@ada-support/embed2 1.5.4 → 1.6.5
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.
|
@@ -31,6 +31,9 @@ export interface EmbedRequestPayloadByEvent {
|
|
|
31
31
|
TRIGGER_ANSWER: {
|
|
32
32
|
answerId: string;
|
|
33
33
|
};
|
|
34
|
+
SET_LANGUAGE: {
|
|
35
|
+
language: string;
|
|
36
|
+
};
|
|
34
37
|
}
|
|
35
38
|
export declare type EmbedRequestEvent = keyof EmbedRequestPayloadByEvent;
|
|
36
39
|
export interface EmbedResponsePayloadByEvent {
|
|
@@ -7,6 +7,7 @@ export interface StoreState extends StartOptionsNoFunction {
|
|
|
7
7
|
chatterToken?: string | null;
|
|
8
8
|
sessionToken?: string | null;
|
|
9
9
|
client?: Client;
|
|
10
|
+
enabledLanguages: string[];
|
|
10
11
|
isDrawerOpen: boolean;
|
|
11
12
|
zdSessionId?: string | null;
|
|
12
13
|
zdPreviousTags?: string | null;
|
package/dist/npm-entry/index.js
CHANGED
|
@@ -15806,7 +15806,7 @@ const client = new error_tracker_BrowserClient({
|
|
|
15806
15806
|
},
|
|
15807
15807
|
|
|
15808
15808
|
environment: "production",
|
|
15809
|
-
release: "1.5
|
|
15809
|
+
release: "1.6.5-7ad1229",
|
|
15810
15810
|
sampleRate: 0.25,
|
|
15811
15811
|
autoSessionTracking: false,
|
|
15812
15812
|
// Integrations don't seem to work with Sentry: https://github.com/getsentry/sentry-javascript/issues/2541
|
|
@@ -16436,7 +16436,7 @@ function getEmbedURL(_ref) {
|
|
|
16436
16436
|
host = "http://".concat(window.location.hostname, ":9001");
|
|
16437
16437
|
}
|
|
16438
16438
|
|
|
16439
|
-
return "".concat(host, "/embed/").concat(frameName, "/").concat("
|
|
16439
|
+
return "".concat(host, "/embed/").concat(frameName, "/").concat("7ad1229", "/index.html");
|
|
16440
16440
|
}
|
|
16441
16441
|
|
|
16442
16442
|
function constructQueryString(query) {
|
|
@@ -17088,6 +17088,7 @@ const getInitialState = adaSettings => ({
|
|
|
17088
17088
|
parentElement: undefined,
|
|
17089
17089
|
isDrawerOpen: false,
|
|
17090
17090
|
drawerHasBeenOpened: false,
|
|
17091
|
+
enabledLanguages: ["en"],
|
|
17091
17092
|
client: undefined,
|
|
17092
17093
|
isIntroShown: false,
|
|
17093
17094
|
wasIntroShown: false,
|
|
@@ -18005,7 +18006,7 @@ function _objectWithoutProperties(source, excluded) {
|
|
|
18005
18006
|
;// CONCATENATED MODULE: ./src/common/models/client/index.ts
|
|
18006
18007
|
|
|
18007
18008
|
|
|
18008
|
-
const _excluded = ["chat", "chat_button", "features", "handle", "language", "persistence", "privacy", "rollout", "tint"];
|
|
18009
|
+
const _excluded = ["chat", "chat_button", "features", "handle", "language", "persistence", "privacy", "rollout", "tint", "translated_languages"];
|
|
18009
18010
|
|
|
18010
18011
|
class Client {
|
|
18011
18012
|
constructor(clientResponse) {
|
|
@@ -18037,6 +18038,8 @@ class Client {
|
|
|
18037
18038
|
|
|
18038
18039
|
_defineProperty(this, "ui_settings", void 0);
|
|
18039
18040
|
|
|
18041
|
+
_defineProperty(this, "translated_languages", void 0);
|
|
18042
|
+
|
|
18040
18043
|
const {
|
|
18041
18044
|
chat,
|
|
18042
18045
|
chat_button: chatButton,
|
|
@@ -18046,7 +18049,9 @@ class Client {
|
|
|
18046
18049
|
persistence,
|
|
18047
18050
|
privacy,
|
|
18048
18051
|
rollout,
|
|
18049
|
-
tint
|
|
18052
|
+
tint,
|
|
18053
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
18054
|
+
translated_languages
|
|
18050
18055
|
} = clientResponse,
|
|
18051
18056
|
rest = _objectWithoutProperties(clientResponse, _excluded);
|
|
18052
18057
|
|
|
@@ -18059,6 +18064,7 @@ class Client {
|
|
|
18059
18064
|
this.privacy = privacy;
|
|
18060
18065
|
this.rollout = rollout;
|
|
18061
18066
|
this.tint = tint;
|
|
18067
|
+
this.translated_languages = translated_languages;
|
|
18062
18068
|
/**
|
|
18063
18069
|
* Even if some properties are not used by Embed2, they may be used by Chat.
|
|
18064
18070
|
* Chat can "pull" the client object from Embed2 in order to reduce an API
|
|
@@ -18186,9 +18192,9 @@ async function log(message, extra, options) {
|
|
|
18186
18192
|
service: "embed",
|
|
18187
18193
|
env: "production",
|
|
18188
18194
|
embedVersion: 2,
|
|
18189
|
-
version: "1.5
|
|
18195
|
+
version: "1.6.5",
|
|
18190
18196
|
isNpm: true,
|
|
18191
|
-
commitHash: "
|
|
18197
|
+
commitHash: "7ad1229"
|
|
18192
18198
|
}))
|
|
18193
18199
|
});
|
|
18194
18200
|
}
|
|
@@ -18758,7 +18764,7 @@ class ChatFrame extends d {
|
|
|
18758
18764
|
const hostPageUrlParams = new (url_default())(window.location.href).searchParams;
|
|
18759
18765
|
const smsToken = hostPageUrlParams.get("adaSMSToken");
|
|
18760
18766
|
const queryParams = {
|
|
18761
|
-
embedVersion: "
|
|
18767
|
+
embedVersion: "7ad1229".slice(0, 7),
|
|
18762
18768
|
greeting,
|
|
18763
18769
|
language,
|
|
18764
18770
|
skipGreeting,
|
|
@@ -20500,6 +20506,7 @@ class Container extends d {
|
|
|
20500
20506
|
try {
|
|
20501
20507
|
await setState(Container_objectSpread(Container_objectSpread({
|
|
20502
20508
|
client: newClient,
|
|
20509
|
+
enabledLanguages: newClient.features.translations ? ["en"].concat(newClient.translated_languages) : ["en"],
|
|
20503
20510
|
initialURL: window.location.href,
|
|
20504
20511
|
isIntroShown: false
|
|
20505
20512
|
}, adaSettingsWithoutFunctions), {}, {
|
|
@@ -20973,7 +20980,7 @@ class Embed {
|
|
|
20973
20980
|
|
|
20974
20981
|
}
|
|
20975
20982
|
|
|
20976
|
-
_defineProperty(Embed, "embed2Version", "
|
|
20983
|
+
_defineProperty(Embed, "embed2Version", "7ad1229");
|
|
20977
20984
|
;// CONCATENATED MODULE: ./src/common/helpers/startup.ts
|
|
20978
20985
|
|
|
20979
20986
|
|
|
@@ -21132,26 +21139,35 @@ function createEmbedObject() {
|
|
|
21132
21139
|
await waitForEmbedInit();
|
|
21133
21140
|
return (_embed13 = embed) === null || _embed13 === void 0 ? void 0 : _embed13.setDeviceToken(token);
|
|
21134
21141
|
},
|
|
21135
|
-
|
|
21142
|
+
setLanguage: async language => {
|
|
21136
21143
|
var _embed14;
|
|
21137
21144
|
|
|
21138
21145
|
await waitForEmbedInit();
|
|
21139
|
-
const
|
|
21146
|
+
const channel = (_embed14 = embed) === null || _embed14 === void 0 ? void 0 : _embed14.messageService.getChannel("chat");
|
|
21147
|
+
channel === null || channel === void 0 ? void 0 : channel.postMessage("SET_LANGUAGE", {
|
|
21148
|
+
language
|
|
21149
|
+
});
|
|
21150
|
+
},
|
|
21151
|
+
handleNotification: async () => {
|
|
21152
|
+
var _embed15;
|
|
21153
|
+
|
|
21154
|
+
await waitForEmbedInit();
|
|
21155
|
+
const windowInfo = await ((_embed15 = embed) === null || _embed15 === void 0 ? void 0 : _embed15.getInfo());
|
|
21140
21156
|
|
|
21141
21157
|
if (!windowInfo) {
|
|
21142
21158
|
return;
|
|
21143
21159
|
}
|
|
21144
21160
|
|
|
21145
21161
|
if (!windowInfo.isChatOpen) {
|
|
21146
|
-
var
|
|
21162
|
+
var _embed16;
|
|
21147
21163
|
|
|
21148
|
-
(
|
|
21164
|
+
(_embed16 = embed) === null || _embed16 === void 0 ? void 0 : _embed16.toggle();
|
|
21149
21165
|
}
|
|
21150
21166
|
},
|
|
21151
21167
|
triggerAnswer: answerId => {
|
|
21152
|
-
var
|
|
21168
|
+
var _embed17;
|
|
21153
21169
|
|
|
21154
|
-
const channel = (
|
|
21170
|
+
const channel = (_embed17 = embed) === null || _embed17 === void 0 ? void 0 : _embed17.messageService.getChannel("chat");
|
|
21155
21171
|
channel === null || channel === void 0 ? void 0 : channel.postMessage("TRIGGER_ANSWER", {
|
|
21156
21172
|
answerId
|
|
21157
21173
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ada-support/embed2",
|
|
3
|
-
"version": "1.5
|
|
3
|
+
"version": "1.6.5",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/npm-entry",
|
|
6
6
|
"typings": "dist/npm-entry/index-npm.d.ts",
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
"webpack-dev-server": "^4.3.1"
|
|
84
84
|
},
|
|
85
85
|
"dependencies": {
|
|
86
|
-
"@ada-support/embed-types": "^1.
|
|
86
|
+
"@ada-support/embed-types": "^1.6.4",
|
|
87
87
|
"@babel/core": "^7.16.12",
|
|
88
88
|
"@babel/plugin-proposal-class-properties": "^7.16.7",
|
|
89
89
|
"@babel/plugin-proposal-numeric-separator": "^7.16.7",
|