ce-storefront 0.3.6 → 0.3.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/lib/config.d.ts +2 -2
- package/esm/lib/config.js +2 -2
- package/esm/models/components/bundleproduct.d.ts +236 -0
- package/esm/models/components/bundleproduct.d.ts.map +1 -0
- package/esm/models/components/bundleproduct.js +262 -0
- package/esm/models/components/bundleproduct.js.map +1 -0
- package/esm/models/components/bundleproductdetail.d.ts +265 -0
- package/esm/models/components/bundleproductdetail.d.ts.map +1 -0
- package/esm/models/components/bundleproductdetail.js +288 -0
- package/esm/models/components/bundleproductdetail.js.map +1 -0
- package/esm/models/components/index.d.ts +4 -1
- package/esm/models/components/index.d.ts.map +1 -1
- package/esm/models/components/index.js +4 -1
- package/esm/models/components/index.js.map +1 -1
- package/esm/models/components/productdetail.d.ts +16 -86
- package/esm/models/components/productdetail.d.ts.map +1 -1
- package/esm/models/components/productdetail.js +20 -88
- package/esm/models/components/productdetail.js.map +1 -1
- package/esm/models/components/productlistresponse.d.ts +6 -5
- package/esm/models/components/productlistresponse.d.ts.map +1 -1
- package/esm/models/components/productlistresponse.js +6 -5
- package/esm/models/components/productlistresponse.js.map +1 -1
- package/esm/models/components/productpricing.d.ts +12 -12
- package/esm/models/components/productpricing.d.ts.map +1 -1
- package/esm/models/components/productpricing.js +12 -12
- package/esm/models/components/productpricing.js.map +1 -1
- package/esm/models/components/productshipping.d.ts +13 -13
- package/esm/models/components/productshipping.d.ts.map +1 -1
- package/esm/models/components/productshipping.js +14 -14
- package/esm/models/components/productshipping.js.map +1 -1
- package/esm/models/components/{product.d.ts → singleproduct.d.ts} +39 -24
- package/esm/models/components/singleproduct.d.ts.map +1 -0
- package/esm/models/components/{product.js → singleproduct.js} +24 -25
- package/esm/models/components/singleproduct.js.map +1 -0
- package/esm/models/components/singleproductdetail.d.ts +159 -0
- package/esm/models/components/singleproductdetail.d.ts.map +1 -0
- package/esm/models/components/singleproductdetail.js +156 -0
- package/esm/models/components/singleproductdetail.js.map +1 -0
- package/esm/models/components/sku.d.ts +7 -4
- package/esm/models/components/sku.d.ts.map +1 -1
- package/esm/models/components/sku.js +6 -4
- package/esm/models/components/sku.js.map +1 -1
- package/esm/models/components/variant.d.ts +39 -30
- package/esm/models/components/variant.d.ts.map +1 -1
- package/esm/models/components/variant.js +38 -31
- package/esm/models/components/variant.js.map +1 -1
- package/esm/models/components/variantdetail.d.ts +89 -27
- package/esm/models/components/variantdetail.d.ts.map +1 -1
- package/esm/models/components/variantdetail.js +93 -28
- package/esm/models/components/variantdetail.js.map +1 -1
- package/jsr.json +1 -1
- package/package.json +1 -1
- package/src/lib/config.ts +2 -2
- package/src/models/components/bundleproduct.ts +501 -0
- package/src/models/components/bundleproductdetail.ts +567 -0
- package/src/models/components/index.ts +4 -1
- package/src/models/components/productdetail.ts +50 -198
- package/src/models/components/productlistresponse.ts +23 -13
- package/src/models/components/productpricing.ts +24 -24
- package/src/models/components/productshipping.ts +27 -27
- package/src/models/components/{product.ts → singleproduct.ts} +90 -73
- package/src/models/components/singleproductdetail.ts +339 -0
- package/src/models/components/sku.ts +16 -8
- package/src/models/components/variant.ts +75 -59
- package/src/models/components/variantdetail.ts +168 -55
- package/esm/models/components/product.d.ts.map +0 -1
- package/esm/models/components/product.js.map +0 -1
|
@@ -0,0 +1,501 @@
|
|
|
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
|
+
ProductSubscription,
|
|
43
|
+
ProductSubscription$inboundSchema,
|
|
44
|
+
ProductSubscription$Outbound,
|
|
45
|
+
ProductSubscription$outboundSchema,
|
|
46
|
+
} from "./productsubscription.js";
|
|
47
|
+
import {
|
|
48
|
+
VariantOption,
|
|
49
|
+
VariantOption$inboundSchema,
|
|
50
|
+
VariantOption$Outbound,
|
|
51
|
+
VariantOption$outboundSchema,
|
|
52
|
+
} from "./variantoption.js";
|
|
53
|
+
|
|
54
|
+
export const BundleProductProductType = {
|
|
55
|
+
Physical: "physical",
|
|
56
|
+
Digital: "digital",
|
|
57
|
+
Bundle: "bundle",
|
|
58
|
+
} as const;
|
|
59
|
+
export type BundleProductProductType = ClosedEnum<
|
|
60
|
+
typeof BundleProductProductType
|
|
61
|
+
>;
|
|
62
|
+
|
|
63
|
+
export const BundleProductBundleItemsProductType = {
|
|
64
|
+
Physical: "physical",
|
|
65
|
+
Digital: "digital",
|
|
66
|
+
Bundle: "bundle",
|
|
67
|
+
} as const;
|
|
68
|
+
export type BundleProductBundleItemsProductType = ClosedEnum<
|
|
69
|
+
typeof BundleProductBundleItemsProductType
|
|
70
|
+
>;
|
|
71
|
+
|
|
72
|
+
export type BundleProductSKU = {
|
|
73
|
+
quantity: number;
|
|
74
|
+
productId: string;
|
|
75
|
+
variantId?: string | null | undefined;
|
|
76
|
+
sku: string;
|
|
77
|
+
slug?: string | undefined;
|
|
78
|
+
productName: string;
|
|
79
|
+
variantName?: string | null | undefined;
|
|
80
|
+
productType: BundleProductBundleItemsProductType;
|
|
81
|
+
shortDescription?: string | undefined;
|
|
82
|
+
active?: boolean | undefined;
|
|
83
|
+
stockAvailable?: boolean | undefined;
|
|
84
|
+
/**
|
|
85
|
+
* Indicates whether this item is associated with any active (product-specific) coupons
|
|
86
|
+
*/
|
|
87
|
+
onOffer?: boolean | undefined;
|
|
88
|
+
onSubscription?: boolean | undefined;
|
|
89
|
+
onPromotion?: boolean | undefined;
|
|
90
|
+
categoryIds?: Array<string> | undefined;
|
|
91
|
+
tags?: Array<string> | undefined;
|
|
92
|
+
reviewsCount?: number | undefined;
|
|
93
|
+
reviewsRatingSum?: number | undefined;
|
|
94
|
+
attributes?: Array<ProductAttribute> | undefined;
|
|
95
|
+
images?: Array<ProductImage> | undefined;
|
|
96
|
+
pricing?: ProductPricing | undefined;
|
|
97
|
+
promotion?: ProductPromotion | null | undefined;
|
|
98
|
+
subscription?: Array<ProductSubscription> | undefined;
|
|
99
|
+
associatedOptions?: { [k: string]: AssociatedOption } | null | undefined;
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
export type BundleProduct = {
|
|
103
|
+
/**
|
|
104
|
+
* The ULID of the product
|
|
105
|
+
*/
|
|
106
|
+
id: string;
|
|
107
|
+
sku?: string | undefined;
|
|
108
|
+
name: string;
|
|
109
|
+
slug: string;
|
|
110
|
+
shortDescription?: string | undefined;
|
|
111
|
+
productType: BundleProductProductType;
|
|
112
|
+
active?: boolean | undefined;
|
|
113
|
+
/**
|
|
114
|
+
* Indicates whether the product has stock available
|
|
115
|
+
*/
|
|
116
|
+
stockAvailable?: boolean | undefined;
|
|
117
|
+
/**
|
|
118
|
+
* Indicates whether this item is associated with any active (product-specific) coupons
|
|
119
|
+
*/
|
|
120
|
+
onOffer?: boolean | undefined;
|
|
121
|
+
/**
|
|
122
|
+
* Indicates whether the product has any subscription plans avaialble
|
|
123
|
+
*/
|
|
124
|
+
onSubscription?: boolean | undefined;
|
|
125
|
+
/**
|
|
126
|
+
* Indicates whether the product is currently on promotion. When true, the `ProductPromotion` object will contain details of the promotion
|
|
127
|
+
*/
|
|
128
|
+
onPromotion?: boolean | undefined;
|
|
129
|
+
/**
|
|
130
|
+
* Indicates whether the product has variants
|
|
131
|
+
*/
|
|
132
|
+
hasVariant?: boolean | undefined;
|
|
133
|
+
tags?: Array<string> | null | undefined;
|
|
134
|
+
categoryIds?: Array<string> | undefined;
|
|
135
|
+
reviewsRatingSum?: number | undefined;
|
|
136
|
+
reviewsCount?: number | undefined;
|
|
137
|
+
attributes?: Array<ProductAttribute> | undefined;
|
|
138
|
+
pricing: ProductPricing;
|
|
139
|
+
/**
|
|
140
|
+
* this will be used if has_variant is true, to auto set default values.
|
|
141
|
+
*/
|
|
142
|
+
variantOptions: Array<VariantOption> | null;
|
|
143
|
+
promotion: ProductPromotion | null;
|
|
144
|
+
images: Array<ProductImage>;
|
|
145
|
+
subscription: Array<ProductSubscription>;
|
|
146
|
+
bundleItems?: Array<BundleProductSKU> | undefined;
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
/** @internal */
|
|
150
|
+
export const BundleProductProductType$inboundSchema: z.ZodNativeEnum<
|
|
151
|
+
typeof BundleProductProductType
|
|
152
|
+
> = z.nativeEnum(BundleProductProductType);
|
|
153
|
+
|
|
154
|
+
/** @internal */
|
|
155
|
+
export const BundleProductProductType$outboundSchema: z.ZodNativeEnum<
|
|
156
|
+
typeof BundleProductProductType
|
|
157
|
+
> = BundleProductProductType$inboundSchema;
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* @internal
|
|
161
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
162
|
+
*/
|
|
163
|
+
export namespace BundleProductProductType$ {
|
|
164
|
+
/** @deprecated use `BundleProductProductType$inboundSchema` instead. */
|
|
165
|
+
export const inboundSchema = BundleProductProductType$inboundSchema;
|
|
166
|
+
/** @deprecated use `BundleProductProductType$outboundSchema` instead. */
|
|
167
|
+
export const outboundSchema = BundleProductProductType$outboundSchema;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/** @internal */
|
|
171
|
+
export const BundleProductBundleItemsProductType$inboundSchema: z.ZodNativeEnum<
|
|
172
|
+
typeof BundleProductBundleItemsProductType
|
|
173
|
+
> = z.nativeEnum(BundleProductBundleItemsProductType);
|
|
174
|
+
|
|
175
|
+
/** @internal */
|
|
176
|
+
export const BundleProductBundleItemsProductType$outboundSchema:
|
|
177
|
+
z.ZodNativeEnum<typeof BundleProductBundleItemsProductType> =
|
|
178
|
+
BundleProductBundleItemsProductType$inboundSchema;
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* @internal
|
|
182
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
183
|
+
*/
|
|
184
|
+
export namespace BundleProductBundleItemsProductType$ {
|
|
185
|
+
/** @deprecated use `BundleProductBundleItemsProductType$inboundSchema` instead. */
|
|
186
|
+
export const inboundSchema =
|
|
187
|
+
BundleProductBundleItemsProductType$inboundSchema;
|
|
188
|
+
/** @deprecated use `BundleProductBundleItemsProductType$outboundSchema` instead. */
|
|
189
|
+
export const outboundSchema =
|
|
190
|
+
BundleProductBundleItemsProductType$outboundSchema;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/** @internal */
|
|
194
|
+
export const BundleProductSKU$inboundSchema: z.ZodType<
|
|
195
|
+
BundleProductSKU,
|
|
196
|
+
z.ZodTypeDef,
|
|
197
|
+
unknown
|
|
198
|
+
> = z.object({
|
|
199
|
+
quantity: z.number().int(),
|
|
200
|
+
product_id: z.string(),
|
|
201
|
+
variant_id: z.nullable(z.string()).optional(),
|
|
202
|
+
sku: z.string(),
|
|
203
|
+
slug: z.string().optional(),
|
|
204
|
+
product_name: z.string(),
|
|
205
|
+
variant_name: z.nullable(z.string()).optional(),
|
|
206
|
+
product_type: BundleProductBundleItemsProductType$inboundSchema,
|
|
207
|
+
short_description: z.string().optional(),
|
|
208
|
+
active: z.boolean().default(true),
|
|
209
|
+
stock_available: z.boolean().default(true),
|
|
210
|
+
on_offer: z.boolean().default(false),
|
|
211
|
+
on_subscription: z.boolean().default(false),
|
|
212
|
+
on_promotion: z.boolean().default(false),
|
|
213
|
+
category_ids: z.array(z.string()).optional(),
|
|
214
|
+
tags: z.array(z.string()).optional(),
|
|
215
|
+
reviews_count: z.number().int().optional(),
|
|
216
|
+
reviews_rating_sum: z.number().optional(),
|
|
217
|
+
attributes: z.array(ProductAttribute$inboundSchema).optional(),
|
|
218
|
+
images: z.array(ProductImage$inboundSchema).optional(),
|
|
219
|
+
pricing: ProductPricing$inboundSchema.optional(),
|
|
220
|
+
promotion: z.nullable(ProductPromotion$inboundSchema).optional(),
|
|
221
|
+
subscription: z.array(ProductSubscription$inboundSchema).optional(),
|
|
222
|
+
associated_options: z.nullable(z.record(AssociatedOption$inboundSchema))
|
|
223
|
+
.optional(),
|
|
224
|
+
}).transform((v) => {
|
|
225
|
+
return remap$(v, {
|
|
226
|
+
"product_id": "productId",
|
|
227
|
+
"variant_id": "variantId",
|
|
228
|
+
"product_name": "productName",
|
|
229
|
+
"variant_name": "variantName",
|
|
230
|
+
"product_type": "productType",
|
|
231
|
+
"short_description": "shortDescription",
|
|
232
|
+
"stock_available": "stockAvailable",
|
|
233
|
+
"on_offer": "onOffer",
|
|
234
|
+
"on_subscription": "onSubscription",
|
|
235
|
+
"on_promotion": "onPromotion",
|
|
236
|
+
"category_ids": "categoryIds",
|
|
237
|
+
"reviews_count": "reviewsCount",
|
|
238
|
+
"reviews_rating_sum": "reviewsRatingSum",
|
|
239
|
+
"associated_options": "associatedOptions",
|
|
240
|
+
});
|
|
241
|
+
});
|
|
242
|
+
|
|
243
|
+
/** @internal */
|
|
244
|
+
export type BundleProductSKU$Outbound = {
|
|
245
|
+
quantity: number;
|
|
246
|
+
product_id: string;
|
|
247
|
+
variant_id?: string | null | undefined;
|
|
248
|
+
sku: string;
|
|
249
|
+
slug?: string | undefined;
|
|
250
|
+
product_name: string;
|
|
251
|
+
variant_name?: string | null | undefined;
|
|
252
|
+
product_type: string;
|
|
253
|
+
short_description?: string | undefined;
|
|
254
|
+
active: boolean;
|
|
255
|
+
stock_available: boolean;
|
|
256
|
+
on_offer: boolean;
|
|
257
|
+
on_subscription: boolean;
|
|
258
|
+
on_promotion: boolean;
|
|
259
|
+
category_ids?: Array<string> | undefined;
|
|
260
|
+
tags?: Array<string> | undefined;
|
|
261
|
+
reviews_count?: number | undefined;
|
|
262
|
+
reviews_rating_sum?: number | undefined;
|
|
263
|
+
attributes?: Array<ProductAttribute$Outbound> | undefined;
|
|
264
|
+
images?: Array<ProductImage$Outbound> | undefined;
|
|
265
|
+
pricing?: ProductPricing$Outbound | undefined;
|
|
266
|
+
promotion?: ProductPromotion$Outbound | null | undefined;
|
|
267
|
+
subscription?: Array<ProductSubscription$Outbound> | undefined;
|
|
268
|
+
associated_options?:
|
|
269
|
+
| { [k: string]: AssociatedOption$Outbound }
|
|
270
|
+
| null
|
|
271
|
+
| undefined;
|
|
272
|
+
};
|
|
273
|
+
|
|
274
|
+
/** @internal */
|
|
275
|
+
export const BundleProductSKU$outboundSchema: z.ZodType<
|
|
276
|
+
BundleProductSKU$Outbound,
|
|
277
|
+
z.ZodTypeDef,
|
|
278
|
+
BundleProductSKU
|
|
279
|
+
> = z.object({
|
|
280
|
+
quantity: z.number().int(),
|
|
281
|
+
productId: z.string(),
|
|
282
|
+
variantId: z.nullable(z.string()).optional(),
|
|
283
|
+
sku: z.string(),
|
|
284
|
+
slug: z.string().optional(),
|
|
285
|
+
productName: z.string(),
|
|
286
|
+
variantName: z.nullable(z.string()).optional(),
|
|
287
|
+
productType: BundleProductBundleItemsProductType$outboundSchema,
|
|
288
|
+
shortDescription: z.string().optional(),
|
|
289
|
+
active: z.boolean().default(true),
|
|
290
|
+
stockAvailable: z.boolean().default(true),
|
|
291
|
+
onOffer: z.boolean().default(false),
|
|
292
|
+
onSubscription: z.boolean().default(false),
|
|
293
|
+
onPromotion: z.boolean().default(false),
|
|
294
|
+
categoryIds: z.array(z.string()).optional(),
|
|
295
|
+
tags: z.array(z.string()).optional(),
|
|
296
|
+
reviewsCount: z.number().int().optional(),
|
|
297
|
+
reviewsRatingSum: z.number().optional(),
|
|
298
|
+
attributes: z.array(ProductAttribute$outboundSchema).optional(),
|
|
299
|
+
images: z.array(ProductImage$outboundSchema).optional(),
|
|
300
|
+
pricing: ProductPricing$outboundSchema.optional(),
|
|
301
|
+
promotion: z.nullable(ProductPromotion$outboundSchema).optional(),
|
|
302
|
+
subscription: z.array(ProductSubscription$outboundSchema).optional(),
|
|
303
|
+
associatedOptions: z.nullable(z.record(AssociatedOption$outboundSchema))
|
|
304
|
+
.optional(),
|
|
305
|
+
}).transform((v) => {
|
|
306
|
+
return remap$(v, {
|
|
307
|
+
productId: "product_id",
|
|
308
|
+
variantId: "variant_id",
|
|
309
|
+
productName: "product_name",
|
|
310
|
+
variantName: "variant_name",
|
|
311
|
+
productType: "product_type",
|
|
312
|
+
shortDescription: "short_description",
|
|
313
|
+
stockAvailable: "stock_available",
|
|
314
|
+
onOffer: "on_offer",
|
|
315
|
+
onSubscription: "on_subscription",
|
|
316
|
+
onPromotion: "on_promotion",
|
|
317
|
+
categoryIds: "category_ids",
|
|
318
|
+
reviewsCount: "reviews_count",
|
|
319
|
+
reviewsRatingSum: "reviews_rating_sum",
|
|
320
|
+
associatedOptions: "associated_options",
|
|
321
|
+
});
|
|
322
|
+
});
|
|
323
|
+
|
|
324
|
+
/**
|
|
325
|
+
* @internal
|
|
326
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
327
|
+
*/
|
|
328
|
+
export namespace BundleProductSKU$ {
|
|
329
|
+
/** @deprecated use `BundleProductSKU$inboundSchema` instead. */
|
|
330
|
+
export const inboundSchema = BundleProductSKU$inboundSchema;
|
|
331
|
+
/** @deprecated use `BundleProductSKU$outboundSchema` instead. */
|
|
332
|
+
export const outboundSchema = BundleProductSKU$outboundSchema;
|
|
333
|
+
/** @deprecated use `BundleProductSKU$Outbound` instead. */
|
|
334
|
+
export type Outbound = BundleProductSKU$Outbound;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
export function bundleProductSKUToJSON(
|
|
338
|
+
bundleProductSKU: BundleProductSKU,
|
|
339
|
+
): string {
|
|
340
|
+
return JSON.stringify(
|
|
341
|
+
BundleProductSKU$outboundSchema.parse(bundleProductSKU),
|
|
342
|
+
);
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
export function bundleProductSKUFromJSON(
|
|
346
|
+
jsonString: string,
|
|
347
|
+
): SafeParseResult<BundleProductSKU, SDKValidationError> {
|
|
348
|
+
return safeParse(
|
|
349
|
+
jsonString,
|
|
350
|
+
(x) => BundleProductSKU$inboundSchema.parse(JSON.parse(x)),
|
|
351
|
+
`Failed to parse 'BundleProductSKU' from JSON`,
|
|
352
|
+
);
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
/** @internal */
|
|
356
|
+
export const BundleProduct$inboundSchema: z.ZodType<
|
|
357
|
+
BundleProduct,
|
|
358
|
+
z.ZodTypeDef,
|
|
359
|
+
unknown
|
|
360
|
+
> = z.object({
|
|
361
|
+
id: z.string(),
|
|
362
|
+
sku: z.string().optional(),
|
|
363
|
+
name: z.string(),
|
|
364
|
+
slug: z.string(),
|
|
365
|
+
short_description: z.string().optional(),
|
|
366
|
+
product_type: BundleProductProductType$inboundSchema,
|
|
367
|
+
active: z.boolean().default(true),
|
|
368
|
+
stock_available: z.boolean().default(true),
|
|
369
|
+
on_offer: z.boolean().default(false),
|
|
370
|
+
on_subscription: z.boolean().default(false),
|
|
371
|
+
on_promotion: z.boolean().default(false),
|
|
372
|
+
has_variant: z.boolean().default(false),
|
|
373
|
+
tags: z.nullable(z.array(z.string())).optional(),
|
|
374
|
+
category_ids: z.array(z.string()).optional(),
|
|
375
|
+
reviews_rating_sum: z.number().optional(),
|
|
376
|
+
reviews_count: z.number().int().optional(),
|
|
377
|
+
attributes: z.array(ProductAttribute$inboundSchema).optional(),
|
|
378
|
+
pricing: ProductPricing$inboundSchema,
|
|
379
|
+
variant_options: z.nullable(z.array(VariantOption$inboundSchema)),
|
|
380
|
+
promotion: z.nullable(ProductPromotion$inboundSchema),
|
|
381
|
+
images: z.array(ProductImage$inboundSchema),
|
|
382
|
+
subscription: z.array(ProductSubscription$inboundSchema),
|
|
383
|
+
bundle_items: z.array(z.lazy(() => BundleProductSKU$inboundSchema))
|
|
384
|
+
.optional(),
|
|
385
|
+
}).transform((v) => {
|
|
386
|
+
return remap$(v, {
|
|
387
|
+
"short_description": "shortDescription",
|
|
388
|
+
"product_type": "productType",
|
|
389
|
+
"stock_available": "stockAvailable",
|
|
390
|
+
"on_offer": "onOffer",
|
|
391
|
+
"on_subscription": "onSubscription",
|
|
392
|
+
"on_promotion": "onPromotion",
|
|
393
|
+
"has_variant": "hasVariant",
|
|
394
|
+
"category_ids": "categoryIds",
|
|
395
|
+
"reviews_rating_sum": "reviewsRatingSum",
|
|
396
|
+
"reviews_count": "reviewsCount",
|
|
397
|
+
"variant_options": "variantOptions",
|
|
398
|
+
"bundle_items": "bundleItems",
|
|
399
|
+
});
|
|
400
|
+
});
|
|
401
|
+
|
|
402
|
+
/** @internal */
|
|
403
|
+
export type BundleProduct$Outbound = {
|
|
404
|
+
id: string;
|
|
405
|
+
sku?: string | undefined;
|
|
406
|
+
name: string;
|
|
407
|
+
slug: string;
|
|
408
|
+
short_description?: string | undefined;
|
|
409
|
+
product_type: string;
|
|
410
|
+
active: boolean;
|
|
411
|
+
stock_available: boolean;
|
|
412
|
+
on_offer: boolean;
|
|
413
|
+
on_subscription: boolean;
|
|
414
|
+
on_promotion: boolean;
|
|
415
|
+
has_variant: boolean;
|
|
416
|
+
tags?: Array<string> | null | undefined;
|
|
417
|
+
category_ids?: Array<string> | undefined;
|
|
418
|
+
reviews_rating_sum?: number | undefined;
|
|
419
|
+
reviews_count?: number | undefined;
|
|
420
|
+
attributes?: Array<ProductAttribute$Outbound> | undefined;
|
|
421
|
+
pricing: ProductPricing$Outbound;
|
|
422
|
+
variant_options: Array<VariantOption$Outbound> | null;
|
|
423
|
+
promotion: ProductPromotion$Outbound | null;
|
|
424
|
+
images: Array<ProductImage$Outbound>;
|
|
425
|
+
subscription: Array<ProductSubscription$Outbound>;
|
|
426
|
+
bundle_items?: Array<BundleProductSKU$Outbound> | undefined;
|
|
427
|
+
};
|
|
428
|
+
|
|
429
|
+
/** @internal */
|
|
430
|
+
export const BundleProduct$outboundSchema: z.ZodType<
|
|
431
|
+
BundleProduct$Outbound,
|
|
432
|
+
z.ZodTypeDef,
|
|
433
|
+
BundleProduct
|
|
434
|
+
> = z.object({
|
|
435
|
+
id: z.string(),
|
|
436
|
+
sku: z.string().optional(),
|
|
437
|
+
name: z.string(),
|
|
438
|
+
slug: z.string(),
|
|
439
|
+
shortDescription: z.string().optional(),
|
|
440
|
+
productType: BundleProductProductType$outboundSchema,
|
|
441
|
+
active: z.boolean().default(true),
|
|
442
|
+
stockAvailable: z.boolean().default(true),
|
|
443
|
+
onOffer: z.boolean().default(false),
|
|
444
|
+
onSubscription: z.boolean().default(false),
|
|
445
|
+
onPromotion: z.boolean().default(false),
|
|
446
|
+
hasVariant: z.boolean().default(false),
|
|
447
|
+
tags: z.nullable(z.array(z.string())).optional(),
|
|
448
|
+
categoryIds: z.array(z.string()).optional(),
|
|
449
|
+
reviewsRatingSum: z.number().optional(),
|
|
450
|
+
reviewsCount: z.number().int().optional(),
|
|
451
|
+
attributes: z.array(ProductAttribute$outboundSchema).optional(),
|
|
452
|
+
pricing: ProductPricing$outboundSchema,
|
|
453
|
+
variantOptions: z.nullable(z.array(VariantOption$outboundSchema)),
|
|
454
|
+
promotion: z.nullable(ProductPromotion$outboundSchema),
|
|
455
|
+
images: z.array(ProductImage$outboundSchema),
|
|
456
|
+
subscription: z.array(ProductSubscription$outboundSchema),
|
|
457
|
+
bundleItems: z.array(z.lazy(() => BundleProductSKU$outboundSchema))
|
|
458
|
+
.optional(),
|
|
459
|
+
}).transform((v) => {
|
|
460
|
+
return remap$(v, {
|
|
461
|
+
shortDescription: "short_description",
|
|
462
|
+
productType: "product_type",
|
|
463
|
+
stockAvailable: "stock_available",
|
|
464
|
+
onOffer: "on_offer",
|
|
465
|
+
onSubscription: "on_subscription",
|
|
466
|
+
onPromotion: "on_promotion",
|
|
467
|
+
hasVariant: "has_variant",
|
|
468
|
+
categoryIds: "category_ids",
|
|
469
|
+
reviewsRatingSum: "reviews_rating_sum",
|
|
470
|
+
reviewsCount: "reviews_count",
|
|
471
|
+
variantOptions: "variant_options",
|
|
472
|
+
bundleItems: "bundle_items",
|
|
473
|
+
});
|
|
474
|
+
});
|
|
475
|
+
|
|
476
|
+
/**
|
|
477
|
+
* @internal
|
|
478
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
479
|
+
*/
|
|
480
|
+
export namespace BundleProduct$ {
|
|
481
|
+
/** @deprecated use `BundleProduct$inboundSchema` instead. */
|
|
482
|
+
export const inboundSchema = BundleProduct$inboundSchema;
|
|
483
|
+
/** @deprecated use `BundleProduct$outboundSchema` instead. */
|
|
484
|
+
export const outboundSchema = BundleProduct$outboundSchema;
|
|
485
|
+
/** @deprecated use `BundleProduct$Outbound` instead. */
|
|
486
|
+
export type Outbound = BundleProduct$Outbound;
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
export function bundleProductToJSON(bundleProduct: BundleProduct): string {
|
|
490
|
+
return JSON.stringify(BundleProduct$outboundSchema.parse(bundleProduct));
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
export function bundleProductFromJSON(
|
|
494
|
+
jsonString: string,
|
|
495
|
+
): SafeParseResult<BundleProduct, SDKValidationError> {
|
|
496
|
+
return safeParse(
|
|
497
|
+
jsonString,
|
|
498
|
+
(x) => BundleProduct$inboundSchema.parse(JSON.parse(x)),
|
|
499
|
+
`Failed to parse 'BundleProduct' from JSON`,
|
|
500
|
+
);
|
|
501
|
+
}
|