common-header-lib 0.0.17 → 0.0.18

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.
@@ -34,6 +34,7 @@ export declare class CommonHeaderLibComponent implements OnChanges, OnInit, Afte
34
34
  EnableNotifications: boolean;
35
35
  EnableMoreApps: boolean;
36
36
  EnableProfile: boolean;
37
+ languages: any[];
37
38
  selectedLOBId: any;
38
39
  timezoneDetails: EventEmitter<any>;
39
40
  lobSelected: EventEmitter<any>;
@@ -142,6 +143,6 @@ export declare class CommonHeaderLibComponent implements OnChanges, OnInit, Afte
142
143
  getLoggedInuserDetails(): void;
143
144
  ngOnDestroy(): void;
144
145
  static ɵfac: i0.ɵɵFactoryDeclaration<CommonHeaderLibComponent, never>;
145
- static ɵcmp: i0.ɵɵComponentDeclaration<CommonHeaderLibComponent, "lib-common-header-lib", never, { "EnableLogo": "EnableLogo"; "moduleName": "moduleName"; "EnableTimeZone": "EnableTimeZone"; "EnableLOB": "EnableLOB"; "showAllLOB": "showAllLOB"; "EnableMail": "EnableMail"; "EnableNotifications": "EnableNotifications"; "EnableMoreApps": "EnableMoreApps"; "EnableProfile": "EnableProfile"; }, { "timezoneDetails": "timezoneDetails"; "lobSelected": "lobSelected"; "getBgImage": "getBgImage"; "langChange": "langChange"; "overlayStateChange": "overlayStateChange"; }, never, never, false>;
146
+ static ɵcmp: i0.ɵɵComponentDeclaration<CommonHeaderLibComponent, "lib-common-header-lib", never, { "EnableLogo": "EnableLogo"; "moduleName": "moduleName"; "EnableTimeZone": "EnableTimeZone"; "EnableLOB": "EnableLOB"; "showAllLOB": "showAllLOB"; "EnableMail": "EnableMail"; "EnableNotifications": "EnableNotifications"; "EnableMoreApps": "EnableMoreApps"; "EnableProfile": "EnableProfile"; "languages": "languages"; }, { "timezoneDetails": "timezoneDetails"; "lobSelected": "lobSelected"; "getBgImage": "getBgImage"; "langChange": "langChange"; "overlayStateChange": "overlayStateChange"; }, never, never, false>;
146
147
  }
147
148
  export {};
@@ -1,8 +1,3 @@
1
- import { HttpClient } from '@angular/common/http';
2
- import { TranslateService } from '@ngx-translate/core';
3
- import { TranslateHttpLoader } from '@ngx-translate/http-loader';
4
- import { StorageService } from './services/storage.service';
5
- import { ToastMsgService } from './services/toast-msg.service';
6
1
  import * as i0 from "@angular/core";
7
2
  import * as i1 from "./common-header-lib.component";
8
3
  import * as i2 from "./pipes/slice-to-two.pipe";
@@ -35,55 +30,26 @@ import * as i28 from "primeng/button";
35
30
  import * as i29 from "primeng/confirmdialog";
36
31
  import * as i30 from "@ng-bootstrap/ng-bootstrap";
37
32
  import * as i31 from "@ngx-translate/core";
