@amplifyup/sdk 0.1.61 → 0.1.63
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/README.md +404 -10
- package/dist/AmplifyRenderer-Bwob7ICJ.d.ts +93 -0
- package/dist/AmplifyRenderer-TawbUIKZ.d.mts +93 -0
- package/dist/AmplifyRenderer.d.mts +4 -40
- package/dist/AmplifyRenderer.d.ts +4 -40
- package/dist/AmplifyRenderer.js +327 -30
- package/dist/AmplifyRenderer.js.map +1 -1
- package/dist/AmplifyRenderer.mjs +328 -31
- package/dist/AmplifyRenderer.mjs.map +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +135 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +135 -3
- package/dist/index.mjs.map +1 -1
- package/dist/{query-BqApXxQi.d.ts → query-3AXnQgzO.d.ts} +1 -0
- package/dist/{query-DaJlqU-Z.d.mts → query-DIZjc7st.d.mts} +1 -0
- package/dist/react.d.mts +74 -42
- package/dist/react.d.ts +74 -42
- package/dist/react.js +1613 -1253
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +1690 -1334
- package/dist/react.mjs.map +1 -1
- package/dist/server.d.mts +1 -1
- package/dist/server.d.ts +1 -1
- package/dist/server.js +134 -2
- package/dist/server.js.map +1 -1
- package/dist/server.mjs +134 -2
- package/dist/server.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -1,40 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
interface AmplifyRendererProps {
|
|
7
|
-
/**
|
|
8
|
-
* Component renderer function that maps componentId to React component
|
|
9
|
-
* This is site-specific and must be provided by the developer
|
|
10
|
-
*/
|
|
11
|
-
renderComponent: (componentId: string, props: Record<string, any>, slots?: Record<string, ReactNode>, context?: {
|
|
12
|
-
layoutNodeId: string;
|
|
13
|
-
}) => ReactNode;
|
|
14
|
-
/**
|
|
15
|
-
* Optional page config for server-side rendering (SSR/SSG)
|
|
16
|
-
* If provided, the component will use this instead of fetching client-side
|
|
17
|
-
*/
|
|
18
|
-
pageConfig?: PageConfig;
|
|
19
|
-
/**
|
|
20
|
-
* Optional loading component
|
|
21
|
-
*/
|
|
22
|
-
loadingComponent?: ReactNode;
|
|
23
|
-
/**
|
|
24
|
-
* Optional error component
|
|
25
|
-
*/
|
|
26
|
-
errorComponent?: (error: string) => ReactNode;
|
|
27
|
-
/**
|
|
28
|
-
* Optional empty state component (when no content is configured)
|
|
29
|
-
*/
|
|
30
|
-
emptyComponent?: ReactNode;
|
|
31
|
-
/**
|
|
32
|
-
* Force Composer page-slot wrapper (avoids SSR miss when window isn't available yet).
|
|
33
|
-
* When true, root components stay under [data-slot-source="page"] so hierarchy can climb to Page.
|
|
34
|
-
*/
|
|
35
|
-
composerPreview?: boolean;
|
|
36
|
-
}
|
|
37
|
-
declare function AmplifyRendererInner({ renderComponent, pageConfig: serverPageConfig, loadingComponent, errorComponent, emptyComponent, composerPreview, }: AmplifyRendererProps): react_jsx_runtime.JSX.Element | null;
|
|
38
|
-
declare const AmplifyRenderer: React.MemoExoticComponent<typeof AmplifyRendererInner>;
|
|
39
|
-
|
|
40
|
-
export { AmplifyRenderer };
|
|
1
|
+
import 'react';
|
|
2
|
+
import 'react/jsx-runtime';
|
|
3
|
+
export { A as AmplifyRenderer } from './AmplifyRenderer-Bwob7ICJ.js';
|
|
4
|
+
import './types-Db_eLrfU.js';
|
package/dist/AmplifyRenderer.js
CHANGED
|
@@ -407,6 +407,159 @@ function isComposerPreview() {
|
|
|
407
407
|
return false;
|
|
408
408
|
}
|
|
409
409
|
|
|
410
|
+
// src/field-envelope.ts
|
|
411
|
+
var FIELDS_BRAND = Symbol("amplifyup.fields");
|
|
412
|
+
function isBrandedFields(value) {
|
|
413
|
+
return !!value && typeof value === "object" && FIELDS_BRAND in value;
|
|
414
|
+
}
|
|
415
|
+
function brandFields(bag) {
|
|
416
|
+
if (isBrandedFields(bag)) return bag;
|
|
417
|
+
Object.defineProperty(bag, FIELDS_BRAND, {
|
|
418
|
+
value: true,
|
|
419
|
+
enumerable: false,
|
|
420
|
+
configurable: false
|
|
421
|
+
});
|
|
422
|
+
return bag;
|
|
423
|
+
}
|
|
424
|
+
function isFieldEnvelope(value) {
|
|
425
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return false;
|
|
426
|
+
const rec = value;
|
|
427
|
+
return typeof rec.name === "string" && "value" in rec && !("url" in rec);
|
|
428
|
+
}
|
|
429
|
+
function isPortableImageShape(value) {
|
|
430
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return false;
|
|
431
|
+
return "url" in value;
|
|
432
|
+
}
|
|
433
|
+
function isEntryRefItem(value) {
|
|
434
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return false;
|
|
435
|
+
const rec = value;
|
|
436
|
+
return typeof rec.id === "string" && rec.id.trim().length > 0 || typeof rec._id === "string" && rec._id.trim().length > 0 || typeof rec.docId === "string" && rec.docId.trim().length > 0;
|
|
437
|
+
}
|
|
438
|
+
function isRepeaterArray(value) {
|
|
439
|
+
if (!Array.isArray(value) || value.length === 0) return false;
|
|
440
|
+
const sample = value.find((item) => item != null);
|
|
441
|
+
if (sample === void 0) return false;
|
|
442
|
+
if (typeof sample !== "object" || Array.isArray(sample)) return false;
|
|
443
|
+
if (isPortableImageShape(sample)) return false;
|
|
444
|
+
if (isEntryRefItem(sample)) return false;
|
|
445
|
+
if (sample.$$typeof) return false;
|
|
446
|
+
return true;
|
|
447
|
+
}
|
|
448
|
+
function joinPath(prefix, key) {
|
|
449
|
+
return prefix ? `${prefix}.${key}` : key;
|
|
450
|
+
}
|
|
451
|
+
function emptyValue(raw) {
|
|
452
|
+
if (raw === void 0) return null;
|
|
453
|
+
return raw;
|
|
454
|
+
}
|
|
455
|
+
function toFieldEnvelopes(source, prefix = "") {
|
|
456
|
+
const input = source && typeof source === "object" && !Array.isArray(source) ? source : {};
|
|
457
|
+
if (isBrandedFields(input)) {
|
|
458
|
+
return input;
|
|
459
|
+
}
|
|
460
|
+
const out = {};
|
|
461
|
+
for (const [key, raw] of Object.entries(input)) {
|
|
462
|
+
const path = joinPath(prefix, key);
|
|
463
|
+
if (isFieldEnvelope(raw)) {
|
|
464
|
+
const inner = raw.value;
|
|
465
|
+
if (isRepeaterArray(inner)) {
|
|
466
|
+
out[key] = {
|
|
467
|
+
value: envelopeRepeaterItems(inner, raw.name || path),
|
|
468
|
+
name: raw.name || path
|
|
469
|
+
};
|
|
470
|
+
continue;
|
|
471
|
+
}
|
|
472
|
+
out[key] = { value: raw.value ?? null, name: raw.name || path };
|
|
473
|
+
continue;
|
|
474
|
+
}
|
|
475
|
+
if (isRepeaterArray(raw)) {
|
|
476
|
+
out[key] = { value: envelopeRepeaterItems(raw, path), name: path };
|
|
477
|
+
continue;
|
|
478
|
+
}
|
|
479
|
+
if (raw && typeof raw === "object" && !Array.isArray(raw) && !isPortableImageShape(raw) && !raw.$$typeof) {
|
|
480
|
+
out[key] = toFieldEnvelopes(raw, path);
|
|
481
|
+
continue;
|
|
482
|
+
}
|
|
483
|
+
out[key] = { value: emptyValue(raw), name: path };
|
|
484
|
+
}
|
|
485
|
+
return brandFields(out);
|
|
486
|
+
}
|
|
487
|
+
function envelopeRepeaterItems(items, prefix) {
|
|
488
|
+
return items.map((item, i) => {
|
|
489
|
+
const path = joinPath(prefix, String(i));
|
|
490
|
+
if (isBrandedFields(item)) return item;
|
|
491
|
+
if (item && typeof item === "object" && !Array.isArray(item)) {
|
|
492
|
+
return toFieldEnvelopes(item, path);
|
|
493
|
+
}
|
|
494
|
+
return toFieldEnvelopes({}, path);
|
|
495
|
+
});
|
|
496
|
+
}
|
|
497
|
+
function attachFieldEnvelopes(props) {
|
|
498
|
+
const raw = props && typeof props === "object" ? { ...props } : {};
|
|
499
|
+
if (isBrandedFields(raw.fields)) return raw;
|
|
500
|
+
const { fields: existing, ...content } = raw;
|
|
501
|
+
const source = existing && typeof existing === "object" && !isFieldEnvelope(existing) ? existing : content;
|
|
502
|
+
return { ...raw, fields: toFieldEnvelopes(source) };
|
|
503
|
+
}
|
|
504
|
+
function walkLayoutNodes(nodes) {
|
|
505
|
+
if (!Array.isArray(nodes)) return;
|
|
506
|
+
for (const node of nodes) {
|
|
507
|
+
if (!node || typeof node !== "object") continue;
|
|
508
|
+
const rec = node;
|
|
509
|
+
rec.props = attachFieldEnvelopes(rec.props);
|
|
510
|
+
for (const slot of rec.slots || []) {
|
|
511
|
+
walkLayoutNodes(slot.children);
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
function envelopePageConfig(page) {
|
|
516
|
+
if (!page || typeof page !== "object") return page ?? null;
|
|
517
|
+
const tree = page.layoutTree;
|
|
518
|
+
if (Array.isArray(tree)) walkLayoutNodes(tree);
|
|
519
|
+
return page;
|
|
520
|
+
}
|
|
521
|
+
function collectFieldPatches(props) {
|
|
522
|
+
const out = [];
|
|
523
|
+
const walkRepeater = (items, prefix) => {
|
|
524
|
+
items.forEach((item, i) => {
|
|
525
|
+
const itemPath = joinPath(prefix, String(i));
|
|
526
|
+
if (isBrandedFields(item) || item && typeof item === "object" && !Array.isArray(item) && !isFieldEnvelope(item)) {
|
|
527
|
+
walk(item, itemPath);
|
|
528
|
+
}
|
|
529
|
+
});
|
|
530
|
+
};
|
|
531
|
+
const walk = (obj, prefix) => {
|
|
532
|
+
for (const [key, raw] of Object.entries(obj)) {
|
|
533
|
+
if (key === "fields" && raw && typeof raw === "object" && !Array.isArray(raw) && !isFieldEnvelope(raw)) {
|
|
534
|
+
walk(raw, prefix);
|
|
535
|
+
continue;
|
|
536
|
+
}
|
|
537
|
+
const path = joinPath(prefix, key);
|
|
538
|
+
if (isFieldEnvelope(raw)) {
|
|
539
|
+
if (isRepeaterArray(raw.value)) {
|
|
540
|
+
walkRepeater(raw.value, raw.name || path);
|
|
541
|
+
continue;
|
|
542
|
+
}
|
|
543
|
+
out.push({ name: raw.name || path, value: raw.value });
|
|
544
|
+
continue;
|
|
545
|
+
}
|
|
546
|
+
if (isRepeaterArray(raw)) {
|
|
547
|
+
walkRepeater(raw, path);
|
|
548
|
+
continue;
|
|
549
|
+
}
|
|
550
|
+
if (raw && typeof raw === "object" && !Array.isArray(raw) && !isPortableImageShape(raw) && !raw.$$typeof) {
|
|
551
|
+
walk(raw, path);
|
|
552
|
+
continue;
|
|
553
|
+
}
|
|
554
|
+
out.push({ name: path, value: emptyValue(raw) });
|
|
555
|
+
}
|
|
556
|
+
};
|
|
557
|
+
if (props && typeof props === "object" && !Array.isArray(props)) {
|
|
558
|
+
walk(props, "");
|
|
559
|
+
}
|
|
560
|
+
return out;
|
|
561
|
+
}
|
|
562
|
+
|
|
410
563
|
// src/page-context.ts
|
|
411
564
|
var defaultLog = {
|
|
412
565
|
warn: (...args) => {
|
|
@@ -555,7 +708,70 @@ function mergeEventContext(properties, attached) {
|
|
|
555
708
|
...attached.pageRoute ? { pageRoute: attached.pageRoute } : {}
|
|
556
709
|
};
|
|
557
710
|
}
|
|
711
|
+
var PAGE_RESOURCE_MARKER = "__amplifyupPageResource";
|
|
712
|
+
function isPageResourceSentinel(value) {
|
|
713
|
+
return !!value && typeof value === "object" && !Array.isArray(value) && typeof value[PAGE_RESOURCE_MARKER] === "string";
|
|
714
|
+
}
|
|
715
|
+
function getByDotPath(source, path) {
|
|
716
|
+
if (!path) return source;
|
|
717
|
+
const parts = path.split(".").filter(Boolean);
|
|
718
|
+
let cur = source;
|
|
719
|
+
for (const part of parts) {
|
|
720
|
+
if (cur == null || typeof cur !== "object" || Array.isArray(cur)) {
|
|
721
|
+
return void 0;
|
|
722
|
+
}
|
|
723
|
+
cur = cur[part];
|
|
724
|
+
}
|
|
725
|
+
return cur;
|
|
726
|
+
}
|
|
727
|
+
function hydratePageResourceValue(value, fields) {
|
|
728
|
+
if (!isPageResourceSentinel(value)) return value;
|
|
729
|
+
if (!fields) return null;
|
|
730
|
+
if (value.path) return getByDotPath(fields, value.path) ?? null;
|
|
731
|
+
return fields;
|
|
732
|
+
}
|
|
733
|
+
function hydrateFieldsBag(bag, fields) {
|
|
734
|
+
const out = {};
|
|
735
|
+
for (const [key, val] of Object.entries(bag)) {
|
|
736
|
+
if (val && typeof val === "object" && !Array.isArray(val) && typeof val.name === "string" && "value" in val && !("url" in val)) {
|
|
737
|
+
const env = val;
|
|
738
|
+
out[key] = {
|
|
739
|
+
name: env.name,
|
|
740
|
+
value: isPageResourceSentinel(env.value) ? hydratePageResourceValue(env.value, fields) : env.value
|
|
741
|
+
};
|
|
742
|
+
continue;
|
|
743
|
+
}
|
|
744
|
+
if (val && typeof val === "object" && !Array.isArray(val) && !("url" in val)) {
|
|
745
|
+
out[key] = hydrateFieldsBag(val, fields);
|
|
746
|
+
continue;
|
|
747
|
+
}
|
|
748
|
+
out[key] = isPageResourceSentinel(val) ? hydratePageResourceValue(val, fields) : val;
|
|
749
|
+
}
|
|
750
|
+
return out;
|
|
751
|
+
}
|
|
752
|
+
function hydratePageResourceProps(props, fields) {
|
|
753
|
+
const source = props && typeof props === "object" ? props : {};
|
|
754
|
+
const out = { ...source };
|
|
755
|
+
if (out.fields && typeof out.fields === "object" && !Array.isArray(out.fields)) {
|
|
756
|
+
const next = hydrateFieldsBag(out.fields, fields);
|
|
757
|
+
out.fields = isBrandedFields(out.fields) ? brandFields(next) : next;
|
|
758
|
+
}
|
|
759
|
+
for (const [key, val] of Object.entries(out)) {
|
|
760
|
+
if (key === "fields") continue;
|
|
761
|
+
if (isPageResourceSentinel(val)) {
|
|
762
|
+
out[key] = hydratePageResourceValue(val, fields);
|
|
763
|
+
}
|
|
764
|
+
}
|
|
765
|
+
return out;
|
|
766
|
+
}
|
|
767
|
+
|
|
768
|
+
// src/page-resource-runtime.ts
|
|
769
|
+
var pageResourceFields = null;
|
|
558
770
|
function setPageResourceFields(fields) {
|
|
771
|
+
pageResourceFields = fields && typeof fields === "object" ? fields : null;
|
|
772
|
+
}
|
|
773
|
+
function getPageResourceFields() {
|
|
774
|
+
return pageResourceFields;
|
|
559
775
|
}
|
|
560
776
|
|
|
561
777
|
// src/debug.ts
|
|
@@ -1238,6 +1454,7 @@ var AmplifyUpSDK = class {
|
|
|
1238
1454
|
this.resolvedPageData,
|
|
1239
1455
|
this.resolvedPageRoute
|
|
1240
1456
|
);
|
|
1457
|
+
setPageResourceFields(null);
|
|
1241
1458
|
return;
|
|
1242
1459
|
}
|
|
1243
1460
|
this.attachedPageContext = applyPageContext(this.pendingPageContext, {
|
|
@@ -1666,7 +1883,7 @@ Available Console Commands:
|
|
|
1666
1883
|
this.refreshEventTracking();
|
|
1667
1884
|
}, 800);
|
|
1668
1885
|
}
|
|
1669
|
-
return pageConfig;
|
|
1886
|
+
return envelopePageConfig(pageConfig);
|
|
1670
1887
|
}
|
|
1671
1888
|
/**
|
|
1672
1889
|
* Set up view-level event tracking based on configuration
|
|
@@ -3039,31 +3256,83 @@ function getSDK(adapter) {
|
|
|
3039
3256
|
var trackContentView = (contentId, contentType, properties) => getSDK().trackContentView(contentId, contentType, properties);
|
|
3040
3257
|
var refreshEventTracking = () => getSDK().refreshEventTracking();
|
|
3041
3258
|
getSDK();
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
3259
|
+
|
|
3260
|
+
// src/composer-store.ts
|
|
3261
|
+
var ComposerFieldStore = class {
|
|
3262
|
+
constructor() {
|
|
3263
|
+
this.values = /* @__PURE__ */ new Map();
|
|
3264
|
+
this.listeners = /* @__PURE__ */ new Map();
|
|
3265
|
+
}
|
|
3266
|
+
get(name) {
|
|
3267
|
+
return this.values.has(name) ? this.values.get(name) : void 0;
|
|
3268
|
+
}
|
|
3269
|
+
set(name, value) {
|
|
3270
|
+
if (!name) return;
|
|
3271
|
+
this.values.set(name, value);
|
|
3272
|
+
const set = this.listeners.get(name);
|
|
3273
|
+
if (!set) return;
|
|
3274
|
+
for (const fn of set) fn();
|
|
3275
|
+
}
|
|
3276
|
+
subscribe(name, fn) {
|
|
3277
|
+
if (!name) return () => {
|
|
3278
|
+
};
|
|
3279
|
+
let set = this.listeners.get(name);
|
|
3280
|
+
if (!set) {
|
|
3281
|
+
set = /* @__PURE__ */ new Set();
|
|
3282
|
+
this.listeners.set(name, set);
|
|
3283
|
+
}
|
|
3284
|
+
set.add(fn);
|
|
3285
|
+
return () => {
|
|
3286
|
+
set.delete(fn);
|
|
3287
|
+
if (set.size === 0) this.listeners.delete(name);
|
|
3052
3288
|
};
|
|
3289
|
+
}
|
|
3290
|
+
keys() {
|
|
3291
|
+
return [...this.values.keys()];
|
|
3292
|
+
}
|
|
3293
|
+
delete(name) {
|
|
3294
|
+
if (!name || !this.values.has(name)) return;
|
|
3295
|
+
this.values.delete(name);
|
|
3296
|
+
const set = this.listeners.get(name);
|
|
3297
|
+
if (!set) return;
|
|
3298
|
+
for (const fn of set) fn();
|
|
3299
|
+
}
|
|
3300
|
+
};
|
|
3301
|
+
var ComposerStoreContext = react.createContext(null);
|
|
3302
|
+
function matchesNode(eventNodeId, layoutNodeId) {
|
|
3303
|
+
if (eventNodeId && layoutNodeId && String(eventNodeId) !== String(layoutNodeId)) {
|
|
3304
|
+
return false;
|
|
3305
|
+
}
|
|
3306
|
+
return true;
|
|
3307
|
+
}
|
|
3308
|
+
function ComposerProvider({
|
|
3309
|
+
layoutNodeId,
|
|
3310
|
+
children
|
|
3311
|
+
}) {
|
|
3312
|
+
const storeRef = react.useRef(null);
|
|
3313
|
+
if (!storeRef.current) storeRef.current = new ComposerFieldStore();
|
|
3314
|
+
const store = storeRef.current;
|
|
3315
|
+
react.useEffect(() => {
|
|
3053
3316
|
const applyField = (fieldName, value, nodeId) => {
|
|
3054
3317
|
if (!fieldName || typeof fieldName !== "string") return;
|
|
3055
|
-
if (!matchesNode(nodeId)) return;
|
|
3056
|
-
|
|
3318
|
+
if (!matchesNode(nodeId, layoutNodeId)) return;
|
|
3319
|
+
store.set(fieldName, value);
|
|
3320
|
+
if (value && typeof value === "object") {
|
|
3321
|
+
for (const patch of collectFieldPatches(
|
|
3322
|
+
toFieldEnvelopes({ [fieldName]: value })
|
|
3323
|
+
)) {
|
|
3324
|
+
store.set(patch.name, patch.value);
|
|
3325
|
+
}
|
|
3326
|
+
}
|
|
3057
3327
|
};
|
|
3058
3328
|
const applyProps = (nextProps, nodeId) => {
|
|
3059
3329
|
if (!nextProps || typeof nextProps !== "object" || Array.isArray(nextProps)) {
|
|
3060
3330
|
return;
|
|
3061
3331
|
}
|
|
3062
|
-
if (!matchesNode(nodeId)) return;
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
}));
|
|
3332
|
+
if (!matchesNode(nodeId, layoutNodeId)) return;
|
|
3333
|
+
for (const patch of collectFieldPatches(nextProps)) {
|
|
3334
|
+
store.set(patch.name, patch.value);
|
|
3335
|
+
}
|
|
3067
3336
|
};
|
|
3068
3337
|
const onPatch = (event) => {
|
|
3069
3338
|
const detail = event.detail || {};
|
|
@@ -3089,9 +3358,19 @@ function useLiveComposerProps(layoutNodeId, props) {
|
|
|
3089
3358
|
window.removeEventListener("amplifyup:props-patch", onPropsPatch);
|
|
3090
3359
|
window.removeEventListener("message", onMessage);
|
|
3091
3360
|
};
|
|
3092
|
-
}, [layoutNodeId]);
|
|
3093
|
-
return
|
|
3361
|
+
}, [layoutNodeId, store]);
|
|
3362
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ComposerStoreContext.Provider, { value: store, children });
|
|
3363
|
+
}
|
|
3364
|
+
function MaybeComposerProvider({
|
|
3365
|
+
enabled,
|
|
3366
|
+
layoutNodeId,
|
|
3367
|
+
children
|
|
3368
|
+
}) {
|
|
3369
|
+
const content = react.useMemo(() => children, [children]);
|
|
3370
|
+
if (!enabled) return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: content });
|
|
3371
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ComposerProvider, { layoutNodeId, children });
|
|
3094
3372
|
}
|
|
3373
|
+
react.createContext(null);
|
|
3095
3374
|
var usePathname = null;
|
|
3096
3375
|
if (typeof window !== "undefined") {
|
|
3097
3376
|
try {
|
|
@@ -3111,9 +3390,19 @@ function useAmplifyUp() {
|
|
|
3111
3390
|
return context;
|
|
3112
3391
|
}
|
|
3113
3392
|
function nodeRenderProps(node) {
|
|
3393
|
+
const settings = node.settings || {};
|
|
3394
|
+
const hydrated = hydratePageResourceProps(
|
|
3395
|
+
node.props || {},
|
|
3396
|
+
getPageResourceFields()
|
|
3397
|
+
);
|
|
3398
|
+
const fields = hydrated.fields;
|
|
3399
|
+
const branded = isBrandedFields(fields) ? fields : brandFields(
|
|
3400
|
+
fields && typeof fields === "object" ? fields : {}
|
|
3401
|
+
);
|
|
3114
3402
|
return {
|
|
3115
|
-
...
|
|
3116
|
-
...
|
|
3403
|
+
...settings,
|
|
3404
|
+
...hydrated,
|
|
3405
|
+
fields: branded
|
|
3117
3406
|
};
|
|
3118
3407
|
}
|
|
3119
3408
|
var ComponentRenderBoundary = class extends react.Component {
|
|
@@ -3163,17 +3452,24 @@ var ComponentRenderBoundary = class extends react.Component {
|
|
|
3163
3452
|
return this.props.children;
|
|
3164
3453
|
}
|
|
3165
3454
|
};
|
|
3166
|
-
function
|
|
3455
|
+
function NodeWithFields({
|
|
3167
3456
|
nodeId,
|
|
3168
3457
|
componentId,
|
|
3169
3458
|
props,
|
|
3170
3459
|
slots,
|
|
3171
|
-
renderComponent
|
|
3460
|
+
renderComponent,
|
|
3461
|
+
composerPreview
|
|
3172
3462
|
}) {
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
|
|
3176
|
-
|
|
3463
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3464
|
+
MaybeComposerProvider,
|
|
3465
|
+
{
|
|
3466
|
+
enabled: !!(composerPreview || isComposerPreview()),
|
|
3467
|
+
layoutNodeId: nodeId,
|
|
3468
|
+
children: renderComponent(componentId, props, slots, {
|
|
3469
|
+
layoutNodeId: nodeId
|
|
3470
|
+
})
|
|
3471
|
+
}
|
|
3472
|
+
);
|
|
3177
3473
|
}
|
|
3178
3474
|
function AmplifyRendererInner({
|
|
3179
3475
|
renderComponent,
|
|
@@ -3529,13 +3825,14 @@ function AmplifyRendererInner({
|
|
|
3529
3825
|
componentId: node.componentId,
|
|
3530
3826
|
nodeId: node.id,
|
|
3531
3827
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3532
|
-
|
|
3828
|
+
NodeWithFields,
|
|
3533
3829
|
{
|
|
3534
3830
|
nodeId: node.id,
|
|
3535
3831
|
componentId: node.componentId,
|
|
3536
3832
|
props: nodeRenderProps(node),
|
|
3537
3833
|
slots: slotsToPass,
|
|
3538
|
-
renderComponent
|
|
3834
|
+
renderComponent,
|
|
3835
|
+
composerPreview
|
|
3539
3836
|
}
|
|
3540
3837
|
)
|
|
3541
3838
|
}
|