@dotcms/uve 0.0.1-beta.8 → 0.0.1-beta.9

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/internal.cjs.js CHANGED
@@ -1,38 +1,38 @@
1
1
  'use strict';
2
2
 
3
3
  /**
4
- * Actions received from the dotCMS UVE
4
+ * Actions received from the dotcms editor
5
5
  *
6
- * @internal
7
- * @enum {string}
6
+ * @export
7
+ * @enum {number}
8
8
  */
9
- exports.__NOTIFY_CLIENT__ = void 0;
10
- (function (__NOTIFY_CLIENT__) {
9
+ exports.__DOTCMS_UVE_EVENT__ = void 0;
10
+ (function (__DOTCMS_UVE_EVENT__) {
11
11
  /**
12
12
  * Request to page to reload
13
13
  */
14
- __NOTIFY_CLIENT__["UVE_RELOAD_PAGE"] = "uve-reload-page";
14
+ __DOTCMS_UVE_EVENT__["UVE_RELOAD_PAGE"] = "uve-reload-page";
15
15
  /**
16
16
  * Request the bounds for the elements
17
17
  */
18
- __NOTIFY_CLIENT__["UVE_REQUEST_BOUNDS"] = "uve-request-bounds";
18
+ __DOTCMS_UVE_EVENT__["UVE_REQUEST_BOUNDS"] = "uve-request-bounds";
19
19
  /**
20
20
  * Received pong from the editor
21
21
  */
22
- __NOTIFY_CLIENT__["UVE_EDITOR_PONG"] = "uve-editor-pong";
22
+ __DOTCMS_UVE_EVENT__["UVE_EDITOR_PONG"] = "uve-editor-pong";
23
23
  /**
24
24
  * Received scroll event trigger from the editor
25
25
  */
26
- __NOTIFY_CLIENT__["UVE_SCROLL_INSIDE_IFRAME"] = "uve-scroll-inside-iframe";
26
+ __DOTCMS_UVE_EVENT__["UVE_SCROLL_INSIDE_IFRAME"] = "uve-scroll-inside-iframe";
27
27
  /**
28
28
  * Set the page data
29
29
  */
30
- __NOTIFY_CLIENT__["UVE_SET_PAGE_DATA"] = "uve-set-page-data";
30
+ __DOTCMS_UVE_EVENT__["UVE_SET_PAGE_DATA"] = "uve-set-page-data";
31
31
  /**
32
32
  * Copy contentlet inline editing success
33
33
  */
34
- __NOTIFY_CLIENT__["UVE_COPY_CONTENTLET_INLINE_EDITING_SUCCESS"] = "uve-copy-contentlet-inline-editing-success";
35
- })(exports.__NOTIFY_CLIENT__ || (exports.__NOTIFY_CLIENT__ = {}));
34
+ __DOTCMS_UVE_EVENT__["UVE_COPY_CONTENTLET_INLINE_EDITING_SUCCESS"] = "uve-copy-contentlet-inline-editing-success";
35
+ })(exports.__DOTCMS_UVE_EVENT__ || (exports.__DOTCMS_UVE_EVENT__ = {}));
36
36
 
37
37
  // TODO: WE NEED TO LOOK FOR ALL THE NOTIFY_CLIENT EVENTS AND ADD THEM TO THE UVE_EVENTS CONSTANT WHEN WE MIGRATE THE EDITOR TO THE NEW UVE LIBRARY
38
38
  /**
@@ -44,7 +44,7 @@ exports.__NOTIFY_CLIENT__ = void 0;
44
44
  const __UVE_EVENTS__ = {
45
45
  changes: callback => {
46
46
  const messageCallback = event => {
47
- if (event.data.name === exports.__NOTIFY_CLIENT__.UVE_SET_PAGE_DATA) {
47
+ if (event.data.name === exports.__DOTCMS_UVE_EVENT__.UVE_SET_PAGE_DATA) {
48
48
  callback(event.data.payload);
49
49
  }
50
50
  };
package/internal.esm.js CHANGED
@@ -1,36 +1,36 @@
1
1
  /**
2
- * Actions received from the dotCMS UVE
2
+ * Actions received from the dotcms editor
3
3
  *
4
- * @internal
5
- * @enum {string}
4
+ * @export
5
+ * @enum {number}
6
6
  */