33
+ /**
34
+ * Common header library module.
35
+ *
36
+ * Translation initialization (APP_INITIALIZER, languages.json validation,
37
+ * fallback chain, language-file loading) is OWNED BY THE CONSUMING APP —
38
+ * see `initTranslateService` and `HttpLoaderFactory` in src/app/app.module.ts
39
+ * (test/dev host) and the equivalent code in your main project's MainModule.
40
+ *
41
+ * The library only imports/exports `TranslateModule` (no `forChild({ isolate })`)
42
+ * so its components share the host app's TranslateService singleton. This
43
+ * guarantees that when the host changes language, library labels translate
44
+ * accordingly.
45
+ *
46
+ * The supported-language list (USERFILTEREDLANGUAGES) is provided by the
47
+ * host app via the `[languages]` @Input on `<lib-common-header-lib>`, which
48
+ * forwards it down to `<ng-translation>`. The library no longer fetches
49
+ * languages.json itself.
50
+ */
38
51
  export declare class CommonHeaderLibModule {
39
52
  static ɵfac: i0.ɵɵFactoryDeclaration<CommonHeaderLibModule, never>;
40
53
  static ɵmod: i0.ɵɵNgModuleDeclaration<CommonHeaderLibModule, [typeof i1.CommonHeaderLibComponent, typeof i2.SliceToTwoPipe, typeof i3.customDateFormatPipe, typeof i4.DateDiffPipe, typeof i5.UserSidebarComponent, typeof i6.SidePopupComponent, typeof i7.NgTranslationComponent, typeof i8.UserMailboxComponent, typeof i9.NotificationSidebarComponent, typeof i10.GeneralConfigurationComponent, typeof i11.TimezoneConfigurationComponent, typeof i12.LandingpgConfigComponent, typeof i13.NoServiceMyAccessPgComponent, typeof i14.GridPaginationComponent, typeof i15.ConfirmDialogComponent, typeof i16.ViewpasswordPopupComponent], [typeof i17.CommonModule, typeof i18.HttpClientModule, typeof i19.ReactiveFormsModule, typeof i20.InputTextModule, typeof i21.DropdownModule, typeof i22.OverlayPanelModule, typeof i23.BadgeModule, typeof i24.DialogModule, typeof i25.SkeletonModule, typeof i26.PaginatorModule, typeof i27.TableModule, typeof i28.ButtonModule, typeof i29.ConfirmDialogModule, typeof i30.NgbModule, typeof i31.TranslateModule], [typeof i1.CommonHeaderLibComponent, typeof i2.SliceToTwoPipe, typeof i4.DateDiffPipe, typeof i3.customDateFormatPipe, typeof i15.ConfirmDialogComponent, typeof i16.ViewpasswordPopupComponent, typeof i31.TranslateModule]>;
41
54
  static ɵinj: i0.ɵɵInjectorDeclaration<CommonHeaderLibModule>;
42
55
  }
43
- /**
44
- * Initializes ngx-translate language configuration during application startup.
45
- *
46
- * Flow:
47
- * 1. Load and validate supported languages from:
48
- * assets/common-header-lib/i18n/languages.json
49
- *
50
- * 2. Build USERFILTEREDLANGUAGES using the exact order defined in languages.json:
51
- * - removes duplicate langKeys
52
- * - ignores unsupported language codes safely
53
- *
54
- * 3. Read USERLANG from localStorage:
55
- * COOKIECONSTANT.USERLANG
56
- *
57
- * 4. If USERLANG:
58
- * - exists in supported languages
59
- * - and translation JSON loads successfully
60
- * → initialize application using USERLANG
61
- *
62
- * 5. If USERLANG is invalid or translation loading fails:
63
- * → fallback to first language from USERFILTEREDLANGUAGES
64
- * (preserving languages.json order)
65
- *
66
- * 6. If first fallback language also fails:
67
- * → fallback to GlobalConstants.DEFAULTLANG
68
- *
69
- * 7. If DEFAULTLANG translation also fails:
70
- * → initialize empty translations safely
71
- * → prevent application bootstrap crash
72
- *
73
- * Example:
74
- * languages.json = ["it", "ja", "ko"]
75
- * localStorage USERLANG = { langKey: "vi" }
76
- *
77
- * Result:
78
- * - "vi" ignored because unsupported
79
- * - tries "it.json"
80
- * - if "it.json" fails → loads DEFAULTLANG ("en")
81
- *
82
- * Notes:
83
- * - languages.json controls supported language order and priority
84
- * - translation files are validated before translate.use(...)
85
- * - invalid localStorage data is ignored safely
86
- * - application startup is protected against translation failures
87
- */
88
- export declare function initTranslateService(translate: TranslateService, localStorageService: StorageService, http: HttpClient, msgService: ToastMsgService): () => Promise<void>;
89
- export declare function createLibTranslateLoader(http: HttpClient): TranslateHttpLoader;
@@ -1,9 +1,9 @@
1
- import { OnInit } from '@angular/core';
1
+ import { OnChanges, OnInit, SimpleChanges } from '@angular/core';
2
2
  import { TranslateService } from '@ngx-translate/core';
3
3
  import { StorageService } from '../../services/storage.service';
