@riverbankcms/sdk 0.70.4 → 0.71.0

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.
@@ -18,6 +18,7 @@ export type SdkPreviewModeContent = {
18
18
  };
19
19
  export type SdkPreviewModeProps = {
20
20
  apiBaseUrl: string;
21
+ dashboardBaseUrl?: string | null;
21
22
  siteId: string;
22
23
  siteSlug: string;
23
24
  surfaceId?: SurfaceId;
@@ -1,2 +1,20 @@
1
+ import { type ReactNode } from "react";
2
+ import type { PreviewShellLayoutProps, PreviewShellProps, SdkPreviewModeProps } from "../../../../preview-next/src/client/index";
1
3
  export type { SdkPreviewModeContent, SdkPreviewModeProps, PreviewShellProps, PreviewShellLayoutProps, } from '../../../../preview-next/src/client/index';
2
- export { SdkPreviewMode, PreviewQueryProvider, createPreviewQueryClient, PreviewShell, PreviewShellLayout, PreviewLayoutProvider, usePreviewLayout, useOptionalPreviewLayout, } from './runtime';
4
+ type PreviewQueryProviderProps = Readonly<{
5
+ children: ReactNode;
6
+ }>;
7
+ type PreviewLayoutProviderProps = Readonly<{
8
+ headerNode: ReactNode;
9
+ bannerNode?: ReactNode;
10
+ footerNode: ReactNode;
11
+ children: ReactNode;
12
+ }>;
13
+ export declare function SdkPreviewMode(props: SdkPreviewModeProps): import("react/jsx-runtime").JSX.Element;
14
+ export declare function PreviewQueryProvider({ children }: PreviewQueryProviderProps): import("react/jsx-runtime").JSX.Element;
15
+ export declare function PreviewShell(props: PreviewShellProps): import("react/jsx-runtime").JSX.Element;
16
+ export declare function PreviewShellLayout(props: PreviewShellLayoutProps): import("react/jsx-runtime").JSX.Element;
17
+ export declare function PreviewLayoutProvider({ headerNode, bannerNode, footerNode, children, }: PreviewLayoutProviderProps): import("react/jsx-runtime").JSX.Element;
18
+ export declare function usePreviewLayout(): never;
19
+ export declare function useOptionalPreviewLayout(): never;
20
+ export declare function createPreviewQueryClient(): never;
@@ -8,4 +8,4 @@
8
8
  * 1. This constant
9
9
  * 2. The "version" field in package.json
10
10
  */
11
- export declare const SDK_VERSION = "0.70.4";
11
+ export declare const SDK_VERSION = "0.71.0";
@@ -54836,7 +54836,7 @@ var SimpleCache = class {
54836
54836
  };
54837
54837
 
54838
54838
  // src/version.ts
54839
- var SDK_VERSION = "0.70.4";
54839
+ var SDK_VERSION = "0.71.0";
54840
54840
 
54841
54841
  // src/client/error.ts
54842
54842
  var RiverbankApiError = class _RiverbankApiError extends Error {
@@ -84337,7 +84337,7 @@ var SimpleCache = class {
84337
84337
  };
84338
84338
 
84339
84339
  // src/version.ts
84340
- var SDK_VERSION = "0.70.4";
84340
+ var SDK_VERSION = "0.71.0";
84341
84341
 
84342
84342
  // src/client/error.ts
84343
84343
  var RiverbankApiError = class _RiverbankApiError extends Error {
@@ -1,14 +1,64 @@
1
1
  "use client";
2
- import {
3
- SdkPreviewMode,
4
- PreviewQueryProvider,
5
- createPreviewQueryClient,
6
- PreviewShell,
7
- PreviewShellLayout,
8
- PreviewLayoutProvider,
9
- usePreviewLayout,
10
- useOptionalPreviewLayout
11
- } from "./runtime.mjs";
2
+ import { jsx } from "react/jsx-runtime";
3
+ import { Suspense, lazy } from "react";
4
+ const LazySdkPreviewMode = lazy(async () => ({
5
+ default: (await import("./runtime.mjs")).SdkPreviewMode
6
+ }));
7
+ const LazyPreviewQueryProvider = lazy(async () => ({
8
+ default: (await import("./runtime.mjs")).PreviewQueryProvider
9
+ }));
10
+ const LazyPreviewShell = lazy(async () => ({
11
+ default: (await import("./runtime.mjs")).PreviewShell
12
+ }));
13
+ const LazyPreviewShellLayout = lazy(async () => ({
14
+ default: (await import("./runtime.mjs")).PreviewShellLayout
15
+ }));
16
+ const LazyPreviewLayoutProvider = lazy(async () => ({
17
+ default: (await import("./runtime.mjs")).PreviewLayoutProvider
18
+ }));
19
+ function SdkPreviewMode(props) {
20
+ return /* @__PURE__ */ jsx(Suspense, { fallback: null, children: /* @__PURE__ */ jsx(LazySdkPreviewMode, { ...props }) });
21
+ }
22
+ function PreviewQueryProvider({ children }) {
23
+ return /* @__PURE__ */ jsx(Suspense, { fallback: null, children: /* @__PURE__ */ jsx(LazyPreviewQueryProvider, { children }) });
24
+ }
25
+ function PreviewShell(props) {
26
+ return /* @__PURE__ */ jsx(Suspense, { fallback: null, children: /* @__PURE__ */ jsx(LazyPreviewShell, { ...props }) });
27
+ }
28
+ function PreviewShellLayout(props) {
29
+ return /* @__PURE__ */ jsx(Suspense, { fallback: null, children: /* @__PURE__ */ jsx(LazyPreviewShellLayout, { ...props }) });
30
+ }
31
+ function PreviewLayoutProvider({
32
+ headerNode,
33
+ bannerNode = null,
34
+ footerNode,
35
+ children
36
+ }) {
37
+ return /* @__PURE__ */ jsx(Suspense, { fallback: null, children: /* @__PURE__ */ jsx(
38
+ LazyPreviewLayoutProvider,
39
+ {
40
+ headerNode,
41
+ bannerNode,
42
+ footerNode,
43
+ children
44
+ }
45
+ ) });
46
+ }
47
+ function usePreviewLayout() {
48
+ throw new Error(
49
+ "usePreviewLayout is available from @riverbankcms/sdk/preview-next/client/runtime."
50
+ );
51
+ }
52
+ function useOptionalPreviewLayout() {
53
+ throw new Error(
54
+ "useOptionalPreviewLayout is available from @riverbankcms/sdk/preview-next/client/runtime."
55
+ );
56
+ }
57
+ function createPreviewQueryClient() {
58
+ throw new Error(
59
+ "createPreviewQueryClient is available from @riverbankcms/sdk/preview-next/client/runtime."
60
+ );
61
+ }
12
62
  export {
13
63
  PreviewLayoutProvider,
14
64
  PreviewQueryProvider,
@@ -210691,12 +210691,17 @@ function PreviewAuthBanner({
210691
210691
  launchReadiness.pendingRequiredCount
210692
210692
  ]);
210693
210693
  const handleReauthenticate = useCallback(() => {
210694
- if (typeof window === "undefined") return;
210695
- const restartUrl = new URL("/api/preview/restart", window.location.origin);
210696
- restartUrl.searchParams.set("return", window.location.href);
210697
- if (siteSlug) restartUrl.searchParams.set("siteSlug", siteSlug);
210698
- window.location.href = restartUrl.toString();
210699
- }, [siteSlug]);
210694
+ if (!dashboardBaseUrl || typeof window === "undefined") return;
210695
+ const currentUrl = window.location.href;
210696
+ window.location.assign(
210697
+ buildPreviewAuthEntryUrl({
210698
+ dashboardBaseUrl,
210699
+ returnUrl: currentUrl,
210700
+ fallbackUrl: currentUrl,
210701
+ siteSlug
210702
+ })
210703
+ );
210704
+ }, [dashboardBaseUrl, siteSlug]);
210700
210705
  const dashboardContinueUrl = useMemo(() => {
210701
210706
  if (!dashboardBaseUrl) return null;
210702
210707
  if (authMode === "onboardingGrant") {
@@ -210751,6 +210756,7 @@ function PreviewAuthBanner({
210751
210756
  type: "button",
210752
210757
  size: "sm",
210753
210758
  variant: "onDark",
210759
+ disabled: !dashboardBaseUrl,
210754
210760
  onClick: handleReauthenticate,
210755
210761
  children: "Reauthenticate"
210756
210762
  }
@@ -213218,6 +213224,7 @@ init_src2();
213218
213224
  function SdkPreviewMode(props2) {
213219
213225
  const {
213220
213226
  apiBaseUrl,
213227
+ dashboardBaseUrl,
213221
213228
  siteId,
213222
213229
  siteSlug,
213223
213230
  previewSession,
@@ -213226,6 +213233,7 @@ function SdkPreviewMode(props2) {
213226
213233
  blockOverrides,
213227
213234
  useThemeScope = true
213228
213235
  } = props2;
213236
+ const resolvedDashboardBaseUrl = dashboardBaseUrl ?? deriveDashboardBaseUrlFromApiBaseUrl(apiBaseUrl);
213229
213237
  const surfaceId = props2.surfaceId ?? resolvePreviewSurfaceId() ?? DEFAULT_SURFACE_ID;
213230
213238
  const theme = content.theme;
213231
213239
  const page = content.page;
@@ -213289,6 +213297,7 @@ function SdkPreviewMode(props2) {
213289
213297
  editableId: content.pageId,
213290
213298
  previewSession,
213291
213299
  previewToken,
213300
+ dashboardBaseUrl: resolvedDashboardBaseUrl,
213292
213301
  surfaceId,
213293
213302
  theme,
213294
213303
  pageId: content.pageId,
@@ -213321,6 +213330,13 @@ function SdkPreviewMode(props2) {
213321
213330
  }
213322
213331
  );
213323
213332
  }
213333
+ function deriveDashboardBaseUrlFromApiBaseUrl(apiBaseUrl) {
213334
+ try {
213335
+ return new URL(apiBaseUrl).origin;
213336
+ } catch {
213337
+ return null;
213338
+ }
213339
+ }
213324
213340
  /*! Bundled license information:
213325
213341
 
213326
213342
  lucide-react/dist/esm/shared/src/utils/mergeClasses.js:
@@ -6797,7 +6797,7 @@ var SimpleCache = class {
6797
6797
  };
6798
6798
 
6799
6799
  // src/version.ts
6800
- var SDK_VERSION = "0.70.4";
6800
+ var SDK_VERSION = "0.71.0";
6801
6801
 
6802
6802
  // src/client/error.ts
6803
6803
  var RiverbankApiError = class _RiverbankApiError extends Error {
@@ -58191,7 +58191,7 @@ var SimpleCache = class {
58191
58191
  };
58192
58192
 
58193
58193
  // src/version.ts
58194
- var SDK_VERSION = "0.70.4";
58194
+ var SDK_VERSION = "0.71.0";
58195
58195
 
58196
58196
  // src/client/error.ts
58197
58197
  var RiverbankApiError = class _RiverbankApiError extends Error {
@@ -4,7 +4,7 @@ import * as path from "path";
4
4
  import * as crypto from "crypto";
5
5
 
6
6
  // src/version.ts
7
- var SDK_VERSION = "0.70.4";
7
+ var SDK_VERSION = "0.71.0";
8
8
 
9
9
  // src/constants.ts
10
10
  var PREBUILD_PAGE_SIZE = 50;
@@ -6830,7 +6830,7 @@ var SimpleCache = class {
6830
6830
  };
6831
6831
 
6832
6832
  // src/version.ts
6833
- var SDK_VERSION = "0.70.4";
6833
+ var SDK_VERSION = "0.71.0";
6834
6834
 
6835
6835
  // src/client/error.ts
6836
6836
  var RiverbankApiError = class _RiverbankApiError extends Error {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riverbankcms/sdk",
3
- "version": "0.70.4",
3
+ "version": "0.71.0",
4
4
  "description": "Riverbank CMS SDK for headless content consumption",
5
5
  "main": "./dist/server/index.mjs",
6
6
  "module": "./dist/server/index.mjs",
@@ -206,6 +206,10 @@
206
206
  "types": "./dist/_dts/sdk/src/preview-next/client/index.d.ts",
207
207
  "import": "./dist/preview-next/client/index.mjs"
208
208
  },
209
+ "./preview-next/client/runtime": {
210
+ "types": "./dist/_dts/sdk/src/preview-next/client/runtime.d.ts",
211
+ "import": "./dist/preview-next/client/runtime.mjs"
212
+ },
209
213
  "./preview-next/chrome.css": "./dist/preview-next/chrome.css",
210
214
  "./preview-next/tailwind-sources.css": "./dist/preview-next/tailwind-sources.css",
211
215
  "./preview-next/styles.css": "./dist/preview-next/styles.css"