@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,236 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Privacy Compliance Helper for Widgetic Embed SDK
|
|
3
|
+
*
|
|
4
|
+
* Provides GDPR, CCPA, and other privacy regulation compliance features:
|
|
5
|
+
* - Consent management and tracking
|
|
6
|
+
* - Data subject rights (access, portability, erasure)
|
|
7
|
+
* - Privacy policy enforcement
|
|
8
|
+
* - Data minimization and anonymization
|
|
9
|
+
* - Cookie and tracking compliance
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Consent types and purposes
|
|
13
|
+
*/
|
|
14
|
+
export type ConsentType = 'necessary' | 'functional' | 'analytics' | 'marketing' | 'personalization';
|
|
15
|
+
/**
|
|
16
|
+
* Legal basis for data processing
|
|
17
|
+
*/
|
|
18
|
+
export type LegalBasis = 'consent' | 'legitimate_interest' | 'contract' | 'legal_obligation' | 'vital_interests' | 'public_task';
|
|
19
|
+
/**
|
|
20
|
+
* Data subject rights
|
|
21
|
+
*/
|
|
22
|
+
export type DataSubjectRight = 'access' | 'rectification' | 'erasure' | 'restrict_processing' | 'data_portability' | 'object' | 'withdraw_consent';
|
|
23
|
+
/**
|
|
24
|
+
* Privacy regulation frameworks
|
|
25
|
+
*/
|
|
26
|
+
export type PrivacyFramework = 'GDPR' | 'CCPA' | 'LGPD' | 'PIPEDA' | 'PDPA';
|
|
27
|
+
/**
|
|
28
|
+
* Consent record structure
|
|
29
|
+
*/
|
|
30
|
+
export interface ConsentRecord {
|
|
31
|
+
id: string;
|
|
32
|
+
userId?: string;
|
|
33
|
+
sessionId: string;
|
|
34
|
+
consentType: ConsentType;
|
|
35
|
+
granted: boolean;
|
|
36
|
+
timestamp: string;
|
|
37
|
+
legalBasis: LegalBasis;
|
|
38
|
+
purpose: string;
|
|
39
|
+
dataCategories: string[];
|
|
40
|
+
retentionPeriod?: number;
|
|
41
|
+
thirdParties?: string[];
|
|
42
|
+
ipAddress?: string;
|
|
43
|
+
userAgent?: string;
|
|
44
|
+
withdrawnAt?: string;
|
|
45
|
+
version: string;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Data subject request
|
|
49
|
+
*/
|
|
50
|
+
export interface DataSubjectRequest {
|
|
51
|
+
id: string;
|
|
52
|
+
type: DataSubjectRight;
|
|
53
|
+
userId: string;
|
|
54
|
+
email: string;
|
|
55
|
+
submittedAt: string;
|
|
56
|
+
status: 'pending' | 'in_progress' | 'completed' | 'rejected';
|
|
57
|
+
reason?: string;
|
|
58
|
+
completedAt?: string;
|
|
59
|
+
verificationCode?: string;
|
|
60
|
+
requestData?: any;
|
|
61
|
+
responseData?: any;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Privacy policy configuration
|
|
65
|
+
*/
|
|
66
|
+
export interface PrivacyPolicyConfig {
|
|
67
|
+
version: string;
|
|
68
|
+
effectiveDate: string;
|
|
69
|
+
dataRetentionDays: number;
|
|
70
|
+
contactEmail: string;
|
|
71
|
+
dpoEmail?: string;
|
|
72
|
+
supportedFrameworks: PrivacyFramework[];
|
|
73
|
+
consentRequirements: {
|
|
74
|
+
[key in ConsentType]: {
|
|
75
|
+
required: boolean;
|
|
76
|
+
legalBasis: LegalBasis;
|
|
77
|
+
purpose: string;
|
|
78
|
+
dataCategories: string[];
|
|
79
|
+
retentionDays?: number;
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Cookie configuration
|
|
85
|
+
*/
|
|
86
|
+
export interface CookieConfig {
|
|
87
|
+
name: string;
|
|
88
|
+
purpose: string;
|
|
89
|
+
category: ConsentType;
|
|
90
|
+
essential: boolean;
|
|
91
|
+
duration: number;
|
|
92
|
+
domain?: string;
|
|
93
|
+
secure?: boolean;
|
|
94
|
+
sameSite?: 'strict' | 'lax' | 'none';
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Privacy compliance configuration
|
|
98
|
+
*/
|
|
99
|
+
export interface PrivacyComplianceConfig {
|
|
100
|
+
enableGDPR?: boolean;
|
|
101
|
+
enableCCPA?: boolean;
|
|
102
|
+
enableOtherFrameworks?: PrivacyFramework[];
|
|
103
|
+
autoDetectRegion?: boolean;
|
|
104
|
+
defaultConsentState?: boolean;
|
|
105
|
+
consentBannerTimeout?: number;
|
|
106
|
+
privacyPolicy: PrivacyPolicyConfig;
|
|
107
|
+
cookies: CookieConfig[];
|
|
108
|
+
dataMinimization?: boolean;
|
|
109
|
+
anonymizeAfterDays?: number;
|
|
110
|
+
auditRetentionDays?: number;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Privacy compliance manager
|
|
114
|
+
*/
|
|
115
|
+
export declare class PrivacyCompliance {
|
|
116
|
+
private config;
|
|
117
|
+
private consentRecords;
|
|
118
|
+
private dataSubjectRequests;
|
|
119
|
+
private userRegion;
|
|
120
|
+
private applicableFrameworks;
|
|
121
|
+
constructor(config: PrivacyComplianceConfig);
|
|
122
|
+
/**
|
|
123
|
+
* Initialize privacy compliance system
|
|
124
|
+
*/
|
|
125
|
+
private initializePrivacyCompliance;
|
|
126
|
+
/**
|
|
127
|
+
* Detect user region for privacy law applicability
|
|
128
|
+
*/
|
|
129
|
+
private detectUserRegion;
|
|
130
|
+
/**
|
|
131
|
+
* Get region from timezone
|
|
132
|
+
*/
|
|
133
|
+
private getRegionFromTimezone;
|
|
134
|
+
/**
|
|
135
|
+
* Get region from browser language
|
|
136
|
+
*/
|
|
137
|
+
private getRegionFromLanguage;
|
|
138
|
+
/**
|
|
139
|
+
* Get region from IP (placeholder - would use geolocation service)
|
|
140
|
+
*/
|
|
141
|
+
private getRegionFromIP;
|
|
142
|
+
/**
|
|
143
|
+
* Determine which privacy frameworks apply
|
|
144
|
+
*/
|
|
145
|
+
private determineApplicableFrameworks;
|
|
146
|
+
/**
|
|
147
|
+
* Load existing consent records from storage
|
|
148
|
+
*/
|
|
149
|
+
private loadExistingConsent;
|
|
150
|
+
/**
|
|
151
|
+
* Record user consent
|
|
152
|
+
*/
|
|
153
|
+
recordConsent(consentType: ConsentType, granted: boolean, context?: {
|
|
154
|
+
userId?: string;
|
|
155
|
+
purpose?: string;
|
|
156
|
+
dataCategories?: string[];
|
|
157
|
+
thirdParties?: string[];
|
|
158
|
+
}): ConsentRecord;
|
|
159
|
+
/**
|
|
160
|
+
* Withdraw consent
|
|
161
|
+
*/
|
|
162
|
+
withdrawConsent(consentType: ConsentType, userId?: string): boolean;
|
|
163
|
+
/**
|
|
164
|
+
* Check if consent is granted for a specific type
|
|
165
|
+
*/
|
|
166
|
+
hasConsent(consentType: ConsentType, userId?: string): boolean;
|
|
167
|
+
/**
|
|
168
|
+
* Submit data subject request
|
|
169
|
+
*/
|
|
170
|
+
submitDataSubjectRequest(type: DataSubjectRight, userEmail: string, userId?: string, requestData?: any): Promise<DataSubjectRequest>;
|
|
171
|
+
/**
|
|
172
|
+
* Process data subject request
|
|
173
|
+
*/
|
|
174
|
+
private processDataSubjectRequest;
|
|
175
|
+
/**
|
|
176
|
+
* Handle data access request (GDPR Article 15)
|
|
177
|
+
*/
|
|
178
|
+
private handleDataAccessRequest;
|
|
179
|
+
/**
|
|
180
|
+
* Handle data erasure request (GDPR Article 17 - Right to be forgotten)
|
|
181
|
+
*/
|
|
182
|
+
private handleDataErasureRequest;
|
|
183
|
+
/**
|
|
184
|
+
* Handle data portability request (GDPR Article 20)
|
|
185
|
+
*/
|
|
186
|
+
private handleDataPortabilityRequest;
|
|
187
|
+
/**
|
|
188
|
+
* Handle data rectification request (GDPR Article 16)
|
|
189
|
+
*/
|
|
190
|
+
private handleDataRectificationRequest;
|
|
191
|
+
/**
|
|
192
|
+
* Check if user is in GDPR jurisdiction
|
|
193
|
+
*/
|
|
194
|
+
isGDPRApplicable(): boolean;
|
|
195
|
+
/**
|
|
196
|
+
* Check if user is in CCPA jurisdiction
|
|
197
|
+
*/
|
|
198
|
+
isCCPAApplicable(): boolean;
|
|
199
|
+
/**
|
|
200
|
+
* Get privacy policy version
|
|
201
|
+
*/
|
|
202
|
+
getPrivacyPolicyVersion(): string;
|
|
203
|
+
/**
|
|
204
|
+
* Get all consent records for a user
|
|
205
|
+
*/
|
|
206
|
+
getUserConsentRecords(userId?: string): ConsentRecord[];
|
|
207
|
+
/**
|
|
208
|
+
* Get cookie configuration
|
|
209
|
+
*/
|
|
210
|
+
getCookieConfig(): CookieConfig[];
|
|
211
|
+
/**
|
|
212
|
+
* Check if cookies are allowed for a category
|
|
213
|
+
*/
|
|
214
|
+
areCookiesAllowed(category: ConsentType): boolean;
|
|
215
|
+
/**
|
|
216
|
+
* Schedule automatic data cleanup
|
|
217
|
+
*/
|
|
218
|
+
private scheduleDataCleanup;
|
|
219
|
+
/**
|
|
220
|
+
* Clean up expired data
|
|
221
|
+
*/
|
|
222
|
+
private cleanupExpiredData;
|
|
223
|
+
private generateConsentId;
|
|
224
|
+
private generateRequestId;
|
|
225
|
+
private generateVerificationCode;
|
|
226
|
+
private getSessionId;
|
|
227
|
+
private getClientIP;
|
|
228
|
+
private persistConsentToStorage;
|
|
229
|
+
private getDataCategoriesForUser;
|
|
230
|
+
private getProcessingPurposesForUser;
|
|
231
|
+
private getThirdPartySharing;
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Get or create privacy compliance instance
|
|
235
|
+
*/
|
|
236
|
+
export declare function getPrivacyCompliance(config?: PrivacyComplianceConfig): PrivacyCompliance;
|
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Real-time Manager for Widgetic Embed SDK
|
|
3
|
+
*
|
|
4
|
+
* Handles WebSocket connections for live widget updates with:
|
|
5
|
+
* - Automatic reconnection with exponential backoff
|
|
6
|
+
* - Security validation through AdvancedSecurityManager
|
|
7
|
+
* - Error recovery and resilience
|
|
8
|
+
* - Message queuing and retry logic
|
|
9
|
+
* - Performance monitoring integration
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Real-time configuration
|
|
13
|
+
*/
|
|
14
|
+
export interface RealtimeConfig {
|
|
15
|
+
enabled: boolean;
|
|
16
|
+
wsUrl?: string;
|
|
17
|
+
authentication: {
|
|
18
|
+
type: 'jwt' | 'apikey' | 'session';
|
|
19
|
+
credentials: string;
|
|
20
|
+
};
|
|
21
|
+
features: {
|
|
22
|
+
contentUpdates: boolean;
|
|
23
|
+
styleUpdates: boolean;
|
|
24
|
+
configUpdates: boolean;
|
|
25
|
+
dataUpdates: boolean;
|
|
26
|
+
};
|
|
27
|
+
security: {
|
|
28
|
+
validateUpdates: boolean;
|
|
29
|
+
rateLimitPerMinute: number;
|
|
30
|
+
allowedUpdateTypes: string[];
|
|
31
|
+
};
|
|
32
|
+
reconnection: {
|
|
33
|
+
enabled: boolean;
|
|
34
|
+
maxAttempts: number;
|
|
35
|
+
baseDelay: number;
|
|
36
|
+
maxDelay: number;
|
|
37
|
+
};
|
|
38
|
+
fallback: {
|
|
39
|
+
enabled: boolean;
|
|
40
|
+
pollInterval?: number;
|
|
41
|
+
};
|
|
42
|
+
heartbeat: {
|
|
43
|
+
enabled: boolean;
|
|
44
|
+
interval: number;
|
|
45
|
+
timeout: number;
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Real-time update message structure
|
|
50
|
+
*/
|
|
51
|
+
export interface RealtimeUpdate {
|
|
52
|
+
type: 'content' | 'style' | 'config' | 'data';
|
|
53
|
+
compositionId: string;
|
|
54
|
+
data: any;
|
|
55
|
+
userId?: string;
|
|
56
|
+
timestamp: number;
|
|
57
|
+
version?: string;
|
|
58
|
+
partial?: boolean;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* WebSocket message types
|
|
62
|
+
*/
|
|
63
|
+
export interface RealtimeMessage {
|
|
64
|
+
type: 'widget_update' | 'subscription_confirmed' | 'heartbeat' | 'error' | 'authentication';
|
|
65
|
+
id?: string;
|
|
66
|
+
compositionId?: string;
|
|
67
|
+
subscriptionId?: string;
|
|
68
|
+
data?: any;
|
|
69
|
+
timestamp: number;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Widget update message
|
|
73
|
+
*/
|
|
74
|
+
export interface WidgetUpdateMessage extends RealtimeMessage {
|
|
75
|
+
type: 'widget_update';
|
|
76
|
+
compositionId: string;
|
|
77
|
+
updateType: 'content' | 'style' | 'config' | 'data';
|
|
78
|
+
data: any;
|
|
79
|
+
userId?: string;
|
|
80
|
+
version?: string;
|
|
81
|
+
partial?: boolean;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Real-time update handler function
|
|
85
|
+
*/
|
|
86
|
+
export type RealtimeUpdateHandler = (update: RealtimeUpdate) => Promise<void>;
|
|
87
|
+
/**
|
|
88
|
+
* Real-time subscription
|
|
89
|
+
*/
|
|
90
|
+
export declare class RealtimeSubscription {
|
|
91
|
+
readonly id: string;
|
|
92
|
+
readonly compositionId: string;
|
|
93
|
+
readonly handler: RealtimeUpdateHandler;
|
|
94
|
+
private _active;
|
|
95
|
+
constructor(compositionId: string, handler: RealtimeUpdateHandler);
|
|
96
|
+
isActive(): boolean;
|
|
97
|
+
unsubscribe(): void;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Connection state
|
|
101
|
+
*/
|
|
102
|
+
type ConnectionState = 'disconnected' | 'connecting' | 'connected' | 'error' | 'reconnecting';
|
|
103
|
+
/**
|
|
104
|
+
* Real-time Manager
|
|
105
|
+
*/
|
|
106
|
+
export declare class RealtimeManager {
|
|
107
|
+
private static instance;
|
|
108
|
+
private config;
|
|
109
|
+
private securityManager;
|
|
110
|
+
private performanceMonitor;
|
|
111
|
+
private socket;
|
|
112
|
+
private connectionState;
|
|
113
|
+
private connectionId;
|
|
114
|
+
private subscriptions;
|
|
115
|
+
private allSubscriptions;
|
|
116
|
+
private reconnectAttempts;
|
|
117
|
+
private reconnectTimer;
|
|
118
|
+
private messageQueue;
|
|
119
|
+
private retryTimer;
|
|
120
|
+
private heartbeatTimer;
|
|
121
|
+
private lastHeartbeat;
|
|
122
|
+
private heartbeatTimeout;
|
|
123
|
+
private pollingFallback;
|
|
124
|
+
private connectionStartTime;
|
|
125
|
+
private messageStats;
|
|
126
|
+
private constructor();
|
|
127
|
+
/**
|
|
128
|
+
* Get singleton instance
|
|
129
|
+
*/
|
|
130
|
+
static getInstance(config?: RealtimeConfig): RealtimeManager;
|
|
131
|
+
/**
|
|
132
|
+
* Initialize and connect to real-time service
|
|
133
|
+
*/
|
|
134
|
+
initialize(): Promise<void>;
|
|
135
|
+
/**
|
|
136
|
+
* Connect to WebSocket server
|
|
137
|
+
*/
|
|
138
|
+
connect(): Promise<void>;
|
|
139
|
+
/**
|
|
140
|
+
* Subscribe to real-time updates for a composition
|
|
141
|
+
*/
|
|
142
|
+
subscribe(compositionId: string, handler: RealtimeUpdateHandler): RealtimeSubscription;
|
|
143
|
+
/**
|
|
144
|
+
* Unsubscribe from real-time updates
|
|
145
|
+
*/
|
|
146
|
+
unsubscribe(subscription: RealtimeSubscription): void;
|
|
147
|
+
/**
|
|
148
|
+
* Get active subscription composition IDs
|
|
149
|
+
*/
|
|
150
|
+
getActiveSubscriptions(): Set<string>;
|
|
151
|
+
/**
|
|
152
|
+
* Get API key for authentication
|
|
153
|
+
*/
|
|
154
|
+
getApiKey(): string;
|
|
155
|
+
/**
|
|
156
|
+
* Handle polled update from fallback system
|
|
157
|
+
*/
|
|
158
|
+
handlePolledUpdate(update: any): Promise<void>;
|
|
159
|
+
/**
|
|
160
|
+
* Build WebSocket URL with authentication
|
|
161
|
+
*/
|
|
162
|
+
private buildWebSocketUrl;
|
|
163
|
+
/**
|
|
164
|
+
* Handle WebSocket connection open
|
|
165
|
+
*/
|
|
166
|
+
private handleConnect;
|
|
167
|
+
/**
|
|
168
|
+
* Handle WebSocket message
|
|
169
|
+
*/
|
|
170
|
+
private handleMessage;
|
|
171
|
+
/**
|
|
172
|
+
* Handle widget update message
|
|
173
|
+
*/
|
|
174
|
+
private handleWidgetUpdate;
|
|
175
|
+
/**
|
|
176
|
+
* Process a real-time update with security validation
|
|
177
|
+
*/
|
|
178
|
+
private processUpdate;
|
|
179
|
+
/**
|
|
180
|
+
* Handle subscription confirmation
|
|
181
|
+
*/
|
|
182
|
+
private handleSubscriptionConfirmed;
|
|
183
|
+
/**
|
|
184
|
+
* Handle heartbeat message
|
|
185
|
+
*/
|
|
186
|
+
private handleHeartbeat;
|
|
187
|
+
/**
|
|
188
|
+
* Handle server error message
|
|
189
|
+
*/
|
|
190
|
+
private handleServerError;
|
|
191
|
+
/**
|
|
192
|
+
* Handle authentication message
|
|
193
|
+
*/
|
|
194
|
+
private handleAuthentication;
|
|
195
|
+
/**
|
|
196
|
+
* Handle WebSocket disconnection
|
|
197
|
+
*/
|
|
198
|
+
private handleDisconnect;
|
|
199
|
+
/**
|
|
200
|
+
* Handle WebSocket error
|
|
201
|
+
*/
|
|
202
|
+
private handleError;
|
|
203
|
+
/**
|
|
204
|
+
* Handle connection errors with recovery
|
|
205
|
+
*/
|
|
206
|
+
private handleConnectionError;
|
|
207
|
+
/**
|
|
208
|
+
* Schedule reconnection with exponential backoff
|
|
209
|
+
*/
|
|
210
|
+
private scheduleReconnection;
|
|
211
|
+
/**
|
|
212
|
+
* Enable polling fallback
|
|
213
|
+
*/
|
|
214
|
+
private enablePollingFallback;
|
|
215
|
+
/**
|
|
216
|
+
* Send message to WebSocket server
|
|
217
|
+
*/
|
|
218
|
+
private sendMessage;
|
|
219
|
+
/**
|
|
220
|
+
* Queue message for retry
|
|
221
|
+
*/
|
|
222
|
+
private queueMessage;
|
|
223
|
+
/**
|
|
224
|
+
* Process message retry queue
|
|
225
|
+
*/
|
|
226
|
+
private processRetryQueue;
|
|
227
|
+
/**
|
|
228
|
+
* Process queued messages when connection is established
|
|
229
|
+
*/
|
|
230
|
+
private processMessageQueue;
|
|
231
|
+
/**
|
|
232
|
+
* Re-establish subscriptions after reconnection
|
|
233
|
+
*/
|
|
234
|
+
private reestablishSubscriptions;
|
|
235
|
+
/**
|
|
236
|
+
* Start heartbeat mechanism
|
|
237
|
+
*/
|
|
238
|
+
private startHeartbeat;
|
|
239
|
+
/**
|
|
240
|
+
* Stop heartbeat mechanism
|
|
241
|
+
*/
|
|
242
|
+
private stopHeartbeat;
|
|
243
|
+
/**
|
|
244
|
+
* Setup event listeners
|
|
245
|
+
*/
|
|
246
|
+
private setupEventListeners;
|
|
247
|
+
/**
|
|
248
|
+
* Emit custom event
|
|
249
|
+
*/
|
|
250
|
+
private emitEvent;
|
|
251
|
+
/**
|
|
252
|
+
* Get connection state
|
|
253
|
+
*/
|
|
254
|
+
getConnectionState(): ConnectionState;
|
|
255
|
+
/**
|
|
256
|
+
* Get connection statistics
|
|
257
|
+
*/
|
|
258
|
+
getStats(): {
|
|
259
|
+
connectionState: ConnectionState;
|
|
260
|
+
subscriptions: number;
|
|
261
|
+
messageStats: {
|
|
262
|
+
sent: number;
|
|
263
|
+
received: number;
|
|
264
|
+
errors: number;
|
|
265
|
+
};
|
|
266
|
+
reconnectAttempts: number;
|
|
267
|
+
lastHeartbeat: number;
|
|
268
|
+
queuedMessages: number;
|
|
269
|
+
};
|
|
270
|
+
/**
|
|
271
|
+
* Disconnect and cleanup
|
|
272
|
+
*/
|
|
273
|
+
disconnect(): void;
|
|
274
|
+
}
|
|
275
|
+
/**
|
|
276
|
+
* Get singleton instance of real-time manager
|
|
277
|
+
*/
|
|
278
|
+
export declare function getRealtimeManager(config?: RealtimeConfig): RealtimeManager;
|
|
279
|
+
export {};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Enhanced Resize Handler - Comprehensive widget resizing capabilities
|
|
3
|
+
* Handles all resize modes including fill, fixed, responsive, and autoscaling
|
|
4
|
+
*/
|
|
5
|
+
import type { ResizeMode, WidgetConfig } from "./types.js";
|
|
6
|
+
import type { AutoScaleConfig } from "./autoscale-manager.js";
|
|
7
|
+
export interface ResizeConfig {
|
|
8
|
+
/** Resize mode behavior */
|
|
9
|
+
mode: ResizeMode;
|
|
10
|
+
/** Whether to observe resize events */
|
|
11
|
+
observeResize?: boolean;
|
|
12
|
+
/** Autoscale configuration */
|
|
13
|
+
autoscale?: boolean | AutoScaleConfig;
|
|
14
|
+
/** Responsive breakpoint */
|
|
15
|
+
adaptive?: number;
|
|
16
|
+
/** Debounce delay for resize events */
|
|
17
|
+
debounceDelay?: number;
|
|
18
|
+
}
|
|
19
|
+
export interface ResizeHandlerOptions {
|
|
20
|
+
observeResize?: boolean;
|
|
21
|
+
debounceMs?: number;
|
|
22
|
+
enableAdaptive?: boolean;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Resize Handler for managing widget sizing and responsiveness
|
|
26
|
+
*/
|
|
27
|
+
export declare class ResizeHandler {
|
|
28
|
+
private options;
|
|
29
|
+
private resizeObserver;
|
|
30
|
+
private instances;
|
|
31
|
+
private debounceTimers;
|
|
32
|
+
constructor(options?: ResizeHandlerOptions);
|
|
33
|
+
/**
|
|
34
|
+
* Register a widget for resize handling
|
|
35
|
+
*/
|
|
36
|
+
registerWidget(widgetId: string, element: HTMLElement, container: HTMLElement, config: WidgetConfig): void;
|
|
37
|
+
/**
|
|
38
|
+
* Unregister a widget from resize handling
|
|
39
|
+
*/
|
|
40
|
+
unregisterWidget(widgetId: string): void;
|
|
41
|
+
/**
|
|
42
|
+
* Generate CSS for iframe resize mode (no JavaScript scenario)
|
|
43
|
+
*/
|
|
44
|
+
static generateIframeCSS(config: WidgetConfig): string;
|
|
45
|
+
/**
|
|
46
|
+
* Apply resize mode to a widget instance
|
|
47
|
+
*/
|
|
48
|
+
private applyResizeMode;
|
|
49
|
+
/**
|
|
50
|
+
* Set element size with proper CSS
|
|
51
|
+
*/
|
|
52
|
+
private setElementSize;
|
|
53
|
+
/**
|
|
54
|
+
* Handle adaptive breakpoints
|
|
55
|
+
*/
|
|
56
|
+
private handleAdaptiveBreakpoint;
|
|
57
|
+
/**
|
|
58
|
+
* Handle resize observer events
|
|
59
|
+
*/
|
|
60
|
+
private handleResize;
|
|
61
|
+
/**
|
|
62
|
+
* Force resize for a specific widget
|
|
63
|
+
*/
|
|
64
|
+
forceResize(widgetId: string): void;
|
|
65
|
+
/**
|
|
66
|
+
* Force resize for all widgets
|
|
67
|
+
*/
|
|
68
|
+
forceResizeAll(): void;
|
|
69
|
+
/**
|
|
70
|
+
* Cleanup all resize handling
|
|
71
|
+
*/
|
|
72
|
+
cleanup(): void;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Get global resize handler instance
|
|
76
|
+
*/
|
|
77
|
+
export declare function getResizeHandler(options?: ResizeHandlerOptions): ResizeHandler;
|
|
78
|
+
/**
|
|
79
|
+
* Reset resize handler (for testing)
|
|
80
|
+
*/
|
|
81
|
+
export declare function resetResizeHandler(): void;
|