@edsis/angular 21.1.3 → 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 -1210
  119. package/fesm2022/edsis-angular-auth.mjs.map +0 -1
  120. package/fesm2022/edsis-angular-sdk-access.mjs +0 -1365
  121. package/fesm2022/edsis-angular-sdk-access.mjs.map +0 -1
  122. package/fesm2022/edsis-angular-sdk-approval.mjs +0 -1259
  123. package/fesm2022/edsis-angular-sdk-approval.mjs.map +0 -1
  124. package/fesm2022/edsis-angular-sdk-auth.mjs +0 -254
  125. package/fesm2022/edsis-angular-sdk-auth.mjs.map +0 -1
  126. package/fesm2022/edsis-angular-sdk-employee.mjs +0 -284
  127. package/fesm2022/edsis-angular-sdk-employee.mjs.map +0 -1
  128. package/fesm2022/edsis-angular-sdk-health.mjs +0 -96
  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 -288
  133. package/fesm2022/edsis-angular-sdk-storage.mjs.map +0 -1
  134. package/fesm2022/edsis-angular-sdk-user.mjs +0 -489
  135. package/fesm2022/edsis-angular-sdk-user.mjs.map +0 -1
  136. package/fesm2022/edsis-angular-sdk.mjs +0 -75
  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 -120
  141. package/types/edsis-angular-sdk-access.d.ts +0 -547
  142. package/types/edsis-angular-sdk-approval.d.ts +0 -638
  143. package/types/edsis-angular-sdk-auth.d.ts +0 -128
  144. package/types/edsis-angular-sdk-employee.d.ts +0 -159
  145. package/types/edsis-angular-sdk-health.d.ts +0 -35
  146. package/types/edsis-angular-sdk-shared.d.ts +0 -176
  147. package/types/edsis-angular-sdk-storage.d.ts +0 -102
  148. package/types/edsis-angular-sdk-user.d.ts +0 -189
  149. package/types/edsis-angular-sdk.d.ts +0 -26
  150. package/types/edsis-angular.d.ts +0 -2
