@rytass/bpm-core-react 0.20.1 → 0.21.1

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 (176) hide show
  1. package/CHANGELOG.md +80 -0
  2. package/README.md +1 -1
  3. package/dist/approval-instance-list-page.css +1 -1
  4. package/dist/chunks/{FormBuilderView-CFRiw04B.js → FormBuilderView-6KdApi-D.js} +667 -584
  5. package/dist/chunks/FormBuilderView-6KdApi-D.js.map +1 -0
  6. package/dist/chunks/FormBuilderView-CGKkuVFi.cjs +4 -0
  7. package/dist/chunks/FormBuilderView-CGKkuVFi.cjs.map +1 -0
  8. package/dist/chunks/{FormRendererView-lYSaR8CQ.cjs → FormRendererView-B-xycC9S.cjs} +3 -3
  9. package/dist/chunks/{FormRendererView-lYSaR8CQ.cjs.map → FormRendererView-B-xycC9S.cjs.map} +1 -1
  10. package/dist/chunks/{FormRendererView-GfbVWEGa.js → FormRendererView-BcQKUi1A.js} +238 -238
  11. package/dist/chunks/{FormRendererView-GfbVWEGa.js.map → FormRendererView-BcQKUi1A.js.map} +1 -1
  12. package/dist/chunks/approval-instance-list-page-BI5fIXc-.js +724 -0
  13. package/dist/chunks/approval-instance-list-page-BI5fIXc-.js.map +1 -0
  14. package/dist/chunks/approval-instance-list-page-Cv5I1YPX.cjs +2 -0
  15. package/dist/chunks/approval-instance-list-page-Cv5I1YPX.cjs.map +1 -0
  16. package/dist/chunks/{categories-DQUtVEiV.cjs → categories-CyyqG6wG.cjs} +2 -2
  17. package/dist/chunks/{categories-DQUtVEiV.cjs.map → categories-CyyqG6wG.cjs.map} +1 -1
  18. package/dist/chunks/{categories-BAdxjNSA.js → categories-f7E-RJEc.js} +9 -9
  19. package/dist/chunks/{categories-BAdxjNSA.js.map → categories-f7E-RJEc.js.map} +1 -1
  20. package/dist/chunks/{compose-egQlRjuZ.js → compose-DFuLPmOA.js} +5 -5
  21. package/dist/chunks/{compose-egQlRjuZ.js.map → compose-DFuLPmOA.js.map} +1 -1
  22. package/dist/chunks/compose-DK3ocWwG.cjs +2 -0
  23. package/dist/chunks/compose-DK3ocWwG.cjs.map +1 -0
  24. package/dist/chunks/{delegations-CVmtpkRn.cjs → delegations-ClRCwD1I.cjs} +2 -2
  25. package/dist/chunks/{delegations-CVmtpkRn.cjs.map → delegations-ClRCwD1I.cjs.map} +1 -1
  26. package/dist/chunks/{delegations-9-yvWWws.js → delegations-CqND-Qtz.js} +5 -5
  27. package/dist/chunks/{delegations-9-yvWWws.js.map → delegations-CqND-Qtz.js.map} +1 -1
  28. package/dist/chunks/{delegations-CrfjsH94.cjs → delegations-D43VDSz1.cjs} +2 -2
  29. package/dist/chunks/{delegations-CrfjsH94.cjs.map → delegations-D43VDSz1.cjs.map} +1 -1
  30. package/dist/chunks/{delegations-CxnNvTCc.js → delegations-zisffLwk.js} +5 -5
  31. package/dist/chunks/{delegations-CxnNvTCc.js.map → delegations-zisffLwk.js.map} +1 -1
  32. package/dist/chunks/designer-CAUWEKJ4.cjs +69 -0
  33. package/dist/chunks/designer-CAUWEKJ4.cjs.map +1 -0
  34. package/dist/chunks/{designer-CZDlQ9Nf.js → designer-CCy5EbOe.js} +2380 -1786
  35. package/dist/chunks/designer-CCy5EbOe.js.map +1 -0
  36. package/dist/chunks/detail-C5KrUC7s.cjs +5 -0
  37. package/dist/chunks/detail-C5KrUC7s.cjs.map +1 -0
  38. package/dist/chunks/{detail-ByZV1XaI.js → detail-Dnc4PPWO.js} +804 -777
  39. package/dist/chunks/detail-Dnc4PPWO.js.map +1 -0
  40. package/dist/chunks/instance-error-message-BEM4O_Kj.js +208 -0
  41. package/dist/chunks/instance-error-message-BEM4O_Kj.js.map +1 -0
  42. package/dist/chunks/instance-error-message-BpCLCOjp.cjs +2 -0
  43. package/dist/chunks/instance-error-message-BpCLCOjp.cjs.map +1 -0
  44. package/dist/chunks/organization-time-zone-provider-B7CXQril.cjs +2 -0
  45. package/dist/chunks/organization-time-zone-provider-B7CXQril.cjs.map +1 -0
  46. package/dist/chunks/organization-time-zone-provider-DNL8yo4-.js +42 -0
  47. package/dist/chunks/organization-time-zone-provider-DNL8yo4-.js.map +1 -0
  48. package/dist/chunks/{providers-BbCs23sk.js → providers-CQWekD7_.js} +197 -196
  49. package/dist/chunks/providers-CQWekD7_.js.map +1 -0
  50. package/dist/chunks/providers-VUOh6i0i.cjs +2 -0
  51. package/dist/chunks/providers-VUOh6i0i.cjs.map +1 -0
  52. package/dist/components/approval-instance-field-filter-controls.d.cts +12 -0
  53. package/dist/components/approval-instance-field-filter-controls.d.ts +12 -0
  54. package/dist/components/approval-instance-field-filters.d.cts +86 -0
  55. package/dist/components/approval-instance-field-filters.d.ts +86 -0
  56. package/dist/components/approval-instance-list-page.d.cts +4 -0
  57. package/dist/components/approval-instance-list-page.d.ts +4 -0
  58. package/dist/components/notification-drawer-options.d.cts +18 -0
  59. package/dist/components/notification-drawer-options.d.ts +18 -0
  60. package/dist/index.cjs +1 -1
  61. package/dist/index.cjs.map +1 -1
  62. package/dist/index.d.cts +1 -0
  63. package/dist/index.d.ts +1 -0
  64. package/dist/index.js +23 -23
  65. package/dist/index.js.map +1 -1
  66. package/dist/lib/organization-time-zone-provider.d.cts +20 -0
  67. package/dist/lib/organization-time-zone-provider.d.ts +20 -0
  68. package/dist/lib/organization-time-zone.d.cts +8 -0
  69. package/dist/lib/organization-time-zone.d.ts +8 -0
  70. package/dist/lib/providers.d.cts +10 -1
  71. package/dist/lib/providers.d.ts +10 -1
  72. package/dist/next/BPMNextProviders.d.cts +8 -1
  73. package/dist/next/BPMNextProviders.d.ts +8 -1
  74. package/dist/next/index.cjs +1 -1
  75. package/dist/next/index.cjs.map +1 -1
  76. package/dist/next/index.js +12 -11
  77. package/dist/next/index.js.map +1 -1
  78. package/dist/next/workflow-chat-route.cjs +2 -2
  79. package/dist/next/workflow-chat-route.cjs.map +1 -1
  80. package/dist/next/workflow-chat-route.js +13 -13
  81. package/dist/pages/admin/delegations/index.cjs +1 -1
  82. package/dist/pages/admin/delegations/index.js +1 -1
  83. package/dist/pages/delegations/index.cjs +1 -1
  84. package/dist/pages/delegations/index.js +1 -1
  85. package/dist/pages/instances/detail/index.cjs +1 -1
  86. package/dist/pages/instances/detail/index.js +1 -1
  87. package/dist/pages/templates/categories/index.cjs +1 -1
  88. package/dist/pages/templates/categories/index.js +1 -1
  89. package/dist/pages/templates/compose/index.cjs +1 -1
  90. package/dist/pages/templates/compose/index.js +1 -1
  91. package/dist/pages/templates/designer/index.cjs +1 -1
  92. package/dist/pages/templates/designer/index.js +1 -1
  93. package/dist/views/admin/delegations/index.cjs +1 -1
  94. package/dist/views/admin/delegations/index.js +1 -1
  95. package/dist/views/admin/index.cjs +1 -1
  96. package/dist/views/admin/index.js +1 -1
  97. package/dist/views/admin/webhook-endpoints/index.cjs +1 -1
  98. package/dist/views/admin/webhook-endpoints/index.cjs.map +1 -1
  99. package/dist/views/admin/webhook-endpoints/index.js +60 -60
  100. package/dist/views/admin/webhook-endpoints/index.js.map +1 -1
  101. package/dist/views/cc/index.cjs +1 -1
  102. package/dist/views/cc/index.js +1 -1
  103. package/dist/views/delegations/index.cjs +1 -1
  104. package/dist/views/delegations/index.js +1 -1
  105. package/dist/views/forms/builder/FormBuilderView.d.cts +8 -1
  106. package/dist/views/forms/builder/FormBuilderView.d.ts +8 -1
  107. package/dist/views/forms/builder/index.cjs +1 -1
  108. package/dist/views/forms/builder/index.js +1 -1
  109. package/dist/views/forms/renderer/index.cjs +1 -1
  110. package/dist/views/forms/renderer/index.js +1 -1
  111. package/dist/views/instances/approver-filled-form.d.cts +8 -5
  112. package/dist/views/instances/approver-filled-form.d.ts +8 -5
  113. package/dist/views/instances/detail/index.cjs +1 -1
  114. package/dist/views/instances/detail/index.js +1 -1
  115. package/dist/views/instances/detail/sections/InstanceTasksSection.d.cts +2 -1
  116. package/dist/views/instances/detail/sections/InstanceTasksSection.d.ts +2 -1
  117. package/dist/views/instances/detail/sections/shared.d.cts +0 -1
  118. package/dist/views/instances/detail/sections/shared.d.ts +0 -1
  119. package/dist/views/instances/new/index.cjs +1 -1
  120. package/dist/views/instances/new/index.cjs.map +1 -1
  121. package/dist/views/instances/new/index.js +8 -8
  122. package/dist/views/instances/new/index.js.map +1 -1
  123. package/dist/views/search/index.cjs +1 -1
  124. package/dist/views/search/index.js +1 -1
  125. package/dist/views/sent/index.cjs +1 -1
  126. package/dist/views/sent/index.js +1 -1
  127. package/dist/views/templates/categories/index.cjs +1 -1
  128. package/dist/views/templates/categories/index.js +1 -1
  129. package/dist/views/templates/compose/index.cjs +1 -1
  130. package/dist/views/templates/compose/index.js +1 -1
  131. package/dist/views/templates/designer/NotifyWebhookTargetsEditor.d.cts +2 -0
  132. package/dist/views/templates/designer/NotifyWebhookTargetsEditor.d.ts +2 -0
  133. package/dist/views/templates/designer/approver-resolver-model.d.cts +105 -1
  134. package/dist/views/templates/designer/approver-resolver-model.d.ts +105 -1
  135. package/dist/views/templates/designer/dynamic-form-resolver-options.d.cts +5 -0
  136. package/dist/views/templates/designer/dynamic-form-resolver-options.d.ts +5 -0
  137. package/dist/views/templates/designer/index.cjs +1 -1
  138. package/dist/views/templates/designer/index.js +1 -1
  139. package/dist/views/templates/designer/node-actor-resolver-options.d.cts +44 -1
  140. package/dist/views/templates/designer/node-actor-resolver-options.d.ts +44 -1
  141. package/dist/views/templates/designer/notify-recipient-options.d.cts +81 -0
  142. package/dist/views/templates/designer/notify-recipient-options.d.ts +81 -0
  143. package/dist/views/templates/designer/position-level-options.d.cts +3 -1
  144. package/dist/views/templates/designer/position-level-options.d.ts +3 -1
  145. package/dist/views/templates/designer/position-scope.d.cts +51 -0
  146. package/dist/views/templates/designer/position-scope.d.ts +51 -0
  147. package/dist/views/templates/index.cjs +1 -1
  148. package/dist/views/templates/index.cjs.map +1 -1
  149. package/dist/views/templates/index.js +7 -7
  150. package/package.json +3 -3
  151. package/dist/chunks/FormBuilderView-CFRiw04B.js.map +0 -1
  152. package/dist/chunks/FormBuilderView-CpUgbSbt.cjs +0 -3
  153. package/dist/chunks/FormBuilderView-CpUgbSbt.cjs.map +0 -1
  154. package/dist/chunks/approval-instance-list-page-BnI4t5mD.js +0 -279
  155. package/dist/chunks/approval-instance-list-page-BnI4t5mD.js.map +0 -1
  156. package/dist/chunks/approval-instance-list-page-fqvmkBlg.cjs +0 -2
  157. package/dist/chunks/approval-instance-list-page-fqvmkBlg.cjs.map +0 -1
  158. package/dist/chunks/compose-Bb5bUVFd.cjs +0 -2
  159. package/dist/chunks/compose-Bb5bUVFd.cjs.map +0 -1
  160. package/dist/chunks/designer-CX9bhYJS.cjs +0 -69
  161. package/dist/chunks/designer-CX9bhYJS.cjs.map +0 -1
  162. package/dist/chunks/designer-CZDlQ9Nf.js.map +0 -1
  163. package/dist/chunks/detail-ByZV1XaI.js.map +0 -1
  164. package/dist/chunks/detail-ChseSF55.cjs +0 -5
  165. package/dist/chunks/detail-ChseSF55.cjs.map +0 -1
  166. package/dist/chunks/instance-error-message-DTARGbGo.cjs +0 -2
  167. package/dist/chunks/instance-error-message-DTARGbGo.cjs.map +0 -1
  168. package/dist/chunks/instance-error-message-q6gy5evy.js +0 -120
  169. package/dist/chunks/instance-error-message-q6gy5evy.js.map +0 -1
  170. package/dist/chunks/language-provider-Bdnx3Gxl.cjs +0 -2
  171. package/dist/chunks/language-provider-Bdnx3Gxl.cjs.map +0 -1
  172. package/dist/chunks/language-provider-phkWOapf.js +0 -17
  173. package/dist/chunks/language-provider-phkWOapf.js.map +0 -1
  174. package/dist/chunks/providers-BbCs23sk.js.map +0 -1
  175. package/dist/chunks/providers-D_KAgOOu.cjs +0 -2
  176. package/dist/chunks/providers-D_KAgOOu.cjs.map +0 -1
