@rytass/bpm-core-react 0.3.8 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (227) hide show
  1. package/CHANGELOG.md +105 -0
  2. package/README.md +69 -4
  3. package/dist/chunks/approval-instance-list-page-BtEc8Cs3.js +278 -0
  4. package/dist/chunks/approval-instance-list-page-BtEc8Cs3.js.map +1 -0
  5. package/dist/chunks/approval-instance-list-page-UNIIgUZy.cjs +2 -0
  6. package/dist/chunks/approval-instance-list-page-UNIIgUZy.cjs.map +1 -0
  7. package/dist/chunks/auth-provider-D2P-qWmY.cjs +2 -0
  8. package/dist/chunks/auth-provider-D2P-qWmY.cjs.map +1 -0
  9. package/dist/chunks/auth-provider-TTO9eNZV.js +83 -0
  10. package/dist/chunks/auth-provider-TTO9eNZV.js.map +1 -0
  11. package/dist/chunks/{builder-D950gct_.js → builder-C3E-8OJu.js} +474 -478
  12. package/dist/chunks/builder-C3E-8OJu.js.map +1 -0
  13. package/dist/chunks/builder-f-Q_0NUs.cjs +3 -0
  14. package/dist/chunks/builder-f-Q_0NUs.cjs.map +1 -0
  15. package/dist/chunks/categories-B6QZKZRt.cjs +2 -0
  16. package/dist/chunks/categories-B6QZKZRt.cjs.map +1 -0
  17. package/dist/chunks/categories-DBPoSrsi.js +382 -0
  18. package/dist/chunks/categories-DBPoSrsi.js.map +1 -0
  19. package/dist/chunks/chunk-CMqjfN_6.cjs +1 -0
  20. package/dist/chunks/dashboard-page-CQRBJxze.js +119 -0
  21. package/dist/chunks/dashboard-page-CQRBJxze.js.map +1 -0
  22. package/dist/chunks/dashboard-page-DrDChhg1.cjs +2 -0
  23. package/dist/chunks/dashboard-page-DrDChhg1.cjs.map +1 -0
  24. package/dist/chunks/delegations-CFXaJrdX.cjs +2 -0
  25. package/dist/chunks/delegations-CFXaJrdX.cjs.map +1 -0
  26. package/dist/chunks/delegations-D5pPEWsP.js +641 -0
  27. package/dist/chunks/delegations-D5pPEWsP.js.map +1 -0
  28. package/dist/chunks/delegations-DwbYkNUg.cjs +2 -0
  29. package/dist/chunks/delegations-DwbYkNUg.cjs.map +1 -0
  30. package/dist/chunks/delegations-FTLaWo1Y.js +568 -0
  31. package/dist/chunks/delegations-FTLaWo1Y.js.map +1 -0
  32. package/dist/chunks/detail-B9JkYNHc.cjs +2 -0
  33. package/dist/chunks/detail-B9JkYNHc.cjs.map +1 -0
  34. package/dist/chunks/detail-CSxI04gB.js +1518 -0
  35. package/dist/chunks/detail-CSxI04gB.js.map +1 -0
  36. package/dist/chunks/format-date-time-XxBzF0F5.cjs +2 -0
  37. package/dist/chunks/{format-date-time-26_pFvv4.cjs.map → format-date-time-XxBzF0F5.cjs.map} +1 -1
  38. package/dist/chunks/login-BfmfCclF.cjs +2 -0
  39. package/dist/chunks/{login-CQ9MfwcC.cjs.map → login-BfmfCclF.cjs.map} +1 -1
  40. package/dist/chunks/{login-C20yVxbc.js → login-xgI4wLHe.js} +3 -2
  41. package/dist/chunks/{login-C20yVxbc.js.map → login-xgI4wLHe.js.map} +1 -1
  42. package/dist/chunks/notifications-BoNa1BXD.js +193 -0
  43. package/dist/chunks/notifications-BoNa1BXD.js.map +1 -0
  44. package/dist/chunks/notifications-a-FCxV02.cjs +2 -0
  45. package/dist/chunks/notifications-a-FCxV02.cjs.map +1 -0
  46. package/dist/chunks/orgs-BIiqzHvb.cjs +2 -0
  47. package/dist/chunks/orgs-BIiqzHvb.cjs.map +1 -0
  48. package/dist/chunks/orgs-Cc18umVt.js +1944 -0
  49. package/dist/chunks/orgs-Cc18umVt.js.map +1 -0
  50. package/dist/chunks/router-adapter-BdHZXLS3.js +23 -0
  51. package/dist/chunks/router-adapter-BdHZXLS3.js.map +1 -0
  52. package/dist/chunks/router-adapter-BybHrCNP.cjs +2 -0
  53. package/dist/chunks/router-adapter-BybHrCNP.cjs.map +1 -0
  54. package/dist/chunks/templates-CL8bPvgn.cjs +2 -0
  55. package/dist/chunks/templates-CL8bPvgn.cjs.map +1 -0
  56. package/dist/chunks/templates-DNfDOPGm.js +380 -0
  57. package/dist/chunks/templates-DNfDOPGm.js.map +1 -0
  58. package/dist/chunks/users-CUY139DF.js +214 -0
  59. package/dist/chunks/users-CUY139DF.js.map +1 -0
  60. package/dist/chunks/users-qghSMtLn.cjs +2 -0
  61. package/dist/chunks/users-qghSMtLn.cjs.map +1 -0
  62. package/dist/components/approval-instance-list-page.d.ts +1 -2
  63. package/dist/components/bpm-notification-bell-button.d.ts +22 -0
  64. package/dist/components/dashboard-page.d.ts +1 -4
  65. package/dist/index.cjs +1 -1
  66. package/dist/index.cjs.map +1 -1
  67. package/dist/index.css +1 -0
  68. package/dist/index.d.ts +3 -1
  69. package/dist/index.js +206 -97
  70. package/dist/index.js.map +1 -1
  71. package/dist/lib/notification-drawer-provider.d.ts +3 -2
  72. package/dist/lib/notification-unread-provider.d.ts +6 -5
  73. package/dist/lib/providers.d.ts +3 -2
  74. package/dist/lib/use-bpm-logout.d.ts +12 -0
  75. package/dist/lib/use-bpm-member.d.ts +11 -0
  76. package/dist/pages/admin/delegations/index.cjs +1 -1
  77. package/dist/pages/admin/delegations/index.js +1 -1
  78. package/dist/pages/admin/orgs/index.cjs +1 -1
  79. package/dist/pages/admin/orgs/index.js +1 -1
  80. package/dist/pages/admin/users/index.cjs +1 -1
  81. package/dist/pages/admin/users/index.js +1 -1
  82. package/dist/pages/delegations/index.cjs +1 -1
  83. package/dist/pages/delegations/index.js +1 -1
  84. package/dist/pages/forms/builder/index.cjs +1 -1
  85. package/dist/pages/forms/builder/index.js +1 -1
  86. package/dist/pages/instances/detail/index.cjs +1 -1
  87. package/dist/pages/instances/detail/index.js +1 -1
  88. package/dist/pages/login/index.cjs +1 -1
  89. package/dist/pages/login/index.js +1 -1
  90. package/dist/pages/settings/notifications/index.cjs +1 -1
  91. package/dist/pages/settings/notifications/index.js +1 -1
  92. package/dist/pages/templates/categories/index.cjs +1 -1
  93. package/dist/pages/templates/categories/index.js +1 -1
  94. package/dist/pages/templates/index.cjs +1 -1
  95. package/dist/pages/templates/index.js +1 -1
  96. package/dist/views/admin/delegations/AdminDelegationsView.d.ts +1 -4
  97. package/dist/views/admin/delegations/index.cjs +1 -1
  98. package/dist/views/admin/delegations/index.js +1 -1
  99. package/dist/views/admin/index.cjs +1 -1
  100. package/dist/views/admin/index.js +3 -3
  101. package/dist/views/admin/orgs/AdminOrgsView.d.ts +1 -4
  102. package/dist/views/admin/orgs/index.cjs +1 -1
  103. package/dist/views/admin/orgs/index.js +1 -1
  104. package/dist/views/admin/users/AdminUsersView.d.ts +1 -4
  105. package/dist/views/admin/users/index.cjs +1 -1
  106. package/dist/views/admin/users/index.js +1 -1
  107. package/dist/views/cc/CcView.d.ts +1 -3
  108. package/dist/views/cc/index.cjs +1 -1
  109. package/dist/views/cc/index.cjs.map +1 -1
  110. package/dist/views/cc/index.js +2 -3
  111. package/dist/views/cc/index.js.map +1 -1
  112. package/dist/views/dashboard/DashboardView.d.ts +1 -3
  113. package/dist/views/dashboard/index.cjs +1 -1
  114. package/dist/views/dashboard/index.cjs.map +1 -1
  115. package/dist/views/dashboard/index.js +3 -3
  116. package/dist/views/dashboard/index.js.map +1 -1
  117. package/dist/views/delegations/DelegationsView.d.ts +1 -4
  118. package/dist/views/delegations/index.cjs +1 -1
  119. package/dist/views/delegations/index.js +1 -1
  120. package/dist/views/forms/FormsView.d.ts +1 -3
  121. package/dist/views/forms/builder/index.cjs +1 -1
  122. package/dist/views/forms/builder/index.js +1 -1
  123. package/dist/views/forms/index.cjs +1 -1
  124. package/dist/views/forms/index.cjs.map +1 -1
  125. package/dist/views/forms/index.js +95 -99
  126. package/dist/views/forms/index.js.map +1 -1
  127. package/dist/views/inbox/InboxView.d.ts +1 -3
  128. package/dist/views/inbox/index.cjs +1 -1
  129. package/dist/views/inbox/index.cjs.map +1 -1
  130. package/dist/views/inbox/index.js +91 -94
  131. package/dist/views/inbox/index.js.map +1 -1
  132. package/dist/views/instances/detail/index.cjs +1 -1
  133. package/dist/views/instances/detail/index.js +1 -1
  134. package/dist/views/instances/new/index.cjs +1 -1
  135. package/dist/views/instances/new/index.cjs.map +1 -1
  136. package/dist/views/instances/new/index.js +71 -77
  137. package/dist/views/instances/new/index.js.map +1 -1
  138. package/dist/views/login/index.cjs +1 -1
  139. package/dist/views/login/index.js +1 -1
  140. package/dist/views/root/RootView.d.ts +1 -3
  141. package/dist/views/search/SearchView.d.ts +1 -3
  142. package/dist/views/search/index.cjs +1 -1
  143. package/dist/views/search/index.cjs.map +1 -1
  144. package/dist/views/search/index.js +2 -3
  145. package/dist/views/search/index.js.map +1 -1
  146. package/dist/views/sent/SentView.d.ts +1 -3
  147. package/dist/views/sent/index.cjs +1 -1
  148. package/dist/views/sent/index.cjs.map +1 -1
  149. package/dist/views/sent/index.js +2 -3
  150. package/dist/views/sent/index.js.map +1 -1
  151. package/dist/views/settings/index.cjs +1 -1
  152. package/dist/views/settings/index.js +1 -1
  153. package/dist/views/settings/notifications/SettingsNotificationsView.d.ts +1 -4
  154. package/dist/views/settings/notifications/index.cjs +1 -1
  155. package/dist/views/settings/notifications/index.js +1 -1
  156. package/dist/views/templates/TemplatesView.d.ts +1 -4
  157. package/dist/views/templates/categories/TemplateCategoriesView.d.ts +1 -4
  158. package/dist/views/templates/categories/index.cjs +1 -1
  159. package/dist/views/templates/categories/index.js +1 -1
  160. package/dist/views/templates/designer/TemplateDesignerView.d.ts +1 -2
  161. package/dist/views/templates/designer/index.cjs +7 -7
  162. package/dist/views/templates/designer/index.cjs.map +1 -1
  163. package/dist/views/templates/designer/index.js +707 -711
  164. package/dist/views/templates/designer/index.js.map +1 -1
  165. package/dist/views/templates/index.cjs +1 -1
  166. package/dist/views/templates/index.js +2 -2
  167. package/dist/views/templates/versions/TemplateVersionsView.d.ts +1 -2
  168. package/dist/views/templates/versions/index.cjs +1 -1
  169. package/dist/views/templates/versions/index.cjs.map +1 -1
  170. package/dist/views/templates/versions/index.js +45 -49
  171. package/dist/views/templates/versions/index.js.map +1 -1
  172. package/package.json +2 -2
  173. package/dist/app-navigation.css +0 -1
  174. package/dist/chunks/app-navigation-BSkMsEhy.js +0 -268
  175. package/dist/chunks/app-navigation-BSkMsEhy.js.map +0 -1
  176. package/dist/chunks/app-navigation-KnlJCUp1.cjs +0 -2
  177. package/dist/chunks/app-navigation-KnlJCUp1.cjs.map +0 -1
  178. package/dist/chunks/approval-instance-list-page-CVXgE2K3.cjs +0 -2
  179. package/dist/chunks/approval-instance-list-page-CVXgE2K3.cjs.map +0 -1
  180. package/dist/chunks/approval-instance-list-page-CqNdoZqx.js +0 -282
  181. package/dist/chunks/approval-instance-list-page-CqNdoZqx.js.map +0 -1
  182. package/dist/chunks/auth-provider-BV8Iiwfb.cjs +0 -2
  183. package/dist/chunks/auth-provider-BV8Iiwfb.cjs.map +0 -1
  184. package/dist/chunks/auth-provider-Bnox5gsx.js +0 -98
  185. package/dist/chunks/auth-provider-Bnox5gsx.js.map +0 -1
  186. package/dist/chunks/builder-CMlJfQHE.cjs +0 -3
  187. package/dist/chunks/builder-CMlJfQHE.cjs.map +0 -1
  188. package/dist/chunks/builder-D950gct_.js.map +0 -1
  189. package/dist/chunks/categories-5yEM3p3N.cjs +0 -2
  190. package/dist/chunks/categories-5yEM3p3N.cjs.map +0 -1
  191. package/dist/chunks/categories-BIpOG451.js +0 -387
  192. package/dist/chunks/categories-BIpOG451.js.map +0 -1
  193. package/dist/chunks/dashboard-page-Bx1-Ys3e.js +0 -122
  194. package/dist/chunks/dashboard-page-Bx1-Ys3e.js.map +0 -1
  195. package/dist/chunks/dashboard-page-CQNRbMkJ.cjs +0 -2
  196. package/dist/chunks/dashboard-page-CQNRbMkJ.cjs.map +0 -1
  197. package/dist/chunks/delegations-B2j-wNEO.js +0 -646
  198. package/dist/chunks/delegations-B2j-wNEO.js.map +0 -1
  199. package/dist/chunks/delegations-CsB9ozLu.cjs +0 -2
  200. package/dist/chunks/delegations-CsB9ozLu.cjs.map +0 -1
  201. package/dist/chunks/delegations-CvtwTXNP.cjs +0 -2
  202. package/dist/chunks/delegations-CvtwTXNP.cjs.map +0 -1
  203. package/dist/chunks/delegations-dKodb0WW.js +0 -573
  204. package/dist/chunks/delegations-dKodb0WW.js.map +0 -1
  205. package/dist/chunks/detail-BcGAqJ_R.js +0 -1523
  206. package/dist/chunks/detail-BcGAqJ_R.js.map +0 -1
  207. package/dist/chunks/detail-CqjqLd65.cjs +0 -2
  208. package/dist/chunks/detail-CqjqLd65.cjs.map +0 -1
  209. package/dist/chunks/format-date-time-26_pFvv4.cjs +0 -2
  210. package/dist/chunks/login-CQ9MfwcC.cjs +0 -2
  211. package/dist/chunks/notifications-2swRqDPF.js +0 -198
  212. package/dist/chunks/notifications-2swRqDPF.js.map +0 -1
  213. package/dist/chunks/notifications-BaYDebFt.cjs +0 -2
  214. package/dist/chunks/notifications-BaYDebFt.cjs.map +0 -1
  215. package/dist/chunks/orgs-CuHxxd_n.js +0 -1949
  216. package/dist/chunks/orgs-CuHxxd_n.js.map +0 -1
  217. package/dist/chunks/orgs-YMiVLNvL.cjs +0 -2
  218. package/dist/chunks/orgs-YMiVLNvL.cjs.map +0 -1
  219. package/dist/chunks/templates-DTkbSgFY.cjs +0 -2
  220. package/dist/chunks/templates-DTkbSgFY.cjs.map +0 -1
  221. package/dist/chunks/templates-DoDWM68t.js +0 -384
  222. package/dist/chunks/templates-DoDWM68t.js.map +0 -1
  223. package/dist/chunks/users-3ySyUW4u.cjs +0 -2
  224. package/dist/chunks/users-3ySyUW4u.cjs.map +0 -1
  225. package/dist/chunks/users-sMfrSjRQ.js +0 -219
  226. package/dist/chunks/users-sMfrSjRQ.js.map +0 -1
  227. package/dist/components/app-navigation.d.ts +0 -41
