@ecomiq/core 1.0.0 → 1.1.1

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 (45) hide show
  1. package/dist/client.cjs +1 -1
  2. package/dist/client.js +1 -1
  3. package/dist/index.cjs +14 -2
  4. package/dist/index.d.cts +4 -2
  5. package/dist/index.d.ts +4 -2
  6. package/dist/index.js +6 -4
  7. package/dist/models/customer-order.cjs +3 -1
  8. package/dist/models/customer-order.d.cts +45 -0
  9. package/dist/models/customer-order.d.ts +45 -0
  10. package/dist/models/customer-order.js +3 -1
  11. package/dist/models/{order-draft-PFBZfRRR.cjs → order-draft-DWKoM7Lu.cjs} +3 -1
  12. package/dist/models/{order-draft-CnHJ0btL.js → order-draft-DhEKDqI8.js} +3 -1
  13. package/dist/models/order-draft.d.cts +18 -0
  14. package/dist/models/order-draft.d.ts +18 -0
  15. package/dist/models/order-status.d.cts +9 -0
  16. package/dist/models/order-status.d.ts +9 -0
  17. package/dist/models/personalization-CdwIzzSn.js +48 -0
  18. package/dist/models/personalization-Uh_MWts-.cjs +52 -0
  19. package/dist/models/personalization-lines-BurVHB4o.cjs +26 -0
  20. package/dist/models/personalization-lines-DigNu6OK.js +23 -0
  21. package/dist/models/personalization-lines.d.cts +15 -0
  22. package/dist/models/personalization-lines.d.ts +15 -0
  23. package/dist/models/personalization.d.cts +69 -0
  24. package/dist/models/personalization.d.ts +69 -0
  25. package/dist/models/products.cjs +4 -1
  26. package/dist/models/products.d.cts +35 -0
  27. package/dist/models/products.d.ts +35 -0
  28. package/dist/models/products.js +4 -1
  29. package/dist/models/storefront-cart.cjs +11 -3
  30. package/dist/models/storefront-cart.d.cts +33 -2
  31. package/dist/models/storefront-cart.d.ts +33 -2
  32. package/dist/models/storefront-cart.js +11 -4
  33. package/dist/models/storefront-checkout.d.cts +18 -0
  34. package/dist/models/storefront-checkout.d.ts +18 -0
  35. package/dist/models/urls.d.cts +32 -0
  36. package/dist/models/urls.d.ts +32 -0
  37. package/dist/services/cart.service.d.cts +45 -0
  38. package/dist/services/cart.service.d.ts +45 -0
  39. package/dist/services/checkout.service.d.cts +36 -0
  40. package/dist/services/checkout.service.d.ts +36 -0
  41. package/dist/services/{order-draft.service-D9gy-OPr.cjs → order-draft.service-CdJbIUT6.cjs} +1 -1
  42. package/dist/services/{order-draft.service-DYPR_pcV.js → order-draft.service-DHhae1Ct.js} +1 -1
  43. package/dist/services/product.service.d.cts +25 -0
  44. package/dist/services/product.service.d.ts +25 -0
  45. package/package.json +1 -1
