@frontegg/redux-store 7.67.0-alpha.0 → 7.67.0-alpha.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.
@@ -278,7 +278,6 @@ export default ((store, api, sharedActions) => {
278
278
  calls.push(actions.loadSocialLoginsConfigurationV2(withRetryConfig()));
279
279
  calls.push(actions.loadAllowSignUps(getRetryWithBlockingCallbackPayload(REQUEST_NAME.LOAD_ALLOW_SIGNUPS)));
280
280
  calls.push(actions.loadPublicAuthStrategiesPolicy(getRetryWithBlockingCallbackPayload(REQUEST_NAME.LOAD_PUBLIC_AUTH_STRATEGIES_POLICY)));
281
- calls.push(actions.loadSignUpStrategies());
282
281
  calls.push(__loadSSOPublicConfigurationFunction(getRetryWithBlockingCallbackPayload(REQUEST_NAME.LOAD_SSO_PUBLIC_CONFIGURATION)));
283
282
  calls.push(actions.loadVendorPublicInfo(withRetryConfig()));
284
283
  calls.push(__refreshMetadata(withRetryConfig()));
@@ -302,7 +301,6 @@ export default ((store, api, sharedActions) => {
302
301
  calls.push(actions.loadSocialLoginsConfigurationV2(withRetryConfig()));
303
302
  calls.push(actions.loadAllowSignUps(getRetryWithBlockingCallbackPayload(REQUEST_NAME.LOAD_ALLOW_SIGNUPS)));
304
303
  calls.push(__loadSSOPublicConfigurationFunction(getRetryWithBlockingCallbackPayload(REQUEST_NAME.LOAD_SSO_PUBLIC_CONFIGURATION)));
305
- calls.push(actions.loadSignUpStrategies());
306
304
  calls.push(actions.loadVendorPublicInfo(withRetryConfig()));
307
305
  calls.push(__refreshMetadata());
308
306
  calls.push(__isMFARequiredSSR(payload));
@@ -6,8 +6,6 @@ declare const _default: (store: FronteggState, api: RestApi, sharedActions: Shar
6
6
  resetSignUpState: () => void;
7
7
  resetSignUpStateSoft: () => void;
8
8
  signUpUser: (_payload: ISignUpUserPayload) => Promise<void>;
9
- signUpUserWithPhoneNumber: (_payload: ISignUpUserPayload) => Promise<void>;
10
9
  loadAllowSignUps: (payload?: WithCallback<WithRetryConfig<{}>, IVendorConfig>) => Promise<void>;
11
- loadSignUpStrategies: () => Promise<void>;
12
10
  };
13
11
  export default _default;
@@ -1,16 +1,14 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
- const _excluded = ["events", "url"],
4
- _excluded2 = ["events", "url"];
3
+ const _excluded = ["events", "url"];
5
4
  import { SignUpStage } from './interfaces';
6
5
  import { deepResetState, errorHandler, retryIfNeeded } from '../../helpers';
7
6
  import { initialState } from './state';
8
- import { AuthStrategyEnum, ContextHolder } from '@frontegg/rest-api';
9
- import { prepareIdentifiersForSignup, isMfaRequired } from '../helpers';
7
+ import { ContextHolder } from '@frontegg/rest-api';
8
+ import { extractPhoneNumber, isMfaRequired } from '../helpers';
10
9
  import { AuthenticationTypes } from '../interfaces';
11
10
  import { GTMEventAction, reportGTMEvent } from '../../helpers/gtm';
12
11
  import { DEFAULT_RETRY_CONFIG } from '../../constants';
13
- import { LoginStep } from '../../toolkit';
14
12
  export default ((store, api, sharedActions) => {
15
13
  const actions = sharedActions;
16
14
  const contextHolder = ContextHolder.for(store.root.appName);
@@ -31,101 +29,15 @@ export default ((store, api, sharedActions) => {
31
29
  allowNotVerifiedUsersLogin
32
30
  });
33
31
  };
34
- const reportSignupCompletion = (payload, userId, tenantId, activationToken, events, authenticationType = AuthenticationTypes.PASSWORD) => {
35
- var _events$signUpComplet;
36
- const {
37
- email,
38
- name,
39
- companyName,
40
- phoneNumber,
41
- url
42
- } = payload;
43
- const signUpCompletePayload = {
44
- email,
45
- name,
46
- companyName,
47
- url,
48
- phoneNumber: phoneNumber || undefined,
49
- authenticationType,
50
- id: userId,
51
- tenantId,
52
- createdAt: new Date(),
53
- activationToken
54
- };
55
- events == null ? void 0 : (_events$signUpComplet = events.signUpComplete) == null ? void 0 : _events$signUpComplet.call(events, signUpCompletePayload);
56
- reportGTMEvent(GTMEventAction.SIGNUP_COMPLETED, signUpCompletePayload);
57
- };
58
- const signUpUserWithPhoneNumber = async _payload => {
59
- const {
60
- events
61
- } = _payload,
62
- payload = _objectWithoutPropertiesLoose(_payload, _excluded);
63
- setSignUpState({
64
- loading: true
65
- });
66
- if (!payload.phoneNumber) {
67
- throw new Error('Phone number is required for phone number signup');
68
- }
69
- try {
70
- var _store$auth$securityP, _grecaptcha, _grecaptcha$execute;
71
- const {
72
- routes,
73
- onRedirectTo
74
- } = store.auth;
75
- const {
76
- tenantId,
77
- userId,
78
- activationToken
79
- } = await api.auth.signUpUserWithPhoneNumber(prepareIdentifiersForSignup(payload));
80
- if (!payload.invitationToken) {
81
- reportSignupCompletion(payload, userId, tenantId, activationToken, events, AuthenticationTypes.PHONE_NUMBER);
82
- }
83
- const {
84
- enabled: captchaEnabled,
85
- siteKey
86
- } = (_store$auth$securityP = store.auth.securityPolicyState.captchaPolicy.policy) != null ? _store$auth$securityP : {};
87
- const recaptchaToken = captchaEnabled && siteKey ? await ((_grecaptcha = window.grecaptcha) == null ? void 0 : (_grecaptcha$execute = _grecaptcha.execute) == null ? void 0 : _grecaptcha$execute.call(_grecaptcha, {
88
- action: 'login'
89
- })) : '';
90
- actions.passwordlessPreLogin({
91
- recaptchaToken,
92
- phoneNumber: payload.phoneNumber,
93
- type: AuthStrategyEnum.SmsCode,
94
- callback: (success, error) => {
95
- if (!success && error) {
96
- throw error;
97
- }
98
- onRedirectTo(routes.loginUrl);
99
- actions.setLoginState({
100
- step: LoginStep.loginWithSmsOtc,
101
- phoneNumber: payload.phoneNumber
102
- });
103
- }
104
- });
105
- } catch (e) {
106
- contextHolder.setAccessToken(null);
107
- contextHolder.setUser(null);
108
- setSignUpState({
109
- error: errorHandler(e)
110
- });
111
- } finally {
112
- setSignUpState({
113
- loading: false
114
- });
115
- }
116
- };
117
32
  const signUpUser = async _payload => {
118
33
  const {
119
- events
34
+ events,
35
+ url
120
36
  } = _payload,
121
- payload = _objectWithoutPropertiesLoose(_payload, _excluded2);
37
+ payload = _objectWithoutPropertiesLoose(_payload, _excluded);
122
38
  setSignUpState({
123
39
  loading: true
124
40
  });
125
- const phoneNumberStrategy = store.auth.signUpState.strategies.phoneNumber;
126
- if (phoneNumberStrategy != null && phoneNumberStrategy.required && phoneNumberStrategy != null && phoneNumberStrategy.enabled && payload.phoneNumber) {
127
- return signUpUserWithPhoneNumber(_payload);
128
- }
129
41
  try {
130
42
  const {
131
43
  routes,
@@ -139,9 +51,32 @@ export default ((store, api, sharedActions) => {
139
51
  tenants = [],
140
52
  activeTenant,
141
53
  activationToken
142
- } = await api.auth.signUpUser(prepareIdentifiersForSignup(payload));
54
+ } = await api.auth.signUpUser(
55
+ //Currently we are not supporting phone number in signup in the backend
56
+ //Remove this line when we will support it (also make sure when field is optional no empty string is sent)
57
+ extractPhoneNumber(payload));
143
58
  if (!payload.invitationToken) {
144
- reportSignupCompletion(payload, userId, tenantId, activationToken, events);
59
+ var _events$signUpComplet;
60
+ const {
61
+ email,
62
+ name,
63
+ companyName,
64
+ phoneNumber
65
+ } = payload;
66
+ const signUpCompletePayload = {
67
+ email,
68
+ name,
69
+ companyName,
70
+ url,
71
+ phoneNumber: phoneNumber || undefined,
72
+ authenticationType: AuthenticationTypes.PASSWORD,
73
+ id: userId,
74
+ tenantId,
75
+ createdAt: new Date(),
76
+ activationToken
77
+ };
78
+ events == null ? void 0 : (_events$signUpComplet = events.signUpComplete) == null ? void 0 : _events$signUpComplet.call(events, signUpCompletePayload);
79
+ reportGTMEvent(GTMEventAction.SIGNUP_COMPLETED, signUpCompletePayload);
145
80
  }
146
81
  if (!shouldActivate && user && isMfaRequired(user, store.root.appName)) {
147
82
  const mfaRequiredState = await actions.getMfaRequiredState(user, DEFAULT_RETRY_CONFIG, true, payload.email);
@@ -220,31 +155,11 @@ export default ((store, api, sharedActions) => {
220
155
  payload == null ? void 0 : (_payload$callback2 = payload.callback) == null ? void 0 : _payload$callback2.call(payload, null, e);
221
156
  }
222
157
  };
223
- const loadSignUpStrategies = async () => {
224
- try {
225
- const strategies = await api.auth.getSignUpStrategies();
226
- setSignUpState({
227
- strategies: strategies.reduce((acc, {
228
- isActive,
229
- strategy,
230
- isRequired
231
- }) => {
232
- acc[strategy] = {
233
- enabled: isActive,
234
- required: isRequired
235
- };
236
- return acc;
237
- }, {})
238
- });
239
- } catch (error) {}
240
- };
241
158
  return {
242
159
  setSignUpState,
243
160
  resetSignUpState,
244
161
  resetSignUpStateSoft,
245
162
  signUpUser,
246
- signUpUserWithPhoneNumber,
247
- loadAllowSignUps,
248
- loadSignUpStrategies
163
+ loadAllowSignUps
249
164
  };
250
165
  });
@@ -1,4 +1,4 @@
1
- import { FronteggApiError, ISignUpUser, SignUpStrategyEnum } from '@frontegg/rest-api';
1
+ import { FronteggApiError, ISignUpUser } from '@frontegg/rest-api';
2
2
  import { CustomEventsOptions } from '../interfaces';
3
3
  export interface SignUpState {
4
4
  loading: boolean;
@@ -9,17 +9,10 @@ export interface SignUpState {
9
9
  firstLoad: boolean;
10
10
  shouldActivate?: boolean;
11
11
  stage: SignUpStage;
12
- phoneNumber?: string;
13
- otcToken?: string;
14
- strategies: Partial<Record<SignUpStrategyEnum, {
15
- enabled: boolean;
16
- required: boolean;
17
- }>>;
18
12
  }
19
13
  export declare enum SignUpStage {
20
14
  SignUp = "SignUp",
21
- SignUpSuccess = "SignUpSuccess",
22
- VerifyPhone = "VerifyPhone"
15
+ SignUpSuccess = "SignUpSuccess"
23
16
  }
24
17
  export interface ISignUpUserPayload extends ISignUpUser {
25
18
  events?: CustomEventsOptions;
@@ -2,5 +2,4 @@ export let SignUpStage;
2
2
  (function (SignUpStage) {
3
3
  SignUpStage["SignUp"] = "SignUp";
4
4
  SignUpStage["SignUpSuccess"] = "SignUpSuccess";
5
- SignUpStage["VerifyPhone"] = "VerifyPhone";
6
5
  })(SignUpStage || (SignUpStage = {}));
@@ -1,21 +1,10 @@
1
1
  import { SignUpStage } from './interfaces';
2
2
  import { createProxy } from '../../toolkit/proxy';
3
- import { SignUpStrategyEnum } from '@frontegg/rest-api';
4
3
  export const initialState = {
5
4
  loading: false,
6
5
  allowSignUps: false,
7
6
  allowNotVerifiedUsersLogin: false,
8
7
  firstLoad: true,
9
- stage: SignUpStage.SignUp,
10
- strategies: {
11
- [SignUpStrategyEnum.Email]: {
12
- enabled: true,
13
- required: false
14
- },
15
- [SignUpStrategyEnum.PhoneNumber]: {
16
- enabled: true,
17
- required: true
18
- }
19
- }
8
+ stage: SignUpStage.SignUp
20
9
  };
21
10
  export default (overrideState => createProxy(initialState, overrideState));
package/auth/helpers.d.ts CHANGED
@@ -8,5 +8,14 @@ export declare const isMfaRequired: (user: ILoginResponse, appName: string) => b
8
8
  export declare const isResetPasswordRequired: (user: ILoginResponse, appName: string) => boolean;
9
9
  export declare const mapMetaDataObjectToActions: (obj: any, path?: string[]) => CommitChangeDto[];
10
10
  export declare const getUri: (urlStrategy: FronteggState["root"]["urlStrategy"]) => string;
11
- export declare const prepareIdentifiersForSignup: (payload: ISignUpUser) => ISignUpUser;
11
+ export declare const extractPhoneNumber: ({ phoneNumber, ...rest }: ISignUpUser) => {
12
+ email: string;
13
+ companyName: string;
14
+ recaptchaToken?: string;
15
+ name?: string;
16
+ password?: string;
17
+ metadata?: string;
18
+ roleIds?: string[];
19
+ invitationToken?: string;
20
+ };
12
21
  export declare const isAuthRoute: (path: string, routes?: Partial<AuthPageRoutes>) => boolean;
package/auth/helpers.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
- const _excluded = ["phoneNumber", "email"],
3
+ const _excluded = ["phoneNumber"],
4
4
  _excluded2 = ["authenticatedUrl"];
5
5
  import { ContextHolder } from '@frontegg/rest-api';
6
6
  import { defaultFronteggRoutes } from './LoginState/consts';
@@ -53,23 +53,9 @@ export const getUri = urlStrategy => {
53
53
  }
54
54
  }
55
55
  };
56
- export const prepareIdentifiersForSignup = payload => {
57
- const {
58
- phoneNumber,
59
- email
60
- } = payload,
61
- finalDto = _objectWithoutPropertiesLoose(payload, _excluded);
62
- if (email != null && email.length) {
63
- Object.assign(finalDto, {
64
- email
65
- });
66
- }
67
- if (phoneNumber != null && phoneNumber.length) {
68
- Object.assign(finalDto, {
69
- phoneNumber
70
- });
71
- }
72
- return finalDto;
56
+ export const extractPhoneNumber = _ref => {
57
+ let rest = _objectWithoutPropertiesLoose(_ref, _excluded);
58
+ return rest;
73
59
  };
74
60
  export const isAuthRoute = (path, routes) => {
75
61
  const _defaultFronteggRoute = _extends({}, defaultFronteggRoutes, routes),
@@ -257,8 +257,7 @@ export declare enum UserVerifiedOriginTypes {
257
257
  }
258
258
  export declare enum AuthenticationTypes {
259
259
  SOCIAL_LOGIN = "SOCIAL_LOGIN",
260
- PASSWORD = "PASSWORD",
261
- PHONE_NUMBER = "PHONE_NUMBER"
260
+ PASSWORD = "PASSWORD"
262
261
  }
263
262
  export declare enum AdminPortalPagesForEvents {
264
263
  profile = "profile",
@@ -315,7 +314,7 @@ export interface ISignUpCompletePayload {
315
314
  name?: string;
316
315
  companyName?: string;
317
316
  phoneNumber?: string;
318
- email?: string;
317
+ email: string;
319
318
  id?: string;
320
319
  createdAt?: Date;
321
320
  tenantId?: string;
@@ -18,7 +18,6 @@ export let AuthenticationTypes;
18
18
  (function (AuthenticationTypes) {
19
19
  AuthenticationTypes["SOCIAL_LOGIN"] = "SOCIAL_LOGIN";
20
20
  AuthenticationTypes["PASSWORD"] = "PASSWORD";
21
- AuthenticationTypes["PHONE_NUMBER"] = "PHONE_NUMBER";
22
21
  })(AuthenticationTypes || (AuthenticationTypes = {}));
23
22
  export let AdminPortalPagesForEvents;
24
23
 
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license Frontegg v7.67.0-alpha.0
1
+ /** @license Frontegg v7.67.0-alpha.1
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.
@@ -4,8 +4,6 @@ declare const _default: (store: FronteggState, api: RestApi, actions: SharedActi
4
4
  resetSignUpState: () => void;
5
5
  resetSignUpStateSoft: () => void;
6
6
  signUpUser: (_payload: import("../..").ISignUpUserPayload) => Promise<void>;
7
- signUpUserWithPhoneNumber: (_payload: import("../..").ISignUpUserPayload) => Promise<void>;
8
7
  loadAllowSignUps: (payload?: import("../../interfaces").WithCallback<import("../../interfaces").WithRetryConfig<{}>, import("dist/@frontegg/rest-api").IVendorConfig>) => Promise<void>;
9
- loadSignUpStrategies: () => Promise<void>;
10
8
  };
11
9
  export default _default;
@@ -285,7 +285,6 @@ var _default = (store, api, sharedActions) => {
285
285
  calls.push(actions.loadSocialLoginsConfigurationV2((0, _helpers.withRetryConfig)()));
286
286
  calls.push(actions.loadAllowSignUps(getRetryWithBlockingCallbackPayload(_interfaces2.REQUEST_NAME.LOAD_ALLOW_SIGNUPS)));
287
287
  calls.push(actions.loadPublicAuthStrategiesPolicy(getRetryWithBlockingCallbackPayload(_interfaces2.REQUEST_NAME.LOAD_PUBLIC_AUTH_STRATEGIES_POLICY)));
288
- calls.push(actions.loadSignUpStrategies());
289
288
  calls.push(__loadSSOPublicConfigurationFunction(getRetryWithBlockingCallbackPayload(_interfaces2.REQUEST_NAME.LOAD_SSO_PUBLIC_CONFIGURATION)));
290
289
  calls.push(actions.loadVendorPublicInfo((0, _helpers.withRetryConfig)()));
291
290
  calls.push(__refreshMetadata((0, _helpers.withRetryConfig)()));
@@ -309,7 +308,6 @@ var _default = (store, api, sharedActions) => {
309
308
  calls.push(actions.loadSocialLoginsConfigurationV2((0, _helpers.withRetryConfig)()));
310
309
  calls.push(actions.loadAllowSignUps(getRetryWithBlockingCallbackPayload(_interfaces2.REQUEST_NAME.LOAD_ALLOW_SIGNUPS)));
311
310
  calls.push(__loadSSOPublicConfigurationFunction(getRetryWithBlockingCallbackPayload(_interfaces2.REQUEST_NAME.LOAD_SSO_PUBLIC_CONFIGURATION)));
312
- calls.push(actions.loadSignUpStrategies());
313
311
  calls.push(actions.loadVendorPublicInfo((0, _helpers.withRetryConfig)()));
314
312
  calls.push(__refreshMetadata());
315
313
  calls.push(__isMFARequiredSSR(payload));
@@ -15,9 +15,7 @@ var _helpers2 = require("../helpers");
15
15
  var _interfaces2 = require("../interfaces");
16
16
  var _gtm = require("../../helpers/gtm");
17
17
  var _constants = require("../../constants");
18
- var _toolkit = require("../../toolkit");
19
- const _excluded = ["events", "url"],
20
- _excluded2 = ["events", "url"];
18
+ const _excluded = ["events", "url"];
21
19
  var _default = (store, api, sharedActions) => {
22
20
  const actions = sharedActions;
23
21
  const contextHolder = _restApi.ContextHolder.for(store.root.appName);
@@ -38,101 +36,15 @@ var _default = (store, api, sharedActions) => {
38
36
  allowNotVerifiedUsersLogin
39
37
  });
40
38
  };
41
- const reportSignupCompletion = (payload, userId, tenantId, activationToken, events, authenticationType = _interfaces2.AuthenticationTypes.PASSWORD) => {
42
- var _events$signUpComplet;
43
- const {
44
- email,
45
- name,
46
- companyName,
47
- phoneNumber,
48
- url
49
- } = payload;
50
- const signUpCompletePayload = {
51
- email,
52
- name,
53
- companyName,
54
- url,
55
- phoneNumber: phoneNumber || undefined,
56
- authenticationType,
57
- id: userId,
58
- tenantId,
59
- createdAt: new Date(),
60
- activationToken
61
- };
62
- events == null ? void 0 : (_events$signUpComplet = events.signUpComplete) == null ? void 0 : _events$signUpComplet.call(events, signUpCompletePayload);
63
- (0, _gtm.reportGTMEvent)(_gtm.GTMEventAction.SIGNUP_COMPLETED, signUpCompletePayload);
64
- };
65
- const signUpUserWithPhoneNumber = async _payload => {
66
- const {
67
- events
68
- } = _payload,
69
- payload = (0, _objectWithoutPropertiesLoose2.default)(_payload, _excluded);
70
- setSignUpState({
71
- loading: true
72
- });
73
- if (!payload.phoneNumber) {
74
- throw new Error('Phone number is required for phone number signup');
75
- }
76
- try {
77
- var _store$auth$securityP, _grecaptcha, _grecaptcha$execute;
78
- const {
79
- routes,
80
- onRedirectTo
81
- } = store.auth;
82
- const {
83
- tenantId,
84
- userId,
85
- activationToken
86
- } = await api.auth.signUpUserWithPhoneNumber((0, _helpers2.prepareIdentifiersForSignup)(payload));
87
- if (!payload.invitationToken) {
88
- reportSignupCompletion(payload, userId, tenantId, activationToken, events, _interfaces2.AuthenticationTypes.PHONE_NUMBER);
89
- }
90
- const {
91
- enabled: captchaEnabled,
92
- siteKey
93
- } = (_store$auth$securityP = store.auth.securityPolicyState.captchaPolicy.policy) != null ? _store$auth$securityP : {};
94
- const recaptchaToken = captchaEnabled && siteKey ? await ((_grecaptcha = window.grecaptcha) == null ? void 0 : (_grecaptcha$execute = _grecaptcha.execute) == null ? void 0 : _grecaptcha$execute.call(_grecaptcha, {
95
- action: 'login'
96
- })) : '';
97
- actions.passwordlessPreLogin({
98
- recaptchaToken,
99
- phoneNumber: payload.phoneNumber,
100
- type: _restApi.AuthStrategyEnum.SmsCode,
101
- callback: (success, error) => {
102
- if (!success && error) {
103
- throw error;
104
- }
105
- onRedirectTo(routes.loginUrl);
106
- actions.setLoginState({
107
- step: _toolkit.LoginStep.loginWithSmsOtc,
108
- phoneNumber: payload.phoneNumber
109
- });
110
- }
111
- });
112
- } catch (e) {
113
- contextHolder.setAccessToken(null);
114
- contextHolder.setUser(null);
115
- setSignUpState({
116
- error: (0, _helpers.errorHandler)(e)
117
- });
118
- } finally {
119
- setSignUpState({
120
- loading: false
121
- });
122
- }
123
- };
124
39
  const signUpUser = async _payload => {
125
40
  const {
126
- events
41
+ events,
42
+ url
127
43
  } = _payload,
128
- payload = (0, _objectWithoutPropertiesLoose2.default)(_payload, _excluded2);
44
+ payload = (0, _objectWithoutPropertiesLoose2.default)(_payload, _excluded);
129
45
  setSignUpState({
130
46
  loading: true
131
47
  });
132
- const phoneNumberStrategy = store.auth.signUpState.strategies.phoneNumber;
133
- if (phoneNumberStrategy != null && phoneNumberStrategy.required && phoneNumberStrategy != null && phoneNumberStrategy.enabled && payload.phoneNumber) {
134
- return signUpUserWithPhoneNumber(_payload);
135
- }
136
48
  try {
137
49
  const {
138
50
  routes,
@@ -146,9 +58,32 @@ var _default = (store, api, sharedActions) => {
146
58
  tenants = [],
147
59
  activeTenant,
148
60
  activationToken
149
- } = await api.auth.signUpUser((0, _helpers2.prepareIdentifiersForSignup)(payload));
61
+ } = await api.auth.signUpUser(
62
+ //Currently we are not supporting phone number in signup in the backend
63
+ //Remove this line when we will support it (also make sure when field is optional no empty string is sent)
64
+ (0, _helpers2.extractPhoneNumber)(payload));
150
65
  if (!payload.invitationToken) {
151
- reportSignupCompletion(payload, userId, tenantId, activationToken, events);
66
+ var _events$signUpComplet;
67
+ const {
68
+ email,
69
+ name,
70
+ companyName,
71
+ phoneNumber
72
+ } = payload;
73
+ const signUpCompletePayload = {
74
+ email,
75
+ name,
76
+ companyName,
77
+ url,
78
+ phoneNumber: phoneNumber || undefined,
79
+ authenticationType: _interfaces2.AuthenticationTypes.PASSWORD,
80
+ id: userId,
81
+ tenantId,
82
+ createdAt: new Date(),
83
+ activationToken
84
+ };
85
+ events == null ? void 0 : (_events$signUpComplet = events.signUpComplete) == null ? void 0 : _events$signUpComplet.call(events, signUpCompletePayload);
86
+ (0, _gtm.reportGTMEvent)(_gtm.GTMEventAction.SIGNUP_COMPLETED, signUpCompletePayload);
152
87
  }
153
88
  if (!shouldActivate && user && (0, _helpers2.isMfaRequired)(user, store.root.appName)) {
154
89
  const mfaRequiredState = await actions.getMfaRequiredState(user, _constants.DEFAULT_RETRY_CONFIG, true, payload.email);
@@ -227,32 +162,12 @@ var _default = (store, api, sharedActions) => {
227
162
  payload == null ? void 0 : (_payload$callback2 = payload.callback) == null ? void 0 : _payload$callback2.call(payload, null, e);
228
163
  }
229
164
  };
230
- const loadSignUpStrategies = async () => {
231
- try {
232
- const strategies = await api.auth.getSignUpStrategies();
233
- setSignUpState({
234
- strategies: strategies.reduce((acc, {
235
- isActive,
236
- strategy,
237
- isRequired
238
- }) => {
239
- acc[strategy] = {
240
- enabled: isActive,
241
- required: isRequired
242
- };
243
- return acc;
244
- }, {})
245
- });
246
- } catch (error) {}
247
- };
248
165
  return {
249
166
  setSignUpState,
250
167
  resetSignUpState,
251
168
  resetSignUpStateSoft,
252
169
  signUpUser,
253
- signUpUserWithPhoneNumber,
254
- loadAllowSignUps,
255
- loadSignUpStrategies
170
+ loadAllowSignUps
256
171
  };
257
172
  };
258
173
  exports.default = _default;
@@ -9,5 +9,4 @@ exports.SignUpStage = SignUpStage;
9
9
  (function (SignUpStage) {
10
10
  SignUpStage["SignUp"] = "SignUp";
11
11
  SignUpStage["SignUpSuccess"] = "SignUpSuccess";
12
- SignUpStage["VerifyPhone"] = "VerifyPhone";
13
12
  })(SignUpStage || (exports.SignUpStage = SignUpStage = {}));
@@ -6,23 +6,12 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.initialState = exports.default = void 0;
7
7
  var _interfaces = require("./interfaces");
8
8
  var _proxy = require("../../toolkit/proxy");
9
- var _restApi = require("@frontegg/rest-api");
10
9
  const initialState = {
11
10
  loading: false,
12
11
  allowSignUps: false,
13
12
  allowNotVerifiedUsersLogin: false,
14
13
  firstLoad: true,
15
- stage: _interfaces.SignUpStage.SignUp,
16
- strategies: {
17
- [_restApi.SignUpStrategyEnum.Email]: {
18
- enabled: true,
19
- required: false
20
- },
21
- [_restApi.SignUpStrategyEnum.PhoneNumber]: {
22
- enabled: true,
23
- required: true
24
- }
25
- }
14
+ stage: _interfaces.SignUpStage.SignUp
26
15
  };
27
16
  exports.initialState = initialState;
28
17
  var _default = overrideState => (0, _proxy.createProxy)(initialState, overrideState);
@@ -9,10 +9,10 @@ var _exportNames = {
9
9
  isResetPasswordRequired: true,
10
10
  mapMetaDataObjectToActions: true,
11
11
  getUri: true,
12
- prepareIdentifiersForSignup: true,
12
+ extractPhoneNumber: true,
13
13
  isAuthRoute: true
14
14
  };
15
- exports.prepareIdentifiersForSignup = exports.mapMetaDataObjectToActions = exports.isResetPasswordRequired = exports.isMfaRequired = exports.isAuthRoute = exports.getUri = void 0;
15
+ exports.mapMetaDataObjectToActions = exports.isResetPasswordRequired = exports.isMfaRequired = exports.isAuthRoute = exports.getUri = exports.extractPhoneNumber = void 0;
16
16
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
17
17
  var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
18
18
  var _restApi = require("@frontegg/rest-api");
@@ -53,7 +53,7 @@ Object.keys(_helpers3).forEach(function (key) {
53
53
  }
54
54
  });
55
55
  });
56
- const _excluded = ["phoneNumber", "email"],
56
+ const _excluded = ["phoneNumber"],
57
57
  _excluded2 = ["authenticatedUrl"];
58
58
  const isMfaRequired = (user, appName) => {
59
59
  const contextHolder = _restApi.ContextHolder.for(appName);
@@ -105,25 +105,11 @@ const getUri = urlStrategy => {
105
105
  }
106
106
  };
107
107
  exports.getUri = getUri;
108
- const prepareIdentifiersForSignup = payload => {
109
- const {
110
- phoneNumber,
111
- email
112
- } = payload,
113
- finalDto = (0, _objectWithoutPropertiesLoose2.default)(payload, _excluded);
114
- if (email != null && email.length) {
115
- Object.assign(finalDto, {
116
- email
117
- });
118
- }
119
- if (phoneNumber != null && phoneNumber.length) {
120
- Object.assign(finalDto, {
121
- phoneNumber
122
- });
123
- }
124
- return finalDto;
108
+ const extractPhoneNumber = _ref => {
109
+ let rest = (0, _objectWithoutPropertiesLoose2.default)(_ref, _excluded);
110
+ return rest;
125
111
  };
126
- exports.prepareIdentifiersForSignup = prepareIdentifiersForSignup;
112
+ exports.extractPhoneNumber = extractPhoneNumber;
127
113
  const isAuthRoute = (path, routes) => {
128
114
  const _defaultFronteggRoute = (0, _extends2.default)({}, _consts.defaultFronteggRoutes, routes),
129
115
  authRoutes = (0, _objectWithoutPropertiesLoose2.default)(_defaultFronteggRoute, _excluded2);
@@ -27,7 +27,6 @@ exports.AuthenticationTypes = AuthenticationTypes;
27
27
  (function (AuthenticationTypes) {
28
28
  AuthenticationTypes["SOCIAL_LOGIN"] = "SOCIAL_LOGIN";
29
29
  AuthenticationTypes["PASSWORD"] = "PASSWORD";
30
- AuthenticationTypes["PHONE_NUMBER"] = "PHONE_NUMBER";
31
30
  })(AuthenticationTypes || (exports.AuthenticationTypes = AuthenticationTypes = {}));
32
31
  let AdminPortalPagesForEvents; // noinspection JSUnusedGlobalSymbols
33
32
  exports.AdminPortalPagesForEvents = AdminPortalPagesForEvents;
package/node/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license Frontegg v7.67.0-alpha.0
1
+ /** @license Frontegg v7.67.0-alpha.1
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,13 +1,13 @@
1
1
  {
2
2
  "name": "@frontegg/redux-store",
3
- "version": "7.67.0-alpha.0",
3
+ "version": "7.67.0-alpha.1",
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.67.0-alpha.0",
10
+ "@frontegg/rest-api": "7.67.0-alpha.1",
11
11
  "fast-deep-equal": "3.1.3",
12
12
  "get-value": "^3.0.1",
13
13
  "proxy-compare": "^3.0.0",