merchi_sdk_ts 0.0.1-a
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.babelrc +13 -0
- package/.eslintrc.cjs +43 -0
- package/LICENSE +21 -0
- package/README.md +2 -0
- package/dist/constants/auto_assign_production_on_actions.js +7 -0
- package/dist/constants/call_to_actions.js +15 -0
- package/dist/constants/call_to_actions.test.js +4 -0
- package/dist/constants/discount_types.js +4 -0
- package/dist/constants/discount_types.test.js +4 -0
- package/dist/constants/domain_types.js +13 -0
- package/dist/constants/domain_types.test.js +4 -0
- package/dist/constants/errors.js +32 -0
- package/dist/constants/event_types.js +6 -0
- package/dist/constants/event_types.test.js +4 -0
- package/dist/constants/field_types.js +14 -0
- package/dist/constants/field_types.test.js +4 -0
- package/dist/constants/input_types.js +14 -0
- package/dist/constants/input_types.test.js +4 -0
- package/dist/constants/inventory_status.test.js +4 -0
- package/dist/constants/inventory_statuses.js +7 -0
- package/dist/constants/invoice_types.js +6 -0
- package/dist/constants/invoice_types.test.js +4 -0
- package/dist/constants/item_types.js +6 -0
- package/dist/constants/item_types.test.js +4 -0
- package/dist/constants/job/drafting_status.js +8 -0
- package/dist/constants/job/drafting_status.test.js +4 -0
- package/dist/constants/job/payment_status.js +8 -0
- package/dist/constants/job/payment_status.test.js +4 -0
- package/dist/constants/job/production_status.js +13 -0
- package/dist/constants/job/production_status.test.js +4 -0
- package/dist/constants/job/shipment_status.js +12 -0
- package/dist/constants/job/shipment_status.test.js +4 -0
- package/dist/constants/job/supply_chain_request_status.js +7 -0
- package/dist/constants/job/supply_chain_request_status.test.js +4 -0
- package/dist/constants/job_priorities.js +7 -0
- package/dist/constants/job_priorities.test.js +4 -0
- package/dist/constants/job_status.js +50 -0
- package/dist/constants/job_status.test.js +4 -0
- package/dist/constants/job_types.js +16 -0
- package/dist/constants/job_types.test.js +4 -0
- package/dist/constants/notification_sections.js +14 -0
- package/dist/constants/notification_sections.test.js +4 -0
- package/dist/constants/notification_types.js +98 -0
- package/dist/constants/notification_types.test.js +4 -0
- package/dist/constants/notification_urgencies.js +7 -0
- package/dist/constants/notification_urgencies.test.js +4 -0
- package/dist/constants/payment_types.js +11 -0
- package/dist/constants/payment_types.test.js +4 -0
- package/dist/constants/platform.js +5 -0
- package/dist/constants/platform.test.js +8 -0
- package/dist/constants/product_types.js +26 -0
- package/dist/constants/product_types.test.js +4 -0
- package/dist/constants/rights.js +6 -0
- package/dist/constants/rights.test.js +4 -0
- package/dist/constants/robots_meta_directives.js +1 -0
- package/dist/constants/robots_meta_directives.test.js +4 -0
- package/dist/constants/roles.js +25 -0
- package/dist/constants/roles.test.js +4 -0
- package/dist/constants/shipment_companies.js +19 -0
- package/dist/constants/shipment_companies.test.js +4 -0
- package/dist/constants/shipment_services.js +4 -0
- package/dist/constants/shipment_services.test.js +4 -0
- package/dist/constants/system_roles.js +4 -0
- package/dist/constants/system_roles.test.js +4 -0
- package/dist/constants/theme_foundations.js +7 -0
- package/dist/constants/theme_foundations.test.js +4 -0
- package/dist/constants/theme_status.js +6 -0
- package/dist/constants/theme_status.test.js +4 -0
- package/dist/constants/user_types.js +18 -0
- package/dist/constants/user_types.test.js +4 -0
- package/dist/constants/white_label_accessibilities.js +6 -0
- package/dist/constants/white_label_accessibilities.test.js +4 -0
- package/dist/cookie.js +16 -0
- package/dist/cookie.test.js +12 -0
- package/dist/entities/address.js +166 -0
- package/dist/entities/address.test.js +6 -0
- package/dist/entities/assignment.js +185 -0
- package/dist/entities/assignment.test.js +38 -0
- package/dist/entities/automatic_payment_relationship.js +77 -0
- package/dist/entities/automatic_payment_relationship.test.js +6 -0
- package/dist/entities/backup.js +44 -0
- package/dist/entities/backup.test.js +6 -0
- package/dist/entities/bank.js +116 -0
- package/dist/entities/bank.test.js +6 -0
- package/dist/entities/cart.js +203 -0
- package/dist/entities/cart.test.js +52 -0
- package/dist/entities/cart_item.js +153 -0
- package/dist/entities/cart_item.test.js +34 -0
- package/dist/entities/cart_shipment_group.js +62 -0
- package/dist/entities/cart_shipment_quote.js +85 -0
- package/dist/entities/category.js +92 -0
- package/dist/entities/category.test.js +52 -0
- package/dist/entities/company.js +648 -0
- package/dist/entities/company.test.js +6 -0
- package/dist/entities/company_invitation.js +82 -0
- package/dist/entities/company_invitation.test.js +6 -0
- package/dist/entities/component.js +209 -0
- package/dist/entities/component.test.js +12 -0
- package/dist/entities/component_tag.js +50 -0
- package/dist/entities/component_tag.test.js +6 -0
- package/dist/entities/component_version.js +80 -0
- package/dist/entities/component_version.test.js +6 -0
- package/dist/entities/country_tax.js +110 -0
- package/dist/entities/country_tax.test.js +11 -0
- package/dist/entities/discount.js +77 -0
- package/dist/entities/discount.test.js +20 -0
- package/dist/entities/discount_group.js +74 -0
- package/dist/entities/discount_group.test.js +6 -0
- package/dist/entities/domain.js +535 -0
- package/dist/entities/domain.test.js +75 -0
- package/dist/entities/domain_invitation.js +90 -0
- package/dist/entities/domain_invitation.test.js +6 -0
- package/dist/entities/domain_tag.js +100 -0
- package/dist/entities/domain_tag.test.js +6 -0
- package/dist/entities/draft.js +180 -0
- package/dist/entities/draft.test.js +39 -0
- package/dist/entities/draft_comment.js +132 -0
- package/dist/entities/draft_comment.test.js +6 -0
- package/dist/entities/draft_template.js +105 -0
- package/dist/entities/draft_template.test.js +6 -0
- package/dist/entities/email_address.js +68 -0
- package/dist/entities/email_address.test.js +6 -0
- package/dist/entities/email_counter.js +56 -0
- package/dist/entities/email_counter.test.js +6 -0
- package/dist/entities/enrolled_domain.js +85 -0
- package/dist/entities/enrolled_domain.test.js +6 -0
- package/dist/entities/exchange_rate.js +62 -0
- package/dist/entities/exchange_rate.test.js +6 -0
- package/dist/entities/file.js +383 -0
- package/dist/entities/file.test.js +38 -0
- package/dist/entities/internal_tag.js +120 -0
- package/dist/entities/internal_tag.test.js +6 -0
- package/dist/entities/inventory.js +120 -0
- package/dist/entities/inventory.test.js +26 -0
- package/dist/entities/inventory_unit_variation.js +64 -0
- package/dist/entities/inventory_unit_variation.test.js +6 -0
- package/dist/entities/invoice.js +420 -0
- package/dist/entities/invoice.test.js +39 -0
- package/dist/entities/item.js +102 -0
- package/dist/entities/item.test.js +17 -0
- package/dist/entities/job.js +744 -0
- package/dist/entities/job.test.js +103 -0
- package/dist/entities/job_comment.js +120 -0
- package/dist/entities/job_comment.test.js +6 -0
- package/dist/entities/matching_inventory.js +77 -0
- package/dist/entities/menu.js +78 -0
- package/dist/entities/menu.test.js +6 -0
- package/dist/entities/menu_item.js +76 -0
- package/dist/entities/menu_item.test.js +6 -0
- package/dist/entities/notification.js +234 -0
- package/dist/entities/notification.test.js +6 -0
- package/dist/entities/page.js +84 -0
- package/dist/entities/page.test.js +6 -0
- package/dist/entities/payment.js +141 -0
- package/dist/entities/payment.test.js +18 -0
- package/dist/entities/payment_device.js +87 -0
- package/dist/entities/payment_device.test.js +6 -0
- package/dist/entities/phone_number.js +98 -0
- package/dist/entities/phone_number.test.js +6 -0
- package/dist/entities/product.js +806 -0
- package/dist/entities/product.test.js +811 -0
- package/dist/entities/production_comment.js +120 -0
- package/dist/entities/production_comment.test.js +6 -0
- package/dist/entities/quote.js +208 -0
- package/dist/entities/quote.test.js +107 -0
- package/dist/entities/quote_item.js +121 -0
- package/dist/entities/quote_item.test.js +56 -0
- package/dist/entities/seo_domain_page.js +82 -0
- package/dist/entities/seo_domain_page.test.js +6 -0
- package/dist/entities/session.js +77 -0
- package/dist/entities/session.test.js +6 -0
- package/dist/entities/shipment.js +401 -0
- package/dist/entities/shipment.test.js +28 -0
- package/dist/entities/shipment_item.js +49 -0
- package/dist/entities/shipment_item.test.js +6 -0
- package/dist/entities/shipment_item_fulfillment.js +48 -0
- package/dist/entities/shipment_item_fulfillment.test.js +6 -0
- package/dist/entities/shipment_method.js +146 -0
- package/dist/entities/shipment_method.test.js +6 -0
- package/dist/entities/shipment_method_variation.js +104 -0
- package/dist/entities/shipment_method_variation.test.js +6 -0
- package/dist/entities/short_url.js +95 -0
- package/dist/entities/short_url.test.js +6 -0
- package/dist/entities/subscription_plan.js +172 -0
- package/dist/entities/subscription_plan.test.js +6 -0
- package/dist/entities/supply_domain.js +73 -0
- package/dist/entities/supply_domain.test.js +6 -0
- package/dist/entities/system_role.js +50 -0
- package/dist/entities/system_role.test.js +6 -0
- package/dist/entities/theme.js +614 -0
- package/dist/entities/theme.test.js +39 -0
- package/dist/entities/theme_css_setting.js +67 -0
- package/dist/entities/theme_css_setting.test.js +6 -0
- package/dist/entities/user.js +749 -0
- package/dist/entities/user.test.js +157 -0
- package/dist/entities/user_company.js +78 -0
- package/dist/entities/user_company.test.js +6 -0
- package/dist/entities/variation.js +147 -0
- package/dist/entities/variation.test.js +6 -0
- package/dist/entities/variation_field.js +313 -0
- package/dist/entities/variation_field.test.js +69 -0
- package/dist/entities/variation_fields_option.js +190 -0
- package/dist/entities/variation_fields_option.test.js +47 -0
- package/dist/entities/variation_option.js +129 -0
- package/dist/entities/variation_option.test.js +6 -0
- package/dist/entities/variations_group.js +111 -0
- package/dist/entities/variations_group.test.js +6 -0
- package/dist/entity.js +888 -0
- package/dist/merchi.js +259 -0
- package/dist/merchi.test.js +35 -0
- package/dist/request.js +132 -0
- package/dist/request.test.js +46 -0
- package/dist/test_util.js +19 -0
- package/dist/toasts.js +27 -0
- package/dist/toasts.test.js +46 -0
- package/dist/util/float.js +24 -0
- package/dist/util/query_string.js +11 -0
- package/dist/util/query_string.test.js +6 -0
- package/dist/util/validation.js +3 -0
- package/dist/util/validation.test.js +12 -0
- package/dist/uuid.js +8 -0
- package/dist/uuid.test.js +13 -0
- package/jest.config.js +17 -0
- package/package.json +44 -0
- package/src/constants/auto_assign_production_on_actions.ts +6 -0
- package/src/constants/call_to_actions.test.ts +5 -0
- package/src/constants/call_to_actions.ts +14 -0
- package/src/constants/discount_types.test.ts +5 -0
- package/src/constants/discount_types.ts +3 -0
- package/src/constants/domain_types.test.ts +5 -0
- package/src/constants/domain_types.ts +12 -0
- package/src/constants/errors.ts +32 -0
- package/src/constants/event_types.test.ts +5 -0
- package/src/constants/event_types.ts +5 -0
- package/src/constants/field_types.test.ts +5 -0
- package/src/constants/field_types.ts +13 -0
- package/src/constants/input_types.test.ts +5 -0
- package/src/constants/input_types.ts +13 -0
- package/src/constants/inventory_status.test.ts +5 -0
- package/src/constants/inventory_statuses.ts +6 -0
- package/src/constants/invoice_types.test.ts +5 -0
- package/src/constants/invoice_types.ts +5 -0
- package/src/constants/item_types.test.ts +5 -0
- package/src/constants/item_types.ts +5 -0
- package/src/constants/job/drafting_status.test.ts +5 -0
- package/src/constants/job/drafting_status.ts +7 -0
- package/src/constants/job/payment_status.test.ts +5 -0
- package/src/constants/job/payment_status.ts +7 -0
- package/src/constants/job/production_status.test.ts +5 -0
- package/src/constants/job/production_status.ts +12 -0
- package/src/constants/job/shipment_status.test.ts +5 -0
- package/src/constants/job/shipment_status.ts +11 -0
- package/src/constants/job/supply_chain_request_status.test.ts +5 -0
- package/src/constants/job/supply_chain_request_status.ts +6 -0
- package/src/constants/job_priorities.test.ts +5 -0
- package/src/constants/job_priorities.ts +6 -0
- package/src/constants/job_status.test.ts +5 -0
- package/src/constants/job_status.ts +49 -0
- package/src/constants/job_types.test.ts +5 -0
- package/src/constants/job_types.ts +15 -0
- package/src/constants/notification_sections.test.ts +5 -0
- package/src/constants/notification_sections.ts +13 -0
- package/src/constants/notification_types.test.ts +5 -0
- package/src/constants/notification_types.ts +97 -0
- package/src/constants/notification_urgencies.test.ts +5 -0
- package/src/constants/notification_urgencies.ts +7 -0
- package/src/constants/payment_types.test.ts +5 -0
- package/src/constants/payment_types.ts +10 -0
- package/src/constants/platform.test.ts +15 -0
- package/src/constants/platform.ts +6 -0
- package/src/constants/product_types.test.ts +6 -0
- package/src/constants/product_types.ts +25 -0
- package/src/constants/rights.test.ts +5 -0
- package/src/constants/rights.ts +5 -0
- package/src/constants/robots_meta_directives.test.ts +5 -0
- package/src/constants/robots_meta_directives.ts +11 -0
- package/src/constants/roles.test.ts +5 -0
- package/src/constants/roles.ts +38 -0
- package/src/constants/shipment_companies.test.ts +5 -0
- package/src/constants/shipment_companies.ts +18 -0
- package/src/constants/shipment_services.test.ts +5 -0
- package/src/constants/shipment_services.ts +3 -0
- package/src/constants/system_roles.test.ts +5 -0
- package/src/constants/system_roles.ts +3 -0
- package/src/constants/theme_foundations.test.ts +5 -0
- package/src/constants/theme_foundations.ts +6 -0
- package/src/constants/theme_status.test.ts +5 -0
- package/src/constants/theme_status.ts +5 -0
- package/src/constants/user_types.test.ts +5 -0
- package/src/constants/user_types.ts +17 -0
- package/src/constants/white_label_accessibilities.test.ts +5 -0
- package/src/constants/white_label_accessibilities.ts +6 -0
- package/src/cookie.test.ts +11 -0
- package/src/cookie.ts +16 -0
- package/src/entities/address.test.ts +7 -0
- package/src/entities/address.ts +65 -0
- package/src/entities/assignment.test.ts +39 -0
- package/src/entities/assignment.ts +92 -0
- package/src/entities/automatic_payment_relationship.test.ts +8 -0
- package/src/entities/automatic_payment_relationship.ts +26 -0
- package/src/entities/backup.test.ts +7 -0
- package/src/entities/backup.ts +14 -0
- package/src/entities/bank.test.ts +7 -0
- package/src/entities/bank.ts +45 -0
- package/src/entities/cart.test.ts +50 -0
- package/src/entities/cart.ts +89 -0
- package/src/entities/cart_item.test.ts +33 -0
- package/src/entities/cart_item.ts +77 -0
- package/src/entities/cart_shipment_group.ts +21 -0
- package/src/entities/cart_shipment_quote.ts +33 -0
- package/src/entities/category.test.ts +57 -0
- package/src/entities/category.ts +37 -0
- package/src/entities/company.test.ts +7 -0
- package/src/entities/company.ts +275 -0
- package/src/entities/company_invitation.test.ts +7 -0
- package/src/entities/company_invitation.ts +33 -0
- package/src/entities/component.test.ts +14 -0
- package/src/entities/component.ts +92 -0
- package/src/entities/component_tag.test.ts +7 -0
- package/src/entities/component_tag.ts +17 -0
- package/src/entities/component_version.test.ts +7 -0
- package/src/entities/component_version.ts +30 -0
- package/src/entities/country_tax.test.ts +13 -0
- package/src/entities/country_tax.ts +46 -0
- package/src/entities/discount.test.ts +18 -0
- package/src/entities/discount.ts +34 -0
- package/src/entities/discount_group.test.ts +7 -0
- package/src/entities/discount_group.ts +28 -0
- package/src/entities/domain.test.ts +79 -0
- package/src/entities/domain.ts +246 -0
- package/src/entities/domain_invitation.test.ts +7 -0
- package/src/entities/domain_invitation.ts +36 -0
- package/src/entities/domain_tag.test.ts +7 -0
- package/src/entities/domain_tag.ts +42 -0
- package/src/entities/draft.test.ts +43 -0
- package/src/entities/draft.ts +88 -0
- package/src/entities/draft_comment.test.ts +7 -0
- package/src/entities/draft_comment.ts +54 -0
- package/src/entities/draft_template.test.ts +7 -0
- package/src/entities/draft_template.ts +40 -0
- package/src/entities/email_address.test.ts +7 -0
- package/src/entities/email_address.ts +24 -0
- package/src/entities/email_counter.test.ts +7 -0
- package/src/entities/email_counter.ts +20 -0
- package/src/entities/enrolled_domain.test.ts +7 -0
- package/src/entities/enrolled_domain.ts +40 -0
- package/src/entities/exchange_rate.test.ts +7 -0
- package/src/entities/exchange_rate.ts +22 -0
- package/src/entities/file.test.ts +43 -0
- package/src/entities/file.ts +172 -0
- package/src/entities/internal_tag.test.ts +7 -0
- package/src/entities/internal_tag.ts +51 -0
- package/src/entities/inventory.test.ts +28 -0
- package/src/entities/inventory.ts +56 -0
- package/src/entities/inventory_unit_variation.test.ts +7 -0
- package/src/entities/inventory_unit_variation.ts +29 -0
- package/src/entities/invoice.test.ts +43 -0
- package/src/entities/invoice.ts +179 -0
- package/src/entities/item.test.ts +19 -0
- package/src/entities/item.ts +44 -0
- package/src/entities/job.test.ts +95 -0
- package/src/entities/job.ts +349 -0
- package/src/entities/job_comment.test.ts +7 -0
- package/src/entities/job_comment.ts +50 -0
- package/src/entities/matching_inventory.ts +29 -0
- package/src/entities/menu.test.ts +7 -0
- package/src/entities/menu.ts +30 -0
- package/src/entities/menu_item.test.ts +7 -0
- package/src/entities/menu_item.ts +29 -0
- package/src/entities/notification.test.ts +7 -0
- package/src/entities/notification.ts +99 -0
- package/src/entities/page.test.ts +7 -0
- package/src/entities/page.ts +32 -0
- package/src/entities/payment.test.ts +19 -0
- package/src/entities/payment.ts +65 -0
- package/src/entities/payment_device.test.ts +7 -0
- package/src/entities/payment_device.ts +30 -0
- package/src/entities/phone_number.test.ts +7 -0
- package/src/entities/phone_number.ts +36 -0
- package/src/entities/product.test.ts +750 -0
- package/src/entities/product.ts +427 -0
- package/src/entities/production_comment.test.ts +7 -0
- package/src/entities/production_comment.ts +50 -0
- package/src/entities/quote.test.ts +98 -0
- package/src/entities/quote.ts +140 -0
- package/src/entities/quote_item.test.ts +50 -0
- package/src/entities/quote_item.ts +71 -0
- package/src/entities/seo_domain_page.test.ts +7 -0
- package/src/entities/seo_domain_page.ts +33 -0
- package/src/entities/session.test.ts +7 -0
- package/src/entities/session.ts +28 -0
- package/src/entities/shipment.test.ts +24 -0
- package/src/entities/shipment.ts +185 -0
- package/src/entities/shipment_item.test.ts +7 -0
- package/src/entities/shipment_item.ts +15 -0
- package/src/entities/shipment_item_fulfillment.test.ts +8 -0
- package/src/entities/shipment_item_fulfillment.ts +15 -0
- package/src/entities/shipment_method.test.ts +7 -0
- package/src/entities/shipment_method.ts +61 -0
- package/src/entities/shipment_method_variation.test.ts +7 -0
- package/src/entities/shipment_method_variation.ts +39 -0
- package/src/entities/short_url.test.ts +7 -0
- package/src/entities/short_url.ts +36 -0
- package/src/entities/subscription_plan.test.ts +7 -0
- package/src/entities/subscription_plan.ts +73 -0
- package/src/entities/supply_domain.test.ts +7 -0
- package/src/entities/supply_domain.ts +27 -0
- package/src/entities/system_role.test.ts +7 -0
- package/src/entities/system_role.ts +17 -0
- package/src/entities/theme.test.ts +38 -0
- package/src/entities/theme.ts +267 -0
- package/src/entities/theme_css_setting.test.ts +7 -0
- package/src/entities/theme_css_setting.ts +23 -0
- package/src/entities/user.test.ts +154 -0
- package/src/entities/user.ts +394 -0
- package/src/entities/user_company.test.ts +7 -0
- package/src/entities/user_company.ts +27 -0
- package/src/entities/variation.test.ts +7 -0
- package/src/entities/variation.ts +61 -0
- package/src/entities/variation_field.test.ts +76 -0
- package/src/entities/variation_field.ts +169 -0
- package/src/entities/variation_fields_option.test.ts +46 -0
- package/src/entities/variation_fields_option.ts +95 -0
- package/src/entities/variation_option.test.ts +7 -0
- package/src/entities/variation_option.ts +52 -0
- package/src/entities/variations_group.test.ts +7 -0
- package/src/entities/variations_group.ts +41 -0
- package/src/entity.ts +1002 -0
- package/src/merchi.test.ts +25 -0
- package/src/merchi.ts +379 -0
- package/src/request.test.ts +43 -0
- package/src/request.ts +124 -0
- package/src/test_util.ts +18 -0
- package/src/toasts.test.ts +38 -0
- package/src/toasts.ts +34 -0
- package/src/util/float.ts +12 -0
- package/src/util/query_string.test.ts +7 -0
- package/src/util/query_string.ts +11 -0
- package/src/util/validation.test.ts +16 -0
- package/src/util/validation.ts +2 -0
- package/src/uuid.test.ts +15 -0
- package/src/uuid.ts +8 -0
- package/tsconfig.json +23 -0
- package/webpack.config.cjs +27 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export enum ProductType {
|
|
2
|
+
SUPPLIER_MOD = 0,
|
|
3
|
+
SUPPLIER = 1,
|
|
4
|
+
SELLER = 2,
|
|
5
|
+
SELLER_MOD = 3,
|
|
6
|
+
CLONED_SUPPLIER_MOD = 4,
|
|
7
|
+
CLONED_SELLER_MOD = 5,
|
|
8
|
+
PRODUCTION_MOD = 6,
|
|
9
|
+
CLONED_SUPPLIER = 7,
|
|
10
|
+
INVENTORY_SELLER = 8,
|
|
11
|
+
INVENTORY_SUPPLIER = 9,
|
|
12
|
+
SELLER_GROUP_BUY = 10,
|
|
13
|
+
SUPPLIER_RESELL_MOD = 11,
|
|
14
|
+
SUPPLIER_RESELL = 12,
|
|
15
|
+
SUPPLIER_GROUP_BUY_INVENTORY = 13,
|
|
16
|
+
CLONED_INVENTORY_SELLER = 14,
|
|
17
|
+
CLONED_SELLER_GROUP_BUY_INVENTORY = 15,
|
|
18
|
+
CLONED_SUPPLIER_RESELL_MOD = 16,
|
|
19
|
+
SUPPLIER_TO_SUPPLIER_RESELL_MOD = 17,
|
|
20
|
+
CLONED_SUPPLIER_RESELL = 18,
|
|
21
|
+
SUPPLY_DOMAIN_REFERENCE = 19,
|
|
22
|
+
SELLER_FILE_DOWNLOAD = 20,
|
|
23
|
+
SUPPLIER_MOD_SUPPLY_CHAIN_REQUEST = 21,
|
|
24
|
+
SUPPLIER_SUPPLY_CHAIN_REQUEST = 22,
|
|
25
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export enum Role {
|
|
2
|
+
PUBLIC = 0,
|
|
3
|
+
ADMIN = 1,
|
|
4
|
+
SALES = 2,
|
|
5
|
+
DESIGNER = 3,
|
|
6
|
+
SUPPLIER = 4,
|
|
7
|
+
CLIENT = 5,
|
|
8
|
+
MANAGER = 6,
|
|
9
|
+
ACCOUNTANT = 7,
|
|
10
|
+
THEME_EDITOR = 8,
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const DOMAIN_MANAGERS = [Role.ADMIN, Role.MANAGER];
|
|
14
|
+
|
|
15
|
+
export const MANAGEMENT_TEAM = [
|
|
16
|
+
...DOMAIN_MANAGERS,
|
|
17
|
+
Role.SALES,
|
|
18
|
+
Role.DESIGNER,
|
|
19
|
+
Role.ACCOUNTANT,
|
|
20
|
+
];
|
|
21
|
+
|
|
22
|
+
export const BUSINESS_ACCOUNTS = [...MANAGEMENT_TEAM, Role.SUPPLIER];
|
|
23
|
+
|
|
24
|
+
export const MANAGEMENT_ROLES = [Role.ADMIN, Role.MANAGER];
|
|
25
|
+
|
|
26
|
+
export const THEME_ROLES = [...MANAGEMENT_ROLES, Role.THEME_EDITOR];
|
|
27
|
+
export const ROLES_RANK = [
|
|
28
|
+
Role.PUBLIC,
|
|
29
|
+
Role.CLIENT,
|
|
30
|
+
Role.ACCOUNTANT,
|
|
31
|
+
Role.SALES,
|
|
32
|
+
Role.DESIGNER,
|
|
33
|
+
Role.SUPPLIER,
|
|
34
|
+
Role.MANAGER,
|
|
35
|
+
Role.ADMIN,
|
|
36
|
+
];
|
|
37
|
+
|
|
38
|
+
export const ALL_ROLES = ROLES_RANK;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export enum ShipmentCompany {
|
|
2
|
+
DHL = 0,
|
|
3
|
+
UPS = 1,
|
|
4
|
+
EMS = 2,
|
|
5
|
+
FED_EX = 3,
|
|
6
|
+
AUSTRALIA_POST = 4,
|
|
7
|
+
STAR_TRACK = 5,
|
|
8
|
+
TOLL = 6,
|
|
9
|
+
TNT = 7,
|
|
10
|
+
CUSTOM_TRACK_LINK = 8,
|
|
11
|
+
ARAMEX = 9,
|
|
12
|
+
REALTIME_EXPRESS = 10,
|
|
13
|
+
UBER = 11,
|
|
14
|
+
CIVIC_TRANSPORT_COURIERS = 12,
|
|
15
|
+
NZ_POST = 13,
|
|
16
|
+
SENDLE = 14,
|
|
17
|
+
USPS = 15,
|
|
18
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export enum UserType {
|
|
2
|
+
PUBLIC = 0,
|
|
3
|
+
CLIENT_GUEST = 1, // A user who has not oppted in for a user account
|
|
4
|
+
CLIENT_DOMAIN = 2, // A user who is a client of one domain
|
|
5
|
+
CLIENT_MULTIPLE_DOMAINS = 3, // A user who is a client of multiple domains
|
|
6
|
+
CLIENT_MERCHI = 4, // A user has a client profile with Merchi
|
|
7
|
+
SELLER_FREE_MERCHI = 5, // A user who has opened a seller store through Merchi
|
|
8
|
+
SELLER_FREE_DOMAIN = 6, // A user who has opened a seller store through a domain/supplier
|
|
9
|
+
SELLER_PAID = 7, // A user who is paying for a seller store
|
|
10
|
+
SELLER_PAID_MULTIPLE_DOMAINS = 8, // A user who is paying for multiple seller stores
|
|
11
|
+
SUPPLIER_THIRD_PARTY = 9, // A user who has a "domain supplier" domain
|
|
12
|
+
SUPPLIER_RESTRICTED = 10, // A user who has a restricted supply domain
|
|
13
|
+
SUPPLIER_MERCHI = 11, // A user who has a supply domain which has been verified by Merchi
|
|
14
|
+
UNRESTRICTED = 12, // A user who has a domain which is unrestricted
|
|
15
|
+
SHOPIFY_REFERENCE = 13, // A user who makes order from shopify and linked to our system
|
|
16
|
+
RESERVED_FROM_SOCIAL = 14, // A user crawled from Social network
|
|
17
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { getCookie } from './cookie';
|
|
2
|
+
|
|
3
|
+
test('can get cookie', () => {
|
|
4
|
+
const token = 'IMiF7rpT$5ciUJ38QY';
|
|
5
|
+
const cookie = `session_token=${token}`;
|
|
6
|
+
Object.defineProperty(document, 'cookie', {
|
|
7
|
+
get: jest.fn().mockImplementation(() => { return cookie; }),
|
|
8
|
+
set: jest.fn().mockImplementation(() => {}),
|
|
9
|
+
});
|
|
10
|
+
expect(getCookie('session_token')).toBe('IMiF7rpT$5ciUJ38QY');
|
|
11
|
+
});
|
package/src/cookie.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export function getCookie(name: string) {
|
|
2
|
+
// code might be executed during SSR
|
|
3
|
+
// istanbul ignore next
|
|
4
|
+
if (typeof document !== 'undefined') {
|
|
5
|
+
const searchPrefix = name + '=',
|
|
6
|
+
cookies = document.cookie.split(';');
|
|
7
|
+
for (let i = 0; i < cookies.length; ++i) {
|
|
8
|
+
let cookie = cookies[i];
|
|
9
|
+
cookie = cookie.replace(/^\s*/, '');
|
|
10
|
+
if (cookie.indexOf(searchPrefix) === 0) {
|
|
11
|
+
return cookie.substring(searchPrefix.length, cookie.length);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
return undefined;
|
|
16
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { Bank } from './bank';
|
|
2
|
+
import { Company } from './company';
|
|
3
|
+
import { Entity } from '../entity';
|
|
4
|
+
import { Inventory } from './inventory';
|
|
5
|
+
import { Invoice } from './invoice';
|
|
6
|
+
import { Job } from './job';
|
|
7
|
+
import { Shipment } from './shipment';
|
|
8
|
+
import { User } from './user';
|
|
9
|
+
|
|
10
|
+
export class Address extends Entity {
|
|
11
|
+
protected static resourceName = 'addresses';
|
|
12
|
+
protected static singularName = 'address';
|
|
13
|
+
protected static pluralName = 'addresses';
|
|
14
|
+
|
|
15
|
+
@Address.property({type: Date})
|
|
16
|
+
public archived?: Date | null;
|
|
17
|
+
|
|
18
|
+
@Address.property()
|
|
19
|
+
public id?: number;
|
|
20
|
+
|
|
21
|
+
@Address.property({type: String})
|
|
22
|
+
public lineOne?: string | null;
|
|
23
|
+
|
|
24
|
+
@Address.property({type: String})
|
|
25
|
+
public lineTwo?: string | null;
|
|
26
|
+
|
|
27
|
+
@Address.property({type: String})
|
|
28
|
+
public city?: string | null;
|
|
29
|
+
|
|
30
|
+
@Address.property({type: String})
|
|
31
|
+
public state?: string | null;
|
|
32
|
+
|
|
33
|
+
@Address.property({type: String})
|
|
34
|
+
public country?: string | null;
|
|
35
|
+
|
|
36
|
+
@Address.property({type: String})
|
|
37
|
+
public postcode?: string | null;
|
|
38
|
+
|
|
39
|
+
@Address.property({arrayType: 'Shipment'})
|
|
40
|
+
public shipmentAsSenderAddress?: Shipment[];
|
|
41
|
+
|
|
42
|
+
@Address.property({arrayType: 'Shipment'})
|
|
43
|
+
public shipmentsAsReceiverAddress?: Shipment[];
|
|
44
|
+
|
|
45
|
+
@Address.property({arrayType: 'Bank'})
|
|
46
|
+
public banks?: Bank[];
|
|
47
|
+
|
|
48
|
+
@Address.property({arrayType: 'User'})
|
|
49
|
+
public users?: User[];
|
|
50
|
+
|
|
51
|
+
@Address.property({arrayType: 'Inventory'})
|
|
52
|
+
public inventories?: Inventory[];
|
|
53
|
+
|
|
54
|
+
@Address.property({arrayType: 'Job'})
|
|
55
|
+
public jobs?: Job[];
|
|
56
|
+
|
|
57
|
+
@Address.property({arrayType: 'Job'})
|
|
58
|
+
public productedJobs?: Job[];
|
|
59
|
+
|
|
60
|
+
@Address.property({arrayType: 'Invoice'})
|
|
61
|
+
public shippingTo?: Invoice[];
|
|
62
|
+
|
|
63
|
+
@Address.property({arrayType: 'Company'})
|
|
64
|
+
public companies?: Company[];
|
|
65
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Merchi } from '../merchi';
|
|
2
|
+
import { setup, mockFetch } from '../test_util';
|
|
3
|
+
|
|
4
|
+
setup();
|
|
5
|
+
|
|
6
|
+
test('can make Assignment', () => {
|
|
7
|
+
const merchi = new Merchi();
|
|
8
|
+
const assignment = new merchi.Assignment();
|
|
9
|
+
expect(assignment).toBeTruthy();
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
test('can generate new invoice', () => {
|
|
13
|
+
mockFetch(true, {'id': 1, 'totalCost': 100}, 200);
|
|
14
|
+
|
|
15
|
+
const merchi = new Merchi();
|
|
16
|
+
const assignment = new merchi.Assignment();
|
|
17
|
+
assignment.id = 1;
|
|
18
|
+
assignment.generateInvoice().then(invoice => {
|
|
19
|
+
expect(invoice.totalCost).toEqual(100);
|
|
20
|
+
expect(invoice.id).toEqual(1);
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
test('can add to invoice', () => {
|
|
25
|
+
const fetch = mockFetch(true, {'id': 2, 'totalCost': 100}, 200);
|
|
26
|
+
const merchi = new Merchi();
|
|
27
|
+
const assignment = new merchi.Assignment();
|
|
28
|
+
assignment.id = 1;
|
|
29
|
+
assignment.generateInvoice({addToInvoice: 2}).then(invoice => {
|
|
30
|
+
expect(invoice.totalCost).toEqual(100);
|
|
31
|
+
expect(invoice.id).toEqual(2);
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
const correct = [['add_to_invoice', '2']];
|
|
35
|
+
expect(
|
|
36
|
+
Array.from(fetch.mock.calls[0][1]['query'])
|
|
37
|
+
).toEqual(correct);
|
|
38
|
+
});
|
|
39
|
+
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { Entity } from '../entity';
|
|
2
|
+
import { Quote } from './quote';
|
|
3
|
+
import { MerchiFile } from './file';
|
|
4
|
+
import { Job } from './job';
|
|
5
|
+
import { Notification } from './notification';
|
|
6
|
+
import { ProductionComment } from './production_comment';
|
|
7
|
+
import { Shipment } from './shipment';
|
|
8
|
+
import { SupplyDomain } from './supply_domain';
|
|
9
|
+
import { User } from './user';
|
|
10
|
+
import { RequestOptions } from '../request';
|
|
11
|
+
|
|
12
|
+
interface GenerateInvoiceProps {
|
|
13
|
+
addToInvoice? : number;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export class Assignment extends Entity {
|
|
17
|
+
protected static resourceName = 'assignments';
|
|
18
|
+
protected static singularName = 'assignment';
|
|
19
|
+
protected static pluralName = 'assignments';
|
|
20
|
+
|
|
21
|
+
@Assignment.property({type: Date})
|
|
22
|
+
public archived?: Date | null;
|
|
23
|
+
|
|
24
|
+
@Assignment.property()
|
|
25
|
+
public id?: number;
|
|
26
|
+
|
|
27
|
+
@Assignment.property({type: Date})
|
|
28
|
+
public managerAccepts?: Date | null;
|
|
29
|
+
|
|
30
|
+
@Assignment.property({type: Date})
|
|
31
|
+
public supplierRefused?: Date | null;
|
|
32
|
+
|
|
33
|
+
@Assignment.property()
|
|
34
|
+
public needsDrafting?: boolean;
|
|
35
|
+
|
|
36
|
+
@Assignment.property()
|
|
37
|
+
public needsShipping?: boolean;
|
|
38
|
+
|
|
39
|
+
@Assignment.property()
|
|
40
|
+
public productionDeadline?: Date;
|
|
41
|
+
|
|
42
|
+
@Assignment.property()
|
|
43
|
+
public assignmentDeadline?: Date;
|
|
44
|
+
|
|
45
|
+
@Assignment.property({type: String})
|
|
46
|
+
public notes?: string | null;
|
|
47
|
+
|
|
48
|
+
@Assignment.property({type: 'Job'})
|
|
49
|
+
public job?: Job | null;
|
|
50
|
+
|
|
51
|
+
@Assignment.property({type: 'Job'})
|
|
52
|
+
public supplyJob?: Job | null;
|
|
53
|
+
|
|
54
|
+
@Assignment.property({type: User})
|
|
55
|
+
public supplier?: User | null;
|
|
56
|
+
|
|
57
|
+
@Assignment.property({type: Quote})
|
|
58
|
+
public quote?: Quote | null;
|
|
59
|
+
|
|
60
|
+
@Assignment.property({arrayType: 'ProductionComment'})
|
|
61
|
+
public comments?: ProductionComment[];
|
|
62
|
+
|
|
63
|
+
@Assignment.property({type: Shipment})
|
|
64
|
+
public shipment?: Shipment | null;
|
|
65
|
+
|
|
66
|
+
@Assignment.property({type: SupplyDomain})
|
|
67
|
+
public supplyDomain?: SupplyDomain | null;
|
|
68
|
+
|
|
69
|
+
@Assignment.property({arrayType: 'Notification'})
|
|
70
|
+
public notifications?: Notification[];
|
|
71
|
+
|
|
72
|
+
@Assignment.property({arrayType: 'MerchiFile'})
|
|
73
|
+
public productionFiles?: MerchiFile[];
|
|
74
|
+
|
|
75
|
+
public generateInvoice = (props?: GenerateInvoiceProps) => {
|
|
76
|
+
const resource = `/generate-invoice-for-assignment/${this.id}/`;
|
|
77
|
+
const fetchOptions: RequestOptions = {method: 'POST'};
|
|
78
|
+
fetchOptions.query = [];
|
|
79
|
+
|
|
80
|
+
if (props && props.addToInvoice) {
|
|
81
|
+
fetchOptions.query.push(['add_to_invoice', String(props.addToInvoice!)]);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
return this.merchi.authenticatedFetch(resource, fetchOptions).
|
|
85
|
+
then((data: any) => {
|
|
86
|
+
const invoice = new this.merchi.Invoice();
|
|
87
|
+
invoice.fromJson(data);
|
|
88
|
+
return invoice;
|
|
89
|
+
});
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Merchi } from '../merchi';
|
|
2
|
+
|
|
3
|
+
test('can make AutomaticPaymentRelationship', () => {
|
|
4
|
+
const merchi = new Merchi();
|
|
5
|
+
const automaticPaymentRelationship =
|
|
6
|
+
new merchi.AutomaticPaymentRelationship();
|
|
7
|
+
expect(automaticPaymentRelationship).toBeTruthy();
|
|
8
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Company } from './company';
|
|
2
|
+
import { Entity } from '../entity';
|
|
3
|
+
|
|
4
|
+
export class AutomaticPaymentRelationship extends Entity {
|
|
5
|
+
protected static resourceName = 'automatic_payment_relationships';
|
|
6
|
+
protected static singularName = 'automaticPaymentRelationship';
|
|
7
|
+
protected static pluralName = 'automaticPaymentRelationships';
|
|
8
|
+
|
|
9
|
+
@AutomaticPaymentRelationship.property({type: Date})
|
|
10
|
+
public archived?: Date | null;
|
|
11
|
+
|
|
12
|
+
@AutomaticPaymentRelationship.property()
|
|
13
|
+
public id?: number;
|
|
14
|
+
|
|
15
|
+
@AutomaticPaymentRelationship.property()
|
|
16
|
+
public creationDate?: Date;
|
|
17
|
+
|
|
18
|
+
@AutomaticPaymentRelationship.property({type: Company})
|
|
19
|
+
public companyCustomer?: Company;
|
|
20
|
+
|
|
21
|
+
@AutomaticPaymentRelationship.property({type: Company})
|
|
22
|
+
public companySupplier?: Company;
|
|
23
|
+
|
|
24
|
+
@AutomaticPaymentRelationship.property({type: String})
|
|
25
|
+
public stripeCustomerId?: string;
|
|
26
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Entity } from '../entity';
|
|
2
|
+
import { MerchiFile } from './file';
|
|
3
|
+
|
|
4
|
+
export class Backup extends Entity {
|
|
5
|
+
protected static resourceName = 'backups';
|
|
6
|
+
protected static singularName = 'backup';
|
|
7
|
+
protected static pluralName = 'backups';
|
|
8
|
+
|
|
9
|
+
@Backup.property()
|
|
10
|
+
public id?: number;
|
|
11
|
+
|
|
12
|
+
@Backup.property()
|
|
13
|
+
public file?: MerchiFile;
|
|
14
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Address } from './address';
|
|
2
|
+
import { Company } from './company';
|
|
3
|
+
import { Entity } from '../entity';
|
|
4
|
+
|
|
5
|
+
export class Bank extends Entity {
|
|
6
|
+
protected static resourceName = 'banks';
|
|
7
|
+
protected static singularName = 'bank';
|
|
8
|
+
protected static pluralName = 'banks';
|
|
9
|
+
|
|
10
|
+
@Bank.property({type: Date})
|
|
11
|
+
public archived?: Date | null;
|
|
12
|
+
|
|
13
|
+
@Bank.property()
|
|
14
|
+
public id?: number;
|
|
15
|
+
|
|
16
|
+
@Bank.property()
|
|
17
|
+
public default?: boolean;
|
|
18
|
+
|
|
19
|
+
@Bank.property()
|
|
20
|
+
public bankName?: string;
|
|
21
|
+
|
|
22
|
+
@Bank.property()
|
|
23
|
+
public accountNumber?: string;
|
|
24
|
+
|
|
25
|
+
@Bank.property()
|
|
26
|
+
public accountName?: string;
|
|
27
|
+
|
|
28
|
+
@Bank.property({type: String})
|
|
29
|
+
public bsb?: string | null;
|
|
30
|
+
|
|
31
|
+
@Bank.property({type: String})
|
|
32
|
+
public swiftCode?: string | null;
|
|
33
|
+
|
|
34
|
+
@Bank.property({type: String})
|
|
35
|
+
public iban?: string | null;
|
|
36
|
+
|
|
37
|
+
@Bank.property({type: String})
|
|
38
|
+
public bankCode?: string | null;
|
|
39
|
+
|
|
40
|
+
@Bank.property({type: 'Address'})
|
|
41
|
+
public bankAddress?: Address | null;
|
|
42
|
+
|
|
43
|
+
@Bank.property()
|
|
44
|
+
public company?: Company;
|
|
45
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { Merchi } from '../merchi';
|
|
2
|
+
import { setup, mockFetch } from '../test_util';
|
|
3
|
+
|
|
4
|
+
setup();
|
|
5
|
+
|
|
6
|
+
test('can make Cart', () => {
|
|
7
|
+
const merchi = new Merchi();
|
|
8
|
+
const cart = new merchi.Cart();
|
|
9
|
+
expect(cart).toBeTruthy();
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
test('cart token supported by merchi', () => {
|
|
13
|
+
const merchi = new Merchi(undefined, undefined, undefined, 'c');
|
|
14
|
+
const correct = [['skip_rights', 'y'], ['cart_token', 'c']];
|
|
15
|
+
const fetch = mockFetch(true, {'invoice': {'id': 1}}, 200);
|
|
16
|
+
const invocation = merchi.Invoice.get(1);
|
|
17
|
+
expect(fetch.mock.calls[0][1]['query']).toEqual(correct);
|
|
18
|
+
return invocation;
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
test('requiresShipment', () => {
|
|
22
|
+
const merchi = new Merchi();
|
|
23
|
+
const cart = new merchi.Cart();
|
|
24
|
+
expect(cart.requiresShipment).toThrow();
|
|
25
|
+
cart.cartItems = [];
|
|
26
|
+
expect(cart.requiresShipment()).toBe(false);
|
|
27
|
+
cart.cartItems = [new merchi.CartItem()];
|
|
28
|
+
cart.cartItems[0].product = new merchi.Product();
|
|
29
|
+
cart.cartItems[0].product.needsShipping = true;
|
|
30
|
+
expect(cart.requiresShipment()).toBe(true);
|
|
31
|
+
cart.cartItems[0].product.needsShipping = false;
|
|
32
|
+
expect(cart.requiresShipment()).toBe(false);
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
test('pass cookie tokens to query string', () => {
|
|
36
|
+
const cookie = 'cart_token=c;';
|
|
37
|
+
Object.defineProperty(document, 'cookie', {
|
|
38
|
+
get: jest.fn().mockImplementation(() => { return cookie; }),
|
|
39
|
+
set: jest.fn().mockImplementation(() => {}),
|
|
40
|
+
});
|
|
41
|
+
const correct = [
|
|
42
|
+
['skip_rights', 'y'],
|
|
43
|
+
['cart_token', 'c'],
|
|
44
|
+
];
|
|
45
|
+
const fetch = mockFetch(true, {'cart': {'id': 1}}, 200);
|
|
46
|
+
const merchi = new Merchi();
|
|
47
|
+
const invocation = merchi.Cart.get(1);
|
|
48
|
+
expect(fetch.mock.calls[0][1]['query']).toEqual(correct);
|
|
49
|
+
return invocation;
|
|
50
|
+
});
|