@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,486 @@
|
|
|
1
|
+
import * as _ from 'lodash';
|
|
2
|
+
import { CartItem } from './cart_item.js';
|
|
3
|
+
import { Category } from './category.js';
|
|
4
|
+
import { Company } from './company.js';
|
|
5
|
+
import { ProductForm } from './product_form.js';
|
|
6
|
+
import { CountryTax } from './country_tax.js';
|
|
7
|
+
import { DiscountGroup } from './discount_group.js';
|
|
8
|
+
import { Domain } from './domain.js';
|
|
9
|
+
import { DomainTag } from './domain_tag.js';
|
|
10
|
+
import { DraftPreview } from './draft_preview.js';
|
|
11
|
+
import { DraftTemplate } from './draft_template.js';
|
|
12
|
+
import { Entity } from '../entity.js';
|
|
13
|
+
import { MerchiFile } from './file.js';
|
|
14
|
+
import { Reminder } from './reminder.js';
|
|
15
|
+
import { InternalTag } from './internal_tag.js';
|
|
16
|
+
import { Inventory } from './inventory.js';
|
|
17
|
+
import { InventoryGroup } from './inventory_group.js';
|
|
18
|
+
import { SupplyDomain } from './supply_domain.js';
|
|
19
|
+
import { User } from './user.js';
|
|
20
|
+
import { VariationField } from './variation_field.js';
|
|
21
|
+
import { ShipmentMethod } from './shipment_method.js';
|
|
22
|
+
import {
|
|
23
|
+
AutoAssignProductionOnAction
|
|
24
|
+
} from '../constants/auto_assign_production_on_actions.js';
|
|
25
|
+
import { Job } from './job.js';
|
|
26
|
+
|
|
27
|
+
export class Product extends Entity {
|
|
28
|
+
protected static resourceName = 'products';
|
|
29
|
+
protected static singularName = 'product';
|
|
30
|
+
protected static pluralName = 'products';
|
|
31
|
+
|
|
32
|
+
@Product.property({type: Date})
|
|
33
|
+
public archived?: Date | null;
|
|
34
|
+
|
|
35
|
+
@Product.property()
|
|
36
|
+
public id?: number;
|
|
37
|
+
|
|
38
|
+
@Product.property()
|
|
39
|
+
public position?: number;
|
|
40
|
+
|
|
41
|
+
@Product.property({type: Date})
|
|
42
|
+
public created?: Date;
|
|
43
|
+
|
|
44
|
+
@Product.property({type: Date})
|
|
45
|
+
public updated?: Date;
|
|
46
|
+
|
|
47
|
+
@Product.property({type: Date})
|
|
48
|
+
public storefrontLastDeployed?: Date | null;
|
|
49
|
+
|
|
50
|
+
@Product.property({type: 'User'})
|
|
51
|
+
public createdBy?: User | null;
|
|
52
|
+
|
|
53
|
+
@Product.property({type: 'User'})
|
|
54
|
+
public designer?: User | null;
|
|
55
|
+
|
|
56
|
+
@Product.property({type: 'User'})
|
|
57
|
+
public updatedBy?: User | null;
|
|
58
|
+
|
|
59
|
+
@Product.property()
|
|
60
|
+
public productType?: number;
|
|
61
|
+
|
|
62
|
+
@Product.property()
|
|
63
|
+
public minimum?: number;
|
|
64
|
+
|
|
65
|
+
@Product.property()
|
|
66
|
+
public defaultQuantity?: number;
|
|
67
|
+
|
|
68
|
+
@Product.property()
|
|
69
|
+
public minimumPrice?: number;
|
|
70
|
+
|
|
71
|
+
@Product.property()
|
|
72
|
+
public setupPrice?: number;
|
|
73
|
+
|
|
74
|
+
@Product.property()
|
|
75
|
+
public setupPerGroup?: boolean;
|
|
76
|
+
|
|
77
|
+
@Product.property()
|
|
78
|
+
public minimumPerGroup?: boolean;
|
|
79
|
+
|
|
80
|
+
@Product.property()
|
|
81
|
+
public groupsFirst?: boolean;
|
|
82
|
+
|
|
83
|
+
@Product.property()
|
|
84
|
+
public deliveryDaysNormal?: number;
|
|
85
|
+
|
|
86
|
+
@Product.property()
|
|
87
|
+
public unitPrice?: number;
|
|
88
|
+
|
|
89
|
+
@Product.property({embeddedByDefault: false})
|
|
90
|
+
public buyUnitPrice?: number;
|
|
91
|
+
|
|
92
|
+
@Product.property({type: 'DiscountGroup'})
|
|
93
|
+
public unitPriceDiscountGroup?: DiscountGroup | null;
|
|
94
|
+
|
|
95
|
+
@Product.property({arrayType: 'ShipmentMethod'})
|
|
96
|
+
public shipmentMethods?: ShipmentMethod[];
|
|
97
|
+
|
|
98
|
+
@Product.property()
|
|
99
|
+
public margin?: number;
|
|
100
|
+
|
|
101
|
+
@Product.property({type: Number})
|
|
102
|
+
public unitWeight?: number | null;
|
|
103
|
+
|
|
104
|
+
@Product.property({type: Number})
|
|
105
|
+
public unitHeight?: number | null;
|
|
106
|
+
|
|
107
|
+
@Product.property({type: Number})
|
|
108
|
+
public unitWidth?: number | null;
|
|
109
|
+
|
|
110
|
+
@Product.property({type: Number})
|
|
111
|
+
public unitDepth?: number | null;
|
|
112
|
+
|
|
113
|
+
@Product.property()
|
|
114
|
+
public name?: string;
|
|
115
|
+
|
|
116
|
+
@Product.property()
|
|
117
|
+
public country?: string;
|
|
118
|
+
|
|
119
|
+
@Product.property()
|
|
120
|
+
public currency?: string;
|
|
121
|
+
|
|
122
|
+
@Product.property({type: String})
|
|
123
|
+
public description?: string | null;
|
|
124
|
+
|
|
125
|
+
@Product.property({type: String})
|
|
126
|
+
public notes?: string | null;
|
|
127
|
+
|
|
128
|
+
@Product.property({type: String})
|
|
129
|
+
public internalUseNotes?: string;
|
|
130
|
+
|
|
131
|
+
@Product.property({type: String})
|
|
132
|
+
public internalUseAiContext?: string;
|
|
133
|
+
|
|
134
|
+
@Product.property({type: String})
|
|
135
|
+
public aiContext?: string;
|
|
136
|
+
|
|
137
|
+
@Product.property({type: String})
|
|
138
|
+
public googleMerchantCenterId?: string;
|
|
139
|
+
|
|
140
|
+
@Product.property({type: String})
|
|
141
|
+
public googleMerchantCenterTitle?: string;
|
|
142
|
+
|
|
143
|
+
@Product.property({type: String})
|
|
144
|
+
public googleMerchantCenterDescription?: string;
|
|
145
|
+
|
|
146
|
+
@Product.property({type: String})
|
|
147
|
+
public googleMerchantCenterProductUrl?: string;
|
|
148
|
+
|
|
149
|
+
@Product.property({type: String})
|
|
150
|
+
public googleMerchantCenterPrice?: number;
|
|
151
|
+
|
|
152
|
+
@Product.property({type: String})
|
|
153
|
+
public shopifyProductId?: string | null;
|
|
154
|
+
|
|
155
|
+
@Product.property({type: String})
|
|
156
|
+
public spProductId?: string | null;
|
|
157
|
+
|
|
158
|
+
@Product.property()
|
|
159
|
+
public useCompanyShipmentMethods?: boolean;
|
|
160
|
+
|
|
161
|
+
@Product.property()
|
|
162
|
+
public dropShipment?: boolean;
|
|
163
|
+
|
|
164
|
+
@Product.property()
|
|
165
|
+
public needsDrafting?: boolean;
|
|
166
|
+
|
|
167
|
+
@Product.property()
|
|
168
|
+
public needsProduction?: boolean;
|
|
169
|
+
|
|
170
|
+
@Product.property()
|
|
171
|
+
public needsShipping?: boolean;
|
|
172
|
+
|
|
173
|
+
@Product.property()
|
|
174
|
+
public needsInvoicing?: boolean;
|
|
175
|
+
|
|
176
|
+
@Product.property()
|
|
177
|
+
public needsInventory?: boolean;
|
|
178
|
+
|
|
179
|
+
@Product.property({type: Date})
|
|
180
|
+
public featureDeadline?: Date;
|
|
181
|
+
|
|
182
|
+
@Product.property()
|
|
183
|
+
public showFeatureDeadline?: boolean;
|
|
184
|
+
|
|
185
|
+
@Product.property()
|
|
186
|
+
public showPublic?: boolean;
|
|
187
|
+
|
|
188
|
+
@Product.property()
|
|
189
|
+
public isDraft?: boolean;
|
|
190
|
+
|
|
191
|
+
@Product.property()
|
|
192
|
+
public showGroupBuyStatus?: boolean;
|
|
193
|
+
|
|
194
|
+
@Product.property({type: Number})
|
|
195
|
+
public groupBuyStatus?: number | null;
|
|
196
|
+
|
|
197
|
+
@Product.property()
|
|
198
|
+
public acceptSquare?: boolean;
|
|
199
|
+
|
|
200
|
+
@Product.property()
|
|
201
|
+
public acceptStripe?: boolean;
|
|
202
|
+
|
|
203
|
+
@Product.property()
|
|
204
|
+
public acceptPaypal?: boolean;
|
|
205
|
+
|
|
206
|
+
@Product.property()
|
|
207
|
+
public acceptUtrust?: boolean;
|
|
208
|
+
|
|
209
|
+
@Product.property()
|
|
210
|
+
public acceptBankTransfer?: boolean;
|
|
211
|
+
|
|
212
|
+
@Product.property()
|
|
213
|
+
public acceptPhonePayment?: boolean;
|
|
214
|
+
|
|
215
|
+
@Product.property()
|
|
216
|
+
public allowAddToCart?: boolean;
|
|
217
|
+
|
|
218
|
+
@Product.property()
|
|
219
|
+
public allowAutomaticPaymentSupply?: boolean;
|
|
220
|
+
|
|
221
|
+
@Product.property()
|
|
222
|
+
public allowGroupBuy?: boolean;
|
|
223
|
+
|
|
224
|
+
@Product.property()
|
|
225
|
+
public allowPaymentUpfront?: boolean;
|
|
226
|
+
|
|
227
|
+
@Product.property()
|
|
228
|
+
public allowQuotation?: boolean;
|
|
229
|
+
|
|
230
|
+
@Product.property()
|
|
231
|
+
public allowChainedInventoryCreation?: boolean;
|
|
232
|
+
|
|
233
|
+
@Product.property()
|
|
234
|
+
public allowClientDraftContribution?: boolean;
|
|
235
|
+
|
|
236
|
+
@Product.property()
|
|
237
|
+
public chainedInventoryHandlingUnitPrice?: number;
|
|
238
|
+
|
|
239
|
+
@Product.property()
|
|
240
|
+
public bestPrice?: number;
|
|
241
|
+
|
|
242
|
+
@Product.property()
|
|
243
|
+
public unitVolume?: number;
|
|
244
|
+
|
|
245
|
+
@Product.property({arrayType: 'Category'})
|
|
246
|
+
public categories?: Category[];
|
|
247
|
+
|
|
248
|
+
@Product.property({arrayType: 'Category'})
|
|
249
|
+
public platformCategories?: Category[];
|
|
250
|
+
|
|
251
|
+
@Product.property({arrayType: 'DiscountGroup'})
|
|
252
|
+
public discountGroups?: DiscountGroup[];
|
|
253
|
+
|
|
254
|
+
@Product.property()
|
|
255
|
+
public domain?: Domain;
|
|
256
|
+
|
|
257
|
+
@Product.property({type: CountryTax})
|
|
258
|
+
public taxType?: CountryTax | null;
|
|
259
|
+
|
|
260
|
+
@Product.property({type: Product})
|
|
261
|
+
public originalProduct?: Product | null;
|
|
262
|
+
|
|
263
|
+
@Product.property({type: Product})
|
|
264
|
+
public clonedFromProduct?: Product | null;
|
|
265
|
+
|
|
266
|
+
@Product.property({type: Product})
|
|
267
|
+
public chainedSupplierProduct?: Product | null;
|
|
268
|
+
|
|
269
|
+
@Product.property({arrayType: 'Product'})
|
|
270
|
+
public chainedSellerProducts?: Product[];
|
|
271
|
+
|
|
272
|
+
@Product.property({type: Product})
|
|
273
|
+
public chainedInventorySupplierProduct?: Product | null;
|
|
274
|
+
|
|
275
|
+
@Product.property({arrayType: 'Product'})
|
|
276
|
+
public chainedInventorySellerProducts?: Product[];
|
|
277
|
+
|
|
278
|
+
@Product.property({type: ProductForm})
|
|
279
|
+
public productForm?: ProductForm | null;
|
|
280
|
+
|
|
281
|
+
@Product.property({arrayType: 'MerchiFile'})
|
|
282
|
+
public images?: MerchiFile[];
|
|
283
|
+
|
|
284
|
+
@Product.property({arrayType: 'MerchiFile'})
|
|
285
|
+
public publicFiles?: MerchiFile[];
|
|
286
|
+
|
|
287
|
+
@Product.property({arrayType: 'MerchiFile'})
|
|
288
|
+
public productionFiles?: MerchiFile[];
|
|
289
|
+
|
|
290
|
+
@Product.property({arrayType: 'VariationField'})
|
|
291
|
+
public groupVariationFields?: VariationField[];
|
|
292
|
+
|
|
293
|
+
@Product.property({arrayType: 'VariationField'})
|
|
294
|
+
public independentVariationFields?: VariationField[];
|
|
295
|
+
|
|
296
|
+
@Product.property({arrayType: 'DomainTag'})
|
|
297
|
+
public tags?: DomainTag[];
|
|
298
|
+
|
|
299
|
+
@Product.property({arrayType: 'InternalTag'})
|
|
300
|
+
public internalTags?: InternalTag[];
|
|
301
|
+
|
|
302
|
+
@Product.property({type: MerchiFile})
|
|
303
|
+
public featureImage?: MerchiFile | null;
|
|
304
|
+
|
|
305
|
+
@Product.property({type: 'Job'})
|
|
306
|
+
public createdByJob?: Job | null;
|
|
307
|
+
|
|
308
|
+
@Product.property({type: 'Job'})
|
|
309
|
+
public defaultJob?: Job | null;
|
|
310
|
+
|
|
311
|
+
@Product.property({arrayType: 'Company', jsonName: 'saved_by_companies'})
|
|
312
|
+
public savedByCompanies?: Company[];
|
|
313
|
+
|
|
314
|
+
@Product.property({arrayType: 'SupplyDomain'})
|
|
315
|
+
public suppliedByDomains?: SupplyDomain[];
|
|
316
|
+
|
|
317
|
+
@Product.property()
|
|
318
|
+
public autoAssignProductionOnAction?: AutoAssignProductionOnAction;
|
|
319
|
+
|
|
320
|
+
@Product.property({arrayType: 'SupplyDomain'})
|
|
321
|
+
public supplyDomains?: SupplyDomain[];
|
|
322
|
+
|
|
323
|
+
@Product.property()
|
|
324
|
+
public inventoriesOpen?: boolean;
|
|
325
|
+
|
|
326
|
+
@Product.property()
|
|
327
|
+
public clientSideCalculation?: boolean;
|
|
328
|
+
|
|
329
|
+
@Product.property()
|
|
330
|
+
public supplyChainDisabled?: boolean;
|
|
331
|
+
|
|
332
|
+
@Product.property({arrayType: 'Inventory'})
|
|
333
|
+
public inventories?: Inventory[];
|
|
334
|
+
|
|
335
|
+
@Product.property({arrayType: 'InventoryGroup'})
|
|
336
|
+
public inventoryGroups?: InventoryGroup[];
|
|
337
|
+
|
|
338
|
+
@Product.property({arrayType: 'CartItem'})
|
|
339
|
+
public cartItems?: CartItem[];
|
|
340
|
+
|
|
341
|
+
@Product.property({arrayType: 'Job'})
|
|
342
|
+
public jobs?: Job[];
|
|
343
|
+
|
|
344
|
+
@Product.property({arrayType: 'Reminder'})
|
|
345
|
+
public reminders?: Reminder[];
|
|
346
|
+
|
|
347
|
+
@Product.property({arrayType: 'Job'})
|
|
348
|
+
public supplyChainRequestJobs?: Job[];
|
|
349
|
+
|
|
350
|
+
@Product.property({arrayType: 'User', jsonName: 'saved_by_users'})
|
|
351
|
+
public savedByUsers?: User[];
|
|
352
|
+
|
|
353
|
+
@Product.property({arrayType: 'User'})
|
|
354
|
+
public suppliers?: User[];
|
|
355
|
+
|
|
356
|
+
@Product.property({arrayType: 'DraftTemplate'})
|
|
357
|
+
public draftTemplates?: DraftTemplate[];
|
|
358
|
+
|
|
359
|
+
@Product.property({arrayType: 'DraftPreview'})
|
|
360
|
+
public draftPreviews?: DraftPreview[];
|
|
361
|
+
|
|
362
|
+
public duplicate = () => {
|
|
363
|
+
/* create a clone of this product on the backend, returning it. */
|
|
364
|
+
const constructor = this.constructor as typeof Product;
|
|
365
|
+
const resourceName = constructor.resourceName;
|
|
366
|
+
const singularName = constructor.singularName;
|
|
367
|
+
const resource = `/${resourceName}/${String(this.id)}/copy/`;
|
|
368
|
+
const fetchOptions = {method: 'POST'};
|
|
369
|
+
return this.merchi.authenticatedFetch(resource, fetchOptions).
|
|
370
|
+
then((data: any) => {
|
|
371
|
+
const product = new this.merchi.Product();
|
|
372
|
+
product.fromJson(data[singularName]);
|
|
373
|
+
return product;
|
|
374
|
+
});
|
|
375
|
+
};
|
|
376
|
+
|
|
377
|
+
public primaryImage = () => {
|
|
378
|
+
if (this.featureImage === undefined) {
|
|
379
|
+
throw new Error('featureImage is undefined, did you forget to embed it?');
|
|
380
|
+
}
|
|
381
|
+
if (this.images === undefined) {
|
|
382
|
+
throw new Error('images is undefined, did you forget to embed it?');
|
|
383
|
+
}
|
|
384
|
+
if (this.featureImage !== null) {
|
|
385
|
+
return this.featureImage;
|
|
386
|
+
}
|
|
387
|
+
if (this.images.length > 0) {
|
|
388
|
+
return this.images[0];
|
|
389
|
+
}
|
|
390
|
+
return null;
|
|
391
|
+
};
|
|
392
|
+
|
|
393
|
+
public hasGroupVariationFields = () => {
|
|
394
|
+
if (this.groupVariationFields === undefined) {
|
|
395
|
+
const err = 'groupVariationFields is undefined, did you forget to embed' +
|
|
396
|
+
' it?';
|
|
397
|
+
throw new Error(err);
|
|
398
|
+
}
|
|
399
|
+
return this.groupVariationFields.length > 0;
|
|
400
|
+
};
|
|
401
|
+
|
|
402
|
+
public hasIndependentVariationFields = () => {
|
|
403
|
+
if (this.independentVariationFields === undefined) {
|
|
404
|
+
const err = 'independentVariationFields is undefined, did you forget to' +
|
|
405
|
+
' embed it?';
|
|
406
|
+
throw new Error(err);
|
|
407
|
+
}
|
|
408
|
+
return this.independentVariationFields.length > 0;
|
|
409
|
+
};
|
|
410
|
+
|
|
411
|
+
public allVariationFields = () => {
|
|
412
|
+
if (this.groupVariationFields === undefined) {
|
|
413
|
+
const err = 'groupVariationFields is undefined, did you forget to embed' +
|
|
414
|
+
' it?';
|
|
415
|
+
throw new Error(err);
|
|
416
|
+
}
|
|
417
|
+
if (this.independentVariationFields === undefined) {
|
|
418
|
+
const err = 'independentVariationFields is undefined, did you forget to' +
|
|
419
|
+
' embed it?';
|
|
420
|
+
throw new Error(err);
|
|
421
|
+
}
|
|
422
|
+
const result: VariationField[] = [];
|
|
423
|
+
return result.concat(this.groupVariationFields,
|
|
424
|
+
this.independentVariationFields);
|
|
425
|
+
};
|
|
426
|
+
|
|
427
|
+
public buildEmptyVariations = () => {
|
|
428
|
+
if (this.independentVariationFields === undefined) {
|
|
429
|
+
const err = 'independentVariationFields is undefined, did you forget to' +
|
|
430
|
+
' embed it?';
|
|
431
|
+
throw new Error(err);
|
|
432
|
+
}
|
|
433
|
+
const iVF: VariationField[] =
|
|
434
|
+
_.orderBy(this.independentVariationFields, ['position'], ['asc']);
|
|
435
|
+
return iVF.map(field => field.buildEmptyVariation());
|
|
436
|
+
};
|
|
437
|
+
|
|
438
|
+
public buildEmptyVariationGroup = () => {
|
|
439
|
+
if (this.groupVariationFields === undefined) {
|
|
440
|
+
const err = 'groupVariationFields is undefined, did you forget to embed' +
|
|
441
|
+
' it?';
|
|
442
|
+
throw new Error(err);
|
|
443
|
+
}
|
|
444
|
+
const result = new this.merchi.VariationsGroup();
|
|
445
|
+
const variations = [];
|
|
446
|
+
let cost = 0;
|
|
447
|
+
const sortedFields = _.orderBy(
|
|
448
|
+
this.groupVariationFields, ['position'], ['asc']);
|
|
449
|
+
result.quantity = 0;
|
|
450
|
+
for (const variationField of sortedFields) {
|
|
451
|
+
const empty = variationField.buildEmptyVariation();
|
|
452
|
+
variations.push(empty);
|
|
453
|
+
cost += empty.cost as number;
|
|
454
|
+
}
|
|
455
|
+
result.groupCost = cost;
|
|
456
|
+
result.variations = variations;
|
|
457
|
+
return result;
|
|
458
|
+
};
|
|
459
|
+
|
|
460
|
+
public removeVariationField = (variationField: VariationField) => {
|
|
461
|
+
if (variationField.independent === undefined) {
|
|
462
|
+
throw new Error('variation.independent is undefined, did you ' +
|
|
463
|
+
'forget to embed it?');
|
|
464
|
+
}
|
|
465
|
+
if (this.independentVariationFields === undefined) {
|
|
466
|
+
const err = 'independentVariationFields is undefined, did you forget to' +
|
|
467
|
+
' embed it?';
|
|
468
|
+
throw new Error(err);
|
|
469
|
+
}
|
|
470
|
+
if (this.groupVariationFields === undefined) {
|
|
471
|
+
const err = 'groupVariationFields is undefined, did you forget to embed' +
|
|
472
|
+
' it?';
|
|
473
|
+
throw new Error(err);
|
|
474
|
+
}
|
|
475
|
+
const variationFields = variationField.independent ?
|
|
476
|
+
this.independentVariationFields : this.groupVariationFields;
|
|
477
|
+
const index = variationFields.findIndex(v => {
|
|
478
|
+
if (v.id === undefined) {
|
|
479
|
+
throw new Error('variation id is undefined, did you forget to ' +
|
|
480
|
+
'embed it?');
|
|
481
|
+
}
|
|
482
|
+
return v.id === variationField.id;
|
|
483
|
+
});
|
|
484
|
+
return variationFields.splice(index, 1);
|
|
485
|
+
};
|
|
486
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { Entity } from '../entity.js';
|
|
2
|
+
import { ProductFormVersion } from './product_form_version.js';
|
|
3
|
+
import { User } from './user.js';
|
|
4
|
+
|
|
5
|
+
export class ProductForm extends Entity {
|
|
6
|
+
protected static resourceName = 'product_forms';
|
|
7
|
+
protected static singularName = 'productForm';
|
|
8
|
+
protected static pluralName = 'productForms';
|
|
9
|
+
|
|
10
|
+
@ProductForm.property({type: Date})
|
|
11
|
+
public archived?: Date | null;
|
|
12
|
+
|
|
13
|
+
@ProductForm.property({type: Date})
|
|
14
|
+
public created?: Date;
|
|
15
|
+
|
|
16
|
+
@ProductForm.property({type: Date})
|
|
17
|
+
public updated?: Date;
|
|
18
|
+
|
|
19
|
+
@ProductForm.property({type: Number})
|
|
20
|
+
public id?: number;
|
|
21
|
+
|
|
22
|
+
@ProductForm.property({type: String})
|
|
23
|
+
public name?: string;
|
|
24
|
+
|
|
25
|
+
@ProductForm.property({type: String})
|
|
26
|
+
public description?: string;
|
|
27
|
+
|
|
28
|
+
@ProductForm.property()
|
|
29
|
+
public tags?: string[];
|
|
30
|
+
|
|
31
|
+
@ProductForm.property({type: String})
|
|
32
|
+
public source?: string;
|
|
33
|
+
|
|
34
|
+
@ProductForm.property({type: String})
|
|
35
|
+
public sdkVersion?: string;
|
|
36
|
+
|
|
37
|
+
@ProductForm.property({type: String})
|
|
38
|
+
public status?: string;
|
|
39
|
+
|
|
40
|
+
@ProductForm.property({type: 'ProductFormVersion'})
|
|
41
|
+
public activeVersion?: ProductFormVersion | null;
|
|
42
|
+
|
|
43
|
+
@ProductForm.property({arrayType: 'ProductFormVersion'})
|
|
44
|
+
public versions?: ProductFormVersion[];
|
|
45
|
+
|
|
46
|
+
@ProductForm.property({type: 'User'})
|
|
47
|
+
public createdBy?: User | null;
|
|
48
|
+
|
|
49
|
+
@ProductForm.property({type: 'User'})
|
|
50
|
+
public updatedBy?: User | null;
|
|
51
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { Entity } from '../entity.js';
|
|
2
|
+
import { User } from './user.js';
|
|
3
|
+
|
|
4
|
+
// Sentinel type for passthrough JSON columns (mirrors other entities). Must not
|
|
5
|
+
// be `Object`, which the property decorator rejects ("Bad attribute type").
|
|
6
|
+
const jsonPropertyType = class {};
|
|
7
|
+
|
|
8
|
+
export class ProductFormVersion extends Entity {
|
|
9
|
+
protected static resourceName = 'product_form_versions';
|
|
10
|
+
protected static singularName = 'productFormVersion';
|
|
11
|
+
protected static pluralName = 'productFormVersions';
|
|
12
|
+
|
|
13
|
+
@ProductFormVersion.property({type: Date})
|
|
14
|
+
public created?: Date;
|
|
15
|
+
|
|
16
|
+
@ProductFormVersion.property({type: Number})
|
|
17
|
+
public id?: number;
|
|
18
|
+
|
|
19
|
+
@ProductFormVersion.property({type: Number})
|
|
20
|
+
public versionNumber?: number;
|
|
21
|
+
|
|
22
|
+
@ProductFormVersion.property({type: String})
|
|
23
|
+
public source?: string;
|
|
24
|
+
|
|
25
|
+
@ProductFormVersion.property({type: String})
|
|
26
|
+
public sdkVersion?: string;
|
|
27
|
+
|
|
28
|
+
@ProductFormVersion.property({type: String})
|
|
29
|
+
public compiledBundleUrl?: string | null;
|
|
30
|
+
|
|
31
|
+
@ProductFormVersion.property({type: String})
|
|
32
|
+
public bundleSha?: string | null;
|
|
33
|
+
|
|
34
|
+
@ProductFormVersion.property({type: String})
|
|
35
|
+
public compiledError?: string | null;
|
|
36
|
+
|
|
37
|
+
@ProductFormVersion.property({type: jsonPropertyType})
|
|
38
|
+
public staticGateReport?: any;
|
|
39
|
+
|
|
40
|
+
@ProductFormVersion.property({type: String})
|
|
41
|
+
public status?: string;
|
|
42
|
+
|
|
43
|
+
@ProductFormVersion.property({type: Date})
|
|
44
|
+
public approvedAt?: Date | null;
|
|
45
|
+
|
|
46
|
+
@ProductFormVersion.property({type: 'User'})
|
|
47
|
+
public approvedBy?: User | null;
|
|
48
|
+
|
|
49
|
+
@ProductFormVersion.property({type: 'User'})
|
|
50
|
+
public createdBy?: User | null;
|
|
51
|
+
}
|