@amplifyup/sdk 0.1.32 → 0.1.33

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/react.mjs CHANGED
@@ -323,12 +323,17 @@ function resolveAmplifyUpUrls(target) {
323
323
 
324
324
  // src/preview.ts
325
325
  function isPreviewRequest(searchParams) {
326
+ return paramIsTrue(searchParams, "preview") || paramIsTrue(searchParams, "visualEditor");
327
+ }
328
+ function isWorkingContentRequest(searchParams) {
329
+ return paramIsTrue(searchParams, "working");
330
+ }
331
+ function paramIsTrue(searchParams, key) {
326
332
  if (searchParams instanceof URLSearchParams) {
327
- return searchParams.get("preview") === "true" || searchParams.get("visualEditor") === "true";
333
+ return searchParams.get(key) === "true";
328
334
  }
329
- const preview = searchParams.preview;
330
- const visualEditor = searchParams.visualEditor;
331
- return preview === "true" || visualEditor === "true";
335
+ const value = searchParams[key];
336
+ return value === "true" || Array.isArray(value) && value[0] === "true";
332
337
  }
333
338
  function isComposerPreview() {
334
339
  if (typeof window === "undefined") return false;
@@ -1464,6 +1469,9 @@ Available Console Commands:
1464
1469
  });
1465
1470
  if (preview) {
1466
1471
  params.set("preview", "true");
1472
+ if (typeof window !== "undefined" && isWorkingContentRequest(new URLSearchParams(window.location.search))) {
1473
+ params.set("working", "true");
1474
+ }
1467
1475
  }
1468
1476
  if (isOnOrchestratorOrigin) {
1469
1477
  return `/api/layout/provider?${params.toString()}`;
@@ -3826,12 +3834,14 @@ async function fetchPageConfigServer(route, trackingId, preview = false, options
3826
3834
  });
3827
3835
  const { orchestratorUrl, edgeUrl } = resolveAmplifyUpUrls(target);
3828
3836
  const previewFlag = preview || (options?.searchParams ? isPreviewRequest(options.searchParams) : false);
3837
+ const workingFlag = options?.searchParams ? isWorkingContentRequest(options.searchParams) : false;
3829
3838
  const fetchOrchestratorPage = async (pageRoute, isPreview) => {
3830
3839
  const params = new URLSearchParams({
3831
3840
  route: pageRoute,
3832
3841
  trackingId
3833
3842
  });
3834
3843
  if (isPreview) params.set("preview", "true");
3844
+ if (workingFlag) params.set("working", "true");
3835
3845
  const url = `${orchestratorUrl}/api/layout/provider?${params.toString()}`;
3836
3846
  try {
3837
3847
  const res = await fetch(url, {
@@ -4014,6 +4024,6 @@ function useAmplifyUp() {
4014
4024
  return context;
4015
4025
  }
4016
4026
 
4017
- export { AmplifyPageContent, AmplifyRenderer, AmplifyUpProvider, ComponentContextProvider, Field, Image, RichText, Slot, fetchPageConfigServer, isComposerPreview, isPreviewRequest, useAmplifyUp, useComponentProps, useLiveComposerProps };
4027
+ export { AmplifyPageContent, AmplifyRenderer, AmplifyUpProvider, ComponentContextProvider, Field, Image, RichText, Slot, fetchPageConfigServer, isComposerPreview, isPreviewRequest, isWorkingContentRequest, useAmplifyUp, useComponentProps, useLiveComposerProps };
4018
4028
  //# sourceMappingURL=react.mjs.map
4019
4029
  //# sourceMappingURL=react.mjs.map