ce-storefront 0.3.19 → 0.4.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 (103) hide show
  1. package/esm/lib/config.d.ts +2 -2
  2. package/esm/lib/config.js +2 -2
  3. package/esm/lib/config.js.map +1 -1
  4. package/esm/models/components/cartitem.d.ts +4 -4
  5. package/esm/models/components/cartitem.d.ts.map +1 -1
  6. package/esm/models/components/cartitem.js +8 -8
  7. package/esm/models/components/cartitem.js.map +1 -1
  8. package/esm/models/components/index.d.ts +3 -5
  9. package/esm/models/components/index.d.ts.map +1 -1
  10. package/esm/models/components/index.js +3 -5
  11. package/esm/models/components/index.js.map +1 -1
  12. package/esm/models/components/{singleproduct.d.ts → product.d.ts} +23 -20
  13. package/esm/models/components/product.d.ts.map +1 -0
  14. package/esm/models/components/{singleproduct.js → product.js} +31 -26
  15. package/esm/models/components/product.js.map +1 -0
  16. package/esm/models/components/productbundleitem.d.ts +142 -0
  17. package/esm/models/components/productbundleitem.d.ts.map +1 -0
  18. package/esm/models/components/productbundleitem.js +171 -0
  19. package/esm/models/components/productbundleitem.js.map +1 -0
  20. package/esm/models/components/productdetail.d.ts +139 -4
  21. package/esm/models/components/productdetail.d.ts.map +1 -1
  22. package/esm/models/components/productdetail.js +136 -10
  23. package/esm/models/components/productdetail.js.map +1 -1
  24. package/esm/models/components/productimage.d.ts +2 -0
  25. package/esm/models/components/productimage.d.ts.map +1 -1
  26. package/esm/models/components/productimage.js +2 -0
  27. package/esm/models/components/productimage.js.map +1 -1
  28. package/esm/models/components/productlist.d.ts +36 -0
  29. package/esm/models/components/productlist.d.ts.map +1 -0
  30. package/esm/models/components/productlist.js +35 -0
  31. package/esm/models/components/productlist.js.map +1 -0
  32. package/esm/models/components/sku.d.ts +5 -5
  33. package/esm/models/components/sku.d.ts.map +1 -1
  34. package/esm/models/components/sku.js +10 -10
  35. package/esm/models/components/sku.js.map +1 -1
  36. package/esm/models/components/variant.d.ts +3 -3
  37. package/esm/models/components/variant.d.ts.map +1 -1
  38. package/esm/models/components/variant.js +6 -6
  39. package/esm/models/components/variant.js.map +1 -1
  40. package/esm/models/components/variantdetail.d.ts +3 -3
  41. package/esm/models/components/variantdetail.d.ts.map +1 -1
  42. package/esm/models/components/variantdetail.js +6 -6
  43. package/esm/models/components/variantdetail.js.map +1 -1
  44. package/esm/models/operations/getcrosssell.d.ts +2 -2
  45. package/esm/models/operations/getcrosssell.d.ts.map +1 -1
  46. package/esm/models/operations/getcrosssell.js +2 -2
  47. package/esm/models/operations/getcrosssell.js.map +1 -1
  48. package/esm/models/operations/getproducts.d.ts +32 -2
  49. package/esm/models/operations/getproducts.d.ts.map +1 -1
  50. package/esm/models/operations/getproducts.js +29 -2
  51. package/esm/models/operations/getproducts.js.map +1 -1
  52. package/esm/models/operations/getsimilar.d.ts +2 -2
  53. package/esm/models/operations/getsimilar.d.ts.map +1 -1
  54. package/esm/models/operations/getsimilar.js +2 -2
  55. package/esm/models/operations/getsimilar.js.map +1 -1
  56. package/esm/models/operations/getskus.d.ts +15 -15
  57. package/esm/models/operations/getskus.d.ts.map +1 -1
  58. package/esm/models/operations/getskus.js +15 -15
  59. package/esm/models/operations/getskus.js.map +1 -1
  60. package/esm/models/operations/getupsell.d.ts +2 -2
  61. package/esm/models/operations/getupsell.d.ts.map +1 -1
  62. package/esm/models/operations/getupsell.js +2 -2
  63. package/esm/models/operations/getupsell.js.map +1 -1
  64. package/jsr.json +1 -1
  65. package/package.json +1 -1
  66. package/src/lib/config.ts +2 -2
  67. package/src/models/components/cartitem.ts +12 -12
  68. package/src/models/components/index.ts +3 -5
  69. package/src/models/components/{singleproduct.ts → product.ts} +81 -72
  70. package/src/models/components/productbundleitem.ts +329 -0
  71. package/src/models/components/productdetail.ts +295 -22
  72. package/src/models/components/productimage.ts +4 -0
  73. package/src/models/components/productlist.ts +81 -0
  74. package/src/models/components/sku.ts +15 -15
  75. package/src/models/components/variant.ts +9 -9
  76. package/src/models/components/variantdetail.ts +9 -9
  77. package/src/models/operations/getcrosssell.ts +4 -4
  78. package/src/models/operations/getproducts.ts +62 -4
  79. package/src/models/operations/getsimilar.ts +4 -4
  80. package/src/models/operations/getskus.ts +30 -27
  81. package/src/models/operations/getupsell.ts +4 -4
  82. package/esm/models/components/bundleproduct.d.ts +0 -236
  83. package/esm/models/components/bundleproduct.d.ts.map +0 -1
  84. package/esm/models/components/bundleproduct.js +0 -258
  85. package/esm/models/components/bundleproduct.js.map +0 -1
  86. package/esm/models/components/bundleproductdetail.d.ts +0 -265
  87. package/esm/models/components/bundleproductdetail.d.ts.map +0 -1
  88. package/esm/models/components/bundleproductdetail.js +0 -284
  89. package/esm/models/components/bundleproductdetail.js.map +0 -1
  90. package/esm/models/components/productlistresponse.d.ts +0 -58
  91. package/esm/models/components/productlistresponse.d.ts.map +0 -1
  92. package/esm/models/components/productlistresponse.js +0 -57
  93. package/esm/models/components/productlistresponse.js.map +0 -1
  94. package/esm/models/components/singleproduct.d.ts.map +0 -1
  95. package/esm/models/components/singleproduct.js.map +0 -1
  96. package/esm/models/components/singleproductdetail.d.ts +0 -159
  97. package/esm/models/components/singleproductdetail.d.ts.map +0 -1
  98. package/esm/models/components/singleproductdetail.js +0 -156
  99. package/esm/models/components/singleproductdetail.js.map +0 -1
  100. package/src/models/components/bundleproduct.ts +0 -494
  101. package/src/models/components/bundleproductdetail.ts +0 -560
  102. package/src/models/components/productlistresponse.ts +0 -141
  103. package/src/models/components/singleproductdetail.ts +0 -339
