@amplifyup/sdk 0.1.42 → 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,7 +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
- 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';
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
6
 
6
7
  /**
7
8
  * Storage utilities for instance ID and user ID
@@ -64,6 +65,7 @@ interface EdgeResolvedPayload {
64
65
  tree?: EdgeResolvedComponent[];
65
66
  /** Composer event bindings baked into the published snapshot. */
66
67
  eventTracking?: EventTrackingConfig$1[];
68
+ pageData?: PageDataSnapshot;
67
69
  meta: {
68
70
  variantKeys: Record<string, string>;
69
71
  audienceLookup?: {
@@ -190,6 +192,11 @@ declare class AmplifyUpSDK {
190
192
  private pageEngagementActive;
191
193
  /** Path of the last page() / routeChange — avoids duplicate SPA fires. */
192
194
  private lastTrackedPath;
195
+ private pendingPageContext;
196
+ private attachedPageContext;
197
+ private resolvedPageData;
198
+ private resolvedPageRoute;
199
+ private resolvedRouteParams;
193
200
  private historyHooksInstalled;
194
201
  private pageEngagementState;
195
202
  constructor(adapter?: CDPAdapter);
@@ -249,6 +256,19 @@ declare class AmplifyUpSDK {
249
256
  */
250
257
  setupComponentViewTracking(): void;
251
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;
252
272
  /**
253
273
  * Track a page view
254
274
  */
@@ -545,4 +565,4 @@ declare const verifyAWSConnection: () => {
545
565
 
546
566
  declare const _default: AmplifyUpSDK;
547
567
 
548
- 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,7 +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
- 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';
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
6
 
6
7
  /**
7
8
  * Storage utilities for instance ID and user ID
@@ -64,6 +65,7 @@ interface EdgeResolvedPayload {
64
65
  tree?: EdgeResolvedComponent[];
65
66
  /** Composer event bindings baked into the published snapshot. */
66
67
  eventTracking?: EventTrackingConfig$1[];
68
+ pageData?: PageDataSnapshot;
67
69
  meta: {
68
70
  variantKeys: Record<string, string>;
69
71
  audienceLookup?: {
@@ -190,6 +192,11 @@ declare class AmplifyUpSDK {
190
192
  private pageEngagementActive;
191
193
  /** Path of the last page() / routeChange — avoids duplicate SPA fires. */
192
194
  private lastTrackedPath;
195
+ private pendingPageContext;
196
+ private attachedPageContext;
197
+ private resolvedPageData;
198
+ private resolvedPageRoute;
199
+ private resolvedRouteParams;
193
200
  private historyHooksInstalled;
194
201
  private pageEngagementState;
195
202
  constructor(adapter?: CDPAdapter);
@@ -249,6 +256,19 @@ declare class AmplifyUpSDK {
249
256
  */
250
257
  setupComponentViewTracking(): void;
251
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;
252
272
  /**
253
273
  * Track a page view
254
274
  */
@@ -545,4 +565,4 @@ declare const verifyAWSConnection: () => {
545
565
 
546
566
  declare const _default: AmplifyUpSDK;
547
567
 
548
- 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,159 @@ 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
+
548
+ // src/reservedRoutes.ts
549
+ var AMPLIFYUP_EDITOR_ROUTE = "/__amplifyup/editor";
550
+ function isAmplifyUpEditorRoute(pathname) {
551
+ return pathname === AMPLIFYUP_EDITOR_ROUTE || pathname.startsWith(`${AMPLIFYUP_EDITOR_ROUTE}/`);
552
+ }
553
+
401
554
  // src/edge/normalizeRoute.ts
402
555
  function normalizeRoute(route) {
403
556
  let path = String(route || "").trim();
@@ -517,7 +670,8 @@ function mapResolvedToPageConfig(payload) {
517
670
  // Stash edge meta for diagnostics (not visitor-facing)
518
671
  description: payload.meta?.degraded ? "degraded" : void 0
519
672
  },
520
- ...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 } : {}
521
675
  };
522
676
  }
523
677
  function collectDegraded(payload) {
@@ -807,6 +961,11 @@ var AmplifyUpSDK = class {
807
961
  this.pageEngagementActive = false;
808
962
  /** Path of the last page() / routeChange — avoids duplicate SPA fires. */
809
963
  this.lastTrackedPath = null;
964
+ this.pendingPageContext = null;
965
+ this.attachedPageContext = null;
966
+ this.resolvedPageData = null;
967
+ this.resolvedPageRoute = "";
968
+ this.resolvedRouteParams = {};
810
969
  this.historyHooksInstalled = false;
811
970
  this.pageEngagementState = {
812
971
  reached: /* @__PURE__ */ new Set(),
@@ -969,8 +1128,13 @@ var AmplifyUpSDK = class {
969
1128
  // Enable debug by default
970
1129
  target: this.target,
971
1130
  dev: config.dev,
972
- ...config.siteId ? { siteId: config.siteId } : {}
1131
+ ...config.siteId ? { siteId: config.siteId } : {},
1132
+ ...config.pageContext ? { pageContext: config.pageContext } : {}
973
1133
  };
1134
+ if (config.pageContext) {
1135
+ this.pendingPageContext = config.pageContext;
1136
+ this.recomputeAttachedContext();
1137
+ }
974
1138
  try {
975
1139
  const adapterConfig = {
976
1140
  ...this.config,
@@ -1327,6 +1491,43 @@ var AmplifyUpSDK = class {
1327
1491
  this.componentViewObservers.forEach((obs) => obs.disconnect());
1328
1492
  this.componentViewObservers = [];
1329
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
+ }
1330
1531
  /**
1331
1532
  * Track a page view
1332
1533
  */
@@ -1348,7 +1549,7 @@ var AmplifyUpSDK = class {
1348
1549
  sessionId,
1349
1550
  trackingId: this.config?.trackingId,
1350
1551
  // Timestamp is included in event payload
1351
- ...properties
1552
+ ...mergeEventContext(properties || {}, this.attachedPageContext)
1352
1553
  };
1353
1554
  this.adapter.page(pageProperties);
1354
1555
  this.lastTrackedPath = url;
@@ -1372,7 +1573,7 @@ var AmplifyUpSDK = class {
1372
1573
  url: typeof window !== "undefined" ? window.location.href : void 0,
1373
1574
  path: properties?.path || (typeof window !== "undefined" ? window.location.pathname : void 0),
1374
1575
  // Timestamp is included in event payload
1375
- ...properties
1576
+ ...mergeEventContext(properties || {}, this.attachedPageContext)
1376
1577
  };
1377
1578
  if (!trackProperties.path && typeof window !== "undefined") {
1378
1579
  trackProperties.path = window.location.pathname;
@@ -1697,8 +1898,15 @@ Available Console Commands:
1697
1898
  });
1698
1899
  if (preview) {
1699
1900
  params.set("preview", "true");
1700
- if (typeof window !== "undefined" && isWorkingContentRequest(new URLSearchParams(window.location.search))) {
1701
- params.set("working", "true");
1901
+ if (typeof window !== "undefined") {
1902
+ const pageSearch = new URLSearchParams(window.location.search);
1903
+ if (isWorkingContentRequest(pageSearch)) {
1904
+ params.set("working", "true");
1905
+ }
1906
+ const zoneId = pageSearch.get("zoneId");
1907
+ const compositionId = pageSearch.get("compositionId");
1908
+ if (zoneId) params.set("zoneId", zoneId);
1909
+ if (compositionId) params.set("compositionId", compositionId);
1702
1910
  }
1703
1911
  }
1704
1912
  if (isOnOrchestratorOrigin) {
@@ -3086,6 +3294,7 @@ var verifyAWSConnection = () => {
3086
3294
  };
3087
3295
  var index_default = getSDK();
3088
3296
 
3297
+ exports.AMPLIFYUP_EDITOR_ROUTE = AMPLIFYUP_EDITOR_ROUTE;
3089
3298
  exports.ANON_COOKIE_NAME = ANON_COOKIE_NAME;
3090
3299
  exports.AmplifyUpSDK = AmplifyUpSDK;
3091
3300
  exports.DWELL_ACTIVITY_IDLE_MS = DWELL_ACTIVITY_IDLE_MS;
@@ -3114,6 +3323,7 @@ exports.getTrackingId = getTrackingId;
3114
3323
  exports.getUserId = getUserId2;
3115
3324
  exports.identify = identify;
3116
3325
  exports.init = init;
3326
+ exports.isAmplifyUpEditorRoute = isAmplifyUpEditorRoute;
3117
3327
  exports.isAmplifyUpTarget = isAmplifyUpTarget;
3118
3328
  exports.isComposerPreview = isComposerPreview;
3119
3329
  exports.isPreviewRequest = isPreviewRequest;