@amplifyup/sdk 0.1.3 → 0.1.4
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/AmplifyRenderer.js +25 -1
- package/dist/AmplifyRenderer.js.map +1 -1
- package/dist/AmplifyRenderer.mjs +25 -1
- package/dist/AmplifyRenderer.mjs.map +1 -1
- package/dist/index.js +25 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +25 -1
- package/dist/index.mjs.map +1 -1
- package/dist/react.js +25 -1
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +25 -1
- package/dist/react.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -276,6 +276,26 @@ function resolveAmplifyUpUrls(target) {
|
|
|
276
276
|
}
|
|
277
277
|
|
|
278
278
|
// src/index.ts
|
|
279
|
+
function readPreviewQueryOverrides() {
|
|
280
|
+
if (typeof window === "undefined") return {};
|
|
281
|
+
const params = new URLSearchParams(window.location.search);
|
|
282
|
+
if (params.get("preview") !== "true" && params.get("visualEditor") !== "true") {
|
|
283
|
+
return {};
|
|
284
|
+
}
|
|
285
|
+
const overrides = {};
|
|
286
|
+
const orchestratorFromQuery = params.get("orchestratorUrl");
|
|
287
|
+
if (orchestratorFromQuery) {
|
|
288
|
+
try {
|
|
289
|
+
overrides.orchestratorUrl = new URL(orchestratorFromQuery).origin.replace(/\/$/, "");
|
|
290
|
+
} catch {
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
const trackingFromQuery = params.get("trackingId");
|
|
294
|
+
if (trackingFromQuery) {
|
|
295
|
+
overrides.trackingId = trackingFromQuery;
|
|
296
|
+
}
|
|
297
|
+
return overrides;
|
|
298
|
+
}
|
|
279
299
|
var AmplifyUpSDK = class {
|
|
280
300
|
constructor(adapter) {
|
|
281
301
|
this.config = null;
|
|
@@ -401,8 +421,12 @@ var AmplifyUpSDK = class {
|
|
|
401
421
|
this.apiGatewayUrl = urls.apiGatewayUrl;
|
|
402
422
|
this.orchestratorUrl = urls.orchestratorUrl;
|
|
403
423
|
this.decisionApiUrl = urls.decisionApiUrl;
|
|
424
|
+
const previewOverrides = readPreviewQueryOverrides();
|
|
425
|
+
if (previewOverrides.orchestratorUrl) {
|
|
426
|
+
this.orchestratorUrl = previewOverrides.orchestratorUrl;
|
|
427
|
+
}
|
|
404
428
|
this.config = {
|
|
405
|
-
trackingId: config.trackingId,
|
|
429
|
+
trackingId: previewOverrides.trackingId || config.trackingId,
|
|
406
430
|
debug: config.debug ?? true,
|
|
407
431
|
// Enable debug by default
|
|
408
432
|
target: this.target,
|