@ada-support/embed2 1.7.17 → 1.7.19

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.
@@ -30,4 +30,5 @@ export declare function getChatURL({ handle, version, cluster, domain, qp, }: {
30
30
  domain?: string;
31
31
  qp?: QueryParams;
32
32
  }): string;
33
+ export declare function escapeUrlParam(param: string): string;
33
34
  export {};
@@ -13260,7 +13260,7 @@ const client = new error_tracker_BrowserClient({
13260
13260
  return event;
13261
13261
  },
13262
13262
  environment: "production",
13263
- release: "1.7.17-b090bf3",
13263
+ release: "1.7.19-581599e",
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}/${"b090bf3"}/index.html`;
13835
+ return `${host}/embed/${frameName}/${"581599e"}/index.html`;
13836
13836
  }
13837
13837
  function constructQueryString(query) {
13838
13838
  return Object.keys(query).map(key => {
@@ -13903,6 +13903,23 @@ function getChatURL(_ref3) {
13903
13903
  }
13904
13904
  return prodUrl;
13905
13905
  }
13906
+ function escapeUrlParam(param) {
13907
+ /**
13908
+ * Escapes a URL parameter to prevent XSS attacks.
13909
+ *
13910
+ * The following characters are escaped:
13911
+ * & is replaced with &, but only if it is not already part of an existing HTML entity (&, <, >, ", ')
13912
+ * < is replaced with &lt;
13913
+ * > is replaced with &gt;
13914
+ * " is replaced with &quot;
13915
+ * ' is replaced with &apos;
13916
+ * / is replaced with &#47;
13917
+ * ? is replaced with &#63;
13918
+ * = is replaced with &#61;
13919
+ * . is replaced with &#46;
13920
+ */
13921
+ return param.replace(/&(?!amp)(?!lt;)(?!gt;)(?!quot)(?!apos;)/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&apos;").replace(/\//g, "&#47;").replace(/\?/g, "&#63;").replace(/=/g, "&#61;").replace(/\./g, "&#46;");
13922
+ }
13906
13923
  ;// CONCATENATED MODULE: ./src/client/store/actions/index.ts
13907
13924
 
13908
13925
 
@@ -14993,9 +15010,9 @@ async function log(message, extra, options) {
14993
15010
  service: "embed",
14994
15011
  env: "production",
14995
15012
  embedVersion: 2,
14996
- version: "1.7.17",
15013
+ version: "1.7.19",
14997
15014
  isNpm: true,
14998
- commitHash: "b090bf3"
15015
+ commitHash: "581599e"
14999
15016
  }))
15000
15017
  });
15001
15018
  }
@@ -15008,6 +15025,7 @@ function alternative_bot_rollout_objectSpread(e) { for (var r = 1; r < arguments
15008
15025
 
15009
15026
 
15010
15027
 
15028
+
15011
15029
  const PRIMARY_BOT_ASSIGNMENT_LABEL = "primary";
15012
15030
  const ALTERNATIVE_BOT_ASSIGNMENT_LABEL = "alternative";
15013
15031
  const BOT_ASSIGNMENT_STORAGE_KEY = "botAssignment";
@@ -15168,7 +15186,11 @@ async function fetchClientUsingAlternativeBotRollout(primaryBotClientObject, alt
15168
15186
  language
15169
15187
  } = adaSettings;
15170
15188
  if (adaBotHandleOverride) {
15171
- const overrideBotClientObject = await fetchClient(adaBotHandleOverride, cluster, domain, language || get_browser_language());
15189
+ const sanitizedAdaBotHandleOverride = escapeUrlParam(adaBotHandleOverride);
15190
+ if (sanitizedAdaBotHandleOverride !== adaBotHandleOverride) {
15191
+ return primaryBotClientObject;
15192
+ }
15193
+ const overrideBotClientObject = await fetchClient(sanitizedAdaBotHandleOverride, cluster, domain, language || get_browser_language());
15172
15194
  if (!overrideBotClientObject) {
15173
15195
  return null;
15174
15196
  }
@@ -16033,7 +16055,7 @@ class ChatFrame extends d {
16033
16055
  const hostPageUrlParams = new URL(window.location.href).searchParams;
16034
16056
  const smsToken = hostPageUrlParams.get("adaSMSToken");
16035
16057
  const queryParams = {
16036
- embedVersion: "b090bf3".slice(0, 7),
16058
+ embedVersion: "581599e".slice(0, 7),
16037
16059
  greeting,
16038
16060
  language,
16039
16061
  skipGreeting,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ada-support/embed2",
3
- "version": "1.7.17",
3
+ "version": "1.7.19",
4
4
  "description": "",
5
5
  "main": "dist/npm-entry",
6
6
  "typings": "dist/npm-entry/index-npm.d.ts",