@tap-payments/auth-jsconnect 2.8.51-development → 2.8.52-development

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.
@@ -60,7 +60,7 @@ import { AuthForType, AuthTypeNumber, FlowsTypes, MigrationStatus } from '../../
60
60
  import { ADD_NEW_ENTITY, AUTH_STEP_NAMES, IDENTIFICATION_TYPE, defaultCountry } from '../../../constants';
61
61
  import API from '../../../api';
62
62
  import { handleCurrentActiveScreen, handleNextScreenStep, handleOpen, handlePrevScreenStep, handleSetCountryByIso2 } from '../../../app/settings';
63
- import { findCountryByIddPrefix, openConnect, sleep } from '../../../utils';
63
+ import { findCountryByIddPrefix, openConnect, sendCustomEventToGTM, sleep } from '../../../utils';
64
64
  export var updateBusinessCountry = createAsyncThunk('auth/updateBusinessCountry', function (countryCode, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
65
65
  var auth, payload, data;
66
66
  return __generator(this, function (_a) {
@@ -198,6 +198,11 @@ export var verifyMobileOtp = createAsyncThunk('auth/verifyMobileOtp', function (
198
198
  data = (_h.sent()).data;
199
199
  if ((_e = data.errors) === null || _e === void 0 ? void 0 : _e.length)
200
200
  throw new Error(data.errors[0].description);
201
+ sendCustomEventToGTM({
202
+ event: 'Send Event',
203
+ event_category: 'User Registration Flow',
204
+ event_action: 'First OTP Success'
205
+ });
201
206
  if (scope === 'merchant') {
202
207
  openConnect(settings.data.appConfig.publicKey, settings.data.businessCountry.iso2);
203
208
  return [2, data];
@@ -342,6 +347,11 @@ export var verifyEmailOtp = createAsyncThunk('auth/verifyEmailOtp', function (pa
342
347
  data = (_h.sent()).data;
343
348
  if ((_e = data.errors) === null || _e === void 0 ? void 0 : _e.length)
344
349
  throw new Error(data.errors[0].description);
350
+ sendCustomEventToGTM({
351
+ event: 'Send Event',
352
+ event_category: 'User Registration Flow',
353
+ event_action: 'First OTP Success'
354
+ });
345
355
  if (scope === 'merchant') {
346
356
  openConnect(settings.data.appConfig.publicKey, settings.data.businessCountry.iso2);
347
357
  return [2, data];
@@ -460,6 +470,11 @@ export var verifyNIDOtp = createAsyncThunk('auth/verifyNIDOtp', function (params
460
470
  data = (_h.sent()).data;
461
471
  if ((_e = data.errors) === null || _e === void 0 ? void 0 : _e.length)
462
472
  throw new Error(data.errors[0].description);
473
+ sendCustomEventToGTM({
474
+ event: 'Send Event',
475
+ event_category: 'User Registration Flow',
476
+ event_action: 'First OTP Success'
477
+ });
463
478
  if (scope === 'merchant') {
464
479
  openConnect(settings.data.appConfig.publicKey, settings.data.businessCountry.iso2);
465
480
  return [2, data];
@@ -574,7 +589,13 @@ export var checkMigrationStatus = createAsyncThunk('auth/checkMigrationStatus',
574
589
  throw new Error('please_try_again_after_few_minutes');
575
590
  }
576
591
  _a.label = 5;
577
- case 5: return [4, thunkApi.dispatch(confirmInfo({ authId: authId }))];
592
+ case 5:
593
+ sendCustomEventToGTM({
594
+ event: 'Send Event',
595
+ event_category: 'User Registration Flow',
596
+ event_action: 'Migration Completed'
597
+ });
598
+ return [4, thunkApi.dispatch(confirmInfo({ authId: authId }))];
578
599
  case 6:
579
600
  _a.sent();
580
601
  return [2];
@@ -61,7 +61,7 @@ import { FlowsTypes, AuthForType, BusinessType, LicenseType } from '../../../@ty
61
61
  import API from '../../../api';
62
62
  import { ADD_NEW_ENTITY, CONNECT_EXPRESS_STEP_NAMES, IDENTIFICATION_TYPE, OTHER_CR_LICENSE, OTHER_FL_LICENSE, SCOPE_AUTH } from '../../../constants';
63
63
  import { defaultCountry } from '../../../constants';
64
- import { getIndividualName, capitalizeTheFirstLetterOfEachWord, sleep, findCountryByIddPrefix, concatenateObjectValues, isSA, isKW, isOtherThanKWOrSA, sendCustomEventToGTM } from '../../../utils';
64
+ import { getIndividualName, capitalizeTheFirstLetterOfEachWord, sleep, findCountryByIddPrefix, concatenateObjectValues, isSA, isKW, isOtherThanKWOrSA, sendCustomEventToGTM, sendCustomDimension } from '../../../utils';
65
65
  export var updateBusinessCountryAsync = createAsyncThunk('connectExpress/updateBusinessCountryAsync', function (countryCode, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
66
66
  var connectExpress, payload, data;
67
67
  return __generator(this, function (_a) {
@@ -447,6 +447,11 @@ export var verifyMobileOtpAsync = createAsyncThunk('connectExpress/verifyMobileO
447
447
  return [4, API.authService.verifyExpressAuth(payload)];
448
448
  case 1:
449
449
  data = _h.sent();
450
+ sendCustomEventToGTM({
451
+ event: 'Send Event',
452
+ event_category: 'User Registration Flow',
453
+ event_action: 'First OTP Success'
454
+ });
450
455
  (_g = (_f = settings.data.appConfig).onStepCompleted) === null || _g === void 0 ? void 0 : _g.call(_f, settings.data.activeScreen.name, params);
451
456
  authId = data.auth.id;
452
457
  thunkApi.dispatch(storeAuthId(authId));
@@ -514,6 +519,11 @@ export var verifyNIDOtpAsync = createAsyncThunk('connectExpress/verifyNIDOtpAsyn
514
519
  return [4, API.authService.verifyExpressAuth(payload)];
515
520
  case 1:
516
521
  data = _h.sent();
522
+ sendCustomEventToGTM({
523
+ event: 'Send Event',
524
+ event_category: 'User Registration Flow',
525
+ event_action: 'First OTP Success'
526
+ });
517
527
  (_g = (_f = settings.data.appConfig).onStepCompleted) === null || _g === void 0 ? void 0 : _g.call(_f, settings.data.activeScreen.name, params);
518
528
  authId = data.auth.id;
519
529
  thunkApi.dispatch(storeAuthId(authId));
@@ -757,6 +767,11 @@ export var verifyNIDOtpLeadIdentityAsync = createAsyncThunk('connectExpress/veri
757
767
  return [4, API.authService.verifyExpressLeadIdentity(payload)];
758
768
  case 1:
759
769
  data = _e.sent();
770
+ sendCustomEventToGTM({
771
+ event: 'Send Event',
772
+ event_category: 'User Registration Flow',
773
+ event_action: 'Absher OTP Success'
774
+ });
760
775
  return [4, thunkApi.dispatch(getLeadByIdAsync(data.lead.id)).unwrap()];
761
776
  case 2:
762
777
  _e.sent();
@@ -916,6 +931,10 @@ export var createAccountAsync = createAsyncThunk('connectExpress/createAccountAs
916
931
  event_label: 'Product Type',
917
932
  event_value: leadId
918
933
  });
934
+ sendCustomDimension({
935
+ event: 'PageView',
936
+ lead_ID: leadId
937
+ });
919
938
  (_m = (_l = settings.data.appConfig).onCreated) === null || _m === void 0 ? void 0 : _m.call(_l, accountData);
920
939
  (_p = (_o = settings.data.appConfig).onFlowCompleted) === null || _p === void 0 ? void 0 : _p.call(_o, accountData);
921
940
  (_r = (_q = settings.data.appConfig).onStepCompleted) === null || _r === void 0 ? void 0 : _r.call(_q, settings.data.activeScreen.name, accountData);
@@ -89,7 +89,11 @@ var Auth = memo(function (_a) {
89
89
  });
90
90
  }); };
91
91
  useAppConfig(__assign(__assign(__assign({ postURL: postURL, navigation: AUTH_SCREENS_NAVIGATION }, props), { configToken: configToken }), (configToken && { onVerifyConfigTokenSuccess: onVerifyConfigTokenSuccess })));
92
- useErrorListener(authError || error);
92
+ useErrorListener(authError || error, {
93
+ event: 'Send Event',
94
+ event_category: 'User Registration Flow',
95
+ event_action: 'Registration Error'
96
+ });
93
97
  useStepStartedListener();
94
98
  var activeScreen = settingData.activeScreen, isTapOrigin = settingData.isTapOrigin, open = settingData.open, merchant = settingData.merchant, appConfig = settingData.appConfig;
95
99
  var animationDirection = open ? openAnimationDirection : closeAnimationDirection;
@@ -24,7 +24,7 @@ import { handlePrevScreenStep } from '../../../../app/settings';
24
24
  import { AuthForType, AuthTypeNumber } from '../../../../@types';
25
25
  import { yupResolver } from '@hookform/resolvers/yup';
26
26
  import Form from '../../../../components/Form';
27
- import { maskPhone, maskID, deepCopy, maskEmail } from '../../../../utils';
27
+ import { maskPhone, maskID, deepCopy, maskEmail, sendCustomEventToGTM } from '../../../../utils';
28
28
  import { OTPValidation } from './validation';
29
29
  import OTPInput from './OTPInput';
30
30
  var OTPTitleContainerStyled = styled(Box)(function (_a) {
@@ -89,6 +89,11 @@ var OTP = function () {
89
89
  dispatch(clearError());
90
90
  }, [methods.formState.isValid]);
91
91
  React.useEffect(function () {
92
+ sendCustomEventToGTM({
93
+ event: 'Send Event',
94
+ event_category: 'User Registration Flow',
95
+ event_action: 'First OTP Page Viewed'
96
+ });
92
97
  return function () {
93
98
  dispatch(resetOTPValue());
94
99
  };
@@ -20,6 +20,7 @@ import { DEFAULT_TIMER_VALUE } from '../../../../constants';
20
20
  import { AuthForType } from '../../../../@types';
21
21
  import { resendMobileAuthOTP, resendNIDAuthOTP, authSelector, clearError, resendEmailAuthOTP } from '../../../app/auth/authStore';
22
22
  import { useAppDispatch, useAppSelector } from '../../../../hooks';
23
+ import { sendCustomEventToGTM } from '../../../../utils';
23
24
  var BoxStyled = styled(Box)(function (_a) {
24
25
  var theme = _a.theme;
25
26
  return ({
@@ -42,19 +43,29 @@ var OTPInput = function (_a) {
42
43
  dispatch(clearError());
43
44
  otpControl.field.onChange(otp);
44
45
  };
46
+ var sendEventAskAnotherOTP = function () {
47
+ sendCustomEventToGTM({
48
+ event: 'Send Event',
49
+ event_category: 'User Registration Flow',
50
+ event_action: 'Another OTP asked'
51
+ });
52
+ };
45
53
  var handleOnResendOTP = function () {
46
54
  if (otpControl.field.value)
47
55
  setValue('otp', '', { shouldValidate: true });
56
+ sendEventAskAnotherOTP();
48
57
  dispatch(resendMobileAuthOTP(mobileData));
49
58
  };
50
59
  var handleOnResendAbsherOTP = function () {
51
60
  if (otpControl.field.value)
52
61
  setValue('otp', '', { shouldValidate: true });
62
+ sendEventAskAnotherOTP();
53
63
  dispatch(resendNIDAuthOTP(nidData));
54
64
  };
55
65
  var handleOnResendEmailOTP = function () {
56
66
  if (otpControl.field.value)
57
67
  setValue('otp', '', { shouldValidate: true });
68
+ sendEventAskAnotherOTP();
58
69
  dispatch(resendEmailAuthOTP(emailData));
59
70
  };
60
71
  var onResendClick = function () {
@@ -87,6 +87,10 @@ var Connect = memo(function (props) {
87
87
  var activeScreen = data.activeScreen, isTapOrigin = data.isTapOrigin, open = data.open, merchant = data.merchant, appConfig = data.appConfig;
88
88
  React.useEffect(function () {
89
89
  initializeGTM();
90
+ sendPageView({
91
+ title: 'Connect',
92
+ connect_flow: 'Normal'
93
+ });
90
94
  if (props.leadId) {
91
95
  dispatch(storeLeadId(props.leadId));
92
96
  }
@@ -126,10 +130,6 @@ var Connect = memo(function (props) {
126
130
  event: 'PageView',
127
131
  website_country: (_c = data.businessCountry) === null || _c === void 0 ? void 0 : _c.iso2
128
132
  });
129
- sendPageView({
130
- title: 'Connect',
131
- connect_flow: 'Normal'
132
- });
133
133
  }
134
134
  }, [data.businessCountry]);
135
135
  var handleDialogClose = function () {
@@ -18,7 +18,7 @@ import { yupResolver } from '@hookform/resolvers/yup';
18
18
  import { civilIDValidationSchema } from './validation';
19
19
  import { useAppDispatch, useLanguage, useAppSelector, useSetFromDefaultValues } from '../../../../hooks';
20
20
  import { handleCurrentActiveScreen, handlePrevScreenStep, settingsSelector } from '../../../../app/settings';
21
- import { deepCopy } from '../../../../utils';
21
+ import { deepCopy, sendCustomEventToGTM } from '../../../../utils';
22
22
  import { clearError, connectSelector, createCivilIdAuth, resetMobileScreen, resetStore } from '../../../app/connect/connectStore';
23
23
  import Form from '../../../../components/Form';
24
24
  import Button, { MobileButton } from '../../../shared/Button';
@@ -84,6 +84,11 @@ var CivilID = function (_a) {
84
84
  dispatch(clearError());
85
85
  };
86
86
  var onBack = function () {
87
+ sendCustomEventToGTM({
88
+ event: 'Send Event',
89
+ event_category: 'User Registration Flow',
90
+ event_action: 'Switch to mobile number Login Clicked'
91
+ });
87
92
  dispatch(handlePrevScreenStep('CONNECT_MOBILE_STEP'));
88
93
  };
89
94
  var onBackToCountryList = function () {
@@ -67,7 +67,7 @@ import { store } from '../../app/store';
67
67
  import { connectExpressSelector, setIsLeadIdPassed, setLeadId, retrieveLeadIdentityByIdAsync, setDefaultCountryCode } from '../app/connectExpress/connectExpressStore';
68
68
  import { ReduxProvider, ThemeProvider } from '../../components/Providers';
69
69
  import Collapse from '../../components/Collapse';
70
- import { isKW, findOrCreateElementAndInject, sendPageView, isOtherThanKWOrSA, initializeGTM } from '../../utils';
70
+ import { isKW, findOrCreateElementAndInject, sendPageView, isOtherThanKWOrSA, initializeGTM, sendCustomEventToGTM, sendCustomDimension } from '../../utils';
71
71
  import { CONNECT_EXPRESS_SCREENS_NAVIGATION } from '../../constants';
72
72
  import { connectExpressFeatureScreens } from '../featuresScreens';
73
73
  import Background from '../shared/Background';
@@ -89,7 +89,11 @@ var ConnectExpress = memo(function (_a) {
89
89
  });
90
90
  }); };
91
91
  useAppConfig(__assign(__assign(__assign({ navigation: CONNECT_EXPRESS_SCREENS_NAVIGATION, maturity: 'express' }, props), { postURL: postURL, configToken: configToken }), (configToken && { onVerifyConfigTokenSuccess: onVerifyConfigTokenSuccess })));
92
- useErrorListener(connectExpressError || error);
92
+ useErrorListener(connectExpressError || error, {
93
+ event: 'Send Event',
94
+ event_category: 'User Registration Flow',
95
+ event_action: 'Registration Error'
96
+ });
93
97
  useStepStartedListener();
94
98
  var activeScreen = data.activeScreen, isTapOrigin = data.isTapOrigin, open = data.open, merchant = data.merchant, appConfig = data.appConfig;
95
99
  React.useEffect(function () {
@@ -100,9 +104,19 @@ var ConnectExpress = memo(function (_a) {
100
104
  });
101
105
  }, []);
102
106
  React.useEffect(function () {
103
- var _a;
107
+ var _a, _b, _c;
104
108
  if (!!((_a = data.businessCountry) === null || _a === void 0 ? void 0 : _a.iso2)) {
105
109
  dispatch(setDefaultCountryCode(data.businessCountry));
110
+ sendCustomEventToGTM({
111
+ event: 'Send Event',
112
+ event_category: 'User Registration Flow',
113
+ event_action: 'Registration Landing Page Viewed',
114
+ event_label: (_b = data.businessCountry) === null || _b === void 0 ? void 0 : _b.iso2
115
+ });
116
+ sendCustomDimension({
117
+ event: 'PageView',
118
+ website_country: (_c = data.businessCountry) === null || _c === void 0 ? void 0 : _c.iso2
119
+ });
106
120
  }
107
121
  }, [data.businessCountry]);
108
122
  React.useEffect(function () {
@@ -27,7 +27,7 @@ import Box from '@mui/material/Box';
27
27
  import Divider from '@mui/material/Divider';
28
28
  import Text from '../../../../components/Text';
29
29
  import IDNumber from './IDNumber';
30
- import { deepCopy } from '../../../../utils';
30
+ import { deepCopy, sendCustomEventToGTM } from '../../../../utils';
31
31
  var FormStyled = styled(Form)(function () { return ({
32
32
  display: 'flex',
33
33
  flexDirection: 'column'
@@ -79,6 +79,11 @@ var CivilID = function (_a) {
79
79
  dispatch(createCivilIdAuthAsync(deepCopy(data)));
80
80
  };
81
81
  var onBack = function () {
82
+ sendCustomEventToGTM({
83
+ event: 'Send Event',
84
+ event_category: 'User Registration Flow',
85
+ event_action: 'Switch to mobile number Login Clicked'
86
+ });
82
87
  dispatch(handlePrevScreenStep());
83
88
  };
84
89
  var onBackToCountryList = function () {
@@ -15,7 +15,7 @@ import { useForm, FormProvider } from 'react-hook-form';
15
15
  import { useTranslation } from 'react-i18next';
16
16
  import { yupResolver } from '@hookform/resolvers/yup';
17
17
  import { useAppDispatch, useAppSelector, useSetFromDefaultValues, useLanguage, useFormReadOnly, useFormErrorAndUpdateReadOnly, useExcludeReadOnlyFelids } from '../../../../hooks';
18
- import { deepCopy, isKW, isSA } from '../../../../utils';
18
+ import { deepCopy, isKW, isSA, sendCustomEventToGTM } from '../../../../utils';
19
19
  import { handlePrevScreenStep, settingsSelector } from '../../../../app/settings';
20
20
  import Form from '../../../../components/Form';
21
21
  import Collapse from '../../../../components/Collapse';
@@ -60,6 +60,13 @@ var CollectBusinessInfo = function (_a) {
60
60
  var originalReadOnly = useFormReadOnly(methods);
61
61
  var readOnly = useFormErrorAndUpdateReadOnly(methods, originalReadOnly);
62
62
  var getFelids = useExcludeReadOnlyFelids(methods, readOnly).getFelids;
63
+ React.useEffect(function () {
64
+ sendCustomEventToGTM({
65
+ event: 'Send Event',
66
+ event_category: 'User Registration Flow',
67
+ event_action: 'Business License Details Step'
68
+ });
69
+ }, []);
63
70
  React.useEffect(function () {
64
71
  if (error)
65
72
  dispatch(clearError());
@@ -18,7 +18,7 @@ import { styled } from '@mui/material/styles';
18
18
  import { useAppDispatch, useAppSelector, useExcludeReadOnlyFelids, useFormErrorAndUpdateReadOnly, useFormReadOnly, useSetFromDefaultValues } from '../../../../hooks';
19
19
  import { AuthForType } from '../../../../@types';
20
20
  import { useLanguage } from '../../../../hooks';
21
- import { deepCopy, isKW } from '../../../../utils';
21
+ import { deepCopy, isKW, sendCustomEventToGTM } from '../../../../utils';
22
22
  import { handlePrevScreenStep, settingsSelector } from '../../../../app/settings';
23
23
  import Form from '../../../../components/Form';
24
24
  import Collapse from '../../../../components/Collapse';
@@ -59,6 +59,13 @@ var CollectIndividualInfo = function (_a) {
59
59
  var originalReadOnly = useFormReadOnly(methods);
60
60
  var readOnly = useFormErrorAndUpdateReadOnly(methods, originalReadOnly);
61
61
  var getFelids = useExcludeReadOnlyFelids(methods, readOnly).getFelids;
62
+ React.useEffect(function () {
63
+ sendCustomEventToGTM({
64
+ event: 'Send Event',
65
+ event_category: 'User Registration Flow',
66
+ event_action: 'Name and Email Page Viewed'
67
+ });
68
+ }, []);
62
69
  React.useEffect(function () {
63
70
  if (countryCode.iso2 !== methods.getValues('countryCode.iso2'))
64
71
  methods.setValue('countryCode', countryCode);
@@ -15,7 +15,7 @@ import { styled } from '@mui/material/styles';
15
15
  import * as React from 'react';
16
16
  import { useTranslation } from 'react-i18next';
17
17
  import Text from '../../../../components/Text';
18
- import { clearError, connectExpressSelector, verifyMobileOtpAsync, resetOTPValue, verifyNIDOtpLeadIdentityAsync } from '../../../app/connectExpress/connectExpressStore';
18
+ import { clearError, connectExpressSelector, resetOTPValue, verifyNIDOtpLeadIdentityAsync } from '../../../app/connectExpress/connectExpressStore';
19
19
  import Button from '../../../shared/Button';
20
20
  import { ScreenContainer } from '../../../shared/Containers';
21
21
  import { useAppDispatch, useAppSelector } from '../../../../hooks';
@@ -25,7 +25,7 @@ import { AuthForType } from '../../../../@types';
25
25
  import { useForm, FormProvider } from 'react-hook-form';
26
26
  import { yupResolver } from '@hookform/resolvers/yup';
27
27
  import Form from '../../../../components/Form';
28
- import { maskPhone, maskID, deepCopy } from '../../../../utils';
28
+ import { maskPhone, maskID, deepCopy, sendCustomEventToGTM } from '../../../../utils';
29
29
  import { OTPValidation } from './validation';
30
30
  import OTPInput from './OTPInput';
31
31
  var OTPTitleContainerStyled = styled(Box)(function (_a) {
@@ -64,16 +64,17 @@ var OTP = function () {
64
64
  dispatch(clearError());
65
65
  }, [methods.formState.isValid]);
66
66
  React.useEffect(function () {
67
+ sendCustomEventToGTM({
68
+ event: 'Send Event',
69
+ event_category: 'User Registration Flow',
70
+ event_action: 'Absher OTP Page Viewed'
71
+ });
67
72
  return function () {
68
73
  dispatch(resetOTPValue());
69
74
  };
70
75
  }, []);
71
76
  var onSubmit = function (formData) {
72
- if (isNidAuth) {
73
- dispatch(verifyNIDOtpLeadIdentityAsync(deepCopy(formData)));
74
- return;
75
- }
76
- dispatch(verifyMobileOtpAsync(deepCopy(formData)));
77
+ dispatch(verifyNIDOtpLeadIdentityAsync(deepCopy(formData)));
77
78
  };
78
79
  var onBack = function () {
79
80
  dispatch(handlePrevScreenStep());
@@ -17,9 +17,9 @@ import Box from '@mui/material/Box/Box';
17
17
  import { styled } from '@mui/material/styles';
18
18
  import OTPField from '../../../shared/OTP';
19
19
  import { DEFAULT_TIMER_VALUE } from '../../../../constants';
20
- import { AuthForType } from '../../../../@types';
21
20
  import { resendNIDAuthIdentityOTP, connectExpressSelector, clearError } from '../../../app/connectExpress/connectExpressStore';
22
21
  import { useAppDispatch, useAppSelector } from '../../../../hooks';
22
+ import { sendCustomEventToGTM } from '../../../../utils';
23
23
  var BoxStyled = styled(Box)(function (_a) {
24
24
  var theme = _a.theme;
25
25
  return ({
@@ -35,20 +35,22 @@ var OTPInput = function (_a) {
35
35
  var otpControl = useController({ name: 'otp', control: control });
36
36
  var _c = useAppSelector(connectExpressSelector), data = _c.data, error = _c.error;
37
37
  var nidData = data.nidData;
38
- var isNidAuth = data.otpData.authFor === AuthForType.NATIONAL_ID_MISSED;
39
38
  var handleOnOTPChange = function (otp) {
40
39
  if (error)
41
40
  dispatch(clearError());
42
41
  otpControl.field.onChange(otp);
43
42
  };
44
- var handleOnResendOTP = function () {
45
- };
46
43
  var handleOnResendAbsherOTP = function () {
47
44
  if (otpControl.field.value)
48
45
  setValue('otp', '', { shouldValidate: true });
46
+ sendCustomEventToGTM({
47
+ event: 'Send Event',
48
+ event_category: 'User Registration Flow',
49
+ event_action: 'Another Absher OTP asked'
50
+ });
49
51
  dispatch(resendNIDAuthIdentityOTP(nidData));
50
52
  };
51
53
  var otpValue = otpControl.field.value;
52
- return (_jsx(BoxStyled, __assign({ dir: 'ltr' }, { children: _jsx(OTPField, { timeEndLabel: t('ide_otp_resend_label'), timerInSeconds: DEFAULT_TIMER_VALUE, onResetClick: isNidAuth ? handleOnResendAbsherOTP : handleOnResendOTP, value: otpValue, onChange: function (number) { return handleOnOTPChange(number.toString()); } }) })));
54
+ return (_jsx(BoxStyled, __assign({ dir: 'ltr' }, { children: _jsx(OTPField, { timeEndLabel: t('ide_otp_resend_label'), timerInSeconds: DEFAULT_TIMER_VALUE, onResetClick: handleOnResendAbsherOTP, value: otpValue, onChange: function (number) { return handleOnOTPChange(number.toString()); } }) })));
53
55
  };
54
56
  export default React.memo(OTPInput);
@@ -29,7 +29,7 @@ import Text from '../../../../components/Text';
29
29
  import IDNumber from './IDNumber';
30
30
  import DOB from './DOB';
31
31
  import TAC from './TAC';
32
- import { deepCopy } from '../../../../utils';
32
+ import { deepCopy, sendCustomEventToGTM } from '../../../../utils';
33
33
  var FormStyled = styled(Form)(function () { return ({
34
34
  display: 'flex',
35
35
  flexDirection: 'column'
@@ -84,6 +84,11 @@ var NID = function (_a) {
84
84
  setCollapse(flag);
85
85
  };
86
86
  var onBack = function () {
87
+ sendCustomEventToGTM({
88
+ event: 'Send Event',
89
+ event_category: 'User Registration Flow',
90
+ event_action: 'Switch to mobile number Login Clicked'
91
+ });
87
92
  dispatch(handlePrevScreenStep());
88
93
  };
89
94
  var onBackToCountryList = function () {
@@ -25,7 +25,7 @@ import { AuthForType } from '../../../../@types';
25
25
  import { useForm, FormProvider } from 'react-hook-form';
26
26
  import { yupResolver } from '@hookform/resolvers/yup';
27
27
  import Form from '../../../../components/Form';
28
- import { maskPhone, maskID, deepCopy } from '../../../../utils';
28
+ import { maskPhone, maskID, deepCopy, sendCustomEventToGTM } from '../../../../utils';
29
29
  import { OTPValidation } from './validation';
30
30
  import OTPInput from './OTPInput';
31
31
  var OTPTitleContainerStyled = styled(Box)(function (_a) {
@@ -64,6 +64,11 @@ var OTP = function () {
64
64
  dispatch(clearError());
65
65
  }, [methods.formState.isValid]);
66
66
  React.useEffect(function () {
67
+ sendCustomEventToGTM({
68
+ event: 'Send Event',
69
+ event_category: 'User Registration Flow',
70
+ event_action: 'First OTP Page Viewed'
71
+ });
67
72
  return function () {
68
73
  dispatch(resetOTPValue());
69
74
  };
@@ -20,6 +20,7 @@ import { DEFAULT_TIMER_VALUE } from '../../../../constants';
20
20
  import { AuthForType } from '../../../../@types';
21
21
  import { resendMobileAuthOTP, resendNIDAuthOTP, connectExpressSelector, clearError } from '../../../app/connectExpress/connectExpressStore';
22
22
  import { useAppDispatch, useAppSelector } from '../../../../hooks';
23
+ import { sendCustomEventToGTM } from '../../../../utils';
23
24
  var BoxStyled = styled(Box)(function (_a) {
24
25
  var theme = _a.theme;
25
26
  return ({
@@ -34,8 +35,15 @@ var OTPInput = function (_a) {
34
35
  var dispatch = useAppDispatch();
35
36
  var otpControl = useController({ name: 'otp', control: control });
36
37
  var _c = useAppSelector(connectExpressSelector), data = _c.data, error = _c.error;
37
- var mobileData = data.mobileData, nidData = data.nidData, responseData = data.responseData;
38
+ var mobileData = data.mobileData, nidData = data.nidData;
38
39
  var isNidAuth = data.otpData.authFor === AuthForType.NATIONAL_ID;
40
+ var sendEventAskAnotherOTP = function () {
41
+ sendCustomEventToGTM({
42
+ event: 'Send Event',
43
+ event_category: 'User Registration Flow',
44
+ event_action: 'Another OTP asked'
45
+ });
46
+ };
39
47
  var handleOnOTPChange = function (otp) {
40
48
  if (error)
41
49
  dispatch(clearError());
@@ -44,11 +52,13 @@ var OTPInput = function (_a) {
44
52
  var handleOnResendOTP = function () {
45
53
  if (otpControl.field.value)
46
54
  setValue('otp', '', { shouldValidate: true });
55
+ sendEventAskAnotherOTP();
47
56
  dispatch(resendMobileAuthOTP(mobileData));
48
57
  };
49
58
  var handleOnResendAbsherOTP = function () {
50
59
  if (otpControl.field.value)
51
60
  setValue('otp', '', { shouldValidate: true });
61
+ sendEventAskAnotherOTP();
52
62
  dispatch(resendNIDAuthOTP(nidData));
53
63
  };
54
64
  var otpValue = otpControl.field.value;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "2.8.51-development",
3
+ "version": "2.8.52-development",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",