@amplifyup/sdk 0.1.72 → 0.1.74
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 +22 -10
- package/dist/AmplifyRenderer.js.map +1 -1
- package/dist/AmplifyRenderer.mjs +22 -10
- package/dist/AmplifyRenderer.mjs.map +1 -1
- package/dist/index.d.mts +9 -4
- package/dist/index.d.ts +9 -4
- package/dist/index.js +24 -11
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +24 -11
- package/dist/index.mjs.map +1 -1
- package/dist/{query-Hay-oVYp.d.ts → query-NcrxJQvI.d.ts} +1 -1
- package/dist/{query-B_DU7yEm.d.mts → query-_SMo6VRf.d.mts} +1 -1
- package/dist/react.d.mts +3 -3
- package/dist/react.d.ts +3 -3
- package/dist/react.js +29 -12
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +29 -12
- package/dist/react.mjs.map +1 -1
- package/dist/server.d.mts +3 -3
- package/dist/server.d.ts +3 -3
- package/dist/server.js +2 -1
- package/dist/server.js.map +1 -1
- package/dist/server.mjs +2 -1
- package/dist/server.mjs.map +1 -1
- package/dist/{types-CGeBbx84.d.mts → types-BGZYaFxP.d.mts} +16 -1
- package/dist/{types-CGeBbx84.d.ts → types-BGZYaFxP.d.ts} +16 -1
- package/package.json +1 -1
package/dist/AmplifyRenderer.mjs
CHANGED
|
@@ -851,7 +851,8 @@ function mergeEventContext(properties, attached) {
|
|
|
851
851
|
...properties,
|
|
852
852
|
...attached.resource ? { resource: attached.resource } : {},
|
|
853
853
|
page: attached.page,
|
|
854
|
-
...attached.pageRoute ? { pageRoute: attached.pageRoute } : {}
|
|
854
|
+
...attached.pageRoute ? { pageRoute: attached.pageRoute } : {},
|
|
855
|
+
...attached.pageResource ? { pageResource: attached.pageResource } : {}
|
|
855
856
|
};
|
|
856
857
|
}
|
|
857
858
|
var PAGE_RESOURCE_MARKER = "__amplifyupPageResource";
|
|
@@ -1076,6 +1077,7 @@ var AmplifyUpSDK = class {
|
|
|
1076
1077
|
this.pendingPageContext = null;
|
|
1077
1078
|
this.attachedPageContext = null;
|
|
1078
1079
|
this.resolvedPageData = null;
|
|
1080
|
+
this.resolvedPageResource = null;
|
|
1079
1081
|
this.resolvedPageRoute = "";
|
|
1080
1082
|
this.resolvedRouteParams = {};
|
|
1081
1083
|
this.historyHooksInstalled = false;
|
|
@@ -1608,28 +1610,38 @@ var AmplifyUpSDK = class {
|
|
|
1608
1610
|
* Apply published pageData (from /v1/resolve) so field validation and
|
|
1609
1611
|
* mapped page fields can run.
|
|
1610
1612
|
*/
|
|
1611
|
-
applyResolvedPageData(pageData, pageRoute, routeParams) {
|
|
1613
|
+
applyResolvedPageData(pageData, pageRoute, routeParams, pageResources) {
|
|
1612
1614
|
this.resolvedPageData = pageData || null;
|
|
1613
1615
|
if (pageRoute) this.resolvedPageRoute = pageRoute;
|
|
1614
1616
|
if (routeParams) this.resolvedRouteParams = routeParams;
|
|
1617
|
+
const firstResourceName = pageData?.resources?.[0]?.name;
|
|
1618
|
+
const resolvedForPage = (firstResourceName ? pageResources?.[firstResourceName] : void 0) || (pageResources ? Object.values(pageResources)[0] : void 0);
|
|
1619
|
+
this.resolvedPageResource = resolvedForPage || null;
|
|
1615
1620
|
this.recomputeAttachedContext();
|
|
1616
1621
|
}
|
|
1617
1622
|
recomputeAttachedContext() {
|
|
1618
1623
|
if (!this.pendingPageContext) {
|
|
1619
|
-
this.attachedPageContext =
|
|
1620
|
-
this.resolvedPageData,
|
|
1621
|
-
this.resolvedPageRoute
|
|
1624
|
+
this.attachedPageContext = this.withPageResource(
|
|
1625
|
+
attachStaticPageContext(this.resolvedPageData, this.resolvedPageRoute)
|
|
1622
1626
|
);
|
|
1623
1627
|
setPageResourceFields(null);
|
|
1624
1628
|
return;
|
|
1625
1629
|
}
|
|
1626
|
-
this.attachedPageContext =
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1630
|
+
this.attachedPageContext = this.withPageResource(
|
|
1631
|
+
applyPageContext(this.pendingPageContext, {
|
|
1632
|
+
pageData: this.resolvedPageData,
|
|
1633
|
+
routeParams: this.resolvedRouteParams,
|
|
1634
|
+
pageRoute: this.resolvedPageRoute
|
|
1635
|
+
})
|
|
1636
|
+
);
|
|
1631
1637
|
setPageResourceFields(this.attachedPageContext?.resource?.fields || null);
|
|
1632
1638
|
}
|
|
1639
|
+
/** Stamp the resolved entry onto the context so events carry it. */
|
|
1640
|
+
withPageResource(context) {
|
|
1641
|
+
if (!context || !this.resolvedPageResource) return context;
|
|
1642
|
+
const { entity, providerId, docId } = this.resolvedPageResource;
|
|
1643
|
+
return { ...context, pageResource: { entity, providerId, docId } };
|
|
1644
|
+
}
|
|
1633
1645
|
getAttachedPageContext() {
|
|
1634
1646
|
return this.attachedPageContext;
|
|
1635
1647
|
}
|