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