4
4
  import { ToastMsgService } from '../../services/toast-msg.service';
5
5
  import * as i0 from "@angular/core";
6
- export declare class NgTranslationComponent implements OnInit {
6
+ export declare class NgTranslationComponent implements OnInit, OnChanges {
7
7
  _translate: TranslateService;
8
8
  private readonly _localstorage;
9
9
  private readonly msgService;
@@ -11,10 +11,11 @@ export declare class NgTranslationComponent implements OnInit {
11
11
  selectedLang: any;
12
12
  constructor(_translate: TranslateService, _localstorage: StorageService, msgService: ToastMsgService);
13
13
  ngOnInit(): void;
14
+ ngOnChanges(changes: SimpleChanges): void;
14
15
  loadLanguages(): void;
15
16
  selectLang(event: any): void;
16
17
  useTranslate(selectedLang: any): void;
17
18
  saveUserLanguage(lang: any): void;
18
19
  static ɵfac: i0.ɵɵFactoryDeclaration<NgTranslationComponent, never>;
19
- static ɵcmp: i0.ɵɵComponentDeclaration<NgTranslationComponent, "ng-translation", never, {}, {}, never, never, false>;
20
+ static ɵcmp: i0.ɵɵComponentDeclaration<NgTranslationComponent, "ng-translation", never, { "languages": "languages"; }, {}, never, never, false>;
20
21
  }
@@ -22,6 +22,7 @@ export declare class UserSidebarComponent implements OnInit, OnDestroy {
22
22
  userLastName: string;
23
23
  userLastLoggedIn: string;
24
24
  private unsubscribeAPIEventListenerData;
25
+ languages: any[];
25
26
  closeDialogBox: EventEmitter<boolean>;
26
27
  private ref;
27
28
  sec: number;
@@ -55,5 +56,5 @@ export declare class UserSidebarComponent implements OnInit, OnDestroy {
55
56
  getLargeFont(): void;
56
57
  ngOnDestroy(): void;
57
58
  static ɵfac: i0.ɵɵFactoryDeclaration<UserSidebarComponent, never>;
58
- static ɵcmp: i0.ɵɵComponentDeclaration<UserSidebarComponent, "app-user-sidebar", never, {}, { "closeDialogBox": "closeDialogBox"; }, never, never, false>;
59
+ static ɵcmp: i0.ɵɵComponentDeclaration<UserSidebarComponent, "app-user-sidebar", never, { "languages": "languages"; }, { "closeDialogBox": "closeDialogBox"; }, never, never, false>;
59
60
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "common-header-lib",
3
- "version": "0.0.17",
3
+ "version": "0.0.18",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^14.2.0",
6
6
  "@angular/core": "^14.2.0",
@@ -85,6 +85,9 @@
85
85
  "Error": "خطأ",
86
86
  "Warning": "تحذير",
87
87
  "Information": "معلومات",
88
- "FailedToLoadLanguageFile": "فشل في تحميل ملف اللغة."
88
+ "FailedToLoadLanguageFile": "فشل في تحميل ملف اللغة.",
89
+ "PasswordViewSuccessMsg": "تم نسخ كلمة المرور إلى الحافظة",
90
+ "SSHPasswordViewSuccessMsg": "تم إنشاء ملف كلمة المرور وتنزيله",
91
+ "SSHPasswordViewErrorMsg": "فشل في إنشاء وتنزيل ملف كلمة المرور"
89
92
  }
90
93
  }
@@ -85,6 +85,9 @@
85
85
  "Error": "Fehler",
86
86
  "Warning": "Warnung",
87
87
  "Information": "Information",
88
- "FailedToLoadLanguageFile": "Fehler beim Laden der Sprachdatei."
88
+ "FailedToLoadLanguageFile": "Fehler beim Laden der Sprachdatei.",
89
+ "PasswordViewSuccessMsg": "Passwort in die Zwischenablage kopiert",
90
+ "SSHPasswordViewSuccessMsg": "Passwortdatei wurde erstellt und heruntergeladen",
91
+ "SSHPasswordViewErrorMsg": "Fehler beim Erstellen und Herunterladen der Passwortdatei"
89
92
  }
90
93
  }
@@ -85,6 +85,9 @@
85
85
  "Error": "Error",
