@widgetic/embed-sdk 0.0.0-stage → 2.0.7
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,177 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A/B Testing Manager for Embed SDK
|
|
3
|
+
* Handles variant selection, user assignment, and analytics tracking
|
|
4
|
+
*/
|
|
5
|
+
import { SimpleEventEmitter as EventEmitter } from '../utils/event-emitter.js';
|
|
6
|
+
import type { ABTestVariant } from '@widgetic/api-sdk';
|
|
7
|
+
export interface ABTestConfig {
|
|
8
|
+
experimentId: string;
|
|
9
|
+
isActive: boolean;
|
|
10
|
+
winningVariant?: string;
|
|
11
|
+
variants: Array<{
|
|
12
|
+
id: string;
|
|
13
|
+
compositionId: string;
|
|
14
|
+
embedCode: string;
|
|
15
|
+
trafficPercentage: number;
|
|
16
|
+
}>;
|
|
17
|
+
successMetrics: string[];
|
|
18
|
+
primaryMetric: string;
|
|
19
|
+
}
|
|
20
|
+
export interface ABTestAssignment {
|
|
21
|
+
variantId: string;
|
|
22
|
+
compositionId: string;
|
|
23
|
+
embedCode: string;
|
|
24
|
+
}
|
|
25
|
+
export interface ConversionTrackingSetup {
|
|
26
|
+
experimentId: string;
|
|
27
|
+
variantId: string;
|
|
28
|
+
metrics: string[];
|
|
29
|
+
trackingTargets: {
|
|
30
|
+
[metric: string]: string[];
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* A/B Testing Manager
|
|
35
|
+
* Singleton for managing A/B test variant assignment and analytics
|
|
36
|
+
*/
|
|
37
|
+
export declare class ABTestManager extends EventEmitter {
|
|
38
|
+
private static instance;
|
|
39
|
+
private assignments;
|
|
40
|
+
private abTestingApi;
|
|
41
|
+
private compositionsApi;
|
|
42
|
+
private widgetManager;
|
|
43
|
+
private messenger;
|
|
44
|
+
private conversionSetups;
|
|
45
|
+
private trackedConversions;
|
|
46
|
+
private constructor();
|
|
47
|
+
/**
|
|
48
|
+
* Get singleton instance
|
|
49
|
+
*/
|
|
50
|
+
static getInstance(): ABTestManager;
|
|
51
|
+
/**
|
|
52
|
+
* Setup event listeners for widget interactions
|
|
53
|
+
*/
|
|
54
|
+
private setupEventListeners;
|
|
55
|
+
/**
|
|
56
|
+
* Get A/B test configuration with real composition data.
|
|
57
|
+
* This method uses a public, non-workspace-specific endpoint.
|
|
58
|
+
*/
|
|
59
|
+
getTestConfig(experimentId: string): Promise<ABTestConfig | null>;
|
|
60
|
+
/**
|
|
61
|
+
* Get variant assignment for user with proper composition validation
|
|
62
|
+
*/
|
|
63
|
+
getVariantAssignment(experimentId: string, userContext: {
|
|
64
|
+
userId?: string;
|
|
65
|
+
sessionId?: string;
|
|
66
|
+
attributes?: Record<string, any>;
|
|
67
|
+
}): Promise<ABTestVariant | null>;
|
|
68
|
+
/**
|
|
69
|
+
* Setup conversion tracking for the assigned variant
|
|
70
|
+
*/
|
|
71
|
+
private setupConversionTracking;
|
|
72
|
+
/**
|
|
73
|
+
* Find tracking targets in composition content
|
|
74
|
+
*/
|
|
75
|
+
private findTrackingTargets;
|
|
76
|
+
/**
|
|
77
|
+
* Check if a CSS selector exists in HTML content
|
|
78
|
+
*/
|
|
79
|
+
private selectorExistsInContent;
|
|
80
|
+
/**
|
|
81
|
+
* Setup widget-specific conversion tracking
|
|
82
|
+
*/
|
|
83
|
+
private setupWidgetConversionTracking;
|
|
84
|
+
/**
|
|
85
|
+
* Setup click tracking using widget function exposure
|
|
86
|
+
*/
|
|
87
|
+
private setupClickTracking;
|
|
88
|
+
/**
|
|
89
|
+
* Setup form tracking using widget function exposure
|
|
90
|
+
*/
|
|
91
|
+
private setupFormTracking;
|
|
92
|
+
/**
|
|
93
|
+
* Setup media tracking using widget function exposure
|
|
94
|
+
*/
|
|
95
|
+
private setupMediaTracking;
|
|
96
|
+
/**
|
|
97
|
+
* Handle widget custom events for conversion tracking
|
|
98
|
+
*/
|
|
99
|
+
private handleWidgetCustomEvent;
|
|
100
|
+
/**
|
|
101
|
+
* Handle media events for conversion tracking
|
|
102
|
+
*/
|
|
103
|
+
private handleMediaEvent;
|
|
104
|
+
/**
|
|
105
|
+
* Handle form events for conversion tracking
|
|
106
|
+
*/
|
|
107
|
+
private handleFormEvent;
|
|
108
|
+
/**
|
|
109
|
+
* Handle click events for conversion tracking
|
|
110
|
+
*/
|
|
111
|
+
private handleClickEvent;
|
|
112
|
+
/**
|
|
113
|
+
* Track conversion with one-per-user enforcement
|
|
114
|
+
*/
|
|
115
|
+
trackConversion(experimentId: string, variantId: string, conversionType: string, data?: any, userContext?: {
|
|
116
|
+
userId?: string;
|
|
117
|
+
sessionId?: string;
|
|
118
|
+
}): Promise<void>;
|
|
119
|
+
/**
|
|
120
|
+
* Track impression event
|
|
121
|
+
*/
|
|
122
|
+
trackImpression(experimentId: string, variantId: string, userContext?: {
|
|
123
|
+
userId?: string;
|
|
124
|
+
sessionId?: string;
|
|
125
|
+
}): Promise<void>;
|
|
126
|
+
/**
|
|
127
|
+
* Validate goal tracking using real widget capabilities from embed SDK
|
|
128
|
+
*/
|
|
129
|
+
validateGoalTracking(variants: Array<{
|
|
130
|
+
composition_id: string;
|
|
131
|
+
name: string;
|
|
132
|
+
}>, successMetrics: string[]): Promise<{
|
|
133
|
+
isValid: boolean;
|
|
134
|
+
issues: Array<{
|
|
135
|
+
variant: string;
|
|
136
|
+
metric: string;
|
|
137
|
+
reason: string;
|
|
138
|
+
}>;
|
|
139
|
+
recommendations: string[];
|
|
140
|
+
}>;
|
|
141
|
+
/**
|
|
142
|
+
* Validate a single variant's tracking capabilities using embed SDK
|
|
143
|
+
*/
|
|
144
|
+
private validateVariantCapabilities;
|
|
145
|
+
/**
|
|
146
|
+
* Check if a widget supports a specific success metric
|
|
147
|
+
*/
|
|
148
|
+
private checkMetricSupport;
|
|
149
|
+
/**
|
|
150
|
+
* Check if widget has clickable capabilities
|
|
151
|
+
*/
|
|
152
|
+
private hasClickableCapabilities;
|
|
153
|
+
/**
|
|
154
|
+
* Select variant based on traffic allocation and user context
|
|
155
|
+
*/
|
|
156
|
+
private selectVariant;
|
|
157
|
+
/**
|
|
158
|
+
* Create deterministic hash for consistent user assignment
|
|
159
|
+
*/
|
|
160
|
+
private createDeterministicHash;
|
|
161
|
+
/**
|
|
162
|
+
* Create assignment in backend
|
|
163
|
+
*/
|
|
164
|
+
private createAssignment;
|
|
165
|
+
/**
|
|
166
|
+
* Generate embed code for composition
|
|
167
|
+
*/
|
|
168
|
+
private generateEmbedCode;
|
|
169
|
+
/**
|
|
170
|
+
* Get or create session ID
|
|
171
|
+
*/
|
|
172
|
+
private getSessionId;
|
|
173
|
+
/**
|
|
174
|
+
* Detect device type from user agent
|
|
175
|
+
*/
|
|
176
|
+
private detectDeviceType;
|
|
177
|
+
}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
export interface CompositionData {
|
|
2
|
+
id: string;
|
|
3
|
+
name: string;
|
|
4
|
+
widgetId: string;
|
|
5
|
+
config: Record<string, any>;
|
|
6
|
+
metadata?: Record<string, any>;
|
|
7
|
+
createdAt?: string;
|
|
8
|
+
updatedAt?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface WidgetData {
|
|
11
|
+
id: string;
|
|
12
|
+
name: string;
|
|
13
|
+
type: string;
|
|
14
|
+
version: string;
|
|
15
|
+
moduleUrl: string;
|
|
16
|
+
dependencies?: string[];
|
|
17
|
+
metadata?: Record<string, any>;
|
|
18
|
+
}
|
|
19
|
+
export interface BatchCompositionsResponse {
|
|
20
|
+
compositions: CompositionData[];
|
|
21
|
+
errors?: Array<{
|
|
22
|
+
id: string;
|
|
23
|
+
error: string;
|
|
24
|
+
}>;
|
|
25
|
+
}
|
|
26
|
+
export interface BatchWidgetsResponse {
|
|
27
|
+
widgets: WidgetData[];
|
|
28
|
+
errors?: Array<{
|
|
29
|
+
id: string;
|
|
30
|
+
error: string;
|
|
31
|
+
}>;
|
|
32
|
+
}
|
|
33
|
+
interface BatchRequestConfig {
|
|
34
|
+
maxBatchSize: number;
|
|
35
|
+
debounceDelay: number;
|
|
36
|
+
retryAttempts: number;
|
|
37
|
+
retryBaseDelay: number;
|
|
38
|
+
cacheTTL: number;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Intelligent batch API client with caching, deduplication, and retry logic
|
|
42
|
+
*/
|
|
43
|
+
export declare class BatchApiClient {
|
|
44
|
+
private compositionCache;
|
|
45
|
+
private widgetCache;
|
|
46
|
+
private pendingCompositionRequests;
|
|
47
|
+
private pendingWidgetRequests;
|
|
48
|
+
private compositionResolvers;
|
|
49
|
+
private widgetResolvers;
|
|
50
|
+
private compositionBatchQueue;
|
|
51
|
+
private widgetBatchQueue;
|
|
52
|
+
private compositionBatchTimer;
|
|
53
|
+
private widgetBatchTimer;
|
|
54
|
+
private lastBatchError;
|
|
55
|
+
private readonly config;
|
|
56
|
+
constructor(config?: Partial<BatchRequestConfig>);
|
|
57
|
+
/**
|
|
58
|
+
* Get compositions with intelligent batching and caching
|
|
59
|
+
*/
|
|
60
|
+
getCompositions(ids: string[]): Promise<CompositionData[]>;
|
|
61
|
+
/**
|
|
62
|
+
* Get widgets with intelligent batching and caching
|
|
63
|
+
*/
|
|
64
|
+
getWidgets(ids: string[]): Promise<WidgetData[]>;
|
|
65
|
+
/**
|
|
66
|
+
* Get single composition with caching
|
|
67
|
+
*/
|
|
68
|
+
getComposition(id: string): Promise<CompositionData>;
|
|
69
|
+
/**
|
|
70
|
+
* Get single widget with caching
|
|
71
|
+
*/
|
|
72
|
+
getWidget(id: string): Promise<WidgetData>;
|
|
73
|
+
/**
|
|
74
|
+
* Batch compositions with intelligent queuing
|
|
75
|
+
*/
|
|
76
|
+
private batchCompositions;
|
|
77
|
+
/**
|
|
78
|
+
* Batch widgets with intelligent queuing
|
|
79
|
+
*/
|
|
80
|
+
private batchWidgets;
|
|
81
|
+
/**
|
|
82
|
+
* Schedule composition batch execution
|
|
83
|
+
*/
|
|
84
|
+
private scheduleCompositionBatch;
|
|
85
|
+
/**
|
|
86
|
+
* Schedule widget batch execution
|
|
87
|
+
*/
|
|
88
|
+
private scheduleWidgetBatch;
|
|
89
|
+
/**
|
|
90
|
+
* Execute composition batch request
|
|
91
|
+
*/
|
|
92
|
+
private executeCompositionBatch;
|
|
93
|
+
/**
|
|
94
|
+
* Execute widget batch request
|
|
95
|
+
*/
|
|
96
|
+
private executeWidgetBatch;
|
|
97
|
+
/**
|
|
98
|
+
* Fetch compositions batch with retry logic and enhanced error handling
|
|
99
|
+
*/
|
|
100
|
+
private fetchCompositionsBatch;
|
|
101
|
+
/**
|
|
102
|
+
* Fetch widgets batch with retry logic and enhanced error handling
|
|
103
|
+
*/
|
|
104
|
+
private fetchWidgetsBatch;
|
|
105
|
+
/**
|
|
106
|
+
* Get cached composition if valid
|
|
107
|
+
*/
|
|
108
|
+
private getCachedComposition;
|
|
109
|
+
/**
|
|
110
|
+
* Get cached widget if valid
|
|
111
|
+
*/
|
|
112
|
+
private getCachedWidget;
|
|
113
|
+
/**
|
|
114
|
+
* Cache composition data
|
|
115
|
+
*/
|
|
116
|
+
private cacheComposition;
|
|
117
|
+
/**
|
|
118
|
+
* Cache widget data
|
|
119
|
+
*/
|
|
120
|
+
private cacheWidget;
|
|
121
|
+
/**
|
|
122
|
+
* Clear all caches
|
|
123
|
+
*/
|
|
124
|
+
clearCache(): void;
|
|
125
|
+
/**
|
|
126
|
+
* Get cache statistics
|
|
127
|
+
*/
|
|
128
|
+
getCacheStats(): {
|
|
129
|
+
compositions: {
|
|
130
|
+
size: number;
|
|
131
|
+
entries: {
|
|
132
|
+
id: string;
|
|
133
|
+
age: number;
|
|
134
|
+
ttl: number;
|
|
135
|
+
}[];
|
|
136
|
+
};
|
|
137
|
+
widgets: {
|
|
138
|
+
size: number;
|
|
139
|
+
entries: {
|
|
140
|
+
id: string;
|
|
141
|
+
age: number;
|
|
142
|
+
ttl: number;
|
|
143
|
+
}[];
|
|
144
|
+
};
|
|
145
|
+
pending: {
|
|
146
|
+
compositions: number;
|
|
147
|
+
widgets: number;
|
|
148
|
+
};
|
|
149
|
+
queues: {
|
|
150
|
+
compositions: number;
|
|
151
|
+
widgets: number;
|
|
152
|
+
};
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Get or create global batch client instance
|
|
157
|
+
*/
|
|
158
|
+
export declare function getBatchClient(): BatchApiClient;
|
|
159
|
+
/**
|
|
160
|
+
* Reset global batch client (useful for testing)
|
|
161
|
+
*/
|
|
162
|
+
export declare function resetBatchClient(): void;
|
|
163
|
+
export {};
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Widgetic SDK - Layered API Architecture
|
|
3
|
+
*
|
|
4
|
+
* This module organizes the SDK into three distinct layers:
|
|
5
|
+
* - High-level: Declarative, auto-magical usage (HTML custom elements)
|
|
6
|
+
* - Mid-level: Programmatic with configuration (render functions)
|
|
7
|
+
* - Low-level: Full control, manual management (direct API access)
|
|
8
|
+
*/
|
|
9
|
+
export { WidgeticWidget, registerWidgeticWidget, } from "../core/custom-element.js";
|
|
10
|
+
export { getSDK, EmbedSDK } from "../core/embed-sdk.js";
|
|
11
|
+
export { setApiKey, setTokenProvider, getConfiguration, } from "../core/config.js";
|
|
12
|
+
export { StaticApiKeyProvider, EndpointTokenProvider, FunctionTokenProvider, } from "../core/token-provider.js";
|
|
13
|
+
export { WidgetRenderer, getWidgetRenderer, type WidgetRenderOptions, type RenderedWidget, } from "../renderers/widget-renderer.js";
|
|
14
|
+
export { CustomElementRenderer, type CustomElementRenderOptions, } from "../renderers/custom-element-renderer.js";
|
|
15
|
+
export { IframeRenderer, type IframeRenderOptions, } from "../renderers/iframe-renderer.js";
|
|
16
|
+
export { AuthManager, type AuthManagerConfig, } from "../core/auth-manager.js";
|
|
17
|
+
export { detectBrowserCapabilities, determineBestRenderMode, } from "../utils/browser.js";
|
|
18
|
+
export { parseWidgetConfig, generateInstanceId, isValidWidgetElement, } from "../utils/parser.js";
|
|
19
|
+
export { BatchApiClient, getBatchClient, resetBatchClient, type CompositionData, type WidgetData, type BatchCompositionsResponse, type BatchWidgetsResponse, } from "../api/batch-client.js";
|
|
20
|
+
export { ModuleLoader, getModuleLoader, resetModuleLoader, type WidgetModule, type LoadedModule, type ModuleLoadOptions, } from "../loaders/module-loader.js";
|
|
21
|
+
export { WidgeticMessenger, getMessenger, resetMessenger, type WidgeticMessage, type MessagingSecurityOptions, } from "../core/messaging.js";
|
|
22
|
+
export { config, getApiUrl, getCdnUrl, getTokenProvider, getAuthToken, } from "../core/config.js";
|
|
23
|
+
export { type TokenProvider, DefaultTokenProvider, } from "../core/token-provider.js";
|
|
24
|
+
export { AuthError, type TokenInfo, type TokenExchangeOptions, } from "../core/auth-manager.js";
|
|
25
|
+
export { CSSDebugger, cssDebugger, enableCSSDebug, disableCSSDebug, analyzeWidgetCSS, monitorWidgetCSS, type CSSConflict, type StyleIsolationReport, } from "../utils/css-debug.js";
|
|
26
|
+
export { log } from "../utils/logger.js";
|
|
27
|
+
import { WidgeticWidget, registerWidgeticWidget } from "../core/custom-element.js";
|
|
28
|
+
import { getSDK } from "../core/embed-sdk.js";
|
|
29
|
+
import { setApiKey, setTokenProvider, getConfiguration, getApiUrl, getCdnUrl, getTokenProvider, getAuthToken } from "../core/config.js";
|
|
30
|
+
import { StaticApiKeyProvider, EndpointTokenProvider, FunctionTokenProvider, DefaultTokenProvider } from "../core/token-provider.js";
|
|
31
|
+
import { AuthManager } from "../core/auth-manager.js";
|
|
32
|
+
import { WidgetRenderer, getWidgetRenderer } from "../renderers/widget-renderer.js";
|
|
33
|
+
import { CustomElementRenderer } from "../renderers/custom-element-renderer.js";
|
|
34
|
+
import { IframeRenderer } from "../renderers/iframe-renderer.js";
|
|
35
|
+
import { detectBrowserCapabilities, determineBestRenderMode } from "../utils/browser.js";
|
|
36
|
+
import { parseWidgetConfig, generateInstanceId, isValidWidgetElement } from "../utils/parser.js";
|
|
37
|
+
import { BatchApiClient, getBatchClient } from "../api/batch-client.js";
|
|
38
|
+
import { ModuleLoader, getModuleLoader } from "../loaders/module-loader.js";
|
|
39
|
+
import { WidgeticMessenger, getMessenger } from "../core/messaging.js";
|
|
40
|
+
import { CSSDebugger, enableCSSDebug, disableCSSDebug } from "../utils/css-debug.js";
|
|
41
|
+
/**
|
|
42
|
+
* High-Level API - Declarative & Auto-magical
|
|
43
|
+
*
|
|
44
|
+
* Perfect for: Simple integrations, HTML-first approaches, minimal JavaScript
|
|
45
|
+
* Characteristics: Auto-initialization, convention over configuration, declarative HTML
|
|
46
|
+
*/
|
|
47
|
+
export declare const HighLevelAPI: {
|
|
48
|
+
readonly WidgeticWidget: typeof WidgeticWidget;
|
|
49
|
+
readonly registerWidgeticWidget: typeof registerWidgeticWidget;
|
|
50
|
+
readonly getSDK: typeof getSDK;
|
|
51
|
+
readonly setApiKey: typeof setApiKey;
|
|
52
|
+
readonly setTokenProvider: typeof setTokenProvider;
|
|
53
|
+
readonly StaticApiKeyProvider: typeof StaticApiKeyProvider;
|
|
54
|
+
readonly EndpointTokenProvider: typeof EndpointTokenProvider;
|
|
55
|
+
readonly FunctionTokenProvider: typeof FunctionTokenProvider;
|
|
56
|
+
readonly getConfiguration: typeof getConfiguration;
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* Mid-Level API - Programmatic with Configuration
|
|
60
|
+
*
|
|
61
|
+
* Perfect for: Framework integrations, custom UIs, controlled rendering
|
|
62
|
+
* Characteristics: Programmatic control, flexible configuration, managed lifecycle
|
|
63
|
+
*/
|
|
64
|
+
export declare const MidLevelAPI: {
|
|
65
|
+
readonly WidgetRenderer: typeof WidgetRenderer;
|
|
66
|
+
readonly getWidgetRenderer: typeof getWidgetRenderer;
|
|
67
|
+
readonly CustomElementRenderer: typeof CustomElementRenderer;
|
|
68
|
+
readonly IframeRenderer: typeof IframeRenderer;
|
|
69
|
+
readonly AuthManager: typeof AuthManager;
|
|
70
|
+
readonly detectBrowserCapabilities: typeof detectBrowserCapabilities;
|
|
71
|
+
readonly determineBestRenderMode: typeof determineBestRenderMode;
|
|
72
|
+
readonly parseWidgetConfig: typeof parseWidgetConfig;
|
|
73
|
+
readonly generateInstanceId: typeof generateInstanceId;
|
|
74
|
+
readonly isValidWidgetElement: typeof isValidWidgetElement;
|
|
75
|
+
};
|
|
76
|
+
/**
|
|
77
|
+
* Low-Level API - Full Control & Manual Management
|
|
78
|
+
*
|
|
79
|
+
* Perfect for: Custom implementations, performance optimization, advanced use cases
|
|
80
|
+
* Characteristics: Manual lifecycle management, direct API access, maximum flexibility
|
|
81
|
+
*/
|
|
82
|
+
export declare const LowLevelAPI: {
|
|
83
|
+
readonly BatchApiClient: typeof BatchApiClient;
|
|
84
|
+
readonly getBatchClient: typeof getBatchClient;
|
|
85
|
+
readonly ModuleLoader: typeof ModuleLoader;
|
|
86
|
+
readonly getModuleLoader: typeof getModuleLoader;
|
|
87
|
+
readonly WidgeticMessenger: typeof WidgeticMessenger;
|
|
88
|
+
readonly getMessenger: typeof getMessenger;
|
|
89
|
+
readonly config: {
|
|
90
|
+
readonly API_URL: string;
|
|
91
|
+
readonly API_VERSION: string;
|
|
92
|
+
readonly CLIENT_URL: string;
|
|
93
|
+
readonly PRODUCTION_URL: string;
|
|
94
|
+
readonly NODE_ENV: "development" | "production";
|
|
95
|
+
readonly ENABLE_EDITING: boolean;
|
|
96
|
+
readonly API_KEY: string;
|
|
97
|
+
readonly AXIOM_API_KEY: string;
|
|
98
|
+
readonly STATSIG_KEY: string;
|
|
99
|
+
};
|
|
100
|
+
readonly getApiUrl: typeof getApiUrl;
|
|
101
|
+
readonly getCdnUrl: typeof getCdnUrl;
|
|
102
|
+
readonly getTokenProvider: typeof getTokenProvider;
|
|
103
|
+
readonly getAuthToken: typeof getAuthToken;
|
|
104
|
+
readonly DefaultTokenProvider: typeof DefaultTokenProvider;
|
|
105
|
+
readonly CSSDebugger: typeof CSSDebugger;
|
|
106
|
+
readonly cssDebugger: CSSDebugger;
|
|
107
|
+
readonly enableCSSDebug: typeof enableCSSDebug;
|
|
108
|
+
readonly disableCSSDebug: typeof disableCSSDebug;
|
|
109
|
+
readonly log: {
|
|
110
|
+
debug: (message: string, ...args: any[]) => void;
|
|
111
|
+
info: (message: string, ...args: any[]) => void;
|
|
112
|
+
warn: (message: string, ...args: any[]) => void;
|
|
113
|
+
error: (message: string, ...args: any[]) => void;
|
|
114
|
+
setLevel: (level: "info" | "debug" | "warn" | "error") => void;
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
export type HighLevelAPIType = typeof HighLevelAPI;
|
|
118
|
+
export type MidLevelAPIType = typeof MidLevelAPI;
|
|
119
|
+
export type LowLevelAPIType = typeof LowLevelAPI;
|