@frontegg/rest-api 7.74.0-alpha.1 → 7.75.0-alpha.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/index.js CHANGED
@@ -17,7 +17,6 @@ import { BaseApiClient } from '../BaseApiClient';
17
17
  import { EntitlementsApi } from '../entitlements';
18
18
  import { ContextHolder } from '../ContextHolder';
19
19
  import { SecurityPolicyApi } from './secutiry-poilicy';
20
- import { AuthStrategyEnum } from './enums';
21
20
  export class AuthenticationApi extends BaseApiClient {
22
21
  constructor(appName) {
23
22
  super(appName);
@@ -563,19 +562,11 @@ export class AuthenticationApi extends BaseApiClient {
563
562
  });
564
563
  };
565
564
  this.passwordlessPreLogin = async _ref => {
566
- var _usernameToTypeMapper;
567
565
  let {
568
566
  type
569
567
  } = _ref,
570
568
  body = _objectWithoutPropertiesLoose(_ref, _excluded);
571
- const usernameToTypeMapper = {
572
- [AuthStrategyEnum.UsernameAndCode]: AuthStrategyEnum.Code,
573
- [AuthStrategyEnum.UsernameAndMagicLink]: AuthStrategyEnum.MagicLink,
574
- [AuthStrategyEnum.UsernameAndSms]: AuthStrategyEnum.SmsCode,
575
- [AuthStrategyEnum.UsernameAndPassword]: AuthStrategyEnum.EmailAndPassword
576
- };
577
- const mappedType = ((_usernameToTypeMapper = usernameToTypeMapper[type]) == null ? void 0 : _usernameToTypeMapper.toLowerCase()) || type.toLowerCase();
578
- return this.post(`${urls.identity.auth.v1}/passwordless/${mappedType}/prelogin`, body);
569
+ return this.post(`${urls.identity.auth.v1}/passwordless/${type.toLocaleLowerCase()}/prelogin`, body);
579
570
  };
