@replohq/canopy-sdk 0.12.0 → 0.14.0
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/_vendor/replo-utils/lib/errors.d.ts +83 -0
- package/_vendor/replo-utils/lib/fonts.mjs +2 -40
- package/_vendor/replo-utils/lib/json.mjs +1 -1
- package/_vendor/replo-utils/lib/misc.mjs +2 -2
- package/_vendor/schemas/agentTools/customIntegrations/loaders/levanta.d.ts +49 -0
- package/_vendor/schemas/agentTools/customIntegrations/loaders/levanta.mjs +36 -0
- package/_vendor/schemas/agentTools/customIntegrations/loaders/product.d.ts +340 -0
- package/_vendor/schemas/agentTools/customIntegrations/loaders/product.mjs +51 -0
- package/_vendor/schemas/agentTools/customIntegrations/loaders/yotpo.d.ts +37 -0
- package/_vendor/schemas/agentTools/customIntegrations/loaders/yotpo.mjs +37 -0
- package/{cart/cart-schema.js → _vendor/schemas/cart.mjs} +17 -26
- package/_vendor/schemas/designLibrary.d.ts +4 -4
- package/_vendor/schemas/errors.d.ts +438 -0
- package/_vendor/schemas/errors.mjs +932 -0
- package/_vendor/schemas/generated/errors.d.ts +61 -0
- package/_vendor/schemas/generated/selectMode.d.ts +102 -0
- package/{loaders/loader-keys.d.ts → _vendor/schemas/loaderKeys.d.ts} +4 -4
- package/{loaders/loader-keys.js → _vendor/schemas/loaderKeys.mjs} +7 -8
- package/_vendor/schemas/objectType.d.ts +1038 -0
- package/_vendor/schemas/objectType.mjs +2 -0
- package/_vendor/schemas/registry.d.ts +539 -0
- package/_vendor/schemas/sandboxFiles.d.ts +36 -0
- package/_vendor/schemas/savedStyles.d.ts +2 -2
- package/_vendor/schemas/selectMode.d.ts +471 -0
- package/_vendor/schemas/selectMode.mjs +120 -4
- package/_vendor/schemas/sellingPlan.d.ts +60 -0
- package/_vendor/schemas/sellingPlan.mjs +1 -0
- package/cart/buy-now-action.js +3 -3
- package/cart/buy-now-action.js.map +2 -2
- package/cart/cart-provider.js +2 -2
- package/cart/cart-provider.js.map +2 -2
- package/cart/cart-types.d.ts +2 -1
- package/cart/cart-types.js.map +2 -2
- package/cart/hooks/use-add-to-cart.js +1 -1
- package/cart/hooks/use-add-to-cart.js.map +2 -2
- package/cart/hooks/use-buy-now.js +2 -2
- package/cart/hooks/use-buy-now.js.map +2 -2
- package/cart/utils/variant-to-cart-line.d.ts +1 -2
- package/cart/utils/variant-to-cart-line.js.map +1 -1
- package/chunk-4XLTENDR.mjs +33 -0
- package/chunk-A7EUNWRQ.mjs +765 -0
- package/{chunk-ME5W2TJM.mjs → chunk-OCB5XQYL.mjs} +2 -2
- package/chunk-QFYIXADC.mjs +42 -0
- package/editor/LinkInterceptor.js +4 -0
- package/editor/LinkInterceptor.js.map +2 -2
- package/editor/select-mode/EditorSelection.js +74 -1
- package/editor/select-mode/EditorSelection.js.map +2 -2
- package/editor/select-mode/descriptor/elementDescriptor.d.ts +13 -2
- package/editor/select-mode/descriptor/elementDescriptor.js +19 -31
- package/editor/select-mode/descriptor/elementDescriptor.js.map +2 -2
- package/editor/select-mode/descriptor/styleExtraction.d.ts +3 -0
- package/editor/select-mode/descriptor/styleExtraction.js +271 -0
- package/editor/select-mode/descriptor/styleExtraction.js.map +7 -0
- package/editor/select-mode/displayModeStore.d.ts +10 -0
- package/editor/select-mode/displayModeStore.js +47 -0
- package/editor/select-mode/displayModeStore.js.map +7 -0
- package/editor/select-mode/fast-refresh-relay.d.ts +3 -0
- package/editor/select-mode/fast-refresh-relay.js +35 -0
- package/editor/select-mode/fast-refresh-relay.js.map +7 -0
- package/editor/select-mode/fiber.d.ts +17 -0
- package/editor/select-mode/fiber.js +103 -34
- package/editor/select-mode/fiber.js.map +2 -2
- package/editor/select-mode/hooks/useEditModeStateMachine.d.ts +20 -0
- package/editor/select-mode/hooks/useEditModeStateMachine.js +226 -0
- package/editor/select-mode/hooks/useEditModeStateMachine.js.map +7 -0
- package/editor/select-mode/hooks/useOptimisticOverrides.d.ts +20 -0
- package/editor/select-mode/hooks/useOptimisticOverrides.js +284 -0
- package/editor/select-mode/hooks/useOptimisticOverrides.js.map +7 -0
- package/editor/select-mode/hooks/useParentMessaging.d.ts +17 -2
- package/editor/select-mode/hooks/useParentMessaging.js +66 -1
- package/editor/select-mode/hooks/useParentMessaging.js.map +2 -2
- package/editor/select-mode/hooks/useSelectModeController.js +5 -6
- package/editor/select-mode/hooks/useSelectModeController.js.map +2 -2
- package/editor/select-mode/hooks/useSelectionHover.js +16 -1
- package/editor/select-mode/hooks/useSelectionHover.js.map +2 -2
- package/editor/select-mode/hooks/useSelectionInteractions.d.ts +7 -2
- package/editor/select-mode/hooks/useSelectionInteractions.js +57 -18
- package/editor/select-mode/hooks/useSelectionInteractions.js.map +2 -2
- package/editor/select-mode/hooks/useSiblingResolution.d.ts +6 -0
- package/editor/select-mode/hooks/useSiblingResolution.js +59 -0
- package/editor/select-mode/hooks/useSiblingResolution.js.map +7 -0
- package/editor/select-mode/inlineTextMarks.d.ts +6 -0
- package/editor/select-mode/inlineTextMarks.js +25 -0
- package/editor/select-mode/inlineTextMarks.js.map +7 -0
- package/editor/select-mode/interactions/selectionGeometry.js +4 -0
- package/editor/select-mode/interactions/selectionGeometry.js.map +2 -2
- package/editor/select-mode/selectionFrame.d.ts +5 -0
- package/editor/select-mode/selectionFrame.js +25 -1
- package/editor/select-mode/selectionFrame.js.map +2 -2
- package/editor/select-mode/symbolicate.js +32 -10
- package/editor/select-mode/symbolicate.js.map +2 -2
- package/editor/select-mode/tiptapInlineEditor.d.ts +23 -0
- package/editor/select-mode/tiptapInlineEditor.js +120 -0
- package/editor/select-mode/tiptapInlineEditor.js.map +7 -0
- package/gateways/canopy-api.d.ts +3 -3
- package/gateways/canopy-api.js +3 -3
- package/gateways/canopy-api.js.map +2 -2
- package/loaders/collection-loader.d.ts +1 -1
- package/loaders/collection-loader.js +1 -1
- package/loaders/collection-loader.js.map +2 -2
- package/loaders/collection-products-loader.d.ts +1 -1
- package/loaders/collection-products-loader.js +1 -1
- package/loaders/collection-products-loader.js.map +2 -2
- package/loaders/invoke-loader.d.ts +2 -2
- package/loaders/invoke-loader.js +2 -2
- package/loaders/invoke-loader.js.map +2 -2
- package/loaders/levanta-product-loader.d.ts +1 -1
- package/loaders/levanta-product-loader.js +1 -1
- package/loaders/levanta-product-loader.js.map +2 -2
- package/loaders/okendo-reviews-loader.js +1 -1
- package/loaders/okendo-reviews-loader.js.map +2 -2
- package/loaders/prefetch-loaders.d.ts +1 -1
- package/loaders/prefetch-loaders.js.map +1 -1
- package/loaders/product-loader.d.ts +1 -1
- package/loaders/product-loader.js +1 -1
- package/loaders/product-loader.js.map +2 -2
- package/loaders/rebuy-recommendations-loader.js +1 -1
- package/loaders/rebuy-recommendations-loader.js.map +2 -2
- package/loaders/yotpo-review-aggregate-loader.d.ts +1 -1
- package/loaders/yotpo-review-aggregate-loader.js +1 -1
- package/loaders/yotpo-review-aggregate-loader.js.map +2 -2
- package/loaders/yotpo-reviews-loader.d.ts +1 -1
- package/loaders/yotpo-reviews-loader.js +1 -1
- package/loaders/yotpo-reviews-loader.js.map +2 -2
- package/package.json +9 -1
- package/cart/cart-schema.js.map +0 -7
- package/lib/canopy-error.d.ts +0 -25
- package/lib/canopy-error.js +0 -24
- package/lib/canopy-error.js.map +0 -7
- package/loaders/loader-keys.js.map +0 -7
- package/loaders/loader-schemas.d.ts +0 -755
- package/loaders/loader-schemas.js +0 -257
- package/loaders/loader-schemas.js.map +0 -7
- package/{cart/cart-schema.d.ts → _vendor/schemas/cart.d.ts} +0 -0
- package/{chunk-NCKKAFF7.mjs → chunk-ILGEM42C.mjs} +7 -7
|
@@ -0,0 +1,765 @@
|
|
|
1
|
+
import { sellingPlanGroupSchema } from './chunk-4XLTENDR.mjs';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
|
|
4
|
+
var registryItemTypeSchema = z.enum(["site", "page", "section", "skill", "plan", "branding", "product"]).describe("RegistryItemType");
|
|
5
|
+
var registryItemVisibilitySchema = z.enum(["public", "unlisted"]).describe("RegistryItemVisibility");
|
|
6
|
+
var registrySlugSchema = z.string().min(1).max(120).regex(/^[\da-z][\d_a-z-]*$/);
|
|
7
|
+
var registryItemIdSchema = z.uuid();
|
|
8
|
+
var registryContentFilesSchema = z.record(z.string().min(1), z.string()).refine((files) => Object.keys(files).length > 0, {
|
|
9
|
+
message: "Registry item content must include at least one file"
|
|
10
|
+
});
|
|
11
|
+
z.object({
|
|
12
|
+
sourceType: z.string().min(1).max(80),
|
|
13
|
+
sourceKey: z.string().min(1).max(512)
|
|
14
|
+
}).describe("RegistryItemSourceIdentity");
|
|
15
|
+
var visualDisplayMetadataSchema = z.object({
|
|
16
|
+
brandName: z.string().optional(),
|
|
17
|
+
brandDomain: z.string().optional(),
|
|
18
|
+
logoUrl: z.url().optional()
|
|
19
|
+
}).strict();
|
|
20
|
+
var siteTemplatePageSchema = z.object({
|
|
21
|
+
route: z.string(),
|
|
22
|
+
name: z.string(),
|
|
23
|
+
url: z.url()
|
|
24
|
+
}).strict();
|
|
25
|
+
var siteRegistryItemMetadataSchema = visualDisplayMetadataSchema.extend({
|
|
26
|
+
artifactRepo: z.string().optional(),
|
|
27
|
+
liveUrl: z.url().optional(),
|
|
28
|
+
pages: z.array(siteTemplatePageSchema).optional()
|
|
29
|
+
}).describe("SiteRegistryItemMetadata");
|
|
30
|
+
var pageRegistryItemMetadataSchema = visualDisplayMetadataSchema.extend({
|
|
31
|
+
keyFeatures: z.array(z.string().min(1).max(80)).max(6).optional(),
|
|
32
|
+
sectionsIncluded: z.array(z.string().min(1).max(80)).max(12).optional()
|
|
33
|
+
}).describe("PageRegistryItemMetadata");
|
|
34
|
+
var sectionRegistryItemMetadataSchema = visualDisplayMetadataSchema.describe("SectionRegistryItemMetadata");
|
|
35
|
+
var brandingRegistryItemMetadataSchema = z.object({
|
|
36
|
+
palette: z.array(z.string()).max(8).optional(),
|
|
37
|
+
logoUrl: z.url().optional(),
|
|
38
|
+
faviconUrl: z.url().optional(),
|
|
39
|
+
tagline: z.string().max(140).optional()
|
|
40
|
+
}).strict().describe("BrandingRegistryItemMetadata");
|
|
41
|
+
var skillRegistryItemMetadataSchema = z.object({
|
|
42
|
+
command: z.string().optional(),
|
|
43
|
+
tagline: z.string().optional(),
|
|
44
|
+
// (Ezra, 2026-07-09, REPL-29107): marks a catalog skill that bedrock-api
|
|
45
|
+
// preinstalls into every user's workspace skills. String-valued because
|
|
46
|
+
// catalog metadata is a string record end to end.
|
|
47
|
+
preinstall: z.literal("true").optional()
|
|
48
|
+
}).strict().describe("SkillRegistryItemMetadata");
|
|
49
|
+
var productRegistryItemMetadataSchema = z.object({
|
|
50
|
+
provider: z.string(),
|
|
51
|
+
providerDisplayName: z.string(),
|
|
52
|
+
providerProductId: z.string(),
|
|
53
|
+
type: z.string(),
|
|
54
|
+
categoryIds: z.array(z.string()).default([]),
|
|
55
|
+
defaultVariantId: z.string().nullish(),
|
|
56
|
+
areaCount: z.number().default(0),
|
|
57
|
+
methods: z.array(z.string()).default([]),
|
|
58
|
+
optionFacets: z.array(
|
|
59
|
+
z.object({ name: z.string(), values: z.array(z.string()) }).strict()
|
|
60
|
+
).default([])
|
|
61
|
+
}).strict().describe("ProductRegistryItemMetadata");
|
|
62
|
+
var genericRegistryItemMetadataSchema = z.union([
|
|
63
|
+
siteRegistryItemMetadataSchema,
|
|
64
|
+
pageRegistryItemMetadataSchema,
|
|
65
|
+
sectionRegistryItemMetadataSchema,
|
|
66
|
+
skillRegistryItemMetadataSchema,
|
|
67
|
+
brandingRegistryItemMetadataSchema,
|
|
68
|
+
productRegistryItemMetadataSchema
|
|
69
|
+
]).describe("GenericRegistryItemMetadata");
|
|
70
|
+
var registryItemMetadataSchema = z.object({
|
|
71
|
+
id: z.string(),
|
|
72
|
+
slug: z.string(),
|
|
73
|
+
name: z.string(),
|
|
74
|
+
type: registryItemTypeSchema,
|
|
75
|
+
metadata: genericRegistryItemMetadataSchema.nullable(),
|
|
76
|
+
projectId: z.string().nullable(),
|
|
77
|
+
createdBy: z.string().nullable(),
|
|
78
|
+
sourceType: z.string().nullable(),
|
|
79
|
+
sourceKey: z.string().nullable(),
|
|
80
|
+
shortLink: z.string().nullable(),
|
|
81
|
+
description: z.string().nullable(),
|
|
82
|
+
visibility: z.string(),
|
|
83
|
+
tags: z.array(z.string()),
|
|
84
|
+
category: z.string().nullable(),
|
|
85
|
+
previewUrls: z.array(z.string()),
|
|
86
|
+
createdAt: z.string(),
|
|
87
|
+
updatedAt: z.string()
|
|
88
|
+
}).describe("RegistryItemMetadata");
|
|
89
|
+
z.object({
|
|
90
|
+
items: z.array(registryItemMetadataSchema),
|
|
91
|
+
nextCursor: z.string().nullable()
|
|
92
|
+
}).describe("FindRegistryItemsResult");
|
|
93
|
+
z.object({
|
|
94
|
+
categories: z.array(z.string())
|
|
95
|
+
}).describe("RegistryItemCategoriesResult");
|
|
96
|
+
z.object({
|
|
97
|
+
tags: z.array(z.string())
|
|
98
|
+
}).describe("RegistryItemTagsResult");
|
|
99
|
+
var registryItemDetailSchema = registryItemMetadataSchema.extend({
|
|
100
|
+
previewHtml: z.string().nullable()
|
|
101
|
+
}).describe("RegistryItemDetail");
|
|
102
|
+
z.object({
|
|
103
|
+
item: registryItemDetailSchema.extend({
|
|
104
|
+
projectId: z.null(),
|
|
105
|
+
createdBy: z.null()
|
|
106
|
+
})
|
|
107
|
+
}).describe("RegistryItemPreviewResult");
|
|
108
|
+
z.object({
|
|
109
|
+
meta: z.object({
|
|
110
|
+
id: z.string(),
|
|
111
|
+
slug: z.string(),
|
|
112
|
+
type: registryItemTypeSchema,
|
|
113
|
+
name: z.string(),
|
|
114
|
+
description: z.string().nullable()
|
|
115
|
+
}),
|
|
116
|
+
files: z.record(z.string(), z.string()),
|
|
117
|
+
dependencies: z.array(z.string())
|
|
118
|
+
}).describe("RegistryItemContent");
|
|
119
|
+
z.object({
|
|
120
|
+
id: z.uuid(),
|
|
121
|
+
slug: z.string().min(1),
|
|
122
|
+
name: z.string().min(1),
|
|
123
|
+
type: registryItemTypeSchema,
|
|
124
|
+
projectId: z.string().min(1).nullable(),
|
|
125
|
+
createdBy: z.string().min(1).nullable(),
|
|
126
|
+
description: z.string().nullable(),
|
|
127
|
+
visibility: z.string(),
|
|
128
|
+
tags: z.array(z.string()),
|
|
129
|
+
category: z.string().nullable(),
|
|
130
|
+
sourceType: z.string().nullable().default(null),
|
|
131
|
+
sourceKey: z.string().nullable().default(null),
|
|
132
|
+
shortLink: z.string().nullable().default(null),
|
|
133
|
+
previewUrls: z.array(z.string()),
|
|
134
|
+
previewHtml: z.string().nullable(),
|
|
135
|
+
metadata: z.record(z.string(), z.unknown()).nullable(),
|
|
136
|
+
files: registryContentFilesSchema,
|
|
137
|
+
dependencies: z.array(z.string()),
|
|
138
|
+
embeddingText: z.string(),
|
|
139
|
+
embedding: z.array(z.number()),
|
|
140
|
+
createdAt: z.string().min(1),
|
|
141
|
+
updatedAt: z.string().min(1)
|
|
142
|
+
}).describe("RegistryItemDocument");
|
|
143
|
+
z.object({
|
|
144
|
+
item: z.object({
|
|
145
|
+
id: registryItemIdSchema,
|
|
146
|
+
slug: registrySlugSchema,
|
|
147
|
+
name: z.string().min(1),
|
|
148
|
+
type: registryItemTypeSchema,
|
|
149
|
+
projectId: z.string().min(1).nullable().default(null),
|
|
150
|
+
createdBy: z.string().min(1).nullable().default(null),
|
|
151
|
+
sourceType: z.string().min(1).max(80).nullable().default(null),
|
|
152
|
+
sourceKey: z.string().min(1).max(512).nullable().default(null),
|
|
153
|
+
description: z.string().nullable().default(null),
|
|
154
|
+
metadata: z.record(z.string(), z.unknown()).nullable().default(null),
|
|
155
|
+
// (Ezra, 2026-07-07, REPL-27571): owned channels (REST create, MCP
|
|
156
|
+
// create_registry_item) may not author public items — only the internal
|
|
157
|
+
// registry-catalog endpoint does — so an omitted visibility must resolve
|
|
158
|
+
// to the project-scoped lane instead of silently going public.
|
|
159
|
+
visibility: registryItemVisibilitySchema.default("unlisted"),
|
|
160
|
+
tags: z.array(z.string()).default([]),
|
|
161
|
+
category: z.string().nullable().default(null),
|
|
162
|
+
previewUrls: z.array(z.string()).default([]),
|
|
163
|
+
previewHtml: z.string().nullable().default(null),
|
|
164
|
+
files: registryContentFilesSchema,
|
|
165
|
+
dependencies: z.array(z.string()).default([])
|
|
166
|
+
})
|
|
167
|
+
}).describe("RegistryCreateItemInput");
|
|
168
|
+
z.object({
|
|
169
|
+
created: z.object({
|
|
170
|
+
id: registryItemIdSchema,
|
|
171
|
+
type: registryItemTypeSchema,
|
|
172
|
+
slug: registrySlugSchema,
|
|
173
|
+
sourceType: z.string().nullable(),
|
|
174
|
+
sourceKey: z.string().nullable(),
|
|
175
|
+
url: z.url().describe(
|
|
176
|
+
"Canonical public-facing URL for the new registry item. The skill returns this to the user immediately so they can share / preview without waiting on verification."
|
|
177
|
+
),
|
|
178
|
+
shareUrl: z.url().nullable()
|
|
179
|
+
})
|
|
180
|
+
}).describe("RegistryCreateItemOutput");
|
|
181
|
+
z.object({
|
|
182
|
+
name: z.string().min(1),
|
|
183
|
+
description: z.string().nullish(),
|
|
184
|
+
metadata: z.record(z.string(), z.unknown()).nullish(),
|
|
185
|
+
visibility: registryItemVisibilitySchema.optional(),
|
|
186
|
+
tags: z.array(z.string()).optional(),
|
|
187
|
+
category: z.string().nullish(),
|
|
188
|
+
previewUrls: z.array(z.string()).optional(),
|
|
189
|
+
previewHtml: z.string().nullish(),
|
|
190
|
+
files: registryContentFilesSchema,
|
|
191
|
+
dependencies: z.array(z.string()).optional()
|
|
192
|
+
}).describe("RegistryCatalogUpsertInput");
|
|
193
|
+
z.object({
|
|
194
|
+
appName: z.string(),
|
|
195
|
+
filepath: z.string(),
|
|
196
|
+
route: z.string(),
|
|
197
|
+
modifiedAt: z.number().optional(),
|
|
198
|
+
// Birth-time (epoch ms) from `stat`, falling back to mtime when the
|
|
199
|
+
// filesystem reports 0/unsupported. Used to sort the pages dashboard.
|
|
200
|
+
createdAt: z.number().optional()
|
|
201
|
+
}).describe("SandboxFile");
|
|
202
|
+
var workspaceSkillSourceSchema = z.enum(["builtin", "project"]).describe("WorkspaceSkillSource");
|
|
203
|
+
z.object({
|
|
204
|
+
slug: z.string(),
|
|
205
|
+
source: workspaceSkillSourceSchema,
|
|
206
|
+
filepath: z.string().optional(),
|
|
207
|
+
name: z.string(),
|
|
208
|
+
description: z.string(),
|
|
209
|
+
body: z.string(),
|
|
210
|
+
tagline: z.string().optional(),
|
|
211
|
+
category: z.string().optional(),
|
|
212
|
+
tags: z.array(z.string()),
|
|
213
|
+
imageUrl: z.string().optional(),
|
|
214
|
+
shape: z.string().optional(),
|
|
215
|
+
gradient: z.string().optional(),
|
|
216
|
+
modifiedAt: z.number().optional()
|
|
217
|
+
}).describe("WorkspaceSkill");
|
|
218
|
+
var skillFileSchema = z.object({
|
|
219
|
+
id: z.string(),
|
|
220
|
+
name: z.string(),
|
|
221
|
+
description: z.string(),
|
|
222
|
+
body: z.string()
|
|
223
|
+
}).describe("SkillFile");
|
|
224
|
+
|
|
225
|
+
// ../schemas/objectType.ts
|
|
226
|
+
var imageSchema = z.object({
|
|
227
|
+
url: z.string(),
|
|
228
|
+
altText: z.string().nullable(),
|
|
229
|
+
width: z.number().nullable(),
|
|
230
|
+
height: z.number().nullable()
|
|
231
|
+
});
|
|
232
|
+
var mediaImageSchema = z.object({
|
|
233
|
+
type: z.literal("image"),
|
|
234
|
+
alt: z.string().nullable(),
|
|
235
|
+
url: z.string(),
|
|
236
|
+
width: z.number().nullable(),
|
|
237
|
+
height: z.number().nullable()
|
|
238
|
+
});
|
|
239
|
+
var videoSourceSchema = z.object({
|
|
240
|
+
url: z.string(),
|
|
241
|
+
mimeType: z.string(),
|
|
242
|
+
format: z.string(),
|
|
243
|
+
width: z.number().nullable(),
|
|
244
|
+
height: z.number().nullable()
|
|
245
|
+
});
|
|
246
|
+
var previewImageSchema = z.object({
|
|
247
|
+
alt: z.string().nullable(),
|
|
248
|
+
url: z.string(),
|
|
249
|
+
width: z.number().nullable(),
|
|
250
|
+
height: z.number().nullable()
|
|
251
|
+
});
|
|
252
|
+
var videoSchema = z.object({
|
|
253
|
+
type: z.literal("video"),
|
|
254
|
+
alt: z.string().nullable(),
|
|
255
|
+
sources: z.array(videoSourceSchema),
|
|
256
|
+
previewImage: previewImageSchema.nullable()
|
|
257
|
+
});
|
|
258
|
+
var externalVideoSchema = z.object({
|
|
259
|
+
type: z.literal("externalVideo"),
|
|
260
|
+
alt: z.string().nullable(),
|
|
261
|
+
embedUrl: z.string(),
|
|
262
|
+
host: z.string(),
|
|
263
|
+
originUrl: z.string(),
|
|
264
|
+
previewImage: previewImageSchema.nullable()
|
|
265
|
+
});
|
|
266
|
+
var mediaSchema = z.discriminatedUnion("type", [
|
|
267
|
+
mediaImageSchema,
|
|
268
|
+
videoSchema,
|
|
269
|
+
externalVideoSchema
|
|
270
|
+
]);
|
|
271
|
+
var priceSchema = z.object({
|
|
272
|
+
amount: z.string(),
|
|
273
|
+
currencyCode: z.string()
|
|
274
|
+
});
|
|
275
|
+
var selectedOptionSchema = z.object({
|
|
276
|
+
name: z.string(),
|
|
277
|
+
value: z.string()
|
|
278
|
+
});
|
|
279
|
+
var optionValueSwatchSchema = z.object({
|
|
280
|
+
color: z.string().nullable(),
|
|
281
|
+
imageUrl: z.string().nullable()
|
|
282
|
+
});
|
|
283
|
+
var optionValueSchema = z.object({
|
|
284
|
+
id: z.string(),
|
|
285
|
+
value: z.string(),
|
|
286
|
+
swatch: optionValueSwatchSchema.nullable()
|
|
287
|
+
});
|
|
288
|
+
var productOptionSchema = z.object({
|
|
289
|
+
id: z.string().optional(),
|
|
290
|
+
name: z.string(),
|
|
291
|
+
values: z.array(z.string()),
|
|
292
|
+
optionValues: z.array(optionValueSchema).optional()
|
|
293
|
+
});
|
|
294
|
+
var metafieldSchema = z.object({
|
|
295
|
+
key: z.string(),
|
|
296
|
+
namespace: z.string(),
|
|
297
|
+
type: z.string(),
|
|
298
|
+
value: z.string()
|
|
299
|
+
});
|
|
300
|
+
var variantSchema = z.object({
|
|
301
|
+
id: z.string(),
|
|
302
|
+
title: z.string().optional(),
|
|
303
|
+
availableForSale: z.boolean().optional(),
|
|
304
|
+
sku: z.string().nullish(),
|
|
305
|
+
selectedOptions: z.array(selectedOptionSchema).optional(),
|
|
306
|
+
image: imageSchema.nullish(),
|
|
307
|
+
price: priceSchema.optional(),
|
|
308
|
+
compareAtPrice: priceSchema.nullish(),
|
|
309
|
+
sellingPlanIds: z.array(z.string()).optional()
|
|
310
|
+
});
|
|
311
|
+
var productSchema = z.object({
|
|
312
|
+
id: z.string(),
|
|
313
|
+
handle: z.string().optional(),
|
|
314
|
+
title: z.string().optional(),
|
|
315
|
+
description: z.string().nullish(),
|
|
316
|
+
descriptionHtml: z.string().nullish(),
|
|
317
|
+
availableForSale: z.boolean().optional(),
|
|
318
|
+
featuredImage: imageSchema.nullish(),
|
|
319
|
+
options: z.array(productOptionSchema).optional(),
|
|
320
|
+
variants: z.array(variantSchema).optional(),
|
|
321
|
+
minPrice: priceSchema.optional(),
|
|
322
|
+
maxPrice: priceSchema.optional(),
|
|
323
|
+
// Storefront `compareAtPriceRange` returns 0.0 amounts when no variant has a
|
|
324
|
+
// compare-at price. Consumers should treat `amount === "0.0"` as "no
|
|
325
|
+
// discount" rather than infer it from nullability.
|
|
326
|
+
compareAtMinPrice: priceSchema.optional(),
|
|
327
|
+
compareAtMaxPrice: priceSchema.optional(),
|
|
328
|
+
images: z.array(imageSchema).optional(),
|
|
329
|
+
media: z.array(mediaSchema).optional(),
|
|
330
|
+
vendor: z.string().nullish(),
|
|
331
|
+
productType: z.string().nullish(),
|
|
332
|
+
tags: z.array(z.string()).optional(),
|
|
333
|
+
sellingPlanGroups: z.array(sellingPlanGroupSchema).optional(),
|
|
334
|
+
metafields: z.array(metafieldSchema).optional()
|
|
335
|
+
});
|
|
336
|
+
var collectionSchema = z.object({
|
|
337
|
+
id: z.string(),
|
|
338
|
+
handle: z.string().optional(),
|
|
339
|
+
title: z.string().optional(),
|
|
340
|
+
descriptionHtml: z.string().nullish(),
|
|
341
|
+
image: imageSchema.nullish()
|
|
342
|
+
});
|
|
343
|
+
var discountCodeSchema = z.object({
|
|
344
|
+
id: z.string(),
|
|
345
|
+
// The redeemable code(s) customers enter at checkout. A single Shopify
|
|
346
|
+
// discount can expose more than one code, so this is an array.
|
|
347
|
+
codes: z.array(z.string()).optional(),
|
|
348
|
+
// The merchant-facing discount name, which is distinct from the code itself.
|
|
349
|
+
title: z.string().optional(),
|
|
350
|
+
// Shopify DiscountStatus: ACTIVE, EXPIRED, or SCHEDULED. Kept as a string so
|
|
351
|
+
// new Shopify statuses do not break parsing.
|
|
352
|
+
status: z.string().optional(),
|
|
353
|
+
// Human-readable explanation of the discount (e.g. "20% off all products").
|
|
354
|
+
summary: z.string().nullish(),
|
|
355
|
+
// Shopify discount union type: DiscountCodeBasic, DiscountCodeBxgy,
|
|
356
|
+
// DiscountCodeFreeShipping, or DiscountCodeApp.
|
|
357
|
+
discountType: z.string().optional(),
|
|
358
|
+
startsAt: z.string().nullish(),
|
|
359
|
+
endsAt: z.string().nullish(),
|
|
360
|
+
usageLimit: z.number().nullish(),
|
|
361
|
+
usageCount: z.number().optional(),
|
|
362
|
+
appliesOncePerCustomer: z.boolean().optional()
|
|
363
|
+
});
|
|
364
|
+
var assetSchema = z.object({
|
|
365
|
+
id: z.string(),
|
|
366
|
+
name: z.string().optional(),
|
|
367
|
+
url: z.string().optional(),
|
|
368
|
+
fileExtension: z.string().optional()
|
|
369
|
+
});
|
|
370
|
+
var integrationSchema = z.object({
|
|
371
|
+
type: z.string(),
|
|
372
|
+
title: z.string().optional(),
|
|
373
|
+
image: z.string().optional()
|
|
374
|
+
});
|
|
375
|
+
var pageSchema = z.object({
|
|
376
|
+
id: z.string(),
|
|
377
|
+
name: z.string().optional(),
|
|
378
|
+
route: z.string().optional()
|
|
379
|
+
}).describe("ObjectTypePage");
|
|
380
|
+
var registryItemSchema = z.object({
|
|
381
|
+
id: z.string(),
|
|
382
|
+
slug: z.string().optional(),
|
|
383
|
+
title: z.string().optional(),
|
|
384
|
+
type: registryItemTypeSchema.optional(),
|
|
385
|
+
description: z.string().optional(),
|
|
386
|
+
previewUrl: z.string().optional()
|
|
387
|
+
}).describe("ObjectTypeRegistryItem");
|
|
388
|
+
var opusClipSchema = z.object({
|
|
389
|
+
id: z.string(),
|
|
390
|
+
title: z.string().optional(),
|
|
391
|
+
description: z.string().optional(),
|
|
392
|
+
previewUrl: z.string().optional(),
|
|
393
|
+
exportUrl: z.string().optional(),
|
|
394
|
+
durationMs: z.number().optional(),
|
|
395
|
+
opusProjectId: z.string().optional(),
|
|
396
|
+
projectTitle: z.string().optional()
|
|
397
|
+
});
|
|
398
|
+
var opusProjectSchema = z.object({
|
|
399
|
+
id: z.string(),
|
|
400
|
+
title: z.string().optional(),
|
|
401
|
+
sourceVideoUrl: z.string().optional(),
|
|
402
|
+
createdAtIso: z.string().optional()
|
|
403
|
+
}).describe("OpusProject");
|
|
404
|
+
var opusCollectionSchema = z.object({
|
|
405
|
+
id: z.string(),
|
|
406
|
+
name: z.string().optional(),
|
|
407
|
+
createdAt: z.string().optional(),
|
|
408
|
+
updatedAt: z.string().optional()
|
|
409
|
+
});
|
|
410
|
+
var segmentSourceSchema = z.object({
|
|
411
|
+
id: z.string().describe("segmentSource primaryId"),
|
|
412
|
+
slug: z.string().optional(),
|
|
413
|
+
name: z.string().optional(),
|
|
414
|
+
enabled: z.boolean().optional(),
|
|
415
|
+
sourceType: z.string().optional(),
|
|
416
|
+
writeKeys: z.array(z.string()).optional()
|
|
417
|
+
}).describe("SegmentSource");
|
|
418
|
+
var levantaAffiliateLinkSchema = z.object({
|
|
419
|
+
linkId: z.string(),
|
|
420
|
+
url: z.string()
|
|
421
|
+
});
|
|
422
|
+
var levantaProductSchema = z.object({
|
|
423
|
+
id: z.string(),
|
|
424
|
+
asin: z.string().optional(),
|
|
425
|
+
title: z.string().optional(),
|
|
426
|
+
price: z.string().optional().describe('Product price as a decimal string in USD (e.g. "34.99").'),
|
|
427
|
+
commission: z.string().optional().describe(
|
|
428
|
+
'Creator commission rate as a decimal string percentage (e.g. "8.5" meaning 8.5%).'
|
|
429
|
+
),
|
|
430
|
+
imageUrl: z.string().nullish(),
|
|
431
|
+
brand: z.object({ id: z.string(), name: z.string() }).nullish(),
|
|
432
|
+
inStock: z.boolean().optional(),
|
|
433
|
+
marketplace: z.string().optional(),
|
|
434
|
+
affiliateLink: levantaAffiliateLinkSchema.nullish()
|
|
435
|
+
}).describe("LevantaProduct");
|
|
436
|
+
var intelligemsExperienceSchema = z.object({
|
|
437
|
+
id: z.string(),
|
|
438
|
+
name: z.string().optional(),
|
|
439
|
+
category: z.string().optional(),
|
|
440
|
+
status: z.string().optional()
|
|
441
|
+
}).describe("IntelligemsExperience");
|
|
442
|
+
var customerIoSegmentSchema = z.object({
|
|
443
|
+
id: z.string().describe("customerIoSegment primaryId"),
|
|
444
|
+
name: z.string().optional(),
|
|
445
|
+
description: z.string().optional(),
|
|
446
|
+
type: z.string().optional()
|
|
447
|
+
}).describe("CustomerIoSegment");
|
|
448
|
+
var customerIoCampaignSchema = z.object({
|
|
449
|
+
id: z.string().describe("customerIoCampaign primaryId"),
|
|
450
|
+
name: z.string().optional(),
|
|
451
|
+
type: z.string().optional(),
|
|
452
|
+
active: z.boolean().optional()
|
|
453
|
+
}).describe("CustomerIoCampaign");
|
|
454
|
+
var customerIoBroadcastSchema = z.object({
|
|
455
|
+
id: z.string().describe("customerIoBroadcast primaryId"),
|
|
456
|
+
name: z.string().optional(),
|
|
457
|
+
active: z.boolean().optional()
|
|
458
|
+
}).describe("CustomerIoBroadcast");
|
|
459
|
+
var vwoCampaignSchema = z.object({
|
|
460
|
+
id: z.string(),
|
|
461
|
+
name: z.string().optional(),
|
|
462
|
+
type: z.string().optional(),
|
|
463
|
+
status: z.string().optional()
|
|
464
|
+
}).describe("VwoCampaign");
|
|
465
|
+
var okendoReviewSchema = z.object({
|
|
466
|
+
id: z.string(),
|
|
467
|
+
title: z.string().optional(),
|
|
468
|
+
body: z.string().optional(),
|
|
469
|
+
rating: z.number().optional(),
|
|
470
|
+
productName: z.string().optional(),
|
|
471
|
+
reviewerName: z.string().optional(),
|
|
472
|
+
dateCreated: z.string().optional(),
|
|
473
|
+
status: z.string().optional()
|
|
474
|
+
}).describe("OkendoReview");
|
|
475
|
+
var looxReviewSchema = z.object({
|
|
476
|
+
id: z.string(),
|
|
477
|
+
title: z.string().optional(),
|
|
478
|
+
body: z.string().optional(),
|
|
479
|
+
rating: z.number().optional(),
|
|
480
|
+
productName: z.string().optional(),
|
|
481
|
+
reviewerName: z.string().optional(),
|
|
482
|
+
dateCreated: z.string().optional(),
|
|
483
|
+
status: z.string().optional()
|
|
484
|
+
}).describe("LooxReview");
|
|
485
|
+
var planSchema = z.object({
|
|
486
|
+
id: z.string(),
|
|
487
|
+
name: z.string().optional(),
|
|
488
|
+
path: z.string().optional()
|
|
489
|
+
}).describe("ObjectTypePlan");
|
|
490
|
+
var OBJECT_TYPE_REGISTRY = {
|
|
491
|
+
product: {
|
|
492
|
+
type: "product",
|
|
493
|
+
displayName: "Product",
|
|
494
|
+
identifiers: {
|
|
495
|
+
primaryId: "id",
|
|
496
|
+
handle: "handle"
|
|
497
|
+
},
|
|
498
|
+
canonicalSchema: productSchema,
|
|
499
|
+
mentionable: true
|
|
500
|
+
},
|
|
501
|
+
collection: {
|
|
502
|
+
type: "collection",
|
|
503
|
+
displayName: "Collection",
|
|
504
|
+
identifiers: {
|
|
505
|
+
primaryId: "id",
|
|
506
|
+
handle: "handle"
|
|
507
|
+
},
|
|
508
|
+
canonicalSchema: collectionSchema,
|
|
509
|
+
mentionable: true
|
|
510
|
+
},
|
|
511
|
+
discountCode: {
|
|
512
|
+
type: "discountCode",
|
|
513
|
+
displayName: "Discount Code",
|
|
514
|
+
identifiers: {
|
|
515
|
+
primaryId: "id"
|
|
516
|
+
},
|
|
517
|
+
canonicalSchema: discountCodeSchema,
|
|
518
|
+
mentionable: true
|
|
519
|
+
},
|
|
520
|
+
variant: {
|
|
521
|
+
type: "variant",
|
|
522
|
+
displayName: "Variant",
|
|
523
|
+
identifiers: {
|
|
524
|
+
primaryId: "id",
|
|
525
|
+
cartMerchandiseId: "id"
|
|
526
|
+
},
|
|
527
|
+
canonicalSchema: variantSchema
|
|
528
|
+
},
|
|
529
|
+
asset: {
|
|
530
|
+
type: "asset",
|
|
531
|
+
displayName: "Asset",
|
|
532
|
+
identifiers: {
|
|
533
|
+
primaryId: "id"
|
|
534
|
+
},
|
|
535
|
+
canonicalSchema: assetSchema,
|
|
536
|
+
mentionable: true
|
|
537
|
+
},
|
|
538
|
+
integration: {
|
|
539
|
+
type: "integration",
|
|
540
|
+
displayName: "Integration",
|
|
541
|
+
identifiers: {
|
|
542
|
+
primaryId: "type"
|
|
543
|
+
},
|
|
544
|
+
canonicalSchema: integrationSchema,
|
|
545
|
+
mentionable: true
|
|
546
|
+
},
|
|
547
|
+
page: {
|
|
548
|
+
type: "page",
|
|
549
|
+
displayName: "Page",
|
|
550
|
+
identifiers: {
|
|
551
|
+
primaryId: "id"
|
|
552
|
+
},
|
|
553
|
+
canonicalSchema: pageSchema,
|
|
554
|
+
mentionable: true
|
|
555
|
+
},
|
|
556
|
+
skill: {
|
|
557
|
+
type: "skill",
|
|
558
|
+
displayName: "Skill",
|
|
559
|
+
identifiers: {
|
|
560
|
+
primaryId: "id"
|
|
561
|
+
},
|
|
562
|
+
canonicalSchema: skillFileSchema,
|
|
563
|
+
mentionable: true
|
|
564
|
+
},
|
|
565
|
+
registryItem: {
|
|
566
|
+
type: "registryItem",
|
|
567
|
+
displayName: "Registry Item",
|
|
568
|
+
identifiers: {
|
|
569
|
+
primaryId: "id",
|
|
570
|
+
handle: "slug"
|
|
571
|
+
},
|
|
572
|
+
canonicalSchema: registryItemSchema,
|
|
573
|
+
mentionable: true
|
|
574
|
+
},
|
|
575
|
+
opusClip: {
|
|
576
|
+
type: "opusClip",
|
|
577
|
+
displayName: "Opus Clip",
|
|
578
|
+
identifiers: {
|
|
579
|
+
primaryId: "id"
|
|
580
|
+
},
|
|
581
|
+
canonicalSchema: opusClipSchema,
|
|
582
|
+
mentionable: true
|
|
583
|
+
},
|
|
584
|
+
opusProject: {
|
|
585
|
+
type: "opusProject",
|
|
586
|
+
displayName: "Opus Project",
|
|
587
|
+
identifiers: {
|
|
588
|
+
primaryId: "id"
|
|
589
|
+
},
|
|
590
|
+
canonicalSchema: opusProjectSchema,
|
|
591
|
+
mentionable: true
|
|
592
|
+
},
|
|
593
|
+
opusCollection: {
|
|
594
|
+
type: "opusCollection",
|
|
595
|
+
displayName: "Opus Clip Collection",
|
|
596
|
+
identifiers: {
|
|
597
|
+
primaryId: "id"
|
|
598
|
+
},
|
|
599
|
+
canonicalSchema: opusCollectionSchema,
|
|
600
|
+
mentionable: true
|
|
601
|
+
},
|
|
602
|
+
segmentSource: {
|
|
603
|
+
type: "segmentSource",
|
|
604
|
+
displayName: "Segment Source",
|
|
605
|
+
identifiers: {
|
|
606
|
+
primaryId: "id"
|
|
607
|
+
},
|
|
608
|
+
canonicalSchema: segmentSourceSchema,
|
|
609
|
+
mentionable: true
|
|
610
|
+
},
|
|
611
|
+
intelligemsExperience: {
|
|
612
|
+
type: "intelligemsExperience",
|
|
613
|
+
displayName: "Intelligems Experience",
|
|
614
|
+
identifiers: {
|
|
615
|
+
primaryId: "id"
|
|
616
|
+
},
|
|
617
|
+
canonicalSchema: intelligemsExperienceSchema,
|
|
618
|
+
mentionable: true
|
|
619
|
+
},
|
|
620
|
+
customerIoSegment: {
|
|
621
|
+
type: "customerIoSegment",
|
|
622
|
+
displayName: "Customer.io Segment",
|
|
623
|
+
identifiers: {
|
|
624
|
+
primaryId: "id"
|
|
625
|
+
},
|
|
626
|
+
canonicalSchema: customerIoSegmentSchema,
|
|
627
|
+
mentionable: true
|
|
628
|
+
},
|
|
629
|
+
customerIoCampaign: {
|
|
630
|
+
type: "customerIoCampaign",
|
|
631
|
+
displayName: "Customer.io Campaign",
|
|
632
|
+
identifiers: {
|
|
633
|
+
primaryId: "id"
|
|
634
|
+
},
|
|
635
|
+
canonicalSchema: customerIoCampaignSchema,
|
|
636
|
+
mentionable: true
|
|
637
|
+
},
|
|
638
|
+
customerIoBroadcast: {
|
|
639
|
+
type: "customerIoBroadcast",
|
|
640
|
+
displayName: "Customer.io Broadcast",
|
|
641
|
+
identifiers: {
|
|
642
|
+
primaryId: "id"
|
|
643
|
+
},
|
|
644
|
+
canonicalSchema: customerIoBroadcastSchema,
|
|
645
|
+
mentionable: true
|
|
646
|
+
},
|
|
647
|
+
vwoCampaign: {
|
|
648
|
+
type: "vwoCampaign",
|
|
649
|
+
displayName: "VWO Campaign",
|
|
650
|
+
identifiers: {
|
|
651
|
+
primaryId: "id"
|
|
652
|
+
},
|
|
653
|
+
canonicalSchema: vwoCampaignSchema,
|
|
654
|
+
mentionable: true
|
|
655
|
+
},
|
|
656
|
+
levantaProduct: {
|
|
657
|
+
type: "levantaProduct",
|
|
658
|
+
displayName: "Levanta Product",
|
|
659
|
+
identifiers: {
|
|
660
|
+
primaryId: "id"
|
|
661
|
+
},
|
|
662
|
+
canonicalSchema: levantaProductSchema,
|
|
663
|
+
mentionable: true
|
|
664
|
+
},
|
|
665
|
+
okendoReview: {
|
|
666
|
+
type: "okendoReview",
|
|
667
|
+
displayName: "Okendo Review",
|
|
668
|
+
identifiers: {
|
|
669
|
+
primaryId: "id"
|
|
670
|
+
},
|
|
671
|
+
canonicalSchema: okendoReviewSchema,
|
|
672
|
+
mentionable: true
|
|
673
|
+
},
|
|
674
|
+
looxReview: {
|
|
675
|
+
type: "looxReview",
|
|
676
|
+
displayName: "Loox Review",
|
|
677
|
+
identifiers: {
|
|
678
|
+
primaryId: "id"
|
|
679
|
+
},
|
|
680
|
+
canonicalSchema: looxReviewSchema,
|
|
681
|
+
mentionable: true
|
|
682
|
+
},
|
|
683
|
+
plan: {
|
|
684
|
+
type: "plan",
|
|
685
|
+
displayName: "Plan",
|
|
686
|
+
identifiers: {
|
|
687
|
+
primaryId: "id"
|
|
688
|
+
},
|
|
689
|
+
canonicalSchema: planSchema,
|
|
690
|
+
mentionable: true
|
|
691
|
+
}
|
|
692
|
+
};
|
|
693
|
+
function getObjectTypeDefinition(objectTypeKey) {
|
|
694
|
+
return OBJECT_TYPE_REGISTRY[objectTypeKey];
|
|
695
|
+
}
|
|
696
|
+
function transformReploProductToCanonical(product) {
|
|
697
|
+
const options = product.options ?? [];
|
|
698
|
+
const variants = product.variants ?? [];
|
|
699
|
+
return {
|
|
700
|
+
id: product.id,
|
|
701
|
+
title: product.title,
|
|
702
|
+
handle: product.slug ?? product.id,
|
|
703
|
+
description: null,
|
|
704
|
+
descriptionHtml: product.descriptionHtml ?? null,
|
|
705
|
+
availableForSale: variants.length > 0 ? variants.some((variant) => variant.availableForSale ?? true) : true,
|
|
706
|
+
featuredImage: product.featuredMedia ? {
|
|
707
|
+
url: product.featuredMedia.url,
|
|
708
|
+
altText: product.featuredMedia.alt ?? null,
|
|
709
|
+
width: product.featuredMedia.width ?? null,
|
|
710
|
+
height: product.featuredMedia.height ?? null
|
|
711
|
+
} : null,
|
|
712
|
+
images: product.featuredMedia ? [
|
|
713
|
+
{
|
|
714
|
+
url: product.featuredMedia.url,
|
|
715
|
+
altText: product.featuredMedia.alt ?? null,
|
|
716
|
+
width: product.featuredMedia.width ?? null,
|
|
717
|
+
height: product.featuredMedia.height ?? null
|
|
718
|
+
}
|
|
719
|
+
] : [],
|
|
720
|
+
media: product.featuredMedia ? [
|
|
721
|
+
{
|
|
722
|
+
type: "image",
|
|
723
|
+
alt: product.featuredMedia.alt ?? null,
|
|
724
|
+
url: product.featuredMedia.url,
|
|
725
|
+
width: product.featuredMedia.width ?? null,
|
|
726
|
+
height: product.featuredMedia.height ?? null
|
|
727
|
+
}
|
|
728
|
+
] : [],
|
|
729
|
+
vendor: null,
|
|
730
|
+
productType: null,
|
|
731
|
+
tags: [],
|
|
732
|
+
sellingPlanGroups: [],
|
|
733
|
+
metafields: [],
|
|
734
|
+
options: options.map((option) => ({
|
|
735
|
+
name: option.title,
|
|
736
|
+
values: option.optionValues.map((optionValue) => optionValue.value)
|
|
737
|
+
})),
|
|
738
|
+
variants: variants.map((variant) => ({
|
|
739
|
+
id: variant.id,
|
|
740
|
+
title: variant.title ?? "",
|
|
741
|
+
availableForSale: variant.availableForSale ?? true,
|
|
742
|
+
sku: variant.sku ?? null,
|
|
743
|
+
selectedOptions: (variant.optionValues ?? []).map((optionValue) => {
|
|
744
|
+
const parentOption = options.find((option) => {
|
|
745
|
+
return option.optionValues.some(
|
|
746
|
+
(parentOptionValue) => parentOptionValue.id === optionValue.id
|
|
747
|
+
);
|
|
748
|
+
});
|
|
749
|
+
return {
|
|
750
|
+
name: parentOption?.title ?? "",
|
|
751
|
+
value: optionValue.value
|
|
752
|
+
};
|
|
753
|
+
}),
|
|
754
|
+
image: null,
|
|
755
|
+
price: {
|
|
756
|
+
amount: String(variant.price ?? 0),
|
|
757
|
+
currencyCode: variant.priceCurrencyCode ?? "USD"
|
|
758
|
+
},
|
|
759
|
+
compareAtPrice: null,
|
|
760
|
+
sellingPlanIds: []
|
|
761
|
+
}))
|
|
762
|
+
};
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
export { assetSchema, collectionSchema, customerIoBroadcastSchema, customerIoCampaignSchema, customerIoSegmentSchema, discountCodeSchema, externalVideoSchema, getObjectTypeDefinition, imageSchema, integrationSchema, intelligemsExperienceSchema, levantaAffiliateLinkSchema, levantaProductSchema, looxReviewSchema, mediaImageSchema, mediaSchema, metafieldSchema, okendoReviewSchema, optionValueSchema, optionValueSwatchSchema, opusClipSchema, opusCollectionSchema, opusProjectSchema, pageSchema, planSchema, previewImageSchema, priceSchema, productOptionSchema, productSchema, registryItemSchema, segmentSourceSchema, selectedOptionSchema, transformReploProductToCanonical, variantSchema, videoSchema, videoSourceSchema, vwoCampaignSchema };
|