spitfirepm 23.9000.4 → 23.9000.6

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.
@@ -145,9 +145,18 @@ declare class PartStorageData {
145
145
  * @param context
146
146
  * @param usingCfg if supplied, stored, otherwise resolved
147
147
  * @returns
148
+ * @see RegisterRestoredCFG
148
149
  */
149
150
  static PartStorageDataFactory(client: sfRestClient, partName: string, forDocType: GUID | undefined, forProject: GUID | undefined, context: string | undefined, usingCfg?: UIDisplayPart): PartStorageData;
150
- static PartStorageDataLookupFactory(client: sfRestClient, lookupName: string): PartStorageData;
151
+ /**
152
+ *
153
+ * @param client
154
+ * @param lookupName
155
+ * @param usingCfg
156
+ * @returns
157
+ * @see RegisterRestoredLookupCFG
158
+ */
159
+ static PartStorageDataLookupFactory(client: sfRestClient, lookupName: string, usingCfg?: UIDisplayPart): PartStorageData;
151
160
  static GetPartContextKey(partName: string, forDocType: GUID | undefined, forProject: GUID | undefined, context: string | undefined): PartContextKey;
152
161
  GetDataModelBuildContextKey(): string;
153
162
  protected constructor(client: sfRestClient, partName: string, forDocType: GUID | undefined, forProject: GUID | undefined, context: string | undefined);
@@ -426,6 +435,14 @@ export declare class sfRestClient {
426
435
  * @see GetPartCFG
427
436
  */
428
437
  RegisterRestoredCFG(partName: string, forDocType?: GUID, forProject?: string, partContext?: string, recoveredCFG?: UIDisplayPart): UIDisplayPart;
438
+ /**
439
+ * Tell the cfg manager about a lookup that was recovered from local storage
440
+ * @param lookupName
441
+ * @param recoveredCFG NOT optional, you are responsible for it being current
442
+ * @returns the cfg object
443
+ * @see GetPartCFG
444
+ */
445
+ RegisterRestoredLookupCFG(lookupName: string, recoveredCFG: UIDisplayPart): UIDisplayPart;
429
446
  /**
430
447
  * Async Get of Lookup column configuration data
431
448
  * @param lookupName name of required Lookup
@@ -540,7 +557,9 @@ export declare class sfRestClient {
540
557
  protected static _SessionClientGetWCC: _SessionClientGetWCCShare | null;
541
558
  protected static _SessionClientGetUCFKMap: JQueryXHR | null;
542
559
  private static _MakeFakeWCC;
543
- /** applies changes to connection properties */
560
+ /** applies changes to connection properties
561
+ * @see SharePageContext
562
+ */
544
563
  UpdateWCCData(newWCC: WCCData): WCCData;
545
564
  /**
546
565
  * For each passed URI, If page does not already have a matching SCRIPT element, adds one
@@ -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.9000.4";
11
+ const ClientPackageVersion = "23.9000.6";
12
12
  // originally modified for typescript and linter requirements by Uladzislau Kumakou of XB Software
13
13
  var LoggingLevels;
14
14
  (function (LoggingLevels) {
@@ -76,6 +76,7 @@ class PartStorageData {
76
76
  * @param context
77
77
  * @param usingCfg if supplied, stored, otherwise resolved
78
78
  * @returns
79
+ * @see RegisterRestoredCFG
79
80
  */
80
81
  static PartStorageDataFactory(client, partName, forDocType, forProject, context, usingCfg) {
81
82
  if (!forProject)
@@ -110,13 +111,28 @@ class PartStorageData {
110
111
  }
111
112
  return thisPart;
112
113
  }
113
- static PartStorageDataLookupFactory(client, lookupName) {
114
+ /**
115
+ *
116
+ * @param client
117
+ * @param lookupName
118
+ * @param usingCfg
119
+ * @returns
120
+ * @see RegisterRestoredLookupCFG
121
+ */
122
+ static PartStorageDataLookupFactory(client, lookupName, usingCfg) {
114
123
  var ReferenceKey = PartStorageData.GetPartContextKey(lookupName, "lookup", "lookup", "lookup");
115
124
  var thisPart;
116
125
  if (PartStorageData._LoadedParts.has(ReferenceKey))
117
126
  thisPart = PartStorageData._LoadedParts.get(ReferenceKey);
118
127
  else {
119
128
  thisPart = new PartStorageData(client, lookupName, "lookup", "lookup", "lookup");
129
+ if (usingCfg && usingCfg.PartName === lookupName) {
130
+ thisPart._InitializationResultPromise = new Promise((preloaded) => {
131
+ thisPart.CFG = usingCfg;
132
+ preloaded(usingCfg);
133
+ });
134
+ return thisPart;
135
+ }
120
136
  var api = new SwaggerClients_1.UICFGClient(PartStorageData._SiteURL);
121
137
  thisPart._InitializationResultPromise = api.getLookupDisplay(lookupName);
122
138
  if (thisPart._InitializationResultPromise) {
@@ -1020,6 +1036,19 @@ class sfRestClient {
1020
1036
  const thisPart = PartStorageData.PartStorageDataFactory(this, partName, forDocType, forProject, partContext, recoveredCFG);
1021
1037
  return recoveredCFG;
1022
1038
  }
1039
+ /**
1040
+ * Tell the cfg manager about a lookup that was recovered from local storage
1041
+ * @param lookupName
1042
+ * @param recoveredCFG NOT optional, you are responsible for it being current
1043
+ * @returns the cfg object
1044
+ * @see GetPartCFG
1045
+ */
1046
+ RegisterRestoredLookupCFG(lookupName, recoveredCFG) {
1047
+ if (!recoveredCFG)
1048
+ throw new Error(`RegisterRestoredCFG(${lookupName}) requires recoveredCFG object `);
1049
+ const thisPart = PartStorageData.PartStorageDataLookupFactory(this, lookupName, recoveredCFG);
1050
+ return recoveredCFG;
1051
+ }
1023
1052
  /**
1024
1053
  * Async Get of Lookup column configuration data
1025
1054
  * @param lookupName name of required Lookup
@@ -1880,17 +1909,18 @@ class sfRestClient {
1880
1909
  sfRestClient.RecentDocumentList = [new _SwaggerClientExports.MenuAction()];
1881
1910
  sfRestClient.RecentDocumentList[0].Enabled = false;
1882
1911
  sfRestClient.RecentDocumentList[0].ItemText = ' (still loading...)';
1883
- api.getRecentDocs()
1884
- .then((recentList) => {
1885
- if (recentList)
1886
- sfRestClient.RecentDocumentList = recentList;
1887
- else
1888
- sfRestClient.RecentDocumentList[0].ItemText = 'Documents will appear here as you open them';
1889
- })
1890
- .catch((reason) => {
1891
- console.warn('LoadUserSessionInfo().getRecentDocs()', reason);
1892
- sfRestClient.RecentDocumentList[0].ItemText = 'None available';
1893
- });
1912
+ if (!RESTClient.IsDocumentPage())
1913
+ api.getRecentDocs()
1914
+ .then((recentList) => {
1915
+ if (recentList)
1916
+ sfRestClient.RecentDocumentList = recentList;
1917
+ else
1918
+ sfRestClient.RecentDocumentList[0].ItemText = 'Documents will appear here as you open them';
1919
+ })
1920
+ .catch((reason) => {
1921
+ console.warn('LoadUserSessionInfo().getRecentDocs()', reason);
1922
+ sfRestClient.RecentDocumentList[0].ItemText = 'None available';
1923
+ });
1894
1924
  }
1895
1925
  if (!apiResult)
1896
1926
  console.warn("LoadUserSessionInfo failed to getWCC");
@@ -1946,7 +1976,9 @@ class sfRestClient {
1946
1976
  FakeWCC.UserKey = "00000000-0000-0000-0000-000000000000";
1947
1977
  return FakeWCC;
1948
1978
  }
1949
- /** applies changes to connection properties */
1979
+ /** applies changes to connection properties
1980
+ * @see SharePageContext
1981
+ */
1950
1982
  UpdateWCCData(newWCC) {
1951
1983
  var RESTClient = this;
1952
1984
  var ChangeList = new Map();
@@ -2346,7 +2378,7 @@ class sfRestClient {
2346
2378
  var RESTClient = this;
2347
2379
  RESTClient.heartbeat();
2348
2380
  return new Promise((resolve) => {
2349
- if (self.name === "Dashboard") {
2381
+ if (self.name.sfStartsWithCI("Dashboard")) {
2350
2382
  resolve(self);
2351
2383
  return;
2352
2384
  }
@@ -2770,7 +2802,7 @@ class sfRestClient {
2770
2802
  return ((!this.IsDocumentPage()) || (sfRestClient._WCC.DataLockFlag >= "2"));
2771
2803
  }
2772
2804
  static IsPowerUXPage() {
2773
- return location.hash.startsWith("#!") || location.pathname === "/powerux/";
2805
+ return location.hash.startsWith("#!") || location.pathname === "/wx/";
2774
2806
  }
2775
2807
  IsPowerUXPage() {
2776
2808
  return sfRestClient.IsPowerUXPage();
@@ -5149,23 +5181,23 @@ class sfRestClient {
5149
5181
  return;
5150
5182
  }
5151
5183
  if (!sfRestClient.IsPowerUXPage()) {
5152
- if (top?.sfClient.IsProjectPage()) {
5184
+ if (RESTClient.IsProjectPage()) {
5153
5185
  top?.refreshPartbyName('ProjDocSummary', 'refresh', 'afterDocumentSaved');
5154
5186
  top?.refreshPartbyName('ProjTypedDocList', 'SlctDocType', dtk);
5155
5187
  }
5156
- else if (top?.sfClient.IsHomeDashboardPage()) {
5188
+ else if (RESTClient.IsHomeDashboardPage()) {
5157
5189
  top?.refreshPartbyName('actionitems', 'refresh', 'afterDocumentSaved');
5158
5190
  }
5159
5191
  }
5160
5192
  };
5161
5193
  sfHub.client.addRecentDocument = function (dmk, title) {
5162
5194
  // this event updates the recent Document list
5163
- top?.sfClient.UpdateRecentDocumentList(dmk, title);
5195
+ RESTClient.UpdateRecentDocumentList(dmk, title);
5164
5196
  };
5165
5197
  sfHub.client.nowViewingDocument = function (target, loginSessionKey, request) {
5166
5198
  var RequestForWindowMatches = request.match(sfHub.client.ForWindowRX);
5167
5199
  console.log(`${new Date().toSFLogTimeString()} sfPMSHub: Signal.nowViewingDocument from ${loginSessionKey} to [${target}]:${request} Req4Window:${RequestForWindowMatches} `);
5168
- if (top?.sfClient.GetPageContextValue("LoginSessionKey") !== loginSessionKey) {
5200
+ if (RESTClient.GetPageContextValue("LoginSessionKey") !== loginSessionKey) {
5169
5201
  var HubEvent = jQuery.Event("sfPMSHubSignal.nowViewingDocument");
5170
5202
  $("body").trigger(HubEvent, [target, loginSessionKey, request]);
5171
5203
  if (HubEvent.isDefaultPrevented())
@@ -5493,6 +5525,8 @@ class sfRestClient {
5493
5525
  return;
5494
5526
  }
5495
5527
  const isDocumentPage = RESTClient.IsDocumentPage();
5528
+ const isPowerUXPage = sfRestClient.IsPowerUXPage();
5529
+ const isMainView = !isDocumentPage && isPowerUXPage && (location.hash.includes("/main/"));
5496
5530
  const docSessionkey = RESTClient.GetPageContextValue("DocSessionKey");
5497
5531
  const docKey = RESTClient.GetPagePK();
5498
5532
  const hasDocSessionkey = (docSessionkey && docSessionkey !== RESTClient.EmptyKey);
@@ -5516,7 +5550,7 @@ class sfRestClient {
5516
5550
  sfRestClient.PageServerPingAttempts++;
5517
5551
  if (hasWebsocketConnection)
5518
5552
  top.sfPMSHub.server.sessionAlive();
5519
- if (RESTClient.IsDocumentPage() && sfRestClient.IsPowerUXPage()) {
5553
+ if (isDocumentPage && isPowerUXPage) {
5520
5554
  try {
5521
5555
  let $DocUI = RESTClient.GetPowerUXDocumentUI();
5522
5556
  let DocModel = RESTClient.GetPageDocumentModel();
@@ -5657,6 +5691,29 @@ class sfRestClient {
5657
5691
  // how to recover??
5658
5692
  }
5659
5693
  }
5694
+ else if (isMainView) {
5695
+ if (top.name !== "Dashboard") {
5696
+ const bc = new BroadcastChannel("sfAuth");
5697
+ const assertMe = setTimeout(() => {
5698
+ console.log('Asserting this is main Dashboard...');
5699
+ top.name = "Dashboard";
5700
+ }, 1234);
5701
+ bc.onmessage = function (event) {
5702
+ // we never receive our own broadcast
5703
+ const eventMessage = event.data;
5704
+ console.log(`BroadcastChannel.pingServer:${eventMessage.event}`, event);
5705
+ if (eventMessage.event === "PongWindowByName") { //PingWindowByName
5706
+ if (eventMessage.context === "Dashboard") {
5707
+ // this means there is already a dashboard
5708
+ console.log('Pong from Dashboard...');
5709
+ clearTimeout(assertMe);
5710
+ }
5711
+ }
5712
+ }; // BroadcastChannel message handling --------- ^^
5713
+ bc.postMessage({ event: "PingWindowByName", context: "Dashboard", payload: false });
5714
+ // we either get a response or take over as Dashboard
5715
+ }
5716
+ }
5660
5717
  self.sfPMSHub.server.dashboardHeartbeat(pdsKey, sfRestClient.PageNotificationCount)
5661
5718
  .then(async (responseText) => {
5662
5719
  if (responseText > "") {