@ada-support/embed2 1.0.47 → 1.0.49
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/client/index.d.ts +1 -1
- package/dist/npm-entry/common/helpers/fetch-client.d.ts +3 -3
- package/dist/npm-entry/common/helpers/get-intro-for-url.d.ts +2 -2
- package/dist/npm-entry/common/lib/fc/index.d.ts +0 -1
- package/dist/npm-entry/common/models/client/index.d.ts +6 -6
- package/dist/npm-entry/common/types/http.d.ts +6 -3
- package/dist/npm-entry/common/types/languages.d.ts +2 -3
- package/dist/npm-entry/common/types/store-state.d.ts +1 -1
- package/dist/npm-entry/frames/helpers/storage/index.d.ts +2 -2
- package/dist/npm-entry/index.js +161 -59
- package/package.json +3 -3
|
@@ -2,7 +2,7 @@ import type { EventSubscriptionCallback } from "client/helpers/event-subscriptio
|
|
|
2
2
|
import { MessageService } from "client/lib/message-service";
|
|
3
3
|
import { StoreProxy } from "client/lib/store-proxy";
|
|
4
4
|
import "client/lib/error-tracker";
|
|
5
|
-
import type Client from "common/models/client";
|
|
5
|
+
import type { Client } from "common/models/client";
|
|
6
6
|
import type { EvaluateCampaignParams, ResetParams, WindowInfo } from "common/types";
|
|
7
7
|
import type { MetaFieldPayload } from "common/types/store";
|
|
8
8
|
import type { StartOptions } from "common/types/store-state";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ClientObject, ClientResponse } from "common/types/http";
|
|
2
|
-
export declare function
|
|
1
|
+
import type { ClientObject, ClientResponse } from "common/types/http";
|
|
2
|
+
export declare function isClientObject(client: Record<string, unknown>): client is ClientObject;
|
|
3
3
|
/**
|
|
4
4
|
* Tries fetching the client from cache. If this fails, tries fetching it from API.
|
|
5
5
|
* If this also fails, returns null.
|
|
6
6
|
*/
|
|
7
|
-
export declare function fetchClient(handle: string, cluster: string, domain: string, language: string): Promise<ClientResponse>;
|
|
7
|
+
export declare function fetchClient(handle: string, cluster: string, domain: string, language: string): Promise<ClientResponse | null>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { CurrentIntro, Intro } from "common/types/http";
|
|
1
|
+
import type { CurrentIntro, Intro } from "common/types/http";
|
|
2
2
|
export declare function getProcessedPath(path: string): string;
|
|
3
3
|
export declare function getPathSearchRegex(path: string): RegExp;
|
|
4
4
|
export declare function doesUrlMatchPath(url: string, path: string): boolean;
|
|
5
|
-
export declare function getIntroForCurrentUrl(intros: Intro[], language: string): CurrentIntro |
|
|
5
|
+
export declare function getIntroForCurrentUrl(intros: Intro[], language: string): CurrentIntro | undefined;
|
|
@@ -15,7 +15,6 @@ export declare class FrameChannel extends Channel {
|
|
|
15
15
|
name: string;
|
|
16
16
|
targetWindow: Window;
|
|
17
17
|
targetOrigin: string;
|
|
18
|
-
eventTarget: Window;
|
|
19
18
|
isConnected: boolean;
|
|
20
19
|
constructor(name: string, targetWindow: Window, targetOrigin?: string);
|
|
21
20
|
private static isMessageEvent;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { BusinessEvent } from "businessEvents/types";
|
|
2
|
-
import { ChatButton, ClientResponse, CurrentIntro, Features } from "common/types/http";
|
|
3
|
-
import { LanguageMap } from "common/types/languages";
|
|
4
|
-
import { MarketingCampaign } from "src/campaigns/types";
|
|
5
|
-
export
|
|
1
|
+
import type { BusinessEvent } from "businessEvents/types";
|
|
2
|
+
import type { ChatButton, ClientResponse, CurrentIntro, Features } from "common/types/http";
|
|
3
|
+
import type { LanguageKey, LanguageMap } from "common/types/languages";
|
|
4
|
+
import type { MarketingCampaign } from "src/campaigns/types";
|
|
5
|
+
export declare class Client {
|
|
6
6
|
tint: string;
|
|
7
7
|
chat: boolean;
|
|
8
8
|
intro?: CurrentIntro;
|
|
9
9
|
handle: string;
|
|
10
10
|
rollout: number;
|
|
11
|
-
language:
|
|
11
|
+
language: LanguageKey;
|
|
12
12
|
privacy: boolean;
|
|
13
13
|
features: Features;
|
|
14
14
|
persistence: string;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { BusinessEvent } from "businessEvents/types";
|
|
1
|
+
import type { BusinessEvent } from "businessEvents/types";
|
|
2
|
+
import type { LanguageKey } from "common/types/languages";
|
|
2
3
|
export interface ChatButton {
|
|
3
4
|
size: number;
|
|
4
5
|
background_color: string;
|
|
@@ -43,20 +44,21 @@ export interface ClientObject {
|
|
|
43
44
|
rollout: number;
|
|
44
45
|
chat: boolean;
|
|
45
46
|
persistence: string;
|
|
46
|
-
language:
|
|
47
|
+
language: LanguageKey;
|
|
47
48
|
privacy: boolean;
|
|
48
49
|
tint: string;
|
|
49
50
|
chat_button: ChatButton | null;
|
|
50
51
|
intro?: CurrentIntro;
|
|
51
52
|
features: Features;
|
|
52
53
|
marketing_campaigns_order?: string[];
|
|
54
|
+
[key: string]: unknown;
|
|
53
55
|
}
|
|
54
56
|
export interface CachedClientObject {
|
|
55
57
|
handle: string;
|
|
56
58
|
rollout: number;
|
|
57
59
|
chat: boolean;
|
|
58
60
|
persistence: string;
|
|
59
|
-
language:
|
|
61
|
+
language: LanguageKey;
|
|
60
62
|
privacy: boolean;
|
|
61
63
|
tint: string;
|
|
62
64
|
chat_button: ChatButton | null;
|
|
@@ -64,6 +66,7 @@ export interface CachedClientObject {
|
|
|
64
66
|
features: Features;
|
|
65
67
|
business_events?: BusinessEvent[];
|
|
66
68
|
marketing_campaigns_order?: string[];
|
|
69
|
+
[key: string]: unknown;
|
|
67
70
|
}
|
|
68
71
|
export interface ClientResponse {
|
|
69
72
|
client: ClientObject;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
declare type
|
|
1
|
+
export declare type LanguageKey = "en" | "da" | "de" | "es" | "fi" | "fr" | "hi" | "ht" | "id" | "it" | "ja" | "km" | "ko" | "ms" | "my" | "no" | "nl" | "pa" | "pt" | "ru" | "sv" | "ta" | "th" | "tl" | "tr" | "vi" | "zh" | "zh-tw" | "bg" | "ro" | "el" | "hu" | "pl" | "cs" | "et" | "hr" | "lt" | "lv" | "sl" | "sk" | "is" | "ar" | "he";
|
|
2
2
|
export declare type LanguageMap = {
|
|
3
|
-
[K in
|
|
3
|
+
[K in LanguageKey]?: string;
|
|
4
4
|
};
|
|
5
|
-
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ConnectionState } from "common/constants/events";
|
|
2
|
-
import type Client from "common/models/client";
|
|
2
|
+
import type { Client } from "common/models/client";
|
|
3
3
|
import type { ChatterEventPayload } from "common/types/events";
|
|
4
4
|
export interface StartOptions {
|
|
5
5
|
handle?: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import Client from "common/models/client";
|
|
2
|
-
import { StorageKey, StorageValueByKey } from "frames/lib/safe-storage";
|
|
1
|
+
import type { Client } from "common/models/client";
|
|
2
|
+
import type { StorageKey, StorageValueByKey } from "frames/lib/safe-storage";
|
|
3
3
|
export declare const PERSISTENCE_NORMAL = "normal";
|
|
4
4
|
export declare const PERSISTENCE_SESSION = "session";
|
|
5
5
|
/**
|
package/dist/npm-entry/index.js
CHANGED
|
@@ -190,6 +190,13 @@ module.exports = __webpack_require__(3685);
|
|
|
190
190
|
|
|
191
191
|
/***/ }),
|
|
192
192
|
|
|
193
|
+
/***/ 3263:
|
|
194
|
+
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
|
|
195
|
+
|
|
196
|
+
module.exports = __webpack_require__(4710);
|
|
197
|
+
|
|
198
|
+
/***/ }),
|
|
199
|
+
|
|
193
200
|
/***/ 4889:
|
|
194
201
|
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
|
|
195
202
|
|
|
@@ -197,6 +204,13 @@ module.exports = __webpack_require__(4303);
|
|
|
197
204
|
|
|
198
205
|
/***/ }),
|
|
199
206
|
|
|
207
|
+
/***/ 9356:
|
|
208
|
+
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
|
|
209
|
+
|
|
210
|
+
module.exports = __webpack_require__(3799);
|
|
211
|
+
|
|
212
|
+
/***/ }),
|
|
213
|
+
|
|
200
214
|
/***/ 9542:
|
|
201
215
|
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
|
|
202
216
|
|
|
@@ -722,7 +736,7 @@ var browserPerformanceTimeOrigin = (function () {
|
|
|
722
736
|
|
|
723
737
|
/***/ }),
|
|
724
738
|
|
|
725
|
-
/***/
|
|
739
|
+
/***/ 9136:
|
|
726
740
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
727
741
|
|
|
728
742
|
"use strict";
|
|
@@ -8500,7 +8514,7 @@ var client = new error_tracker_BrowserClient({
|
|
|
8500
8514
|
return event;
|
|
8501
8515
|
},
|
|
8502
8516
|
environment: "production",
|
|
8503
|
-
release: "1.0.
|
|
8517
|
+
release: "1.0.49-4562505",
|
|
8504
8518
|
sampleRate: 0.25,
|
|
8505
8519
|
autoSessionTracking: false,
|
|
8506
8520
|
// Integrations don't seem to work with Sentry: https://github.com/getsentry/sentry-javascript/issues/2541
|
|
@@ -8730,7 +8744,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
8730
8744
|
}).catch(function (e) {
|
|
8731
8745
|
// We should NOT silently catch errors for "GET_STATE" request event - it is critical for application to work.
|
|
8732
8746
|
if (requestEvent === "GET_STATE") {
|
|
8733
|
-
throw new errors/* AdaEmbedError */.S("Failed to respond to \"GET_STATE\" request. Reason: ".concat(e.message, "."));
|
|
8747
|
+
throw new errors/* AdaEmbedError */.S("Failed to respond to \"GET_STATE\" request. Reason: \"".concat(e.message, "\"."));
|
|
8734
8748
|
} // handling promise
|
|
8735
8749
|
|
|
8736
8750
|
|
|
@@ -8825,8 +8839,6 @@ var FrameChannel = /*#__PURE__*/function (_Channel) {
|
|
|
8825
8839
|
|
|
8826
8840
|
(0,defineProperty/* default */.Z)((0,assertThisInitialized/* default */.Z)(_this), "targetOrigin", void 0);
|
|
8827
8841
|
|
|
8828
|
-
(0,defineProperty/* default */.Z)((0,assertThisInitialized/* default */.Z)(_this), "eventTarget", void 0);
|
|
8829
|
-
|
|
8830
8842
|
(0,defineProperty/* default */.Z)((0,assertThisInitialized/* default */.Z)(_this), "isConnected", false);
|
|
8831
8843
|
|
|
8832
8844
|
_this.name = name;
|
|
@@ -8898,20 +8910,20 @@ var FrameChannel = /*#__PURE__*/function (_Channel) {
|
|
|
8898
8910
|
status: status
|
|
8899
8911
|
});
|
|
8900
8912
|
} catch (e) {
|
|
8901
|
-
var
|
|
8913
|
+
var _context4, _context5;
|
|
8902
8914
|
|
|
8903
8915
|
var reason = e instanceof Error ? e.message : "unknown";
|
|
8904
8916
|
var payloadRootKeys = payload && (0,esm_typeof/* default */.Z)(payload) === "object" ? keys_default()(payload) : [];
|
|
8905
8917
|
|
|
8906
8918
|
if (eventName === "DISPATCH" && payload && (0,esm_typeof/* default */.Z)(payload) === "object") {
|
|
8907
|
-
var _context2;
|
|
8919
|
+
var _context2, _context3;
|
|
8908
8920
|
|
|
8909
8921
|
var p = payload;
|
|
8910
8922
|
var dispatchPayloadKeys = p.payload && (0,esm_typeof/* default */.Z)(p.payload) === "object" ? keys_default()(p.payload) : [];
|
|
8911
|
-
throw new errors/* AdaEmbedError */.S(concat_default()(_context2 = "Failed to stringify payload for \"DISPATCH\" event. Reason: \"".concat(reason, "\". Payload keys: ")).call(_context2, dispatchPayloadKeys.join(", "), "."));
|
|
8923
|
+
throw new errors/* AdaEmbedError */.S(concat_default()(_context2 = concat_default()(_context3 = "Failed to stringify payload for \"DISPATCH\" event. Reason: \"".concat(reason, "\". Action: \"")).call(_context3, p.actionKey, "\". Payload keys: ")).call(_context2, dispatchPayloadKeys.join(", "), "."));
|
|
8912
8924
|
}
|
|
8913
8925
|
|
|
8914
|
-
throw new errors/* AdaEmbedError */.S(concat_default()(
|
|
8926
|
+
throw new errors/* AdaEmbedError */.S(concat_default()(_context4 = concat_default()(_context5 = "Failed to stringify object. Reason: \"".concat(reason, "\". Event: \"")).call(_context5, eventName, "\". Payload keys: ")).call(_context4, payloadRootKeys.join(", "), "."));
|
|
8915
8927
|
}
|
|
8916
8928
|
}
|
|
8917
8929
|
}], [{
|
|
@@ -9201,7 +9213,7 @@ function getEmbedURL(_ref) {
|
|
|
9201
9213
|
polyfillVersionString = "legacy";
|
|
9202
9214
|
}
|
|
9203
9215
|
|
|
9204
|
-
return concat_default()(_context5 = concat_default()(_context6 = concat_default()(_context7 = "".concat(host, "/embed/")).call(_context7, polyfillVersionString, "/")).call(_context6, frameName, "/")).call(_context5, "
|
|
9216
|
+
return concat_default()(_context5 = concat_default()(_context6 = concat_default()(_context7 = "".concat(host, "/embed/")).call(_context7, polyfillVersionString, "/")).call(_context6, frameName, "/")).call(_context5, "4562505", "/index.html");
|
|
9205
9217
|
}
|
|
9206
9218
|
/**
|
|
9207
9219
|
* Generate the Chat / API URL
|
|
@@ -10044,8 +10056,6 @@ var trim_default = /*#__PURE__*/__webpack_require__.n(trim);
|
|
|
10044
10056
|
|
|
10045
10057
|
|
|
10046
10058
|
|
|
10047
|
-
var INTRO_STYLE_EMOJI = "Emoji";
|
|
10048
|
-
var INTRO_STYLE_TEXT = "Text";
|
|
10049
10059
|
function getProcessedPath(path) {
|
|
10050
10060
|
var regex = new RegExp("^http(s)?://(www.)?");
|
|
10051
10061
|
return trim_default()(path).call(path).replace(regex, "");
|
|
@@ -10095,20 +10105,10 @@ function getIntroForCurrentUrl(intros, language) {
|
|
|
10095
10105
|
var matchingIntro = findMatchingIntro(intros);
|
|
10096
10106
|
|
|
10097
10107
|
if (!matchingIntro) {
|
|
10098
|
-
return
|
|
10108
|
+
return undefined;
|
|
10099
10109
|
}
|
|
10100
10110
|
|
|
10101
|
-
if (matchingIntro.style ===
|
|
10102
|
-
return {
|
|
10103
|
-
response_id: matchingIntro.response_id,
|
|
10104
|
-
body: matchingIntro.body.message_text[language],
|
|
10105
|
-
style: matchingIntro.style,
|
|
10106
|
-
delay: matchingIntro.delay,
|
|
10107
|
-
duration: matchingIntro.duration
|
|
10108
|
-
};
|
|
10109
|
-
}
|
|
10110
|
-
|
|
10111
|
-
if (matchingIntro.style === INTRO_STYLE_EMOJI) {
|
|
10111
|
+
if (matchingIntro.style === "Emoji") {
|
|
10112
10112
|
return {
|
|
10113
10113
|
response_id: matchingIntro.response_id,
|
|
10114
10114
|
body: matchingIntro.body.emoji_link,
|
|
@@ -10116,9 +10116,16 @@ function getIntroForCurrentUrl(intros, language) {
|
|
|
10116
10116
|
delay: matchingIntro.delay,
|
|
10117
10117
|
duration: matchingIntro.duration
|
|
10118
10118
|
};
|
|
10119
|
-
}
|
|
10119
|
+
} // Default - "Text" style
|
|
10120
10120
|
|
|
10121
|
-
|
|
10121
|
+
|
|
10122
|
+
return {
|
|
10123
|
+
response_id: matchingIntro.response_id,
|
|
10124
|
+
body: matchingIntro.body.message_text[language],
|
|
10125
|
+
style: matchingIntro.style,
|
|
10126
|
+
delay: matchingIntro.delay,
|
|
10127
|
+
duration: matchingIntro.duration
|
|
10128
|
+
};
|
|
10122
10129
|
}
|
|
10123
10130
|
;// CONCATENATED MODULE: ./src/campaigns/TriggerConditionEvaluator.ts
|
|
10124
10131
|
|
|
@@ -10688,7 +10695,7 @@ function fetch_client_objectSpread(target) { for (var i = 1; i < arguments.lengt
|
|
|
10688
10695
|
|
|
10689
10696
|
|
|
10690
10697
|
|
|
10691
|
-
function
|
|
10698
|
+
function isClientObject(client) {
|
|
10692
10699
|
// We require the following properties defined
|
|
10693
10700
|
return ["handle", "rollout", "chat", "features"].every(function (key) {
|
|
10694
10701
|
return client[key] !== undefined;
|
|
@@ -10719,14 +10726,14 @@ function _fetchClient() {
|
|
|
10719
10726
|
case 3:
|
|
10720
10727
|
cachedClient = _context.sent;
|
|
10721
10728
|
|
|
10722
|
-
if (!(cachedClient &&
|
|
10729
|
+
if (!(cachedClient && isClientObject(cachedClient))) {
|
|
10723
10730
|
_context.next = 6;
|
|
10724
10731
|
break;
|
|
10725
10732
|
}
|
|
10726
10733
|
|
|
10727
10734
|
return _context.abrupt("return", {
|
|
10728
10735
|
client: fetch_client_objectSpread({
|
|
10729
|
-
intro: getIntroForCurrentUrl(cachedClient.intros, language || cachedClient.language)
|
|
10736
|
+
intro: getIntroForCurrentUrl(cachedClient.intros || [], language || cachedClient.language)
|
|
10730
10737
|
}, cachedClient)
|
|
10731
10738
|
});
|
|
10732
10739
|
|
|
@@ -10807,6 +10814,53 @@ function wait(ms) {
|
|
|
10807
10814
|
return setTimeout(resolve, ms);
|
|
10808
10815
|
});
|
|
10809
10816
|
}
|
|
10817
|
+
// EXTERNAL MODULE: ./node_modules/@babel/runtime-corejs3/core-js/object/get-own-property-symbols.js
|
|
10818
|
+
var object_get_own_property_symbols = __webpack_require__(3263);
|
|
10819
|
+
// EXTERNAL MODULE: ./node_modules/@babel/runtime-corejs3/core-js/instance/index-of.js
|
|
10820
|
+
var index_of = __webpack_require__(5683);
|
|
10821
|
+
// EXTERNAL MODULE: ./node_modules/@babel/runtime-corejs3/core-js/object/keys.js
|
|
10822
|
+
var keys = __webpack_require__(9356);
|
|
10823
|
+
;// CONCATENATED MODULE: ./node_modules/@babel/runtime-corejs3/helpers/esm/objectWithoutPropertiesLoose.js
|
|
10824
|
+
|
|
10825
|
+
|
|
10826
|
+
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
10827
|
+
if (source == null) return {};
|
|
10828
|
+
var target = {};
|
|
10829
|
+
|
|
10830
|
+
var sourceKeys = keys(source);
|
|
10831
|
+
|
|
10832
|
+
var key, i;
|
|
10833
|
+
|
|
10834
|
+
for (i = 0; i < sourceKeys.length; i++) {
|
|
10835
|
+
key = sourceKeys[i];
|
|
10836
|
+
if (index_of(excluded).call(excluded, key) >= 0) continue;
|
|
10837
|
+
target[key] = source[key];
|
|
10838
|
+
}
|
|
10839
|
+
|
|
10840
|
+
return target;
|
|
10841
|
+
}
|
|
10842
|
+
;// CONCATENATED MODULE: ./node_modules/@babel/runtime-corejs3/helpers/esm/objectWithoutProperties.js
|
|
10843
|
+
|
|
10844
|
+
|
|
10845
|
+
|
|
10846
|
+
function _objectWithoutProperties(source, excluded) {
|
|
10847
|
+
if (source == null) return {};
|
|
10848
|
+
var target = _objectWithoutPropertiesLoose(source, excluded);
|
|
10849
|
+
var key, i;
|
|
10850
|
+
|
|
10851
|
+
if (object_get_own_property_symbols) {
|
|
10852
|
+
var sourceSymbolKeys = object_get_own_property_symbols(source);
|
|
10853
|
+
|
|
10854
|
+
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
|
10855
|
+
key = sourceSymbolKeys[i];
|
|
10856
|
+
if (index_of(excluded).call(excluded, key) >= 0) continue;
|
|
10857
|
+
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
10858
|
+
target[key] = source[key];
|
|
10859
|
+
}
|
|
10860
|
+
}
|
|
10861
|
+
|
|
10862
|
+
return target;
|
|
10863
|
+
}
|
|
10810
10864
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime-corejs3/core-js-stable/object/assign.js
|
|
10811
10865
|
var core_js_stable_object_assign = __webpack_require__(1942);
|
|
10812
10866
|
var object_assign_default = /*#__PURE__*/__webpack_require__.n(core_js_stable_object_assign);
|
|
@@ -10814,6 +10868,7 @@ var object_assign_default = /*#__PURE__*/__webpack_require__.n(core_js_stable_ob
|
|
|
10814
10868
|
|
|
10815
10869
|
|
|
10816
10870
|
|
|
10871
|
+
var _excluded = ["chat", "chat_button", "features", "handle", "language", "persistence", "privacy", "rollout", "tint"];
|
|
10817
10872
|
|
|
10818
10873
|
var Client = function Client(clientResponse) {
|
|
10819
10874
|
(0,classCallCheck/* default */.Z)(this, Client);
|
|
@@ -10846,15 +10901,34 @@ var Client = function Client(clientResponse) {
|
|
|
10846
10901
|
|
|
10847
10902
|
(0,defineProperty/* default */.Z)(this, "ui_settings", void 0);
|
|
10848
10903
|
|
|
10904
|
+
var chat = clientResponse.chat,
|
|
10905
|
+
chatButton = clientResponse.chat_button,
|
|
10906
|
+
features = clientResponse.features,
|
|
10907
|
+
handle = clientResponse.handle,
|
|
10908
|
+
language = clientResponse.language,
|
|
10909
|
+
persistence = clientResponse.persistence,
|
|
10910
|
+
privacy = clientResponse.privacy,
|
|
10911
|
+
rollout = clientResponse.rollout,
|
|
10912
|
+
tint = clientResponse.tint,
|
|
10913
|
+
rest = _objectWithoutProperties(clientResponse, _excluded);
|
|
10914
|
+
|
|
10915
|
+
this.chat = chat;
|
|
10916
|
+
this.chat_button = chatButton;
|
|
10917
|
+
this.features = features;
|
|
10918
|
+
this.handle = handle;
|
|
10919
|
+
this.language = language;
|
|
10920
|
+
this.persistence = persistence;
|
|
10921
|
+
this.privacy = privacy;
|
|
10922
|
+
this.rollout = rollout;
|
|
10923
|
+
this.tint = tint;
|
|
10849
10924
|
/**
|
|
10850
10925
|
* Even if some properties are not used by Embed2, they may be used by Chat.
|
|
10851
10926
|
* Chat can "pull" the client object from Embed2 in order to reduce an API
|
|
10852
10927
|
* request. Embed2 should thus not modify keys.
|
|
10853
10928
|
*/
|
|
10854
|
-
object_assign_default()(this, clientResponse);
|
|
10855
|
-
};
|
|
10856
|
-
|
|
10857
10929
|
|
|
10930
|
+
object_assign_default()(this, rest);
|
|
10931
|
+
};
|
|
10858
10932
|
function hasCampaignsEnabled(client) {
|
|
10859
10933
|
return (client === null || client === void 0 ? void 0 : client.features.afm_proactive_messaging) || (client === null || client === void 0 ? void 0 : client.features.afm_proactive_messaging_free_tier);
|
|
10860
10934
|
}
|
|
@@ -12672,7 +12746,7 @@ var Container = /*#__PURE__*/function (_Component) {
|
|
|
12672
12746
|
|
|
12673
12747
|
case 6:
|
|
12674
12748
|
_context3.t0 = type;
|
|
12675
|
-
_context3.next = _context3.t0 === TRACK_EVENT ? 9 : _context3.t0 === TRIGGER_CAMPAIGN ? 14 : _context3.t0 === EVAL_CAMPAIGN_CONDITIONS ? 19 : _context3.t0 === TOGGLE ? 24 : _context3.t0 === GET_INFO ? 29 : _context3.t0 === SET_META_FIELDS ? 33 : _context3.t0 === "SET_SENSITIVE_META_FIELDS" ? 40 : _context3.t0 === STOP ? 45 : _context3.t0 === RESET ? 48 : _context3.t0 === DELETE_HISTORY ? 66 : _context3.t0 === CREATE_PROACTIVE ? 78 :
|
|
12749
|
+
_context3.next = _context3.t0 === TRACK_EVENT ? 9 : _context3.t0 === TRIGGER_CAMPAIGN ? 14 : _context3.t0 === EVAL_CAMPAIGN_CONDITIONS ? 19 : _context3.t0 === TOGGLE ? 24 : _context3.t0 === GET_INFO ? 29 : _context3.t0 === SET_META_FIELDS ? 33 : _context3.t0 === "SET_SENSITIVE_META_FIELDS" ? 40 : _context3.t0 === STOP ? 45 : _context3.t0 === RESET ? 48 : _context3.t0 === DELETE_HISTORY ? 66 : _context3.t0 === CREATE_PROACTIVE ? 78 : 91;
|
|
12676
12750
|
break;
|
|
12677
12751
|
|
|
12678
12752
|
case 9:
|
|
@@ -12686,7 +12760,7 @@ var Container = /*#__PURE__*/function (_Component) {
|
|
|
12686
12760
|
|
|
12687
12761
|
case 12:
|
|
12688
12762
|
this.trackEvent(payload);
|
|
12689
|
-
return _context3.abrupt("break",
|
|
12763
|
+
return _context3.abrupt("break", 91);
|
|
12690
12764
|
|
|
12691
12765
|
case 14:
|
|
12692
12766
|
if (client.features.afm_proactive_messaging) {
|
|
@@ -12699,7 +12773,7 @@ var Container = /*#__PURE__*/function (_Component) {
|
|
|
12699
12773
|
|
|
12700
12774
|
case 17:
|
|
12701
12775
|
this.triggerCampaign(payload);
|
|
12702
|
-
return _context3.abrupt("break",
|
|
12776
|
+
return _context3.abrupt("break", 91);
|
|
12703
12777
|
|
|
12704
12778
|
case 19:
|
|
12705
12779
|
if (client.features.afm_proactive_messaging) {
|
|
@@ -12712,7 +12786,7 @@ var Container = /*#__PURE__*/function (_Component) {
|
|
|
12712
12786
|
|
|
12713
12787
|
case 22:
|
|
12714
12788
|
this.evaluateCampaignConditions(payload);
|
|
12715
|
-
return _context3.abrupt("break",
|
|
12789
|
+
return _context3.abrupt("break", 91);
|
|
12716
12790
|
|
|
12717
12791
|
case 24:
|
|
12718
12792
|
toggleChat = this.props.toggleChat;
|
|
@@ -12721,7 +12795,7 @@ var Container = /*#__PURE__*/function (_Component) {
|
|
|
12721
12795
|
|
|
12722
12796
|
case 27:
|
|
12723
12797
|
localChannel.postMessage(TOGGLE_RESPONSE, null, id);
|
|
12724
|
-
return _context3.abrupt("break",
|
|
12798
|
+
return _context3.abrupt("break", 91);
|
|
12725
12799
|
|
|
12726
12800
|
case 29:
|
|
12727
12801
|
_this$props10 = this.props, isDrawerOpen = _this$props10.isDrawerOpen, drawerHasBeenOpened = _this$props10.drawerHasBeenOpened, chatterToken = _this$props10.chatterToken;
|
|
@@ -12732,7 +12806,7 @@ var Container = /*#__PURE__*/function (_Component) {
|
|
|
12732
12806
|
hasClosedChat: drawerHasBeenOpened && !isDrawerOpen
|
|
12733
12807
|
};
|
|
12734
12808
|
localChannel.postMessage(GET_INFO_RESPONSE, contentToReturn, id);
|
|
12735
|
-
return _context3.abrupt("break",
|
|
12809
|
+
return _context3.abrupt("break", 91);
|
|
12736
12810
|
|
|
12737
12811
|
case 33:
|
|
12738
12812
|
_this$props11 = this.props, metaFields = _this$props11.metaFields, setState = _this$props11.setState;
|
|
@@ -12745,7 +12819,7 @@ var Container = /*#__PURE__*/function (_Component) {
|
|
|
12745
12819
|
|
|
12746
12820
|
case 38:
|
|
12747
12821
|
localChannel.postMessage(SET_META_FIELDS_RESPONSE, null, id);
|
|
12748
|
-
return _context3.abrupt("break",
|
|
12822
|
+
return _context3.abrupt("break", 91);
|
|
12749
12823
|
|
|
12750
12824
|
case 40:
|
|
12751
12825
|
_this$props12 = this.props, sensitiveMetaFields = _this$props12.sensitiveMetaFields, _setState = _this$props12.setState;
|
|
@@ -12756,12 +12830,12 @@ var Container = /*#__PURE__*/function (_Component) {
|
|
|
12756
12830
|
|
|
12757
12831
|
case 43:
|
|
12758
12832
|
localChannel.postMessage("SET_SENSITIVE_META_FIELDS_RESPONSE", null, id);
|
|
12759
|
-
return _context3.abrupt("break",
|
|
12833
|
+
return _context3.abrupt("break", 91);
|
|
12760
12834
|
|
|
12761
12835
|
case 45:
|
|
12762
12836
|
localChannel.postMessage(STOP_RESPONSE, null, id);
|
|
12763
12837
|
this.unmount();
|
|
12764
|
-
return _context3.abrupt("break",
|
|
12838
|
+
return _context3.abrupt("break", 91);
|
|
12765
12839
|
|
|
12766
12840
|
case 48:
|
|
12767
12841
|
_ref = payload, greeting = _ref.greeting, language = _ref.language, _newMetaFields = _ref.metaFields, _sensitiveMetaFields = _ref.sensitiveMetaFields, _ref$resetChatHistory = _ref.resetChatHistory, resetChatHistory = _ref$resetChatHistory === void 0 ? true : _ref$resetChatHistory;
|
|
@@ -12815,7 +12889,7 @@ var Container = /*#__PURE__*/function (_Component) {
|
|
|
12815
12889
|
}
|
|
12816
12890
|
|
|
12817
12891
|
localChannel.postMessage(RESET_RESPONSE, null, id);
|
|
12818
|
-
return _context3.abrupt("break",
|
|
12892
|
+
return _context3.abrupt("break", 91);
|
|
12819
12893
|
|
|
12820
12894
|
case 66:
|
|
12821
12895
|
_setState3 = this.props.setState;
|
|
@@ -12843,23 +12917,32 @@ var Container = /*#__PURE__*/function (_Component) {
|
|
|
12843
12917
|
case 75:
|
|
12844
12918
|
xStorageChannel.postMessage(DELETE_HISTORY_EVENT);
|
|
12845
12919
|
localChannel.postMessage(DELETE_HISTORY_RESPONSE, null, id);
|
|
12846
|
-
return _context3.abrupt("break",
|
|
12920
|
+
return _context3.abrupt("break", 91);
|
|
12847
12921
|
|
|
12848
12922
|
case 78:
|
|
12849
12923
|
_ref2 = payload, body = _ref2.body, duration = _ref2.duration;
|
|
12850
|
-
EXTRA_PROACTIVE_DELAY = 1000;
|
|
12924
|
+
EXTRA_PROACTIVE_DELAY = 1000;
|
|
12851
12925
|
|
|
12926
|
+
if (client) {
|
|
12927
|
+
_context3.next = 82;
|
|
12928
|
+
break;
|
|
12929
|
+
}
|
|
12930
|
+
|
|
12931
|
+
throw new errors/* AdaEmbedError */.S("`client` is not defined");
|
|
12932
|
+
|
|
12933
|
+
case 82:
|
|
12934
|
+
// Free tier campaigns re-use the createProactive infrastructure
|
|
12852
12935
|
canCreateProactive = client.features.developer_proactive || client.features.afm_proactive_messaging_free_tier;
|
|
12853
12936
|
|
|
12854
12937
|
if (canCreateProactive) {
|
|
12855
|
-
_context3.next =
|
|
12938
|
+
_context3.next = 86;
|
|
12856
12939
|
break;
|
|
12857
12940
|
}
|
|
12858
12941
|
|
|
12859
12942
|
localChannel.postMessage(CREATE_PROACTIVE_RESPONSE, "Ada Embed - Proactive intros are not available in your feature set.", id, FetchEventStatus.Failure);
|
|
12860
12943
|
return _context3.abrupt("return");
|
|
12861
12944
|
|
|
12862
|
-
case
|
|
12945
|
+
case 86:
|
|
12863
12946
|
this.setState({
|
|
12864
12947
|
hideIntroOverride: true
|
|
12865
12948
|
}, /*#__PURE__*/(0,asyncToGenerator/* default */.Z)( /*#__PURE__*/regenerator_default().mark(function _callee() {
|
|
@@ -12897,14 +12980,14 @@ var Container = /*#__PURE__*/function (_Component) {
|
|
|
12897
12980
|
}
|
|
12898
12981
|
}, _callee);
|
|
12899
12982
|
})));
|
|
12900
|
-
_context3.next =
|
|
12983
|
+
_context3.next = 89;
|
|
12901
12984
|
return wait(duration * 1000 + EXTRA_PROACTIVE_DELAY);
|
|
12902
12985
|
|
|
12903
|
-
case
|
|
12986
|
+
case 89:
|
|
12904
12987
|
localChannel.postMessage(CREATE_PROACTIVE_RESPONSE, null, id);
|
|
12905
|
-
return _context3.abrupt("break",
|
|
12988
|
+
return _context3.abrupt("break", 91);
|
|
12906
12989
|
|
|
12907
|
-
case
|
|
12990
|
+
case 91:
|
|
12908
12991
|
case "end":
|
|
12909
12992
|
return _context3.stop();
|
|
12910
12993
|
}
|
|
@@ -13199,15 +13282,15 @@ var Container = /*#__PURE__*/function (_Component) {
|
|
|
13199
13282
|
}, {
|
|
13200
13283
|
key: "renderIntroFrame",
|
|
13201
13284
|
value: function renderIntroFrame() {
|
|
13202
|
-
var
|
|
13285
|
+
var _client$intro;
|
|
13203
13286
|
|
|
13204
13287
|
var _this$props15 = this.props,
|
|
13205
13288
|
adaSettings = _this$props15.adaSettings,
|
|
13206
|
-
|
|
13289
|
+
client = _this$props15.client;
|
|
13207
13290
|
var parentElement = adaSettings.parentElement;
|
|
13208
13291
|
var hideIntroOverride = this.state.hideIntroOverride;
|
|
13209
13292
|
|
|
13210
|
-
if (parentElement || (
|
|
13293
|
+
if (parentElement || (client === null || client === void 0 ? void 0 : (_client$intro = client.intro) === null || _client$intro === void 0 ? void 0 : _client$intro.style.toLocaleLowerCase()) !== "text" || hideIntroOverride || // This avoids intros and campaigns being shown at the same time
|
|
13211
13294
|
this.shouldRenderChatFrame) {
|
|
13212
13295
|
return null;
|
|
13213
13296
|
}
|
|
@@ -13328,7 +13411,6 @@ function Container_mapStateToProps(storeState) {
|
|
|
13328
13411
|
isChatWebsocketConnected: isChatWebsocketConnected,
|
|
13329
13412
|
isDrawerOpen: isDrawerOpen,
|
|
13330
13413
|
chatterToken: chatterToken,
|
|
13331
|
-
intro: client === null || client === void 0 ? void 0 : client.intro,
|
|
13332
13414
|
appConnectionState: appConnectionState,
|
|
13333
13415
|
drawerHasBeenOpened: drawerHasBeenOpened,
|
|
13334
13416
|
chatterInLiveChat: chatterInLiveChat,
|
|
@@ -13898,7 +13980,7 @@ window.__AdaEmbedConstructor = Embed;
|
|
|
13898
13980
|
/* harmony export */ });
|
|
13899
13981
|
var isModern = new RegExp("((CPU[ +]OS|iPhone[ +]OS|CPU[ +]iPhone|CPU IPhone OS)[ +]+(14|(1[5-9]|[2-9]\\d|\\d{3,}))[_.]\\d+(?:[_.]\\d+)?)|((Chromium|Chrome)\\/(92|(9[3-9]|\\d{3,}))\\.\\d+(?:\\.\\d+)?)|(Version\\/(14|(1[5-9]|[2-9]\\d|\\d{3,}))\\.\\d+(?:\\.\\d+)? Safari\\/)|(Firefox\\/(91|(9[2-9]|\\d{3,}))\\.\\d+\\.\\d+)|(Firefox\\/(91|(9[2-9]|\\d{3,}))\\.\\d+(pre|[ab]\\d+[a-z]*)?)").test(navigator.userAgent);
|
|
13900
13982
|
var isProduction = "production" === "production";
|
|
13901
|
-
var embed2Version = "
|
|
13983
|
+
var embed2Version = "4562505";
|
|
13902
13984
|
|
|
13903
13985
|
/***/ }),
|
|
13904
13986
|
|
|
@@ -14231,9 +14313,9 @@ function _log() {
|
|
|
14231
14313
|
service: "embed",
|
|
14232
14314
|
env: "production",
|
|
14233
14315
|
embedVersion: 2,
|
|
14234
|
-
version: "1.0.
|
|
14316
|
+
version: "1.0.49",
|
|
14235
14317
|
isNpm: true,
|
|
14236
|
-
commitHash: "
|
|
14318
|
+
commitHash: "4562505"
|
|
14237
14319
|
}))
|
|
14238
14320
|
});
|
|
14239
14321
|
|
|
@@ -14915,6 +14997,16 @@ var parent = __webpack_require__(1910);
|
|
|
14915
14997
|
module.exports = parent;
|
|
14916
14998
|
|
|
14917
14999
|
|
|
15000
|
+
/***/ }),
|
|
15001
|
+
|
|
15002
|
+
/***/ 4710:
|
|
15003
|
+
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
|
|
15004
|
+
|
|
15005
|
+
var parent = __webpack_require__(9534);
|
|
15006
|
+
|
|
15007
|
+
module.exports = parent;
|
|
15008
|
+
|
|
15009
|
+
|
|
14918
15010
|
/***/ }),
|
|
14919
15011
|
|
|
14920
15012
|
/***/ 4303:
|
|
@@ -14925,6 +15017,16 @@ var parent = __webpack_require__(6507);
|
|
|
14925
15017
|
module.exports = parent;
|
|
14926
15018
|
|
|
14927
15019
|
|
|
15020
|
+
/***/ }),
|
|
15021
|
+
|
|
15022
|
+
/***/ 3799:
|
|
15023
|
+
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
|
|
15024
|
+
|
|
15025
|
+
var parent = __webpack_require__(3059);
|
|
15026
|
+
|
|
15027
|
+
module.exports = parent;
|
|
15028
|
+
|
|
15029
|
+
|
|
14928
15030
|
/***/ }),
|
|
14929
15031
|
|
|
14930
15032
|
/***/ 5122:
|
|
@@ -23688,7 +23790,7 @@ function _loadEmbed() {
|
|
|
23688
23790
|
polyfillVersionString = "legacy";
|
|
23689
23791
|
}
|
|
23690
23792
|
|
|
23691
|
-
embedScriptSource = concat_default()(_context16 = concat_default()(_context17 = "".concat(host, "/embed/")).call(_context17, polyfillVersionString, "/client/")).call(_context16, "
|
|
23793
|
+
embedScriptSource = concat_default()(_context16 = concat_default()(_context17 = "".concat(host, "/embed/")).call(_context17, polyfillVersionString, "/client/")).call(_context16, "4562505", "/index.js");
|
|
23692
23794
|
}
|
|
23693
23795
|
|
|
23694
23796
|
clientScriptExists = Boolean( true || // The client script is bundled with npm module
|
|
@@ -24226,7 +24328,7 @@ function createEmbedObject() {
|
|
|
24226
24328
|
}
|
|
24227
24329
|
;// CONCATENATED MODULE: ./src/index-npm.ts
|
|
24228
24330
|
|
|
24229
|
-
Promise.resolve(/* import() eager */).then(__webpack_require__.bind(__webpack_require__,
|
|
24331
|
+
Promise.resolve(/* import() eager */).then(__webpack_require__.bind(__webpack_require__, 9136));
|
|
24230
24332
|
/* harmony default export */ var index_npm = (createEmbedObject());
|
|
24231
24333
|
}();
|
|
24232
24334
|
module.exports = __webpack_exports__;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ada-support/embed2",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.49",
|
|
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": "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 86",
|
|
14
14
|
"lint:fix": "yarn lint --fix",
|
|
15
15
|
"deploy-legacy": "TS_NODE_PROJECT=wp.tsconfig.json NODE_ENV=production BROWSERSLIST_ENV=legacy npx webpack --config webpack.prod.ts",
|
|
16
16
|
"deploy-modern": "TS_NODE_PROJECT=wp.tsconfig.json NODE_ENV=production BROWSERSLIST_ENV=modern npx webpack --config webpack.prod.ts",
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"@types/node": "^16.7.1",
|
|
69
69
|
"@types/webpack": "^5.28.0",
|
|
70
70
|
"@types/webpack-bundle-analyzer": "^4.4.1",
|
|
71
|
-
"@types/webpack-dev-server": "^4.
|
|
71
|
+
"@types/webpack-dev-server": "^4.7.2",
|
|
72
72
|
"babel-loader": "^8.0.6",
|
|
73
73
|
"babel-preset-preact": "^2.0.0",
|
|
74
74
|
"browserslist": "^4.17.4",
|