@tap-payments/auth-jsconnect 2.6.52-test → 2.6.54-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.
@@ -52,7 +52,7 @@ import { useAppSelector, useAppDispatch, useLanguage } from '../../../../hooks';
52
52
  import { ScreenContainer } from '../../../shared/Containers';
53
53
  import BusinessCountry from '../../../shared/BusinessCountry';
54
54
  import Button from '../../../shared/Button';
55
- import { findCountryByIso2, isKW, isOtherThanKWOrSA } from '../../../../utils';
55
+ import { findCountryByIso2, isKW, isOtherThanKWOrSA, updateLocationUrlWithCountry } from '../../../../utils';
56
56
  import Collapse from '../../../../components/Collapse';
57
57
  import { handleNextScreenStep, handleSetCountryByIso2, settingsSelector } from '../../../../app/settings';
58
58
  import { connectSelector, setDefaultCountryCode, updateBusinessCountry, storeIsStartFromBusinessCountry, clearError } from '../../../app/connect/connectStore';
@@ -77,8 +77,11 @@ var BusinessCountryScreen = function (_a) {
77
77
  return __generator(this, function (_a) {
78
78
  switch (_a.label) {
79
79
  case 0:
80
+ if (!iso2)
81
+ return [2];
80
82
  countryCode = findCountryByIso2(settingsData.countries, iso2);
81
83
  dispatch(handleSetCountryByIso2(iso2));
84
+ updateLocationUrlWithCountry(iso2);
82
85
  if (!data.leadId) return [3, 2];
83
86
  return [4, dispatch(updateBusinessCountry(iso2))];
84
87
  case 1:
@@ -1,3 +1,4 @@
1
1
  export declare const sleep: (milliseconds?: number) => Promise<unknown>;
2
2
  export declare const dangerousMessage: (message: string, callBack?: Function) => void;
3
3
  export declare const setBaseUrl: (publicKey: string) => void;
4
+ export declare const updateLocationUrlWithCountry: (countryIso2: string) => void;
@@ -18,3 +18,19 @@ export var setBaseUrl = function (publicKey) {
18
18
  }
19
19
  axiosInstance.defaults.baseURL = ENDPOINT_PATHS.DEV_BASE_URL;
20
20
  };
21
+ export var updateLocationUrlWithCountry = function (countryIso2) {
22
+ var country = countryIso2.toLowerCase();
23
+ var url = new URL(window.location.href);
24
+ var protocol = url.protocol;
25
+ var host = url.host;
26
+ var currentPath = url.pathname;
27
+ var search = url.search;
28
+ var hash = url.hash;
29
+ var updatedPath = '';
30
+ if (currentPath === '/')
31
+ updatedPath = "/".concat(country);
32
+ else
33
+ updatedPath = currentPath.replace(/\/[a-z]{2}\/?/i, "/".concat(country));
34
+ var newUrl = "".concat(protocol, "//").concat(host).concat(updatedPath).concat(search).concat(hash);
35
+ window.history.replaceState({}, '', newUrl);
36
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "2.6.52-test",
3
+ "version": "2.6.54-test",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",