@tap-payments/auth-jsconnect 2.9.36-development → 2.9.37-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.
@@ -112,7 +112,7 @@ export var fetchAppSettingsSync = createAsyncThunk('fetchAppSettingsSync', funct
112
112
  thunkApi.dispatch(handleLanguage(lang));
113
113
  if (configInfo.publicKey) {
114
114
  if (configToken) {
115
- setBaseUrl(configInfo.publicKey);
115
+ setBaseUrl(configInfo.publicKey, appConfig.businessCountryCode);
116
116
  }
117
117
  thunkApi.dispatch(handlePublicKey(configInfo.publicKey));
118
118
  }
@@ -358,6 +358,7 @@ export var settingsSlice = createSlice({
358
358
  if (state.data.locale && country.iso2)
359
359
  updateLocale(state.data.locale, country.iso2);
360
360
  state.data.businessCountry = country;
361
+ setBaseUrl(state.data.appConfig.publicKey, country.iso2);
361
362
  }
362
363
  }
363
364
  },
@@ -11,6 +11,7 @@ export declare const ENDPOINT_PATHS: {
11
11
  MIGRATION_STATUS: string;
12
12
  SANDBOX_BASE_URL: string;
13
13
  PRODUCTION_BASE_URL: string;
14
+ PRODUCTION_BASE_URL_SA: string;
14
15
  DEV_BASE_URL: string;
15
16
  BUSINESS_COUNTRIES: string;
16
17
  COUNTRIES: string;
@@ -1,5 +1,6 @@
1
1
  var SANDBOX_BASE_URL = 'https://connect-mw.sandbox.tap.company/middleware';
2
2
  var PRODUCTION_BASE_URL = 'https://connect-mw.tap.company/middleware';
3
+ var PRODUCTION_BASE_URL_SA = 'https://connect-mw.tap.com.sa/middleware';
3
4
  var DEV_BASE_URL = 'https://connect-mw.dev.tap.company/middleware';
4
5
  var API_BUSINESS_COUNTRIES = 'https://godata.sandbox.tap.company/api/v1/business/country/list';
5
6
  var API_COUNTRIES = 'https://utilities.tap.company/api/v1/country/list';
@@ -68,6 +69,7 @@ export var ENDPOINT_PATHS = {
68
69
  MIGRATION_STATUS: MIGRATION_STATUS,
69
70
  SANDBOX_BASE_URL: SANDBOX_BASE_URL,
70
71
  PRODUCTION_BASE_URL: PRODUCTION_BASE_URL,
72
+ PRODUCTION_BASE_URL_SA: PRODUCTION_BASE_URL_SA,
71
73
  DEV_BASE_URL: DEV_BASE_URL,
72
74
  BUSINESS_COUNTRIES: API_BUSINESS_COUNTRIES,
73
75
  COUNTRIES: API_COUNTRIES,
@@ -48,7 +48,7 @@ export var useAppConfig = function (_a) {
48
48
  if (!disableSettingFetching && !configToken)
49
49
  removeRequestHeaders();
50
50
  checkDomain();
51
- setBaseUrl(publicKey);
51
+ setBaseUrl(publicKey, rest.businessCountryCode);
52
52
  setAppConfig();
53
53
  if (typeof boardMaturity === 'boolean')
54
54
  dispatch(handelBoardMaturity(boardMaturity));
@@ -1,6 +1,6 @@
1
1
  export declare const sleep: (milliseconds?: number) => Promise<unknown>;
2
2
  export declare const dangerousMessage: (message: string, callBack?: Function) => void;
3
- export declare const setBaseUrl: (publicKey: string) => void;
3
+ export declare const setBaseUrl: (publicKey: string, countryCode?: string) => void;
4
4
  export declare const updateLocationUrlWithCountry: (countryIso2: string) => void;
5
5
  export declare const openConnect: (pk: string, countryCode?: string) => void;
6
6
  export declare function getMetaData(): Record<string, string> | undefined;
@@ -1,6 +1,7 @@
1
1
  import { axiosInstance } from '../api';
2
2
  import { ENDPOINT_PATHS, CONNECT_DEV_URL, CONNECT_PROD_URL } from '../constants';
3
3
  import { objectHasValues } from './object';
4
+ import { isSA } from './string';
4
5
  export var sleep = function (milliseconds) {
5
6
  if (milliseconds === void 0) { milliseconds = 1000; }
6
7
  return new Promise(function (resolve) { return setTimeout(resolve, milliseconds); });
@@ -11,10 +12,11 @@ export var dangerousMessage = function (message, callBack) {
11
12
  }
12
13
  callBack === null || callBack === void 0 ? void 0 : callBack({ message: message });
13
14
  };
14
- export var setBaseUrl = function (publicKey) {
15
+ export var setBaseUrl = function (publicKey, countryCode) {
16
+ if (countryCode === void 0) { countryCode = ''; }
15
17
  var isProd = publicKey.includes('pk_live');
16
18
  if (isProd) {
17
- axiosInstance.defaults.baseURL = ENDPOINT_PATHS.PRODUCTION_BASE_URL;
19
+ axiosInstance.defaults.baseURL = isSA(countryCode) ? ENDPOINT_PATHS.PRODUCTION_BASE_URL_SA : ENDPOINT_PATHS.PRODUCTION_BASE_URL;
18
20
  return;
19
21
  }
20
22
  axiosInstance.defaults.baseURL = ENDPOINT_PATHS.DEV_BASE_URL;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "2.9.36-development",
3
+ "version": "2.9.37-development",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",