@replohq/canopy-sdk 0.8.3 → 0.9.0

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.
@@ -10,8 +10,6 @@ export declare function isNotNullish<ValueType>(value: ValueType): value is Excl
10
10
  * Checks if a value is either `null` or `undefined`.
11
11
  */
12
12
  export declare function isNullish(value: unknown): value is null | undefined;
13
- export declare function isRecord(value: unknown): value is Record<string, unknown>;
14
- export declare function stringValue(value: unknown): string | null;
15
13
  export declare function getFromRecordOrNull<RecordKey extends PropertyKey, RecordValue>(record: Record<RecordKey, RecordValue> | null | undefined, key: RecordKey | undefined | null): NonNullable<Record<RecordKey, RecordValue>[RecordKey]> | null;
16
14
  export declare function isPrimitive(value: unknown): value is string | number | boolean;
17
15
  type StructureRecord<UnionType extends {
@@ -1,2 +1,2 @@
1
- export { coerceNumberToString, deepCloneAndMergeReplacingArrays, errorMessage, exhaustiveSwitch, formatFileSize, getFromRecordOrNull, hasOwnProperty, invariant, isEmpty, isFunction_default as isFunction, isNotNullish, isNullish, isPrimitive, isRecord, mergeReplacingArrays, mergeReplacingObjects, noop, preventDefault, sleep, stringValue, warning } from '../../../chunk-MSIQX4QA.mjs';
1
+ export { coerceNumberToString, deepCloneAndMergeReplacingArrays, errorMessage, exhaustiveSwitch, formatFileSize, getFromRecordOrNull, hasOwnProperty, invariant, isEmpty, isFunction_default as isFunction, isNotNullish, isNullish, isPrimitive, mergeReplacingArrays, mergeReplacingObjects, noop, preventDefault, sleep, warning } from '../../../chunk-LALXJRJ6.mjs';
2
2
  export { isNumber_default as isNumber, isString_default as isString } from '../../../chunk-GV5FY7ZZ.mjs';
@@ -176,6 +176,12 @@ export declare const fullCollectionSchema: z.ZodObject<{
176
176
  width: z.ZodNullable<z.ZodNumber>;
177
177
  height: z.ZodNullable<z.ZodNumber>;
178
178
  }, z.core.$strip>>;
179
+ metafields: z.ZodOptional<z.ZodArray<z.ZodObject<{
180
+ key: z.ZodString;
181
+ namespace: z.ZodString;
182
+ type: z.ZodString;
183
+ value: z.ZodString;
184
+ }, z.core.$strip>>>;
179
185
  }, z.core.$strip>;