7
- var __NOTIFY_CLIENT__;
8
- (function (__NOTIFY_CLIENT__) {
7
+ var __DOTCMS_UVE_EVENT__;
8
+ (function (__DOTCMS_UVE_EVENT__) {
9
9
  /**
10
10
  * Request to page to reload
11
11
  */
12
- __NOTIFY_CLIENT__["UVE_RELOAD_PAGE"] = "uve-reload-page";
12
+ __DOTCMS_UVE_EVENT__["UVE_RELOAD_PAGE"] = "uve-reload-page";
13
13
  /**
14
14
  * Request the bounds for the elements
15
15
  */
16
- __NOTIFY_CLIENT__["UVE_REQUEST_BOUNDS"] = "uve-request-bounds";
16
+ __DOTCMS_UVE_EVENT__["UVE_REQUEST_BOUNDS"] = "uve-request-bounds";
17
17
  /**
18
18
  * Received pong from the editor
19
19
  */
20
- __NOTIFY_CLIENT__["UVE_EDITOR_PONG"] = "uve-editor-pong";
20
+ __DOTCMS_UVE_EVENT__["UVE_EDITOR_PONG"] = "uve-editor-pong";
21
21
  /**
22
22
  * Received scroll event trigger from the editor
23
23
  */
24
- __NOTIFY_CLIENT__["UVE_SCROLL_INSIDE_IFRAME"] = "uve-scroll-inside-iframe";
24
+ __DOTCMS_UVE_EVENT__["UVE_SCROLL_INSIDE_IFRAME"] = "uve-scroll-inside-iframe";
25
25
  /**
26
26
  * Set the page data
27
27
  */
28
- __NOTIFY_CLIENT__["UVE_SET_PAGE_DATA"] = "uve-set-page-data";
28
+ __DOTCMS_UVE_EVENT__["UVE_SET_PAGE_DATA"] = "uve-set-page-data";
29
29
  /**
30
30
  * Copy contentlet inline editing success
31
31
  */
32
- __NOTIFY_CLIENT__["UVE_COPY_CONTENTLET_INLINE_EDITING_SUCCESS"] = "uve-copy-contentlet-inline-editing-success";
33
- })(__NOTIFY_CLIENT__ || (__NOTIFY_CLIENT__ = {}));
32
+ __DOTCMS_UVE_EVENT__["UVE_COPY_CONTENTLET_INLINE_EDITING_SUCCESS"] = "uve-copy-contentlet-inline-editing-success";
33
+ })(__DOTCMS_UVE_EVENT__ || (__DOTCMS_UVE_EVENT__ = {}));
34
34
 
35
35
  // TODO: WE NEED TO LOOK FOR ALL THE NOTIFY_CLIENT EVENTS AND ADD THEM TO THE UVE_EVENTS CONSTANT WHEN WE MIGRATE THE EDITOR TO THE NEW UVE LIBRARY
