@cmssy/react 19.38.1 → 19.39.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/dist/client.cjs +6 -1
- package/dist/client.d.cts +2 -0
- package/dist/client.d.ts +2 -0
- package/dist/client.js +7 -2
- package/dist/index.cjs +3 -2
- package/dist/index.js +4 -3
- package/dist/internal-server.cjs +3 -2
- package/dist/internal-server.js +4 -3
- package/package.json +2 -2
package/dist/client.cjs
CHANGED
|
@@ -356,7 +356,12 @@ function useEditBridge(page, config) {
|
|
|
356
356
|
],
|
|
357
357
|
schemas: config.schemas ?? /* @__PURE__ */ Object.create(null),
|
|
358
358
|
blockMeta: config.blockMeta ?? /* @__PURE__ */ Object.create(null),
|
|
359
|
-
capabilities:
|
|
359
|
+
capabilities: [
|
|
360
|
+
"shortcuts",
|
|
361
|
+
...canDetectInvisibleBlocks() ? ["invisible-blocks"] : [],
|
|
362
|
+
...config.acceptsEditToken ? [core.CMSSY_EDIT_TOKEN_CAPABILITY] : [],
|
|
363
|
+
...config.acceptsDraftToken ? [core.CMSSY_DRAFT_TOKEN_CAPABILITY] : []
|
|
364
|
+
],
|
|
360
365
|
...config.layoutRegions ? { layoutRegions: core.layoutRegionsToBridge(config.layoutRegions) } : {}
|
|
361
366
|
});
|
|
362
367
|
} catch (error) {
|
package/dist/client.d.cts
CHANGED
|
@@ -10,6 +10,8 @@ interface EditBridgeConfig {
|
|
|
10
10
|
layoutRegions?: readonly LayoutRegion[] | undefined;
|
|
11
11
|
blockDataUrl?: string;
|
|
12
12
|
blockDataToken?: string;
|
|
13
|
+
acceptsEditToken?: boolean;
|
|
14
|
+
acceptsDraftToken?: boolean;
|
|
13
15
|
}
|
|
14
16
|
type PatchMap = Partial<Record<string, Record<string, unknown>>>;
|
|
15
17
|
interface InsertedBlock {
|
package/dist/client.d.ts
CHANGED
|
@@ -10,6 +10,8 @@ interface EditBridgeConfig {
|
|
|
10
10
|
layoutRegions?: readonly LayoutRegion[] | undefined;
|
|
11
11
|
blockDataUrl?: string;
|
|
12
12
|
blockDataToken?: string;
|
|
13
|
+
acceptsEditToken?: boolean;
|
|
14
|
+
acceptsDraftToken?: boolean;
|
|
13
15
|
}
|
|
14
16
|
type PatchMap = Partial<Record<string, Record<string, unknown>>>;
|
|
15
17
|
interface InsertedBlock {
|
package/dist/client.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useState, useRef, useEffect, useMemo, createElement } from 'react';
|
|
3
3
|
import { resolveInitialTarget, buildBlockContext, getBlockContentForLanguage, normalizeBlockContent, asBucket } from '@cmssy/core/internal';
|
|
4
|
-
import { blocksToMeta, blocksToSchemas, postToEditor, layoutRegionsToBridge, PROTOCOL_VERSION, parseEditorMessage, CMSSY_EDIT_TOKEN_HEADER } from '@cmssy/core';
|
|
4
|
+
import { blocksToMeta, blocksToSchemas, postToEditor, layoutRegionsToBridge, CMSSY_EDIT_TOKEN_CAPABILITY, CMSSY_DRAFT_TOKEN_CAPABILITY, PROTOCOL_VERSION, parseEditorMessage, CMSSY_EDIT_TOKEN_HEADER } from '@cmssy/core';
|
|
5
5
|
import { BlockErrorBoundary } from '@cmssy/react/block-error-boundary';
|
|
6
6
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
7
7
|
|
|
@@ -354,7 +354,12 @@ function useEditBridge(page, config) {
|
|
|
354
354
|
],
|
|
355
355
|
schemas: config.schemas ?? /* @__PURE__ */ Object.create(null),
|
|
356
356
|
blockMeta: config.blockMeta ?? /* @__PURE__ */ Object.create(null),
|
|
357
|
-
capabilities:
|
|
357
|
+
capabilities: [
|
|
358
|
+
"shortcuts",
|
|
359
|
+
...canDetectInvisibleBlocks() ? ["invisible-blocks"] : [],
|
|
360
|
+
...config.acceptsEditToken ? [CMSSY_EDIT_TOKEN_CAPABILITY] : [],
|
|
361
|
+
...config.acceptsDraftToken ? [CMSSY_DRAFT_TOKEN_CAPABILITY] : []
|
|
362
|
+
],
|
|
358
363
|
...config.layoutRegions ? { layoutRegions: layoutRegionsToBridge(config.layoutRegions) } : {}
|
|
359
364
|
});
|
|
360
365
|
} catch (error) {
|
package/dist/index.cjs
CHANGED
|
@@ -1048,10 +1048,11 @@ function createBlockDataHandler(config, blocks, options = {}) {
|
|
|
1048
1048
|
{ status: 400 }
|
|
1049
1049
|
);
|
|
1050
1050
|
}
|
|
1051
|
-
const
|
|
1051
|
+
const page = pageOf(body);
|
|
1052
|
+
const authorized = page !== core.CMSSY_EDIT_URL_TOKEN_PAGE && await core.verifyCmssyEditToken(
|
|
1052
1053
|
request.headers.get(core.CMSSY_EDIT_TOKEN_HEADER),
|
|
1053
1054
|
config.draftSecret,
|
|
1054
|
-
{ page
|
|
1055
|
+
{ page }
|
|
1055
1056
|
);
|
|
1056
1057
|
if (!authorized) {
|
|
1057
1058
|
return new Response(
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { blocksToSchemas, isTransientRequestError, resolveEditorOrigin, verifyCmssyEditToken, CMSSY_EDIT_TOKEN_HEADER } from '@cmssy/core';
|
|
1
|
+
import { blocksToSchemas, isTransientRequestError, resolveEditorOrigin, CMSSY_EDIT_URL_TOKEN_PAGE, verifyCmssyEditToken, CMSSY_EDIT_TOKEN_HEADER } from '@cmssy/core';
|
|
2
2
|
export { CmssyRequestError, FieldType, MediaType, PROTOCOL_VERSION, createCmssyClient, defineCmssyLayout, evaluateFieldConditionGroup, fields, graphqlRequest, isFormFieldRequired, isFormFieldVisible, isProtocolCompatible, mediaAlt, mediaDuration, mediaType, mediaTypeValues, mediaUrl, mediaUrls, normalizeOrigin, parseEditorMessage, postToEditor, typedOperation, visibleFormFields } from '@cmssy/core';
|
|
3
3
|
import { unreachableShowWhenTargets, buildBlockContext, readThroughLayoutStore, layoutStoreKey, fetchLayouts, fetchLayoutKey, fetchLayoutsByKey, normalizeBlockContent, asBucket, layoutRegionIds, fetchPage, resolveSiteLocales as resolveSiteLocales$1, getBlockContentForLanguage, resolveRelationContent } from '@cmssy/core/internal';
|
|
4
4
|
export { buildBlockContext } from '@cmssy/core/internal';
|
|
@@ -1048,10 +1048,11 @@ function createBlockDataHandler(config, blocks, options = {}) {
|
|
|
1048
1048
|
{ status: 400 }
|
|
1049
1049
|
);
|
|
1050
1050
|
}
|
|
1051
|
-
const
|
|
1051
|
+
const page = pageOf(body);
|
|
1052
|
+
const authorized = page !== CMSSY_EDIT_URL_TOKEN_PAGE && await verifyCmssyEditToken(
|
|
1052
1053
|
request.headers.get(CMSSY_EDIT_TOKEN_HEADER),
|
|
1053
1054
|
config.draftSecret,
|
|
1054
|
-
{ page
|
|
1055
|
+
{ page }
|
|
1055
1056
|
);
|
|
1056
1057
|
if (!authorized) {
|
|
1057
1058
|
return new Response(
|
package/dist/internal-server.cjs
CHANGED
|
@@ -291,10 +291,11 @@ function createBlockDataHandler(config, blocks, options = {}) {
|
|
|
291
291
|
{ status: 400 }
|
|
292
292
|
);
|
|
293
293
|
}
|
|
294
|
-
const
|
|
294
|
+
const page = pageOf(body);
|
|
295
|
+
const authorized = page !== core.CMSSY_EDIT_URL_TOKEN_PAGE && await core.verifyCmssyEditToken(
|
|
295
296
|
request.headers.get(core.CMSSY_EDIT_TOKEN_HEADER),
|
|
296
297
|
config.draftSecret,
|
|
297
|
-
{ page
|
|
298
|
+
{ page }
|
|
298
299
|
);
|
|
299
300
|
if (!authorized) {
|
|
300
301
|
return new Response(
|
package/dist/internal-server.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { buildBlockContext, getBlockContentForLanguage, resolveRelationContent, normalizeBlockContent } from '@cmssy/core/internal';
|
|
2
|
-
import { blocksToSchemas, verifyCmssyEditToken, CMSSY_EDIT_TOKEN_HEADER } from '@cmssy/core';
|
|
2
|
+
import { blocksToSchemas, CMSSY_EDIT_URL_TOKEN_PAGE, verifyCmssyEditToken, CMSSY_EDIT_TOKEN_HEADER } from '@cmssy/core';
|
|
3
3
|
export { blocksToSchemas } from '@cmssy/core';
|
|
4
4
|
|
|
5
5
|
// src/components/resolve-block-data.ts
|
|
@@ -290,10 +290,11 @@ function createBlockDataHandler(config, blocks, options = {}) {
|
|
|
290
290
|
{ status: 400 }
|
|
291
291
|
);
|
|
292
292
|
}
|
|
293
|
-
const
|
|
293
|
+
const page = pageOf(body);
|
|
294
|
+
const authorized = page !== CMSSY_EDIT_URL_TOKEN_PAGE && await verifyCmssyEditToken(
|
|
294
295
|
request.headers.get(CMSSY_EDIT_TOKEN_HEADER),
|
|
295
296
|
config.draftSecret,
|
|
296
|
-
{ page
|
|
297
|
+
{ page }
|
|
297
298
|
);
|
|
298
299
|
if (!authorized) {
|
|
299
300
|
return new Response(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cmssy/react",
|
|
3
|
-
"version": "19.
|
|
3
|
+
"version": "19.39.0",
|
|
4
4
|
"engines": {
|
|
5
5
|
"node": ">=20"
|
|
6
6
|
},
|
|
@@ -110,7 +110,7 @@
|
|
|
110
110
|
},
|
|
111
111
|
"dependencies": {
|
|
112
112
|
"@cmssy/types": "0.78.0",
|
|
113
|
-
"@cmssy/core": "19.
|
|
113
|
+
"@cmssy/core": "19.39.0"
|
|
114
114
|
},
|
|
115
115
|
"scripts": {
|
|
116
116
|
"build": "tsup",
|