@frontegg/redux-store 7.41.0 → 7.43.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/LoginState/actions/index.d.ts +1 -1
- package/auth/LoginState/actions/index.js +3 -0
- package/auth/LoginState/actions/mfaRequiredState.actions.d.ts +1 -1
- package/auth/LoginState/actions/mfaRequiredState.actions.js +3 -3
- package/auth/SignUpState/actions.js +1 -1
- package/auth/SmsState/actions.js +0 -7
- package/index.js +1 -1
- package/mocks/auth-mocks/loginActions.mocks.d.ts +1 -1
- package/node/auth/LoginState/actions/index.js +3 -0
- package/node/auth/LoginState/actions/mfaRequiredState.actions.js +3 -3
- package/node/auth/SignUpState/actions.js +1 -1
- package/node/auth/SmsState/actions.js +0 -7
- package/node/index.js +1 -1
- package/node/toolkit/FronteggNativeModule.js +26 -6
- package/package.json +2 -2
- package/toolkit/FronteggNativeModule.d.ts +3 -0
- package/toolkit/FronteggNativeModule.js +26 -6
|
@@ -18,7 +18,7 @@ declare const _default: (store: FronteggState, api: RestApi, sharedActions: Shar
|
|
|
18
18
|
verifyMFAEmailCodeForLogin: (payload: WithCallback<import("@frontegg/rest-api").IVerifyMFAEmailCode>) => Promise<void>;
|
|
19
19
|
mfaWithAuthenticator: ({ callback, ...loginWithMfaPayload }: WithCallback<import("@frontegg/rest-api").ILoginWithMfa>, setLoadingAction: import("../interfaces").SetLoadingAction, isStepUp: boolean) => Promise<void>;
|
|
20
20
|
loginWithMfa: (payload: WithCallback<import("@frontegg/rest-api").ILoginWithMfa>) => Promise<void>;
|
|
21
|
-
getMfaRequiredState: (user: import("../../interfaces").User | any, retryConfig?: import("../../../interfaces").RetryConfig, shouldContinueWhenFailing?: boolean) => Promise<Partial<AuthState> & {
|
|
21
|
+
getMfaRequiredState: (user: import("../../interfaces").User | any, retryConfig?: import("../../../interfaces").RetryConfig, shouldContinueWhenFailing?: boolean, emailFromSignup?: string) => Promise<Partial<AuthState> & {
|
|
22
22
|
mfaState: Partial<MFAState>;
|
|
23
23
|
loginState: Partial<LoginState>;
|
|
24
24
|
}>;
|
|
@@ -514,6 +514,9 @@ export default ((store, api, sharedActions) => {
|
|
|
514
514
|
}
|
|
515
515
|
}
|
|
516
516
|
}
|
|
517
|
+
if (FronteggNativeModule.isSuggestSavePasswordAvailable()) {
|
|
518
|
+
FronteggNativeModule.suggestSavePassword(email, password);
|
|
519
|
+
}
|
|
517
520
|
|
|
518
521
|
// TODO: extract item name to constants
|
|
519
522
|
localStorage.removeItem('register-quick-login');
|
|
@@ -3,7 +3,7 @@ import { MFAState } from '../../MfaState/interfaces';
|
|
|
3
3
|
import { AuthState, User } from '../../interfaces';
|
|
4
4
|
import { FronteggState, RestApi, RetryConfig, SharedActions } from '../../../interfaces';
|
|
5
5
|
declare const _default: (store: FronteggState, api: RestApi, _sharedActions: SharedActions) => {
|
|
6
|
-
getMfaRequiredState: (user: User | any, retryConfig?: RetryConfig, shouldContinueWhenFailing?: boolean) => Promise<Partial<AuthState> & {
|
|
6
|
+
getMfaRequiredState: (user: User | any, retryConfig?: RetryConfig, shouldContinueWhenFailing?: boolean, emailFromSignup?: string) => Promise<Partial<AuthState> & {
|
|
7
7
|
mfaState: Partial<MFAState>;
|
|
8
8
|
loginState: Partial<LoginState>;
|
|
9
9
|
}>;
|
|
@@ -4,8 +4,8 @@ import { LoginStep, LoginFlow } from '../interfaces';
|
|
|
4
4
|
import { MFAStep } from '../../MfaState/interfaces';
|
|
5
5
|
import { retryIfNeeded } from '../../../helpers';
|
|
6
6
|
export default ((store, api, _sharedActions) => {
|
|
7
|
-
const getMfaRequiredState = async (user, retryConfig, shouldContinueWhenFailing = false) => {
|
|
8
|
-
var _user$mfaDevices, _user$mfaDevices$emai;
|
|
7
|
+
const getMfaRequiredState = async (user, retryConfig, shouldContinueWhenFailing = false, emailFromSignup) => {
|
|
8
|
+
var _user$mfaDevices, _user$mfaDevices$emai, _user$userEmail;
|
|
9
9
|
let step = LoginStep.loginWithTwoFactor;
|
|
10
10
|
const mfaState = {
|
|
11
11
|
step: MFAStep.verify,
|
|
@@ -61,7 +61,7 @@ export default ((store, api, _sharedActions) => {
|
|
|
61
61
|
error: undefined,
|
|
62
62
|
step,
|
|
63
63
|
tenantsLoading: true,
|
|
64
|
-
email: user.userEmail,
|
|
64
|
+
email: (_user$userEmail = user.userEmail) != null ? _user$userEmail : emailFromSignup,
|
|
65
65
|
tenants: [],
|
|
66
66
|
allowRememberMfaDevice: isAllowedToRemember,
|
|
67
67
|
mfaDeviceExpiration,
|
|
@@ -77,7 +77,7 @@ export default ((store, api, sharedActions) => {
|
|
|
77
77
|
reportGTMEvent(GTMEventAction.SIGNUP_COMPLETED, signUpCompletePayload);
|
|
78
78
|
}
|
|
79
79
|
if (!shouldActivate && user && isMfaRequired(user, store.root.appName)) {
|
|
80
|
-
const mfaRequiredState = await actions.getMfaRequiredState(user, DEFAULT_RETRY_CONFIG, true);
|
|
80
|
+
const mfaRequiredState = await actions.getMfaRequiredState(user, DEFAULT_RETRY_CONFIG, true, payload.email);
|
|
81
81
|
actions.setAuthState(mfaRequiredState);
|
|
82
82
|
onRedirectTo(routes.loginUrl);
|
|
83
83
|
} else {
|
package/auth/SmsState/actions.js
CHANGED
|
@@ -43,9 +43,6 @@ export default ((store, api, sharedActions) => {
|
|
|
43
43
|
callback
|
|
44
44
|
} = _payload,
|
|
45
45
|
payload = _objectWithoutPropertiesLoose(_payload, _excluded);
|
|
46
|
-
setSmsState({
|
|
47
|
-
loading: true
|
|
48
|
-
});
|
|
49
46
|
try {
|
|
50
47
|
const {
|
|
51
48
|
otcToken
|
|
@@ -60,10 +57,6 @@ export default ((store, api, sharedActions) => {
|
|
|
60
57
|
error: errorHandler(e)
|
|
61
58
|
});
|
|
62
59
|
callback == null ? void 0 : callback(false, e);
|
|
63
|
-
} finally {
|
|
64
|
-
setSmsState({
|
|
65
|
-
loading: false
|
|
66
|
-
});
|
|
67
60
|
}
|
|
68
61
|
};
|
|
69
62
|
const verifyPhoneNumber = async _payload => {
|
package/index.js
CHANGED
|
@@ -14,7 +14,7 @@ declare const _default: (store: FronteggState, api: RestApi, sharedActions: Shar
|
|
|
14
14
|
verifyMFAEmailCodeForLogin: (payload: WithCallback<import("dist/@frontegg/rest-api").IVerifyMFAEmailCode>) => Promise<void>;
|
|
15
15
|
mfaWithAuthenticator: ({ callback, ...loginWithMfaPayload }: WithCallback<import("dist/@frontegg/rest-api").ILoginWithMfa>, setLoadingAction: import("../..").SetLoadingAction, isStepUp: boolean) => Promise<void>;
|
|
16
16
|
loginWithMfa: (payload: WithCallback<import("dist/@frontegg/rest-api").ILoginWithMfa>) => Promise<void>;
|
|
17
|
-
getMfaRequiredState: (user: import("../..").User | any, retryConfig?: import("../../interfaces").RetryConfig, shouldContinueWhenFailing?: boolean) => Promise<Partial<import("../..").AuthState> & {
|
|
17
|
+
getMfaRequiredState: (user: import("../..").User | any, retryConfig?: import("../../interfaces").RetryConfig, shouldContinueWhenFailing?: boolean, emailFromSignup?: string) => Promise<Partial<import("../..").AuthState> & {
|
|
18
18
|
mfaState: Partial<import("../..").MFAState>;
|
|
19
19
|
loginState: Partial<import("../..").LoginState>;
|
|
20
20
|
}>;
|
|
@@ -521,6 +521,9 @@ var _default = (store, api, sharedActions) => {
|
|
|
521
521
|
}
|
|
522
522
|
}
|
|
523
523
|
}
|
|
524
|
+
if (_toolkit.FronteggNativeModule.isSuggestSavePasswordAvailable()) {
|
|
525
|
+
_toolkit.FronteggNativeModule.suggestSavePassword(email, password);
|
|
526
|
+
}
|
|
524
527
|
|
|
525
528
|
// TODO: extract item name to constants
|
|
526
529
|
localStorage.removeItem('register-quick-login');
|
|
@@ -11,8 +11,8 @@ var _interfaces = require("../interfaces");
|
|
|
11
11
|
var _interfaces2 = require("../../MfaState/interfaces");
|
|
12
12
|
var _helpers2 = require("../../../helpers");
|
|
13
13
|
var _default = (store, api, _sharedActions) => {
|
|
14
|
-
const getMfaRequiredState = async (user, retryConfig, shouldContinueWhenFailing = false) => {
|
|
15
|
-
var _user$mfaDevices, _user$mfaDevices$emai;
|
|
14
|
+
const getMfaRequiredState = async (user, retryConfig, shouldContinueWhenFailing = false, emailFromSignup) => {
|
|
15
|
+
var _user$mfaDevices, _user$mfaDevices$emai, _user$userEmail;
|
|
16
16
|
let step = _interfaces.LoginStep.loginWithTwoFactor;
|
|
17
17
|
const mfaState = {
|
|
18
18
|
step: _interfaces2.MFAStep.verify,
|
|
@@ -68,7 +68,7 @@ var _default = (store, api, _sharedActions) => {
|
|
|
68
68
|
error: undefined,
|
|
69
69
|
step,
|
|
70
70
|
tenantsLoading: true,
|
|
71
|
-
email: user.userEmail,
|
|
71
|
+
email: (_user$userEmail = user.userEmail) != null ? _user$userEmail : emailFromSignup,
|
|
72
72
|
tenants: [],
|
|
73
73
|
allowRememberMfaDevice: isAllowedToRemember,
|
|
74
74
|
mfaDeviceExpiration,
|
|
@@ -84,7 +84,7 @@ var _default = (store, api, sharedActions) => {
|
|
|
84
84
|
(0, _gtm.reportGTMEvent)(_gtm.GTMEventAction.SIGNUP_COMPLETED, signUpCompletePayload);
|
|
85
85
|
}
|
|
86
86
|
if (!shouldActivate && user && (0, _helpers2.isMfaRequired)(user, store.root.appName)) {
|
|
87
|
-
const mfaRequiredState = await actions.getMfaRequiredState(user, _constants.DEFAULT_RETRY_CONFIG, true);
|
|
87
|
+
const mfaRequiredState = await actions.getMfaRequiredState(user, _constants.DEFAULT_RETRY_CONFIG, true, payload.email);
|
|
88
88
|
actions.setAuthState(mfaRequiredState);
|
|
89
89
|
onRedirectTo(routes.loginUrl);
|
|
90
90
|
} else {
|
|
@@ -50,9 +50,6 @@ var _default = (store, api, sharedActions) => {
|
|
|
50
50
|
callback
|
|
51
51
|
} = _payload,
|
|
52
52
|
payload = (0, _objectWithoutPropertiesLoose2.default)(_payload, _excluded);
|
|
53
|
-
setSmsState({
|
|
54
|
-
loading: true
|
|
55
|
-
});
|
|
56
53
|
try {
|
|
57
54
|
const {
|
|
58
55
|
otcToken
|
|
@@ -67,10 +64,6 @@ var _default = (store, api, sharedActions) => {
|
|
|
67
64
|
error: (0, _helpers.errorHandler)(e)
|
|
68
65
|
});
|
|
69
66
|
callback == null ? void 0 : callback(false, e);
|
|
70
|
-
} finally {
|
|
71
|
-
setSmsState({
|
|
72
|
-
loading: false
|
|
73
|
-
});
|
|
74
67
|
}
|
|
75
68
|
};
|
|
76
69
|
const verifyPhoneNumber = async _payload => {
|
package/node/index.js
CHANGED
|
@@ -62,14 +62,31 @@ class FronteggNativeModule {
|
|
|
62
62
|
throw new Error('FronteggNativeBridge is not available');
|
|
63
63
|
}
|
|
64
64
|
};
|
|
65
|
+
this.suggestSavePassword = (email, password) => {
|
|
66
|
+
if (this.isWebkitAvailable()) {
|
|
67
|
+
var _window$webkit5, _window$webkit5$messa, _window$webkit5$messa2;
|
|
68
|
+
(_window$webkit5 = window.webkit) == null ? void 0 : (_window$webkit5$messa = _window$webkit5.messageHandlers) == null ? void 0 : (_window$webkit5$messa2 = _window$webkit5$messa.FronteggNativeBridge) == null ? void 0 : _window$webkit5$messa2.postMessage(JSON.stringify({
|
|
69
|
+
action: 'suggestSavePassword',
|
|
70
|
+
payload: {
|
|
71
|
+
email,
|
|
72
|
+
password
|
|
73
|
+
}
|
|
74
|
+
}));
|
|
75
|
+
} else if (this.isJsInterfaceAvailable()) {
|
|
76
|
+
var _window$FronteggNativ5;
|
|
77
|
+
(_window$FronteggNativ5 = window.FronteggNativeBridge) == null ? void 0 : _window$FronteggNativ5.suggestSavePassword(email, password);
|
|
78
|
+
} else {
|
|
79
|
+
throw new Error('FronteggNativeBridge is not available');
|
|
80
|
+
}
|
|
81
|
+
};
|
|
65
82
|
this.promptSocialLoginConsent = () => {
|
|
66
|
-
var _window$
|
|
67
|
-
return (_window$
|
|
83
|
+
var _window$FronteggNativ6, _window$FronteggNativ7;
|
|
84
|
+
return (_window$FronteggNativ6 = (_window$FronteggNativ7 = window.FronteggNativeBridgeFunctions) == null ? void 0 : _window$FronteggNativ7['shouldPromptSocialLoginConsent']) != null ? _window$FronteggNativ6 : false;
|
|
68
85
|
};
|
|
69
86
|
}
|
|
70
87
|
isWebkitAvailable() {
|
|
71
|
-
var _window$
|
|
72
|
-
return ((_window$
|
|
88
|
+
var _window$webkit6, _window$webkit6$messa;
|
|
89
|
+
return ((_window$webkit6 = window.webkit) == null ? void 0 : (_window$webkit6$messa = _window$webkit6.messageHandlers) == null ? void 0 : _window$webkit6$messa.FronteggNativeBridge) != null;
|
|
73
90
|
}
|
|
74
91
|
isJsInterfaceAvailable() {
|
|
75
92
|
return window.FronteggNativeBridge != null;
|
|
@@ -90,10 +107,13 @@ class FronteggNativeModule {
|
|
|
90
107
|
isLoginWithSSOAvailable() {
|
|
91
108
|
return this.isAvailable('loginWithSSO');
|
|
92
109
|
}
|
|
110
|
+
isSuggestSavePasswordAvailable() {
|
|
111
|
+
return this.isAvailable('suggestSavePassword');
|
|
112
|
+
}
|
|
93
113
|
isAvailable(method) {
|
|
94
114
|
if (this.isWebkitAvailable() || this.isJsInterfaceAvailable()) {
|
|
95
|
-
var _window$
|
|
96
|
-
return (_window$
|
|
115
|
+
var _window$FronteggNativ8, _window$FronteggNativ9;
|
|
116
|
+
return (_window$FronteggNativ8 = (_window$FronteggNativ9 = window.FronteggNativeBridgeFunctions) == null ? void 0 : _window$FronteggNativ9[method]) != null ? _window$FronteggNativ8 : false;
|
|
97
117
|
}
|
|
98
118
|
return false;
|
|
99
119
|
}
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@frontegg/redux-store",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.43.0",
|
|
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
9
|
"@frontegg/entitlements-javascript-commons": "1.1.2",
|
|
10
|
-
"@frontegg/rest-api": "7.
|
|
10
|
+
"@frontegg/rest-api": "7.43.0",
|
|
11
11
|
"fast-deep-equal": "3.1.3",
|
|
12
12
|
"get-value": "^3.0.1",
|
|
13
13
|
"proxy-compare": "^3.0.0",
|
|
@@ -3,6 +3,7 @@ export interface FronteggNativeBridge {
|
|
|
3
3
|
loginWithSocialLogin: (url: string) => void;
|
|
4
4
|
loginWithSocialLoginProvider: (provider: string) => void;
|
|
5
5
|
loginWithCustomSocialLoginProvider: (providerId: string) => void;
|
|
6
|
+
suggestSavePassword: (email: string, password: string) => void;
|
|
6
7
|
}
|
|
7
8
|
declare global {
|
|
8
9
|
interface Window {
|
|
@@ -27,6 +28,7 @@ declare class FronteggNativeModule {
|
|
|
27
28
|
isSocialLoginProviderAvailable(): boolean;
|
|
28
29
|
isCustomSocialLoginProviderAvailable(): boolean;
|
|
29
30
|
isLoginWithSSOAvailable(): boolean;
|
|
31
|
+
isSuggestSavePasswordAvailable(): boolean;
|
|
30
32
|
isAvailable(method: string): boolean;
|
|
31
33
|
loginWithSSO: (email: string) => void;
|
|
32
34
|
/**
|
|
@@ -37,6 +39,7 @@ declare class FronteggNativeModule {
|
|
|
37
39
|
loginWithSocialLogin: (url: string) => void;
|
|
38
40
|
loginWithSocialLoginProvider: (provider: string) => void;
|
|
39
41
|
loginWithCustomSocialLoginProvider: (providerId: string) => void;
|
|
42
|
+
suggestSavePassword: (email: string, password: string) => void;
|
|
40
43
|
promptSocialLoginConsent: () => boolean;
|
|
41
44
|
}
|
|
42
45
|
declare const _default: FronteggNativeModule;
|
|
@@ -56,14 +56,31 @@ class FronteggNativeModule {
|
|
|
56
56
|
throw new Error('FronteggNativeBridge is not available');
|
|
57
57
|
}
|
|
58
58
|
};
|
|
59
|
+
this.suggestSavePassword = (email, password) => {
|
|
60
|
+
if (this.isWebkitAvailable()) {
|
|
61
|
+
var _window$webkit5, _window$webkit5$messa, _window$webkit5$messa2;
|
|
62
|
+
(_window$webkit5 = window.webkit) == null ? void 0 : (_window$webkit5$messa = _window$webkit5.messageHandlers) == null ? void 0 : (_window$webkit5$messa2 = _window$webkit5$messa.FronteggNativeBridge) == null ? void 0 : _window$webkit5$messa2.postMessage(JSON.stringify({
|
|
63
|
+
action: 'suggestSavePassword',
|
|
64
|
+
payload: {
|
|
65
|
+
email,
|
|
66
|
+
password
|
|
67
|
+
}
|
|
68
|
+
}));
|
|
69
|
+
} else if (this.isJsInterfaceAvailable()) {
|
|
70
|
+
var _window$FronteggNativ5;
|
|
71
|
+
(_window$FronteggNativ5 = window.FronteggNativeBridge) == null ? void 0 : _window$FronteggNativ5.suggestSavePassword(email, password);
|
|
72
|
+
} else {
|
|
73
|
+
throw new Error('FronteggNativeBridge is not available');
|
|
74
|
+
}
|
|
75
|
+
};
|
|
59
76
|
this.promptSocialLoginConsent = () => {
|
|
60
|
-
var _window$
|
|
61
|
-
return (_window$
|
|
77
|
+
var _window$FronteggNativ6, _window$FronteggNativ7;
|
|
78
|
+
return (_window$FronteggNativ6 = (_window$FronteggNativ7 = window.FronteggNativeBridgeFunctions) == null ? void 0 : _window$FronteggNativ7['shouldPromptSocialLoginConsent']) != null ? _window$FronteggNativ6 : false;
|
|
62
79
|
};
|
|
63
80
|
}
|
|
64
81
|
isWebkitAvailable() {
|
|
65
|
-
var _window$
|
|
66
|
-
return ((_window$
|
|
82
|
+
var _window$webkit6, _window$webkit6$messa;
|
|
83
|
+
return ((_window$webkit6 = window.webkit) == null ? void 0 : (_window$webkit6$messa = _window$webkit6.messageHandlers) == null ? void 0 : _window$webkit6$messa.FronteggNativeBridge) != null;
|
|
67
84
|
}
|
|
68
85
|
isJsInterfaceAvailable() {
|
|
69
86
|
return window.FronteggNativeBridge != null;
|
|
@@ -84,10 +101,13 @@ class FronteggNativeModule {
|
|
|
84
101
|
isLoginWithSSOAvailable() {
|
|
85
102
|
return this.isAvailable('loginWithSSO');
|
|
86
103
|
}
|
|
104
|
+
isSuggestSavePasswordAvailable() {
|
|
105
|
+
return this.isAvailable('suggestSavePassword');
|
|
106
|
+
}
|
|
87
107
|
isAvailable(method) {
|
|
88
108
|
if (this.isWebkitAvailable() || this.isJsInterfaceAvailable()) {
|
|
89
|
-
var _window$
|
|
90
|
-
return (_window$
|
|
109
|
+
var _window$FronteggNativ8, _window$FronteggNativ9;
|
|
110
|
+
return (_window$FronteggNativ8 = (_window$FronteggNativ9 = window.FronteggNativeBridgeFunctions) == null ? void 0 : _window$FronteggNativ9[method]) != null ? _window$FronteggNativ8 : false;
|
|
91
111
|
}
|
|
92
112
|
return false;
|
|
93
113
|
}
|