@amplifyup/sdk 0.2.1 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/react.d.mts CHANGED
@@ -88,7 +88,7 @@ declare function useComposerPreviewFlag(force?: boolean): boolean;
88
88
  * }
89
89
  * ```
90
90
  */
91
- declare function Slot({ name, className, }: {
91
+ declare function Slot({ name, className }: {
92
92
  name: string;
93
93
  className?: string;
94
94
  }): react_jsx_runtime.JSX.Element | null;
package/dist/react.d.ts CHANGED
@@ -88,7 +88,7 @@ declare function useComposerPreviewFlag(force?: boolean): boolean;
88
88
  * }
89
89
  * ```
90
90
  */
91
- declare function Slot({ name, className, }: {
91
+ declare function Slot({ name, className }: {
92
92
  name: string;
93
93
  className?: string;
94
94
  }): react_jsx_runtime.JSX.Element | null;
package/dist/react.js CHANGED
@@ -427,7 +427,7 @@ function isComposerPreview() {
427
427
  if (window.self !== window.top && document.referrer) {
428
428
  try {
429
429
  const refUrl = new URL(document.referrer);
430
- if (refUrl.hostname === "amplifyup.ai" || refUrl.hostname.endsWith(".amplifyup.ai") || refUrl.hostname === "localhost" && refUrl.port === "5001" || refUrl.pathname.includes("/dashboard/composer") || refUrl.pathname.includes("/dashboard/routes/")) {
430
+ if (refUrl.hostname === "amplifyup.ai" || refUrl.hostname.endsWith(".amplifyup.ai") || refUrl.hostname === "localhost" && refUrl.port === "5001" || refUrl.pathname.includes("/dashboard/composer")) {
431
431
  return true;
432
432
  }
433
433
  } catch {
@@ -1069,7 +1069,8 @@ function layoutProviderCacheKey(opts) {
1069
1069
  opts.preview ? "1" : "0",
1070
1070
  opts.working ? "1" : "0",
1071
1071
  opts.zoneId || "",
1072
- opts.compositionId || ""
1072
+ opts.compositionId || "",
1073
+ opts.layoutId || ""
1073
1074
  ].join("|");
1074
1075
  }
1075
1076
  function getSettledLayoutProvider(key) {
@@ -1586,7 +1587,7 @@ var AmplifyUpSDK = class {
1586
1587
  if (document.referrer) {
1587
1588
  try {
1588
1589
  const referrerUrl = new URL(document.referrer);
1589
- if (referrerUrl.hostname === "localhost" && referrerUrl.port === "5001" || referrerUrl.pathname.includes("/dashboard/composer") || referrerUrl.pathname.includes("/dashboard/routes/")) {
1590
+ if (referrerUrl.hostname === "localhost" && referrerUrl.port === "5001" || referrerUrl.pathname.includes("/dashboard/composer")) {
1590
1591
  return true;
1591
1592
  }
1592
1593
  } catch {
@@ -1863,11 +1864,7 @@ var AmplifyUpSDK = class {
1863
1864
  this.page(resumePath, { resumed: true });
1864
1865
  this.lastTrackedPath = resumePath;
1865
1866
  if (this.config?.debug) {
1866
- console.log(
1867
- "[AmplifyUp SDK] Idle resume page view",
1868
- resumePath,
1869
- `(hidden ${Math.round(idleMs / 6e4)}m)`
1870
- );
1867
+ console.log("[AmplifyUp SDK] Idle resume page view", resumePath, `(hidden ${Math.round(idleMs / 6e4)}m)`);
1871
1868
  }
1872
1869
  }
1873
1870
  noteActivity();
@@ -1887,12 +1884,7 @@ var AmplifyUpSDK = class {
1887
1884
  }
1888
1885
  state.visibleSince = null;
1889
1886
  };
1890
- const activityEvents = [
1891
- "pointerdown",
1892
- "keydown",
1893
- "scroll",
1894
- "touchstart"
1895
- ];
1887
+ const activityEvents = ["pointerdown", "keydown", "scroll", "touchstart"];
1896
1888
  const onActivity = () => noteActivity();
1897
1889
  window.addEventListener("scroll", onScroll, { passive: true });
1898
1890
  document.addEventListener("visibilitychange", onVisibility);
@@ -2040,11 +2032,7 @@ var AmplifyUpSDK = class {
2040
2032
  hosts.forEach((host) => observer.observe(host));
2041
2033
  this.componentViewObservers.push(observer);
2042
2034
  if (this.config?.debug) {
2043
- console.log(
2044
- "[AmplifyUp SDK] Component View tracking enabled for",
2045
- hosts.length,
2046
- "hosts"
2047
- );
2035
+ console.log("[AmplifyUp SDK] Component View tracking enabled for", hosts.length, "hosts");
2048
2036
  }
2049
2037
  }
2050
2038
  cleanupComponentViewTracking() {
@@ -2516,6 +2504,8 @@ Available Console Commands:
2516
2504
  const compositionId = pageSearch.get("compositionId");
2517
2505
  if (zoneId) params.set("zoneId", zoneId);
2518
2506
  if (compositionId) params.set("compositionId", compositionId);
2507
+ const layoutId = pageSearch.get("layoutId");
2508
+ if (layoutId) params.set("layoutId", layoutId);
2519
2509
  }
2520
2510
  }
2521
2511
  if (isOnOrchestratorOrigin) {
@@ -2536,7 +2526,8 @@ Available Console Commands:
2536
2526
  preview,
2537
2527
  working: pageSearch ? isWorkingContentRequest(pageSearch) : false,
2538
2528
  zoneId: pageSearch?.get("zoneId"),
2539
- compositionId: pageSearch?.get("compositionId")
2529
+ compositionId: pageSearch?.get("compositionId"),
2530
+ layoutId: pageSearch?.get("layoutId")
2540
2531
  });
2541
2532
  return dedupeLayoutProviderFetch(cacheKey, async () => {
2542
2533
  const startedAt = Date.now();
@@ -2618,15 +2609,11 @@ Available Console Commands:
2618
2609
  ) : document;
2619
2610
  if (!scopeRoot) {
2620
2611
  if (this.config?.debug) {
2621
- console.log(
2622
- `[AmplifyUp SDK] Component host not found for ${eventConfig.componentId}`
2623
- );
2612
+ console.log(`[AmplifyUp SDK] Component host not found for ${eventConfig.componentId}`);
2624
2613
  }
2625
2614
  return;
2626
2615
  }
2627
- targetElements = Array.from(
2628
- scopeRoot.querySelectorAll(eventConfig.selector)
2629
- );
2616
+ targetElements = Array.from(scopeRoot.querySelectorAll(eventConfig.selector));
2630
2617
  if (scopeRoot instanceof Element && scopeRoot !== document.documentElement && scopeRoot.matches?.(eventConfig.selector)) {
2631
2618
  targetElements.unshift(scopeRoot);
2632
2619
  }
@@ -2659,7 +2646,9 @@ Available Console Commands:
2659
2646
  });
2660
2647
  }
2661
2648
  if (this.config?.debug) {
2662
- console.log(`[AmplifyUp SDK] Attached ${eventConfig.eventType} listener for ${eventConfig.eventName} on selector: ${eventConfig.selector}`);
2649
+ console.log(
2650
+ `[AmplifyUp SDK] Attached ${eventConfig.eventType} listener for ${eventConfig.eventName} on selector: ${eventConfig.selector}`
2651
+ );
2663
2652
  }
2664
2653
  });
2665
2654
  });
@@ -2669,16 +2658,16 @@ Available Console Commands:
2669
2658
  */
2670
2659
  mapEventType(eventType) {
2671
2660
  const eventMap = {
2672
- "click": "click",
2673
- "submit": "submit",
2674
- "focus": "focus",
2675
- "blur": "blur",
2676
- "hover": "mouseenter",
2677
- "change": "change",
2678
- "scroll": "scroll",
2679
- "view": "view",
2661
+ click: "click",
2662
+ submit: "submit",
2663
+ focus: "focus",
2664
+ blur: "blur",
2665
+ hover: "mouseenter",
2666
+ change: "change",
2667
+ scroll: "scroll",
2668
+ view: "view",
2680
2669
  // Handled separately with IntersectionObserver
2681
- "custom": "custom"
2670
+ custom: "custom"
2682
2671
  };
2683
2672
  return eventMap[eventType] || eventType;
2684
2673
  }
@@ -2754,11 +2743,7 @@ Available Console Commands:
2754
2743
  (entries) => {
2755
2744
  entries.forEach((entry) => {
2756
2745
  if (entry.isIntersecting) {
2757
- this.handleTrackedEvent(
2758
- new CustomEvent("view"),
2759
- config,
2760
- element
2761
- );
2746
+ this.handleTrackedEvent(new CustomEvent("view"), config, element);
2762
2747
  observer.unobserve(element);
2763
2748
  }
2764
2749
  });
@@ -2901,21 +2886,15 @@ Available Console Commands:
2901
2886
  return;
2902
2887
  }
2903
2888
  if (event.data?.type === "AMPLIFYUP_FIELD_PATCH") {
2904
- window.dispatchEvent(
2905
- new CustomEvent("amplifyup:field-patch", { detail: event.data })
2906
- );
2889
+ window.dispatchEvent(new CustomEvent("amplifyup:field-patch", { detail: event.data }));
2907
2890
  return;
2908
2891
  }
2909
2892
  if (event.data?.type === "AMPLIFYUP_PROPS_PATCH") {
2910
- window.dispatchEvent(
2911
- new CustomEvent("amplifyup:props-patch", { detail: event.data })
2912
- );
2893
+ window.dispatchEvent(new CustomEvent("amplifyup:props-patch", { detail: event.data }));
2913
2894
  return;
2914
2895
  }
2915
2896
  if (event.data?.type === "AMPLIFYUP_LAYOUT_PATCH") {
2916
- window.dispatchEvent(
2917
- new CustomEvent("amplifyup:layout-patch", { detail: event.data })
2918
- );
2897
+ window.dispatchEvent(new CustomEvent("amplifyup:layout-patch", { detail: event.data }));
2919
2898
  return;
2920
2899
  }
2921
2900
  if (event.data?.type === "COMPONENT_DELETABLE_STATUS") {
@@ -2978,9 +2957,7 @@ Available Console Commands:
2978
2957
  const { componentId, slotName, nodeId, isPageSlot } = event.data;
2979
2958
  let element = null;
2980
2959
  if (isPageSlot || slotName === "main" && !nodeId && !componentId) {
2981
- element = document.querySelector(
2982
- '[data-slot-source="page"]'
2983
- );
2960
+ element = document.querySelector('[data-slot-source="page"]');
2984
2961
  }
2985
2962
  if (!element && nodeId && slotName) {
2986
2963
  element = document.querySelector(
@@ -2988,9 +2965,7 @@ Available Console Commands:
2988
2965
  );
2989
2966
  }
2990
2967
  if (!element && nodeId && !slotName) {
2991
- element = document.querySelector(
2992
- `[data-node-id="${nodeId}"]`
2993
- );
2968
+ element = document.querySelector(`[data-node-id="${nodeId}"]`);
2994
2969
  }
2995
2970
  if (!element && slotName) {
2996
2971
  element = document.querySelector(
@@ -3031,30 +3006,33 @@ Available Console Commands:
3031
3006
  };
3032
3007
  if (window.parent && window.parent !== window) {
3033
3008
  const hierarchyEls = this.buildComponentHierarchy(element);
3034
- window.parent.postMessage({
3035
- type: "ELEMENT_POSITION",
3036
- componentId: componentId || null,
3037
- slotName: slotName || null,
3038
- nodeId: nodeId || null,
3039
- isPageSlot: !!isPageSlot || element.getAttribute("data-slot-source") === "page",
3040
- hierarchy: hierarchyEls.map((el, index) => {
3041
- const elComponentId = el.getAttribute("data-amplifyup-component") || el.getAttribute("data-component-id");
3042
- const elSlotName = el.getAttribute("data-amplifyup-slot") || el.getAttribute("data-slot-id");
3043
- const isSlot = !elComponentId && !!elSlotName;
3044
- const pageSlot = isSlot && el.getAttribute("data-slot-source") === "page";
3045
- return {
3046
- index,
3047
- componentId: elComponentId,
3048
- componentName: pageSlot ? "Page" : el.getAttribute("data-component-name"),
3049
- slotName: isSlot ? elSlotName : null,
3050
- isSlot,
3051
- isPageSlot: pageSlot,
3052
- nodeId: el.getAttribute("data-node-id") || (isSlot ? el.getAttribute("data-parent-node-id") : null)
3053
- };
3054
- }),
3055
- position,
3056
- bounds
3057
- }, "*");
3009
+ window.parent.postMessage(
3010
+ {
3011
+ type: "ELEMENT_POSITION",
3012
+ componentId: componentId || null,
3013
+ slotName: slotName || null,
3014
+ nodeId: nodeId || null,
3015
+ isPageSlot: !!isPageSlot || element.getAttribute("data-slot-source") === "page",
3016
+ hierarchy: hierarchyEls.map((el, index) => {
3017
+ const elComponentId = el.getAttribute("data-amplifyup-component") || el.getAttribute("data-component-id");
3018
+ const elSlotName = el.getAttribute("data-amplifyup-slot") || el.getAttribute("data-slot-id");
3019
+ const isSlot = !elComponentId && !!elSlotName;
3020
+ const pageSlot = isSlot && el.getAttribute("data-slot-source") === "page";
3021
+ return {
3022
+ index,
3023
+ componentId: elComponentId,
3024
+ componentName: pageSlot ? "Page" : el.getAttribute("data-component-name"),
3025
+ slotName: isSlot ? elSlotName : null,
3026
+ isSlot,
3027
+ isPageSlot: pageSlot,
3028
+ nodeId: el.getAttribute("data-node-id") || (isSlot ? el.getAttribute("data-parent-node-id") : null)
3029
+ };
3030
+ }),
3031
+ position,
3032
+ bounds
3033
+ },
3034
+ "*"
3035
+ );
3058
3036
  }
3059
3037
  } else {
3060
3038
  console.warn("[AmplifyUp SDK] Element not found for position request");
@@ -3070,7 +3048,11 @@ Available Console Commands:
3070
3048
  switch (message.type) {
3071
3049
  case "ENABLE_HIGHLIGHTING":
3072
3050
  case "UPDATE_HIGHLIGHTING":
3073
- console.log("[AmplifyUp SDK] Enabling highlighting with registry:", message.componentRegistry?.length || 0, "components");
3051
+ console.log(
3052
+ "[AmplifyUp SDK] Enabling highlighting with registry:",
3053
+ message.componentRegistry?.length || 0,
3054
+ "components"
3055
+ );
3074
3056
  this.enableHighlighting(
3075
3057
  message.componentRegistry || [],
3076
3058
  message.highlightComponents ?? true,
@@ -3130,12 +3112,15 @@ Available Console Commands:
3130
3112
  const tagName = target.tagName.toLowerCase();
3131
3113
  const text = (target.textContent || "").replace(/\s+/g, " ").trim().substring(0, 80);
3132
3114
  if (window.parent && window.parent !== window) {
3133
- window.parent.postMessage({
3134
- type: "ELEMENT_CLICKED_FOR_EVENT",
3135
- selector,
3136
- tagName,
3137
- text
3138
- }, "*");
3115
+ window.parent.postMessage(
3116
+ {
3117
+ type: "ELEMENT_CLICKED_FOR_EVENT",
3118
+ selector,
3119
+ tagName,
3120
+ text
3121
+ },
3122
+ "*"
3123
+ );
3139
3124
  }
3140
3125
  };
3141
3126
  document.addEventListener("click", this.eventSelectionClickHandler, true);
@@ -3161,9 +3146,7 @@ Available Console Commands:
3161
3146
  return "[" + attr.name + '="' + attr.value + '"]';
3162
3147
  }
3163
3148
  if (el.className && typeof el.className === "string") {
3164
- const classes = el.className.split(" ").filter(
3165
- (c) => c && !c.startsWith("has-") && !c.includes("selectable") && !c.includes("selected")
3166
- );
3149
+ const classes = el.className.split(" ").filter((c) => c && !c.startsWith("has-") && !c.includes("selectable") && !c.includes("selected"));
3167
3150
  if (classes.length > 0) {
3168
3151
  return el.tagName.toLowerCase() + "." + classes[0];
3169
3152
  }
@@ -3213,9 +3196,7 @@ Available Console Commands:
3213
3196
  }
3214
3197
  });
3215
3198
  if (containing.length === 0) return null;
3216
- const innermost = containing.filter(
3217
- (el) => !containing.some((other) => other !== el && el.contains(other))
3218
- );
3199
+ const innermost = containing.filter((el) => !containing.some((other) => other !== el && el.contains(other)));
3219
3200
  if (innermost.length === 1) return innermost[0];
3220
3201
  let best = innermost[0];
3221
3202
  let bestArea = Infinity;
@@ -3332,9 +3313,7 @@ Available Console Commands:
3332
3313
  */
3333
3314
  enableHighlighting(componentRegistry, highlightComponents, showZones) {
3334
3315
  if (typeof document === "undefined") return;
3335
- const previouslySelected = Array.from(
3336
- document.querySelectorAll(".amplifyup-selected")
3337
- );
3316
+ const previouslySelected = Array.from(document.querySelectorAll(".amplifyup-selected"));
3338
3317
  this.componentRegistry = componentRegistry;
3339
3318
  this.highlightingEnabled = true;
3340
3319
  this.highlightComponentsEnabled = highlightComponents;
@@ -3707,10 +3686,7 @@ Available Console Commands:
3707
3686
  if (shouldReapply && this.highlightingEnabled) {
3708
3687
  setTimeout(() => {
3709
3688
  if (this.highlightingEnabled) {
3710
- this.applyComponentHighlights(
3711
- this.highlightComponentsEnabled,
3712
- this.showZonesEnabled
3713
- );
3689
+ this.applyComponentHighlights(this.highlightComponentsEnabled, this.showZonesEnabled);
3714
3690
  }
3715
3691
  }, 100);
3716
3692
  }
@@ -3719,7 +3695,13 @@ Available Console Commands:
3719
3695
  childList: true,
3720
3696
  subtree: true,
3721
3697
  attributes: true,
3722
- attributeFilter: ["data-amplifyup-component", "data-component-id", "data-amplifyup-slot", "data-slot-id", "data-slot-empty"]
3698
+ attributeFilter: [
3699
+ "data-amplifyup-component",
3700
+ "data-component-id",
3701
+ "data-amplifyup-slot",
3702
+ "data-slot-id",
3703
+ "data-slot-empty"
3704
+ ]
3723
3705
  });
