@olenbetong/appframe-core 2.0.0 → 2.0.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.
@@ -1,13 +1,23 @@
1
1
  import SessionHandler from "./SessionHandler.js";
2
2
 
3
3
  export default class UserSession extends SessionHandler {
4
+ amDesignator: string = "a.m.";
5
+ dayNames: string[] = ["sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday"];
6
+ dayNamesShort: string[] = ["sun", "mon", "tue", "wed", "thu", "fri", "sat"];
4
7
  decimalSeparator: string = ".";
5
8
  domain: string = "OB";
6
- formats: any;
9
+ email: string | null | undefined;
10
+ formats: undefined | Record<string, string>;
7
11
  groupSeparator: string | null = null;
8
- shortDateFormat: string = "dd.MM.yyyy";
9
- login: string = "";
12
+ integratedSecurity: boolean = false;
10
13
  isDeveloper: boolean = false;
14
+ login: string = "";
15
+ loginType: string | undefined;
16
+ monthNames: string[] = ["january", "february", "march", "april", "may", "june", "july", "august", "september", "october", "november", "december", ""];
17
+ monthNamesShort: string[] = ["jan", "feb", "mar", "apr", "may", "jun", "jul", "augt", "sep", "oct", "nov", "dec", ""];
18
+ name: string | undefined;
19
+ pmDesignator: string = "p.m.";
20
+ shortDateFormat: string = "dd.MM.yyyy";
11
21
  culture: string = "en-GB";
12
22
  uiculture: string = "en-GB";
13
23
  expired: (callback: () => void) => void = () => null;
@@ -1,7 +1,7 @@
1
1
  async function getLocalizedStringAsync(string: string) {
2
2
  try {
3
- let response = await fetch("/api/user/localize", {
4
- body: JSON.stringify({ string }),
3
+ let response = await fetch(`/api/user/localize`, {
4
+ body: JSON.stringify({ string, ArticleID: af.article.id }),
5
5
  headers: {
6
6
  Accept: "application/json; */*",
7
7
  "Content-Type": "application/json",
@@ -21,10 +21,7 @@ async function getLocalizedStringAsync(string: string) {
21
21
  function afGetLocalizedString(string: string): string;
22
22
  function afGetLocalizedString(string: string, wait: false): string;
23
23
  function afGetLocalizedString(string: string, wait: true): Promise<string>;
24
- function afGetLocalizedString(
25
- string: string,
26
- wait?: boolean
27
- ): string | Promise<string> {
24
+ function afGetLocalizedString(string: string, wait?: boolean): string | Promise<string> {
28
25
  if (af?.article?.i18n !== undefined) {
29
26
  if (!Object.prototype.hasOwnProperty.call(af.article.i18n, string)) {
30
27
  af.article.i18n[string] = string;
@@ -101,17 +98,11 @@ function addDeveloperUtils() {
101
98
  if (string) {
102
99
  const escaped = string.replace(/'/g, "\\'");
103
100
  if (forCustomRoute) {
104
- const localized = afGetLocalizedString(string).replaceAll(
105
- /'/g,
106
- "\\'"
107
- );
101
+ const localized = afGetLocalizedString(string).replaceAll(/'/g, "\\'");
108
102
  strings.push(`'${escaped}': '${localized}',`);
109
103
  } else {
110
104
  strings.push(
111
- `s['${escaped}'] = @Html(@context.AddLocalizableString("${string.replaceAll(
112
- '"',
113
- '\\"'
114
- )}"));`
105
+ `s['${escaped}'] = @Html(@context.AddLocalizableString("${string.replaceAll('"', '\\"')}"));`
115
106
  );
116
107
  }
117
108
  }