acsi-core 1.2.42 → 1.2.43

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.
@@ -159,9 +159,6 @@ function _catch(body, recover) {
159
159
  return result;
160
160
  }
161
161
 
162
- var _process$env$PUBLIC_U;
163
- var PUBLIC_URL = (_process$env$PUBLIC_U = process.env.PUBLIC_URL) != null ? _process$env$PUBLIC_U : '';
164
-
165
162
  var styles = {"core-button":"_xvNBN","primary":"_U9Qyp","secondary":"_1VzMy","text":"_pZNuj","danger":"_2uYm1","light":"_wxH5S"};
166
163
 
167
164
  var _excluded = ["type", "children", "onClick", "icon", "disabled", "htmlType"];
@@ -1733,9 +1730,9 @@ var apiUpload = axios.create({
1733
1730
  if (imPersonate) {
1734
1731
  config.headers.ImPersonate = imPersonate;
1735
1732
  }
1736
- var tenantId = config.externalTenantId || localStorage.getItem(ORGANIZATION_TENANT);
1733
+ var tenantId = localStorage.getItem(ORGANIZATION_TENANT);
1737
1734
  if (tenantId) {
1738
- config.headers["X-TenantID"] = tenantId;
1735
+ config.headers["X-TenantId"] = tenantId;
1739
1736
  }
1740
1737
  return config;
1741
1738
  }, function (error) {
@@ -1744,39 +1741,63 @@ var apiUpload = axios.create({
1744
1741
  });
1745
1742
  [api, apiUpload].forEach(function (i) {
1746
1743
  return i.interceptors.response.use(function (response) {
1744
+ if (response.data && response.data.message === "RedirectToTenantDomain" && response.data.redirectDomain) {
1745
+ var token = localStorage.getItem(ACCESS_TOKEN) || "";
1746
+ var redirectUrl = response.data.redirectDomain;
1747
+ if (!/^https?:\/\//i.test(redirectUrl)) {
1748
+ redirectUrl = window.location.protocol + "//" + redirectUrl;
1749
+ }
1750
+ redirectUrl = redirectUrl.replace(/\/$/, "");
1751
+ window.location.href = redirectUrl + "/login?token=" + encodeURIComponent(token);
1752
+ return new Promise(function () {});
1753
+ }
1747
1754
  return response;
1748
1755
  }, function (error) {
1749
- if (error.response.status === 401) {
1750
- window.location.href = "/login";
1751
- }
1752
- if (error.response.status == 403) {
1753
- var hostname = window.location.hostname;
1754
- var parts = hostname.split('.');
1755
- var domain = parts.slice(-2).join('.');
1756
- localStorage.removeItem(ACCESS_TOKEN);
1757
- localStorage.removeItem(ORGANIZATION_TENANT);
1758
- localStorage.removeItem(TIMEZONE_ID);
1759
- localStorage.removeItem(ORGANIZATION_TEAM);
1760
- Cookies.remove('auth', {
1761
- path: '/',
1762
- domain: "." + domain
1763
- });
1764
- localStorage.removeItem("USER_EMAIL");
1765
- window.location.href = "/login";
1756
+ if (error.response && error.response.data) {
1757
+ var data = error.response.data;
1758
+ if (data.message === "RedirectToTenantDomain" && data.redirectDomain) {
1759
+ var token = localStorage.getItem(ACCESS_TOKEN) || "";
1760
+ var redirectUrl = data.redirectDomain;
1761
+ if (!/^https?:\/\//i.test(redirectUrl)) {
1762
+ redirectUrl = window.location.protocol + "//" + redirectUrl;
1763
+ }
1764
+ redirectUrl = redirectUrl.replace(/\/$/, "");
1765
+ window.location.href = redirectUrl + "/login?token=" + encodeURIComponent(token);
1766
+ return new Promise(function () {});
1767
+ }
1768
+ }
1769
+ if (error.response) {
1770
+ if (error.response.status === 401) {
1771
+ window.location.href = "/login";
1772
+ }
1773
+ if (error.response.status == 403) {
1774
+ var hostname = window.location.hostname;
1775
+ var parts = hostname.split('.');
1776
+ var domain = parts.slice(-2).join('.');
1777
+ localStorage.removeItem(ACCESS_TOKEN);
1778
+ localStorage.removeItem(ORGANIZATION_TENANT);
1779
+ localStorage.removeItem(TIMEZONE_ID);
1780
+ localStorage.removeItem(ORGANIZATION_TEAM);
1781
+ Cookies.remove('auth', {
1782
+ path: '/',
1783
+ domain: "." + domain
1784
+ });
1785
+ localStorage.removeItem("USER_EMAIL");
1786
+ window.location.href = "/login";
1787
+ }
1766
1788
  }
1767
1789
  return Promise.reject(error);
1768
1790
  });
1769
1791
  });
1770
1792
 
1771
- var IDP_URL = "" + process.env.REACT_APP_IDP_API_URL;
1772
1793
  var apiLoginGoogle = function apiLoginGoogle(body) {
1773
- return api.post(IDP_URL + "/api/Auth/login", body);
1794
+ return api.post(BASE_URL + "/api/Auth/login", body);
1774
1795
  };
1775
1796
  var apiSendEmailCode = function apiSendEmailCode(body) {
1776
- return api.post(IDP_URL + "/api/Auth/send-code-email", body);
1797
+ return api.post(BASE_URL + "/api/Auth/send-code-email", body);
1777
1798
  };
1778
1799
  var apiCheckEmailCode = function apiCheckEmailCode(params) {
1779
- return api.get(IDP_URL + "/api/Auth/check-code-email", {
1800
+ return api.get(BASE_URL + "/api/Auth/check-code-email", {
1780
1801
  params: params
1781
1802
  });
1782
1803
  };
@@ -1873,8 +1894,6 @@ var BlockLogin = function BlockLogin(_ref) {
1873
1894
  var _useState5 = useState(0),
1874
1895
  currentImageIndex = _useState5[0],
1875
1896
  setCurrentImageIndex = _useState5[1];
1876
- var search = new URLSearchParams(window.location.search);
1877
- var returnUrl = search.get("returnUrl") || "";
1878
1897
  var handleGetImage = function handleGetImage() {
1879
1898
  try {
1880
1899
  var _temp = _catch(function () {
@@ -1965,7 +1984,7 @@ var BlockLogin = function BlockLogin(_ref) {
1965
1984
  dispatch(setLoading(false));
1966
1985
  }
1967
1986
  localStorage.setItem(ACCESS_TOKEN, tokenJWT);
1968
- onNavigate(returnUrl || "/dashboard");
1987
+ onNavigate("/dashboard");
1969
1988
  dispatch(setLoading(false));
1970
1989
  });
1971
1990
  }
@@ -2048,11 +2067,11 @@ var BlockLogin = function BlockLogin(_ref) {
2048
2067
  }
2049
2068
  };
2050
2069
  var redirectUrl = getRedirectUrl(authResult.data.role);
2051
- window.location.href = redirectUrl + " " + (returnUrl || "/dashboard");
2070
+ window.location.href = redirectUrl + "/dashboard";
2052
2071
  dispatch(setLoading(false));
2053
2072
  }
2054
2073
  localStorage.setItem(ACCESS_TOKEN, tokenJWT);
2055
- onNavigate(returnUrl || "/dashboard");
2074
+ onNavigate("/dashboard");
2056
2075
  dispatch(setLoading(false));
2057
2076
  });
2058
2077
  }
@@ -2145,7 +2164,7 @@ var BlockLogin = function BlockLogin(_ref) {
2145
2164
  to: "/",
2146
2165
  className: "d-flex"
2147
2166
  }, React.createElement("img", {
2148
- src: PUBLIC_URL + "/images/Logo.png",
2167
+ src: "/images/Logo.png",
2149
2168
  alt: "",
2150
2169
  height: 37,
2151
2170
  width: 155,
@@ -2172,7 +2191,7 @@ var BlockLogin = function BlockLogin(_ref) {
2172
2191
  width: 24,
2173
2192
  height: 24,
2174
2193
  alt: "Google sign-in",
2175
- src: PUBLIC_URL + "/images/icons/Google__G__logo.png"
2194
+ src: "/images/icons/Google__G__logo.png"
2176
2195
  }), "Sign in with Google")), MICROSOFT_SSO_ENABLED === "true" && React.createElement("div", {
2177
2196
  className: "" + styleGlobal["microsoft_button"]
2178
2197
  }, React.createElement("button", {
@@ -2183,7 +2202,7 @@ var BlockLogin = function BlockLogin(_ref) {
2183
2202
  width: 24,
2184
2203
  height: 24,
2185
2204
  alt: "Google sign-in",
2186
- src: PUBLIC_URL + "/images/Single-Sign-On-logo.png"
2205
+ src: "/images/Single-Sign-On-logo.png"
2187
2206
  }), "Sign in with Microsoft")), React.createElement("span", {
2188
2207
  className: "" + styleGlobal["box-field"]
2189
2208
  }, "OR"), React.createElement("div", {
@@ -2203,7 +2222,7 @@ var BlockLogin = function BlockLogin(_ref) {
2203
2222
  width: 20,
2204
2223
  height: 20,
2205
2224
  alt: "Email sign-in",
2206
- src: PUBLIC_URL + "/images/icons/Login_icon.png"
2225
+ src: "/images/icons/Login_icon.png"
2207
2226
  }), "Sign in with Email")), React.createElement("div", {
2208
2227
  className: styleGlobal["box-signin-text"] + " "
2209
2228
  }, React.createElement("span", {
@@ -2237,7 +2256,7 @@ var BlockLogin = function BlockLogin(_ref) {
2237
2256
  }))) : React.createElement("div", {
2238
2257
  className: "" + styleGlobal["box-right"],
2239
2258
  style: {
2240
- backgroundImage: "url('" + PUBLIC_URL + "/images/bg_login.png')"
2259
+ backgroundImage: "url('/images/bg_login.png')"
2241
2260
  }
2242
2261
  }, React.createElement("div", {
2243
2262
  className: "" + styleGlobal["box-right-body"]
@@ -2266,7 +2285,7 @@ var BlockLogin = function BlockLogin(_ref) {
2266
2285
  }, React.createElement("img", {
2267
2286
  className: "img-fluid",
2268
2287
  alt: "",
2269
- src: PUBLIC_URL + "/images/image_login.png",
2288
+ src: "/images/image_login.png",
2270
2289
  style: {
2271
2290
  width: "15vw"
2272
2291
  }
@@ -2277,7 +2296,7 @@ var BlockLogin = function BlockLogin(_ref) {
2277
2296
  marginTop: "-15px"
2278
2297
  },
2279
2298
  alt: "",
2280
- src: PUBLIC_URL + "/images/icons/Vector 22.png"
2299
+ src: "/images/icons/Vector 22.png"
2281
2300
  }))))))), role === "LandingPage" && React.createElement(Col, {
2282
2301
  sm: 12,
2283
2302
  lg: 5,
@@ -2285,7 +2304,7 @@ var BlockLogin = function BlockLogin(_ref) {
2285
2304
  }, React.createElement("div", {
2286
2305
  className: "" + styleGlobal["box-right"],
2287
2306
  style: {
2288
- backgroundImage: "url('" + PUBLIC_URL + "/images/bg_login.png')"
2307
+ backgroundImage: "url('/images/bg_login.png')"
2289
2308
  }
2290
2309
  }, React.createElement("div", {
2291
2310
  className: "" + styleGlobal["box-right-body"]
@@ -2314,7 +2333,7 @@ var BlockLogin = function BlockLogin(_ref) {
2314
2333
  }, React.createElement("img", {
2315
2334
  className: "img-fluid",
2316
2335
  alt: "",
2317
- src: PUBLIC_URL + "/images/image_login.png",
2336
+ src: "/images/image_login.png",
2318
2337
  style: {
2319
2338
  width: "15vw"
2320
2339
  }
@@ -2325,7 +2344,7 @@ var BlockLogin = function BlockLogin(_ref) {
2325
2344
  marginTop: "-15px"
2326
2345
  },
2327
2346
  alt: "",
2328
- src: PUBLIC_URL + "/images/icons/Vector 22.png"
2347
+ src: "/images/icons/Vector 22.png"
2329
2348
  })))))))), React.createElement(Modal, {
2330
2349
  isOpen: isScreenCode,
2331
2350
  toggle: function toggle() {
@@ -2451,8 +2470,6 @@ var useLogin = function useLogin(onNavigate, trackEvent) {
2451
2470
  var _useState6 = useState(minutes * 60),
2452
2471
  timeLeft = _useState6[0],
2453
2472
  setTimeLeft = _useState6[1];
2454
- var search = new URLSearchParams(window.location.search);
2455
- var returnUrl = search.get("returnUrl") || "/dashboard";
2456
2473
  var loginWithEmail = function loginWithEmail(role) {
2457
2474
  try {
2458
2475
  var _temp2 = function _temp2() {
@@ -2519,9 +2536,9 @@ var useLogin = function useLogin(onNavigate, trackEvent) {
2519
2536
  if ((_data$data$roles = data.data.roles) !== null && _data$data$roles !== void 0 && _data$data$roles.includes("Admin")) {
2520
2537
  domain = ADMIN_ORIGIN;
2521
2538
  }
2522
- window.location.href = "" + domain + (returnUrl || "/dashboard");
2539
+ window.location.href = domain + "/dashboard";
2523
2540
  } else {
2524
- onNavigate(returnUrl || "/dashboard");
2541
+ onNavigate("/dashboard");
2525
2542
  }
2526
2543
  } else {
2527
2544
  toast.error("The code is not correct. Please check again.");