@xapp/chat-widget 1.37.2 → 1.38.0
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/App.d.ts +6 -0
- package/dist/index.css +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.es.js +16 -5
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +16 -5
- package/dist/index.js.map +1 -1
- package/dist/store/ChatAction.d.ts +4 -0
- package/dist/tests/App.test.d.ts +1 -0
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -1941,6 +1941,7 @@ function writeMessage(msg, user) {
|
|
|
1941
1941
|
function executeAction(text, token) {
|
|
1942
1942
|
return function (chatServer) { return function (dispatch, getState) {
|
|
1943
1943
|
var attributes = getState().attributes;
|
|
1944
|
+
attributes = __assign(__assign({}, attributes), { currentUrl: window.location.href });
|
|
1944
1945
|
chatServer.sendChatMsg({ text: text, token: token, attributes: attributes }, function (err) {
|
|
1945
1946
|
if (err) {
|
|
1946
1947
|
log("Error sending message", err);
|
|
@@ -1997,6 +1998,7 @@ function sendFile(file) {
|
|
|
1997
1998
|
user: {
|
|
1998
1999
|
nick: "",
|
|
1999
2000
|
},
|
|
2001
|
+
attributes: { currentUrl: window.location.href },
|
|
2000
2002
|
timestamp: +Date()
|
|
2001
2003
|
}
|
|
2002
2004
|
});
|
|
@@ -3131,14 +3133,14 @@ var StentorDirectChat = /** @class */ (function () {
|
|
|
3131
3133
|
};
|
|
3132
3134
|
StentorDirectChat.prototype.setVisitorInfo = function (visitorInfo, cb) {
|
|
3133
3135
|
this.visitorInfo = visitorInfo;
|
|
3134
|
-
this._attributes = this.visitorInfo.attributes;
|
|
3136
|
+
this._attributes = __assign(__assign({}, this.visitorInfo.attributes), { currentUrl: window.location.href });
|
|
3135
3137
|
this._accessToken = this.visitorInfo.accessToken;
|
|
3136
|
-
this.startSession();
|
|
3137
3138
|
// This is for the bot
|
|
3138
3139
|
this.userJoined({
|
|
3139
3140
|
user: this.getBot(undefined),
|
|
3140
3141
|
token: ""
|
|
3141
3142
|
});
|
|
3143
|
+
this.startSession();
|
|
3142
3144
|
cb();
|
|
3143
3145
|
};
|
|
3144
3146
|
StentorDirectChat.prototype.sendChatRating = function () {
|
|
@@ -3300,7 +3302,13 @@ var StentorDirectChat = /** @class */ (function () {
|
|
|
3300
3302
|
else {
|
|
3301
3303
|
this._userId = "stentor-widget-user-".concat(uuid_1());
|
|
3302
3304
|
}
|
|
3303
|
-
|
|
3305
|
+
if (get("sessionId") !== "") {
|
|
3306
|
+
this._sessionId = get("sessionId");
|
|
3307
|
+
}
|
|
3308
|
+
else {
|
|
3309
|
+
this._sessionId = "stentor-widget-session-".concat(uuid_1());
|
|
3310
|
+
set("sessionId", this._sessionId);
|
|
3311
|
+
}
|
|
3304
3312
|
// This is a flag that is cleared after the first message is sent
|
|
3305
3313
|
this.isNewSession = true;
|
|
3306
3314
|
};
|
|
@@ -7554,7 +7562,7 @@ function useGreeting(active) {
|
|
|
7554
7562
|
visitorId: curr.visitorId,
|
|
7555
7563
|
userId: curr.userId,
|
|
7556
7564
|
accessToken: curr.accessToken,
|
|
7557
|
-
attributes: curr.attributes
|
|
7565
|
+
attributes: __assign(__assign({}, curr.attributes), { currentUrl: window.location.href })
|
|
7558
7566
|
}));
|
|
7559
7567
|
var timeoutId_1 = setTimeout(function () {
|
|
7560
7568
|
var greetingAction = sendGreeting();
|
|
@@ -8707,6 +8715,9 @@ function joinMessages(messages, msg) {
|
|
|
8707
8715
|
|
|
8708
8716
|
function memberJoin(state, detail) {
|
|
8709
8717
|
var _a;
|
|
8718
|
+
if (state.chats.length === 0) {
|
|
8719
|
+
set("sessionId", "");
|
|
8720
|
+
}
|
|
8710
8721
|
if (isAgent(detail.user.nick)) {
|
|
8711
8722
|
var prevAgentInfo = state.agents[detail.user.nick];
|
|
8712
8723
|
return __assign(__assign({}, state), { isChatting: true, chats: (prevAgentInfo === null || prevAgentInfo === void 0 ? void 0 : prevAgentInfo.joined) ? state.chats : joinMessages(state.chats, detail), agents: (_a = {},
|
|
@@ -8733,7 +8744,7 @@ function memberLeave(state, detail) {
|
|
|
8733
8744
|
|
|
8734
8745
|
function resetReducer(state) {
|
|
8735
8746
|
if (state === void 0) { state = DEFAULT_STATE; }
|
|
8736
|
-
return __assign(__assign({}, createDefaultState()), { connection: __assign(__assign({}, state.connection), { nonce: uuid_1() }), visitor: state.visitor, visitorId: state.visitorId });
|
|
8747
|
+
return __assign(__assign({}, createDefaultState()), { connection: __assign(__assign({}, state.connection), { greetingRequested: false, nonce: uuid_1() }), visitor: state.visitor, visitorId: state.visitorId });
|
|
8737
8748
|
}
|
|
8738
8749
|
|
|
8739
8750
|
// todo: create reducer (requires redux-thunk dependncy)
|