@replohq/sandbox-runtime 1.17.0 → 1.18.1

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 (38) hide show
  1. package/ClientErrorBoundary.js +26 -0
  2. package/DocumentReadyBeacon.js +5 -1
  3. package/_vendor/schemas/iframeRpcChannel.mjs +3 -541
  4. package/_vendor/schemas/previewHealthIframeRpc.d.ts +159 -0
  5. package/_vendor/schemas/previewHealthIframeRpc.mjs +123 -0
  6. package/_vendor/schemas/selectMode.d.ts +1 -1
  7. package/_vendor/schemas/selectModeIframeRpc.d.ts +5 -5
  8. package/buildMetadata.js +3 -3
  9. package/capturePage.js +5 -1
  10. package/chunk-KRA4LUIR.mjs +541 -0
  11. package/nextErrorFeed.d.ts +30 -0
  12. package/nextErrorFeed.js +64 -0
  13. package/package.json +5 -12
  14. package/previewHealth.d.ts +25 -0
  15. package/previewHealth.js +431 -0
  16. package/sandbox-runtime.js +0 -2
  17. package/select-mode/hooks/useSelectionHover.js +5 -0
  18. package/select-mode/iframeRpcChannel.d.ts +1 -1
  19. package/select-mode/section-canvas/SectionCanvas.js +80 -124
  20. package/select-mode/section-canvas/sectionCanvasStore.d.ts +0 -2
  21. package/select-mode/section-canvas/sectionCanvasStore.js +0 -15
  22. package/NextErrorReporter.d.ts +0 -1
  23. package/NextErrorReporter.js +0 -131
  24. package/_vendor/schemas/componentPreview.d.ts +0 -43
  25. package/_vendor/schemas/componentPreview.mjs +0 -79
  26. package/_vendor/schemas/generated/componentPreview.d.ts +0 -5
  27. package/_vendor/schemas/generated/componentPreview.mjs +0 -1
  28. package/_vendor/schemas/loaderKeys.d.ts +0 -69
  29. package/next/component-preview-client.d.ts +0 -8
  30. package/next/component-preview-client.js +0 -227
  31. package/next/component-preview-href.d.ts +0 -5
  32. package/next/component-preview-href.js +0 -13
  33. package/next/component-preview-props.d.ts +0 -8
  34. package/next/component-preview-props.js +0 -35
  35. package/next/component-preview.d.ts +0 -11
  36. package/next/component-preview.js +0 -83
  37. package/select-mode/section-canvas/sectionGhost.d.ts +0 -5
  38. package/select-mode/section-canvas/sectionGhost.js +0 -23
