@replohq/canopy-sdk 3.0.2 → 3.0.3
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 +12 -0
- package/_vendor/replo-utils/lib/url.mjs +1 -1
- package/_vendor/schemas/generated/consent.d.ts +19 -2
- package/_vendor/schemas/generated/selectMode.d.ts +1 -1
- 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 +6 -0
- package/_vendor/schemas/selectModeIframeRpc.mjs +6 -1
- package/analytics/analytics-provider.js +1 -1
- package/analytics/get-analytics-sinks.js +1 -1
- package/analytics/hooks/use-product-viewed-analytics.js +1 -1
- package/analytics/replo-first-party-pixel.js +1 -1
- package/analytics/replo-pixel-script.js +1 -1
- package/analytics/sinks/ga4-sink.js +1 -1
- package/analytics/sinks/meta-sink.js +1 -1
- package/analytics/sinks/pinterest-sink.js +1 -1
- package/analytics/sinks/reddit-sink.js +1 -1
- package/analytics/sinks/replo-sink.js +1 -1
- package/analytics/sinks/snapchat-sink.js +1 -1
- package/analytics/sinks/tiktok-sink.js +1 -1
- package/analytics/sinks/window-sink.js +1 -1
- package/analytics/utils/analytics-utils.js +1 -1
- package/analytics/utils/navigation-tracker.js +1 -1
- package/analytics/utils/shopify-funnel-gate.js +1 -1
- package/cart/buy-now-action.js +1 -1
- package/cart/cart-actions.js +1 -1
- package/cart/cart-loader.js +1 -1
- package/cart/cart-provider.js +1 -1
- package/cart/cart-schema.js +1 -1
- package/cart/cart-types.js +1 -1
- package/cart/gateways/cart-gateway.js +1 -1
- package/cart/gateways/cookie-cart-gateway.js +1 -1
- package/cart/gateways/default-cart-gateway.js +1 -1
- package/cart/gateways/resolver-cart-gateway.js +1 -1
- package/cart/gateways/stripe-cart-gateway.js +1 -1
- package/cart/hooks/use-add-to-cart.js +1 -1
- package/cart/hooks/use-buy-now.js +1 -1
- package/cart/utils/cart-utils.js +1 -1
- package/cart/utils/cookie-cart-persistence.js +1 -1
- package/cart/utils/variant-to-cart-line.js +1 -1
- package/{chunk-7GWIUERW.mjs → chunk-2BNHFQZH.mjs} +32 -22
- package/{chunk-2GKD6VTQ.mjs → chunk-IQVZY6EV.mjs} +40 -1
- package/consent/consent-action.js +1 -1
- package/consent/consent-actions.js +1 -1
- package/consent/consent-store.js +1 -1
- package/consent/cookie.js +1 -1
- package/consent/replo-scripts.js +1 -1
- package/consent/script-registration-store.js +1 -1
- package/consent/script-snippets.js +1 -1
- package/consent/window-api.js +1 -1
- package/editor/ClientErrorBoundary.js +1 -1
- package/editor/DocumentReadyBeacon.js +1 -1
- package/editor/LinkInterceptor.js +1 -1
- package/editor/NextErrorReporter.js +1 -1
- package/editor/annotations/AnnotationLayerMount.js +1 -1
- package/editor/annotations/annotationController.js +1 -1
- package/editor/annotations/bridgeGate.js +1 -1
- package/editor/design-library-preview/DesignLibraryPreview.js +1 -1
- package/editor/posthog-relay.js +1 -1
- package/editor/select-mode/EditorSelection.js +1 -1
- package/editor/select-mode/annotationFrames.js +1 -1
- package/editor/select-mode/descriptor/elementDescriptor.js +1 -1
- package/editor/select-mode/descriptor/styleExtraction.js +1 -1
- package/editor/select-mode/displayModeStore.js +1 -1
- package/editor/select-mode/fast-refresh-relay.js +1 -1
- package/editor/select-mode/fiber.js +1 -1
- package/editor/select-mode/hooks/useCrosshairCursor.js +1 -1
- package/editor/select-mode/hooks/useEditModeStateMachine.js +1 -1
- package/editor/select-mode/hooks/useOptimisticOverrides.js +1 -1
- package/editor/select-mode/hooks/useParentMessaging.js +1 -1
- package/editor/select-mode/hooks/useSelectModeController.js +1 -1
- package/editor/select-mode/hooks/useSelectionHover.js +1 -1
- package/editor/select-mode/hooks/useSelectionInteractions.js +1 -1
- package/editor/select-mode/hooks/useSelectionScrollSync.js +1 -1
- package/editor/select-mode/hooks/useSiblingResolution.js +1 -1
- package/editor/select-mode/iframeRpcChannel.js +1 -1
- package/editor/select-mode/inlineTextMarks.js +1 -1
- package/editor/select-mode/interactions/selectionGeometry.js +1 -1
- package/editor/select-mode/selectModeSession.js +1 -1
- package/editor/select-mode/selectionFrame.js +1 -1
- package/editor/select-mode/symbolicate.js +1 -1
- package/editor/select-mode/tiptapInlineEditor.js +1 -1
- package/env.js +1 -1
- package/gateways/canopy-api.js +1 -1
- package/hooks/use-client-value.js +1 -1
- package/hooks/use-formatted-price.js +1 -1
- package/lib/canopy-error.js +1 -1
- package/lib/get-query-client.js +1 -1
- package/lib/integration-utils.js +1 -1
- package/lib/shopify-utils.js +1 -1
- package/lib/url-utils.js +1 -1
- package/loaders/collection-loader.js +1 -1
- package/loaders/collection-products-loader.js +1 -1
- package/loaders/contentful-entries-loader.js +1 -1
- package/loaders/contentful-entry-loader.js +1 -1
- package/loaders/invoke-loader-action.js +1 -1
- package/loaders/invoke-loader-server.js +1 -1
- package/loaders/invoke-loader.js +1 -1
- package/loaders/levanta-product-loader.js +1 -1
- package/loaders/loader-error-boundary.js +1 -1
- package/loaders/loader-keys.js +1 -1
- package/loaders/loader-schemas.js +1 -1
- package/loaders/metaobject-loader.js +1 -1
- package/loaders/metaobjects-loader.js +1 -1
- package/loaders/okendo-review-aggregate-loader.js +1 -1
- package/loaders/okendo-reviews-loader.js +1 -1
- package/loaders/prefetch-loaders.js +1 -1
- package/loaders/preview-placeholder.js +1 -1
- package/loaders/product-loader-args.js +1 -1
- package/loaders/product-loader.js +1 -1
- package/loaders/rebuy-recommendations-loader.js +1 -1
- package/loaders/reviews-io-review-aggregate-loader.js +1 -1
- package/loaders/reviews-io-reviews-loader.js +1 -1
- package/loaders/smile-earning-rules-loader.js +1 -1
- package/loaders/smile-rewards-loader.js +1 -1
- package/loaders/smile-vip-tiers-loader.js +1 -1
- package/loaders/statsig-experiment-loader.js +1 -1
- package/loaders/vendor-loader-keys.js +1 -1
- package/loaders/yotpo-review-aggregate-loader.js +1 -1
- package/loaders/yotpo-reviews-loader.js +1 -1
- package/money.js +1 -1
- package/next/config.js +1 -1
- package/next/image-loader.js +1 -1
- package/next/open-next.js +1 -1
- package/orders/order-status-schema.js +1 -1
- package/orders/order-status.js +1 -1
- package/package.json +1 -1
- package/providers/query-provider.js +1 -1
- package/providers/replo-provider.js +1 -1
- package/routing/evaluate.js +1 -1
- package/routing/rules.js +1 -1
|
@@ -55,3 +55,15 @@ 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;
|
|
63
|
+
/**
|
|
64
|
+
* Registration inputs are attacker-typeable, and the pipeline fetches them
|
|
65
|
+
* server-side — so only plain public https(+http) origins pass: no
|
|
66
|
+
* credentials, no ports, no IP literals, no localhost/RFC-6762 style names.
|
|
67
|
+
*/
|
|
68
|
+
export declare function sanitizePublicHttpUrl(value: string | null): string | null;
|
|
69
|
+
export declare function safeHost(url: string): string | null;
|
|
@@ -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, safeHost, sanitizePublicHttpUrl, truncateDomain } from '../../../chunk-IQVZY6EV.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-
|
|
2
|
+
import { parseUrl } from '../../../chunk-IQVZY6EV.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';
|
|
@@ -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-
|
|
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()
|
package/cart/buy-now-action.js
CHANGED
package/cart/cart-actions.js
CHANGED
package/cart/cart-loader.js
CHANGED
package/cart/cart-provider.js
CHANGED
package/cart/cart-schema.js
CHANGED
package/cart/cart-types.js
CHANGED
package/cart/utils/cart-utils.js
CHANGED
|
@@ -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,44 @@ 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
|
+
}
|
|
155
|
+
function sanitizePublicHttpUrl(value) {
|
|
156
|
+
const trimmed = value?.trim();
|
|
157
|
+
if (!trimmed) {
|
|
158
|
+
return null;
|
|
159
|
+
}
|
|
160
|
+
const withScheme = /^[a-z][a-z0-9+.-]*:/iu.test(trimmed) ? trimmed : `https://${trimmed}`;
|
|
161
|
+
let url;
|
|
162
|
+
try {
|
|
163
|
+
url = new URL(withScheme);
|
|
164
|
+
} catch {
|
|
165
|
+
return null;
|
|
166
|
+
}
|
|
167
|
+
if (url.protocol !== "https:" && url.protocol !== "http:") {
|
|
168
|
+
return null;
|
|
169
|
+
}
|
|
170
|
+
if (url.username || url.password || url.port) {
|
|
171
|
+
return null;
|
|
172
|
+
}
|
|
173
|
+
const host = url.hostname.toLowerCase();
|
|
174
|
+
if (!host.includes(".") || host === "localhost" || host.endsWith(".local") || host.endsWith(".internal") || host.endsWith(".lan") || /^\d{1,3}(\.\d{1,3}){3}$/u.test(host) || host.startsWith("[")) {
|
|
175
|
+
return null;
|
|
176
|
+
}
|
|
177
|
+
url.protocol = "https:";
|
|
178
|
+
url.hash = "";
|
|
179
|
+
return url.toString();
|
|
180
|
+
}
|
|
181
|
+
function safeHost(url) {
|
|
182
|
+
try {
|
|
183
|
+
return new URL(url).hostname.toLowerCase();
|
|
184
|
+
} catch {
|
|
185
|
+
return null;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
149
188
|
|
|
150
|
-
export { buildUrlSearchParams, isPreviewInternalHostname, isPreviewOrigin, isValidHttpUrl, isValidRoutePath, normalizeCustomDomain, normalizeUrlIncludingProtocolRelative, normalizeUrlScheme, parseUrl, truncateDomain };
|
|
189
|
+
export { buildUrlSearchParams, fileExtensionFromUrl, isPreviewInternalHostname, isPreviewOrigin, isValidHttpUrl, isValidRoutePath, normalizeCustomDomain, normalizeUrlIncludingProtocolRelative, normalizeUrlScheme, parseUrl, safeHost, sanitizePublicHttpUrl, truncateDomain };
|
package/consent/consent-store.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { canopyTombstoneError, canopyTombstoneObject } from "../lib/tombstone";
|
|
2
|
+
import { canopyTombstoneError, canopyTombstoneObject } from "../lib/tombstone.js";
|
|
3
3
|
const consentStore = canopyTombstoneObject({
|
|
4
4
|
symbol: "consentStore",
|
|
5
5
|
subpath: "consent/consent-store"
|
package/consent/cookie.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { canopyTombstoneError, canopyTombstoneObject } from "../lib/tombstone";
|
|
1
|
+
import { canopyTombstoneError, canopyTombstoneObject } from "../lib/tombstone.js";
|
|
2
2
|
const CONSENT_COOKIE_NAME = "replo_consent";
|
|
3
3
|
const CONSENT_COOKIE_VERSION = 1;
|
|
4
4
|
const CONSENT_COOKIE_MAX_AGE_SECONDS = 60 * 60 * 24 * 180;
|
package/consent/replo-scripts.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { canopyTombstoneError, canopyTombstoneObject } from "../lib/tombstone";
|
|
2
|
+
import { canopyTombstoneError, canopyTombstoneObject } from "../lib/tombstone.js";
|
|
3
3
|
const scriptRegistrationStore = canopyTombstoneObject({
|
|
4
4
|
symbol: "scriptRegistrationStore",
|
|
5
5
|
subpath: "consent/script-registration-store",
|
package/consent/window-api.js
CHANGED