@jrapps/my_tickets_dashboard_ui 0.0.8 → 0.0.10
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/index.js +66 -355
- package/dist/cjs/index.js.map +4 -4
- package/dist/esm/index.js +0 -4
- package/dist/types/components/index.d.ts +0 -1
- package/dist/types/components/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/cjs/components/ManageTicketModal/index.js +0 -314
- package/dist/cjs/components/ManageTicketModal/index.js.map +0 -7
- package/dist/esm/chunks/chunk-YIO4EY76.js +0 -288
- package/dist/esm/chunks/chunk-YIO4EY76.js.map +0 -7
- package/dist/esm/components/ManageTicketModal/index.js +0 -7
- package/dist/esm/components/ManageTicketModal/index.js.map +0 -7
- package/dist/types/components/ManageTicketModal/ManageTicketModal.d.ts +0 -6
- package/dist/types/components/ManageTicketModal/ManageTicketModal.d.ts.map +0 -1
- package/dist/types/components/ManageTicketModal/ManageTicketModal.types.d.ts +0 -37
- package/dist/types/components/ManageTicketModal/ManageTicketModal.types.d.ts.map +0 -1
- package/dist/types/components/ManageTicketModal/index.d.ts +0 -3
- package/dist/types/components/ManageTicketModal/index.d.ts.map +0 -1
- package/dist/types/components/ManageTicketModal/priority-change-content.d.ts +0 -5
- package/dist/types/components/ManageTicketModal/priority-change-content.d.ts.map +0 -1
- package/dist/types/components/ManageTicketModal/status-change-content.d.ts +0 -5
- package/dist/types/components/ManageTicketModal/status-change-content.d.ts.map +0 -1
- package/dist/types/components/ManageTicketModal/transfer-ticket-content.d.ts +0 -5
- package/dist/types/components/ManageTicketModal/transfer-ticket-content.d.ts.map +0 -1
- package/dist/types/components/ManageTicketModal/useManageTicketModal.d.ts +0 -30
- package/dist/types/components/ManageTicketModal/useManageTicketModal.d.ts.map +0 -1
package/dist/cjs/index.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
2
|
var __defProp = Object.defineProperty;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
6
|
var __export = (target, all) => {
|
|
9
7
|
for (var name in all)
|
|
@@ -17,312 +15,25 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
15
|
}
|
|
18
16
|
return to;
|
|
19
17
|
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
19
|
|
|
30
20
|
// src/index.ts
|
|
31
21
|
var src_exports = {};
|
|
32
22
|
__export(src_exports, {
|
|
33
|
-
ManageTicketModal: () => ManageTicketModal,
|
|
34
23
|
Sidebar: () => Sidebar
|
|
35
24
|
});
|
|
36
25
|
module.exports = __toCommonJS(src_exports);
|
|
37
26
|
|
|
38
|
-
// src/components/ManageTicketModal/ManageTicketModal.tsx
|
|
39
|
-
var import_react2 = __toESM(require("react"));
|
|
40
|
-
|
|
41
|
-
// src/components/ManageTicketModal/useManageTicketModal.ts
|
|
42
|
-
var import_react = require("react");
|
|
43
|
-
var import_essentials = require("@wix/essentials");
|
|
44
|
-
var BASE_URL = new URL("").origin;
|
|
45
|
-
var STATE_CONFIG = {
|
|
46
|
-
STATUS_CHANGE: {
|
|
47
|
-
title: "Change Status",
|
|
48
|
-
getUrl: (id, value) => `${BASE_URL}/api/tickets/update-ticket-status?id=${id}&status=${value}`,
|
|
49
|
-
getPayload: (value) => ({ newStatus: value })
|
|
50
|
-
},
|
|
51
|
-
PRIORITY_CHANGE: {
|
|
52
|
-
title: "Change Priority",
|
|
53
|
-
getUrl: (id, value) => `${BASE_URL}/api/tickets/update-ticket-priority?id=${id}&priority=${value}`,
|
|
54
|
-
getPayload: (value) => ({ newPriority: value })
|
|
55
|
-
},
|
|
56
|
-
TRANSFER_TICKET: {
|
|
57
|
-
title: "Transfer Ticket",
|
|
58
|
-
getUrl: (id, value) => `${BASE_URL}/api/tickets/transfer-ticket?id=${id}&teamId=${value}`,
|
|
59
|
-
getPayload: (value) => ({ newTeamId: value })
|
|
60
|
-
}
|
|
61
|
-
};
|
|
62
|
-
function useManageTicketModal({ id, state, onClose }) {
|
|
63
|
-
const [isSaving, setIsSaving] = (0, import_react.useState)(false);
|
|
64
|
-
const [newStatus, setNewStatus] = (0, import_react.useState)("");
|
|
65
|
-
const [newPriority, setNewPriority] = (0, import_react.useState)("");
|
|
66
|
-
const [selectedTeam, setSelectedTeam] = (0, import_react.useState)("");
|
|
67
|
-
const [teams, setTeams] = (0, import_react.useState)([]);
|
|
68
|
-
const [isLoading, setIsLoading] = (0, import_react.useState)(false);
|
|
69
|
-
const [isError, setIsError] = (0, import_react.useState)(false);
|
|
70
|
-
const modalTitle = STATE_CONFIG[state]?.title ?? "Manage Ticket";
|
|
71
|
-
(0, import_react.useEffect)(() => {
|
|
72
|
-
if (state !== "TRANSFER_TICKET") {
|
|
73
|
-
setIsLoading(false);
|
|
74
|
-
setIsError(false);
|
|
75
|
-
return;
|
|
76
|
-
}
|
|
77
|
-
setIsLoading(true);
|
|
78
|
-
setIsError(false);
|
|
79
|
-
const fetchTeams = async () => {
|
|
80
|
-
try {
|
|
81
|
-
const response = await import_essentials.httpClient.fetchWithAuth(`${BASE_URL}/api/teams/teams`);
|
|
82
|
-
const data = await response.json();
|
|
83
|
-
setTeams(data.teams);
|
|
84
|
-
} catch (error) {
|
|
85
|
-
console.error("Error fetching teams:", error);
|
|
86
|
-
setIsError(true);
|
|
87
|
-
} finally {
|
|
88
|
-
setIsLoading(false);
|
|
89
|
-
}
|
|
90
|
-
};
|
|
91
|
-
fetchTeams();
|
|
92
|
-
}, [id, state]);
|
|
93
|
-
const handleSave = async () => {
|
|
94
|
-
const config = STATE_CONFIG[state];
|
|
95
|
-
if (!config) return;
|
|
96
|
-
const valueMap = {
|
|
97
|
-
STATUS_CHANGE: newStatus,
|
|
98
|
-
PRIORITY_CHANGE: newPriority,
|
|
99
|
-
TRANSFER_TICKET: selectedTeam
|
|
100
|
-
};
|
|
101
|
-
const value = valueMap[state];
|
|
102
|
-
if (!value) return;
|
|
103
|
-
setIsSaving(true);
|
|
104
|
-
try {
|
|
105
|
-
await import_essentials.httpClient.fetchWithAuth(config.getUrl(id, value), { method: "PUT" });
|
|
106
|
-
onClose(config.getPayload(value));
|
|
107
|
-
} catch (error) {
|
|
108
|
-
console.error("Error saving:", error);
|
|
109
|
-
} finally {
|
|
110
|
-
setIsSaving(false);
|
|
111
|
-
}
|
|
112
|
-
};
|
|
113
|
-
const handleCancel = () => onClose({ cancelled: true });
|
|
114
|
-
return {
|
|
115
|
-
// State
|
|
116
|
-
isSaving,
|
|
117
|
-
isLoading,
|
|
118
|
-
isError,
|
|
119
|
-
teams,
|
|
120
|
-
newStatus,
|
|
121
|
-
newPriority,
|
|
122
|
-
selectedTeam,
|
|
123
|
-
modalTitle,
|
|
124
|
-
// Setters
|
|
125
|
-
setNewStatus,
|
|
126
|
-
setNewPriority,
|
|
127
|
-
setSelectedTeam,
|
|
128
|
-
// Handlers
|
|
129
|
-
handleSave,
|
|
130
|
-
handleCancel
|
|
131
|
-
};
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
// src/components/ManageTicketModal/ManageTicketModal.tsx
|
|
135
|
-
var import_design_system4 = require("@wix/design-system");
|
|
136
|
-
var import_styles_studio_global = require("@wix/design-system/styles-studio.global.css");
|
|
137
|
-
|
|
138
|
-
// src/components/ManageTicketModal/status-change-content.tsx
|
|
139
|
-
var import_design_system = require("@wix/design-system");
|
|
140
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
141
|
-
var STATUS_LABELS = {
|
|
142
|
-
closed: "Closed",
|
|
143
|
-
in_progress: "In Progress",
|
|
144
|
-
open: "Open"
|
|
145
|
-
};
|
|
146
|
-
var StatusChangeContent = ({ currentStatus, newStatus, onStatusChange }) => {
|
|
147
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_design_system.Box, { direction: "vertical", width: "stretch", gap: "10px", children: [
|
|
148
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_design_system.FormField, { label: "Current Status", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_design_system.Input, { value: STATUS_LABELS[currentStatus] ?? currentStatus, disabled: true }) }),
|
|
149
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_design_system.FormField, { label: "New Status", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
150
|
-
import_design_system.Dropdown,
|
|
151
|
-
{
|
|
152
|
-
options: [
|
|
153
|
-
{ id: "open", value: "Open" },
|
|
154
|
-
{ id: "in_progress", value: "In Progress" },
|
|
155
|
-
{ id: "closed", value: "Closed" }
|
|
156
|
-
],
|
|
157
|
-
placeholder: "Select new status",
|
|
158
|
-
selectedId: newStatus || "",
|
|
159
|
-
popoverProps: { appendTo: "window", zIndex: 9999 },
|
|
160
|
-
onSelect: (option) => onStatusChange(option?.id ?? "")
|
|
161
|
-
}
|
|
162
|
-
) })
|
|
163
|
-
] });
|
|
164
|
-
};
|
|
165
|
-
var status_change_content_default = StatusChangeContent;
|
|
166
|
-
|
|
167
|
-
// src/components/ManageTicketModal/priority-change-content.tsx
|
|
168
|
-
var import_design_system2 = require("@wix/design-system");
|
|
169
|
-
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
170
|
-
var PRIORITY_LABELS = {
|
|
171
|
-
high: "High",
|
|
172
|
-
medium: "Medium",
|
|
173
|
-
low: "Low"
|
|
174
|
-
};
|
|
175
|
-
var PriorityChangeContent = ({ currentPriority, newPriority, onPriorityChange }) => {
|
|
176
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_design_system2.Box, { direction: "vertical", width: "stretch", gap: "10px", children: [
|
|
177
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_design_system2.FormField, { label: "Current Priority", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_design_system2.Input, { value: PRIORITY_LABELS[currentPriority] ?? currentPriority, disabled: true }) }),
|
|
178
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_design_system2.FormField, { label: "New Priority", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
179
|
-
import_design_system2.Dropdown,
|
|
180
|
-
{
|
|
181
|
-
options: [
|
|
182
|
-
{ id: "high", value: "High" },
|
|
183
|
-
{ id: "medium", value: "Medium" },
|
|
184
|
-
{ id: "low", value: "Low" }
|
|
185
|
-
],
|
|
186
|
-
placeholder: "Select new priority",
|
|
187
|
-
selectedId: newPriority || "",
|
|
188
|
-
popoverProps: { appendTo: "window", zIndex: 9999 },
|
|
189
|
-
onSelect: (option) => onPriorityChange(option?.id ?? "")
|
|
190
|
-
}
|
|
191
|
-
) })
|
|
192
|
-
] });
|
|
193
|
-
};
|
|
194
|
-
var priority_change_content_default = PriorityChangeContent;
|
|
195
|
-
|
|
196
|
-
// src/components/ManageTicketModal/transfer-ticket-content.tsx
|
|
197
|
-
var import_design_system3 = require("@wix/design-system");
|
|
198
|
-
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
199
|
-
var TransferTicketContent = ({ currentTeam, teams, selectedTeam, onTeamChange }) => {
|
|
200
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_design_system3.Box, { direction: "vertical", width: "stretch", gap: "10px", children: [
|
|
201
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_design_system3.FormField, { label: "Current Team", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_design_system3.Input, { value: currentTeam, disabled: true }) }),
|
|
202
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_design_system3.FormField, { label: "New Team", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
203
|
-
import_design_system3.Dropdown,
|
|
204
|
-
{
|
|
205
|
-
options: teams.map((team) => ({ id: team._id, value: team.name })),
|
|
206
|
-
placeholder: "Select new team",
|
|
207
|
-
selectedId: selectedTeam || "",
|
|
208
|
-
popoverProps: { appendTo: "window", zIndex: 9999 },
|
|
209
|
-
onSelect: (option) => onTeamChange(option?.id ?? "")
|
|
210
|
-
}
|
|
211
|
-
) })
|
|
212
|
-
] });
|
|
213
|
-
};
|
|
214
|
-
var transfer_ticket_content_default = TransferTicketContent;
|
|
215
|
-
|
|
216
|
-
// src/components/ManageTicketModal/ManageTicketModal.css
|
|
217
|
-
if (typeof document !== "undefined" && !document.getElementById("jrapps-style-94103778")) {
|
|
218
|
-
const s = document.createElement("style");
|
|
219
|
-
s.id = "jrapps-style-94103778";
|
|
220
|
-
s.textContent = ".manage-ticket-modal {\n /* ManageTicketModal base styles */\n}\n";
|
|
221
|
-
document.head.appendChild(s);
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
// src/components/ManageTicketModal/ManageTicketModal.tsx
|
|
225
|
-
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
226
|
-
var ManageTicketModal = import_react2.default.forwardRef(
|
|
227
|
-
({
|
|
228
|
-
className,
|
|
229
|
-
isOpen,
|
|
230
|
-
id,
|
|
231
|
-
state,
|
|
232
|
-
onClose,
|
|
233
|
-
currentStatus,
|
|
234
|
-
currentPriority,
|
|
235
|
-
ticketNumber,
|
|
236
|
-
currentTeamName
|
|
237
|
-
}, ref) => {
|
|
238
|
-
const {
|
|
239
|
-
isSaving,
|
|
240
|
-
isLoading,
|
|
241
|
-
isError,
|
|
242
|
-
teams,
|
|
243
|
-
newStatus,
|
|
244
|
-
newPriority,
|
|
245
|
-
selectedTeam,
|
|
246
|
-
modalTitle,
|
|
247
|
-
setNewStatus,
|
|
248
|
-
setNewPriority,
|
|
249
|
-
setSelectedTeam,
|
|
250
|
-
handleSave,
|
|
251
|
-
handleCancel
|
|
252
|
-
} = useManageTicketModal({ id, state, onClose });
|
|
253
|
-
const renderContent = () => {
|
|
254
|
-
if (isLoading) {
|
|
255
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_design_system4.Box, { direction: "vertical", width: "stretch", gap: "10px", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_design_system4.Loader, { size: "medium", status: "loading", text: "Loading..." }) });
|
|
256
|
-
}
|
|
257
|
-
if (isError) {
|
|
258
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_design_system4.Box, { direction: "vertical", width: "stretch", gap: "10px", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_design_system4.Loader, { size: "medium", status: "error", text: "Error loading data" }) });
|
|
259
|
-
}
|
|
260
|
-
if (state === "STATUS_CHANGE") {
|
|
261
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
262
|
-
status_change_content_default,
|
|
263
|
-
{
|
|
264
|
-
currentStatus: currentStatus ?? "",
|
|
265
|
-
newStatus,
|
|
266
|
-
onStatusChange: setNewStatus
|
|
267
|
-
}
|
|
268
|
-
);
|
|
269
|
-
}
|
|
270
|
-
if (state === "PRIORITY_CHANGE") {
|
|
271
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
272
|
-
priority_change_content_default,
|
|
273
|
-
{
|
|
274
|
-
currentPriority: currentPriority ?? "",
|
|
275
|
-
newPriority,
|
|
276
|
-
onPriorityChange: setNewPriority
|
|
277
|
-
}
|
|
278
|
-
);
|
|
279
|
-
}
|
|
280
|
-
if (state === "TRANSFER_TICKET") {
|
|
281
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
282
|
-
transfer_ticket_content_default,
|
|
283
|
-
{
|
|
284
|
-
currentTeam: currentTeamName,
|
|
285
|
-
teams,
|
|
286
|
-
selectedTeam,
|
|
287
|
-
onTeamChange: setSelectedTeam
|
|
288
|
-
}
|
|
289
|
-
);
|
|
290
|
-
}
|
|
291
|
-
return null;
|
|
292
|
-
};
|
|
293
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_design_system4.Modal, { isOpen, ref, className, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
294
|
-
import_design_system4.CustomModalLayout,
|
|
295
|
-
{
|
|
296
|
-
width: "500px",
|
|
297
|
-
primaryButtonText: isSaving ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_design_system4.Loader, { size: "tiny" }) : "Save",
|
|
298
|
-
secondaryButtonText: "Cancel",
|
|
299
|
-
primaryButtonOnClick: handleSave,
|
|
300
|
-
secondaryButtonOnClick: handleCancel,
|
|
301
|
-
showHeaderDivider: true,
|
|
302
|
-
showFooterDivider: true,
|
|
303
|
-
title: modalTitle,
|
|
304
|
-
subtitle: !isLoading ? ticketNumber : "",
|
|
305
|
-
footnote: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_design_system4.Box, { alignContent: "center", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_design_system4.Text, { size: "small", children: [
|
|
306
|
-
"Powered by ",
|
|
307
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_design_system4.Text, { size: "small", weight: "bold", children: "My Tickets" })
|
|
308
|
-
] }) }),
|
|
309
|
-
content: renderContent()
|
|
310
|
-
}
|
|
311
|
-
) });
|
|
312
|
-
}
|
|
313
|
-
);
|
|
314
|
-
ManageTicketModal.displayName = "ManageTicketModal";
|
|
315
|
-
|
|
316
27
|
// src/components/Sidebar/Sidebar.tsx
|
|
317
|
-
var
|
|
318
|
-
var
|
|
28
|
+
var import_react3 = require("react");
|
|
29
|
+
var import_design_system3 = require("@wix/design-system");
|
|
319
30
|
var import_wix_ui_icons_common2 = require("@wix/wix-ui-icons-common");
|
|
320
31
|
|
|
321
32
|
// src/components/Sidebar/sidebar-menu-item.tsx
|
|
322
|
-
var
|
|
323
|
-
var
|
|
33
|
+
var import_react = require("react");
|
|
34
|
+
var import_design_system = require("@wix/design-system");
|
|
324
35
|
var import_dashboard = require("@wix/dashboard");
|
|
325
|
-
var
|
|
36
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
326
37
|
var SidebarMenuItem = ({
|
|
327
38
|
item,
|
|
328
39
|
items,
|
|
@@ -337,11 +48,11 @@ var SidebarMenuItem = ({
|
|
|
337
48
|
onModalClosed,
|
|
338
49
|
onCreateTicketClicked
|
|
339
50
|
}) => {
|
|
340
|
-
const [itemTotalCount, setItemTotalCount] = (0,
|
|
51
|
+
const [itemTotalCount, setItemTotalCount] = (0, import_react.useState)(totalCount);
|
|
341
52
|
const hasChildren = items.some((i) => i.parent === item.stateId);
|
|
342
53
|
const isExpanded = expandedSections.has(item.stateId);
|
|
343
54
|
const isSelected = selectedId === item.stateId;
|
|
344
|
-
(0,
|
|
55
|
+
(0, import_react.useEffect)(() => {
|
|
345
56
|
setItemTotalCount(totalCount);
|
|
346
57
|
}, [totalCount]);
|
|
347
58
|
const handleAction = async (actionItem) => {
|
|
@@ -363,34 +74,34 @@ var SidebarMenuItem = ({
|
|
|
363
74
|
};
|
|
364
75
|
if (hasChildren) {
|
|
365
76
|
const children = items.filter((i) => i.parent === item.stateId);
|
|
366
|
-
return /* @__PURE__ */ (0,
|
|
367
|
-
/* @__PURE__ */ (0,
|
|
77
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "sidebar-section", children: [
|
|
78
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
368
79
|
"div",
|
|
369
80
|
{
|
|
370
81
|
className: `sidebar-item sidebar-parent-item ${isSelected ? "sidebar-item-selected" : ""}`,
|
|
371
82
|
onClick: () => onToggleSection(item.stateId),
|
|
372
83
|
children: [
|
|
373
|
-
/* @__PURE__ */ (0,
|
|
374
|
-
expanded && /* @__PURE__ */ (0,
|
|
375
|
-
/* @__PURE__ */ (0,
|
|
376
|
-
/* @__PURE__ */ (0,
|
|
377
|
-
item.subtitle && /* @__PURE__ */ (0,
|
|
84
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_design_system.Box, { className: "sidebar-item-icon", children: item.prefixIcon }),
|
|
85
|
+
expanded && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
86
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_design_system.Box, { className: "sidebar-item-content", direction: "vertical", children: [
|
|
87
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_design_system.Text, { size: "small", className: "sidebar-item-title", children: item.label }),
|
|
88
|
+
item.subtitle && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_design_system.Text, { size: "small", className: "sidebar-item-subtitle", children: item.subtitle })
|
|
378
89
|
] }),
|
|
379
|
-
/* @__PURE__ */ (0,
|
|
90
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_design_system.Box, { className: `sidebar-item-chevron ${isExpanded ? "expanded" : ""}`, children: "\u25BC" })
|
|
380
91
|
] })
|
|
381
92
|
]
|
|
382
93
|
}
|
|
383
94
|
),
|
|
384
|
-
isExpanded && /* @__PURE__ */ (0,
|
|
95
|
+
isExpanded && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_design_system.Box, { className: "sidebar-submenu-container", direction: "vertical", children: children.map((child) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
385
96
|
"div",
|
|
386
97
|
{
|
|
387
98
|
className: `sidebar-item sidebar-child-item ${expandedClassName} ${selectedId === child.stateId ? "sidebar-item-selected" : ""}`,
|
|
388
99
|
onClick: () => handleAction(child),
|
|
389
100
|
children: [
|
|
390
|
-
/* @__PURE__ */ (0,
|
|
391
|
-
expanded && /* @__PURE__ */ (0,
|
|
392
|
-
/* @__PURE__ */ (0,
|
|
393
|
-
child.subtitle && /* @__PURE__ */ (0,
|
|
101
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_design_system.Box, { className: "sidebar-item-icon", children: child.prefixIcon }),
|
|
102
|
+
expanded && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_design_system.Box, { className: "sidebar-item-content", direction: "vertical", children: [
|
|
103
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_design_system.Text, { size: "small", className: "sidebar-item-title-submenu", children: child.label }),
|
|
104
|
+
child.subtitle && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_design_system.Text, { size: "small", className: "sidebar-item-subtitle", children: child.subtitle })
|
|
394
105
|
] }) })
|
|
395
106
|
]
|
|
396
107
|
},
|
|
@@ -398,19 +109,19 @@ var SidebarMenuItem = ({
|
|
|
398
109
|
)) })
|
|
399
110
|
] }, item.stateId);
|
|
400
111
|
}
|
|
401
|
-
return /* @__PURE__ */ (0,
|
|
112
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
402
113
|
"div",
|
|
403
114
|
{
|
|
404
115
|
className: `sidebar-item ${expandedClassName} ${isSelected ? "sidebar-item-selected" : ""}`,
|
|
405
116
|
onClick: () => handleAction(item),
|
|
406
117
|
children: [
|
|
407
|
-
/* @__PURE__ */ (0,
|
|
408
|
-
expanded && /* @__PURE__ */ (0,
|
|
409
|
-
/* @__PURE__ */ (0,
|
|
410
|
-
/* @__PURE__ */ (0,
|
|
411
|
-
item.subtitle && /* @__PURE__ */ (0,
|
|
118
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_design_system.Box, { className: "sidebar-item-icon", children: item.prefixIcon }),
|
|
119
|
+
expanded && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_design_system.Box, { className: "sidebar-item-content", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_design_system.Box, { verticalAlign: "middle", gap: 2, children: [
|
|
120
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_design_system.Box, { direction: "vertical", children: [
|
|
121
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_design_system.Text, { size: "small", className: "sidebar-item-title", children: item.label }),
|
|
122
|
+
item.subtitle && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_design_system.Text, { size: "small", className: "sidebar-item-subtitle", children: item.subtitle })
|
|
412
123
|
] }),
|
|
413
|
-
item?.showTotalCount && item?.showTotalCount === true && /* @__PURE__ */ (0,
|
|
124
|
+
item?.showTotalCount && item?.showTotalCount === true && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_design_system.CounterBadge, { size: "medium", skin: "warning", children: String(itemTotalCount) })
|
|
414
125
|
] }) }) })
|
|
415
126
|
]
|
|
416
127
|
},
|
|
@@ -420,22 +131,22 @@ var SidebarMenuItem = ({
|
|
|
420
131
|
var sidebar_menu_item_default = SidebarMenuItem;
|
|
421
132
|
|
|
422
133
|
// src/components/Sidebar/footer/avatar-dropdown.wrapper.tsx
|
|
423
|
-
var
|
|
424
|
-
var
|
|
134
|
+
var import_react2 = require("react");
|
|
135
|
+
var import_design_system2 = require("@wix/design-system");
|
|
425
136
|
|
|
426
137
|
// src/components/Sidebar/footer/status-dots.wrapper.tsx
|
|
427
|
-
var
|
|
138
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
428
139
|
var Online = () => {
|
|
429
|
-
return /* @__PURE__ */ (0,
|
|
140
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { style: { width: "8px", height: "8px", borderRadius: "50%", background: "#22c55e", boxShadow: "0 0 0 2px #fff" } });
|
|
430
141
|
};
|
|
431
142
|
var Away = () => {
|
|
432
|
-
return /* @__PURE__ */ (0,
|
|
143
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { style: { width: "8px", height: "8px", borderRadius: "50%", background: "#f59e0b", boxShadow: "0 0 0 2px #fff" } });
|
|
433
144
|
};
|
|
434
145
|
var DoNotDisturb = () => {
|
|
435
|
-
return /* @__PURE__ */ (0,
|
|
146
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { style: { position: "relative", width: "8px", height: "8px", borderRadius: "50%", background: "#ef4444", boxShadow: "0 0 0 2px #fff" }, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { style: { position: "absolute", top: "50%", left: "10%", right: "10%", height: "2px", background: "#fff", transform: "translateY(-50%)", borderRadius: "1px" } }) });
|
|
436
147
|
};
|
|
437
148
|
var Offline = () => {
|
|
438
|
-
return /* @__PURE__ */ (0,
|
|
149
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { style: { width: "8px", height: "8px", borderRadius: "50%", border: "2px solid #71717a", boxShadow: "0 0 0 2px #fff" } });
|
|
439
150
|
};
|
|
440
151
|
var StatusDots = {
|
|
441
152
|
Online,
|
|
@@ -447,9 +158,9 @@ var status_dots_wrapper_default = StatusDots;
|
|
|
447
158
|
|
|
448
159
|
// src/components/Sidebar/footer/avatar-dropdown.wrapper.tsx
|
|
449
160
|
var import_wix_ui_icons_common = require("@wix/wix-ui-icons-common");
|
|
450
|
-
var
|
|
161
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
451
162
|
var AvatarDropdown = ({ status = "online", onStatusChange, onLogout, permissions, agentProfilePictureUrl, agentName, agentRole }) => {
|
|
452
|
-
const [selectedStatus, setSelectedStatus] = (0,
|
|
163
|
+
const [selectedStatus, setSelectedStatus] = (0, import_react2.useState)(status);
|
|
453
164
|
const handleStatusChange = (newStatus) => {
|
|
454
165
|
setSelectedStatus(newStatus);
|
|
455
166
|
if (onStatusChange) {
|
|
@@ -462,45 +173,45 @@ var AvatarDropdown = ({ status = "online", onStatusChange, onLogout, permissions
|
|
|
462
173
|
}
|
|
463
174
|
};
|
|
464
175
|
const options = [
|
|
465
|
-
(0,
|
|
176
|
+
(0, import_design_system2.listItemSectionBuilder)({
|
|
466
177
|
id: "status-section",
|
|
467
178
|
title: "Online Status"
|
|
468
179
|
}),
|
|
469
|
-
(0,
|
|
180
|
+
(0, import_design_system2.listItemSelectBuilder)({
|
|
470
181
|
id: "online",
|
|
471
182
|
checkbox: true,
|
|
472
|
-
prefix: /* @__PURE__ */ (0,
|
|
183
|
+
prefix: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(status_dots_wrapper_default.Online, {}),
|
|
473
184
|
title: "Online",
|
|
474
185
|
disabled: permissions?.["my-tickets-change-agent-online-status"] === true ? false : true
|
|
475
186
|
}),
|
|
476
|
-
(0,
|
|
187
|
+
(0, import_design_system2.listItemSelectBuilder)({
|
|
477
188
|
id: "busy",
|
|
478
189
|
checkbox: true,
|
|
479
|
-
prefix: /* @__PURE__ */ (0,
|
|
190
|
+
prefix: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(status_dots_wrapper_default.Away, {}),
|
|
480
191
|
title: "Away",
|
|
481
192
|
disabled: permissions?.["my-tickets-change-agent-online-status"] === true ? false : true
|
|
482
193
|
}),
|
|
483
|
-
(0,
|
|
194
|
+
(0, import_design_system2.listItemSelectBuilder)({
|
|
484
195
|
id: "offline",
|
|
485
196
|
checkbox: true,
|
|
486
|
-
prefix: /* @__PURE__ */ (0,
|
|
197
|
+
prefix: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(status_dots_wrapper_default.DoNotDisturb, {}),
|
|
487
198
|
title: "Offline",
|
|
488
199
|
disabled: permissions?.["my-tickets-change-agent-online-status"] === true ? false : true
|
|
489
200
|
}),
|
|
490
201
|
{ id: "divider-1", value: "-" },
|
|
491
|
-
(0,
|
|
202
|
+
(0, import_design_system2.listItemActionBuilder)({
|
|
492
203
|
id: 0,
|
|
493
204
|
title: "Logout",
|
|
494
205
|
onClick: handleLogout
|
|
495
206
|
})
|
|
496
207
|
];
|
|
497
|
-
return /* @__PURE__ */ (0,
|
|
498
|
-
/* @__PURE__ */ (0,
|
|
499
|
-
/* @__PURE__ */ (0,
|
|
500
|
-
/* @__PURE__ */ (0,
|
|
501
|
-
/* @__PURE__ */ (0,
|
|
208
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_design_system2.DropdownBase, { options, selectedId: selectedStatus, onSelect: (option) => typeof option.id === "string" && handleStatusChange(option.id), className: "sidebar-avatar-dropdown", minWidth: 0, children: ({ toggle }) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_design_system2.TextButton, { className: "header-account-button", onClick: toggle, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_design_system2.Box, { verticalAlign: "middle", gap: 2, textAlign: "start", maxWidth: "100%", minWidth: 0, children: [
|
|
209
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_design_system2.Avatar, { presence: selectedStatus, name: agentName && !agentProfilePictureUrl ? agentName : void 0, size: "size30", imgProps: !agentName && agentProfilePictureUrl || agentName && agentProfilePictureUrl ? { src: agentProfilePictureUrl } : void 0 }),
|
|
210
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_design_system2.Box, { direction: "vertical", gap: 0, verticalAlign: "middle", maxWidth: "100%", minWidth: 0, children: [
|
|
211
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_design_system2.Text, { weight: "bold", size: "small", ellipsis: true, maxWidth: "100%", children: agentName ? agentName : "Error getting name" }),
|
|
212
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_design_system2.Text, { size: "tiny", secondary: true, ellipsis: true, maxWidth: "100%", children: agentRole ? agentRole : "Error getting role" })
|
|
502
213
|
] }),
|
|
503
|
-
/* @__PURE__ */ (0,
|
|
214
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_wix_ui_icons_common.ChevronDown, {})
|
|
504
215
|
] }) }) });
|
|
505
216
|
};
|
|
506
217
|
var avatar_dropdown_wrapper_default = AvatarDropdown;
|
|
@@ -514,8 +225,8 @@ if (typeof document !== "undefined" && !document.getElementById("jrapps-style-ee
|
|
|
514
225
|
}
|
|
515
226
|
|
|
516
227
|
// src/components/Sidebar/Sidebar.tsx
|
|
517
|
-
var
|
|
518
|
-
var Sidebar = (0,
|
|
228
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
229
|
+
var Sidebar = (0, import_react3.forwardRef)(
|
|
519
230
|
({
|
|
520
231
|
className,
|
|
521
232
|
children,
|
|
@@ -534,10 +245,10 @@ var Sidebar = (0, import_react5.forwardRef)(
|
|
|
534
245
|
onLogout,
|
|
535
246
|
permissions
|
|
536
247
|
}, ref) => {
|
|
537
|
-
const [expandedSections, setExpandedSections] = (0,
|
|
538
|
-
const [expanded, setExpanded] = (0,
|
|
539
|
-
const [shouldShowExpandButton, setShouldShowExpandButton] = (0,
|
|
540
|
-
const sidebarRef = (0,
|
|
248
|
+
const [expandedSections, setExpandedSections] = (0, import_react3.useState)(/* @__PURE__ */ new Set());
|
|
249
|
+
const [expanded, setExpanded] = (0, import_react3.useState)(true);
|
|
250
|
+
const [shouldShowExpandButton, setShouldShowExpandButton] = (0, import_react3.useState)(false);
|
|
251
|
+
const sidebarRef = (0, import_react3.useRef)(null);
|
|
541
252
|
const SIDEBAR_EXPANDED_WIDTH = "210px";
|
|
542
253
|
const toggleSection = (sectionId) => {
|
|
543
254
|
const newExpanded = new Set(expandedSections);
|
|
@@ -581,14 +292,14 @@ var Sidebar = (0, import_react5.forwardRef)(
|
|
|
581
292
|
const rootItems = items.filter((item) => !item.parent || item.parent === "default");
|
|
582
293
|
const currentUrl = new URL("");
|
|
583
294
|
const expandedClassName = expanded ? "expanded" : "closed";
|
|
584
|
-
return /* @__PURE__ */ (0,
|
|
585
|
-
shouldShowExpandButton && /* @__PURE__ */ (0,
|
|
586
|
-
/* @__PURE__ */ (0,
|
|
587
|
-
/* @__PURE__ */ (0,
|
|
588
|
-
/* @__PURE__ */ (0,
|
|
589
|
-
expanded && /* @__PURE__ */ (0,
|
|
295
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "sidebar-outer-wrapper", ref, children: [
|
|
296
|
+
shouldShowExpandButton && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { onMouseEnter: () => setShouldShowExpandButton(true), onMouseLeave: () => setShouldShowExpandButton(false), className: "sidebar-expand-button-container", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { onClick: toggleSidebar, children: expanded ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_wix_ui_icons_common2.ChevronLeft, {}) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_wix_ui_icons_common2.ChevronRight, {}) }) }),
|
|
297
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { ref: sidebarRef, className: `sidebar-container ${expanded ? "expanded" : "closed"}`, children: isOpen && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
298
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { onMouseEnter: () => setShouldShowExpandButton(true), onMouseLeave: () => setShouldShowExpandButton(false), children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_design_system3.Box, { className: "sidebar-header-box", direction: "horizontal", gap: "13px", WebkitAlignItems: "center", children: [
|
|
299
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("img", { width: "37px", height: "37px", src: currentUrl.origin + "/logo.png", alt: "My Tickets Logo", className: "sidebar-logo" }),
|
|
300
|
+
expanded && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_design_system3.Text, { className: "header-title", children: "My Tickets" })
|
|
590
301
|
] }) }),
|
|
591
|
-
/* @__PURE__ */ (0,
|
|
302
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_design_system3.Box, { className: `sidebar-items-container ${expandedClassName}`, direction: "vertical", children: rootItems.map((item) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
592
303
|
sidebar_menu_item_default,
|
|
593
304
|
{
|
|
594
305
|
item,
|
|
@@ -606,9 +317,9 @@ var Sidebar = (0, import_react5.forwardRef)(
|
|
|
606
317
|
},
|
|
607
318
|
item.stateId
|
|
608
319
|
)) }),
|
|
609
|
-
/* @__PURE__ */ (0,
|
|
610
|
-
expanded && /* @__PURE__ */ (0,
|
|
611
|
-
!expanded && /* @__PURE__ */ (0,
|
|
320
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_design_system3.Box, { direction: "horizontal", className: `sidebar-footer ${expandedClassName}`, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_design_system3.Box, { marginTop: "2px", maxWidth: "100%", minWidth: 0, children: [
|
|
321
|
+
expanded && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(avatar_dropdown_wrapper_default, { status, onStatusChange, onLogout, permissions, agentProfilePictureUrl, agentName, agentRole }),
|
|
322
|
+
!expanded && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_design_system3.Avatar, { name: agentName && !agentProfilePictureUrl ? agentName : void 0, size: "size30", imgProps: !agentName && agentProfilePictureUrl || agentName && agentProfilePictureUrl ? { src: agentProfilePictureUrl } : void 0 })
|
|
612
323
|
] }) })
|
|
613
324
|
] }) })
|
|
614
325
|
] });
|