@ada-support/embed2 1.14.9 → 1.14.10
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 +61 -9
- package/package.json +1 -1
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.10-df84716",
|
|
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}/${"df84716"}/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.10",
|
|
17542
17542
|
isNpm: true,
|
|
17543
|
-
commitHash: "
|
|
17543
|
+
commitHash: "df84716"
|
|
17544
17544
|
}))
|
|
17545
17545
|
});
|
|
17546
17546
|
}
|
|
@@ -18686,6 +18686,29 @@ function proactiveShownWithinFrequency(proactiveConversationKey, frequency, hand
|
|
|
18686
18686
|
}
|
|
18687
18687
|
}
|
|
18688
18688
|
|
|
18689
|
+
// Ranking advances across visits: once a proactive fires it's remembered so a
|
|
18690
|
+
// later visit surfaces the next-highest priority instead of repeating it. This
|
|
18691
|
+
// "shown" set persists in localStorage (across visits, unlike the per-session
|
|
18692
|
+
// frequency record above) under the same disclosed `proactive_conversations_shown`
|
|
18693
|
+
// key, scoped by handle.
|
|
18694
|
+
function getRankedShownKeys(handle) {
|
|
18695
|
+
const storageValue = dist/* adaLocalStorage */.BB.getFnItem("proactive_conversations_shown");
|
|
18696
|
+
const stored = storageValue ? storageValue[handle] : undefined;
|
|
18697
|
+
return stored ? stored.split(",") : [];
|
|
18698
|
+
}
|
|
18699
|
+
function setRankedShownKeys(handle, keys) {
|
|
18700
|
+
const storageValue = dist/* adaLocalStorage */.BB.getFnItem("proactive_conversations_shown") || {};
|
|
18701
|
+
dist/* adaLocalStorage */.BB.setFnItem("proactive_conversations_shown", proactiveConversation_objectSpread(proactiveConversation_objectSpread({}, storageValue), {}, {
|
|
18702
|
+
[handle]: keys.join(",")
|
|
18703
|
+
}));
|
|
18704
|
+
}
|
|
18705
|
+
function recordRankedShown(handle, proactiveConversationKey) {
|
|
18706
|
+
const keys = getRankedShownKeys(handle);
|
|
18707
|
+
if (!keys.includes(proactiveConversationKey)) {
|
|
18708
|
+
setRankedShownKeys(handle, [...keys, proactiveConversationKey]);
|
|
18709
|
+
}
|
|
18710
|
+
}
|
|
18711
|
+
|
|
18689
18712
|
// A proactive only fires when `now` is within its optional scheduling window.
|
|
18690
18713
|
// Bounds are absolute ISO 8601 UTC instants authored in the dashboard; either
|
|
18691
18714
|
// may be unset for an open-ended window. This mirrors the declarative campaign
|
|
@@ -18834,6 +18857,14 @@ function proactiveTriggerImpl(_ref3) {
|
|
|
18834
18857
|
|
|
18835
18858
|
// Record the proactive message as being shown
|
|
18836
18859
|
recordProactiveTrigger(messageKey, frequency, handle);
|
|
18860
|
+
|
|
18861
|
+
// Remember URL-triggered shows so ranking advances to the next proactive on
|
|
18862
|
+
// the next visit. Recording every URL trigger (not just ranked ones) is safe:
|
|
18863
|
+
// the unranked fire-all path never reads this set, and the loop-reset in
|
|
18864
|
+
// `selectProactivesToTriggerForUrl` clears any stale keys.
|
|
18865
|
+
if (triggerMethod === "url") {
|
|
18866
|
+
recordRankedShown(handle, messageKey);
|
|
18867
|
+
}
|
|
18837
18868
|
setRecentProactiveConversationConfig({
|
|
18838
18869
|
key: messageKey,
|
|
18839
18870
|
params
|
|
@@ -18874,8 +18905,10 @@ function evaluateUrlTriggerConditions(conditions, url) {
|
|
|
18874
18905
|
// Prioritization is configured only by clients on the
|
|
18875
18906
|
// `proactive-messaging-image-support` flag — the only ones who can rank in the
|
|
18876
18907
|
// dashboard. Embed has no flag access, so the presence of an `order` is the
|
|
18877
|
-
// signal: when any match is ranked,
|
|
18878
|
-
//
|
|
18908
|
+
// signal: when any match is ranked, exactly one fires and successive visits
|
|
18909
|
+
// advance down the ranking (the highest priority that hasn't been shown yet,
|
|
18910
|
+
// looping back to the top once all have), rather than firing every match — the
|
|
18911
|
+
// pre-ranking behavior kept for unranked clients.
|
|
18879
18912
|
function selectProactivesToTriggerForUrl(proactiveConversations, url, handle) {
|
|
18880
18913
|
const matches = Object.entries(proactiveConversations).filter(_ref4 => {
|
|
18881
18914
|
let [key, conversation] = _ref4;
|
|
@@ -18889,7 +18922,26 @@ function selectProactivesToTriggerForUrl(proactiveConversations, url, handle) {
|
|
|
18889
18922
|
if (!isRankingConfigured) {
|
|
18890
18923
|
return matches;
|
|
18891
18924
|
}
|
|
18892
|
-
|
|
18925
|
+
|
|
18926
|
+
// Ranking fires one proactive per visit and advances down the list: matches
|
|
18927
|
+
// already shown on previous visits are skipped so the next-highest priority
|
|
18928
|
+
// fires. Once every current match has been shown, clear their records so the
|
|
18929
|
+
// cycle loops back to the top.
|
|
18930
|
+
const shownKeys = getRankedShownKeys(handle);
|
|
18931
|
+
const unshown = matches.filter(_ref6 => {
|
|
18932
|
+
let [key] = _ref6;
|
|
18933
|
+
return !shownKeys.includes(key);
|
|
18934
|
+
});
|
|
18935
|
+
if (unshown.length === 0) {
|
|
18936
|
+
const matchKeys = matches.map(_ref7 => {
|
|
18937
|
+
let [key] = _ref7;
|
|
18938
|
+
return key;
|
|
18939
|
+
});
|
|
18940
|
+
setRankedShownKeys(handle, shownKeys.filter(key => !matchKeys.includes(key)));
|
|
18941
|
+
const top = pickHighestPriorityMatch(matches);
|
|
18942
|
+
return top ? [top] : [];
|
|
18943
|
+
}
|
|
18944
|
+
const top = pickHighestPriorityMatch(unshown);
|
|
18893
18945
|
return top ? [top] : [];
|
|
18894
18946
|
}
|
|
18895
18947
|
;// ./src/services/chat-versioning/manifest.ts
|
|
@@ -20278,7 +20330,7 @@ class ChatFrame extends d {
|
|
|
20278
20330
|
log("Chat frame mount", {
|
|
20279
20331
|
handle,
|
|
20280
20332
|
chatUrl: this.url,
|
|
20281
|
-
embedVersion: "
|
|
20333
|
+
embedVersion: "df84716".slice(0, 7),
|
|
20282
20334
|
embedSettings: adaSettings
|
|
20283
20335
|
});
|
|
20284
20336
|
|
|
@@ -20366,7 +20418,7 @@ class ChatFrame extends d {
|
|
|
20366
20418
|
const hostPageUrlParams = new URL(window.location.href).searchParams;
|
|
20367
20419
|
const smsToken = hostPageUrlParams.get("adaSMSToken");
|
|
20368
20420
|
const queryParams = {
|
|
20369
|
-
embedVersion: "
|
|
20421
|
+
embedVersion: "df84716".slice(0, 7),
|
|
20370
20422
|
greeting,
|
|
20371
20423
|
language,
|
|
20372
20424
|
skipGreeting,
|