@amplifyup/sdk 0.1.44 → 0.1.45

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 } from './types-BjlTE_cW.mjs';
1
+ import { i as AmplifyUpTarget } from './types-NdLzHxZo.mjs';
2
2
 
3
3
  /**
4
4
  * On-request variant selection (tier 3).
@@ -1,4 +1,4 @@
1
- import { i as AmplifyUpTarget } from './types-BjlTE_cW.js';
1
+ import { i as AmplifyUpTarget } from './types-NdLzHxZo.js';
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 { P as PageConfig, c as AmplifyUpConfig, e as AmplifyPageContextInput, C as ContentSource, A as AmplifyContentMeta } from './types-BjlTE_cW.mjs';
3
- export { Z as ZoneConfig } from './types-BjlTE_cW.mjs';
2
+ import { P as PageConfig, c as AmplifyUpConfig, e as AmplifyPageContextInput, C as ContentSource, A as AmplifyContentMeta } from './types-NdLzHxZo.mjs';
3
+ export { Z as ZoneConfig } from './types-NdLzHxZo.mjs';
4
4
  import React, { 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-DhyG93JN.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-2-zPPrMI.mjs';
7
7
  export { i as isComposerPreview, a as isPreviewRequest, b as isWorkingContentRequest } from './preview-_vHmzRen.mjs';
8
8
  export { fetchPageConfigServer } from './server.mjs';
9
9
  import './reservedRoutes-aGgViBDM.mjs';
package/dist/react.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { P as PageConfig, c as AmplifyUpConfig, e as AmplifyPageContextInput, C as ContentSource, A as AmplifyContentMeta } from './types-BjlTE_cW.js';
3
- export { Z as ZoneConfig } from './types-BjlTE_cW.js';
2
+ import { P as PageConfig, c as AmplifyUpConfig, e as AmplifyPageContextInput, C as ContentSource, A as AmplifyContentMeta } from './types-NdLzHxZo.js';
3
+ export { Z as ZoneConfig } from './types-NdLzHxZo.js';
4
4
  import React, { 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-CMiGo_Kt.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-CFpvzSZT.js';
7
7
  export { i as isComposerPreview, a as isPreviewRequest, b as isWorkingContentRequest } from './preview-_vHmzRen.js';
8
8
  export { fetchPageConfigServer } from './server.js';
9
9
  import './reservedRoutes-aGgViBDM.js';
package/dist/react.js CHANGED
@@ -481,14 +481,14 @@ function applyPageContext(input, opts) {
481
481
  log.warn("AmplifyUp: pageContext needs resourceType and key");
482
482
  return null;
483
483
  }
484
- const slot = opts.pageData?.slots?.[0];
485
- if (slot && slot.type && slot.type !== input.resourceType) {
484
+ const resource = opts.pageData?.resources?.[0];
485
+ if (resource && resource.type && resource.type !== input.resourceType) {
486
486
  log.warn(
487
- `AmplifyUp: pageContext resourceType "${input.resourceType}" does not match page slot "${slot.type}"`
487
+ `AmplifyUp: pageContext resourceType "${input.resourceType}" does not match page resource "${resource.type}"`
488
488
  );
489
489
  return null;
490
490
  }
491
- const fieldDefs = slot?.fields || [];
491
+ const fieldDefs = resource?.fields || [];
492
492
  const defByKey = new Map(fieldDefs.map((f) => [f.key, f]));
493
493
  const rawFields = input.fields && typeof input.fields === "object" ? input.fields : {};
494
494
  const fields = {};
@@ -506,7 +506,7 @@ function applyPageContext(input, opts) {
506
506
  }
507
507
  }
508
508
  const params = { ...opts.routeParams || {} };
509
- const mapping = slot?.urlParamMapping;
509
+ const mapping = resource?.urlParamMapping;
510
510
  let resourceKey = key;
511
511
  if (mapping) {
512
512
  const fromUrl = params[mapping.param];
@@ -524,7 +524,7 @@ function applyPageContext(input, opts) {
524
524
  if (pf.value !== void 0) pageFields[pf.key] = pf.value;
525
525
  continue;
526
526
  }
527
- if (pf.source === "mapped" && pf.slot && pf.field) {
527
+ if (pf.source === "mapped" && pf.resource && pf.field) {
528
528
  pageFields[pf.key] = fields[pf.field];
529
529
  }
530
530
  }
@@ -568,9 +568,9 @@ function mergeEventContext(properties, attached) {
568
568
  ...attached.pageRoute ? { pageRoute: attached.pageRoute } : {}
569
569
  };
570
570
  }
571
- var PAGE_SLOT_MARKER = "__amplifyupPageSlot";
572
- function isPageSlotSentinel(value) {
573
- return !!value && typeof value === "object" && !Array.isArray(value) && typeof value[PAGE_SLOT_MARKER] === "string";
571
+ var PAGE_RESOURCE_MARKER = "__amplifyupPageResource";
572
+ function isPageResourceSentinel(value) {
573
+ return !!value && typeof value === "object" && !Array.isArray(value) && typeof value[PAGE_RESOURCE_MARKER] === "string";
574
574
  }
575
575
  function getByDotPath(source, path) {
576
576
  if (!path) return source;
@@ -584,30 +584,30 @@ function getByDotPath(source, path) {
584
584
  }
585
585
  return cur;
586
586
  }
587
- function hydratePageSlotValue(value, fields) {
588
- if (!isPageSlotSentinel(value)) return value;
587
+ function hydratePageResourceValue(value, fields) {
588
+ if (!isPageResourceSentinel(value)) return value;
589
589
  if (!fields) return null;
590
590
  if (value.path) return getByDotPath(fields, value.path) ?? null;
591
591
  return fields;
592
592
  }
593
- function hydratePageSlotProps(props, fields) {
593
+ function hydratePageResourceProps(props, fields) {
594
594
  const source = props && typeof props === "object" ? props : {};
595
595
  const out = { ...source };
596
596
  for (const [key, val] of Object.entries(out)) {
597
- if (isPageSlotSentinel(val)) {
598
- out[key] = hydratePageSlotValue(val, fields);
597
+ if (isPageResourceSentinel(val)) {
598
+ out[key] = hydratePageResourceValue(val, fields);
599
599
  }
600
600
  }
601
601
  return out;
602
602
  }
603
603
 
604
- // src/page-slot-runtime.ts
605
- var pageSlotFields = null;
606
- function setPageSlotFields(fields) {
607
- pageSlotFields = fields && typeof fields === "object" ? fields : null;
604
+ // src/page-resource-runtime.ts
605
+ var pageResourceFields = null;
606
+ function setPageResourceFields(fields) {
607
+ pageResourceFields = fields && typeof fields === "object" ? fields : null;
608
608
  }
609
- function getPageSlotFields() {
610
- return pageSlotFields;
609
+ function getPageResourceFields() {
610
+ return pageResourceFields;
611
611
  }
612
612
 
613
613
  // src/edge/normalizeRoute.ts
@@ -1575,7 +1575,7 @@ var AmplifyUpSDK = class {
1575
1575
  this.resolvedPageData,
1576
1576
  this.resolvedPageRoute
1577
1577
  );
1578
- setPageSlotFields(null);
1578
+ setPageResourceFields(null);
1579
1579
  return;
1580
1580
  }
1581
1581
  this.attachedPageContext = applyPageContext(this.pendingPageContext, {
@@ -1583,7 +1583,7 @@ var AmplifyUpSDK = class {
1583
1583
  routeParams: this.resolvedRouteParams,
1584
1584
  pageRoute: this.resolvedPageRoute
1585
1585
  });
1586
- setPageSlotFields(this.attachedPageContext?.resource?.fields || null);
1586
+ setPageResourceFields(this.attachedPageContext?.resource?.fields || null);
1587
1587
  }
1588
1588
  getAttachedPageContext() {
1589
1589
  return this.attachedPageContext;
@@ -3388,7 +3388,7 @@ function ComponentContextProvider({
3388
3388
  }) {
3389
3389
  const liveProps = useLiveComposerProps(
3390
3390
  layoutNodeId,
3391
- hydratePageSlotProps(props || {}, getPageSlotFields())
3391
+ hydratePageResourceProps(props || {}, getPageResourceFields())
3392
3392
  );
3393
3393
  return /* @__PURE__ */ jsxRuntime.jsx(
3394
3394
  ComponentContext.Provider,