@ada-support/embed2 1.12.4 → 1.13.1
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,13 +1,15 @@
|
|
|
1
1
|
import type { StartOptions } from "@ada-support/embed-types";
|
|
2
2
|
export type HostTelemetrySurface = "mobile" | "browser";
|
|
3
|
-
export type HostTelemetryPlatform = "ios" | "android" | "
|
|
3
|
+
export type HostTelemetryPlatform = "ios" | "android" | "react-native" | "web" | "unknown";
|
|
4
4
|
export type HostTelemetryWebSdkOrigin = "legacy" | "messaging";
|
|
5
|
+
export type HostTelemetryMobileShell = "messaging-sdk" | "legacy-sdk";
|
|
5
6
|
export interface HostTelemetryContext {
|
|
6
7
|
surface: HostTelemetrySurface;
|
|
7
8
|
hostPlatform: HostTelemetryPlatform;
|
|
8
9
|
webSdkOrigin: HostTelemetryWebSdkOrigin;
|
|
10
|
+
mobileShell?: HostTelemetryMobileShell;
|
|
9
11
|
mobilePackage?: string;
|
|
10
|
-
|
|
12
|
+
mobileVersion?: string;
|
|
11
13
|
}
|
|
12
14
|
export declare const HOST_TELEMETRY_QUERY_PARAM = "ada_host_telemetry";
|
|
13
15
|
type StartOptionsWithHostTelemetry = StartOptions & {
|
|
@@ -4,15 +4,4 @@ export interface Hosts {
|
|
|
4
4
|
export interface Ports {
|
|
5
5
|
[key: string]: number;
|
|
6
6
|
}
|
|
7
|
-
export declare const ports:
|
|
8
|
-
readonly localhost: {
|
|
9
|
-
readonly api: 8000;
|
|
10
|
-
readonly chat: 8002;
|
|
11
|
-
readonly default: 9001;
|
|
12
|
-
};
|
|
13
|
-
readonly e2ereference: {
|
|
14
|
-
readonly api: 8000;
|
|
15
|
-
readonly chat: 8002;
|
|
16
|
-
readonly default: 9001;
|
|
17
|
-
};
|
|
18
|
-
};
|
|
7
|
+
export declare const ports: Hosts;
|
package/dist/npm-entry/index.js
CHANGED
|
@@ -15919,7 +15919,7 @@ const client = new BrowserClient({
|
|
|
15919
15919
|
return event;
|
|
15920
15920
|
},
|
|
15921
15921
|
environment: "production",
|
|
15922
|
-
release: "1.
|
|
15922
|
+
release: "1.13.1-955cc04",
|
|
15923
15923
|
sampleRate: 0.25,
|
|
15924
15924
|
autoSessionTracking: false,
|
|
15925
15925
|
// Integrations don't seem to work with Sentry: https://github.com/getsentry/sentry-javascript/issues/2541
|
|
@@ -16460,16 +16460,23 @@ function httpRequest(obj) {
|
|
|
16460
16460
|
;// CONCATENATED MODULE: ./src/common/helpers/config-info.ts
|
|
16461
16461
|
const isProduction = "production" === "production";
|
|
16462
16462
|
;// CONCATENATED MODULE: ./src/common/helpers/url/constants.ts
|
|
16463
|
+
// These ports are only used in development (localhost URL construction).
|
|
16464
|
+
// Production code paths check `isProduction` first and never read these values.
|
|
16465
|
+
//
|
|
16466
|
+
// The values come from DefinePlugin globals (DEV_API_PORT, DEV_CHAT_PORT,
|
|
16467
|
+
// DEV_FRAMES_PORT) which default to 8000, 8002, 9001 respectively when the
|
|
16468
|
+
// env vars are not set. So running `yarn start` without any env vars produces
|
|
16469
|
+
// the same ports as before — this is not a behavior change for normal dev.
|
|
16463
16470
|
const ports = {
|
|
16464
16471
|
localhost: {
|
|
16465
|
-
api:
|
|
16466
|
-
chat:
|
|
16467
|
-
default:
|
|
16472
|
+
api: Number(DEV_API_PORT),
|
|
16473
|
+
chat: Number(DEV_CHAT_PORT),
|
|
16474
|
+
default: Number(DEV_FRAMES_PORT)
|
|
16468
16475
|
},
|
|
16469
16476
|
e2ereference: {
|
|
16470
|
-
api:
|
|
16471
|
-
chat:
|
|
16472
|
-
default:
|
|
16477
|
+
api: Number(DEV_API_PORT),
|
|
16478
|
+
chat: Number(DEV_CHAT_PORT),
|
|
16479
|
+
default: Number(DEV_FRAMES_PORT)
|
|
16473
16480
|
}
|
|
16474
16481
|
};
|
|
16475
16482
|
;// CONCATENATED MODULE: ./src/common/helpers/url/index.ts
|
|
@@ -16500,9 +16507,9 @@ function getEmbedURL(_ref) {
|
|
|
16500
16507
|
if (isProduction) {
|
|
16501
16508
|
host = `https://${handle}${clusterString}.${domainString}.support`;
|
|
16502
16509
|
} else {
|
|
16503
|
-
host = `http://${handle}.localhost
|
|
16510
|
+
host = `http://${handle}.localhost:${ports.localhost.default}`;
|
|
16504
16511
|
}
|
|
16505
|
-
return `${host}/embed/${frameName}/${"
|
|
16512
|
+
return `${host}/embed/${frameName}/${"955cc04"}/index.html`;
|
|
16506
16513
|
}
|
|
16507
16514
|
function constructQueryString(query) {
|
|
16508
16515
|
return Object.keys(query).map(key => {
|
|
@@ -16566,7 +16573,7 @@ function getChatURL(_ref3) {
|
|
|
16566
16573
|
if (domainName === "localhost") {
|
|
16567
16574
|
// Chat should be on a different domain (even though the port is different).
|
|
16568
16575
|
// We need this to test Embed+Chat behaviour when third-party cookies are disabled (incognito mode).
|
|
16569
|
-
return `${window.location.protocol}//${handle}.chat
|
|
16576
|
+
return `${window.location.protocol}//${handle}.chat:${ports.localhost.chat}/${questionSym}${queryString}`;
|
|
16570
16577
|
}
|
|
16571
16578
|
const host = `${window.location.hostname}:${ports[domainName].chat}`;
|
|
16572
16579
|
return `http://${host}/${questionSym}${queryString}`;
|
|
@@ -17690,9 +17697,9 @@ async function log(message, extra, options) {
|
|
|
17690
17697
|
service: "embed",
|
|
17691
17698
|
env: "production",
|
|
17692
17699
|
embedVersion: 2,
|
|
17693
|
-
version: "1.
|
|
17700
|
+
version: "1.13.1",
|
|
17694
17701
|
isNpm: true,
|
|
17695
|
-
commitHash: "
|
|
17702
|
+
commitHash: "955cc04"
|
|
17696
17703
|
}))
|
|
17697
17704
|
});
|
|
17698
17705
|
}
|
|
@@ -18458,7 +18465,32 @@ const getChatVersionFromManifest = manifest => {
|
|
|
18458
18465
|
dist/* adaLocalStorage */.BB.setItem("ada-embed_chat-manifest-cache", manifestString);
|
|
18459
18466
|
return hash;
|
|
18460
18467
|
};
|
|
18468
|
+
|
|
18469
|
+
// Symmetric with embed-loader's `__ada-embed-version` URL param. The regex
|
|
18470
|
+
// approach mirrors embed-loader so behavior stays aligned across the two
|
|
18471
|
+
// loaders; see embed-loader/source/init.ts.
|
|
18472
|
+
const getURLParam = name => {
|
|
18473
|
+
const escaped = name.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
18474
|
+
const results = new RegExp(`[?&]${escaped}=([^&#]*)`).exec(window.location.href);
|
|
18475
|
+
if (!results) {
|
|
18476
|
+
return null;
|
|
18477
|
+
}
|
|
18478
|
+
try {
|
|
18479
|
+
return decodeURIComponent(results[1]);
|
|
18480
|
+
} catch {
|
|
18481
|
+
// Ignore malformed query overrides instead of breaking embed startup.
|
|
18482
|
+
return null;
|
|
18483
|
+
}
|
|
18484
|
+
};
|
|
18461
18485
|
const getChatVersion = async adaSettings => {
|
|
18486
|
+
// Allow pinning via URL parameter — mirrors embed-loader's
|
|
18487
|
+
// `?__ada-embed-version=<sha>` mechanism, bypasses the dev/dev2/stage
|
|
18488
|
+
// auto-skip below (same override semantics as `window.__AdaChatVersion`).
|
|
18489
|
+
const versionFromURL = getURLParam("__ada-chat-version");
|
|
18490
|
+
if (versionFromURL) {
|
|
18491
|
+
return versionFromURL;
|
|
18492
|
+
}
|
|
18493
|
+
|
|
18462
18494
|
// allow versioning using global variable
|
|
18463
18495
|
if (window.__AdaChatVersion) {
|
|
18464
18496
|
return window.__AdaChatVersion;
|
|
@@ -18468,7 +18500,7 @@ const getChatVersion = async adaSettings => {
|
|
|
18468
18500
|
domain
|
|
18469
18501
|
} = adaSettings;
|
|
18470
18502
|
|
|
18471
|
-
// Skip automatic versioning for ATT and dev/stage clusters but allow override through __AdaChatVersion
|
|
18503
|
+
// Skip automatic versioning for ATT and dev/stage clusters but allow override through __AdaChatVersion or __ada-chat-version
|
|
18472
18504
|
if (cluster === "att" || domain !== null && domain !== void 0 && domain.match(/ada-(dev|dev2|stage)/)) {
|
|
18473
18505
|
return undefined;
|
|
18474
18506
|
}
|
|
@@ -19087,6 +19119,7 @@ const HOST_TELEMETRY_QUERY_PARAM = "ada_host_telemetry";
|
|
|
19087
19119
|
const TRUSTED_MOBILE_SDK_PATH = "/mobile-sdk-webview/";
|
|
19088
19120
|
const MAX_TELEMETRY_TAG_LENGTH = 100;
|
|
19089
19121
|
const TELEMETRY_TAG_VALUE_PATTERN = /^[a-z0-9_-]+$/;
|
|
19122
|
+
const SEMVER_TAG_VALUE_PATTERN = /^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/;
|
|
19090
19123
|
|
|
19091
19124
|
// Private mobile-sdk handshake used only on the trusted /mobile-sdk-webview/ page.
|
|
19092
19125
|
|
|
@@ -19111,9 +19144,8 @@ function normalizeHostPlatform(value) {
|
|
|
19111
19144
|
return "ios";
|
|
19112
19145
|
case "android":
|
|
19113
19146
|
return "android";
|
|
19114
|
-
case "
|
|
19115
|
-
|
|
19116
|
-
return "react_native";
|
|
19147
|
+
case "react-native":
|
|
19148
|
+
return "react-native";
|
|
19117
19149
|
case "web":
|
|
19118
19150
|
return "web";
|
|
19119
19151
|
case "unknown":
|
|
@@ -19128,6 +19160,24 @@ function normalizeOrigin(value) {
|
|
|
19128
19160
|
}
|
|
19129
19161
|
return undefined;
|
|
19130
19162
|
}
|
|
19163
|
+
function normalizeMobileShell(value) {
|
|
19164
|
+
if (typeof value !== "string") {
|
|
19165
|
+
return undefined;
|
|
19166
|
+
}
|
|
19167
|
+
|
|
19168
|
+
// Accept both separator styles defensively, but normalize everything this
|
|
19169
|
+
// helper emits back to the canonical kebab-case tags.
|
|
19170
|
+
switch (value.trim().toLowerCase()) {
|
|
19171
|
+
case "messaging_sdk":
|
|
19172
|
+
case "messaging-sdk":
|
|
19173
|
+
return "messaging-sdk";
|
|
19174
|
+
case "legacy_sdk":
|
|
19175
|
+
case "legacy-sdk":
|
|
19176
|
+
return "legacy-sdk";
|
|
19177
|
+
default:
|
|
19178
|
+
return undefined;
|
|
19179
|
+
}
|
|
19180
|
+
}
|
|
19131
19181
|
function normalizeTelemetryTagValue(value) {
|
|
19132
19182
|
if (typeof value !== "string") {
|
|
19133
19183
|
return undefined;
|
|
@@ -19138,11 +19188,21 @@ function normalizeTelemetryTagValue(value) {
|
|
|
19138
19188
|
}
|
|
19139
19189
|
return normalizedValue;
|
|
19140
19190
|
}
|
|
19141
|
-
function
|
|
19142
|
-
if (
|
|
19191
|
+
function normalizeMobileVersion(value) {
|
|
19192
|
+
if (typeof value !== "string") {
|
|
19193
|
+
return undefined;
|
|
19194
|
+
}
|
|
19195
|
+
const trimmedValue = value.trim();
|
|
19196
|
+
if (trimmedValue.length > MAX_TELEMETRY_TAG_LENGTH || !SEMVER_TAG_VALUE_PATTERN.test(trimmedValue)) {
|
|
19143
19197
|
return undefined;
|
|
19144
19198
|
}
|
|
19145
|
-
return
|
|
19199
|
+
return trimmedValue;
|
|
19200
|
+
}
|
|
19201
|
+
function deriveMessagingMobileShell(mobilePackage) {
|
|
19202
|
+
return mobilePackage ? "messaging-sdk" : undefined;
|
|
19203
|
+
}
|
|
19204
|
+
function deriveLegacyMobileShell(surface, hostPlatform) {
|
|
19205
|
+
return surface === "mobile" && hostPlatform !== "web" ? "legacy-sdk" : undefined;
|
|
19146
19206
|
}
|
|
19147
19207
|
function normalizeHostTelemetry(value) {
|
|
19148
19208
|
const record = asRecord(value);
|
|
@@ -19153,18 +19213,21 @@ function normalizeHostTelemetry(value) {
|
|
|
19153
19213
|
const hostPlatform = normalizeHostPlatform(record.hostPlatform);
|
|
19154
19214
|
const webSdkOrigin = normalizeOrigin(record.webSdkOrigin);
|
|
19155
19215
|
const mobilePackage = normalizeTelemetryTagValue(record.mobilePackage);
|
|
19216
|
+
const mobileVersion = normalizeMobileVersion(record.mobileVersion);
|
|
19156
19217
|
if (!surface || !hostPlatform || !webSdkOrigin) {
|
|
19157
19218
|
return undefined;
|
|
19158
19219
|
}
|
|
19159
|
-
const
|
|
19160
|
-
return host_telemetry_objectSpread(host_telemetry_objectSpread({
|
|
19220
|
+
const mobileShell = deriveMessagingMobileShell(mobilePackage) ?? normalizeMobileShell(record.mobileShell);
|
|
19221
|
+
return host_telemetry_objectSpread(host_telemetry_objectSpread(host_telemetry_objectSpread({
|
|
19161
19222
|
surface,
|
|
19162
19223
|
hostPlatform,
|
|
19163
19224
|
webSdkOrigin
|
|
19164
|
-
},
|
|
19225
|
+
}, mobileShell ? {
|
|
19226
|
+
mobileShell
|
|
19227
|
+
} : {}), mobilePackage ? {
|
|
19165
19228
|
mobilePackage
|
|
19166
|
-
} : {}),
|
|
19167
|
-
|
|
19229
|
+
} : {}), mobileVersion ? {
|
|
19230
|
+
mobileVersion
|
|
19168
19231
|
} : {});
|
|
19169
19232
|
}
|
|
19170
19233
|
function isTrustedMobileSdkHostPage() {
|
|
@@ -19174,37 +19237,46 @@ function isTrustedMobileSdkHostPage() {
|
|
|
19174
19237
|
function resolveHostTelemetryFromStartOptions(adaSettings) {
|
|
19175
19238
|
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
19176
19239
|
const trustedMobileSdkHostPage = isTrustedMobileSdkHostPage(options.pathname);
|
|
19177
|
-
|
|
19240
|
+
// Treat the presence of the hostTelemetry property as authoritative, even if
|
|
19241
|
+
// normalization fails, so broken new-wrapper payloads are not downgraded
|
|
19242
|
+
// into the legacy mobile-shell bucket.
|
|
19243
|
+
const hasExplicitHostTelemetry = trustedMobileSdkHostPage && Object.prototype.hasOwnProperty.call(adaSettings, "hostTelemetry");
|
|
19244
|
+
const explicit = hasExplicitHostTelemetry ? normalizeHostTelemetry(adaSettings.hostTelemetry) : undefined;
|
|
19178
19245
|
const webSdkOrigin = (explicit === null || explicit === void 0 ? void 0 : explicit.webSdkOrigin) ?? "legacy";
|
|
19179
19246
|
const hostPlatform = (explicit === null || explicit === void 0 ? void 0 : explicit.hostPlatform) ?? (trustedMobileSdkHostPage ? "unknown" : "web");
|
|
19180
19247
|
const surface = (explicit === null || explicit === void 0 ? void 0 : explicit.surface) ?? (trustedMobileSdkHostPage ? "mobile" : "browser");
|
|
19181
19248
|
const mobilePackage = explicit === null || explicit === void 0 ? void 0 : explicit.mobilePackage;
|
|
19182
|
-
const
|
|
19183
|
-
|
|
19249
|
+
const mobileVersion = explicit === null || explicit === void 0 ? void 0 : explicit.mobileVersion;
|
|
19250
|
+
const mobileShell = deriveMessagingMobileShell(mobilePackage) ?? (explicit === null || explicit === void 0 ? void 0 : explicit.mobileShell) ?? (!hasExplicitHostTelemetry ? deriveLegacyMobileShell(surface, hostPlatform) : undefined);
|
|
19251
|
+
return host_telemetry_objectSpread(host_telemetry_objectSpread(host_telemetry_objectSpread({
|
|
19184
19252
|
surface,
|
|
19185
19253
|
hostPlatform,
|
|
19186
19254
|
webSdkOrigin
|
|
19187
|
-
},
|
|
19255
|
+
}, mobileShell ? {
|
|
19256
|
+
mobileShell
|
|
19257
|
+
} : {}), mobilePackage ? {
|
|
19188
19258
|
mobilePackage
|
|
19189
|
-
} : {}),
|
|
19190
|
-
|
|
19259
|
+
} : {}), mobileVersion ? {
|
|
19260
|
+
mobileVersion
|
|
19191
19261
|
} : {});
|
|
19192
19262
|
}
|
|
19193
19263
|
function serializeHostTelemetry(hostTelemetry) {
|
|
19194
19264
|
return JSON.stringify(hostTelemetry);
|
|
19195
19265
|
}
|
|
19196
19266
|
function shouldPropagateHostTelemetry(hostTelemetry) {
|
|
19197
|
-
return hostTelemetry.surface !== "browser" || hostTelemetry.hostPlatform !== "web" || hostTelemetry.webSdkOrigin !== "legacy" || Boolean(hostTelemetry.mobilePackage) || Boolean(hostTelemetry.
|
|
19267
|
+
return hostTelemetry.surface !== "browser" || hostTelemetry.hostPlatform !== "web" || hostTelemetry.webSdkOrigin !== "legacy" || Boolean(hostTelemetry.mobileShell) || Boolean(hostTelemetry.mobilePackage) || Boolean(hostTelemetry.mobileVersion);
|
|
19198
19268
|
}
|
|
19199
19269
|
function toMonitoringContext(hostTelemetry) {
|
|
19200
|
-
return host_telemetry_objectSpread(host_telemetry_objectSpread({
|
|
19270
|
+
return host_telemetry_objectSpread(host_telemetry_objectSpread(host_telemetry_objectSpread({
|
|
19201
19271
|
surface: hostTelemetry.surface,
|
|
19202
19272
|
host_platform: hostTelemetry.hostPlatform,
|
|
19203
19273
|
web_sdk_origin: hostTelemetry.webSdkOrigin
|
|
19204
|
-
}, hostTelemetry.
|
|
19274
|
+
}, hostTelemetry.mobileShell ? {
|
|
19275
|
+
mobile_shell: hostTelemetry.mobileShell
|
|
19276
|
+
} : {}), hostTelemetry.mobilePackage ? {
|
|
19205
19277
|
mobile_package: hostTelemetry.mobilePackage
|
|
19206
|
-
} : {}), hostTelemetry.
|
|
19207
|
-
|
|
19278
|
+
} : {}), hostTelemetry.mobileVersion ? {
|
|
19279
|
+
mobile_version: hostTelemetry.mobileVersion
|
|
19208
19280
|
} : {});
|
|
19209
19281
|
}
|
|
19210
19282
|
;// CONCATENATED MODULE: ./src/common/helpers/is-mobile.ts
|
|
@@ -19428,7 +19500,7 @@ class ChatFrame extends preact_module_d {
|
|
|
19428
19500
|
log("Chat frame mount", {
|
|
19429
19501
|
handle,
|
|
19430
19502
|
chatUrl: this.url,
|
|
19431
|
-
embedVersion: "
|
|
19503
|
+
embedVersion: "955cc04".slice(0, 7),
|
|
19432
19504
|
embedSettings: adaSettings
|
|
19433
19505
|
});
|
|
19434
19506
|
|
|
@@ -19516,7 +19588,7 @@ class ChatFrame extends preact_module_d {
|
|
|
19516
19588
|
const hostPageUrlParams = new URL(window.location.href).searchParams;
|
|
19517
19589
|
const smsToken = hostPageUrlParams.get("adaSMSToken");
|
|
19518
19590
|
const queryParams = {
|
|
19519
|
-
embedVersion: "
|
|
19591
|
+
embedVersion: "955cc04".slice(0, 7),
|
|
19520
19592
|
greeting,
|
|
19521
19593
|
language,
|
|
19522
19594
|
skipGreeting,
|