36
36
  /**
@@ -42,7 +42,7 @@ var __NOTIFY_CLIENT__;
42
42
  const __UVE_EVENTS__ = {
43
43
  changes: callback => {
44
44
  const messageCallback = event => {
45
- if (event.data.name === __NOTIFY_CLIENT__.UVE_SET_PAGE_DATA) {
45
+ if (event.data.name === __DOTCMS_UVE_EVENT__.UVE_SET_PAGE_DATA) {
46
46
  callback(event.data.payload);
47
47
  }
48
48
  };
@@ -70,4 +70,4 @@ const __UVE_EVENT_ERROR_FALLBACK__ = event => {
70
70
  };
71
71
  };
72
72
 
73
- export { __NOTIFY_CLIENT__, __UVE_EVENTS__, __UVE_EVENT_ERROR_FALLBACK__ };
73
+ export { __DOTCMS_UVE_EVENT__, __UVE_EVENTS__, __UVE_EVENT_ERROR_FALLBACK__ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dotcms/uve",
3
- "version": "0.0.1-beta.8",
3
+ "version": "0.0.1-beta.9",
4
4
  "description": "Official JavaScript library for interacting with Universal Visual Editor (UVE)",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1,4 +1,4 @@
1
- import { UVEEvent } from '../lib/types';
1
+ import { UVEEvent } from '../lib/types/editor/public';
2
2
  /**
3
3
  * Events that can be subscribed to in the UVE
4
4
  *
@@ -1,2 +1 @@
1
1
  export * from './constants';
2
- export * from './enums';
package/src/internal.d.ts CHANGED
@@ -1 +1,3 @@
1
1
  export * from './internal/index';
2
+ export * from './lib/types/editor/internal';
3
+ export * from './lib/types/events/internal';
@@ -0,0 +1,44 @@
1
+ import { DotCMSUVEAction } from './public';
2
+ /**
3
+ * @description Custom client parameters for fetching data.
4
+ */
5
+ export type DotCMSCustomerParams = {
6
+ depth: string;
7
+ };
8
+ /**
9
+ * Configuration for reordering a menu.
10
+ */
11
+ export interface DotCMSReorderMenuConfig {
12
+ /**
13
+ * The starting level of the menu to be reordered.
14
+ */
15
+ startLevel: number;
16
+ /**
17
+ * The depth of the menu levels to be reordered.
18
+ */
19
+ depth: number;
20
+ }
21
+ declare global {
22
+ interface Window {
23
+ dotCMSUVE: DotCMSUVE;
24
+ }
25
+ }
26
+ /**
27
+ * Post message props
28
+ *
29
+ * @export
30
+ * @template T
31
+ * @interface DotCMSUVEMessage
32
+ */
33
+ export type DotCMSUVEMessage<T> = {
34
+ action: DotCMSUVEAction;
35
+ payload?: T;
36
+ };
37
+ type DotCMSUVEFunction = (...args: any[]) => void;
38
+ export interface DotCMSUVE {
39
+ editContentlet: DotCMSUVEFunction;
40
+ initInlineEditing: DotCMSUVEFunction;
41
+ reorderMenu: DotCMSUVEFunction;
42
+ lastScrollYPosition: number;
43
+ }
44
+ export {};
@@ -0,0 +1,138 @@
1
+ /**
2
+ * Represents the state of the Universal Visual Editor (UVE)
3
+ * @interface
4
+ * @property {UVE_MODE} mode - The current mode of operation for UVE (EDIT, PREVIEW, LIVE, or UNKNOWN)
5
+ * @property {string | null} persona - The selected persona for content personalization
6
+ * @property {string | null} variantName - The name of the current content variant
7
+ * @property {string | null} experimentId - The identifier for the current A/B testing experiment
8
+ * @property {string | null} publishDate - The scheduled publish date for content
9
+ * @property {string | null} languageId - The identifier for the current language selection
10
+ */
11
+ export interface UVEState {
12
+ mode: UVE_MODE;
13
+ persona: string | null;
14
+ variantName: string | null;
15
+ experimentId: string | null;
16
+ publishDate: string | null;
17
+ languageId: string | null;
18
+ }
19
+ /**
20
+ * Possible modes of UVE (Universal Visual Editor)
21
+ * @enum {string}
22
+ *
23
+ * @property {string} LIVE - Shows published and future content
24
+ * @property {string} PREVIEW - Shows published and working content
25
+ * @property {string} EDIT - Enables content editing functionality in UVE
26
+ * @property {string} UNKNOWN - Error state, UVE should not remain in this mode
27
+ */
28
+ export declare enum UVE_MODE {
29
+ EDIT = "EDIT_MODE",
30
+ PREVIEW = "PREVIEW_MODE",
31
+ LIVE = "LIVE",
32
+ UNKNOWN = "UNKNOWN"
33
+ }
34
+ /**
35
+ * Callback function for UVE events
36
+ * @callback UVECallback
37
+ * @param {unknown} payload - The payload of the event
38
+ */
39
+ export type UVECallback = (payload: unknown) => void;
40
+ /**
41
+ * Unsubscribe function for UVE events
42
+ * @callback UnsubscribeUVE
43
+ */
44
+ export type UnsubscribeUVE = () => void;
45
+ /**
46
+ * UVESubscription type
47
+ * @typedef {Object} UVESubscription
48
+ * @property {UnsubscribeUVE} unsubscribe - The unsubscribe function for the UVE event
49
+ * @property {string} event - The event name
50
+ */
51
+ export type UVESubscription = {
52
+ unsubscribe: UnsubscribeUVE;
53
+ event: string;
54
+ };
55
+ /**
56
+ * UVE event type
57
+ * @typedef {function} UVEEvent
58
+ */
59
+ export type UVEEvent = (callback: UVECallback) => UVESubscription;
60
+ /**
61
+ * Configuration type for DotCMS Editor
62
+ * @typedef {Object} DotCMSEditoConfig
63
+ * @property {Object} [params] - Parameters for Page API configuration
64
+ * @property {number} [params.depth] - The depth level for fetching page data
65
+ * @property {string} [query] - GraphQL query string for data fetching
66
+ */
67
+ export type DotCMSEditorConfig = {
68
+ params: {
69
+ depth: number;
70
+ };
71
+ } | {
72
+ query: string;
73
+ };
74
+ /**
75
+ * Actions send to the dotcms editor
76
+ *
77
+ * @export
78
+ * @enum {number}
79
+ */
80
+ export declare enum DotCMSUVEAction {
81
+ /**
82
+ * Tell the dotcms editor that page change
83
+ */
84
+ NAVIGATION_UPDATE = "set-url",
85
+ /**
86
+ * Send the element position of the rows, columnsm containers and contentlets
87
+ */
88
+ SET_BOUNDS = "set-bounds",
89
+ /**
90
+ * Send the information of the hovered contentlet
91
+ */
92
+ SET_CONTENTLET = "set-contentlet",
93
+ /**
94
+ * Tell the editor that the page is being scrolled
95
+ */
96
+ IFRAME_SCROLL = "scroll",
97
+ /**
98
+ * Tell the editor that the page has stopped scrolling
99
+ */
100
+ IFRAME_SCROLL_END = "scroll-end",
101
+ /**
102
+ * Ping the editor to see if the page is inside the editor
103
+ */
104
+ PING_EDITOR = "ping-editor",
105
+ /**
106
+ * Tell the editor to init the inline editing editor.
107
+ */
108
+ INIT_INLINE_EDITING = "init-inline-editing",
109
+ /**
110
+ * Tell the editor to open the Copy-contentlet dialog
111
+ * To copy a content and then edit it inline.
112
+ */
113
+ COPY_CONTENTLET_INLINE_EDITING = "copy-contentlet-inline-editing",
114
+ /**
115
+ * Tell the editor to save inline edited contentlet
116
+ */
117
+ UPDATE_CONTENTLET_INLINE_EDITING = "update-contentlet-inline-editing",
118
+ /**
119
+ * Tell the editor to trigger a menu reorder
120
+ */
121
+ REORDER_MENU = "reorder-menu",
122
+ /**
123
+ * Tell the editor to send the page info to iframe
124
+ */
125
+ GET_PAGE_DATA = "get-page-data",
126
+ /**
127
+ * Tell the editor an user send a graphql query
128
+ */
129
+ CLIENT_READY = "client-ready",
130
+ /**
131
+ * Tell the editor to edit a contentlet
132
+ */
133
+ EDIT_CONTENTLET = "edit-contentlet",
134
+ /**
135
+ * Tell the editor to do nothing
136
+ */
137
+ NOOP = "noop"
138
+ }
@@ -1,10 +1,10 @@
1
1
  /**
2
- * Actions received from the dotCMS UVE
2
+ * Actions received from the dotcms editor
3
3
  *
4
- * @internal
5
- * @enum {string}
4
+ * @export
5
+ * @enum {number}
6
6
  */
