@amplifyup/sdk 0.3.1-uat.105.g9d5f4eb → 0.3.2-uat.107.gfe9868a
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 +15 -1
- package/dist/AmplifyRenderer.js.map +1 -1
- package/dist/AmplifyRenderer.mjs +15 -1
- package/dist/AmplifyRenderer.mjs.map +1 -1
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +12 -0
- package/dist/index.mjs.map +1 -1
- package/dist/react.js +52 -1
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +52 -1
- package/dist/react.mjs.map +1 -1
- package/dist/server.js +36 -22
- package/dist/server.js.map +1 -1
- package/dist/server.mjs +36 -22
- package/dist/server.mjs.map +1 -1
- package/package.json +1 -1
package/dist/AmplifyRenderer.js
CHANGED
|
@@ -405,6 +405,12 @@ function resolveAmplifyUpUrls(target) {
|
|
|
405
405
|
function isPreviewRequest(searchParams) {
|
|
406
406
|
return paramIsTrue(searchParams, "preview") || paramIsTrue(searchParams, "visualEditor");
|
|
407
407
|
}
|
|
408
|
+
var PREVIEW_ACCESS_REQUIRED = "preview_access_required";
|
|
409
|
+
function readPreviewToken(searchParams) {
|
|
410
|
+
if (searchParams instanceof URLSearchParams) return searchParams.get("previewToken");
|
|
411
|
+
const value = searchParams.previewToken;
|
|
412
|
+
return (Array.isArray(value) ? value[0] : value) || null;
|
|
413
|
+
}
|
|
408
414
|
function isWorkingContentRequest(searchParams) {
|
|
409
415
|
return paramIsTrue(searchParams, "working");
|
|
410
416
|
}
|
|
@@ -2114,6 +2120,8 @@ Available Console Commands:
|
|
|
2114
2120
|
if (compositionId) params.set("compositionId", compositionId);
|
|
2115
2121
|
const layoutId = pageSearch.get("layoutId");
|
|
2116
2122
|
if (layoutId) params.set("layoutId", layoutId);
|
|
2123
|
+
const previewToken = readPreviewToken(pageSearch);
|
|
2124
|
+
if (previewToken) params.set("previewToken", previewToken);
|
|
2117
2125
|
}
|
|
2118
2126
|
}
|
|
2119
2127
|
if (isOnOrchestratorOrigin) {
|
|
@@ -2158,6 +2166,10 @@ Available Console Commands:
|
|
|
2158
2166
|
if (response.status === 404) {
|
|
2159
2167
|
return null;
|
|
2160
2168
|
}
|
|
2169
|
+
if (response.status === 401) {
|
|
2170
|
+
const body = await response.json().catch(() => null);
|
|
2171
|
+
if (body?.error === PREVIEW_ACCESS_REQUIRED) throw new Error(PREVIEW_ACCESS_REQUIRED);
|
|
2172
|
+
}
|
|
2161
2173
|
throw new Error(`Failed to fetch page: ${response.statusText}`);
|
|
2162
2174
|
}
|
|
2163
2175
|
const contentType = response.headers.get("content-type") || "";
|
|
@@ -4036,7 +4048,9 @@ function AmplifyRendererInner(rendererProps) {
|
|
|
4036
4048
|
}
|
|
4037
4049
|
personalizationUrl = url.toString();
|
|
4038
4050
|
} else if (orchestratorUrl) {
|
|
4039
|
-
|
|
4051
|
+
const trackingId = sdk.getTrackingId();
|
|
4052
|
+
if (!trackingId) return;
|
|
4053
|
+
personalizationUrl = `${orchestratorUrl}/api/personalization/variant?trackingId=${encodeURIComponent(trackingId)}&instanceId=${encodeURIComponent(instanceId)}&layoutId=${encodeURIComponent(pageConfig.layoutId)}&slotId=${encodeURIComponent(slot.slotId)}&nodeId=${encodeURIComponent(node.id)}`;
|
|
4040
4054
|
} else {
|
|
4041
4055
|
return;
|
|
4042
4056
|
}
|