3724
3706
  }
3725
3707
  /**
@@ -3733,9 +3715,7 @@ Available Console Commands:
3733
3715
  this.teardownComposerDragDrop();
3734
3716
  if (opts?.clearSelection !== false && typeof window !== "undefined") {
3735
3717
  window.__AMPLIFYUP_COMPOSER_EDIT__ = false;
3736
- window.dispatchEvent(
3737
- new CustomEvent("amplifyup:composer-edit", { detail: { enabled: false } })
3738
- );
3718
+ window.dispatchEvent(new CustomEvent("amplifyup:composer-edit", { detail: { enabled: false } }));
3739
3719
  }
3740
3720
  if (this.mutationObserver) {
3741
3721
  this.mutationObserver.disconnect();
@@ -3893,7 +3873,10 @@ Available Console Commands:
3893
3873
  e.stopPropagation();
3894
3874
  this.sendSelectionMessage(htmlEl, hierarchy);
3895
3875
  if (window.parent && window.parent !== window) {
3896
- window.parent.postMessage({ type: "CHECK_COMPONENT_DELETABLE", componentId: component.component_id }, "*");
3876
+ window.parent.postMessage(
3877
+ { type: "CHECK_COMPONENT_DELETABLE", componentId: component.component_id },
3878
+ "*"
3879
+ );
3897
3880
  }
3898
3881
  };
3899
3882
  htmlEl.addEventListener("click", handleClick);
@@ -4268,23 +4251,12 @@ function ComponentContextProvider({
4268
4251
  componentId
4269
4252
  }) {
4270
4253
  const next = hydratePageResourceProps(props || {}, getPageResourceFields());
4271
- return /* @__PURE__ */ jsxRuntime.jsx(
4272
- ComponentContext.Provider,
4273
- {
4274
- value: { slots, props: next, layoutNodeId, componentId },
4275
- children
4276
- }
4277
- );
4254
+ return /* @__PURE__ */ jsxRuntime.jsx(ComponentContext.Provider, { value: { slots, props: next, layoutNodeId, componentId }, children });
4278
4255
  }
