@declarion/react 0.86.0 → 0.88.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 (90) hide show
  1. package/dist-lib/app.js +28 -28
  2. package/dist-lib/components/actions/ActionButton.js +86 -85
  3. package/dist-lib/components/actions/ActionResultDialog.impl.js +47 -47
  4. package/dist-lib/components/actions/ActionRunner.js +47 -47
  5. package/dist-lib/components/actions/ObjectActionBar.js +9 -9
  6. package/dist-lib/components/actions/RowActionsKebab.js +19 -19
  7. package/dist-lib/components/agents/AgentChatPanel.impl.js +53 -53
  8. package/dist-lib/components/chrome/AssociationTabs.js +21 -21
  9. package/dist-lib/components/chrome/RecordHeader.js +33 -40
  10. package/dist-lib/components/detail-layout/AssociatedBlock.js +387 -381
  11. package/dist-lib/components/detail-layout/ChildrenBlock.js +12 -13
  12. package/dist-lib/components/detail-layout/ChildrenTimeline.js +198 -198
  13. package/dist-lib/components/detail-layout/DraggableChildrenTable.js +114 -114
  14. package/dist-lib/components/detail-layout/EditableChildrenTable.js +160 -160
  15. package/dist-lib/components/detail-layout/EvidenceBlock.js +20 -21
  16. package/dist-lib/components/detail-layout/PropertiesBlock.js +45 -39
  17. package/dist-lib/components/detail-layout/QuickAddForm.js +9 -9
  18. package/dist-lib/components/detail-layout/TimelineComposer.js +87 -89
  19. package/dist-lib/components/detail-layout/widgets/EntityScorecardWidget.js +100 -99
  20. package/dist-lib/components/fields/FileReferenceField.js +9 -9
  21. package/dist-lib/components/fields/StructureField.js +57 -47
  22. package/dist-lib/components/fields/TimestampField.js +59 -54
  23. package/dist-lib/components/fields/cells/factories/money.js +14 -23
  24. package/dist-lib/components/fields/cells/factories/nextRun.js +1 -1
  25. package/dist-lib/components/fields/cells/factories/text.js +18 -3
  26. package/dist-lib/components/fields/cells/factories/timestamp.js +24 -12
  27. package/dist-lib/components/file-widgets/DocumentCard.js +108 -106
  28. package/dist-lib/components/layout/Layout.js +306 -361
  29. package/dist-lib/components/layout/Rail.js +42 -41
  30. package/dist-lib/components/layout/Sidebar.js +132 -117
  31. package/dist-lib/components/layout/TabStrip.js +116 -115
  32. package/dist-lib/components/layout/TenantChip.js +47 -54
  33. package/dist-lib/components/layout/TopBar.js +108 -105
  34. package/dist-lib/components/list/InlineEditCell.js +23 -23
  35. package/dist-lib/components/list/QuickPeek.js +65 -66
  36. package/dist-lib/components/pages/DocumentsMenu.js +42 -42
  37. package/dist-lib/components/pages/ExportMenu.js +25 -25
  38. package/dist-lib/components/pages/RecordDocumentsPanel.js +35 -35
  39. package/dist-lib/components/pages/RecordNotesPanel.js +94 -93
  40. package/dist-lib/components/pages/SmartDetailPage.impl.js +421 -417
  41. package/dist-lib/components/pages/SmartListPage.impl.js +293 -295
  42. package/dist-lib/components/pages/SmartRecordListPage.impl.js +310 -310
  43. package/dist-lib/components/pages/auth/AuthShell.js +73 -73
  44. package/dist-lib/components/pages/auth/SignIn.js +32 -32
  45. package/dist-lib/components/pages/auth/SignUp.impl.js +3 -3
  46. package/dist-lib/components/pages/auth/SignUpCode.js +9 -9
  47. package/dist-lib/components/pages/list/ListFloatbar.js +12 -12
  48. package/dist-lib/components/pages/list/ListHeader.js +19 -19
  49. package/dist-lib/components/pages/list/ListNoRows.js +15 -15
  50. package/dist-lib/components/pages/list/ListToolbar.js +145 -145
  51. package/dist-lib/components/pages/list/useActiveView.js +14 -5
  52. package/dist-lib/components/pages/list/useListQuery.js +121 -81
  53. package/dist-lib/components/pages/list/useListRowInteraction.js +70 -70
  54. package/dist-lib/components/pages/list/useRowMenu.js +7 -7
  55. package/dist-lib/components/pages/profile/Preferences.impl.js +81 -78
  56. package/dist-lib/components/pages/profile/Profile.impl.js +191 -189
  57. package/dist-lib/components/pages/tenant-params/TenantParamsPage.impl.js +166 -158
  58. package/dist-lib/components/shared/ChangePasswordDialog.impl.js +23 -23
  59. package/dist-lib/components/shared/MarkdownRenderer.js +9 -9
  60. package/dist-lib/hooks/useAuth.js +11 -11
  61. package/dist-lib/hooks/useBranding.js +4 -4
  62. package/dist-lib/hooks/useDisplayTimeZone.js +8 -0
  63. package/dist-lib/hooks/useFollowAgentOpen.js +24 -24
  64. package/dist-lib/hooks/useImpersonation.js +6 -6
  65. package/dist-lib/hooks/useMutations.js +23 -23
  66. package/dist-lib/hooks/useObjectStatus.js +5 -5
  67. package/dist-lib/hooks/useParams.js +59 -51
  68. package/dist-lib/hooks/useProperties.js +8 -8
  69. package/dist-lib/hooks/useRowTenant.js +18 -6
  70. package/dist-lib/hooks/useText.js +9 -7
  71. package/dist-lib/hooks/useUiPreferences.js +71 -0
  72. package/dist-lib/index.d.ts +22 -6
  73. package/dist-lib/index.js +127 -126
  74. package/dist-lib/lib/actions.js +116 -84
  75. package/dist-lib/lib/child-config.js +10 -1
  76. package/dist-lib/lib/format-count.js +16 -1
  77. package/dist-lib/lib/language.js +23 -21
  78. package/dist-lib/lib/money-text.js +29 -0
  79. package/dist-lib/lib/profile.js +4 -0
  80. package/dist-lib/lib/role-label.js +8 -0
  81. package/dist-lib/lib/schema-routing.js +34 -14
  82. package/dist-lib/lib/shortcut.js +10 -0
  83. package/dist-lib/lib/timestamp.js +93 -31
  84. package/dist-lib/stores/auth.js +9 -8
  85. package/dist-lib/stores/preferences.js +56 -17
  86. package/dist-lib/testing.d.ts +1 -1
  87. package/dist-lib/testing.js +25 -28
  88. package/dist-lib/types/schema.js +33 -27
  89. package/dist-lib/{useResponsiveMode-D3SKz5z4.d.ts → useResponsiveMode-9_eJT18k.d.ts} +5 -5
  90. package/package.json +1 -1
