@merchi/sdk 1.42.15 → 1.42.17
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/dist/constants/auto_assign_production_on_actions.d.ts +6 -0
- package/dist/constants/call_to_actions.d.ts +14 -0
- package/dist/constants/call_to_actions.test.d.ts +1 -0
- package/dist/constants/discount_types.d.ts +5 -0
- package/dist/constants/discount_types.test.d.ts +1 -0
- package/dist/constants/domain_types.d.ts +12 -0
- package/dist/constants/domain_types.test.d.ts +1 -0
- package/dist/constants/errors.d.ts +26 -0
- package/dist/constants/event_types.d.ts +5 -0
- package/dist/constants/event_types.test.d.ts +1 -0
- package/dist/constants/field_types.d.ts +18 -0
- package/dist/constants/field_types.js +1 -0
- package/dist/constants/field_types.test.d.ts +1 -0
- package/dist/constants/index.d.ts +25 -0
- package/dist/constants/input_types.d.ts +13 -0
- package/dist/constants/input_types.test.d.ts +1 -0
- package/dist/constants/inventory_status.test.d.ts +1 -0
- package/dist/constants/inventory_statuses.d.ts +6 -0
- package/dist/constants/invoice_types.d.ts +5 -0
- package/dist/constants/invoice_types.test.d.ts +1 -0
- package/dist/constants/item_types.d.ts +5 -0
- package/dist/constants/item_types.test.d.ts +1 -0
- package/dist/constants/job/drafting_status.d.ts +7 -0
- package/dist/constants/job/drafting_status.test.d.ts +1 -0
- package/dist/constants/job/payment_status.d.ts +7 -0
- package/dist/constants/job/payment_status.test.d.ts +1 -0
- package/dist/constants/job/production_status.d.ts +12 -0
- package/dist/constants/job/production_status.test.d.ts +1 -0
- package/dist/constants/job/shipment_status.d.ts +11 -0
- package/dist/constants/job/shipment_status.test.d.ts +1 -0
- package/dist/constants/job/supply_chain_request_status.d.ts +6 -0
- package/dist/constants/job/supply_chain_request_status.test.d.ts +1 -0
- package/dist/constants/job_priorities.d.ts +6 -0
- package/dist/constants/job_priorities.test.d.ts +1 -0
- package/dist/constants/job_status.d.ts +45 -0
- package/dist/constants/job_status.test.d.ts +1 -0
- package/dist/constants/job_types.d.ts +16 -0
- package/dist/constants/job_types.test.d.ts +1 -0
- package/dist/constants/notification_sections.d.ts +13 -0
- package/dist/constants/notification_sections.test.d.ts +1 -0
- package/dist/constants/notification_types.d.ts +101 -0
- package/dist/constants/notification_types.test.d.ts +1 -0
- package/dist/constants/notification_urgencies.d.ts +6 -0
- package/dist/constants/notification_urgencies.test.d.ts +1 -0
- package/dist/constants/payment_types.d.ts +10 -0
- package/dist/constants/payment_types.test.d.ts +1 -0
- package/dist/constants/platform.d.ts +5 -0
- package/dist/constants/platform.test.d.ts +1 -0
- package/dist/constants/product_types.d.ts +26 -0
- package/dist/constants/product_types.test.d.ts +1 -0
- package/dist/constants/rights.d.ts +5 -0
- package/dist/constants/rights.test.d.ts +1 -0
- package/dist/constants/robots_meta_directives.d.ts +1 -0
- package/dist/constants/robots_meta_directives.test.d.ts +1 -0
- package/dist/constants/roles.d.ts +21 -0
- package/dist/constants/roles.js +3 -0
- package/dist/constants/roles.test.d.ts +1 -0
- package/dist/constants/shipment_companies.d.ts +19 -0
- package/dist/constants/shipment_companies.test.d.ts +1 -0
- package/dist/constants/shipment_services.d.ts +3 -0
- package/dist/constants/shipment_services.test.d.ts +1 -0
- package/dist/constants/system_roles.d.ts +3 -0
- package/dist/constants/system_roles.test.d.ts +1 -0
- package/dist/constants/theme_status.d.ts +5 -0
- package/dist/constants/theme_status.test.d.ts +1 -0
- package/dist/constants/user_types.d.ts +17 -0
- package/dist/constants/user_types.test.d.ts +1 -0
- package/dist/constants/white_label_accessibilities.d.ts +5 -0
- package/dist/constants/white_label_accessibilities.test.d.ts +1 -0
- package/dist/cookie.d.ts +1 -0
- package/dist/cookie.test.d.ts +1 -0
- package/dist/entities/address.d.ts +30 -0
- package/dist/entities/address.test.d.ts +1 -0
- package/dist/entities/agent_conversation.d.ts +18 -0
- package/dist/entities/agent_conversation.test.d.ts +1 -0
- package/dist/entities/agent_skill.d.ts +33 -0
- package/dist/entities/agent_skill.test.d.ts +1 -0
- package/dist/entities/agent_skill_approval.d.ts +13 -0
- package/dist/entities/agent_skill_version.d.ts +18 -0
- package/dist/entities/agent_token_analytics.d.ts +50 -0
- package/dist/entities/agent_token_usage.d.ts +31 -0
- package/dist/entities/agent_token_usage.test.d.ts +1 -0
- package/dist/entities/assignment.d.ts +40 -0
- package/dist/entities/assignment.test.d.ts +1 -0
- package/dist/entities/automatic_payment_relationship.d.ts +14 -0
- package/dist/entities/automatic_payment_relationship.test.d.ts +1 -0
- package/dist/entities/bank.d.ts +20 -0
- package/dist/entities/bank.test.d.ts +1 -0
- package/dist/entities/cart.d.ts +50 -0
- package/dist/entities/cart.test.d.ts +1 -0
- package/dist/entities/cart_item.d.ts +33 -0
- package/dist/entities/cart_item.test.d.ts +1 -0
- package/dist/entities/cart_shipment_group.d.ts +12 -0
- package/dist/entities/cart_shipment_quote.d.ts +16 -0
- package/dist/entities/category.d.ts +26 -0
- package/dist/entities/category.test.d.ts +1 -0
- package/dist/entities/company.d.ts +137 -0
- package/dist/entities/company.test.d.ts +1 -0
- package/dist/entities/company_invitation.d.ts +16 -0
- package/dist/entities/company_invitation.test.d.ts +1 -0
- package/dist/entities/country_tax.d.ts +20 -0
- package/dist/entities/country_tax.test.d.ts +1 -0
- package/dist/entities/discount.d.ts +19 -0
- package/dist/entities/discount.test.d.ts +1 -0
- package/dist/entities/discount_group.d.ts +20 -0
- package/dist/entities/discount_group.test.d.ts +1 -0
- package/dist/entities/domain.d.ts +629 -0
- package/dist/entities/domain.test.d.ts +1 -0
- package/dist/entities/domain_chat_settings.d.ts +33 -0
- package/dist/entities/domain_chat_settings.test.d.ts +1 -0
- package/dist/entities/domain_invitation.d.ts +17 -0
- package/dist/entities/domain_invitation.test.d.ts +1 -0
- package/dist/entities/domain_tag.d.ts +21 -0
- package/dist/entities/domain_tag.test.d.ts +1 -0
- package/dist/entities/draft.d.ts +31 -0
- package/dist/entities/draft.test.d.ts +1 -0
- package/dist/entities/draft_comment.d.ts +28 -0
- package/dist/entities/draft_comment.test.d.ts +1 -0
- package/dist/entities/draft_preview.d.ts +18 -0
- package/dist/entities/draft_preview.test.d.ts +1 -0
- package/dist/entities/draft_preview_layer.d.ts +12 -0
- package/dist/entities/draft_preview_layer.test.d.ts +1 -0
- package/dist/entities/draft_template.d.ts +31 -0
- package/dist/entities/draft_template.js +8 -0
- package/dist/entities/draft_template.test.d.ts +1 -0
- package/dist/entities/email_address.d.ts +13 -0
- package/dist/entities/email_address.test.d.ts +1 -0
- package/dist/entities/email_counter.d.ts +11 -0
- package/dist/entities/email_counter.test.d.ts +1 -0
- package/dist/entities/enrolled_domain.d.ts +16 -0
- package/dist/entities/enrolled_domain.test.d.ts +1 -0
- package/dist/entities/exchange_rate.d.ts +11 -0
- package/dist/entities/exchange_rate.test.d.ts +1 -0
- package/dist/entities/file.d.ts +65 -0
- package/dist/entities/file.test.d.ts +1 -0
- package/dist/entities/internal_tag.d.ts +26 -0
- package/dist/entities/internal_tag.test.d.ts +1 -0
- package/dist/entities/inventory.d.ts +27 -0
- package/dist/entities/inventory.test.d.ts +1 -0
- package/dist/entities/inventory_group.d.ts +19 -0
- package/dist/entities/inventory_group.test.d.ts +1 -0
- package/dist/entities/inventory_unit_variation.d.ts +13 -0
- package/dist/entities/inventory_unit_variation.test.d.ts +1 -0
- package/dist/entities/invoice.d.ts +80 -0
- package/dist/entities/invoice.test.d.ts +1 -0
- package/dist/entities/item.d.ts +24 -0
- package/dist/entities/item.test.d.ts +1 -0
- package/dist/entities/job.d.ts +156 -0
- package/dist/entities/job.test.d.ts +1 -0
- package/dist/entities/job_comment.d.ts +24 -0
- package/dist/entities/job_comment.test.d.ts +1 -0
- package/dist/entities/job_note.d.ts +19 -0
- package/dist/entities/job_operation_log.d.ts +18 -0
- package/dist/entities/job_operation_log.test.d.ts +1 -0
- package/dist/entities/matching_inventory.d.ts +16 -0
- package/dist/entities/notification.d.ts +47 -0
- package/dist/entities/notification.test.d.ts +1 -0
- package/dist/entities/payment.d.ts +28 -0
- package/dist/entities/payment.test.d.ts +1 -0
- package/dist/entities/payment_device.d.ts +14 -0
- package/dist/entities/payment_device.test.d.ts +1 -0
- package/dist/entities/phone_number.d.ts +17 -0
- package/dist/entities/phone_number.test.d.ts +1 -0
- package/dist/entities/product.d.ts +148 -0
- package/dist/entities/product.test.d.ts +1 -0
- package/dist/entities/product_form.d.ts +22 -0
- package/dist/entities/product_form_version.d.ts +20 -0
- package/dist/entities/product_review.d.ts +74 -0
- package/dist/entities/production_comment.d.ts +24 -0
- package/dist/entities/production_comment.test.d.ts +1 -0
- package/dist/entities/quote.d.ts +29 -0
- package/dist/entities/quote.test.d.ts +1 -0
- package/dist/entities/quote_item.d.ts +24 -0
- package/dist/entities/quote_item.test.d.ts +1 -0
- package/dist/entities/reminder.d.ts +35 -0
- package/dist/entities/reminder.test.d.ts +1 -0
- package/dist/entities/session.d.ts +15 -0
- package/dist/entities/session.test.d.ts +1 -0
- package/dist/entities/shipment.d.ts +76 -0
- package/dist/entities/shipment.test.d.ts +1 -0
- package/dist/entities/shipment_item.d.ts +10 -0
- package/dist/entities/shipment_item.test.d.ts +1 -0
- package/dist/entities/shipment_item_fulfillment.d.ts +10 -0
- package/dist/entities/shipment_item_fulfillment.test.d.ts +1 -0
- package/dist/entities/shipment_log.d.ts +15 -0
- package/dist/entities/shipment_method.d.ts +28 -0
- package/dist/entities/shipment_method.test.d.ts +1 -0
- package/dist/entities/shipment_method_variation.d.ts +18 -0
- package/dist/entities/shipment_method_variation.test.d.ts +1 -0
- package/dist/entities/short_url.d.ts +17 -0
- package/dist/entities/short_url.test.d.ts +1 -0
- package/dist/entities/subscription_plan.d.ts +30 -0
- package/dist/entities/subscription_plan.test.d.ts +1 -0
- package/dist/entities/supply_domain.d.ts +14 -0
- package/dist/entities/supply_domain.test.d.ts +1 -0
- package/dist/entities/support_conversation.d.ts +30 -0
- package/dist/entities/support_conversation.test.d.ts +1 -0
- package/dist/entities/support_message.d.ts +15 -0
- package/dist/entities/support_message.test.d.ts +1 -0
- package/dist/entities/system_role.d.ts +10 -0
- package/dist/entities/system_role.test.d.ts +1 -0
- package/dist/entities/theme.d.ts +26 -0
- package/dist/entities/theme.test.d.ts +1 -0
- package/dist/entities/theme_css_setting.d.ts +12 -0
- package/dist/entities/theme_css_setting.test.d.ts +1 -0
- package/dist/entities/user.d.ts +142 -0
- package/dist/entities/user.test.d.ts +1 -0
- package/dist/entities/user_company.d.ts +14 -0
- package/dist/entities/user_company.test.d.ts +1 -0
- package/dist/entities/variation.d.ts +29 -0
- package/dist/entities/variation.test.d.ts +1 -0
- package/dist/entities/variation_field.d.ts +87 -0
- package/dist/entities/variation_field.js +33 -0
- package/dist/entities/variation_field.test.d.ts +1 -0
- package/dist/entities/variation_fields_option.d.ts +36 -0
- package/dist/entities/variation_fields_option.test.d.ts +1 -0
- package/dist/entities/variation_option.d.ts +23 -0
- package/dist/entities/variation_option.test.d.ts +1 -0
- package/dist/entities/variations_group.d.ts +20 -0
- package/dist/entities/variations_group.test.d.ts +1 -0
- package/dist/entity.d.ts +208 -0
- package/dist/index.d.ts +88 -0
- package/dist/merchi.d.ts +179 -0
- package/dist/merchi.test.d.ts +1 -0
- package/dist/pricing/discount.d.ts +2 -0
- package/dist/pricing/discount.test.d.ts +1 -0
- package/dist/pricing/estimate.d.ts +2 -0
- package/dist/pricing/estimate.js +56 -0
- package/dist/pricing/estimate.test.d.ts +1 -0
- package/dist/pricing/estimate.test.js +81 -0
- package/dist/pricing/golden.test.d.ts +1 -0
- package/dist/pricing/index.d.ts +7 -0
- package/dist/pricing/index.test.d.ts +1 -0
- package/dist/pricing/inventory.d.ts +2 -0
- package/dist/pricing/inventory.test.d.ts +1 -0
- package/dist/pricing/matrix.d.ts +10 -0
- package/dist/pricing/matrix.test.d.ts +1 -0
- package/dist/pricing/round.d.ts +13 -0
- package/dist/pricing/round.test.d.ts +1 -0
- package/dist/pricing/types.d.ts +137 -0
- package/dist/pricing/visibility.d.ts +3 -0
- package/dist/pricing/visibility.test.d.ts +1 -0
- package/dist/request.d.ts +56 -0
- package/dist/request.test.d.ts +1 -0
- package/dist/test_util.d.ts +3 -0
- package/dist/toasts.d.ts +14 -0
- package/dist/toasts.test.d.ts +1 -0
- package/dist/util/float.d.ts +1 -0
- package/dist/util/index.d.ts +3 -0
- package/dist/util/query_string.d.ts +1 -0
- package/dist/util/query_string.test.d.ts +1 -0
- package/dist/util/validation.d.ts +1 -0
- package/dist/util/validation.test.d.ts +1 -0
- package/dist/uuid.d.ts +1 -0
- package/dist/uuid.test.d.ts +1 -0
- package/package.json +2 -1
- package/src/constants/field_types.ts +1 -0
- package/src/constants/roles.ts +3 -0
- package/src/entities/draft_template.ts +6 -0
- package/src/entities/variation_field.ts +25 -0
- package/src/entity.ts +1 -1
- package/src/pricing/estimate.test.ts +95 -0
- package/src/pricing/estimate.ts +73 -0
- package/src/pricing/types.ts +10 -0
- package/tsconfig.json +1 -0
package/dist/merchi.d.ts
ADDED
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { Entity, EmbedDescriptor } from './entity.js';
|
|
2
|
+
import { AutomaticPaymentRelationship } from './entities/automatic_payment_relationship.js';
|
|
3
|
+
import { Session } from './entities/session.js';
|
|
4
|
+
import { JobComment } from './entities/job_comment.js';
|
|
5
|
+
import { JobNote } from './entities/job_note.js';
|
|
6
|
+
import { JobOperationLog } from './entities/job_operation_log.js';
|
|
7
|
+
import { Domain } from './entities/domain.js';
|
|
8
|
+
import { ExchangeRate } from './entities/exchange_rate.js';
|
|
9
|
+
import { Job } from './entities/job.js';
|
|
10
|
+
import { VariationField } from './entities/variation_field.js';
|
|
11
|
+
import { VariationOption } from './entities/variation_option.js';
|
|
12
|
+
import { ProductionComment } from './entities/production_comment.js';
|
|
13
|
+
import { Product } from './entities/product.js';
|
|
14
|
+
import { ProductReview } from './entities/product_review.js';
|
|
15
|
+
import { InternalTag } from './entities/internal_tag.js';
|
|
16
|
+
import { Inventory } from './entities/inventory.js';
|
|
17
|
+
import { InventoryGroup } from './entities/inventory_group.js';
|
|
18
|
+
import { QuoteItem } from './entities/quote_item.js';
|
|
19
|
+
import { Category } from './entities/category.js';
|
|
20
|
+
import { Invoice } from './entities/invoice.js';
|
|
21
|
+
import { UserCompany } from './entities/user_company.js';
|
|
22
|
+
import { InventoryUnitVariation } from './entities/inventory_unit_variation.js';
|
|
23
|
+
import { VariationFieldsOption } from './entities/variation_fields_option.js';
|
|
24
|
+
import { Bank } from './entities/bank.js';
|
|
25
|
+
import { Shipment } from './entities/shipment.js';
|
|
26
|
+
import { ShipmentLog } from './entities/shipment_log.js';
|
|
27
|
+
import { ShipmentItem } from './entities/shipment_item.js';
|
|
28
|
+
import { ShipmentItemFulfillment } from './entities/shipment_item_fulfillment.js';
|
|
29
|
+
import { ShipmentMethod } from './entities/shipment_method.js';
|
|
30
|
+
import { ShipmentMethodVariation } from './entities/shipment_method_variation.js';
|
|
31
|
+
import { DomainInvitation } from './entities/domain_invitation.js';
|
|
32
|
+
import { EmailCounter } from './entities/email_counter.js';
|
|
33
|
+
import { SupplyDomain } from './entities/supply_domain.js';
|
|
34
|
+
import { Cart } from './entities/cart.js';
|
|
35
|
+
import { CartShipmentGroup } from './entities/cart_shipment_group.js';
|
|
36
|
+
import { CartShipmentQuote } from './entities/cart_shipment_quote.js';
|
|
37
|
+
import { Theme } from './entities/theme.js';
|
|
38
|
+
import { ThemeCssSetting } from './entities/theme_css_setting.js';
|
|
39
|
+
import { ProductForm } from './entities/product_form.js';
|
|
40
|
+
import { ProductFormVersion } from './entities/product_form_version.js';
|
|
41
|
+
import { MerchiFile } from './entities/file.js';
|
|
42
|
+
import { EmailAddress } from './entities/email_address.js';
|
|
43
|
+
import { ShortUrl } from './entities/short_url.js';
|
|
44
|
+
import { VariationsGroup } from './entities/variations_group.js';
|
|
45
|
+
import { Quote } from './entities/quote.js';
|
|
46
|
+
import { Reminder } from './entities/reminder.js';
|
|
47
|
+
import { Draft } from './entities/draft.js';
|
|
48
|
+
import { DraftPreview } from './entities/draft_preview.js';
|
|
49
|
+
import { DraftPreviewLayer } from './entities/draft_preview_layer.js';
|
|
50
|
+
import { DraftTemplate } from './entities/draft_template.js';
|
|
51
|
+
import { Discount } from './entities/discount.js';
|
|
52
|
+
import { DiscountGroup } from './entities/discount_group.js';
|
|
53
|
+
import { User } from './entities/user.js';
|
|
54
|
+
import { Company } from './entities/company.js';
|
|
55
|
+
import { EnrolledDomain } from './entities/enrolled_domain.js';
|
|
56
|
+
import { CountryTax } from './entities/country_tax.js';
|
|
57
|
+
import { Item } from './entities/item.js';
|
|
58
|
+
import { DomainTag } from './entities/domain_tag.js';
|
|
59
|
+
import { DraftComment } from './entities/draft_comment.js';
|
|
60
|
+
import { Notification } from './entities/notification.js';
|
|
61
|
+
import { Payment } from './entities/payment.js';
|
|
62
|
+
import { CompanyInvitation } from './entities/company_invitation.js';
|
|
63
|
+
import { SystemRole } from './entities/system_role.js';
|
|
64
|
+
import { PaymentDevice } from './entities/payment_device.js';
|
|
65
|
+
import { PhoneNumber } from './entities/phone_number.js';
|
|
66
|
+
import { Variation } from './entities/variation.js';
|
|
67
|
+
import { CartItem } from './entities/cart_item.js';
|
|
68
|
+
import { Address } from './entities/address.js';
|
|
69
|
+
import { AgentConversation } from './entities/agent_conversation.js';
|
|
70
|
+
import { AgentTokenUsage } from './entities/agent_token_usage.js';
|
|
71
|
+
import { AgentSkill } from './entities/agent_skill.js';
|
|
72
|
+
import { AgentSkillVersion } from './entities/agent_skill_version.js';
|
|
73
|
+
import { AgentSkillApproval } from './entities/agent_skill_approval.js';
|
|
74
|
+
import { DomainChatSettings } from './entities/domain_chat_settings.js';
|
|
75
|
+
import { SupportConversation } from './entities/support_conversation.js';
|
|
76
|
+
import { SupportMessage } from './entities/support_message.js';
|
|
77
|
+
import { Assignment } from './entities/assignment.js';
|
|
78
|
+
import { MatchingInventory } from './entities/matching_inventory.js';
|
|
79
|
+
import { SubscriptionPlan } from './entities/subscription_plan.js';
|
|
80
|
+
import { RequestOptions } from './request.js';
|
|
81
|
+
export interface Type<T, A extends any[]> extends Function {
|
|
82
|
+
new (...args: A): T;
|
|
83
|
+
}
|
|
84
|
+
interface UserRequestOptions {
|
|
85
|
+
embed?: EmbedDescriptor;
|
|
86
|
+
}
|
|
87
|
+
export declare const API_VERSION = "v6";
|
|
88
|
+
export declare class Merchi {
|
|
89
|
+
id: string;
|
|
90
|
+
sessionToken?: string;
|
|
91
|
+
invoiceToken?: string;
|
|
92
|
+
clientToken?: string;
|
|
93
|
+
cartToken?: string;
|
|
94
|
+
readonly backendUri: string;
|
|
95
|
+
AutomaticPaymentRelationship: typeof AutomaticPaymentRelationship;
|
|
96
|
+
Notification: typeof Notification;
|
|
97
|
+
EnrolledDomain: typeof EnrolledDomain;
|
|
98
|
+
SystemRole: typeof SystemRole;
|
|
99
|
+
UserCompany: typeof UserCompany;
|
|
100
|
+
Variation: typeof Variation;
|
|
101
|
+
CountryTax: typeof CountryTax;
|
|
102
|
+
VariationField: typeof VariationField;
|
|
103
|
+
Assignment: typeof Assignment;
|
|
104
|
+
InternalTag: typeof InternalTag;
|
|
105
|
+
Inventory: typeof Inventory;
|
|
106
|
+
InventoryGroup: typeof InventoryGroup;
|
|
107
|
+
JobComment: typeof JobComment;
|
|
108
|
+
JobNote: typeof JobNote;
|
|
109
|
+
JobOperationLog: typeof JobOperationLog;
|
|
110
|
+
VariationOption: typeof VariationOption;
|
|
111
|
+
SupplyDomain: typeof SupplyDomain;
|
|
112
|
+
ProductionComment: typeof ProductionComment;
|
|
113
|
+
DraftComment: typeof DraftComment;
|
|
114
|
+
Shipment: typeof Shipment;
|
|
115
|
+
ShipmentLog: typeof ShipmentLog;
|
|
116
|
+
ShipmentItem: typeof ShipmentItem;
|
|
117
|
+
ShipmentItemFulfillment: typeof ShipmentItemFulfillment;
|
|
118
|
+
ShipmentMethod: typeof ShipmentMethod;
|
|
119
|
+
ShipmentMethodVariation: typeof ShipmentMethodVariation;
|
|
120
|
+
Draft: typeof Draft;
|
|
121
|
+
DraftPreview: typeof DraftPreview;
|
|
122
|
+
DraftPreviewLayer: typeof DraftPreviewLayer;
|
|
123
|
+
DraftTemplate: typeof DraftTemplate;
|
|
124
|
+
VariationFieldsOption: typeof VariationFieldsOption;
|
|
125
|
+
Category: typeof Category;
|
|
126
|
+
MerchiFile: typeof MerchiFile;
|
|
127
|
+
Invoice: typeof Invoice;
|
|
128
|
+
CompanyInvitation: typeof CompanyInvitation;
|
|
129
|
+
Bank: typeof Bank;
|
|
130
|
+
Job: typeof Job;
|
|
131
|
+
DomainInvitation: typeof DomainInvitation;
|
|
132
|
+
Product: typeof Product;
|
|
133
|
+
ProductReview: typeof ProductReview;
|
|
134
|
+
DomainTag: typeof DomainTag;
|
|
135
|
+
EmailAddress: typeof EmailAddress;
|
|
136
|
+
PhoneNumber: typeof PhoneNumber;
|
|
137
|
+
Company: typeof Company;
|
|
138
|
+
Address: typeof Address;
|
|
139
|
+
AgentConversation: typeof AgentConversation;
|
|
140
|
+
AgentTokenUsage: typeof AgentTokenUsage;
|
|
141
|
+
AgentSkill: typeof AgentSkill;
|
|
142
|
+
AgentSkillVersion: typeof AgentSkillVersion;
|
|
143
|
+
AgentSkillApproval: typeof AgentSkillApproval;
|
|
144
|
+
DomainChatSettings: typeof DomainChatSettings;
|
|
145
|
+
SupportConversation: typeof SupportConversation;
|
|
146
|
+
SupportMessage: typeof SupportMessage;
|
|
147
|
+
Discount: typeof Discount;
|
|
148
|
+
DiscountGroup: typeof DiscountGroup;
|
|
149
|
+
User: typeof User;
|
|
150
|
+
Session: typeof Session;
|
|
151
|
+
Theme: typeof Theme;
|
|
152
|
+
ThemeCssSetting: typeof ThemeCssSetting;
|
|
153
|
+
Item: typeof Item;
|
|
154
|
+
EmailCounter: typeof EmailCounter;
|
|
155
|
+
Domain: typeof Domain;
|
|
156
|
+
ExchangeRate: typeof ExchangeRate;
|
|
157
|
+
Payment: typeof Payment;
|
|
158
|
+
PaymentDevice: typeof PaymentDevice;
|
|
159
|
+
ShortUrl: typeof ShortUrl;
|
|
160
|
+
CartItem: typeof CartItem;
|
|
161
|
+
InventoryUnitVariation: typeof InventoryUnitVariation;
|
|
162
|
+
VariationsGroup: typeof VariationsGroup;
|
|
163
|
+
Cart: typeof Cart;
|
|
164
|
+
CartShipmentGroup: typeof CartShipmentGroup;
|
|
165
|
+
CartShipmentQuote: typeof CartShipmentQuote;
|
|
166
|
+
Quote: typeof Quote;
|
|
167
|
+
ProductForm: typeof ProductForm;
|
|
168
|
+
ProductFormVersion: typeof ProductFormVersion;
|
|
169
|
+
QuoteItem: typeof QuoteItem;
|
|
170
|
+
Reminder: typeof Reminder;
|
|
171
|
+
MatchingInventory: typeof MatchingInventory;
|
|
172
|
+
SubscriptionPlan: typeof SubscriptionPlan;
|
|
173
|
+
setupClass(cls: typeof Entity): typeof Entity;
|
|
174
|
+
constructor(sessionToken?: string, clientToken?: string, invoiceToken?: string, cartToken?: string, backendUri?: string);
|
|
175
|
+
authenticatedFetch: (resource: string, options: RequestOptions, expectEmptyResponse?: boolean) => Promise<any>;
|
|
176
|
+
authenticatedFetchWithProgress: (resource: string, options: RequestOptions, progressCallback?: ((progress: number) => void) | undefined) => Promise<any>;
|
|
177
|
+
getCurrentUser: (options?: UserRequestOptions) => Promise<any>;
|
|
178
|
+
}
|
|
179
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/pricing/estimate.js
CHANGED
|
@@ -150,6 +150,59 @@ function colourExtractCostFactor(field, sel, groupQuantities) {
|
|
|
150
150
|
}
|
|
151
151
|
return { setup: setup, unitList: unitList };
|
|
152
152
|
}
|
|
153
|
+
function parseEmbroidery(value) {
|
|
154
|
+
if (value === undefined || value === null || value === '')
|
|
155
|
+
return null;
|
|
156
|
+
try {
|
|
157
|
+
var parsed = JSON.parse(String(value));
|
|
158
|
+
return parsed && typeof parsed === 'object' ? parsed : null;
|
|
159
|
+
}
|
|
160
|
+
catch (_a) {
|
|
161
|
+
return null;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
function embroideryCostFactor(field, sel, groupQuantities) {
|
|
165
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
166
|
+
var n = groupQuantities.length;
|
|
167
|
+
var zeros = { setup: 0, unitList: new Array(n).fill(0) };
|
|
168
|
+
var parsed = parseEmbroidery((_a = sel === null || sel === void 0 ? void 0 : sel.value) !== null && _a !== void 0 ? _a : null);
|
|
169
|
+
var width = Number(parsed === null || parsed === void 0 ? void 0 : parsed.widthMm);
|
|
170
|
+
var height = Number(parsed === null || parsed === void 0 ? void 0 : parsed.heightMm);
|
|
171
|
+
var coverage = Number((_b = sel === null || sel === void 0 ? void 0 : sel.coverage) !== null && _b !== void 0 ? _b : parsed === null || parsed === void 0 ? void 0 : parsed.coverage);
|
|
172
|
+
// An explicit colourCount, including 0, wins. Otherwise count the saved
|
|
173
|
+
// colour list. A null value or a non-array list contributes no colours.
|
|
174
|
+
var savedColours = parsed === null || parsed === void 0 ? void 0 : parsed.colours;
|
|
175
|
+
var colourCount = Number((_c = sel === null || sel === void 0 ? void 0 : sel.colourCount) !== null && _c !== void 0 ? _c : (Array.isArray(savedColours) ? savedColours.length : 0));
|
|
176
|
+
var hasDesign = Boolean(String((parsed === null || parsed === void 0 ? void 0 : parsed.text) || '').trim()) || Boolean(sel === null || sel === void 0 ? void 0 : sel.hasFiles) || colourCount > 0;
|
|
177
|
+
if (!(width > 0) || !(height > 0) || !(coverage > 0) || !hasDesign)
|
|
178
|
+
return zeros;
|
|
179
|
+
var density = Number(field.stitchDensity) > 0 ? Number(field.stitchDensity) : 2.5;
|
|
180
|
+
var thousands = Math.round(width * height * coverage * density) / 1000;
|
|
181
|
+
var totalQty = groupQuantities.reduce(function (a, b) { return a + b; }, 0);
|
|
182
|
+
var setup = variationSetupCost(field, totalQty);
|
|
183
|
+
var unitList = variationUnitCosts(field, groupQuantities);
|
|
184
|
+
var stitchSetup = variationSetupCost({
|
|
185
|
+
variationCost: field.stitchVariationCost || 0,
|
|
186
|
+
variationCostDiscountGroup: (_d = field.stitchVariationCostDiscountGroup) !== null && _d !== void 0 ? _d : null,
|
|
187
|
+
}, totalQty);
|
|
188
|
+
var stitchUnits = variationUnitCosts({
|
|
189
|
+
variationUnitCost: field.stitchVariationUnitCost || 0,
|
|
190
|
+
variationUnitCostDiscountGroup: (_e = field.stitchVariationUnitCostDiscountGroup) !== null && _e !== void 0 ? _e : null,
|
|
191
|
+
}, groupQuantities);
|
|
192
|
+
var colourSetup = variationSetupCost({
|
|
193
|
+
variationCost: field.colourVariationCost || 0,
|
|
194
|
+
variationCostDiscountGroup: (_f = field.colourVariationCostDiscountGroup) !== null && _f !== void 0 ? _f : null,
|
|
195
|
+
}, totalQty);
|
|
196
|
+
var colourUnits = variationUnitCosts({
|
|
197
|
+
variationUnitCost: field.colourVariationUnitCost || 0,
|
|
198
|
+
variationUnitCostDiscountGroup: (_g = field.colourVariationUnitCostDiscountGroup) !== null && _g !== void 0 ? _g : null,
|
|
199
|
+
}, groupQuantities);
|
|
200
|
+
setup += stitchSetup * thousands + colourSetup * colourCount;
|
|
201
|
+
for (var i = 0; i < n; i++) {
|
|
202
|
+
unitList[i] += stitchUnits[i] * thousands + colourUnits[i] * colourCount;
|
|
203
|
+
}
|
|
204
|
+
return { setup: setup, unitList: unitList };
|
|
205
|
+
}
|
|
153
206
|
function costFactor(field, sel, groupQuantities) {
|
|
154
207
|
var e_1, _a, e_2, _b;
|
|
155
208
|
var n = groupQuantities.length;
|
|
@@ -160,6 +213,9 @@ function costFactor(field, sel, groupQuantities) {
|
|
|
160
213
|
if (Number(field.fieldType) === FieldType.COLOUR_EXTRACT) {
|
|
161
214
|
return colourExtractCostFactor(field, sel, groupQuantities);
|
|
162
215
|
}
|
|
216
|
+
if (Number(field.fieldType) === FieldType.EMBROIDERY) {
|
|
217
|
+
return embroideryCostFactor(field, sel, groupQuantities);
|
|
218
|
+
}
|
|
163
219
|
if (isEmpty(field, sel)) {
|
|
164
220
|
return { setup: 0, unitList: new Array(n).fill(0) };
|
|
165
221
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -451,3 +451,84 @@ test('group field visibility is scoped per group (no cross-group leak)', functio
|
|
|
451
451
|
expect(r.groupCosts).toEqual([0, 5]);
|
|
452
452
|
expect(r.cost).toBe(5);
|
|
453
453
|
});
|
|
454
|
+
test('embroidery prices stitches and colours from the saved size', function () {
|
|
455
|
+
var rules = __assign(__assign({}, base), { fields: [{
|
|
456
|
+
id: 16, originalId: 16, position: 0, fieldType: 16, independent: true,
|
|
457
|
+
isSelectable: false, selectedBy: [],
|
|
458
|
+
variationCost: 15, variationUnitCost: 0,
|
|
459
|
+
variationCostDiscountGroup: null, variationUnitCostDiscountGroup: null,
|
|
460
|
+
stitchDensity: 2.5,
|
|
461
|
+
stitchVariationCost: 12, stitchVariationUnitCost: 0.8,
|
|
462
|
+
stitchVariationCostDiscountGroup: null, stitchVariationUnitCostDiscountGroup: null,
|
|
463
|
+
colourVariationCost: 5, colourVariationUnitCost: 0.4,
|
|
464
|
+
colourVariationCostDiscountGroup: null, colourVariationUnitCostDiscountGroup: null,
|
|
465
|
+
options: [],
|
|
466
|
+
}] });
|
|
467
|
+
var value = JSON.stringify({
|
|
468
|
+
text: 'ACME', widthMm: 80, heightMm: 40, colours: ['#111111', '#CC0000'], coverage: 0.5,
|
|
469
|
+
});
|
|
470
|
+
var r = estimateQuote(rules, {
|
|
471
|
+
quantity: 1,
|
|
472
|
+
fieldValues: { 16: { value: value, colourCount: 2, coverage: 0.5 } },
|
|
473
|
+
});
|
|
474
|
+
expect(r.cost).toBe(87);
|
|
475
|
+
});
|
|
476
|
+
test('embroidery counts colours on the saved value when colourCount is omitted', function () {
|
|
477
|
+
var rules = __assign(__assign({}, base), { fields: [{
|
|
478
|
+
id: 16, originalId: 16, position: 0, fieldType: 16, independent: true,
|
|
479
|
+
isSelectable: false, selectedBy: [],
|
|
480
|
+
variationCost: 15, variationUnitCost: 0,
|
|
481
|
+
variationCostDiscountGroup: null, variationUnitCostDiscountGroup: null,
|
|
482
|
+
stitchDensity: 2.5,
|
|
483
|
+
stitchVariationCost: 12, stitchVariationUnitCost: 0.8,
|
|
484
|
+
stitchVariationCostDiscountGroup: null, stitchVariationUnitCostDiscountGroup: null,
|
|
485
|
+
colourVariationCost: 5, colourVariationUnitCost: 0.4,
|
|
486
|
+
colourVariationCostDiscountGroup: null, colourVariationUnitCostDiscountGroup: null,
|
|
487
|
+
options: [],
|
|
488
|
+
}] });
|
|
489
|
+
var value = JSON.stringify({
|
|
490
|
+
text: 'ACME', widthMm: 80, heightMm: 40, colours: ['#111111', '#CC0000'], coverage: 0.5,
|
|
491
|
+
});
|
|
492
|
+
var r = estimateQuote(rules, {
|
|
493
|
+
quantity: 1,
|
|
494
|
+
fieldValues: { 16: { value: value, coverage: 0.5 } },
|
|
495
|
+
});
|
|
496
|
+
expect(r.cost).toBe(87);
|
|
497
|
+
});
|
|
498
|
+
test('embroidery ignores a null or non-array colour list', function () {
|
|
499
|
+
var rules = __assign(__assign({}, base), { fields: [{
|
|
500
|
+
id: 16, originalId: 16, position: 0, fieldType: 16, independent: true,
|
|
501
|
+
isSelectable: false, selectedBy: [],
|
|
502
|
+
variationCost: 15, variationUnitCost: 0,
|
|
503
|
+
variationCostDiscountGroup: null, variationUnitCostDiscountGroup: null,
|
|
504
|
+
stitchDensity: 2.5,
|
|
505
|
+
stitchVariationCost: 12, stitchVariationUnitCost: 0.8,
|
|
506
|
+
stitchVariationCostDiscountGroup: null, stitchVariationUnitCostDiscountGroup: null,
|
|
507
|
+
colourVariationCost: 5, colourVariationUnitCost: 0.4,
|
|
508
|
+
colourVariationCostDiscountGroup: null, colourVariationUnitCostDiscountGroup: null,
|
|
509
|
+
options: [],
|
|
510
|
+
}] });
|
|
511
|
+
var missing = estimateQuote(rules, {
|
|
512
|
+
quantity: 1,
|
|
513
|
+
fieldValues: { 16: { value: null, colourCount: 2, coverage: 0.5 } },
|
|
514
|
+
});
|
|
515
|
+
// No saved size, so the stitch price cannot be calculated.
|
|
516
|
+
expect(missing.cost).toBe(10);
|
|
517
|
+
var notColours = JSON.stringify({
|
|
518
|
+
text: 'ACME', widthMm: 80, heightMm: 40, colours: 'red', coverage: 0.5,
|
|
519
|
+
});
|
|
520
|
+
var uncounted = estimateQuote(rules, {
|
|
521
|
+
quantity: 1,
|
|
522
|
+
fieldValues: { 16: { value: notColours, coverage: 0.5 } },
|
|
523
|
+
});
|
|
524
|
+
// 10 + 15 + 12*4 + 0.8*4 = 76.2; a non-array colour list adds no colour fee.
|
|
525
|
+
expect(uncounted.cost).toBe(76.2);
|
|
526
|
+
var explicitZero = JSON.stringify({
|
|
527
|
+
text: 'ACME', widthMm: 80, heightMm: 40, colours: ['#111111', '#CC0000'], coverage: 0.5,
|
|
528
|
+
});
|
|
529
|
+
var zero = estimateQuote(rules, {
|
|
530
|
+
quantity: 1,
|
|
531
|
+
fieldValues: { 16: { value: explicitZero, colourCount: 0, coverage: 0.5 } },
|
|
532
|
+
});
|
|
533
|
+
expect(zero.cost).toBe(76.2);
|
|
534
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from './types.js';
|
|
2
|
+
export { roundHalfEven } from './round.js';
|
|
3
|
+
export { applyDiscount } from './discount.js';
|
|
4
|
+
export { resolveVisibleFields, resolveVisibleOptionIds } from './visibility.js';
|
|
5
|
+
export { resolveUnavailableOptionIds } from './inventory.js';
|
|
6
|
+
export { estimateQuote } from './estimate.js';
|
|
7
|
+
export { buildPriceMatrix } from './matrix.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { BuildPriceMatrixOptions, PriceMatrix, PricingRules, Selections } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Quantity-break price table for the current selection.
|
|
4
|
+
*
|
|
5
|
+
* Columns are unique quantity thresholds from every discount group on the
|
|
6
|
+
* product, fields, and options. Each cell is `estimateQuote` at that quantity
|
|
7
|
+
* so the table matches what the form will charge. Returns null when there are
|
|
8
|
+
* fewer than two distinct prices (nothing useful to show).
|
|
9
|
+
*/
|
|
10
|
+
export declare function buildPriceMatrix(rules: PricingRules, selections?: Selections, options?: BuildPriceMatrixOptions): PriceMatrix | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Round `value` to `dp` decimal places using decimal half-even (round half to
|
|
3
|
+
* even / banker's rounding) so it mirrors the server's `Decimal(round(x, n))`.
|
|
4
|
+
*
|
|
5
|
+
* This intentionally matches Python's *decimal* half-even behaviour, NOT Python
|
|
6
|
+
* float `round()` (e.g. `roundHalfEven(2.675, 2) === 2.68`, whereas float
|
|
7
|
+
* `round(2.675, 2)` yields 2.67).
|
|
8
|
+
*
|
|
9
|
+
* Targeted at the money domain: small magnitudes and `dp <= 3`. The `EPS`
|
|
10
|
+
* half-detection tolerance is tuned for that domain and is not intended for
|
|
11
|
+
* arbitrary large magnitudes or high precision.
|
|
12
|
+
*/
|
|
13
|
+
export declare function roundHalfEven(value: number, dp: number): number;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
export interface DiscountTier {
|
|
2
|
+
lowerLimit: number;
|
|
3
|
+
amount: number;
|
|
4
|
+
}
|
|
5
|
+
export interface DiscountGroup {
|
|
6
|
+
groupRestricted: boolean;
|
|
7
|
+
discounts: DiscountTier[];
|
|
8
|
+
}
|
|
9
|
+
export interface PricingOption {
|
|
10
|
+
id: number;
|
|
11
|
+
originalId: number | null;
|
|
12
|
+
position: number;
|
|
13
|
+
default: boolean;
|
|
14
|
+
available?: boolean;
|
|
15
|
+
variationCost: number;
|
|
16
|
+
variationUnitCost: number;
|
|
17
|
+
variationCostDiscountGroup: DiscountGroup | null;
|
|
18
|
+
variationUnitCostDiscountGroup: DiscountGroup | null;
|
|
19
|
+
selectedBy: number[];
|
|
20
|
+
}
|
|
21
|
+
export interface PricingField {
|
|
22
|
+
id: number;
|
|
23
|
+
originalId: number | null;
|
|
24
|
+
position: number;
|
|
25
|
+
fieldType: number;
|
|
26
|
+
independent: boolean;
|
|
27
|
+
isSelectable: boolean;
|
|
28
|
+
selectedBy: number[];
|
|
29
|
+
variationCost: number;
|
|
30
|
+
variationUnitCost: number;
|
|
31
|
+
variationCostDiscountGroup: DiscountGroup | null;
|
|
32
|
+
variationUnitCostDiscountGroup: DiscountGroup | null;
|
|
33
|
+
/** Area field (type 14): once-off and per-edge unit costs. */
|
|
34
|
+
areaUnit?: 'mm' | 'cm' | 'm' | string;
|
|
35
|
+
heightVariationCost?: number;
|
|
36
|
+
heightVariationUnitCost?: number;
|
|
37
|
+
widthVariationCost?: number;
|
|
38
|
+
widthVariationUnitCost?: number;
|
|
39
|
+
heightVariationCostDiscountGroup?: DiscountGroup | null;
|
|
40
|
+
heightVariationUnitCostDiscountGroup?: DiscountGroup | null;
|
|
41
|
+
widthVariationCostDiscountGroup?: DiscountGroup | null;
|
|
42
|
+
widthVariationUnitCostDiscountGroup?: DiscountGroup | null;
|
|
43
|
+
/** Colour extract (fieldType 13): per selected colour, not a static option. */
|
|
44
|
+
colourVariationCost?: number;
|
|
45
|
+
colourVariationUnitCost?: number;
|
|
46
|
+
colourVariationCostDiscountGroup?: DiscountGroup | null;
|
|
47
|
+
colourVariationUnitCostDiscountGroup?: DiscountGroup | null;
|
|
48
|
+
/** Embroidery (fieldType 16): per 1,000 stitches, plus the per-colour rates. */
|
|
49
|
+
embroideryInputMode?: 'text' | 'file' | string;
|
|
50
|
+
stitchDensity?: number;
|
|
51
|
+
averageStitchLengthMm?: number;
|
|
52
|
+
stitchVariationCost?: number;
|
|
53
|
+
stitchVariationUnitCost?: number;
|
|
54
|
+
stitchVariationCostDiscountGroup?: DiscountGroup | null;
|
|
55
|
+
stitchVariationUnitCostDiscountGroup?: DiscountGroup | null;
|
|
56
|
+
options: PricingOption[];
|
|
57
|
+
}
|
|
58
|
+
export interface PricingRules {
|
|
59
|
+
currency: string;
|
|
60
|
+
taxPercent: number;
|
|
61
|
+
product: {
|
|
62
|
+
unitPrice: number;
|
|
63
|
+
minimumPrice: number | null;
|
|
64
|
+
/** Product-level setup fee. Applied once to the job, or once per
|
|
65
|
+
* non-empty variation group when setupPerGroup is true. */
|
|
66
|
+
setupPrice?: number;
|
|
67
|
+
setupPerGroup?: boolean;
|
|
68
|
+
discountGroup: DiscountGroup | null;
|
|
69
|
+
};
|
|
70
|
+
fields: PricingField[];
|
|
71
|
+
groupFields: PricingField[];
|
|
72
|
+
hasGroups: boolean;
|
|
73
|
+
needsInventory?: boolean;
|
|
74
|
+
inventoryUnits?: InventoryUnit[];
|
|
75
|
+
unsupported?: string;
|
|
76
|
+
}
|
|
77
|
+
export interface InventoryUnit {
|
|
78
|
+
optionIds: number[];
|
|
79
|
+
quantity: number;
|
|
80
|
+
}
|
|
81
|
+
export interface FieldSelection {
|
|
82
|
+
selectedOptionIds?: number[];
|
|
83
|
+
value?: string | number | null;
|
|
84
|
+
/** Colour extract: number of chosen colours when ids are not in the rules. */
|
|
85
|
+
colourCount?: number;
|
|
86
|
+
/** Colour extract: an artwork file is attached, even if no colour was kept. */
|
|
87
|
+
hasFiles?: boolean;
|
|
88
|
+
/** Embroidery: fraction of the size box that is ink. */
|
|
89
|
+
coverage?: number;
|
|
90
|
+
}
|
|
91
|
+
export interface GroupSelection {
|
|
92
|
+
quantity: number;
|
|
93
|
+
fieldValues: Record<number, FieldSelection>;
|
|
94
|
+
}
|
|
95
|
+
export interface Selections {
|
|
96
|
+
quantity?: number;
|
|
97
|
+
fieldValues: Record<number, FieldSelection>;
|
|
98
|
+
groups?: GroupSelection[];
|
|
99
|
+
}
|
|
100
|
+
export interface QuoteResult {
|
|
101
|
+
costPerUnit: number;
|
|
102
|
+
cost: number;
|
|
103
|
+
taxAmount: number;
|
|
104
|
+
totalCost: number;
|
|
105
|
+
groupCosts: number[];
|
|
106
|
+
currency: string;
|
|
107
|
+
}
|
|
108
|
+
export interface UnsupportedResult {
|
|
109
|
+
unsupported: string;
|
|
110
|
+
}
|
|
111
|
+
export interface PriceMatrixBand {
|
|
112
|
+
/** Inclusive lower quantity used to quote this column. */
|
|
113
|
+
quantity: number;
|
|
114
|
+
/** Inclusive upper quantity, or null for an open-ended last band. */
|
|
115
|
+
upperLimit: number | null;
|
|
116
|
+
/** Buyer-facing range, e.g. "1–49" or "100+". */
|
|
117
|
+
label: string;
|
|
118
|
+
}
|
|
119
|
+
export interface PriceMatrixCell {
|
|
120
|
+
quantity: number;
|
|
121
|
+
costPerUnit: number;
|
|
122
|
+
/** Ex-tax cost ÷ quantity (variation unit costs + amortized setup). */
|
|
123
|
+
unitPrice: number;
|
|
124
|
+
cost: number;
|
|
125
|
+
taxAmount: number;
|
|
126
|
+
totalCost: number;
|
|
127
|
+
}
|
|
128
|
+
export interface PriceMatrix {
|
|
129
|
+
currency: string;
|
|
130
|
+
taxPercent: number;
|
|
131
|
+
bands: PriceMatrixBand[];
|
|
132
|
+
cells: PriceMatrixCell[];
|
|
133
|
+
}
|
|
134
|
+
export interface BuildPriceMatrixOptions {
|
|
135
|
+
/** Floor quantity for the first band (product MOQ). Defaults to 1. */
|
|
136
|
+
minQuantity?: number;
|
|
137
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { ErrorType } from './constants/errors.js';
|
|
2
|
+
export interface RequestOptions extends RequestInit {
|
|
3
|
+
query?: string[][];
|
|
4
|
+
}
|
|
5
|
+
export interface ApiErrorDetails {
|
|
6
|
+
/**
|
|
7
|
+
* The json_name of the missing / disallowed related entity type
|
|
8
|
+
* (e.g. 'file', 'product', 'domain').
|
|
9
|
+
*/
|
|
10
|
+
relation?: string;
|
|
11
|
+
/**
|
|
12
|
+
* The json_name of the parent entity the relation was being
|
|
13
|
+
* attached to (e.g. 'variation', 'job').
|
|
14
|
+
*/
|
|
15
|
+
parentType?: string;
|
|
16
|
+
/**
|
|
17
|
+
* The id the client supplied for the missing / disallowed entity.
|
|
18
|
+
* May be a numeric id as a number, or a string id depending on
|
|
19
|
+
* the model.
|
|
20
|
+
*/
|
|
21
|
+
id?: number | string;
|
|
22
|
+
/**
|
|
23
|
+
* The form-data index the client sent the entity under (i.e. the
|
|
24
|
+
* ``N`` in ``parent-N-id``).
|
|
25
|
+
*/
|
|
26
|
+
index?: number;
|
|
27
|
+
/**
|
|
28
|
+
* The fields the client sent for the missing entity, with noisy
|
|
29
|
+
* keys (signed URLs, their expiries) stripped and long string
|
|
30
|
+
* values truncated. Useful when debugging uploads where the
|
|
31
|
+
* client knows the uploadId but the server has no matching row.
|
|
32
|
+
*/
|
|
33
|
+
provided?: {
|
|
34
|
+
[key: string]: any;
|
|
35
|
+
};
|
|
36
|
+
[key: string]: any;
|
|
37
|
+
}
|
|
38
|
+
export declare class ApiError extends Error {
|
|
39
|
+
statusCode?: number;
|
|
40
|
+
errorCode?: ErrorType;
|
|
41
|
+
errorMessage: string;
|
|
42
|
+
/**
|
|
43
|
+
* Structured context the API may include alongside the error
|
|
44
|
+
* message (e.g. the missing entity id and payload echo). Present
|
|
45
|
+
* only when the backend chooses to populate it - most error
|
|
46
|
+
* responses still carry just ``statusCode``, ``errorCode`` and
|
|
47
|
+
* ``message``.
|
|
48
|
+
*/
|
|
49
|
+
details?: ApiErrorDetails;
|
|
50
|
+
original: any;
|
|
51
|
+
constructor(err: any);
|
|
52
|
+
}
|
|
53
|
+
export declare const version = "v6";
|
|
54
|
+
export declare function backendFetch(baseUrl: string, resource: string, options?: RequestOptions): Promise<Response>;
|
|
55
|
+
export declare function apiFetch(baseUrl: string, resource: string, options?: RequestOptions, expectEmptyResponse?: boolean): Promise<any>;
|
|
56
|
+
export declare function apiFetchWithProgress(baseUrl: string, resource: string, options?: RequestOptions, progressCallback?: (progress: number) => void): Promise<any>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/toasts.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Merchi } from './merchi.js';
|
|
2
|
+
import { NotificationSection } from './constants/notification_sections.js';
|
|
3
|
+
import { NotificationType } from './constants/notification_types.js';
|
|
4
|
+
interface RelatedObj {
|
|
5
|
+
id: number;
|
|
6
|
+
type: string;
|
|
7
|
+
}
|
|
8
|
+
interface ToastOptions {
|
|
9
|
+
entities: RelatedObj[];
|
|
10
|
+
sections: NotificationSection[];
|
|
11
|
+
notificationTypes?: Record<NotificationType, boolean>;
|
|
12
|
+
}
|
|
13
|
+
export declare const toastNotifications: (merchi: Merchi, options: ToastOptions) => Promise<any>;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function kahanSum(values: Iterable<number>): number;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getQueryStringValue(name: string): string | undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const isUndefinedOrNull: (value: any) => boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|