@replohq/canopy-sdk 3.0.1 → 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.
@@ -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-2GKD6VTQ.mjs';
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 = {
@@ -13,7 +13,11 @@ export type ScriptTagDescriptor = {
13
13
  module?: boolean;
14
14
  };
15
15
  export type ReploScriptEntry = {
16
- 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";
17
21
  identifier: string;
18
22
  requiredConsent?: ConsentCategory[];
19
23
  } | {
@@ -28,6 +32,19 @@ export type ReploScriptEntry = {
28
32
  requiredConsent: ConsentCategory[];
29
33
  src?: string;
30
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
+ };
31
48
  };
32
49
  export type ConsentAction = "accept" | "reject" | "update" | "withdraw";
33
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,5 +1,5 @@
1
1
  import { getParamSegment, getRouteParams, hasRouteParam, matchSource } from '../../../chunk-VPEVERWE.mjs';
2
- import { parseUrl } from '../../../chunk-2GKD6VTQ.mjs';
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-7GWIUERW.mjs';
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';
@@ -131,6 +131,12 @@ export declare const websiteBuilderToCanopyMethodConfig: {
131
131
  }, z.core.$strip>;
132
132
  timeoutMs: number;
133
133
  };
134
+ navigateToRoute: {
135
+ inputSchema: z.ZodObject<{
136
+ pathname: z.ZodString;
137
+ }, z.core.$strip>;
138
+ outputSchema: z.ZodVoid;
139
+ };
134
140
  setDisplayMode: {
135
141
  inputSchema: z.ZodObject<{
136
142
  displayMode: z.ZodEnum<{
@@ -1,4 +1,4 @@
1
- import { selectModeFormatCommandSchema, selectModeOptimisticUpdatePayloadSchema, selectModeSelectionTypeSchema, displayModeSchema, selectModeTiptapActiveMarksSchema, selectModeBoundingRectSchema, selectableDataSchema, selectModeSelectionRectSchema, selectModeClickPositionSchema, selectedElementSchema } from '../../chunk-7GWIUERW.mjs';
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';
@@ -21,6 +21,11 @@ var websiteBuilderToCanopyMethodConfig = {
21
21
  outputSchema: selectedElementSchema,
22
22
  timeoutMs: 1500
23
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
+ },
24
29
  setDisplayMode: {
25
30
  inputSchema: z.object({ displayMode: displayModeSchema }),
26
31
  outputSchema: z.void()
@@ -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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@replohq/canopy-sdk",
3
- "version": "3.0.1",
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
- "publishConfig": {
215
- "registry": "https://registry.npmjs.org/",
216
- "access": "public"
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"