4279
- function Slot({
4280
- name,
4281
- className
4282
- }) {
4256
+ function Slot({ name, className }) {
4283
4257
  const context = React3.useContext(ComponentContext);
4284
4258
  if (!context) {
4285
- console.warn(
4286
- `[AmplifyUp SDK] Slot "${name}" only works inside a component rendered from your component registry`
4287
- );
4259
+ console.warn(`[AmplifyUp SDK] Slot "${name}" only works inside a component rendered from your component registry`);
4288
4260
  return null;
4289
4261
  }
4290
4262
  const slotContent = context.slots?.[name];
@@ -4300,21 +4272,17 @@ function Slot({
4300
4272
  window.self !== window.top && document.referrer && (() => {
4301
4273
  try {
4302
4274
  const referrerUrl = new URL(document.referrer);
4303
- return referrerUrl.hostname === "localhost" && referrerUrl.port === "5001" || referrerUrl.pathname.includes("/dashboard/composer") || referrerUrl.pathname.includes("/dashboard/routes/");
4275
+ return referrerUrl.hostname === "localhost" && referrerUrl.port === "5001" || referrerUrl.pathname.includes("/dashboard/composer");
4304
4276
  } catch {
4305
4277
  return false;
4306
4278
  }
4307
4279
  })());
4308
- sdkDebugOnce(
4309
- `slot:${context.layoutNodeId || ""}:${name}`,
4310
- `[Slot:${name}]`,
4311
- {
4312
- slotState,
4313
- isEmpty,
4314
- isEditorMode,
4315
- availableSlotKeys: context.slots ? Object.keys(context.slots) : []
4316
- }
4317
- );
4280
+ sdkDebugOnce(`slot:${context.layoutNodeId || ""}:${name}`, `[Slot:${name}]`, {
4281
+ slotState,
4282
+ isEmpty,
4283
+ isEditorMode,
4284
+ availableSlotKeys: context.slots ? Object.keys(context.slots) : []
4285
+ });
4318
4286
  return /* @__PURE__ */ jsxRuntime.jsx(
4319
4287
  "div",
4320
4288
  {
@@ -4404,18 +4372,12 @@ function canInlineEditRichText(name, value) {
4404
4372
  return true;
4405
4373
  }
4406
4374
  function useComposerEditMode() {
4407
- return React3.useSyncExternalStore(
4408
- subscribeComposerEdit,
4409
- isComposerEditMode,
4410
- getComposerEditModeServer
4411
- );
4375
+ return React3.useSyncExternalStore(subscribeComposerEdit, isComposerEditMode, getComposerEditModeServer);
4412
4376
  }
4413
4377
  function useBoundField(field, value, name, component) {
4414
4378
  const bound = resolveEditableBinding(field, value, name);
4415
4379
  if (bound.requiresName) {
4416
- console.warn(
4417
- `[AmplifyUp SDK] ${component} value={\u2026} requires name="\u2026" for computed values`
4418
- );
4380
+ console.warn(`[AmplifyUp SDK] ${component} value={\u2026} requires name="\u2026" for computed values`);
4419
4381
  }
4420
4382
  const fieldValue = useComposerFieldValue(bound.name, bound.value, bound.ref);
4421
4383
  return { editName: bound.name, fieldValue, ref: bound.ref };
@@ -4496,9 +4458,7 @@ function ComposerInlineField({
4496
4458
  const el = elRef.current;
4497
4459
  if (!el) return;
4498
4460
  if (document.activeElement === el) return;
4499
- if (el.querySelector(
4500
- "input, button, select, textarea, form, svg, iframe, img"
4501
- )) {
4461
+ if (el.querySelector("input, button, select, textarea, form, svg, iframe, img")) {
4502
4462
  return;
4503
4463
  }
4504
4464
  const next = idleDisplay || "";
@@ -4705,9 +4665,7 @@ function warnReadOnlyRowField(name) {
4705
4665
  const key = name || "(unnamed)";
4706
4666
  if (warnedReadOnlyFields.has(key)) return;
4707
4667
  warnedReadOnlyFields.add(key);
4708
- console.warn(
4709
- `[AmplifyUp SDK] ${key} has no write target; rendered read-only.`
4710
- );
4668
+ console.warn(`[AmplifyUp SDK] ${key} has no write target; rendered read-only.`);
4711
4669
  }
4712
4670
  function canComposerBind(field, ref, editName) {
4713
4671
  if (isReadOnlyRowField(field) || isFieldEnvelope(field) && field.readOnly) {
@@ -4719,9 +4677,7 @@ function canComposerBind(field, ref, editName) {
4719
4677
  function warnProjectionProps(component, hasField, hasValue, name) {
4720
4678
  if (process.env.NODE_ENV === "production") return;
4721
4679
  if (!hasField && !hasValue && !name) {
4722
- console.warn(
4723
- `[AmplifyUp SDK] ${component} needs field={fields.yourProp} (or value + name for computed values)`
4724
- );
4680
+ console.warn(`[AmplifyUp SDK] ${component} needs field={fields.yourProp} (or value + name for computed values)`);
4725
4681
  }
4726
4682
  }
4727
4683
  function hasOwnProp(props, key) {
@@ -4775,26 +4731,14 @@ function markdownToHtml(markdown) {
4775
4731
  }
4776
4732
  }
4777
4733
  function RichText(props) {
4778
- const {
4779
- field,
4780
- value,
4781
- name,
4782
- className,
4783
- as: Tag = "div",
4784
- children
4785
- } = props;
4734
+ const { field, value, name, className, as: Tag = "div", children } = props;
4786
4735
  const context = React3.useContext(ComponentContext);
4787
4736
  const composerEdit = useComposerEditMode();
4788
4737
  const childrenValue = typeof children === "string" || typeof children === "number" ? String(children) : void 0;
4789
4738
  const hasField = isFieldEnvelope(field);
4790
4739
  const hasValueProp = hasOwnProp(props, "value") || childrenValue !== void 0;
4791
4740
  const boundValue = hasOwnProp(props, "value") ? value : childrenValue !== void 0 ? childrenValue : value;
4792
- const { editName, fieldValue, ref } = useBoundField(
4793
- field,
4794
- boundValue,
4795
- name,
4796
- "RichText"
4797
- );
4741
+ const { editName, fieldValue, ref } = useBoundField(field, boundValue, name, "RichText");
4798
4742
  assertNamedEnvelope("RichText", field);
4799
4743
  if (!hasField && !hasValueProp && !name) {
4800
4744
  return null;
@@ -4896,28 +4840,14 @@ function coerceImageField(field, value, name) {
4896
4840
  };
4897
4841
  }
4898
4842
  function Image(props) {
4899
- const {
4900
- field,
4901
- value,
4902
- name,
4903
- alt: altProp,
4904
- className,
4905
- width: widthProp,
4906
- height: heightProp,
4907
- ...imgProps
4908
- } = props;
4843
+ const { field, value, name, alt: altProp, className, width: widthProp, height: heightProp, ...imgProps } = props;
4909
4844
  const context = React3.useContext(ComponentContext);
4910
4845
  assertNamedEnvelope("Image", field);
4911
4846
  const coerced = coerceImageField(field, value, name);
4912
4847
  const boundField = coerced.field;
4913
4848
  const hasField = isFieldEnvelope(boundField);
4914
4849
  const hasValue = hasOwnProp(props, "value");
4915
- const { editName, fieldValue, ref } = useBoundField(
4916
- boundField,
4917
- coerced.value,
4918
- coerced.name,
4919
- "Image"
4920
- );
4850
+ const { editName, fieldValue, ref } = useBoundField(boundField, coerced.value, coerced.name, "Image");
4921
4851
  const composerEdit = useComposerEditMode();
4922
4852
  warnProjectionProps("Image", hasField || isBrandedFields(field), hasValue, coerced.name || name);
4923
4853
  if (!isBrandedFields(field) && warnNotScalarField("Image", boundField, fieldValue)) {
@@ -4940,9 +4870,7 @@ function Image(props) {
4940
4870
  "data-amplifyup-ref-id": ref?.id || void 0
4941
4871
  } : null;
4942
4872
  if (composerEdit && !editName && (hasField || hasValue)) {
4943
- console.warn(
4944
- '[AmplifyUp SDK] Image value={\u2026} requires name="\u2026" for computed values'
4945
- );
4873
+ console.warn('[AmplifyUp SDK] Image value={\u2026} requires name="\u2026" for computed values');
4946
4874
  }
4947
4875
  if (!src) {
4948
4876
  if (!composerEdit || !fieldAttrs) return null;