@amplifyup/sdk 0.1.68 → 0.1.70

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
@@ -206,11 +206,8 @@ declare class AmplifyUpSDK {
206
206
  private pageEngagementState;
207
207
  constructor(adapter?: CDPAdapter);
208
208
  /**
209
- * Detect if we're running in visual editor mode
210
- * Returns true if:
211
- * 1. Preview mode flag is set by proxy
212
- * 2. We're in an iframe AND parent is from orchestrator domain
213
- * 3. OR visualEditor/preview query parameter is present
209
+ * Detect if we're running in visual editor mode.
210
+ * Single source of truth: isComposerPreview() (flag, query, Composer referrer).
214
211
  */
215
212
  private detectVisualEditorMode;
216
213
  /**
package/dist/index.d.ts CHANGED
@@ -206,11 +206,8 @@ declare class AmplifyUpSDK {
206
206
  private pageEngagementState;
207
207
  constructor(adapter?: CDPAdapter);
208
208
  /**
209
- * Detect if we're running in visual editor mode
210
- * Returns true if:
211
- * 1. Preview mode flag is set by proxy
212
- * 2. We're in an iframe AND parent is from orchestrator domain
213
- * 3. OR visualEditor/preview query parameter is present
209
+ * Detect if we're running in visual editor mode.
210
+ * Single source of truth: isComposerPreview() (flag, query, Composer referrer).
214
211
  */
215
212
  private detectVisualEditorMode;
216
213
  /**
package/dist/index.js CHANGED
@@ -1340,33 +1340,11 @@ var AmplifyUpSDK = class {
1340
1340
  }
1341
1341
  }
1342
1342
  /**
1343
- * Detect if we're running in visual editor mode
1344
- * Returns true if:
1345
- * 1. Preview mode flag is set by proxy
1346
- * 2. We're in an iframe AND parent is from orchestrator domain
1347
- * 3. OR visualEditor/preview query parameter is present
1343
+ * Detect if we're running in visual editor mode.
1344
+ * Single source of truth: isComposerPreview() (flag, query, Composer referrer).
1348
1345
  */
1349
1346
  detectVisualEditorMode() {
1350
- if (typeof window === "undefined") return false;
1351
- if (window.__AMPLIFYUP_PREVIEW_MODE__ === true) {
1352
- return true;
1353
- }
1354
- const urlParams = new URLSearchParams(window.location.search);
1355
- if (urlParams.get("visualEditor") === "true" || urlParams.get("preview") === "true") {
1356
- return true;
1357
- }
1358
- const inIframe = window.self !== window.top;
1359
- if (!inIframe) return false;
1360
- try {
1361
- if (document.referrer) {
1362
- const referrerUrl = new URL(document.referrer);
1363
- if (referrerUrl.hostname === "localhost" && referrerUrl.port === "5001" || referrerUrl.pathname.includes("/dashboard/composer") || referrerUrl.pathname.includes("/dashboard/routes/")) {
1364
- return true;
1365
- }
1366
- }
1367
- } catch (e) {
1368
- }
1369
- return false;
1347
+ return isComposerPreview();
1370
1348
  }
1371
1349
  /**
1372
1350
  * Check if we're in preview/composer mode (should disable tracking)