@ada-support/embed2 1.14.6 → 1.14.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/npm-entry/index.js
CHANGED
|
@@ -16125,7 +16125,7 @@ const client = new BrowserClient({
|
|
|
16125
16125
|
return event;
|
|
16126
16126
|
},
|
|
16127
16127
|
environment: "production",
|
|
16128
|
-
release: "1.14.
|
|
16128
|
+
release: "1.14.7-4506c4f",
|
|
16129
16129
|
sampleRate: 0.25,
|
|
16130
16130
|
autoSessionTracking: false,
|
|
16131
16131
|
// Integrations don't seem to work with Sentry: https://github.com/getsentry/sentry-javascript/issues/2541
|
|
@@ -16751,7 +16751,7 @@ function getEmbedURL(_ref) {
|
|
|
16751
16751
|
} else {
|
|
16752
16752
|
host = `http://${handle}.localhost:${ports.localhost.default}`;
|
|
16753
16753
|
}
|
|
16754
|
-
return `${host}/embed/${frameName}/${"
|
|
16754
|
+
return `${host}/embed/${frameName}/${"4506c4f"}/index.html`;
|
|
16755
16755
|
}
|
|
16756
16756
|
function constructQueryString(query) {
|
|
16757
16757
|
return Object.keys(query).map(key => {
|
|
@@ -17538,9 +17538,9 @@ async function log(message, extra, options) {
|
|
|
17538
17538
|
service: "embed",
|
|
17539
17539
|
env: "production",
|
|
17540
17540
|
embedVersion: 2,
|
|
17541
|
-
version: "1.14.
|
|
17541
|
+
version: "1.14.7",
|
|
17542
17542
|
isNpm: true,
|
|
17543
|
-
commitHash: "
|
|
17543
|
+
commitHash: "4506c4f"
|
|
17544
17544
|
}))
|
|
17545
17545
|
});
|
|
17546
17546
|
}
|
|
@@ -18685,6 +18685,34 @@ function proactiveShownWithinFrequency(proactiveConversationKey, frequency, hand
|
|
|
18685
18685
|
return false;
|
|
18686
18686
|
}
|
|
18687
18687
|
}
|
|
18688
|
+
|
|
18689
|
+
// A proactive only fires when `now` is within its optional scheduling window.
|
|
18690
|
+
// Bounds are absolute ISO 8601 UTC instants authored in the dashboard; either
|
|
18691
|
+
// may be unset for an open-ended window. This mirrors the declarative campaign
|
|
18692
|
+
// datetime gating: the start is after-inclusive and the end is before-exclusive,
|
|
18693
|
+
// evaluated through the shared trigger-condition evaluator so the semantics stay
|
|
18694
|
+
// identical across both surfaces.
|
|
18695
|
+
function isWithinSchedule(scheduleStart, scheduleEnd) {
|
|
18696
|
+
const now = new Date();
|
|
18697
|
+
const buildCondition = (operator, datetime) => ({
|
|
18698
|
+
type: "datetime",
|
|
18699
|
+
// Bounds are absolute UTC instants (the stored datetime carries a `Z`
|
|
18700
|
+
// offset). `timezone` is metadata the evaluator doesn't consult, but label
|
|
18701
|
+
// it UTC to match the data and stay correct if the evaluator ever honors it.
|
|
18702
|
+
timezone: "UTC",
|
|
18703
|
+
condition: {
|
|
18704
|
+
operator,
|
|
18705
|
+
datetime
|
|
18706
|
+
}
|
|
18707
|
+
});
|
|
18708
|
+
if (scheduleStart && !evalDatetimeTriggerCondition(buildCondition("after-inclusive", scheduleStart), now)) {
|
|
18709
|
+
return false;
|
|
18710
|
+
}
|
|
18711
|
+
if (scheduleEnd && !evalDatetimeTriggerCondition(buildCondition("before-exclusive", scheduleEnd), now)) {
|
|
18712
|
+
return false;
|
|
18713
|
+
}
|
|
18714
|
+
return true;
|
|
18715
|
+
}
|
|
18688
18716
|
function addProactiveToStorageString(oldStorageValue, proactiveConversationId) {
|
|
18689
18717
|
return oldStorageValue ? `${oldStorageValue},${proactiveConversationId}` : proactiveConversationId;
|
|
18690
18718
|
}
|
|
@@ -18754,13 +18782,19 @@ function proactiveTriggerImpl(_ref) {
|
|
|
18754
18782
|
duration,
|
|
18755
18783
|
delay,
|
|
18756
18784
|
frequency,
|
|
18757
|
-
active
|
|
18785
|
+
active,
|
|
18786
|
+
schedule_start: scheduleStart,
|
|
18787
|
+
schedule_end: scheduleEnd
|
|
18758
18788
|
} = proactiveConversation.modality_config.chat;
|
|
18759
18789
|
let proactiveMessage = proactiveConversation.messages[language][0];
|
|
18760
18790
|
if (!active) {
|
|
18761
18791
|
warn("Proactive message is not active");
|
|
18762
18792
|
return;
|
|
18763
18793
|
}
|
|
18794
|
+
if (!isWithinSchedule(scheduleStart, scheduleEnd)) {
|
|
18795
|
+
warn("Proactive message is outside its scheduled window");
|
|
18796
|
+
return;
|
|
18797
|
+
}
|
|
18764
18798
|
if (isTemplate) {
|
|
18765
18799
|
if (Object.keys(params).length === 0) {
|
|
18766
18800
|
warn("Proactive message is a template but no parameters were provided");
|
|
@@ -20206,7 +20240,7 @@ class ChatFrame extends d {
|
|
|
20206
20240
|
log("Chat frame mount", {
|
|
20207
20241
|
handle,
|
|
20208
20242
|
chatUrl: this.url,
|
|
20209
|
-
embedVersion: "
|
|
20243
|
+
embedVersion: "4506c4f".slice(0, 7),
|
|
20210
20244
|
embedSettings: adaSettings
|
|
20211
20245
|
});
|
|
20212
20246
|
|
|
@@ -20294,7 +20328,7 @@ class ChatFrame extends d {
|
|
|
20294
20328
|
const hostPageUrlParams = new URL(window.location.href).searchParams;
|
|
20295
20329
|
const smsToken = hostPageUrlParams.get("adaSMSToken");
|
|
20296
20330
|
const queryParams = {
|
|
20297
|
-
embedVersion: "
|
|
20331
|
+
embedVersion: "4506c4f".slice(0, 7),
|
|
20298
20332
|
greeting,
|
|
20299
20333
|
language,
|
|
20300
20334
|
skipGreeting,
|
|
@@ -21786,7 +21820,7 @@ class Container extends d {
|
|
|
21786
21820
|
let [key, conversation] = _ref;
|
|
21787
21821
|
const chatConfig = conversation.modality_config.chat;
|
|
21788
21822
|
const isTemplate = conversation.is_template;
|
|
21789
|
-
if (chatConfig.active && !isTemplate && evaluateUrlTriggerConditions(chatConfig.url_trigger_conditions, currentUrl)) {
|
|
21823
|
+
if (chatConfig.active && !isTemplate && isWithinSchedule(chatConfig.schedule_start, chatConfig.schedule_end) && evaluateUrlTriggerConditions(chatConfig.url_trigger_conditions, currentUrl)) {
|
|
21790
21824
|
this.handleProactiveTrigger(Container_objectSpread({
|
|
21791
21825
|
key
|
|
21792
21826
|
}, conversation), "url");
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { StartOptions } from "@ada-support/embed-types";
|
|
2
2
|
import type { MessageService } from "client/lib/message-service";
|
|
3
3
|
import type { ProactiveConversation, ProactiveConversationTriggerMethod, ProactiveConversationUrlTriggerConditions, RecentProactiveConversationConfig } from "./types";
|
|
4
|
+
export declare function isWithinSchedule(scheduleStart?: string | null, scheduleEnd?: string | null): boolean;
|
|
4
5
|
export declare function proactiveTriggerImpl({ proactiveConversation, triggerMethod, adaSettings, messageService, language, setRecentProactiveConversationConfig, clearProactiveConversation, }: {
|
|
5
6
|
proactiveConversation: ProactiveConversation;
|
|
6
7
|
triggerMethod: ProactiveConversationTriggerMethod | null;
|