mario-core 2.9.31-beta → 2.9.32-beta

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.
@@ -7,6 +7,7 @@ import { object, string, boolean, number, array } from 'yup';
7
7
  import { useDispatch, useSelector } from 'react-redux';
8
8
  import { createAction, createReducer, configureStore } from '@reduxjs/toolkit';
9
9
  import axios from 'axios';
10
+ import amplitude from 'amplitude-js';
10
11
  import { useGoogleReCaptcha, GoogleReCaptcha, GoogleReCaptchaProvider } from 'react-google-recaptcha-v3';
11
12
  import GoogleLogin from 'react-google-login';
12
13
  import Select from 'react-select';
@@ -26,7 +27,6 @@ import ReactNotification$1 from 'react-notifications-component';
26
27
  import 'react-notifications-component/dist/theme.css';
27
28
  import { AiOutlineEye } from 'react-icons/ai';
28
29
  import moment from 'moment';
29
- import amplitude from 'amplitude-js';
30
30
 
31
31
  // A type of promise-like that resolves synchronously and supports only one observer
32
32
 
@@ -414,7 +414,8 @@ var useLogin = function useLogin() {
414
414
  lastName = _res$data.lastName,
415
415
  roles = _res$data.roles,
416
416
  email = _res$data.email,
417
- profileImageFileName = _res$data.profileImageFileName;
417
+ profileImageFileName = _res$data.profileImageFileName,
418
+ isLoginFirst = _res$data.isLoginFirst;
418
419
  localStorage.setItem(ACCESS_TOKEN, token);
419
420
  dispatch(setUser({
420
421
  id: id,
@@ -425,6 +426,22 @@ var useLogin = function useLogin() {
425
426
  profileImageFileName: profileImageFileName
426
427
  }));
427
428
 
429
+ if (data !== null && data !== void 0 && data.email && !roles.includes("Admin")) {
430
+ amplitude.getInstance().init(INIT_AMPLITUDE_KEY, data.email, {
431
+ includeReferrer: true,
432
+ includeUtm: true
433
+ });
434
+ amplitude.getInstance().logEvent("general: session start", {
435
+ user_id: data.email
436
+ });
437
+
438
+ if (isLoginFirst) {
439
+ amplitude.getInstance().logEvent("general: first login", {
440
+ user_id: data.email
441
+ });
442
+ }
443
+ }
444
+
428
445
  if (isDistrict) {
429
446
  history.push(HOMEPAGE_DISTRICT);
430
447
  } else if (roles.includes("Admin")) {