@frontegg/redux-store 7.103.0-alpha.0 → 7.103.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.
@@ -87,7 +87,7 @@ export default ((store, api, sharedActions) => {
87
87
  preserveQueryParams: true
88
88
  });
89
89
  } else {
90
- var _events$userVerified;
90
+ var _user$createdAt, _events$userVerified, _user$createdAt2;
91
91
  setActivateState({
92
92
  step: ActivateAccountStep.success
93
93
  });
@@ -97,10 +97,19 @@ export default ((store, api, sharedActions) => {
97
97
  id: user.id,
98
98
  tenantId: user.tenantId,
99
99
  name: user.name,
100
- createdAt: new Date()
100
+ createdAt: (_user$createdAt = user == null ? void 0 : user.createdAt) != null ? _user$createdAt : new Date()
101
101
  };
102
102
  events == null ? void 0 : (_events$userVerified = events.userVerified) == null ? void 0 : _events$userVerified.call(events, userVerifiedPayload);
103
103
  reportGTMEvent(GTMEventAction.USER_VERIFIED, userVerifiedPayload);
104
+ const loginCompletedPayload = {
105
+ tenantId: user.tenantId,
106
+ userId: user.id,
107
+ authenticationType: 'activation_link',
108
+ createdAt: (_user$createdAt2 = user == null ? void 0 : user.createdAt) != null ? _user$createdAt2 : new Date(),
109
+ email: user.email,
110
+ name: user.name
111
+ };
112
+ reportGTMEvent(GTMEventAction.LOGIN_COMPLETED, loginCompletedPayload);
104
113
  actions.afterAuthenticationStateUpdate(_extends({
105
114
  user
106
115
  }, rest), {
@@ -1,6 +1,7 @@
1
1
  import { FeatureFlags } from '@frontegg/rest-api';
2
2
  import { MFAStep } from '../../MfaState/interfaces';
3
3
  import { LoginFlow, LoginStep } from '../interfaces';
4
+ import { GTMEventAction, reportGTMEvent } from '../../../helpers';
4
5
  import { isResetPasswordRequired, shouldShowPasswordRotationPromptFunc } from '../../helpers';
5
6
  export default function (store, api, sharedActions) {
6
7
  const actions = sharedActions;
@@ -95,6 +96,17 @@ export default function (store, api, sharedActions) {
95
96
  actions.setAuthState({
96
97
  isAuthenticated
97
98
  });
99
+ if (isAuthenticated && !isStepUp) {
100
+ const loginCompletedPayload = {
101
+ tenantId: user.tenantId,
102
+ userId: user.id,
103
+ authenticationType: 'mfa',
104
+ createdAt: new Date(),
105
+ email: user.email,
106
+ name: user.name
107
+ };
108
+ reportGTMEvent(GTMEventAction.LOGIN_COMPLETED, loginCompletedPayload);
109
+ }
98
110
  if (isStepUp) {
99
111
  return await postHandleVerifyMFAResponseForStepUp();
100
112
  }
@@ -1,5 +1,5 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
- import { createRandomString, generateCodeChallenge } from '../../../helpers';
2
+ import { createRandomString, generateCodeChallenge, GTMEventAction, reportGTMEvent } from '../../../helpers';
3
3
  import { HOSTED_LOGIN_VERIFIER_KEY } from '../../../constants';
4
4
  import { getBaseNameWithoutSlashSuffix, getSearchParam, isOauthCallbackRoute, TENANT_ID_PARAM_KEY } from '../helpers';
5
5
  import { getUri, isSteppedUp } from '../../helpers';
@@ -169,12 +169,25 @@ export default ((store, api, sharedActions) => {
169
169
  code_verifier,
170
170
  grant_type: 'authorization_code'
171
171
  };
172
+ const isStepUpFlow = window.localStorage.getItem(SHOULD_STEP_UP_KEY);
172
173
  try {
173
174
  const response = await api.auth.exchangeOAuthTokensV2(body);
175
+ const user = response.user;
174
176
  actions.afterAuthenticationStateUpdate(response, {
175
177
  isAuthenticated: true,
176
178
  isLoading: false
177
179
  });
180
+ if (!isStepUpFlow) {
181
+ const loginCompletedPayload = {
182
+ tenantId: user == null ? void 0 : user.tenantId,
183
+ userId: user == null ? void 0 : user.id,
184
+ authenticationType: 'hosted',
185
+ createdAt: user == null ? void 0 : user.createdAt,
186
+ email: user == null ? void 0 : user.email,
187
+ name: user == null ? void 0 : user.name
188
+ };
189
+ reportGTMEvent(GTMEventAction.LOGIN_COMPLETED, loginCompletedPayload);
190
+ }
178
191
  } catch (e) {
179
192
  actions.setAuthState({
180
193
  isLoading: false
@@ -182,7 +195,6 @@ export default ((store, api, sharedActions) => {
182
195
  console.error('Failed to exchangeOAuthTokens', e);
183
196
  } finally {
184
197
  const user = store.auth.user;
185
- const isStepUpFlow = window.localStorage.getItem(SHOULD_STEP_UP_KEY);
186
198
  window.localStorage.removeItem(SHOULD_STEP_UP_KEY);
187
199
 
188
200
  // when the user pause the step up flow we may still have the key in the local storage in hosted. Ignore it.
@@ -435,10 +435,23 @@ export default ((store, api, sharedActions) => {
435
435
  });
436
436
  try {
437
437
  const user = await api.auth.postLogin(payload);
438
+ const isAuthenticated = !!user.accessToken;
438
439
  actions.setAuthState({
439
440
  user: user.accessToken ? user : undefined,
440
- isAuthenticated: !!user.accessToken
441
- });
441
+ isAuthenticated
442
+ });
443
+ if (isAuthenticated) {
444
+ var _user$createdAt;
445
+ const loginCompletedPayload = {
446
+ tenantId: user.tenantId,
447
+ userId: user.id,
448
+ authenticationType: 'password',
449
+ createdAt: (_user$createdAt = user == null ? void 0 : user.createdAt) != null ? _user$createdAt : new Date(),
450
+ email: user.email,
451
+ name: user.name
452
+ };
453
+ reportGTMEvent(GTMEventAction.LOGIN_COMPLETED, loginCompletedPayload);
454
+ }
442
455
  await actions.afterAuthNavigation();
443
456
  } catch (e) {
444
457
  setTimeout(() => {
@@ -520,6 +533,18 @@ export default ((store, api, sharedActions) => {
520
533
  },
521
534
  isAuthenticated
522
535
  });
536
+ if (isAuthenticated) {
537
+ var _user$createdAt2;
538
+ const loginCompletedPayload = {
539
+ tenantId: user.tenantId,
540
+ userId: user.id,
541
+ authenticationType: 'password',
542
+ createdAt: (_user$createdAt2 = user == null ? void 0 : user.createdAt) != null ? _user$createdAt2 : new Date(),
543
+ email,
544
+ name: user.name
545
+ };
546
+ reportGTMEvent(GTMEventAction.LOGIN_COMPLETED, loginCompletedPayload);
547
+ }
523
548
  if (loginState.flow === LoginFlow.Login) {
524
549
  if (securityCenterLoginFlows && user.isBreachedPassword && !isAuthenticated) {
525
550
  setLoginState({
@@ -777,6 +802,7 @@ export default ((store, api, sharedActions) => {
777
802
  preserveQueryParams: true
778
803
  });
779
804
  } else {
805
+ var _user$createdAt3;
780
806
  const loginState = store.auth.loginState;
781
807
  if (user.emailVerified) {
782
808
  var _events$userVerified;
@@ -791,6 +817,15 @@ export default ((store, api, sharedActions) => {
791
817
  events == null ? void 0 : (_events$userVerified = events.userVerified) == null ? void 0 : _events$userVerified.call(events, userVerifiedPayload);
792
818
  reportGTMEvent(GTMEventAction.USER_VERIFIED, userVerifiedPayload);
793
819
  }
820
+ const loginCompletedPayload = {
821
+ tenantId: user.tenantId,
822
+ userId: user.id,
823
+ authenticationType: 'magic_link',
824
+ createdAt: (_user$createdAt3 = user == null ? void 0 : user.createdAt) != null ? _user$createdAt3 : new Date(),
825
+ email: user.email,
826
+ name: user.name
827
+ };
828
+ reportGTMEvent(GTMEventAction.LOGIN_COMPLETED, loginCompletedPayload);
794
829
  if (user.id) {
795
830
  localStorage.setItem('userId', user.id);
796
831
  }
@@ -946,6 +981,7 @@ export default ((store, api, sharedActions) => {
946
981
  preserveQueryParams: true
947
982
  });
948
983
  } else {
984
+ var _user$createdAt4;
949
985
  if (user.id) {
950
986
  localStorage.setItem('userId', user.id);
951
987
  }
@@ -957,6 +993,15 @@ export default ((store, api, sharedActions) => {
957
993
  setLoginState({
958
994
  error: undefined
959
995
  });
996
+ const loginCompletedPayload = {
997
+ tenantId: user.tenantId,
998
+ userId: user.id,
999
+ authenticationType: 'webauthn',
1000
+ createdAt: (_user$createdAt4 = user == null ? void 0 : user.createdAt) != null ? _user$createdAt4 : new Date(),
1001
+ email: user.email,
1002
+ name: user.name
1003
+ };
1004
+ reportGTMEvent(GTMEventAction.LOGIN_COMPLETED, loginCompletedPayload);
960
1005
  await actions.afterAuthNavigation();
961
1006
  // TODO: Itamar why moving callback to inside the else block
962
1007
  callback == null ? void 0 : callback(true);
@@ -2,7 +2,7 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
2
2
  import _extends from "@babel/runtime/helpers/esm/extends";
3
3
  const _excluded = ["callback"];
4
4
  import { LoginFlow, LoginStep } from '../interfaces';
5
- import { errorHandler } from '../../../helpers';
5
+ import { errorHandler, GTMEventAction, reportGTMEvent } from '../../../helpers';
6
6
  import { isResetPasswordRequired, shouldShowPasswordRotationPromptFunc } from '../../helpers';
7
7
  export default ((store, api, sharedActions) => {
8
8
  const actions = sharedActions;
@@ -120,6 +120,17 @@ export default ((store, api, sharedActions) => {
120
120
  tenants,
121
121
  activeTenant
122
122
  }, additionalUpdate);
123
+ if (isAuthenticated && !isStepUp) {
124
+ const loginCompletedPayload = {
125
+ tenantId: user.tenantId,
126
+ userId: user.id,
127
+ authenticationType: 'mfa',
128
+ createdAt: new Date(),
129
+ email: user.email,
130
+ name: user.name
131
+ };
132
+ reportGTMEvent(GTMEventAction.LOGIN_COMPLETED, loginCompletedPayload);
133
+ }
123
134
  if (user.id) {
124
135
  localStorage.setItem('userId', user.id);
125
136
  }
@@ -9,7 +9,7 @@ const _excluded = ["callback"],
9
9
  _excluded7 = ["callback"],
10
10
  _excluded8 = ["deviceId", "callback"];
11
11
  import { MFAStep } from './interfaces';
12
- import { errorHandler, base64urlDecode, publicKeyCredentialToJSON, deepResetState, retryIfNeeded } from '../../helpers';
12
+ import { errorHandler, base64urlDecode, publicKeyCredentialToJSON, deepResetState, retryIfNeeded, GTMEventAction, reportGTMEvent } from '../../helpers';
13
13
  import { initialState } from './state';
14
14
  export default ((store, api, sharedActions) => {
15
15
  const actions = sharedActions;
@@ -153,6 +153,18 @@ export default ((store, api, sharedActions) => {
153
153
  await actions.afterAuthenticationStateUpdate(_extends({
154
154
  user
155
155
  }, rest));
156
+ if (!!(user != null && user.accessToken)) {
157
+ var _user$createdAt;
158
+ const loginCompletedPayload = {
159
+ tenantId: user == null ? void 0 : user.tenantId,
160
+ userId: user == null ? void 0 : user.id,
161
+ authenticationType: 'mfa',
162
+ createdAt: (_user$createdAt = user == null ? void 0 : user.createdAt) != null ? _user$createdAt : new Date(),
163
+ email: user == null ? void 0 : user.email,
164
+ name: user == null ? void 0 : user.name
165
+ };
166
+ reportGTMEvent(GTMEventAction.LOGIN_COMPLETED, loginCompletedPayload);
167
+ }
156
168
  callback == null ? void 0 : callback(mfaState.recoveryCode);
157
169
  } catch (e) {
158
170
  setMfaState({
@@ -120,6 +120,7 @@ export default ((store, api, sharedActions) => {
120
120
  tenantId
121
121
  };
122
122
  const signUpCompletePayload = _extends({}, basePayload, {
123
+ name,
123
124
  socialProvider: payload.provider,
124
125
  authenticationType: AuthenticationTypes.SOCIAL_LOGIN
125
126
  });
@@ -132,6 +133,17 @@ export default ((store, api, sharedActions) => {
132
133
  events == null ? void 0 : (_events$userVerified = events.userVerified) == null ? void 0 : _events$userVerified.call(events, userVerifiedPayload);
133
134
  reportGTMEvent(GTMEventAction.USER_VERIFIED, userVerifiedPayload);
134
135
  }
136
+ const loginCompletedPayload = {
137
+ tenantId,
138
+ userId,
139
+ authenticationType: AuthenticationTypes.SOCIAL_LOGIN,
140
+ createdAt: new Date(),
141
+ provider: payload.provider,
142
+ email,
143
+ name,
144
+ isFirstLogin: isNewUser
145
+ };
146
+ reportGTMEvent(GTMEventAction.LOGIN_COMPLETED, loginCompletedPayload);
135
147
  if (userId) {
136
148
  localStorage.setItem('userId', userId);
137
149
  }
package/helpers/gtm.d.ts CHANGED
@@ -3,7 +3,8 @@
3
3
  */
4
4
  export declare enum GTMEventAction {
5
5
  SIGNUP_COMPLETED = "signup_completed",
6
- USER_VERIFIED = "user_verified"
6
+ USER_VERIFIED = "user_verified",
7
+ LOGIN_COMPLETED = "login_completed"
7
8
  }
8
9
  /**
9
10
  * Mapping between event action to event payload
@@ -11,6 +12,7 @@ export declare enum GTMEventAction {
11
12
  interface EventToPayloadMap {
12
13
  [GTMEventAction.SIGNUP_COMPLETED]: any;
13
14
  [GTMEventAction.USER_VERIFIED]: any;
15
+ [GTMEventAction.LOGIN_COMPLETED]: any;
14
16
  }
15
17
  declare global {
16
18
  interface Window {
package/helpers/gtm.js CHANGED
@@ -12,6 +12,7 @@ export let GTMEventAction;
12
12
  (function (GTMEventAction) {
13
13
  GTMEventAction["SIGNUP_COMPLETED"] = "signup_completed";
14
14
  GTMEventAction["USER_VERIFIED"] = "user_verified";
15
+ GTMEventAction["LOGIN_COMPLETED"] = "login_completed";
15
16
  })(GTMEventAction || (GTMEventAction = {}));
16
17
  /**
17
18
  * Report GTM event by onFronteggEvent
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license Frontegg v7.103.0-alpha.0
1
+ /** @license Frontegg v7.103.0
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.
@@ -94,7 +94,7 @@ var _default = (store, api, sharedActions) => {
94
94
  preserveQueryParams: true
95
95
  });
96
96
  } else {
97
- var _events$userVerified;
97
+ var _user$createdAt, _events$userVerified, _user$createdAt2;
98
98
  setActivateState({
99
99
  step: _interfaces.ActivateAccountStep.success
100
100
  });
@@ -104,10 +104,19 @@ var _default = (store, api, sharedActions) => {
104
104
  id: user.id,
105
105
  tenantId: user.tenantId,
106
106
  name: user.name,
107
- createdAt: new Date()
107
+ createdAt: (_user$createdAt = user == null ? void 0 : user.createdAt) != null ? _user$createdAt : new Date()
108
108
  };
109
109
  events == null ? void 0 : (_events$userVerified = events.userVerified) == null ? void 0 : _events$userVerified.call(events, userVerifiedPayload);
110
110
  (0, _gtm.reportGTMEvent)(_gtm.GTMEventAction.USER_VERIFIED, userVerifiedPayload);
111
+ const loginCompletedPayload = {
112
+ tenantId: user.tenantId,
113
+ userId: user.id,
114
+ authenticationType: 'activation_link',
115
+ createdAt: (_user$createdAt2 = user == null ? void 0 : user.createdAt) != null ? _user$createdAt2 : new Date(),
116
+ email: user.email,
117
+ name: user.name
118
+ };
119
+ (0, _gtm.reportGTMEvent)(_gtm.GTMEventAction.LOGIN_COMPLETED, loginCompletedPayload);
111
120
  actions.afterAuthenticationStateUpdate((0, _extends2.default)({
112
121
  user
113
122
  }, rest), {
@@ -7,7 +7,8 @@ exports.default = _default;
7
7
  var _restApi = require("@frontegg/rest-api");
8
8
  var _interfaces = require("../../MfaState/interfaces");
9
9
  var _interfaces2 = require("../interfaces");
10
- var _helpers = require("../../helpers");
10
+ var _helpers = require("../../../helpers");
11
+ var _helpers2 = require("../../helpers");
11
12
  function _default(store, api, sharedActions) {
12
13
  const actions = sharedActions;
13
14
 
@@ -44,7 +45,7 @@ function _default(store, api, sharedActions) {
44
45
  });
45
46
  return;
46
47
  }
47
- if ((0, _helpers.isResetPasswordRequired)(user, store.root.appName)) {
48
+ if ((0, _helpers2.isResetPasswordRequired)(user, store.root.appName)) {
48
49
  actions.setLoginState({
49
50
  step: _interfaces2.LoginStep.passwordRotationExpired,
50
51
  loading: false,
@@ -53,7 +54,7 @@ function _default(store, api, sharedActions) {
53
54
  });
54
55
  return;
55
56
  }
56
- if ((0, _helpers.shouldShowPasswordRotationPromptFunc)(user)) {
57
+ if ((0, _helpers2.shouldShowPasswordRotationPromptFunc)(user)) {
57
58
  actions.setLoginState({
58
59
  step: _interfaces2.LoginStep.passwordRotationNotification,
59
60
  loading: false
@@ -101,6 +102,17 @@ function _default(store, api, sharedActions) {
101
102
  actions.setAuthState({
102
103
  isAuthenticated
103
104
  });
105
+ if (isAuthenticated && !isStepUp) {
106
+ const loginCompletedPayload = {
107
+ tenantId: user.tenantId,
108
+ userId: user.id,
109
+ authenticationType: 'mfa',
110
+ createdAt: new Date(),
111
+ email: user.email,
112
+ name: user.name
113
+ };
114
+ (0, _helpers.reportGTMEvent)(_helpers.GTMEventAction.LOGIN_COMPLETED, loginCompletedPayload);
115
+ }
104
116
  if (isStepUp) {
105
117
  return await postHandleVerifyMFAResponseForStepUp();
106
118
  }
@@ -176,12 +176,25 @@ var _default = (store, api, sharedActions) => {
176
176
  code_verifier,
177
177
  grant_type: 'authorization_code'
178
178
  };
179
+ const isStepUpFlow = window.localStorage.getItem(_consts.SHOULD_STEP_UP_KEY);
179
180
  try {
180
181
  const response = await api.auth.exchangeOAuthTokensV2(body);
182
+ const user = response.user;
181
183
  actions.afterAuthenticationStateUpdate(response, {
182
184
  isAuthenticated: true,
183
185
  isLoading: false
184
186
  });
187
+ if (!isStepUpFlow) {
188
+ const loginCompletedPayload = {
189
+ tenantId: user == null ? void 0 : user.tenantId,
190
+ userId: user == null ? void 0 : user.id,
191
+ authenticationType: 'hosted',
192
+ createdAt: user == null ? void 0 : user.createdAt,
193
+ email: user == null ? void 0 : user.email,
194
+ name: user == null ? void 0 : user.name
195
+ };
196
+ (0, _helpers.reportGTMEvent)(_helpers.GTMEventAction.LOGIN_COMPLETED, loginCompletedPayload);
197
+ }
185
198
  } catch (e) {
186
199
  actions.setAuthState({
187
200
  isLoading: false
@@ -189,7 +202,6 @@ var _default = (store, api, sharedActions) => {
189
202
  console.error('Failed to exchangeOAuthTokens', e);
190
203
  } finally {
191
204
  const user = store.auth.user;
192
- const isStepUpFlow = window.localStorage.getItem(_consts.SHOULD_STEP_UP_KEY);
193
205
  window.localStorage.removeItem(_consts.SHOULD_STEP_UP_KEY);
194
206
 
195
207
  // when the user pause the step up flow we may still have the key in the local storage in hosted. Ignore it.
@@ -442,10 +442,23 @@ var _default = (store, api, sharedActions) => {
442
442
  });
443
443
  try {
444
444
  const user = await api.auth.postLogin(payload);
445
+ const isAuthenticated = !!user.accessToken;
445
446
  actions.setAuthState({
446
447
  user: user.accessToken ? user : undefined,
447
- isAuthenticated: !!user.accessToken
448
- });
448
+ isAuthenticated
449
+ });
450
+ if (isAuthenticated) {
451
+ var _user$createdAt;
452
+ const loginCompletedPayload = {
453
+ tenantId: user.tenantId,
454
+ userId: user.id,
455
+ authenticationType: 'password',
456
+ createdAt: (_user$createdAt = user == null ? void 0 : user.createdAt) != null ? _user$createdAt : new Date(),
457
+ email: user.email,
458
+ name: user.name
459
+ };
460
+ (0, _helpers.reportGTMEvent)(_helpers.GTMEventAction.LOGIN_COMPLETED, loginCompletedPayload);
461
+ }
449
462
  await actions.afterAuthNavigation();
450
463
  } catch (e) {
451
464
  setTimeout(() => {
@@ -527,6 +540,18 @@ var _default = (store, api, sharedActions) => {
527
540
  },
528
541
  isAuthenticated
529
542
  });
543
+ if (isAuthenticated) {
544
+ var _user$createdAt2;
545
+ const loginCompletedPayload = {
546
+ tenantId: user.tenantId,
547
+ userId: user.id,
548
+ authenticationType: 'password',
549
+ createdAt: (_user$createdAt2 = user == null ? void 0 : user.createdAt) != null ? _user$createdAt2 : new Date(),
550
+ email,
551
+ name: user.name
552
+ };
553
+ (0, _helpers.reportGTMEvent)(_helpers.GTMEventAction.LOGIN_COMPLETED, loginCompletedPayload);
554
+ }
530
555
  if (loginState.flow === _interfaces.LoginFlow.Login) {
531
556
  if (securityCenterLoginFlows && user.isBreachedPassword && !isAuthenticated) {
532
557
  setLoginState({
@@ -784,6 +809,7 @@ var _default = (store, api, sharedActions) => {
784
809
  preserveQueryParams: true
785
810
  });
786
811
  } else {
812
+ var _user$createdAt3;
787
813
  const loginState = store.auth.loginState;
788
814
  if (user.emailVerified) {
789
815
  var _events$userVerified;
@@ -798,6 +824,15 @@ var _default = (store, api, sharedActions) => {
798
824
  events == null ? void 0 : (_events$userVerified = events.userVerified) == null ? void 0 : _events$userVerified.call(events, userVerifiedPayload);
799
825
  (0, _helpers.reportGTMEvent)(_helpers.GTMEventAction.USER_VERIFIED, userVerifiedPayload);
800
826
  }
827
+ const loginCompletedPayload = {
828
+ tenantId: user.tenantId,
829
+ userId: user.id,
830
+ authenticationType: 'magic_link',
831
+ createdAt: (_user$createdAt3 = user == null ? void 0 : user.createdAt) != null ? _user$createdAt3 : new Date(),
832
+ email: user.email,
833
+ name: user.name
834
+ };
835
+ (0, _helpers.reportGTMEvent)(_helpers.GTMEventAction.LOGIN_COMPLETED, loginCompletedPayload);
801
836
  if (user.id) {
802
837
  localStorage.setItem('userId', user.id);
803
838
  }
@@ -953,6 +988,7 @@ var _default = (store, api, sharedActions) => {
953
988
  preserveQueryParams: true
954
989
  });
955
990
  } else {
991
+ var _user$createdAt4;
956
992
  if (user.id) {
957
993
  localStorage.setItem('userId', user.id);
958
994
  }
@@ -964,6 +1000,15 @@ var _default = (store, api, sharedActions) => {
964
1000
  setLoginState({
965
1001
  error: undefined
966
1002
  });
1003
+ const loginCompletedPayload = {
1004
+ tenantId: user.tenantId,
1005
+ userId: user.id,
1006
+ authenticationType: 'webauthn',
1007
+ createdAt: (_user$createdAt4 = user == null ? void 0 : user.createdAt) != null ? _user$createdAt4 : new Date(),
1008
+ email: user.email,
1009
+ name: user.name
1010
+ };
1011
+ (0, _helpers.reportGTMEvent)(_helpers.GTMEventAction.LOGIN_COMPLETED, loginCompletedPayload);
967
1012
  await actions.afterAuthNavigation();
968
1013
  // TODO: Itamar why moving callback to inside the else block
969
1014
  callback == null ? void 0 : callback(true);
@@ -127,6 +127,17 @@ var _default = (store, api, sharedActions) => {
127
127
  tenants,
128
128
  activeTenant
129
129
  }, additionalUpdate);
130
+ if (isAuthenticated && !isStepUp) {
131
+ const loginCompletedPayload = {
132
+ tenantId: user.tenantId,
133
+ userId: user.id,
134
+ authenticationType: 'mfa',
135
+ createdAt: new Date(),
136
+ email: user.email,
137
+ name: user.name
138
+ };
139
+ (0, _helpers.reportGTMEvent)(_helpers.GTMEventAction.LOGIN_COMPLETED, loginCompletedPayload);
140
+ }
130
141
  if (user.id) {
131
142
  localStorage.setItem('userId', user.id);
132
143
  }
@@ -160,6 +160,18 @@ var _default = (store, api, sharedActions) => {
160
160
  await actions.afterAuthenticationStateUpdate((0, _extends2.default)({
161
161
  user
162
162
  }, rest));
163
+ if (!!(user != null && user.accessToken)) {
164
+ var _user$createdAt;
165
+ const loginCompletedPayload = {
166
+ tenantId: user == null ? void 0 : user.tenantId,
167
+ userId: user == null ? void 0 : user.id,
168
+ authenticationType: 'mfa',
169
+ createdAt: (_user$createdAt = user == null ? void 0 : user.createdAt) != null ? _user$createdAt : new Date(),
170
+ email: user == null ? void 0 : user.email,
171
+ name: user == null ? void 0 : user.name
172
+ };
173
+ (0, _helpers.reportGTMEvent)(_helpers.GTMEventAction.LOGIN_COMPLETED, loginCompletedPayload);
174
+ }
163
175
  callback == null ? void 0 : callback(mfaState.recoveryCode);
164
176
  } catch (e) {
165
177
  setMfaState({
@@ -127,6 +127,7 @@ var _default = (store, api, sharedActions) => {
127
127
  tenantId
128
128
  };
129
129
  const signUpCompletePayload = (0, _extends2.default)({}, basePayload, {
130
+ name,
130
131
  socialProvider: payload.provider,
131
132
  authenticationType: _interfaces.AuthenticationTypes.SOCIAL_LOGIN
132
133
  });
@@ -139,6 +140,17 @@ var _default = (store, api, sharedActions) => {
139
140
  events == null ? void 0 : (_events$userVerified = events.userVerified) == null ? void 0 : _events$userVerified.call(events, userVerifiedPayload);
140
141
  (0, _gtm.reportGTMEvent)(_gtm.GTMEventAction.USER_VERIFIED, userVerifiedPayload);
141
142
  }
143
+ const loginCompletedPayload = {
144
+ tenantId,
145
+ userId,
146
+ authenticationType: _interfaces.AuthenticationTypes.SOCIAL_LOGIN,
147
+ createdAt: new Date(),
148
+ provider: payload.provider,
149
+ email,
150
+ name,
151
+ isFirstLogin: isNewUser
152
+ };
153
+ (0, _gtm.reportGTMEvent)(_gtm.GTMEventAction.LOGIN_COMPLETED, loginCompletedPayload);
142
154
  if (userId) {
143
155
  localStorage.setItem('userId', userId);
144
156
  }
@@ -18,6 +18,7 @@ exports.GTMEventAction = GTMEventAction;
18
18
  (function (GTMEventAction) {
19
19
  GTMEventAction["SIGNUP_COMPLETED"] = "signup_completed";
20
20
  GTMEventAction["USER_VERIFIED"] = "user_verified";
21
+ GTMEventAction["LOGIN_COMPLETED"] = "login_completed";
21
22
  })(GTMEventAction || (exports.GTMEventAction = GTMEventAction = {}));
22
23
  /**
23
24
  * Report GTM event by onFronteggEvent
package/node/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license Frontegg v7.103.0-alpha.0
1
+ /** @license Frontegg v7.103.0
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.103.0-alpha.0",
3
+ "version": "7.103.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.103.0-alpha.0",
10
+ "@frontegg/rest-api": "7.103.0",
11
11
  "fast-deep-equal": "3.1.3",
12
12
  "get-value": "^3.0.1",
13
13
  "proxy-compare": "^3.0.0",