@tap-payments/auth-jsconnect 2.11.1-beta → 2.12.0-beta

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
  },
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { LibConfig } from '../../@types';
3
- export interface AuthLibProps extends Pick<LibConfig, 'open' | 'mode' | 'scope' | 'merchantDomain' | 'publicKey' | 'redirectUrl' | 'data' | 'postURL' | 'appInfo' | 'businessCountryCode' | 'language' | 'onFlowCompleted' | 'onError' | 'onStepCompleted' | 'onReady' | 'onClose' | 'onStepStarted'> {
3
+ export interface AuthLibProps extends Pick<LibConfig, 'open' | 'mode' | 'scope' | 'merchantDomain' | 'publicKey' | 'redirectUrl' | 'data' | 'postURL' | 'appInfo' | 'businessCountryCode' | 'language' | 'onFlowCompleted' | 'onError' | 'onStepCompleted' | 'onReady' | 'onClose' | 'onStepStarted' | 'region'> {
4
4
  leadId?: string;
5
5
  configToken?: string;
6
6
  }
@@ -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.BETA_BASE_URL;
18
+ axiosInstance.defaults.baseURL = isSA(region) ? ENDPOINT_PATHS.PRODUCTION_BASE_URL_SA : ENDPOINT_PATHS.BETA_BASE_URL;
20
19
  return;
21
20
  }
22
21
  axiosInstance.defaults.baseURL = ENDPOINT_PATHS.SANDBOX_BASE_URL;
@@ -46,7 +46,7 @@ export declare const getBaseUrl: () => string;
46
46
  export declare const getScreenNameBasedOnFlow: (flow: string, isAuthorizedUser?: boolean, isOtherThanSAOrKWCountry?: boolean) => "CONNECT_NID_STEP" | "" | "BUSINESS_BUSINESS_TYPE_STEP" | "INDIVIDUAL_PERSONAL_INDIVIDUAL_INFO_STEP" | "INDIVIDUAL_LIST_STEP" | "PASSWORD_CREATE_PASSWORD_STEP" | "BANK_BANK_DETAILS_STEP" | "TAX_TAX_DETAILS_STEP" | "ENTITY_NAME_STEP" | "BRAND_INFO_STEP";
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;
@@ -214,7 +214,9 @@ export var isKW = function (flag) {
214
214
  return ['kw', 'kwd'].includes(flag === null || flag === void 0 ? void 0 : flag.toLowerCase());
215
215
  };
216
216
  export var isSA = function (flag) {
217
- return ['sa', 'sau'].includes(flag === null || flag === void 0 ? void 0 : flag.toLowerCase());
217
+ if (!flag)
218
+ return false;
219
+ return ['sa', 'sau'].includes(flag.toLowerCase());
218
220
  };
219
221
  export var isOtherThanKWOrSA = function (flag) {
220
222
  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.11.1-beta",
3
+ "version": "2.12.0-beta",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",