@frontegg/rest-api 7.83.0-alpha.5 → 7.83.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/auth/enums.d.ts CHANGED
@@ -25,8 +25,7 @@ export declare enum MachineToMachineAuthStrategy {
25
25
  }
26
26
  export declare enum SignUpStrategyEnum {
27
27
  Email = "email",
28
- PhoneNumber = "phoneNumber",
29
- Username = "username"
28
+ PhoneNumber = "phoneNumber"
30
29
  }
31
30
  export declare enum EIdentifierType {
32
31
  email = "email",
package/auth/enums.js CHANGED
@@ -30,7 +30,6 @@ export let SignUpStrategyEnum;
30
30
  (function (SignUpStrategyEnum) {
31
31
  SignUpStrategyEnum["Email"] = "email";
32
32
  SignUpStrategyEnum["PhoneNumber"] = "phoneNumber";
33
- SignUpStrategyEnum["Username"] = "username";
34
33
  })(SignUpStrategyEnum || (SignUpStrategyEnum = {}));
35
34
  export let EIdentifierType;
36
35
  (function (EIdentifierType) {
package/auth/index.d.ts CHANGED
@@ -485,7 +485,6 @@ export declare class AuthenticationApi extends BaseApiClient {
485
485
  * Get vendor secure access configuration.
486
486
  */
487
487
  getVendorConfig: () => Promise<IVendorConfig>;
488
- private signUp;
489
488
  /**
490
489
  * Sign up a new user and create a new tenant.
491
490
  *
@@ -498,12 +497,6 @@ export declare class AuthenticationApi extends BaseApiClient {
498
497
  * @param body - The sign-up data
499
498
  */
500
499
  signUpUserWithPhoneNumber: (body: ISignUpUser) => Promise<ISignUpResponse>;
501
- /**
502
- * Sign up a new user and create a new tenant.
503
- *
504
- * @param body - The sign-up data
505
- */
506
- signUpUserWithUsername: (body: ISignUpUser) => Promise<ISignUpResponse>;
507
500
  /**
508
501
  * Get all current user active sessions.
509
502
  */
package/auth/index.js CHANGED
@@ -439,14 +439,14 @@ export class AuthenticationApi extends BaseApiClient {
439
439
  this.getVendorConfig = async () => {
440
440
  return this.get(`${urls.identity.configurations.v1}/public`);
441
441
  };
442
- this.signUp = async (signUpUrl, body) => {
442
+ this.signUpUser = async body => {
443
443
  const {
444
444
  shouldActivate,
445
445
  authResponse,
446
446
  userId,
447
447
  tenantId,
448
448
  activationToken
449
- } = await this.post(signUpUrl, body);
449
+ } = await this.post(`${urls.identity.users.v1}/signUp`, body);
450
450
  const response = {
451
451
  shouldActivate,
452
452
  userId,
@@ -468,14 +468,34 @@ export class AuthenticationApi extends BaseApiClient {
468
468
  activationToken
469
469
  });
470
470
  };
471
- this.signUpUser = async body => {
472
- return this.signUp(`${urls.identity.users.v1}/signUp`, body);
473
- };
474
471
  this.signUpUserWithPhoneNumber = async body => {
475
- return this.signUp(`${urls.identity.users.v1}/signUp/phoneNumber`, body);
476
- };
477
- this.signUpUserWithUsername = async body => {
478
- return this.signUp(`${urls.identity.users.v1}/signUp/username`, body);
472
+ const {
473
+ shouldActivate,
474
+ authResponse,
475
+ userId,
476
+ tenantId,
477
+ activationToken
478
+ } = await this.post(`${urls.identity.users.v1}/signUp/phoneNumber`, body);
479
+ const response = {
480
+ shouldActivate,
481
+ userId,
482
+ tenantId
483
+ };
484
+ if (!shouldActivate && authResponse) {
485
+ const {
486
+ user,
487
+ tenants,
488
+ activeTenant
489
+ } = await this.generateLoginResponseV3(authResponse);
490
+ return _extends({}, response, {
491
+ user,
492
+ tenants,
493
+ activeTenant
494
+ });
495
+ }
496
+ return _extends({}, response, {
497
+ activationToken
498
+ });
479
499
  };
480
500
  this.getCurrentUserSessions = async () => {
481
501
  return this.get(urls.identity.users.sessions.currentUser.v1);
@@ -256,7 +256,6 @@ export interface ISignUpUser {
256
256
  metadata?: string /** JSON */;
257
257
  roleIds?: string[];
258
258
  invitationToken?: string;
259
- username?: string;
260
259
  }
261
260
  export interface ISignUpResponse {
262
261
  shouldActivate: boolean;
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license Frontegg v7.83.0-alpha.5
1
+ /** @license Frontegg v7.83.0
2
2
  *
3
3
  * This source code is licensed under the MIT license found in the
4
4
  * LICENSE file in the root directory of this source tree.
@@ -40,7 +40,6 @@ exports.SignUpStrategyEnum = SignUpStrategyEnum;
40
40
  (function (SignUpStrategyEnum) {
41
41
  SignUpStrategyEnum["Email"] = "email";
42
42
  SignUpStrategyEnum["PhoneNumber"] = "phoneNumber";
43
- SignUpStrategyEnum["Username"] = "username";
44
43
  })(SignUpStrategyEnum || (exports.SignUpStrategyEnum = SignUpStrategyEnum = {}));
45
44
  let EIdentifierType;
46
45
  exports.EIdentifierType = EIdentifierType;
@@ -504,14 +504,14 @@ class AuthenticationApi extends _BaseApiClient.BaseApiClient {
504
504
  this.getVendorConfig = async () => {
505
505
  return this.get(`${_constants2.urls.identity.configurations.v1}/public`);
506
506
  };
507
- this.signUp = async (signUpUrl, body) => {
507
+ this.signUpUser = async body => {
508
508
  const {
509
509
  shouldActivate,
510
510
  authResponse,
511
511
  userId,
512
512
  tenantId,
513
513
  activationToken
514
- } = await this.post(signUpUrl, body);
514
+ } = await this.post(`${_constants2.urls.identity.users.v1}/signUp`, body);
515
515
  const response = {
516
516
  shouldActivate,
517
517
  userId,
@@ -533,14 +533,34 @@ class AuthenticationApi extends _BaseApiClient.BaseApiClient {
533
533
  activationToken
534
534
  });
535
535
  };
536
- this.signUpUser = async body => {
537
- return this.signUp(`${_constants2.urls.identity.users.v1}/signUp`, body);
538
- };
539
536
  this.signUpUserWithPhoneNumber = async body => {
540
- return this.signUp(`${_constants2.urls.identity.users.v1}/signUp/phoneNumber`, body);
541
- };
542
- this.signUpUserWithUsername = async body => {
543
- return this.signUp(`${_constants2.urls.identity.users.v1}/signUp/username`, body);
537
+ const {
538
+ shouldActivate,
539
+ authResponse,
540
+ userId,
541
+ tenantId,
542
+ activationToken
543
+ } = await this.post(`${_constants2.urls.identity.users.v1}/signUp/phoneNumber`, body);
544
+ const response = {
545
+ shouldActivate,
546
+ userId,
547
+ tenantId
548
+ };
549
+ if (!shouldActivate && authResponse) {
550
+ const {
551
+ user,
552
+ tenants,
553
+ activeTenant
554
+ } = await this.generateLoginResponseV3(authResponse);
555
+ return (0, _extends2.default)({}, response, {
556
+ user,
557
+ tenants,
558
+ activeTenant
559
+ });
560
+ }
561
+ return (0, _extends2.default)({}, response, {
562
+ activationToken
563
+ });
544
564
  };
545
565
  this.getCurrentUserSessions = async () => {
546
566
  return this.get(_constants2.urls.identity.users.sessions.currentUser.v1);
package/node/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license Frontegg v7.83.0-alpha.5
1
+ /** @license Frontegg v7.83.0
2
2
  *
3
3
  * This source code is licensed under the MIT license found in the
4
4
  * LICENSE file in the root directory of this source tree.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@frontegg/rest-api",
3
- "version": "7.83.0-alpha.5",
3
+ "version": "7.83.0",
4
4
  "main": "./node/index.js",
5
5
  "license": "MIT",
6
6
  "author": "Frontegg LTD",