@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,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { ReactNode } from 'react';
3
- import { P as PageConfig } from './types-BjlTE_cW.mjs';
3
+ import { P as PageConfig } from './types-DpTzUg1C.mjs';
4
4
 
5
5
  interface AmplifyRendererProps {
6
6
  /**
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { ReactNode } from 'react';
3
- import { P as PageConfig } from './types-BjlTE_cW.js';
3
+ import { P as PageConfig } from './types-DpTzUg1C.js';
4
4
 
5
5
  interface AmplifyRendererProps {
6
6
  /**
@@ -464,14 +464,14 @@ function applyPageContext(input, opts) {
464
464
  log.warn("AmplifyUp: pageContext needs resourceType and key");
465
465
  return null;
466
466
  }
467
- const slot = opts.pageData?.slots?.[0];
468
- if (slot && slot.type && slot.type !== input.resourceType) {
467
+ const resource = opts.pageData?.resources?.[0];
468
+ if (resource && resource.type && resource.type !== input.resourceType) {
469
469
  log.warn(
470
- `AmplifyUp: pageContext resourceType "${input.resourceType}" does not match page slot "${slot.type}"`
470
+ `AmplifyUp: pageContext resourceType "${input.resourceType}" does not match page resource "${resource.type}"`
471
471
  );
472
472
  return null;
473
473
  }
474
- const fieldDefs = slot?.fields || [];
474
+ const fieldDefs = resource?.fields || [];
475
475
  const defByKey = new Map(fieldDefs.map((f) => [f.key, f]));
476
476
  const rawFields = input.fields && typeof input.fields === "object" ? input.fields : {};
477
477
  const fields = {};
@@ -484,12 +484,16 @@ function applyPageContext(input, opts) {
484
484
  log.warn(`AmplifyUp: unknown resource field "${k}" dropped`);
485
485
  continue;
486
486
  }
487
+ if (def.passThrough) {
488
+ if (v != null) fields[k] = v;
489
+ continue;
490
+ }
487
491
  const coerced = coerceField(def, v, log);
488
492
  if (coerced !== void 0) fields[k] = coerced;
489
493
  }
490
494
  }
491
495
  const params = { ...opts.routeParams || {} };
492
- const mapping = slot?.urlParamMapping;
496
+ const mapping = resource?.urlParamMapping;
493
497
  let resourceKey = key;
494
498
  if (mapping) {
495
499
  const fromUrl = params[mapping.param];
@@ -507,7 +511,7 @@ function applyPageContext(input, opts) {
507
511
  if (pf.value !== void 0) pageFields[pf.key] = pf.value;
508
512
  continue;
509
513
  }
510
- if (pf.source === "mapped" && pf.slot && pf.field) {
514
+ if (pf.source === "mapped" && pf.resource && pf.field) {
511
515
  pageFields[pf.key] = fields[pf.field];
512
516
  }
513
517
  }
@@ -551,7 +555,7 @@ function mergeEventContext(properties, attached) {
551
555
  ...attached.pageRoute ? { pageRoute: attached.pageRoute } : {}
552
556
  };
553
557
  }
554
- function setPageSlotFields(fields) {
558
+ function setPageResourceFields(fields) {
555
559
  }
556
560
 
557
561
  // src/index.ts
@@ -1184,7 +1188,7 @@ var AmplifyUpSDK = class {
1184
1188
  routeParams: this.resolvedRouteParams,
1185
1189
  pageRoute: this.resolvedPageRoute
1186
1190
  });
1187
- setPageSlotFields(this.attachedPageContext?.resource?.fields || null);
1191
+ setPageResourceFields(this.attachedPageContext?.resource?.fields || null);
1188
1192
  }
1189
1193
  getAttachedPageContext() {
1190
1194
  return this.attachedPageContext;