@edsis/angular 21.1.4 → 21.1.27

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 (150) hide show
  1. package/.npmignore +2 -0
  2. package/README.md +123 -88
  3. package/brand/etos/README.md +273 -0
  4. package/brand/etos/package.json +4 -0
  5. package/chart/README.md +0 -0
  6. package/chart/package.json +4 -0
  7. package/collection.json +30 -0
  8. package/component/package.json +4 -0
  9. package/etos/styles/color.css +73 -0
  10. package/etos/styles/index.css +7 -0
  11. package/etos/styles/layout.css +21 -0
  12. package/etos/styles/package.css +15 -0
  13. package/etos/styles/style.css +53 -0
  14. package/fesm2022/ojiepermana-angular-brand-etos.mjs +1060 -0
  15. package/fesm2022/ojiepermana-angular-brand-etos.mjs.map +1 -0
  16. package/fesm2022/ojiepermana-angular-chart.mjs +3714 -0
  17. package/fesm2022/ojiepermana-angular-chart.mjs.map +1 -0
  18. package/fesm2022/ojiepermana-angular-component.mjs +4069 -0
  19. package/fesm2022/ojiepermana-angular-component.mjs.map +1 -0
  20. package/fesm2022/ojiepermana-angular-generator-api.mjs +67 -0
  21. package/fesm2022/ojiepermana-angular-generator-api.mjs.map +1 -0
  22. package/fesm2022/ojiepermana-angular-layout.mjs +457 -0
  23. package/fesm2022/ojiepermana-angular-layout.mjs.map +1 -0
  24. package/fesm2022/ojiepermana-angular-navigation.mjs +2315 -0
  25. package/fesm2022/ojiepermana-angular-navigation.mjs.map +1 -0
  26. package/fesm2022/ojiepermana-angular-theme.mjs +407 -0
  27. package/fesm2022/ojiepermana-angular-theme.mjs.map +1 -0
  28. package/fesm2022/ojiepermana-angular.mjs +22 -0
  29. package/fesm2022/ojiepermana-angular.mjs.map +1 -0
  30. package/generator/api/README.md +246 -0
  31. package/generator/api/bin/package.json +3 -0
  32. package/generator/api/bin/schematics/init/index.js +88 -0
  33. package/generator/api/bin/schematics/ng-add/index.js +108 -0
  34. package/generator/api/bin/schematics/sdk/index.js +76 -0
  35. package/generator/api/bin/src/config/loader.js +41 -0
  36. package/generator/api/bin/src/config/schema.js +56 -0
  37. package/generator/api/bin/src/emit/client.js +246 -0
  38. package/generator/api/bin/src/emit/metadata.js +295 -0
  39. package/generator/api/bin/src/emit/models.js +106 -0
  40. package/generator/api/bin/src/emit/navigation.js +56 -0
  41. package/generator/api/bin/src/emit/operations.js +122 -0
  42. package/generator/api/bin/src/emit/public-api.js +54 -0
  43. package/generator/api/bin/src/emit/services.js +87 -0
  44. package/generator/api/bin/src/engine.js +65 -0
  45. package/generator/api/bin/src/layout/per-domain.js +355 -0
  46. package/generator/api/bin/src/parser/bundle.js +25 -0
  47. package/generator/api/bin/src/parser/ir.js +320 -0
  48. package/generator/api/bin/src/parser/types.js +7 -0
  49. package/generator/api/bin/src/render/template.js +58 -0
  50. package/generator/api/bin/src/writer/index.js +236 -0
  51. package/generator/api/package.json +4 -0
  52. package/generator/api/schematics/init/schema.json +19 -0
  53. package/generator/api/schematics/ng-add/schema.json +14 -0
  54. package/generator/api/schematics/sdk/schema.json +19 -0
  55. package/generator/api/sdk.config.example.json +22 -0
  56. package/generator/guide/README.md +84 -0
  57. package/generator/guide/bin/package.json +3 -0
  58. package/generator/guide/bin/schematics/build/index.js +35 -0
  59. package/generator/guide/bin/schematics/init/index.js +70 -0
  60. package/generator/guide/bin/src/config/loader.js +50 -0
  61. package/generator/guide/bin/src/config/schema.js +12 -0
  62. package/generator/guide/bin/src/engine/component.js +73 -0
  63. package/generator/guide/bin/src/engine/frontmatter.js +42 -0
  64. package/generator/guide/bin/src/engine/index.js +42 -0
  65. package/generator/guide/bin/src/engine/naming.js +39 -0
  66. package/generator/guide/bin/src/engine/render.js +18 -0
  67. package/generator/guide/bin/src/engine/routes.js +106 -0
  68. package/generator/guide/bin/src/engine/walk.js +35 -0
  69. package/generator/guide/guide.config.example.json +9 -0
  70. package/generator/guide/schematics/build/schema.json +14 -0
  71. package/generator/guide/schematics/init/schema.json +19 -0
  72. package/layout/package.json +4 -0
  73. package/navigation/package.json +4 -0
  74. package/package.json +102 -39
  75. package/theme/package.json +4 -0
  76. package/theme/styles/etos.css +6 -0
  77. package/theme/styles/index.css +32 -0
  78. package/theme/styles/themes/library/_components.css +81 -0
  79. package/theme/styles/themes/library/_layers.css +15 -0
  80. package/theme/styles/themes/library/_material-overrides.css +254 -0
  81. package/theme/styles/themes/library/_tokens.css +55 -0
  82. package/theme/styles/themes/library/color/amber.css +31 -0
  83. package/theme/styles/themes/library/color/base.css +36 -0
  84. package/theme/styles/themes/library/color/blue.css +31 -0
  85. package/theme/styles/themes/library/color/cyan.css +31 -0
  86. package/theme/styles/themes/library/color/emerald.css +31 -0
  87. package/theme/styles/themes/library/color/fuchsia.css +31 -0
  88. package/theme/styles/themes/library/color/green.css +31 -0
  89. package/theme/styles/themes/library/color/index.css +22 -0
  90. package/theme/styles/themes/library/color/indigo.css +31 -0
  91. package/theme/styles/themes/library/color/lime.css +31 -0
  92. package/theme/styles/themes/library/color/orange.css +31 -0
  93. package/theme/styles/themes/library/color/pink.css +31 -0
  94. package/theme/styles/themes/library/color/purple.css +31 -0
  95. package/theme/styles/themes/library/color/red.css +31 -0
  96. package/theme/styles/themes/library/color/rose.css +31 -0
  97. package/theme/styles/themes/library/color/sky.css +31 -0
  98. package/theme/styles/themes/library/color/teal.css +31 -0
  99. package/theme/styles/themes/library/color/violet.css +31 -0
  100. package/theme/styles/themes/library/color/yellow.css +31 -0
  101. package/theme/styles/themes/library/style/brutal.css +50 -0
  102. package/theme/styles/themes/library/style/default.css +54 -0
  103. package/theme/styles/themes/library/style/index.css +8 -0
  104. package/theme/styles/themes/library/style/sharp.css +50 -0
  105. package/theme/styles/themes/library/style/soft.css +50 -0
  106. package/theme/styles/themes/mode/dark.css +20 -0
  107. package/theme/styles/themes/mode/index.css +6 -0
  108. package/theme/styles/themes/mode/light.css +24 -0
  109. package/theme/styles/themes/tailwind.css +114 -0
  110. package/types/ojiepermana-angular-brand-etos.d.ts +162 -0
  111. package/types/ojiepermana-angular-chart.d.ts +1094 -0
  112. package/types/ojiepermana-angular-component.d.ts +1386 -0
  113. package/types/ojiepermana-angular-generator-api.d.ts +85 -0
  114. package/types/ojiepermana-angular-layout.d.ts +163 -0
  115. package/types/ojiepermana-angular-navigation.d.ts +388 -0
  116. package/types/ojiepermana-angular-theme.d.ts +171 -0
  117. package/types/ojiepermana-angular.d.ts +3 -0
  118. package/fesm2022/edsis-angular-auth.mjs +0 -1209
  119. package/fesm2022/edsis-angular-auth.mjs.map +0 -1
  120. package/fesm2022/edsis-angular-sdk-access.mjs +0 -1364
  121. package/fesm2022/edsis-angular-sdk-access.mjs.map +0 -1
  122. package/fesm2022/edsis-angular-sdk-approval.mjs +0 -1258
  123. package/fesm2022/edsis-angular-sdk-approval.mjs.map +0 -1
  124. package/fesm2022/edsis-angular-sdk-auth.mjs +0 -253
  125. package/fesm2022/edsis-angular-sdk-auth.mjs.map +0 -1
  126. package/fesm2022/edsis-angular-sdk-employee.mjs +0 -283
  127. package/fesm2022/edsis-angular-sdk-employee.mjs.map +0 -1
  128. package/fesm2022/edsis-angular-sdk-health.mjs +0 -95
  129. package/fesm2022/edsis-angular-sdk-health.mjs.map +0 -1
  130. package/fesm2022/edsis-angular-sdk-shared.mjs +0 -2740
  131. package/fesm2022/edsis-angular-sdk-shared.mjs.map +0 -1
  132. package/fesm2022/edsis-angular-sdk-storage.mjs +0 -287
  133. package/fesm2022/edsis-angular-sdk-storage.mjs.map +0 -1
  134. package/fesm2022/edsis-angular-sdk-user.mjs +0 -488
  135. package/fesm2022/edsis-angular-sdk-user.mjs.map +0 -1
  136. package/fesm2022/edsis-angular-sdk.mjs +0 -6730
  137. package/fesm2022/edsis-angular-sdk.mjs.map +0 -1
  138. package/fesm2022/edsis-angular.mjs +0 -8
  139. package/fesm2022/edsis-angular.mjs.map +0 -1
  140. package/types/edsis-angular-auth.d.ts +0 -119
  141. package/types/edsis-angular-sdk-access.d.ts +0 -546
  142. package/types/edsis-angular-sdk-approval.d.ts +0 -637
  143. package/types/edsis-angular-sdk-auth.d.ts +0 -127
  144. package/types/edsis-angular-sdk-employee.d.ts +0 -158
  145. package/types/edsis-angular-sdk-health.d.ts +0 -34
  146. package/types/edsis-angular-sdk-shared.d.ts +0 -176
  147. package/types/edsis-angular-sdk-storage.d.ts +0 -101
  148. package/types/edsis-angular-sdk-user.d.ts +0 -188
  149. package/types/edsis-angular-sdk.d.ts +0 -1927
  150. package/types/edsis-angular.d.ts +0 -2
