acsi-core 1.1.3 → 1.2.1

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.
@@ -86,6 +86,7 @@ var COLORS = {
86
86
  };
87
87
  var ORGANIZATION_TENANT = "ORGANIZATION_TENANT";
88
88
  var ORGANIZATION_TEAM = "ORGANIZATION_TEAM";
89
+ var TIMEZONE_ID = "TIMEZONE_ID";
89
90
 
90
91
  var styleGlobal = {"signup_wrap":"_1KLz9","box-signin":"_2Jo1o","signin_title":"_3egBO","signup_link":"_1DoIT","google_button":"_34hK_","microsoft_button":"_19ESb","box-field":"_2e9xO","box-input":"_3zXRp","box-text":"_8NJga","box-button-email":"_21FPk","box-signin-container":"_1QERu","box-signin-text":"_2-znH","box-signin-logo":"_1aB2m","box-right":"_3qndF","image-slideshow":"_1aM7m","active":"_Vx1zf","box-right-body":"_JzdCr","box-right-footer":"_19aCA","pr-30":"_2HB5r","width-400":"_4ehXP"};
91
92
 
@@ -1712,6 +1713,7 @@ var apiUpload = axios.create({
1712
1713
  var domain = parts.slice(-2).join('.');
1713
1714
  localStorage.removeItem(ACCESS_TOKEN);
1714
1715
  localStorage.removeItem(ORGANIZATION_TENANT);
1716
+ localStorage.removeItem(TIMEZONE_ID);
1715
1717
  localStorage.removeItem(ORGANIZATION_TEAM);
1716
1718
  Cookies.remove('auth', {
1717
1719
  path: '/',
@@ -1934,7 +1936,8 @@ var BlockLogin = function BlockLogin(_ref) {
1934
1936
  });
1935
1937
  var fnLoginMicrosoft = function fnLoginMicrosoft() {
1936
1938
  try {
1937
- var msalInstance = new PublicClientApplication(msalConfig(MICROSOFT_CLIENT_ID, MICROSOFT_URL_DIRECT));
1939
+ var redirectUri = window.location.origin + "/auth-redirect.html";
1940
+ var msalInstance = new PublicClientApplication(msalConfig(MICROSOFT_CLIENT_ID, redirectUri));
1938
1941
  if (!msalInstance) {
1939
1942
  console.error("MSAL instance not initialized");
1940
1943
  return Promise.resolve();
@@ -1942,7 +1945,8 @@ var BlockLogin = function BlockLogin(_ref) {
1942
1945
  return Promise.resolve(_catch(function () {
1943
1946
  return Promise.resolve(msalInstance.initialize()).then(function () {
1944
1947
  var loginRequest = {
1945
- scopes: ["openid", "profile", "email"]
1948
+ scopes: ["openid", "profile", "email"],
1949
+ redirectUri: redirectUri
1946
1950
  };
1947
1951
  var silentRequest = _extends({}, loginRequest, {
1948
1952
  prompt: "select_account"
@@ -3464,8 +3468,23 @@ var CustomSelectOption = function CustomSelectOption(_ref) {
3464
3468
 
3465
3469
  var utcToLocalTime = (function (time, FORMAT) {
3466
3470
  if (time === DATE_MIN_VALUE || time == null) return "";
3471
+ var timezone = localStorage.getItem(TIMEZONE_ID) || "";
3467
3472
  try {
3468
- return moment.utc(time).local().format(FORMAT || "yyyy-MM-DD");
3473
+ if (!timezone) {
3474
+ return moment.utc(time).local().format(FORMAT || "yyyy-MM-DD");
3475
+ }
3476
+ var isOffset = /^(UTC|GMT)?[+-]/.test(timezone);
3477
+ if (isOffset) {
3478
+ var cleanOffset = timezone.replace(/UTC|GMT/gi, "").trim();
3479
+ var offsetMinutes;
3480
+ if (/^[+-]?\d+$/.test(cleanOffset)) {
3481
+ offsetMinutes = parseInt(cleanOffset, 10) * 60;
3482
+ } else {
3483
+ offsetMinutes = cleanOffset;
3484
+ }
3485
+ return moment.utc(time).utcOffset(offsetMinutes).format(FORMAT || "yyyy-MM-DD");
3486
+ }
3487
+ return moment.utc(time).tz(timezone).format(FORMAT || "yyyy-MM-DD");
3469
3488
  } catch (_unused) {
3470
3489
  return "";
3471
3490
  }
@@ -3482,23 +3501,22 @@ var timeSpanToLocalMoment = (function (time, timezone) {
3482
3501
  }
3483
3502
  var dateTime;
3484
3503
  var isOffset = /^(UTC|GMT)?[+-]/.test(timezone);
3485
- console.log({
3486
- isOffset: isOffset
3487
- });
3488
3504
  if (isOffset) {
3489
3505
  var cleanOffset = timezone.replace(/UTC|GMT/gi, '').trim();
3490
- console.log({
3491
- cleanOffset: cleanOffset
3492
- });
3493
- dateTime = moment$1.utc(time, "HH:mm:ss").utcOffset(cleanOffset, true);
3506
+ var offsetMinutes;
3507
+ if (/^[+-]?\d+$/.test(cleanOffset)) {
3508
+ offsetMinutes = parseInt(cleanOffset, 10) * 60;
3509
+ } else {
3510
+ offsetMinutes = cleanOffset;
3511
+ }
3512
+ dateTime = moment$1.utc(time, "HH:mm:ss").utcOffset(offsetMinutes);
3494
3513
  } else {
3495
- dateTime = moment$1.tz(time, "HH:mm:ss", timezone);
3514
+ dateTime = moment$1.utc(time, "HH:mm:ss").tz(timezone);
3496
3515
  }
3497
- console.log("run time", dateTime.format("HH:mm:ss"), timezone);
3498
3516
  return dateTime;
3499
3517
  });
3500
3518
 
3501
3519
  var historyCore = createBrowserHistory();
3502
3520
 
3503
- export { ACCESS_TOKEN, AmplitudeEvent, BASE_URL, CommonDialog, ConfirmDialog, CoreButton, CoreInput$1 as CoreCheckbox, CoreError, CoreInput, CoreInputCompact, CoreModal, CoreRadio, CoreRange, CoreSearch, CoreSelect, CoreSelectCompact, CoreTextArea, CoreTitleInput, CoreTooltip, CustomAsyncSelect, CustomCreatable, CustomPagination, CustomSelect, CustomSelectOption, DATE_TIME_MIN_VALUE, LayoutContext, Loading, Login, MarkdownRenderer as MarkdownLatexRender, NotFound, OPENSALT_BASE_URL, ORGANIZATION_TEAM, ORGANIZATION_TENANT, Role, api, apiUpload, firstCheckToken, getAccessToken, getErrorMessage, getImageUrl, historyCore, initSentry, initializeAmplitude, setAddTenant, setAlert, setIsFirstCalendar, setIsRefetchSidebar, setLoading, setLoadingPage, setMenuCollapse, setTeam, setTenant, setUser, store, timeSpanToLocalMoment, useAmplitude, useGoogleSignOut, utcToLocalTime };
3521
+ export { ACCESS_TOKEN, AmplitudeEvent, BASE_URL, CommonDialog, ConfirmDialog, CoreButton, CoreInput$1 as CoreCheckbox, CoreError, CoreInput, CoreInputCompact, CoreModal, CoreRadio, CoreRange, CoreSearch, CoreSelect, CoreSelectCompact, CoreTextArea, CoreTitleInput, CoreTooltip, CustomAsyncSelect, CustomCreatable, CustomPagination, CustomSelect, CustomSelectOption, DATE_TIME_MIN_VALUE, LayoutContext, Loading, Login, MarkdownRenderer as MarkdownLatexRender, NotFound, OPENSALT_BASE_URL, ORGANIZATION_TEAM, ORGANIZATION_TENANT, Role, TIMEZONE_ID, api, apiUpload, firstCheckToken, getAccessToken, getErrorMessage, getImageUrl, historyCore, initSentry, initializeAmplitude, setAddTenant, setAlert, setIsFirstCalendar, setIsRefetchSidebar, setLoading, setLoadingPage, setMenuCollapse, setTeam, setTenant, setUser, store, timeSpanToLocalMoment, useAmplitude, useGoogleSignOut, utcToLocalTime };
3504
3522
  //# sourceMappingURL=index.modern.js.map