merchi_sdk_ts 0.0.1-a
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.babelrc +13 -0
- package/.eslintrc.cjs +43 -0
- package/LICENSE +21 -0
- package/README.md +2 -0
- package/dist/constants/auto_assign_production_on_actions.js +7 -0
- package/dist/constants/call_to_actions.js +15 -0
- package/dist/constants/call_to_actions.test.js +4 -0
- package/dist/constants/discount_types.js +4 -0
- package/dist/constants/discount_types.test.js +4 -0
- package/dist/constants/domain_types.js +13 -0
- package/dist/constants/domain_types.test.js +4 -0
- package/dist/constants/errors.js +32 -0
- package/dist/constants/event_types.js +6 -0
- package/dist/constants/event_types.test.js +4 -0
- package/dist/constants/field_types.js +14 -0
- package/dist/constants/field_types.test.js +4 -0
- package/dist/constants/input_types.js +14 -0
- package/dist/constants/input_types.test.js +4 -0
- package/dist/constants/inventory_status.test.js +4 -0
- package/dist/constants/inventory_statuses.js +7 -0
- package/dist/constants/invoice_types.js +6 -0
- package/dist/constants/invoice_types.test.js +4 -0
- package/dist/constants/item_types.js +6 -0
- package/dist/constants/item_types.test.js +4 -0
- package/dist/constants/job/drafting_status.js +8 -0
- package/dist/constants/job/drafting_status.test.js +4 -0
- package/dist/constants/job/payment_status.js +8 -0
- package/dist/constants/job/payment_status.test.js +4 -0
- package/dist/constants/job/production_status.js +13 -0
- package/dist/constants/job/production_status.test.js +4 -0
- package/dist/constants/job/shipment_status.js +12 -0
- package/dist/constants/job/shipment_status.test.js +4 -0
- package/dist/constants/job/supply_chain_request_status.js +7 -0
- package/dist/constants/job/supply_chain_request_status.test.js +4 -0
- package/dist/constants/job_priorities.js +7 -0
- package/dist/constants/job_priorities.test.js +4 -0
- package/dist/constants/job_status.js +50 -0
- package/dist/constants/job_status.test.js +4 -0
- package/dist/constants/job_types.js +16 -0
- package/dist/constants/job_types.test.js +4 -0
- package/dist/constants/notification_sections.js +14 -0
- package/dist/constants/notification_sections.test.js +4 -0
- package/dist/constants/notification_types.js +98 -0
- package/dist/constants/notification_types.test.js +4 -0
- package/dist/constants/notification_urgencies.js +7 -0
- package/dist/constants/notification_urgencies.test.js +4 -0
- package/dist/constants/payment_types.js +11 -0
- package/dist/constants/payment_types.test.js +4 -0
- package/dist/constants/platform.js +5 -0
- package/dist/constants/platform.test.js +8 -0
- package/dist/constants/product_types.js +26 -0
- package/dist/constants/product_types.test.js +4 -0
- package/dist/constants/rights.js +6 -0
- package/dist/constants/rights.test.js +4 -0
- package/dist/constants/robots_meta_directives.js +1 -0
- package/dist/constants/robots_meta_directives.test.js +4 -0
- package/dist/constants/roles.js +25 -0
- package/dist/constants/roles.test.js +4 -0
- package/dist/constants/shipment_companies.js +19 -0
- package/dist/constants/shipment_companies.test.js +4 -0
- package/dist/constants/shipment_services.js +4 -0
- package/dist/constants/shipment_services.test.js +4 -0
- package/dist/constants/system_roles.js +4 -0
- package/dist/constants/system_roles.test.js +4 -0
- package/dist/constants/theme_foundations.js +7 -0
- package/dist/constants/theme_foundations.test.js +4 -0
- package/dist/constants/theme_status.js +6 -0
- package/dist/constants/theme_status.test.js +4 -0
- package/dist/constants/user_types.js +18 -0
- package/dist/constants/user_types.test.js +4 -0
- package/dist/constants/white_label_accessibilities.js +6 -0
- package/dist/constants/white_label_accessibilities.test.js +4 -0
- package/dist/cookie.js +16 -0
- package/dist/cookie.test.js +12 -0
- package/dist/entities/address.js +166 -0
- package/dist/entities/address.test.js +6 -0
- package/dist/entities/assignment.js +185 -0
- package/dist/entities/assignment.test.js +38 -0
- package/dist/entities/automatic_payment_relationship.js +77 -0
- package/dist/entities/automatic_payment_relationship.test.js +6 -0
- package/dist/entities/backup.js +44 -0
- package/dist/entities/backup.test.js +6 -0
- package/dist/entities/bank.js +116 -0
- package/dist/entities/bank.test.js +6 -0
- package/dist/entities/cart.js +203 -0
- package/dist/entities/cart.test.js +52 -0
- package/dist/entities/cart_item.js +153 -0
- package/dist/entities/cart_item.test.js +34 -0
- package/dist/entities/cart_shipment_group.js +62 -0
- package/dist/entities/cart_shipment_quote.js +85 -0
- package/dist/entities/category.js +92 -0
- package/dist/entities/category.test.js +52 -0
- package/dist/entities/company.js +648 -0
- package/dist/entities/company.test.js +6 -0
- package/dist/entities/company_invitation.js +82 -0
- package/dist/entities/company_invitation.test.js +6 -0
- package/dist/entities/component.js +209 -0
- package/dist/entities/component.test.js +12 -0
- package/dist/entities/component_tag.js +50 -0
- package/dist/entities/component_tag.test.js +6 -0
- package/dist/entities/component_version.js +80 -0
- package/dist/entities/component_version.test.js +6 -0
- package/dist/entities/country_tax.js +110 -0
- package/dist/entities/country_tax.test.js +11 -0
- package/dist/entities/discount.js +77 -0
- package/dist/entities/discount.test.js +20 -0
- package/dist/entities/discount_group.js +74 -0
- package/dist/entities/discount_group.test.js +6 -0
- package/dist/entities/domain.js +535 -0
- package/dist/entities/domain.test.js +75 -0
- package/dist/entities/domain_invitation.js +90 -0
- package/dist/entities/domain_invitation.test.js +6 -0
- package/dist/entities/domain_tag.js +100 -0
- package/dist/entities/domain_tag.test.js +6 -0
- package/dist/entities/draft.js +180 -0
- package/dist/entities/draft.test.js +39 -0
- package/dist/entities/draft_comment.js +132 -0
- package/dist/entities/draft_comment.test.js +6 -0
- package/dist/entities/draft_template.js +105 -0
- package/dist/entities/draft_template.test.js +6 -0
- package/dist/entities/email_address.js +68 -0
- package/dist/entities/email_address.test.js +6 -0
- package/dist/entities/email_counter.js +56 -0
- package/dist/entities/email_counter.test.js +6 -0
- package/dist/entities/enrolled_domain.js +85 -0
- package/dist/entities/enrolled_domain.test.js +6 -0
- package/dist/entities/exchange_rate.js +62 -0
- package/dist/entities/exchange_rate.test.js +6 -0
- package/dist/entities/file.js +383 -0
- package/dist/entities/file.test.js +38 -0
- package/dist/entities/internal_tag.js +120 -0
- package/dist/entities/internal_tag.test.js +6 -0
- package/dist/entities/inventory.js +120 -0
- package/dist/entities/inventory.test.js +26 -0
- package/dist/entities/inventory_unit_variation.js +64 -0
- package/dist/entities/inventory_unit_variation.test.js +6 -0
- package/dist/entities/invoice.js +420 -0
- package/dist/entities/invoice.test.js +39 -0
- package/dist/entities/item.js +102 -0
- package/dist/entities/item.test.js +17 -0
- package/dist/entities/job.js +744 -0
- package/dist/entities/job.test.js +103 -0
- package/dist/entities/job_comment.js +120 -0
- package/dist/entities/job_comment.test.js +6 -0
- package/dist/entities/matching_inventory.js +77 -0
- package/dist/entities/menu.js +78 -0
- package/dist/entities/menu.test.js +6 -0
- package/dist/entities/menu_item.js +76 -0
- package/dist/entities/menu_item.test.js +6 -0
- package/dist/entities/notification.js +234 -0
- package/dist/entities/notification.test.js +6 -0
- package/dist/entities/page.js +84 -0
- package/dist/entities/page.test.js +6 -0
- package/dist/entities/payment.js +141 -0
- package/dist/entities/payment.test.js +18 -0
- package/dist/entities/payment_device.js +87 -0
- package/dist/entities/payment_device.test.js +6 -0
- package/dist/entities/phone_number.js +98 -0
- package/dist/entities/phone_number.test.js +6 -0
- package/dist/entities/product.js +806 -0
- package/dist/entities/product.test.js +811 -0
- package/dist/entities/production_comment.js +120 -0
- package/dist/entities/production_comment.test.js +6 -0
- package/dist/entities/quote.js +208 -0
- package/dist/entities/quote.test.js +107 -0
- package/dist/entities/quote_item.js +121 -0
- package/dist/entities/quote_item.test.js +56 -0
- package/dist/entities/seo_domain_page.js +82 -0
- package/dist/entities/seo_domain_page.test.js +6 -0
- package/dist/entities/session.js +77 -0
- package/dist/entities/session.test.js +6 -0
- package/dist/entities/shipment.js +401 -0
- package/dist/entities/shipment.test.js +28 -0
- package/dist/entities/shipment_item.js +49 -0
- package/dist/entities/shipment_item.test.js +6 -0
- package/dist/entities/shipment_item_fulfillment.js +48 -0
- package/dist/entities/shipment_item_fulfillment.test.js +6 -0
- package/dist/entities/shipment_method.js +146 -0
- package/dist/entities/shipment_method.test.js +6 -0
- package/dist/entities/shipment_method_variation.js +104 -0
- package/dist/entities/shipment_method_variation.test.js +6 -0
- package/dist/entities/short_url.js +95 -0
- package/dist/entities/short_url.test.js +6 -0
- package/dist/entities/subscription_plan.js +172 -0
- package/dist/entities/subscription_plan.test.js +6 -0
- package/dist/entities/supply_domain.js +73 -0
- package/dist/entities/supply_domain.test.js +6 -0
- package/dist/entities/system_role.js +50 -0
- package/dist/entities/system_role.test.js +6 -0
- package/dist/entities/theme.js +614 -0
- package/dist/entities/theme.test.js +39 -0
- package/dist/entities/theme_css_setting.js +67 -0
- package/dist/entities/theme_css_setting.test.js +6 -0
- package/dist/entities/user.js +749 -0
- package/dist/entities/user.test.js +157 -0
- package/dist/entities/user_company.js +78 -0
- package/dist/entities/user_company.test.js +6 -0
- package/dist/entities/variation.js +147 -0
- package/dist/entities/variation.test.js +6 -0
- package/dist/entities/variation_field.js +313 -0
- package/dist/entities/variation_field.test.js +69 -0
- package/dist/entities/variation_fields_option.js +190 -0
- package/dist/entities/variation_fields_option.test.js +47 -0
- package/dist/entities/variation_option.js +129 -0
- package/dist/entities/variation_option.test.js +6 -0
- package/dist/entities/variations_group.js +111 -0
- package/dist/entities/variations_group.test.js +6 -0
- package/dist/entity.js +888 -0
- package/dist/merchi.js +259 -0
- package/dist/merchi.test.js +35 -0
- package/dist/request.js +132 -0
- package/dist/request.test.js +46 -0
- package/dist/test_util.js +19 -0
- package/dist/toasts.js +27 -0
- package/dist/toasts.test.js +46 -0
- package/dist/util/float.js +24 -0
- package/dist/util/query_string.js +11 -0
- package/dist/util/query_string.test.js +6 -0
- package/dist/util/validation.js +3 -0
- package/dist/util/validation.test.js +12 -0
- package/dist/uuid.js +8 -0
- package/dist/uuid.test.js +13 -0
- package/jest.config.js +17 -0
- package/package.json +44 -0
- package/src/constants/auto_assign_production_on_actions.ts +6 -0
- package/src/constants/call_to_actions.test.ts +5 -0
- package/src/constants/call_to_actions.ts +14 -0
- package/src/constants/discount_types.test.ts +5 -0
- package/src/constants/discount_types.ts +3 -0
- package/src/constants/domain_types.test.ts +5 -0
- package/src/constants/domain_types.ts +12 -0
- package/src/constants/errors.ts +32 -0
- package/src/constants/event_types.test.ts +5 -0
- package/src/constants/event_types.ts +5 -0
- package/src/constants/field_types.test.ts +5 -0
- package/src/constants/field_types.ts +13 -0
- package/src/constants/input_types.test.ts +5 -0
- package/src/constants/input_types.ts +13 -0
- package/src/constants/inventory_status.test.ts +5 -0
- package/src/constants/inventory_statuses.ts +6 -0
- package/src/constants/invoice_types.test.ts +5 -0
- package/src/constants/invoice_types.ts +5 -0
- package/src/constants/item_types.test.ts +5 -0
- package/src/constants/item_types.ts +5 -0
- package/src/constants/job/drafting_status.test.ts +5 -0
- package/src/constants/job/drafting_status.ts +7 -0
- package/src/constants/job/payment_status.test.ts +5 -0
- package/src/constants/job/payment_status.ts +7 -0
- package/src/constants/job/production_status.test.ts +5 -0
- package/src/constants/job/production_status.ts +12 -0
- package/src/constants/job/shipment_status.test.ts +5 -0
- package/src/constants/job/shipment_status.ts +11 -0
- package/src/constants/job/supply_chain_request_status.test.ts +5 -0
- package/src/constants/job/supply_chain_request_status.ts +6 -0
- package/src/constants/job_priorities.test.ts +5 -0
- package/src/constants/job_priorities.ts +6 -0
- package/src/constants/job_status.test.ts +5 -0
- package/src/constants/job_status.ts +49 -0
- package/src/constants/job_types.test.ts +5 -0
- package/src/constants/job_types.ts +15 -0
- package/src/constants/notification_sections.test.ts +5 -0
- package/src/constants/notification_sections.ts +13 -0
- package/src/constants/notification_types.test.ts +5 -0
- package/src/constants/notification_types.ts +97 -0
- package/src/constants/notification_urgencies.test.ts +5 -0
- package/src/constants/notification_urgencies.ts +7 -0
- package/src/constants/payment_types.test.ts +5 -0
- package/src/constants/payment_types.ts +10 -0
- package/src/constants/platform.test.ts +15 -0
- package/src/constants/platform.ts +6 -0
- package/src/constants/product_types.test.ts +6 -0
- package/src/constants/product_types.ts +25 -0
- package/src/constants/rights.test.ts +5 -0
- package/src/constants/rights.ts +5 -0
- package/src/constants/robots_meta_directives.test.ts +5 -0
- package/src/constants/robots_meta_directives.ts +11 -0
- package/src/constants/roles.test.ts +5 -0
- package/src/constants/roles.ts +38 -0
- package/src/constants/shipment_companies.test.ts +5 -0
- package/src/constants/shipment_companies.ts +18 -0
- package/src/constants/shipment_services.test.ts +5 -0
- package/src/constants/shipment_services.ts +3 -0
- package/src/constants/system_roles.test.ts +5 -0
- package/src/constants/system_roles.ts +3 -0
- package/src/constants/theme_foundations.test.ts +5 -0
- package/src/constants/theme_foundations.ts +6 -0
- package/src/constants/theme_status.test.ts +5 -0
- package/src/constants/theme_status.ts +5 -0
- package/src/constants/user_types.test.ts +5 -0
- package/src/constants/user_types.ts +17 -0
- package/src/constants/white_label_accessibilities.test.ts +5 -0
- package/src/constants/white_label_accessibilities.ts +6 -0
- package/src/cookie.test.ts +11 -0
- package/src/cookie.ts +16 -0
- package/src/entities/address.test.ts +7 -0
- package/src/entities/address.ts +65 -0
- package/src/entities/assignment.test.ts +39 -0
- package/src/entities/assignment.ts +92 -0
- package/src/entities/automatic_payment_relationship.test.ts +8 -0
- package/src/entities/automatic_payment_relationship.ts +26 -0
- package/src/entities/backup.test.ts +7 -0
- package/src/entities/backup.ts +14 -0
- package/src/entities/bank.test.ts +7 -0
- package/src/entities/bank.ts +45 -0
- package/src/entities/cart.test.ts +50 -0
- package/src/entities/cart.ts +89 -0
- package/src/entities/cart_item.test.ts +33 -0
- package/src/entities/cart_item.ts +77 -0
- package/src/entities/cart_shipment_group.ts +21 -0
- package/src/entities/cart_shipment_quote.ts +33 -0
- package/src/entities/category.test.ts +57 -0
- package/src/entities/category.ts +37 -0
- package/src/entities/company.test.ts +7 -0
- package/src/entities/company.ts +275 -0
- package/src/entities/company_invitation.test.ts +7 -0
- package/src/entities/company_invitation.ts +33 -0
- package/src/entities/component.test.ts +14 -0
- package/src/entities/component.ts +92 -0
- package/src/entities/component_tag.test.ts +7 -0
- package/src/entities/component_tag.ts +17 -0
- package/src/entities/component_version.test.ts +7 -0
- package/src/entities/component_version.ts +30 -0
- package/src/entities/country_tax.test.ts +13 -0
- package/src/entities/country_tax.ts +46 -0
- package/src/entities/discount.test.ts +18 -0
- package/src/entities/discount.ts +34 -0
- package/src/entities/discount_group.test.ts +7 -0
- package/src/entities/discount_group.ts +28 -0
- package/src/entities/domain.test.ts +79 -0
- package/src/entities/domain.ts +246 -0
- package/src/entities/domain_invitation.test.ts +7 -0
- package/src/entities/domain_invitation.ts +36 -0
- package/src/entities/domain_tag.test.ts +7 -0
- package/src/entities/domain_tag.ts +42 -0
- package/src/entities/draft.test.ts +43 -0
- package/src/entities/draft.ts +88 -0
- package/src/entities/draft_comment.test.ts +7 -0
- package/src/entities/draft_comment.ts +54 -0
- package/src/entities/draft_template.test.ts +7 -0
- package/src/entities/draft_template.ts +40 -0
- package/src/entities/email_address.test.ts +7 -0
- package/src/entities/email_address.ts +24 -0
- package/src/entities/email_counter.test.ts +7 -0
- package/src/entities/email_counter.ts +20 -0
- package/src/entities/enrolled_domain.test.ts +7 -0
- package/src/entities/enrolled_domain.ts +40 -0
- package/src/entities/exchange_rate.test.ts +7 -0
- package/src/entities/exchange_rate.ts +22 -0
- package/src/entities/file.test.ts +43 -0
- package/src/entities/file.ts +172 -0
- package/src/entities/internal_tag.test.ts +7 -0
- package/src/entities/internal_tag.ts +51 -0
- package/src/entities/inventory.test.ts +28 -0
- package/src/entities/inventory.ts +56 -0
- package/src/entities/inventory_unit_variation.test.ts +7 -0
- package/src/entities/inventory_unit_variation.ts +29 -0
- package/src/entities/invoice.test.ts +43 -0
- package/src/entities/invoice.ts +179 -0
- package/src/entities/item.test.ts +19 -0
- package/src/entities/item.ts +44 -0
- package/src/entities/job.test.ts +95 -0
- package/src/entities/job.ts +349 -0
- package/src/entities/job_comment.test.ts +7 -0
- package/src/entities/job_comment.ts +50 -0
- package/src/entities/matching_inventory.ts +29 -0
- package/src/entities/menu.test.ts +7 -0
- package/src/entities/menu.ts +30 -0
- package/src/entities/menu_item.test.ts +7 -0
- package/src/entities/menu_item.ts +29 -0
- package/src/entities/notification.test.ts +7 -0
- package/src/entities/notification.ts +99 -0
- package/src/entities/page.test.ts +7 -0
- package/src/entities/page.ts +32 -0
- package/src/entities/payment.test.ts +19 -0
- package/src/entities/payment.ts +65 -0
- package/src/entities/payment_device.test.ts +7 -0
- package/src/entities/payment_device.ts +30 -0
- package/src/entities/phone_number.test.ts +7 -0
- package/src/entities/phone_number.ts +36 -0
- package/src/entities/product.test.ts +750 -0
- package/src/entities/product.ts +427 -0
- package/src/entities/production_comment.test.ts +7 -0
- package/src/entities/production_comment.ts +50 -0
- package/src/entities/quote.test.ts +98 -0
- package/src/entities/quote.ts +140 -0
- package/src/entities/quote_item.test.ts +50 -0
- package/src/entities/quote_item.ts +71 -0
- package/src/entities/seo_domain_page.test.ts +7 -0
- package/src/entities/seo_domain_page.ts +33 -0
- package/src/entities/session.test.ts +7 -0
- package/src/entities/session.ts +28 -0
- package/src/entities/shipment.test.ts +24 -0
- package/src/entities/shipment.ts +185 -0
- package/src/entities/shipment_item.test.ts +7 -0
- package/src/entities/shipment_item.ts +15 -0
- package/src/entities/shipment_item_fulfillment.test.ts +8 -0
- package/src/entities/shipment_item_fulfillment.ts +15 -0
- package/src/entities/shipment_method.test.ts +7 -0
- package/src/entities/shipment_method.ts +61 -0
- package/src/entities/shipment_method_variation.test.ts +7 -0
- package/src/entities/shipment_method_variation.ts +39 -0
- package/src/entities/short_url.test.ts +7 -0
- package/src/entities/short_url.ts +36 -0
- package/src/entities/subscription_plan.test.ts +7 -0
- package/src/entities/subscription_plan.ts +73 -0
- package/src/entities/supply_domain.test.ts +7 -0
- package/src/entities/supply_domain.ts +27 -0
- package/src/entities/system_role.test.ts +7 -0
- package/src/entities/system_role.ts +17 -0
- package/src/entities/theme.test.ts +38 -0
- package/src/entities/theme.ts +267 -0
- package/src/entities/theme_css_setting.test.ts +7 -0
- package/src/entities/theme_css_setting.ts +23 -0
- package/src/entities/user.test.ts +154 -0
- package/src/entities/user.ts +394 -0
- package/src/entities/user_company.test.ts +7 -0
- package/src/entities/user_company.ts +27 -0
- package/src/entities/variation.test.ts +7 -0
- package/src/entities/variation.ts +61 -0
- package/src/entities/variation_field.test.ts +76 -0
- package/src/entities/variation_field.ts +169 -0
- package/src/entities/variation_fields_option.test.ts +46 -0
- package/src/entities/variation_fields_option.ts +95 -0
- package/src/entities/variation_option.test.ts +7 -0
- package/src/entities/variation_option.ts +52 -0
- package/src/entities/variations_group.test.ts +7 -0
- package/src/entities/variations_group.ts +41 -0
- package/src/entity.ts +1002 -0
- package/src/merchi.test.ts +25 -0
- package/src/merchi.ts +379 -0
- package/src/request.test.ts +43 -0
- package/src/request.ts +124 -0
- package/src/test_util.ts +18 -0
- package/src/toasts.test.ts +38 -0
- package/src/toasts.ts +34 -0
- package/src/util/float.ts +12 -0
- package/src/util/query_string.test.ts +7 -0
- package/src/util/query_string.ts +11 -0
- package/src/util/validation.test.ts +16 -0
- package/src/util/validation.ts +2 -0
- package/src/uuid.test.ts +15 -0
- package/src/uuid.ts +8 -0
- package/tsconfig.json +23 -0
- package/webpack.config.cjs +27 -0
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
var _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _dec8, _dec9, _dec10, _dec11, _dec12, _dec13, _dec14, _dec15, _dec16, _dec17, _dec18, _dec19, _dec20, _dec21, _dec22, _dec23, _dec24, _dec25, _dec26, _dec27, _dec28, _dec29, _dec30, _dec31, _dec32, _dec33, _class, _descriptor, _descriptor2, _descriptor3, _descriptor4, _descriptor5, _descriptor6, _descriptor7, _descriptor8, _descriptor9, _descriptor10, _descriptor11, _descriptor12, _descriptor13, _descriptor14, _descriptor15, _descriptor16, _descriptor17, _descriptor18, _descriptor19, _descriptor20, _descriptor21, _descriptor22, _descriptor23, _descriptor24, _descriptor25, _descriptor26, _descriptor27, _descriptor28, _descriptor29, _descriptor30, _descriptor31, _descriptor32, _descriptor33, _VariationField;
|
|
3
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
4
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
5
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
6
|
+
function _initializerDefineProperty(target, property, descriptor, context) { if (!descriptor) return; Object.defineProperty(target, property, { enumerable: descriptor.enumerable, configurable: descriptor.configurable, writable: descriptor.writable, value: descriptor.initializer ? descriptor.initializer.call(context) : void 0 }); }
|
|
7
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
8
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
9
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
10
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
11
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
12
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
13
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
14
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
15
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
16
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
17
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
18
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
19
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
20
|
+
function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) { var desc = {}; Object.keys(descriptor).forEach(function (key) { desc[key] = descriptor[key]; }); desc.enumerable = !!desc.enumerable; desc.configurable = !!desc.configurable; if ('value' in desc || desc.initializer) { desc.writable = true; } desc = decorators.slice().reverse().reduce(function (desc, decorator) { return decorator(target, property, desc) || desc; }, desc); if (context && desc.initializer !== void 0) { desc.value = desc.initializer ? desc.initializer.call(context) : void 0; desc.initializer = undefined; } if (desc.initializer === void 0) { Object.defineProperty(target, property, desc); desc = null; } return desc; }
|
|
21
|
+
function _initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that ' + 'transform-class-properties is enabled and runs after the decorators transform.'); }
|
|
22
|
+
import { cloneDeepWith } from 'lodash';
|
|
23
|
+
import { Entity } from '../entity';
|
|
24
|
+
import { FieldType } from '../constants/field_types';
|
|
25
|
+
export var VariationField = (_dec = VariationField.property({
|
|
26
|
+
type: Date
|
|
27
|
+
}), _dec2 = VariationField.property(), _dec3 = VariationField.property(), _dec4 = VariationField.property(), _dec5 = VariationField.property(), _dec6 = VariationField.property(), _dec7 = VariationField.property({
|
|
28
|
+
type: String
|
|
29
|
+
}), _dec8 = VariationField.property(), _dec9 = VariationField.property(), _dec10 = VariationField.property(), _dec11 = VariationField.property(), _dec12 = VariationField.property(), _dec13 = VariationField.property({
|
|
30
|
+
type: 'DiscountGroup'
|
|
31
|
+
}), _dec14 = VariationField.property(), _dec15 = VariationField.property({
|
|
32
|
+
embeddedByDefault: false
|
|
33
|
+
}), _dec16 = VariationField.property({
|
|
34
|
+
embeddedByDefault: false
|
|
35
|
+
}), _dec17 = VariationField.property({
|
|
36
|
+
type: 'DiscountGroup'
|
|
37
|
+
}), _dec18 = VariationField.property(), _dec19 = VariationField.property({
|
|
38
|
+
type: Number
|
|
39
|
+
}), _dec20 = VariationField.property({
|
|
40
|
+
type: Number
|
|
41
|
+
}), _dec21 = VariationField.property(), _dec22 = VariationField.property(), _dec23 = VariationField.property(), _dec24 = VariationField.property(), _dec25 = VariationField.property(), _dec26 = VariationField.property(), _dec27 = VariationField.property(), _dec28 = VariationField.property(), _dec29 = VariationField.property(), _dec30 = VariationField.property(), _dec31 = VariationField.property(), _dec32 = VariationField.property({
|
|
42
|
+
arrayType: 'Variation'
|
|
43
|
+
}), _dec33 = VariationField.property({
|
|
44
|
+
arrayType: 'VariationFieldsOption'
|
|
45
|
+
}), (_class = (_VariationField = /*#__PURE__*/function (_Entity) {
|
|
46
|
+
_inherits(VariationField, _Entity);
|
|
47
|
+
function VariationField() {
|
|
48
|
+
var _this;
|
|
49
|
+
_classCallCheck(this, VariationField);
|
|
50
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
51
|
+
args[_key] = arguments[_key];
|
|
52
|
+
}
|
|
53
|
+
_this = _callSuper(this, VariationField, [].concat(args));
|
|
54
|
+
_initializerDefineProperty(_assertThisInitialized(_this), "archived", _descriptor, _assertThisInitialized(_this));
|
|
55
|
+
_initializerDefineProperty(_assertThisInitialized(_this), "id", _descriptor2, _assertThisInitialized(_this));
|
|
56
|
+
_initializerDefineProperty(_assertThisInitialized(_this), "position", _descriptor3, _assertThisInitialized(_this));
|
|
57
|
+
_initializerDefineProperty(_assertThisInitialized(_this), "required", _descriptor4, _assertThisInitialized(_this));
|
|
58
|
+
_initializerDefineProperty(_assertThisInitialized(_this), "independent", _descriptor5, _assertThisInitialized(_this));
|
|
59
|
+
_initializerDefineProperty(_assertThisInitialized(_this), "name", _descriptor6, _assertThisInitialized(_this));
|
|
60
|
+
_initializerDefineProperty(_assertThisInitialized(_this), "placeholder", _descriptor7, _assertThisInitialized(_this));
|
|
61
|
+
_initializerDefineProperty(_assertThisInitialized(_this), "defaultValue", _descriptor8, _assertThisInitialized(_this));
|
|
62
|
+
_initializerDefineProperty(_assertThisInitialized(_this), "currency", _descriptor9, _assertThisInitialized(_this));
|
|
63
|
+
_initializerDefineProperty(_assertThisInitialized(_this), "fieldType", _descriptor10, _assertThisInitialized(_this));
|
|
64
|
+
_initializerDefineProperty(_assertThisInitialized(_this), "margin", _descriptor11, _assertThisInitialized(_this));
|
|
65
|
+
_initializerDefineProperty(_assertThisInitialized(_this), "variationCost", _descriptor12, _assertThisInitialized(_this));
|
|
66
|
+
_initializerDefineProperty(_assertThisInitialized(_this), "variationCostDiscountGroup", _descriptor13, _assertThisInitialized(_this));
|
|
67
|
+
_initializerDefineProperty(_assertThisInitialized(_this), "variationUnitCost", _descriptor14, _assertThisInitialized(_this));
|
|
68
|
+
_initializerDefineProperty(_assertThisInitialized(_this), "buyUnitCost", _descriptor15, _assertThisInitialized(_this));
|
|
69
|
+
_initializerDefineProperty(_assertThisInitialized(_this), "buyCost", _descriptor16, _assertThisInitialized(_this));
|
|
70
|
+
_initializerDefineProperty(_assertThisInitialized(_this), "variationUnitCostDiscountGroup", _descriptor17, _assertThisInitialized(_this));
|
|
71
|
+
_initializerDefineProperty(_assertThisInitialized(_this), "rows", _descriptor18, _assertThisInitialized(_this));
|
|
72
|
+
_initializerDefineProperty(_assertThisInitialized(_this), "fieldMin", _descriptor19, _assertThisInitialized(_this));
|
|
73
|
+
_initializerDefineProperty(_assertThisInitialized(_this), "fieldMax", _descriptor20, _assertThisInitialized(_this));
|
|
74
|
+
_initializerDefineProperty(_assertThisInitialized(_this), "allowDecimal", _descriptor21, _assertThisInitialized(_this));
|
|
75
|
+
_initializerDefineProperty(_assertThisInitialized(_this), "sellerProductEditable", _descriptor22, _assertThisInitialized(_this));
|
|
76
|
+
_initializerDefineProperty(_assertThisInitialized(_this), "multipleSelect", _descriptor23, _assertThisInitialized(_this));
|
|
77
|
+
_initializerDefineProperty(_assertThisInitialized(_this), "showFilePreview", _descriptor24, _assertThisInitialized(_this));
|
|
78
|
+
_initializerDefineProperty(_assertThisInitialized(_this), "allowFileMultiple", _descriptor25, _assertThisInitialized(_this));
|
|
79
|
+
_initializerDefineProperty(_assertThisInitialized(_this), "allowFileJpeg", _descriptor26, _assertThisInitialized(_this));
|
|
80
|
+
_initializerDefineProperty(_assertThisInitialized(_this), "allowFileGif", _descriptor27, _assertThisInitialized(_this));
|
|
81
|
+
_initializerDefineProperty(_assertThisInitialized(_this), "allowFilePdf", _descriptor28, _assertThisInitialized(_this));
|
|
82
|
+
_initializerDefineProperty(_assertThisInitialized(_this), "allowFilePng", _descriptor29, _assertThisInitialized(_this));
|
|
83
|
+
_initializerDefineProperty(_assertThisInitialized(_this), "allowFileAi", _descriptor30, _assertThisInitialized(_this));
|
|
84
|
+
_initializerDefineProperty(_assertThisInitialized(_this), "product", _descriptor31, _assertThisInitialized(_this));
|
|
85
|
+
_initializerDefineProperty(_assertThisInitialized(_this), "variations", _descriptor32, _assertThisInitialized(_this));
|
|
86
|
+
_initializerDefineProperty(_assertThisInitialized(_this), "options", _descriptor33, _assertThisInitialized(_this));
|
|
87
|
+
_defineProperty(_assertThisInitialized(_this), "isSelectable", function () {
|
|
88
|
+
if (_this.fieldType === undefined) {
|
|
89
|
+
throw new Error('fieldType is undefined, did you forget to embed it?');
|
|
90
|
+
}
|
|
91
|
+
var selectable = new Set([FieldType.SELECT, FieldType.CHECKBOX, FieldType.RADIO, FieldType.IMAGE_SELECT, FieldType.COLOUR_SELECT]);
|
|
92
|
+
return selectable.has(_this.fieldType);
|
|
93
|
+
});
|
|
94
|
+
_defineProperty(_assertThisInitialized(_this), "buildEmptyVariation", function () {
|
|
95
|
+
if (_this.defaultValue === undefined) {
|
|
96
|
+
throw new Error('defaultValue is undefined, did you forget to embed it?');
|
|
97
|
+
}
|
|
98
|
+
if (_this.variationCost === undefined) {
|
|
99
|
+
var err = 'variationCost is undefined, did you forget to embed it?';
|
|
100
|
+
throw new Error(err);
|
|
101
|
+
}
|
|
102
|
+
if (_this.options === undefined) {
|
|
103
|
+
throw new Error('options is undefined, did you forget to embed it?');
|
|
104
|
+
}
|
|
105
|
+
var result = new _this.merchi.Variation(_this.merchi);
|
|
106
|
+
result.selectableOptions = [];
|
|
107
|
+
if (_this.isSelectable()) {
|
|
108
|
+
var onceOffCost = 0;
|
|
109
|
+
var value = [];
|
|
110
|
+
var _iterator = _createForOfIteratorHelper(_this.options),
|
|
111
|
+
_step;
|
|
112
|
+
try {
|
|
113
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
114
|
+
var option = _step.value;
|
|
115
|
+
if (_this.sellerProductEditable && option.include || !_this.sellerProductEditable && option["default"]) {
|
|
116
|
+
if (option.variationCost === undefined) {
|
|
117
|
+
throw new Error('option.variationCost is undefined, did you ' + 'forget to embed it?');
|
|
118
|
+
}
|
|
119
|
+
value.push(option.id);
|
|
120
|
+
onceOffCost += option.variationCost;
|
|
121
|
+
}
|
|
122
|
+
result.selectableOptions.push(option.buildVariationOption());
|
|
123
|
+
}
|
|
124
|
+
} catch (err) {
|
|
125
|
+
_iterator.e(err);
|
|
126
|
+
} finally {
|
|
127
|
+
_iterator.f();
|
|
128
|
+
}
|
|
129
|
+
result.value = value.join();
|
|
130
|
+
result.onceOffCost = onceOffCost;
|
|
131
|
+
} else {
|
|
132
|
+
result.value = _this.defaultValue;
|
|
133
|
+
result.onceOffCost = _this.variationCost;
|
|
134
|
+
}
|
|
135
|
+
result.unitCostTotal = 0;
|
|
136
|
+
result.cost = result.onceOffCost;
|
|
137
|
+
function customiser(value, index) {
|
|
138
|
+
if (index === 'merchi') {
|
|
139
|
+
return value;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
result.variationField = cloneDeepWith(_assertThisInitialized(_this), customiser);
|
|
143
|
+
return result;
|
|
144
|
+
});
|
|
145
|
+
return _this;
|
|
146
|
+
}
|
|
147
|
+
return _createClass(VariationField);
|
|
148
|
+
}(Entity), _defineProperty(_VariationField, "resourceName", 'variation_fields'), _defineProperty(_VariationField, "singularName", 'variationField'), _defineProperty(_VariationField, "pluralName", 'variationFields'), _VariationField), (_descriptor = _applyDecoratedDescriptor(_class.prototype, "archived", [_dec], {
|
|
149
|
+
configurable: true,
|
|
150
|
+
enumerable: true,
|
|
151
|
+
writable: true,
|
|
152
|
+
initializer: null
|
|
153
|
+
}), _descriptor2 = _applyDecoratedDescriptor(_class.prototype, "id", [_dec2], {
|
|
154
|
+
configurable: true,
|
|
155
|
+
enumerable: true,
|
|
156
|
+
writable: true,
|
|
157
|
+
initializer: null
|
|
158
|
+
}), _descriptor3 = _applyDecoratedDescriptor(_class.prototype, "position", [_dec3], {
|
|
159
|
+
configurable: true,
|
|
160
|
+
enumerable: true,
|
|
161
|
+
writable: true,
|
|
162
|
+
initializer: null
|
|
163
|
+
}), _descriptor4 = _applyDecoratedDescriptor(_class.prototype, "required", [_dec4], {
|
|
164
|
+
configurable: true,
|
|
165
|
+
enumerable: true,
|
|
166
|
+
writable: true,
|
|
167
|
+
initializer: null
|
|
168
|
+
}), _descriptor5 = _applyDecoratedDescriptor(_class.prototype, "independent", [_dec5], {
|
|
169
|
+
configurable: true,
|
|
170
|
+
enumerable: true,
|
|
171
|
+
writable: true,
|
|
172
|
+
initializer: null
|
|
173
|
+
}), _descriptor6 = _applyDecoratedDescriptor(_class.prototype, "name", [_dec6], {
|
|
174
|
+
configurable: true,
|
|
175
|
+
enumerable: true,
|
|
176
|
+
writable: true,
|
|
177
|
+
initializer: null
|
|
178
|
+
}), _descriptor7 = _applyDecoratedDescriptor(_class.prototype, "placeholder", [_dec7], {
|
|
179
|
+
configurable: true,
|
|
180
|
+
enumerable: true,
|
|
181
|
+
writable: true,
|
|
182
|
+
initializer: null
|
|
183
|
+
}), _descriptor8 = _applyDecoratedDescriptor(_class.prototype, "defaultValue", [_dec8], {
|
|
184
|
+
configurable: true,
|
|
185
|
+
enumerable: true,
|
|
186
|
+
writable: true,
|
|
187
|
+
initializer: null
|
|
188
|
+
}), _descriptor9 = _applyDecoratedDescriptor(_class.prototype, "currency", [_dec9], {
|
|
189
|
+
configurable: true,
|
|
190
|
+
enumerable: true,
|
|
191
|
+
writable: true,
|
|
192
|
+
initializer: null
|
|
193
|
+
}), _descriptor10 = _applyDecoratedDescriptor(_class.prototype, "fieldType", [_dec10], {
|
|
194
|
+
configurable: true,
|
|
195
|
+
enumerable: true,
|
|
196
|
+
writable: true,
|
|
197
|
+
initializer: null
|
|
198
|
+
}), _descriptor11 = _applyDecoratedDescriptor(_class.prototype, "margin", [_dec11], {
|
|
199
|
+
configurable: true,
|
|
200
|
+
enumerable: true,
|
|
201
|
+
writable: true,
|
|
202
|
+
initializer: null
|
|
203
|
+
}), _descriptor12 = _applyDecoratedDescriptor(_class.prototype, "variationCost", [_dec12], {
|
|
204
|
+
configurable: true,
|
|
205
|
+
enumerable: true,
|
|
206
|
+
writable: true,
|
|
207
|
+
initializer: null
|
|
208
|
+
}), _descriptor13 = _applyDecoratedDescriptor(_class.prototype, "variationCostDiscountGroup", [_dec13], {
|
|
209
|
+
configurable: true,
|
|
210
|
+
enumerable: true,
|
|
211
|
+
writable: true,
|
|
212
|
+
initializer: null
|
|
213
|
+
}), _descriptor14 = _applyDecoratedDescriptor(_class.prototype, "variationUnitCost", [_dec14], {
|
|
214
|
+
configurable: true,
|
|
215
|
+
enumerable: true,
|
|
216
|
+
writable: true,
|
|
217
|
+
initializer: null
|
|
218
|
+
}), _descriptor15 = _applyDecoratedDescriptor(_class.prototype, "buyUnitCost", [_dec15], {
|
|
219
|
+
configurable: true,
|
|
220
|
+
enumerable: true,
|
|
221
|
+
writable: true,
|
|
222
|
+
initializer: null
|
|
223
|
+
}), _descriptor16 = _applyDecoratedDescriptor(_class.prototype, "buyCost", [_dec16], {
|
|
224
|
+
configurable: true,
|
|
225
|
+
enumerable: true,
|
|
226
|
+
writable: true,
|
|
227
|
+
initializer: null
|
|
228
|
+
}), _descriptor17 = _applyDecoratedDescriptor(_class.prototype, "variationUnitCostDiscountGroup", [_dec17], {
|
|
229
|
+
configurable: true,
|
|
230
|
+
enumerable: true,
|
|
231
|
+
writable: true,
|
|
232
|
+
initializer: null
|
|
233
|
+
}), _descriptor18 = _applyDecoratedDescriptor(_class.prototype, "rows", [_dec18], {
|
|
234
|
+
configurable: true,
|
|
235
|
+
enumerable: true,
|
|
236
|
+
writable: true,
|
|
237
|
+
initializer: null
|
|
238
|
+
}), _descriptor19 = _applyDecoratedDescriptor(_class.prototype, "fieldMin", [_dec19], {
|
|
239
|
+
configurable: true,
|
|
240
|
+
enumerable: true,
|
|
241
|
+
writable: true,
|
|
242
|
+
initializer: null
|
|
243
|
+
}), _descriptor20 = _applyDecoratedDescriptor(_class.prototype, "fieldMax", [_dec20], {
|
|
244
|
+
configurable: true,
|
|
245
|
+
enumerable: true,
|
|
246
|
+
writable: true,
|
|
247
|
+
initializer: null
|
|
248
|
+
}), _descriptor21 = _applyDecoratedDescriptor(_class.prototype, "allowDecimal", [_dec21], {
|
|
249
|
+
configurable: true,
|
|
250
|
+
enumerable: true,
|
|
251
|
+
writable: true,
|
|
252
|
+
initializer: null
|
|
253
|
+
}), _descriptor22 = _applyDecoratedDescriptor(_class.prototype, "sellerProductEditable", [_dec22], {
|
|
254
|
+
configurable: true,
|
|
255
|
+
enumerable: true,
|
|
256
|
+
writable: true,
|
|
257
|
+
initializer: null
|
|
258
|
+
}), _descriptor23 = _applyDecoratedDescriptor(_class.prototype, "multipleSelect", [_dec23], {
|
|
259
|
+
configurable: true,
|
|
260
|
+
enumerable: true,
|
|
261
|
+
writable: true,
|
|
262
|
+
initializer: null
|
|
263
|
+
}), _descriptor24 = _applyDecoratedDescriptor(_class.prototype, "showFilePreview", [_dec24], {
|
|
264
|
+
configurable: true,
|
|
265
|
+
enumerable: true,
|
|
266
|
+
writable: true,
|
|
267
|
+
initializer: null
|
|
268
|
+
}), _descriptor25 = _applyDecoratedDescriptor(_class.prototype, "allowFileMultiple", [_dec25], {
|
|
269
|
+
configurable: true,
|
|
270
|
+
enumerable: true,
|
|
271
|
+
writable: true,
|
|
272
|
+
initializer: null
|
|
273
|
+
}), _descriptor26 = _applyDecoratedDescriptor(_class.prototype, "allowFileJpeg", [_dec26], {
|
|
274
|
+
configurable: true,
|
|
275
|
+
enumerable: true,
|
|
276
|
+
writable: true,
|
|
277
|
+
initializer: null
|
|
278
|
+
}), _descriptor27 = _applyDecoratedDescriptor(_class.prototype, "allowFileGif", [_dec27], {
|
|
279
|
+
configurable: true,
|
|
280
|
+
enumerable: true,
|
|
281
|
+
writable: true,
|
|
282
|
+
initializer: null
|
|
283
|
+
}), _descriptor28 = _applyDecoratedDescriptor(_class.prototype, "allowFilePdf", [_dec28], {
|
|
284
|
+
configurable: true,
|
|
285
|
+
enumerable: true,
|
|
286
|
+
writable: true,
|
|
287
|
+
initializer: null
|
|
288
|
+
}), _descriptor29 = _applyDecoratedDescriptor(_class.prototype, "allowFilePng", [_dec29], {
|
|
289
|
+
configurable: true,
|
|
290
|
+
enumerable: true,
|
|
291
|
+
writable: true,
|
|
292
|
+
initializer: null
|
|
293
|
+
}), _descriptor30 = _applyDecoratedDescriptor(_class.prototype, "allowFileAi", [_dec30], {
|
|
294
|
+
configurable: true,
|
|
295
|
+
enumerable: true,
|
|
296
|
+
writable: true,
|
|
297
|
+
initializer: null
|
|
298
|
+
}), _descriptor31 = _applyDecoratedDescriptor(_class.prototype, "product", [_dec31], {
|
|
299
|
+
configurable: true,
|
|
300
|
+
enumerable: true,
|
|
301
|
+
writable: true,
|
|
302
|
+
initializer: null
|
|
303
|
+
}), _descriptor32 = _applyDecoratedDescriptor(_class.prototype, "variations", [_dec32], {
|
|
304
|
+
configurable: true,
|
|
305
|
+
enumerable: true,
|
|
306
|
+
writable: true,
|
|
307
|
+
initializer: null
|
|
308
|
+
}), _descriptor33 = _applyDecoratedDescriptor(_class.prototype, "options", [_dec33], {
|
|
309
|
+
configurable: true,
|
|
310
|
+
enumerable: true,
|
|
311
|
+
writable: true,
|
|
312
|
+
initializer: null
|
|
313
|
+
})), _class));
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { Merchi } from '../merchi';
|
|
2
|
+
test('can make VariationField', function () {
|
|
3
|
+
var merchi = new Merchi();
|
|
4
|
+
var variationField = new merchi.VariationField();
|
|
5
|
+
expect(variationField).toBeTruthy();
|
|
6
|
+
});
|
|
7
|
+
test('isSelectable', function () {
|
|
8
|
+
var merchi = new Merchi();
|
|
9
|
+
var vf = new merchi.VariationField();
|
|
10
|
+
expect(vf.isSelectable).toThrow();
|
|
11
|
+
vf.fieldType = 1;
|
|
12
|
+
expect(vf.isSelectable()).toBe(false);
|
|
13
|
+
vf.fieldType = 11;
|
|
14
|
+
expect(vf.isSelectable()).toBe(true);
|
|
15
|
+
});
|
|
16
|
+
test('buildEmptyVariation cost', function () {
|
|
17
|
+
var merchi = new Merchi();
|
|
18
|
+
var vf = new merchi.VariationField();
|
|
19
|
+
expect(vf.buildEmptyVariation).toThrow();
|
|
20
|
+
vf.defaultValue = 'a';
|
|
21
|
+
vf.fieldType = 11;
|
|
22
|
+
expect(vf.buildEmptyVariation).toThrow();
|
|
23
|
+
vf.variationCost = 2;
|
|
24
|
+
expect(vf.buildEmptyVariation).toThrow();
|
|
25
|
+
var o1 = new merchi.VariationFieldsOption();
|
|
26
|
+
var o2 = new merchi.VariationFieldsOption();
|
|
27
|
+
o1["default"] = true;
|
|
28
|
+
vf.options = [o1, o2];
|
|
29
|
+
expect(vf.buildEmptyVariation).toThrow();
|
|
30
|
+
o1.variationCost = 3;
|
|
31
|
+
expect(vf.buildEmptyVariation().onceOffCost).toEqual(3);
|
|
32
|
+
vf.fieldType = 1;
|
|
33
|
+
expect(vf.buildEmptyVariation().onceOffCost).toEqual(2);
|
|
34
|
+
});
|
|
35
|
+
test('buildEmptyVariation seller editable options', function () {
|
|
36
|
+
var merchi = new Merchi();
|
|
37
|
+
var vf = new merchi.VariationField();
|
|
38
|
+
expect(vf.buildEmptyVariation).toThrow();
|
|
39
|
+
vf.defaultValue = 'a';
|
|
40
|
+
vf.fieldType = 11;
|
|
41
|
+
vf.sellerProductEditable = true;
|
|
42
|
+
vf.variationCost = 2;
|
|
43
|
+
expect(vf.buildEmptyVariation).toThrow();
|
|
44
|
+
var o1 = new merchi.VariationFieldsOption();
|
|
45
|
+
var o2 = new merchi.VariationFieldsOption();
|
|
46
|
+
o1.include = true;
|
|
47
|
+
o1.id = 1;
|
|
48
|
+
o1.variationCost = 1;
|
|
49
|
+
o2["default"] = true;
|
|
50
|
+
o2.id = 2;
|
|
51
|
+
o2.variationCost = 1;
|
|
52
|
+
vf.options = [o1, o2];
|
|
53
|
+
expect(vf.buildEmptyVariation().value).toEqual('1');
|
|
54
|
+
});
|
|
55
|
+
test('buildEmptyVariation selectable options', function () {
|
|
56
|
+
var merchi = new Merchi();
|
|
57
|
+
var vf = new merchi.VariationField();
|
|
58
|
+
var o1 = new merchi.VariationFieldsOption();
|
|
59
|
+
var o2 = new merchi.VariationFieldsOption();
|
|
60
|
+
o1.value = 'test 1';
|
|
61
|
+
o2.value = 'test 2';
|
|
62
|
+
vf.options = [o1, o2];
|
|
63
|
+
vf.variationCost = 2;
|
|
64
|
+
vf.defaultValue = 'a';
|
|
65
|
+
vf.fieldType = 11;
|
|
66
|
+
var v = vf.buildEmptyVariation();
|
|
67
|
+
expect(v.selectableOptions[0].value).toEqual('test 1');
|
|
68
|
+
expect(v.selectableOptions[1].value).toEqual('test 2');
|
|
69
|
+
});
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
var _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _dec8, _dec9, _dec10, _dec11, _dec12, _dec13, _dec14, _dec15, _dec16, _dec17, _dec18, _class, _descriptor, _descriptor2, _descriptor3, _descriptor4, _descriptor5, _descriptor6, _descriptor7, _descriptor8, _descriptor9, _descriptor10, _descriptor11, _descriptor12, _descriptor13, _descriptor14, _descriptor15, _descriptor16, _descriptor17, _descriptor18, _VariationFieldsOption;
|
|
3
|
+
function _initializerDefineProperty(target, property, descriptor, context) { if (!descriptor) return; Object.defineProperty(target, property, { enumerable: descriptor.enumerable, configurable: descriptor.configurable, writable: descriptor.writable, value: descriptor.initializer ? descriptor.initializer.call(context) : void 0 }); }
|
|
4
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
5
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
6
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
7
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
8
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
9
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
10
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
11
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
12
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
13
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
14
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
15
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
16
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
17
|
+
function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) { var desc = {}; Object.keys(descriptor).forEach(function (key) { desc[key] = descriptor[key]; }); desc.enumerable = !!desc.enumerable; desc.configurable = !!desc.configurable; if ('value' in desc || desc.initializer) { desc.writable = true; } desc = decorators.slice().reverse().reduce(function (desc, decorator) { return decorator(target, property, desc) || desc; }, desc); if (context && desc.initializer !== void 0) { desc.value = desc.initializer ? desc.initializer.call(context) : void 0; desc.initializer = undefined; } if (desc.initializer === void 0) { Object.defineProperty(target, property, desc); desc = null; } return desc; }
|
|
18
|
+
function _initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that ' + 'transform-class-properties is enabled and runs after the decorators transform.'); }
|
|
19
|
+
import { Entity } from '../entity';
|
|
20
|
+
import { MerchiFile } from './file';
|
|
21
|
+
import { VariationField } from './variation_field';
|
|
22
|
+
export var VariationFieldsOption = (_dec = VariationFieldsOption.property({
|
|
23
|
+
type: Date
|
|
24
|
+
}), _dec2 = VariationFieldsOption.property(), _dec3 = VariationFieldsOption.property({
|
|
25
|
+
type: String
|
|
26
|
+
}), _dec4 = VariationFieldsOption.property({
|
|
27
|
+
type: String
|
|
28
|
+
}), _dec5 = VariationFieldsOption.property(), _dec6 = VariationFieldsOption.property(), _dec7 = VariationFieldsOption.property(), _dec8 = VariationFieldsOption.property(), _dec9 = VariationFieldsOption.property(), _dec10 = VariationFieldsOption.property({
|
|
29
|
+
type: 'DiscountGroup'
|
|
30
|
+
}), _dec11 = VariationFieldsOption.property(), _dec12 = VariationFieldsOption.property({
|
|
31
|
+
embeddedByDefault: false
|
|
32
|
+
}), _dec13 = VariationFieldsOption.property({
|
|
33
|
+
embeddedByDefault: false
|
|
34
|
+
}), _dec14 = VariationFieldsOption.property({
|
|
35
|
+
type: 'DiscountGroup'
|
|
36
|
+
}), _dec15 = VariationFieldsOption.property({
|
|
37
|
+
type: VariationField
|
|
38
|
+
}), _dec16 = VariationFieldsOption.property({
|
|
39
|
+
type: MerchiFile
|
|
40
|
+
}), _dec17 = VariationFieldsOption.property({
|
|
41
|
+
arrayType: 'Variation'
|
|
42
|
+
}), _dec18 = VariationFieldsOption.property({
|
|
43
|
+
arrayType: 'InventoryUnitVariation'
|
|
44
|
+
}), (_class = (_VariationFieldsOption = /*#__PURE__*/function (_Entity) {
|
|
45
|
+
_inherits(VariationFieldsOption, _Entity);
|
|
46
|
+
function VariationFieldsOption() {
|
|
47
|
+
var _this;
|
|
48
|
+
_classCallCheck(this, VariationFieldsOption);
|
|
49
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
50
|
+
args[_key] = arguments[_key];
|
|
51
|
+
}
|
|
52
|
+
_this = _callSuper(this, VariationFieldsOption, [].concat(args));
|
|
53
|
+
_initializerDefineProperty(_assertThisInitialized(_this), "archived", _descriptor, _assertThisInitialized(_this));
|
|
54
|
+
_initializerDefineProperty(_assertThisInitialized(_this), "id", _descriptor2, _assertThisInitialized(_this));
|
|
55
|
+
_initializerDefineProperty(_assertThisInitialized(_this), "value", _descriptor3, _assertThisInitialized(_this));
|
|
56
|
+
_initializerDefineProperty(_assertThisInitialized(_this), "colour", _descriptor4, _assertThisInitialized(_this));
|
|
57
|
+
_initializerDefineProperty(_assertThisInitialized(_this), "currency", _descriptor5, _assertThisInitialized(_this));
|
|
58
|
+
_initializerDefineProperty(_assertThisInitialized(_this), "default", _descriptor6, _assertThisInitialized(_this));
|
|
59
|
+
_initializerDefineProperty(_assertThisInitialized(_this), "include", _descriptor7, _assertThisInitialized(_this));
|
|
60
|
+
_initializerDefineProperty(_assertThisInitialized(_this), "position", _descriptor8, _assertThisInitialized(_this));
|
|
61
|
+
_initializerDefineProperty(_assertThisInitialized(_this), "variationCost", _descriptor9, _assertThisInitialized(_this));
|
|
62
|
+
_initializerDefineProperty(_assertThisInitialized(_this), "variationCostDiscountGroup", _descriptor10, _assertThisInitialized(_this));
|
|
63
|
+
_initializerDefineProperty(_assertThisInitialized(_this), "variationUnitCost", _descriptor11, _assertThisInitialized(_this));
|
|
64
|
+
_initializerDefineProperty(_assertThisInitialized(_this), "buyUnitCost", _descriptor12, _assertThisInitialized(_this));
|
|
65
|
+
_initializerDefineProperty(_assertThisInitialized(_this), "buyCost", _descriptor13, _assertThisInitialized(_this));
|
|
66
|
+
_initializerDefineProperty(_assertThisInitialized(_this), "variationUnitCostDiscountGroup", _descriptor14, _assertThisInitialized(_this));
|
|
67
|
+
_initializerDefineProperty(_assertThisInitialized(_this), "variationField", _descriptor15, _assertThisInitialized(_this));
|
|
68
|
+
_initializerDefineProperty(_assertThisInitialized(_this), "linkedFile", _descriptor16, _assertThisInitialized(_this));
|
|
69
|
+
_initializerDefineProperty(_assertThisInitialized(_this), "selectedByVariations", _descriptor17, _assertThisInitialized(_this));
|
|
70
|
+
_initializerDefineProperty(_assertThisInitialized(_this), "inventoryUnitVariations", _descriptor18, _assertThisInitialized(_this));
|
|
71
|
+
_defineProperty(_assertThisInitialized(_this), "totalCost", function (quantity) {
|
|
72
|
+
if (_this.variationCost === undefined) {
|
|
73
|
+
throw new Error('variationCost is unknown');
|
|
74
|
+
}
|
|
75
|
+
if (_this.variationUnitCost === undefined) {
|
|
76
|
+
throw new Error('variationUnitCost is unknown');
|
|
77
|
+
}
|
|
78
|
+
return _this.variationCost + _this.variationUnitCost * quantity;
|
|
79
|
+
});
|
|
80
|
+
_defineProperty(_assertThisInitialized(_this), "buildVariationOption", function () {
|
|
81
|
+
var result = new _this.merchi.VariationOption(_this.merchi);
|
|
82
|
+
result.optionId = _this.id;
|
|
83
|
+
result.include = _this.include;
|
|
84
|
+
result.value = _this.value;
|
|
85
|
+
result.position = _this.position;
|
|
86
|
+
result["default"] = _this["default"];
|
|
87
|
+
result.colour = _this.colour;
|
|
88
|
+
result.linkedFile = _this.linkedFile;
|
|
89
|
+
result.quantity = 0;
|
|
90
|
+
result.currency = _this.currency;
|
|
91
|
+
result.unitCost = _this.variationUnitCost;
|
|
92
|
+
result.unitCostTotal = 0;
|
|
93
|
+
result.onceOffCost = _this.variationCost;
|
|
94
|
+
result.totalCost = _this.variationCost;
|
|
95
|
+
return result;
|
|
96
|
+
});
|
|
97
|
+
return _this;
|
|
98
|
+
}
|
|
99
|
+
return _createClass(VariationFieldsOption);
|
|
100
|
+
}(Entity), _defineProperty(_VariationFieldsOption, "resourceName", 'variation_fields_options'), _defineProperty(_VariationFieldsOption, "singularName", 'variationFieldsOption'), _defineProperty(_VariationFieldsOption, "pluralName", 'variationFieldsOptions'), _VariationFieldsOption), (_descriptor = _applyDecoratedDescriptor(_class.prototype, "archived", [_dec], {
|
|
101
|
+
configurable: true,
|
|
102
|
+
enumerable: true,
|
|
103
|
+
writable: true,
|
|
104
|
+
initializer: null
|
|
105
|
+
}), _descriptor2 = _applyDecoratedDescriptor(_class.prototype, "id", [_dec2], {
|
|
106
|
+
configurable: true,
|
|
107
|
+
enumerable: true,
|
|
108
|
+
writable: true,
|
|
109
|
+
initializer: null
|
|
110
|
+
}), _descriptor3 = _applyDecoratedDescriptor(_class.prototype, "value", [_dec3], {
|
|
111
|
+
configurable: true,
|
|
112
|
+
enumerable: true,
|
|
113
|
+
writable: true,
|
|
114
|
+
initializer: null
|
|
115
|
+
}), _descriptor4 = _applyDecoratedDescriptor(_class.prototype, "colour", [_dec4], {
|
|
116
|
+
configurable: true,
|
|
117
|
+
enumerable: true,
|
|
118
|
+
writable: true,
|
|
119
|
+
initializer: null
|
|
120
|
+
}), _descriptor5 = _applyDecoratedDescriptor(_class.prototype, "currency", [_dec5], {
|
|
121
|
+
configurable: true,
|
|
122
|
+
enumerable: true,
|
|
123
|
+
writable: true,
|
|
124
|
+
initializer: null
|
|
125
|
+
}), _descriptor6 = _applyDecoratedDescriptor(_class.prototype, "default", [_dec6], {
|
|
126
|
+
configurable: true,
|
|
127
|
+
enumerable: true,
|
|
128
|
+
writable: true,
|
|
129
|
+
initializer: null
|
|
130
|
+
}), _descriptor7 = _applyDecoratedDescriptor(_class.prototype, "include", [_dec7], {
|
|
131
|
+
configurable: true,
|
|
132
|
+
enumerable: true,
|
|
133
|
+
writable: true,
|
|
134
|
+
initializer: null
|
|
135
|
+
}), _descriptor8 = _applyDecoratedDescriptor(_class.prototype, "position", [_dec8], {
|
|
136
|
+
configurable: true,
|
|
137
|
+
enumerable: true,
|
|
138
|
+
writable: true,
|
|
139
|
+
initializer: null
|
|
140
|
+
}), _descriptor9 = _applyDecoratedDescriptor(_class.prototype, "variationCost", [_dec9], {
|
|
141
|
+
configurable: true,
|
|
142
|
+
enumerable: true,
|
|
143
|
+
writable: true,
|
|
144
|
+
initializer: null
|
|
145
|
+
}), _descriptor10 = _applyDecoratedDescriptor(_class.prototype, "variationCostDiscountGroup", [_dec10], {
|
|
146
|
+
configurable: true,
|
|
147
|
+
enumerable: true,
|
|
148
|
+
writable: true,
|
|
149
|
+
initializer: null
|
|
150
|
+
}), _descriptor11 = _applyDecoratedDescriptor(_class.prototype, "variationUnitCost", [_dec11], {
|
|
151
|
+
configurable: true,
|
|
152
|
+
enumerable: true,
|
|
153
|
+
writable: true,
|
|
154
|
+
initializer: null
|
|
155
|
+
}), _descriptor12 = _applyDecoratedDescriptor(_class.prototype, "buyUnitCost", [_dec12], {
|
|
156
|
+
configurable: true,
|
|
157
|
+
enumerable: true,
|
|
158
|
+
writable: true,
|
|
159
|
+
initializer: null
|
|
160
|
+
}), _descriptor13 = _applyDecoratedDescriptor(_class.prototype, "buyCost", [_dec13], {
|
|
161
|
+
configurable: true,
|
|
162
|
+
enumerable: true,
|
|
163
|
+
writable: true,
|
|
164
|
+
initializer: null
|
|
165
|
+
}), _descriptor14 = _applyDecoratedDescriptor(_class.prototype, "variationUnitCostDiscountGroup", [_dec14], {
|
|
166
|
+
configurable: true,
|
|
167
|
+
enumerable: true,
|
|
168
|
+
writable: true,
|
|
169
|
+
initializer: null
|
|
170
|
+
}), _descriptor15 = _applyDecoratedDescriptor(_class.prototype, "variationField", [_dec15], {
|
|
171
|
+
configurable: true,
|
|
172
|
+
enumerable: true,
|
|
173
|
+
writable: true,
|
|
174
|
+
initializer: null
|
|
175
|
+
}), _descriptor16 = _applyDecoratedDescriptor(_class.prototype, "linkedFile", [_dec16], {
|
|
176
|
+
configurable: true,
|
|
177
|
+
enumerable: true,
|
|
178
|
+
writable: true,
|
|
179
|
+
initializer: null
|
|
180
|
+
}), _descriptor17 = _applyDecoratedDescriptor(_class.prototype, "selectedByVariations", [_dec17], {
|
|
181
|
+
configurable: true,
|
|
182
|
+
enumerable: true,
|
|
183
|
+
writable: true,
|
|
184
|
+
initializer: null
|
|
185
|
+
}), _descriptor18 = _applyDecoratedDescriptor(_class.prototype, "inventoryUnitVariations", [_dec18], {
|
|
186
|
+
configurable: true,
|
|
187
|
+
enumerable: true,
|
|
188
|
+
writable: true,
|
|
189
|
+
initializer: null
|
|
190
|
+
})), _class));
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Merchi } from '../merchi';
|
|
2
|
+
test('can make VariationFieldsOption', function () {
|
|
3
|
+
var merchi = new Merchi();
|
|
4
|
+
var variationFieldsOption = new merchi.VariationFieldsOption();
|
|
5
|
+
expect(variationFieldsOption).toBeTruthy();
|
|
6
|
+
});
|
|
7
|
+
test('totalCost', function () {
|
|
8
|
+
var merchi = new Merchi();
|
|
9
|
+
var vfo = new merchi.VariationFieldsOption();
|
|
10
|
+
expect(function () {
|
|
11
|
+
return vfo.totalCost(33);
|
|
12
|
+
}).toThrow();
|
|
13
|
+
vfo.variationCost = 12.4;
|
|
14
|
+
expect(function () {
|
|
15
|
+
return vfo.totalCost(33);
|
|
16
|
+
}).toThrow();
|
|
17
|
+
vfo.variationUnitCost = 9.98;
|
|
18
|
+
expect(vfo.totalCost(33)).toEqual(341.74);
|
|
19
|
+
});
|
|
20
|
+
test('buildVariationOption', function () {
|
|
21
|
+
var merchi = new Merchi();
|
|
22
|
+
var option = new merchi.VariationFieldsOption();
|
|
23
|
+
var file = new merchi.MerchiFile();
|
|
24
|
+
file.id = 1;
|
|
25
|
+
option.id = 1;
|
|
26
|
+
option.value = 'aa';
|
|
27
|
+
option.position = 3;
|
|
28
|
+
option["default"] = true;
|
|
29
|
+
option.colour = '#AAAAAA';
|
|
30
|
+
option.linkedFile = file;
|
|
31
|
+
option.currency = 'AUD';
|
|
32
|
+
option.variationCost = 100;
|
|
33
|
+
option.variationUnitCost = 1;
|
|
34
|
+
var variationOption = option.buildVariationOption();
|
|
35
|
+
expect(variationOption.optionId).toEqual(option.id);
|
|
36
|
+
expect(variationOption.value).toEqual(option.value);
|
|
37
|
+
expect(variationOption.position).toEqual(option.position);
|
|
38
|
+
expect(variationOption["default"]).toEqual(option["default"]);
|
|
39
|
+
expect(variationOption.colour).toEqual(option.colour);
|
|
40
|
+
expect(variationOption.linkedFile.id).toEqual(1);
|
|
41
|
+
expect(variationOption.quantity).toEqual(0);
|
|
42
|
+
expect(variationOption.currency).toEqual(option.currency);
|
|
43
|
+
expect(variationOption.onceOffCost).toEqual(option.variationCost);
|
|
44
|
+
expect(variationOption.unitCost).toEqual(option.variationUnitCost);
|
|
45
|
+
expect(variationOption.unitCostTotal).toEqual(0);
|
|
46
|
+
expect(variationOption.totalCost).toEqual(option.variationCost);
|
|
47
|
+
});
|