@tap-payments/auth-jsconnect 2.8.72-development → 2.8.74-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.
@@ -57,7 +57,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
57
57
  var _a;
58
58
  import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
59
59
  import { getStoredData, storeData, isArray, findItem, getBrowserInfo, getFingerPrint, sortCountries, findCountryByIso2, getRequestHeaders, encryptString, dangerousMessage, getParameterByName, setBaseUrl, getUserLanguage } from '../utils';
60
- import { BUSINESS_COUNTRIES, DefaultDeviceInfo, LOCAL_STORAGE_KEYS } from '../constants';
60
+ import { BUSINESS_COUNTRIES, DEFAULT_COUNTRY_ISO2, DefaultDeviceInfo, LOCAL_STORAGE_KEYS } from '../constants';
61
61
  import i18n from '../i18n';
62
62
  import { updateLocale } from '../utils/locale';
63
63
  import API, { getAxiosHeaders, setAxiosGlobalHeaders } from '../api';
@@ -161,8 +161,7 @@ export var fetchAppSettingsSync = createAsyncThunk('fetchAppSettingsSync', funct
161
161
  ipCountry = undefined;
162
162
  if (countryCode)
163
163
  businessCountry = findCountryByIso2(countries, countryCode);
164
- if (country_code)
165
- ipCountry = findCountryByIso2(countries, country_code);
164
+ ipCountry = findCountryByIso2(countries, country_code !== null && country_code !== void 0 ? country_code : DEFAULT_COUNTRY_ISO2);
166
165
  if (appConfig.onSettingFetched)
167
166
  appConfig.onSettingFetched({
168
167
  config: config,
@@ -9,6 +9,7 @@ export declare const LOCAL_STORAGE_KEYS: {
9
9
  languageMode: string;
10
10
  };
11
11
  export declare const SCOPE_AUTH = "auth";
12
+ export declare const DEFAULT_COUNTRY_ISO2 = "KW";
12
13
  export declare const EXTERNAL_LINKS: {
13
14
  TOS_EN: string;
14
15
  TOS_AR: string;
@@ -9,6 +9,7 @@ export var LOCAL_STORAGE_KEYS = {
9
9
  languageMode: 'languageMode'
10
10
  };
11
11
  export var SCOPE_AUTH = 'auth';
12
+ export var DEFAULT_COUNTRY_ISO2 = 'KW';
12
13
  export var EXTERNAL_LINKS = {
13
14
  TOS_EN: '/en/terms-conditions',
14
15
  TOS_AR: '/ar/terms-conditions',
@@ -3,7 +3,7 @@ import * as React from 'react';
3
3
  import { useTranslation } from 'react-i18next';
4
4
  import { useController, useFormContext } from 'react-hook-form';
5
5
  import { KW_MAX_LICENSE_LENGTH, KW_MIN_LICENSE_LENGTH, LICENSE_NUMBER_MAX_LENGTH, LICENSE_NUMBER_MIN_LENGTH } from '../../../../constants';
6
- import { removeAllOtherThanCharsAndNumber, isSA } from '../../../../utils';
6
+ import { isSA, cleanFLandCRNumber } from '../../../../utils';
7
7
  import ScreenContainer from '../../../shared/Containers/ScreenContainer';
8
8
  import ClearIcon from '../../../shared/ClearIcon';
9
9
  import CheckIcon from '../../../shared/CheckIcon';
@@ -19,7 +19,7 @@ var LicenseNumber = function () {
19
19
  var isSACountry = React.useMemo(function () { return isSA(settingsData.businessCountry.iso2); }, [settingsData.businessCountry.iso2]);
20
20
  var handleFLNumberChange = function (_a) {
21
21
  var target = _a.target;
22
- var value = removeAllOtherThanCharsAndNumber(target.value);
22
+ var value = cleanFLandCRNumber(target.value);
23
23
  licenseNumberControl.field.onChange(value);
24
24
  };
25
25
  var clearLicenseNumber = function () {
@@ -14,7 +14,7 @@ import * as React from 'react';
14
14
  import { useTranslation } from 'react-i18next';
15
15
  import { useController, useFormContext } from 'react-hook-form';
16
16
  import { CR_MIN_LICENSE_LENGTH, CR_NUMBER_MAX_LENGTH, FL_MIN_LICENSE_LENGTH, FL_NUMBER_MAX_LENGTH, KW_MAX_LICENSE_LENGTH, KW_MIN_LICENSE_LENGTH } from '../../../../constants';
17
- import { removeAllOtherThanCharsAndNumber, isOtherLicense, isKW, isOtherThanKWOrSA } from '../../../../utils';
17
+ import { isOtherLicense, isKW, isOtherThanKWOrSA, cleanFLandCRNumber } from '../../../../utils';
18
18
  import ScreenContainer from '../../../shared/Containers/ScreenContainer';
19
19
  import ClearIcon from '../../../shared/ClearIcon';
20
20
  import CheckIcon from '../../../shared/CheckIcon';
@@ -38,7 +38,7 @@ var LicenseNumber = function (_a) {
38
38
  var readOnly = !isOtherLicense(selectedLicense) || (selectedEntityLicense && !isOtherLicense(selectedEntityLicense));
39
39
  var handleFLNumberChange = function (_a) {
40
40
  var target = _a.target;
41
- var value = removeAllOtherThanCharsAndNumber(target.value);
41
+ var value = cleanFLandCRNumber(target.value);
42
42
  licenseNumberControl.field.onChange(value);
43
43
  };
44
44
  var clearLicenseNumber = function () {
@@ -3,7 +3,7 @@ import * as React from 'react';
3
3
  import { useTranslation } from 'react-i18next';
4
4
  import { useController, useFormContext } from 'react-hook-form';
5
5
  import { KW_MAX_LICENSE_LENGTH, KW_MIN_LICENSE_LENGTH, LICENSE_NUMBER_MAX_LENGTH, LICENSE_NUMBER_MIN_LENGTH } from '../../../../constants';
6
- import { removeAllOtherThanCharsNumberSlashAndHyphen, isSA } from '../../../../utils';
6
+ import { isSA, cleanFLandCRNumber } from '../../../../utils';
7
7
  import ScreenContainer from '../../../shared/Containers/ScreenContainer';
8
8
  import ClearIcon from '../../../shared/ClearIcon';
9
9
  import CheckIcon from '../../../shared/CheckIcon';
@@ -19,7 +19,7 @@ var LicenseNumber = function () {
19
19
  var isSACountry = React.useMemo(function () { return isSA(settingsData.businessCountry.iso2); }, [settingsData.businessCountry.iso2]);
20
20
  var handleFLNumberChange = function (_a) {
21
21
  var target = _a.target;
22
- var value = removeAllOtherThanCharsNumberSlashAndHyphen(target.value);
22
+ var value = cleanFLandCRNumber(target.value);
23
23
  licenseNumberControl.field.onChange(value);
24
24
  };
25
25
  var clearLicenseNumber = function () {
@@ -14,7 +14,7 @@ import * as React from 'react';
14
14
  import { useTranslation } from 'react-i18next';
15
15
  import { useController, useFormContext } from 'react-hook-form';
16
16
  import { CR_MIN_LICENSE_LENGTH, CR_NUMBER_MAX_LENGTH, FL_MIN_LICENSE_LENGTH, FL_NUMBER_MAX_LENGTH, KW_MAX_LICENSE_LENGTH, KW_MIN_LICENSE_LENGTH } from '../../../../constants';
17
- import { removeAllOtherThanCharsAndNumber, isKW, isOtherThanKWOrSA } from '../../../../utils';
17
+ import { isKW, isOtherThanKWOrSA, cleanFLandCRNumber } from '../../../../utils';
18
18
  import ScreenContainer from '../../../shared/Containers/ScreenContainer';
19
19
  import ClearIcon from '../../../shared/ClearIcon';
20
20
  import CheckIcon from '../../../shared/CheckIcon';
@@ -36,7 +36,7 @@ var LicenseNumber = function (_a) {
36
36
  var isCR = (selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type) === BusinessType.CR;
37
37
  var handleFLNumberChange = function (_a) {
38
38
  var target = _a.target;
39
- var value = removeAllOtherThanCharsAndNumber(target.value);
39
+ var value = cleanFLandCRNumber(target.value);
40
40
  licenseNumberControl.field.onChange(value);
41
41
  };
42
42
  var clearLicenseNumber = function () {
@@ -6,6 +6,7 @@ export declare const removeAllOtherThanAlphabetAndSpace: (str: string) => string
6
6
  export declare const removeAllNumberFromChars: (str: string) => string;
7
7
  export declare const keepEmailCharacters: (str: string) => string;
8
8
  export declare const removeAllOtherThanCharsAndNumber: (str: string) => string;
9
+ export declare const cleanFLandCRNumber: (str: string) => string;
9
10
  export declare const removeAllOtherThanCharsNumberSlashAndHyphen: (str: string) => string;
10
11
  export declare const removeAllOtherThanCharsNumbersAtAndDot: (str: string) => string;
11
12
  export declare const removeAllOtherThanCharsNumbersAndSpace: (str: string) => string;
@@ -22,6 +22,9 @@ export var keepEmailCharacters = function (str) {
22
22
  export var removeAllOtherThanCharsAndNumber = function (str) {
23
23
  return str.replace(/[^A-Za-z0-9]/g, '');
24
24
  };
25
+ export var cleanFLandCRNumber = function (str) {
26
+ return str.replace(/[^a-zA-Z0-9_-]/g, '');
27
+ };
25
28
  export var removeAllOtherThanCharsNumberSlashAndHyphen = function (str) {
26
29
  return str.replace(/[^A-Za-z0-9/-]/g, '');
27
30
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "2.8.72-development",
3
+ "version": "2.8.74-development",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",