@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.
@@ -1,4 +1,4 @@
1
- import { i as AmplifyUpTarget, y as ListRow } from './types-CGeBbx84.js';
1
+ import { i as AmplifyUpTarget, y as ListRow } from './types-BGZYaFxP.js';
2
2
 
3
3
  /**
4
4
  * On-request variant selection (tier 3).
@@ -1,4 +1,4 @@
1
- import { i as AmplifyUpTarget, y as ListRow } from './types-CGeBbx84.mjs';
1
+ import { i as AmplifyUpTarget, y as ListRow } from './types-BGZYaFxP.mjs';
2
2
 
3
3
  /**
4
4
  * On-request variant selection (tier 3).
package/dist/react.d.mts CHANGED
@@ -1,9 +1,9 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { L as LayoutComponentProps, P as PageConfig, F as Field$1, l as FIELDS_BRAND, c as AmplifyUpConfig, e as AmplifyPageContextInput, C as ContentSource, A as AmplifyContentMeta } from './types-CGeBbx84.mjs';
3
- export { w as FieldRef, x as Fields, z as ImageValue, y as ListRow, B as PortableRef, Z as ZoneConfig, m as attachFieldEnvelopes, p as composerStoreKey, o as envelopeListRows, v as isBrandedFields, s as isFieldEnvelope, u as isReadOnlyRowField, q as listOwnerFromSpec, t as toFieldEnvelopes } from './types-CGeBbx84.mjs';
2
+ import { L as LayoutComponentProps, P as PageConfig, F as Field$1, l as FIELDS_BRAND, c as AmplifyUpConfig, e as AmplifyPageContextInput, C as ContentSource, A as AmplifyContentMeta } from './types-BGZYaFxP.mjs';
3
+ export { w as FieldRef, x as Fields, z as ImageValue, y as ListRow, B as PortableRef, Z as ZoneConfig, m as attachFieldEnvelopes, p as composerStoreKey, o as envelopeListRows, v as isBrandedFields, s as isFieldEnvelope, u as isReadOnlyRowField, q as listOwnerFromSpec, t as toFieldEnvelopes } from './types-BGZYaFxP.mjs';
4
4
  import react__default, { 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-B_DU7yEm.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-_SMo6VRf.mjs';
7
7
  export { i as isComposerPreview, a as isPreviewRequest, b as isWorkingContentRequest } from './preview-_vHmzRen.mjs';
8
8
 
9
9
  type RenderComponentContext = {
package/dist/react.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { L as LayoutComponentProps, P as PageConfig, F as Field$1, l as FIELDS_BRAND, c as AmplifyUpConfig, e as AmplifyPageContextInput, C as ContentSource, A as AmplifyContentMeta } from './types-CGeBbx84.js';
3
- export { w as FieldRef, x as Fields, z as ImageValue, y as ListRow, B as PortableRef, Z as ZoneConfig, m as attachFieldEnvelopes, p as composerStoreKey, o as envelopeListRows, v as isBrandedFields, s as isFieldEnvelope, u as isReadOnlyRowField, q as listOwnerFromSpec, t as toFieldEnvelopes } from './types-CGeBbx84.js';
2
+ import { L as LayoutComponentProps, P as PageConfig, F as Field$1, l as FIELDS_BRAND, c as AmplifyUpConfig, e as AmplifyPageContextInput, C as ContentSource, A as AmplifyContentMeta } from './types-BGZYaFxP.js';
3
+ export { w as FieldRef, x as Fields, z as ImageValue, y as ListRow, B as PortableRef, Z as ZoneConfig, m as attachFieldEnvelopes, p as composerStoreKey, o as envelopeListRows, v as isBrandedFields, s as isFieldEnvelope, u as isReadOnlyRowField, q as listOwnerFromSpec, t as toFieldEnvelopes } from './types-BGZYaFxP.js';
4
4
  import react__default, { 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-Hay-oVYp.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-NcrxJQvI.js';
7
7
  export { i as isComposerPreview, a as isPreviewRequest, b as isWorkingContentRequest } from './preview-_vHmzRen.js';
8
8
 
9
9
  type RenderComponentContext = {
package/dist/react.js CHANGED
@@ -888,7 +888,8 @@ function mergeEventContext(properties, attached) {
888
888
  ...properties,
889
889
  ...attached.resource ? { resource: attached.resource } : {},
890
890
  page: attached.page,
891
- ...attached.pageRoute ? { pageRoute: attached.pageRoute } : {}
891
+ ...attached.pageRoute ? { pageRoute: attached.pageRoute } : {},
892
+ ...attached.pageResource ? { pageResource: attached.pageResource } : {}
892
893
  };
893
894
  }
894
895
  var PAGE_RESOURCE_MARKER = "__amplifyupPageResource";
@@ -1188,7 +1189,8 @@ function mapResolvedToPageConfig(payload) {
1188
1189
  description: payload.meta?.degraded ? "degraded" : void 0
1189
1190
  },
1190
1191
  ...payload.eventTracking && payload.eventTracking.length > 0 ? { eventTracking: payload.eventTracking } : {},
1191
- ...payload.pageData ? { pageData: payload.pageData } : {}
1192
+ ...payload.pageData ? { pageData: payload.pageData } : {},
1193
+ ...payload.pageResources ? { pageResources: payload.pageResources } : {}
1192
1194
  };
1193
1195
  }
1194
1196
  function collectDegraded(payload) {
@@ -1490,6 +1492,7 @@ var AmplifyUpSDK = class {
1490
1492
  this.pendingPageContext = null;
1491
1493
  this.attachedPageContext = null;
1492
1494
  this.resolvedPageData = null;
1495
+ this.resolvedPageResource = null;
1493
1496
  this.resolvedPageRoute = "";
1494
1497
  this.resolvedRouteParams = {};
1495
1498
  this.historyHooksInstalled = false;
@@ -2022,28 +2025,38 @@ var AmplifyUpSDK = class {
2022
2025
  * Apply published pageData (from /v1/resolve) so field validation and
2023
2026
  * mapped page fields can run.
2024
2027
  */
