@ecomiq/core 1.1.0 → 1.2.0

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 (50) hide show
  1. package/README.md +16 -2
  2. package/dist/client.cjs +181 -24
  3. package/dist/client.d.cts +8 -2
  4. package/dist/client.d.ts +8 -2
  5. package/dist/client.js +184 -27
  6. package/dist/index.cjs +16 -10
  7. package/dist/index.d.cts +5 -4
  8. package/dist/index.d.ts +5 -4
  9. package/dist/index.js +10 -9
  10. package/dist/libs/{graphql-_6Y8lR_Q.js → graphql-8PZkrq66.js} +12 -8
  11. package/dist/libs/{graphql-wJH7HaQU.cjs → graphql-BICZrYlZ.cjs} +12 -7
  12. package/dist/libs/graphql-batch-AFRui-4Y.js +125 -0
  13. package/dist/libs/graphql-batch-B0xSD6G2.cjs +125 -0
  14. package/dist/libs/graphql-batch.d.cts +2 -0
  15. package/dist/libs/graphql-batch.d.ts +2 -0
  16. package/dist/models/collections.cjs +5 -0
  17. package/dist/models/collections.d.cts +109 -1
  18. package/dist/models/collections.d.ts +109 -1
  19. package/dist/models/collections.js +4 -1
  20. package/dist/models/customer-order.cjs +1 -1
  21. package/dist/models/customer-order.js +1 -1
  22. package/dist/models/{order-draft-C-2WRbjl.cjs → order-draft-DWKoM7Lu.cjs} +1 -1
  23. package/dist/models/{order-draft-CSIWRIV0.js → order-draft-DhEKDqI8.js} +1 -1
  24. package/dist/models/{personalization-BPFmkdJ0.js → personalization-CdwIzzSn.js} +1 -22
  25. package/dist/models/{personalization-CQosKg8O.cjs → personalization-Uh_MWts-.cjs} +0 -25
  26. package/dist/models/personalization-lines-BurVHB4o.cjs +26 -0
  27. package/dist/models/personalization-lines-DigNu6OK.js +23 -0
  28. package/dist/models/personalization-lines.d.cts +15 -0
  29. package/dist/models/personalization-lines.d.ts +15 -0
  30. package/dist/models/personalization.d.cts +1 -15
  31. package/dist/models/personalization.d.ts +1 -15
  32. package/dist/models/products.cjs +1 -1
  33. package/dist/models/products.js +1 -1
  34. package/dist/models/storefront-cart.cjs +1 -1
  35. package/dist/models/storefront-cart.js +1 -1
  36. package/dist/models/storefront-reviews.cjs +9 -2
  37. package/dist/models/storefront-reviews.d.cts +99 -0
  38. package/dist/models/storefront-reviews.d.ts +99 -0
  39. package/dist/models/storefront-reviews.js +7 -3
  40. package/dist/services/layout.service-C6zG6zY7.cjs +65 -0
  41. package/dist/services/layout.service-DufBhrOR.js +65 -0
  42. package/dist/services/layout.service.d.cts +1 -0
  43. package/dist/services/layout.service.d.ts +1 -0
  44. package/dist/services/{order-draft.service-Dlu6eEkV.cjs → order-draft.service-CdJbIUT6.cjs} +1 -1
  45. package/dist/services/{order-draft.service-B0VcmWhn.js → order-draft.service-DHhae1Ct.js} +1 -1
  46. package/dist/services/{review.service-CO2icjpu.cjs → review.service-BgRGfq4t.cjs} +0 -8
  47. package/dist/services/{review.service-De1YkhFp.js → review.service-DMgxbO94.js} +2 -9
  48. package/package.json +1 -1
  49. package/dist/services/layout.service-BkvLzl1g.cjs +0 -50
  50. package/dist/services/layout.service-DmbeMOkK.js +0 -50
@@ -1,3 +1,4 @@
1
+ import { ProductSort } from "./products.js";
1
2
  import { z } from "zod";
