@amplifyup/sdk 0.1.44 → 0.1.45
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.d.mts +1 -1
- package/dist/AmplifyRenderer.d.ts +1 -1
- package/dist/AmplifyRenderer.js +8 -8
- package/dist/AmplifyRenderer.js.map +1 -1
- package/dist/AmplifyRenderer.mjs +8 -8
- package/dist/AmplifyRenderer.mjs.map +1 -1
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +8 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8 -8
- package/dist/index.mjs.map +1 -1
- package/dist/{query-DhyG93JN.d.mts → query-2-zPPrMI.d.mts} +1 -1
- package/dist/{query-CMiGo_Kt.d.ts → query-CFpvzSZT.d.ts} +1 -1
- package/dist/react.d.mts +3 -3
- package/dist/react.d.ts +3 -3
- package/dist/react.js +23 -23
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +23 -23
- package/dist/react.mjs.map +1 -1
- package/dist/server.d.mts +3 -3
- package/dist/server.d.ts +3 -3
- package/dist/{types-BjlTE_cW.d.mts → types-NdLzHxZo.d.mts} +2 -2
- package/dist/{types-BjlTE_cW.d.ts → types-NdLzHxZo.d.ts} +2 -2
- package/package.json +1 -1
package/dist/react.d.mts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { P as PageConfig, c as AmplifyUpConfig, e as AmplifyPageContextInput, C as ContentSource, A as AmplifyContentMeta } from './types-
|
|
3
|
-
export { Z as ZoneConfig } from './types-
|
|
2
|
+
import { P as PageConfig, c as AmplifyUpConfig, e as AmplifyPageContextInput, C as ContentSource, A as AmplifyContentMeta } from './types-NdLzHxZo.mjs';
|
|
3
|
+
export { Z as ZoneConfig } from './types-NdLzHxZo.mjs';
|
|
4
4
|
import React, { ReactNode } from 'react';
|
|
5
5
|
export { AmplifyRenderer } from './AmplifyRenderer.mjs';
|
|
6
|
-
export { Q as QueryContentError, e as QueryContentOptions, k as QueryFilter, l as QueryFilterOp, i as QueryPagination, h as QueryResult, m as QuerySort, j as QuerySpec, S as SelectVariantsError, a as SelectVariantsOptions, b as SelectVariantsResult, n as nextPageSpec, q as queryContent, d as searchSpec, s as selectVariants } from './query-
|
|
6
|
+
export { Q as QueryContentError, e as QueryContentOptions, k as QueryFilter, l as QueryFilterOp, i as QueryPagination, h as QueryResult, m as QuerySort, j as QuerySpec, S as SelectVariantsError, a as SelectVariantsOptions, b as SelectVariantsResult, n as nextPageSpec, q as queryContent, d as searchSpec, s as selectVariants } from './query-2-zPPrMI.mjs';
|
|
7
7
|
export { i as isComposerPreview, a as isPreviewRequest, b as isWorkingContentRequest } from './preview-_vHmzRen.mjs';
|
|
8
8
|
export { fetchPageConfigServer } from './server.mjs';
|
|
9
9
|
import './reservedRoutes-aGgViBDM.mjs';
|
package/dist/react.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { P as PageConfig, c as AmplifyUpConfig, e as AmplifyPageContextInput, C as ContentSource, A as AmplifyContentMeta } from './types-
|
|
3
|
-
export { Z as ZoneConfig } from './types-
|
|
2
|
+
import { P as PageConfig, c as AmplifyUpConfig, e as AmplifyPageContextInput, C as ContentSource, A as AmplifyContentMeta } from './types-NdLzHxZo.js';
|
|
3
|
+
export { Z as ZoneConfig } from './types-NdLzHxZo.js';
|
|
4
4
|
import React, { ReactNode } from 'react';
|
|
5
5
|
export { AmplifyRenderer } from './AmplifyRenderer.js';
|
|
6
|
-
export { Q as QueryContentError, e as QueryContentOptions, k as QueryFilter, l as QueryFilterOp, i as QueryPagination, h as QueryResult, m as QuerySort, j as QuerySpec, S as SelectVariantsError, a as SelectVariantsOptions, b as SelectVariantsResult, n as nextPageSpec, q as queryContent, d as searchSpec, s as selectVariants } from './query-
|
|
6
|
+
export { Q as QueryContentError, e as QueryContentOptions, k as QueryFilter, l as QueryFilterOp, i as QueryPagination, h as QueryResult, m as QuerySort, j as QuerySpec, S as SelectVariantsError, a as SelectVariantsOptions, b as SelectVariantsResult, n as nextPageSpec, q as queryContent, d as searchSpec, s as selectVariants } from './query-CFpvzSZT.js';
|
|
7
7
|
export { i as isComposerPreview, a as isPreviewRequest, b as isWorkingContentRequest } from './preview-_vHmzRen.js';
|
|
8
8
|
export { fetchPageConfigServer } from './server.js';
|
|
9
9
|
import './reservedRoutes-aGgViBDM.js';
|
package/dist/react.js
CHANGED
|
@@ -481,14 +481,14 @@ function applyPageContext(input, opts) {
|
|
|
481
481
|
log.warn("AmplifyUp: pageContext needs resourceType and key");
|
|
482
482
|
return null;
|
|
483
483
|
}
|
|
484
|
-
const
|
|
485
|
-
if (
|
|
484
|
+
const resource = opts.pageData?.resources?.[0];
|
|
485
|
+
if (resource && resource.type && resource.type !== input.resourceType) {
|
|
486
486
|
log.warn(
|
|
487
|
-
`AmplifyUp: pageContext resourceType "${input.resourceType}" does not match page
|
|
487
|
+
`AmplifyUp: pageContext resourceType "${input.resourceType}" does not match page resource "${resource.type}"`
|
|
488
488
|
);
|
|
489
489
|
return null;
|
|
490
490
|
}
|
|
491
|
-
const fieldDefs =
|
|
491
|
+
const fieldDefs = resource?.fields || [];
|
|
492
492
|
const defByKey = new Map(fieldDefs.map((f) => [f.key, f]));
|
|
493
493
|
const rawFields = input.fields && typeof input.fields === "object" ? input.fields : {};
|
|
494
494
|
const fields = {};
|
|
@@ -506,7 +506,7 @@ function applyPageContext(input, opts) {
|
|
|
506
506
|
}
|
|
507
507
|
}
|
|
508
508
|
const params = { ...opts.routeParams || {} };
|
|
509
|
-
const mapping =
|
|
509
|
+
const mapping = resource?.urlParamMapping;
|
|
510
510
|
let resourceKey = key;
|
|
511
511
|
if (mapping) {
|
|
512
512
|
const fromUrl = params[mapping.param];
|
|
@@ -524,7 +524,7 @@ function applyPageContext(input, opts) {
|
|
|
524
524
|
if (pf.value !== void 0) pageFields[pf.key] = pf.value;
|
|
525
525
|
continue;
|
|
526
526
|
}
|
|
527
|
-
if (pf.source === "mapped" && pf.
|
|
527
|
+
if (pf.source === "mapped" && pf.resource && pf.field) {
|
|
528
528
|
pageFields[pf.key] = fields[pf.field];
|
|
529
529
|
}
|
|
530
530
|
}
|
|
@@ -568,9 +568,9 @@ function mergeEventContext(properties, attached) {
|
|
|
568
568
|
...attached.pageRoute ? { pageRoute: attached.pageRoute } : {}
|
|
569
569
|
};
|
|
570
570
|
}
|
|
571
|
-
var
|
|
572
|
-
function
|
|
573
|
-
return !!value && typeof value === "object" && !Array.isArray(value) && typeof value[
|
|
571
|
+
var PAGE_RESOURCE_MARKER = "__amplifyupPageResource";
|
|
572
|
+
function isPageResourceSentinel(value) {
|
|
573
|
+
return !!value && typeof value === "object" && !Array.isArray(value) && typeof value[PAGE_RESOURCE_MARKER] === "string";
|
|
574
574
|
}
|
|
575
575
|
function getByDotPath(source, path) {
|
|
576
576
|
if (!path) return source;
|
|
@@ -584,30 +584,30 @@ function getByDotPath(source, path) {
|
|
|
584
584
|
}
|
|
585
585
|
return cur;
|
|
586
586
|
}
|
|
587
|
-
function
|
|
588
|
-
if (!
|
|
587
|
+
function hydratePageResourceValue(value, fields) {
|
|
588
|
+
if (!isPageResourceSentinel(value)) return value;
|
|
589
589
|
if (!fields) return null;
|
|
590
590
|
if (value.path) return getByDotPath(fields, value.path) ?? null;
|
|
591
591
|
return fields;
|
|
592
592
|
}
|
|
593
|
-
function
|
|
593
|
+
function hydratePageResourceProps(props, fields) {
|
|
594
594
|
const source = props && typeof props === "object" ? props : {};
|
|
595
595
|
const out = { ...source };
|
|
596
596
|
for (const [key, val] of Object.entries(out)) {
|
|
597
|
-
if (
|
|
598
|
-
out[key] =
|
|
597
|
+
if (isPageResourceSentinel(val)) {
|
|
598
|
+
out[key] = hydratePageResourceValue(val, fields);
|
|
599
599
|
}
|
|
600
600
|
}
|
|
601
601
|
return out;
|
|
602
602
|
}
|
|
603
603
|
|
|
604
|
-
// src/page-
|
|
605
|
-
var
|
|
606
|
-
function
|
|
607
|
-
|
|
604
|
+
// src/page-resource-runtime.ts
|
|
605
|
+
var pageResourceFields = null;
|
|
606
|
+
function setPageResourceFields(fields) {
|
|
607
|
+
pageResourceFields = fields && typeof fields === "object" ? fields : null;
|
|
608
608
|
}
|
|
609
|
-
function
|
|
610
|
-
return
|
|
609
|
+
function getPageResourceFields() {
|
|
610
|
+
return pageResourceFields;
|
|
611
611
|
}
|
|
612
612
|
|
|
613
613
|
// src/edge/normalizeRoute.ts
|
|
@@ -1575,7 +1575,7 @@ var AmplifyUpSDK = class {
|
|
|
1575
1575
|
this.resolvedPageData,
|
|
1576
1576
|
this.resolvedPageRoute
|
|
1577
1577
|
);
|
|
1578
|
-
|
|
1578
|
+
setPageResourceFields(null);
|
|
1579
1579
|
return;
|
|
1580
1580
|
}
|
|
1581
1581
|
this.attachedPageContext = applyPageContext(this.pendingPageContext, {
|
|
@@ -1583,7 +1583,7 @@ var AmplifyUpSDK = class {
|
|
|
1583
1583
|
routeParams: this.resolvedRouteParams,
|
|
1584
1584
|
pageRoute: this.resolvedPageRoute
|
|
1585
1585
|
});
|
|
1586
|
-
|
|
1586
|
+
setPageResourceFields(this.attachedPageContext?.resource?.fields || null);
|
|
1587
1587
|
}
|
|
1588
1588
|
getAttachedPageContext() {
|
|
1589
1589
|
return this.attachedPageContext;
|
|
@@ -3388,7 +3388,7 @@ function ComponentContextProvider({
|
|
|
3388
3388
|
}) {
|
|
3389
3389
|
const liveProps = useLiveComposerProps(
|
|
3390
3390
|
layoutNodeId,
|
|
3391
|
-
|
|
3391
|
+
hydratePageResourceProps(props || {}, getPageResourceFields())
|
|
3392
3392
|
);
|
|
3393
3393
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3394
3394
|
ComponentContext.Provider,
|