@widgetic/embed-sdk 0.0.0-stage → 2.0.6
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/README.md +567 -2
- package/dist/browser/chunks/ABTestManager.js +1 -0
- package/dist/browser/chunks/advanced.js +1 -0
- package/dist/browser/chunks/api.js +1 -0
- package/dist/browser/chunks/core.js +1 -0
- package/dist/browser/chunks/display.js +1 -0
- package/dist/browser/chunks/media.js +1 -0
- package/dist/browser/chunks/messaging.js +1 -0
- package/dist/browser/chunks/performance.js +1 -0
- package/dist/browser/chunks/renderers.js +1 -0
- package/dist/browser/chunks/scanner.js +1 -0
- package/dist/browser/chunks/security.js +1 -0
- package/dist/browser/chunks/vendor.js +1 -0
- package/dist/browser/embed-bootstrap.js +1 -0
- package/dist/browser/embed-sdk.js +1 -0
- package/dist/esm/chunks/ABTestManager.js +1 -0
- package/dist/esm/chunks/advanced.js +1 -0
- package/dist/esm/chunks/api.js +1 -0
- package/dist/esm/chunks/core.js +1 -0
- package/dist/esm/chunks/display.js +1 -0
- package/dist/esm/chunks/media.js +1 -0
- package/dist/esm/chunks/messaging.js +1 -0
- package/dist/esm/chunks/performance.js +1 -0
- package/dist/esm/chunks/renderers.js +1 -0
- package/dist/esm/chunks/scanner.js +1 -0
- package/dist/esm/chunks/security.js +1 -0
- package/dist/esm/chunks/vendor.js +1 -0
- package/dist/esm/embed-bootstrap.js +1 -0
- package/dist/esm/embed-sdk.js +1 -0
- package/dist/esm/types/abTesting/ABTestElement.d.ts +120 -0
- package/dist/esm/types/abTesting/ABTestManager.d.ts +177 -0
- package/dist/esm/types/api/batch-client.d.ts +163 -0
- package/dist/esm/types/api/layers.d.ts +119 -0
- package/dist/esm/types/core/advanced-security-manager.d.ts +330 -0
- package/dist/esm/types/core/analytics-tracker.d.ts +224 -0
- package/dist/esm/types/core/auth-detector.d.ts +65 -0
- package/dist/esm/types/core/auth-manager.d.ts +90 -0
- package/dist/esm/types/core/autoscale-manager.d.ts +91 -0
- package/dist/esm/types/core/breakpoints.d.ts +48 -0
- package/dist/esm/types/core/config.d.ts +152 -0
- package/dist/esm/types/core/constants.d.ts +75 -0
- package/dist/esm/types/core/content-position-manager.d.ts +228 -0
- package/dist/esm/types/core/custom-element.d.ts +152 -0
- package/dist/esm/types/core/display-manager.d.ts +109 -0
- package/dist/esm/types/core/editor-overlay.d.ts +113 -0
- package/dist/esm/types/core/embed-sdk.d.ts +310 -0
- package/dist/esm/types/core/exit-intent-trigger.d.ts +114 -0
- package/dist/esm/types/core/lazy-loader.d.ts +111 -0
- package/dist/esm/types/core/media-manager.d.ts +364 -0
- package/dist/esm/types/core/messaging.d.ts +251 -0
- package/dist/esm/types/core/overlay-manager.d.ts +119 -0
- package/dist/esm/types/core/performance-monitor.d.ts +152 -0
- package/dist/esm/types/core/privacy-compliance.d.ts +236 -0
- package/dist/esm/types/core/realtime-manager.d.ts +279 -0
- package/dist/esm/types/core/resize-handler.d.ts +81 -0
- package/dist/esm/types/core/resource-optimizer.d.ts +133 -0
- package/dist/esm/types/core/responsive-manager.d.ts +49 -0
- package/dist/esm/types/core/scroll-trigger.d.ts +105 -0
- package/dist/esm/types/core/security-manager.d.ts +150 -0
- package/dist/esm/types/core/text-field-manager.d.ts +204 -0
- package/dist/esm/types/core/token-provider.d.ts +75 -0
- package/dist/esm/types/core/trigger-defaults.d.ts +36 -0
- package/dist/esm/types/core/trigger-manager.d.ts +248 -0
- package/dist/esm/types/core/types.d.ts +473 -0
- package/dist/esm/types/core/ui-sdk-loader.d.ts +90 -0
- package/dist/esm/types/core/widget-manager.d.ts +285 -0
- package/dist/esm/types/core/widget-metadata.d.ts +107 -0
- package/dist/esm/types/embed-sdk.d.ts +31 -0
- package/dist/esm/types/loaders/module-loader.d.ts +147 -0
- package/dist/esm/types/renderers/custom-element-renderer.d.ts +78 -0
- package/dist/esm/types/renderers/iframe-renderer.d.ts +185 -0
- package/dist/esm/types/renderers/widget-renderer.d.ts +173 -0
- package/dist/esm/types/sdk/embed-bootstrap.d.ts +84 -0
- package/dist/esm/types/sdk/embed-sdk.d.ts +31 -0
- package/dist/esm/types/translations/TranslationElement.d.ts +93 -0
- package/dist/esm/types/utils/browser.d.ts +29 -0
- package/dist/esm/types/utils/caseConversion.d.ts +2 -0
- package/dist/esm/types/utils/css-debug.d.ts +105 -0
- package/dist/esm/types/utils/device-detector.d.ts +100 -0
- package/dist/esm/types/utils/event-emitter.d.ts +14 -0
- package/dist/esm/types/utils/hydrate-published-host.d.ts +17 -0
- package/dist/esm/types/utils/logger.d.ts +31 -0
- package/dist/esm/types/utils/parser.d.ts +39 -0
- package/dist/esm/types/utils/portal.d.ts +74 -0
- package/dist/esm/types/utils/public-embed-lookup.d.ts +68 -0
- package/dist/esm/types/utils/published-host-display.d.ts +61 -0
- package/dist/umd/embed-bootstrap.js +1 -0
- package/dist/umd/embed-sdk.js +1 -0
- package/package.json +154 -4
|
@@ -0,0 +1,473 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type definitions for the Widgetic Embed SDK
|
|
3
|
+
* Simple tag detection + enhancement approach
|
|
4
|
+
*/
|
|
5
|
+
import type { AutoScaleConfig } from './autoscale-manager.js';
|
|
6
|
+
/**
|
|
7
|
+
* Render modes for embedding widgets
|
|
8
|
+
*/
|
|
9
|
+
export type RenderMode = "auto" | "iframe" | "custom-element";
|
|
10
|
+
/**
|
|
11
|
+
* Resize modes for widget responsiveness
|
|
12
|
+
*/
|
|
13
|
+
export type ResizeMode = "fill-width" | "fill-height" | "fixed" | "fixed-height" | "fixed-width" | "allow-scale-down" | "fill";
|
|
14
|
+
/**
|
|
15
|
+
* Display modes for widget presentation
|
|
16
|
+
*/
|
|
17
|
+
export type DisplayMode = "inline" | "overlay" | "popup" | "fullscreen" | "modal";
|
|
18
|
+
/**
|
|
19
|
+
* Overlay positioning options
|
|
20
|
+
*/
|
|
21
|
+
export type OverlayPosition = "center" | "top" | "bottom" | "left" | "right" | "top-left" | "top-right" | "bottom-left" | "bottom-right";
|
|
22
|
+
/**
|
|
23
|
+
* Fullscreen trigger options
|
|
24
|
+
*/
|
|
25
|
+
export type FullscreenTrigger = "auto" | "click" | "manual" | "double-click" | "hover";
|
|
26
|
+
/**
|
|
27
|
+
* Scroll trigger configuration
|
|
28
|
+
*/
|
|
29
|
+
export interface ScrollTriggerConfig {
|
|
30
|
+
/** Enable scroll triggers */
|
|
31
|
+
enabled: boolean;
|
|
32
|
+
/** Intersection threshold for viewport detection (0-1) */
|
|
33
|
+
threshold?: number;
|
|
34
|
+
/** Scroll distance in pixels to trigger overlay mode */
|
|
35
|
+
distance?: number;
|
|
36
|
+
/** Scroll direction to track */
|
|
37
|
+
direction?: 'up' | 'down' | 'any';
|
|
38
|
+
/** Debounce delay for scroll events in milliseconds */
|
|
39
|
+
debounce?: number;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Delay trigger configuration: show the overlay a fixed time after the widget
|
|
43
|
+
* is ready, whatever the visitor does in the meantime.
|
|
44
|
+
*/
|
|
45
|
+
export interface DelayTriggerConfig {
|
|
46
|
+
/** Enable the delay trigger */
|
|
47
|
+
enabled?: boolean;
|
|
48
|
+
/** Time to wait before the overlay appears, in milliseconds */
|
|
49
|
+
delayMs?: number;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Exit intent configuration for desktop
|
|
53
|
+
*/
|
|
54
|
+
export interface DesktopExitIntentConfig {
|
|
55
|
+
/** Enable desktop exit intent detection */
|
|
56
|
+
enabled: boolean;
|
|
57
|
+
/** Mouse sensitivity near viewport edge (pixels) */
|
|
58
|
+
sensitivity?: number;
|
|
59
|
+
/** Delay before triggering (milliseconds) */
|
|
60
|
+
delay?: number;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Exit intent configuration for mobile
|
|
64
|
+
*/
|
|
65
|
+
export interface MobileExitIntentConfig {
|
|
66
|
+
/** Enable mobile exit intent detection */
|
|
67
|
+
enabled: boolean;
|
|
68
|
+
/** Detect back button press */
|
|
69
|
+
backButton?: boolean;
|
|
70
|
+
/** Detect scroll up gestures */
|
|
71
|
+
scrollUp?: boolean;
|
|
72
|
+
/** Detect tab switching/app backgrounding */
|
|
73
|
+
tabSwitch?: boolean;
|
|
74
|
+
/** Scroll sensitivity for upward gesture detection (pixels) */
|
|
75
|
+
sensitivity?: number;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Exit intent configuration
|
|
79
|
+
*/
|
|
80
|
+
export interface ExitIntentConfig {
|
|
81
|
+
/** Enable exit intent triggers */
|
|
82
|
+
enabled: boolean;
|
|
83
|
+
/** Desktop-specific configuration */
|
|
84
|
+
desktop?: DesktopExitIntentConfig;
|
|
85
|
+
/** Mobile-specific configuration */
|
|
86
|
+
mobile?: MobileExitIntentConfig;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Overlay positioning and styling configuration
|
|
90
|
+
*/
|
|
91
|
+
export interface OverlayConfig {
|
|
92
|
+
/**
|
|
93
|
+
* Position of overlay on screen. `center` and `center-center` are the same
|
|
94
|
+
* spot: the Embed Editor's grid spells the middle cell `center-center`.
|
|
95
|
+
*/
|
|
96
|
+
position?: 'top-left' | 'top-center' | 'top-right' | 'center-left' | 'center' | 'center-center' | 'center-right' | 'bottom-left' | 'bottom-center' | 'bottom-right';
|
|
97
|
+
/** Offset from edges in pixels */
|
|
98
|
+
offset?: {
|
|
99
|
+
x: number;
|
|
100
|
+
y: number;
|
|
101
|
+
};
|
|
102
|
+
/**
|
|
103
|
+
* Stacking order of the overlay layer. Defaults to 99999999, the same value
|
|
104
|
+
* the design system's Portal uses, so an embed that states nothing keeps
|
|
105
|
+
* sitting above everything else on the page.
|
|
106
|
+
*/
|
|
107
|
+
zIndex?: number;
|
|
108
|
+
/**
|
|
109
|
+
* Stretch the overlay across the whole viewport width, flush with the top or
|
|
110
|
+
* bottom edge (a bar). Only the vertical half of `position` is used, so
|
|
111
|
+
* `top-*` gives a top bar and `bottom-*` a bottom bar.
|
|
112
|
+
*/
|
|
113
|
+
fullWidth?: boolean;
|
|
114
|
+
/** Custom CSS class name */
|
|
115
|
+
className?: string;
|
|
116
|
+
/** Custom CSS styles */
|
|
117
|
+
style?: string;
|
|
118
|
+
/** Show close button */
|
|
119
|
+
closeButton?: boolean;
|
|
120
|
+
/** Show backdrop */
|
|
121
|
+
backdrop?: boolean;
|
|
122
|
+
/** Animation type */
|
|
123
|
+
animation?: 'fade' | 'slide' | 'slide-up' | 'slide-down' | 'slide-left' | 'slide-right' | 'zoom' | 'bounce' | 'none';
|
|
124
|
+
/** Background configuration for backdrop */
|
|
125
|
+
background?: {
|
|
126
|
+
enabled: boolean;
|
|
127
|
+
color?: string;
|
|
128
|
+
opacity?: number;
|
|
129
|
+
};
|
|
130
|
+
/** Mixed mode overlay-specific configurations */
|
|
131
|
+
overlayWidth?: string | number;
|
|
132
|
+
overlayHeight?: string | number;
|
|
133
|
+
overlayResize?: ResizeMode;
|
|
134
|
+
/** Support for keeping inline dimensions vs overlay dimensions */
|
|
135
|
+
keepDimensions?: boolean;
|
|
136
|
+
embedTarget?: string;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Main trigger configuration
|
|
140
|
+
*/
|
|
141
|
+
export interface TriggerConfig {
|
|
142
|
+
/** Display mode for widget */
|
|
143
|
+
mode?: 'site' | 'mixed' | 'overlay';
|
|
144
|
+
/**
|
|
145
|
+
* What puts the overlay on screen. `exitIntent` (the trigger system's
|
|
146
|
+
* long-standing behaviour) watches for the pointer leaving the viewport and
|
|
147
|
+
* for scroll distance; `pageLoad` shows it as soon as the widget is ready;
|
|
148
|
+
* `delay` shows it once `delay.delayMs` has passed; `scroll` shows it once the
|
|
149
|
+
* visitor has scrolled `scroll.distance` pixels and nothing else.
|
|
150
|
+
* Only meaningful when `mode` is `'overlay'` — a mixed-mode widget is inline
|
|
151
|
+
* until it scrolls out of view by design.
|
|
152
|
+
*/
|
|
153
|
+
eventTrigger?: 'exitIntent' | 'pageLoad' | 'delay' | 'scroll';
|
|
154
|
+
/** Delay trigger configuration, read when `eventTrigger` is `'delay'` */
|
|
155
|
+
delay?: DelayTriggerConfig;
|
|
156
|
+
/** Scroll trigger configuration */
|
|
157
|
+
scroll?: ScrollTriggerConfig;
|
|
158
|
+
/** Exit intent trigger configuration */
|
|
159
|
+
exitIntent?: ExitIntentConfig;
|
|
160
|
+
/** Overlay styling and positioning */
|
|
161
|
+
overlay?: OverlayConfig;
|
|
162
|
+
/** Recurrence/frequency limiting for overlay mode */
|
|
163
|
+
recurrence?: {
|
|
164
|
+
/** Enable recurrence limiting */
|
|
165
|
+
enabled: boolean;
|
|
166
|
+
/** Maximum number of views allowed in time period */
|
|
167
|
+
maxViews: number;
|
|
168
|
+
/** Time period in hours (e.g., 24 for daily) */
|
|
169
|
+
timePeriodHours: number;
|
|
170
|
+
/** Custom storage key suffix for this widget */
|
|
171
|
+
storageKeySuffix?: string;
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Trigger event detail for custom events
|
|
176
|
+
*/
|
|
177
|
+
export interface TriggerEventDetail {
|
|
178
|
+
/** Widget ID that triggered the event */
|
|
179
|
+
widgetId: string;
|
|
180
|
+
/** Type of trigger that activated */
|
|
181
|
+
triggerType: string;
|
|
182
|
+
/** Additional trigger data */
|
|
183
|
+
triggerData?: any;
|
|
184
|
+
/**
|
|
185
|
+
* Set on the copy `TriggerManager` re-broadcasts for outside listeners
|
|
186
|
+
* (analytics, host pages). The manager ignores its own broadcasts; without
|
|
187
|
+
* this it would consume them as if a trigger had just fired, and re-broadcast
|
|
188
|
+
* them again, until the call stack ran out.
|
|
189
|
+
*/
|
|
190
|
+
source?: 'trigger-manager';
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Common trigger instance interface
|
|
194
|
+
*/
|
|
195
|
+
export interface TriggerInstance {
|
|
196
|
+
/** Update trigger configuration */
|
|
197
|
+
updateConfig?(config: any): void;
|
|
198
|
+
/** Reset trigger state */
|
|
199
|
+
reset?(): void;
|
|
200
|
+
/** Get trigger statistics */
|
|
201
|
+
getStats?(): any;
|
|
202
|
+
/** Check if trigger is active */
|
|
203
|
+
isActive?(): boolean;
|
|
204
|
+
/** Destroy trigger and clean up */
|
|
205
|
+
destroy(): void;
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Widget configuration parsed from HTML attributes
|
|
209
|
+
*/
|
|
210
|
+
export interface WidgetConfig {
|
|
211
|
+
/** Unique composition ID */
|
|
212
|
+
compositionId: string;
|
|
213
|
+
/** How to render this widget */
|
|
214
|
+
renderMode: RenderMode;
|
|
215
|
+
/** How to display this widget */
|
|
216
|
+
displayMode: DisplayMode;
|
|
217
|
+
/** Resize behavior */
|
|
218
|
+
resize: ResizeMode;
|
|
219
|
+
/** Initial width in pixels */
|
|
220
|
+
width: number;
|
|
221
|
+
/** Initial height in pixels */
|
|
222
|
+
height: number;
|
|
223
|
+
/** Enable automatic height scaling based on content */
|
|
224
|
+
autoscale?: boolean | AutoScaleConfig;
|
|
225
|
+
/** Breakpoint for mobile adaptation */
|
|
226
|
+
adaptive?: number;
|
|
227
|
+
/** Responsive configuration */
|
|
228
|
+
responsive?: number;
|
|
229
|
+
/** Widget loading priority for performance optimization */
|
|
230
|
+
priority?: 'critical' | 'high' | 'medium' | 'low';
|
|
231
|
+
/** Whether to preload this widget's resources */
|
|
232
|
+
preload?: boolean;
|
|
233
|
+
/** Custom script URL for widget-specific JavaScript */
|
|
234
|
+
scriptUrl?: string;
|
|
235
|
+
/** Custom style URL for widget-specific CSS */
|
|
236
|
+
styleUrl?: string;
|
|
237
|
+
/** Additional resource URLs for preloading/prefetching */
|
|
238
|
+
resourceUrls?: string[];
|
|
239
|
+
/** Device restrictions configuration */
|
|
240
|
+
device?: {
|
|
241
|
+
/** Enable widget display on mobile devices */
|
|
242
|
+
mobileEnabled?: boolean;
|
|
243
|
+
/** Enable widget display on desktop/tablet devices */
|
|
244
|
+
desktopEnabled?: boolean;
|
|
245
|
+
};
|
|
246
|
+
/** Fullscreen configuration */
|
|
247
|
+
fullscreen?: {
|
|
248
|
+
enabled: boolean;
|
|
249
|
+
trigger: FullscreenTrigger;
|
|
250
|
+
showControls: boolean;
|
|
251
|
+
exitOnEscape: boolean;
|
|
252
|
+
allowAutoEnter: boolean;
|
|
253
|
+
};
|
|
254
|
+
/** Overlay configuration */
|
|
255
|
+
overlay?: {
|
|
256
|
+
enabled: boolean;
|
|
257
|
+
position: OverlayPosition;
|
|
258
|
+
backdrop: boolean;
|
|
259
|
+
closeOnBackdropClick: boolean;
|
|
260
|
+
closeOnEscape: boolean;
|
|
261
|
+
showCloseButton: boolean;
|
|
262
|
+
trigger: "click" | "hover" | "manual" | "auto";
|
|
263
|
+
width?: string | number;
|
|
264
|
+
height?: string | number;
|
|
265
|
+
maxWidth?: string | number;
|
|
266
|
+
maxHeight?: string | number;
|
|
267
|
+
zIndex?: number;
|
|
268
|
+
animation?: "fade" | "slide-up" | "slide-down" | "slide-left" | "slide-right" | "zoom" | "bounce" | "none";
|
|
269
|
+
overlayWidth?: string | number;
|
|
270
|
+
overlayHeight?: string | number;
|
|
271
|
+
overlayResize?: ResizeMode;
|
|
272
|
+
keepDimensions?: boolean;
|
|
273
|
+
embedTarget?: string;
|
|
274
|
+
};
|
|
275
|
+
/** Popup configuration */
|
|
276
|
+
popup?: {
|
|
277
|
+
enabled: boolean;
|
|
278
|
+
trigger: "click" | "manual";
|
|
279
|
+
width?: number;
|
|
280
|
+
height?: number;
|
|
281
|
+
centerScreen?: boolean;
|
|
282
|
+
allowResize?: boolean;
|
|
283
|
+
showToolbar?: boolean;
|
|
284
|
+
target?: string;
|
|
285
|
+
};
|
|
286
|
+
/** Media management configuration */
|
|
287
|
+
media?: {
|
|
288
|
+
/** Whether this widget should auto-pause others when playing */
|
|
289
|
+
autoPause?: boolean;
|
|
290
|
+
/** Type of media this widget can play */
|
|
291
|
+
mediaType?: 'audio' | 'video' | 'both';
|
|
292
|
+
/** Priority level for conflict resolution (0-10, default: 5) */
|
|
293
|
+
priority?: number;
|
|
294
|
+
/** Whether to persist playback state in localStorage */
|
|
295
|
+
persistState?: boolean;
|
|
296
|
+
/** Whether to allow simultaneous playback with specific media types */
|
|
297
|
+
allowSimultaneous?: ('audio' | 'video')[];
|
|
298
|
+
};
|
|
299
|
+
/** Content position tracking configuration */
|
|
300
|
+
content?: {
|
|
301
|
+
/** Type of content being tracked */
|
|
302
|
+
contentType?: 'gallery' | 'carousel' | 'slider' | 'stepper' | 'tabs' | 'list' | 'custom';
|
|
303
|
+
/** Whether to persist position state in localStorage */
|
|
304
|
+
persistState?: boolean;
|
|
305
|
+
/** Whether to auto-resume position after page refresh */
|
|
306
|
+
autoResume?: boolean;
|
|
307
|
+
/** Maximum time since last interaction to allow auto-resume (ms, default: 24 hours) */
|
|
308
|
+
autoResumeTimeout?: number;
|
|
309
|
+
/** Whether to track additional metadata */
|
|
310
|
+
trackMetadata?: boolean;
|
|
311
|
+
};
|
|
312
|
+
/** Text field persistence configuration */
|
|
313
|
+
textFields?: {
|
|
314
|
+
/** Whether to auto-persist text changes */
|
|
315
|
+
autoPersist?: boolean;
|
|
316
|
+
/** Type of text content being tracked */
|
|
317
|
+
textType?: 'form' | 'editor' | 'comment' | 'note' | 'custom';
|
|
318
|
+
/** Whether to persist state in localStorage */
|
|
319
|
+
persistState?: boolean;
|
|
320
|
+
/** Whether to auto-restore text after page refresh */
|
|
321
|
+
autoRestore?: boolean;
|
|
322
|
+
/** Maximum time since last change to allow auto-restore (ms, default: 24 hours) */
|
|
323
|
+
autoRestoreTimeout?: number;
|
|
324
|
+
/** Debounce delay for auto-save in milliseconds */
|
|
325
|
+
debounceDelay?: number;
|
|
326
|
+
/** Maximum length of text to persist */
|
|
327
|
+
maxLength?: number;
|
|
328
|
+
/** Custom storage key suffix */
|
|
329
|
+
storageKeySuffix?: string;
|
|
330
|
+
};
|
|
331
|
+
/** Security configuration for text fields and other features */
|
|
332
|
+
security?: {
|
|
333
|
+
/** Enable input sanitization */
|
|
334
|
+
enableSanitization?: boolean;
|
|
335
|
+
/** Enable rate limiting */
|
|
336
|
+
enableRateLimit?: boolean;
|
|
337
|
+
/** Enable bot detection */
|
|
338
|
+
enableBotDetection?: boolean;
|
|
339
|
+
/** Maximum text length (characters) */
|
|
340
|
+
maxTextLength?: number;
|
|
341
|
+
/** Rate limit: max updates per minute per widget */
|
|
342
|
+
maxUpdatesPerMinute?: number;
|
|
343
|
+
/** Rate limit: max updates per minute globally */
|
|
344
|
+
maxGlobalUpdatesPerMinute?: number;
|
|
345
|
+
/** Suspicious activity threshold */
|
|
346
|
+
suspiciousActivityThreshold?: number;
|
|
347
|
+
};
|
|
348
|
+
/** Trigger configuration for widget display modes */
|
|
349
|
+
triggers?: TriggerConfig;
|
|
350
|
+
}
|
|
351
|
+
/**
|
|
352
|
+
* Display state for enhanced widget instances
|
|
353
|
+
*/
|
|
354
|
+
export interface WidgetDisplayState {
|
|
355
|
+
mode: DisplayMode;
|
|
356
|
+
isFullscreen: boolean;
|
|
357
|
+
isOverlay: boolean;
|
|
358
|
+
isPopup: boolean;
|
|
359
|
+
overlayPortal?: any;
|
|
360
|
+
popupWindow?: Window | null;
|
|
361
|
+
fullscreenElement?: HTMLElement;
|
|
362
|
+
originalPlaceholder?: Comment | Node;
|
|
363
|
+
originalStyle?: string;
|
|
364
|
+
}
|
|
365
|
+
/**
|
|
366
|
+
* Widget instance after enhancement
|
|
367
|
+
*/
|
|
368
|
+
export interface WidgetInstance {
|
|
369
|
+
/** Unique instance ID */
|
|
370
|
+
id: string;
|
|
371
|
+
/** Widget configuration */
|
|
372
|
+
config: WidgetConfig;
|
|
373
|
+
/** Enhanced/replaced element (iframe or custom element) */
|
|
374
|
+
element: HTMLElement;
|
|
375
|
+
/** Instance state */
|
|
376
|
+
state: {
|
|
377
|
+
ready: boolean;
|
|
378
|
+
error: Error | null;
|
|
379
|
+
width: number;
|
|
380
|
+
height: number;
|
|
381
|
+
};
|
|
382
|
+
/** Display state for advanced modes */
|
|
383
|
+
displayState: WidgetDisplayState;
|
|
384
|
+
/** Display mode controls */
|
|
385
|
+
enterFullscreen?(): Promise<void>;
|
|
386
|
+
exitFullscreen?(): Promise<void>;
|
|
387
|
+
showOverlay?(): Promise<void>;
|
|
388
|
+
hideOverlay?(): Promise<void>;
|
|
389
|
+
openPopup?(): Promise<Window | null>;
|
|
390
|
+
closePopup?(): void;
|
|
391
|
+
}
|
|
392
|
+
/**
|
|
393
|
+
* Main SDK interface
|
|
394
|
+
*/
|
|
395
|
+
export interface WidgeticEmbedSDK {
|
|
396
|
+
/** SDK version */
|
|
397
|
+
version: string;
|
|
398
|
+
/** Initialize the SDK */
|
|
399
|
+
init(): Promise<void>;
|
|
400
|
+
/** Scan page for enhance them */
|
|
401
|
+
enhance(): Promise<void>;
|
|
402
|
+
/** Get all widget instances */
|
|
403
|
+
getInstances(): WidgetInstance[];
|
|
404
|
+
/** Get widget instance by ID */
|
|
405
|
+
getInstance(id: string): WidgetInstance | null;
|
|
406
|
+
/** Refresh - rescan and enhance new widgets */
|
|
407
|
+
refresh(): Promise<void>;
|
|
408
|
+
}
|
|
409
|
+
/**
|
|
410
|
+
* API response for composition data
|
|
411
|
+
*/
|
|
412
|
+
export interface CompositionData {
|
|
413
|
+
id: string;
|
|
414
|
+
widgetId: string;
|
|
415
|
+
content: any;
|
|
416
|
+
theme: any;
|
|
417
|
+
version: string;
|
|
418
|
+
}
|
|
419
|
+
/**
|
|
420
|
+
* API response for widget module data
|
|
421
|
+
*/
|
|
422
|
+
export interface WidgetModuleData {
|
|
423
|
+
id: string;
|
|
424
|
+
name: string;
|
|
425
|
+
version: string;
|
|
426
|
+
moduleUrl: string;
|
|
427
|
+
dependencies?: string[];
|
|
428
|
+
}
|
|
429
|
+
/**
|
|
430
|
+
* Browser capability detection
|
|
431
|
+
*/
|
|
432
|
+
export interface BrowserCapabilities {
|
|
433
|
+
customElements: boolean;
|
|
434
|
+
http3: boolean;
|
|
435
|
+
resizeObserver: boolean;
|
|
436
|
+
fullscreenApi: boolean;
|
|
437
|
+
popupBlocking: boolean;
|
|
438
|
+
}
|
|
439
|
+
/**
|
|
440
|
+
* Responsive breakpoint state
|
|
441
|
+
*/
|
|
442
|
+
export interface ResponsiveState {
|
|
443
|
+
/** Current viewport mode */
|
|
444
|
+
mode: 'desktop' | 'mobile';
|
|
445
|
+
/** Breakpoint value that triggered the change */
|
|
446
|
+
breakpoint: number;
|
|
447
|
+
/** Current container width */
|
|
448
|
+
width: number;
|
|
449
|
+
/** Timestamp of the change */
|
|
450
|
+
timestamp: number;
|
|
451
|
+
}
|
|
452
|
+
/**
|
|
453
|
+
* Responsive configuration options
|
|
454
|
+
*/
|
|
455
|
+
export interface ResponsiveConfig {
|
|
456
|
+
/** Breakpoint value in pixels */
|
|
457
|
+
breakpoint: number;
|
|
458
|
+
/** Debounce delay for resize events in milliseconds */
|
|
459
|
+
debounceDelay?: number;
|
|
460
|
+
/** Initial state (auto-detected if not provided) */
|
|
461
|
+
initialMode?: 'desktop' | 'mobile';
|
|
462
|
+
}
|
|
463
|
+
declare global {
|
|
464
|
+
interface Window {
|
|
465
|
+
widgetic?: WidgeticEmbedSDK;
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
export type { AutoScaleConfig, AutoScaleState } from './autoscale-manager';
|
|
469
|
+
export type { MediaConfig, MediaState, MediaEvent, ResumeOptions, GlobalVolumeState } from './media-manager';
|
|
470
|
+
export type { ContentPositionConfig, ContentPositionState, ContentPositionEvent, ResumePositionOptions } from './content-position-manager';
|
|
471
|
+
export type { TextFieldConfig, TextFieldState } from './text-field-manager';
|
|
472
|
+
export type { SecurityConfig, SecurityValidationResult, RateLimitEntry, BehaviorEntry } from './security-manager';
|
|
473
|
+
export type { DeviceType, DeviceInfo } from '../utils/device-detector';
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* UI SDK Dynamic Loader
|
|
3
|
+
* Loads the Widgetic UI SDK on-demand for authenticated editing
|
|
4
|
+
*/
|
|
5
|
+
export interface UISdkConfig {
|
|
6
|
+
basePath?: string;
|
|
7
|
+
version?: string;
|
|
8
|
+
modules?: string[];
|
|
9
|
+
debug?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface UISdkInstance {
|
|
12
|
+
mountWidgetCreator(container: HTMLElement, options?: any): Promise<any>;
|
|
13
|
+
unmountWidgetCreator(container: HTMLElement): Promise<void>;
|
|
14
|
+
mountCompositionEditor(container: HTMLElement, compositionId: string, options?: any): Promise<any>;
|
|
15
|
+
unmountCompositionEditor(container: HTMLElement): Promise<void>;
|
|
16
|
+
mountEmbedEditor(container: HTMLElement, compositionId: string, options?: any): Promise<any>;
|
|
17
|
+
unmountEmbedEditor(container: HTMLElement): Promise<void>;
|
|
18
|
+
init(config?: UISdkConfig): Promise<void>;
|
|
19
|
+
destroy(): Promise<void>;
|
|
20
|
+
on(event: string, callback: Function): void;
|
|
21
|
+
off(event: string, callback: Function): void;
|
|
22
|
+
emit(event: string, data?: any): void;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* UI SDK Loader and Manager
|
|
26
|
+
*/
|
|
27
|
+
export declare class UISdkLoader {
|
|
28
|
+
private config;
|
|
29
|
+
private loadPromise;
|
|
30
|
+
private sdkInstance;
|
|
31
|
+
private isLoading;
|
|
32
|
+
private loadTimeout;
|
|
33
|
+
constructor(config?: UISdkConfig);
|
|
34
|
+
/**
|
|
35
|
+
* Get the UI SDK base URL
|
|
36
|
+
*/
|
|
37
|
+
private getUISdkBaseUrl;
|
|
38
|
+
/**
|
|
39
|
+
* Load the UI SDK dynamically
|
|
40
|
+
*/
|
|
41
|
+
loadUISdk(): Promise<UISdkInstance>;
|
|
42
|
+
/**
|
|
43
|
+
* Perform the actual SDK loading
|
|
44
|
+
*/
|
|
45
|
+
private performLoad;
|
|
46
|
+
/**
|
|
47
|
+
* Check if UI SDK is loaded
|
|
48
|
+
*/
|
|
49
|
+
isLoaded(): boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Check if UI SDK is currently loading
|
|
52
|
+
*/
|
|
53
|
+
isLoadingState(): boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Get the loaded UI SDK instance (null if not loaded)
|
|
56
|
+
*/
|
|
57
|
+
getInstance(): UISdkInstance | null;
|
|
58
|
+
/**
|
|
59
|
+
* Initialize UI SDK with configuration
|
|
60
|
+
*/
|
|
61
|
+
initializeUISdk(sdkConfig?: UISdkConfig): Promise<UISdkInstance>;
|
|
62
|
+
/**
|
|
63
|
+
* Cleanup and unload UI SDK
|
|
64
|
+
*/
|
|
65
|
+
cleanup(): Promise<void>;
|
|
66
|
+
/**
|
|
67
|
+
* Preload UI SDK (for faster editor access)
|
|
68
|
+
*/
|
|
69
|
+
preload(): Promise<void>;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Get global UI SDK loader instance
|
|
73
|
+
*/
|
|
74
|
+
export declare function getUISdkLoader(config?: UISdkConfig): UISdkLoader;
|
|
75
|
+
/**
|
|
76
|
+
* Load UI SDK with default configuration
|
|
77
|
+
*/
|
|
78
|
+
export declare function loadUISdk(config?: UISdkConfig): Promise<UISdkInstance>;
|
|
79
|
+
/**
|
|
80
|
+
* Initialize UI SDK with configuration
|
|
81
|
+
*/
|
|
82
|
+
export declare function initializeUISdk(config?: UISdkConfig): Promise<UISdkInstance>;
|
|
83
|
+
/**
|
|
84
|
+
* Check if UI SDK is available
|
|
85
|
+
*/
|
|
86
|
+
export declare function isUISdkLoaded(): boolean;
|
|
87
|
+
/**
|
|
88
|
+
* Reset UI SDK loader (for testing)
|
|
89
|
+
*/
|
|
90
|
+
export declare function resetUISdkLoader(): void;
|