@replohq/canopy-sdk 3.0.6 → 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.
Files changed (53) hide show
  1. package/_vendor/replo-utils/lib/crypto.d.ts +8 -0
  2. package/_vendor/replo-utils/lib/fonts.mjs +2 -3
  3. package/_vendor/replo-utils/lib/geometry.mjs +0 -2
  4. package/_vendor/replo-utils/lib/json.d.ts +0 -4
  5. package/_vendor/replo-utils/lib/json.mjs +1 -4
  6. package/_vendor/replo-utils/lib/misc.mjs +2 -4
  7. package/_vendor/replo-utils/lib/posthogReplay.mjs +0 -2
  8. package/_vendor/replo-utils/lib/string.d.ts +0 -12
  9. package/_vendor/replo-utils/lib/url.d.ts +10 -3
  10. package/_vendor/replo-utils/lib/url.mjs +3 -4
  11. package/_vendor/replo-utils/react/use-iframe-rpc-channel.mjs +0 -1
  12. package/_vendor/schemas/agentBillingFeatureType.d.ts +1 -0
  13. package/_vendor/schemas/comments.d.ts +932 -0
  14. package/_vendor/schemas/designLibrary.d.ts +1 -1
  15. package/_vendor/schemas/designLibrary.mjs +72 -73
  16. package/_vendor/schemas/errors.d.ts +36 -45
  17. package/_vendor/schemas/generated/comments.d.ts +244 -0
  18. package/_vendor/schemas/generated/consent.d.ts +43 -2
  19. package/_vendor/schemas/generated/errors.d.ts +1 -0
  20. package/_vendor/schemas/generated/selectMode.d.ts +3 -1
  21. package/_vendor/schemas/generated/selectModeIframeRpc.d.ts +43 -0
  22. package/_vendor/schemas/iframeRpcChannel.d.ts +13 -1
  23. package/_vendor/schemas/iframeRpcChannel.mjs +167 -8
  24. package/_vendor/schemas/loaderKeys.mjs +0 -2
  25. package/_vendor/schemas/{money.d.ts → moneyFormat.d.ts} +11 -9
  26. package/_vendor/schemas/moneyFormat.mjs +119 -0
  27. package/_vendor/schemas/pageAnnotations.d.ts +1 -1
  28. package/_vendor/schemas/pageAnnotations.mjs +1 -2
  29. package/_vendor/schemas/reploError.d.ts +43 -0
  30. package/_vendor/schemas/routing/match.mjs +0 -1
  31. package/_vendor/schemas/routing/rules.d.ts +2 -2
  32. package/_vendor/schemas/routing/rules.mjs +5 -8
  33. package/_vendor/schemas/savedStyles.d.ts +1 -1
  34. package/_vendor/schemas/selectMode.d.ts +117 -4
  35. package/_vendor/schemas/selectMode.mjs +4 -6
  36. package/_vendor/schemas/selectModeIframeRpc.d.ts +373 -1
  37. package/_vendor/schemas/selectModeIframeRpc.mjs +77 -9
  38. package/chunk-B7XDEXPL.mjs +19 -0
  39. package/chunk-CJIK4NVP.mjs +547 -0
  40. package/chunk-DINTPZM2.mjs +71 -0
  41. package/{chunk-AKZNN7F2.mjs → chunk-IQCJXNJU.mjs} +1 -1
  42. package/{chunk-EXI4VDHP.mjs → chunk-PQEA6P4V.mjs} +20 -3
  43. package/{chunk-DINXH6YP.mjs → chunk-YGLYUC6R.mjs} +18 -7
  44. package/money.d.ts +1 -1
  45. package/package.json +2 -2
  46. package/_vendor/replo-utils/lib/object.d.ts +0 -31
  47. package/_vendor/schemas/money.mjs +0 -1937
  48. package/chunk-HGXQNZW7.mjs +0 -38
  49. package/chunk-ILGEM42C.mjs +0 -21
  50. package/chunk-RLFL66ST.mjs +0 -242
  51. package/chunk-UJCSKKID.mjs +0 -23
  52. package/chunk-VUXOGD76.mjs +0 -206
  53. /package/{chunk-FNTGY7I5.mjs → chunk-JELVREEB.mjs} +0 -0
