@arsedizioni/ars-utils 22.0.8 → 22.0.11

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 (31) hide show
  1. package/fesm2022/arsedizioni-ars-utils-clipper.common.mjs +2 -11
  2. package/fesm2022/arsedizioni-ars-utils-clipper.common.mjs.map +1 -1
  3. package/fesm2022/arsedizioni-ars-utils-clipper.ui.mjs +6 -8
  4. package/fesm2022/arsedizioni-ars-utils-clipper.ui.mjs.map +1 -1
  5. package/fesm2022/arsedizioni-ars-utils-core.mjs +1700 -1797
  6. package/fesm2022/arsedizioni-ars-utils-core.mjs.map +1 -1
  7. package/fesm2022/arsedizioni-ars-utils-evolution.common.mjs +3 -12
  8. package/fesm2022/arsedizioni-ars-utils-evolution.common.mjs.map +1 -1
  9. package/fesm2022/arsedizioni-ars-utils-help.mjs +2 -11
  10. package/fesm2022/arsedizioni-ars-utils-help.mjs.map +1 -1
  11. package/fesm2022/arsedizioni-ars-utils-support.common.mjs +3 -12
  12. package/fesm2022/arsedizioni-ars-utils-support.common.mjs.map +1 -1
  13. package/fesm2022/arsedizioni-ars-utils-tinymce.mjs +2 -12
  14. package/fesm2022/arsedizioni-ars-utils-tinymce.mjs.map +1 -1
  15. package/fesm2022/arsedizioni-ars-utils-ui.application.mjs +96 -123
  16. package/fesm2022/arsedizioni-ars-utils-ui.application.mjs.map +1 -1
  17. package/fesm2022/arsedizioni-ars-utils-ui.mjs +6 -301
  18. package/fesm2022/arsedizioni-ars-utils-ui.mjs.map +1 -1
  19. package/fesm2022/arsedizioni-ars-utils-ui.oauth.mjs +2 -11
  20. package/fesm2022/arsedizioni-ars-utils-ui.oauth.mjs.map +1 -1
  21. package/package.json +5 -1
  22. package/types/arsedizioni-ars-utils-clipper.common.d.ts +3 -8
  23. package/types/arsedizioni-ars-utils-clipper.ui.d.ts +1 -1
  24. package/types/arsedizioni-ars-utils-core.d.ts +506 -490
  25. package/types/arsedizioni-ars-utils-evolution.common.d.ts +4 -10
  26. package/types/arsedizioni-ars-utils-help.d.ts +34 -40
  27. package/types/arsedizioni-ars-utils-support.common.d.ts +4 -10
  28. package/types/arsedizioni-ars-utils-tinymce.d.ts +7 -13
  29. package/types/arsedizioni-ars-utils-ui.application.d.ts +46 -56
  30. package/types/arsedizioni-ars-utils-ui.d.ts +5 -98
  31. package/types/arsedizioni-ars-utils-ui.oauth.d.ts +2 -8
@@ -1,13 +1,13 @@
1
- import * as i0 from '@angular/core';
2
- import { Injectable, signal, ChangeDetectionStrategy, Component, output, inject, Service, makeEnvironmentProviders, NgModule, input, computed, viewChildren, forwardRef, DestroyRef, NgZone, afterNextRender, InjectionToken, TemplateRef, ViewContainerRef, effect, Directive, ElementRef, Renderer2, PLATFORM_ID, isDevMode } from '@angular/core';
3
- import { SafeHtmlPipe, SystemUtils, ArsCoreModule, PasswordValidatorDirective, EqualsValidatorDirective, EnvironmentService } from '@arsedizioni/ars-utils/core';
4
1
  import { MatPaginatorIntl } from '@angular/material/paginator';
2
+ import * as i0 from '@angular/core';
3
+ import { Injectable, signal, ChangeDetectionStrategy, Component, output, inject, Service, input, computed, viewChildren, forwardRef, InjectionToken, TemplateRef, ViewContainerRef, effect, Directive, ElementRef, Renderer2, PLATFORM_ID, isDevMode, NgModule } from '@angular/core';
5
4
  import { Overlay } from '@angular/cdk/overlay';
6
5
  import { ComponentPortal } from '@angular/cdk/portal';
7
6
  import { PlatformLocation, isPlatformBrowser } from '@angular/common';
8
7
  import { MatDialogRef, MAT_DIALOG_DATA, MatDialogTitle, MatDialogContent, MatDialogClose, MatDialogActions, MatDialog } from '@angular/material/dialog';
9
8
  import { MAT_SNACK_BAR_DATA, MatSnackBar } from '@angular/material/snack-bar';
10
- import { timer, filter, map, distinctUntilChanged, shareReplay } from 'rxjs';
9
+ import { SafeHtmlPipe, SystemUtils, PasswordValidatorDirective, EqualsValidatorDirective } from '@arsedizioni/ars-utils/core';
10
+ import { timer, map, distinctUntilChanged, shareReplay } from 'rxjs';
11
11
  import { tap, first } from 'rxjs/operators';
12
12
  import * as i3 from '@angular/material/progress-spinner';
13
13
  import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
