File tree Expand file tree Collapse file tree 3 files changed +19
-3
lines changed Expand file tree Collapse file tree 3 files changed +19
-3
lines changed Original file line number Diff line number Diff line change 1+ import { CLIENT_METADATA } from './constants' ;
12export enum ErrorCode {
23 CLIENT_ERROR_CODE_USAGE_LIMIT_REACHED = 'CLIENT_ERROR_CODE_USAGE_LIMIT_REACHED' ,
34 CLIENT_ERROR_CODE_VALIDATION_ERROR = 'CLIENT_ERROR_CODE_VALIDATION_ERROR' ,
@@ -72,6 +73,7 @@ export class ClientError extends Error {
7273 sendErrorMetric ( 'client_error' , code , {
7374 details,
7475 statusCode,
76+ ...CLIENT_METADATA ,
7577 } ) ;
7678 }
7779}
Original file line number Diff line number Diff line change 1+ import { version } from '../../package.json' ;
2+
13// Core API
24export const DEFAULT_HEADERS = {
35 'Content-Type' : 'application/json' ,
@@ -14,3 +16,8 @@ export const CONNECTION_CLOSED_CODE_SIGNALLING_CLIENT_CONNECTION_FAILURE =
1416 'CONNECTION_CLOSED_CODE_SIGNALLING_CLIENT_CONNECTION_FAILURE' ;
1517export const CONNECTION_CLOSED_CODE_WEBRTC_FAILURE =
1618 'CONNECTION_CLOSED_CODE_WEBRTC_FAILURE' ;
19+
20+ export const CLIENT_METADATA = {
21+ client : 'js-sdk' ,
22+ version,
23+ } ;
Original file line number Diff line number Diff line change 11import { ClientError , ErrorCode } from '../lib/ClientError' ;
2- import { DEFAULT_API_BASE_URL , DEFAULT_API_VERSION } from '../lib/constants' ;
2+ import {
3+ CLIENT_METADATA ,
4+ DEFAULT_API_BASE_URL ,
5+ DEFAULT_API_VERSION ,
6+ } from '../lib/constants' ;
37import {
48 CoreApiRestClientOptions ,
59 PersonaConfig ,
@@ -40,7 +44,6 @@ export class CoreApiRestClient {
4044 400 ,
4145 ) ;
4246 }
43- // TODO: why do we need to get the unsafe session token here?
4447 this . sessionToken = await this . unsafe_getSessionToken ( personaConfig ) ;
4548 }
4649
@@ -51,7 +54,11 @@ export class CoreApiRestClient {
5154 'Content-Type' : 'application/json' ,
5255 Authorization : `Bearer ${ this . sessionToken } ` ,
5356 } ,
54- body : JSON . stringify ( { personaConfig, sessionOptions } ) ,
57+ body : JSON . stringify ( {
58+ personaConfig,
59+ sessionOptions,
60+ clientMetadata : CLIENT_METADATA ,
61+ } ) ,
5562 } ) ;
5663
5764 const data = await response . json ( ) ;
You can’t perform that action at this time.
0 commit comments