cidaas-javascript-sdk 3.0.4 → 3.1.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.
@@ -1,10 +1,10 @@
1
- export declare class AcceptResetPasswordEntity {
1
+ export interface AcceptResetPasswordEntity {
2
2
  resetRequestId: string;
3
3
  exchangeId: string;
4
4
  password: string;
5
5
  confirmPassword: string;
6
- provider: string;
7
- requestId: string;
6
+ provider?: string;
7
+ requestId?: string;
8
8
  }
9
9
  export declare class AccessTokenRequest {
10
10
  grant_type?: string;
@@ -71,20 +71,20 @@ export interface IDeviceRequest {
71
71
  deviceType: string;
72
72
  }
73
73
  export type AccountVerificationRequestEntity = {
74
- email: string;
75
- mobile: string;
76
- phone: string;
77
- username: string;
78
- verificationMedium: string;
79
- processingType: string;
80
- requestId: string;
81
- client_id: string;
82
- redirect_uri: string;
83
- response_type: string;
74
+ email?: string;
75
+ mobile?: string;
76
+ phone?: string;
77
+ username?: string;
78
+ verificationMedium?: string;
79
+ processingType?: string;
80
+ requestId?: string;
81
+ client_id?: string;
82
+ redirect_uri?: string;
83
+ response_type?: string;
84
84
  sub: string;
85
- templateKey: string;
86
- name: string;
87
- accept_language: string;
85
+ templateKey?: string;
86
+ name?: string;
87
+ accept_language?: string;
88
88
  };
89
89
  export interface ChangePasswordEntity {
90
90
  sub: string;
@@ -266,47 +266,6 @@ export interface IUserEntity {
266
266
  trackId: string;
267
267
  need_reset_password: boolean;
268
268
  }
269
- export interface IUserEntity {
270
- userStatus: string;
271
- user_status: string;
272
- user_status_reason: string;
273
- username: string;
274
- sub: string;
275
- given_name: string;
276
- family_name: string;
277
- middle_name: string;
278
- nickname: string;
279
- originalProviderUserId?: string[];
280
- email: string;
281
- email_verified: boolean;
282
- mobile_number: string;
283
- mobile_number_obj: IMobileEntity | null;
284
- mobile_number_verified: boolean;
285
- phone_number: string;
286
- phone_number_obj: IMobileEntity | null;
287
- phone_number_verified: boolean;
288
- profile: string;
289
- picture: string;
290
- website: string;
291
- gender: string;
292
- zoneinfo: string;
293
- locale: string;
294
- birthdate: Date | null;
295
- address?: IAddressEntity;
296
- customFields?: any;
297
- identityCustomFields?: any;
298
- password: string;
299
- provider: string;
300
- providerUserId: string;
301
- identityId: string;
302
- mfa_enabled?: boolean;
303
- roles: string[];
304
- userGroups: IUserGroupMap[];
305
- groups?: IUserGroupMap[];
306
- rawJSON: string;
307
- trackId: string;
308
- need_reset_password: boolean;
309
- }
310
269
  export interface IUserGroupMap {
311
270
  sub: string;
312
271
  groupId: string;
@@ -346,30 +305,30 @@ export interface LoginFormRequestEntity {
346
305
  username: string;
347
306
  password: string;
348
307
  requestId: string;
349
- provider: string;
350
- captcha: string;
351
- username_type: string;
352
- field_key: string;
353
- bot_captcha_response: string;
354
- csrf_token: string;
308
+ provider?: string;
309
+ captcha?: string;
310
+ username_type?: string;
311
+ field_key?: string;
312
+ bot_captcha_response?: string;
313
+ csrf_token?: string;
355
314
  dc?: string;
356
315
  device_fp?: string;
357
316
  captcha_ref?: string;
358
317
  locale?: string;
359
- rememberMe: boolean;
360
- remember_me: boolean;
318
+ rememberMe?: boolean;
319
+ remember_me?: boolean;
361
320
  }
362
321
  export interface ResetPasswordEntity {
363
322
  email: string;
364
- mobile: string;
365
- phone: string;
366
- username: string;
367
- resetMedium: string;
368
- processingType: string;
323
+ mobile?: string;
324
+ phone?: string;
325
+ username?: string;
326
+ resetMedium: "SMS" | "EMAIL" | "IVR";
327
+ processingType: "CODE" | "LINK";
369
328
  requestId: string;
370
- provider: string;
371
- resetPasswordId: string;
372
- sub: string;
329
+ provider?: string;
330
+ resetPasswordId?: string;
331
+ sub?: string;
373
332
  }
374
333
  export declare class TokenIntrospectionEntity {
375
334
  token: string;
@@ -409,51 +368,51 @@ export interface UserActivityEntity {
409
368
  events?: [string];
410
369
  }
411
370
  export declare class UserEntity {
412
- userStatus: string;
371
+ userStatus?: string;
413
372
  user_status?: string;
414
- user_status_reason: string;
415
- username: string;
416
- sub: string;
373
+ user_status_reason?: string;
374
+ username?: string;
375
+ sub?: string;
417
376
  originalProviderUserId?: string[];
418
377
  given_name: string;
419
378
  family_name: string;
420
- middle_name: string;
421
- nickname: string;
379
+ middle_name?: string;
380
+ nickname?: string;
422
381
  email: string;
423
- email_verified: boolean;
424
- mobile_number: string;
425
- mobile_number_obj: IMobileEntity | null;
426
- mobile_number_verified: boolean;
427
- phone_number: string;
428
- phone_number_obj: IMobileEntity | null;
429
- phone_number_verified: boolean;
430
- profile: string;
431
- picture: string;
432
- website: string;
433
- gender: string;
434
- zoneinfo: string;
435
- locale: string;
436
- birthdate: Date | string;
382
+ email_verified?: boolean;
383
+ mobile_number?: string;
384
+ mobile_number_obj?: IMobileEntity | null;
385
+ mobile_number_verified?: boolean;
386
+ phone_number?: string;
387
+ phone_number_obj?: IMobileEntity | null;
388
+ phone_number_verified?: boolean;
389
+ profile?: string;
390
+ picture?: string;
391
+ website?: string;
392
+ gender?: string;
393
+ zoneinfo?: string;
394
+ locale?: string;
395
+ birthdate?: Date | string;
437
396
  address?: AddressEntity;
438
397
  customFields?: any;
439
398
  identityCustomFields?: any;
440
399
  password: string;
441
- password_echo?: string;
442
- password_hash_info: any | null;
443
- generate_password: boolean;
444
- provider: string;
445
- identityId: string;
446
- providerUserId: string;
447
- providerBusinessIds: string[];
448
- street_address: string;
400
+ password_echo: string;
401
+ password_hash_info?: any | null;
402
+ generate_password?: boolean;
403
+ provider?: string;
404
+ identityId?: string;
405
+ providerUserId?: string;
406
+ providerBusinessIds?: string[];
407
+ street_address?: string;
449
408
  mfa_enabled?: boolean;
450
409
  roles?: string[];
451
410
  groups?: IUserGroupMap[];
452
411
  userGroups?: IUserGroupMap[];
453
- trackId: string;
454
- rawJSON: string;
455
- need_reset_password: boolean;
456
- no_event: boolean;
412
+ trackId?: string;
413
+ rawJSON?: string;
414
+ need_reset_password?: boolean;
415
+ no_event?: boolean;
457
416
  consents?: IConsentField[] | IConsentTrackingEntity[];
458
417
  consent_track_ids?: string[];
459
418
  ignore_default_roles?: string[];
@@ -556,12 +515,12 @@ export declare class ValidateResetPasswordEntity {
556
515
  code: string;
557
516
  }
558
517
  export interface IChangePasswordEntity {
559
- sub: string;
560
- identityId: string;
518
+ sub?: string;
519
+ identityId?: string;
561
520
  old_password: string;
562
521
  new_password: string;
563
522
  confirm_password: string;
564
- accessToken: string;
523
+ accessToken?: string;
565
524
  loginSettingsId: string;
566
- client_id: string;
525
+ client_id?: string;
567
526
  }
@@ -1,18 +1,6 @@
1
1
  "use strict";
2
2
  exports.__esModule = true;
3
- exports.ValidateResetPasswordEntity = exports.UpdateReviewDeviceEntity = exports.GroupValidationEntity = exports.TokenIntrospectionEntity = exports.FindUserEntity = exports.PhysicalVerificationLoginRequest = exports.AccessTokenRequest = exports.AcceptResetPasswordEntity = void 0;
4
- var AcceptResetPasswordEntity = /** @class */ (function () {
5
- function AcceptResetPasswordEntity() {
6
- this.resetRequestId = "";
7
- this.exchangeId = "";
8
- this.password = "";
9
- this.confirmPassword = "";
10
- this.provider = "";
11
- this.requestId = "";
12
- }
13
- return AcceptResetPasswordEntity;
14
- }());
15
- exports.AcceptResetPasswordEntity = AcceptResetPasswordEntity;
3
+ exports.ValidateResetPasswordEntity = exports.UpdateReviewDeviceEntity = exports.GroupValidationEntity = exports.TokenIntrospectionEntity = exports.FindUserEntity = exports.PhysicalVerificationLoginRequest = exports.AccessTokenRequest = void 0;
16
4
  var AccessTokenRequest = /** @class */ (function () {
17
5
  function AccessTokenRequest() {
18
6
  this.user_agent = "";
@@ -11,11 +11,11 @@ export declare class Helper {
11
11
  * @param options
12
12
  * @param serviceurl
13
13
  * @param errorResolver
14
- * @param access_token
15
- * @param headers
14
+ * @param access_token??
15
+ * @param headers??
16
16
  * @returns
17
17
  */
18
- static createPostPromise(options: any, serviceurl: string, errorResolver: boolean, access_token?: string, headers?: any): Promise<unknown>;
18
+ static createPostPromise(options: any, serviceurl: string, errorResolver: boolean, method: string, access_token?: string, headers?: any): Promise<unknown>;
19
19
  }
20
20
  export declare class CustomException {
21
21
  errorMessage: string;
@@ -31,11 +31,11 @@ var Helper = /** @class */ (function () {
31
31
  * @param options
32
32
  * @param serviceurl
33
33
  * @param errorResolver
34
- * @param access_token
35
- * @param headers
34
+ * @param access_token??
35
+ * @param headers??
36
36
  * @returns
37
37
  */
38
- Helper.createPostPromise = function (options, serviceurl, errorResolver, access_token, headers) {
38
+ Helper.createPostPromise = function (options, serviceurl, errorResolver, method, access_token, headers) {
39
39
  return new Promise(function (resolve, reject) {
40
40
  try {
41
41
  var http = new XMLHttpRequest();
@@ -49,7 +49,7 @@ var Helper = /** @class */ (function () {
49
49
  }
50
50
  }
51
51
  };
52
- http.open("POST", serviceurl, true);
52
+ http.open(method, serviceurl, true);
53
53
  http.setRequestHeader("Content-type", "application/json");
54
54
  if (headers) {
55
55
  for (var key in headers) {
@@ -24,7 +24,7 @@ export declare namespace LoginService {
24
24
  device_fp: string;
25
25
  }): void;
26
26
  /**
27
- * register with social
27
+ * with social
28
28
  * @param options
29
29
  * @param queryParams
30
30
  */
@@ -94,9 +94,10 @@ export declare namespace LoginService {
94
94
  * @param options
95
95
  */
96
96
  function loginAfterRegister(options: {
97
- device_id: string;
97
+ device_id?: string;
98
98
  dc?: string;
99
- rememberMe: boolean;
100
- trackId: string;
99
+ rememberMe?: boolean;
100
+ trackId?: string;
101
+ device_fp?: string;
101
102
  }): void;
102
103
  }
@@ -65,7 +65,7 @@ var LoginService;
65
65
  LoginService.loginWithSocial = loginWithSocial;
66
66
  ;
67
67
  /**
68
- * register with social
68
+ * with social
69
69
  * @param options
70
70
  * @param queryParams
71
71
  */
@@ -10,31 +10,13 @@ var TokenService;
10
10
  * @returns
11
11
  */
12
12
  function renewToken(options) {
13
- return new Promise(function (resolve, reject) {
14
- try {
15
- if (!options.refresh_token) {
16
- throw new Helper_1.CustomException("refresh_token cannot be empty", 417);
17
- }
18
- options.client_id = window.webAuthSettings.client_id;
19
- options.grant_type = 'refresh_token';
20
- var http = new XMLHttpRequest();
21
- var _serviceURL = window.webAuthSettings.authority + "/token-srv/token";
22
- http.onreadystatechange = function () {
23
- if (http.readyState == 4) {
24
- resolve(JSON.parse(http.responseText));
25
- }
26
- };
27
- http.open("POST", _serviceURL, true);
28
- http.setRequestHeader("Content-type", "application/json");
29
- if (window.localeSettings) {
30
- http.setRequestHeader("accept-language", window.localeSettings);
31
- }
32
- http.send(JSON.stringify(options));
33
- }
34
- catch (ex) {
35
- reject(ex);
36
- }
37
- });
13
+ if (!options.refresh_token) {
14
+ throw new Helper_1.CustomException("refresh_token cannot be empty", 417);
15
+ }
16
+ options.client_id = window.webAuthSettings.client_id;
17
+ options.grant_type = 'refresh_token';
18
+ var _serviceURL = window.webAuthSettings.authority + "/token-srv/token";
19
+ return Helper_1.Helper.createPostPromise(options, _serviceURL, undefined, "POST");
38
20
  }
39
21
  TokenService.renewToken = renewToken;
40
22
  ;
@@ -44,34 +26,20 @@ var TokenService;
44
26
  * @returns
45
27
  */
46
28
  function getAccessToken(options) {
47
- var _this = this;
48
- return new Promise(function (resolve, reject) {
49
- try {
50
- if (!options.code) {
51
- throw new Helper_1.CustomException("code cannot be empty", 417);
52
- }
53
- options.client_id = window.webAuthSettings.client_id;
54
- options.redirect_uri = window.webAuthSettings.redirect_uri;
55
- options.code_verifier = _this.code_verifier;
56
- options.grant_type = "authorization_code";
57
- var http = new XMLHttpRequest();
58
- var _serviceURL = window.webAuthSettings.authority + "/token-srv/token";
59
- http.onreadystatechange = function () {
60
- if (http.readyState == 4) {
61
- resolve(JSON.parse(http.responseText));
62
- }
63
- };
64
- http.open("POST", _serviceURL, true);
65
- http.setRequestHeader("Content-type", "application/json");
66
- if (window.localeSettings) {
67
- http.setRequestHeader("accept-language", window.localeSettings);
68
- }
69
- http.send(JSON.stringify(options));
70
- }
71
- catch (ex) {
72
- reject(ex);
73
- }
74
- });
29
+ if (!options.code) {
30
+ throw new Helper_1.CustomException("code cannot be empty", 417);
31
+ }
32
+ options.client_id = window.webAuthSettings.client_id;
33
+ options.redirect_uri = window.webAuthSettings.redirect_uri;
34
+ options.grant_type = "authorization_code";
35
+ if (!window.webAuthSettings.disablePKCE) {
36
+ window.usermanager._client.createSigninRequest(window.webAuthSettings).then(function (signInRequest) {
37
+ var _a;
38
+ options.code_verifier = (_a = signInRequest.state) === null || _a === void 0 ? void 0 : _a.code_verifier;
39
+ });
40
+ }
41
+ var _serviceURL = window.webAuthSettings.authority + "/token-srv/token";
42
+ return Helper_1.Helper.createPostPromise(options, _serviceURL, undefined, "POST");
75
43
  }
76
44
  TokenService.getAccessToken = getAccessToken;
77
45
  ;
@@ -81,29 +49,11 @@ var TokenService;
81
49
  * @returns
82
50
  */
83
51
  function validateAccessToken(options) {
84
- return new Promise(function (resolve, reject) {
85
- try {
86
- if (!options.token || !options.token_type_hint) {
87
- throw new Helper_1.CustomException("token or token_type_hint cannot be empty", 417);
88
- }
89
- var http = new XMLHttpRequest();
90
- var _serviceURL = window.webAuthSettings.authority + "/token-srv/introspect";
91
- http.onreadystatechange = function () {
92
- if (http.readyState == 4) {
93
- resolve(JSON.parse(http.responseText));
94
- }
95
- };
96
- http.open("POST", _serviceURL, true);
97
- http.setRequestHeader("Content-type", "application/json");
98
- if (window.localeSettings) {
99
- http.setRequestHeader("accept-language", window.localeSettings);
100
- }
101
- http.send(JSON.stringify(options));
102
- }
103
- catch (ex) {
104
- reject(ex);
105
- }
106
- });
52
+ if (!options.token || !options.token_type_hint) {
53
+ throw new Helper_1.CustomException("token or token_type_hint cannot be empty", 417);
54
+ }
55
+ var _serviceURL = window.webAuthSettings.authority + "/token-srv/introspect";
56
+ return Helper_1.Helper.createPostPromise(options, _serviceURL, false, "POST");
107
57
  }
108
58
  TokenService.validateAccessToken = validateAccessToken;
109
59
  ;
@@ -113,31 +63,8 @@ var TokenService;
113
63
  * @returns
114
64
  */
115
65
  function getScopeConsentDetails(options) {
116
- return new Promise(function (resolve, reject) {
117
- try {
118
- var http = new XMLHttpRequest();
119
- var _serviceURL = window.webAuthSettings.authority + "/token-srv/prelogin/metadata/" + options.track_id + "?acceptLanguage=" + options.locale;
120
- http.onreadystatechange = function () {
121
- if (http.readyState == 4) {
122
- if (http.responseText) {
123
- resolve(JSON.parse(http.responseText));
124
- }
125
- else {
126
- resolve(false);
127
- }
128
- }
129
- };
130
- http.open("GET", _serviceURL, true);
131
- http.setRequestHeader("Content-type", "application/json");
132
- if (window.localeSettings) {
133
- http.setRequestHeader("accept-language", window.localeSettings);
134
- }
135
- http.send();
136
- }
137
- catch (ex) {
138
- reject(ex);
139
- }
140
- });
66
+ var _serviceURL = window.webAuthSettings.authority + "/token-srv/prelogin/metadata/" + options.track_id + "?acceptLanguage=" + options.locale;
67
+ return Helper_1.Helper.createPostPromise(undefined, _serviceURL, false, "GET");
141
68
  }
142
69
  TokenService.getScopeConsentDetails = getScopeConsentDetails;
143
70
  ;
@@ -149,7 +76,7 @@ var TokenService;
149
76
  */
150
77
  function updateSuggestMFA(track_id, options) {
151
78
  var _serviceURL = window.webAuthSettings.authority + "/token-srv/prelogin/suggested/mfa/update/" + track_id;
152
- return Helper_1.Helper.createPostPromise(options, _serviceURL, false);
79
+ return Helper_1.Helper.createPostPromise(options, _serviceURL, false, "POST");
153
80
  }
154
81
  TokenService.updateSuggestMFA = updateSuggestMFA;
155
82
  ;
@@ -159,31 +86,8 @@ var TokenService;
159
86
  * @returns
160
87
  */
161
88
  function getMissingFieldsLogin(trackId) {
162
- return new Promise(function (resolve, reject) {
163
- try {
164
- var http = new XMLHttpRequest();
165
- var _serviceURL = window.webAuthSettings.authority + "/token-srv/prelogin/metadata/" + trackId;
166
- http.onreadystatechange = function () {
167
- if (http.readyState == 4) {
168
- if (http.responseText) {
169
- resolve(JSON.parse(http.responseText));
170
- }
171
- else {
172
- resolve(undefined);
173
- }
174
- }
175
- };
176
- http.open("GET", _serviceURL, true);
177
- http.setRequestHeader("Content-type", "application/json");
178
- if (window.localeSettings) {
179
- http.setRequestHeader("accept-language", window.localeSettings);
180
- }
181
- http.send();
182
- }
183
- catch (ex) {
184
- reject(ex);
185
- }
186
- });
89
+ var _serviceURL = window.webAuthSettings.authority + "/token-srv/prelogin/metadata/" + trackId;
90
+ return Helper_1.Helper.createPostPromise(undefined, _serviceURL, false, "GET");
187
91
  }
188
92
  TokenService.getMissingFieldsLogin = getMissingFieldsLogin;
189
93
  ;
@@ -19,7 +19,7 @@ export declare namespace UserService {
19
19
  captcha?: string;
20
20
  acceptlanguage?: string;
21
21
  bot_captcha_response?: string;
22
- trackId: string;
22
+ trackId?: string;
23
23
  }): Promise<unknown>;
24
24
  /**
25
25
  * get invite info
@@ -48,12 +48,12 @@ export declare namespace UserService {
48
48
  * handle reset password
49
49
  * @param options
50
50
  */
51
- function handleResetPassword(options: ValidateResetPasswordEntity): void;
51
+ function handleResetPassword(options: ValidateResetPasswordEntity): Promise<unknown>;
52
52
  /**
53
53
  * reset password
54
54
  * @param options
55
55
  */
56
- function resetPassword(options: AcceptResetPasswordEntity): void;
56
+ function resetPassword(options: AcceptResetPasswordEntity): Promise<unknown>;
57
57
  /**
58
58
  * get Deduplication details
59
59
  * @param options