@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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
|
-
import { L as LayoutComponentProps, P as PageConfig } from './types-
|
|
4
|
+
import { L as LayoutComponentProps, P as PageConfig } from './types-BGZYaFxP.mjs';
|
|
5
5
|
|
|
6
6
|
interface AmplifyRendererProps {
|
|
7
7
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
|
-
import { L as LayoutComponentProps, P as PageConfig } from './types-
|
|
4
|
+
import { L as LayoutComponentProps, P as PageConfig } from './types-BGZYaFxP.js';
|
|
5
5
|
|
|
6
6
|
interface AmplifyRendererProps {
|
|
7
7
|
/**
|
package/dist/AmplifyRenderer.js
CHANGED
|
@@ -853,7 +853,8 @@ function mergeEventContext(properties, attached) {
|
|
|
853
853
|
...properties,
|
|
854
854
|
...attached.resource ? { resource: attached.resource } : {},
|
|
855
855
|
page: attached.page,
|
|
856
|
-
...attached.pageRoute ? { pageRoute: attached.pageRoute } : {}
|
|
856
|
+
...attached.pageRoute ? { pageRoute: attached.pageRoute } : {},
|
|
857
|
+
...attached.pageResource ? { pageResource: attached.pageResource } : {}
|
|
857
858
|
};
|
|
858
859
|
}
|
|
859
860
|
var PAGE_RESOURCE_MARKER = "__amplifyupPageResource";
|
|
@@ -1078,6 +1079,7 @@ var AmplifyUpSDK = class {
|
|
|
1078
1079
|
this.pendingPageContext = null;
|
|
1079
1080
|
this.attachedPageContext = null;
|
|
1080
1081
|
this.resolvedPageData = null;
|
|
1082
|
+
this.resolvedPageResource = null;
|
|
1081
1083
|
this.resolvedPageRoute = "";
|
|
1082
1084
|
this.resolvedRouteParams = {};
|
|
1083
1085
|
this.historyHooksInstalled = false;
|
|
@@ -1610,28 +1612,38 @@ var AmplifyUpSDK = class {
|
|
|
1610
1612
|
* Apply published pageData (from /v1/resolve) so field validation and
|
|
1611
1613
|
* mapped page fields can run.
|
|
1612
1614
|
*/
|
|
1613
|
-
applyResolvedPageData(pageData, pageRoute, routeParams) {
|
|
1615
|
+
applyResolvedPageData(pageData, pageRoute, routeParams, pageResources) {
|
|
1614
1616
|
this.resolvedPageData = pageData || null;
|
|
1615
1617
|
if (pageRoute) this.resolvedPageRoute = pageRoute;
|
|
1616
1618
|
if (routeParams) this.resolvedRouteParams = routeParams;
|
|
1619
|
+
const firstResourceName = pageData?.resources?.[0]?.name;
|
|
1620
|
+
const resolvedForPage = (firstResourceName ? pageResources?.[firstResourceName] : void 0) || (pageResources ? Object.values(pageResources)[0] : void 0);
|
|
1621
|
+
this.resolvedPageResource = resolvedForPage || null;
|
|
1617
1622
|
this.recomputeAttachedContext();
|
|
1618
1623
|
}
|
|
1619
1624
|
recomputeAttachedContext() {
|
|
1620
1625
|
if (!this.pendingPageContext) {
|
|
1621
|
-
this.attachedPageContext =
|
|
1622
|
-
this.resolvedPageData,
|
|
1623
|
-
this.resolvedPageRoute
|
|
1626
|
+
this.attachedPageContext = this.withPageResource(
|
|
1627
|
+
attachStaticPageContext(this.resolvedPageData, this.resolvedPageRoute)
|
|
1624
1628
|
);
|
|
1625
1629
|
setPageResourceFields(null);
|
|
1626
1630
|
return;
|
|
1627
1631
|
}
|
|
1628
|
-
this.attachedPageContext =
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1632
|
+
this.attachedPageContext = this.withPageResource(
|
|
1633
|
+
applyPageContext(this.pendingPageContext, {
|
|
1634
|
+
pageData: this.resolvedPageData,
|
|
1635
|
+
routeParams: this.resolvedRouteParams,
|
|
1636
|
+
pageRoute: this.resolvedPageRoute
|
|
1637
|
+
})
|
|
1638
|
+
);
|
|
1633
1639
|
setPageResourceFields(this.attachedPageContext?.resource?.fields || null);
|
|
1634
1640
|
}
|
|
1641
|
+
/** Stamp the resolved entry onto the context so events carry it. */
|
|
1642
|
+
withPageResource(context) {
|
|
1643
|
+
if (!context || !this.resolvedPageResource) return context;
|
|
1644
|
+
const { entity, providerId, docId } = this.resolvedPageResource;
|
|
1645
|
+
return { ...context, pageResource: { entity, providerId, docId } };
|
|
1646
|
+
}
|
|
1635
1647
|
getAttachedPageContext() {
|
|
1636
1648
|
return this.attachedPageContext;
|
|
1637
1649
|
}
|