@cmssy/remix 16.8.0 → 16.9.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/index.cjs +26 -0
- package/dist/index.d.cts +12 -4
- package/dist/index.d.ts +12 -4
- package/dist/index.js +17 -4
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -85,6 +85,11 @@ function createCmssyLoader(config, options = {}) {
|
|
|
85
85
|
defaultLocale: slot.defaultLocale,
|
|
86
86
|
enabledLocales: slot.enabledLocales,
|
|
87
87
|
isEdit,
|
|
88
|
+
...isEdit && config.draftSecret ? {
|
|
89
|
+
blockDataToken: await core.mintCmssyEditToken(config.draftSecret, {
|
|
90
|
+
page: slot.page.slug
|
|
91
|
+
})
|
|
92
|
+
} : {},
|
|
88
93
|
editorOrigin: core.resolveEditorOrigin(config.editorOrigin),
|
|
89
94
|
editorData,
|
|
90
95
|
...config.layout ? { layoutRegions: config.layout.regions } : {}
|
|
@@ -96,6 +101,14 @@ function createCmssyHeaders(config) {
|
|
|
96
101
|
return internal.cmssyCspHeaders({ editorOrigin: config.editorOrigin });
|
|
97
102
|
};
|
|
98
103
|
}
|
|
104
|
+
function createCmssyBlockDataAction(config, blocks, options = {}) {
|
|
105
|
+
const handle = react.createBlockDataHandler(config, blocks, options);
|
|
106
|
+
return async function action({
|
|
107
|
+
request
|
|
108
|
+
}) {
|
|
109
|
+
return handle(request);
|
|
110
|
+
};
|
|
111
|
+
}
|
|
99
112
|
function localeOfMatch(match) {
|
|
100
113
|
for (const result of [match?.loaderData, match?.data]) {
|
|
101
114
|
const locale = result?.locale;
|
|
@@ -112,6 +125,10 @@ function useCmssyLocale() {
|
|
|
112
125
|
return void 0;
|
|
113
126
|
}
|
|
114
127
|
|
|
128
|
+
Object.defineProperty(exports, "CMSSY_EDIT_TOKEN_HEADER", {
|
|
129
|
+
enumerable: true,
|
|
130
|
+
get: function () { return core.CMSSY_EDIT_TOKEN_HEADER; }
|
|
131
|
+
});
|
|
115
132
|
Object.defineProperty(exports, "CMSSY_LOCALE_HEADER", {
|
|
116
133
|
enumerable: true,
|
|
117
134
|
get: function () { return core.CMSSY_LOCALE_HEADER; }
|
|
@@ -140,6 +157,14 @@ Object.defineProperty(exports, "localizeHref", {
|
|
|
140
157
|
enumerable: true,
|
|
141
158
|
get: function () { return core.localizeHref; }
|
|
142
159
|
});
|
|
160
|
+
Object.defineProperty(exports, "mintCmssyEditToken", {
|
|
161
|
+
enumerable: true,
|
|
162
|
+
get: function () { return core.mintCmssyEditToken; }
|
|
163
|
+
});
|
|
164
|
+
Object.defineProperty(exports, "verifyCmssyEditToken", {
|
|
165
|
+
enumerable: true,
|
|
166
|
+
get: function () { return core.verifyCmssyEditToken; }
|
|
167
|
+
});
|
|
143
168
|
Object.defineProperty(exports, "verifyCmssyWebhook", {
|
|
144
169
|
enumerable: true,
|
|
145
170
|
get: function () { return core.verifyCmssyWebhook; }
|
|
@@ -148,6 +173,7 @@ Object.defineProperty(exports, "resolveCmssyLayout", {
|
|
|
148
173
|
enumerable: true,
|
|
149
174
|
get: function () { return react.resolveCmssyLayout; }
|
|
150
175
|
});
|
|
176
|
+
exports.createCmssyBlockDataAction = createCmssyBlockDataAction;
|
|
151
177
|
exports.createCmssyHeaders = createCmssyHeaders;
|
|
152
178
|
exports.createCmssyLoader = createCmssyLoader;
|
|
153
179
|
exports.useCmssyLocale = useCmssyLocale;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { CmssyPageData, CmssyLayoutGroup, CmssyBlockPage, LayoutRegion, RetryOption, CmssyConfig } from '@cmssy/core';
|
|
2
|
-
export { CMSSY_LOCALE_HEADER, CmssyBlockContext, CmssyBlockPage, CmssyConfig, CmssyEnvConfig, CmssyLayout, CmssyLayoutGroup, CmssyPageData, CmssyRegion, CmssyRegionOf, CmssyRegionSettings, CmssyRegionSettingsOf, CmssyRetryMode, CmssyWebhookError, CmssyWebhookEvent, LayoutRegion, RetryOption, RetryPolicy, VerifyCmssyWebhookOptions, createCmssyClient, defineCmssyConfig, defineCmssyLayout, isVerifiedEditUrl, localizeHref, verifyCmssyWebhook } from '@cmssy/core';
|
|
3
|
-
import { BlockDefinition } from '@cmssy/react';
|
|
1
|
+
import { CmssyPageData, CmssyLayoutGroup, CmssyBlockPage, LayoutRegion, RetryOption, CmssyConfig, CmssyClientConfig } from '@cmssy/core';
|
|
2
|
+
export { CMSSY_EDIT_TOKEN_HEADER, CMSSY_LOCALE_HEADER, CmssyBlockContext, CmssyBlockPage, CmssyConfig, CmssyEnvConfig, CmssyLayout, CmssyLayoutGroup, CmssyPageData, CmssyRegion, CmssyRegionOf, CmssyRegionSettings, CmssyRegionSettingsOf, CmssyRetryMode, CmssyWebhookError, CmssyWebhookEvent, LayoutRegion, RetryOption, RetryPolicy, VerifyCmssyWebhookOptions, createCmssyClient, defineCmssyConfig, defineCmssyLayout, isVerifiedEditUrl, localizeHref, mintCmssyEditToken, verifyCmssyEditToken, verifyCmssyWebhook } from '@cmssy/core';
|
|
3
|
+
import { BlockDefinition, CmssyBlockDataHandlerOptions } from '@cmssy/react';
|
|
4
4
|
export { CmssyLayoutEditableProps, CmssyLayoutResolution, ResolveCmssyLayoutOptions, resolveCmssyLayout } from '@cmssy/react';
|
|
5
5
|
|
|
6
6
|
interface CmssyRouteData {
|
|
@@ -11,6 +11,7 @@ interface CmssyRouteData {
|
|
|
11
11
|
defaultLocale: string;
|
|
12
12
|
enabledLocales: string[];
|
|
13
13
|
isEdit: boolean;
|
|
14
|
+
blockDataToken?: string;
|
|
14
15
|
editorOrigin: string | string[];
|
|
15
16
|
diagnostics?: string;
|
|
16
17
|
editorData?: Record<string, CmssyLayoutEditorData>;
|
|
@@ -31,6 +32,13 @@ declare function createCmssyLoader(config: CmssyConfig, options?: CreateCmssyLoa
|
|
|
31
32
|
}) => Promise<CmssyRouteData>;
|
|
32
33
|
declare function createCmssyHeaders(config: CmssyConfig): () => Record<string, string>;
|
|
33
34
|
|
|
35
|
+
type CmssyBlockDataActionConfig = CmssyBlockDataHandlerOptions;
|
|
36
|
+
declare function createCmssyBlockDataAction(config: CmssyClientConfig & {
|
|
37
|
+
draftSecret?: string;
|
|
38
|
+
}, blocks: BlockDefinition[], options?: CmssyBlockDataActionConfig): ({ request, }: {
|
|
39
|
+
request: Request;
|
|
40
|
+
}) => Promise<Response>;
|
|
41
|
+
|
|
34
42
|
declare function useCmssyLocale(): string | undefined;
|
|
35
43
|
|
|
36
|
-
export { type CmssyRouteData, type CreateCmssyLoaderOptions, createCmssyHeaders, createCmssyLoader, useCmssyLocale };
|
|
44
|
+
export { type CmssyBlockDataActionConfig, type CmssyRouteData, type CreateCmssyLoaderOptions, createCmssyBlockDataAction, createCmssyHeaders, createCmssyLoader, useCmssyLocale };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { CmssyPageData, CmssyLayoutGroup, CmssyBlockPage, LayoutRegion, RetryOption, CmssyConfig } from '@cmssy/core';
|
|
2
|
-
export { CMSSY_LOCALE_HEADER, CmssyBlockContext, CmssyBlockPage, CmssyConfig, CmssyEnvConfig, CmssyLayout, CmssyLayoutGroup, CmssyPageData, CmssyRegion, CmssyRegionOf, CmssyRegionSettings, CmssyRegionSettingsOf, CmssyRetryMode, CmssyWebhookError, CmssyWebhookEvent, LayoutRegion, RetryOption, RetryPolicy, VerifyCmssyWebhookOptions, createCmssyClient, defineCmssyConfig, defineCmssyLayout, isVerifiedEditUrl, localizeHref, verifyCmssyWebhook } from '@cmssy/core';
|
|
3
|
-
import { BlockDefinition } from '@cmssy/react';
|
|
1
|
+
import { CmssyPageData, CmssyLayoutGroup, CmssyBlockPage, LayoutRegion, RetryOption, CmssyConfig, CmssyClientConfig } from '@cmssy/core';
|
|
2
|
+
export { CMSSY_EDIT_TOKEN_HEADER, CMSSY_LOCALE_HEADER, CmssyBlockContext, CmssyBlockPage, CmssyConfig, CmssyEnvConfig, CmssyLayout, CmssyLayoutGroup, CmssyPageData, CmssyRegion, CmssyRegionOf, CmssyRegionSettings, CmssyRegionSettingsOf, CmssyRetryMode, CmssyWebhookError, CmssyWebhookEvent, LayoutRegion, RetryOption, RetryPolicy, VerifyCmssyWebhookOptions, createCmssyClient, defineCmssyConfig, defineCmssyLayout, isVerifiedEditUrl, localizeHref, mintCmssyEditToken, verifyCmssyEditToken, verifyCmssyWebhook } from '@cmssy/core';
|
|
3
|
+
import { BlockDefinition, CmssyBlockDataHandlerOptions } from '@cmssy/react';
|
|
4
4
|
export { CmssyLayoutEditableProps, CmssyLayoutResolution, ResolveCmssyLayoutOptions, resolveCmssyLayout } from '@cmssy/react';
|
|
5
5
|
|
|
6
6
|
interface CmssyRouteData {
|
|
@@ -11,6 +11,7 @@ interface CmssyRouteData {
|
|
|
11
11
|
defaultLocale: string;
|
|
12
12
|
enabledLocales: string[];
|
|
13
13
|
isEdit: boolean;
|
|
14
|
+
blockDataToken?: string;
|
|
14
15
|
editorOrigin: string | string[];
|
|
15
16
|
diagnostics?: string;
|
|
16
17
|
editorData?: Record<string, CmssyLayoutEditorData>;
|
|
@@ -31,6 +32,13 @@ declare function createCmssyLoader(config: CmssyConfig, options?: CreateCmssyLoa
|
|
|
31
32
|
}) => Promise<CmssyRouteData>;
|
|
32
33
|
declare function createCmssyHeaders(config: CmssyConfig): () => Record<string, string>;
|
|
33
34
|
|
|
35
|
+
type CmssyBlockDataActionConfig = CmssyBlockDataHandlerOptions;
|
|
36
|
+
declare function createCmssyBlockDataAction(config: CmssyClientConfig & {
|
|
37
|
+
draftSecret?: string;
|
|
38
|
+
}, blocks: BlockDefinition[], options?: CmssyBlockDataActionConfig): ({ request, }: {
|
|
39
|
+
request: Request;
|
|
40
|
+
}) => Promise<Response>;
|
|
41
|
+
|
|
34
42
|
declare function useCmssyLocale(): string | undefined;
|
|
35
43
|
|
|
36
|
-
export { type CmssyRouteData, type CreateCmssyLoaderOptions, createCmssyHeaders, createCmssyLoader, useCmssyLocale };
|
|
44
|
+
export { type CmssyBlockDataActionConfig, type CmssyRouteData, type CreateCmssyLoaderOptions, createCmssyBlockDataAction, createCmssyHeaders, createCmssyLoader, useCmssyLocale };
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { isVerifiedEditUrl, CMSSY_EDIT_QUERY_PARAM, CMSSY_SECRET_QUERY_PARAM, resolveEditorOrigin } from '@cmssy/core';
|
|
2
|
-
export { CMSSY_LOCALE_HEADER, CmssyWebhookError, createCmssyClient, defineCmssyConfig, defineCmssyLayout, isVerifiedEditUrl, localizeHref, verifyCmssyWebhook } from '@cmssy/core';
|
|
1
|
+
import { isVerifiedEditUrl, CMSSY_EDIT_QUERY_PARAM, CMSSY_SECRET_QUERY_PARAM, resolveEditorOrigin, mintCmssyEditToken } from '@cmssy/core';
|
|
2
|
+
export { CMSSY_EDIT_TOKEN_HEADER, CMSSY_LOCALE_HEADER, CmssyWebhookError, createCmssyClient, defineCmssyConfig, defineCmssyLayout, isVerifiedEditUrl, localizeHref, mintCmssyEditToken, verifyCmssyEditToken, verifyCmssyWebhook } from '@cmssy/core';
|
|
3
3
|
import { isDevelopment, resolveSiteLocales, layoutRegionIds, CMSSY_LOCALE_HEADER, fetchPage, cmssyCspHeaders } from '@cmssy/core/internal';
|
|
4
|
-
import { resolveCmssyLayoutSlot } from '@cmssy/react';
|
|
4
|
+
import { resolveCmssyLayoutSlot, createBlockDataHandler } from '@cmssy/react';
|
|
5
5
|
export { resolveCmssyLayout } from '@cmssy/react';
|
|
6
6
|
import { useMatches } from 'react-router';
|
|
7
7
|
|
|
@@ -85,6 +85,11 @@ function createCmssyLoader(config, options = {}) {
|
|
|
85
85
|
defaultLocale: slot.defaultLocale,
|
|
86
86
|
enabledLocales: slot.enabledLocales,
|
|
87
87
|
isEdit,
|
|
88
|
+
...isEdit && config.draftSecret ? {
|
|
89
|
+
blockDataToken: await mintCmssyEditToken(config.draftSecret, {
|
|
90
|
+
page: slot.page.slug
|
|
91
|
+
})
|
|
92
|
+
} : {},
|
|
88
93
|
editorOrigin: resolveEditorOrigin(config.editorOrigin),
|
|
89
94
|
editorData,
|
|
90
95
|
...config.layout ? { layoutRegions: config.layout.regions } : {}
|
|
@@ -96,6 +101,14 @@ function createCmssyHeaders(config) {
|
|
|
96
101
|
return cmssyCspHeaders({ editorOrigin: config.editorOrigin });
|
|
97
102
|
};
|
|
98
103
|
}
|
|
104
|
+
function createCmssyBlockDataAction(config, blocks, options = {}) {
|
|
105
|
+
const handle = createBlockDataHandler(config, blocks, options);
|
|
106
|
+
return async function action({
|
|
107
|
+
request
|
|
108
|
+
}) {
|
|
109
|
+
return handle(request);
|
|
110
|
+
};
|
|
111
|
+
}
|
|
99
112
|
function localeOfMatch(match) {
|
|
100
113
|
for (const result of [match?.loaderData, match?.data]) {
|
|
101
114
|
const locale = result?.locale;
|
|
@@ -112,4 +125,4 @@ function useCmssyLocale() {
|
|
|
112
125
|
return void 0;
|
|
113
126
|
}
|
|
114
127
|
|
|
115
|
-
export { createCmssyHeaders, createCmssyLoader, useCmssyLocale };
|
|
128
|
+
export { createCmssyBlockDataAction, createCmssyHeaders, createCmssyLoader, useCmssyLocale };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cmssy/remix",
|
|
3
|
-
"version": "16.
|
|
3
|
+
"version": "16.9.0",
|
|
4
4
|
"description": "React Router 7 bindings for cmssy headless sites: page loader, framing CSP, sitemap and robots.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cmssy",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
],
|
|
52
52
|
"peerDependencies": {
|
|
53
53
|
"react-router": ">=7",
|
|
54
|
-
"@cmssy/react": "^16.
|
|
54
|
+
"@cmssy/react": "^16.9.0"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"@types/node": "^20.0.0",
|
|
@@ -59,10 +59,10 @@
|
|
|
59
59
|
"tsup": "^8.3.0",
|
|
60
60
|
"typescript": "^5.6.0",
|
|
61
61
|
"vitest": "^2.1.0",
|
|
62
|
-
"@cmssy/react": "16.
|
|
62
|
+
"@cmssy/react": "16.9.0"
|
|
63
63
|
},
|
|
64
64
|
"dependencies": {
|
|
65
|
-
"@cmssy/core": "16.
|
|
65
|
+
"@cmssy/core": "16.9.0"
|
|
66
66
|
},
|
|
67
67
|
"scripts": {
|
|
68
68
|
"build": "tsup",
|