@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.mjs
CHANGED
|
@@ -272,6 +272,26 @@ function resolveAmplifyUpUrls(target) {
|
|
|
272
272
|
}
|
|
273
273
|
|
|
274
274
|
// src/index.ts
|
|
275
|
+
function readPreviewQueryOverrides() {
|
|
276
|
+
if (typeof window === "undefined") return {};
|
|
277
|
+
const params = new URLSearchParams(window.location.search);
|
|
278
|
+
if (params.get("preview") !== "true" && params.get("visualEditor") !== "true") {
|
|
279
|
+
return {};
|
|
280
|
+
}
|
|
281
|
+
const overrides = {};
|
|
282
|
+
const orchestratorFromQuery = params.get("orchestratorUrl");
|
|
283
|
+
if (orchestratorFromQuery) {
|
|
284
|
+
try {
|
|
285
|
+
overrides.orchestratorUrl = new URL(orchestratorFromQuery).origin.replace(/\/$/, "");
|
|
286
|
+
} catch {
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
const trackingFromQuery = params.get("trackingId");
|
|
290
|
+
if (trackingFromQuery) {
|
|
291
|
+
overrides.trackingId = trackingFromQuery;
|
|
292
|
+
}
|
|
293
|
+
return overrides;
|
|
294
|
+
}
|
|
275
295
|
var AmplifyUpSDK = class {
|
|
276
296
|
constructor(adapter) {
|
|
277
297
|
this.config = null;
|
|
@@ -397,8 +417,12 @@ var AmplifyUpSDK = class {
|
|
|
397
417
|
this.apiGatewayUrl = urls.apiGatewayUrl;
|
|
398
418
|
this.orchestratorUrl = urls.orchestratorUrl;
|
|
399
419
|
this.decisionApiUrl = urls.decisionApiUrl;
|
|
420
|
+
const previewOverrides = readPreviewQueryOverrides();
|
|
421
|
+
if (previewOverrides.orchestratorUrl) {
|
|
422
|
+
this.orchestratorUrl = previewOverrides.orchestratorUrl;
|
|
423
|
+
}
|
|
400
424
|
this.config = {
|
|
401
|
-
trackingId: config.trackingId,
|
|
425
|
+
trackingId: previewOverrides.trackingId || config.trackingId,
|
|
402
426
|
debug: config.debug ?? true,
|
|
403
427
|
// Enable debug by default
|
|
404
428
|
target: this.target,
|