genesys-cloud-streaming-client 14.0.1-develop.11 → 14.0.2-develop.12

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.
@@ -21,6 +21,8 @@ export declare class Client {
21
21
  deadChannels: string[];
22
22
  config: IClientConfig;
23
23
  streamId: any;
24
+ backgroundAssistantMode: boolean;
25
+ isGuest: boolean;
24
26
  http: HttpClient;
25
27
  notifications: NotificationsAPI;
26
28
  _notifications: Notifications;
@@ -30,6 +32,7 @@ export declare class Client {
30
32
  _ping: Ping;
31
33
  _reconnector: Reconnector;
32
34
  constructor(options: IClientOptions);
35
+ private checkIsBackgroundAssistant;
33
36
  cleanupLeakTimer(): void;
34
37
  on(eventName: any, ...args: any[]): this;
35
38
  once(eventName: any, ...args: any[]): this;
@@ -64,6 +64,8 @@ class Client {
64
64
  this.hardReconnectCount = 0;
65
65
  this.reconnectLeakTime = 1000 * 60 * 10; // 10 minutes
66
66
  this.deadChannels = [];
67
+ this.backgroundAssistantMode = false;
68
+ this.isGuest = false;
67
69
  this.http = new http_client_1.HttpClient();
68
70
  const stanzaio = stanza_1.createClient({});
69
71
  // TODO: remove this hack when we can. basically stanza messes up the auth mechanism priority.
@@ -82,12 +84,19 @@ class Client {
82
84
  appName: options.appName,
83
85
  appVersion: options.appVersion
84
86
  };
85
- const accessToken = options.authToken || '';
87
+ this.backgroundAssistantMode = this.checkIsBackgroundAssistant();
88
+ this.isGuest = !this.backgroundAssistantMode && !options.authToken;
89
+ let loggerAccessToken = options.authToken || '';
90
+ let loggerUrl = `https://api.${this.config.apiHost}/api/v2/diagnostics/trace`;
91
+ if (this.backgroundAssistantMode) {
92
+ loggerAccessToken = options.jwt;
93
+ loggerUrl += '/backgroundassistant';
94
+ }
86
95
  this.logger = new genesys_cloud_client_logger_1.Logger({
87
- accessToken,
88
- url: `https://api.${this.config.apiHost}/api/v2/diagnostics/trace`,
96
+ accessToken: loggerAccessToken,
97
+ url: loggerUrl,
89
98
  uploadDebounceTime: 1000,
90
- initializeServerLogging: !options.optOutOfWebrtcStatsTelemetry,
99
+ initializeServerLogging: !this.isGuest && !options.optOutOfWebrtcStatsTelemetry,
91
100
  /* streaming-client logging info */
92
101
  appVersion: Client.version,
93
102
  appName: 'streaming-client',
@@ -204,6 +213,13 @@ class Client {
204
213
  this[`_${extensionName}`] = extension;
205
214
  });
206
215
  }
216
+ checkIsBackgroundAssistant() {
217
+ if (this.config.jwt) {
218
+ const jwt = utils_1.parseJwt(this.config.jwt);
219
+ return jwt && jwt.iss === 'urn:purecloud:screenrecording';
220
+ }
221
+ return false;
222
+ }
207
223
  cleanupLeakTimer() {
208
224
  clearInterval(this.leakyReconnectTimer);
209
225
  this.leakyReconnectTimer = null;
@@ -353,7 +369,7 @@ class Client {
353
369
  return Client.version;
354
370
  }
355
371
  static get version() {
356
- return '14.0.1';
372
+ return '14.0.2';
357
373
  }
358
374
  }
359
375
  exports.Client = Client;
@@ -25,9 +25,7 @@ class HttpClient {
25
25
  url,
26
26
  data: opts.data,
27
27
  headers: {
28
- 'content-type': opts.contentType || 'application/json',
29
- // we may not need this
30
- 'accept-encoding': 'gzip, deflate'
28
+ 'content-type': opts.contentType || 'application/json'
31
29
  }
32
30
  };
33
31
  // default to include auth header
@@ -157,7 +157,7 @@ class WebrtcExtension extends events_1.EventEmitter {
157
157
  }
158
158
  this.statsArr.splice(0, statsToSend.length);
159
159
  this.statBuffer = this.statsArr.reduce((currentSize, stats) => currentSize + utils_1.calculatePayloadSize(stats), 0);
160
- if (!statsToSend.length || !this.client.config.authToken) {
160
+ if (!statsToSend.length || this.client.isGuest) {
161
161
  return;
162
162
  }
163
163
  const data = {
@@ -169,10 +169,16 @@ class WebrtcExtension extends events_1.EventEmitter {
169
169
  };
170
170
  // At least for now, we'll just fire and forget. Since this is non-critical, we'll not retry failures
171
171
  try {
172
- await this.client.http.requestApi('diagnostics/newrelic/insights', {
172
+ let authToken = this.client.config.authToken;
173
+ let url = 'diagnostics/newrelic/insights';
174
+ if (this.client.backgroundAssistantMode) {
175
+ authToken = this.client.config.jwt;
176
+ url += '/backgroundassistant';
177
+ }
178
+ await this.client.http.requestApi(url, {
173
179
  method: 'post',
174
180
  host: this.client.config.apiHost,
175
- authToken: this.client.config.authToken,
181
+ authToken,
176
182
  logger: this.client.logger,
177
183
  data
178
184
  });
@@ -5,10 +5,10 @@
5
5
  "team": "Genesys Client Media (WebRTC)",
6
6
  "indexFiles": [
7
7
  {
8
- "file": "/v14.0.1/streaming-client.browser.ie.js"
8
+ "file": "/v14.0.2/streaming-client.browser.ie.js"
9
9
  },
10
10
  {
11
- "file": "/v14.0.1/streaming-client.browser.js"
11
+ "file": "/v14.0.2/streaming-client.browser.js"
12
12
  },
13
13
  {
14
14
  "file": "/v14/streaming-client.browser.ie.js"
@@ -17,6 +17,6 @@
17
17
  "file": "/v14/streaming-client.browser.js"
18
18
  }
19
19
  ],
20
- "build": "11",
21
- "buildDate": "2022-06-06T15:02:29.711906Z"
20
+ "build": "12",
21
+ "buildDate": "2022-06-07T22:38:32.449031Z"
22
22
  }
@@ -21,6 +21,8 @@ export declare class Client {
21
21
  deadChannels: string[];
22
22
  config: IClientConfig;
23
23
  streamId: any;
24
+ backgroundAssistantMode: boolean;
25
+ isGuest: boolean;
24
26
  http: HttpClient;
25
27
  notifications: NotificationsAPI;
26
28
  _notifications: Notifications;
@@ -30,6 +32,7 @@ export declare class Client {
30
32
  _ping: Ping;
31
33
  _reconnector: Reconnector;
32
34
  constructor(options: IClientOptions);
35
+ private checkIsBackgroundAssistant;
33
36
  cleanupLeakTimer(): void;
34
37
  on(eventName: any, ...args: any[]): this;
35
38
  once(eventName: any, ...args: any[]): this;
package/dist/es/client.js CHANGED
@@ -63,6 +63,8 @@ export class Client {
63
63
  this.hardReconnectCount = 0;
64
64
  this.reconnectLeakTime = 1000 * 60 * 10; // 10 minutes
65
65
  this.deadChannels = [];
66
+ this.backgroundAssistantMode = false;
67
+ this.isGuest = false;
66
68
  this.http = new HttpClient();
67
69
  const stanzaio = createStanzaClient({});
68
70
  // TODO: remove this hack when we can. basically stanza messes up the auth mechanism priority.
@@ -81,12 +83,19 @@ export class Client {
81
83
  appName: options.appName,
82
84
  appVersion: options.appVersion
83
85
  };
84
- const accessToken = options.authToken || '';
86
+ this.backgroundAssistantMode = this.checkIsBackgroundAssistant();
87
+ this.isGuest = !this.backgroundAssistantMode && !options.authToken;
88
+ let loggerAccessToken = options.authToken || '';
89
+ let loggerUrl = `https://api.${this.config.apiHost}/api/v2/diagnostics/trace`;
90
+ if (this.backgroundAssistantMode) {
91
+ loggerAccessToken = options.jwt;
92
+ loggerUrl += '/backgroundassistant';
93
+ }
85
94
  this.logger = new Logger({
86
- accessToken,
87
- url: `https://api.${this.config.apiHost}/api/v2/diagnostics/trace`,
95
+ accessToken: loggerAccessToken,
96
+ url: loggerUrl,
88
97
  uploadDebounceTime: 1000,
89
- initializeServerLogging: !options.optOutOfWebrtcStatsTelemetry,
98
+ initializeServerLogging: !this.isGuest && !options.optOutOfWebrtcStatsTelemetry,
90
99
  /* streaming-client logging info */
91
100
  appVersion: Client.version,
92
101
  appName: 'streaming-client',
@@ -203,6 +212,13 @@ export class Client {
203
212
  this[`_${extensionName}`] = extension;
204
213
  });
205
214
  }
215
+ checkIsBackgroundAssistant() {
216
+ if (this.config.jwt) {
217
+ const jwt = parseJwt(this.config.jwt);
218
+ return jwt && jwt.iss === 'urn:purecloud:screenrecording';
219
+ }
220
+ return false;
221
+ }
206
222
  cleanupLeakTimer() {
207
223
  clearInterval(this.leakyReconnectTimer);
208
224
  this.leakyReconnectTimer = null;
@@ -354,6 +370,6 @@ export class Client {
354
370
  return Client.version;
355
371
  }
356
372
  static get version() {
357
- return '14.0.1';
373
+ return '14.0.2';
358
374
  }
359
375
  }
@@ -21,9 +21,7 @@ export class HttpClient {
21
21
  url,
22
22
  data: opts.data,
23
23
  headers: {
24
- 'content-type': opts.contentType || 'application/json',
25
- // we may not need this
26
- 'accept-encoding': 'gzip, deflate'
24
+ 'content-type': opts.contentType || 'application/json'
27
25
  }
28
26
  };
29
27
  // default to include auth header
@@ -41946,7 +41946,7 @@ class WebrtcExtension extends EventEmitter {
41946
41946
  }
41947
41947
  this.statsArr.splice(0, statsToSend.length);
41948
41948
  this.statBuffer = this.statsArr.reduce((currentSize, stats) => currentSize + calculatePayloadSize(stats), 0);
41949
- if (!statsToSend.length || !this.client.config.authToken) {
41949
+ if (!statsToSend.length || this.client.isGuest) {
41950
41950
  return;
41951
41951
  }
41952
41952
  const data = {
@@ -41958,10 +41958,16 @@ class WebrtcExtension extends EventEmitter {
41958
41958
  };
41959
41959
  // At least for now, we'll just fire and forget. Since this is non-critical, we'll not retry failures
41960
41960
  try {
41961
- yield this.client.http.requestApi('diagnostics/newrelic/insights', {
41961
+ let authToken = this.client.config.authToken;
41962
+ let url = 'diagnostics/newrelic/insights';
41963
+ if (this.client.backgroundAssistantMode) {
41964
+ authToken = this.client.config.jwt;
41965
+ url += '/backgroundassistant';
41966
+ }
41967
+ yield this.client.http.requestApi(url, {
41962
41968
  method: 'post',
41963
41969
  host: this.client.config.apiHost,
41964
- authToken: this.client.config.authToken,
41970
+ authToken,
41965
41971
  logger: this.client.logger,
41966
41972
  data
41967
41973
  });
@@ -42838,9 +42844,7 @@ class HttpClient {
42838
42844
  url,
42839
42845
  data: opts.data,
42840
42846
  headers: {
42841
- 'content-type': opts.contentType || 'application/json',
42842
- // we may not need this
42843
- 'accept-encoding': 'gzip, deflate'
42847
+ 'content-type': opts.contentType || 'application/json'
42844
42848
  }
42845
42849
  };
42846
42850
  // default to include auth header
@@ -43245,6 +43249,8 @@ class Client {
43245
43249
  this.hardReconnectCount = 0;
43246
43250
  this.reconnectLeakTime = 1000 * 60 * 10; // 10 minutes
43247
43251
  this.deadChannels = [];
43252
+ this.backgroundAssistantMode = false;
43253
+ this.isGuest = false;
43248
43254
  this.http = new HttpClient();
43249
43255
  const stanzaio = createClient({});
43250
43256
  // TODO: remove this hack when we can. basically stanza messes up the auth mechanism priority.
@@ -43263,12 +43269,19 @@ class Client {
43263
43269
  appName: options.appName,
43264
43270
  appVersion: options.appVersion
43265
43271
  };
43266
- const accessToken = options.authToken || '';
43272
+ this.backgroundAssistantMode = this.checkIsBackgroundAssistant();
43273
+ this.isGuest = !this.backgroundAssistantMode && !options.authToken;
43274
+ let loggerAccessToken = options.authToken || '';
43275
+ let loggerUrl = `https://api.${this.config.apiHost}/api/v2/diagnostics/trace`;
43276
+ if (this.backgroundAssistantMode) {
43277
+ loggerAccessToken = options.jwt;
43278
+ loggerUrl += '/backgroundassistant';
43279
+ }
43267
43280
  this.logger = new Logger({
43268
- accessToken,
43269
- url: `https://api.${this.config.apiHost}/api/v2/diagnostics/trace`,
43281
+ accessToken: loggerAccessToken,
43282
+ url: loggerUrl,
43270
43283
  uploadDebounceTime: 1000,
43271
- initializeServerLogging: !options.optOutOfWebrtcStatsTelemetry,
43284
+ initializeServerLogging: !this.isGuest && !options.optOutOfWebrtcStatsTelemetry,
43272
43285
  /* streaming-client logging info */
43273
43286
  appVersion: Client.version,
43274
43287
  appName: 'streaming-client',
@@ -43385,6 +43398,13 @@ class Client {
43385
43398
  this[`_${extensionName}`] = extension;
43386
43399
  });
43387
43400
  }
43401
+ checkIsBackgroundAssistant() {
43402
+ if (this.config.jwt) {
43403
+ const jwt = parseJwt(this.config.jwt);
43404
+ return jwt && jwt.iss === 'urn:purecloud:screenrecording';
43405
+ }
43406
+ return false;
43407
+ }
43388
43408
  cleanupLeakTimer() {
43389
43409
  clearInterval(this.leakyReconnectTimer);
43390
43410
  this.leakyReconnectTimer = null;
@@ -43536,7 +43556,7 @@ class Client {
43536
43556
  return Client.version;
43537
43557
  }
43538
43558
  static get version() {
43539
- return '14.0.1';
43559
+ return '14.0.2';
43540
43560
  }
43541
43561
  }
43542
43562
 
package/dist/es/webrtc.js CHANGED
@@ -155,7 +155,7 @@ export class WebrtcExtension extends EventEmitter {
155
155
  }
156
156
  this.statsArr.splice(0, statsToSend.length);
157
157
  this.statBuffer = this.statsArr.reduce((currentSize, stats) => currentSize + calculatePayloadSize(stats), 0);
158
- if (!statsToSend.length || !this.client.config.authToken) {
158
+ if (!statsToSend.length || this.client.isGuest) {
159
159
  return;
160
160
  }
161
161
  const data = {
@@ -167,10 +167,16 @@ export class WebrtcExtension extends EventEmitter {
167
167
  };
168
168
  // At least for now, we'll just fire and forget. Since this is non-critical, we'll not retry failures
169
169
  try {
170
- yield this.client.http.requestApi('diagnostics/newrelic/insights', {
170
+ let authToken = this.client.config.authToken;
171
+ let url = 'diagnostics/newrelic/insights';
172
+ if (this.client.backgroundAssistantMode) {
173
+ authToken = this.client.config.jwt;
174
+ url += '/backgroundassistant';
175
+ }
176
+ yield this.client.http.requestApi(url, {
171
177
  method: 'post',
172
178
  host: this.client.config.apiHost,
173
- authToken: this.client.config.authToken,
179
+ authToken,
174
180
  logger: this.client.logger,
175
181
  data
176
182
  });
@@ -3,7 +3,9 @@ All notable changes to this project will be documented in this file.
3
3
 
4
4
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5
5
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
- # [Unreleased](https://github.com/purecloudlabs/genesys-cloud-streaming-client/compare/v14.0.0...HEAD)
6
+ # [Unreleased](https://github.com/purecloudlabs/genesys-cloud-streaming-client/compare/v14.0.1...HEAD)
7
+ ### Added
8
+ * [PCM-1819](https://inindca.atlassian.net/browse/PCM-1819) Added separate backgroundassistant endpoints that will be used when using a screen recording jwt
7
9
 
8
10
  # [v14.0.1](https://github.com/purecloudlabs/genesys-cloud-streaming-client/compare/v14.0.0...v14.0.1)
9
11
 
@@ -21,6 +21,8 @@ export declare class Client {
21
21
  deadChannels: string[];
22
22
  config: IClientConfig;
23
23
  streamId: any;
24
+ backgroundAssistantMode: boolean;
25
+ isGuest: boolean;
24
26
  http: HttpClient;
25
27
  notifications: NotificationsAPI;
26
28
  _notifications: Notifications;
@@ -30,6 +32,7 @@ export declare class Client {
30
32
  _ping: Ping;
31
33
  _reconnector: Reconnector;
32
34
  constructor(options: IClientOptions);
35
+ private checkIsBackgroundAssistant;
33
36
  cleanupLeakTimer(): void;
34
37
  on(eventName: any, ...args: any[]): this;
35
38
  once(eventName: any, ...args: any[]): this;
@@ -64,6 +64,8 @@ class Client {
64
64
  this.hardReconnectCount = 0;
65
65
  this.reconnectLeakTime = 1000 * 60 * 10; // 10 minutes
66
66
  this.deadChannels = [];
67
+ this.backgroundAssistantMode = false;
68
+ this.isGuest = false;
67
69
  this.http = new http_client_1.HttpClient();
68
70
  const stanzaio = stanza_1.createClient({});
69
71
  // TODO: remove this hack when we can. basically stanza messes up the auth mechanism priority.
@@ -82,12 +84,19 @@ class Client {
82
84
  appName: options.appName,
83
85
  appVersion: options.appVersion
84
86
  };
85
- const accessToken = options.authToken || '';
87
+ this.backgroundAssistantMode = this.checkIsBackgroundAssistant();
88
+ this.isGuest = !this.backgroundAssistantMode && !options.authToken;
89
+ let loggerAccessToken = options.authToken || '';
90
+ let loggerUrl = `https://api.${this.config.apiHost}/api/v2/diagnostics/trace`;
91
+ if (this.backgroundAssistantMode) {
92
+ loggerAccessToken = options.jwt;
93
+ loggerUrl += '/backgroundassistant';
94
+ }
86
95
  this.logger = new genesys_cloud_client_logger_1.Logger({
87
- accessToken,
88
- url: `https://api.${this.config.apiHost}/api/v2/diagnostics/trace`,
96
+ accessToken: loggerAccessToken,
97
+ url: loggerUrl,
89
98
  uploadDebounceTime: 1000,
90
- initializeServerLogging: !options.optOutOfWebrtcStatsTelemetry,
99
+ initializeServerLogging: !this.isGuest && !options.optOutOfWebrtcStatsTelemetry,
91
100
  /* streaming-client logging info */
92
101
  appVersion: Client.version,
93
102
  appName: 'streaming-client',
@@ -204,6 +213,13 @@ class Client {
204
213
  this[`_${extensionName}`] = extension;
205
214
  });
206
215
  }
216
+ checkIsBackgroundAssistant() {
217
+ if (this.config.jwt) {
218
+ const jwt = utils_1.parseJwt(this.config.jwt);
219
+ return jwt && jwt.iss === 'urn:purecloud:screenrecording';
220
+ }
221
+ return false;
222
+ }
207
223
  cleanupLeakTimer() {
208
224
  clearInterval(this.leakyReconnectTimer);
209
225
  this.leakyReconnectTimer = null;
@@ -353,7 +369,7 @@ class Client {
353
369
  return Client.version;
354
370
  }
355
371
  static get version() {
356
- return '14.0.1';
372
+ return '14.0.2';
357
373
  }
358
374
  }
359
375
  exports.Client = Client;
@@ -25,9 +25,7 @@ class HttpClient {
25
25
  url,
26
26
  data: opts.data,
27
27
  headers: {
28
- 'content-type': opts.contentType || 'application/json',
29
- // we may not need this
30
- 'accept-encoding': 'gzip, deflate'
28
+ 'content-type': opts.contentType || 'application/json'
31
29
  }
32
30
  };
33
31
  // default to include auth header
@@ -157,7 +157,7 @@ class WebrtcExtension extends events_1.EventEmitter {
157
157
  }
158
158
  this.statsArr.splice(0, statsToSend.length);
159
159
  this.statBuffer = this.statsArr.reduce((currentSize, stats) => currentSize + utils_1.calculatePayloadSize(stats), 0);
160
- if (!statsToSend.length || !this.client.config.authToken) {
160
+ if (!statsToSend.length || this.client.isGuest) {
161
161
  return;
162
162
  }
163
163
  const data = {
@@ -169,10 +169,16 @@ class WebrtcExtension extends events_1.EventEmitter {
169
169
  };
170
170
  // At least for now, we'll just fire and forget. Since this is non-critical, we'll not retry failures
171
171
  try {
172
- await this.client.http.requestApi('diagnostics/newrelic/insights', {
172
+ let authToken = this.client.config.authToken;
173
+ let url = 'diagnostics/newrelic/insights';
174
+ if (this.client.backgroundAssistantMode) {
175
+ authToken = this.client.config.jwt;
176
+ url += '/backgroundassistant';
177
+ }
178
+ await this.client.http.requestApi(url, {
173
179
  method: 'post',
174
180
  host: this.client.config.apiHost,
175
- authToken: this.client.config.authToken,
181
+ authToken,
176
182
  logger: this.client.logger,
177
183
  data
178
184
  });