@tap-payments/auth-jsconnect 2.0.85-test → 2.0.86-test

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.
@@ -1,4 +1,6 @@
1
1
  declare const countryService: {
2
- getCountries: () => Promise<any>;
2
+ getCountries: (disableCountries?: boolean) => Promise<any> | {
3
+ list: never[];
4
+ };
3
5
  };
4
6
  export { countryService };
@@ -1,6 +1,8 @@
1
1
  import { httpClient } from './axios';
2
2
  import { ENDPOINT_PATHS } from '../constants';
3
- var getCountries = function () {
3
+ var getCountries = function (disableCountries) {
4
+ if (disableCountries)
5
+ return { list: [] };
4
6
  return httpClient({
5
7
  method: 'post',
6
8
  url: ENDPOINT_PATHS.COUNTRIES
@@ -16,7 +16,9 @@ declare const API: {
16
16
  validateOperator: (body: ValidateOperatorBody) => Promise<any>;
17
17
  };
18
18
  countryService: {
19
- getCountries: () => Promise<any>;
19
+ getCountries: (disableCountries?: boolean | undefined) => Promise<any> | {
20
+ list: never[];
21
+ };
20
22
  };
21
23
  authService: {
22
24
  createAuth: (data: CreateAuthBody, config?: import("axios").AxiosRequestConfig<any> | undefined) => Promise<import("axios").AxiosResponse<any, any>>;
@@ -5,7 +5,9 @@ export declare const fetchAppSettingsSync: import("@reduxjs/toolkit").AsyncThunk
5
5
  businessCountry: CountryCode;
6
6
  locale: any;
7
7
  deviceInfo: DeviceInfo;
8
- }, void, {}>;
8
+ }, {
9
+ disableCountries?: boolean | undefined;
10
+ }, {}>;
9
11
  export interface SettingsData {
10
12
  skin: ThemeMode;
11
13
  language: LanguageMode;
@@ -52,19 +52,20 @@ import { defaultCountry, DefaultDeviceInfo, LOCAL_STORAGE_KEYS, DIALOG_ID, BACKG
52
52
  import i18n from '../i18n';
53
53
  import { updateLocale } from '../utils/locale';
54
54
  import API, { setAxiosGlobalHeaders } from '../api';
55
- export var fetchAppSettingsSync = createAsyncThunk('fetchAppSettingsSync', function (_, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
56
- var settings, _a, appConfig, language, _b, client, device, os, _c, visitorId, _d, ip, latitude, longitude, locale, list, operatorData, deviceInfo, countries, businessCountry;
55
+ export var fetchAppSettingsSync = createAsyncThunk('fetchAppSettingsSync', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
56
+ var settings, _a, appConfig, language, _b, client, device, os, disableCountries, _c, visitorId, _d, ip, latitude, longitude, locale, list, operatorData, deviceInfo, countries, businessCountry;
57
57
  return __generator(this, function (_e) {
58
58
  switch (_e.label) {
59
59
  case 0:
60
60
  settings = thunkApi.getState().settings;
61
61
  _a = settings.data, appConfig = _a.appConfig, language = _a.language;
62
62
  _b = getBrowserInfo(), client = _b.client, device = _b.device, os = _b.os;
63
+ disableCountries = params.disableCountries;
63
64
  return [4, Promise.all([
64
65
  getFingerPrint(),
65
66
  API.ipService.getIP(),
66
67
  API.firebaseService.getLocale(),
67
- API.countryService.getCountries()
68
+ API.countryService.getCountries(disableCountries)
68
69
  ])];
69
70
  case 1:
70
71
  _c = _e.sent(), visitorId = _c[0].visitorId, _d = _c[1], ip = _d.ip, latitude = _d.latitude, longitude = _d.longitude, locale = _c[2], list = _c[3].list;
@@ -5,9 +5,10 @@ export interface OTPFieldProps {
5
5
  autoFocus?: boolean;
6
6
  onChange: (otpValue: number) => void;
7
7
  isInputNum?: boolean;
8
+ disabled?: boolean;
8
9
  }
9
10
  declare const _default: React.MemoExoticComponent<{
10
- ({ length, value, autoFocus, isInputNum, ...rest }: OTPFieldProps): JSX.Element;
11
+ ({ length, value, autoFocus, isInputNum, disabled, ...rest }: OTPFieldProps): JSX.Element;
11
12
  defaultProps: {
12
13
  length: number;
13
14
  autoFocus: boolean;
@@ -34,8 +34,8 @@ var OTPFieldStyled = styled(OTPInput)(function (_a) {
34
34
  });
35
35
  });
36
36
  var OTPFieldComponent = function (_a) {
37
- var length = _a.length, value = _a.value, autoFocus = _a.autoFocus, isInputNum = _a.isInputNum, rest = __rest(_a, ["length", "value", "autoFocus", "isInputNum"]);
38
- return (_jsx(OTPFieldStyled, __assign({ value: value, inputStyle: { width: '46px' }, numInputs: length, shouldAutoFocus: autoFocus, isInputNum: isInputNum }, rest)));
37
+ var length = _a.length, value = _a.value, autoFocus = _a.autoFocus, isInputNum = _a.isInputNum, disabled = _a.disabled, rest = __rest(_a, ["length", "value", "autoFocus", "isInputNum", "disabled"]);
38
+ return (_jsx(OTPFieldStyled, __assign({ value: value, inputStyle: { width: '46px' }, numInputs: length, isDisabled: disabled, shouldAutoFocus: autoFocus, isInputNum: isInputNum }, rest)));
39
39
  };
40
40
  OTPFieldComponent.defaultProps = {
41
41
  length: 6,
@@ -16,7 +16,7 @@ export interface AuthData extends ResponseData {
16
16
  termAndConditionChecked: boolean;
17
17
  dob: string;
18
18
  type: string;
19
- businessCountryCode: string;
19
+ countryISOCode: string;
20
20
  }
21
21
  export interface AuthState extends SharedState<AuthData> {
22
22
  customLoading?: boolean;
@@ -76,19 +76,19 @@ export var verifyAuthOTP = createAsyncThunk('verifyAuthOTPKit', function (params
76
76
  });
77
77
  }); });
78
78
  export var resendOTP = createAsyncThunk('authResendOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
79
- var _a, settings, auth, _b, nid, dob, type, requestBody, data;
79
+ var _a, settings, auth, _b, nid, dob, type, countryISOCode, requestBody, data;
80
80
  return __generator(this, function (_c) {
81
81
  switch (_c.label) {
82
82
  case 0:
83
83
  _a = thunkApi.getState(), settings = _a.settings, auth = _a.auth;
84
- _b = auth.data || {}, nid = _b.nid, dob = _b.dob, type = _b.type;
84
+ _b = auth.data || {}, nid = _b.nid, dob = _b.dob, type = _b.type, countryISOCode = _b.countryISOCode;
85
85
  requestBody = {
86
86
  lang: settings.data.language,
87
87
  user_credentail: {
88
88
  identification_id: nid,
89
89
  identification_id_type: type,
90
90
  date_of_birth: dob,
91
- country_code: settings.data.businessCountry.iso2
91
+ country_code: countryISOCode
92
92
  },
93
93
  sign_in: false,
94
94
  is_lead: false,
@@ -120,7 +120,7 @@ var initialState = {
120
120
  termAndConditionChecked: false,
121
121
  dob: '',
122
122
  type: '',
123
- businessCountryCode: ''
123
+ countryISOCode: ''
124
124
  }
125
125
  };
126
126
  export var authSlice = createSlice({
@@ -169,7 +169,7 @@ export var authSlice = createSlice({
169
169
  state.data.nid = data === null || data === void 0 ? void 0 : data.identification_id;
170
170
  state.data.dob = data === null || data === void 0 ? void 0 : data.date_of_birth;
171
171
  state.data.type = data === null || data === void 0 ? void 0 : data.identification_id_type;
172
- state.data.businessCountryCode = data === null || data === void 0 ? void 0 : data.country_code;
172
+ state.data.countryISOCode = data === null || data === void 0 ? void 0 : data.country_code;
173
173
  })
174
174
  .addCase(retrieveLead.rejected, function (state, action) {
175
175
  state.loading = false;
@@ -40,7 +40,7 @@ var Auth = memo(function (_a) {
40
40
  var dispatch = useAppDispatch();
41
41
  var _b = useAppSelector(settingsSelector), data = _b.data, error = _b.error, settingLoading = _b.loading;
42
42
  var _c = useAppSelector(authSelector), authError = _c.error, customLoading = _c.customLoading;
43
- useAppConfig(__assign({ navigation: AUTH_SCREENS_NAVIGATION }, props));
43
+ useAppConfig(__assign({ navigation: AUTH_SCREENS_NAVIGATION, disableCountries: true }, props));
44
44
  useErrorListener(authError || error);
45
45
  useStepStartedListener();
46
46
  var activeScreen = data.activeScreen, isTapOrigin = data.isTapOrigin, open = data.open;
@@ -46,6 +46,6 @@ var OTPInput = function (_a) {
46
46
  dispatch(resendOTP());
47
47
  };
48
48
  var otpValue = otpControl.field.value;
49
- return (_jsx(BoxStyled, __assign({ dir: 'ltr' }, { children: _jsx(OTPField, { timeEndLabel: t('ide_otp_resend_label'), timerInSeconds: DEFAULT_TIMER_VALUE, onResetClick: loading ? undefined : handleOnResendOTP, value: otpValue, onChange: function (number) { return handleOnOTPChange(number.toString()); } }) })));
49
+ return (_jsx(BoxStyled, __assign({ dir: 'ltr' }, { children: _jsx(OTPField, { timeEndLabel: t('ide_otp_resend_label'), timerInSeconds: DEFAULT_TIMER_VALUE, onResetClick: loading ? undefined : handleOnResendOTP, value: otpValue, disabled: loading, onChange: function (number) { return handleOnOTPChange(number.toString()); } }) })));
50
50
  };
51
51
  export default React.memo(OTPInput);
@@ -1,6 +1,7 @@
1
1
  import { LibConfig, ScreenStepNavigation } from '../@types';
2
2
  interface AppConfigProps extends LibConfig {
3
3
  navigation: ScreenStepNavigation[];
4
+ disableCountries?: boolean;
4
5
  }
5
- export declare const useAppConfig: ({ appInfo, navigation, publicKey, ...rest }: AppConfigProps) => void;
6
+ export declare const useAppConfig: ({ appInfo, navigation, publicKey, disableCountries, ...rest }: AppConfigProps) => void;
6
7
  export {};
@@ -27,7 +27,7 @@ import { axiosInstance } from '../api';
27
27
  import { isTapDomain, removeRequestHeaders } from '../utils';
28
28
  import { ENDPOINT_PATHS } from '../constants';
29
29
  export var useAppConfig = function (_a) {
30
- var appInfo = _a.appInfo, navigation = _a.navigation, publicKey = _a.publicKey, rest = __rest(_a, ["appInfo", "navigation", "publicKey"]);
30
+ var appInfo = _a.appInfo, navigation = _a.navigation, publicKey = _a.publicKey, disableCountries = _a.disableCountries, rest = __rest(_a, ["appInfo", "navigation", "publicKey", "disableCountries"]);
31
31
  var dispatch = useAppDispatch();
32
32
  var setBaseUrl = function () {
33
33
  var isProd = publicKey.includes('pk_live');
@@ -56,6 +56,6 @@ export var useAppConfig = function (_a) {
56
56
  setBaseUrl();
57
57
  setAppConfig();
58
58
  dispatch(handleLanguage(rest.language));
59
- dispatch(fetchAppSettingsSync());
59
+ dispatch(fetchAppSettingsSync({ disableCountries: disableCountries }));
60
60
  }, []);
61
61
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "2.0.85-test",
3
+ "version": "2.0.86-test",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",