@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,17 @@
|
|
|
1
|
+
export function setup() {
|
|
2
|
+
beforeAll(function () {
|
|
3
|
+
global.BACKEND_URI = 'http://example.com/';
|
|
4
|
+
});
|
|
5
|
+
}
|
|
6
|
+
export function mockFetch(ok, data, status) {
|
|
7
|
+
var mock = jest.fn();
|
|
8
|
+
mock.mockImplementation(function () {
|
|
9
|
+
return Promise.resolve({
|
|
10
|
+
status: status,
|
|
11
|
+
ok: ok,
|
|
12
|
+
json: function () { return Promise.resolve(data); }
|
|
13
|
+
});
|
|
14
|
+
});
|
|
15
|
+
global.fetch = mock;
|
|
16
|
+
return mock;
|
|
17
|
+
}
|
package/dist/toasts.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export var toastNotifications = function (merchi, options) {
|
|
2
|
+
var resource = '/notifications-check-update/';
|
|
3
|
+
var data = new FormData();
|
|
4
|
+
var entities = options.entities, sections = options.sections, notificationTypes = options.notificationTypes;
|
|
5
|
+
data.set('entities', JSON.stringify(entities));
|
|
6
|
+
data.set('sections', JSON.stringify(sections));
|
|
7
|
+
data.set('notificationTypes', JSON.stringify(notificationTypes));
|
|
8
|
+
var fetchOptions = { method: 'POST', body: data };
|
|
9
|
+
return merchi
|
|
10
|
+
.authenticatedFetch(resource, fetchOptions)
|
|
11
|
+
.then(function (data) {
|
|
12
|
+
return data.notifications.map(function (n) { return new merchi.Notification().fromJson(n); });
|
|
13
|
+
});
|
|
14
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { setup, mockFetch } from './test_util.js';
|
|
2
|
+
import { toastNotifications } from './toasts.js';
|
|
3
|
+
import { Merchi } from './merchi.js';
|
|
4
|
+
import { NotificationSection } from './constants/notification_sections.js';
|
|
5
|
+
import { NotificationType } from './constants/notification_types.js';
|
|
6
|
+
setup();
|
|
7
|
+
test('fetch toast of jobs', function () {
|
|
8
|
+
var _a, _b;
|
|
9
|
+
var merchi = new Merchi();
|
|
10
|
+
var fetch = mockFetch(true, { 'notifications': [{ id: 1, message: 'test' }] }, 200);
|
|
11
|
+
var entities = [{ id: 1, type: 'job' }];
|
|
12
|
+
var sections = [NotificationSection.JOB_NOTIFICATIONS];
|
|
13
|
+
var notificationTypes = (_a = {}, _a[NotificationType.JOB_PAID] = true, _a);
|
|
14
|
+
var options = { entities: entities, sections: sections, notificationTypes: notificationTypes };
|
|
15
|
+
var invocation = toastNotifications(merchi, options);
|
|
16
|
+
var expectUrl = "".concat(global.BACKEND_URI, "v6/notifications-check-update/");
|
|
17
|
+
expect(fetch.mock.calls[0][0]).toEqual(expectUrl);
|
|
18
|
+
expect(fetch.mock.calls[0][1].method).toEqual('POST');
|
|
19
|
+
expect(JSON.parse(fetch.mock.calls[0][1].body.get('entities'))).toEqual([{ id: 1, type: 'job' }]);
|
|
20
|
+
expect(fetch.mock.calls[0][1].body.get('sections')).toEqual("[".concat(NotificationSection.JOB_NOTIFICATIONS, "]"));
|
|
21
|
+
expect(JSON.parse(fetch.mock.calls[0][1].body.get('notificationTypes'))).toEqual((_b = {}, _b[NotificationType.JOB_PAID] = true, _b));
|
|
22
|
+
invocation.then(function (notifications) {
|
|
23
|
+
expect(notifications.length).toBe(1);
|
|
24
|
+
expect(notifications[0].id).toBe(1);
|
|
25
|
+
expect(notifications[0].message).toBe('test');
|
|
26
|
+
});
|
|
27
|
+
return invocation;
|
|
28
|
+
});
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
var __values = (this && this.__values) || function(o) {
|
|
2
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
3
|
+
if (m) return m.call(o);
|
|
4
|
+
if (o && typeof o.length === "number") return {
|
|
5
|
+
next: function () {
|
|
6
|
+
if (o && i >= o.length) o = void 0;
|
|
7
|
+
return { value: o && o[i++], done: !o };
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
11
|
+
};
|
|
12
|
+
export function kahanSum(values) {
|
|
13
|
+
var e_1, _a;
|
|
14
|
+
/* Return the kahan summation of the input number array */
|
|
15
|
+
var accumulator = 0;
|
|
16
|
+
var compensation = 0;
|
|
17
|
+
try {
|
|
18
|
+
for (var values_1 = __values(values), values_1_1 = values_1.next(); !values_1_1.done; values_1_1 = values_1.next()) {
|
|
19
|
+
var value = values_1_1.value;
|
|
20
|
+
var y = value - compensation;
|
|
21
|
+
var t = accumulator + y;
|
|
22
|
+
compensation = (t - accumulator) - y;
|
|
23
|
+
accumulator = t;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
27
|
+
finally {
|
|
28
|
+
try {
|
|
29
|
+
if (values_1_1 && !values_1_1.done && (_a = values_1.return)) _a.call(values_1);
|
|
30
|
+
}
|
|
31
|
+
finally { if (e_1) throw e_1.error; }
|
|
32
|
+
}
|
|
33
|
+
return accumulator;
|
|
34
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export function getQueryStringValue(name) {
|
|
2
|
+
if (window && typeof window !== 'undefined') {
|
|
3
|
+
var query = window.location.search.substring(1);
|
|
4
|
+
var vars = query.split('&');
|
|
5
|
+
for (var i = 0; i < vars.length; i++) {
|
|
6
|
+
var pair = vars[i].split('=');
|
|
7
|
+
if (pair[0] === name) {
|
|
8
|
+
return decodeURIComponent(pair[1]);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
return undefined;
|
|
13
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { isUndefinedOrNull } from './validation.js';
|
|
2
|
+
test('return true if value is null', function () {
|
|
3
|
+
expect(isUndefinedOrNull(null)).toBe(true);
|
|
4
|
+
});
|
|
5
|
+
test('return true if value is undefined', function () {
|
|
6
|
+
expect(isUndefinedOrNull(undefined)).toBe(true);
|
|
7
|
+
});
|
|
8
|
+
test('return false if value other than undefined or null', function () {
|
|
9
|
+
expect(isUndefinedOrNull(false)).toBe(false);
|
|
10
|
+
expect(isUndefinedOrNull('')).toBe(false);
|
|
11
|
+
expect(isUndefinedOrNull(0)).toBe(false);
|
|
12
|
+
});
|
package/dist/uuid.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { generateUUID } from './uuid.js';
|
|
2
|
+
test('can generate UUID', function () {
|
|
3
|
+
var realRandom = global.Math.random;
|
|
4
|
+
var randomStub = jest.fn(function () { return 0.4; });
|
|
5
|
+
global.Math.random = randomStub;
|
|
6
|
+
var correct = '66666666-6666-4666-a666-666666666666';
|
|
7
|
+
var attempt = generateUUID();
|
|
8
|
+
expect(randomStub).toHaveBeenCalled();
|
|
9
|
+
expect(attempt).toBe(correct);
|
|
10
|
+
global.Math.random = realRandom;
|
|
11
|
+
});
|
package/jest.config.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
"roots": ["<rootDir>/src"],
|
|
3
|
+
"transform": {
|
|
4
|
+
"^.+\\.tsx?$": "ts-jest"
|
|
5
|
+
},
|
|
6
|
+
// Resolve the source's .js-extension ESM imports back to their .ts sources
|
|
7
|
+
// so ts-jest can run the suite (the repo uses `"type": "module"` with
|
|
8
|
+
// explicit .js import specifiers).
|
|
9
|
+
"moduleNameMapper": {
|
|
10
|
+
"^(\\.{1,2}/.*)\\.js$": "$1"
|
|
11
|
+
},
|
|
12
|
+
"testEnvironment": 'jsdom',
|
|
13
|
+
"collectCoverage": true,
|
|
14
|
+
"collectCoverageFrom": ["src/**"],
|
|
15
|
+
"coverageThreshold": {
|
|
16
|
+
"global": {
|
|
17
|
+
"branches": 100,
|
|
18
|
+
"functions": 100,
|
|
19
|
+
"lines": 100,
|
|
20
|
+
"statements": 100
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
Binary file
|
package/package.json
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@merchi/sdk",
|
|
3
|
+
"version": "1.40.2",
|
|
4
|
+
"main": "dist/index.js",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/merchisdk/merchi_ts.git",
|
|
9
|
+
"directory": "packages/sdk"
|
|
10
|
+
},
|
|
11
|
+
"publishConfig": {
|
|
12
|
+
"access": "public"
|
|
13
|
+
},
|
|
14
|
+
"author": "Daniel Collins <mail@dcollins.info>, James Campton <james@merchi.co>, Cheng Yu <chengyu0316@gmail.com>",
|
|
15
|
+
"license": "GPL-3.0",
|
|
16
|
+
"scripts": {
|
|
17
|
+
"build": "tsc",
|
|
18
|
+
"test": "jest --coverage"
|
|
19
|
+
},
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"@types/jest": "^28.0.0",
|
|
22
|
+
"@typescript-eslint/eslint-plugin": "^5.0.0",
|
|
23
|
+
"@typescript-eslint/parser": "^5.30.5",
|
|
24
|
+
"eslint": "^8.19.0",
|
|
25
|
+
"jest": "^28.0.0",
|
|
26
|
+
"ts-jest": "^28.0.0",
|
|
27
|
+
"typescript": "^4.3.0"
|
|
28
|
+
},
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"@types/lodash": "^4.14.141",
|
|
31
|
+
"@types/moment-timezone": "^0.5.12",
|
|
32
|
+
"@types/node": "^16.0.0",
|
|
33
|
+
"browser-or-node": "2.1.1",
|
|
34
|
+
"jest-environment-jsdom": "^28.1.3",
|
|
35
|
+
"lodash": "^4.17.15",
|
|
36
|
+
"moment": "^2.24.0",
|
|
37
|
+
"moment-timezone": "^0.5.27",
|
|
38
|
+
"path": "^0.12.7",
|
|
39
|
+
"reflect-metadata": "^0.1.13"
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export enum CallToActions {
|
|
2
|
+
COMPLETE_COMPANY_PROFILE_AND_UPGRADE_SUBSCRIPTION_PLAN = 0,
|
|
3
|
+
COMPLETE_COMPANY_PROFILE = 1,
|
|
4
|
+
UPGRADE_SUBSCRIPTION_PLAN = 2,
|
|
5
|
+
COMPANY_ADD_PAYMENT_DETAILS_TO_UNLOCK_MORE_FEATURES = 3,
|
|
6
|
+
COMPANY_SUBSCRIPTION_OUTSTANDING = 4,
|
|
7
|
+
COMPANY_OWNERSHIP_NEEDS_CONFIRMATION = 5,
|
|
8
|
+
MOD_PRODUCT_READY_FOR_SALE = 6,
|
|
9
|
+
CREATE_STORE_FOR_SELLING = 7,
|
|
10
|
+
COMPANY_NEEDS_TO_ADD_PAYMENT_METHOD = 8,
|
|
11
|
+
YOUR_COMPANIES_NEED_STRIPE_TO_COLLECT_PAYMENT = 9,
|
|
12
|
+
SUPPLIER_PRODUCT_READY_FOR_SALE = 10,
|
|
13
|
+
SET_PASSWORD = 11,
|
|
14
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export enum DomainType {
|
|
2
|
+
UNRESTRICTED = 0,
|
|
3
|
+
SELLER = 1,
|
|
4
|
+
SELLER_PLUS = 2,
|
|
5
|
+
SUPPLIER = 3,
|
|
6
|
+
RESTRICTED_SUPPLIER = 4,
|
|
7
|
+
DOMAIN_SUPPLIER = 5,
|
|
8
|
+
DOMAIN_CLIENT_CATALOGUE = 6,
|
|
9
|
+
DOMAIN_SHOPIFY_SELLER = 7,
|
|
10
|
+
UNRESTRICTED_SHOPIFY_APP = 8,
|
|
11
|
+
RESERVED = 9,
|
|
12
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export enum ErrorType {
|
|
2
|
+
UNKNOWN_ERROR = 0,
|
|
3
|
+
SERVER_ERROR = 1,
|
|
4
|
+
CLIENT_ERROR = 2,
|
|
5
|
+
EMAIL_ALREADY_EXISTS = 3,
|
|
6
|
+
SUPPLIER_NOT_ADDED_TO_PRODUCT = 4,
|
|
7
|
+
EMAIL_NOT_FOUND = 5,
|
|
8
|
+
INVALID_PHONE_NUMBER = 6,
|
|
9
|
+
INVALID_PASSWORD = 7,
|
|
10
|
+
RESOURCE_NOT_FOUND = 8,
|
|
11
|
+
RESOURCE_GONE = 9,
|
|
12
|
+
REQUEST_TOO_LARGE = 10,
|
|
13
|
+
UNKNOWN_DOMAIN = 11,
|
|
14
|
+
UNSUPPORTED_METHOD = 12,
|
|
15
|
+
MISSING_EVENT_TYPES = 13,
|
|
16
|
+
INVALID_EVENT_TYPES = 14,
|
|
17
|
+
MISSING_URI = 15,
|
|
18
|
+
MISSING_SID = 16,
|
|
19
|
+
MISSING_SECRET_KEY = 17,
|
|
20
|
+
MISSING_SUBSCRIPTION_TOKEN = 18,
|
|
21
|
+
WRONG_SECRET_KEY = 19,
|
|
22
|
+
DUPLICATE_SUBSCRIPTION_TOKEN = 20,
|
|
23
|
+
BAD_SMS_TOKEN = 21,
|
|
24
|
+
DOMAIN_NOT_FOUND = 22,
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function getErrorFromCode(code: number): ErrorType {
|
|
28
|
+
if (code in ErrorType) {
|
|
29
|
+
return code;
|
|
30
|
+
}
|
|
31
|
+
return ErrorType.UNKNOWN_ERROR;
|
|
32
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export enum FieldType {
|
|
2
|
+
TEXT_INPUT = 1,
|
|
3
|
+
SELECT = 2,
|
|
4
|
+
FILE_UPLOAD = 3,
|
|
5
|
+
TEXT_AREA = 4,
|
|
6
|
+
NUMBER_INPUT = 5,
|
|
7
|
+
CHECKBOX = 6,
|
|
8
|
+
RADIO = 7,
|
|
9
|
+
FIELD_INSTRUCTIONS = 8,
|
|
10
|
+
IMAGE_SELECT = 9,
|
|
11
|
+
COLOUR_PICKER = 10,
|
|
12
|
+
COLOUR_SELECT = 11,
|
|
13
|
+
TURNAROUND_TIME = 12,
|
|
14
|
+
COLOUR_EXTRACT = 13,
|
|
15
|
+
AREA = 14,
|
|
16
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import * as field_types from './field_types.js';
|
|
2
|
+
import * as input_types from './input_types.js';
|
|
3
|
+
import * as platform from './platform.js';
|
|
4
|
+
import * as system_roles from './system_roles.js';
|
|
5
|
+
import * as user_types from './user_types.js';
|
|
6
|
+
import * as roles from './roles.js';
|
|
7
|
+
import * as notification_sections from './notification_sections.js';
|
|
8
|
+
import * as notification_types from './notification_types.js';
|
|
9
|
+
import * as shipment_services from './shipment_services.js';
|
|
10
|
+
import * as shipment_companies from './shipment_companies.js';
|
|
11
|
+
import * as auto_assign_production_on_actions from './auto_assign_production_on_actions.js';
|
|
12
|
+
import * as product_types from './product_types.js';
|
|
13
|
+
import * as drafting_status from './job/drafting_status.js';
|
|
14
|
+
import * as job_types from './job_types.js';
|
|
15
|
+
import * as payment_status from './job/payment_status.js';
|
|
16
|
+
import * as production_status from './job/production_status.js';
|
|
17
|
+
import * as shipment_status from './job/shipment_status.js';
|
|
18
|
+
import * as call_to_actions from './call_to_actions.js';
|
|
19
|
+
import * as domain_types from './domain_types.js';
|
|
20
|
+
import * as job_status from './job_status.js';
|
|
21
|
+
import * as white_label_accessibilities from './white_label_accessibilities.js';
|
|
22
|
+
import * as robots_meta_directives from './robots_meta_directives.js';
|
|
23
|
+
import * as inventory_statuses from './inventory_statuses.js';
|
|
24
|
+
import * as discount_types from './discount_types.js';
|
|
25
|
+
|
|
26
|
+
export {
|
|
27
|
+
discount_types,
|
|
28
|
+
field_types,
|
|
29
|
+
input_types,
|
|
30
|
+
inventory_statuses,
|
|
31
|
+
platform,
|
|
32
|
+
robots_meta_directives,
|
|
33
|
+
system_roles,
|
|
34
|
+
user_types,
|
|
35
|
+
white_label_accessibilities,
|
|
36
|
+
roles,
|
|
37
|
+
notification_sections,
|
|
38
|
+
notification_types,
|
|
39
|
+
shipment_services,
|
|
40
|
+
shipment_companies,
|
|
41
|
+
auto_assign_production_on_actions,
|
|
42
|
+
product_types,
|
|
43
|
+
drafting_status,
|
|
44
|
+
job_types,
|
|
45
|
+
payment_status,
|
|
46
|
+
production_status,
|
|
47
|
+
shipment_status,
|
|
48
|
+
call_to_actions,
|
|
49
|
+
domain_types,
|
|
50
|
+
job_status,
|
|
51
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export enum DraftingStatus {
|
|
2
|
+
INIT = 0,
|
|
3
|
+
WAIT_DRAFTING = 1,
|
|
4
|
+
CHANGES_REQUESTED = 2,
|
|
5
|
+
DRAFTING_UPLOADED = 3,
|
|
6
|
+
DRAFTING_APPROVED = 4,
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export enum PaymentStatus {
|
|
10
|
+
INIT = 0,
|
|
11
|
+
ISSUED = 1,
|
|
12
|
+
OVERDUE = 2,
|
|
13
|
+
PARTIAL_PAID = 3,
|
|
14
|
+
FULLY_PAID = 4,
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export enum ProductionStatus {
|
|
18
|
+
INIT = 0,
|
|
19
|
+
REJECTED = 1,
|
|
20
|
+
QUOTING = 2,
|
|
21
|
+
ASSIGN_SENT = 3,
|
|
22
|
+
ASSIGN_DEADLINE_REACHED = 4,
|
|
23
|
+
ASSIGN_COMPLETE = 5,
|
|
24
|
+
QUESTIONING = 6,
|
|
25
|
+
COMMENCED = 7,
|
|
26
|
+
FINISHED = 8,
|
|
27
|
+
SHIPPED = 9,
|
|
28
|
+
COMPLETED = 10,
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export enum ShipmentStatus {
|
|
32
|
+
NOT_ASSIGNED = 0,
|
|
33
|
+
ASSIGNED = 1,
|
|
34
|
+
DISPATCH_SET = 2,
|
|
35
|
+
DISPATCH_WARNING = 3,
|
|
36
|
+
DISPATCH_LATE = 4,
|
|
37
|
+
DISPATCHED = 5,
|
|
38
|
+
EXPECTED_RECEIVE_DATE_WARNING = 6,
|
|
39
|
+
EXPECTED_RECEIVE_DATE_PAST = 7,
|
|
40
|
+
RECEIVED = 8,
|
|
41
|
+
PICKED_UP = 9,
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export enum SupplyChainRequestStatus {
|
|
45
|
+
NO_REQUEST = 0,
|
|
46
|
+
REQUESTED = 1,
|
|
47
|
+
DECLINED = 2,
|
|
48
|
+
ACCEPTED = 3,
|
|
49
|
+
}
|