ngx-sp-auth 1.0.5 → 2.1.6

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.
Files changed (64) hide show
  1. package/README.md +207 -24
  2. package/fesm2022/ngx-sp-auth.mjs +381 -409
  3. package/fesm2022/ngx-sp-auth.mjs.map +1 -1
  4. package/lib/auth.module.d.ts +8 -15
  5. package/lib/components/menu-lateral/dropdown/primary-dropdown/primary-dropdown.component.d.ts +1 -1
  6. package/lib/components/menu-lateral/dropdown/secondary-dropdown/secondary-dropdown.component.d.ts +1 -1
  7. package/lib/components/menu-lateral/menu/menu-lateral.component.d.ts +13 -13
  8. package/lib/components/menu-lateral/menu/selecao-estabelecimentos-modal/selecao-estabelecimentos-modal.component.d.ts +1 -1
  9. package/lib/components/menu-lateral/submenus/dynamic-menu/dynamic-menu.component.d.ts +1 -1
  10. package/lib/components/menu-lateral/submenus/notif-submenu/notif-submenu.component.d.ts +1 -1
  11. package/lib/components/nova-senha/nova-senhacomponent.d.ts +1 -1
  12. package/package.json +2 -4
  13. package/esm2022/lib/auth.module.mjs +0 -87
  14. package/esm2022/lib/auth.service.mjs +0 -306
  15. package/esm2022/lib/components/login/login.component.mjs +0 -323
  16. package/esm2022/lib/components/menu-lateral/dropdown/primary-dropdown/primary-dropdown.component.mjs +0 -67
  17. package/esm2022/lib/components/menu-lateral/dropdown/secondary-dropdown/secondary-dropdown.component.mjs +0 -32
  18. package/esm2022/lib/components/menu-lateral/menu/list-estab.service.mjs +0 -55
  19. package/esm2022/lib/components/menu-lateral/menu/menu-lateral.component.mjs +0 -233
  20. package/esm2022/lib/components/menu-lateral/menu/selecao-estabelecimentos-modal/selecao-estabelecimentos-modal.component.mjs +0 -200
  21. package/esm2022/lib/components/menu-lateral/menu-services.service.mjs +0 -151
  22. package/esm2022/lib/components/menu-lateral/model/iestabelecimento.model.mjs +0 -2
  23. package/esm2022/lib/components/menu-lateral/model/imenu-item-structure.model.mjs +0 -2
  24. package/esm2022/lib/components/menu-lateral/model/imenu.model.mjs +0 -12
  25. package/esm2022/lib/components/menu-lateral/model/infrausuarioimg.mjs +0 -12
  26. package/esm2022/lib/components/menu-lateral/model/isubmenu-item-structure.model.mjs +0 -2
  27. package/esm2022/lib/components/menu-lateral/model/ret-estabelecimento-session.mjs +0 -10
  28. package/esm2022/lib/components/menu-lateral/model/ret-infrausuarioemail.mjs +0 -8
  29. package/esm2022/lib/components/menu-lateral/model/ret-infrausuarioimg.mjs +0 -11
  30. package/esm2022/lib/components/menu-lateral/model/usuario-img.mjs +0 -8
  31. package/esm2022/lib/components/menu-lateral/submenus/dynamic-menu/dynamic-menu.component.mjs +0 -54
  32. package/esm2022/lib/components/menu-lateral/submenus/notif-submenu/notif-submenu.component.mjs +0 -14
  33. package/esm2022/lib/components/nova-senha/nova-senhacomponent.mjs +0 -191
  34. package/esm2022/lib/custom/custom-login.service.mjs +0 -52
  35. package/esm2022/lib/custom/custom-menu.service.mjs +0 -88
  36. package/esm2022/lib/custom/custom-storage.service.mjs +0 -70
  37. package/esm2022/lib/custom/menu-config.service.mjs +0 -70
  38. package/esm2022/lib/custom/models/icustom-login-service.mjs +0 -2
  39. package/esm2022/lib/custom/models/icustom-menu-service.mjs +0 -2
  40. package/esm2022/lib/custom/models/icustom-storage-service.mjs +0 -2
  41. package/esm2022/lib/custom/models/imenu-config.mjs +0 -2
  42. package/esm2022/lib/environments/environments.service.mjs +0 -21
  43. package/esm2022/lib/environments/models/ienvironments.mjs +0 -2
  44. package/esm2022/lib/guards/auth-guard.mjs +0 -34
  45. package/esm2022/lib/guards/external-login-guard.mjs +0 -88
  46. package/esm2022/lib/guards/login-guard.mjs +0 -35
  47. package/esm2022/lib/interceptors/auth-aplic.interceptor.mjs +0 -41
  48. package/esm2022/lib/interceptors/auth-infra.interceptor.mjs +0 -30
  49. package/esm2022/lib/models/code-2fa.mjs +0 -2
  50. package/esm2022/lib/models/custom-propriedades-login.mjs +0 -3
  51. package/esm2022/lib/models/forgotten-password-form.mjs +0 -2
  52. package/esm2022/lib/models/login-form.mjs +0 -2
  53. package/esm2022/lib/models/login.mjs +0 -2
  54. package/esm2022/lib/models/nova-senha-form.mjs +0 -2
  55. package/esm2022/lib/models/password-recup.mjs +0 -2
  56. package/esm2022/lib/models/payload.mjs +0 -2
  57. package/esm2022/lib/models/ret-login.mjs +0 -21
  58. package/esm2022/lib/models/ret-token.mjs +0 -8
  59. package/esm2022/lib/models/token.mjs +0 -2
  60. package/esm2022/lib/server/ret-server-config.mjs +0 -9
  61. package/esm2022/lib/server/server.service.mjs +0 -38
  62. package/esm2022/lib/storage/auth-storage.service.mjs +0 -365
  63. package/esm2022/ngx-sp-auth.mjs +0 -5
  64. package/esm2022/public-api.mjs +0 -39