@@ -0,0 +1,48 @@
1
+ import { EntityIdSchema, NullableEntityIdSchema } from "./ids.js";
2
+ import { z } from "zod";
3
+ // src/models/personalization.ts
4
+ const ModifierSelectionTypeSchema = z.enum([
5
+ "single",
6
+ "multiple",
7
+ "text"
8
+ ]);
9
+ const ModifierDisplaySchema = z.enum([
10
+ "list",
11
+ "color",
12
+ "image",
13
+ "font"
14
+ ]);
15
+ const ModifierOptionItemSchema = z.object({
16
+ id: EntityIdSchema,
17
+ name: z.string(),
18
+ priceDelta: z.number(),
19
+ isDefault: z.boolean(),
20
+ color: z.string().nullable(),
21
+ fileUrl: z.string().nullable(),
22
+ fileName: z.string().nullable(),
23
+ tag: z.string().nullable(),
24
+ maxQuantity: z.number().int().positive()
25
+ });
26
+ const ModifierGroupItemSchema = z.object({
27
+ id: EntityIdSchema,
28
+ name: z.string(),
29
+ description: z.string().nullable(),
30
+ selectionType: ModifierSelectionTypeSchema,
31
+ display: ModifierDisplaySchema,
32
+ isRequired: z.boolean(),
33
+ minSelections: z.number().int().nonnegative(),
34
+ maxSelections: z.number().int().positive().nullable(),
35
+ maxLength: z.number().int().positive().nullable(),
36
+ priceDelta: z.number(),
37
+ options: z.array(ModifierOptionItemSchema)
38
+ });
39
+ const ItemModifierSchema = z.object({
40
+ modifierGroupId: EntityIdSchema,
41
+ modifierGroupName: z.string(),
42
+ modifierOptionId: NullableEntityIdSchema,
43
+ modifierOptionName: z.string().nullable(),
44
+ value: z.string().nullable(),
45
+ quantity: z.number().int().positive(),
46
+ priceDelta: z.number()
47
+ });
48
+ export { ItemModifierSchema, ModifierDisplaySchema, ModifierGroupItemSchema, ModifierOptionItemSchema, ModifierSelectionTypeSchema };
@@ -0,0 +1,52 @@
1
+ const require_models_ids = require("./ids.cjs");
2
+ let zod = require("zod");
3
+ // src/models/personalization.ts
4
+ const ModifierSelectionTypeSchema = zod.z.enum([
5
+ "single",
6
+ "multiple",
7
+ "text"
8
+ ]);
9
+ const ModifierDisplaySchema = zod.z.enum([
10
+ "list",
11
+ "color",
12
+ "image",
13
+ "font"
14
+ ]);
15
+ const ModifierOptionItemSchema = zod.z.object({
16
+ id: require_models_ids.EntityIdSchema,
17
+ name: zod.z.string(),
18
+ priceDelta: zod.z.number(),
19
+ isDefault: zod.z.boolean(),
20
+ color: zod.z.string().nullable(),
21
+ fileUrl: zod.z.string().nullable(),
22
+ fileName: zod.z.string().nullable(),
23
+ tag: zod.z.string().nullable(),
24
+ maxQuantity: zod.z.number().int().positive()
25
+ });
26
+ const ModifierGroupItemSchema = zod.z.object({
27
+ id: require_models_ids.EntityIdSchema,
28
+ name: zod.z.string(),
29
+ description: zod.z.string().nullable(),
30
+ selectionType: ModifierSelectionTypeSchema,
31
+ display: ModifierDisplaySchema,
32
+ isRequired: zod.z.boolean(),
33
+ minSelections: zod.z.number().int().nonnegative(),
34
+ maxSelections: zod.z.number().int().positive().nullable(),
35
+ maxLength: zod.z.number().int().positive().nullable(),
36
+ priceDelta: zod.z.number(),
37
+ options: zod.z.array(ModifierOptionItemSchema)
38
+ });
39
+ const ItemModifierSchema = zod.z.object({
40
+ modifierGroupId: require_models_ids.EntityIdSchema,
41
+ modifierGroupName: zod.z.string(),
42
+ modifierOptionId: require_models_ids.NullableEntityIdSchema,
43
+ modifierOptionName: zod.z.string().nullable(),
44
+ value: zod.z.string().nullable(),
45
+ quantity: zod.z.number().int().positive(),
46
+ priceDelta: zod.z.number()
47
+ });
48
+ exports.ItemModifierSchema = ItemModifierSchema;
49
+ exports.ModifierDisplaySchema = ModifierDisplaySchema;
50
+ exports.ModifierGroupItemSchema = ModifierGroupItemSchema;
51
+ exports.ModifierOptionItemSchema = ModifierOptionItemSchema;
52
+ exports.ModifierSelectionTypeSchema = ModifierSelectionTypeSchema;
@@ -0,0 +1,26 @@
1
+ // src/models/personalization-lines.ts
2
+ function roundMoney(value) {
3
+ return Math.round(value * 100) / 100;
4
+ }
5
+ /** Extra charged per unit for the line's customizations. */
6
+ function modifiersUnitPrice(modifiers) {
7
+ return roundMoney(modifiers.reduce((sum, modifier) => sum + modifier.priceDelta * modifier.quantity, 0));
8
+ }
9
+ /** Unit price of the line with its customizations. */
10
+ function lineUnitPrice(line) {
11
+ return roundMoney(line.unitPrice + modifiersUnitPrice(line.modifiers));
12
+ }
13
+ /** Line total with its customizations, before discounts. */
14
+ function lineTotal(line) {
15
+ return roundMoney(lineUnitPrice(line) * line.quantity);
16
+ }
17
+ /** What the buyer chose or typed, with the option quantity when it is more than one. */
18
+ function modifierLabel(modifier) {
19
+ const label = modifier.value ?? modifier.modifierOptionName ?? "";
20
+ if (modifier.quantity > 1) return `${label} × ${modifier.quantity}`;
21
+ return label;
22
+ }
23
+ exports.lineTotal = lineTotal;
24
+ exports.lineUnitPrice = lineUnitPrice;
25
+ exports.modifierLabel = modifierLabel;
26
+ exports.modifiersUnitPrice = modifiersUnitPrice;
@@ -0,0 +1,23 @@
1
+ // src/models/personalization-lines.ts
2
+ function roundMoney(value) {
3
+ return Math.round(value * 100) / 100;
4
+ }
5
+ /** Extra charged per unit for the line's customizations. */
6
+ function modifiersUnitPrice(modifiers) {
7
+ return roundMoney(modifiers.reduce((sum, modifier) => sum + modifier.priceDelta * modifier.quantity, 0));
8
+ }
9
+ /** Unit price of the line with its customizations. */
10
+ function lineUnitPrice(line) {
11
+ return roundMoney(line.unitPrice + modifiersUnitPrice(line.modifiers));
12
+ }
13
+ /** Line total with its customizations, before discounts. */
14
+ function lineTotal(line) {
15
+ return roundMoney(lineUnitPrice(line) * line.quantity);
16
+ }
17
+ /** What the buyer chose or typed, with the option quantity when it is more than one. */
18
+ function modifierLabel(modifier) {
19
+ const label = modifier.value ?? modifier.modifierOptionName ?? "";
20
+ if (modifier.quantity > 1) return `${label} × ${modifier.quantity}`;
21
+ return label;
22
+ }
23
+ export { lineTotal, lineUnitPrice, modifierLabel, modifiersUnitPrice };
@@ -0,0 +1,15 @@
1
+ import { ItemModifier } from "./personalization.cjs";
2
+ type PricedLine = {
3
+ unitPrice: number;
4
+ quantity: number;
5
+ modifiers: readonly Pick<ItemModifier, 'priceDelta' | 'quantity'>[];
6
+ };
7
+ /** Extra charged per unit for the line's customizations. */
8
+ export declare function modifiersUnitPrice(modifiers: PricedLine['modifiers']): number;
9
+ /** Unit price of the line with its customizations. */
10
+ export declare function lineUnitPrice(line: Omit<PricedLine, 'quantity'>): number;
11
+ /** Line total with its customizations, before discounts. */
12
+ export declare function lineTotal(line: PricedLine): number;
13
+ /** What the buyer chose or typed, with the option quantity when it is more than one. */
14
+ export declare function modifierLabel(modifier: Pick<ItemModifier, 'value' | 'modifierOptionName' | 'quantity'>): string;
15
+ export {};
@@ -0,0 +1,15 @@
1
+ import { ItemModifier } from "./personalization.js";
2
+ type PricedLine = {
3
+ unitPrice: number;
4
+ quantity: number;
5
+ modifiers: readonly Pick<ItemModifier, 'priceDelta' | 'quantity'>[];
6
+ };
7
+ /** Extra charged per unit for the line's customizations. */
8
+ export declare function modifiersUnitPrice(modifiers: PricedLine['modifiers']): number;
9
+ /** Unit price of the line with its customizations. */
10
+ export declare function lineUnitPrice(line: Omit<PricedLine, 'quantity'>): number;
11
+ /** Line total with its customizations, before discounts. */
12
+ export declare function lineTotal(line: PricedLine): number;
13
+ /** What the buyer chose or typed, with the option quantity when it is more than one. */
14
+ export declare function modifierLabel(modifier: Pick<ItemModifier, 'value' | 'modifierOptionName' | 'quantity'>): string;
15
+ export {};
@@ -0,0 +1,69 @@
1
+ import { z } from "zod";
2
+ export declare const ModifierSelectionTypeSchema: z.ZodEnum<{
3
+ multiple: "multiple";
4
+ single: "single";
5
+ text: "text";
6
+ }>;
7
+ export declare const ModifierDisplaySchema: z.ZodEnum<{
8
+ color: "color";
9
+ font: "font";
10
+ image: "image";
11
+ list: "list";
12
+ }>;
13
+ export declare const ModifierOptionItemSchema: z.ZodObject<{
14
+ id: z.ZodString;
15
+ name: z.ZodString;
16
+ priceDelta: z.ZodNumber;
17
+ isDefault: z.ZodBoolean;
18
+ color: z.ZodNullable<z.ZodString>;
19
+ fileUrl: z.ZodNullable<z.ZodString>;
20
+ fileName: z.ZodNullable<z.ZodString>;
21
+ tag: z.ZodNullable<z.ZodString>;
22
+ maxQuantity: z.ZodNumber;
23
+ }, z.core.$strip>;
24
+ export declare const ModifierGroupItemSchema: z.ZodObject<{
25
+ id: z.ZodString;
26
+ name: z.ZodString;
27
+ description: z.ZodNullable<z.ZodString>;
28
+ selectionType: z.ZodEnum<{
29
+ multiple: "multiple";
30
+ single: "single";
31
+ text: "text";
32
+ }>;
33
+ display: z.ZodEnum<{
34
+ color: "color";
35
+ font: "font";
36
+ image: "image";
37
+ list: "list";
38
+ }>;
39
+ isRequired: z.ZodBoolean;
40
+ minSelections: z.ZodNumber;
41
+ maxSelections: z.ZodNullable<z.ZodNumber>;
42
+ maxLength: z.ZodNullable<z.ZodNumber>;
43
+ priceDelta: z.ZodNumber;
44
+ options: z.ZodArray<z.ZodObject<{
45
+ id: z.ZodString;
46
+ name: z.ZodString;
47
+ priceDelta: z.ZodNumber;
48
+ isDefault: z.ZodBoolean;
49
+ color: z.ZodNullable<z.ZodString>;
50
+ fileUrl: z.ZodNullable<z.ZodString>;
51
+ fileName: z.ZodNullable<z.ZodString>;
52
+ tag: z.ZodNullable<z.ZodString>;
53
+ maxQuantity: z.ZodNumber;
54
+ }, z.core.$strip>>;
55
+ }, z.core.$strip>;
56
+ export declare const ItemModifierSchema: z.ZodObject<{
57
+ modifierGroupId: z.ZodString;
58
+ modifierGroupName: z.ZodString;
59
+ modifierOptionId: z.ZodNullable<z.ZodString>;
60
+ modifierOptionName: z.ZodNullable<z.ZodString>;
61
+ value: z.ZodNullable<z.ZodString>;
62
+ quantity: z.ZodNumber;
63
+ priceDelta: z.ZodNumber;
64
+ }, z.core.$strip>;
65
+ export type ModifierSelectionType = z.infer<typeof ModifierSelectionTypeSchema>;
66
+ export type ModifierDisplay = z.infer<typeof ModifierDisplaySchema>;
67
+ export type ModifierOptionItem = z.infer<typeof ModifierOptionItemSchema>;
68
+ export type ModifierGroupItem = z.infer<typeof ModifierGroupItemSchema>;
69
+ export type ItemModifier = z.infer<typeof ItemModifierSchema>;
@@ -0,0 +1,69 @@
1
+ import { z } from "zod";
2
+ export declare const ModifierSelectionTypeSchema: z.ZodEnum<{
3
+ multiple: "multiple";
4
+ single: "single";
5
+ text: "text";
6
+ }>;
7
+ export declare const ModifierDisplaySchema: z.ZodEnum<{
8
+ color: "color";
9
+ font: "font";
10
+ image: "image";
11
+ list: "list";
12
+ }>;
13
+ export declare const ModifierOptionItemSchema: z.ZodObject<{
14
+ id: z.ZodString;
15
+ name: z.ZodString;
16
+ priceDelta: z.ZodNumber;
17
+ isDefault: z.ZodBoolean;
18
+ color: z.ZodNullable<z.ZodString>;
19
+ fileUrl: z.ZodNullable<z.ZodString>;
20
+ fileName: z.ZodNullable<z.ZodString>;
21
+ tag: z.ZodNullable<z.ZodString>;
22
+ maxQuantity: z.ZodNumber;
23
+ }, z.core.$strip>;
24
+ export declare const ModifierGroupItemSchema: z.ZodObject<{
25
+ id: z.ZodString;
26
+ name: z.ZodString;
27
+ description: z.ZodNullable<z.ZodString>;
28
+ selectionType: z.ZodEnum<{
29
+ multiple: "multiple";
30
+ single: "single";
31
+ text: "text";
32
+ }>;
33
+ display: z.ZodEnum<{
34
+ color: "color";
35
+ font: "font";
36
+ image: "image";
37
+ list: "list";
38
+ }>;
39
+ isRequired: z.ZodBoolean;
40
+ minSelections: z.ZodNumber;
41
+ maxSelections: z.ZodNullable<z.ZodNumber>;
42
+ maxLength: z.ZodNullable<z.ZodNumber>;
43
+ priceDelta: z.ZodNumber;
44
+ options: z.ZodArray<z.ZodObject<{
45
+ id: z.ZodString;
46
+ name: z.ZodString;
47
+ priceDelta: z.ZodNumber;
48
+ isDefault: z.ZodBoolean;
49
+ color: z.ZodNullable<z.ZodString>;
50
+ fileUrl: z.ZodNullable<z.ZodString>;
51
+ fileName: z.ZodNullable<z.ZodString>;
52
+ tag: z.ZodNullable<z.ZodString>;
53
+ maxQuantity: z.ZodNumber;
54
+ }, z.core.$strip>>;
55
+ }, z.core.$strip>;
56
+ export declare const ItemModifierSchema: z.ZodObject<{
57
+ modifierGroupId: z.ZodString;
58
+ modifierGroupName: z.ZodString;
59
+ modifierOptionId: z.ZodNullable<z.ZodString>;
60
+ modifierOptionName: z.ZodNullable<z.ZodString>;
61
+ value: z.ZodNullable<z.ZodString>;
62
+ quantity: z.ZodNumber;
63
+ priceDelta: z.ZodNumber;
64
+ }, z.core.$strip>;
65
+ export type ModifierSelectionType = z.infer<typeof ModifierSelectionTypeSchema>;
66
+ export type ModifierDisplay = z.infer<typeof ModifierDisplaySchema>;
67
+ export type ModifierOptionItem = z.infer<typeof ModifierOptionItemSchema>;
68
+ export type ModifierGroupItem = z.infer<typeof ModifierGroupItemSchema>;
69
+ export type ItemModifier = z.infer<typeof ItemModifierSchema>;
@@ -1,5 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_models_ids = require("./ids.cjs");
3
+ const require_personalization = require("./personalization-Uh_MWts-.cjs");
3
4
  let zod = require("zod");
