ce-storefront 0.4.0 → 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.
- package/esm/lib/config.d.ts +2 -2
- package/esm/lib/config.js +2 -2
- package/esm/models/components/index.d.ts +3 -5
- package/esm/models/components/index.d.ts.map +1 -1
- package/esm/models/components/index.js +3 -5
- package/esm/models/components/index.js.map +1 -1
- package/esm/models/components/{singleproduct.d.ts → product.d.ts} +17 -14
- package/esm/models/components/product.d.ts.map +1 -0
- package/esm/models/components/{singleproduct.js → product.js} +19 -14
- package/esm/models/components/product.js.map +1 -0
- package/esm/models/components/productbundleitem.d.ts +142 -0
- package/esm/models/components/productbundleitem.d.ts.map +1 -0
- package/esm/models/components/productbundleitem.js +171 -0
- package/esm/models/components/productbundleitem.js.map +1 -0
- package/esm/models/components/productdetail.d.ts +139 -4
- package/esm/models/components/productdetail.d.ts.map +1 -1
- package/esm/models/components/productdetail.js +136 -10
- package/esm/models/components/productdetail.js.map +1 -1
- package/esm/models/components/productlist.d.ts +36 -0
- package/esm/models/components/productlist.d.ts.map +1 -0
- package/esm/models/components/productlist.js +35 -0
- package/esm/models/components/productlist.js.map +1 -0
- package/esm/models/operations/getcrosssell.d.ts +2 -2
- package/esm/models/operations/getcrosssell.d.ts.map +1 -1
- package/esm/models/operations/getcrosssell.js +2 -2
- package/esm/models/operations/getcrosssell.js.map +1 -1
- package/esm/models/operations/getproducts.d.ts +32 -2
- package/esm/models/operations/getproducts.d.ts.map +1 -1
- package/esm/models/operations/getproducts.js +29 -2
- package/esm/models/operations/getproducts.js.map +1 -1
- package/esm/models/operations/getsimilar.d.ts +2 -2
- package/esm/models/operations/getsimilar.d.ts.map +1 -1
- package/esm/models/operations/getsimilar.js +2 -2
- package/esm/models/operations/getsimilar.js.map +1 -1
- package/esm/models/operations/getskus.d.ts +15 -15
- package/esm/models/operations/getskus.d.ts.map +1 -1
- package/esm/models/operations/getskus.js +15 -15
- package/esm/models/operations/getskus.js.map +1 -1
- package/esm/models/operations/getupsell.d.ts +2 -2
- package/esm/models/operations/getupsell.d.ts.map +1 -1
- package/esm/models/operations/getupsell.js +2 -2
- package/esm/models/operations/getupsell.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/index.ts +3 -5
- package/src/models/components/{singleproduct.ts → product.ts} +69 -60
- package/src/models/components/productbundleitem.ts +329 -0
- package/src/models/components/productdetail.ts +295 -22
- package/src/models/components/productlist.ts +81 -0
- package/src/models/operations/getcrosssell.ts +4 -4
- package/src/models/operations/getproducts.ts +62 -4
- package/src/models/operations/getsimilar.ts +4 -4
- package/src/models/operations/getskus.ts +30 -27
- package/src/models/operations/getupsell.ts +4 -4
- package/esm/models/components/bundleproduct.d.ts +0 -236
- package/esm/models/components/bundleproduct.d.ts.map +0 -1
- package/esm/models/components/bundleproduct.js +0 -258
- package/esm/models/components/bundleproduct.js.map +0 -1
- package/esm/models/components/bundleproductdetail.d.ts +0 -265
- package/esm/models/components/bundleproductdetail.d.ts.map +0 -1
- package/esm/models/components/bundleproductdetail.js +0 -284
- package/esm/models/components/bundleproductdetail.js.map +0 -1
- package/esm/models/components/productlistresponse.d.ts +0 -58
- package/esm/models/components/productlistresponse.d.ts.map +0 -1
- package/esm/models/components/productlistresponse.js +0 -57
- package/esm/models/components/productlistresponse.js.map +0 -1
- package/esm/models/components/singleproduct.d.ts.map +0 -1
- package/esm/models/components/singleproduct.js.map +0 -1
- package/esm/models/components/singleproductdetail.d.ts +0 -159
- package/esm/models/components/singleproductdetail.d.ts.map +0 -1
- package/esm/models/components/singleproductdetail.js +0 -156
- package/esm/models/components/singleproductdetail.js.map +0 -1
- package/src/models/components/bundleproduct.ts +0 -494
- package/src/models/components/bundleproductdetail.ts +0 -560
- package/src/models/components/productlistresponse.ts +0 -141
- package/src/models/components/singleproductdetail.ts +0 -339
|
@@ -0,0 +1,329 @@
|
|
|
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
|
+
|
|
48
|
+
export const ProductBundleItemProductType = {
|
|
49
|
+
Physical: "physical",
|
|
50
|
+
Digital: "digital",
|
|
51
|
+
Bundle: "bundle",
|
|
52
|
+
} as const;
|
|
53
|
+
export type ProductBundleItemProductType = ClosedEnum<
|
|
54
|
+
typeof ProductBundleItemProductType
|
|
55
|
+
>;
|
|
56
|
+
|
|
57
|
+
export type ProductBundleItemSKU = {
|
|
58
|
+
quantity: number;
|
|
59
|
+
productId: string;
|
|
60
|
+
variantId: string | null;
|
|
61
|
+
sku: string;
|
|
62
|
+
slug: string | null;
|
|
63
|
+
productName: string;
|
|
64
|
+
variantName: string | null;
|
|
65
|
+
productType: ProductBundleItemProductType;
|
|
66
|
+
shortDescription: string | null;
|
|
67
|
+
active: boolean;
|
|
68
|
+
stockAvailable: boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Indicates whether this item is associated with any active (product-specific) coupons
|
|
71
|
+
*/
|
|
72
|
+
onOffer: boolean;
|
|
73
|
+
onSubscription: boolean;
|
|
74
|
+
onPromotion: boolean;
|
|
75
|
+
categoryIds: Array<string>;
|
|
76
|
+
tags: Array<string> | null;
|
|
77
|
+
reviewsCount: number;
|
|
78
|
+
reviewsRatingSum: number | null;
|
|
79
|
+
attributes: Array<ProductAttribute>;
|
|
80
|
+
images: Array<ProductImage>;
|
|
81
|
+
pricing: ProductPricing;
|
|
82
|
+
promotion: ProductPromotion | null;
|
|
83
|
+
subscription: Array<ProductSubscription>;
|
|
84
|
+
associatedOptions: { [k: string]: AssociatedOption } | null;
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
export type ProductBundleItem = {
|
|
88
|
+
bundleItems: Array<ProductBundleItemSKU>;
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
/** @internal */
|
|
92
|
+
export const ProductBundleItemProductType$inboundSchema: z.ZodNativeEnum<
|
|
93
|
+
typeof ProductBundleItemProductType
|
|
94
|
+
> = z.nativeEnum(ProductBundleItemProductType);
|
|
95
|
+
|
|
96
|
+
/** @internal */
|
|
97
|
+
export const ProductBundleItemProductType$outboundSchema: z.ZodNativeEnum<
|
|
98
|
+
typeof ProductBundleItemProductType
|
|
99
|
+
> = ProductBundleItemProductType$inboundSchema;
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* @internal
|
|
103
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
104
|
+
*/
|
|
105
|
+
export namespace ProductBundleItemProductType$ {
|
|
106
|
+
/** @deprecated use `ProductBundleItemProductType$inboundSchema` instead. */
|
|
107
|
+
export const inboundSchema = ProductBundleItemProductType$inboundSchema;
|
|
108
|
+
/** @deprecated use `ProductBundleItemProductType$outboundSchema` instead. */
|
|
109
|
+
export const outboundSchema = ProductBundleItemProductType$outboundSchema;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/** @internal */
|
|
113
|
+
export const ProductBundleItemSKU$inboundSchema: z.ZodType<
|
|
114
|
+
ProductBundleItemSKU,
|
|
115
|
+
z.ZodTypeDef,
|
|
116
|
+
unknown
|
|
117
|
+
> = z.object({
|
|
118
|
+
quantity: z.number().int(),
|
|
119
|
+
product_id: z.string(),
|
|
120
|
+
variant_id: z.nullable(z.string()),
|
|
121
|
+
sku: z.string(),
|
|
122
|
+
slug: z.nullable(z.string()),
|
|
123
|
+
product_name: z.string(),
|
|
124
|
+
variant_name: z.nullable(z.string()),
|
|
125
|
+
product_type: ProductBundleItemProductType$inboundSchema,
|
|
126
|
+
short_description: z.nullable(z.string()),
|
|
127
|
+
active: z.boolean(),
|
|
128
|
+
stock_available: z.boolean(),
|
|
129
|
+
on_offer: z.boolean(),
|
|
130
|
+
on_subscription: z.boolean(),
|
|
131
|
+
on_promotion: z.boolean(),
|
|
132
|
+
category_ids: z.array(z.string()),
|
|
133
|
+
tags: z.nullable(z.array(z.string())),
|
|
134
|
+
reviews_count: z.number().int(),
|
|
135
|
+
reviews_rating_sum: z.nullable(z.number()),
|
|
136
|
+
attributes: z.array(ProductAttribute$inboundSchema),
|
|
137
|
+
images: z.array(ProductImage$inboundSchema),
|
|
138
|
+
pricing: ProductPricing$inboundSchema,
|
|
139
|
+
promotion: z.nullable(ProductPromotion$inboundSchema),
|
|
140
|
+
subscription: z.array(ProductSubscription$inboundSchema),
|
|
141
|
+
associated_options: z.nullable(z.record(AssociatedOption$inboundSchema)),
|
|
142
|
+
}).transform((v) => {
|
|
143
|
+
return remap$(v, {
|
|
144
|
+
"product_id": "productId",
|
|
145
|
+
"variant_id": "variantId",
|
|
146
|
+
"product_name": "productName",
|
|
147
|
+
"variant_name": "variantName",
|
|
148
|
+
"product_type": "productType",
|
|
149
|
+
"short_description": "shortDescription",
|
|
150
|
+
"stock_available": "stockAvailable",
|
|
151
|
+
"on_offer": "onOffer",
|
|
152
|
+
"on_subscription": "onSubscription",
|
|
153
|
+
"on_promotion": "onPromotion",
|
|
154
|
+
"category_ids": "categoryIds",
|
|
155
|
+
"reviews_count": "reviewsCount",
|
|
156
|
+
"reviews_rating_sum": "reviewsRatingSum",
|
|
157
|
+
"associated_options": "associatedOptions",
|
|
158
|
+
});
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
/** @internal */
|
|
162
|
+
export type ProductBundleItemSKU$Outbound = {
|
|
163
|
+
quantity: number;
|
|
164
|
+
product_id: string;
|
|
165
|
+
variant_id: string | null;
|
|
166
|
+
sku: string;
|
|
167
|
+
slug: string | null;
|
|
168
|
+
product_name: string;
|
|
169
|
+
variant_name: string | null;
|
|
170
|
+
product_type: string;
|
|
171
|
+
short_description: string | null;
|
|
172
|
+
active: boolean;
|
|
173
|
+
stock_available: boolean;
|
|
174
|
+
on_offer: boolean;
|
|
175
|
+
on_subscription: boolean;
|
|
176
|
+
on_promotion: boolean;
|
|
177
|
+
category_ids: Array<string>;
|
|
178
|
+
tags: Array<string> | null;
|
|
179
|
+
reviews_count: number;
|
|
180
|
+
reviews_rating_sum: number | null;
|
|
181
|
+
attributes: Array<ProductAttribute$Outbound>;
|
|
182
|
+
images: Array<ProductImage$Outbound>;
|
|
183
|
+
pricing: ProductPricing$Outbound;
|
|
184
|
+
promotion: ProductPromotion$Outbound | null;
|
|
185
|
+
subscription: Array<ProductSubscription$Outbound>;
|
|
186
|
+
associated_options: { [k: string]: AssociatedOption$Outbound } | null;
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
/** @internal */
|
|
190
|
+
export const ProductBundleItemSKU$outboundSchema: z.ZodType<
|
|
191
|
+
ProductBundleItemSKU$Outbound,
|
|
192
|
+
z.ZodTypeDef,
|
|
193
|
+
ProductBundleItemSKU
|
|
194
|
+
> = z.object({
|
|
195
|
+
quantity: z.number().int(),
|
|
196
|
+
productId: z.string(),
|
|
197
|
+
variantId: z.nullable(z.string()),
|
|
198
|
+
sku: z.string(),
|
|
199
|
+
slug: z.nullable(z.string()),
|
|
200
|
+
productName: z.string(),
|
|
201
|
+
variantName: z.nullable(z.string()),
|
|
202
|
+
productType: ProductBundleItemProductType$outboundSchema,
|
|
203
|
+
shortDescription: z.nullable(z.string()),
|
|
204
|
+
active: z.boolean(),
|
|
205
|
+
stockAvailable: z.boolean(),
|
|
206
|
+
onOffer: z.boolean(),
|
|
207
|
+
onSubscription: z.boolean(),
|
|
208
|
+
onPromotion: z.boolean(),
|
|
209
|
+
categoryIds: z.array(z.string()),
|
|
210
|
+
tags: z.nullable(z.array(z.string())),
|
|
211
|
+
reviewsCount: z.number().int(),
|
|
212
|
+
reviewsRatingSum: z.nullable(z.number()),
|
|
213
|
+
attributes: z.array(ProductAttribute$outboundSchema),
|
|
214
|
+
images: z.array(ProductImage$outboundSchema),
|
|
215
|
+
pricing: ProductPricing$outboundSchema,
|
|
216
|
+
promotion: z.nullable(ProductPromotion$outboundSchema),
|
|
217
|
+
subscription: z.array(ProductSubscription$outboundSchema),
|
|
218
|
+
associatedOptions: z.nullable(z.record(AssociatedOption$outboundSchema)),
|
|
219
|
+
}).transform((v) => {
|
|
220
|
+
return remap$(v, {
|
|
221
|
+
productId: "product_id",
|
|
222
|
+
variantId: "variant_id",
|
|
223
|
+
productName: "product_name",
|
|
224
|
+
variantName: "variant_name",
|
|
225
|
+
productType: "product_type",
|
|
226
|
+
shortDescription: "short_description",
|
|
227
|
+
stockAvailable: "stock_available",
|
|
228
|
+
onOffer: "on_offer",
|
|
229
|
+
onSubscription: "on_subscription",
|
|
230
|
+
onPromotion: "on_promotion",
|
|
231
|
+
categoryIds: "category_ids",
|
|
232
|
+
reviewsCount: "reviews_count",
|
|
233
|
+
reviewsRatingSum: "reviews_rating_sum",
|
|
234
|
+
associatedOptions: "associated_options",
|
|
235
|
+
});
|
|
236
|
+
});
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* @internal
|
|
240
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
241
|
+
*/
|
|
242
|
+
export namespace ProductBundleItemSKU$ {
|
|
243
|
+
/** @deprecated use `ProductBundleItemSKU$inboundSchema` instead. */
|
|
244
|
+
export const inboundSchema = ProductBundleItemSKU$inboundSchema;
|
|
245
|
+
/** @deprecated use `ProductBundleItemSKU$outboundSchema` instead. */
|
|
246
|
+
export const outboundSchema = ProductBundleItemSKU$outboundSchema;
|
|
247
|
+
/** @deprecated use `ProductBundleItemSKU$Outbound` instead. */
|
|
248
|
+
export type Outbound = ProductBundleItemSKU$Outbound;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
export function productBundleItemSKUToJSON(
|
|
252
|
+
productBundleItemSKU: ProductBundleItemSKU,
|
|
253
|
+
): string {
|
|
254
|
+
return JSON.stringify(
|
|
255
|
+
ProductBundleItemSKU$outboundSchema.parse(productBundleItemSKU),
|
|
256
|
+
);
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
export function productBundleItemSKUFromJSON(
|
|
260
|
+
jsonString: string,
|
|
261
|
+
): SafeParseResult<ProductBundleItemSKU, SDKValidationError> {
|
|
262
|
+
return safeParse(
|
|
263
|
+
jsonString,
|
|
264
|
+
(x) => ProductBundleItemSKU$inboundSchema.parse(JSON.parse(x)),
|
|
265
|
+
`Failed to parse 'ProductBundleItemSKU' from JSON`,
|
|
266
|
+
);
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
/** @internal */
|
|
270
|
+
export const ProductBundleItem$inboundSchema: z.ZodType<
|
|
271
|
+
ProductBundleItem,
|
|
272
|
+
z.ZodTypeDef,
|
|
273
|
+
unknown
|
|
274
|
+
> = z.object({
|
|
275
|
+
bundle_items: z.array(z.lazy(() => ProductBundleItemSKU$inboundSchema)),
|
|
276
|
+
}).transform((v) => {
|
|
277
|
+
return remap$(v, {
|
|
278
|
+
"bundle_items": "bundleItems",
|
|
279
|
+
});
|
|
280
|
+
});
|
|
281
|
+
|
|
282
|
+
/** @internal */
|
|
283
|
+
export type ProductBundleItem$Outbound = {
|
|
284
|
+
bundle_items: Array<ProductBundleItemSKU$Outbound>;
|
|
285
|
+
};
|
|
286
|
+
|
|
287
|
+
/** @internal */
|
|
288
|
+
export const ProductBundleItem$outboundSchema: z.ZodType<
|
|
289
|
+
ProductBundleItem$Outbound,
|
|
290
|
+
z.ZodTypeDef,
|
|
291
|
+
ProductBundleItem
|
|
292
|
+
> = z.object({
|
|
293
|
+
bundleItems: z.array(z.lazy(() => ProductBundleItemSKU$outboundSchema)),
|
|
294
|
+
}).transform((v) => {
|
|
295
|
+
return remap$(v, {
|
|
296
|
+
bundleItems: "bundle_items",
|
|
297
|
+
});
|
|
298
|
+
});
|
|
299
|
+
|
|
300
|
+
/**
|
|
301
|
+
* @internal
|
|
302
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
303
|
+
*/
|
|
304
|
+
export namespace ProductBundleItem$ {
|
|
305
|
+
/** @deprecated use `ProductBundleItem$inboundSchema` instead. */
|
|
306
|
+
export const inboundSchema = ProductBundleItem$inboundSchema;
|
|
307
|
+
/** @deprecated use `ProductBundleItem$outboundSchema` instead. */
|
|
308
|
+
export const outboundSchema = ProductBundleItem$outboundSchema;
|
|
309
|
+
/** @deprecated use `ProductBundleItem$Outbound` instead. */
|
|
310
|
+
export type Outbound = ProductBundleItem$Outbound;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
export function productBundleItemToJSON(
|
|
314
|
+
productBundleItem: ProductBundleItem,
|
|
315
|
+
): string {
|
|
316
|
+
return JSON.stringify(
|
|
317
|
+
ProductBundleItem$outboundSchema.parse(productBundleItem),
|
|
318
|
+
);
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
export function productBundleItemFromJSON(
|
|
322
|
+
jsonString: string,
|
|
323
|
+
): SafeParseResult<ProductBundleItem, SDKValidationError> {
|
|
324
|
+
return safeParse(
|
|
325
|
+
jsonString,
|
|
326
|
+
(x) => ProductBundleItem$inboundSchema.parse(JSON.parse(x)),
|
|
327
|
+
`Failed to parse 'ProductBundleItem' from JSON`,
|
|
328
|
+
);
|
|
329
|
+
}
|
|
@@ -3,48 +3,321 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
import * as z from "zod";
|
|
6
|
+
import { remap as remap$ } from "../../lib/primitives.js";
|
|
6
7
|
import { safeParse } from "../../lib/schemas.js";
|
|
8
|
+
import { ClosedEnum } from "../../types/enums.js";
|
|
7
9
|
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
8
10
|
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
9
11
|
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
} from "./
|
|
12
|
+
ProductAttribute,
|
|
13
|
+
ProductAttribute$inboundSchema,
|
|
14
|
+
ProductAttribute$Outbound,
|
|
15
|
+
ProductAttribute$outboundSchema,
|
|
16
|
+
} from "./productattribute.js";
|
|
15
17
|
import {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
} from "./
|
|
18
|
+
ProductBundleItem,
|
|
19
|
+
ProductBundleItem$inboundSchema,
|
|
20
|
+
ProductBundleItem$Outbound,
|
|
21
|
+
ProductBundleItem$outboundSchema,
|
|
22
|
+
} from "./productbundleitem.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
|
+
Variant,
|
|
67
|
+
Variant$inboundSchema,
|
|
68
|
+
Variant$Outbound,
|
|
69
|
+
Variant$outboundSchema,
|
|
70
|
+
} from "./variant.js";
|
|
71
|
+
import {
|
|
72
|
+
VariantOption,
|
|
73
|
+
VariantOption$inboundSchema,
|
|
74
|
+
VariantOption$Outbound,
|
|
75
|
+
VariantOption$outboundSchema,
|
|
76
|
+
} from "./variantoption.js";
|
|
77
|
+
|
|
78
|
+
export const ProductDetailProductType = {
|
|
79
|
+
Physical: "physical",
|
|
80
|
+
Digital: "digital",
|
|
81
|
+
Bundle: "bundle",
|
|
82
|
+
} as const;
|
|
83
|
+
export type ProductDetailProductType = ClosedEnum<
|
|
84
|
+
typeof ProductDetailProductType
|
|
85
|
+
>;
|
|
21
86
|
|
|
22
|
-
export type ProductDetail =
|
|
87
|
+
export type ProductDetail = {
|
|
88
|
+
/**
|
|
89
|
+
* The ULID of the product
|
|
90
|
+
*/
|
|
91
|
+
id: string;
|
|
92
|
+
sku: string | null;
|
|
93
|
+
name: string;
|
|
94
|
+
slug: string | null;
|
|
95
|
+
shortDescription: string | null;
|
|
96
|
+
productType: ProductDetailProductType;
|
|
97
|
+
active: boolean;
|
|
98
|
+
/**
|
|
99
|
+
* Indicates whether the product has stock available
|
|
100
|
+
*/
|
|
101
|
+
stockAvailable: boolean;
|
|
102
|
+
/**
|
|
103
|
+
* Indicates whether this item is associated with any active (product-specific) coupons
|
|
104
|
+
*/
|
|
105
|
+
onOffer: boolean;
|
|
106
|
+
/**
|
|
107
|
+
* Indicates whether the product has any subscription plans avaialble
|
|
108
|
+
*/
|
|
109
|
+
onSubscription: boolean;
|
|
110
|
+
/**
|
|
111
|
+
* Indicates whether the product is currently on promotion. When true, the `ProductPromotion` object will contain details of the promotion
|
|
112
|
+
*/
|
|
113
|
+
onPromotion: boolean;
|
|
114
|
+
/**
|
|
115
|
+
* Indicates whether the product has variants
|
|
116
|
+
*/
|
|
117
|
+
hasVariant: boolean;
|
|
118
|
+
tags: Array<string> | null;
|
|
119
|
+
categoryIds: Array<string>;
|
|
120
|
+
reviewsRatingSum: number;
|
|
121
|
+
reviewsCount: number;
|
|
122
|
+
attributes: Array<ProductAttribute>;
|
|
123
|
+
pricing: ProductPricing;
|
|
124
|
+
/**
|
|
125
|
+
* this will be used if has_variant is true, to auto set default values.
|
|
126
|
+
*/
|
|
127
|
+
variantOptions: Array<VariantOption> | null;
|
|
128
|
+
promotion: ProductPromotion | null;
|
|
129
|
+
images: Array<ProductImage>;
|
|
130
|
+
subscription: Array<ProductSubscription>;
|
|
131
|
+
variants: Array<Variant>;
|
|
132
|
+
bundleItems: ProductBundleItem;
|
|
133
|
+
description: string | null;
|
|
134
|
+
hsnCode: string | null;
|
|
135
|
+
videos: Array<ProductVideo>;
|
|
136
|
+
shipping: ProductShipping | null;
|
|
137
|
+
/**
|
|
138
|
+
* An array of product ULIDs
|
|
139
|
+
*/
|
|
140
|
+
upsellingProductIds: Array<string>;
|
|
141
|
+
/**
|
|
142
|
+
* An array of product ULIDs
|
|
143
|
+
*/
|
|
144
|
+
crosssellingProductIds: Array<string>;
|
|
145
|
+
seo: Seo;
|
|
146
|
+
metadata: { [k: string]: string };
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
/** @internal */
|
|
150
|
+
export const ProductDetailProductType$inboundSchema: z.ZodNativeEnum<
|
|
151
|
+
typeof ProductDetailProductType
|
|
152
|
+
> = z.nativeEnum(ProductDetailProductType);
|
|
153
|
+
|
|
154
|
+
/** @internal */
|
|
155
|
+
export const ProductDetailProductType$outboundSchema: z.ZodNativeEnum<
|
|
156
|
+
typeof ProductDetailProductType
|
|
157
|
+
> = ProductDetailProductType$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 ProductDetailProductType$ {
|
|
164
|
+
/** @deprecated use `ProductDetailProductType$inboundSchema` instead. */
|
|
165
|
+
export const inboundSchema = ProductDetailProductType$inboundSchema;
|
|
166
|
+
/** @deprecated use `ProductDetailProductType$outboundSchema` instead. */
|
|
167
|
+
export const outboundSchema = ProductDetailProductType$outboundSchema;
|
|
168
|
+
}
|
|
23
169
|
|
|
24
170
|
/** @internal */
|
|
25
171
|
export const ProductDetail$inboundSchema: z.ZodType<
|
|
26
172
|
ProductDetail,
|
|
27
173
|
z.ZodTypeDef,
|
|
28
174
|
unknown
|
|
29
|
-
> = z.
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
175
|
+
> = z.object({
|
|
176
|
+
id: z.string(),
|
|
177
|
+
sku: z.nullable(z.string()),
|
|
178
|
+
name: z.string(),
|
|
179
|
+
slug: z.nullable(z.string()),
|
|
180
|
+
short_description: z.nullable(z.string()),
|
|
181
|
+
product_type: ProductDetailProductType$inboundSchema,
|
|
182
|
+
active: z.boolean(),
|
|
183
|
+
stock_available: z.boolean(),
|
|
184
|
+
on_offer: z.boolean(),
|
|
185
|
+
on_subscription: z.boolean(),
|
|
186
|
+
on_promotion: z.boolean(),
|
|
187
|
+
has_variant: z.boolean(),
|
|
188
|
+
tags: z.nullable(z.array(z.string())),
|
|
189
|
+
category_ids: z.array(z.string()),
|
|
190
|
+
reviews_rating_sum: z.number(),
|
|
191
|
+
reviews_count: z.number().int(),
|
|
192
|
+
attributes: z.array(ProductAttribute$inboundSchema),
|
|
193
|
+
pricing: ProductPricing$inboundSchema,
|
|
194
|
+
variant_options: z.nullable(z.array(VariantOption$inboundSchema)),
|
|
195
|
+
promotion: z.nullable(ProductPromotion$inboundSchema),
|
|
196
|
+
images: z.array(ProductImage$inboundSchema),
|
|
197
|
+
subscription: z.array(ProductSubscription$inboundSchema),
|
|
198
|
+
variants: z.array(Variant$inboundSchema),
|
|
199
|
+
bundle_items: ProductBundleItem$inboundSchema,
|
|
200
|
+
description: z.nullable(z.string()),
|
|
201
|
+
hsn_code: z.nullable(z.string()),
|
|
202
|
+
videos: z.array(ProductVideo$inboundSchema),
|
|
203
|
+
shipping: z.nullable(ProductShipping$inboundSchema),
|
|
204
|
+
upselling_product_ids: z.array(z.string()),
|
|
205
|
+
crossselling_product_ids: z.array(z.string()),
|
|
206
|
+
seo: Seo$inboundSchema,
|
|
207
|
+
metadata: z.record(z.string()),
|
|
208
|
+
}).transform((v) => {
|
|
209
|
+
return remap$(v, {
|
|
210
|
+
"short_description": "shortDescription",
|
|
211
|
+
"product_type": "productType",
|
|
212
|
+
"stock_available": "stockAvailable",
|
|
213
|
+
"on_offer": "onOffer",
|
|
214
|
+
"on_subscription": "onSubscription",
|
|
215
|
+
"on_promotion": "onPromotion",
|
|
216
|
+
"has_variant": "hasVariant",
|
|
217
|
+
"category_ids": "categoryIds",
|
|
218
|
+
"reviews_rating_sum": "reviewsRatingSum",
|
|
219
|
+
"reviews_count": "reviewsCount",
|
|
220
|
+
"variant_options": "variantOptions",
|
|
221
|
+
"bundle_items": "bundleItems",
|
|
222
|
+
"hsn_code": "hsnCode",
|
|
223
|
+
"upselling_product_ids": "upsellingProductIds",
|
|
224
|
+
"crossselling_product_ids": "crosssellingProductIds",
|
|
225
|
+
});
|
|
226
|
+
});
|
|
33
227
|
|
|
34
228
|
/** @internal */
|
|
35
|
-
export type ProductDetail$Outbound =
|
|
36
|
-
|
|
37
|
-
|
|
|
229
|
+
export type ProductDetail$Outbound = {
|
|
230
|
+
id: string;
|
|
231
|
+
sku: string | null;
|
|
232
|
+
name: string;
|
|
233
|
+
slug: string | null;
|
|
234
|
+
short_description: string | null;
|
|
235
|
+
product_type: string;
|
|
236
|
+
active: boolean;
|
|
237
|
+
stock_available: boolean;
|
|
238
|
+
on_offer: boolean;
|
|
239
|
+
on_subscription: boolean;
|
|
240
|
+
on_promotion: boolean;
|
|
241
|
+
has_variant: boolean;
|
|
242
|
+
tags: Array<string> | null;
|
|
243
|
+
category_ids: Array<string>;
|
|
244
|
+
reviews_rating_sum: number;
|
|
245
|
+
reviews_count: number;
|
|
246
|
+
attributes: Array<ProductAttribute$Outbound>;
|
|
247
|
+
pricing: ProductPricing$Outbound;
|
|
248
|
+
variant_options: Array<VariantOption$Outbound> | null;
|
|
249
|
+
promotion: ProductPromotion$Outbound | null;
|
|
250
|
+
images: Array<ProductImage$Outbound>;
|
|
251
|
+
subscription: Array<ProductSubscription$Outbound>;
|
|
252
|
+
variants: Array<Variant$Outbound>;
|
|
253
|
+
bundle_items: ProductBundleItem$Outbound;
|
|
254
|
+
description: string | null;
|
|
255
|
+
hsn_code: string | null;
|
|
256
|
+
videos: Array<ProductVideo$Outbound>;
|
|
257
|
+
shipping: ProductShipping$Outbound | null;
|
|
258
|
+
upselling_product_ids: Array<string>;
|
|
259
|
+
crossselling_product_ids: Array<string>;
|
|
260
|
+
seo: Seo$Outbound;
|
|
261
|
+
metadata: { [k: string]: string };
|
|
262
|
+
};
|
|
38
263
|
|
|
39
264
|
/** @internal */
|
|
40
265
|
export const ProductDetail$outboundSchema: z.ZodType<
|
|
41
266
|
ProductDetail$Outbound,
|
|
42
267
|
z.ZodTypeDef,
|
|
43
268
|
ProductDetail
|
|
44
|
-
> = z.
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
269
|
+
> = z.object({
|
|
270
|
+
id: z.string(),
|
|
271
|
+
sku: z.nullable(z.string()),
|
|
272
|
+
name: z.string(),
|
|
273
|
+
slug: z.nullable(z.string()),
|
|
274
|
+
shortDescription: z.nullable(z.string()),
|
|
275
|
+
productType: ProductDetailProductType$outboundSchema,
|
|
276
|
+
active: z.boolean(),
|
|
277
|
+
stockAvailable: z.boolean(),
|
|
278
|
+
onOffer: z.boolean(),
|
|
279
|
+
onSubscription: z.boolean(),
|
|
280
|
+
onPromotion: z.boolean(),
|
|
281
|
+
hasVariant: z.boolean(),
|
|
282
|
+
tags: z.nullable(z.array(z.string())),
|
|
283
|
+
categoryIds: z.array(z.string()),
|
|
284
|
+
reviewsRatingSum: z.number(),
|
|
285
|
+
reviewsCount: z.number().int(),
|
|
286
|
+
attributes: z.array(ProductAttribute$outboundSchema),
|
|
287
|
+
pricing: ProductPricing$outboundSchema,
|
|
288
|
+
variantOptions: z.nullable(z.array(VariantOption$outboundSchema)),
|
|
289
|
+
promotion: z.nullable(ProductPromotion$outboundSchema),
|
|
290
|
+
images: z.array(ProductImage$outboundSchema),
|
|
291
|
+
subscription: z.array(ProductSubscription$outboundSchema),
|
|
292
|
+
variants: z.array(Variant$outboundSchema),
|
|
293
|
+
bundleItems: ProductBundleItem$outboundSchema,
|
|
294
|
+
description: z.nullable(z.string()),
|
|
295
|
+
hsnCode: z.nullable(z.string()),
|
|
296
|
+
videos: z.array(ProductVideo$outboundSchema),
|
|
297
|
+
shipping: z.nullable(ProductShipping$outboundSchema),
|
|
298
|
+
upsellingProductIds: z.array(z.string()),
|
|
299
|
+
crosssellingProductIds: z.array(z.string()),
|
|
300
|
+
seo: Seo$outboundSchema,
|
|
301
|
+
metadata: z.record(z.string()),
|
|
302
|
+
}).transform((v) => {
|
|
303
|
+
return remap$(v, {
|
|
304
|
+
shortDescription: "short_description",
|
|
305
|
+
productType: "product_type",
|
|
306
|
+
stockAvailable: "stock_available",
|
|
307
|
+
onOffer: "on_offer",
|
|
308
|
+
onSubscription: "on_subscription",
|
|
309
|
+
onPromotion: "on_promotion",
|
|
310
|
+
hasVariant: "has_variant",
|
|
311
|
+
categoryIds: "category_ids",
|
|
312
|
+
reviewsRatingSum: "reviews_rating_sum",
|
|
313
|
+
reviewsCount: "reviews_count",
|
|
314
|
+
variantOptions: "variant_options",
|
|
315
|
+
bundleItems: "bundle_items",
|
|
316
|
+
hsnCode: "hsn_code",
|
|
317
|
+
upsellingProductIds: "upselling_product_ids",
|
|
318
|
+
crosssellingProductIds: "crossselling_product_ids",
|
|
319
|
+
});
|
|
320
|
+
});
|
|
48
321
|
|
|
49
322
|
/**
|
|
50
323
|
* @internal
|