urasoft-live-support 1.1.1 → 1.1.2

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.
@@ -1 +1 @@
1
- {"version":3,"file":"ChatWidget.d.ts","sourceRoot":"","sources":["../../src/core/ChatWidget.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAgD,MAAM,UAAU,CAAC;AAEpF,OAAO,eAAe,CAAC;AAEvB,qBAAa,UAAU;IACnB,OAAO,CAAC,MAAM,CAYZ;IACF,OAAO,CAAC,KAAK,CAAkB;IAC/B,OAAO,CAAC,SAAS,CAA4B;IAC7C,OAAO,CAAC,aAAa,CAA8B;IACnD,OAAO,CAAC,WAAW,CAAa;IAChC,OAAO,CAAC,iBAAiB,CAAkB;IAC3C,OAAO,CAAC,WAAW,CAAa;IAChC,OAAO,CAAC,cAAc,CAA+B;gBAEzC,MAAM,GAAE,UAAe;IAiDnC,OAAO,CAAC,IAAI;IAUZ,OAAO,CAAC,eAAe;IAyBvB,OAAO,CAAC,YAAY;IAepB,OAAO,CAAC,WAAW;IASnB,OAAO,CAAC,iBAAiB;IAczB,OAAO,CAAC,YAAY;IAgCpB,OAAO,CAAC,mBAAmB;IAoB3B,OAAO,CAAC,iBAAiB;IAqBzB,OAAO,CAAC,YAAY;IAIpB,OAAO,CAAC,MAAM;IAed,OAAO,CAAC,gBAAgB;IAoGxB,OAAO,CAAC,aAAa;IA4BrB,OAAO,CAAC,oBAAoB;YAoCd,cAAc;YA0Ed,iBAAiB;YAgCjB,WAAW;YAyEX,kBAAkB;IAuEhC,OAAO,CAAC,UAAU;IAgBlB,OAAO,CAAC,cAAc;IAStB,OAAO,CAAC,MAAM;IAKP,IAAI,IAAI,IAAI;IAKZ,KAAK,IAAI,IAAI;IAKP,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAW9B,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,MAAM,EAAE,MA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AAI;IAKP,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAW9B,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI;IAYvF,OAAO,CAAC,UAAU;IAMlB,OAAO,CAAC,UAAU;YAIJ,gBAAgB;IA2D9B,OAAO,CAAC,UAAU;IAKlB,OAAO,CAAC,iBAAiB;IAgCzB,OAAO,CAAC,cAAc;YAQR,eAAe;YAwCf,iBAAiB;IAqB/B,OAAO,CAAC,kBAAkB,CAWzB;CACJ"}
package/dist/index.d.ts CHANGED
@@ -172,6 +172,7 @@ declare class SignalRClient {
172
172
  disconnect(): Promise<void>;
173
173
  isConnected(): boolean;
174
174
  getConnectionState(): signalR.HubConnectionState | null;
175
+ private setupNetworkMonitoring;
175
176
  }
176
177
 
177
178
  export { ChatWidget, SignalRClient };
package/dist/index.esm.js CHANGED
@@ -3357,9 +3357,11 @@ class SignalRClient {
3357
3357
  this.config = config;
3358
3358
  console.log('SignalRClient constructor - hubUrl:', config.hubUrl);
3359
3359
  console.log('SignalRClient constructor - full config:', config);
3360
+ // Network status monitoring for auto-reconnect
3361
+ this.setupNetworkMonitoring();
3360
3362
  // Yeniden bağlanma ayarlarını varsayılanlarla birleştir
3361
3363
  this.reconnectOptions = {
3362
- maxRetries: config.reconnect?.maxRetries ?? 5,
3364
+ maxRetries: config.reconnect?.maxRetries ?? 999999, // Sınırsız yeniden deneme
3363
3365
  delayStrategy: config.reconnect?.delayStrategy ?? 'exponential',
3364
3366
  initialDelay: config.reconnect?.initialDelay ?? 1000,
3365
3367
  maxDelay: config.reconnect?.maxDelay ?? 30000,
@@ -3597,6 +3599,34 @@ class SignalRClient {
3597
3599
  getConnectionState() {
3598
3600
  return this.connection?.state || null;
3599
3601
  }
3602
+ setupNetworkMonitoring() {
3603
+ // Online/offline event listeners for auto-reconnect
3604
+ if (typeof window !== 'undefined') {
3605
+ window.addEventListener('online', async () => {
3606
+ console.log('Network connection restored, attempting to reconnect...');
3607
+ if (this.connection?.state !== HubConnectionState.Connected) {
3608
+ try {
3609
+ await this.connect();
3610
+ }
3611
+ catch (error) {
3612
+ console.error('Failed to reconnect after network restoration:', error);
3613
+ }
3614
+ }
3615
+ });
3616
+ // Visibility change - reconnect when tab becomes visible
3617
+ document.addEventListener('visibilitychange', async () => {
3618
+ if (!document.hidden && this.connection?.state !== HubConnectionState.Connected && !this.isManualDisconnect) {
3619
+ console.log('Tab became visible, checking connection...');
3620
+ try {
3621
+ await this.connect();
3622
+ }
3623
+ catch (error) {
3624
+ console.error('Failed to reconnect on tab visibility:', error);
3625
+ }
3626
+ }
3627
+ });
3628
+ }
3629
+ }
3600
3630
  }
3601
3631
 
3602
3632
  class ChatWidget {
@@ -3901,6 +3931,7 @@ class ChatWidget {
3901
3931
  : this.mergeClasses('chat-message chat-message-agent', this.config.customClasses?.messageAgent);
3902
3932
  return `
3903
3933
  <div class="${messageClass}">
3934
+ ${isUser ? '<div class="chat-message-avatar-emoji">👤</div>' : ''}
3904
3935
  ${!isUser && message.avatar ? `<img src="${message.avatar}" alt="Agent" class="${this.mergeClasses('chat-message-avatar', this.config.customClasses?.messageAvatar)}" />` : ''}
3905
3936
  <div class="chat-message-content">
3906
3937
  ${message.message ? `<div class="${this.mergeClasses('chat-message-text', this.config.customClasses?.messageText)}">${this.escapeHtml(message.message)}</div>` : ''}