4
5
  // src/models/products.ts
5
6
  const ProductSellerSchema = zod.z.object({
@@ -65,7 +66,8 @@ const ProductSummarySchema = zod.z.object({
65
66
  seller: ProductSellerSchema.nullable(),
66
67
  options: zod.z.array(ProductOptionGroupSchema),
67
68
  images: zod.z.array(ProductImageSchema),
68
- availableVariantId: require_models_ids.EntityIdSchema.nullable()
69
+ availableVariantId: require_models_ids.EntityIdSchema.nullable(),
70
+ hasModifierGroups: zod.z.boolean()
69
71
  });
70
72
  const ProductSummariesSchema = zod.z.array(ProductSummarySchema);
71
73
  const FacetItemSchema = zod.z.object({
@@ -205,6 +207,7 @@ const ProductDetailSchema = zod.z.object({
205
207
  bundleItems: zod.z.array(BundleItemSchema),
206
208
  sizeGuide: SizeGuideSchema.nullable(),
207
209
  priceTiers: zod.z.array(ProductPriceTierSchema),
210
+ modifierGroups: zod.z.array(require_personalization.ModifierGroupItemSchema),
208
211
  createdAt: zod.z.string().datetime({ offset: true }).nullable(),
209
212
  updatedAt: zod.z.string().datetime({ offset: true }).nullable(),
210
213
  seller: ProductSellerSchema.nullable(),
@@ -167,6 +167,7 @@ export declare const ProductSummarySchema: z.ZodObject<{
167
167
  }>>>;
168
168
  }, z.core.$strip>>;
169
169
  availableVariantId: z.ZodNullable<z.ZodString>;
170
+ hasModifierGroups: z.ZodBoolean;
170
171
  }, z.core.$strip>;
171
172
  export declare const ProductSummariesSchema: z.ZodArray<z.ZodObject<{
172
173
  id: z.ZodString;
@@ -241,6 +242,7 @@ export declare const ProductSummariesSchema: z.ZodArray<z.ZodObject<{
241
242
  }>>>;
242
243
  }, z.core.$strip>>;
243
244
  availableVariantId: z.ZodNullable<z.ZodString>;
245
+ hasModifierGroups: z.ZodBoolean;
244
246
  }, z.core.$strip>>;
245
247
  export declare const FacetItemSchema: z.ZodObject<{
246
248
  value: z.ZodString;
@@ -344,6 +346,7 @@ export declare const ProductsResponseSchema: z.ZodObject<{
344
346
  }>>>;
345
347
  }, z.core.$strip>>;
346
348
  availableVariantId: z.ZodNullable<z.ZodString>;
349
+ hasModifierGroups: z.ZodBoolean;
347
350
  }, z.core.$strip>>;
348
351
  filters: z.ZodArray<z.ZodObject<{
349
352
  id: z.ZodString;
@@ -644,6 +647,38 @@ export declare const ProductDetailSchema: z.ZodObject<{
644
647
  maxQuantity: z.ZodNullable<z.ZodNumber>;
645
648
  unitPrice: z.ZodNumber;
646
649
  }, z.core.$strip>>;
650
+ modifierGroups: z.ZodArray<z.ZodObject<{
651
+ id: z.ZodString;
652
+ name: z.ZodString;
653
+ description: z.ZodNullable<z.ZodString>;
654
+ selectionType: z.ZodEnum<{
655
+ multiple: "multiple";
656
+ single: "single";
657
+ text: "text";
658
+ }>;
659
+ display: z.ZodEnum<{
660
+ color: "color";
661
+ font: "font";
662
+ image: "image";
663
+ list: "list";
664
+ }>;
665
+ isRequired: z.ZodBoolean;
666
+ minSelections: z.ZodNumber;
667
+ maxSelections: z.ZodNullable<z.ZodNumber>;
668
+ maxLength: z.ZodNullable<z.ZodNumber>;
669
+ priceDelta: z.ZodNumber;
670
+ options: z.ZodArray<z.ZodObject<{
671
+ id: z.ZodString;
672
+ name: z.ZodString;
673
+ priceDelta: z.ZodNumber;
674
+ isDefault: z.ZodBoolean;
675
+ color: z.ZodNullable<z.ZodString>;
676
+ fileUrl: z.ZodNullable<z.ZodString>;
677
+ fileName: z.ZodNullable<z.ZodString>;
678
+ tag: z.ZodNullable<z.ZodString>;
679
+ maxQuantity: z.ZodNumber;
680
+ }, z.core.$strip>>;
681
+ }, z.core.$strip>>;
647
682
  createdAt: z.ZodNullable<z.ZodString>;
648
683
  updatedAt: z.ZodNullable<z.ZodString>;
649
684
  seller: z.ZodNullable<z.ZodObject<{
@@ -167,6 +167,7 @@ export declare const ProductSummarySchema: z.ZodObject<{
167
167
  }>>>;
168
168
  }, z.core.$strip>>;
169
169
  availableVariantId: z.ZodNullable<z.ZodString>;
170
+ hasModifierGroups: z.ZodBoolean;
170
171
  }, z.core.$strip>;
171
172
  export declare const ProductSummariesSchema: z.ZodArray<z.ZodObject<{
172
173
  id: z.ZodString;
@@ -241,6 +242,7 @@ export declare const ProductSummariesSchema: z.ZodArray<z.ZodObject<{
241
242
  }>>>;
242
243
  }, z.core.$strip>>;
243
244
  availableVariantId: z.ZodNullable<z.ZodString>;
245
+ hasModifierGroups: z.ZodBoolean;
244
246
  }, z.core.$strip>>;
245
247
  export declare const FacetItemSchema: z.ZodObject<{
246
248
  value: z.ZodString;
@@ -344,6 +346,7 @@ export declare const ProductsResponseSchema: z.ZodObject<{
344
346
  }>>>;
345
347
  }, z.core.$strip>>;
346
348
  availableVariantId: z.ZodNullable<z.ZodString>;
349
+ hasModifierGroups: z.ZodBoolean;
347
350
  }, z.core.$strip>>;
