@declarion/react 0.87.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.
- package/dist-lib/app.js +28 -28
- package/dist-lib/components/actions/ActionButton.js +86 -85
- package/dist-lib/components/actions/ActionResultDialog.impl.js +47 -47
- package/dist-lib/components/actions/ActionRunner.js +47 -47
- package/dist-lib/components/actions/ObjectActionBar.js +9 -9
- package/dist-lib/components/actions/RowActionsKebab.js +19 -19
- package/dist-lib/components/agents/AgentChatPanel.impl.js +53 -53
- package/dist-lib/components/chrome/AssociationTabs.js +21 -21
- package/dist-lib/components/chrome/RecordHeader.js +33 -40
- package/dist-lib/components/detail-layout/AssociatedBlock.js +387 -381
- package/dist-lib/components/detail-layout/ChildrenBlock.js +12 -13
- package/dist-lib/components/detail-layout/ChildrenTimeline.js +198 -198
- package/dist-lib/components/detail-layout/DraggableChildrenTable.js +114 -114
- package/dist-lib/components/detail-layout/EditableChildrenTable.js +160 -160
- package/dist-lib/components/detail-layout/EvidenceBlock.js +20 -21
- package/dist-lib/components/detail-layout/PropertiesBlock.js +45 -39
- package/dist-lib/components/detail-layout/QuickAddForm.js +9 -9
- package/dist-lib/components/detail-layout/TimelineComposer.js +87 -89
- package/dist-lib/components/detail-layout/widgets/EntityScorecardWidget.js +100 -99
- package/dist-lib/components/fields/FileReferenceField.js +9 -9
- package/dist-lib/components/fields/StructureField.js +57 -47
- package/dist-lib/components/fields/TimestampField.js +59 -54
- package/dist-lib/components/fields/cells/factories/money.js +14 -23
- package/dist-lib/components/fields/cells/factories/nextRun.js +1 -1
- package/dist-lib/components/fields/cells/factories/text.js +18 -3
- package/dist-lib/components/fields/cells/factories/timestamp.js +24 -12
- package/dist-lib/components/file-widgets/DocumentCard.js +108 -106
- package/dist-lib/components/layout/Layout.js +306 -361
- package/dist-lib/components/layout/Rail.js +42 -41
- package/dist-lib/components/layout/Sidebar.js +132 -117
- package/dist-lib/components/layout/TabStrip.js +116 -115
- package/dist-lib/components/layout/TenantChip.js +47 -54
- package/dist-lib/components/layout/TopBar.js +108 -105
- package/dist-lib/components/list/InlineEditCell.js +23 -23
- package/dist-lib/components/list/QuickPeek.js +65 -66
- package/dist-lib/components/pages/DocumentsMenu.js +42 -42
- package/dist-lib/components/pages/ExportMenu.js +25 -25
- package/dist-lib/components/pages/RecordDocumentsPanel.js +35 -35
- package/dist-lib/components/pages/RecordNotesPanel.js +94 -93
- package/dist-lib/components/pages/SmartDetailPage.impl.js +421 -417
- package/dist-lib/components/pages/SmartListPage.impl.js +293 -295
- package/dist-lib/components/pages/SmartRecordListPage.impl.js +310 -310
- package/dist-lib/components/pages/auth/AuthShell.js +73 -73
- package/dist-lib/components/pages/auth/SignIn.js +32 -32
- package/dist-lib/components/pages/auth/SignUp.impl.js +3 -3
- package/dist-lib/components/pages/auth/SignUpCode.js +9 -9
- package/dist-lib/components/pages/list/ListFloatbar.js +12 -12
- package/dist-lib/components/pages/list/ListHeader.js +19 -19
- package/dist-lib/components/pages/list/ListNoRows.js +15 -15
- package/dist-lib/components/pages/list/ListToolbar.js +145 -145
- package/dist-lib/components/pages/list/useActiveView.js +14 -5
- package/dist-lib/components/pages/list/useListQuery.js +121 -81
- package/dist-lib/components/pages/list/useListRowInteraction.js +70 -70
- package/dist-lib/components/pages/list/useRowMenu.js +7 -7
- package/dist-lib/components/pages/profile/Preferences.impl.js +81 -78
- package/dist-lib/components/pages/profile/Profile.impl.js +191 -189
- package/dist-lib/components/pages/tenant-params/TenantParamsPage.impl.js +166 -158
- package/dist-lib/components/shared/ChangePasswordDialog.impl.js +23 -23
- package/dist-lib/components/shared/MarkdownRenderer.js +9 -9
- package/dist-lib/hooks/useAuth.js +11 -11
- package/dist-lib/hooks/useBranding.js +4 -4
- package/dist-lib/hooks/useDisplayTimeZone.js +8 -0
- package/dist-lib/hooks/useFollowAgentOpen.js +24 -24
- package/dist-lib/hooks/useImpersonation.js +6 -6
- package/dist-lib/hooks/useMutations.js +23 -23
- package/dist-lib/hooks/useObjectStatus.js +5 -5
- package/dist-lib/hooks/useParams.js +59 -51
- package/dist-lib/hooks/useProperties.js +8 -8
- package/dist-lib/hooks/useRowTenant.js +18 -6
- package/dist-lib/hooks/useText.js +9 -7
- package/dist-lib/hooks/useUiPreferences.js +71 -0
- package/dist-lib/index.d.ts +22 -6
- package/dist-lib/index.js +127 -126
- package/dist-lib/lib/actions.js +116 -84
- package/dist-lib/lib/child-config.js +10 -1
- package/dist-lib/lib/format-count.js +16 -1
- package/dist-lib/lib/language.js +23 -21
- package/dist-lib/lib/money-text.js +29 -0
- package/dist-lib/lib/profile.js +4 -0
- package/dist-lib/lib/role-label.js +8 -0
- package/dist-lib/lib/schema-routing.js +34 -14
- package/dist-lib/lib/shortcut.js +10 -0
- package/dist-lib/lib/timestamp.js +93 -31
- package/dist-lib/stores/auth.js +9 -8
- package/dist-lib/stores/preferences.js +56 -17
- package/dist-lib/testing.d.ts +1 -1
- package/dist-lib/testing.js +25 -28
- package/dist-lib/types/schema.js +33 -27
- package/dist-lib/{useResponsiveMode-D3SKz5z4.d.ts → useResponsiveMode-9_eJT18k.d.ts} +5 -5
- 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 {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
35
|
-
import {
|
|
36
|
-
import {
|
|
37
|
-
import {
|
|
38
|
-
import {
|
|
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
|
|
41
|
-
function
|
|
42
|
-
let r =
|
|
43
|
-
entity:
|
|
44
|
-
entityCode:
|
|
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:
|
|
48
|
-
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
|
|
54
|
-
/* @__PURE__ */
|
|
55
|
-
header: /* @__PURE__ */
|
|
55
|
+
return /* @__PURE__ */ J(K, { children: [
|
|
56
|
+
/* @__PURE__ */ J(B, {
|
|
57
|
+
header: /* @__PURE__ */ q("div", {
|
|
56
58
|
"data-testid": "profile-hero",
|
|
57
|
-
children: /* @__PURE__ */
|
|
58
|
-
icon:
|
|
59
|
-
name:
|
|
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:
|
|
64
|
+
title: H,
|
|
63
65
|
mode: "display",
|
|
64
66
|
showTitle: _.isVisible("show_title"),
|
|
65
|
-
highlights: /* @__PURE__ */
|
|
67
|
+
highlights: /* @__PURE__ */ J("div", {
|
|
66
68
|
className: "flex flex-wrap gap-1",
|
|
67
69
|
children: [
|
|
68
|
-
/* @__PURE__ */
|
|
70
|
+
/* @__PURE__ */ q(d, {
|
|
69
71
|
tone: "violet",
|
|
70
72
|
size: "xs",
|
|
71
73
|
dot: !0,
|
|
72
|
-
children:
|
|
74
|
+
children: W
|
|
73
75
|
}),
|
|
74
|
-
/* @__PURE__ */
|
|
76
|
+
/* @__PURE__ */ q(d, {
|
|
75
77
|
tone: "slate",
|
|
76
78
|
size: "xs",
|
|
77
|
-
children:
|
|
79
|
+
children: Y
|
|
78
80
|
}),
|
|
79
|
-
|
|
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
|
|
88
|
-
icon: /* @__PURE__ */
|
|
89
|
-
onClick: () =>
|
|
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__ */
|
|
92
|
-
icon: /* @__PURE__ */
|
|
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__ */
|
|
101
|
+
/* @__PURE__ */ q(m, {
|
|
100
102
|
title: v("profile.personal.title", "Personal info"),
|
|
101
|
-
icon: /* @__PURE__ */
|
|
102
|
-
children: /* @__PURE__ */
|
|
103
|
+
icon: /* @__PURE__ */ q(c.users, { size: 14 }),
|
|
104
|
+
children: /* @__PURE__ */ q("div", {
|
|
103
105
|
"data-testid": "profile-personal-info-grid",
|
|
104
|
-
children: /* @__PURE__ */
|
|
105
|
-
|
|
106
|
+
children: /* @__PURE__ */ J(I, { children: [
|
|
107
|
+
o && V && O && /* @__PURE__ */ q(F, {
|
|
106
108
|
label: v("profile.avatar", "Avatar"),
|
|
107
|
-
children: /* @__PURE__ */
|
|
108
|
-
userId:
|
|
109
|
-
entity:
|
|
110
|
-
record:
|
|
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
|
|
114
|
+
await b.refetch();
|
|
113
115
|
}
|
|
114
|
-
},
|
|
116
|
+
}, Z(O)) })
|
|
115
117
|
}),
|
|
116
|
-
/* @__PURE__ */
|
|
118
|
+
/* @__PURE__ */ q(F, {
|
|
117
119
|
label: v("profile.display_name", "Display name"),
|
|
118
|
-
children:
|
|
120
|
+
children: X("display_name")
|
|
119
121
|
}),
|
|
120
|
-
/* @__PURE__ */
|
|
122
|
+
/* @__PURE__ */ q(F, {
|
|
121
123
|
label: v("profile.personal.email", "Email"),
|
|
122
124
|
"data-testid": "profile-email",
|
|
123
|
-
children:
|
|
125
|
+
children: X("email")
|
|
124
126
|
}),
|
|
125
|
-
/* @__PURE__ */
|
|
127
|
+
/* @__PURE__ */ q(F, {
|
|
126
128
|
label: v("profile.personal.timezone", "Timezone"),
|
|
127
|
-
children:
|
|
129
|
+
children: ne()
|
|
128
130
|
}),
|
|
129
|
-
/* @__PURE__ */
|
|
131
|
+
/* @__PURE__ */ q($, {})
|
|
130
132
|
] })
|
|
131
133
|
})
|
|
132
134
|
}),
|
|
133
|
-
/* @__PURE__ */
|
|
135
|
+
/* @__PURE__ */ q(m, {
|
|
134
136
|
title: v("profile.security.title", "Security"),
|
|
135
|
-
icon: /* @__PURE__ */
|
|
136
|
-
children: /* @__PURE__ */
|
|
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__ */
|
|
141
|
+
children: /* @__PURE__ */ q(l, {
|
|
140
142
|
size: "xs",
|
|
141
|
-
onClick: () =>
|
|
143
|
+
onClick: () => A(!0),
|
|
142
144
|
children: v("profile.security.password_change", "Change")
|
|
143
145
|
})
|
|
144
146
|
}) })
|
|
145
147
|
}),
|
|
146
|
-
/* @__PURE__ */
|
|
148
|
+
/* @__PURE__ */ q(m, {
|
|
147
149
|
title: v("profile.access.title", "Access"),
|
|
148
|
-
icon: /* @__PURE__ */
|
|
149
|
-
children: /* @__PURE__ */
|
|
150
|
-
/* @__PURE__ */
|
|
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__ */
|
|
154
|
+
children: /* @__PURE__ */ q(d, {
|
|
153
155
|
tone: "violet",
|
|
154
156
|
size: "xs",
|
|
155
157
|
dot: !0,
|
|
156
|
-
children:
|
|
158
|
+
children: W
|
|
157
159
|
})
|
|
158
160
|
}),
|
|
159
|
-
/* @__PURE__ */
|
|
161
|
+
/* @__PURE__ */ q(F, {
|
|
160
162
|
label: v("profile.access.groups", "Groups"),
|
|
161
|
-
children:
|
|
163
|
+
children: o?.roles && o.roles.length > 0 ? /* @__PURE__ */ q("div", {
|
|
162
164
|
className: "flex flex-wrap gap-1",
|
|
163
|
-
children:
|
|
164
|
-
}) :
|
|
165
|
+
children: o.roles.map((e) => /* @__PURE__ */ q(f, { children: U(e) }, e))
|
|
166
|
+
}) : N
|
|
165
167
|
}),
|
|
166
|
-
/* @__PURE__ */
|
|
168
|
+
/* @__PURE__ */ q(F, {
|
|
167
169
|
label: v("profile.access.permissions", "Permissions"),
|
|
168
|
-
children: i(v, "profile.access.permissions_explicit",
|
|
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__ */
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
screen:
|
|
179
|
-
entity:
|
|
180
|
-
entityCode:
|
|
181
|
-
record:
|
|
182
|
-
recordId:
|
|
183
|
-
schema:
|
|
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__ */
|
|
188
|
-
open:
|
|
189
|
-
initialName:
|
|
190
|
-
userId:
|
|
191
|
-
onClose: () =>
|
|
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
|
|
195
|
+
await u(), L(!1);
|
|
194
196
|
}
|
|
195
197
|
}),
|
|
196
|
-
/* @__PURE__ */
|
|
197
|
-
open:
|
|
198
|
-
onClose: () =>
|
|
198
|
+
/* @__PURE__ */ q(P, {
|
|
199
|
+
open: k,
|
|
200
|
+
onClose: () => A(!1),
|
|
199
201
|
onSubmit: async ({ current: t, next: n }) => {
|
|
200
|
-
await e(t, n),
|
|
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
|
|
206
|
-
return
|
|
207
|
+
function Z(e) {
|
|
208
|
+
return k(A(e, Y))?.id ?? "";
|
|
207
209
|
}
|
|
208
|
-
function
|
|
209
|
-
let i =
|
|
210
|
-
let
|
|
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: { [
|
|
214
|
+
formData: { [Y]: u },
|
|
213
215
|
record: n,
|
|
214
216
|
isNew: !1
|
|
215
217
|
});
|
|
216
|
-
if (Object.keys(
|
|
217
|
-
|
|
218
|
+
if (Object.keys(f).length !== 0) {
|
|
219
|
+
d(!0);
|
|
218
220
|
try {
|
|
219
|
-
await
|
|
220
|
-
let t =
|
|
221
|
-
t &&
|
|
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
|
|
225
|
+
await l.flushAllDrafts(), m((e) => e + 1), y.error(s(c, e));
|
|
224
226
|
} finally {
|
|
225
|
-
|
|
227
|
+
d(!1);
|
|
226
228
|
}
|
|
227
229
|
}
|
|
228
230
|
};
|
|
229
|
-
return /* @__PURE__ */
|
|
231
|
+
return /* @__PURE__ */ q(U, { children: j({
|
|
230
232
|
entity: t,
|
|
231
|
-
entityCode:
|
|
232
|
-
fieldName:
|
|
233
|
+
entityCode: a,
|
|
234
|
+
fieldName: Y,
|
|
233
235
|
record: n,
|
|
234
236
|
mode: "edit",
|
|
235
|
-
onChange: (e) => void
|
|
236
|
-
disabled:
|
|
237
|
+
onChange: (e) => void h(e),
|
|
238
|
+
disabled: u,
|
|
237
239
|
t: i,
|
|
238
240
|
fieldId: "profile-avatar"
|
|
239
|
-
}) },
|
|
241
|
+
}) }, f);
|
|
240
242
|
}
|
|
241
|
-
function
|
|
242
|
-
let
|
|
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
|
|
245
|
-
|
|
246
|
+
let E = () => {
|
|
247
|
+
x(t), T(null), r();
|
|
246
248
|
};
|
|
247
|
-
return /* @__PURE__ */ K
|
|
248
|
-
onClick:
|
|
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__ */
|
|
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:
|
|
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__ */
|
|
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__ */
|
|
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__ */
|
|
294
|
+
children: /* @__PURE__ */ q(c.edit, { size: 15 })
|
|
293
295
|
}),
|
|
294
|
-
/* @__PURE__ */
|
|
296
|
+
/* @__PURE__ */ J("div", {
|
|
295
297
|
style: { flex: 1 },
|
|
296
|
-
children: [/* @__PURE__ */
|
|
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:
|
|
303
|
-
}), /* @__PURE__ */
|
|
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:
|
|
310
|
+
children: f("profile.edit.subtitle", "Update your display name.")
|
|
309
311
|
})]
|
|
310
312
|
}),
|
|
311
|
-
/* @__PURE__ */
|
|
312
|
-
icon: /* @__PURE__ */
|
|
313
|
-
title:
|
|
314
|
-
onClick:
|
|
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__ */
|
|
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__ */
|
|
327
|
+
children: [/* @__PURE__ */ J("div", { children: [/* @__PURE__ */ q(_, {
|
|
326
328
|
required: !0,
|
|
327
|
-
htmlFor:
|
|
328
|
-
children:
|
|
329
|
-
}), /* @__PURE__ */
|
|
330
|
-
id:
|
|
331
|
-
value:
|
|
332
|
-
onChange:
|
|
333
|
-
placeholder:
|
|
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
|
-
})] }),
|
|
337
|
+
})] }), w && /* @__PURE__ */ q(V, { text: w })]
|
|
336
338
|
}),
|
|
337
|
-
/* @__PURE__ */
|
|
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:
|
|
347
|
+
flexWrap: d ? "wrap" : "nowrap"
|
|
346
348
|
},
|
|
347
349
|
children: [
|
|
348
|
-
/* @__PURE__ */
|
|
349
|
-
/* @__PURE__ */
|
|
350
|
-
onClick:
|
|
351
|
-
children:
|
|
350
|
+
/* @__PURE__ */ q("div", { style: { flex: 1 } }),
|
|
351
|
+
/* @__PURE__ */ q(l, {
|
|
352
|
+
onClick: E,
|
|
353
|
+
children: f("dialog.cancel", "Cancel")
|
|
352
354
|
}),
|
|
353
|
-
/* @__PURE__ */
|
|
355
|
+
/* @__PURE__ */ q(l, {
|
|
354
356
|
kind: "primary",
|
|
355
|
-
icon:
|
|
357
|
+
icon: q(S ? g : c.check, { size: 13 }),
|
|
356
358
|
onClick: async () => {
|
|
357
|
-
if (!
|
|
359
|
+
if (!b.trim()) T(f("profile.edit.name_required", "Display name is required."));
|
|
358
360
|
else {
|
|
359
|
-
|
|
361
|
+
T(null), C(!0);
|
|
360
362
|
try {
|
|
361
|
-
await
|
|
363
|
+
await o(a, { id: n }, { display_name: b.trim() }), await i();
|
|
362
364
|
} catch (e) {
|
|
363
|
-
|
|
365
|
+
T(s(m, e));
|
|
364
366
|
} finally {
|
|
365
|
-
|
|
367
|
+
C(!1);
|
|
366
368
|
}
|
|
367
369
|
}
|
|
368
370
|
},
|
|
369
|
-
disabled: !
|
|
370
|
-
children:
|
|
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
|
|
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
|
|
386
|
-
return /* @__PURE__ */
|
|
387
|
-
carrierEntityCode:
|
|
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 =
|
|
394
|
-
return /* @__PURE__ */
|
|
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__ */
|
|
398
|
+
children: i ? o?.name[o.code] || e(o?.name) || a : /* @__PURE__ */ q(g, { size: 12 })
|
|
397
399
|
});
|
|
398
400
|
}
|
|
399
|
-
function
|
|
401
|
+
function re({ userId: e }) {
|
|
400
402
|
let { data: t } = n();
|
|
401
403
|
if (!e || !t) return null;
|
|
402
|
-
let r = t.entities[
|
|
403
|
-
return r ? /* @__PURE__ */
|
|
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:
|
|
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 {
|
|
422
|
+
export { X as Profile, $ as ProfileLanguageRow, Q as ProfileParamsBlock };
|