@@ -29,18 +29,8 @@ import * as i2$3 from '@angular/material/form-field';
29
29
  import { MatFormFieldModule } from '@angular/material/form-field';
30
30
  import * as i3$2 from '@angular/material/input';
31
31
  import { MatInputModule } from '@angular/material/input';
32
- import { takeUntilDestroyed, toSignal } from '@angular/core/rxjs-interop';
33
- import { MsalBroadcastService, MsalService, MSAL_INSTANCE, MSAL_GUARD_CONFIG, MSAL_INTERCEPTOR_CONFIG } from '@azure/msal-angular';
34
- import { PublicClientApplication, BrowserCacheLocation, InteractionType, EventType } from '@azure/msal-browser';
35
- import { broadcastResponseToMainFrame } from '@azure/msal-browser/redirect-bridge';
36
32
  import { BreakpointObserver } from '@angular/cdk/layout';
37
-
38
- var LoginOAuthType;
39
- (function (LoginOAuthType) {
40
- LoginOAuthType[LoginOAuthType["None"] = 0] = "None";
41
- LoginOAuthType[LoginOAuthType["Microsoft"] = 1] = "Microsoft";
42
- LoginOAuthType[LoginOAuthType["Google"] = 2] = "Google";
43
- })(LoginOAuthType || (LoginOAuthType = {}));
33
+ import { toSignal } from '@angular/core/rxjs-interop';
44
34
 
45
35
  /** Italian localisation for the Material paginator labels. */
46
36
  class PaginatorIntl extends MatPaginatorIntl {
@@ -791,46 +781,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.0", ngImpor
791
781
  type: Service
792
782
  }], ctorParameters: () => [] });
793
783
 
794
- /**
795
- * Standalone providers for the ars-utils "ui" layer.
796
- *
797
- * Currently this entry point has NO environment-level providers to register:
798
- * - Services use `@Service()` (root-provided) and are loaded on demand when injected.
799
- * - The core pipes (format, safeHtml, replace, ...) are standalone and template-only,
800
- * so consuming components import them via `imports: []` — they never need to be
801
- * listed here. Listing them would force all of them into the eager bundle and
802
- * defeat tree-shaking.
803
- *
804
- * The function is kept for API symmetry / future configuration and so standalone apps
805
- * have a stable extension point.
806
- *
807
- * @example
808
- * bootstrapApplication(AppComponent, {
809
- * providers: [provideArsUI()]
810
- * });
811
- */
812
- function provideArsUI() {
813
- return makeEnvironmentProviders([]);
814
- }
815
- /**
816
- * @deprecated Prefer the standalone {@link provideArsUI} provider together with
817
- * direct imports of the standalone components/directives. This module is kept as a thin,
818
- * backward-compatible shim so existing NgModule-based applications keep working unchanged.
819
- */
820
- class ArsUIModule {
821
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.0", ngImport: i0, type: ArsUIModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
822
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "22.0.0", ngImport: i0, type: ArsUIModule, imports: [ArsCoreModule] }); }
823
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "22.0.0", ngImport: i0, type: ArsUIModule, imports: [ArsCoreModule] }); }
824
- }
825
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.0", ngImport: i0, type: ArsUIModule, decorators: [{
826
- type: NgModule,
827
- args: [{
828
- imports: [
829
- ArsCoreModule,
830
- ],
831
- }]
832
- }] });
833
-
834
784
  const DEFAULT_STRENGTH = { score: 0, label: '', color: '', suggestions: [], isValid: false };
