@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.
@@ -462,14 +462,14 @@ function applyPageContext(input, opts) {
462
462
  log.warn("AmplifyUp: pageContext needs resourceType and key");
463
463
  return null;
464
464
  }
465
- const slot = opts.pageData?.slots?.[0];
466
- if (slot && slot.type && slot.type !== input.resourceType) {
465
+ const resource = opts.pageData?.resources?.[0];
466
+ if (resource && resource.type && resource.type !== input.resourceType) {
467
467
  log.warn(
468
- `AmplifyUp: pageContext resourceType "${input.resourceType}" does not match page slot "${slot.type}"`
468
+ `AmplifyUp: pageContext resourceType "${input.resourceType}" does not match page resource "${resource.type}"`
469
469
  );
470
470
  return null;
471
471
  }
472
- const fieldDefs = slot?.fields || [];
472
+ const fieldDefs = resource?.fields || [];
473
473
  const defByKey = new Map(fieldDefs.map((f) => [f.key, f]));
474
474
  const rawFields = input.fields && typeof input.fields === "object" ? input.fields : {};
475
475
  const fields = {};
@@ -487,7 +487,7 @@ function applyPageContext(input, opts) {
487
487
  }
488
488
  }
489
489
  const params = { ...opts.routeParams || {} };
490
- const mapping = slot?.urlParamMapping;
490
+ const mapping = resource?.urlParamMapping;
491
491
  let resourceKey = key;
492
492
  if (mapping) {
493
493
  const fromUrl = params[mapping.param];
@@ -505,7 +505,7 @@ function applyPageContext(input, opts) {
505
505
  if (pf.value !== void 0) pageFields[pf.key] = pf.value;
506
506
  continue;
507
507
  }
508
- if (pf.source === "mapped" && pf.slot && pf.field) {
508
+ if (pf.source === "mapped" && pf.resource && pf.field) {
509
509
  pageFields[pf.key] = fields[pf.field];
510
510
  }
511
511
  }
@@ -549,7 +549,7 @@ function mergeEventContext(properties, attached) {
549
549
  ...attached.pageRoute ? { pageRoute: attached.pageRoute } : {}
550
550
  };
551
551
  }
552
- function setPageSlotFields(fields) {
552
+ function setPageResourceFields(fields) {
553
553
  }
554
554
 
555
555
  // src/index.ts
@@ -1182,7 +1182,7 @@ var AmplifyUpSDK = class {
1182
1182
  routeParams: this.resolvedRouteParams,
1183
1183
  pageRoute: this.resolvedPageRoute
1184
1184
  });
1185
- setPageSlotFields(this.attachedPageContext?.resource?.fields || null);
1185
+ setPageResourceFields(this.attachedPageContext?.resource?.fields || null);
1186
1186
  }
1187
1187
  getAttachedPageContext() {
1188
1188
  return this.attachedPageContext;