@@ -1,560 +0,0 @@
1
- /*
2
- * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
- */
4
-
5
- import * as z from "zod";
6
- import { remap as remap$ } from "../../lib/primitives.js";
7
- import { safeParse } from "../../lib/schemas.js";
8
- import { ClosedEnum } from "../../types/enums.js";
9
- import { Result as SafeParseResult } from "../../types/fp.js";
10
- import { SDKValidationError } from "../errors/sdkvalidationerror.js";
11
- import {
12
- AssociatedOption,
13
- AssociatedOption$inboundSchema,
14
- AssociatedOption$Outbound,
15
- AssociatedOption$outboundSchema,
16
- } from "./associatedoption.js";
17
- import {
18
- ProductAttribute,
19
- ProductAttribute$inboundSchema,
20
- ProductAttribute$Outbound,
21
- ProductAttribute$outboundSchema,
22
- } from "./productattribute.js";
23
- import {
24
- ProductImage,
25
- ProductImage$inboundSchema,
26
- ProductImage$Outbound,
27
- ProductImage$outboundSchema,
28
- } from "./productimage.js";
29
- import {
30
- ProductPricing,
31
- ProductPricing$inboundSchema,
32
- ProductPricing$Outbound,
33
- ProductPricing$outboundSchema,
34
- } from "./productpricing.js";
35
- import {
36
- ProductPromotion,
37
- ProductPromotion$inboundSchema,
38
- ProductPromotion$Outbound,
39
- ProductPromotion$outboundSchema,
40
- } from "./productpromotion.js";
41
- import {
42
- ProductShipping,
43
- ProductShipping$inboundSchema,
44
- ProductShipping$Outbound,
45
- ProductShipping$outboundSchema,
46
- } from "./productshipping.js";
47
- import {
48
- ProductSubscription,
49
- ProductSubscription$inboundSchema,
50
- ProductSubscription$Outbound,
51
- ProductSubscription$outboundSchema,
52
- } from "./productsubscription.js";
53
- import {
54
- ProductVideo,
55
- ProductVideo$inboundSchema,
56
- ProductVideo$Outbound,
57
- ProductVideo$outboundSchema,
58
- } from "./productvideo.js";
59
- import {
60
- Seo,
61
- Seo$inboundSchema,
62
- Seo$Outbound,
63
- Seo$outboundSchema,
64
- } from "./seo.js";
65
- import {
66
- VariantOption,
67
- VariantOption$inboundSchema,
68
- VariantOption$Outbound,
69
- VariantOption$outboundSchema,
70
- } from "./variantoption.js";
71
-
72
- export const BundleProductDetailProductType = {
73
- Physical: "physical",
74
- Digital: "digital",
75
- Bundle: "bundle",
76
- } as const;
77
- export type BundleProductDetailProductType = ClosedEnum<
78
- typeof BundleProductDetailProductType
79
- >;
80
-
81
- export const BundleProductDetailBundleItemsProductType = {
82
- Physical: "physical",
83
- Digital: "digital",
84
- Bundle: "bundle",
85
- } as const;
86
- export type BundleProductDetailBundleItemsProductType = ClosedEnum<
87
- typeof BundleProductDetailBundleItemsProductType
88
- >;
89
-
90
- export type BundleProductDetailSKU = {
91
- quantity: number;
92
- productId: string;
93
- variantId: string | null;
94
- sku: string;
95
- slug: string | null;
96
- productName: string;
97
- variantName: string | null;
98
- productType: BundleProductDetailBundleItemsProductType;
99
- shortDescription: string | null;
100
- active?: boolean | undefined;
101
- stockAvailable?: boolean | undefined;
102
- /**
103
- * Indicates whether this item is associated with any active (product-specific) coupons
104
- */
105
- onOffer?: boolean | undefined;
106
- onSubscription?: boolean | undefined;
107
- onPromotion?: boolean | undefined;
108
- categoryIds: Array<string>;
109
- tags: Array<string> | null;
110
- reviewsCount: number;
111
- reviewsRatingSum: number | null;
112
- attributes: Array<ProductAttribute>;
113
- images: Array<ProductImage>;
114
- pricing: ProductPricing;
115
- promotion: ProductPromotion | null;
116
- subscription: Array<ProductSubscription>;
117
- associatedOptions: { [k: string]: AssociatedOption } | null;
118
- };
119
-
120
- export type BundleProductDetail = {
121
- /**
122
- * The ULID of the product
123
- */
124
- id: string;
125
- sku: string | null;
126
- name: string;
127
- slug: string | null;
128
- shortDescription: string | null;
129
- productType: BundleProductDetailProductType;
130
- active?: boolean | undefined;
131
- /**
132
- * Indicates whether the product has stock available
133
- */
134
- stockAvailable?: boolean | undefined;
135
- /**
136
- * Indicates whether this item is associated with any active (product-specific) coupons
137
- */
138
- onOffer?: boolean | undefined;
139
- /**
140
- * Indicates whether the product has any subscription plans avaialble
141
- */
142
- onSubscription?: boolean | undefined;
143
- /**
144
- * Indicates whether the product is currently on promotion. When true, the `ProductPromotion` object will contain details of the promotion
145
- */
146
- onPromotion?: boolean | undefined;
147
- /**
148
- * Indicates whether the product has variants
149
- */
150
- hasVariant?: boolean | undefined;
151
- tags: Array<string> | null;
152
- categoryIds: Array<string>;
153
- reviewsRatingSum: number;
154
- reviewsCount: number;
155
- attributes: Array<ProductAttribute>;
156
- pricing: ProductPricing;
157
- /**
158
- * this will be used if has_variant is true, to auto set default values.
159
- */
160
- variantOptions: Array<VariantOption> | null;
161
- promotion: ProductPromotion | null;
162
- images: Array<ProductImage>;
163
- subscription: Array<ProductSubscription>;
164
- bundleItems: Array<BundleProductDetailSKU>;
165
- description: string | null;
166
- hsnCode: string | null;
167
- videos: Array<ProductVideo>;
168
- shipping: ProductShipping | null;
169
- /**
170
- * An array of product ULIDs
171
- */
172
- upsellingProductIds: Array<string>;
173
- /**
174
- * An array of product ULIDs
175
- */
176
- crosssellingProductIds: Array<string>;
177
- seo: Seo;
178
- metadata: { [k: string]: string };
179
- };
180
-
181
- /** @internal */
182
- export const BundleProductDetailProductType$inboundSchema: z.ZodNativeEnum<
183
- typeof BundleProductDetailProductType
184
- > = z.nativeEnum(BundleProductDetailProductType);
185
-
186
- /** @internal */
187
- export const BundleProductDetailProductType$outboundSchema: z.ZodNativeEnum<
188
- typeof BundleProductDetailProductType
189
- > = BundleProductDetailProductType$inboundSchema;
190
-
191
- /**
192
- * @internal
193
- * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
194
- */
195
- export namespace BundleProductDetailProductType$ {
196
- /** @deprecated use `BundleProductDetailProductType$inboundSchema` instead. */
197
- export const inboundSchema = BundleProductDetailProductType$inboundSchema;
198
- /** @deprecated use `BundleProductDetailProductType$outboundSchema` instead. */
199
- export const outboundSchema = BundleProductDetailProductType$outboundSchema;
200
- }
201
-
202
- /** @internal */
203
- export const BundleProductDetailBundleItemsProductType$inboundSchema:
204
- z.ZodNativeEnum<typeof BundleProductDetailBundleItemsProductType> = z
205
- .nativeEnum(BundleProductDetailBundleItemsProductType);
206
-
207
- /** @internal */
208
- export const BundleProductDetailBundleItemsProductType$outboundSchema:
209
- z.ZodNativeEnum<typeof BundleProductDetailBundleItemsProductType> =
210
- BundleProductDetailBundleItemsProductType$inboundSchema;
211
-
212
- /**
213
- * @internal
214
- * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
215
- */
216
- export namespace BundleProductDetailBundleItemsProductType$ {
217
- /** @deprecated use `BundleProductDetailBundleItemsProductType$inboundSchema` instead. */
218
- export const inboundSchema =
219
- BundleProductDetailBundleItemsProductType$inboundSchema;
220
- /** @deprecated use `BundleProductDetailBundleItemsProductType$outboundSchema` instead. */
221
- export const outboundSchema =
222
- BundleProductDetailBundleItemsProductType$outboundSchema;
223
- }
224
-
225
- /** @internal */
226
- export const BundleProductDetailSKU$inboundSchema: z.ZodType<
227
- BundleProductDetailSKU,
228
- z.ZodTypeDef,
229
- unknown
230
- > = z.object({
231
- quantity: z.number().int(),
232
- product_id: z.string(),
233
- variant_id: z.nullable(z.string()),
234
- sku: z.string(),
235
- slug: z.nullable(z.string()),
236
- product_name: z.string(),
237
- variant_name: z.nullable(z.string()),
238
- product_type: BundleProductDetailBundleItemsProductType$inboundSchema,
239
- short_description: z.nullable(z.string()),
240
- active: z.boolean().default(true),
241
- stock_available: z.boolean().default(true),
242
- on_offer: z.boolean().default(false),
243
- on_subscription: z.boolean().default(false),
244
- on_promotion: z.boolean().default(false),
245
- category_ids: z.array(z.string()),
246
- tags: z.nullable(z.array(z.string())),
247
- reviews_count: z.number().int(),
248
- reviews_rating_sum: z.nullable(z.number()),
249
- attributes: z.array(ProductAttribute$inboundSchema),
250
- images: z.array(ProductImage$inboundSchema),
251
- pricing: ProductPricing$inboundSchema,
252
- promotion: z.nullable(ProductPromotion$inboundSchema),
253
- subscription: z.array(ProductSubscription$inboundSchema),
254
- associated_options: z.nullable(z.record(AssociatedOption$inboundSchema)),
255
- }).transform((v) => {
256
- return remap$(v, {
257
- "product_id": "productId",
258
- "variant_id": "variantId",
259
- "product_name": "productName",
260
- "variant_name": "variantName",
261
- "product_type": "productType",
262
- "short_description": "shortDescription",
263
- "stock_available": "stockAvailable",
264
- "on_offer": "onOffer",
265
- "on_subscription": "onSubscription",
266
- "on_promotion": "onPromotion",
267
- "category_ids": "categoryIds",
268
- "reviews_count": "reviewsCount",
269
- "reviews_rating_sum": "reviewsRatingSum",
270
- "associated_options": "associatedOptions",
271
- });
272
- });
273
-
274
- /** @internal */
275
- export type BundleProductDetailSKU$Outbound = {
276
- quantity: number;
277
- product_id: string;
278
- variant_id: string | null;
279
- sku: string;
280
- slug: string | null;
281
- product_name: string;
282
- variant_name: string | null;
283
- product_type: string;
284
- short_description: string | null;
285
- active: boolean;
286
- stock_available: boolean;
287
- on_offer: boolean;
288
- on_subscription: boolean;
289
- on_promotion: boolean;
290
- category_ids: Array<string>;
291
- tags: Array<string> | null;
292
- reviews_count: number;
293
- reviews_rating_sum: number | null;
294
- attributes: Array<ProductAttribute$Outbound>;
295
- images: Array<ProductImage$Outbound>;
296
- pricing: ProductPricing$Outbound;
297
- promotion: ProductPromotion$Outbound | null;
298
- subscription: Array<ProductSubscription$Outbound>;
299
- associated_options: { [k: string]: AssociatedOption$Outbound } | null;
300
- };
301
-
302
- /** @internal */
303
- export const BundleProductDetailSKU$outboundSchema: z.ZodType<
304
- BundleProductDetailSKU$Outbound,
305
- z.ZodTypeDef,
306
- BundleProductDetailSKU
307
- > = z.object({
308
- quantity: z.number().int(),
309
- productId: z.string(),
310
- variantId: z.nullable(z.string()),
311
- sku: z.string(),
312
- slug: z.nullable(z.string()),
313
- productName: z.string(),
314
- variantName: z.nullable(z.string()),
315
- productType: BundleProductDetailBundleItemsProductType$outboundSchema,
316
- shortDescription: z.nullable(z.string()),
317
- active: z.boolean().default(true),
318
- stockAvailable: z.boolean().default(true),
319
- onOffer: z.boolean().default(false),
320
- onSubscription: z.boolean().default(false),
321
- onPromotion: z.boolean().default(false),
322
- categoryIds: z.array(z.string()),
323
- tags: z.nullable(z.array(z.string())),
324
- reviewsCount: z.number().int(),
325
- reviewsRatingSum: z.nullable(z.number()),
326
- attributes: z.array(ProductAttribute$outboundSchema),
327
- images: z.array(ProductImage$outboundSchema),
328
- pricing: ProductPricing$outboundSchema,
329
- promotion: z.nullable(ProductPromotion$outboundSchema),
330
- subscription: z.array(ProductSubscription$outboundSchema),
331
- associatedOptions: z.nullable(z.record(AssociatedOption$outboundSchema)),
332
- }).transform((v) => {
333
- return remap$(v, {
334
- productId: "product_id",
335
- variantId: "variant_id",
336
- productName: "product_name",
337
- variantName: "variant_name",
338
- productType: "product_type",
339
- shortDescription: "short_description",
340
- stockAvailable: "stock_available",
341
- onOffer: "on_offer",
342
- onSubscription: "on_subscription",
343
- onPromotion: "on_promotion",
344
- categoryIds: "category_ids",
345
- reviewsCount: "reviews_count",
346
- reviewsRatingSum: "reviews_rating_sum",
347
- associatedOptions: "associated_options",
348
- });
349
- });
350
-
351
- /**
352
- * @internal
353
- * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
354
- */
355
- export namespace BundleProductDetailSKU$ {
356
- /** @deprecated use `BundleProductDetailSKU$inboundSchema` instead. */
357
- export const inboundSchema = BundleProductDetailSKU$inboundSchema;
358
- /** @deprecated use `BundleProductDetailSKU$outboundSchema` instead. */
359
- export const outboundSchema = BundleProductDetailSKU$outboundSchema;
360
- /** @deprecated use `BundleProductDetailSKU$Outbound` instead. */
361
- export type Outbound = BundleProductDetailSKU$Outbound;
362
- }
363
-
364
- export function bundleProductDetailSKUToJSON(
365
- bundleProductDetailSKU: BundleProductDetailSKU,
366
- ): string {
367
- return JSON.stringify(
368
- BundleProductDetailSKU$outboundSchema.parse(bundleProductDetailSKU),
369
- );
370
- }
371
-
372
- export function bundleProductDetailSKUFromJSON(
373
- jsonString: string,
374
- ): SafeParseResult<BundleProductDetailSKU, SDKValidationError> {
375
- return safeParse(
376
- jsonString,
377
- (x) => BundleProductDetailSKU$inboundSchema.parse(JSON.parse(x)),
378
- `Failed to parse 'BundleProductDetailSKU' from JSON`,
379
- );
380
- }
381
-
382
- /** @internal */
383
- export const BundleProductDetail$inboundSchema: z.ZodType<
384
- BundleProductDetail,
385
- z.ZodTypeDef,
386
- unknown
387
- > = z.object({
388
- id: z.string(),
389
- sku: z.nullable(z.string()),
390
- name: z.string(),
391
- slug: z.nullable(z.string()),
392
- short_description: z.nullable(z.string()),
393
- product_type: BundleProductDetailProductType$inboundSchema,
394
- active: z.boolean().default(true),
395
- stock_available: z.boolean().default(true),
396
- on_offer: z.boolean().default(false),
397
- on_subscription: z.boolean().default(false),
398
- on_promotion: z.boolean().default(false),
399
- has_variant: z.boolean().default(false),
400
- tags: z.nullable(z.array(z.string())),
401
- category_ids: z.array(z.string()),
402
- reviews_rating_sum: z.number(),
403
- reviews_count: z.number().int(),
404
- attributes: z.array(ProductAttribute$inboundSchema),
405
- pricing: ProductPricing$inboundSchema,
406
- variant_options: z.nullable(z.array(VariantOption$inboundSchema)),
407
- promotion: z.nullable(ProductPromotion$inboundSchema),
408
- images: z.array(ProductImage$inboundSchema),
409
- subscription: z.array(ProductSubscription$inboundSchema),
410
- bundle_items: z.array(z.lazy(() => BundleProductDetailSKU$inboundSchema)),
411
- description: z.nullable(z.string()),
412
- hsn_code: z.nullable(z.string()),
413
- videos: z.array(ProductVideo$inboundSchema),
414
- shipping: z.nullable(ProductShipping$inboundSchema),
415
- upselling_product_ids: z.array(z.string()),
416
- crossselling_product_ids: z.array(z.string()),
417
- seo: Seo$inboundSchema,
418
- metadata: z.record(z.string()),
419
- }).transform((v) => {
420
- return remap$(v, {
421
- "short_description": "shortDescription",
422
- "product_type": "productType",
423
- "stock_available": "stockAvailable",
424
- "on_offer": "onOffer",
425
- "on_subscription": "onSubscription",
426
- "on_promotion": "onPromotion",
427
- "has_variant": "hasVariant",
428
- "category_ids": "categoryIds",
429
- "reviews_rating_sum": "reviewsRatingSum",
430
- "reviews_count": "reviewsCount",
431
- "variant_options": "variantOptions",
432
- "bundle_items": "bundleItems",
433
- "hsn_code": "hsnCode",
434
- "upselling_product_ids": "upsellingProductIds",
435
- "crossselling_product_ids": "crosssellingProductIds",
436
- });
437
- });
438
-
439
- /** @internal */
440
- export type BundleProductDetail$Outbound = {
441
- id: string;
442
- sku: string | null;
443
- name: string;
444
- slug: string | null;
445
- short_description: string | null;
446
- product_type: string;
447
- active: boolean;
448
- stock_available: boolean;
449
- on_offer: boolean;
450
- on_subscription: boolean;
451
- on_promotion: boolean;
452
- has_variant: boolean;
453
- tags: Array<string> | null;
454
- category_ids: Array<string>;
455
- reviews_rating_sum: number;
456
- reviews_count: number;
457
- attributes: Array<ProductAttribute$Outbound>;
458
- pricing: ProductPricing$Outbound;
459
- variant_options: Array<VariantOption$Outbound> | null;
460
- promotion: ProductPromotion$Outbound | null;
461
- images: Array<ProductImage$Outbound>;
462
- subscription: Array<ProductSubscription$Outbound>;
463
- bundle_items: Array<BundleProductDetailSKU$Outbound>;
464
- description: string | null;
465
- hsn_code: string | null;
466
- videos: Array<ProductVideo$Outbound>;
467
- shipping: ProductShipping$Outbound | null;
468
- upselling_product_ids: Array<string>;
469
- crossselling_product_ids: Array<string>;
470
- seo: Seo$Outbound;
471
- metadata: { [k: string]: string };
472
- };
473
-
474
- /** @internal */
475
- export const BundleProductDetail$outboundSchema: z.ZodType<
476
- BundleProductDetail$Outbound,
477
- z.ZodTypeDef,
478
- BundleProductDetail
479
- > = z.object({
480
- id: z.string(),
481
- sku: z.nullable(z.string()),
482
- name: z.string(),
483
- slug: z.nullable(z.string()),
484
- shortDescription: z.nullable(z.string()),
485
- productType: BundleProductDetailProductType$outboundSchema,
486
- active: z.boolean().default(true),
487
- stockAvailable: z.boolean().default(true),
488
- onOffer: z.boolean().default(false),
489
- onSubscription: z.boolean().default(false),
490
- onPromotion: z.boolean().default(false),
491
- hasVariant: z.boolean().default(false),
492
- tags: z.nullable(z.array(z.string())),
493
- categoryIds: z.array(z.string()),
494
- reviewsRatingSum: z.number(),
495
- reviewsCount: z.number().int(),
496
- attributes: z.array(ProductAttribute$outboundSchema),
497
- pricing: ProductPricing$outboundSchema,
498
- variantOptions: z.nullable(z.array(VariantOption$outboundSchema)),
499
- promotion: z.nullable(ProductPromotion$outboundSchema),
500
- images: z.array(ProductImage$outboundSchema),
501
- subscription: z.array(ProductSubscription$outboundSchema),
502
- bundleItems: z.array(z.lazy(() => BundleProductDetailSKU$outboundSchema)),
503
- description: z.nullable(z.string()),
504
- hsnCode: z.nullable(z.string()),
505
- videos: z.array(ProductVideo$outboundSchema),
506
- shipping: z.nullable(ProductShipping$outboundSchema),
507
- upsellingProductIds: z.array(z.string()),
508
- crosssellingProductIds: z.array(z.string()),
509
- seo: Seo$outboundSchema,
510
- metadata: z.record(z.string()),
511
- }).transform((v) => {
512
- return remap$(v, {
513
- shortDescription: "short_description",
514
- productType: "product_type",
515
- stockAvailable: "stock_available",
516
- onOffer: "on_offer",
517
- onSubscription: "on_subscription",
518
- onPromotion: "on_promotion",
519
- hasVariant: "has_variant",
520
- categoryIds: "category_ids",
521
- reviewsRatingSum: "reviews_rating_sum",
522
- reviewsCount: "reviews_count",
523
- variantOptions: "variant_options",
524
- bundleItems: "bundle_items",
525
- hsnCode: "hsn_code",
526
- upsellingProductIds: "upselling_product_ids",
527
- crosssellingProductIds: "crossselling_product_ids",
528
- });
529
- });
530
-
531
- /**
532
- * @internal
533
- * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
534
- */
535
- export namespace BundleProductDetail$ {
536
- /** @deprecated use `BundleProductDetail$inboundSchema` instead. */
537
- export const inboundSchema = BundleProductDetail$inboundSchema;
538
- /** @deprecated use `BundleProductDetail$outboundSchema` instead. */
539
- export const outboundSchema = BundleProductDetail$outboundSchema;
540
- /** @deprecated use `BundleProductDetail$Outbound` instead. */
541
- export type Outbound = BundleProductDetail$Outbound;
542
- }
543
-
544
- export function bundleProductDetailToJSON(
545
- bundleProductDetail: BundleProductDetail,
546
- ): string {
547
- return JSON.stringify(
548
- BundleProductDetail$outboundSchema.parse(bundleProductDetail),
549
- );
550
- }
551
-
552
- export function bundleProductDetailFromJSON(
553
- jsonString: string,
554
- ): SafeParseResult<BundleProductDetail, SDKValidationError> {
555
- return safeParse(
556
- jsonString,
557
- (x) => BundleProductDetail$inboundSchema.parse(JSON.parse(x)),
558
- `Failed to parse 'BundleProductDetail' from JSON`,
559
- );
560
- }
@@ -1,141 +0,0 @@
1
- /*
2
- * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
- */
4
-
5
- import * as z from "zod";
6
- import { safeParse } from "../../lib/schemas.js";
7
- import { Result as SafeParseResult } from "../../types/fp.js";
8
- import { SDKValidationError } from "../errors/sdkvalidationerror.js";
9
- import {
10
- BundleProduct,
11
- BundleProduct$inboundSchema,
12
- BundleProduct$Outbound,
13
- BundleProduct$outboundSchema,
14
- } from "./bundleproduct.js";
15
- import {
16
- Pagination,
17
- Pagination$inboundSchema,
18
- Pagination$Outbound,
19
- Pagination$outboundSchema,
20
- } from "./pagination.js";
21
- import {
22
- SingleProduct,
23
- SingleProduct$inboundSchema,
24
- SingleProduct$Outbound,
25
- SingleProduct$outboundSchema,
26
- } from "./singleproduct.js";
27
-
28
- export type Products = SingleProduct | BundleProduct;
29
-
30
- export type ProductListResponse = {
31
- products: Array<SingleProduct | BundleProduct>;
32
- /**
33
- * pagination metadata structure
34
- */
35
- pagination: Pagination;
36
- };
37
-
38
- /** @internal */
39
- export const Products$inboundSchema: z.ZodType<
40
- Products,
41
- z.ZodTypeDef,
42
- unknown
43
- > = z.union([SingleProduct$inboundSchema, BundleProduct$inboundSchema]);
44
-
45
- /** @internal */
46
- export type Products$Outbound = SingleProduct$Outbound | BundleProduct$Outbound;
47
-
48
- /** @internal */
49
- export const Products$outboundSchema: z.ZodType<
50
- Products$Outbound,
51
- z.ZodTypeDef,
52
- Products
53
- > = z.union([SingleProduct$outboundSchema, BundleProduct$outboundSchema]);
54
-
55
- /**
56
- * @internal
57
- * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
58
- */
59
- export namespace Products$ {
60
- /** @deprecated use `Products$inboundSchema` instead. */
61
- export const inboundSchema = Products$inboundSchema;
62
- /** @deprecated use `Products$outboundSchema` instead. */
63
- export const outboundSchema = Products$outboundSchema;
64
- /** @deprecated use `Products$Outbound` instead. */
65
- export type Outbound = Products$Outbound;
66
- }
67
-
68
- export function productsToJSON(products: Products): string {
69
- return JSON.stringify(Products$outboundSchema.parse(products));
70
- }
71
-
72
- export function productsFromJSON(
73
- jsonString: string,
74
- ): SafeParseResult<Products, SDKValidationError> {
75
- return safeParse(
76
- jsonString,
77
- (x) => Products$inboundSchema.parse(JSON.parse(x)),
78
- `Failed to parse 'Products' from JSON`,
79
- );
80
- }
81
-
82
- /** @internal */
83
- export const ProductListResponse$inboundSchema: z.ZodType<
84
- ProductListResponse,
85
- z.ZodTypeDef,
86
- unknown
87
- > = z.object({
88
- products: z.array(
89
- z.union([SingleProduct$inboundSchema, BundleProduct$inboundSchema]),
90
- ),
91
- pagination: Pagination$inboundSchema,
92
- });
93
-
94
- /** @internal */
95
- export type ProductListResponse$Outbound = {
96
- products: Array<SingleProduct$Outbound | BundleProduct$Outbound>;
97
- pagination: Pagination$Outbound;
98
- };
99
-
100
- /** @internal */
101
- export const ProductListResponse$outboundSchema: z.ZodType<
102
- ProductListResponse$Outbound,
103
- z.ZodTypeDef,
104
- ProductListResponse
105
- > = z.object({
106
- products: z.array(
107
- z.union([SingleProduct$outboundSchema, BundleProduct$outboundSchema]),
108
- ),
109
- pagination: Pagination$outboundSchema,
110
- });
111
-
112
- /**
113
- * @internal
114
- * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
115
- */
116
- export namespace ProductListResponse$ {
117
- /** @deprecated use `ProductListResponse$inboundSchema` instead. */
118
- export const inboundSchema = ProductListResponse$inboundSchema;
119
- /** @deprecated use `ProductListResponse$outboundSchema` instead. */
120
- export const outboundSchema = ProductListResponse$outboundSchema;
121
- /** @deprecated use `ProductListResponse$Outbound` instead. */
122
- export type Outbound = ProductListResponse$Outbound;
123
- }
124
-
125
- export function productListResponseToJSON(
126
- productListResponse: ProductListResponse,
127
- ): string {
128
- return JSON.stringify(
129
- ProductListResponse$outboundSchema.parse(productListResponse),
130
- );
131
- }
132
-
133
- export function productListResponseFromJSON(
134
- jsonString: string,
135
- ): SafeParseResult<ProductListResponse, SDKValidationError> {
136
- return safeParse(
137
- jsonString,
138
- (x) => ProductListResponse$inboundSchema.parse(JSON.parse(x)),
139
- `Failed to parse 'ProductListResponse' from JSON`,
140
- );
141
- }