@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.
package/dist/index.d.mts CHANGED
@@ -1,8 +1,8 @@
1
- import { P as PageConfig, C as ContentSource, A as AmplifyContentMeta, E as EventTrackingConfig$1, a as PageDataSnapshot, b as CDPAdapter, c as AmplifyUpConfig, d as EventProperties, e as AmplifyPageContextInput, f as AttachedPageEventContext, I as IdentifyInput, g as IdentifyTraits, h as ProfileFieldsInput, i as AmplifyUpTarget } from './types-BjlTE_cW.mjs';
2
- export { Z as ZoneConfig, k as isAmplifyUpTarget, n as normalizeAmplifyUpTarget, r as resolveAmplifyUpTarget, j as resolveAmplifyUpUrls } from './types-BjlTE_cW.mjs';
1
+ import { P as PageConfig, C as ContentSource, A as AmplifyContentMeta, E as EventTrackingConfig$1, a as PageDataSnapshot, b as CDPAdapter, c as AmplifyUpConfig, d as EventProperties, e as AmplifyPageContextInput, f as AttachedPageEventContext, I as IdentifyInput, g as IdentifyTraits, h as ProfileFieldsInput, i as AmplifyUpTarget } from './types-DpTzUg1C.mjs';
2
+ export { Z as ZoneConfig, k as isAmplifyUpTarget, n as normalizeAmplifyUpTarget, r as resolveAmplifyUpTarget, j as resolveAmplifyUpUrls } from './types-DpTzUg1C.mjs';
3
3
  export { i as isComposerPreview, a as isPreviewRequest, b as isWorkingContentRequest } from './preview-_vHmzRen.mjs';
4
4
  export { A as AMPLIFYUP_EDITOR_ROUTE, i as isAmplifyUpEditorRoute } from './reservedRoutes-aGgViBDM.mjs';
5
- export { g as FetchEdgeQueryOptions, F as FetchEdgeSelectOptions, 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, c as fetchEdgeQuery, f as fetchEdgeSelect, n as nextPageSpec, q as queryContent, d as searchSpec, s as selectVariants } from './query-DhyG93JN.mjs';
5
+ export { g as FetchEdgeQueryOptions, F as FetchEdgeSelectOptions, 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, c as fetchEdgeQuery, f as fetchEdgeSelect, n as nextPageSpec, q as queryContent, d as searchSpec, s as selectVariants } from './query-CWFb7rSm.mjs';
6
6
 