package/README.md CHANGED
@@ -1,24 +1,207 @@
1
- # NgxSpAuth
2
-
3
- This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 17.3.0.
4
-
5
- ## Code scaffolding
6
-
7
- Run `ng generate component component-name --project ngx-sp-auth` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project ngx-sp-auth`.
8
- > Note: Don't forget to add `--project ngx-sp-auth` or else it will be added to the default project in your `angular.json` file.
9
-
10
- ## Build
11
-
12
- Run `ng build ngx-sp-auth` to build the project. The build artifacts will be stored in the `dist/` directory.
13
-
14
- ## Publishing
15
-
16
- After building your library with `ng build ngx-sp-auth`, go to the dist folder `cd dist/ngx-sp-auth` and run `npm publish`.
17
-
18
- ## Running unit tests
19
-
20
- Run `ng test ngx-sp-auth` to execute the unit tests via [Karma](https://karma-runner.github.io).
21
-
22
- ## Further help
23
-
24
- 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.
1
+ # NgxSpAuth - Biblioteca de Login 🔐
2
+
3
+ ![npm version](https://img.shields.io/npm/v/ngx-sp-auth)
4
+
5
+ ![npm downloads](https://img.shields.io/npm/dt/ngx-sp-auth)
6
+
7
+ # Introdução 📝
8
+
9
+ Esta biblioteca fornece componentes de telas relacionadas a autenticação.
10
+
11
+ # Recursos 🚀
12
+
13
+ ✅ Autenticação de usuários com tenant, usuario e senha;
14
+
15
+ ✅ Recuperação de senha;
16
+
17
+ ✅ Menu Lateral liberado após Login.
18
+
19
+ # Instalação e configuração 📥
20
+
21
+ 1️⃣ Instalar a biblioteca - utilizando o comando "npm install ngx-sp-auth";
22
+
23
+ 2️⃣ Configurar o sistema para utilizar os componentes (somente para projetos que nunca utilizaram essa biblioteca);
24
+
25
+ 2.1. Substituir referência do import { AuthStorageService } from 'src/app/auth/storage/auth-storage.service'
26
+ para import { AuthStorageService } from 'ngx-sp-auth';
27
+
28
+ 2.2. Verificar se existe mais alguma referência para algum arquivo dentro do diretório "src/app/auth/" e substitua a importação para "ngx-sp-auth",
29
+ isso depende de cada projeto.
30
+
31
+ 2.3. Adicionar/Alterar os seguintes trechos de código do projeto.
32
+
33
+ - import { AuthGuard, LoginComponent, NovaSenhaComponent } from "ngx-sp-auth";
34
+
35
+ - No seu APP_ROUTES colocar as rotas abaixo.
36
+
37
+ ```typescript
38
+ {
39
+ path: "auth/login",
40
+ component: LoginComponent,
41
+ canLoad: [LoginGuard]
42
+ },
43
+ {
44
+ path: 'auth/login/novaSenha/:param',
45
+ component: NovaSenhaComponent,
46
+ canLoad: [LoginGuard]
47
+ }
48
+ ```
49
+
50
+ - No seu app-component.ts adicionar o seguinte código abaixo.
51
+ (Serve principalmente para adicionar propriedades e métodos customizados ou não para a biblioteca).
52
+
53
+ ```typescript
54
+ import { AuthStorageService, EnvironmentService, ICustomLoginService, ICustomMenuService, ICustomStorageService, IEnvironments, IMenuConfig, LibCustomLoginService, LibCustomMenuService, LibCustomStorageService, MenuConfigService } from 'ngx-sp-auth';
55
+ import { CustomMenuService } from './project/custom/menu/custom-menu.service';
56
+ import { CustomLoginService } from './project/custom/login/custom-login.service';
57
+ import { CustomStorageService } from './project/custom/storage/custom-storage.service';
58
+
59
+ export class AppComponent {
60
+
61
+ private _menuConfig = new MenuConfig(false);
62
+
63
+ public configCustomLogin: ICustomLoginService = {
64
+ // passando propriedades customizadas para o componente de Login
65
+ loginTitle: "",
66
+ loginSubtitle: "",
67
+ loginBackground: "",
68
+ loginLogotipo: "",
69
+ loginAltLogotipo: "",
70
+ loginPageTitle: "",
71
+ loginDesenvDomain: "",
72
+ loginDesenvUser: "",
73
+ loginDesenvPassword: "",
74
+ // passando métodos customizados para o componente de Login
75
+ authLogin: (): void => { },
76
+ authLogout: (): void => { }
77
+ }
78
+
79
+ public mapsEnvironment: IEnvironments = {
80
+ needsAuthAplic: environment.needsAuthAplic,
81
+ needsAuthInfra: environment.needsAuthInfra
82
+ };
83
+
84
+ public configMenuProduto: IMenuConfig = {
85
+ isMenuStatic: this._menuConfig._isMenuStatic,
86
+ initializeMenu: this._menuConfig.initializeMenu,
87
+ menuOptions: this._menuConfig.menuOptions,
88
+ initializeMenuDropdown: this._menuConfig.initializeMenuDropdown
89
+ }
90
+
91
+ public configCustomMenuService: ICustomMenuService = {
92
+ menuDynamic: false,
93
+ moduleName: '',
94
+ moduleImg: '',
95
+ moduleSvg: "",
96
+ themeColor: "",
97
+ menuDynamicOnInit: (): void => { },
98
+ menuStaticOnInit: (): void => { },
99
+ menuopenExpansibleMenu: (ref: HTMLDivElement): void => { },
100
+ };
101
+
102
+ public configCustomStorageService: ICustomStorageService = {
103
+ isSaving: false,
104
+ storageConstructor: (): void => { },
105
+ storageLogout: (): void => { },
106
+ storageSaveLocalInstance: (): void => { },
107
+ storageInitializeAutoStorage: (): void => { }
108
+ };
109
+
110
+ constructor(
111
+ private _environmentService: EnvironmentService,
112
+ private _menuConfigService: MenuConfigService,
113
+ private _customMenuService: CustomMenuService,
114
+ private _customLoginService: CustomLoginService,
115
+ private _customStorageService: CustomStorageService,
116
+ private _libCusomLoginService: LibCustomLoginService,
117
+ private _libCustomMenuService: LibCustomMenuService,
118
+ private _libCustomStorageService: LibCustomStorageService,
119
+ ) {
120
+
121
+ this.configCustomMenuService.menuDynamic = this._customMenuService.menuDynamic;
122
+ this.configCustomMenuService.moduleName = this._customMenuService.moduleName;
123
+ this.configCustomMenuService.moduleImg = this._customMenuService.moduleImg;
124
+ this.configCustomMenuService.moduleSvg = this._customMenuService.moduleSvg;
125
+ this.configCustomMenuService.themeColor = this._customMenuService.themeColor;
126
+
127
+ this.configCustomStorageService.storageConstructor = this._customStorageService.storageConstructor;
128
+ this.configCustomStorageService.storageInitializeAutoStorage = this._customStorageService.storageInitializeAutoStorage;
129
+ this.configCustomStorageService.storageLogout = this._customStorageService.storageLogout;
130
+ this.configCustomStorageService.storageSaveLocalInstance = this._customStorageService.storageSaveLocalInstance;
131
+
132
+ this.configCustomLogin.loginAltLogotipo = this._customLoginService.loginAltLogotipo;
133
+ this.configCustomLogin.loginTitle = this._customLoginService.loginTitle;
134
+ this.configCustomLogin.loginSubtitle = this._customLoginService.loginSubtitle;
135
+ this.configCustomLogin.loginPageTitle = this._customLoginService.loginPageTitle;
136
+ this.configCustomLogin.loginLogotipo = this._customLoginService.loginLogotipo;
137
+ this.configCustomLogin.loginDesenvUser = this._customLoginService.loginDesenvUser;
138
+ this.configCustomLogin.loginDesenvDomain = this._customLoginService.loginDesenvDomain;
139
+ this.configCustomLogin.loginDesenvPassword = this._customLoginService.loginDesenvPassword;
140
+ this.configCustomLogin.loginBackground = this._customLoginService.loginBackground;
141
+ this.configCustomLogin.authLogin = this._customLoginService.authLogin;
142
+ this.configCustomLogin.authLogout = this._customLoginService.authLogout;
143
+
144
+ this.configCustomMenuService.menuDynamicOnInit = this._customMenuService.menuDynamicOnInit;
145
+ this.configCustomMenuService.menuStaticOnInit = this._customMenuService.menuStaticOnInit;
146
+ this.configCustomMenuService.menuopenExpansibleMenu = this._customMenuService.menuopenExpansibleMenu;
147
+
148
+ _libCustomStorageService.ConfigurarCustomStorage(this.configCustomStorageService);
149
+ _libCusomLoginService.ConfigurarCustomLogin(this.configCustomLogin);
150
+ _environmentService.ConfigurarEnvironments(this.mapsEnvironment);
151
+ _menuConfigService.ConfigurarMenuConfig(this.configMenuProduto);
152
+ _libCustomMenuService.ConfigurarCustomMenuService(this.configCustomMenuService);
153
+ }
154
+ }
155
+ ```
156
+
157
+ - Remover o AUTH_ROUTES do main.ts
158
+
159
+ Antes:
160
+ ```typescript
161
+ provideRouter([
162
+ ...APP_ROUTES,
163
+ ...PROJECT_ROUTES,
164
+ ...AUTH_ROUTES
165
+ ]),
166
+
167
+ ```
168
+ Depois:
169
+
170
+ ```typescript
171
+ provideRouter([
172
+ ...APP_ROUTES,
173
+ ...PROJECT_ROUTES,
174
+ ]),
175
+ ```
176
+
177
+ - Verificar o hostname do environments.ts, mudar tudo para minúsculo se tiver algo escrito em maiúsculo.
178
+
179
+ # Customização de Estilos (SCSS) 🎨
180
+
181
+ Para realizar as customizações de SCSS na biblioteca é necessario implementar o código nos seguintes arquivos do seu projeto.
182
+
183
+ - custom-login-styles.scss
184
+ - custom-menu-styles.scss
185
+ - custom-styles.scss
186
+
187
+ Classes possiveis de estilização no componente de Login:
188
+
189
+ ```typescript
190
+ //Ainda sendo validado.
191
+ ```
192
+
193
+ # Publicar no NPM 🚀
194
+
195
+ 1️⃣ Mudar a propriedade "version" do no package.json para o número da nova versão que se deseja publicar no NPM.
196
+
197
+ nova versão PATCH (0.0.1);
198
+
199
+ nova versão MINOR (0.1.0);
200
+
201
+ nova versão MAJOR (1.0.0) *Somente para grandes mudanças biblioteca*.
202
+
203
+ 2️⃣ Comandos para publicação:
204
+
205
+ - `cd dist/ngx-sp-auth`
206
+ - `npm adduser` OU `npm login` _- depende se você já possui conta no NPM ou não_
207
+ - `npm publish --access public --tag latest`