@ada-support/embed2 1.0.60 → 1.0.64
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/businessEvents/businessEvent.d.ts +3 -3
- package/dist/npm-entry/businessEvents/types.d.ts +2 -11
- package/dist/npm-entry/campaigns/types.d.ts +1 -18
- package/dist/npm-entry/client/index.d.ts +1 -0
- package/dist/npm-entry/common/constants/events.d.ts +2 -0
- package/dist/npm-entry/{campaigns → common/helpers}/TriggerConditionEvaluator.d.ts +1 -1
- package/dist/npm-entry/common/helpers/isRTL.d.ts +1 -1
- package/dist/npm-entry/common/lib/channel.d.ts +2 -0
- package/dist/npm-entry/common/types/helpers.d.ts +18 -0
- package/dist/npm-entry/common/types/http.d.ts +0 -1
- package/dist/npm-entry/common/types/index.d.ts +0 -1
- package/dist/npm-entry/index.js +201 -188
- package/package.json +3 -2
- package/dist/npm-entry/businessEvents/TriggerConditionEvaluator.d.ts +0 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { TrackEventParams } from "common/types";
|
|
2
|
-
import { StartOptions } from "common/types/store-state";
|
|
3
|
-
import { BusinessEvent } from "./types";
|
|
1
|
+
import type { TrackEventParams } from "common/types";
|
|
2
|
+
import type { StartOptions } from "common/types/store-state";
|
|
3
|
+
import type { BusinessEvent } from "./types";
|
|
4
4
|
export declare function trackEventImpl(adaSettings: StartOptions, chatterToken: string, params: TrackEventParams): void;
|
|
5
5
|
export declare const getEventsToTrigger: (businessEvents: BusinessEvent[]) => BusinessEvent[];
|
|
@@ -1,17 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
type: "url-match";
|
|
3
|
-
conditions_any: [
|
|
4
|
-
{
|
|
5
|
-
type: "ends-with" | "contains" | "equals" | "regex";
|
|
6
|
-
value: string;
|
|
7
|
-
}
|
|
8
|
-
];
|
|
9
|
-
}
|
|
10
|
-
export declare type TriggerCondition = URLMatchTriggerCondition;
|
|
1
|
+
import type { URLMatchTriggerCondition } from "common/types/helpers";
|
|
11
2
|
export interface BusinessEvent {
|
|
12
3
|
event_key: string;
|
|
13
4
|
value: number;
|
|
14
|
-
trigger_conditions:
|
|
5
|
+
trigger_conditions: URLMatchTriggerCondition[];
|
|
15
6
|
}
|
|
16
7
|
export interface BusinessEventsResponse {
|
|
17
8
|
business_events: BusinessEvent[];
|
|
@@ -1,22 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import type { TriggerCondition } from "common/types/helpers";
|
|
2
2
|
export declare type GoalEvent = unknown;
|
|
3
|
-
export interface URLMatchTriggerCondition {
|
|
4
|
-
type: "url-match";
|
|
5
|
-
conditions_any: [
|
|
6
|
-
{
|
|
7
|
-
type: "ends-with" | "contains" | "equals" | "regex";
|
|
8
|
-
value: string;
|
|
9
|
-
}
|
|
10
|
-
];
|
|
11
|
-
}
|
|
12
|
-
export interface DateTimeTriggerCondition {
|
|
13
|
-
type: "datetime";
|
|
14
|
-
timezone: string;
|
|
15
|
-
condition: {
|
|
16
|
-
operator: "before-exclusive" | "after-inclusive";
|
|
17
|
-
datetime: string;
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
3
|
export declare type CampaignFrequency = "every-time" | "once-per-session" | "once-per-user";
|
|
21
4
|
export interface MarketingCampaign {
|
|
22
5
|
_id: string;
|
|
@@ -38,4 +38,5 @@ export declare class Embed {
|
|
|
38
38
|
createProactive(body: string, duration: number, responseId?: string): Promise<void>;
|
|
39
39
|
subscribeEvent(eventKey: string, callback: EventSubscriptionCallback): number;
|
|
40
40
|
unsubscribeEvent(id: number): void;
|
|
41
|
+
closeCampaign(): Promise<void>;
|
|
41
42
|
}
|
|
@@ -72,6 +72,8 @@ export declare const TRIGGER_CAMPAIGN = "TRIGGER_CAMPAIGN";
|
|
|
72
72
|
export declare const TRIGGER_CAMPAIGN_RESPONSE = "TRIGGER_CAMPAIGN_RESPONSE";
|
|
73
73
|
export declare const EVAL_CAMPAIGN_CONDITIONS = "EVAL_CAMPAIGN_CONDITIONS";
|
|
74
74
|
export declare const EVAL_CAMPAIGN_CONDITIONS_RESPONSE = "EVAL_CAMPAIGN_CONDITIONS_RESPONSE";
|
|
75
|
+
export declare const CLOSE_CAMPAIGN = "CLOSE_CAMPAIGN";
|
|
76
|
+
export declare const CLOSE_CAMPAIGN_RESPONSE = "CLOSE_CAMPAIGN_RESPONSE";
|
|
75
77
|
export declare const SEND_GREETING = "SEND_GREETING";
|
|
76
78
|
/**
|
|
77
79
|
* Fetch Event Status
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DateTimeTriggerCondition, TriggerCondition, URLMatchTriggerCondition } from "
|
|
1
|
+
import type { DateTimeTriggerCondition, TriggerCondition, URLMatchTriggerCondition } from "common/types/helpers";
|
|
2
2
|
export declare const evalUrlMatchTriggerCondition: (triggerCondition: URLMatchTriggerCondition, url: string) => boolean;
|
|
3
3
|
export declare const evalDatetimeTriggerCondition: (triggerCondition: DateTimeTriggerCondition, currentDateTime: Date) => boolean;
|
|
4
4
|
export declare const evalTriggerCondition: (triggerCondition: TriggerCondition) => boolean;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { StoreState } from "common/types/store-state";
|
|
1
|
+
import type { StoreState } from "common/types/store-state";
|
|
2
2
|
export declare const isRTLLanguage: (language: StoreState["language"] | undefined) => boolean;
|
|
3
3
|
export declare const isRTL: (client: StoreState["client"] | undefined, language: StoreState["language"] | undefined) => boolean;
|
|
@@ -23,6 +23,7 @@ export interface EmbedRequestPayloadByEvent {
|
|
|
23
23
|
TRIGGER_CAMPAIGN: unknown;
|
|
24
24
|
TRACK_EVENT: TrackEventParams;
|
|
25
25
|
SEND_GREETING: SendGreetingParams;
|
|
26
|
+
CLOSE_CAMPAIGN: unknown;
|
|
26
27
|
}
|
|
27
28
|
export declare type EmbedRequestEvent = keyof EmbedRequestPayloadByEvent;
|
|
28
29
|
export interface EmbedResponsePayloadByEvent {
|
|
@@ -47,6 +48,7 @@ export interface EmbedResponsePayloadByEvent {
|
|
|
47
48
|
TOGGLE_RESPONSE: unknown;
|
|
48
49
|
TRACK_EVENT_RESPONSE: string;
|
|
49
50
|
TRIGGER_CAMPAIGN_RESPONSE: string;
|
|
51
|
+
CLOSE_CAMPAIGN_RESPONSE: unknown;
|
|
50
52
|
entry_INIT: unknown;
|
|
51
53
|
client_INIT: unknown;
|
|
52
54
|
button_INIT: unknown;
|
|
@@ -1,3 +1,21 @@
|
|
|
1
1
|
export declare type PartialRecord<K extends keyof any, T> = {
|
|
2
2
|
[P in K]?: T;
|
|
3
3
|
};
|
|
4
|
+
export declare type TriggerCondition = URLMatchTriggerCondition | DateTimeTriggerCondition;
|
|
5
|
+
export interface URLMatchTriggerCondition {
|
|
6
|
+
type: "url-match";
|
|
7
|
+
conditions_any: [
|
|
8
|
+
{
|
|
9
|
+
type: "ends-with" | "contains" | "equals" | "regex";
|
|
10
|
+
value: string;
|
|
11
|
+
}
|
|
12
|
+
];
|
|
13
|
+
}
|
|
14
|
+
export interface DateTimeTriggerCondition {
|
|
15
|
+
type: "datetime";
|
|
16
|
+
timezone: string;
|
|
17
|
+
condition: {
|
|
18
|
+
operator: "before-exclusive" | "after-inclusive";
|
|
19
|
+
datetime: string;
|
|
20
|
+
};
|
|
21
|
+
}
|
package/dist/npm-entry/index.js
CHANGED
|
@@ -570,7 +570,7 @@ var browserPerformanceTimeOrigin = (function () {
|
|
|
570
570
|
|
|
571
571
|
/***/ }),
|
|
572
572
|
|
|
573
|
-
/***/
|
|
573
|
+
/***/ 5265:
|
|
574
574
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
575
575
|
|
|
576
576
|
"use strict";
|
|
@@ -8788,7 +8788,7 @@ var client = new error_tracker_BrowserClient({
|
|
|
8788
8788
|
return event;
|
|
8789
8789
|
},
|
|
8790
8790
|
environment: "production",
|
|
8791
|
-
release: "1.0.
|
|
8791
|
+
release: "1.0.64-b369b05",
|
|
8792
8792
|
sampleRate: 0.25,
|
|
8793
8793
|
autoSessionTracking: false,
|
|
8794
8794
|
// Integrations don't seem to work with Sentry: https://github.com/getsentry/sentry-javascript/issues/2541
|
|
@@ -8925,7 +8925,9 @@ var TRACK_EVENT_RESPONSE = "TRACK_EVENT_RESPONSE";
|
|
|
8925
8925
|
var TRIGGER_CAMPAIGN = "TRIGGER_CAMPAIGN";
|
|
8926
8926
|
var TRIGGER_CAMPAIGN_RESPONSE = "TRIGGER_CAMPAIGN_RESPONSE";
|
|
8927
8927
|
var EVAL_CAMPAIGN_CONDITIONS = "EVAL_CAMPAIGN_CONDITIONS";
|
|
8928
|
-
var EVAL_CAMPAIGN_CONDITIONS_RESPONSE = "EVAL_CAMPAIGN_CONDITIONS_RESPONSE";
|
|
8928
|
+
var EVAL_CAMPAIGN_CONDITIONS_RESPONSE = "EVAL_CAMPAIGN_CONDITIONS_RESPONSE";
|
|
8929
|
+
var CLOSE_CAMPAIGN = "CLOSE_CAMPAIGN";
|
|
8930
|
+
var CLOSE_CAMPAIGN_RESPONSE = "CLOSE_CAMPAIGN_RESPONSE"; // Tells chat to send a greeting
|
|
8929
8931
|
|
|
8930
8932
|
var SEND_GREETING = "SEND_GREETING";
|
|
8931
8933
|
/**
|
|
@@ -9488,7 +9490,7 @@ function getEmbedURL(_ref) {
|
|
|
9488
9490
|
polyfillVersionString = "legacy";
|
|
9489
9491
|
}
|
|
9490
9492
|
|
|
9491
|
-
return concat_default()(_context5 = concat_default()(_context6 = concat_default()(_context7 = "".concat(host, "/embed/")).call(_context7, polyfillVersionString, "/")).call(_context6, frameName, "/")).call(_context5, "
|
|
9493
|
+
return concat_default()(_context5 = concat_default()(_context6 = concat_default()(_context7 = "".concat(host, "/embed/")).call(_context7, polyfillVersionString, "/")).call(_context6, frameName, "/")).call(_context5, "b369b05", "/index.html");
|
|
9492
9494
|
}
|
|
9493
9495
|
/**
|
|
9494
9496
|
* Generate the Chat / API URL
|
|
@@ -10201,7 +10203,38 @@ var ends_with_default = /*#__PURE__*/__webpack_require__.n(ends_with);
|
|
|
10201
10203
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime-corejs3/core-js-stable/instance/slice.js
|
|
10202
10204
|
var slice = __webpack_require__(3649);
|
|
10203
10205
|
var slice_default = /*#__PURE__*/__webpack_require__.n(slice);
|
|
10204
|
-
|
|
10206
|
+
// EXTERNAL MODULE: ./node_modules/@babel/runtime-corejs3/core-js-stable/instance/trim.js
|
|
10207
|
+
var trim = __webpack_require__(5843);
|
|
10208
|
+
var trim_default = /*#__PURE__*/__webpack_require__.n(trim);
|
|
10209
|
+
;// CONCATENATED MODULE: ./src/common/helpers/get-intro-for-url.ts
|
|
10210
|
+
|
|
10211
|
+
|
|
10212
|
+
function getProcessedPath(path) {
|
|
10213
|
+
var regex = /^http(s)?:\/\/(www.)?/;
|
|
10214
|
+
return trim_default()(path).call(path).replace(regex, "");
|
|
10215
|
+
}
|
|
10216
|
+
function getPathSearchRegex(path) {
|
|
10217
|
+
var params = path.split("?");
|
|
10218
|
+
|
|
10219
|
+
if (params.length > 1) {
|
|
10220
|
+
var _context;
|
|
10221
|
+
|
|
10222
|
+
var escapedParams = encodeURI(params[1]);
|
|
10223
|
+
return new RegExp(concat_default()(_context = "^".concat(params[0], "\\?")).call(_context, escapedParams, "$"));
|
|
10224
|
+
}
|
|
10225
|
+
|
|
10226
|
+
var newPath = path.replace("*", ".*");
|
|
10227
|
+
return new RegExp("^".concat(newPath, "$"));
|
|
10228
|
+
}
|
|
10229
|
+
function doesUrlMatchPath(url, path) {
|
|
10230
|
+
var processedUrl = getProcessedPath(url);
|
|
10231
|
+
var processedPath = getProcessedPath(path);
|
|
10232
|
+
var pathRegex = getPathSearchRegex(processedPath);
|
|
10233
|
+
var matches = pathRegex.exec(processedUrl);
|
|
10234
|
+
return matches !== null;
|
|
10235
|
+
}
|
|
10236
|
+
;// CONCATENATED MODULE: ./src/common/helpers/TriggerConditionEvaluator.ts
|
|
10237
|
+
|
|
10205
10238
|
|
|
10206
10239
|
|
|
10207
10240
|
|
|
@@ -10233,7 +10266,9 @@ var evalUrlMatchTriggerCondition = function evalUrlMatchTriggerCondition(trigger
|
|
|
10233
10266
|
return includes_default()(url).call(url, condition.value);
|
|
10234
10267
|
|
|
10235
10268
|
case "equals":
|
|
10236
|
-
|
|
10269
|
+
{
|
|
10270
|
+
return doesUrlMatchPath(urlWithoutQueryParams, condition.value);
|
|
10271
|
+
}
|
|
10237
10272
|
|
|
10238
10273
|
case "regex":
|
|
10239
10274
|
{
|
|
@@ -10247,11 +10282,29 @@ var evalUrlMatchTriggerCondition = function evalUrlMatchTriggerCondition(trigger
|
|
|
10247
10282
|
}
|
|
10248
10283
|
});
|
|
10249
10284
|
};
|
|
10285
|
+
var evalDatetimeTriggerCondition = function evalDatetimeTriggerCondition(triggerCondition, currentDateTime) {
|
|
10286
|
+
var conditionDatetime = new Date(triggerCondition.condition.datetime);
|
|
10287
|
+
|
|
10288
|
+
switch (triggerCondition.condition.operator) {
|
|
10289
|
+
case "before-exclusive":
|
|
10290
|
+
return currentDateTime < conditionDatetime;
|
|
10291
|
+
|
|
10292
|
+
case "after-inclusive":
|
|
10293
|
+
return currentDateTime >= conditionDatetime;
|
|
10294
|
+
// If an unknown comparator is found, ignore the trigger condition - do not block campaign
|
|
10295
|
+
|
|
10296
|
+
default:
|
|
10297
|
+
return true;
|
|
10298
|
+
}
|
|
10299
|
+
};
|
|
10250
10300
|
var evalTriggerCondition = function evalTriggerCondition(triggerCondition) {
|
|
10251
10301
|
switch (triggerCondition.type) {
|
|
10252
10302
|
case "url-match":
|
|
10253
10303
|
return evalUrlMatchTriggerCondition(triggerCondition, window.location.href);
|
|
10254
|
-
|
|
10304
|
+
|
|
10305
|
+
case "datetime":
|
|
10306
|
+
return evalDatetimeTriggerCondition(triggerCondition, new Date());
|
|
10307
|
+
// If an unknown trigger type is found, ignore the trigger condition - do not block campaign
|
|
10255
10308
|
|
|
10256
10309
|
default:
|
|
10257
10310
|
return true;
|
|
@@ -10346,113 +10399,6 @@ var get_browser_language_getBrowserLanguage = function getBrowserLanguage() {
|
|
|
10346
10399
|
;// CONCATENATED MODULE: ./src/services/helpers.ts
|
|
10347
10400
|
var NO_OP_FUNCTION = function NO_OP_FUNCTION() {// Do nothing
|
|
10348
10401
|
};
|
|
10349
|
-
// EXTERNAL MODULE: ./node_modules/@babel/runtime-corejs3/core-js-stable/instance/trim.js
|
|
10350
|
-
var trim = __webpack_require__(5843);
|
|
10351
|
-
var trim_default = /*#__PURE__*/__webpack_require__.n(trim);
|
|
10352
|
-
;// CONCATENATED MODULE: ./src/common/helpers/get-intro-for-url.ts
|
|
10353
|
-
|
|
10354
|
-
|
|
10355
|
-
function getProcessedPath(path) {
|
|
10356
|
-
var regex = /^http(s)?:\/\/(www.)?/;
|
|
10357
|
-
return trim_default()(path).call(path).replace(regex, "");
|
|
10358
|
-
}
|
|
10359
|
-
function getPathSearchRegex(path) {
|
|
10360
|
-
var params = path.split("?");
|
|
10361
|
-
|
|
10362
|
-
if (params.length > 1) {
|
|
10363
|
-
var _context;
|
|
10364
|
-
|
|
10365
|
-
var escapedParams = encodeURI(params[1]);
|
|
10366
|
-
return new RegExp(concat_default()(_context = "^".concat(params[0], "\\?")).call(_context, escapedParams, "$"));
|
|
10367
|
-
}
|
|
10368
|
-
|
|
10369
|
-
var newPath = path.replace("*", ".*");
|
|
10370
|
-
return new RegExp("^".concat(newPath, "$"));
|
|
10371
|
-
}
|
|
10372
|
-
function doesUrlMatchPath(url, path) {
|
|
10373
|
-
var processedUrl = getProcessedPath(url);
|
|
10374
|
-
var processedPath = getProcessedPath(path);
|
|
10375
|
-
var pathRegex = getPathSearchRegex(processedPath);
|
|
10376
|
-
var matches = pathRegex.exec(processedUrl);
|
|
10377
|
-
return matches !== null;
|
|
10378
|
-
}
|
|
10379
|
-
;// CONCATENATED MODULE: ./src/campaigns/TriggerConditionEvaluator.ts
|
|
10380
|
-
|
|
10381
|
-
|
|
10382
|
-
|
|
10383
|
-
|
|
10384
|
-
|
|
10385
|
-
var TriggerConditionEvaluator_stripTrailingSlash = function stripTrailingSlash(url) {
|
|
10386
|
-
return ends_with_default()(url).call(url, "/") ? slice_default()(url).call(url, 0, -1) : url;
|
|
10387
|
-
};
|
|
10388
|
-
|
|
10389
|
-
var TriggerConditionEvaluator_evalUrlMatchTriggerCondition = function evalUrlMatchTriggerCondition(triggerCondition, url) {
|
|
10390
|
-
/**
|
|
10391
|
-
* Behaviour
|
|
10392
|
-
* regex Regex match (as per javascript string .match) over the whole string including
|
|
10393
|
-
* query params
|
|
10394
|
-
* ends-with Match only the URL without query params. Match including trailing slashes
|
|
10395
|
-
* contains Match substring including query params
|
|
10396
|
-
* equals Matches the exact URL, without query params
|
|
10397
|
-
*/
|
|
10398
|
-
var urlWithoutQueryParams = url.split("?")[0];
|
|
10399
|
-
return triggerCondition.conditions_any.some(function (condition) {
|
|
10400
|
-
switch (condition.type) {
|
|
10401
|
-
case "ends-with":
|
|
10402
|
-
{
|
|
10403
|
-
var _context;
|
|
10404
|
-
|
|
10405
|
-
return ends_with_default()(urlWithoutQueryParams).call(urlWithoutQueryParams, condition.value) || ends_with_default()(_context = TriggerConditionEvaluator_stripTrailingSlash(urlWithoutQueryParams)).call(_context, condition.value);
|
|
10406
|
-
}
|
|
10407
|
-
|
|
10408
|
-
case "contains":
|
|
10409
|
-
return includes_default()(url).call(url, condition.value);
|
|
10410
|
-
|
|
10411
|
-
case "equals":
|
|
10412
|
-
{
|
|
10413
|
-
return doesUrlMatchPath(urlWithoutQueryParams, condition.value);
|
|
10414
|
-
}
|
|
10415
|
-
|
|
10416
|
-
case "regex":
|
|
10417
|
-
{
|
|
10418
|
-
var rx = new RegExp(condition.value);
|
|
10419
|
-
return Boolean(rx.exec(url));
|
|
10420
|
-
}
|
|
10421
|
-
// If an unknown URL match type is found, ignore it - one of the others will have to match
|
|
10422
|
-
|
|
10423
|
-
default:
|
|
10424
|
-
return false;
|
|
10425
|
-
}
|
|
10426
|
-
});
|
|
10427
|
-
};
|
|
10428
|
-
var evalDatetimeTriggerCondition = function evalDatetimeTriggerCondition(triggerCondition, currentDateTime) {
|
|
10429
|
-
var conditionDatetime = new Date(triggerCondition.condition.datetime);
|
|
10430
|
-
|
|
10431
|
-
switch (triggerCondition.condition.operator) {
|
|
10432
|
-
case "before-exclusive":
|
|
10433
|
-
return currentDateTime < conditionDatetime;
|
|
10434
|
-
|
|
10435
|
-
case "after-inclusive":
|
|
10436
|
-
return currentDateTime >= conditionDatetime;
|
|
10437
|
-
// If an unknown comparator is found, ignore the trigger condition - do not block campaign
|
|
10438
|
-
|
|
10439
|
-
default:
|
|
10440
|
-
return true;
|
|
10441
|
-
}
|
|
10442
|
-
};
|
|
10443
|
-
var TriggerConditionEvaluator_evalTriggerCondition = function evalTriggerCondition(triggerCondition) {
|
|
10444
|
-
switch (triggerCondition.type) {
|
|
10445
|
-
case "url-match":
|
|
10446
|
-
return TriggerConditionEvaluator_evalUrlMatchTriggerCondition(triggerCondition, window.location.href);
|
|
10447
|
-
|
|
10448
|
-
case "datetime":
|
|
10449
|
-
return evalDatetimeTriggerCondition(triggerCondition, new Date());
|
|
10450
|
-
// If an unknown trigger type is found, ignore the trigger condition - do not block campaign
|
|
10451
|
-
|
|
10452
|
-
default:
|
|
10453
|
-
return true;
|
|
10454
|
-
}
|
|
10455
|
-
};
|
|
10456
10402
|
;// CONCATENATED MODULE: ./src/campaigns/campaign.ts
|
|
10457
10403
|
|
|
10458
10404
|
|
|
@@ -10627,7 +10573,7 @@ var getCampaignToTrigger = function getCampaignToTrigger(adaSettings, marketingC
|
|
|
10627
10573
|
}
|
|
10628
10574
|
|
|
10629
10575
|
var conditionsMet = campaign.trigger_conditions.every(function (tc) {
|
|
10630
|
-
return
|
|
10576
|
+
return evalTriggerCondition(tc);
|
|
10631
10577
|
});
|
|
10632
10578
|
var doesPassFrequencyCheck = ignoreFrequency || !campaignShownWithinFrequency(campaign, handle);
|
|
10633
10579
|
return conditionsMet && doesPassFrequencyCheck;
|
|
@@ -11030,7 +10976,7 @@ var isRTLLanguage = function isRTLLanguage(language) {
|
|
|
11030
10976
|
};
|
|
11031
10977
|
var isRTL = function isRTL(client, language) {
|
|
11032
10978
|
var rtlLanguageBool = isRTLLanguage(language) || isRTLLanguage(getBrowserLanguage());
|
|
11033
|
-
var featureFlagsBool = (client === null || client === void 0 ? void 0 : client.features.chat_ui_v2) &&
|
|
10979
|
+
var featureFlagsBool = (client === null || client === void 0 ? void 0 : client.features.chat_ui_v2) && client.features.translations;
|
|
11034
10980
|
return featureFlagsBool && rtlLanguageBool || false;
|
|
11035
10981
|
};
|
|
11036
10982
|
;// CONCATENATED MODULE: ./src/common/helpers/getAlignment.ts
|
|
@@ -12900,7 +12846,7 @@ var Container = /*#__PURE__*/function (_Component) {
|
|
|
12900
12846
|
// that a user might engage with another campaign on another page path
|
|
12901
12847
|
|
|
12902
12848
|
|
|
12903
|
-
if (
|
|
12849
|
+
if (wasCampaignShownButNowClosed) {
|
|
12904
12850
|
setState({
|
|
12905
12851
|
wasCampaignShownButNowClosed: false
|
|
12906
12852
|
});
|
|
@@ -13074,7 +13020,8 @@ var Container = /*#__PURE__*/function (_Component) {
|
|
|
13074
13020
|
|
|
13075
13021
|
setState({
|
|
13076
13022
|
latestCampaignKey: campaignKey,
|
|
13077
|
-
hasChatOpenedAfterProactiveMessagesShown: false
|
|
13023
|
+
hasChatOpenedAfterProactiveMessagesShown: false,
|
|
13024
|
+
wasCampaignShownButNowClosed: false
|
|
13078
13025
|
});
|
|
13079
13026
|
this.setState({
|
|
13080
13027
|
// Only need to load chat for engage campaigns, not free tier (message_text) campaigns
|
|
@@ -13118,7 +13065,7 @@ var Container = /*#__PURE__*/function (_Component) {
|
|
|
13118
13065
|
var _handleEmbedAction = (0,asyncToGenerator/* default */.Z)( /*#__PURE__*/regenerator_default().mark(function _callee2(type, payload, id) {
|
|
13119
13066
|
var _this5 = this;
|
|
13120
13067
|
|
|
13121
|
-
var _this$props9, client, messageService, adaSettings, parentElement, localChannel, xStorageChannel, toggleChat, _this$props10, isDrawerOpen, drawerHasBeenOpened, chatterToken, contentToReturn, _this$props11, metaFields, setState, metaData, newMetaFields, _this$props12, sensitiveMetaFields, _setState, _ref, greeting, language, _newMetaFields, _sensitiveMetaFields, _ref$resetChatHistory, resetChatHistory, _setState2, chatHasBeenRendered, newState, _setState3, _ref2, body, duration, EXTRA_PROACTIVE_DELAY;
|
|
13068
|
+
var _this$props9, client, messageService, adaSettings, parentElement, localChannel, xStorageChannel, chatChannel, toggleChat, _this$props10, isDrawerOpen, drawerHasBeenOpened, chatterToken, contentToReturn, _this$props11, metaFields, setState, metaData, newMetaFields, _this$props12, sensitiveMetaFields, _setState, _ref, greeting, language, _newMetaFields, _sensitiveMetaFields, _ref$resetChatHistory, resetChatHistory, _setState2, chatHasBeenRendered, newState, _setState3, _ref2, body, duration, EXTRA_PROACTIVE_DELAY;
|
|
13122
13069
|
|
|
13123
13070
|
return regenerator_default().wrap(function _callee2$(_context3) {
|
|
13124
13071
|
while (1) {
|
|
@@ -13128,68 +13075,69 @@ var Container = /*#__PURE__*/function (_Component) {
|
|
|
13128
13075
|
parentElement = adaSettings.parentElement;
|
|
13129
13076
|
localChannel = messageService.getChannel("local");
|
|
13130
13077
|
xStorageChannel = messageService.getChannel(XSTORAGE_IFRAME);
|
|
13078
|
+
chatChannel = messageService.getChannel(CHAT_IFRAME);
|
|
13131
13079
|
|
|
13132
13080
|
if (localChannel) {
|
|
13133
|
-
_context3.next =
|
|
13081
|
+
_context3.next = 7;
|
|
13134
13082
|
break;
|
|
13135
13083
|
}
|
|
13136
13084
|
|
|
13137
13085
|
throw new errors/* AdaEmbedError */.S("`localChannel` is null");
|
|
13138
13086
|
|
|
13139
|
-
case
|
|
13087
|
+
case 7:
|
|
13140
13088
|
_context3.t0 = type;
|
|
13141
|
-
_context3.next = _context3.t0 === TRACK_EVENT ?
|
|
13089
|
+
_context3.next = _context3.t0 === TRACK_EVENT ? 10 : _context3.t0 === TRIGGER_CAMPAIGN ? 15 : _context3.t0 === EVAL_CAMPAIGN_CONDITIONS ? 20 : _context3.t0 === TOGGLE ? 25 : _context3.t0 === GET_INFO ? 30 : _context3.t0 === SET_META_FIELDS ? 34 : _context3.t0 === "SET_SENSITIVE_META_FIELDS" ? 41 : _context3.t0 === STOP ? 46 : _context3.t0 === RESET ? 49 : _context3.t0 === DELETE_HISTORY ? 67 : _context3.t0 === CREATE_PROACTIVE ? 79 : _context3.t0 === CLOSE_CAMPAIGN ? 88 : 91;
|
|
13142
13090
|
break;
|
|
13143
13091
|
|
|
13144
|
-
case
|
|
13092
|
+
case 10:
|
|
13145
13093
|
if (client.features.afm_business_events) {
|
|
13146
|
-
_context3.next =
|
|
13094
|
+
_context3.next = 13;
|
|
13147
13095
|
break;
|
|
13148
13096
|
}
|
|
13149
13097
|
|
|
13150
13098
|
localChannel.postMessage(TRACK_EVENT_RESPONSE, "Ada Embed - business events not available in your feature set.", id, FetchEventStatus.Failure);
|
|
13151
13099
|
return _context3.abrupt("return");
|
|
13152
13100
|
|
|
13153
|
-
case
|
|
13101
|
+
case 13:
|
|
13154
13102
|
this.trackEvent(payload);
|
|
13155
|
-
return _context3.abrupt("break",
|
|
13103
|
+
return _context3.abrupt("break", 91);
|
|
13156
13104
|
|
|
13157
|
-
case
|
|
13105
|
+
case 15:
|
|
13158
13106
|
if (client.features.afm_proactive_messaging) {
|
|
13159
|
-
_context3.next =
|
|
13107
|
+
_context3.next = 18;
|
|
13160
13108
|
break;
|
|
13161
13109
|
}
|
|
13162
13110
|
|
|
13163
13111
|
localChannel.postMessage(TRIGGER_CAMPAIGN_RESPONSE, "Ada Embed - proactive campaigns not available in your feature set.", id, FetchEventStatus.Failure);
|
|
13164
13112
|
return _context3.abrupt("return");
|
|
13165
13113
|
|
|
13166
|
-
case
|
|
13114
|
+
case 18:
|
|
13167
13115
|
this.triggerCampaign(payload);
|
|
13168
|
-
return _context3.abrupt("break",
|
|
13116
|
+
return _context3.abrupt("break", 91);
|
|
13169
13117
|
|
|
13170
|
-
case
|
|
13118
|
+
case 20:
|
|
13171
13119
|
if (client.features.afm_proactive_messaging) {
|
|
13172
|
-
_context3.next =
|
|
13120
|
+
_context3.next = 23;
|
|
13173
13121
|
break;
|
|
13174
13122
|
}
|
|
13175
13123
|
|
|
13176
13124
|
localChannel.postMessage(TRIGGER_CAMPAIGN_RESPONSE, "Ada Embed - proactive campaigns not available in your feature set.", id, FetchEventStatus.Failure);
|
|
13177
13125
|
return _context3.abrupt("return");
|
|
13178
13126
|
|
|
13179
|
-
case
|
|
13127
|
+
case 23:
|
|
13180
13128
|
this.evaluateCampaignConditions(payload);
|
|
13181
|
-
return _context3.abrupt("break",
|
|
13129
|
+
return _context3.abrupt("break", 91);
|
|
13182
13130
|
|
|
13183
|
-
case
|
|
13131
|
+
case 25:
|
|
13184
13132
|
toggleChat = this.props.toggleChat;
|
|
13185
|
-
_context3.next =
|
|
13133
|
+
_context3.next = 28;
|
|
13186
13134
|
return toggleChat();
|
|
13187
13135
|
|
|
13188
|
-
case
|
|
13136
|
+
case 28:
|
|
13189
13137
|
localChannel.postMessage(TOGGLE_RESPONSE, null, id);
|
|
13190
|
-
return _context3.abrupt("break",
|
|
13138
|
+
return _context3.abrupt("break", 91);
|
|
13191
13139
|
|
|
13192
|
-
case
|
|
13140
|
+
case 30:
|
|
13193
13141
|
_this$props10 = this.props, isDrawerOpen = _this$props10.isDrawerOpen, drawerHasBeenOpened = _this$props10.drawerHasBeenOpened, chatterToken = _this$props10.chatterToken;
|
|
13194
13142
|
contentToReturn = {
|
|
13195
13143
|
isDrawerOpen: isDrawerOpen,
|
|
@@ -13198,38 +13146,38 @@ var Container = /*#__PURE__*/function (_Component) {
|
|
|
13198
13146
|
hasClosedChat: drawerHasBeenOpened && !isDrawerOpen
|
|
13199
13147
|
};
|
|
13200
13148
|
localChannel.postMessage(GET_INFO_RESPONSE, contentToReturn, id);
|
|
13201
|
-
return _context3.abrupt("break",
|
|
13149
|
+
return _context3.abrupt("break", 91);
|
|
13202
13150
|
|
|
13203
|
-
case
|
|
13151
|
+
case 34:
|
|
13204
13152
|
_this$props11 = this.props, metaFields = _this$props11.metaFields, setState = _this$props11.setState;
|
|
13205
13153
|
metaData = payload;
|
|
13206
13154
|
newMetaFields = Container_objectSpread(Container_objectSpread({}, metaFields), metaData);
|
|
13207
|
-
_context3.next =
|
|
13155
|
+
_context3.next = 39;
|
|
13208
13156
|
return setState({
|
|
13209
13157
|
metaFields: newMetaFields
|
|
13210
13158
|
});
|
|
13211
13159
|
|
|
13212
|
-
case
|
|
13160
|
+
case 39:
|
|
13213
13161
|
localChannel.postMessage(SET_META_FIELDS_RESPONSE, null, id);
|
|
13214
|
-
return _context3.abrupt("break",
|
|
13162
|
+
return _context3.abrupt("break", 91);
|
|
13215
13163
|
|
|
13216
|
-
case
|
|
13164
|
+
case 41:
|
|
13217
13165
|
_this$props12 = this.props, sensitiveMetaFields = _this$props12.sensitiveMetaFields, _setState = _this$props12.setState;
|
|
13218
|
-
_context3.next =
|
|
13166
|
+
_context3.next = 44;
|
|
13219
13167
|
return _setState({
|
|
13220
13168
|
sensitiveMetaFields: Container_objectSpread(Container_objectSpread({}, sensitiveMetaFields), payload)
|
|
13221
13169
|
});
|
|
13222
13170
|
|
|
13223
|
-
case
|
|
13171
|
+
case 44:
|
|
13224
13172
|
localChannel.postMessage("SET_SENSITIVE_META_FIELDS_RESPONSE", null, id);
|
|
13225
|
-
return _context3.abrupt("break",
|
|
13173
|
+
return _context3.abrupt("break", 91);
|
|
13226
13174
|
|
|
13227
|
-
case
|
|
13175
|
+
case 46:
|
|
13228
13176
|
localChannel.postMessage(STOP_RESPONSE, null, id);
|
|
13229
13177
|
this.unmount();
|
|
13230
|
-
return _context3.abrupt("break",
|
|
13178
|
+
return _context3.abrupt("break", 91);
|
|
13231
13179
|
|
|
13232
|
-
case
|
|
13180
|
+
case 49:
|
|
13233
13181
|
_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;
|
|
13234
13182
|
_setState2 = this.props.setState;
|
|
13235
13183
|
chatHasBeenRendered = this.state.chatHasBeenRendered;
|
|
@@ -13241,18 +13189,18 @@ var Container = /*#__PURE__*/function (_Component) {
|
|
|
13241
13189
|
};
|
|
13242
13190
|
|
|
13243
13191
|
if (!resetChatHistory) {
|
|
13244
|
-
_context3.next =
|
|
13192
|
+
_context3.next = 62;
|
|
13245
13193
|
break;
|
|
13246
13194
|
}
|
|
13247
13195
|
|
|
13248
13196
|
if (xStorageChannel) {
|
|
13249
|
-
_context3.next =
|
|
13197
|
+
_context3.next = 56;
|
|
13250
13198
|
break;
|
|
13251
13199
|
}
|
|
13252
13200
|
|
|
13253
13201
|
throw new errors/* AdaEmbedError */.S("`xStorageChannel` is null");
|
|
13254
13202
|
|
|
13255
|
-
case
|
|
13203
|
+
case 56:
|
|
13256
13204
|
xStorageChannel.postMessage(DELETE_HISTORY_EVENT); // Clear chatter data from local storage
|
|
13257
13205
|
|
|
13258
13206
|
safeLocalStorage.removeItem(CHATTER_TOKEN_STORAGE_KEY);
|
|
@@ -13265,11 +13213,11 @@ var Container = /*#__PURE__*/function (_Component) {
|
|
|
13265
13213
|
chatterCreated: null
|
|
13266
13214
|
});
|
|
13267
13215
|
|
|
13268
|
-
case
|
|
13269
|
-
_context3.next =
|
|
13216
|
+
case 62:
|
|
13217
|
+
_context3.next = 64;
|
|
13270
13218
|
return _setState2(newState);
|
|
13271
13219
|
|
|
13272
|
-
case
|
|
13220
|
+
case 64:
|
|
13273
13221
|
if (chatHasBeenRendered) {
|
|
13274
13222
|
this.setState({
|
|
13275
13223
|
hideChatOverride: true
|
|
@@ -13281,48 +13229,48 @@ var Container = /*#__PURE__*/function (_Component) {
|
|
|
13281
13229
|
}
|
|
13282
13230
|
|
|
13283
13231
|
localChannel.postMessage(RESET_RESPONSE, null, id);
|
|
13284
|
-
return _context3.abrupt("break",
|
|
13232
|
+
return _context3.abrupt("break", 91);
|
|
13285
13233
|
|
|
13286
|
-
case
|
|
13234
|
+
case 67:
|
|
13287
13235
|
_setState3 = this.props.setState;
|
|
13288
13236
|
|
|
13289
13237
|
if (xStorageChannel) {
|
|
13290
|
-
_context3.next =
|
|
13238
|
+
_context3.next = 70;
|
|
13291
13239
|
break;
|
|
13292
13240
|
}
|
|
13293
13241
|
|
|
13294
13242
|
throw new errors/* AdaEmbedError */.S("`xStorageChannel` is null");
|
|
13295
13243
|
|
|
13296
|
-
case
|
|
13244
|
+
case 70:
|
|
13297
13245
|
// Clear chatter data from local storage
|
|
13298
13246
|
safeLocalStorage.removeItem(CHATTER_TOKEN_STORAGE_KEY);
|
|
13299
13247
|
safeSessionStorage.removeItem(CHATTER_TOKEN_STORAGE_KEY);
|
|
13300
13248
|
safeLocalStorage.removeItem(CHATTER_CREATED_STORAGE_KEY);
|
|
13301
13249
|
safeSessionStorage.removeItem(CHATTER_CREATED_STORAGE_KEY); // And from state
|
|
13302
13250
|
|
|
13303
|
-
_context3.next =
|
|
13251
|
+
_context3.next = 76;
|
|
13304
13252
|
return _setState3({
|
|
13305
13253
|
chatterToken: null,
|
|
13306
13254
|
chatterCreated: null
|
|
13307
13255
|
});
|
|
13308
13256
|
|
|
13309
|
-
case
|
|
13257
|
+
case 76:
|
|
13310
13258
|
xStorageChannel.postMessage(DELETE_HISTORY_EVENT);
|
|
13311
13259
|
localChannel.postMessage(DELETE_HISTORY_RESPONSE, null, id);
|
|
13312
|
-
return _context3.abrupt("break",
|
|
13260
|
+
return _context3.abrupt("break", 91);
|
|
13313
13261
|
|
|
13314
|
-
case
|
|
13262
|
+
case 79:
|
|
13315
13263
|
_ref2 = payload, body = _ref2.body, duration = _ref2.duration;
|
|
13316
13264
|
EXTRA_PROACTIVE_DELAY = 1000;
|
|
13317
13265
|
|
|
13318
13266
|
if (client) {
|
|
13319
|
-
_context3.next =
|
|
13267
|
+
_context3.next = 83;
|
|
13320
13268
|
break;
|
|
13321
13269
|
}
|
|
13322
13270
|
|
|
13323
13271
|
throw new errors/* AdaEmbedError */.S("`client` is not defined");
|
|
13324
13272
|
|
|
13325
|
-
case
|
|
13273
|
+
case 83:
|
|
13326
13274
|
// Do not feature flag gate this behind the developer_proactive flag
|
|
13327
13275
|
// It's also used for free-tier campaigns, which are available to all clients
|
|
13328
13276
|
this.setState({
|
|
@@ -13362,14 +13310,22 @@ var Container = /*#__PURE__*/function (_Component) {
|
|
|
13362
13310
|
}
|
|
13363
13311
|
}, _callee);
|
|
13364
13312
|
})));
|
|
13365
|
-
_context3.next =
|
|
13313
|
+
_context3.next = 86;
|
|
13366
13314
|
return wait(duration * 1000 + EXTRA_PROACTIVE_DELAY);
|
|
13367
13315
|
|
|
13368
|
-
case
|
|
13316
|
+
case 86:
|
|
13369
13317
|
localChannel.postMessage(CREATE_PROACTIVE_RESPONSE, null, id);
|
|
13370
|
-
return _context3.abrupt("break",
|
|
13318
|
+
return _context3.abrupt("break", 91);
|
|
13371
13319
|
|
|
13372
|
-
case
|
|
13320
|
+
case 88:
|
|
13321
|
+
if (chatChannel) {
|
|
13322
|
+
chatChannel.postMessage(CLOSE_CAMPAIGN);
|
|
13323
|
+
}
|
|
13324
|
+
|
|
13325
|
+
localChannel.postMessage(CLOSE_CAMPAIGN_RESPONSE, null, id);
|
|
13326
|
+
return _context3.abrupt("break", 91);
|
|
13327
|
+
|
|
13328
|
+
case 91:
|
|
13373
13329
|
case "end":
|
|
13374
13330
|
return _context3.stop();
|
|
13375
13331
|
}
|
|
@@ -14343,6 +14299,35 @@ var Embed = /*#__PURE__*/function () {
|
|
|
14343
14299
|
value: function unsubscribeEvent(id) {
|
|
14344
14300
|
event_subscriptions_unsubscribeEvent(id);
|
|
14345
14301
|
}
|
|
14302
|
+
}, {
|
|
14303
|
+
key: "closeCampaign",
|
|
14304
|
+
value: function () {
|
|
14305
|
+
var _closeCampaign = (0,asyncToGenerator/* default */.Z)( /*#__PURE__*/regenerator_default().mark(function _callee13() {
|
|
14306
|
+
return regenerator_default().wrap(function _callee13$(_context13) {
|
|
14307
|
+
while (1) {
|
|
14308
|
+
switch (_context13.prev = _context13.next) {
|
|
14309
|
+
case 0:
|
|
14310
|
+
_context13.next = 2;
|
|
14311
|
+
return this.initialized;
|
|
14312
|
+
|
|
14313
|
+
case 2:
|
|
14314
|
+
_context13.next = 4;
|
|
14315
|
+
return this.localChannel.fetch(CLOSE_CAMPAIGN, CLOSE_CAMPAIGN_RESPONSE);
|
|
14316
|
+
|
|
14317
|
+
case 4:
|
|
14318
|
+
case "end":
|
|
14319
|
+
return _context13.stop();
|
|
14320
|
+
}
|
|
14321
|
+
}
|
|
14322
|
+
}, _callee13, this);
|
|
14323
|
+
}));
|
|
14324
|
+
|
|
14325
|
+
function closeCampaign() {
|
|
14326
|
+
return _closeCampaign.apply(this, arguments);
|
|
14327
|
+
}
|
|
14328
|
+
|
|
14329
|
+
return closeCampaign;
|
|
14330
|
+
}()
|
|
14346
14331
|
}]);
|
|
14347
14332
|
|
|
14348
14333
|
return Embed;
|
|
@@ -14368,7 +14353,7 @@ window.__AdaEmbedConstructor = Embed;
|
|
|
14368
14353
|
/* harmony export */ });
|
|
14369
14354
|
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)\\/(97|(9[8-9]|\\d{3,}))\\.\\d+(?:\\.\\d+)?)|(Version\\/(15|(1[6-9]|[2-9]\\d|\\d{3,}))\\.\\d+(?:\\.\\d+)? Safari\\/)|(Firefox\\/(96|(9[7-9]|\\d{3,}))\\.\\d+\\.\\d+)|(Firefox\\/(96|(9[7-9]|\\d{3,}))\\.\\d+(pre|[ab]\\d+[a-z]*)?)").test(navigator.userAgent);
|
|
14370
14355
|
var isProduction = "production" === "production";
|
|
14371
|
-
var embed2Version = "
|
|
14356
|
+
var embed2Version = "b369b05";
|
|
14372
14357
|
|
|
14373
14358
|
/***/ }),
|
|
14374
14359
|
|
|
@@ -14714,9 +14699,9 @@ function _log() {
|
|
|
14714
14699
|
service: "embed",
|
|
14715
14700
|
env: "production",
|
|
14716
14701
|
embedVersion: 2,
|
|
14717
|
-
version: "1.0.
|
|
14702
|
+
version: "1.0.64",
|
|
14718
14703
|
isNpm: true,
|
|
14719
|
-
commitHash: "
|
|
14704
|
+
commitHash: "b369b05"
|
|
14720
14705
|
}))
|
|
14721
14706
|
});
|
|
14722
14707
|
|
|
@@ -25639,12 +25624,12 @@ function loadEmbed(_x) {
|
|
|
25639
25624
|
|
|
25640
25625
|
|
|
25641
25626
|
function _loadEmbed() {
|
|
25642
|
-
_loadEmbed = (0,asyncToGenerator/* default */.Z)( /*#__PURE__*/regenerator_default().mark(function
|
|
25643
|
-
var embedScriptSource,
|
|
25627
|
+
_loadEmbed = (0,asyncToGenerator/* default */.Z)( /*#__PURE__*/regenerator_default().mark(function _callee17(adaSettings) {
|
|
25628
|
+
var embedScriptSource, _context17, _context18, polyfillVersionString, host, clientScriptExists;
|
|
25644
25629
|
|
|
25645
|
-
return regenerator_default().wrap(function
|
|
25630
|
+
return regenerator_default().wrap(function _callee17$(_context19) {
|
|
25646
25631
|
while (1) {
|
|
25647
|
-
switch (
|
|
25632
|
+
switch (_context19.prev = _context19.next) {
|
|
25648
25633
|
case 0:
|
|
25649
25634
|
if (adaSettings.customDomains) {
|
|
25650
25635
|
embedScriptSource = config_info/* isModern */.pX ? adaSettings.customDomains.embedModern : adaSettings.customDomains.embedLegacy;
|
|
@@ -25657,7 +25642,7 @@ function _loadEmbed() {
|
|
|
25657
25642
|
polyfillVersionString = "legacy";
|
|
25658
25643
|
}
|
|
25659
25644
|
|
|
25660
|
-
embedScriptSource = concat_default()(
|
|
25645
|
+
embedScriptSource = concat_default()(_context17 = concat_default()(_context18 = "".concat(host, "/embed/")).call(_context18, polyfillVersionString, "/client/")).call(_context17, "b369b05", "/index.js");
|
|
25661
25646
|
}
|
|
25662
25647
|
|
|
25663
25648
|
clientScriptExists = Boolean( true || // The client script is bundled with npm module
|
|
@@ -25667,23 +25652,23 @@ function _loadEmbed() {
|
|
|
25667
25652
|
*/
|
|
25668
25653
|
|
|
25669
25654
|
if (clientScriptExists) {
|
|
25670
|
-
|
|
25655
|
+
_context19.next = 11;
|
|
25671
25656
|
break;
|
|
25672
25657
|
}
|
|
25673
25658
|
|
|
25674
|
-
|
|
25675
|
-
|
|
25659
|
+
_context19.prev = 3;
|
|
25660
|
+
_context19.next = 6;
|
|
25676
25661
|
return loadScript({
|
|
25677
25662
|
src: embedScriptSource
|
|
25678
25663
|
});
|
|
25679
25664
|
|
|
25680
25665
|
case 6:
|
|
25681
|
-
|
|
25666
|
+
_context19.next = 11;
|
|
25682
25667
|
break;
|
|
25683
25668
|
|
|
25684
25669
|
case 8:
|
|
25685
|
-
|
|
25686
|
-
|
|
25670
|
+
_context19.prev = 8;
|
|
25671
|
+
_context19.t0 = _context19["catch"](3);
|
|
25687
25672
|
console.warn("There was an issue creating the embed client script.");
|
|
25688
25673
|
|
|
25689
25674
|
case 11:
|
|
@@ -25693,10 +25678,10 @@ function _loadEmbed() {
|
|
|
25693
25678
|
|
|
25694
25679
|
case 12:
|
|
25695
25680
|
case "end":
|
|
25696
|
-
return
|
|
25681
|
+
return _context19.stop();
|
|
25697
25682
|
}
|
|
25698
25683
|
}
|
|
25699
|
-
},
|
|
25684
|
+
}, _callee17, null, [[3, 8]]);
|
|
25700
25685
|
}));
|
|
25701
25686
|
return _loadEmbed.apply(this, arguments);
|
|
25702
25687
|
}
|
|
@@ -26190,12 +26175,40 @@ function createEmbedObject() {
|
|
|
26190
26175
|
}
|
|
26191
26176
|
|
|
26192
26177
|
return unsubscribeEvent;
|
|
26178
|
+
}(),
|
|
26179
|
+
closeCampaign: function () {
|
|
26180
|
+
var _closeCampaign = (0,asyncToGenerator/* default */.Z)( /*#__PURE__*/regenerator_default().mark(function _callee16() {
|
|
26181
|
+
var _embed12;
|
|
26182
|
+
|
|
26183
|
+
return regenerator_default().wrap(function _callee16$(_context16) {
|
|
26184
|
+
while (1) {
|
|
26185
|
+
switch (_context16.prev = _context16.next) {
|
|
26186
|
+
case 0:
|
|
26187
|
+
_context16.next = 2;
|
|
26188
|
+
return waitForEmbedInit();
|
|
26189
|
+
|
|
26190
|
+
case 2:
|
|
26191
|
+
return _context16.abrupt("return", (_embed12 = embed) === null || _embed12 === void 0 ? void 0 : _embed12.closeCampaign());
|
|
26192
|
+
|
|
26193
|
+
case 3:
|
|
26194
|
+
case "end":
|
|
26195
|
+
return _context16.stop();
|
|
26196
|
+
}
|
|
26197
|
+
}
|
|
26198
|
+
}, _callee16);
|
|
26199
|
+
}));
|
|
26200
|
+
|
|
26201
|
+
function closeCampaign() {
|
|
26202
|
+
return _closeCampaign.apply(this, arguments);
|
|
26203
|
+
}
|
|
26204
|
+
|
|
26205
|
+
return closeCampaign;
|
|
26193
26206
|
}()
|
|
26194
26207
|
});
|
|
26195
26208
|
}
|
|
26196
26209
|
;// CONCATENATED MODULE: ./src/index-npm.ts
|
|
26197
26210
|
|
|
26198
|
-
Promise.resolve(/* import() eager */).then(__webpack_require__.bind(__webpack_require__,
|
|
26211
|
+
Promise.resolve(/* import() eager */).then(__webpack_require__.bind(__webpack_require__, 5265));
|
|
26199
26212
|
/* harmony default export */ var index_npm = (createEmbedObject());
|
|
26200
26213
|
}();
|
|
26201
26214
|
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.64",
|
|
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 74",
|
|
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",
|
|
@@ -74,6 +74,7 @@
|
|
|
74
74
|
"eslint-plugin-chai-friendly": "^0.7.2",
|
|
75
75
|
"eslint-plugin-compat": "^3.13.0",
|
|
76
76
|
"eslint-plugin-cypress": "^2.11.3",
|
|
77
|
+
"eslint-plugin-sonarjs": "^0.11.0",
|
|
77
78
|
"husky": "^7.0.0",
|
|
78
79
|
"jest": "^27.3.1",
|
|
79
80
|
"jest-localstorage-mock": "^2.4.0",
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { TriggerCondition, URLMatchTriggerCondition } from "./types";
|
|
2
|
-
export declare const evalUrlMatchTriggerCondition: (triggerCondition: URLMatchTriggerCondition, url: string) => boolean;
|
|
3
|
-
export declare const evalTriggerCondition: (triggerCondition: TriggerCondition) => boolean;
|