@@ -1,28 +1,28 @@
1
1
  "use client";
2
2
  import { n as e, t } from "./auth-provider-C2b-5mGt.js";
3
- import { r as n, t as r } from "./language-provider-phkWOapf.js";
4
- import { r as i } from "./router-adapter-CkxCyzf5.js";
5
- import { r as a } from "./routes-config-BcNaWJWJ.js";
6
- import { t as o } from "./bpm-form-field-9B-Det0u.js";
7
- import { Fragment as s, createContext as c, useCallback as l, useContext as u, useEffect as ee, useMemo as d, useState as f } from "react";
8
- import { Typography as te } from "@mezzanine-ui/react";
9
- import { Fragment as ne, jsx as p, jsxs as m } from "react/jsx-runtime";
10
- import { archiveNotifications as re, decideTask as ie, listNotifications as ae, markAllNotificationsRead as oe, markNotificationRead as h, readUnreadNotificationCount as g, unarchiveNotifications as se } from "@rytass/bpm-core-client/workflow";
11
- import { CalendarConfigProviderMoment as _, CalendarLocale as v } from "@mezzanine-ui/react/moment";
3
+ import { a as n, r, t as i } from "./organization-time-zone-provider-DNL8yo4-.js";
4
+ import { r as a } from "./router-adapter-CkxCyzf5.js";
5
+ import { r as o } from "./routes-config-BcNaWJWJ.js";
6
+ import { t as s } from "./bpm-form-field-9B-Det0u.js";
7
+ import { Fragment as c, createContext as l, useCallback as u, useContext as d, useEffect as f, useMemo as p, useState as m } from "react";
8
+ import { Typography as ee } from "@mezzanine-ui/react";
9
+ import { Fragment as te, jsx as h, jsxs as g } from "react/jsx-runtime";
10
+ import { archiveNotifications as ne, decideTask as re, listNotifications as ie, markAllNotificationsRead as ae, markNotificationRead as oe, readUnreadNotificationCount as _, unarchiveNotifications as se } from "@rytass/bpm-core-client/workflow";
11
+ import { CalendarConfigProviderMoment as v, CalendarLocale as y } from "@mezzanine-ui/react/moment";
12
12
  import ce from "@mezzanine-ui/react/Drawer";
