@amplifyup/sdk 0.2.0 → 0.2.2
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/AmplifyRenderer.js +83 -110
- package/dist/AmplifyRenderer.js.map +1 -1
- package/dist/AmplifyRenderer.mjs +83 -110
- package/dist/AmplifyRenderer.mjs.map +1 -1
- package/dist/index.js +82 -103
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +82 -103
- package/dist/index.mjs.map +1 -1
- package/dist/react.d.mts +1 -1
- package/dist/react.d.ts +1 -1
- package/dist/react.js +103 -178
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +103 -178
- package/dist/react.mjs.map +1 -1
- package/dist/server.js +1 -1
- package/dist/server.js.map +1 -1
- package/dist/server.mjs +1 -1
- package/dist/server.mjs.map +1 -1
- package/package.json +1 -1
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")
|
|
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 {
|
|
@@ -1586,7 +1586,7 @@ var AmplifyUpSDK = class {
|
|
|
1586
1586
|
if (document.referrer) {
|
|
1587
1587
|
try {
|
|
1588
1588
|
const referrerUrl = new URL(document.referrer);
|
|
1589
|
-
if (referrerUrl.hostname === "localhost" && referrerUrl.port === "5001" || referrerUrl.pathname.includes("/dashboard/composer")
|
|
1589
|
+
if (referrerUrl.hostname === "localhost" && referrerUrl.port === "5001" || referrerUrl.pathname.includes("/dashboard/composer")) {
|
|
1590
1590
|
return true;
|
|
1591
1591
|
}
|
|
1592
1592
|
} catch {
|
|
@@ -1863,11 +1863,7 @@ var AmplifyUpSDK = class {
|
|
|
1863
1863
|
this.page(resumePath, { resumed: true });
|
|
1864
1864
|
this.lastTrackedPath = resumePath;
|
|
1865
1865
|
if (this.config?.debug) {
|
|
1866
|
-
console.log(
|
|
1867
|
-
"[AmplifyUp SDK] Idle resume page view",
|
|
1868
|
-
resumePath,
|
|
1869
|
-
`(hidden ${Math.round(idleMs / 6e4)}m)`
|
|
1870
|
-
);
|
|
1866
|
+
console.log("[AmplifyUp SDK] Idle resume page view", resumePath, `(hidden ${Math.round(idleMs / 6e4)}m)`);
|
|
1871
1867
|
}
|
|
1872
1868
|
}
|
|
1873
1869
|
noteActivity();
|
|
@@ -1887,12 +1883,7 @@ var AmplifyUpSDK = class {
|
|
|
1887
1883
|
}
|
|
1888
1884
|
state.visibleSince = null;
|
|
1889
1885
|
};
|
|
1890
|
-
const activityEvents = [
|
|
1891
|
-
"pointerdown",
|
|
1892
|
-
"keydown",
|
|
1893
|
-
"scroll",
|
|
1894
|
-
"touchstart"
|
|
1895
|
-
];
|
|
1886
|
+
const activityEvents = ["pointerdown", "keydown", "scroll", "touchstart"];
|
|
1896
1887
|
const onActivity = () => noteActivity();
|
|
1897
1888
|
window.addEventListener("scroll", onScroll, { passive: true });
|
|
1898
1889
|
document.addEventListener("visibilitychange", onVisibility);
|
|
@@ -2040,11 +2031,7 @@ var AmplifyUpSDK = class {
|
|
|
2040
2031
|
hosts.forEach((host) => observer.observe(host));
|
|
2041
2032
|
this.componentViewObservers.push(observer);
|
|
2042
2033
|
if (this.config?.debug) {
|
|
2043
|
-
console.log(
|
|
2044
|
-
"[AmplifyUp SDK] Component View tracking enabled for",
|
|
2045
|
-
hosts.length,
|
|
2046
|
-
"hosts"
|
|
2047
|
-
);
|
|
2034
|
+
console.log("[AmplifyUp SDK] Component View tracking enabled for", hosts.length, "hosts");
|
|
2048
2035
|
}
|
|
2049
2036
|
}
|
|
2050
2037
|
cleanupComponentViewTracking() {
|
|
@@ -2618,15 +2605,11 @@ Available Console Commands:
|
|
|
2618
2605
|
) : document;
|
|
2619
2606
|
if (!scopeRoot) {
|
|
2620
2607
|
if (this.config?.debug) {
|
|
2621
|
-
console.log(
|
|
2622
|
-
`[AmplifyUp SDK] Component host not found for ${eventConfig.componentId}`
|
|
2623
|
-
);
|
|
2608
|
+
console.log(`[AmplifyUp SDK] Component host not found for ${eventConfig.componentId}`);
|
|
2624
2609
|
}
|
|
2625
2610
|
return;
|
|
2626
2611
|
}
|
|
2627
|
-
targetElements = Array.from(
|
|
2628
|
-
scopeRoot.querySelectorAll(eventConfig.selector)
|
|
2629
|
-
);
|
|
2612
|
+
targetElements = Array.from(scopeRoot.querySelectorAll(eventConfig.selector));
|
|
2630
2613
|
if (scopeRoot instanceof Element && scopeRoot !== document.documentElement && scopeRoot.matches?.(eventConfig.selector)) {
|
|
2631
2614
|
targetElements.unshift(scopeRoot);
|
|
2632
2615
|
}
|
|
@@ -2659,7 +2642,9 @@ Available Console Commands:
|
|
|
2659
2642
|
});
|
|
2660
2643
|
}
|
|
2661
2644
|
if (this.config?.debug) {
|
|
2662
|
-
console.log(
|
|
2645
|
+
console.log(
|
|
2646
|
+
`[AmplifyUp SDK] Attached ${eventConfig.eventType} listener for ${eventConfig.eventName} on selector: ${eventConfig.selector}`
|
|
2647
|
+
);
|
|
2663
2648
|
}
|
|
2664
2649
|
});
|
|
2665
2650
|
});
|
|
@@ -2669,16 +2654,16 @@ Available Console Commands:
|
|
|
2669
2654
|
*/
|
|
2670
2655
|
mapEventType(eventType) {
|
|
2671
2656
|
const eventMap = {
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2657
|
+
click: "click",
|
|
2658
|
+
submit: "submit",
|
|
2659
|
+
focus: "focus",
|
|
2660
|
+
blur: "blur",
|
|
2661
|
+
hover: "mouseenter",
|
|
2662
|
+
change: "change",
|
|
2663
|
+
scroll: "scroll",
|
|
2664
|
+
view: "view",
|
|
2680
2665
|
// Handled separately with IntersectionObserver
|
|
2681
|
-
|
|
2666
|
+
custom: "custom"
|
|
2682
2667
|
};
|
|
2683
2668
|
return eventMap[eventType] || eventType;
|
|
2684
2669
|
}
|
|
@@ -2754,11 +2739,7 @@ Available Console Commands:
|
|
|
2754
2739
|
(entries) => {
|
|
2755
2740
|
entries.forEach((entry) => {
|
|
2756
2741
|
if (entry.isIntersecting) {
|
|
2757
|
-
this.handleTrackedEvent(
|
|
2758
|
-
new CustomEvent("view"),
|
|
2759
|
-
config,
|
|
2760
|
-
element
|
|
2761
|
-
);
|
|
2742
|
+
this.handleTrackedEvent(new CustomEvent("view"), config, element);
|
|
2762
2743
|
observer.unobserve(element);
|
|
2763
2744
|
}
|
|
2764
2745
|
});
|
|
@@ -2901,21 +2882,15 @@ Available Console Commands:
|
|
|
2901
2882
|
return;
|
|
2902
2883
|
}
|
|
2903
2884
|
if (event.data?.type === "AMPLIFYUP_FIELD_PATCH") {
|
|
2904
|
-
window.dispatchEvent(
|
|
2905
|
-
new CustomEvent("amplifyup:field-patch", { detail: event.data })
|
|
2906
|
-
);
|
|
2885
|
+
window.dispatchEvent(new CustomEvent("amplifyup:field-patch", { detail: event.data }));
|
|
2907
2886
|
return;
|
|
2908
2887
|
}
|
|
2909
2888
|
if (event.data?.type === "AMPLIFYUP_PROPS_PATCH") {
|
|
2910
|
-
window.dispatchEvent(
|
|
2911
|
-
new CustomEvent("amplifyup:props-patch", { detail: event.data })
|
|
2912
|
-
);
|
|
2889
|
+
window.dispatchEvent(new CustomEvent("amplifyup:props-patch", { detail: event.data }));
|
|
2913
2890
|
return;
|
|
2914
2891
|
}
|
|
2915
2892
|
if (event.data?.type === "AMPLIFYUP_LAYOUT_PATCH") {
|
|
2916
|
-
window.dispatchEvent(
|
|
2917
|
-
new CustomEvent("amplifyup:layout-patch", { detail: event.data })
|
|
2918
|
-
);
|
|
2893
|
+
window.dispatchEvent(new CustomEvent("amplifyup:layout-patch", { detail: event.data }));
|
|
2919
2894
|
return;
|
|
2920
2895
|
}
|
|
2921
2896
|
if (event.data?.type === "COMPONENT_DELETABLE_STATUS") {
|
|
@@ -2978,9 +2953,7 @@ Available Console Commands:
|
|
|
2978
2953
|
const { componentId, slotName, nodeId, isPageSlot } = event.data;
|
|
2979
2954
|
let element = null;
|
|
2980
2955
|
if (isPageSlot || slotName === "main" && !nodeId && !componentId) {
|
|
2981
|
-
element = document.querySelector(
|
|
2982
|
-
'[data-slot-source="page"]'
|
|
2983
|
-
);
|
|
2956
|
+
element = document.querySelector('[data-slot-source="page"]');
|
|
2984
2957
|
}
|
|
2985
2958
|
if (!element && nodeId && slotName) {
|
|
2986
2959
|
element = document.querySelector(
|
|
@@ -2988,9 +2961,7 @@ Available Console Commands:
|
|
|
2988
2961
|
);
|
|
2989
2962
|
}
|
|
2990
2963
|
if (!element && nodeId && !slotName) {
|
|
2991
|
-
element = document.querySelector(
|
|
2992
|
-
`[data-node-id="${nodeId}"]`
|
|
2993
|
-
);
|
|
2964
|
+
element = document.querySelector(`[data-node-id="${nodeId}"]`);
|
|
2994
2965
|
}
|
|
2995
2966
|
if (!element && slotName) {
|
|
2996
2967
|
element = document.querySelector(
|
|
@@ -3031,30 +3002,33 @@ Available Console Commands:
|
|
|
3031
3002
|
};
|
|
3032
3003
|
if (window.parent && window.parent !== window) {
|
|
3033
3004
|
const hierarchyEls = this.buildComponentHierarchy(element);
|
|
3034
|
-
window.parent.postMessage(
|
|
3035
|
-
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
3005
|
+
window.parent.postMessage(
|
|
3006
|
+
{
|
|
3007
|
+
type: "ELEMENT_POSITION",
|
|
3008
|
+
componentId: componentId || null,
|
|
3009
|
+
slotName: slotName || null,
|
|
3010
|
+
nodeId: nodeId || null,
|
|
3011
|
+
isPageSlot: !!isPageSlot || element.getAttribute("data-slot-source") === "page",
|
|
3012
|
+
hierarchy: hierarchyEls.map((el, index) => {
|
|
3013
|
+
const elComponentId = el.getAttribute("data-amplifyup-component") || el.getAttribute("data-component-id");
|
|
3014
|
+
const elSlotName = el.getAttribute("data-amplifyup-slot") || el.getAttribute("data-slot-id");
|
|
3015
|
+
const isSlot = !elComponentId && !!elSlotName;
|
|
3016
|
+
const pageSlot = isSlot && el.getAttribute("data-slot-source") === "page";
|
|
3017
|
+
return {
|
|
3018
|
+
index,
|
|
3019
|
+
componentId: elComponentId,
|
|
3020
|
+
componentName: pageSlot ? "Page" : el.getAttribute("data-component-name"),
|
|
3021
|
+
slotName: isSlot ? elSlotName : null,
|
|
3022
|
+
isSlot,
|
|
3023
|
+
isPageSlot: pageSlot,
|
|
3024
|
+
nodeId: el.getAttribute("data-node-id") || (isSlot ? el.getAttribute("data-parent-node-id") : null)
|
|
3025
|
+
};
|
|
3026
|
+
}),
|
|
3027
|
+
position,
|
|
3028
|
+
bounds
|
|
3029
|
+
},
|
|
3030
|
+
"*"
|
|
3031
|
+
);
|
|
3058
3032
|
}
|
|
3059
3033
|
} else {
|
|
3060
3034
|
console.warn("[AmplifyUp SDK] Element not found for position request");
|
|
@@ -3070,7 +3044,11 @@ Available Console Commands:
|
|
|
3070
3044
|
switch (message.type) {
|
|
3071
3045
|
case "ENABLE_HIGHLIGHTING":
|
|
3072
3046
|
case "UPDATE_HIGHLIGHTING":
|
|
3073
|
-
console.log(
|
|
3047
|
+
console.log(
|
|
3048
|
+
"[AmplifyUp SDK] Enabling highlighting with registry:",
|
|
3049
|
+
message.componentRegistry?.length || 0,
|
|
3050
|
+
"components"
|
|
3051
|
+
);
|
|
3074
3052
|
this.enableHighlighting(
|
|
3075
3053
|
message.componentRegistry || [],
|
|
3076
3054
|
message.highlightComponents ?? true,
|
|
@@ -3130,12 +3108,15 @@ Available Console Commands:
|
|
|
3130
3108
|
const tagName = target.tagName.toLowerCase();
|
|
3131
3109
|
const text = (target.textContent || "").replace(/\s+/g, " ").trim().substring(0, 80);
|
|
3132
3110
|
if (window.parent && window.parent !== window) {
|
|
3133
|
-
window.parent.postMessage(
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3111
|
+
window.parent.postMessage(
|
|
3112
|
+
{
|
|
3113
|
+
type: "ELEMENT_CLICKED_FOR_EVENT",
|
|
3114
|
+
selector,
|
|
3115
|
+
tagName,
|
|
3116
|
+
text
|
|
3117
|
+
},
|
|
3118
|
+
"*"
|
|
3119
|
+
);
|
|
3139
3120
|
}
|
|
3140
3121
|
};
|
|
3141
3122
|
document.addEventListener("click", this.eventSelectionClickHandler, true);
|
|
@@ -3161,9 +3142,7 @@ Available Console Commands:
|
|
|
3161
3142
|
return "[" + attr.name + '="' + attr.value + '"]';
|
|
3162
3143
|
}
|
|
3163
3144
|
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
|
-
);
|
|
3145
|
+
const classes = el.className.split(" ").filter((c) => c && !c.startsWith("has-") && !c.includes("selectable") && !c.includes("selected"));
|
|
3167
3146
|
if (classes.length > 0) {
|
|
3168
3147
|
return el.tagName.toLowerCase() + "." + classes[0];
|
|
3169
3148
|
}
|
|
@@ -3213,9 +3192,7 @@ Available Console Commands:
|
|
|
3213
3192
|
}
|
|
3214
3193
|
});
|
|
3215
3194
|
if (containing.length === 0) return null;
|
|
3216
|
-
const innermost = containing.filter(
|
|
3217
|
-
(el) => !containing.some((other) => other !== el && el.contains(other))
|
|
3218
|
-
);
|
|
3195
|
+
const innermost = containing.filter((el) => !containing.some((other) => other !== el && el.contains(other)));
|
|
3219
3196
|
if (innermost.length === 1) return innermost[0];
|
|
3220
3197
|
let best = innermost[0];
|
|
3221
3198
|
let bestArea = Infinity;
|
|
@@ -3332,9 +3309,7 @@ Available Console Commands:
|
|
|
3332
3309
|
*/
|
|
3333
3310
|
enableHighlighting(componentRegistry, highlightComponents, showZones) {
|
|
3334
3311
|
if (typeof document === "undefined") return;
|
|
3335
|
-
const previouslySelected = Array.from(
|
|
3336
|
-
document.querySelectorAll(".amplifyup-selected")
|
|
3337
|
-
);
|
|
3312
|
+
const previouslySelected = Array.from(document.querySelectorAll(".amplifyup-selected"));
|
|
3338
3313
|
this.componentRegistry = componentRegistry;
|
|
3339
3314
|
this.highlightingEnabled = true;
|
|
3340
3315
|
this.highlightComponentsEnabled = highlightComponents;
|
|
@@ -3707,10 +3682,7 @@ Available Console Commands:
|
|
|
3707
3682
|
if (shouldReapply && this.highlightingEnabled) {
|
|
3708
3683
|
setTimeout(() => {
|
|
3709
3684
|
if (this.highlightingEnabled) {
|
|
3710
|
-
this.applyComponentHighlights(
|
|
3711
|
-
this.highlightComponentsEnabled,
|
|
3712
|
-
this.showZonesEnabled
|
|
3713
|
-
);
|
|
3685
|
+
this.applyComponentHighlights(this.highlightComponentsEnabled, this.showZonesEnabled);
|
|
3714
3686
|
}
|
|
3715
3687
|
}, 100);
|
|
3716
3688
|
}
|
|
@@ -3719,7 +3691,13 @@ Available Console Commands:
|
|
|
3719
3691
|
childList: true,
|
|
3720
3692
|
subtree: true,
|
|
3721
3693
|
attributes: true,
|
|
3722
|
-
attributeFilter: [
|
|
3694
|
+
attributeFilter: [
|
|
3695
|
+
"data-amplifyup-component",
|
|
3696
|
+
"data-component-id",
|
|
3697
|
+
"data-amplifyup-slot",
|
|
3698
|
+
"data-slot-id",
|
|
3699
|
+
"data-slot-empty"
|
|
3700
|
+
]
|
|
3723
3701
|
});
|
|
3724
3702
|
}
|
|
3725
3703
|
/**
|
|
@@ -3733,9 +3711,7 @@ Available Console Commands:
|
|
|
3733
3711
|
this.teardownComposerDragDrop();
|
|
3734
3712
|
if (opts?.clearSelection !== false && typeof window !== "undefined") {
|
|
3735
3713
|
window.__AMPLIFYUP_COMPOSER_EDIT__ = false;
|
|
3736
|
-
window.dispatchEvent(
|
|
3737
|
-
new CustomEvent("amplifyup:composer-edit", { detail: { enabled: false } })
|
|
3738
|
-
);
|
|
3714
|
+
window.dispatchEvent(new CustomEvent("amplifyup:composer-edit", { detail: { enabled: false } }));
|
|
3739
3715
|
}
|
|
3740
3716
|
if (this.mutationObserver) {
|
|
3741
3717
|
this.mutationObserver.disconnect();
|
|
@@ -3893,7 +3869,10 @@ Available Console Commands:
|
|
|
3893
3869
|
e.stopPropagation();
|
|
3894
3870
|
this.sendSelectionMessage(htmlEl, hierarchy);
|
|
3895
3871
|
if (window.parent && window.parent !== window) {
|
|
3896
|
-
window.parent.postMessage(
|
|
3872
|
+
window.parent.postMessage(
|
|
3873
|
+
{ type: "CHECK_COMPONENT_DELETABLE", componentId: component.component_id },
|
|
3874
|
+
"*"
|
|
3875
|
+
);
|
|
3897
3876
|
}
|
|
3898
3877
|
};
|
|
3899
3878
|
htmlEl.addEventListener("click", handleClick);
|
|
@@ -4268,23 +4247,12 @@ function ComponentContextProvider({
|
|
|
4268
4247
|
componentId
|
|
4269
4248
|
}) {
|
|
4270
4249
|
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
|
-
);
|
|
4250
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ComponentContext.Provider, { value: { slots, props: next, layoutNodeId, componentId }, children });
|
|
4278
4251
|
}
|
|
4279
|
-
function Slot({
|
|
4280
|
-
name,
|
|
4281
|
-
className
|
|
4282
|
-
}) {
|
|
4252
|
+
function Slot({ name, className }) {
|
|
4283
4253
|
const context = React3.useContext(ComponentContext);
|
|
4284
4254
|
if (!context) {
|
|
4285
|
-
console.warn(
|
|
4286
|
-
`[AmplifyUp SDK] Slot "${name}" only works inside a component rendered from your component registry`
|
|
4287
|
-
);
|
|
4255
|
+
console.warn(`[AmplifyUp SDK] Slot "${name}" only works inside a component rendered from your component registry`);
|
|
4288
4256
|
return null;
|
|
4289
4257
|
}
|
|
4290
4258
|
const slotContent = context.slots?.[name];
|
|
@@ -4300,21 +4268,17 @@ function Slot({
|
|
|
4300
4268
|
window.self !== window.top && document.referrer && (() => {
|
|
4301
4269
|
try {
|
|
4302
4270
|
const referrerUrl = new URL(document.referrer);
|
|
4303
|
-
return referrerUrl.hostname === "localhost" && referrerUrl.port === "5001" || referrerUrl.pathname.includes("/dashboard/composer")
|
|
4271
|
+
return referrerUrl.hostname === "localhost" && referrerUrl.port === "5001" || referrerUrl.pathname.includes("/dashboard/composer");
|
|
4304
4272
|
} catch {
|
|
4305
4273
|
return false;
|
|
4306
4274
|
}
|
|
4307
4275
|
})());
|
|
4308
|
-
sdkDebugOnce(
|
|
4309
|
-
|
|
4310
|
-
|
|
4311
|
-
|
|
4312
|
-
|
|
4313
|
-
|
|
4314
|
-
isEditorMode,
|
|
4315
|
-
availableSlotKeys: context.slots ? Object.keys(context.slots) : []
|
|
4316
|
-
}
|
|
4317
|
-
);
|
|
4276
|
+
sdkDebugOnce(`slot:${context.layoutNodeId || ""}:${name}`, `[Slot:${name}]`, {
|
|
4277
|
+
slotState,
|
|
4278
|
+
isEmpty,
|
|
4279
|
+
isEditorMode,
|
|
4280
|
+
availableSlotKeys: context.slots ? Object.keys(context.slots) : []
|
|
4281
|
+
});
|
|
4318
4282
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4319
4283
|
"div",
|
|
4320
4284
|
{
|
|
@@ -4404,18 +4368,12 @@ function canInlineEditRichText(name, value) {
|
|
|
4404
4368
|
return true;
|
|
4405
4369
|
}
|
|
4406
4370
|
function useComposerEditMode() {
|
|
4407
|
-
return React3.useSyncExternalStore(
|
|
4408
|
-
subscribeComposerEdit,
|
|
4409
|
-
isComposerEditMode,
|
|
4410
|
-
getComposerEditModeServer
|
|
4411
|
-
);
|
|
4371
|
+
return React3.useSyncExternalStore(subscribeComposerEdit, isComposerEditMode, getComposerEditModeServer);
|
|
4412
4372
|
}
|
|
4413
4373
|
function useBoundField(field, value, name, component) {
|
|
4414
4374
|
const bound = resolveEditableBinding(field, value, name);
|
|
4415
4375
|
if (bound.requiresName) {
|
|
4416
|
-
console.warn(
|
|
4417
|
-
`[AmplifyUp SDK] ${component} value={\u2026} requires name="\u2026" for computed values`
|
|
4418
|
-
);
|
|
4376
|
+
console.warn(`[AmplifyUp SDK] ${component} value={\u2026} requires name="\u2026" for computed values`);
|
|
4419
4377
|
}
|
|
4420
4378
|
const fieldValue = useComposerFieldValue(bound.name, bound.value, bound.ref);
|
|
4421
4379
|
return { editName: bound.name, fieldValue, ref: bound.ref };
|
|
@@ -4496,9 +4454,7 @@ function ComposerInlineField({
|
|
|
4496
4454
|
const el = elRef.current;
|
|
4497
4455
|
if (!el) return;
|
|
4498
4456
|
if (document.activeElement === el) return;
|
|
4499
|
-
if (el.querySelector(
|
|
4500
|
-
"input, button, select, textarea, form, svg, iframe, img"
|
|
4501
|
-
)) {
|
|
4457
|
+
if (el.querySelector("input, button, select, textarea, form, svg, iframe, img")) {
|
|
4502
4458
|
return;
|
|
4503
4459
|
}
|
|
4504
4460
|
const next = idleDisplay || "";
|
|
@@ -4705,9 +4661,7 @@ function warnReadOnlyRowField(name) {
|
|
|
4705
4661
|
const key = name || "(unnamed)";
|
|
4706
4662
|
if (warnedReadOnlyFields.has(key)) return;
|
|
4707
4663
|
warnedReadOnlyFields.add(key);
|
|
4708
|
-
console.warn(
|
|
4709
|
-
`[AmplifyUp SDK] ${key} has no write target; rendered read-only.`
|
|
4710
|
-
);
|
|
4664
|
+
console.warn(`[AmplifyUp SDK] ${key} has no write target; rendered read-only.`);
|
|
4711
4665
|
}
|
|
4712
4666
|
function canComposerBind(field, ref, editName) {
|
|
4713
4667
|
if (isReadOnlyRowField(field) || isFieldEnvelope(field) && field.readOnly) {
|
|
@@ -4719,9 +4673,7 @@ function canComposerBind(field, ref, editName) {
|
|
|
4719
4673
|
function warnProjectionProps(component, hasField, hasValue, name) {
|
|
4720
4674
|
if (process.env.NODE_ENV === "production") return;
|
|
4721
4675
|
if (!hasField && !hasValue && !name) {
|
|
4722
|
-
console.warn(
|
|
4723
|
-
`[AmplifyUp SDK] ${component} needs field={fields.yourProp} (or value + name for computed values)`
|
|
4724
|
-
);
|
|
4676
|
+
console.warn(`[AmplifyUp SDK] ${component} needs field={fields.yourProp} (or value + name for computed values)`);
|
|
4725
4677
|
}
|
|
4726
4678
|
}
|
|
4727
4679
|
function hasOwnProp(props, key) {
|
|
@@ -4775,26 +4727,14 @@ function markdownToHtml(markdown) {
|
|
|
4775
4727
|
}
|
|
4776
4728
|
}
|
|
4777
4729
|
function RichText(props) {
|
|
4778
|
-
const {
|
|
4779
|
-
field,
|
|
4780
|
-
value,
|
|
4781
|
-
name,
|
|
4782
|
-
className,
|
|
4783
|
-
as: Tag = "div",
|
|
4784
|
-
children
|
|
4785
|
-
} = props;
|
|
4730
|
+
const { field, value, name, className, as: Tag = "div", children } = props;
|
|
4786
4731
|
const context = React3.useContext(ComponentContext);
|
|
4787
4732
|
const composerEdit = useComposerEditMode();
|
|
4788
4733
|
const childrenValue = typeof children === "string" || typeof children === "number" ? String(children) : void 0;
|
|
4789
4734
|
const hasField = isFieldEnvelope(field);
|
|
4790
4735
|
const hasValueProp = hasOwnProp(props, "value") || childrenValue !== void 0;
|
|
4791
4736
|
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
|
-
);
|
|
4737
|
+
const { editName, fieldValue, ref } = useBoundField(field, boundValue, name, "RichText");
|
|
4798
4738
|
assertNamedEnvelope("RichText", field);
|
|
4799
4739
|
if (!hasField && !hasValueProp && !name) {
|
|
4800
4740
|
return null;
|
|
@@ -4896,28 +4836,14 @@ function coerceImageField(field, value, name) {
|
|
|
4896
4836
|
};
|
|
4897
4837
|
}
|
|
4898
4838
|
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;
|
|
4839
|
+
const { field, value, name, alt: altProp, className, width: widthProp, height: heightProp, ...imgProps } = props;
|
|
4909
4840
|
const context = React3.useContext(ComponentContext);
|
|
4910
4841
|
assertNamedEnvelope("Image", field);
|
|
4911
4842
|
const coerced = coerceImageField(field, value, name);
|
|
4912
4843
|
const boundField = coerced.field;
|
|
4913
4844
|
const hasField = isFieldEnvelope(boundField);
|
|
4914
4845
|
const hasValue = hasOwnProp(props, "value");
|
|
4915
|
-
const { editName, fieldValue, ref } = useBoundField(
|
|
4916
|
-
boundField,
|
|
4917
|
-
coerced.value,
|
|
4918
|
-
coerced.name,
|
|
4919
|
-
"Image"
|
|
4920
|
-
);
|
|
4846
|
+
const { editName, fieldValue, ref } = useBoundField(boundField, coerced.value, coerced.name, "Image");
|
|
4921
4847
|
const composerEdit = useComposerEditMode();
|
|
4922
4848
|
warnProjectionProps("Image", hasField || isBrandedFields(field), hasValue, coerced.name || name);
|
|
4923
4849
|
if (!isBrandedFields(field) && warnNotScalarField("Image", boundField, fieldValue)) {
|
|
@@ -4940,9 +4866,7 @@ function Image(props) {
|
|
|
4940
4866
|
"data-amplifyup-ref-id": ref?.id || void 0
|
|
4941
4867
|
} : null;
|
|
4942
4868
|
if (composerEdit && !editName && (hasField || hasValue)) {
|
|
4943
|
-
console.warn(
|
|
4944
|
-
'[AmplifyUp SDK] Image value={\u2026} requires name="\u2026" for computed values'
|
|
4945
|
-
);
|
|
4869
|
+
console.warn('[AmplifyUp SDK] Image value={\u2026} requires name="\u2026" for computed values');
|
|
4946
4870
|
}
|
|
4947
4871
|
if (!src) {
|
|
4948
4872
|
if (!composerEdit || !fieldAttrs) return null;
|
|
@@ -5898,6 +5822,7 @@ function AmplifyUpProvider({
|
|
|
5898
5822
|
});
|
|
5899
5823
|
return next;
|
|
5900
5824
|
});
|
|
5825
|
+
setError(null);
|
|
5901
5826
|
setLoading(false);
|
|
5902
5827
|
};
|
|
5903
5828
|
const onMessage = (event) => {
|