@merchi/sdk 1.42.14 → 1.42.16

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.
Files changed (266) hide show
  1. package/dist/constants/auto_assign_production_on_actions.d.ts +6 -0
  2. package/dist/constants/call_to_actions.d.ts +14 -0
  3. package/dist/constants/call_to_actions.test.d.ts +1 -0
  4. package/dist/constants/discount_types.d.ts +5 -0
  5. package/dist/constants/discount_types.test.d.ts +1 -0
  6. package/dist/constants/domain_types.d.ts +12 -0
  7. package/dist/constants/domain_types.test.d.ts +1 -0
  8. package/dist/constants/errors.d.ts +26 -0
  9. package/dist/constants/event_types.d.ts +5 -0
  10. package/dist/constants/event_types.test.d.ts +1 -0
  11. package/dist/constants/field_types.d.ts +18 -0
  12. package/dist/constants/field_types.js +1 -0
  13. package/dist/constants/field_types.test.d.ts +1 -0
  14. package/dist/constants/index.d.ts +25 -0
  15. package/dist/constants/input_types.d.ts +13 -0
  16. package/dist/constants/input_types.test.d.ts +1 -0
  17. package/dist/constants/inventory_status.test.d.ts +1 -0
  18. package/dist/constants/inventory_statuses.d.ts +6 -0
  19. package/dist/constants/invoice_types.d.ts +5 -0
  20. package/dist/constants/invoice_types.test.d.ts +1 -0
  21. package/dist/constants/item_types.d.ts +5 -0
  22. package/dist/constants/item_types.test.d.ts +1 -0
  23. package/dist/constants/job/drafting_status.d.ts +7 -0
  24. package/dist/constants/job/drafting_status.test.d.ts +1 -0
  25. package/dist/constants/job/payment_status.d.ts +7 -0
  26. package/dist/constants/job/payment_status.test.d.ts +1 -0
  27. package/dist/constants/job/production_status.d.ts +12 -0
  28. package/dist/constants/job/production_status.test.d.ts +1 -0
  29. package/dist/constants/job/shipment_status.d.ts +11 -0
  30. package/dist/constants/job/shipment_status.test.d.ts +1 -0
  31. package/dist/constants/job/supply_chain_request_status.d.ts +6 -0
  32. package/dist/constants/job/supply_chain_request_status.test.d.ts +1 -0
  33. package/dist/constants/job_priorities.d.ts +6 -0
  34. package/dist/constants/job_priorities.test.d.ts +1 -0
  35. package/dist/constants/job_status.d.ts +45 -0
  36. package/dist/constants/job_status.test.d.ts +1 -0
  37. package/dist/constants/job_types.d.ts +16 -0
  38. package/dist/constants/job_types.test.d.ts +1 -0
  39. package/dist/constants/notification_sections.d.ts +13 -0
  40. package/dist/constants/notification_sections.test.d.ts +1 -0
  41. package/dist/constants/notification_types.d.ts +101 -0
  42. package/dist/constants/notification_types.test.d.ts +1 -0
  43. package/dist/constants/notification_urgencies.d.ts +6 -0
  44. package/dist/constants/notification_urgencies.test.d.ts +1 -0
  45. package/dist/constants/payment_types.d.ts +10 -0
  46. package/dist/constants/payment_types.test.d.ts +1 -0
  47. package/dist/constants/platform.d.ts +5 -0
  48. package/dist/constants/platform.test.d.ts +1 -0
  49. package/dist/constants/product_types.d.ts +26 -0
  50. package/dist/constants/product_types.test.d.ts +1 -0
  51. package/dist/constants/rights.d.ts +5 -0
  52. package/dist/constants/rights.test.d.ts +1 -0
  53. package/dist/constants/robots_meta_directives.d.ts +1 -0
  54. package/dist/constants/robots_meta_directives.test.d.ts +1 -0
  55. package/dist/constants/roles.d.ts +20 -0
  56. package/dist/constants/roles.test.d.ts +1 -0
  57. package/dist/constants/shipment_companies.d.ts +19 -0
  58. package/dist/constants/shipment_companies.test.d.ts +1 -0
  59. package/dist/constants/shipment_services.d.ts +3 -0
  60. package/dist/constants/shipment_services.test.d.ts +1 -0
  61. package/dist/constants/system_roles.d.ts +3 -0
  62. package/dist/constants/system_roles.test.d.ts +1 -0
  63. package/dist/constants/theme_status.d.ts +5 -0
  64. package/dist/constants/theme_status.test.d.ts +1 -0
  65. package/dist/constants/user_types.d.ts +17 -0
  66. package/dist/constants/user_types.test.d.ts +1 -0
  67. package/dist/constants/white_label_accessibilities.d.ts +5 -0
  68. package/dist/constants/white_label_accessibilities.test.d.ts +1 -0
  69. package/dist/cookie.d.ts +1 -0
  70. package/dist/cookie.test.d.ts +1 -0
  71. package/dist/entities/address.d.ts +30 -0
  72. package/dist/entities/address.test.d.ts +1 -0
  73. package/dist/entities/agent_conversation.d.ts +18 -0
  74. package/dist/entities/agent_conversation.test.d.ts +1 -0
  75. package/dist/entities/agent_skill.d.ts +33 -0
  76. package/dist/entities/agent_skill.test.d.ts +1 -0
  77. package/dist/entities/agent_skill_approval.d.ts +13 -0
  78. package/dist/entities/agent_skill_version.d.ts +18 -0
  79. package/dist/entities/agent_token_analytics.d.ts +50 -0
  80. package/dist/entities/agent_token_usage.d.ts +31 -0
  81. package/dist/entities/agent_token_usage.test.d.ts +1 -0
  82. package/dist/entities/assignment.d.ts +40 -0
  83. package/dist/entities/assignment.test.d.ts +1 -0
  84. package/dist/entities/automatic_payment_relationship.d.ts +14 -0
  85. package/dist/entities/automatic_payment_relationship.test.d.ts +1 -0
  86. package/dist/entities/bank.d.ts +20 -0
  87. package/dist/entities/bank.test.d.ts +1 -0
  88. package/dist/entities/cart.d.ts +50 -0
  89. package/dist/entities/cart.test.d.ts +1 -0
  90. package/dist/entities/cart_item.d.ts +33 -0
  91. package/dist/entities/cart_item.test.d.ts +1 -0
  92. package/dist/entities/cart_shipment_group.d.ts +12 -0
  93. package/dist/entities/cart_shipment_quote.d.ts +16 -0
  94. package/dist/entities/category.d.ts +26 -0
  95. package/dist/entities/category.test.d.ts +1 -0
  96. package/dist/entities/company.d.ts +137 -0
  97. package/dist/entities/company.test.d.ts +1 -0
  98. package/dist/entities/company_invitation.d.ts +16 -0
  99. package/dist/entities/company_invitation.test.d.ts +1 -0
  100. package/dist/entities/country_tax.d.ts +20 -0
  101. package/dist/entities/country_tax.test.d.ts +1 -0
  102. package/dist/entities/discount.d.ts +19 -0
  103. package/dist/entities/discount.test.d.ts +1 -0
  104. package/dist/entities/discount_group.d.ts +20 -0
  105. package/dist/entities/discount_group.test.d.ts +1 -0
  106. package/dist/entities/domain.d.ts +629 -0
  107. package/dist/entities/domain.test.d.ts +1 -0
  108. package/dist/entities/domain_chat_settings.d.ts +33 -0
  109. package/dist/entities/domain_chat_settings.test.d.ts +1 -0
  110. package/dist/entities/domain_invitation.d.ts +17 -0
  111. package/dist/entities/domain_invitation.test.d.ts +1 -0
  112. package/dist/entities/domain_tag.d.ts +21 -0
  113. package/dist/entities/domain_tag.test.d.ts +1 -0
  114. package/dist/entities/draft.d.ts +31 -0
  115. package/dist/entities/draft.test.d.ts +1 -0
  116. package/dist/entities/draft_comment.d.ts +28 -0
  117. package/dist/entities/draft_comment.test.d.ts +1 -0
  118. package/dist/entities/draft_preview.d.ts +18 -0
  119. package/dist/entities/draft_preview.test.d.ts +1 -0
  120. package/dist/entities/draft_preview_layer.d.ts +12 -0
  121. package/dist/entities/draft_preview_layer.test.d.ts +1 -0
  122. package/dist/entities/draft_template.d.ts +31 -0
  123. package/dist/entities/draft_template.js +8 -0
  124. package/dist/entities/draft_template.test.d.ts +1 -0
  125. package/dist/entities/email_address.d.ts +13 -0
  126. package/dist/entities/email_address.test.d.ts +1 -0
  127. package/dist/entities/email_counter.d.ts +11 -0
  128. package/dist/entities/email_counter.test.d.ts +1 -0
  129. package/dist/entities/enrolled_domain.d.ts +16 -0
  130. package/dist/entities/enrolled_domain.test.d.ts +1 -0
  131. package/dist/entities/exchange_rate.d.ts +11 -0
  132. package/dist/entities/exchange_rate.test.d.ts +1 -0
  133. package/dist/entities/file.d.ts +65 -0
  134. package/dist/entities/file.test.d.ts +1 -0
  135. package/dist/entities/internal_tag.d.ts +26 -0
  136. package/dist/entities/internal_tag.test.d.ts +1 -0
  137. package/dist/entities/inventory.d.ts +27 -0
  138. package/dist/entities/inventory.test.d.ts +1 -0
  139. package/dist/entities/inventory_group.d.ts +19 -0
  140. package/dist/entities/inventory_group.test.d.ts +1 -0
  141. package/dist/entities/inventory_unit_variation.d.ts +13 -0
  142. package/dist/entities/inventory_unit_variation.test.d.ts +1 -0
  143. package/dist/entities/invoice.d.ts +80 -0
  144. package/dist/entities/invoice.test.d.ts +1 -0
  145. package/dist/entities/item.d.ts +24 -0
  146. package/dist/entities/item.test.d.ts +1 -0
  147. package/dist/entities/job.d.ts +156 -0
  148. package/dist/entities/job.test.d.ts +1 -0
  149. package/dist/entities/job_comment.d.ts +24 -0
  150. package/dist/entities/job_comment.test.d.ts +1 -0
  151. package/dist/entities/job_note.d.ts +19 -0
  152. package/dist/entities/job_operation_log.d.ts +18 -0
  153. package/dist/entities/job_operation_log.test.d.ts +1 -0
  154. package/dist/entities/matching_inventory.d.ts +16 -0
  155. package/dist/entities/notification.d.ts +47 -0
  156. package/dist/entities/notification.test.d.ts +1 -0
  157. package/dist/entities/payment.d.ts +28 -0
  158. package/dist/entities/payment.test.d.ts +1 -0
  159. package/dist/entities/payment_device.d.ts +14 -0
  160. package/dist/entities/payment_device.test.d.ts +1 -0
  161. package/dist/entities/phone_number.d.ts +17 -0
  162. package/dist/entities/phone_number.test.d.ts +1 -0
  163. package/dist/entities/product.d.ts +148 -0
  164. package/dist/entities/product.test.d.ts +1 -0
  165. package/dist/entities/product_form.d.ts +22 -0
  166. package/dist/entities/product_form_version.d.ts +20 -0
  167. package/dist/entities/product_review.d.ts +74 -0
  168. package/dist/entities/production_comment.d.ts +24 -0
  169. package/dist/entities/production_comment.test.d.ts +1 -0
  170. package/dist/entities/quote.d.ts +29 -0
  171. package/dist/entities/quote.test.d.ts +1 -0
  172. package/dist/entities/quote_item.d.ts +24 -0
  173. package/dist/entities/quote_item.test.d.ts +1 -0
  174. package/dist/entities/reminder.d.ts +35 -0
  175. package/dist/entities/reminder.test.d.ts +1 -0
  176. package/dist/entities/session.d.ts +15 -0
  177. package/dist/entities/session.test.d.ts +1 -0
  178. package/dist/entities/shipment.d.ts +76 -0
  179. package/dist/entities/shipment.test.d.ts +1 -0
  180. package/dist/entities/shipment_item.d.ts +10 -0
  181. package/dist/entities/shipment_item.test.d.ts +1 -0
  182. package/dist/entities/shipment_item_fulfillment.d.ts +10 -0
  183. package/dist/entities/shipment_item_fulfillment.test.d.ts +1 -0
  184. package/dist/entities/shipment_log.d.ts +15 -0
  185. package/dist/entities/shipment_method.d.ts +28 -0
  186. package/dist/entities/shipment_method.test.d.ts +1 -0
  187. package/dist/entities/shipment_method_variation.d.ts +18 -0
  188. package/dist/entities/shipment_method_variation.test.d.ts +1 -0
  189. package/dist/entities/short_url.d.ts +17 -0
  190. package/dist/entities/short_url.test.d.ts +1 -0
  191. package/dist/entities/subscription_plan.d.ts +30 -0
  192. package/dist/entities/subscription_plan.test.d.ts +1 -0
  193. package/dist/entities/supply_domain.d.ts +14 -0
  194. package/dist/entities/supply_domain.test.d.ts +1 -0
  195. package/dist/entities/support_conversation.d.ts +30 -0
  196. package/dist/entities/support_conversation.test.d.ts +1 -0
  197. package/dist/entities/support_message.d.ts +15 -0
  198. package/dist/entities/support_message.test.d.ts +1 -0
  199. package/dist/entities/system_role.d.ts +10 -0
  200. package/dist/entities/system_role.test.d.ts +1 -0
  201. package/dist/entities/theme.d.ts +26 -0
  202. package/dist/entities/theme.test.d.ts +1 -0
  203. package/dist/entities/theme_css_setting.d.ts +12 -0
  204. package/dist/entities/theme_css_setting.test.d.ts +1 -0
  205. package/dist/entities/user.d.ts +142 -0
  206. package/dist/entities/user.test.d.ts +1 -0
  207. package/dist/entities/user_company.d.ts +14 -0
  208. package/dist/entities/user_company.test.d.ts +1 -0
  209. package/dist/entities/variation.d.ts +29 -0
  210. package/dist/entities/variation.test.d.ts +1 -0
  211. package/dist/entities/variation_field.d.ts +87 -0
  212. package/dist/entities/variation_field.js +33 -0
  213. package/dist/entities/variation_field.test.d.ts +1 -0
  214. package/dist/entities/variation_fields_option.d.ts +36 -0
  215. package/dist/entities/variation_fields_option.js +4 -0
  216. package/dist/entities/variation_fields_option.test.d.ts +1 -0
  217. package/dist/entities/variation_option.d.ts +23 -0
  218. package/dist/entities/variation_option.test.d.ts +1 -0
  219. package/dist/entities/variations_group.d.ts +20 -0
  220. package/dist/entities/variations_group.test.d.ts +1 -0
  221. package/dist/entity.d.ts +208 -0
  222. package/dist/entity.js +6 -4
  223. package/dist/index.d.ts +88 -0
  224. package/dist/merchi.d.ts +179 -0
  225. package/dist/merchi.test.d.ts +1 -0
  226. package/dist/pricing/discount.d.ts +2 -0
  227. package/dist/pricing/discount.test.d.ts +1 -0
  228. package/dist/pricing/estimate.d.ts +2 -0
  229. package/dist/pricing/estimate.js +56 -0
  230. package/dist/pricing/estimate.test.d.ts +1 -0
  231. package/dist/pricing/estimate.test.js +81 -0
  232. package/dist/pricing/golden.test.d.ts +1 -0
  233. package/dist/pricing/index.d.ts +7 -0
  234. package/dist/pricing/index.test.d.ts +1 -0
  235. package/dist/pricing/inventory.d.ts +2 -0
  236. package/dist/pricing/inventory.test.d.ts +1 -0
  237. package/dist/pricing/matrix.d.ts +10 -0
  238. package/dist/pricing/matrix.test.d.ts +1 -0
  239. package/dist/pricing/round.d.ts +13 -0
  240. package/dist/pricing/round.test.d.ts +1 -0
  241. package/dist/pricing/types.d.ts +137 -0
  242. package/dist/pricing/visibility.d.ts +3 -0
  243. package/dist/pricing/visibility.test.d.ts +1 -0
  244. package/dist/request.d.ts +56 -0
  245. package/dist/request.test.d.ts +1 -0
  246. package/dist/test_util.d.ts +3 -0
  247. package/dist/toasts.d.ts +14 -0
  248. package/dist/toasts.test.d.ts +1 -0
  249. package/dist/util/float.d.ts +1 -0
  250. package/dist/util/index.d.ts +3 -0
  251. package/dist/util/query_string.d.ts +1 -0
  252. package/dist/util/query_string.test.d.ts +1 -0
  253. package/dist/util/validation.d.ts +1 -0
  254. package/dist/util/validation.test.d.ts +1 -0
  255. package/dist/uuid.d.ts +1 -0
  256. package/dist/uuid.test.d.ts +1 -0
  257. package/package.json +2 -1
  258. package/src/constants/field_types.ts +1 -0
  259. package/src/entities/draft_template.ts +6 -0
  260. package/src/entities/variation_field.ts +25 -0
  261. package/src/entities/variation_fields_option.ts +3 -0
  262. package/src/entity.ts +6 -5
  263. package/src/pricing/estimate.test.ts +95 -0
  264. package/src/pricing/estimate.ts +73 -0
  265. package/src/pricing/types.ts +10 -0
  266. package/tsconfig.json +1 -0
