@aslaluroba/help-center-react 3.2.1 → 3.2.3
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/components/ui/image-attachment.d.ts +2 -1
- package/dist/index.css +1 -1
- package/dist/index.esm.js +295 -125
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +295 -125
- package/dist/index.js.map +1 -1
- package/dist/lib/types.d.ts +1 -0
- package/dist/services.esm.js +71 -14
- package/dist/services.esm.js.map +1 -1
- package/dist/services.js +71 -14
- package/dist/services.js.map +1 -1
- package/dist/ui/chatbot-popup/chat-window-screen/footer.d.ts +1 -0
- package/dist/ui/chatbot-popup/chat-window-screen/index.d.ts +2 -1
- package/package.json +1 -1
- package/src/components/ui/agent-response/agent-response.tsx +5 -3
- package/src/components/ui/image-attachment.tsx +29 -17
- package/src/components/ui/image-preview-dialog.tsx +46 -0
- package/src/core/AblyService.ts +59 -12
- package/src/lib/custom-hooks/useTypewriter.ts +5 -3
- package/src/lib/types.ts +2 -1
- package/src/ui/chatbot-popup/chat-window-screen/footer.tsx +71 -44
- package/src/ui/chatbot-popup/chat-window-screen/index.tsx +69 -18
- package/src/ui/help-center.tsx +13 -8
- package/src/ui/help-popup.tsx +3 -1
package/dist/services.js
CHANGED
|
@@ -13638,10 +13638,19 @@ class ClientAblyService {
|
|
|
13638
13638
|
token: ablyToken,
|
|
13639
13639
|
autoConnect: true
|
|
13640
13640
|
});
|
|
13641
|
+
_this.client.connection.on('failed', stateChange => {
|
|
13642
|
+
var _a;
|
|
13643
|
+
console.error('[AblyService] Connection state: failed', {
|
|
13644
|
+
reason: (_a = stateChange.reason) === null || _a === void 0 ? void 0 : _a.message,
|
|
13645
|
+
error: stateChange.reason
|
|
13646
|
+
});
|
|
13647
|
+
});
|
|
13641
13648
|
// Wait for connection to be established
|
|
13642
13649
|
yield new Promise((resolve, reject) => {
|
|
13643
13650
|
if (!_this.client) {
|
|
13644
|
-
|
|
13651
|
+
var error = new Error('Failed to initialize Ably client');
|
|
13652
|
+
console.error('[AblyService]', error);
|
|
13653
|
+
reject(error);
|
|
13645
13654
|
return;
|
|
13646
13655
|
}
|
|
13647
13656
|
_this.client.connection.once('connected', () => {
|
|
@@ -13650,23 +13659,38 @@ class ClientAblyService {
|
|
|
13650
13659
|
resolve();
|
|
13651
13660
|
});
|
|
13652
13661
|
_this.client.connection.once('failed', stateChange => {
|
|
13653
|
-
var _a;
|
|
13654
|
-
|
|
13662
|
+
var _a, _b;
|
|
13663
|
+
var error = new Error("Ably connection failed: ".concat(((_a = stateChange.reason) === null || _a === void 0 ? void 0 : _a.message) || 'Unknown error'));
|
|
13664
|
+
console.error('[AblyService] Connection failed', {
|
|
13665
|
+
reason: (_b = stateChange.reason) === null || _b === void 0 ? void 0 : _b.message,
|
|
13666
|
+
error: stateChange.reason
|
|
13667
|
+
});
|
|
13668
|
+
reject(error);
|
|
13655
13669
|
});
|
|
13656
13670
|
_this.client.connection.once('disconnected', stateChange => {
|
|
13657
|
-
var _a;
|
|
13658
|
-
|
|
13671
|
+
var _a, _b;
|
|
13672
|
+
var error = new Error("Ably connection disconnected: ".concat(((_a = stateChange.reason) === null || _a === void 0 ? void 0 : _a.message) || 'Unknown error'));
|
|
13673
|
+
console.error('[AblyService] Connection disconnected', {
|
|
13674
|
+
reason: (_b = stateChange.reason) === null || _b === void 0 ? void 0 : _b.message
|
|
13675
|
+
});
|
|
13676
|
+
reject(error);
|
|
13659
13677
|
});
|
|
13660
13678
|
// Set a timeout for connection
|
|
13661
13679
|
setTimeout(() => {
|
|
13662
13680
|
if (!_this.isConnected) {
|
|
13663
|
-
|
|
13681
|
+
var _error = new Error('Ably connection timeout');
|
|
13682
|
+
console.error('[AblyService] Connection timeout after 10 seconds');
|
|
13683
|
+
reject(_error);
|
|
13664
13684
|
}
|
|
13665
13685
|
}, 10000);
|
|
13666
13686
|
});
|
|
13667
13687
|
// Subscribe to the session room
|
|
13668
13688
|
yield _this.joinChannel(sessionId, onMessageReceived, tenantId);
|
|
13669
13689
|
} catch (error) {
|
|
13690
|
+
console.error('[AblyService] Error in startConnection', {
|
|
13691
|
+
error,
|
|
13692
|
+
sessionId
|
|
13693
|
+
});
|
|
13670
13694
|
_this.isConnected = false;
|
|
13671
13695
|
_this.sessionId = null;
|
|
13672
13696
|
throw error;
|
|
@@ -13677,23 +13701,53 @@ class ClientAblyService {
|
|
|
13677
13701
|
var _this2 = this;
|
|
13678
13702
|
return _asyncToGenerator(function* () {
|
|
13679
13703
|
if (!_this2.client) {
|
|
13680
|
-
|
|
13704
|
+
var error = new Error('Chat client not initialized');
|
|
13705
|
+
console.error('[AblyService] joinChannel error:', error);
|
|
13706
|
+
throw error;
|
|
13681
13707
|
}
|
|
13682
13708
|
var roomName = "session:".concat(tenantId, ":").concat(sessionId);
|
|
13683
13709
|
// Set up raw channel subscription for server messages
|
|
13684
13710
|
if (_this2.client) {
|
|
13685
13711
|
_this2.channel = _this2.client.channels.get(roomName);
|
|
13712
|
+
_this2.channel.on('failed', stateChange => {
|
|
13713
|
+
var _a;
|
|
13714
|
+
console.error('[AblyService] Channel failed', {
|
|
13715
|
+
roomName,
|
|
13716
|
+
reason: (_a = stateChange.reason) === null || _a === void 0 ? void 0 : _a.message,
|
|
13717
|
+
error: stateChange.reason
|
|
13718
|
+
});
|
|
13719
|
+
});
|
|
13686
13720
|
// Subscribe to assistant/system responses
|
|
13687
13721
|
_this2.channel.subscribe('ReceiveMessage', message => {
|
|
13688
|
-
var _a, _b, _c, _d, _e, _f;
|
|
13722
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
13689
13723
|
try {
|
|
13690
|
-
|
|
13691
|
-
var
|
|
13692
|
-
var
|
|
13693
|
-
var
|
|
13694
|
-
|
|
13724
|
+
// Ensure messageContent is always a string (default to empty string if undefined)
|
|
13725
|
+
var messageContent = typeof message.data === 'string' ? message.data : (_d = (_b = (_a = message.data) === null || _a === void 0 ? void 0 : _a.content) !== null && _b !== void 0 ? _b : (_c = message.data) === null || _c === void 0 ? void 0 : _c.message) !== null && _d !== void 0 ? _d : '';
|
|
13726
|
+
var senderType = ((_e = message.data) === null || _e === void 0 ? void 0 : _e.senderType) || 3; // Assistant
|
|
13727
|
+
var needsAgent = ((_f = message.data) === null || _f === void 0 ? void 0 : _f.needsAgent) || ((_g = message.data) === null || _g === void 0 ? void 0 : _g.actionType) == 'needs_agent' || false;
|
|
13728
|
+
var attachments = ((_h = message.data) === null || _h === void 0 ? void 0 : _h.attachments) || [];
|
|
13729
|
+
// Extract downloadUrl from attachments (Ably now returns downloadUrl directly)
|
|
13730
|
+
// Attachments can be: strings (URLs), objects with downloadUrl, or objects with id
|
|
13731
|
+
var attachmentUrls = attachments.map(attachment => {
|
|
13732
|
+
if (typeof attachment === 'string') {
|
|
13733
|
+
// If it's already a string, it's a URL
|
|
13734
|
+
return attachment;
|
|
13735
|
+
} else if (attachment === null || attachment === void 0 ? void 0 : attachment.downloadUrl) {
|
|
13736
|
+
// If it's an object with downloadUrl, use that
|
|
13737
|
+
return attachment.downloadUrl;
|
|
13738
|
+
} else if (attachment === null || attachment === void 0 ? void 0 : attachment.url) {
|
|
13739
|
+
// Fallback to url property
|
|
13740
|
+
return attachment.url;
|
|
13741
|
+
}
|
|
13742
|
+
// If it's an object with id, we'll need to keep it for backward compatibility
|
|
13743
|
+
return null;
|
|
13744
|
+
}).filter(url => url !== null);
|
|
13745
|
+
onMessageReceived(messageContent, senderType, needsAgent, attachmentUrls);
|
|
13695
13746
|
} catch (error) {
|
|
13696
|
-
|
|
13747
|
+
console.error('[AblyService] Error processing message', {
|
|
13748
|
+
error,
|
|
13749
|
+
message
|
|
13750
|
+
});
|
|
13697
13751
|
}
|
|
13698
13752
|
});
|
|
13699
13753
|
yield _this2.channel.attach();
|
|
@@ -13723,6 +13777,9 @@ class ClientAblyService {
|
|
|
13723
13777
|
_this3.isConnected = false;
|
|
13724
13778
|
_this3.sessionId = null;
|
|
13725
13779
|
} catch (error) {
|
|
13780
|
+
console.error('[AblyService] Error in stopConnection', {
|
|
13781
|
+
error
|
|
13782
|
+
});
|
|
13726
13783
|
// Reset state even if there's an error
|
|
13727
13784
|
_this3.isConnected = false;
|
|
13728
13785
|
_this3.sessionId = null;
|