@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.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { P as PageConfig, C as ContentSource, A as AmplifyContentMeta, E as EventTrackingConfig$1, a as PageDataSnapshot, b as CDPAdapter, c as AmplifyUpConfig, d as EventProperties, e as AmplifyPageContextInput, f as AttachedPageEventContext, I as IdentifyInput, g as IdentifyTraits, h as ProfileFieldsInput, i as AmplifyUpTarget } from './types-
|
|
2
|
-
export { Z as ZoneConfig, k as isAmplifyUpTarget, n as normalizeAmplifyUpTarget, r as resolveAmplifyUpTarget, j as resolveAmplifyUpUrls } from './types-
|
|
1
|
+
import { P as PageConfig, C as ContentSource, A as AmplifyContentMeta, E as EventTrackingConfig$1, a as PageDataSnapshot, R as ResolvedPageResourceRef, b as CDPAdapter, c as AmplifyUpConfig, d as EventProperties, e as AmplifyPageContextInput, f as AttachedPageEventContext, I as IdentifyInput, g as IdentifyTraits, h as ProfileFieldsInput, i as AmplifyUpTarget } from './types-BGZYaFxP.mjs';
|
|
2
|
+
export { Z as ZoneConfig, k as isAmplifyUpTarget, n as normalizeAmplifyUpTarget, r as resolveAmplifyUpTarget, j as resolveAmplifyUpUrls } from './types-BGZYaFxP.mjs';
|
|
3
3
|
export { i as isComposerPreview, a as isPreviewRequest, b as isWorkingContentRequest } from './preview-_vHmzRen.mjs';
|
|
4
4
|
export { A as AMPLIFYUP_EDITOR_ROUTE, i as isAmplifyUpEditorRoute } from './reservedRoutes-aGgViBDM.mjs';
|
|
5
|
-
export { g as FetchEdgeQueryOptions, F as FetchEdgeSelectOptions, 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, c as fetchEdgeQuery, f as fetchEdgeSelect, n as nextPageSpec, q as queryContent, d as searchSpec, s as selectVariants } from './query-
|
|
5
|
+
export { g as FetchEdgeQueryOptions, F as FetchEdgeSelectOptions, 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, c as fetchEdgeQuery, f as fetchEdgeSelect, n as nextPageSpec, q as queryContent, d as searchSpec, s as selectVariants } from './query-_SMo6VRf.mjs';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Storage utilities for instance ID and user ID
|
|
@@ -71,6 +71,8 @@ interface EdgeResolvedPayload {
|
|
|
71
71
|
/** Composer event bindings baked into the published snapshot. */
|
|
72
72
|
eventTracking?: EventTrackingConfig$1[];
|
|
73
73
|
pageData?: PageDataSnapshot;
|
|
74
|
+
/** resource name → document this URL resolved to. */
|
|
75
|
+
pageResources?: Record<string, ResolvedPageResourceRef>;
|
|
74
76
|
meta: {
|
|
75
77
|
variantKeys: Record<string, string>;
|
|
76
78
|
audienceLookup?: {
|
|
@@ -200,6 +202,7 @@ declare class AmplifyUpSDK {
|
|
|
200
202
|
private pendingPageContext;
|
|
201
203
|
private attachedPageContext;
|
|
202
204
|
private resolvedPageData;
|
|
205
|
+
private resolvedPageResource;
|
|
203
206
|
private resolvedPageRoute;
|
|
204
207
|
private resolvedRouteParams;
|
|
205
208
|
private historyHooksInstalled;
|
|
@@ -271,8 +274,10 @@ declare class AmplifyUpSDK {
|
|
|
271
274
|
* Apply published pageData (from /v1/resolve) so field validation and
|
|
272
275
|
* mapped page fields can run.
|
|
273
276
|
*/
|
|
274
|
-
applyResolvedPageData(pageData: PageDataSnapshot | null | undefined, pageRoute?: string, routeParams?: Record<string, string>): void;
|
|
277
|
+
applyResolvedPageData(pageData: PageDataSnapshot | null | undefined, pageRoute?: string, routeParams?: Record<string, string>, pageResources?: Record<string, ResolvedPageResourceRef> | null): void;
|
|
275
278
|
private recomputeAttachedContext;
|
|
279
|
+
/** Stamp the resolved entry onto the context so events carry it. */
|
|
280
|
+
private withPageResource;
|
|
276
281
|
getAttachedPageContext(): AttachedPageEventContext | null;
|
|
277
282
|
/**
|
|
278
283
|
* Track a page view
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { P as PageConfig, C as ContentSource, A as AmplifyContentMeta, E as EventTrackingConfig$1, a as PageDataSnapshot, b as CDPAdapter, c as AmplifyUpConfig, d as EventProperties, e as AmplifyPageContextInput, f as AttachedPageEventContext, I as IdentifyInput, g as IdentifyTraits, h as ProfileFieldsInput, i as AmplifyUpTarget } from './types-
|
|
2
|
-
export { Z as ZoneConfig, k as isAmplifyUpTarget, n as normalizeAmplifyUpTarget, r as resolveAmplifyUpTarget, j as resolveAmplifyUpUrls } from './types-
|
|
1
|
+
import { P as PageConfig, C as ContentSource, A as AmplifyContentMeta, E as EventTrackingConfig$1, a as PageDataSnapshot, R as ResolvedPageResourceRef, b as CDPAdapter, c as AmplifyUpConfig, d as EventProperties, e as AmplifyPageContextInput, f as AttachedPageEventContext, I as IdentifyInput, g as IdentifyTraits, h as ProfileFieldsInput, i as AmplifyUpTarget } from './types-BGZYaFxP.js';
|
|
2
|
+
export { Z as ZoneConfig, k as isAmplifyUpTarget, n as normalizeAmplifyUpTarget, r as resolveAmplifyUpTarget, j as resolveAmplifyUpUrls } from './types-BGZYaFxP.js';
|
|
3
3
|
export { i as isComposerPreview, a as isPreviewRequest, b as isWorkingContentRequest } from './preview-_vHmzRen.js';
|
|
4
4
|
export { A as AMPLIFYUP_EDITOR_ROUTE, i as isAmplifyUpEditorRoute } from './reservedRoutes-aGgViBDM.js';
|
|
5
|
-
export { g as FetchEdgeQueryOptions, F as FetchEdgeSelectOptions, 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, c as fetchEdgeQuery, f as fetchEdgeSelect, n as nextPageSpec, q as queryContent, d as searchSpec, s as selectVariants } from './query-
|
|
5
|
+
export { g as FetchEdgeQueryOptions, F as FetchEdgeSelectOptions, 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, c as fetchEdgeQuery, f as fetchEdgeSelect, n as nextPageSpec, q as queryContent, d as searchSpec, s as selectVariants } from './query-NcrxJQvI.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Storage utilities for instance ID and user ID
|
|
@@ -71,6 +71,8 @@ interface EdgeResolvedPayload {
|
|
|
71
71
|
/** Composer event bindings baked into the published snapshot. */
|
|
72
72
|
eventTracking?: EventTrackingConfig$1[];
|
|
73
73
|
pageData?: PageDataSnapshot;
|
|
74
|
+
/** resource name → document this URL resolved to. */
|
|
75
|
+
pageResources?: Record<string, ResolvedPageResourceRef>;
|
|
74
76
|
meta: {
|
|
75
77
|
variantKeys: Record<string, string>;
|
|
76
78
|
audienceLookup?: {
|
|
@@ -200,6 +202,7 @@ declare class AmplifyUpSDK {
|
|
|
200
202
|
private pendingPageContext;
|
|
201
203
|
private attachedPageContext;
|
|
202
204
|
private resolvedPageData;
|
|
205
|
+
private resolvedPageResource;
|
|
203
206
|
private resolvedPageRoute;
|
|
204
207
|
private resolvedRouteParams;
|
|
205
208
|
private historyHooksInstalled;
|
|
@@ -271,8 +274,10 @@ declare class AmplifyUpSDK {
|
|
|
271
274
|
* Apply published pageData (from /v1/resolve) so field validation and
|
|
272
275
|
* mapped page fields can run.
|
|
273
276
|
*/
|
|
274
|
-
applyResolvedPageData(pageData: PageDataSnapshot | null | undefined, pageRoute?: string, routeParams?: Record<string, string>): void;
|
|
277
|
+
applyResolvedPageData(pageData: PageDataSnapshot | null | undefined, pageRoute?: string, routeParams?: Record<string, string>, pageResources?: Record<string, ResolvedPageResourceRef> | null): void;
|
|
275
278
|
private recomputeAttachedContext;
|
|
279
|
+
/** Stamp the resolved entry onto the context so events carry it. */
|
|
280
|
+
private withPageResource;
|
|
276
281
|
getAttachedPageContext(): AttachedPageEventContext | null;
|
|
277
282
|
/**
|
|
278
283
|
* Track a page view
|
package/dist/index.js
CHANGED
|
@@ -792,7 +792,8 @@ function mergeEventContext(properties, attached) {
|
|
|
792
792
|
...properties,
|
|
793
793
|
...attached.resource ? { resource: attached.resource } : {},
|
|
794
794
|
page: attached.page,
|
|
795
|
-
...attached.pageRoute ? { pageRoute: attached.pageRoute } : {}
|
|
795
|
+
...attached.pageRoute ? { pageRoute: attached.pageRoute } : {},
|
|
796
|
+
...attached.pageResource ? { pageResource: attached.pageResource } : {}
|
|
796
797
|
};
|
|
797
798
|
}
|
|
798
799
|
function setPageResourceFields(fields) {
|
|
@@ -1013,7 +1014,8 @@ function mapResolvedToPageConfig(payload) {
|
|
|
1013
1014
|
description: payload.meta?.degraded ? "degraded" : void 0
|
|
1014
1015
|
},
|
|
1015
1016
|
...payload.eventTracking && payload.eventTracking.length > 0 ? { eventTracking: payload.eventTracking } : {},
|
|
1016
|
-
...payload.pageData ? { pageData: payload.pageData } : {}
|
|
1017
|
+
...payload.pageData ? { pageData: payload.pageData } : {},
|
|
1018
|
+
...payload.pageResources ? { pageResources: payload.pageResources } : {}
|
|
1017
1019
|
};
|
|
1018
1020
|
}
|
|
1019
1021
|
function collectDegraded(payload) {
|
|
@@ -1315,6 +1317,7 @@ var AmplifyUpSDK = class {
|
|
|
1315
1317
|
this.pendingPageContext = null;
|
|
1316
1318
|
this.attachedPageContext = null;
|
|
1317
1319
|
this.resolvedPageData = null;
|
|
1320
|
+
this.resolvedPageResource = null;
|
|
1318
1321
|
this.resolvedPageRoute = "";
|
|
1319
1322
|
this.resolvedRouteParams = {};
|
|
1320
1323
|
this.historyHooksInstalled = false;
|
|
@@ -1847,27 +1850,37 @@ var AmplifyUpSDK = class {
|
|
|
1847
1850
|
* Apply published pageData (from /v1/resolve) so field validation and
|
|
1848
1851
|
* mapped page fields can run.
|
|
1849
1852
|
*/
|
|
1850
|
-
applyResolvedPageData(pageData, pageRoute, routeParams) {
|
|
1853
|
+
applyResolvedPageData(pageData, pageRoute, routeParams, pageResources) {
|
|
1851
1854
|
this.resolvedPageData = pageData || null;
|
|
1852
1855
|
if (pageRoute) this.resolvedPageRoute = pageRoute;
|
|
1853
1856
|
if (routeParams) this.resolvedRouteParams = routeParams;
|
|
1857
|
+
const firstResourceName = pageData?.resources?.[0]?.name;
|
|
1858
|
+
const resolvedForPage = (firstResourceName ? pageResources?.[firstResourceName] : void 0) || (pageResources ? Object.values(pageResources)[0] : void 0);
|
|
1859
|
+
this.resolvedPageResource = resolvedForPage || null;
|
|
1854
1860
|
this.recomputeAttachedContext();
|
|
1855
1861
|
}
|
|
1856
1862
|
recomputeAttachedContext() {
|
|
1857
1863
|
if (!this.pendingPageContext) {
|
|
1858
|
-
this.attachedPageContext =
|
|
1859
|
-
this.resolvedPageData,
|
|
1860
|
-
this.resolvedPageRoute
|
|
1864
|
+
this.attachedPageContext = this.withPageResource(
|
|
1865
|
+
attachStaticPageContext(this.resolvedPageData, this.resolvedPageRoute)
|
|
1861
1866
|
);
|
|
1862
1867
|
return;
|
|
1863
1868
|
}
|
|
1864
|
-
this.attachedPageContext =
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
+
this.attachedPageContext = this.withPageResource(
|
|
1870
|
+
applyPageContext(this.pendingPageContext, {
|
|
1871
|
+
pageData: this.resolvedPageData,
|
|
1872
|
+
routeParams: this.resolvedRouteParams,
|
|
1873
|
+
pageRoute: this.resolvedPageRoute
|
|
1874
|
+
})
|
|
1875
|
+
);
|
|
1869
1876
|
setPageResourceFields(this.attachedPageContext?.resource?.fields || null);
|
|
1870
1877
|
}
|
|
1878
|
+
/** Stamp the resolved entry onto the context so events carry it. */
|
|
1879
|
+
withPageResource(context) {
|
|
1880
|
+
if (!context || !this.resolvedPageResource) return context;
|
|
1881
|
+
const { entity, providerId, docId } = this.resolvedPageResource;
|
|
1882
|
+
return { ...context, pageResource: { entity, providerId, docId } };
|
|
1883
|
+
}
|
|
1871
1884
|
getAttachedPageContext() {
|
|
1872
1885
|
return this.attachedPageContext;
|
|
1873
1886
|
}
|