@twilio/flex-ui-telemetry
Advanced tools
Comparing version 1.1.1 to 1.2.0
@@ -16,2 +16,9 @@ "use strict"; | ||
}, | ||
configuration: { | ||
sdkOptions: { | ||
chat: { | ||
region: 'us1', | ||
}, | ||
}, | ||
}, | ||
getInstance() { | ||
@@ -18,0 +25,0 @@ return this; |
@@ -17,7 +17,7 @@ "use strict"; | ||
constructor(properties = {}) { | ||
var _a, _b, _c, _d; | ||
var _a, _b, _c, _d, _e, _f; | ||
const flexManager = (_c = (_b = (_a = window === null || window === void 0 ? void 0 : window.Twilio) === null || _a === void 0 ? void 0 : _a.Flex) === null || _b === void 0 ? void 0 : _b.Manager) === null || _c === void 0 ? void 0 : _c.getInstance(); | ||
if (flexManager) { | ||
const { workerClient, serviceConfiguration } = flexManager; | ||
this.commonProperties = Object.assign({ product: constants_1.PRODUCT, source: constants_1.SOURCE, flexUiVersion: ((_d = semver.coerce(serviceConfiguration.ui_version)) === null || _d === void 0 ? void 0 : _d.version) || serviceConfiguration.ui_version, workerSid: (workerClient === null || workerClient === void 0 ? void 0 : workerClient.sid) || '', accountSid: (serviceConfiguration === null || serviceConfiguration === void 0 ? void 0 : serviceConfiguration.account_sid) || '' }, properties); | ||
const { workerClient, serviceConfiguration, configuration } = flexManager; | ||
this.commonProperties = Object.assign({ product: constants_1.PRODUCT, source: constants_1.SOURCE, flexUiVersion: ((_d = semver.coerce(serviceConfiguration.ui_version)) === null || _d === void 0 ? void 0 : _d.version) || serviceConfiguration.ui_version, workerSid: (workerClient === null || workerClient === void 0 ? void 0 : workerClient.sid) || '', accountSid: (serviceConfiguration === null || serviceConfiguration === void 0 ? void 0 : serviceConfiguration.account_sid) || '', realm: ((_f = (_e = configuration === null || configuration === void 0 ? void 0 : configuration.sdkOptions) === null || _e === void 0 ? void 0 : _e.chat) === null || _f === void 0 ? void 0 : _f.region) || '' }, properties); | ||
} | ||
@@ -24,0 +24,0 @@ else { |
@@ -39,7 +39,15 @@ interface Worker { | ||
} | ||
interface SDKOptions { | ||
chat?: { | ||
region?: string; | ||
}; | ||
} | ||
export interface Manager { | ||
workerClient: Worker; | ||
serviceConfiguration: ServiceConfiguration; | ||
configuration: { | ||
sdkOptions?: SDKOptions; | ||
}; | ||
getInstance(): Manager; | ||
} | ||
export {}; |
@@ -8,5 +8,7 @@ export interface SegmentOptions { | ||
product: string; | ||
source: string; | ||
flexUiVersion: string; | ||
workerSid: string; | ||
accountSid: string; | ||
realm: string; | ||
} | ||
@@ -13,0 +15,0 @@ export interface PageProperties { |
{ | ||
"name": "@twilio/flex-ui-telemetry", | ||
"version": "1.1.1", | ||
"version": "1.2.0", | ||
"description": "Flex UI Telemetry SDK", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -6,3 +6,8 @@ # Flex Telemetry SDK for UI | ||
> **NOTE:** This works only inside the Flex UI window where the iframe with the Segment AnalyticsJS + custom JS snippets exist which helps isolate the Flex Segment Analytics instance. | ||
> ⚠️ **Important Note:** | ||
> | ||
>- This package is for Twilio internal use only and is not officially supported. | ||
> | ||
>- This package works only inside the Flex UI window where the iframe with the Segment AnalyticsJS + custom JS snippets exist which helps isolate the Flex Segment Analytics instance. | ||
## Usage | ||
@@ -9,0 +14,0 @@ |
@@ -32,3 +32,3 @@ import * as semver from 'semver'; | ||
if (flexManager) { | ||
const { workerClient, serviceConfiguration } = flexManager; | ||
const { workerClient, serviceConfiguration, configuration } = flexManager; | ||
@@ -41,2 +41,3 @@ this.commonProperties = { | ||
accountSid: serviceConfiguration?.account_sid || '', | ||
realm: configuration?.sdkOptions?.chat?.region || '', | ||
...properties, | ||
@@ -43,0 +44,0 @@ }; |
@@ -42,6 +42,15 @@ interface Worker { | ||
interface SDKOptions { | ||
chat?: { | ||
region?: string; | ||
}; | ||
} | ||
export interface Manager { | ||
workerClient: Worker; | ||
serviceConfiguration: ServiceConfiguration; | ||
configuration: { | ||
sdkOptions?: SDKOptions; | ||
}; | ||
getInstance(): Manager; | ||
} |
@@ -9,5 +9,7 @@ export interface SegmentOptions { | ||
product: string; | ||
source: string; | ||
flexUiVersion: string; | ||
workerSid: string; | ||
accountSid: string; | ||
realm: string; | ||
} | ||
@@ -14,0 +16,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
48
55909
36
1098