@tap-payments/auth-jsconnect 2.10.21-development → 2.11.0-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.
@@ -245,6 +245,7 @@ export interface LibConfig extends LibCallbacks {
245
245
  notification?: SDKNotification;
246
246
  boardMaturity?: boolean;
247
247
  settingData?: SettingAsyncData;
248
+ region?: string;
248
249
  }
249
250
  export interface OSDetails {
250
251
  name: string;
@@ -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, appConfig.businessCountryCode);
115
+ setBaseUrl(configInfo.publicKey, appConfig.region);
116
116
  }
117
117
  thunkApi.dispatch(handlePublicKey(configInfo.publicKey));
118
118
  }
@@ -362,7 +362,6 @@ export var settingsSlice = createSlice({
362
362
  if (state.data.locale && country.iso2)
363
363
  updateLocale(state.data.locale, country.iso2);
364
364
  state.data.businessCountry = country;
365
- setBaseUrl(state.data.appConfig.publicKey, country.iso2);
366
365
  }
367
366
  }
368
367
  },
@@ -48,7 +48,7 @@ export var useAppConfig = function (_a) {
48
48
  if (!disableSettingFetching && !configToken)
49
49
  removeRequestHeaders();
50
50
  checkDomain();
51
- setBaseUrl(publicKey, rest.businessCountryCode);
51
+ setBaseUrl(publicKey, rest.region);
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, countryCode?: string) => void;
3
+ export declare const setBaseUrl: (publicKey: string, region?: 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;
@@ -12,11 +12,10 @@ export var dangerousMessage = function (message, callBack) {
12
12
  }
13
13
  callBack === null || callBack === void 0 ? void 0 : callBack({ message: message });
14
14
  };
15
- export var setBaseUrl = function (publicKey, countryCode) {
16
- if (countryCode === void 0) { countryCode = ''; }
15
+ export var setBaseUrl = function (publicKey, region) {
17
16
  var isProd = publicKey.includes('pk_live');
18
17
  if (isProd) {
19
- axiosInstance.defaults.baseURL = isSA(countryCode) ? ENDPOINT_PATHS.PRODUCTION_BASE_URL_SA : ENDPOINT_PATHS.PRODUCTION_BASE_URL;
18
+ axiosInstance.defaults.baseURL = isSA(region) ? ENDPOINT_PATHS.PRODUCTION_BASE_URL_SA : ENDPOINT_PATHS.PRODUCTION_BASE_URL;
20
19
  return;
21
20
  }
22
21
  axiosInstance.defaults.baseURL = ENDPOINT_PATHS.DEV_BASE_URL;
@@ -46,7 +46,7 @@ export declare const getBaseUrl: () => string;
46
46
  export declare const getScreenNameBasedOnFlow: (flow: string, isAuthorizedUser?: boolean, isOtherThanSAOrKWCountry?: boolean, terminalStepName?: string) => string;
47
47
  export declare const getEighteenYearsAgo: () => string;
48
48
  export declare const isKW: (flag: string) => boolean;
49
- export declare const isSA: (flag: string) => boolean;
49
+ export declare const isSA: (flag: string | undefined) => boolean;
50
50
  export declare const isOtherThanKWOrSA: (flag: string) => boolean;
51
51
  export declare const isKWOrSA: (flag: string) => boolean;
52
52
  export declare const isLinkedIn: (flag: string) => boolean;
@@ -217,7 +217,9 @@ export var isKW = function (flag) {
217
217
  return ['kw', 'kwd'].includes(flag === null || flag === void 0 ? void 0 : flag.toLowerCase());
218
218
  };
219
219
  export var isSA = function (flag) {
220
- return ['sa', 'sau'].includes(flag === null || flag === void 0 ? void 0 : flag.toLowerCase());
220
+ if (!flag)
221
+ return false;
222
+ return ['sa', 'sau'].includes(flag.toLowerCase());
221
223
  };
222
224
  export var isOtherThanKWOrSA = function (flag) {
223
225
  return !isKW(flag) && !isSA(flag);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "2.10.21-development",
3
+ "version": "2.11.0-development",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",