@@ -16,7 +16,6 @@ import {
16
16
  import {
17
17
  getPlacedSections,
18
18
  getSectionGaps,
19
- GHOST_WIDTH_PX,
20
19
  sectionCanvasStore,
21
20
  useSectionCanvasStore
22
21
  } from "./sectionCanvasStore";
@@ -29,10 +28,11 @@ const ACCENT_PRESSED = "#1d4ed8";
29
28
  const PILL_HEIGHT = 22;
30
29
  const PILL_SPREAD = 64;
31
30
  const PILL_HALF_WIDTH = 52;
31
+ const LABEL_HALF_WIDTH = 80;
32
32
  const SECTION_CANVAS_CSS = `
33
33
  [${SECTION_CANVAS_ATTRIBUTE}] button { all: initial; box-sizing: border-box; display: flex; align-items: center; justify-content: center; pointer-events: auto; cursor: pointer !important; color: ${ACCENT}; background: #fff !important; }
34
34
  [${SECTION_CANVAS_ATTRIBUTE}] button * { cursor: inherit !important; }
35
- [${SECTION_CANVAS_ATTRIBUTE}] [data-shape="pill"] { position: absolute; transform: translate(-50%, -50%); white-space: nowrap; border-radius: 4px; background: ${ACCENT} !important; color: #fff !important; font-family: system-ui, -apple-system, sans-serif; font-weight: 600; box-shadow: 0 2px 6px rgba(15, 23, 42, 0.2); }
35
+ [${SECTION_CANVAS_ATTRIBUTE}] [data-shape="pill"] { position: absolute; display: flex; align-items: center; transform: translate(-50%, -50%); white-space: nowrap; border-radius: 4px; background: ${ACCENT} !important; color: #fff !important; font-family: system-ui, -apple-system, sans-serif; font-weight: 600; box-shadow: 0 2px 6px rgba(15, 23, 42, 0.2); }
36
36
  [${SECTION_CANVAS_ATTRIBUTE}] button[data-shape="pill"]:hover, [${SECTION_CANVAS_ATTRIBUTE}] button[data-shape="pill"]:focus-visible { background: ${ACCENT_PRESSED} !important; color: #fff !important; }
37
37
  [${SECTION_CANVAS_ATTRIBUTE}] button[data-shape="tool"] { border-radius: 4px; gap: 4px; background: transparent !important; color: #fff !important; font-family: system-ui, -apple-system, sans-serif; font-weight: 600; }
38
38
  [${SECTION_CANVAS_ATTRIBUTE}] button[data-shape="tool"][data-grip] { cursor: grab !important; }
@@ -237,73 +237,55 @@ function SectionCanvas() {
237
237
  }
238
238
  );
239
239
  }
240
- let insertMarker = null;
241
- const insertingAt = canvas.insertingAt;
242
- if (typeof insertingAt === "number" && !drag) {
243
- const placed = getPlacedSections({ canvas, elementsByIndex });
244
- const gap = getSectionGaps(placed, canvas.sections.length).find(
245
- (candidate) => candidate.at === insertingAt
240
+ const markedGap = drag ? drag.gap : canvas.insertingAt;
241
+ let gapMarker = null;
242
+ const placed = typeof markedGap === "number" ? getPlacedSections({ canvas, elementsByIndex }) : [];
243
+ const gap = getSectionGaps(placed, canvas.sections.length).find(
244
+ (candidate) => candidate.at === markedGap
245
+ );
246
+ if (gap) {
247
+ const left = Math.max(
248
+ visible.left,
249
+ Math.min(...placed.map(({ box }) => box.left))
246
250
  );
247
- if (gap) {
248
- const left = Math.max(
249
- visible.left,
250
- Math.min(...placed.map(({ box }) => box.left))
251
- );
252
- const right = Math.min(
253
- visible.right,
254
- Math.max(...placed.map(({ box }) => box.right))
255
- );
256
- const y = Math.min(
257
- Math.max(gap.y, PILL_HEIGHT * unit),
258
- window.innerHeight - PILL_HEIGHT * unit
259
- );
260
- insertMarker = /* @__PURE__ */ jsxs(Fragment, { children: [
261
- /* @__PURE__ */ jsx(
262
- "div",
263
- {
264
- style: {
265
- position: "fixed",
266
- left,
267
- width: right - left,
268
- top: y - 1.5 * unit,
269
- height: 3 * unit,
270
- background: ACCENT
271
- }
272
- }
273
- ),
274
- /* @__PURE__ */ jsx(
275
- "div",
276
- {
277
- "data-shape": "pill",
278
- role: "status",
279
- style: {
280
- left: (left + right) / 2,
281
- top: y,
282
- height: PILL_HEIGHT * unit,
283
- padding: `0 ${10 * unit}px`,
284
- fontSize: 11 * unit,
285
- display: "flex",
286
- alignItems: "center"
287
- },
288
- children: "New Section Goes Here"
251
+ const right = Math.min(
252
+ visible.right,
253
+ Math.max(...placed.map(({ box }) => box.right))
254
+ );
255
+ const y = Math.min(
256
+ Math.max(gap.y, PILL_HEIGHT * unit),
257
+ window.innerHeight - PILL_HEIGHT * unit
258
+ );
259
+ gapMarker = /* @__PURE__ */ jsxs(Fragment, { children: [
260
+ /* @__PURE__ */ jsx(
261
+ "div",
262
+ {
263
+ "data-replo-section-drop-line": true,
264
+ style: {
265
+ position: "fixed",
266
+ left,
267
+ width: right - left,
268
+ top: y - 1.5 * unit,
269
+ height: 3 * unit,
270
+ borderRadius: 3 * unit,
271
+ background: ACCENT,
272
+ boxShadow: `0 0 0 ${unit}px #fff`
289
273
  }
