@ada-support/embed2 1.7.27 → 1.7.31
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/embed.d.ts +2 -1
- package/dist/npm-entry/common/constants/events.d.ts +2 -0
- package/dist/npm-entry/common/lib/channel.d.ts +4 -1
- package/dist/npm-entry/common/models/client/index.d.ts +2 -0
- package/dist/npm-entry/common/types/http.d.ts +3 -0
- package/dist/npm-entry/index.js +145 -11
- package/dist/npm-entry/proactiveConversations/proactiveConversation.d.ts +10 -0
- package/dist/npm-entry/proactiveConversations/types.d.ts +19 -0
- package/package.json +22 -22
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CampaignParams, ResetParams, StartOptions, WindowInfo } from "@ada-support/embed-types";
|
|
1
|
+
import type { CampaignParams, ResetParams, StartOptions, TriggerProactiveParams, WindowInfo } from "@ada-support/embed-types";
|
|
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";
|
|
@@ -20,5 +20,6 @@ export declare function createEmbed(adaSettings: StartOptions): {
|
|
|
20
20
|
readonly createProactive: (body: string, duration: number, responseId?: string) => Promise<void>;
|
|
21
21
|
readonly closeCampaign: () => Promise<void>;
|
|
22
22
|
readonly setDeviceToken: (token: string) => Promise<void>;
|
|
23
|
+
readonly triggerProactive: (triggerProactiveParams: TriggerProactiveParams) => Promise<void>;
|
|
23
24
|
};
|
|
24
25
|
export declare type Embed = ReturnType<typeof createEmbed>;
|
|
@@ -74,6 +74,8 @@ export declare const CLOSE_CAMPAIGN = "CLOSE_CAMPAIGN";
|
|
|
74
74
|
export declare const CLOSE_CAMPAIGN_RESPONSE = "CLOSE_CAMPAIGN_RESPONSE";
|
|
75
75
|
export declare const SET_DEVICE_TOKEN = "SET_DEVICE_TOKEN";
|
|
76
76
|
export declare const SET_DEVICE_TOKEN_RESPONSE = "SET_DEVICE_TOKEN_RESPONSE";
|
|
77
|
+
export declare const TRIGGER_PROACTIVE = "TRIGGER_PROACTIVE";
|
|
78
|
+
export declare const TRIGGER_PROACTIVE_RESPONSE = "TRIGGER_PROACTIVE_RESPONSE";
|
|
77
79
|
export declare const SEND_GREETING = "SEND_GREETING";
|
|
78
80
|
/**
|
|
79
81
|
* Fetch Event Status
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CampaignParams, ResetParams } from "@ada-support/embed-types";
|
|
1
|
+
import type { CampaignParams, ResetParams, TriggerProactiveParams } from "@ada-support/embed-types";
|
|
2
2
|
import type { FetchEventStatusType } from "common/constants/events";
|
|
3
3
|
import type { SendGreetingParams, StoreDispatchPayload, StoreGetPayload, TrackEventParams } from "common/types";
|
|
4
4
|
import type { AdaCustomEvent, Refhandler } from "common/types/events";
|
|
@@ -8,6 +8,7 @@ export interface EmbedRequestPayloadByEvent {
|
|
|
8
8
|
CREATE_PROACTIVE: {
|
|
9
9
|
body: string;
|
|
10
10
|
duration: number | null;
|
|
11
|
+
delay?: number;
|
|
11
12
|
responseId?: string | null;
|
|
12
13
|
};
|
|
13
14
|
DELETE_HISTORY: undefined;
|
|
@@ -33,6 +34,7 @@ export interface EmbedRequestPayloadByEvent {
|
|
|
33
34
|
SET_LANGUAGE: {
|
|
34
35
|
language: string;
|
|
35
36
|
};
|
|
37
|
+
TRIGGER_PROACTIVE: TriggerProactiveParams;
|
|
36
38
|
}
|
|
37
39
|
export declare type EmbedRequestEvent = keyof EmbedRequestPayloadByEvent;
|
|
38
40
|
export interface EmbedResponsePayloadByEvent {
|
|
@@ -65,6 +67,7 @@ export interface EmbedResponsePayloadByEvent {
|
|
|
65
67
|
"chat_INIT": unknown;
|
|
66
68
|
"x-storage_INIT": unknown;
|
|
67
69
|
"SET_DEVICE_TOKEN_RESPONSE": unknown;
|
|
70
|
+
"TRIGGER_PROACTIVE_RESPONSE": unknown;
|
|
68
71
|
}
|
|
69
72
|
export declare type EmbedResponseEvent = keyof EmbedResponsePayloadByEvent;
|
|
70
73
|
export declare type EmbedEvent = EmbedRequestEvent | EmbedResponseEvent;
|
|
@@ -2,6 +2,7 @@ import type { BusinessEvent } from "businessEvents/types";
|
|
|
2
2
|
import type { ChatButton, ClientResponse, CurrentIntro, Features } from "common/types/http";
|
|
3
3
|
import type { LanguageKey, LanguageMap } from "common/types/languages";
|
|
4
4
|
import type { MarketingCampaign } from "src/campaigns/types";
|
|
5
|
+
import type { ProactiveConversations } from "src/proactiveConversations/types";
|
|
5
6
|
export declare class Client {
|
|
6
7
|
tint: string;
|
|
7
8
|
chat: boolean;
|
|
@@ -31,6 +32,7 @@ export declare class Client {
|
|
|
31
32
|
};
|
|
32
33
|
};
|
|
33
34
|
translated_languages: string[];
|
|
35
|
+
proactive_conversations?: ProactiveConversations;
|
|
34
36
|
[key: string]: unknown;
|
|
35
37
|
constructor(clientResponse: ClientResponse["client"]);
|
|
36
38
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { BusinessEvent } from "businessEvents/types";
|
|
2
2
|
import type { LanguageKey } from "common/types/languages";
|
|
3
|
+
import type { ProactiveConversations } from "src/proactiveConversations/types";
|
|
3
4
|
export interface ChatButton {
|
|
4
5
|
size: number;
|
|
5
6
|
background_color: string;
|
|
@@ -36,6 +37,7 @@ export interface ClientObject {
|
|
|
36
37
|
features: Features;
|
|
37
38
|
marketing_campaigns_order?: string[];
|
|
38
39
|
translated_languages: string[];
|
|
40
|
+
proactive_conversations?: ProactiveConversations;
|
|
39
41
|
[key: string]: unknown;
|
|
40
42
|
}
|
|
41
43
|
export interface CachedClientObject {
|
|
@@ -54,6 +56,7 @@ export interface CachedClientObject {
|
|
|
54
56
|
features: Features;
|
|
55
57
|
business_events?: BusinessEvent[];
|
|
56
58
|
marketing_campaigns_order?: string[];
|
|
59
|
+
proactive_conversations?: ProactiveConversations;
|
|
57
60
|
[key: string]: unknown;
|
|
58
61
|
}
|
|
59
62
|
export interface ClientResponse {
|
package/dist/npm-entry/index.js
CHANGED
|
@@ -13949,7 +13949,7 @@ const client = new BrowserClient({
|
|
|
13949
13949
|
return event;
|
|
13950
13950
|
},
|
|
13951
13951
|
environment: "production",
|
|
13952
|
-
release: "1.7.
|
|
13952
|
+
release: "1.7.31-645ffae",
|
|
13953
13953
|
sampleRate: 0.25,
|
|
13954
13954
|
autoSessionTracking: false,
|
|
13955
13955
|
// Integrations don't seem to work with Sentry: https://github.com/getsentry/sentry-javascript/issues/2541
|
|
@@ -14064,6 +14064,8 @@ const CLOSE_CAMPAIGN = "CLOSE_CAMPAIGN";
|
|
|
14064
14064
|
const CLOSE_CAMPAIGN_RESPONSE = "CLOSE_CAMPAIGN_RESPONSE";
|
|
14065
14065
|
const SET_DEVICE_TOKEN = "SET_DEVICE_TOKEN";
|
|
14066
14066
|
const SET_DEVICE_TOKEN_RESPONSE = "SET_DEVICE_TOKEN_RESPONSE";
|
|
14067
|
+
const TRIGGER_PROACTIVE = "TRIGGER_PROACTIVE";
|
|
14068
|
+
const TRIGGER_PROACTIVE_RESPONSE = "TRIGGER_PROACTIVE_RESPONSE";
|
|
14067
14069
|
|
|
14068
14070
|
// Tells chat to send a greeting
|
|
14069
14071
|
const SEND_GREETING = "SEND_GREETING";
|
|
@@ -14521,7 +14523,7 @@ function getEmbedURL(_ref) {
|
|
|
14521
14523
|
} else {
|
|
14522
14524
|
host = `http://${handle}.localhost:9001`;
|
|
14523
14525
|
}
|
|
14524
|
-
return `${host}/embed/${frameName}/${"
|
|
14526
|
+
return `${host}/embed/${frameName}/${"645ffae"}/index.html`;
|
|
14525
14527
|
}
|
|
14526
14528
|
function constructQueryString(query) {
|
|
14527
14529
|
return Object.keys(query).map(key => {
|
|
@@ -14926,7 +14928,7 @@ class StoreProxy {
|
|
|
14926
14928
|
}
|
|
14927
14929
|
}
|
|
14928
14930
|
;// CONCATENATED MODULE: ./src/client/helpers/local-notifications/index.ts
|
|
14929
|
-
const browserHasNotificationSupport =
|
|
14931
|
+
const browserHasNotificationSupport = "Notification" in window;
|
|
14930
14932
|
function checkIfUserHasGivenPermission() {
|
|
14931
14933
|
if (!browserHasNotificationSupport) {
|
|
14932
14934
|
return false;
|
|
@@ -15465,7 +15467,6 @@ function triggerCampaignImpl(_ref) {
|
|
|
15465
15467
|
}).catch(NO_OP_FUNCTION); // we don't want to log errors here, it may fail because of rate limiting
|
|
15466
15468
|
}
|
|
15467
15469
|
}
|
|
15468
|
-
|
|
15469
15470
|
const getCampaignToTrigger = (adaSettings, marketingCampaigns, options, onlyBasic) => {
|
|
15470
15471
|
const {
|
|
15471
15472
|
ignoreStatus = false,
|
|
@@ -15615,6 +15616,7 @@ class Client {
|
|
|
15615
15616
|
_defineProperty(this, "marketing_campaigns", void 0);
|
|
15616
15617
|
_defineProperty(this, "ui_settings", void 0);
|
|
15617
15618
|
_defineProperty(this, "translated_languages", void 0);
|
|
15619
|
+
_defineProperty(this, "proactive_conversations", void 0);
|
|
15618
15620
|
const {
|
|
15619
15621
|
chat,
|
|
15620
15622
|
chat_button: chatButton,
|
|
@@ -15699,9 +15701,9 @@ async function log(message, extra, options) {
|
|
|
15699
15701
|
service: "embed",
|
|
15700
15702
|
env: "production",
|
|
15701
15703
|
embedVersion: 2,
|
|
15702
|
-
version: "1.7.
|
|
15704
|
+
version: "1.7.31",
|
|
15703
15705
|
isNpm: true,
|
|
15704
|
-
commitHash: "
|
|
15706
|
+
commitHash: "645ffae"
|
|
15705
15707
|
}))
|
|
15706
15708
|
});
|
|
15707
15709
|
}
|
|
@@ -16226,6 +16228,82 @@ function setBrowserStorageItem(key, value, persistenceSetting) {
|
|
|
16226
16228
|
dist/* adaSessionStorage */.ad.setItem(key, value);
|
|
16227
16229
|
}
|
|
16228
16230
|
}
|
|
16231
|
+
;// CONCATENATED MODULE: ./src/proactiveConversations/proactiveConversation.ts
|
|
16232
|
+
|
|
16233
|
+
function proactiveConversation_ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
16234
|
+
function proactiveConversation_objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? proactiveConversation_ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : proactiveConversation_ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
16235
|
+
|
|
16236
|
+
|
|
16237
|
+
|
|
16238
|
+
function proactiveShownWithinFrequency(proactiveConversationKey, frequency, handle) {
|
|
16239
|
+
switch (frequency) {
|
|
16240
|
+
case "always":
|
|
16241
|
+
return false;
|
|
16242
|
+
case "session":
|
|
16243
|
+
{
|
|
16244
|
+
const storageValue = dist/* adaSessionStorage */.ad.getFnItem("marketing_campaigns_shown");
|
|
16245
|
+
const perSessionProactives = storageValue ? (storageValue[handle] || "").split(",") : [];
|
|
16246
|
+
return perSessionProactives.includes(proactiveConversationKey);
|
|
16247
|
+
}
|
|
16248
|
+
default:
|
|
16249
|
+
return false;
|
|
16250
|
+
}
|
|
16251
|
+
}
|
|
16252
|
+
function addProactiveToStorageString(oldStorageValue, proactiveConversationId) {
|
|
16253
|
+
return oldStorageValue ? `${oldStorageValue},${proactiveConversationId}` : proactiveConversationId;
|
|
16254
|
+
}
|
|
16255
|
+
function recordProactiveTrigger(proactiveConversationKey, frequency, handle) {
|
|
16256
|
+
switch (frequency) {
|
|
16257
|
+
case "always":
|
|
16258
|
+
break;
|
|
16259
|
+
case "session":
|
|
16260
|
+
{
|
|
16261
|
+
const currentStorageValue = dist/* adaSessionStorage */.ad.getFnItem("marketing_campaigns_shown");
|
|
16262
|
+
const newStorageValue = addProactiveToStorageString(currentStorageValue ? currentStorageValue[handle] || "" : "", proactiveConversationKey);
|
|
16263
|
+
dist/* adaSessionStorage */.ad.setFnItem("marketing_campaigns_shown", proactiveConversation_objectSpread(proactiveConversation_objectSpread({}, currentStorageValue), {}, {
|
|
16264
|
+
[handle]: newStorageValue
|
|
16265
|
+
}));
|
|
16266
|
+
break;
|
|
16267
|
+
}
|
|
16268
|
+
default:
|
|
16269
|
+
break;
|
|
16270
|
+
}
|
|
16271
|
+
}
|
|
16272
|
+
function proactiveTriggerImpl(_ref) {
|
|
16273
|
+
let {
|
|
16274
|
+
proactiveConversation,
|
|
16275
|
+
messageKey,
|
|
16276
|
+
adaSettings,
|
|
16277
|
+
messageService,
|
|
16278
|
+
clearProactiveMessage
|
|
16279
|
+
} = _ref;
|
|
16280
|
+
const {
|
|
16281
|
+
handle
|
|
16282
|
+
} = adaSettings;
|
|
16283
|
+
const {
|
|
16284
|
+
duration,
|
|
16285
|
+
delay,
|
|
16286
|
+
frequency
|
|
16287
|
+
} = proactiveConversation.modality_config.chat;
|
|
16288
|
+
|
|
16289
|
+
// Check if the proactive message has been shown within the specified frequency
|
|
16290
|
+
const doesPassFrequencyCheck = !proactiveShownWithinFrequency(messageKey, frequency, handle);
|
|
16291
|
+
if (!doesPassFrequencyCheck) {
|
|
16292
|
+
return;
|
|
16293
|
+
}
|
|
16294
|
+
|
|
16295
|
+
// Record the proactive message as being shown
|
|
16296
|
+
recordProactiveTrigger(messageKey, frequency, handle);
|
|
16297
|
+
clearProactiveMessage();
|
|
16298
|
+
const localChannel = messageService.getChannel("local");
|
|
16299
|
+
const lang = adaSettings.language || get_browser_language();
|
|
16300
|
+
const message = proactiveConversation.messages[lang][0];
|
|
16301
|
+
localChannel.postMessage(CREATE_PROACTIVE, {
|
|
16302
|
+
body: message,
|
|
16303
|
+
duration,
|
|
16304
|
+
delay
|
|
16305
|
+
});
|
|
16306
|
+
}
|
|
16229
16307
|
;// CONCATENATED MODULE: ./src/services/chat-versioning/manifest.ts
|
|
16230
16308
|
|
|
16231
16309
|
|
|
@@ -16748,7 +16826,7 @@ class ChatFrame extends d {
|
|
|
16748
16826
|
const hostPageUrlParams = new URL(window.location.href).searchParams;
|
|
16749
16827
|
const smsToken = hostPageUrlParams.get("adaSMSToken");
|
|
16750
16828
|
const queryParams = {
|
|
16751
|
-
embedVersion: "
|
|
16829
|
+
embedVersion: "645ffae".slice(0, 7),
|
|
16752
16830
|
greeting,
|
|
16753
16831
|
language,
|
|
16754
16832
|
skipGreeting,
|
|
@@ -17602,6 +17680,7 @@ function Container_objectSpread(e) { for (var r = 1; r < arguments.length; r++)
|
|
|
17602
17680
|
|
|
17603
17681
|
|
|
17604
17682
|
|
|
17683
|
+
|
|
17605
17684
|
|
|
17606
17685
|
|
|
17607
17686
|
class Container extends d {
|
|
@@ -17618,7 +17697,8 @@ class Container extends d {
|
|
|
17618
17697
|
hideIntroOverride: false,
|
|
17619
17698
|
followUpResponseId: null,
|
|
17620
17699
|
chatVersion: undefined,
|
|
17621
|
-
readyToRenderChatFrame: false
|
|
17700
|
+
readyToRenderChatFrame: false,
|
|
17701
|
+
proactiveConversation: null
|
|
17622
17702
|
});
|
|
17623
17703
|
_defineProperty(this, "resetChatBound", this.resetChat.bind(this));
|
|
17624
17704
|
_defineProperty(this, "locationChangeHandlerBound", this.locationChangeHandler.bind(this));
|
|
@@ -17732,7 +17812,8 @@ class Container extends d {
|
|
|
17732
17812
|
const {
|
|
17733
17813
|
campaignToTrigger,
|
|
17734
17814
|
campaignTriggerOptions,
|
|
17735
|
-
followUpResponseId
|
|
17815
|
+
followUpResponseId,
|
|
17816
|
+
proactiveConversation
|
|
17736
17817
|
} = this.state;
|
|
17737
17818
|
|
|
17738
17819
|
/* We wait for all necessary preconditions (e.g. necessary connections established) to be true,
|
|
@@ -17758,6 +17839,17 @@ class Container extends d {
|
|
|
17758
17839
|
messageService
|
|
17759
17840
|
});
|
|
17760
17841
|
}
|
|
17842
|
+
if (proactiveConversation) {
|
|
17843
|
+
proactiveTriggerImpl({
|
|
17844
|
+
proactiveConversation,
|
|
17845
|
+
messageKey: proactiveConversation.key,
|
|
17846
|
+
adaSettings,
|
|
17847
|
+
messageService,
|
|
17848
|
+
clearProactiveMessage: () => this.setState({
|
|
17849
|
+
proactiveConversation: null
|
|
17850
|
+
})
|
|
17851
|
+
});
|
|
17852
|
+
}
|
|
17761
17853
|
|
|
17762
17854
|
// If a follow-up response has been queued by a triggered Campaign, tell chat to show it
|
|
17763
17855
|
if (isChatWebsocketConnected && isDrawerOpen && followUpResponseId) {
|
|
@@ -18001,6 +18093,17 @@ class Container extends d {
|
|
|
18001
18093
|
});
|
|
18002
18094
|
localChannel.postMessage(SET_DEVICE_TOKEN_RESPONSE, null, id);
|
|
18003
18095
|
}
|
|
18096
|
+
handleProactiveTrigger(proactiveConversation) {
|
|
18097
|
+
const {
|
|
18098
|
+
isDrawerOpen
|
|
18099
|
+
} = this.props;
|
|
18100
|
+
if (isDrawerOpen) {
|
|
18101
|
+
return;
|
|
18102
|
+
}
|
|
18103
|
+
this.setState({
|
|
18104
|
+
proactiveConversation
|
|
18105
|
+
});
|
|
18106
|
+
}
|
|
18004
18107
|
async handleEmbedAction(type, payload, id) {
|
|
18005
18108
|
const {
|
|
18006
18109
|
client,
|
|
@@ -18197,7 +18300,8 @@ class Container extends d {
|
|
|
18197
18300
|
}
|
|
18198
18301
|
const {
|
|
18199
18302
|
body,
|
|
18200
|
-
duration
|
|
18303
|
+
duration,
|
|
18304
|
+
delay
|
|
18201
18305
|
} = payload;
|
|
18202
18306
|
const EXTRA_PROACTIVE_DELAY = 1000;
|
|
18203
18307
|
this.setState({
|
|
@@ -18209,7 +18313,7 @@ class Container extends d {
|
|
|
18209
18313
|
const newClient = new Client(Container_objectSpread(Container_objectSpread({}, client), {}, {
|
|
18210
18314
|
intro: {
|
|
18211
18315
|
body,
|
|
18212
|
-
delay: 0,
|
|
18316
|
+
delay: delay || 0,
|
|
18213
18317
|
// Not just duration || null because we want to preserve 0 duration
|
|
18214
18318
|
duration: duration || duration === 0 ? duration : null,
|
|
18215
18319
|
style: "Text",
|
|
@@ -18242,6 +18346,26 @@ class Container extends d {
|
|
|
18242
18346
|
this.handleSettingDeviceToken(localChannel, payload, id);
|
|
18243
18347
|
break;
|
|
18244
18348
|
}
|
|
18349
|
+
case TRIGGER_PROACTIVE:
|
|
18350
|
+
{
|
|
18351
|
+
var _client$proactive_con;
|
|
18352
|
+
if (!client) {
|
|
18353
|
+
throw new AdaEmbedError("`client` is not defined");
|
|
18354
|
+
}
|
|
18355
|
+
const {
|
|
18356
|
+
messageKey
|
|
18357
|
+
} = payload;
|
|
18358
|
+
if ((_client$proactive_con = client.proactive_conversations) !== null && _client$proactive_con !== void 0 && _client$proactive_con[messageKey]) {
|
|
18359
|
+
const proactiveConversation = client.proactive_conversations[messageKey];
|
|
18360
|
+
this.handleProactiveTrigger(Container_objectSpread(Container_objectSpread({}, proactiveConversation), {}, {
|
|
18361
|
+
key: messageKey
|
|
18362
|
+
}));
|
|
18363
|
+
} else {
|
|
18364
|
+
warn(`Proactive message with key ${messageKey} not found`);
|
|
18365
|
+
}
|
|
18366
|
+
localChannel.postMessage(TRIGGER_PROACTIVE_RESPONSE, null, id);
|
|
18367
|
+
break;
|
|
18368
|
+
}
|
|
18245
18369
|
default:
|
|
18246
18370
|
{
|
|
18247
18371
|
// Do nothing
|
|
@@ -18780,6 +18904,10 @@ function createEmbed(adaSettings) {
|
|
|
18780
18904
|
await localChannel.fetch(SET_DEVICE_TOKEN, SET_DEVICE_TOKEN_RESPONSE, {
|
|
18781
18905
|
token
|
|
18782
18906
|
});
|
|
18907
|
+
},
|
|
18908
|
+
async triggerProactive(triggerProactiveParams) {
|
|
18909
|
+
await initialized;
|
|
18910
|
+
await localChannel.fetch(TRIGGER_PROACTIVE, TRIGGER_PROACTIVE_RESPONSE, triggerProactiveParams);
|
|
18783
18911
|
}
|
|
18784
18912
|
};
|
|
18785
18913
|
}
|
|
@@ -18947,6 +19075,12 @@ function createEmbedInterface() {
|
|
|
18947
19075
|
channel.postMessage("TRIGGER_ANSWER", {
|
|
18948
19076
|
answerId
|
|
18949
19077
|
});
|
|
19078
|
+
},
|
|
19079
|
+
triggerProactive: triggerProactiveParams => {
|
|
19080
|
+
if (!embed) {
|
|
19081
|
+
throw EMBED_NOT_INITIALIZED_ERROR;
|
|
19082
|
+
}
|
|
19083
|
+
return embed.triggerProactive(triggerProactiveParams);
|
|
18950
19084
|
}
|
|
18951
19085
|
});
|
|
18952
19086
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { StartOptions } from "@ada-support/embed-types";
|
|
2
|
+
import type { MessageService } from "client/lib/message-service";
|
|
3
|
+
import type { ProactiveConversation } from "./types";
|
|
4
|
+
export declare function proactiveTriggerImpl({ proactiveConversation, messageKey, adaSettings, messageService, clearProactiveMessage, }: {
|
|
5
|
+
proactiveConversation: ProactiveConversation;
|
|
6
|
+
messageKey: string;
|
|
7
|
+
adaSettings: StartOptions;
|
|
8
|
+
messageService: MessageService;
|
|
9
|
+
clearProactiveMessage: () => void;
|
|
10
|
+
}): void;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface ProactiveConversation {
|
|
2
|
+
messages: {
|
|
3
|
+
[language: string]: string[];
|
|
4
|
+
};
|
|
5
|
+
modality_config: {
|
|
6
|
+
[modality: string]: {
|
|
7
|
+
active: boolean;
|
|
8
|
+
url_trigger_conditions: string[];
|
|
9
|
+
delay: number;
|
|
10
|
+
duration: number;
|
|
11
|
+
frequency: ProactiveConversationFrequency;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
key?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface ProactiveConversations {
|
|
17
|
+
[messageKey: string]: ProactiveConversation;
|
|
18
|
+
}
|
|
19
|
+
export declare type ProactiveConversationFrequency = "always" | "session";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ada-support/embed2",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.31",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/npm-entry",
|
|
6
6
|
"typings": "dist/npm-entry/index-npm.d.ts",
|
|
@@ -43,6 +43,15 @@
|
|
|
43
43
|
"license": "ISC",
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@ada-support/eslint-config-ada": "^1.2.5",
|
|
46
|
+
"@babel/core": "^7.23.2",
|
|
47
|
+
"@babel/plugin-proposal-class-properties": "^7.16.7",
|
|
48
|
+
"@babel/plugin-proposal-numeric-separator": "^7.16.7",
|
|
49
|
+
"@babel/plugin-proposal-object-rest-spread": "^7.16.7",
|
|
50
|
+
"@babel/plugin-proposal-optional-chaining": "^7.16.7",
|
|
51
|
+
"@babel/plugin-transform-react-jsx": "^7.16.7",
|
|
52
|
+
"@babel/plugin-transform-runtime": "^7.16.10",
|
|
53
|
+
"@babel/preset-env": "^7.23.2",
|
|
54
|
+
"@babel/preset-typescript": "^7.23.2",
|
|
46
55
|
"@testing-library/preact": "^2.0.1",
|
|
47
56
|
"@types/enzyme": "^3.10.11",
|
|
48
57
|
"@types/jest": "^27.0.2",
|
|
@@ -54,17 +63,22 @@
|
|
|
54
63
|
"@types/webpack": "^5.28.0",
|
|
55
64
|
"@types/webpack-bundle-analyzer": "^4.4.1",
|
|
56
65
|
"@types/webpack-dev-server": "^4.7.2",
|
|
66
|
+
"babel-loader": "9.1.2",
|
|
67
|
+
"babel-preset-preact": "^2.0.0",
|
|
57
68
|
"browserslist": "^4.17.4",
|
|
58
69
|
"cypress": "^9.6.1",
|
|
59
70
|
"depcheck": "^1.4.3",
|
|
71
|
+
"dotenv": "^8.2.0",
|
|
60
72
|
"enzyme": "^3.11.0",
|
|
61
73
|
"enzyme-adapter-preact-pure": "^4.0.1",
|
|
62
74
|
"eslint": "^8.8.0",
|
|
75
|
+
"eslint-config-prettier": "^8.5.0",
|
|
63
76
|
"eslint-plugin-chai-friendly": "^0.7.2",
|
|
64
77
|
"eslint-plugin-compat": "^4.0.2",
|
|
65
78
|
"eslint-plugin-cypress": "^2.12.1",
|
|
66
79
|
"eslint-plugin-sonarjs": "^0.11.0",
|
|
67
80
|
"husky": "^7.0.0",
|
|
81
|
+
"html-webpack-plugin": "^5.5.0",
|
|
68
82
|
"jest": "^27.5.1",
|
|
69
83
|
"jest-localstorage-mock": "^2.4.0",
|
|
70
84
|
"lint-staged": "^11.2.3",
|
|
@@ -74,39 +88,25 @@
|
|
|
74
88
|
"start-server-and-test": "^2.0.4",
|
|
75
89
|
"ts-node": "^10.2.1",
|
|
76
90
|
"tsconfig-paths": "^3.11.0",
|
|
91
|
+
"typescript": "^4.6.2",
|
|
92
|
+
"webpack": "^5.76.0",
|
|
77
93
|
"webpack-bundle-analyzer": "^4.5.0",
|
|
78
|
-
"webpack-
|
|
94
|
+
"webpack-cli": "^5.1.4",
|
|
95
|
+
"webpack-dev-server": "^4.3.1",
|
|
96
|
+
"webpack-merge": "^5.8.0"
|
|
79
97
|
},
|
|
80
98
|
"dependencies": {
|
|
81
|
-
"@ada-support/embed-types": "^1.
|
|
99
|
+
"@ada-support/embed-types": "^1.8.0",
|
|
82
100
|
"@ada-support/web-storage": "^1.2.6",
|
|
83
|
-
"@babel/core": "^7.23.2",
|
|
84
|
-
"@babel/plugin-proposal-class-properties": "^7.16.7",
|
|
85
|
-
"@babel/plugin-proposal-numeric-separator": "^7.16.7",
|
|
86
|
-
"@babel/plugin-proposal-object-rest-spread": "^7.16.7",
|
|
87
|
-
"@babel/plugin-proposal-optional-chaining": "^7.16.7",
|
|
88
|
-
"@babel/plugin-transform-react-jsx": "^7.16.7",
|
|
89
|
-
"@babel/plugin-transform-runtime": "^7.16.10",
|
|
90
|
-
"@babel/preset-env": "^7.23.2",
|
|
91
|
-
"@babel/preset-typescript": "^7.23.2",
|
|
92
101
|
"@babel/runtime-corejs3": "^7.15.4",
|
|
93
102
|
"@sentry/browser": "^8.33.0",
|
|
94
103
|
"@sentry/types": "^8.33.1",
|
|
95
|
-
"babel-loader": "9.1.2",
|
|
96
|
-
"babel-preset-preact": "^2.0.0",
|
|
97
|
-
"dotenv": "^8.2.0",
|
|
98
|
-
"eslint-config-prettier": "^8.5.0",
|
|
99
104
|
"focus-visible": "^5.2.0",
|
|
100
|
-
"html-webpack-plugin": "^5.5.0",
|
|
101
105
|
"json-stable-stringify": "^1.0.1",
|
|
102
106
|
"lodash.debounce": "^4.0.8",
|
|
103
107
|
"lodash.memoize": "^4.1.2",
|
|
104
108
|
"preact": "10.4.5",
|
|
105
|
-
"
|
|
106
|
-
"uniqid": "^5.3.0",
|
|
107
|
-
"webpack": "^5.76.0",
|
|
108
|
-
"webpack-cli": "^4.9.2",
|
|
109
|
-
"webpack-merge": "^5.8.0"
|
|
109
|
+
"uniqid": "^5.3.0"
|
|
110
110
|
},
|
|
111
111
|
"resolutions": {
|
|
112
112
|
"@lambdatest/node-tunnel": ">=3.0.2",
|