@ada-support/embed2 1.14.22 → 1.14.24
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,3 +1,4 @@
|
|
|
1
1
|
export declare function getProcessedPath(path: string): string;
|
|
2
2
|
export declare function getPathSearchRegex(path: string): RegExp;
|
|
3
|
+
export declare const stripTrailingSlash: (value: string) => string;
|
|
3
4
|
export declare function doesUrlMatchPath(url: string, path: string): boolean;
|
package/dist/npm-entry/index.js
CHANGED
|
@@ -16119,7 +16119,7 @@ const client = new BrowserClient({
|
|
|
16119
16119
|
return event;
|
|
16120
16120
|
},
|
|
16121
16121
|
environment: "production",
|
|
16122
|
-
release: "1.14.
|
|
16122
|
+
release: "1.14.24-b964ecf",
|
|
16123
16123
|
sampleRate: 0.25,
|
|
16124
16124
|
autoSessionTracking: false,
|
|
16125
16125
|
// Integrations don't seem to work with Sentry: https://github.com/getsentry/sentry-javascript/issues/2541
|
|
@@ -16750,7 +16750,7 @@ function getEmbedURL(_ref) {
|
|
|
16750
16750
|
} else {
|
|
16751
16751
|
host = `http://${handle}.localhost:${ports.localhost.default}`;
|
|
16752
16752
|
}
|
|
16753
|
-
return `${host}/embed/${frameName}/${"
|
|
16753
|
+
return `${host}/embed/${frameName}/${"b964ecf"}/index.html`;
|
|
16754
16754
|
}
|
|
16755
16755
|
function constructQueryString(query) {
|
|
16756
16756
|
return Object.keys(query).map(key => {
|
|
@@ -17586,9 +17586,9 @@ async function log(message, extra, options) {
|
|
|
17586
17586
|
service: "embed",
|
|
17587
17587
|
env: "production",
|
|
17588
17588
|
embedVersion: 2,
|
|
17589
|
-
version: "1.14.
|
|
17589
|
+
version: "1.14.24",
|
|
17590
17590
|
isNpm: true,
|
|
17591
|
-
commitHash: "
|
|
17591
|
+
commitHash: "b964ecf"
|
|
17592
17592
|
}))
|
|
17593
17593
|
});
|
|
17594
17594
|
}
|
|
@@ -17597,34 +17597,48 @@ function getProcessedPath(path) {
|
|
|
17597
17597
|
const regex = /^http(s)?:\/\/(www.)?/;
|
|
17598
17598
|
return path.trim().replace(regex, "");
|
|
17599
17599
|
}
|
|
17600
|
+
|
|
17601
|
+
// Only "*" is a wildcard ("match anything"); every other character — including
|
|
17602
|
+
// regex metacharacters in a customer URL like "." or "(" — is matched literally,
|
|
17603
|
+
// so they are escaped rather than interpreted (or throwing on an unbalanced "("
|
|
17604
|
+
// or a trailing "\").
|
|
17605
|
+
function escapeLiteralsExpandWildcards(value) {
|
|
17606
|
+
return value.replace(/[.+?^${}()|[\]\\]/g, "\\$&").replace(/\*/g, ".*");
|
|
17607
|
+
}
|
|
17600
17608
|
function getPathSearchRegex(path) {
|
|
17601
17609
|
const params = path.split("?");
|
|
17602
17610
|
if (params.length > 1) {
|
|
17603
|
-
|
|
17604
|
-
|
|
17611
|
+
// The pre-"?" half needs the same escaping as the wildcard branch below: an
|
|
17612
|
+
// unescaped "|" here is a top-level alternation, which discards the "^…$"
|
|
17613
|
+
// anchoring and silently widens the condition to a prefix wildcard.
|
|
17614
|
+
const escapedPath = escapeLiteralsExpandWildcards(params[0]);
|
|
17615
|
+
return new RegExp(`^${escapedPath}\\?${escapeLiteralsExpandWildcards(params[1])}$`);
|
|
17605
17616
|
}
|
|
17606
17617
|
|
|
17607
|
-
//
|
|
17608
|
-
// regex metacharacters in a customer URL like "." or "(" — is matched literally,
|
|
17609
|
-
// so they are escaped rather than interpreted (or throwing on an unbalanced "("
|
|
17610
|
-
// or a trailing "\"). A trailing "/*" is optional: "/help/*" also matches "/help"
|
|
17611
|
-
// with nothing after it.
|
|
17618
|
+
// A trailing "/*" is optional: "/help/*" also matches "/help" with nothing after it.
|
|
17612
17619
|
const hasTrailingWildcard = path.endsWith("/*");
|
|
17613
17620
|
const base = hasTrailingWildcard ? path.slice(0, -2) : path;
|
|
17614
|
-
const escaped = base
|
|
17621
|
+
const escaped = escapeLiteralsExpandWildcards(base);
|
|
17615
17622
|
const newPath = hasTrailingWildcard ? `${escaped}(/.*)?` : escaped;
|
|
17616
17623
|
return new RegExp(`^${newPath}$`);
|
|
17617
17624
|
}
|
|
17625
|
+
|
|
17626
|
+
// A trailing slash is not significant. docs.ada.cx documents "Exactly Matches" as matching
|
|
17627
|
+
// `https://www.example.com/checkout/` for a `https://www.example.com/checkout` condition,
|
|
17628
|
+
// and the `ends-with` arm in TriggerConditionEvaluator already tolerates one the same way —
|
|
17629
|
+
// so `equals` requiring an exact slash was the odd one out, not the documented behaviour.
|
|
17630
|
+
const stripTrailingSlash = value => value.endsWith("/") ? value.slice(0, -1) : value;
|
|
17618
17631
|
function doesUrlMatchPath(url, path) {
|
|
17619
|
-
|
|
17620
|
-
|
|
17632
|
+
// Normalized on BOTH sides, so it does not matter which of the page URL or the authored
|
|
17633
|
+
// condition carries the slash.
|
|
17634
|
+
const processedUrl = stripTrailingSlash(getProcessedPath(url));
|
|
17635
|
+
const processedPath = stripTrailingSlash(getProcessedPath(path));
|
|
17621
17636
|
const pathRegex = getPathSearchRegex(processedPath);
|
|
17622
17637
|
const matches = pathRegex.exec(processedUrl);
|
|
17623
17638
|
return matches !== null;
|
|
17624
17639
|
}
|
|
17625
17640
|
;// ./src/common/helpers/TriggerConditionEvaluator.ts
|
|
17626
17641
|
|
|
17627
|
-
const stripTrailingSlash = url => url.endsWith("/") ? url.slice(0, -1) : url;
|
|
17628
17642
|
const evalUrlMatchTriggerCondition = (triggerConditions, url) => {
|
|
17629
17643
|
/**
|
|
17630
17644
|
* Behaviour
|
|
@@ -20394,7 +20408,7 @@ class ChatFrame extends d {
|
|
|
20394
20408
|
log("Chat frame mount", {
|
|
20395
20409
|
handle,
|
|
20396
20410
|
chatUrl: this.url,
|
|
20397
|
-
embedVersion: "
|
|
20411
|
+
embedVersion: "b964ecf".slice(0, 7),
|
|
20398
20412
|
embedSettings: adaSettings
|
|
20399
20413
|
});
|
|
20400
20414
|
|
|
@@ -20482,7 +20496,7 @@ class ChatFrame extends d {
|
|
|
20482
20496
|
const hostPageUrlParams = new URL(window.location.href).searchParams;
|
|
20483
20497
|
const smsToken = hostPageUrlParams.get("adaSMSToken");
|
|
20484
20498
|
const queryParams = {
|
|
20485
|
-
embedVersion: "
|
|
20499
|
+
embedVersion: "b964ecf".slice(0, 7),
|
|
20486
20500
|
greeting,
|
|
20487
20501
|
language,
|
|
20488
20502
|
skipGreeting,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ada-support/embed2",
|
|
3
|
-
"version": "1.14.
|
|
3
|
+
"version": "1.14.24",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/npm-entry",
|
|
6
6
|
"typings": "dist/npm-entry/index-npm.d.ts",
|
|
@@ -115,4 +115,4 @@
|
|
|
115
115
|
"publishConfig": {
|
|
116
116
|
"access": "public"
|
|
117
117
|
}
|
|
118
|
-
}
|
|
118
|
+
}
|