@replohq/canopy-sdk 0.1.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/json.d.ts +6 -0
- package/_vendor/replo-utils/lib/misc.d.ts +128 -0
- package/_vendor/replo-utils/lib/misc.mjs +1 -0
- package/_vendor/replo-utils/lib/object.d.ts +31 -0
- package/_vendor/replo-utils/lib/parse.d.ts +15 -0
- 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 +334 -0
- package/_vendor/schemas/agentTools/customIntegrations/loaders/product.mjs +50 -0
- package/_vendor/schemas/cart.d.ts +198 -0
- package/_vendor/schemas/cart.mjs +83 -0
- package/_vendor/schemas/errors.d.ts +428 -0
- package/_vendor/schemas/errors.mjs +955 -0
- package/_vendor/schemas/generated/errors.d.ts +61 -0
- package/_vendor/schemas/generated/selectMode.d.ts +95 -0
- package/_vendor/schemas/generated/selectMode.mjs +1 -0
- package/_vendor/schemas/loaderKeys.d.ts +39 -0
- package/_vendor/schemas/loaderKeys.mjs +23 -0
- package/_vendor/schemas/objectType.d.ts +895 -0
- package/_vendor/schemas/objectType.mjs +2 -0
- package/_vendor/schemas/registry.d.ts +243 -0
- package/_vendor/schemas/sandboxFiles.d.ts +35 -0
- package/_vendor/schemas/selectMode.d.ts +507 -0
- package/_vendor/schemas/selectMode.mjs +194 -0
- package/_vendor/schemas/sellingPlan.d.ts +60 -0
- package/_vendor/schemas/sellingPlan.mjs +1 -0
- package/analytics/analytics-provider.d.ts +13 -0
- package/analytics/analytics-provider.js +104 -0
- package/analytics/analytics-provider.js.map +7 -0
- package/analytics/analytics-sink.d.ts +20 -0
- package/analytics/analytics-sink.js +1 -0
- package/analytics/analytics-sink.js.map +7 -0
- package/analytics/hooks/use-product-viewed-analytics.d.ts +23 -0
- package/analytics/hooks/use-product-viewed-analytics.js +34 -0
- package/analytics/hooks/use-product-viewed-analytics.js.map +7 -0
- package/analytics/sinks/ga4-sink.d.ts +15 -0
- package/analytics/sinks/ga4-sink.js +52 -0
- package/analytics/sinks/ga4-sink.js.map +7 -0
- package/analytics/sinks/meta-sink.d.ts +14 -0
- package/analytics/sinks/meta-sink.js +44 -0
- package/analytics/sinks/meta-sink.js.map +7 -0
- package/analytics/sinks/pinterest-sink.d.ts +14 -0
- package/analytics/sinks/pinterest-sink.js +76 -0
- package/analytics/sinks/pinterest-sink.js.map +7 -0
- package/analytics/sinks/reddit-sink.d.ts +14 -0
- package/analytics/sinks/reddit-sink.js +80 -0
- package/analytics/sinks/reddit-sink.js.map +7 -0
- package/analytics/sinks/replo-sink.d.ts +14 -0
- package/analytics/sinks/replo-sink.js +57 -0
- package/analytics/sinks/replo-sink.js.map +7 -0
- package/analytics/sinks/snapchat-sink.d.ts +14 -0
- package/analytics/sinks/snapchat-sink.js +67 -0
- package/analytics/sinks/snapchat-sink.js.map +7 -0
- package/analytics/sinks/tiktok-sink.d.ts +14 -0
- package/analytics/sinks/tiktok-sink.js +79 -0
- package/analytics/sinks/tiktok-sink.js.map +7 -0
- package/analytics/sinks/window-sink.d.ts +18 -0
- package/analytics/sinks/window-sink.js +46 -0
- package/analytics/sinks/window-sink.js.map +7 -0
- package/analytics/utils/analytics-utils.d.ts +7 -0
- package/analytics/utils/analytics-utils.js +130 -0
- package/analytics/utils/analytics-utils.js.map +7 -0
- package/analytics/utils/navigation-tracker.d.ts +16 -0
- package/analytics/utils/navigation-tracker.js +44 -0
- package/analytics/utils/navigation-tracker.js.map +7 -0
- package/cart/buy-now-action.d.ts +21 -0
- package/cart/buy-now-action.js +104 -0
- package/cart/buy-now-action.js.map +7 -0
- package/cart/cart-actions.d.ts +63 -0
- package/cart/cart-actions.js +90 -0
- package/cart/cart-actions.js.map +7 -0
- package/cart/cart-loader.d.ts +9 -0
- package/cart/cart-loader.js +11 -0
- package/cart/cart-loader.js.map +7 -0
- package/cart/cart-provider.d.ts +85 -0
- package/cart/cart-provider.js +358 -0
- package/cart/cart-provider.js.map +7 -0
- package/cart/cart-types.d.ts +154 -0
- package/cart/cart-types.js +16 -0
- package/cart/cart-types.js.map +7 -0
- package/cart/gateways/cart-gateway.d.ts +10 -0
- package/cart/gateways/cart-gateway.js +19 -0
- package/cart/gateways/cart-gateway.js.map +7 -0
- package/cart/gateways/cookie-cart-gateway.d.ts +28 -0
- package/cart/gateways/cookie-cart-gateway.js +109 -0
- package/cart/gateways/cookie-cart-gateway.js.map +7 -0
- package/cart/gateways/default-cart-gateway.d.ts +19 -0
- package/cart/gateways/default-cart-gateway.js +30 -0
- package/cart/gateways/default-cart-gateway.js.map +7 -0
- package/cart/gateways/resolver-cart-gateway.d.ts +2 -0
- package/cart/gateways/resolver-cart-gateway.js +106 -0
- package/cart/gateways/resolver-cart-gateway.js.map +7 -0
- package/cart/gateways/stripe-cart-gateway.d.ts +19 -0
- package/cart/gateways/stripe-cart-gateway.js +28 -0
- package/cart/gateways/stripe-cart-gateway.js.map +7 -0
- package/cart/gateways/stripe-constants.d.ts +1 -0
- package/cart/gateways/stripe-constants.js +5 -0
- package/cart/gateways/stripe-constants.js.map +7 -0
- package/cart/hooks/use-add-to-cart.d.ts +63 -0
- package/cart/hooks/use-add-to-cart.js +120 -0
- package/cart/hooks/use-add-to-cart.js.map +7 -0
- package/cart/hooks/use-buy-now.d.ts +49 -0
- package/cart/hooks/use-buy-now.js +62 -0
- package/cart/hooks/use-buy-now.js.map +7 -0
- package/cart/utils/cart-utils.d.ts +31 -0
- package/cart/utils/cart-utils.js +48 -0
- package/cart/utils/cart-utils.js.map +7 -0
- package/cart/utils/cookie-cart-persistence.d.ts +55 -0
- package/cart/utils/cookie-cart-persistence.js +153 -0
- package/cart/utils/cookie-cart-persistence.js.map +7 -0
- package/cart/utils/variant-to-cart-line.d.ts +124 -0
- package/cart/utils/variant-to-cart-line.js +202 -0
- package/cart/utils/variant-to-cart-line.js.map +7 -0
- package/chunk-46YU2W6T.mjs +538 -0
- package/chunk-4TZVNC3W.mjs +33 -0
- package/chunk-INHK6MYI.mjs +1598 -0
- package/editor/ClientErrorBoundary.d.ts +7 -0
- package/editor/ClientErrorBoundary.js +48 -0
- package/editor/ClientErrorBoundary.js.map +7 -0
- package/editor/LinkInterceptor.d.ts +1 -0
- package/editor/LinkInterceptor.js +124 -0
- package/editor/LinkInterceptor.js.map +7 -0
- package/editor/posthog-relay.d.ts +10 -0
- package/editor/posthog-relay.js +60 -0
- package/editor/posthog-relay.js.map +7 -0
- package/editor/select-mode/EditorSelection.d.ts +24 -0
- package/editor/select-mode/EditorSelection.js +34 -0
- package/editor/select-mode/EditorSelection.js.map +7 -0
- package/editor/select-mode/descriptor/elementDescriptor.d.ts +15 -0
- package/editor/select-mode/descriptor/elementDescriptor.js +213 -0
- package/editor/select-mode/descriptor/elementDescriptor.js.map +7 -0
- package/editor/select-mode/fiber.d.ts +52 -0
- package/editor/select-mode/fiber.js +269 -0
- package/editor/select-mode/fiber.js.map +7 -0
- package/editor/select-mode/hooks/useCrosshairCursor.d.ts +12 -0
- package/editor/select-mode/hooks/useCrosshairCursor.js +20 -0
- package/editor/select-mode/hooks/useCrosshairCursor.js.map +7 -0
- package/editor/select-mode/hooks/useParentMessaging.d.ts +24 -0
- package/editor/select-mode/hooks/useParentMessaging.js +33 -0
- package/editor/select-mode/hooks/useParentMessaging.js.map +7 -0
- package/editor/select-mode/hooks/useSelectModeController.d.ts +8 -0
- package/editor/select-mode/hooks/useSelectModeController.js +49 -0
- package/editor/select-mode/hooks/useSelectModeController.js.map +7 -0
- package/editor/select-mode/hooks/useSelectionHover.d.ts +22 -0
- package/editor/select-mode/hooks/useSelectionHover.js +98 -0
- package/editor/select-mode/hooks/useSelectionHover.js.map +7 -0
- package/editor/select-mode/hooks/useSelectionInteractions.d.ts +32 -0
- package/editor/select-mode/hooks/useSelectionInteractions.js +293 -0
- package/editor/select-mode/hooks/useSelectionInteractions.js.map +7 -0
- package/editor/select-mode/hooks/useSelectionScrollSync.d.ts +28 -0
- package/editor/select-mode/hooks/useSelectionScrollSync.js +77 -0
- package/editor/select-mode/hooks/useSelectionScrollSync.js.map +7 -0
- package/editor/select-mode/interactions/selectionGeometry.d.ts +80 -0
- package/editor/select-mode/interactions/selectionGeometry.js +160 -0
- package/editor/select-mode/interactions/selectionGeometry.js.map +7 -0
- package/editor/select-mode/selectModeSession.d.ts +21 -0
- package/editor/select-mode/selectModeSession.js +7 -0
- package/editor/select-mode/selectModeSession.js.map +7 -0
- package/editor/select-mode/selectionFrame.d.ts +48 -0
- package/editor/select-mode/selectionFrame.js +74 -0
- package/editor/select-mode/selectionFrame.js.map +7 -0
- package/editor/select-mode/symbolicate.d.ts +3 -0
- package/editor/select-mode/symbolicate.js +139 -0
- package/editor/select-mode/symbolicate.js.map +7 -0
- package/env.d.ts +13 -0
- package/env.js +20 -0
- package/env.js.map +7 -0
- package/gateways/canopy-api.d.ts +84 -0
- package/gateways/canopy-api.js +203 -0
- package/gateways/canopy-api.js.map +7 -0
- package/hooks/use-client-value.d.ts +10 -0
- package/hooks/use-client-value.js +12 -0
- package/hooks/use-client-value.js.map +7 -0
- package/hooks/use-formatted-price.d.ts +15 -0
- package/hooks/use-formatted-price.js +19 -0
- package/hooks/use-formatted-price.js.map +7 -0
- package/lib/get-query-client.d.ts +2 -0
- package/lib/get-query-client.js +34 -0
- package/lib/get-query-client.js.map +7 -0
- package/lib/integration-utils.d.ts +2 -0
- package/lib/integration-utils.js +9 -0
- package/lib/integration-utils.js.map +7 -0
- package/lib/shopify-utils.d.ts +16 -0
- package/lib/shopify-utils.js +11 -0
- package/lib/shopify-utils.js.map +7 -0
- package/lib/url-utils.d.ts +4 -0
- package/lib/url-utils.js +8 -0
- package/lib/url-utils.js.map +7 -0
- package/loaders/collection-loader.d.ts +11 -0
- package/loaders/collection-loader.js +53 -0
- package/loaders/collection-loader.js.map +7 -0
- package/loaders/collection-products-loader.d.ts +12 -0
- package/loaders/collection-products-loader.js +56 -0
- package/loaders/collection-products-loader.js.map +7 -0
- package/loaders/invoke-loader-action.d.ts +11 -0
- package/loaders/invoke-loader-action.js +14 -0
- package/loaders/invoke-loader-action.js.map +7 -0
- package/loaders/invoke-loader-server.d.ts +18 -0
- package/loaders/invoke-loader-server.js +35 -0
- package/loaders/invoke-loader-server.js.map +7 -0
- package/loaders/invoke-loader.d.ts +14 -0
- package/loaders/invoke-loader.js +36 -0
- package/loaders/invoke-loader.js.map +7 -0
- package/loaders/levanta-product-loader.d.ts +11 -0
- package/loaders/levanta-product-loader.js +53 -0
- package/loaders/levanta-product-loader.js.map +7 -0
- package/loaders/loader-error-boundary.d.ts +25 -0
- package/loaders/loader-error-boundary.js +24 -0
- package/loaders/loader-error-boundary.js.map +7 -0
- package/loaders/okendo-review-aggregate-loader.d.ts +17 -0
- package/loaders/okendo-review-aggregate-loader.js +56 -0
- package/loaders/okendo-review-aggregate-loader.js.map +7 -0
- package/loaders/okendo-reviews-loader.d.ts +23 -0
- package/loaders/okendo-reviews-loader.js +54 -0
- package/loaders/okendo-reviews-loader.js.map +7 -0
- package/loaders/prefetch-loaders.d.ts +33 -0
- package/loaders/prefetch-loaders.js +46 -0
- package/loaders/prefetch-loaders.js.map +7 -0
- package/loaders/product-loader.d.ts +11 -0
- package/loaders/product-loader.js +53 -0
- package/loaders/product-loader.js.map +7 -0
- package/loaders/rebuy-recommendations-loader.d.ts +159 -0
- package/loaders/rebuy-recommendations-loader.js +57 -0
- package/loaders/rebuy-recommendations-loader.js.map +7 -0
- package/loaders/smile-earning-rules-loader.d.ts +19 -0
- package/loaders/smile-earning-rules-loader.js +44 -0
- package/loaders/smile-earning-rules-loader.js.map +7 -0
- package/loaders/smile-rewards-loader.d.ts +19 -0
- package/loaders/smile-rewards-loader.js +44 -0
- package/loaders/smile-rewards-loader.js.map +7 -0
- package/loaders/smile-vip-tiers-loader.d.ts +18 -0
- package/loaders/smile-vip-tiers-loader.js +43 -0
- package/loaders/smile-vip-tiers-loader.js.map +7 -0
- package/package.json +29 -0
- package/providers/query-provider.d.ts +1 -0
- package/providers/query-provider.js +12 -0
- package/providers/query-provider.js.map +7 -0
- package/providers/replo-provider.d.ts +1 -0
- package/providers/replo-provider.js +20 -0
- package/providers/replo-provider.js.map +7 -0
|
@@ -0,0 +1,538 @@
|
|
|
1
|
+
import { sellingPlanGroupSchema } from './chunk-4TZVNC3W.mjs';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
|
|
4
|
+
var registryItemTypeSchema = z.enum(["site", "page", "section", "skill", "plan", "branding"]).describe("RegistryItemType");
|
|
5
|
+
z.object({
|
|
6
|
+
sourceType: z.string().min(1).max(80),
|
|
7
|
+
sourceKey: z.string().min(1).max(512)
|
|
8
|
+
}).describe("RegistryItemSourceIdentity");
|
|
9
|
+
var visualDisplayMetadataSchema = z.object({
|
|
10
|
+
brandName: z.string().optional(),
|
|
11
|
+
brandDomain: z.string().optional(),
|
|
12
|
+
logoUrl: z.string().url().optional()
|
|
13
|
+
}).strict();
|
|
14
|
+
var siteRegistryItemMetadataSchema = visualDisplayMetadataSchema.describe("SiteRegistryItemMetadata");
|
|
15
|
+
var pageRegistryItemMetadataSchema = visualDisplayMetadataSchema.describe("PageRegistryItemMetadata");
|
|
16
|
+
var sectionRegistryItemMetadataSchema = visualDisplayMetadataSchema.describe("SectionRegistryItemMetadata");
|
|
17
|
+
var brandingRegistryItemMetadataSchema = z.object({
|
|
18
|
+
palette: z.array(z.string()).max(8).optional(),
|
|
19
|
+
logoUrl: z.string().url().optional(),
|
|
20
|
+
faviconUrl: z.string().url().optional(),
|
|
21
|
+
tagline: z.string().max(140).optional()
|
|
22
|
+
}).strict().describe("BrandingRegistryItemMetadata");
|
|
23
|
+
var skillRegistryItemMetadataSchema = z.object({
|
|
24
|
+
command: z.string().optional(),
|
|
25
|
+
tagline: z.string().optional()
|
|
26
|
+
}).strict().describe("SkillRegistryItemMetadata");
|
|
27
|
+
var genericRegistryItemMetadataSchema = z.union([
|
|
28
|
+
siteRegistryItemMetadataSchema,
|
|
29
|
+
pageRegistryItemMetadataSchema,
|
|
30
|
+
sectionRegistryItemMetadataSchema,
|
|
31
|
+
skillRegistryItemMetadataSchema,
|
|
32
|
+
brandingRegistryItemMetadataSchema
|
|
33
|
+
]).describe("GenericRegistryItemMetadata");
|
|
34
|
+
var registryItemMetadataSchema = z.object({
|
|
35
|
+
id: z.string(),
|
|
36
|
+
slug: z.string(),
|
|
37
|
+
name: z.string(),
|
|
38
|
+
type: registryItemTypeSchema,
|
|
39
|
+
metadata: genericRegistryItemMetadataSchema.nullable(),
|
|
40
|
+
projectId: z.string().nullable(),
|
|
41
|
+
createdBy: z.string().nullable(),
|
|
42
|
+
sourceType: z.string().nullable(),
|
|
43
|
+
sourceKey: z.string().nullable(),
|
|
44
|
+
shortLink: z.string().nullable(),
|
|
45
|
+
description: z.string().nullable(),
|
|
46
|
+
visibility: z.string(),
|
|
47
|
+
tags: z.array(z.string()),
|
|
48
|
+
category: z.string().nullable(),
|
|
49
|
+
previewUrls: z.array(z.string()),
|
|
50
|
+
createdAt: z.string(),
|
|
51
|
+
updatedAt: z.string()
|
|
52
|
+
}).describe("RegistryItemMetadata");
|
|
53
|
+
z.object({
|
|
54
|
+
items: z.array(registryItemMetadataSchema),
|
|
55
|
+
nextCursor: z.string().nullable()
|
|
56
|
+
}).describe("FindRegistryItemsResult");
|
|
57
|
+
z.object({
|
|
58
|
+
categories: z.array(z.string())
|
|
59
|
+
}).describe("RegistryItemCategoriesResult");
|
|
60
|
+
z.object({
|
|
61
|
+
tags: z.array(z.string())
|
|
62
|
+
}).describe("RegistryItemTagsResult");
|
|
63
|
+
registryItemMetadataSchema.extend({
|
|
64
|
+
previewHtml: z.string().nullable()
|
|
65
|
+
}).describe("RegistryItemDetail");
|
|
66
|
+
z.object({
|
|
67
|
+
meta: z.object({
|
|
68
|
+
id: z.string(),
|
|
69
|
+
slug: z.string(),
|
|
70
|
+
type: registryItemTypeSchema,
|
|
71
|
+
name: z.string(),
|
|
72
|
+
description: z.string().nullable()
|
|
73
|
+
}),
|
|
74
|
+
files: z.record(z.string(), z.string()),
|
|
75
|
+
dependencies: z.array(z.string())
|
|
76
|
+
}).describe("RegistryItemContent");
|
|
77
|
+
z.object({
|
|
78
|
+
appName: z.string(),
|
|
79
|
+
filepath: z.string(),
|
|
80
|
+
route: z.string(),
|
|
81
|
+
modifiedAt: z.number().optional()
|
|
82
|
+
}).describe("SandboxFile");
|
|
83
|
+
var workspaceSkillSourceSchema = z.enum(["builtin", "project"]).describe("WorkspaceSkillSource");
|
|
84
|
+
z.object({
|
|
85
|
+
slug: z.string(),
|
|
86
|
+
source: workspaceSkillSourceSchema,
|
|
87
|
+
filepath: z.string().optional(),
|
|
88
|
+
name: z.string(),
|
|
89
|
+
description: z.string(),
|
|
90
|
+
body: z.string(),
|
|
91
|
+
tagline: z.string().optional(),
|
|
92
|
+
category: z.string().optional(),
|
|
93
|
+
tags: z.array(z.string()),
|
|
94
|
+
imageUrl: z.string().optional(),
|
|
95
|
+
shape: z.string().optional(),
|
|
96
|
+
gradient: z.string().optional(),
|
|
97
|
+
modifiedAt: z.number().optional()
|
|
98
|
+
}).describe("WorkspaceSkill");
|
|
99
|
+
var skillFileSchema = z.object({
|
|
100
|
+
id: z.string(),
|
|
101
|
+
name: z.string(),
|
|
102
|
+
description: z.string(),
|
|
103
|
+
body: z.string()
|
|
104
|
+
}).describe("SkillFile");
|
|
105
|
+
|
|
106
|
+
// ../schemas/objectType.ts
|
|
107
|
+
var imageSchema = z.object({
|
|
108
|
+
url: z.string(),
|
|
109
|
+
altText: z.string().nullable(),
|
|
110
|
+
width: z.number().nullable(),
|
|
111
|
+
height: z.number().nullable()
|
|
112
|
+
});
|
|
113
|
+
var mediaImageSchema = z.object({
|
|
114
|
+
type: z.literal("image"),
|
|
115
|
+
alt: z.string().nullable(),
|
|
116
|
+
url: z.string(),
|
|
117
|
+
width: z.number().nullable(),
|
|
118
|
+
height: z.number().nullable()
|
|
119
|
+
});
|
|
120
|
+
var videoSourceSchema = z.object({
|
|
121
|
+
url: z.string(),
|
|
122
|
+
mimeType: z.string(),
|
|
123
|
+
format: z.string(),
|
|
124
|
+
width: z.number().nullable(),
|
|
125
|
+
height: z.number().nullable()
|
|
126
|
+
});
|
|
127
|
+
var previewImageSchema = z.object({
|
|
128
|
+
alt: z.string().nullable(),
|
|
129
|
+
url: z.string(),
|
|
130
|
+
width: z.number().nullable(),
|
|
131
|
+
height: z.number().nullable()
|
|
132
|
+
});
|
|
133
|
+
var videoSchema = z.object({
|
|
134
|
+
type: z.literal("video"),
|
|
135
|
+
alt: z.string().nullable(),
|
|
136
|
+
sources: z.array(videoSourceSchema),
|
|
137
|
+
previewImage: previewImageSchema.nullable()
|
|
138
|
+
});
|
|
139
|
+
var externalVideoSchema = z.object({
|
|
140
|
+
type: z.literal("externalVideo"),
|
|
141
|
+
alt: z.string().nullable(),
|
|
142
|
+
embedUrl: z.string(),
|
|
143
|
+
host: z.string(),
|
|
144
|
+
originUrl: z.string(),
|
|
145
|
+
previewImage: previewImageSchema.nullable()
|
|
146
|
+
});
|
|
147
|
+
var mediaSchema = z.discriminatedUnion("type", [
|
|
148
|
+
mediaImageSchema,
|
|
149
|
+
videoSchema,
|
|
150
|
+
externalVideoSchema
|
|
151
|
+
]);
|
|
152
|
+
var priceSchema = z.object({
|
|
153
|
+
amount: z.string(),
|
|
154
|
+
currencyCode: z.string()
|
|
155
|
+
});
|
|
156
|
+
var selectedOptionSchema = z.object({
|
|
157
|
+
name: z.string(),
|
|
158
|
+
value: z.string()
|
|
159
|
+
});
|
|
160
|
+
var optionValueSwatchSchema = z.object({
|
|
161
|
+
color: z.string().nullable(),
|
|
162
|
+
imageUrl: z.string().nullable()
|
|
163
|
+
});
|
|
164
|
+
var optionValueSchema = z.object({
|
|
165
|
+
id: z.string(),
|
|
166
|
+
value: z.string(),
|
|
167
|
+
swatch: optionValueSwatchSchema.nullable()
|
|
168
|
+
});
|
|
169
|
+
var productOptionSchema = z.object({
|
|
170
|
+
id: z.string().optional(),
|
|
171
|
+
name: z.string(),
|
|
172
|
+
values: z.array(z.string()),
|
|
173
|
+
optionValues: z.array(optionValueSchema).optional()
|
|
174
|
+
});
|
|
175
|
+
var metafieldSchema = z.object({
|
|
176
|
+
key: z.string(),
|
|
177
|
+
namespace: z.string(),
|
|
178
|
+
type: z.string(),
|
|
179
|
+
value: z.string()
|
|
180
|
+
});
|
|
181
|
+
var variantSchema = z.object({
|
|
182
|
+
id: z.string(),
|
|
183
|
+
title: z.string().optional(),
|
|
184
|
+
availableForSale: z.boolean().optional(),
|
|
185
|
+
sku: z.string().nullable().optional(),
|
|
186
|
+
selectedOptions: z.array(selectedOptionSchema).optional(),
|
|
187
|
+
image: imageSchema.nullable().optional(),
|
|
188
|
+
price: priceSchema.optional(),
|
|
189
|
+
compareAtPrice: priceSchema.nullable().optional(),
|
|
190
|
+
sellingPlanIds: z.array(z.string()).optional()
|
|
191
|
+
});
|
|
192
|
+
var productSchema = z.object({
|
|
193
|
+
id: z.string(),
|
|
194
|
+
handle: z.string().optional(),
|
|
195
|
+
title: z.string().optional(),
|
|
196
|
+
description: z.string().nullable().optional(),
|
|
197
|
+
descriptionHtml: z.string().nullable().optional(),
|
|
198
|
+
availableForSale: z.boolean().optional(),
|
|
199
|
+
featuredImage: imageSchema.nullable().optional(),
|
|
200
|
+
options: z.array(productOptionSchema).optional(),
|
|
201
|
+
variants: z.array(variantSchema).optional(),
|
|
202
|
+
minPrice: priceSchema.optional(),
|
|
203
|
+
maxPrice: priceSchema.optional(),
|
|
204
|
+
// Storefront `compareAtPriceRange` returns 0.0 amounts when no variant has a
|
|
205
|
+
// compare-at price. Consumers should treat `amount === "0.0"` as "no
|
|
206
|
+
// discount" rather than infer it from nullability.
|
|
207
|
+
compareAtMinPrice: priceSchema.optional(),
|
|
208
|
+
compareAtMaxPrice: priceSchema.optional(),
|
|
209
|
+
images: z.array(imageSchema).optional(),
|
|
210
|
+
media: z.array(mediaSchema).optional(),
|
|
211
|
+
vendor: z.string().nullable().optional(),
|
|
212
|
+
productType: z.string().nullable().optional(),
|
|
213
|
+
tags: z.array(z.string()).optional(),
|
|
214
|
+
sellingPlanGroups: z.array(sellingPlanGroupSchema).optional(),
|
|
215
|
+
metafields: z.array(metafieldSchema).optional()
|
|
216
|
+
});
|
|
217
|
+
var collectionSchema = z.object({
|
|
218
|
+
id: z.string(),
|
|
219
|
+
handle: z.string().optional(),
|
|
220
|
+
title: z.string().optional(),
|
|
221
|
+
descriptionHtml: z.string().nullable().optional(),
|
|
222
|
+
image: imageSchema.nullable().optional()
|
|
223
|
+
});
|
|
224
|
+
var assetSchema = z.object({
|
|
225
|
+
id: z.string(),
|
|
226
|
+
name: z.string().optional(),
|
|
227
|
+
url: z.string().optional(),
|
|
228
|
+
fileExtension: z.string().optional()
|
|
229
|
+
});
|
|
230
|
+
var integrationSchema = z.object({
|
|
231
|
+
type: z.string(),
|
|
232
|
+
title: z.string().optional(),
|
|
233
|
+
image: z.string().optional()
|
|
234
|
+
});
|
|
235
|
+
var pageSchema = z.object({
|
|
236
|
+
id: z.string(),
|
|
237
|
+
name: z.string().optional(),
|
|
238
|
+
route: z.string().optional()
|
|
239
|
+
}).describe("ObjectTypePage");
|
|
240
|
+
var registryItemSchema = z.object({
|
|
241
|
+
id: z.string(),
|
|
242
|
+
slug: z.string().optional(),
|
|
243
|
+
title: z.string().optional(),
|
|
244
|
+
type: registryItemTypeSchema.optional(),
|
|
245
|
+
description: z.string().optional(),
|
|
246
|
+
previewUrl: z.string().optional()
|
|
247
|
+
}).describe("ObjectTypeRegistryItem");
|
|
248
|
+
var opusClipSchema = z.object({
|
|
249
|
+
id: z.string(),
|
|
250
|
+
title: z.string().optional(),
|
|
251
|
+
description: z.string().optional(),
|
|
252
|
+
previewUrl: z.string().optional(),
|
|
253
|
+
exportUrl: z.string().optional(),
|
|
254
|
+
durationMs: z.number().optional(),
|
|
255
|
+
opusProjectId: z.string().optional(),
|
|
256
|
+
projectTitle: z.string().optional()
|
|
257
|
+
});
|
|
258
|
+
var opusProjectSchema = z.object({
|
|
259
|
+
id: z.string(),
|
|
260
|
+
title: z.string().optional(),
|
|
261
|
+
sourceVideoUrl: z.string().optional(),
|
|
262
|
+
createdAtIso: z.string().optional()
|
|
263
|
+
}).describe("OpusProject");
|
|
264
|
+
var opusCollectionSchema = z.object({
|
|
265
|
+
id: z.string(),
|
|
266
|
+
name: z.string().optional(),
|
|
267
|
+
createdAt: z.string().optional(),
|
|
268
|
+
updatedAt: z.string().optional()
|
|
269
|
+
});
|
|
270
|
+
var segmentSourceSchema = z.object({
|
|
271
|
+
id: z.string().describe("segmentSource primaryId"),
|
|
272
|
+
slug: z.string().optional(),
|
|
273
|
+
name: z.string().optional(),
|
|
274
|
+
enabled: z.boolean().optional(),
|
|
275
|
+
sourceType: z.string().optional(),
|
|
276
|
+
writeKeys: z.array(z.string()).optional()
|
|
277
|
+
}).describe("SegmentSource");
|
|
278
|
+
var levantaAffiliateLinkSchema = z.object({
|
|
279
|
+
linkId: z.string(),
|
|
280
|
+
url: z.string()
|
|
281
|
+
});
|
|
282
|
+
var levantaProductSchema = z.object({
|
|
283
|
+
id: z.string(),
|
|
284
|
+
asin: z.string().optional(),
|
|
285
|
+
title: z.string().optional(),
|
|
286
|
+
price: z.string().optional().describe('Product price as a decimal string in USD (e.g. "34.99").'),
|
|
287
|
+
commission: z.string().optional().describe(
|
|
288
|
+
'Creator commission rate as a decimal string percentage (e.g. "8.5" meaning 8.5%).'
|
|
289
|
+
),
|
|
290
|
+
imageUrl: z.string().nullable().optional(),
|
|
291
|
+
brand: z.object({ id: z.string(), name: z.string() }).nullable().optional(),
|
|
292
|
+
inStock: z.boolean().optional(),
|
|
293
|
+
marketplace: z.string().optional(),
|
|
294
|
+
affiliateLink: levantaAffiliateLinkSchema.nullable().optional()
|
|
295
|
+
}).describe("LevantaProduct");
|
|
296
|
+
var intelligemsExperienceSchema = z.object({
|
|
297
|
+
id: z.string(),
|
|
298
|
+
name: z.string().optional(),
|
|
299
|
+
category: z.string().optional(),
|
|
300
|
+
status: z.string().optional()
|
|
301
|
+
}).describe("IntelligemsExperience");
|
|
302
|
+
var okendoReviewSchema = z.object({
|
|
303
|
+
id: z.string(),
|
|
304
|
+
title: z.string().optional(),
|
|
305
|
+
body: z.string().optional(),
|
|
306
|
+
rating: z.number().optional(),
|
|
307
|
+
productName: z.string().optional(),
|
|
308
|
+
reviewerName: z.string().optional(),
|
|
309
|
+
dateCreated: z.string().optional(),
|
|
310
|
+
status: z.string().optional()
|
|
311
|
+
}).describe("OkendoReview");
|
|
312
|
+
var planSchema = z.object({
|
|
313
|
+
id: z.string(),
|
|
314
|
+
name: z.string().optional(),
|
|
315
|
+
path: z.string().optional()
|
|
316
|
+
}).describe("ObjectTypePlan");
|
|
317
|
+
var OBJECT_TYPE_REGISTRY = {
|
|
318
|
+
product: {
|
|
319
|
+
type: "product",
|
|
320
|
+
displayName: "Product",
|
|
321
|
+
identifiers: {
|
|
322
|
+
primaryId: "id",
|
|
323
|
+
handle: "handle"
|
|
324
|
+
},
|
|
325
|
+
canonicalSchema: productSchema,
|
|
326
|
+
mentionable: true
|
|
327
|
+
},
|
|
328
|
+
collection: {
|
|
329
|
+
type: "collection",
|
|
330
|
+
displayName: "Collection",
|
|
331
|
+
identifiers: {
|
|
332
|
+
primaryId: "id",
|
|
333
|
+
handle: "handle"
|
|
334
|
+
},
|
|
335
|
+
canonicalSchema: collectionSchema,
|
|
336
|
+
mentionable: true
|
|
337
|
+
},
|
|
338
|
+
variant: {
|
|
339
|
+
type: "variant",
|
|
340
|
+
displayName: "Variant",
|
|
341
|
+
identifiers: {
|
|
342
|
+
primaryId: "id",
|
|
343
|
+
cartMerchandiseId: "id"
|
|
344
|
+
},
|
|
345
|
+
canonicalSchema: variantSchema
|
|
346
|
+
},
|
|
347
|
+
asset: {
|
|
348
|
+
type: "asset",
|
|
349
|
+
displayName: "Asset",
|
|
350
|
+
identifiers: {
|
|
351
|
+
primaryId: "id"
|
|
352
|
+
},
|
|
353
|
+
canonicalSchema: assetSchema,
|
|
354
|
+
mentionable: true
|
|
355
|
+
},
|
|
356
|
+
integration: {
|
|
357
|
+
type: "integration",
|
|
358
|
+
displayName: "Integration",
|
|
359
|
+
identifiers: {
|
|
360
|
+
primaryId: "type"
|
|
361
|
+
},
|
|
362
|
+
canonicalSchema: integrationSchema,
|
|
363
|
+
mentionable: true
|
|
364
|
+
},
|
|
365
|
+
page: {
|
|
366
|
+
type: "page",
|
|
367
|
+
displayName: "Page",
|
|
368
|
+
identifiers: {
|
|
369
|
+
primaryId: "id"
|
|
370
|
+
},
|
|
371
|
+
canonicalSchema: pageSchema,
|
|
372
|
+
mentionable: true
|
|
373
|
+
},
|
|
374
|
+
skill: {
|
|
375
|
+
type: "skill",
|
|
376
|
+
displayName: "Skill",
|
|
377
|
+
identifiers: {
|
|
378
|
+
primaryId: "id"
|
|
379
|
+
},
|
|
380
|
+
canonicalSchema: skillFileSchema,
|
|
381
|
+
mentionable: true
|
|
382
|
+
},
|
|
383
|
+
registryItem: {
|
|
384
|
+
type: "registryItem",
|
|
385
|
+
displayName: "Registry Item",
|
|
386
|
+
identifiers: {
|
|
387
|
+
primaryId: "id",
|
|
388
|
+
handle: "slug"
|
|
389
|
+
},
|
|
390
|
+
canonicalSchema: registryItemSchema,
|
|
391
|
+
mentionable: true
|
|
392
|
+
},
|
|
393
|
+
opusClip: {
|
|
394
|
+
type: "opusClip",
|
|
395
|
+
displayName: "Opus Clip",
|
|
396
|
+
identifiers: {
|
|
397
|
+
primaryId: "id"
|
|
398
|
+
},
|
|
399
|
+
canonicalSchema: opusClipSchema,
|
|
400
|
+
mentionable: true
|
|
401
|
+
},
|
|
402
|
+
opusProject: {
|
|
403
|
+
type: "opusProject",
|
|
404
|
+
displayName: "Opus Project",
|
|
405
|
+
identifiers: {
|
|
406
|
+
primaryId: "id"
|
|
407
|
+
},
|
|
408
|
+
canonicalSchema: opusProjectSchema,
|
|
409
|
+
mentionable: true
|
|
410
|
+
},
|
|
411
|
+
opusCollection: {
|
|
412
|
+
type: "opusCollection",
|
|
413
|
+
displayName: "Opus Clip Collection",
|
|
414
|
+
identifiers: {
|
|
415
|
+
primaryId: "id"
|
|
416
|
+
},
|
|
417
|
+
canonicalSchema: opusCollectionSchema,
|
|
418
|
+
mentionable: true
|
|
419
|
+
},
|
|
420
|
+
segmentSource: {
|
|
421
|
+
type: "segmentSource",
|
|
422
|
+
displayName: "Segment Source",
|
|
423
|
+
identifiers: {
|
|
424
|
+
primaryId: "id"
|
|
425
|
+
},
|
|
426
|
+
canonicalSchema: segmentSourceSchema,
|
|
427
|
+
mentionable: true
|
|
428
|
+
},
|
|
429
|
+
intelligemsExperience: {
|
|
430
|
+
type: "intelligemsExperience",
|
|
431
|
+
displayName: "Intelligems Experience",
|
|
432
|
+
identifiers: {
|
|
433
|
+
primaryId: "id"
|
|
434
|
+
},
|
|
435
|
+
canonicalSchema: intelligemsExperienceSchema,
|
|
436
|
+
mentionable: true
|
|
437
|
+
},
|
|
438
|
+
levantaProduct: {
|
|
439
|
+
type: "levantaProduct",
|
|
440
|
+
displayName: "Levanta Product",
|
|
441
|
+
identifiers: {
|
|
442
|
+
primaryId: "id"
|
|
443
|
+
},
|
|
444
|
+
canonicalSchema: levantaProductSchema,
|
|
445
|
+
mentionable: true
|
|
446
|
+
},
|
|
447
|
+
okendoReview: {
|
|
448
|
+
type: "okendoReview",
|
|
449
|
+
displayName: "Okendo Review",
|
|
450
|
+
identifiers: {
|
|
451
|
+
primaryId: "id"
|
|
452
|
+
},
|
|
453
|
+
canonicalSchema: okendoReviewSchema,
|
|
454
|
+
mentionable: true
|
|
455
|
+
},
|
|
456
|
+
plan: {
|
|
457
|
+
type: "plan",
|
|
458
|
+
displayName: "Plan",
|
|
459
|
+
identifiers: {
|
|
460
|
+
primaryId: "id"
|
|
461
|
+
},
|
|
462
|
+
canonicalSchema: planSchema,
|
|
463
|
+
mentionable: true
|
|
464
|
+
}
|
|
465
|
+
};
|
|
466
|
+
function getObjectTypeDefinition(objectTypeKey) {
|
|
467
|
+
return OBJECT_TYPE_REGISTRY[objectTypeKey];
|
|
468
|
+
}
|
|
469
|
+
function transformReploProductToCanonical(product) {
|
|
470
|
+
const options = product.options ?? [];
|
|
471
|
+
const variants = product.variants ?? [];
|
|
472
|
+
return {
|
|
473
|
+
id: product.id,
|
|
474
|
+
title: product.title,
|
|
475
|
+
handle: product.slug ?? product.id,
|
|
476
|
+
description: null,
|
|
477
|
+
descriptionHtml: product.descriptionHtml ?? null,
|
|
478
|
+
availableForSale: variants.length > 0 ? variants.some((variant) => variant.availableForSale ?? true) : true,
|
|
479
|
+
featuredImage: product.featuredMedia ? {
|
|
480
|
+
url: product.featuredMedia.url,
|
|
481
|
+
altText: product.featuredMedia.alt ?? null,
|
|
482
|
+
width: product.featuredMedia.width ?? null,
|
|
483
|
+
height: product.featuredMedia.height ?? null
|
|
484
|
+
} : null,
|
|
485
|
+
images: product.featuredMedia ? [
|
|
486
|
+
{
|
|
487
|
+
url: product.featuredMedia.url,
|
|
488
|
+
altText: product.featuredMedia.alt ?? null,
|
|
489
|
+
width: product.featuredMedia.width ?? null,
|
|
490
|
+
height: product.featuredMedia.height ?? null
|
|
491
|
+
}
|
|
492
|
+
] : [],
|
|
493
|
+
media: product.featuredMedia ? [
|
|
494
|
+
{
|
|
495
|
+
type: "image",
|
|
496
|
+
alt: product.featuredMedia.alt ?? null,
|
|
497
|
+
url: product.featuredMedia.url,
|
|
498
|
+
width: product.featuredMedia.width ?? null,
|
|
499
|
+
height: product.featuredMedia.height ?? null
|
|
500
|
+
}
|
|
501
|
+
] : [],
|
|
502
|
+
vendor: null,
|
|
503
|
+
productType: null,
|
|
504
|
+
tags: [],
|
|
505
|
+
sellingPlanGroups: [],
|
|
506
|
+
metafields: [],
|
|
507
|
+
options: options.map((option) => ({
|
|
508
|
+
name: option.title,
|
|
509
|
+
values: option.optionValues.map((optionValue) => optionValue.value)
|
|
510
|
+
})),
|
|
511
|
+
variants: variants.map((variant) => ({
|
|
512
|
+
id: variant.id,
|
|
513
|
+
title: variant.title ?? "",
|
|
514
|
+
availableForSale: variant.availableForSale ?? true,
|
|
515
|
+
sku: variant.sku ?? null,
|
|
516
|
+
selectedOptions: (variant.optionValues ?? []).map((optionValue) => {
|
|
517
|
+
const parentOption = options.find((option) => {
|
|
518
|
+
return option.optionValues.some(
|
|
519
|
+
(parentOptionValue) => parentOptionValue.id === optionValue.id
|
|
520
|
+
);
|
|
521
|
+
});
|
|
522
|
+
return {
|
|
523
|
+
name: parentOption?.title ?? "",
|
|
524
|
+
value: optionValue.value
|
|
525
|
+
};
|
|
526
|
+
}),
|
|
527
|
+
image: null,
|
|
528
|
+
price: {
|
|
529
|
+
amount: String(variant.price ?? 0),
|
|
530
|
+
currencyCode: variant.priceCurrencyCode ?? "USD"
|
|
531
|
+
},
|
|
532
|
+
compareAtPrice: null,
|
|
533
|
+
sellingPlanIds: []
|
|
534
|
+
}))
|
|
535
|
+
};
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
export { assetSchema, collectionSchema, externalVideoSchema, getObjectTypeDefinition, imageSchema, integrationSchema, intelligemsExperienceSchema, levantaAffiliateLinkSchema, levantaProductSchema, mediaImageSchema, mediaSchema, metafieldSchema, okendoReviewSchema, optionValueSchema, optionValueSwatchSchema, opusClipSchema, opusCollectionSchema, opusProjectSchema, pageSchema, planSchema, previewImageSchema, priceSchema, productOptionSchema, productSchema, registryItemSchema, segmentSourceSchema, selectedOptionSchema, transformReploProductToCanonical, variantSchema, videoSchema, videoSourceSchema };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
// ../schemas/sellingPlan.ts
|
|
4
|
+
var sellingPlanPriceAdjustmentSchema = z.object({
|
|
5
|
+
value: z.number(),
|
|
6
|
+
valueType: z.enum(["percentage", "fixedAmount", "price"])
|
|
7
|
+
});
|
|
8
|
+
var sellingPlanOptionValueSchema = z.object({
|
|
9
|
+
name: z.string().optional(),
|
|
10
|
+
value: z.string()
|
|
11
|
+
});
|
|
12
|
+
var sellingPlanSchema = z.object({
|
|
13
|
+
id: z.string(),
|
|
14
|
+
name: z.string(),
|
|
15
|
+
description: z.string().nullable(),
|
|
16
|
+
optionValues: z.array(sellingPlanOptionValueSchema),
|
|
17
|
+
priceAdjustments: z.array(sellingPlanPriceAdjustmentSchema),
|
|
18
|
+
appId: z.string().nullable().optional(),
|
|
19
|
+
price: z.string().optional(),
|
|
20
|
+
externalId: z.string().nullable()
|
|
21
|
+
});
|
|
22
|
+
var sellingPlanGroupSchema = z.object({
|
|
23
|
+
appId: z.string().nullable(),
|
|
24
|
+
options: z.array(
|
|
25
|
+
z.object({
|
|
26
|
+
name: z.string(),
|
|
27
|
+
values: z.array(z.union([z.string(), z.null()]))
|
|
28
|
+
})
|
|
29
|
+
),
|
|
30
|
+
sellingPlans: z.array(sellingPlanSchema)
|
|
31
|
+
}).describe("SellingPlanGroup");
|
|
32
|
+
|
|
33
|
+
export { sellingPlanGroupSchema, sellingPlanOptionValueSchema, sellingPlanPriceAdjustmentSchema, sellingPlanSchema };
|