@tap-payments/auth-jsconnect 2.0.84-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.
@@ -66,7 +66,7 @@ export declare type VerifyAuthKitOTPBody = {
66
66
  verify_token?: string;
67
67
  data: string;
68
68
  post_url: string;
69
- scopes: Array<string>;
69
+ scopes?: Array<string>;
70
70
  terms: Array<string>;
71
71
  encryption_contract: Array<string>;
72
72
  };
@@ -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,
@@ -61,7 +61,7 @@ var OTPTimerComponent = function (_a) {
61
61
  }
62
62
  };
63
63
  return (_jsx(OTPTimerStyled, __assign({ onClick: resetTimer }, rest, { children: _jsx(OTPTimerTextStyled, __assign({ variant: 'h4', color: 'primary', sx: {
64
- cursor: timeValue <= 0 ? 'pointer' : 'default'
64
+ cursor: timeValue <= 0 && onResetClick ? 'pointer' : 'default'
65
65
  } }, { children: timeValue > 0 ? (timeValue > 9 ? "00:".concat(timeValue) : "00:0".concat(timeValue)) : timeEndLabel })) })));
66
66
  };
67
67
  OTPTimerComponent.defaultProps = {
@@ -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;
@@ -62,7 +62,6 @@ export var verifyAuthOTP = createAsyncThunk('verifyAuthOTPKit', function (params
62
62
  verify_token: verifyToken,
63
63
  data: params.otp,
64
64
  post_url: postUrl,
65
- scopes: settings.data.appConfig.scope || [],
66
65
  terms: auth.data.termAndConditionChecked ? ['general'] : [],
67
66
  encryption_contract: ['data']
68
67
  };
@@ -77,22 +76,22 @@ export var verifyAuthOTP = createAsyncThunk('verifyAuthOTPKit', function (params
77
76
  });
78
77
  }); });
79
78
  export var resendOTP = createAsyncThunk('authResendOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
80
- var _a, settings, auth, _b, nid, dob, type, requestBody, data;
79
+ var _a, settings, auth, _b, nid, dob, type, countryISOCode, requestBody, data;
81
80
  return __generator(this, function (_c) {
82
81
  switch (_c.label) {
83
82
  case 0:
84
83
  _a = thunkApi.getState(), settings = _a.settings, auth = _a.auth;
85
- _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;
86
85
  requestBody = {
87
86
  lang: settings.data.language,
88
87
  user_credentail: {
89
88
  identification_id: nid,
90
89
  identification_id_type: type,
91
90
  date_of_birth: dob,
92
- country_code: settings.data.businessCountry.iso2
91
+ country_code: countryISOCode
93
92
  },
94
93
  sign_in: false,
95
- is_lead: true,
94
+ is_lead: false,
96
95
  encryption_contract: [
97
96
  'user_credentail.country_code',
98
97
  'user_credentail.identification_id',
@@ -121,7 +120,7 @@ var initialState = {
121
120
  termAndConditionChecked: false,
122
121
  dob: '',
123
122
  type: '',
124
- businessCountryCode: ''
123
+ countryISOCode: ''
125
124
  }
126
125
  };
127
126
  export var authSlice = createSlice({
@@ -170,7 +169,7 @@ export var authSlice = createSlice({
170
169
  state.data.nid = data === null || data === void 0 ? void 0 : data.identification_id;
171
170
  state.data.dob = data === null || data === void 0 ? void 0 : data.date_of_birth;
172
171
  state.data.type = data === null || data === void 0 ? void 0 : data.identification_id_type;
173
- 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;
174
173
  })
175
174
  .addCase(retrieveLead.rejected, function (state, action) {
176
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;
@@ -32,7 +32,7 @@ var OTPInput = function (_a) {
32
32
  var t = useTranslation().t;
33
33
  var dispatch = useAppDispatch();
34
34
  var otpControl = useController({ name: 'otp', control: control });
35
- var error = useAppSelector(authSelector).error;
35
+ var _c = useAppSelector(authSelector), error = _c.error, loading = _c.loading;
36
36
  var handleOnOTPChange = function (otp) {
37
37
  if (!!error)
38
38
  dispatch(clearError());
@@ -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: 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);
@@ -129,8 +129,7 @@ var BrandName = function (_a) {
129
129
  var brandValue = value.replaceAll(' ', '-').toLowerCase();
130
130
  var address = (brandValue[brandValue.length - 1] === '-' ? brandValue.slice(0, -1) : brandValue) + '.com';
131
131
  var updatedSalesChannels = salesChannels.map(function (channel) {
132
- var _a;
133
- if (((_a = channel.name) === null || _a === void 0 ? void 0 : _a.en.toLowerCase()) === 'website') {
132
+ if (channel.id.toLowerCase() === 'website') {
134
133
  return __assign(__assign({}, channel), { address: address });
135
134
  }
136
135
  return channel;
@@ -31,17 +31,17 @@ export var MerchantValidationSchema = function (isNewBrand) {
31
31
  var channels = (value || []);
32
32
  var dic = {};
33
33
  channels.forEach(function (channel) {
34
- var _a, _b, _c;
34
+ var _a, _b;
35
35
  if ((_a = channel.sub) === null || _a === void 0 ? void 0 : _a.length) {
36
36
  channel.sub.forEach(function (sub) {
37
- var _a, _b;
38
- var key = (_b = (_a = sub.name) === null || _a === void 0 ? void 0 : _a.en) === null || _b === void 0 ? void 0 : _b.toLowerCase();
37
+ var _a;
38
+ var key = (_a = sub.id) === null || _a === void 0 ? void 0 : _a.toLowerCase();
39
39
  if (key)
40
40
  dic[key] = sub.address || '';
41
41
  });
42
42
  }
43
43
  else {
44
- var key = (_c = (_b = channel.name) === null || _b === void 0 ? void 0 : _b.en) === null || _c === void 0 ? void 0 : _c.toLowerCase();
44
+ var key = (_b = channel.id) === null || _b === void 0 ? void 0 : _b.toLowerCase();
45
45
  if (key)
46
46
  dic[key] = channel.address || '';
47
47
  }
@@ -72,17 +72,17 @@ export var MerchantValidationSchema = function (isNewBrand) {
72
72
  var channels = (value || []);
73
73
  var dic = {};
74
74
  channels.forEach(function (channel) {
75
- var _a, _b, _c;
75
+ var _a, _b;
76
76
  if ((_a = channel.sub) === null || _a === void 0 ? void 0 : _a.length) {
77
77
  channel.sub.forEach(function (sub) {
78
- var _a, _b;
79
- var key = (_b = (_a = sub.name) === null || _a === void 0 ? void 0 : _a.en) === null || _b === void 0 ? void 0 : _b.toLowerCase();
78
+ var _a;
79
+ var key = (_a = sub.id) === null || _a === void 0 ? void 0 : _a.toLowerCase();
80
80
  if (key)
81
81
  dic[key] = sub.address || '';
82
82
  });
83
83
  }
84
84
  else {
85
- var key = (_c = (_b = channel.name) === null || _b === void 0 ? void 0 : _b.en) === null || _c === void 0 ? void 0 : _c.toLowerCase();
85
+ var key = (_b = channel.id) === null || _b === void 0 ? void 0 : _b.toLowerCase();
86
86
  if (key)
87
87
  dic[key] = channel.address || '';
88
88
  }
@@ -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.84-test",
3
+ "version": "2.0.86-test",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",