@@ -1,1209 +0,0 @@
1
- import * as i0 from '@angular/core';
2
- import { InjectionToken, inject, makeEnvironmentProviders, ChangeDetectionStrategy, Component, DestroyRef, signal } from '@angular/core';
3
- import { HttpContextToken, HttpErrorResponse, provideHttpClient, withFetch, withInterceptors } from '@angular/common/http';
4
- import { ApiConfiguration, provideApiConfiguration } from '@edsis/angular/sdk/shared';
5
- import { DOCUMENT, Location } from '@angular/common';
6
- import { AuthService } from '@edsis/angular/sdk/auth';
7
- import { firstValueFrom, throwError, from, finalize, combineLatest } from 'rxjs';
8
- import { switchMap, catchError } from 'rxjs/operators';
9
- import { Router, RouterOutlet, RouterLink, ActivatedRoute } from '@angular/router';
10
- import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
11
- import * as i1 from '@angular/forms';
12
- import { FormBuilder, Validators, ReactiveFormsModule } from '@angular/forms';
13
-
14
- const DEFAULT_LOGIN_PATH = '/login';
15
- const DEFAULT_LOGOUT_PATH = '/logout';
16
- const DEFAULT_VERIFY_PATH = '/verify';
17
- const DEFAULT_AUTHENTICATED_HOME_PATH = '/dashboard';
18
- const EDSIS_AUTH_CONFIG = new InjectionToken('EDSIS_AUTH_CONFIG');
19
- function resolveEdsisAuthConfig(config) {
20
- const loginPath = normalizePath(config.loginPath, DEFAULT_LOGIN_PATH);
21
- return {
22
- apiUrl: normalizeAbsoluteUrl(config.apiUrl, 'apiUrl'),
23
- appUrl: normalizeAbsoluteUrl(config.appUrl, 'appUrl'),
24
- loginPath,
25
- logoutPath: normalizePath(config.logoutPath, DEFAULT_LOGOUT_PATH),
26
- verifyPath: normalizePath(config.verifyPath, DEFAULT_VERIFY_PATH),
27
- authenticatedHomePath: normalizePath(config.authenticatedHomePath, DEFAULT_AUTHENTICATED_HOME_PATH),
28
- guestHomePath: normalizePath(config.guestHomePath, loginPath),
29
- };
30
- }
31
- function normalizeAbsoluteUrl(value, label) {
32
- const normalizedValue = value.trim();
33
- if (!normalizedValue) {
34
- throw new Error(`Edsis auth requires a non-empty ${label}.`);
35
- }
36
- const normalizedUrl = new URL(normalizedValue);
37
- return normalizedUrl.toString().replace(/\/$/, '');
38
- }
39
- function normalizePath(value, fallback) {
40
- const normalizedValue = value?.trim();
41
- if (!normalizedValue) {
42
- return fallback;
43
- }
44
- return (normalizedValue.startsWith('/') ? normalizedValue : `/${normalizedValue}`);
45
- }
46
-
47
- const AUTH_SESSION_STORAGE_KEYS = ['access_token', 'user_id', 'role', 'name'];
48
- const EMPTY_SESSION_FINGERPRINT = '__empty_session__';
49
- const JWT_PART_COUNT = 3;
50
- const TOKEN_EXPIRY_SKEW_MS = 30_000;
51
- let validatedAccessToken = '';
52
- let validatedUntilEpochMs = 0;
53
- let failedSessionFingerprint = null;
54
- let pendingSessionValidation = null;
55
- function getSessionStorage(documentRef) {
56
- return documentRef.defaultView?.sessionStorage ?? null;
57
- }
58
- function readSessionStorageValue(documentRef, storageKey) {
59
- return getSessionStorage(documentRef)?.getItem(storageKey)?.trim() ?? '';
60
- }
61
- function readSessionDataValue(sessionData, storageKey) {
62
- const value = sessionData?.[storageKey];
63
- return typeof value === 'string' ? value.trim() : '';
64
- }
65
- function clearValidatedSession() {
66
- validatedAccessToken = '';
67
- validatedUntilEpochMs = 0;
68
- }
69
- function clearFailedSessionFingerprint() {
70
- failedSessionFingerprint = null;
71
- }
72
- function readSessionFingerprint(documentRef) {
73
- return readStoredAccessToken(documentRef) || EMPTY_SESSION_FINGERPRINT;
74
- }
75
- function hasFailedSessionFingerprint(documentRef) {
76
- return failedSessionFingerprint === readSessionFingerprint(documentRef);
77
- }
78
- function markFailedSessionFingerprint(documentRef) {
79
- failedSessionFingerprint = readSessionFingerprint(documentRef);
80
- }
81
- function getTokenExpiryEpochMs(documentRef, accessToken) {
82
- const windowRef = documentRef.defaultView;
83
- const tokenParts = accessToken.split('.');
84
- if (!windowRef?.atob || tokenParts.length !== JWT_PART_COUNT) {
85
- return null;
86
- }
87
- const normalizedPayload = tokenParts[1].replace(/-/g, '+').replace(/_/g, '/');
88
- const paddedPayload = normalizedPayload.padEnd(Math.ceil(normalizedPayload.length / 4) * 4, '=');
89
- try {
90
- const parsedPayload = JSON.parse(windowRef.atob(paddedPayload));
91
- return typeof parsedPayload.exp === 'number' ? parsedPayload.exp * 1000 : null;
92
- }
93
- catch {
94
- return null;
95
- }
96
- }
97
- function markValidatedSession(documentRef) {
98
- const accessToken = readStoredAccessToken(documentRef);
99
- if (!accessToken) {
100
- clearValidatedSession();
101
- return;
102
- }
103
- const tokenExpiryEpochMs = getTokenExpiryEpochMs(documentRef, accessToken);
104
- if (!tokenExpiryEpochMs) {
105
- clearValidatedSession();
106
- return;
107
- }
108
- validatedAccessToken = accessToken;
109
- validatedUntilEpochMs = tokenExpiryEpochMs;
110
- }
111
- function hasValidatedSession(documentRef) {
112
- const accessToken = readStoredAccessToken(documentRef);
113
- if (!accessToken) {
114
- clearValidatedSession();
115
- return false;
116
- }
117
- if (accessToken !== validatedAccessToken) {
118
- markValidatedSession(documentRef);
119
- }
120
- if (!validatedAccessToken) {
121
- clearValidatedSession();
122
- return false;
123
- }
124
- return validatedUntilEpochMs > Date.now() + TOKEN_EXPIRY_SKEW_MS;
125
- }
126
- function hasStoredSession(documentRef) {
127
- return Boolean(readStoredAccessToken(documentRef));
128
- }
129
- function readStoredAccessToken(documentRef) {
130
- return readSessionStorageValue(documentRef, 'access_token');
131
- }
132
- function readStoredSession(documentRef) {
133
- const accessToken = readStoredAccessToken(documentRef);
134
- if (!accessToken) {
135
- return null;
136
- }
137
- const userId = readSessionStorageValue(documentRef, 'user_id');
138
- const role = readSessionStorageValue(documentRef, 'role');
139
- const name = readSessionStorageValue(documentRef, 'name');
140
- return {
141
- accessToken,
142
- userId: userId || undefined,
143
- role: role || undefined,
144
- name: name || undefined,
145
- };
146
- }
147
- function persistSession(documentRef, sessionData) {
148
- const sessionStorageRef = getSessionStorage(documentRef);
149
- if (!sessionStorageRef) {
150
- clearValidatedSession();
151
- return null;
152
- }
153
- for (const storageKey of AUTH_SESSION_STORAGE_KEYS) {
154
- const nextValue = readSessionDataValue(sessionData, storageKey);
155
- if (nextValue) {
156
- sessionStorageRef.setItem(storageKey, nextValue);
157
- continue;
158
- }
159
- sessionStorageRef.removeItem(storageKey);
160
- }
161
- markValidatedSession(documentRef);
162
- clearFailedSessionFingerprint();
163
- return readStoredSession(documentRef);
164
- }
165
- function clearStoredSession(documentRef, options) {
166
- const sessionStorageRef = getSessionStorage(documentRef);
167
- for (const storageKey of AUTH_SESSION_STORAGE_KEYS) {
168
- sessionStorageRef?.removeItem(storageKey);
169
- }
170
- clearValidatedSession();
171
- if (!options?.preserveFailedSessionFingerprint) {
172
- clearFailedSessionFingerprint();
173
- }
174
- }
175
- async function validateStoredSession(documentRef, authService, options) {
176
- if (!options?.forceRefresh && hasValidatedSession(documentRef)) {
177
- return true;
178
- }
179
- if (hasFailedSessionFingerprint(documentRef)) {
180
- return false;
181
- }
182
- if (pendingSessionValidation) {
183
- return pendingSessionValidation;
184
- }
185
- pendingSessionValidation = (async () => {
186
- try {
187
- const response = await firstValueFrom(authService.refreshAuthToken());
188
- persistSession(documentRef, response.data);
189
- return hasValidatedSession(documentRef);
190
- }
191
- catch {
192
- clearStoredSession(documentRef, { preserveFailedSessionFingerprint: true });
193
- markFailedSessionFingerprint(documentRef);
194
- return false;
195
- }
196
- finally {
197
- pendingSessionValidation = null;
198
- }
199
- })();
200
- return pendingSessionValidation;
201
- }
202
- function injectSessionState() {
203
- const documentRef = inject(DOCUMENT);
204
- const authService = inject(AuthService);
205
- return validateStoredSession(documentRef, authService);
206
- }
207
- function injectSessionRefresh() {
208
- const documentRef = inject(DOCUMENT);
209
- const authService = inject(AuthService);
210
- return validateStoredSession(documentRef, authService, { forceRefresh: true });
211
- }
212
- function injectSessionClear() {
213
- clearStoredSession(inject(DOCUMENT));
214
- }
215
-
216
- const PROTECTED_API_PATH_PREFIX = '/v1/';
217
- const AUTH_PATH_PREFIX = '/v1/auth/';
218
- const HEALTH_PATH = '/health';
219
- const EDSIS_SKIP_AUTH = new HttpContextToken(() => false);
220
- const EDSIS_AUTH_RETRY = new HttpContextToken(() => false);
221
- function normalizeUrl(url) {
222
- try {
223
- return new URL(url);
224
- }
225
- catch {
226
- return null;
227
- }
228
- }
229
- function resolveApiPath(url, rootUrl) {
230
- const normalizedUrl = normalizeUrl(url);
231
- const normalizedRootUrl = normalizeUrl(rootUrl);
232
- if (normalizedUrl && normalizedRootUrl) {
233
- if (normalizedUrl.origin !== normalizedRootUrl.origin) {
234
- return null;
235
- }
236
- if (!normalizedUrl.pathname.startsWith(normalizedRootUrl.pathname)) {
237
- return null;
238
- }
239
- const apiPath = normalizedUrl.pathname.slice(normalizedRootUrl.pathname.length) || '/';
240
- return apiPath.startsWith('/') ? apiPath : `/${apiPath}`;
241
- }
242
- if (url.startsWith(rootUrl)) {
243
- const apiPath = url.slice(rootUrl.length).split(/[?#]/, 1)[0] ?? '/';
244
- return apiPath.startsWith('/') ? apiPath : `/${apiPath}`;
245
- }
246
- if (url.startsWith('/')) {
247
- return url.split(/[?#]/, 1)[0] ?? url;
248
- }
249
- return null;
250
- }
251
- function isAuthRequest(apiPath) {
252
- return apiPath.startsWith(AUTH_PATH_PREFIX);
253
- }
254
- function isProtectedApiRequest(apiPath) {
255
- return apiPath.startsWith(PROTECTED_API_PATH_PREFIX) && !isAuthRequest(apiPath);
256
- }
257
- function isHealthRequest(apiPath) {
258
- return apiPath === HEALTH_PATH;
259
- }
260
- function isHandledRequest(apiPath) {
261
- return isProtectedApiRequest(apiPath) || isAuthRequest(apiPath) || isHealthRequest(apiPath);
262
- }
263
- function applyCookieCredentials(request, apiPath) {
264
- return isAuthRequest(apiPath) && !request.withCredentials ? request.clone({ withCredentials: true }) : request;
265
- }
266
- function applyBearerToken(request, accessToken, isRetry = false) {
267
- return request.clone({
268
- context: isRetry ? request.context.set(EDSIS_AUTH_RETRY, true) : request.context,
269
- setHeaders: {
270
- Authorization: `Bearer ${accessToken}`,
271
- },
272
- });
273
- }
274
- async function resolveAccessToken(documentRef, authService, options) {
275
- const isSessionValid = await validateStoredSession(documentRef, authService, options);
276
- return isSessionValid ? readStoredAccessToken(documentRef) : '';
277
- }
278
- function handleUnauthorizedError(error, request, next, documentRef, authService) {
279
- if (!(error instanceof HttpErrorResponse) || error.status !== 401 || request.context.get(EDSIS_AUTH_RETRY)) {
280
- return throwError(() => error);
281
- }
282
- return from(resolveAccessToken(documentRef, authService, { forceRefresh: true })).pipe(switchMap((refreshedAccessToken) => {
283
- if (!refreshedAccessToken) {
284
- clearStoredSession(documentRef);
285
- return throwError(() => error);
286
- }
287
- return next(applyBearerToken(request, refreshedAccessToken, true));
288
- }), catchError(() => {
289
- clearStoredSession(documentRef);
290
- return throwError(() => error);
291
- }));
292
- }
293
- const edsisAuthInterceptor = (request, next) => {
294
- const documentRef = inject(DOCUMENT);
295
- const apiConfiguration = inject(ApiConfiguration);
296
- const authService = inject(AuthService);
297
- if (request.context.get(EDSIS_SKIP_AUTH)) {
298
- return next(request);
299
- }
300
- const apiPath = resolveApiPath(request.url, apiConfiguration.rootUrl);
301
- if (!apiPath || !isHandledRequest(apiPath)) {
302
- return next(request);
303
- }
304
- const preparedRequest = applyCookieCredentials(request, apiPath);
305
- if (isAuthRequest(apiPath) || isHealthRequest(apiPath)) {
306
- return next(preparedRequest);
307
- }
308
- return from(resolveAccessToken(documentRef, authService)).pipe(switchMap((accessToken) => {
309
- const authorizedRequest = accessToken ? applyBearerToken(preparedRequest, accessToken) : preparedRequest;
310
- return next(authorizedRequest).pipe(catchError((error) => handleUnauthorizedError(error, preparedRequest, next, documentRef, authService)));
311
- }));
312
- };
313
-
314
- function provideEdsisAuth(config) {
315
- const resolvedConfig = resolveEdsisAuthConfig(config);
316
- return makeEnvironmentProviders([
317
- provideApiConfiguration(resolvedConfig.apiUrl),
318
- provideHttpClient(withFetch(), withInterceptors([edsisAuthInterceptor])),
319
- {
320
- provide: EDSIS_AUTH_CONFIG,
321
- useValue: resolvedConfig,
322
- },
323
- ]);
324
- }
325
-
326
- const authenticatedGuard = async () => {
327
- const router = inject(Router);
328
- const authConfig = inject(EDSIS_AUTH_CONFIG);
329
- if (await injectSessionState()) {
330
- return true;
331
- }
332
- return router.parseUrl(authConfig.guestHomePath);
333
- };
334
- const homeRedirectGuard = async () => {
335
- const router = inject(Router);
336
- const authConfig = inject(EDSIS_AUTH_CONFIG);
337
- return router.parseUrl((await injectSessionState()) ? authConfig.authenticatedHomePath : authConfig.guestHomePath);
338
- };
339
- const guestOnlyGuard = async () => {
340
- const router = inject(Router);
341
- const authConfig = inject(EDSIS_AUTH_CONFIG);
342
- if (!(await injectSessionState())) {
343
- return true;
344
- }
345
- return router.parseUrl(authConfig.authenticatedHomePath);
346
- };
347
-
348
- class AuthShellPage {
349
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.13", ngImport: i0, type: AuthShellPage, deps: [], target: i0.ɵɵFactoryTarget.Component });
350
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.13", type: AuthShellPage, isStandalone: true, selector: "edsis-auth-shell-page", host: { classAttribute: "block min-h-screen bg-background text-foreground" }, ngImport: i0, template: `
351
- <section
352
- class="relative isolate flex min-h-screen items-center justify-center overflow-hidden px-4 py-10 sm:px-6 lg:px-8">
353
- <div
354
- aria-hidden="true"
355
- class="absolute inset-0 bg-[radial-gradient(circle_at_top_left,rgba(14,165,233,0.14),transparent_34%),radial-gradient(circle_at_bottom_right,rgba(34,197,94,0.12),transparent_32%)]"></div>
356
-
357
- <div
358
- aria-hidden="true"
359
- class="absolute inset-0 bg-[linear-gradient(rgba(148,163,184,0.08)_1px,transparent_1px),linear-gradient(90deg,rgba(148,163,184,0.08)_1px,transparent_1px)] bg-[size:4.5rem_4.5rem] [mask-image:radial-gradient(circle_at_center,black,transparent_82%)]"></div>
360
-
361
- <div class="relative flex w-full max-w-xl justify-center">
362
- <div aria-hidden="true" class="pointer-events-none absolute inset-0 z-20">
363
- <div class="absolute left-1/2 top-0 w-screen -translate-x-1/2 border-t border-border/70"></div>
364
- <div class="absolute left-1/2 bottom-0 w-screen -translate-x-1/2 border-t border-border/70"></div>
365
- <div class="absolute left-0 top-1/2 h-screen -translate-y-1/2 border-l border-border/70"></div>
366
- <div class="absolute right-0 top-1/2 h-screen -translate-y-1/2 border-l border-border/70"></div>
367
-
368
- <div class="absolute left-0 top-0 h-8 w-8 -translate-x-1/2 -translate-y-1/2">
369
- <div
370
- class="absolute left-1/2 top-1/2 h-5 -translate-x-1/2 -translate-y-1/2 border-l-2 border-primary"></div>
371
- <div
372
- class="absolute left-1/2 top-1/2 w-5 -translate-x-1/2 -translate-y-1/2 border-t-2 border-primary"></div>
373
- </div>
374
- <div class="absolute right-0 top-0 h-8 w-8 translate-x-1/2 -translate-y-1/2">
375
- <div
376
- class="absolute left-1/2 top-1/2 h-5 -translate-x-1/2 -translate-y-1/2 border-l-2 border-primary"></div>
377
- <div
378
- class="absolute left-1/2 top-1/2 w-5 -translate-x-1/2 -translate-y-1/2 border-t-2 border-primary"></div>
379
- </div>
380
- <div class="absolute left-0 bottom-0 h-8 w-8 -translate-x-1/2 translate-y-1/2">
381
- <div
382
- class="absolute left-1/2 top-1/2 h-5 -translate-x-1/2 -translate-y-1/2 border-l-2 border-primary"></div>
383
- <div
384
- class="absolute left-1/2 top-1/2 w-5 -translate-x-1/2 -translate-y-1/2 border-t-2 border-primary"></div>
385
- </div>
386
- <div class="absolute right-0 bottom-0 h-8 w-8 translate-x-1/2 translate-y-1/2">
387
- <div
388
- class="absolute left-1/2 top-1/2 h-5 -translate-x-1/2 -translate-y-1/2 border-l-2 border-primary"></div>
389
- <div
390
- class="absolute left-1/2 top-1/2 w-5 -translate-x-1/2 -translate-y-1/2 border-t-2 border-primary"></div>
391
- </div>
392
- </div>
393
-
394
- <div class="relative z-10 w-full border border-border/80 bg-card/95 p-6 shadow-2xl backdrop-blur sm:p-8">
395
- <router-outlet />
396
- </div>
397
- </div>
398
- </section>
399
- `, isInline: true, dependencies: [{ kind: "directive", type: RouterOutlet, selector: "router-outlet", inputs: ["name", "routerOutletData"], outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
400
- }
401
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.13", ngImport: i0, type: AuthShellPage, decorators: [{
402
- type: Component,
403
- args: [{
404
- selector: 'edsis-auth-shell-page',
405
- imports: [RouterOutlet],
406
- host: {
407
- class: 'block min-h-screen bg-background text-foreground',
408
- },
409
- template: `
410
- <section
411
- class="relative isolate flex min-h-screen items-center justify-center overflow-hidden px-4 py-10 sm:px-6 lg:px-8">
412
- <div
413
- aria-hidden="true"
414
- class="absolute inset-0 bg-[radial-gradient(circle_at_top_left,rgba(14,165,233,0.14),transparent_34%),radial-gradient(circle_at_bottom_right,rgba(34,197,94,0.12),transparent_32%)]"></div>
415
-
416
- <div
417
- aria-hidden="true"
418
- class="absolute inset-0 bg-[linear-gradient(rgba(148,163,184,0.08)_1px,transparent_1px),linear-gradient(90deg,rgba(148,163,184,0.08)_1px,transparent_1px)] bg-[size:4.5rem_4.5rem] [mask-image:radial-gradient(circle_at_center,black,transparent_82%)]"></div>
419
-
420
- <div class="relative flex w-full max-w-xl justify-center">
421
- <div aria-hidden="true" class="pointer-events-none absolute inset-0 z-20">
422
- <div class="absolute left-1/2 top-0 w-screen -translate-x-1/2 border-t border-border/70"></div>
423
- <div class="absolute left-1/2 bottom-0 w-screen -translate-x-1/2 border-t border-border/70"></div>
424
- <div class="absolute left-0 top-1/2 h-screen -translate-y-1/2 border-l border-border/70"></div>
425
- <div class="absolute right-0 top-1/2 h-screen -translate-y-1/2 border-l border-border/70"></div>
426
-
427
- <div class="absolute left-0 top-0 h-8 w-8 -translate-x-1/2 -translate-y-1/2">
428
- <div
429
- class="absolute left-1/2 top-1/2 h-5 -translate-x-1/2 -translate-y-1/2 border-l-2 border-primary"></div>
430
- <div
431
- class="absolute left-1/2 top-1/2 w-5 -translate-x-1/2 -translate-y-1/2 border-t-2 border-primary"></div>
432
- </div>
433
- <div class="absolute right-0 top-0 h-8 w-8 translate-x-1/2 -translate-y-1/2">
434
- <div
435
- class="absolute left-1/2 top-1/2 h-5 -translate-x-1/2 -translate-y-1/2 border-l-2 border-primary"></div>
436
- <div
437
- class="absolute left-1/2 top-1/2 w-5 -translate-x-1/2 -translate-y-1/2 border-t-2 border-primary"></div>
438
- </div>
439
- <div class="absolute left-0 bottom-0 h-8 w-8 -translate-x-1/2 translate-y-1/2">
440
- <div
441
- class="absolute left-1/2 top-1/2 h-5 -translate-x-1/2 -translate-y-1/2 border-l-2 border-primary"></div>
442
- <div
443
- class="absolute left-1/2 top-1/2 w-5 -translate-x-1/2 -translate-y-1/2 border-t-2 border-primary"></div>
444
- </div>
445
- <div class="absolute right-0 bottom-0 h-8 w-8 translate-x-1/2 translate-y-1/2">
446
- <div
447
- class="absolute left-1/2 top-1/2 h-5 -translate-x-1/2 -translate-y-1/2 border-l-2 border-primary"></div>
448
- <div
449
- class="absolute left-1/2 top-1/2 w-5 -translate-x-1/2 -translate-y-1/2 border-t-2 border-primary"></div>
450
- </div>
451
- </div>
452
-
453
- <div class="relative z-10 w-full border border-border/80 bg-card/95 p-6 shadow-2xl backdrop-blur sm:p-8">
454
- <router-outlet />
455
- </div>
456
- </div>
457
- </section>
458
- `,
459
- changeDetection: ChangeDetectionStrategy.OnPush,
460
- }]
461
- }] });
462
-
463
- function buildVerifyUrl(config) {
464
- const baseUrl = typeof window !== 'undefined' && window.location.origin ? window.location.origin : config.appUrl;
465
- return new URL(config.verifyPath, `${baseUrl}/`).toString();
466
- }
467
- function extractMagicToken(queryToken, fragment) {
468
- const tokenFromQuery = normalizeText(queryToken);
469
- if (tokenFromQuery) {
470
- return tokenFromQuery;
471
- }
472
- const normalizedFragment = normalizeText(fragment?.startsWith('#') ? fragment.slice(1) : fragment);
473
- if (!normalizedFragment) {
474
- return null;
475
- }
476
- const fragmentParams = new URLSearchParams(normalizedFragment);
477
- const tokenFromFragment = normalizeText(fragmentParams.get('token')) ??
478
- normalizeText(fragmentParams.get('magic_token')) ??
479
- normalizeText(fragmentParams.get('value'));
480
- if (tokenFromFragment) {
481
- return tokenFromFragment;
482
- }
483
- return normalizedFragment.includes('=') ? null : normalizedFragment;
484
- }
485
- function getResponseMessage(response, fallback) {
486
- if (!hasMessage(response)) {
487
- return fallback;
488
- }
489
- return normalizeText(response.message) ?? fallback;
490
- }
491
- function getErrorMessage(error, fallback) {
492
- if (error instanceof HttpErrorResponse) {
493
- const errorBody = error.error;
494
- if (typeof errorBody === 'string') {
495
- return normalizeText(errorBody) ?? fallback;
496
- }
497
- if (hasMessage(errorBody)) {
498
- return normalizeText(errorBody.message) ?? fallback;
499
- }
500
- return normalizeText(error.message) ?? fallback;
501
- }
502
- if (error instanceof Error) {
503
- return normalizeText(error.message) ?? fallback;
504
- }
505
- return fallback;
506
- }
507
- function hasMessage(value) {
508
- return typeof value === 'object' && value !== null && 'message' in value;
509
- }
510
- function normalizeText(value) {
511
- if (typeof value !== 'string') {
512
- return null;
513
- }
514
- const normalizedValue = value.trim();
515
- return normalizedValue.length > 0 ? normalizedValue : null;
516
- }
517
-
518
- class AuthLoginPage {
519
- destroyRef = inject(DestroyRef);
520
- formBuilder = inject(FormBuilder);
521
- authService = inject(AuthService);
522
- form = this.formBuilder.nonNullable.group({
523
- email: ['', [Validators.required, Validators.email, Validators.maxLength(255)]],
524
- });
525
- isSubmitting = signal(false, ...(ngDevMode ? [{ debugName: "isSubmitting" }] : /* istanbul ignore next */ []));
526
- responseMessage = signal(null, ...(ngDevMode ? [{ debugName: "responseMessage" }] : /* istanbul ignore next */ []));
527
- errorMessage = signal(null, ...(ngDevMode ? [{ debugName: "errorMessage" }] : /* istanbul ignore next */ []));
528
- emailControl = this.form.controls.email;
529
- hasInlineError() {
530
- return this.emailControl.invalid && (this.emailControl.dirty || this.emailControl.touched);
531
- }
532
- fieldTone() {
533
- if (this.hasInlineError() || this.errorMessage()) {
534
- return 'error';
535
- }
536
- if (this.responseMessage()) {
537
- return 'success';
538
- }
539
- return 'idle';
540
- }
541
- submit() {
542
- if (this.form.invalid) {
543
- this.form.markAllAsTouched();
544
- return;
545
- }
546
- this.isSubmitting.set(true);
547
- this.responseMessage.set(null);
548
- this.errorMessage.set(null);
549
- const email = this.emailControl.getRawValue().trim().toLowerCase();
550
- this.emailControl.setValue(email);
551
- this.authService
552
- .requestMagicLoginLink({
553
- body: {
554
- email,
555
- },
556
- })
557
- .pipe(takeUntilDestroyed(this.destroyRef), finalize(() => this.isSubmitting.set(false)))
558
- .subscribe({
559
- next: (response) => {
560
- this.responseMessage.set(getResponseMessage(response, 'Magic link berhasil dikirim.'));
561
- },
562
- error: (error) => {
563
- this.errorMessage.set(getErrorMessage(error, 'Gagal mengirim magic link.'));
564
- },
565
- });
566
- }
567
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.13", ngImport: i0, type: AuthLoginPage, deps: [], target: i0.ɵɵFactoryTarget.Component });
568
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.13", type: AuthLoginPage, isStandalone: true, selector: "edsis-auth-login-page", host: { classAttribute: "block" }, ngImport: i0, template: `
569
- <div class="space-y-8">
570
- <header class="space-y-3">
571
- <p class="text-sm font-medium uppercase tracking-[0.24em] text-muted-foreground">Login</p>
572
- <div class="space-y-2">
573
- <h2 class="text-3xl font-semibold tracking-tight">Verifikasi email untuk masuk.</h2>
574
- <p class="max-w-xl text-sm leading-6 text-muted-foreground">
575
- Masukkan email yang terdaftar, silahkan klik link pada email yang diterima untuk masuk ke aplikasi.
576
- </p>
577
- </div>
578
- </header>
579
-
580
- <form class="space-y-5" [formGroup]="form" (ngSubmit)="submit()">
581
- <div class="space-y-2">
582
- <div
583
- class="grid grid-cols-[2.5rem_minmax(0,1fr)_2.5rem] grid-rows-[2rem_auto_2rem_auto] sm:grid-cols-[3rem_minmax(0,1fr)_3rem]">
584
- <div aria-hidden="true" class="relative border-b border-r border-border/70">
585
- <div class="absolute bottom-0 right-0 h-7 w-7 translate-x-1/2 translate-y-1/2">
586
- <div
587
- class="absolute left-1/2 top-1/2 h-4 -translate-x-1/2 -translate-y-1/2 border-l-2 border-primary"></div>
588
- <div
589
- class="absolute left-1/2 top-1/2 w-4 -translate-x-1/2 -translate-y-1/2 border-t-2 border-primary"></div>
590
- </div>
591
- </div>
592
- <div aria-hidden="true" class="border-b border-border/70"></div>
593
- <div aria-hidden="true" class="relative border-b border-l border-border/70">
594
- <div class="absolute bottom-0 left-0 h-7 w-7 -translate-x-1/2 translate-y-1/2">
595
- <div
596
- class="absolute left-1/2 top-1/2 h-4 -translate-x-1/2 -translate-y-1/2 border-l-2 border-primary"></div>
597
- <div
598
- class="absolute left-1/2 top-1/2 w-4 -translate-x-1/2 -translate-y-1/2 border-t-2 border-primary"></div>
599
- </div>
600
- </div>
601
-
602
- <div aria-hidden="true" class="border-r border-border/70"></div>
603
- <div
604
- class="relative z-10 flex items-center gap-4 border bg-card px-6 py-4 shadow-sm transition focus-within:ring-2 focus-within:ring-primary/15 sm:px-8"
605
- [class.border-border]="fieldTone() === 'idle'"
606
- [class.border-destructive]="fieldTone() === 'error'"
607
- [class.border-emerald-500]="fieldTone() === 'success'">
608
- <span aria-hidden="true" class="flex shrink-0 items-center justify-center text-primary">
609
- <svg
610
- viewBox="0 0 24 24"
611
- class="h-6 w-6 fill-none stroke-current"
612
- stroke-width="1.8"
613
- stroke-linecap="round"
614
- stroke-linejoin="round">
615
- <path d="M4 7.5h16" />
616
- <path d="M5 6h14a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1Z" />
617
- <path d="m5 8 7 5 7-5" />
618
- </svg>
619
- </span>
620
-
621
- <input
622
- id="email"
623
- type="email"
624
- inputmode="email"
625
- autocomplete="email"
626
- aria-label="Email"
627
- formControlName="email"
628
- placeholder="your@email.com"
629
- class="min-w-0 grow border-0 bg-transparent text-base font-medium text-foreground outline-none placeholder:font-normal placeholder:text-muted-foreground/80 md:text-lg" />
630
-
631
- <button
632
- type="submit"
633
- [disabled]="form.invalid || isSubmitting()"
634
- class="inline-flex shrink-0 items-center justify-center bg-primary px-4 py-2.5 text-sm font-semibold text-primary-foreground transition hover:opacity-95 focus:outline-none focus:ring-2 focus:ring-primary/20 disabled:cursor-not-allowed disabled:opacity-60">
635
- {{ isSubmitting() ? 'Mengirim...' : 'Kirim' }}
636
- </button>
637
- </div>
638
- <div aria-hidden="true" class="border-l border-border/70"></div>
639
-
640
- <div aria-hidden="true" class="relative border-r border-t border-border/70">
641
- <div class="absolute right-0 top-0 h-7 w-7 translate-x-1/2 -translate-y-1/2">
642
- <div
643
- class="absolute left-1/2 top-1/2 h-4 -translate-x-1/2 -translate-y-1/2 border-l-2 border-primary"></div>
644
- <div
645
- class="absolute left-1/2 top-1/2 w-4 -translate-x-1/2 -translate-y-1/2 border-t-2 border-primary"></div>
646
- </div>
647
- </div>
648
- <div aria-hidden="true" class="border-t border-border/70"></div>
649
- <div aria-hidden="true" class="relative border-l border-t border-border/70">
650
- <div class="absolute left-0 top-0 h-7 w-7 -translate-x-1/2 -translate-y-1/2">
651
- <div
652
- class="absolute left-1/2 top-1/2 h-4 -translate-x-1/2 -translate-y-1/2 border-l-2 border-primary"></div>
653
- <div
654
- class="absolute left-1/2 top-1/2 w-4 -translate-x-1/2 -translate-y-1/2 border-t-2 border-primary"></div>
655
- </div>
656
- </div>
657
-
658
- <div aria-hidden="true" class="border-r border-border/70"></div>
659
- <div class="px-4 pt-4 text-center sm:px-6">
660
- @if (hasInlineError()) {
661
- <p class="text-sm text-destructive">
662
- @if (emailControl.hasError('required')) {
663
- Email wajib diisi.
664
- } @else {
665
- Gunakan format email yang valid dengan panjang maksimal 255 karakter.
666
- }
667
- </p>
668
- } @else if (responseMessage()) {
669
- <p class="text-sm text-emerald-700">
670
- {{ responseMessage() }}
671
- </p>
672
- } @else if (errorMessage()) {
673
- <p class="text-sm text-destructive">
674
- {{ errorMessage() }}
675
- </p>
676
- }
677
- </div>
678
- <div aria-hidden="true" class="border-l border-border/70"></div>
679
- </div>
680
-
681
- <div class="space-y-4 pt-4">
682
- <div
683
- class="flex items-center justify-center text-sm font-medium uppercase tracking-[0.18em] text-muted-foreground">
684
- Atau
685
- </div>
686
-
687
- <div class="flex flex-wrap items-center justify-center gap-3">
688
- <button
689
- type="button"
690
- class="inline-flex h-12 items-center justify-center gap-3 bg-card px-4 text-[0.74rem] font-medium uppercase tracking-[0.16em] text-card-foreground transition-[background-color,color] duration-150 hover:bg-secondary hover:text-destructive">
691
- <span class="inline-flex size-6 shrink-0 items-center justify-center" aria-hidden="true">
692
- <svg viewBox="0 0 24 24" class="size-5" xmlns="http://www.w3.org/2000/svg">
693
- <path
694
- fill="#EA4335"
695
- d="M12.24 10.285v3.965h5.514c-.24 1.285-.96 2.374-2.045 3.105l3.305 2.565c1.925-1.775 3.03-4.39 3.03-7.49 0-.73-.065-1.43-.185-2.145z" />
696
- <path
697
- fill="#34A853"
698
- d="M12 22c2.7 0 4.965-.895 6.62-2.425l-3.305-2.565c-.915.615-2.085.985-3.315.985-2.545 0-4.7-1.72-5.47-4.03H3.115v2.53A9.996 9.996 0 0 0 12 22" />
699
- <path
700
- fill="#4A90E2"
701
- d="M6.53 13.965A5.996 5.996 0 0 1 6.24 12c0-.68.115-1.34.29-1.965v-2.53H3.115A9.996 9.996 0 0 0 2 12c0 1.61.385 3.135 1.115 4.495z" />
702
- <path
703
- fill="#FBBC05"
704
- d="M12 6.005c1.47 0 2.79.505 3.83 1.495l2.87-2.87C16.96 3.01 14.695 2 12 2a9.996 9.996 0 0 0-8.885 5.505l3.415 2.53c.77-2.31 2.925-4.03 5.47-4.03" />
705
- </svg>
706
- </span>
707
- Google
708
- </button>
709
- <button
710
- type="button"
711
- class="inline-flex h-12 items-center justify-center gap-3 bg-card px-4 text-[0.74rem] font-medium uppercase tracking-[0.16em] text-card-foreground transition-[background-color,color] duration-150 hover:bg-secondary hover:text-destructive">
712
- <span class="inline-flex size-6 shrink-0 items-center justify-center" aria-hidden="true">
713
- <svg viewBox="0 0 24 24" class="size-5" xmlns="http://www.w3.org/2000/svg">
714
- <path fill="#F25022" d="M2 2h9.5v9.5H2z" />
715
- <path fill="#7FBA00" d="M12.5 2H22v9.5h-9.5z" />
716
- <path fill="#00A4EF" d="M2 12.5h9.5V22H2z" />
717
- <path fill="#FFB900" d="M12.5 12.5H22V22h-9.5z" />
718
- </svg>
719
- </span>
720
- Microsoft
721
- </button>
722
- <button
723
- type="button"
724
- class="inline-flex h-12 items-center justify-center gap-3 bg-card px-4 text-[0.74rem] font-medium uppercase tracking-[0.16em] text-card-foreground transition-[background-color,color] duration-150 hover:bg-secondary hover:text-destructive">
725
- <span class="inline-flex size-6 shrink-0 items-center justify-center" aria-hidden="true">
726
- <svg viewBox="0 0 24 24" class="size-5 fill-current" xmlns="http://www.w3.org/2000/svg">
727
- <path
728
- d="M15.482 2c.13 1.25-.31 2.19-.84 2.81-.55.65-1.47 1.15-2.39 1.08-.12-1.21.38-2.17.92-2.79.6-.68 1.61-1.17 2.31-1.1Zm3.94 16.85c-.41.94-.91 1.8-1.54 2.59-.86 1.07-1.57 1.8-2.39 1.8-.59 0-.99-.17-1.44-.36-.47-.2-.95-.4-1.63-.4-.71 0-1.22.2-1.7.4-.46.19-.85.35-1.38.37-.79.03-1.55-.8-2.42-1.87-1.86-2.28-3.3-6.43-1.38-9.77.96-1.66 2.68-2.72 4.55-2.75.71-.01 1.39.21 1.98.41.45.15.86.29 1.19.29.3 0 .73-.15 1.19-.31.68-.23 1.46-.49 2.28-.42 1.14.09 2.17.55 2.98 1.38-2.66 1.45-2.23 5.2.71 6.54Z" />
729
- </svg>
730
- </span>
731
- Apple
732
- </button>
733
- </div>
734
- </div>
735
- </div>
736
- </form>
737
- </div>
738
- `, isInline: true, dependencies: [{ kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
739
- }
740
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.13", ngImport: i0, type: AuthLoginPage, decorators: [{
741
- type: Component,
742
- args: [{
743
- selector: 'edsis-auth-login-page',
744
- imports: [ReactiveFormsModule],
745
- host: {
746
- class: 'block',
747
- },
748
- template: `
749
- <div class="space-y-8">
750
- <header class="space-y-3">
751
- <p class="text-sm font-medium uppercase tracking-[0.24em] text-muted-foreground">Login</p>
752
- <div class="space-y-2">
753
- <h2 class="text-3xl font-semibold tracking-tight">Verifikasi email untuk masuk.</h2>
754
- <p class="max-w-xl text-sm leading-6 text-muted-foreground">
755
- Masukkan email yang terdaftar, silahkan klik link pada email yang diterima untuk masuk ke aplikasi.
756
- </p>
757
- </div>
758
- </header>
759
-
760
- <form class="space-y-5" [formGroup]="form" (ngSubmit)="submit()">
761
- <div class="space-y-2">
762
- <div
763
- class="grid grid-cols-[2.5rem_minmax(0,1fr)_2.5rem] grid-rows-[2rem_auto_2rem_auto] sm:grid-cols-[3rem_minmax(0,1fr)_3rem]">
764
- <div aria-hidden="true" class="relative border-b border-r border-border/70">
765
- <div class="absolute bottom-0 right-0 h-7 w-7 translate-x-1/2 translate-y-1/2">
766
- <div
767
- class="absolute left-1/2 top-1/2 h-4 -translate-x-1/2 -translate-y-1/2 border-l-2 border-primary"></div>
768
- <div
769
- class="absolute left-1/2 top-1/2 w-4 -translate-x-1/2 -translate-y-1/2 border-t-2 border-primary"></div>
770
- </div>
771
- </div>
772
- <div aria-hidden="true" class="border-b border-border/70"></div>
773
- <div aria-hidden="true" class="relative border-b border-l border-border/70">
774
- <div class="absolute bottom-0 left-0 h-7 w-7 -translate-x-1/2 translate-y-1/2">
775
- <div
776
- class="absolute left-1/2 top-1/2 h-4 -translate-x-1/2 -translate-y-1/2 border-l-2 border-primary"></div>
777
- <div
778
- class="absolute left-1/2 top-1/2 w-4 -translate-x-1/2 -translate-y-1/2 border-t-2 border-primary"></div>
779
- </div>
780
- </div>
781
-
782
- <div aria-hidden="true" class="border-r border-border/70"></div>
783
- <div
784
- class="relative z-10 flex items-center gap-4 border bg-card px-6 py-4 shadow-sm transition focus-within:ring-2 focus-within:ring-primary/15 sm:px-8"
785
- [class.border-border]="fieldTone() === 'idle'"
786
- [class.border-destructive]="fieldTone() === 'error'"
787
- [class.border-emerald-500]="fieldTone() === 'success'">
788
- <span aria-hidden="true" class="flex shrink-0 items-center justify-center text-primary">
789
- <svg
790
- viewBox="0 0 24 24"
791
- class="h-6 w-6 fill-none stroke-current"
792
- stroke-width="1.8"
793
- stroke-linecap="round"
794
- stroke-linejoin="round">
795
- <path d="M4 7.5h16" />
796
- <path d="M5 6h14a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1Z" />
797
- <path d="m5 8 7 5 7-5" />
798
- </svg>
799
- </span>
800
-
801
- <input
802
- id="email"
803
- type="email"
804
- inputmode="email"
805
- autocomplete="email"
806
- aria-label="Email"
807
- formControlName="email"
808
- placeholder="your@email.com"
809
- class="min-w-0 grow border-0 bg-transparent text-base font-medium text-foreground outline-none placeholder:font-normal placeholder:text-muted-foreground/80 md:text-lg" />
810
-
811
- <button
812
- type="submit"
813
- [disabled]="form.invalid || isSubmitting()"
814
- class="inline-flex shrink-0 items-center justify-center bg-primary px-4 py-2.5 text-sm font-semibold text-primary-foreground transition hover:opacity-95 focus:outline-none focus:ring-2 focus:ring-primary/20 disabled:cursor-not-allowed disabled:opacity-60">
815
- {{ isSubmitting() ? 'Mengirim...' : 'Kirim' }}
816
- </button>
817
- </div>
818
- <div aria-hidden="true" class="border-l border-border/70"></div>
819
-
820
- <div aria-hidden="true" class="relative border-r border-t border-border/70">
821
- <div class="absolute right-0 top-0 h-7 w-7 translate-x-1/2 -translate-y-1/2">
822
- <div
823
- class="absolute left-1/2 top-1/2 h-4 -translate-x-1/2 -translate-y-1/2 border-l-2 border-primary"></div>
824
- <div
825
- class="absolute left-1/2 top-1/2 w-4 -translate-x-1/2 -translate-y-1/2 border-t-2 border-primary"></div>
826
- </div>
827
- </div>
828
- <div aria-hidden="true" class="border-t border-border/70"></div>
829
- <div aria-hidden="true" class="relative border-l border-t border-border/70">
830
- <div class="absolute left-0 top-0 h-7 w-7 -translate-x-1/2 -translate-y-1/2">
831
- <div
832
- class="absolute left-1/2 top-1/2 h-4 -translate-x-1/2 -translate-y-1/2 border-l-2 border-primary"></div>
833
- <div
834
- class="absolute left-1/2 top-1/2 w-4 -translate-x-1/2 -translate-y-1/2 border-t-2 border-primary"></div>
835
- </div>
836
- </div>
837
-
838
- <div aria-hidden="true" class="border-r border-border/70"></div>
839
- <div class="px-4 pt-4 text-center sm:px-6">
840
- @if (hasInlineError()) {
841
- <p class="text-sm text-destructive">
842
- @if (emailControl.hasError('required')) {
843
- Email wajib diisi.
844
- } @else {
845
- Gunakan format email yang valid dengan panjang maksimal 255 karakter.
846
- }
847
- </p>
848
- } @else if (responseMessage()) {
849
- <p class="text-sm text-emerald-700">
850
- {{ responseMessage() }}
851
- </p>
852
- } @else if (errorMessage()) {
853
- <p class="text-sm text-destructive">
854
- {{ errorMessage() }}
855
- </p>
856
- }
857
- </div>
858
- <div aria-hidden="true" class="border-l border-border/70"></div>
859
- </div>
860
-
861
- <div class="space-y-4 pt-4">
862
- <div
863
- class="flex items-center justify-center text-sm font-medium uppercase tracking-[0.18em] text-muted-foreground">
864
- Atau
865
- </div>
866
-
867
- <div class="flex flex-wrap items-center justify-center gap-3">
868
- <button
869
- type="button"
870
- class="inline-flex h-12 items-center justify-center gap-3 bg-card px-4 text-[0.74rem] font-medium uppercase tracking-[0.16em] text-card-foreground transition-[background-color,color] duration-150 hover:bg-secondary hover:text-destructive">
871
- <span class="inline-flex size-6 shrink-0 items-center justify-center" aria-hidden="true">
872
- <svg viewBox="0 0 24 24" class="size-5" xmlns="http://www.w3.org/2000/svg">
873
- <path
874
- fill="#EA4335"
875
- d="M12.24 10.285v3.965h5.514c-.24 1.285-.96 2.374-2.045 3.105l3.305 2.565c1.925-1.775 3.03-4.39 3.03-7.49 0-.73-.065-1.43-.185-2.145z" />
876
- <path
877
- fill="#34A853"
878
- d="M12 22c2.7 0 4.965-.895 6.62-2.425l-3.305-2.565c-.915.615-2.085.985-3.315.985-2.545 0-4.7-1.72-5.47-4.03H3.115v2.53A9.996 9.996 0 0 0 12 22" />
879
- <path
880
- fill="#4A90E2"
881
- d="M6.53 13.965A5.996 5.996 0 0 1 6.24 12c0-.68.115-1.34.29-1.965v-2.53H3.115A9.996 9.996 0 0 0 2 12c0 1.61.385 3.135 1.115 4.495z" />
882
- <path
883
- fill="#FBBC05"
884
- d="M12 6.005c1.47 0 2.79.505 3.83 1.495l2.87-2.87C16.96 3.01 14.695 2 12 2a9.996 9.996 0 0 0-8.885 5.505l3.415 2.53c.77-2.31 2.925-4.03 5.47-4.03" />
885
- </svg>
886
- </span>
887
- Google
888
- </button>
889
- <button
890
- type="button"
891
- class="inline-flex h-12 items-center justify-center gap-3 bg-card px-4 text-[0.74rem] font-medium uppercase tracking-[0.16em] text-card-foreground transition-[background-color,color] duration-150 hover:bg-secondary hover:text-destructive">
892
- <span class="inline-flex size-6 shrink-0 items-center justify-center" aria-hidden="true">
893
- <svg viewBox="0 0 24 24" class="size-5" xmlns="http://www.w3.org/2000/svg">
894
- <path fill="#F25022" d="M2 2h9.5v9.5H2z" />
895
- <path fill="#7FBA00" d="M12.5 2H22v9.5h-9.5z" />
896
- <path fill="#00A4EF" d="M2 12.5h9.5V22H2z" />
897
- <path fill="#FFB900" d="M12.5 12.5H22V22h-9.5z" />
898
- </svg>
899
- </span>
900
- Microsoft
901
- </button>
902
- <button
903
- type="button"
904
- class="inline-flex h-12 items-center justify-center gap-3 bg-card px-4 text-[0.74rem] font-medium uppercase tracking-[0.16em] text-card-foreground transition-[background-color,color] duration-150 hover:bg-secondary hover:text-destructive">
905
- <span class="inline-flex size-6 shrink-0 items-center justify-center" aria-hidden="true">
906
- <svg viewBox="0 0 24 24" class="size-5 fill-current" xmlns="http://www.w3.org/2000/svg">
907
- <path
908
- d="M15.482 2c.13 1.25-.31 2.19-.84 2.81-.55.65-1.47 1.15-2.39 1.08-.12-1.21.38-2.17.92-2.79.6-.68 1.61-1.17 2.31-1.1Zm3.94 16.85c-.41.94-.91 1.8-1.54 2.59-.86 1.07-1.57 1.8-2.39 1.8-.59 0-.99-.17-1.44-.36-.47-.2-.95-.4-1.63-.4-.71 0-1.22.2-1.7.4-.46.19-.85.35-1.38.37-.79.03-1.55-.8-2.42-1.87-1.86-2.28-3.3-6.43-1.38-9.77.96-1.66 2.68-2.72 4.55-2.75.71-.01 1.39.21 1.98.41.45.15.86.29 1.19.29.3 0 .73-.15 1.19-.31.68-.23 1.46-.49 2.28-.42 1.14.09 2.17.55 2.98 1.38-2.66 1.45-2.23 5.2.71 6.54Z" />
909
- </svg>
910
- </span>
911
- Apple
912
- </button>
913
- </div>
914
- </div>
915
- </div>
916
- </form>
917
- </div>
918
- `,
919
- changeDetection: ChangeDetectionStrategy.OnPush,
920
- }]
921
- }] });
922
-
923
- class AuthLogoutPage {
924
- destroyRef = inject(DestroyRef);
925
- documentRef = inject(DOCUMENT);
926
- router = inject(Router);
927
- authService = inject(AuthService);
928
- authConfig = inject(EDSIS_AUTH_CONFIG);
929
- guestHomePath = this.authConfig.guestHomePath;
930
- authenticatedHomePath = this.authConfig.authenticatedHomePath;
931
- state = signal('pending', ...(ngDevMode ? [{ debugName: "state" }] : /* istanbul ignore next */ []));
932
- message = signal('Mengakhiri sesi...', ...(ngDevMode ? [{ debugName: "message" }] : /* istanbul ignore next */ []));
933
- ngOnInit() {
934
- clearStoredSession(this.documentRef);
935
- this.authService
936
- .logoutAuthSession()
937
- .pipe(takeUntilDestroyed(this.destroyRef), finalize(() => {
938
- if (this.state() === 'pending') {
939
- this.state.set('success');
940
- }
941
- }))
942
- .subscribe({
943
- next: (response) => {
944
- this.state.set('success');
945
- this.message.set(getResponseMessage(response, 'Sesi berhasil diakhiri.'));
946
- void this.router.navigateByUrl(this.guestHomePath, { replaceUrl: true });
947
- },
948
- error: (error) => {
949
- this.state.set('error');
950
- this.message.set(getErrorMessage(error, 'Sesi lokal sudah dihapus, tetapi request logout gagal.'));
951
- },
952
- });
953
- }
954
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.13", ngImport: i0, type: AuthLogoutPage, deps: [], target: i0.ɵɵFactoryTarget.Component });
955
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.13", type: AuthLogoutPage, isStandalone: true, selector: "edsis-auth-logout-page", host: { classAttribute: "block" }, ngImport: i0, template: `
956
- <div class="space-y-6">
957
- <header class="space-y-3">
958
- <p class="text-sm font-medium uppercase tracking-[0.24em] text-muted-foreground">Logout</p>
959
- <h2 class="text-3xl font-semibold tracking-tight">Mengakhiri sesi Edsis.</h2>
960
- <p class="max-w-xl text-sm leading-6 text-muted-foreground">
961
- Halaman ini membersihkan sesi lokal lalu memanggil endpoint logout untuk merevoke refresh-token cookie pada
962
- backend.
963
- </p>
964
- </header>
965
-
966
- <div class="rounded-2xl border border-border bg-background/80 px-5 py-4 text-sm leading-6 text-foreground">
967
- {{ message() }}
968
- </div>
969
-
970
- @if (state() === 'error') {
971
- <div class="rounded-2xl border border-destructive/20 bg-destructive/10 px-4 py-3 text-sm text-destructive">
972
- Backend tidak mengonfirmasi logout, tetapi sesi lokal sudah dihapus.
973
- </div>
974
- }
975
-
976
- <div class="flex flex-wrap gap-3">
977
- <a
978
- [routerLink]="guestHomePath"
979
- class="inline-flex items-center justify-center rounded-2xl bg-primary px-4 py-3 text-sm font-semibold text-background transition hover:opacity-95 focus:outline-none focus:ring-2 focus:ring-primary/20">
980
- Kembali ke login
981
- </a>
982
- <a
983
- [routerLink]="authenticatedHomePath"
984
- class="inline-flex items-center justify-center rounded-2xl border border-border px-4 py-3 text-sm font-semibold text-foreground transition hover:bg-background focus:outline-none focus:ring-2 focus:ring-primary/20">
985
- Buka dashboard
986
- </a>
987
- </div>
988
- </div>
989
- `, isInline: true, dependencies: [{ kind: "directive", type: RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
990
- }
991
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.13", ngImport: i0, type: AuthLogoutPage, decorators: [{
992
- type: Component,
993
- args: [{
994
- selector: 'edsis-auth-logout-page',
995
- imports: [RouterLink],
996
- host: {
997
- class: 'block',
998
- },
999
- template: `
1000
- <div class="space-y-6">
1001
- <header class="space-y-3">
1002
- <p class="text-sm font-medium uppercase tracking-[0.24em] text-muted-foreground">Logout</p>
1003
- <h2 class="text-3xl font-semibold tracking-tight">Mengakhiri sesi Edsis.</h2>
1004
- <p class="max-w-xl text-sm leading-6 text-muted-foreground">
1005
- Halaman ini membersihkan sesi lokal lalu memanggil endpoint logout untuk merevoke refresh-token cookie pada
1006
- backend.
1007
- </p>
1008
- </header>
1009
-
1010
- <div class="rounded-2xl border border-border bg-background/80 px-5 py-4 text-sm leading-6 text-foreground">
1011
- {{ message() }}
1012
- </div>
1013
-
1014
- @if (state() === 'error') {
1015
- <div class="rounded-2xl border border-destructive/20 bg-destructive/10 px-4 py-3 text-sm text-destructive">
1016
- Backend tidak mengonfirmasi logout, tetapi sesi lokal sudah dihapus.
1017
- </div>
1018
- }
1019
-
1020
- <div class="flex flex-wrap gap-3">
1021
- <a
1022
- [routerLink]="guestHomePath"
1023
- class="inline-flex items-center justify-center rounded-2xl bg-primary px-4 py-3 text-sm font-semibold text-background transition hover:opacity-95 focus:outline-none focus:ring-2 focus:ring-primary/20">
1024
- Kembali ke login
1025
- </a>
1026
- <a
1027
- [routerLink]="authenticatedHomePath"
1028
- class="inline-flex items-center justify-center rounded-2xl border border-border px-4 py-3 text-sm font-semibold text-foreground transition hover:bg-background focus:outline-none focus:ring-2 focus:ring-primary/20">
1029
- Buka dashboard
1030
- </a>
1031
- </div>
1032
- </div>
1033
- `,
1034
- changeDetection: ChangeDetectionStrategy.OnPush,
1035
- }]
1036
- }] });
1037
-
1038
- class AuthVerifyPage {
1039
- destroyRef = inject(DestroyRef);
1040
- documentRef = inject(DOCUMENT);
1041
- route = inject(ActivatedRoute);
1042
- router = inject(Router);
1043
- location = inject(Location);
1044
- authService = inject(AuthService);
1045
- authConfig = inject(EDSIS_AUTH_CONFIG);
1046
- guestHomePath = this.authConfig.guestHomePath;
1047
- authenticatedHomePath = this.authConfig.authenticatedHomePath;
1048
- state = signal('pending', ...(ngDevMode ? [{ debugName: "state" }] : /* istanbul ignore next */ []));
1049
- message = signal('Memverifikasi magic link...', ...(ngDevMode ? [{ debugName: "message" }] : /* istanbul ignore next */ []));
1050
- ngOnInit() {
1051
- combineLatest([this.route.queryParamMap, this.route.fragment])
1052
- .pipe(takeUntilDestroyed(this.destroyRef))
1053
- .subscribe(([queryParamMap, fragment]) => {
1054
- const token = extractMagicToken(queryParamMap.get('token'), fragment);
1055
- this.clearTokenFromAddressBar();
1056
- if (!token) {
1057
- this.state.set('error');
1058
- this.message.set('Token magic link tidak ditemukan pada URL yang dibuka.');
1059
- return;
1060
- }
1061
- this.verify(token);
1062
- });
1063
- }
1064
- clearTokenFromAddressBar() {
1065
- this.location.replaceState(this.authConfig.verifyPath);
1066
- }
1067
- verify(token) {
1068
- this.authService
1069
- .verifyMagicLink({
1070
- body: {
1071
- token,
1072
- device_type: 'web',
1073
- },
1074
- })
1075
- .pipe(takeUntilDestroyed(this.destroyRef))
1076
- .subscribe({
1077
- next: (response) => {
1078
- const session = persistSession(this.documentRef, response.data);
1079
- if (!session) {
1080
- this.state.set('error');
1081
- this.message.set('Verifikasi berhasil, tetapi access token tidak ditemukan di respons backend.');
1082
- return;
1083
- }
1084
- this.state.set('success');
1085
- this.message.set(getResponseMessage(response, 'Verifikasi berhasil. Mengarahkan ke dashboard...'));
1086
- void this.router.navigateByUrl(this.authenticatedHomePath, { replaceUrl: true });
1087
- },
1088
- error: (error) => {
1089
- this.state.set('error');
1090
- this.message.set(getErrorMessage(error, 'Magic link tidak valid atau sudah kedaluwarsa.'));
1091
- },
1092
- });
1093
- }
1094
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.13", ngImport: i0, type: AuthVerifyPage, deps: [], target: i0.ɵɵFactoryTarget.Component });
1095
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.13", type: AuthVerifyPage, isStandalone: true, selector: "edsis-auth-verify-page", host: { classAttribute: "block" }, ngImport: i0, template: `
1096
- <div class="space-y-6">
1097
- <header class="space-y-3">
1098
- <p class="text-sm font-medium uppercase tracking-[0.24em] text-muted-foreground">Verify</p>
1099
- <h2 class="text-3xl font-semibold tracking-tight">Memverifikasi magic link.</h2>
1100
- <p class="max-w-xl text-sm leading-6 text-muted-foreground">
1101
- Token akan dikonsumsi satu kali, sesi refresh cookie dibentuk di backend, lalu access token disimpan secara
1102
- lokal untuk aplikasi.
1103
- </p>
1104
- </header>
1105
-
1106
- <div class="rounded-2xl border border-border bg-background/80 px-5 py-4 text-sm leading-6 text-foreground">
1107
- {{ message() }}
1108
- </div>
1109
-
1110
- @if (state() === 'error') {
1111
- <div class="rounded-2xl border border-destructive/20 bg-destructive/10 px-4 py-3 text-sm text-destructive">
1112
- Pastikan Anda membuka link terbaru dari email dan token belum pernah dipakai sebelumnya.
1113
- </div>
1114
- }
1115
-
1116
- <div class="flex flex-wrap gap-3">
1117
- <a
1118
- [routerLink]="guestHomePath"
1119
- class="inline-flex items-center justify-center rounded-2xl border border-border px-4 py-3 text-sm font-semibold text-foreground transition hover:bg-background focus:outline-none focus:ring-2 focus:ring-primary/20">
1120
- Minta link baru
1121
- </a>
1122
- <a
1123
- [routerLink]="authenticatedHomePath"
1124
- class="inline-flex items-center justify-center rounded-2xl bg-primary px-4 py-3 text-sm font-semibold text-background transition hover:opacity-95 focus:outline-none focus:ring-2 focus:ring-primary/20">
1125
- Buka dashboard
1126
- </a>
1127
- </div>
1128
- </div>
1129
- `, isInline: true, dependencies: [{ kind: "directive", type: RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1130
- }
1131
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.13", ngImport: i0, type: AuthVerifyPage, decorators: [{
1132
- type: Component,
1133
- args: [{
1134
- selector: 'edsis-auth-verify-page',
1135
- imports: [RouterLink],
1136
- host: {
1137
- class: 'block',
1138
- },
1139
- template: `
1140
- <div class="space-y-6">
1141
- <header class="space-y-3">
1142
- <p class="text-sm font-medium uppercase tracking-[0.24em] text-muted-foreground">Verify</p>
1143
- <h2 class="text-3xl font-semibold tracking-tight">Memverifikasi magic link.</h2>
1144
- <p class="max-w-xl text-sm leading-6 text-muted-foreground">
1145
- Token akan dikonsumsi satu kali, sesi refresh cookie dibentuk di backend, lalu access token disimpan secara
1146
- lokal untuk aplikasi.
1147
- </p>
1148
- </header>
1149
-
1150
- <div class="rounded-2xl border border-border bg-background/80 px-5 py-4 text-sm leading-6 text-foreground">
1151
- {{ message() }}
1152
- </div>
1153
-
1154
- @if (state() === 'error') {
1155
- <div class="rounded-2xl border border-destructive/20 bg-destructive/10 px-4 py-3 text-sm text-destructive">
1156
- Pastikan Anda membuka link terbaru dari email dan token belum pernah dipakai sebelumnya.
1157
- </div>
1158
- }
1159
-
1160
- <div class="flex flex-wrap gap-3">
1161
- <a
1162
- [routerLink]="guestHomePath"
1163
- class="inline-flex items-center justify-center rounded-2xl border border-border px-4 py-3 text-sm font-semibold text-foreground transition hover:bg-background focus:outline-none focus:ring-2 focus:ring-primary/20">
1164
- Minta link baru
1165
- </a>
1166
- <a
1167
- [routerLink]="authenticatedHomePath"
1168
- class="inline-flex items-center justify-center rounded-2xl bg-primary px-4 py-3 text-sm font-semibold text-background transition hover:opacity-95 focus:outline-none focus:ring-2 focus:ring-primary/20">
1169
- Buka dashboard
1170
- </a>
1171
- </div>
1172
- </div>
1173
- `,
1174
- changeDetection: ChangeDetectionStrategy.OnPush,
1175
- }]
1176
- }] });
1177
-
1178
- const authRoutes = [
1179
- {
1180
- path: '',
1181
- component: AuthShellPage,
1182
- children: [
1183
- {
1184
- path: 'login',
1185
- title: 'Login',
1186
- canActivate: [guestOnlyGuard],
1187
- component: AuthLoginPage,
1188
- },
1189
- {
1190
- path: 'logout',
1191
- title: 'Logout',
1192
- component: AuthLogoutPage,
1193
- },
1194
- {
1195
- path: 'verify',
1196
- title: 'Verify',
1197
- canActivate: [guestOnlyGuard],
1198
- component: AuthVerifyPage,
1199
- },
1200
- ],
1201
- },
1202
- ];
1203
-
1204
- /**
1205
- * Generated bundle index. Do not edit.
1206
- */
1207
-
1208
- export { AuthLoginPage, AuthLogoutPage, AuthShellPage, AuthVerifyPage, EDSIS_AUTH_CONFIG, EDSIS_SKIP_AUTH, authRoutes, authenticatedGuard, clearStoredSession, edsisAuthInterceptor, guestOnlyGuard, hasStoredSession, homeRedirectGuard, injectSessionClear, injectSessionRefresh, injectSessionState, persistSession, provideEdsisAuth, readStoredAccessToken, readStoredSession, resolveEdsisAuthConfig, validateStoredSession };
1209
- //# sourceMappingURL=edsis-angular-auth.mjs.map