7
- export declare enum __NOTIFY_CLIENT__ {
7
+ export declare enum __DOTCMS_UVE_EVENT__ {
8
8
  /**
9
9
  * Request to page to reload
10
10
  */
@@ -0,0 +1,18 @@
1
+ export type DotCMSInlineEditingType = 'BLOCK_EDITOR' | 'WYSIWYG';
2
+ /**
3
+ * Interface representing the data needed for inline editing in DotCMS
4
+ *
5
+ * @interface DotCMSInlineEditorData
6
+ * @property {string} inode - The inode identifier of the content being edited
7
+ * @property {number} language - The language ID of the content
8
+ * @property {string} contentType - The content type identifier
9
+ * @property {string} fieldName - The name of the field being edited
10
+ * @property {Record<string, unknown>} content - The content data as key-value pairs
11
+ */
12
+ export interface DotCMSInlineEditingPayload {
13
+ inode: string;
14
+ language: number;
15
+ contentType: string;
16
+ fieldName: string;
17
+ content: Record<string, unknown>;
18
+ }
@@ -1,4 +1,4 @@
1
- import { UVECallback, UVEState, UVESubscription } from './types';
1
+ import { UVECallback, UVEState, UVESubscription } from './types/editor/public';
2
2
  /**
3
3
  * Gets the current state of the Universal Visual Editor (UVE).
4
4
  *
package/src/types.d.ts CHANGED
@@ -1 +1,2 @@
1
- export * from './lib/types';
1
+ export * from './lib/types/editor/public';
2
+ export * from './lib/types/events/public';
package/types.cjs.js CHANGED
@@ -16,3 +16,69 @@ exports.UVE_MODE = void 0;
16
16
  UVE_MODE["LIVE"] = "LIVE";
17
17
  UVE_MODE["UNKNOWN"] = "UNKNOWN";
18
18
  })(exports.UVE_MODE || (exports.UVE_MODE = {}));
19
+ /**
20
+ * Actions send to the dotcms editor
21
+ *
22
+ * @export
23
+ * @enum {number}
24
+ */
25
+ exports.DotCMSUVEAction = void 0;
26
+ (function (DotCMSUVEAction) {
27
+ /**
28
+ * Tell the dotcms editor that page change
29
+ */
30
+ DotCMSUVEAction["NAVIGATION_UPDATE"] = "set-url";
31
+ /**
32
+ * Send the element position of the rows, columnsm containers and contentlets
33
+ */
34
+ DotCMSUVEAction["SET_BOUNDS"] = "set-bounds";
35
+ /**
36
+ * Send the information of the hovered contentlet
37
+ */
38
+ DotCMSUVEAction["SET_CONTENTLET"] = "set-contentlet";
39
+ /**
40
+ * Tell the editor that the page is being scrolled
41
+ */
42
+ DotCMSUVEAction["IFRAME_SCROLL"] = "scroll";
43
+ /**
44
+ * Tell the editor that the page has stopped scrolling
45
+ */
46
+ DotCMSUVEAction["IFRAME_SCROLL_END"] = "scroll-end";
47
+ /**
48
+ * Ping the editor to see if the page is inside the editor
49
+ */
50
+ DotCMSUVEAction["PING_EDITOR"] = "ping-editor";
51
+ /**
52
+ * Tell the editor to init the inline editing editor.
53
+ */
54
+ DotCMSUVEAction["INIT_INLINE_EDITING"] = "init-inline-editing";
55
+ /**
56
+ * Tell the editor to open the Copy-contentlet dialog
57
+ * To copy a content and then edit it inline.
58
+ */
59
+ DotCMSUVEAction["COPY_CONTENTLET_INLINE_EDITING"] = "copy-contentlet-inline-editing";
60
+ /**
61
+ * Tell the editor to save inline edited contentlet
62
+ */
63
+ DotCMSUVEAction["UPDATE_CONTENTLET_INLINE_EDITING"] = "update-contentlet-inline-editing";
64
+ /**
65
+ * Tell the editor to trigger a menu reorder
66
+ */
67
+ DotCMSUVEAction["REORDER_MENU"] = "reorder-menu";
68
+ /**
69
+ * Tell the editor to send the page info to iframe
70
+ */
71
+ DotCMSUVEAction["GET_PAGE_DATA"] = "get-page-data";
72
+ /**
73
+ * Tell the editor an user send a graphql query
74
+ */
75
+ DotCMSUVEAction["CLIENT_READY"] = "client-ready";
76
+ /**
77
+ * Tell the editor to edit a contentlet
78
+ */
79
+ DotCMSUVEAction["EDIT_CONTENTLET"] = "edit-contentlet";
80
+ /**
81
+ * Tell the editor to do nothing
82
+ */
83
+ DotCMSUVEAction["NOOP"] = "noop";
84
+ })(exports.DotCMSUVEAction || (exports.DotCMSUVEAction = {}));
package/types.esm.js CHANGED
@@ -14,5 +14,71 @@ var UVE_MODE;
14
14
  UVE_MODE["LIVE"] = "LIVE";
15
15
  UVE_MODE["UNKNOWN"] = "UNKNOWN";
16
16
  })(UVE_MODE || (UVE_MODE = {}));
