@tap-payments/auth-jsconnect 2.12.12-development → 2.12.14-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.
@@ -236,6 +236,7 @@ export interface LibConfig extends LibCallbacks {
236
236
  closeButton?: boolean;
237
237
  disableNafath?: boolean;
238
238
  disablePaci?: boolean;
239
+ emailAuth?: boolean;
239
240
  dialogStartTransition?: 'left' | 'right' | 'up' | 'down';
240
241
  dialogEndTransition?: 'left' | 'right' | 'up' | 'down';
241
242
  };
@@ -61,7 +61,7 @@ import { FlowsTypes, AuthForType, BusinessType, LicenseType, AuthForScreen } fro
61
61
  import API, { setAuthSessionToGlobalHeaders } from '../../../api';
62
62
  import { ADD_NEW_ENTITY, COLLECT_DOB_INFO_NAFATH, CONNECT_EXPRESS_STEP_NAMES, IDENTIFICATION_TYPE, NAFATH_PACI_TIMEOUT_DURATION, NAFATH_VERIFICATION_FAILED, OTHER_CR_LICENSE, OTHER_FL_LICENSE, SCOPE_AUTH, SCOPE_MERCHANT } from '../../../constants';
63
63
  import { defaultCountry } from '../../../constants';
64
- import { getIndividualName, capitalizeTheFirstLetterOfEachWord, sleep, findCountryByIddPrefix, concatenateObjectValues, isSA, isKW, isQA, isOtherThanKWOrSA, sendCustomEventToGTM, sendCustomDimension, getMetaData, isNetworkError, isTimeoutError, isInternalServerError, isAuthenticationVerificationFailed } from '../../../utils';
64
+ import { getIndividualName, capitalizeTheFirstLetterOfEachWord, sleep, findCountryByIddPrefix, concatenateObjectValues, isSA, isKW, isEmailAuthEnabled, isOtherThanKWOrSA, sendCustomEventToGTM, sendCustomDimension, getMetaData, isNetworkError, isTimeoutError, isInternalServerError, isAuthenticationVerificationFailed } 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) {
@@ -81,17 +81,17 @@ export var updateBusinessCountryAsync = createAsyncThunk('connectExpress/updateB
81
81
  });
82
82
  }); });