13
- import y from "@mezzanine-ui/react/Modal";
13
+ import b from "@mezzanine-ui/react/Modal";
14
14
  import le from "@mezzanine-ui/react/NotificationCenter";
15
- import b from "@mezzanine-ui/react/Textarea";
15
+ import x from "@mezzanine-ui/react/Textarea";
16
16
  // src/lib/notification-drawer-provider.tsx
17
- var x = c(null);
18
- function S({ children: e }) {
19
- let [t, n] = f(!1), r = l(() => {
17
+ var S = l(null);
18
+ function C({ children: e }) {
19
+ let [t, n] = m(!1), r = u(() => {
20
20
  n(!0);
21
- }, []), i = l(() => {
21
+ }, []), i = u(() => {
22
22
  n(!1);
23
- }, []), a = l(() => {
23
+ }, []), a = u(() => {
24
24
  n((e) => !e);
25
- }, []), o = d(() => ({
25
+ }, []), o = p(() => ({
26
26
  close: i,
27
27
  isOpen: t,
28
28
  open: r,
@@ -33,13 +33,13 @@ function S({ children: e }) {
33
33
  r,
34
34
  a
35
35
  ]);
36
- return /* @__PURE__ */ p(x.Provider, {
36
+ return /* @__PURE__ */ h(S.Provider, {
37
37
  value: o,
38
38
  children: e
39
39
  });
40
40
  }
41
- function C() {
42
- return u(x) || {
41
+ function w() {
42
+ return d(S) || {
43
43
  close: () => void 0,
44
44
  isOpen: !1,
45
45
  open: () => void 0,
@@ -47,14 +47,14 @@ function C() {
47
47
  };
48
48
  }
49
49
  // src/lib/notification-unread-provider.tsx
50
- var w = c(null);
51
- function T({ children: t }) {
52
- let { member: n } = e(), r = n?.memberId ?? null, [i, a] = f(0), o = l(async () => {
50
+ var T = l(null);
51
+ function E({ children: t }) {
52
+ let { member: n } = e(), r = n?.memberId ?? null, [i, a] = m(0), o = u(async () => {
53
53
  if (!r) return a(0), 0;
54
- let e = await g(r);
54
+ let e = await _(r);
55
55
  return a(e), e;
56
56
  }, [r]);
57
- ee(() => {
57
+ f(() => {
58
58
  let e = !0;
59
59
  return (async () => {
60
60
  try {
@@ -67,47 +67,36 @@ function T({ children: t }) {
67
67
  e = !1;
68
68
  };
69
69
  }, [o]);
70
- let s = d(() => ({
70
+ let s = p(() => ({
71
71
  refreshUnreadCount: o,
72
72
  unreadCount: i
73
73
  }), [o, i]);
74
- return /* @__PURE__ */ p(w.Provider, {
74
+ return /* @__PURE__ */ h(T.Provider, {
75
75
  value: s,
76
76
  children: t
77
77
  });
78
78
  }
79
- function E() {
80
- return u(w) || {
79
+ function ue() {
80
+ return d(T) || {
81
81
  refreshUnreadCount: async () => 0,
82
82
  unreadCount: 0
83
83
  };
84
84
  }
85
- // src/components/notification-drawer.tsx
86
- var D = [
87
- "today",
88
- "yesterday",
89
- "past7Days",
90
- "earlier"
91
- ], ue = {
92
- earlier: "更早",
93
- past7Days: "過去七天",
94
- today: "今天",
95
- yesterday: "昨天"
96
- }, de = 50, fe = "toggleArchived";
97
- function pe(e) {
98
- let t = j(e) !== !1, n = e.actionable && !!e.instanceId && M(e);
85
+ // src/components/notification-drawer-options.ts
86
+ function de(e) {
87
+ let t = D(e), n = O(e, t) !== !1, r = e.actionable && !!e.instanceId && (k(t, "hasFillableFields") || k(t, "requireApprovalComment"));
99
88
  return [
100
- ...e.actionable ? [n ? {
89
+ ...e.actionable ? [r ? {
101
90
  id: "view",
102
91
  name: "開啟案件"
103
92
  } : {
104
93
  id: "approve",
105
94
  name: "同意"
106
- }, ...t ? [{
95
+ }, ...n ? [{
107
96
  id: "reject",
108
97
  name: "拒絕"
109
98
  }] : []] : [],
110
- ...e.instanceId && !n ? [{
99
+ ...e.instanceId && !r ? [{
111
100
  id: "view",
112
101
  name: "查看案件"
113
102
  }] : [],
@@ -124,127 +113,155 @@ function pe(e) {
124
113
  }
125
114
  ];
126
115
  }
127
- var me = {
116
+ function D(e) {
117
+ try {
118
+ let t = JSON.parse(e.payloadJson);
119
+ return A(t) ? t : null;
120
+ } catch {
121
+ return null;
122
+ }
123
+ }
124
+ function O(e, t) {
125
+ return t && typeof t.allowReject == "boolean" ? t.allowReject : e.allowReject;
126
+ }
127
+ function k(e, t) {
128
+ return e !== null && e[t] === !0;
129
+ }
130
+ function A(e) {
131
+ return typeof e == "object" && !!e && !Array.isArray(e);
132
+ }
133
+ // src/components/notification-drawer.tsx
134
+ var fe = [
135
+ "today",
136
+ "yesterday",
137
+ "past7Days",
138
+ "earlier"
139
+ ], pe = {
140
+ earlier: "更早",
141
+ past7Days: "過去七天",
142
+ today: "今天",
143
+ yesterday: "昨天"
144
+ }, me = 50, he = "toggleArchived", j = {
128
145
  APPROVED: "簽核任務已同意",
129
146
  REJECTED: "簽核任務已拒絕",
130
147
  RETURNED: "簽核任務已退回",
131
148
  SUPERSEDED: "簽核任務已結束",
132
149
  TRANSFERRED: "簽核任務已轉派"
133
150
  };
134
- function he(e) {
135
- return e.resolution ? me[e.resolution] : e.title;
151
+ function M(e) {
152
+ return e.resolution ? j[e.resolution] : e.title;
136
153
  }
137
154
  function ge(e) {
138
- return e.resolution === "APPROVED" ? "success" : e.resolution === "REJECTED" ? "error" : e.resolution ? "info" : k(e.type);
155
+ return e.resolution === "APPROVED" ? "success" : e.resolution === "REJECTED" ? "error" : e.resolution ? "info" : P(e.type);
139
156
  }
140
- function O() {
141
- let t = i(), n = a(), { member: r } = e(), { close: c, isOpen: u } = C(), { refreshUnreadCount: g } = E(), _ = r?.memberId ?? null, [v, x] = f([]), [S, w] = f(0), [T, me] = f(1), [O, k] = f(!1), [j, M] = f(!1), [N, P] = f(null), [F, I] = f(null), [L, ve] = f("all"), [R, ye] = f(!1), [z, B] = f(null), [be, V] = f(""), [H, U] = f(null), [W, G] = f(""), [K, q] = f(!1), xe = be.trim(), J = W.trim(), Y = l(async (e, t) => {
157
+ function N() {
158
+ let t = a(), n = o(), { member: r } = e(), { close: i, isOpen: l } = w(), { refreshUnreadCount: d } = ue(), _ = r?.memberId ?? null, [v, y] = m([]), [S, C] = m(0), [T, E] = m(1), [D, O] = m(!1), [k, A] = m(!1), [j, N] = m(null), [P, I] = m(null), [L, ve] = m("all"), [R, ye] = m(!1), [z, B] = m(null), [V, H] = m(""), [U, W] = m(null), [be, G] = m(""), [K, q] = m(!1), xe = V.trim(), J = be.trim(), Y = u(async (e, t) => {
142
159
  if (!_) return !1;
143
- k(!0), P(null);
160
+ O(!0), N(null);
144
161
  try {
145
- let n = await ae({
162
+ let n = await ie({
146
163
  includeArchived: R,
147
164
  includeRead: !0,
148
165
  page: e,
149
- pageSize: de,
166
+ pageSize: me,
150
167
  recipientMemberId: _
151
168
  });
152
- return x((e) => t ? [...e, ...n.notifications] : n.notifications), w(n.totalCount), me(e), await g(), !0;
169
+ return y((e) => t ? [...e, ...n.notifications] : n.notifications), C(n.totalCount), E(e), await d(), !0;
153
170
  } catch (e) {
154
- return P(A(e)), !1;
171
+ return N(F(e)), !1;
155
172
  } finally {
156
- k(!1);
173
+ O(!1);
157
174
  }
158
175
  }, [
159
176
  _,
160
177
  R,
161
- g
178
+ d
162
179
  ]);
163
- ee(() => {
164
- u && _ && (P(null), I(null), Y(1, !1));
180
+ f(() => {
181
+ l && _ && (N(null), I(null), Y(1, !1));
165
182
  }, [
166
- u,
183
+ l,
167
184
  _,
168
185
  Y
169
186
  ]);
170
- let Se = l((e) => {
187
+ let Se = u((e) => {
171
188
  let t = e.target.value;
172
189
  (t === "all" || t === "read" || t === "unread") && ve(t);
173
- }, []), Ce = l(async () => {
174
- if (_ && !j) {
175
- M(!0), P(null);
190
+ }, []), Ce = u(async () => {
191
+ if (_ && !k) {
192
+ A(!0), N(null);
176
193
  try {
177
- await oe({ recipientMemberId: _ }), await Y(1, !1);
194
+ await ae({ recipientMemberId: _ }), await Y(1, !1);
178
195
  } catch (e) {
179
- P(A(e));
196
+ N(F(e));
180
197
  } finally {
181
- M(!1);
198
+ A(!1);
182
199
  }
183
200
  }
184
201
  }, [
185
- j,
202
+ k,
186
203
  _,
187
204
  Y
188
- ]), we = l(() => {
189
- O || Y(T + 1, !0);
205
+ ]), we = u(() => {
206
+ D || Y(T + 1, !0);
190
207
  }, [
191
- O,
208
+ D,
192
209
  Y,
193
210
  T
194
- ]), Te = l(async (e) => {
211
+ ]), Te = u(async (e) => {
195
212
  if (_) try {
196
- await h({
213
+ await oe({
197
214
  id: e,
198
215
  readerMemberId: _
199
216
  }), await Y(1, !1);
200
217
  } catch (e) {
201
- P(A(e));
218
+ N(F(e));
202
219
  }
203
- }, [_, Y]), Ee = l(async (e) => {
220
+ }, [_, Y]), Ee = u(async (e) => {
204
221
  if (_) {
205
- P(null), I(null);
222
+ N(null), I(null);
206
223
  try {
207
- let t = he(e);
208
- e.archivedAt ? (await se({ ids: [e.id] }), I(`已將「${t}」移出封存。`)) : (await re({ ids: [e.id] }), I(`已封存「${t}」。`)), await Y(1, !1);
224
+ let t = M(e);
225
+ e.archivedAt ? (await se({ ids: [e.id] }), I(`已將「${t}」移出封存。`)) : (await ne({ ids: [e.id] }), I(`已封存「${t}」。`)), await Y(1, !1);
209
226
  } catch (e) {
210
- P(A(e));
227
+ N(F(e));
211
228
  }
212
229
  }
213
- }, [_, Y]), De = l((e) => {
214
- e.id === fe && (I(null), ye((e) => !e));
215
- }, []), X = l(async (e) => {
230
+ }, [_, Y]), De = u((e) => {
231
+ e.id === he && (I(null), ye((e) => !e));
232
+ }, []), X = u(async (e) => {
216
233
  if (e.instanceId && _) try {
217
- e.status !== "READ" && (await h({
234
+ e.status !== "READ" && (await oe({
218
235
  id: e.id,
219
236
  readerMemberId: _
220
- }), await g()), c(), t.push(n.caseDetail(e.instanceId));
237
+ }), await d()), i(), t.push(n.caseDetail(e.instanceId));
221
238
  } catch (e) {
222
- P(A(e));
239
+ N(F(e));
223
240
  }
224
241
  }, [
225
- c,
242
+ i,
226
243
  _,
227
- g,
244
+ d,
228
245
  t,
229
246
  n
230
- ]), Z = l((e) => {
231
- P(null), B(e), V("");
232
- }, []), Oe = l(() => {
233
- K || (B(null), V(""));
234
- }, [K]), ke = l(async () => {
247
+ ]), Oe = u((e) => {
248
+ N(null), B(e), H("");
249
+ }, []), ke = u(() => {
250
+ K || (B(null), H(""));
251
+ }, [K]), Ae = u(async () => {
235
252
  let e = z;
236
253
  if (e?.taskId && _ && !K) {
237
- q(!0), P(null), I(null);
254
+ q(!0), N(null), I(null);
238
255
  try {
239
- if (await ie({
256
+ if (await re({
240
257
  action: "APPROVED",
241
258
  comment: xe || null,
242
259
  decidedByMemberId: _,
243
260
  taskId: e.taskId
244
261
  }), !await Y(1, !1)) return;
245
- B(null), V(""), I(`已同意「${e.title}」。`);
262
+ B(null), H(""), I(`已同意「${e.title}」。`);
246
263
  } catch (e) {
247
- P(A(e));
264
+ N(F(e));
248
265
  } finally {
249
266
  q(!1);
250
267
  }
@@ -255,23 +272,23 @@ function O() {
255
272
  K,
256
273
  Y,
257
274
  xe
258
- ]), Ae = l((e) => {
259
- U(e), G("");
260
- }, []), je = l(() => {
261
- U(null), G("");
262
- }, []), Me = l(async () => {
263
- let e = H;
275
+ ]), je = u((e) => {
276
+ W(e), G("");
277
+ }, []), Me = u(() => {
278
+ W(null), G("");
279
+ }, []), Ne = u(async () => {
280
+ let e = U;
264
281
  if (e?.taskId && _ && J && !K) {
265
- q(!0), P(null), I(null);
282
+ q(!0), N(null), I(null);
266
283
  try {
267
- await ie({
284
+ await re({
268
285
  action: "REJECTED",
269
286
  comment: J,
270
287
  decidedByMemberId: _,
271
288
  taskId: e.taskId
272
- }), U(null), G(""), I(`已拒絕「${e.title}」。`), await Y(1, !1);
289
+ }), W(null), G(""), I(`已拒絕「${e.title}」。`), await Y(1, !1);
273
290
  } catch (e) {
274
- P(A(e));
291
+ N(F(e));
275
292
  } finally {
276
293
  q(!1);
277
294
  }
@@ -280,36 +297,36 @@ function O() {
280
297
  _,
281
298
  K,
282
299
  Y,
283
- H,
300
+ U,
284
301
  J
285
- ]), Ne = l((e, t) => {
302
+ ]), Pe = u((e, t) => {
286
303
  let n = t.id;
287
- n === "approve" ? Z(e) : n === "reject" ? Ae(e) : n === "view" ? X(e) : n === "read" ? Te(e.id) : (n === "archive" || n === "unarchive") && Ee(e);
304
+ n === "approve" ? Oe(e) : n === "reject" ? je(e) : n === "view" ? X(e) : n === "read" ? Te(e.id) : (n === "archive" || n === "unarchive") && Ee(e);
288
305
  }, [
289
306
  Ee,
290
307
  Te,
291
308
  X,
292
- Z,
293
- Ae
294
- ]), Q = l((e, t) => !(e instanceof Node) || !t.contains(e) ? !1 : !(e instanceof Element && e.closest("button")), []), Pe = l((e, t) => {
295
- Q(t.target, t.currentTarget) && X(e);
296
- }, [X, Q]), Fe = l((e, t) => {
297
- (t.key === "Enter" || t.key === " ") && Q(t.target, t.currentTarget) && (t.preventDefault(), X(e));
298
- }, [X, Q]), Ie = d(() => v.filter((e) => L === "all" ? !0 : L === "read" ? e.status === "READ" : e.status !== "READ"), [L, v]), Le = d(() => {
299
- let e = /* @__PURE__ */ new Date(), t = D.reduce((e, t) => (e[t] = [], e), {
309
+ Oe,
310
+ je
311
+ ]), Z = u((e, t) => !(e instanceof Node) || !t.contains(e) ? !1 : !(e instanceof Element && e.closest("button")), []), Fe = u((e, t) => {
312
+ Z(t.target, t.currentTarget) && X(e);
313
+ }, [X, Z]), Ie = u((e, t) => {
314
+ (t.key === "Enter" || t.key === " ") && Z(t.target, t.currentTarget) && (t.preventDefault(), X(e));
315
+ }, [X, Z]), Le = p(() => v.filter((e) => L === "all" ? !0 : L === "read" ? e.status === "READ" : e.status !== "READ"), [L, v]), Q = p(() => {
316
+ let e = /* @__PURE__ */ new Date(), t = fe.reduce((e, t) => (e[t] = [], e), {
300
317
  earlier: [],
301
318
  past7Days: [],
302
319
  today: [],
303
320
  yesterday: []
304
321
  });
305
- return Ie.forEach((n) => {
322
+ return Le.forEach((n) => {
306
323
  t[_e(n.createdAt, e)].push(n);
307
- }), D.map((e) => [e, t[e]]).filter(([, e]) => e.length > 0);
308
- }, [Ie]), $ = v.length < S;
309
- return _ ? /* @__PURE__ */ m(ne, { children: [
310
- /* @__PURE__ */ p(ce, {
311
- bottomGhostActionDisabled: j || O,
312
- bottomGhostActionLoading: j,
324
+ }), fe.map((e) => [e, t[e]]).filter(([, e]) => e.length > 0);
325
+ }, [Le]), $ = v.length < S;
326
+ return _ ? /* @__PURE__ */ g(te, { children: [
327
+ /* @__PURE__ */ h(ce, {
328
+ bottomGhostActionDisabled: k || D,
329
+ bottomGhostActionLoading: k,
313
330
  bottomGhostActionText: "全部標為已讀",
314
331
  bottomOnGhostActionClick: () => {
315
332
  Ce();
@@ -317,15 +334,15 @@ function O() {
317
334
  bottomOnPrimaryActionClick: () => {
318
335
  we();
319
336
  },
320
- bottomPrimaryActionDisabled: !$ || O,
321
- bottomPrimaryActionLoading: O && $,
337
+ bottomPrimaryActionDisabled: !$ || D,
338
+ bottomPrimaryActionLoading: D && $,
322
339
  bottomPrimaryActionText: $ ? "載入更多" : "已顯示全部",
323
340
  contentKey: `${L}:${R}:${v.length}`,
324
341
  filterAreaAllRadioLabel: "全部",
325
342
  filterAreaOnRadioChange: Se,
326
343
  filterAreaOnSelect: De,
327
344
  filterAreaOptions: [{
328
- id: fe,
345
+ id: he,
329
346
  name: R ? "隱藏已封存" : "顯示已封存"
330
347
  }],
331
348
  filterAreaReadRadioLabel: "已讀",
@@ -335,61 +352,61 @@ function O() {
335
352
  headerTitle: "通知中心",
336
353
  isBottomDisplay: !0,
337
354
  isHeaderDisplay: !0,
338
- onClose: c,
339
- open: u,
355
+ onClose: i,
356
+ open: l,
340
357
  size: "medium",
341
- children: /* @__PURE__ */ m("div", {
358
+ children: /* @__PURE__ */ g("div", {
342
359
  role: "list",
343
360
  children: [
344
- N ? /* @__PURE__ */ p("p", {
361
+ j ? /* @__PURE__ */ h("p", {
345
362
  role: "alert",
346
363
  style: {
347
364
  color: "var(--mzn-color-text-error, #d92d20)",
348
365
  padding: "12px 16px"
349
366
  },
350
- children: N
367
+ children: j
351
368
  }) : null,
352
- F ? /* @__PURE__ */ p("p", {
369
+ P ? /* @__PURE__ */ h("p", {
353
370
  role: "status",
354
371
  style: {
355
372
  color: "var(--mzn-color-text-success, #079455)",
356
373
  padding: "12px 16px"
357
374
  },
358
- children: F
375
+ children: P
359
376
  }) : null,
360
- Le.length === 0 ? /* @__PURE__ */ p("p", {
377
+ Q.length === 0 ? /* @__PURE__ */ h("p", {
361
378
  style: {
362
379
  color: "var(--mzn-color-text-secondary, #6b7280)",
363
380
  padding: "24px 16px",
364
381
  textAlign: "center"
365
382
  },
366
- children: O ? "載入中…" : "目前沒有通知"
383
+ children: D ? "載入中…" : "目前沒有通知"
367
384
  }) : null,
368
- Le.map(([e, t]) => /* @__PURE__ */ p(s, { children: t.map((t, n) => {
385
+ Q.map(([e, t]) => /* @__PURE__ */ h(c, { children: t.map((t, n) => {
369
386
  let r = t.instanceId !== null;
370
- return /* @__PURE__ */ p("div", {
387
+ return /* @__PURE__ */ h("div", {
371
388
  onClick: r ? (e) => {
372
- Pe(t, e);
389
+ Fe(t, e);
373
390
  } : void 0,
374
391
  onKeyDown: r ? (e) => {
375
- Fe(t, e);
392
+ Ie(t, e);
376
393
  } : void 0,
377
394
  role: r ? "button" : void 0,
378
395
  style: r ? { cursor: "pointer" } : void 0,
379
396
  tabIndex: r ? 0 : void 0,
380
- children: /* @__PURE__ */ p(le, {
397
+ children: /* @__PURE__ */ h(le, {
381
398
  appendTips: t.archivedAt ? "已封存" : void 0,
382
399
  description: t.body,
383
400
  onBadgeSelect: (e) => {
384
- Ne(t, e);
401
+ Pe(t, e);
385
402
  },
386
- options: [...pe(t)],
387
- prependTips: n === 0 ? ue[e] : void 0,
403
+ options: [...de(t)],
404
+ prependTips: n === 0 ? pe[e] : void 0,
388
405
  reference: t.id,
389
406
  severity: ge(t),
390
407
  showBadge: t.status !== "READ",
391
408
  timeStamp: t.createdAt,
392
- title: he(t),
409
+ title: M(t),
393
410
  type: "drawer"
394
411
  })
395
412
  }, t.id);
@@ -397,15 +414,15 @@ function O() {
397
414
  ]
398
415
  })
399
416
  }),
400
- /* @__PURE__ */ m(y, {
417
+ /* @__PURE__ */ g(b, {
401
418
  cancelText: "取消",
402
419
  confirmText: "送出同意",
403
420
  loading: K,
404
421
  modalType: "standard",
405
- onCancel: Oe,
406
- onClose: Oe,
422
+ onCancel: ke,
423
+ onClose: ke,
407
424
  onConfirm: () => {
408
- ke();
425
+ Ae();
409
426
  },
410
427
  open: z !== null,
411
428
  showModalFooter: !0,
@@ -413,26 +430,26 @@ function O() {
413
430
  size: "regular",
414
431
  supportingText: "可以留下同意說明,內容會記錄在簽核歷程;不填也可以直接送出。",
415
432
  title: "簽核意見",
416
- children: [N ? /* @__PURE__ */ p(te, {
433
+ children: [j ? /* @__PURE__ */ h(ee, {
417
434
  color: "text-error",
418
435
  role: "alert",
419
436
  variant: "body",
420
- children: N
421
- }) : null, /* @__PURE__ */ p(o, {
437
+ children: j
438
+ }) : null, /* @__PURE__ */ h(s, {
422
439
  label: "簽核意見",
423
440
  name: "notificationApproveComment",
424
- children: /* @__PURE__ */ p(b, {
441
+ children: /* @__PURE__ */ h(x, {
425
442
  autoFocus: !0,
426
443
  onChange: (e) => {
427
- V(e.target.value);
444
+ H(e.target.value);
428
445
  },
429
446
  placeholder: "選填,例如補充核准條件或提醒事項",
430
447
  rows: 4,
431
- value: be
448
+ value: V
432
449
  })
433
450
  })]
434
451
  }),
435
- /* @__PURE__ */ p(y, {
452
+ /* @__PURE__ */ h(b, {
436
453
  cancelText: "取消",
437
454
  confirmButtonProps: {
438
455
  disabled: !J,
@@ -442,30 +459,30 @@ function O() {
442
459
  loading: K,
443
460
  modalStatusType: "error",
444
461
  modalType: "standard",
445
- onCancel: je,
446
- onClose: je,
462
+ onCancel: Me,
463
+ onClose: Me,
447
464
  onConfirm: () => {
448
- Me();
465
+ Ne();
449
466
  },
450
- open: H !== null,
467
+ open: U !== null,
451
468
  showModalFooter: !0,
452
469
  showModalHeader: !0,
453
470
  size: "regular",
454
471
  supportingText: "拒絕案件時必須留下原因,供發起人與後續追蹤查看。",
455
472
  title: "拒絕原因",
456
- children: /* @__PURE__ */ p(b, {
473
+ children: /* @__PURE__ */ h(x, {
457
474
  autoFocus: !0,
458
475
  onChange: (e) => {
459
476
  G(e.target.value);
460
477
  },
461
478
  placeholder: "請輸入拒絕原因",
462
479
  rows: 4,
463
- value: W
480
+ value: be
464
481
  })
465
482
  })
466
483
  ] }) : null;
467
484
  }
468
- function k(e) {
485
+ function P(e) {
469
486
  return e === "SLA_OVERDUE" ? "error" : e === "SLA_WARNING" ? "warning" : e === "INSTANCE_COMPLETED" ? "success" : "info";
470
487
  }
471
488
  function _e(e, t) {
@@ -476,42 +493,26 @@ function _e(e, t) {
476
493
  let a = new Date(r);
477
494
  return a.setDate(a.getDate() - 1), i.getTime() === a.getTime() ? "yesterday" : (t.getTime() - n.getTime()) / 864e5 <= 7 ? "past7Days" : "earlier";
478
495
  }
479
- function A(e) {
496
+ function F(e) {
480
497
  return e instanceof Error ? e.message : "發生未知錯誤";
481
498
  }
482
- function j(e) {
483
- try {
484
- let t = JSON.parse(e.payloadJson);
485
- return N(t) && typeof t.allowReject == "boolean" ? t.allowReject : e.allowReject;
486
- } catch {
487
- return e.allowReject;
488
- }
489
- }
490
- function M(e) {
491
- try {
492
- let t = JSON.parse(e.payloadJson);
493
- return N(t) && t.hasFillableFields === !0;
494
- } catch {
495
- return !1;
496
- }
497
- }
498
- function N(e) {
499
- return typeof e == "object" && !!e && !Array.isArray(e);
500
- }
501
499
  // src/lib/providers.tsx
502
- function P({ children: e, locale: i = v.ZH_TW, language: a = n, publicPaths: o, loginPath: s }) {
503
- return /* @__PURE__ */ p(_, {
504
- locale: i,
505
- children: /* @__PURE__ */ p(r, {
506
- language: a,
507
- children: /* @__PURE__ */ p(t, {
508
- publicPaths: o,
509
- loginPath: s,
510
- children: /* @__PURE__ */ p(T, { children: /* @__PURE__ */ m(S, { children: [e, /* @__PURE__ */ p(O, {})] }) })
500
+ function I({ children: e, locale: a = y.ZH_TW, language: o = n, organizationTimeZone: s, publicPaths: c, loginPath: l }) {
501
+ return /* @__PURE__ */ h(v, {
502
+ locale: a,
503
+ children: /* @__PURE__ */ h(r, {
504
+ language: o,
505
+ children: /* @__PURE__ */ h(i, {
506
+ timeZone: s,
507
+ children: /* @__PURE__ */ h(t, {
508
+ publicPaths: c,
509
+ loginPath: l,
510
+ children: /* @__PURE__ */ h(E, { children: /* @__PURE__ */ g(C, { children: [e, /* @__PURE__ */ h(N, {})] }) })
511
+ })
511
512
  })
512
513
  })
513
514
  });
514
515
  }
515
- export { S as a, E as i, O as n, C as o, T as r, P as t };
516
+ export { C as a, ue as i, N as n, w as o, E as r, I as t };
516
517
 
517
- //# sourceMappingURL=providers-BbCs23sk.js.map
518
+ //# sourceMappingURL=providers-CQWekD7_.js.map