@replohq/canopy-sdk 3.0.0 → 3.0.2-beta.token-rotation-check.4.712d073
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/url.d.ts +5 -0
- package/_vendor/replo-utils/lib/url.mjs +1 -1
- package/_vendor/schemas/generated/consent.d.ts +21 -2
- package/_vendor/schemas/generated/selectMode.d.ts +1 -1
- package/_vendor/schemas/generated/selectModeIframeRpc.d.ts +8 -0
- package/_vendor/schemas/loaderKeys.mjs +2 -2
- package/_vendor/schemas/routing/rules.mjs +1 -1
- package/_vendor/schemas/selectMode.d.ts +10 -2
- package/_vendor/schemas/selectMode.mjs +1 -1
- package/_vendor/schemas/selectModeIframeRpc.d.ts +27 -1
- package/_vendor/schemas/selectModeIframeRpc.mjs +17 -4
- package/{chunk-7GWIUERW.mjs → chunk-2BNHFQZH.mjs} +32 -22
- package/{chunk-2GKD6VTQ.mjs → chunk-WKKSDMLR.mjs} +7 -1
- package/lib/tombstone.js +2 -2
- package/lib/tombstone.js.map +1 -1
- package/package.json +5 -4
|
@@ -55,3 +55,8 @@ export declare const isValidRoutePath: (path: string) => boolean;
|
|
|
55
55
|
* relative value such as a site path.
|
|
56
56
|
*/
|
|
57
57
|
export declare function parseUrl(value: string, base?: string): URL | null;
|
|
58
|
+
/**
|
|
59
|
+
* File extension from a URL's path, lowercased, defaulting to "jpg" for
|
|
60
|
+
* extensionless paths (product imagery is the primary consumer).
|
|
61
|
+
*/
|
|
62
|
+
export declare function fileExtensionFromUrl(url: string): string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { buildUrlSearchParams, isPreviewInternalHostname, isPreviewOrigin, isValidHttpUrl, isValidRoutePath, normalizeCustomDomain, normalizeUrlIncludingProtocolRelative, normalizeUrlScheme, parseUrl, truncateDomain } from '../../../chunk-
|
|
1
|
+
export { buildUrlSearchParams, fileExtensionFromUrl, isPreviewInternalHostname, isPreviewOrigin, isValidHttpUrl, isValidRoutePath, normalizeCustomDomain, normalizeUrlIncludingProtocolRelative, normalizeUrlScheme, parseUrl, truncateDomain } from '../../../chunk-WKKSDMLR.mjs';
|
|
2
2
|
import '../../../chunk-AKZNN7F2.mjs';
|
|
3
3
|
import '../../../chunk-FNTGY7I5.mjs';
|
|
4
4
|
import '../../../chunk-UJCSKKID.mjs';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type ReploScriptType = "GA4" | "GoogleTagManager" | "Meta" | "TikTok" | "Pinterest" | "Reddit" | "Snapchat" | "Hotjar" | "MicrosoftClarity" | "Contentsquare" | "Segment" | "Northbeam" | "snippet" | "custom";
|
|
1
|
+
export type ReploScriptType = "GA4" | "GoogleTagManager" | "Meta" | "TikTok" | "Pinterest" | "Reddit" | "Snapchat" | "Hotjar" | "MicrosoftClarity" | "Contentsquare" | "Segment" | "Northbeam" | "Gorgias" | "Converge" | "Cookiebot" | "snippet" | "custom" | "consentPlatform";
|
|
2
2
|
export type ConsentCategory = "necessary" | "analytics" | "marketing" | "preferences" | "sale_of_data";
|
|
3
3
|
export type ConsentMode = "off" | "simple" | "per-category";
|
|
4
4
|
export type ScriptTagDescriptor = {
|
|
@@ -10,15 +10,21 @@ export type ScriptTagDescriptor = {
|
|
|
10
10
|
} | {
|
|
11
11
|
kind: "inline";
|
|
12
12
|
body: string;
|
|
13
|
+
module?: boolean;
|
|
13
14
|
};
|
|
14
15
|
export type ReploScriptEntry = {
|
|
15
|
-
type: "GA4" | "GoogleTagManager" | "Meta" | "TikTok" | "Pinterest" | "Reddit" | "Snapchat" | "Hotjar" | "MicrosoftClarity" | "Contentsquare" | "Segment" | "Northbeam";
|
|
16
|
+
type: "GA4" | "GoogleTagManager" | "Meta" | "TikTok" | "Pinterest" | "Reddit" | "Snapchat" | "Hotjar" | "MicrosoftClarity" | "Contentsquare" | "Segment" | "Northbeam" | "Gorgias" | "Converge";
|
|
17
|
+
identifier: string;
|
|
18
|
+
requiredConsent?: ConsentCategory[];
|
|
19
|
+
} | {
|
|
20
|
+
type: "Cookiebot";
|
|
16
21
|
identifier: string;
|
|
17
22
|
requiredConsent?: ConsentCategory[];
|
|
18
23
|
} | {
|
|
19
24
|
type: "snippet";
|
|
20
25
|
id: string;
|
|
21
26
|
body: string;
|
|
27
|
+
module?: boolean;
|
|
22
28
|
requiredConsent: ConsentCategory[];
|
|
23
29
|
} | {
|
|
24
30
|
type: "custom";
|
|
@@ -26,6 +32,19 @@ export type ReploScriptEntry = {
|
|
|
26
32
|
requiredConsent: ConsentCategory[];
|
|
27
33
|
src?: string;
|
|
28
34
|
body?: string;
|
|
35
|
+
} | {
|
|
36
|
+
type: "consentPlatform";
|
|
37
|
+
id: string;
|
|
38
|
+
src: string;
|
|
39
|
+
attributes?: {
|
|
40
|
+
[x: string]: string;
|
|
41
|
+
};
|
|
42
|
+
blockingAttribute: {
|
|
43
|
+
name: string;
|
|
44
|
+
values: {
|
|
45
|
+
[x: string]: string;
|
|
46
|
+
};
|
|
47
|
+
};
|
|
29
48
|
};
|
|
30
49
|
export type ConsentAction = "accept" | "reject" | "update" | "withdraw";
|
|
31
50
|
export type ConsentRecordRequest = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export type DisplayMode = "browse" | "selection";
|
|
2
2
|
export type SelectModeSelectionType = "none" | "element" | "area" | "drag";
|
|
3
|
-
export type SelectModeInlineTextStatus = "editable" | "dynamic" | null;
|
|
3
|
+
export type SelectModeInlineTextStatus = "editable" | "dynamic" | "translated" | null;
|
|
4
4
|
export type SelectModeTextMetrics = {
|
|
5
5
|
tightWidth: number;
|
|
6
6
|
lineCount: number;
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
import type { DisplayMode, SelectModeSelectionType, SelectModeOptimisticUpdatePayload, SelectModeFormatCommand, SelectableData, SelectModeBoundingRect, SelectModeClickPosition, SelectModeSelectionRect, SelectModeTiptapActiveMarks } from "./selectMode";
|
|
2
|
+
export type IframeRuntimeBuildMetadata = {
|
|
3
|
+
packageName: string;
|
|
4
|
+
version: string;
|
|
5
|
+
branch: string | null;
|
|
6
|
+
commit: string | null;
|
|
7
|
+
builtAt: string | null;
|
|
8
|
+
};
|
|
2
9
|
export type SelectModeParentMessage = {
|
|
3
10
|
method: "setDisplayMode";
|
|
4
11
|
data: {
|
|
@@ -46,6 +53,7 @@ export type SelectModeParentMessage = {
|
|
|
46
53
|
};
|
|
47
54
|
export type SelectModeIframeMessage = {
|
|
48
55
|
method: "iframeReady";
|
|
56
|
+
data?: IframeRuntimeBuildMetadata;
|
|
49
57
|
} | {
|
|
50
58
|
method: "elementSelected";
|
|
51
59
|
data: {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import '../../chunk-UJCSKKID.mjs';
|
|
2
2
|
|
|
3
3
|
// lib/tombstone.ts
|
|
4
|
-
var migrationCommand = `pnpm add @replohq/sdk@latest @replohq/sandbox-runtime@latest && pnpm remove canopy-sdk
|
|
5
|
-
(if package.json lists "@replohq/canopy-sdk" instead of the "canopy-sdk" alias, run: pnpm remove @replohq/canopy-sdk)`;
|
|
4
|
+
var migrationCommand = `pnpm add --ignore-workspace @replohq/sdk@latest @replohq/sandbox-runtime@latest && pnpm remove --ignore-workspace canopy-sdk
|
|
5
|
+
(if package.json lists "@replohq/canopy-sdk" instead of the "canopy-sdk" alias, run: pnpm remove --ignore-workspace @replohq/canopy-sdk)`;
|
|
6
6
|
var providerComposition = `import { ReploProvider } from "@replohq/sdk/providers/replo-provider";
|
|
7
7
|
import { SandboxRuntime } from "@replohq/sandbox-runtime";
|
|
8
8
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getParamSegment, getRouteParams, hasRouteParam, matchSource } from '../../../chunk-VPEVERWE.mjs';
|
|
2
|
-
import { parseUrl } from '../../../chunk-
|
|
2
|
+
import { parseUrl } from '../../../chunk-WKKSDMLR.mjs';
|
|
3
3
|
import '../../../chunk-AKZNN7F2.mjs';
|
|
4
4
|
import { ReploError } from '../../../chunk-ZZPQ3E7S.mjs';
|
|
5
5
|
import '../../../chunk-H36NDYLG.mjs';
|
|
@@ -8,6 +8,7 @@ export declare const displayModeSchema: z.ZodEnum<{
|
|
|
8
8
|
export declare const selectModeInlineTextStatusSchema: z.ZodNullable<z.ZodEnum<{
|
|
9
9
|
editable: "editable";
|
|
10
10
|
dynamic: "dynamic";
|
|
11
|
+
translated: "translated";
|
|
11
12
|
}>>;
|
|
12
13
|
export declare const selectModeTextMetricsSchema: z.ZodObject<{
|
|
13
14
|
tightWidth: z.ZodNumber;
|
|
@@ -86,13 +87,15 @@ export type RectOffset = {
|
|
|
86
87
|
left: number;
|
|
87
88
|
top: number;
|
|
88
89
|
};
|
|
89
|
-
export declare function transformRect({ rect, offset, }: {
|
|
90
|
+
export declare function transformRect({ rect, offset, scale, }: {
|
|
90
91
|
rect: SelectModeBoundingRect;
|
|
91
92
|
offset: RectOffset;
|
|
93
|
+
scale?: number;
|
|
92
94
|
}): SelectModeBoundingRect;
|
|
93
|
-
export declare function transformPoint({ point, offset, }: {
|
|
95
|
+
export declare function transformPoint({ point, offset, scale, }: {
|
|
94
96
|
point: SelectModeClickPosition;
|
|
95
97
|
offset: RectOffset;
|
|
98
|
+
scale?: number;
|
|
96
99
|
}): SelectModeClickPosition;
|
|
97
100
|
export declare function getIframeOffset(iframe: HTMLIFrameElement | null): RectOffset;
|
|
98
101
|
export declare const selectedElementSchema: z.ZodObject<{
|
|
@@ -256,6 +259,11 @@ export type SelectModeBoundingRect = z.infer<typeof selectModeBoundingRectSchema
|
|
|
256
259
|
export type SelectModeClickPosition = z.infer<typeof selectModeClickPositionSchema>;
|
|
257
260
|
export type SelectableData = z.infer<typeof selectableDataSchema>;
|
|
258
261
|
export type SelectableDataPayload = z.infer<typeof selectableDataPayloadSchema>;
|
|
262
|
+
export declare function transformSelectedElement({ element, offset, scale, }: {
|
|
263
|
+
element: z.infer<typeof selectedElementSchema>;
|
|
264
|
+
offset: RectOffset;
|
|
265
|
+
scale?: number;
|
|
266
|
+
}): z.infer<typeof selectedElementSchema>;
|
|
259
267
|
export declare function transformSelectableData({ data, offset, }: {
|
|
260
268
|
data: SelectableData;
|
|
261
269
|
offset: RectOffset;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { SELECT_MODE_SELECTABLE_ATTRIBUTE, SELECT_MODE_SELECTABLE_PAYLOAD_ATTRIBUTE, displayModeSchema, getIframeOffset, readSelectablePayload, selectModeBoundingRectSchema, selectModeClickPositionSchema, selectModeDefinedStyleSchema, selectModeFiberChainEntrySchema, selectModeFormatCommandSchema, selectModeInlineTextStatusSchema, selectModeOptimisticUpdatePayloadSchema, selectModeSelectionRectSchema, selectModeSelectionSchema, selectModeSelectionTypeSchema, selectModeSourceLocationSchema, selectModeStyleAtRuleSchema, selectModeStyleVariantSchema, selectModeTextMetricsSchema, selectModeTiptapActiveMarksSchema, selectableDataPayloadSchema, selectableDataSchema, selectablePlanDataSchema, selectablePlanPayloadSchema, selectedElementSchema, transformPoint, transformRect, transformSelectableData } from '../../chunk-
|
|
1
|
+
export { SELECT_MODE_SELECTABLE_ATTRIBUTE, SELECT_MODE_SELECTABLE_PAYLOAD_ATTRIBUTE, displayModeSchema, getIframeOffset, readSelectablePayload, selectModeBoundingRectSchema, selectModeClickPositionSchema, selectModeDefinedStyleSchema, selectModeFiberChainEntrySchema, selectModeFormatCommandSchema, selectModeInlineTextStatusSchema, selectModeOptimisticUpdatePayloadSchema, selectModeSelectionRectSchema, selectModeSelectionSchema, selectModeSelectionTypeSchema, selectModeSourceLocationSchema, selectModeStyleAtRuleSchema, selectModeStyleVariantSchema, selectModeTextMetricsSchema, selectModeTiptapActiveMarksSchema, selectableDataPayloadSchema, selectableDataSchema, selectablePlanDataSchema, selectablePlanPayloadSchema, selectedElementSchema, transformPoint, transformRect, transformSelectableData, transformSelectedElement } from '../../chunk-2BNHFQZH.mjs';
|
|
2
2
|
import '../../chunk-VKO7P3ED.mjs';
|
|
3
3
|
import '../../chunk-H36NDYLG.mjs';
|
|
4
4
|
import '../../chunk-ILGEM42C.mjs';
|
|
@@ -2,6 +2,13 @@ import type { SelectModeIframeMessage, SelectModeParentMessage } from "./generat
|
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
export declare const SELECT_MODE_IFRAME_RPC_CHANNEL_ID: "replo:select-mode-iframe-rpc";
|
|
4
4
|
export declare const SELECT_MODE_IFRAME_RPC_CHANNEL_VERSION: 1;
|
|
5
|
+
export declare const iframeRuntimeBuildMetadataSchema: z.ZodObject<{
|
|
6
|
+
packageName: z.ZodString;
|
|
7
|
+
version: z.ZodString;
|
|
8
|
+
branch: z.ZodNullable<z.ZodString>;
|
|
9
|
+
commit: z.ZodNullable<z.ZodString>;
|
|
10
|
+
builtAt: z.ZodNullable<z.ZodString>;
|
|
11
|
+
}, z.core.$strip>;
|
|
5
12
|
export declare const websiteBuilderToCanopyMethodConfig: {
|
|
6
13
|
symbolicateSelectedElement: {
|
|
7
14
|
inputSchema: z.ZodObject<{
|
|
@@ -124,6 +131,12 @@ export declare const websiteBuilderToCanopyMethodConfig: {
|
|
|
124
131
|
}, z.core.$strip>;
|
|
125
132
|
timeoutMs: number;
|
|
126
133
|
};
|
|
134
|
+
navigateToRoute: {
|
|
135
|
+
inputSchema: z.ZodObject<{
|
|
136
|
+
pathname: z.ZodString;
|
|
137
|
+
}, z.core.$strip>;
|
|
138
|
+
outputSchema: z.ZodVoid;
|
|
139
|
+
};
|
|
127
140
|
setDisplayMode: {
|
|
128
141
|
inputSchema: z.ZodObject<{
|
|
129
142
|
displayMode: z.ZodEnum<{
|
|
@@ -280,7 +293,13 @@ export declare const canopyToWebsiteBuilderMethodConfig: {
|
|
|
280
293
|
timeoutMs: number;
|
|
281
294
|
};
|
|
282
295
|
iframeReady: {
|
|
283
|
-
inputSchema: z.
|
|
296
|
+
inputSchema: z.ZodOptional<z.ZodObject<{
|
|
297
|
+
packageName: z.ZodString;
|
|
298
|
+
version: z.ZodString;
|
|
299
|
+
branch: z.ZodNullable<z.ZodString>;
|
|
300
|
+
commit: z.ZodNullable<z.ZodString>;
|
|
301
|
+
builtAt: z.ZodNullable<z.ZodString>;
|
|
302
|
+
}, z.core.$strip>>;
|
|
284
303
|
outputSchema: z.ZodVoid;
|
|
285
304
|
};
|
|
286
305
|
elementSelected: {
|
|
@@ -629,6 +648,13 @@ export declare const selectModeParentMessageSchema: z.ZodDiscriminatedUnion<[z.Z
|
|
|
629
648
|
}, z.core.$strip>], "method">;
|
|
630
649
|
export declare const selectModeIframeMessageSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
631
650
|
method: z.ZodLiteral<"iframeReady">;
|
|
651
|
+
data: z.ZodOptional<z.ZodObject<{
|
|
652
|
+
packageName: z.ZodString;
|
|
653
|
+
version: z.ZodString;
|
|
654
|
+
branch: z.ZodNullable<z.ZodString>;
|
|
655
|
+
commit: z.ZodNullable<z.ZodString>;
|
|
656
|
+
builtAt: z.ZodNullable<z.ZodString>;
|
|
657
|
+
}, z.core.$strip>>;
|
|
632
658
|
}, z.core.$strip>, z.ZodObject<{
|
|
633
659
|
method: z.ZodLiteral<"elementSelected">;
|
|
634
660
|
data: z.ZodObject<{
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { selectModeFormatCommandSchema, selectModeOptimisticUpdatePayloadSchema, selectModeSelectionTypeSchema, displayModeSchema, selectModeTiptapActiveMarksSchema, selectModeBoundingRectSchema, selectableDataSchema, selectModeSelectionRectSchema, selectModeClickPositionSchema, selectedElementSchema } from '../../chunk-
|
|
1
|
+
import { selectModeFormatCommandSchema, selectModeOptimisticUpdatePayloadSchema, selectModeSelectionTypeSchema, displayModeSchema, selectModeTiptapActiveMarksSchema, selectModeBoundingRectSchema, selectableDataSchema, selectModeSelectionRectSchema, selectModeClickPositionSchema, selectedElementSchema } from '../../chunk-2BNHFQZH.mjs';
|
|
2
2
|
import '../../chunk-VKO7P3ED.mjs';
|
|
3
3
|
import '../../chunk-H36NDYLG.mjs';
|
|
4
4
|
import '../../chunk-ILGEM42C.mjs';
|
|
@@ -8,12 +8,24 @@ import { z } from 'zod';
|
|
|
8
8
|
|
|
9
9
|
var SELECT_MODE_IFRAME_RPC_CHANNEL_ID = "replo:select-mode-iframe-rpc";
|
|
10
10
|
var SELECT_MODE_IFRAME_RPC_CHANNEL_VERSION = 1;
|
|
11
|
+
var iframeRuntimeBuildMetadataSchema = z.object({
|
|
12
|
+
packageName: z.string(),
|
|
13
|
+
version: z.string(),
|
|
14
|
+
branch: z.string().nullable(),
|
|
15
|
+
commit: z.string().nullable(),
|
|
16
|
+
builtAt: z.string().nullable()
|
|
17
|
+
}).describe("IframeRuntimeBuildMetadata");
|
|
11
18
|
var websiteBuilderToCanopyMethodConfig = {
|
|
12
19
|
symbolicateSelectedElement: {
|
|
13
20
|
inputSchema: selectedElementSchema,
|
|
14
21
|
outputSchema: selectedElementSchema,
|
|
15
22
|
timeoutMs: 1500
|
|
16
23
|
},
|
|
24
|
+
// Client-side transition command; fire-and-forget because success is observed as the `replo:navigated` echo.
|
|
25
|
+
navigateToRoute: {
|
|
26
|
+
inputSchema: z.object({ pathname: z.string() }),
|
|
27
|
+
outputSchema: z.void()
|
|
28
|
+
},
|
|
17
29
|
setDisplayMode: {
|
|
18
30
|
inputSchema: z.object({ displayMode: displayModeSchema }),
|
|
19
31
|
outputSchema: z.void()
|
|
@@ -81,7 +93,7 @@ var canopyToWebsiteBuilderMethodConfig = {
|
|
|
81
93
|
timeoutMs: 5e3
|
|
82
94
|
},
|
|
83
95
|
iframeReady: {
|
|
84
|
-
inputSchema:
|
|
96
|
+
inputSchema: iframeRuntimeBuildMetadataSchema.optional(),
|
|
85
97
|
outputSchema: z.void()
|
|
86
98
|
},
|
|
87
99
|
elementSelected: {
|
|
@@ -184,7 +196,8 @@ var selectModeParentMessageSchema = z.discriminatedUnion("method", [
|
|
|
184
196
|
]).describe("SelectModeParentMessage");
|
|
185
197
|
var selectModeIframeMessageSchema = z.discriminatedUnion("method", [
|
|
186
198
|
z.object({
|
|
187
|
-
method: z.literal("iframeReady")
|
|
199
|
+
method: z.literal("iframeReady"),
|
|
200
|
+
data: iframeRuntimeBuildMetadataSchema.optional()
|
|
188
201
|
}),
|
|
189
202
|
z.object({
|
|
190
203
|
method: z.literal("elementSelected"),
|
|
@@ -223,4 +236,4 @@ var selectModeIframeMessageSchema = z.discriminatedUnion("method", [
|
|
|
223
236
|
})
|
|
224
237
|
]).describe("SelectModeIframeMessage");
|
|
225
238
|
|
|
226
|
-
export { SELECT_MODE_IFRAME_RPC_CHANNEL_ID, SELECT_MODE_IFRAME_RPC_CHANNEL_VERSION, canopyToWebsiteBuilderMethodConfig, selectModeIframeMessageSchema, selectModeParentMessageSchema, websiteBuilderToCanopyMethodConfig };
|
|
239
|
+
export { SELECT_MODE_IFRAME_RPC_CHANNEL_ID, SELECT_MODE_IFRAME_RPC_CHANNEL_VERSION, canopyToWebsiteBuilderMethodConfig, iframeRuntimeBuildMetadataSchema, selectModeIframeMessageSchema, selectModeParentMessageSchema, websiteBuilderToCanopyMethodConfig };
|
|
@@ -10,7 +10,7 @@ function parseSchemaOrNull(value, schema) {
|
|
|
10
10
|
var SELECT_MODE_SELECTABLE_ATTRIBUTE = "data-replo-selectable";
|
|
11
11
|
var SELECT_MODE_SELECTABLE_PAYLOAD_ATTRIBUTE = "data-replo-selectable-payload";
|
|
12
12
|
var displayModeSchema = z.enum(["browse", "selection"]).describe("DisplayMode");
|
|
13
|
-
var selectModeInlineTextStatusSchema = z.enum(["editable", "dynamic"]).nullable().describe("SelectModeInlineTextStatus");
|
|
13
|
+
var selectModeInlineTextStatusSchema = z.enum(["editable", "dynamic", "translated"]).nullable().describe("SelectModeInlineTextStatus");
|
|
14
14
|
var selectModeTextMetricsSchema = z.object({
|
|
15
15
|
tightWidth: z.number(),
|
|
16
16
|
lineCount: z.number(),
|
|
@@ -63,26 +63,28 @@ var selectModeDefinedStyleSchema = z.object({
|
|
|
63
63
|
}).describe("SelectModeDefinedStyle");
|
|
64
64
|
function transformRect({
|
|
65
65
|
rect,
|
|
66
|
-
offset
|
|
66
|
+
offset,
|
|
67
|
+
scale = 1
|
|
67
68
|
}) {
|
|
68
69
|
return {
|
|
69
|
-
x: rect.x + offset.left,
|
|
70
|
-
y: rect.y + offset.top,
|
|
71
|
-
left: rect.left + offset.left,
|
|
72
|
-
right: rect.right + offset.left,
|
|
73
|
-
top: rect.top + offset.top,
|
|
74
|
-
bottom: rect.bottom + offset.top,
|
|
75
|
-
width: rect.width,
|
|
76
|
-
height: rect.height
|
|
70
|
+
x: rect.x * scale + offset.left,
|
|
71
|
+
y: rect.y * scale + offset.top,
|
|
72
|
+
left: rect.left * scale + offset.left,
|
|
73
|
+
right: rect.right * scale + offset.left,
|
|
74
|
+
top: rect.top * scale + offset.top,
|
|
75
|
+
bottom: rect.bottom * scale + offset.top,
|
|
76
|
+
width: rect.width * scale,
|
|
77
|
+
height: rect.height * scale
|
|
77
78
|
};
|
|
78
79
|
}
|
|
79
80
|
function transformPoint({
|
|
80
81
|
point,
|
|
81
|
-
offset
|
|
82
|
+
offset,
|
|
83
|
+
scale = 1
|
|
82
84
|
}) {
|
|
83
85
|
return {
|
|
84
|
-
x: point.x + offset.left,
|
|
85
|
-
y: point.y + offset.top
|
|
86
|
+
x: point.x * scale + offset.left,
|
|
87
|
+
y: point.y * scale + offset.top
|
|
86
88
|
};
|
|
87
89
|
}
|
|
88
90
|
function getIframeOffset(iframe) {
|
|
@@ -117,6 +119,21 @@ var selectablePlanDataSchema = z.object({
|
|
|
117
119
|
var selectablePlanPayloadSchema = selectablePlanDataSchema.omit({ rect: true }).describe("SelectablePlanPayload");
|
|
118
120
|
var selectableDataPayloadSchema = z.discriminatedUnion("kind", [selectablePlanPayloadSchema]).describe("SelectableDataPayload");
|
|
119
121
|
var selectableDataSchema = z.discriminatedUnion("kind", [selectedElementSchema, selectablePlanDataSchema]).describe("SelectableData");
|
|
122
|
+
function transformSelectedElement({
|
|
123
|
+
element,
|
|
124
|
+
offset,
|
|
125
|
+
scale = 1
|
|
126
|
+
}) {
|
|
127
|
+
return {
|
|
128
|
+
...element,
|
|
129
|
+
rect: transformRect({ rect: element.rect, offset, scale }),
|
|
130
|
+
clickPosition: transformPoint({
|
|
131
|
+
point: element.clickPosition,
|
|
132
|
+
offset,
|
|
133
|
+
scale
|
|
134
|
+
})
|
|
135
|
+
};
|
|
136
|
+
}
|
|
120
137
|
function transformSelectableData({
|
|
121
138
|
data,
|
|
122
139
|
offset
|
|
@@ -125,14 +142,7 @@ function transformSelectableData({
|
|
|
125
142
|
data,
|
|
126
143
|
"kind"
|
|
127
144
|
)({
|
|
128
|
-
"react-element": (element) => ({
|
|
129
|
-
...element,
|
|
130
|
-
rect: transformRect({ rect: element.rect, offset }),
|
|
131
|
-
clickPosition: transformPoint({
|
|
132
|
-
point: element.clickPosition,
|
|
133
|
-
offset
|
|
134
|
-
})
|
|
135
|
-
}),
|
|
145
|
+
"react-element": (element) => transformSelectedElement({ element, offset }),
|
|
136
146
|
plan: (plan) => ({
|
|
137
147
|
...plan,
|
|
138
148
|
rect: transformRect({ rect: plan.rect, offset })
|
|
@@ -194,4 +204,4 @@ var selectModeSelectionSchema = z.discriminatedUnion("type", [
|
|
|
194
204
|
})
|
|
195
205
|
]).describe("SelectModeSelection");
|
|
196
206
|
|
|
197
|
-
export { SELECT_MODE_SELECTABLE_ATTRIBUTE, SELECT_MODE_SELECTABLE_PAYLOAD_ATTRIBUTE, displayModeSchema, getIframeOffset, readSelectablePayload, selectModeBoundingRectSchema, selectModeClickPositionSchema, selectModeDefinedStyleSchema, selectModeFiberChainEntrySchema, selectModeFormatCommandSchema, selectModeInlineTextStatusSchema, selectModeOptimisticUpdatePayloadSchema, selectModeSelectionRectSchema, selectModeSelectionSchema, selectModeSelectionTypeSchema, selectModeSourceLocationSchema, selectModeStyleAtRuleSchema, selectModeStyleVariantSchema, selectModeTextMetricsSchema, selectModeTiptapActiveMarksSchema, selectableDataPayloadSchema, selectableDataSchema, selectablePlanDataSchema, selectablePlanPayloadSchema, selectedElementSchema, transformPoint, transformRect, transformSelectableData };
|
|
207
|
+
export { SELECT_MODE_SELECTABLE_ATTRIBUTE, SELECT_MODE_SELECTABLE_PAYLOAD_ATTRIBUTE, displayModeSchema, getIframeOffset, readSelectablePayload, selectModeBoundingRectSchema, selectModeClickPositionSchema, selectModeDefinedStyleSchema, selectModeFiberChainEntrySchema, selectModeFormatCommandSchema, selectModeInlineTextStatusSchema, selectModeOptimisticUpdatePayloadSchema, selectModeSelectionRectSchema, selectModeSelectionSchema, selectModeSelectionTypeSchema, selectModeSourceLocationSchema, selectModeStyleAtRuleSchema, selectModeStyleVariantSchema, selectModeTextMetricsSchema, selectModeTiptapActiveMarksSchema, selectableDataPayloadSchema, selectableDataSchema, selectablePlanDataSchema, selectablePlanPayloadSchema, selectedElementSchema, transformPoint, transformRect, transformSelectableData, transformSelectedElement };
|
|
@@ -146,5 +146,11 @@ function parseUrl(value, base) {
|
|
|
146
146
|
return null;
|
|
147
147
|
}
|
|
148
148
|
}
|
|
149
|
+
function fileExtensionFromUrl(url) {
|
|
150
|
+
const pathname = URL.canParse(url) ? new URL(url).pathname : url;
|
|
151
|
+
const lastSegment = pathname.split("/").pop() ?? "";
|
|
152
|
+
const extension = lastSegment.includes(".") ? lastSegment.split(".").pop() ?? "" : "";
|
|
153
|
+
return extension.toLowerCase() || "jpg";
|
|
154
|
+
}
|
|
149
155
|
|
|
150
|
-
export { buildUrlSearchParams, isPreviewInternalHostname, isPreviewOrigin, isValidHttpUrl, isValidRoutePath, normalizeCustomDomain, normalizeUrlIncludingProtocolRelative, normalizeUrlScheme, parseUrl, truncateDomain };
|
|
156
|
+
export { buildUrlSearchParams, fileExtensionFromUrl, isPreviewInternalHostname, isPreviewOrigin, isValidHttpUrl, isValidRoutePath, normalizeCustomDomain, normalizeUrlIncludingProtocolRelative, normalizeUrlScheme, parseUrl, truncateDomain };
|
package/lib/tombstone.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const migrationCommand = `pnpm add @replohq/sdk@latest @replohq/sandbox-runtime@latest && pnpm remove canopy-sdk
|
|
2
|
-
(if package.json lists "@replohq/canopy-sdk" instead of the "canopy-sdk" alias, run: pnpm remove @replohq/canopy-sdk)`;
|
|
1
|
+
const migrationCommand = `pnpm add --ignore-workspace @replohq/sdk@latest @replohq/sandbox-runtime@latest && pnpm remove --ignore-workspace canopy-sdk
|
|
2
|
+
(if package.json lists "@replohq/canopy-sdk" instead of the "canopy-sdk" alias, run: pnpm remove --ignore-workspace @replohq/canopy-sdk)`;
|
|
3
3
|
const providerComposition = `import { ReploProvider } from "@replohq/sdk/providers/replo-provider";
|
|
4
4
|
import { SandboxRuntime } from "@replohq/sandbox-runtime";
|
|
5
5
|
|
package/lib/tombstone.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../lib/tombstone.ts"],
|
|
4
|
-
"sourcesContent": ["type PublicSdkReplacement = {\n kind: \"public-sdk\";\n replacementImport?: string;\n};\n\ntype SandboxRuntimeReplacement = {\n kind: \"sandbox-runtime\";\n};\n\ntype InternalReplacement = {\n kind: \"internal\";\n nearestPublicSubpaths: readonly string[];\n};\n\ntype TombstoneReplacement =\n | PublicSdkReplacement\n | SandboxRuntimeReplacement\n | InternalReplacement;\n\ntype TombstoneLocation = {\n symbol: string;\n subpath: string;\n replacement?: TombstoneReplacement;\n replacementImport?: string;\n};\n\nconst migrationCommand = `pnpm add @replohq/sdk@latest @replohq/sandbox-runtime@latest && pnpm remove canopy-sdk\n(if package.json lists \"@replohq/canopy-sdk\" instead of the \"canopy-sdk\" alias, run: pnpm remove @replohq/canopy-sdk)`;\n\nconst providerComposition = `import { ReploProvider } from \"@replohq/sdk/providers/replo-provider\";\nimport { SandboxRuntime } from \"@replohq/sandbox-runtime\";\n\nexport default function RootLayout({\n children,\n}: Readonly<{\n children: React.ReactNode;\n}>) {\n return (\n <html>\n <body>\n <ReploProvider>\n <SandboxRuntime>{children}</SandboxRuntime>\n </ReploProvider>\n </body>\n </html>\n );\n}`;\n\nconst migrationRule = `For storefront imports the migration is mechanical: every public canopy-sdk/<subpath> or @replohq/canopy-sdk/<subpath> import becomes @replohq/sdk/<subpath>. Editor/select-mode functionality is not imported directly: SandboxRuntime from @replohq/sandbox-runtime provides it automatically once mounted.`;\n\nfunction reploProviderTombstoneError(): Error {\n return new Error(`ReploProvider was removed from @replohq/canopy-sdk v3, the final, fully deprecated release.\n\nReplace the single legacy provider with ReploProvider from @replohq/sdk/providers/replo-provider wrapping SandboxRuntime from @replohq/sandbox-runtime, with SandboxRuntime nested inside ReploProvider:\n\n${providerComposition}\n\nInstall the replacements and remove the deprecated package:\n${migrationCommand}\n\n${migrationRule}`);\n}\n\nfunction sandboxRuntimeMigration({ symbol }: { symbol: string }): string {\n return `${symbol} was editor/select-mode functionality. It now ships inside @replohq/sandbox-runtime and is not directly importable.\n\nMount SandboxRuntime from @replohq/sandbox-runtime inside ReploProvider from @replohq/sdk in the root layout; SandboxRuntime provides this functionality automatically:\n\n${providerComposition}\n\nThen delete this import and any /editor route code that used it.`;\n}\n\nfunction internalMigration({\n nearestPublicSubpaths,\n}: InternalReplacement): string {\n const publicApis = nearestPublicSubpaths\n .map((subpath) => `- @replohq/sdk/${subpath}`)\n .join(\"\\n\");\n\n return `This was an internal module with no direct public replacement.\n\nUse the nearest supported public API for this domain:\n${publicApis}`;\n}\n\nexport function canopyTombstoneError({\n symbol,\n subpath,\n replacement,\n replacementImport,\n}: TombstoneLocation): Error {\n if (symbol === \"ReploProvider\") {\n return reploProviderTombstoneError();\n }\n\n const resolvedReplacement = replacement ?? {\n kind: \"public-sdk\",\n replacementImport,\n };\n const migration = (() => {\n switch (resolvedReplacement.kind) {\n case \"public-sdk\":\n return `Use the replacement export:\n${\n resolvedReplacement.replacementImport ??\n `import { ${symbol} } from \"@replohq/sdk/${subpath}\";`\n}`;\n case \"sandbox-runtime\":\n return sandboxRuntimeMigration({ symbol });\n case \"internal\":\n return internalMigration(resolvedReplacement);\n }\n })();\n\n return new Error(`${symbol} was removed from @replohq/canopy-sdk v3, the final, fully deprecated release.\n\n${migration}\n\nInstall the replacements and remove the deprecated package:\n${migrationCommand}\n\n${migrationRule}`);\n}\n\nexport function canopyTombstoneObject<ExportType>(\n location: TombstoneLocation,\n): ExportType {\n const throwTombstoneError = (): never => {\n throw canopyTombstoneError(location);\n };\n\n // eslint-disable-next-line replo/no-as-cast -- Proxy traps cannot retain an arbitrary public object type without the mandated boundary cast.\n return new Proxy(throwTombstoneError, {\n apply: throwTombstoneError,\n get: throwTombstoneError,\n has: throwTombstoneError,\n }) as unknown as ExportType;\n}\n"],
|
|
4
|
+
"sourcesContent": ["type PublicSdkReplacement = {\n kind: \"public-sdk\";\n replacementImport?: string;\n};\n\ntype SandboxRuntimeReplacement = {\n kind: \"sandbox-runtime\";\n};\n\ntype InternalReplacement = {\n kind: \"internal\";\n nearestPublicSubpaths: readonly string[];\n};\n\ntype TombstoneReplacement =\n | PublicSdkReplacement\n | SandboxRuntimeReplacement\n | InternalReplacement;\n\ntype TombstoneLocation = {\n symbol: string;\n subpath: string;\n replacement?: TombstoneReplacement;\n replacementImport?: string;\n};\n\nconst migrationCommand = `pnpm add --ignore-workspace @replohq/sdk@latest @replohq/sandbox-runtime@latest && pnpm remove --ignore-workspace canopy-sdk\n(if package.json lists \"@replohq/canopy-sdk\" instead of the \"canopy-sdk\" alias, run: pnpm remove --ignore-workspace @replohq/canopy-sdk)`;\n\nconst providerComposition = `import { ReploProvider } from \"@replohq/sdk/providers/replo-provider\";\nimport { SandboxRuntime } from \"@replohq/sandbox-runtime\";\n\nexport default function RootLayout({\n children,\n}: Readonly<{\n children: React.ReactNode;\n}>) {\n return (\n <html>\n <body>\n <ReploProvider>\n <SandboxRuntime>{children}</SandboxRuntime>\n </ReploProvider>\n </body>\n </html>\n );\n}`;\n\nconst migrationRule = `For storefront imports the migration is mechanical: every public canopy-sdk/<subpath> or @replohq/canopy-sdk/<subpath> import becomes @replohq/sdk/<subpath>. Editor/select-mode functionality is not imported directly: SandboxRuntime from @replohq/sandbox-runtime provides it automatically once mounted.`;\n\nfunction reploProviderTombstoneError(): Error {\n return new Error(`ReploProvider was removed from @replohq/canopy-sdk v3, the final, fully deprecated release.\n\nReplace the single legacy provider with ReploProvider from @replohq/sdk/providers/replo-provider wrapping SandboxRuntime from @replohq/sandbox-runtime, with SandboxRuntime nested inside ReploProvider:\n\n${providerComposition}\n\nInstall the replacements and remove the deprecated package:\n${migrationCommand}\n\n${migrationRule}`);\n}\n\nfunction sandboxRuntimeMigration({ symbol }: { symbol: string }): string {\n return `${symbol} was editor/select-mode functionality. It now ships inside @replohq/sandbox-runtime and is not directly importable.\n\nMount SandboxRuntime from @replohq/sandbox-runtime inside ReploProvider from @replohq/sdk in the root layout; SandboxRuntime provides this functionality automatically:\n\n${providerComposition}\n\nThen delete this import and any /editor route code that used it.`;\n}\n\nfunction internalMigration({\n nearestPublicSubpaths,\n}: InternalReplacement): string {\n const publicApis = nearestPublicSubpaths\n .map((subpath) => `- @replohq/sdk/${subpath}`)\n .join(\"\\n\");\n\n return `This was an internal module with no direct public replacement.\n\nUse the nearest supported public API for this domain:\n${publicApis}`;\n}\n\nexport function canopyTombstoneError({\n symbol,\n subpath,\n replacement,\n replacementImport,\n}: TombstoneLocation): Error {\n if (symbol === \"ReploProvider\") {\n return reploProviderTombstoneError();\n }\n\n const resolvedReplacement = replacement ?? {\n kind: \"public-sdk\",\n replacementImport,\n };\n const migration = (() => {\n switch (resolvedReplacement.kind) {\n case \"public-sdk\":\n return `Use the replacement export:\n${\n resolvedReplacement.replacementImport ??\n `import { ${symbol} } from \"@replohq/sdk/${subpath}\";`\n}`;\n case \"sandbox-runtime\":\n return sandboxRuntimeMigration({ symbol });\n case \"internal\":\n return internalMigration(resolvedReplacement);\n }\n })();\n\n return new Error(`${symbol} was removed from @replohq/canopy-sdk v3, the final, fully deprecated release.\n\n${migration}\n\nInstall the replacements and remove the deprecated package:\n${migrationCommand}\n\n${migrationRule}`);\n}\n\nexport function canopyTombstoneObject<ExportType>(\n location: TombstoneLocation,\n): ExportType {\n const throwTombstoneError = (): never => {\n throw canopyTombstoneError(location);\n };\n\n // eslint-disable-next-line replo/no-as-cast -- Proxy traps cannot retain an arbitrary public object type without the mandated boundary cast.\n return new Proxy(throwTombstoneError, {\n apply: throwTombstoneError,\n get: throwTombstoneError,\n has: throwTombstoneError,\n }) as unknown as ExportType;\n}\n"],
|
|
5
5
|
"mappings": "AA0BA,MAAM,mBAAmB;AAAA;AAGzB,MAAM,sBAAsB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAmB5B,MAAM,gBAAgB;AAEtB,SAAS,8BAAqC;AAC5C,SAAO,IAAI,MAAM;AAAA;AAAA;AAAA;AAAA,EAIjB,mBAAmB;AAAA;AAAA;AAAA,EAGnB,gBAAgB;AAAA;AAAA,EAEhB,aAAa,EAAE;AACjB;AAEA,SAAS,wBAAwB,EAAE,OAAO,GAA+B;AACvE,SAAO,GAAG,MAAM;AAAA;AAAA;AAAA;AAAA,EAIhB,mBAAmB;AAAA;AAAA;AAGrB;AAEA,SAAS,kBAAkB;AAAA,EACzB;AACF,GAAgC;AAC9B,QAAM,aAAa,sBAChB,IAAI,CAAC,YAAY,kBAAkB,OAAO,EAAE,EAC5C,KAAK,IAAI;AAEZ,SAAO;AAAA;AAAA;AAAA,EAGP,UAAU;AACZ;AAEO,SAAS,qBAAqB;AAAA,EACnC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAA6B;AAC3B,MAAI,WAAW,iBAAiB;AAC9B,WAAO,4BAA4B;AAAA,EACrC;AAEA,QAAM,sBAAsB,eAAe;AAAA,IACzC,MAAM;AAAA,IACN;AAAA,EACF;AACA,QAAM,aAAa,MAAM;AACvB,YAAQ,oBAAoB,MAAM;AAAA,MAChC,KAAK;AACH,eAAO;AAAA,EAEb,oBAAoB,qBACpB,YAAY,MAAM,yBAAyB,OAAO,IACpD;AAAA,MACM,KAAK;AACH,eAAO,wBAAwB,EAAE,OAAO,CAAC;AAAA,MAC3C,KAAK;AACH,eAAO,kBAAkB,mBAAmB;AAAA,IAChD;AAAA,EACF,GAAG;AAEH,SAAO,IAAI,MAAM,GAAG,MAAM;AAAA;AAAA,EAE1B,SAAS;AAAA;AAAA;AAAA,EAGT,gBAAgB;AAAA;AAAA,EAEhB,aAAa,EAAE;AACjB;AAEO,SAAS,sBACd,UACY;AACZ,QAAM,sBAAsB,MAAa;AACvC,UAAM,qBAAqB,QAAQ;AAAA,EACrC;AAGA,SAAO,IAAI,MAAM,qBAAqB;AAAA,IACpC,OAAO;AAAA,IACP,KAAK;AAAA,IACL,KAAK;AAAA,EACP,CAAC;AACH;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@replohq/canopy-sdk",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.2-beta.token-rotation-check.4.712d073",
|
|
4
4
|
"description": "Replo Canopy SDK — cart, analytics, data loaders, and editor runtime for agent-built Next.js sites.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -211,9 +211,10 @@
|
|
|
211
211
|
"react": ">=18.2.0",
|
|
212
212
|
"react-dom": ">=18.2.0"
|
|
213
213
|
},
|
|
214
|
-
"
|
|
215
|
-
"
|
|
216
|
-
"
|
|
214
|
+
"repository": {
|
|
215
|
+
"type": "git",
|
|
216
|
+
"url": "git+https://github.com/replohq/andytown.git",
|
|
217
|
+
"directory": "packages/canopy-sdk"
|
|
217
218
|
},
|
|
218
219
|
"engines": {
|
|
219
220
|
"node": "22.x"
|