@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
package/src/index.ts
ADDED
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import { Address } from './entities/address.js';
|
|
2
|
+
import { AgentConversation } from './entities/agent_conversation.js';
|
|
3
|
+
import { AgentTokenUsage } from './entities/agent_token_usage.js';
|
|
4
|
+
export type {
|
|
5
|
+
AgentTokenAnalyticsSummary,
|
|
6
|
+
AgentTokenAnalyticsTimeseries,
|
|
7
|
+
AgentTokenUsageRecordPayload,
|
|
8
|
+
AgentTokenUsageRecordResponse,
|
|
9
|
+
CompanyAnalyticsResponse,
|
|
10
|
+
DomainAnalyticsResponse,
|
|
11
|
+
ProfileAnalyticsSummaryMetric,
|
|
12
|
+
} from './entities/agent_token_analytics.js';
|
|
13
|
+
import { AgentSkill } from './entities/agent_skill.js';
|
|
14
|
+
import { AgentSkillVersion } from './entities/agent_skill_version.js';
|
|
15
|
+
import { AgentSkillApproval } from './entities/agent_skill_approval.js';
|
|
16
|
+
import { DomainChatSettings } from './entities/domain_chat_settings.js';
|
|
17
|
+
import { SupportConversation } from './entities/support_conversation.js';
|
|
18
|
+
import { SupportMessage } from './entities/support_message.js';
|
|
19
|
+
import { Assignment } from './entities/assignment.js';
|
|
20
|
+
import { AutomaticPaymentRelationship } from './entities/automatic_payment_relationship.js';
|
|
21
|
+
import { Bank } from './entities/bank.js';
|
|
22
|
+
import { Cart } from './entities/cart.js';
|
|
23
|
+
import { CartItem } from './entities/cart_item.js';
|
|
24
|
+
import { CartShipmentGroup } from './entities/cart_shipment_group.js';
|
|
25
|
+
import { CartShipmentQuote } from './entities/cart_shipment_quote.js';
|
|
26
|
+
import { Category } from './entities/category.js';
|
|
27
|
+
import { Company } from './entities/company.js';
|
|
28
|
+
import { CompanyInvitation } from './entities/company_invitation.js';
|
|
29
|
+
import { ProductForm } from './entities/product_form.js';
|
|
30
|
+
import { ProductFormVersion } from './entities/product_form_version.js';
|
|
31
|
+
import { CountryTax } from './entities/country_tax.js';
|
|
32
|
+
import { Discount } from './entities/discount.js';
|
|
33
|
+
import { DiscountGroup } from './entities/discount_group.js';
|
|
34
|
+
import { Domain } from './entities/domain.js';
|
|
35
|
+
import { DomainInvitation } from './entities/domain_invitation.js';
|
|
36
|
+
import { DomainTag } from './entities/domain_tag.js';
|
|
37
|
+
import { Draft } from './entities/draft.js';
|
|
38
|
+
import { DraftComment } from './entities/draft_comment.js';
|
|
39
|
+
import { DraftTemplate } from './entities/draft_template.js';
|
|
40
|
+
import { EmailAddress } from './entities/email_address.js';
|
|
41
|
+
import { EmailCounter } from './entities/email_counter.js';
|
|
42
|
+
import { EnrolledDomain } from './entities/enrolled_domain.js';
|
|
43
|
+
import { Entity, EmbedDescriptor } from './entity.js'; // eslint-disable-next-line no-unused-vars
|
|
44
|
+
import { ExchangeRate } from './entities/exchange_rate.js';
|
|
45
|
+
import { InternalTag } from './entities/internal_tag.js';
|
|
46
|
+
import { Inventory } from './entities/inventory.js';
|
|
47
|
+
import { InventoryUnitVariation } from './entities/inventory_unit_variation.js';
|
|
48
|
+
import { Invoice } from './entities/invoice.js';
|
|
49
|
+
import { Item } from './entities/item.js';
|
|
50
|
+
import { Job } from './entities/job.js';
|
|
51
|
+
import { JobComment } from './entities/job_comment.js';
|
|
52
|
+
import { JobNote } from './entities/job_note.js';
|
|
53
|
+
import { JobOperationLog } from './entities/job_operation_log.js';
|
|
54
|
+
import { MatchingInventory } from './entities/matching_inventory.js';
|
|
55
|
+
import { Merchi } from './merchi.js';
|
|
56
|
+
import { MerchiFile } from './entities/file.js';
|
|
57
|
+
import { Notification } from './entities/notification.js';
|
|
58
|
+
import { Payment } from './entities/payment.js';
|
|
59
|
+
import { PaymentDevice } from './entities/payment_device.js';
|
|
60
|
+
import { PhoneNumber } from './entities/phone_number.js';
|
|
61
|
+
import { Product } from './entities/product.js';
|
|
62
|
+
import { ProductReview } from './entities/product_review.js';
|
|
63
|
+
export type {
|
|
64
|
+
ProductReviewCreateInput,
|
|
65
|
+
ProductReviewPatchInput,
|
|
66
|
+
} from './entities/product_review.js';
|
|
67
|
+
import { ProductionComment } from './entities/production_comment.js';
|
|
68
|
+
import { Quote } from './entities/quote.js';
|
|
69
|
+
import { QuoteItem } from './entities/quote_item.js';
|
|
70
|
+
import { Reminder } from './entities/reminder.js';
|
|
71
|
+
import { RequestOptions, apiFetch, apiFetchWithProgress } from './request.js'; // eslint-disable-next-line no-unused-vars
|
|
72
|
+
import { Session } from './entities/session.js';
|
|
73
|
+
import { Shipment } from './entities/shipment.js';
|
|
74
|
+
import { ShipmentLog } from './entities/shipment_log.js';
|
|
75
|
+
import { ShipmentItem } from './entities/shipment_item.js';
|
|
76
|
+
import { ShipmentItemFulfillment } from './entities/shipment_item_fulfillment.js';
|
|
77
|
+
import { ShipmentMethod } from './entities/shipment_method.js';
|
|
78
|
+
import { ShipmentMethodVariation } from './entities/shipment_method_variation.js';
|
|
79
|
+
import { ShortUrl } from './entities/short_url.js';
|
|
80
|
+
import { SubscriptionPlan } from './entities/subscription_plan.js';
|
|
81
|
+
import { SupplyDomain } from './entities/supply_domain.js';
|
|
82
|
+
import { SystemRole } from './entities/system_role.js';
|
|
83
|
+
import { Theme } from './entities/theme.js';
|
|
84
|
+
import { ThemeCssSetting } from './entities/theme_css_setting.js';
|
|
85
|
+
import { User } from './entities/user.js';
|
|
86
|
+
import { UserCompany } from './entities/user_company.js';
|
|
87
|
+
import { Variation } from './entities/variation.js';
|
|
88
|
+
import { VariationField } from './entities/variation_field.js';
|
|
89
|
+
import { VariationFieldsOption } from './entities/variation_fields_option.js';
|
|
90
|
+
import { VariationOption } from './entities/variation_option.js';
|
|
91
|
+
import { VariationsGroup } from './entities/variations_group.js';
|
|
92
|
+
import { generateUUID } from './uuid.js';
|
|
93
|
+
import { getCookie } from './cookie.js';
|
|
94
|
+
import * as constants from './constants/index.js';
|
|
95
|
+
import * as request from './request.js';
|
|
96
|
+
import * as util from './util/index.js';
|
|
97
|
+
import * as pricing from './pricing/index.js';
|
|
98
|
+
import { toastNotifications } from './toasts.js';
|
|
99
|
+
|
|
100
|
+
export {
|
|
101
|
+
constants,
|
|
102
|
+
request,
|
|
103
|
+
util,
|
|
104
|
+
pricing,
|
|
105
|
+
toastNotifications,
|
|
106
|
+
Address,
|
|
107
|
+
AgentConversation,
|
|
108
|
+
AgentTokenUsage,
|
|
109
|
+
AgentSkill,
|
|
110
|
+
AgentSkillVersion,
|
|
111
|
+
AgentSkillApproval,
|
|
112
|
+
DomainChatSettings,
|
|
113
|
+
SupportConversation,
|
|
114
|
+
SupportMessage,
|
|
115
|
+
Assignment,
|
|
116
|
+
AutomaticPaymentRelationship,
|
|
117
|
+
Bank,
|
|
118
|
+
Cart,
|
|
119
|
+
CartItem,
|
|
120
|
+
CartShipmentGroup,
|
|
121
|
+
CartShipmentQuote,
|
|
122
|
+
Category,
|
|
123
|
+
Company,
|
|
124
|
+
CompanyInvitation,
|
|
125
|
+
ProductForm,
|
|
126
|
+
ProductFormVersion,
|
|
127
|
+
CountryTax,
|
|
128
|
+
Discount,
|
|
129
|
+
DiscountGroup,
|
|
130
|
+
Domain,
|
|
131
|
+
DomainInvitation,
|
|
132
|
+
DomainTag,
|
|
133
|
+
Draft,
|
|
134
|
+
DraftComment,
|
|
135
|
+
DraftTemplate,
|
|
136
|
+
EmailAddress,
|
|
137
|
+
EmailCounter,
|
|
138
|
+
EnrolledDomain,
|
|
139
|
+
Entity,
|
|
140
|
+
EmbedDescriptor,
|
|
141
|
+
ExchangeRate,
|
|
142
|
+
InternalTag,
|
|
143
|
+
Inventory,
|
|
144
|
+
InventoryUnitVariation,
|
|
145
|
+
Invoice,
|
|
146
|
+
Item,
|
|
147
|
+
Job,
|
|
148
|
+
JobComment,
|
|
149
|
+
JobNote,
|
|
150
|
+
JobOperationLog,
|
|
151
|
+
MatchingInventory,
|
|
152
|
+
Merchi,
|
|
153
|
+
MerchiFile,
|
|
154
|
+
Notification,
|
|
155
|
+
Payment,
|
|
156
|
+
PaymentDevice,
|
|
157
|
+
PhoneNumber,
|
|
158
|
+
Product,
|
|
159
|
+
ProductReview,
|
|
160
|
+
ProductionComment,
|
|
161
|
+
Quote,
|
|
162
|
+
QuoteItem,
|
|
163
|
+
Reminder,
|
|
164
|
+
RequestOptions,
|
|
165
|
+
apiFetch,
|
|
166
|
+
apiFetchWithProgress,
|
|
167
|
+
Session,
|
|
168
|
+
Shipment,
|
|
169
|
+
ShipmentLog,
|
|
170
|
+
ShipmentItem,
|
|
171
|
+
ShipmentItemFulfillment,
|
|
172
|
+
ShipmentMethod,
|
|
173
|
+
ShipmentMethodVariation,
|
|
174
|
+
ShortUrl,
|
|
175
|
+
SubscriptionPlan,
|
|
176
|
+
SupplyDomain,
|
|
177
|
+
SystemRole,
|
|
178
|
+
Theme,
|
|
179
|
+
ThemeCssSetting,
|
|
180
|
+
User,
|
|
181
|
+
UserCompany,
|
|
182
|
+
Variation,
|
|
183
|
+
VariationField,
|
|
184
|
+
VariationFieldsOption,
|
|
185
|
+
VariationOption,
|
|
186
|
+
VariationsGroup,
|
|
187
|
+
generateUUID,
|
|
188
|
+
getCookie
|
|
189
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { setup, mockFetch } from './test_util.js';
|
|
2
|
+
import { Merchi } from './merchi.js';
|
|
3
|
+
|
|
4
|
+
setup();
|
|
5
|
+
|
|
6
|
+
test('can get current user merchi has session token', () => {
|
|
7
|
+
const testToken = 'YrDwzmh8&QGtAfg9quh(4QfSlE^RPXWl';
|
|
8
|
+
const merchi = new Merchi(testToken);
|
|
9
|
+
mockFetch(true, { session: { user: { name: 'currentUser' } } }, 200);
|
|
10
|
+
return merchi
|
|
11
|
+
.getCurrentUser()
|
|
12
|
+
.then(user => expect(user.name).toBe('currentUser'));
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
test('get current user return empty if there is no cookie', () => {
|
|
16
|
+
Object.defineProperty(document, 'cookie', {
|
|
17
|
+
get: jest.fn().mockImplementation(() => {
|
|
18
|
+
return '';
|
|
19
|
+
}),
|
|
20
|
+
});
|
|
21
|
+
const merchi = new Merchi();
|
|
22
|
+
mockFetch(true, { user: { name: 'currentUser' } }, 200);
|
|
23
|
+
return merchi.getCurrentUser({embed: {}}).then(
|
|
24
|
+
user => expect(user).toBe(null));
|
|
25
|
+
});
|
package/src/merchi.ts
ADDED
|
@@ -0,0 +1,445 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Entity,
|
|
3
|
+
// eslint-disable-next-line no-unused-vars
|
|
4
|
+
EmbedDescriptor,
|
|
5
|
+
} from './entity.js';
|
|
6
|
+
import { AutomaticPaymentRelationship } from './entities/automatic_payment_relationship.js';
|
|
7
|
+
import { Session } from './entities/session.js';
|
|
8
|
+
import { JobComment } from './entities/job_comment.js';
|
|
9
|
+
import { JobNote } from './entities/job_note.js';
|
|
10
|
+
import { JobOperationLog } from './entities/job_operation_log.js';
|
|
11
|
+
import { Domain } from './entities/domain.js';
|
|
12
|
+
import { ExchangeRate } from './entities/exchange_rate.js';
|
|
13
|
+
import { Job } from './entities/job.js';
|
|
14
|
+
import { VariationField } from './entities/variation_field.js';
|
|
15
|
+
import { VariationOption } from './entities/variation_option.js';
|
|
16
|
+
import { ProductionComment } from './entities/production_comment.js';
|
|
17
|
+
import { Product } from './entities/product.js';
|
|
18
|
+
import { ProductReview } from './entities/product_review.js';
|
|
19
|
+
import { InternalTag } from './entities/internal_tag.js';
|
|
20
|
+
import { Inventory } from './entities/inventory.js';
|
|
21
|
+
import { InventoryGroup } from './entities/inventory_group.js';
|
|
22
|
+
import { QuoteItem } from './entities/quote_item.js';
|
|
23
|
+
import { Category } from './entities/category.js';
|
|
24
|
+
import { Invoice } from './entities/invoice.js';
|
|
25
|
+
import { UserCompany } from './entities/user_company.js';
|
|
26
|
+
import { InventoryUnitVariation } from './entities/inventory_unit_variation.js';
|
|
27
|
+
import { VariationFieldsOption } from './entities/variation_fields_option.js';
|
|
28
|
+
import { Bank } from './entities/bank.js';
|
|
29
|
+
import { Shipment } from './entities/shipment.js';
|
|
30
|
+
import { ShipmentLog } from './entities/shipment_log.js';
|
|
31
|
+
import { ShipmentItem } from './entities/shipment_item.js';
|
|
32
|
+
import { ShipmentItemFulfillment } from './entities/shipment_item_fulfillment.js';
|
|
33
|
+
import { ShipmentMethod } from './entities/shipment_method.js';
|
|
34
|
+
import { ShipmentMethodVariation } from './entities/shipment_method_variation.js';
|
|
35
|
+
import { DomainInvitation } from './entities/domain_invitation.js';
|
|
36
|
+
import { EmailCounter } from './entities/email_counter.js';
|
|
37
|
+
import { SupplyDomain } from './entities/supply_domain.js';
|
|
38
|
+
import { Cart } from './entities/cart.js';
|
|
39
|
+
import { CartShipmentGroup } from './entities/cart_shipment_group.js';
|
|
40
|
+
import { CartShipmentQuote } from './entities/cart_shipment_quote.js';
|
|
41
|
+
import { Theme } from './entities/theme.js';
|
|
42
|
+
import { ThemeCssSetting } from './entities/theme_css_setting.js';
|
|
43
|
+
import { ProductForm } from './entities/product_form.js';
|
|
44
|
+
import { ProductFormVersion } from './entities/product_form_version.js';
|
|
45
|
+
import { MerchiFile } from './entities/file.js';
|
|
46
|
+
import { EmailAddress } from './entities/email_address.js';
|
|
47
|
+
import { ShortUrl } from './entities/short_url.js';
|
|
48
|
+
import { VariationsGroup } from './entities/variations_group.js';
|
|
49
|
+
import { Quote } from './entities/quote.js';
|
|
50
|
+
import { Reminder } from './entities/reminder.js';
|
|
51
|
+
import { Draft } from './entities/draft.js';
|
|
52
|
+
import { DraftPreview } from './entities/draft_preview.js';
|
|
53
|
+
import { DraftPreviewLayer } from './entities/draft_preview_layer.js';
|
|
54
|
+
import { DraftTemplate } from './entities/draft_template.js';
|
|
55
|
+
import { Discount } from './entities/discount.js';
|
|
56
|
+
import { DiscountGroup } from './entities/discount_group.js';
|
|
57
|
+
import { User } from './entities/user.js';
|
|
58
|
+
import { Company } from './entities/company.js';
|
|
59
|
+
import { EnrolledDomain } from './entities/enrolled_domain.js';
|
|
60
|
+
import { CountryTax } from './entities/country_tax.js';
|
|
61
|
+
import { Item } from './entities/item.js';
|
|
62
|
+
import { DomainTag } from './entities/domain_tag.js';
|
|
63
|
+
import { DraftComment } from './entities/draft_comment.js';
|
|
64
|
+
import { Notification } from './entities/notification.js';
|
|
65
|
+
import { Payment } from './entities/payment.js';
|
|
66
|
+
import { CompanyInvitation } from './entities/company_invitation.js';
|
|
67
|
+
import { SystemRole } from './entities/system_role.js';
|
|
68
|
+
import { PaymentDevice } from './entities/payment_device.js';
|
|
69
|
+
import { PhoneNumber } from './entities/phone_number.js';
|
|
70
|
+
import { Variation } from './entities/variation.js';
|
|
71
|
+
import { CartItem } from './entities/cart_item.js';
|
|
72
|
+
import { Address } from './entities/address.js';
|
|
73
|
+
import { AgentConversation } from './entities/agent_conversation.js';
|
|
74
|
+
import { AgentTokenUsage } from './entities/agent_token_usage.js';
|
|
75
|
+
import { AgentSkill } from './entities/agent_skill.js';
|
|
76
|
+
import { AgentSkillVersion } from './entities/agent_skill_version.js';
|
|
77
|
+
import { AgentSkillApproval } from './entities/agent_skill_approval.js';
|
|
78
|
+
import { DomainChatSettings } from './entities/domain_chat_settings.js';
|
|
79
|
+
import { SupportConversation } from './entities/support_conversation.js';
|
|
80
|
+
import { SupportMessage } from './entities/support_message.js';
|
|
81
|
+
import { Assignment } from './entities/assignment.js';
|
|
82
|
+
import { MatchingInventory } from './entities/matching_inventory.js';
|
|
83
|
+
import { SubscriptionPlan } from './entities/subscription_plan.js';
|
|
84
|
+
import { generateUUID } from './uuid.js';
|
|
85
|
+
// eslint-disable-next-line no-unused-vars
|
|
86
|
+
import { RequestOptions, apiFetch, apiFetchWithProgress } from './request.js';
|
|
87
|
+
import { getCookie } from './cookie.js';
|
|
88
|
+
|
|
89
|
+
// the type of classes
|
|
90
|
+
export interface Type<T, A extends any[]> extends Function {
|
|
91
|
+
new (...args: A): T;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function cloneClass<T, A extends []>(
|
|
95
|
+
original: Type<T, A>,
|
|
96
|
+
arg: any
|
|
97
|
+
): Type<T, A> {
|
|
98
|
+
// copy the constructor, but use the empty object as `this`
|
|
99
|
+
const copy = original.bind({}, arg);
|
|
100
|
+
// pick up any static members (this is shallow, the members are not copied)
|
|
101
|
+
Object.assign(copy, original);
|
|
102
|
+
return copy;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
interface UserRequestOptions {
|
|
106
|
+
embed?: EmbedDescriptor;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export const API_VERSION = 'v6';
|
|
110
|
+
|
|
111
|
+
export class Merchi {
|
|
112
|
+
public id: string = generateUUID();
|
|
113
|
+
|
|
114
|
+
public sessionToken?: string;
|
|
115
|
+
public invoiceToken?: string;
|
|
116
|
+
public clientToken?: string;
|
|
117
|
+
public cartToken?: string;
|
|
118
|
+
public readonly backendUri: string;
|
|
119
|
+
|
|
120
|
+
public AutomaticPaymentRelationship: typeof AutomaticPaymentRelationship;
|
|
121
|
+
public Notification: typeof Notification;
|
|
122
|
+
public EnrolledDomain: typeof EnrolledDomain;
|
|
123
|
+
public SystemRole: typeof SystemRole;
|
|
124
|
+
public UserCompany: typeof UserCompany;
|
|
125
|
+
public Variation: typeof Variation;
|
|
126
|
+
public CountryTax: typeof CountryTax;
|
|
127
|
+
public VariationField: typeof VariationField;
|
|
128
|
+
public Assignment: typeof Assignment;
|
|
129
|
+
public InternalTag: typeof InternalTag;
|
|
130
|
+
public Inventory: typeof Inventory;
|
|
131
|
+
public InventoryGroup: typeof InventoryGroup;
|
|
132
|
+
public JobComment: typeof JobComment;
|
|
133
|
+
public JobNote: typeof JobNote;
|
|
134
|
+
public JobOperationLog: typeof JobOperationLog;
|
|
135
|
+
public VariationOption: typeof VariationOption;
|
|
136
|
+
public SupplyDomain: typeof SupplyDomain;
|
|
137
|
+
public ProductionComment: typeof ProductionComment;
|
|
138
|
+
public DraftComment: typeof DraftComment;
|
|
139
|
+
public Shipment: typeof Shipment;
|
|
140
|
+
public ShipmentLog: typeof ShipmentLog;
|
|
141
|
+
public ShipmentItem: typeof ShipmentItem;
|
|
142
|
+
public ShipmentItemFulfillment: typeof ShipmentItemFulfillment;
|
|
143
|
+
public ShipmentMethod: typeof ShipmentMethod;
|
|
144
|
+
public ShipmentMethodVariation: typeof ShipmentMethodVariation;
|
|
145
|
+
public Draft: typeof Draft;
|
|
146
|
+
public DraftPreview: typeof DraftPreview;
|
|
147
|
+
public DraftPreviewLayer: typeof DraftPreviewLayer;
|
|
148
|
+
public DraftTemplate: typeof DraftTemplate;
|
|
149
|
+
public VariationFieldsOption: typeof VariationFieldsOption;
|
|
150
|
+
public Category: typeof Category;
|
|
151
|
+
public MerchiFile: typeof MerchiFile;
|
|
152
|
+
public Invoice: typeof Invoice;
|
|
153
|
+
public CompanyInvitation: typeof CompanyInvitation;
|
|
154
|
+
public Bank: typeof Bank;
|
|
155
|
+
public Job: typeof Job;
|
|
156
|
+
public DomainInvitation: typeof DomainInvitation;
|
|
157
|
+
public Product: typeof Product;
|
|
158
|
+
public ProductReview: typeof ProductReview;
|
|
159
|
+
public DomainTag: typeof DomainTag;
|
|
160
|
+
public EmailAddress: typeof EmailAddress;
|
|
161
|
+
public PhoneNumber: typeof PhoneNumber;
|
|
162
|
+
public Company: typeof Company;
|
|
163
|
+
public Address: typeof Address;
|
|
164
|
+
public AgentConversation: typeof AgentConversation;
|
|
165
|
+
public AgentTokenUsage: typeof AgentTokenUsage;
|
|
166
|
+
public AgentSkill: typeof AgentSkill;
|
|
167
|
+
public AgentSkillVersion: typeof AgentSkillVersion;
|
|
168
|
+
public AgentSkillApproval: typeof AgentSkillApproval;
|
|
169
|
+
public DomainChatSettings: typeof DomainChatSettings;
|
|
170
|
+
public SupportConversation: typeof SupportConversation;
|
|
171
|
+
public SupportMessage: typeof SupportMessage;
|
|
172
|
+
public Discount: typeof Discount;
|
|
173
|
+
public DiscountGroup: typeof DiscountGroup;
|
|
174
|
+
public User: typeof User;
|
|
175
|
+
public Session: typeof Session;
|
|
176
|
+
public Theme: typeof Theme;
|
|
177
|
+
public ThemeCssSetting: typeof ThemeCssSetting;
|
|
178
|
+
public Item: typeof Item;
|
|
179
|
+
public EmailCounter: typeof EmailCounter;
|
|
180
|
+
public Domain: typeof Domain;
|
|
181
|
+
public ExchangeRate: typeof ExchangeRate;
|
|
182
|
+
public Payment: typeof Payment;
|
|
183
|
+
public PaymentDevice: typeof PaymentDevice;
|
|
184
|
+
public ShortUrl: typeof ShortUrl;
|
|
185
|
+
public CartItem: typeof CartItem;
|
|
186
|
+
public InventoryUnitVariation: typeof InventoryUnitVariation;
|
|
187
|
+
public VariationsGroup: typeof VariationsGroup;
|
|
188
|
+
public Cart: typeof Cart;
|
|
189
|
+
public CartShipmentGroup: typeof CartShipmentGroup;
|
|
190
|
+
public CartShipmentQuote: typeof CartShipmentQuote;
|
|
191
|
+
public Quote: typeof Quote;
|
|
192
|
+
public ProductForm: typeof ProductForm;
|
|
193
|
+
public ProductFormVersion: typeof ProductFormVersion;
|
|
194
|
+
public QuoteItem: typeof QuoteItem;
|
|
195
|
+
public Reminder: typeof Reminder;
|
|
196
|
+
public MatchingInventory: typeof MatchingInventory;
|
|
197
|
+
public SubscriptionPlan: typeof SubscriptionPlan;
|
|
198
|
+
|
|
199
|
+
public setupClass(cls: typeof Entity) {
|
|
200
|
+
const result = cloneClass(cls, this) as typeof Entity;
|
|
201
|
+
result.merchi = this;
|
|
202
|
+
return result;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
public constructor(
|
|
206
|
+
sessionToken?: string,
|
|
207
|
+
clientToken?: string,
|
|
208
|
+
invoiceToken?: string,
|
|
209
|
+
cartToken?: string,
|
|
210
|
+
backendUri?: string
|
|
211
|
+
) {
|
|
212
|
+
if (sessionToken) {
|
|
213
|
+
this.sessionToken = sessionToken;
|
|
214
|
+
} else {
|
|
215
|
+
this.sessionToken = getCookie('session_token');
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
if (clientToken) {
|
|
219
|
+
this.clientToken = clientToken;
|
|
220
|
+
} else {
|
|
221
|
+
this.clientToken = getCookie('client_token');
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
if (invoiceToken) {
|
|
225
|
+
this.invoiceToken = invoiceToken;
|
|
226
|
+
} else {
|
|
227
|
+
this.invoiceToken = getCookie('invoice_token');
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
if (cartToken) {
|
|
231
|
+
this.cartToken = cartToken;
|
|
232
|
+
} else {
|
|
233
|
+
this.cartToken = getCookie('cart_token');
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
let determinedBaseUri = backendUri;
|
|
237
|
+
if (!determinedBaseUri) {
|
|
238
|
+
const clientBackendUri = typeof window !== 'undefined' &&
|
|
239
|
+
(window as any).merchiBackendUri ?
|
|
240
|
+
(window as any).merchiBackendUri : undefined;
|
|
241
|
+
if (clientBackendUri) {
|
|
242
|
+
determinedBaseUri = clientBackendUri;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
if (!determinedBaseUri) {
|
|
246
|
+
const envBackendUri = typeof process !== 'undefined' &&
|
|
247
|
+
process.env.MERCHI_BACKEND_URI ?
|
|
248
|
+
process.env.MERCHI_BACKEND_URI : undefined;
|
|
249
|
+
if (envBackendUri) {
|
|
250
|
+
determinedBaseUri = envBackendUri;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
if (!determinedBaseUri) {
|
|
254
|
+
determinedBaseUri = 'https://api.merchi.co/';
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
// Ensure determinedBaseUri ends with a slash
|
|
258
|
+
if (!determinedBaseUri.endsWith('/')) {
|
|
259
|
+
determinedBaseUri += '/';
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
this.backendUri = determinedBaseUri;
|
|
263
|
+
|
|
264
|
+
// re-export configured versions of all classes
|
|
265
|
+
this.AutomaticPaymentRelationship = this.setupClass(
|
|
266
|
+
AutomaticPaymentRelationship
|
|
267
|
+
) as typeof AutomaticPaymentRelationship;
|
|
268
|
+
this.Variation = this.setupClass(Variation) as typeof Variation;
|
|
269
|
+
this.DraftComment = this.setupClass(DraftComment) as typeof DraftComment;
|
|
270
|
+
this.ProductForm = this.setupClass(ProductForm) as typeof ProductForm;
|
|
271
|
+
this.ProductFormVersion = this.setupClass(ProductFormVersion) as typeof ProductFormVersion;
|
|
272
|
+
this.Theme = this.setupClass(Theme) as typeof Theme;
|
|
273
|
+
this.ThemeCssSetting = this.setupClass(ThemeCssSetting) as typeof ThemeCssSetting;
|
|
274
|
+
this.Company = this.setupClass(Company) as typeof Company;
|
|
275
|
+
this.InternalTag = this.setupClass(InternalTag) as typeof InternalTag;
|
|
276
|
+
this.Inventory = this.setupClass(Inventory) as typeof Inventory;
|
|
277
|
+
this.InventoryGroup = this.setupClass(InventoryGroup) as typeof InventoryGroup;
|
|
278
|
+
this.Notification = this.setupClass(Notification) as typeof Notification;
|
|
279
|
+
this.Shipment = this.setupClass(Shipment) as typeof Shipment;
|
|
280
|
+
this.ShipmentLog = this.setupClass(ShipmentLog) as typeof ShipmentLog;
|
|
281
|
+
this.ShipmentItem = this.setupClass(ShipmentItem) as typeof ShipmentItem;
|
|
282
|
+
this.ShipmentItemFulfillment = this.setupClass(
|
|
283
|
+
ShipmentItemFulfillment
|
|
284
|
+
) as typeof ShipmentItemFulfillment;
|
|
285
|
+
this.ShipmentMethod = this.setupClass(
|
|
286
|
+
ShipmentMethod
|
|
287
|
+
) as typeof ShipmentMethod;
|
|
288
|
+
this.ShipmentMethodVariation = this.setupClass(
|
|
289
|
+
ShipmentMethodVariation
|
|
290
|
+
) as typeof ShipmentMethodVariation;
|
|
291
|
+
this.Domain = this.setupClass(Domain) as typeof Domain;
|
|
292
|
+
this.ExchangeRate = this.setupClass(ExchangeRate) as typeof ExchangeRate;
|
|
293
|
+
this.Invoice = this.setupClass(Invoice) as typeof Invoice;
|
|
294
|
+
this.Job = this.setupClass(Job) as typeof Job;
|
|
295
|
+
this.Category = this.setupClass(Category) as typeof Category;
|
|
296
|
+
this.VariationField = this.setupClass(
|
|
297
|
+
VariationField
|
|
298
|
+
) as typeof VariationField;
|
|
299
|
+
this.InventoryUnitVariation = this.setupClass(
|
|
300
|
+
InventoryUnitVariation
|
|
301
|
+
) as typeof InventoryUnitVariation;
|
|
302
|
+
this.PhoneNumber = this.setupClass(PhoneNumber) as typeof PhoneNumber;
|
|
303
|
+
this.QuoteItem = this.setupClass(QuoteItem) as typeof QuoteItem;
|
|
304
|
+
this.Assignment = this.setupClass(Assignment) as typeof Assignment;
|
|
305
|
+
this.Draft = this.setupClass(Draft) as typeof Draft;
|
|
306
|
+
this.DraftPreview = this.setupClass(DraftPreview) as typeof DraftPreview;
|
|
307
|
+
this.DraftPreviewLayer = this.setupClass(DraftPreviewLayer) as typeof DraftPreviewLayer;
|
|
308
|
+
this.DraftTemplate = this.setupClass(DraftTemplate) as typeof DraftTemplate;
|
|
309
|
+
this.VariationsGroup = this.setupClass(
|
|
310
|
+
VariationsGroup
|
|
311
|
+
) as typeof VariationsGroup;
|
|
312
|
+
this.EnrolledDomain = this.setupClass(
|
|
313
|
+
EnrolledDomain
|
|
314
|
+
) as typeof EnrolledDomain;
|
|
315
|
+
this.CompanyInvitation = this.setupClass(
|
|
316
|
+
CompanyInvitation
|
|
317
|
+
) as typeof CompanyInvitation;
|
|
318
|
+
this.Quote = this.setupClass(Quote) as typeof Quote;
|
|
319
|
+
this.Reminder = this.setupClass(Reminder) as typeof Reminder;
|
|
320
|
+
this.EmailAddress = this.setupClass(EmailAddress) as typeof EmailAddress;
|
|
321
|
+
this.ProductionComment = this.setupClass(
|
|
322
|
+
ProductionComment
|
|
323
|
+
) as typeof ProductionComment;
|
|
324
|
+
this.CountryTax = this.setupClass(CountryTax) as typeof CountryTax;
|
|
325
|
+
this.ShortUrl = this.setupClass(ShortUrl) as typeof ShortUrl;
|
|
326
|
+
this.Product = this.setupClass(Product) as typeof Product;
|
|
327
|
+
this.ProductReview = this.setupClass(
|
|
328
|
+
ProductReview
|
|
329
|
+
) as typeof ProductReview;
|
|
330
|
+
this.SystemRole = this.setupClass(SystemRole) as typeof SystemRole;
|
|
331
|
+
this.CartItem = this.setupClass(CartItem) as typeof CartItem;
|
|
332
|
+
this.UserCompany = this.setupClass(UserCompany) as typeof UserCompany;
|
|
333
|
+
this.DomainTag = this.setupClass(DomainTag) as typeof DomainTag;
|
|
334
|
+
this.VariationFieldsOption = this.setupClass(
|
|
335
|
+
VariationFieldsOption
|
|
336
|
+
) as typeof VariationFieldsOption;
|
|
337
|
+
this.Address = this.setupClass(Address) as typeof Address;
|
|
338
|
+
this.AgentConversation = this.setupClass(AgentConversation) as typeof AgentConversation;
|
|
339
|
+
this.AgentTokenUsage = this.setupClass(AgentTokenUsage) as typeof AgentTokenUsage;
|
|
340
|
+
this.AgentSkill = this.setupClass(AgentSkill) as typeof AgentSkill;
|
|
341
|
+
this.AgentSkillVersion = this.setupClass(AgentSkillVersion) as typeof AgentSkillVersion;
|
|
342
|
+
this.AgentSkillApproval = this.setupClass(AgentSkillApproval) as typeof AgentSkillApproval;
|
|
343
|
+
this.DomainChatSettings = this.setupClass(DomainChatSettings) as typeof DomainChatSettings;
|
|
344
|
+
this.SupportConversation = this.setupClass(SupportConversation) as typeof SupportConversation;
|
|
345
|
+
this.SupportMessage = this.setupClass(SupportMessage) as typeof SupportMessage;
|
|
346
|
+
this.Item = this.setupClass(Item) as typeof Item;
|
|
347
|
+
this.SupplyDomain = this.setupClass(SupplyDomain) as typeof SupplyDomain;
|
|
348
|
+
this.DomainInvitation = this.setupClass(
|
|
349
|
+
DomainInvitation
|
|
350
|
+
) as typeof DomainInvitation;
|
|
351
|
+
this.EmailCounter = this.setupClass(EmailCounter) as typeof EmailCounter;
|
|
352
|
+
this.Session = this.setupClass(Session) as typeof Session;
|
|
353
|
+
this.Bank = this.setupClass(Bank) as typeof Bank;
|
|
354
|
+
this.Discount = this.setupClass(Discount) as typeof Discount;
|
|
355
|
+
this.DiscountGroup = this.setupClass(DiscountGroup) as typeof DiscountGroup;
|
|
356
|
+
this.Payment = this.setupClass(Payment) as typeof Payment;
|
|
357
|
+
this.PaymentDevice = this.setupClass(PaymentDevice) as typeof PaymentDevice;
|
|
358
|
+
this.Cart = this.setupClass(Cart) as typeof Cart;
|
|
359
|
+
this.CartShipmentGroup = this.setupClass(
|
|
360
|
+
CartShipmentGroup
|
|
361
|
+
) as typeof CartShipmentGroup;
|
|
362
|
+
this.CartShipmentQuote = this.setupClass(
|
|
363
|
+
CartShipmentQuote
|
|
364
|
+
) as typeof CartShipmentQuote;
|
|
365
|
+
this.MerchiFile = this.setupClass(MerchiFile) as typeof MerchiFile;
|
|
366
|
+
this.User = this.setupClass(User) as typeof User;
|
|
367
|
+
this.JobComment = this.setupClass(JobComment) as typeof JobComment;
|
|
368
|
+
this.JobNote = this.setupClass(JobNote) as typeof JobNote;
|
|
369
|
+
this.JobOperationLog = this.setupClass(JobOperationLog) as typeof JobOperationLog;
|
|
370
|
+
this.VariationOption = this.setupClass(
|
|
371
|
+
VariationOption
|
|
372
|
+
) as typeof VariationOption;
|
|
373
|
+
this.MatchingInventory = this.setupClass(
|
|
374
|
+
MatchingInventory
|
|
375
|
+
) as typeof MatchingInventory;
|
|
376
|
+
this.SubscriptionPlan = this.setupClass(
|
|
377
|
+
SubscriptionPlan
|
|
378
|
+
) as typeof SubscriptionPlan;
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
public authenticatedFetch = (
|
|
382
|
+
resource: string,
|
|
383
|
+
options: RequestOptions,
|
|
384
|
+
expectEmptyResponse?: boolean
|
|
385
|
+
) => {
|
|
386
|
+
if (!options.query) {
|
|
387
|
+
/* istanbul ignore next */
|
|
388
|
+
options.query = [];
|
|
389
|
+
}
|
|
390
|
+
if (this.sessionToken) {
|
|
391
|
+
/* istanbul ignore next */
|
|
392
|
+
options.query.push(['session_token', this.sessionToken]);
|
|
393
|
+
}
|
|
394
|
+
if (this.clientToken) {
|
|
395
|
+
/* istanbul ignore next */
|
|
396
|
+
options.query.push(['client_token', this.clientToken]);
|
|
397
|
+
}
|
|
398
|
+
if (this.invoiceToken) {
|
|
399
|
+
/* istanbul ignore next */
|
|
400
|
+
options.query.push(['invoice_token', this.invoiceToken]);
|
|
401
|
+
}
|
|
402
|
+
if (this.cartToken) {
|
|
403
|
+
/* istanbul ignore next */
|
|
404
|
+
options.query.push(['cart_token', this.cartToken]);
|
|
405
|
+
}
|
|
406
|
+
// Pass the full backendUri, and resource is now just the endpoint
|
|
407
|
+
return apiFetch(this.backendUri, resource, options, expectEmptyResponse);
|
|
408
|
+
};
|
|
409
|
+
|
|
410
|
+
/* istanbul ignore next */
|
|
411
|
+
public authenticatedFetchWithProgress = (
|
|
412
|
+
resource: string,
|
|
413
|
+
options: RequestOptions,
|
|
414
|
+
progressCallback?: (progress: number) => void
|
|
415
|
+
) => {
|
|
416
|
+
if (!options.query) {
|
|
417
|
+
options.query = [];
|
|
418
|
+
}
|
|
419
|
+
if (this.sessionToken) {
|
|
420
|
+
options.query.push(['session_token', this.sessionToken]);
|
|
421
|
+
}
|
|
422
|
+
if (this.clientToken) {
|
|
423
|
+
options.query.push(['client_token', this.clientToken]);
|
|
424
|
+
}
|
|
425
|
+
if (this.invoiceToken) {
|
|
426
|
+
options.query.push(['invoice_token', this.invoiceToken]);
|
|
427
|
+
}
|
|
428
|
+
if (this.cartToken) {
|
|
429
|
+
options.query.push(['cart_token', this.cartToken]);
|
|
430
|
+
}
|
|
431
|
+
// Pass the full backendUri, and resource is now just the endpoint
|
|
432
|
+
return apiFetchWithProgress(this.backendUri, resource, options, progressCallback);
|
|
433
|
+
};
|
|
434
|
+
|
|
435
|
+
public getCurrentUser = (options?: UserRequestOptions) => {
|
|
436
|
+
const { embed = {} } = options || {};
|
|
437
|
+
const defaultEmbed = { user: { enrolledDomains: { domain: {} } } };
|
|
438
|
+
if (!this.sessionToken) {
|
|
439
|
+
return Promise.resolve(null);
|
|
440
|
+
}
|
|
441
|
+
return this.Session.get(this.sessionToken, {
|
|
442
|
+
embed: { ...defaultEmbed, ...embed },
|
|
443
|
+
}).then((session: any) => session.user);
|
|
444
|
+
};
|
|
445
|
+
}
|