@frontegg/redux-store 6.75.0-alpha.6 → 6.75.0-alpha.8

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,17 +1,17 @@
1
1
  import { IVendorConfig } from '@frontegg/rest-api';
2
2
  import { IAuthStrategiesConfig } from '@frontegg/rest-api';
3
- export declare function loadPublicSecurityPolicy(): Generator<import("redux-saga/effects").CallEffect<IVendorConfig> | import("redux-saga/effects").PutEffect<{
3
+ export declare function loadPublicSecurityPolicy(): Generator<import("redux-saga/effects").CallEffect<IVendorConfig> | import("redux-saga/effects").CallEffect<IAuthStrategiesConfig> | import("redux-saga/effects").PutEffect<{
4
4
  payload: Partial<import("../../interfaces").WithStatus & {
5
5
  policy?: IVendorConfig | undefined;
6
6
  }>;
7
7
  type: string;
8
- }>, void, IVendorConfig>;
9
- export declare function loadPublicAuthStrategiesPolicy(): Generator<import("redux-saga/effects").PutEffect<{
8
+ }>, void, IVendorConfig & IAuthStrategiesConfig>;
9
+ export declare function loadPublicAuthStrategiesPolicy(): Generator<import("redux-saga/effects").CallEffect<IAuthStrategiesConfig> | import("redux-saga/effects").PutEffect<{
10
10
  payload: Partial<import("../../interfaces").WithStatus & {
11
11
  policy?: IAuthStrategiesConfig | undefined;
12
12
  }>;
13
13
  type: string;
14
- }> | import("redux-saga/effects").CallEffect<IAuthStrategiesConfig>, void, IAuthStrategiesConfig>;
14
+ }>, void, IAuthStrategiesConfig>;
15
15
  export declare function securityPolicySagas(): Generator<import("redux-saga/effects").ForkEffect<never>, void, unknown>;