290
- )
291
- ] });
292
- }
274
+ }
275
+ ),
276
+ !drag && /* @__PURE__ */ jsx(
277
+ "div",
278
+ {
279
+ "data-shape": "pill",
280
+ role: "status",
281
+ style: pillStyle({ unit, left: (left + right) / 2, top: y }),
282
+ children: "New Section Goes Here"
283
+ }
284
+ )
285
+ ] });
293
286
  }
294
287
  let dragLayer = null;
295
288
  if (drag?.isActive && activeBox) {
296
- const placed = getPlacedSections({ canvas, elementsByIndex });
297
- const gap = drag.gap === null ? null : getSectionGaps(placed, canvas.sections.length).find((candidate) => {
298
- return candidate.at === drag.gap;
299
- });
300
- const lineLeft = Math.min(...placed.map(({ box }) => box.left));
301
- const lineRight = Math.max(...placed.map(({ box }) => box.right));
302
- const ghostWidth = GHOST_WIDTH_PX * unit;
303
- const ghostHeight = Math.min(
304
- (activeBox.bottom - activeBox.top) / (activeBox.right - activeBox.left) * ghostWidth,
305
- ghostWidth * 0.75
306
- );
307
289
  dragLayer = /* @__PURE__ */ jsxs(Fragment, { children: [
308
290
  /* @__PURE__ */ jsx(
309
291
  "div",
@@ -320,61 +302,26 @@ function SectionCanvas() {
320
302
  }
321
303
  }
322
304
  ),
323
- gap && /* @__PURE__ */ jsx(
324
- "div",
325
- {
326
- "data-replo-section-drop-line": true,
327
- style: {
328
- position: "fixed",
329
- left: lineLeft,
330
- width: lineRight - lineLeft,
331
- top: Math.min(
332
- Math.max(gap.y, 3 * unit),
333
- window.innerHeight - 3 * unit
334
- ) - 1.5 * unit,
335
- height: 3 * unit,
336
- borderRadius: 3 * unit,
337
- background: ACCENT,
338
- boxShadow: `0 0 0 ${unit}px #fff`
339
- }
340
- }
341
- ),
342
305
  /* @__PURE__ */ jsx(
343
306
  "div",
344
307
  {
308
+ "data-shape": "pill",
345
309
  style: {
346
- position: "fixed",
347
- left: drag.x + 14 * unit + ghostWidth > window.innerWidth ? drag.x - 14 * unit - ghostWidth : drag.x + 14 * unit,
348
- top: Math.min(
349
- drag.y + 14 * unit,
350
- window.innerHeight - ghostHeight - 8 * unit
351
- ),
352
- width: ghostWidth,
353
- height: ghostHeight,
310
+ ...pillStyle({
311
+ unit,
312
+ left: Math.min(
313
+ Math.max(drag.x, LABEL_HALF_WIDTH * unit),
314
+ window.innerWidth - LABEL_HALF_WIDTH * unit
315
+ ),
316
+ top: drag.y + 20 * unit + PILL_HEIGHT * unit > window.innerHeight ? drag.y - 20 * unit : drag.y + 20 * unit
317
+ }),
318
+ maxWidth: 2 * LABEL_HALF_WIDTH * unit,
319
+ display: "block",
320
+ lineHeight: `${PILL_HEIGHT * unit}px`,
354
321
  overflow: "hidden",
355
- borderRadius: 6 * unit,
356
- background: "#fff",
357
- boxShadow: `0 ${8 * unit}px ${24 * unit}px rgba(15, 23, 42, 0.25), 0 0 0 ${unit}px rgba(15, 23, 42, 0.12)`,
358
- opacity: 0.95,
359
- display: "flex",
360
- alignItems: "center",
361
- justifyContent: "center",
362
- font: `500 ${12 * unit}px/1.3 system-ui, sans-serif`,
363
- color: "#3f3f46"
322
+ textOverflow: "ellipsis"
364
323
  },
365
- children: drag.ghostSrc ? /* @__PURE__ */ jsx(
366
- "img",
367
- {
368
- src: drag.ghostSrc,
369
- alt: "",
370
- style: {
371
- display: "block",
372
- width: "100%",
373
- height: "auto",
374
- alignSelf: "flex-start"
375
- }
376
- }
377
- ) : activeSection?.label ?? "Section"
324
+ children: activeSection?.label ?? "Section"
378
325
  }
379
326
  )
380
327
  ] });