83
83
  export var retrieveLeadIdentityByIdAsync = createAsyncThunk('expressConnect/retrieveLeadIdentityByIdAsync', function (leadId, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
84
- var settings, countryCode, showBoard, data, _a, country_code, contact, phone, status, board_id, board_info_id, isRegistered, screen_1, screen_2, _b, boardInfo, boardData, error_1;
85
- var _c, _d, _e, _f, _g, _h;
86
- return __generator(this, function (_j) {
87
- switch (_j.label) {
84
+ var settings, countryCode, showBoard, data, _a, country_code, contact, phone, status, board_id, board_info_id, emailAuth, isRegistered, screen_1, screen_2, _b, boardInfo, boardData, error_1;
85
+ var _c, _d, _e, _f, _g, _h, _j;
86
+ return __generator(this, function (_k) {
87
+ switch (_k.label) {
88
88
  case 0:
89
89
  settings = thunkApi.getState().settings;
90
90
  countryCode = settings.data.businessCountry;
91
91
  showBoard = settings.data.appConfig.showBoard;
92
92
  return [4, API.leadService.retrieveLeadIdentity(leadId)];
93
93
  case 1:
94
- data = _j.sent();
94
+ data = _k.sent();
95
95
  _a = data || {}, country_code = _a.country_code, contact = _a.contact;
96
96
  if (country_code)
97
97
  thunkApi.dispatch(handleSetCountryByIso2(country_code));
@@ -103,20 +103,23 @@ export var retrieveLeadIdentityByIdAsync = createAsyncThunk('expressConnect/retr
103
103
  thunkApi.dispatch(handleCurrentActiveScreen('CONNECT_EXPRESS_BUSINESS_COUNTRY_STEP'));
104
104
  return [2, { data: data, countryCode: countryCode }];
105
105
  }
106
+ emailAuth = (_d = settings.data.appConfig.features) === null || _d === void 0 ? void 0 : _d.emailAuth;
106
107
  isRegistered = (status === null || status === void 0 ? void 0 : status.toLowerCase()) === 'registered';
107
108
  if (!isRegistered && !(data === null || data === void 0 ? void 0 : data.identification) && phone) {
108
- screen_1 = isQA(country_code || ((_d = settings.data.businessCountry) === null || _d === void 0 ? void 0 : _d.iso2)) ? 'CONNECT_EXPRESS_EMAIL_STEP' : 'CONNECT_EXPRESS_MOBILE_STEP';
109
+ screen_1 = isEmailAuthEnabled(emailAuth, country_code || ((_e = settings.data.businessCountry) === null || _e === void 0 ? void 0 : _e.iso2))
110
+ ? 'CONNECT_EXPRESS_EMAIL_STEP'
111
+ : 'CONNECT_EXPRESS_MOBILE_STEP';
109
112
  thunkApi.dispatch(handleCurrentActiveScreen(screen_1));
110
113
  return [2, { data: data, countryCode: countryCode }];
111
114
  }
112
115
  if (!isRegistered && country_code) {
113
116
  screen_2 = 'CONNECT_EXPRESS_NID_STEP';
114
117
  if (!isSA(data.country_code))
115
- screen_2 = isQA(data.country_code) ? 'CONNECT_EXPRESS_EMAIL_STEP' : 'CONNECT_EXPRESS_MOBILE_STEP';
118
+ screen_2 = isEmailAuthEnabled(emailAuth, data.country_code) ? 'CONNECT_EXPRESS_EMAIL_STEP' : 'CONNECT_EXPRESS_MOBILE_STEP';
116
119
  thunkApi.dispatch(handleCurrentActiveScreen(screen_2));
117
120
  return [2, { data: data, countryCode: countryCode }];
118
121
  }
119
- if (!isRegistered && isQA(settings.data.businessCountry.iso2)) {
122
+ if (!isRegistered && isEmailAuthEnabled(emailAuth, settings.data.businessCountry.iso2)) {
120
123
  thunkApi.dispatch(handleCurrentActiveScreen('CONNECT_EXPRESS_EMAIL_STEP'));
121
124
  return [2, { data: data, countryCode: countryCode }];
122
125
  }
@@ -128,11 +131,11 @@ export var retrieveLeadIdentityByIdAsync = createAsyncThunk('expressConnect/retr
128
131
  thunkApi.dispatch(handleCurrentActiveScreen('CONNECT_EXPRESS_NID_STEP'));
129
132
  return [2, { data: data, countryCode: countryCode }];
130
133
  }
131
- if ((_e = data === null || data === void 0 ? void 0 : data.identification) === null || _e === void 0 ? void 0 : _e.authentication_id) {
132
- thunkApi.dispatch(storeAuthId((_f = data === null || data === void 0 ? void 0 : data.identification) === null || _f === void 0 ? void 0 : _f.authentication_id));
134
+ if ((_f = data === null || data === void 0 ? void 0 : data.identification) === null || _f === void 0 ? void 0 : _f.authentication_id) {
135
+ thunkApi.dispatch(storeAuthId((_g = data === null || data === void 0 ? void 0 : data.identification) === null || _g === void 0 ? void 0 : _g.authentication_id));
133
136
  }
134
137
  if (isRegistered && !showBoard) {
135
- (_h = (_g = settings.data.appConfig).onFlowCompleted) === null || _h === void 0 ? void 0 : _h.call(_g, data);
138
+ (_j = (_h = settings.data.appConfig).onFlowCompleted) === null || _j === void 0 ? void 0 : _j.call(_h, data);
136
139
  thunkApi.dispatch(handleCurrentActiveScreen('CONNECT_EXPRESS_ACCOUNT_ALREADY_CREATED_STEP'));
137
140
  return [2, { data: data, countryCode: countryCode }];
138
141
  }
@@ -141,19 +144,19 @@ export var retrieveLeadIdentityByIdAsync = createAsyncThunk('expressConnect/retr
141
144
  return [2, { data: data, countryCode: countryCode }];
142
145
  }
143
146
  if (!(isRegistered && board_id && board_info_id)) return [3, 5];
144
- _j.label = 2;
147
+ _k.label = 2;
145
148
  case 2:
146
- _j.trys.push([2, 4, , 5]);
149
+ _k.trys.push([2, 4, , 5]);
147
150
  return [4, Promise.all([
148
151
  API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id }),
149
152
  API.boardService.retrieveBoardDetails(board_id)
150
153
  ])];
151
154
  case 3:
152
- _b = _j.sent(), boardInfo = _b[0], boardData = _b[1];
155
+ _b = _k.sent(), boardInfo = _b[0], boardData = _b[1];
153
156
  thunkApi.dispatch(handleCurrentActiveScreen('CONNECT_EXPRESS_SUCCESS_WITH_FLOW_BUTTONS_STEP'));
154
157
  return [2, { data: data, countryCode: countryCode, boardInfo: boardInfo, boardData: boardData }];
155
158
  case 4:
156
- error_1 = _j.sent();
159
+ error_1 = _k.sent();
157
160
  thunkApi.dispatch(handleCurrentActiveScreen('CONNECT_EXPRESS_ACCOUNT_ALREADY_CREATED_STEP'));
158
161
  return [2, { data: data, countryCode: countryCode }];
159
162
  case 5: return [2, { data: data, countryCode: countryCode }];
@@ -67,7 +67,7 @@ import { store } from '../../app/store';
67
67
  import { connectExpressSelector, setIsLeadIdPassed, setLeadId, retrieveLeadIdentityByIdAsync, setDefaultCountryCode, clearError, createAuthSessionExpiredAsync } from '../app/connectExpress/connectExpressStore';
68
68
  import { ReduxProvider, ThemeProvider } from '../../components/Providers';
69
69
  import Collapse from '../../components/Collapse';
70
- import { isKW, isQA, findOrCreateElementAndInject, sendPageView, isOtherThanKWOrSA, initializeGTM, sendCustomEventToGTM, sendCustomDimension } from '../../utils';
70
+ import { isKW, isEmailAuthEnabled, 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';
@@ -123,7 +123,7 @@ var ConnectExpress = memo(function (_a) {
123
123
  }
124
124
  }, [data.businessCountry]);
125
125
  React.useEffect(function () {
126
- var _a, _b, _c;
126
+ var _a, _b, _c, _d;
127
127
  if (settingLoading || !props.open)
128
128
  return;
129
129
  if (!data.isValidOperator) {
@@ -146,10 +146,10 @@ var ConnectExpress = memo(function (_a) {
146
146
  dispatch(handleCurrentActiveScreen('CONNECT_EXPRESS_BUSINESS_COUNTRY_STEP'));
147
147
  return;
148
148
  }
149
- if (((_b = data.businessCountry) === null || _b === void 0 ? void 0 : _b.iso2) && isQA(data.businessCountry.iso2)) {
149
+ if (((_b = data.businessCountry) === null || _b === void 0 ? void 0 : _b.iso2) && isEmailAuthEnabled((_c = appConfig.features) === null || _c === void 0 ? void 0 : _c.emailAuth, data.businessCountry.iso2)) {
150
150
  dispatch(handleCurrentActiveScreen('CONNECT_EXPRESS_EMAIL_STEP'));
151
151
  }
152
- else if (((_c = data.businessCountry) === null || _c === void 0 ? void 0 : _c.iso2) && (isKW(data.businessCountry.iso2) || isOtherThanKWOrSA(data.businessCountry.iso2))) {
152
+ else if (((_d = data.businessCountry) === null || _d === void 0 ? void 0 : _d.iso2) && (isKW(data.businessCountry.iso2) || isOtherThanKWOrSA(data.businessCountry.iso2))) {
153
153
  dispatch(handleCurrentActiveScreen('CONNECT_EXPRESS_MOBILE_STEP'));
154
154
  }
155
155
  }, [data.isValidOperator, settingLoading]);
@@ -15,7 +15,7 @@ import { useForm, FormProvider } from 'react-hook-form';
15
15
  import { useTranslation } from 'react-i18next';
16
16
  import Collapse from '@mui/material/Collapse';
17
17
  import { yupResolver } from '@hookform/resolvers/yup';
18
- import { useAppDispatch, useAppSelector } from '../../../../hooks';
18
+ import { useAppDispatch, useAppSelector, useIsEmailAuth } from '../../../../hooks';
19
19
  import { handlePrevScreenStep, settingsSelector } from '../../../../app/settings';
20
20
  import { deepCopy, isKW, isSA, sendCustomEventToGTM } from '../../../../utils';
21
21
  import { AuthForType } from '../../../../@types';
@@ -45,7 +45,7 @@ var AuthenticationList = function (_a) {
45
45
  var _g = React.useState(false), isAddEntity = _g[0], setIsAddEntity = _g[1];
46
46
  var otpData = data.otpData;
47
47
  var startWithNID = otpData.authFor === AuthForType.NATIONAL_ID;
48
- var startWithEmail = otpData.authFor === AuthForType.EMAIL;
48
+ var startWithEmail = useIsEmailAuth();
49
49
  React.useEffect(function () {
50
50
  sendCustomEventToGTM({
51
51
  event: 'Send Event',
@@ -53,7 +53,7 @@ import { ScreenContainer } from '../../../shared/Containers';
53
53
  import BusinessCountry from '../../../shared/BusinessCountry';
54
54
  import Button from '../../../shared/Button';
55
55
  import Collapse from '../../../../components/Collapse';
56
- import { findCountryByIso2, isKW, isQA, isOtherThanKWOrSA, sendCustomEventToGTM } from '../../../../utils';
56
+ import { findCountryByIso2, isKW, isEmailAuthEnabled, isOtherThanKWOrSA, sendCustomEventToGTM } from '../../../../utils';
57
57
  import { handleNextScreenStep, handleSetCountryByIso2, settingsSelector } from '../../../../app/settings';
58
58
  import { clearError, connectExpressSelector, setDefaultCountryCode, storeIsStartFromBusinessCountry, updateBusinessCountryAsync } from '../../../app/connectExpress/connectExpressStore';
59
59
  var BusinessCountryScreen = function (_a) {
@@ -74,8 +74,9 @@ var BusinessCountryScreen = function (_a) {
74
74
  }, [settingsData.businessCountry, settingsData.ipCountry]);
75
75
  var onSelectCountry = function (iso2) { return __awaiter(void 0, void 0, void 0, function () {
76
76
  var countryCode;
77
- return __generator(this, function (_a) {
78
- switch (_a.label) {
77
+ var _a;
78
+ return __generator(this, function (_b) {
79
+ switch (_b.label) {
79
80
  case 0:
80
81
  if (!iso2)
81
82
  return [2];
@@ -90,12 +91,12 @@ var BusinessCountryScreen = function (_a) {
90
91
  if (!data.leadId) return [3, 2];
91
92
  return [4, dispatch(updateBusinessCountryAsync(iso2))];
92
93
  case 1:
93
- _a.sent();
94
- _a.label = 2;
94
+ _b.sent();
95
+ _b.label = 2;
95
96
  case 2:
96
97
  if (countryCode)
97
98
  dispatch(setDefaultCountryCode(countryCode));
98
- if (isQA(iso2)) {
99
+ if (isEmailAuthEnabled((_a = settingsData.appConfig.features) === null || _a === void 0 ? void 0 : _a.emailAuth, iso2)) {
99
100
  dispatch(handleNextScreenStep('CONNECT_EXPRESS_EMAIL_STEP'));
100
101
  return [2];
101
102
  }
@@ -17,7 +17,7 @@ import { yupResolver } from '@hookform/resolvers/yup';
17
17
  import { styled } from '@mui/material/styles';
18
18
  import { useAppDispatch, useAppSelector, useExcludeReadOnlyFelids, useFormErrorAndUpdateReadOnly, useFormReadOnly, useSetFromDefaultValues } from '../../../../hooks';
19
19
  import { AuthForType } from '../../../../@types';
20
- import { useLanguage } from '../../../../hooks';
20
+ import { useLanguage, useIsEmailAuth } from '../../../../hooks';
21
21
  import { deepCopy, isKW, sendCustomEventToGTM } from '../../../../utils';
22
22
  import { handlePrevScreenStep, settingsSelector } from '../../../../app/settings';
23
23
  import Form from '../../../../components/Form';
@@ -45,7 +45,7 @@ var CollectIndividualInfo = function (_a) {
45
45
  var t = useTranslation().t;
46
46
  var isAr = useLanguage().isAr;
47
47
  var individualData = data.individualData, otpData = data.otpData, responseData = data.responseData;
48
- var startWithEmail = otpData.authFor === AuthForType.EMAIL;
48
+ var startWithEmail = useIsEmailAuth();
49
49
  var startWithNID = otpData.authFor === AuthForType.NATIONAL_ID;
50
50
  var startWithNIDMissed = otpData.authFor === AuthForType.NATIONAL_ID_MISSED;
51
51
  var contact = ((responseData === null || responseData === void 0 ? void 0 : responseData.leadData) || {}).contact;
@@ -16,13 +16,12 @@ import { styled } from '@mui/material/styles';
16
16
  import { useForm, FormProvider } from 'react-hook-form';
17
17
  import { yupResolver } from '@hookform/resolvers/yup';
18
18
  import { NIDOtherCountryValidationSchema, NIDValidationSchema } from './validation';
19
- import { useAppDispatch, useLanguage, useAppSelector } from '../../../../hooks';
19
+ import { useAppDispatch, useLanguage, useAppSelector, useIsEmailAuth } from '../../../../hooks';
20
20
  import { handlePrevScreenStep, settingsSelector } from '../../../../app/settings';
21
21
  import { clearError, connectExpressSelector, createNIDNafathAuthIdentityAsync } from '../../../app/connectExpress/connectExpressStore';
22
22
  import Form from '../../../../components/Form';
23
23
  import Button from '../../../shared/Button';
24
24
  import { ScreenContainer } from '../../../shared/Containers';
25
- import { AuthForType } from '../../../../@types';
26
25
  import Collapse from '../../../../components/Collapse';
27
26
  import IDNumber from './IDNumber';
28
27
  import DOB from './DOB';
@@ -39,7 +38,7 @@ var NID = function (_a) {
39
38
  var settingsData = useAppSelector(settingsSelector).data;
40
39
  var _c = useAppSelector(connectExpressSelector), data = _c.data, loading = _c.loading, error = _c.error;
41
40
  var isOtherCountry = React.useMemo(function () { return isOtherThanKWOrSA(settingsData.businessCountry.iso2); }, [settingsData.businessCountry.iso2]);
42
- var startWithEmail = data.otpData.authFor === AuthForType.EMAIL;
41
+ var startWithEmail = useIsEmailAuth();
43
42
  var methods = useForm({
44
43
  resolver: yupResolver(isOtherCountry ? NIDOtherCountryValidationSchema : NIDValidationSchema),
45
44
  defaultValues: data.nidData,
@@ -17,14 +17,13 @@ import Text from '../../../../components/Text';
17
17
  import { clearError, connectExpressSelector, verifyMobileOtpAsync, verifyEmailOtpAsync, resetOTPValue } from '../../../app/connectExpress/connectExpressStore';
18
18
  import Button from '../../../shared/Button';
19
19
  import { ScreenContainer } from '../../../shared/Containers';
20
- import { useAppDispatch, useAppSelector, useSanitizedTranslation } from '../../../../hooks';
20
+ import { useAppDispatch, useAppSelector, useSanitizedTranslation, useIsEmailAuth } from '../../../../hooks';
21
21
  import { handlePrevScreenStep } from '../../../../app/settings';
22
22
  import { useLanguage } from '../../../../hooks';
23
23
  import { useForm, FormProvider } from 'react-hook-form';
24
24
  import { yupResolver } from '@hookform/resolvers/yup';
25
25
  import Form from '../../../../components/Form';
26
26
  import { maskPhone, deepCopy, sendCustomEventToGTM, maskEmail } from '../../../../utils';
27
- import { AuthForType } from '../../../../@types';
28
27
  import { OTPValidation } from './validation';
29
28
  import OTPInput from './OTPInput';
30
29
  var OTPTitleContainerStyled = styled(Box)(function (_a) {
@@ -52,7 +51,7 @@ var OTP = function () {
52
51
  var _b = useAppSelector(connectExpressSelector), data = _b.data, loading = _b.loading, error = _b.error;
53
52
  var st = useSanitizedTranslation();
54
53
  var isAr = useLanguage().isAr;
55
- var isStartWithEmail = data.otpData.authFor === AuthForType.EMAIL;
54
+ var isEmailFlow = useIsEmailAuth();
56
55
  var methods = useForm({
57
56
  resolver: yupResolver(OTPValidation),
58
57
  defaultValues: data.otpData,
@@ -73,7 +72,7 @@ var OTP = function () {
73
72
  };
74
73
  }, []);
75
74
  var onSubmit = function (formData) {
76
- if (isStartWithEmail) {
75
+ if (isEmailFlow) {
77
76
  dispatch(verifyEmailOtpAsync(deepCopy(formData)));
78
77
  }
79
78
  else {
@@ -81,11 +80,10 @@ var OTP = function () {
81
80
  }
82
81
  };
83
82
  var onBack = function () {
84
- var screen = isStartWithEmail ? 'CONNECT_EXPRESS_EMAIL_STEP' : 'CONNECT_EXPRESS_MOBILE_STEP';
83
+ var screen = isEmailFlow ? 'CONNECT_EXPRESS_EMAIL_STEP' : 'CONNECT_EXPRESS_MOBILE_STEP';
85
84
  dispatch(handlePrevScreenStep(screen));
86
85
  };
87
86
  var disabled = !methods.formState.isValid;
88
- var isEmailFlow = data.otpData.authFor === AuthForType.EMAIL;
89
87
  var phone = data.mobileData.mobile ? ((_a = data.mobileData.countryCode) === null || _a === void 0 ? void 0 : _a.idd_prefix) + data.mobileData.mobile : '';
90
88
  var contactInfo = isEmailFlow ? maskEmail(data.emailData.email) : maskPhone(phone);
91
89
  var title = isEmailFlow ? st('otp_email_sent_title') : st('ide_opt_sent_title');
@@ -18,9 +18,8 @@ import { styled } from '@mui/material/styles';
18
18
  import OTPField from '../../../shared/OTP';
19
19
  import { DEFAULT_TIMER_VALUE } from '../../../../constants';
20
20
  import { resendMobileAuthOTP, resendEmailAuthOTP, connectExpressSelector, clearError } from '../../../app/connectExpress/connectExpressStore';
21
- import { useAppDispatch, useAppSelector } from '../../../../hooks';
21
+ import { useAppDispatch, useAppSelector, useIsEmailAuth } from '../../../../hooks';
22
22
  import { sendCustomEventToGTM } from '../../../../utils';
23
- import { AuthForType } from '../../../../@types';
24
23
  var BoxStyled = styled(Box)(function (_a) {
25
24
  var theme = _a.theme;
26
25
  return ({
@@ -35,8 +34,8 @@ var OTPInput = function (_a) {
35
34
  var dispatch = useAppDispatch();
36
35
  var otpControl = useController({ name: 'otp', control: control });
37
36
  var _c = useAppSelector(connectExpressSelector), data = _c.data, error = _c.error;
38
- var mobileData = data.mobileData, emailData = data.emailData, otpData = data.otpData;
39
- var isEmailFlow = otpData.authFor === AuthForType.EMAIL;
37
+ var mobileData = data.mobileData, emailData = data.emailData;
38
+ var isEmailFlow = useIsEmailAuth();
40
39
  var sendEventAskAnotherOTP = function () {
41
40
  sendCustomEventToGTM({
42
41
  event: 'Send Event',
@@ -15,6 +15,7 @@ export * from './useSetFromDefaultValues';
15
15
  export * from './useCountUp';
16
16
  export * from './useCountDown';
17
17
  export * from './useCountry';
18
+ export * from './useIsEmailAuth';
18
19
  export * from './useVerifyToken';
19
20
  export * from './useFormReadOnly';
20
21
  export * from './useDataNoneEditable';
@@ -15,6 +15,7 @@ export * from './useSetFromDefaultValues';
15
15
  export * from './useCountUp';
16
16
  export * from './useCountDown';
17
17
  export * from './useCountry';
18
+ export * from './useIsEmailAuth';
18
19
  export * from './useVerifyToken';
19
20
  export * from './useFormReadOnly';
20
21
  export * from './useDataNoneEditable';
@@ -31,7 +31,7 @@ export var useAppConfig = function (_a) {
31
31
  var data = useAppSelector(settingsSelector).data;
32
32
  var setAppConfig = function () {
33
33
  if (!disableSettingFetching) {
34
- dispatch(handleSetAppConfig(__assign({ appInfo: appInfo, publicKey: publicKey, scope: scope === null || scope === void 0 ? void 0 : scope.toLowerCase(), mode: mode !== null && mode !== void 0 ? mode : 'page', showBoard: showBoard !== null && showBoard !== void 0 ? showBoard : true, features: __assign({ merchantLogo: true, switchLanguage: true, overlay: true, loaderOverlay: true }, features) }, rest)));
34
+ dispatch(handleSetAppConfig(__assign({ appInfo: appInfo, publicKey: publicKey, scope: scope === null || scope === void 0 ? void 0 : scope.toLowerCase(), mode: mode !== null && mode !== void 0 ? mode : 'page', showBoard: showBoard !== null && showBoard !== void 0 ? showBoard : true, features: __assign({ merchantLogo: true, switchLanguage: true, overlay: true, loaderOverlay: true, emailAuth: true }, features) }, rest)));
35
35
  }
36
36
  dispatch(handleActiveFlowScreens(navigation));
37
37
  };
@@ -0,0 +1 @@
1
+ export declare const useIsEmailAuth: () => boolean | undefined;
@@ -0,0 +1,11 @@
1
+ import { useMemo } from 'react';
2
+ import { useAppSelector } from './useAppSelector';
3
+ import { settingsSelector } from '../app/settings';
4
+ import { isEmailAuthEnabled } from '../utils';
5
+ export var useIsEmailAuth = function () {
6
+ var _a, _b;
7
+ var settingsData = useAppSelector(settingsSelector).data;
8
+ var emailAuth = (_a = settingsData.appConfig.features) === null || _a === void 0 ? void 0 : _a.emailAuth;
9
+ var countryIso2 = (_b = settingsData.businessCountry) === null || _b === void 0 ? void 0 : _b.iso2;
10
+ return useMemo(function () { return isEmailAuthEnabled(emailAuth, countryIso2); }, [emailAuth, countryIso2]);
11
+ };
@@ -49,6 +49,7 @@ export declare const isKW: (flag: string) => boolean;
49
49
  export declare const isSA: (flag: string | undefined) => boolean;
50
50
  export declare const isOtherThanKWOrSA: (flag: string) => boolean;
51
51
  export declare const isQA: (flag: string | undefined) => boolean;
52
+ export declare const isEmailAuthEnabled: (emailAuth: boolean | undefined, countryIso2: string | undefined) => boolean | undefined;
52
53
  export declare const isKWOrSA: (flag: string) => boolean;
53
54
  export declare const isLinkedIn: (flag: string) => boolean;
54
55
  export declare const isTwitter: (flag: string) => boolean;
@@ -229,6 +229,9 @@ export var isQA = function (flag) {
229
229
  return false;
230
230
  return ['qa', 'qat'].includes(flag.toLowerCase());
231
231
  };
232
+ export var isEmailAuthEnabled = function (emailAuth, countryIso2) {
233
+ return emailAuth && isQA(countryIso2);
234
+ };
232
235
  export var isKWOrSA = function (flag) {
233
236
  return isKW(flag) || isSA(flag);
234
237
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "2.12.12-development",
3
+ "version": "2.12.14-development",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",