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