7
7
  /**
8
8
  * Storage utilities for instance ID and user ID
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- import { P as PageConfig, C as ContentSource, A as AmplifyContentMeta, E as EventTrackingConfig$1, a as PageDataSnapshot, b as CDPAdapter, c as AmplifyUpConfig, d as EventProperties, e as AmplifyPageContextInput, f as AttachedPageEventContext, I as IdentifyInput, g as IdentifyTraits, h as ProfileFieldsInput, i as AmplifyUpTarget } from './types-BjlTE_cW.js';
2
- export { Z as ZoneConfig, k as isAmplifyUpTarget, n as normalizeAmplifyUpTarget, r as resolveAmplifyUpTarget, j as resolveAmplifyUpUrls } from './types-BjlTE_cW.js';
1
+ import { P as PageConfig, C as ContentSource, A as AmplifyContentMeta, E as EventTrackingConfig$1, a as PageDataSnapshot, b as CDPAdapter, c as AmplifyUpConfig, d as EventProperties, e as AmplifyPageContextInput, f as AttachedPageEventContext, I as IdentifyInput, g as IdentifyTraits, h as ProfileFieldsInput, i as AmplifyUpTarget } from './types-DpTzUg1C.js';
2
+ export { Z as ZoneConfig, k as isAmplifyUpTarget, n as normalizeAmplifyUpTarget, r as resolveAmplifyUpTarget, j as resolveAmplifyUpUrls } from './types-DpTzUg1C.js';
3
3
  export { i as isComposerPreview, a as isPreviewRequest, b as isWorkingContentRequest } from './preview-_vHmzRen.js';
4
4
  export { A as AMPLIFYUP_EDITOR_ROUTE, i as isAmplifyUpEditorRoute } from './reservedRoutes-aGgViBDM.js';
5
- export { g as FetchEdgeQueryOptions, F as FetchEdgeSelectOptions, 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, c as fetchEdgeQuery, f as fetchEdgeSelect, n as nextPageSpec, q as queryContent, d as searchSpec, s as selectVariants } from './query-CMiGo_Kt.js';
5
+ export { g as FetchEdgeQueryOptions, F as FetchEdgeSelectOptions, 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, c as fetchEdgeQuery, f as fetchEdgeSelect, n as nextPageSpec, q as queryContent, d as searchSpec, s as selectVariants } from './query-L7zSmLFX.js';
6
6
 
7
7
  /**
8
8
  * Storage utilities for instance ID and user ID
package/dist/index.js CHANGED
@@ -455,14 +455,14 @@ function applyPageContext(input, opts) {
455
455
  log.warn("AmplifyUp: pageContext needs resourceType and key");
456
456
  return null;
457
457
  }
458
- const slot = opts.pageData?.slots?.[0];
459
- if (slot && slot.type && slot.type !== input.resourceType) {
458
+ const resource = opts.pageData?.resources?.[0];
459
+ if (resource && resource.type && resource.type !== input.resourceType) {
460
460
  log.warn(
461
- `AmplifyUp: pageContext resourceType "${input.resourceType}" does not match page slot "${slot.type}"`
461
+ `AmplifyUp: pageContext resourceType "${input.resourceType}" does not match page resource "${resource.type}"`
462
462
  );
463
463
  return null;
464
464
  }
465
- const fieldDefs = slot?.fields || [];
465
+ const fieldDefs = resource?.fields || [];
466
466
  const defByKey = new Map(fieldDefs.map((f) => [f.key, f]));
467
467
  const rawFields = input.fields && typeof input.fields === "object" ? input.fields : {};
468
468
  const fields = {};
@@ -475,12 +475,16 @@ function applyPageContext(input, opts) {
475
475
  log.warn(`AmplifyUp: unknown resource field "${k}" dropped`);
476
476
  continue;
477
477
  }
478
+ if (def.passThrough) {
479
+ if (v != null) fields[k] = v;
480
+ continue;
481
+ }
478
482
  const coerced = coerceField(def, v, log);
479
483
  if (coerced !== void 0) fields[k] = coerced;
480
484
  }
481
485
  }
482
486
  const params = { ...opts.routeParams || {} };
483
- const mapping = slot?.urlParamMapping;
487
+ const mapping = resource?.urlParamMapping;
484
488
  let resourceKey = key;
485
489
  if (mapping) {
486
490
  const fromUrl = params[mapping.param];
@@ -498,7 +502,7 @@ function applyPageContext(input, opts) {
498
502
  if (pf.value !== void 0) pageFields[pf.key] = pf.value;
499
503
  continue;
500
504
  }
501
- if (pf.source === "mapped" && pf.slot && pf.field) {
505
+ if (pf.source === "mapped" && pf.resource && pf.field) {
502
506
  pageFields[pf.key] = fields[pf.field];
503
507
  }
504
508
  }
@@ -542,7 +546,7 @@ function mergeEventContext(properties, attached) {
542
546
  ...attached.pageRoute ? { pageRoute: attached.pageRoute } : {}
543
547
  };
544
548
  }
545
- function setPageSlotFields(fields) {
549
+ function setPageResourceFields(fields) {
546
550
  }
547
551
 
548
552
  // src/reservedRoutes.ts
@@ -1523,7 +1527,7 @@ var AmplifyUpSDK = class {
1523
1527
  routeParams: this.resolvedRouteParams,
1524
1528
  pageRoute: this.resolvedPageRoute
1525
1529
  });
1526
- setPageSlotFields(this.attachedPageContext?.resource?.fields || null);
1530
+ setPageResourceFields(this.attachedPageContext?.resource?.fields || null);
1527
1531
  }
1528
1532
  getAttachedPageContext() {
1529
1533
  return this.attachedPageContext;