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