@amplifyup/sdk 0.1.39 → 0.1.41

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.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  'use client';
2
- import { createContext, useState, useEffect, useContext, Fragment as Fragment$1, useRef, Component } from 'react';
2
+ import React, { createContext, useState, useEffect, useContext, Fragment as Fragment$1, useSyncExternalStore, useRef, Component } from 'react';
3
3
  import { marked } from 'marked';
4
4
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
5
5
 
@@ -102,6 +102,7 @@ var AWSAdapter = class {
102
102
  const eventData = {
103
103
  type: "page",
104
104
  anonymousId: properties.instanceId,
105
+ sessionId: properties.sessionId,
105
106
  userId: properties.userId,
106
107
  properties: {
107
108
  path: properties.path || properties.url,
@@ -144,6 +145,7 @@ var AWSAdapter = class {
144
145
  type: "track",
145
146
  event: eventName,
146
147
  anonymousId: properties.instanceId,
148
+ sessionId: properties.sessionId,
147
149
  userId: properties.userId,
148
150
  properties: {
149
151
  ...properties
@@ -166,6 +168,7 @@ var AWSAdapter = class {
166
168
  const eventData = {
167
169
  type: "identify",
168
170
  anonymousId: traits.instanceId,
171
+ sessionId: traits.sessionId,
169
172
  traits: {
170
173
  ...traits,
171
174
  ...identifiers ? { identifiers } : {}
@@ -184,6 +187,7 @@ var AWSAdapter = class {
184
187
  const eventData = {
185
188
  type: "set_fields",
186
189
  anonymousId: context.instanceId,
190
+ sessionId: context.sessionId,
187
191
  fields,
188
192
  traits: {
189
193
  instanceId: context.instanceId,
@@ -206,7 +210,11 @@ var AWSAdapter = class {
206
210
  // src/storage.ts
207
211
  var INSTANCE_ID_KEY = "amplifyup_instance_id";
208
212
  var USER_ID_KEY = "amplifyup_user_id";
213
+ var SESSION_ID_KEY = "amplifyup_session_id";
214
+ var SESSION_ACTIVITY_KEY = "amplifyup_session_activity";
209
215
  var ANON_COOKIE_NAME = "amplifyup_anon_id";
216
+ var SESSION_COOKIE_NAME = "amplifyup_session_id";
217
+ var SESSION_IDLE_GAP_MS = 30 * 60 * 1e3;
210
218
  function generateGuid() {
211
219
  if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
212
220
  return crypto.randomUUID();
@@ -233,9 +241,9 @@ function readCookie(name) {
233
241
  }
234
242
  return null;
235
243
  }
236
- function writeCookie(name, value) {
244
+ function writeCookie(name, value, maxAgeSeconds = 31536e3) {
237
245
  if (typeof document === "undefined") return;
238
- document.cookie = `${name}=${encodeURIComponent(value)}; Path=/; Max-Age=31536000; SameSite=Lax`;
246
+ document.cookie = `${name}=${encodeURIComponent(value)}; Path=/; Max-Age=${maxAgeSeconds}; SameSite=Lax`;
239
247
  }
240
248
  function getInstanceId() {
241
249
  if (typeof window === "undefined") {
@@ -258,6 +266,23 @@ function getUserId() {
258
266
  }
259
267
  return localStorage.getItem(USER_ID_KEY);
260
268
  }
269
+ function getSessionId() {
270
+ if (typeof window === "undefined") {
271
+ return "";
272
+ }
273
+ const now = Date.now();
274
+ const lastActivity = Number(localStorage.getItem(SESSION_ACTIVITY_KEY) || 0);
275
+ const fromCookie = readCookie(SESSION_COOKIE_NAME);
276
+ const fromLs = localStorage.getItem(SESSION_ID_KEY);
277
+ let sessionId = fromLs || fromCookie || "";
278
+ if (!sessionId || lastActivity > 0 && now - lastActivity >= SESSION_IDLE_GAP_MS) {
279
+ sessionId = generateGuid();
280
+ }
281
+ localStorage.setItem(SESSION_ID_KEY, sessionId);
282
+ localStorage.setItem(SESSION_ACTIVITY_KEY, String(now));
283
+ writeCookie(SESSION_COOKIE_NAME, sessionId, Math.floor(SESSION_IDLE_GAP_MS / 1e3));
284
+ return sessionId;
285
+ }
261
286
  function setUserId(userId) {
262
287
  if (typeof window === "undefined") {
263
288
  return;
@@ -270,7 +295,10 @@ function clearIds() {
270
295
  }
271
296
  localStorage.removeItem(INSTANCE_ID_KEY);
272
297
  localStorage.removeItem(USER_ID_KEY);
298
+ localStorage.removeItem(SESSION_ID_KEY);
299
+ localStorage.removeItem(SESSION_ACTIVITY_KEY);
273
300
  document.cookie = `${ANON_COOKIE_NAME}=; Path=/; Max-Age=0; SameSite=Lax`;
301
+ document.cookie = `${SESSION_COOKIE_NAME}=; Path=/; Max-Age=0; SameSite=Lax`;
274
302
  }
275
303
 
276
304
  // src/targets.ts
@@ -433,6 +461,7 @@ async function fetchEdgeResolve(options) {
433
461
  params.set("variants", variantParam);
434
462
  } else if (options.anonId) {
435
463
  params.set("anonId", options.anonId);
464
+ if (options.sessionId) params.set("sessionId", options.sessionId);
436
465
  }
437
466
  const fetchFn = options.fetch ?? globalThis.fetch.bind(globalThis);
438
467
  const init = {
@@ -534,6 +563,7 @@ async function fetchContent(options) {
534
563
  trackingId: options.trackingId,
535
564
  route: options.route,
536
565
  anonId: options.variantKeys ? void 0 : options.anonId,
566
+ sessionId: options.variantKeys ? void 0 : options.sessionId,
537
567
  siteId: options.siteId,
538
568
  fetch: options.fetchFn,
539
569
  revalidate: options.revalidate,
@@ -603,6 +633,7 @@ async function fetchEdgeSelect(options) {
603
633
  ...options.trackingId ? { trackingId: options.trackingId } : {},
604
634
  ...options.site ? { site: options.site } : {},
605
635
  anonId: options.anonId,
636
+ ...options.sessionId ? { sessionId: options.sessionId } : {},
606
637
  ...options.zones?.length ? { zones: options.zones } : {},
607
638
  ...options.context ? { context: options.context } : {}
608
639
  })
@@ -631,6 +662,7 @@ async function selectVariants(options) {
631
662
  site: options.site,
632
663
  view: options.view,
633
664
  anonId: options.anonId,
665
+ sessionId: options.sessionId,
634
666
  zones: options.zones,
635
667
  context: options.context,
636
668
  fetch: options.fetch,
@@ -715,7 +747,6 @@ function searchSpec(pagination, field, term) {
715
747
  }
716
748
 
717
749
  // src/index.ts
718
- var SESSION_IDLE_GAP_MS = 30 * 60 * 1e3;
719
750
  var DWELL_ACTIVITY_IDLE_MS = 2 * 60 * 1e3;
720
751
  var DWELL_POLL_MS = 5e3;
721
752
  function readPreviewQueryOverrides() {
@@ -891,6 +922,7 @@ var AmplifyUpSDK = class {
891
922
  if (typeof window === "undefined") return;
892
923
  window.AmplifyUp = {
893
924
  getInstanceId: () => this.getInstanceId(),
925
+ getSessionId: () => this.getSessionId(),
894
926
  getUserId: () => this.getUserId(),
895
927
  getTrackingId: () => this.getTrackingId(),
896
928
  getTarget: () => this.getTarget(),
@@ -1313,12 +1345,14 @@ var AmplifyUpSDK = class {
1313
1345
  return;
1314
1346
  }
1315
1347
  const instanceId = getInstanceId();
1348
+ const sessionId = getSessionId();
1316
1349
  const pageProperties = {
1317
1350
  name: url,
1318
1351
  path: url,
1319
1352
  url: typeof window !== "undefined" ? window.location.href : url,
1320
1353
  referrer: typeof document !== "undefined" ? document.referrer : void 0,
1321
1354
  instanceId,
1355
+ sessionId,
1322
1356
  trackingId: this.config?.trackingId,
1323
1357
  // Timestamp is included in event payload
1324
1358
  ...properties
@@ -1337,8 +1371,10 @@ var AmplifyUpSDK = class {
1337
1371
  return;
1338
1372
  }
1339
1373
  const instanceId = getInstanceId();
1374
+ const sessionId = getSessionId();
1340
1375
  const trackProperties = {
1341
1376
  instanceId,
1377
+ sessionId,
1342
1378
  trackingId: this.config?.trackingId,
1343
1379
  url: typeof window !== "undefined" ? window.location.href : void 0,
1344
1380
  path: properties?.path || (typeof window !== "undefined" ? window.location.pathname : void 0),
@@ -1411,8 +1447,10 @@ var AmplifyUpSDK = class {
1411
1447
  return;
1412
1448
  }
1413
1449
  const instanceId = getInstanceId();
1450
+ const sessionId = getSessionId();
1414
1451
  const identifyTraits = {
1415
1452
  instanceId,
1453
+ sessionId,
1416
1454
  trackingId: this.config?.trackingId,
1417
1455
  ...traits
1418
1456
  };
@@ -1450,6 +1488,7 @@ var AmplifyUpSDK = class {
1450
1488
  if (typeof this.adapter.setProfileFields === "function") {
1451
1489
  this.adapter.setProfileFields(fields, {
1452
1490
  instanceId: instanceId || void 0,
1491
+ sessionId: getSessionId() || void 0,
1453
1492
  trackingId: this.config?.trackingId
1454
1493
  });
1455
1494
  }
@@ -1500,6 +1539,12 @@ var AmplifyUpSDK = class {
1500
1539
  getInstanceId() {
1501
1540
  return getInstanceId();
1502
1541
  }
1542
+ /**
1543
+ * Get session id (30-minute inactivity reset).
1544
+ */
1545
+ getSessionId() {
1546
+ return getSessionId();
1547
+ }
1503
1548
  /**
1504
1549
  * Get user ID
1505
1550
  */
@@ -3031,7 +3076,10 @@ function useLiveComposerProps(layoutNodeId, props) {
3031
3076
  return;
3032
3077
  }
3033
3078
  if (!matchesNode(nodeId)) return;
3034
- setLive(nextProps);
3079
+ setLive((prev) => ({
3080
+ ...prev,
3081
+ ...nextProps
3082
+ }));
3035
3083
  };
3036
3084
  const onPatch = (event) => {
3037
3085
  const detail = event.detail || {};
@@ -3192,6 +3240,32 @@ function isLikelyNonTextFieldName(name) {
3192
3240
  const n = name.toLowerCase();
3193
3241
  return n.includes("href") || n.includes("url") || n.includes("src") || n.includes("image") || n.includes("icon") || n.includes("overlay") || n.includes("color");
3194
3242
  }
3243
+ function isPlainTextValue(value) {
3244
+ return typeof value === "string" || typeof value === "number";
3245
+ }
3246
+ var COMPOSER_EMPTY_FIELD_HINT = "Click here to edit this field";
3247
+ var EMPTY_FIELD_PLACEHOLDERS = /* @__PURE__ */ new Set([
3248
+ COMPOSER_EMPTY_FIELD_HINT,
3249
+ "Click here to enter text",
3250
+ "Sample Title",
3251
+ "Sample Heading",
3252
+ "Sample Subheading"
3253
+ ]);
3254
+ function isComposerEmptyText(value) {
3255
+ if (value === void 0 || value === null) return true;
3256
+ if (typeof value !== "string") return false;
3257
+ const trimmed = value.trim();
3258
+ return trimmed === "" || EMPTY_FIELD_PLACEHOLDERS.has(trimmed);
3259
+ }
3260
+ function isReactNodeFallback(fallback) {
3261
+ if (fallback == null || fallback === false) return false;
3262
+ return !isPlainTextValue(fallback);
3263
+ }
3264
+ function htmlHasVisualChrome(html) {
3265
+ return /<(input|button|select|textarea|form|svg|iframe|video|audio|img)\b/i.test(
3266
+ html
3267
+ );
3268
+ }
3195
3269
  function canInlineEdit(name, value) {
3196
3270
  if (isLikelyNonTextFieldName(name)) return false;
3197
3271
  if (value !== void 0 && value !== null && typeof value === "object") {
@@ -3200,15 +3274,18 @@ function canInlineEdit(name, value) {
3200
3274
  if (typeof value === "boolean") return false;
3201
3275
  return true;
3202
3276
  }
3277
+ function subscribeComposerEdit(onStoreChange) {
3278
+ if (typeof window === "undefined") return () => {
3279
+ };
3280
+ window.addEventListener("amplifyup:composer-edit", onStoreChange);
3281
+ return () => window.removeEventListener("amplifyup:composer-edit", onStoreChange);
3282
+ }
3203
3283
  function useComposerEditMode() {
3204
- const [enabled, setEnabled] = useState(false);
3205
- useEffect(() => {
3206
- const sync = () => setEnabled(isComposerEditMode());
3207
- sync();
3208
- window.addEventListener("amplifyup:composer-edit", sync);
3209
- return () => window.removeEventListener("amplifyup:composer-edit", sync);
3210
- }, []);
3211
- return enabled;
3284
+ return useSyncExternalStore(
3285
+ subscribeComposerEdit,
3286
+ isComposerEditMode,
3287
+ () => false
3288
+ );
3212
3289
  }
3213
3290
  function useFieldOverlay(layoutNodeId, name, source) {
3214
3291
  const [overlay, setOverlay] = useState(void 0);
@@ -3239,6 +3316,14 @@ function commitComposerField(layoutNodeId, componentId, name, value) {
3239
3316
  "*"
3240
3317
  );
3241
3318
  }
3319
+ function placeCaret(el, atStart = false) {
3320
+ const range = document.createRange();
3321
+ range.selectNodeContents(el);
3322
+ range.collapse(atStart);
3323
+ const sel = window.getSelection();
3324
+ sel?.removeAllRanges();
3325
+ sel?.addRange(range);
3326
+ }
3242
3327
  function ComposerInlineField({
3243
3328
  name,
3244
3329
  value,
@@ -3249,35 +3334,54 @@ function ComposerInlineField({
3249
3334
  componentId
3250
3335
  }) {
3251
3336
  const [editing, setEditing] = useState(false);
3337
+ const [focused, setFocused] = useState(false);
3252
3338
  const elRef = useRef(null);
3253
- const text = formatFieldValue(value);
3339
+ const storedEmpty = isComposerEmptyText(value);
3340
+ const text = storedEmpty ? "" : formatFieldValue(value);
3254
3341
  const fallbackText = typeof fallback === "string" || typeof fallback === "number" ? String(fallback) : "";
3255
- const display = text || fallbackText;
3342
+ const hint = COMPOSER_EMPTY_FIELD_HINT;
3343
+ const idleDisplay = storedEmpty ? hint : text || fallbackText;
3256
3344
  const showRendered = !!render && !editing;
3345
+ const showHint = storedEmpty && !focused && !showRendered;
3257
3346
  useEffect(() => {
3258
3347
  const el = elRef.current;
3259
3348
  if (!el || showRendered) return;
3260
3349
  if (document.activeElement === el) return;
3261
- const next = display || "";
3350
+ if (el.querySelector(
3351
+ "input, button, select, textarea, form, svg, iframe, img"
3352
+ )) {
3353
+ return;
3354
+ }
3355
+ const next = idleDisplay || "";
3262
3356
  if (el.textContent !== next) el.textContent = next;
3263
- }, [display, showRendered]);
3357
+ }, [idleDisplay, showRendered]);
3264
3358
  useEffect(() => {
3265
3359
  if (!editing || !elRef.current) return;
3266
3360
  const el = elRef.current;
3267
- el.textContent = display || "";
3361
+ if (storedEmpty) {
3362
+ el.textContent = "";
3363
+ el.focus();
3364
+ placeCaret(el, true);
3365
+ return;
3366
+ }
3367
+ el.textContent = idleDisplay || "";
3268
3368
  el.focus();
3269
- const range = document.createRange();
3270
- range.selectNodeContents(el);
3271
- const sel = window.getSelection();
3272
- sel?.removeAllRanges();
3273
- sel?.addRange(range);
3274
- }, [editing]);
3369
+ placeCaret(el, false);
3370
+ }, [editing, storedEmpty, idleDisplay]);
3275
3371
  const finishEdit = () => {
3276
3372
  const raw = (elRef.current?.innerText ?? "").replace(/\u00a0/g, " ").replace(/\n+$/g, "");
3277
3373
  const next = raw.trim() === "" ? "" : raw;
3278
3374
  setEditing(false);
3375
+ setFocused(false);
3376
+ if (storedEmpty && next === "") {
3377
+ if (elRef.current) elRef.current.textContent = hint;
3378
+ if (typeof value === "string" && EMPTY_FIELD_PLACEHOLDERS.has(value.trim())) {
3379
+ commitComposerField(layoutNodeId, componentId, name, "");
3380
+ }
3381
+ return;
3382
+ }
3279
3383
  if (next === text) return;
3280
- if (!text && next === fallbackText) return;
3384
+ if (!text && !storedEmpty && next === fallbackText) return;
3281
3385
  commitComposerField(layoutNodeId, componentId, name, next);
3282
3386
  };
3283
3387
  return /* @__PURE__ */ jsx(
@@ -3287,6 +3391,7 @@ function ComposerInlineField({
3287
3391
  className,
3288
3392
  "data-amplifyup-field": name,
3289
3393
  "data-amplifyup-node-id": layoutNodeId || void 0,
3394
+ "data-amplifyup-empty-hint": showHint ? "true" : void 0,
3290
3395
  contentEditable: !showRendered,
3291
3396
  suppressContentEditableWarning: true,
3292
3397
  role: "textbox",
@@ -3303,6 +3408,12 @@ function ComposerInlineField({
3303
3408
  },
3304
3409
  onFocus: () => {
3305
3410
  if (!isComposerEditMode()) return;
3411
+ setFocused(true);
3412
+ const el = elRef.current;
3413
+ if (el && storedEmpty) {
3414
+ el.textContent = "";
3415
+ placeCaret(el, true);
3416
+ }
3306
3417
  if (render) setEditing(true);
3307
3418
  },
3308
3419
  onBlur: finishEdit,
@@ -3314,8 +3425,9 @@ function ComposerInlineField({
3314
3425
  }
3315
3426
  if (event.key === "Escape") {
3316
3427
  event.preventDefault();
3317
- if (elRef.current) elRef.current.textContent = display || "";
3428
+ if (elRef.current) elRef.current.textContent = idleDisplay || "";
3318
3429
  setEditing(false);
3430
+ setFocused(false);
3319
3431
  event.currentTarget.blur();
3320
3432
  }
3321
3433
  },
@@ -3324,12 +3436,59 @@ function ComposerInlineField({
3324
3436
  outline: "1px dashed color-mix(in srgb, currentColor 40%, transparent)",
3325
3437
  outlineOffset: "2px",
3326
3438
  minWidth: "1ch",
3327
- display: render ? void 0 : "inline"
3439
+ minHeight: "1em",
3440
+ display: render ? void 0 : "inline",
3441
+ opacity: showHint ? 0.5 : void 0
3328
3442
  },
3329
- children: showRendered ? value != null && value !== "" ? render(value) : fallback ?? display : null
3443
+ children: showRendered ? value != null && value !== "" && !storedEmpty ? render(value) : fallback ?? idleDisplay : isReactNodeFallback(fallback) && !idleDisplay ? fallback : null
3330
3444
  }
3331
3445
  );
3332
3446
  }
3447
+ function ComposerInlineHtml({
3448
+ name,
3449
+ html,
3450
+ className,
3451
+ Tag = "div",
3452
+ layoutNodeId,
3453
+ componentId
3454
+ }) {
3455
+ const elRef = useRef(null);
3456
+ const sourceTextRef = useRef("");
3457
+ useEffect(() => {
3458
+ const el = elRef.current;
3459
+ if (!el) return;
3460
+ if (document.activeElement === el || el.contains(document.activeElement)) {
3461
+ return;
3462
+ }
3463
+ if (el.innerHTML !== html) el.innerHTML = html;
3464
+ sourceTextRef.current = (el.innerText ?? "").replace(/\u00a0/g, " ").trim();
3465
+ }, [html]);
3466
+ const finishEdit = () => {
3467
+ const el = elRef.current;
3468
+ if (!el) return;
3469
+ const next = (el.innerText ?? "").replace(/\u00a0/g, " ").replace(/\n+$/g, "");
3470
+ if (next.trim() === sourceTextRef.current) return;
3471
+ commitComposerField(layoutNodeId, componentId, name, next.trim());
3472
+ };
3473
+ return React.createElement(Tag, {
3474
+ ref: elRef,
3475
+ className,
3476
+ "data-amplifyup-field": name,
3477
+ "data-amplifyup-node-id": layoutNodeId || void 0,
3478
+ contentEditable: true,
3479
+ suppressContentEditableWarning: true,
3480
+ dangerouslySetInnerHTML: { __html: html },
3481
+ onMouseDown: (event) => {
3482
+ event.stopPropagation();
3483
+ },
3484
+ onBlur: finishEdit,
3485
+ style: {
3486
+ cursor: "text",
3487
+ outline: "1px dashed color-mix(in srgb, currentColor 40%, transparent)",
3488
+ outlineOffset: "2px"
3489
+ }
3490
+ });
3491
+ }
3333
3492
  function formatFieldValue(value) {
3334
3493
  if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
3335
3494
  return String(value);
@@ -3396,7 +3555,13 @@ function Field({
3396
3555
  if (render) {
3397
3556
  return /* @__PURE__ */ jsx("span", { className, style: { display: "contents" }, children: render(fieldValue) });
3398
3557
  }
3399
- if (composerEdit && canInlineEdit(name, fieldValue)) {
3558
+ if (Array.isArray(fieldValue)) {
3559
+ const list = renderLinkList(fieldValue, className);
3560
+ if (list) return list;
3561
+ }
3562
+ const text = formatFieldValue(fieldValue);
3563
+ const showVisualFallback = !text && isReactNodeFallback(fallback);
3564
+ if (composerEdit && canInlineEdit(name, fieldValue) && !showVisualFallback) {
3400
3565
  return /* @__PURE__ */ jsx(
3401
3566
  ComposerInlineField,
3402
3567
  {
@@ -3412,11 +3577,6 @@ function Field({
3412
3577
  if (fieldValue === void 0 || fieldValue === null) {
3413
3578
  return fallback ? /* @__PURE__ */ jsx("span", { className, children: fallback }) : null;
3414
3579
  }
3415
- if (Array.isArray(fieldValue)) {
3416
- const list = renderLinkList(fieldValue, className);
3417
- if (list) return list;
3418
- }
3419
- const text = formatFieldValue(fieldValue);
3420
3580
  if (!text) {
3421
3581
  return fallback ? /* @__PURE__ */ jsx("span", { className, children: fallback }) : null;
3422
3582
  }
@@ -3447,20 +3607,20 @@ function RichText({
3447
3607
  console.warn(`[AmplifyUp SDK] RichText "${name}" used outside ComponentContextProvider`);
3448
3608
  return fallback ? /* @__PURE__ */ jsx(Fragment, { children: fallback }) : null;
3449
3609
  }
3450
- if (composerEdit && canInlineEdit(name, fieldValue)) {
3451
- return /* @__PURE__ */ jsx(
3452
- ComposerInlineField,
3453
- {
3454
- name,
3455
- value: fieldValue,
3456
- fallback,
3457
- className,
3458
- layoutNodeId: context.layoutNodeId,
3459
- componentId: context.componentId
3460
- }
3461
- );
3462
- }
3463
- if (fieldValue === void 0 || fieldValue === null || fieldValue === "") {
3610
+ if (isComposerEmptyText(fieldValue)) {
3611
+ if (composerEdit && canInlineEdit(name, fieldValue) && !isReactNodeFallback(fallback)) {
3612
+ return /* @__PURE__ */ jsx(
3613
+ ComposerInlineField,
3614
+ {
3615
+ name,
3616
+ value: fieldValue,
3617
+ fallback: typeof fallback === "string" || typeof fallback === "number" ? fallback : void 0,
3618
+ className,
3619
+ layoutNodeId: context.layoutNodeId,
3620
+ componentId: context.componentId
3621
+ }
3622
+ );
3623
+ }
3464
3624
  return fallback ? /* @__PURE__ */ jsx(Tag, { className, children: fallback }) : null;
3465
3625
  }
3466
3626
  let html = "";
@@ -3478,6 +3638,30 @@ function RichText({
3478
3638
  if (!html) {
3479
3639
  return fallback ? /* @__PURE__ */ jsx(Tag, { className, children: fallback }) : null;
3480
3640
  }
3641
+ if (composerEdit && htmlHasVisualChrome(html)) {
3642
+ return /* @__PURE__ */ jsx(
3643
+ Tag,
3644
+ {
3645
+ className,
3646
+ "data-amplifyup-field": name,
3647
+ "data-amplifyup-node-id": context.layoutNodeId || void 0,
3648
+ dangerouslySetInnerHTML: { __html: html }
3649
+ }
3650
+ );
3651
+ }
3652
+ if (composerEdit && canInlineEdit(name, fieldValue)) {
3653
+ return /* @__PURE__ */ jsx(
3654
+ ComposerInlineHtml,
3655
+ {
3656
+ name,
3657
+ html,
3658
+ className,
3659
+ Tag,
3660
+ layoutNodeId: context.layoutNodeId,
3661
+ componentId: context.componentId
3662
+ }
3663
+ );
3664
+ }
3481
3665
  return /* @__PURE__ */ jsx(Tag, { className, dangerouslySetInnerHTML: { __html: html } });
3482
3666
  }
3483
3667
  function isPortableImageValue(value) {
@@ -3528,6 +3712,12 @@ function Image({
3528
3712
  }
3529
3713
  );
3530
3714
  }
3715
+ function nodeRenderProps(node) {
3716
+ return {
3717
+ ...node.settings || {},
3718
+ ...node.props || {}
3719
+ };
3720
+ }
3531
3721
  var ComponentRenderBoundary = class extends Component {
3532
3722
  constructor() {
3533
3723
  super(...arguments);
@@ -3951,7 +4141,7 @@ function AmplifyRenderer({
3951
4141
  {
3952
4142
  nodeId: node.id,
3953
4143
  componentId: node.componentId,
3954
- props: node.props || {},
4144
+ props: nodeRenderProps(node),
3955
4145
  slots: slotsToPass,
3956
4146
  renderComponent
3957
4147
  }
@@ -4227,12 +4417,14 @@ function AmplifyUpProvider({ children, config }) {
4227
4417
  }
4228
4418
  let variantKeys;
4229
4419
  const anonId = sdk.getInstanceId();
4420
+ const sessionId = sdk.getSessionId();
4230
4421
  if (!preview && anonId) {
4231
4422
  try {
4232
4423
  const selected = await selectVariants({
4233
4424
  trackingId,
4234
4425
  view: actualRoute,
4235
4426
  anonId,
4427
+ sessionId: sessionId || void 0,
4236
4428
  site: sdk.getSiteId() || void 0,
4237
4429
  edgeUrl
4238
4430
  });
@@ -4245,6 +4437,7 @@ function AmplifyUpProvider({ children, config }) {
4245
4437
  route: actualRoute,
4246
4438
  trackingId,
4247
4439
  anonId: variantKeys ? void 0 : anonId,
4440
+ sessionId: variantKeys ? void 0 : sessionId || void 0,
4248
4441
  siteId: sdk.getSiteId() || null,
4249
4442
  preview,
4250
4443
  orchestratorUrl,