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
|
@@ -5,20 +5,27 @@
|
|
|
5
5
|
import * as z from "zod";
|
|
6
6
|
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
7
|
import { safeParse } from "../../lib/schemas.js";
|
|
8
|
+
import { ClosedEnum } from "../../types/enums.js";
|
|
8
9
|
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
9
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";
|
|
10
23
|
import {
|
|
11
24
|
ProductImage,
|
|
12
25
|
ProductImage$inboundSchema,
|
|
13
26
|
ProductImage$Outbound,
|
|
14
27
|
ProductImage$outboundSchema,
|
|
15
28
|
} from "./productimage.js";
|
|
16
|
-
import {
|
|
17
|
-
ProductPackaging,
|
|
18
|
-
ProductPackaging$inboundSchema,
|
|
19
|
-
ProductPackaging$Outbound,
|
|
20
|
-
ProductPackaging$outboundSchema,
|
|
21
|
-
} from "./productpackaging.js";
|
|
22
29
|
import {
|
|
23
30
|
ProductPricing,
|
|
24
31
|
ProductPricing$inboundSchema,
|
|
@@ -55,148 +62,97 @@ import {
|
|
|
55
62
|
Seo$Outbound,
|
|
56
63
|
Seo$outboundSchema,
|
|
57
64
|
} from "./seo.js";
|
|
65
|
+
import {
|
|
66
|
+
VariantOption,
|
|
67
|
+
VariantOption$inboundSchema,
|
|
68
|
+
VariantOption$Outbound,
|
|
69
|
+
VariantOption$outboundSchema,
|
|
70
|
+
} from "./variantoption.js";
|
|
58
71
|
|
|
59
|
-
export
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
72
|
+
export const VariantDetailProductType = {
|
|
73
|
+
Physical: "physical",
|
|
74
|
+
Digital: "digital",
|
|
75
|
+
Bundle: "bundle",
|
|
76
|
+
} as const;
|
|
77
|
+
export type VariantDetailProductType = ClosedEnum<
|
|
78
|
+
typeof VariantDetailProductType
|
|
79
|
+
>;
|
|
65
80
|
|
|
66
81
|
export type VariantDetail = {
|
|
67
82
|
/**
|
|
68
83
|
* variant id
|
|
69
84
|
*/
|
|
70
|
-
id
|
|
85
|
+
id: string;
|
|
71
86
|
/**
|
|
72
|
-
*
|
|
87
|
+
* product id
|
|
73
88
|
*/
|
|
74
|
-
|
|
75
|
-
shortDescription?: string | undefined;
|
|
76
|
-
description?: string | undefined;
|
|
77
|
-
stockAvailable?: boolean | undefined;
|
|
78
|
-
isDefault?: boolean | undefined;
|
|
79
|
-
associatedOptions?: VariantDetailAssociatedOptions | undefined;
|
|
80
|
-
metadata?: Array<VariantDetailMetadata> | null | undefined;
|
|
89
|
+
productId: string;
|
|
81
90
|
/**
|
|
82
91
|
* variant sku
|
|
83
92
|
*/
|
|
84
93
|
sku?: string | undefined;
|
|
85
|
-
|
|
86
|
-
|
|
94
|
+
slug?: string | undefined;
|
|
95
|
+
/**
|
|
96
|
+
* variant name
|
|
97
|
+
*/
|
|
98
|
+
name: string;
|
|
99
|
+
/**
|
|
100
|
+
* variant name
|
|
101
|
+
*/
|
|
102
|
+
productName: string;
|
|
103
|
+
shortDescription: string;
|
|
104
|
+
active: boolean;
|
|
105
|
+
stockAvailable: boolean;
|
|
106
|
+
/**
|
|
107
|
+
* Indicates whether this item is associated with any active (product-specific) coupons
|
|
108
|
+
*/
|
|
109
|
+
onOffer?: boolean | undefined;
|
|
110
|
+
onPromotion?: boolean | undefined;
|
|
111
|
+
onSubscription?: boolean | undefined;
|
|
112
|
+
/**
|
|
113
|
+
* Indicates whether a variant is marked as the default variant for a product
|
|
114
|
+
*/
|
|
115
|
+
isDefault: boolean;
|
|
116
|
+
associatedOptions: { [k: string]: AssociatedOption };
|
|
87
117
|
images?: Array<ProductImage> | undefined;
|
|
88
|
-
|
|
89
|
-
packaging?: ProductPackaging | undefined;
|
|
90
|
-
promotion?: Array<ProductPromotion> | undefined;
|
|
118
|
+
pricing: ProductPricing;
|
|
91
119
|
subscription?: Array<ProductSubscription> | undefined;
|
|
120
|
+
promotion?: Array<ProductPromotion> | undefined;
|
|
121
|
+
productType: VariantDetailProductType;
|
|
122
|
+
description?: string | undefined;
|
|
123
|
+
categoryIds?: Array<string> | undefined;
|
|
124
|
+
tags?: Array<string> | null | undefined;
|
|
125
|
+
reviewRatingSum?: number | undefined;
|
|
126
|
+
reviewsCount?: number | undefined;
|
|
127
|
+
hsnCode?: string | undefined;
|
|
128
|
+
variantOptions: Array<VariantOption>;
|
|
129
|
+
productAttributes?: Array<ProductAttribute> | undefined;
|
|
130
|
+
variantAttributes?: Array<ProductAttribute> | undefined;
|
|
131
|
+
videos?: Array<ProductVideo> | undefined;
|
|
132
|
+
shipping?: ProductShipping | null | undefined;
|
|
92
133
|
seo?: Seo | undefined;
|
|
134
|
+
metadata?: { [k: string]: string } | undefined;
|
|
93
135
|
};
|
|
94
136
|
|
|
95
137
|
/** @internal */
|
|
96
|
-
export const
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
unknown
|
|
100
|
-
> = z.object({});
|
|
101
|
-
|
|
102
|
-
/** @internal */
|
|
103
|
-
export type VariantDetailAssociatedOptions$Outbound = {};
|
|
104
|
-
|
|
105
|
-
/** @internal */
|
|
106
|
-
export const VariantDetailAssociatedOptions$outboundSchema: z.ZodType<
|
|
107
|
-
VariantDetailAssociatedOptions$Outbound,
|
|
108
|
-
z.ZodTypeDef,
|
|
109
|
-
VariantDetailAssociatedOptions
|
|
110
|
-
> = z.object({});
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* @internal
|
|
114
|
-
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
115
|
-
*/
|
|
116
|
-
export namespace VariantDetailAssociatedOptions$ {
|
|
117
|
-
/** @deprecated use `VariantDetailAssociatedOptions$inboundSchema` instead. */
|
|
118
|
-
export const inboundSchema = VariantDetailAssociatedOptions$inboundSchema;
|
|
119
|
-
/** @deprecated use `VariantDetailAssociatedOptions$outboundSchema` instead. */
|
|
120
|
-
export const outboundSchema = VariantDetailAssociatedOptions$outboundSchema;
|
|
121
|
-
/** @deprecated use `VariantDetailAssociatedOptions$Outbound` instead. */
|
|
122
|
-
export type Outbound = VariantDetailAssociatedOptions$Outbound;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
export function variantDetailAssociatedOptionsToJSON(
|
|
126
|
-
variantDetailAssociatedOptions: VariantDetailAssociatedOptions,
|
|
127
|
-
): string {
|
|
128
|
-
return JSON.stringify(
|
|
129
|
-
VariantDetailAssociatedOptions$outboundSchema.parse(
|
|
130
|
-
variantDetailAssociatedOptions,
|
|
131
|
-
),
|
|
132
|
-
);
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
export function variantDetailAssociatedOptionsFromJSON(
|
|
136
|
-
jsonString: string,
|
|
137
|
-
): SafeParseResult<VariantDetailAssociatedOptions, SDKValidationError> {
|
|
138
|
-
return safeParse(
|
|
139
|
-
jsonString,
|
|
140
|
-
(x) => VariantDetailAssociatedOptions$inboundSchema.parse(JSON.parse(x)),
|
|
141
|
-
`Failed to parse 'VariantDetailAssociatedOptions' from JSON`,
|
|
142
|
-
);
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
/** @internal */
|
|
146
|
-
export const VariantDetailMetadata$inboundSchema: z.ZodType<
|
|
147
|
-
VariantDetailMetadata,
|
|
148
|
-
z.ZodTypeDef,
|
|
149
|
-
unknown
|
|
150
|
-
> = z.object({
|
|
151
|
-
key: z.string().optional(),
|
|
152
|
-
value: z.string().optional(),
|
|
153
|
-
});
|
|
138
|
+
export const VariantDetailProductType$inboundSchema: z.ZodNativeEnum<
|
|
139
|
+
typeof VariantDetailProductType
|
|
140
|
+
> = z.nativeEnum(VariantDetailProductType);
|
|
154
141
|
|
|
155
142
|
/** @internal */
|
|
156
|
-
export
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
};
|
|
160
|
-
|
|
161
|
-
/** @internal */
|
|
162
|
-
export const VariantDetailMetadata$outboundSchema: z.ZodType<
|
|
163
|
-
VariantDetailMetadata$Outbound,
|
|
164
|
-
z.ZodTypeDef,
|
|
165
|
-
VariantDetailMetadata
|
|
166
|
-
> = z.object({
|
|
167
|
-
key: z.string().optional(),
|
|
168
|
-
value: z.string().optional(),
|
|
169
|
-
});
|
|
143
|
+
export const VariantDetailProductType$outboundSchema: z.ZodNativeEnum<
|
|
144
|
+
typeof VariantDetailProductType
|
|
145
|
+
> = VariantDetailProductType$inboundSchema;
|
|
170
146
|
|
|
171
147
|
/**
|
|
172
148
|
* @internal
|
|
173
149
|
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
174
150
|
*/
|
|
175
|
-
export namespace
|
|
176
|
-
/** @deprecated use `
|
|
177
|
-
export const inboundSchema =
|
|
178
|
-
/** @deprecated use `
|
|
179
|
-
export const outboundSchema =
|
|
180
|
-
/** @deprecated use `VariantDetailMetadata$Outbound` instead. */
|
|
181
|
-
export type Outbound = VariantDetailMetadata$Outbound;
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
export function variantDetailMetadataToJSON(
|
|
185
|
-
variantDetailMetadata: VariantDetailMetadata,
|
|
186
|
-
): string {
|
|
187
|
-
return JSON.stringify(
|
|
188
|
-
VariantDetailMetadata$outboundSchema.parse(variantDetailMetadata),
|
|
189
|
-
);
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
export function variantDetailMetadataFromJSON(
|
|
193
|
-
jsonString: string,
|
|
194
|
-
): SafeParseResult<VariantDetailMetadata, SDKValidationError> {
|
|
195
|
-
return safeParse(
|
|
196
|
-
jsonString,
|
|
197
|
-
(x) => VariantDetailMetadata$inboundSchema.parse(JSON.parse(x)),
|
|
198
|
-
`Failed to parse 'VariantDetailMetadata' from JSON`,
|
|
199
|
-
);
|
|
151
|
+
export namespace VariantDetailProductType$ {
|
|
152
|
+
/** @deprecated use `VariantDetailProductType$inboundSchema` instead. */
|
|
153
|
+
export const inboundSchema = VariantDetailProductType$inboundSchema;
|
|
154
|
+
/** @deprecated use `VariantDetailProductType$outboundSchema` instead. */
|
|
155
|
+
export const outboundSchema = VariantDetailProductType$outboundSchema;
|
|
200
156
|
}
|
|
201
157
|
|
|
202
158
|
/** @internal */
|
|
@@ -205,54 +161,94 @@ export const VariantDetail$inboundSchema: z.ZodType<
|
|
|
205
161
|
z.ZodTypeDef,
|
|
206
162
|
unknown
|
|
207
163
|
> = z.object({
|
|
208
|
-
id: z.string()
|
|
209
|
-
|
|
210
|
-
short_description: z.string().optional(),
|
|
211
|
-
description: z.string().optional(),
|
|
212
|
-
stock_available: z.boolean().optional(),
|
|
213
|
-
is_default: z.boolean().optional(),
|
|
214
|
-
associated_options: z.lazy(() => VariantDetailAssociatedOptions$inboundSchema)
|
|
215
|
-
.optional(),
|
|
216
|
-
metadata: z.nullable(
|
|
217
|
-
z.array(z.lazy(() => VariantDetailMetadata$inboundSchema)),
|
|
218
|
-
).optional(),
|
|
164
|
+
id: z.string(),
|
|
165
|
+
product_id: z.string(),
|
|
219
166
|
sku: z.string().optional(),
|
|
220
|
-
|
|
221
|
-
|
|
167
|
+
slug: z.string().optional(),
|
|
168
|
+
name: z.string(),
|
|
169
|
+
product_name: z.string(),
|
|
170
|
+
short_description: z.string(),
|
|
171
|
+
active: z.boolean(),
|
|
172
|
+
stock_available: z.boolean(),
|
|
173
|
+
on_offer: z.boolean().default(false),
|
|
174
|
+
on_promotion: z.boolean().default(false),
|
|
175
|
+
on_subscription: z.boolean().default(false),
|
|
176
|
+
is_default: z.boolean(),
|
|
177
|
+
associated_options: z.record(AssociatedOption$inboundSchema),
|
|
222
178
|
images: z.array(ProductImage$inboundSchema).optional(),
|
|
223
|
-
|
|
224
|
-
packaging: ProductPackaging$inboundSchema.optional(),
|
|
225
|
-
promotion: z.array(ProductPromotion$inboundSchema).optional(),
|
|
179
|
+
pricing: ProductPricing$inboundSchema,
|
|
226
180
|
subscription: z.array(ProductSubscription$inboundSchema).optional(),
|
|
181
|
+
promotion: z.array(ProductPromotion$inboundSchema).optional(),
|
|
182
|
+
product_type: VariantDetailProductType$inboundSchema,
|
|
183
|
+
description: z.string().optional(),
|
|
184
|
+
category_ids: z.array(z.string()).optional(),
|
|
185
|
+
tags: z.nullable(z.array(z.string())).optional(),
|
|
186
|
+
review_rating_sum: z.number().optional(),
|
|
187
|
+
reviews_count: z.number().int().optional(),
|
|
188
|
+
hsn_code: z.string().optional(),
|
|
189
|
+
variant_options: z.array(VariantOption$inboundSchema),
|
|
190
|
+
product_attributes: z.array(ProductAttribute$inboundSchema).optional(),
|
|
191
|
+
variant_attributes: z.array(ProductAttribute$inboundSchema).optional(),
|
|
192
|
+
videos: z.array(ProductVideo$inboundSchema).optional(),
|
|
193
|
+
shipping: z.nullable(ProductShipping$inboundSchema).optional(),
|
|
227
194
|
seo: Seo$inboundSchema.optional(),
|
|
195
|
+
metadata: z.record(z.string()).optional(),
|
|
228
196
|
}).transform((v) => {
|
|
229
197
|
return remap$(v, {
|
|
198
|
+
"product_id": "productId",
|
|
199
|
+
"product_name": "productName",
|
|
230
200
|
"short_description": "shortDescription",
|
|
231
201
|
"stock_available": "stockAvailable",
|
|
202
|
+
"on_offer": "onOffer",
|
|
203
|
+
"on_promotion": "onPromotion",
|
|
204
|
+
"on_subscription": "onSubscription",
|
|
232
205
|
"is_default": "isDefault",
|
|
233
206
|
"associated_options": "associatedOptions",
|
|
207
|
+
"product_type": "productType",
|
|
208
|
+
"category_ids": "categoryIds",
|
|
209
|
+
"review_rating_sum": "reviewRatingSum",
|
|
210
|
+
"reviews_count": "reviewsCount",
|
|
211
|
+
"hsn_code": "hsnCode",
|
|
212
|
+
"variant_options": "variantOptions",
|
|
213
|
+
"product_attributes": "productAttributes",
|
|
214
|
+
"variant_attributes": "variantAttributes",
|
|
234
215
|
});
|
|
235
216
|
});
|
|
236
217
|
|
|
237
218
|
/** @internal */
|
|
238
219
|
export type VariantDetail$Outbound = {
|
|
239
|
-
id
|
|
240
|
-
|
|
241
|
-
short_description?: string | undefined;
|
|
242
|
-
description?: string | undefined;
|
|
243
|
-
stock_available?: boolean | undefined;
|
|
244
|
-
is_default?: boolean | undefined;
|
|
245
|
-
associated_options?: VariantDetailAssociatedOptions$Outbound | undefined;
|
|
246
|
-
metadata?: Array<VariantDetailMetadata$Outbound> | null | undefined;
|
|
220
|
+
id: string;
|
|
221
|
+
product_id: string;
|
|
247
222
|
sku?: string | undefined;
|
|
248
|
-
|
|
249
|
-
|
|
223
|
+
slug?: string | undefined;
|
|
224
|
+
name: string;
|
|
225
|
+
product_name: string;
|
|
226
|
+
short_description: string;
|
|
227
|
+
active: boolean;
|
|
228
|
+
stock_available: boolean;
|
|
229
|
+
on_offer: boolean;
|
|
230
|
+
on_promotion: boolean;
|
|
231
|
+
on_subscription: boolean;
|
|
232
|
+
is_default: boolean;
|
|
233
|
+
associated_options: { [k: string]: AssociatedOption$Outbound };
|
|
250
234
|
images?: Array<ProductImage$Outbound> | undefined;
|
|
251
|
-
|
|
252
|
-
packaging?: ProductPackaging$Outbound | undefined;
|
|
253
|
-
promotion?: Array<ProductPromotion$Outbound> | undefined;
|
|
235
|
+
pricing: ProductPricing$Outbound;
|
|
254
236
|
subscription?: Array<ProductSubscription$Outbound> | undefined;
|
|
237
|
+
promotion?: Array<ProductPromotion$Outbound> | undefined;
|
|
238
|
+
product_type: string;
|
|
239
|
+
description?: string | undefined;
|
|
240
|
+
category_ids?: Array<string> | undefined;
|
|
241
|
+
tags?: Array<string> | null | undefined;
|
|
242
|
+
review_rating_sum?: number | undefined;
|
|
243
|
+
reviews_count?: number | undefined;
|
|
244
|
+
hsn_code?: string | undefined;
|
|
245
|
+
variant_options: Array<VariantOption$Outbound>;
|
|
246
|
+
product_attributes?: Array<ProductAttribute$Outbound> | undefined;
|
|
247
|
+
variant_attributes?: Array<ProductAttribute$Outbound> | undefined;
|
|
248
|
+
videos?: Array<ProductVideo$Outbound> | undefined;
|
|
249
|
+
shipping?: ProductShipping$Outbound | null | undefined;
|
|
255
250
|
seo?: Seo$Outbound | undefined;
|
|
251
|
+
metadata?: { [k: string]: string } | undefined;
|
|
256
252
|
};
|
|
257
253
|
|
|
258
254
|
/** @internal */
|
|
@@ -261,32 +257,57 @@ export const VariantDetail$outboundSchema: z.ZodType<
|
|
|
261
257
|
z.ZodTypeDef,
|
|
262
258
|
VariantDetail
|
|
263
259
|
> = z.object({
|
|
264
|
-
id: z.string()
|
|
265
|
-
|
|
266
|
-
shortDescription: z.string().optional(),
|
|
267
|
-
description: z.string().optional(),
|
|
268
|
-
stockAvailable: z.boolean().optional(),
|
|
269
|
-
isDefault: z.boolean().optional(),
|
|
270
|
-
associatedOptions: z.lazy(() => VariantDetailAssociatedOptions$outboundSchema)
|
|
271
|
-
.optional(),
|
|
272
|
-
metadata: z.nullable(
|
|
273
|
-
z.array(z.lazy(() => VariantDetailMetadata$outboundSchema)),
|
|
274
|
-
).optional(),
|
|
260
|
+
id: z.string(),
|
|
261
|
+
productId: z.string(),
|
|
275
262
|
sku: z.string().optional(),
|
|
276
|
-
|
|
277
|
-
|
|
263
|
+
slug: z.string().optional(),
|
|
264
|
+
name: z.string(),
|
|
265
|
+
productName: z.string(),
|
|
266
|
+
shortDescription: z.string(),
|
|
267
|
+
active: z.boolean(),
|
|
268
|
+
stockAvailable: z.boolean(),
|
|
269
|
+
onOffer: z.boolean().default(false),
|
|
270
|
+
onPromotion: z.boolean().default(false),
|
|
271
|
+
onSubscription: z.boolean().default(false),
|
|
272
|
+
isDefault: z.boolean(),
|
|
273
|
+
associatedOptions: z.record(AssociatedOption$outboundSchema),
|
|
278
274
|
images: z.array(ProductImage$outboundSchema).optional(),
|
|
279
|
-
|
|
280
|
-
packaging: ProductPackaging$outboundSchema.optional(),
|
|
281
|
-
promotion: z.array(ProductPromotion$outboundSchema).optional(),
|
|
275
|
+
pricing: ProductPricing$outboundSchema,
|
|
282
276
|
subscription: z.array(ProductSubscription$outboundSchema).optional(),
|
|
277
|
+
promotion: z.array(ProductPromotion$outboundSchema).optional(),
|
|
278
|
+
productType: VariantDetailProductType$outboundSchema,
|
|
279
|
+
description: z.string().optional(),
|
|
280
|
+
categoryIds: z.array(z.string()).optional(),
|
|
281
|
+
tags: z.nullable(z.array(z.string())).optional(),
|
|
282
|
+
reviewRatingSum: z.number().optional(),
|
|
283
|
+
reviewsCount: z.number().int().optional(),
|
|
284
|
+
hsnCode: z.string().optional(),
|
|
285
|
+
variantOptions: z.array(VariantOption$outboundSchema),
|
|
286
|
+
productAttributes: z.array(ProductAttribute$outboundSchema).optional(),
|
|
287
|
+
variantAttributes: z.array(ProductAttribute$outboundSchema).optional(),
|
|
288
|
+
videos: z.array(ProductVideo$outboundSchema).optional(),
|
|
289
|
+
shipping: z.nullable(ProductShipping$outboundSchema).optional(),
|
|
283
290
|
seo: Seo$outboundSchema.optional(),
|
|
291
|
+
metadata: z.record(z.string()).optional(),
|
|
284
292
|
}).transform((v) => {
|
|
285
293
|
return remap$(v, {
|
|
294
|
+
productId: "product_id",
|
|
295
|
+
productName: "product_name",
|
|
286
296
|
shortDescription: "short_description",
|
|
287
297
|
stockAvailable: "stock_available",
|
|
298
|
+
onOffer: "on_offer",
|
|
299
|
+
onPromotion: "on_promotion",
|
|
300
|
+
onSubscription: "on_subscription",
|
|
288
301
|
isDefault: "is_default",
|
|
289
302
|
associatedOptions: "associated_options",
|
|
303
|
+
productType: "product_type",
|
|
304
|
+
categoryIds: "category_ids",
|
|
305
|
+
reviewRatingSum: "review_rating_sum",
|
|
306
|
+
reviewsCount: "reviews_count",
|
|
307
|
+
hsnCode: "hsn_code",
|
|
308
|
+
variantOptions: "variant_options",
|
|
309
|
+
productAttributes: "product_attributes",
|
|
310
|
+
variantAttributes: "variant_attributes",
|
|
290
311
|
});
|
|
291
312
|
});
|
|
292
313
|
|
|
@@ -0,0 +1,214 @@
|
|
|
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
|
+
|
|
12
|
+
export const OptionType = {
|
|
13
|
+
SingleSelect: "single-select",
|
|
14
|
+
Color: "color",
|
|
15
|
+
} as const;
|
|
16
|
+
export type OptionType = ClosedEnum<typeof OptionType>;
|
|
17
|
+
|
|
18
|
+
export type Two = {};
|
|
19
|
+
|
|
20
|
+
export type OptionValue = Two | string;
|
|
21
|
+
|
|
22
|
+
export type VariantOption = {
|
|
23
|
+
optionName?: string | undefined;
|
|
24
|
+
optionType?: OptionType | undefined;
|
|
25
|
+
/**
|
|
26
|
+
* When option_type is color, value will contain an array of objects like:
|
|
27
|
+
*
|
|
28
|
+
* @remarks
|
|
29
|
+
* ```json
|
|
30
|
+
* [
|
|
31
|
+
* {
|
|
32
|
+
* "name": "first_color",
|
|
33
|
+
* "hexcode": "#000000"
|
|
34
|
+
* },
|
|
35
|
+
* {
|
|
36
|
+
* "name": "second_color",
|
|
37
|
+
* "hexcode": "#FFFFFF"
|
|
38
|
+
* }
|
|
39
|
+
* ]
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
optionValue?: Array<Two | string> | undefined;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
/** @internal */
|
|
46
|
+
export const OptionType$inboundSchema: z.ZodNativeEnum<typeof OptionType> = z
|
|
47
|
+
.nativeEnum(OptionType);
|
|
48
|
+
|
|
49
|
+
/** @internal */
|
|
50
|
+
export const OptionType$outboundSchema: z.ZodNativeEnum<typeof OptionType> =
|
|
51
|
+
OptionType$inboundSchema;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* @internal
|
|
55
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
56
|
+
*/
|
|
57
|
+
export namespace OptionType$ {
|
|
58
|
+
/** @deprecated use `OptionType$inboundSchema` instead. */
|
|
59
|
+
export const inboundSchema = OptionType$inboundSchema;
|
|
60
|
+
/** @deprecated use `OptionType$outboundSchema` instead. */
|
|
61
|
+
export const outboundSchema = OptionType$outboundSchema;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/** @internal */
|
|
65
|
+
export const Two$inboundSchema: z.ZodType<Two, z.ZodTypeDef, unknown> = z
|
|
66
|
+
.object({});
|
|
67
|
+
|
|
68
|
+
/** @internal */
|
|
69
|
+
export type Two$Outbound = {};
|
|
70
|
+
|
|
71
|
+
/** @internal */
|
|
72
|
+
export const Two$outboundSchema: z.ZodType<Two$Outbound, z.ZodTypeDef, Two> = z
|
|
73
|
+
.object({});
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* @internal
|
|
77
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
78
|
+
*/
|
|
79
|
+
export namespace Two$ {
|
|
80
|
+
/** @deprecated use `Two$inboundSchema` instead. */
|
|
81
|
+
export const inboundSchema = Two$inboundSchema;
|
|
82
|
+
/** @deprecated use `Two$outboundSchema` instead. */
|
|
83
|
+
export const outboundSchema = Two$outboundSchema;
|
|
84
|
+
/** @deprecated use `Two$Outbound` instead. */
|
|
85
|
+
export type Outbound = Two$Outbound;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export function twoToJSON(two: Two): string {
|
|
89
|
+
return JSON.stringify(Two$outboundSchema.parse(two));
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export function twoFromJSON(
|
|
93
|
+
jsonString: string,
|
|
94
|
+
): SafeParseResult<Two, SDKValidationError> {
|
|
95
|
+
return safeParse(
|
|
96
|
+
jsonString,
|
|
97
|
+
(x) => Two$inboundSchema.parse(JSON.parse(x)),
|
|
98
|
+
`Failed to parse 'Two' from JSON`,
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/** @internal */
|
|
103
|
+
export const OptionValue$inboundSchema: z.ZodType<
|
|
104
|
+
OptionValue,
|
|
105
|
+
z.ZodTypeDef,
|
|
106
|
+
unknown
|
|
107
|
+
> = z.union([z.lazy(() => Two$inboundSchema), z.string()]);
|
|
108
|
+
|
|
109
|
+
/** @internal */
|
|
110
|
+
export type OptionValue$Outbound = Two$Outbound | string;
|
|
111
|
+
|
|
112
|
+
/** @internal */
|
|
113
|
+
export const OptionValue$outboundSchema: z.ZodType<
|
|
114
|
+
OptionValue$Outbound,
|
|
115
|
+
z.ZodTypeDef,
|
|
116
|
+
OptionValue
|
|
117
|
+
> = z.union([z.lazy(() => Two$outboundSchema), z.string()]);
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* @internal
|
|
121
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
122
|
+
*/
|
|
123
|
+
export namespace OptionValue$ {
|
|
124
|
+
/** @deprecated use `OptionValue$inboundSchema` instead. */
|
|
125
|
+
export const inboundSchema = OptionValue$inboundSchema;
|
|
126
|
+
/** @deprecated use `OptionValue$outboundSchema` instead. */
|
|
127
|
+
export const outboundSchema = OptionValue$outboundSchema;
|
|
128
|
+
/** @deprecated use `OptionValue$Outbound` instead. */
|
|
129
|
+
export type Outbound = OptionValue$Outbound;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export function optionValueToJSON(optionValue: OptionValue): string {
|
|
133
|
+
return JSON.stringify(OptionValue$outboundSchema.parse(optionValue));
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export function optionValueFromJSON(
|
|
137
|
+
jsonString: string,
|
|
138
|
+
): SafeParseResult<OptionValue, SDKValidationError> {
|
|
139
|
+
return safeParse(
|
|
140
|
+
jsonString,
|
|
141
|
+
(x) => OptionValue$inboundSchema.parse(JSON.parse(x)),
|
|
142
|
+
`Failed to parse 'OptionValue' from JSON`,
|
|
143
|
+
);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/** @internal */
|
|
147
|
+
export const VariantOption$inboundSchema: z.ZodType<
|
|
148
|
+
VariantOption,
|
|
149
|
+
z.ZodTypeDef,
|
|
150
|
+
unknown
|
|
151
|
+
> = z.object({
|
|
152
|
+
option_name: z.string().optional(),
|
|
153
|
+
option_type: OptionType$inboundSchema.optional(),
|
|
154
|
+
option_value: z.array(z.union([z.lazy(() => Two$inboundSchema), z.string()]))
|
|
155
|
+
.optional(),
|
|
156
|
+
}).transform((v) => {
|
|
157
|
+
return remap$(v, {
|
|
158
|
+
"option_name": "optionName",
|
|
159
|
+
"option_type": "optionType",
|
|
160
|
+
"option_value": "optionValue",
|
|
161
|
+
});
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
/** @internal */
|
|
165
|
+
export type VariantOption$Outbound = {
|
|
166
|
+
option_name?: string | undefined;
|
|
167
|
+
option_type?: string | undefined;
|
|
168
|
+
option_value?: Array<Two$Outbound | string> | undefined;
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
/** @internal */
|
|
172
|
+
export const VariantOption$outboundSchema: z.ZodType<
|
|
173
|
+
VariantOption$Outbound,
|
|
174
|
+
z.ZodTypeDef,
|
|
175
|
+
VariantOption
|
|
176
|
+
> = z.object({
|
|
177
|
+
optionName: z.string().optional(),
|
|
178
|
+
optionType: OptionType$outboundSchema.optional(),
|
|
179
|
+
optionValue: z.array(z.union([z.lazy(() => Two$outboundSchema), z.string()]))
|
|
180
|
+
.optional(),
|
|
181
|
+
}).transform((v) => {
|
|
182
|
+
return remap$(v, {
|
|
183
|
+
optionName: "option_name",
|
|
184
|
+
optionType: "option_type",
|
|
185
|
+
optionValue: "option_value",
|
|
186
|
+
});
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* @internal
|
|
191
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
192
|
+
*/
|
|
193
|
+
export namespace VariantOption$ {
|
|
194
|
+
/** @deprecated use `VariantOption$inboundSchema` instead. */
|
|
195
|
+
export const inboundSchema = VariantOption$inboundSchema;
|
|
196
|
+
/** @deprecated use `VariantOption$outboundSchema` instead. */
|
|
197
|
+
export const outboundSchema = VariantOption$outboundSchema;
|
|
198
|
+
/** @deprecated use `VariantOption$Outbound` instead. */
|
|
199
|
+
export type Outbound = VariantOption$Outbound;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
export function variantOptionToJSON(variantOption: VariantOption): string {
|
|
203
|
+
return JSON.stringify(VariantOption$outboundSchema.parse(variantOption));
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
export function variantOptionFromJSON(
|
|
207
|
+
jsonString: string,
|
|
208
|
+
): SafeParseResult<VariantOption, SDKValidationError> {
|
|
209
|
+
return safeParse(
|
|
210
|
+
jsonString,
|
|
211
|
+
(x) => VariantOption$inboundSchema.parse(JSON.parse(x)),
|
|
212
|
+
`Failed to parse 'VariantOption' from JSON`,
|
|
213
|
+
);
|
|
214
|
+
}
|
|
@@ -21,10 +21,6 @@ export type Slabs = {
|
|
|
21
21
|
|
|
22
22
|
export type VolumeBasedPromotion = {
|
|
23
23
|
promotionType?: "discount" | undefined;
|
|
24
|
-
/**
|
|
25
|
-
* Optional ID for a specific customer group.
|
|
26
|
-
*/
|
|
27
|
-
customerGroupId?: string | null | undefined;
|
|
28
24
|
slabs: Array<Slabs>;
|
|
29
25
|
};
|
|
30
26
|
|
|
@@ -95,19 +91,16 @@ export const VolumeBasedPromotion$inboundSchema: z.ZodType<
|
|
|
95
91
|
unknown
|
|
96
92
|
> = z.object({
|
|
97
93
|
promotion_type: z.literal("discount").optional(),
|
|
98
|
-
customer_group_id: z.nullable(z.string()).optional(),
|
|
99
94
|
slabs: z.array(z.lazy(() => Slabs$inboundSchema)),
|
|
100
95
|
}).transform((v) => {
|
|
101
96
|
return remap$(v, {
|
|
102
97
|
"promotion_type": "promotionType",
|
|
103
|
-
"customer_group_id": "customerGroupId",
|
|
104
98
|
});
|
|
105
99
|
});
|
|
106
100
|
|
|
107
101
|
/** @internal */
|
|
108
102
|
export type VolumeBasedPromotion$Outbound = {
|
|
109
103
|
promotion_type: "discount";
|
|
110
|
-
customer_group_id?: string | null | undefined;
|
|
111
104
|
slabs: Array<Slabs$Outbound>;
|
|
112
105
|
};
|
|
113
106
|
|
|
@@ -118,12 +111,10 @@ export const VolumeBasedPromotion$outboundSchema: z.ZodType<
|
|
|
118
111
|
VolumeBasedPromotion
|
|
119
112
|
> = z.object({
|
|
120
113
|
promotionType: z.literal("discount").default("discount" as const),
|
|
121
|
-
customerGroupId: z.nullable(z.string()).optional(),
|
|
122
114
|
slabs: z.array(z.lazy(() => Slabs$outboundSchema)),
|
|
123
115
|
}).transform((v) => {
|
|
124
116
|
return remap$(v, {
|
|
125
117
|
promotionType: "promotion_type",
|
|
126
|
-
customerGroupId: "customer_group_id",
|
|
127
118
|
});
|
|
128
119
|
});
|
|
129
120
|
|