@amplifyup/sdk 0.1.43 → 0.1.44

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 CDPAdapter, b as AmplifyUpConfig, c as EventProperties, I as IdentifyInput, d as IdentifyTraits, e as ProfileFieldsInput, f as AmplifyUpTarget } from './types-DUP8Lb7R.mjs';
2
- export { Z as ZoneConfig, i as isAmplifyUpTarget, n as normalizeAmplifyUpTarget, r as resolveAmplifyUpTarget, g as resolveAmplifyUpUrls } from './types-DUP8Lb7R.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-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';
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-CraXKhi7.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';
6
6
 
7
7
  /**
8
8
  * Storage utilities for instance ID and user ID
@@ -65,6 +65,7 @@ interface EdgeResolvedPayload {
65
65
  tree?: EdgeResolvedComponent[];
66
66
  /** Composer event bindings baked into the published snapshot. */
67
67
  eventTracking?: EventTrackingConfig$1[];
68
+ pageData?: PageDataSnapshot;
68
69
  meta: {
69
70
  variantKeys: Record<string, string>;
70
71
  audienceLookup?: {
@@ -191,6 +192,11 @@ declare class AmplifyUpSDK {
191
192
  private pageEngagementActive;
192
193
  /** Path of the last page() / routeChange — avoids duplicate SPA fires. */
193
194
  private lastTrackedPath;
195
+ private pendingPageContext;
196
+ private attachedPageContext;
197
+ private resolvedPageData;
198
+ private resolvedPageRoute;
199
+ private resolvedRouteParams;
194
200
  private historyHooksInstalled;
195
201
  private pageEngagementState;
196
202
  constructor(adapter?: CDPAdapter);
@@ -250,6 +256,19 @@ declare class AmplifyUpSDK {
250
256
  */
251
257
  setupComponentViewTracking(): void;
252
258
  private cleanupComponentViewTracking;
259
+ /**
260
+ * Set resource context for this page. Prefer passing `pageContext` on
261
+ * AmplifyUpProvider / init — required for components using From page.
262
+ * Late calls still attach to subsequent events (not a second page view).
263
+ */
264
+ setPageContext(input: AmplifyPageContextInput): void;
265
+ /**
266
+ * Apply published pageData (from /v1/resolve) so field validation and
267
+ * mapped page fields can run.
268
+ */
269
+ applyResolvedPageData(pageData: PageDataSnapshot | null | undefined, pageRoute?: string, routeParams?: Record<string, string>): void;
270
+ private recomputeAttachedContext;
271
+ getAttachedPageContext(): AttachedPageEventContext | null;
253
272
  /**
254
273
  * Track a page view
255
274
  */
@@ -546,4 +565,4 @@ declare const verifyAWSConnection: () => {
546
565
 
547
566
  declare const _default: AmplifyUpSDK;
548
567
 
549
- export { ANON_COOKIE_NAME, AmplifyContentMeta, AmplifyUpConfig, AmplifyUpSDK, AmplifyUpTarget, CDPAdapter, ContentSource, DWELL_ACTIVITY_IDLE_MS, EdgeResolveError, EventProperties, EventTrackingConfig$1 as EventTrackingConfig, type FetchContentOptions, type FetchContentResult, IdentifyInput, IdentifyTraits, PageConfig, ProfileFieldsInput, SESSION_COOKIE_NAME, SESSION_IDLE_GAP_MS, buildLayoutProviderUrl, buildPageRenderUrl, cleanupEventTracking, _default as default, fetchContent, fetchEdgeResolve, fetchPageConfig, getDiagnostics, getInstanceId, getOrchestratorUrl, getSDK, getSessionId, getStatus, getTarget, getTrackingId, getUserId, identify, init, mapResolvedToPageConfig, normalizeRoute, page, refreshEventTracking, reset, routeChange, setProfileFields, setupComponentViewTracking, setupEventTracking, testTracking, track, trackClick, trackContentEngagement, trackContentView, trackFormFieldInteraction, trackFormSubmit, verifyAWSConnection };
568
+ export { ANON_COOKIE_NAME, AmplifyContentMeta, AmplifyPageContextInput, AmplifyUpConfig, AmplifyUpSDK, AmplifyUpTarget, CDPAdapter, ContentSource, DWELL_ACTIVITY_IDLE_MS, EdgeResolveError, EventProperties, EventTrackingConfig$1 as EventTrackingConfig, type FetchContentOptions, type FetchContentResult, IdentifyInput, IdentifyTraits, PageConfig, PageDataSnapshot, ProfileFieldsInput, SESSION_COOKIE_NAME, SESSION_IDLE_GAP_MS, buildLayoutProviderUrl, buildPageRenderUrl, cleanupEventTracking, _default as default, fetchContent, fetchEdgeResolve, fetchPageConfig, getDiagnostics, getInstanceId, getOrchestratorUrl, getSDK, getSessionId, getStatus, getTarget, getTrackingId, getUserId, identify, init, mapResolvedToPageConfig, normalizeRoute, page, refreshEventTracking, reset, routeChange, setProfileFields, setupComponentViewTracking, setupEventTracking, testTracking, track, trackClick, trackContentEngagement, trackContentView, trackFormFieldInteraction, trackFormSubmit, verifyAWSConnection };
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 CDPAdapter, b as AmplifyUpConfig, c as EventProperties, I as IdentifyInput, d as IdentifyTraits, e as ProfileFieldsInput, f as AmplifyUpTarget } from './types-DUP8Lb7R.js';
2
- export { Z as ZoneConfig, i as isAmplifyUpTarget, n as normalizeAmplifyUpTarget, r as resolveAmplifyUpTarget, g as resolveAmplifyUpUrls } from './types-DUP8Lb7R.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-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';
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-BMsorj0k.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';
6
6
 
7
7
  /**
8
8
  * Storage utilities for instance ID and user ID
@@ -65,6 +65,7 @@ interface EdgeResolvedPayload {
65
65
  tree?: EdgeResolvedComponent[];
66
66
  /** Composer event bindings baked into the published snapshot. */
67
67
  eventTracking?: EventTrackingConfig$1[];
68
+ pageData?: PageDataSnapshot;
68
69
  meta: {
69
70
  variantKeys: Record<string, string>;
70
71
  audienceLookup?: {
@@ -191,6 +192,11 @@ declare class AmplifyUpSDK {
191
192
  private pageEngagementActive;
192
193
  /** Path of the last page() / routeChange — avoids duplicate SPA fires. */
193
194
  private lastTrackedPath;
195
+ private pendingPageContext;
196
+ private attachedPageContext;
197
+ private resolvedPageData;
198
+ private resolvedPageRoute;
199
+ private resolvedRouteParams;
194
200
  private historyHooksInstalled;
195
201
  private pageEngagementState;
196
202
  constructor(adapter?: CDPAdapter);
@@ -250,6 +256,19 @@ declare class AmplifyUpSDK {
250
256
  */
251
257
  setupComponentViewTracking(): void;
252
258
  private cleanupComponentViewTracking;
259
+ /**
260
+ * Set resource context for this page. Prefer passing `pageContext` on
261
+ * AmplifyUpProvider / init — required for components using From page.
262
+ * Late calls still attach to subsequent events (not a second page view).
263
+ */
264
+ setPageContext(input: AmplifyPageContextInput): void;
265
+ /**
266
+ * Apply published pageData (from /v1/resolve) so field validation and
267
+ * mapped page fields can run.
268
+ */
269
+ applyResolvedPageData(pageData: PageDataSnapshot | null | undefined, pageRoute?: string, routeParams?: Record<string, string>): void;
270
+ private recomputeAttachedContext;
271
+ getAttachedPageContext(): AttachedPageEventContext | null;
253
272
  /**
254
273
  * Track a page view
255
274
  */
@@ -546,4 +565,4 @@ declare const verifyAWSConnection: () => {
546
565
 
547
566
  declare const _default: AmplifyUpSDK;
548
567
 
549
- export { ANON_COOKIE_NAME, AmplifyContentMeta, AmplifyUpConfig, AmplifyUpSDK, AmplifyUpTarget, CDPAdapter, ContentSource, DWELL_ACTIVITY_IDLE_MS, EdgeResolveError, EventProperties, EventTrackingConfig$1 as EventTrackingConfig, type FetchContentOptions, type FetchContentResult, IdentifyInput, IdentifyTraits, PageConfig, ProfileFieldsInput, SESSION_COOKIE_NAME, SESSION_IDLE_GAP_MS, buildLayoutProviderUrl, buildPageRenderUrl, cleanupEventTracking, _default as default, fetchContent, fetchEdgeResolve, fetchPageConfig, getDiagnostics, getInstanceId, getOrchestratorUrl, getSDK, getSessionId, getStatus, getTarget, getTrackingId, getUserId, identify, init, mapResolvedToPageConfig, normalizeRoute, page, refreshEventTracking, reset, routeChange, setProfileFields, setupComponentViewTracking, setupEventTracking, testTracking, track, trackClick, trackContentEngagement, trackContentView, trackFormFieldInteraction, trackFormSubmit, verifyAWSConnection };
568
+ export { ANON_COOKIE_NAME, AmplifyContentMeta, AmplifyPageContextInput, AmplifyUpConfig, AmplifyUpSDK, AmplifyUpTarget, CDPAdapter, ContentSource, DWELL_ACTIVITY_IDLE_MS, EdgeResolveError, EventProperties, EventTrackingConfig$1 as EventTrackingConfig, type FetchContentOptions, type FetchContentResult, IdentifyInput, IdentifyTraits, PageConfig, PageDataSnapshot, ProfileFieldsInput, SESSION_COOKIE_NAME, SESSION_IDLE_GAP_MS, buildLayoutProviderUrl, buildPageRenderUrl, cleanupEventTracking, _default as default, fetchContent, fetchEdgeResolve, fetchPageConfig, getDiagnostics, getInstanceId, getOrchestratorUrl, getSDK, getSessionId, getStatus, getTarget, getTrackingId, getUserId, identify, init, mapResolvedToPageConfig, normalizeRoute, page, refreshEventTracking, reset, routeChange, setProfileFields, setupComponentViewTracking, setupEventTracking, testTracking, track, trackClick, trackContentEngagement, trackContentView, trackFormFieldInteraction, trackFormSubmit, verifyAWSConnection };
package/dist/index.js CHANGED
@@ -398,6 +398,153 @@ function isComposerPreview() {
398
398
  return false;
399
399
  }
400
400
 
401
+ // src/page-context.ts
402
+ var defaultLog = {
403
+ warn: (...args) => {
404
+ if (typeof console !== "undefined") console.warn(...args);
405
+ }
406
+ };
407
+ function coerceField(def, raw, log) {
408
+ if (raw == null) return void 0;
409
+ if (def.multiValue) {
410
+ const list = Array.isArray(raw) ? raw : [raw];
411
+ const out = [];
412
+ for (const item of list) {
413
+ const coerced = coerceScalar(def, item, log);
414
+ if (coerced !== void 0) out.push(coerced);
415
+ }
416
+ return out;
417
+ }
418
+ return coerceScalar(def, raw, log);
419
+ }
420
+ function coerceScalar(def, raw, log) {
421
+ switch (def.dataType) {
422
+ case "string":
423
+ if (typeof raw === "string") return raw;
424
+ if (typeof raw === "number" || typeof raw === "boolean") return String(raw);
425
+ log.warn(`AmplifyUp: dropped field "${def.key}" (expected string)`);
426
+ return void 0;
427
+ case "number": {
428
+ if (typeof raw === "number" && Number.isFinite(raw)) return raw;
429
+ if (typeof raw === "string" && raw.trim() !== "" && Number.isFinite(Number(raw))) {
430
+ return Number(raw);
431
+ }
432
+ log.warn(`AmplifyUp: dropped field "${def.key}" (expected number)`);
433
+ return void 0;
434
+ }
435
+ case "boolean": {
436
+ if (typeof raw === "boolean") return raw;
437
+ if (raw === "true") return true;
438
+ if (raw === "false") return false;
439
+ log.warn(`AmplifyUp: dropped field "${def.key}" (expected boolean)`);
440
+ return void 0;
441
+ }
442
+ case "date": {
443
+ if (typeof raw === "string" && !Number.isNaN(Date.parse(raw))) return raw;
444
+ log.warn(`AmplifyUp: dropped field "${def.key}" (expected date)`);
445
+ return void 0;
446
+ }
447
+ default:
448
+ return void 0;
449
+ }
450
+ }
451
+ function applyPageContext(input, opts) {
452
+ const log = opts.log || defaultLog;
453
+ const key = String(input.key || "").trim();
454
+ if (!key || !input.resourceType) {
455
+ log.warn("AmplifyUp: pageContext needs resourceType and key");
456
+ return null;
457
+ }
458
+ const slot = opts.pageData?.slots?.[0];
459
+ if (slot && slot.type && slot.type !== input.resourceType) {
460
+ log.warn(
461
+ `AmplifyUp: pageContext resourceType "${input.resourceType}" does not match page slot "${slot.type}"`
462
+ );
463
+ return null;
464
+ }
465
+ const fieldDefs = slot?.fields || [];
466
+ const defByKey = new Map(fieldDefs.map((f) => [f.key, f]));
467
+ const rawFields = input.fields && typeof input.fields === "object" ? input.fields : {};
468
+ const fields = {};
469
+ if (fieldDefs.length === 0) {
470
+ Object.assign(fields, rawFields);
471
+ } else {
472
+ for (const [k, v] of Object.entries(rawFields)) {
473
+ const def = defByKey.get(k);
474
+ if (!def) {
475
+ log.warn(`AmplifyUp: unknown resource field "${k}" dropped`);
476
+ continue;
477
+ }
478
+ const coerced = coerceField(def, v, log);
479
+ if (coerced !== void 0) fields[k] = coerced;
480
+ }
481
+ }
482
+ const params = { ...opts.routeParams || {} };
483
+ const mapping = slot?.urlParamMapping;
484
+ let resourceKey = key;
485
+ if (mapping) {
486
+ const fromUrl = params[mapping.param];
487
+ const fromField = fields[mapping.field];
488
+ if (fromUrl) resourceKey = String(fromUrl);
489
+ if (fromUrl && fromField != null && String(fromField) !== String(fromUrl)) {
490
+ log.warn(
491
+ `AmplifyUp: resource key mismatch \u2014 URL :${mapping.param} is "${fromUrl}" but ${mapping.field} is "${String(fromField)}". Using the URL param.`
492
+ );
493
+ }
494
+ }
495
+ const pageFields = {};
496
+ for (const pf of opts.pageData?.pageFields || []) {
497
+ if (pf.source === "static") {
498
+ if (pf.value !== void 0) pageFields[pf.key] = pf.value;
499
+ continue;
500
+ }
501
+ if (pf.source === "mapped" && pf.slot && pf.field) {
502
+ pageFields[pf.key] = fields[pf.field];
503
+ }
504
+ }
505
+ return {
506
+ resource: {
507
+ type: input.resourceType,
508
+ key: resourceKey,
509
+ params,
510
+ fields
511
+ },
512
+ page: { fields: pageFields },
513
+ pageRoute: opts.pageRoute || ""
514
+ };
515
+ }
516
+ function staticPageFieldsFromSnapshot(pageData) {
517
+ const pageFields = {};
518
+ for (const pf of pageData?.pageFields || []) {
519
+ if (pf.source === "static" && pf.value !== void 0) {
520
+ pageFields[pf.key] = pf.value;
521
+ }
522
+ }
523
+ return pageFields;
524
+ }
525
+ function attachStaticPageContext(pageData, pageRoute) {
526
+ if (!pageData) return null;
527
+ const fields = staticPageFieldsFromSnapshot(pageData);
528
+ const hasStatic = Object.keys(fields).length > 0;
529
+ const hasRoute = !!pageRoute;
530
+ if (!hasStatic && !hasRoute) return null;
531
+ return {
532
+ page: { fields },
533
+ pageRoute: pageRoute || ""
534
+ };
535
+ }
536
+ function mergeEventContext(properties, attached) {
537
+ if (!attached) return properties;
538
+ return {
539
+ ...properties,
540
+ ...attached.resource ? { resource: attached.resource } : {},
541
+ page: attached.page,
542
+ ...attached.pageRoute ? { pageRoute: attached.pageRoute } : {}
543
+ };
544
+ }
545
+ function setPageSlotFields(fields) {
546
+ }
547
+
401
548
  // src/reservedRoutes.ts
402
549
  var AMPLIFYUP_EDITOR_ROUTE = "/__amplifyup/editor";
403
550
  function isAmplifyUpEditorRoute(pathname) {
@@ -523,7 +670,8 @@ function mapResolvedToPageConfig(payload) {
523
670
  // Stash edge meta for diagnostics (not visitor-facing)
524
671
  description: payload.meta?.degraded ? "degraded" : void 0
525
672
  },
526
- ...payload.eventTracking && payload.eventTracking.length > 0 ? { eventTracking: payload.eventTracking } : {}
673
+ ...payload.eventTracking && payload.eventTracking.length > 0 ? { eventTracking: payload.eventTracking } : {},
674
+ ...payload.pageData ? { pageData: payload.pageData } : {}
527
675
  };
528
676
  }
529
677
  function collectDegraded(payload) {
@@ -813,6 +961,11 @@ var AmplifyUpSDK = class {
813
961
  this.pageEngagementActive = false;
814
962
  /** Path of the last page() / routeChange — avoids duplicate SPA fires. */
815
963
  this.lastTrackedPath = null;
964
+ this.pendingPageContext = null;
965
+ this.attachedPageContext = null;
966
+ this.resolvedPageData = null;
967
+ this.resolvedPageRoute = "";
968
+ this.resolvedRouteParams = {};
816
969
  this.historyHooksInstalled = false;
817
970
  this.pageEngagementState = {
818
971
  reached: /* @__PURE__ */ new Set(),
@@ -975,8 +1128,13 @@ var AmplifyUpSDK = class {
975
1128
  // Enable debug by default
976
1129
  target: this.target,
977
1130
  dev: config.dev,
978
- ...config.siteId ? { siteId: config.siteId } : {}
1131
+ ...config.siteId ? { siteId: config.siteId } : {},
1132
+ ...config.pageContext ? { pageContext: config.pageContext } : {}
979
1133
  };
1134
+ if (config.pageContext) {
1135
+ this.pendingPageContext = config.pageContext;
1136
+ this.recomputeAttachedContext();
1137
+ }
980
1138
  try {
981
1139
  const adapterConfig = {
982
1140
  ...this.config,
@@ -1333,6 +1491,43 @@ var AmplifyUpSDK = class {
1333
1491
  this.componentViewObservers.forEach((obs) => obs.disconnect());
1334
1492
  this.componentViewObservers = [];
1335
1493
  }
1494
+ /**
1495
+ * Set resource context for this page. Prefer passing `pageContext` on
1496
+ * AmplifyUpProvider / init — required for components using From page.
1497
+ * Late calls still attach to subsequent events (not a second page view).
1498
+ */
1499
+ setPageContext(input) {
1500
+ this.pendingPageContext = input;
1501
+ this.recomputeAttachedContext();
1502
+ }
1503
+ /**
1504
+ * Apply published pageData (from /v1/resolve) so field validation and
1505
+ * mapped page fields can run.
1506
+ */
1507
+ applyResolvedPageData(pageData, pageRoute, routeParams) {
1508
+ this.resolvedPageData = pageData || null;
1509
+ if (pageRoute) this.resolvedPageRoute = pageRoute;
1510
+ if (routeParams) this.resolvedRouteParams = routeParams;
1511
+ this.recomputeAttachedContext();
1512
+ }
1513
+ recomputeAttachedContext() {
1514
+ if (!this.pendingPageContext) {
1515
+ this.attachedPageContext = attachStaticPageContext(
1516
+ this.resolvedPageData,
1517
+ this.resolvedPageRoute
1518
+ );
1519
+ return;
1520
+ }
1521
+ this.attachedPageContext = applyPageContext(this.pendingPageContext, {
1522
+ pageData: this.resolvedPageData,
1523
+ routeParams: this.resolvedRouteParams,
1524
+ pageRoute: this.resolvedPageRoute
1525
+ });
1526
+ setPageSlotFields(this.attachedPageContext?.resource?.fields || null);
1527
+ }
1528
+ getAttachedPageContext() {
1529
+ return this.attachedPageContext;
1530
+ }
1336
1531
  /**
1337
1532
  * Track a page view
1338
1533
  */
@@ -1354,7 +1549,7 @@ var AmplifyUpSDK = class {
1354
1549
  sessionId,
1355
1550
  trackingId: this.config?.trackingId,
1356
1551
  // Timestamp is included in event payload
1357
- ...properties
1552
+ ...mergeEventContext(properties || {}, this.attachedPageContext)
1358
1553
  };
1359
1554
  this.adapter.page(pageProperties);
1360
1555
  this.lastTrackedPath = url;
@@ -1378,7 +1573,7 @@ var AmplifyUpSDK = class {
1378
1573
  url: typeof window !== "undefined" ? window.location.href : void 0,
1379
1574
  path: properties?.path || (typeof window !== "undefined" ? window.location.pathname : void 0),
1380
1575
  // Timestamp is included in event payload
1381
- ...properties
1576
+ ...mergeEventContext(properties || {}, this.attachedPageContext)
1382
1577
  };
1383
1578
  if (!trackProperties.path && typeof window !== "undefined") {
1384
1579
  trackProperties.path = window.location.pathname;