@dotcms/uve 26.8.3-1-next.2478 → 26.8.7-1
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/index.cjs.js +1 -0
- package/index.esm.js +1 -1
- package/internal.cjs.js +1 -0
- package/internal.esm.js +1 -1
- package/package.json +1 -1
- package/public.cjs.js +36 -0
- package/public.esm.js +36 -1
- package/src/lib/core/core.utils.d.ts +28 -0
- package/src/lib/editor/public.d.ts +6 -1
- package/src/script/utils.d.ts +1 -1
package/index.cjs.js
CHANGED
|
@@ -13,6 +13,7 @@ exports.enableBlockEditorInline = _public.enableBlockEditorInline;
|
|
|
13
13
|
exports.getUVEState = _public.getUVEState;
|
|
14
14
|
exports.initInlineEditing = _public.initInlineEditing;
|
|
15
15
|
exports.initUVE = _public.initUVE;
|
|
16
|
+
exports.isRequestFromUVE = _public.isRequestFromUVE;
|
|
16
17
|
exports.reorderMenu = _public.reorderMenu;
|
|
17
18
|
exports.sendMessageToUVE = _public.sendMessageToUVE;
|
|
18
19
|
exports.updateNavigation = _public.updateNavigation;
|
package/index.esm.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { d as createContentlet, c as createUVESubscription, e as editContentlet, b as enableBlockEditorInline, g as getUVEState, a as initInlineEditing, f as initUVE, i as isRequestFromUVE, r as reorderMenu, s as sendMessageToUVE, u as updateNavigation } from './public.esm.js';
|
|
2
2
|
import '@dotcms/types';
|
|
3
3
|
import '@dotcms/types/internal';
|
package/internal.cjs.js
CHANGED
|
@@ -402,6 +402,7 @@ exports.getDotContentletAttributes = _public.getDotContentletAttributes;
|
|
|
402
402
|
exports.getNativeEventBinder = _public.getNativeEventBinder;
|
|
403
403
|
exports.getUVEState = _public.getUVEState;
|
|
404
404
|
exports.isDotAnalyticsActive = _public.isDotAnalyticsActive;
|
|
405
|
+
exports.isRequestFromUVE = _public.isRequestFromUVE;
|
|
405
406
|
exports.isValidBlocks = _public.isValidBlocks;
|
|
406
407
|
exports.readContentletDataset = _public.readContentletDataset;
|
|
407
408
|
exports.setBounds = _public.setBounds;
|
package/internal.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { g as getUVEState, s as sendMessageToUVE } from './public.esm.js';
|
|
2
|
-
export { A as ANALYTICS_ACTIVE_WINDOW_KEY,
|
|
2
|
+
export { A as ANALYTICS_ACTIVE_WINDOW_KEY, m as ANALYTICS_READY_EVENT, C as CUSTOM_NO_COMPONENT, D as DEVELOPMENT_MODE, l as DOT_SECTION_ID_PREFIX, k as EMPTY_CONTAINER_STYLE_ANGULAR, j as EMPTY_CONTAINER_STYLE_REACT, E as END_CLASS, P as PRODUCTION_MODE, S as START_CLASS, T as TEMP_EMPTY_CONTENTLET, n as TEMP_EMPTY_CONTENTLET_TYPE, _ as __UVE_EVENTS__, h as __UVE_EVENT_ERROR_FALLBACK__, y as combineClasses, x as computeScrollIsInBottom, c as createUVESubscription, v as findDotCMSElement, w as findDotCMSVTLData, F as getAnalyticsContentletAttributes, t as getClosestDotCMSContainerData, z as getColumnPositionClasses, H as getContainersData, I as getContentletsInContainer, q as getDotCMSContainerData, p as getDotCMSContentletsBound, o as getDotCMSPageBounds, J as getDotContainerAttributes, B as getDotContentletAttributes, L as getNativeEventBinder, G as isDotAnalyticsActive, i as isRequestFromUVE, N as isValidBlocks, K as readContentletDataset, M as setBounds } from './public.esm.js';
|
|
3
3
|
import { UVE_MODE, DotCMSUVEAction } from '@dotcms/types';
|
|
4
4
|
import '@dotcms/types/internal';
|
|
5
5
|
|
package/package.json
CHANGED
package/public.cjs.js
CHANGED
|
@@ -1042,6 +1042,36 @@ function getUVEState() {
|
|
|
1042
1042
|
dotCMSHost
|
|
1043
1043
|
};
|
|
1044
1044
|
}
|
|
1045
|
+
/**
|
|
1046
|
+
* Detects whether a request's query parameters came through the UVE iframe - for server-only
|
|
1047
|
+
* contexts (e.g. a Next.js Server Component fetching data before any client code runs) where
|
|
1048
|
+
* `getUVEState()` can't be used, since it reads `window.location` and there is no `window` yet.
|
|
1049
|
+
*
|
|
1050
|
+
* UVE always appends `dotCMSHost` to the iframed URL, so its presence is the signal checked here.
|
|
1051
|
+
*
|
|
1052
|
+
* @remarks
|
|
1053
|
+
* This is a heuristic based on a single query parameter, not a security boundary - it can be
|
|
1054
|
+
* forced onto any URL. A forced/spoofed request only ever gets a blank/placeholder response
|
|
1055
|
+
* instead of a real 404 or error page: the actual page content still only ever arrives through a
|
|
1056
|
+
* genuine UVE editor `postMessage`, so nothing sensitive leaks. If a wrong HTTP status in that
|
|
1057
|
+
* forced case matters for your use case (SEO, monitoring), validate the request further
|
|
1058
|
+
* server-side (e.g. the `Sec-Fetch-Dest: iframe` header) before trusting this.
|
|
1059
|
+
*
|
|
1060
|
+
* @param searchParams - The request's query parameters, as a plain object (e.g. a Next.js
|
|
1061
|
+
* Server Component's `searchParams` prop).
|
|
1062
|
+
*
|
|
1063
|
+
* @example
|
|
1064
|
+
* ```ts
|
|
1065
|
+
* export default async function Page({ searchParams }) {
|
|
1066
|
+
* const sp = await searchParams;
|
|
1067
|
+
* const insideUVE = isRequestFromUVE(sp);
|
|
1068
|
+
* // ...decide whether to bail to notFound() or render the page shell
|
|
1069
|
+
* }
|
|
1070
|
+
* ```
|
|
1071
|
+
*/
|
|
1072
|
+
function isRequestFromUVE(searchParams) {
|
|
1073
|
+
return Boolean(searchParams['dotCMSHost']);
|
|
1074
|
+
}
|
|
1045
1075
|
/**
|
|
1046
1076
|
* Creates a subscription to a UVE event.
|
|
1047
1077
|
*
|
|
@@ -1515,6 +1545,11 @@ function createContentlet(contentType) {
|
|
|
1515
1545
|
* - Client ready state
|
|
1516
1546
|
* - UVE event subscriptions
|
|
1517
1547
|
*
|
|
1548
|
+
* @param {Partial<DotCMSPageResponse>} [config] - Sent as-is to the editor as the CLIENT_READY
|
|
1549
|
+
* payload. Accepts a partial shape (e.g. just `{ graphql }`) for callers that don't yet have a
|
|
1550
|
+
* full page response — a failed/draft page fetch, for instance — since this only ever forwards
|
|
1551
|
+
* `config` to the editor and never reads any of its fields itself.
|
|
1552
|
+
*
|
|
1518
1553
|
* @returns {Object} An object containing the cleanup function
|
|
1519
1554
|
* @returns {Function} destroyUVESubscriptions - Function to clean up all UVE event subscriptions
|
|
1520
1555
|
*
|
|
@@ -1584,6 +1619,7 @@ exports.getUVEState = getUVEState;
|
|
|
1584
1619
|
exports.initInlineEditing = initInlineEditing;
|
|
1585
1620
|
exports.initUVE = initUVE;
|
|
1586
1621
|
exports.isDotAnalyticsActive = isDotAnalyticsActive;
|
|
1622
|
+
exports.isRequestFromUVE = isRequestFromUVE;
|
|
1587
1623
|
exports.isValidBlocks = isValidBlocks;
|
|
1588
1624
|
exports.readContentletDataset = readContentletDataset;
|
|
1589
1625
|
exports.reorderMenu = reorderMenu;
|
package/public.esm.js
CHANGED
|
@@ -1040,6 +1040,36 @@ function getUVEState() {
|
|
|
1040
1040
|
dotCMSHost
|
|
1041
1041
|
};
|
|
1042
1042
|
}
|
|
1043
|
+
/**
|
|
1044
|
+
* Detects whether a request's query parameters came through the UVE iframe - for server-only
|
|
1045
|
+
* contexts (e.g. a Next.js Server Component fetching data before any client code runs) where
|
|
1046
|
+
* `getUVEState()` can't be used, since it reads `window.location` and there is no `window` yet.
|
|
1047
|
+
*
|
|
1048
|
+
* UVE always appends `dotCMSHost` to the iframed URL, so its presence is the signal checked here.
|
|
1049
|
+
*
|
|
1050
|
+
* @remarks
|
|
1051
|
+
* This is a heuristic based on a single query parameter, not a security boundary - it can be
|
|
1052
|
+
* forced onto any URL. A forced/spoofed request only ever gets a blank/placeholder response
|
|
1053
|
+
* instead of a real 404 or error page: the actual page content still only ever arrives through a
|
|
1054
|
+
* genuine UVE editor `postMessage`, so nothing sensitive leaks. If a wrong HTTP status in that
|
|
1055
|
+
* forced case matters for your use case (SEO, monitoring), validate the request further
|
|
1056
|
+
* server-side (e.g. the `Sec-Fetch-Dest: iframe` header) before trusting this.
|
|
1057
|
+
*
|
|
1058
|
+
* @param searchParams - The request's query parameters, as a plain object (e.g. a Next.js
|
|
1059
|
+
* Server Component's `searchParams` prop).
|
|
1060
|
+
*
|
|
1061
|
+
* @example
|
|
1062
|
+
* ```ts
|
|
1063
|
+
* export default async function Page({ searchParams }) {
|
|
1064
|
+
* const sp = await searchParams;
|
|
1065
|
+
* const insideUVE = isRequestFromUVE(sp);
|
|
1066
|
+
* // ...decide whether to bail to notFound() or render the page shell
|
|
1067
|
+
* }
|
|
1068
|
+
* ```
|
|
1069
|
+
*/
|
|
1070
|
+
function isRequestFromUVE(searchParams) {
|
|
1071
|
+
return Boolean(searchParams['dotCMSHost']);
|
|
1072
|
+
}
|
|
1043
1073
|
/**
|
|
1044
1074
|
* Creates a subscription to a UVE event.
|
|
1045
1075
|
*
|
|
@@ -1513,6 +1543,11 @@ function createContentlet(contentType) {
|
|
|
1513
1543
|
* - Client ready state
|
|
1514
1544
|
* - UVE event subscriptions
|
|
1515
1545
|
*
|
|
1546
|
+
* @param {Partial<DotCMSPageResponse>} [config] - Sent as-is to the editor as the CLIENT_READY
|
|
1547
|
+
* payload. Accepts a partial shape (e.g. just `{ graphql }`) for callers that don't yet have a
|
|
1548
|
+
* full page response — a failed/draft page fetch, for instance — since this only ever forwards
|
|
1549
|
+
* `config` to the editor and never reads any of its fields itself.
|
|
1550
|
+
*
|
|
1516
1551
|
* @returns {Object} An object containing the cleanup function
|
|
1517
1552
|
* @returns {Function} destroyUVESubscriptions - Function to clean up all UVE event subscriptions
|
|
1518
1553
|
*
|
|
@@ -1545,4 +1580,4 @@ function initUVE(config = {}) {
|
|
|
1545
1580
|
};
|
|
1546
1581
|
}
|
|
1547
1582
|
|
|
1548
|
-
export { ANALYTICS_ACTIVE_WINDOW_KEY as A,
|
|
1583
|
+
export { ANALYTICS_ACTIVE_WINDOW_KEY as A, getDotContentletAttributes as B, CUSTOM_NO_COMPONENT as C, DEVELOPMENT_MODE as D, END_CLASS as E, getAnalyticsContentletAttributes as F, isDotAnalyticsActive as G, getContainersData as H, getContentletsInContainer as I, getDotContainerAttributes as J, readContentletDataset as K, getNativeEventBinder as L, setBounds as M, isValidBlocks as N, PRODUCTION_MODE as P, START_CLASS as S, TEMP_EMPTY_CONTENTLET as T, __UVE_EVENTS__ as _, initInlineEditing as a, enableBlockEditorInline as b, createUVESubscription as c, createContentlet as d, editContentlet as e, initUVE as f, getUVEState as g, __UVE_EVENT_ERROR_FALLBACK__ as h, isRequestFromUVE as i, EMPTY_CONTAINER_STYLE_REACT as j, EMPTY_CONTAINER_STYLE_ANGULAR as k, DOT_SECTION_ID_PREFIX as l, ANALYTICS_READY_EVENT as m, TEMP_EMPTY_CONTENTLET_TYPE as n, getDotCMSPageBounds as o, getDotCMSContentletsBound as p, getDotCMSContainerData as q, reorderMenu as r, sendMessageToUVE as s, getClosestDotCMSContainerData as t, updateNavigation as u, findDotCMSElement as v, findDotCMSVTLData as w, computeScrollIsInBottom as x, combineClasses as y, getColumnPositionClasses as z };
|
|
@@ -28,6 +28,34 @@ import { UVEEventPayloadMap, UVEEventSubscription, UVEEventType, UVEState } from
|
|
|
28
28
|
* ```
|
|
29
29
|
*/
|
|
30
30
|
export declare function getUVEState(): UVEState | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* Detects whether a request's query parameters came through the UVE iframe - for server-only
|
|
33
|
+
* contexts (e.g. a Next.js Server Component fetching data before any client code runs) where
|
|
34
|
+
* `getUVEState()` can't be used, since it reads `window.location` and there is no `window` yet.
|
|
35
|
+
*
|
|
36
|
+
* UVE always appends `dotCMSHost` to the iframed URL, so its presence is the signal checked here.
|
|
37
|
+
*
|
|
38
|
+
* @remarks
|
|
39
|
+
* This is a heuristic based on a single query parameter, not a security boundary - it can be
|
|
40
|
+
* forced onto any URL. A forced/spoofed request only ever gets a blank/placeholder response
|
|
41
|
+
* instead of a real 404 or error page: the actual page content still only ever arrives through a
|
|
42
|
+
* genuine UVE editor `postMessage`, so nothing sensitive leaks. If a wrong HTTP status in that
|
|
43
|
+
* forced case matters for your use case (SEO, monitoring), validate the request further
|
|
44
|
+
* server-side (e.g. the `Sec-Fetch-Dest: iframe` header) before trusting this.
|
|
45
|
+
*
|
|
46
|
+
* @param searchParams - The request's query parameters, as a plain object (e.g. a Next.js
|
|
47
|
+
* Server Component's `searchParams` prop).
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```ts
|
|
51
|
+
* export default async function Page({ searchParams }) {
|
|
52
|
+
* const sp = await searchParams;
|
|
53
|
+
* const insideUVE = isRequestFromUVE(sp);
|
|
54
|
+
* // ...decide whether to bail to notFound() or render the page shell
|
|
55
|
+
* }
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
58
|
+
export declare function isRequestFromUVE(searchParams: Record<string, string | string[] | undefined>): boolean;
|
|
31
59
|
/**
|
|
32
60
|
* Creates a subscription to a UVE event.
|
|
33
61
|
*
|
|
@@ -86,6 +86,11 @@ export declare function createContentlet(contentType: string): void;
|
|
|
86
86
|
* - Client ready state
|
|
87
87
|
* - UVE event subscriptions
|
|
88
88
|
*
|
|
89
|
+
* @param {Partial<DotCMSPageResponse>} [config] - Sent as-is to the editor as the CLIENT_READY
|
|
90
|
+
* payload. Accepts a partial shape (e.g. just `{ graphql }`) for callers that don't yet have a
|
|
91
|
+
* full page response — a failed/draft page fetch, for instance — since this only ever forwards
|
|
92
|
+
* `config` to the editor and never reads any of its fields itself.
|
|
93
|
+
*
|
|
89
94
|
* @returns {Object} An object containing the cleanup function
|
|
90
95
|
* @returns {Function} destroyUVESubscriptions - Function to clean up all UVE event subscriptions
|
|
91
96
|
*
|
|
@@ -97,6 +102,6 @@ export declare function createContentlet(contentType: string): void;
|
|
|
97
102
|
* destroyUVESubscriptions();
|
|
98
103
|
* ```
|
|
99
104
|
*/
|
|
100
|
-
export declare function initUVE(config?: DotCMSPageResponse): {
|
|
105
|
+
export declare function initUVE(config?: Partial<DotCMSPageResponse>): {
|
|
101
106
|
destroyUVESubscriptions: () => void;
|
|
102
107
|
};
|
package/src/script/utils.d.ts
CHANGED
|
@@ -44,7 +44,7 @@ export declare function registerUVEEvents(): {
|
|
|
44
44
|
* This is typically called after all UVE event handlers and DOM listeners
|
|
45
45
|
* have been set up successfully.
|
|
46
46
|
*/
|
|
47
|
-
export declare function setClientIsReady(config?: DotCMSPageResponse): void;
|
|
47
|
+
export declare function setClientIsReady(config?: Partial<DotCMSPageResponse>): void;
|
|
48
48
|
/**
|
|
49
49
|
* Listen for block editor inline event.
|
|
50
50
|
*/
|