@ada-support/embed2 1.1.29 → 1.1.32
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.
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { MessageService } from "client/lib/message-service";
|
|
1
2
|
import type { StoreProxy } from "client/lib/store-proxy";
|
|
2
3
|
export declare const StoreContext: import("preact").Context<StoreProxy>;
|
|
3
|
-
export declare const MessageServiceContext: import("preact").Context<
|
|
4
|
+
export declare const MessageServiceContext: import("preact").Context<MessageService>;
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import type { ActionCreators } from "common/constants/actions";
|
|
2
|
+
import type { StoreAction } from "common/types";
|
|
2
3
|
import type { MessagePayload } from "common/types/events";
|
|
3
|
-
import type { StoreAction } from "common/types/index";
|
|
4
4
|
import type { DirectDispatch } from "common/types/store";
|
|
5
5
|
import type { StoreState } from "common/types/store-state";
|
|
6
|
-
declare const actions: {
|
|
6
|
+
export declare const actions: {
|
|
7
7
|
[key in ActionCreators]: ({ currentState, payload, dispatch }: {
|
|
8
8
|
payload?: MessagePayload;
|
|
9
9
|
currentState: StoreState;
|
|
10
10
|
dispatch: DirectDispatch;
|
|
11
11
|
}) => StoreAction;
|
|
12
12
|
};
|
|
13
|
-
export default actions;
|
package/dist/npm-entry/index.js
CHANGED
|
@@ -8798,7 +8798,7 @@ var client = new error_tracker_BrowserClient({
|
|
|
8798
8798
|
return event;
|
|
8799
8799
|
},
|
|
8800
8800
|
environment: "production",
|
|
8801
|
-
release: "1.1.
|
|
8801
|
+
release: "1.1.32-e9fb831",
|
|
8802
8802
|
sampleRate: 0.25,
|
|
8803
8803
|
autoSessionTracking: false,
|
|
8804
8804
|
// Integrations don't seem to work with Sentry: https://github.com/getsentry/sentry-javascript/issues/2541
|
|
@@ -9490,17 +9490,17 @@ function getEmbedURL(_ref) {
|
|
|
9490
9490
|
var host;
|
|
9491
9491
|
var polyfillVersionString;
|
|
9492
9492
|
|
|
9493
|
-
if (config_info/* isProduction */.
|
|
9493
|
+
if (config_info/* isProduction */.y) {
|
|
9494
9494
|
var _context3, _context4;
|
|
9495
9495
|
|
|
9496
9496
|
host = concat_default()(_context3 = concat_default()(_context4 = "https://".concat(handle)).call(_context4, clusterString, ".")).call(_context3, domainString, ".support");
|
|
9497
|
-
polyfillVersionString = config_info/* isModern */.
|
|
9497
|
+
polyfillVersionString = config_info/* isModern */.p ? "modern" : "legacy";
|
|
9498
9498
|
} else {
|
|
9499
9499
|
host = "http://".concat(window.location.hostname, ":9001");
|
|
9500
9500
|
polyfillVersionString = "legacy";
|
|
9501
9501
|
}
|
|
9502
9502
|
|
|
9503
|
-
return concat_default()(_context5 = concat_default()(_context6 = concat_default()(_context7 = "".concat(host, "/embed/")).call(_context7, polyfillVersionString, "/")).call(_context6, frameName, "/")).call(_context5, "
|
|
9503
|
+
return concat_default()(_context5 = concat_default()(_context6 = concat_default()(_context7 = "".concat(host, "/embed/")).call(_context7, polyfillVersionString, "/")).call(_context6, frameName, "/")).call(_context5, "e9fb831", "/index.html");
|
|
9504
9504
|
}
|
|
9505
9505
|
/**
|
|
9506
9506
|
* Generate the Chat / API URL
|
|
@@ -9538,7 +9538,7 @@ function getURL(_ref2) {
|
|
|
9538
9538
|
|
|
9539
9539
|
var prodUrl = concat_default()(_context11 = concat_default()(_context12 = concat_default()(_context13 = concat_default()(_context14 = concat_default()(_context15 = concat_default()(_context16 = "https://".concat(handle)).call(_context16, clusterString, ".")).call(_context15, domainString, ".support/")).call(_context14, name, "/")).call(_context13, routeString)).call(_context12, questionSym)).call(_context11, queryString);
|
|
9540
9540
|
|
|
9541
|
-
if (config_info/* isProduction */.
|
|
9541
|
+
if (config_info/* isProduction */.y || false) {
|
|
9542
9542
|
return prodUrl;
|
|
9543
9543
|
}
|
|
9544
9544
|
|
|
@@ -9573,6 +9573,7 @@ function getURL(_ref2) {
|
|
|
9573
9573
|
|
|
9574
9574
|
|
|
9575
9575
|
|
|
9576
|
+
|
|
9576
9577
|
var actions = {
|
|
9577
9578
|
setState: function setState(_ref) {
|
|
9578
9579
|
var _ref$payload = _ref.payload,
|
|
@@ -9589,6 +9590,10 @@ var actions = {
|
|
|
9589
9590
|
* Clear the persisted unread message count
|
|
9590
9591
|
*/
|
|
9591
9592
|
if (currentState.chatterToken) {
|
|
9593
|
+
if (!currentState.handle) {
|
|
9594
|
+
throw new errors/* AdaEmbedError */.S("`currentState.handle` is undefined");
|
|
9595
|
+
}
|
|
9596
|
+
|
|
9592
9597
|
var url = getURL({
|
|
9593
9598
|
name: "api",
|
|
9594
9599
|
handle: currentState.handle,
|
|
@@ -9609,6 +9614,10 @@ var actions = {
|
|
|
9609
9614
|
proactiveCampaignHadMessages = currentState.proactiveCampaignHadMessages;
|
|
9610
9615
|
|
|
9611
9616
|
if (!currentState.isDrawerOpen && !hasChatOpenedAfterProactiveMessagesShown && !wasCampaignShownButNowClosed && proactiveCampaignHadMessages && currentState.latestCampaignKey) {
|
|
9617
|
+
if (!currentState.handle) {
|
|
9618
|
+
throw new errors/* AdaEmbedError */.S("`currentState.handle` is undefined");
|
|
9619
|
+
}
|
|
9620
|
+
|
|
9612
9621
|
var _url = getURL({
|
|
9613
9622
|
name: "api",
|
|
9614
9623
|
handle: currentState.handle,
|
|
@@ -9654,7 +9663,6 @@ var actions = {
|
|
|
9654
9663
|
};
|
|
9655
9664
|
}
|
|
9656
9665
|
};
|
|
9657
|
-
/* harmony default export */ var store_actions = (actions);
|
|
9658
9666
|
;// CONCATENATED MODULE: ./src/common/constants/storage-keys.ts
|
|
9659
9667
|
var CHATTER_TOKEN_STORAGE_KEY = "chatter";
|
|
9660
9668
|
var CHATTER_CREATED_STORAGE_KEY = "ada-embed_chatter-created";
|
|
@@ -9938,7 +9946,7 @@ function getValueFromStorage(key) {
|
|
|
9938
9946
|
return safeLocalStorage.getItem(key) || safeSessionStorage.getItem(key);
|
|
9939
9947
|
}
|
|
9940
9948
|
|
|
9941
|
-
var
|
|
9949
|
+
var defaultState = {
|
|
9942
9950
|
handle: undefined,
|
|
9943
9951
|
styles: undefined,
|
|
9944
9952
|
domain: undefined,
|
|
@@ -9983,7 +9991,6 @@ var state = {
|
|
|
9983
9991
|
wasCampaignShownButNowClosed: false,
|
|
9984
9992
|
proactiveCampaignHadMessages: false
|
|
9985
9993
|
};
|
|
9986
|
-
/* harmony default export */ var store_state = (state);
|
|
9987
9994
|
;// CONCATENATED MODULE: ./src/client/store/index.ts
|
|
9988
9995
|
|
|
9989
9996
|
|
|
@@ -10019,8 +10026,8 @@ var Store = /*#__PURE__*/function () {
|
|
|
10019
10026
|
|
|
10020
10027
|
(0,defineProperty/* default */.Z)(this, "messageService", void 0);
|
|
10021
10028
|
|
|
10022
|
-
this.defaultState =
|
|
10023
|
-
this.state =
|
|
10029
|
+
this.defaultState = defaultState;
|
|
10030
|
+
this.state = defaultState;
|
|
10024
10031
|
this.messageService = messageService;
|
|
10025
10032
|
}
|
|
10026
10033
|
|
|
@@ -10086,7 +10093,7 @@ var Store = /*#__PURE__*/function () {
|
|
|
10086
10093
|
return;
|
|
10087
10094
|
}
|
|
10088
10095
|
|
|
10089
|
-
var actionVal =
|
|
10096
|
+
var actionVal = actions[actionKey]({
|
|
10090
10097
|
currentState: this.state,
|
|
10091
10098
|
payload: payload,
|
|
10092
10099
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
@@ -10934,7 +10941,7 @@ function _fetchClient() {
|
|
|
10934
10941
|
case 3:
|
|
10935
10942
|
cachedClient = _context.sent;
|
|
10936
10943
|
|
|
10937
|
-
if (!
|
|
10944
|
+
if (!isClientObject(cachedClient)) {
|
|
10938
10945
|
_context.next = 6;
|
|
10939
10946
|
break;
|
|
10940
10947
|
}
|
|
@@ -10950,7 +10957,10 @@ function _fetchClient() {
|
|
|
10950
10957
|
case 8:
|
|
10951
10958
|
_context.prev = 8;
|
|
10952
10959
|
_context.t0 = _context["catch"](0);
|
|
10953
|
-
|
|
10960
|
+
|
|
10961
|
+
if (_context.t0 instanceof Error) {
|
|
10962
|
+
error_tracker.trackException(_context.t0);
|
|
10963
|
+
}
|
|
10954
10964
|
|
|
10955
10965
|
case 11:
|
|
10956
10966
|
_context.prev = 11;
|
|
@@ -11735,7 +11745,7 @@ var ChatFrame = /*#__PURE__*/function (_Component) {
|
|
|
11735
11745
|
cluster: cluster,
|
|
11736
11746
|
domain: domain,
|
|
11737
11747
|
qp: {
|
|
11738
|
-
embedVersion: slice_default()("
|
|
11748
|
+
embedVersion: slice_default()("e9fb831").call("e9fb831", 0, 7),
|
|
11739
11749
|
greeting: greeting,
|
|
11740
11750
|
language: language,
|
|
11741
11751
|
skipGreeting: skipGreeting,
|
|
@@ -13853,7 +13863,6 @@ function client_objectSpread(target) { for (var i = 1; i < arguments.length; i++
|
|
|
13853
13863
|
|
|
13854
13864
|
|
|
13855
13865
|
|
|
13856
|
-
|
|
13857
13866
|
var Embed = /*#__PURE__*/function () {
|
|
13858
13867
|
function Embed(adaSettings, unmountCallback) {
|
|
13859
13868
|
var _this = this;
|
|
@@ -13942,6 +13951,10 @@ var Embed = /*#__PURE__*/function () {
|
|
|
13942
13951
|
parentContainer = document.body;
|
|
13943
13952
|
}
|
|
13944
13953
|
|
|
13954
|
+
if (!parentContainer) {
|
|
13955
|
+
throw new errors/* AdaEmbedError */.S("`parentContainer` is null");
|
|
13956
|
+
}
|
|
13957
|
+
|
|
13945
13958
|
parentContainer.appendChild(this.entryContainer);
|
|
13946
13959
|
M(v(StoreContext.Provider, {
|
|
13947
13960
|
value: this.store
|
|
@@ -14388,7 +14401,7 @@ var Embed = /*#__PURE__*/function () {
|
|
|
14388
14401
|
* Bind to the window object so it can be used by the entry file.
|
|
14389
14402
|
*/
|
|
14390
14403
|
|
|
14391
|
-
(0,defineProperty/* default */.Z)(Embed, "embed2Version",
|
|
14404
|
+
(0,defineProperty/* default */.Z)(Embed, "embed2Version", "e9fb831");
|
|
14392
14405
|
|
|
14393
14406
|
window.__AdaEmbedConstructor = Embed;
|
|
14394
14407
|
|
|
@@ -14399,13 +14412,11 @@ window.__AdaEmbedConstructor = Embed;
|
|
|
14399
14412
|
|
|
14400
14413
|
"use strict";
|
|
14401
14414
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
14402
|
-
/* harmony export */ "
|
|
14403
|
-
/* harmony export */ "
|
|
14404
|
-
/* harmony export */ "Mk": function() { return /* binding */ embed2Version; }
|
|
14415
|
+
/* harmony export */ "p": function() { return /* binding */ isModern; },
|
|
14416
|
+
/* harmony export */ "y": function() { return /* binding */ isProduction; }
|
|
14405
14417
|
/* harmony export */ });
|
|
14406
14418
|
var isModern = new RegExp("((CPU[ +]OS|iPhone[ +]OS|CPU[ +]iPhone|CPU IPhone OS)[ +]+(15|(1[6-9]|[2-9]\\d|\\d{3,}))[_.]\\d+(?:[_.]\\d+)?)|((Chromium|Chrome)\\/(100|(10[1-9]|1[1-9]\\d|[2-9]\\d\\d|\\d{4,}))\\.\\d+(?:\\.\\d+)?)|(Version\\/(15|(1[6-9]|[2-9]\\d|\\d{3,}))\\.\\d+(?:\\.\\d+)? Safari\\/)|(Firefox\\/(99|([1-9]\\d\\d|\\d{4,}))\\.\\d+\\.\\d+)|(Firefox\\/(99|([1-9]\\d\\d|\\d{4,}))\\.\\d+(pre|[ab]\\d+[a-z]*)?)").test(navigator.userAgent);
|
|
14407
14419
|
var isProduction = "production" === "production";
|
|
14408
|
-
var embed2Version = "fcea82c";
|
|
14409
14420
|
|
|
14410
14421
|
/***/ }),
|
|
14411
14422
|
|
|
@@ -14750,9 +14761,9 @@ function _log() {
|
|
|
14750
14761
|
service: "embed",
|
|
14751
14762
|
env: "production",
|
|
14752
14763
|
embedVersion: 2,
|
|
14753
|
-
version: "1.1.
|
|
14764
|
+
version: "1.1.32",
|
|
14754
14765
|
isNpm: true,
|
|
14755
|
-
commitHash: "
|
|
14766
|
+
commitHash: "e9fb831"
|
|
14756
14767
|
}))
|
|
14757
14768
|
});
|
|
14758
14769
|
|
|
@@ -25683,17 +25694,17 @@ function _loadClientChunk() {
|
|
|
25683
25694
|
switch (_context19.prev = _context19.next) {
|
|
25684
25695
|
case 0:
|
|
25685
25696
|
if (adaSettings.customDomains) {
|
|
25686
|
-
clientScriptSource = config_info/* isModern */.
|
|
25697
|
+
clientScriptSource = config_info/* isModern */.p ? adaSettings.customDomains.embedModern : adaSettings.customDomains.embedLegacy;
|
|
25687
25698
|
} else {
|
|
25688
|
-
if (config_info/* isProduction */.
|
|
25699
|
+
if (config_info/* isProduction */.y) {
|
|
25689
25700
|
host = "https://static.ada.support";
|
|
25690
|
-
polyfillVersionString = config_info/* isModern */.
|
|
25701
|
+
polyfillVersionString = config_info/* isModern */.p ? "modern" : "legacy";
|
|
25691
25702
|
} else {
|
|
25692
25703
|
host = "http://localhost:9001";
|
|
25693
25704
|
polyfillVersionString = "legacy";
|
|
25694
25705
|
}
|
|
25695
25706
|
|
|
25696
|
-
clientScriptSource = concat_default()(_context17 = concat_default()(_context18 = "".concat(host, "/embed/")).call(_context18, polyfillVersionString, "/client/")).call(_context17, "
|
|
25707
|
+
clientScriptSource = concat_default()(_context17 = concat_default()(_context18 = "".concat(host, "/embed/")).call(_context18, polyfillVersionString, "/client/")).call(_context17, "e9fb831", "/index.js");
|
|
25697
25708
|
} // `window.__AdaEmbedConstructor` gets created in the "client" bundle
|
|
25698
25709
|
|
|
25699
25710
|
|
|
@@ -25738,7 +25749,7 @@ function _loadClientChunk() {
|
|
|
25738
25749
|
}
|
|
25739
25750
|
|
|
25740
25751
|
function createEmbedObject() {
|
|
25741
|
-
var embed;
|
|
25752
|
+
var embed = null;
|
|
25742
25753
|
var startEmbedResolve;
|
|
25743
25754
|
var startEmbed = null;
|
|
25744
25755
|
|
|
@@ -25791,7 +25802,7 @@ function createEmbedObject() {
|
|
|
25791
25802
|
startEmbedResolve = resolve;
|
|
25792
25803
|
});
|
|
25793
25804
|
/**
|
|
25794
|
-
* We cannot use window.
|
|
25805
|
+
* We cannot use window.__AdaEmbedConstructor until the embed script has loaded
|
|
25795
25806
|
*/
|
|
25796
25807
|
|
|
25797
25808
|
_context2.next = 5;
|
|
@@ -25806,7 +25817,7 @@ function createEmbedObject() {
|
|
|
25806
25817
|
throw new Error("`window.__AdaEmbedConstructor` is not defined");
|
|
25807
25818
|
|
|
25808
25819
|
case 7:
|
|
25809
|
-
if (!(adaSettings.customDomains && window.__AdaEmbedConstructor.embed2Version !==
|
|
25820
|
+
if (!(adaSettings.customDomains && window.__AdaEmbedConstructor.embed2Version !== "e9fb831")) {
|
|
25810
25821
|
_context2.next = 9;
|
|
25811
25822
|
break;
|
|
25812
25823
|
}
|
|
@@ -25815,7 +25826,7 @@ function createEmbedObject() {
|
|
|
25815
25826
|
|
|
25816
25827
|
case 9:
|
|
25817
25828
|
/**
|
|
25818
|
-
* We bind the window.
|
|
25829
|
+
* We bind the window.__AdaEmbedConstructor instead of importing the Embed class because entry is a
|
|
25819
25830
|
* separate bundle.
|
|
25820
25831
|
*/
|
|
25821
25832
|
embed = new window.__AdaEmbedConstructor(adaSettings, function () {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ada-support/embed2",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.32",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/npm-entry",
|
|
6
6
|
"typings": "dist/npm-entry/index.d.ts",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"build:modern": "TS_NODE_PROJECT=wp.tsconfig.json NODE_ENV=production BROWSERSLIST_ENV=modern npx webpack --config webpack.prod.ts",
|
|
11
11
|
"build:npm-types": "tsc --project tsconfig.npm.json --declaration --outDir dist/npm-entry --emitDeclarationOnly --allowJs false --checkJs false",
|
|
12
12
|
"build:npm": "./npm-build.sh",
|
|
13
|
-
"lint": "tsc --noEmit --strict false && ./node_modules/.bin/eslint --report-unused-disable-directives --ext .js,.jsx,.ts,.tsx . --max-warnings
|
|
13
|
+
"lint": "tsc --noEmit --strict false && ./node_modules/.bin/eslint --report-unused-disable-directives --ext .js,.jsx,.ts,.tsx . --max-warnings 25",
|
|
14
14
|
"lint:fix": "yarn lint --fix",
|
|
15
15
|
"test": "jest",
|
|
16
16
|
"check-types": "./node_modules/typescript/bin/tsc --project ./tsconfig.json --noEmit --strict false",
|