@ada-support/embed2 1.7.8 → 1.7.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.
|
@@ -1 +1,15 @@
|
|
|
1
|
+
export declare function storeRollout(handle: string, group: "A" | "B", lastProb: number): void;
|
|
2
|
+
/** The logic below determines whether or not the chat button is visible if the rollout is not 100%
|
|
3
|
+
* GROUP A - DOES NOT SEE CHAT BUTTON
|
|
4
|
+
* GROUP B - SEE'S CHAT BUTTON
|
|
5
|
+
*
|
|
6
|
+
* First we check if the rollout is either 100% or 0%. In either of these cases we do not need to check the probability score to determine their grouping.
|
|
7
|
+
* - If the rollout is 100% we put the user in group B and they see the button.
|
|
8
|
+
* - If the rollout is 0% we put the user in group A and they do not see the button.
|
|
9
|
+
* - If the rollout is between 0% and 100% we need to check the probability score to determine their grouping and store the result.
|
|
10
|
+
*
|
|
11
|
+
* - If the user has not been put in a group yet we need to put them in a group and store the result.
|
|
12
|
+
* - If the user has already been put in a group and the rollout has not changed we do not need to move them.
|
|
13
|
+
* - If the user has already been put in a group and the rollout has changed we need to check if they should be moved to the other group and store the result.
|
|
14
|
+
*/
|
|
1
15
|
export declare function checkRollout(rollout: number, handle: string): boolean;
|
package/dist/npm-entry/index.js
CHANGED
|
@@ -13260,7 +13260,7 @@ const client = new error_tracker_BrowserClient({
|
|
|
13260
13260
|
return event;
|
|
13261
13261
|
},
|
|
13262
13262
|
environment: "production",
|
|
13263
|
-
release: "1.7.
|
|
13263
|
+
release: "1.7.10-5537610",
|
|
13264
13264
|
sampleRate: 0.25,
|
|
13265
13265
|
autoSessionTracking: false,
|
|
13266
13266
|
// Integrations don't seem to work with Sentry: https://github.com/getsentry/sentry-javascript/issues/2541
|
|
@@ -13832,7 +13832,7 @@ function getEmbedURL(_ref) {
|
|
|
13832
13832
|
} else {
|
|
13833
13833
|
host = `http://${handle}.localhost:9001`;
|
|
13834
13834
|
}
|
|
13835
|
-
return `${host}/embed/${frameName}/${"
|
|
13835
|
+
return `${host}/embed/${frameName}/${"5537610"}/index.html`;
|
|
13836
13836
|
}
|
|
13837
13837
|
function constructQueryString(query) {
|
|
13838
13838
|
return Object.keys(query).map(key => {
|
|
@@ -14993,9 +14993,9 @@ async function log(message, extra, options) {
|
|
|
14993
14993
|
service: "embed",
|
|
14994
14994
|
env: "production",
|
|
14995
14995
|
embedVersion: 2,
|
|
14996
|
-
version: "1.7.
|
|
14996
|
+
version: "1.7.10",
|
|
14997
14997
|
isNpm: true,
|
|
14998
|
-
commitHash: "
|
|
14998
|
+
commitHash: "5537610"
|
|
14999
14999
|
}))
|
|
15000
15000
|
});
|
|
15001
15001
|
}
|
|
@@ -15221,6 +15221,7 @@ function unbindLocationChangeOverrides() {
|
|
|
15221
15221
|
function rollout_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; }
|
|
15222
15222
|
function rollout_objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? rollout_ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : rollout_ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
15223
15223
|
|
|
15224
|
+
|
|
15224
15225
|
function storeRollout(handle, group, lastProb) {
|
|
15225
15226
|
dist/* adaLocalStorage.setFnItem */.wG.setFnItem("rolloutGroup", rollout_objectSpread(rollout_objectSpread({}, dist/* adaLocalStorage.getFnItem */.wG.getFnItem("rolloutGroup")), {}, {
|
|
15226
15227
|
[handle]: group
|
|
@@ -15245,64 +15246,71 @@ function readRollout(handle) {
|
|
|
15245
15246
|
rollout.lastProb = (dist/* adaLocalStorage.getFnItem */.wG.getFnItem("rolloutLastValue") || {})[handle] || null;
|
|
15246
15247
|
return rollout;
|
|
15247
15248
|
}
|
|
15249
|
+
|
|
15250
|
+
/** The logic below determines whether or not the chat button is visible if the rollout is not 100%
|
|
15251
|
+
* GROUP A - DOES NOT SEE CHAT BUTTON
|
|
15252
|
+
* GROUP B - SEE'S CHAT BUTTON
|
|
15253
|
+
*
|
|
15254
|
+
* First we check if the rollout is either 100% or 0%. In either of these cases we do not need to check the probability score to determine their grouping.
|
|
15255
|
+
* - If the rollout is 100% we put the user in group B and they see the button.
|
|
15256
|
+
* - If the rollout is 0% we put the user in group A and they do not see the button.
|
|
15257
|
+
* - If the rollout is between 0% and 100% we need to check the probability score to determine their grouping and store the result.
|
|
15258
|
+
*
|
|
15259
|
+
* - If the user has not been put in a group yet we need to put them in a group and store the result.
|
|
15260
|
+
* - If the user has already been put in a group and the rollout has not changed we do not need to move them.
|
|
15261
|
+
* - If the user has already been put in a group and the rollout has changed we need to check if they should be moved to the other group and store the result.
|
|
15262
|
+
*/
|
|
15248
15263
|
function checkRollout(rollout, handle) {
|
|
15249
|
-
|
|
15250
|
-
|
|
15251
|
-
|
|
15252
|
-
|
|
15253
|
-
|
|
15254
|
-
|
|
15255
|
-
|
|
15256
|
-
|
|
15257
|
-
|
|
15258
|
-
|
|
15259
|
-
|
|
15260
|
-
|
|
15261
|
-
|
|
15262
|
-
|
|
15263
|
-
|
|
15264
|
-
|
|
15265
|
-
|
|
15266
|
-
|
|
15267
|
-
|
|
15268
|
-
|
|
15269
|
-
|
|
15270
|
-
|
|
15271
|
-
|
|
15272
|
-
|
|
15273
|
-
|
|
15274
|
-
|
|
15275
|
-
|
|
15276
|
-
|
|
15277
|
-
|
|
15278
|
-
|
|
15279
|
-
|
|
15280
|
-
|
|
15281
|
-
|
|
15282
|
-
|
|
15283
|
-
|
|
15284
|
-
|
|
15285
|
-
|
|
15286
|
-
|
|
15287
|
-
|
|
15288
|
-
|
|
15289
|
-
|
|
15290
|
-
|
|
15291
|
-
|
|
15292
|
-
|
|
15293
|
-
|
|
15294
|
-
|
|
15295
|
-
return shouldMove;
|
|
15296
|
-
}
|
|
15297
|
-
}
|
|
15298
|
-
} else {
|
|
15299
|
-
// Probability is the same as before.
|
|
15300
|
-
return rg.group === "B";
|
|
15301
|
-
}
|
|
15302
|
-
}
|
|
15264
|
+
// Get current rollout percentage in browser storage
|
|
15265
|
+
const userRolloutGroup = readRollout(handle);
|
|
15266
|
+
|
|
15267
|
+
// If somehow the rollout doesn't fall within the 0% to 100% range - just show the button
|
|
15268
|
+
if (rollout < 0 || rollout > 1) {
|
|
15269
|
+
warn("Rollout value must be between 0 and 1 - defaulting to 1");
|
|
15270
|
+
return true;
|
|
15271
|
+
}
|
|
15272
|
+
|
|
15273
|
+
// If rollout is 1 or 0 - just check if we should show the button or not and store the result
|
|
15274
|
+
// This also acts as a reset if someone accidentally gets put in group A but the rollout changed to
|
|
15275
|
+
// 100% - they will now be put in group B
|
|
15276
|
+
if (rollout === 1 || rollout === 0) {
|
|
15277
|
+
const group = rollout ? "B" : "A";
|
|
15278
|
+
storeRollout(handle, group, rollout);
|
|
15279
|
+
return group === "B";
|
|
15280
|
+
}
|
|
15281
|
+
|
|
15282
|
+
// If the user has already been put in a group and it hasn't changed - don't move them
|
|
15283
|
+
if (rollout === userRolloutGroup.lastProb) {
|
|
15284
|
+
return userRolloutGroup.group === "B";
|
|
15285
|
+
}
|
|
15286
|
+
|
|
15287
|
+
// Generate a random number to test against the probability score
|
|
15288
|
+
const rand = Math.random();
|
|
15289
|
+
|
|
15290
|
+
// If the user has not been put in a group yet - test against the probability score to determine their group and assign it to them
|
|
15291
|
+
if (userRolloutGroup.group === null || userRolloutGroup.lastProb === 0) {
|
|
15292
|
+
const roll = rand <= rollout;
|
|
15293
|
+
const group = roll ? "B" : "A";
|
|
15294
|
+
storeRollout(handle, group, rollout);
|
|
15295
|
+
return roll;
|
|
15296
|
+
}
|
|
15297
|
+
|
|
15298
|
+
// If we got here the rollout value has changed and is either higher or lower than the previous value
|
|
15299
|
+
if (userRolloutGroup.lastProb !== null && rollout > 0) {
|
|
15300
|
+
// If the rollout is higher than previous we want to test against the probability score to see if they get upgraded to group B
|
|
15301
|
+
// If the rollout is lower than previous we want to test against the probability score to see if they get downgraded to group A
|
|
15302
|
+
const adjustedProb = rollout > userRolloutGroup.lastProb ? 1 - userRolloutGroup.lastProb / rollout // This is the math to see if the user gets upgraded to group B
|
|
15303
|
+
: 1 - rollout / userRolloutGroup.lastProb; // This is the math to see if the user gets downgraded to group A
|
|
15304
|
+
|
|
15305
|
+
// If the random number is less than or equal to the adjusted probability score - we will upgrade the user to group B, otherwise they will go to group A
|
|
15306
|
+
const shouldBeVisible = rand <= adjustedProb;
|
|
15307
|
+
const group = shouldBeVisible ? "B" : "A";
|
|
15308
|
+
storeRollout(handle, group, rollout);
|
|
15309
|
+
return shouldBeVisible;
|
|
15303
15310
|
}
|
|
15304
15311
|
|
|
15305
|
-
//
|
|
15312
|
+
// If all else fails show the button
|
|
15313
|
+
warn("Unable to detemrine rollout group - defaulting to showing chat button");
|
|
15306
15314
|
return true;
|
|
15307
15315
|
}
|
|
15308
15316
|
;// CONCATENATED MODULE: ./src/client/helpers/web-notifications/web-notification-events.ts
|
|
@@ -16016,7 +16024,7 @@ class ChatFrame extends d {
|
|
|
16016
16024
|
const hostPageUrlParams = new URL(window.location.href).searchParams;
|
|
16017
16025
|
const smsToken = hostPageUrlParams.get("adaSMSToken");
|
|
16018
16026
|
const queryParams = {
|
|
16019
|
-
embedVersion: "
|
|
16027
|
+
embedVersion: "5537610".slice(0, 7),
|
|
16020
16028
|
greeting,
|
|
16021
16029
|
language,
|
|
16022
16030
|
skipGreeting,
|
|
@@ -17575,7 +17583,8 @@ class Container extends d {
|
|
|
17575
17583
|
return;
|
|
17576
17584
|
}
|
|
17577
17585
|
const primaryBotClient = new Client(clientResponse.client);
|
|
17578
|
-
const
|
|
17586
|
+
const rolloutPercentage = rolloutOverride !== undefined ? rolloutOverride : primaryBotClient.rollout;
|
|
17587
|
+
const shouldHideEmbedButton = !checkRollout(rolloutPercentage, primaryBotClient.handle);
|
|
17579
17588
|
|
|
17580
17589
|
// if there is a bot override handle in the URL, we should ignore the primary rollout which determines whether any embed button is shown
|
|
17581
17590
|
if (shouldHideEmbedButton && !getBotOverrideHandleFromWebpageURL()) {
|