@sdcorejs/angular 19.0.5 → 19.0.7

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.
@@ -0,0 +1,54 @@
1
+ <!doctype html>
2
+ <html lang="vi">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
6
+ <title>Lỗi đăng nhập</title>
7
+ <!--
8
+ Trang lỗi tĩnh (fallback) cho luồng đăng nhập Keycloak — đích redirect khi keycloak.init() thất bại.
9
+
10
+ MẪU TỔNG QUÁT TỪ CORE: dùng được NGAY, không cần chỉnh sửa gì. Consumer COPY file này vào
11
+ `public/auth-keycloak-error.html` (hoặc tên theo `authErrorUrl`). Khi muốn, tuỳ biến tại các
12
+ placeholder bên dưới (logo, thông tin hỗ trợ, nội dung, ngôn ngữ).
13
+
14
+ Nguyên tắc: KHÔNG phụ thuộc JS/CSS/ảnh bên ngoài (bundle app có thể đã lỗi) → style để inline,
15
+ mặc định không nhúng tài nguyên nào.
16
+ -->
17
+ <style>
18
+ * { box-sizing: border-box; }
19
+ html, body { height: 100%; margin: 0; }
20
+ body {
21
+ display: flex; align-items: center; justify-content: center;
22
+ min-height: 100vh; padding: 24px;
23
+ font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
24
+ color: #1f2937; background: #f5f6f8;
25
+ }
26
+ .box {
27
+ max-width: 480px; width: 100%; text-align: center;
28
+ background: #fff; border: 1px solid #e5e7eb; border-radius: 12px;
29
+ padding: 40px 32px; box-shadow: 0 1px 3px rgba(0, 0, 0, .08);
30
+ }
31
+ h1 { font-size: 20px; margin: 0 0 12px; }
32
+ p { margin: 8px 0; line-height: 1.6; color: #4b5563; font-size: 14px; }
33
+ .actions { margin-top: 24px; }
34
+ .btn {
35
+ display: inline-block; padding: 10px 20px; border-radius: 8px;
36
+ background: #2563eb; color: #fff; text-decoration: none; font-size: 14px;
37
+ }
38
+ </style>
39
+ </head>
40
+ <body>
41
+ <main class="box">
42
+ <!-- (Tuỳ chọn) Logo — bỏ comment và sửa src:
43
+ <img src="/your-logo.svg" alt="logo" style="height: 40px; margin-bottom: 24px;" /> -->
44
+ <h1>Có lỗi xảy ra khi đăng nhập</h1>
45
+ <p>Hệ thống đang gặp sự cố kỹ thuật trong quá trình xác thực. Trang chưa thể tải đầy đủ thông tin.</p>
46
+ <p>Vui lòng thử lại sau ít phút.</p>
47
+ <!-- (Tuỳ chọn) Thông tin hỗ trợ — bỏ comment và sửa email/đường dẫn:
48
+ <p>Cần hỗ trợ? Liên hệ <a href="mailto:you@example.com">you@example.com</a></p> -->
49
+ <div class="actions">
50
+ <a class="btn" href="/">Thử lại</a>
51
+ </div>
52
+ </main>
53
+ </body>
54
+ </html>
@@ -0,0 +1,7 @@
1
+ <html>
2
+ <body>
3
+ <script>
4
+ parent.postMessage(location.href, location.origin);
5
+ </script>
6
+ </body>
7
+ </html>
@@ -4,6 +4,31 @@ export interface SdKeycloakTenantConfig {
4
4
  realm: string;
5
5
  clientId: string;
6
6
  secureRoutes?: string[];
7
+ /**
8
+ * Basename (KHÔNG kèm đuôi `.html`) của file Keycloak **silent SSO redirect** mà consumer
9
+ * BẮT BUỘC đặt trong thư mục `public/`. Mặc định `'silent-renew'`.
10
+ *
11
+ * Service sẽ truyền `${origin}/<silentRenewUrl>.html` vào `silentCheckSsoRedirectUri`. Với giá trị
12
+ * mặc định, Keycloak gọi `${origin}/silent-renew.html` (giống hành vi cũ — không phá vỡ project hiện có).
13
+ *
14
+ * Consumer cần tạo file tĩnh này (nội dung mẫu ở `modules/keycloak/htmls/silent-renew.html`); nếu THIẾU,
15
+ * silent `check-sso` thất bại và `init()` trả về `false` không mong muốn (user bị coi là chưa đăng nhập).
16
+ * Cho phép truyền kèm `/` đầu hoặc đuôi `.html` (tự chuẩn hoá), hoặc đặt sâu hơn:
17
+ * `'assets/silent-renew'` → `${origin}/assets/silent-renew.html`.
18
+ */
19
+ silentRenewUrl?: string;
20
+ /**
21
+ * Basename (KHÔNG kèm đuôi `.html`) của **trang lỗi tĩnh** trong `public/`, dùng làm đích redirect khi
22
+ * `keycloak.init()` NÉM LỖI (Keycloak sập / mạng lỗi / cấu hình realm sai). Mặc định `'auth-keycloak-error'`.
23
+ *
24
+ * Khi init thất bại, app điều hướng full-page tới `${origin}/<authErrorUrl>.html`. Vì là file tĩnh nên
25
+ * trang lỗi vẫn hiển thị kể cả khi bundle Angular chưa khởi tạo được. Service cũng tự bỏ qua `init()` nếu
26
+ * đang đứng sẵn ở trang lỗi này (chống vòng lặp redirect).
27
+ *
28
+ * Consumer nên tạo file (nội dung mẫu ở `modules/keycloak/htmls/auth-keycloak-error.html`) và viết lại
29
+ * branding/nội dung. Nếu THIẾU, redirect rơi vào trang 404 của host. Chuẩn hoá giá trị giống `silentRenewUrl`.
30
+ */
31
+ authErrorUrl?: string;
7
32
  }
8
33
  export interface ISdKeycloakConfiguration {
9
34
  loadTenantConfig: () => Promise<SdKeycloakTenantConfig>;
@@ -5,6 +5,11 @@ export declare class SdKeycloakService {
5
5
  keycloak: Keycloak;
6
6
  config: SdKeycloakTenantConfig;
7
7
  init(config: SdKeycloakTenantConfig): Promise<boolean>;
8
+ /**
9
+ * Chuẩn hoá basename file tĩnh trong public/ thành URL tuyệt đối.
10
+ * `'silent-renew'` | `'/silent-renew'` | `'silent-renew.html'` → `${origin}/silent-renew.html`.
11
+ */
12
+ private toPublicHtmlUrl;
8
13
  login(): Promise<void>;
9
14
  logout(): Promise<void>;
10
15
  getToken(): string | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sdcorejs/angular",
3
- "version": "19.0.5",
3
+ "version": "19.0.7",
4
4
  "license": "MIT",
5
5
  "peerDependencies": {
6
6
  "@angular/common": "^19.0.0 || ^20.0.0 || ^21.0.0",
@@ -9,7 +9,7 @@
9
9
  "@angular/material-date-fns-adapter": "^19.0.0 || ^20.0.0 || ^21.0.0"
10
10
  },
11
11
  "dependencies": {
12
- "@sdcorejs/utils": "^1.1.2",
12
+ "@sdcorejs/utils": "^1.1.3",
13
13
  "@ckeditor/ckeditor5-angular": "11.1.2",
14
14
  "@omer-go/docx-parser-converter-ts": "^1.0.0",
15
15
  "@bjorn3/browser_wasi_shim": "^0.4.2",
@@ -33,14 +33,14 @@
33
33
  "types": "./index.d.ts",
34
34
  "default": "./fesm2022/sdcorejs-angular.mjs"
35
35
  },
36
- "./configurations": {
37
- "types": "./configurations/index.d.ts",
38
- "default": "./fesm2022/sdcorejs-angular-configurations.mjs"
39
- },
40
36
  "./components": {
41
37
  "types": "./components/index.d.ts",
42
38
  "default": "./fesm2022/sdcorejs-angular-components.mjs"
43
39
  },
40
+ "./configurations": {
41
+ "types": "./configurations/index.d.ts",
42
+ "default": "./fesm2022/sdcorejs-angular-configurations.mjs"
43
+ },
44
44
  "./directives": {
45
45
  "types": "./directives/index.d.ts",
46
46
  "default": "./fesm2022/sdcorejs-angular-directives.mjs"