package/dist/index.js CHANGED
@@ -1,174 +1,247 @@
1
1
  "use client";
2
- import { a as e, i as t, n, r, t as i } from "./chunks/auth-provider-Bnox5gsx.js";
2
+ import { n as e, r as t, t as n } from "./chunks/router-adapter-BdHZXLS3.js";
3
+ import { n as r, t as i } from "./chunks/auth-provider-TTO9eNZV.js";
3
4
  import { t as a } from "./chunks/format-date-time-CB-LxzqT.js";
4
- import { a as o, i as s, n as c, r as l, t as u } from "./chunks/app-navigation-BSkMsEhy.js";
5
- import { n as d, r as f, t as p } from "./chunks/routes-config-dxahImVe.js";
6
- import { a as m, i as h, n as g, o as _, r as v, t as y } from "./chunks/admin-pickers-DLlG_1du.js";
7
- import { t as b } from "./chunks/approval-instance-list-page-CqNdoZqx.js";
8
- import { t as x } from "./chunks/bpm-form-field-Cao0rMol.js";
9
- import { t as S } from "./chunks/dashboard-page-Bx1-Ys3e.js";
10
- import { Fragment as C, useCallback as w, useEffect as T, useMemo as E, useState as D } from "react";
11
- import { jsx as O, jsxs as k } from "react/jsx-runtime";
12
- import { listNotifications as A, markAllNotificationsRead as j, markNotificationRead as M } from "@rytass/bpm-core-client/workflow";
13
- import { CalendarConfigProviderMoment as N, CalendarLocale as P } from "@mezzanine-ui/react/moment";
14
- import F from "@mezzanine-ui/react/Drawer";
15
- import I from "@mezzanine-ui/react/NotificationCenter";
5
+ import { n as o, r as s, t as c } from "./chunks/routes-config-dxahImVe.js";
6
+ import { a as l, i as u, n as d, o as f, r as p, t as m } from "./chunks/admin-pickers-DLlG_1du.js";
7
+ import { t as h } from "./chunks/approval-instance-list-page-BtEc8Cs3.js";
8
+ import { t as g } from "./chunks/bpm-form-field-Cao0rMol.js";
9
+ import { t as _ } from "./chunks/dashboard-page-CQRBJxze.js";
10
+ import { Fragment as v, createContext as y, useCallback as b, useContext as x, useEffect as S, useMemo as C, useState as w } from "react";
11
+ import { NavigationIconButton as T } from "@mezzanine-ui/react";
12
+ import { jsx as E, jsxs as D } from "react/jsx-runtime";
13
+ import { listNotifications as O, markAllNotificationsRead as k, markNotificationRead as A, readUnreadNotificationCount as j } from "@rytass/bpm-core-client/workflow";
14
+ import { CalendarConfigProviderMoment as M, CalendarLocale as N } from "@mezzanine-ui/react/moment";
15
+ import P from "@mezzanine-ui/react/Drawer";
16
+ import F from "@mezzanine-ui/react/NotificationCenter";
17
+ import { NotificationUnreadIcon as I } from "@mezzanine-ui/icons";
18
+ import './index.css';//#region src/lib/notification-drawer-provider.tsx
19
+ var L = y(null);
20
+ function R({ children: e }) {
21
+ let [t, n] = w(!1), r = b(() => {
22
+ n(!0);
23
+ }, []), i = b(() => {
24
+ n(!1);
25
+ }, []), a = b(() => {
26
+ n((e) => !e);
27
+ }, []), o = C(() => ({
28
+ close: i,
29
+ isOpen: t,
30
+ open: r,
31
+ toggle: a
32
+ }), [
33
+ i,
34
+ t,
35
+ r,
36
+ a
37
+ ]);
38
+ return /* @__PURE__ */ E(L.Provider, {
39
+ value: o,
40
+ children: e
41
+ });
42
+ }
43
+ function z() {
44
+ return x(L) || {
45
+ close: () => void 0,
46
+ isOpen: !1,
47
+ open: () => void 0,
48
+ toggle: () => void 0
49
+ };
50
+ }
51
+ //#endregion
52
+ //#region src/lib/notification-unread-provider.tsx
53
+ var B = y(null);
54
+ function V({ children: e }) {
55
+ let { member: t } = r(), n = t?.memberId ?? null, [i, a] = w(0), o = b(async () => {
56
+ if (!n) return a(0), 0;
57
+ let e = await j(n);
58
+ return a(e), e;
59
+ }, [n]);
60
+ S(() => {
61
+ let e = !0;
62
+ return (async () => {
63
+ try {
64
+ let t = await o();
65
+ e && a(t);
66
+ } catch {
67
+ e && a(0);
68
+ }
69
+ })(), () => {
70
+ e = !1;
71
+ };
72
+ }, [o]);
73
+ let s = C(() => ({
74
+ refreshUnreadCount: o,
75
+ unreadCount: i
76
+ }), [o, i]);
77
+ return /* @__PURE__ */ E(B.Provider, {
78
+ value: s,
79
+ children: e
80
+ });
81
+ }
82
+ function H() {
83
+ return x(B) || {
84
+ refreshUnreadCount: async () => 0,
85
+ unreadCount: 0
86
+ };
87
+ }
88
+ //#endregion
16
89
  //#region src/components/notification-drawer.tsx
