@frontegg/redux-store 6.77.0-alpha.1 → 6.77.0-alpha.3
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/PasskeysState/index.d.ts +9 -0
- package/auth/PasskeysState/index.js +7 -2
- package/auth/PasskeysState/interfaces.d.ts +2 -0
- package/auth/PasskeysState/saga.d.ts +8 -0
- package/auth/PasskeysState/saga.js +46 -5
- package/auth/index.d.ts +5 -0
- package/auth/reducer.d.ts +5 -0
- package/index.js +1 -1
- package/node/auth/PasskeysState/index.js +7 -2
- package/node/auth/PasskeysState/saga.js +46 -4
- package/node/index.js +1 -1
- package/package.json +1 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { WithCallback } from '../../interfaces';
|
|
1
2
|
import { PasskeysState } from './interfaces';
|
|
2
3
|
declare const passkeysState: PasskeysState;
|
|
3
4
|
declare const reducers: {
|
|
@@ -94,6 +95,11 @@ declare const reducers: {
|
|
|
94
95
|
};
|
|
95
96
|
declare const actions: {
|
|
96
97
|
loadWebAuthnDevices: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
98
|
+
deleteWebAuthnDevice: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[WithCallback<{
|
|
99
|
+
deviceId: string;
|
|
100
|
+
}, boolean>], WithCallback<{
|
|
101
|
+
deviceId: string;
|
|
102
|
+
}, boolean>, string, never, never>;
|
|
97
103
|
};
|
|
98
104
|
/**
|
|
99
105
|
* To be used for actions types after dispatch, and should contains
|
|
@@ -103,6 +109,9 @@ declare type DispatchedActions = {
|
|
|
103
109
|
setPasskeysState: (state: Partial<PasskeysState>) => void;
|
|
104
110
|
resetPasskeysState: () => void;
|
|
105
111
|
loadWebAuthnDevices: () => void;
|
|
112
|
+
deleteWebAuthnDevice: (payload: WithCallback<{
|
|
113
|
+
deviceId: string;
|
|
114
|
+
}>) => void;
|
|
106
115
|
};
|
|
107
116
|
export declare type PasskeysActions = DispatchedActions;
|
|
108
117
|
export { passkeysState, reducers as passkeysReducers, actions as passkeysActions };
|
|
@@ -2,7 +2,9 @@ import { createAction } from '@reduxjs/toolkit';
|
|
|
2
2
|
import { authStoreName } from '../../constants';
|
|
3
3
|
import { resetStateByKey, typeReducerForKey } from '../utils';
|
|
4
4
|
const passkeysState = {
|
|
5
|
-
devices: []
|
|
5
|
+
devices: [],
|
|
6
|
+
loading: false,
|
|
7
|
+
error: null
|
|
6
8
|
};
|
|
7
9
|
const reducers = {
|
|
8
10
|
setPasskeysState: typeReducerForKey('passkeysState'),
|
|
@@ -11,7 +13,10 @@ const reducers = {
|
|
|
11
13
|
})
|
|
12
14
|
};
|
|
13
15
|
const actions = {
|
|
14
|
-
loadWebAuthnDevices: createAction(`${authStoreName}/loadWebAuthnDevices`)
|
|
16
|
+
loadWebAuthnDevices: createAction(`${authStoreName}/loadWebAuthnDevices`),
|
|
17
|
+
deleteWebAuthnDevice: createAction(`${authStoreName}/deleteWebAuthnDevice`, payload => ({
|
|
18
|
+
payload
|
|
19
|
+
}))
|
|
15
20
|
};
|
|
16
21
|
|
|
17
22
|
/**
|
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
import { IWebAuthnDevices } from '@frontegg/rest-api';
|
|
2
|
+
import { WithCallback } from '../../interfaces';
|
|
3
|
+
import { PayloadAction } from '@reduxjs/toolkit';
|
|
4
|
+
export declare function deleteWebAuthnDevice({ payload }: PayloadAction<WithCallback<{
|
|
5
|
+
deviceId: string;
|
|
6
|
+
}>>): Generator<import("redux-saga/effects").SelectEffect | import("redux-saga/effects").CallEffect<void> | import("redux-saga/effects").PutEffect<{
|
|
7
|
+
payload: Partial<import("./interfaces").PasskeysState>;
|
|
8
|
+
type: string;
|
|
9
|
+
}>, void, IWebAuthnDevices>;
|
|
2
10
|
export declare function loadWebAuthnDevices(): Generator<import("redux-saga/effects").CallEffect<IWebAuthnDevices> | import("redux-saga/effects").PutEffect<{
|
|
3
11
|
payload: Partial<import("./interfaces").PasskeysState>;
|
|
4
12
|
type: string;
|
|
@@ -1,14 +1,55 @@
|
|
|
1
|
-
import { call, put, takeEvery } from 'redux-saga/effects';
|
|
1
|
+
import { call, put, select, takeEvery } from 'redux-saga/effects';
|
|
2
2
|
import { api } from '@frontegg/rest-api';
|
|
3
3
|
import { actions } from '../reducer';
|
|
4
|
-
export function*
|
|
4
|
+
export function* deleteWebAuthnDevice({
|
|
5
|
+
payload
|
|
6
|
+
}) {
|
|
5
7
|
const {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
+
callback,
|
|
9
|
+
deviceId
|
|
10
|
+
} = payload;
|
|
11
|
+
yield put(actions.setPasskeysState({
|
|
12
|
+
loading: true
|
|
13
|
+
}));
|
|
14
|
+
try {
|
|
15
|
+
yield call(api.auth.deleteWebAuthnDevice, deviceId);
|
|
16
|
+
const {
|
|
17
|
+
devices
|
|
18
|
+
} = yield select(state => state.auth.passkeysState);
|
|
19
|
+
const newDevices = devices.filter(device => device.id !== deviceId);
|
|
20
|
+
yield put(actions.setPasskeysState({
|
|
21
|
+
devices: newDevices,
|
|
22
|
+
loading: false
|
|
23
|
+
}));
|
|
24
|
+
callback == null ? void 0 : callback(true);
|
|
25
|
+
} catch (e) {
|
|
26
|
+
yield put(actions.setPasskeysState({
|
|
27
|
+
loading: false,
|
|
28
|
+
error: e.message || null
|
|
29
|
+
}));
|
|
30
|
+
callback == null ? void 0 : callback(null, e.message);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
export function* loadWebAuthnDevices() {
|
|
8
34
|
yield put(actions.setPasskeysState({
|
|
9
|
-
|
|
35
|
+
loading: true
|
|
10
36
|
}));
|
|
37
|
+
try {
|
|
38
|
+
const {
|
|
39
|
+
devices
|
|
40
|
+
} = yield call(api.auth.getWebAuthnDevices);
|
|
41
|
+
yield put(actions.setPasskeysState({
|
|
42
|
+
devices: devices,
|
|
43
|
+
loading: false
|
|
44
|
+
}));
|
|
45
|
+
} catch (e) {
|
|
46
|
+
yield put(actions.setPasskeysState({
|
|
47
|
+
loading: false,
|
|
48
|
+
error: e.message || null
|
|
49
|
+
}));
|
|
50
|
+
}
|
|
11
51
|
}
|
|
12
52
|
export function* passkeysSagas() {
|
|
13
53
|
yield takeEvery(actions.loadWebAuthnDevices, loadWebAuthnDevices);
|
|
54
|
+
yield takeEvery(actions.deleteWebAuthnDevice, deleteWebAuthnDevice);
|
|
14
55
|
}
|
package/auth/index.d.ts
CHANGED
|
@@ -60,6 +60,11 @@ declare const _default: {
|
|
|
60
60
|
reducer: import("redux").Reducer<import("./interfaces").AuthState, import("redux").AnyAction>;
|
|
61
61
|
actions: {
|
|
62
62
|
loadWebAuthnDevices: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
63
|
+
deleteWebAuthnDevice: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("..").WithCallback<{
|
|
64
|
+
deviceId: string;
|
|
65
|
+
}, boolean>], import("..").WithCallback<{
|
|
66
|
+
deviceId: string;
|
|
67
|
+
}, boolean>, string, never, never>;
|
|
63
68
|
impersonate: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("..").WithCallback<import("./ImpersonationState/interfaces").IImpersonatePayload, boolean>], import("..").WithCallback<import("./ImpersonationState/interfaces").IImpersonatePayload, boolean>, string, never, never>;
|
|
64
69
|
loadProvisionConnections: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
65
70
|
createProvisionConnection: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("..").WithCallback<import("@frontegg/rest-api").Scim2CreateConnectionConfigRequest, import("@frontegg/rest-api").Scim2CreateConnectionConfigResponse>], import("..").WithCallback<import("@frontegg/rest-api").Scim2CreateConnectionConfigRequest, import("@frontegg/rest-api").Scim2CreateConnectionConfigResponse>, string, never, never>;
|
package/auth/reducer.d.ts
CHANGED
|
@@ -25,6 +25,11 @@ import { GroupsDialogsActions } from './GroupsState/groupsDialogsState';
|
|
|
25
25
|
declare const reducer: import("redux").Reducer<AuthState, import("redux").AnyAction>;
|
|
26
26
|
declare const actions: {
|
|
27
27
|
loadWebAuthnDevices: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
28
|
+
deleteWebAuthnDevice: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("..").WithCallback<{
|
|
29
|
+
deviceId: string;
|
|
30
|
+
}, boolean>], import("..").WithCallback<{
|
|
31
|
+
deviceId: string;
|
|
32
|
+
}, boolean>, string, never, never>;
|
|
28
33
|
impersonate: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("..").WithCallback<import(".").IImpersonatePayload, boolean>], import("..").WithCallback<import(".").IImpersonatePayload, boolean>, string, never, never>;
|
|
29
34
|
loadProvisionConnections: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
30
35
|
createProvisionConnection: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("..").WithCallback<import("@frontegg/rest-api").Scim2CreateConnectionConfigRequest, import("@frontegg/rest-api").Scim2CreateConnectionConfigResponse>], import("..").WithCallback<import("@frontegg/rest-api").Scim2CreateConnectionConfigRequest, import("@frontegg/rest-api").Scim2CreateConnectionConfigResponse>, string, never, never>;
|
package/index.js
CHANGED
|
@@ -8,7 +8,9 @@ var _toolkit = require("@reduxjs/toolkit");
|
|
|
8
8
|
var _constants = require("../../constants");
|
|
9
9
|
var _utils = require("../utils");
|
|
10
10
|
const passkeysState = {
|
|
11
|
-
devices: []
|
|
11
|
+
devices: [],
|
|
12
|
+
loading: false,
|
|
13
|
+
error: null
|
|
12
14
|
};
|
|
13
15
|
exports.passkeysState = passkeysState;
|
|
14
16
|
const reducers = {
|
|
@@ -19,7 +21,10 @@ const reducers = {
|
|
|
19
21
|
};
|
|
20
22
|
exports.passkeysReducers = reducers;
|
|
21
23
|
const actions = {
|
|
22
|
-
loadWebAuthnDevices: (0, _toolkit.createAction)(`${_constants.authStoreName}/loadWebAuthnDevices`)
|
|
24
|
+
loadWebAuthnDevices: (0, _toolkit.createAction)(`${_constants.authStoreName}/loadWebAuthnDevices`),
|
|
25
|
+
deleteWebAuthnDevice: (0, _toolkit.createAction)(`${_constants.authStoreName}/deleteWebAuthnDevice`, payload => ({
|
|
26
|
+
payload
|
|
27
|
+
}))
|
|
23
28
|
};
|
|
24
29
|
|
|
25
30
|
/**
|
|
@@ -3,19 +3,61 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
exports.deleteWebAuthnDevice = deleteWebAuthnDevice;
|
|
6
7
|
exports.loadWebAuthnDevices = loadWebAuthnDevices;
|
|
7
8
|
exports.passkeysSagas = passkeysSagas;
|
|
8
9
|
var _effects = require("redux-saga/effects");
|
|
9
10
|
var _restApi = require("@frontegg/rest-api");
|
|
10
11
|
var _reducer = require("../reducer");
|
|
11
|
-
function*
|
|
12
|
+
function* deleteWebAuthnDevice({
|
|
13
|
+
payload
|
|
14
|
+
}) {
|
|
12
15
|
const {
|
|
13
|
-
|
|
14
|
-
|
|
16
|
+
callback,
|
|
17
|
+
deviceId
|
|
18
|
+
} = payload;
|
|
19
|
+
yield (0, _effects.put)(_reducer.actions.setPasskeysState({
|
|
20
|
+
loading: true
|
|
21
|
+
}));
|
|
22
|
+
try {
|
|
23
|
+
yield (0, _effects.call)(_restApi.api.auth.deleteWebAuthnDevice, deviceId);
|
|
24
|
+
const {
|
|
25
|
+
devices
|
|
26
|
+
} = yield (0, _effects.select)(state => state.auth.passkeysState);
|
|
27
|
+
const newDevices = devices.filter(device => device.id !== deviceId);
|
|
28
|
+
yield (0, _effects.put)(_reducer.actions.setPasskeysState({
|
|
29
|
+
devices: newDevices,
|
|
30
|
+
loading: false
|
|
31
|
+
}));
|
|
32
|
+
callback == null ? void 0 : callback(true);
|
|
33
|
+
} catch (e) {
|
|
34
|
+
yield (0, _effects.put)(_reducer.actions.setPasskeysState({
|
|
35
|
+
loading: false,
|
|
36
|
+
error: e.message || null
|
|
37
|
+
}));
|
|
38
|
+
callback == null ? void 0 : callback(null, e.message);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
function* loadWebAuthnDevices() {
|
|
15
42
|
yield (0, _effects.put)(_reducer.actions.setPasskeysState({
|
|
16
|
-
|
|
43
|
+
loading: true
|
|
17
44
|
}));
|
|
45
|
+
try {
|
|
46
|
+
const {
|
|
47
|
+
devices
|
|
48
|
+
} = yield (0, _effects.call)(_restApi.api.auth.getWebAuthnDevices);
|
|
49
|
+
yield (0, _effects.put)(_reducer.actions.setPasskeysState({
|
|
50
|
+
devices: devices,
|
|
51
|
+
loading: false
|
|
52
|
+
}));
|
|
53
|
+
} catch (e) {
|
|
54
|
+
yield (0, _effects.put)(_reducer.actions.setPasskeysState({
|
|
55
|
+
loading: false,
|
|
56
|
+
error: e.message || null
|
|
57
|
+
}));
|
|
58
|
+
}
|
|
18
59
|
}
|
|
19
60
|
function* passkeysSagas() {
|
|
20
61
|
yield (0, _effects.takeEvery)(_reducer.actions.loadWebAuthnDevices, loadWebAuthnDevices);
|
|
62
|
+
yield (0, _effects.takeEvery)(_reducer.actions.deleteWebAuthnDevice, deleteWebAuthnDevice);
|
|
21
63
|
}
|
package/node/index.js
CHANGED