spitfirepm 23.8774.2 → 23.8780.2

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.
@@ -356,7 +356,7 @@ export declare class sfRestClient {
356
356
  * Get Display Value using DV-Name and key value, with 0 to 4 dependencies.
357
357
  * @param displayName the name of a display value rule (eg sfUser, RoleName, etc)
358
358
  * @param keyValue the primary or most significant key
359
- * @param dependsOn optional array of context values (multi-part key); 0 to 4 elements allowed
359
+ * @param dependsOn optional array of context values (multi-part key); 0 to 4 elements allowed; hint: use 'empty' for an empty value
360
360
  * @param autoVary force bypass of cache
361
361
  * @returns Promise for String
362
362
  */
@@ -487,6 +487,7 @@ export declare class sfRestClient {
487
487
  * @param locationHash when omitted, location.toString is used
488
488
  */
489
489
  LoadUserSessionInfo(bypassCache?: boolean, newHref?: string): Promise<WCCData>;
490
+ IsLoginRelatedPage(): boolean;
490
491
  protected static _SessionClientGetWCC: _SessionClientGetWCCShare | null;
491
492
  protected static _SessionClientGetUCFKMap: JQueryXHR | null;
492
493
  private static _MakeFakeWCC;
@@ -790,6 +791,7 @@ export declare class sfRestClient {
790
791
  * @param hashCode help with getting freshest
791
792
  */
792
793
  DisplaySysNotification(hashCode: string | number, timeOutMS?: number): Promise<JQuery<HTMLElement>>;
794
+ private lastNotificationCheckPromise;
793
795
  /** Checks backend for a new system notification and displays it */
794
796
  CheckForSystemNotification(): void;
795
797
  private static lastNotificationCheck;
@@ -993,6 +995,7 @@ export declare class sfRestClient {
993
995
  * Called by the global instance to connect to SignalR
994
996
  */
995
997
  protected static StartSignalRClientHub(): void;
998
+ NavigateToServerUnavailable(reason: string, delayMs?: number): void;
996
999
  NavigateToLogout(reason: string, delayMs?: number): void;
997
1000
  private _navigateToLogoutTimerEvent;
998
1001
  protected static LogoutPageURL(mValue: string): string;
@@ -8,7 +8,7 @@ const BrowserExtensionChecker_1 = require("./BrowserExtensionChecker");
8
8
  const RESTClientBase = require("./APIClientBase"); // avoid conflict with same in SwaggerClient when loaded by classic UI
9
9
  const string_extensions_1 = require("./string.extensions");
10
10
  //import {dialog} from "jquery-ui";
11
- const ClientPackageVersion = "23.8774.2";
11
+ const ClientPackageVersion = "23.8780.2";
12
12
  // originally modified for typescript and linter requirements by Uladzislau Kumakou
13
13
  var LoggingLevels;
14
14
  (function (LoggingLevels) {
@@ -848,7 +848,7 @@ class sfRestClient {
848
848
  * Get Display Value using DV-Name and key value, with 0 to 4 dependencies.
849
849
  * @param displayName the name of a display value rule (eg sfUser, RoleName, etc)
850
850
  * @param keyValue the primary or most significant key
851
- * @param dependsOn optional array of context values (multi-part key); 0 to 4 elements allowed
851
+ * @param dependsOn optional array of context values (multi-part key); 0 to 4 elements allowed; hint: use 'empty' for an empty value
852
852
  * @param autoVary force bypass of cache
853
853
  * @returns Promise for String
854
854
  */
@@ -1806,7 +1806,7 @@ class sfRestClient {
1806
1806
  * @param locationHash when omitted, location.toString is used
1807
1807
  */
1808
1808
  LoadUserSessionInfo(bypassCache, newHref) {
1809
- var RESTClient = this;
1809
+ const RESTClient = this;
1810
1810
  var api;
1811
1811
  var apiResult = null;
1812
1812
  sfRestClient._z.WCCLoaded = false; // required to make CheckPermit() (etc) wait for this to complete
@@ -1868,13 +1868,7 @@ class sfRestClient {
1868
1868
  console.log(`LoadUserSessionInfo(getWCC) catch`, x);
1869
1869
  if (RESTClient.IsRESTErrorResponse(x)) {
1870
1870
  if (x.ThisStatus === 401) {
1871
- let IsLoginRelatedPage = sfRestClient.NextHrefIsPending && sfRestClient.NextHrefIsUnauthenticated;
1872
- if (!IsLoginRelatedPage && RESTClient.IsPageOfType(RESTClient.PageTypeNames.UnauthenticatedLogin))
1873
- IsLoginRelatedPage = true;
1874
- if (!IsLoginRelatedPage && RESTClient.IsPageOfType(RESTClient.PageTypeNames.UserAccountRecovery))
1875
- IsLoginRelatedPage = true;
1876
- if (!IsLoginRelatedPage && RESTClient.IsPageOfType(RESTClient.PageTypeNames.UnauthenticatedDefault))
1877
- IsLoginRelatedPage = true;
1871
+ let IsLoginRelatedPage = RESTClient.IsLoginRelatedPage();
1878
1872
  if (!IsLoginRelatedPage && (top?.name === "Dashboard" || this.IsHomeDashboardPage())) { // do we need more here?
1879
1873
  // goal is to not redirect document pages, etc
1880
1874
  if (sfRestClient._Options.LogLevel >= LoggingLevels.None)
@@ -1888,6 +1882,17 @@ class sfRestClient {
1888
1882
  });
1889
1883
  });
1890
1884
  }
1885
+ IsLoginRelatedPage() {
1886
+ const RESTClient = this;
1887
+ let IsLoginRelatedPage = sfRestClient.NextHrefIsPending && sfRestClient.NextHrefIsUnauthenticated;
1888
+ if (!IsLoginRelatedPage && RESTClient.IsPageOfType(RESTClient.PageTypeNames.UnauthenticatedLogin))
1889
+ IsLoginRelatedPage = true;
1890
+ if (!IsLoginRelatedPage && RESTClient.IsPageOfType(RESTClient.PageTypeNames.UserAccountRecovery))
1891
+ IsLoginRelatedPage = true;
1892
+ if (!IsLoginRelatedPage && RESTClient.IsPageOfType(RESTClient.PageTypeNames.UnauthenticatedDefault))
1893
+ IsLoginRelatedPage = true;
1894
+ return IsLoginRelatedPage;
1895
+ }
1891
1896
  static _MakeFakeWCC() {
1892
1897
  let FakeWCC = new WCCData();
1893
1898
  FakeWCC.AdminLevel = 0;
@@ -3731,7 +3736,14 @@ class sfRestClient {
3731
3736
  const thisRestClient = this;
3732
3737
  if ((Date.now() - sfRestClient.lastNotificationCheck) < 34567)
3733
3738
  return;
3734
- SystemAPI.getSystemNotification("")
3739
+ if (thisRestClient.lastNotificationCheckPromise !== null) {
3740
+ if (thisRestClient.DevMode())
3741
+ console.log("Prior notification check still pending...");
3742
+ return;
3743
+ }
3744
+ ;
3745
+ thisRestClient.lastNotificationCheckPromise = SystemAPI.getSystemNotification("");
3746
+ thisRestClient.lastNotificationCheckPromise
3735
3747
  .then((theNotification) => {
3736
3748
  if (theNotification)
3737
3749
  thisRestClient.DisplaySysNotification(theNotification.sfHashCode().toString());
@@ -3744,6 +3756,8 @@ class sfRestClient {
3744
3756
  if ("status" in reason && reason.status > 500) {
3745
3757
  // DisplayThisNotification() requiers a functional server
3746
3758
  if (thisRestClient.isWebix()) {
3759
+ if (this.IsLoginRelatedPage())
3760
+ thisRestClient.NavigateToServerUnavailable(showMsg);
3747
3761
  const m = {
3748
3762
  text: showMsg,
3749
3763
  type: 'debug',
@@ -3758,6 +3772,7 @@ class sfRestClient {
3758
3772
  }
3759
3773
  })
3760
3774
  .finally(() => {
3775
+ thisRestClient.lastNotificationCheckPromise = null;
3761
3776
  sfRestClient.lastNotificationCheck = Date.now();
3762
3777
  });
3763
3778
  }
@@ -5337,6 +5352,11 @@ class sfRestClient {
5337
5352
  });
5338
5353
  }
5339
5354
  }
5355
+ NavigateToServerUnavailable(reason, delayMs = 222) {
5356
+ const RESTClient = this;
5357
+ const url = `${RESTClient._SiteRootURL}/wx/#!/server-unavailable`;
5358
+ setTimeout(`top.location="${url}";`, delayMs);
5359
+ }
5340
5360
  NavigateToLogout(reason, delayMs = 222) {
5341
5361
  if (this._navigateToLogoutTimerEvent) {
5342
5362
  console.log(`${new Date().toSFLogTimeString()} NavigateToLogout already pending, redundant ${reason} ignored...`);
@@ -6048,6 +6068,7 @@ class sfRestClient {
6048
6068
  this.rxPopWhatURL = new RegExp(/javascript:(?<popWhat>PopMSWindowTool|PopXLTool|PopAuditTool|popWin|popNewDoc)\(['"`](?<URL>.+?)[`'"](,|\))(['"`](?<TARGET>.+?)[`'"](,|\)))?(['"`](?<OPTIONS>.+?)[`'"](,|\)))?/gmi);
6049
6069
  this.rxPopWindowName = new RegExp(/javascript:(?<popWhat>popWin)\(['"`](?<URL>.+?)[`'"],\s?['"`](?<WindowName>.+?)[`'"],.*\)/gmi);
6050
6070
  this.rxOfficeLink = new RegExp(/(?<popWhat>OfficeLink.application|(PopXLTool|PopFVC|PopMSWindowTool|PopAuditTool)\()/gmi);
6071
+ this.lastNotificationCheckPromise = null;
6051
6072
  this._LookupViewPortAdjustments = { outsidExtraW: 48, outsidExtraH: 64, vpExtraW: 16, vpExtraH: 32, frameExtraH: 8 };
6052
6073
  //var $LookupFrame = $($LookupDialog.children("iframe").get(0))
6053
6074
  this.DialogViewPortAdjustments = { outsidExtraW: 65, outsidExtraH: 64, vpExtraW: 16, vpExtraH: 32, frameExtraH: 8 };