180
186
  export declare const paginatedProductsSchema: z.ZodObject<{
181
187
  products: z.ZodArray<z.ZodObject<{
@@ -1,4 +1,4 @@
1
- import { priceSchema, metafieldSchema, imageSchema, selectedOptionSchema, mediaSchema, productOptionSchema, productSchema } from '../../../../../chunk-5E25PJUK.mjs';
1
+ import { priceSchema, metafieldSchema, imageSchema, selectedOptionSchema, mediaSchema, productOptionSchema, productSchema } from '../../../../../chunk-AG47B4AR.mjs';
2
2
  import { sellingPlanGroupSchema } from '../../../../../chunk-4TZVNC3W.mjs';
3
3
  import { z } from 'zod';
4
4
 
@@ -37,7 +37,8 @@ var fullCollectionSchema = z.object({
37
37
  handle: z.string(),
38
38
  title: z.string(),
39
39
  descriptionHtml: z.string().nullable(),
40
- image: imageSchema.nullable()
40
+ image: imageSchema.nullable(),
41
+ metafields: z.array(metafieldSchema).optional()
41
42
  });
42
43
  var paginatedProductsSchema = z.object({
43
44
  products: z.array(productSchema),
@@ -1,4 +1,4 @@
1
- import { MapCache_default, exhaustiveSwitch, hasOwnProperty, identity_default, baseFor_default, keys_default, Stack_default, isLength_default, isIndex_default, isArguments_default, getTag_default, isBuffer_default, isTypedArray_default, eq_default, Uint8Array_default, getAllKeys_default, baseAssignValue_default } from '../../chunk-MSIQX4QA.mjs';
1
+ import { MapCache_default, exhaustiveSwitch, hasOwnProperty, identity_default, baseFor_default, keys_default, Stack_default, isLength_default, isIndex_default, isArguments_default, getTag_default, isBuffer_default, isTypedArray_default, eq_default, Uint8Array_default, getAllKeys_default, baseAssignValue_default } from '../../chunk-LALXJRJ6.mjs';
2
2
  import { Symbol_default, isArray_default, isObject_default, isObjectLike_default, baseGetTag_default } from '../../chunk-GV5FY7ZZ.mjs';
3
3
  import { z, ZodError } from 'zod';
4
4
 
@@ -1,2 +1,2 @@
1
- export { assetSchema, collectionSchema, customerIoBroadcastSchema, customerIoCampaignSchema, customerIoSegmentSchema, externalVideoSchema, getObjectTypeDefinition, imageSchema, integrationSchema, intelligemsExperienceSchema, levantaAffiliateLinkSchema, levantaProductSchema, looxReviewSchema, mediaImageSchema, mediaSchema, metafieldSchema, okendoReviewSchema, optionValueSchema, optionValueSwatchSchema, opusClipSchema, opusCollectionSchema, opusProjectSchema, pageSchema, planSchema, previewImageSchema, priceSchema, productOptionSchema, productSchema, registryItemSchema, segmentSourceSchema, selectedOptionSchema, transformReploProductToCanonical, variantSchema, videoSchema, videoSourceSchema, vwoCampaignSchema } from '../../chunk-5E25PJUK.mjs';
1
+ export { assetSchema, collectionSchema, customerIoBroadcastSchema, customerIoCampaignSchema, customerIoSegmentSchema, externalVideoSchema, getObjectTypeDefinition, imageSchema, integrationSchema, intelligemsExperienceSchema, levantaAffiliateLinkSchema, levantaProductSchema, looxReviewSchema, mediaImageSchema, mediaSchema, metafieldSchema, okendoReviewSchema, optionValueSchema, optionValueSwatchSchema, opusClipSchema, opusCollectionSchema, opusProjectSchema, pageSchema, planSchema, previewImageSchema, priceSchema, productOptionSchema, productSchema, registryItemSchema, segmentSourceSchema, selectedOptionSchema, transformReploProductToCanonical, variantSchema, videoSchema, videoSourceSchema, vwoCampaignSchema } from '../../chunk-AG47B4AR.mjs';
2
2
  import '../../chunk-4TZVNC3W.mjs';
@@ -49,6 +49,8 @@ export declare const pageRegistryItemMetadataSchema: z.ZodObject<{
49
49
  brandName: z.ZodOptional<z.ZodString>;
50
50
  brandDomain: z.ZodOptional<z.ZodString>;
51
51
  logoUrl: z.ZodOptional<z.ZodURL>;
52
+ keyFeatures: z.ZodOptional<z.ZodArray<z.ZodString>>;
53
+ sectionsIncluded: z.ZodOptional<z.ZodArray<z.ZodString>>;
52
54
  }, z.core.$strict>;
53
55
  export declare const sectionRegistryItemMetadataSchema: z.ZodObject<{
54
56
  brandName: z.ZodOptional<z.ZodString>;
@@ -64,6 +66,7 @@ export declare const brandingRegistryItemMetadataSchema: z.ZodObject<{
64
66
  export declare const skillRegistryItemMetadataSchema: z.ZodObject<{
65
67
  command: z.ZodOptional<z.ZodString>;
66
68
  tagline: z.ZodOptional<z.ZodString>;
69
+ preinstall: z.ZodOptional<z.ZodLiteral<"true">>;
67
70
  }, z.core.$strict>;
68
71
  export declare const productRegistryItemMetadataSchema: z.ZodObject<{
69
72
  provider: z.ZodString;
@@ -99,6 +102,8 @@ export declare const genericRegistryItemMetadataSchema: z.ZodUnion<readonly [z.Z
99
102
  brandName: z.ZodOptional<z.ZodString>;
100
103
  brandDomain: z.ZodOptional<z.ZodString>;
101
104
  logoUrl: z.ZodOptional<z.ZodURL>;
105
+ keyFeatures: z.ZodOptional<z.ZodArray<z.ZodString>>;
106
+ sectionsIncluded: z.ZodOptional<z.ZodArray<z.ZodString>>;
102
107
  }, z.core.$strict>, z.ZodObject<{
103
108
  brandName: z.ZodOptional<z.ZodString>;
104
109
  brandDomain: z.ZodOptional<z.ZodString>;
@@ -106,6 +111,7 @@ export declare const genericRegistryItemMetadataSchema: z.ZodUnion<readonly [z.Z
106
111
  }, z.core.$strict>, z.ZodObject<{
107
112
  command: z.ZodOptional<z.ZodString>;
108
113
  tagline: z.ZodOptional<z.ZodString>;
114
+ preinstall: z.ZodOptional<z.ZodLiteral<"true">>;
109
115
  }, z.core.$strict>, z.ZodObject<{
110
116
  palette: z.ZodOptional<z.ZodArray<z.ZodString>>;
111
117
  logoUrl: z.ZodOptional<z.ZodURL>;
@@ -158,6 +164,8 @@ export declare const registryItemMetadataSchema: z.ZodObject<{
158
164
  brandName: z.ZodOptional<z.ZodString>;
159
165
  brandDomain: z.ZodOptional<z.ZodString>;
160
166
  logoUrl: z.ZodOptional<z.ZodURL>;
167
+ keyFeatures: z.ZodOptional<z.ZodArray<z.ZodString>>;
168
+ sectionsIncluded: z.ZodOptional<z.ZodArray<z.ZodString>>;
161
169
  }, z.core.$strict>, z.ZodObject<{
162
170
  brandName: z.ZodOptional<z.ZodString>;
163
171
  brandDomain: z.ZodOptional<z.ZodString>;
@@ -165,6 +173,7 @@ export declare const registryItemMetadataSchema: z.ZodObject<{
165
173
  }, z.core.$strict>, z.ZodObject<{
166
174
  command: z.ZodOptional<z.ZodString>;
167
175
  tagline: z.ZodOptional<z.ZodString>;
176
+ preinstall: z.ZodOptional<z.ZodLiteral<"true">>;
168
177
  }, z.core.$strict>, z.ZodObject<{
169
178
  palette: z.ZodOptional<z.ZodArray<z.ZodString>>;
170
179
  logoUrl: z.ZodOptional<z.ZodURL>;
@@ -231,6 +240,8 @@ export declare const registryListItemsResultSchema: z.ZodObject<{
231
240
  brandName: z.ZodOptional<z.ZodString>;
232
241
  brandDomain: z.ZodOptional<z.ZodString>;
233
242
  logoUrl: z.ZodOptional<z.ZodURL>;
243
+ keyFeatures: z.ZodOptional<z.ZodArray<z.ZodString>>;
244
+ sectionsIncluded: z.ZodOptional<z.ZodArray<z.ZodString>>;
234
245
  }, z.core.$strict>, z.ZodObject<{
235
246
  brandName: z.ZodOptional<z.ZodString>;
236
247
  brandDomain: z.ZodOptional<z.ZodString>;
@@ -238,6 +249,7 @@ export declare const registryListItemsResultSchema: z.ZodObject<{
238
249
  }, z.core.$strict>, z.ZodObject<{
239
250
  command: z.ZodOptional<z.ZodString>;
240
251
  tagline: z.ZodOptional<z.ZodString>;
252
+ preinstall: z.ZodOptional<z.ZodLiteral<"true">>;
241
253
  }, z.core.$strict>, z.ZodObject<{
242
254
  palette: z.ZodOptional<z.ZodArray<z.ZodString>>;
243
255
  logoUrl: z.ZodOptional<z.ZodURL>;
@@ -311,6 +323,8 @@ export declare const registryItemDetailSchema: z.ZodObject<{
311
323
  brandName: z.ZodOptional<z.ZodString>;
312
324
  brandDomain: z.ZodOptional<z.ZodString>;
313
325
  logoUrl: z.ZodOptional<z.ZodURL>;
326
+ keyFeatures: z.ZodOptional<z.ZodArray<z.ZodString>>;
327
+ sectionsIncluded: z.ZodOptional<z.ZodArray<z.ZodString>>;
314
328
  }, z.core.$strict>, z.ZodObject<{
315
329
  brandName: z.ZodOptional<z.ZodString>;
316
330
  brandDomain: z.ZodOptional<z.ZodString>;
@@ -318,6 +332,7 @@ export declare const registryItemDetailSchema: z.ZodObject<{
318
332
  }, z.core.$strict>, z.ZodObject<{
319
333
  command: z.ZodOptional<z.ZodString>;
320
334
  tagline: z.ZodOptional<z.ZodString>;
335
+ preinstall: z.ZodOptional<z.ZodLiteral<"true">>;
321
336
  }, z.core.$strict>, z.ZodObject<{
322
337
  palette: z.ZodOptional<z.ZodArray<z.ZodString>>;
323
338
  logoUrl: z.ZodOptional<z.ZodURL>;
@@ -385,6 +400,8 @@ export declare const registryItemPreviewResultSchema: z.ZodObject<{
385
400
  brandName: z.ZodOptional<z.ZodString>;
386
401
  brandDomain: z.ZodOptional<z.ZodString>;
387
402
  logoUrl: z.ZodOptional<z.ZodURL>;
403
+ keyFeatures: z.ZodOptional<z.ZodArray<z.ZodString>>;
404
+ sectionsIncluded: z.ZodOptional<z.ZodArray<z.ZodString>>;
388
405
  }, z.core.$strict>, z.ZodObject<{
389
406
  brandName: z.ZodOptional<z.ZodString>;
390
407
  brandDomain: z.ZodOptional<z.ZodString>;
@@ -392,6 +409,7 @@ export declare const registryItemPreviewResultSchema: z.ZodObject<{
392
409
  }, z.core.$strict>, z.ZodObject<{
393
410
  command: z.ZodOptional<z.ZodString>;
394
411
  tagline: z.ZodOptional<z.ZodString>;
412
+ preinstall: z.ZodOptional<z.ZodLiteral<"true">>;
395
413
  }, z.core.$strict>, z.ZodObject<{
396
414
  palette: z.ZodOptional<z.ZodArray<z.ZodString>>;
397
415
  logoUrl: z.ZodOptional<z.ZodURL>;
@@ -1,5 +1,5 @@
1
1
  import { parseJsonOrNull } from '../../chunk-VKO7P3ED.mjs';
2
- import { exhaustiveSwitch } from '../../chunk-MSIQX4QA.mjs';
2
+ import { exhaustiveSwitch } from '../../chunk-LALXJRJ6.mjs';
3
3
  import '../../chunk-GV5FY7ZZ.mjs';
4
4
  import { z } from 'zod';
5
5
 
@@ -27,7 +27,10 @@ var siteRegistryItemMetadataSchema = visualDisplayMetadataSchema.extend({
27
27
  liveUrl: z.url().optional(),
28
28
  pages: z.array(siteTemplatePageSchema).optional()
29
29
  }).describe("SiteRegistryItemMetadata");
30
- var pageRegistryItemMetadataSchema = visualDisplayMetadataSchema.describe("PageRegistryItemMetadata");
30
+ var pageRegistryItemMetadataSchema = visualDisplayMetadataSchema.extend({
31
+ keyFeatures: z.array(z.string().min(1).max(80)).max(6).optional(),
32
+ sectionsIncluded: z.array(z.string().min(1).max(80)).max(12).optional()
33
+ }).describe("PageRegistryItemMetadata");
31
34
  var sectionRegistryItemMetadataSchema = visualDisplayMetadataSchema.describe("SectionRegistryItemMetadata");
32
35
  var brandingRegistryItemMetadataSchema = z.object({
33
36
  palette: z.array(z.string()).max(8).optional(),
@@ -37,7 +40,11 @@ var brandingRegistryItemMetadataSchema = z.object({
37
40
  }).strict().describe("BrandingRegistryItemMetadata");
38
41
  var skillRegistryItemMetadataSchema = z.object({
39
42
  command: z.string().optional(),
40
- tagline: z.string().optional()
43
+ tagline: z.string().optional(),
44
+ // (Ezra, 2026-07-09, REPL-29107): marks a catalog skill that bedrock-api
45
+ // preinstalls into every user's workspace skills. String-valued because
46
+ // catalog metadata is a string record end to end.
47
+ preinstall: z.literal("true").optional()
41
48
  }).strict().describe("SkillRegistryItemMetadata");
42
49
  var productRegistryItemMetadataSchema = z.object({
43
50
  provider: z.string(),
@@ -1408,12 +1408,6 @@ function isNotNullish(value) {
1408
1408
  function isNullish(value) {
1409
1409
  return value == null;
1410
1410
  }
1411
- function isRecord(value) {
1412
- return value !== null && typeof value === "object" && !Array.isArray(value);
1413
- }
1414
- function stringValue(value) {
1415
- return typeof value === "string" && value.length > 0 ? value : null;
1416
- }
1417
1411
  function getFromRecordOrNull(record, key) {
1418
1412
  return key ? record?.[key] ?? null : null;
1419
1413
  }
@@ -1517,4 +1511,4 @@ function errorMessage(error) {
1517
1511
  return String(error);
1518
1512
  }
1519
1513
 
1520
- export { MapCache_default, Stack_default, Uint8Array_default, baseAssignValue_default, baseFor_default, coerceNumberToString, deepCloneAndMergeReplacingArrays, eq_default, errorMessage, exhaustiveSwitch, formatFileSize, getAllKeys_default, getFromRecordOrNull, getTag_default, hasOwnProperty12 as hasOwnProperty, identity_default, invariant, isArguments_default, isBuffer_default, isEmpty2 as isEmpty, isFunction_default, isIndex_default, isLength_default, isNotNullish, isNullish, isPrimitive, isRecord, isTypedArray_default, keys_default, mergeReplacingArrays, mergeReplacingObjects, noop, preventDefault, sleep, stringValue, warning };
1514
+ export { MapCache_default, Stack_default, Uint8Array_default, baseAssignValue_default, baseFor_default, coerceNumberToString, deepCloneAndMergeReplacingArrays, eq_default, errorMessage, exhaustiveSwitch, formatFileSize, getAllKeys_default, getFromRecordOrNull, getTag_default, hasOwnProperty12 as hasOwnProperty, identity_default, invariant, isArguments_default, isBuffer_default, isEmpty2 as isEmpty, isFunction_default, isIndex_default, isLength_default, isNotNullish, isNullish, isPrimitive, isTypedArray_default, keys_default, mergeReplacingArrays, mergeReplacingObjects, noop, preventDefault, sleep, warning };
@@ -38,6 +38,10 @@ function initPostHogRelay() {
38
38
  api_host: POSTHOG_API_HOST,
39
39
  persistence: "localStorage",
40
40
  autocapture: false,
41
+ // (Noah, 2026-07-14, REPL-29305): Disable performance capture — its PerformanceObserver
42
+ // relays a non-cloneable PerformanceServerTiming across the iframe boundary via postMessage,
43
+ // throwing a DataCloneError in the preview. Matches the bedrock-sdk relay.
44
+ capture_performance: false,
41
45
  capture_pageview: false,
42
46
  session_recording: {
43
47
  recordCrossOriginIframes: true,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../editor/posthog-relay.tsx"],
4
- "sourcesContent": ["\"use client\";\n\n/**\n * PostHog Cross-Origin Iframe Relay\n *\n * Initializes PostHog inside the sandbox iframe as a \"relay\" - it captures DOM\n * mutations via rrweb and sends them to the parent window's PostHog instance\n * via postMessage, enabling session recordings to include iframe content.\n */\nimport { useEffect } from \"react\";\n\nconst POSTHOG_API_KEY = \"phc_dRETsj85vNkKrvQQszEFRBibH5kUF9l7rbjACuKPanZ\";\nconst POSTHOG_API_HOST = \"https://d99bbtllqsaif.cloudfront.net\";\n\ninterface PostHog {\n init: (apiKey: string, config: Record<string, unknown>) => void;\n}\n\ndeclare global {\n interface Window {\n posthog?: PostHog;\n }\n}\n\nlet initPromise: Promise<void> | null = null;\n\nfunction loadPostHogScript() {\n return new Promise<void>((resolve) => {\n if (window.posthog) {\n resolve();\n return;\n }\n\n const script = document.createElement(\"script\");\n script.src = `${POSTHOG_API_HOST}/static/array.js`;\n script.async = true;\n script.addEventListener(\"load\", () => resolve());\n script.addEventListener(\"error\", () => {\n resolve();\n console.warn(\"[PostHog Relay] Failed to load PostHog script\");\n });\n document.head.append(script);\n });\n}\n\nfunction initPostHogRelay() {\n if (window.self === window.top) {\n return Promise.resolve();\n }\n\n if (initPromise) {\n return initPromise;\n }\n\n initPromise = (async () => {\n await loadPostHogScript();\n\n if (!window.posthog) {\n initPromise = null;\n console.warn(\"[PostHog Relay] PostHog not available after script load\");\n return;\n }\n\n window.posthog.init(POSTHOG_API_KEY, {\n api_host: POSTHOG_API_HOST,\n persistence: \"localStorage\",\n autocapture: false,\n capture_pageview: false,\n session_recording: {\n recordCrossOriginIframes: true,\n // NOTE (Nick, 2026-02-02, REPL-23284): Disable canvas recording to prevent SecurityError on tainted canvases\n captureCanvas: { recordCanvas: false },\n },\n });\n })();\n\n return initPromise;\n}\n\nexport default function PostHogRelay() {\n // eslint-disable-next-line replo/no-use-effect -- Legacy effect - may or may not be necessary\n useEffect(() => {\n void initPostHogRelay();\n }, []);\n\n return null;\n}\n"],
5
- "mappings": ";AASA,SAAS,iBAAiB;AAE1B,MAAM,kBAAkB;AACxB,MAAM,mBAAmB;AAYzB,IAAI,cAAoC;AAExC,SAAS,oBAAoB;AAC3B,SAAO,IAAI,QAAc,CAAC,YAAY;AACpC,QAAI,OAAO,SAAS;AAClB,cAAQ;AACR;AAAA,IACF;AAEA,UAAM,SAAS,SAAS,cAAc,QAAQ;AAC9C,WAAO,MAAM,GAAG,gBAAgB;AAChC,WAAO,QAAQ;AACf,WAAO,iBAAiB,QAAQ,MAAM,QAAQ,CAAC;AAC/C,WAAO,iBAAiB,SAAS,MAAM;AACrC,cAAQ;AACR,cAAQ,KAAK,+CAA+C;AAAA,IAC9D,CAAC;AACD,aAAS,KAAK,OAAO,MAAM;AAAA,EAC7B,CAAC;AACH;AAEA,SAAS,mBAAmB;AAC1B,MAAI,OAAO,SAAS,OAAO,KAAK;AAC9B,WAAO,QAAQ,QAAQ;AAAA,EACzB;AAEA,MAAI,aAAa;AACf,WAAO;AAAA,EACT;AAEA,iBAAe,YAAY;AACzB,UAAM,kBAAkB;AAExB,QAAI,CAAC,OAAO,SAAS;AACnB,oBAAc;AACd,cAAQ,KAAK,yDAAyD;AACtE;AAAA,IACF;AAEA,WAAO,QAAQ,KAAK,iBAAiB;AAAA,MACnC,UAAU;AAAA,MACV,aAAa;AAAA,MACb,aAAa;AAAA,MACb,kBAAkB;AAAA,MAClB,mBAAmB;AAAA,QACjB,0BAA0B;AAAA;AAAA,QAE1B,eAAe,EAAE,cAAc,MAAM;AAAA,MACvC;AAAA,IACF,CAAC;AAAA,EACH,GAAG;AAEH,SAAO;AACT;AAEe,SAAR,eAAgC;AAErC,YAAU,MAAM;AACd,SAAK,iBAAiB;AAAA,EACxB,GAAG,CAAC,CAAC;AAEL,SAAO;AACT;",
4
+ "sourcesContent": ["\"use client\";\n\n/**\n * PostHog Cross-Origin Iframe Relay\n *\n * Initializes PostHog inside the sandbox iframe as a \"relay\" - it captures DOM\n * mutations via rrweb and sends them to the parent window's PostHog instance\n * via postMessage, enabling session recordings to include iframe content.\n */\nimport { useEffect } from \"react\";\n\nconst POSTHOG_API_KEY = \"phc_dRETsj85vNkKrvQQszEFRBibH5kUF9l7rbjACuKPanZ\";\nconst POSTHOG_API_HOST = \"https://d99bbtllqsaif.cloudfront.net\";\n\ninterface PostHog {\n init: (apiKey: string, config: Record<string, unknown>) => void;\n}\n\ndeclare global {\n interface Window {\n posthog?: PostHog;\n }\n}\n\nlet initPromise: Promise<void> | null = null;\n\nfunction loadPostHogScript() {\n return new Promise<void>((resolve) => {\n if (window.posthog) {\n resolve();\n return;\n }\n\n const script = document.createElement(\"script\");\n script.src = `${POSTHOG_API_HOST}/static/array.js`;\n script.async = true;\n script.addEventListener(\"load\", () => resolve());\n script.addEventListener(\"error\", () => {\n resolve();\n console.warn(\"[PostHog Relay] Failed to load PostHog script\");\n });\n document.head.append(script);\n });\n}\n\nfunction initPostHogRelay() {\n if (window.self === window.top) {\n return Promise.resolve();\n }\n\n if (initPromise) {\n return initPromise;\n }\n\n initPromise = (async () => {\n await loadPostHogScript();\n\n if (!window.posthog) {\n initPromise = null;\n console.warn(\"[PostHog Relay] PostHog not available after script load\");\n return;\n }\n\n window.posthog.init(POSTHOG_API_KEY, {\n api_host: POSTHOG_API_HOST,\n persistence: \"localStorage\",\n autocapture: false,\n // (Noah, 2026-07-14, REPL-29305): Disable performance capture \u2014 its PerformanceObserver\n // relays a non-cloneable PerformanceServerTiming across the iframe boundary via postMessage,\n // throwing a DataCloneError in the preview. Matches the bedrock-sdk relay.\n capture_performance: false,\n capture_pageview: false,\n session_recording: {\n recordCrossOriginIframes: true,\n // NOTE (Nick, 2026-02-02, REPL-23284): Disable canvas recording to prevent SecurityError on tainted canvases\n captureCanvas: { recordCanvas: false },\n },\n });\n })();\n\n return initPromise;\n}\n\nexport default function PostHogRelay() {\n // eslint-disable-next-line replo/no-use-effect -- Legacy effect - may or may not be necessary\n useEffect(() => {\n void initPostHogRelay();\n }, []);\n\n return null;\n}\n"],
5
+ "mappings": ";AASA,SAAS,iBAAiB;AAE1B,MAAM,kBAAkB;AACxB,MAAM,mBAAmB;AAYzB,IAAI,cAAoC;AAExC,SAAS,oBAAoB;AAC3B,SAAO,IAAI,QAAc,CAAC,YAAY;AACpC,QAAI,OAAO,SAAS;AAClB,cAAQ;AACR;AAAA,IACF;AAEA,UAAM,SAAS,SAAS,cAAc,QAAQ;AAC9C,WAAO,MAAM,GAAG,gBAAgB;AAChC,WAAO,QAAQ;AACf,WAAO,iBAAiB,QAAQ,MAAM,QAAQ,CAAC;AAC/C,WAAO,iBAAiB,SAAS,MAAM;AACrC,cAAQ;AACR,cAAQ,KAAK,+CAA+C;AAAA,IAC9D,CAAC;AACD,aAAS,KAAK,OAAO,MAAM;AAAA,EAC7B,CAAC;AACH;AAEA,SAAS,mBAAmB;AAC1B,MAAI,OAAO,SAAS,OAAO,KAAK;AAC9B,WAAO,QAAQ,QAAQ;AAAA,EACzB;AAEA,MAAI,aAAa;AACf,WAAO;AAAA,EACT;AAEA,iBAAe,YAAY;AACzB,UAAM,kBAAkB;AAExB,QAAI,CAAC,OAAO,SAAS;AACnB,oBAAc;AACd,cAAQ,KAAK,yDAAyD;AACtE;AAAA,IACF;AAEA,WAAO,QAAQ,KAAK,iBAAiB;AAAA,MACnC,UAAU;AAAA,MACV,aAAa;AAAA,MACb,aAAa;AAAA;AAAA;AAAA;AAAA,MAIb,qBAAqB;AAAA,MACrB,kBAAkB;AAAA,MAClB,mBAAmB;AAAA,QACjB,0BAA0B;AAAA;AAAA,QAE1B,eAAe,EAAE,cAAc,MAAM;AAAA,MACvC;AAAA,IACF,CAAC;AAAA,EACH,GAAG;AAEH,SAAO;AACT;AAEe,SAAR,eAAgC;AAErC,YAAU,MAAM;AACd,SAAK,iBAAiB;AAAA,EACxB,GAAG,CAAC,CAAC;AAEL,SAAO;AACT;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,21 @@
1
+ export type MetafieldIdentifier = {
2
+ namespace: string;
3
+ key: string;
4
+ };
5
+ export type ProductLoaderArgs = {
6
+ handle?: string;
7
+ productId?: string;
8
+ productMetafieldIdentifiers?: MetafieldIdentifier[];
9
+ variantMetafieldIdentifiers?: MetafieldIdentifier[];
10
+ };
11
+ /**
12
+ * Builds the single object used as BOTH the React Query key and the loader
13
+ * payload. They must stay identical: `PrefetchedLoaders` seeds the cache under
14
+ * `[loaderKey, args]`, so an arg sent to the loader but missing from the key
15
+ * (or vice versa) silently misses the prefetch — the client refetches without
16
+ * it and the page renders incomplete data instead of erroring.
17
+ *
18
+ * Keys left `undefined` drop out of React Query's key hash, so omitting a field
19
+ * here hashes the same as a prefetch that never passed it.
20
+ */
21
+ export declare function buildProductLoaderArgs({ handle, productId, productMetafieldIdentifiers, variantMetafieldIdentifiers, }: ProductLoaderArgs): ProductLoaderArgs;
@@ -0,0 +1,17 @@
1
+ function buildProductLoaderArgs({
2
+ handle,
3
+ productId,
4
+ productMetafieldIdentifiers,
5
+ variantMetafieldIdentifiers
6
+ }) {
7
+ return {
8
+ handle,
9
+ productId,
10
+ productMetafieldIdentifiers,
11
+ variantMetafieldIdentifiers
12
+ };
13
+ }
14
+ export {
15
+ buildProductLoaderArgs
16
+ };
17
+ //# sourceMappingURL=product-loader-args.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../loaders/product-loader-args.ts"],
4
+ "sourcesContent": ["export type MetafieldIdentifier = {\n namespace: string;\n key: string;\n};\n\nexport type ProductLoaderArgs = {\n handle?: string;\n productId?: string;\n productMetafieldIdentifiers?: MetafieldIdentifier[];\n variantMetafieldIdentifiers?: MetafieldIdentifier[];\n};\n\n/**\n * Builds the single object used as BOTH the React Query key and the loader\n * payload. They must stay identical: `PrefetchedLoaders` seeds the cache under\n * `[loaderKey, args]`, so an arg sent to the loader but missing from the key\n * (or vice versa) silently misses the prefetch \u2014 the client refetches without\n * it and the page renders incomplete data instead of erroring.\n *\n * Keys left `undefined` drop out of React Query's key hash, so omitting a field\n * here hashes the same as a prefetch that never passed it.\n */\nexport function buildProductLoaderArgs({\n handle,\n productId,\n productMetafieldIdentifiers,\n variantMetafieldIdentifiers,\n}: ProductLoaderArgs): ProductLoaderArgs {\n return {\n handle,\n productId,\n productMetafieldIdentifiers,\n variantMetafieldIdentifiers,\n };\n}\n"],
5
+ "mappings": "AAsBO,SAAS,uBAAuB;AAAA,EACrC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAyC;AACvC,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;",
6
+ "names": []
7
+ }
@@ -1,11 +1,10 @@
1
1
  import type { ReactNode } from "react";
2
2
  import type { FullProduct } from "../_vendor/schemas/agentTools/customIntegrations/loaders/product";
3
- type ProductLoaderProps = {
3
+ import type { ProductLoaderArgs } from "./product-loader-args";
4
+ type ProductLoaderProps = ProductLoaderArgs & {
4
5
  loaderKey: string;
5
- handle?: string;
6
- productId?: string;
7
6
  children: (data: FullProduct) => ReactNode;
8
7
  fallback?: ReactNode;
9
8
  };
10
- export declare function ProductLoader({ loaderKey, handle, productId, children, fallback, }: ProductLoaderProps): import("react/jsx-runtime").JSX.Element;
9
+ export declare function ProductLoader({ loaderKey, handle, productId, productMetafieldIdentifiers, variantMetafieldIdentifiers, children, fallback, }: ProductLoaderProps): import("react/jsx-runtime").JSX.Element;
11
10
  export {};
@@ -5,19 +5,16 @@ import { useSuspenseQuery } from "@tanstack/react-query";
5
5
  import { fullProductSchema } from "../_vendor/schemas/agentTools/customIntegrations/loaders/product.mjs";
6
6
  import { invokeLoader } from "./invoke-loader";
7
7
  import { LoaderErrorBoundary } from "./loader-error-boundary";
8
+ import { buildProductLoaderArgs } from "./product-loader-args";
8
9
  function ProductLoaderInner({
9
10
  loaderKey,
10
- handle,
11
- productId,
11
+ args,
12
12
  children
13
13
  }) {
14
14
  const queryResult = useSuspenseQuery({
15
- queryKey: [loaderKey, { handle, productId }],
15
+ queryKey: [loaderKey, args],
16
16
  queryFn: async () => {
17
- const loadedData = await invokeLoader({
18
- loaderKey,
19
- args: { handle, productId }
20
- });
17
+ const loadedData = await invokeLoader({ loaderKey, args });
21
18
  return fullProductSchema.parse(loadedData);
22
19
  }
23
20
  });
@@ -27,23 +24,23 @@ function ProductLoader({
27
24
  loaderKey,
28
25
  handle,
29
26
  productId,
27
+ productMetafieldIdentifiers,
28
+ variantMetafieldIdentifiers,
30
29
  children,
31
30
  fallback
32
31
  }) {
32
+ const args = buildProductLoaderArgs({
33
+ handle,
34
+ productId,
35
+ productMetafieldIdentifiers,
36
+ variantMetafieldIdentifiers
37
+ });
33
38
  return /* @__PURE__ */ jsx(
34
39
  LoaderErrorBoundary,
35
40
  {
36
41
  fallback: fallback ?? null,
37
- resetKey: `${loaderKey}:${handle ?? ""}:${productId ?? ""}`,
38
- children: /* @__PURE__ */ jsx(Suspense, { fallback: fallback ?? null, children: /* @__PURE__ */ jsx(
39
- ProductLoaderInner,
40
- {
41
- loaderKey,
42
- handle,
43
- productId,
44
- children
45
- }
46
- ) })
42
+ resetKey: `${loaderKey}:${JSON.stringify(args)}`,
43
+ children: /* @__PURE__ */ jsx(Suspense, { fallback: fallback ?? null, children: /* @__PURE__ */ jsx(ProductLoaderInner, { loaderKey, args, children }) })
47
44
  }
48
45
  );
49
46
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../loaders/product-loader.tsx"],
4
- "sourcesContent": ["\"use client\";\n\nimport type { ReactNode } from \"react\";\nimport type { FullProduct } from \"schemas/agentTools/customIntegrations/loaders/product\";\n\nimport { Suspense } from \"react\";\n\nimport { useSuspenseQuery } from \"@tanstack/react-query\";\nimport { fullProductSchema } from \"schemas/agentTools/customIntegrations/loaders/product\";\n\nimport { invokeLoader } from \"./invoke-loader\";\nimport { LoaderErrorBoundary } from \"./loader-error-boundary\";\n\ntype ProductLoaderProps = {\n loaderKey: string;\n handle?: string;\n productId?: string;\n children: (data: FullProduct) => ReactNode;\n fallback?: ReactNode;\n};\n\nfunction ProductLoaderInner({\n loaderKey,\n handle,\n productId,\n children,\n}: Omit<ProductLoaderProps, \"fallback\">) {\n const queryResult = useSuspenseQuery({\n queryKey: [loaderKey, { handle, productId }],\n queryFn: async () => {\n const loadedData = await invokeLoader({\n loaderKey,\n args: { handle, productId },\n });\n return fullProductSchema.parse(loadedData);\n },\n });\n\n return <>{children(queryResult.data)}</>;\n}\n\nexport function ProductLoader({\n loaderKey,\n handle,\n productId,\n children,\n fallback,\n}: ProductLoaderProps) {\n return (\n <LoaderErrorBoundary\n fallback={fallback ?? null}\n resetKey={`${loaderKey}:${handle ?? \"\"}:${productId ?? \"\"}`}\n >\n <Suspense fallback={fallback ?? null}>\n <ProductLoaderInner\n loaderKey={loaderKey}\n handle={handle}\n productId={productId}\n >\n {children}\n </ProductLoaderInner>\n </Suspense>\n </LoaderErrorBoundary>\n );\n}\n"],
5
- "mappings": ";AAsCS;AAjCT,SAAS,gBAAgB;AAEzB,SAAS,wBAAwB;AACjC,SAAS,yBAAyB;AAElC,SAAS,oBAAoB;AAC7B,SAAS,2BAA2B;AAUpC,SAAS,mBAAmB;AAAA,EAC1B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAyC;AACvC,QAAM,cAAc,iBAAiB;AAAA,IACnC,UAAU,CAAC,WAAW,EAAE,QAAQ,UAAU,CAAC;AAAA,IAC3C,SAAS,YAAY;AACnB,YAAM,aAAa,MAAM,aAAa;AAAA,QACpC;AAAA,QACA,MAAM,EAAE,QAAQ,UAAU;AAAA,MAC5B,CAAC;AACD,aAAO,kBAAkB,MAAM,UAAU;AAAA,IAC3C;AAAA,EACF,CAAC;AAED,SAAO,gCAAG,mBAAS,YAAY,IAAI,GAAE;AACvC;AAEO,SAAS,cAAc;AAAA,EAC5B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAuB;AACrB,SACE;AAAA,IAAC;AAAA;AAAA,MACC,UAAU,YAAY;AAAA,MACtB,UAAU,GAAG,SAAS,IAAI,UAAU,EAAE,IAAI,aAAa,EAAE;AAAA,MAEzD,8BAAC,YAAS,UAAU,YAAY,MAC9B;AAAA,QAAC;AAAA;AAAA,UACC;AAAA,UACA;AAAA,UACA;AAAA,UAEC;AAAA;AAAA,MACH,GACF;AAAA;AAAA,EACF;AAEJ;",
4
+ "sourcesContent": ["\"use client\";\n\nimport type { ReactNode } from \"react\";\nimport type { FullProduct } from \"schemas/agentTools/customIntegrations/loaders/product\";\nimport type { ProductLoaderArgs } from \"./product-loader-args\";\n\nimport { Suspense } from \"react\";\n\nimport { useSuspenseQuery } from \"@tanstack/react-query\";\nimport { fullProductSchema } from \"schemas/agentTools/customIntegrations/loaders/product\";\n\nimport { invokeLoader } from \"./invoke-loader\";\nimport { LoaderErrorBoundary } from \"./loader-error-boundary\";\nimport { buildProductLoaderArgs } from \"./product-loader-args\";\n\ntype ProductLoaderProps = ProductLoaderArgs & {\n loaderKey: string;\n children: (data: FullProduct) => ReactNode;\n fallback?: ReactNode;\n};\n\nfunction ProductLoaderInner({\n loaderKey,\n args,\n children,\n}: {\n loaderKey: string;\n args: ProductLoaderArgs;\n children: (data: FullProduct) => ReactNode;\n}) {\n const queryResult = useSuspenseQuery({\n queryKey: [loaderKey, args],\n queryFn: async () => {\n const loadedData = await invokeLoader({ loaderKey, args });\n return fullProductSchema.parse(loadedData);\n },\n });\n\n return <>{children(queryResult.data)}</>;\n}\n\nexport function ProductLoader({\n loaderKey,\n handle,\n productId,\n productMetafieldIdentifiers,\n variantMetafieldIdentifiers,\n children,\n fallback,\n}: ProductLoaderProps) {\n const args = buildProductLoaderArgs({\n handle,\n productId,\n productMetafieldIdentifiers,\n variantMetafieldIdentifiers,\n });\n\n return (\n <LoaderErrorBoundary\n fallback={fallback ?? null}\n resetKey={`${loaderKey}:${JSON.stringify(args)}`}\n >\n <Suspense fallback={fallback ?? null}>\n <ProductLoaderInner loaderKey={loaderKey} args={args}>\n {children}\n </ProductLoaderInner>\n </Suspense>\n </LoaderErrorBoundary>\n );\n}\n"],
5
+ "mappings": ";AAsCS;AAhCT,SAAS,gBAAgB;AAEzB,SAAS,wBAAwB;AACjC,SAAS,yBAAyB;AAElC,SAAS,oBAAoB;AAC7B,SAAS,2BAA2B;AACpC,SAAS,8BAA8B;AAQvC,SAAS,mBAAmB;AAAA,EAC1B;AAAA,EACA;AAAA,EACA;AACF,GAIG;AACD,QAAM,cAAc,iBAAiB;AAAA,IACnC,UAAU,CAAC,WAAW,IAAI;AAAA,IAC1B,SAAS,YAAY;AACnB,YAAM,aAAa,MAAM,aAAa,EAAE,WAAW,KAAK,CAAC;AACzD,aAAO,kBAAkB,MAAM,UAAU;AAAA,IAC3C;AAAA,EACF,CAAC;AAED,SAAO,gCAAG,mBAAS,YAAY,IAAI,GAAE;AACvC;AAEO,SAAS,cAAc;AAAA,EAC5B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAuB;AACrB,QAAM,OAAO,uBAAuB;AAAA,IAClC;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AAED,SACE;AAAA,IAAC;AAAA;AAAA,MACC,UAAU,YAAY;AAAA,MACtB,UAAU,GAAG,SAAS,IAAI,KAAK,UAAU,IAAI,CAAC;AAAA,MAE9C,8BAAC,YAAS,UAAU,YAAY,MAC9B,8BAAC,sBAAmB,WAAsB,MACvC,UACH,GACF;AAAA;AAAA,EACF;AAEJ;",
6
6
  "names": []
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@replohq/canopy-sdk",
3
- "version": "0.8.3",
3
+ "version": "0.9.0",
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,