Class: Extension::Models::SpecificationHandlers::CheckoutUiExtension

Inherits:
Default
  • Object
show all
Defined in:
lib/project_types/extension/models/specification_handlers/checkout_ui_extension.rb

Constant Summary collapse

L10N_ERROR_PREFIX =
"core.extension.push.checkout_ui_extension.localization.error"
L10N_FILE_SIZE_LIMIT =

16kb

16 * 1024
L10N_BUNDLE_SIZE_LIMIT =

256kb

256 * 1024
LOCALE_CODE_FORMAT =
%r{
\A
(?<language>[a-zA-Z]{2,3}) # Language tag
(?:
 -
 (?<region>[a-zA-Z]{2}) # Optional region subtag
)?
\z}x
PERMITTED_CONFIG_KEYS =
[:extension_points, :metafields, :name, :capabilities]

Instance Attribute Summary

Attributes inherited from Default

#specification

Instance Method Summary collapse

Methods inherited from Default

#argo_runtime, #choose_port?, #cli_package, #create, #establish_tunnel?, #extension_context, #graphql_identifier, #identifier, #initialize, #message_for_extension, #name, #renderer_package, #serve, #server_config_file, #server_config_path, #tagline, #valid_extension_contexts

Constructor Details

This class inherits a constructor from Extension::Models::SpecificationHandlers::Default

Instance Method Details

#build_resource_url(context:, shop:) ⇒ Object



32
33
34
35
36
# File 'lib/project_types/extension/models/specification_handlers/checkout_ui_extension.rb', line 32

def build_resource_url(context:, shop:)
  product = Tasks::GetProduct.call(context, shop)
  return unless product
  format("/cart/%<variant_id>d:%<quantity>d", variant_id: product.variant_id, quantity: 1)
end

#config(context) ⇒ Object



20
21
22
23
24
25
26
# File 'lib/project_types/extension/models/specification_handlers/checkout_ui_extension.rb', line 20

def config(context)
  {
    **Features::ArgoConfig.parse_yaml(context, PERMITTED_CONFIG_KEYS),
    **argo.config(context, include_renderer_version: false),
    **localization(context),
  }
end

#supplies_resource_url?Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/project_types/extension/models/specification_handlers/checkout_ui_extension.rb', line 28

def supplies_resource_url?
  true
end