@replohq/canopy-sdk 3.0.5 → 3.0.7
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/crypto.d.ts +8 -0
- package/_vendor/replo-utils/lib/errors.d.ts +1 -0
- package/_vendor/replo-utils/lib/fonts.d.ts +12 -1
- package/_vendor/replo-utils/lib/fonts.mjs +61 -12
- package/_vendor/replo-utils/lib/geometry.mjs +0 -2
- package/_vendor/replo-utils/lib/json.d.ts +0 -4
- package/_vendor/replo-utils/lib/json.mjs +1 -4
- package/_vendor/replo-utils/lib/misc.d.ts +4 -0
- package/_vendor/replo-utils/lib/misc.mjs +2 -4
- package/_vendor/replo-utils/lib/posthogReplay.mjs +0 -2
- package/_vendor/replo-utils/lib/string.d.ts +0 -12
- package/_vendor/replo-utils/lib/url.d.ts +10 -3
- package/_vendor/replo-utils/lib/url.mjs +3 -4
- package/_vendor/replo-utils/react/use-iframe-rpc-channel.mjs +0 -1
- package/_vendor/schemas/agentBillingFeatureType.d.ts +1 -0
- package/_vendor/schemas/comments.d.ts +932 -0
- package/_vendor/schemas/designLibrary.d.ts +24 -1
- package/_vendor/schemas/designLibrary.mjs +76 -70
- package/_vendor/schemas/errors.d.ts +50 -45
- package/_vendor/schemas/generated/comments.d.ts +244 -0
- package/_vendor/schemas/generated/consent.d.ts +43 -2
- package/_vendor/schemas/generated/errors.d.ts +1 -0
- package/_vendor/schemas/generated/selectMode.d.ts +52 -1
- package/_vendor/schemas/generated/selectModeIframeRpc.d.ts +64 -8
- package/_vendor/schemas/iframeRpcChannel.d.ts +13 -1
- package/_vendor/schemas/iframeRpcChannel.mjs +202 -19
- package/_vendor/schemas/loaderKeys.mjs +2 -4
- package/_vendor/schemas/{money.d.ts → moneyFormat.d.ts} +11 -9
- package/_vendor/schemas/moneyFormat.mjs +119 -0
- package/_vendor/schemas/pageAnnotations.d.ts +1 -1
- package/_vendor/schemas/pageAnnotations.mjs +1 -2
- package/_vendor/schemas/reploError.d.ts +43 -0
- package/_vendor/schemas/routing/match.mjs +0 -1
- package/_vendor/schemas/routing/rules.d.ts +2 -2
- package/_vendor/schemas/routing/rules.mjs +5 -8
- package/_vendor/schemas/savedStyles.d.ts +1 -1
- package/_vendor/schemas/selectMode.d.ts +272 -4
- package/_vendor/schemas/selectMode.mjs +4 -6
- package/_vendor/schemas/selectModeIframeRpc.d.ts +802 -111
- package/_vendor/schemas/selectModeIframeRpc.mjs +142 -47
- package/chunk-B7XDEXPL.mjs +19 -0
- package/chunk-CJIK4NVP.mjs +547 -0
- package/chunk-DINTPZM2.mjs +71 -0
- package/{chunk-AKZNN7F2.mjs → chunk-IQCJXNJU.mjs} +1 -1
- package/{chunk-H36NDYLG.mjs → chunk-PQEA6P4V.mjs} +40 -3
- package/{chunk-3A2F6BOM.mjs → chunk-YGLYUC6R.mjs} +21 -8
- package/editor/select-mode/iframeRpcChannel.d.ts +4 -4
- package/lib/tombstone.js +2 -2
- package/money.d.ts +1 -1
- package/orders/order-status-schema.d.ts +3 -3
- package/package.json +2 -2
- package/_vendor/replo-utils/lib/object.d.ts +0 -31
- package/_vendor/schemas/money.mjs +0 -1937
- package/chunk-544ZM65A.mjs +0 -203
- package/chunk-HGXQNZW7.mjs +0 -38
- package/chunk-ILGEM42C.mjs +0 -21
- package/chunk-QPGBIWJK.mjs +0 -195
- package/chunk-UJCSKKID.mjs +0 -23
- /package/{chunk-FNTGY7I5.mjs → chunk-JELVREEB.mjs} +0 -0
|
@@ -9,12 +9,16 @@ function buildUrlSearchParams(values) {
|
|
|
9
9
|
for (const item of value) {
|
|
10
10
|
urlSearchParams.append(key, item);
|
|
11
11
|
}
|
|
12
|
-
} else if (value !== void 0) {
|
|
12
|
+
} else if (value !== void 0 && value !== null) {
|
|
13
13
|
urlSearchParams.set(key, String(value));
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
return urlSearchParams;
|
|
17
17
|
}
|
|
18
|
+
function pathWithSearchParams(path, values) {
|
|
19
|
+
const search = buildUrlSearchParams(values).toString();
|
|
20
|
+
return search.length > 0 ? `${path}?${search}` : path;
|
|
21
|
+
}
|
|
18
22
|
function isValidHttpUrl(url, options = {}) {
|
|
19
23
|
const validUrl = normalizeUrlIncludingProtocolRelative(url);
|
|
20
24
|
if (!validUrl) {
|
|
@@ -45,12 +49,12 @@ function matchesAllowedHostname({
|
|
|
45
49
|
});
|
|
46
50
|
}
|
|
47
51
|
function isBlockedHostname(hostname) {
|
|
48
|
-
const normalized = hostname.toLowerCase();
|
|
49
|
-
if (normalized === "localhost" || normalized.endsWith(".localhost")) {
|
|
52
|
+
const normalized = hostname.toLowerCase().replace(/\.$/, "");
|
|
53
|
+
if (normalized === "localhost" || normalized.endsWith(".localhost") || normalized.endsWith(".internal")) {
|
|
50
54
|
return true;
|
|
51
55
|
}
|
|
52
|
-
if (
|
|
53
|
-
return
|
|
56
|
+
if (normalized.startsWith("[")) {
|
|
57
|
+
return !isGlobalUnicastIpv6(normalized.slice(1, -1));
|
|
54
58
|
}
|
|
55
59
|
const ipv4Match = /^(\d{1,3})\.(\d{1,3})/.exec(normalized);
|
|
56
60
|
if (ipv4Match) {
|
|
@@ -59,10 +63,17 @@ function isBlockedHostname(hostname) {
|
|
|
59
63
|
if (Number.isNaN(first) || Number.isNaN(second)) {
|
|
60
64
|
return true;
|
|
61
65
|
}
|
|
62
|
-
return first === 0 || first === 127 || first === 10 || first === 172 && second >= 16 && second <= 31 || first === 192 && second === 168 || first === 169 && second === 254;
|
|
66
|
+
return first === 0 || first === 127 || first === 10 || first === 172 && second >= 16 && second <= 31 || first === 192 && second === 168 || first === 169 && second === 254 || first === 100 && second >= 64 && second <= 127 || first >= 224;
|
|
63
67
|
}
|
|
64
68
|
return false;
|
|
65
69
|
}
|
|
70
|
+
function isGlobalUnicastIpv6(address) {
|
|
71
|
+
const [first = 0, second = 0] = address.split(":").slice(0, 2).map((hextet) => Number.parseInt(hextet || "0", 16));
|
|
72
|
+
if (!(first >= 8192 && first <= 16383) || first === 8194) {
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
return !(first === 8193 && second === 0);
|
|
76
|
+
}
|
|
66
77
|
function normalizeUrlIncludingProtocolRelative(url) {
|
|
67
78
|
let validUrl;
|
|
68
79
|
try {
|
|
@@ -172,7 +183,9 @@ function sanitizePublicHttpUrl(value, { preserveProtocol = false } = {}) {
|
|
|
172
183
|
if (!host.includes(".") || host === "localhost" || host.endsWith(".") || host.endsWith(".localhost") || host.endsWith(".local") || host.endsWith(".internal") || host.endsWith(".lan") || /^\d{1,3}(\.\d{1,3}){3}$/u.test(host) || host.startsWith("[")) {
|
|
173
184
|
return null;
|
|
174
185
|
}
|
|
175
|
-
if (!preserveProtocol)
|
|
186
|
+
if (!preserveProtocol) {
|
|
187
|
+
url.protocol = "https:";
|
|
188
|
+
}
|
|
176
189
|
url.hash = "";
|
|
177
190
|
return url.toString();
|
|
178
191
|
}
|
|
@@ -189,4 +202,4 @@ function safeHost(url) {
|
|
|
189
202
|
}
|
|
190
203
|
}
|
|
191
204
|
|
|
192
|
-
export { buildUrlSearchParams, fileExtensionFromUrl, isPreviewInternalHostname, isPreviewOrigin, isPublicHttpsUrl, isValidHttpUrl, isValidRoutePath, normalizeCustomDomain, normalizeUrlIncludingProtocolRelative, normalizeUrlScheme, parseUrl, safeHost, sanitizePublicHttpUrl, truncateDomain };
|
|
205
|
+
export { buildUrlSearchParams, fileExtensionFromUrl, isPreviewInternalHostname, isPreviewOrigin, isPublicHttpsUrl, isValidHttpUrl, isValidRoutePath, normalizeCustomDomain, normalizeUrlIncludingProtocolRelative, normalizeUrlScheme, parseUrl, pathWithSearchParams, safeHost, sanitizePublicHttpUrl, truncateDomain };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { SelectedElement } from "../../_vendor/schemas/generated/selectMode";
|
|
2
2
|
import type { IframeRpcChannel, IframeRpcChannelInputHandlers, IframeRpcChannelRemote } from "../../_vendor/schemas/iframeRpcChannel";
|
|
3
|
-
import type {
|
|
4
|
-
export type WebsiteBuilderRpcRemote = IframeRpcChannelRemote<typeof
|
|
5
|
-
type SelectModeParentMessagingHandlers = Omit<IframeRpcChannelInputHandlers<typeof
|
|
3
|
+
import type { previewIframeToWebsiteBuilderMethodConfig, websiteBuilderToPreviewIframeMethodConfig } from "../../_vendor/schemas/selectModeIframeRpc";
|
|
4
|
+
export type WebsiteBuilderRpcRemote = IframeRpcChannelRemote<typeof previewIframeToWebsiteBuilderMethodConfig>;
|
|
5
|
+
type SelectModeParentMessagingHandlers = Omit<IframeRpcChannelInputHandlers<typeof websiteBuilderToPreviewIframeMethodConfig>, "symbolicateSelectedElement">;
|
|
6
6
|
/** @deprecated Mount SandboxRuntime from @replohq/sandbox-runtime instead. */
|
|
7
|
-
export declare function getSelectModeIframeRpcChannel(): IframeRpcChannel<typeof
|
|
7
|
+
export declare function getSelectModeIframeRpcChannel(): IframeRpcChannel<typeof previewIframeToWebsiteBuilderMethodConfig> | null;
|
|
8
8
|
/** @deprecated Mount SandboxRuntime from @replohq/sandbox-runtime instead. */
|
|
9
9
|
export declare function setSelectModeParentHandlers(_nextHandlers: SelectModeParentMessagingHandlers | null): void;
|
|
10
10
|
/** @deprecated Mount SandboxRuntime from @replohq/sandbox-runtime instead. */
|
package/lib/tombstone.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const migrationCommand = `pnpm add
|
|
2
|
-
(if package.json lists "@replohq/canopy-sdk" instead of the "canopy-sdk" alias, run: pnpm remove
|
|
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)`;
|
|
3
3
|
const providerComposition = `import { ReploProvider } from "@replohq/sdk/providers/replo-provider";
|
|
4
4
|
import { SandboxRuntime } from "@replohq/sandbox-runtime";
|
|
5
5
|
|
package/money.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { formatAmount as replacementFormatAmount, fromMajorUnitsToMinorUnits as replacementFromMajorUnitsToMinorUnits, fromMinorUnitsToMajorUnits as replacementFromMinorUnitsToMajorUnits, fromMinorUnitsToMajorUnitsString as replacementFromMinorUnitsToMajorUnitsString } from "./_vendor/schemas/
|
|
1
|
+
import type { formatAmount as replacementFormatAmount, fromMajorUnitsToMinorUnits as replacementFromMajorUnitsToMinorUnits, fromMinorUnitsToMajorUnits as replacementFromMinorUnitsToMajorUnits, fromMinorUnitsToMajorUnitsString as replacementFromMinorUnitsToMajorUnitsString } from "./_vendor/schemas/moneyFormat";
|
|
2
2
|
/** @deprecated Use fromMajorUnitsToMinorUnits from @replohq/sdk/money. */
|
|
3
3
|
export declare function fromMajorUnitsToMinorUnits(_money: Parameters<typeof replacementFromMajorUnitsToMinorUnits>[0]): ReturnType<typeof replacementFromMajorUnitsToMinorUnits>;
|
|
4
4
|
/** @deprecated Use fromMinorUnitsToMajorUnits from @replohq/sdk/money. */
|
|
@@ -22,8 +22,8 @@ declare const orderStatusShipmentSchemaDefinition: z.ZodObject<{
|
|
|
22
22
|
shippedAt: z.ZodString;
|
|
23
23
|
}, z.core.$strip>;
|
|
24
24
|
declare const orderFinancialStatusSchemaDefinition: z.ZodEnum<{
|
|
25
|
-
failed: "failed";
|
|
26
25
|
pending: "pending";
|
|
26
|
+
failed: "failed";
|
|
27
27
|
paid: "paid";
|
|
28
28
|
refunded: "refunded";
|
|
29
29
|
partiallyRefunded: "partiallyRefunded";
|
|
@@ -33,8 +33,8 @@ declare const orderStatusSummarySchemaDefinition: z.ZodObject<{
|
|
|
33
33
|
orderNumber: z.ZodString;
|
|
34
34
|
placedAt: z.ZodString;
|
|
35
35
|
financialStatus: z.ZodEnum<{
|
|
36
|
-
failed: "failed";
|
|
37
36
|
pending: "pending";
|
|
37
|
+
failed: "failed";
|
|
38
38
|
paid: "paid";
|
|
39
39
|
refunded: "refunded";
|
|
40
40
|
partiallyRefunded: "partiallyRefunded";
|
|
@@ -94,8 +94,8 @@ declare const orderStatusResultSchemaDefinition: z.ZodDiscriminatedUnion<[z.ZodO
|
|
|
94
94
|
orderNumber: z.ZodString;
|
|
95
95
|
placedAt: z.ZodString;
|
|
96
96
|
financialStatus: z.ZodEnum<{
|
|
97
|
-
failed: "failed";
|
|
98
97
|
pending: "pending";
|
|
98
|
+
failed: "failed";
|
|
99
99
|
paid: "paid";
|
|
100
100
|
refunded: "refunded";
|
|
101
101
|
partiallyRefunded: "partiallyRefunded";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@replohq/canopy-sdk",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.7",
|
|
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,
|
|
@@ -221,6 +221,6 @@
|
|
|
221
221
|
"access": "public"
|
|
222
222
|
},
|
|
223
223
|
"engines": {
|
|
224
|
-
"node": "22.x"
|
|
224
|
+
"node": "22.x || >=26.13.1 <27"
|
|
225
225
|
}
|
|
226
226
|
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { dequal as dequalLite } from "dequal/lite";
|
|
2
|
-
interface ForEachPrimitiveValueArgs {
|
|
3
|
-
target: Record<string, any> | unknown[] | null;
|
|
4
|
-
fn: (value: unknown, key: string, newTarget: Record<string, any>) => void;
|
|
5
|
-
valueConversionFunction?: (transformValue: Record<string, any> | unknown[]) => Record<string, any> | unknown[];
|
|
6
|
-
}
|
|
7
|
-
/** There's probably a bug somewhere here since it assumes target is initially an object */
|
|
8
|
-
export declare function forEachPrimitiveValue({ target, fn, valueConversionFunction, }: ForEachPrimitiveValueArgs): void;
|
|
9
|
-
export declare function shallowEqual(objA: unknown, objB: unknown): boolean;
|
|
10
|
-
/**
|
|
11
|
-
* Internally we use `dequal` for deep equality checks. It benchmarks faster
|
|
12
|
-
* than lodash and most other libraries.
|
|
13
|
-
*
|
|
14
|
-
* This function is an alias for `dequal`'s "lite" module. It does not check
|
|
15
|
-
* equality for `Map` or `Set` values. If you need to compare those, use
|
|
16
|
-
* `deepEqualHeavy`.
|
|
17
|
-
*
|
|
18
|
-
* @see https://github.com/lukeed/dequal#modes
|
|
19
|
-
*/
|
|
20
|
-
export declare const deepEqual: typeof dequalLite;
|
|
21
|
-
/**
|
|
22
|
-
* Creates a new object with specified keys omitted.
|
|
23
|
-
*
|
|
24
|
-
* @param obj - The source object
|
|
25
|
-
* @param keysToOmit - Array of keys to omit from the result
|
|
26
|
-
* @returns A new object without the specified keys
|
|
27
|
-
*/
|
|
28
|
-
export declare function omit<ObjectType extends Record<string, any>, KeyType extends keyof ObjectType>(obj: ObjectType, keysToOmit: KeyType[]): Omit<ObjectType, KeyType>;
|
|
29
|
-
export declare function filterUndefined<ObjectType extends Record<string, unknown>>(data: ObjectType): Partial<ObjectType>;
|
|
30
|
-
export declare function toNullableIfDefined<ValueType>(value: ValueType | undefined): ValueType | null | undefined;
|
|
31
|
-
export {};
|