17
+ /**
18
+ * Actions send to the dotcms editor
19
+ *
20
+ * @export
21
+ * @enum {number}
22
+ */
23
+ var DotCMSUVEAction;
24
+ (function (DotCMSUVEAction) {
25
+ /**
26
+ * Tell the dotcms editor that page change
27
+ */
28
+ DotCMSUVEAction["NAVIGATION_UPDATE"] = "set-url";
29
+ /**
30
+ * Send the element position of the rows, columnsm containers and contentlets
31
+ */
32
+ DotCMSUVEAction["SET_BOUNDS"] = "set-bounds";
33
+ /**
34
+ * Send the information of the hovered contentlet
35
+ */
36
+ DotCMSUVEAction["SET_CONTENTLET"] = "set-contentlet";
37
+ /**
38
+ * Tell the editor that the page is being scrolled
39
+ */
40
+ DotCMSUVEAction["IFRAME_SCROLL"] = "scroll";
41
+ /**
42
+ * Tell the editor that the page has stopped scrolling
43
+ */
44
+ DotCMSUVEAction["IFRAME_SCROLL_END"] = "scroll-end";
45
+ /**
46
+ * Ping the editor to see if the page is inside the editor
47
+ */
48
+ DotCMSUVEAction["PING_EDITOR"] = "ping-editor";
49
+ /**
50
+ * Tell the editor to init the inline editing editor.
51
+ */
52
+ DotCMSUVEAction["INIT_INLINE_EDITING"] = "init-inline-editing";
53
+ /**
54
+ * Tell the editor to open the Copy-contentlet dialog
55
+ * To copy a content and then edit it inline.
56
+ */
57
+ DotCMSUVEAction["COPY_CONTENTLET_INLINE_EDITING"] = "copy-contentlet-inline-editing";
58
+ /**
59
+ * Tell the editor to save inline edited contentlet
60
+ */
61
+ DotCMSUVEAction["UPDATE_CONTENTLET_INLINE_EDITING"] = "update-contentlet-inline-editing";
62
+ /**
63
+ * Tell the editor to trigger a menu reorder
64
+ */
65
+ DotCMSUVEAction["REORDER_MENU"] = "reorder-menu";
66
+ /**
67
+ * Tell the editor to send the page info to iframe
68
+ */
69
+ DotCMSUVEAction["GET_PAGE_DATA"] = "get-page-data";
70
+ /**
71
+ * Tell the editor an user send a graphql query
72
+ */
73
+ DotCMSUVEAction["CLIENT_READY"] = "client-ready";
74
+ /**
75
+ * Tell the editor to edit a contentlet
76
+ */
77
+ DotCMSUVEAction["EDIT_CONTENTLET"] = "edit-contentlet";
78
+ /**
79
+ * Tell the editor to do nothing
80
+ */
81
+ DotCMSUVEAction["NOOP"] = "noop";
82
+ })(DotCMSUVEAction || (DotCMSUVEAction = {}));
17
83
 