@@ -2,81 +2,83 @@ import { changePassword as e } from "../../../api/auth.js";
2
2
  import { useAuthStore as t } from "../../../stores/auth.js";
3
3
  import { useSchema as n } from "../../../hooks/useSchema.js";
4
4
  import { LANGUAGE_PARAMETER as r, pluralText as i } from "../../../lib/language.js";
5
- import { Icon as a } from "../../primitives/Icons.js";
6
- import { Btn as o } from "../../primitives/Btn.js";
7
- import { IconBtn as s } from "../../primitives/IconBtn.js";
8
- import { Pill as c } from "../../primitives/Pill.js";
9
- import { Chip as l } from "../../primitives/Chip.js";
10
- import { useText as u } from "../../../hooks/useText.js";
11
- import { SectionCard as d } from "../../primitives/SectionCard.js";
12
- import { useResponsiveMode as f } from "../../../hooks/useResponsiveMode.js";
13
- import { Spinner as p } from "../../primitives/Spinner.js";
14
- import { FieldLabel as m, TextInput as h } from "../../primitives/Fields.js";
15
- import { DynamicIcon as g } from "../../shared/DynamicIcon.js";
16
- import { updateEntity as _ } from "../../../api/data.js";
17
- import { failureTitle as v } from "../../../lib/failure.js";
18
- import { useAllParams as y } from "../../../hooks/useParams.js";
19
- import { useTabNavigate as b } from "../../../hooks/useTabNavigate.js";
20
- import { toast as x } from "../../../lib/toast.js";
21
- import { useBrandingChrome as S } from "../../../hooks/useBrandingChrome.js";
22
- import { useCurrentScreen as C } from "../../../hooks/useCurrentScreen.js";
23
- import { useObject as w } from "../../../hooks/useObject.js";
24
- import { FileDraftScope as T, useFileDraftScope as E } from "../../file-widgets/draft-scope.js";
25
- import { singleFileFromValue as D } from "../../file-widgets/value.js";
26
- import { getFileFieldValue as O, renderSchemaField as k } from "../../file-widgets/host.js";
27
- import { buildFilesPayload as A } from "../../file-widgets/payload.js";
28
- import { EMPTY_CELL as j } from "../../fields/cells/factories/emptyCell.js";
29
- import { ChangePasswordDialog as M } from "../../shared/ChangePasswordDialog.js";
30
- import { FieldRow as N, FieldsGrid as P } from "../../detail-layout/FieldRow.js";
31
- import { AssociatedBlock as F } from "../../detail-layout/AssociatedBlock.js";
32
- import { DetailAuditStrip as I } from "../../detail-layout/DetailAuditStrip.js";
33
- import { RecordHeader as L } from "../../chrome/RecordHeader.js";
34
- import { PageShell as R } from "../../chrome/PageShell.js";
35
- import { ErrorLine as z } from "../../params/param-editors.js";
36
- import { ParamsBlock as B } from "../../params/ParamsBlock.js";
37
- import { Fragment as V, useId as H, useState as U } from "react";
38
- import { Fragment as W, jsx as G, jsxs as K } from "react/jsx-runtime";
5
+ import { PROFILE_ENTITY as a } from "../../../lib/profile.js";
6
+ import { updateEntity as o } from "../../../api/data.js";
7
+ import { failureTitle as s } from "../../../lib/failure.js";
8
+ import { Icon as c } from "../../primitives/Icons.js";
9
+ import { Btn as l } from "../../primitives/Btn.js";
10
+ import { IconBtn as u } from "../../primitives/IconBtn.js";
11
+ import { Pill as d } from "../../primitives/Pill.js";
12
+ import { Chip as f } from "../../primitives/Chip.js";
13
+ import { useText as p } from "../../../hooks/useText.js";
14
+ import { SectionCard as m } from "../../primitives/SectionCard.js";
15
+ import { useResponsiveMode as h } from "../../../hooks/useResponsiveMode.js";
16
+ import { Spinner as g } from "../../primitives/Spinner.js";
17
+ import { FieldLabel as _, TextInput as v } from "../../primitives/Fields.js";
18
+ import { toast as y } from "../../../lib/toast.js";
19
+ import { useAllParams as b } from "../../../hooks/useParams.js";
20
+ import { DynamicIcon as x } from "../../shared/DynamicIcon.js";
21
+ import { useTabNavigate as S } from "../../../hooks/useTabNavigate.js";
22
+ import { activeRoleLabel as C } from "../../../lib/role-label.js";
23
+ import { useBrandingChrome as w } from "../../../hooks/useBrandingChrome.js";
24
+ import { useCurrentScreen as T } from "../../../hooks/useCurrentScreen.js";
25
+ import { useObject as E } from "../../../hooks/useObject.js";
26
+ import { FileDraftScope as D, useFileDraftScope as O } from "../../file-widgets/draft-scope.js";
27
+ import { singleFileFromValue as k } from "../../file-widgets/value.js";
28
+ import { getFileFieldValue as A, renderSchemaField as j } from "../../file-widgets/host.js";
29
+ import { buildFilesPayload as M } from "../../file-widgets/payload.js";
30
+ import { EMPTY_CELL as N } from "../../fields/cells/factories/emptyCell.js";
31
+ import { ChangePasswordDialog as P } from "../../shared/ChangePasswordDialog.js";
32
+ import { FieldRow as F, FieldsGrid as I } from "../../detail-layout/FieldRow.js";
33
+ import { AssociatedBlock as L } from "../../detail-layout/AssociatedBlock.js";
34
+ import { DetailAuditStrip as R } from "../../detail-layout/DetailAuditStrip.js";
35
+ import { RecordHeader as z } from "../../chrome/RecordHeader.js";
36
+ import { PageShell as B } from "../../chrome/PageShell.js";
37
+ import { ErrorLine as V } from "../../params/param-editors.js";
38
+ import { ParamsBlock as H } from "../../params/ParamsBlock.js";
39
+ import { Fragment as U, useId as W, useState as G } from "react";
40
+ import { Fragment as K, jsx as q, jsxs as J } from "react/jsx-runtime";
39
41
  //#region src/components/pages/profile/Profile.impl.tsx
