@frontegg/redux-store 5.41.0 → 5.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.
@@ -33,6 +33,8 @@ export declare function signUpUser({ payload: { events, url, ...payload } }: Pay
33
33
  } & {
34
34
  shouldActivate: any;
35
35
  user: any;
36
+ tenantId: any;
37
+ userId: any;
36
38
  }>;
37
39
  export declare function resetSignUpStateSoft(): Generator<import("redux-saga/effects").PutEffect<{
38
40
  payload: Partial<import("./interfaces").SignUpState>;
package/auth/index.js CHANGED
@@ -822,10 +822,19 @@ function* signUpUser(_a) {
822
822
  yield put(actions.setSignUpState({ loading: true }));
823
823
  try {
824
824
  const { routes, onRedirectTo } = yield select((state) => state.auth);
825
- const { shouldActivate, user } = yield call(api.auth.signUpUser, payload);
825
+ const { shouldActivate, user, tenantId, userId } = yield call(api.auth.signUpUser, payload);
826
826
  if (!payload.invitationToken) {
827
827
  const { email, name, companyName } = payload;
828
- (_b = events === null || events === void 0 ? void 0 : events.signUpComplete) === null || _b === void 0 ? void 0 : _b.call(events, { email, name, companyName, url, authenticationType: AuthenticationTypes.PASSWORD });
828
+ (_b = events === null || events === void 0 ? void 0 : events.signUpComplete) === null || _b === void 0 ? void 0 : _b.call(events, {
829
+ email,
830
+ name,
831
+ companyName,
832
+ url,
833
+ authenticationType: AuthenticationTypes.PASSWORD,
834
+ id: userId,
835
+ tenantId,
836
+ createdAt: new Date(),
837
+ });
829
838
  }
830
839
  ContextHolder.setAccessToken(user === null || user === void 0 ? void 0 : user.accessToken);
831
840
  ContextHolder.setUser(user);
@@ -1079,7 +1088,14 @@ function* passwordlessPostLogin(_a) {
1079
1088
  else {
1080
1089
  const user = yield call(api.auth.generateLoginResponse, data);
1081
1090
  if (data.emailVerified) {
1082
- (_b = events === null || events === void 0 ? void 0 : events.userVerified) === null || _b === void 0 ? void 0 : _b.call(events, { email: user.email, origin: UserVeirifedOriginTypes.PASSWORDLESS });
1091
+ (_b = events === null || events === void 0 ? void 0 : events.userVerified) === null || _b === void 0 ? void 0 : _b.call(events, {
1092
+ email: user.email,
1093
+ origin: UserVeirifedOriginTypes.PASSWORDLESS,
1094
+ id: user.id,
1095
+ tenantId: user.tenantId,
1096
+ createdAt: new Date(),
1097
+ name: user.name,
1098
+ });
1083
1099
  }
1084
1100
  yield put(actions.loadTenants());
1085
1101
  yield put(actions.setState({ user, isAuthenticated: true }));
@@ -2214,7 +2230,7 @@ function* activateAccount(_a) {
2214
2230
  else {
2215
2231
  yield put(actions.setActivateState({ step: ActivateAccountStep.success }));
2216
2232
  const { user, tenants } = yield call(api.auth.generateLoginResponseV2, data);
2217
- (_b = events === null || events === void 0 ? void 0 : events.userVerified) === null || _b === void 0 ? void 0 : _b.call(events, { email: user.email, origin: UserVeirifedOriginTypes.ACTIVATION_LINK });
2233
+ (_b = events === null || events === void 0 ? void 0 : events.userVerified) === null || _b === void 0 ? void 0 : _b.call(events, { email: user.email, origin: UserVeirifedOriginTypes.ACTIVATION_LINK, id: user.id, tenantId: user.tenantId, name: user.name, createdAt: new Date() });
2218
2234
  yield put(actions.setTenantsState({ tenants, loading: false }));
2219
2235
  yield put(actions.setState({ user, isAuthenticated: true }));
2220
2236
  yield delay$1(1000);
@@ -2709,10 +2725,26 @@ function* loginViaSocialLogin(_a) {
2709
2725
  var _e = _a.payload, { events, url } = _e, payload = __rest(_e, ["events", "url"]);
2710
2726
  try {
2711
2727
  yield put(actions.setSocialLoginsState({ loading: true }));
2712
- const { email, isNewUser } = yield call(api.auth.loginViaSocialLogin, payload);
2728
+ const { email, isNewUser, userId, tenantId, name, } = yield call(api.auth.loginViaSocialLogin, payload);
2713
2729
  if (isNewUser) {
2714
- (_b = events === null || events === void 0 ? void 0 : events.signUpComplete) === null || _b === void 0 ? void 0 : _b.call(events, { email, url, authenticationType: AuthenticationTypes.SOCIAL_LOGIN, socialProvider: payload.provider });
2715
- (_c = events === null || events === void 0 ? void 0 : events.userVerified) === null || _c === void 0 ? void 0 : _c.call(events, { email, origin: UserVeirifedOriginTypes.SOCIAL_LOGIN });
2730
+ (_b = events === null || events === void 0 ? void 0 : events.signUpComplete) === null || _b === void 0 ? void 0 : _b.call(events, {
2731
+ email,
2732
+ url,
2733
+ authenticationType: AuthenticationTypes.SOCIAL_LOGIN,
2734
+ createdAt: new Date(),
2735
+ id: userId,
2736
+ socialProvider: payload.provider,
2737
+ tenantId,
2738
+ });
2739
+ (_c = events === null || events === void 0 ? void 0 : events.userVerified) === null || _c === void 0 ? void 0 : _c.call(events, {
2740
+ email,
2741
+ origin: UserVeirifedOriginTypes.SOCIAL_LOGIN,
2742
+ createdAt: new Date(),
2743
+ id: userId,
2744
+ url,
2745
+ tenantId,
2746
+ name,
2747
+ });
2716
2748
  }
2717
2749
  yield put(actions.setLoginState({ email, isNewUser }));
2718
2750
  yield refreshToken();
@@ -141,11 +141,19 @@ export interface CustomEventsOptions {
141
141
  export interface IUserVerifiedPayload {
142
142
  email: string;
143
143
  origin: UserVeirifedOriginTypes;
144
+ createdAt?: Date;
145
+ tenantId?: string;
146
+ id?: string;
147
+ url?: URL;
148
+ name?: string;
144
149
  }
145
150
  export interface ISignUpCompletePayload {
146
151
  name?: string;
147
152
  companyName?: string;
148
153
  email: string;
154
+ id?: string;
155
+ createdAt?: Date;
156
+ tenantId?: string;
149
157
  url?: URL;
150
158
  authenticationType: AuthenticationTypes;
151
159
  socialProvider?: SocialLoginProviders;
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var auth_index = require('../index-5c2d4101.js');
5
+ var auth_index = require('../index-216f8576.js');
6
6
  var constants = require('../constants-52e37c08.js');
7
7
  var restApi = require('@frontegg/rest-api');
8
8
  require('@reduxjs/toolkit');
@@ -831,10 +831,19 @@ function* signUpUser(_a) {
831
831
  yield effects.put(actions.setSignUpState({ loading: true }));
832
832
  try {
833
833
  const { routes, onRedirectTo } = yield effects.select((state) => state.auth);
834
- const { shouldActivate, user } = yield effects.call(restApi.api.auth.signUpUser, payload);
834
+ const { shouldActivate, user, tenantId, userId } = yield effects.call(restApi.api.auth.signUpUser, payload);
835
835
  if (!payload.invitationToken) {
836
836
  const { email, name, companyName } = payload;
837
- (_b = events === null || events === void 0 ? void 0 : events.signUpComplete) === null || _b === void 0 ? void 0 : _b.call(events, { email, name, companyName, url, authenticationType: exports.AuthenticationTypes.PASSWORD });
837
+ (_b = events === null || events === void 0 ? void 0 : events.signUpComplete) === null || _b === void 0 ? void 0 : _b.call(events, {
838
+ email,
839
+ name,
840
+ companyName,
841
+ url,
842
+ authenticationType: exports.AuthenticationTypes.PASSWORD,
843
+ id: userId,
844
+ tenantId,
845
+ createdAt: new Date(),
846
+ });
838
847
  }
839
848
  restApi.ContextHolder.setAccessToken(user === null || user === void 0 ? void 0 : user.accessToken);
840
849
  restApi.ContextHolder.setUser(user);
@@ -1088,7 +1097,14 @@ function* passwordlessPostLogin(_a) {
1088
1097
  else {
1089
1098
  const user = yield effects.call(restApi.api.auth.generateLoginResponse, data);
1090
1099
  if (data.emailVerified) {
1091
- (_b = events === null || events === void 0 ? void 0 : events.userVerified) === null || _b === void 0 ? void 0 : _b.call(events, { email: user.email, origin: exports.UserVeirifedOriginTypes.PASSWORDLESS });
1100
+ (_b = events === null || events === void 0 ? void 0 : events.userVerified) === null || _b === void 0 ? void 0 : _b.call(events, {
1101
+ email: user.email,
1102
+ origin: exports.UserVeirifedOriginTypes.PASSWORDLESS,
1103
+ id: user.id,
1104
+ tenantId: user.tenantId,
1105
+ createdAt: new Date(),
1106
+ name: user.name,
1107
+ });
1092
1108
  }
1093
1109
  yield effects.put(actions.loadTenants());
1094
1110
  yield effects.put(actions.setState({ user, isAuthenticated: true }));
@@ -2223,7 +2239,7 @@ function* activateAccount(_a) {
2223
2239
  else {
2224
2240
  yield effects.put(actions.setActivateState({ step: exports.ActivateAccountStep.success }));
2225
2241
  const { user, tenants } = yield effects.call(restApi.api.auth.generateLoginResponseV2, data);
2226
- (_b = events === null || events === void 0 ? void 0 : events.userVerified) === null || _b === void 0 ? void 0 : _b.call(events, { email: user.email, origin: exports.UserVeirifedOriginTypes.ACTIVATION_LINK });
2242
+ (_b = events === null || events === void 0 ? void 0 : events.userVerified) === null || _b === void 0 ? void 0 : _b.call(events, { email: user.email, origin: exports.UserVeirifedOriginTypes.ACTIVATION_LINK, id: user.id, tenantId: user.tenantId, name: user.name, createdAt: new Date() });
2227
2243
  yield effects.put(actions.setTenantsState({ tenants, loading: false }));
2228
2244
  yield effects.put(actions.setState({ user, isAuthenticated: true }));
2229
2245
  yield effects.delay(1000);
@@ -2718,10 +2734,26 @@ function* loginViaSocialLogin(_a) {
2718
2734
  var _e = _a.payload, { events, url } = _e, payload = tslib.__rest(_e, ["events", "url"]);
2719
2735
  try {
2720
2736
  yield effects.put(actions.setSocialLoginsState({ loading: true }));
2721
- const { email, isNewUser } = yield effects.call(restApi.api.auth.loginViaSocialLogin, payload);
2737
+ const { email, isNewUser, userId, tenantId, name, } = yield effects.call(restApi.api.auth.loginViaSocialLogin, payload);
2722
2738
  if (isNewUser) {
2723
- (_b = events === null || events === void 0 ? void 0 : events.signUpComplete) === null || _b === void 0 ? void 0 : _b.call(events, { email, url, authenticationType: exports.AuthenticationTypes.SOCIAL_LOGIN, socialProvider: payload.provider });
2724
- (_c = events === null || events === void 0 ? void 0 : events.userVerified) === null || _c === void 0 ? void 0 : _c.call(events, { email, origin: exports.UserVeirifedOriginTypes.SOCIAL_LOGIN });
2739
+ (_b = events === null || events === void 0 ? void 0 : events.signUpComplete) === null || _b === void 0 ? void 0 : _b.call(events, {
2740
+ email,
2741
+ url,
2742
+ authenticationType: exports.AuthenticationTypes.SOCIAL_LOGIN,
2743
+ createdAt: new Date(),
2744
+ id: userId,
2745
+ socialProvider: payload.provider,
2746
+ tenantId,
2747
+ });
2748
+ (_c = events === null || events === void 0 ? void 0 : events.userVerified) === null || _c === void 0 ? void 0 : _c.call(events, {
2749
+ email,
2750
+ origin: exports.UserVeirifedOriginTypes.SOCIAL_LOGIN,
2751
+ createdAt: new Date(),
2752
+ id: userId,
2753
+ url,
2754
+ tenantId,
2755
+ name,
2756
+ });
2725
2757
  }
2726
2758
  yield effects.put(actions.setLoginState({ email, isNewUser }));
2727
2759
  yield refreshToken();
package/node/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-5c2d4101.js');
5
+ var auth_index = require('./index-216f8576.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');
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var auth_index = require('../index-5c2d4101.js');
5
+ var auth_index = require('../index-216f8576.js');
6
6
  var toolkit = require('@reduxjs/toolkit');
7
7
  var createSagaMiddleware = require('redux-saga');
8
8
  var effects = 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.41.0",
4
+ "version": "5.43.0",
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.62",
10
+ "@frontegg/rest-api": "2.10.64",
11
11
  "@reduxjs/toolkit": "^1.5.0",
12
12
  "redux-saga": "^1.1.0",
13
13
  "tslib": "^2.3.1",