@olenbetong/appframe-core 2.11.7 → 2.11.9

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.
@@ -135,7 +135,7 @@ async function logActivity(activity, parameters = {}, timeElapsed = 0) {
135
135
  console.error(`${response.status} ${response.statusText}`);
136
136
  }
137
137
  }
138
- } catch (error) {
138
+ } catch {
139
139
  }
140
140
  }
141
141
  function startActivity(activity, startParameters = {}) {
@@ -350,7 +350,7 @@ async function downloadRequest(request, { fileName, signal, onProgress }) {
350
350
  }
351
351
  });
352
352
  response = new Response(stream);
353
- } catch (error) {
353
+ } catch {
354
354
  }
355
355
  const blob = await response.blob();
356
356
  onProgress?.({ bytesReceived, status: "downloaded" });
@@ -432,25 +432,6 @@ function expose(name, value, options = {}) {
432
432
  }
433
433
  }
434
434
 
435
- // src/getUserImage.ts
436
- var sizeMap = {
437
- xs: 64,
438
- sm: 128,
439
- md: 256,
440
- lg: 512,
441
- xl: void 0
442
- };
443
- function getUserImage(primKeyOrOptions, login, hash, size = "xs") {
444
- if (primKeyOrOptions && typeof primKeyOrOptions === "object") {
445
- return getUserImage(primKeyOrOptions.primKey, primKeyOrOptions.login, primKeyOrOptions.hash, primKeyOrOptions.size);
446
- }
447
- if (!primKeyOrOptions || !hash) {
448
- return "";
449
- }
450
- let sizePx = sizeMap[size];
451
- return `/api/data/blob/EmployeesLookup/${primKeyOrOptions}/Image/${encodeURIComponent(login ?? "")}${login ? "." : ""}${encodeURIComponent(hash)}.jpg${sizePx ? `?width=${sizePx}` : ""}`;
452
- }
453
-
454
435
  // src/getLocalizedString.ts
455
436
  async function fetchLocalizedString(text) {
456
437
  try {
@@ -466,7 +447,7 @@ async function fetchLocalizedString(text) {
466
447
  if (response.ok) {
467
448
  return await response.json();
468
449
  }
469
- } catch (error) {
450
+ } catch {
470
451
  }
471
452
  return text;
472
453
  }
@@ -494,6 +475,25 @@ function getLocalizedString(string, wait) {
494
475
  }
495
476
  }
496
477
 
478
+ // src/getUserImage.ts
479
+ var sizeMap = {
480
+ xs: 64,
481
+ sm: 128,
482
+ md: 256,
483
+ lg: 512,
484
+ xl: void 0
485
+ };
486
+ function getUserImage(primKeyOrOptions, login, hash, size = "xs") {
487
+ if (primKeyOrOptions && typeof primKeyOrOptions === "object") {
488
+ return getUserImage(primKeyOrOptions.primKey, primKeyOrOptions.login, primKeyOrOptions.hash, primKeyOrOptions.size);
489
+ }
490
+ if (!primKeyOrOptions || !hash) {
491
+ return "";
492
+ }
493
+ let sizePx = sizeMap[size];
494
+ return `/api/data/blob/EmployeesLookup/${primKeyOrOptions}/Image/${encodeURIComponent(login ?? "")}${login ? "." : ""}${encodeURIComponent(hash)}.jpg${sizePx ? `?width=${sizePx}` : ""}`;
495
+ }
496
+
497
497
  // src/localize.ts
498
498
  function localize(stringParts, ...args) {
499
499
  invariant(
@@ -508,32 +508,6 @@ function localize(stringParts, ...args) {
508
508
  return localized;
509
509
  }
510
510
 
511
- // src/settings.ts
512
- function getKey(article2) {
513
- const articleKey = article2 ?? window.af?.article?.id ?? window.window?.location.pathname.substring(1).split("/")[0];
514
- return `${articleKey}.${window.af?.userSession.login ?? "anonymous"}`;
515
- }
516
- function getSettings(setting, article2) {
517
- if (!window.af?.userSession) return null;
518
- const key = getKey(article2);
519
- const settings = JSON.parse(localStorage.getItem(key) || "{}");
520
- if (setting) {
521
- return settings[setting] || null;
522
- }
523
- return settings;
524
- }
525
- function saveSettings(setting, value, article2) {
526
- if (!window.af?.userSession) return;
527
- const key = getKey(article2);
528
- let userSettings = JSON.parse(localStorage.getItem(key) || "{}");
529
- if (typeof value !== "undefined") {
530
- userSettings[setting] = value;
531
- } else {
532
- userSettings = setting;
533
- }
534
- localStorage.setItem(key, JSON.stringify(userSettings));
535
- }
536
-
537
511
  // src/alert.ts
538
512
  var template = `
539
513
  <dialog class="alert-dialog">
@@ -645,8 +619,34 @@ async function alert(prompt, options = {}) {
645
619
  });
646
620
  }
647
621
 
622
+ // src/settings.ts
623
+ function getKey(article2) {
624
+ const articleKey = article2 ?? window.af?.article?.id ?? window.window?.location.pathname.substring(1).split("/")[0];
625
+ return `${articleKey}.${window.af?.userSession.login ?? "anonymous"}`;
626
+ }
627
+ function getSettings(setting, article2) {
628
+ if (!window.af?.userSession) return null;
629
+ const key = getKey(article2);
630
+ const settings = JSON.parse(localStorage.getItem(key) || "{}");
631
+ if (setting) {
632
+ return settings[setting] || null;
633
+ }
634
+ return settings;
635
+ }
636
+ function saveSettings(setting, value, article2) {
637
+ if (!window.af?.userSession) return;
638
+ const key = getKey(article2);
639
+ let userSettings = JSON.parse(localStorage.getItem(key) || "{}");
640
+ if (typeof value !== "undefined") {
641
+ userSettings[setting] = value;
642
+ } else {
643
+ userSettings = setting;
644
+ }
645
+ localStorage.setItem(key, JSON.stringify(userSettings));
646
+ }
647
+
648
648
  // src/index.ts
649
- var version = "2.11.7";
649
+ var version = "2.11.9";
650
650
  export {
651
651
  ConfirmButtons,
652
652
  SessionHandler,