@ada-support/embed2 1.13.0 → 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 & {
|
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.13.
|
|
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
|
|
@@ -16509,7 +16509,7 @@ function getEmbedURL(_ref) {
|
|
|
16509
16509
|
} else {
|
|
16510
16510
|
host = `http://${handle}.localhost:${ports.localhost.default}`;
|
|
16511
16511
|
}
|
|
16512
|
-
return `${host}/embed/${frameName}/${"
|
|
16512
|
+
return `${host}/embed/${frameName}/${"955cc04"}/index.html`;
|
|
16513
16513
|
}
|
|
16514
16514
|
function constructQueryString(query) {
|
|
16515
16515
|
return Object.keys(query).map(key => {
|
|
@@ -17697,9 +17697,9 @@ async function log(message, extra, options) {
|
|
|
17697
17697
|
service: "embed",
|
|
17698
17698
|
env: "production",
|
|
17699
17699
|
embedVersion: 2,
|
|
17700
|
-
version: "1.13.
|
|
17700
|
+
version: "1.13.1",
|
|
17701
17701
|
isNpm: true,
|
|
17702
|
-
commitHash: "
|
|
17702
|
+
commitHash: "955cc04"
|
|
17703
17703
|
}))
|
|
17704
17704
|
});
|
|
17705
17705
|
}
|
|
@@ -18465,7 +18465,32 @@ const getChatVersionFromManifest = manifest => {
|
|
|
18465
18465
|
dist/* adaLocalStorage */.BB.setItem("ada-embed_chat-manifest-cache", manifestString);
|
|
18466
18466
|
return hash;
|
|
18467
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
|
+
};
|
|
18468
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
|
+
|
|
18469
18494
|
// allow versioning using global variable
|
|
18470
18495
|
if (window.__AdaChatVersion) {
|
|
18471
18496
|
return window.__AdaChatVersion;
|
|
@@ -18475,7 +18500,7 @@ const getChatVersion = async adaSettings => {
|
|
|
18475
18500
|
domain
|
|
18476
18501
|
} = adaSettings;
|
|
18477
18502
|
|
|
18478
|
-
// 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
|
|
18479
18504
|
if (cluster === "att" || domain !== null && domain !== void 0 && domain.match(/ada-(dev|dev2|stage)/)) {
|
|
18480
18505
|
return undefined;
|
|
18481
18506
|
}
|
|
@@ -19094,6 +19119,7 @@ const HOST_TELEMETRY_QUERY_PARAM = "ada_host_telemetry";
|
|
|
19094
19119
|
const TRUSTED_MOBILE_SDK_PATH = "/mobile-sdk-webview/";
|
|
19095
19120
|
const MAX_TELEMETRY_TAG_LENGTH = 100;
|
|
19096
19121
|
const TELEMETRY_TAG_VALUE_PATTERN = /^[a-z0-9_-]+$/;
|
|
19122
|
+
const SEMVER_TAG_VALUE_PATTERN = /^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/;
|
|
19097
19123
|
|
|
19098
19124
|
// Private mobile-sdk handshake used only on the trusted /mobile-sdk-webview/ page.
|
|
19099
19125
|
|
|
@@ -19118,9 +19144,8 @@ function normalizeHostPlatform(value) {
|
|
|
19118
19144
|
return "ios";
|
|
19119
19145
|
case "android":
|
|
19120
19146
|
return "android";
|
|
19121
|
-
case "
|
|
19122
|
-
|
|
19123
|
-
return "react_native";
|
|
19147
|
+
case "react-native":
|
|
19148
|
+
return "react-native";
|
|
19124
19149
|
case "web":
|
|
19125
19150
|
return "web";
|
|
19126
19151
|
case "unknown":
|
|
@@ -19135,6 +19160,24 @@ function normalizeOrigin(value) {
|
|
|
19135
19160
|
}
|
|
19136
19161
|
return undefined;
|
|
19137
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
|
+
}
|
|
19138
19181
|
function normalizeTelemetryTagValue(value) {
|
|
19139
19182
|
if (typeof value !== "string") {
|
|
19140
19183
|
return undefined;
|
|
@@ -19145,11 +19188,21 @@ function normalizeTelemetryTagValue(value) {
|
|
|
19145
19188
|
}
|
|
19146
19189
|
return normalizedValue;
|
|
19147
19190
|
}
|
|
19148
|
-
function
|
|
19149
|
-
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)) {
|
|
19150
19197
|
return undefined;
|
|
19151
19198
|
}
|
|
19152
|
-
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;
|
|
19153
19206
|
}
|
|
19154
19207
|
function normalizeHostTelemetry(value) {
|
|
19155
19208
|
const record = asRecord(value);
|
|
@@ -19160,18 +19213,21 @@ function normalizeHostTelemetry(value) {
|
|
|
19160
19213
|
const hostPlatform = normalizeHostPlatform(record.hostPlatform);
|
|
19161
19214
|
const webSdkOrigin = normalizeOrigin(record.webSdkOrigin);
|
|
19162
19215
|
const mobilePackage = normalizeTelemetryTagValue(record.mobilePackage);
|
|
19216
|
+
const mobileVersion = normalizeMobileVersion(record.mobileVersion);
|
|
19163
19217
|
if (!surface || !hostPlatform || !webSdkOrigin) {
|
|
19164
19218
|
return undefined;
|
|
19165
19219
|
}
|
|
19166
|
-
const
|
|
19167
|
-
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({
|
|
19168
19222
|
surface,
|
|
19169
19223
|
hostPlatform,
|
|
19170
19224
|
webSdkOrigin
|
|
19171
|
-
},
|
|
19225
|
+
}, mobileShell ? {
|
|
19226
|
+
mobileShell
|
|
19227
|
+
} : {}), mobilePackage ? {
|
|
19172
19228
|
mobilePackage
|
|
19173
|
-
} : {}),
|
|
19174
|
-
|
|
19229
|
+
} : {}), mobileVersion ? {
|
|
19230
|
+
mobileVersion
|
|
19175
19231
|
} : {});
|
|
19176
19232
|
}
|
|
19177
19233
|
function isTrustedMobileSdkHostPage() {
|
|
@@ -19181,37 +19237,46 @@ function isTrustedMobileSdkHostPage() {
|
|
|
19181
19237
|
function resolveHostTelemetryFromStartOptions(adaSettings) {
|
|
19182
19238
|
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
19183
19239
|
const trustedMobileSdkHostPage = isTrustedMobileSdkHostPage(options.pathname);
|
|
19184
|
-
|
|
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;
|
|
19185
19245
|
const webSdkOrigin = (explicit === null || explicit === void 0 ? void 0 : explicit.webSdkOrigin) ?? "legacy";
|
|
19186
19246
|
const hostPlatform = (explicit === null || explicit === void 0 ? void 0 : explicit.hostPlatform) ?? (trustedMobileSdkHostPage ? "unknown" : "web");
|
|
19187
19247
|
const surface = (explicit === null || explicit === void 0 ? void 0 : explicit.surface) ?? (trustedMobileSdkHostPage ? "mobile" : "browser");
|
|
19188
19248
|
const mobilePackage = explicit === null || explicit === void 0 ? void 0 : explicit.mobilePackage;
|
|
19189
|
-
const
|
|
19190
|
-
|
|
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({
|
|
19191
19252
|
surface,
|
|
19192
19253
|
hostPlatform,
|
|
19193
19254
|
webSdkOrigin
|
|
19194
|
-
},
|
|
19255
|
+
}, mobileShell ? {
|
|
19256
|
+
mobileShell
|
|
19257
|
+
} : {}), mobilePackage ? {
|
|
19195
19258
|
mobilePackage
|
|
19196
|
-
} : {}),
|
|
19197
|
-
|
|
19259
|
+
} : {}), mobileVersion ? {
|
|
19260
|
+
mobileVersion
|
|
19198
19261
|
} : {});
|
|
19199
19262
|
}
|
|
19200
19263
|
function serializeHostTelemetry(hostTelemetry) {
|
|
19201
19264
|
return JSON.stringify(hostTelemetry);
|
|
19202
19265
|
}
|
|
19203
19266
|
function shouldPropagateHostTelemetry(hostTelemetry) {
|
|
19204
|
-
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);
|
|
19205
19268
|
}
|
|
19206
19269
|
function toMonitoringContext(hostTelemetry) {
|
|
19207
|
-
return host_telemetry_objectSpread(host_telemetry_objectSpread({
|
|
19270
|
+
return host_telemetry_objectSpread(host_telemetry_objectSpread(host_telemetry_objectSpread({
|
|
19208
19271
|
surface: hostTelemetry.surface,
|
|
19209
19272
|
host_platform: hostTelemetry.hostPlatform,
|
|
19210
19273
|
web_sdk_origin: hostTelemetry.webSdkOrigin
|
|
19211
|
-
}, hostTelemetry.
|
|
19274
|
+
}, hostTelemetry.mobileShell ? {
|
|
19275
|
+
mobile_shell: hostTelemetry.mobileShell
|
|
19276
|
+
} : {}), hostTelemetry.mobilePackage ? {
|
|
19212
19277
|
mobile_package: hostTelemetry.mobilePackage
|
|
19213
|
-
} : {}), hostTelemetry.
|
|
19214
|
-
|
|
19278
|
+
} : {}), hostTelemetry.mobileVersion ? {
|
|
19279
|
+
mobile_version: hostTelemetry.mobileVersion
|
|
19215
19280
|
} : {});
|
|
19216
19281
|
}
|
|
19217
19282
|
;// CONCATENATED MODULE: ./src/common/helpers/is-mobile.ts
|
|
@@ -19435,7 +19500,7 @@ class ChatFrame extends preact_module_d {
|
|
|
19435
19500
|
log("Chat frame mount", {
|
|
19436
19501
|
handle,
|
|
19437
19502
|
chatUrl: this.url,
|
|
19438
|
-
embedVersion: "
|
|
19503
|
+
embedVersion: "955cc04".slice(0, 7),
|
|
19439
19504
|
embedSettings: adaSettings
|
|
19440
19505
|
});
|
|
19441
19506
|
|
|
@@ -19523,7 +19588,7 @@ class ChatFrame extends preact_module_d {
|
|
|
19523
19588
|
const hostPageUrlParams = new URL(window.location.href).searchParams;
|
|
19524
19589
|
const smsToken = hostPageUrlParams.get("adaSMSToken");
|
|
19525
19590
|
const queryParams = {
|
|
19526
|
-
embedVersion: "
|
|
19591
|
+
embedVersion: "955cc04".slice(0, 7),
|
|
19527
19592
|
greeting,
|
|
19528
19593
|
language,
|
|
19529
19594
|
skipGreeting,
|