@ada-support/embed2 1.4.11 → 1.4.14
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/npm-entry/index.js
CHANGED
|
@@ -15811,7 +15811,7 @@ const client = new error_tracker_BrowserClient({
|
|
|
15811
15811
|
},
|
|
15812
15812
|
|
|
15813
15813
|
environment: "production",
|
|
15814
|
-
release: "1.4.
|
|
15814
|
+
release: "1.4.14-295d3c0",
|
|
15815
15815
|
sampleRate: 0.25,
|
|
15816
15816
|
autoSessionTracking: false,
|
|
15817
15817
|
// Integrations don't seem to work with Sentry: https://github.com/getsentry/sentry-javascript/issues/2541
|
|
@@ -16335,7 +16335,12 @@ let ActionTypes;
|
|
|
16335
16335
|
ActionTypes["SET_CONNECTION_STATE_TYPE"] = "SET_CONNECTION_STATE";
|
|
16336
16336
|
ActionTypes["INCREMENT_MESSAGE_COUNT_TYPE"] = "INCREMENT_MESSAGE_COUNT";
|
|
16337
16337
|
})(ActionTypes || (ActionTypes = {}));
|
|
16338
|
+
// EXTERNAL MODULE: ./node_modules/@babel/runtime-corejs3/core-js-stable/url.js
|
|
16339
|
+
var url = __webpack_require__(9969);
|
|
16340
|
+
var url_default = /*#__PURE__*/__webpack_require__.n(url);
|
|
16338
16341
|
;// CONCATENATED MODULE: ./src/common/helpers/http.ts
|
|
16342
|
+
|
|
16343
|
+
|
|
16339
16344
|
/**
|
|
16340
16345
|
* Vanilla HTTP request. Returns a Promise.
|
|
16341
16346
|
*/
|
|
@@ -16345,11 +16350,15 @@ function httpRequest(obj) {
|
|
|
16345
16350
|
const {
|
|
16346
16351
|
headers
|
|
16347
16352
|
} = obj;
|
|
16348
|
-
const xhr = new XMLHttpRequest();
|
|
16353
|
+
const xhr = new XMLHttpRequest(); // include the ada_request_origin query parameter since adding a header causes CORS issues.
|
|
16354
|
+
// this parameter would be used to tag the request's trace in Datadog.
|
|
16355
|
+
|
|
16356
|
+
const requestURL = new (url_default())(obj.url);
|
|
16357
|
+
requestURL.searchParams.set("ada_request_origin", "embed");
|
|
16349
16358
|
|
|
16350
16359
|
if ("withCredentials" in xhr) {
|
|
16351
16360
|
// XMLHttpRequest for Chrome/Firefox/Opera/Safari.
|
|
16352
|
-
xhr.open(method,
|
|
16361
|
+
xhr.open(method, requestURL, true);
|
|
16353
16362
|
} else {
|
|
16354
16363
|
return;
|
|
16355
16364
|
}
|
|
@@ -16432,7 +16441,7 @@ function getEmbedURL(_ref) {
|
|
|
16432
16441
|
host = "http://".concat(window.location.hostname, ":9001");
|
|
16433
16442
|
}
|
|
16434
16443
|
|
|
16435
|
-
return "".concat(host, "/embed/").concat(frameName, "/").concat("
|
|
16444
|
+
return "".concat(host, "/embed/").concat(frameName, "/").concat("295d3c0", "/index.html");
|
|
16436
16445
|
}
|
|
16437
16446
|
|
|
16438
16447
|
function constructQueryString(query) {
|
|
@@ -18143,12 +18152,71 @@ const persistence = {
|
|
|
18143
18152
|
}
|
|
18144
18153
|
}
|
|
18145
18154
|
};
|
|
18155
|
+
// EXTERNAL MODULE: ./node_modules/lodash.memoize/index.js
|
|
18156
|
+
var lodash_memoize = __webpack_require__(773);
|
|
18157
|
+
var lodash_memoize_default = /*#__PURE__*/__webpack_require__.n(lodash_memoize);
|
|
18158
|
+
;// CONCATENATED MODULE: ./src/services/logger/index.ts
|
|
18159
|
+
|
|
18160
|
+
|
|
18161
|
+
function logger_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
18162
|
+
|
|
18163
|
+
function logger_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? logger_ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : logger_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
18164
|
+
|
|
18165
|
+
|
|
18166
|
+
|
|
18167
|
+
const DEFAULT_LOG_SAMPLE_RATE = 0.01; // 1% of logs will go through
|
|
18168
|
+
|
|
18169
|
+
const DD_BASE_URL = "https://browser-http-intake.logs.datadoghq.com/v1/input/";
|
|
18170
|
+
const DD_TOKEN = "pubfe23baedd2ea322bebb5ed2020fa2fa1"; // We need memoization to ensure consistency of logs
|
|
18171
|
+
|
|
18172
|
+
const shouldLog = lodash_memoize_default()(sampleRate => {
|
|
18173
|
+
if (!DD_TOKEN || sampleRate === 0) {
|
|
18174
|
+
return false;
|
|
18175
|
+
}
|
|
18176
|
+
|
|
18177
|
+
return Math.random() < (sampleRate || DEFAULT_LOG_SAMPLE_RATE);
|
|
18178
|
+
});
|
|
18179
|
+
/**
|
|
18180
|
+
* Sends log to Datadog
|
|
18181
|
+
*/
|
|
18182
|
+
|
|
18183
|
+
async function log(message, extra, options) {
|
|
18184
|
+
if (!shouldLog(options === null || options === void 0 ? void 0 : options.sampleRate)) {
|
|
18185
|
+
return;
|
|
18186
|
+
}
|
|
18187
|
+
|
|
18188
|
+
await httpRequest({
|
|
18189
|
+
url: "".concat(DD_BASE_URL).concat(DD_TOKEN, "?ddsource=browser&ddtags=version:1.5.0,env:").concat("production"),
|
|
18190
|
+
method: "POST",
|
|
18191
|
+
body: JSON.stringify(logger_objectSpread(logger_objectSpread({
|
|
18192
|
+
message
|
|
18193
|
+
}, extra), {}, {
|
|
18194
|
+
sampleRate: (options === null || options === void 0 ? void 0 : options.sampleRate) || DEFAULT_LOG_SAMPLE_RATE,
|
|
18195
|
+
service: "embed",
|
|
18196
|
+
env: "production",
|
|
18197
|
+
embedVersion: 2,
|
|
18198
|
+
version: "1.4.14",
|
|
18199
|
+
isNpm: true,
|
|
18200
|
+
commitHash: "295d3c0"
|
|
18201
|
+
}))
|
|
18202
|
+
});
|
|
18203
|
+
}
|
|
18146
18204
|
;// CONCATENATED MODULE: ./src/services/chat-versioning/manifest.ts
|
|
18147
18205
|
|
|
18206
|
+
|
|
18148
18207
|
const CHAT_MANIFEST_PATH = "https://static.ada.support/chat-manifest.json";
|
|
18149
18208
|
const loadChatManifest = async () => {
|
|
18150
|
-
|
|
18151
|
-
|
|
18209
|
+
try {
|
|
18210
|
+
const r = await fetch(CHAT_MANIFEST_PATH);
|
|
18211
|
+
return r.json();
|
|
18212
|
+
} catch (e) {
|
|
18213
|
+
// handling cases where r is undefined / other fetch errors
|
|
18214
|
+
// by returning undefined, we tell the server to load the unversioned index.html file for chat
|
|
18215
|
+
log("Failed to load chat manifest", {
|
|
18216
|
+
hostPage: window.location.href
|
|
18217
|
+
});
|
|
18218
|
+
return undefined;
|
|
18219
|
+
}
|
|
18152
18220
|
}; // Use one message for different errors to reduce the bundle size
|
|
18153
18221
|
|
|
18154
18222
|
const MANIFEST_VALIDATION_ERROR_MESSAGE = "The format of manifest file is incorrect";
|
|
@@ -18262,60 +18330,13 @@ const getChatVersion = async adaSettings => {
|
|
|
18262
18330
|
}
|
|
18263
18331
|
|
|
18264
18332
|
const manifest = await loadChatManifest();
|
|
18265
|
-
return getChatVersionFromManifest(manifest);
|
|
18266
|
-
};
|
|
18267
|
-
// EXTERNAL MODULE: ./node_modules/lodash.memoize/index.js
|
|
18268
|
-
var lodash_memoize = __webpack_require__(773);
|
|
18269
|
-
var lodash_memoize_default = /*#__PURE__*/__webpack_require__.n(lodash_memoize);
|
|
18270
|
-
;// CONCATENATED MODULE: ./src/services/logger/index.ts
|
|
18271
|
-
|
|
18272
|
-
|
|
18273
|
-
function logger_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
18274
|
-
|
|
18275
|
-
function logger_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? logger_ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : logger_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
18276
18333
|
|
|
18277
|
-
|
|
18278
|
-
|
|
18279
|
-
const DEFAULT_LOG_SAMPLE_RATE = 0.01; // 1% of logs will go through
|
|
18280
|
-
|
|
18281
|
-
const DD_BASE_URL = "https://browser-http-intake.logs.datadoghq.com/v1/input/";
|
|
18282
|
-
const DD_TOKEN = "pubfe23baedd2ea322bebb5ed2020fa2fa1"; // We need memoization to ensure consistency of logs
|
|
18283
|
-
|
|
18284
|
-
const shouldLog = lodash_memoize_default()(sampleRate => {
|
|
18285
|
-
if (!DD_TOKEN || sampleRate === 0) {
|
|
18286
|
-
return false;
|
|
18287
|
-
}
|
|
18288
|
-
|
|
18289
|
-
return Math.random() < (sampleRate || DEFAULT_LOG_SAMPLE_RATE);
|
|
18290
|
-
});
|
|
18291
|
-
/**
|
|
18292
|
-
* Sends log to Datadog
|
|
18293
|
-
*/
|
|
18294
|
-
|
|
18295
|
-
async function log(message, extra, options) {
|
|
18296
|
-
if (!shouldLog(options === null || options === void 0 ? void 0 : options.sampleRate)) {
|
|
18297
|
-
return;
|
|
18334
|
+
if (!manifest) {
|
|
18335
|
+
return undefined;
|
|
18298
18336
|
}
|
|
18299
18337
|
|
|
18300
|
-
|
|
18301
|
-
|
|
18302
|
-
method: "POST",
|
|
18303
|
-
body: JSON.stringify(logger_objectSpread(logger_objectSpread({
|
|
18304
|
-
message
|
|
18305
|
-
}, extra), {}, {
|
|
18306
|
-
sampleRate: (options === null || options === void 0 ? void 0 : options.sampleRate) || DEFAULT_LOG_SAMPLE_RATE,
|
|
18307
|
-
service: "embed",
|
|
18308
|
-
env: "production",
|
|
18309
|
-
embedVersion: 2,
|
|
18310
|
-
version: "1.4.11",
|
|
18311
|
-
isNpm: true,
|
|
18312
|
-
commitHash: "b2dd6e8"
|
|
18313
|
-
}))
|
|
18314
|
-
});
|
|
18315
|
-
}
|
|
18316
|
-
// EXTERNAL MODULE: ./node_modules/@babel/runtime-corejs3/core-js-stable/url.js
|
|
18317
|
-
var url = __webpack_require__(9969);
|
|
18318
|
-
var url_default = /*#__PURE__*/__webpack_require__.n(url);
|
|
18338
|
+
return getChatVersionFromManifest(manifest);
|
|
18339
|
+
};
|
|
18319
18340
|
;// CONCATENATED MODULE: ./src/client/components/IFrame/index.tsx
|
|
18320
18341
|
|
|
18321
18342
|
|
|
@@ -18751,7 +18772,7 @@ class ChatFrame extends d {
|
|
|
18751
18772
|
const hostPageUrlParams = new (url_default())(window.location.href).searchParams;
|
|
18752
18773
|
const smsToken = hostPageUrlParams.get("adaSMSToken");
|
|
18753
18774
|
const queryParams = {
|
|
18754
|
-
embedVersion: "
|
|
18775
|
+
embedVersion: "295d3c0".slice(0, 7),
|
|
18755
18776
|
greeting,
|
|
18756
18777
|
language,
|
|
18757
18778
|
skipGreeting,
|
|
@@ -20926,7 +20947,7 @@ class Embed {
|
|
|
20926
20947
|
|
|
20927
20948
|
}
|
|
20928
20949
|
|
|
20929
|
-
_defineProperty(Embed, "embed2Version", "
|
|
20950
|
+
_defineProperty(Embed, "embed2Version", "295d3c0");
|
|
20930
20951
|
;// CONCATENATED MODULE: ./src/common/helpers/startup.ts
|
|
20931
20952
|
|
|
20932
20953
|
|
|
@@ -5,6 +5,6 @@ export interface Manifest {
|
|
|
5
5
|
weight: number;
|
|
6
6
|
}[];
|
|
7
7
|
}
|
|
8
|
-
export declare const loadChatManifest: () => Promise<Manifest>;
|
|
8
|
+
export declare const loadChatManifest: () => Promise<Manifest | undefined>;
|
|
9
9
|
export declare const MANIFEST_VALIDATION_ERROR_MESSAGE = "The format of manifest file is incorrect";
|
|
10
10
|
export declare const isManifest: (input: unknown) => input is Manifest;
|