18
- export { UVE_MODE };
84
+ export { DotCMSUVEAction, UVE_MODE };
@@ -1,59 +0,0 @@
1
- /**
2
- * Represents the state of the Universal Visual Editor (UVE)
3
- * @interface
4
- * @property {UVE_MODE} mode - The current mode of operation for UVE (EDIT, PREVIEW, LIVE, or UNKNOWN)
5
- * @property {string | null} persona - The selected persona for content personalization
6
- * @property {string | null} variantName - The name of the current content variant
7
- * @property {string | null} experimentId - The identifier for the current A/B testing experiment
8
- * @property {string | null} publishDate - The scheduled publish date for content
9
- * @property {string | null} languageId - The identifier for the current language selection
10
- */
11
- export interface UVEState {
12
- mode: UVE_MODE;
13
- persona: string | null;
14
- variantName: string | null;
15
- experimentId: string | null;
16
- publishDate: string | null;
17
- languageId: string | null;
18
- }
19
- /**
20
- * Possible modes of UVE (Universal Visual Editor)
21
- * @enum {string}
22
- *
23
- * @property {string} LIVE - Shows published and future content
24
- * @property {string} PREVIEW - Shows published and working content
25
- * @property {string} EDIT - Enables content editing functionality in UVE
26
- * @property {string} UNKNOWN - Error state, UVE should not remain in this mode
27
- */
28
- export declare enum UVE_MODE {
29
- EDIT = "EDIT_MODE",
30
- PREVIEW = "PREVIEW_MODE",
31
- LIVE = "LIVE",
32
- UNKNOWN = "UNKNOWN"
33
- }
34
- /**
35
- * Callback function for UVE events
36
- * @callback UVECallback
37
- * @param {unknown} payload - The payload of the event
38
- */
39
- export type UVECallback = (payload: unknown) => void;
40
- /**
41
- * Unsubscribe function for UVE events
42
- * @callback UnsubscribeUVE
43
- */
44
- export type UnsubscribeUVE = () => void;
45
- /**
46
- * UVESubscription type
47
- * @typedef {Object} UVESubscription
48
- * @property {UnsubscribeUVE} unsubscribe - The unsubscribe function for the UVE event
49
- * @property {string} event - The event name
50
- */
51
- export type UVESubscription = {
52
- unsubscribe: UnsubscribeUVE;
53
- event: string;
54
- };
55
- /**
56
- * UVE event type
57
- * @typedef {function} UVEEvent
58
- */
59
- export type UVEEvent = (callback: UVECallback) => UVESubscription;