@propmix/profet-common-header 2.0.6 → 2.0.7
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.
- package/README.md +35 -64
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -15,13 +15,12 @@ This library was generated with [Angular CLI](https://github.com/angular/angular
|
|
|
15
15
|
|
|
16
16
|
2. Import the library in module
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
]
|
|
18
|
+
import { CommonHeaderModule } from "@propmix/profet-common-header";
|
|
19
|
+
imports: [
|
|
20
|
+
|
|
21
|
+
// Other import statements
|
|
22
|
+
CommonHeaderModule
|
|
23
|
+
]
|
|
25
24
|
|
|
26
25
|
|
|
27
26
|
3. Use library in the component html
|
|
@@ -34,20 +33,14 @@ This library was generated with [Angular CLI](https://github.com/angular/angular
|
|
|
34
33
|
|
|
35
34
|
1. menuEvent - To capture the side menu click
|
|
36
35
|
|
|
37
|
-
|
|
38
|
-
|
|
39
36
|
*HTML Usage* - `<lib-header (menuEvent)="sideMenuToggle()"></lib-header>`
|
|
40
37
|
|
|
41
|
-
|
|
42
|
-
|
|
43
38
|
*Typescript* -
|
|
44
39
|
|
|
45
40
|
sideMenuToggle(){
|
|
46
41
|
|
|
47
42
|
// Mat menu toogle logic
|
|
48
|
-
|
|
49
43
|
this.sidenav.toggle();
|
|
50
|
-
|
|
51
44
|
}
|
|
52
45
|
|
|
53
46
|
2. infoEvent - Getting company data from header
|
|
@@ -73,95 +66,73 @@ This library was generated with [Angular CLI](https://github.com/angular/angular
|
|
|
73
66
|
## Config
|
|
74
67
|
|
|
75
68
|
|
|
69
|
+
Use an initializer function to configure parameters
|
|
76
70
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
71
|
+
import { HeaderConfig } from '@propmix/profet-common-header/lib/utils/HeaderConfig';
|
|
72
|
+
import { Amplify } from 'aws-amplify';
|
|
73
|
+
import { environment } from 'src/environments/environment';
|
|
80
74
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
75
|
+
export function initializeHeaderConfig(): HeaderConfig {
|
|
76
|
+
const headerConfig: HeaderConfig = {
|
|
77
|
+
apiUrl: environment.portalApiUrl,
|
|
84
78
|
|
|
79
|
+
portalFrontendUrl: environment.portalFrontendUrl,
|
|
80
|
+
// portalFrontendUrl is optional
|
|
81
|
+
|
|
82
|
+
signOutUrl: Amplify.getConfig().Auth.Cognito.loginWith.oauth.redirectSignOut[0]
|
|
83
|
+
// signOutUrl - using this option to specify the logout path.
|
|
84
|
+
// Usually take this from the Amplify config
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
return headerConfig;
|
|
88
|
+
}
|
|
85
89
|
|
|
86
90
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
import { HeaderConfig } from '@propmix/profet-common-header/lib/utils/HeaderConfig';
|
|
90
|
-
|
|
91
|
-
const headerConfig: HeaderConfig = {
|
|
92
|
-
apiUrl: 'your api base url',
|
|
93
|
-
portalFrontendUrl: environment.portalFrontendUrl [Optional]
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
providers: [
|
|
97
|
-
CommonHeaderService,
|
|
98
|
-
{ provide: 'headerConfig', useValue: headerConfig }
|
|
99
|
-
]
|
|
100
|
-
|
|
91
|
+
Use the configuration option in the app.module.ts file
|
|
101
92
|
|
|
102
93
|
|
|
103
|
-
|
|
94
|
+
import { CommonHeaderService } from '@propmix/profet-common-header';
|
|
95
|
+
|
|
96
|
+
import { HeaderConfig } from '@propmix/profet-common-header/lib/utils/HeaderConfig';
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
providers: [
|
|
100
|
+
CommonHeaderService,
|
|
101
|
+
{ provide: 'headerConfig', useFactory: initializeHeaderConfig }
|
|
102
|
+
]
|
|
104
103
|
|
|
105
104
|
## Publishing
|
|
106
105
|
|
|
107
|
-
|
|
108
|
-
|
|
109
106
|
1. ng build common-header
|
|
110
107
|
|
|
111
|
-
|
|
112
|
-
|
|
113
108
|
2. cd dist/common-header
|
|
114
109
|
|
|
115
|
-
|
|
116
|
-
|
|
117
110
|
3. npm publish --access public
|
|
118
111
|
|
|
119
112
|
|
|
120
113
|
|
|
121
114
|
## Local testing
|
|
122
115
|
|
|
123
|
-
|
|
124
|
-
|
|
125
116
|
Do these steps from the library directory
|
|
126
117
|
|
|
127
|
-
|
|
128
|
-
|
|
129
118
|
1. ng build common-header
|
|
130
119
|
|
|
131
120
|
2. cd dist/common-header/
|
|
132
121
|
|
|
133
122
|
3. npm link
|
|
134
123
|
|
|
135
|
-
|
|
136
|
-
|
|
137
124
|
Do this steps from the client application
|
|
138
125
|
|
|
139
|
-
|
|
140
|
-
|
|
141
126
|
1. npm ci
|
|
142
127
|
|
|
143
128
|
2. npm link @propmix/profet-common-header
|
|
144
129
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
130
|
## Running unit tests
|
|
150
131
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
132
|
Run `ng test common-header` to execute the unit tests via [Karma](https://karma-runner.github.io).
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
133
|
+
|
|
160
134
|
|
|
161
135
|
## Further help
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
136
|
+
|
|
166
137
|
|
|
167
138
|
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.
|