@flusys/ng-auth 7.0.1 → 7.1.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flusys/ng-auth",
3
- "version": "7.0.1",
3
+ "version": "7.1.0",
4
4
  "description": "Authentication module for FLUSYS Angular applications",
5
5
  "license": "MIT",
6
6
  "peerDependencies": {
@@ -8,10 +8,10 @@
8
8
  "@angular/core": ">=22.0.0",
9
9
  "@angular/forms": ">=22.0.0",
10
10
  "@angular/router": ">=22.0.0",
11
- "@flusys/ng-core": ">=7.0.1",
12
- "@flusys/ng-layout": ">=7.0.1",
13
- "@flusys/ng-shared": ">=7.0.1",
14
- "@flusys/ng-ui": ">=7.0.1",
11
+ "@flusys/ng-core": ">=7.1.0",
12
+ "@flusys/ng-layout": ">=7.1.0",
13
+ "@flusys/ng-shared": ">=7.1.0",
14
+ "@flusys/ng-ui": ">=7.1.0",
15
15
  "rxjs": "^7.8.0"
16
16
  },
17
17
  "sideEffects": false,
@@ -1,4 +1,4 @@
1
- import { ISingleResponse, IMessageResponse, ApiResourceService, IFilterData, IListResponse, IUserBasicInfo, ICompanyApiProvider, ICompanyBasicInfo, IAuthStateProvider, IUserPermissionProvider, IUserBranchPermission as IUserBranchPermission$1, IUserCompanyInfo, IUserProvider, ILogicNode, RouterTabItem, BaseFormComponent, IFormField, ITableAction, ITableColumn, IProfileRoleInfo, IProfileActionInfo } from '@flusys/ng-shared';
1
+ import { ISingleResponse, IBaseEntity, IMessageResponse, ApiResourceService, IFilterData, IListResponse, IUserBasicInfo, ICompanyApiProvider, ICompanyBasicInfo, IAuthStateProvider, IUserPermissionProvider, IUserBranchPermission as IUserBranchPermission$1, IUserCompanyInfo, IUserProvider, ILogicNode, RouterTabItem, BaseFormComponent, IFormField, ITableAction, ITableColumn, IProfileRoleInfo, IProfileActionInfo } from '@flusys/ng-shared';
2
2
  import * as rxjs from 'rxjs';
3
3
  import { Observable } from 'rxjs';
4
4
  import * as _angular_core from '@angular/core';
@@ -10,6 +10,14 @@ import * as _angular_forms_signals from '@angular/forms/signals';
10
10
  import * as _flusys_ng_auth from '@flusys/ng-auth';
11
11
  import * as _flusys_ng_core from '@flusys/ng-core';
12
12
 
