spitfirepm 1.20.93 → 1.20.97

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.
@@ -101,6 +101,10 @@ export declare class WCCData {
101
101
  export declare class DataModelRow {
102
102
  [key: string]: any;
103
103
  }
104
+ export declare class InvokeOptions {
105
+ ByTask: boolean | undefined;
106
+ ByAcct: boolean | undefined;
107
+ }
104
108
  export declare class DataModelCollection {
105
109
  [key: string]: any;
106
110
  }
@@ -413,6 +417,7 @@ export declare class sfRestClient {
413
417
  IsDocExclusiveToMe(): boolean;
414
418
  IsPowerUXPage(): boolean;
415
419
  IsHomeDashboardPage(): boolean;
420
+ IsCatalogPage(): boolean;
416
421
  IsDocumentPage(): boolean;
417
422
  IsProjectPage(): boolean;
418
423
  /** @deprecated use IsPageOfType() */
@@ -444,11 +449,11 @@ export declare class sfRestClient {
444
449
  *
445
450
  * Actions Supported
446
451
  * - vPgPopup(...)
447
- * - PopDoc(...)
448
- * - PopTXHistory(...)
452
+ * - PopDoc(...) and PopNewDoc
453
+ * - PopTXHistory(...) and PopBFAHistory()
449
454
  * - Nav To (dcmodules and admin tools)
450
455
  */
451
- InvokeAction(actionString: string | _SwaggerClientExports.MenuAction, rowData?: DataModelRow): void;
456
+ InvokeAction(actionString: string | _SwaggerClientExports.MenuAction, rowData?: DataModelRow, options?: InvokeOptions): void;
452
457
  /** Creates an exchange token and calls OpenWindowsLinkHelper() */
453
458
  FollowLinkViaSFLink(targetURL: string, afterOpenArg?: boolean | string | [string, string] | Function, autoCloseDoc?: boolean): void;
454
459
  /**
@@ -1,13 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.sfRestClient = exports.DataModelCollection = exports.DataModelRow = exports.WCCData = exports.NVPair = exports.LoggingLevels = void 0;
3
+ exports.sfRestClient = exports.DataModelCollection = exports.InvokeOptions = exports.DataModelRow = exports.WCCData = exports.NVPair = exports.LoggingLevels = void 0;
4
4
  //import { sfApplicationRootPath } from "./string.extensions";
5
5
  const SwaggerClients_1 = require("./SwaggerClients");
6
6
  const _SwaggerClientExports = require("./SwaggerClients");
7
7
  const $ = require("jquery");
8
8
  const BrowserExtensionChecker_1 = require("./BrowserExtensionChecker");
9
9
  //import {dialog} from "jquery-ui";
10
- const ClientPackageVersion = "1.20.93";
10
+ const ClientPackageVersion = "1.20.97";
11
11
  // original script created by Stan York and modified for typescript and linter requirements by Uladzislau Kumakou
12
12
  var LoggingLevels;
13
13
  (function (LoggingLevels) {
@@ -47,7 +47,7 @@ class PartStorageData {
47
47
  PartStorageData._LoadedParts.set(this._ReferenceKey, this);
48
48
  this._InitializationResultPromise = null;
49
49
  if (!PartStorageData._SiteURL) {
50
- var ApplicationPath = window.location.pathname.substring(1, window.location.pathname.substring(1).indexOf("/") + 1);
50
+ var ApplicationPath = window.__HTTPApplicationName();
51
51
  PartStorageData._SiteURL = `${window.location.origin}/${ApplicationPath || 'sfPMS'}`;
52
52
  }
53
53
  }
@@ -207,6 +207,10 @@ class DataModelRow {
207
207
  }
208
208
  exports.DataModelRow = DataModelRow;
209
209
  ;
210
+ class InvokeOptions {
211
+ }
212
+ exports.InvokeOptions = InvokeOptions;
213
+ ;
210
214
  class DataModelCollection {
211
215
  }
212
216
  exports.DataModelCollection = DataModelCollection;
@@ -335,7 +339,7 @@ class sfRestClient {
335
339
  this.EmptyKey = "00000000-0000-0000-0000-000000000000";
336
340
  this._CachedDVRequests = new Map();
337
341
  this.ThisInstanceID = sfRestClient.InstanceSerialNumberSource++;
338
- var ApplicationPath = window.location.pathname.substring(1, window.location.pathname.substring(1).indexOf("/") + 1);
342
+ var ApplicationPath = window.__HTTPApplicationName();
339
343
  this._SiteURL = `${window.location.origin}/${ApplicationPath || 'sfPMS'}`;
340
344
  this._SiteRootURL = `/${ApplicationPath || 'sfPMS'}`;
341
345
  this.exports = _SwaggerClientExports;
@@ -1687,7 +1691,7 @@ class sfRestClient {
1687
1691
  UseID = options.substring(options?.indexOf("&UseID") + 7, 36);
1688
1692
  }
1689
1693
  else
1690
- UseID = await this.NewGuid(); // todo: fix this!!!
1694
+ UseID = await this.NewGuid();
1691
1695
  if (sfRestClient._Options.PopDocForceXBUI)
1692
1696
  url = sfRestClient._Options.PopNewDocXBURL;
1693
1697
  url = url.sfFormat(thisRestClient._SiteURL, dtk, project, options);
@@ -2022,6 +2026,9 @@ class sfRestClient {
2022
2026
  IsHomeDashboardPage() {
2023
2027
  return this.IsPageOfType(this.PageTypeNames.HomeDashboard);
2024
2028
  }
2029
+ IsCatalogPage() {
2030
+ return this.IsPageOfType(this.PageTypeNames.Catalog);
2031
+ }
2025
2032
  IsDocumentPage() {
2026
2033
  return this.IsPageOfType(this.PageTypeNames.Document); // "DocDetail") ;
2027
2034
  }
@@ -2071,6 +2078,7 @@ class sfRestClient {
2071
2078
  result = this.PageTypeNames.Contacts;
2072
2079
  break;
2073
2080
  case "libview":
2081
+ case "LibView":
2074
2082
  result = this.PageTypeNames.Catalog;
2075
2083
  break;
2076
2084
  case "cusysm":
@@ -2097,6 +2105,8 @@ class sfRestClient {
2097
2105
  var pgHash = location.hash;
2098
2106
  if (pgHash.length > 0)
2099
2107
  pgname = pgHash; // for xb style
2108
+ if (pgname.endsWith("pvp.aspx"))
2109
+ pgname = this.GetPageQueryParameterByName("vpg");
2100
2110
  if (pgname.indexOf("/") >= 0)
2101
2111
  pgname = pgname.substring(pgname.lastIndexOf("/") + 1);
2102
2112
  if (pgname.indexOf("?") >= 0)
@@ -2118,7 +2128,7 @@ class sfRestClient {
2118
2128
  result = "home";
2119
2129
  break;
2120
2130
  default:
2121
- console.warn("Unexpected page type: ", classicPageName);
2131
+ console.warn("No XB varient for page type: ", classicPageName);
2122
2132
  result = classicPageName.toString();
2123
2133
  break;
2124
2134
  }
@@ -2304,12 +2314,14 @@ class sfRestClient {
2304
2314
  *
2305
2315
  * Actions Supported
2306
2316
  * - vPgPopup(...)
2307
- * - PopDoc(...)
2308
- * - PopTXHistory(...)
2317
+ * - PopDoc(...) and PopNewDoc
2318
+ * - PopTXHistory(...) and PopBFAHistory()
2309
2319
  * - Nav To (dcmodules and admin tools)
2310
2320
  */
2311
- InvokeAction(actionString, rowData) {
2321
+ InvokeAction(actionString, rowData, options) {
2312
2322
  var ActionString = "";
2323
+ var UseNewTabWindow = false;
2324
+ var RESTClient = this;
2313
2325
  if (typeof actionString === "string")
2314
2326
  ActionString = actionString;
2315
2327
  if (actionString instanceof _SwaggerClientExports.MenuAction) {
@@ -2334,7 +2346,9 @@ class sfRestClient {
2334
2346
  if (ActionString.indexOf("?") > 0) {
2335
2347
  ActionOptions = "&" + ActionString.substring(ActionString.indexOf("?") + 1);
2336
2348
  }
2349
+ ActionOptions = ActionOptions.replaceAll("xbia=1", "xbia=2");
2337
2350
  ActionString = `javascript:vPgPopup('v/LibView.aspx', '${ActionOptions}', 850, 950);`; // ... w,h
2351
+ UseNewTabWindow = true;
2338
2352
  }
2339
2353
  else {
2340
2354
  this.ModalDialog(ActionString, undefined, undefined, window);
@@ -2354,7 +2368,12 @@ class sfRestClient {
2354
2368
  var ActionArgs = this.ExpandActionMarkers(match.groups.args, rowData);
2355
2369
  if (ActionArgs && ActionArgs.indexOf("&Project") < 0)
2356
2370
  ActionArgs += "&Project=" + this.GetPageProjectKey();
2357
- this.VModalPage(match.groups.vpgName, ActionArgs, parseInt(match.groups.width), parseInt(match.groups.height), match.groups.default);
2371
+ if (UseNewTabWindow) {
2372
+ var url = `${RESTClient._SiteRootURL}/pvp.aspx?vpg=${match.groups.vpgName}${ActionArgs}`;
2373
+ self.open(url, match.groups.vpgName);
2374
+ }
2375
+ else
2376
+ this.VModalPage(match.groups.vpgName, ActionArgs, parseInt(match.groups.width), parseInt(match.groups.height), match.groups.default);
2358
2377
  }
2359
2378
  else {
2360
2379
  console.warn("InvokeAction::VPg failed match", ActionString);
@@ -2388,17 +2407,56 @@ class sfRestClient {
2388
2407
  console.warn("InvokeAction::PopNewDoc failed match", actionString);
2389
2408
  }
2390
2409
  }
2391
- else if (ActionString.indexOf("PopTXHistory(") >= 0) {
2410
+ else if (ActionString.indexOf("PopTXHistory(") + ActionString.indexOf("PopBFAHistory(") >= 0) {
2392
2411
  console.warn("InvokeAction::TXH not really done", ActionString);
2412
+ var rx;
2413
+ var vpgName;
2414
+ var Project = this.GetPageProjectKey();
2415
+ var Task = "%", Acct = "%", Period = "%";
2416
+ var BFAMode = false;
2417
+ var mode = "";
2418
+ var PageDSK = "";
2419
+ if (!options)
2420
+ options = { ByTask: true, ByAcct: true };
2421
+ if (ActionString.indexOf("PopBFAHistory(") >= 0) {
2422
+ rx = /PopBFAHistory\(['"](?<PGDSK>.*?)['"],\s*?(?<project>.*?),\s*?(?<task>.*?),\s*?(?<acct>.*?),['"](?<mode>.*?)['"]\s*?\)/gm;
2423
+ vpgName = "BFANotes";
2424
+ BFAMode = true;
2425
+ }
2426
+ else {
2427
+ // this rx does not remove quotes from period
2428
+ rx = /PopTXHistory\(\\?['"](?<pgname>.*?)\\?['"],\s*?(?<task>.*?),\s*?(?<acct>.*?) (,\s*?(?<period>.*?)|\));/gm;
2429
+ vpgName = "TranHistory";
2430
+ }
2431
+ var match = rx.exec(ActionString);
2432
+ if (match && match.groups) {
2433
+ // we ignore the task and account in the invoice action string - see InvokeOptions
2434
+ if (match.groups.project)
2435
+ Project = match.groups.project;
2436
+ if (match.groups.mode)
2437
+ mode = match.groups.mode;
2438
+ if (match.groups.PGDSK)
2439
+ PageDSK = match.groups.PGDSK;
2440
+ if (match.groups.period)
2441
+ Period = match.groups.period;
2442
+ }
2443
+ var ModalOptions;
2444
+ if (BFAMode) {
2445
+ ModalOptions = `&project=${Project}&ds=1&task=${Task}&acct=${Acct}&period=${Period}`;
2446
+ }
2447
+ else {
2448
+ ModalOptions = `&project=${Project}&task=${Task}&acct=${Acct}&period=%`;
2449
+ }
2393
2450
  // sample action: javascript:PopTXHistory(\"TranHistory\", ifByTask() ? Row.task.trim() : \"%\", ifByAcct() ? Row.acct.trim() :\"%\" );
2451
+ // sample javascript:PopBFAHistory('$$PDSID$$',row.Project, ifByTask() ? Row.task.trim() : \"%\", ifByAcct() ? Row.acct.trim() :\"%\" ,'PA');
2394
2452
  // sample http://stany2017/SFPMS/pvp.aspx?vpg=TranHistory&project=GC003&ds=1f573cce-ddd8-4463-a6a6-40c641357f47_ProjectCA_dsData&task=01000&acct=%25&period=%
2395
- var Project = this.GetPageProjectKey();
2396
- var Task = "%", Acct = "%";
2397
- if (rowData && rowData["task"])
2453
+ if (options && options.ByTask && rowData && rowData["task"])
2398
2454
  Task = rowData["task"];
2399
- if (rowData && rowData["acct"])
2455
+ if (options && options.ByAcct && rowData && rowData["acct"])
2400
2456
  Acct = rowData["acct"];
2401
- this.VModalPage("TranHistory", "&project={0}&task={1}&acct={2}&period=%".sfFormat(Project, Task, Acct), 999, 444, undefined);
2457
+ if (sfRestClient._Options.LogLevel >= LoggingLevels.Verbose)
2458
+ console.log(`InvokeAction: VModalPage(${vpgName})`, ModalOptions);
2459
+ this.VModalPage(vpgName, ModalOptions, 999, 444, undefined);
2402
2460
  }
2403
2461
  else if (ActionString.indexOf("PopXLTool(") >= 0 ||
2404
2462
  ActionString.indexOf("PopFVC(") >= 0 ||
@@ -2537,10 +2595,10 @@ class sfRestClient {
2537
2595
  if (RESTClient.IsDocumentPage() && typeof afterOpenArg === "boolean" && afterOpenArg) {
2538
2596
  innerScript = "top.ResetUnsavedChanges();";
2539
2597
  if (autoCloseDoc) {
2540
- innerScript += 'setTimeout(\\\'top.location.href = "about:blank";\\\', 842);';
2598
+ innerScript += "setTimeout('top.location.href = \"about:blank\";', 842);";
2541
2599
  innerScript += "window.top.close();";
2542
2600
  }
2543
- xscript = `setTimeout(\'${innerScript};\', 242);` + xscript;
2601
+ xscript = `setTimeout('${innerScript};', 242);` + xscript;
2544
2602
  }
2545
2603
  else if (typeof self.PostbackRefresh === "function" && !afterOpenArg || typeof afterOpenArg === "string" || (Array.isArray(afterOpenArg) && afterOpenArg.length === 2)) {
2546
2604
  if (!afterOpenArg)
@@ -2550,22 +2608,24 @@ class sfRestClient {
2550
2608
  pbArg = afterOpenArg[1];
2551
2609
  afterOpenArg = afterOpenArg[0];
2552
2610
  }
2553
- innerScript = `PostbackRefresh(\\\'${afterOpenArg}\\\',\\\'${pbArg}\\\');`;
2611
+ innerScript = `PostbackRefresh('${afterOpenArg}','${pbArg}');`;
2554
2612
  }
2555
2613
  else if (typeof afterOpenArg === "function")
2556
2614
  afterOpenArg(et);
2557
2615
  else
2558
2616
  console.log("OpenWindowsLinkHelper() - no post action", afterOpenArg);
2559
2617
  if (typeof innerScript === "string" && innerScript.length > 0)
2560
- xscript = `setTimeout(\'${innerScript};\', ${innerDelay});` + xscript;
2618
+ xscript = `setTimeout('${innerScript};', ${innerDelay});` + xscript;
2561
2619
  try {
2562
2620
  $.connection.sfPMSHub.server.activateExchangeToken(openURL).then(ok => {
2563
2621
  if (!ok)
2564
2622
  setTimeout(xscript, 211);
2565
2623
  else {
2566
2624
  console.log("Activated via SignalR");
2567
- if (typeof innerScript === "string" && innerScript.length > 0)
2625
+ if (typeof innerScript === "string" && innerScript.length > 0) {
2626
+ console.log("Post Activation, Scheduled", innerScript);
2568
2627
  setTimeout(innerScript, innerDelay);
2628
+ }
2569
2629
  }
2570
2630
  }).catch(r => {
2571
2631
  setTimeout(xscript, 211);
@@ -3811,7 +3871,10 @@ class sfRestClient {
3811
3871
  return;
3812
3872
  if (top) {
3813
3873
  var RESTClient = top.sfClient;
3814
- if (top.name.length > 0 && target.sfStartsWithCI(top?.name)) {
3874
+ var TopName = top.name;
3875
+ if (TopName && TopName === 'v/LibView.aspx')
3876
+ TopName = "Dashboard";
3877
+ if (TopName.length > 0 && target.sfStartsWithCI(TopName)) {
3815
3878
  if (request.startsWith("javascript:")) {
3816
3879
  request = request.substring(11);
3817
3880
  try {
@@ -3827,11 +3890,12 @@ class sfRestClient {
3827
3890
  }
3828
3891
  }
3829
3892
  else if (request.sfStartsWithCI("refresh")) {
3830
- if (RESTClient.IsProjectPage()) {
3893
+ var HasRefreshPageParts = (typeof top?.refreshPageParts === "function");
3894
+ if (HasRefreshPageParts && RESTClient.IsProjectPage()) {
3831
3895
  top.refreshPartbyName('DocSearch', request, 'signalR');
3832
3896
  top.refreshPartbyName('ProjTypedDocList', request, 'signalR');
3833
3897
  }
3834
- else if (RESTClient.IsHomeDashboardPage()) {
3898
+ else if (HasRefreshPageParts && RESTClient.IsHomeDashboardPage()) {
3835
3899
  top.refreshPartbyName('actionitems', 'refresh', 'signalR');
3836
3900
  }
3837
3901
  else if (typeof top?.refreshPageParts === "function") {
@@ -3842,14 +3906,14 @@ class sfRestClient {
3842
3906
  top.location.href = request;
3843
3907
  }
3844
3908
  }
3845
- else if (top?.name.length > 0 && RESTClient.GetPageContextValue("DataPK").endsWith(top.name)
3846
- && (RequestForWindowMatches) && typeof RequestForWindowMatches.groups === "object" && RequestForWindowMatches.groups.WindowName === top.name) {
3909
+ else if (TopName.length > 0 && RESTClient.GetPageContextValue("DataPK").endsWith(TopName)
3910
+ && (RequestForWindowMatches) && typeof RequestForWindowMatches.groups === "object" && RequestForWindowMatches.groups.WindowName === TopName) {
3847
3911
  // hey wait, this is about me! Lets schedule a refresh that might get stomped by re-nav (which is ok)
3848
3912
  console.log("sfPMSHub queing request RefreshAttachments in 1 second (belt and suspenders)");
3849
3913
  setTimeout("top.sfDocDetailPostBack('RefreshAttachments','sfLink'); // signalr", 987);
3850
3914
  }
3851
3915
  else
3852
- console.log(`sfPMSHub ignoring request to [${target}]:${request}`);
3916
+ console.log(`sfPMSHub ignoring ${request} to [${target}]`);
3853
3917
  }
3854
3918
  };
3855
3919
  sfHub.client.dashboardRefreshPartByName = function (target) {