@weldsuite/helpdesk-widget-sdk 1.0.16 → 1.0.17
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/dist/angular.d.ts +32 -41
- package/dist/angular.esm.js +237 -58
- package/dist/angular.esm.js.map +1 -1
- package/dist/angular.js +237 -58
- package/dist/angular.js.map +1 -1
- package/dist/index.d.ts +55 -55
- package/dist/index.esm.js +259 -60
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +260 -59
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +260 -59
- package/dist/index.umd.js.map +1 -1
- package/dist/react.d.ts +32 -41
- package/dist/react.esm.js +237 -58
- package/dist/react.esm.js.map +1 -1
- package/dist/react.js +237 -58
- package/dist/react.js.map +1 -1
- package/dist/vue-composables.esm.js +237 -58
- package/dist/vue-composables.esm.js.map +1 -1
- package/dist/vue-composables.js +237 -58
- package/dist/vue-composables.js.map +1 -1
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -27,41 +27,6 @@ interface PositionConfig {
|
|
|
27
27
|
left?: string;
|
|
28
28
|
top?: string;
|
|
29
29
|
}
|
|
30
|
-
/**
|
|
31
|
-
* Customization configuration
|
|
32
|
-
*/
|
|
33
|
-
interface CustomizationConfig {
|
|
34
|
-
primaryColor?: string;
|
|
35
|
-
accentColor?: string;
|
|
36
|
-
backgroundColor?: string;
|
|
37
|
-
textColor?: string;
|
|
38
|
-
fontFamily?: string;
|
|
39
|
-
fontSize?: string;
|
|
40
|
-
borderRadius?: string;
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Feature flags
|
|
44
|
-
*/
|
|
45
|
-
interface FeatureConfig {
|
|
46
|
-
attachments?: boolean;
|
|
47
|
-
reactions?: boolean;
|
|
48
|
-
typing?: boolean;
|
|
49
|
-
readReceipts?: boolean;
|
|
50
|
-
offlineMode?: boolean;
|
|
51
|
-
fileUpload?: boolean;
|
|
52
|
-
imageUpload?: boolean;
|
|
53
|
-
voiceMessages?: boolean;
|
|
54
|
-
videoMessages?: boolean;
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Mobile configuration
|
|
58
|
-
*/
|
|
59
|
-
interface MobileConfig {
|
|
60
|
-
fullScreen?: boolean;
|
|
61
|
-
scrollLock?: boolean;
|
|
62
|
-
keyboardHandling?: 'auto' | 'manual';
|
|
63
|
-
safeAreaInsets?: boolean;
|
|
64
|
-
}
|
|
65
30
|
/**
|
|
66
31
|
* Iframe configuration
|
|
67
32
|
*/
|
|
@@ -154,15 +119,13 @@ interface SecurityConfig {
|
|
|
154
119
|
*/
|
|
155
120
|
interface WeldConfig {
|
|
156
121
|
widgetId: string;
|
|
122
|
+
testMode?: boolean;
|
|
157
123
|
api?: Partial<ApiConfig>;
|
|
158
124
|
iframes?: Partial<IframeConfig>;
|
|
159
125
|
position?: {
|
|
160
126
|
launcher?: PositionConfig;
|
|
161
127
|
widget?: PositionConfig;
|
|
162
128
|
};
|
|
163
|
-
customization?: CustomizationConfig;
|
|
164
|
-
features?: FeatureConfig;
|
|
165
|
-
mobile?: MobileConfig;
|
|
166
129
|
auth?: AuthConfig;
|
|
167
130
|
locale?: LocaleConfig;
|
|
168
131
|
logging?: LogConfig;
|
|
@@ -182,11 +145,9 @@ interface WeldConfig {
|
|
|
182
145
|
*/
|
|
183
146
|
interface ResolvedConfig {
|
|
184
147
|
widgetId: string;
|
|
148
|
+
testMode?: boolean;
|
|
185
149
|
api: ApiConfig;
|
|
186
150
|
iframes: IframeConfig;
|
|
187
|
-
customization: CustomizationConfig;
|
|
188
|
-
features: FeatureConfig;
|
|
189
|
-
mobile: MobileConfig;
|
|
190
151
|
auth: AuthConfig;
|
|
191
152
|
locale: LocaleConfig;
|
|
192
153
|
logging: LogConfig;
|
|
@@ -499,6 +460,7 @@ declare class WeldSDK {
|
|
|
499
460
|
private readyResolve;
|
|
500
461
|
private boundHandleLauncherClick;
|
|
501
462
|
private subscriptionIds;
|
|
463
|
+
private pageTrackingCleanup;
|
|
502
464
|
constructor(config: WeldConfig);
|
|
503
465
|
/**
|
|
504
466
|
* Handle launcher click messages from iframe
|
|
@@ -532,6 +494,22 @@ declare class WeldSDK {
|
|
|
532
494
|
* Check if SDK is ready
|
|
533
495
|
*/
|
|
534
496
|
isReady(): boolean;
|
|
497
|
+
/**
|
|
498
|
+
* Update callbacks on an existing instance (used by singleton reuse)
|
|
499
|
+
*/
|
|
500
|
+
updateCallbacks(config: Partial<WeldConfig>): void;
|
|
501
|
+
/**
|
|
502
|
+
* Persist open/closed state to sessionStorage
|
|
503
|
+
*/
|
|
504
|
+
private persistOpenState;
|
|
505
|
+
/**
|
|
506
|
+
* Clear persisted state from sessionStorage
|
|
507
|
+
*/
|
|
508
|
+
private clearPersistedState;
|
|
509
|
+
/**
|
|
510
|
+
* Check if widget was previously open (from sessionStorage)
|
|
511
|
+
*/
|
|
512
|
+
private wasOpen;
|
|
535
513
|
/**
|
|
536
514
|
* Open the widget
|
|
537
515
|
*/
|
|
@@ -687,19 +665,39 @@ declare class WeldSDK {
|
|
|
687
665
|
* Disable debug mode
|
|
688
666
|
*/
|
|
689
667
|
disableDebug(): void;
|
|
668
|
+
/**
|
|
669
|
+
* Send a page change message to the widget iframe
|
|
670
|
+
*/
|
|
671
|
+
private sendPageChange;
|
|
672
|
+
/**
|
|
673
|
+
* Start tracking page URL changes (SPA navigations + popstate)
|
|
674
|
+
*/
|
|
675
|
+
private startPageTracking;
|
|
690
676
|
/**
|
|
691
677
|
* Ensure SDK is ready before operation
|
|
692
678
|
*/
|
|
693
679
|
private ensureReady;
|
|
680
|
+
/**
|
|
681
|
+
* Detach from the current component lifecycle without destroying the widget.
|
|
682
|
+
* Use this as a React useEffect cleanup — the widget stays alive across navigations.
|
|
683
|
+
*/
|
|
684
|
+
detach(): void;
|
|
694
685
|
/**
|
|
695
686
|
* Destroy SDK and cleanup
|
|
696
687
|
*/
|
|
697
688
|
destroy(): void;
|
|
698
689
|
}
|
|
699
690
|
/**
|
|
700
|
-
* Create and initialize WeldSDK instance
|
|
691
|
+
* Create and initialize WeldSDK instance.
|
|
692
|
+
* Uses singleton pattern — if an instance for the same widgetId already exists
|
|
693
|
+
* and is not destroyed, updates callbacks and returns the existing instance.
|
|
701
694
|
*/
|
|
702
695
|
declare function createWeldSDK(config: WeldConfig): Promise<WeldSDK>;
|
|
696
|
+
/**
|
|
697
|
+
* Explicitly destroy a WeldSDK instance by widgetId.
|
|
698
|
+
* Use this for logout or when you need to fully remove the widget.
|
|
699
|
+
*/
|
|
700
|
+
declare function destroyWeldSDK(widgetId: string): void;
|
|
703
701
|
|
|
704
702
|
/**
|
|
705
703
|
* Weld SDK - Iframe Manager
|
|
@@ -745,6 +743,7 @@ declare class IframeManager {
|
|
|
745
743
|
private boundHandleResize;
|
|
746
744
|
private boundHandleOrientationChange;
|
|
747
745
|
private boundHandleVisualViewportResize;
|
|
746
|
+
private eventListenersBound;
|
|
748
747
|
constructor(config: ResolvedConfig);
|
|
749
748
|
/**
|
|
750
749
|
* Initialize all containers and iframes
|
|
@@ -753,6 +752,7 @@ declare class IframeManager {
|
|
|
753
752
|
init(messageBroker?: MessageBrokerInterface): Promise<void>;
|
|
754
753
|
/**
|
|
755
754
|
* Create root container structure
|
|
755
|
+
* Reuses existing container if it has the same widgetId (singleton behavior)
|
|
756
756
|
*/
|
|
757
757
|
private createRootContainer;
|
|
758
758
|
/**
|
|
@@ -887,6 +887,7 @@ declare enum MessageType {
|
|
|
887
887
|
AUTH_TOKEN_UPDATE = "weld:auth:token:update",
|
|
888
888
|
EVENT_TRACK = "weld:event:track",
|
|
889
889
|
ERROR_REPORT = "weld:error:report",
|
|
890
|
+
PAGE_CHANGE = "weld:page:change",
|
|
890
891
|
API_SUCCESS = "weld:api:success",
|
|
891
892
|
API_ERROR = "weld:api:error"
|
|
892
893
|
}
|
|
@@ -968,16 +969,6 @@ interface ConfigUpdatePayload {
|
|
|
968
969
|
right: string;
|
|
969
970
|
};
|
|
970
971
|
};
|
|
971
|
-
customization?: {
|
|
972
|
-
primaryColor?: string;
|
|
973
|
-
accentColor?: string;
|
|
974
|
-
fontFamily?: string;
|
|
975
|
-
};
|
|
976
|
-
features?: {
|
|
977
|
-
attachments?: boolean;
|
|
978
|
-
reactions?: boolean;
|
|
979
|
-
typing?: boolean;
|
|
980
|
-
};
|
|
981
972
|
}
|
|
982
973
|
/**
|
|
983
974
|
* Theme update payload
|
|
@@ -1016,6 +1007,14 @@ interface EventPayload {
|
|
|
1016
1007
|
properties?: Record<string, any>;
|
|
1017
1008
|
timestamp: number;
|
|
1018
1009
|
}
|
|
1010
|
+
/**
|
|
1011
|
+
* Page change payload
|
|
1012
|
+
*/
|
|
1013
|
+
interface PageChangePayload {
|
|
1014
|
+
url: string;
|
|
1015
|
+
title: string;
|
|
1016
|
+
timestamp: number;
|
|
1017
|
+
}
|
|
1019
1018
|
/**
|
|
1020
1019
|
* Type guards
|
|
1021
1020
|
*/
|
|
@@ -1042,10 +1041,11 @@ type ThemeUpdateMessage = PayloadMessage<ThemeUpdatePayload>;
|
|
|
1042
1041
|
type AuthMessage = PayloadMessage<AuthPayload>;
|
|
1043
1042
|
type ErrorMessage = PayloadMessage<ErrorPayload>;
|
|
1044
1043
|
type EventMessage = PayloadMessage<EventPayload>;
|
|
1044
|
+
type PageChangeMessage = PayloadMessage<PageChangePayload>;
|
|
1045
1045
|
/**
|
|
1046
1046
|
* Union type for all messages
|
|
1047
1047
|
*/
|
|
1048
|
-
type WeldMessage = BaseMessage | ReadyMessage | StateUpdateMessage | WidgetStateMessage | LauncherStateMessage | BackdropStateMessage | MessageDataMessage | ConfigUpdateMessage | ThemeUpdateMessage | AuthMessage | ErrorMessage | EventMessage;
|
|
1048
|
+
type WeldMessage = BaseMessage | ReadyMessage | StateUpdateMessage | WidgetStateMessage | LauncherStateMessage | BackdropStateMessage | MessageDataMessage | ConfigUpdateMessage | ThemeUpdateMessage | AuthMessage | ErrorMessage | EventMessage | PageChangeMessage;
|
|
1049
1049
|
|
|
1050
1050
|
/**
|
|
1051
1051
|
* Weld SDK - Logger Utility
|
|
@@ -1539,5 +1539,5 @@ declare function isValidFileSize(file: File, maxSizeBytes: number): boolean;
|
|
|
1539
1539
|
*/
|
|
1540
1540
|
declare function formatFileSize(bytes: number): string;
|
|
1541
1541
|
|
|
1542
|
-
export { ConnectionStatus, DEFAULT_CONFIG, WeldSDK as HelpdeskWidget, IframeManager, IframeType, LogLevel, Logger, MessageBroker, MessageOrigin, MessageStatus, MessageType, RateLimiter, SecurityManager, StateCoordinator, TokenValidator, WeldSDK, WidgetView, WidgetVisibility, createInitialState, createMessage, createWeldSDK, deepClone, deepMerge, WeldSDK as default, defaultLogger, formatFileSize, getStateValue, hasRequiredProperties, createWeldSDK as initHelpdeskWidget, isBaseMessage, isInRange, isPayloadMessage, isPlainObject, isValidApiKey, isValidArrayLength, isValidColor, isValidEmail, isValidFileSize, isValidFileType, isValidLength, isValidMessageText, isValidUrl, isValidWorkspaceId, resolveConfig, sanitizeHtml, sanitizeInput, setStateValue, validateConfig };
|
|
1543
|
-
export type { ApiConfig, Attachment, AuthConfig, AuthPayload, BackdropState, BackdropStatePayload, BaseMessage, ConfigUpdatePayload, ConversationState,
|
|
1542
|
+
export { ConnectionStatus, DEFAULT_CONFIG, WeldSDK as HelpdeskWidget, IframeManager, IframeType, LogLevel, Logger, MessageBroker, MessageOrigin, MessageStatus, MessageType, RateLimiter, SecurityManager, StateCoordinator, TokenValidator, WeldSDK, WidgetView, WidgetVisibility, createInitialState, createMessage, createWeldSDK, deepClone, deepMerge, WeldSDK as default, defaultLogger, destroyWeldSDK as destroyHelpdeskWidget, destroyWeldSDK, formatFileSize, getStateValue, hasRequiredProperties, createWeldSDK as initHelpdeskWidget, isBaseMessage, isInRange, isPayloadMessage, isPlainObject, isValidApiKey, isValidArrayLength, isValidColor, isValidEmail, isValidFileSize, isValidFileType, isValidLength, isValidMessageText, isValidUrl, isValidWorkspaceId, resolveConfig, sanitizeHtml, sanitizeInput, setStateValue, validateConfig };
|
|
1543
|
+
export type { ApiConfig, Attachment, AuthConfig, AuthPayload, BackdropState, BackdropStatePayload, BaseMessage, ConfigUpdatePayload, ConversationState, DeviceInfo, DeviceType, ErrorPayload, EventPayload, WeldConfig as HelpdeskWidgetConfig, IframeConfig, LauncherState, LauncherStatePayload, LocaleConfig, LogConfig, Message, MessageDataPayload, MobileState, NetworkState, Participant, PayloadMessage, PerformanceConfig, PositionConfig, Reaction, ResolvedConfig, SecurityConfig, StateAction, StateListener, StateSubscription, StateUpdatePayload, ThemeUpdatePayload, UIState, UserState, WeldConfig, WeldMessage, WeldState, WidgetEvent, WidgetEventHandler, WidgetEventType, WidgetState, WidgetStatePayload };
|