@jrapps/my_tickets_dashboard_modals_ui 0.0.2 → 0.1.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/cjs/components/CreateManageTeamModal/index.js +339 -0
- package/dist/cjs/components/CreateManageTeamModal/index.js.map +7 -0
- package/dist/cjs/components/ManageCreateUserModal/index.js +278 -0
- package/dist/cjs/components/ManageCreateUserModal/index.js.map +7 -0
- package/dist/cjs/index.js +591 -44
- package/dist/cjs/index.js.map +4 -4
- package/dist/esm/chunks/chunk-2GZEVEZL.js +257 -0
- package/dist/esm/chunks/chunk-2GZEVEZL.js.map +7 -0
- package/dist/esm/chunks/chunk-4WLRHNEL.js +324 -0
- package/dist/esm/chunks/chunk-4WLRHNEL.js.map +7 -0
- package/dist/esm/components/CreateManageTeamModal/index.js +7 -0
- package/dist/esm/components/CreateManageTeamModal/index.js.map +7 -0
- package/dist/esm/components/ManageCreateUserModal/index.js +7 -0
- package/dist/esm/components/ManageCreateUserModal/index.js.map +7 -0
- package/dist/esm/index.js +8 -0
- package/dist/types/components/CreateManageTeamModal/CreateManageTeamModal.d.ts +6 -0
- package/dist/types/components/CreateManageTeamModal/CreateManageTeamModal.d.ts.map +1 -0
- package/dist/types/components/CreateManageTeamModal/CreateManageTeamModal.types.d.ts +48 -0
- package/dist/types/components/CreateManageTeamModal/CreateManageTeamModal.types.d.ts.map +1 -0
- package/dist/types/components/CreateManageTeamModal/index.d.ts +3 -0
- package/dist/types/components/CreateManageTeamModal/index.d.ts.map +1 -0
- package/dist/types/components/CreateManageTeamModal/permissions-accordion.d.ts +5 -0
- package/dist/types/components/CreateManageTeamModal/permissions-accordion.d.ts.map +1 -0
- package/dist/types/components/CreateManageTeamModal/team-permissions.d.ts +98 -0
- package/dist/types/components/CreateManageTeamModal/team-permissions.d.ts.map +1 -0
- package/dist/types/components/CreateManageTeamModal/useCreateManageTeamModal.d.ts +27 -0
- package/dist/types/components/CreateManageTeamModal/useCreateManageTeamModal.d.ts.map +1 -0
- package/dist/types/components/ManageCreateUserModal/ManageCreateUserModal.d.ts +6 -0
- package/dist/types/components/ManageCreateUserModal/ManageCreateUserModal.d.ts.map +1 -0
- package/dist/types/components/ManageCreateUserModal/ManageCreateUserModal.types.d.ts +53 -0
- package/dist/types/components/ManageCreateUserModal/ManageCreateUserModal.types.d.ts.map +1 -0
- package/dist/types/components/ManageCreateUserModal/index.d.ts +3 -0
- package/dist/types/components/ManageCreateUserModal/index.d.ts.map +1 -0
- package/dist/types/components/ManageCreateUserModal/useManageCreateUserModal.d.ts +28 -0
- package/dist/types/components/ManageCreateUserModal/useManageCreateUserModal.d.ts.map +1 -0
- package/dist/types/components/ManageTicketModal/useManageTicketModal.d.ts +1 -1
- package/dist/types/components/index.d.ts +2 -0
- package/dist/types/components/index.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/cjs/index.js
CHANGED
|
@@ -30,16 +30,563 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/index.ts
|
|
31
31
|
var src_exports = {};
|
|
32
32
|
__export(src_exports, {
|
|
33
|
+
CreateManageTeamModal: () => CreateManageTeamModal,
|
|
34
|
+
ManageCreateUserModal: () => ManageCreateUserModal,
|
|
33
35
|
ManageTicketModal: () => ManageTicketModal
|
|
34
36
|
});
|
|
35
37
|
module.exports = __toCommonJS(src_exports);
|
|
36
38
|
|
|
37
|
-
// src/components/
|
|
39
|
+
// src/components/CreateManageTeamModal/CreateManageTeamModal.tsx
|
|
38
40
|
var import_react2 = __toESM(require("react"));
|
|
39
41
|
|
|
40
|
-
// src/components/
|
|
42
|
+
// src/components/CreateManageTeamModal/useCreateManageTeamModal.ts
|
|
41
43
|
var import_react = require("react");
|
|
42
44
|
var import_essentials = require("@wix/essentials");
|
|
45
|
+
var import_dashboard = require("@wix/dashboard");
|
|
46
|
+
|
|
47
|
+
// src/components/CreateManageTeamModal/CreateManageTeamModal.types.ts
|
|
48
|
+
var DEFAULT_TEAM_DATA = {
|
|
49
|
+
name: "",
|
|
50
|
+
description: "",
|
|
51
|
+
teamPictureUrl: "",
|
|
52
|
+
email: "",
|
|
53
|
+
agents: [],
|
|
54
|
+
assignedTickets: [],
|
|
55
|
+
permissions: []
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
// src/components/CreateManageTeamModal/useCreateManageTeamModal.ts
|
|
59
|
+
function useCreateManageTeamModal({
|
|
60
|
+
id,
|
|
61
|
+
state,
|
|
62
|
+
permissions,
|
|
63
|
+
onClose
|
|
64
|
+
}) {
|
|
65
|
+
const [teamData, setTeamData] = (0, import_react.useState)(DEFAULT_TEAM_DATA);
|
|
66
|
+
const [isLoading, setIsLoading] = (0, import_react.useState)(false);
|
|
67
|
+
const [error, setError] = (0, import_react.useState)(null);
|
|
68
|
+
const [isSaving, setIsSaving] = (0, import_react.useState)(false);
|
|
69
|
+
const handleFormChange = (field, value) => {
|
|
70
|
+
setTeamData((prev) => ({ ...prev, [field]: value }));
|
|
71
|
+
};
|
|
72
|
+
const validate = () => {
|
|
73
|
+
if (!teamData.name.trim()) return "Team name is required.";
|
|
74
|
+
if (!teamData.email.trim()) return "Team email is required.";
|
|
75
|
+
return null;
|
|
76
|
+
};
|
|
77
|
+
const handleSave = async () => {
|
|
78
|
+
const validationError = validate();
|
|
79
|
+
if (validationError) {
|
|
80
|
+
setError(validationError);
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
setIsSaving(true);
|
|
84
|
+
setError(null);
|
|
85
|
+
try {
|
|
86
|
+
const baseApiUrl = new URL("").origin;
|
|
87
|
+
const res = await import_essentials.httpClient.fetchWithAuth(
|
|
88
|
+
`${baseApiUrl}/api/teams/teams${state === "EDIT" ? `?id=${id}` : ""}`,
|
|
89
|
+
{
|
|
90
|
+
method: state === "EDIT" ? "PUT" : "POST",
|
|
91
|
+
body: JSON.stringify(teamData)
|
|
92
|
+
}
|
|
93
|
+
);
|
|
94
|
+
const data = await res.json();
|
|
95
|
+
if (data.success) {
|
|
96
|
+
onClose({
|
|
97
|
+
newTeamData: {
|
|
98
|
+
_id: data.team._id,
|
|
99
|
+
name: data.team.name,
|
|
100
|
+
description: data.team.description,
|
|
101
|
+
teamPictureUrl: data.team.teamPictureUrl
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
} catch (err) {
|
|
106
|
+
console.error("Error saving team:", err instanceof Error ? err.message : String(err));
|
|
107
|
+
setError("Try again later.");
|
|
108
|
+
} finally {
|
|
109
|
+
setIsSaving(false);
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
const handleAddImage = () => {
|
|
113
|
+
import_dashboard.dashboard.openMediaManager({ multiSelect: false }).then((result) => {
|
|
114
|
+
if (result && result.items.length > 0) {
|
|
115
|
+
const imageUrl = result.items[0].url;
|
|
116
|
+
handleFormChange("teamPictureUrl", imageUrl);
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
};
|
|
120
|
+
(0, import_react.useEffect)(() => {
|
|
121
|
+
if (state === "EDIT") {
|
|
122
|
+
setIsLoading(true);
|
|
123
|
+
const fetchTeamDetails = async () => {
|
|
124
|
+
try {
|
|
125
|
+
const baseApiUrl = new URL("").origin;
|
|
126
|
+
const res = await import_essentials.httpClient.fetchWithAuth(
|
|
127
|
+
`${baseApiUrl}/api/teams/teams?id=${id}`,
|
|
128
|
+
{
|
|
129
|
+
method: "GET",
|
|
130
|
+
headers: { "Content-Type": "application/json" }
|
|
131
|
+
}
|
|
132
|
+
);
|
|
133
|
+
const data = await res.json();
|
|
134
|
+
setTeamData(data.team || DEFAULT_TEAM_DATA);
|
|
135
|
+
} catch (err) {
|
|
136
|
+
console.error(
|
|
137
|
+
"Error fetching team details:",
|
|
138
|
+
err instanceof Error ? err.message : String(err)
|
|
139
|
+
);
|
|
140
|
+
setError("Try again later.");
|
|
141
|
+
} finally {
|
|
142
|
+
setIsLoading(false);
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
fetchTeamDetails();
|
|
146
|
+
}
|
|
147
|
+
}, [id, state]);
|
|
148
|
+
return {
|
|
149
|
+
teamData,
|
|
150
|
+
isLoading,
|
|
151
|
+
isSaving,
|
|
152
|
+
error,
|
|
153
|
+
handleFormChange,
|
|
154
|
+
handleSave,
|
|
155
|
+
handleAddImage,
|
|
156
|
+
canEdit: permissions["my-tickets-edit-teams"]
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
// src/components/CreateManageTeamModal/CreateManageTeamModal.css
|
|
161
|
+
if (typeof document !== "undefined" && !document.getElementById("jrapps-style-41fecb36")) {
|
|
162
|
+
const s = document.createElement("style");
|
|
163
|
+
s.id = "jrapps-style-41fecb36";
|
|
164
|
+
s.textContent = ".create-manage-team-modal {\n /* CreateManageTeamModal base styles */\n}\n";
|
|
165
|
+
document.head.appendChild(s);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
// src/components/CreateManageTeamModal/CreateManageTeamModal.tsx
|
|
169
|
+
var import_design_system2 = require("@wix/design-system");
|
|
170
|
+
var import_styles_studio_global = require("@wix/design-system/styles-studio.global.css");
|
|
171
|
+
|
|
172
|
+
// src/components/CreateManageTeamModal/permissions-accordion.tsx
|
|
173
|
+
var import_design_system = require("@wix/design-system");
|
|
174
|
+
|
|
175
|
+
// src/components/CreateManageTeamModal/team-permissions.ts
|
|
176
|
+
var TEAM_PERMISSIONS = [
|
|
177
|
+
{ "id": "my-tickets-transfer-chat-to-agent", "name": "Transfer Chat to Agent", "category": "Chat" },
|
|
178
|
+
{ "id": "my-tickets-transfer-chat-to-team", "name": "Transfer Chat to Team", "category": "Chat" },
|
|
179
|
+
{ "id": "my-tickets-convert-chat-to-ticket", "name": "Convert Chat to Ticket", "category": "Chat" },
|
|
180
|
+
{ "id": "my-tickets-view-chats", "name": "View Chats", "category": "Chat" },
|
|
181
|
+
{ "id": "my-tickets-view-single-chat", "name": "View Single Chat", "category": "Chat" },
|
|
182
|
+
{ "id": "my-tickets-join-single-chat", "name": "Join Single Chat", "category": "Chat" },
|
|
183
|
+
{ "id": "my-tickets-end-single-chat", "name": "End Single Chat", "category": "Chat" },
|
|
184
|
+
{ "id": "my-tickets-view-single-ticket", "name": "View Single Ticket", "category": "Ticket" },
|
|
185
|
+
{ "id": "my-tickets-single-ticket-send-message", "name": "Send Message to Single Ticket", "category": "Ticket" },
|
|
186
|
+
{ "id": "my-tickets-close-single-ticket", "name": "Close Single Ticket", "category": "Ticket" },
|
|
187
|
+
{ "id": "my-tickets-reopen-single-ticket", "name": "Reopen Single Ticket", "category": "Ticket" },
|
|
188
|
+
{ "id": "my-tickets-change-ticket-priority", "name": "Change Ticket Priority", "category": "Ticket" },
|
|
189
|
+
{ "id": "my-tickets-transfer-ticket", "name": "Transfer Ticket", "category": "Ticket" },
|
|
190
|
+
{ "id": "my-tickets-change-agent-online-status", "name": "Change Agent Online Status", "category": "Agent" },
|
|
191
|
+
{ "id": "my-tickets-notifications-enabled", "name": "Enable Notifications", "category": "Notification" },
|
|
192
|
+
{ "id": "my-tickets-create-quick-chat", "name": "Create Quick Chat", "category": "Chat" },
|
|
193
|
+
{ "id": "my-tickets-edit-teams", "name": "Edit Teams", "category": "Team" },
|
|
194
|
+
{ "id": "my-tickets-edit-accounts", "name": "Edit Accounts", "category": "Account" },
|
|
195
|
+
{ "id": "my-tickets-view-teams", "name": "View Teams", "category": "Team" },
|
|
196
|
+
{ "id": "my-tickets-view-accounts", "name": "View Accounts", "category": "Account" },
|
|
197
|
+
{ "id": "my-tickets-create-teams", "name": "Create Teams", "category": "Team" },
|
|
198
|
+
{ "id": "my-tickets-create-accounts", "name": "Create Accounts", "category": "Account" },
|
|
199
|
+
{ "id": "my-tickets-view-all-tickets", "name": "View All Tickets", "category": "Ticket" },
|
|
200
|
+
{ "id": "my-tickets-create-ticket", "name": "Create Ticket", "category": "Ticket" }
|
|
201
|
+
];
|
|
202
|
+
|
|
203
|
+
// src/components/CreateManageTeamModal/permissions-accordion.tsx
|
|
204
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
205
|
+
var PermissionsAccordion = ({
|
|
206
|
+
selectedPermissions,
|
|
207
|
+
onChange,
|
|
208
|
+
disabled
|
|
209
|
+
}) => {
|
|
210
|
+
const groupedPermissions = TEAM_PERMISSIONS.reduce(
|
|
211
|
+
(acc, perm) => {
|
|
212
|
+
if (!acc[perm.category]) {
|
|
213
|
+
acc[perm.category] = [];
|
|
214
|
+
}
|
|
215
|
+
acc[perm.category].push(perm);
|
|
216
|
+
return acc;
|
|
217
|
+
},
|
|
218
|
+
{}
|
|
219
|
+
);
|
|
220
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_design_system.FormField, { label: "Permissions", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
221
|
+
import_design_system.Accordion,
|
|
222
|
+
{
|
|
223
|
+
horizontalPadding: "tiny",
|
|
224
|
+
size: "tiny",
|
|
225
|
+
items: Object.entries(groupedPermissions).map(
|
|
226
|
+
([category, categoryPermissions]) => (0, import_design_system.accordionItemBuilder)({
|
|
227
|
+
title: category,
|
|
228
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_design_system.Box, { direction: "vertical", gap: "small", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_design_system.Layout, { children: categoryPermissions.map((perm) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_design_system.Cell, { span: 6, children: [
|
|
229
|
+
" ",
|
|
230
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
231
|
+
import_design_system.Checkbox,
|
|
232
|
+
{
|
|
233
|
+
checked: selectedPermissions?.includes(perm.id) || false,
|
|
234
|
+
onChange: (e) => {
|
|
235
|
+
const isChecked = e.target.checked;
|
|
236
|
+
onChange(
|
|
237
|
+
isChecked ? [...selectedPermissions || [], perm.id] : selectedPermissions?.filter((p) => p !== perm.id) || []
|
|
238
|
+
);
|
|
239
|
+
},
|
|
240
|
+
disabled,
|
|
241
|
+
children: perm.name
|
|
242
|
+
}
|
|
243
|
+
)
|
|
244
|
+
] }, perm.id)) }) })
|
|
245
|
+
})
|
|
246
|
+
)
|
|
247
|
+
}
|
|
248
|
+
) });
|
|
249
|
+
};
|
|
250
|
+
var permissions_accordion_default = PermissionsAccordion;
|
|
251
|
+
|
|
252
|
+
// src/components/CreateManageTeamModal/CreateManageTeamModal.tsx
|
|
253
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
254
|
+
var CreateManageTeamModal = import_react2.default.forwardRef(
|
|
255
|
+
({ className, isOpen, id, state, permissions, onClose }, ref) => {
|
|
256
|
+
const {
|
|
257
|
+
teamData,
|
|
258
|
+
isLoading,
|
|
259
|
+
isSaving,
|
|
260
|
+
error,
|
|
261
|
+
handleFormChange,
|
|
262
|
+
handleSave,
|
|
263
|
+
handleAddImage,
|
|
264
|
+
canEdit
|
|
265
|
+
} = useCreateManageTeamModal({ id, state, permissions, onClose });
|
|
266
|
+
const modalActions = !isLoading ? {
|
|
267
|
+
primaryButtonText: isSaving ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_design_system2.Loader, { size: "tiny" }) : "Save",
|
|
268
|
+
primaryButtonOnClick: handleSave,
|
|
269
|
+
primaryButtonProps: { disabled: !canEdit },
|
|
270
|
+
secondaryButtonText: !isSaving && state === "CREATE" ? "Cancel" : !isSaving && state === "EDIT" ? "Close" : void 0,
|
|
271
|
+
secondaryButtonOnClick: () => onClose({ cancelled: true })
|
|
272
|
+
} : {};
|
|
273
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_design_system2.Modal, { isOpen, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { ref, className, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
274
|
+
import_design_system2.CustomModalLayout,
|
|
275
|
+
{
|
|
276
|
+
width: "520px",
|
|
277
|
+
...modalActions,
|
|
278
|
+
showHeaderDivider: true,
|
|
279
|
+
showFooterDivider: true,
|
|
280
|
+
title: state === "EDIT" ? "Edit Team" : "Create Team",
|
|
281
|
+
subtitle: state === "EDIT" ? "Make changes to the team details below." : "Fill in the details to create a new team.",
|
|
282
|
+
footnote: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_design_system2.Box, { alignContent: "center", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_design_system2.Text, { size: "small", children: [
|
|
283
|
+
"Powered by ",
|
|
284
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_design_system2.Text, { size: "small", weight: "bold", children: "My Tickets" })
|
|
285
|
+
] }) }),
|
|
286
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_design_system2.Box, { direction: "vertical", width: "stretch", gap: "10px", children: isLoading ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_design_system2.Box, { WebkitJustifyContent: "center", alignContent: "center", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_design_system2.Loader, { size: "medium", status: "loading", text: "Loading data..." }) }) : error ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_design_system2.Box, { WebkitJustifyContent: "center", alignContent: "center", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_design_system2.Loader, { size: "medium", status: "error", text: error }) }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
|
|
287
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_design_system2.Box, { direction: "horizontal", width: "stretch", gap: "10px", children: [
|
|
288
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_design_system2.FormField, { label: "Team Picture", required: true, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
289
|
+
import_design_system2.ImageViewer,
|
|
290
|
+
{
|
|
291
|
+
disabled: !canEdit,
|
|
292
|
+
height: "115px",
|
|
293
|
+
width: "115px",
|
|
294
|
+
imageUrl: teamData?.teamPictureUrl || "",
|
|
295
|
+
onAddImage: handleAddImage
|
|
296
|
+
}
|
|
297
|
+
) }),
|
|
298
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_design_system2.Box, { direction: "vertical", width: "stretch", gap: "10px", children: [
|
|
299
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_design_system2.FormField, { label: "Team Name", required: true, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
300
|
+
import_design_system2.Input,
|
|
301
|
+
{
|
|
302
|
+
value: teamData?.name || "",
|
|
303
|
+
onChange: (e) => handleFormChange("name", e.target.value),
|
|
304
|
+
disabled: !canEdit
|
|
305
|
+
}
|
|
306
|
+
) }),
|
|
307
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_design_system2.FormField, { label: "Team Description", required: true, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
308
|
+
import_design_system2.Input,
|
|
309
|
+
{
|
|
310
|
+
value: teamData?.description || "",
|
|
311
|
+
onChange: (e) => handleFormChange("description", e.target.value),
|
|
312
|
+
disabled: !canEdit
|
|
313
|
+
}
|
|
314
|
+
) })
|
|
315
|
+
] })
|
|
316
|
+
] }),
|
|
317
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_design_system2.FormField, { label: "Team Email", required: true, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
318
|
+
import_design_system2.Input,
|
|
319
|
+
{
|
|
320
|
+
suffix: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_design_system2.Box, { verticalAlign: "middle", children: "@mytickets.internal" }),
|
|
321
|
+
type: "email",
|
|
322
|
+
value: teamData?.email?.replace("@mytickets.internal", "") || "",
|
|
323
|
+
onChange: (e) => handleFormChange("email", e.target.value),
|
|
324
|
+
disabled: !canEdit
|
|
325
|
+
}
|
|
326
|
+
) }),
|
|
327
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_design_system2.Box, { direction: "horizontal", width: "stretch", gap: "10px", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
328
|
+
permissions_accordion_default,
|
|
329
|
+
{
|
|
330
|
+
selectedPermissions: teamData.permissions || [],
|
|
331
|
+
onChange: (perms) => handleFormChange("permissions", perms),
|
|
332
|
+
disabled: !canEdit
|
|
333
|
+
}
|
|
334
|
+
) })
|
|
335
|
+
] }) })
|
|
336
|
+
}
|
|
337
|
+
) }) });
|
|
338
|
+
}
|
|
339
|
+
);
|
|
340
|
+
CreateManageTeamModal.displayName = "CreateManageTeamModal";
|
|
341
|
+
|
|
342
|
+
// src/components/ManageCreateUserModal/ManageCreateUserModal.tsx
|
|
343
|
+
var import_react4 = __toESM(require("react"));
|
|
344
|
+
|
|
345
|
+
// src/components/ManageCreateUserModal/useManageCreateUserModal.ts
|
|
346
|
+
var import_react3 = require("react");
|
|
347
|
+
var import_essentials2 = require("@wix/essentials");
|
|
348
|
+
|
|
349
|
+
// src/components/ManageCreateUserModal/ManageCreateUserModal.types.ts
|
|
350
|
+
var DEFAULT_USER_DATA = {
|
|
351
|
+
_id: "",
|
|
352
|
+
passcode: "",
|
|
353
|
+
userId: "",
|
|
354
|
+
email: "",
|
|
355
|
+
name: "",
|
|
356
|
+
phoneNumber: "",
|
|
357
|
+
role: "",
|
|
358
|
+
team: "",
|
|
359
|
+
profilePictureUrl: "",
|
|
360
|
+
assignedTickets: [],
|
|
361
|
+
isAdmin: false
|
|
362
|
+
};
|
|
363
|
+
|
|
364
|
+
// src/components/ManageCreateUserModal/useManageCreateUserModal.ts
|
|
365
|
+
var BASE_API_URL = new URL("").origin;
|
|
366
|
+
function useManageCreateUserModal({ id, state }) {
|
|
367
|
+
const [userData, setUserData] = (0, import_react3.useState)(DEFAULT_USER_DATA);
|
|
368
|
+
const [isLoading, setIsLoading] = (0, import_react3.useState)(true);
|
|
369
|
+
const [isSaving, setIsSaving] = (0, import_react3.useState)(false);
|
|
370
|
+
const [error, setError] = (0, import_react3.useState)(false);
|
|
371
|
+
const [teams, setTeams] = (0, import_react3.useState)([]);
|
|
372
|
+
const handleFormChange = (field, value) => {
|
|
373
|
+
setUserData((prev) => ({ ...prev, [field]: value }));
|
|
374
|
+
};
|
|
375
|
+
(0, import_react3.useEffect)(() => {
|
|
376
|
+
const fetchTeams = async () => {
|
|
377
|
+
try {
|
|
378
|
+
const response = await import_essentials2.httpClient.fetchWithAuth(`${BASE_API_URL}/api/teams/teams`);
|
|
379
|
+
const result = await response.json();
|
|
380
|
+
if (!result.success) throw new Error(result.error || "Failed to fetch teams");
|
|
381
|
+
setTeams(result.teams || []);
|
|
382
|
+
} catch (err) {
|
|
383
|
+
console.error("Error fetching teams data:", err);
|
|
384
|
+
}
|
|
385
|
+
};
|
|
386
|
+
const fetchUser = async () => {
|
|
387
|
+
try {
|
|
388
|
+
const response = await import_essentials2.httpClient.fetchWithAuth(`${BASE_API_URL}/api/users/users?id=${id}`);
|
|
389
|
+
const result = await response.json();
|
|
390
|
+
if (!result.success) throw new Error(result.error || "Failed to fetch user data");
|
|
391
|
+
setUserData(result.user || DEFAULT_USER_DATA);
|
|
392
|
+
} catch (err) {
|
|
393
|
+
console.error("Error fetching user data:", err);
|
|
394
|
+
setError(true);
|
|
395
|
+
}
|
|
396
|
+
};
|
|
397
|
+
const init = async () => {
|
|
398
|
+
setIsLoading(true);
|
|
399
|
+
await Promise.all([
|
|
400
|
+
fetchTeams(),
|
|
401
|
+
...state === "EDIT" ? [fetchUser()] : []
|
|
402
|
+
]);
|
|
403
|
+
setIsLoading(false);
|
|
404
|
+
};
|
|
405
|
+
init();
|
|
406
|
+
}, [id, state]);
|
|
407
|
+
const handleSave = async (onClose) => {
|
|
408
|
+
setIsSaving(true);
|
|
409
|
+
try {
|
|
410
|
+
const emailWithDomain = userData.email.includes("@") ? userData.email : `${userData.email}@mytickets.internal`;
|
|
411
|
+
const payload = {
|
|
412
|
+
...userData,
|
|
413
|
+
email: emailWithDomain,
|
|
414
|
+
// Only include passcode in the payload when the user has typed one.
|
|
415
|
+
...userData.passcode ? { passcode: userData.passcode } : {}
|
|
416
|
+
};
|
|
417
|
+
delete payload.passcode;
|
|
418
|
+
const res = await import_essentials2.httpClient.fetchWithAuth(
|
|
419
|
+
`${BASE_API_URL}/api/users/users${state === "EDIT" ? `?id=${id}` : ""}`,
|
|
420
|
+
{
|
|
421
|
+
method: state === "EDIT" ? "PUT" : "POST",
|
|
422
|
+
body: JSON.stringify(payload)
|
|
423
|
+
}
|
|
424
|
+
);
|
|
425
|
+
const data = await res.json();
|
|
426
|
+
if (data.success) {
|
|
427
|
+
onClose({ newUserData: data.user });
|
|
428
|
+
}
|
|
429
|
+
} catch (err) {
|
|
430
|
+
console.error("Error saving user:", err instanceof Error ? err.message : String(err));
|
|
431
|
+
setError(true);
|
|
432
|
+
} finally {
|
|
433
|
+
setIsSaving(false);
|
|
434
|
+
}
|
|
435
|
+
};
|
|
436
|
+
return {
|
|
437
|
+
userData,
|
|
438
|
+
isLoading,
|
|
439
|
+
isSaving,
|
|
440
|
+
error,
|
|
441
|
+
teams,
|
|
442
|
+
handleFormChange,
|
|
443
|
+
handleSave
|
|
444
|
+
};
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
// src/components/ManageCreateUserModal/ManageCreateUserModal.css
|
|
448
|
+
if (typeof document !== "undefined" && !document.getElementById("jrapps-style-03331631")) {
|
|
449
|
+
const s = document.createElement("style");
|
|
450
|
+
s.id = "jrapps-style-03331631";
|
|
451
|
+
s.textContent = ".manage-create-user-modal {\n /* ManageCreateUserModal base styles */\n}\n";
|
|
452
|
+
document.head.appendChild(s);
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
// src/components/ManageCreateUserModal/ManageCreateUserModal.tsx
|
|
456
|
+
var import_design_system3 = require("@wix/design-system");
|
|
457
|
+
var import_styles_studio_global2 = require("@wix/design-system/styles-studio.global.css");
|
|
458
|
+
var import_dashboard2 = require("@wix/dashboard");
|
|
459
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
460
|
+
var ManageCreateUserModal = import_react4.default.forwardRef(
|
|
461
|
+
({ className, id, state, permissions, isOpen, onClose }, ref) => {
|
|
462
|
+
const { userData, isLoading, isSaving, error, teams, handleFormChange, handleSave } = useManageCreateUserModal({ id, state });
|
|
463
|
+
const canEdit = permissions["my-tickets-edit-accounts"];
|
|
464
|
+
const isDefaultAdmin = userData.role === "DEFAULT_ADMIN";
|
|
465
|
+
const handleAddImage = () => {
|
|
466
|
+
import_dashboard2.dashboard.openMediaManager({ multiSelect: false }).then((result) => {
|
|
467
|
+
if (result && result.items.length > 0) {
|
|
468
|
+
handleFormChange("profilePictureUrl", result.items[0].url);
|
|
469
|
+
}
|
|
470
|
+
});
|
|
471
|
+
};
|
|
472
|
+
const modalActionProps = isLoading ? {} : {
|
|
473
|
+
primaryButtonText: isSaving ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_design_system3.Loader, { size: "tiny" }) : "Save",
|
|
474
|
+
secondaryButtonText: !isSaving ? state === "CREATE" ? "Cancel" : "Close" : void 0,
|
|
475
|
+
primaryButtonProps: { disabled: !canEdit },
|
|
476
|
+
primaryButtonOnClick: () => handleSave(onClose),
|
|
477
|
+
secondaryButtonOnClick: () => onClose()
|
|
478
|
+
};
|
|
479
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_design_system3.Modal, { isOpen, ref, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
480
|
+
import_design_system3.CustomModalLayout,
|
|
481
|
+
{
|
|
482
|
+
width: "500px",
|
|
483
|
+
...modalActionProps,
|
|
484
|
+
showHeaderDivider: true,
|
|
485
|
+
showFooterDivider: true,
|
|
486
|
+
title: state === "EDIT" ? "Edit User Account" : "Create User Account",
|
|
487
|
+
subtitle: state === "EDIT" ? "Make changes to the user account details below." : "Fill in the details to create a new user account.",
|
|
488
|
+
footnote: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_design_system3.Box, { alignContent: "center", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_design_system3.Text, { size: "small", children: [
|
|
489
|
+
"Powered by ",
|
|
490
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_design_system3.Text, { size: "small", weight: "bold", children: "My Tickets" })
|
|
491
|
+
] }) }),
|
|
492
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_design_system3.Box, { direction: "vertical", width: "stretch", gap: "10px", children: isLoading ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_design_system3.Box, { WebkitJustifyContent: "center", alignContent: "center", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_design_system3.Loader, { size: "medium", status: "loading", text: "Loading User..." }) }) : error ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_design_system3.Box, { WebkitJustifyContent: "center", alignContent: "center", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_design_system3.Loader, { size: "medium", status: "error", text: "Please try again later." }) }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
|
|
493
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_design_system3.Box, { direction: "horizontal", width: "stretch", gap: "10px", children: [
|
|
494
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_design_system3.FormField, { label: "Profile Picture", required: true, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
495
|
+
import_design_system3.ImageViewer,
|
|
496
|
+
{
|
|
497
|
+
height: "115px",
|
|
498
|
+
width: "115px",
|
|
499
|
+
imageUrl: userData.profilePictureUrl,
|
|
500
|
+
onAddImage: handleAddImage
|
|
501
|
+
}
|
|
502
|
+
) }),
|
|
503
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_design_system3.Box, { direction: "vertical", width: "stretch", gap: "10px", children: [
|
|
504
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
505
|
+
import_design_system3.FormField,
|
|
506
|
+
{
|
|
507
|
+
label: state === "EDIT" ? "New Passcode (leave blank to keep)" : "Passcode",
|
|
508
|
+
required: state !== "EDIT",
|
|
509
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
510
|
+
import_design_system3.Input,
|
|
511
|
+
{
|
|
512
|
+
type: "password",
|
|
513
|
+
value: userData.passcode,
|
|
514
|
+
onChange: (e) => handleFormChange("passcode", e.target.value),
|
|
515
|
+
disabled: !canEdit
|
|
516
|
+
}
|
|
517
|
+
)
|
|
518
|
+
}
|
|
519
|
+
),
|
|
520
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_design_system3.FormField, { label: "Team", required: true, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
521
|
+
import_design_system3.Dropdown,
|
|
522
|
+
{
|
|
523
|
+
disabled: !canEdit || isDefaultAdmin,
|
|
524
|
+
options: isDefaultAdmin ? [] : teams.map((team) => ({ id: String(team._id), value: String(team.name) })),
|
|
525
|
+
selectedId: typeof userData.team === "object" && !isDefaultAdmin ? userData.team._id : "",
|
|
526
|
+
onSelect: (option) => handleFormChange("team", { _id: String(option.id), name: String(option.value) })
|
|
527
|
+
}
|
|
528
|
+
) })
|
|
529
|
+
] })
|
|
530
|
+
] }),
|
|
531
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_design_system3.Box, { direction: "horizontal", width: "stretch", gap: "10px", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_design_system3.FormField, { label: "Name", required: true, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
532
|
+
import_design_system3.Input,
|
|
533
|
+
{
|
|
534
|
+
value: userData.name,
|
|
535
|
+
onChange: (e) => handleFormChange("name", e.target.value),
|
|
536
|
+
disabled: !canEdit
|
|
537
|
+
}
|
|
538
|
+
) }) }),
|
|
539
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_design_system3.Box, { direction: "horizontal", width: "stretch", gap: "10px", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_design_system3.FormField, { label: "Email", required: true, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
540
|
+
import_design_system3.Input,
|
|
541
|
+
{
|
|
542
|
+
suffix: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_design_system3.Box, { verticalAlign: "middle", children: "@mytickets.internal" }),
|
|
543
|
+
type: "email",
|
|
544
|
+
value: userData.email.replace("@mytickets.internal", ""),
|
|
545
|
+
onChange: (e) => handleFormChange("email", e.target.value),
|
|
546
|
+
disabled: !canEdit || isDefaultAdmin
|
|
547
|
+
}
|
|
548
|
+
) }) }),
|
|
549
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_design_system3.FormField, { label: "Phone Number", required: true, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
550
|
+
import_design_system3.Input,
|
|
551
|
+
{
|
|
552
|
+
type: "tel",
|
|
553
|
+
value: userData.phoneNumber,
|
|
554
|
+
onChange: (e) => handleFormChange("phoneNumber", e.target.value),
|
|
555
|
+
disabled: !canEdit || isDefaultAdmin
|
|
556
|
+
}
|
|
557
|
+
) }),
|
|
558
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_design_system3.Box, { direction: "horizontal", width: "stretch", gap: "10px", children: [
|
|
559
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_design_system3.FormField, { label: "Role", required: true, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
560
|
+
import_design_system3.Input,
|
|
561
|
+
{
|
|
562
|
+
value: userData.role,
|
|
563
|
+
onChange: (e) => handleFormChange("role", e.target.value),
|
|
564
|
+
disabled: !canEdit || isDefaultAdmin
|
|
565
|
+
}
|
|
566
|
+
) }),
|
|
567
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_design_system3.FormField, { label: "Is Admin", required: true, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
568
|
+
import_design_system3.ToggleSwitch,
|
|
569
|
+
{
|
|
570
|
+
size: "small",
|
|
571
|
+
checked: userData.isAdmin,
|
|
572
|
+
onChange: () => handleFormChange("isAdmin", !userData.isAdmin),
|
|
573
|
+
disabled: !canEdit || isDefaultAdmin
|
|
574
|
+
}
|
|
575
|
+
) })
|
|
576
|
+
] })
|
|
577
|
+
] }) })
|
|
578
|
+
}
|
|
579
|
+
) });
|
|
580
|
+
}
|
|
581
|
+
);
|
|
582
|
+
ManageCreateUserModal.displayName = "ManageCreateUserModal";
|
|
583
|
+
|
|
584
|
+
// src/components/ManageTicketModal/ManageTicketModal.tsx
|
|
585
|
+
var import_react6 = __toESM(require("react"));
|
|
586
|
+
|
|
587
|
+
// src/components/ManageTicketModal/useManageTicketModal.ts
|
|
588
|
+
var import_react5 = require("react");
|
|
589
|
+
var import_essentials3 = require("@wix/essentials");
|
|
43
590
|
var BASE_URL = new URL("").origin;
|
|
44
591
|
var STATE_CONFIG = {
|
|
45
592
|
STATUS_CHANGE: {
|
|
@@ -59,15 +606,15 @@ var STATE_CONFIG = {
|
|
|
59
606
|
}
|
|
60
607
|
};
|
|
61
608
|
function useManageTicketModal({ id, state, onClose }) {
|
|
62
|
-
const [isSaving, setIsSaving] = (0,
|
|
63
|
-
const [newStatus, setNewStatus] = (0,
|
|
64
|
-
const [newPriority, setNewPriority] = (0,
|
|
65
|
-
const [selectedTeam, setSelectedTeam] = (0,
|
|
66
|
-
const [teams, setTeams] = (0,
|
|
67
|
-
const [isLoading, setIsLoading] = (0,
|
|
68
|
-
const [isError, setIsError] = (0,
|
|
609
|
+
const [isSaving, setIsSaving] = (0, import_react5.useState)(false);
|
|
610
|
+
const [newStatus, setNewStatus] = (0, import_react5.useState)("");
|
|
611
|
+
const [newPriority, setNewPriority] = (0, import_react5.useState)("");
|
|
612
|
+
const [selectedTeam, setSelectedTeam] = (0, import_react5.useState)("");
|
|
613
|
+
const [teams, setTeams] = (0, import_react5.useState)([]);
|
|
614
|
+
const [isLoading, setIsLoading] = (0, import_react5.useState)(false);
|
|
615
|
+
const [isError, setIsError] = (0, import_react5.useState)(false);
|
|
69
616
|
const modalTitle = STATE_CONFIG[state]?.title ?? "Manage Ticket";
|
|
70
|
-
(0,
|
|
617
|
+
(0, import_react5.useEffect)(() => {
|
|
71
618
|
if (state !== "TRANSFER_TICKET") {
|
|
72
619
|
setIsLoading(false);
|
|
73
620
|
setIsError(false);
|
|
@@ -77,7 +624,7 @@ function useManageTicketModal({ id, state, onClose }) {
|
|
|
77
624
|
setIsError(false);
|
|
78
625
|
const fetchTeams = async () => {
|
|
79
626
|
try {
|
|
80
|
-
const response = await
|
|
627
|
+
const response = await import_essentials3.httpClient.fetchWithAuth(`${BASE_URL}/api/teams/teams`);
|
|
81
628
|
const data = await response.json();
|
|
82
629
|
setTeams(data.teams);
|
|
83
630
|
} catch (error) {
|
|
@@ -101,7 +648,7 @@ function useManageTicketModal({ id, state, onClose }) {
|
|
|
101
648
|
if (!value) return;
|
|
102
649
|
setIsSaving(true);
|
|
103
650
|
try {
|
|
104
|
-
await
|
|
651
|
+
await import_essentials3.httpClient.fetchWithAuth(config.getUrl(id, value), { method: "PUT" });
|
|
105
652
|
onClose(config.getPayload(value));
|
|
106
653
|
} catch (error) {
|
|
107
654
|
console.error("Error saving:", error);
|
|
@@ -131,22 +678,22 @@ function useManageTicketModal({ id, state, onClose }) {
|
|
|
131
678
|
}
|
|
132
679
|
|
|
133
680
|
// src/components/ManageTicketModal/ManageTicketModal.tsx
|
|
134
|
-
var
|
|
135
|
-
var
|
|
681
|
+
var import_design_system7 = require("@wix/design-system");
|
|
682
|
+
var import_styles_studio_global3 = require("@wix/design-system/styles-studio.global.css");
|
|
136
683
|
|
|
137
684
|
// src/components/ManageTicketModal/status-change-content.tsx
|
|
138
|
-
var
|
|
139
|
-
var
|
|
685
|
+
var import_design_system4 = require("@wix/design-system");
|
|
686
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
140
687
|
var STATUS_LABELS = {
|
|
141
688
|
closed: "Closed",
|
|
142
689
|
in_progress: "In Progress",
|
|
143
690
|
open: "Open"
|
|
144
691
|
};
|
|
145
692
|
var StatusChangeContent = ({ currentStatus, newStatus, onStatusChange }) => {
|
|
146
|
-
return /* @__PURE__ */ (0,
|
|
147
|
-
/* @__PURE__ */ (0,
|
|
148
|
-
/* @__PURE__ */ (0,
|
|
149
|
-
|
|
693
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_design_system4.Box, { direction: "vertical", width: "stretch", gap: "10px", children: [
|
|
694
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_design_system4.FormField, { label: "Current Status", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_design_system4.Input, { value: STATUS_LABELS[currentStatus] ?? currentStatus, disabled: true }) }),
|
|
695
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_design_system4.FormField, { label: "New Status", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
696
|
+
import_design_system4.Dropdown,
|
|
150
697
|
{
|
|
151
698
|
options: [
|
|
152
699
|
{ id: "open", value: "Open" },
|
|
@@ -164,18 +711,18 @@ var StatusChangeContent = ({ currentStatus, newStatus, onStatusChange }) => {
|
|
|
164
711
|
var status_change_content_default = StatusChangeContent;
|
|
165
712
|
|
|
166
713
|
// src/components/ManageTicketModal/priority-change-content.tsx
|
|
167
|
-
var
|
|
168
|
-
var
|
|
714
|
+
var import_design_system5 = require("@wix/design-system");
|
|
715
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
169
716
|
var PRIORITY_LABELS = {
|
|
170
717
|
high: "High",
|
|
171
718
|
medium: "Medium",
|
|
172
719
|
low: "Low"
|
|
173
720
|
};
|
|
174
721
|
var PriorityChangeContent = ({ currentPriority, newPriority, onPriorityChange }) => {
|
|
175
|
-
return /* @__PURE__ */ (0,
|
|
176
|
-
/* @__PURE__ */ (0,
|
|
177
|
-
/* @__PURE__ */ (0,
|
|
178
|
-
|
|
722
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_design_system5.Box, { direction: "vertical", width: "stretch", gap: "10px", children: [
|
|
723
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_design_system5.FormField, { label: "Current Priority", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_design_system5.Input, { value: PRIORITY_LABELS[currentPriority] ?? currentPriority, disabled: true }) }),
|
|
724
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_design_system5.FormField, { label: "New Priority", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
725
|
+
import_design_system5.Dropdown,
|
|
179
726
|
{
|
|
180
727
|
options: [
|
|
181
728
|
{ id: "high", value: "High" },
|
|
@@ -193,13 +740,13 @@ var PriorityChangeContent = ({ currentPriority, newPriority, onPriorityChange })
|
|
|
193
740
|
var priority_change_content_default = PriorityChangeContent;
|
|
194
741
|
|
|
195
742
|
// src/components/ManageTicketModal/transfer-ticket-content.tsx
|
|
196
|
-
var
|
|
197
|
-
var
|
|
743
|
+
var import_design_system6 = require("@wix/design-system");
|
|
744
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
198
745
|
var TransferTicketContent = ({ currentTeam, teams, selectedTeam, onTeamChange }) => {
|
|
199
|
-
return /* @__PURE__ */ (0,
|
|
200
|
-
/* @__PURE__ */ (0,
|
|
201
|
-
/* @__PURE__ */ (0,
|
|
202
|
-
|
|
746
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_design_system6.Box, { direction: "vertical", width: "stretch", gap: "10px", children: [
|
|
747
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_design_system6.FormField, { label: "Current Team", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_design_system6.Input, { value: currentTeam, disabled: true }) }),
|
|
748
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_design_system6.FormField, { label: "New Team", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
749
|
+
import_design_system6.Dropdown,
|
|
203
750
|
{
|
|
204
751
|
options: teams.map((team) => ({ id: team._id, value: team.name })),
|
|
205
752
|
placeholder: "Select new team",
|
|
@@ -221,8 +768,8 @@ if (typeof document !== "undefined" && !document.getElementById("jrapps-style-45
|
|
|
221
768
|
}
|
|
222
769
|
|
|
223
770
|
// src/components/ManageTicketModal/ManageTicketModal.tsx
|
|
224
|
-
var
|
|
225
|
-
var ManageTicketModal =
|
|
771
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
772
|
+
var ManageTicketModal = import_react6.default.forwardRef(
|
|
226
773
|
({
|
|
227
774
|
className,
|
|
228
775
|
isOpen,
|
|
@@ -251,13 +798,13 @@ var ManageTicketModal = import_react2.default.forwardRef(
|
|
|
251
798
|
} = useManageTicketModal({ id, state, onClose });
|
|
252
799
|
const renderContent = () => {
|
|
253
800
|
if (isLoading) {
|
|
254
|
-
return /* @__PURE__ */ (0,
|
|
801
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_design_system7.Box, { direction: "vertical", width: "stretch", gap: "10px", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_design_system7.Loader, { size: "medium", status: "loading", text: "Loading..." }) });
|
|
255
802
|
}
|
|
256
803
|
if (isError) {
|
|
257
|
-
return /* @__PURE__ */ (0,
|
|
804
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_design_system7.Box, { direction: "vertical", width: "stretch", gap: "10px", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_design_system7.Loader, { size: "medium", status: "error", text: "Error loading data" }) });
|
|
258
805
|
}
|
|
259
806
|
if (state === "STATUS_CHANGE") {
|
|
260
|
-
return /* @__PURE__ */ (0,
|
|
807
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
261
808
|
status_change_content_default,
|
|
262
809
|
{
|
|
263
810
|
currentStatus: currentStatus ?? "",
|
|
@@ -267,7 +814,7 @@ var ManageTicketModal = import_react2.default.forwardRef(
|
|
|
267
814
|
);
|
|
268
815
|
}
|
|
269
816
|
if (state === "PRIORITY_CHANGE") {
|
|
270
|
-
return /* @__PURE__ */ (0,
|
|
817
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
271
818
|
priority_change_content_default,
|
|
272
819
|
{
|
|
273
820
|
currentPriority: currentPriority ?? "",
|
|
@@ -277,7 +824,7 @@ var ManageTicketModal = import_react2.default.forwardRef(
|
|
|
277
824
|
);
|
|
278
825
|
}
|
|
279
826
|
if (state === "TRANSFER_TICKET") {
|
|
280
|
-
return /* @__PURE__ */ (0,
|
|
827
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
281
828
|
transfer_ticket_content_default,
|
|
282
829
|
{
|
|
283
830
|
currentTeam: currentTeamName,
|
|
@@ -289,11 +836,11 @@ var ManageTicketModal = import_react2.default.forwardRef(
|
|
|
289
836
|
}
|
|
290
837
|
return null;
|
|
291
838
|
};
|
|
292
|
-
return /* @__PURE__ */ (0,
|
|
293
|
-
|
|
839
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_design_system7.Modal, { isOpen, ref, className, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
840
|
+
import_design_system7.CustomModalLayout,
|
|
294
841
|
{
|
|
295
842
|
width: "500px",
|
|
296
|
-
primaryButtonText: isSaving ? /* @__PURE__ */ (0,
|
|
843
|
+
primaryButtonText: isSaving ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_design_system7.Loader, { size: "tiny" }) : "Save",
|
|
297
844
|
secondaryButtonText: "Cancel",
|
|
298
845
|
primaryButtonOnClick: handleSave,
|
|
299
846
|
secondaryButtonOnClick: handleCancel,
|
|
@@ -301,9 +848,9 @@ var ManageTicketModal = import_react2.default.forwardRef(
|
|
|
301
848
|
showFooterDivider: true,
|
|
302
849
|
title: modalTitle,
|
|
303
850
|
subtitle: !isLoading ? ticketNumber : "",
|
|
304
|
-
footnote: /* @__PURE__ */ (0,
|
|
851
|
+
footnote: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_design_system7.Box, { alignContent: "center", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_design_system7.Text, { size: "small", children: [
|
|
305
852
|
"Powered by ",
|
|
306
|
-
/* @__PURE__ */ (0,
|
|
853
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_design_system7.Text, { size: "small", weight: "bold", children: "My Tickets" })
|
|
307
854
|
] }) }),
|
|
308
855
|
content: renderContent()
|
|
309
856
|
}
|