580
571
  this.passwordlessPostLoginV2 = async _ref2 => {
581
572
  let {
@@ -4,8 +4,7 @@ import { AuthStrategyEnum, MachineToMachineAuthStrategy, SignUpStrategyEnum, Soc
4
4
  import { ISamlRolesGroup } from '../teams/interfaces';
5
5
  export * from './secutiry-poilicy/interfaces';
6
6
  export type IPreLogin = {
7
- email?: string;
8
- username?: string;
7
+ email: string;
9
8
  tenantId?: string;
10
9
  };
11
10
  export type IPostLogin = {
@@ -27,8 +26,7 @@ export type IOidcPostLoginV2 = {
27
26
  redirectUri?: string;
28
27
  };
29
28
  export type ILogin = {
30
- email?: string;
31
- username?: string;
29
+ email: string;
32
30
  password: string;
33
31
  recaptchaToken?: string;
34
32
  invitationToken?: string;
@@ -393,16 +391,13 @@ export interface IBasePasswordlessPreLogin {
393
391
  export interface IEmailPasswordlessPreLogin extends IBasePasswordlessPreLogin {
394
392
  email: string;
395
393
  }
396
- export interface IUsernamePasswordlessPreLogin extends IBasePasswordlessPreLogin {
397
- username: string;
398
- }
399
394
  export interface IUserIDPasswordlessPreLogin extends IBasePasswordlessPreLogin {
400
395
  userId: string;
401
396
  }
402
397
  export interface IPhoneNumberPasswordlessPreLogin extends IBasePasswordlessPreLogin {
403
398
  phoneNumber: string;
404
399
  }
405
- export type IPasswordlessPreLogin = IEmailPasswordlessPreLogin | IUserIDPasswordlessPreLogin | IUsernamePasswordlessPreLogin | IPhoneNumberPasswordlessPreLogin;
400
+ export type IPasswordlessPreLogin = IEmailPasswordlessPreLogin | IUserIDPasswordlessPreLogin | IPhoneNumberPasswordlessPreLogin;
406
401
  export interface IPasswordlessPostLogin {
407
402
  token: string;
408
403
  recaptchaToken?: string;
package/index.d.ts CHANGED
@@ -27,6 +27,7 @@ import { SecurityCenterApi } from './security-center';
27
27
  import { PhoneNumbersApi } from './user-phone-numbers';
28
28
  import { ApplicationsApi } from './applications';
29
29
  import { VeloApi } from './velo';
30
+ import { UserEmailPolicyApi } from './users-emails-policy';
30
31
  export * from './interfaces';
31
32
  export * from './auth/interfaces';
32
33
  export * from './auth/enums';
@@ -57,6 +58,7 @@ export * from './security-center/interfaces';
57
58
  export * from './user-phone-numbers/interfaces';
58
59
  export * from './applications/interfaces';
59
60
  export * from './velo/interfaces';
61
+ export * from './users-emails-policy/interfaces';
60
62
  export { GENERIC_ERROR_CODE, GENERIC_ERROR_MESSAGE } from './constants';
61
63
  /**
62
64
  * Frontegg API client for default app
@@ -88,6 +90,7 @@ declare const api: {
88
90
  userPhoneNumbers: PhoneNumbersApi;
89
91
  applications: ApplicationsApi;
90
92
  velo: VeloApi;
93
+ userEmailPolicy: UserEmailPolicyApi;
91
94
  };
92
95
  export type FronteggApiClient = {
93
96
  auth: AuthenticationApi;
@@ -114,6 +117,7 @@ export type FronteggApiClient = {
114
117
  userPhoneNumbers: PhoneNumbersApi;
115
118
  applications: ApplicationsApi;
116
119
  velo: VeloApi;
120
+ userEmailPolicy: UserEmailPolicyApi;
117
121
  };
118
122
  declare const createApiClient: (appName: string) => FronteggApiClient;
119
123
  export { fetch, FetchClient, ContextHolder, FronteggContext, api, createApiClient, FronteggApiError, AuthStrategyEnum, SocialLoginProviders, ISubscriptionCancellationPolicy, ISubscriptionStatus, PaymentMethodType, ProviderType, MachineToMachineAuthStrategy, };
@@ -165,6 +169,7 @@ declare const _default: {
165
169
  userPhoneNumbers: PhoneNumbersApi;
166
170
  applications: ApplicationsApi;
167
171
  velo: VeloApi;
172
+ userEmailPolicy: UserEmailPolicyApi;
168
173
  };
169
174
  createApiClient: (appName: string) => FronteggApiClient;
170
175
  FronteggApiError: typeof FronteggApiError;
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license Frontegg v7.74.0-alpha.1
1
+ /** @license Frontegg v7.75.0-alpha.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.
@@ -32,6 +32,7 @@ import DefaultSecurityCenterApi, { SecurityCenterApi } from './security-center';
32
32
  import DefaultPhoneNumbersApi, { PhoneNumbersApi } from './user-phone-numbers';
33
33
  import DefaultApplicationsApi, { ApplicationsApi } from './applications';
34
34
  import DefaultVeloApi, { VeloApi } from './velo';
35
+ import DefaultUserEmailPolicyApi, { UserEmailPolicyApi } from './users-emails-policy';
35
36
  export * from './interfaces';
36
37
  export * from './auth/interfaces';
37
38
  export * from './auth/enums';
@@ -62,6 +63,7 @@ export * from './security-center/interfaces';
62
63
  export * from './user-phone-numbers/interfaces';
63
64
  export * from './applications/interfaces';
64
65
  export * from './velo/interfaces';
66
+ export * from './users-emails-policy/interfaces';
65
67
  export { GENERIC_ERROR_CODE, GENERIC_ERROR_MESSAGE } from './constants';
66
68
  /**
67
69
  * Frontegg API client for default app
@@ -92,7 +94,8 @@ const api = {
92
94
  securityCenter: DefaultSecurityCenterApi,
93
95
  userPhoneNumbers: DefaultPhoneNumbersApi,
94
96
  applications: DefaultApplicationsApi,
95
- velo: DefaultVeloApi
97
+ velo: DefaultVeloApi,
98
+ userEmailPolicy: DefaultUserEmailPolicyApi
96
99
  };
97
100
  const createApiClient = appName => ({
98
101
  auth: new AuthenticationApi(appName),
@@ -118,7 +121,8 @@ const createApiClient = appName => ({
118
121
  securityCenter: new SecurityCenterApi(appName),
119
122
  userPhoneNumbers: new PhoneNumbersApi(appName),
120
123
  applications: new ApplicationsApi(appName),
121
- velo: new VeloApi(appName)
124
+ velo: new VeloApi(appName),
125
+ userEmailPolicy: new UserEmailPolicyApi(appName)
122
126
  });
123
127
  export { fetch, FetchClient, ContextHolder, FronteggContext, api, createApiClient, FronteggApiError, AuthStrategyEnum, SocialLoginProviders, ISubscriptionCancellationPolicy, ISubscriptionStatus, PaymentMethodType, ProviderType, MachineToMachineAuthStrategy };
124
128
  export default {
@@ -628,19 +628,11 @@ class AuthenticationApi extends _BaseApiClient.BaseApiClient {
628
628
  });
629
629
  };
630
630
  this.passwordlessPreLogin = async _ref => {
631
- var _usernameToTypeMapper;
632
631
  let {
633
632
  type
634
633
  } = _ref,
635
634
  body = (0, _objectWithoutPropertiesLoose2.default)(_ref, _excluded);
636
- const usernameToTypeMapper = {
637
- [_enums.AuthStrategyEnum.UsernameAndCode]: _enums.AuthStrategyEnum.Code,
638
- [_enums.AuthStrategyEnum.UsernameAndMagicLink]: _enums.AuthStrategyEnum.MagicLink,
639
- [_enums.AuthStrategyEnum.UsernameAndSms]: _enums.AuthStrategyEnum.SmsCode,
640
- [_enums.AuthStrategyEnum.UsernameAndPassword]: _enums.AuthStrategyEnum.EmailAndPassword
641
- };
642
- const mappedType = ((_usernameToTypeMapper = usernameToTypeMapper[type]) == null ? void 0 : _usernameToTypeMapper.toLowerCase()) || type.toLowerCase();
643
- return this.post(`${_constants2.urls.identity.auth.v1}/passwordless/${mappedType}/prelogin`, body);
635
+ return this.post(`${_constants2.urls.identity.auth.v1}/passwordless/${type.toLocaleLowerCase()}/prelogin`, body);
644
636
  };
645
637
  this.passwordlessPostLoginV2 = async _ref2 => {
646
638
  let {
package/node/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license Frontegg v7.74.0-alpha.1
1
+ /** @license Frontegg v7.75.0-alpha.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.
@@ -173,6 +173,7 @@ var _securityCenter = _interopRequireWildcard(require("./security-center"));
173
173
  var _userPhoneNumbers = _interopRequireWildcard(require("./user-phone-numbers"));
174
174
  var _applications = _interopRequireWildcard(require("./applications"));
175
175
  var _velo = _interopRequireWildcard(require("./velo"));
176
+ var _usersEmailsPolicy = _interopRequireWildcard(require("./users-emails-policy"));
176
177
  var _interfaces = require("./interfaces");
177
178
  Object.keys(_interfaces).forEach(function (key) {
178
179
  if (key === "default" || key === "__esModule") return;
@@ -521,6 +522,18 @@ Object.keys(_interfaces24).forEach(function (key) {
521
522
  }
522
523
  });
523
524
  });
525
+ var _interfaces25 = require("./users-emails-policy/interfaces");
526
+ Object.keys(_interfaces25).forEach(function (key) {
527
+ if (key === "default" || key === "__esModule") return;
528
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
529
+ if (key in exports && exports[key] === _interfaces25[key]) return;
530
+ Object.defineProperty(exports, key, {
531
+ enumerable: true,
532
+ get: function () {
533
+ return _interfaces25[key];
534
+ }
535
+ });
536
+ });
524
537
  var _constants = require("./constants");
525
538
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
526
539
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
@@ -553,7 +566,8 @@ const api = {
553
566
  securityCenter: _securityCenter.default,
554
567
  userPhoneNumbers: _userPhoneNumbers.default,
555
568
  applications: _applications.default,
556
- velo: _velo.default
569
+ velo: _velo.default,
570
+ userEmailPolicy: _usersEmailsPolicy.default
557
571
  };
558
572
  exports.api = api;
559
573
  const createApiClient = appName => ({
@@ -580,7 +594,8 @@ const createApiClient = appName => ({
580
594
  securityCenter: new _securityCenter.SecurityCenterApi(appName),
581
595
  userPhoneNumbers: new _userPhoneNumbers.PhoneNumbersApi(appName),
582
596
  applications: new _applications.ApplicationsApi(appName),
583
- velo: new _velo.VeloApi(appName)
597
+ velo: new _velo.VeloApi(appName),
598
+ userEmailPolicy: new _usersEmailsPolicy.UserEmailPolicyApi(appName)
584
599
  });
585
600
  exports.createApiClient = createApiClient;
586
601
  var _default = {
@@ -16,6 +16,17 @@ class TeamsApi extends _BaseApiClient.BaseApiClient {
16
16
  addRoles: true
17
17
  });
18
18
  };
19
+ this.updateEmail = async email => {
20
+ return this.post(`${_constants.urls.identity.users.v1}/email/me`, {
21
+ email
22
+ });
23
+ };
24
+ this.verifyEmail = async (email, code) => {
25
+ return this.post(`${_constants.urls.identity.users.v1}/email/me/verify`, {
26
+ email,
27
+ code
28
+ });
29
+ };
19
30
  this.updateProfile = async body => {
20
31
  return this.put(`${_constants.urls.identity.users.v2}/me`, body);
21
32
  };
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = exports.UserEmailPolicyApi = void 0;
7
+ var _BaseApiClient = require("../BaseApiClient");
8
+ var _constants = require("../constants");
9
+ class UserEmailPolicyApi extends _BaseApiClient.BaseApiClient {
10
+ constructor(appName) {
11
+ super(appName);
12
+ this.getUserEmailPolicyConfig = async () => {
13
+ return this.get(`${_constants.urls.identity.configurations.v1}/user-emails-policy`);
14
+ };
15
+ }
16
+
17
+ /** Retrieve users email policy config. */
18
+ }
19
+ exports.UserEmailPolicyApi = UserEmailPolicyApi;
20
+ var _default = new UserEmailPolicyApi('default');
21
+ exports.default = _default;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@frontegg/rest-api",
3
- "version": "7.74.0-alpha.1",
3
+ "version": "7.75.0-alpha.0",
4
4
  "main": "./node/index.js",
5
5
  "license": "MIT",
6
6
  "author": "Frontegg LTD",
package/teams/index.d.ts CHANGED
@@ -5,6 +5,8 @@ import { BaseApiClient } from '../BaseApiClient';
5
5
  export declare class TeamsApi extends BaseApiClient {
6
6
  constructor(appName: string);
7
7
  getProfile: (params?: object) => Promise<IUserProfile>;
8
+ updateEmail: (email: string) => Promise<void>;
9
+ verifyEmail: (email: string, code: string) => Promise<void>;
8
10
  updateProfile: (body: Partial<IUpdateProfile>) => Promise<IUserProfile>;
9
11
  updateProfileImage: (body: FormData) => Promise<string>;
10
12
  /**
package/teams/index.js CHANGED
@@ -9,6 +9,17 @@ export class TeamsApi extends BaseApiClient {
9
9
  addRoles: true
10
10
  });
11
11
  };
12
+ this.updateEmail = async email => {
13
+ return this.post(`${urls.identity.users.v1}/email/me`, {
14
+ email
15
+ });
16
+ };
17
+ this.verifyEmail = async (email, code) => {
18
+ return this.post(`${urls.identity.users.v1}/email/me/verify`, {
19
+ email,
20
+ code
21
+ });
22
+ };
12
23
  this.updateProfile = async body => {
13
24
  return this.put(`${urls.identity.users.v2}/me`, body);
14
25
  };
@@ -0,0 +1,9 @@
1
+ import { BaseApiClient } from '../BaseApiClient';
2
+ import { IUserEmailPolicyConfig } from './interfaces';
3
+ export declare class UserEmailPolicyApi extends BaseApiClient {
4
+ constructor(appName: string);
5
+ /** Retrieve users email policy config. */
6
+ getUserEmailPolicyConfig: () => Promise<IUserEmailPolicyConfig>;
7
+ }
8
+ declare const _default: UserEmailPolicyApi;
9
+ export default _default;
@@ -0,0 +1,14 @@
1
+ import { BaseApiClient } from '../BaseApiClient';
2
+ import { urls } from '../constants';
3
+ export class UserEmailPolicyApi extends BaseApiClient {
4
+ constructor(appName) {
5
+ super(appName);
6
+ this.getUserEmailPolicyConfig = async () => {
7
+ return this.get(`${urls.identity.configurations.v1}/user-emails-policy`);
8
+ };
9
+ }
10
+
11
+ /** Retrieve users email policy config. */
12
+ }
13
+
14
+ export default new UserEmailPolicyApi('default');
@@ -0,0 +1,3 @@
1
+ export interface IUserEmailPolicyConfig {
2
+ allowEmailChange: boolean;
3
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
1
+ {
2
+ "sideEffects": false,
3
+ "module": "./index.js",
4
+ "main": "../node/users-emails-policy/index.js",
5
+ "types": "./index.d.ts"
6
+ }