@jrapps/my_tickets_dashboard_ui 0.0.7 → 0.0.8
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/ManageTicketModal/index.js +314 -0
- package/dist/cjs/components/ManageTicketModal/index.js.map +7 -0
- package/dist/cjs/components/Sidebar/index.js +1 -2
- package/dist/cjs/components/Sidebar/index.js.map +1 -1
- package/dist/cjs/index.js +356 -68
- package/dist/cjs/index.js.map +4 -4
- package/dist/esm/chunks/chunk-YIO4EY76.js +288 -0
- package/dist/esm/chunks/chunk-YIO4EY76.js.map +7 -0
- package/dist/esm/components/ManageTicketModal/index.js +7 -0
- package/dist/esm/components/ManageTicketModal/index.js.map +7 -0
- package/dist/esm/index.js +4 -0
- package/dist/types/components/ManageTicketModal/ManageTicketModal.d.ts +6 -0
- package/dist/types/components/ManageTicketModal/ManageTicketModal.d.ts.map +1 -0
- package/dist/types/components/ManageTicketModal/ManageTicketModal.types.d.ts +37 -0
- package/dist/types/components/ManageTicketModal/ManageTicketModal.types.d.ts.map +1 -0
- package/dist/types/components/ManageTicketModal/index.d.ts +3 -0
- package/dist/types/components/ManageTicketModal/index.d.ts.map +1 -0
- package/dist/types/components/ManageTicketModal/priority-change-content.d.ts +5 -0
- package/dist/types/components/ManageTicketModal/priority-change-content.d.ts.map +1 -0
- package/dist/types/components/ManageTicketModal/status-change-content.d.ts +5 -0
- package/dist/types/components/ManageTicketModal/status-change-content.d.ts.map +1 -0
- package/dist/types/components/ManageTicketModal/transfer-ticket-content.d.ts +5 -0
- package/dist/types/components/ManageTicketModal/transfer-ticket-content.d.ts.map +1 -0
- package/dist/types/components/ManageTicketModal/useManageTicketModal.d.ts +30 -0
- package/dist/types/components/ManageTicketModal/useManageTicketModal.d.ts.map +1 -0
- package/dist/types/components/index.d.ts +1 -0
- package/dist/types/components/index.d.ts.map +1 -1
- package/package.json +3 -2
package/dist/cjs/index.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
5
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
8
|
var __export = (target, all) => {
|
|
7
9
|
for (var name in all)
|
|
@@ -15,25 +17,312 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
17
|
}
|
|
16
18
|
return to;
|
|
17
19
|
};
|
|
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
|
+
));
|
|
18
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
29
|
|
|
20
30
|
// src/index.ts
|
|
21
31
|
var src_exports = {};
|
|
22
32
|
__export(src_exports, {
|
|
33
|
+
ManageTicketModal: () => ManageTicketModal,
|
|
23
34
|
Sidebar: () => Sidebar
|
|
24
35
|
});
|
|
25
36
|
module.exports = __toCommonJS(src_exports);
|
|
26
37
|
|
|
27
|
-
// src/components/
|
|
28
|
-
var
|
|
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
|
|
29
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
|
+
// src/components/Sidebar/Sidebar.tsx
|
|
317
|
+
var import_react5 = require("react");
|
|
318
|
+
var import_design_system7 = require("@wix/design-system");
|
|
30
319
|
var import_wix_ui_icons_common2 = require("@wix/wix-ui-icons-common");
|
|
31
320
|
|
|
32
321
|
// src/components/Sidebar/sidebar-menu-item.tsx
|
|
33
|
-
var
|
|
34
|
-
var
|
|
322
|
+
var import_react3 = require("react");
|
|
323
|
+
var import_design_system5 = require("@wix/design-system");
|
|
35
324
|
var import_dashboard = require("@wix/dashboard");
|
|
36
|
-
var
|
|
325
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
37
326
|
var SidebarMenuItem = ({
|
|
38
327
|
item,
|
|
39
328
|
items,
|
|
@@ -48,11 +337,11 @@ var SidebarMenuItem = ({
|
|
|
48
337
|
onModalClosed,
|
|
49
338
|
onCreateTicketClicked
|
|
50
339
|
}) => {
|
|
51
|
-
const [itemTotalCount, setItemTotalCount] = (0,
|
|
340
|
+
const [itemTotalCount, setItemTotalCount] = (0, import_react3.useState)(totalCount);
|
|
52
341
|
const hasChildren = items.some((i) => i.parent === item.stateId);
|
|
53
342
|
const isExpanded = expandedSections.has(item.stateId);
|
|
54
343
|
const isSelected = selectedId === item.stateId;
|
|
55
|
-
(0,
|
|
344
|
+
(0, import_react3.useEffect)(() => {
|
|
56
345
|
setItemTotalCount(totalCount);
|
|
57
346
|
}, [totalCount]);
|
|
58
347
|
const handleAction = async (actionItem) => {
|
|
@@ -74,34 +363,34 @@ var SidebarMenuItem = ({
|
|
|
74
363
|
};
|
|
75
364
|
if (hasChildren) {
|
|
76
365
|
const children = items.filter((i) => i.parent === item.stateId);
|
|
77
|
-
return /* @__PURE__ */ (0,
|
|
78
|
-
/* @__PURE__ */ (0,
|
|
366
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "sidebar-section", children: [
|
|
367
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
79
368
|
"div",
|
|
80
369
|
{
|
|
81
370
|
className: `sidebar-item sidebar-parent-item ${isSelected ? "sidebar-item-selected" : ""}`,
|
|
82
371
|
onClick: () => onToggleSection(item.stateId),
|
|
83
372
|
children: [
|
|
84
|
-
/* @__PURE__ */ (0,
|
|
85
|
-
expanded && /* @__PURE__ */ (0,
|
|
86
|
-
/* @__PURE__ */ (0,
|
|
87
|
-
/* @__PURE__ */ (0,
|
|
88
|
-
item.subtitle && /* @__PURE__ */ (0,
|
|
373
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_design_system5.Box, { className: "sidebar-item-icon", children: item.prefixIcon }),
|
|
374
|
+
expanded && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
|
|
375
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_design_system5.Box, { className: "sidebar-item-content", direction: "vertical", children: [
|
|
376
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_design_system5.Text, { size: "small", className: "sidebar-item-title", children: item.label }),
|
|
377
|
+
item.subtitle && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_design_system5.Text, { size: "small", className: "sidebar-item-subtitle", children: item.subtitle })
|
|
89
378
|
] }),
|
|
90
|
-
/* @__PURE__ */ (0,
|
|
379
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_design_system5.Box, { className: `sidebar-item-chevron ${isExpanded ? "expanded" : ""}`, children: "\u25BC" })
|
|
91
380
|
] })
|
|
92
381
|
]
|
|
93
382
|
}
|
|
94
383
|
),
|
|
95
|
-
isExpanded && /* @__PURE__ */ (0,
|
|
384
|
+
isExpanded && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_design_system5.Box, { className: "sidebar-submenu-container", direction: "vertical", children: children.map((child) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
96
385
|
"div",
|
|
97
386
|
{
|
|
98
387
|
className: `sidebar-item sidebar-child-item ${expandedClassName} ${selectedId === child.stateId ? "sidebar-item-selected" : ""}`,
|
|
99
388
|
onClick: () => handleAction(child),
|
|
100
389
|
children: [
|
|
101
|
-
/* @__PURE__ */ (0,
|
|
102
|
-
expanded && /* @__PURE__ */ (0,
|
|
103
|
-
/* @__PURE__ */ (0,
|
|
104
|
-
child.subtitle && /* @__PURE__ */ (0,
|
|
390
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_design_system5.Box, { className: "sidebar-item-icon", children: child.prefixIcon }),
|
|
391
|
+
expanded && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_jsx_runtime5.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_design_system5.Box, { className: "sidebar-item-content", direction: "vertical", children: [
|
|
392
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_design_system5.Text, { size: "small", className: "sidebar-item-title-submenu", children: child.label }),
|
|
393
|
+
child.subtitle && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_design_system5.Text, { size: "small", className: "sidebar-item-subtitle", children: child.subtitle })
|
|
105
394
|
] }) })
|
|
106
395
|
]
|
|
107
396
|
},
|
|
@@ -109,19 +398,19 @@ var SidebarMenuItem = ({
|
|
|
109
398
|
)) })
|
|
110
399
|
] }, item.stateId);
|
|
111
400
|
}
|
|
112
|
-
return /* @__PURE__ */ (0,
|
|
401
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
113
402
|
"div",
|
|
114
403
|
{
|
|
115
404
|
className: `sidebar-item ${expandedClassName} ${isSelected ? "sidebar-item-selected" : ""}`,
|
|
116
405
|
onClick: () => handleAction(item),
|
|
117
406
|
children: [
|
|
118
|
-
/* @__PURE__ */ (0,
|
|
119
|
-
expanded && /* @__PURE__ */ (0,
|
|
120
|
-
/* @__PURE__ */ (0,
|
|
121
|
-
/* @__PURE__ */ (0,
|
|
122
|
-
item.subtitle && /* @__PURE__ */ (0,
|
|
407
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_design_system5.Box, { className: "sidebar-item-icon", children: item.prefixIcon }),
|
|
408
|
+
expanded && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_jsx_runtime5.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_design_system5.Box, { className: "sidebar-item-content", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_design_system5.Box, { verticalAlign: "middle", gap: 2, children: [
|
|
409
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_design_system5.Box, { direction: "vertical", children: [
|
|
410
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_design_system5.Text, { size: "small", className: "sidebar-item-title", children: item.label }),
|
|
411
|
+
item.subtitle && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_design_system5.Text, { size: "small", className: "sidebar-item-subtitle", children: item.subtitle })
|
|
123
412
|
] }),
|
|
124
|
-
item?.showTotalCount && item?.showTotalCount === true && /* @__PURE__ */ (0,
|
|
413
|
+
item?.showTotalCount && item?.showTotalCount === true && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_design_system5.CounterBadge, { size: "medium", skin: "warning", children: String(itemTotalCount) })
|
|
125
414
|
] }) }) })
|
|
126
415
|
]
|
|
127
416
|
},
|
|
@@ -131,22 +420,22 @@ var SidebarMenuItem = ({
|
|
|
131
420
|
var sidebar_menu_item_default = SidebarMenuItem;
|
|
132
421
|
|
|
133
422
|
// src/components/Sidebar/footer/avatar-dropdown.wrapper.tsx
|
|
134
|
-
var
|
|
135
|
-
var
|
|
423
|
+
var import_react4 = require("react");
|
|
424
|
+
var import_design_system6 = require("@wix/design-system");
|
|
136
425
|
|
|
137
426
|
// src/components/Sidebar/footer/status-dots.wrapper.tsx
|
|
138
|
-
var
|
|
427
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
139
428
|
var Online = () => {
|
|
140
|
-
return /* @__PURE__ */ (0,
|
|
429
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { style: { width: "8px", height: "8px", borderRadius: "50%", background: "#22c55e", boxShadow: "0 0 0 2px #fff" } });
|
|
141
430
|
};
|
|
142
431
|
var Away = () => {
|
|
143
|
-
return /* @__PURE__ */ (0,
|
|
432
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { style: { width: "8px", height: "8px", borderRadius: "50%", background: "#f59e0b", boxShadow: "0 0 0 2px #fff" } });
|
|
144
433
|
};
|
|
145
434
|
var DoNotDisturb = () => {
|
|
146
|
-
return /* @__PURE__ */ (0,
|
|
435
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { style: { position: "relative", width: "8px", height: "8px", borderRadius: "50%", background: "#ef4444", boxShadow: "0 0 0 2px #fff" }, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { style: { position: "absolute", top: "50%", left: "10%", right: "10%", height: "2px", background: "#fff", transform: "translateY(-50%)", borderRadius: "1px" } }) });
|
|
147
436
|
};
|
|
148
437
|
var Offline = () => {
|
|
149
|
-
return /* @__PURE__ */ (0,
|
|
438
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { style: { width: "8px", height: "8px", borderRadius: "50%", border: "2px solid #71717a", boxShadow: "0 0 0 2px #fff" } });
|
|
150
439
|
};
|
|
151
440
|
var StatusDots = {
|
|
152
441
|
Online,
|
|
@@ -158,9 +447,9 @@ var status_dots_wrapper_default = StatusDots;
|
|
|
158
447
|
|
|
159
448
|
// src/components/Sidebar/footer/avatar-dropdown.wrapper.tsx
|
|
160
449
|
var import_wix_ui_icons_common = require("@wix/wix-ui-icons-common");
|
|
161
|
-
var
|
|
450
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
162
451
|
var AvatarDropdown = ({ status = "online", onStatusChange, onLogout, permissions, agentProfilePictureUrl, agentName, agentRole }) => {
|
|
163
|
-
const [selectedStatus, setSelectedStatus] = (0,
|
|
452
|
+
const [selectedStatus, setSelectedStatus] = (0, import_react4.useState)(status);
|
|
164
453
|
const handleStatusChange = (newStatus) => {
|
|
165
454
|
setSelectedStatus(newStatus);
|
|
166
455
|
if (onStatusChange) {
|
|
@@ -173,45 +462,45 @@ var AvatarDropdown = ({ status = "online", onStatusChange, onLogout, permissions
|
|
|
173
462
|
}
|
|
174
463
|
};
|
|
175
464
|
const options = [
|
|
176
|
-
(0,
|
|
465
|
+
(0, import_design_system6.listItemSectionBuilder)({
|
|
177
466
|
id: "status-section",
|
|
178
467
|
title: "Online Status"
|
|
179
468
|
}),
|
|
180
|
-
(0,
|
|
469
|
+
(0, import_design_system6.listItemSelectBuilder)({
|
|
181
470
|
id: "online",
|
|
182
471
|
checkbox: true,
|
|
183
|
-
prefix: /* @__PURE__ */ (0,
|
|
472
|
+
prefix: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(status_dots_wrapper_default.Online, {}),
|
|
184
473
|
title: "Online",
|
|
185
474
|
disabled: permissions?.["my-tickets-change-agent-online-status"] === true ? false : true
|
|
186
475
|
}),
|
|
187
|
-
(0,
|
|
476
|
+
(0, import_design_system6.listItemSelectBuilder)({
|
|
188
477
|
id: "busy",
|
|
189
478
|
checkbox: true,
|
|
190
|
-
prefix: /* @__PURE__ */ (0,
|
|
479
|
+
prefix: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(status_dots_wrapper_default.Away, {}),
|
|
191
480
|
title: "Away",
|
|
192
481
|
disabled: permissions?.["my-tickets-change-agent-online-status"] === true ? false : true
|
|
193
482
|
}),
|
|
194
|
-
(0,
|
|
483
|
+
(0, import_design_system6.listItemSelectBuilder)({
|
|
195
484
|
id: "offline",
|
|
196
485
|
checkbox: true,
|
|
197
|
-
prefix: /* @__PURE__ */ (0,
|
|
486
|
+
prefix: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(status_dots_wrapper_default.DoNotDisturb, {}),
|
|
198
487
|
title: "Offline",
|
|
199
488
|
disabled: permissions?.["my-tickets-change-agent-online-status"] === true ? false : true
|
|
200
489
|
}),
|
|
201
490
|
{ id: "divider-1", value: "-" },
|
|
202
|
-
(0,
|
|
491
|
+
(0, import_design_system6.listItemActionBuilder)({
|
|
203
492
|
id: 0,
|
|
204
493
|
title: "Logout",
|
|
205
494
|
onClick: handleLogout
|
|
206
495
|
})
|
|
207
496
|
];
|
|
208
|
-
return /* @__PURE__ */ (0,
|
|
209
|
-
/* @__PURE__ */ (0,
|
|
210
|
-
/* @__PURE__ */ (0,
|
|
211
|
-
/* @__PURE__ */ (0,
|
|
212
|
-
/* @__PURE__ */ (0,
|
|
497
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_design_system6.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_runtime7.jsx)(import_design_system6.TextButton, { className: "header-account-button", onClick: toggle, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_design_system6.Box, { verticalAlign: "middle", gap: 2, textAlign: "start", maxWidth: "100%", minWidth: 0, children: [
|
|
498
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_design_system6.Avatar, { presence: selectedStatus, name: agentName && !agentProfilePictureUrl ? agentName : void 0, size: "size30", imgProps: !agentName && agentProfilePictureUrl || agentName && agentProfilePictureUrl ? { src: agentProfilePictureUrl } : void 0 }),
|
|
499
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_design_system6.Box, { direction: "vertical", gap: 0, verticalAlign: "middle", maxWidth: "100%", minWidth: 0, children: [
|
|
500
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_design_system6.Text, { weight: "bold", size: "small", ellipsis: true, maxWidth: "100%", children: agentName ? agentName : "Error getting name" }),
|
|
501
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_design_system6.Text, { size: "tiny", secondary: true, ellipsis: true, maxWidth: "100%", children: agentRole ? agentRole : "Error getting role" })
|
|
213
502
|
] }),
|
|
214
|
-
/* @__PURE__ */ (0,
|
|
503
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_wix_ui_icons_common.ChevronDown, {})
|
|
215
504
|
] }) }) });
|
|
216
505
|
};
|
|
217
506
|
var avatar_dropdown_wrapper_default = AvatarDropdown;
|
|
@@ -225,9 +514,8 @@ if (typeof document !== "undefined" && !document.getElementById("jrapps-style-ee
|
|
|
225
514
|
}
|
|
226
515
|
|
|
227
516
|
// src/components/Sidebar/Sidebar.tsx
|
|
228
|
-
var
|
|
229
|
-
var
|
|
230
|
-
var Sidebar = (0, import_react3.forwardRef)(
|
|
517
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
518
|
+
var Sidebar = (0, import_react5.forwardRef)(
|
|
231
519
|
({
|
|
232
520
|
className,
|
|
233
521
|
children,
|
|
@@ -246,10 +534,10 @@ var Sidebar = (0, import_react3.forwardRef)(
|
|
|
246
534
|
onLogout,
|
|
247
535
|
permissions
|
|
248
536
|
}, ref) => {
|
|
249
|
-
const [expandedSections, setExpandedSections] = (0,
|
|
250
|
-
const [expanded, setExpanded] = (0,
|
|
251
|
-
const [shouldShowExpandButton, setShouldShowExpandButton] = (0,
|
|
252
|
-
const sidebarRef = (0,
|
|
537
|
+
const [expandedSections, setExpandedSections] = (0, import_react5.useState)(/* @__PURE__ */ new Set());
|
|
538
|
+
const [expanded, setExpanded] = (0, import_react5.useState)(true);
|
|
539
|
+
const [shouldShowExpandButton, setShouldShowExpandButton] = (0, import_react5.useState)(false);
|
|
540
|
+
const sidebarRef = (0, import_react5.useRef)(null);
|
|
253
541
|
const SIDEBAR_EXPANDED_WIDTH = "210px";
|
|
254
542
|
const toggleSection = (sectionId) => {
|
|
255
543
|
const newExpanded = new Set(expandedSections);
|
|
@@ -291,16 +579,16 @@ var Sidebar = (0, import_react3.forwardRef)(
|
|
|
291
579
|
}
|
|
292
580
|
};
|
|
293
581
|
const rootItems = items.filter((item) => !item.parent || item.parent === "default");
|
|
294
|
-
const currentUrl = new URL(
|
|
582
|
+
const currentUrl = new URL("");
|
|
295
583
|
const expandedClassName = expanded ? "expanded" : "closed";
|
|
296
|
-
return /* @__PURE__ */ (0,
|
|
297
|
-
shouldShowExpandButton && /* @__PURE__ */ (0,
|
|
298
|
-
/* @__PURE__ */ (0,
|
|
299
|
-
/* @__PURE__ */ (0,
|
|
300
|
-
/* @__PURE__ */ (0,
|
|
301
|
-
expanded && /* @__PURE__ */ (0,
|
|
584
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "sidebar-outer-wrapper", ref, children: [
|
|
585
|
+
shouldShowExpandButton && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { onMouseEnter: () => setShouldShowExpandButton(true), onMouseLeave: () => setShouldShowExpandButton(false), className: "sidebar-expand-button-container", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { onClick: toggleSidebar, children: expanded ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_wix_ui_icons_common2.ChevronLeft, {}) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_wix_ui_icons_common2.ChevronRight, {}) }) }),
|
|
586
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { ref: sidebarRef, className: `sidebar-container ${expanded ? "expanded" : "closed"}`, children: isOpen && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
|
|
587
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { onMouseEnter: () => setShouldShowExpandButton(true), onMouseLeave: () => setShouldShowExpandButton(false), children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_design_system7.Box, { className: "sidebar-header-box", direction: "horizontal", gap: "13px", WebkitAlignItems: "center", children: [
|
|
588
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("img", { width: "37px", height: "37px", src: currentUrl.origin + "/logo.png", alt: "My Tickets Logo", className: "sidebar-logo" }),
|
|
589
|
+
expanded && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_design_system7.Text, { className: "header-title", children: "My Tickets" })
|
|
302
590
|
] }) }),
|
|
303
|
-
/* @__PURE__ */ (0,
|
|
591
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_design_system7.Box, { className: `sidebar-items-container ${expandedClassName}`, direction: "vertical", children: rootItems.map((item) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
304
592
|
sidebar_menu_item_default,
|
|
305
593
|
{
|
|
306
594
|
item,
|
|
@@ -318,9 +606,9 @@ var Sidebar = (0, import_react3.forwardRef)(
|
|
|
318
606
|
},
|
|
319
607
|
item.stateId
|
|
320
608
|
)) }),
|
|
321
|
-
/* @__PURE__ */ (0,
|
|
322
|
-
expanded && /* @__PURE__ */ (0,
|
|
323
|
-
!expanded && /* @__PURE__ */ (0,
|
|
609
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_design_system7.Box, { direction: "horizontal", className: `sidebar-footer ${expandedClassName}`, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_design_system7.Box, { marginTop: "2px", maxWidth: "100%", minWidth: 0, children: [
|
|
610
|
+
expanded && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(avatar_dropdown_wrapper_default, { status, onStatusChange, onLogout, permissions, agentProfilePictureUrl, agentName, agentRole }),
|
|
611
|
+
!expanded && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_design_system7.Avatar, { name: agentName && !agentProfilePictureUrl ? agentName : void 0, size: "size30", imgProps: !agentName && agentProfilePictureUrl || agentName && agentProfilePictureUrl ? { src: agentProfilePictureUrl } : void 0 })
|
|
324
612
|
] }) })
|
|
325
613
|
] }) })
|
|
326
614
|
] });
|