cidaas-javascript-sdk 2.2.7 → 2.3.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/CHANGELOG.md CHANGED
@@ -1,6 +1,18 @@
1
- ## [2.2.7](https://gitlab.widas.de/cidaas-public-devkits/cidaas-public-sdks/cidaas-javascript-sdk/compare/v2.2.6...v2.2.7) (2023-02-06)
1
+ # [2.3.0](https://gitlab.widas.de/cidaas-public-devkits/cidaas-public-sdks/cidaas-javascript-sdk/compare/v2.2.7...v2.3.0) (2023-03-02)
2
2
 
3
3
 
4
4
  ### Bug Fixes
5
5
 
6
- * **[gitlab-240](https://gitlab.widas.de/cidaas-v2/auth/issues/-/issues/240):** added cookie for device_dr ([bb50022](https://gitlab.widas.de/cidaas-public-devkits/cidaas-public-sdks/cidaas-javascript-sdk/commit/bb5002253e36fdccd1052bba746e2efbcd031a07))
6
+ * [813](https://gitlab.widas.de/cidaas-v2/ui/issues/-/issues/813) added headers parameters ([966b149](https://gitlab.widas.de/cidaas-public-devkits/cidaas-public-sdks/cidaas-javascript-sdk/commit/966b1493c93b5ccf80839f2bcff979a541974730))
7
+ * [813](https://gitlab.widas.de/cidaas-v2/ui/issues/-/issues/813) added headers parameters ([d085513](https://gitlab.widas.de/cidaas-public-devkits/cidaas-public-sdks/cidaas-javascript-sdk/commit/d085513585770cdae5bc6c8693d10c7f6764faaf))
8
+ * [813](https://gitlab.widas.de/cidaas-v2/ui/issues/-/issues/813) added headers parameters ([e103f95](https://gitlab.widas.de/cidaas-public-devkits/cidaas-public-sdks/cidaas-javascript-sdk/commit/e103f956583b727c7e66f32d56a38fac84ab3f02))
9
+ * [813](https://gitlab.widas.de/cidaas-v2/ui/issues/-/issues/813) added headers parameters ([a38ac72](https://gitlab.widas.de/cidaas-public-devkits/cidaas-public-sdks/cidaas-javascript-sdk/commit/a38ac7219decd19cd237ec82c6898ca09880218a))
10
+ * adapt review changes ([81aec32](https://gitlab.widas.de/cidaas-public-devkits/cidaas-public-sdks/cidaas-javascript-sdk/commit/81aec32ce735fad6955ee7db7c0e8edb80df3059))
11
+ * end statement with semicolon ([c924be0](https://gitlab.widas.de/cidaas-public-devkits/cidaas-public-sdks/cidaas-javascript-sdk/commit/c924be0a26022db76f5a516e20bf03051b809cc6))
12
+ * indentation fix and readme update ([4b1568f](https://gitlab.widas.de/cidaas-public-devkits/cidaas-public-sdks/cidaas-javascript-sdk/commit/4b1568f8068952b93fa43689ac04a8c2bd5a43ca))
13
+ * revert long-lat change ([86a35bc](https://gitlab.widas.de/cidaas-public-devkits/cidaas-public-sdks/cidaas-javascript-sdk/commit/86a35bc70d0ffd01b0f3a0acf13d5b0d114590f7))
14
+
15
+
16
+ ### Features
17
+
18
+ * added the acceptlanguage options in header ([7871bc9](https://gitlab.widas.de/cidaas-public-devkits/cidaas-public-sdks/cidaas-javascript-sdk/commit/7871bc9290ca34e5cf91d0ab00a0ae1905437bc6)), closes [/gitlab.widas.de/customer-specific-projects/integration-team/cidaas-public-devkit-documentation/-/issues/218#note_552348](https://gitlab.widas.de//gitlab.widas.de/customer-specific-projects/integration-team/cidaas-public-devkit-documentation/-/issues/218/issues/note_552348)
package/README.md CHANGED
@@ -193,7 +193,8 @@ To get the client basic information, call ****getClientInfo()****. This will ret
193
193
  ##### Sample code
194
194
  ```js
195
195
  cidaas.getClientInfo({
196
- requestId: 'your requestId'
196
+ requestId: 'your requestId',
197
+ acceptlanguage: 'your locale' // optional example: de-de, en-US
197
198
  }).then(function (resp) {
198
199
  // your success code here
199
200
  }).catch(function(ex) {
@@ -255,7 +256,7 @@ To handle registration, first you need the registration fields. To get the regis
255
256
  ```js
256
257
  cidaas.getRegistrationSetup({
257
258
  requestId: 'your requestId',
258
- acceptlanguage: 'your locale' // de-de, en-US
259
+ acceptlanguage: 'your locale' // optional example: de-de, en-US
259
260
  }).then(function (resp) {
260
261
  // your success code here
261
262
  }).catch(function(ex) {
@@ -361,7 +362,8 @@ cidaas.register({
361
362
  family_name: 'yyyyy',
362
363
  password: '123456',
363
364
  password_echo: '123456',
364
- provider: 'your provider' // FACEBOOK, GOOGLE, SELF
365
+ provider: 'your provider', // FACEBOOK, GOOGLE, SELF
366
+ acceptlanguage: 'your locale' // optional example: de-de, en-US
365
367
  }, headers).then(function (response) {
366
368
  // type your code here
367
369
  }).catch(function(ex) {
@@ -412,7 +414,8 @@ Once social register, it will redirect to the extra information page with reques
412
414
  ```js
413
415
  cidaas.getMissingFields({
414
416
  trackId: 'your trackId', // which you will get it from url
415
- requestId: 'your requestId' // which you will get it from url
417
+ requestId: 'your requestId', // which you will get it from url
418
+ acceptlanguage: 'your locale' // optional example: de-de, en-US
416
419
  }).then(function (response) {
417
420
  // type your code here
418
421
  }).catch(function (ex) {
@@ -430,7 +433,8 @@ Once registration successful, verify the account based on the flow. To get the d
430
433
 
431
434
  ```js
432
435
  cidaas.getCommunicationStatus({
433
- sub: 'your sub' // which you will get on the registration response
436
+ sub: 'your sub', // which you will get on the registration response
437
+ acceptlanguage: 'your locale' // optional example: de-de, en-US
434
438
  }).then(function (response) {
435
439
  // type your code here
436
440
  }).catch(function(ex) {
@@ -624,7 +628,8 @@ To get user profile details, pass access token to ****getProfileInfo()****.
624
628
 
625
629
  ```js
626
630
  cidaas.getProfileInfo({
627
- access_token: 'your access token'
631
+ access_token: 'your access token',
632
+ acceptlanguage: 'your locale' // optional example: de-de, en-US
628
633
  }).then(function (response) {
629
634
  // type your code here
630
635
  }).catch(function (ex) {
@@ -698,7 +703,8 @@ To get the user profile information, call ****getUserProfile()****.
698
703
  ##### Sample code
699
704
  ```js
700
705
  cidaas.getUserProfile({
701
- access_token: 'your access token'
706
+ access_token: 'your access token',
707
+ acceptlanguage: 'your locale' // optional example: de-de, en-US
702
708
  }).then(function (response) {
703
709
  // type your code here
704
710
  }).catch(function (ex) {
@@ -733,7 +739,8 @@ To update the user profile information, call ****updateProfile()****.
733
739
  cidaas.updateProfile({
734
740
  family_name: 'Doe',
735
741
  given_name: 'John',
736
- provider: 'self'
742
+ provider: 'self',
743
+ acceptlanguage: 'your locale' // optional example: de-de, en-US
737
744
  }, 'your access token', 'your sub').then(function () {
738
745
  // type your code here
739
746
  }).catch(function (ex) {
@@ -1755,7 +1762,8 @@ To get the details of consent tile and description, call ****getConsentDetails()
1755
1762
  ##### Sample code
1756
1763
  ```js
1757
1764
  this.cidaas.getConsentDetails({
1758
- consent_name: 'your consent name'
1765
+ consent_name: 'your consent name',
1766
+ acceptlanguage: 'your locale' // optional example: de-de, en-US
1759
1767
  }).then((response) => {
1760
1768
  // type your code here
1761
1769
  }).catch((err) => {
@@ -1878,7 +1886,8 @@ To get the list of existing users in deduplication, call ****getDeduplicationDet
1878
1886
  ##### Sample code
1879
1887
  ```js
1880
1888
  this.cidaas.getDeduplicationDetails({
1881
- track_id: 'your track id'
1889
+ track_id: 'your track id',
1890
+ acceptlanguage: 'your locale' // optional example: de-de, en-US
1882
1891
  }).then((response) => {
1883
1892
  // type your code here
1884
1893
  }).catch((err) => {
@@ -1912,7 +1921,8 @@ To register new user in deduplication, call ****registerDeduplication()****.
1912
1921
  ##### Sample code
1913
1922
  ```js
1914
1923
  this.cidaas.registerDeduplication({
1915
- track_id: 'your track id'
1924
+ track_id: 'your track id',
1925
+ acceptlanguage: 'your locale' // optional example: de-de, en-US
1916
1926
  }).then((response) => {
1917
1927
  // type your code here
1918
1928
  }).catch((err) => {
@@ -2055,4 +2065,3 @@ this.socket.on("status-update", (msg) => {
2055
2065
  }
2056
2066
  });
2057
2067
  ```
2058
- F
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cidaas-javascript-sdk",
3
- "version": "2.2.7",
3
+ "version": "2.3.0",
4
4
  "author": "cidaas by Widas ID GmbH",
5
5
  "description": "Cidaas native javascript sdk",
6
6
  "license": "MIT",
@@ -2,8 +2,7 @@ var Authentication = require('../authentication');
2
2
  var CustomException = require('./exception');
3
3
  var Oidc = require('oidc-client');
4
4
  var CryptoJS = require("crypto-js");
5
- var fingerprint = require('@fingerprintjs/fingerprintjs')
6
-
5
+ var fingerprint = require('@fingerprintjs/fingerprintjs');
7
6
 
8
7
  var code_verifier;
9
8
 
@@ -24,6 +23,17 @@ function WebAuth(settings) {
24
23
 
25
24
  var registrationFields = [];
26
25
 
26
+ // added the common header
27
+ function createHeaders(http, options) {
28
+ http.setRequestHeader("Content-Type", "application/json");
29
+ if (options && options.acceptlanguage) {
30
+ http.setRequestHeader("Accept-Language", options.acceptlanguage);
31
+ } else if (window.localeSettings) {
32
+ http.setRequestHeader("Accept-Language", window.localeSettings);
33
+ }
34
+ return http;
35
+ }
36
+
27
37
  // prototype methods
28
38
  // login
29
39
  WebAuth.prototype.loginWithBrowser = function () {
@@ -135,11 +145,8 @@ WebAuth.prototype.getUserProfile = function (options) {
135
145
  }
136
146
  };
137
147
  http.open("GET", _serviceURL, true);
138
- http.setRequestHeader("Content-type", "application/json");
148
+ http = createHeaders(http, options);
139
149
  http.setRequestHeader("Authorization", `Bearer ${options.access_token}`);
140
- if (window.localeSettings) {
141
- http.setRequestHeader("accept-language", window.localeSettings);
142
- }
143
150
  http.send();
144
151
  } catch (ex) {
145
152
  reject(ex);
@@ -162,11 +169,8 @@ WebAuth.prototype.getProfileInfo = function (access_token) {
162
169
  }
163
170
  };
164
171
  http.open("GET", _serviceURL, true);
165
- http.setRequestHeader("Content-type", "application/json");
172
+ http = createHeaders(http, null);
166
173
  http.setRequestHeader("Authorization", `Bearer ${access_token}`);
167
- if (window.localeSettings) {
168
- http.setRequestHeader("accept-language", window.localeSettings);
169
- }
170
174
  http.send();
171
175
  } catch (ex) {
172
176
  reject(ex);
@@ -246,9 +250,6 @@ function createPostPromise(options, serviceurl, errorResolver, access_token) {
246
250
  if (access_token) {
247
251
  http.setRequestHeader("Authorization", `Bearer ${access_token}`);
248
252
  }
249
- if (window.localeSettings) {
250
- http.setRequestHeader("accept-language", window.localeSettings);
251
- }
252
253
  if (options) {
253
254
  http.send(JSON.stringify(options));
254
255
  } else {
@@ -276,10 +277,7 @@ WebAuth.prototype.renewToken = function (options) {
276
277
  }
277
278
  };
278
279
  http.open("POST", _serviceURL, true);
279
- http.setRequestHeader("Content-type", "application/json");
280
- if (window.localeSettings) {
281
- http.setRequestHeader("accept-language", window.localeSettings);
282
- }
280
+ http = createHeaders(http, options);
283
281
  http.send(JSON.stringify(options));
284
282
  } catch (ex) {
285
283
  reject(ex);
@@ -353,10 +351,7 @@ WebAuth.prototype.getAccessToken = function (options) {
353
351
  }
354
352
  };
355
353
  http.open("POST", _serviceURL, true);
356
- http.setRequestHeader("Content-type", "application/json");
357
- if (window.localeSettings) {
358
- http.setRequestHeader("accept-language", window.localeSettings);
359
- }
354
+ http = createHeaders(http, options);
360
355
  http.send(JSON.stringify(options));
361
356
  } catch (ex) {
362
357
  reject(ex);
@@ -379,10 +374,7 @@ WebAuth.prototype.validateAccessToken = function (options) {
379
374
  }
380
375
  };
381
376
  http.open("POST", _serviceURL, true);
382
- http.setRequestHeader("Content-type", "application/json");
383
- if (window.localeSettings) {
384
- http.setRequestHeader("accept-language", window.localeSettings);
385
- }
377
+ http = createHeaders(http, options);
386
378
  http.send(JSON.stringify(options));
387
379
  } catch (ex) {
388
380
  reject(ex);
@@ -423,10 +415,7 @@ WebAuth.prototype.getRequestId = function () {
423
415
  }
424
416
  };
425
417
  http.open("POST", _serviceURL, true);
426
- http.setRequestHeader("Content-type", "application/json");
427
- if (window.localeSettings) {
428
- http.setRequestHeader("accept-language", window.localeSettings);
429
- }
418
+ http = createHeaders(http, null);
430
419
  http.send(JSON.stringify(bodyParams));
431
420
  } catch (ex) {
432
421
  reject(ex);
@@ -522,10 +511,7 @@ WebAuth.prototype.getMissingFields = function (options) {
522
511
  }
523
512
  };
524
513
  http.open("GET", _serviceURL, true);
525
- http.setRequestHeader("Content-type", "application/json");
526
- if (window.localeSettings) {
527
- http.setRequestHeader("accept-language", window.localeSettings);
528
- }
514
+ http = createHeaders(http, options);
529
515
  http.send();
530
516
  } catch (ex) {
531
517
  reject(ex);
@@ -549,10 +535,7 @@ WebAuth.prototype.getTenantInfo = function () {
549
535
  }
550
536
  };
551
537
  http.open("GET", _serviceURL, true);
552
- http.setRequestHeader("Content-type", "application/json");
553
- if (window.localeSettings) {
554
- http.setRequestHeader("accept-language", window.localeSettings);
555
- }
538
+ http = createHeaders(http, null);
556
539
  http.send();
557
540
  } catch (ex) {
558
541
  reject(ex);
@@ -585,10 +568,7 @@ WebAuth.prototype.getClientInfo = function (options) {
585
568
  }
586
569
  };
587
570
  http.open("GET", _serviceURL, true);
588
- http.setRequestHeader("Content-type", "application/json");
589
- if (window.localeSettings) {
590
- http.setRequestHeader("accept-language", window.localeSettings);
591
- }
571
+ http = createHeaders(http, options);
592
572
  http.send();
593
573
  } catch (ex) {
594
574
  reject(ex);
@@ -612,11 +592,8 @@ WebAuth.prototype.getDevicesInfo = function (options) {
612
592
  }
613
593
  };
614
594
  http.open("GET", _serviceURL, true);
615
- http.setRequestHeader("Content-type", "application/json");
616
- if (window.localeSettings) {
617
- http.setRequestHeader("accept-language", window.localeSettings);
618
- }
619
- if(window.navigator.userAgent) {
595
+ http = createHeaders(http, options);
596
+ if (window.navigator.userAgent) {
620
597
  http.setRequestBody("userAgent", window.navigator.userAgent)
621
598
  }
622
599
  http.send();
@@ -642,11 +619,8 @@ WebAuth.prototype.deleteDevice = function (options) {
642
619
  }
643
620
  };
644
621
  http.open("DELETE", _serviceURL, true);
645
- http.setRequestHeader("Content-type", "application/json");
646
- if (window.localeSettings) {
647
- http.setRequestHeader("accept-language", window.localeSettings);
648
- }
649
- if(window.navigator.userAgent) {
622
+ http = createHeaders(http, options);
623
+ if (window.navigator.userAgent) {
650
624
  http.setRequestBody("userAgent", window.navigator.userAgent)
651
625
  }
652
626
  http.send();
@@ -676,10 +650,7 @@ WebAuth.prototype.getRegistrationSetup = function (options) {
676
650
  }
677
651
  };
678
652
  http.open("GET", _serviceURL, true);
679
- http.setRequestHeader("Content-type", "application/json");
680
- if (window.localeSettings) {
681
- http.setRequestHeader("accept-language", window.localeSettings);
682
- }
653
+ http = createHeaders(http, options);
683
654
  http.send();
684
655
  } catch (ex) {
685
656
  reject(ex);
@@ -707,16 +678,11 @@ WebAuth.prototype.register = function (options, headers) {
707
678
  }
708
679
  };
709
680
  http.open("POST", _serviceURL, true);
710
- http.setRequestHeader("Content-type", "application/json");
681
+ http = createHeaders(http, options);
711
682
  http.setRequestHeader("requestId", headers.requestId);
712
683
  if (headers.captcha) {
713
684
  http.setRequestHeader("captcha", headers.captcha);
714
685
  }
715
- if (headers.acceptlanguage) {
716
- http.setRequestHeader("accept-language", headers.acceptlanguage);
717
- } else if (window.localeSettings) {
718
- http.setRequestHeader("accept-language", window.localeSettings);
719
- }
720
686
  if (headers.bot_captcha_response) {
721
687
  http.setRequestHeader("bot_captcha_response", headers.bot_captcha_response);
722
688
  }
@@ -747,10 +713,7 @@ WebAuth.prototype.getInviteUserDetails = function (options) {
747
713
  }
748
714
  };
749
715
  http.open("GET", _serviceURL, true);
750
- http.setRequestHeader("Content-type", "application/json");
751
- if (window.localeSettings) {
752
- http.setRequestHeader("accept-language", window.localeSettings);
753
- }
716
+ http = createHeaders(http, options);
754
717
  http.send();
755
718
  } catch (ex) {
756
719
  reject(ex);
@@ -774,13 +737,10 @@ WebAuth.prototype.getCommunicationStatus = function (options) {
774
737
  }
775
738
  };
776
739
  http.open("GET", _serviceURL, true);
777
- http.setRequestHeader("Content-type", "application/json");
740
+ http = createHeaders(http, options);
778
741
  if (options.requestId) {
779
742
  http.setRequestHeader("requestId", options.requestId);
780
743
  }
781
- if (window.localeSettings) {
782
- http.setRequestHeader("accept-language", window.localeSettings);
783
- }
784
744
  http.send();
785
745
  } catch (ex) {
786
746
  reject(ex);
@@ -813,7 +773,7 @@ WebAuth.prototype.initiateAccountVerification = function (options) {
813
773
 
814
774
  // initiate verification and return response
815
775
  WebAuth.prototype.initiateAccountVerificationAsynFn = async function (options) {
816
- try {
776
+ try {
817
777
 
818
778
  const searchParams = new URLSearchParams(options);
819
779
 
@@ -830,8 +790,8 @@ WebAuth.prototype.initiateAccountVerificationAsynFn = async function (options) {
830
790
 
831
791
  } catch (ex) {
832
792
  throw new CustomException(ex, 417);
833
- }
834
-
793
+ }
794
+
835
795
  };
836
796
 
837
797
  // verofy account
@@ -918,10 +878,7 @@ WebAuth.prototype.getMFAList = function (options) {
918
878
  }
919
879
  };
920
880
  http.open("GET", _serviceURL, true);
921
- http.setRequestHeader("Content-type", "application/json");
922
- if (window.localeSettings) {
923
- http.setRequestHeader("accept-language", window.localeSettings);
924
- }
881
+ http = createHeaders(http, options);
925
882
  http.send();
926
883
  } catch (ex) {
927
884
  reject(ex);
@@ -940,7 +897,7 @@ WebAuth.prototype.getMFAListV2 = function (options) {
940
897
  // initiate mfa v2
941
898
  WebAuth.prototype.initiateMFAV2 = function (options) {
942
899
  var _serviceURL = window.webAuthSettings.authority + "/verification-srv/v2/authenticate/initiate/" + options.type;
943
- return createPostPromise(options, _serviceURL, undefined);
900
+ return createPostPromise(options, _serviceURL, false);
944
901
  };
945
902
 
946
903
  // initiate email
@@ -953,7 +910,7 @@ WebAuth.prototype.initiateEmail = function (options) {
953
910
  // initiate email v2
954
911
  WebAuth.prototype.initiateEmailV2 = function (options) {
955
912
  var _serviceURL = window.webAuthSettings.authority + "/verification-srv/v2/authenticate/initiate/email";
956
- return createPostPromise(options, _serviceURL, undefined);
913
+ return createPostPromise(options, _serviceURL, false);
957
914
  };
958
915
 
959
916
  // initiate sms
@@ -966,7 +923,7 @@ WebAuth.prototype.initiateSMS = function (options) {
966
923
  // initiate sms v2
967
924
  WebAuth.prototype.initiateSMSV2 = function (options) {
968
925
  var _serviceURL = window.webAuthSettings.authority + "/verification-srv/v2/authenticate/initiate/sms";
969
- return createPostPromise(options, _serviceURL, undefined);
926
+ return createPostPromise(options, _serviceURL, false);
970
927
  };
971
928
 
972
929
  // initiate ivr
@@ -1189,10 +1146,7 @@ WebAuth.prototype.getConsentDetails = function (options) {
1189
1146
  }
1190
1147
  };
1191
1148
  http.open("GET", _serviceURL, true);
1192
- http.setRequestHeader("Content-type", "application/json");
1193
- if (window.localeSettings) {
1194
- http.setRequestHeader("accept-language", window.localeSettings);
1195
- }
1149
+ http = createHeaders(http, options);
1196
1150
  http.send();
1197
1151
  } catch (ex) {
1198
1152
  reject(ex);
@@ -1233,10 +1187,7 @@ WebAuth.prototype.getScopeConsentDetails = function (options) {
1233
1187
  }
1234
1188
  };
1235
1189
  http.open("GET", _serviceURL, true);
1236
- http.setRequestHeader("Content-type", "application/json");
1237
- if (window.localeSettings) {
1238
- http.setRequestHeader("accept-language", window.localeSettings);
1239
- }
1190
+ http = createHeaders(http, options);
1240
1191
  http.send();
1241
1192
  } catch (ex) {
1242
1193
  reject(ex);
@@ -1260,11 +1211,8 @@ WebAuth.prototype.getScopeConsentVersionDetailsV2 = function (options) {
1260
1211
  }
1261
1212
  };
1262
1213
  http.open("GET", _serviceURL, true);
1263
- http.setRequestHeader("Content-type", "application/json");
1214
+ http = createHeaders(http, options);
1264
1215
  http.setRequestHeader("Authorization", `Bearer ${options.access_token}`);
1265
- if (window.localeSettings) {
1266
- http.setRequestHeader("accept-language", window.localeSettings);
1267
- }
1268
1216
  http.send();
1269
1217
  } catch (ex) {
1270
1218
  reject(ex);
@@ -1333,10 +1281,7 @@ WebAuth.prototype.getDeduplicationDetails = function (options) {
1333
1281
  }
1334
1282
  };
1335
1283
  http.open("GET", _serviceURL, true);
1336
- http.setRequestHeader("Content-type", "application/json");
1337
- if (window.localeSettings) {
1338
- http.setRequestHeader("accept-language", window.localeSettings);
1339
- }
1284
+ http = createHeaders(http, options);
1340
1285
  http.send();
1341
1286
  } catch (ex) {
1342
1287
  reject(ex);
@@ -1369,10 +1314,7 @@ WebAuth.prototype.registerDeduplication = function (options) {
1369
1314
  }
1370
1315
  };
1371
1316
  http.open("POST", _serviceURL, true);
1372
- http.setRequestHeader("Content-type", "application/json");
1373
- if (window.localeSettings) {
1374
- http.setRequestHeader("accept-language", window.localeSettings);
1375
- }
1317
+ http = createHeaders(http, options);
1376
1318
  http.send();
1377
1319
  } catch (ex) {
1378
1320
  reject(ex);
@@ -1473,11 +1415,8 @@ WebAuth.prototype.updateProfile = function (options, access_token, sub) {
1473
1415
  }
1474
1416
  };
1475
1417
  http.open("PUT", _serviceURL, true);
1476
- http.setRequestHeader("Content-type", "application/json");
1418
+ http = createHeaders(http, options);
1477
1419
  http.setRequestHeader("Authorization", `Bearer ${access_token}`);
1478
- if (window.localeSettings) {
1479
- http.setRequestHeader("accept-language", window.localeSettings);
1480
- }
1481
1420
  http.send(JSON.stringify(options));
1482
1421
  } catch (ex) {
1483
1422
  throw new CustomException(ex, 417);
@@ -1507,11 +1446,9 @@ WebAuth.prototype.getUnreviewedDevices = function (access_token, sub) {
1507
1446
  }
1508
1447
  };
1509
1448
  http.open("GET", _serviceURL, true);
1510
- http.setRequestHeader("Content-type", "application/json");
1449
+ http = createHeaders(http, options);
1511
1450
  http.setRequestHeader("Authorization", `Bearer ${access_token}`);
1512
- if (window.localeSettings) {
1513
- http.setRequestHeader("accept-language", window.localeSettings);
1514
- }
1451
+
1515
1452
  http.send();
1516
1453
  } catch (ex) {
1517
1454
  throw new CustomException(ex, 417);
@@ -1535,11 +1472,8 @@ WebAuth.prototype.getReviewedDevices = function (access_token, sub) {
1535
1472
  }
1536
1473
  };
1537
1474
  http.open("GET", _serviceURL, true);
1538
- http.setRequestHeader("Content-type", "application/json");
1475
+ http = createHeaders(http, options);
1539
1476
  http.setRequestHeader("Authorization", `Bearer ${access_token}`);
1540
- if (window.localeSettings) {
1541
- http.setRequestHeader("accept-language", window.localeSettings);
1542
- }
1543
1477
  http.send();
1544
1478
  } catch (ex) {
1545
1479
  throw new CustomException(ex, 417);
@@ -1563,11 +1497,8 @@ WebAuth.prototype.reviewDevice = function (options, access_token, sub) {
1563
1497
  }
1564
1498
  };
1565
1499
  http.open("PUT", _serviceURL, true);
1566
- http.setRequestHeader("Content-type", "application/json");
1500
+ http = createHeaders(http, options);
1567
1501
  http.setRequestHeader("Authorization", `Bearer ${access_token}`);
1568
- if (window.localeSettings) {
1569
- http.setRequestHeader("accept-language", window.localeSettings);
1570
- }
1571
1502
  http.send(JSON.stringify(options));
1572
1503
  } catch (ex) {
1573
1504
  throw new CustomException(ex, 417);
@@ -1597,11 +1528,8 @@ WebAuth.prototype.viewAcceptedConsent = function (options, access_token) {
1597
1528
  }
1598
1529
  };
1599
1530
  http.open("GET", _serviceURL, true);
1600
- http.setRequestHeader("Content-type", "application/json");
1531
+ http = createHeaders(http, options);
1601
1532
  http.setRequestHeader("Authorization", `Bearer ${access_token}`);
1602
- if (window.localeSettings) {
1603
- http.setRequestHeader("accept-language", window.localeSettings);
1604
- }
1605
1533
  http.send();
1606
1534
  } catch (ex) {
1607
1535
  throw new CustomException(ex, 417);
@@ -1803,10 +1731,8 @@ WebAuth.prototype.authenticateFaceVerification = function (options) {
1803
1731
  }
1804
1732
  };
1805
1733
  http.open("POST", _serviceURL, true);
1734
+ http = createHeaders(http, options);
1806
1735
  http.setRequestHeader("Content-type", "multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW");
1807
- if (window.localeSettings) {
1808
- http.setRequestHeader("accept-language", window.localeSettings);
1809
- }
1810
1736
  http.send(JSON.stringify(options));
1811
1737
  } catch (ex) {
1812
1738
  reject(ex);
@@ -1842,10 +1768,7 @@ WebAuth.prototype.getMissingFieldsLogin = function (trackId) {
1842
1768
  }
1843
1769
  };
1844
1770
  http.open("GET", _serviceURL, true);
1845
- http.setRequestHeader("Content-type", "application/json");
1846
- if (window.localeSettings) {
1847
- http.setRequestHeader("accept-language", window.localeSettings);
1848
- }
1771
+ http = createHeaders(http, options);
1849
1772
  http.send();
1850
1773
  } catch (ex) {
1851
1774
  reject(ex);
@@ -1869,14 +1792,9 @@ WebAuth.prototype.progressiveRegistration = function (options, headers) {
1869
1792
  }
1870
1793
  };
1871
1794
  http.open("POST", _serviceURL, true);
1872
- http.setRequestHeader("Content-type", "application/json");
1795
+ http = createHeaders(http, options);
1873
1796
  http.setRequestHeader("requestId", headers.requestId);
1874
1797
  http.setRequestHeader("trackId", headers.trackId);
1875
- if (headers.acceptlanguage) {
1876
- http.setRequestHeader("accept-language", headers.acceptlanguage);
1877
- } else if (window.localeSettings) {
1878
- http.setRequestHeader("accept-language", window.localeSettings);
1879
- }
1880
1798
  http.send(JSON.stringify(options));
1881
1799
  } catch (ex) {
1882
1800
  reject(ex);
@@ -1942,10 +1860,10 @@ WebAuth.prototype.setAcceptLanguageHeader = function (acceptLanguage) {
1942
1860
  WebAuth.prototype.getDeviceInfo = function () {
1943
1861
  return new Promise(function (resolve, reject) {
1944
1862
  try {
1945
- const value = ('; '+document.cookie).split(`; cidaas_dr=`).pop().split(';')[0];
1863
+ const value = ('; ' + document.cookie).split(`; cidaas_dr=`).pop().split(';')[0];
1946
1864
  const fpPromise = fingerprint.load();
1947
- var options = {fingerprint:"", userAgent:""};
1948
- if(!value) {
1865
+ var options = { fingerprint: "", userAgent: "" };
1866
+ if (!value) {
1949
1867
  (async () => {
1950
1868
  const fp = await fpPromise;
1951
1869
  const result = await fp.get();
@@ -1959,10 +1877,7 @@ WebAuth.prototype.getDeviceInfo = function () {
1959
1877
  }
1960
1878
  };
1961
1879
  http.open("POST", _serviceURL, true);
1962
- http.setRequestHeader("Content-type", "application/json");
1963
- if (window.localeSettings) {
1964
- http.setRequestHeader("accept-language", window.localeSettings);
1965
- }
1880
+ http = createHeaders(http, options);
1966
1881
  http.send(JSON.stringify(options));
1967
1882
  })();
1968
1883
  }