@amityco/ts-sdk 7.25.0 → 7.25.1-0b3ecf6e.0
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.
- package/dist/@types/domains/client.d.ts +17 -0
- package/dist/@types/domains/client.d.ts.map +1 -1
- package/dist/client/api/createClient.d.ts +5 -1
- package/dist/client/api/createClient.d.ts.map +1 -1
- package/dist/core/device.d.ts +1 -1
- package/dist/core/device.d.ts.map +1 -1
- package/dist/core/tests/device.test.d.ts +2 -0
- package/dist/core/tests/device.test.d.ts.map +1 -0
- package/dist/core/transports/http.d.ts.map +1 -1
- package/dist/core/transports/utils.d.ts +8 -0
- package/dist/core/transports/utils.d.ts.map +1 -1
- package/dist/index.cjs.js +103 -17
- package/dist/index.esm.js +102 -16
- package/dist/index.umd.js +2 -2
- package/package.json +1 -1
|
@@ -36,6 +36,10 @@ declare global {
|
|
|
36
36
|
}
|
|
37
37
|
type Client = {
|
|
38
38
|
version: string;
|
|
39
|
+
product?: NonNullable<Amity.Device['deviceInfo']['product']>;
|
|
40
|
+
uikitVersion?: string;
|
|
41
|
+
appId?: string;
|
|
42
|
+
appVersion?: string;
|
|
39
43
|
log: Logger;
|
|
40
44
|
http: AxiosInstance;
|
|
41
45
|
upload: AxiosInstance;
|
|
@@ -73,6 +77,19 @@ declare global {
|
|
|
73
77
|
kind: 'node' | 'web';
|
|
74
78
|
model?: string;
|
|
75
79
|
sdkVersion: string;
|
|
80
|
+
product?: 'uikit' | 'sdk';
|
|
81
|
+
uikitVersion?: string;
|
|
82
|
+
coreSdkVersion?: string;
|
|
83
|
+
osName?: string;
|
|
84
|
+
osVersion?: string;
|
|
85
|
+
deviceType?: 'mobile' | 'tablet' | 'desktop';
|
|
86
|
+
browserName?: string;
|
|
87
|
+
browserVersion?: string;
|
|
88
|
+
appId?: string;
|
|
89
|
+
appVersion?: string;
|
|
90
|
+
locale?: string;
|
|
91
|
+
timezone?: string;
|
|
92
|
+
networkType?: string;
|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aAC3B,CAAC;YACF,kBAAkB,EAAE,QAAQ,GAAG,SAAS,CAAC;YACzC,oBAAoB,EAAE,KAAK,CAAC,wBAAwB,CAAC;SACtD,CAAC;QAEF,KAAK,gBAAgB,GAAG;YACtB,wBAAwB,EAAE,OAAO,CAAC;SACnC,CAAC;QAEF,KAAK,uBAAuB,GAAG;YAC7B,OAAO,EAAE;gBACP,OAAO,EAAE,OAAO,CAAC;aAClB,CAAC;SACH,CAAC;QAEF,KAAK,iBAAiB,GAAG;YACvB,UAAU,EAAE;gBACV,OAAO,EAAE,OAAO,CAAC;aAClB,CAAC;SACH,CAAC;QAEF,KAAK,mBAAmB,GAAG;YACzB,MAAM,EAAE,KAAK,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;YACrC,WAAW,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC,aAAa,CAAC,CAAC;YAChD,SAAS,CAAC,EAAE,MAAM,CAAC;YACnB,QAAQ,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;SACrC,CAAC;QAEF,KAAK,4BAA4B,GAAG;YAClC,aAAa,CAAC,EAAE,MAAM,CAAC;YACvB,sBAAsB,CAAC,EAAE,MAAM,CAAC;SACjC,CAAC;QAEF,KAAK,mBAAmB,GAAG;YACzB,UAAU,EAAE,OAAO,CAAC;SACrB,CAAC;QAEF,KAAK,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,aAAa,CAAC,CAAC;QAEtF,KAAK,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG;YACxD,WAAW,EAAE,OAAO,CAAC;SACtB,CAAC;KACH;CACF"}
|
|
@@ -15,7 +15,7 @@ import { API_REGIONS } from '~/client/utils/endpoints';
|
|
|
15
15
|
*
|
|
16
16
|
* @category Client API
|
|
17
17
|
* */
|
|
18
|
-
export declare const createClient: (apiKey: string, apiRegion?: (typeof API_REGIONS)[keyof typeof API_REGIONS], { debugSession, apiEndpoint, prefixDeviceIdKey, rteEnabled, }?: {
|
|
18
|
+
export declare const createClient: (apiKey: string, apiRegion?: (typeof API_REGIONS)[keyof typeof API_REGIONS], { debugSession, apiEndpoint, prefixDeviceIdKey, rteEnabled, product, uikitVersion, appId, appVersion, }?: {
|
|
19
19
|
debugSession?: string | undefined;
|
|
20
20
|
apiEndpoint?: {
|
|
21
21
|
http?: string | undefined;
|
|
@@ -24,5 +24,9 @@ export declare const createClient: (apiKey: string, apiRegion?: (typeof API_REGI
|
|
|
24
24
|
} | undefined;
|
|
25
25
|
prefixDeviceIdKey?: string | undefined;
|
|
26
26
|
rteEnabled?: boolean | undefined;
|
|
27
|
+
product?: "uikit" | "sdk" | undefined;
|
|
28
|
+
uikitVersion?: string | undefined;
|
|
29
|
+
appId?: string | undefined;
|
|
30
|
+
appVersion?: string | undefined;
|
|
27
31
|
}) => Amity.Client;
|
|
28
32
|
//# sourceMappingURL=createClient.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createClient.d.ts","sourceRoot":"","sources":["../../../src/client/api/createClient.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,WAAW,EAAc,MAAM,0BAA0B,CAAC;AAuBnE;;;;;;;;;;;;;;;KAeK;AACL,eAAO,MAAM,YAAY,WACf,MAAM,cACH,CAAA,kBAAkB,EAAC,MAAM,kBAAkB,CAAC
|
|
1
|
+
{"version":3,"file":"createClient.d.ts","sourceRoot":"","sources":["../../../src/client/api/createClient.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,WAAW,EAAc,MAAM,0BAA0B,CAAC;AAuBnE;;;;;;;;;;;;;;;KAeK;AACL,eAAO,MAAM,YAAY,WACf,MAAM,cACH,CAAA,kBAAkB,EAAC,MAAM,kBAAkB,CAAC;;;;;;;;;;;;;MAoBtD,MAAM,MAsGR,CAAC"}
|
package/dist/core/device.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
export declare const getDeviceId: () => Promise<string>;
|
|
3
3
|
export declare const getMQTTClientId: (userId: Amity.InternalUser['userId']) => Promise<string>;
|
|
4
4
|
/** @hidden */
|
|
5
|
-
export declare const getDeviceModel: () => string;
|
|
5
|
+
export declare const getDeviceModel: () => string | undefined;
|
|
6
6
|
/** @hidden */
|
|
7
7
|
export declare const getDeviceInfo: () => Amity.Device['deviceInfo'];
|
|
8
8
|
//# sourceMappingURL=device.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"device.d.ts","sourceRoot":"","sources":["../../src/core/device.ts"],"names":[],"mappings":"AAuDA,cAAc;AACd,eAAO,MAAM,WAAW,uBAgBvB,CAAC;AAEF,eAAO,MAAM,eAAe,WAAkB,MAAM,YAAY,CAAC,QAAQ,CAAC,oBAGzE,CAAC;AAEF,cAAc;AACd,eAAO,MAAM,cAAc,
|
|
1
|
+
{"version":3,"file":"device.d.ts","sourceRoot":"","sources":["../../src/core/device.ts"],"names":[],"mappings":"AAuDA,cAAc;AACd,eAAO,MAAM,WAAW,uBAgBvB,CAAC;AAEF,eAAO,MAAM,eAAe,WAAkB,MAAM,YAAY,CAAC,QAAQ,CAAC,oBAGzE,CAAC;AAEF,cAAc;AACd,eAAO,MAAM,cAAc,QAAO,MAAM,GAAG,SAO1C,CAAC;AAgEF,cAAc;AACd,eAAO,MAAM,aAAa,QAAO,MAAM,MAAM,CAAC,YAAY,CAsBzD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"device.test.d.ts","sourceRoot":"","sources":["../../../src/core/tests/device.test.ts"],"names":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../../src/core/transports/http.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../../src/core/transports/http.ts"],"names":[],"mappings":"AAgBA,oBAAY,kBAAkB;IAC5B,WAAW,iBAAiB;IAC5B,gBAAgB,uBAAuB;IACvC,YAAY,kBAAkB;CAC/B;AAUD,yDAAyD;AACzD,eAAO,MAAM,oBAAoB,YAEhC,CAAC;AAuDF,mDAAmD;AACnD,eAAO,MAAM,yBAAyB,YAErC,CAAC;AAGF;;;;;;;;GAQG;AACH,eAAO,MAAM,mBAAmB,aAAc,MAAM,kCAoInD,CAAC"}
|
|
@@ -10,4 +10,12 @@
|
|
|
10
10
|
* @hidden
|
|
11
11
|
*/
|
|
12
12
|
export declare const unwrapPayload: <T>(response: Amity.Response<T>) => T;
|
|
13
|
+
/**
|
|
14
|
+
* W3C Trace Context `traceparent`: `version-<16-byte trace-id>-<8-byte span-id>-<flags>`.
|
|
15
|
+
* The SDK is the trace originator, so it mints a fresh trace + span id per request; flags `01` = sampled.
|
|
16
|
+
*
|
|
17
|
+
* @category Transport
|
|
18
|
+
* @hidden
|
|
19
|
+
*/
|
|
20
|
+
export declare const generateTraceparent: () => string;
|
|
13
21
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/core/transports/utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/core/transports/utils.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;GAUG;AACH,eAAO,MAAM,aAAa,uCAYzB,CAAC;AAYF;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,QAAO,MAAkD,CAAC"}
|
package/dist/index.cjs.js
CHANGED
|
@@ -7,8 +7,8 @@ var mitt = require('mitt');
|
|
|
7
7
|
var debug = require('debug');
|
|
8
8
|
var axios = require('axios');
|
|
9
9
|
var HttpAgent = require('agentkeepalive');
|
|
10
|
-
var mqtt = require('mqtt');
|
|
11
10
|
var uuid$1 = require('react-native-uuid');
|
|
11
|
+
var mqtt = require('mqtt');
|
|
12
12
|
var jwtDecode = require('jwt-decode');
|
|
13
13
|
var hash = require('object-hash');
|
|
14
14
|
var Hls = require('hls.js');
|
|
@@ -19,8 +19,8 @@ var mitt__default = /*#__PURE__*/_interopDefaultLegacy(mitt);
|
|
|
19
19
|
var debug__default = /*#__PURE__*/_interopDefaultLegacy(debug);
|
|
20
20
|
var axios__default = /*#__PURE__*/_interopDefaultLegacy(axios);
|
|
21
21
|
var HttpAgent__default = /*#__PURE__*/_interopDefaultLegacy(HttpAgent);
|
|
22
|
-
var mqtt__default = /*#__PURE__*/_interopDefaultLegacy(mqtt);
|
|
23
22
|
var uuid__default = /*#__PURE__*/_interopDefaultLegacy(uuid$1);
|
|
23
|
+
var mqtt__default = /*#__PURE__*/_interopDefaultLegacy(mqtt);
|
|
24
24
|
var jwtDecode__default = /*#__PURE__*/_interopDefaultLegacy(jwtDecode);
|
|
25
25
|
var hash__default = /*#__PURE__*/_interopDefaultLegacy(hash);
|
|
26
26
|
var Hls__default = /*#__PURE__*/_interopDefaultLegacy(Hls);
|
|
@@ -1938,6 +1938,8 @@ function computeUrl(type, region) {
|
|
|
1938
1938
|
return URLS[type].replace('{region}', region);
|
|
1939
1939
|
}
|
|
1940
1940
|
|
|
1941
|
+
const uuid = () => uuid__default["default"].v4().toString();
|
|
1942
|
+
|
|
1941
1943
|
/**
|
|
1942
1944
|
* Unwraps v3 server payload (for error handling and type extraction)
|
|
1943
1945
|
*
|
|
@@ -1962,6 +1964,24 @@ const unwrapPayload = (response) => {
|
|
|
1962
1964
|
// unjust, but helps force uncast "T | undefined" to allow deconstruction without warnings
|
|
1963
1965
|
return undefined;
|
|
1964
1966
|
};
|
|
1967
|
+
/**
|
|
1968
|
+
* Builds a hex string of `bytes` length from the SDK's uuid helper (a v4 UUID is
|
|
1969
|
+
* 16 bytes / 32 hex chars once hyphens are removed) — avoids a new crypto dependency.
|
|
1970
|
+
*/
|
|
1971
|
+
const randomHex = (bytes) => {
|
|
1972
|
+
let hex = '';
|
|
1973
|
+
while (hex.length < bytes * 2)
|
|
1974
|
+
hex += uuid().replace(/-/g, '');
|
|
1975
|
+
return hex.slice(0, bytes * 2);
|
|
1976
|
+
};
|
|
1977
|
+
/**
|
|
1978
|
+
* W3C Trace Context `traceparent`: `version-<16-byte trace-id>-<8-byte span-id>-<flags>`.
|
|
1979
|
+
* The SDK is the trace originator, so it mints a fresh trace + span id per request; flags `01` = sampled.
|
|
1980
|
+
*
|
|
1981
|
+
* @category Transport
|
|
1982
|
+
* @hidden
|
|
1983
|
+
*/
|
|
1984
|
+
const generateTraceparent = () => `00-${randomHex(16)}-${randomHex(8)}-01`;
|
|
1965
1985
|
|
|
1966
1986
|
class NetworkActivitiesWatcher {
|
|
1967
1987
|
constructor() {
|
|
@@ -2086,6 +2106,10 @@ const createHttpTransport = (endpoint) => {
|
|
|
2086
2106
|
});
|
|
2087
2107
|
instance.defaults.withCredentials = false;
|
|
2088
2108
|
instance.interceptors.request.use(config => {
|
|
2109
|
+
// Request tracing — set on every outbound request (login included), never persisted.
|
|
2110
|
+
// Must run before the session-url early-return below so /api/v5/sessions carries them too.
|
|
2111
|
+
config.headers.set('x-request-id', uuid());
|
|
2112
|
+
config.headers.set('traceparent', generateTraceparent());
|
|
2089
2113
|
// do not check expiration for token creation url
|
|
2090
2114
|
if (config.url === '/api/v5/sessions') {
|
|
2091
2115
|
return config;
|
|
@@ -2348,8 +2372,6 @@ const getItem = async (key) => {
|
|
|
2348
2372
|
});
|
|
2349
2373
|
};
|
|
2350
2374
|
|
|
2351
|
-
const uuid = () => uuid__default["default"].v4().toString();
|
|
2352
|
-
|
|
2353
2375
|
// TODO: find a way to uniquely identify the device
|
|
2354
2376
|
let tabIndex = 0;
|
|
2355
2377
|
// This logic is running on browser only
|
|
@@ -2409,22 +2431,82 @@ const getMQTTClientId = async (userId) => {
|
|
|
2409
2431
|
};
|
|
2410
2432
|
/** @hidden */
|
|
2411
2433
|
const getDeviceModel = () => {
|
|
2412
|
-
var _a
|
|
2434
|
+
var _a;
|
|
2435
|
+
// Node reports the runtime version. Mobile SDKs report the real device model.
|
|
2413
2436
|
if ((_a = safeProcess.versions) === null || _a === void 0 ? void 0 : _a.node)
|
|
2414
2437
|
return safeProcess.versions.node;
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
return
|
|
2438
|
+
// Browsers don't expose a real device model — omit it and rely on
|
|
2439
|
+
// deviceType + browserName + osName instead.
|
|
2440
|
+
return undefined;
|
|
2441
|
+
};
|
|
2442
|
+
const hasNavigator = () => typeof navigator !== 'undefined' && !!navigator;
|
|
2443
|
+
const getLocale = () => (hasNavigator() ? navigator.language : undefined);
|
|
2444
|
+
const getTimezone = () => {
|
|
2445
|
+
try {
|
|
2446
|
+
return Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
2447
|
+
}
|
|
2448
|
+
catch (_a) {
|
|
2449
|
+
return undefined;
|
|
2450
|
+
}
|
|
2451
|
+
};
|
|
2452
|
+
const getNetworkType = () => {
|
|
2453
|
+
var _a;
|
|
2454
|
+
if (!hasNavigator())
|
|
2455
|
+
return undefined;
|
|
2456
|
+
return (_a = navigator.connection) === null || _a === void 0 ? void 0 : _a.effectiveType;
|
|
2457
|
+
};
|
|
2458
|
+
const isNode = () => { var _a; return !!((_a = safeProcess.versions) === null || _a === void 0 ? void 0 : _a.node); };
|
|
2459
|
+
const parseUserAgent = () => {
|
|
2460
|
+
if (!hasNavigator() || !navigator.userAgent)
|
|
2461
|
+
return {};
|
|
2462
|
+
const ua = navigator.userAgent;
|
|
2463
|
+
const result = {};
|
|
2464
|
+
const os = /(iPhone|iPad|iPod).*?OS (\d[\d_]*)/.exec(ua) ||
|
|
2465
|
+
/(Android) (\d[\d.]*)/.exec(ua) ||
|
|
2466
|
+
/(Windows) NT (\d[\d.]*)/.exec(ua) ||
|
|
2467
|
+
/(Mac) OS X (\d[\d_.]*)/.exec(ua);
|
|
2468
|
+
if (os) {
|
|
2469
|
+
let osName = os[1];
|
|
2470
|
+
if (os[1].startsWith('iP'))
|
|
2471
|
+
osName = 'iOS';
|
|
2472
|
+
else if (os[1] === 'Mac')
|
|
2473
|
+
osName = 'macOS';
|
|
2474
|
+
result.osName = osName;
|
|
2475
|
+
result.osVersion = os[2].replace(/_/g, '.');
|
|
2476
|
+
}
|
|
2477
|
+
const browser = /(Edg)\/(\d[\d.]*)/.exec(ua) ||
|
|
2478
|
+
/(Firefox)\/(\d[\d.]*)/.exec(ua) ||
|
|
2479
|
+
/(Chrome)\/(\d[\d.]*)/.exec(ua) ||
|
|
2480
|
+
/Version\/(\d[\d.]*)/.exec(ua);
|
|
2481
|
+
if (browser) {
|
|
2482
|
+
if (browser[0].startsWith('Version')) {
|
|
2483
|
+
result.browserName = 'Safari';
|
|
2484
|
+
[, result.browserVersion] = browser;
|
|
2485
|
+
}
|
|
2486
|
+
else {
|
|
2487
|
+
result.browserName = browser[1] === 'Edg' ? 'Edge' : browser[1];
|
|
2488
|
+
[, , result.browserVersion] = browser;
|
|
2489
|
+
}
|
|
2490
|
+
}
|
|
2491
|
+
if (/Tablet|iPad/.test(ua))
|
|
2492
|
+
result.deviceType = 'tablet';
|
|
2493
|
+
else if (/Mobi|Android/.test(ua))
|
|
2494
|
+
result.deviceType = 'mobile';
|
|
2495
|
+
else
|
|
2496
|
+
result.deviceType = 'desktop';
|
|
2497
|
+
return result;
|
|
2418
2498
|
};
|
|
2419
2499
|
/** @hidden */
|
|
2420
2500
|
const getDeviceInfo = () => {
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2501
|
+
var _a;
|
|
2502
|
+
let client;
|
|
2503
|
+
try {
|
|
2504
|
+
client = getActiveClient();
|
|
2505
|
+
}
|
|
2506
|
+
catch (_b) {
|
|
2507
|
+
client = undefined;
|
|
2508
|
+
}
|
|
2509
|
+
return Object.assign({ kind: isNode() ? 'node' : 'web', model: getDeviceModel(), sdkVersion: VERSION, coreSdkVersion: VERSION, product: (_a = client === null || client === void 0 ? void 0 : client.product) !== null && _a !== void 0 ? _a : 'sdk', uikitVersion: client === null || client === void 0 ? void 0 : client.uikitVersion, appId: client === null || client === void 0 ? void 0 : client.appId, appVersion: client === null || client === void 0 ? void 0 : client.appVersion, locale: getLocale(), timezone: getTimezone(), networkType: getNetworkType() }, parseUserAgent());
|
|
2428
2510
|
};
|
|
2429
2511
|
|
|
2430
2512
|
/* eslint-disable no-console */
|
|
@@ -8412,7 +8494,7 @@ const DEFAULT_DEBUG_SESSION = 'amity';
|
|
|
8412
8494
|
*
|
|
8413
8495
|
* @category Client API
|
|
8414
8496
|
* */
|
|
8415
|
-
const createClient = (apiKey, apiRegion = API_REGIONS.SG, { debugSession = DEFAULT_DEBUG_SESSION, apiEndpoint, prefixDeviceIdKey, rteEnabled = true, } = {}) => {
|
|
8497
|
+
const createClient = (apiKey, apiRegion = API_REGIONS.SG, { debugSession = DEFAULT_DEBUG_SESSION, apiEndpoint, prefixDeviceIdKey, rteEnabled = true, product, uikitVersion, appId, appVersion, } = {}) => {
|
|
8416
8498
|
var _a, _b, _c;
|
|
8417
8499
|
const log = createLogger(debugSession);
|
|
8418
8500
|
log('client/api/createClient', {
|
|
@@ -8441,6 +8523,10 @@ const createClient = (apiKey, apiRegion = API_REGIONS.SG, { debugSession = DEFAU
|
|
|
8441
8523
|
const useLegacyUnreadCount = true;
|
|
8442
8524
|
const client = {
|
|
8443
8525
|
version: `${VERSION}`,
|
|
8526
|
+
product,
|
|
8527
|
+
uikitVersion,
|
|
8528
|
+
appId,
|
|
8529
|
+
appVersion,
|
|
8444
8530
|
apiKey,
|
|
8445
8531
|
/*
|
|
8446
8532
|
* SDK Components
|
|
@@ -12472,7 +12558,7 @@ const getWatchSessionStorage = () => {
|
|
|
12472
12558
|
return storageInstance;
|
|
12473
12559
|
};
|
|
12474
12560
|
|
|
12475
|
-
const privateKey = "
|
|
12561
|
+
const privateKey = "MIIEpQIBAAKCAQEAwAEc/oZgYIvKSUG/C3mONYLR4ZPgAjMEX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Qha/8qtVsD+CyQ7awcPfb8kK9c0bBt+bTS6d4BkTcxkEkMgtrkBVR8Nqfu5jXsLH4VCv4G61zbMhZw8+ut+az5YX2yCN7Frj9sFlxapMRPQmzMEe0CgYEAumsAzM8ZqNv4mAK65Mnr0rhLj1cbxcKRdUYACOgtEFQpzxN/HZnTeFAe5nx3pI3uFlRHq3DFEYnT6dHMWaJQmAULYpVIwMi9L6gtyJ9fzoI6uqMtxRDMUqKdaSsTGOY/kJ6KhQ/unXi1K3XXjR+yd1+C0q+HUm1+CYxvrZYLfskCgYEArsEy+IQOiqniJ0NE2vVUF+UK/IRZaic9YKcpov5Ot7Vvzm/MnnW4N1ljVskocETBWMmPUvNSExVjPebi+rxd8fa5kY8BJScPTzMFbunZn/wjtGdcM10qdlVQ9doG61A/9P3ezFKCfS4AvF/H/59LcSx2Bh28fp3/efiVIOpVd4Y=";
|
|
12476
12562
|
/*
|
|
12477
12563
|
* The crypto algorithm used for importing key and signing string
|
|
12478
12564
|
*/
|
package/dist/index.esm.js
CHANGED
|
@@ -3,8 +3,8 @@ import mitt from 'mitt';
|
|
|
3
3
|
import debug from 'debug';
|
|
4
4
|
import axios from 'axios';
|
|
5
5
|
import HttpAgent, { HttpsAgent } from 'agentkeepalive';
|
|
6
|
-
import mqtt from 'mqtt';
|
|
7
6
|
import uuid$1 from 'react-native-uuid';
|
|
7
|
+
import mqtt from 'mqtt';
|
|
8
8
|
import jwtDecode from 'jwt-decode';
|
|
9
9
|
import hash from 'object-hash';
|
|
10
10
|
import Hls from 'hls.js';
|
|
@@ -1922,6 +1922,8 @@ function computeUrl(type, region) {
|
|
|
1922
1922
|
return URLS[type].replace('{region}', region);
|
|
1923
1923
|
}
|
|
1924
1924
|
|
|
1925
|
+
const uuid = () => uuid$1.v4().toString();
|
|
1926
|
+
|
|
1925
1927
|
/**
|
|
1926
1928
|
* Unwraps v3 server payload (for error handling and type extraction)
|
|
1927
1929
|
*
|
|
@@ -1946,6 +1948,24 @@ const unwrapPayload = (response) => {
|
|
|
1946
1948
|
// unjust, but helps force uncast "T | undefined" to allow deconstruction without warnings
|
|
1947
1949
|
return undefined;
|
|
1948
1950
|
};
|
|
1951
|
+
/**
|
|
1952
|
+
* Builds a hex string of `bytes` length from the SDK's uuid helper (a v4 UUID is
|
|
1953
|
+
* 16 bytes / 32 hex chars once hyphens are removed) — avoids a new crypto dependency.
|
|
1954
|
+
*/
|
|
1955
|
+
const randomHex = (bytes) => {
|
|
1956
|
+
let hex = '';
|
|
1957
|
+
while (hex.length < bytes * 2)
|
|
1958
|
+
hex += uuid().replace(/-/g, '');
|
|
1959
|
+
return hex.slice(0, bytes * 2);
|
|
1960
|
+
};
|
|
1961
|
+
/**
|
|
1962
|
+
* W3C Trace Context `traceparent`: `version-<16-byte trace-id>-<8-byte span-id>-<flags>`.
|
|
1963
|
+
* The SDK is the trace originator, so it mints a fresh trace + span id per request; flags `01` = sampled.
|
|
1964
|
+
*
|
|
1965
|
+
* @category Transport
|
|
1966
|
+
* @hidden
|
|
1967
|
+
*/
|
|
1968
|
+
const generateTraceparent = () => `00-${randomHex(16)}-${randomHex(8)}-01`;
|
|
1949
1969
|
|
|
1950
1970
|
class NetworkActivitiesWatcher {
|
|
1951
1971
|
constructor() {
|
|
@@ -2070,6 +2090,10 @@ const createHttpTransport = (endpoint) => {
|
|
|
2070
2090
|
});
|
|
2071
2091
|
instance.defaults.withCredentials = false;
|
|
2072
2092
|
instance.interceptors.request.use(config => {
|
|
2093
|
+
// Request tracing — set on every outbound request (login included), never persisted.
|
|
2094
|
+
// Must run before the session-url early-return below so /api/v5/sessions carries them too.
|
|
2095
|
+
config.headers.set('x-request-id', uuid());
|
|
2096
|
+
config.headers.set('traceparent', generateTraceparent());
|
|
2073
2097
|
// do not check expiration for token creation url
|
|
2074
2098
|
if (config.url === '/api/v5/sessions') {
|
|
2075
2099
|
return config;
|
|
@@ -2332,8 +2356,6 @@ const getItem = async (key) => {
|
|
|
2332
2356
|
});
|
|
2333
2357
|
};
|
|
2334
2358
|
|
|
2335
|
-
const uuid = () => uuid$1.v4().toString();
|
|
2336
|
-
|
|
2337
2359
|
// TODO: find a way to uniquely identify the device
|
|
2338
2360
|
let tabIndex = 0;
|
|
2339
2361
|
// This logic is running on browser only
|
|
@@ -2393,22 +2415,82 @@ const getMQTTClientId = async (userId) => {
|
|
|
2393
2415
|
};
|
|
2394
2416
|
/** @hidden */
|
|
2395
2417
|
const getDeviceModel = () => {
|
|
2396
|
-
var _a
|
|
2418
|
+
var _a;
|
|
2419
|
+
// Node reports the runtime version. Mobile SDKs report the real device model.
|
|
2397
2420
|
if ((_a = safeProcess.versions) === null || _a === void 0 ? void 0 : _a.node)
|
|
2398
2421
|
return safeProcess.versions.node;
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
return
|
|
2422
|
+
// Browsers don't expose a real device model — omit it and rely on
|
|
2423
|
+
// deviceType + browserName + osName instead.
|
|
2424
|
+
return undefined;
|
|
2425
|
+
};
|
|
2426
|
+
const hasNavigator = () => typeof navigator !== 'undefined' && !!navigator;
|
|
2427
|
+
const getLocale = () => (hasNavigator() ? navigator.language : undefined);
|
|
2428
|
+
const getTimezone = () => {
|
|
2429
|
+
try {
|
|
2430
|
+
return Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
2431
|
+
}
|
|
2432
|
+
catch (_a) {
|
|
2433
|
+
return undefined;
|
|
2434
|
+
}
|
|
2435
|
+
};
|
|
2436
|
+
const getNetworkType = () => {
|
|
2437
|
+
var _a;
|
|
2438
|
+
if (!hasNavigator())
|
|
2439
|
+
return undefined;
|
|
2440
|
+
return (_a = navigator.connection) === null || _a === void 0 ? void 0 : _a.effectiveType;
|
|
2441
|
+
};
|
|
2442
|
+
const isNode = () => { var _a; return !!((_a = safeProcess.versions) === null || _a === void 0 ? void 0 : _a.node); };
|
|
2443
|
+
const parseUserAgent = () => {
|
|
2444
|
+
if (!hasNavigator() || !navigator.userAgent)
|
|
2445
|
+
return {};
|
|
2446
|
+
const ua = navigator.userAgent;
|
|
2447
|
+
const result = {};
|
|
2448
|
+
const os = /(iPhone|iPad|iPod).*?OS (\d[\d_]*)/.exec(ua) ||
|
|
2449
|
+
/(Android) (\d[\d.]*)/.exec(ua) ||
|
|
2450
|
+
/(Windows) NT (\d[\d.]*)/.exec(ua) ||
|
|
2451
|
+
/(Mac) OS X (\d[\d_.]*)/.exec(ua);
|
|
2452
|
+
if (os) {
|
|
2453
|
+
let osName = os[1];
|
|
2454
|
+
if (os[1].startsWith('iP'))
|
|
2455
|
+
osName = 'iOS';
|
|
2456
|
+
else if (os[1] === 'Mac')
|
|
2457
|
+
osName = 'macOS';
|
|
2458
|
+
result.osName = osName;
|
|
2459
|
+
result.osVersion = os[2].replace(/_/g, '.');
|
|
2460
|
+
}
|
|
2461
|
+
const browser = /(Edg)\/(\d[\d.]*)/.exec(ua) ||
|
|
2462
|
+
/(Firefox)\/(\d[\d.]*)/.exec(ua) ||
|
|
2463
|
+
/(Chrome)\/(\d[\d.]*)/.exec(ua) ||
|
|
2464
|
+
/Version\/(\d[\d.]*)/.exec(ua);
|
|
2465
|
+
if (browser) {
|
|
2466
|
+
if (browser[0].startsWith('Version')) {
|
|
2467
|
+
result.browserName = 'Safari';
|
|
2468
|
+
[, result.browserVersion] = browser;
|
|
2469
|
+
}
|
|
2470
|
+
else {
|
|
2471
|
+
result.browserName = browser[1] === 'Edg' ? 'Edge' : browser[1];
|
|
2472
|
+
[, , result.browserVersion] = browser;
|
|
2473
|
+
}
|
|
2474
|
+
}
|
|
2475
|
+
if (/Tablet|iPad/.test(ua))
|
|
2476
|
+
result.deviceType = 'tablet';
|
|
2477
|
+
else if (/Mobi|Android/.test(ua))
|
|
2478
|
+
result.deviceType = 'mobile';
|
|
2479
|
+
else
|
|
2480
|
+
result.deviceType = 'desktop';
|
|
2481
|
+
return result;
|
|
2402
2482
|
};
|
|
2403
2483
|
/** @hidden */
|
|
2404
2484
|
const getDeviceInfo = () => {
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2485
|
+
var _a;
|
|
2486
|
+
let client;
|
|
2487
|
+
try {
|
|
2488
|
+
client = getActiveClient();
|
|
2489
|
+
}
|
|
2490
|
+
catch (_b) {
|
|
2491
|
+
client = undefined;
|
|
2492
|
+
}
|
|
2493
|
+
return Object.assign({ kind: isNode() ? 'node' : 'web', model: getDeviceModel(), sdkVersion: VERSION, coreSdkVersion: VERSION, product: (_a = client === null || client === void 0 ? void 0 : client.product) !== null && _a !== void 0 ? _a : 'sdk', uikitVersion: client === null || client === void 0 ? void 0 : client.uikitVersion, appId: client === null || client === void 0 ? void 0 : client.appId, appVersion: client === null || client === void 0 ? void 0 : client.appVersion, locale: getLocale(), timezone: getTimezone(), networkType: getNetworkType() }, parseUserAgent());
|
|
2412
2494
|
};
|
|
2413
2495
|
|
|
2414
2496
|
/* eslint-disable no-console */
|
|
@@ -8412,7 +8494,7 @@ const DEFAULT_DEBUG_SESSION = 'amity';
|
|
|
8412
8494
|
*
|
|
8413
8495
|
* @category Client API
|
|
8414
8496
|
* */
|
|
8415
|
-
const createClient = (apiKey, apiRegion = API_REGIONS.SG, { debugSession = DEFAULT_DEBUG_SESSION, apiEndpoint, prefixDeviceIdKey, rteEnabled = true, } = {}) => {
|
|
8497
|
+
const createClient = (apiKey, apiRegion = API_REGIONS.SG, { debugSession = DEFAULT_DEBUG_SESSION, apiEndpoint, prefixDeviceIdKey, rteEnabled = true, product, uikitVersion, appId, appVersion, } = {}) => {
|
|
8416
8498
|
var _a, _b, _c;
|
|
8417
8499
|
const log = createLogger(debugSession);
|
|
8418
8500
|
log('client/api/createClient', {
|
|
@@ -8441,6 +8523,10 @@ const createClient = (apiKey, apiRegion = API_REGIONS.SG, { debugSession = DEFAU
|
|
|
8441
8523
|
const useLegacyUnreadCount = true;
|
|
8442
8524
|
const client = {
|
|
8443
8525
|
version: `${VERSION}`,
|
|
8526
|
+
product,
|
|
8527
|
+
uikitVersion,
|
|
8528
|
+
appId,
|
|
8529
|
+
appVersion,
|
|
8444
8530
|
apiKey,
|
|
8445
8531
|
/*
|
|
8446
8532
|
* SDK Components
|
|
@@ -12472,7 +12558,7 @@ const getWatchSessionStorage = () => {
|
|
|
12472
12558
|
return storageInstance;
|
|
12473
12559
|
};
|
|
12474
12560
|
|
|
12475
|
-
const privateKey = "
|
|
12561
|
+
const privateKey = "MIIEpQIBAAKCAQEAwAEc/oZgYIvKSUG/C3mONYLR4ZPgAjMEX4bJ+xqqakUDRtqlNO+eZs2blQ1Ko0DBkqPExyQezvjibH5W2UZBV5RaBTlTcNVKTToMBEGesAfaEcM3qUyQHxdbFYZv6P4sb14dcwxTQ8usmaV8ooiR1Fcaso5ZWYcZ8Hb46FbQ7OoVumsBtPWwfZ4f003o5VCl6AIM6lcLv9UDLlFVYhE+PeXpRHtfWlGqxMvqC9oinlwhL6nWv6VjQXW4nhcib72dPBzfHT7k/PMKto2SxALYdb68ENiAGuJLWi3AUHSyYCJK2w7wIlWfJUAI0v26ub10IpExr6D5QuW2577jjP93iwIDAQABAoIBAFWfqXhwIIatkFY+9Z1+ZcbDQimgsmMIsUiQaX6Lk7e0cxOj6czDlxYtVtaPiNtow2pLkjNkjkCqiP7tEHnwdK9DvylZOTa2R15NJpK3WLcTqVIGhsn/FL5owfvFah6zSsmXZParZm5zY9NZE03ALZhOB9/cz0e3kf/EbpfeL2mW7MApyiUt5i09ycchroOpcWp73ipIxvgigtZyUGFmsQicWhUs28F0D7w4Qfk76yG3nqXeb+BAMhCaIaa/k/aAxhiZG/ygEQWQrcC8gfe+jyicMAQPDEVS9YuUMGsLjIjKuVLZzp2xirQnhc2i2zVNEIvG6soprPOBEMQugzrtX5ECgYEA3b7KAbBIbDl1e4ZSCWhHdHkiWVZHaopsR/LhqDDNhXjWjq3AesgV6k0j9EdziMn/HmmOso0bz99GTV3JZf4A9ztTLumJlkHbdVtlgOqSjrFLj12rH9KXTheyIhWSpUmm8+W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