@replohq/canopy-sdk 0.3.0 → 0.4.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.
@@ -1,4 +1,4 @@
1
- import { priceSchema, metafieldSchema, imageSchema, selectedOptionSchema, mediaSchema, productOptionSchema, productSchema } from '../../../../../chunk-46YU2W6T.mjs';
1
+ import { priceSchema, metafieldSchema, imageSchema, selectedOptionSchema, mediaSchema, productOptionSchema, productSchema } from '../../../../../chunk-7WEM5FUJ.mjs';
2
2
  import { sellingPlanGroupSchema } from '../../../../../chunk-4TZVNC3W.mjs';
3
3
  import { z } from 'zod';
4
4
 
@@ -330,6 +330,8 @@ export declare const DESIGN_LIBRARY_PREVIEW_MESSAGE_TYPE = "replo:design-library
330
330
  export declare const designLibraryPreviewFontSchema: z.ZodObject<{
331
331
  family: z.ZodString;
332
332
  cssVar: z.ZodString;
333
+ faceUrl: z.ZodOptional<z.ZodString>;
334
+ format: z.ZodOptional<z.ZodString>;
333
335
  }, z.core.$strip>;
334
336
  export declare const designLibraryPreviewMessageSchema: z.ZodObject<{
335
337
  type: z.ZodLiteral<"replo:design-library:applyOverrides">;
@@ -337,6 +339,8 @@ export declare const designLibraryPreviewMessageSchema: z.ZodObject<{
337
339
  fonts: z.ZodArray<z.ZodObject<{
338
340
  family: z.ZodString;
339
341
  cssVar: z.ZodString;
342
+ faceUrl: z.ZodOptional<z.ZodString>;
343
+ format: z.ZodOptional<z.ZodString>;
340
344
  }, z.core.$strip>>;
341
345
  defaultFontCssVar: z.ZodNullable<z.ZodString>;
342
346
  }, z.core.$strip>;
@@ -102,7 +102,9 @@ var globalsCssSnapshotSchema = z.object({
102
102
  var DESIGN_LIBRARY_PREVIEW_MESSAGE_TYPE = "replo:design-library:applyOverrides";
103
103
  var designLibraryPreviewFontSchema = z.object({
104
104
  family: z.string(),
105
- cssVar: z.string()
105
+ cssVar: z.string(),
106
+ faceUrl: z.string().optional(),
107
+ format: z.string().optional()
106
108
  }).describe("DesignLibraryPreviewFont");
107
109
  var designLibraryPreviewMessageSchema = z.object({
108
110
  type: z.literal(DESIGN_LIBRARY_PREVIEW_MESSAGE_TYPE),
@@ -400,6 +400,29 @@ export declare const intelligemsExperienceSchema: z.ZodObject<{
400
400
  category: z.ZodOptional<z.ZodString>;
401
401
  status: z.ZodOptional<z.ZodString>;
402
402
  }, z.core.$strip>;
403
+ export declare const customerIoSegmentSchema: z.ZodObject<{
404
+ id: z.ZodString;
405
+ name: z.ZodOptional<z.ZodString>;
406
+ description: z.ZodOptional<z.ZodString>;
407
+ type: z.ZodOptional<z.ZodString>;
408
+ }, z.core.$strip>;
409
+ export declare const customerIoCampaignSchema: z.ZodObject<{
410
+ id: z.ZodString;
411
+ name: z.ZodOptional<z.ZodString>;
412
+ type: z.ZodOptional<z.ZodString>;
413
+ active: z.ZodOptional<z.ZodBoolean>;
414
+ }, z.core.$strip>;
415
+ export declare const customerIoBroadcastSchema: z.ZodObject<{
416
+ id: z.ZodString;
417
+ name: z.ZodOptional<z.ZodString>;
418
+ active: z.ZodOptional<z.ZodBoolean>;
419
+ }, z.core.$strip>;
420
+ export declare const vwoCampaignSchema: z.ZodObject<{
421
+ id: z.ZodString;
422
+ name: z.ZodOptional<z.ZodString>;
423
+ type: z.ZodOptional<z.ZodString>;
424
+ status: z.ZodOptional<z.ZodString>;
425
+ }, z.core.$strip>;
403
426
  export declare const okendoReviewSchema: z.ZodObject<{
404
427
  id: z.ZodString;
405
428
  title: z.ZodOptional<z.ZodString>;
@@ -410,6 +433,16 @@ export declare const okendoReviewSchema: z.ZodObject<{
410
433
  dateCreated: z.ZodOptional<z.ZodString>;
411
434
  status: z.ZodOptional<z.ZodString>;
412
435
  }, z.core.$strip>;
436
+ export declare const looxReviewSchema: z.ZodObject<{
437
+ id: z.ZodString;
438
+ title: z.ZodOptional<z.ZodString>;
439
+ body: z.ZodOptional<z.ZodString>;
440
+ rating: z.ZodOptional<z.ZodNumber>;
441
+ productName: z.ZodOptional<z.ZodString>;
442
+ reviewerName: z.ZodOptional<z.ZodString>;
443
+ dateCreated: z.ZodOptional<z.ZodString>;
444
+ status: z.ZodOptional<z.ZodString>;
445
+ }, z.core.$strip>;
413
446
  export declare const planSchema: z.ZodObject<{
414
447
  id: z.ZodString;
415
448
  name: z.ZodOptional<z.ZodString>;
@@ -800,6 +833,61 @@ declare const OBJECT_TYPE_REGISTRY: {
800
833
  }, z.core.$strip>;
801
834
  mentionable: true;
802
835
  };
836
+ customerIoSegment: {
837
+ type: string;
838
+ displayName: string;
839
+ identifiers: {
840
+ primaryId: string;
841
+ };
842
+ canonicalSchema: z.ZodObject<{
843
+ id: z.ZodString;
844
+ name: z.ZodOptional<z.ZodString>;
845
+ description: z.ZodOptional<z.ZodString>;
846
+ type: z.ZodOptional<z.ZodString>;
847
+ }, z.core.$strip>;
848
+ mentionable: true;
849
+ };
850
+ customerIoCampaign: {
851
+ type: string;
852
+ displayName: string;
853
+ identifiers: {
854
+ primaryId: string;
855
+ };
856
+ canonicalSchema: z.ZodObject<{
857
+ id: z.ZodString;
858
+ name: z.ZodOptional<z.ZodString>;
859
+ type: z.ZodOptional<z.ZodString>;
860
+ active: z.ZodOptional<z.ZodBoolean>;
861
+ }, z.core.$strip>;
862
+ mentionable: true;
863
+ };
864
+ customerIoBroadcast: {
865
+ type: string;
866
+ displayName: string;
867
+ identifiers: {
868
+ primaryId: string;
869
+ };
870
+ canonicalSchema: z.ZodObject<{
871
+ id: z.ZodString;
872
+ name: z.ZodOptional<z.ZodString>;
873
+ active: z.ZodOptional<z.ZodBoolean>;
874
+ }, z.core.$strip>;
875
+ mentionable: true;
876
+ };
877
+ vwoCampaign: {
878
+ type: string;
879
+ displayName: string;
880
+ identifiers: {
881
+ primaryId: string;
882
+ };
883
+ canonicalSchema: z.ZodObject<{
884
+ id: z.ZodString;
885
+ name: z.ZodOptional<z.ZodString>;
886
+ type: z.ZodOptional<z.ZodString>;
887
+ status: z.ZodOptional<z.ZodString>;
888
+ }, z.core.$strip>;
889
+ mentionable: true;
890
+ };
803
891
  levantaProduct: {
804
892
  type: string;
805
893
  displayName: string;
@@ -844,6 +932,24 @@ declare const OBJECT_TYPE_REGISTRY: {
844
932
  }, z.core.$strip>;
845
933
  mentionable: true;
846
934
  };
935
+ looxReview: {
936
+ type: string;
937
+ displayName: string;
938
+ identifiers: {
939
+ primaryId: string;
940
+ };
941
+ canonicalSchema: z.ZodObject<{
942
+ id: z.ZodString;
943
+ title: z.ZodOptional<z.ZodString>;
944
+ body: z.ZodOptional<z.ZodString>;
945
+ rating: z.ZodOptional<z.ZodNumber>;
946
+ productName: z.ZodOptional<z.ZodString>;
947
+ reviewerName: z.ZodOptional<z.ZodString>;
948
+ dateCreated: z.ZodOptional<z.ZodString>;
949
+ status: z.ZodOptional<z.ZodString>;
950
+ }, z.core.$strip>;
951
+ mentionable: true;
952
+ };
847
953
  plan: {
848
954
  type: string;
849
955
  displayName: string;
@@ -1,2 +1,2 @@
1
- export { assetSchema, collectionSchema, externalVideoSchema, getObjectTypeDefinition, imageSchema, integrationSchema, intelligemsExperienceSchema, levantaAffiliateLinkSchema, levantaProductSchema, mediaImageSchema, mediaSchema, metafieldSchema, okendoReviewSchema, optionValueSchema, optionValueSwatchSchema, opusClipSchema, opusCollectionSchema, opusProjectSchema, pageSchema, planSchema, previewImageSchema, priceSchema, productOptionSchema, productSchema, registryItemSchema, segmentSourceSchema, selectedOptionSchema, transformReploProductToCanonical, variantSchema, videoSchema, videoSourceSchema } from '../../chunk-46YU2W6T.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-7WEM5FUJ.mjs';
2
2
  import '../../chunk-4TZVNC3W.mjs';
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Resolves the Replo first-party pixel's config from the worker env and hands it
3
+ * to the consent-gated client injector. This lives inside `ReploProvider` (not
4
+ * the site's `app/layout.tsx`) so every agent site ships the implicit
5
+ * first-party pixel automatically — mirroring how `ReploSink` is an always-on
6
+ * sink that is never authored in the layout or editable in the miniapp.
7
+ *
8
+ * Renders nothing when the analytics pipeline isn't wired (e.g. lean local dev,
9
+ * where `REPLO_ANALYTICS_PIXEL_URL` / `ANALYTICS_FIRE_API_URL` are unset),
10
+ * mirroring the self-disabling consent action.
11
+ */
12
+ export declare function ReploFirstPartyPixel(): Promise<import("react/jsx-runtime").JSX.Element | null>;
@@ -0,0 +1,31 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { getEnv } from "../env";
3
+ import { ReploPixelScript } from "./replo-pixel-script";
4
+ async function ReploFirstPartyPixel() {
5
+ let pixelUrl;
6
+ let apiUrl;
7
+ let projectId;
8
+ try {
9
+ const env = await getEnv();
10
+ pixelUrl = env.REPLO_ANALYTICS_PIXEL_URL;
11
+ apiUrl = env.ANALYTICS_FIRE_API_URL;
12
+ projectId = env.PROJECT_ID;
13
+ } catch {
14
+ return null;
15
+ }
16
+ if (!pixelUrl || !apiUrl || !projectId) {
17
+ return null;
18
+ }
19
+ return /* @__PURE__ */ jsx(
20
+ ReploPixelScript,
21
+ {
22
+ pixelUrl,
23
+ apiUrl,
24
+ projectId
25
+ }
26
+ );
27
+ }
28
+ export {
29
+ ReploFirstPartyPixel
30
+ };
31
+ //# sourceMappingURL=replo-first-party-pixel.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../analytics/replo-first-party-pixel.tsx"],
4
+ "sourcesContent": ["import { getEnv } from \"../env\";\nimport { ReploPixelScript } from \"./replo-pixel-script\";\n\n/**\n * Resolves the Replo first-party pixel's config from the worker env and hands it\n * to the consent-gated client injector. This lives inside `ReploProvider` (not\n * the site's `app/layout.tsx`) so every agent site ships the implicit\n * first-party pixel automatically \u2014 mirroring how `ReploSink` is an always-on\n * sink that is never authored in the layout or editable in the miniapp.\n *\n * Renders nothing when the analytics pipeline isn't wired (e.g. lean local dev,\n * where `REPLO_ANALYTICS_PIXEL_URL` / `ANALYTICS_FIRE_API_URL` are unset),\n * mirroring the self-disabling consent action.\n */\nexport async function ReploFirstPartyPixel() {\n let pixelUrl: string | undefined;\n let apiUrl: string | undefined;\n let projectId: string | undefined;\n try {\n const env = await getEnv();\n pixelUrl = env.REPLO_ANALYTICS_PIXEL_URL;\n apiUrl = env.ANALYTICS_FIRE_API_URL;\n projectId = env.PROJECT_ID;\n } catch {\n // No Cloudflare env (e.g. running the site outside the worker): no pixel.\n return null;\n }\n\n if (!pixelUrl || !apiUrl || !projectId) {\n return null;\n }\n\n return (\n <ReploPixelScript\n pixelUrl={pixelUrl}\n apiUrl={apiUrl}\n projectId={projectId}\n />\n );\n}\n"],
5
+ "mappings": "AAiCI;AAjCJ,SAAS,cAAc;AACvB,SAAS,wBAAwB;AAajC,eAAsB,uBAAuB;AAC3C,MAAI;AACJ,MAAI;AACJ,MAAI;AACJ,MAAI;AACF,UAAM,MAAM,MAAM,OAAO;AACzB,eAAW,IAAI;AACf,aAAS,IAAI;AACb,gBAAY,IAAI;AAAA,EAClB,QAAQ;AAEN,WAAO;AAAA,EACT;AAEA,MAAI,CAAC,YAAY,CAAC,UAAU,CAAC,WAAW;AACtC,WAAO;AAAA,EACT;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA;AAAA,EACF;AAEJ;",
6
+ "names": []
7
+ }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Consent-gated injector for Replo's first-party analytics pixel. The loaded
3
+ * script sets `window.ReploPixel`, which the always-on `ReploSink` forwards
4
+ * events into, so gating it on `analytics` consent keeps the first-party sink
5
+ * consent-correct without the pixel loading unconditionally in `<head>` the way
6
+ * the legacy scaffold does. `analytics` consent here matches the
7
+ * `firstPartyAllowed` gate that controls whether `ReploSink` is created at all.
8
+ */
9
+ export declare function ReploPixelScript({ pixelUrl, apiUrl, projectId, }: {
10
+ pixelUrl: string;
11
+ apiUrl: string;
12
+ projectId: string;
13
+ }): import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,30 @@
1
+ "use client";
2
+ import { jsx } from "react/jsx-runtime";
3
+ import { isConsentAllowed, useConsent } from "../consent/consent-store";
4
+ import { InjectedScript } from "../consent/replo-scripts";
5
+ const PIXEL_SCRIPT_ID = "replo:first-party-pixel";
6
+ function ReploPixelScript({
7
+ pixelUrl,
8
+ apiUrl,
9
+ projectId
10
+ }) {
11
+ const consent = useConsent();
12
+ if (!isConsentAllowed({ state: consent, requiredConsent: ["analytics"] })) {
13
+ return null;
14
+ }
15
+ const descriptors = [
16
+ {
17
+ kind: "external",
18
+ src: `${pixelUrl}/latest.js`,
19
+ attributes: {
20
+ "data-api-url": apiUrl,
21
+ "data-project-id": projectId
22
+ }
23
+ }
24
+ ];
25
+ return /* @__PURE__ */ jsx(InjectedScript, { baseId: PIXEL_SCRIPT_ID, descriptors });
26
+ }
27
+ export {
28
+ ReploPixelScript
29
+ };
30
+ //# sourceMappingURL=replo-pixel-script.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../analytics/replo-pixel-script.tsx"],
4
+ "sourcesContent": ["\"use client\";\n\nimport type { ScriptTagDescriptor } from \"schemas/generated/consent\";\n\nimport { isConsentAllowed, useConsent } from \"../consent/consent-store\";\nimport { InjectedScript } from \"../consent/replo-scripts\";\n\n// Stable injection id so re-renders and React Strict Mode double-invokes never\n// inject the pixel twice (the loader itself also guards via `__reploPixelLoaded`).\nconst PIXEL_SCRIPT_ID = \"replo:first-party-pixel\";\n\n/**\n * Consent-gated injector for Replo's first-party analytics pixel. The loaded\n * script sets `window.ReploPixel`, which the always-on `ReploSink` forwards\n * events into, so gating it on `analytics` consent keeps the first-party sink\n * consent-correct without the pixel loading unconditionally in `<head>` the way\n * the legacy scaffold does. `analytics` consent here matches the\n * `firstPartyAllowed` gate that controls whether `ReploSink` is created at all.\n */\nexport function ReploPixelScript({\n pixelUrl,\n apiUrl,\n projectId,\n}: {\n pixelUrl: string;\n apiUrl: string;\n projectId: string;\n}) {\n const consent = useConsent();\n if (!isConsentAllowed({ state: consent, requiredConsent: [\"analytics\"] })) {\n return null;\n }\n\n const descriptors: ScriptTagDescriptor[] = [\n {\n kind: \"external\",\n src: `${pixelUrl}/latest.js`,\n attributes: {\n \"data-api-url\": apiUrl,\n \"data-project-id\": projectId,\n },\n },\n ];\n\n return <InjectedScript baseId={PIXEL_SCRIPT_ID} descriptors={descriptors} />;\n}\n"],
5
+ "mappings": ";AA4CS;AAxCT,SAAS,kBAAkB,kBAAkB;AAC7C,SAAS,sBAAsB;AAI/B,MAAM,kBAAkB;AAUjB,SAAS,iBAAiB;AAAA,EAC/B;AAAA,EACA;AAAA,EACA;AACF,GAIG;AACD,QAAM,UAAU,WAAW;AAC3B,MAAI,CAAC,iBAAiB,EAAE,OAAO,SAAS,iBAAiB,CAAC,WAAW,EAAE,CAAC,GAAG;AACzE,WAAO;AAAA,EACT;AAEA,QAAM,cAAqC;AAAA,IACzC;AAAA,MACE,MAAM;AAAA,MACN,KAAK,GAAG,QAAQ;AAAA,MAChB,YAAY;AAAA,QACV,gBAAgB;AAAA,QAChB,mBAAmB;AAAA,MACrB;AAAA,IACF;AAAA,EACF;AAEA,SAAO,oBAAC,kBAAe,QAAQ,iBAAiB,aAA0B;AAC5E;",
6
+ "names": []
7
+ }
@@ -299,6 +299,29 @@ var intelligemsExperienceSchema = z.object({
299
299
  category: z.string().optional(),
300
300
  status: z.string().optional()
301
301
  }).describe("IntelligemsExperience");
302
+ var customerIoSegmentSchema = z.object({
303
+ id: z.string().describe("customerIoSegment primaryId"),
304
+ name: z.string().optional(),
305
+ description: z.string().optional(),
306
+ type: z.string().optional()
307
+ }).describe("CustomerIoSegment");
308
+ var customerIoCampaignSchema = z.object({
309
+ id: z.string().describe("customerIoCampaign primaryId"),
310
+ name: z.string().optional(),
311
+ type: z.string().optional(),
312
+ active: z.boolean().optional()
313
+ }).describe("CustomerIoCampaign");
314
+ var customerIoBroadcastSchema = z.object({
315
+ id: z.string().describe("customerIoBroadcast primaryId"),
316
+ name: z.string().optional(),
317
+ active: z.boolean().optional()
318
+ }).describe("CustomerIoBroadcast");
319
+ var vwoCampaignSchema = z.object({
320
+ id: z.string(),
321
+ name: z.string().optional(),
322
+ type: z.string().optional(),
323
+ status: z.string().optional()
324
+ }).describe("VwoCampaign");
302
325
  var okendoReviewSchema = z.object({
303
326
  id: z.string(),
304
327
  title: z.string().optional(),
@@ -309,6 +332,16 @@ var okendoReviewSchema = z.object({
309
332
  dateCreated: z.string().optional(),
310
333
  status: z.string().optional()
311
334
  }).describe("OkendoReview");
335
+ var looxReviewSchema = z.object({
336
+ id: z.string(),
337
+ title: z.string().optional(),
338
+ body: z.string().optional(),
339
+ rating: z.number().optional(),
340
+ productName: z.string().optional(),
341
+ reviewerName: z.string().optional(),
342
+ dateCreated: z.string().optional(),
343
+ status: z.string().optional()
344
+ }).describe("LooxReview");
312
345
  var planSchema = z.object({
313
346
  id: z.string(),
314
347
  name: z.string().optional(),
@@ -435,6 +468,42 @@ var OBJECT_TYPE_REGISTRY = {
435
468
  canonicalSchema: intelligemsExperienceSchema,
436
469
  mentionable: true
437
470
  },
471
+ customerIoSegment: {
472
+ type: "customerIoSegment",
473
+ displayName: "Customer.io Segment",
474
+ identifiers: {
475
+ primaryId: "id"
476
+ },
477
+ canonicalSchema: customerIoSegmentSchema,
478
+ mentionable: true
479
+ },
480
+ customerIoCampaign: {
481
+ type: "customerIoCampaign",
482
+ displayName: "Customer.io Campaign",
483
+ identifiers: {
484
+ primaryId: "id"
485
+ },
486
+ canonicalSchema: customerIoCampaignSchema,
487
+ mentionable: true
488
+ },
489
+ customerIoBroadcast: {
490
+ type: "customerIoBroadcast",
491
+ displayName: "Customer.io Broadcast",
492
+ identifiers: {
493
+ primaryId: "id"
494
+ },
495
+ canonicalSchema: customerIoBroadcastSchema,
496
+ mentionable: true
497
+ },
498
+ vwoCampaign: {
499
+ type: "vwoCampaign",
500
+ displayName: "VWO Campaign",
501
+ identifiers: {
502
+ primaryId: "id"
503
+ },
504
+ canonicalSchema: vwoCampaignSchema,
505
+ mentionable: true
506
+ },
438
507
  levantaProduct: {
439
508
  type: "levantaProduct",
440
509
  displayName: "Levanta Product",
@@ -453,6 +522,15 @@ var OBJECT_TYPE_REGISTRY = {
453
522
  canonicalSchema: okendoReviewSchema,
454
523
  mentionable: true
455
524
  },
525
+ looxReview: {
526
+ type: "looxReview",
527
+ displayName: "Loox Review",
528
+ identifiers: {
529
+ primaryId: "id"
530
+ },
531
+ canonicalSchema: looxReviewSchema,
532
+ mentionable: true
533
+ },
456
534
  plan: {
457
535
  type: "plan",
458
536
  displayName: "Plan",
@@ -535,4 +613,4 @@ function transformReploProductToCanonical(product) {
535
613
  };
536
614
  }
537
615
 
538
- export { assetSchema, collectionSchema, externalVideoSchema, getObjectTypeDefinition, imageSchema, integrationSchema, intelligemsExperienceSchema, levantaAffiliateLinkSchema, levantaProductSchema, mediaImageSchema, mediaSchema, metafieldSchema, okendoReviewSchema, optionValueSchema, optionValueSwatchSchema, opusClipSchema, opusCollectionSchema, opusProjectSchema, pageSchema, planSchema, previewImageSchema, priceSchema, productOptionSchema, productSchema, registryItemSchema, segmentSourceSchema, selectedOptionSchema, transformReploProductToCanonical, variantSchema, videoSchema, videoSourceSchema };
616
+ 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 };
@@ -1,4 +1,18 @@
1
- import type { ReploScriptEntry } from "../_vendor/schemas/generated/consent";
1
+ import type { ReploScriptEntry, ScriptTagDescriptor } from "../_vendor/schemas/generated/consent";
2
+ /**
3
+ * Injects the resolved tags into `document.head` once a caller has decided
4
+ * consent allows it. Reused both for author-managed `ReploScripts` entries and
5
+ * for the implicit Replo first-party pixel.
6
+ *
7
+ * DOM insertion (not JSX) is required because inline `<script>` bodies set via
8
+ * React's `dangerouslySetInnerHTML` never execute. Each node is tagged with
9
+ * `data-replo-script-id` (plus a per-tag index) so re-renders and React Strict
10
+ * Mode double-invokes do not double-inject.
11
+ */
12
+ export declare function InjectedScript({ baseId, descriptors, }: {
13
+ baseId: string;
14
+ descriptors: ScriptTagDescriptor[];
15
+ }): null;
2
16
  /**
3
17
  * The single registry component for all managed tracking scripts on the site.
4
18
  * Authored once in `app/layout.tsx`; the agent/miniapp only edit the `scripts`
@@ -26,9 +26,10 @@ function descriptorsFor(entry) {
26
26
  }
27
27
  return buildScriptTags({ type: entry.type, identifier: entry.identifier });
28
28
  }
29
- function InjectedScript({ entry }) {
30
- const descriptors = descriptorsFor(entry);
31
- const baseId = scriptId(entry);
29
+ function InjectedScript({
30
+ baseId,
31
+ descriptors
32
+ }) {
32
33
  const injectionKey = `${baseId}|${JSON.stringify(descriptors)}`;
33
34
  useEffect(() => {
34
35
  if (typeof document === "undefined") {
@@ -79,13 +80,14 @@ function ManagedScript({ entry }) {
79
80
  if (!isConsentAllowed({ state: consent, requiredConsent })) {
80
81
  return null;
81
82
  }
82
- return /* @__PURE__ */ jsx(InjectedScript, { entry });
83
+ return /* @__PURE__ */ jsx(InjectedScript, { baseId: id, descriptors: descriptorsFor(entry) });
83
84
  }
84
85
  function ReploScripts({ scripts }) {
85
86
  useEffect(() => installConsentWindowApi(), []);
86
87
  return /* @__PURE__ */ jsx(Fragment, { children: scripts.map((entry) => /* @__PURE__ */ jsx(ManagedScript, { entry }, scriptId(entry))) });
87
88
  }
88
89
  export {
90
+ InjectedScript,
89
91
  ReploScripts
90
92
  };
91
93
  //# sourceMappingURL=replo-scripts.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../consent/replo-scripts.tsx"],
4
- "sourcesContent": ["\"use client\";\n\nimport type {\n ConsentCategory,\n ReploScriptEntry,\n ScriptTagDescriptor,\n} from \"schemas/generated/consent\";\n\nimport { useEffect } from \"react\";\n\nimport { isConsentAllowed, useConsent } from \"./consent-store\";\nimport { registerScript, unregisterScript } from \"./script-registration-store\";\nimport { buildScriptTags, defaultConsentFor } from \"./script-snippets\";\nimport { installConsentWindowApi } from \"./window-api\";\n\n/** Stable identity for an entry, used as React key and DOM dedupe key. */\nfunction scriptId(entry: ReploScriptEntry): string {\n return entry.type === \"custom\"\n ? `custom:${entry.id}`\n : `${entry.type}:${entry.identifier}`;\n}\n\nfunction requiredConsentFor(entry: ReploScriptEntry): ConsentCategory[] {\n if (entry.type === \"custom\") {\n return entry.requiredConsent;\n }\n return entry.requiredConsent ?? defaultConsentFor(entry.type);\n}\n\n/**\n * Resolves an entry to the concrete tags to inject. A named provider may resolve\n * to multiple tags (GA4 = external loader + inline config); a custom entry is a\n * single external `src` or inline `body`.\n */\nfunction descriptorsFor(entry: ReploScriptEntry): ScriptTagDescriptor[] {\n if (entry.type === \"custom\") {\n if (entry.src) {\n return [{ kind: \"external\", src: entry.src }];\n }\n if (entry.body) {\n return [{ kind: \"inline\", body: entry.body }];\n }\n return [];\n }\n return buildScriptTags({ type: entry.type, identifier: entry.identifier });\n}\n\n/**\n * Injects the resolved tags into `document.head` once consent allows it.\n *\n * DOM insertion (not JSX) is required because inline `<script>` bodies set via\n * React's `dangerouslySetInnerHTML` never execute. Each node is tagged with\n * `data-replo-script-id` (plus a per-tag index) so re-renders and React Strict\n * Mode double-invokes do not double-inject.\n */\nfunction InjectedScript({ entry }: { entry: ReploScriptEntry }) {\n const descriptors = descriptorsFor(entry);\n const baseId = scriptId(entry);\n // Re-inject only when the resolved tags actually change.\n const injectionKey = `${baseId}|${JSON.stringify(descriptors)}`;\n\n // eslint-disable-next-line replo/no-use-effect -- script injection is a DOM side effect that must run after mount and on consent changes\n useEffect(() => {\n if (typeof document === \"undefined\") {\n return;\n }\n const createdNodes: HTMLScriptElement[] = [];\n descriptors.forEach((descriptor, index) => {\n const nodeId = `${baseId}#${index}`;\n const existing = document.querySelector(\n `script[data-replo-script-id=\"${nodeId}\"]`,\n );\n if (existing) {\n return;\n }\n const scriptElement = document.createElement(\"script\");\n scriptElement.dataset.reploScriptId = nodeId;\n if (descriptor.kind === \"external\") {\n scriptElement.src = descriptor.src;\n scriptElement.async = true;\n for (const [attributeName, attributeValue] of Object.entries(\n descriptor.attributes ?? {},\n )) {\n scriptElement.setAttribute(attributeName, attributeValue);\n }\n } else {\n scriptElement.textContent = descriptor.body;\n }\n document.head.append(scriptElement);\n createdNodes.push(scriptElement);\n });\n\n return () => {\n // Removing the node does not unload an already-loaded vendor (see the plan's\n // revocation note); full teardown is a reload triggered by the banner. This\n // cleanup keeps the DOM tidy and prevents duplicates across remounts.\n for (const node of createdNodes) {\n node.remove();\n }\n };\n }, [injectionKey]);\n\n return null;\n}\n\nfunction ManagedScript({ entry }: { entry: ReploScriptEntry }) {\n const consent = useConsent();\n const requiredConsent = requiredConsentFor(entry);\n const id = scriptId(entry);\n const consentKey = requiredConsent.join(\",\");\n\n // eslint-disable-next-line replo/no-use-effect -- register/unregister with the singleton so the analytics provider can gate sinks by what's on the page\n useEffect(() => {\n registerScript({ id, type: entry.type, requiredConsent });\n return () => unregisterScript(id);\n }, [id, entry.type, consentKey]);\n\n if (!isConsentAllowed({ state: consent, requiredConsent })) {\n return null;\n }\n return <InjectedScript entry={entry} />;\n}\n\n/**\n * The single registry component for all managed tracking scripts on the site.\n * Authored once in `app/layout.tsx`; the agent/miniapp only edit the `scripts`\n * array. Each entry registers itself and is gated + injected per consent.\n */\nexport function ReploScripts({ scripts }: { scripts: ReploScriptEntry[] }) {\n // eslint-disable-next-line replo/no-use-effect -- install the window.Replo.customerPrivacy API + change event once the consent runtime mounts\n useEffect(() => installConsentWindowApi(), []);\n\n return (\n <>\n {scripts.map((entry) => (\n <ManagedScript key={scriptId(entry)} entry={entry} />\n ))}\n </>\n );\n}\n"],
5
- "mappings": ";AAwHS,SAaL,UAbK;AAhHT,SAAS,iBAAiB;AAE1B,SAAS,kBAAkB,kBAAkB;AAC7C,SAAS,gBAAgB,wBAAwB;AACjD,SAAS,iBAAiB,yBAAyB;AACnD,SAAS,+BAA+B;AAGxC,SAAS,SAAS,OAAiC;AACjD,SAAO,MAAM,SAAS,WAClB,UAAU,MAAM,EAAE,KAClB,GAAG,MAAM,IAAI,IAAI,MAAM,UAAU;AACvC;AAEA,SAAS,mBAAmB,OAA4C;AACtE,MAAI,MAAM,SAAS,UAAU;AAC3B,WAAO,MAAM;AAAA,EACf;AACA,SAAO,MAAM,mBAAmB,kBAAkB,MAAM,IAAI;AAC9D;AAOA,SAAS,eAAe,OAAgD;AACtE,MAAI,MAAM,SAAS,UAAU;AAC3B,QAAI,MAAM,KAAK;AACb,aAAO,CAAC,EAAE,MAAM,YAAY,KAAK,MAAM,IAAI,CAAC;AAAA,IAC9C;AACA,QAAI,MAAM,MAAM;AACd,aAAO,CAAC,EAAE,MAAM,UAAU,MAAM,MAAM,KAAK,CAAC;AAAA,IAC9C;AACA,WAAO,CAAC;AAAA,EACV;AACA,SAAO,gBAAgB,EAAE,MAAM,MAAM,MAAM,YAAY,MAAM,WAAW,CAAC;AAC3E;AAUA,SA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AAE;AAAA,EAClC,GAAG,CAAC,IAAI,MAAM,MAAM,UAAU,CAAC;AAE/B,MAAI,CAAC,iBAAiB,EAAE,OAAO,SAAS,gBAAgB,CAAC,GAAG;AAC1D,WAAO;AAAA,EACT;AACA,SAAO,oBAAC,kBAAe,OAAc;AACvC;AAOO,SAAS,aAAa,EAAE,QAAQ,GAAoC;AAEzE,YAAU,MAAM,wBAAwB,GAAG,CAAC,CAAC;AAE7C,SACE,gCACG,kBAAQ,IAAI,CAAC,UACZ,oBAAC,iBAAoC,SAAjB,SAAS,KAAK,CAAiB,CACpD,GACH;AAEJ;",
4
+ "sourcesContent": ["\"use client\";\n\nimport type {\n ConsentCategory,\n ReploScriptEntry,\n ScriptTagDescriptor,\n} from \"schemas/generated/consent\";\n\nimport { useEffect } from \"react\";\n\nimport { isConsentAllowed, useConsent } from \"./consent-store\";\nimport { registerScript, unregisterScript } from \"./script-registration-store\";\nimport { buildScriptTags, defaultConsentFor } from \"./script-snippets\";\nimport { installConsentWindowApi } from \"./window-api\";\n\n/** Stable identity for an entry, used as React key and DOM dedupe key. */\nfunction scriptId(entry: ReploScriptEntry): string {\n return entry.type === \"custom\"\n ? `custom:${entry.id}`\n : `${entry.type}:${entry.identifier}`;\n}\n\nfunction requiredConsentFor(entry: ReploScriptEntry): ConsentCategory[] {\n if (entry.type === \"custom\") {\n return entry.requiredConsent;\n }\n return entry.requiredConsent ?? defaultConsentFor(entry.type);\n}\n\n/**\n * Resolves an entry to the concrete tags to inject. A named provider may resolve\n * to multiple tags (GA4 = external loader + inline config); a custom entry is a\n * single external `src` or inline `body`.\n */\nfunction descriptorsFor(entry: ReploScriptEntry): ScriptTagDescriptor[] {\n if (entry.type === \"custom\") {\n if (entry.src) {\n return [{ kind: \"external\", src: entry.src }];\n }\n if (entry.body) {\n return [{ kind: \"inline\", body: entry.body }];\n }\n return [];\n }\n return buildScriptTags({ type: entry.type, identifier: entry.identifier });\n}\n\n/**\n * Injects the resolved tags into `document.head` once a caller has decided\n * consent allows it. Reused both for author-managed `ReploScripts` entries and\n * for the implicit Replo first-party pixel.\n *\n * DOM insertion (not JSX) is required because inline `<script>` bodies set via\n * React's `dangerouslySetInnerHTML` never execute. Each node is tagged with\n * `data-replo-script-id` (plus a per-tag index) so re-renders and React Strict\n * Mode double-invokes do not double-inject.\n */\nexport function InjectedScript({\n baseId,\n descriptors,\n}: {\n baseId: string;\n descriptors: ScriptTagDescriptor[];\n}) {\n // Re-inject only when the resolved tags actually change.\n const injectionKey = `${baseId}|${JSON.stringify(descriptors)}`;\n\n // eslint-disable-next-line replo/no-use-effect -- script injection is a DOM side effect that must run after mount and on consent changes\n useEffect(() => {\n if (typeof document === \"undefined\") {\n return;\n }\n const createdNodes: HTMLScriptElement[] = [];\n descriptors.forEach((descriptor, index) => {\n const nodeId = `${baseId}#${index}`;\n const existing = document.querySelector(\n `script[data-replo-script-id=\"${nodeId}\"]`,\n );\n if (existing) {\n return;\n }\n const scriptElement = document.createElement(\"script\");\n scriptElement.dataset.reploScriptId = nodeId;\n if (descriptor.kind === \"external\") {\n scriptElement.src = descriptor.src;\n scriptElement.async = true;\n for (const [attributeName, attributeValue] of Object.entries(\n descriptor.attributes ?? {},\n )) {\n scriptElement.setAttribute(attributeName, attributeValue);\n }\n } else {\n scriptElement.textContent = descriptor.body;\n }\n document.head.append(scriptElement);\n createdNodes.push(scriptElement);\n });\n\n return () => {\n // Removing the node does not unload an already-loaded vendor (see the plan's\n // revocation note); full teardown is a reload triggered by the banner. This\n // cleanup keeps the DOM tidy and prevents duplicates across remounts.\n for (const node of createdNodes) {\n node.remove();\n }\n };\n }, [injectionKey]);\n\n return null;\n}\n\nfunction ManagedScript({ entry }: { entry: ReploScriptEntry }) {\n const consent = useConsent();\n const requiredConsent = requiredConsentFor(entry);\n const id = scriptId(entry);\n const consentKey = requiredConsent.join(\",\");\n\n // eslint-disable-next-line replo/no-use-effect -- register/unregister with the singleton so the analytics provider can gate sinks by what's on the page\n useEffect(() => {\n registerScript({ id, type: entry.type, requiredConsent });\n return () => unregisterScript(id);\n }, [id, entry.type, consentKey]);\n\n if (!isConsentAllowed({ state: consent, requiredConsent })) {\n return null;\n }\n return <InjectedScript baseId={id} descriptors={descriptorsFor(entry)} />;\n}\n\n/**\n * The single registry component for all managed tracking scripts on the site.\n * Authored once in `app/layout.tsx`; the agent/miniapp only edit the `scripts`\n * array. Each entry registers itself and is gated + injected per consent.\n */\nexport function ReploScripts({ scripts }: { scripts: ReploScriptEntry[] }) {\n // eslint-disable-next-line replo/no-use-effect -- install the window.Replo.customerPrivacy API + change event once the consent runtime mounts\n useEffect(() => installConsentWindowApi(), []);\n\n return (\n <>\n {scripts.map((entry) => (\n <ManagedScript key={scriptId(entry)} entry={entry} />\n ))}\n </>\n );\n}\n"],
5
+ "mappings": ";AA8HS,SAaL,UAbK;AAtHT,SAAS,iBAAiB;AAE1B,SAAS,kBAAkB,kBAAkB;AAC7C,SAAS,gBAAgB,wBAAwB;AACjD,SAAS,iBAAiB,yBAAyB;AACnD,SAAS,+BAA+B;AAGxC,SAAS,SAAS,OAAiC;AACjD,SAAO,MAAM,SAAS,WAClB,UAAU,MAAM,EAAE,KAClB,GAAG,MAAM,IAAI,IAAI,MAAM,UAAU;AACvC;AAEA,SAAS,mBAAmB,OAA4C;AACtE,MAAI,MAAM,SAAS,UAAU;AAC3B,WAAO,MAAM;AAAA,EACf;AACA,SAAO,MAAM,mBAAmB,kBAAkB,MAAM,IAAI;AAC9D;AAOA,SAAS,eAAe,OAAgD;AACtE,MAAI,MAAM,SAAS,UAAU;AAC3B,QAAI,MAAM,KAAK;AACb,aAAO,CAAC,EAAE,MAAM,YAAY,KAAK,MAAM,IAAI,CAAC;AAAA,IAC9C;AACA,QAAI,MAAM,MAAM;AACd,aAAO,CAAC,EAAE,MAAM,UAAU,MAAM,MAAM,KAAK,CAAC;AAAA,IAC9C;AACA,WAAO,CAAC;AAAA,EACV;AACA,SAAO,gBAAgB,EAAE,MAAM,MAAM,MAAM,YAAY,M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,GAAG,CAAC,IAAI,MAAM,MAAM,UAAU,CAAC;AAE/B,MAAI,CAAC,iBAAiB,EAAE,OAAO,SAAS,gBAAgB,CAAC,GAAG;AAC1D,WAAO;AAAA,EACT;AACA,SAAO,oBAAC,kBAAe,QAAQ,IAAI,aAAa,eAAe,KAAK,GAAG;AACzE;AAOO,SAAS,aAAa,EAAE,QAAQ,GAAoC;AAEzE,YAAU,MAAM,wBAAwB,GAAG,CAAC,CAAC;AAE7C,SACE,gCACG,kBAAQ,IAAI,CAAC,UACZ,oBAAC,iBAAoC,SAAjB,SAAS,KAAK,CAAiB,CACpD,GACH;AAEJ;",
6
6
  "names": []
7
7
  }
@@ -3,9 +3,13 @@ import { useEffect, useRef } from "react";
3
3
  import { buildGoogleFontsCssUrl } from "../../_vendor/replo-utils/lib/google-fonts.mjs";
4
4
  import { designLibraryPreviewMessageSchema } from "../../_vendor/schemas/designLibrary.mjs";
5
5
  const FONT_LINK_DATA_KEY = "reploDesignLibraryFont";
6
+ function escapeCssString(value) {
7
+ return value.replace(/\\/gu, "\\\\").replace(/'/gu, "\\'");
8
+ }
6
9
  function DesignLibraryPreview() {
7
10
  const ownedKeys = useRef(null);
8
11
  const ownedFontLinks = useRef(null);
12
+ const ownedFontFaces = useRef(null);
9
13
  const ownsDefaultFont = useRef(false);
10
14
  useEffect(() => {
11
15
  const handleMessage = (event) => {
@@ -15,7 +19,7 @@ function DesignLibraryPreview() {
15
19
  const root = document.documentElement;
16
20
  const nextVars = { ...cssVars };
17
21
  for (const font of fonts) {
18
- nextVars[font.cssVar] = `'${font.family}'`;
22
+ nextVars[font.cssVar] = `'${escapeCssString(font.family)}'`;
19
23
  }
20
24
  const owned = ownedKeys.current ?? /* @__PURE__ */ new Set();
21
25
  for (const key of owned) {
@@ -25,9 +29,11 @@ function DesignLibraryPreview() {
25
29
  for (const [key, value] of Object.entries(nextVars)) {
26
30
  root.style.setProperty(key, value);
27
31
  }
32
+ const customFonts = fonts.filter((font) => Boolean(font.faceUrl));
33
+ const googleFonts = fonts.filter((font) => !font.faceUrl);
28
34
  const links = ownedFontLinks.current ?? /* @__PURE__ */ new Map();
29
35
  const nextHrefs = new Set(
30
- fonts.map((font) => buildGoogleFontsCssUrl(font.family))
36
+ googleFonts.map((font) => buildGoogleFontsCssUrl(font.family))
31
37
  );
32
38
  for (const [href, link] of links) {
33
39
  if (!nextHrefs.has(href)) {
@@ -45,6 +51,27 @@ function DesignLibraryPreview() {
45
51
  links.set(href, link);
46
52
  }
47
53
  ownedFontLinks.current = links;
54
+ const faces = ownedFontFaces.current ?? /* @__PURE__ */ new Map();
55
+ const nextFamilies = new Set(customFonts.map((font) => font.family));
56
+ for (const [family, entry] of faces) {
57
+ if (!nextFamilies.has(family)) {
58
+ entry.style.remove();
59
+ faces.delete(family);
60
+ }
61
+ }
62
+ for (const font of customFonts) {
63
+ if (!font.faceUrl) continue;
64
+ const existing = faces.get(font.family);
65
+ if (existing?.url === font.faceUrl) continue;
66
+ existing?.style.remove();
67
+ const style = document.createElement("style");
68
+ style.dataset[FONT_LINK_DATA_KEY] = "";
69
+ const format = font.format ? ` format('${escapeCssString(font.format)}')` : "";
70
+ style.textContent = `@font-face{font-family:'${escapeCssString(font.family)}';font-weight:400;font-style:normal;src:url('${escapeCssString(font.faceUrl)}')${format};font-display:swap;}`;
71
+ document.head.append(style);
72
+ faces.set(font.family, { url: font.faceUrl, style });
73
+ }
74
+ ownedFontFaces.current = faces;
48
75
  if (defaultFontCssVar) {
49
76
  root.style.setProperty("font-family", `var(${defaultFontCssVar})`);
50
77
  ownsDefaultFont.current = true;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../editor/design-library-preview/DesignLibraryPreview.tsx"],
4
- "sourcesContent": ["\"use client\";\n\nimport { useEffect, useRef } from \"react\";\n\nimport { buildGoogleFontsCssUrl } from \"replo-utils/lib/google-fonts\";\nimport { designLibraryPreviewMessageSchema } from \"schemas/designLibrary\";\n\nconst FONT_LINK_DATA_KEY = \"reploDesignLibraryFont\";\n\nexport function DesignLibraryPreview() {\n // NOTE (Ben, 2026-06-03): The custom-property keys we set last time, so on the\n // next message we remove only the ones we own that the new override set drops.\n const ownedKeys = useRef<Set<string> | null>(null);\n // NOTE (Ben, 2026-06-05): The Google Font <link> hrefs we injected, keyed by\n // href so we de-dupe and remove only our own when the override set changes.\n const ownedFontLinks = useRef<Map<string, HTMLLinkElement> | null>(null);\n // NOTE (Ben, 2026-06-05): Whether we set the document default font-family, so\n // we can clear just that.\n const ownsDefaultFont = useRef(false);\n\n // eslint-disable-next-line replo/no-use-effect -- Subscribes to window message events from the parent editor.\n useEffect(() => {\n const handleMessage = (event: MessageEvent) => {\n const parsed = designLibraryPreviewMessageSchema.safeParse(event.data);\n if (!parsed.success) return;\n const { cssVars, fonts, defaultFontCssVar } = parsed.data;\n const root = document.documentElement;\n\n // --- CSS variable overrides (colors + font role vars) ---\n const nextVars: Record<string, string> = { ...cssVars };\n for (const font of fonts) {\n nextVars[font.cssVar] = `'${font.family}'`;\n }\n const owned = ownedKeys.current ?? new Set();\n for (const key of owned) {\n if (!(key in nextVars)) root.style.removeProperty(key);\n }\n ownedKeys.current = new Set(Object.keys(nextVars));\n for (const [key, value] of Object.entries(nextVars)) {\n root.style.setProperty(key, value);\n }\n\n // --- Google Font stylesheets ---\n const links = ownedFontLinks.current ?? new Map();\n const nextHrefs = new Set(\n fonts.map((font) => buildGoogleFontsCssUrl(font.family)),\n );\n for (const [href, link] of links) {\n if (!nextHrefs.has(href)) {\n link.remove();\n links.delete(href);\n }\n }\n for (const href of nextHrefs) {\n if (links.has(href)) continue;\n const link = document.createElement(\"link\");\n link.rel = \"stylesheet\";\n link.href = href;\n link.dataset[FONT_LINK_DATA_KEY] = \"\";\n document.head.append(link);\n links.set(href, link);\n }\n ownedFontLinks.current = links;\n\n // --- Document default font ---\n if (defaultFontCssVar) {\n root.style.setProperty(\"font-family\", `var(${defaultFontCssVar})`);\n ownsDefaultFont.current = true;\n } else if (ownsDefaultFont.current) {\n root.style.removeProperty(\"font-family\");\n ownsDefaultFont.current = false;\n }\n };\n window.addEventListener(\"message\", handleMessage);\n return () => {\n window.removeEventListener(\"message\", handleMessage);\n };\n }, []);\n\n return null;\n}\n"],
5
- "mappings": ";AAEA,SAAS,WAAW,cAAc;AAElC,SAAS,8BAA8B;AACvC,SAAS,yCAAyC;AAElD,MAAM,qBAAqB;AAEpB,SAAS,uBAAuB;AAGrC,QAAM,YAAY,OAA2B,IAAI;AAGjD,QAAM,iBAAiB,OAA4C,IAAI;AAGvE,QAAM,kBAAkB,OAAO,KAAK;AAGpC,YAAU,MAAM;AACd,UAAM,gBAAgB,CAAC,UAAwB;AAC7C,YAAM,SAAS,kCAAkC,UAAU,MAAM,IAAI;AACrE,UAAI,CAAC,OAAO,QAAS;AACrB,YAAM,EAAE,SAAS,OAAO,kBAAkB,IAAI,OAAO;AACrD,YAAM,OAAO,SAAS;AAGtB,YAAM,WAAmC,EAAE,GAAG,QAAQ;AACtD,iBAAW,QAAQ,OAAO;AACxB,iBAAS,KAAK,MAAM,IAAI,IAAI,KAAK,MAAM;AAAA,MACzC;AACA,YAAM,QAAQ,UAAU,WAAW,oBAAI,IAAI;AAC3C,iBAAW,OAAO,OAAO;AACvB,YAAI,EAAE,OAAO,UAAW,MAAK,MAAM,eAAe,GAAG;AAAA,MACvD;AACA,gBAAU,UAAU,IAAI,IAAI,OAAO,KAAK,QAAQ,CAAC;AACjD,iBAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,QAAQ,GAAG;AACnD,aAAK,MAAM,YAAY,KAAK,KAAK;AAAA,MACnC;AAGA,YAAM,QAAQ,eAAe,WAAW,oBAAI,IAAI;AAChD,YAAM,YAAY,IAAI;AAAA,QACpB,MAAM,IAAI,CAAC,SAAS,uBAAuB,KAAK,MAAM,CAAC;AAAA,MACzD;AACA,iBAAW,CAAC,MAAM,IAAI,KAAK,OAAO;AAChC,YAAI,CAAC,UAAU,IAAI,IAAI,GAAG;AACxB,eAAK,OAAO;AACZ,gBAAM,OAAO,IAAI;AAAA,QACnB;AAAA,MACF;AACA,iBAAW,QAAQ,WAAW;AAC5B,YAAI,MAAM,IAAI,IAAI,EAAG;AACrB,cAAM,OAAO,SAAS,cAAc,MAAM;AAC1C,aAAK,MAAM;AACX,aAAK,OAAO;AACZ,aAAK,QAAQ,kBAAkB,IAAI;AACnC,iBAAS,KAAK,OAAO,IAAI;AACzB,cAAM,IAAI,MAAM,IAAI;AAAA,MACtB;AACA,qBAAe,UAAU;AAGzB,UAAI,mBAAmB;AACrB,aAAK,MAAM,YAAY,eAAe,OAAO,iBAAiB,GAAG;AACjE,wBAAgB,UAAU;AAAA,MAC5B,WAAW,gBAAgB,SAAS;AAClC,aAAK,MAAM,eAAe,aAAa;AACvC,wBAAgB,UAAU;AAAA,MAC5B;AAAA,IACF;AACA,WAAO,iBAAiB,WAAW,aAAa;AAChD,WAAO,MAAM;AACX,aAAO,oBAAoB,WAAW,aAAa;AAAA,IACrD;AAAA,EACF,GAAG,CAAC,CAAC;AAEL,SAAO;AACT;",
4
+ "sourcesContent": ["\"use client\";\n\nimport { useEffect, useRef } from \"react\";\n\nimport { buildGoogleFontsCssUrl } from \"replo-utils/lib/google-fonts\";\nimport { designLibraryPreviewMessageSchema } from \"schemas/designLibrary\";\n\nconst FONT_LINK_DATA_KEY = \"reploDesignLibraryFont\";\n\nfunction escapeCssString(value: string): string {\n return value.replace(/\\\\/gu, \"\\\\\\\\\").replace(/'/gu, \"\\\\'\");\n}\n\nexport function DesignLibraryPreview() {\n // NOTE (Ben, 2026-06-03): The custom-property keys we set last time, so on the\n // next message we remove only the ones we own that the new override set drops.\n const ownedKeys = useRef<Set<string> | null>(null);\n // NOTE (Ben, 2026-06-05): The Google Font <link> hrefs we injected, keyed by\n // href so we de-dupe and remove only our own when the override set changes.\n const ownedFontLinks = useRef<Map<string, HTMLLinkElement> | null>(null);\n // NOTE (Ben, 2026-06-05): The @font-face <style> nodes for uploaded custom\n // fonts, keyed by family with the URL we injected, so we de-dupe, re-inject\n // when a family's asset URL changes (re-upload), and remove only our own when\n // the override set changes.\n const ownedFontFaces = useRef<Map<\n string,\n { url: string; style: HTMLStyleElement }\n > | null>(null);\n // NOTE (Ben, 2026-06-05): Whether we set the document default font-family, so\n // we can clear just that.\n const ownsDefaultFont = useRef(false);\n\n // eslint-disable-next-line replo/no-use-effect -- Subscribes to window message events from the parent editor.\n useEffect(() => {\n const handleMessage = (event: MessageEvent) => {\n const parsed = designLibraryPreviewMessageSchema.safeParse(event.data);\n if (!parsed.success) return;\n const { cssVars, fonts, defaultFontCssVar } = parsed.data;\n const root = document.documentElement;\n\n // --- CSS variable overrides (colors + font role vars) ---\n const nextVars: Record<string, string> = { ...cssVars };\n for (const font of fonts) {\n nextVars[font.cssVar] = `'${escapeCssString(font.family)}'`;\n }\n const owned = ownedKeys.current ?? new Set();\n for (const key of owned) {\n if (!(key in nextVars)) root.style.removeProperty(key);\n }\n ownedKeys.current = new Set(Object.keys(nextVars));\n for (const [key, value] of Object.entries(nextVars)) {\n root.style.setProperty(key, value);\n }\n\n // Custom uploaded fonts carry a faceUrl; Google fonts don't.\n const customFonts = fonts.filter((font) => Boolean(font.faceUrl));\n const googleFonts = fonts.filter((font) => !font.faceUrl);\n\n // --- Google Font stylesheets (<link> to the CDN) ---\n const links = ownedFontLinks.current ?? new Map();\n const nextHrefs = new Set(\n googleFonts.map((font) => buildGoogleFontsCssUrl(font.family)),\n );\n for (const [href, link] of links) {\n if (!nextHrefs.has(href)) {\n link.remove();\n links.delete(href);\n }\n }\n for (const href of nextHrefs) {\n if (links.has(href)) continue;\n const link = document.createElement(\"link\");\n link.rel = \"stylesheet\";\n link.href = href;\n link.dataset[FONT_LINK_DATA_KEY] = \"\";\n document.head.append(link);\n links.set(href, link);\n }\n ownedFontLinks.current = links;\n\n // --- Custom uploaded fonts (@font-face from the asset URL) ---\n const faces = ownedFontFaces.current ?? new Map();\n const nextFamilies = new Set(customFonts.map((font) => font.family));\n for (const [family, entry] of faces) {\n if (!nextFamilies.has(family)) {\n entry.style.remove();\n faces.delete(family);\n }\n }\n for (const font of customFonts) {\n if (!font.faceUrl) continue;\n const existing = faces.get(font.family);\n // Re-upload reuses the family but changes the asset URL; replace the\n // stale node rather than skipping it.\n if (existing?.url === font.faceUrl) continue;\n existing?.style.remove();\n const style = document.createElement(\"style\");\n style.dataset[FONT_LINK_DATA_KEY] = \"\";\n const format = font.format\n ? ` format('${escapeCssString(font.format)}')`\n : \"\";\n style.textContent = `@font-face{font-family:'${escapeCssString(font.family)}';font-weight:400;font-style:normal;src:url('${escapeCssString(font.faceUrl)}')${format};font-display:swap;}`;\n document.head.append(style);\n faces.set(font.family, { url: font.faceUrl, style });\n }\n ownedFontFaces.current = faces;\n\n // --- Document default font ---\n if (defaultFontCssVar) {\n root.style.setProperty(\"font-family\", `var(${defaultFontCssVar})`);\n ownsDefaultFont.current = true;\n } else if (ownsDefaultFont.current) {\n root.style.removeProperty(\"font-family\");\n ownsDefaultFont.current = false;\n }\n };\n window.addEventListener(\"message\", handleMessage);\n return () => {\n window.removeEventListener(\"message\", handleMessage);\n };\n }, []);\n\n return null;\n}\n"],
5
+ "mappings": ";AAEA,SAAS,WAAW,cAAc;AAElC,SAAS,8BAA8B;AACvC,SAAS,yCAAyC;AAElD,MAAM,qBAAqB;AAE3B,SAAS,gBAAgB,OAAuB;AAC9C,SAAO,MAAM,QAAQ,QAAQ,MAAM,EAAE,QAAQ,OAAO,KAAK;AAC3D;AAEO,SAAS,uBAAuB;AAGrC,QAAM,YAAY,OAA2B,IAAI;AAGjD,QAAM,iBAAiB,OAA4C,IAAI;AAKvE,QAAM,iBAAiB,OAGb,IAAI;AAGd,QAAM,kBAAkB,OAAO,KAAK;AAGpC,YAAU,MAAM;AACd,UAAM,gBAAgB,CAAC,UAAwB;AAC7C,YAAM,SAAS,kCAAkC,UAAU,MAAM,IAAI;AACrE,UAAI,CAAC,OAAO,QAAS;AACrB,YAAM,EAAE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_FIRE_API_URL?: string;
5
+ REPLO_ANALYTICS_PIXEL_URL?: string;
5
6
  SHOPIFY_URL?: string;
6
7
  SHOPIFY_STOREFRONT_ACCESS_TOKEN?: string | null;
7
8
  STRIPE_CONNECT_ACCOUNT_ID?: string | null;
package/env.js CHANGED
@@ -4,6 +4,7 @@ const envSchema = z.object({
4
4
  CANOPY_API_HOST: z.string().min(1),
5
5
  PROJECT_ID: z.string().uuid(),
6
6
  ANALYTICS_FIRE_API_URL: z.string().optional(),
7
+ REPLO_ANALYTICS_PIXEL_URL: z.string().optional(),
7
8
  SHOPIFY_URL: z.string().optional(),
8
9
  SHOPIFY_STOREFRONT_ACCESS_TOKEN: z.string().nullable().optional(),
9
10
  STRIPE_CONNECT_ACCOUNT_ID: z.string().nullable().optional(),
package/env.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../env.ts"],
4
- "sourcesContent": ["import { getCloudflareContext } from \"@opennextjs/cloudflare\";\nimport { z } from \"zod\";\n\ntype Env = {\n CANOPY_API_HOST: string;\n PROJECT_ID: string;\n\n // Base URL of analytics-fire (e.g. https://data.replo.app). Read server-side by\n // the consent action (`consent/consent-actions.ts`) to forward proof-of-consent\n // records. Optional: absent in environments where the audit pipeline isn't\n // wired (e.g. local dev), where consent recording simply no-ops.\n ANALYTICS_FIRE_API_URL?: string;\n\n // NOTE (Gabe 2025-06-26): If there's no Shopify integration these will be\n // undefined.\n SHOPIFY_URL?: string;\n // NOTE (Gabe 2025-06-26): Even if there's an integration, if we haven't been\n // given elevated scope this may be null.\n SHOPIFY_STOREFRONT_ACCESS_TOKEN?: string | null;\n STRIPE_CONNECT_ACCOUNT_ID?: string | null;\n CHECKOUT_PROVIDER?: \"shopify\" | \"stripe\" | \"none\";\n\n REPLO_INTERNAL_REVALIDATE_SECRET?: string;\n /** Shared secret sent in X-Replo-Resolver-Auth for server-to-server cart calls. */\n CART_AUTH_SECRET?: string;\n};\n\nconst envSchema = z.object({\n CANOPY_API_HOST: z.string().min(1),\n PROJECT_ID: z.string().uuid(),\n ANALYTICS_FIRE_API_URL: z.string().optional(),\n SHOPIFY_URL: z.string().optional(),\n SHOPIFY_STOREFRONT_ACCESS_TOKEN: z.string().nullable().optional(),\n STRIPE_CONNECT_ACCOUNT_ID: z.string().nullable().optional(),\n CHECKOUT_PROVIDER: z.enum([\"shopify\", \"stripe\", \"none\"]).optional(),\n REPLO_INTERNAL_REVALIDATE_SECRET: z.string().optional(),\n CART_AUTH_SECRET: z.string().optional(),\n});\n\nexport const getEnv = async (): Promise<Env> => {\n const { env } = await getCloudflareContext({ async: true });\n return envSchema.parse(env);\n};\n"],
5
- "mappings": "AAAA,SAAS,4BAA4B;AACrC,SAAS,SAAS;AA0BlB,MAAM,YAAY,EAAE,OAAO;AAAA,EACzB,iBAAiB,EAAE,OAAO,EAAE,IAAI,CAAC;AAAA,EACjC,YAAY,EAAE,OAAO,EAAE,KAAK;AAAA,EAC5B,wBAAwB,EAAE,OAAO,EAAE,SAAS;AAAA,EAC5C,aAAa,EAAE,OAAO,EAAE,SAAS;AAAA,EACjC,iCAAiC,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS;AAAA,EAChE,2BAA2B,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS;AAAA,EAC1D,mBAAmB,EAAE,KAAK,CAAC,WAAW,UAAU,MAAM,CAAC,EAAE,SAAS;AAAA,EAClE,kCAAkC,EAAE,OAAO,EAAE,SAAS;AAAA,EACtD,kBAAkB,EAAE,OAAO,EAAE,SAAS;AACxC,CAAC;AAEM,MAAM,SAAS,YAA0B;AAC9C,QAAM,EAAE,IAAI,IAAI,MAAM,qBAAqB,EAAE,OAAO,KAAK,CAAC;AAC1D,SAAO,UAAU,MAAM,GAAG;AAC5B;",
4
+ "sourcesContent": ["import { getCloudflareContext } from \"@opennextjs/cloudflare\";\nimport { z } from \"zod\";\n\ntype Env = {\n CANOPY_API_HOST: string;\n PROJECT_ID: string;\n\n // Base URL of analytics-fire (e.g. https://data.replo.app). Read server-side by\n // the consent action (`consent/consent-actions.ts`) to forward proof-of-consent\n // records. Optional: absent in environments where the audit pipeline isn't\n // wired (e.g. local dev), where consent recording simply no-ops.\n ANALYTICS_FIRE_API_URL?: string;\n\n // Base URL of the Replo first-party analytics pixel CDN (e.g.\n // https://pixel.replo.app). `<ReploFirstPartyPixel>` loads\n // `${REPLO_ANALYTICS_PIXEL_URL}/latest.js` into the page once analytics consent\n // is granted; the browser fetches it directly. Optional: absent when the pixel\n // isn't configured (e.g. lean local dev), where the pixel simply isn't injected.\n REPLO_ANALYTICS_PIXEL_URL?: string;\n\n // NOTE (Gabe 2025-06-26): If there's no Shopify integration these will be\n // undefined.\n SHOPIFY_URL?: string;\n // NOTE (Gabe 2025-06-26): Even if there's an integration, if we haven't been\n // given elevated scope this may be null.\n SHOPIFY_STOREFRONT_ACCESS_TOKEN?: string | null;\n STRIPE_CONNECT_ACCOUNT_ID?: string | null;\n CHECKOUT_PROVIDER?: \"shopify\" | \"stripe\" | \"none\";\n\n REPLO_INTERNAL_REVALIDATE_SECRET?: string;\n /** Shared secret sent in X-Replo-Resolver-Auth for server-to-server cart calls. */\n CART_AUTH_SECRET?: string;\n};\n\nconst envSchema = z.object({\n CANOPY_API_HOST: z.string().min(1),\n PROJECT_ID: z.string().uuid(),\n ANALYTICS_FIRE_API_URL: z.string().optional(),\n REPLO_ANALYTICS_PIXEL_URL: z.string().optional(),\n SHOPIFY_URL: z.string().optional(),\n SHOPIFY_STOREFRONT_ACCESS_TOKEN: z.string().nullable().optional(),\n STRIPE_CONNECT_ACCOUNT_ID: z.string().nullable().optional(),\n CHECKOUT_PROVIDER: z.enum([\"shopify\", \"stripe\", \"none\"]).optional(),\n REPLO_INTERNAL_REVALIDATE_SECRET: z.string().optional(),\n CART_AUTH_SECRET: z.string().optional(),\n});\n\nexport const getEnv = async (): Promise<Env> => {\n const { env } = await getCloudflareContext({ async: true });\n return envSchema.parse(env);\n};\n"],
5
+ "mappings": "AAAA,SAAS,4BAA4B;AACrC,SAAS,SAAS;AAiClB,MAAM,YAAY,EAAE,OAAO;AAAA,EACzB,iBAAiB,EAAE,OAAO,EAAE,IAAI,CAAC;AAAA,EACjC,YAAY,EAAE,OAAO,EAAE,KAAK;AAAA,EAC5B,wBAAwB,EAAE,OAAO,EAAE,SAAS;AAAA,EAC5C,2BAA2B,EAAE,OAAO,EAAE,SAAS;AAAA,EAC/C,aAAa,EAAE,OAAO,EAAE,SAAS;AAAA,EACjC,iCAAiC,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS;AAAA,EAChE,2BAA2B,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS;AAAA,EAC1D,mBAAmB,EAAE,KAAK,CAAC,WAAW,UAAU,MAAM,CAAC,EAAE,SAAS;AAAA,EAClE,kCAAkC,EAAE,OAAO,EAAE,SAAS;AAAA,EACtD,kBAAkB,EAAE,OAAO,EAAE,SAAS;AACxC,CAAC;AAEM,MAAM,SAAS,YAA0B;AAC9C,QAAM,EAAE,IAAI,IAAI,MAAM,qBAAqB,EAAE,OAAO,KAAK,CAAC;AAC1D,SAAO,UAAU,MAAM,GAAG;AAC5B;",
6
6
  "names": []
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@replohq/canopy-sdk",
3
- "version": "0.3.0",
3
+ "version": "0.4.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,
@@ -1,5 +1,6 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { AnalyticsProvider } from "../analytics/analytics-provider";
3
+ import { ReploFirstPartyPixel } from "../analytics/replo-first-party-pixel";
3
4
  import { CartLoader } from "../cart/cart-loader";
4
5
  import { ClientErrorBoundary } from "../editor/ClientErrorBoundary";
5
6
  import { DesignLibraryPreview } from "../editor/design-library-preview/DesignLibraryPreview";
@@ -8,13 +9,16 @@ import PostHogRelay from "../editor/posthog-relay";
8
9
  import { EditorSelection } from "../editor/select-mode/EditorSelection";
9
10
  import { QueryProvider } from "./query-provider";
10
11
  function ReploProvider({ children }) {
11
- return /* @__PURE__ */ jsx(QueryProvider, { children: /* @__PURE__ */ jsx(AnalyticsProvider, { children: /* @__PURE__ */ jsx(CartLoader, { children: /* @__PURE__ */ jsxs(ClientErrorBoundary, { children: [
12
- /* @__PURE__ */ jsx(LinkInterceptor, {}),
13
- /* @__PURE__ */ jsx(PostHogRelay, {}),
14
- /* @__PURE__ */ jsx(EditorSelection, {}),
15
- /* @__PURE__ */ jsx(DesignLibraryPreview, {}),
16
- children
17
- ] }) }) }) });
12
+ return /* @__PURE__ */ jsx(QueryProvider, { children: /* @__PURE__ */ jsxs(AnalyticsProvider, { children: [
13
+ /* @__PURE__ */ jsx(ReploFirstPartyPixel, {}),
14
+ /* @__PURE__ */ jsx(CartLoader, { children: /* @__PURE__ */ jsxs(ClientErrorBoundary, { children: [
15
+ /* @__PURE__ */ jsx(LinkInterceptor, {}),
16
+ /* @__PURE__ */ jsx(PostHogRelay, {}),
17
+ /* @__PURE__ */ jsx(EditorSelection, {}),
18
+ /* @__PURE__ */ jsx(DesignLibraryPreview, {}),
19
+ children
20
+ ] }) })
21
+ ] }) });
18
22
  }
19
23
  export {
20
24
  ReploProvider
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../providers/replo-provider.tsx"],
4
- "sourcesContent": ["import { AnalyticsProvider } from \"../analytics/analytics-provider\";\nimport { CartLoader } from \"../cart/cart-loader\";\nimport { ClientErrorBoundary } from \"../editor/ClientErrorBoundary\";\nimport { DesignLibraryPreview } from \"../editor/design-library-preview/DesignLibraryPreview\";\nimport LinkInterceptor from \"../editor/LinkInterceptor\";\nimport PostHogRelay from \"../editor/posthog-relay\";\nimport { EditorSelection } from \"../editor/select-mode/EditorSelection\";\nimport { QueryProvider } from \"./query-provider\";\n\nexport function ReploProvider({ children }: React.PropsWithChildren) {\n return (\n <QueryProvider>\n <AnalyticsProvider>\n <CartLoader>\n <ClientErrorBoundary>\n <LinkInterceptor />\n <PostHogRelay />\n <EditorSelection />\n <DesignLibraryPreview />\n {children}\n </ClientErrorBoundary>\n </CartLoader>\n </AnalyticsProvider>\n </QueryProvider>\n );\n}\n"],
5
- "mappings": "AAcU,SACE,KADF;AAdV,SAAS,yBAAyB;AAClC,SAAS,kBAAkB;AAC3B,SAAS,2BAA2B;AACpC,SAAS,4BAA4B;AACrC,OAAO,qBAAqB;AAC5B,OAAO,kBAAkB;AACzB,SAAS,uBAAuB;AAChC,SAAS,qBAAqB;AAEvB,SAAS,cAAc,EAAE,SAAS,GAA4B;AACnE,SACE,oBAAC,iBACC,8BAAC,qBACC,8BAAC,cACC,+BAAC,uBACC;AAAA,wBAAC,mBAAgB;AAAA,IACjB,oBAAC,gBAAa;AAAA,IACd,oBAAC,mBAAgB;AAAA,IACjB,oBAAC,wBAAqB;AAAA,IACrB;AAAA,KACH,GACF,GACF,GACF;AAEJ;",
4
+ "sourcesContent": ["import { AnalyticsProvider } from \"../analytics/analytics-provider\";\nimport { ReploFirstPartyPixel } from \"../analytics/replo-first-party-pixel\";\nimport { CartLoader } from \"../cart/cart-loader\";\nimport { ClientErrorBoundary } from \"../editor/ClientErrorBoundary\";\nimport { DesignLibraryPreview } from \"../editor/design-library-preview/DesignLibraryPreview\";\nimport LinkInterceptor from \"../editor/LinkInterceptor\";\nimport PostHogRelay from \"../editor/posthog-relay\";\nimport { EditorSelection } from \"../editor/select-mode/EditorSelection\";\nimport { QueryProvider } from \"./query-provider\";\n\nexport function ReploProvider({ children }: React.PropsWithChildren) {\n return (\n <QueryProvider>\n <AnalyticsProvider>\n <ReploFirstPartyPixel />\n <CartLoader>\n <ClientErrorBoundary>\n <LinkInterceptor />\n <PostHogRelay />\n <EditorSelection />\n <DesignLibraryPreview />\n {children}\n </ClientErrorBoundary>\n </CartLoader>\n </AnalyticsProvider>\n </QueryProvider>\n );\n}\n"],
5
+ "mappings": "AAcQ,cAEE,YAFF;AAdR,SAAS,yBAAyB;AAClC,SAAS,4BAA4B;AACrC,SAAS,kBAAkB;AAC3B,SAAS,2BAA2B;AACpC,SAAS,4BAA4B;AACrC,OAAO,qBAAqB;AAC5B,OAAO,kBAAkB;AACzB,SAAS,uBAAuB;AAChC,SAAS,qBAAqB;AAEvB,SAAS,cAAc,EAAE,SAAS,GAA4B;AACnE,SACE,oBAAC,iBACC,+BAAC,qBACC;AAAA,wBAAC,wBAAqB;AAAA,IACtB,oBAAC,cACC,+BAAC,uBACC;AAAA,0BAAC,mBAAgB;AAAA,MACjB,oBAAC,gBAAa;AAAA,MACd,oBAAC,mBAAgB;AAAA,MACjB,oBAAC,wBAAqB;AAAA,MACrB;AAAA,OACH,GACF;AAAA,KACF,GACF;AAEJ;",
6
6
  "names": []
7
7
  }