@@ -397,7 +344,7 @@ function SectionCanvas() {
397
344
  onPointerDown: (event) => event.stopPropagation(),
398
345
  children: [
399
346
  /* @__PURE__ */ jsx("style", { children: SECTION_CANVAS_CSS }),
400
- insertMarker,
347
+ gapMarker,
401
348
  overlay,
402
349
  dragLayer
403
350
  ]
@@ -406,6 +353,19 @@ function SectionCanvas() {
406
353
  document.body
407
354
  );
408
355
  }
356
+ function pillStyle({
357
+ unit,
358
+ left,
359
+ top
360
+ }) {
361
+ return {
362
+ left,
363
+ top,
364
+ height: PILL_HEIGHT * unit,
365
+ padding: `0 ${10 * unit}px`,
366
+ fontSize: 11 * unit
367
+ };
368
+ }
409
369
  function SectionControls({
410
370
  index,
411
371
  label,
@@ -435,6 +395,8 @@ function SectionControls({
435
395
  ),
436
396
  visible.right - PILL_HALF_WIDTH * unit - spread
437
397
  );
398
+ const outlineLeft = Math.max(box.left, visible.left);
399
+ const outlineRight = Math.min(box.right, visible.right);
438
400
  const toolbarTop = Math.max(box.top, 0) + TOOLBAR_INSET * unit;
439
401
  const textButton = {
440
402
  height: size,
@@ -447,9 +409,9 @@ function SectionControls({
447
409
  {
448
410
  style: {
449
411
  position: "fixed",
450
- left: box.left,
412
+ left: outlineLeft,
451
413
  top: box.top,
452
- width: box.right - box.left,
414
+ width: outlineRight - outlineLeft,
453
415
  height: box.bottom - box.top,
454
416
  boxSizing: "border-box",
455
417
  border: `${2 * unit}px solid ${ACCENT}`,
@@ -471,13 +433,7 @@ function SectionControls({
471
433
  type: "button",
472
434
  "data-shape": "pill",
473
435
  "aria-label": `Add Section ${edge} ${label}`,
474
- style: {
475
- left,
476
- top,
477
- height: pillHeight,
478
- padding: `0 ${10 * unit}px`,
479
- fontSize: 11 * unit
480
- },
436
+ style: pillStyle({ unit, left, top }),
481
437
  onClick: () => actions.request({ type: "insert", at }),
482
438
  children: "Add Section"
483
439
  },
@@ -489,7 +445,7 @@ function SectionControls({
489
445
  style: {
490
446
  position: "fixed",
491
447
  top: toolbarTop,
492
- right: window.innerWidth - Math.min(box.right, visible.right) + TOOLBAR_INSET * unit,
448
+ right: window.innerWidth - outlineRight + TOOLBAR_INSET * unit,
493
449
  display: "flex",
494
450
  gap: 2 * unit,
495
451
  padding: 2 * unit,
@@ -7,7 +7,6 @@ export type SectionDrag = {
7
7
  x: number;
8
8
  y: number;
9
9
  isActive: boolean;
10
- ghostSrc: string | null;
11
10
  gap: number | null;
12
11
  };
13
12
  type PendingMove = {
@@ -52,7 +51,6 @@ type SectionCanvasStoreState = {
52
51
  }) => void;
53
52
  };
54
53
  };
55
- export declare const GHOST_WIDTH_PX = 240;
56
54
  /** On-screen sections in page order, with their boxes. */
57
55
  export declare function getPlacedSections(state: Pick<SectionCanvasStoreState, "canvas" | "elementsByIndex">): {
58
56
  section: import("../../_vendor/schemas/generated/selectModeIframeRpc").SectionCanvasSection;
@@ -8,9 +8,7 @@ import {
8
8
  startOptimisticSectionMove
9
9
  } from "./optimisticSectionMove";
10
10
  import { findSectionElements } from "./sectionElements";
11
- import { captureSectionGhost } from "./sectionGhost";
12
11
  const DRAG_THRESHOLD_PX = 4;
13
- const GHOST_WIDTH_PX = 240;
14
12
  let resolveToken = 0;
15
13
  let moveCounter = 0;
16
14
  function sameSections(previous, next) {
@@ -164,7 +162,6 @@ const sectionCanvasStore = createShallowStore(
164
162
  getWebsiteBuilderRpc()?.sectionCanvasRequest({ request });
165
163
  },
166
164
  beginDrag: ({ index, pointerId, x, y }) => {
167
- const elements = get().elementsByIndex.get(index) ?? [];
168
165
  set({
169
166
  drag: {
170
167
  index,
@@ -174,20 +171,9 @@ const sectionCanvasStore = createShallowStore(
174
171
  x,
175
172
  y,
176
173
  isActive: false,
177
- ghostSrc: null,
178
174
  gap: null
179
175
  }
180
176
  });
181
- const scale = get().canvas?.previewScale ?? 1;
182
- void captureSectionGhost({
183
- elements,
184
- width: GHOST_WIDTH_PX / scale
185
- }).then((ghostSrc) => {
186
- const drag = get().drag;
187
- if (ghostSrc && drag?.pointerId === pointerId && drag.index === index) {
188
- set({ drag: { ...drag, ghostSrc } });
189
- }
190
- });
191
177
  },
192
178
  updateDrag: ({ x, y }) => {
193
179
  const state = get();
@@ -267,7 +253,6 @@ function useSectionCanvasStore(selector) {
267
253
  return useShallowStore(sectionCanvasStore, selector);
268
254
  }
269
255
  export {
270
- GHOST_WIDTH_PX,
271
256
  getPlacedSections,
272
257
  getSectionGaps,
273
258
  sectionCanvasStore,
@@ -1 +0,0 @@
1
- export declare function NextErrorReporter(): null;
@@ -1,131 +0,0 @@
1
- "use client";
2
- import * as React from "react";
3
- import {
4
- isAllowedEditorMessage,
5
- isAllowedEditorOrigin
6
- } from "./annotations/bridgeGate";
7
- const ERRORED_BADGE_SELECTOR = '[data-next-badge][data-error="true"]';
8
- const COLLECTED_ISSUE_SELECTOR = "[data-nextjs-dialog]";
9
- const CLOSED_DIALOG_OVERLAY_SELECTOR = '[data-nextjs-dialog-overlay][data-rendered="false"]';
10
- const RED_CHROME_SELECTOR = `${ERRORED_BADGE_SELECTOR}, ${COLLECTED_ISSUE_SELECTOR}`;
11
- const STATUS_LATCH_MS = 500;
12
- function findInitialEditorOrigin() {
13
- if (window.self === window.top) {
14
- return null;
15
- }
16
- const ancestorOrigin = "ancestorOrigins" in window.location ? window.location.ancestorOrigins.item(0) : null;
17
- return [ancestorOrigin, getOriginOrNull(document.referrer)].find((origin) => {
18
- return origin !== null && isAllowedEditorOrigin(origin);
19
- }) ?? null;
20
- }
21
- function getOriginOrNull(url) {
22
- try {
23
- return new URL(url).origin;
24
- } catch {
25
- return null;
26
- }
27
- }
28
- function NextErrorReporter() {
29
- React.useEffect(() => {
30
- let editorOrigin = findInitialEditorOrigin();
31
- let lastStatus = null;
32
- let shadowObserver = null;
33
- let observedRoot = null;
34
- let pendingPost = null;
35
- const deliver = () => {
36
- if (editorOrigin === null || lastStatus === null) {
37
- return;
38
- }
39
- window.parent.postMessage(
40
- {
41
- type: "replo:preview:status",
42
- route: window.location.pathname,
43
- status: lastStatus
44
- },
45
- editorOrigin
46
- );
47
- };
48
- const postNow = (status) => {
49
- if (lastStatus === status) {
50
- return;
51
- }
52
- lastStatus = status;
53
- deliver();
54
- };
55
- const handleParentMessage = (event) => {
56
- if (event.source !== window.parent || !isAllowedEditorMessage(event)) {
57
- return;
58
- }
59
- if (event.origin === editorOrigin) {
60
- return;
61
- }
62
- editorOrigin = event.origin;
63
- deliver();
64
- };
65
- window.addEventListener("message", handleParentMessage);
66
- const post = (status) => {
67
- if (pendingPost) {
68
- if (pendingPost.status === status) {
69
- return;
70
- }
71
- window.clearTimeout(pendingPost.timeoutId);
72
- pendingPost = null;
73
- }
74
- if (lastStatus === status) {
75
- return;
76
- }
77
- if (lastStatus === null && status === "ok") {
78
- postNow(status);
79
- return;
80
- }
81
- const timeoutId = window.setTimeout(() => {
82
- pendingPost = null;
83
- postNow(status);
84
- }, STATUS_LATCH_MS);
85
- pendingPost = { status, timeoutId };
86
- };
87
- const syncOverlayState = () => {
88
- const portal = document.getElementsByTagName("nextjs-portal")[0];
89
- if (!(portal instanceof HTMLElement)) {
90
- post("ok");
91
- return;
92
- }
93
- const root = portal.shadowRoot;
94
- if (root && root !== observedRoot) {
95
- shadowObserver?.disconnect();
96
- shadowObserver = new MutationObserver(syncOverlayState);
97
- shadowObserver.observe(root, {
98
- childList: true,
99
- subtree: true,
100
- characterData: true,
101
- attributes: true,
102
- attributeFilter: ["data-error", "data-rendered"]
103
- });
104
- observedRoot = root;
105
- }
106
- portal.style.display = root?.querySelector(RED_CHROME_SELECTOR) ? "none" : "";
107
- const dialog = root?.querySelector(COLLECTED_ISSUE_SELECTOR) ?? null;
108
- post(
109
- dialog && !dialog.closest(CLOSED_DIALOG_OVERLAY_SELECTOR) ? "error" : "ok"
110
- );
111
- };
112
- const lightObserver = new MutationObserver(syncOverlayState);
113
- lightObserver.observe(document.documentElement, {
114
- childList: true,
115
- subtree: true
116
- });
117
- syncOverlayState();
118
- return () => {
119
- window.removeEventListener("message", handleParentMessage);
120
- lightObserver.disconnect();
121
- shadowObserver?.disconnect();
122
- if (pendingPost) {
123
- window.clearTimeout(pendingPost.timeoutId);
124
- }
125
- };
126
- }, []);
127
- return null;
128
- }
129
- export {
130
- NextErrorReporter
131
- };
@@ -1,43 +0,0 @@
1
- import * as z from "zod";
2
- export declare const MAX_COMPONENT_PREVIEW_PROPS_BYTES: number;
3
- export declare const componentPreviewPropNameSchema: z.ZodString;
4
- export declare const componentPreviewPropsSchema: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
5
- export declare const COMPONENT_PREVIEW_IFRAME_RPC_CHANNEL_ID: "replo:component-preview-iframe-rpc";
6
- export declare const COMPONENT_PREVIEW_IFRAME_RPC_CHANNEL_VERSION: 2;
7
- export declare const COMPONENT_PREVIEW_PARENT_ORIGIN_PARAM = "reploParentOrigin";
8
- export declare const websiteBuilderToComponentPreviewMethodConfig: {
9
- setProps: {
10
- inputSchema: z.ZodObject<{
11
- props: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
12
- sourceRevision: z.ZodString;
13
- }, z.core.$strip>;
14
- outputSchema: z.ZodObject<{
15
- mode: z.ZodEnum<{
16
- client: "client";
17
- navigation: "navigation";
18
- unchanged: "unchanged";
19
- }>;
20
- }, z.core.$strip>;
21
- timeoutMs: number;
22
- };
23
- };
24
- export declare const componentPreviewToWebsiteBuilderMethodConfig: {
25
- contentBoundsChanged: {
26
- inputSchema: z.ZodObject<{
27
- height: z.ZodNumber;
28
- }, z.core.$strip>;
29
- outputSchema: z.ZodVoid;
30
- };
31
- iframeReady: {
32
- inputSchema: z.ZodUndefined;
33
- outputSchema: z.ZodVoid;
34
- };
35
- };
36
- export declare const componentPreviewProductReferenceSchema: z.ZodObject<{
37
- type: z.ZodLiteral<"product">;
38
- loaderKey: z.ZodEnum<{
39
- "shopify_storefront.product": "shopify_storefront.product";
40
- "replo_products.product": "replo_products.product";
41
- }>;
42
- productId: z.ZodString;
43
- }, z.core.$strict>;
@@ -1,79 +0,0 @@
1
- import * as z2 from 'zod';
2
-
3
- var DATA_LOADER_KEYS = {
4
- SHOPIFY_INTEGRATION_DETAILS: "shopify_storefront.integration_details",
5
- SHOPIFY_PRODUCT: "shopify_storefront.product",
6
- SHOPIFY_COLLECTION: "shopify_storefront.collection",
7
- SHOPIFY_COLLECTION_PRODUCTS: "shopify_storefront.collection_products",
8
- SHOPIFY_METAOBJECT: "shopify_storefront.metaobject",
9
- SHOPIFY_METAOBJECTS: "shopify_storefront.metaobjects",
10
- SHOPIFY_KACHING_BUNDLES: "shopify_storefront.kaching_bundles",
11
- REPLO_PRODUCT: "replo_products.product",
12
- OKENDO_PRODUCT_REVIEWS: "okendo.product_reviews",
13
- OKENDO_PRODUCT_REVIEW_AGGREGATE: "okendo.product_review_aggregate",
14
- REBUY_RECOMMENDATIONS: "rebuy.recommendations",
15
- LEVANTA_PRODUCT: "levanta_products.product",
16
- SMILE_IO_VIP_TIERS: "smile_io.vip_tiers",
17
- SMILE_IO_EARNING_RULES: "smile_io.earning_rules",
18
- SMILE_IO_REWARDS: "smile_io.rewards",
19
- YOTPO_PRODUCT_REVIEWS: "yotpo.product_reviews",
20
- YOTPO_PRODUCT_REVIEW_AGGREGATE: "yotpo.product_review_aggregate",
21
- REVIEWS_IO_PRODUCT_REVIEWS: "reviews_io.product_reviews",
22
- REVIEWS_IO_PRODUCT_REVIEW_AGGREGATE: "reviews_io.product_review_aggregate",
23
- LOOX_PRODUCT_REVIEWS: "loox.product_reviews",
24
- LOOX_PRODUCT_REVIEW_AGGREGATE: "loox.product_review_aggregate",
25
- JUDGEME_PRODUCT_REVIEWS: "judgeme.product_reviews",
26
- JUDGEME_PRODUCT_REVIEW_AGGREGATE: "judgeme.product_review_aggregate",
27
- STATSIG_EXPERIMENT: "statsig.experiment",
28
- CONTENTFUL_ENTRY: "contentful.entry",
29
- CONTENTFUL_ENTRIES: "contentful.entries"
30
- };
31
- z2.enum(Object.values(DATA_LOADER_KEYS));
32
-
33
- var MAX_COMPONENT_PREVIEW_PROPS_BYTES = 16 * 1024;
34
- var componentPreviewPropNameSchema = z2.string().min(1).max(80).regex(/^[A-Za-z_$][\w$]*$/u).refine((name) => {
35
- return !["__proto__", "constructor", "dangerouslySetInnerHTML"].includes(
36
- name
37
- );
38
- }, "Unsafe prop name");
39
- var componentPreviewPropsSchema = z2.record(
40
- componentPreviewPropNameSchema,
41
- z2.json()
42
- );
43
- var COMPONENT_PREVIEW_IFRAME_RPC_CHANNEL_ID = "replo:component-preview-iframe-rpc";
44
- var COMPONENT_PREVIEW_IFRAME_RPC_CHANNEL_VERSION = 2;
45
- var COMPONENT_PREVIEW_PARENT_ORIGIN_PARAM = "reploParentOrigin";
46
- var websiteBuilderToComponentPreviewMethodConfig = {
47
- setProps: {
48
- inputSchema: z2.object({
49
- props: componentPreviewPropsSchema,
50
- sourceRevision: z2.string().min(1)
51
- }),
52
- outputSchema: z2.object({
53
- mode: z2.enum(["client", "navigation", "unchanged"])
54
- }),
55
- timeoutMs: 1e4
56
- }
57
- };
58
- var componentPreviewToWebsiteBuilderMethodConfig = {
59
- contentBoundsChanged: {
60
- inputSchema: z2.object({
61
- height: z2.number().finite().min(0).max(1e5)
62
- }),
63
- outputSchema: z2.void()
64
- },
65
- iframeReady: {
66
- inputSchema: z2.undefined(),
67
- outputSchema: z2.void()
68
- }
69
- };
70
- var componentPreviewProductReferenceSchema = z2.object({
71
- type: z2.literal("product"),
72
- loaderKey: z2.enum([
73
- DATA_LOADER_KEYS.SHOPIFY_PRODUCT,
74
- DATA_LOADER_KEYS.REPLO_PRODUCT
75
- ]),
76
- productId: z2.string().min(1)
77
- }).strict().describe("ComponentPreviewProductReference");
78
-
79
- export { COMPONENT_PREVIEW_IFRAME_RPC_CHANNEL_ID, COMPONENT_PREVIEW_IFRAME_RPC_CHANNEL_VERSION, COMPONENT_PREVIEW_PARENT_ORIGIN_PARAM, MAX_COMPONENT_PREVIEW_PROPS_BYTES, componentPreviewProductReferenceSchema, componentPreviewPropNameSchema, componentPreviewPropsSchema, componentPreviewToWebsiteBuilderMethodConfig, websiteBuilderToComponentPreviewMethodConfig };
@@ -1,5 +0,0 @@
1
- export type ComponentPreviewProductReference = {
2
- type: "product";
3
- loaderKey: "shopify_storefront.product" | "replo_products.product";
4
- productId: string;
5
- };