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,252 @@
|
|
|
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 SKUProductType = {
|
|
49
|
+
Physical: "physical",
|
|
50
|
+
Digital: "digital",
|
|
51
|
+
Bundle: "bundle",
|
|
52
|
+
} as const;
|
|
53
|
+
export type SKUProductType = ClosedEnum<typeof SKUProductType>;
|
|
54
|
+
|
|
55
|
+
export type Sku = {
|
|
56
|
+
productId: string;
|
|
57
|
+
variantId?: string | null | undefined;
|
|
58
|
+
sku: string;
|
|
59
|
+
slug?: string | undefined;
|
|
60
|
+
productName: string;
|
|
61
|
+
variantName?: string | null | undefined;
|
|
62
|
+
productType: SKUProductType;
|
|
63
|
+
shortDescription?: string | undefined;
|
|
64
|
+
active?: boolean | undefined;
|
|
65
|
+
stockAvailable?: boolean | undefined;
|
|
66
|
+
/**
|
|
67
|
+
* Indicates whether this item is associated with any active (product-specific) coupons
|
|
68
|
+
*/
|
|
69
|
+
onOffer?: boolean | undefined;
|
|
70
|
+
onSubscription?: boolean | undefined;
|
|
71
|
+
onPromotion?: boolean | undefined;
|
|
72
|
+
categoryIds?: Array<string> | undefined;
|
|
73
|
+
tags?: Array<string> | undefined;
|
|
74
|
+
reviewsCount?: number | undefined;
|
|
75
|
+
reviewsRatingSum?: number | undefined;
|
|
76
|
+
attributes?: Array<ProductAttribute> | undefined;
|
|
77
|
+
images?: Array<ProductImage> | undefined;
|
|
78
|
+
pricing?: ProductPricing | undefined;
|
|
79
|
+
promotion?: ProductPromotion | null | undefined;
|
|
80
|
+
subscription?: Array<ProductSubscription> | undefined;
|
|
81
|
+
associatedOptions?: { [k: string]: AssociatedOption } | null | undefined;
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
/** @internal */
|
|
85
|
+
export const SKUProductType$inboundSchema: z.ZodNativeEnum<
|
|
86
|
+
typeof SKUProductType
|
|
87
|
+
> = z.nativeEnum(SKUProductType);
|
|
88
|
+
|
|
89
|
+
/** @internal */
|
|
90
|
+
export const SKUProductType$outboundSchema: z.ZodNativeEnum<
|
|
91
|
+
typeof SKUProductType
|
|
92
|
+
> = SKUProductType$inboundSchema;
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* @internal
|
|
96
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
97
|
+
*/
|
|
98
|
+
export namespace SKUProductType$ {
|
|
99
|
+
/** @deprecated use `SKUProductType$inboundSchema` instead. */
|
|
100
|
+
export const inboundSchema = SKUProductType$inboundSchema;
|
|
101
|
+
/** @deprecated use `SKUProductType$outboundSchema` instead. */
|
|
102
|
+
export const outboundSchema = SKUProductType$outboundSchema;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/** @internal */
|
|
106
|
+
export const Sku$inboundSchema: z.ZodType<Sku, z.ZodTypeDef, unknown> = z
|
|
107
|
+
.object({
|
|
108
|
+
product_id: z.string(),
|
|
109
|
+
variant_id: z.nullable(z.string()).optional(),
|
|
110
|
+
sku: z.string(),
|
|
111
|
+
slug: z.string().optional(),
|
|
112
|
+
product_name: z.string(),
|
|
113
|
+
variant_name: z.nullable(z.string()).optional(),
|
|
114
|
+
product_type: SKUProductType$inboundSchema,
|
|
115
|
+
short_description: z.string().optional(),
|
|
116
|
+
active: z.boolean().default(true),
|
|
117
|
+
stock_available: z.boolean().default(true),
|
|
118
|
+
on_offer: z.boolean().default(false),
|
|
119
|
+
on_subscription: z.boolean().default(false),
|
|
120
|
+
on_promotion: z.boolean().default(false),
|
|
121
|
+
category_ids: z.array(z.string()).optional(),
|
|
122
|
+
tags: z.array(z.string()).optional(),
|
|
123
|
+
reviews_count: z.number().int().optional(),
|
|
124
|
+
reviews_rating_sum: z.number().optional(),
|
|
125
|
+
attributes: z.array(ProductAttribute$inboundSchema).optional(),
|
|
126
|
+
images: z.array(ProductImage$inboundSchema).optional(),
|
|
127
|
+
pricing: ProductPricing$inboundSchema.optional(),
|
|
128
|
+
promotion: z.nullable(ProductPromotion$inboundSchema).optional(),
|
|
129
|
+
subscription: z.array(ProductSubscription$inboundSchema).optional(),
|
|
130
|
+
associated_options: z.nullable(z.record(AssociatedOption$inboundSchema))
|
|
131
|
+
.optional(),
|
|
132
|
+
}).transform((v) => {
|
|
133
|
+
return remap$(v, {
|
|
134
|
+
"product_id": "productId",
|
|
135
|
+
"variant_id": "variantId",
|
|
136
|
+
"product_name": "productName",
|
|
137
|
+
"variant_name": "variantName",
|
|
138
|
+
"product_type": "productType",
|
|
139
|
+
"short_description": "shortDescription",
|
|
140
|
+
"stock_available": "stockAvailable",
|
|
141
|
+
"on_offer": "onOffer",
|
|
142
|
+
"on_subscription": "onSubscription",
|
|
143
|
+
"on_promotion": "onPromotion",
|
|
144
|
+
"category_ids": "categoryIds",
|
|
145
|
+
"reviews_count": "reviewsCount",
|
|
146
|
+
"reviews_rating_sum": "reviewsRatingSum",
|
|
147
|
+
"associated_options": "associatedOptions",
|
|
148
|
+
});
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
/** @internal */
|
|
152
|
+
export type Sku$Outbound = {
|
|
153
|
+
product_id: string;
|
|
154
|
+
variant_id?: string | null | undefined;
|
|
155
|
+
sku: string;
|
|
156
|
+
slug?: string | undefined;
|
|
157
|
+
product_name: string;
|
|
158
|
+
variant_name?: string | null | undefined;
|
|
159
|
+
product_type: string;
|
|
160
|
+
short_description?: string | undefined;
|
|
161
|
+
active: boolean;
|
|
162
|
+
stock_available: boolean;
|
|
163
|
+
on_offer: boolean;
|
|
164
|
+
on_subscription: boolean;
|
|
165
|
+
on_promotion: boolean;
|
|
166
|
+
category_ids?: Array<string> | undefined;
|
|
167
|
+
tags?: Array<string> | undefined;
|
|
168
|
+
reviews_count?: number | undefined;
|
|
169
|
+
reviews_rating_sum?: number | undefined;
|
|
170
|
+
attributes?: Array<ProductAttribute$Outbound> | undefined;
|
|
171
|
+
images?: Array<ProductImage$Outbound> | undefined;
|
|
172
|
+
pricing?: ProductPricing$Outbound | undefined;
|
|
173
|
+
promotion?: ProductPromotion$Outbound | null | undefined;
|
|
174
|
+
subscription?: Array<ProductSubscription$Outbound> | undefined;
|
|
175
|
+
associated_options?:
|
|
176
|
+
| { [k: string]: AssociatedOption$Outbound }
|
|
177
|
+
| null
|
|
178
|
+
| undefined;
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
/** @internal */
|
|
182
|
+
export const Sku$outboundSchema: z.ZodType<Sku$Outbound, z.ZodTypeDef, Sku> = z
|
|
183
|
+
.object({
|
|
184
|
+
productId: z.string(),
|
|
185
|
+
variantId: z.nullable(z.string()).optional(),
|
|
186
|
+
sku: z.string(),
|
|
187
|
+
slug: z.string().optional(),
|
|
188
|
+
productName: z.string(),
|
|
189
|
+
variantName: z.nullable(z.string()).optional(),
|
|
190
|
+
productType: SKUProductType$outboundSchema,
|
|
191
|
+
shortDescription: z.string().optional(),
|
|
192
|
+
active: z.boolean().default(true),
|
|
193
|
+
stockAvailable: z.boolean().default(true),
|
|
194
|
+
onOffer: z.boolean().default(false),
|
|
195
|
+
onSubscription: z.boolean().default(false),
|
|
196
|
+
onPromotion: z.boolean().default(false),
|
|
197
|
+
categoryIds: z.array(z.string()).optional(),
|
|
198
|
+
tags: z.array(z.string()).optional(),
|
|
199
|
+
reviewsCount: z.number().int().optional(),
|
|
200
|
+
reviewsRatingSum: z.number().optional(),
|
|
201
|
+
attributes: z.array(ProductAttribute$outboundSchema).optional(),
|
|
202
|
+
images: z.array(ProductImage$outboundSchema).optional(),
|
|
203
|
+
pricing: ProductPricing$outboundSchema.optional(),
|
|
204
|
+
promotion: z.nullable(ProductPromotion$outboundSchema).optional(),
|
|
205
|
+
subscription: z.array(ProductSubscription$outboundSchema).optional(),
|
|
206
|
+
associatedOptions: z.nullable(z.record(AssociatedOption$outboundSchema))
|
|
207
|
+
.optional(),
|
|
208
|
+
}).transform((v) => {
|
|
209
|
+
return remap$(v, {
|
|
210
|
+
productId: "product_id",
|
|
211
|
+
variantId: "variant_id",
|
|
212
|
+
productName: "product_name",
|
|
213
|
+
variantName: "variant_name",
|
|
214
|
+
productType: "product_type",
|
|
215
|
+
shortDescription: "short_description",
|
|
216
|
+
stockAvailable: "stock_available",
|
|
217
|
+
onOffer: "on_offer",
|
|
218
|
+
onSubscription: "on_subscription",
|
|
219
|
+
onPromotion: "on_promotion",
|
|
220
|
+
categoryIds: "category_ids",
|
|
221
|
+
reviewsCount: "reviews_count",
|
|
222
|
+
reviewsRatingSum: "reviews_rating_sum",
|
|
223
|
+
associatedOptions: "associated_options",
|
|
224
|
+
});
|
|
225
|
+
});
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* @internal
|
|
229
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
230
|
+
*/
|
|
231
|
+
export namespace Sku$ {
|
|
232
|
+
/** @deprecated use `Sku$inboundSchema` instead. */
|
|
233
|
+
export const inboundSchema = Sku$inboundSchema;
|
|
234
|
+
/** @deprecated use `Sku$outboundSchema` instead. */
|
|
235
|
+
export const outboundSchema = Sku$outboundSchema;
|
|
236
|
+
/** @deprecated use `Sku$Outbound` instead. */
|
|
237
|
+
export type Outbound = Sku$Outbound;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
export function skuToJSON(sku: Sku): string {
|
|
241
|
+
return JSON.stringify(Sku$outboundSchema.parse(sku));
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
export function skuFromJSON(
|
|
245
|
+
jsonString: string,
|
|
246
|
+
): SafeParseResult<Sku, SDKValidationError> {
|
|
247
|
+
return safeParse(
|
|
248
|
+
jsonString,
|
|
249
|
+
(x) => Sku$inboundSchema.parse(JSON.parse(x)),
|
|
250
|
+
`Failed to parse 'Sku' from JSON`,
|
|
251
|
+
);
|
|
252
|
+
}
|
|
@@ -7,6 +7,12 @@ import { remap as remap$ } from "../../lib/primitives.js";
|
|
|
7
7
|
import { safeParse } from "../../lib/schemas.js";
|
|
8
8
|
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
9
9
|
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
10
|
+
import {
|
|
11
|
+
AssociatedOption,
|
|
12
|
+
AssociatedOption$inboundSchema,
|
|
13
|
+
AssociatedOption$Outbound,
|
|
14
|
+
AssociatedOption$outboundSchema,
|
|
15
|
+
} from "./associatedoption.js";
|
|
10
16
|
import {
|
|
11
17
|
ProductImage,
|
|
12
18
|
ProductImage$inboundSchema,
|
|
@@ -25,12 +31,6 @@ import {
|
|
|
25
31
|
ProductPromotion$Outbound,
|
|
26
32
|
ProductPromotion$outboundSchema,
|
|
27
33
|
} from "./productpromotion.js";
|
|
28
|
-
import {
|
|
29
|
-
ProductShipping,
|
|
30
|
-
ProductShipping$inboundSchema,
|
|
31
|
-
ProductShipping$Outbound,
|
|
32
|
-
ProductShipping$outboundSchema,
|
|
33
|
-
} from "./productshipping.js";
|
|
34
34
|
import {
|
|
35
35
|
ProductSubscription,
|
|
36
36
|
ProductSubscription$inboundSchema,
|
|
@@ -38,195 +38,103 @@ import {
|
|
|
38
38
|
ProductSubscription$outboundSchema,
|
|
39
39
|
} from "./productsubscription.js";
|
|
40
40
|
|
|
41
|
-
export type AssociatedOptions = {};
|
|
42
|
-
|
|
43
|
-
export type Metadata = {
|
|
44
|
-
key?: string | undefined;
|
|
45
|
-
value?: string | undefined;
|
|
46
|
-
};
|
|
47
|
-
|
|
48
41
|
export type Variant = {
|
|
49
42
|
/**
|
|
50
43
|
* variant id
|
|
51
44
|
*/
|
|
52
|
-
id
|
|
45
|
+
id: string;
|
|
53
46
|
/**
|
|
54
|
-
*
|
|
47
|
+
* product id
|
|
55
48
|
*/
|
|
56
|
-
|
|
49
|
+
productId: string;
|
|
57
50
|
/**
|
|
58
51
|
* variant sku
|
|
59
52
|
*/
|
|
60
53
|
sku?: string | undefined;
|
|
61
54
|
slug?: string | undefined;
|
|
62
|
-
|
|
55
|
+
/**
|
|
56
|
+
* variant name
|
|
57
|
+
*/
|
|
58
|
+
name: string;
|
|
59
|
+
/**
|
|
60
|
+
* variant name
|
|
61
|
+
*/
|
|
62
|
+
productName: string;
|
|
63
|
+
shortDescription: string;
|
|
64
|
+
active: boolean;
|
|
65
|
+
stockAvailable: boolean;
|
|
66
|
+
/**
|
|
67
|
+
* Indicates whether this item is associated with any active (product-specific) coupons
|
|
68
|
+
*/
|
|
69
|
+
onOffer?: boolean | undefined;
|
|
63
70
|
onPromotion?: boolean | undefined;
|
|
64
71
|
onSubscription?: boolean | undefined;
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
isDefault
|
|
72
|
+
/**
|
|
73
|
+
* Indicates whether a variant is marked as the default variant for a product
|
|
74
|
+
*/
|
|
75
|
+
isDefault: boolean;
|
|
76
|
+
associatedOptions: { [k: string]: AssociatedOption };
|
|
69
77
|
images?: Array<ProductImage> | undefined;
|
|
70
|
-
pricing
|
|
78
|
+
pricing: ProductPricing;
|
|
71
79
|
subscription?: Array<ProductSubscription> | undefined;
|
|
72
80
|
promotion?: Array<ProductPromotion> | undefined;
|
|
73
|
-
shipping?: ProductShipping | undefined;
|
|
74
|
-
metadata?: Array<Metadata> | null | undefined;
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
/** @internal */
|
|
78
|
-
export const AssociatedOptions$inboundSchema: z.ZodType<
|
|
79
|
-
AssociatedOptions,
|
|
80
|
-
z.ZodTypeDef,
|
|
81
|
-
unknown
|
|
82
|
-
> = z.object({});
|
|
83
|
-
|
|
84
|
-
/** @internal */
|
|
85
|
-
export type AssociatedOptions$Outbound = {};
|
|
86
|
-
|
|
87
|
-
/** @internal */
|
|
88
|
-
export const AssociatedOptions$outboundSchema: z.ZodType<
|
|
89
|
-
AssociatedOptions$Outbound,
|
|
90
|
-
z.ZodTypeDef,
|
|
91
|
-
AssociatedOptions
|
|
92
|
-
> = z.object({});
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* @internal
|
|
96
|
-
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
97
|
-
*/
|
|
98
|
-
export namespace AssociatedOptions$ {
|
|
99
|
-
/** @deprecated use `AssociatedOptions$inboundSchema` instead. */
|
|
100
|
-
export const inboundSchema = AssociatedOptions$inboundSchema;
|
|
101
|
-
/** @deprecated use `AssociatedOptions$outboundSchema` instead. */
|
|
102
|
-
export const outboundSchema = AssociatedOptions$outboundSchema;
|
|
103
|
-
/** @deprecated use `AssociatedOptions$Outbound` instead. */
|
|
104
|
-
export type Outbound = AssociatedOptions$Outbound;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
export function associatedOptionsToJSON(
|
|
108
|
-
associatedOptions: AssociatedOptions,
|
|
109
|
-
): string {
|
|
110
|
-
return JSON.stringify(
|
|
111
|
-
AssociatedOptions$outboundSchema.parse(associatedOptions),
|
|
112
|
-
);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
export function associatedOptionsFromJSON(
|
|
116
|
-
jsonString: string,
|
|
117
|
-
): SafeParseResult<AssociatedOptions, SDKValidationError> {
|
|
118
|
-
return safeParse(
|
|
119
|
-
jsonString,
|
|
120
|
-
(x) => AssociatedOptions$inboundSchema.parse(JSON.parse(x)),
|
|
121
|
-
`Failed to parse 'AssociatedOptions' from JSON`,
|
|
122
|
-
);
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
/** @internal */
|
|
126
|
-
export const Metadata$inboundSchema: z.ZodType<
|
|
127
|
-
Metadata,
|
|
128
|
-
z.ZodTypeDef,
|
|
129
|
-
unknown
|
|
130
|
-
> = z.object({
|
|
131
|
-
key: z.string().optional(),
|
|
132
|
-
value: z.string().optional(),
|
|
133
|
-
});
|
|
134
|
-
|
|
135
|
-
/** @internal */
|
|
136
|
-
export type Metadata$Outbound = {
|
|
137
|
-
key?: string | undefined;
|
|
138
|
-
value?: string | undefined;
|
|
139
81
|
};
|
|
140
82
|
|
|
141
|
-
/** @internal */
|
|
142
|
-
export const Metadata$outboundSchema: z.ZodType<
|
|
143
|
-
Metadata$Outbound,
|
|
144
|
-
z.ZodTypeDef,
|
|
145
|
-
Metadata
|
|
146
|
-
> = z.object({
|
|
147
|
-
key: z.string().optional(),
|
|
148
|
-
value: z.string().optional(),
|
|
149
|
-
});
|
|
150
|
-
|
|
151
|
-
/**
|
|
152
|
-
* @internal
|
|
153
|
-
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
154
|
-
*/
|
|
155
|
-
export namespace Metadata$ {
|
|
156
|
-
/** @deprecated use `Metadata$inboundSchema` instead. */
|
|
157
|
-
export const inboundSchema = Metadata$inboundSchema;
|
|
158
|
-
/** @deprecated use `Metadata$outboundSchema` instead. */
|
|
159
|
-
export const outboundSchema = Metadata$outboundSchema;
|
|
160
|
-
/** @deprecated use `Metadata$Outbound` instead. */
|
|
161
|
-
export type Outbound = Metadata$Outbound;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
export function metadataToJSON(metadata: Metadata): string {
|
|
165
|
-
return JSON.stringify(Metadata$outboundSchema.parse(metadata));
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
export function metadataFromJSON(
|
|
169
|
-
jsonString: string,
|
|
170
|
-
): SafeParseResult<Metadata, SDKValidationError> {
|
|
171
|
-
return safeParse(
|
|
172
|
-
jsonString,
|
|
173
|
-
(x) => Metadata$inboundSchema.parse(JSON.parse(x)),
|
|
174
|
-
`Failed to parse 'Metadata' from JSON`,
|
|
175
|
-
);
|
|
176
|
-
}
|
|
177
|
-
|
|
178
83
|
/** @internal */
|
|
179
84
|
export const Variant$inboundSchema: z.ZodType<Variant, z.ZodTypeDef, unknown> =
|
|
180
85
|
z.object({
|
|
181
|
-
id: z.string()
|
|
182
|
-
|
|
86
|
+
id: z.string(),
|
|
87
|
+
product_id: z.string(),
|
|
183
88
|
sku: z.string().optional(),
|
|
184
89
|
slug: z.string().optional(),
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
90
|
+
name: z.string(),
|
|
91
|
+
product_name: z.string(),
|
|
92
|
+
short_description: z.string(),
|
|
93
|
+
active: z.boolean(),
|
|
94
|
+
stock_available: z.boolean(),
|
|
95
|
+
on_offer: z.boolean().default(false),
|
|
96
|
+
on_promotion: z.boolean().default(false),
|
|
97
|
+
on_subscription: z.boolean().default(false),
|
|
98
|
+
is_default: z.boolean(),
|
|
99
|
+
associated_options: z.record(AssociatedOption$inboundSchema),
|
|
193
100
|
images: z.array(ProductImage$inboundSchema).optional(),
|
|
194
|
-
pricing: ProductPricing$inboundSchema
|
|
101
|
+
pricing: ProductPricing$inboundSchema,
|
|
195
102
|
subscription: z.array(ProductSubscription$inboundSchema).optional(),
|
|
196
103
|
promotion: z.array(ProductPromotion$inboundSchema).optional(),
|
|
197
|
-
shipping: ProductShipping$inboundSchema.optional(),
|
|
198
|
-
metadata: z.nullable(z.array(z.lazy(() => Metadata$inboundSchema)))
|
|
199
|
-
.optional(),
|
|
200
104
|
}).transform((v) => {
|
|
201
105
|
return remap$(v, {
|
|
106
|
+
"product_id": "productId",
|
|
107
|
+
"product_name": "productName",
|
|
108
|
+
"short_description": "shortDescription",
|
|
109
|
+
"stock_available": "stockAvailable",
|
|
110
|
+
"on_offer": "onOffer",
|
|
202
111
|
"on_promotion": "onPromotion",
|
|
203
112
|
"on_subscription": "onSubscription",
|
|
204
|
-
"associated_options": "associatedOptions",
|
|
205
|
-
"stock_available": "stockAvailable",
|
|
206
|
-
"short_description": "shortDescription",
|
|
207
113
|
"is_default": "isDefault",
|
|
114
|
+
"associated_options": "associatedOptions",
|
|
208
115
|
});
|
|
209
116
|
});
|
|
210
117
|
|
|
211
118
|
/** @internal */
|
|
212
119
|
export type Variant$Outbound = {
|
|
213
|
-
id
|
|
214
|
-
|
|
120
|
+
id: string;
|
|
121
|
+
product_id: string;
|
|
215
122
|
sku?: string | undefined;
|
|
216
123
|
slug?: string | undefined;
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
stock_available
|
|
222
|
-
|
|
223
|
-
|
|
124
|
+
name: string;
|
|
125
|
+
product_name: string;
|
|
126
|
+
short_description: string;
|
|
127
|
+
active: boolean;
|
|
128
|
+
stock_available: boolean;
|
|
129
|
+
on_offer: boolean;
|
|
130
|
+
on_promotion: boolean;
|
|
131
|
+
on_subscription: boolean;
|
|
132
|
+
is_default: boolean;
|
|
133
|
+
associated_options: { [k: string]: AssociatedOption$Outbound };
|
|
224
134
|
images?: Array<ProductImage$Outbound> | undefined;
|
|
225
|
-
pricing
|
|
135
|
+
pricing: ProductPricing$Outbound;
|
|
226
136
|
subscription?: Array<ProductSubscription$Outbound> | undefined;
|
|
227
137
|
promotion?: Array<ProductPromotion$Outbound> | undefined;
|
|
228
|
-
shipping?: ProductShipping$Outbound | undefined;
|
|
229
|
-
metadata?: Array<Metadata$Outbound> | null | undefined;
|
|
230
138
|
};
|
|
231
139
|
|
|
232
140
|
/** @internal */
|
|
@@ -235,32 +143,35 @@ export const Variant$outboundSchema: z.ZodType<
|
|
|
235
143
|
z.ZodTypeDef,
|
|
236
144
|
Variant
|
|
237
145
|
> = z.object({
|
|
238
|
-
id: z.string()
|
|
239
|
-
|
|
146
|
+
id: z.string(),
|
|
147
|
+
productId: z.string(),
|
|
240
148
|
sku: z.string().optional(),
|
|
241
149
|
slug: z.string().optional(),
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
stockAvailable: z.boolean()
|
|
247
|
-
|
|
248
|
-
|
|
150
|
+
name: z.string(),
|
|
151
|
+
productName: z.string(),
|
|
152
|
+
shortDescription: z.string(),
|
|
153
|
+
active: z.boolean(),
|
|
154
|
+
stockAvailable: z.boolean(),
|
|
155
|
+
onOffer: z.boolean().default(false),
|
|
156
|
+
onPromotion: z.boolean().default(false),
|
|
157
|
+
onSubscription: z.boolean().default(false),
|
|
158
|
+
isDefault: z.boolean(),
|
|
159
|
+
associatedOptions: z.record(AssociatedOption$outboundSchema),
|
|
249
160
|
images: z.array(ProductImage$outboundSchema).optional(),
|
|
250
|
-
pricing: ProductPricing$outboundSchema
|
|
161
|
+
pricing: ProductPricing$outboundSchema,
|
|
251
162
|
subscription: z.array(ProductSubscription$outboundSchema).optional(),
|
|
252
163
|
promotion: z.array(ProductPromotion$outboundSchema).optional(),
|
|
253
|
-
shipping: ProductShipping$outboundSchema.optional(),
|
|
254
|
-
metadata: z.nullable(z.array(z.lazy(() => Metadata$outboundSchema)))
|
|
255
|
-
.optional(),
|
|
256
164
|
}).transform((v) => {
|
|
257
165
|
return remap$(v, {
|
|
166
|
+
productId: "product_id",
|
|
167
|
+
productName: "product_name",
|
|
168
|
+
shortDescription: "short_description",
|
|
169
|
+
stockAvailable: "stock_available",
|
|
170
|
+
onOffer: "on_offer",
|
|
258
171
|
onPromotion: "on_promotion",
|
|
259
172
|
onSubscription: "on_subscription",
|
|
260
|
-
associatedOptions: "associated_options",
|
|
261
|
-
stockAvailable: "stock_available",
|
|
262
|
-
shortDescription: "short_description",
|
|
263
173
|
isDefault: "is_default",
|
|
174
|
+
associatedOptions: "associated_options",
|
|
264
175
|
});
|
|
265
176
|
});
|
|
266
177
|
|