@@ -0,0 +1,71 @@
1
+ import { randomUUID, randomFillSync } from 'crypto';
2
+
3
+ var byteToHex = [];
4
+ for (let i = 0; i < 256; ++i) {
5
+ byteToHex.push((i + 256).toString(16).slice(1));
6
+ }
7
+ function unsafeStringify(arr, offset = 0) {
8
+ return (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase();
9
+ }
10
+ var rnds8Pool = new Uint8Array(256);
11
+ var poolPtr = rnds8Pool.length;
12
+ function rng() {
13
+ if (poolPtr > rnds8Pool.length - 16) {
14
+ randomFillSync(rnds8Pool);
15
+ poolPtr = 0;
16
+ }
17
+ return rnds8Pool.slice(poolPtr, poolPtr += 16);
18
+ }
19
+ var native_default = { randomUUID };
20
+
21
+ function v4(options, buf, offset) {
22
+ if (native_default.randomUUID && !buf && !options) {
23
+ return native_default.randomUUID();
24
+ }
25
+ options = options || {};
26
+ const rnds = options.random ?? options.rng?.() ?? rng();
27
+ if (rnds.length < 16) {
28
+ throw new Error("Random bytes length must be >= 16");
29
+ }
30
+ rnds[6] = rnds[6] & 15 | 64;
31
+ rnds[8] = rnds[8] & 63 | 128;
32
+ if (buf) {
33
+ offset = offset || 0;
34
+ if (offset < 0 || offset + 16 > buf.length) {
35
+ throw new RangeError(`UUID byte range ${offset}:${offset + 15} is out of buffer bounds`);
36
+ }
37
+ for (let i = 0; i < 16; ++i) {
38
+ buf[offset + i] = rnds[i];
39
+ }
40
+ return buf;
41
+ }
42
+ return unsafeStringify(rnds);
43
+ }
44
+ var v4_default = v4;
45
+
46
+ function randomUUID2() {
47
+ return v4_default();
48
+ }
49
+
50
+ var ReploError = class _ReploError extends Error {
51
+ config;
52
+ id;
53
+ constructor(config) {
54
+ super(config.message);
55
+ this.message = config.message ?? this.constructor.name;
56
+ this.config = config;
57
+ this.id = randomUUID2();
58
+ const cause = config.cause;
59
+ if (cause) {
60
+ this.cause = cause;
61
+ if (cause instanceof _ReploError) {
62
+ this.config.additionalData = {
63
+ ...this.config.additionalData,
64
+ ...cause.config.additionalData
65
+ };
66
+ }
67
+ }
68
+ }
69
+ };
70
+
71
+ export { ReploError, randomUUID2 as randomUUID };
@@ -1,4 +1,4 @@
1
- import { Symbol_default, isArray_default, isObjectLike_default, baseGetTag_default } from './chunk-FNTGY7I5.mjs';
1
+ import { Symbol_default, isArray_default, isObjectLike_default, baseGetTag_default } from './chunk-JELVREEB.mjs';
2
2
 
3
3
  function arrayMap(array, iteratee) {
4
4
  var index = -1, length = array == null ? 0 : array.length, result = Array(length);
@@ -1,5 +1,4 @@
1
- import { isObject_default } from './chunk-ILGEM42C.mjs';
2
- import { root_default, isObjectLike_default, freeGlobal_default, baseGetTag_default, Symbol_default, isArray_default } from './chunk-FNTGY7I5.mjs';
1
+ import { root_default, isObjectLike_default, freeGlobal_default, baseGetTag_default, Symbol_default, isArray_default } from './chunk-JELVREEB.mjs';
3
2
 
4
3
  function listCacheClear() {
5
4
  this.__data__ = [];
@@ -102,6 +101,12 @@ function stackHas(key) {
102
101
  }
103
102
  var stackHas_default = stackHas;
104
103
 
104
+ function isObject(value) {
105
+ var type = typeof value;
106
+ return value != null && (type == "object" || type == "function");
107
+ }
108
+ var isObject_default = isObject;
109
+
105
110
  var asyncTag = "[object AsyncFunction]";
106
111
  var funcTag = "[object Function]";
107
112
  var genTag = "[object GeneratorFunction]";
@@ -1033,6 +1038,18 @@ function isEmpty(value) {
1033
1038
  }
1034
1039
  var isEmpty_default = isEmpty;
1035
1040
 
1041
+ var numberTag4 = "[object Number]";
1042
+ function isNumber(value) {
1043
+ return typeof value == "number" || isObjectLike_default(value) && baseGetTag_default(value) == numberTag4;
1044
+ }
1045
+ var isNumber_default = isNumber;
1046
+
1047
+ var stringTag4 = "[object String]";
1048
+ function isString(value) {
1049
+ return typeof value == "string" || !isArray_default(value) && isObjectLike_default(value) && baseGetTag_default(value) == stringTag4;
1050
+ }
1051
+ var isString_default = isString;
1052
+
1036
1053
  function assignMergeValue(object, key, value) {
1037
1054
  if (value !== void 0 && !eq_default(object[key], value) || value === void 0 && !(key in object)) {
1038
1055
  baseAssignValue_default(object, key, value);
@@ -1410,4 +1427,4 @@ function errorMessage(error) {
1410
1427
  return String(error);
1411
1428
  }
1412
1429
 
1413
- export { coerceNumberToString, deepCloneAndMergeReplacingArrays, errorMessage, exhaustiveSwitch, formatFileSize, getFromRecordOrNull, hasOwnProperty12 as hasOwnProperty, invariant, isEmpty2 as isEmpty, isFunction_default, isNotNullish, isNullish, isPrimitive, mergeReplacingArrays, mergeReplacingObjects, noop, preventDefault, sleep, sleepWithSignal, warning };
1430
+ export { coerceNumberToString, deepCloneAndMergeReplacingArrays, errorMessage, exhaustiveSwitch, formatFileSize, getFromRecordOrNull, hasOwnProperty12 as hasOwnProperty, invariant, isEmpty2 as isEmpty, isFunction_default, isNotNullish, isNullish, isNumber_default, isPrimitive, isString_default, mergeReplacingArrays, mergeReplacingObjects, noop, preventDefault, sleep, sleepWithSignal, warning };
@@ -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 (/^(::1|fc[\da-f]{0,2}:|fd[\da-f]{0,2}:|fe80:)/.test(normalized) || normalized.startsWith("::ffff:")) {
53
- return true;
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 {
@@ -191,4 +202,4 @@ function safeHost(url) {
191
202
  }
192
203
  }
193
204
 
194
- 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 };
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/money";
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. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@replohq/canopy-sdk",
3
- "version": "3.0.6",
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 {};