@amplifyup/sdk 0.1.44 → 0.1.46

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-DpTzUg1C.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-DpTzUg1C.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-DpTzUg1C.mjs';
3
+ export { Z as ZoneConfig } from './types-DpTzUg1C.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-CWFb7rSm.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-DpTzUg1C.js';
3
+ export { Z as ZoneConfig } from './types-DpTzUg1C.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-L7zSmLFX.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 = {};
@@ -501,12 +501,16 @@ function applyPageContext(input, opts) {
501
501
  log.warn(`AmplifyUp: unknown resource field "${k}" dropped`);
502
502
  continue;
503
503
  }
504
+ if (def.passThrough) {
505
+ if (v != null) fields[k] = v;
506
+ continue;
507
+ }
504
508
  const coerced = coerceField(def, v, log);
505
509
  if (coerced !== void 0) fields[k] = coerced;
506
510
  }
507
511
  }
508
512
  const params = { ...opts.routeParams || {} };
509
- const mapping = slot?.urlParamMapping;
513
+ const mapping = resource?.urlParamMapping;
510
514
  let resourceKey = key;
511
515
  if (mapping) {
512
516
  const fromUrl = params[mapping.param];
@@ -524,7 +528,7 @@ function applyPageContext(input, opts) {
524
528
  if (pf.value !== void 0) pageFields[pf.key] = pf.value;
525
529
  continue;
526
530
  }
527
- if (pf.source === "mapped" && pf.slot && pf.field) {
531
+ if (pf.source === "mapped" && pf.resource && pf.field) {
528
532
  pageFields[pf.key] = fields[pf.field];
529
533
  }
530
534
  }
@@ -568,9 +572,9 @@ function mergeEventContext(properties, attached) {
568
572
  ...attached.pageRoute ? { pageRoute: attached.pageRoute } : {}
569
573
  };
570
574
  }
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";
575
+ var PAGE_RESOURCE_MARKER = "__amplifyupPageResource";
576
+ function isPageResourceSentinel(value) {
577
+ return !!value && typeof value === "object" && !Array.isArray(value) && typeof value[PAGE_RESOURCE_MARKER] === "string";
574
578
  }
575
579
  function getByDotPath(source, path) {
576
580
  if (!path) return source;
@@ -584,30 +588,30 @@ function getByDotPath(source, path) {
584
588
  }
585
589
  return cur;
586
590
  }
587
- function hydratePageSlotValue(value, fields) {
588
- if (!isPageSlotSentinel(value)) return value;
591
+ function hydratePageResourceValue(value, fields) {
592
+ if (!isPageResourceSentinel(value)) return value;
589
593
  if (!fields) return null;
590
594
  if (value.path) return getByDotPath(fields, value.path) ?? null;
591
595
  return fields;
592
596
  }
593
- function hydratePageSlotProps(props, fields) {
597
+ function hydratePageResourceProps(props, fields) {
594
598
  const source = props && typeof props === "object" ? props : {};
595
599
  const out = { ...source };
596
600
  for (const [key, val] of Object.entries(out)) {
597
- if (isPageSlotSentinel(val)) {
598
- out[key] = hydratePageSlotValue(val, fields);
601
+ if (isPageResourceSentinel(val)) {
602
+ out[key] = hydratePageResourceValue(val, fields);
599
603
  }
600
604
  }
601
605
  return out;
602
606
  }
603
607
 
604
- // src/page-slot-runtime.ts
605
- var pageSlotFields = null;
606
- function setPageSlotFields(fields) {
607
- pageSlotFields = fields && typeof fields === "object" ? fields : null;
608
+ // src/page-resource-runtime.ts
609
+ var pageResourceFields = null;
610
+ function setPageResourceFields(fields) {
611
+ pageResourceFields = fields && typeof fields === "object" ? fields : null;
608
612
  }
609
- function getPageSlotFields() {
610
- return pageSlotFields;
613
+ function getPageResourceFields() {
614
+ return pageResourceFields;
611
615
  }
612
616
 
613
617
  // src/edge/normalizeRoute.ts
@@ -1575,7 +1579,7 @@ var AmplifyUpSDK = class {
1575
1579
  this.resolvedPageData,
1576
1580
  this.resolvedPageRoute
1577
1581
  );
1578
- setPageSlotFields(null);
1582
+ setPageResourceFields(null);
1579
1583
  return;
1580
1584
  }
1581
1585
  this.attachedPageContext = applyPageContext(this.pendingPageContext, {
@@ -1583,7 +1587,7 @@ var AmplifyUpSDK = class {
1583
1587
  routeParams: this.resolvedRouteParams,
1584
1588
  pageRoute: this.resolvedPageRoute
1585
1589
  });
1586
- setPageSlotFields(this.attachedPageContext?.resource?.fields || null);
1590
+ setPageResourceFields(this.attachedPageContext?.resource?.fields || null);
1587
1591
  }
1588
1592
  getAttachedPageContext() {
1589
1593
  return this.attachedPageContext;
@@ -3388,7 +3392,7 @@ function ComponentContextProvider({
3388
3392
  }) {
3389
3393
  const liveProps = useLiveComposerProps(
3390
3394
  layoutNodeId,
3391
- hydratePageSlotProps(props || {}, getPageSlotFields())
3395
+ hydratePageResourceProps(props || {}, getPageResourceFields())
3392
3396
  );
3393
3397
  return /* @__PURE__ */ jsxRuntime.jsx(
3394
3398
  ComponentContext.Provider,