2025
- applyResolvedPageData(pageData, pageRoute, routeParams) {
2028
+ applyResolvedPageData(pageData, pageRoute, routeParams, pageResources) {
2026
2029
  this.resolvedPageData = pageData || null;
2027
2030
  if (pageRoute) this.resolvedPageRoute = pageRoute;
2028
2031
  if (routeParams) this.resolvedRouteParams = routeParams;
2032
+ const firstResourceName = pageData?.resources?.[0]?.name;
2033
+ const resolvedForPage = (firstResourceName ? pageResources?.[firstResourceName] : void 0) || (pageResources ? Object.values(pageResources)[0] : void 0);
2034
+ this.resolvedPageResource = resolvedForPage || null;
2029
2035
  this.recomputeAttachedContext();
2030
2036
  }
2031
2037
  recomputeAttachedContext() {
2032
2038
  if (!this.pendingPageContext) {
2033
- this.attachedPageContext = attachStaticPageContext(
2034
- this.resolvedPageData,
2035
- this.resolvedPageRoute
2039
+ this.attachedPageContext = this.withPageResource(
2040
+ attachStaticPageContext(this.resolvedPageData, this.resolvedPageRoute)
2036
2041
  );
2037
2042
  setPageResourceFields(null);
2038
2043
  return;
2039
2044
  }
2040
- this.attachedPageContext = applyPageContext(this.pendingPageContext, {
2041
- pageData: this.resolvedPageData,
2042
- routeParams: this.resolvedRouteParams,
2043
- pageRoute: this.resolvedPageRoute
2044
- });
2045
+ this.attachedPageContext = this.withPageResource(
2046
+ applyPageContext(this.pendingPageContext, {
2047
+ pageData: this.resolvedPageData,
2048
+ routeParams: this.resolvedRouteParams,
2049
+ pageRoute: this.resolvedPageRoute
2050
+ })
2051
+ );
2045
2052
  setPageResourceFields(this.attachedPageContext?.resource?.fields || null);
2046
2053
  }
2054
+ /** Stamp the resolved entry onto the context so events carry it. */
2055
+ withPageResource(context) {
2056
+ if (!context || !this.resolvedPageResource) return context;
2057
+ const { entity, providerId, docId } = this.resolvedPageResource;
2058
+ return { ...context, pageResource: { entity, providerId, docId } };
2059
+ }
2047
2060
  getAttachedPageContext() {
2048
2061
  return this.attachedPageContext;
2049
2062
  }
@@ -4892,6 +4905,9 @@ var lastRichTextRequestAt = 0;
4892
4905
  function requestCanvasRichTextEdit(opts) {
4893
4906
  if (typeof window === "undefined" || window.parent === window) return;
4894
4907
  if (!opts.name) return;
4908
+ if (opts.el.classList.contains("au-rte-active") || opts.el.querySelector(".ProseMirror")) {
4909
+ return;
4910
+ }
4895
4911
  const now = Date.now();
4896
4912
  if (now - lastRichTextRequestAt < 400) return;
4897
4913
  lastRichTextRequestAt = now;
@@ -5593,7 +5609,8 @@ function AmplifyUpProvider({
5593
5609
  sdk.applyResolvedPageData(
5594
5610
  result.pageConfig.pageData || null,
5595
5611
  result.pageConfig.route,
5596
- extractRouteParams(result.pageConfig.route, actualRoute)
5612
+ extractRouteParams(result.pageConfig.route, actualRoute),
5613
+ result.pageConfig.pageResources || null
5597
5614
  );
5598
5615
  }
5599
5616
  setInitialized(true);