@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/index.mjs
CHANGED
|
@@ -788,7 +788,8 @@ function mergeEventContext(properties, attached) {
|
|
|
788
788
|
...properties,
|
|
789
789
|
...attached.resource ? { resource: attached.resource } : {},
|
|
790
790
|
page: attached.page,
|
|
791
|
-
...attached.pageRoute ? { pageRoute: attached.pageRoute } : {}
|
|
791
|
+
...attached.pageRoute ? { pageRoute: attached.pageRoute } : {},
|
|
792
|
+
...attached.pageResource ? { pageResource: attached.pageResource } : {}
|
|
792
793
|
};
|
|
793
794
|
}
|
|
794
795
|
function setPageResourceFields(fields) {
|
|
@@ -1009,7 +1010,8 @@ function mapResolvedToPageConfig(payload) {
|
|
|
1009
1010
|
description: payload.meta?.degraded ? "degraded" : void 0
|
|
1010
1011
|
},
|
|
1011
1012
|
...payload.eventTracking && payload.eventTracking.length > 0 ? { eventTracking: payload.eventTracking } : {},
|
|
1012
|
-
...payload.pageData ? { pageData: payload.pageData } : {}
|
|
1013
|
+
...payload.pageData ? { pageData: payload.pageData } : {},
|
|
1014
|
+
...payload.pageResources ? { pageResources: payload.pageResources } : {}
|
|
1013
1015
|
};
|
|
1014
1016
|
}
|
|
1015
1017
|
function collectDegraded(payload) {
|
|
@@ -1311,6 +1313,7 @@ var AmplifyUpSDK = class {
|
|
|
1311
1313
|
this.pendingPageContext = null;
|
|
1312
1314
|
this.attachedPageContext = null;
|
|
1313
1315
|
this.resolvedPageData = null;
|
|
1316
|
+
this.resolvedPageResource = null;
|
|
1314
1317
|
this.resolvedPageRoute = "";
|
|
1315
1318
|
this.resolvedRouteParams = {};
|
|
1316
1319
|
this.historyHooksInstalled = false;
|
|
@@ -1843,27 +1846,37 @@ var AmplifyUpSDK = class {
|
|
|
1843
1846
|
* Apply published pageData (from /v1/resolve) so field validation and
|
|
1844
1847
|
* mapped page fields can run.
|
|
1845
1848
|
*/
|
|
1846
|
-
applyResolvedPageData(pageData, pageRoute, routeParams) {
|
|
1849
|
+
applyResolvedPageData(pageData, pageRoute, routeParams, pageResources) {
|
|
1847
1850
|
this.resolvedPageData = pageData || null;
|
|
1848
1851
|
if (pageRoute) this.resolvedPageRoute = pageRoute;
|
|
1849
1852
|
if (routeParams) this.resolvedRouteParams = routeParams;
|
|
1853
|
+
const firstResourceName = pageData?.resources?.[0]?.name;
|
|
1854
|
+
const resolvedForPage = (firstResourceName ? pageResources?.[firstResourceName] : void 0) || (pageResources ? Object.values(pageResources)[0] : void 0);
|
|
1855
|
+
this.resolvedPageResource = resolvedForPage || null;
|
|
1850
1856
|
this.recomputeAttachedContext();
|
|
1851
1857
|
}
|
|
1852
1858
|
recomputeAttachedContext() {
|
|
1853
1859
|
if (!this.pendingPageContext) {
|
|
1854
|
-
this.attachedPageContext =
|
|
1855
|
-
this.resolvedPageData,
|
|
1856
|
-
this.resolvedPageRoute
|
|
1860
|
+
this.attachedPageContext = this.withPageResource(
|
|
1861
|
+
attachStaticPageContext(this.resolvedPageData, this.resolvedPageRoute)
|
|
1857
1862
|
);
|
|
1858
1863
|
return;
|
|
1859
1864
|
}
|
|
1860
|
-
this.attachedPageContext =
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
+
this.attachedPageContext = this.withPageResource(
|
|
1866
|
+
applyPageContext(this.pendingPageContext, {
|
|
1867
|
+
pageData: this.resolvedPageData,
|
|
1868
|
+
routeParams: this.resolvedRouteParams,
|
|
1869
|
+
pageRoute: this.resolvedPageRoute
|
|
1870
|
+
})
|
|
1871
|
+
);
|
|
1865
1872
|
setPageResourceFields(this.attachedPageContext?.resource?.fields || null);
|
|
1866
1873
|
}
|
|
1874
|
+
/** Stamp the resolved entry onto the context so events carry it. */
|
|
1875
|
+
withPageResource(context) {
|
|
1876
|
+
if (!context || !this.resolvedPageResource) return context;
|
|
1877
|
+
const { entity, providerId, docId } = this.resolvedPageResource;
|
|
1878
|
+
return { ...context, pageResource: { entity, providerId, docId } };
|
|
1879
|
+
}
|
|
1867
1880
|
getAttachedPageContext() {
|
|
1868
1881
|
return this.attachedPageContext;
|
|
1869
1882
|
}
|