@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/AmplifyRenderer.mjs
CHANGED
|
@@ -282,6 +282,26 @@ function resolveAmplifyUpUrls(target) {
|
|
|
282
282
|
}
|
|
283
283
|
|
|
284
284
|
// src/index.ts
|
|
285
|
+
function readPreviewQueryOverrides() {
|
|
286
|
+
if (typeof window === "undefined") return {};
|
|
287
|
+
const params = new URLSearchParams(window.location.search);
|
|
288
|
+
if (params.get("preview") !== "true" && params.get("visualEditor") !== "true") {
|
|
289
|
+
return {};
|
|
290
|
+
}
|
|
291
|
+
const overrides = {};
|
|
292
|
+
const orchestratorFromQuery = params.get("orchestratorUrl");
|
|
293
|
+
if (orchestratorFromQuery) {
|
|
294
|
+
try {
|
|
295
|
+
overrides.orchestratorUrl = new URL(orchestratorFromQuery).origin.replace(/\/$/, "");
|
|
296
|
+
} catch {
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
const trackingFromQuery = params.get("trackingId");
|
|
300
|
+
if (trackingFromQuery) {
|
|
301
|
+
overrides.trackingId = trackingFromQuery;
|
|
302
|
+
}
|
|
303
|
+
return overrides;
|
|
304
|
+
}
|
|
285
305
|
var AmplifyUpSDK = class {
|
|
286
306
|
constructor(adapter) {
|
|
287
307
|
this.config = null;
|
|
@@ -407,8 +427,12 @@ var AmplifyUpSDK = class {
|
|
|
407
427
|
this.apiGatewayUrl = urls.apiGatewayUrl;
|
|
408
428
|
this.orchestratorUrl = urls.orchestratorUrl;
|
|
409
429
|
this.decisionApiUrl = urls.decisionApiUrl;
|
|
430
|
+
const previewOverrides = readPreviewQueryOverrides();
|
|
431
|
+
if (previewOverrides.orchestratorUrl) {
|
|
432
|
+
this.orchestratorUrl = previewOverrides.orchestratorUrl;
|
|
433
|
+
}
|
|
410
434
|
this.config = {
|
|
411
|
-
trackingId: config.trackingId,
|
|
435
|
+
trackingId: previewOverrides.trackingId || config.trackingId,
|
|
412
436
|
debug: config.debug ?? true,
|
|
413
437
|
// Enable debug by default
|
|
414
438
|
target: this.target,
|