@ada-support/embed2 1.13.1 → 1.13.2
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.
|
@@ -17,6 +17,7 @@ type StartOptionsWithHostTelemetry = StartOptions & {
|
|
|
17
17
|
};
|
|
18
18
|
export declare function resolveHostTelemetryFromStartOptions(adaSettings: StartOptionsWithHostTelemetry, options?: {
|
|
19
19
|
pathname?: string;
|
|
20
|
+
protocol?: string;
|
|
20
21
|
}): HostTelemetryContext;
|
|
21
22
|
export declare function serializeHostTelemetry(hostTelemetry: HostTelemetryContext): string;
|
|
22
23
|
export declare function shouldPropagateHostTelemetry(hostTelemetry: HostTelemetryContext): boolean;
|
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.2-ea8e50e",
|
|
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}/${"ea8e50e"}/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.2",
|
|
17701
17701
|
isNpm: true,
|
|
17702
|
-
commitHash: "
|
|
17702
|
+
commitHash: "ea8e50e"
|
|
17703
17703
|
}))
|
|
17704
17704
|
});
|
|
17705
17705
|
}
|
|
@@ -19123,6 +19123,19 @@ const SEMVER_TAG_VALUE_PATTERN = /^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/;
|
|
|
19123
19123
|
|
|
19124
19124
|
// Private mobile-sdk handshake used only on the trusted /mobile-sdk-webview/ page.
|
|
19125
19125
|
|
|
19126
|
+
// `metaFields.sdkType` is a long-standing convention set by every legacy
|
|
19127
|
+
// mobile wrapper — iOS SDK (`"IOS"`), Android SDK (`"ANDROID"`), React Native
|
|
19128
|
+
// SDK (`"REACTNATIVE"`). The new Messaging wrappers pass the richer
|
|
19129
|
+
// `hostTelemetry` handshake instead, so this map is only consulted as a
|
|
19130
|
+
// legacy-attribution fallback.
|
|
19131
|
+
const LEGACY_SDK_TYPE_PLATFORM_MAP = {
|
|
19132
|
+
IOS: "ios",
|
|
19133
|
+
ANDROID: "android",
|
|
19134
|
+
REACTNATIVE: "react-native",
|
|
19135
|
+
"REACT-NATIVE": "react-native",
|
|
19136
|
+
REACT_NATIVE: "react-native"
|
|
19137
|
+
};
|
|
19138
|
+
|
|
19126
19139
|
// Keep this normalization logic in sync with
|
|
19127
19140
|
// chat/src/shared/services/host-telemetry.ts. Both sides normalize across the
|
|
19128
19141
|
// embed/chat iframe boundary on purpose.
|
|
@@ -19234,20 +19247,58 @@ function isTrustedMobileSdkHostPage() {
|
|
|
19234
19247
|
let pathname = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : window.location.pathname;
|
|
19235
19248
|
return pathname === TRUSTED_MOBILE_SDK_PATH || pathname === TRUSTED_MOBILE_SDK_PATH.slice(0, -1);
|
|
19236
19249
|
}
|
|
19250
|
+
function isHttpOrigin() {
|
|
19251
|
+
let protocol = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : window.location.protocol;
|
|
19252
|
+
return protocol === "http:" || protocol === "https:";
|
|
19253
|
+
}
|
|
19254
|
+
function resolveLegacySdkTypePlatform(metaFields) {
|
|
19255
|
+
const record = asRecord(metaFields);
|
|
19256
|
+
const raw = record === null || record === void 0 ? void 0 : record.sdkType;
|
|
19257
|
+
if (typeof raw !== "string") {
|
|
19258
|
+
return undefined;
|
|
19259
|
+
}
|
|
19260
|
+
return LEGACY_SDK_TYPE_PLATFORM_MAP[raw.trim().toUpperCase()];
|
|
19261
|
+
}
|
|
19262
|
+
function resolveLegacySdkTypeFingerprint(metaFields, trustedMobileContext) {
|
|
19263
|
+
if (!trustedMobileContext) {
|
|
19264
|
+
return undefined;
|
|
19265
|
+
}
|
|
19266
|
+
const hostPlatform = resolveLegacySdkTypePlatform(metaFields);
|
|
19267
|
+
if (!hostPlatform) {
|
|
19268
|
+
return undefined;
|
|
19269
|
+
}
|
|
19270
|
+
return {
|
|
19271
|
+
surface: "mobile",
|
|
19272
|
+
hostPlatform,
|
|
19273
|
+
webSdkOrigin: "legacy",
|
|
19274
|
+
mobileShell: "legacy-sdk"
|
|
19275
|
+
};
|
|
19276
|
+
}
|
|
19237
19277
|
function resolveHostTelemetryFromStartOptions(adaSettings) {
|
|
19238
19278
|
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
19239
19279
|
const trustedMobileSdkHostPage = isTrustedMobileSdkHostPage(options.pathname);
|
|
19280
|
+
// Non-http origins are assumed to be native WebView hosts (file://,
|
|
19281
|
+
// react-native asset URIs) — legacy AndroidSDK and react-native-sdk both
|
|
19282
|
+
// load a bundled `embed.html` from file://, so the trusted-path check alone
|
|
19283
|
+
// misses them. Gating sdkType attribution on this prevents a web customer
|
|
19284
|
+
// from incidentally tagging themselves as mobile via `metaFields.sdkType`.
|
|
19285
|
+
const trustedMobileContext = trustedMobileSdkHostPage || !isHttpOrigin(options.protocol);
|
|
19240
19286
|
// Treat the presence of the hostTelemetry property as authoritative, even if
|
|
19241
19287
|
// normalization fails, so broken new-wrapper payloads are not downgraded
|
|
19242
19288
|
// into the legacy mobile-shell bucket.
|
|
19243
19289
|
const hasExplicitHostTelemetry = trustedMobileSdkHostPage && Object.prototype.hasOwnProperty.call(adaSettings, "hostTelemetry");
|
|
19244
19290
|
const explicit = hasExplicitHostTelemetry ? normalizeHostTelemetry(adaSettings.hostTelemetry) : undefined;
|
|
19245
|
-
|
|
19246
|
-
|
|
19247
|
-
|
|
19291
|
+
// Legacy wrappers (iOS SDK, AndroidSDK, react-native-sdk) all set
|
|
19292
|
+
// `metaFields.sdkType` before calling `adaEmbed.start(...)`. They do not
|
|
19293
|
+
// know about the newer `hostTelemetry` handshake, so this fingerprint is
|
|
19294
|
+
// the only way to attribute their traffic to the right platform.
|
|
19295
|
+
const legacyFingerprint = !hasExplicitHostTelemetry ? resolveLegacySdkTypeFingerprint(adaSettings.metaFields, trustedMobileContext) : undefined;
|
|
19296
|
+
const webSdkOrigin = (explicit === null || explicit === void 0 ? void 0 : explicit.webSdkOrigin) ?? (legacyFingerprint === null || legacyFingerprint === void 0 ? void 0 : legacyFingerprint.webSdkOrigin) ?? "legacy";
|
|
19297
|
+
const hostPlatform = (explicit === null || explicit === void 0 ? void 0 : explicit.hostPlatform) ?? (legacyFingerprint === null || legacyFingerprint === void 0 ? void 0 : legacyFingerprint.hostPlatform) ?? (trustedMobileSdkHostPage ? "unknown" : "web");
|
|
19298
|
+
const surface = (explicit === null || explicit === void 0 ? void 0 : explicit.surface) ?? (legacyFingerprint === null || legacyFingerprint === void 0 ? void 0 : legacyFingerprint.surface) ?? (trustedMobileSdkHostPage ? "mobile" : "browser");
|
|
19248
19299
|
const mobilePackage = explicit === null || explicit === void 0 ? void 0 : explicit.mobilePackage;
|
|
19249
19300
|
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);
|
|
19301
|
+
const mobileShell = deriveMessagingMobileShell(mobilePackage) ?? (explicit === null || explicit === void 0 ? void 0 : explicit.mobileShell) ?? (legacyFingerprint === null || legacyFingerprint === void 0 ? void 0 : legacyFingerprint.mobileShell) ?? (!hasExplicitHostTelemetry ? deriveLegacyMobileShell(surface, hostPlatform) : undefined);
|
|
19251
19302
|
return host_telemetry_objectSpread(host_telemetry_objectSpread(host_telemetry_objectSpread({
|
|
19252
19303
|
surface,
|
|
19253
19304
|
hostPlatform,
|
|
@@ -19500,7 +19551,7 @@ class ChatFrame extends preact_module_d {
|
|
|
19500
19551
|
log("Chat frame mount", {
|
|
19501
19552
|
handle,
|
|
19502
19553
|
chatUrl: this.url,
|
|
19503
|
-
embedVersion: "
|
|
19554
|
+
embedVersion: "ea8e50e".slice(0, 7),
|
|
19504
19555
|
embedSettings: adaSettings
|
|
19505
19556
|
});
|
|
19506
19557
|
|
|
@@ -19588,7 +19639,7 @@ class ChatFrame extends preact_module_d {
|
|
|
19588
19639
|
const hostPageUrlParams = new URL(window.location.href).searchParams;
|
|
19589
19640
|
const smsToken = hostPageUrlParams.get("adaSMSToken");
|
|
19590
19641
|
const queryParams = {
|
|
19591
|
-
embedVersion: "
|
|
19642
|
+
embedVersion: "ea8e50e".slice(0, 7),
|
|
19592
19643
|
greeting,
|
|
19593
19644
|
language,
|
|
19594
19645
|
skipGreeting,
|