2
3
  export declare const CollectionSchema: z.ZodObject<{
3
4
  id: z.ZodString;
@@ -19,5 +20,112 @@ export declare const CollectionsSchema: z.ZodArray<z.ZodObject<{
19
20
  productCount: z.ZodOptional<z.ZodNumber>;
20
21
  template: z.ZodOptional<z.ZodNullable<z.ZodString>>;
21
22
  }, z.core.$strip>>;
23
+ export declare const CollectionWithCoversSchema: z.ZodObject<{
24
+ id: z.ZodString;
25
+ slug: z.ZodString;
26
+ name: z.ZodString;
27
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
28
+ imageUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
29
+ type: z.ZodString;
30
+ productCount: z.ZodOptional<z.ZodNumber>;
31
+ template: z.ZodOptional<z.ZodNullable<z.ZodString>>;
32
+ imageCandidates: z.ZodArray<z.ZodString>;
33
+ }, z.core.$strip>;
34
+ export declare const CollectionWithProductsSchema: z.ZodObject<{
35
+ id: z.ZodString;
36
+ slug: z.ZodString;
37
+ name: z.ZodString;
38
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
39
+ imageUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
40
+ type: z.ZodString;
41
+ productCount: z.ZodOptional<z.ZodNumber>;
42
+ template: z.ZodOptional<z.ZodNullable<z.ZodString>>;
43
+ products: z.ZodArray<z.ZodObject<{
44
+ id: z.ZodString;
45
+ name: z.ZodString;
46
+ slug: z.ZodString;
47
+ url: z.ZodString;
48
+ productType: z.ZodString;
49
+ imageUrl: z.ZodString;
50
+ price: z.ZodNumber;
51
+ compareAtPrice: z.ZodNullable<z.ZodNumber>;
52
+ variantCount: z.ZodNumber;
53
+ isAvailable: z.ZodBoolean;
54
+ totalInventory: z.ZodNumber;
55
+ bundleItemsCount: z.ZodNumber;
56
+ brand: z.ZodString;
57
+ category: z.ZodString;
58
+ status: z.ZodString;
59
+ collections: z.ZodArray<z.ZodString>;
60
+ tags: z.ZodArray<z.ZodString>;
61
+ seller: z.ZodNullable<z.ZodObject<{
62
+ id: z.ZodString;
63
+ name: z.ZodString;
64
+ slug: z.ZodString;
65
+ }, z.core.$strip>>;
66
+ options: z.ZodArray<z.ZodObject<{
67
+ key: z.ZodString;
68
+ name: z.ZodString;
69
+ type: z.ZodOptional<z.ZodEnum<{
70
+ checkbox: "checkbox";
71
+ colorPicker: "colorPicker";
72
+ datePicker: "datePicker";
73
+ dateTimePicker: "dateTimePicker";
74
+ file: "file";
75
+ input: "input";
76
+ number: "number";
77
+ select: "select";
78
+ textArea: "textArea";
79
+ timePicker: "timePicker";
80
+ url: "url";
81
+ }>>;
82
+ values: z.ZodArray<z.ZodObject<{
83
+ key: z.ZodString;
84
+ name: z.ZodString;
85
+ value: z.ZodString;
86
+ valueId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
87
+ valueName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
88
+ type: z.ZodOptional<z.ZodEnum<{
89
+ checkbox: "checkbox";
90
+ colorPicker: "colorPicker";
91
+ datePicker: "datePicker";
92
+ dateTimePicker: "dateTimePicker";
93
+ file: "file";
94
+ input: "input";
95
+ number: "number";
96
+ select: "select";
97
+ textArea: "textArea";
98
+ timePicker: "timePicker";
99
+ url: "url";
100
+ }>>;
101
+ color: z.ZodOptional<z.ZodNullable<z.ZodString>>;
102
+ imageUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
103
+ unit: z.ZodOptional<z.ZodNullable<z.ZodString>>;
104
+ }, z.core.$strip>>;
105
+ }, z.core.$strip>>;
106
+ images: z.ZodArray<z.ZodObject<{
107
+ url: z.ZodString;
108
+ name: z.ZodString;
109
+ order: z.ZodNumber;
110
+ type: z.ZodDefault<z.ZodCatch<z.ZodEnum<{
111
+ image: "image";
112
+ video: "video";
113
+ }>>>;
114
+ }, z.core.$strip>>;
115
+ availableVariantId: z.ZodNullable<z.ZodString>;
116
+ hasModifierGroups: z.ZodBoolean;
117
+ }, z.core.$strip>>;
118
+ }, z.core.$strip>;
22
119
  export type Collection = z.infer<typeof CollectionSchema>;
23
- export type Collections = z.infer<typeof CollectionsSchema>;
120
+ export type Collections = z.infer<typeof CollectionsSchema>;
121
+ export type CollectionWithCovers = z.infer<typeof CollectionWithCoversSchema>;
122
+ export type CollectionWithProducts = z.infer<typeof CollectionWithProductsSchema>;
123
+ export type CollectionCoversOptions = {
124
+ limit?: number;
125
+ candidates?: number;
126
+ };
127
+ export type CollectionsWithProductsOptions = {
128
+ limit?: number;
129
+ products: number;
130
+ sort?: ProductSort;
131
+ };
@@ -1,4 +1,5 @@
1
1
  import { EntityIdSchema } from "./ids.js";
2
+ import { ProductSummarySchema } from "./products.js";
2
3
  import { z } from "zod";
3
4
  // src/models/collections.ts
4
5
  const CollectionSchema = z.object({
@@ -12,4 +13,6 @@ const CollectionSchema = z.object({
12
13
  template: z.string().nullable().optional()
13
14
  });
14
15
  const CollectionsSchema = z.array(CollectionSchema);
15
- export { CollectionSchema, CollectionsSchema };
16
+ const CollectionWithCoversSchema = CollectionSchema.extend({ imageCandidates: z.array(z.string()) });
17
+ const CollectionWithProductsSchema = CollectionSchema.extend({ products: z.array(ProductSummarySchema) });
18
+ export { CollectionSchema, CollectionWithCoversSchema, CollectionWithProductsSchema, CollectionsSchema };
@@ -1,7 +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-CQosKg8O.cjs");
4
+ const require_personalization = require("./personalization-Uh_MWts-.cjs");
5
5
  let zod = require("zod");
6
6
  // src/models/customer-order.ts
7
7
  const CustomerOrderShippingAddressSchema = zod.z.object({
@@ -1,6 +1,6 @@
1
1
  import { DiscountAmountSchema } from "./amounts-cKBCecl7.js";
2
2
  import { EntityIdSchema } from "./ids.js";
3
- import { ItemModifierSchema } from "./personalization-BPFmkdJ0.js";
3
+ import { ItemModifierSchema } from "./personalization-CdwIzzSn.js";
4
4
  import { z } from "zod";
5
5
  // src/models/customer-order.ts
6
6
  const CustomerOrderShippingAddressSchema = z.object({
@@ -1,6 +1,6 @@
1
1
  const require_amounts = require("./amounts-lmg89eJQ.cjs");
2
2
  const require_models_ids = require("./ids.cjs");
3
- const require_personalization = require("./personalization-CQosKg8O.cjs");
3
+ const require_personalization = require("./personalization-Uh_MWts-.cjs");
4
4
  let zod = require("zod");
5
5
  // src/models/order-draft.ts
6
6
  const OrderDraftItemSchema = zod.z.object({
@@ -1,6 +1,6 @@
1
1
  import { DiscountAmountSchema } from "./amounts-cKBCecl7.js";
2
2
  import { EntityIdSchema, NullableEntityIdSchema } from "./ids.js";
3
- import { ItemModifierSchema } from "./personalization-BPFmkdJ0.js";
3
+ import { ItemModifierSchema } from "./personalization-CdwIzzSn.js";
4
4
  import { z } from "zod";
5
5
  // src/models/order-draft.ts
6
6
  const OrderDraftItemSchema = z.object({
@@ -45,25 +45,4 @@ const ItemModifierSchema = z.object({
45
45
  quantity: z.number().int().positive(),
46
46
  priceDelta: z.number()
47
47
  });
48
- function roundMoney(value) {
49
- return Math.round(value * 100) / 100;
50
- }
51
- /** Extra charged per unit for the line's customizations. */
52
- function modifiersUnitPrice(modifiers) {
53
- return roundMoney(modifiers.reduce((sum, modifier) => sum + modifier.priceDelta * modifier.quantity, 0));
54
- }
55
- /** Unit price of the line with its customizations. */
56
- function lineUnitPrice(line) {
57
- return roundMoney(line.unitPrice + modifiersUnitPrice(line.modifiers));
58
- }
59
- /** Line total with its customizations, before discounts. */
60
- function lineTotal(line) {
61
- return roundMoney(lineUnitPrice(line) * line.quantity);
62
- }
63
- /** What the buyer chose or typed, with the option quantity when it is more than one. */
64
- function modifierLabel(modifier) {
65
- const label = modifier.value ?? modifier.modifierOptionName ?? "";
66
- if (modifier.quantity > 1) return `${label} × ${modifier.quantity}`;
67
- return label;
68
- }
69
- export { ItemModifierSchema, ModifierDisplaySchema, ModifierGroupItemSchema, ModifierOptionItemSchema, ModifierSelectionTypeSchema, lineTotal, lineUnitPrice, modifierLabel, modifiersUnitPrice };
48
+ export { ItemModifierSchema, ModifierDisplaySchema, ModifierGroupItemSchema, ModifierOptionItemSchema, ModifierSelectionTypeSchema };
@@ -45,33 +45,8 @@ const ItemModifierSchema = zod.z.object({
45
45
  quantity: zod.z.number().int().positive(),
46
46
  priceDelta: zod.z.number()
47
47
  });
48
- function roundMoney(value) {
49
- return Math.round(value * 100) / 100;
50
- }
51
- /** Extra charged per unit for the line's customizations. */
52
- function modifiersUnitPrice(modifiers) {
53
- return roundMoney(modifiers.reduce((sum, modifier) => sum + modifier.priceDelta * modifier.quantity, 0));
54
- }
55
- /** Unit price of the line with its customizations. */
56
- function lineUnitPrice(line) {
57
- return roundMoney(line.unitPrice + modifiersUnitPrice(line.modifiers));
58
- }
59
- /** Line total with its customizations, before discounts. */
60
- function lineTotal(line) {
61
- return roundMoney(lineUnitPrice(line) * line.quantity);
62
- }
63
- /** What the buyer chose or typed, with the option quantity when it is more than one. */
64
- function modifierLabel(modifier) {
65
- const label = modifier.value ?? modifier.modifierOptionName ?? "";
66
- if (modifier.quantity > 1) return `${label} × ${modifier.quantity}`;
67
- return label;
68
- }
69
48
  exports.ItemModifierSchema = ItemModifierSchema;
70
49
  exports.ModifierDisplaySchema = ModifierDisplaySchema;
71
50
  exports.ModifierGroupItemSchema = ModifierGroupItemSchema;
72
51
  exports.ModifierOptionItemSchema = ModifierOptionItemSchema;
73
52
  exports.ModifierSelectionTypeSchema = ModifierSelectionTypeSchema;
74
- exports.lineTotal = lineTotal;
75
- exports.lineUnitPrice = lineUnitPrice;
76
- exports.modifierLabel = modifierLabel;
77
- exports.modifiersUnitPrice = modifiersUnitPrice;
@@ -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 {};
@@ -66,18 +66,4 @@ export type ModifierSelectionType = z.infer<typeof ModifierSelectionTypeSchema>;
66
66
  export type ModifierDisplay = z.infer<typeof ModifierDisplaySchema>;
67
67
  export type ModifierOptionItem = z.infer<typeof ModifierOptionItemSchema>;
68
68
  export type ModifierGroupItem = z.infer<typeof ModifierGroupItemSchema>;
69
- export type ItemModifier = z.infer<typeof ItemModifierSchema>;
70
- type PricedLine = {
71
- unitPrice: number;
72
- quantity: number;
73
- modifiers: readonly Pick<ItemModifier, 'priceDelta' | 'quantity'>[];
74
- };
75
- /** Extra charged per unit for the line's customizations. */
76
- export declare function modifiersUnitPrice(modifiers: PricedLine['modifiers']): number;
77
- /** Unit price of the line with its customizations. */
78
- export declare function lineUnitPrice(line: Omit<PricedLine, 'quantity'>): number;
79
- /** Line total with its customizations, before discounts. */
80
- export declare function lineTotal(line: PricedLine): number;
81
- /** What the buyer chose or typed, with the option quantity when it is more than one. */
82
- export declare function modifierLabel(modifier: Pick<ItemModifier, 'value' | 'modifierOptionName' | 'quantity'>): string;
83
- export {};
69
+ export type ItemModifier = z.infer<typeof ItemModifierSchema>;
@@ -66,18 +66,4 @@ export type ModifierSelectionType = z.infer<typeof ModifierSelectionTypeSchema>;
66
66
  export type ModifierDisplay = z.infer<typeof ModifierDisplaySchema>;
67
67
  export type ModifierOptionItem = z.infer<typeof ModifierOptionItemSchema>;
68
68
  export type ModifierGroupItem = z.infer<typeof ModifierGroupItemSchema>;
69
- export type ItemModifier = z.infer<typeof ItemModifierSchema>;
70
- type PricedLine = {
71
- unitPrice: number;
72
- quantity: number;
73
- modifiers: readonly Pick<ItemModifier, 'priceDelta' | 'quantity'>[];
74
- };
75
- /** Extra charged per unit for the line's customizations. */
76
- export declare function modifiersUnitPrice(modifiers: PricedLine['modifiers']): number;
77
- /** Unit price of the line with its customizations. */
78
- export declare function lineUnitPrice(line: Omit<PricedLine, 'quantity'>): number;
79
- /** Line total with its customizations, before discounts. */
80
- export declare function lineTotal(line: PricedLine): number;
81
- /** What the buyer chose or typed, with the option quantity when it is more than one. */
82
- export declare function modifierLabel(modifier: Pick<ItemModifier, 'value' | 'modifierOptionName' | 'quantity'>): string;
83
- export {};
69
+ export type ItemModifier = z.infer<typeof ItemModifierSchema>;
@@ -1,6 +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-CQosKg8O.cjs");
3
+ const require_personalization = require("./personalization-Uh_MWts-.cjs");
4
4
  let zod = require("zod");
5
5
  // src/models/products.ts
6
6
  const ProductSellerSchema = zod.z.object({
@@ -1,5 +1,5 @@
1
1
  import { EntityIdSchema } from "./ids.js";
2
- import { ModifierGroupItemSchema } from "./personalization-BPFmkdJ0.js";
2
+ import { ModifierGroupItemSchema } from "./personalization-CdwIzzSn.js";
3
3
  import { z } from "zod";
4
4
  // src/models/products.ts
5
5
  const ProductSellerSchema = z.object({
@@ -1,7 +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-CQosKg8O.cjs");
4
+ const require_personalization = require("./personalization-Uh_MWts-.cjs");
5
5
  let zod = require("zod");
6
6
  // src/models/storefront-cart.ts
7
7
  const CartShippingMethodTypeSchema = zod.z.enum([
@@ -1,6 +1,6 @@
1
1
  import { DiscountAmountSchema } from "./amounts-cKBCecl7.js";
2
2
  import { CartTokenSchema, EntityIdSchema, NullableEntityIdSchema } from "./ids.js";
3
- import { ItemModifierSchema } from "./personalization-BPFmkdJ0.js";
3
+ import { ItemModifierSchema } from "./personalization-CdwIzzSn.js";
4
4
  import { z } from "zod";
5
5
  // src/models/storefront-cart.ts
6
6
  const CartShippingMethodTypeSchema = z.enum([
@@ -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_models_products = require("./products.cjs");
3
4
  let zod = require("zod");
4
5
  // src/models/storefront-reviews.ts
5
6
  const StorefrontReviewSchema = zod.z.object({
@@ -32,15 +33,18 @@ const StorefrontReviewsSchema = zod.z.object({
32
33
  nextCursor: zod.z.string().nullable(),
33
34
  totalCount: zod.z.number().int().nonnegative().nullable()
34
35
  });
36
+ const ProductReviewSortSchema = zod.z.enum(["rating", "createdOn"]);
37
+ const ProductReviewDirectionSchema = zod.z.enum(["asc", "desc"]);
35
38
  const ListProductReviewsParamsSchema = zod.z.object({
36
39
  productId: require_models_ids.EntityIdSchema,
37
40
  limit: zod.z.number().int().min(1).max(200).optional(),
38
41
  cursor: zod.z.string().optional(),
39
42
  search: zod.z.string().optional(),
40
- sortBy: zod.z.enum(["rating", "createdOn"]).optional(),
41
- sortDirection: zod.z.enum(["asc", "desc"]).optional(),
43
+ sortBy: ProductReviewSortSchema.optional(),
44
+ sortDirection: ProductReviewDirectionSchema.optional(),
42
45
  rating: zod.z.number().int().min(1).max(5).optional()
43
46
  });
47
+ const ProductWithReviewsSchema = require_models_products.ProductSummarySchema.extend({ reviews: zod.z.array(StorefrontReviewSchema) });
44
48
  const CreateProductReviewParamsSchema = zod.z.object({
45
49
  productId: require_models_ids.EntityIdSchema,
46
50
  rating: zod.z.number().int().min(1).max(5),
@@ -62,6 +66,9 @@ exports.CreateCustomerProductReviewParamsSchema = CreateCustomerProductReviewPar
62
66
  exports.CreateProductReviewParamsSchema = CreateProductReviewParamsSchema;
63
67
  exports.ListProductReviewsParamsSchema = ListProductReviewsParamsSchema;
64
68
  exports.ListStoreReviewsParamsSchema = ListStoreReviewsParamsSchema;
69
+ exports.ProductReviewDirectionSchema = ProductReviewDirectionSchema;
70
+ exports.ProductReviewSortSchema = ProductReviewSortSchema;
71
+ exports.ProductWithReviewsSchema = ProductWithReviewsSchema;
65
72
  exports.StorefrontReviewSchema = StorefrontReviewSchema;
66
73
  exports.StorefrontReviewsSchema = StorefrontReviewsSchema;
67
74
  exports.StorefrontStoreReviewSchema = StorefrontStoreReviewSchema;
@@ -38,6 +38,14 @@ export declare const StorefrontReviewsSchema: z.ZodObject<{
38
38
  nextCursor: z.ZodNullable<z.ZodString>;
39
39
  totalCount: z.ZodNullable<z.ZodNumber>;
40
40
  }, z.core.$strip>;
41
+ export declare const ProductReviewSortSchema: z.ZodEnum<{
42
+ createdOn: "createdOn";
43
+ rating: "rating";
44
+ }>;
45
+ export declare const ProductReviewDirectionSchema: z.ZodEnum<{
46
+ asc: "asc";
47
+ desc: "desc";
48
+ }>;
41
49
  export declare const ListProductReviewsParamsSchema: z.ZodObject<{
42
50
  productId: z.ZodString;
43
51
  limit: z.ZodOptional<z.ZodNumber>;
@@ -53,6 +61,97 @@ export declare const ListProductReviewsParamsSchema: z.ZodObject<{
53
61
  }>>;
54
62
  rating: z.ZodOptional<z.ZodNumber>;
55
63
  }, z.core.$strip>;
64
+ export declare const ProductWithReviewsSchema: z.ZodObject<{
65
+ id: z.ZodString;
66
+ name: z.ZodString;
67
+ slug: z.ZodString;
68
+ url: z.ZodString;
69
+ productType: z.ZodString;
70
+ imageUrl: z.ZodString;
71
+ price: z.ZodNumber;
72
+ compareAtPrice: z.ZodNullable<z.ZodNumber>;
73
+ variantCount: z.ZodNumber;
74
+ isAvailable: z.ZodBoolean;
75
+ totalInventory: z.ZodNumber;
76
+ bundleItemsCount: z.ZodNumber;
77
+ brand: z.ZodString;
78
+ category: z.ZodString;
79
+ status: z.ZodString;
80
+ collections: z.ZodArray<z.ZodString>;
81
+ tags: z.ZodArray<z.ZodString>;
82
+ seller: z.ZodNullable<z.ZodObject<{
83
+ id: z.ZodString;
84
+ name: z.ZodString;
85
+ slug: z.ZodString;
86
+ }, z.core.$strip>>;
87
+ options: z.ZodArray<z.ZodObject<{
88
+ key: z.ZodString;
89
+ name: z.ZodString;
90
+ type: z.ZodOptional<z.ZodEnum<{
91
+ checkbox: "checkbox";
92
+ colorPicker: "colorPicker";
93
+ datePicker: "datePicker";
94
+ dateTimePicker: "dateTimePicker";
95
+ file: "file";
96
+ input: "input";
97
+ number: "number";
98
+ select: "select";
99
+ textArea: "textArea";
100
+ timePicker: "timePicker";
101
+ url: "url";
102
+ }>>;
103
+ values: z.ZodArray<z.ZodObject<{
104
+ key: z.ZodString;
105
+ name: z.ZodString;
106
+ value: z.ZodString;
107
+ valueId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
108
+ valueName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
109
+ type: z.ZodOptional<z.ZodEnum<{
110
+ checkbox: "checkbox";
111
+ colorPicker: "colorPicker";
112
+ datePicker: "datePicker";
113
+ dateTimePicker: "dateTimePicker";
114
+ file: "file";
115
+ input: "input";
116
+ number: "number";
117
+ select: "select";
118
+ textArea: "textArea";
119
+ timePicker: "timePicker";
120
+ url: "url";
121
+ }>>;
122
+ color: z.ZodOptional<z.ZodNullable<z.ZodString>>;
123
+ imageUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
124
+ unit: z.ZodOptional<z.ZodNullable<z.ZodString>>;
125
+ }, z.core.$strip>>;
126
+ }, z.core.$strip>>;
127
+ images: z.ZodArray<z.ZodObject<{
128
+ url: z.ZodString;
129
+ name: z.ZodString;
130
+ order: z.ZodNumber;
131
+ type: z.ZodDefault<z.ZodCatch<z.ZodEnum<{
132
+ image: "image";
133
+ video: "video";
134
+ }>>>;
135
+ }, z.core.$strip>>;
136
+ availableVariantId: z.ZodNullable<z.ZodString>;
137
+ hasModifierGroups: z.ZodBoolean;
138
+ reviews: z.ZodArray<z.ZodObject<{
139
+ id: z.ZodString;
140
+ productId: z.ZodString;
141
+ isVerifiedPurchase: z.ZodBoolean;
142
+ rating: z.ZodNumber;
143
+ title: z.ZodNullable<z.ZodString>;
144
+ content: z.ZodString;
145
+ reviewerName: z.ZodNullable<z.ZodString>;
146
+ createdOn: z.ZodString;
147
+ }, z.core.$strip>>;
148
+ }, z.core.$strip>;
149
+ export type ProductWithReviews = z.infer<typeof ProductWithReviewsSchema>;
150
+ export type ProductReviewsOptions = {
151
+ limit?: number;
152
+ sortBy?: z.infer<typeof ProductReviewSortSchema>;
153
+ sortDirection?: z.infer<typeof ProductReviewDirectionSchema>;
154
+ };
56
155
  export declare const CreateProductReviewParamsSchema: z.ZodObject<{
57
156
  productId: z.ZodString;
58
157
  rating: z.ZodNumber;
@@ -38,6 +38,14 @@ export declare const StorefrontReviewsSchema: z.ZodObject<{
38
38
  nextCursor: z.ZodNullable<z.ZodString>;
39
39
  totalCount: z.ZodNullable<z.ZodNumber>;
40
40
  }, z.core.$strip>;
41
+ export declare const ProductReviewSortSchema: z.ZodEnum<{
42
+ createdOn: "createdOn";
43
+ rating: "rating";
44
+ }>;
45
+ export declare const ProductReviewDirectionSchema: z.ZodEnum<{
46
+ asc: "asc";
47
+ desc: "desc";
48
+ }>;
41
49
  export declare const ListProductReviewsParamsSchema: z.ZodObject<{
42
50
  productId: z.ZodString;
43
51
  limit: z.ZodOptional<z.ZodNumber>;
@@ -53,6 +61,97 @@ export declare const ListProductReviewsParamsSchema: z.ZodObject<{
53
61
  }>>;
54
62
  rating: z.ZodOptional<z.ZodNumber>;
55
63
  }, z.core.$strip>;
64
+ export declare const ProductWithReviewsSchema: z.ZodObject<{
65
+ id: z.ZodString;
66
+ name: z.ZodString;
67
+ slug: z.ZodString;
68
+ url: z.ZodString;
69
+ productType: z.ZodString;
70
+ imageUrl: z.ZodString;
71
+ price: z.ZodNumber;
72
+ compareAtPrice: z.ZodNullable<z.ZodNumber>;
73
+ variantCount: z.ZodNumber;
74
+ isAvailable: z.ZodBoolean;
75
+ totalInventory: z.ZodNumber;
76
+ bundleItemsCount: z.ZodNumber;
77
+ brand: z.ZodString;
78
+ category: z.ZodString;
79
+ status: z.ZodString;
80
+ collections: z.ZodArray<z.ZodString>;
81
+ tags: z.ZodArray<z.ZodString>;
82
+ seller: z.ZodNullable<z.ZodObject<{
83
+ id: z.ZodString;
84
+ name: z.ZodString;
85
+ slug: z.ZodString;
86
+ }, z.core.$strip>>;
87
+ options: z.ZodArray<z.ZodObject<{
88
+ key: z.ZodString;
89
+ name: z.ZodString;
90
+ type: z.ZodOptional<z.ZodEnum<{
91
+ checkbox: "checkbox";
92
+ colorPicker: "colorPicker";
93
+ datePicker: "datePicker";
94
+ dateTimePicker: "dateTimePicker";
95
+ file: "file";
96
+ input: "input";
97
+ number: "number";
98
+ select: "select";
99
+ textArea: "textArea";
100
+ timePicker: "timePicker";
101
+ url: "url";
102
+ }>>;
103
+ values: z.ZodArray<z.ZodObject<{
104
+ key: z.ZodString;
105
+ name: z.ZodString;
106
+ value: z.ZodString;
107
+ valueId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
108
+ valueName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
109
+ type: z.ZodOptional<z.ZodEnum<{
110
+ checkbox: "checkbox";
111
+ colorPicker: "colorPicker";
112
+ datePicker: "datePicker";
113
+ dateTimePicker: "dateTimePicker";
114
+ file: "file";
115
+ input: "input";
116
+ number: "number";
117
+ select: "select";
118
+ textArea: "textArea";
119
+ timePicker: "timePicker";
120
+ url: "url";
121
+ }>>;
122
+ color: z.ZodOptional<z.ZodNullable<z.ZodString>>;
123
+ imageUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
124
+ unit: z.ZodOptional<z.ZodNullable<z.ZodString>>;
125
+ }, z.core.$strip>>;
126
+ }, z.core.$strip>>;
127
+ images: z.ZodArray<z.ZodObject<{
128
+ url: z.ZodString;
129
+ name: z.ZodString;
130
+ order: z.ZodNumber;
131
+ type: z.ZodDefault<z.ZodCatch<z.ZodEnum<{
132
+ image: "image";
133
+ video: "video";
134
+ }>>>;
135
+ }, z.core.$strip>>;
136
+ availableVariantId: z.ZodNullable<z.ZodString>;
137
+ hasModifierGroups: z.ZodBoolean;
138
+ reviews: z.ZodArray<z.ZodObject<{
139
+ id: z.ZodString;
140
+ productId: z.ZodString;
141
+ isVerifiedPurchase: z.ZodBoolean;
142
+ rating: z.ZodNumber;
143
+ title: z.ZodNullable<z.ZodString>;
144
+ content: z.ZodString;
145
+ reviewerName: z.ZodNullable<z.ZodString>;
146
+ createdOn: z.ZodString;
147
+ }, z.core.$strip>>;
148
+ }, z.core.$strip>;
149
+ export type ProductWithReviews = z.infer<typeof ProductWithReviewsSchema>;
150
+ export type ProductReviewsOptions = {
151
+ limit?: number;
152
+ sortBy?: z.infer<typeof ProductReviewSortSchema>;
153
+ sortDirection?: z.infer<typeof ProductReviewDirectionSchema>;
154
+ };
56
155
  export declare const CreateProductReviewParamsSchema: z.ZodObject<{
57
156
  productId: z.ZodString;
58
157
  rating: z.ZodNumber;