835
785
  /**
836
786
  * Displays a password-strength indicator for the provided password string.
@@ -1218,251 +1168,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.0", ngImpor
1218
1168
  ], template: "<div class=\"dialog-info\">\r\n @if (f.form.invalid) {\r\n <span class=\"dialog-info-error\">Ci sono ancora dei campi obbligatori (*) non compilati.</span>\r\n } @else {\r\n <span class=\"dialog-info-ok\">Tutti i campi obbligatori (*) sono compilati.</span>\r\n }\r\n</div>\r\n<div mat-dialog-title>Reimposta password</div>\r\n<mat-dialog-content>\r\n <form name=\"form\" #f=\"ngForm\" novalidate>\r\n @if (dialogData().mode === 'forgot') {\r\n <mat-form-field style=\"width: 100%;\" [appearance]=\"dialogData().appearance\">\r\n <mat-label>Email che hai scelto quando ti sei registrato</mat-label>\r\n <input type=\"email\" matInput [(ngModel)]=\"item.userEmail\" name=\"userEmail\" #userEmail=\"ngModel\" email required\r\n [attr.aria-label]=\"'Email con cui ti sei registrato'\">\r\n @if (userEmail.invalid) {\r\n <mat-error>Email non valida.</mat-error>\r\n }\r\n </mat-form-field>\r\n }\r\n @if (dialogData().mode !== 'admin') {\r\n <mat-form-field style=\"width: 100%;\" [appearance]=\"dialogData().appearance\">\r\n <mat-label>Vecchia password</mat-label>\r\n <input [type]=\"!showOldPassword() ? 'password' : 'text'\" matInput name=\"oldPwd\" autocomplete=\"on\"\r\n [(ngModel)]=\"item.oldPassword\" required maxlength=\"30\" #oldPwd=\"ngModel\">\r\n <button type=\"button\" mat-icon-button class=\"toolbar-suffix\" matSuffix\r\n (click)=\"showOldPassword.set(!showOldPassword())\">\r\n <mat-icon>{{showOldPassword() ? 'visibility' : 'visibility_off'}}</mat-icon>\r\n </button>\r\n @if(item.oldPassword) {\r\n <password-strength [password]=\"item.oldPassword\"></password-strength>\r\n }\r\n @if (oldPwd.invalid) {\r\n <mat-error>Non valido.</mat-error>\r\n }\r\n </mat-form-field>\r\n }\r\n <mat-form-field style=\"width: 100%;\" hintLabel=\"Minimo 10 car. con 1 simbolo e 1 maiuscola\"\r\n [appearance]=\"dialogData().appearance\">\r\n <mat-label>Nuova password</mat-label>\r\n <input [type]=\"!showPassword() ? 'password' : 'text'\" matInput name=\"newPwd\" [(ngModel)]=\"item.password\" required\r\n password minlength=\"10\" maxlength=\"30\" #newPwd=\"ngModel\">\r\n @if(item.password) {\r\n <password-strength [password]=\"item.password\"></password-strength>\r\n }\r\n <button type=\"button\" mat-icon-button class=\"toolbar-suffix\" matSuffix (click)=\"showPassword.set(!showPassword())\">\r\n <mat-icon>{{showPassword() ? 'visibility' : 'visibility_off'}}</mat-icon>\r\n </button>\r\n <mat-hint align=\"end\">{{newPwd.value?.length || 0}}/30</mat-hint>\r\n @if (newPwd.invalid) {\r\n <mat-error>Non valido.</mat-error>\r\n }\r\n </mat-form-field>\r\n <mat-form-field style=\"width: 100%;\" hintLabel=\"Minimo 10 car. con 1 simbolo e 1 maiuscola\"\r\n [appearance]=\"dialogData().appearance\">\r\n <mat-label>Conferma nuova password</mat-label>\r\n <input [type]=\"!showPassword2() ? 'password' : 'text'\" matInput name=\"newPwd2\" [(ngModel)]=\"item.password2\"\r\n [required]=\"dialogData().mode !== 'admin'\" password minlength=\"10\" maxlength=\"30\" [equals]=\"newPwd.control\" #newPwd2=\"ngModel\">\r\n <button type=\"button\" mat-icon-button class=\"toolbar-suffix\" matSuffix (click)=\"showPassword2.set(!showPassword2())\">\r\n <mat-icon>{{showPassword2() ? 'visibility' : 'visibility_off'}}</mat-icon>\r\n </button>\r\n @if(item.password2) {\r\n <password-strength [password]=\"item.password2\"></password-strength>\r\n }\r\n <mat-hint align=\"end\">{{newPwd2.value?.length || 0}}/30</mat-hint>\r\n @if (newPwd2.invalid) {\r\n <mat-error>Non valido.</mat-error>\r\n }\r\n </mat-form-field>\r\n </form>\r\n</mat-dialog-content>\r\n<mat-dialog-actions>\r\n <div fxLayout=\"row\" fxLayoutGap=\"10px\" fxFill>\r\n <div fxFlex=\"30\">\r\n @if (dialogData().mode === 'admin') {\r\n <button mat-stroked-button (click)=\"generatePassword()\">Genera</button>\r\n }\r\n </div>\r\n <div fxFlex=\"70\" fxLayoutAlign=\"end\">\r\n <button mat-flat-button [disabled]=\"f.form.invalid\" (click)=\"ok()\">Salva</button>\r\n @if (dialogData().mode !== 'forgot') {\r\n <button mat-stroked-button [mat-dialog-close]=\"true\">Annulla</button>\r\n }\r\n </div>\r\n </div>\r\n</mat-dialog-actions>", styles: [".dialog-info{font-size:x-small;font-weight:700;text-align:right;padding:10px}.dialog-info-green,.dialog-info-ok{color:var(--ars-color-ok, #388E3C)}.dialog-info-red,.dialog-info-error{color:var(--mat-form-field-error-text-color, #a80710)}.dialog-header{padding-bottom:20px}.dialog-toolbar{padding:0 5px 0 24px;height:48px;min-height:48px}.dialog-close{margin-right:5px;margin-top:0}.dialog-menu{margin-left:10px;margin-top:10px}.dialog-title{padding:0 24px}.section-title{font-size:large;font-weight:600;padding-top:10px;padding-bottom:8px}.center{text-align:center}.wide{min-width:100%!important;max-width:100%!important;width:100%!important}.fill{min-width:100%!important;max-width:100%!important;width:100%!important;min-height:100%!important;max-height:100%!important;height:100%!important}.scroll-auto{overflow:auto;height:100%}.scroll-hidden{overflow:hidden;height:100%}b{font-weight:700}.large{font-size:large!important}.smaller{font-size:smaller!important}.small{font-size:small!important;line-height:16px!important}.small-icon-button{width:1.5rem!important;height:1.5rem!important;padding:0!important;display:inline-flex!important;align-items:center;justify-content:center}.small-icon-button .mat-mdc-button-touch-target{width:1.5rem!important;height:1.5rem!important}.x-small{font-size:x-small!important;line-height:14px!important}.bold{font-weight:700}.uppercase{text-transform:uppercase!important}.lowercase{text-transform:lowercase!important}.truncated{min-width:0;max-width:100%}@supports (-webkit-line-clamp: 2){.truncated{overflow:hidden;text-overflow:ellipsis;white-space:initial;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}}.truncated span,.truncated div{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}@supports (-webkit-line-clamp: 2){.truncated span,.truncated div{overflow:hidden;text-overflow:ellipsis;white-space:initial;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}}.clipped{min-width:0;max-width:100%}.clipped span,.clipped div{white-space:nowrap;overflow:hidden;text-overflow:clip}.accent{color:var(--ars-color-accent, #7894ae)!important}.primary{color:var(--ars-color-primary, #00a293)!important}.secondary{color:var(--ars-color-secondary, #4a635f)!important}.error{color:var(--ars-color-error, #ff5449)!important}.success{color:var(--ars-color-ok, #388E3C)!important}.warning{color:var(--ars-color-warning, #FFC107)!important}.text{color:var(--ars-color-text, #191c1b)!important}.overlay{position:absolute;top:0;left:0;width:100%;height:100%;z-index:10;background-color:var(--ars-color-overlay, rgba(255, 255, 255, .75))}.drawer-content{padding-top:10px}.drawer .title-container,.drawer-small .title-container{padding:20px 5px 20px 0}.drawer .title-container-with-loader,.drawer-small .title-container-with-loader{padding:14px 5px 20px 0}.drawer .title,.drawer-small .title{font-size:19.2px!important;font-weight:600;padding-left:15px;min-width:150px;width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.drawer .accordion-panel,.drawer-small .accordion-panel{background-color:transparent!important}.drawer .accordion-header,.drawer-small .accordion-header{padding-left:10px;padding-right:10px;border-radius:var(--mat-expansion-container-shape)}.drawer .mat-expansion-panel-body,.drawer-small .mat-expansion-panel-body{padding-left:10px!important;padding-right:10px!important;padding-bottom:20px!important}@media screen and (min-width:0px)and (max-width:430px){.drawer,.drawer-small{border-radius:0!important;min-width:100%!important;max-width:100%!important}}@media screen and (min-width:431px){.drawer{min-width:420px!important;max-width:420px!important}.drawer .title{min-width:200px}.drawer .mat-expansion-panel-body{padding-left:15px!important;padding-right:15px!important;padding-bottom:20px!important}.drawer-small{min-width:360px!important;max-width:360px!important}}.drawer-with-loader{padding-top:0!important}.drawer-transparent{background-color:transparent}.fade-in{animation:fadein .5s linear}@keyframes fadein{0%{opacity:0}to{opacity:1}}.bright{filter:brightness(.7)!important}@media(prefers-color-scheme:dark){.dialog-info-green,.dialog-info-ok{color:var(--ars-color-ok, #4CAF50)}.dialog-info-red,.dialog-info-error{color:var(--mat-form-field-error-text-color, #ff5449)}b,.bold{font-weight:600}.bright{filter:brightness(1.5)!important}}input[type=password]::-ms-reveal{display:none}input[type=password]::-webkit-credentials-auto-fill-button{visibility:hidden;display:none!important}\n"] }]
1219
1169
  }], ctorParameters: () => [], propDecorators: { done: [{ type: i0.Output, args: ["done"] }] } });
1220
1170
 
1221
- function MSALInstanceFactory(environment) {
1222
- return new PublicClientApplication({
1223
- auth: {
1224
- clientId: "6b2c080f-6ab0-4511-a9df-0bce69db5833",
1225
- authority: "https://login.microsoftonline.com/common",
1226
- redirectUri: environment.appLoginRedirectUri,
1227
- },
1228
- cache: {
1229
- cacheLocation: BrowserCacheLocation.LocalStorage
1230
- }
1231
- });
1232
- }
1233
- function MSALInterceptorConfigFactory(environment) {
1234
- return {
1235
- interactionType: InteractionType.Popup,
1236
- protectedResourceMap: new Map([
1237
- [environment.appServiceLoginUri, ["api://6b2c080f-6ab0-4511-a9df-0bce69db5833/AngularSPAAuthScope"]],
1238
- ["https://graph.microsoft.com/v2.0/me", ["user.read"]],
1239
- ])
1240
- };
1241
- }
1242
- function MSALGuardConfigFactory() {
1243
- return {
1244
- interactionType: InteractionType.Popup,
1245
- authRequest: {
1246
- scopes: ["user.read"]
1247
- }
1248
- };
1249
- }
1250
- class LoginOAuthComponent {
1251
- constructor() {
1252
- this.destroyRef = inject(DestroyRef);
1253
- this.msalBroadcastService = inject(MsalBroadcastService);
1254
- this.msaLService = inject(MsalService);
1255
- this.dialogService = inject(DialogService);
1256
- this.ngZone = inject(NgZone);
1257
- /** Emitted when OAuth authentication succeeds. */
1258
- this.success = output();
1259
- /** Whether to show the introductory info panel. */
1260
- this.showInfo = input(true, /* @ts-ignore */
1261
- ...(ngDevMode ? [{ debugName: "showInfo" }] : /* istanbul ignore next */ []));
1262
- /** Application name displayed in the info panel. */
1263
- this.applicationName = input(/* @ts-ignore */
1264
- ...(ngDevMode ? [undefined, { debugName: "applicationName" }] : /* istanbul ignore next */ []));
1265
- /** Whether to trigger `initialize()` automatically on mount. */
1266
- this.autoInitialize = input(false, /* @ts-ignore */
1267
- ...(ngDevMode ? [{ debugName: "autoInitialize" }] : /* istanbul ignore next */ []));
1268
- /** Whether the Microsoft login button is shown. */
1269
- this.allowMicrosoft = input(true, /* @ts-ignore */
1270
- ...(ngDevMode ? [{ debugName: "allowMicrosoft" }] : /* istanbul ignore next */ []));
1271
- /** Whether the Google login button is shown. */
1272
- this.allowGoogle = input(true, /* @ts-ignore */
1273
- ...(ngDevMode ? [{ debugName: "allowGoogle" }] : /* istanbul ignore next */ []));
1274
- this.oauthReady = signal(false, /* @ts-ignore */
1275
- ...(ngDevMode ? [{ debugName: "oauthReady" }] : /* istanbul ignore next */ []));
1276
- this.oauthMicrosoftReady = signal(false, /* @ts-ignore */
1277
- ...(ngDevMode ? [{ debugName: "oauthMicrosoftReady" }] : /* istanbul ignore next */ []));
1278
- this.oauthGoogleReady = signal(false, /* @ts-ignore */
1279
- ...(ngDevMode ? [{ debugName: "oauthGoogleReady" }] : /* istanbul ignore next */ []));
1280
- this.msalBroadcastService.msalSubject$
1281
- .pipe(filter((msg) => msg.eventType === EventType.LOGOUT_FAILURE ||
1282
- msg.eventType === EventType.ACQUIRE_TOKEN_FAILURE), takeUntilDestroyed(this.destroyRef))
1283
- .subscribe((r) => {
1284
- if (r?.payload) {
1285
- const error = r.payload;
1286
- this.dialogService.error(error?.message ?? 'Errore di autenticazione Microsoft');
1287
- }
1288
- });
1289
- afterNextRender(() => {
1290
- if (this.autoInitialize()) {
1291
- this.initialize();
1292
- }
1293
- });
1294
- }
1295
- /**
1296
- * Initialize OAuth providers (Microsoft MSAL and Google GSI).
1297
- * Safe to call multiple times — already-initialized providers are skipped.
1298
- * Must be public so the host component can trigger it manually when `autoInitialize` is false.
1299
- */
1300
- initialize() {
1301
- if (this.oauthMicrosoftReady() && this.oauthGoogleReady()) {
1302
- return; // Both already loaded
1303
- }
1304
- this.oauthReady.set(true);
1305
- // Load MS stack only if not already initialized
1306
- if (!this.oauthMicrosoftReady()) {
1307
- this.msaLService.initialize()
1308
- .pipe(takeUntilDestroyed(this.destroyRef))
1309
- .subscribe(() => {
1310
- this.oauthMicrosoftReady.set(true);
1311
- });
1312
- }
1313
- // Load Google script only if not already initialized
1314
- if (!this.oauthGoogleReady()) {
1315
- const DSLScript = document.createElement('script');
1316
- DSLScript.src = 'https://accounts.google.com/gsi/client';
1317
- DSLScript.type = 'text/javascript';
1318
- document.body.appendChild(DSLScript);
1319
- document.body.removeChild(DSLScript);
1320
- // @ts-ignore
1321
- window.onGoogleLibraryLoad = () => {
1322
- // initialize google account
1323
- // @ts-ignore
1324
- google.accounts.id.initialize({
1325
- client_id: '71204983077-ag31h3bgt2udcbfr9nn84r9rni2k3snp.apps.googleusercontent.com',
1326
- cancel_on_tap_outside: true,
1327
- auto_select: false,
1328
- callback: (r) => {
1329
- this.ngZone.run(() => {
1330
- this.success.emit({ type: LoginOAuthType.Google, token: r.credential });
1331
- });
1332
- }
1333
- });
1334
- googleButtonWrapper = createFakeGoogleWrapper();
1335
- this.oauthGoogleReady.set(true);
1336
- };
1337
- }
1338
- }
1339
- /**
1340
- * Trigger a Microsoft (MSAL) login popup and acquire an access token on success.
1341
- */
1342
- loginMSAL() {
1343
- // Clear any in-progress interaction flag that may have been left by a previous incomplete popup
1344
- sessionStorage.removeItem('msal.interaction.status');
1345
- this.msaLService.loginPopup()
1346
- .pipe(takeUntilDestroyed(this.destroyRef))
1347
- .subscribe({
1348
- next: (r) => {
1349
- try {
1350
- this.msaLService.instance.setActiveAccount(r.account);
1351
- this.msaLService.acquireTokenSilent({
1352
- scopes: [
1353
- "api://6b2c080f-6ab0-4511-a9df-0bce69db5833/AngularSPAAuthScope"
1354
- ],
1355
- account: r.account
1356
- }).pipe(takeUntilDestroyed(this.destroyRef)).subscribe({
1357
- next: (tokenResult) => {
1358
- console.log("Token acquired!");
1359
- this.success.emit({ type: LoginOAuthType.Microsoft, token: tokenResult.accessToken });
1360
- },
1361
- error: (error) => {
1362
- this.dialogService.error(error.message);
1363
- }
1364
- });
1365
- }
1366
- catch (error) {
1367
- this.dialogService.error(error.message);
1368
- }
1369
- },
1370
- error: (error) => {
1371
- this.dialogService.error(error.message);
1372
- }
1373
- });
1374
- }
1375
- /**
1376
- * Trigger the hidden Google GSI button to open the Google sign-in flow.
1377
- */
1378
- loginGoogle() {
1379
- // Use wrapper click to prevent Illegal invocation exception
1380
- googleButtonWrapper.click();
1381
- }
1382
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.0", ngImport: i0, type: LoginOAuthComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1383
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.0", type: LoginOAuthComponent, isStandalone: true, selector: "login-oauth", inputs: { showInfo: { classPropertyName: "showInfo", publicName: "showInfo", isSignal: true, isRequired: false, transformFunction: null }, applicationName: { classPropertyName: "applicationName", publicName: "applicationName", isSignal: true, isRequired: false, transformFunction: null }, autoInitialize: { classPropertyName: "autoInitialize", publicName: "autoInitialize", isSignal: true, isRequired: false, transformFunction: null }, allowMicrosoft: { classPropertyName: "allowMicrosoft", publicName: "allowMicrosoft", isSignal: true, isRequired: false, transformFunction: null }, allowGoogle: { classPropertyName: "allowGoogle", publicName: "allowGoogle", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { success: "success" }, providers: [
1384
- {
1385
- provide: MSAL_INSTANCE,
1386
- deps: [EnvironmentService],
1387
- useFactory: MSALInstanceFactory
1388
- },
1389
- {
1390
- provide: MSAL_GUARD_CONFIG,
1391
- useFactory: MSALGuardConfigFactory
1392
- },
1393
- {
1394
- provide: MSAL_INTERCEPTOR_CONFIG,
1395
- deps: [EnvironmentService],
1396
- useFactory: MSALInterceptorConfigFactory
1397
- },
1398
- MsalService,
1399
- MsalBroadcastService
1400
- ], ngImport: i0, template: "<div class=\"login-oauth\">\r\n @if(showInfo()) {\r\n <div class=\"message\">\r\n <p>Questa sezione consente di accedere al servizio utilizzando un provider OAuth2.</p>\r\n @if(applicationName()) {\r\n <p>La email utilizzata deve essere collegata ad un utente valido di {{applicationName()}} e dei servizi ad esso\r\n connessi.</p>\r\n }\r\n </div>\r\n }\r\n @if (allowMicrosoft()) {\r\n <div class=\"button\">\r\n <button mat-flat-button (click)=\"loginMSAL()\" aria-label=\"Effettua accesso\"\r\n [disabled]=\"!oauthMicrosoftReady()\" style=\"width: 100%;\">\r\n Accedi con Microsoft</button>\r\n </div>\r\n }\r\n @if (allowGoogle()) {\r\n <div class=\"button\">\r\n <button mat-flat-button (click)=\"loginGoogle()\" style=\"width: 100%;\"\r\n aria-label=\"Effettua accesso\" [disabled]=\"!oauthGoogleReady()\">\r\n Accedi con Google</button>\r\n </div>\r\n }\r\n</div>\r\n", styles: [".login-oauth{text-align:center}.login-oauth .button{padding:10px 0;width:100%}.login-oauth .message{padding:0 0 10px!important;font-size:small}\n"], dependencies: [{ kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i2$2.MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1401
- }
1402
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.0", ngImport: i0, type: LoginOAuthComponent, decorators: [{
1403
- type: Component,
1404
- args: [{ selector: 'login-oauth', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, providers: [
1405
- {
1406
- provide: MSAL_INSTANCE,
1407
- deps: [EnvironmentService],
1408
- useFactory: MSALInstanceFactory
1409
- },
1410
- {
1411
- provide: MSAL_GUARD_CONFIG,
1412
- useFactory: MSALGuardConfigFactory
1413
- },
1414
- {
1415
- provide: MSAL_INTERCEPTOR_CONFIG,
1416
- deps: [EnvironmentService],
1417
- useFactory: MSALInterceptorConfigFactory
1418
- },
1419
- MsalService,
1420
- MsalBroadcastService
1421
- ], imports: [
1422
- MatButtonModule
1423
- ], template: "<div class=\"login-oauth\">\r\n @if(showInfo()) {\r\n <div class=\"message\">\r\n <p>Questa sezione consente di accedere al servizio utilizzando un provider OAuth2.</p>\r\n @if(applicationName()) {\r\n <p>La email utilizzata deve essere collegata ad un utente valido di {{applicationName()}} e dei servizi ad esso\r\n connessi.</p>\r\n }\r\n </div>\r\n }\r\n @if (allowMicrosoft()) {\r\n <div class=\"button\">\r\n <button mat-flat-button (click)=\"loginMSAL()\" aria-label=\"Effettua accesso\"\r\n [disabled]=\"!oauthMicrosoftReady()\" style=\"width: 100%;\">\r\n Accedi con Microsoft</button>\r\n </div>\r\n }\r\n @if (allowGoogle()) {\r\n <div class=\"button\">\r\n <button mat-flat-button (click)=\"loginGoogle()\" style=\"width: 100%;\"\r\n aria-label=\"Effettua accesso\" [disabled]=\"!oauthGoogleReady()\">\r\n Accedi con Google</button>\r\n </div>\r\n }\r\n</div>\r\n", styles: [".login-oauth{text-align:center}.login-oauth .button{padding:10px 0;width:100%}.login-oauth .message{padding:0 0 10px!important;font-size:small}\n"] }]
1424
- }], ctorParameters: () => [], propDecorators: { success: [{ type: i0.Output, args: ["success"] }], showInfo: [{ type: i0.Input, args: [{ isSignal: true, alias: "showInfo", required: false }] }], applicationName: [{ type: i0.Input, args: [{ isSignal: true, alias: "applicationName", required: false }] }], autoInitialize: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoInitialize", required: false }] }], allowMicrosoft: [{ type: i0.Input, args: [{ isSignal: true, alias: "allowMicrosoft", required: false }] }], allowGoogle: [{ type: i0.Input, args: [{ isSignal: true, alias: "allowGoogle", required: false }] }] } });
1425
- const createFakeGoogleWrapper = () => {
1426
- const googleLoginWrapper = document.createElement("div");
1427
- // Or you can simple hide it in CSS rule for custom-google-button
1428
- googleLoginWrapper.style.display = "none";
1429
- googleLoginWrapper.classList.add("custom-google-button");
1430
- // Add the wrapper to body
1431
- document.body.appendChild(googleLoginWrapper);
1432
- // Use GSI javascript api to render the button inside our wrapper
1433
- // You can ignore the properties because this button will not appear
1434
- // @ts-ignore
1435
- window.google.accounts.id.renderButton(googleLoginWrapper, {
1436
- type: "icon",
1437
- width: "200",
1438
- });
1439
- const googleLoginWrapperButton = googleLoginWrapper.querySelector("div[role=button]");
1440
- return {
1441
- click: () => {
1442
- // @ts-ignore
1443
- googleLoginWrapperButton.click();
1444
- },
1445
- };
1446
- };
1447
- var googleButtonWrapper;
1448
-
1449
- class LoginOAuthOkMSComponent {
1450
- constructor() {
1451
- /** Message displayed while the popup is completing authentication. */
1452
- this.message = input('Accesso in corso...', /* @ts-ignore */
1453
- ...(ngDevMode ? [{ debugName: "message" }] : /* istanbul ignore next */ []));
1454
- // MSAL v5 popup flow: parse the auth response from the URL and send
1455
- // it back to the opener window via BroadcastChannel, then close the popup.
1456
- broadcastResponseToMainFrame();
1457
- }
1458
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.0", ngImport: i0, type: LoginOAuthOkMSComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1459
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.0.0", type: LoginOAuthOkMSComponent, isStandalone: true, selector: "app-login-oauth-ok-ms", inputs: { message: { classPropertyName: "message", publicName: "message", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<div fxLayout=\"column\" fxLayoutAlign=\"center center\" fxFill>\r\n <div class=\"login-auto fade-in\">\r\n <div class=\"message\">\r\n Autenticazione in corso...\r\n </div>\r\n <mat-progress-bar mode=\"indeterminate\" color=\"primary\"></mat-progress-bar>\r\n </div>\r\n</div>\r\n", styles: [".login-auto{padding:20px 0}.login-auto .message{font-size:large;font-weight:700;color:var(--ars-color-primary);max-width:300px;text-align:center;width:100%;padding:40px 0}\n"], dependencies: [{ kind: "ngmodule", type: FlexModule }, { kind: "directive", type: i1.DefaultLayoutDirective, selector: " [fxLayout], [fxLayout.xs], [fxLayout.sm], [fxLayout.md], [fxLayout.lg], [fxLayout.xl], [fxLayout.lt-sm], [fxLayout.lt-md], [fxLayout.lt-lg], [fxLayout.lt-xl], [fxLayout.gt-xs], [fxLayout.gt-sm], [fxLayout.gt-md], [fxLayout.gt-lg]", inputs: ["fxLayout", "fxLayout.xs", "fxLayout.sm", "fxLayout.md", "fxLayout.lg", "fxLayout.xl", "fxLayout.lt-sm", "fxLayout.lt-md", "fxLayout.lt-lg", "fxLayout.lt-xl", "fxLayout.gt-xs", "fxLayout.gt-sm", "fxLayout.gt-md", "fxLayout.gt-lg"] }, { kind: "directive", type: i1.DefaultLayoutAlignDirective, selector: " [fxLayoutAlign], [fxLayoutAlign.xs], [fxLayoutAlign.sm], [fxLayoutAlign.md], [fxLayoutAlign.lg], [fxLayoutAlign.xl], [fxLayoutAlign.lt-sm], [fxLayoutAlign.lt-md], [fxLayoutAlign.lt-lg], [fxLayoutAlign.lt-xl], [fxLayoutAlign.gt-xs], [fxLayoutAlign.gt-sm], [fxLayoutAlign.gt-md], [fxLayoutAlign.gt-lg]", inputs: ["fxLayoutAlign", "fxLayoutAlign.xs", "fxLayoutAlign.sm", "fxLayoutAlign.md", "fxLayoutAlign.lg", "fxLayoutAlign.xl", "fxLayoutAlign.lt-sm", "fxLayoutAlign.lt-md", "fxLayoutAlign.lt-lg", "fxLayoutAlign.lt-xl", "fxLayoutAlign.gt-xs", "fxLayoutAlign.gt-sm", "fxLayoutAlign.gt-md", "fxLayoutAlign.gt-lg"] }, { kind: "directive", type: i1.FlexFillDirective, selector: "[fxFill], [fxFlexFill]" }, { kind: "ngmodule", type: MatProgressBarModule }, { kind: "component", type: i2.MatProgressBar, selector: "mat-progress-bar", inputs: ["color", "value", "bufferValue", "mode"], outputs: ["animationEnd"], exportAs: ["matProgressBar"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1460
- }
1461
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.0", ngImport: i0, type: LoginOAuthOkMSComponent, decorators: [{
1462
- type: Component,
1463
- args: [{ selector: 'app-login-oauth-ok-ms', changeDetection: ChangeDetectionStrategy.OnPush, imports: [FlexModule, MatProgressBarModule], template: "<div fxLayout=\"column\" fxLayoutAlign=\"center center\" fxFill>\r\n <div class=\"login-auto fade-in\">\r\n <div class=\"message\">\r\n Autenticazione in corso...\r\n </div>\r\n <mat-progress-bar mode=\"indeterminate\" color=\"primary\"></mat-progress-bar>\r\n </div>\r\n</div>\r\n", styles: [".login-auto{padding:20px 0}.login-auto .message{font-size:large;font-weight:700;color:var(--ars-color-primary);max-width:300px;text-align:center;width:100%;padding:40px 0}\n"] }]
1464
- }], ctorParameters: () => [], propDecorators: { message: [{ type: i0.Input, args: [{ isSignal: true, alias: "message", required: false }] }] } });
1465
-
1466
1171
  /**
1467
1172
  * @file breakpoints.ts
1468
1173
  * Bootstrap 5 breakpoint definitions as CDK-compatible MediaQuery strings.
@@ -3351,5 +3056,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.0", ngImpor
3351
3056
  * Generated bundle index. Do not edit.
3352
3057
  */
