@frontegg/redux-store 5.59.1 → 5.61.1
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/LoginState/index.d.ts +14 -2
- package/auth/LoginState/interfaces.d.ts +21 -2
- package/auth/LoginState/saga.d.ts +5 -1
- package/auth/SecurityPolicyState/index.d.ts +47 -1
- package/auth/SecurityPolicyState/interfaces.d.ts +3 -1
- package/auth/SecurityPolicyState/saga.d.ts +6 -0
- package/auth/TeamState/index.d.ts +21 -1
- package/auth/TeamState/interfaces.d.ts +10 -1
- package/auth/TenantsState/index.d.ts +6 -0
- package/auth/TenantsState/interfaces.d.ts +2 -1
- package/auth/dummy.d.ts +3 -1
- package/auth/index.d.ts +30 -0
- package/auth/index.js +493 -36
- package/auth/reducer.d.ts +30 -0
- package/auth/utils.d.ts +3 -0
- package/index.js +1 -1
- package/node/auth/index.js +15 -3
- package/node/{index-c7535125.js → index-5642a636.js} +513 -146
- package/node/index-6906e508.js +151 -0
- package/node/index.js +14 -2
- package/node/toolkit/index.js +2 -2
- package/node/vendor/index.js +1 -1
- package/package.json +2 -2
- package/node/index-2ab7009b.js +0 -52
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var constants = require('./constants-52e37c08.js');
|
|
4
|
+
var toolkit = require('@reduxjs/toolkit');
|
|
5
|
+
var effects = require('redux-saga/effects');
|
|
6
|
+
var restApi = require('@frontegg/rest-api');
|
|
7
|
+
|
|
8
|
+
const resetStateByKey = (key, initialState) => (state) => (Object.assign(Object.assign({}, state), { [key]: initialState[key] }));
|
|
9
|
+
const typeReducer = (key) => (state, { payload }) => (Object.assign(Object.assign({}, state), { [key]: payload }));
|
|
10
|
+
const typeReducerForKey = (key) => ({
|
|
11
|
+
prepare: (payload) => ({ payload }),
|
|
12
|
+
reducer: (state, { payload }) => {
|
|
13
|
+
return Object.assign(Object.assign({}, state), { [key]: Object.assign(Object.assign({}, state[key]), payload) });
|
|
14
|
+
},
|
|
15
|
+
});
|
|
16
|
+
const typeReducerNestedKey = (key, nestedKey) => ({
|
|
17
|
+
prepare: (payload) => ({ payload }),
|
|
18
|
+
reducer: (state, { payload }) => {
|
|
19
|
+
var _a;
|
|
20
|
+
return Object.assign(Object.assign({}, state), { [key]: Object.assign(Object.assign({}, state[key]), { [nestedKey]: Object.assign(Object.assign({}, (_a = state === null || state === void 0 ? void 0 : state[key]) === null || _a === void 0 ? void 0 : _a[nestedKey]), payload) }) });
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
const loadersReducerForKey = (key) => ({
|
|
24
|
+
prepare: (payload) => ({ payload }),
|
|
25
|
+
reducer: (state, { payload }) => {
|
|
26
|
+
var _a;
|
|
27
|
+
return (Object.assign(Object.assign({}, state), { [key]: Object.assign(Object.assign({}, state[key]), { loaders: Object.assign(Object.assign({}, state[key].loaders), { [payload.key]: (_a = payload.value) !== null && _a !== void 0 ? _a : true }) }) }));
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
const errorsReducerForKey = (key) => ({
|
|
31
|
+
prepare: (payload) => ({ payload }),
|
|
32
|
+
reducer: (state, { payload }) => {
|
|
33
|
+
var _a;
|
|
34
|
+
return (Object.assign(Object.assign({}, state), { [key]: Object.assign(Object.assign({}, state[key]), { errors: Object.assign(Object.assign({}, state[key].errors), { [payload.key]: (_a = payload.value) !== null && _a !== void 0 ? _a : true }) }) }));
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
const delay = (delayTime = 500) => new Promise((resolve) => setTimeout(resolve, delayTime));
|
|
38
|
+
const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_';
|
|
39
|
+
const lookup = new Uint8Array(256);
|
|
40
|
+
for (let i = 0; i < chars.length; i++) {
|
|
41
|
+
lookup[chars.charCodeAt(i)] = i;
|
|
42
|
+
}
|
|
43
|
+
const base64urlEncode = (arraybuffer) => {
|
|
44
|
+
const bytes = new Uint8Array(arraybuffer);
|
|
45
|
+
const len = bytes.length;
|
|
46
|
+
let i;
|
|
47
|
+
let base64url = '';
|
|
48
|
+
for (i = 0; i < len; i += 3) {
|
|
49
|
+
base64url += chars[bytes[i] >> 2];
|
|
50
|
+
base64url += chars[((bytes[i] & 3) << 4) | (bytes[i + 1] >> 4)];
|
|
51
|
+
base64url += chars[((bytes[i + 1] & 15) << 2) | (bytes[i + 2] >> 6)];
|
|
52
|
+
base64url += chars[bytes[i + 2] & 63];
|
|
53
|
+
}
|
|
54
|
+
if (len % 3 === 2) {
|
|
55
|
+
base64url = base64url.substring(0, base64url.length - 1);
|
|
56
|
+
}
|
|
57
|
+
else if (len % 3 === 1) {
|
|
58
|
+
base64url = base64url.substring(0, base64url.length - 2);
|
|
59
|
+
}
|
|
60
|
+
return base64url;
|
|
61
|
+
};
|
|
62
|
+
const base64urlDecode = (base64string) => {
|
|
63
|
+
const bufferLength = base64string.length * 0.75;
|
|
64
|
+
let len = base64string.length, i, p = 0, encoded1, encoded2, encoded3, encoded4;
|
|
65
|
+
const bytes = new Uint8Array(bufferLength);
|
|
66
|
+
for (i = 0; i < len; i += 4) {
|
|
67
|
+
encoded1 = lookup[base64string.charCodeAt(i)];
|
|
68
|
+
encoded2 = lookup[base64string.charCodeAt(i + 1)];
|
|
69
|
+
encoded3 = lookup[base64string.charCodeAt(i + 2)];
|
|
70
|
+
encoded4 = lookup[base64string.charCodeAt(i + 3)];
|
|
71
|
+
bytes[p++] = (encoded1 << 2) | (encoded2 >> 4);
|
|
72
|
+
bytes[p++] = ((encoded2 & 15) << 4) | (encoded3 >> 2);
|
|
73
|
+
bytes[p++] = ((encoded3 & 3) << 6) | (encoded4 & 63);
|
|
74
|
+
}
|
|
75
|
+
return bytes.buffer;
|
|
76
|
+
};
|
|
77
|
+
const publicKeyCredentialToJSON = (pubKeyCred) => {
|
|
78
|
+
if (pubKeyCred instanceof Array) {
|
|
79
|
+
const arr = [];
|
|
80
|
+
for (const i of pubKeyCred) {
|
|
81
|
+
arr.push(publicKeyCredentialToJSON(i));
|
|
82
|
+
}
|
|
83
|
+
return arr;
|
|
84
|
+
}
|
|
85
|
+
else if (pubKeyCred instanceof ArrayBuffer) {
|
|
86
|
+
return base64urlEncode(pubKeyCred);
|
|
87
|
+
}
|
|
88
|
+
else if (pubKeyCred instanceof Object) {
|
|
89
|
+
const obj = {};
|
|
90
|
+
for (const key in pubKeyCred) {
|
|
91
|
+
obj[key] = publicKeyCredentialToJSON(pubKeyCred[key]);
|
|
92
|
+
}
|
|
93
|
+
return obj;
|
|
94
|
+
}
|
|
95
|
+
return pubKeyCred;
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
const reducers = {
|
|
99
|
+
setVendorState: (state, { payload }) => (Object.assign(Object.assign({}, state), payload)),
|
|
100
|
+
};
|
|
101
|
+
const actions$1 = {
|
|
102
|
+
loadVendorPublicInfo: toolkit.createAction(`${constants.vendorStoreName}/loadVendorPublicInfo`),
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
const initialState = {
|
|
106
|
+
whiteLabelMode: false,
|
|
107
|
+
};
|
|
108
|
+
const { reducer, actions: sliceActions } = toolkit.createSlice({
|
|
109
|
+
name: constants.vendorStoreName,
|
|
110
|
+
initialState,
|
|
111
|
+
reducers: Object.assign({}, reducers)
|
|
112
|
+
});
|
|
113
|
+
const actions = Object.assign(Object.assign({}, sliceActions), actions$1);
|
|
114
|
+
|
|
115
|
+
function* loadVendorPublicInfo() {
|
|
116
|
+
try {
|
|
117
|
+
const { whiteLabelMode = false } = yield restApi.api.vendor.getVendorPublicInfo();
|
|
118
|
+
yield effects.put(actions.setVendorState({ whiteLabelMode }));
|
|
119
|
+
}
|
|
120
|
+
catch (e) {
|
|
121
|
+
console.error('failed to getVendorPublicInfo - ', e);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
function* sagas() {
|
|
125
|
+
yield effects.takeEvery(actions.loadVendorPublicInfo, loadVendorPublicInfo);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// export store
|
|
129
|
+
var vendorStore = {
|
|
130
|
+
sagas,
|
|
131
|
+
storeName: constants.vendorStoreName,
|
|
132
|
+
initialState,
|
|
133
|
+
reducer,
|
|
134
|
+
actions,
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
exports.actions = actions;
|
|
138
|
+
exports.base64urlDecode = base64urlDecode;
|
|
139
|
+
exports.delay = delay;
|
|
140
|
+
exports.errorsReducerForKey = errorsReducerForKey;
|
|
141
|
+
exports.initialState = initialState;
|
|
142
|
+
exports.loadVendorPublicInfo = loadVendorPublicInfo;
|
|
143
|
+
exports.loadersReducerForKey = loadersReducerForKey;
|
|
144
|
+
exports.publicKeyCredentialToJSON = publicKeyCredentialToJSON;
|
|
145
|
+
exports.reducer = reducer;
|
|
146
|
+
exports.resetStateByKey = resetStateByKey;
|
|
147
|
+
exports.sagas = sagas;
|
|
148
|
+
exports.typeReducer = typeReducer;
|
|
149
|
+
exports.typeReducerForKey = typeReducerForKey;
|
|
150
|
+
exports.typeReducerNestedKey = typeReducerNestedKey;
|
|
151
|
+
exports.vendorStore = vendorStore;
|
package/node/index.js
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var auth_index = require('./index-
|
|
5
|
+
var auth_index = require('./index-5642a636.js');
|
|
6
6
|
var audits_index = require('./audits/index.js');
|
|
7
7
|
var connectivity_index = require('./connectivity/index.js');
|
|
8
8
|
var subscriptions_index = require('./subscriptions/index.js');
|
|
9
|
-
var vendor_index = require('./index-
|
|
9
|
+
var vendor_index = require('./index-6906e508.js');
|
|
10
10
|
var saga = require('./saga-b0d1a607.js');
|
|
11
11
|
var restApi = require('@frontegg/rest-api');
|
|
12
12
|
var constants = require('./constants-52e37c08.js');
|
|
@@ -52,6 +52,12 @@ Object.defineProperty(exports, 'ForgotPasswordStep', {
|
|
|
52
52
|
return auth_index.ForgotPasswordStep;
|
|
53
53
|
}
|
|
54
54
|
});
|
|
55
|
+
Object.defineProperty(exports, 'LoginFlow', {
|
|
56
|
+
enumerable: true,
|
|
57
|
+
get: function () {
|
|
58
|
+
return auth_index.LoginFlow;
|
|
59
|
+
}
|
|
60
|
+
});
|
|
55
61
|
Object.defineProperty(exports, 'LoginStep', {
|
|
56
62
|
enumerable: true,
|
|
57
63
|
get: function () {
|
|
@@ -64,6 +70,12 @@ Object.defineProperty(exports, 'MFAStep', {
|
|
|
64
70
|
return auth_index.MFAStep;
|
|
65
71
|
}
|
|
66
72
|
});
|
|
73
|
+
Object.defineProperty(exports, 'QuickLoginStrategy', {
|
|
74
|
+
enumerable: true,
|
|
75
|
+
get: function () {
|
|
76
|
+
return auth_index.QuickLoginStrategy;
|
|
77
|
+
}
|
|
78
|
+
});
|
|
67
79
|
Object.defineProperty(exports, 'ResetPhoneNumberStep', {
|
|
68
80
|
enumerable: true,
|
|
69
81
|
get: function () {
|
package/node/toolkit/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var auth_index = require('../index-
|
|
5
|
+
var auth_index = require('../index-5642a636.js');
|
|
6
6
|
var toolkit = require('@reduxjs/toolkit');
|
|
7
7
|
var createSagaMiddleware = require('redux-saga');
|
|
8
8
|
var effects = require('redux-saga/effects');
|
|
@@ -11,7 +11,7 @@ require('../audits/index.js');
|
|
|
11
11
|
require('../saga-b0d1a607.js');
|
|
12
12
|
require('../connectivity/index.js');
|
|
13
13
|
require('../subscriptions/index.js');
|
|
14
|
-
require('../index-
|
|
14
|
+
require('../index-6906e508.js');
|
|
15
15
|
require('../constants-52e37c08.js');
|
|
16
16
|
require('tslib');
|
|
17
17
|
require('uuid');
|
package/node/vendor/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var vendor_index = require('../index-
|
|
5
|
+
var vendor_index = require('../index-6906e508.js');
|
|
6
6
|
var constants = require('../constants-52e37c08.js');
|
|
7
7
|
require('@reduxjs/toolkit');
|
|
8
8
|
require('redux-saga/effects');
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@frontegg/redux-store",
|
|
3
3
|
"libName": "FronteggReduxStore",
|
|
4
|
-
"version": "5.
|
|
4
|
+
"version": "5.61.1",
|
|
5
5
|
"author": "Frontegg LTD",
|
|
6
6
|
"main": "./node/index.js",
|
|
7
7
|
"module": "./index.js",
|
|
8
8
|
"types": "./index.d.ts",
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@frontegg/rest-api": "2.10.
|
|
10
|
+
"@frontegg/rest-api": "^2.10.82",
|
|
11
11
|
"@reduxjs/toolkit": "^1.5.0",
|
|
12
12
|
"redux-saga": "^1.1.0",
|
|
13
13
|
"tslib": "^2.3.1",
|
package/node/index-2ab7009b.js
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var constants = require('./constants-52e37c08.js');
|
|
4
|
-
var toolkit = require('@reduxjs/toolkit');
|
|
5
|
-
var effects = require('redux-saga/effects');
|
|
6
|
-
var restApi = require('@frontegg/rest-api');
|
|
7
|
-
|
|
8
|
-
const reducers = {
|
|
9
|
-
setVendorState: (state, { payload }) => (Object.assign(Object.assign({}, state), payload)),
|
|
10
|
-
};
|
|
11
|
-
const actions$1 = {
|
|
12
|
-
loadVendorPublicInfo: toolkit.createAction(`${constants.vendorStoreName}/loadVendorPublicInfo`),
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
const initialState = {
|
|
16
|
-
whiteLabelMode: false,
|
|
17
|
-
};
|
|
18
|
-
const { reducer, actions: sliceActions } = toolkit.createSlice({
|
|
19
|
-
name: constants.vendorStoreName,
|
|
20
|
-
initialState,
|
|
21
|
-
reducers: Object.assign({}, reducers)
|
|
22
|
-
});
|
|
23
|
-
const actions = Object.assign(Object.assign({}, sliceActions), actions$1);
|
|
24
|
-
|
|
25
|
-
function* loadVendorPublicInfo() {
|
|
26
|
-
try {
|
|
27
|
-
const { whiteLabelMode = false } = yield restApi.api.vendor.getVendorPublicInfo();
|
|
28
|
-
yield effects.put(actions.setVendorState({ whiteLabelMode }));
|
|
29
|
-
}
|
|
30
|
-
catch (e) {
|
|
31
|
-
console.error('failed to getVendorPublicInfo - ', e);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
function* sagas() {
|
|
35
|
-
yield effects.takeEvery(actions.loadVendorPublicInfo, loadVendorPublicInfo);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// export store
|
|
39
|
-
var vendorStore = {
|
|
40
|
-
sagas,
|
|
41
|
-
storeName: constants.vendorStoreName,
|
|
42
|
-
initialState,
|
|
43
|
-
reducer,
|
|
44
|
-
actions,
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
exports.actions = actions;
|
|
48
|
-
exports.initialState = initialState;
|
|
49
|
-
exports.loadVendorPublicInfo = loadVendorPublicInfo;
|
|
50
|
-
exports.reducer = reducer;
|
|
51
|
-
exports.sagas = sagas;
|
|
52
|
-
exports.vendorStore = vendorStore;
|