@cmssy/next 0.2.6 → 0.3.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.
package/README.md CHANGED
@@ -54,10 +54,42 @@ import { cmssyCspHeaders, applyCmssyCsp } from "@cmssy/next";
54
54
 
55
55
  Helpers to frame the page inside the cmssy editor only in edit mode.
56
56
 
57
+ ## Localized navigation (path prefix)
58
+
59
+ The active locale lives in the URL path prefix (`/en/about`; the default locale
60
+ stays bare). `createCmssyPage` resolves it and exposes it via `CmssyLocaleProvider`.
61
+ For the locale to survive navigation, internal links must carry the prefix - use
62
+ `CmssyLink` instead of `next/link` / `<a>`:
63
+
64
+ ```tsx
65
+ // any block component
66
+ import { CmssyLink } from "@cmssy/next/client";
67
+
68
+ <CmssyLink href="/about">About</CmssyLink>; // → /en/about while EN is active
69
+ ```
70
+
71
+ Add middleware so the root layout (which can't read the path) resolves the right
72
+ locale via `getCmssyLocale`:
73
+
74
+ ```ts
75
+ // middleware.ts
76
+ import { createCmssyLocaleMiddleware } from "@cmssy/next";
77
+ import { cmssy } from "@/cmssy/config";
78
+
79
+ export const middleware = createCmssyLocaleMiddleware(cmssy);
80
+ export const config = { matcher: ["/((?!_next|api|.*\\..*).*)"] };
81
+ ```
82
+
83
+ Language switcher and raw markup helpers live in `@cmssy/react`:
84
+ `buildLocaleSwitchHref(target, pathname, locale)`, `localizeHref(href, locale)`,
85
+ `localizeHtmlLinks(html, locale)`.
86
+
57
87
  ## Exports
58
88
 
59
89
  `createCmssyPage`, `createDraftRoute`, `cmssyCspHeaders` / `applyCmssyCsp`,
60
- `isCmssyEditRequest` / `isCmssyEditMode`, and the `CmssyNextConfig` type.
90
+ `isCmssyEditRequest` / `isCmssyEditMode`, `createCmssyLocaleMiddleware` /
91
+ `resolveLocaleFromPathname`, the `CmssyNextConfig` type, and from
92
+ `@cmssy/next/client`: `CmssyLink`, `CmssyLocaleProvider`, `useCmssyLocale`.
61
93
 
62
94
  ## License
63
95
 
@@ -0,0 +1,29 @@
1
+ "use client";
2
+ 'use strict';
3
+
4
+ var Link = require('next/link');
5
+ var react = require('@cmssy/react');
6
+ var client = require('@cmssy/react/client');
7
+ var jsxRuntime = require('react/jsx-runtime');
8
+
9
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
10
+
11
+ var Link__default = /*#__PURE__*/_interopDefault(Link);
12
+
13
+ // src/cmssy-link.tsx
14
+ function CmssyLink({ href, locale, ...rest }) {
15
+ const fromContext = client.useCmssyLocale();
16
+ const active = locale ?? fromContext;
17
+ const resolved = active ? react.localizeHref(href, active) : href;
18
+ return /* @__PURE__ */ jsxRuntime.jsx(Link__default.default, { href: resolved, ...rest });
19
+ }
20
+
21
+ Object.defineProperty(exports, "CmssyLocaleProvider", {
22
+ enumerable: true,
23
+ get: function () { return client.CmssyLocaleProvider; }
24
+ });
25
+ Object.defineProperty(exports, "useCmssyLocale", {
26
+ enumerable: true,
27
+ get: function () { return client.useCmssyLocale; }
28
+ });
29
+ exports.CmssyLink = CmssyLink;
@@ -0,0 +1,19 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import Link from 'next/link';
3
+ import { ComponentProps } from 'react';
4
+ import { CmssyLocaleContext } from '@cmssy/react';
5
+ export { CmssyLocaleProvider, CmssyLocaleProviderProps, useCmssyLocale } from '@cmssy/react/client';
6
+
7
+ interface CmssyLinkProps extends Omit<ComponentProps<typeof Link>, "href" | "locale"> {
8
+ href: string;
9
+ /** Override the active locale (defaults to the nearest CmssyLocaleProvider). */
10
+ locale?: CmssyLocaleContext;
11
+ }
12
+ /**
13
+ * `next/link` that prefixes internal hrefs with the active locale, so navigation
14
+ * preserves the language. Reads the locale from the nearest
15
+ * `CmssyLocaleProvider`; falls back to the raw href when none is mounted.
16
+ */
17
+ declare function CmssyLink({ href, locale, ...rest }: CmssyLinkProps): react_jsx_runtime.JSX.Element;
18
+
19
+ export { CmssyLink, type CmssyLinkProps };
@@ -0,0 +1,19 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import Link from 'next/link';
3
+ import { ComponentProps } from 'react';
4
+ import { CmssyLocaleContext } from '@cmssy/react';
5
+ export { CmssyLocaleProvider, CmssyLocaleProviderProps, useCmssyLocale } from '@cmssy/react/client';
6
+
7
+ interface CmssyLinkProps extends Omit<ComponentProps<typeof Link>, "href" | "locale"> {
8
+ href: string;
9
+ /** Override the active locale (defaults to the nearest CmssyLocaleProvider). */
10
+ locale?: CmssyLocaleContext;
11
+ }
12
+ /**
13
+ * `next/link` that prefixes internal hrefs with the active locale, so navigation
14
+ * preserves the language. Reads the locale from the nearest
15
+ * `CmssyLocaleProvider`; falls back to the raw href when none is mounted.
16
+ */
17
+ declare function CmssyLink({ href, locale, ...rest }: CmssyLinkProps): react_jsx_runtime.JSX.Element;
18
+
19
+ export { CmssyLink, type CmssyLinkProps };
package/dist/client.js ADDED
@@ -0,0 +1,16 @@
1
+ "use client";
2
+ import Link from 'next/link';
3
+ import { localizeHref } from '@cmssy/react';
4
+ import { useCmssyLocale } from '@cmssy/react/client';
5
+ export { CmssyLocaleProvider, useCmssyLocale } from '@cmssy/react/client';
6
+ import { jsx } from 'react/jsx-runtime';
7
+
8
+ // src/cmssy-link.tsx
9
+ function CmssyLink({ href, locale, ...rest }) {
10
+ const fromContext = useCmssyLocale();
11
+ const active = locale ?? fromContext;
12
+ const resolved = active ? localizeHref(href, active) : href;
13
+ return /* @__PURE__ */ jsx(Link, { href: resolved, ...rest });
14
+ }
15
+
16
+ export { CmssyLink };
package/dist/index.cjs CHANGED
@@ -3,10 +3,11 @@
3
3
  var headers = require('next/headers');
4
4
  var navigation = require('next/navigation');
5
5
  var react = require('@cmssy/react');
6
+ var client = require('@cmssy/react/client');
6
7
  var jsxRuntime = require('react/jsx-runtime');
7
8
  var crypto$1 = require('crypto');
8
- var jose = require('jose');
9
9
  var server = require('next/server');
10
+ var jose = require('jose');
10
11
 
11
12
  // src/create-cmssy-page.tsx
12
13
 
@@ -111,9 +112,14 @@ function createCmssyPage(config, blocks, options) {
111
112
  defaultLocale
112
113
  );
113
114
  const forms = Object.keys(resolvedForms).length > 0 ? resolvedForms : void 0;
115
+ const localeContext = {
116
+ current: locale,
117
+ default: defaultLocale,
118
+ enabled: enabledLocales && enabledLocales.length > 0 ? enabledLocales : Array.from(/* @__PURE__ */ new Set([defaultLocale, locale]))
119
+ };
114
120
  if (editMode && Editor) {
115
121
  const bridgeOrigin = resolveBridgeOrigin(config.editorOrigin);
116
- return /* @__PURE__ */ jsxRuntime.jsx(
122
+ return /* @__PURE__ */ jsxRuntime.jsx(client.CmssyLocaleProvider, { value: localeContext, children: /* @__PURE__ */ jsxRuntime.jsx(
117
123
  Editor,
118
124
  {
119
125
  page,
@@ -123,9 +129,9 @@ function createCmssyPage(config, blocks, options) {
123
129
  edit: { editorOrigin: bridgeOrigin },
124
130
  forms
125
131
  }
126
- );
132
+ ) });
127
133
  }
128
- return /* @__PURE__ */ jsxRuntime.jsx(
134
+ return /* @__PURE__ */ jsxRuntime.jsx(client.CmssyLocaleProvider, { value: localeContext, children: /* @__PURE__ */ jsxRuntime.jsx(
129
135
  react.CmssyServerPage,
130
136
  {
131
137
  page,
@@ -135,7 +141,7 @@ function createCmssyPage(config, blocks, options) {
135
141
  enabledLocales,
136
142
  forms
137
143
  }
138
- );
144
+ ) });
139
145
  };
140
146
  }
141
147
  function resolveBridgeOrigin(editorOrigin) {
@@ -228,6 +234,30 @@ async function getCmssyLocale(config) {
228
234
  const { defaultLocale } = await react.resolveSiteLocales(config);
229
235
  return defaultLocale;
230
236
  }
237
+ async function resolveLocaleFromPathname(config, pathname) {
238
+ const segments = pathname.split("/").filter(Boolean);
239
+ const hasStaticLocales = !!config.enabledLocales?.length;
240
+ const fetched = config.defaultLocale && hasStaticLocales ? null : await react.resolveSiteLocales({
241
+ apiUrl: config.apiUrl,
242
+ workspaceSlug: config.workspaceSlug
243
+ });
244
+ const siteLocales = {
245
+ defaultLocale: config.defaultLocale ?? fetched.defaultLocale,
246
+ locales: hasStaticLocales ? config.enabledLocales : fetched.locales
247
+ };
248
+ return react.splitLocaleFromPath(segments, siteLocales).locale;
249
+ }
250
+ function createCmssyLocaleMiddleware(config) {
251
+ return async function cmssyLocaleMiddleware(request2) {
252
+ const locale = await resolveLocaleFromPathname(
253
+ config,
254
+ request2.nextUrl.pathname
255
+ );
256
+ const headers3 = new Headers(request2.headers);
257
+ headers3.set(CMSSY_LOCALE_HEADER, locale);
258
+ return server.NextResponse.next({ request: { headers: headers3 } });
259
+ };
260
+ }
231
261
  var CMSSY_SESSION_COOKIE = "cmssy_session";
232
262
  var SESSION_MAX_AGE_SECONDS = 30 * 24 * 60 * 60;
233
263
  var MIN_SESSION_SECRET_LENGTH = 32;
@@ -1312,6 +1342,7 @@ exports.cmssyCspHeaders = cmssyCspHeaders;
1312
1342
  exports.createCmssyAuthMiddleware = createCmssyAuthMiddleware;
1313
1343
  exports.createCmssyAuthRoute = createCmssyAuthRoute;
1314
1344
  exports.createCmssyCartRoute = createCmssyCartRoute;
1345
+ exports.createCmssyLocaleMiddleware = createCmssyLocaleMiddleware;
1315
1346
  exports.createCmssyOrdersRoute = createCmssyOrdersRoute;
1316
1347
  exports.createCmssyPage = createCmssyPage;
1317
1348
  exports.createDraftRoute = createDraftRoute;
@@ -1325,6 +1356,7 @@ exports.isCmssyEditMode = isCmssyEditMode;
1325
1356
  exports.isCmssyEditRequest = isCmssyEditRequest;
1326
1357
  exports.localeForPathname = localeForPathname;
1327
1358
  exports.openSession = openSession;
1359
+ exports.resolveLocaleFromPathname = resolveLocaleFromPathname;
1328
1360
  exports.sealSession = sealSession;
1329
1361
  exports.sessionCookieOptions = sessionCookieOptions;
1330
1362
  exports.splitCmssyLocale = splitCmssyLocale;
package/dist/index.d.cts CHANGED
@@ -82,6 +82,19 @@ declare function splitCmssyLocale(config: CmssyClientConfig, path: string[] | un
82
82
  }>;
83
83
  declare function getCmssyLocale(config: CmssyClientConfig): Promise<string>;
84
84
 
85
+ /**
86
+ * Resolves the active locale from a pathname's leading segment. Uses the
87
+ * config's static `defaultLocale` + `enabledLocales` when both are set (no
88
+ * network); otherwise fetches the workspace locales (cached).
89
+ */
90
+ declare function resolveLocaleFromPathname(config: CmssyNextConfig, pathname: string): Promise<string>;
91
+ /**
92
+ * Middleware that derives the locale from the URL path prefix and forwards it as
93
+ * the `x-cmssy-locale` request header, so server components that can't read the
94
+ * path (root layout) resolve the right locale via `getCmssyLocale`.
95
+ */
96
+ declare function createCmssyLocaleMiddleware(config: CmssyNextConfig): (request: NextRequest) => Promise<NextResponse>;
97
+
85
98
  declare const CMSSY_SESSION_COOKIE = "cmssy_session";
86
99
  declare const SESSION_MAX_AGE_SECONDS: number;
87
100
  interface CmssySessionUser {
@@ -222,4 +235,4 @@ declare class CmssyWebhookError extends Error {
222
235
  */
223
236
  declare function verifyCmssyWebhook(options: VerifyCmssyWebhookOptions): CmssyWebhookEvent;
224
237
 
225
- export { CMSSY_CART_COOKIE, CMSSY_EDIT_HEADER, CMSSY_LOCALE_HEADER, CMSSY_SESSION_COOKIE, type CmssyAuthConfig, type CmssyAuthMiddleware, type CmssyAuthRouteHandlers, type CmssyCartRouteHandlers, type CmssyCspOptions, type CmssyDraftRouteConfig, type CmssyEditorProps, type CmssyNextConfig, type CmssyOrdersRouteHandlers, type CmssySessionPayload, type CmssySessionUser, CmssyWebhookError, type CmssyWebhookEvent, type CmssyWebhookOrder, type CreateCmssyPageOptions, type FetchProductOptions, type FetchProductsOptions, type MyOrdersResult, SESSION_MAX_AGE_SECONDS, type SessionCookieOptions, type VerifyCmssyWebhookOptions, applyCmssyCsp, assertAuthConfig, cmssyCspHeaders, createCmssyAuthMiddleware, createCmssyAuthRoute, createCmssyCartRoute, createCmssyOrdersRoute, createCmssyPage, createDraftRoute, fetchProduct, fetchProducts, getCmssyAccessToken, getCmssyLocale, getCmssyUser, isAccessExpired, isCmssyEditMode, isCmssyEditRequest, localeForPathname, openSession, sealSession, sessionCookieOptions, splitCmssyLocale, verifyCmssyWebhook };
238
+ export { CMSSY_CART_COOKIE, CMSSY_EDIT_HEADER, CMSSY_LOCALE_HEADER, CMSSY_SESSION_COOKIE, type CmssyAuthConfig, type CmssyAuthMiddleware, type CmssyAuthRouteHandlers, type CmssyCartRouteHandlers, type CmssyCspOptions, type CmssyDraftRouteConfig, type CmssyEditorProps, type CmssyNextConfig, type CmssyOrdersRouteHandlers, type CmssySessionPayload, type CmssySessionUser, CmssyWebhookError, type CmssyWebhookEvent, type CmssyWebhookOrder, type CreateCmssyPageOptions, type FetchProductOptions, type FetchProductsOptions, type MyOrdersResult, SESSION_MAX_AGE_SECONDS, type SessionCookieOptions, type VerifyCmssyWebhookOptions, applyCmssyCsp, assertAuthConfig, cmssyCspHeaders, createCmssyAuthMiddleware, createCmssyAuthRoute, createCmssyCartRoute, createCmssyLocaleMiddleware, createCmssyOrdersRoute, createCmssyPage, createDraftRoute, fetchProduct, fetchProducts, getCmssyAccessToken, getCmssyLocale, getCmssyUser, isAccessExpired, isCmssyEditMode, isCmssyEditRequest, localeForPathname, openSession, resolveLocaleFromPathname, sealSession, sessionCookieOptions, splitCmssyLocale, verifyCmssyWebhook };
package/dist/index.d.ts CHANGED
@@ -82,6 +82,19 @@ declare function splitCmssyLocale(config: CmssyClientConfig, path: string[] | un
82
82
  }>;
83
83
  declare function getCmssyLocale(config: CmssyClientConfig): Promise<string>;
84
84
 
85
+ /**
86
+ * Resolves the active locale from a pathname's leading segment. Uses the
87
+ * config's static `defaultLocale` + `enabledLocales` when both are set (no
88
+ * network); otherwise fetches the workspace locales (cached).
89
+ */
90
+ declare function resolveLocaleFromPathname(config: CmssyNextConfig, pathname: string): Promise<string>;
91
+ /**
92
+ * Middleware that derives the locale from the URL path prefix and forwards it as
93
+ * the `x-cmssy-locale` request header, so server components that can't read the
94
+ * path (root layout) resolve the right locale via `getCmssyLocale`.
95
+ */
96
+ declare function createCmssyLocaleMiddleware(config: CmssyNextConfig): (request: NextRequest) => Promise<NextResponse>;
97
+
85
98
  declare const CMSSY_SESSION_COOKIE = "cmssy_session";
86
99
  declare const SESSION_MAX_AGE_SECONDS: number;
87
100
  interface CmssySessionUser {
@@ -222,4 +235,4 @@ declare class CmssyWebhookError extends Error {
222
235
  */
223
236
  declare function verifyCmssyWebhook(options: VerifyCmssyWebhookOptions): CmssyWebhookEvent;
224
237
 
225
- export { CMSSY_CART_COOKIE, CMSSY_EDIT_HEADER, CMSSY_LOCALE_HEADER, CMSSY_SESSION_COOKIE, type CmssyAuthConfig, type CmssyAuthMiddleware, type CmssyAuthRouteHandlers, type CmssyCartRouteHandlers, type CmssyCspOptions, type CmssyDraftRouteConfig, type CmssyEditorProps, type CmssyNextConfig, type CmssyOrdersRouteHandlers, type CmssySessionPayload, type CmssySessionUser, CmssyWebhookError, type CmssyWebhookEvent, type CmssyWebhookOrder, type CreateCmssyPageOptions, type FetchProductOptions, type FetchProductsOptions, type MyOrdersResult, SESSION_MAX_AGE_SECONDS, type SessionCookieOptions, type VerifyCmssyWebhookOptions, applyCmssyCsp, assertAuthConfig, cmssyCspHeaders, createCmssyAuthMiddleware, createCmssyAuthRoute, createCmssyCartRoute, createCmssyOrdersRoute, createCmssyPage, createDraftRoute, fetchProduct, fetchProducts, getCmssyAccessToken, getCmssyLocale, getCmssyUser, isAccessExpired, isCmssyEditMode, isCmssyEditRequest, localeForPathname, openSession, sealSession, sessionCookieOptions, splitCmssyLocale, verifyCmssyWebhook };
238
+ export { CMSSY_CART_COOKIE, CMSSY_EDIT_HEADER, CMSSY_LOCALE_HEADER, CMSSY_SESSION_COOKIE, type CmssyAuthConfig, type CmssyAuthMiddleware, type CmssyAuthRouteHandlers, type CmssyCartRouteHandlers, type CmssyCspOptions, type CmssyDraftRouteConfig, type CmssyEditorProps, type CmssyNextConfig, type CmssyOrdersRouteHandlers, type CmssySessionPayload, type CmssySessionUser, CmssyWebhookError, type CmssyWebhookEvent, type CmssyWebhookOrder, type CreateCmssyPageOptions, type FetchProductOptions, type FetchProductsOptions, type MyOrdersResult, SESSION_MAX_AGE_SECONDS, type SessionCookieOptions, type VerifyCmssyWebhookOptions, applyCmssyCsp, assertAuthConfig, cmssyCspHeaders, createCmssyAuthMiddleware, createCmssyAuthRoute, createCmssyCartRoute, createCmssyLocaleMiddleware, createCmssyOrdersRoute, createCmssyPage, createDraftRoute, fetchProduct, fetchProducts, getCmssyAccessToken, getCmssyLocale, getCmssyUser, isAccessExpired, isCmssyEditMode, isCmssyEditRequest, localeForPathname, openSession, resolveLocaleFromPathname, sealSession, sessionCookieOptions, splitCmssyLocale, verifyCmssyWebhook };
package/dist/index.js CHANGED
@@ -1,10 +1,11 @@
1
1
  import { draftMode, headers, cookies } from 'next/headers';
2
2
  import { notFound, redirect } from 'next/navigation';
3
3
  import { resolveSiteLocales, splitLocaleFromPath, fetchPage, resolveForms, CmssyServerPage, resolveWorkspaceId, graphqlRequest } from '@cmssy/react';
4
+ import { CmssyLocaleProvider } from '@cmssy/react/client';
4
5
  import { jsx } from 'react/jsx-runtime';
5
6
  import { createHmac, createHash, timingSafeEqual } from 'crypto';
6
- import { EncryptJWT, jwtDecrypt } from 'jose';
7
7
  import { NextResponse } from 'next/server';
8
+ import { EncryptJWT, jwtDecrypt } from 'jose';
8
9
 
9
10
  // src/create-cmssy-page.tsx
10
11
 
@@ -109,9 +110,14 @@ function createCmssyPage(config, blocks, options) {
109
110
  defaultLocale
110
111
  );
111
112
  const forms = Object.keys(resolvedForms).length > 0 ? resolvedForms : void 0;
113
+ const localeContext = {
114
+ current: locale,
115
+ default: defaultLocale,
116
+ enabled: enabledLocales && enabledLocales.length > 0 ? enabledLocales : Array.from(/* @__PURE__ */ new Set([defaultLocale, locale]))
117
+ };
112
118
  if (editMode && Editor) {
113
119
  const bridgeOrigin = resolveBridgeOrigin(config.editorOrigin);
114
- return /* @__PURE__ */ jsx(
120
+ return /* @__PURE__ */ jsx(CmssyLocaleProvider, { value: localeContext, children: /* @__PURE__ */ jsx(
115
121
  Editor,
116
122
  {
117
123
  page,
@@ -121,9 +127,9 @@ function createCmssyPage(config, blocks, options) {
121
127
  edit: { editorOrigin: bridgeOrigin },
122
128
  forms
123
129
  }
124
- );
130
+ ) });
125
131
  }
126
- return /* @__PURE__ */ jsx(
132
+ return /* @__PURE__ */ jsx(CmssyLocaleProvider, { value: localeContext, children: /* @__PURE__ */ jsx(
127
133
  CmssyServerPage,
128
134
  {
129
135
  page,
@@ -133,7 +139,7 @@ function createCmssyPage(config, blocks, options) {
133
139
  enabledLocales,
134
140
  forms
135
141
  }
136
- );
142
+ ) });
137
143
  };
138
144
  }
139
145
  function resolveBridgeOrigin(editorOrigin) {
@@ -226,6 +232,30 @@ async function getCmssyLocale(config) {
226
232
  const { defaultLocale } = await resolveSiteLocales(config);
227
233
  return defaultLocale;
228
234
  }
235
+ async function resolveLocaleFromPathname(config, pathname) {
236
+ const segments = pathname.split("/").filter(Boolean);
237
+ const hasStaticLocales = !!config.enabledLocales?.length;
238
+ const fetched = config.defaultLocale && hasStaticLocales ? null : await resolveSiteLocales({
239
+ apiUrl: config.apiUrl,
240
+ workspaceSlug: config.workspaceSlug
241
+ });
242
+ const siteLocales = {
243
+ defaultLocale: config.defaultLocale ?? fetched.defaultLocale,
244
+ locales: hasStaticLocales ? config.enabledLocales : fetched.locales
245
+ };
246
+ return splitLocaleFromPath(segments, siteLocales).locale;
247
+ }
248
+ function createCmssyLocaleMiddleware(config) {
249
+ return async function cmssyLocaleMiddleware(request2) {
250
+ const locale = await resolveLocaleFromPathname(
251
+ config,
252
+ request2.nextUrl.pathname
253
+ );
254
+ const headers3 = new Headers(request2.headers);
255
+ headers3.set(CMSSY_LOCALE_HEADER, locale);
256
+ return NextResponse.next({ request: { headers: headers3 } });
257
+ };
258
+ }
229
259
  var CMSSY_SESSION_COOKIE = "cmssy_session";
230
260
  var SESSION_MAX_AGE_SECONDS = 30 * 24 * 60 * 60;
231
261
  var MIN_SESSION_SECRET_LENGTH = 32;
@@ -1298,4 +1328,4 @@ function verifyCmssyWebhook(options) {
1298
1328
  return parsed;
1299
1329
  }
1300
1330
 
1301
- export { CMSSY_CART_COOKIE, CMSSY_EDIT_HEADER, CMSSY_LOCALE_HEADER, CMSSY_SESSION_COOKIE, CmssyWebhookError, SESSION_MAX_AGE_SECONDS, applyCmssyCsp, assertAuthConfig, cmssyCspHeaders, createCmssyAuthMiddleware, createCmssyAuthRoute, createCmssyCartRoute, createCmssyOrdersRoute, createCmssyPage, createDraftRoute, fetchProduct, fetchProducts, getCmssyAccessToken, getCmssyLocale, getCmssyUser, isAccessExpired, isCmssyEditMode, isCmssyEditRequest, localeForPathname, openSession, sealSession, sessionCookieOptions, splitCmssyLocale, verifyCmssyWebhook };
1331
+ export { CMSSY_CART_COOKIE, CMSSY_EDIT_HEADER, CMSSY_LOCALE_HEADER, CMSSY_SESSION_COOKIE, CmssyWebhookError, SESSION_MAX_AGE_SECONDS, applyCmssyCsp, assertAuthConfig, cmssyCspHeaders, createCmssyAuthMiddleware, createCmssyAuthRoute, createCmssyCartRoute, createCmssyLocaleMiddleware, createCmssyOrdersRoute, createCmssyPage, createDraftRoute, fetchProduct, fetchProducts, getCmssyAccessToken, getCmssyLocale, getCmssyUser, isAccessExpired, isCmssyEditMode, isCmssyEditRequest, localeForPathname, openSession, resolveLocaleFromPathname, sealSession, sessionCookieOptions, splitCmssyLocale, verifyCmssyWebhook };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cmssy/next",
3
- "version": "0.2.6",
3
+ "version": "0.3.0",
4
4
  "description": "Next.js App Router bindings for cmssy headless sites (createCmssyPage + draft preview)",
5
5
  "keywords": [
6
6
  "cmssy",
@@ -27,6 +27,11 @@
27
27
  "types": "./dist/index.d.ts",
28
28
  "import": "./dist/index.js",
29
29
  "require": "./dist/index.cjs"
30
+ },
31
+ "./client": {
32
+ "types": "./dist/client.d.ts",
33
+ "import": "./dist/client.js",
34
+ "require": "./dist/client.cjs"
30
35
  }
31
36
  },
32
37
  "main": "./dist/index.cjs",
@@ -36,7 +41,7 @@
36
41
  "dist"
37
42
  ],
38
43
  "peerDependencies": {
39
- "@cmssy/react": "^0.2.5",
44
+ "@cmssy/react": "^0.3.0",
40
45
  "next": ">=15",
41
46
  "react": "^18.2.0 || ^19.0.0",
42
47
  "react-dom": "^18.2.0 || ^19.0.0"
@@ -49,7 +54,7 @@
49
54
  "tsup": "^8.3.0",
50
55
  "typescript": "^5.6.0",
51
56
  "vitest": "^2.1.0",
52
- "@cmssy/react": "0.2.6"
57
+ "@cmssy/react": "0.3.0"
53
58
  },
54
59
  "dependencies": {
55
60
  "jose": "^6.2.3"