@merchi/sdk 1.40.2
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/.eslintrc.cjs +43 -0
- package/.turbo/turbo-build.log +1 -0
- package/.turbo/turbo-test.log +849 -0
- package/LICENSE +21 -0
- package/README.md +244 -0
- package/coverage/clover.xml +5057 -0
- package/coverage/coverage-final.json +133 -0
- package/coverage/lcov-report/base.css +224 -0
- package/coverage/lcov-report/block-navigation.js +87 -0
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +191 -0
- package/coverage/lcov-report/prettify.css +1 -0
- package/coverage/lcov-report/prettify.js +2 -0
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +210 -0
- package/coverage/lcov-report/src/constants/auto_assign_production_on_actions.ts.html +103 -0
- package/coverage/lcov-report/src/constants/call_to_actions.ts.html +127 -0
- package/coverage/lcov-report/src/constants/discount_types.ts.html +100 -0
- package/coverage/lcov-report/src/constants/domain_types.ts.html +121 -0
- package/coverage/lcov-report/src/constants/errors.ts.html +181 -0
- package/coverage/lcov-report/src/constants/event_types.ts.html +100 -0
- package/coverage/lcov-report/src/constants/field_types.ts.html +133 -0
- package/coverage/lcov-report/src/constants/index.html +551 -0
- package/coverage/lcov-report/src/constants/index.ts.html +238 -0
- package/coverage/lcov-report/src/constants/input_types.ts.html +124 -0
- package/coverage/lcov-report/src/constants/inventory_statuses.ts.html +103 -0
- package/coverage/lcov-report/src/constants/invoice_types.ts.html +100 -0
- package/coverage/lcov-report/src/constants/item_types.ts.html +100 -0
- package/coverage/lcov-report/src/constants/job/drafting_status.ts.html +106 -0
- package/coverage/lcov-report/src/constants/job/index.html +176 -0
- package/coverage/lcov-report/src/constants/job/payment_status.ts.html +106 -0
- package/coverage/lcov-report/src/constants/job/production_status.ts.html +121 -0
- package/coverage/lcov-report/src/constants/job/shipment_status.ts.html +118 -0
- package/coverage/lcov-report/src/constants/job/supply_chain_request_status.ts.html +103 -0
- package/coverage/lcov-report/src/constants/job_priorities.ts.html +103 -0
- package/coverage/lcov-report/src/constants/job_status.ts.html +232 -0
- package/coverage/lcov-report/src/constants/job_types.ts.html +133 -0
- package/coverage/lcov-report/src/constants/notification_sections.ts.html +124 -0
- package/coverage/lcov-report/src/constants/notification_types.ts.html +385 -0
- package/coverage/lcov-report/src/constants/notification_urgencies.ts.html +106 -0
- package/coverage/lcov-report/src/constants/payment_types.ts.html +115 -0
- package/coverage/lcov-report/src/constants/platform.ts.html +103 -0
- package/coverage/lcov-report/src/constants/product_types.ts.html +163 -0
- package/coverage/lcov-report/src/constants/rights.ts.html +100 -0
- package/coverage/lcov-report/src/constants/robots_meta_directives.ts.html +118 -0
- package/coverage/lcov-report/src/constants/roles.ts.html +223 -0
- package/coverage/lcov-report/src/constants/shipment_companies.ts.html +142 -0
- package/coverage/lcov-report/src/constants/shipment_services.ts.html +94 -0
- package/coverage/lcov-report/src/constants/system_roles.ts.html +94 -0
- package/coverage/lcov-report/src/constants/theme_status.ts.html +100 -0
- package/coverage/lcov-report/src/constants/user_types.ts.html +136 -0
- package/coverage/lcov-report/src/constants/white_label_accessibilities.ts.html +103 -0
- package/coverage/lcov-report/src/cookie.ts.html +133 -0
- package/coverage/lcov-report/src/entities/address.ts.html +280 -0
- package/coverage/lcov-report/src/entities/agent_conversation.ts.html +202 -0
- package/coverage/lcov-report/src/entities/agent_skill.ts.html +382 -0
- package/coverage/lcov-report/src/entities/agent_skill_approval.ts.html +163 -0
- package/coverage/lcov-report/src/entities/agent_skill_version.ts.html +277 -0
- package/coverage/lcov-report/src/entities/agent_token_usage.ts.html +349 -0
- package/coverage/lcov-report/src/entities/assignment.ts.html +382 -0
- package/coverage/lcov-report/src/entities/automatic_payment_relationship.ts.html +172 -0
- package/coverage/lcov-report/src/entities/bank.ts.html +220 -0
- package/coverage/lcov-report/src/entities/cart.ts.html +391 -0
- package/coverage/lcov-report/src/entities/cart_item.ts.html +340 -0
- package/coverage/lcov-report/src/entities/cart_shipment_group.ts.html +148 -0
- package/coverage/lcov-report/src/entities/cart_shipment_quote.ts.html +184 -0
- package/coverage/lcov-report/src/entities/category.ts.html +262 -0
- package/coverage/lcov-report/src/entities/company.ts.html +1276 -0
- package/coverage/lcov-report/src/entities/company_invitation.ts.html +184 -0
- package/coverage/lcov-report/src/entities/country_tax.ts.html +223 -0
- package/coverage/lcov-report/src/entities/discount.ts.html +235 -0
- package/coverage/lcov-report/src/entities/discount_group.ts.html +214 -0
- package/coverage/lcov-report/src/entities/domain.ts.html +3349 -0
- package/coverage/lcov-report/src/entities/domain_chat_settings.ts.html +331 -0
- package/coverage/lcov-report/src/entities/domain_invitation.ts.html +193 -0
- package/coverage/lcov-report/src/entities/domain_tag.ts.html +211 -0
- package/coverage/lcov-report/src/entities/draft.ts.html +322 -0
- package/coverage/lcov-report/src/entities/draft_comment.ts.html +274 -0
- package/coverage/lcov-report/src/entities/draft_preview.ts.html +196 -0
- package/coverage/lcov-report/src/entities/draft_preview_layer.ts.html +148 -0
- package/coverage/lcov-report/src/entities/draft_template.ts.html +328 -0
- package/coverage/lcov-report/src/entities/email_address.ts.html +157 -0
- package/coverage/lcov-report/src/entities/email_counter.ts.html +145 -0
- package/coverage/lcov-report/src/entities/enrolled_domain.ts.html +205 -0
- package/coverage/lcov-report/src/entities/exchange_rate.ts.html +151 -0
- package/coverage/lcov-report/src/entities/file.ts.html +580 -0
- package/coverage/lcov-report/src/entities/index.html +1271 -0
- package/coverage/lcov-report/src/entities/internal_tag.ts.html +238 -0
- package/coverage/lcov-report/src/entities/inventory.ts.html +274 -0
- package/coverage/lcov-report/src/entities/inventory_group.ts.html +193 -0
- package/coverage/lcov-report/src/entities/inventory_unit_variation.ts.html +172 -0
- package/coverage/lcov-report/src/entities/invoice.ts.html +661 -0
- package/coverage/lcov-report/src/entities/item.ts.html +262 -0
- package/coverage/lcov-report/src/entities/job.ts.html +1288 -0
- package/coverage/lcov-report/src/entities/job_comment.ts.html +244 -0
- package/coverage/lcov-report/src/entities/job_note.ts.html +205 -0
- package/coverage/lcov-report/src/entities/job_operation_log.ts.html +208 -0
- package/coverage/lcov-report/src/entities/matching_inventory.ts.html +172 -0
- package/coverage/lcov-report/src/entities/notification.ts.html +403 -0
- package/coverage/lcov-report/src/entities/payment.ts.html +316 -0
- package/coverage/lcov-report/src/entities/payment_device.ts.html +175 -0
- package/coverage/lcov-report/src/entities/phone_number.ts.html +193 -0
- package/coverage/lcov-report/src/entities/product.ts.html +1543 -0
- package/coverage/lcov-report/src/entities/product_form.ts.html +238 -0
- package/coverage/lcov-report/src/entities/product_form_version.ts.html +238 -0
- package/coverage/lcov-report/src/entities/product_review.ts.html +748 -0
- package/coverage/lcov-report/src/entities/production_comment.ts.html +244 -0
- package/coverage/lcov-report/src/entities/quote.ts.html +505 -0
- package/coverage/lcov-report/src/entities/quote_item.ts.html +298 -0
- package/coverage/lcov-report/src/entities/reminder.ts.html +307 -0
- package/coverage/lcov-report/src/entities/session.ts.html +169 -0
- package/coverage/lcov-report/src/entities/shipment.ts.html +673 -0
- package/coverage/lcov-report/src/entities/shipment_item.ts.html +130 -0
- package/coverage/lcov-report/src/entities/shipment_item_fulfillment.ts.html +130 -0
- package/coverage/lcov-report/src/entities/shipment_log.ts.html +196 -0
- package/coverage/lcov-report/src/entities/shipment_method.ts.html +268 -0
- package/coverage/lcov-report/src/entities/shipment_method_variation.ts.html +202 -0
- package/coverage/lcov-report/src/entities/short_url.ts.html +193 -0
- package/coverage/lcov-report/src/entities/subscription_plan.ts.html +304 -0
- package/coverage/lcov-report/src/entities/supply_domain.ts.html +166 -0
- package/coverage/lcov-report/src/entities/support_conversation.ts.html +280 -0
- package/coverage/lcov-report/src/entities/support_message.ts.html +175 -0
- package/coverage/lcov-report/src/entities/system_role.ts.html +136 -0
- package/coverage/lcov-report/src/entities/theme.ts.html +331 -0
- package/coverage/lcov-report/src/entities/theme_css_setting.ts.html +154 -0
- package/coverage/lcov-report/src/entities/user.ts.html +1369 -0
- package/coverage/lcov-report/src/entities/user_company.ts.html +166 -0
- package/coverage/lcov-report/src/entities/variation.ts.html +277 -0
- package/coverage/lcov-report/src/entities/variation_field.ts.html +889 -0
- package/coverage/lcov-report/src/entities/variation_fields_option.ts.html +406 -0
- package/coverage/lcov-report/src/entities/variation_option.ts.html +259 -0
- package/coverage/lcov-report/src/entities/variations_group.ts.html +208 -0
- package/coverage/lcov-report/src/entity.ts.html +3379 -0
- package/coverage/lcov-report/src/index.html +221 -0
- package/coverage/lcov-report/src/index.ts.html +652 -0
- package/coverage/lcov-report/src/merchi.ts.html +1420 -0
- package/coverage/lcov-report/src/pricing/discount.ts.html +136 -0
- package/coverage/lcov-report/src/pricing/estimate.ts.html +1015 -0
- package/coverage/lcov-report/src/pricing/index.html +206 -0
- package/coverage/lcov-report/src/pricing/index.ts.html +106 -0
- package/coverage/lcov-report/src/pricing/inventory.ts.html +352 -0
- package/coverage/lcov-report/src/pricing/matrix.ts.html +736 -0
- package/coverage/lcov-report/src/pricing/round.ts.html +166 -0
- package/coverage/lcov-report/src/pricing/visibility.ts.html +418 -0
- package/coverage/lcov-report/src/request.ts.html +673 -0
- package/coverage/lcov-report/src/test_util.ts.html +139 -0
- package/coverage/lcov-report/src/toasts.ts.html +187 -0
- package/coverage/lcov-report/src/util/float.ts.html +121 -0
- package/coverage/lcov-report/src/util/index.html +161 -0
- package/coverage/lcov-report/src/util/index.ts.html +106 -0
- package/coverage/lcov-report/src/util/query_string.ts.html +124 -0
- package/coverage/lcov-report/src/util/validation.ts.html +91 -0
- package/coverage/lcov-report/src/uuid.ts.html +109 -0
- package/coverage/lcov.info +7758 -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 +6 -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 +17 -0
- package/dist/constants/field_types.test.js +4 -0
- package/dist/constants/index.js +25 -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 +17 -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 +101 -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 +27 -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 +11 -0
- package/dist/constants/robots_meta_directives.test.js +4 -0
- package/dist/constants/roles.js +64 -0
- package/dist/constants/roles.test.js +4 -0
- package/dist/constants/shipment_companies.js +20 -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_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 +15 -0
- package/dist/cookie.test.js +10 -0
- package/dist/entities/address.js +104 -0
- package/dist/entities/address.test.js +6 -0
- package/dist/entities/agent_conversation.js +78 -0
- package/dist/entities/agent_conversation.test.js +6 -0
- package/dist/entities/agent_skill.js +133 -0
- package/dist/entities/agent_skill.test.js +11 -0
- package/dist/entities/agent_skill_approval.js +61 -0
- package/dist/entities/agent_skill_version.js +99 -0
- package/dist/entities/agent_token_analytics.js +1 -0
- package/dist/entities/agent_token_usage.js +127 -0
- package/dist/entities/agent_token_usage.test.js +6 -0
- package/dist/entities/assignment.js +135 -0
- package/dist/entities/assignment.test.js +30 -0
- package/dist/entities/automatic_payment_relationship.js +65 -0
- package/dist/entities/automatic_payment_relationship.test.js +6 -0
- package/dist/entities/bank.js +85 -0
- package/dist/entities/bank.test.js +6 -0
- package/dist/entities/cart.js +173 -0
- package/dist/entities/cart.test.js +51 -0
- package/dist/entities/cart_item.js +125 -0
- package/dist/entities/cart_item.test.js +28 -0
- package/dist/entities/cart_shipment_group.js +53 -0
- package/dist/entities/cart_shipment_quote.js +70 -0
- package/dist/entities/category.js +101 -0
- package/dist/entities/category.test.js +52 -0
- package/dist/entities/company.js +509 -0
- package/dist/entities/company.test.js +6 -0
- package/dist/entities/company_invitation.js +70 -0
- package/dist/entities/company_invitation.test.js +6 -0
- package/dist/entities/country_tax.js +80 -0
- package/dist/entities/country_tax.test.js +11 -0
- package/dist/entities/discount.js +89 -0
- package/dist/entities/discount.test.js +34 -0
- package/dist/entities/discount_group.js +80 -0
- package/dist/entities/discount_group.test.js +6 -0
- package/dist/entities/domain.js +567 -0
- package/dist/entities/domain.test.js +356 -0
- package/dist/entities/domain_chat_settings.js +134 -0
- package/dist/entities/domain_chat_settings.test.js +15 -0
- package/dist/entities/domain_invitation.js +74 -0
- package/dist/entities/domain_invitation.test.js +6 -0
- package/dist/entities/domain_tag.js +77 -0
- package/dist/entities/domain_tag.test.js +6 -0
- package/dist/entities/draft.js +122 -0
- package/dist/entities/draft.test.js +26 -0
- package/dist/entities/draft_comment.js +107 -0
- package/dist/entities/draft_comment.test.js +6 -0
- package/dist/entities/draft_preview.js +74 -0
- package/dist/entities/draft_preview.test.js +36 -0
- package/dist/entities/draft_preview_layer.js +54 -0
- package/dist/entities/draft_preview_layer.test.js +6 -0
- package/dist/entities/draft_template.js +119 -0
- package/dist/entities/draft_template.test.js +12 -0
- package/dist/entities/email_address.js +56 -0
- package/dist/entities/email_address.test.js +6 -0
- package/dist/entities/email_counter.js +53 -0
- package/dist/entities/email_counter.test.js +6 -0
- package/dist/entities/enrolled_domain.js +74 -0
- package/dist/entities/enrolled_domain.test.js +6 -0
- package/dist/entities/exchange_rate.js +56 -0
- package/dist/entities/exchange_rate.test.js +6 -0
- package/dist/entities/file.js +218 -0
- package/dist/entities/file.test.js +38 -0
- package/dist/entities/internal_tag.js +84 -0
- package/dist/entities/internal_tag.test.js +6 -0
- package/dist/entities/inventory.js +97 -0
- package/dist/entities/inventory.test.js +22 -0
- package/dist/entities/inventory_group.js +69 -0
- package/dist/entities/inventory_group.test.js +6 -0
- package/dist/entities/inventory_unit_variation.js +61 -0
- package/dist/entities/inventory_unit_variation.test.js +6 -0
- package/dist/entities/invoice.js +268 -0
- package/dist/entities/invoice.test.js +45 -0
- package/dist/entities/item.js +96 -0
- package/dist/entities/item.test.js +17 -0
- package/dist/entities/job.js +519 -0
- package/dist/entities/job.test.js +83 -0
- package/dist/entities/job_comment.js +94 -0
- package/dist/entities/job_comment.test.js +6 -0
- package/dist/entities/job_note.js +78 -0
- package/dist/entities/job_operation_log.js +82 -0
- package/dist/entities/job_operation_log.test.js +6 -0
- package/dist/entities/matching_inventory.js +63 -0
- package/dist/entities/notification.js +163 -0
- package/dist/entities/notification.test.js +51 -0
- package/dist/entities/payment.js +122 -0
- package/dist/entities/payment.test.js +22 -0
- package/dist/entities/payment_device.js +65 -0
- package/dist/entities/payment_device.test.js +6 -0
- package/dist/entities/phone_number.js +72 -0
- package/dist/entities/phone_number.test.js +6 -0
- package/dist/entities/product.js +619 -0
- package/dist/entities/product.test.js +720 -0
- package/dist/entities/product_form.js +92 -0
- package/dist/entities/product_form_version.js +95 -0
- package/dist/entities/product_review.js +234 -0
- package/dist/entities/production_comment.js +94 -0
- package/dist/entities/production_comment.test.js +6 -0
- package/dist/entities/quote.js +168 -0
- package/dist/entities/quote.test.js +86 -0
- package/dist/entities/quote_item.js +99 -0
- package/dist/entities/quote_item.test.js +40 -0
- package/dist/entities/reminder.js +120 -0
- package/dist/entities/reminder.test.js +14 -0
- package/dist/entities/session.js +63 -0
- package/dist/entities/session.test.js +6 -0
- package/dist/entities/shipment.js +256 -0
- package/dist/entities/shipment.test.js +20 -0
- package/dist/entities/shipment_item.js +45 -0
- package/dist/entities/shipment_item.test.js +6 -0
- package/dist/entities/shipment_item_fulfillment.js +46 -0
- package/dist/entities/shipment_item_fulfillment.test.js +6 -0
- package/dist/entities/shipment_log.js +75 -0
- package/dist/entities/shipment_method.js +104 -0
- package/dist/entities/shipment_method.test.js +6 -0
- package/dist/entities/shipment_method_variation.js +77 -0
- package/dist/entities/shipment_method_variation.test.js +6 -0
- package/dist/entities/short_url.js +73 -0
- package/dist/entities/short_url.test.js +6 -0
- package/dist/entities/subscription_plan.js +122 -0
- package/dist/entities/subscription_plan.test.js +6 -0
- package/dist/entities/supply_domain.js +62 -0
- package/dist/entities/supply_domain.test.js +6 -0
- package/dist/entities/support_conversation.js +106 -0
- package/dist/entities/support_conversation.test.js +6 -0
- package/dist/entities/support_message.js +66 -0
- package/dist/entities/support_message.test.js +6 -0
- package/dist/entities/system_role.js +49 -0
- package/dist/entities/system_role.test.js +6 -0
- package/dist/entities/theme.js +125 -0
- package/dist/entities/theme.test.js +35 -0
- package/dist/entities/theme_css_setting.js +57 -0
- package/dist/entities/theme_css_setting.test.js +6 -0
- package/dist/entities/user.js +508 -0
- package/dist/entities/user.test.js +134 -0
- package/dist/entities/user_company.js +62 -0
- package/dist/entities/user_company.test.js +6 -0
- package/dist/entities/variation.js +108 -0
- package/dist/entities/variation.test.js +6 -0
- package/dist/entities/variation_field.js +381 -0
- package/dist/entities/variation_field.test.js +69 -0
- package/dist/entities/variation_fields_option.js +153 -0
- package/dist/entities/variation_fields_option.test.js +43 -0
- package/dist/entities/variation_option.js +104 -0
- package/dist/entities/variation_option.test.js +6 -0
- package/dist/entities/variations_group.js +79 -0
- package/dist/entities/variations_group.test.js +6 -0
- package/dist/entity.js +950 -0
- package/dist/index.js +86 -0
- package/dist/merchi.js +296 -0
- package/dist/merchi.test.js +21 -0
- package/dist/pricing/discount.js +11 -0
- package/dist/pricing/discount.test.js +35 -0
- package/dist/pricing/estimate.js +335 -0
- package/dist/pricing/estimate.test.js +403 -0
- package/dist/pricing/golden.test.js +61 -0
- package/dist/pricing/index.js +7 -0
- package/dist/pricing/index.test.js +8 -0
- package/dist/pricing/inventory.js +238 -0
- package/dist/pricing/inventory.test.js +188 -0
- package/dist/pricing/matrix.js +245 -0
- package/dist/pricing/matrix.test.js +437 -0
- package/dist/pricing/round.js +29 -0
- package/dist/pricing/round.test.js +27 -0
- package/dist/pricing/types.js +1 -0
- package/dist/pricing/visibility.js +227 -0
- package/dist/pricing/visibility.test.js +210 -0
- package/dist/request.js +169 -0
- package/dist/request.test.js +70 -0
- package/dist/test_util.js +17 -0
- package/dist/toasts.js +14 -0
- package/dist/toasts.test.js +28 -0
- package/dist/util/float.js +34 -0
- package/dist/util/index.js +3 -0
- package/dist/util/query_string.js +13 -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 +11 -0
- package/jest.config.js +23 -0
- package/merchi_sdk_ts-1.13.1.tgz +0 -0
- package/package.json +41 -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 +5 -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 +16 -0
- package/src/constants/index.ts +51 -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 +16 -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 +100 -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 +26 -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 +46 -0
- package/src/constants/shipment_companies.test.ts +5 -0
- package/src/constants/shipment_companies.ts +19 -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_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/agent_conversation.test.ts +7 -0
- package/src/entities/agent_conversation.ts +39 -0
- package/src/entities/agent_skill.test.ts +13 -0
- package/src/entities/agent_skill.ts +99 -0
- package/src/entities/agent_skill_approval.ts +26 -0
- package/src/entities/agent_skill_version.ts +64 -0
- package/src/entities/agent_token_analytics.ts +49 -0
- package/src/entities/agent_token_usage.test.ts +7 -0
- package/src/entities/agent_token_usage.ts +88 -0
- package/src/entities/assignment.test.ts +39 -0
- package/src/entities/assignment.ts +99 -0
- package/src/entities/automatic_payment_relationship.test.ts +8 -0
- package/src/entities/automatic_payment_relationship.ts +29 -0
- package/src/entities/bank.test.ts +7 -0
- package/src/entities/bank.ts +45 -0
- package/src/entities/cart.test.ts +57 -0
- package/src/entities/cart.ts +102 -0
- package/src/entities/cart_item.test.ts +33 -0
- package/src/entities/cart_item.ts +85 -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 +59 -0
- package/src/entities/company.test.ts +7 -0
- package/src/entities/company.ts +397 -0
- package/src/entities/company_invitation.test.ts +7 -0
- package/src/entities/company_invitation.ts +33 -0
- package/src/entities/country_tax.test.ts +13 -0
- package/src/entities/country_tax.ts +46 -0
- package/src/entities/discount.test.ts +36 -0
- package/src/entities/discount.ts +50 -0
- package/src/entities/discount_group.test.ts +7 -0
- package/src/entities/discount_group.ts +43 -0
- package/src/entities/domain.test.ts +393 -0
- package/src/entities/domain.ts +1088 -0
- package/src/entities/domain_chat_settings.test.ts +16 -0
- package/src/entities/domain_chat_settings.ts +82 -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 +29 -0
- package/src/entities/draft.ts +79 -0
- package/src/entities/draft_comment.test.ts +7 -0
- package/src/entities/draft_comment.ts +63 -0
- package/src/entities/draft_preview.test.ts +42 -0
- package/src/entities/draft_preview.ts +37 -0
- package/src/entities/draft_preview_layer.test.ts +7 -0
- package/src/entities/draft_preview_layer.ts +21 -0
- package/src/entities/draft_template.test.ts +14 -0
- package/src/entities/draft_template.ts +81 -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 +165 -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 +63 -0
- package/src/entities/inventory_group.test.ts +7 -0
- package/src/entities/inventory_group.ts +36 -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 +50 -0
- package/src/entities/invoice.ts +192 -0
- package/src/entities/item.test.ts +19 -0
- package/src/entities/item.ts +59 -0
- package/src/entities/job.test.ts +95 -0
- package/src/entities/job.ts +401 -0
- package/src/entities/job_comment.test.ts +7 -0
- package/src/entities/job_comment.ts +53 -0
- package/src/entities/job_note.ts +40 -0
- package/src/entities/job_operation_log.test.ts +7 -0
- package/src/entities/job_operation_log.ts +41 -0
- package/src/entities/matching_inventory.ts +29 -0
- package/src/entities/notification.test.ts +58 -0
- package/src/entities/notification.ts +106 -0
- package/src/entities/payment.test.ts +27 -0
- package/src/entities/payment.ts +77 -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 +776 -0
- package/src/entities/product.ts +486 -0
- package/src/entities/product_form.ts +51 -0
- package/src/entities/product_form_version.ts +51 -0
- package/src/entities/product_review.ts +221 -0
- package/src/entities/production_comment.test.ts +7 -0
- package/src/entities/production_comment.ts +53 -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/reminder.test.ts +16 -0
- package/src/entities/reminder.ts +74 -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 +196 -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_log.ts +37 -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/support_conversation.test.ts +7 -0
- package/src/entities/support_conversation.ts +65 -0
- package/src/entities/support_message.test.ts +7 -0
- package/src/entities/support_message.ts +30 -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 +82 -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 +428 -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 +64 -0
- package/src/entities/variation_field.test.ts +76 -0
- package/src/entities/variation_field.ts +268 -0
- package/src/entities/variation_fields_option.test.ts +46 -0
- package/src/entities/variation_fields_option.ts +107 -0
- package/src/entities/variation_option.test.ts +7 -0
- package/src/entities/variation_option.ts +58 -0
- package/src/entities/variations_group.test.ts +7 -0
- package/src/entities/variations_group.ts +41 -0
- package/src/entity.ts +1098 -0
- package/src/index.ts +189 -0
- package/src/merchi.test.ts +25 -0
- package/src/merchi.ts +445 -0
- package/src/pricing/__fixtures__/conditional_field_hidden.json +112 -0
- package/src/pricing/__fixtures__/conditional_field_visible.json +113 -0
- package/src/pricing/__fixtures__/group_product.json +130 -0
- package/src/pricing/__fixtures__/non_selectable_number_field.json +108 -0
- package/src/pricing/__fixtures__/quantity_break_discount.json +104 -0
- package/src/pricing/__fixtures__/simple_selectable_field.json +110 -0
- package/src/pricing/discount.test.ts +47 -0
- package/src/pricing/discount.ts +17 -0
- package/src/pricing/estimate.test.ts +486 -0
- package/src/pricing/estimate.ts +310 -0
- package/src/pricing/golden.test.ts +51 -0
- package/src/pricing/index.test.ts +9 -0
- package/src/pricing/index.ts +7 -0
- package/src/pricing/inventory.test.ts +197 -0
- package/src/pricing/inventory.ts +89 -0
- package/src/pricing/matrix.test.ts +553 -0
- package/src/pricing/matrix.ts +217 -0
- package/src/pricing/round.test.ts +31 -0
- package/src/pricing/round.ts +27 -0
- package/src/pricing/types.ts +140 -0
- package/src/pricing/visibility.test.ts +223 -0
- package/src/pricing/visibility.ts +111 -0
- package/src/request.test.ts +79 -0
- package/src/request.ts +196 -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/index.ts +7 -0
- package/src/util/query_string.test.ts +7 -0
- package/src/util/query_string.ts +13 -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 +29 -0
|
@@ -0,0 +1,381 @@
|
|
|
1
|
+
var __extends = (this && this.__extends) || (function () {
|
|
2
|
+
var extendStatics = function (d, b) {
|
|
3
|
+
extendStatics = Object.setPrototypeOf ||
|
|
4
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
5
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
6
|
+
return extendStatics(d, b);
|
|
7
|
+
};
|
|
8
|
+
return function (d, b) {
|
|
9
|
+
if (typeof b !== "function" && b !== null)
|
|
10
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
11
|
+
extendStatics(d, b);
|
|
12
|
+
function __() { this.constructor = d; }
|
|
13
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
14
|
+
};
|
|
15
|
+
})();
|
|
16
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
17
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
18
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
19
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
20
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
21
|
+
};
|
|
22
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
23
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
24
|
+
};
|
|
25
|
+
var __values = (this && this.__values) || function(o) {
|
|
26
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
27
|
+
if (m) return m.call(o);
|
|
28
|
+
if (o && typeof o.length === "number") return {
|
|
29
|
+
next: function () {
|
|
30
|
+
if (o && i >= o.length) o = void 0;
|
|
31
|
+
return { value: o && o[i++], done: !o };
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
35
|
+
};
|
|
36
|
+
import { cloneDeepWith } from 'lodash';
|
|
37
|
+
import { Entity } from '../entity.js';
|
|
38
|
+
import { InventoryGroup } from './inventory_group.js';
|
|
39
|
+
import { Product } from './product.js';
|
|
40
|
+
import { FieldType } from '../constants/field_types.js';
|
|
41
|
+
var VariationField = /** @class */ (function (_super) {
|
|
42
|
+
__extends(VariationField, _super);
|
|
43
|
+
function VariationField() {
|
|
44
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
45
|
+
_this.isSelectable = function () {
|
|
46
|
+
if (_this.fieldType === undefined) {
|
|
47
|
+
throw new Error('fieldType is undefined, did you forget to embed it?');
|
|
48
|
+
}
|
|
49
|
+
var selectable = new Set([FieldType.SELECT,
|
|
50
|
+
FieldType.CHECKBOX,
|
|
51
|
+
FieldType.RADIO,
|
|
52
|
+
FieldType.IMAGE_SELECT,
|
|
53
|
+
FieldType.COLOUR_SELECT,
|
|
54
|
+
FieldType.COLOUR_EXTRACT]);
|
|
55
|
+
return selectable.has(_this.fieldType);
|
|
56
|
+
};
|
|
57
|
+
_this.buildEmptyVariation = function () {
|
|
58
|
+
var e_1, _a;
|
|
59
|
+
if (_this.defaultValue === undefined) {
|
|
60
|
+
throw new Error('defaultValue is undefined, did you forget to embed it?');
|
|
61
|
+
}
|
|
62
|
+
if (_this.variationCost === undefined) {
|
|
63
|
+
var err = 'variationCost is undefined, did you forget to embed it?';
|
|
64
|
+
throw new Error(err);
|
|
65
|
+
}
|
|
66
|
+
if (_this.options === undefined) {
|
|
67
|
+
throw new Error('options is undefined, did you forget to embed it?');
|
|
68
|
+
}
|
|
69
|
+
var result = new _this.merchi.Variation(_this.merchi);
|
|
70
|
+
result.selectableOptions = [];
|
|
71
|
+
if (_this.fieldType === FieldType.COLOUR_EXTRACT) {
|
|
72
|
+
result.value = _this.defaultValue;
|
|
73
|
+
result.onceOffCost = 0;
|
|
74
|
+
result.variationFiles = [];
|
|
75
|
+
}
|
|
76
|
+
else if (_this.fieldType === FieldType.AREA) {
|
|
77
|
+
result.value = _this.defaultValue;
|
|
78
|
+
result.onceOffCost = 0;
|
|
79
|
+
}
|
|
80
|
+
else if (_this.isSelectable()) {
|
|
81
|
+
var onceOffCost = 0;
|
|
82
|
+
var value = [];
|
|
83
|
+
try {
|
|
84
|
+
for (var _b = __values(_this.options), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
85
|
+
var option = _c.value;
|
|
86
|
+
if ((_this.sellerProductEditable && option.include) ||
|
|
87
|
+
(!_this.sellerProductEditable && option.default)) {
|
|
88
|
+
if (option.variationCost === undefined) {
|
|
89
|
+
throw new Error('option.variationCost is undefined, did you ' +
|
|
90
|
+
'forget to embed it?');
|
|
91
|
+
}
|
|
92
|
+
value.push(option.id);
|
|
93
|
+
onceOffCost += option.variationCost;
|
|
94
|
+
}
|
|
95
|
+
result.selectableOptions.push(option.buildVariationOption());
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
99
|
+
finally {
|
|
100
|
+
try {
|
|
101
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
102
|
+
}
|
|
103
|
+
finally { if (e_1) throw e_1.error; }
|
|
104
|
+
}
|
|
105
|
+
result.value = value.join();
|
|
106
|
+
result.onceOffCost = onceOffCost;
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
result.value = _this.defaultValue;
|
|
110
|
+
result.onceOffCost = _this.variationCost;
|
|
111
|
+
}
|
|
112
|
+
result.unitCostTotal = 0;
|
|
113
|
+
result.cost = result.onceOffCost;
|
|
114
|
+
function customiser(value, index) {
|
|
115
|
+
if (index === 'merchi') {
|
|
116
|
+
return value;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
result.variationField = cloneDeepWith(_this, customiser);
|
|
120
|
+
return result;
|
|
121
|
+
};
|
|
122
|
+
return _this;
|
|
123
|
+
}
|
|
124
|
+
VariationField.resourceName = 'variation_fields';
|
|
125
|
+
VariationField.singularName = 'variationField';
|
|
126
|
+
VariationField.pluralName = 'variationFields';
|
|
127
|
+
__decorate([
|
|
128
|
+
VariationField.property({ type: Date }),
|
|
129
|
+
__metadata("design:type", Object)
|
|
130
|
+
], VariationField.prototype, "archived", void 0);
|
|
131
|
+
__decorate([
|
|
132
|
+
VariationField.property(),
|
|
133
|
+
__metadata("design:type", Number)
|
|
134
|
+
], VariationField.prototype, "id", void 0);
|
|
135
|
+
__decorate([
|
|
136
|
+
VariationField.property(),
|
|
137
|
+
__metadata("design:type", Number)
|
|
138
|
+
], VariationField.prototype, "position", void 0);
|
|
139
|
+
__decorate([
|
|
140
|
+
VariationField.property(),
|
|
141
|
+
__metadata("design:type", Boolean)
|
|
142
|
+
], VariationField.prototype, "required", void 0);
|
|
143
|
+
__decorate([
|
|
144
|
+
VariationField.property(),
|
|
145
|
+
__metadata("design:type", Boolean)
|
|
146
|
+
], VariationField.prototype, "independent", void 0);
|
|
147
|
+
__decorate([
|
|
148
|
+
VariationField.property(),
|
|
149
|
+
__metadata("design:type", String)
|
|
150
|
+
], VariationField.prototype, "name", void 0);
|
|
151
|
+
__decorate([
|
|
152
|
+
VariationField.property(),
|
|
153
|
+
__metadata("design:type", String)
|
|
154
|
+
], VariationField.prototype, "instructions", void 0);
|
|
155
|
+
__decorate([
|
|
156
|
+
VariationField.property({ type: String }),
|
|
157
|
+
__metadata("design:type", Object)
|
|
158
|
+
], VariationField.prototype, "placeholder", void 0);
|
|
159
|
+
__decorate([
|
|
160
|
+
VariationField.property(),
|
|
161
|
+
__metadata("design:type", String)
|
|
162
|
+
], VariationField.prototype, "defaultValue", void 0);
|
|
163
|
+
__decorate([
|
|
164
|
+
VariationField.property(),
|
|
165
|
+
__metadata("design:type", String)
|
|
166
|
+
], VariationField.prototype, "currency", void 0);
|
|
167
|
+
__decorate([
|
|
168
|
+
VariationField.property(),
|
|
169
|
+
__metadata("design:type", Number)
|
|
170
|
+
], VariationField.prototype, "fieldType", void 0);
|
|
171
|
+
__decorate([
|
|
172
|
+
VariationField.property(),
|
|
173
|
+
__metadata("design:type", Number)
|
|
174
|
+
], VariationField.prototype, "margin", void 0);
|
|
175
|
+
__decorate([
|
|
176
|
+
VariationField.property(),
|
|
177
|
+
__metadata("design:type", Number)
|
|
178
|
+
], VariationField.prototype, "variationCost", void 0);
|
|
179
|
+
__decorate([
|
|
180
|
+
VariationField.property({ type: 'DiscountGroup' }),
|
|
181
|
+
__metadata("design:type", Object)
|
|
182
|
+
], VariationField.prototype, "variationCostDiscountGroup", void 0);
|
|
183
|
+
__decorate([
|
|
184
|
+
VariationField.property(),
|
|
185
|
+
__metadata("design:type", Number)
|
|
186
|
+
], VariationField.prototype, "variationUnitCost", void 0);
|
|
187
|
+
__decorate([
|
|
188
|
+
VariationField.property({ embeddedByDefault: false }),
|
|
189
|
+
__metadata("design:type", Number)
|
|
190
|
+
], VariationField.prototype, "buyUnitCost", void 0);
|
|
191
|
+
__decorate([
|
|
192
|
+
VariationField.property({ embeddedByDefault: false }),
|
|
193
|
+
__metadata("design:type", Number)
|
|
194
|
+
], VariationField.prototype, "buyCost", void 0);
|
|
195
|
+
__decorate([
|
|
196
|
+
VariationField.property({ type: 'DiscountGroup' }),
|
|
197
|
+
__metadata("design:type", Object)
|
|
198
|
+
], VariationField.prototype, "variationUnitCostDiscountGroup", void 0);
|
|
199
|
+
__decorate([
|
|
200
|
+
VariationField.property(),
|
|
201
|
+
__metadata("design:type", Number)
|
|
202
|
+
], VariationField.prototype, "rows", void 0);
|
|
203
|
+
__decorate([
|
|
204
|
+
VariationField.property({ type: Number }),
|
|
205
|
+
__metadata("design:type", Object)
|
|
206
|
+
], VariationField.prototype, "fieldMin", void 0);
|
|
207
|
+
__decorate([
|
|
208
|
+
VariationField.property({ type: Number }),
|
|
209
|
+
__metadata("design:type", Object)
|
|
210
|
+
], VariationField.prototype, "fieldMax", void 0);
|
|
211
|
+
__decorate([
|
|
212
|
+
VariationField.property(),
|
|
213
|
+
__metadata("design:type", Boolean)
|
|
214
|
+
], VariationField.prototype, "allowDecimal", void 0);
|
|
215
|
+
__decorate([
|
|
216
|
+
VariationField.property(),
|
|
217
|
+
__metadata("design:type", Boolean)
|
|
218
|
+
], VariationField.prototype, "isHtml", void 0);
|
|
219
|
+
__decorate([
|
|
220
|
+
VariationField.property(),
|
|
221
|
+
__metadata("design:type", Boolean)
|
|
222
|
+
], VariationField.prototype, "considerBusinessHours", void 0);
|
|
223
|
+
__decorate([
|
|
224
|
+
VariationField.property(),
|
|
225
|
+
__metadata("design:type", Boolean)
|
|
226
|
+
], VariationField.prototype, "shippingTimeIncluded", void 0);
|
|
227
|
+
__decorate([
|
|
228
|
+
VariationField.property(),
|
|
229
|
+
__metadata("design:type", Boolean)
|
|
230
|
+
], VariationField.prototype, "sellerProductEditable", void 0);
|
|
231
|
+
__decorate([
|
|
232
|
+
VariationField.property(),
|
|
233
|
+
__metadata("design:type", Boolean)
|
|
234
|
+
], VariationField.prototype, "multipleSelect", void 0);
|
|
235
|
+
__decorate([
|
|
236
|
+
VariationField.property(),
|
|
237
|
+
__metadata("design:type", Boolean)
|
|
238
|
+
], VariationField.prototype, "showFilePreview", void 0);
|
|
239
|
+
__decorate([
|
|
240
|
+
VariationField.property(),
|
|
241
|
+
__metadata("design:type", Boolean)
|
|
242
|
+
], VariationField.prototype, "allowFileMultiple", void 0);
|
|
243
|
+
__decorate([
|
|
244
|
+
VariationField.property(),
|
|
245
|
+
__metadata("design:type", Boolean)
|
|
246
|
+
], VariationField.prototype, "allowFileJpeg", void 0);
|
|
247
|
+
__decorate([
|
|
248
|
+
VariationField.property(),
|
|
249
|
+
__metadata("design:type", Boolean)
|
|
250
|
+
], VariationField.prototype, "allowFileGif", void 0);
|
|
251
|
+
__decorate([
|
|
252
|
+
VariationField.property(),
|
|
253
|
+
__metadata("design:type", Boolean)
|
|
254
|
+
], VariationField.prototype, "allowFilePdf", void 0);
|
|
255
|
+
__decorate([
|
|
256
|
+
VariationField.property(),
|
|
257
|
+
__metadata("design:type", Boolean)
|
|
258
|
+
], VariationField.prototype, "allowFilePng", void 0);
|
|
259
|
+
__decorate([
|
|
260
|
+
VariationField.property(),
|
|
261
|
+
__metadata("design:type", Boolean)
|
|
262
|
+
], VariationField.prototype, "allowFileAi", void 0);
|
|
263
|
+
__decorate([
|
|
264
|
+
VariationField.property(),
|
|
265
|
+
__metadata("design:type", Number)
|
|
266
|
+
], VariationField.prototype, "maxColours", void 0);
|
|
267
|
+
__decorate([
|
|
268
|
+
VariationField.property(),
|
|
269
|
+
__metadata("design:type", Boolean)
|
|
270
|
+
], VariationField.prototype, "simplifyColours", void 0);
|
|
271
|
+
__decorate([
|
|
272
|
+
VariationField.property(),
|
|
273
|
+
__metadata("design:type", Number)
|
|
274
|
+
], VariationField.prototype, "colourVariationCost", void 0);
|
|
275
|
+
__decorate([
|
|
276
|
+
VariationField.property({ type: 'DiscountGroup' }),
|
|
277
|
+
__metadata("design:type", Object)
|
|
278
|
+
], VariationField.prototype, "colourVariationCostDiscountGroup", void 0);
|
|
279
|
+
__decorate([
|
|
280
|
+
VariationField.property(),
|
|
281
|
+
__metadata("design:type", Number)
|
|
282
|
+
], VariationField.prototype, "colourVariationUnitCost", void 0);
|
|
283
|
+
__decorate([
|
|
284
|
+
VariationField.property({ type: 'DiscountGroup' }),
|
|
285
|
+
__metadata("design:type", Object)
|
|
286
|
+
], VariationField.prototype, "colourVariationUnitCostDiscountGroup", void 0);
|
|
287
|
+
__decorate([
|
|
288
|
+
VariationField.property(),
|
|
289
|
+
__metadata("design:type", Number)
|
|
290
|
+
], VariationField.prototype, "heightVariationCost", void 0);
|
|
291
|
+
__decorate([
|
|
292
|
+
VariationField.property({ type: 'DiscountGroup' }),
|
|
293
|
+
__metadata("design:type", Object)
|
|
294
|
+
], VariationField.prototype, "heightVariationCostDiscountGroup", void 0);
|
|
295
|
+
__decorate([
|
|
296
|
+
VariationField.property(),
|
|
297
|
+
__metadata("design:type", Number)
|
|
298
|
+
], VariationField.prototype, "heightVariationUnitCost", void 0);
|
|
299
|
+
__decorate([
|
|
300
|
+
VariationField.property({ type: 'DiscountGroup' }),
|
|
301
|
+
__metadata("design:type", Object)
|
|
302
|
+
], VariationField.prototype, "heightVariationUnitCostDiscountGroup", void 0);
|
|
303
|
+
__decorate([
|
|
304
|
+
VariationField.property(),
|
|
305
|
+
__metadata("design:type", Number)
|
|
306
|
+
], VariationField.prototype, "widthVariationCost", void 0);
|
|
307
|
+
__decorate([
|
|
308
|
+
VariationField.property({ type: 'DiscountGroup' }),
|
|
309
|
+
__metadata("design:type", Object)
|
|
310
|
+
], VariationField.prototype, "widthVariationCostDiscountGroup", void 0);
|
|
311
|
+
__decorate([
|
|
312
|
+
VariationField.property(),
|
|
313
|
+
__metadata("design:type", Number)
|
|
314
|
+
], VariationField.prototype, "widthVariationUnitCost", void 0);
|
|
315
|
+
__decorate([
|
|
316
|
+
VariationField.property({ type: 'DiscountGroup' }),
|
|
317
|
+
__metadata("design:type", Object)
|
|
318
|
+
], VariationField.prototype, "widthVariationUnitCostDiscountGroup", void 0);
|
|
319
|
+
__decorate([
|
|
320
|
+
VariationField.property({ type: Number }),
|
|
321
|
+
__metadata("design:type", Object)
|
|
322
|
+
], VariationField.prototype, "heightFieldMin", void 0);
|
|
323
|
+
__decorate([
|
|
324
|
+
VariationField.property({ type: Number }),
|
|
325
|
+
__metadata("design:type", Object)
|
|
326
|
+
], VariationField.prototype, "heightFieldMax", void 0);
|
|
327
|
+
__decorate([
|
|
328
|
+
VariationField.property({ type: Number }),
|
|
329
|
+
__metadata("design:type", Object)
|
|
330
|
+
], VariationField.prototype, "widthFieldMin", void 0);
|
|
331
|
+
__decorate([
|
|
332
|
+
VariationField.property({ type: Number }),
|
|
333
|
+
__metadata("design:type", Object)
|
|
334
|
+
], VariationField.prototype, "widthFieldMax", void 0);
|
|
335
|
+
__decorate([
|
|
336
|
+
VariationField.property(),
|
|
337
|
+
__metadata("design:type", String)
|
|
338
|
+
], VariationField.prototype, "areaUnit", void 0);
|
|
339
|
+
__decorate([
|
|
340
|
+
VariationField.property(),
|
|
341
|
+
__metadata("design:type", String)
|
|
342
|
+
], VariationField.prototype, "areaInputType", void 0);
|
|
343
|
+
__decorate([
|
|
344
|
+
VariationField.property({ type: Number }),
|
|
345
|
+
__metadata("design:type", Object)
|
|
346
|
+
], VariationField.prototype, "areaStep", void 0);
|
|
347
|
+
__decorate([
|
|
348
|
+
VariationField.property(),
|
|
349
|
+
__metadata("design:type", Boolean)
|
|
350
|
+
], VariationField.prototype, "aspectRatioLock", void 0);
|
|
351
|
+
__decorate([
|
|
352
|
+
VariationField.property({ type: Number }),
|
|
353
|
+
__metadata("design:type", Object)
|
|
354
|
+
], VariationField.prototype, "aspectRatio", void 0);
|
|
355
|
+
__decorate([
|
|
356
|
+
VariationField.property(),
|
|
357
|
+
__metadata("design:type", Product)
|
|
358
|
+
], VariationField.prototype, "product", void 0);
|
|
359
|
+
__decorate([
|
|
360
|
+
VariationField.property({ arrayType: 'VariationFieldsOption' }),
|
|
361
|
+
__metadata("design:type", Array)
|
|
362
|
+
], VariationField.prototype, "selectedBy", void 0);
|
|
363
|
+
__decorate([
|
|
364
|
+
VariationField.property({ type: 'InventoryGroup' }),
|
|
365
|
+
__metadata("design:type", InventoryGroup)
|
|
366
|
+
], VariationField.prototype, "inventoryGroup", void 0);
|
|
367
|
+
__decorate([
|
|
368
|
+
VariationField.property({ type: 'InventoryGroup' }),
|
|
369
|
+
__metadata("design:type", InventoryGroup)
|
|
370
|
+
], VariationField.prototype, "linkedInventoryGroup", void 0);
|
|
371
|
+
__decorate([
|
|
372
|
+
VariationField.property({ arrayType: 'Variation' }),
|
|
373
|
+
__metadata("design:type", Array)
|
|
374
|
+
], VariationField.prototype, "variations", void 0);
|
|
375
|
+
__decorate([
|
|
376
|
+
VariationField.property({ arrayType: 'VariationFieldsOption' }),
|
|
377
|
+
__metadata("design:type", Array)
|
|
378
|
+
], VariationField.prototype, "options", void 0);
|
|
379
|
+
return VariationField;
|
|
380
|
+
}(Entity));
|
|
381
|
+
export { VariationField };
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { Merchi } from '../merchi.js';
|
|
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,153 @@
|
|
|
1
|
+
var __extends = (this && this.__extends) || (function () {
|
|
2
|
+
var extendStatics = function (d, b) {
|
|
3
|
+
extendStatics = Object.setPrototypeOf ||
|
|
4
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
5
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
6
|
+
return extendStatics(d, b);
|
|
7
|
+
};
|
|
8
|
+
return function (d, b) {
|
|
9
|
+
if (typeof b !== "function" && b !== null)
|
|
10
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
11
|
+
extendStatics(d, b);
|
|
12
|
+
function __() { this.constructor = d; }
|
|
13
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
14
|
+
};
|
|
15
|
+
})();
|
|
16
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
17
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
18
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
19
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
20
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
21
|
+
};
|
|
22
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
23
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
24
|
+
};
|
|
25
|
+
import { Entity } from '../entity.js';
|
|
26
|
+
import { MerchiFile } from './file.js';
|
|
27
|
+
import { VariationField } from './variation_field.js';
|
|
28
|
+
var VariationFieldsOption = /** @class */ (function (_super) {
|
|
29
|
+
__extends(VariationFieldsOption, _super);
|
|
30
|
+
function VariationFieldsOption() {
|
|
31
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
32
|
+
_this.totalCost = function (quantity) {
|
|
33
|
+
if (_this.variationCost === undefined) {
|
|
34
|
+
throw new Error('variationCost is unknown');
|
|
35
|
+
}
|
|
36
|
+
if (_this.variationUnitCost === undefined) {
|
|
37
|
+
throw new Error('variationUnitCost is unknown');
|
|
38
|
+
}
|
|
39
|
+
return _this.variationCost + _this.variationUnitCost * quantity;
|
|
40
|
+
};
|
|
41
|
+
_this.buildVariationOption = function () {
|
|
42
|
+
var result = new _this.merchi.VariationOption(_this.merchi);
|
|
43
|
+
result.optionId = _this.id;
|
|
44
|
+
result.include = _this.include;
|
|
45
|
+
result.value = _this.value;
|
|
46
|
+
result.position = _this.position;
|
|
47
|
+
result.default = _this.default;
|
|
48
|
+
result.colour = _this.colour;
|
|
49
|
+
result.linkedFile = _this.linkedFile;
|
|
50
|
+
result.quantity = 0;
|
|
51
|
+
result.currency = _this.currency;
|
|
52
|
+
result.unitCost = _this.variationUnitCost;
|
|
53
|
+
result.unitCostTotal = 0;
|
|
54
|
+
result.onceOffCost = _this.variationCost;
|
|
55
|
+
result.totalCost = _this.variationCost;
|
|
56
|
+
return result;
|
|
57
|
+
};
|
|
58
|
+
return _this;
|
|
59
|
+
}
|
|
60
|
+
VariationFieldsOption.resourceName = 'variation_fields_options';
|
|
61
|
+
VariationFieldsOption.singularName = 'variationFieldsOption';
|
|
62
|
+
VariationFieldsOption.pluralName = 'variationFieldsOptions';
|
|
63
|
+
__decorate([
|
|
64
|
+
VariationFieldsOption.property({ type: Date }),
|
|
65
|
+
__metadata("design:type", Object)
|
|
66
|
+
], VariationFieldsOption.prototype, "archived", void 0);
|
|
67
|
+
__decorate([
|
|
68
|
+
VariationFieldsOption.property(),
|
|
69
|
+
__metadata("design:type", Number)
|
|
70
|
+
], VariationFieldsOption.prototype, "id", void 0);
|
|
71
|
+
__decorate([
|
|
72
|
+
VariationFieldsOption.property({ type: String }),
|
|
73
|
+
__metadata("design:type", Object)
|
|
74
|
+
], VariationFieldsOption.prototype, "value", void 0);
|
|
75
|
+
__decorate([
|
|
76
|
+
VariationFieldsOption.property({ type: String }),
|
|
77
|
+
__metadata("design:type", Object)
|
|
78
|
+
], VariationFieldsOption.prototype, "colour", void 0);
|
|
79
|
+
__decorate([
|
|
80
|
+
VariationFieldsOption.property(),
|
|
81
|
+
__metadata("design:type", Boolean)
|
|
82
|
+
], VariationFieldsOption.prototype, "isExtracted", void 0);
|
|
83
|
+
__decorate([
|
|
84
|
+
VariationFieldsOption.property(),
|
|
85
|
+
__metadata("design:type", String)
|
|
86
|
+
], VariationFieldsOption.prototype, "currency", void 0);
|
|
87
|
+
__decorate([
|
|
88
|
+
VariationFieldsOption.property(),
|
|
89
|
+
__metadata("design:type", Boolean)
|
|
90
|
+
], VariationFieldsOption.prototype, "default", void 0);
|
|
91
|
+
__decorate([
|
|
92
|
+
VariationFieldsOption.property(),
|
|
93
|
+
__metadata("design:type", Boolean)
|
|
94
|
+
], VariationFieldsOption.prototype, "include", void 0);
|
|
95
|
+
__decorate([
|
|
96
|
+
VariationFieldsOption.property(),
|
|
97
|
+
__metadata("design:type", Boolean)
|
|
98
|
+
], VariationFieldsOption.prototype, "noInventory", void 0);
|
|
99
|
+
__decorate([
|
|
100
|
+
VariationFieldsOption.property(),
|
|
101
|
+
__metadata("design:type", Number)
|
|
102
|
+
], VariationFieldsOption.prototype, "position", void 0);
|
|
103
|
+
__decorate([
|
|
104
|
+
VariationFieldsOption.property(),
|
|
105
|
+
__metadata("design:type", Number)
|
|
106
|
+
], VariationFieldsOption.prototype, "deliveryDays", void 0);
|
|
107
|
+
__decorate([
|
|
108
|
+
VariationFieldsOption.property(),
|
|
109
|
+
__metadata("design:type", Number)
|
|
110
|
+
], VariationFieldsOption.prototype, "variationCost", void 0);
|
|
111
|
+
__decorate([
|
|
112
|
+
VariationFieldsOption.property({ type: 'DiscountGroup' }),
|
|
113
|
+
__metadata("design:type", Object)
|
|
114
|
+
], VariationFieldsOption.prototype, "variationCostDiscountGroup", void 0);
|
|
115
|
+
__decorate([
|
|
116
|
+
VariationFieldsOption.property(),
|
|
117
|
+
__metadata("design:type", Number)
|
|
118
|
+
], VariationFieldsOption.prototype, "variationUnitCost", void 0);
|
|
119
|
+
__decorate([
|
|
120
|
+
VariationFieldsOption.property({ embeddedByDefault: false }),
|
|
121
|
+
__metadata("design:type", Number)
|
|
122
|
+
], VariationFieldsOption.prototype, "buyUnitCost", void 0);
|
|
123
|
+
__decorate([
|
|
124
|
+
VariationFieldsOption.property({ embeddedByDefault: false }),
|
|
125
|
+
__metadata("design:type", Number)
|
|
126
|
+
], VariationFieldsOption.prototype, "buyCost", void 0);
|
|
127
|
+
__decorate([
|
|
128
|
+
VariationFieldsOption.property({ type: 'DiscountGroup' }),
|
|
129
|
+
__metadata("design:type", Object)
|
|
130
|
+
], VariationFieldsOption.prototype, "variationUnitCostDiscountGroup", void 0);
|
|
131
|
+
__decorate([
|
|
132
|
+
VariationFieldsOption.property({ type: VariationField }),
|
|
133
|
+
__metadata("design:type", Object)
|
|
134
|
+
], VariationFieldsOption.prototype, "variationField", void 0);
|
|
135
|
+
__decorate([
|
|
136
|
+
VariationFieldsOption.property({ type: MerchiFile }),
|
|
137
|
+
__metadata("design:type", Object)
|
|
138
|
+
], VariationFieldsOption.prototype, "linkedFile", void 0);
|
|
139
|
+
__decorate([
|
|
140
|
+
VariationFieldsOption.property({ arrayType: 'Variation' }),
|
|
141
|
+
__metadata("design:type", Array)
|
|
142
|
+
], VariationFieldsOption.prototype, "selectedByVariations", void 0);
|
|
143
|
+
__decorate([
|
|
144
|
+
VariationFieldsOption.property({ arrayType: 'InventoryUnitVariation' }),
|
|
145
|
+
__metadata("design:type", Array)
|
|
146
|
+
], VariationFieldsOption.prototype, "inventoryUnitVariations", void 0);
|
|
147
|
+
__decorate([
|
|
148
|
+
VariationFieldsOption.property({ arrayType: 'VariationFieldsOption' }),
|
|
149
|
+
__metadata("design:type", Array)
|
|
150
|
+
], VariationFieldsOption.prototype, "selectedBy", void 0);
|
|
151
|
+
return VariationFieldsOption;
|
|
152
|
+
}(Entity));
|
|
153
|
+
export { VariationFieldsOption };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Merchi } from '../merchi.js';
|
|
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 () { return vfo.totalCost(33); }).toThrow();
|
|
11
|
+
vfo.variationCost = 12.4;
|
|
12
|
+
expect(function () { return vfo.totalCost(33); }).toThrow();
|
|
13
|
+
vfo.variationUnitCost = 9.98;
|
|
14
|
+
expect(vfo.totalCost(33)).toEqual(341.74);
|
|
15
|
+
});
|
|
16
|
+
test('buildVariationOption', function () {
|
|
17
|
+
var merchi = new Merchi();
|
|
18
|
+
var option = new merchi.VariationFieldsOption();
|
|
19
|
+
var file = new merchi.MerchiFile();
|
|
20
|
+
file.id = 1;
|
|
21
|
+
option.id = 1;
|
|
22
|
+
option.value = 'aa';
|
|
23
|
+
option.position = 3;
|
|
24
|
+
option.default = true;
|
|
25
|
+
option.colour = '#AAAAAA';
|
|
26
|
+
option.linkedFile = file;
|
|
27
|
+
option.currency = 'AUD';
|
|
28
|
+
option.variationCost = 100;
|
|
29
|
+
option.variationUnitCost = 1;
|
|
30
|
+
var variationOption = option.buildVariationOption();
|
|
31
|
+
expect(variationOption.optionId).toEqual(option.id);
|
|
32
|
+
expect(variationOption.value).toEqual(option.value);
|
|
33
|
+
expect(variationOption.position).toEqual(option.position);
|
|
34
|
+
expect(variationOption.default).toEqual(option.default);
|
|
35
|
+
expect(variationOption.colour).toEqual(option.colour);
|
|
36
|
+
expect(variationOption.linkedFile.id).toEqual(1);
|
|
37
|
+
expect(variationOption.quantity).toEqual(0);
|
|
38
|
+
expect(variationOption.currency).toEqual(option.currency);
|
|
39
|
+
expect(variationOption.onceOffCost).toEqual(option.variationCost);
|
|
40
|
+
expect(variationOption.unitCost).toEqual(option.variationUnitCost);
|
|
41
|
+
expect(variationOption.unitCostTotal).toEqual(0);
|
|
42
|
+
expect(variationOption.totalCost).toEqual(option.variationCost);
|
|
43
|
+
});
|