@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.
package/dist/index.mjs CHANGED
@@ -451,14 +451,14 @@ function applyPageContext(input, opts) {
451
451
  log.warn("AmplifyUp: pageContext needs resourceType and key");
452
452
  return null;
453
453
  }
454
- const slot = opts.pageData?.slots?.[0];
455
- if (slot && slot.type && slot.type !== input.resourceType) {
454
+ const resource = opts.pageData?.resources?.[0];
455
+ if (resource && resource.type && resource.type !== input.resourceType) {
456
456
  log.warn(
457
- `AmplifyUp: pageContext resourceType "${input.resourceType}" does not match page slot "${slot.type}"`
457
+ `AmplifyUp: pageContext resourceType "${input.resourceType}" does not match page resource "${resource.type}"`
458
458
  );
459
459
  return null;
460
460
  }
461
- const fieldDefs = slot?.fields || [];
461
+ const fieldDefs = resource?.fields || [];
462
462
  const defByKey = new Map(fieldDefs.map((f) => [f.key, f]));
463
463
  const rawFields = input.fields && typeof input.fields === "object" ? input.fields : {};
464
464
  const fields = {};
@@ -476,7 +476,7 @@ function applyPageContext(input, opts) {
476
476
  }
477
477
  }
478
478
  const params = { ...opts.routeParams || {} };
479
- const mapping = slot?.urlParamMapping;
479
+ const mapping = resource?.urlParamMapping;
480
480
  let resourceKey = key;
481
481
  if (mapping) {
482
482
  const fromUrl = params[mapping.param];
@@ -494,7 +494,7 @@ function applyPageContext(input, opts) {
494
494
  if (pf.value !== void 0) pageFields[pf.key] = pf.value;
495
495
  continue;
496
496
  }
497
- if (pf.source === "mapped" && pf.slot && pf.field) {
497
+ if (pf.source === "mapped" && pf.resource && pf.field) {
498
498
  pageFields[pf.key] = fields[pf.field];
499
499
  }
500
500
  }
@@ -538,7 +538,7 @@ function mergeEventContext(properties, attached) {
538
538
  ...attached.pageRoute ? { pageRoute: attached.pageRoute } : {}
539
539
  };
540
540
  }
541
- function setPageSlotFields(fields) {
541
+ function setPageResourceFields(fields) {
542
542
  }
543
543
 
544
544
  // src/reservedRoutes.ts
@@ -1519,7 +1519,7 @@ var AmplifyUpSDK = class {
1519
1519
  routeParams: this.resolvedRouteParams,
1520
1520
  pageRoute: this.resolvedPageRoute
1521
1521
  });
1522
- setPageSlotFields(this.attachedPageContext?.resource?.fields || null);
1522
+ setPageResourceFields(this.attachedPageContext?.resource?.fields || null);
1523
1523
  }
1524
1524
  getAttachedPageContext() {
1525
1525
  return this.attachedPageContext;