@weldsuite/helpdesk-widget-sdk 1.0.15 → 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 +36 -41
- package/dist/angular.esm.js +483 -102
- package/dist/angular.esm.js.map +1 -1
- package/dist/angular.js +483 -102
- package/dist/angular.js.map +1 -1
- package/dist/index.d.ts +60 -56
- package/dist/index.esm.js +505 -104
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +506 -103
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +506 -103
- package/dist/index.umd.js.map +1 -1
- package/dist/react.d.ts +36 -41
- package/dist/react.esm.js +483 -102
- package/dist/react.esm.js.map +1 -1
- package/dist/react.js +483 -102
- package/dist/react.js.map +1 -1
- package/dist/vue-composables.esm.js +483 -102
- package/dist/vue-composables.esm.js.map +1 -1
- package/dist/vue-composables.js +483 -102
- 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,11 +460,16 @@ 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
|
|
505
467
|
*/
|
|
506
468
|
private handleLauncherClickMessage;
|
|
469
|
+
/**
|
|
470
|
+
* Show fullscreen image lightbox on the parent page
|
|
471
|
+
*/
|
|
472
|
+
private showImageLightbox;
|
|
507
473
|
/**
|
|
508
474
|
* Initialize the SDK and render widget
|
|
509
475
|
*/
|
|
@@ -528,6 +494,22 @@ declare class WeldSDK {
|
|
|
528
494
|
* Check if SDK is ready
|
|
529
495
|
*/
|
|
530
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;
|
|
531
513
|
/**
|
|
532
514
|
* Open the widget
|
|
533
515
|
*/
|
|
@@ -683,19 +665,39 @@ declare class WeldSDK {
|
|
|
683
665
|
* Disable debug mode
|
|
684
666
|
*/
|
|
685
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;
|
|
686
676
|
/**
|
|
687
677
|
* Ensure SDK is ready before operation
|
|
688
678
|
*/
|
|
689
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;
|
|
690
685
|
/**
|
|
691
686
|
* Destroy SDK and cleanup
|
|
692
687
|
*/
|
|
693
688
|
destroy(): void;
|
|
694
689
|
}
|
|
695
690
|
/**
|
|
696
|
-
* 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.
|
|
697
694
|
*/
|
|
698
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;
|
|
699
701
|
|
|
700
702
|
/**
|
|
701
703
|
* Weld SDK - Iframe Manager
|
|
@@ -741,6 +743,7 @@ declare class IframeManager {
|
|
|
741
743
|
private boundHandleResize;
|
|
742
744
|
private boundHandleOrientationChange;
|
|
743
745
|
private boundHandleVisualViewportResize;
|
|
746
|
+
private eventListenersBound;
|
|
744
747
|
constructor(config: ResolvedConfig);
|
|
745
748
|
/**
|
|
746
749
|
* Initialize all containers and iframes
|
|
@@ -749,6 +752,7 @@ declare class IframeManager {
|
|
|
749
752
|
init(messageBroker?: MessageBrokerInterface): Promise<void>;
|
|
750
753
|
/**
|
|
751
754
|
* Create root container structure
|
|
755
|
+
* Reuses existing container if it has the same widgetId (singleton behavior)
|
|
752
756
|
*/
|
|
753
757
|
private createRootContainer;
|
|
754
758
|
/**
|
|
@@ -768,7 +772,7 @@ declare class IframeManager {
|
|
|
768
772
|
*/
|
|
769
773
|
private createWidgetIframe;
|
|
770
774
|
/**
|
|
771
|
-
* Create backdrop iframe
|
|
775
|
+
* Create backdrop iframe — disabled, widget stays non-modal so users can interact with the page
|
|
772
776
|
*/
|
|
773
777
|
private createBackdropIframe;
|
|
774
778
|
/**
|
|
@@ -883,6 +887,7 @@ declare enum MessageType {
|
|
|
883
887
|
AUTH_TOKEN_UPDATE = "weld:auth:token:update",
|
|
884
888
|
EVENT_TRACK = "weld:event:track",
|
|
885
889
|
ERROR_REPORT = "weld:error:report",
|
|
890
|
+
PAGE_CHANGE = "weld:page:change",
|
|
886
891
|
API_SUCCESS = "weld:api:success",
|
|
887
892
|
API_ERROR = "weld:api:error"
|
|
888
893
|
}
|
|
@@ -964,16 +969,6 @@ interface ConfigUpdatePayload {
|
|
|
964
969
|
right: string;
|
|
965
970
|
};
|
|
966
971
|
};
|
|
967
|
-
customization?: {
|
|
968
|
-
primaryColor?: string;
|
|
969
|
-
accentColor?: string;
|
|
970
|
-
fontFamily?: string;
|
|
971
|
-
};
|
|
972
|
-
features?: {
|
|
973
|
-
attachments?: boolean;
|
|
974
|
-
reactions?: boolean;
|
|
975
|
-
typing?: boolean;
|
|
976
|
-
};
|
|
977
972
|
}
|
|
978
973
|
/**
|
|
979
974
|
* Theme update payload
|
|
@@ -1012,6 +1007,14 @@ interface EventPayload {
|
|
|
1012
1007
|
properties?: Record<string, any>;
|
|
1013
1008
|
timestamp: number;
|
|
1014
1009
|
}
|
|
1010
|
+
/**
|
|
1011
|
+
* Page change payload
|
|
1012
|
+
*/
|
|
1013
|
+
interface PageChangePayload {
|
|
1014
|
+
url: string;
|
|
1015
|
+
title: string;
|
|
1016
|
+
timestamp: number;
|
|
1017
|
+
}
|
|
1015
1018
|
/**
|
|
1016
1019
|
* Type guards
|
|
1017
1020
|
*/
|
|
@@ -1038,10 +1041,11 @@ type ThemeUpdateMessage = PayloadMessage<ThemeUpdatePayload>;
|
|
|
1038
1041
|
type AuthMessage = PayloadMessage<AuthPayload>;
|
|
1039
1042
|
type ErrorMessage = PayloadMessage<ErrorPayload>;
|
|
1040
1043
|
type EventMessage = PayloadMessage<EventPayload>;
|
|
1044
|
+
type PageChangeMessage = PayloadMessage<PageChangePayload>;
|
|
1041
1045
|
/**
|
|
1042
1046
|
* Union type for all messages
|
|
1043
1047
|
*/
|
|
1044
|
-
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;
|
|
1045
1049
|
|
|
1046
1050
|
/**
|
|
1047
1051
|
* Weld SDK - Logger Utility
|
|
@@ -1535,5 +1539,5 @@ declare function isValidFileSize(file: File, maxSizeBytes: number): boolean;
|
|
|
1535
1539
|
*/
|
|
1536
1540
|
declare function formatFileSize(bytes: number): string;
|
|
1537
1541
|
|
|
1538
|
-
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 };
|
|
1539
|
-
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 };
|