@amplifyup/sdk 0.1.39 → 0.1.40

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.js CHANGED
@@ -1,10 +1,14 @@
1
1
  'use client';
2
2
  'use strict';
3
3
 
4
- var react = require('react');
4
+ var React = require('react');
5
5
  var marked = require('marked');
6
6
  var jsxRuntime = require('react/jsx-runtime');
7
7
 
8
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
9
+
10
+ var React__default = /*#__PURE__*/_interopDefault(React);
11
+
8
12
  /* @amplifyup/sdk - https://amplifyup.ai */
9
13
  var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
10
14
  get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
@@ -3010,13 +3014,13 @@ function getSDK(adapter) {
3010
3014
  var trackContentView = (contentId, contentType, properties) => getSDK().trackContentView(contentId, contentType, properties);
3011
3015
  var refreshEventTracking = () => getSDK().refreshEventTracking();
3012
3016
  getSDK();
3013
- var ComponentContext = react.createContext(null);
3017
+ var ComponentContext = React.createContext(null);
3014
3018
  function useLiveComposerProps(layoutNodeId, props) {
3015
- const [live, setLive] = react.useState(props);
3016
- react.useEffect(() => {
3019
+ const [live, setLive] = React.useState(props);
3020
+ React.useEffect(() => {
3017
3021
  setLive(props);
3018
3022
  }, [props]);
3019
- react.useEffect(() => {
3023
+ React.useEffect(() => {
3020
3024
  const matchesNode = (nodeId) => {
3021
3025
  if (nodeId && layoutNodeId && String(nodeId) !== String(layoutNodeId)) {
3022
3026
  return false;
@@ -3033,7 +3037,10 @@ function useLiveComposerProps(layoutNodeId, props) {
3033
3037
  return;
3034
3038
  }
3035
3039
  if (!matchesNode(nodeId)) return;
3036
- setLive(nextProps);
3040
+ setLive((prev) => ({
3041
+ ...prev,
3042
+ ...nextProps
3043
+ }));
3037
3044
  };
3038
3045
  const onPatch = (event) => {
3039
3046
  const detail = event.detail || {};
@@ -3063,7 +3070,7 @@ function useLiveComposerProps(layoutNodeId, props) {
3063
3070
  return live;
3064
3071
  }
3065
3072
  function useComponentProps() {
3066
- const context = react.useContext(ComponentContext);
3073
+ const context = React.useContext(ComponentContext);
3067
3074
  if (!context) {
3068
3075
  console.warn(
3069
3076
  "[AmplifyUp SDK] useComponentProps used outside ComponentContextProvider"
@@ -3092,7 +3099,7 @@ function Slot({
3092
3099
  name,
3093
3100
  className
3094
3101
  }) {
3095
- const context = react.useContext(ComponentContext);
3102
+ const context = React.useContext(ComponentContext);
3096
3103
  console.log(`[Slot:${name}] Rendering slot`, {
3097
3104
  hasContext: !!context,
3098
3105
  availableSlotKeys: context?.slots ? Object.keys(context.slots) : [],
@@ -3194,6 +3201,32 @@ function isLikelyNonTextFieldName(name) {
3194
3201
  const n = name.toLowerCase();
3195
3202
  return n.includes("href") || n.includes("url") || n.includes("src") || n.includes("image") || n.includes("icon") || n.includes("overlay") || n.includes("color");
3196
3203
  }
3204
+ function isPlainTextValue(value) {
3205
+ return typeof value === "string" || typeof value === "number";
3206
+ }
3207
+ var COMPOSER_EMPTY_FIELD_HINT = "Click here to edit this field";
3208
+ var EMPTY_FIELD_PLACEHOLDERS = /* @__PURE__ */ new Set([
3209
+ COMPOSER_EMPTY_FIELD_HINT,
3210
+ "Click here to enter text",
3211
+ "Sample Title",
3212
+ "Sample Heading",
3213
+ "Sample Subheading"
3214
+ ]);
3215
+ function isComposerEmptyText(value) {
3216
+ if (value === void 0 || value === null) return true;
3217
+ if (typeof value !== "string") return false;
3218
+ const trimmed = value.trim();
3219
+ return trimmed === "" || EMPTY_FIELD_PLACEHOLDERS.has(trimmed);
3220
+ }
3221
+ function isReactNodeFallback(fallback) {
3222
+ if (fallback == null || fallback === false) return false;
3223
+ return !isPlainTextValue(fallback);
3224
+ }
3225
+ function htmlHasVisualChrome(html) {
3226
+ return /<(input|button|select|textarea|form|svg|iframe|video|audio|img)\b/i.test(
3227
+ html
3228
+ );
3229
+ }
3197
3230
  function canInlineEdit(name, value) {
3198
3231
  if (isLikelyNonTextFieldName(name)) return false;
3199
3232
  if (value !== void 0 && value !== null && typeof value === "object") {
@@ -3202,19 +3235,22 @@ function canInlineEdit(name, value) {
3202
3235
  if (typeof value === "boolean") return false;
3203
3236
  return true;
3204
3237
  }
3238
+ function subscribeComposerEdit(onStoreChange) {
3239
+ if (typeof window === "undefined") return () => {
3240
+ };
3241
+ window.addEventListener("amplifyup:composer-edit", onStoreChange);
3242
+ return () => window.removeEventListener("amplifyup:composer-edit", onStoreChange);
3243
+ }
3205
3244
  function useComposerEditMode() {
3206
- const [enabled, setEnabled] = react.useState(false);
3207
- react.useEffect(() => {
3208
- const sync = () => setEnabled(isComposerEditMode());
3209
- sync();
3210
- window.addEventListener("amplifyup:composer-edit", sync);
3211
- return () => window.removeEventListener("amplifyup:composer-edit", sync);
3212
- }, []);
3213
- return enabled;
3245
+ return React.useSyncExternalStore(
3246
+ subscribeComposerEdit,
3247
+ isComposerEditMode,
3248
+ () => false
3249
+ );
3214
3250
  }
3215
3251
  function useFieldOverlay(layoutNodeId, name, source) {
3216
- const [overlay, setOverlay] = react.useState(void 0);
3217
- react.useEffect(() => {
3252
+ const [overlay, setOverlay] = React.useState(void 0);
3253
+ React.useEffect(() => {
3218
3254
  const onPatch = (event) => {
3219
3255
  const detail = event.detail || {};
3220
3256
  if (detail.fieldName !== name) return;
@@ -3241,6 +3277,14 @@ function commitComposerField(layoutNodeId, componentId, name, value) {
3241
3277
  "*"
3242
3278
  );
3243
3279
  }
3280
+ function placeCaret(el, atStart = false) {
3281
+ const range = document.createRange();
3282
+ range.selectNodeContents(el);
3283
+ range.collapse(atStart);
3284
+ const sel = window.getSelection();
3285
+ sel?.removeAllRanges();
3286
+ sel?.addRange(range);
3287
+ }
3244
3288
  function ComposerInlineField({
3245
3289
  name,
3246
3290
  value,
@@ -3250,36 +3294,55 @@ function ComposerInlineField({
3250
3294
  layoutNodeId,
3251
3295
  componentId
3252
3296
  }) {
3253
- const [editing, setEditing] = react.useState(false);
3254
- const elRef = react.useRef(null);
3255
- const text = formatFieldValue(value);
3297
+ const [editing, setEditing] = React.useState(false);
3298
+ const [focused, setFocused] = React.useState(false);
3299
+ const elRef = React.useRef(null);
3300
+ const storedEmpty = isComposerEmptyText(value);
3301
+ const text = storedEmpty ? "" : formatFieldValue(value);
3256
3302
  const fallbackText = typeof fallback === "string" || typeof fallback === "number" ? String(fallback) : "";
3257
- const display = text || fallbackText;
3303
+ const hint = COMPOSER_EMPTY_FIELD_HINT;
3304
+ const idleDisplay = storedEmpty ? hint : text || fallbackText;
3258
3305
  const showRendered = !!render && !editing;
3259
- react.useEffect(() => {
3306
+ const showHint = storedEmpty && !focused && !showRendered;
3307
+ React.useEffect(() => {
3260
3308
  const el = elRef.current;
3261
3309
  if (!el || showRendered) return;
3262
3310
  if (document.activeElement === el) return;
3263
- const next = display || "";
3311
+ if (el.querySelector(
3312
+ "input, button, select, textarea, form, svg, iframe, img"
3313
+ )) {
3314
+ return;
3315
+ }
3316
+ const next = idleDisplay || "";
3264
3317
  if (el.textContent !== next) el.textContent = next;
3265
- }, [display, showRendered]);
3266
- react.useEffect(() => {
3318
+ }, [idleDisplay, showRendered]);
3319
+ React.useEffect(() => {
3267
3320
  if (!editing || !elRef.current) return;
3268
3321
  const el = elRef.current;
3269
- el.textContent = display || "";
3322
+ if (storedEmpty) {
3323
+ el.textContent = "";
3324
+ el.focus();
3325
+ placeCaret(el, true);
3326
+ return;
3327
+ }
3328
+ el.textContent = idleDisplay || "";
3270
3329
  el.focus();
3271
- const range = document.createRange();
3272
- range.selectNodeContents(el);
3273
- const sel = window.getSelection();
3274
- sel?.removeAllRanges();
3275
- sel?.addRange(range);
3276
- }, [editing]);
3330
+ placeCaret(el, false);
3331
+ }, [editing, storedEmpty, idleDisplay]);
3277
3332
  const finishEdit = () => {
3278
3333
  const raw = (elRef.current?.innerText ?? "").replace(/\u00a0/g, " ").replace(/\n+$/g, "");
3279
3334
  const next = raw.trim() === "" ? "" : raw;
3280
3335
  setEditing(false);
3336
+ setFocused(false);
3337
+ if (storedEmpty && next === "") {
3338
+ if (elRef.current) elRef.current.textContent = hint;
3339
+ if (typeof value === "string" && EMPTY_FIELD_PLACEHOLDERS.has(value.trim())) {
3340
+ commitComposerField(layoutNodeId, componentId, name, "");
3341
+ }
3342
+ return;
3343
+ }
3281
3344
  if (next === text) return;
3282
- if (!text && next === fallbackText) return;
3345
+ if (!text && !storedEmpty && next === fallbackText) return;
3283
3346
  commitComposerField(layoutNodeId, componentId, name, next);
3284
3347
  };
3285
3348
  return /* @__PURE__ */ jsxRuntime.jsx(
@@ -3289,6 +3352,7 @@ function ComposerInlineField({
3289
3352
  className,
3290
3353
  "data-amplifyup-field": name,
3291
3354
  "data-amplifyup-node-id": layoutNodeId || void 0,
3355
+ "data-amplifyup-empty-hint": showHint ? "true" : void 0,
3292
3356
  contentEditable: !showRendered,
3293
3357
  suppressContentEditableWarning: true,
3294
3358
  role: "textbox",
@@ -3305,6 +3369,12 @@ function ComposerInlineField({
3305
3369
  },
3306
3370
  onFocus: () => {
3307
3371
  if (!isComposerEditMode()) return;
3372
+ setFocused(true);
3373
+ const el = elRef.current;
3374
+ if (el && storedEmpty) {
3375
+ el.textContent = "";
3376
+ placeCaret(el, true);
3377
+ }
3308
3378
  if (render) setEditing(true);
3309
3379
  },
3310
3380
  onBlur: finishEdit,
@@ -3316,8 +3386,9 @@ function ComposerInlineField({
3316
3386
  }
3317
3387
  if (event.key === "Escape") {
3318
3388
  event.preventDefault();
3319
- if (elRef.current) elRef.current.textContent = display || "";
3389
+ if (elRef.current) elRef.current.textContent = idleDisplay || "";
3320
3390
  setEditing(false);
3391
+ setFocused(false);
3321
3392
  event.currentTarget.blur();
3322
3393
  }
3323
3394
  },
@@ -3326,12 +3397,59 @@ function ComposerInlineField({
3326
3397
  outline: "1px dashed color-mix(in srgb, currentColor 40%, transparent)",
3327
3398
  outlineOffset: "2px",
3328
3399
  minWidth: "1ch",
3329
- display: render ? void 0 : "inline"
3400
+ minHeight: "1em",
3401
+ display: render ? void 0 : "inline",
3402
+ opacity: showHint ? 0.5 : void 0
3330
3403
  },
3331
- children: showRendered ? value != null && value !== "" ? render(value) : fallback ?? display : null
3404
+ children: showRendered ? value != null && value !== "" && !storedEmpty ? render(value) : fallback ?? idleDisplay : isReactNodeFallback(fallback) && !idleDisplay ? fallback : null
3332
3405
  }
3333
3406
  );
3334
3407
  }
3408
+ function ComposerInlineHtml({
3409
+ name,
3410
+ html,
3411
+ className,
3412
+ Tag = "div",
3413
+ layoutNodeId,
3414
+ componentId
3415
+ }) {
3416
+ const elRef = React.useRef(null);
3417
+ const sourceTextRef = React.useRef("");
3418
+ React.useEffect(() => {
3419
+ const el = elRef.current;
3420
+ if (!el) return;
3421
+ if (document.activeElement === el || el.contains(document.activeElement)) {
3422
+ return;
3423
+ }
3424
+ if (el.innerHTML !== html) el.innerHTML = html;
3425
+ sourceTextRef.current = (el.innerText ?? "").replace(/\u00a0/g, " ").trim();
3426
+ }, [html]);
3427
+ const finishEdit = () => {
3428
+ const el = elRef.current;
3429
+ if (!el) return;
3430
+ const next = (el.innerText ?? "").replace(/\u00a0/g, " ").replace(/\n+$/g, "");
3431
+ if (next.trim() === sourceTextRef.current) return;
3432
+ commitComposerField(layoutNodeId, componentId, name, next.trim());
3433
+ };
3434
+ return React__default.default.createElement(Tag, {
3435
+ ref: elRef,
3436
+ className,
3437
+ "data-amplifyup-field": name,
3438
+ "data-amplifyup-node-id": layoutNodeId || void 0,
3439
+ contentEditable: true,
3440
+ suppressContentEditableWarning: true,
3441
+ dangerouslySetInnerHTML: { __html: html },
3442
+ onMouseDown: (event) => {
3443
+ event.stopPropagation();
3444
+ },
3445
+ onBlur: finishEdit,
3446
+ style: {
3447
+ cursor: "text",
3448
+ outline: "1px dashed color-mix(in srgb, currentColor 40%, transparent)",
3449
+ outlineOffset: "2px"
3450
+ }
3451
+ });
3452
+ }
3335
3453
  function formatFieldValue(value) {
3336
3454
  if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
3337
3455
  return String(value);
@@ -3384,7 +3502,7 @@ function Field({
3384
3502
  className,
3385
3503
  render
3386
3504
  }) {
3387
- const context = react.useContext(ComponentContext);
3505
+ const context = React.useContext(ComponentContext);
3388
3506
  const composerEdit = useComposerEditMode();
3389
3507
  const fieldValue = useFieldOverlay(
3390
3508
  context?.layoutNodeId,
@@ -3398,7 +3516,13 @@ function Field({
3398
3516
  if (render) {
3399
3517
  return /* @__PURE__ */ jsxRuntime.jsx("span", { className, style: { display: "contents" }, children: render(fieldValue) });
3400
3518
  }
3401
- if (composerEdit && canInlineEdit(name, fieldValue)) {
3519
+ if (Array.isArray(fieldValue)) {
3520
+ const list = renderLinkList(fieldValue, className);
3521
+ if (list) return list;
3522
+ }
3523
+ const text = formatFieldValue(fieldValue);
3524
+ const showVisualFallback = !text && isReactNodeFallback(fallback);
3525
+ if (composerEdit && canInlineEdit(name, fieldValue) && !showVisualFallback) {
3402
3526
  return /* @__PURE__ */ jsxRuntime.jsx(
3403
3527
  ComposerInlineField,
3404
3528
  {
@@ -3414,11 +3538,6 @@ function Field({
3414
3538
  if (fieldValue === void 0 || fieldValue === null) {
3415
3539
  return fallback ? /* @__PURE__ */ jsxRuntime.jsx("span", { className, children: fallback }) : null;
3416
3540
  }
3417
- if (Array.isArray(fieldValue)) {
3418
- const list = renderLinkList(fieldValue, className);
3419
- if (list) return list;
3420
- }
3421
- const text = formatFieldValue(fieldValue);
3422
3541
  if (!text) {
3423
3542
  return fallback ? /* @__PURE__ */ jsxRuntime.jsx("span", { className, children: fallback }) : null;
3424
3543
  }
@@ -3438,7 +3557,7 @@ function RichText({
3438
3557
  className,
3439
3558
  as: Tag = "div"
3440
3559
  }) {
3441
- const context = react.useContext(ComponentContext);
3560
+ const context = React.useContext(ComponentContext);
3442
3561
  const composerEdit = useComposerEditMode();
3443
3562
  const fieldValue = useFieldOverlay(
3444
3563
  context?.layoutNodeId,
@@ -3449,20 +3568,20 @@ function RichText({
3449
3568
  console.warn(`[AmplifyUp SDK] RichText "${name}" used outside ComponentContextProvider`);
3450
3569
  return fallback ? /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: fallback }) : null;
3451
3570
  }
3452
- if (composerEdit && canInlineEdit(name, fieldValue)) {
3453
- return /* @__PURE__ */ jsxRuntime.jsx(
3454
- ComposerInlineField,
3455
- {
3456
- name,
3457
- value: fieldValue,
3458
- fallback,
3459
- className,
3460
- layoutNodeId: context.layoutNodeId,
3461
- componentId: context.componentId
3462
- }
3463
- );
3464
- }
3465
- if (fieldValue === void 0 || fieldValue === null || fieldValue === "") {
3571
+ if (isComposerEmptyText(fieldValue)) {
3572
+ if (composerEdit && canInlineEdit(name, fieldValue) && !isReactNodeFallback(fallback)) {
3573
+ return /* @__PURE__ */ jsxRuntime.jsx(
3574
+ ComposerInlineField,
3575
+ {
3576
+ name,
3577
+ value: fieldValue,
3578
+ fallback: typeof fallback === "string" || typeof fallback === "number" ? fallback : void 0,
3579
+ className,
3580
+ layoutNodeId: context.layoutNodeId,
3581
+ componentId: context.componentId
3582
+ }
3583
+ );
3584
+ }
3466
3585
  return fallback ? /* @__PURE__ */ jsxRuntime.jsx(Tag, { className, children: fallback }) : null;
3467
3586
  }
3468
3587
  let html = "";
@@ -3480,6 +3599,30 @@ function RichText({
3480
3599
  if (!html) {
3481
3600
  return fallback ? /* @__PURE__ */ jsxRuntime.jsx(Tag, { className, children: fallback }) : null;
3482
3601
  }
3602
+ if (composerEdit && htmlHasVisualChrome(html)) {
3603
+ return /* @__PURE__ */ jsxRuntime.jsx(
3604
+ Tag,
3605
+ {
3606
+ className,
3607
+ "data-amplifyup-field": name,
3608
+ "data-amplifyup-node-id": context.layoutNodeId || void 0,
3609
+ dangerouslySetInnerHTML: { __html: html }
3610
+ }
3611
+ );
3612
+ }
3613
+ if (composerEdit && canInlineEdit(name, fieldValue)) {
3614
+ return /* @__PURE__ */ jsxRuntime.jsx(
3615
+ ComposerInlineHtml,
3616
+ {
3617
+ name,
3618
+ html,
3619
+ className,
3620
+ Tag,
3621
+ layoutNodeId: context.layoutNodeId,
3622
+ componentId: context.componentId
3623
+ }
3624
+ );
3625
+ }
3483
3626
  return /* @__PURE__ */ jsxRuntime.jsx(Tag, { className, dangerouslySetInnerHTML: { __html: html } });
3484
3627
  }
3485
3628
  function isPortableImageValue(value) {
@@ -3500,7 +3643,7 @@ function Image({
3500
3643
  height: heightProp,
3501
3644
  ...imgProps
3502
3645
  }) {
3503
- const context = react.useContext(ComponentContext);
3646
+ const context = React.useContext(ComponentContext);
3504
3647
  const fieldValue = useFieldOverlay(
3505
3648
  context?.layoutNodeId,
3506
3649
  name,
@@ -3530,7 +3673,13 @@ function Image({
3530
3673
  }
3531
3674
  );
3532
3675
  }
3533
- var ComponentRenderBoundary = class extends react.Component {
3676
+ function nodeRenderProps(node) {
3677
+ return {
3678
+ ...node.settings || {},
3679
+ ...node.props || {}
3680
+ };
3681
+ }
3682
+ var ComponentRenderBoundary = class extends React.Component {
3534
3683
  constructor() {
3535
3684
  super(...arguments);
3536
3685
  this.state = { error: null };
@@ -3602,8 +3751,8 @@ function AmplifyRenderer({
3602
3751
  const loading = serverPageConfig ? false : clientHook.loading;
3603
3752
  const error = serverPageConfig ? null : clientHook.error;
3604
3753
  const contentSource = clientHook.source;
3605
- const [variantCache, setVariantCache] = react.useState({});
3606
- react.useEffect(() => {
3754
+ const [variantCache, setVariantCache] = React.useState({});
3755
+ React.useEffect(() => {
3607
3756
  if (typeof window !== "undefined") {
3608
3757
  if (window.__AMPLIFYUP_PREVIEW_MODE__ === true) {
3609
3758
  return;
@@ -3629,7 +3778,7 @@ function AmplifyRenderer({
3629
3778
  });
3630
3779
  }
3631
3780
  }, [pageConfig]);
3632
- react.useEffect(() => {
3781
+ React.useEffect(() => {
3633
3782
  if (!pageConfig?.eventTracking?.length) return;
3634
3783
  const sdk = getSDK();
3635
3784
  if (!sdk.isInitialized()) return;
@@ -3647,7 +3796,7 @@ function AmplifyRenderer({
3647
3796
  window.clearTimeout(t2);
3648
3797
  };
3649
3798
  }, [pageConfig?.id, pageConfig?.eventTracking]);
3650
- react.useEffect(() => {
3799
+ React.useEffect(() => {
3651
3800
  if (!pageConfig) return;
3652
3801
  const t = window.setTimeout(() => {
3653
3802
  getSDK().setupComponentViewTracking();
@@ -3655,7 +3804,7 @@ function AmplifyRenderer({
3655
3804
  }, 100);
3656
3805
  return () => window.clearTimeout(t);
3657
3806
  }, [variantCache, pageConfig?.id]);
3658
- react.useEffect(() => {
3807
+ React.useEffect(() => {
3659
3808
  const isVisualEditorMode = () => {
3660
3809
  if (typeof window === "undefined") return false;
3661
3810
  const urlParams = new URLSearchParams(window.location.search);
@@ -3741,7 +3890,7 @@ function AmplifyRenderer({
3741
3890
  console.log("[AmplifyRenderer] Sent component tree from layoutTree:", componentTree.length, "root components");
3742
3891
  }
3743
3892
  }, [pageConfig]);
3744
- react.useEffect(() => {
3893
+ React.useEffect(() => {
3745
3894
  if (!pageConfig?.layoutTree || !pageConfig.layoutId) return;
3746
3895
  const roots = pageConfig.layoutTree;
3747
3896
  const fromEdge = contentSource === "edge" || roots.some((n) => n._contentSource === "edge");
@@ -3882,7 +4031,7 @@ function AmplifyRenderer({
3882
4031
  "data-amplifyup-slot": "content",
3883
4032
  "data-parent-node-id": node.id,
3884
4033
  "data-parent-component-id": "AmplifyZone",
3885
- children: children.filter(Boolean).map((child) => /* @__PURE__ */ jsxRuntime.jsx(react.Fragment, { children: renderNode(child) }, child.id))
4034
+ children: children.filter(Boolean).map((child) => /* @__PURE__ */ jsxRuntime.jsx(React.Fragment, { children: renderNode(child) }, child.id))
3886
4035
  }
3887
4036
  )
3888
4037
  }
@@ -3932,7 +4081,7 @@ function AmplifyRenderer({
3932
4081
  "data-zone-id": slot.zoneId || void 0,
3933
4082
  "data-parent-node-id": node.id,
3934
4083
  "data-parent-component-id": node.componentId,
3935
- children: safeChildren.filter(Boolean).map((child) => /* @__PURE__ */ jsxRuntime.jsx(react.Fragment, { children: renderNode(child) }, child.id))
4084
+ children: safeChildren.filter(Boolean).map((child) => /* @__PURE__ */ jsxRuntime.jsx(React.Fragment, { children: renderNode(child) }, child.id))
3936
4085
  },
3937
4086
  slot.slotId
3938
4087
  );
@@ -3953,7 +4102,7 @@ function AmplifyRenderer({
3953
4102
  {
3954
4103
  nodeId: node.id,
3955
4104
  componentId: node.componentId,
3956
- props: node.props || {},
4105
+ props: nodeRenderProps(node),
3957
4106
  slots: slotsToPass,
3958
4107
  renderComponent
3959
4108
  }
@@ -4123,14 +4272,14 @@ if (typeof window !== "undefined") {
4123
4272
  } catch {
4124
4273
  }
4125
4274
  }
4126
- var AmplifyUpContext = react.createContext(null);
4275
+ var AmplifyUpContext = React.createContext(null);
4127
4276
  function AmplifyUpProvider({ children, config }) {
4128
- const [initialized, setInitialized] = react.useState(false);
4129
- const [pageConfig, setPageConfig] = react.useState(null);
4130
- const [loading, setLoading] = react.useState(true);
4131
- const [error, setError] = react.useState(null);
4132
- const [source, setSource] = react.useState(null);
4133
- const [meta, setMeta] = react.useState(null);
4277
+ const [initialized, setInitialized] = React.useState(false);
4278
+ const [pageConfig, setPageConfig] = React.useState(null);
4279
+ const [loading, setLoading] = React.useState(true);
4280
+ const [error, setError] = React.useState(null);
4281
+ const [source, setSource] = React.useState(null);
4282
+ const [meta, setMeta] = React.useState(null);
4134
4283
  const getActualRoute = () => {
4135
4284
  if (typeof window === "undefined") return "";
4136
4285
  const currentPath = window.location.pathname;
@@ -4148,13 +4297,13 @@ function AmplifyUpProvider({ children, config }) {
4148
4297
  return currentPath;
4149
4298
  };
4150
4299
  const nextPathname = usePathname ? usePathname() : null;
4151
- const [pathname, setPathname] = react.useState(() => {
4300
+ const [pathname, setPathname] = React.useState(() => {
4152
4301
  if (typeof window !== "undefined") {
4153
4302
  return getActualRoute();
4154
4303
  }
4155
4304
  return "";
4156
4305
  });
4157
- react.useEffect(() => {
4306
+ React.useEffect(() => {
4158
4307
  if (typeof window !== "undefined") {
4159
4308
  const actualRoute = getActualRoute();
4160
4309
  if (window.location.pathname === "/api/pages/proxy" || window.location.pathname.startsWith("/api/pages/proxy")) {
@@ -4180,7 +4329,7 @@ function AmplifyUpProvider({ children, config }) {
4180
4329
  };
4181
4330
  }
4182
4331
  }, [nextPathname]);
4183
- react.useEffect(() => {
4332
+ React.useEffect(() => {
4184
4333
  let cancelled = false;
4185
4334
  const sdk = getSDK();
4186
4335
  sdk.init(config).then(() => {
@@ -4197,7 +4346,7 @@ function AmplifyUpProvider({ children, config }) {
4197
4346
  cancelled = true;
4198
4347
  };
4199
4348
  }, [config.trackingId, config.target, config.debug, config.dev, config.siteId]);
4200
- react.useEffect(() => {
4349
+ React.useEffect(() => {
4201
4350
  if (!initialized) return;
4202
4351
  let cancelled = false;
4203
4352
  const load = async () => {
@@ -4293,7 +4442,7 @@ function AmplifyUpProvider({ children, config }) {
4293
4442
  );
4294
4443
  }
4295
4444
  function useAmplifyUp() {
4296
- const context = react.useContext(AmplifyUpContext);
4445
+ const context = React.useContext(AmplifyUpContext);
4297
4446
  if (!context) {
4298
4447
  throw new Error("useAmplifyUp must be used within AmplifyUpProvider");
4299
4448
  }