@edsis/angular 22.0.39 → 22.0.41
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,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@edsis/angular",
|
|
3
|
-
"version": "22.0.
|
|
3
|
+
"version": "22.0.41",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"@angular/common": ">=22.0.0",
|
|
6
6
|
"@angular/core": ">=22.0.0",
|
|
7
7
|
"@angular/forms": ">=22.0.0",
|
|
8
8
|
"@angular/router": ">=22.0.0",
|
|
9
|
-
"@edsis/navigation": "^22.0.
|
|
10
|
-
"@edsis/sdk": "^22.0.
|
|
11
|
-
"@edsis/theme": "^22.0.
|
|
12
|
-
"@edsis/component": "^22.0.
|
|
9
|
+
"@edsis/navigation": "^22.0.41",
|
|
10
|
+
"@edsis/sdk": "^22.0.41",
|
|
11
|
+
"@edsis/theme": "^22.0.41",
|
|
12
|
+
"@edsis/component": "^22.0.41",
|
|
13
13
|
"rxjs": ">=7.8.0"
|
|
14
14
|
},
|
|
15
15
|
"peerDependenciesMeta": {
|
|
@@ -2,8 +2,8 @@ import { HttpInterceptorFn, HttpContextToken } from '@angular/common/http';
|
|
|
2
2
|
import * as _angular_core from '@angular/core';
|
|
3
3
|
import { InjectionToken, EnvironmentProviders, OnInit } from '@angular/core';
|
|
4
4
|
import { CanActivateFn, Routes } from '@angular/router';
|
|
5
|
-
import * as _angular_forms from '@angular/forms';
|
|
6
5
|
import * as _edsis_angular_module_auth from '@edsis/angular/module/auth';
|
|
6
|
+
import * as _angular_forms from '@angular/forms';
|
|
7
7
|
import { AuthTokenResponse, AuthSessionService } from '@edsis/sdk/auth';
|
|
8
8
|
|
|
9
9
|
/**
|
|
@@ -36,6 +36,25 @@ interface EdsisAuthMessages {
|
|
|
36
36
|
readonly healthRetry: string;
|
|
37
37
|
readonly healthChecking: string;
|
|
38
38
|
};
|
|
39
|
+
readonly google: {
|
|
40
|
+
readonly title: string;
|
|
41
|
+
readonly intro: string;
|
|
42
|
+
readonly badge: string;
|
|
43
|
+
/** Aria tombol Google di halaman login saat sign-in aktif (config terisi). */
|
|
44
|
+
readonly signInAria: string;
|
|
45
|
+
/** Status di halaman login selama full-page redirect ke Google berlangsung. */
|
|
46
|
+
readonly googleRedirecting: string;
|
|
47
|
+
readonly googleExchangeInProgress: string;
|
|
48
|
+
readonly exchangeInProgressAria: string;
|
|
49
|
+
readonly googleStateMismatch: string;
|
|
50
|
+
readonly googleAccessDenied: string;
|
|
51
|
+
/** Error generik callback; juga fallback saat backend tidak mengirim pesan. */
|
|
52
|
+
readonly googleCallbackError: string;
|
|
53
|
+
readonly googleRetry: string;
|
|
54
|
+
readonly missingAccessToken: string;
|
|
55
|
+
readonly successRedirect: string;
|
|
56
|
+
readonly openDashboard: string;
|
|
57
|
+
};
|
|
39
58
|
readonly logout: {
|
|
40
59
|
readonly title: string;
|
|
41
60
|
readonly intro: string;
|
|
@@ -70,6 +89,12 @@ type EdsisAuthMessagesOverride = {
|
|
|
70
89
|
declare const EDSIS_AUTH_MESSAGES: InjectionToken<EdsisAuthMessages>;
|
|
71
90
|
declare function mergeEdsisAuthMessages(override?: EdsisAuthMessagesOverride): EdsisAuthMessages;
|
|
72
91
|
|
|
92
|
+
/**
|
|
93
|
+
* Path route callback Google di dalam `authRoutes`; juga menjadi sumber
|
|
94
|
+
* derivasi `redirectUri` (`${appUrl}/auth/google/callback`), sehingga URL yang
|
|
95
|
+
* didaftarkan di Google Cloud Console selalu konsisten dengan route library.
|
|
96
|
+
*/
|
|
97
|
+
declare const GOOGLE_OAUTH_CALLBACK_ROUTE_PATH: "auth/google/callback";
|
|
73
98
|
/**
|
|
74
99
|
* Health-check backend auth di halaman login (opt-in).
|
|
75
100
|
* Sehat = HTTP 2xx dalam `timeoutMs`; body respons tidak diparse.
|
|
@@ -82,6 +107,22 @@ interface EdsisAuthHealthCheckConfig {
|
|
|
82
107
|
/** Default 4000. */
|
|
83
108
|
timeoutMs?: number;
|
|
84
109
|
}
|
|
110
|
+
/**
|
|
111
|
+
* Google Sign-In dengan authorization-code flow. Exchange code dilakukan
|
|
112
|
+
* backend (`POST {apiUrl}/auth/google`) sehingga client secret tidak pernah
|
|
113
|
+
* menyentuh frontend.
|
|
114
|
+
*/
|
|
115
|
+
interface EdsisAuthGoogleOauthConfig {
|
|
116
|
+
/**
|
|
117
|
+
* OAuth 2.0 client ID dari Google Cloud Console. String kosong dianggap
|
|
118
|
+
* tidak dikonfigurasi (tombol Google tetap placeholder), sehingga aman
|
|
119
|
+
* meneruskan nilai environment yang di-inject build-time apa adanya.
|
|
120
|
+
*/
|
|
121
|
+
clientId: string;
|
|
122
|
+
}
|
|
123
|
+
interface EdsisAuthOauthConfig {
|
|
124
|
+
google?: EdsisAuthGoogleOauthConfig;
|
|
125
|
+
}
|
|
85
126
|
interface EdsisAuthConfig {
|
|
86
127
|
apiUrl: string;
|
|
87
128
|
appUrl: string;
|
|
@@ -98,12 +139,27 @@ interface EdsisAuthConfig {
|
|
|
98
139
|
*/
|
|
99
140
|
httpInterceptors?: readonly HttpInterceptorFn[];
|
|
100
141
|
healthCheck?: EdsisAuthHealthCheckConfig;
|
|
142
|
+
/**
|
|
143
|
+
* Provider OAuth di halaman login (saat ini hanya Google). `redirectUri`
|
|
144
|
+
* tidak dikonfigurasi konsumer; library menurunkannya dari `appUrl`:
|
|
145
|
+
* `${appUrl}/auth/google/callback`.
|
|
146
|
+
*/
|
|
147
|
+
oauth?: EdsisAuthOauthConfig;
|
|
101
148
|
}
|
|
102
149
|
interface ResolvedEdsisAuthHealthCheck {
|
|
103
150
|
enabled: boolean;
|
|
104
151
|
url: string;
|
|
105
152
|
timeoutMs: number;
|
|
106
153
|
}
|
|
154
|
+
interface ResolvedEdsisAuthGoogleOauth {
|
|
155
|
+
clientId: string;
|
|
156
|
+
/** Diturunkan dari `appUrl`: `${appUrl}/auth/google/callback`. */
|
|
157
|
+
redirectUri: string;
|
|
158
|
+
}
|
|
159
|
+
interface ResolvedEdsisAuthOauth {
|
|
160
|
+
/** `null` saat Google Sign-In tidak dikonfigurasi (perilaku placeholder lama). */
|
|
161
|
+
google: ResolvedEdsisAuthGoogleOauth | null;
|
|
162
|
+
}
|
|
107
163
|
interface ResolvedEdsisAuthConfig {
|
|
108
164
|
apiUrl: string;
|
|
109
165
|
appUrl: string;
|
|
@@ -113,6 +169,7 @@ interface ResolvedEdsisAuthConfig {
|
|
|
113
169
|
authenticatedHomePath: `/${string}`;
|
|
114
170
|
guestHomePath: `/${string}`;
|
|
115
171
|
healthCheck: ResolvedEdsisAuthHealthCheck;
|
|
172
|
+
oauth: ResolvedEdsisAuthOauth;
|
|
116
173
|
}
|
|
117
174
|
declare const EDSIS_AUTH_CONFIG: InjectionToken<ResolvedEdsisAuthConfig>;
|
|
118
175
|
declare function resolveEdsisAuthConfig(config: EdsisAuthConfig): ResolvedEdsisAuthConfig;
|
|
@@ -127,6 +184,23 @@ declare const EDSIS_SKIP_AUTH: HttpContextToken<boolean>;
|
|
|
127
184
|
declare const EDSIS_SKIP_SESSION_REFRESH: HttpContextToken<boolean>;
|
|
128
185
|
declare const edsisAuthInterceptor: HttpInterceptorFn;
|
|
129
186
|
|
|
187
|
+
declare const GOOGLE_OAUTH_STATE_STORAGE_KEY = "auth-google-state";
|
|
188
|
+
declare const GOOGLE_OAUTH_AUTHORIZE_URL = "https://accounts.google.com/o/oauth2/v2/auth";
|
|
189
|
+
interface GoogleAuthorizeUrlOptions {
|
|
190
|
+
clientId: string;
|
|
191
|
+
redirectUri: string;
|
|
192
|
+
state: string;
|
|
193
|
+
}
|
|
194
|
+
/** Nilai `state` acak berbasis crypto (anti-CSRF untuk round-trip OAuth). */
|
|
195
|
+
declare function createGoogleOauthState(windowRef: Window): string;
|
|
196
|
+
declare function buildGoogleAuthorizeUrl(options: GoogleAuthorizeUrlOptions): string;
|
|
197
|
+
declare function storeGoogleOauthState(documentRef: Document, state: string): void;
|
|
198
|
+
/**
|
|
199
|
+
* Baca lalu hapus state dari sessionStorage. State sekali pakai: dikonsumsi di
|
|
200
|
+
* semua cabang callback agar tidak bocor ke percobaan login berikutnya.
|
|
201
|
+
*/
|
|
202
|
+
declare function consumeGoogleOauthState(documentRef: Document): string;
|
|
203
|
+
|
|
130
204
|
declare const authRoutes: Routes;
|
|
131
205
|
|
|
132
206
|
declare class AuthShellPage {
|
|
@@ -134,6 +208,30 @@ declare class AuthShellPage {
|
|
|
134
208
|
static ɵcmp: _angular_core.ɵɵComponentDeclaration<AuthShellPage, "edsis-auth-shell-page", never, {}, {}, never, never, true, never>;
|
|
135
209
|
}
|
|
136
210
|
|
|
211
|
+
declare class AuthGoogleCallbackPage {
|
|
212
|
+
private readonly documentRef;
|
|
213
|
+
private readonly destroyRef;
|
|
214
|
+
private readonly injector;
|
|
215
|
+
private readonly route;
|
|
216
|
+
private readonly router;
|
|
217
|
+
private readonly location;
|
|
218
|
+
private readonly authSessionService;
|
|
219
|
+
private readonly authConfig;
|
|
220
|
+
protected readonly messages: _edsis_angular_module_auth.EdsisAuthMessages;
|
|
221
|
+
protected readonly loginPath: `/${string}`;
|
|
222
|
+
protected readonly authenticatedHomePath: `/${string}`;
|
|
223
|
+
protected readonly state: _angular_core.WritableSignal<"pending" | "success" | "error">;
|
|
224
|
+
protected readonly message: _angular_core.WritableSignal<string>;
|
|
225
|
+
private readonly retryLink;
|
|
226
|
+
constructor();
|
|
227
|
+
private handleCallback;
|
|
228
|
+
private clearCallbackParamsFromAddressBar;
|
|
229
|
+
private exchange;
|
|
230
|
+
private fail;
|
|
231
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<AuthGoogleCallbackPage, never>;
|
|
232
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<AuthGoogleCallbackPage, "AuthGoogleCallbackPage", never, {}, {}, never, never, true, never>;
|
|
233
|
+
}
|
|
234
|
+
|
|
137
235
|
type AuthHealthStatus = 'idle' | 'checking' | 'healthy' | 'unhealthy';
|
|
138
236
|
/**
|
|
139
237
|
* Health-check backend auth untuk `AuthLoginPage` (internal, di-provide oleh
|
|
@@ -155,6 +253,7 @@ declare class AuthHealthService {
|
|
|
155
253
|
}
|
|
156
254
|
|
|
157
255
|
declare class AuthLoginPage {
|
|
256
|
+
private readonly documentRef;
|
|
158
257
|
private readonly destroyRef;
|
|
159
258
|
private readonly formBuilder;
|
|
160
259
|
private readonly injector;
|
|
@@ -162,6 +261,8 @@ declare class AuthLoginPage {
|
|
|
162
261
|
private readonly authConfig;
|
|
163
262
|
protected readonly messages: _edsis_angular_module_auth.EdsisAuthMessages;
|
|
164
263
|
protected readonly health: AuthHealthService;
|
|
264
|
+
protected readonly googleOauth: _edsis_angular_module_auth.ResolvedEdsisAuthGoogleOauth | null;
|
|
265
|
+
protected readonly isGoogleRedirecting: _angular_core.WritableSignal<boolean>;
|
|
165
266
|
protected readonly form: _angular_forms.FormGroup<{
|
|
166
267
|
email: _angular_forms.FormControl<string>;
|
|
167
268
|
}>;
|
|
@@ -181,6 +282,8 @@ declare class AuthLoginPage {
|
|
|
181
282
|
protected readonly fieldTone: _angular_core.Signal<"success" | "error" | "idle">;
|
|
182
283
|
protected readonly emailFieldClasses: _angular_core.Signal<"flex-nowrap bg-background/70 shadow-sm [&>[data-slot=input-group-control]]:h-12! [&>[data-slot=input-group-control]]:px-4! [&>[data-slot=input-group-control]]:text-base!" | "flex-nowrap bg-background/70 shadow-sm [&>[data-slot=input-group-control]]:h-12! [&>[data-slot=input-group-control]]:px-4! [&>[data-slot=input-group-control]]:text-base! border-destructive focus-within:border-destructive focus-within:ring-destructive/20" | "flex-nowrap bg-background/70 shadow-sm [&>[data-slot=input-group-control]]:h-12! [&>[data-slot=input-group-control]]:px-4! [&>[data-slot=input-group-control]]:text-base! border-emerald-500 focus-within:border-emerald-500 focus-within:ring-emerald-500/20">;
|
|
183
284
|
protected retryHealth(): void;
|
|
285
|
+
protected signInWithGoogle(): void;
|
|
286
|
+
protected redirectTo(url: string): void;
|
|
184
287
|
protected submit(): Promise<void>;
|
|
185
288
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<AuthLoginPage, never>;
|
|
186
289
|
static ɵcmp: _angular_core.ɵɵComponentDeclaration<AuthLoginPage, "edsis-auth-login-page", never, {}, {}, never, never, true, never>;
|
|
@@ -256,5 +359,5 @@ declare function injectSessionState(): Promise<boolean>;
|
|
|
256
359
|
declare function injectSessionRefresh(): Promise<boolean>;
|
|
257
360
|
declare function injectSessionClear(): void;
|
|
258
361
|
|
|
259
|
-
export { AUTH_SESSION_CHANGE_EVENT, AuthLoginPage, AuthLogoutPage, AuthShellPage, AuthVerifyPage, DEFAULT_EDSIS_AUTH_MESSAGES, EDSIS_AUTH_CONFIG, EDSIS_AUTH_MESSAGES, EDSIS_SKIP_AUTH, EDSIS_SKIP_SESSION_REFRESH, authRoutes, authenticatedGuard, clearStoredSession, edsisAuthInterceptor, guestOnlyGuard, hasStoredSession, homeRedirectGuard, injectSessionClear, injectSessionRefresh, injectSessionState, mergeEdsisAuthMessages, persistSession, provideEdsisAuth, readStoredAccessToken, readStoredSession, resolveEdsisAuthConfig, shouldClearSessionAfterRefreshFailure, startAuthSessionMonitor, validateStoredSession, ɵresetAuthSessionModuleState };
|
|
260
|
-
export type { EdsisAuthConfig, EdsisAuthHealthCheckConfig, EdsisAuthMessages, EdsisAuthMessagesOverride, ResolvedEdsisAuthConfig, ResolvedEdsisAuthHealthCheck, StoredAuthSession };
|
|
362
|
+
export { AUTH_SESSION_CHANGE_EVENT, AuthGoogleCallbackPage, AuthLoginPage, AuthLogoutPage, AuthShellPage, AuthVerifyPage, DEFAULT_EDSIS_AUTH_MESSAGES, EDSIS_AUTH_CONFIG, EDSIS_AUTH_MESSAGES, EDSIS_SKIP_AUTH, EDSIS_SKIP_SESSION_REFRESH, GOOGLE_OAUTH_AUTHORIZE_URL, GOOGLE_OAUTH_CALLBACK_ROUTE_PATH, GOOGLE_OAUTH_STATE_STORAGE_KEY, authRoutes, authenticatedGuard, buildGoogleAuthorizeUrl, clearStoredSession, consumeGoogleOauthState, createGoogleOauthState, edsisAuthInterceptor, guestOnlyGuard, hasStoredSession, homeRedirectGuard, injectSessionClear, injectSessionRefresh, injectSessionState, mergeEdsisAuthMessages, persistSession, provideEdsisAuth, readStoredAccessToken, readStoredSession, resolveEdsisAuthConfig, shouldClearSessionAfterRefreshFailure, startAuthSessionMonitor, storeGoogleOauthState, validateStoredSession, ɵresetAuthSessionModuleState };
|
|
363
|
+
export type { EdsisAuthConfig, EdsisAuthGoogleOauthConfig, EdsisAuthHealthCheckConfig, EdsisAuthMessages, EdsisAuthMessagesOverride, EdsisAuthOauthConfig, GoogleAuthorizeUrlOptions, ResolvedEdsisAuthConfig, ResolvedEdsisAuthGoogleOauth, ResolvedEdsisAuthHealthCheck, ResolvedEdsisAuthOauth, StoredAuthSession };
|