@propmix/profet-common-header 1.0.0

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.
@@ -0,0 +1,330 @@
1
+ import * as i0 from '@angular/core';
2
+ import { inject, Injectable, Inject, Component, EventEmitter, ViewEncapsulation, Input, Output, NgModule } from '@angular/core';
3
+ import { HttpClient, HttpClientModule } from '@angular/common/http';
4
+ import { Observable } from 'rxjs';
5
+ import { Router } from '@angular/router';
6
+ import { MatSnackBar, MatSnackBarModule } from '@angular/material/snack-bar';
7
+ import { Auth } from 'aws-amplify';
8
+ import * as i2 from '@angular/common';
9
+ import { CommonModule } from '@angular/common';
10
+ import * as i3 from '@angular/material/toolbar';
11
+ import { MatToolbarModule } from '@angular/material/toolbar';
12
+ import * as i4 from '@angular/material/button';
13
+ import { MatButtonModule } from '@angular/material/button';
14
+ import * as i5 from '@angular/material/menu';
15
+ import { MatMenuModule } from '@angular/material/menu';
16
+ import { MatIconModule } from '@angular/material/icon';
17
+ import { MatSidenavModule } from '@angular/material/sidenav';
18
+
19
+ class EndPoints {
20
+ }
21
+ EndPoints.API_URLS = {
22
+ getAppsApi: '/api/company/getALlApplications',
23
+ getCompanyApplications: '/api/company/getCompanyApplications',
24
+ getUserCompanies: '/api/profile/getUserCompanies',
25
+ updateUserCompany: '/api/company/updateUserCompany'
26
+ };
27
+
28
+ class ApiGatewayService {
29
+ constructor() {
30
+ this._http = inject(HttpClient);
31
+ }
32
+ doGet(url, config) {
33
+ return new Observable(observer => {
34
+ if (!config) {
35
+ config = {
36
+ isLoaderHidden: false
37
+ };
38
+ }
39
+ ;
40
+ let headers;
41
+ if (config.isUnauthorized) {
42
+ headers = {
43
+ skip: "true"
44
+ };
45
+ }
46
+ // this._loaderService.requestStarted(config);
47
+ this._http
48
+ .get(url, { headers: headers })
49
+ .subscribe({
50
+ next: (data) => {
51
+ // this._loaderService.requestEnded();
52
+ observer.next(data);
53
+ observer.complete();
54
+ },
55
+ error: (error) => {
56
+ // this.handleError(error, config, observer);
57
+ }
58
+ });
59
+ });
60
+ }
61
+ doPost(url, req_body) {
62
+ return new Observable(observer => {
63
+ let headers;
64
+ this._http
65
+ .post(url, req_body, { headers: headers })
66
+ .subscribe({
67
+ next: (data) => {
68
+ if (data && data.hasOwnProperty('status')) {
69
+ observer.next(data);
70
+ observer.complete();
71
+ }
72
+ else {
73
+ observer.next(data);
74
+ observer.complete();
75
+ }
76
+ },
77
+ error: (error) => {
78
+ // this.handleError(error, config, observer);
79
+ }
80
+ });
81
+ });
82
+ }
83
+ }
84
+ ApiGatewayService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ApiGatewayService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
85
+ ApiGatewayService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ApiGatewayService, providedIn: 'root' });
86
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ApiGatewayService, decorators: [{
87
+ type: Injectable,
88
+ args: [{
89
+ providedIn: 'root'
90
+ }]
91
+ }] });
92
+
93
+ class HeaderConfig {
94
+ constructor() {
95
+ this.apiUrl = '';
96
+ }
97
+ }
98
+
99
+ class CommonHeaderService {
100
+ constructor(config) {
101
+ this.config = config;
102
+ this.baseUrl = '';
103
+ this._apiGatewayService = inject(ApiGatewayService);
104
+ console.log('version =>1.0.14');
105
+ this.baseUrl = this.config.apiUrl;
106
+ }
107
+ // getUserInfo() {
108
+ // let url = `${this.baseUrl}/api/users/fetchLoggedInUsers`;
109
+ // return this._http.get(url);
110
+ // }
111
+ getApps() {
112
+ let url = `${this.baseUrl + EndPoints.API_URLS.getAppsApi}`;
113
+ return this._apiGatewayService.doGet(url);
114
+ }
115
+ getCompanyApplications() {
116
+ let url = `${this.baseUrl + EndPoints.API_URLS.getCompanyApplications}`;
117
+ return this._apiGatewayService.doGet(url);
118
+ }
119
+ getUserCompanies() {
120
+ let url = `${this.baseUrl + EndPoints.API_URLS.getUserCompanies}`;
121
+ return this._apiGatewayService.doGet(url);
122
+ }
123
+ updateUserCompany(reqBody) {
124
+ let url = `${this.baseUrl + EndPoints.API_URLS.updateUserCompany}`;
125
+ return this._apiGatewayService.doPost(url, reqBody);
126
+ }
127
+ }
128
+ CommonHeaderService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CommonHeaderService, deps: [{ token: 'headerConfig' }], target: i0.ɵɵFactoryTarget.Injectable });
129
+ CommonHeaderService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CommonHeaderService, providedIn: 'root' });
130
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CommonHeaderService, decorators: [{
131
+ type: Injectable,
132
+ args: [{
133
+ providedIn: 'root'
134
+ }]
135
+ }], ctorParameters: function () { return [{ type: HeaderConfig, decorators: [{
136
+ type: Inject,
137
+ args: ['headerConfig']
138
+ }] }]; } });
139
+
140
+ class CommonHeaderComponent {
141
+ }
142
+ CommonHeaderComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CommonHeaderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
143
+ CommonHeaderComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: CommonHeaderComponent, selector: "lib-common-header", ngImport: i0, template: `
144
+ <p>
145
+ common-header works!
146
+ </p>
147
+ `, isInline: true });
148
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CommonHeaderComponent, decorators: [{
149
+ type: Component,
150
+ args: [{ selector: 'lib-common-header', template: `
151
+ <p>
152
+ common-header works!
153
+ </p>
154
+ ` }]
155
+ }] });
156
+
157
+ class HeaderComponent {
158
+ constructor(_ser) {
159
+ this._ser = _ser;
160
+ this.menuEvent = new EventEmitter();
161
+ this.appList = [];
162
+ this.showSwitchCompanies = false;
163
+ this._router = inject(Router);
164
+ this._snackbar = inject(MatSnackBar);
165
+ }
166
+ ngOnInit() {
167
+ this._ser.getApps().subscribe({
168
+ next: (v) => {
169
+ console.log('from lib', v);
170
+ if (v?.data?.applications && v.data.applications.length > 0) {
171
+ this.fetchCompanyData(v.data.applications);
172
+ }
173
+ },
174
+ error: (e) => {
175
+ console.log('from lib errrr', e);
176
+ }
177
+ });
178
+ this.getUserCompany();
179
+ }
180
+ fetchCompanyData(allApps) {
181
+ this._ser.getCompanyApplications().subscribe({
182
+ next: (v) => {
183
+ console.log("getCompanyApplications res :", v);
184
+ if (v?.data.enabledApplications) {
185
+ this.appList = [];
186
+ let appInfo = [];
187
+ let fetchedApplications = v.data.enabledApplications.split(',');
188
+ console.log("fetchedapps", fetchedApplications);
189
+ if (fetchedApplications.length > 0) {
190
+ fetchedApplications.forEach((element) => {
191
+ appInfo = allApps.filter(ele => ele.name == element);
192
+ if (appInfo && appInfo.length > 0) {
193
+ if (appInfo[0].name != 'mca') {
194
+ this.appList.push({
195
+ name: appInfo[0].displayName,
196
+ value: element,
197
+ appUrl: appInfo[0].appUrl
198
+ });
199
+ }
200
+ }
201
+ });
202
+ console.log('apps>>', this.appList);
203
+ }
204
+ }
205
+ }
206
+ });
207
+ }
208
+ getUserCompany() {
209
+ this._ser.getUserCompanies().subscribe({
210
+ next: (userCompaniesData) => {
211
+ if (userCompaniesData && userCompaniesData.data && userCompaniesData.data.companies) {
212
+ this.userCompanies = userCompaniesData.data.companies;
213
+ if (this.userCompanies.length > 1) {
214
+ this.showSwitchCompanies = true;
215
+ }
216
+ }
217
+ },
218
+ error: (e) => {
219
+ console.log("Error in fetching companies for the user");
220
+ }
221
+ });
222
+ }
223
+ appRedirect(app) {
224
+ // if (app.name != 'Order Management') {
225
+ window.open(app.appUrl, "_self");
226
+ // }
227
+ }
228
+ profile() {
229
+ // this.fetchUserData();
230
+ this._router.navigateByUrl('/app/profile');
231
+ }
232
+ onLogoutClick() {
233
+ // this.logoutEvent.emit();
234
+ Auth.signOut({ global: true })
235
+ .then(data => console.log(data))
236
+ .catch(err => {
237
+ console.log(err);
238
+ Auth.signOut();
239
+ });
240
+ }
241
+ switchCompany(company) {
242
+ // switch the user to the selectec company
243
+ let req = { companyKey: company.companyKey };
244
+ this._ser.updateUserCompany(req).subscribe({
245
+ next: (response) => {
246
+ if (response && response.type && response.type == "OK") {
247
+ // refresh the current page to reload the contents based on the current company
248
+ window.location.reload();
249
+ }
250
+ else {
251
+ // display a message to the user that the company could not be switched.
252
+ this._snackbar.open('Company could not be switched. Please try again or contact support.', 'OK', { duration: 5000 });
253
+ }
254
+ },
255
+ error: (e) => {
256
+ // display a message to the user that the company could not be switched.
257
+ this._snackbar.open('Company could not be switched. Please try again or contact support.', 'OK', { duration: 5000 });
258
+ }
259
+ });
260
+ }
261
+ menuAction() {
262
+ this.menuEvent.emit();
263
+ }
264
+ }
265
+ HeaderComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: HeaderComponent, deps: [{ token: CommonHeaderService }], target: i0.ɵɵFactoryTarget.Component });
266
+ HeaderComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: HeaderComponent, selector: "lib-header", inputs: { userInfo: "userInfo" }, outputs: { menuEvent: "menuEvent" }, ngImport: i0, template: "<!-- <mat-drawer-container autosize>\n <mat-drawer #menudrawer class=\"example-sidenav\" mode=\"over\" (click)=\"sidenav.close()\">\n <div class=\"sidenavPanel\">\n <a class=\"navbar-brand me-auto\" href=\"#\">\n <img src=\"assets/images/Profet_Logo.png\" alt=\"Logo\" style=\"width:140px;\">\n </a>\n <ul class=\"navbarList\">\n <li><img src=\"../../../assets/images/ordersIcon.png\">Orders</li>\n <li><img src=\"../../../assets/images/panelIcon.png\">Panels</li>\n <li><img src=\"../../../assets/images/scheduleIcon.png\">Fee Schedule</li>\n <li><img src=\"../../../assets/images/settingIcon.png\">Settings</li>\n </ul>\n <span class=\"version\">Version: &nbsp;365b520 | 0.16.0</span>\n </div>\n </mat-drawer> -->\n\n\n\n <mat-toolbar color=\"primary\" class=\"common_header shadow-sm\">\n <button mat-icon-button (click)=\"menuAction()\" aria-label=\"main menu\" tabindex=\"0\" class=\"menuHamberger me-4\">\n <img src=\"../assets/images/hamburger_menu.svg\" style=\"width: 20px;height: 20px;\">\n </button>\n <a class=\"navbar-brand me-auto\" href=\"#\">\n <img src=\"assets/images/Profet_Logo.png\" alt=\"Logo\" style=\"width:140px;\">\n </a>\n <span class=\"example-spacer\"></span>\n <button color=\"primary\" mat-stroked-button class=\"btnCreateOrder me-2\"><img class=\"me-2\" src=\"../assets/images/file_upload_icon.svg\" width=\"20px\">Create Order</button>\n <button *ngIf=\"appList.length > 0\" mat-icon-button class=\"me-3 switchButton\" [matMenuTriggerFor]=\"apps\">\n <img src=\"../assets/images/apps.png\" alt=\"apps icon\" style=\"width:20px;height: 20px;\">\n </button>\n <mat-menu #apps=\"matMenu\" class=\"accounts_drpmenu\">\n <div *ngFor=\"let app of appList\">\n <button mat-menu-item (click)=\"appRedirect(app)\">{{app.name}}</button>\n </div>\n </mat-menu>\n <div class=\"profile-name\">\n <p *ngIf=\"userInfo && userInfo.name\" class=\"xsHiddenUsername mb-0\">{{userInfo.name}}</p>\n <!--<span class=\"xsHiddenUsername mb-0\" *ngFor=\"let role of userRole\">{{role | formatWord: true:'_'}}</span>-->\n </div>\n <button mat-button [matMenuTriggerFor]=\"menu\">\n <img class=\"avatarLogo\" src=\"../assets/images/dp.png\" alt=\"Avatar Logo\" class=\"avatarLogo rounded-pill\">\n </button>\n <mat-menu #menu=\"matMenu\" class=\"accounts_drpmenu\">\n <span *ngIf=\"userInfo && userInfo.name\" class=\"xsShowUsername\">{{userInfo.name}}</span>\n <button mat-menu-item (click)=\"profile()\">Profile</button>\n <button mat-menu-item (click)=\"onLogoutClick()\">Logout</button>\n <button *ngIf=\"showSwitchCompanies\" mat-menu-item [matMenuTriggerFor]=\"companies\">Switch Company</button>\n <mat-menu #companies=\"matMenu\" class=\"accounts_drpmenu\">\n <div *ngFor=\"let company of userCompanies\">\n <button mat-menu-item (click)=\"switchCompany(company)\">{{company.name}}</button>\n </div>\n </mat-menu>\n </mat-menu>\n\n\n <!-- <button mat-icon-button class=\"example-icon favorite-icon\" aria-label=\"Example icon-button with heart icon\">\n <mat-icon>favorite</mat-icon>\n </button>\n <button mat-icon-button class=\"example-icon\" aria-label=\"Example icon-button with share icon\">\n <mat-icon>share</mat-icon>\n </button> -->\n </mat-toolbar>\n<!-- </mat-drawer-container> -->", styles: ["@import\"~@angular/material/prebuilt-themes/indigo-pink.css\";.profile-name{text-align:end;color:#000}.profile-name span{font-size:12px;color:#9e9e9ede}.avatarLogo{width:40px}mat-toolbar.mat-toolbar.common_header.mat-primary.mat-toolbar-single-row{position:fixed;left:0;top:0;background-color:#fff;height:48px}button.switchButton,button.menuHamberger{padding:8px!important}.sidenavPanel{padding:20px 25px;height:100vh;position:relative}ul.navbarList{padding-left:0;list-style:none;margin-top:40px}ul.navbarList li{color:#666;font-weight:400;margin-bottom:25px;width:170px;cursor:pointer}.active{color:#4177d6!important}ul.navbarList li img{width:23px;margin-right:15px}.accounts_drpmenu{margin-top:.7em}.xsShowUsername{display:none;padding:0 16px;height:48px;line-height:48px}\n"], dependencies: [{ kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i3.MatToolbar, selector: "mat-toolbar", inputs: ["color"], exportAs: ["matToolbar"] }, { kind: "component", type: i4.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i4.MatIconButton, selector: "button[mat-icon-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i5.MatMenu, selector: "mat-menu", exportAs: ["matMenu"] }, { kind: "component", type: i5.MatMenuItem, selector: "[mat-menu-item]", inputs: ["disabled", "disableRipple", "role"], exportAs: ["matMenuItem"] }, { kind: "directive", type: i5.MatMenuTrigger, selector: "[mat-menu-trigger-for], [matMenuTriggerFor]", exportAs: ["matMenuTrigger"] }], encapsulation: i0.ViewEncapsulation.None });
267
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: HeaderComponent, decorators: [{
268
+ type: Component,
269
+ args: [{ selector: 'lib-header', encapsulation: ViewEncapsulation.None, template: "<!-- <mat-drawer-container autosize>\n <mat-drawer #menudrawer class=\"example-sidenav\" mode=\"over\" (click)=\"sidenav.close()\">\n <div class=\"sidenavPanel\">\n <a class=\"navbar-brand me-auto\" href=\"#\">\n <img src=\"assets/images/Profet_Logo.png\" alt=\"Logo\" style=\"width:140px;\">\n </a>\n <ul class=\"navbarList\">\n <li><img src=\"../../../assets/images/ordersIcon.png\">Orders</li>\n <li><img src=\"../../../assets/images/panelIcon.png\">Panels</li>\n <li><img src=\"../../../assets/images/scheduleIcon.png\">Fee Schedule</li>\n <li><img src=\"../../../assets/images/settingIcon.png\">Settings</li>\n </ul>\n <span class=\"version\">Version: &nbsp;365b520 | 0.16.0</span>\n </div>\n </mat-drawer> -->\n\n\n\n <mat-toolbar color=\"primary\" class=\"common_header shadow-sm\">\n <button mat-icon-button (click)=\"menuAction()\" aria-label=\"main menu\" tabindex=\"0\" class=\"menuHamberger me-4\">\n <img src=\"../assets/images/hamburger_menu.svg\" style=\"width: 20px;height: 20px;\">\n </button>\n <a class=\"navbar-brand me-auto\" href=\"#\">\n <img src=\"assets/images/Profet_Logo.png\" alt=\"Logo\" style=\"width:140px;\">\n </a>\n <span class=\"example-spacer\"></span>\n <button color=\"primary\" mat-stroked-button class=\"btnCreateOrder me-2\"><img class=\"me-2\" src=\"../assets/images/file_upload_icon.svg\" width=\"20px\">Create Order</button>\n <button *ngIf=\"appList.length > 0\" mat-icon-button class=\"me-3 switchButton\" [matMenuTriggerFor]=\"apps\">\n <img src=\"../assets/images/apps.png\" alt=\"apps icon\" style=\"width:20px;height: 20px;\">\n </button>\n <mat-menu #apps=\"matMenu\" class=\"accounts_drpmenu\">\n <div *ngFor=\"let app of appList\">\n <button mat-menu-item (click)=\"appRedirect(app)\">{{app.name}}</button>\n </div>\n </mat-menu>\n <div class=\"profile-name\">\n <p *ngIf=\"userInfo && userInfo.name\" class=\"xsHiddenUsername mb-0\">{{userInfo.name}}</p>\n <!--<span class=\"xsHiddenUsername mb-0\" *ngFor=\"let role of userRole\">{{role | formatWord: true:'_'}}</span>-->\n </div>\n <button mat-button [matMenuTriggerFor]=\"menu\">\n <img class=\"avatarLogo\" src=\"../assets/images/dp.png\" alt=\"Avatar Logo\" class=\"avatarLogo rounded-pill\">\n </button>\n <mat-menu #menu=\"matMenu\" class=\"accounts_drpmenu\">\n <span *ngIf=\"userInfo && userInfo.name\" class=\"xsShowUsername\">{{userInfo.name}}</span>\n <button mat-menu-item (click)=\"profile()\">Profile</button>\n <button mat-menu-item (click)=\"onLogoutClick()\">Logout</button>\n <button *ngIf=\"showSwitchCompanies\" mat-menu-item [matMenuTriggerFor]=\"companies\">Switch Company</button>\n <mat-menu #companies=\"matMenu\" class=\"accounts_drpmenu\">\n <div *ngFor=\"let company of userCompanies\">\n <button mat-menu-item (click)=\"switchCompany(company)\">{{company.name}}</button>\n </div>\n </mat-menu>\n </mat-menu>\n\n\n <!-- <button mat-icon-button class=\"example-icon favorite-icon\" aria-label=\"Example icon-button with heart icon\">\n <mat-icon>favorite</mat-icon>\n </button>\n <button mat-icon-button class=\"example-icon\" aria-label=\"Example icon-button with share icon\">\n <mat-icon>share</mat-icon>\n </button> -->\n </mat-toolbar>\n<!-- </mat-drawer-container> -->", styles: ["@import\"~@angular/material/prebuilt-themes/indigo-pink.css\";.profile-name{text-align:end;color:#000}.profile-name span{font-size:12px;color:#9e9e9ede}.avatarLogo{width:40px}mat-toolbar.mat-toolbar.common_header.mat-primary.mat-toolbar-single-row{position:fixed;left:0;top:0;background-color:#fff;height:48px}button.switchButton,button.menuHamberger{padding:8px!important}.sidenavPanel{padding:20px 25px;height:100vh;position:relative}ul.navbarList{padding-left:0;list-style:none;margin-top:40px}ul.navbarList li{color:#666;font-weight:400;margin-bottom:25px;width:170px;cursor:pointer}.active{color:#4177d6!important}ul.navbarList li img{width:23px;margin-right:15px}.accounts_drpmenu{margin-top:.7em}.xsShowUsername{display:none;padding:0 16px;height:48px;line-height:48px}\n"] }]
270
+ }], ctorParameters: function () { return [{ type: CommonHeaderService }]; }, propDecorators: { userInfo: [{
271
+ type: Input
272
+ }], menuEvent: [{
273
+ type: Output
274
+ }] } });
275
+
276
+ class CommonHeaderModule {
277
+ }
278
+ CommonHeaderModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CommonHeaderModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
279
+ CommonHeaderModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.10", ngImport: i0, type: CommonHeaderModule, declarations: [CommonHeaderComponent,
280
+ HeaderComponent], imports: [CommonModule,
281
+ MatToolbarModule,
282
+ MatIconModule,
283
+ HttpClientModule,
284
+ MatButtonModule,
285
+ MatSidenavModule,
286
+ MatMenuModule,
287
+ MatSnackBarModule], exports: [CommonHeaderComponent,
288
+ HeaderComponent] });
289
+ CommonHeaderModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CommonHeaderModule, imports: [CommonModule,
290
+ MatToolbarModule,
291
+ MatIconModule,
292
+ HttpClientModule,
293
+ MatButtonModule,
294
+ MatSidenavModule,
295
+ MatMenuModule,
296
+ MatSnackBarModule] });
297
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CommonHeaderModule, decorators: [{
298
+ type: NgModule,
299
+ args: [{
300
+ declarations: [
301
+ CommonHeaderComponent,
302
+ HeaderComponent
303
+ ],
304
+ imports: [
305
+ CommonModule,
306
+ MatToolbarModule,
307
+ MatIconModule,
308
+ HttpClientModule,
309
+ MatButtonModule,
310
+ MatSidenavModule,
311
+ MatMenuModule,
312
+ MatSnackBarModule
313
+ ],
314
+ exports: [
315
+ CommonHeaderComponent,
316
+ HeaderComponent
317
+ ]
318
+ }]
319
+ }] });
320
+
321
+ /*
322
+ * Public API Surface of common-header
323
+ */
324
+
325
+ /**
326
+ * Generated bundle index. Do not edit.
327
+ */
328
+
329
+ export { CommonHeaderComponent, CommonHeaderModule, CommonHeaderService, HeaderComponent, HeaderConfig };
330
+ //# sourceMappingURL=propmix-profet-common-header.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"propmix-profet-common-header.mjs","sources":["../../../projects/common-header/src/lib/api-endpoints.def.ts","../../../projects/common-header/src/lib/api-gateway.service.ts","../../../projects/common-header/src/lib/utils/HeaderConfig.ts","../../../projects/common-header/src/lib/common-header.service.ts","../../../projects/common-header/src/lib/common-header.component.ts","../../../projects/common-header/src/lib/header/header.component.ts","../../../projects/common-header/src/lib/header/header.component.html","../../../projects/common-header/src/lib/common-header.module.ts","../../../projects/common-header/src/public-api.ts","../../../projects/common-header/src/propmix-profet-common-header.ts"],"sourcesContent":["export class EndPoints {\n public static API_URLS = {\n getAppsApi: '/api/company/getALlApplications',\n getCompanyApplications: '/api/company/getCompanyApplications',\n getUserCompanies: '/api/profile/getUserCompanies',\n updateUserCompany: '/api/company/updateUserCompany'\n }\n}","import { HttpClient } from '@angular/common/http';\nimport { Injectable, inject } from '@angular/core';\nimport { Observable } from 'rxjs';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class ApiGatewayService {\n private _http = inject(HttpClient);\n \n doGet(url: string, config?: any): Observable<any> {\n return new Observable(observer => {\n if (!config) {\n config = {\n isLoaderHidden: false\n };\n };\n let headers:any;\n if(config.isUnauthorized){\n headers = {\n skip: \"true\"\n }\n }\n \n // this._loaderService.requestStarted(config);\n this._http\n .get(url,{headers: headers})\n .subscribe({\n next: (data) => {\n // this._loaderService.requestEnded();\n observer.next(data);\n observer.complete();\n },\n error: (error) => {\n // this.handleError(error, config, observer);\n }\n });\n })\n }\n doPost(url: string, req_body?: any): Observable<any> {\n return new Observable(observer => {\n let headers:any;\n this._http\n .post(url, req_body,{headers: headers})\n .subscribe({\n next: (data) => {\n if (data && data.hasOwnProperty('status')) {\n observer.next(data);\n observer.complete();\n } else {\n observer.next(data);\n observer.complete();\n }\n },\n error: (error:any) => {\n // this.handleError(error, config, observer);\n }\n })\n });\n }\n}\n","export class HeaderConfig {\n apiUrl: string = '';\n}","import { HttpClient } from '@angular/common/http';\nimport { Inject, Injectable, inject } from '@angular/core';\nimport { HeaderConfig } from './utils/HeaderConfig';\nimport { EndPoints } from './api-endpoints.def';\nimport { ApiGatewayService } from './api-gateway.service';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class CommonHeaderService {\n private baseUrl: string = '';\n private _apiGatewayService = inject(ApiGatewayService);\n constructor(@Inject('headerConfig') private config: HeaderConfig) { \n console.log('version =>1.0.14')\n this.baseUrl = this.config.apiUrl;\n }\n\n // getUserInfo() {\n // let url = `${this.baseUrl}/api/users/fetchLoggedInUsers`;\n // return this._http.get(url);\n // }\n\n getApps() {\n let url = `${this.baseUrl + EndPoints.API_URLS.getAppsApi}`;\n return this._apiGatewayService.doGet(url);\n }\n getCompanyApplications() {\n let url = `${this.baseUrl + EndPoints.API_URLS.getCompanyApplications}`;\n return this._apiGatewayService.doGet(url);\n }\n getUserCompanies() {\n let url = `${this.baseUrl + EndPoints.API_URLS.getUserCompanies}`;\n return this._apiGatewayService.doGet(url);\n }\n updateUserCompany(reqBody: any) {\n let url = `${this.baseUrl + EndPoints.API_URLS.updateUserCompany}`;\n return this._apiGatewayService.doPost(url, reqBody);\n }\n}\n","import { Component } from '@angular/core';\n\n@Component({\n selector: 'lib-common-header',\n template: `\n <p>\n common-header works!\n </p>\n `,\n styles: [\n ]\n})\nexport class CommonHeaderComponent {\n\n}\n","import { Component, OnInit, inject, ViewChild, ViewEncapsulation, Input, Output, EventEmitter } from '@angular/core';\nimport { CommonHeaderService } from '../common-header.service';\nimport { MatSidenav } from '@angular/material/sidenav';\nimport { Router } from '@angular/router';\nimport { MatSnackBar } from '@angular/material/snack-bar';\nimport { UserDetails } from '../utils/UserDetails';\nimport { Auth } from 'aws-amplify';\n\n@Component({\n selector: 'lib-header',\n templateUrl: './header.component.html',\n styleUrls: ['./header.component.css'],\n encapsulation: ViewEncapsulation.None\n})\nexport class HeaderComponent implements OnInit{\n \n // @ViewChild('menudrawer')\n @Input() userInfo!: UserDetails;\n\n @Output() menuEvent = new EventEmitter<any>();\n sidenav!: MatSidenav;\n appList: Array<any> = [];\n userCompanies: any;\n showSwitchCompanies: boolean = false;\n private _router = inject(Router);\n private _snackbar = inject(MatSnackBar);\n\n constructor(private _ser: CommonHeaderService){}\n\n ngOnInit(): void {\n this._ser.getApps().subscribe({\n next: (v) => {\n console.log('from lib',v);\n if(v?.data?.applications && v.data.applications.length > 0){\n this.fetchCompanyData(v.data.applications);\n }\n },\n error: (e) => {\n console.log('from lib errrr',e)\n }\n });\n this.getUserCompany();\n }\n\n fetchCompanyData(allApps:Array<any>) {\n this._ser.getCompanyApplications().subscribe({\n next: (v) => {\n console.log(\"getCompanyApplications res :\", v);\n if (v?.data.enabledApplications) {\n this.appList = [];\n let appInfo = [];\n let fetchedApplications = v.data.enabledApplications.split(',');\n console.log(\"fetchedapps\", fetchedApplications);\n\n if (fetchedApplications.length > 0) {\n fetchedApplications.forEach((element:any) => {\n appInfo = allApps.filter(ele => ele.name == element);\n if (appInfo && appInfo.length > 0) {\n if(appInfo[0].name != 'mca'){\n this.appList.push({\n name: appInfo[0].displayName,\n value: element,\n appUrl: appInfo[0].appUrl\n });\n }\n }\n });\n console.log('apps>>',this.appList)\n }\n }\n\n }\n })\n }\n\n getUserCompany(){\n this._ser.getUserCompanies().subscribe({\n next: (userCompaniesData: any) => {\n if (userCompaniesData && userCompaniesData.data && userCompaniesData.data.companies) {\n this.userCompanies = userCompaniesData.data.companies;\n if (this.userCompanies.length > 1) {\n this.showSwitchCompanies = true;\n }\n }\n },\n error: (e) => {\n console.log(\"Error in fetching companies for the user\");\n }\n })\n }\n\n appRedirect(app:any) {\n // if (app.name != 'Order Management') {\n window.open(app.appUrl, \"_self\");\n // }\n }\n profile() {\n // this.fetchUserData();\n this._router.navigateByUrl('/app/profile');\n }\n onLogoutClick() {\n // this.logoutEvent.emit();\n Auth.signOut({ global: true })\n .then(data => console.log(data))\n .catch(err => {\n console.log(err)\n Auth.signOut();\n });\n }\n switchCompany(company: any) {\n // switch the user to the selectec company\n let req = { companyKey: company.companyKey };\n this._ser.updateUserCompany(req).subscribe({\n next: (response: any) => {\n if (response && response.type && response.type == \"OK\") {\n // refresh the current page to reload the contents based on the current company\n window.location.reload();\n }\n else {\n // display a message to the user that the company could not be switched.\n this._snackbar.open('Company could not be switched. Please try again or contact support.', 'OK', { duration: 5000 })\n }\n },\n error: (e) => {\n // display a message to the user that the company could not be switched.\n this._snackbar.open('Company could not be switched. Please try again or contact support.', 'OK', { duration: 5000 })\n }\n })\n }\n menuAction(){\n this.menuEvent.emit();\n }\n}\n","<!-- <mat-drawer-container autosize>\n <mat-drawer #menudrawer class=\"example-sidenav\" mode=\"over\" (click)=\"sidenav.close()\">\n <div class=\"sidenavPanel\">\n <a class=\"navbar-brand me-auto\" href=\"#\">\n <img src=\"assets/images/Profet_Logo.png\" alt=\"Logo\" style=\"width:140px;\">\n </a>\n <ul class=\"navbarList\">\n <li><img src=\"../../../assets/images/ordersIcon.png\">Orders</li>\n <li><img src=\"../../../assets/images/panelIcon.png\">Panels</li>\n <li><img src=\"../../../assets/images/scheduleIcon.png\">Fee Schedule</li>\n <li><img src=\"../../../assets/images/settingIcon.png\">Settings</li>\n </ul>\n <span class=\"version\">Version: &nbsp;365b520 | 0.16.0</span>\n </div>\n </mat-drawer> -->\n\n\n\n <mat-toolbar color=\"primary\" class=\"common_header shadow-sm\">\n <button mat-icon-button (click)=\"menuAction()\" aria-label=\"main menu\" tabindex=\"0\" class=\"menuHamberger me-4\">\n <img src=\"../assets/images/hamburger_menu.svg\" style=\"width: 20px;height: 20px;\">\n </button>\n <a class=\"navbar-brand me-auto\" href=\"#\">\n <img src=\"assets/images/Profet_Logo.png\" alt=\"Logo\" style=\"width:140px;\">\n </a>\n <span class=\"example-spacer\"></span>\n <button color=\"primary\" mat-stroked-button class=\"btnCreateOrder me-2\"><img class=\"me-2\" src=\"../assets/images/file_upload_icon.svg\" width=\"20px\">Create Order</button>\n <button *ngIf=\"appList.length > 0\" mat-icon-button class=\"me-3 switchButton\" [matMenuTriggerFor]=\"apps\">\n <img src=\"../assets/images/apps.png\" alt=\"apps icon\" style=\"width:20px;height: 20px;\">\n </button>\n <mat-menu #apps=\"matMenu\" class=\"accounts_drpmenu\">\n <div *ngFor=\"let app of appList\">\n <button mat-menu-item (click)=\"appRedirect(app)\">{{app.name}}</button>\n </div>\n </mat-menu>\n <div class=\"profile-name\">\n <p *ngIf=\"userInfo && userInfo.name\" class=\"xsHiddenUsername mb-0\">{{userInfo.name}}</p>\n <!--<span class=\"xsHiddenUsername mb-0\" *ngFor=\"let role of userRole\">{{role | formatWord: true:'_'}}</span>-->\n </div>\n <button mat-button [matMenuTriggerFor]=\"menu\">\n <img class=\"avatarLogo\" src=\"../assets/images/dp.png\" alt=\"Avatar Logo\" class=\"avatarLogo rounded-pill\">\n </button>\n <mat-menu #menu=\"matMenu\" class=\"accounts_drpmenu\">\n <span *ngIf=\"userInfo && userInfo.name\" class=\"xsShowUsername\">{{userInfo.name}}</span>\n <button mat-menu-item (click)=\"profile()\">Profile</button>\n <button mat-menu-item (click)=\"onLogoutClick()\">Logout</button>\n <button *ngIf=\"showSwitchCompanies\" mat-menu-item [matMenuTriggerFor]=\"companies\">Switch Company</button>\n <mat-menu #companies=\"matMenu\" class=\"accounts_drpmenu\">\n <div *ngFor=\"let company of userCompanies\">\n <button mat-menu-item (click)=\"switchCompany(company)\">{{company.name}}</button>\n </div>\n </mat-menu>\n </mat-menu>\n\n\n <!-- <button mat-icon-button class=\"example-icon favorite-icon\" aria-label=\"Example icon-button with heart icon\">\n <mat-icon>favorite</mat-icon>\n </button>\n <button mat-icon-button class=\"example-icon\" aria-label=\"Example icon-button with share icon\">\n <mat-icon>share</mat-icon>\n </button> -->\n </mat-toolbar>\n<!-- </mat-drawer-container> -->","import { NgModule } from '@angular/core';\nimport { CommonHeaderComponent } from './common-header.component';\nimport { HeaderComponent } from './header/header.component';\nimport {MatToolbarModule} from '@angular/material/toolbar';\nimport {MatIconModule} from '@angular/material/icon'\nimport { HttpClientModule } from '@angular/common/http';\nimport {MatButtonModule} from '@angular/material/button'\nimport {MatSidenavModule} from '@angular/material/sidenav';\nimport {MatMenuModule} from '@angular/material/menu';\nimport { CommonModule } from '@angular/common';\nimport { MatSnackBarModule } from \"@angular/material/snack-bar\";\n\n@NgModule({\n declarations: [\n CommonHeaderComponent,\n HeaderComponent\n ],\n imports: [\n CommonModule,\n MatToolbarModule,\n MatIconModule,\n HttpClientModule,\n MatButtonModule,\n MatSidenavModule,\n MatMenuModule,\n MatSnackBarModule\n ],\n exports: [\n CommonHeaderComponent,\n HeaderComponent\n ]\n})\nexport class CommonHeaderModule { }\n","/*\n * Public API Surface of common-header\n */\n\nexport * from './lib/common-header.service';\nexport * from './lib/common-header.component';\nexport * from './lib/common-header.module';\nexport * from './lib/header/header.component';\nexport * from './lib/utils/HeaderConfig';\nexport * from './lib/utils/UserDetails';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["i1.CommonHeaderService"],"mappings":";;;;;;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QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,kBAAkB,iBAlB3B,qBAAqB;AACrB,QAAA,eAAe,aAGf,YAAY;QACZ,gBAAgB;QAChB,aAAa;QACb,gBAAgB;QAChB,eAAe;QACf,gBAAgB;QAChB,aAAa;AACb,QAAA,iBAAiB,aAGjB,qBAAqB;QACrB,eAAe,CAAA,EAAA,CAAA,CAAA;AAGN,kBAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,kBAAkB,YAd3B,YAAY;QACZ,gBAAgB;QAChB,aAAa;QACb,gBAAgB;QAChB,eAAe;QACf,gBAAgB;QAChB,aAAa;QACb,iBAAiB,CAAA,EAAA,CAAA,CAAA;4FAOR,kBAAkB,EAAA,UAAA,EAAA,CAAA;kBApB9B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,YAAY,EAAE;wBACZ,qBAAqB;wBACrB,eAAe;AAChB,qBAAA;AACD,oBAAA,OAAO,EAAE;wBACP,YAAY;wBACZ,gBAAgB;wBAChB,aAAa;wBACb,gBAAgB;wBAChB,eAAe;wBACf,gBAAgB;wBAChB,aAAa;wBACb,iBAAiB;AAClB,qBAAA;AACD,oBAAA,OAAO,EAAE;wBACP,qBAAqB;wBACrB,eAAe;AAChB,qBAAA;AACF,iBAAA,CAAA;;;AC/BD;;AAEG;;ACFH;;AAEG;;;;"}
package/index.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Generated bundle index. Do not edit.
3
+ */
4
+ /// <amd-module name="@propmix/profet-common-header" />
5
+ export * from './public-api';
@@ -0,0 +1,8 @@
1
+ export declare class EndPoints {
2
+ static API_URLS: {
3
+ getAppsApi: string;
4
+ getCompanyApplications: string;
5
+ getUserCompanies: string;
6
+ updateUserCompany: string;
7
+ };
8
+ }
@@ -0,0 +1,9 @@
1
+ import { Observable } from 'rxjs';
2
+ import * as i0 from "@angular/core";
3
+ export declare class ApiGatewayService {
4
+ private _http;
5
+ doGet(url: string, config?: any): Observable<any>;
6
+ doPost(url: string, req_body?: any): Observable<any>;
7
+ static ɵfac: i0.ɵɵFactoryDeclaration<ApiGatewayService, never>;
8
+ static ɵprov: i0.ɵɵInjectableDeclaration<ApiGatewayService>;
9
+ }
@@ -0,0 +1,5 @@
1
+ import * as i0 from "@angular/core";
2
+ export declare class CommonHeaderComponent {
3
+ static ɵfac: i0.ɵɵFactoryDeclaration<CommonHeaderComponent, never>;
4
+ static ɵcmp: i0.ɵɵComponentDeclaration<CommonHeaderComponent, "lib-common-header", never, {}, {}, never, never, false, never>;
5
+ }
@@ -0,0 +1,16 @@
1
+ import * as i0 from "@angular/core";
2
+ import * as i1 from "./common-header.component";
3
+ import * as i2 from "./header/header.component";
4
+ import * as i3 from "@angular/common";
5
+ import * as i4 from "@angular/material/toolbar";
6
+ import * as i5 from "@angular/material/icon";
7
+ import * as i6 from "@angular/common/http";
8
+ import * as i7 from "@angular/material/button";
9
+ import * as i8 from "@angular/material/sidenav";
10
+ import * as i9 from "@angular/material/menu";
11
+ import * as i10 from "@angular/material/snack-bar";
12
+ export declare class CommonHeaderModule {
13
+ static ɵfac: i0.ɵɵFactoryDeclaration<CommonHeaderModule, never>;
14
+ static ɵmod: i0.ɵɵNgModuleDeclaration<CommonHeaderModule, [typeof i1.CommonHeaderComponent, typeof i2.HeaderComponent], [typeof i3.CommonModule, typeof i4.MatToolbarModule, typeof i5.MatIconModule, typeof i6.HttpClientModule, typeof i7.MatButtonModule, typeof i8.MatSidenavModule, typeof i9.MatMenuModule, typeof i10.MatSnackBarModule], [typeof i1.CommonHeaderComponent, typeof i2.HeaderComponent]>;
15
+ static ɵinj: i0.ɵɵInjectorDeclaration<CommonHeaderModule>;
16
+ }
@@ -0,0 +1,14 @@
1
+ import { HeaderConfig } from './utils/HeaderConfig';
2
+ import * as i0 from "@angular/core";
3
+ export declare class CommonHeaderService {
4
+ private config;
5
+ private baseUrl;
6
+ private _apiGatewayService;
7
+ constructor(config: HeaderConfig);
8
+ getApps(): import("rxjs").Observable<any>;
9
+ getCompanyApplications(): import("rxjs").Observable<any>;
10
+ getUserCompanies(): import("rxjs").Observable<any>;
11
+ updateUserCompany(reqBody: any): import("rxjs").Observable<any>;
12
+ static ɵfac: i0.ɵɵFactoryDeclaration<CommonHeaderService, never>;
13
+ static ɵprov: i0.ɵɵInjectableDeclaration<CommonHeaderService>;
14
+ }
@@ -0,0 +1,27 @@
1
+ import { OnInit, EventEmitter } from '@angular/core';
2
+ import { CommonHeaderService } from '../common-header.service';
3
+ import { MatSidenav } from '@angular/material/sidenav';
4
+ import { UserDetails } from '../utils/UserDetails';
5
+ import * as i0 from "@angular/core";
6
+ export declare class HeaderComponent implements OnInit {
7
+ private _ser;
8
+ userInfo: UserDetails;
9
+ menuEvent: EventEmitter<any>;
10
+ sidenav: MatSidenav;
11
+ appList: Array<any>;
12
+ userCompanies: any;
13
+ showSwitchCompanies: boolean;
14
+ private _router;
15
+ private _snackbar;
16
+ constructor(_ser: CommonHeaderService);
17
+ ngOnInit(): void;
18
+ fetchCompanyData(allApps: Array<any>): void;
19
+ getUserCompany(): void;
20
+ appRedirect(app: any): void;
21
+ profile(): void;
22
+ onLogoutClick(): void;
23
+ switchCompany(company: any): void;
24
+ menuAction(): void;
25
+ static ɵfac: i0.ɵɵFactoryDeclaration<HeaderComponent, never>;
26
+ static ɵcmp: i0.ɵɵComponentDeclaration<HeaderComponent, "lib-header", never, { "userInfo": "userInfo"; }, { "menuEvent": "menuEvent"; }, never, never, false, never>;
27
+ }
@@ -0,0 +1,3 @@
1
+ export declare class HeaderConfig {
2
+ apiUrl: string;
3
+ }
@@ -0,0 +1,4 @@
1
+ export interface UserDetails {
2
+ name: string;
3
+ details: any;
4
+ }
package/package.json ADDED
@@ -0,0 +1,32 @@
1
+ {
2
+ "name": "@propmix/profet-common-header",
3
+ "version": "1.0.0",
4
+ "peerDependencies": {
5
+ "@angular/common": "^15.2.0",
6
+ "@angular/core": "^15.2.0",
7
+ "aws-amplify": "^5.2.4"
8
+ },
9
+ "dependencies": {
10
+ "tslib": "^2.3.0"
11
+ },
12
+ "sideEffects": false,
13
+ "module": "fesm2015/propmix-profet-common-header.mjs",
14
+ "es2020": "fesm2020/propmix-profet-common-header.mjs",
15
+ "esm2020": "esm2020/propmix-profet-common-header.mjs",
16
+ "fesm2020": "fesm2020/propmix-profet-common-header.mjs",
17
+ "fesm2015": "fesm2015/propmix-profet-common-header.mjs",
18
+ "typings": "index.d.ts",
19
+ "exports": {
20
+ "./package.json": {
21
+ "default": "./package.json"
22
+ },
23
+ ".": {
24
+ "types": "./index.d.ts",
25
+ "esm2020": "./esm2020/propmix-profet-common-header.mjs",
26
+ "es2020": "./fesm2020/propmix-profet-common-header.mjs",
27
+ "es2015": "./fesm2015/propmix-profet-common-header.mjs",
28
+ "node": "./fesm2015/propmix-profet-common-header.mjs",
29
+ "default": "./fesm2020/propmix-profet-common-header.mjs"
30
+ }
31
+ }
32
+ }
@@ -0,0 +1,6 @@
1
+ export * from './lib/common-header.service';
2
+ export * from './lib/common-header.component';
3
+ export * from './lib/common-header.module';
4
+ export * from './lib/header/header.component';
5
+ export * from './lib/utils/HeaderConfig';
6
+ export * from './lib/utils/UserDetails';