16
16
  /*********************************
17
17
  * Preview Sagas
@@ -11,6 +11,7 @@ import { api } from '@frontegg/rest-api';
11
11
  import { actions } from '../reducer';
12
12
  import { delay } from '../utils';
13
13
  import { policyDemo, policyMfaDemo, policyLockoutDemo, policyPasswordHistoryDemo, publicSecurityPolicy } from '../dummy';
14
+ import { useFeatureFlags } from '../../helpers';
14
15
  function* loadSecurityPolicy() {
15
16
  yield put(actions.setSecurityPolicyGlobalState({
16
17
  loading: true,
@@ -43,6 +44,13 @@ export function* loadPublicSecurityPolicy() {
43
44
  }));
44
45
  try {
45
46
  const policy = yield call(api.auth.getVendorConfig);
47
+ const [withLoginPerTenant] = useFeatureFlags(['admin_portal_login_per_tenant']);
48
+ if (withLoginPerTenant) {
49
+ const authStrategies = yield call(api.auth.getVendorPublicAuthStrategiesConfig);
50
+ if (authStrategies.mainAuthStrategies.length > 0) {
51
+ policy.authStrategy = authStrategies.mainAuthStrategies[0].strategy;
52
+ }
53
+ }
46
54
  yield put(actions.setSecurityPolicyPublicState({
47
55
  policy,
48
56
  loading: false
@@ -1,16 +1,16 @@
1
1
  import { PayloadAction } from '@reduxjs/toolkit';
2
- import { IVendorConfig } from '@frontegg/rest-api';
2
+ import { IAuthStrategiesConfig, IVendorConfig } from '@frontegg/rest-api';
3
3
  import { ISignUpUserPayload } from './interfaces';
4
4
  import { AuthState } from '../interfaces';
5
5
  export declare function loadAllowSignUps(): Generator<import("redux-saga/effects").PutEffect<{
6
6
  payload: Partial<import("./interfaces").SignUpState>;
7
7
  type: string;
8
- }> | import("redux-saga/effects").CallEffect<IVendorConfig> | import("redux-saga/effects").PutEffect<{
8
+ }> | import("redux-saga/effects").CallEffect<IVendorConfig> | import("redux-saga/effects").CallEffect<IAuthStrategiesConfig> | import("redux-saga/effects").PutEffect<{
9
9
  payload: Partial<import("../../interfaces").WithStatus & {
10
10
  policy?: IVendorConfig | undefined;
11
11
  }>;
12
12
  type: string;
13
- }>, void, IVendorConfig>;
13
+ }>, void, IVendorConfig & IAuthStrategiesConfig>;
14
14
  export declare function signUpUser({ payload: { events, url, ...payload } }: PayloadAction<ISignUpUserPayload>): Generator<import("redux-saga/effects").PutEffect<{
15
15
  payload: Partial<import("./interfaces").SignUpState>;
16
16
  type: string;
@@ -6,12 +6,21 @@ import { actions } from '../reducer';
6
6
  import { SignUpStage } from './interfaces';
7
7
  import { AuthenticationTypes } from '../interfaces';
8
8
  import { getMfaRequiredState, isMfaRequired } from '../LoginState/saga';
9
+ import { useFeatureFlags } from '../../helpers';
9
10
  export function* loadAllowSignUps() {
10
11
  yield put(actions.setSignUpState({
11
12
  loading: true
12
13
  }));
13
14
  try {
14
15
  const policy = yield call(api.auth.getVendorConfig);
16
+ const authStrategies = yield call(api.auth.getVendorPublicAuthStrategiesConfig);
17
+ const [withLoginPerTenant] = useFeatureFlags(['admin_portal_login_per_tenant']);
18
+ if (withLoginPerTenant) {
19
+ const authStrategies = yield call(api.auth.getVendorPublicAuthStrategiesConfig);
20
+ if (authStrategies.mainAuthStrategies.length > 0) {
21
+ policy.authStrategy = authStrategies.mainAuthStrategies[0].strategy;
22
+ }
23
+ }
15
24
  const {
16
25
  allowSignups: allowSignUps,
17
26
  allowNotVerifiedUsersLogin
package/auth/dummy.js CHANGED
@@ -343,94 +343,106 @@ export const dummyIps = [{
343
343
  strategy: RestrictionType.BLOCK,
344
344
  description: 'IP 4'
345
345
  }];
346
+ const generateGroupUsers = count => {
347
+ const users = [];
348
+ Array.from({
349
+ length: count
350
+ }).forEach((_, i) => {
351
+ users.push(_extends({}, userTeamDemo, {
352
+ id: `id${i}`,
353
+ profilePictureUrl: null,
354
+ createdAt: new Date()
355
+ }));
356
+ });
357
+ return users;
358
+ };
359
+ const generateRoleByName = roleName => {
360
+ return {
361
+ id: 'b43b2c4b-e056-4eec-8c55-d200a475bbc0' + roleName,
362
+ key: roleName,
363
+ name: roleName,
364
+ description: null,
365
+ isDefault: true,
366
+ createdAt: new Date(),
367
+ updatedAt: new Date(),
368
+ permissions: [],
369
+ tenantId: 'tenantId',
370
+ vendorId: 'vendorId'
371
+ };
372
+ };
346
373
  export const allGroupsDummy = [{
347
- id: 'id',
348
- name: 'group-name',
349
- color: '#36373c',
350
- description: 'group-description',
351
- users: [{
352
- id: '23cb3a62-324f-4e5f-8738-c474046d52f0',
353
- name: 'kkk',
354
- email: 'kiyec12603@gmail.com',
355
- profilePictureUrl: null,
356
- createdAt: new Date()
357
- }],
358
- roles: [{
359
- id: '916577c9-c5cc-4312-9725-450be7ede15f',
360
- name: 'Admin'
361
- }, {
362
- id: '916577c9-c5cc-4312-9725-43be7ede15f',
363
- name: 'Read'
364
- }, {
365
- id: '916577c9-c5cc-4312-9725-43be723e15f',
366
- name: 'View'
367
- }, {
368
- id: '916577c9-c5cc-4312-9725-43be7ede15f',
369
- name: 'Readonly'
370
- }]
374
+ id: 'id1',
375
+ name: 'Designers',
376
+ color: '#E1F5E2',
377
+ description: 'The whole design team',
378
+ users: generateGroupUsers(6),
379
+ roles: [generateRoleByName('Editor')],
380
+ metadata: '{"lastTermsCheck":"2022-08-16T10:31:11.270Z"}'
371
381
  }, {
372
382
  id: 'id2',
373
- name: 'another-group-name',
374
- color: '#36373c',
375
- description: 'group-description',
376
- users: [{
377
- id: '23cb3a62-324f-4e5f-8738-c474046d52f0',
378
- name: 'Patrick Lopez',
379
- email: 'lopez@gmail.com',
380
- profilePictureUrl: null,
381
- createdAt: new Date(),
382
- activatedForTenant: true
383
- }, {
384
- id: '23cb62-324fe-4e5f-8738-c474046d52f0',
385
- name: 'John Mayer',
386
- email: 'mayer@gmail.com',
387
- profilePictureUrl: null,
388
- createdAt: new Date()
389
- }, {
390
- id: '23cb62-324fe-4e5f-8738-c47106d5232',
391
- name: 'Michael Jackson',
392
- email: 'michael@gmail.com',
393
- activatedForTenant: true,
394
- profilePictureUrl: null,
395
- createdAt: new Date()
396
- }, {
397
- id: '23cb62-324fe-4e5f-8728-c4710d5232',
398
- name: 'Clara Maria',
399
- email: 'claramaria@gmail.com',
400
- profilePictureUrl: null,
401
- activatedForTenant: true,
402
- createdAt: new Date()
403
- }, {
404
- id: '23cb62-324fe-4e5f-8728-c4710d5232',
405
- name: 'Lara Smith',
406
- email: 'lara@gmail.com',
407
- activatedForTenant: true,
408
- profilePictureUrl: null,
409
- createdAt: new Date()
410
- }, {
411
- id: '23cb62-324fe-4e5f-8728-c4710d5232',
412
- name: 'Met Wives',
413
- email: 'wives@gmail.com',
414
- profilePictureUrl: null,
415
- createdAt: new Date()
416
- }, {
417
- id: '23cb62-324fe-4e5f-8728-c4710d5232',
418
- name: 'Karin Lopez',
419
- email: 'karin@gmail.com',
420
- activatedForTenant: true,
421
- profilePictureUrl: null,
422
- createdAt: new Date()
423
- }, {
424
- id: '23c163-324fe-4e5f-8728-c4710d5232',
425
- name: 'Betty Smith',
426
- email: 'betty@gmail.com',
427
- activatedForTenant: true,
428
- profilePictureUrl: null,
429
- createdAt: new Date()
430
- }],
431
- roles: [{
432
- id: '916577c9-c5cc-4312-9725-450be7ede15f',
433
- name: 'Admin'
434
- }],
435
- metadata: '{"lastTermsCheck":"2022-08-16T10:31:11.270Z"}'
383
+ name: 'Developers',
384
+ color: '#03A9F4',
385
+ description: 'All frontend and backend developers',
386
+ users: generateGroupUsers(44),
387
+ roles: [generateRoleByName('Editor')]
388
+ }, {
389
+ id: 'id3',
390
+ name: 'Product',
391
+ color: '#E1583E',
392
+ description: 'PMs and team leads',
393
+ users: generateGroupUsers(8),
394
+ roles: [generateRoleByName('Viewer')]
395
+ }, {
396
+ id: 'id4',
397
+ name: 'Management',
398
+ color: '#9AE0FF',
399
+ description: 'Executives',
400
+ users: generateGroupUsers(5),
401
+ roles: [generateRoleByName('Admin'), generateRoleByName('Owner')]
402
+ }, {
403
+ id: 'id5',
404
+ name: 'Sales',
405
+ color: '#ED8E7C',
406
+ users: generateGroupUsers(21),
407
+ description: 'BDR, AE, and inside sales',
408
+ roles: [generateRoleByName('Viewer')]
409
+ }, {
410
+ id: 'id6',
411
+ name: 'Support',
412
+ color: '#A79D7B',
413
+ users: generateGroupUsers(23),
414
+ description: 'Dev success and customer success',
415
+ roles: [generateRoleByName('Admin')]
416
+ }, {
417
+ id: 'id7',
418
+ name: 'Marketing',
419
+ color: '#2CA744',
420
+ users: generateGroupUsers(10),
421
+ description: 'The marketing department',
422
+ roles: [generateRoleByName('Viewer')]
423
+ }, {
424
+ id: 'id8',
425
+ name: 'HR',
426
+ color: '#EAE1C2',
427
+ users: generateGroupUsers(4),
428
+ description: 'Human resources',
429
+ roles: [generateRoleByName('Viewer')]
430
+ }, {
431
+ id: 'id9',
432
+ name: 'Finance',
433
+ color: '#5587C0',
434
+ users: generateGroupUsers(3),
435
+ roles: [generateRoleByName('Viewer')]
436
+ }, {
437
+ id: 'id10',
438
+ name: 'Operations',
439
+ color: '#B1CAE7',
440
+ users: generateGroupUsers(8),
441
+ roles: [generateRoleByName('Editor')]
442
+ }, {
443
+ id: 'id11',
444
+ name: 'Legal',
445
+ color: '#2CA744',
446
+ users: generateGroupUsers(4),
447
+ roles: [generateRoleByName('Viewer')]
436
448
  }];
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license Frontegg v6.75.0-alpha.6
1
+ /** @license Frontegg v6.75.0-alpha.8
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.
@@ -16,6 +16,7 @@ var _restApi = require("@frontegg/rest-api");
16
16
  var _reducer = require("../reducer");
17
17
  var _utils = require("../utils");
18
18
  var _dummy = require("../dummy");
19
+ var _helpers = require("../../helpers");
19
20
  const _excluded = ["callback"],
20
21
  _excluded2 = ["callback"],
21
22
  _excluded3 = ["callback"],
@@ -54,6 +55,13 @@ function* loadPublicSecurityPolicy() {
54
55
  }));
55
56
  try {
56
57
  const policy = yield (0, _effects.call)(_restApi.api.auth.getVendorConfig);
58
+ const [withLoginPerTenant] = (0, _helpers.useFeatureFlags)(['admin_portal_login_per_tenant']);
59
+ if (withLoginPerTenant) {
60
+ const authStrategies = yield (0, _effects.call)(_restApi.api.auth.getVendorPublicAuthStrategiesConfig);
61
+ if (authStrategies.mainAuthStrategies.length > 0) {
62
+ policy.authStrategy = authStrategies.mainAuthStrategies[0].strategy;
63
+ }
64
+ }
57
65
  yield (0, _effects.put)(_reducer.actions.setSecurityPolicyPublicState({
58
66
  policy,
59
67
  loading: false
@@ -15,6 +15,7 @@ var _reducer = require("../reducer");
15
15
  var _interfaces = require("./interfaces");
16
16
  var _interfaces2 = require("../interfaces");
17
17
  var _saga = require("../LoginState/saga");
18
+ var _helpers = require("../../helpers");
18
19
  const _excluded = ["events", "url"];
19
20
  function* loadAllowSignUps() {
20
21
  yield (0, _effects.put)(_reducer.actions.setSignUpState({
@@ -22,6 +23,14 @@ function* loadAllowSignUps() {
22
23
  }));
23
24
  try {
24
25
  const policy = yield (0, _effects.call)(_restApi.api.auth.getVendorConfig);
26
+ const authStrategies = yield (0, _effects.call)(_restApi.api.auth.getVendorPublicAuthStrategiesConfig);
27
+ const [withLoginPerTenant] = (0, _helpers.useFeatureFlags)(['admin_portal_login_per_tenant']);
28
+ if (withLoginPerTenant) {
29
+ const authStrategies = yield (0, _effects.call)(_restApi.api.auth.getVendorPublicAuthStrategiesConfig);
30
+ if (authStrategies.mainAuthStrategies.length > 0) {
31
+ policy.authStrategy = authStrategies.mainAuthStrategies[0].strategy;
32
+ }
33
+ }
25
34
  const {
26
35
  allowSignups: allowSignUps,
27
36
  allowNotVerifiedUsersLogin
@@ -377,95 +377,107 @@ const dummyIps = [{
377
377
  description: 'IP 4'
378
378
  }];
379
379
  exports.dummyIps = dummyIps;
380
+ const generateGroupUsers = count => {
381
+ const users = [];
382
+ Array.from({
383
+ length: count
384
+ }).forEach((_, i) => {
385
+ users.push((0, _extends2.default)({}, userTeamDemo, {
386
+ id: `id${i}`,
387
+ profilePictureUrl: null,
388
+ createdAt: new Date()
389
+ }));
390
+ });
391
+ return users;
392
+ };
393
+ const generateRoleByName = roleName => {
394
+ return {
395
+ id: 'b43b2c4b-e056-4eec-8c55-d200a475bbc0' + roleName,
396
+ key: roleName,
397
+ name: roleName,
398
+ description: null,
399
+ isDefault: true,
400
+ createdAt: new Date(),
401
+ updatedAt: new Date(),
402
+ permissions: [],
403
+ tenantId: 'tenantId',
404
+ vendorId: 'vendorId'
405
+ };
406
+ };
380
407
  const allGroupsDummy = [{
381
- id: 'id',
382
- name: 'group-name',
383
- color: '#36373c',
384
- description: 'group-description',
385
- users: [{
386
- id: '23cb3a62-324f-4e5f-8738-c474046d52f0',
387
- name: 'kkk',
388
- email: 'kiyec12603@gmail.com',
389
- profilePictureUrl: null,
390
- createdAt: new Date()
391
- }],
392
- roles: [{
393
- id: '916577c9-c5cc-4312-9725-450be7ede15f',
394
- name: 'Admin'
395
- }, {
396
- id: '916577c9-c5cc-4312-9725-43be7ede15f',
397
- name: 'Read'
398
- }, {
399
- id: '916577c9-c5cc-4312-9725-43be723e15f',
400
- name: 'View'
401
- }, {
402
- id: '916577c9-c5cc-4312-9725-43be7ede15f',
403
- name: 'Readonly'
404
- }]
408
+ id: 'id1',
409
+ name: 'Designers',
410
+ color: '#E1F5E2',
411
+ description: 'The whole design team',
412
+ users: generateGroupUsers(6),
413
+ roles: [generateRoleByName('Editor')],
414
+ metadata: '{"lastTermsCheck":"2022-08-16T10:31:11.270Z"}'
405
415
  }, {
406
416
  id: 'id2',
407
- name: 'another-group-name',
408
- color: '#36373c',
409
- description: 'group-description',
410
- users: [{
411
- id: '23cb3a62-324f-4e5f-8738-c474046d52f0',
412
- name: 'Patrick Lopez',
413
- email: 'lopez@gmail.com',
414
- profilePictureUrl: null,
415
- createdAt: new Date(),
416
- activatedForTenant: true
417
- }, {
418
- id: '23cb62-324fe-4e5f-8738-c474046d52f0',
419
- name: 'John Mayer',
420
- email: 'mayer@gmail.com',
421
- profilePictureUrl: null,
422
- createdAt: new Date()
423
- }, {
424
- id: '23cb62-324fe-4e5f-8738-c47106d5232',
425
- name: 'Michael Jackson',
426
- email: 'michael@gmail.com',
427
- activatedForTenant: true,
428
- profilePictureUrl: null,
429
- createdAt: new Date()
430
- }, {
431
- id: '23cb62-324fe-4e5f-8728-c4710d5232',
432
- name: 'Clara Maria',
433
- email: 'claramaria@gmail.com',
434
- profilePictureUrl: null,
435
- activatedForTenant: true,
436
- createdAt: new Date()
437
- }, {
438
- id: '23cb62-324fe-4e5f-8728-c4710d5232',
439
- name: 'Lara Smith',
440
- email: 'lara@gmail.com',
441
- activatedForTenant: true,
442
- profilePictureUrl: null,
443
- createdAt: new Date()
444
- }, {
445
- id: '23cb62-324fe-4e5f-8728-c4710d5232',
446
- name: 'Met Wives',
447
- email: 'wives@gmail.com',
448
- profilePictureUrl: null,
449
- createdAt: new Date()
450
- }, {
451
- id: '23cb62-324fe-4e5f-8728-c4710d5232',
452
- name: 'Karin Lopez',
453
- email: 'karin@gmail.com',
454
- activatedForTenant: true,
455
- profilePictureUrl: null,
456
- createdAt: new Date()
457
- }, {
458
- id: '23c163-324fe-4e5f-8728-c4710d5232',
459
- name: 'Betty Smith',
460
- email: 'betty@gmail.com',
461
- activatedForTenant: true,
462
- profilePictureUrl: null,
463
- createdAt: new Date()
464
- }],
465
- roles: [{
466
- id: '916577c9-c5cc-4312-9725-450be7ede15f',
467
- name: 'Admin'
468
- }],
469
- metadata: '{"lastTermsCheck":"2022-08-16T10:31:11.270Z"}'
417
+ name: 'Developers',
418
+ color: '#03A9F4',
419
+ description: 'All frontend and backend developers',
420
+ users: generateGroupUsers(44),
421
+ roles: [generateRoleByName('Editor')]
422
+ }, {
423
+ id: 'id3',
424
+ name: 'Product',
425
+ color: '#E1583E',
426
+ description: 'PMs and team leads',
427
+ users: generateGroupUsers(8),
428
+ roles: [generateRoleByName('Viewer')]
429
+ }, {
430
+ id: 'id4',
431
+ name: 'Management',
432
+ color: '#9AE0FF',
433
+ description: 'Executives',
434
+ users: generateGroupUsers(5),
435
+ roles: [generateRoleByName('Admin'), generateRoleByName('Owner')]
436
+ }, {
437
+ id: 'id5',
438
+ name: 'Sales',
439
+ color: '#ED8E7C',
440
+ users: generateGroupUsers(21),
441
+ description: 'BDR, AE, and inside sales',
442
+ roles: [generateRoleByName('Viewer')]
443
+ }, {
444
+ id: 'id6',
445
+ name: 'Support',
446
+ color: '#A79D7B',
447
+ users: generateGroupUsers(23),
448
+ description: 'Dev success and customer success',
449
+ roles: [generateRoleByName('Admin')]
450
+ }, {
451
+ id: 'id7',
452
+ name: 'Marketing',
453
+ color: '#2CA744',
454
+ users: generateGroupUsers(10),
455
+ description: 'The marketing department',
456
+ roles: [generateRoleByName('Viewer')]
457
+ }, {
458
+ id: 'id8',
459
+ name: 'HR',
460
+ color: '#EAE1C2',
461
+ users: generateGroupUsers(4),
462
+ description: 'Human resources',
463
+ roles: [generateRoleByName('Viewer')]
464
+ }, {
465
+ id: 'id9',
466
+ name: 'Finance',
467
+ color: '#5587C0',
468
+ users: generateGroupUsers(3),
469
+ roles: [generateRoleByName('Viewer')]
470
+ }, {
471
+ id: 'id10',
472
+ name: 'Operations',
473
+ color: '#B1CAE7',
474
+ users: generateGroupUsers(8),
475
+ roles: [generateRoleByName('Editor')]
476
+ }, {
477
+ id: 'id11',
478
+ name: 'Legal',
479
+ color: '#2CA744',
480
+ users: generateGroupUsers(4),
481
+ roles: [generateRoleByName('Viewer')]
470
482
  }];
471
483
  exports.allGroupsDummy = allGroupsDummy;
package/node/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license Frontegg v6.75.0-alpha.6
1
+ /** @license Frontegg v6.75.0-alpha.8
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,12 +1,12 @@
1
1
  {
2
2
  "name": "@frontegg/redux-store",
3
- "version": "6.75.0-alpha.6",
3
+ "version": "6.75.0-alpha.8",
4
4
  "main": "./node/index.js",
5
5
  "license": "MIT",
6
6
  "author": "Frontegg LTD",
7
7
  "dependencies": {
8
8
  "@babel/runtime": "^7.18.6",
9
- "@frontegg/rest-api": "3.0.85",
9
+ "@frontegg/rest-api": "3.0.87",
10
10
  "@reduxjs/toolkit": "^1.8.5",
11
11
  "redux-saga": "^1.2.1",
12
12
  "uuid": "^8.3.2"