3353
3058
 
3354
- export { ALIAS_FAMILIES, ALIAS_INDEX, ArsUIFlexModule, ArsUIModule, BS5_BREAKPOINTS, BusyDialogComponent, BusyTimer, CANONICAL_ALIASES, ConfirmDialogComponent, CredentialsDialogComponent, DeleteDialogComponent, DeleteDialogConfirmMode, DialogService, FxClassDirective, FxFlexAlignDirective, FxFlexDirective, FxFlexFillDirective, FxFlexOffsetDirective, FxFlexOrderDirective, FxGridAreaDirective, FxGridColumnDirective, FxGridDirective, FxLayoutAlignDirective, FxLayoutDirective, FxLayoutGapDirective, FxLayoutWrapDirective, FxShowHideDirective, FxStyleDirective, IfBpDirective, InfoDialogComponent, LAYOUT_BREAKPOINTS, LoginOAuthComponent, LoginOAuthOkMSComponent, LoginOAuthType, MSALGuardConfigFactory, MSALInstanceFactory, MSALInterceptorConfigFactory, MediaObserver, NON_CANONICAL_PRIORITY, OtpInputComponent, PaginatorIntl, PasswordStrengthComponent, RecoverPasswordDialogComponent, ResetPasswordDialogComponent, ResponsiveBaseDirective, ToastComponent, UIService, provideArsUI, resolve, resolveAll, resolveNonCanonical };
3059
+ export { ALIAS_FAMILIES, ALIAS_INDEX, ArsUIFlexModule, BS5_BREAKPOINTS, BusyDialogComponent, BusyTimer, CANONICAL_ALIASES, ConfirmDialogComponent, CredentialsDialogComponent, DeleteDialogComponent, DeleteDialogConfirmMode, DialogService, FxClassDirective, FxFlexAlignDirective, FxFlexDirective, FxFlexFillDirective, FxFlexOffsetDirective, FxFlexOrderDirective, FxGridAreaDirective, FxGridColumnDirective, FxGridDirective, FxLayoutAlignDirective, FxLayoutDirective, FxLayoutGapDirective, FxLayoutWrapDirective, FxShowHideDirective, FxStyleDirective, IfBpDirective, InfoDialogComponent, LAYOUT_BREAKPOINTS, MediaObserver, NON_CANONICAL_PRIORITY, OtpInputComponent, PaginatorIntl, PasswordStrengthComponent, RecoverPasswordDialogComponent, ResetPasswordDialogComponent, ResponsiveBaseDirective, ToastComponent, UIService, resolve, resolveAll, resolveNonCanonical };
3355
3060
  //# sourceMappingURL=arsedizioni-ars-utils-ui.mjs.map