@@ -0,0 +1,29 @@
1
+ import { CartItem } from './cart_item.js';
2
+ import { Entity } from '../entity.js';
3
+ import { MerchiFile } from './file.js';
4
+ import { Job } from './job.js';
5
+ import { VariationField } from './variation_field.js';
6
+ import { VariationOption } from './variation_option.js';
7
+ import { VariationsGroup } from './variations_group.js';
8
+ export declare class Variation extends Entity {
9
+ protected static resourceName: string;
10
+ protected static singularName: string;
11
+ protected static pluralName: string;
12
+ archived?: Date | null;
13
+ id?: number;
14
+ value?: string | null;
15
+ currency?: string;
16
+ cost?: number;
17
+ quantity?: number;
18
+ onceOffCost?: number;
19
+ unitCost?: number;
20
+ unitCostTotal?: number;
21
+ isVisible?: boolean;
22
+ variationField?: VariationField;
23
+ variationsGroup?: VariationsGroup | null;
24
+ job?: Job | null;
25
+ cartItem?: CartItem | null;
26
+ variationFiles?: MerchiFile[];
27
+ selectedOptions?: VariationOption[];
28
+ selectableOptions?: VariationOption[];
29
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,87 @@
1
+ import { DiscountGroup } from './discount_group.js';
2
+ import { Entity } from '../entity.js';
3
+ import { InventoryGroup } from './inventory_group.js';
4
+ import { Product } from './product.js';
5
+ import { Variation } from './variation.js';
6
+ import { VariationFieldsOption } from './variation_fields_option.js';
7
+ import { FieldType } from '../constants/field_types.js';
8
+ export declare class VariationField extends Entity {
9
+ protected static resourceName: string;
10
+ protected static singularName: string;
11
+ protected static pluralName: string;
12
+ archived?: Date | null;
13
+ id?: number;
14
+ position?: number;
15
+ /** Columns this field spans. Null is the full width of its list. */
16
+ layoutSpan?: number | null;
17
+ required?: boolean;
18
+ independent?: boolean;
19
+ name?: string;
20
+ instructions?: string;
21
+ placeholder?: string | null;
22
+ defaultValue?: string;
23
+ currency?: string;
24
+ fieldType?: FieldType;
25
+ margin?: number;
26
+ variationCost?: number;
27
+ variationCostDiscountGroup?: DiscountGroup | null;
28
+ variationUnitCost?: number;
29
+ buyUnitCost?: number;
30
+ buyCost?: number;
31
+ variationUnitCostDiscountGroup?: DiscountGroup | null;
32
+ rows?: number;
33
+ fieldMin?: number | null;
34
+ fieldMax?: number | null;
35
+ allowDecimal?: boolean;
36
+ allowAllPantones?: boolean;
37
+ isHtml?: boolean;
38
+ considerBusinessHours?: boolean;
39
+ shippingTimeIncluded?: boolean;
40
+ sellerProductEditable?: boolean;
41
+ multipleSelect?: boolean;
42
+ showFilePreview?: boolean;
43
+ allowFileMultiple?: boolean;
44
+ allowFileJpeg?: boolean;
45
+ allowFileGif?: boolean;
46
+ allowFilePdf?: boolean;
47
+ allowFilePng?: boolean;
48
+ allowFileAi?: boolean;
49
+ maxColours?: number;
50
+ simplifyColours?: boolean;
51
+ colourVariationCost?: number;
52
+ colourVariationCostDiscountGroup?: DiscountGroup | null;
53
+ colourVariationUnitCost?: number;
54
+ colourVariationUnitCostDiscountGroup?: DiscountGroup | null;
55
+ heightVariationCost?: number;
56
+ heightVariationCostDiscountGroup?: DiscountGroup | null;
57
+ heightVariationUnitCost?: number;
58
+ heightVariationUnitCostDiscountGroup?: DiscountGroup | null;
59
+ widthVariationCost?: number;
60
+ widthVariationCostDiscountGroup?: DiscountGroup | null;
61
+ widthVariationUnitCost?: number;
62
+ widthVariationUnitCostDiscountGroup?: DiscountGroup | null;
63
+ heightFieldMin?: number | null;
64
+ heightFieldMax?: number | null;
65
+ widthFieldMin?: number | null;
66
+ widthFieldMax?: number | null;
67
+ areaUnit?: string;
68
+ areaInputType?: string;
69
+ areaStep?: number | null;
70
+ aspectRatioLock?: boolean;
71
+ aspectRatio?: number | null;
72
+ embroideryInputMode?: string;
73
+ stitchDensity?: number;
74
+ averageStitchLengthMm?: number;
75
+ stitchVariationCost?: number;
76
+ stitchVariationCostDiscountGroup?: DiscountGroup | null;
77
+ stitchVariationUnitCost?: number;
78
+ stitchVariationUnitCostDiscountGroup?: DiscountGroup | null;
79
+ product?: Product;
80
+ selectedBy?: VariationFieldsOption[];
81
+ inventoryGroup?: InventoryGroup;
82
+ linkedInventoryGroup?: InventoryGroup;
83
+ variations?: Variation[];
84
+ options?: VariationFieldsOption[];
85
+ isSelectable: () => boolean;
86
+ buildEmptyVariation: () => Variation;
87
+ }
@@ -86,6 +86,11 @@ var VariationField = /** @class */ (function (_super) {
86
86
  result.value = _this.defaultValue;
87
87
  result.onceOffCost = 0;
88
88
  }
89
+ else if (_this.fieldType === FieldType.EMBROIDERY) {
90
+ result.value = '';
91
+ result.onceOffCost = 0;
92
+ result.variationFiles = [];
93
+ }
89
94
  else if (_this.isSelectable()) {
90
95
  var onceOffCost = 0;
91
96
  var value = [];
@@ -369,6 +374,34 @@ var VariationField = /** @class */ (function (_super) {
369
374
  VariationField.property({ type: Number }),
370
375
  __metadata("design:type", Object)
371
376
  ], VariationField.prototype, "aspectRatio", void 0);
377
+ __decorate([
378
+ VariationField.property(),
379
+ __metadata("design:type", String)
380
+ ], VariationField.prototype, "embroideryInputMode", void 0);
381
+ __decorate([
382
+ VariationField.property({ type: Number }),
383
+ __metadata("design:type", Number)
384
+ ], VariationField.prototype, "stitchDensity", void 0);
385
+ __decorate([
386
+ VariationField.property({ type: Number }),
387
+ __metadata("design:type", Number)
388
+ ], VariationField.prototype, "averageStitchLengthMm", void 0);
389
+ __decorate([
390
+ VariationField.property(),
391
+ __metadata("design:type", Number)
392
+ ], VariationField.prototype, "stitchVariationCost", void 0);
393
+ __decorate([
394
+ VariationField.property({ type: 'DiscountGroup' }),
395
+ __metadata("design:type", Object)
396
+ ], VariationField.prototype, "stitchVariationCostDiscountGroup", void 0);
397
+ __decorate([
398
+ VariationField.property(),
399
+ __metadata("design:type", Number)
400
+ ], VariationField.prototype, "stitchVariationUnitCost", void 0);
401
+ __decorate([
402
+ VariationField.property({ type: 'DiscountGroup' }),
403
+ __metadata("design:type", Object)
404
+ ], VariationField.prototype, "stitchVariationUnitCostDiscountGroup", void 0);
372
405
  __decorate([
373
406
  VariationField.property(),
374
407
  __metadata("design:type", Product)
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,36 @@
1
+ import { DiscountGroup } from './discount_group.js';
2
+ import { Entity } from '../entity.js';
3
+ import { MerchiFile } from './file.js';
4
+ import { InventoryUnitVariation } from './inventory_unit_variation.js';
5
+ import { Variation } from './variation.js';
6
+ import { VariationField } from './variation_field.js';
7
+ export declare class VariationFieldsOption extends Entity {
8
+ protected static resourceName: string;
9
+ protected static singularName: string;
10
+ protected static pluralName: string;
11
+ archived?: Date | null;
12
+ id?: number;
13
+ value?: string | null;
14
+ colour?: string | null;
15
+ isExtracted?: boolean;
16
+ currency?: string;
17
+ default?: boolean;
18
+ include?: boolean;
19
+ noInventory?: boolean;
20
+ position?: number;
21
+ deliveryDays?: number;
22
+ variationCost?: number;
23
+ variationCostDiscountGroup?: DiscountGroup | null;
24
+ variationUnitCost?: number;
25
+ buyUnitCost?: number;
26
+ buyCost?: number;
27
+ variationUnitCostDiscountGroup?: DiscountGroup | null;
28
+ variationField?: VariationField | null;
29
+ linkedFile?: MerchiFile | null;
30
+ linkedProductImage?: MerchiFile | null;
31
+ selectedByVariations?: Variation[];
32
+ inventoryUnitVariations?: InventoryUnitVariation[];
33
+ selectedBy?: VariationFieldsOption[];
34
+ totalCost: (quantity: number) => number;
35
+ buildVariationOption: () => import("./variation_option.js").VariationOption;
36
+ }
@@ -136,6 +136,10 @@ var VariationFieldsOption = /** @class */ (function (_super) {
136
136
  VariationFieldsOption.property({ type: MerchiFile }),
137
137
  __metadata("design:type", Object)
138
138
  ], VariationFieldsOption.prototype, "linkedFile", void 0);
139
+ __decorate([
140
+ VariationFieldsOption.property({ type: MerchiFile }),
141
+ __metadata("design:type", Object)
142
+ ], VariationFieldsOption.prototype, "linkedProductImage", void 0);
139
143
  __decorate([
140
144
  VariationFieldsOption.property({ arrayType: 'Variation' }),
141
145
  __metadata("design:type", Array)
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,23 @@
1
+ import { Entity } from '../entity.js';
2
+ import { MerchiFile } from './file.js';
3
+ export declare class VariationOption extends Entity {
4
+ protected static singularName: string;
5
+ protected static pluralName: string;
6
+ optionId?: number;
7
+ value?: string | null;
8
+ colour?: string | null;
9
+ position?: number;
10
+ available?: boolean;
11
+ default?: boolean;
12
+ include?: boolean;
13
+ isVisible?: boolean;
14
+ linkedFile?: MerchiFile | null;
15
+ fieldName?: string;
16
+ userDeadline?: Date;
17
+ quantity?: number;
18
+ currency?: string;
19
+ onceOffCost?: number;
20
+ unitCost?: number;
21
+ unitCostTotal?: number;
22
+ totalCost?: number;
23
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,20 @@
1
+ import { CartItem } from './cart_item.js';
2
+ import { Entity } from '../entity.js';
3
+ import { Job } from './job.js';
4
+ import { Variation } from './variation.js';
5
+ import { MatchingInventory } from './matching_inventory.js';
6
+ export declare class VariationsGroup extends Entity {
7
+ protected static resourceName: string;
8
+ protected static singularName: string;
9
+ protected static pluralName: string;
10
+ archived?: Date | null;
11
+ id?: number;
12
+ quantity?: number;
13
+ groupCost?: number | null;
14
+ job?: Job | null;
15
+ cartItem?: CartItem | null;
16
+ matchingInventory?: MatchingInventory | null;
17
+ variations?: Variation[];
18
+ inventoryCount?: number;
19
+ inventorySufficient?: boolean;
20
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,208 @@
1
+ import 'reflect-metadata';
2
+ import { Merchi } from './merchi.js';
3
+ import { NotificationType } from './constants/notification_types.js';
4
+ import { NotificationSection } from './constants/notification_sections.js';
5
+ import { Role } from './constants/roles.js';
6
+ import { DomainType } from './constants/domain_types.js';
7
+ import { ProductType } from './constants/product_types.js';
8
+ interface Counter {
9
+ value: number;
10
+ }
11
+ interface PropertyOptions {
12
+ embeddedByDefault?: boolean;
13
+ jsonName?: string;
14
+ type?: any;
15
+ arrayType?: string;
16
+ }
17
+ export interface EmbedDescriptor {
18
+ [property: string]: {} | EmbedDescriptor;
19
+ }
20
+ export interface NestedIncludeArchivedDescriptor {
21
+ [property: string]: {} | boolean | NestedIncludeArchivedDescriptor;
22
+ }
23
+ export type IncludeArchivedDescriptor = boolean | NestedIncludeArchivedDescriptor;
24
+ interface FromJsonOptions {
25
+ arrayValueStrict?: boolean;
26
+ makeDirty?: boolean;
27
+ }
28
+ export interface CreateOptions {
29
+ withRights?: boolean;
30
+ embed?: EmbedDescriptor;
31
+ }
32
+ interface SaveOptions {
33
+ withRights?: boolean;
34
+ embed?: EmbedDescriptor;
35
+ }
36
+ interface DeleteOptions {
37
+ withRights?: boolean;
38
+ }
39
+ interface GetOptions {
40
+ embed?: EmbedDescriptor;
41
+ includeArchived?: IncludeArchivedDescriptor;
42
+ withRights?: boolean;
43
+ }
44
+ export declare enum SerialiseMethod {
45
+ TO_DICT = "to_dict",
46
+ ONLY_ID = "only_id"
47
+ }
48
+ interface ListOptions {
49
+ as?: string;
50
+ asRole?: Role;
51
+ businessDomainsOnly?: boolean;
52
+ categoryId?: number;
53
+ clientId?: number;
54
+ clientCompanyId?: number;
55
+ categories?: string[];
56
+ clientOnly?: boolean;
57
+ companyCustomerId?: number;
58
+ companyId?: number;
59
+ companySupplierId?: number;
60
+ conversationId?: number;
61
+ dateFrom?: Date;
62
+ dateTo?: Date;
63
+ domainRoles?: Role[];
64
+ domainTypes?: DomainType[];
65
+ doesNotHaveAdminDomain?: boolean;
66
+ embed?: EmbedDescriptor;
67
+ entityTypes?: number[];
68
+ exclude?: number[];
69
+ excludeDomains?: number[];
70
+ excludeJobs?: number[];
71
+ googleMerchantCenterExported?: boolean;
72
+ groupBuyForJobId?: number;
73
+ groupBuyOnly?: boolean;
74
+ inbound?: boolean;
75
+ includeOnly?: number[];
76
+ inDomain?: number;
77
+ inDomainName?: string;
78
+ inDomainRoles?: number[];
79
+ isJobManager?: boolean;
80
+ isMaster?: boolean;
81
+ isOrder?: boolean;
82
+ isPrivate?: boolean;
83
+ jobNotifiable?: number;
84
+ descendants?: number;
85
+ limit?: number;
86
+ managedDomainsOnly?: boolean;
87
+ managedOnly?: boolean;
88
+ managerId?: number;
89
+ masterProduct?: number;
90
+ memberOnly?: boolean;
91
+ merchiOnly?: boolean;
92
+ notificationSender?: number;
93
+ notificationJob?: number;
94
+ notificationRecipient?: number;
95
+ notificationType?: NotificationType;
96
+ offset?: number;
97
+ orClientId?: number;
98
+ orClientCompanyId?: number | number[];
99
+ order?: string;
100
+ originalOf?: number;
101
+ platformCategoryId?: number;
102
+ priceRange?: number[];
103
+ productTypes?: ProductType[];
104
+ publicOnly?: boolean;
105
+ isDraft?: boolean;
106
+ isTest?: boolean;
107
+ /** true = invoice fully paid, false = invoice issued but not fully paid */
108
+ invoicePaid?: boolean;
109
+ sourceChannel?: string;
110
+ q?: string;
111
+ receiverId?: number;
112
+ userAsReceiver?: number;
113
+ relatedAssignment?: number;
114
+ relatedDraft?: number;
115
+ relatedJob?: number;
116
+ relatedJobs?: number[];
117
+ relatedShipment?: number;
118
+ relatedProduct?: number;
119
+ relatedUser?: number;
120
+ savedByUser?: number;
121
+ section?: NotificationSection;
122
+ senderCompanyId?: number;
123
+ senderRole?: Role;
124
+ serialiseMethod?: SerialiseMethod;
125
+ shopifyOnly?: boolean;
126
+ sort?: string;
127
+ state?: string;
128
+ supplierResellOnly?: boolean;
129
+ tab?: string;
130
+ tags?: number[];
131
+ trackingNumber?: string;
132
+ tagsInternal?: number[];
133
+ excludeTags?: number[];
134
+ excludeTagsInternal?: number[];
135
+ tagNames?: string[];
136
+ teamOnly?: boolean;
137
+ turnaroundTimeDays?: number;
138
+ withRights?: boolean;
139
+ skipCount?: boolean;
140
+ }
141
+ export interface ListMetadata {
142
+ canCreate?: boolean;
143
+ available: number | null;
144
+ count: number;
145
+ limit: number;
146
+ offset: number;
147
+ }
148
+ export interface ListResponse<T> {
149
+ items: T[];
150
+ metadata: ListMetadata;
151
+ }
152
+ interface SerialiseOptions {
153
+ existing?: FormData;
154
+ excludeOld?: boolean;
155
+ _prefix?: string;
156
+ }
157
+ interface PropertyInfo {
158
+ property: string;
159
+ attribute: string;
160
+ type: Function;
161
+ arrayType?: Entity;
162
+ dirty: boolean;
163
+ currentValue?: any;
164
+ updatingOrder: boolean;
165
+ embeddedByDefault: boolean;
166
+ }
167
+ export declare class Entity {
168
+ private static jsonNameKey;
169
+ private static arrayTypeKey;
170
+ private static extraOptionsKey;
171
+ private static propertiesSetKey;
172
+ protected static resourceName: string;
173
+ protected static singularName: string;
174
+ protected static pluralName: string;
175
+ protected static primaryKey: string;
176
+ merchi: Merchi;
177
+ static merchi: Merchi;
178
+ isDirty: boolean;
179
+ propertiesMap: Map<string, PropertyInfo>;
180
+ readonly backObjects: Set<Entity>;
181
+ key: string;
182
+ protected isSingleEntityProperty(info: PropertyInfo): boolean;
183
+ protected static property(options?: PropertyOptions): (target: Entity, propertyKey: string) => void;
184
+ protected makePropertiesMap(): Map<any, any>;
185
+ constructor(merchi?: Merchi);
186
+ getPrimaryKeyValue: () => any;
187
+ private setupProperties;
188
+ static get<T extends typeof Entity>(this: T, key: number | string, options?: GetOptions): Promise<InstanceType<T>>;
189
+ static list<T extends typeof Entity>(this: T, options?: ListOptions): Promise<ListResponse<InstanceType<T>>>;
190
+ save: (options?: SaveOptions) => Promise<this>;
191
+ createFactory: ({ resourceName }: {
192
+ resourceName?: string | undefined;
193
+ }) => (options?: CreateOptions) => Promise<this>;
194
+ create: (options?: CreateOptions) => Promise<this>;
195
+ private getEntityClass;
196
+ cleanDirty: () => void;
197
+ fromJson: (json: any, options?: FromJsonOptions) => this;
198
+ toJson: () => any;
199
+ protected forEachProperty: (fn: (i: PropertyInfo) => void) => void;
200
+ toFormData: (options?: SerialiseOptions, fileIndex?: Counter) => FormData;
201
+ protected addBackObject: (remote?: Entity) => void;
202
+ protected addBackObjectList: (remotes?: Entity[]) => void;
203
+ updateOrder: (property: string) => void;
204
+ protected markDirty: (property: string, newValue: any) => void;
205
+ delete: (options?: DeleteOptions) => Promise<this>;
206
+ recover: (options?: SaveOptions) => Promise<this>;
207
+ }
208
+ export {};
package/dist/entity.js CHANGED
@@ -209,10 +209,12 @@ var Entity = /** @class */ (function () {
209
209
  propertyInfo.currentValue = newValue;
210
210
  }
211
211
  else if (_this.isSingleEntityProperty(propertyInfo)) {
212
- // if property already have a entity as relationship, try to merge
213
- // with json first, this behavior may need to be configurable in the
214
- // future.
215
- if (propertyInfo.currentValue) {
212
+ // null clears the link. An empty entity would omit the clear
213
+ // sentinel from toFormData, so the saved photo would stick.
214
+ if (value === null) {
215
+ propertyInfo.currentValue = null;
216
+ }
217
+ else if (propertyInfo.currentValue) {
216
218
  propertyInfo.currentValue.fromJson(value, options);
217
219
  }
218
220
  else {
@@ -0,0 +1,88 @@
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 { AgentTokenAnalyticsSummary, AgentTokenAnalyticsTimeseries, AgentTokenUsageRecordPayload, AgentTokenUsageRecordResponse, CompanyAnalyticsResponse, DomainAnalyticsResponse, ProfileAnalyticsSummaryMetric, } from './entities/agent_token_analytics.js';
5
+ import { AgentSkill } from './entities/agent_skill.js';
6
+ import { AgentSkillVersion } from './entities/agent_skill_version.js';
7
+ import { AgentSkillApproval } from './entities/agent_skill_approval.js';
8
+ import { DomainChatSettings } from './entities/domain_chat_settings.js';
9
+ import { SupportConversation } from './entities/support_conversation.js';
10
+ import { SupportMessage } from './entities/support_message.js';
11
+ import { Assignment } from './entities/assignment.js';
12
+ import { AutomaticPaymentRelationship } from './entities/automatic_payment_relationship.js';
13
+ import { Bank } from './entities/bank.js';
14
+ import { Cart } from './entities/cart.js';
15
+ import { CartItem } from './entities/cart_item.js';
16
+ import { CartShipmentGroup } from './entities/cart_shipment_group.js';
17
+ import { CartShipmentQuote } from './entities/cart_shipment_quote.js';
18
+ import { Category } from './entities/category.js';
19
+ import { Company } from './entities/company.js';
20
+ import { CompanyInvitation } from './entities/company_invitation.js';
21
+ import { ProductForm } from './entities/product_form.js';
22
+ import { ProductFormVersion } from './entities/product_form_version.js';
23
+ import { CountryTax } from './entities/country_tax.js';
24
+ import { Discount } from './entities/discount.js';
25
+ import { DiscountGroup } from './entities/discount_group.js';
26
+ import { Domain } from './entities/domain.js';
27
+ import { DomainInvitation } from './entities/domain_invitation.js';
28
+ import { DomainTag } from './entities/domain_tag.js';
29
+ import { Draft } from './entities/draft.js';
30
+ import { DraftComment } from './entities/draft_comment.js';
31
+ import { DraftTemplate } from './entities/draft_template.js';
32
+ import { EmailAddress } from './entities/email_address.js';
33
+ import { EmailCounter } from './entities/email_counter.js';
34
+ import { EnrolledDomain } from './entities/enrolled_domain.js';
35
+ import { Entity, EmbedDescriptor } from './entity.js';
36
+ import { ExchangeRate } from './entities/exchange_rate.js';
37
+ import { InternalTag } from './entities/internal_tag.js';
38
+ import { Inventory } from './entities/inventory.js';
39
+ import { InventoryUnitVariation } from './entities/inventory_unit_variation.js';
40
+ import { Invoice } from './entities/invoice.js';
41
+ import { Item } from './entities/item.js';
42
+ import { Job } from './entities/job.js';
43
+ import { JobComment } from './entities/job_comment.js';
44
+ import { JobNote } from './entities/job_note.js';
45
+ import { JobOperationLog } from './entities/job_operation_log.js';
46
+ import { MatchingInventory } from './entities/matching_inventory.js';
47
+ import { Merchi } from './merchi.js';
48
+ import { MerchiFile } from './entities/file.js';
49
+ import { Notification } from './entities/notification.js';
50
+ import { Payment } from './entities/payment.js';
51
+ import { PaymentDevice } from './entities/payment_device.js';
52
+ import { PhoneNumber } from './entities/phone_number.js';
53
+ import { Product } from './entities/product.js';
54
+ import { ProductReview } from './entities/product_review.js';
55
+ export type { ProductReviewCreateInput, ProductReviewPatchInput, } from './entities/product_review.js';
56
+ import { ProductionComment } from './entities/production_comment.js';
57
+ import { Quote } from './entities/quote.js';
58
+ import { QuoteItem } from './entities/quote_item.js';
59
+ import { Reminder } from './entities/reminder.js';
60
+ import { RequestOptions, apiFetch, apiFetchWithProgress } from './request.js';
61
+ import { Session } from './entities/session.js';
62
+ import { Shipment } from './entities/shipment.js';
63
+ import { ShipmentLog } from './entities/shipment_log.js';
64
+ import { ShipmentItem } from './entities/shipment_item.js';
65
+ import { ShipmentItemFulfillment } from './entities/shipment_item_fulfillment.js';
66
+ import { ShipmentMethod } from './entities/shipment_method.js';
67
+ import { ShipmentMethodVariation } from './entities/shipment_method_variation.js';
68
+ import { ShortUrl } from './entities/short_url.js';
69
+ import { SubscriptionPlan } from './entities/subscription_plan.js';
70
+ import { SupplyDomain } from './entities/supply_domain.js';
71
+ import { SystemRole } from './entities/system_role.js';
72
+ import { Theme } from './entities/theme.js';
73
+ import { ThemeCssSetting } from './entities/theme_css_setting.js';
74
+ import { User } from './entities/user.js';
75
+ import { UserCompany } from './entities/user_company.js';
76
+ import { Variation } from './entities/variation.js';
77
+ import { VariationField } from './entities/variation_field.js';
78
+ import { VariationFieldsOption } from './entities/variation_fields_option.js';
79
+ import { VariationOption } from './entities/variation_option.js';
80
+ import { VariationsGroup } from './entities/variations_group.js';
81
+ import { generateUUID } from './uuid.js';
82
+ import { getCookie } from './cookie.js';
83
+ import * as constants from './constants/index.js';
84
+ import * as request from './request.js';
85
+ import * as util from './util/index.js';
86
+ import * as pricing from './pricing/index.js';
87
+ import { toastNotifications } from './toasts.js';
88
+ export { constants, request, util, pricing, toastNotifications, Address, AgentConversation, AgentTokenUsage, AgentSkill, AgentSkillVersion, AgentSkillApproval, DomainChatSettings, SupportConversation, SupportMessage, Assignment, AutomaticPaymentRelationship, Bank, Cart, CartItem, CartShipmentGroup, CartShipmentQuote, Category, Company, CompanyInvitation, ProductForm, ProductFormVersion, CountryTax, Discount, DiscountGroup, Domain, DomainInvitation, DomainTag, Draft, DraftComment, DraftTemplate, EmailAddress, EmailCounter, EnrolledDomain, Entity, EmbedDescriptor, ExchangeRate, InternalTag, Inventory, InventoryUnitVariation, Invoice, Item, Job, JobComment, JobNote, JobOperationLog, MatchingInventory, Merchi, MerchiFile, Notification, Payment, PaymentDevice, PhoneNumber, Product, ProductReview, ProductionComment, Quote, QuoteItem, Reminder, RequestOptions, apiFetch, apiFetchWithProgress, Session, Shipment, ShipmentLog, ShipmentItem, ShipmentItemFulfillment, ShipmentMethod, ShipmentMethodVariation, ShortUrl, SubscriptionPlan, SupplyDomain, SystemRole, Theme, ThemeCssSetting, User, UserCompany, Variation, VariationField, VariationFieldsOption, VariationOption, VariationsGroup, generateUUID, getCookie };