348
351
  filters: z.ZodArray<z.ZodObject<{
349
352
  id: z.ZodString;
@@ -644,6 +647,38 @@ export declare const ProductDetailSchema: z.ZodObject<{
644
647
  maxQuantity: z.ZodNullable<z.ZodNumber>;
645
648
  unitPrice: z.ZodNumber;
646
649
  }, z.core.$strip>>;
650
+ modifierGroups: z.ZodArray<z.ZodObject<{
651
+ id: z.ZodString;
652
+ name: z.ZodString;
653
+ description: z.ZodNullable<z.ZodString>;
654
+ selectionType: z.ZodEnum<{
655
+ multiple: "multiple";
656
+ single: "single";
657
+ text: "text";
658
+ }>;
659
+ display: z.ZodEnum<{
660
+ color: "color";
661
+ font: "font";
662
+ image: "image";
663
+ list: "list";
664
+ }>;
665
+ isRequired: z.ZodBoolean;
666
+ minSelections: z.ZodNumber;
667
+ maxSelections: z.ZodNullable<z.ZodNumber>;
668
+ maxLength: z.ZodNullable<z.ZodNumber>;
669
+ priceDelta: z.ZodNumber;
670
+ options: z.ZodArray<z.ZodObject<{
671
+ id: z.ZodString;
672
+ name: z.ZodString;
673
+ priceDelta: z.ZodNumber;
674
+ isDefault: z.ZodBoolean;
675
+ color: z.ZodNullable<z.ZodString>;
676
+ fileUrl: z.ZodNullable<z.ZodString>;
677
+ fileName: z.ZodNullable<z.ZodString>;
678
+ tag: z.ZodNullable<z.ZodString>;
679
+ maxQuantity: z.ZodNumber;
680
+ }, z.core.$strip>>;
681
+ }, z.core.$strip>>;
647
682
  createdAt: z.ZodNullable<z.ZodString>;
648
683
  updatedAt: z.ZodNullable<z.ZodString>;
649
684
  seller: z.ZodNullable<z.ZodObject<{
@@ -1,4 +1,5 @@
1
1
  import { EntityIdSchema } from "./ids.js";
2
+ import { ModifierGroupItemSchema } from "./personalization-CdwIzzSn.js";
2
3
  import { z } from "zod";
3
4
  // src/models/products.ts
4
5
  const ProductSellerSchema = z.object({
@@ -64,7 +65,8 @@ const ProductSummarySchema = z.object({
64
65
  seller: ProductSellerSchema.nullable(),
65
66
  options: z.array(ProductOptionGroupSchema),
66
67
  images: z.array(ProductImageSchema),
67
- availableVariantId: EntityIdSchema.nullable()
68
+ availableVariantId: EntityIdSchema.nullable(),
69
+ hasModifierGroups: z.boolean()
68
70
  });
69
71
  const ProductSummariesSchema = z.array(ProductSummarySchema);
70
72
  const FacetItemSchema = z.object({
@@ -204,6 +206,7 @@ const ProductDetailSchema = z.object({
204
206
  bundleItems: z.array(BundleItemSchema),
205
207
  sizeGuide: SizeGuideSchema.nullable(),
206
208
  priceTiers: z.array(ProductPriceTierSchema),
209
+ modifierGroups: z.array(ModifierGroupItemSchema),
207
210
  createdAt: z.string().datetime({ offset: true }).nullable(),
208
211
  updatedAt: z.string().datetime({ offset: true }).nullable(),
209
212
  seller: ProductSellerSchema.nullable(),
@@ -1,6 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_amounts = require("./amounts-lmg89eJQ.cjs");
3
3
  const require_models_ids = require("./ids.cjs");
4
+ const require_personalization = require("./personalization-Uh_MWts-.cjs");
4
5
  let zod = require("zod");
5
6
  // src/models/storefront-cart.ts
6
7
  const CartShippingMethodTypeSchema = zod.z.enum([
@@ -57,7 +58,8 @@ const StorefrontCartItemSchema = zod.z.object({
57
58
  requiresShipping: zod.z.boolean(),
58
59
  sellerId: require_models_ids.NullableEntityIdSchema,
59
60
  sellerName: zod.z.string().nullable(),
60
- orderBumpId: require_models_ids.NullableEntityIdSchema
61
+ orderBumpId: require_models_ids.NullableEntityIdSchema,
62
+ modifiers: zod.z.array(require_personalization.ItemModifierSchema)
61
63
  });
62
64
  const StorefrontCartShippingMethodSchema = zod.z.object({
63
65
  id: require_models_ids.EntityIdSchema,
@@ -131,10 +133,15 @@ const CreateCartParamsSchema = zod.z.object({
131
133
  email: zod.z.string().email().optional()
132
134
  });
133
135
  const GetCartParamsSchema = zod.z.object({ cartToken: require_models_ids.CartTokenSchema });
136
+ const CartItemModifierOptionSchema = zod.z.object({
137
+ optionId: require_models_ids.EntityIdSchema,
138
+ quantity: zod.z.number().int().min(1).max(99).optional()
139
+ });
134
140
  const CartItemModifierSchema = zod.z.object({
135
141
  modifierGroupId: require_models_ids.EntityIdSchema,
136
- optionIds: zod.z.array(require_models_ids.EntityIdSchema).min(1)
137
- });
142
+ options: zod.z.array(CartItemModifierOptionSchema).min(1).optional(),
143
+ value: zod.z.string().trim().min(1).max(500).optional()
144
+ }).refine((modifier) => modifier.options === void 0 !== (modifier.value === void 0), { message: "Send the chosen options or the typed value, not both." });
138
145
  const AddCartItemParamsSchema = zod.z.object({
139
146
  cartToken: require_models_ids.CartTokenSchema,
140
147
  variantId: require_models_ids.EntityIdSchema,
@@ -153,6 +160,7 @@ const RemoveCartItemParamsSchema = zod.z.object({
153
160
  cartItemId: require_models_ids.EntityIdSchema
154
161
  });
155
162
  exports.AddCartItemParamsSchema = AddCartItemParamsSchema;
163
+ exports.CartItemModifierOptionSchema = CartItemModifierOptionSchema;
156
164
  exports.CartItemModifierSchema = CartItemModifierSchema;
157
165
  exports.CartShippingMethodTypeSchema = CartShippingMethodTypeSchema;
158
166
  exports.CreateCartParamsSchema = CreateCartParamsSchema;
@@ -64,6 +64,15 @@ export declare const StorefrontCartItemSchema: z.ZodObject<{
64
64
  sellerId: z.ZodNullable<z.ZodString>;
65
65
  sellerName: z.ZodNullable<z.ZodString>;
66
66
  orderBumpId: z.ZodNullable<z.ZodString>;
67
+ modifiers: z.ZodArray<z.ZodObject<{
68
+ modifierGroupId: z.ZodString;
69
+ modifierGroupName: z.ZodString;
70
+ modifierOptionId: z.ZodNullable<z.ZodString>;
71
+ modifierOptionName: z.ZodNullable<z.ZodString>;
72
+ value: z.ZodNullable<z.ZodString>;
73
+ quantity: z.ZodNumber;
74
+ priceDelta: z.ZodNumber;
75
+ }, z.core.$strip>>;
67
76
  }, z.core.$strip>;
68
77
  export declare const StorefrontCartShippingMethodSchema: z.ZodObject<{
69
78
  id: z.ZodString;
@@ -193,6 +202,15 @@ export declare const StorefrontCartSchema: z.ZodObject<{
193
202
  sellerId: z.ZodNullable<z.ZodString>;
194
203
  sellerName: z.ZodNullable<z.ZodString>;
195
204
  orderBumpId: z.ZodNullable<z.ZodString>;
205
+ modifiers: z.ZodArray<z.ZodObject<{
206
+ modifierGroupId: z.ZodString;
207
+ modifierGroupName: z.ZodString;
208
+ modifierOptionId: z.ZodNullable<z.ZodString>;
209
+ modifierOptionName: z.ZodNullable<z.ZodString>;
210
+ value: z.ZodNullable<z.ZodString>;
211
+ quantity: z.ZodNumber;
212
+ priceDelta: z.ZodNumber;
213
+ }, z.core.$strip>>;
196
214
  }, z.core.$strip>>;
197
215
  shippingMethods: z.ZodArray<z.ZodObject<{
198
216
  id: z.ZodString;
@@ -251,9 +269,17 @@ export declare const CreateCartParamsSchema: z.ZodObject<{
251
269
  export declare const GetCartParamsSchema: z.ZodObject<{
252
270
  cartToken: z.ZodString;
253
271
  }, z.core.$strip>;
272
+ export declare const CartItemModifierOptionSchema: z.ZodObject<{
273
+ optionId: z.ZodString;
274
+ quantity: z.ZodOptional<z.ZodNumber>;
275
+ }, z.core.$strip>;
254
276
  export declare const CartItemModifierSchema: z.ZodObject<{
255
277
  modifierGroupId: z.ZodString;
256
- optionIds: z.ZodArray<z.ZodString>;
278
+ options: z.ZodOptional<z.ZodArray<z.ZodObject<{
279
+ optionId: z.ZodString;
280
+ quantity: z.ZodOptional<z.ZodNumber>;
281
+ }, z.core.$strip>>>;
282
+ value: z.ZodOptional<z.ZodString>;
257
283
  }, z.core.$strip>;
258
284
  export declare const AddCartItemParamsSchema: z.ZodObject<{
259
285
  cartToken: z.ZodString;
@@ -263,7 +289,11 @@ export declare const AddCartItemParamsSchema: z.ZodObject<{
263
289
  orderBumpId: z.ZodOptional<z.ZodString>;
264
290
  modifiers: z.ZodOptional<z.ZodArray<z.ZodObject<{
265
291
  modifierGroupId: z.ZodString;
266
- optionIds: z.ZodArray<z.ZodString>;
292
+ options: z.ZodOptional<z.ZodArray<z.ZodObject<{
293
+ optionId: z.ZodString;
294
+ quantity: z.ZodOptional<z.ZodNumber>;
295
+ }, z.core.$strip>>>;
296
+ value: z.ZodOptional<z.ZodString>;
267
297
  }, z.core.$strip>>>;
268
298
  }, z.core.$strip>;
269
299
  export declare const UpdateCartItemQuantityParamsSchema: z.ZodObject<{
@@ -285,5 +315,6 @@ export type StorefrontCart = z.infer<typeof StorefrontCartSchema>;
285
315
  export type CreateCartParams = z.input<typeof CreateCartParamsSchema>;
286
316
  export type GetCartParams = z.input<typeof GetCartParamsSchema>;
287
317
  export type AddCartItemParams = z.input<typeof AddCartItemParamsSchema>;
318
+ export type CartItemModifierInput = z.input<typeof CartItemModifierSchema>;
288
319
  export type UpdateCartItemQuantityParams = z.input<typeof UpdateCartItemQuantityParamsSchema>;
289
320
  export type RemoveCartItemParams = z.input<typeof RemoveCartItemParamsSchema>;