@@ -1,1210 +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'];
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
- return {
140
- accessToken,
141
- userId: userId || undefined,
142
- role: role || undefined,
143
- };
144
- }
145
- function persistSession(documentRef, sessionData) {
146
- const sessionStorageRef = getSessionStorage(documentRef);
147
- if (!sessionStorageRef) {
148
- clearValidatedSession();
149
- return null;
150
- }
151
- for (const storageKey of AUTH_SESSION_STORAGE_KEYS) {
152
- const nextValue = readSessionDataValue(sessionData, storageKey);
153
- if (nextValue) {
154
- sessionStorageRef.setItem(storageKey, nextValue);
155
- continue;
156
- }
157
- sessionStorageRef.removeItem(storageKey);
158
- }
159
- markValidatedSession(documentRef);
160
- clearFailedSessionFingerprint();
161
- return readStoredSession(documentRef);
162
- }
163
- function clearStoredSession(documentRef, options) {
164
- const sessionStorageRef = getSessionStorage(documentRef);
165
- for (const storageKey of AUTH_SESSION_STORAGE_KEYS) {
166
- sessionStorageRef?.removeItem(storageKey);
167
- }
168
- clearValidatedSession();
169
- if (!options?.preserveFailedSessionFingerprint) {
170
- clearFailedSessionFingerprint();
171
- }
172
- }
173
- async function validateStoredSession(documentRef, authService, options) {
174
- if (!options?.forceRefresh && hasValidatedSession(documentRef)) {
175
- return true;
176
- }
177
- if (hasFailedSessionFingerprint(documentRef)) {
178
- return false;
179
- }
180
- if (pendingSessionValidation) {
181
- return pendingSessionValidation;
182
- }
183
- pendingSessionValidation = (async () => {
184
- try {
185
- const response = await firstValueFrom(authService.refreshAuthToken());
186
- persistSession(documentRef, response.data);
187
- return hasValidatedSession(documentRef);
188
- }
189
- catch {
190
- clearStoredSession(documentRef, { preserveFailedSessionFingerprint: true });
191
- markFailedSessionFingerprint(documentRef);
192
- return false;
193
- }
194
- finally {
195
- pendingSessionValidation = null;
196
- }
197
- })();
198
- return pendingSessionValidation;
199
- }
200
- function injectSessionState() {
201
- const documentRef = inject(DOCUMENT);
202
- const authService = inject(AuthService);
203
- return validateStoredSession(documentRef, authService);
204
- }
205
- function injectSessionRefresh() {
206
- const documentRef = inject(DOCUMENT);
207
- const authService = inject(AuthService);
208
- return validateStoredSession(documentRef, authService, { forceRefresh: true });
209
- }
210
- function injectSessionClear() {
211
- clearStoredSession(inject(DOCUMENT));
212
- }
213
-
214
- const PROTECTED_API_PATH_PREFIX = '/v1/';
215
- const AUTH_PATH_PREFIX = '/v1/auth/';
216
- const HEALTH_PATH = '/health';
217
- const EDSIS_SKIP_AUTH = new HttpContextToken(() => false);
218
- const EDSIS_AUTH_RETRY = new HttpContextToken(() => false);
219
- function normalizeUrl(url) {
220
- try {
221
- return new URL(url);
222
- }
223
- catch {
224
- return null;
225
- }
226
- }
227
- function resolveApiPath(url, rootUrl) {
228
- const normalizedUrl = normalizeUrl(url);
229
- const normalizedRootUrl = normalizeUrl(rootUrl);
230
- if (normalizedUrl && normalizedRootUrl) {
231
- if (normalizedUrl.origin !== normalizedRootUrl.origin) {
232
- return null;
233
- }
234
- if (!normalizedUrl.pathname.startsWith(normalizedRootUrl.pathname)) {
235
- return null;
236
- }
237
- const apiPath = normalizedUrl.pathname.slice(normalizedRootUrl.pathname.length) || '/';
238
- return apiPath.startsWith('/') ? apiPath : `/${apiPath}`;
239
- }
240
- if (url.startsWith(rootUrl)) {
241
- const apiPath = url.slice(rootUrl.length).split(/[?#]/, 1)[0] ?? '/';
242
- return apiPath.startsWith('/') ? apiPath : `/${apiPath}`;
243
- }
244
- if (url.startsWith('/')) {
245
- return url.split(/[?#]/, 1)[0] ?? url;
246
- }
247
- return null;
248
- }
249
- function isAuthRequest(apiPath) {
250
- return apiPath.startsWith(AUTH_PATH_PREFIX);
251
- }
252
- function isProtectedApiRequest(apiPath) {
253
- return apiPath.startsWith(PROTECTED_API_PATH_PREFIX) && !isAuthRequest(apiPath);
254
- }
255
- function isHealthRequest(apiPath) {
256
- return apiPath === HEALTH_PATH;
257
- }
258
- function isHandledRequest(apiPath) {
259
- return isProtectedApiRequest(apiPath) || isAuthRequest(apiPath) || isHealthRequest(apiPath);
260
- }
261
- function applyCookieCredentials(request, apiPath) {
262
- return isAuthRequest(apiPath) && !request.withCredentials ? request.clone({ withCredentials: true }) : request;
263
- }
264
- function applyBearerToken(request, accessToken, isRetry = false) {
265
- return request.clone({
266
- context: isRetry ? request.context.set(EDSIS_AUTH_RETRY, true) : request.context,
267
- setHeaders: {
268
- Authorization: `Bearer ${accessToken}`,
269
- },
270
- });
271
- }
272
- async function resolveAccessToken(documentRef, authService, options) {
273
- const isSessionValid = await validateStoredSession(documentRef, authService, options);
274
- return isSessionValid ? readStoredAccessToken(documentRef) : '';
275
- }
276
- function handleUnauthorizedError(error, request, next, documentRef, authService) {
277
- if (!(error instanceof HttpErrorResponse) || error.status !== 401 || request.context.get(EDSIS_AUTH_RETRY)) {
278
- return throwError(() => error);
279
- }
280
- return from(resolveAccessToken(documentRef, authService, { forceRefresh: true })).pipe(switchMap((refreshedAccessToken) => {
281
- if (!refreshedAccessToken) {
282
- clearStoredSession(documentRef);
283
- return throwError(() => error);
284
- }
285
- return next(applyBearerToken(request, refreshedAccessToken, true));
286
- }), catchError(() => {
287
- clearStoredSession(documentRef);
288
- return throwError(() => error);
289
- }));
290
- }
291
- const edsisAuthInterceptor = (request, next) => {
292
- const documentRef = inject(DOCUMENT);
293
- const apiConfiguration = inject(ApiConfiguration);
294
- const authService = inject(AuthService);
295
- if (request.context.get(EDSIS_SKIP_AUTH)) {
296
- return next(request);
297
- }
298
- const apiPath = resolveApiPath(request.url, apiConfiguration.rootUrl);
299
- if (!apiPath || !isHandledRequest(apiPath)) {
300
- return next(request);
301
- }
302
- const preparedRequest = applyCookieCredentials(request, apiPath);
303
- if (isAuthRequest(apiPath) || isHealthRequest(apiPath)) {
304
- return next(preparedRequest);
305
- }
306
- return from(resolveAccessToken(documentRef, authService)).pipe(switchMap((accessToken) => {
307
- const authorizedRequest = accessToken ? applyBearerToken(preparedRequest, accessToken) : preparedRequest;
308
- return next(authorizedRequest).pipe(catchError((error) => handleUnauthorizedError(error, preparedRequest, next, documentRef, authService)));
309
- }));
310
- };
311
-
312
- function provideEdsisAuth(config) {
313
- const resolvedConfig = resolveEdsisAuthConfig(config);
314
- return makeEnvironmentProviders([
315
- provideApiConfiguration(resolvedConfig.apiUrl),
316
- provideHttpClient(withFetch(), withInterceptors([edsisAuthInterceptor])),
317
- {
318
- provide: EDSIS_AUTH_CONFIG,
319
- useValue: resolvedConfig,
320
- },
321
- ]);
322
- }
323
-
324
- const authenticatedGuard = async () => {
325
- const router = inject(Router);
326
- const authConfig = inject(EDSIS_AUTH_CONFIG);
327
- if (await injectSessionState()) {
328
- return true;
329
- }
330
- return router.parseUrl(authConfig.guestHomePath);
331
- };
332
- const homeRedirectGuard = async () => {
333
- const router = inject(Router);
334
- const authConfig = inject(EDSIS_AUTH_CONFIG);
335
- return router.parseUrl((await injectSessionState()) ? authConfig.authenticatedHomePath : authConfig.guestHomePath);
336
- };
337
- const guestOnlyGuard = async () => {
338
- const router = inject(Router);
339
- const authConfig = inject(EDSIS_AUTH_CONFIG);
340
- if (!(await injectSessionState())) {
341
- return true;
342
- }
343
- return router.parseUrl(authConfig.authenticatedHomePath);
344
- };
345
-
346
- class AuthShellPage {
347
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.10", ngImport: i0, type: AuthShellPage, deps: [], target: i0.ɵɵFactoryTarget.Component });
348
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.10", type: AuthShellPage, isStandalone: true, selector: "edsis-auth-shell-page", host: { classAttribute: "block min-h-screen bg-background text-foreground" }, ngImport: i0, template: `
349
- <section
350
- class="relative isolate flex min-h-screen items-center justify-center overflow-hidden px-4 py-10 sm:px-6 lg:px-8">
351
- <div
352
- aria-hidden="true"
353
- 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>
354
-
355
- <div
356
- aria-hidden="true"
357
- 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>
358
-
359
- <div class="relative flex w-full max-w-xl justify-center">
360
- <div aria-hidden="true" class="pointer-events-none absolute inset-0 z-20">
361
- <div class="absolute left-1/2 top-0 w-screen -translate-x-1/2 border-t border-border/70"></div>
362
- <div class="absolute left-1/2 bottom-0 w-screen -translate-x-1/2 border-t border-border/70"></div>
363
- <div class="absolute left-0 top-1/2 h-screen -translate-y-1/2 border-l border-border/70"></div>
364
- <div class="absolute right-0 top-1/2 h-screen -translate-y-1/2 border-l border-border/70"></div>
365
-
366
- <div class="absolute left-0 top-0 h-8 w-8 -translate-x-1/2 -translate-y-1/2">
367
- <div
368
- class="absolute left-1/2 top-1/2 h-5 -translate-x-1/2 -translate-y-1/2 border-l-2 border-primary"></div>
369
- <div
370
- class="absolute left-1/2 top-1/2 w-5 -translate-x-1/2 -translate-y-1/2 border-t-2 border-primary"></div>
371
- </div>
372
- <div class="absolute right-0 top-0 h-8 w-8 translate-x-1/2 -translate-y-1/2">
373
- <div
374
- class="absolute left-1/2 top-1/2 h-5 -translate-x-1/2 -translate-y-1/2 border-l-2 border-primary"></div>
375
- <div
376
- class="absolute left-1/2 top-1/2 w-5 -translate-x-1/2 -translate-y-1/2 border-t-2 border-primary"></div>
377
- </div>
378
- <div class="absolute left-0 bottom-0 h-8 w-8 -translate-x-1/2 translate-y-1/2">
379
- <div
380
- class="absolute left-1/2 top-1/2 h-5 -translate-x-1/2 -translate-y-1/2 border-l-2 border-primary"></div>
381
- <div
382
- class="absolute left-1/2 top-1/2 w-5 -translate-x-1/2 -translate-y-1/2 border-t-2 border-primary"></div>
383
- </div>
384
- <div class="absolute right-0 bottom-0 h-8 w-8 translate-x-1/2 translate-y-1/2">
385
- <div
386
- class="absolute left-1/2 top-1/2 h-5 -translate-x-1/2 -translate-y-1/2 border-l-2 border-primary"></div>
387
- <div
388
- class="absolute left-1/2 top-1/2 w-5 -translate-x-1/2 -translate-y-1/2 border-t-2 border-primary"></div>
389
- </div>
390
- </div>
391
-
392
- <div class="relative z-10 w-full border border-border/80 bg-card/95 p-6 shadow-2xl backdrop-blur sm:p-8">
393
- <router-outlet />
394
- </div>
395
- </div>
396
- </section>
397
- `, isInline: true, dependencies: [{ kind: "directive", type: RouterOutlet, selector: "router-outlet", inputs: ["name", "routerOutletData"], outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
398
- }
399
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.10", ngImport: i0, type: AuthShellPage, decorators: [{
400
- type: Component,
401
- args: [{
402
- selector: 'edsis-auth-shell-page',
403
- imports: [RouterOutlet],
404
- host: {
405
- class: 'block min-h-screen bg-background text-foreground',
406
- },
407
- template: `
408
- <section
409
- class="relative isolate flex min-h-screen items-center justify-center overflow-hidden px-4 py-10 sm:px-6 lg:px-8">
410
- <div
411
- aria-hidden="true"
412
- 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>
413
-
414
- <div
415
- aria-hidden="true"
416
- 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>
417
-
418
- <div class="relative flex w-full max-w-xl justify-center">
419
- <div aria-hidden="true" class="pointer-events-none absolute inset-0 z-20">
420
- <div class="absolute left-1/2 top-0 w-screen -translate-x-1/2 border-t border-border/70"></div>
421
- <div class="absolute left-1/2 bottom-0 w-screen -translate-x-1/2 border-t border-border/70"></div>
422
- <div class="absolute left-0 top-1/2 h-screen -translate-y-1/2 border-l border-border/70"></div>
423
- <div class="absolute right-0 top-1/2 h-screen -translate-y-1/2 border-l border-border/70"></div>
424
-
425
- <div class="absolute left-0 top-0 h-8 w-8 -translate-x-1/2 -translate-y-1/2">
426
- <div
427
- class="absolute left-1/2 top-1/2 h-5 -translate-x-1/2 -translate-y-1/2 border-l-2 border-primary"></div>
428
- <div
429
- class="absolute left-1/2 top-1/2 w-5 -translate-x-1/2 -translate-y-1/2 border-t-2 border-primary"></div>
430
- </div>
431
- <div class="absolute right-0 top-0 h-8 w-8 translate-x-1/2 -translate-y-1/2">
432
- <div
433
- class="absolute left-1/2 top-1/2 h-5 -translate-x-1/2 -translate-y-1/2 border-l-2 border-primary"></div>
434
- <div
435
- class="absolute left-1/2 top-1/2 w-5 -translate-x-1/2 -translate-y-1/2 border-t-2 border-primary"></div>
436
- </div>
437
- <div class="absolute left-0 bottom-0 h-8 w-8 -translate-x-1/2 translate-y-1/2">
438
- <div
439
- class="absolute left-1/2 top-1/2 h-5 -translate-x-1/2 -translate-y-1/2 border-l-2 border-primary"></div>
440
- <div
441
- class="absolute left-1/2 top-1/2 w-5 -translate-x-1/2 -translate-y-1/2 border-t-2 border-primary"></div>
442
- </div>
443
- <div class="absolute right-0 bottom-0 h-8 w-8 translate-x-1/2 translate-y-1/2">
444
- <div
445
- class="absolute left-1/2 top-1/2 h-5 -translate-x-1/2 -translate-y-1/2 border-l-2 border-primary"></div>
446
- <div
447
- class="absolute left-1/2 top-1/2 w-5 -translate-x-1/2 -translate-y-1/2 border-t-2 border-primary"></div>
448
- </div>
449
- </div>
450
-
451
- <div class="relative z-10 w-full border border-border/80 bg-card/95 p-6 shadow-2xl backdrop-blur sm:p-8">
452
- <router-outlet />
453
- </div>
454
- </div>
455
- </section>
456
- `,
457
- changeDetection: ChangeDetectionStrategy.OnPush,
458
- }]
459
- }] });
460
-
461
- function buildVerifyUrl(config) {
462
- const baseUrl = typeof window !== 'undefined' && window.location.origin ? window.location.origin : config.appUrl;
463
- return new URL(config.verifyPath, `${baseUrl}/`).toString();
464
- }
465
- function extractMagicToken(queryToken, fragment) {
466
- const tokenFromQuery = normalizeText(queryToken);
467
- if (tokenFromQuery) {
468
- return tokenFromQuery;
469
- }
470
- const normalizedFragment = normalizeText(fragment?.startsWith('#') ? fragment.slice(1) : fragment);
471
- if (!normalizedFragment) {
472
- return null;
473
- }
474
- const fragmentParams = new URLSearchParams(normalizedFragment);
475
- const tokenFromFragment = normalizeText(fragmentParams.get('token')) ??
476
- normalizeText(fragmentParams.get('magic_token')) ??
477
- normalizeText(fragmentParams.get('value'));
478
- if (tokenFromFragment) {
479
- return tokenFromFragment;
480
- }
481
- return normalizedFragment.includes('=') ? null : normalizedFragment;
482
- }
483
- function getResponseMessage(response, fallback) {
484
- if (!hasMessage(response)) {
485
- return fallback;
486
- }
487
- return normalizeText(response.message) ?? fallback;
488
- }
489
- function getErrorMessage(error, fallback) {
490
- if (error instanceof HttpErrorResponse) {
491
- const errorBody = error.error;
492
- if (typeof errorBody === 'string') {
493
- return normalizeText(errorBody) ?? fallback;
494
- }
495
- if (hasMessage(errorBody)) {
496
- return normalizeText(errorBody.message) ?? fallback;
497
- }
498
- return normalizeText(error.message) ?? fallback;
499
- }
500
- if (error instanceof Error) {
501
- return normalizeText(error.message) ?? fallback;
502
- }
503
- return fallback;
504
- }
505
- function hasMessage(value) {
506
- return typeof value === 'object' && value !== null && 'message' in value;
507
- }
508
- function normalizeText(value) {
509
- if (typeof value !== 'string') {
510
- return null;
511
- }
512
- const normalizedValue = value.trim();
513
- return normalizedValue.length > 0 ? normalizedValue : null;
514
- }
515
-
516
- class AuthLoginPage {
517
- destroyRef = inject(DestroyRef);
518
- formBuilder = inject(FormBuilder);
519
- authService = inject(AuthService);
520
- authConfig = inject(EDSIS_AUTH_CONFIG);
521
- form = this.formBuilder.nonNullable.group({
522
- email: ['', [Validators.required, Validators.email, Validators.maxLength(255)]],
523
- });
524
- isSubmitting = signal(false, ...(ngDevMode ? [{ debugName: "isSubmitting" }] : /* istanbul ignore next */ []));
525
- responseMessage = signal(null, ...(ngDevMode ? [{ debugName: "responseMessage" }] : /* istanbul ignore next */ []));
526
- errorMessage = signal(null, ...(ngDevMode ? [{ debugName: "errorMessage" }] : /* istanbul ignore next */ []));
527
- verifyUrl = buildVerifyUrl(this.authConfig);
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
- .resendMagicLink({
553
- body: {
554
- email,
555
- frontend_url: this.verifyUrl,
556
- },
557
- })
558
- .pipe(takeUntilDestroyed(this.destroyRef), finalize(() => this.isSubmitting.set(false)))
559
- .subscribe({
560
- next: (response) => {
561
- this.responseMessage.set(getResponseMessage(response, 'Magic link berhasil dikirim ulang.'));
562
- },
563
- error: (error) => {
564
- this.errorMessage.set(getErrorMessage(error, 'Gagal mengirim magic link.'));
565
- },
566
- });
567
- }
568
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.10", ngImport: i0, type: AuthLoginPage, deps: [], target: i0.ɵɵFactoryTarget.Component });
569
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.10", type: AuthLoginPage, isStandalone: true, selector: "edsis-auth-login-page", host: { classAttribute: "block" }, ngImport: i0, template: `
570
- <div class="space-y-8">
571
- <header class="space-y-3">
572
- <p class="text-sm font-medium uppercase tracking-[0.24em] text-muted-foreground">Login</p>
573
- <div class="space-y-2">
574
- <h2 class="text-3xl font-semibold tracking-tight">Verifikasi email untuk masuk.</h2>
575
- <p class="max-w-xl text-sm leading-6 text-muted-foreground">
576
- Masukkan email yang terdaftar, silahkan klik link pada email yang diterima untuk masuk ke aplikasi.
577
- </p>
578
- </div>
579
- </header>
580
-
581
- <form class="space-y-5" [formGroup]="form" (ngSubmit)="submit()">
582
- <div class="space-y-2">
583
- <div
584
- 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]">
585
- <div aria-hidden="true" class="relative border-b border-r border-border/70">
586
- <div class="absolute bottom-0 right-0 h-7 w-7 translate-x-1/2 translate-y-1/2">
587
- <div
588
- class="absolute left-1/2 top-1/2 h-4 -translate-x-1/2 -translate-y-1/2 border-l-2 border-primary"></div>
589
- <div
590
- class="absolute left-1/2 top-1/2 w-4 -translate-x-1/2 -translate-y-1/2 border-t-2 border-primary"></div>
591
- </div>
592
- </div>
593
- <div aria-hidden="true" class="border-b border-border/70"></div>
594
- <div aria-hidden="true" class="relative border-b border-l border-border/70">
595
- <div class="absolute bottom-0 left-0 h-7 w-7 -translate-x-1/2 translate-y-1/2">
596
- <div
597
- class="absolute left-1/2 top-1/2 h-4 -translate-x-1/2 -translate-y-1/2 border-l-2 border-primary"></div>
598
- <div
599
- class="absolute left-1/2 top-1/2 w-4 -translate-x-1/2 -translate-y-1/2 border-t-2 border-primary"></div>
600
- </div>
601
- </div>
602
-
603
- <div aria-hidden="true" class="border-r border-border/70"></div>
604
- <div
605
- 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"
606
- [class.border-border]="fieldTone() === 'idle'"
607
- [class.border-destructive]="fieldTone() === 'error'"
608
- [class.border-emerald-500]="fieldTone() === 'success'">
609
- <span aria-hidden="true" class="flex shrink-0 items-center justify-center text-primary">
610
- <svg
611
- viewBox="0 0 24 24"
612
- class="h-6 w-6 fill-none stroke-current"
613
- stroke-width="1.8"
614
- stroke-linecap="round"
615
- stroke-linejoin="round">
616
- <path d="M4 7.5h16" />
617
- <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" />
618
- <path d="m5 8 7 5 7-5" />
619
- </svg>
620
- </span>
621
-
622
- <input
623
- id="email"
624
- type="email"
625
- inputmode="email"
626
- autocomplete="email"
627
- aria-label="Email"
628
- formControlName="email"
629
- placeholder="your@email.com"
630
- 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" />
631
-
632
- <button
633
- type="submit"
634
- [disabled]="form.invalid || isSubmitting()"
635
- 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">
636
- {{ isSubmitting() ? 'Mengirim...' : 'Kirim' }}
637
- </button>
638
- </div>
639
- <div aria-hidden="true" class="border-l border-border/70"></div>
640
-
641
- <div aria-hidden="true" class="relative border-r border-t border-border/70">
642
- <div class="absolute right-0 top-0 h-7 w-7 translate-x-1/2 -translate-y-1/2">
643
- <div
644
- class="absolute left-1/2 top-1/2 h-4 -translate-x-1/2 -translate-y-1/2 border-l-2 border-primary"></div>
645
- <div
646
- class="absolute left-1/2 top-1/2 w-4 -translate-x-1/2 -translate-y-1/2 border-t-2 border-primary"></div>
647
- </div>
648
- </div>
649
- <div aria-hidden="true" class="border-t border-border/70"></div>
650
- <div aria-hidden="true" class="relative border-l border-t border-border/70">
651
- <div class="absolute left-0 top-0 h-7 w-7 -translate-x-1/2 -translate-y-1/2">
652
- <div
653
- class="absolute left-1/2 top-1/2 h-4 -translate-x-1/2 -translate-y-1/2 border-l-2 border-primary"></div>
654
- <div
655
- class="absolute left-1/2 top-1/2 w-4 -translate-x-1/2 -translate-y-1/2 border-t-2 border-primary"></div>
656
- </div>
657
- </div>
658
-
659
- <div aria-hidden="true" class="border-r border-border/70"></div>
660
- <div class="px-4 pt-4 text-center sm:px-6">
661
- @if (hasInlineError()) {
662
- <p class="text-sm text-destructive">
663
- @if (emailControl.hasError('required')) {
664
- Email wajib diisi.
665
- } @else {
666
- Gunakan format email yang valid dengan panjang maksimal 255 karakter.
667
- }
668
- </p>
669
- } @else if (responseMessage()) {
670
- <p class="text-sm text-emerald-700">
671
- {{ responseMessage() }}
672
- </p>
673
- } @else if (errorMessage()) {
674
- <p class="text-sm text-destructive">
675
- {{ errorMessage() }}
676
- </p>
677
- }
678
- </div>
679
- <div aria-hidden="true" class="border-l border-border/70"></div>
680
- </div>
681
-
682
- <div class="space-y-4 pt-4">
683
- <div
684
- class="flex items-center justify-center text-sm font-medium uppercase tracking-[0.18em] text-muted-foreground">
685
- Atau
686
- </div>
687
-
688
- <div class="flex flex-wrap items-center justify-center gap-3">
689
- <button
690
- type="button"
691
- 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">
692
- <span class="inline-flex size-6 shrink-0 items-center justify-center" aria-hidden="true">
693
- <svg viewBox="0 0 24 24" class="size-5" xmlns="http://www.w3.org/2000/svg">
694
- <path
695
- fill="#EA4335"
696
- 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" />
697
- <path
698
- fill="#34A853"
699
- 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" />
700
- <path
701
- fill="#4A90E2"
702
- 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" />
703
- <path
704
- fill="#FBBC05"
705
- 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" />
706
- </svg>
707
- </span>
708
- Google
709
- </button>
710
- <button
711
- type="button"
712
- 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">
713
- <span class="inline-flex size-6 shrink-0 items-center justify-center" aria-hidden="true">
714
- <svg viewBox="0 0 24 24" class="size-5" xmlns="http://www.w3.org/2000/svg">
715
- <path fill="#F25022" d="M2 2h9.5v9.5H2z" />
716
- <path fill="#7FBA00" d="M12.5 2H22v9.5h-9.5z" />
717
- <path fill="#00A4EF" d="M2 12.5h9.5V22H2z" />
718
- <path fill="#FFB900" d="M12.5 12.5H22V22h-9.5z" />
719
- </svg>
720
- </span>
721
- Microsoft
722
- </button>
723
- <button
724
- type="button"
725
- 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">
726
- <span class="inline-flex size-6 shrink-0 items-center justify-center" aria-hidden="true">
727
- <svg viewBox="0 0 24 24" class="size-5 fill-current" xmlns="http://www.w3.org/2000/svg">
728
- <path
729
- 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" />
730
- </svg>
731
- </span>
732
- Apple
733
- </button>
734
- </div>
735
- </div>
736
- </div>
737
- </form>
738
- </div>
739
- `, 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 });
740
- }
741
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.10", ngImport: i0, type: AuthLoginPage, decorators: [{
742
- type: Component,
743
- args: [{
744
- selector: 'edsis-auth-login-page',
745
- imports: [ReactiveFormsModule],
746
- host: {
747
- class: 'block',
748
- },
749
- template: `
750
- <div class="space-y-8">
751
- <header class="space-y-3">
752
- <p class="text-sm font-medium uppercase tracking-[0.24em] text-muted-foreground">Login</p>
753
- <div class="space-y-2">
754
- <h2 class="text-3xl font-semibold tracking-tight">Verifikasi email untuk masuk.</h2>
755
- <p class="max-w-xl text-sm leading-6 text-muted-foreground">
756
- Masukkan email yang terdaftar, silahkan klik link pada email yang diterima untuk masuk ke aplikasi.
757
- </p>
758
- </div>
759
- </header>
760
-
761
- <form class="space-y-5" [formGroup]="form" (ngSubmit)="submit()">
762
- <div class="space-y-2">
763
- <div
764
- 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]">
765
- <div aria-hidden="true" class="relative border-b border-r border-border/70">
766
- <div class="absolute bottom-0 right-0 h-7 w-7 translate-x-1/2 translate-y-1/2">
767
- <div
768
- class="absolute left-1/2 top-1/2 h-4 -translate-x-1/2 -translate-y-1/2 border-l-2 border-primary"></div>
769
- <div
770
- class="absolute left-1/2 top-1/2 w-4 -translate-x-1/2 -translate-y-1/2 border-t-2 border-primary"></div>
771
- </div>
772
- </div>
773
- <div aria-hidden="true" class="border-b border-border/70"></div>
774
- <div aria-hidden="true" class="relative border-b border-l border-border/70">
775
- <div class="absolute bottom-0 left-0 h-7 w-7 -translate-x-1/2 translate-y-1/2">
776
- <div
777
- class="absolute left-1/2 top-1/2 h-4 -translate-x-1/2 -translate-y-1/2 border-l-2 border-primary"></div>
778
- <div
779
- class="absolute left-1/2 top-1/2 w-4 -translate-x-1/2 -translate-y-1/2 border-t-2 border-primary"></div>
780
- </div>
781
- </div>
782
-
783
- <div aria-hidden="true" class="border-r border-border/70"></div>
784
- <div
785
- 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"
786
- [class.border-border]="fieldTone() === 'idle'"
787
- [class.border-destructive]="fieldTone() === 'error'"
788
- [class.border-emerald-500]="fieldTone() === 'success'">
789
- <span aria-hidden="true" class="flex shrink-0 items-center justify-center text-primary">
790
- <svg
791
- viewBox="0 0 24 24"
792
- class="h-6 w-6 fill-none stroke-current"
793
- stroke-width="1.8"
794
- stroke-linecap="round"
795
- stroke-linejoin="round">
796
- <path d="M4 7.5h16" />
797
- <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" />
798
- <path d="m5 8 7 5 7-5" />
799
- </svg>
800
- </span>
801
-
802
- <input
803
- id="email"
804
- type="email"
805
- inputmode="email"
806
- autocomplete="email"
807
- aria-label="Email"
808
- formControlName="email"
809
- placeholder="your@email.com"
810
- 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" />
811
-
812
- <button
813
- type="submit"
814
- [disabled]="form.invalid || isSubmitting()"
815
- 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">
816
- {{ isSubmitting() ? 'Mengirim...' : 'Kirim' }}
817
- </button>
818
- </div>
819
- <div aria-hidden="true" class="border-l border-border/70"></div>
820
-
821
- <div aria-hidden="true" class="relative border-r border-t border-border/70">
822
- <div class="absolute right-0 top-0 h-7 w-7 translate-x-1/2 -translate-y-1/2">
823
- <div
824
- class="absolute left-1/2 top-1/2 h-4 -translate-x-1/2 -translate-y-1/2 border-l-2 border-primary"></div>
825
- <div
826
- class="absolute left-1/2 top-1/2 w-4 -translate-x-1/2 -translate-y-1/2 border-t-2 border-primary"></div>
827
- </div>
828
- </div>
829
- <div aria-hidden="true" class="border-t border-border/70"></div>
830
- <div aria-hidden="true" class="relative border-l border-t border-border/70">
831
- <div class="absolute left-0 top-0 h-7 w-7 -translate-x-1/2 -translate-y-1/2">
832
- <div
833
- class="absolute left-1/2 top-1/2 h-4 -translate-x-1/2 -translate-y-1/2 border-l-2 border-primary"></div>
834
- <div
835
- class="absolute left-1/2 top-1/2 w-4 -translate-x-1/2 -translate-y-1/2 border-t-2 border-primary"></div>
836
- </div>
837
- </div>
838
-
839
- <div aria-hidden="true" class="border-r border-border/70"></div>
840
- <div class="px-4 pt-4 text-center sm:px-6">
841
- @if (hasInlineError()) {
842
- <p class="text-sm text-destructive">
843
- @if (emailControl.hasError('required')) {
844
- Email wajib diisi.
845
- } @else {
846
- Gunakan format email yang valid dengan panjang maksimal 255 karakter.
847
- }
848
- </p>
849
- } @else if (responseMessage()) {
850
- <p class="text-sm text-emerald-700">
851
- {{ responseMessage() }}
852
- </p>
853
- } @else if (errorMessage()) {
854
- <p class="text-sm text-destructive">
855
- {{ errorMessage() }}
856
- </p>
857
- }
858
- </div>
859
- <div aria-hidden="true" class="border-l border-border/70"></div>
860
- </div>
861
-
862
- <div class="space-y-4 pt-4">
863
- <div
864
- class="flex items-center justify-center text-sm font-medium uppercase tracking-[0.18em] text-muted-foreground">
865
- Atau
866
- </div>
867
-
868
- <div class="flex flex-wrap items-center justify-center gap-3">
869
- <button
870
- type="button"
871
- 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">
872
- <span class="inline-flex size-6 shrink-0 items-center justify-center" aria-hidden="true">
873
- <svg viewBox="0 0 24 24" class="size-5" xmlns="http://www.w3.org/2000/svg">
874
- <path
875
- fill="#EA4335"
876
- 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" />
877
- <path
878
- fill="#34A853"
879
- 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" />
880
- <path
881
- fill="#4A90E2"
882
- 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" />
883
- <path
884
- fill="#FBBC05"
885
- 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" />
886
- </svg>
887
- </span>
888
- Google
889
- </button>
890
- <button
891
- type="button"
892
- 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">
893
- <span class="inline-flex size-6 shrink-0 items-center justify-center" aria-hidden="true">
894
- <svg viewBox="0 0 24 24" class="size-5" xmlns="http://www.w3.org/2000/svg">
895
- <path fill="#F25022" d="M2 2h9.5v9.5H2z" />
896
- <path fill="#7FBA00" d="M12.5 2H22v9.5h-9.5z" />
897
- <path fill="#00A4EF" d="M2 12.5h9.5V22H2z" />
898
- <path fill="#FFB900" d="M12.5 12.5H22V22h-9.5z" />
899
- </svg>
900
- </span>
901
- Microsoft
902
- </button>
903
- <button
904
- type="button"
905
- 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">
906
- <span class="inline-flex size-6 shrink-0 items-center justify-center" aria-hidden="true">
907
- <svg viewBox="0 0 24 24" class="size-5 fill-current" xmlns="http://www.w3.org/2000/svg">
908
- <path
909
- 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" />
910
- </svg>
911
- </span>
912
- Apple
913
- </button>
914
- </div>
915
- </div>
916
- </div>
917
- </form>
918
- </div>
919
- `,
920
- changeDetection: ChangeDetectionStrategy.OnPush,
921
- }]
922
- }] });
923
-
924
- class AuthLogoutPage {
925
- destroyRef = inject(DestroyRef);
926
- documentRef = inject(DOCUMENT);
927
- router = inject(Router);
928
- authService = inject(AuthService);
929
- authConfig = inject(EDSIS_AUTH_CONFIG);
930
- guestHomePath = this.authConfig.guestHomePath;
931
- authenticatedHomePath = this.authConfig.authenticatedHomePath;
932
- state = signal('pending', ...(ngDevMode ? [{ debugName: "state" }] : /* istanbul ignore next */ []));
933
- message = signal('Mengakhiri sesi...', ...(ngDevMode ? [{ debugName: "message" }] : /* istanbul ignore next */ []));
934
- ngOnInit() {
935
- clearStoredSession(this.documentRef);
936
- this.authService
937
- .logoutAuthSession()
938
- .pipe(takeUntilDestroyed(this.destroyRef), finalize(() => {
939
- if (this.state() === 'pending') {
940
- this.state.set('success');
941
- }
942
- }))
943
- .subscribe({
944
- next: (response) => {
945
- this.state.set('success');
946
- this.message.set(getResponseMessage(response, 'Sesi berhasil diakhiri.'));
947
- void this.router.navigateByUrl(this.guestHomePath, { replaceUrl: true });
948
- },
949
- error: (error) => {
950
- this.state.set('error');
951
- this.message.set(getErrorMessage(error, 'Sesi lokal sudah dihapus, tetapi request logout gagal.'));
952
- },
953
- });
954
- }
955
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.10", ngImport: i0, type: AuthLogoutPage, deps: [], target: i0.ɵɵFactoryTarget.Component });
956
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.10", type: AuthLogoutPage, isStandalone: true, selector: "edsis-auth-logout-page", host: { classAttribute: "block" }, ngImport: i0, template: `
957
- <div class="space-y-6">
958
- <header class="space-y-3">
959
- <p class="text-sm font-medium uppercase tracking-[0.24em] text-muted-foreground">Logout</p>
960
- <h2 class="text-3xl font-semibold tracking-tight">Mengakhiri sesi Edsis.</h2>
961
- <p class="max-w-xl text-sm leading-6 text-muted-foreground">
962
- Halaman ini membersihkan sesi lokal lalu memanggil endpoint logout untuk merevoke refresh-token cookie pada
963
- backend.
964
- </p>
965
- </header>
966
-
967
- <div class="rounded-2xl border border-border bg-background/80 px-5 py-4 text-sm leading-6 text-foreground">
968
- {{ message() }}
969
- </div>
970
-
971
- @if (state() === 'error') {
972
- <div class="rounded-2xl border border-destructive/20 bg-destructive/10 px-4 py-3 text-sm text-destructive">
973
- Backend tidak mengonfirmasi logout, tetapi sesi lokal sudah dihapus.
974
- </div>
975
- }
976
-
977
- <div class="flex flex-wrap gap-3">
978
- <a
979
- [routerLink]="guestHomePath"
980
- 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">
981
- Kembali ke login
982
- </a>
983
- <a
984
- [routerLink]="authenticatedHomePath"
985
- 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">
986
- Buka dashboard
987
- </a>
988
- </div>
989
- </div>
990
- `, 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 });
991
- }
992
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.10", ngImport: i0, type: AuthLogoutPage, decorators: [{
993
- type: Component,
994
- args: [{
995
- selector: 'edsis-auth-logout-page',
996
- imports: [RouterLink],
997
- host: {
998
- class: 'block',
999
- },
1000
- template: `
1001
- <div class="space-y-6">
1002
- <header class="space-y-3">
1003
- <p class="text-sm font-medium uppercase tracking-[0.24em] text-muted-foreground">Logout</p>
1004
- <h2 class="text-3xl font-semibold tracking-tight">Mengakhiri sesi Edsis.</h2>
1005
- <p class="max-w-xl text-sm leading-6 text-muted-foreground">
1006
- Halaman ini membersihkan sesi lokal lalu memanggil endpoint logout untuk merevoke refresh-token cookie pada
1007
- backend.
1008
- </p>
1009
- </header>
1010
-
1011
- <div class="rounded-2xl border border-border bg-background/80 px-5 py-4 text-sm leading-6 text-foreground">
1012
- {{ message() }}
1013
- </div>
1014
-
1015
- @if (state() === 'error') {
1016
- <div class="rounded-2xl border border-destructive/20 bg-destructive/10 px-4 py-3 text-sm text-destructive">
1017
- Backend tidak mengonfirmasi logout, tetapi sesi lokal sudah dihapus.
1018
- </div>
1019
- }
1020
-
1021
- <div class="flex flex-wrap gap-3">
1022
- <a
1023
- [routerLink]="guestHomePath"
1024
- 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">
1025
- Kembali ke login
1026
- </a>
1027
- <a
1028
- [routerLink]="authenticatedHomePath"
1029
- 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">
1030
- Buka dashboard
1031
- </a>
1032
- </div>
1033
- </div>
1034
- `,
1035
- changeDetection: ChangeDetectionStrategy.OnPush,
1036
- }]
1037
- }] });
1038
-
1039
- class AuthVerifyPage {
1040
- destroyRef = inject(DestroyRef);
1041
- documentRef = inject(DOCUMENT);
1042
- route = inject(ActivatedRoute);
1043
- router = inject(Router);
1044
- location = inject(Location);
1045
- authService = inject(AuthService);
1046
- authConfig = inject(EDSIS_AUTH_CONFIG);
1047
- guestHomePath = this.authConfig.guestHomePath;
1048
- authenticatedHomePath = this.authConfig.authenticatedHomePath;
1049
- state = signal('pending', ...(ngDevMode ? [{ debugName: "state" }] : /* istanbul ignore next */ []));
1050
- message = signal('Memverifikasi magic link...', ...(ngDevMode ? [{ debugName: "message" }] : /* istanbul ignore next */ []));
1051
- ngOnInit() {
1052
- combineLatest([this.route.queryParamMap, this.route.fragment])
1053
- .pipe(takeUntilDestroyed(this.destroyRef))
1054
- .subscribe(([queryParamMap, fragment]) => {
1055
- const token = extractMagicToken(queryParamMap.get('token'), fragment);
1056
- this.clearTokenFromAddressBar();
1057
- if (!token) {
1058
- this.state.set('error');
1059
- this.message.set('Token magic link tidak ditemukan pada URL yang dibuka.');
1060
- return;
1061
- }
1062
- this.verify(token);
1063
- });
1064
- }
1065
- clearTokenFromAddressBar() {
1066
- this.location.replaceState(this.authConfig.verifyPath);
1067
- }
1068
- verify(token) {
1069
- this.authService
1070
- .verifyMagicLink({
1071
- body: {
1072
- token,
1073
- device_type: 'web',
1074
- },
1075
- })
1076
- .pipe(takeUntilDestroyed(this.destroyRef))
1077
- .subscribe({
1078
- next: (response) => {
1079
- const session = persistSession(this.documentRef, response.data);
1080
- if (!session) {
1081
- this.state.set('error');
1082
- this.message.set('Verifikasi berhasil, tetapi access token tidak ditemukan di respons backend.');
1083
- return;
1084
- }
1085
- this.state.set('success');
1086
- this.message.set(getResponseMessage(response, 'Verifikasi berhasil. Mengarahkan ke dashboard...'));
1087
- void this.router.navigateByUrl(this.authenticatedHomePath, { replaceUrl: true });
1088
- },
1089
- error: (error) => {
1090
- this.state.set('error');
1091
- this.message.set(getErrorMessage(error, 'Magic link tidak valid atau sudah kedaluwarsa.'));
1092
- },
1093
- });
1094
- }
1095
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.10", ngImport: i0, type: AuthVerifyPage, deps: [], target: i0.ɵɵFactoryTarget.Component });
1096
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.10", type: AuthVerifyPage, isStandalone: true, selector: "edsis-auth-verify-page", host: { classAttribute: "block" }, ngImport: i0, template: `
1097
- <div class="space-y-6">
1098
- <header class="space-y-3">
1099
- <p class="text-sm font-medium uppercase tracking-[0.24em] text-muted-foreground">Verify</p>
1100
- <h2 class="text-3xl font-semibold tracking-tight">Memverifikasi magic link.</h2>
1101
- <p class="max-w-xl text-sm leading-6 text-muted-foreground">
1102
- Token akan dikonsumsi satu kali, sesi refresh cookie dibentuk di backend, lalu access token disimpan secara
1103
- lokal untuk aplikasi.
1104
- </p>
1105
- </header>
1106
-
1107
- <div class="rounded-2xl border border-border bg-background/80 px-5 py-4 text-sm leading-6 text-foreground">
1108
- {{ message() }}
1109
- </div>
1110
-
1111
- @if (state() === 'error') {
1112
- <div class="rounded-2xl border border-destructive/20 bg-destructive/10 px-4 py-3 text-sm text-destructive">
1113
- Pastikan Anda membuka link terbaru dari email dan token belum pernah dipakai sebelumnya.
1114
- </div>
1115
- }
1116
-
1117
- <div class="flex flex-wrap gap-3">
1118
- <a
1119
- [routerLink]="guestHomePath"
1120
- 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">
1121
- Minta link baru
1122
- </a>
1123
- <a
1124
- [routerLink]="authenticatedHomePath"
1125
- 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">
1126
- Buka dashboard
1127
- </a>
1128
- </div>
1129
- </div>
1130
- `, 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 });
1131
- }
1132
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.10", ngImport: i0, type: AuthVerifyPage, decorators: [{
1133
- type: Component,
1134
- args: [{
1135
- selector: 'edsis-auth-verify-page',
1136
- imports: [RouterLink],
1137
- host: {
1138
- class: 'block',
1139
- },
1140
- template: `
1141
- <div class="space-y-6">
1142
- <header class="space-y-3">
1143
- <p class="text-sm font-medium uppercase tracking-[0.24em] text-muted-foreground">Verify</p>
1144
- <h2 class="text-3xl font-semibold tracking-tight">Memverifikasi magic link.</h2>
1145
- <p class="max-w-xl text-sm leading-6 text-muted-foreground">
1146
- Token akan dikonsumsi satu kali, sesi refresh cookie dibentuk di backend, lalu access token disimpan secara
1147
- lokal untuk aplikasi.
1148
- </p>
1149
- </header>
1150
-
1151
- <div class="rounded-2xl border border-border bg-background/80 px-5 py-4 text-sm leading-6 text-foreground">
1152
- {{ message() }}
1153
- </div>
1154
-
1155
- @if (state() === 'error') {
1156
- <div class="rounded-2xl border border-destructive/20 bg-destructive/10 px-4 py-3 text-sm text-destructive">
1157
- Pastikan Anda membuka link terbaru dari email dan token belum pernah dipakai sebelumnya.
1158
- </div>
1159
- }
1160
-
1161
- <div class="flex flex-wrap gap-3">
1162
- <a
1163
- [routerLink]="guestHomePath"
1164
- 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">
1165
- Minta link baru
1166
- </a>
1167
- <a
1168
- [routerLink]="authenticatedHomePath"
1169
- 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">
1170
- Buka dashboard
1171
- </a>
1172
- </div>
1173
- </div>
1174
- `,
1175
- changeDetection: ChangeDetectionStrategy.OnPush,
1176
- }]
1177
- }] });
1178
-
1179
- const authRoutes = [
1180
- {
1181
- path: '',
1182
- component: AuthShellPage,
1183
- children: [
1184
- {
1185
- path: 'login',
1186
- title: 'Login',
1187
- canActivate: [guestOnlyGuard],
1188
- component: AuthLoginPage,
1189
- },
1190
- {
1191
- path: 'logout',
1192
- title: 'Logout',
1193
- component: AuthLogoutPage,
1194
- },
1195
- {
1196
- path: 'verify',
1197
- title: 'Verify',
1198
- canActivate: [guestOnlyGuard],
1199
- component: AuthVerifyPage,
1200
- },
1201
- ],
1202
- },
1203
- ];
1204
-
1205
- /**
1206
- * Generated bundle index. Do not edit.
1207
- */
1208
-
1209
- 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 };
1210
- //# sourceMappingURL=edsis-angular-auth.mjs.map