@crownpeak/dqm-react-component 1.0.1 → 1.1.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/CHANGELOG.md +25 -0
- package/DEVELOPMENT.md +36 -1
- package/EXAMPLES.md +187 -0
- package/QUICKSTART.md +7 -0
- package/README.md +75 -1
- package/dist/DQMSidebar.d.ts.map +1 -1
- package/dist/components/sidebar/CloseButton.d.ts +6 -0
- package/dist/components/sidebar/CloseButton.d.ts.map +1 -0
- package/dist/components/sidebar/SidebarContent.d.ts.map +1 -1
- package/dist/components/sidebar/SidebarFooter.d.ts.map +1 -1
- package/dist/components/sidebar/SidebarHeader.d.ts.map +1 -1
- package/dist/components/sidebar/SidebarSkeleton.d.ts.map +1 -1
- package/dist/components/sidebar/StyledDrawer.d.ts +6 -1
- package/dist/components/sidebar/StyledDrawer.d.ts.map +1 -1
- package/dist/components/sidebar/StyledFab.d.ts +4 -1
- package/dist/components/sidebar/StyledFab.d.ts.map +1 -1
- package/dist/dqm-widget.d.ts +107 -0
- package/dist/dqm-widget.esm.js +386 -0
- package/dist/dqm-widget.iife.js +132 -0
- package/dist/html-pages/DQMWidget.d.ts +36 -0
- package/dist/html-pages/DQMWidget.d.ts.map +1 -0
- package/dist/html-pages/index.d.ts +32 -0
- package/dist/html-pages/index.d.ts.map +1 -0
- package/dist/index.cjs +26 -26
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.html +498 -0
- package/dist/index.js +4061 -3839
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +83 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/useDomPresence.d.ts +210 -0
- package/dist/utils/useDomPresence.d.ts.map +1 -0
- package/package.json +12 -3
package/dist/types.d.ts
CHANGED
|
@@ -9,6 +9,70 @@ export interface OAuth2Config {
|
|
|
9
9
|
redirectUri: string;
|
|
10
10
|
scope?: string;
|
|
11
11
|
}
|
|
12
|
+
/**
|
|
13
|
+
* Position for manual overlay offset configuration.
|
|
14
|
+
* Specifies from which edge the offset should be applied.
|
|
15
|
+
*/
|
|
16
|
+
export type OverlayOffsetPosition = 'top' | 'bottom' | 'left' | 'right';
|
|
17
|
+
/**
|
|
18
|
+
* Configuration for overlay/toolbar detection and offset handling.
|
|
19
|
+
*
|
|
20
|
+
* Use this to configure how the DQM sidebar adapts to overlays like
|
|
21
|
+
* toolbars or other fixed elements on the page.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* // Manual offset for a 50px toolbar at the top
|
|
25
|
+
* overlayConfig: {
|
|
26
|
+
* manualOffset: {
|
|
27
|
+
* position: 'top',
|
|
28
|
+
* pixels: 50
|
|
29
|
+
* }
|
|
30
|
+
* }
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* // Custom selector with iFrame content validation
|
|
34
|
+
* overlayConfig: {
|
|
35
|
+
* selector: 'iframe.my-toolbar',
|
|
36
|
+
* validateIframe: true
|
|
37
|
+
* }
|
|
38
|
+
*/
|
|
39
|
+
export interface OverlayConfig {
|
|
40
|
+
/**
|
|
41
|
+
* CSS selector for the overlay element to detect.
|
|
42
|
+
*
|
|
43
|
+
* Set to `null` or empty string to disable auto-detection.
|
|
44
|
+
*/
|
|
45
|
+
selector?: string | null;
|
|
46
|
+
/**
|
|
47
|
+
* Whether to validate iFrame elements by checking if contentWindow exists.
|
|
48
|
+
* Only applies when the detected element is an iFrame.
|
|
49
|
+
* Default: true
|
|
50
|
+
*/
|
|
51
|
+
validateIframe?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Polling interval in milliseconds for detecting overlay changes.
|
|
54
|
+
* Useful for cross-origin iFrames where MutationObserver can't detect internal changes.
|
|
55
|
+
* Set to 0 to disable polling.
|
|
56
|
+
* Default: 1000
|
|
57
|
+
*/
|
|
58
|
+
pollMs?: number;
|
|
59
|
+
/**
|
|
60
|
+
* Manual offset configuration. Use this when auto-detection doesn't work,
|
|
61
|
+
* e.g., for iFrames that fill the whole screen but have smaller internal content.
|
|
62
|
+
*
|
|
63
|
+
* When set, this takes precedence over auto-detected values.
|
|
64
|
+
*/
|
|
65
|
+
manualOffset?: {
|
|
66
|
+
/**
|
|
67
|
+
* The edge from which to apply the offset.
|
|
68
|
+
*/
|
|
69
|
+
position: OverlayOffsetPosition;
|
|
70
|
+
/**
|
|
71
|
+
* The offset value in pixels.
|
|
72
|
+
*/
|
|
73
|
+
pixels: number;
|
|
74
|
+
};
|
|
75
|
+
}
|
|
12
76
|
export interface DQMConfig {
|
|
13
77
|
apiKey?: string;
|
|
14
78
|
websiteId?: string;
|
|
@@ -16,7 +80,26 @@ export interface DQMConfig {
|
|
|
16
80
|
oauth2Config?: OAuth2Config;
|
|
17
81
|
useLocalStorage?: boolean;
|
|
18
82
|
disabled?: boolean;
|
|
83
|
+
disableLogout?: boolean;
|
|
19
84
|
apiEndpoint?: string;
|
|
85
|
+
shadowDomMode?: boolean;
|
|
86
|
+
/**
|
|
87
|
+
* Configuration for overlay detection and offset handling.
|
|
88
|
+
*
|
|
89
|
+
* Use this to adapt the sidebar position to fixed overlays like
|
|
90
|
+
* preview bars, admin toolbars, or other fixed-position elements.
|
|
91
|
+
*
|
|
92
|
+
* @example
|
|
93
|
+
* // Disable overlay detection
|
|
94
|
+
* overlayConfig: { selector: null }
|
|
95
|
+
*
|
|
96
|
+
* @example
|
|
97
|
+
* // Manual 50px offset from top
|
|
98
|
+
* overlayConfig: { manualOffset: { position: 'top', pixels: 50 } }
|
|
99
|
+
*
|
|
100
|
+
* @see OverlayConfig for all available options
|
|
101
|
+
*/
|
|
102
|
+
overlayConfig?: OverlayConfig;
|
|
20
103
|
}
|
|
21
104
|
export interface DQMSidebarProps {
|
|
22
105
|
open: boolean;
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AACA,OA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
|
1
|
+
/**
|
|
2
|
+
* Describes the position of an overlay element relative to the viewport.
|
|
3
|
+
*
|
|
4
|
+
* - `'top'`: Element is anchored to the top edge (e.g., preview bars, toolbars)
|
|
5
|
+
* - `'bottom'`: Element is anchored to the bottom edge (e.g., cookie banners)
|
|
6
|
+
* - `'left'`: Element is anchored to the left edge (e.g., navigation sidebars)
|
|
7
|
+
* - `'right'`: Element is anchored to the right edge (e.g., chat widgets)
|
|
8
|
+
* - `'center'`: Element is floating in the center (e.g., modals)
|
|
9
|
+
* - `null`: No element present or position cannot be determined
|
|
10
|
+
*/
|
|
11
|
+
export type OverlayPosition = 'top' | 'bottom' | 'left' | 'right' | 'center' | null;
|
|
12
|
+
/**
|
|
13
|
+
* Represents the bounding rectangle of a DOM element.
|
|
14
|
+
* All values are in pixels relative to the viewport.
|
|
15
|
+
*
|
|
16
|
+
* @interface ElementRect
|
|
17
|
+
* @property {number} height - The height of the element in pixels
|
|
18
|
+
* @property {number} width - The width of the element in pixels
|
|
19
|
+
* @property {number} top - Distance from the top of the viewport to the element's top edge
|
|
20
|
+
* @property {number} bottom - Distance from the top of the viewport to the element's bottom edge
|
|
21
|
+
* @property {number} left - Distance from the left of the viewport to the element's left edge
|
|
22
|
+
* @property {number} right - Distance from the left of the viewport to the element's right edge
|
|
23
|
+
*/
|
|
24
|
+
export interface ElementRect {
|
|
25
|
+
height: number;
|
|
26
|
+
width: number;
|
|
27
|
+
top: number;
|
|
28
|
+
bottom: number;
|
|
29
|
+
left: number;
|
|
30
|
+
right: number;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Result object returned by the useDomPresence hook.
|
|
34
|
+
*
|
|
35
|
+
* @interface DomPresenceResult
|
|
36
|
+
* @property {boolean} present - Whether the element is currently present in the DOM
|
|
37
|
+
* and passes the optional validation check
|
|
38
|
+
* @property {ElementRect | null} rect - The element's bounding rectangle, or null if not present.
|
|
39
|
+
* Updated on DOM mutations, window resize, and polling (if enabled).
|
|
40
|
+
* @property {OverlayPosition} position - The detected position of the element relative to
|
|
41
|
+
* the viewport edges. Useful for determining how to adjust other UI elements.
|
|
42
|
+
* @property {Object} contentOffset - Calculated offsets indicating where main content
|
|
43
|
+
* should begin to avoid being obscured by the overlay element.
|
|
44
|
+
* @property {number} contentOffset.top - Pixels to offset from the top
|
|
45
|
+
* @property {number} contentOffset.bottom - Pixels to offset from the bottom
|
|
46
|
+
* @property {number} contentOffset.left - Pixels to offset from the left
|
|
47
|
+
* @property {number} contentOffset.right - Pixels to offset from the right
|
|
48
|
+
*/
|
|
49
|
+
export interface DomPresenceResult {
|
|
50
|
+
present: boolean;
|
|
51
|
+
rect: ElementRect | null;
|
|
52
|
+
position: OverlayPosition;
|
|
53
|
+
contentOffset: {
|
|
54
|
+
top: number;
|
|
55
|
+
bottom: number;
|
|
56
|
+
left: number;
|
|
57
|
+
right: number;
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Configuration options for the useOverlayResistant hook.
|
|
62
|
+
* Matches the OverlayConfig interface from types.ts.
|
|
63
|
+
*
|
|
64
|
+
* @interface UseOverlayResistantConfig
|
|
65
|
+
*/
|
|
66
|
+
export interface UseOverlayResistantConfig {
|
|
67
|
+
/**
|
|
68
|
+
* CSS selector for the overlay element to detect.
|
|
69
|
+
*
|
|
70
|
+
* Set to `null` or empty string to disable auto-detection.
|
|
71
|
+
*/
|
|
72
|
+
selector?: string | null;
|
|
73
|
+
/**
|
|
74
|
+
* Whether to validate iFrame elements by checking if contentWindow exists.
|
|
75
|
+
* Only applies when the detected element is an iFrame.
|
|
76
|
+
* Default: true
|
|
77
|
+
*/
|
|
78
|
+
validateIframe?: boolean;
|
|
79
|
+
/**
|
|
80
|
+
* Polling interval in milliseconds for detecting overlay changes.
|
|
81
|
+
* Useful for cross-origin iFrames where MutationObserver can't detect internal changes.
|
|
82
|
+
* Set to 0 to disable polling.
|
|
83
|
+
* Default: 1000
|
|
84
|
+
*/
|
|
85
|
+
pollMs?: number;
|
|
86
|
+
/**
|
|
87
|
+
* Manual offset configuration. Use this when auto-detection doesn't work,
|
|
88
|
+
* e.g., for iFrames that fill the whole screen but have smaller internal content.
|
|
89
|
+
*
|
|
90
|
+
* When set, this takes precedence over auto-detected values.
|
|
91
|
+
*/
|
|
92
|
+
manualOffset?: {
|
|
93
|
+
/**
|
|
94
|
+
* The edge from which to apply the offset.
|
|
95
|
+
*/
|
|
96
|
+
position: 'top' | 'bottom' | 'left' | 'right';
|
|
97
|
+
/**
|
|
98
|
+
* The offset value in pixels.
|
|
99
|
+
*/
|
|
100
|
+
pixels: number;
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Result object returned by the useOverlayResistant hook.
|
|
105
|
+
*
|
|
106
|
+
* This interface provides a simplified view focused on overlay dimensions
|
|
107
|
+
* and positioning for generic overlay/toolbars.
|
|
108
|
+
*
|
|
109
|
+
* @interface OverlayInfo
|
|
110
|
+
* @property {boolean} present - Whether the overlay element is currently visible
|
|
111
|
+
* @property {number} height - Height of the overlay in pixels (0 if not present)
|
|
112
|
+
* @property {number} width - Width of the overlay in pixels (0 if not present)
|
|
113
|
+
* @property {OverlayPosition} position - Position of the overlay ('top', 'bottom', etc.)
|
|
114
|
+
* @property {Object} contentOffset - Space to reserve for the overlay
|
|
115
|
+
* @property {number} contentOffset.top - Offset from top in pixels
|
|
116
|
+
* @property {number} contentOffset.bottom - Offset from bottom in pixels
|
|
117
|
+
* @property {number} contentOffset.left - Offset from left in pixels
|
|
118
|
+
* @property {number} contentOffset.right - Offset from right in pixels
|
|
119
|
+
* @property {boolean} isManualOffset - Whether the offset is from manual configuration
|
|
120
|
+
*/
|
|
121
|
+
export interface OverlayInfo {
|
|
122
|
+
present: boolean;
|
|
123
|
+
height: number;
|
|
124
|
+
width: number;
|
|
125
|
+
position: OverlayPosition;
|
|
126
|
+
contentOffset: {
|
|
127
|
+
top: number;
|
|
128
|
+
bottom: number;
|
|
129
|
+
left: number;
|
|
130
|
+
right: number;
|
|
131
|
+
};
|
|
132
|
+
/** True if the offset is from manual configuration rather than auto-detection */
|
|
133
|
+
isManualOffset: boolean;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* React hook that detects and tracks overlay elements (e.g., preview bars, toolbars).
|
|
137
|
+
*
|
|
138
|
+
* This hook is designed for handling overlays like preview bars or admin toolbars.
|
|
139
|
+
* It provides information about the overlay's presence, dimensions, and position
|
|
140
|
+
* to allow UI components to adjust their layout accordingly.
|
|
141
|
+
*
|
|
142
|
+
* ## Features
|
|
143
|
+
*
|
|
144
|
+
* - **Configurable Selector**: Detect any overlay element via CSS selector
|
|
145
|
+
* - **iFrame Validation**: Optionally validates iFrame's `contentWindow` availability
|
|
146
|
+
* - **Resilient Polling**: Configurable polling interval for cross-origin iFrames
|
|
147
|
+
* - **Position Detection**: Automatically detects overlay position (top/bottom/left/right)
|
|
148
|
+
* - **Manual Override**: Supports manual offset for cases where auto-detection fails
|
|
149
|
+
* - **Content Offset Calculation**: Provides ready-to-use offset values
|
|
150
|
+
*
|
|
151
|
+
* ## Manual Offset
|
|
152
|
+
*
|
|
153
|
+
* For cross-origin iFrames that fill the entire viewport but have smaller internal
|
|
154
|
+
* content (e.g., a 50px toolbar inside a full-screen iFrame), use `manualOffset`.
|
|
155
|
+
*
|
|
156
|
+
* **Important**: The `manualOffset` is only applied when the element matching the
|
|
157
|
+
* `selector` is actually present in the DOM. The hook always observes the selector
|
|
158
|
+
* via MutationObserver, so the offset will automatically appear/disappear when
|
|
159
|
+
* the element is added/removed.
|
|
160
|
+
*
|
|
161
|
+
* ```tsx
|
|
162
|
+
* // Applies 50px offset only when the element matching the selector exists
|
|
163
|
+
* useOverlayResistant({
|
|
164
|
+
* selector: 'iframe#my-overlay',
|
|
165
|
+
* manualOffset: { position: 'top', pixels: 50 }
|
|
166
|
+
* })
|
|
167
|
+
* ```
|
|
168
|
+
*
|
|
169
|
+
* @param {UseOverlayResistantConfig} [config] - Configuration options
|
|
170
|
+
* @returns {OverlayInfo} Object with presence, dimensions, position, and content offset
|
|
171
|
+
*
|
|
172
|
+
* @example
|
|
173
|
+
* // Custom selector
|
|
174
|
+
* const toolbar = useOverlayResistant({
|
|
175
|
+
* selector: '.admin-toolbar',
|
|
176
|
+
* validateIframe: false
|
|
177
|
+
* });
|
|
178
|
+
*
|
|
179
|
+
* @example
|
|
180
|
+
* // Manual offset for cross-origin iFrame with 50px internal toolbar
|
|
181
|
+
* const overlay = useOverlayResistant({
|
|
182
|
+
* manualOffset: { position: 'top', pixels: 50 }
|
|
183
|
+
* });
|
|
184
|
+
*
|
|
185
|
+
* @example
|
|
186
|
+
* // Disable overlay detection entirely
|
|
187
|
+
* const noOverlay = useOverlayResistant({ selector: null });
|
|
188
|
+
*
|
|
189
|
+
* @example
|
|
190
|
+
* // Full sidebar positioning with config
|
|
191
|
+
* function DQMSidebarContainer({ overlayConfig }) {
|
|
192
|
+
* const overlay = useOverlayResistant(overlayConfig);
|
|
193
|
+
*
|
|
194
|
+
* return (
|
|
195
|
+
* <aside
|
|
196
|
+
* style={{
|
|
197
|
+
* position: 'fixed',
|
|
198
|
+
* top: overlay.contentOffset.top,
|
|
199
|
+
* right: 0,
|
|
200
|
+
* bottom: overlay.contentOffset.bottom,
|
|
201
|
+
* height: `calc(100vh - ${overlay.contentOffset.top + overlay.contentOffset.bottom}px)`,
|
|
202
|
+
* }}
|
|
203
|
+
* >
|
|
204
|
+
* <DQMSidebar />
|
|
205
|
+
* </aside>
|
|
206
|
+
* );
|
|
207
|
+
* }
|
|
208
|
+
*/
|
|
209
|
+
export declare const useOverlayResistant: (config?: UseOverlayResistantConfig) => OverlayInfo;
|
|
210
|
+
//# sourceMappingURL=useDomPresence.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDomPresence.d.ts","sourceRoot":"","sources":["../../src/utils/useDomPresence.tsx"],"names":[],"mappings":"AAeA;;;;;;;;;GASG;AACH,MAAM,MAAM,eAAe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M,CAAC;QACZ,MAAM,EAAE,MAAM,CAAC;QACf,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,MAAM,CAAC;KACjB,CAAC;IACF,iFAAiF;IACjF,cAAc,EAAE,OAAO,CAAC;CAC3B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyEG;AACH,eAAO,MAAM,mBAAmB,GAAI,SAAS,yBAAyB,KAAG,WA4ExE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crownpeak/dqm-react-component",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "A React component for Crownpeak Digital Quality Management (DQM) integration",
|
|
6
6
|
"type": "module",
|
|
@@ -14,10 +14,17 @@
|
|
|
14
14
|
"require": "./dist/index.cjs",
|
|
15
15
|
"default": "./dist/index.js"
|
|
16
16
|
},
|
|
17
|
+
"./widget": {
|
|
18
|
+
"types": "./dist/dqm-widget.d.ts",
|
|
19
|
+
"import": "./dist/dqm-widget.esm.js",
|
|
20
|
+
"default": "./dist/dqm-widget.esm.js"
|
|
21
|
+
},
|
|
17
22
|
"./dist/*": "./dist/*",
|
|
18
23
|
"./package.json": "./package.json"
|
|
19
24
|
},
|
|
20
|
-
"sideEffects":
|
|
25
|
+
"sideEffects": [
|
|
26
|
+
"./dist/dqm-widget.iife.js"
|
|
27
|
+
],
|
|
21
28
|
"files": [
|
|
22
29
|
"dist",
|
|
23
30
|
"README.md",
|
|
@@ -55,12 +62,14 @@
|
|
|
55
62
|
"dev:client": "vite",
|
|
56
63
|
"dev:server": "REDIS_URL=redis://localhost:6379 tsx watch server/index.ts",
|
|
57
64
|
"dev:auth-ui": "cd server-ui && vite",
|
|
58
|
-
"build": "npm run build:lib && npm run build:server && npm run build:auth-ui",
|
|
65
|
+
"build": "npm run build:lib && npm run build:widget && npm run build:server && npm run build:auth-ui",
|
|
59
66
|
"build:lib": "tsc && vite build --mode library",
|
|
67
|
+
"build:widget": "vite build --mode widget && cp src/html-pages/dqm-widget.d.ts dist/",
|
|
60
68
|
"build:server": "tsc -p tsconfig.server.json",
|
|
61
69
|
"build:auth-ui": "cd server-ui && vite build",
|
|
62
70
|
"start": "npm run build && concurrently \"npm run start:server\" \"vite\"",
|
|
63
71
|
"start:server": "REDIS_URL=redis://localhost:6379 node dist/server/index.js",
|
|
72
|
+
"serve:widget": "npx serve -l 4173 -c serve.json",
|
|
64
73
|
"prepublishOnly": "npm run build && npm run lint",
|
|
65
74
|
"lint": "eslint . || true",
|
|
66
75
|
"preview": "vite preview --host"
|