13
+ declare enum SocialProviderEnum {
14
+ GOOGLE = "google",
15
+ FACEBOOK = "facebook",
16
+ LINKEDIN = "linkedin",
17
+ MICROSOFT = "microsoft"
18
+ }
19
+ declare const SOCIAL_PROVIDERS: readonly [SocialProviderEnum.GOOGLE, SocialProviderEnum.FACEBOOK, SocialProviderEnum.LINKEDIN, SocialProviderEnum.MICROSOFT];
20
+
13
21
  interface ILoginRequest {
14
22
  email: string;
15
23
  password: string;
@@ -216,6 +224,40 @@ interface IUserBranchPermission {
216
224
  companyId: string;
217
225
  }
218
226
 
227
+ interface ISocialAuthConfig extends IBaseEntity {
228
+ provider: SocialProviderEnum;
229
+ isEnabled: boolean;
230
+ clientId: string | null;
231
+ hasClientSecret: boolean;
232
+ scopes: string[] | null;
233
+ extraConfig: Record<string, unknown> | null;
234
+ }
235
+ interface ICreateSocialAuthConfigDto {
236
+ provider: SocialProviderEnum;
237
+ isEnabled?: boolean;
238
+ clientId?: string;
239
+ clientSecret?: string;
240
+ scopes?: string[];
241
+ extraConfig?: Record<string, unknown>;
242
+ }
243
+ interface IUpdateSocialAuthConfigDto extends Partial<ICreateSocialAuthConfigDto> {
244
+ id: string;
245
+ }
246
+ interface ISocialProviderInfo {
247
+ provider: SocialProviderEnum;
248
+ redirectUri: string;
249
+ }
250
+ interface ISocialAuthorization {
251
+ provider: SocialProviderEnum;
252
+ authorizationUrl: string;
253
+ state: string;
254
+ }
255
+ interface ISocialCallbackRequest {
256
+ code: string;
257
+ state: string;
258
+ redirectUri: string;
259
+ }
260
+
219
261
  interface ICreateUserRequest {
220
262
  name: string;
221
263
  email: string;
@@ -376,6 +418,31 @@ declare class CompanyApiService extends ApiResourceService<ICreateCompanyRequest
376
418
  static ɵprov: _angular_core.ɵɵInjectableDeclaration<CompanyApiService>;
377
419
  }
378
420
 
421
+ /** Round-trips the pre-login returnUrl through the OAuth redirect, which cannot carry it itself. */
422
+ declare const SOCIAL_RETURN_URL_KEY = "flusys_social_return_url";
423
+ declare class SocialAuthApiService {
424
+ private readonly appConfig;
425
+ private readonly http;
426
+ private readonly platform;
427
+ private readonly baseUrl;
428
+ get redirectUri(): string;
429
+ /** Called before redirecting to the provider, so the callback page can resume where the user left off. */
430
+ saveReturnUrl(returnUrl: string): void;
431
+ /** Reads and clears the returnUrl saved by {@link saveReturnUrl}. */
432
+ consumeReturnUrl(): string;
433
+ getProviders(): Observable<ISingleResponse<ISocialProviderInfo[]>>;
434
+ authorize(provider: SocialProviderEnum): Observable<ISingleResponse<ISocialAuthorization>>;
435
+ callback(request: ISocialCallbackRequest): Observable<AuthResponse>;
436
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<SocialAuthApiService, never>;
437
+ static ɵprov: _angular_core.ɵɵInjectableDeclaration<SocialAuthApiService>;
438
+ }
439
+
440
+ declare class SocialAuthConfigApiService extends ApiResourceService<ICreateSocialAuthConfigDto | IUpdateSocialAuthConfigDto, ISocialAuthConfig> {
441
+ constructor();
442
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<SocialAuthConfigApiService, never>;
443
+ static ɵprov: _angular_core.ɵɵInjectableDeclaration<SocialAuthConfigApiService>;
444
+ }
445
+
379
446
  /**
380
447
  * Token Refresh State Service
381
448
  * Manages token refresh state for SSR-safe request queuing.
@@ -772,6 +839,7 @@ declare const AUTH_ENDPOINTS: {
772
839
  readonly FORGOT_PASSWORD: "/auth/forgot-password";
773
840
  readonly RESET_PASSWORD: "/auth/reset-password";
774
841
  readonly RESEND_VERIFICATION: "/auth/resend-verification";
842
+ readonly SOCIAL_CALLBACK: "/auth/social/callback";
775
843
  };
776
844
  /** Check if a URL matches a specific endpoint */
777
845
  declare function isEndpoint(url: string, endpoint: string): boolean;
@@ -784,6 +852,7 @@ declare const AUTH_MESSAGES: Record<string, string>;
784
852
  * - Users (always visible) - includes permission management via dialogs
785
853
  * - Companies (only if company feature enabled)
786
854
  * - Branches (only if company feature enabled)
855
+ * - Social Config (social sign-in provider credentials)
787
856
  */
788
857
  declare class AdministrationPageComponent {
789
858
  private readonly appConfig;
@@ -974,6 +1043,7 @@ declare class LoginPageComponent {
974
1043
  readonly isLoading: _angular_core.WritableSignal<boolean>;
975
1044
  readonly unverifiedEmail: _angular_core.WritableSignal<string>;
976
1045
  readonly savedUserName: _angular_core.WritableSignal<string | null>;
1046
+ readonly welcomeBackText: _angular_core.Signal<string>;
977
1047
  readonly loginFormModel: _angular_core.WritableSignal<ILoginFormModel>;
978
1048
  private readonly emailErrorMessage;
979
1049
  private readonly passwordMinLength;
@@ -1189,6 +1259,59 @@ declare class ResetPasswordPageComponent {
1189
1259
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<ResetPasswordPageComponent, "lib-reset-password-page", never, {}, {}, never, never, true, never>;
1190
1260
  }
1191
1261
 
1262
+ declare class SocialCallbackPageComponent {
1263
+ private readonly destroyRef;
1264
+ private readonly route;
1265
+ private readonly router;
1266
+ private readonly platform;
1267
+ private readonly socialApi;
1268
+ private readonly authState;
1269
+ private readonly messageService;
1270
+ private readonly translateAdapter;
1271
+ private readonly _error;
1272
+ readonly errorDetail: _angular_core.Signal<string | null>;
1273
+ constructor();
1274
+ backToLogin(): void;
1275
+ private exchangeCode;
1276
+ private returnUrl;
1277
+ private translate;
1278
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<SocialCallbackPageComponent, never>;
1279
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<SocialCallbackPageComponent, "lib-social-callback-page", never, {}, {}, never, never, true, never>;
1280
+ }
1281
+
1282
+ interface IProviderFormModel {
1283
+ provider: SocialProviderEnum;
1284
+ id: string | null;
1285
+ isEnabled: boolean;
1286
+ clientId: string;
1287
+ /** A newly typed secret to save. Left blank keeps the previously stored one. */
1288
+ clientSecret: string;
1289
+ hasClientSecret: boolean;
1290
+ tenantId: string;
1291
+ scopes: string;
1292
+ }
1293
+ declare class SocialConfigPageComponent {
1294
+ private readonly configService;
1295
+ private readonly socialApi;
1296
+ private readonly messageService;
1297
+ private readonly translateAdapter;
1298
+ readonly tenantProvider = SocialProviderEnum.MICROSOFT;
1299
+ private readonly _forms;
1300
+ readonly forms: _angular_core.Signal<IProviderFormModel[]>;
1301
+ private readonly _isLoading;
1302
+ readonly isLoading: _angular_core.Signal<boolean>;
1303
+ private readonly _isSaving;
1304
+ readonly isSaving: _angular_core.Signal<boolean>;
1305
+ readonly redirectUri: string;
1306
+ constructor();
1307
+ updateField<K extends keyof IProviderFormModel>(provider: SocialProviderEnum, field: K, value: IProviderFormModel[K]): void;
1308
+ onSave(): Promise<void>;
1309
+ private loadConfigs;
1310
+ private translate;
1311
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<SocialConfigPageComponent, never>;
1312
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<SocialConfigPageComponent, "lib-social-config-page", never, {}, {}, never, never, true, never>;
1313
+ }
1314
+
1192
1315
  interface IUserFormModel {
1193
1316
  name: string;
1194
1317
  email: string;
@@ -1330,6 +1453,29 @@ declare class VerifyEmailPageComponent {
1330
1453
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<VerifyEmailPageComponent, "lib-verify-email-page", never, {}, {}, never, never, true, never>;
1331
1454
  }
1332
1455
 
1456
+ declare class SocialLoginButtonsComponent {
1457
+ private readonly destroyRef;
1458
+ private readonly socialApi;
1459
+ private readonly messageService;
1460
+ private readonly platform;
1461
+ private readonly document;
1462
+ private readonly translateAdapter;
1463
+ readonly returnUrl: _angular_core.InputSignal<string>;
1464
+ readonly providerEnum: typeof SocialProviderEnum;
1465
+ private readonly _providers;
1466
+ readonly providers: _angular_core.Signal<ISocialProviderInfo[]>;
1467
+ private readonly _pendingProvider;
1468
+ readonly pendingProvider: _angular_core.Signal<SocialProviderEnum | null>;
1469
+ readonly showLabels: _angular_core.Signal<boolean>;
1470
+ readonly layoutClass: _angular_core.Signal<"grid grid-cols-1" | "grid grid-cols-2 gap-3" | "flex flex-wrap justify-center gap-3">;
1471
+ constructor();
1472
+ onSelect(provider: SocialProviderEnum): void;
1473
+ protected redirectTo(url: string): void;
1474
+ private translate;
1475
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<SocialLoginButtonsComponent, never>;
1476
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<SocialLoginButtonsComponent, "lib-social-login-buttons", never, { "returnUrl": { "alias": "returnUrl"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
1477
+ }
1478
+
1333
1479
  interface BranchWithAssignment extends IBranch {
1334
1480
  isAssigned: boolean;
1335
1481
  }
@@ -1399,5 +1545,5 @@ declare class UserCompanyPermissionDialogComponent {
1399
1545
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<UserCompanyPermissionDialogComponent, "lib-user-company-permission-dialog", never, { "visible": { "alias": "visible"; "required": true; "isSignal": true; }; "user": { "alias": "user"; "required": true; "isSignal": true; }; }, { "closed": "closed"; "permissionsChanged": "permissionsChanged"; }, never, never, true, never>;
1400
1546
  }
1401
1547
 
1402
- export { ADMINISTRATION_ROUTES, AUTH_ENDPOINTS, AUTH_MESSAGES, AUTH_PROFILE_EXTENSION, AUTH_REGISTRATION_EXTENSION, AUTH_ROUTES, AUTH_USER_DETAIL_CONFIG, AUTH_USER_FORM_EXTENSION, AUTH_USER_LIST_EXTENSION, AUTH_VALIDATION_CONFIG, AdministrationPageComponent, AuthApiService, AuthCompanyApiProviderAdapter, AuthInitService, AuthLayoutApiAdapter, AuthLayoutStateAdapter, AuthStateProviderAdapter, AuthStateService, AuthUserPermissionProviderAdapter, AuthUserProviderAdapter, BranchApiService, BranchFormComponent, BranchListComponent, CompanyApiService, CompanyFormComponent, CompanyListComponent, ForgotPasswordPageComponent, LoginPageComponent, PROFILE_FIELD_CONTEXT, PROFILE_ROUTES, ProfilePageComponent, REGISTRATION_FIELD_CONTEXT, RegisterPageComponent, ResetPasswordPageComponent, TokenRefreshStateService, USER_FORM_FIELD_CONTEXT, UserApiService, UserBranchPermissionDialogComponent, UserCompanyPermissionDialogComponent, UserFormComponent, UserListComponent, UserPermissionApiService, VerifyEmailPageComponent, authGuard, authInterceptor, companyFeatureGuard, emailFeatureGuard, guestGuard, isCompanySelectionResponse, isEmailVerificationRequired, isEndpoint, isLoginResponse, provideAuthLayoutIntegration, provideAuthProviders, signUpFeatureGuard, tokenRefreshInterceptor, validateEmail, validatePassword };
1403
- export type { AuthResponse, IAssignUserBranchRequest, IAssignUserCompanyRequest, IAuthValidationConfig, IBranch, IBranchInfo, IBranchSelectionInfo, IChangePasswordRequest, ICompany, ICompanyInfo, ICompanySelectionData, ICompanySelectionResponse, ICompanyWithBranches, ICreateBranchRequest, ICreateCompanyRequest, ICreateUserRequest, IEmailValidationConfig, IEmailVerificationData, ILoginData, ILoginRequest, ILoginRequiresEmailVerification, ILoginResponse, IMeData, IMeResponse, IPasswordValidationConfig, IPermissionItem, IProfileExtensionProvider, IProfileExtraField, IProfileExtraSection, IProfileFieldTemplateContext, IRefreshTokenResponse, IRegistrationData, IRegistrationExtensionProvider, IRegistrationExtraField, IRegistrationFieldTemplateContext, IRegistrationRequest, IRegistrationResponse, ISelectRequest, ISwitchCompanyRequest, IUpdateBranchRequest, IUpdateCompanyRequest, IUpdateUserRequest, IUser, IUserBranchPermission, IUserCompanyPermission, IUserDetailViewConfig, IUserFormExtensionProvider, IUserFormExtraField, IUserFormFieldTemplateContext, IUserInfo, IUserListExtensionProvider, IUserListExtraAction, IUserListExtraColumn, UserDetailViewMode };
1548
+ export { ADMINISTRATION_ROUTES, AUTH_ENDPOINTS, AUTH_MESSAGES, AUTH_PROFILE_EXTENSION, AUTH_REGISTRATION_EXTENSION, AUTH_ROUTES, AUTH_USER_DETAIL_CONFIG, AUTH_USER_FORM_EXTENSION, AUTH_USER_LIST_EXTENSION, AUTH_VALIDATION_CONFIG, AdministrationPageComponent, AuthApiService, AuthCompanyApiProviderAdapter, AuthInitService, AuthLayoutApiAdapter, AuthLayoutStateAdapter, AuthStateProviderAdapter, AuthStateService, AuthUserPermissionProviderAdapter, AuthUserProviderAdapter, BranchApiService, BranchFormComponent, BranchListComponent, CompanyApiService, CompanyFormComponent, CompanyListComponent, ForgotPasswordPageComponent, LoginPageComponent, PROFILE_FIELD_CONTEXT, PROFILE_ROUTES, ProfilePageComponent, REGISTRATION_FIELD_CONTEXT, RegisterPageComponent, ResetPasswordPageComponent, SOCIAL_PROVIDERS, SOCIAL_RETURN_URL_KEY, SocialAuthApiService, SocialAuthConfigApiService, SocialCallbackPageComponent, SocialConfigPageComponent, SocialLoginButtonsComponent, SocialProviderEnum, TokenRefreshStateService, USER_FORM_FIELD_CONTEXT, UserApiService, UserBranchPermissionDialogComponent, UserCompanyPermissionDialogComponent, UserFormComponent, UserListComponent, UserPermissionApiService, VerifyEmailPageComponent, authGuard, authInterceptor, companyFeatureGuard, emailFeatureGuard, guestGuard, isCompanySelectionResponse, isEmailVerificationRequired, isEndpoint, isLoginResponse, provideAuthLayoutIntegration, provideAuthProviders, signUpFeatureGuard, tokenRefreshInterceptor, validateEmail, validatePassword };
1549
+ export type { AuthResponse, IAssignUserBranchRequest, IAssignUserCompanyRequest, IAuthValidationConfig, IBranch, IBranchInfo, IBranchSelectionInfo, IChangePasswordRequest, ICompany, ICompanyInfo, ICompanySelectionData, ICompanySelectionResponse, ICompanyWithBranches, ICreateBranchRequest, ICreateCompanyRequest, ICreateSocialAuthConfigDto, ICreateUserRequest, IEmailValidationConfig, IEmailVerificationData, ILoginData, ILoginRequest, ILoginRequiresEmailVerification, ILoginResponse, IMeData, IMeResponse, IPasswordValidationConfig, IPermissionItem, IProfileExtensionProvider, IProfileExtraField, IProfileExtraSection, IProfileFieldTemplateContext, IRefreshTokenResponse, IRegistrationData, IRegistrationExtensionProvider, IRegistrationExtraField, IRegistrationFieldTemplateContext, IRegistrationRequest, IRegistrationResponse, ISelectRequest, ISocialAuthConfig, ISocialAuthorization, ISocialCallbackRequest, ISocialProviderInfo, ISwitchCompanyRequest, IUpdateBranchRequest, IUpdateCompanyRequest, IUpdateSocialAuthConfigDto, IUpdateUserRequest, IUser, IUserBranchPermission, IUserCompanyPermission, IUserDetailViewConfig, IUserFormExtensionProvider, IUserFormExtraField, IUserFormFieldTemplateContext, IUserInfo, IUserListExtensionProvider, IUserListExtraAction, IUserListExtraColumn, UserDetailViewMode };