40
- var q = "profile", J = "avatar";
41
- function Y() {
42
- let r = b(), s = t((e) => e.user), f = t((e) => e.activeTenant), p = t((e) => e.refreshMe), { data: m } = n(), h = C(), _ = S("custom"), v = u(), y = w(q, s?.id), E = y.data?.data, [D, O] = U(!1), [A, F] = U(!1), z = m?.entities[q], B = s?.display_name || s?.email || v("profile.user_fallback", "User"), V = (e) => s?.role_names?.[e] || e, H = s?.roles?.[0] && V(s.roles[0]) || v("profile.role_fallback", "Member"), J = f?.env ? `${f.name} · ${f.env}` : f?.name ?? "—", Y = (e) => z && k({
43
- entity: z,
44
- entityCode: q,
42
+ var Y = "avatar";
43
+ function X() {
44
+ let r = S(), o = t((e) => e.user), s = t((e) => e.activeTenant), u = t((e) => e.refreshMe), { data: h } = n(), g = T(), _ = w("custom"), v = p(), b = E(a, o?.id), O = b.data?.data, [k, A] = G(!1), [M, L] = G(!1), V = h?.entities[a], H = o?.display_name || o?.email || v("profile.user_fallback", "User"), U = (e) => v(o?.role_names?.[e]) || e, W = C(o, v), Y = s?.env ? `${s.name} · ${s.env}` : s?.name ?? "—", X = (e) => V && j({
45
+ entity: V,
46
+ entityCode: "profile",
45
47
  fieldName: e,
46
48
  record: {
47
- email: s?.email,
48
- display_name: s?.display_name
49
+ email: o?.email,
50
+ display_name: o?.display_name
49
51
  },
50
52
  mode: "display",
51
53
  t: v
52
54
  });
53
- return /* @__PURE__ */ K(W, { children: [
54
- /* @__PURE__ */ K(R, {
55
- header: /* @__PURE__ */ G("div", {
55
+ return /* @__PURE__ */ J(K, { children: [
56
+ /* @__PURE__ */ J(B, {
57
+ header: /* @__PURE__ */ q("div", {
56
58
  "data-testid": "profile-hero",
57
- children: /* @__PURE__ */ G(L, {
58
- icon: z?.display.icon ? /* @__PURE__ */ G(g, {
59
- name: z.display.icon,
59
+ children: /* @__PURE__ */ q(z, {
60
+ icon: V?.display.icon ? /* @__PURE__ */ q(x, {
61
+ name: V.display.icon,
60
62
  size: 16
61
63
  }) : void 0,
62
- title: B,
64
+ title: H,
63
65
  mode: "display",
64
66
  showTitle: _.isVisible("show_title"),
65
- highlights: /* @__PURE__ */ K("div", {
67
+ highlights: /* @__PURE__ */ J("div", {
66
68
  className: "flex flex-wrap gap-1",
67
69
  children: [
68
- /* @__PURE__ */ G(c, {
70
+ /* @__PURE__ */ q(d, {
69
71
  tone: "violet",
70
72
  size: "xs",
71
73
  dot: !0,
72
- children: H
74
+ children: W
73
75
  }),
74
- /* @__PURE__ */ G(c, {
76
+ /* @__PURE__ */ q(d, {
75
77
  tone: "slate",
76
78
  size: "xs",
77
- children: J
79
+ children: Y
78
80
  }),
79
- s?.is_active && /* @__PURE__ */ G(c, {
81
+ o?.is_active && /* @__PURE__ */ q(d, {
80
82
  tone: "emerald",
81
83
  size: "xs",
82
84
  dot: !0,
@@ -84,168 +86,168 @@ function Y() {
84
86
  })
85
87
  ]
86
88
  }),
87
- right: _.isVisible("show_actions") && /* @__PURE__ */ K(W, { children: [/* @__PURE__ */ G(o, {
88
- icon: /* @__PURE__ */ G(a.edit, { size: 13 }),
89
- onClick: () => F(!0),
89
+ right: _.isVisible("show_actions") && /* @__PURE__ */ J(K, { children: [/* @__PURE__ */ q(l, {
90
+ icon: /* @__PURE__ */ q(c.edit, { size: 13 }),
91
+ onClick: () => L(!0),
90
92
  children: v("profile.edit", "Edit profile")
91
- }), /* @__PURE__ */ G(o, {
92
- icon: /* @__PURE__ */ G(a.settings, { size: 13 }),
93
+ }), /* @__PURE__ */ q(l, {
94
+ icon: /* @__PURE__ */ q(c.settings, { size: 13 }),
93
95
  onClick: () => r("/preferences", { topLevel: !0 }),
94
96
  children: v("profile.preferences", "Preferences")
95
97
  })] })
96
98
  })
97
99
  }),
98
100
  children: [
99
- /* @__PURE__ */ G(d, {
101
+ /* @__PURE__ */ q(m, {
100
102
  title: v("profile.personal.title", "Personal info"),
101
- icon: /* @__PURE__ */ G(a.users, { size: 14 }),
102
- children: /* @__PURE__ */ G("div", {
103
+ icon: /* @__PURE__ */ q(c.users, { size: 14 }),
104
+ children: /* @__PURE__ */ q("div", {
103
105
  "data-testid": "profile-personal-info-grid",
104
- children: /* @__PURE__ */ K(P, { children: [
105
- s && z && E && /* @__PURE__ */ G(N, {
106
+ children: /* @__PURE__ */ J(I, { children: [
107
+ o && V && O && /* @__PURE__ */ q(F, {
106
108
  label: v("profile.avatar", "Avatar"),
107
- children: /* @__PURE__ */ G(T, { children: /* @__PURE__ */ G(Z, {
108
- userId: s.id,
109
- entity: z,
110
- record: E,
109
+ children: /* @__PURE__ */ q(D, { children: /* @__PURE__ */ q(ee, {
110
+ userId: o.id,
111
+ entity: V,
112
+ record: O,
111
113
  onCommitted: async () => {
112
- await y.refetch();
114
+ await b.refetch();
113
115
  }
114
- }, X(E)) })
116
+ }, Z(O)) })
115
117
  }),
116
- /* @__PURE__ */ G(N, {
118
+ /* @__PURE__ */ q(F, {
117
119
  label: v("profile.display_name", "Display name"),
118
- children: Y("display_name")
120
+ children: X("display_name")
119
121
  }),
120
- /* @__PURE__ */ G(N, {
122
+ /* @__PURE__ */ q(F, {
121
123
  label: v("profile.personal.email", "Email"),
122
124
  "data-testid": "profile-email",
123
- children: Y("email")
125
+ children: X("email")
124
126
  }),
125
- /* @__PURE__ */ G(N, {
127
+ /* @__PURE__ */ q(F, {
126
128
  label: v("profile.personal.timezone", "Timezone"),
127
- children: te()
129
+ children: ne()
128
130
  }),
129
- /* @__PURE__ */ G($, {})
131
+ /* @__PURE__ */ q($, {})
130
132
  ] })
131
133
  })
132
134
  }),
133
- /* @__PURE__ */ G(d, {
135
+ /* @__PURE__ */ q(m, {
134
136
  title: v("profile.security.title", "Security"),
135
- icon: /* @__PURE__ */ G(a.shield, { size: 14 }),
136
- children: /* @__PURE__ */ G(P, { children: /* @__PURE__ */ G(N, {
137
+ icon: /* @__PURE__ */ q(c.shield, { size: 14 }),
138
+ children: /* @__PURE__ */ q(I, { children: /* @__PURE__ */ q(F, {
137
139
  label: v("profile.security.password", "Password"),
138
140
  hint: v("profile.security.password_hint", "Update at any time"),
139
- children: /* @__PURE__ */ G(o, {
141
+ children: /* @__PURE__ */ q(l, {
140
142
  size: "xs",
141
- onClick: () => O(!0),
143
+ onClick: () => A(!0),
142
144
  children: v("profile.security.password_change", "Change")
143
145
  })
144
146
  }) })
145
147
  }),
146
- /* @__PURE__ */ G(d, {
148
+ /* @__PURE__ */ q(m, {
147
149
  title: v("profile.access.title", "Access"),
148
- icon: /* @__PURE__ */ G(a.key, { size: 14 }),
149
- children: /* @__PURE__ */ K(P, { children: [
150
- /* @__PURE__ */ G(N, {
150
+ icon: /* @__PURE__ */ q(c.key, { size: 14 }),
151
+ children: /* @__PURE__ */ J(I, { children: [
152
+ /* @__PURE__ */ q(F, {
151
153
  label: v("profile.access.role", "Role"),
152
- children: /* @__PURE__ */ G(c, {
154
+ children: /* @__PURE__ */ q(d, {
153
155
  tone: "violet",
154
156
  size: "xs",
155
157
  dot: !0,
156
- children: H
158
+ children: W
157
159
  })
158
160
  }),
159
- /* @__PURE__ */ G(N, {
161
+ /* @__PURE__ */ q(F, {
160
162
  label: v("profile.access.groups", "Groups"),
161
- children: s?.roles && s.roles.length > 0 ? /* @__PURE__ */ G("div", {
163
+ children: o?.roles && o.roles.length > 0 ? /* @__PURE__ */ q("div", {
162
164
  className: "flex flex-wrap gap-1",
163
- children: s.roles.map((e) => /* @__PURE__ */ G(l, { children: V(e) }, e))
164
- }) : j
165
+ children: o.roles.map((e) => /* @__PURE__ */ q(f, { children: U(e) }, e))
166
+ }) : N
165
167
  }),
166
- /* @__PURE__ */ G(N, {
168
+ /* @__PURE__ */ q(F, {
167
169
  label: v("profile.access.permissions", "Permissions"),
168
- children: i(v, "profile.access.permissions_explicit", s?.permissions?.length ?? 0, {
170
+ children: i(v, "profile.access.permissions_explicit", o?.permissions?.length ?? 0, {
169
171
  one: "{count} explicit",
170
172
  other: "{count} explicit"
171
173
  })
172
174
  })
173
175
  ] })
174
176
  }),
175
- /* @__PURE__ */ G(ne, { userId: s?.id }),
176
- s?.id && /* @__PURE__ */ G(Q, { userId: s.id }),
177
- h?.screen && m && z && E && /* @__PURE__ */ G(I, {
178
- screen: h.screen,
179
- entity: z,
180
- entityCode: q,
181
- record: E,
182
- recordId: s?.id,
183
- schema: m
177
+ /* @__PURE__ */ q(re, { userId: o?.id }),
178
+ o?.id && /* @__PURE__ */ q(Q, { userId: o.id }),
179
+ g?.screen && h && V && O && /* @__PURE__ */ q(R, {
180
+ screen: g.screen,
181
+ entity: V,
182
+ entityCode: "profile",
183
+ record: O,
184
+ recordId: o?.id,
185
+ schema: h
184
186
  })
185
187
  ]
186
188
  }),
187
- /* @__PURE__ */ G(ee, {
188
- open: A,
189
- initialName: s?.display_name ?? "",
190
- userId: s?.id ?? "",
191
- onClose: () => F(!1),
189
+ /* @__PURE__ */ q(te, {
190
+ open: M,
191
+ initialName: o?.display_name ?? "",
192
+ userId: o?.id ?? "",
193
+ onClose: () => L(!1),
192
194
  onSaved: async () => {
193
- await p(), F(!1);
195
+ await u(), L(!1);
194
196
  }
195
197
  }),
196
- /* @__PURE__ */ G(M, {
197
- open: D,
198
- onClose: () => O(!1),
198
+ /* @__PURE__ */ q(P, {
199
+ open: k,
200
+ onClose: () => A(!1),
199
201
  onSubmit: async ({ current: t, next: n }) => {
200
- await e(t, n), x.success(v("profile.password.changed", "Password changed. Sign in again to continue."));
202
+ await e(t, n), y.success(v("profile.password.changed", "Password changed. Sign in again to continue."));
201
203
  }
202
204
  })
203
205
  ] });
204
206
  }
205
- function X(e) {
206
- return D(O(e, J))?.id ?? "";
207
+ function Z(e) {
208
+ return k(A(e, Y))?.id ?? "";
207
209
  }
208
- function Z({ userId: e, entity: t, record: n, onCommitted: r }) {
209
- let i = u(), a = u("errors"), o = E(), [s, c] = U(!1), [l, d] = U(0), f = async (s) => {
210
- let l = A({
210
+ function ee({ userId: e, entity: t, record: n, onCommitted: r }) {
211
+ let i = p(), c = p("errors"), l = O(), [u, d] = G(!1), [f, m] = G(0), h = async (u) => {
212
+ let f = M({
211
213
  entity: t,
212
- formData: { [J]: s },
214
+ formData: { [Y]: u },
213
215
  record: n,
214
216
  isNew: !1
215
217
  });
216
- if (Object.keys(l).length !== 0) {
217
- c(!0);
218
+ if (Object.keys(f).length !== 0) {
219
+ d(!0);
218
220
  try {
219
- await _(q, { id: e }, { $files: l });
220
- let t = X({ [J]: s });
221
- t && o.markCommitted(t), await r(), x.success(i("profile.avatar.updated", "Avatar updated."));
221
+ await o(a, { id: e }, { $files: f });
222
+ let t = Z({ [Y]: u });
223
+ t && l.markCommitted(t), await r(), y.success(i("profile.avatar.updated", "Avatar updated."));
222
224
  } catch (e) {
223
- await o.flushAllDrafts(), d((e) => e + 1), x.error(v(a, e));
225
+ await l.flushAllDrafts(), m((e) => e + 1), y.error(s(c, e));
224
226
  } finally {
225
- c(!1);
227
+ d(!1);
226
228
  }
227
229
  }
228
230
  };
229
- return /* @__PURE__ */ G(V, { children: k({
231
+ return /* @__PURE__ */ q(U, { children: j({
230
232
  entity: t,
231
- entityCode: q,
232
- fieldName: J,
233
+ entityCode: a,
234
+ fieldName: Y,
233
235
  record: n,
234
236
  mode: "edit",
235
- onChange: (e) => void f(e),
236
- disabled: s,
237
+ onChange: (e) => void h(e),
238
+ disabled: u,
237
239
  t: i,
238
240
  fieldId: "profile-avatar"
239
- }) }, l);
241
+ }) }, f);
240
242
  }
241
- function ee({ open: e, initialName: t, userId: n, onClose: r, onSaved: i }) {
242
- let c = f().isPhone, l = u(), d = u("errors"), g = H(), [y, b] = U(t), [x, S] = U(!1), [C, w] = U(null);
243
+ function te({ open: e, initialName: t, userId: n, onClose: r, onSaved: i }) {
244
+ let d = h().isPhone, f = p(), m = p("errors"), y = W(), [b, x] = G(t), [S, C] = G(!1), [w, T] = G(null);
243
245
  if (!e) return null;
244
- let T = () => {
245
- b(t), w(null), r();
246
+ let E = () => {
247
+ x(t), T(null), r();
246
248
  };
247
- return /* @__PURE__ */ K(W, { children: [/* @__PURE__ */ G("div", {
248
- onClick: T,
249
+ return /* @__PURE__ */ J(K, { children: [/* @__PURE__ */ q("div", {
250
+ onClick: E,
249
251
  style: {
250
252
  position: "fixed",
251
253
  inset: 0,
@@ -253,7 +255,7 @@ function ee({ open: e, initialName: t, userId: n, onClose: r, onSaved: i }) {
253
255
  zIndex: 60,
254
256
  backdropFilter: "blur(2px)"
255
257
  }
256
- }), /* @__PURE__ */ K("div", {
258
+ }), /* @__PURE__ */ J("div", {
257
259
  "data-testid": "edit-profile-dialog",
258
260
  style: {
259
261
  position: "fixed",
@@ -261,7 +263,7 @@ function ee({ open: e, initialName: t, userId: n, onClose: r, onSaved: i }) {
261
263
  left: "50%",
262
264
  transform: "translate(-50%, -50%)",
263
265
  zIndex: 61,
264
- width: c ? "calc(100vw - 24px)" : 420,
266
+ width: d ? "calc(100vw - 24px)" : 420,
265
267
  maxWidth: "calc(100vw - 24px)",
266
268
  background: "var(--surface)",
267
269
  borderRadius: "var(--radius-lg)",
@@ -270,7 +272,7 @@ function ee({ open: e, initialName: t, userId: n, onClose: r, onSaved: i }) {
270
272
  overflow: "hidden"
271
273
  },
272
274
  children: [
273
- /* @__PURE__ */ K("div", {
275
+ /* @__PURE__ */ J("div", {
274
276
  style: {
275
277
  padding: "14px 18px 0",
276
278
  display: "flex",
@@ -278,7 +280,7 @@ function ee({ open: e, initialName: t, userId: n, onClose: r, onSaved: i }) {
278
280
  gap: 10
279
281
  },
280
282
  children: [
281
- /* @__PURE__ */ G("span", {
283
+ /* @__PURE__ */ q("span", {
282
284
  style: {
283
285
  width: 28,
284
286
  height: 28,
@@ -289,52 +291,52 @@ function ee({ open: e, initialName: t, userId: n, onClose: r, onSaved: i }) {
289
291
  alignItems: "center",
290
292
  justifyContent: "center"
291
293
  },
292
- children: /* @__PURE__ */ G(a.edit, { size: 15 })
294
+ children: /* @__PURE__ */ q(c.edit, { size: 15 })
293
295
  }),
294
- /* @__PURE__ */ K("div", {
296
+ /* @__PURE__ */ J("div", {
295
297
  style: { flex: 1 },
296
- children: [/* @__PURE__ */ G("div", {
298
+ children: [/* @__PURE__ */ q("div", {
297
299
  style: {
298
300
  fontSize: 14,
299
301
  fontWeight: 600,
300
302
  color: "var(--text)"
301
303
  },
302
- children: l("profile.edit", "Edit profile")
303
- }), /* @__PURE__ */ G("div", {
304
+ children: f("profile.edit", "Edit profile")
305
+ }), /* @__PURE__ */ q("div", {
304
306
  style: {
305
307
  fontSize: 11.5,
306
308
  color: "var(--text-3)"
307
309
  },
308
- children: l("profile.edit.subtitle", "Update your display name.")
310
+ children: f("profile.edit.subtitle", "Update your display name.")
309
311
  })]
310
312
  }),
311
- /* @__PURE__ */ G(s, {
312
- icon: /* @__PURE__ */ G(a.x, { size: 14 }),
313
- title: l("profile.edit.close", "Close"),
314
- onClick: T
313
+ /* @__PURE__ */ q(u, {
314
+ icon: /* @__PURE__ */ q(c.x, { size: 14 }),
315
+ title: f("profile.edit.close", "Close"),
316
+ onClick: E
315
317
  })
316
318
  ]
317
319
  }),
318
- /* @__PURE__ */ K("div", {
320
+ /* @__PURE__ */ J("div", {
319
321
  style: {
320
322
  padding: "12px 18px 16px",
321
323
  display: "flex",
322
324
  flexDirection: "column",
323
325
  gap: 12
324
326
  },
325
- children: [/* @__PURE__ */ K("div", { children: [/* @__PURE__ */ G(m, {
327
+ children: [/* @__PURE__ */ J("div", { children: [/* @__PURE__ */ q(_, {
326
328
  required: !0,
327
- htmlFor: g,
328
- children: l("profile.display_name", "Display name")
329
- }), /* @__PURE__ */ G(h, {
330
- id: g,
331
- value: y,
332
- onChange: b,
333
- placeholder: l("profile.edit.name_placeholder", "Your name"),
329
+ htmlFor: y,
330
+ children: f("profile.display_name", "Display name")
331
+ }), /* @__PURE__ */ q(v, {
332
+ id: y,
333
+ value: b,
334
+ onChange: x,
335
+ placeholder: f("profile.edit.name_placeholder", "Your name"),
334
336
  autoFocus: !0
335
- })] }), C && /* @__PURE__ */ G(z, { text: C })]
337
+ })] }), w && /* @__PURE__ */ q(V, { text: w })]
336
338
  }),
337
- /* @__PURE__ */ K("div", {
339
+ /* @__PURE__ */ J("div", {
338
340
  style: {
339
341
  padding: "10px 16px",
340
342
  borderTop: "1px solid var(--divider)",
@@ -342,39 +344,39 @@ function ee({ open: e, initialName: t, userId: n, onClose: r, onSaved: i }) {
342
344
  alignItems: "center",
343
345
  gap: 8,
344
346
  background: "var(--surface-2)",
345
- flexWrap: c ? "wrap" : "nowrap"
347
+ flexWrap: d ? "wrap" : "nowrap"
346
348
  },
347
349
  children: [
348
- /* @__PURE__ */ G("div", { style: { flex: 1 } }),
349
- /* @__PURE__ */ G(o, {
350
- onClick: T,
351
- children: l("dialog.cancel", "Cancel")
350
+ /* @__PURE__ */ q("div", { style: { flex: 1 } }),
351
+ /* @__PURE__ */ q(l, {
352
+ onClick: E,
353
+ children: f("dialog.cancel", "Cancel")
352
354
  }),
353
- /* @__PURE__ */ G(o, {
355
+ /* @__PURE__ */ q(l, {
354
356
  kind: "primary",
355
- icon: G(x ? p : a.check, { size: 13 }),
357
+ icon: q(S ? g : c.check, { size: 13 }),
356
358
  onClick: async () => {
357
- if (!y.trim()) w(l("profile.edit.name_required", "Display name is required."));
359
+ if (!b.trim()) T(f("profile.edit.name_required", "Display name is required."));
358
360
  else {
359
- w(null), S(!0);
361
+ T(null), C(!0);
360
362
  try {
361
- await _(q, { id: n }, { display_name: y.trim() }), await i();
363
+ await o(a, { id: n }, { display_name: b.trim() }), await i();
362
364
  } catch (e) {
363
- w(v(d, e));
365
+ T(s(m, e));
364
366
  } finally {
365
- S(!1);
367
+ C(!1);
366
368
  }
367
369
  }
368
370
  },
369
- disabled: !y.trim() || x,
370
- children: x ? l("dialog.saving", "Saving…") : l("dialog.save", "Save")
371
+ disabled: !b.trim() || S,
372
+ children: S ? f("dialog.saving", "Saving…") : f("dialog.save", "Save")
371
373
  })
372
374
  ]
373
375
  })
374
376
  ]
375
377
  })] });
376
378
  }
377
- function te() {
379
+ function ne() {
378
380
  try {
379
381
  return Intl.DateTimeFormat().resolvedOptions().timeZone || "—";
380
382
  } catch {
@@ -382,25 +384,25 @@ function te() {
382
384
  }
383
385
  }
384
386
  function Q({ userId: e }) {
385
- let { data: t } = n(), r = t?.entities[q]?.params_scope ?? q;
386
- return /* @__PURE__ */ G(B, {
387
- carrierEntityCode: q,
387
+ let { data: t } = n(), r = t?.entities.profile?.params_scope ?? "profile";
388
+ return /* @__PURE__ */ q(H, {
389
+ carrierEntityCode: a,
388
390
  carrierScope: r,
389
391
  rowId: e
390
392
  });
391
393
  }
392
394
  function $() {
393
- let e = u(), { data: t } = n(), i = y().data?.find((e) => e.code === r), a = typeof i?.value == "string" ? i.value : e.language, o = t?.languages?.find((e) => e.code === a);
394
- return /* @__PURE__ */ G(N, {
395
+ let e = p(), { data: t } = n(), i = b().data?.find((e) => e.code === r), a = typeof i?.value == "string" ? i.value : e.language, o = t?.languages?.find((e) => e.code === a);
396
+ return /* @__PURE__ */ q(F, {
395
397
  label: e(i?.name),
396
- children: i ? o?.name[o.code] || e(o?.name) || a : /* @__PURE__ */ G(p, { size: 12 })
398
+ children: i ? o?.name[o.code] || e(o?.name) || a : /* @__PURE__ */ q(g, { size: 12 })
397
399
  });
398
400
  }
399
- function ne({ userId: e }) {
401
+ function re({ userId: e }) {
400
402
  let { data: t } = n();
401
403
  if (!e || !t) return null;
402
- let r = t.entities[q];
403
- return r ? /* @__PURE__ */ G(F, {
404
+ let r = t.entities[a];
405
+ return r ? /* @__PURE__ */ q(L, {
404
406
  node: {
405
407
  associated: "api_key",
406
408
  foreign_key: "user_id"
@@ -408,7 +410,7 @@ function ne({ userId: e }) {
408
410
  ctx: {
409
411
  schema: t,
410
412
  entity: r,
411
- entityCode: q,
413
+ entityCode: a,
412
414
  recordId: e,
413
415
  record: { id: e },
414
416
  isNew: !1,
@@ -417,4 +419,4 @@ function ne({ userId: e }) {
417
419
  }) : null;
418
420
  }
419
421
  //#endregion
420
- export { Y as Profile, $ as ProfileLanguageRow, Q as ProfileParamsBlock };
422
+ export { X as Profile, $ as ProfileLanguageRow, Q as ProfileParamsBlock };