86
86
  "Warning": "Warning",
87
87
  "Information": "Information",
88
- "FailedToLoadLanguageFile": "Failed to load language file."
88
+ "FailedToLoadLanguageFile": "Failed to load language file.",
89
+ "PasswordViewSuccessMsg": "Password Copied to Clipboard",
90
+ "SSHPasswordViewSuccessMsg": "Password file generated and downloaded.",
91
+ "SSHPasswordViewErrorMsg": "Failed to generate and download the password file."
89
92
  }
90
93
  }
@@ -85,6 +85,9 @@
85
85
  "Error": "Error",
86
86
  "Warning": "Advertencia",
87
87
  "Information": "Información",
88
- "FailedToLoadLanguageFile": "Error al cargar el archivo de idioma."
88
+ "FailedToLoadLanguageFile": "Error al cargar el archivo de idioma.",
89
+ "PasswordViewSuccessMsg": "Contraseña copiada al portapapeles",
90
+ "SSHPasswordViewSuccessMsg": "El archivo de contraseña se generó y descargó",
91
+ "SSHPasswordViewErrorMsg": "Error al generar y descargar el archivo de contraseña"
89
92
  }
90
93
  }
@@ -85,6 +85,9 @@
85
85
  "Error": "Erreur",
86
86
  "Warning": "Avertissement",
87
87
  "Information": "Information",
88
- "FailedToLoadLanguageFile": "Échec du chargement du fichier de langue."
88
+ "FailedToLoadLanguageFile": "Échec du chargement du fichier de langue.",
89
+ "PasswordViewSuccessMsg": "Mot de passe copié dans le presse-papiers",
90
+ "SSHPasswordViewSuccessMsg": "Le fichier de mot de passe a été généré et téléchargé",
91
+ "SSHPasswordViewErrorMsg": "Échec de la génération et du téléchargement du fichier de mot de passe"
89
92
  }
90
93
  }
@@ -85,6 +85,9 @@
85
85
  "Error": "त्रुटि",
86
86
  "Warning": "चेतावनी",
87
87
  "Information": "जानकारी",
88
- "FailedToLoadLanguageFile": "भाषा फ़ाइल लोड करने में विफल।"
88
+ "FailedToLoadLanguageFile": "भाषा फ़ाइल लोड करने में विफल।",
89
+ "PasswordViewSuccessMsg": "पासवर्ड क्लिपबोर्ड पर कॉपी किया गया।",
90
+ "SSHPasswordViewSuccessMsg": "पासवर्ड फ़ाइल बनाई गई और डाउनलोड की गई।",
91
+ "SSHPasswordViewErrorMsg": "पासवर्ड फ़ाइल बनाने और डाउनलोड करने में विफल।"
89
92
  }
90
93
  }
@@ -85,6 +85,9 @@
85
85
  "Error": "エラー",
86
86
  "Warning": "警告",
87
87
  "Information": "情報",
88
- "FailedToLoadLanguageFile": "言語ファイルの読み込みに失敗しました。"
88
+ "FailedToLoadLanguageFile": "言語ファイルの読み込みに失敗しました。",
89
+ "PasswordViewSuccessMsg": "パスワードがクリップボードにコピーされました",
90
+ "SSHPasswordViewSuccessMsg": "パスワードファイルが生成され、ダウンロードされました",
91
+ "SSHPasswordViewErrorMsg": "パスワードファイルの生成とダウンロードに失敗しました"
89
92
  }
90
93
  }
@@ -85,6 +85,9 @@
85
85
  "Error": "오류",
86
86
  "Warning": "경고",
87
87
  "Information": "정보",
88
- "FailedToLoadLanguageFile": "언어 파일을 불러오지 못했습니다."
88
+ "FailedToLoadLanguageFile": "언어 파일을 불러오지 못했습니다.",
89
+ "PasswordViewSuccessMsg": "비밀번호가 클립보드에 복사되었습니다",
90
+ "SSHPasswordViewSuccessMsg": "비밀번호 파일이 생성되고 다운로드되었습니다",
91
+ "SSHPasswordViewErrorMsg": "비밀번호 파일 생성 및 다운로드에 실패했습니다"
89
92
  }
90
93
  }