17
- var L = [
90
+ var U = [
18
91
  "today",
19
92
  "yesterday",
20
93
  "past7Days",
21
94
  "earlier"
22
- ], R = {
95
+ ], W = {
23
96
  earlier: "更早",
24
97
  past7Days: "過去七天",
25
98
  today: "今天",
26
99
  yesterday: "昨天"
27
- }, z = 50;
28
- function B() {
29
- let t = e(), r = f(), { member: i } = n(), { close: a, isOpen: s } = o(), { refreshUnreadCount: c } = l(), u = i?.memberId ?? null, [d, p] = D([]), [m, h] = D(0), [g, _] = D(1), [v, y] = D(!1), [b, x] = D(!1), [S, N] = D(null), [P, B] = D("all"), W = w(async (e, t) => {
30
- if (u) {
31
- y(!0), N(null);
100
+ }, G = 50;
101
+ function K() {
102
+ let e = t(), n = s(), { member: i } = r(), { close: a, isOpen: o } = z(), { refreshUnreadCount: c } = H(), l = i?.memberId ?? null, [u, d] = w([]), [f, p] = w(0), [m, h] = w(1), [g, _] = w(!1), [y, x] = w(!1), [T, j] = w(null), [M, N] = w("all"), I = b(async (e, t) => {
103
+ if (l) {
104
+ _(!0), j(null);
32
105
  try {
33
- let n = await A({
106
+ let n = await O({
34
107
  includeRead: !0,
35
108
  page: e,
36
- pageSize: z,
37
- recipientMemberId: u
109
+ pageSize: G,
110
+ recipientMemberId: l
38
111
  });
39
- p((e) => t ? [...e, ...n.notifications] : n.notifications), h(n.totalCount), _(e), await c();
112
+ d((e) => t ? [...e, ...n.notifications] : n.notifications), p(n.totalCount), h(e), await c();
40
113
  } catch (e) {
41
- N(U(e));
114
+ j(Y(e));
42
115
  } finally {
43
- y(!1);
116
+ _(!1);
44
117
  }
45
118
  }
46
- }, [u, c]);
47
- T(() => {
48
- !s || !u || W(1, !1);
119
+ }, [l, c]);
120
+ S(() => {
121
+ !o || !l || I(1, !1);
49
122
  }, [
50
- s,
51
- u,
52
- W
123
+ o,
124
+ l,
125
+ I
53
126
  ]);
54
- let G = w((e) => {
127
+ let L = b((e) => {
55
128
  let t = e.target.value;
56
- (t === "all" || t === "read" || t === "unread") && B(t);
57
- }, []), K = w(async () => {
58
- if (!(!u || b)) {
59
- x(!0), N(null);
129
+ (t === "all" || t === "read" || t === "unread") && N(t);
130
+ }, []), R = b(async () => {
131
+ if (!(!l || y)) {
132
+ x(!0), j(null);
60
133
  try {
61
- await j({ recipientMemberId: u }), await W(1, !1);
134
+ await k({ recipientMemberId: l }), await I(1, !1);
62
135
  } catch (e) {
63
- N(U(e));
136
+ j(Y(e));
64
137
  } finally {
65
138
  x(!1);
66
139
  }
67
140
  }
68
141
  }, [
69
- b,
70
- u,
71
- W
72
- ]), q = w(() => {
73
- v || W(g + 1, !0);
142
+ y,
143
+ l,
144
+ I
145
+ ]), B = b(() => {
146
+ g || I(m + 1, !0);
74
147
  }, [
75
- v,
76
- W,
77
- g
78
- ]), J = w(async (e) => {
79
- if (u) try {
80
- await M({
148
+ g,
149
+ I,
150
+ m
151
+ ]), V = b(async (e) => {
152
+ if (l) try {
153
+ await A({
81
154
  id: e,
82
- readerMemberId: u
83
- }), await W(1, !1);
155
+ readerMemberId: l
156
+ }), await I(1, !1);
84
157
  } catch (e) {
85
- N(U(e));
158
+ j(Y(e));
86
159
  }
87
- }, [u, W]), Y = w(async (e) => {
88
- if (!(!e.instanceId || !u)) try {
89
- e.status !== "READ" && (await M({
90
- id: e.id,
91
- readerMemberId: u
92
- }), await c()), a(), t.push(r.caseDetail(e.instanceId));
160
+ }, [l, I]), K = b(async (t) => {
161
+ if (!(!t.instanceId || !l)) try {
162
+ t.status !== "READ" && (await A({
163
+ id: t.id,
164
+ readerMemberId: l
165
+ }), await c()), a(), e.push(n.caseDetail(t.instanceId));
93
166
  } catch (e) {
94
- N(U(e));
167
+ j(Y(e));
95
168
  }
96
169
  }, [
97
170
  a,
98
- u,
171
+ l,
99
172
  c,
100
- t,
101
- r
102
- ]), X = E(() => d.filter((e) => P === "all" ? !0 : P === "read" ? e.status === "READ" : e.status !== "READ"), [P, d]), Z = E(() => {
103
- let e = /* @__PURE__ */ new Date(), t = L.reduce((e, t) => (e[t] = [], e), {
173
+ e,
174
+ n
175
+ ]), X = C(() => u.filter((e) => M === "all" ? !0 : M === "read" ? e.status === "READ" : e.status !== "READ"), [M, u]), Z = C(() => {
176
+ let e = /* @__PURE__ */ new Date(), t = U.reduce((e, t) => (e[t] = [], e), {
104
177
  earlier: [],
105
178
  past7Days: [],
106
179
  today: [],
107
180
  yesterday: []
108
181
  });
109
182
  return X.forEach((n) => {
110
- t[H(n.createdAt, e)].push(n);
111
- }), L.map((e) => [e, t[e]]).filter(([, e]) => e.length > 0);
112
- }, [X]), Q = d.length < m;
113
- return u ? /* @__PURE__ */ O(F, {
114
- bottomGhostActionDisabled: b || v,
115
- bottomGhostActionLoading: b,
183
+ t[J(n.createdAt, e)].push(n);
184
+ }), U.map((e) => [e, t[e]]).filter(([, e]) => e.length > 0);
185
+ }, [X]), Q = u.length < f;
186
+ return l ? /* @__PURE__ */ E(P, {
187
+ bottomGhostActionDisabled: y || g,
188
+ bottomGhostActionLoading: y,
116
189
  bottomGhostActionText: "全部標為已讀",
117
190
  bottomOnGhostActionClick: () => {
118
- K();
191
+ R();
119
192
  },
120
193
  bottomOnPrimaryActionClick: () => {
121
- q();
194
+ B();
122
195
  },
123
- bottomPrimaryActionDisabled: !Q || v,
124
- bottomPrimaryActionLoading: v && Q,
196
+ bottomPrimaryActionDisabled: !Q || g,
197
+ bottomPrimaryActionLoading: g && Q,
125
198
  bottomPrimaryActionText: Q ? "載入更多" : "已顯示全部",
126
- contentKey: `${P}:${d.length}`,
199
+ contentKey: `${M}:${u.length}`,
127
200
  filterAreaAllRadioLabel: "全部",
128
- filterAreaOnRadioChange: G,
201
+ filterAreaOnRadioChange: L,
129
202
  filterAreaReadRadioLabel: "已讀",
130
203
  filterAreaShow: !0,
131
204
  filterAreaUnreadRadioLabel: "未讀",
132
- filterAreaValue: P,
205
+ filterAreaValue: M,
133
206
  headerTitle: "通知中心",
134
207
  isBottomDisplay: !0,
135
208
  isHeaderDisplay: !0,
136
209
  onClose: a,
137
- open: s,
210
+ open: o,
138
211
  size: "medium",
139
- children: /* @__PURE__ */ k("div", {
212
+ children: /* @__PURE__ */ D("div", {
140
213
  role: "list",
141
214
  children: [
142
- S ? /* @__PURE__ */ O("p", {
215
+ T ? /* @__PURE__ */ E("p", {
143
216
  role: "alert",
144
217
  style: {
145
218
  color: "var(--mzn-color-text-error, #d92d20)",
146
219
  padding: "12px 16px"
147
220
  },
148
- children: S
221
+ children: T
149
222
  }) : null,
150
- Z.length === 0 ? /* @__PURE__ */ O("p", {
223
+ Z.length === 0 ? /* @__PURE__ */ E("p", {
151
224
  style: {
152
225
  color: "var(--mzn-color-text-secondary, #6b7280)",
153
226
  padding: "24px 16px",
154
227
  textAlign: "center"
155
228
  },
156
- children: v ? "載入中…" : "目前沒有通知"
229
+ children: g ? "載入中…" : "目前沒有通知"
157
230
  }) : null,
158
- Z.map(([e, t], n) => /* @__PURE__ */ O(C, { children: t.map((r, i) => /* @__PURE__ */ O(I, {
231
+ Z.map(([e, t], n) => /* @__PURE__ */ E(v, { children: t.map((r, i) => /* @__PURE__ */ E(F, {
159
232
  appendTips: n === Z.length - 1 && i === t.length - 1 && !Q ? "已顯示全部通知" : void 0,
160
233
  cancelButtonText: r.status === "READ" ? void 0 : "標為已讀",
161
234
  description: r.body,
162
235
  onCancel: r.status === "READ" ? void 0 : () => {
163
- J(r.id);
236
+ V(r.id);
164
237
  },
165
238
  onConfirm: r.instanceId ? () => {
166
- Y(r);
239
+ K(r);
167
240
  } : void 0,
168
241
  confirmButtonText: r.instanceId ? "查看案件" : void 0,
169
- prependTips: i === 0 ? R[e] : void 0,
242
+ prependTips: i === 0 ? W[e] : void 0,
170
243
  reference: r.id,
171
- severity: V(r.type),
244
+ severity: q(r.type),
172
245
  showBadge: r.status !== "READ",
173
246
  timeStamp: r.createdAt,
174
247
  title: r.title,
@@ -178,10 +251,10 @@ function B() {
178
251
  })
179
252
  }) : null;
180
253
  }
181
- function V(e) {
254
+ function q(e) {
182
255
  return e === "SLA_OVERDUE" ? "error" : e === "SLA_WARNING" ? "warning" : e === "INSTANCE_COMPLETED" ? "success" : "info";
183
256
  }
184
- function H(e, t) {
257
+ function J(e, t) {
185
258
  let n = new Date(e);
186
259
  if (Number.isNaN(n.getTime())) return "earlier";
187
260
  let r = new Date(t.getFullYear(), t.getMonth(), t.getDate()), i = new Date(n.getFullYear(), n.getMonth(), n.getDate());
@@ -189,22 +262,58 @@ function H(e, t) {
189
262
  let a = new Date(r);
190
263
  return a.setDate(a.getDate() - 1), i.getTime() === a.getTime() ? "yesterday" : (t.getTime() - n.getTime()) / (1e3 * 60 * 60 * 24) <= 7 ? "past7Days" : "earlier";
191
264
  }
192
- function U(e) {
265
+ function Y(e) {
193
266
  return e instanceof Error ? e.message : "發生未知錯誤";
194
267
  }
195
268
  //#endregion
196
269
  //#region src/lib/providers.tsx
197
- function W({ children: e, locale: t = P.ZH_TW, publicPaths: n, loginPath: r }) {
198
- return /* @__PURE__ */ O(N, {
270
+ function X({ children: e, locale: t = N.ZH_TW, publicPaths: n, loginPath: r }) {
271
+ return /* @__PURE__ */ E(M, {
199
272
  locale: t,
200
- children: /* @__PURE__ */ O(i, {
273
+ children: /* @__PURE__ */ E(i, {
201
274
  publicPaths: n,
202
275
  loginPath: r,
203
- children: /* @__PURE__ */ O(c, { children: /* @__PURE__ */ k(s, { children: [e, /* @__PURE__ */ O(B, {})] }) })
276
+ children: /* @__PURE__ */ E(V, { children: /* @__PURE__ */ D(R, { children: [e, /* @__PURE__ */ E(K, {})] }) })
204
277
  })
205
278
  });
206
279
  }
207
280
  //#endregion
208
- export { u as AppLayout, b as ApprovalInstanceListPage, i as AuthProvider, x as BPMFormField, p as BPMRoutesProvider, S as DashboardPage, y as MemberPicker, B as NotificationDrawer, s as NotificationDrawerProvider, c as NotificationUnreadProvider, g as OrgUnitPicker, v as PositionPicker, W as Providers, r as RouterAdapterProvider, d as createDefaultBPMRoutes, t as defaultBrowserSearchParams, a as formatDateTime, h as readMemberOption, m as readOrgUnitOption, _ as readPositionOption, n as useAuth, f as useBPMRoutes, o as useNotificationDrawer, l as useNotificationUnread, e as useRouterAdapter };
281
+ //#region src/lib/use-bpm-logout.ts
282
+ function Z() {
283
+ let { logout: e } = r();
284
+ return e;
285
+ }
286
+ //#endregion
287
+ //#region src/lib/use-bpm-member.ts
288
+ function Q() {
289
+ let { member: e } = r();
290
+ return e;
291
+ }
292
+ var $ = {
293
+ root: "bpm_root_jl5S-",
294
+ badge: "bpm_badge_SIKJk"
295
+ };
296
+ //#endregion
297
+ //#region src/components/bpm-notification-bell-button.tsx
298
+ function ee({ label: e = "通知中心" } = {}) {
299
+ let { open: t } = z(), { unreadCount: n } = H(), r = n > 0 ? `${e},${n} 則未讀` : e;
300
+ return /* @__PURE__ */ D("span", {
301
+ className: $.root,
302
+ children: [/* @__PURE__ */ E(T, {
303
+ "aria-label": r,
304
+ icon: I,
305
+ onClick: () => {
306
+ t();
307
+ },
308
+ title: e,
309
+ type: "button"
310
+ }), n > 0 ? /* @__PURE__ */ E("span", {
311
+ className: $.badge,
312
+ children: n > 99 ? "99+" : n
313
+ }) : null]
314
+ });
315
+ }
316
+ //#endregion
317
+ export { h as ApprovalInstanceListPage, i as AuthProvider, g as BPMFormField, ee as BPMNotificationBellButton, c as BPMRoutesProvider, _ as DashboardPage, m as MemberPicker, K as NotificationDrawer, R as NotificationDrawerProvider, V as NotificationUnreadProvider, d as OrgUnitPicker, p as PositionPicker, X as Providers, n as RouterAdapterProvider, o as createDefaultBPMRoutes, e as defaultBrowserSearchParams, a as formatDateTime, u as readMemberOption, l as readOrgUnitOption, f as readPositionOption, r as useAuth, Z as useBPMLogout, Q as useBPMMember, s as useBPMRoutes, z as useNotificationDrawer, H as useNotificationUnread, t as useRouterAdapter };
209
318
 
210
319
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../src/components/notification-drawer.tsx","../src/lib/providers.tsx"],"sourcesContent":["'use client';\n\nimport {\n Fragment,\n useCallback,\n useEffect,\n useMemo,\n useState,\n type ChangeEvent,\n type ReactElement,\n} from 'react';\nimport Drawer from '@mezzanine-ui/react/Drawer';\nimport NotificationCenter from '@mezzanine-ui/react/NotificationCenter';\nimport type { NotificationSeverity } from '@mezzanine-ui/core/notification-center';\nimport {\n listNotifications,\n markAllNotificationsRead,\n markNotificationRead,\n type NotificationRecord,\n type NotificationType,\n} from '@rytass/bpm-core-client/workflow';\nimport { useAuth } from '../lib/auth-provider';\nimport { useNotificationDrawer } from '../lib/notification-drawer-provider';\nimport { useNotificationUnread } from '../lib/notification-unread-provider';\nimport { useRouterAdapter } from '../lib/router-adapter';\nimport { useBPMRoutes } from '../lib/routes-config';\n\ntype FilterValue = 'all' | 'read' | 'unread';\n\ntype TimeGroup = 'today' | 'yesterday' | 'past7Days' | 'earlier';\n\nconst TIME_GROUP_ORDER: readonly TimeGroup[] = [\n 'today',\n 'yesterday',\n 'past7Days',\n 'earlier',\n];\n\nconst TIME_GROUP_LABEL: Readonly<Record<TimeGroup, string>> = {\n earlier: '更早',\n past7Days: '過去七天',\n today: '今天',\n yesterday: '昨天',\n};\n\nconst PAGE_SIZE = 50;\n\n/**\n * Right-side notification drawer mounted at the root by `<Providers>`.\n * Opens / closes via `useNotificationDrawer()`, polls\n * `listNotifications()` for the current member, supports filter\n * (`all` / `read` / `unread`), per-row mark-read, bulk mark-all-read, and\n * load-more pagination. Clicking a row with an `instanceId` navigates to\n * `/instances/<id>` via the host's router adapter.\n */\nexport function NotificationDrawer(): ReactElement | null {\n const router = useRouterAdapter();\n const routes = useBPMRoutes();\n const { member } = useAuth();\n const { close, isOpen } = useNotificationDrawer();\n const { refreshUnreadCount } = useNotificationUnread();\n const currentMemberId = member?.memberId ?? null;\n const [rows, setRows] = useState<readonly NotificationRecord[]>([]);\n const [totalCount, setTotalCount] = useState(0);\n const [page, setPage] = useState(1);\n const [loading, setLoading] = useState(false);\n const [bulkLoading, setBulkLoading] = useState(false);\n const [error, setError] = useState<string | null>(null);\n const [filter, setFilter] = useState<FilterValue>('all');\n\n const loadPage = useCallback(\n async (nextPage: number, append: boolean): Promise<void> => {\n if (!currentMemberId) return;\n setLoading(true);\n setError(null);\n try {\n const result = await listNotifications({\n includeRead: true,\n page: nextPage,\n pageSize: PAGE_SIZE,\n recipientMemberId: currentMemberId,\n });\n setRows((current): readonly NotificationRecord[] =>\n append ? [...current, ...result.notifications] : result.notifications,\n );\n setTotalCount(result.totalCount);\n setPage(nextPage);\n await refreshUnreadCount();\n } catch (e: unknown) {\n setError(readErrorMessage(e));\n } finally {\n setLoading(false);\n }\n },\n [currentMemberId, refreshUnreadCount],\n );\n\n useEffect((): void => {\n if (!isOpen || !currentMemberId) return;\n void loadPage(1, false);\n }, [isOpen, currentMemberId, loadPage]);\n\n const handleFilterChange = useCallback(\n (event: ChangeEvent<HTMLInputElement>): void => {\n const next = event.target.value;\n if (next === 'all' || next === 'read' || next === 'unread') setFilter(next);\n },\n [],\n );\n\n const handleMarkAllRead = useCallback(async (): Promise<void> => {\n if (!currentMemberId || bulkLoading) return;\n setBulkLoading(true);\n setError(null);\n try {\n await markAllNotificationsRead({ recipientMemberId: currentMemberId });\n await loadPage(1, false);\n } catch (e: unknown) {\n setError(readErrorMessage(e));\n } finally {\n setBulkLoading(false);\n }\n }, [bulkLoading, currentMemberId, loadPage]);\n\n const handleLoadMore = useCallback((): void => {\n if (loading) return;\n void loadPage(page + 1, true);\n }, [loading, loadPage, page]);\n\n const handleMarkRead = useCallback(\n async (id: string): Promise<void> => {\n if (!currentMemberId) return;\n try {\n await markNotificationRead({ id, readerMemberId: currentMemberId });\n await loadPage(1, false);\n } catch (e: unknown) {\n setError(readErrorMessage(e));\n }\n },\n [currentMemberId, loadPage],\n );\n\n const handleOpenInstance = useCallback(\n async (record: NotificationRecord): Promise<void> => {\n if (!record.instanceId || !currentMemberId) return;\n try {\n if (record.status !== 'READ') {\n await markNotificationRead({\n id: record.id,\n readerMemberId: currentMemberId,\n });\n await refreshUnreadCount();\n }\n close();\n router.push(routes.caseDetail(record.instanceId));\n } catch (e: unknown) {\n setError(readErrorMessage(e));\n }\n },\n [close, currentMemberId, refreshUnreadCount, router, routes],\n );\n\n const filteredRows = useMemo(\n (): readonly NotificationRecord[] =>\n rows.filter((row): boolean => {\n if (filter === 'all') return true;\n if (filter === 'read') return row.status === 'READ';\n return row.status !== 'READ';\n }),\n [filter, rows],\n );\n\n const groupedRows = useMemo(\n (): ReadonlyArray<readonly [TimeGroup, readonly NotificationRecord[]]> => {\n const now = new Date();\n const buckets = TIME_GROUP_ORDER.reduce<\n Record<TimeGroup, NotificationRecord[]>\n >(\n (accumulator, group) => {\n accumulator[group] = [];\n return accumulator;\n },\n { earlier: [], past7Days: [], today: [], yesterday: [] },\n );\n filteredRows.forEach((row): void => {\n buckets[resolveTimeGroup(row.createdAt, now)].push(row);\n });\n return TIME_GROUP_ORDER.map(\n (group) => [group, buckets[group]] as const,\n ).filter(([, items]) => items.length > 0);\n },\n [filteredRows],\n );\n\n const hasMore = rows.length < totalCount;\n\n if (!currentMemberId) return null;\n\n return (\n <Drawer\n bottomGhostActionDisabled={bulkLoading || loading}\n bottomGhostActionLoading={bulkLoading}\n bottomGhostActionText=\"全部標為已讀\"\n bottomOnGhostActionClick={(): void => {\n void handleMarkAllRead();\n }}\n bottomOnPrimaryActionClick={(): void => {\n handleLoadMore();\n }}\n bottomPrimaryActionDisabled={!hasMore || loading}\n bottomPrimaryActionLoading={loading && hasMore}\n bottomPrimaryActionText={hasMore ? '載入更多' : '已顯示全部'}\n contentKey={`${filter}:${rows.length}`}\n filterAreaAllRadioLabel=\"全部\"\n filterAreaOnRadioChange={handleFilterChange}\n filterAreaReadRadioLabel=\"已讀\"\n filterAreaShow\n filterAreaUnreadRadioLabel=\"未讀\"\n filterAreaValue={filter}\n headerTitle=\"通知中心\"\n isBottomDisplay\n isHeaderDisplay\n onClose={close}\n open={isOpen}\n size=\"medium\"\n >\n <div role=\"list\">\n {error ? (\n <p\n role=\"alert\"\n style={{\n color: 'var(--mzn-color-text-error, #d92d20)',\n padding: '12px 16px',\n }}\n >\n {error}\n </p>\n ) : null}\n {groupedRows.length === 0 ? (\n <p\n style={{\n color: 'var(--mzn-color-text-secondary, #6b7280)',\n padding: '24px 16px',\n textAlign: 'center',\n }}\n >\n {loading ? '載入中…' : '目前沒有通知'}\n </p>\n ) : null}\n {groupedRows.map(([group, items], groupIndex) => (\n <Fragment key={group}>\n {items.map((record, itemIndex) => (\n <NotificationCenter\n appendTips={\n groupIndex === groupedRows.length - 1 &&\n itemIndex === items.length - 1 &&\n !hasMore\n ? '已顯示全部通知'\n : undefined\n }\n cancelButtonText={\n record.status !== 'READ' ? '標為已讀' : undefined\n }\n description={record.body}\n key={record.id}\n onCancel={\n record.status !== 'READ'\n ? (): void => {\n void handleMarkRead(record.id);\n }\n : undefined\n }\n onConfirm={\n record.instanceId\n ? (): void => {\n void handleOpenInstance(record);\n }\n : undefined\n }\n confirmButtonText={record.instanceId ? '查看案件' : undefined}\n prependTips={itemIndex === 0 ? TIME_GROUP_LABEL[group] : undefined}\n reference={record.id}\n severity={toSeverity(record.type)}\n showBadge={record.status !== 'READ'}\n timeStamp={record.createdAt}\n title={record.title}\n type=\"drawer\"\n />\n ))}\n </Fragment>\n ))}\n </div>\n </Drawer>\n );\n}\n\nfunction toSeverity(type: NotificationType): NotificationSeverity {\n if (type === 'SLA_OVERDUE') return 'error';\n if (type === 'SLA_WARNING') return 'warning';\n if (type === 'INSTANCE_COMPLETED') return 'success';\n return 'info';\n}\n\nfunction resolveTimeGroup(value: string, now: Date): TimeGroup {\n const notificationDate = new Date(value);\n if (Number.isNaN(notificationDate.getTime())) return 'earlier';\n const nowStartOfDay = new Date(now.getFullYear(), now.getMonth(), now.getDate());\n const notificationStartOfDay = new Date(\n notificationDate.getFullYear(),\n notificationDate.getMonth(),\n notificationDate.getDate(),\n );\n if (notificationStartOfDay.getTime() === nowStartOfDay.getTime()) return 'today';\n const yesterdayStartOfDay = new Date(nowStartOfDay);\n yesterdayStartOfDay.setDate(yesterdayStartOfDay.getDate() - 1);\n if (notificationStartOfDay.getTime() === yesterdayStartOfDay.getTime())\n return 'yesterday';\n const diffInDays =\n (now.getTime() - notificationDate.getTime()) / (1000 * 60 * 60 * 24);\n if (diffInDays <= 7) return 'past7Days';\n return 'earlier';\n}\n\nfunction readErrorMessage(error: unknown): string {\n return error instanceof Error ? error.message : '發生未知錯誤';\n}\n","'use client';\n\nimport type { ReactElement, ReactNode } from 'react';\nimport {\n CalendarConfigProviderMoment,\n CalendarLocale,\n} from '@mezzanine-ui/react/moment';\nimport { AuthProvider } from './auth-provider';\nimport { NotificationDrawer } from '../components/notification-drawer';\nimport { NotificationDrawerProvider } from './notification-drawer-provider';\nimport { NotificationUnreadProvider } from './notification-unread-provider';\n\ninterface ProvidersProps {\n readonly children: ReactNode;\n /** Override Mezzanine calendar locale. Defaults to `CalendarLocale.ZH_TW`. */\n readonly locale?: CalendarLocale;\n /**\n * Public paths that should not trigger redirect to `/login` when there\n * is no session. Forwarded to `<AuthProvider>`. Defaults to `['/login']`.\n */\n readonly publicPaths?: readonly string[];\n /** Where to send unauthenticated users. Defaults to `'/login'`. */\n readonly loginPath?: string;\n}\n\n/**\n * One-stop BPM admin provider stack. Wires:\n *\n * - Mezzanine UI calendar locale (moment-based, `ZH_TW` by default)\n * - `<AuthProvider>` (BPM session via REST `/auth/*`)\n * - `<NotificationUnreadProvider>` (polls unread count)\n * - `<NotificationDrawerProvider>` (controls drawer open/close state)\n * - `<NotificationDrawer />` mounted at the root so the bell-icon button in\n * `<AppLayout />` can open it.\n *\n * Consumer hosts wrap this **inside** a `<RouterAdapterProvider>` (provided\n * by the `pages/*` subpath shims when consuming via Next.js, or wired by\n * hand for other frameworks).\n */\nexport function Providers({\n children,\n locale = CalendarLocale.ZH_TW,\n publicPaths,\n loginPath,\n}: ProvidersProps): ReactElement {\n return (\n <CalendarConfigProviderMoment locale={locale}>\n <AuthProvider publicPaths={publicPaths} loginPath={loginPath}>\n <NotificationUnreadProvider>\n <NotificationDrawerProvider>\n {children}\n <NotificationDrawer />\n </NotificationDrawerProv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,QAAQ,MAAM,MAAO,KAAK,KAAK,OACjD,IAAU,cACrB;AACT;AAEA,SAAS,EAAiB,GAAwB;CAChD,OAAO,aAAiB,QAAQ,EAAM,UAAU;AAClD;;;AC9RA,SAAgB,EAAU,EACxB,aACA,YAAS,EAAe,OACxB,gBACA,gBAC+B;CAC/B,OACE,kBAAC,GAAD;EAAsC;YACpC,kBAAC,GAAD;GAA2B;GAAwB;aACjD,kBAAC,GAAD,EAAA,UACE,kBAAC,GAAD,EAAA,UAAA,CACG,GACD,kBAAC,GAAD,CAAqB,CAAA,CACK,EAAA,CAAA,EACF,CAAA;EAChB,CAAA;CACc,CAAA;AAElC"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/lib/notification-drawer-provider.tsx","../src/lib/notification-unread-provider.tsx","../src/components/notification-drawer.tsx","../src/lib/providers.tsx","../src/lib/use-bpm-logout.ts","../src/lib/use-bpm-member.ts","../src/components/bpm-notification-bell-button.module.scss","../src/components/bpm-notification-bell-button.tsx"],"sourcesContent":["'use client';\n\nimport {\n createContext,\n useCallback,\n useContext,\n useMemo,\n useState,\n type ReactElement,\n type ReactNode,\n} from 'react';\n\ninterface NotificationDrawerContextValue {\n readonly close: () => void;\n readonly isOpen: boolean;\n readonly open: () => void;\n readonly toggle: () => void;\n}\n\nconst NotificationDrawerContext =\n createContext<NotificationDrawerContextValue | null>(null);\n\ninterface NotificationDrawerProviderProps {\n readonly children: ReactNode;\n}\n\n/**\n * Controls the open/closed state of the BPM notification drawer. Wraps\n * children with a context that `<NotificationDrawer />` reads to mount /\n * hide itself, and that the host navigation reads (via\n * `<BPMNotificationBellButton />` or `useNotificationDrawer().open`) to\n * open the drawer when the bell icon is clicked.\n *\n * When used outside this provider, the returned hook is a safe no-op so\n * components don't crash in test or storybook environments.\n */\nexport function NotificationDrawerProvider({\n children,\n}: NotificationDrawerProviderProps): ReactElement {\n const [isOpen, setIsOpen] = useState(false);\n\n const open = useCallback((): void => {\n setIsOpen(true);\n }, []);\n const close = useCallback((): void => {\n setIsOpen(false);\n }, []);\n const toggle = useCallback((): void => {\n setIsOpen((current) => !current);\n }, []);\n\n const value = useMemo<NotificationDrawerContextValue>(\n () => ({ close, isOpen, open, toggle }),\n [close, isOpen, open, toggle],\n );\n\n return (\n <NotificationDrawerContext.Provider value={value}>\n {children}\n </NotificationDrawerContext.Provider>\n );\n}\n\n/**\n * Read the BPM notification drawer's open state and control helpers.\n * Returns a no-op stub when used outside `<NotificationDrawerProvider>`.\n */\nexport function useNotificationDrawer(): NotificationDrawerContextValue {\n const context = useContext(NotificationDrawerContext);\n if (!context) {\n return {\n close: (): void => undefined,\n isOpen: false,\n open: (): void => undefined,\n toggle: (): void => undefined,\n };\n }\n return context;\n}\n","'use client';\n\nimport {\n createContext,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useState,\n type ReactElement,\n type ReactNode,\n} from 'react';\nimport { readUnreadNotificationCount } from '@rytass/bpm-core-client/workflow';\nimport { useAuth } from './auth-provider';\n\ninterface NotificationUnreadContextValue {\n readonly refreshUnreadCount: () => Promise<number>;\n readonly unreadCount: number;\n}\n\nconst NotificationUnreadContext =\n createContext<NotificationUnreadContextValue | null>(null);\n\ninterface NotificationUnreadProviderProps {\n readonly children: ReactNode;\n}\n\n/**\n * Polls BPM for the current member's unread notification count via\n * `readUnreadNotificationCount` and exposes it through context for the\n * host navigation (`<BPMNotificationBellButton />` badge or any custom\n * trigger using `useNotificationUnread().unreadCount`) and the BPM\n * `<NotificationDrawer />` (header count). Refresh is triggered on\n * mount and whenever the auth member id changes; consumers can call\n * `refreshUnreadCount()` after acknowledging a notification.\n */\nexport function NotificationUnreadProvider({\n children,\n}: NotificationUnreadProviderProps): ReactElement {\n const { member } = useAuth();\n const currentMemberId = member?.memberId ?? null;\n const [unreadCount, setUnreadCount] = useState(0);\n\n const refreshUnreadCount = useCallback(async (): Promise<number> => {\n if (!currentMemberId) {\n setUnreadCount(0);\n return 0;\n }\n const next = await readUnreadNotificationCount(currentMemberId);\n setUnreadCount(next);\n return next;\n }, [currentMemberId]);\n\n useEffect((): (() => void) => {\n let active = true;\n void (async () => {\n try {\n const next = await refreshUnreadCount();\n if (active) setUnreadCount(next);\n } catch {\n if (active) setUnreadCount(0);\n }\n })();\n return (): void => {\n active = false;\n };\n }, [refreshUnreadCount]);\n\n const value = useMemo<NotificationUnreadContextValue>(\n () => ({ refreshUnreadCount, unreadCount }),\n [refreshUnreadCount, unreadCount],\n );\n\n return (\n <NotificationUnreadContext.Provider value={value}>\n {children}\n </NotificationUnreadContext.Provider>\n );\n}\n\n/**\n * Read the current unread-notification count and a manual refresh helper.\n * Returns a zero/no-op stub when used outside\n * `<NotificationUnreadProvider>`.\n */\nexport function useNotificationUnread(): NotificationUnreadContextValue {\n const context = useContext(NotificationUnreadContext);\n if (!context) {\n return {\n refreshUnreadCount: async (): Promise<number> => 0,\n unreadCount: 0,\n };\n }\n return context;\n}\n","'use client';\n\nimport {\n Fragment,\n useCallback,\n useEffect,\n useMemo,\n useState,\n type ChangeEvent,\n type ReactElement,\n} from 'react';\nimport Drawer from '@mezzanine-ui/react/Drawer';\nimport NotificationCenter from '@mezzanine-ui/react/NotificationCenter';\nimport type { NotificationSeverity } from '@mezzanine-ui/core/notification-center';\nimport {\n listNotifications,\n markAllNotificationsRead,\n markNotificationRead,\n type NotificationRecord,\n type NotificationType,\n} from '@rytass/bpm-core-client/workflow';\nimport { useAuth } from '../lib/auth-provider';\nimport { useNotificationDrawer } from '../lib/notification-drawer-provider';\nimport { useNotificationUnread } from '../lib/notification-unread-provider';\nimport { useRouterAdapter } from '../lib/router-adapter';\nimport { useBPMRoutes } from '../lib/routes-config';\n\ntype FilterValue = 'all' | 'read' | 'unread';\n\ntype TimeGroup = 'today' | 'yesterday' | 'past7Days' | 'earlier';\n\nconst TIME_GROUP_ORDER: readonly TimeGroup[] = [\n 'today',\n 'yesterday',\n 'past7Days',\n 'earlier',\n];\n\nconst TIME_GROUP_LABEL: Readonly<Record<TimeGroup, string>> = {\n earlier: '更早',\n past7Days: '過去七天',\n today: '今天',\n yesterday: '昨天',\n};\n\nconst PAGE_SIZE = 50;\n\n/**\n * Right-side notification drawer mounted at the root by `<Providers>`.\n * Opens / closes via `useNotificationDrawer()`, polls\n * `listNotifications()` for the current member, supports filter\n * (`all` / `read` / `unread`), per-row mark-read, bulk mark-all-read, and\n * load-more pagination. Clicking a row with an `instanceId` navigates to\n * `/instances/<id>` via the host's router adapter.\n */\nexport function NotificationDrawer(): ReactElement | null {\n const router = useRouterAdapter();\n const routes = useBPMRoutes();\n const { member } = useAuth();\n const { close, isOpen } = useNotificationDrawer();\n const { refreshUnreadCount } = useNotificationUnread();\n const currentMemberId = member?.memberId ?? null;\n const [rows, setRows] = useState<readonly NotificationRecord[]>([]);\n const [totalCount, setTotalCount] = useState(0);\n const [page, setPage] = useState(1);\n const [loading, setLoading] = useState(false);\n const [bulkLoading, setBulkLoading] = useState(false);\n const [error, setError] = useState<string | null>(null);\n const [filter, setFilter] = useState<FilterValue>('all');\n\n const loadPage = useCallback(\n async (nextPage: number, append: boolean): Promise<void> => {\n if (!currentMemberId) return;\n setLoading(true);\n setError(null);\n try {\n const result = await listNotifications({\n includeRead: true,\n page: nextPage,\n pageSize: PAGE_SIZE,\n recipientMemberId: currentMemberId,\n });\n setRows((current): readonly NotificationRecord[] =>\n append ? [...current, ...result.notifications] : result.notifications,\n );\n setTotalCount(result.totalCount);\n setPage(nextPage);\n await refreshUnreadCount();\n } catch (e: unknown) {\n setError(readErrorMessage(e));\n } finally {\n setLoading(false);\n }\n },\n [currentMemberId, refreshUnreadCount],\n );\n\n useEffect((): void => {\n if (!isOpen || !currentMemberId) return;\n void loadPage(1, false);\n }, [isOpen, currentMemberId, loadPage]);\n\n const handleFilterChange = useCallback(\n (event: ChangeEvent<HTMLInputElement>): void => {\n const next = event.target.value;\n if (next === 'all' || next === 'read' || next === 'unread') setFilter(next);\n },\n [],\n );\n\n const handleMarkAllRead = useCallback(async (): Promise<void> => {\n if (!currentMemberId || bulkLoading) return;\n setBulkLoading(true);\n setError(null);\n try {\n await markAllNotificationsRead({ recipientMemberId: currentMemberId });\n await loadPage(1, false);\n } catch (e: unknown) {\n setError(readErrorMessage(e));\n } finally {\n setBulkLoading(false);\n }\n }, [bulkLoading, currentMemberId, loadPage]);\n\n const handleLoadMore = useCallback((): void => {\n if (loading) return;\n void loadPage(page + 1, true);\n }, [loading, loadPage, page]);\n\n const handleMarkRead = useCallback(\n async (id: string): Promise<void> => {\n if (!currentMemberId) return;\n try {\n await markNotificationRead({ id, readerMemberId: currentMemberId });\n await loadPage(1, false);\n } catch (e: unknown) {\n setError(readErrorMessage(e));\n }\n },\n [currentMemberId, loadPage],\n );\n\n const handleOpenInstance = useCallback(\n async (record: NotificationRecord): Promise<void> => {\n if (!record.instanceId || !currentMemberId) return;\n try {\n if (record.status !== 'READ') {\n await markNotificationRead({\n id: record.id,\n readerMemberId: currentMemberId,\n });\n await refreshUnreadCount();\n }\n close();\n router.push(routes.caseDetail(record.instanceId));\n } catch (e: unknown) {\n setError(readErrorMessage(e));\n }\n },\n [close, currentMemberId, refreshUnreadCount, router, routes],\n );\n\n const filteredRows = useMemo(\n (): readonly NotificationRecord[] =>\n rows.filter((row): boolean => {\n if (filter === 'all') return true;\n if (filter === 'read') return row.status === 'READ';\n return row.status !== 'READ';\n }),\n [filter, rows],\n );\n\n const groupedRows = useMemo(\n (): ReadonlyArray<readonly [TimeGroup, readonly NotificationRecord[]]> => {\n const now = new Date();\n const buckets = TIME_GROUP_ORDER.reduce<\n Record<TimeGroup, NotificationRecord[]>\n >(\n (accumulator, group) => {\n accumulator[group] = [];\n return accumulator;\n },\n { earlier: [], past7Days: [], today: [], yesterday: [] },\n );\n filteredRows.forEach((row): void => {\n buckets[resolveTimeGroup(row.createdAt, now)].push(row);\n });\n return TIME_GROUP_ORDER.map(\n (group) => [group, buckets[group]] as const,\n ).filter(([, items]) => items.length > 0);\n },\n [filteredRows],\n );\n\n const hasMore = rows.length < totalCount;\n\n if (!currentMemberId) return null;\n\n return (\n <Drawer\n bottomGhostActionDisabled={bulkLoading || loading}\n bottomGhostActionLoading={bulkLoading}\n bottomGhostActionText=\"全部標為已讀\"\n bottomOnGhostActionClick={(): void => {\n void handleMarkAllRead();\n }}\n bottomOnPrimaryActionClick={(): void => {\n handleLoadMore();\n }}\n bottomPrimaryActionDisabled={!hasMore || loading}\n bottomPrimaryActionLoading={loading && hasMore}\n bottomPrimaryActionText={hasMore ? '載入更多' : '已顯示全部'}\n contentKey={`${filter}:${rows.length}`}\n filterAreaAllRadioLabel=\"全部\"\n filterAreaOnRadioChange={handleFilterChange}\n filterAreaReadRadioLabel=\"已讀\"\n filterAreaShow\n filterAreaUnreadRadioLabel=\"未讀\"\n filterAreaValue={filter}\n headerTitle=\"通知中心\"\n isBottomDisplay\n isHeaderDisplay\n onClose={close}\n open={isOpen}\n size=\"medium\"\n >\n <div role=\"list\">\n {error ? (\n <p\n role=\"alert\"\n style={{\n color: 'var(--mzn-color-text-error, #d92d20)',\n padding: '12px 16px',\n }}\n >\n {error}\n </p>\n ) : null}\n {groupedRows.length === 0 ? (\n <p\n style={{\n color: 'var(--mzn-color-text-secondary, #6b7280)',\n padding: '24px 16px',\n textAlign: 'center',\n }}\n >\n {loading ? '載入中…' : '目前沒有通知'}\n </p>\n ) : null}\n {groupedRows.map(([group, items], groupIndex) => (\n <Fragment key={group}>\n {items.map((record, itemIndex) => (\n <NotificationCenter\n appendTips={\n groupIndex === groupedRows.length - 1 &&\n itemIndex === items.length - 1 &&\n !hasMore\n ? '已顯示全部通知'\n : undefined\n }\n cancelButtonText={\n record.status !== 'READ' ? '標為已讀' : undefined\n }\n description={record.body}\n key={record.id}\n onCancel={\n record.status !== 'READ'\n ? (): void => {\n void handleMarkRead(record.id);\n }\n : undefined\n }\n onConfirm={\n record.instanceId\n ? (): void => {\n void handleOpenInstance(record);\n }\n : undefined\n }\n confirmButtonText={record.instanceId ? '查看案件' : undefined}\n prependTips={itemIndex === 0 ? TIME_GROUP_LABEL[group] : undefined}\n reference={record.id}\n severity={toSeverity(record.type)}\n showBadge={record.status !== 'READ'}\n timeStamp={record.createdAt}\n title={record.title}\n type=\"drawer\"\n />\n ))}\n </Fragment>\n ))}\n </div>\n </Drawer>\n );\n}\n\nfunction toSeverity(type: NotificationType): NotificationSeverity {\n if (type === 'SLA_OVERDUE') return 'error';\n if (type === 'SLA_WARNING') return 'warning';\n if (type === 'INSTANCE_COMPLETED') return 'success';\n return 'info';\n}\n\nfunction resolveTimeGroup(value: string, now: Date): TimeGroup {\n const notificationDate = new Date(value);\n if (Number.isNaN(notificationDate.getTime())) return 'earlier';\n const nowStartOfDay = new Date(now.getFullYear(), now.getMonth(), now.getDate());\n const notificationStartOfDay = new Date(\n notificationDate.getFullYear(),\n notificationDate.getMonth(),\n notificationDate.getDate(),\n );\n if (notificationStartOfDay.getTime() === nowStartOfDay.getTime()) return 'today';\n const yesterdayStartOfDay = new Date(nowStartOfDay);\n yesterdayStartOfDay.setDate(yesterdayStartOfDay.getDate() - 1);\n if (notificationStartOfDay.getTime() === yesterdayStartOfDay.getTime())\n return 'yesterday';\n const diffInDays =\n (now.getTime() - notificationDate.getTime()) / (1000 * 60 * 60 * 24);\n if (diffInDays <= 7) return 'past7Days';\n return 'earlier';\n}\n\nfunction readErrorMessage(error: unknown): string {\n return error instanceof Error ? error.message : '發生未知錯誤';\n}\n","'use client';\n\nimport type { ReactElement, ReactNode } from 'react';\nimport {\n CalendarConfigProviderMoment,\n CalendarLocale,\n} from '@mezzanine-ui/react/moment';\nimport { AuthProvider } from './auth-provider';\nimport { NotificationDrawer } from '../components/notification-drawer';\nimport { NotificationDrawerProvider } from './notification-drawer-provider';\nimport { NotificationUnreadProvider } from './notification-unread-provider';\n\ninterface ProvidersProps {\n readonly children: ReactNode;\n /** Override Mezzanine calendar locale. Defaults to `CalendarLocale.ZH_TW`. */\n readonly locale?: CalendarLocale;\n /**\n * Public paths that should not trigger redirect to `/login` when there\n * is no session. Forwarded to `<AuthProvider>`. Defaults to `['/login']`.\n */\n readonly publicPaths?: readonly string[];\n /** Where to send unauthenticated users. Defaults to `'/login'`. */\n readonly loginPath?: string;\n}\n\n/**\n * One-stop BPM admin provider stack. Wires:\n *\n * - Mezzanine UI calendar locale (moment-based, `ZH_TW` by default)\n * - `<AuthProvider>` (BPM session via REST `/auth/*`)\n * - `<NotificationUnreadProvider>` (polls unread count)\n * - `<NotificationDrawerProvider>` (controls drawer open/close state)\n * - `<NotificationDrawer />` mounted at the root so the host navigation\n * bell (`<BPMNotificationBellButton />` or any custom trigger calling\n * `useNotificationDrawer().open`) can open it.\n *\n * Consumer hosts wrap this **inside** a `<RouterAdapterProvider>` (provided\n * by the `pages/*` subpath shims when consuming via Next.js, or wired by\n * hand for other frameworks).\n */\nexport function Providers({\n children,\n locale = CalendarLocale.ZH_TW,\n publicPaths,\n loginPath,\n}: ProvidersProps): ReactElement {\n return (\n <CalendarConfigProviderMoment locale={locale}>\n <AuthProvider publicPaths={publicPaths} loginPath={loginPath}>\n <NotificationUnreadProvider>\n <NotificationDrawerProvider>\n {children}\n <NotificationDrawer />\n </NotificationDrawerProvider>\n </NotificationUnreadProvider>\n </AuthProvider>\n </CalendarConfigProviderMoment>\n );\n}\n","'use client';\n\nimport { useAuth } from './auth-provider';\n\n/**\n * Drop-in logout handler for host navigation menus. Wraps the BPM auth\n * context's logout flow — calls `logoutApi()` against the BPM REST\n * session endpoint, clears the in-memory member, then redirects to the\n * configured `loginPath`.\n *\n * Hosts mount this on their own logout buttons / menu items so they do\n * not need to touch `useAuth()` directly. To customize the post-logout\n * destination, override the `loginPath` prop on `<BPMNextProviders>` or\n * `<AuthProvider>`.\n */\nexport function useBPMLogout(): () => Promise<void> {\n const { logout } = useAuth();\n return logout;\n}\n","'use client';\n\nimport type { ApiMember } from '@rytass/bpm-core-client';\nimport { useAuth } from './auth-provider';\n\n/**\n * Read the currently authenticated BPM member. Returns `null` when there\n * is no active session — typically only seen on the login page or during\n * the brief loading window before `<AuthProvider>` resolves the cookie.\n *\n * Convenience alias for `useAuth().member` aimed at host navigations\n * (avatar, display name, role-based menu visibility) that should not\n * depend on the broader `useAuth()` surface.\n */\nexport function useBPMMember(): ApiMember | null {\n const { member } = useAuth();\n return member;\n}\n",".root {\n display: inline-flex;\n position: relative;\n}\n\n.badge {\n align-items: center;\n background: #d92d20;\n border: 1px solid #fff;\n border-radius: 999px;\n color: #fff;\n display: inline-flex;\n font-size: 10px;\n font-weight: 600;\n height: 16px;\n justify-content: center;\n line-height: 1;\n min-width: 16px;\n padding: 0 4px;\n pointer-events: none;\n position: absolute;\n right: -4px;\n top: -4px;\n}\n","'use client';\n\nimport type { ReactElement } from 'react';\nimport { NavigationIconButton } from '@mezzanine-ui/react';\nimport { NotificationUnreadIcon } from '@mezzanine-ui/icons';\nimport { useNotificationDrawer } from '../lib/notification-drawer-provider';\nimport { useNotificationUnread } from '../lib/notification-unread-provider';\nimport styles from './bpm-notification-bell-button.module.scss';\n\nexport interface BPMNotificationBellButtonProps {\n /** Override the aria-label / tooltip. Defaults to `通知中心`. */\n readonly label?: string;\n}\n\n/**\n * Drop-in notification bell. Reads the unread count from\n * `<NotificationUnreadProvider>`, opens the BPM `<NotificationDrawer />`\n * mounted by `<Providers>` (or `<BPMNextProviders>`) on click, and\n * renders a small red badge with the unread count.\n *\n * Use this when the host navigation wants the BPM notification UX with\n * minimum wiring. Hosts that need a fully custom button can skip this\n * widget and consume `useNotificationDrawer()` + `useNotificationUnread()`\n * directly to wire their own trigger.\n *\n * Visual: uses Mezzanine `NavigationIconButton` so the bell aligns with\n * surrounding Mezzanine navigation chrome. The button is decoupled from\n * the `<Navigation>` container — it does not require a Mezzanine\n * navigation tree to render.\n */\nexport function BPMNotificationBellButton({\n label = '通知中心',\n}: BPMNotificationBellButtonProps = {}): ReactElement {\n const { open } = useNotificationDrawer();\n const { unreadCount } = useNotificationUnread();\n const ariaLabel = unreadCount > 0 ? `${label},${unreadCount} 則未讀` : label;\n return (\n <span className={styles.root}>\n <NavigationIconButton\n aria-label={ariaLabel}\n icon={NotificationUnreadIcon}\n onClick={(): void => {\n open();\n }}\n title={label}\n type=\"button\"\n />\n {unreadCount > 0 ? (\n <span className={styles.badge}>\n {unreadCount > 99 ? '99+' : unreadCount}\n </span>\n ) : null}\n </span>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAmBA,IAAM,IACJ,EAAqD,IAAI;AAgB3D,SAAgB,EAA2B,EACzC,eACgD;CAChD,IAAM,CAAC,GAAQ,KAAa,EAAS,EAAK,GAEpC,IAAO,QAAwB;EACnC,EAAU,EAAI;CAChB,GAAG,CAAC,CAAC,GACC,IAAQ,QAAwB;EACpC,EAAU,EAAK;CACjB,GAAG,CAAC,CAAC,GACC,IAAS,QAAwB;EACrC,GAAW,MAAY,CAAC,CAAO;CACjC,GAAG,CAAC,CAAC,GAEC,IAAQ,SACL;EAAE;EAAO;EAAQ;EAAM;CAAO,IACrC;EAAC;EAAO;EAAQ;EAAM;CAAM,CAC9B;CAEA,OACE,kBAAC,EAA0B,UAA3B;EAA2C;EACxC;CACiC,CAAA;AAExC;AAMA,SAAgB,IAAwD;CAUtE,OATgB,EAAW,CACtB,KACI;EACL,aAAmB,KAAA;EACnB,QAAQ;EACR,YAAkB,KAAA;EAClB,cAAoB,KAAA;CACtB;AAGJ;;;AC1DA,IAAM,IACJ,EAAqD,IAAI;AAe3D,SAAgB,EAA2B,EACzC,eACgD;CAChD,IAAM,EAAE,cAAW,EAAQ,GACrB,IAAkB,GAAQ,YAAY,MACtC,CAAC,GAAa,KAAkB,EAAS,CAAC,GAE1C,IAAqB,EAAY,YAA6B;EAClE,IAAI,CAAC,GAEH,OADA,EAAe,CAAC,GACT;EAET,IAAM,IAAO,MAAM,EAA4B,CAAe;EAE9D,OADA,EAAe,CAAI,GACZ;CACT,GAAG,CAAC,CAAe,CAAC;CAEpB,QAA8B;EAC5B,IAAI,IAAS;EASb,QARM,YAAY;GAChB,IAAI;IACF,IAAM,IAAO,M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;aACrB,IAAc,KAAK,QAAQ;EACxB,CAAA,IACJ,IACA;;AAEV"}
@@ -11,8 +11,9 @@ interface NotificationDrawerProviderProps {
11
11
  /**
12
12
  * Controls the open/closed state of the BPM notification drawer. Wraps
13
13
  * children with a context that `<NotificationDrawer />` reads to mount /
14
- * hide itself, and that `<AppLayout />` reads to open the drawer when
15
- * the bell icon is clicked.
14
+ * hide itself, and that the host navigation reads (via
15
+ * `<BPMNotificationBellButton />` or `useNotificationDrawer().open`) to
16
+ * open the drawer when the bell icon is clicked.
16
17
  *
17
18
  * When used outside this provider, the returned hook is a safe no-op so
18
19
  * components don't crash in test or storybook environments.
@@ -8,11 +8,12 @@ interface NotificationUnreadProviderProps {
8
8
  }
9
9
  /**
10
10
  * Polls BPM for the current member's unread notification count via
11
- * `readUnreadNotificationCount` and exposes it through context for
12
- * `<AppLayout />` (bell badge) and `<NotificationDrawer />` (header
13
- * count). Refresh is triggered on mount and whenever the auth member id
14
- * changes; consumers can call `refreshUnreadCount()` after acknowledging
15
- * a notification.
11
+ * `readUnreadNotificationCount` and exposes it through context for the
12
+ * host navigation (`<BPMNotificationBellButton />` badge or any custom
13
+ * trigger using `useNotificationUnread().unreadCount`) and the BPM
14
+ * `<NotificationDrawer />` (header count). Refresh is triggered on
15
+ * mount and whenever the auth member id changes; consumers can call
16
+ * `refreshUnreadCount()` after acknowledging a notification.
16
17
  */
17
18
  export declare function NotificationUnreadProvider({ children, }: NotificationUnreadProviderProps): ReactElement;
18
19
  /**
@@ -19,8 +19,9 @@ interface ProvidersProps {
19
19
  * - `<AuthProvider>` (BPM session via REST `/auth/*`)
20
20
  * - `<NotificationUnreadProvider>` (polls unread count)
21
21
  * - `<NotificationDrawerProvider>` (controls drawer open/close state)
22
- * - `<NotificationDrawer />` mounted at the root so the bell-icon button in
23
- * `<AppLayout />` can open it.
22
+ * - `<NotificationDrawer />` mounted at the root so the host navigation
23
+ * bell (`<BPMNotificationBellButton />` or any custom trigger calling
24
+ * `useNotificationDrawer().open`) can open it.
24
25
  *
25
26
  * Consumer hosts wrap this **inside** a `<RouterAdapterProvider>` (provided
26
27
  * by the `pages/*` subpath shims when consuming via Next.js, or wired by
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Drop-in logout handler for host navigation menus. Wraps the BPM auth
3
+ * context's logout flow — calls `logoutApi()` against the BPM REST
4
+ * session endpoint, clears the in-memory member, then redirects to the
5
+ * configured `loginPath`.
6
+ *
7
+ * Hosts mount this on their own logout buttons / menu items so they do
8
+ * not need to touch `useAuth()` directly. To customize the post-logout
9
+ * destination, override the `loginPath` prop on `<BPMNextProviders>` or
10
+ * `<AuthProvider>`.
11
+ */
12
+ export declare function useBPMLogout(): () => Promise<void>;
@@ -0,0 +1,11 @@
1
+ import { ApiMember } from '@rytass/bpm-core-client';
2
+ /**
3
+ * Read the currently authenticated BPM member. Returns `null` when there
4
+ * is no active session — typically only seen on the login page or during
5
+ * the brief loading window before `<AuthProvider>` resolves the cookie.
6
+ *
7
+ * Convenience alias for `useAuth().member` aimed at host navigations
8
+ * (avatar, display name, role-based menu visibility) that should not
9
+ * depend on the broader `useAuth()` surface.
10
+ */
11
+ export declare function useBPMMember(): ApiMember | null;
@@ -1,2 +1,2 @@
1
- Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("../../../chunks/delegations-CvtwTXNP.cjs");let t=require("react/jsx-runtime");var n={title:`代理設定 | BPM Admin`,description:`設定簽核代理規則,讓符合範圍的待簽任務自動改派給代理人。`};function r(){return(0,t.jsx)(e.t,{})}exports.default=r,exports.metadata=n;
1
+ Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("../../../chunks/delegations-DwbYkNUg.cjs");let t=require("react/jsx-runtime");var n={title:`代理設定 | BPM Admin`,description:`設定簽核代理規則,讓符合範圍的待簽任務自動改派給代理人。`};function r(){return(0,t.jsx)(e.t,{})}exports.default=r,exports.metadata=n;
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1,4 +1,4 @@
1
- import { t as e } from "../../../chunks/delegations-B2j-wNEO.js";
1
+ import { t as e } from "../../../chunks/delegations-D5pPEWsP.js";
2
2
  import { jsx as t } from "react/jsx-runtime";
3
3
  //#region src/pages/admin/delegations/index.tsx
4
4
  var n = {
@@ -1,2 +1,2 @@
1
- Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("../../../chunks/orgs-YMiVLNvL.cjs");let t=require("react/jsx-runtime");var n={title:`組織管理 | BPM Admin`,description:`維護組織樹、職位、會員歸屬與簽核主管解析規則。`};function r(){return(0,t.jsx)(e.t,{})}exports.default=r,exports.metadata=n;
1
+ Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("../../../chunks/orgs-BIiqzHvb.cjs");let t=require("react/jsx-runtime");var n={title:`組織管理 | BPM Admin`,description:`維護組織樹、職位、會員歸屬與簽核主管解析規則。`};function r(){return(0,t.jsx)(e.t,{})}exports.default=r,exports.metadata=n;
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1,4 +1,4 @@
1
- import { t as e } from "../../../chunks/orgs-CuHxxd_n.js";
1
+ import { t as e } from "../../../chunks/orgs-Cc18umVt.js";
2
2
  import { jsx as t } from "react/jsx-runtime";
3
3
  //#region src/pages/admin/orgs/index.tsx
4
4
  var n = {
@@ -1,2 +1,2 @@
1
- Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("../../../chunks/users-3ySyUW4u.cjs");let t=require("react/jsx-runtime");var n={title:`會員對照 | BPM Admin`,description:`檢視 BPM 內部會員組織歸屬與主管解析。`};function r(){return(0,t.jsx)(e.t,{})}exports.default=r,exports.metadata=n;
1
+ Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("../../../chunks/users-qghSMtLn.cjs");let t=require("react/jsx-runtime");var n={title:`會員對照 | BPM Admin`,description:`檢視 BPM 內部會員組織歸屬與主管解析。`};function r(){return(0,t.jsx)(e.t,{})}exports.default=r,exports.metadata=n;
2
2
  //# sourceMappingURL=index.cjs.map