@tap-payments/auth-jsconnect 2.3.37-test → 2.3.39-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.
@@ -47,13 +47,13 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
47
47
  };
48
48
  var _a;
49
49
  import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
50
- import { getStoredData, storeData, isArray, findItem, getBrowserInfo, getFingerPrint, sortCountries, findCountryByIso2, getRequestHeaders, encryptString, dangerousMessage } from '../utils';
50
+ import { getStoredData, storeData, isArray, findItem, getBrowserInfo, getFingerPrint, sortCountries, findCountryByIso2, getRequestHeaders, encryptString, dangerousMessage, isKW, isSA } from '../utils';
51
51
  import { DefaultDeviceInfo, LOCAL_STORAGE_KEYS } from '../constants';
52
52
  import i18n from '../i18n';
53
53
  import { updateLocale } from '../utils/locale';
54
54
  import API, { setAxiosGlobalHeaders } from '../api';
55
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, disableLocale, maturity, _c, visitorId, _d, ip, latitude, longitude, locale, list, operatorData, deviceInfo, operatorStatus, isValidOperator, countries, businessCountry;
56
+ var settings, _a, appConfig, language, _b, client, device, os, disableCountries, disableLocale, maturity, _c, visitorId, _d, ip, latitude, longitude, locale, list, operatorData, deviceInfo, operatorStatus, isValidOperator, countries, countryCode, isKWOrSA, businessCountry;
57
57
  return __generator(this, function (_e) {
58
58
  switch (_e.label) {
59
59
  case 0:
@@ -113,7 +113,11 @@ export var fetchAppSettingsSync = createAsyncThunk('fetchAppSettingsSync', funct
113
113
  operatorStatus = _e.sent();
114
114
  isValidOperator = operatorStatus === 'valid';
115
115
  countries = sortCountries(list);
116
- businessCountry = findCountryByIso2(countries, appConfig.businessCountryCode);
116
+ countryCode = appConfig.businessCountryCode;
117
+ isKWOrSA = isKW(countryCode) || isSA(countryCode);
118
+ if (!isKWOrSA)
119
+ countryCode = 'SA';
120
+ businessCountry = findCountryByIso2(countries, countryCode);
117
121
  if (!businessCountry)
118
122
  throw new Error('Business country not found, you have to pass a valid business country code in the lib config');
119
123
  return [2, { countries: countries, businessCountry: businessCountry, locale: locale, deviceInfo: deviceInfo, isValidOperator: isValidOperator }];
@@ -156,19 +156,20 @@ export var resendOTPMobile = createAsyncThunk('resendOTPMobile', function (param
156
156
  });
157
157
  }); });
158
158
  export var resendOTPNID = createAsyncThunk('resendOTPNID', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
159
- var _a, settings, connect, _b, nid, dob, type, requestBody, data;
159
+ var _a, settings, connect, _b, nid, dob, identification_id_type, requestBody, data;
160
160
  return __generator(this, function (_c) {
161
161
  switch (_c.label) {
162
162
  case 0:
163
163
  _a = thunkApi.getState(), settings = _a.settings, connect = _a.connect;
164
- _b = connect.data.nidData, nid = _b.nid, dob = _b.dob, type = _b.type;
164
+ _b = connect.data.nidData, nid = _b.nid, dob = _b.dob;
165
+ identification_id_type = nid.startsWith('1') ? IDENTIFICATION_TYPE.NID : IDENTIFICATION_TYPE.IQAMA;
165
166
  requestBody = {
166
167
  country: settings.data.businessCountry.iso2,
167
168
  scope: settings.data.appConfig.scope,
168
169
  lang: settings.data.language,
169
170
  user_credentail: {
170
171
  identification_id: nid,
171
- identification_id_type: type,
172
+ identification_id_type: identification_id_type,
172
173
  date_of_birth: dob,
173
174
  country_code: settings.data.businessCountry.iso2
174
175
  },
@@ -7,7 +7,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
7
7
  }
8
8
  return to.concat(ar || Array.prototype.slice.call(from));
9
9
  };
10
- import { REGEX_WEBSITE, LINKEDIN_URL, SOCIAL_USERNAME, DIGITS_ONLY, REGEX_ALPHANUMERIC } from '../../../../constants';
10
+ import { REGEX_WEBSITE, DIGITS_ONLY, REGEX_ALPHANUMERIC } from '../../../../constants';
11
11
  import * as yup from 'yup';
12
12
  var validationSalesChannels = function (channels) {
13
13
  if (channels === void 0) { channels = []; }
@@ -42,16 +42,16 @@ var validationSalesChannels = function (channels) {
42
42
  if (key === 'website' && value && !value.match(REGEX_WEBSITE)) {
43
43
  return 'invalid_url';
44
44
  }
45
- if (key === 'linkedin' && value && !value.match(LINKEDIN_URL)) {
45
+ if (key === 'linkedin' && value && !value.trim()) {
46
46
  return 'invalid_linkedin_profile_url';
47
47
  }
48
- if (key === 'facebook' && value && !value.match(SOCIAL_USERNAME)) {
48
+ if (key === 'facebook' && value && !value.trim()) {
49
49
  return 'invalid_facebook_username';
50
50
  }
51
- if (key === 'instagram' && value && !value.match(SOCIAL_USERNAME)) {
51
+ if (key === 'instagram' && value && !value.trim()) {
52
52
  return 'invalid_instagram_username';
53
53
  }
54
- if (key === 'twitter' && value && !value.match(SOCIAL_USERNAME)) {
54
+ if (key === 'twitter' && value && !value.trim()) {
55
55
  return 'invalid_twitter_username';
56
56
  }
57
57
  if (key === 'physical_store' && value && value.length < 3) {
@@ -7,7 +7,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
7
7
  }
8
8
  return to.concat(ar || Array.prototype.slice.call(from));
9
9
  };
10
- import { REGEX_WEBSITE, LINKEDIN_URL, SOCIAL_USERNAME, DIGITS_ONLY, REGEX_ALPHANUMERIC } from '../../../../constants';
10
+ import { REGEX_WEBSITE, DIGITS_ONLY, REGEX_ALPHANUMERIC } from '../../../../constants';
11
11
  import * as yup from 'yup';
12
12
  var validationSalesChannels = function (channels) {
13
13
  if (channels === void 0) { channels = []; }
@@ -42,16 +42,16 @@ var validationSalesChannels = function (channels) {
42
42
  if (key === 'website' && value && !value.match(REGEX_WEBSITE)) {
43
43
  return 'invalid_url';
44
44
  }
45
- if (key === 'linkedin' && value && !value.match(LINKEDIN_URL)) {
45
+ if (key === 'linkedin' && value && !value.trim()) {
46
46
  return 'invalid_linkedin_profile_url';
47
47
  }
48
- if (key === 'facebook' && value && !value.match(SOCIAL_USERNAME)) {
48
+ if (key === 'facebook' && value && !value.trim()) {
49
49
  return 'invalid_facebook_username';
50
50
  }
51
- if (key === 'instagram' && value && !value.match(SOCIAL_USERNAME)) {
51
+ if (key === 'instagram' && value && !value.trim()) {
52
52
  return 'invalid_instagram_username';
53
53
  }
54
- if (key === 'twitter' && value && !value.match(SOCIAL_USERNAME)) {
54
+ if (key === 'twitter' && value && !value.trim()) {
55
55
  return 'invalid_twitter_username';
56
56
  }
57
57
  if (key === 'physical_store' && value && value.length < 3) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "2.3.37-test",
3
+ "version": "2.3.39-test",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",