@ynput/ayon-frontend-shared 0.3.28 → 0.3.29
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/_virtual/index.cjs14.js +1 -1
- package/dist/_virtual/index.cjs15.js +1 -1
- package/dist/_virtual/index.cjs19.js +1 -1
- package/dist/_virtual/index.cjs4.js +1 -1
- package/dist/_virtual/index.cjs5.js +1 -1
- package/dist/_virtual/index.cjs6.js +1 -1
- package/dist/_virtual/index.cjs8.js +1 -1
- package/dist/_virtual/index.cjs9.js +1 -1
- package/dist/_virtual/index.es10.js +2 -2
- package/dist/_virtual/index.es11.js +2 -2
- package/dist/_virtual/index.es13.js +2 -2
- package/dist/_virtual/index.es14.js +2 -5
- package/dist/_virtual/index.es14.js.map +1 -1
- package/dist/_virtual/index.es15.js +2 -2
- package/dist/_virtual/index.es16.js +2 -2
- package/dist/_virtual/index.es17.js +2 -2
- package/dist/_virtual/index.es18.js +2 -2
- package/dist/_virtual/index.es19.js +2 -2
- package/dist/_virtual/index.es4.js +5 -2
- package/dist/_virtual/index.es4.js.map +1 -1
- package/dist/_virtual/index.es5.js +2 -5
- package/dist/_virtual/index.es5.js.map +1 -1
- package/dist/_virtual/index.es6.js +2 -2
- package/dist/_virtual/index.es8.js +2 -2
- package/dist/_virtual/index.es9.js +5 -2
- package/dist/_virtual/index.es9.js.map +1 -1
- package/dist/components.cjs.js +1 -1
- package/dist/components.es.js +34 -33
- package/dist/node_modules/match-sorter/dist/match-sorter.esm.cjs.js +1 -1
- package/dist/node_modules/match-sorter/dist/match-sorter.esm.es.js +1 -1
- package/dist/node_modules/remove-accents/index.cjs.js +1 -1
- package/dist/node_modules/remove-accents/index.es.js +1 -1
- package/dist/shared/node_modules/@module-federation/error-codes/dist/index.cjs.js +1 -1
- package/dist/shared/node_modules/@module-federation/error-codes/dist/index.es.js +1 -1
- package/dist/shared/node_modules/@module-federation/runtime/dist/index.cjs.js +1 -1
- package/dist/shared/node_modules/@module-federation/runtime/dist/index.es.js +1 -1
- package/dist/shared/node_modules/@module-federation/runtime-core/dist/index.cjs.js +1 -1
- package/dist/shared/node_modules/@module-federation/runtime-core/dist/index.es.js +1 -1
- package/dist/shared/node_modules/@module-federation/runtime-core/dist/module/index.cjs.js +1 -1
- package/dist/shared/node_modules/@module-federation/runtime-core/dist/module/index.es.js +1 -1
- package/dist/shared/node_modules/@module-federation/runtime-core/dist/plugins/snapshot/index.cjs.js +1 -1
- package/dist/shared/node_modules/@module-federation/runtime-core/dist/plugins/snapshot/index.es.js +1 -1
- package/dist/shared/node_modules/@module-federation/runtime-core/dist/remote/index.cjs.js +1 -1
- package/dist/shared/node_modules/@module-federation/runtime-core/dist/remote/index.es.js +1 -1
- package/dist/shared/node_modules/@module-federation/runtime-core/dist/shared/index.cjs.js +1 -1
- package/dist/shared/node_modules/@module-federation/runtime-core/dist/shared/index.es.js +1 -1
- package/dist/shared/node_modules/@module-federation/runtime-core/dist/type/index.cjs.js +1 -1
- package/dist/shared/node_modules/@module-federation/runtime-core/dist/type/index.es.js +1 -1
- package/dist/shared/node_modules/@module-federation/runtime-core/dist/utils/hooks/index.cjs.js +1 -1
- package/dist/shared/node_modules/@module-federation/runtime-core/dist/utils/hooks/index.es.js +1 -1
- package/dist/shared/node_modules/@module-federation/runtime-core/dist/utils/index.cjs.js +1 -1
- package/dist/shared/node_modules/@module-federation/runtime-core/dist/utils/index.es.js +1 -1
- package/dist/shared/node_modules/@module-federation/runtime-core/dist/utils/semver/index.cjs.js +1 -1
- package/dist/shared/node_modules/@module-federation/runtime-core/dist/utils/semver/index.cjs.js.map +1 -1
- package/dist/shared/node_modules/@module-federation/runtime-core/dist/utils/semver/index.es.js +1 -1
- package/dist/shared/node_modules/@module-federation/runtime-core/dist/utils/semver/utils.cjs.js +1 -1
- package/dist/shared/node_modules/@module-federation/runtime-core/dist/utils/semver/utils.es.js +1 -1
- package/dist/shared/node_modules/@module-federation/sdk/dist/index.cjs.js +1 -1
- package/dist/shared/node_modules/@module-federation/sdk/dist/index.es.js +1 -1
- package/dist/shared/node_modules/@module-federation/sdk/dist/utils.cjs.js +1 -1
- package/dist/shared/node_modules/@module-federation/sdk/dist/utils.es.js +1 -1
- package/dist/shared/node_modules/prop-types/index.cjs.js +1 -1
- package/dist/shared/node_modules/prop-types/index.es.js +1 -1
- package/dist/shared/node_modules/react-transition-group/esm/CSSTransition.cjs.js +1 -1
- package/dist/shared/node_modules/react-transition-group/esm/CSSTransition.cjs.js.map +1 -1
- package/dist/shared/node_modules/react-transition-group/esm/CSSTransition.es.js +1 -1
- package/dist/shared/node_modules/react-transition-group/esm/Transition.cjs.js +1 -1
- package/dist/shared/node_modules/react-transition-group/esm/Transition.cjs.js.map +1 -1
- package/dist/shared/node_modules/react-transition-group/esm/Transition.es.js +1 -1
- package/dist/shared/node_modules/react-transition-group/esm/utils/PropTypes.cjs.js +1 -1
- package/dist/shared/node_modules/react-transition-group/esm/utils/PropTypes.cjs.js.map +1 -1
- package/dist/shared/node_modules/react-transition-group/esm/utils/PropTypes.es.js +1 -1
- package/dist/shared/src/components/EntityPanelUploader/EntityPanelUploader.cjs.js +1 -1
- package/dist/shared/src/components/EntityPanelUploader/EntityPanelUploader.cjs.js.map +1 -1
- package/dist/shared/src/components/EntityPanelUploader/EntityPanelUploader.es.js +155 -133
- package/dist/shared/src/components/EntityPanelUploader/EntityPanelUploader.es.js.map +1 -1
- package/dist/shared/src/components/Powerpack/PricingLink.cjs.js +1 -1
- package/dist/shared/src/components/Powerpack/PricingLink.cjs.js.map +1 -1
- package/dist/shared/src/components/Powerpack/PricingLink.es.js +5 -5
- package/dist/shared/src/components/Powerpack/PricingLink.es.js.map +1 -1
- package/dist/shared/src/components/ReviewablesSelector/ReviewablesSelector.cjs.js +1 -1
- package/dist/shared/src/components/ReviewablesSelector/ReviewablesSelector.cjs.js.map +1 -1
- package/dist/shared/src/components/ReviewablesSelector/ReviewablesSelector.es.js +29 -29
- package/dist/shared/src/components/ReviewablesSelector/ReviewablesSelector.es.js.map +1 -1
- package/dist/shared/src/components/VersionUploader/context/VersionUploadContext.cjs.js +1 -1
- package/dist/shared/src/components/VersionUploader/context/VersionUploadContext.cjs.js.map +1 -1
- package/dist/shared/src/components/VersionUploader/context/VersionUploadContext.es.js +100 -99
- package/dist/shared/src/components/VersionUploader/context/VersionUploadContext.es.js.map +1 -1
- package/dist/shared/src/containers/EntityPickerDialog/components/EntityTypeTable.cjs.js +1 -1
- package/dist/shared/src/containers/EntityPickerDialog/components/EntityTypeTable.cjs.js.map +1 -1
- package/dist/shared/src/containers/EntityPickerDialog/components/EntityTypeTable.es.js +23 -23
- package/dist/shared/src/containers/EntityPickerDialog/components/EntityTypeTable.es.js.map +1 -1
- package/dist/shared/src/containers/Feed/Feed.cjs.js +1 -1
- package/dist/shared/src/containers/Feed/Feed.cjs.js.map +1 -1
- package/dist/shared/src/containers/Feed/Feed.es.js +1 -1
- package/dist/shared/src/containers/Feed/Feed.es.js.map +1 -1
- package/dist/types/components/Powerpack/PricingLink.d.ts +1 -1
- package/dist/types/components/VersionUploader/context/VersionUploadContext.d.ts +1 -0
- package/package.json +2 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { j as
|
|
2
|
-
import { useState as
|
|
3
|
-
import
|
|
1
|
+
import { j as p } from "../../../../_virtual/jsx-runtime.es.js";
|
|
2
|
+
import { useState as u, useRef as T } from "react";
|
|
3
|
+
import ar from "clsx";
|
|
4
4
|
import "../../containers/ContextMenu/ContextMenuContext.es.js";
|
|
5
5
|
import "@ynput/ayon-react-components";
|
|
6
6
|
/* empty css */
|
|
@@ -64,7 +64,7 @@ import "../../api/queries/config/getConfig.es.js";
|
|
|
64
64
|
import "../../api/queries/config/updateConfig.es.js";
|
|
65
65
|
import "../../api/queries/entities/getEntity.es.js";
|
|
66
66
|
import "../../api/queries/entities/getEntityPanel.es.js";
|
|
67
|
-
import { useUpdateEntitiesMutation as
|
|
67
|
+
import { useUpdateEntitiesMutation as sr } from "../../api/queries/entities/updateEntity.es.js";
|
|
68
68
|
import "../../api/queries/entityLists/getLists.es.js";
|
|
69
69
|
import "../../api/queries/entityLists/updateLists.es.js";
|
|
70
70
|
import "../../api/queries/entityLists/getListsAttributes.es.js";
|
|
@@ -80,7 +80,7 @@ import "../../api/queries/overview/getOverview.es.js";
|
|
|
80
80
|
import "../../api/queries/overview/updateOverview.es.js";
|
|
81
81
|
import "../../api/queries/versions/getVersionsProducts.es.js";
|
|
82
82
|
import "../../api/queries/permissions/getPermissions.es.js";
|
|
83
|
-
import { useCreateProductMutation as
|
|
83
|
+
import { useCreateProductMutation as lr } from "../../api/queries/products/createProduct.es.js";
|
|
84
84
|
import "../../api/queries/products/getFolderProducts.es.js";
|
|
85
85
|
import "../../api/queries/project/getProject.es.js";
|
|
86
86
|
import "../../api/queries/project/updateProject.es.js";
|
|
@@ -96,7 +96,7 @@ import "../../api/queries/userDashboard/getUserDashboard.es.js";
|
|
|
96
96
|
import "../../api/queries/users/getUsers.es.js";
|
|
97
97
|
import "../../api/queries/users/updateUsers.es.js";
|
|
98
98
|
import "../../api/queries/users/guests.es.js";
|
|
99
|
-
import { useCreateVersionMutation as
|
|
99
|
+
import { useCreateVersionMutation as dr } from "../../api/queries/versions/updateVersions.es.js";
|
|
100
100
|
import "../../api/queries/views/getViews.es.js";
|
|
101
101
|
import "../../api/queries/views/updateViews.es.js";
|
|
102
102
|
import "../../api/queries/watchers/getWatchers.es.js";
|
|
@@ -104,9 +104,9 @@ import "../../api/queries/uris/getUris.es.js";
|
|
|
104
104
|
import "../../containers/Feed/components/Tooltips/TeamTooltip/TeamTooltip.styled.es.js";
|
|
105
105
|
import "../../containers/Feed/components/Tooltips/EntityTooltip/EntityTooltip.styled.es.js";
|
|
106
106
|
import "../../context/RemoteModulesContext.es.js";
|
|
107
|
-
import { useDetailsPanelContext as
|
|
107
|
+
import { useDetailsPanelContext as cr } from "../../context/DetailsPanelContext.es.js";
|
|
108
108
|
import "../../context/SubtasksModulesContext.es.js";
|
|
109
|
-
import { ThumbnailUploadProvider as
|
|
109
|
+
import { ThumbnailUploadProvider as ur } from "../../context/ThumbnailUploaderContext.es.js";
|
|
110
110
|
import "../../context/SettingsPanelContext.es.js";
|
|
111
111
|
import "../../context/pip/PiPProvider.es.js";
|
|
112
112
|
import "../../context/pip/PiPWrapper.es.js";
|
|
@@ -149,13 +149,13 @@ import "../Chips/Chips.es.js";
|
|
|
149
149
|
import "date-fns";
|
|
150
150
|
import "../DateRangePicker/DateRangePicker.styled.es.js";
|
|
151
151
|
import "../LinksManager/CellEditingDialog.es.js";
|
|
152
|
-
import { toast as
|
|
152
|
+
import { toast as V } from "react-toastify";
|
|
153
153
|
import "../../../../_virtual/index.es.js";
|
|
154
154
|
import "../../../../node_modules/refractor/lib/common.es.js";
|
|
155
155
|
import "../../../../node_modules/refractor/lib/all.es.js";
|
|
156
156
|
/* empty css */
|
|
157
157
|
import "uuid";
|
|
158
|
-
import { sanitizeProductName as
|
|
158
|
+
import { sanitizeProductName as fr, createProductHelper as hr, handleUploadError as M, getNextVersionNumber as gr, createVersionHelper as vr } from "../../util/versionUploadHelpers.es.js";
|
|
159
159
|
import "../../util/pubsub.es.js";
|
|
160
160
|
import "../DetailsPanelAttributes/DetailsPanelAttributesEditor.es.js";
|
|
161
161
|
import "../DetailsPanelDetails/DetailsPanelDetails.es.js";
|
|
@@ -165,8 +165,8 @@ import "../DoneCheckbox/DoneCheckbox.es.js";
|
|
|
165
165
|
import "../EarlyPreview/EarlyPreview.es.js";
|
|
166
166
|
import "../EmptyPlaceholder/EmptyPlaceholder.es.js";
|
|
167
167
|
import "../EmptyPlaceholder/EmptyPlaceholderFlex.styled.es.js";
|
|
168
|
-
import { DragAndDropWrapper as
|
|
169
|
-
import
|
|
168
|
+
import { DragAndDropWrapper as yr, DropZones as W, UploadingProgress as br, Progress as Dr, CancelButton as xr } from "./EntityPanelUploader.styled.es.js";
|
|
169
|
+
import Ur from "./Dropzone.es.js";
|
|
170
170
|
import wr from "axios";
|
|
171
171
|
import "../ReviewablesList/ReviewablesList.styled.es.js";
|
|
172
172
|
import "../ReviewablesList/ReviewablesUpload.styled.es.js";
|
|
@@ -206,7 +206,7 @@ import "../Thumbnail/Thumbnail.styled.es.js";
|
|
|
206
206
|
import "../Thumbnail/StackedThumbnails.es.js";
|
|
207
207
|
import "../ThumbnailSimple/ThumbnailSimple.es.js";
|
|
208
208
|
import "../VersionUploader/components/UploadVersionDialog.es.js";
|
|
209
|
-
import "../VersionUploader/context/VersionUploadContext.es.js";
|
|
209
|
+
import { useOptionalVersionUploadContext as Ir } from "../VersionUploader/context/VersionUploadContext.es.js";
|
|
210
210
|
import "../Watchers/Watchers.es.js";
|
|
211
211
|
import "../Menu/Menu.styled.es.js";
|
|
212
212
|
import "../Menu/MenuItem.es.js";
|
|
@@ -262,7 +262,7 @@ import "../../containers/ProjectTreeTable/components/HeaderActionButton.es.js";
|
|
|
262
262
|
import "../../containers/ProjectTreeTable/components/ColumnHeaderMenu.es.js";
|
|
263
263
|
import "../../containers/DetailsPanel/DetailsPanel.styled.es.js";
|
|
264
264
|
import "../../containers/DetailsPanel/components/DetailsPanelTabs/DetailsPanelTabs.styled.es.js";
|
|
265
|
-
import { ThumbnailWrapper as
|
|
265
|
+
import { ThumbnailWrapper as Tr } from "../../containers/DetailsPanel/components/DetailsPanelHeader/DetailsPanelHeader.styled.es.js";
|
|
266
266
|
import "../PlayableIcon/PlayableIcon.es.js";
|
|
267
267
|
import "../../containers/DetailsPanel/components/DetailsPanelFiles/DetailsPanelFiles.es.js";
|
|
268
268
|
import "../../containers/DetailsPanel/components/DetailsPanelSlideOut/DetailsPanelSlideOut.styled.es.js";
|
|
@@ -274,228 +274,250 @@ import "../../containers/Views/context/ViewsContext.es.js";
|
|
|
274
274
|
import "../../containers/Views/Views.styled.es.js";
|
|
275
275
|
import "../../containers/Views/ViewsMenuContainer/ViewsMenuContainer.es.js";
|
|
276
276
|
import "../../containers/Views/ViewsMenu/ViewsMenu.es.js";
|
|
277
|
-
const
|
|
277
|
+
const Vr = [
|
|
278
278
|
{ id: "thumbnail", label: "Upload thumbnail", icon: "add_photo_alternate" },
|
|
279
279
|
{ id: "version", label: "Upload version", icon: "layers" }
|
|
280
|
-
],
|
|
281
|
-
children:
|
|
282
|
-
entityType:
|
|
283
|
-
entities:
|
|
280
|
+
], Oe = ({
|
|
281
|
+
children: B = [],
|
|
282
|
+
entityType: k,
|
|
283
|
+
entities: s = [],
|
|
284
284
|
projectName: b,
|
|
285
|
-
onUploaded:
|
|
286
|
-
onVersionCreated:
|
|
285
|
+
onUploaded: E,
|
|
286
|
+
onVersionCreated: q
|
|
287
287
|
}) => {
|
|
288
|
-
const { dispatch:
|
|
288
|
+
const { dispatch: H } = cr(), D = Ir(), [C, f] = u(!1), [x, h] = u(null), c = T(0), [U, l] = u(null), [_, y] = u(0), [G, g] = u(!1), [w, v] = u(null), i = s.length === 1 ? s[0] : null, R = i?.task?.id, P = i?.folder?.id, J = i?.product?.id, K = i?.id, j = !!(i && k !== "representation"), { handleFileUpload: Q } = Pr({
|
|
289
289
|
projectName: b,
|
|
290
|
-
versionId:
|
|
291
|
-
taskId:
|
|
292
|
-
folderId:
|
|
293
|
-
productId:
|
|
294
|
-
dispatch:
|
|
290
|
+
versionId: K,
|
|
291
|
+
taskId: R,
|
|
292
|
+
folderId: P,
|
|
293
|
+
productId: J,
|
|
294
|
+
dispatch: H,
|
|
295
295
|
onUpload: () => {
|
|
296
|
-
|
|
296
|
+
l(null), y(0);
|
|
297
297
|
},
|
|
298
298
|
onProgress: (r) => {
|
|
299
|
-
|
|
299
|
+
y(r);
|
|
300
300
|
}
|
|
301
|
-
}),
|
|
302
|
-
|
|
303
|
-
},
|
|
304
|
-
if (!
|
|
305
|
-
|
|
301
|
+
}), X = Vr.filter((r) => r.id === "version" ? j : !0), n = () => {
|
|
302
|
+
l(null), f(!1), h(null), c.current = 0, y(0), g(!1), v(null);
|
|
303
|
+
}, Y = async (r) => {
|
|
304
|
+
if (!w || !i) {
|
|
305
|
+
g(!1), v(null);
|
|
306
306
|
return;
|
|
307
307
|
}
|
|
308
|
-
const t =
|
|
308
|
+
const t = fr(r);
|
|
309
309
|
if (!t.trim()) {
|
|
310
|
-
|
|
310
|
+
V.error(
|
|
311
311
|
"Product name must contain valid characters (letters, numbers, underscore, or hyphen)"
|
|
312
312
|
);
|
|
313
313
|
return;
|
|
314
314
|
}
|
|
315
315
|
try {
|
|
316
|
-
if (!
|
|
316
|
+
if (!P)
|
|
317
317
|
throw new Error("Folder ID is required to create a product");
|
|
318
|
-
|
|
319
|
-
const o = await
|
|
320
|
-
folderId:
|
|
318
|
+
l("version");
|
|
319
|
+
const o = await hr(tr, b, {
|
|
320
|
+
folderId: P,
|
|
321
321
|
name: t,
|
|
322
322
|
productType: "review",
|
|
323
323
|
// default product type for uploaded files
|
|
324
324
|
productBaseType: "review"
|
|
325
325
|
});
|
|
326
|
-
|
|
326
|
+
g(!1), await N(w, o.id), v(null);
|
|
327
327
|
} catch (o) {
|
|
328
|
-
|
|
328
|
+
M(o, "creating product"), n();
|
|
329
329
|
}
|
|
330
|
-
},
|
|
331
|
-
|
|
332
|
-
}, [
|
|
333
|
-
if (!
|
|
334
|
-
return
|
|
335
|
-
|
|
330
|
+
}, z = () => {
|
|
331
|
+
g(!1), v(null), n();
|
|
332
|
+
}, [rr] = dr(), [tr] = lr(), F = async (r) => {
|
|
333
|
+
if (!j || !i)
|
|
334
|
+
return V.error("Please select exactly one version to upload reviewables"), n();
|
|
335
|
+
if (D) {
|
|
336
|
+
const e = Array.from(r).map((a) => ({
|
|
337
|
+
file: a,
|
|
338
|
+
preview: a.type.startsWith("image/") ? URL.createObjectURL(a) : void 0
|
|
339
|
+
}));
|
|
340
|
+
D.setPendingFiles((a) => [...a, ...e]);
|
|
341
|
+
const m = i.product, d = i.task ? {
|
|
342
|
+
id: i.task.id,
|
|
343
|
+
name: i.task.name,
|
|
344
|
+
label: i.task.label,
|
|
345
|
+
taskType: i.task.taskType
|
|
346
|
+
} : void 0;
|
|
347
|
+
D.onOpenVersionUpload({
|
|
348
|
+
productId: m?.id,
|
|
349
|
+
folderId: i.folder?.id,
|
|
350
|
+
taskId: i.task?.id,
|
|
351
|
+
linkedTask: d,
|
|
352
|
+
latestVersionNumber: m?.latestVersion?.version,
|
|
353
|
+
latestVersionId: m?.latestVersion?.id
|
|
354
|
+
}), n();
|
|
355
|
+
return;
|
|
356
|
+
}
|
|
357
|
+
const t = i.product?.id;
|
|
336
358
|
if (!t) {
|
|
337
|
-
|
|
359
|
+
v(r), g(!0);
|
|
338
360
|
return;
|
|
339
361
|
}
|
|
340
362
|
await N(r, t);
|
|
341
363
|
}, N = async (r, t) => {
|
|
342
364
|
try {
|
|
343
|
-
const o =
|
|
365
|
+
const o = gr(i.product?.latestVersion), e = await vr(rr, b, {
|
|
344
366
|
productId: t,
|
|
345
|
-
taskId:
|
|
367
|
+
taskId: R,
|
|
346
368
|
// previous version could have a taskId or we are uploading on a task
|
|
347
369
|
version: o
|
|
348
370
|
});
|
|
349
|
-
await
|
|
371
|
+
await Q(r, e.id), n(), q?.(e.id);
|
|
350
372
|
} catch (o) {
|
|
351
|
-
|
|
373
|
+
M(o, "uploading version"), n();
|
|
352
374
|
}
|
|
353
|
-
},
|
|
354
|
-
if (
|
|
375
|
+
}, A = async (r = []) => {
|
|
376
|
+
if (f(!1), !s.length)
|
|
355
377
|
return;
|
|
356
378
|
const t = (/* @__PURE__ */ new Date()).toISOString();
|
|
357
379
|
let o = [];
|
|
358
|
-
for (const
|
|
359
|
-
const
|
|
360
|
-
if (!
|
|
361
|
-
|
|
362
|
-
const
|
|
380
|
+
for (const e of r) {
|
|
381
|
+
const m = s.find((a) => a.id === e.id);
|
|
382
|
+
if (!m) continue;
|
|
383
|
+
e.thumbnailId;
|
|
384
|
+
const d = e.users || [];
|
|
363
385
|
o.push({
|
|
364
|
-
id:
|
|
365
|
-
projectName:
|
|
386
|
+
id: m.id,
|
|
387
|
+
projectName: m.projectName,
|
|
366
388
|
data: { updatedAt: t },
|
|
367
|
-
currentAssignees:
|
|
368
|
-
}),
|
|
389
|
+
currentAssignees: d
|
|
390
|
+
}), m.productId;
|
|
369
391
|
}
|
|
370
392
|
try {
|
|
371
|
-
await
|
|
372
|
-
} catch (
|
|
373
|
-
console.error("Error uploading thumbnail:",
|
|
393
|
+
await or({ operations: o, entityType: k }), E && E(o);
|
|
394
|
+
} catch (e) {
|
|
395
|
+
console.error("Error uploading thumbnail:", e);
|
|
374
396
|
}
|
|
375
|
-
},
|
|
376
|
-
if (!r) return
|
|
397
|
+
}, O = async (r) => {
|
|
398
|
+
if (!r) return n();
|
|
377
399
|
try {
|
|
378
400
|
if (!r.type.includes("image"))
|
|
379
401
|
throw new Error("File is not an image");
|
|
380
402
|
let t = [];
|
|
381
|
-
for (const
|
|
382
|
-
const { id:
|
|
383
|
-
if (!
|
|
384
|
-
const
|
|
385
|
-
|
|
403
|
+
for (const m of s) {
|
|
404
|
+
const { id: d, entityType: a, projectName: I } = m;
|
|
405
|
+
if (!I) throw new Error("Project name is required");
|
|
406
|
+
const nr = wr.post(
|
|
407
|
+
I && `/api/projects/${I}/${a}s/${d}/thumbnail`,
|
|
386
408
|
r,
|
|
387
409
|
{
|
|
388
|
-
onUploadProgress: (
|
|
389
|
-
|
|
410
|
+
onUploadProgress: ($) => {
|
|
411
|
+
y(Math.round(100 * $.loaded / ($.total || r.size)));
|
|
390
412
|
},
|
|
391
413
|
headers: {
|
|
392
414
|
"Content-Type": r.type
|
|
393
415
|
}
|
|
394
416
|
}
|
|
395
417
|
);
|
|
396
|
-
t.push(
|
|
418
|
+
t.push(nr);
|
|
397
419
|
}
|
|
398
|
-
const
|
|
399
|
-
thumbnailId:
|
|
400
|
-
id:
|
|
420
|
+
const e = (await Promise.all(t)).map((m, d) => ({
|
|
421
|
+
thumbnailId: m.data.id,
|
|
422
|
+
id: s[d].id
|
|
401
423
|
}));
|
|
402
|
-
|
|
424
|
+
A(e), n();
|
|
403
425
|
} catch (t) {
|
|
404
|
-
console.error(t),
|
|
426
|
+
console.error(t), V.error(t.message), n();
|
|
405
427
|
}
|
|
406
|
-
}, [
|
|
407
|
-
r.preventDefault(),
|
|
408
|
-
}, ir = (r) => {
|
|
409
|
-
r.preventDefault(), l.current--, l.current === 0 && (c(!1), u(null));
|
|
428
|
+
}, [or] = sr(), ir = (r) => {
|
|
429
|
+
r.preventDefault(), c.current++, c.current === 1 && f(!0);
|
|
410
430
|
}, pr = (r) => {
|
|
431
|
+
r.preventDefault(), c.current--, c.current === 0 && (f(!1), h(null));
|
|
432
|
+
}, er = (r) => {
|
|
411
433
|
r.preventDefault();
|
|
412
434
|
}, mr = (r) => {
|
|
413
|
-
if (r.preventDefault(),
|
|
414
|
-
if (
|
|
415
|
-
|
|
435
|
+
if (r.preventDefault(), c.current = 0, f(!1), h(null), !(!r.dataTransfer.files || r.dataTransfer.files.length === 0)) {
|
|
436
|
+
if (x === "thumbnail") {
|
|
437
|
+
l("thumbnail");
|
|
416
438
|
const t = r.dataTransfer.files[0];
|
|
417
|
-
|
|
439
|
+
O(t);
|
|
418
440
|
}
|
|
419
|
-
if (
|
|
420
|
-
|
|
441
|
+
if (x === "version") {
|
|
442
|
+
l("version");
|
|
421
443
|
const t = r.dataTransfer.files;
|
|
422
|
-
|
|
444
|
+
F(t);
|
|
423
445
|
}
|
|
424
446
|
}
|
|
425
|
-
},
|
|
447
|
+
}, S = async (r, t) => {
|
|
426
448
|
const o = r.target.files;
|
|
427
|
-
!o || o.length === 0 || (t === "version" && (
|
|
428
|
-
},
|
|
429
|
-
return /* @__PURE__ */
|
|
430
|
-
|
|
449
|
+
!o || o.length === 0 || (t === "version" && (l("version"), F(o)), t === "thumbnail" && (l("thumbnail"), O(o[0])));
|
|
450
|
+
}, L = T(null), Z = T(null);
|
|
451
|
+
return /* @__PURE__ */ p.jsxs(
|
|
452
|
+
ur,
|
|
431
453
|
{
|
|
432
|
-
entities:
|
|
433
|
-
handleThumbnailUpload:
|
|
434
|
-
thumbnailInputRef:
|
|
435
|
-
versionsInputRef:
|
|
454
|
+
entities: s,
|
|
455
|
+
handleThumbnailUpload: A,
|
|
456
|
+
thumbnailInputRef: L,
|
|
457
|
+
versionsInputRef: j ? Z : void 0,
|
|
436
458
|
children: [
|
|
437
|
-
/* @__PURE__ */
|
|
438
|
-
|
|
459
|
+
/* @__PURE__ */ p.jsxs(
|
|
460
|
+
yr,
|
|
439
461
|
{
|
|
440
|
-
className:
|
|
441
|
-
onDragEnter:
|
|
442
|
-
onDragLeave:
|
|
443
|
-
onDragOver:
|
|
462
|
+
className: ar({ dragging: C }),
|
|
463
|
+
onDragEnter: ir,
|
|
464
|
+
onDragLeave: pr,
|
|
465
|
+
onDragOver: er,
|
|
444
466
|
onDrop: mr,
|
|
445
467
|
children: [
|
|
446
|
-
/* @__PURE__ */
|
|
447
|
-
|
|
448
|
-
|
|
468
|
+
/* @__PURE__ */ p.jsx(Tr, { children: /* @__PURE__ */ p.jsx("div", { children: B }) }),
|
|
469
|
+
C && /* @__PURE__ */ p.jsx(W, { children: X.map((r) => /* @__PURE__ */ p.jsx(
|
|
470
|
+
Ur,
|
|
449
471
|
{
|
|
450
472
|
id: r.id,
|
|
451
473
|
label: r.label,
|
|
452
474
|
icon: r.icon,
|
|
453
|
-
isActive:
|
|
454
|
-
onDragOver: () =>
|
|
455
|
-
onDragLeave: () =>
|
|
475
|
+
isActive: x === r.id,
|
|
476
|
+
onDragOver: () => h(r.id),
|
|
477
|
+
onDragLeave: () => h(null)
|
|
456
478
|
},
|
|
457
479
|
r.id
|
|
458
480
|
)) }),
|
|
459
|
-
(
|
|
460
|
-
/* @__PURE__ */
|
|
461
|
-
/* @__PURE__ */
|
|
462
|
-
|
|
481
|
+
(U === "thumbnail" || U === "version") && /* @__PURE__ */ p.jsxs(W, { children: [
|
|
482
|
+
/* @__PURE__ */ p.jsxs(br, { children: [
|
|
483
|
+
/* @__PURE__ */ p.jsx(
|
|
484
|
+
Dr,
|
|
463
485
|
{
|
|
464
486
|
style: {
|
|
465
|
-
right: `${100 -
|
|
487
|
+
right: `${100 - _}%`
|
|
466
488
|
}
|
|
467
489
|
}
|
|
468
490
|
),
|
|
469
|
-
/* @__PURE__ */
|
|
491
|
+
/* @__PURE__ */ p.jsx("span", { className: "label", children: `Uploading ${U}...` })
|
|
470
492
|
] }),
|
|
471
|
-
/* @__PURE__ */
|
|
493
|
+
/* @__PURE__ */ p.jsx(xr, { icon: "close", variant: "text", onClick: n })
|
|
472
494
|
] }),
|
|
473
|
-
/* @__PURE__ */
|
|
495
|
+
/* @__PURE__ */ p.jsx(
|
|
474
496
|
"input",
|
|
475
497
|
{
|
|
476
498
|
type: "file",
|
|
477
|
-
onChange: (r) =>
|
|
478
|
-
ref:
|
|
499
|
+
onChange: (r) => S(r, "thumbnail"),
|
|
500
|
+
ref: L
|
|
479
501
|
}
|
|
480
502
|
),
|
|
481
|
-
/* @__PURE__ */
|
|
503
|
+
/* @__PURE__ */ p.jsx(
|
|
482
504
|
"input",
|
|
483
505
|
{
|
|
484
506
|
type: "file",
|
|
485
|
-
onChange: (r) =>
|
|
486
|
-
ref:
|
|
507
|
+
onChange: (r) => S(r, "version"),
|
|
508
|
+
ref: Z
|
|
487
509
|
}
|
|
488
510
|
)
|
|
489
511
|
]
|
|
490
512
|
}
|
|
491
513
|
),
|
|
492
|
-
/* @__PURE__ */
|
|
514
|
+
/* @__PURE__ */ p.jsx(
|
|
493
515
|
jr,
|
|
494
516
|
{
|
|
495
|
-
isOpen:
|
|
496
|
-
files:
|
|
497
|
-
onSubmit:
|
|
498
|
-
onCancel:
|
|
517
|
+
isOpen: G,
|
|
518
|
+
files: w,
|
|
519
|
+
onSubmit: Y,
|
|
520
|
+
onCancel: z
|
|
499
521
|
}
|
|
500
522
|
)
|
|
501
523
|
]
|
|
@@ -503,6 +525,6 @@ const Ir = [
|
|
|
503
525
|
);
|
|
504
526
|
};
|
|
505
527
|
export {
|
|
506
|
-
|
|
528
|
+
Oe as EntityPanelUploader
|
|
507
529
|
};
|
|
508
530
|
//# sourceMappingURL=EntityPanelUploader.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityPanelUploader.es.js","sources":["../../../../../src/components/EntityPanelUploader/EntityPanelUploader.tsx"],"sourcesContent":["import { ChangeEvent, useRef, useState } from 'react'\nimport clsx from 'clsx'\n\nimport { ThumbnailWrapper } from '@shared/containers'\nimport {\n useCreateVersionMutation,\n useUpdateEntitiesMutation,\n useCreateProductMutation,\n} from '@shared/api'\nimport * as Styled from './EntityPanelUploader.styled'\nimport { ThumbnailUploadProvider } from '../../context/ThumbnailUploaderContext'\nimport Dropzone, { DropzoneType } from './Dropzone'\nimport axios from 'axios'\nimport { toast } from 'react-toastify'\nimport { useReviewablesUpload } from '../ReviewablesList'\nimport { useDetailsPanelContext } from '@shared/context'\nimport EntityPanelUploaderDialog from './EntityPanelUploaderDialog'\nimport {\n sanitizeProductName,\n createProductHelper,\n createVersionHelper,\n getNextVersionNumber,\n handleUploadError,\n} from '@shared/util'\n\ntype Operation = {\n id: string\n projectName: string\n currentAssignees: any[]\n data: { updatedAt: string }\n}\nexport type EntityPanelUploaderProps = {\n entityType: string\n entities: any[]\n projectName: any\n children?: JSX.Element | JSX.Element[]\n onUploaded?: (operations: Operation[]) => void\n resetFileUploadState?: () => void\n onVersionCreated?: (versionId: string) => void\n}\n\ntype UploadType = 'thumbnail' | 'version'\nconst dropZones: (DropzoneType & { id: UploadType })[] = [\n { id: 'thumbnail', label: 'Upload thumbnail', icon: 'add_photo_alternate' },\n { id: 'version', label: 'Upload version', icon: 'layers' },\n]\n\nexport const EntityPanelUploader = ({\n children = [],\n entityType,\n entities = [],\n projectName,\n onUploaded,\n onVersionCreated,\n}: EntityPanelUploaderProps) => {\n const { dispatch } = useDetailsPanelContext()\n // Dragging and dropping state\n const [isDraggingFile, setIsDraggingFile] = useState(false)\n const [draggingZone, setDraggingZone] = useState<UploadType | null>(null)\n const dragCounterRef = useRef(0)\n\n // Uploading state\n const [uploadingType, setUploadingType] = useState<UploadType | null>(null)\n const [progress, setProgress] = useState(0)\n\n // Dialog state for product creation\n const [showProductDialog, setShowProductDialog] = useState(false)\n const [pendingFiles, setPendingFiles] = useState<FileList | null>(null)\n\n // Check if we have exactly one entity selected\n const singleEntity = entities.length === 1 ? entities[0] : null\n // extra all entity IDs for the single version entity\n const taskId: string | undefined = singleEntity?.task?.id\n const folderId: string | undefined = singleEntity?.folder?.id\n const productId: string | undefined = singleEntity?.product?.id\n const versionId: string | undefined = singleEntity?.id\n const canUploadVersions = Boolean(singleEntity && entityType !== 'representation')\n\n // Use the custom hook for reviewable upload logic (only when single version)\n const { handleFileUpload: uploadReviewableFiles } = useReviewablesUpload({\n projectName,\n versionId: versionId,\n taskId: taskId,\n folderId: folderId,\n productId: productId,\n dispatch,\n onUpload: () => {\n setUploadingType(null)\n setProgress(0)\n },\n onProgress: (progress) => {\n setProgress(progress)\n },\n })\n\n // Filter drop zones based on whether we can upload reviewables\n const availableDropZones = dropZones.filter((zone) => {\n if (zone.id === 'version') {\n return canUploadVersions\n }\n return true\n })\n\n const resetState = () => {\n setUploadingType(null)\n setIsDraggingFile(false)\n setDraggingZone(null)\n dragCounterRef.current = 0\n setProgress(0)\n setShowProductDialog(false)\n setPendingFiles(null)\n }\n\n // Handle dialog submission - create product and upload version\n const handleDialogSubmit = async (productName: string) => {\n if (!pendingFiles || !singleEntity) {\n setShowProductDialog(false)\n setPendingFiles(null)\n return\n }\n\n const sanitizedName = sanitizeProductName(productName)\n\n if (!sanitizedName.trim()) {\n toast.error(\n 'Product name must contain valid characters (letters, numbers, underscore, or hyphen)',\n )\n return\n }\n\n try {\n if (!folderId) {\n throw new Error('Folder ID is required to create a product')\n }\n setUploadingType('version')\n\n // Create the product\n const productRes = await createProductHelper(createProduct, projectName, {\n folderId: folderId,\n name: sanitizedName,\n productType: 'review', // default product type for uploaded files\n productBaseType: 'review',\n })\n\n // Close dialog and proceed with version upload\n setShowProductDialog(false)\n await uploadVersionWithProduct(pendingFiles, productRes.id)\n setPendingFiles(null)\n } catch (error: any) {\n handleUploadError(error, 'creating product')\n resetState()\n }\n }\n\n // Handle dialog cancellation\n const handleDialogCancel = () => {\n setShowProductDialog(false)\n setPendingFiles(null)\n resetState()\n }\n\n const [createVersion] = useCreateVersionMutation()\n const [createProduct] = useCreateProductMutation()\n // Handle version/reviewable file upload\n const handleVersionUpload = async (files: FileList) => {\n if (!canUploadVersions || !singleEntity) {\n toast.error('Please select exactly one version to upload reviewables')\n return resetState()\n }\n\n const productId = singleEntity.product?.id\n if (!productId) {\n // Show dialog to create product first\n setPendingFiles(files)\n setShowProductDialog(true)\n return\n }\n\n // If we have a productId, proceed with upload\n await uploadVersionWithProduct(files, productId)\n }\n\n // Helper function to handle the actual version upload\n const uploadVersionWithProduct = async (files: FileList, productId: string) => {\n try {\n const nextVersion = getNextVersionNumber(singleEntity!.product?.latestVersion)\n\n // create a new version\n const versionRes = await createVersionHelper(createVersion, projectName, {\n productId,\n taskId, // previous version could have a taskId or we are uploading on a task\n version: nextVersion,\n })\n\n await uploadReviewableFiles(files, versionRes.id)\n // The hook handles success callbacks, just reset our local state\n resetState()\n\n // update entity panel to focus the new version\n onVersionCreated?.(versionRes.id)\n } catch (error: any) {\n handleUploadError(error, 'uploading version')\n resetState()\n }\n }\n\n // once the file has been uploaded, we need to patch the entities with the new thumbnail\n const handleThumbnailFileUploaded = async (thumbnails: any[] = []) => {\n // always set isDragginle to false\n setIsDraggingFile(false)\n\n // check something was actually uploaded\n if (!entities.length) {\n return\n }\n\n // patching the updatedAt will force a refresh of the thumbnail url\n const newUpdatedAt = new Date().toISOString()\n\n let operations: Operation[] = []\n let versionPatches = []\n\n for (const entity of thumbnails) {\n const entityToPatch = entities.find((e) => e.id === entity.id)\n if (!entityToPatch) continue\n const thumbnailId = entity.thumbnailId\n const currentAssignees = entity.users || []\n\n operations.push({\n id: entityToPatch.id,\n projectName: entityToPatch.projectName,\n data: { updatedAt: newUpdatedAt },\n currentAssignees,\n })\n\n const versionPatch = {\n productId: entityToPatch.productId,\n versionUpdatedAt: newUpdatedAt,\n versionThumbnailId: thumbnailId,\n }\n\n versionPatches.push(versionPatch)\n }\n\n try {\n await updateEntities({ operations, entityType })\n onUploaded && onUploaded(operations)\n } catch (error) {\n console.error('Error uploading thumbnail:', error)\n }\n }\n\n const handleUploadThumbnail = async (file: File) => {\n if (!file) return resetState()\n\n try {\n // check file is an image\n if (!file.type.includes('image')) {\n throw new Error('File is not an image')\n }\n\n let promises = []\n for (const entity of entities) {\n const { id, entityType, projectName } = entity\n\n if (!projectName) throw new Error('Project name is required')\n\n const promise = axios.post(\n projectName && `/api/projects/${projectName}/${entityType}s/${id}/thumbnail`,\n file,\n {\n onUploadProgress: (e) => {\n setProgress(Math.round((100 * e.loaded) / (e.total || file.size)))\n },\n headers: {\n 'Content-Type': file.type,\n },\n },\n )\n\n promises.push(promise)\n }\n\n const res = await Promise.all(promises)\n\n const updatedEntities = res.map((res, i) => ({\n thumbnailId: res.data.id as string,\n id: entities[i].id,\n }))\n\n handleThumbnailFileUploaded(updatedEntities)\n resetState()\n } catch (error: any) {\n console.error(error)\n toast.error(error.message)\n resetState()\n }\n }\n\n const [updateEntities] = useUpdateEntitiesMutation()\n\n const handleDragEnter = (e: React.DragEvent) => {\n e.preventDefault()\n dragCounterRef.current++\n if (dragCounterRef.current === 1) {\n setIsDraggingFile(true)\n }\n }\n\n const handleDragLeave = (e: React.DragEvent) => {\n e.preventDefault()\n dragCounterRef.current--\n if (dragCounterRef.current === 0) {\n setIsDraggingFile(false)\n setDraggingZone(null)\n }\n }\n\n const handleDragOver = (e: React.DragEvent) => {\n e.preventDefault()\n }\n\n const handleDrop = (e: React.DragEvent) => {\n e.preventDefault()\n dragCounterRef.current = 0\n setIsDraggingFile(false)\n setDraggingZone(null)\n\n if (!e.dataTransfer.files || e.dataTransfer.files.length === 0) {\n return\n }\n\n if (draggingZone === 'thumbnail') {\n setUploadingType('thumbnail')\n const file = e.dataTransfer.files[0]\n // try to upload the thumbnail\n handleUploadThumbnail(file)\n }\n\n if (draggingZone === 'version') {\n setUploadingType('version')\n const files = e.dataTransfer.files\n // try to upload the reviewables using the hook\n handleVersionUpload(files)\n }\n }\n\n // upload thumbnail from input (right click on thumbnail)\n const handleInputUpload = async (event: ChangeEvent<HTMLInputElement>, type: UploadType) => {\n const files = event.target.files\n if (!files || files.length === 0) {\n return\n }\n\n if (type === 'version') {\n setUploadingType('version')\n handleVersionUpload(files)\n }\n if (type === 'thumbnail') {\n setUploadingType('thumbnail')\n handleUploadThumbnail(files[0])\n }\n }\n\n const thumbnailInputRef = useRef<HTMLInputElement>(null)\n const versionsInputRef = useRef<HTMLInputElement>(null)\n\n return (\n <ThumbnailUploadProvider\n entities={entities}\n handleThumbnailUpload={handleThumbnailFileUploaded}\n thumbnailInputRef={thumbnailInputRef}\n versionsInputRef={canUploadVersions ? versionsInputRef : undefined}\n >\n <Styled.DragAndDropWrapper\n className={clsx({ dragging: isDraggingFile })}\n onDragEnter={handleDragEnter}\n onDragLeave={handleDragLeave}\n onDragOver={handleDragOver}\n onDrop={handleDrop}\n >\n <ThumbnailWrapper>\n <div>{children}</div>\n </ThumbnailWrapper>\n {isDraggingFile && (\n <Styled.DropZones>\n {availableDropZones.map((zone) => (\n <Dropzone\n key={zone.id}\n id={zone.id}\n label={zone.label}\n icon={zone.icon}\n isActive={draggingZone === zone.id}\n onDragOver={() => setDraggingZone(zone.id)}\n onDragLeave={() => setDraggingZone(null)}\n />\n ))}\n </Styled.DropZones>\n )}\n {(uploadingType === 'thumbnail' || uploadingType === 'version') && (\n <Styled.DropZones>\n <Styled.UploadingProgress>\n <Styled.Progress\n style={{\n right: `${100 - progress}%`,\n }}\n />\n <span className=\"label\">{`Uploading ${uploadingType}...`}</span>\n </Styled.UploadingProgress>\n <Styled.CancelButton icon={'close'} variant=\"text\" onClick={resetState} />\n </Styled.DropZones>\n )}\n <input\n type=\"file\"\n onChange={(e) => handleInputUpload(e, 'thumbnail')}\n ref={thumbnailInputRef}\n />\n <input\n type=\"file\"\n onChange={(e) => handleInputUpload(e, 'version')}\n ref={versionsInputRef}\n />\n </Styled.DragAndDropWrapper>\n\n {/* Product creation dialog */}\n <EntityPanelUploaderDialog\n isOpen={showProductDialog}\n files={pendingFiles}\n onSubmit={handleDialogSubmit}\n onCancel={handleDialogCancel}\n />\n </ThumbnailUploadProvider>\n )\n}\n"],"names":["dropZones","EntityPanelUploader","children","entityType","entities","projectName","onUploaded","onVersionCreated","dispatch","useDetailsPanelContext","isDraggingFile","setIsDraggingFile","useState","draggingZone","setDraggingZone","dragCounterRef","useRef","uploadingType","setUploadingType","progress","setProgress","showProductDialog","setShowProductDialog","pendingFiles","setPendingFiles","singleEntity","taskId","folderId","productId","versionId","canUploadVersions","uploadReviewableFiles","useReviewablesUpload","availableDropZones","zone","resetState","handleDialogSubmit","productName","sanitizedName","sanitizeProductName","toast","productRes","createProductHelper","createProduct","uploadVersionWithProduct","error","handleUploadError","handleDialogCancel","createVersion","useCreateVersionMutation","useCreateProductMutation","handleVersionUpload","files","nextVersion","getNextVersionNumber","versionRes","createVersionHelper","handleThumbnailFileUploaded","thumbnails","newUpdatedAt","operations","entity","entityToPatch","e","currentAssignees","updateEntities","handleUploadThumbnail","file","promises","id","promise","axios","updatedEntities","res","i","useUpdateEntitiesMutation","handleDragEnter","handleDragLeave","handleDragOver","handleDrop","handleInputUpload","event","type","thumbnailInputRef","versionsInputRef","jsxs","ThumbnailUploadProvider","Styled.DragAndDropWrapper","clsx","jsx","ThumbnailWrapper","Styled.DropZones","Dropzone","Styled.UploadingProgress","Styled.Progress","Styled.CancelButton","EntityPanelUploaderDialog"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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A,gBAAC;AAAA,gBAAA;AAAA,kBACC,MAAK;AAAA,kBACL,UAAU,CAAC1B,MAAMiB,EAAkBjB,GAAG,WAAW;AAAA,kBACjD,KAAKoB;AAAA,gBAAA;AAAA,cAAA;AAAA,cAEPM,gBAAAA,EAAAA;AAAAA,gBAAC;AAAA,gBAAA;AAAA,kBACC,MAAK;AAAA,kBACL,UAAU,CAAC1B,MAAMiB,EAAkBjB,GAAG,SAAS;AAAA,kBAC/C,KAAKqB;AAAA,gBAAA;AAAA,cAAA;AAAA,YACP;AAAA,UAAA;AAAA,QAAA;AAAA,QAIFK,gBAAAA,EAAAA;AAAAA,UAACO;AAAA,UAAA;AAAA,YACC,QAAQ3E;AAAA,YACR,OAAOE;AAAA,YACP,UAAUa;AAAA,YACV,UAAUW;AAAA,UAAA;AAAA,QAAA;AAAA,MACZ;AAAA,IAAA;AAAA,EAAA;AAGN;"}
|
|
1
|
+
{"version":3,"file":"EntityPanelUploader.es.js","sources":["../../../../../src/components/EntityPanelUploader/EntityPanelUploader.tsx"],"sourcesContent":["import { ChangeEvent, useRef, useState } from 'react'\nimport clsx from 'clsx'\n\nimport { ThumbnailWrapper } from '@shared/containers'\nimport {\n useCreateVersionMutation,\n useUpdateEntitiesMutation,\n useCreateProductMutation,\n} from '@shared/api'\nimport * as Styled from './EntityPanelUploader.styled'\nimport { ThumbnailUploadProvider } from '../../context/ThumbnailUploaderContext'\nimport Dropzone, { DropzoneType } from './Dropzone'\nimport axios from 'axios'\nimport { toast } from 'react-toastify'\nimport { useReviewablesUpload } from '../ReviewablesList'\nimport { useDetailsPanelContext } from '@shared/context'\nimport EntityPanelUploaderDialog from './EntityPanelUploaderDialog'\nimport { useOptionalVersionUploadContext } from '@shared/components'\nimport {\n sanitizeProductName,\n createProductHelper,\n createVersionHelper,\n getNextVersionNumber,\n handleUploadError,\n} from '@shared/util'\n\ntype Operation = {\n id: string\n projectName: string\n currentAssignees: any[]\n data: { updatedAt: string }\n}\nexport type EntityPanelUploaderProps = {\n entityType: string\n entities: any[]\n projectName: any\n children?: JSX.Element | JSX.Element[]\n onUploaded?: (operations: Operation[]) => void\n resetFileUploadState?: () => void\n onVersionCreated?: (versionId: string) => void\n}\n\ntype UploadType = 'thumbnail' | 'version'\nconst dropZones: (DropzoneType & { id: UploadType })[] = [\n { id: 'thumbnail', label: 'Upload thumbnail', icon: 'add_photo_alternate' },\n { id: 'version', label: 'Upload version', icon: 'layers' },\n]\n\nexport const EntityPanelUploader = ({\n children = [],\n entityType,\n entities = [],\n projectName,\n onUploaded,\n onVersionCreated,\n}: EntityPanelUploaderProps) => {\n const { dispatch } = useDetailsPanelContext()\n const versionUploadCtx = useOptionalVersionUploadContext()\n // Dragging and dropping state\n const [isDraggingFile, setIsDraggingFile] = useState(false)\n const [draggingZone, setDraggingZone] = useState<UploadType | null>(null)\n const dragCounterRef = useRef(0)\n\n // Uploading state\n const [uploadingType, setUploadingType] = useState<UploadType | null>(null)\n const [progress, setProgress] = useState(0)\n\n // Dialog state for product creation\n const [showProductDialog, setShowProductDialog] = useState(false)\n const [pendingFiles, setPendingFiles] = useState<FileList | null>(null)\n\n // Check if we have exactly one entity selected\n const singleEntity = entities.length === 1 ? entities[0] : null\n // extra all entity IDs for the single version entity\n const taskId: string | undefined = singleEntity?.task?.id\n const folderId: string | undefined = singleEntity?.folder?.id\n const productId: string | undefined = singleEntity?.product?.id\n const versionId: string | undefined = singleEntity?.id\n const canUploadVersions = Boolean(singleEntity && entityType !== 'representation')\n\n // Use the custom hook for reviewable upload logic (only when single version)\n const { handleFileUpload: uploadReviewableFiles } = useReviewablesUpload({\n projectName,\n versionId: versionId,\n taskId: taskId,\n folderId: folderId,\n productId: productId,\n dispatch,\n onUpload: () => {\n setUploadingType(null)\n setProgress(0)\n },\n onProgress: (progress) => {\n setProgress(progress)\n },\n })\n\n // Filter drop zones based on whether we can upload reviewables\n const availableDropZones = dropZones.filter((zone) => {\n if (zone.id === 'version') {\n return canUploadVersions\n }\n return true\n })\n\n const resetState = () => {\n setUploadingType(null)\n setIsDraggingFile(false)\n setDraggingZone(null)\n dragCounterRef.current = 0\n setProgress(0)\n setShowProductDialog(false)\n setPendingFiles(null)\n }\n\n // Handle dialog submission - create product and upload version\n const handleDialogSubmit = async (productName: string) => {\n if (!pendingFiles || !singleEntity) {\n setShowProductDialog(false)\n setPendingFiles(null)\n return\n }\n\n const sanitizedName = sanitizeProductName(productName)\n\n if (!sanitizedName.trim()) {\n toast.error(\n 'Product name must contain valid characters (letters, numbers, underscore, or hyphen)',\n )\n return\n }\n\n try {\n if (!folderId) {\n throw new Error('Folder ID is required to create a product')\n }\n setUploadingType('version')\n\n // Create the product\n const productRes = await createProductHelper(createProduct, projectName, {\n folderId: folderId,\n name: sanitizedName,\n productType: 'review', // default product type for uploaded files\n productBaseType: 'review',\n })\n\n // Close dialog and proceed with version upload\n setShowProductDialog(false)\n await uploadVersionWithProduct(pendingFiles, productRes.id)\n setPendingFiles(null)\n } catch (error: any) {\n handleUploadError(error, 'creating product')\n resetState()\n }\n }\n\n // Handle dialog cancellation\n const handleDialogCancel = () => {\n setShowProductDialog(false)\n setPendingFiles(null)\n resetState()\n }\n\n const [createVersion] = useCreateVersionMutation()\n const [createProduct] = useCreateProductMutation()\n // Handle version/reviewable file upload\n const handleVersionUpload = async (files: FileList) => {\n if (!canUploadVersions || !singleEntity) {\n toast.error('Please select exactly one version to upload reviewables')\n return resetState()\n }\n\n if (versionUploadCtx) {\n const fileArray = Array.from(files)\n const pending = fileArray.map((file) => ({\n file,\n preview: file.type.startsWith('image/') ? URL.createObjectURL(file) : undefined,\n }))\n versionUploadCtx.setPendingFiles((prev) => [...prev, ...pending])\n\n const product = singleEntity.product\n const linkedTask = singleEntity.task\n ? {\n id: singleEntity.task.id,\n name: singleEntity.task.name,\n label: singleEntity.task.label,\n taskType: singleEntity.task.taskType,\n }\n : undefined\n\n versionUploadCtx.onOpenVersionUpload({\n productId: product?.id,\n folderId: singleEntity.folder?.id,\n taskId: singleEntity.task?.id,\n linkedTask,\n latestVersionNumber: product?.latestVersion?.version,\n latestVersionId: product?.latestVersion?.id,\n })\n // Reset local upload UI; the dialog now drives the flow.\n resetState()\n return\n }\n\n const productId = singleEntity.product?.id\n if (!productId) {\n // Show dialog to create product first\n setPendingFiles(files)\n setShowProductDialog(true)\n return\n }\n\n // If we have a productId, proceed with upload\n await uploadVersionWithProduct(files, productId)\n }\n\n // Helper function to handle the actual version upload\n const uploadVersionWithProduct = async (files: FileList, productId: string) => {\n try {\n const nextVersion = getNextVersionNumber(singleEntity!.product?.latestVersion)\n\n // create a new version\n const versionRes = await createVersionHelper(createVersion, projectName, {\n productId,\n taskId, // previous version could have a taskId or we are uploading on a task\n version: nextVersion,\n })\n\n await uploadReviewableFiles(files, versionRes.id)\n // The hook handles success callbacks, just reset our local state\n resetState()\n\n // update entity panel to focus the new version\n onVersionCreated?.(versionRes.id)\n } catch (error: any) {\n handleUploadError(error, 'uploading version')\n resetState()\n }\n }\n\n // once the file has been uploaded, we need to patch the entities with the new thumbnail\n const handleThumbnailFileUploaded = async (thumbnails: any[] = []) => {\n // always set isDragginle to false\n setIsDraggingFile(false)\n\n // check something was actually uploaded\n if (!entities.length) {\n return\n }\n\n // patching the updatedAt will force a refresh of the thumbnail url\n const newUpdatedAt = new Date().toISOString()\n\n let operations: Operation[] = []\n let versionPatches = []\n\n for (const entity of thumbnails) {\n const entityToPatch = entities.find((e) => e.id === entity.id)\n if (!entityToPatch) continue\n const thumbnailId = entity.thumbnailId\n const currentAssignees = entity.users || []\n\n operations.push({\n id: entityToPatch.id,\n projectName: entityToPatch.projectName,\n data: { updatedAt: newUpdatedAt },\n currentAssignees,\n })\n\n const versionPatch = {\n productId: entityToPatch.productId,\n versionUpdatedAt: newUpdatedAt,\n versionThumbnailId: thumbnailId,\n }\n\n versionPatches.push(versionPatch)\n }\n\n try {\n await updateEntities({ operations, entityType })\n onUploaded && onUploaded(operations)\n } catch (error) {\n console.error('Error uploading thumbnail:', error)\n }\n }\n\n const handleUploadThumbnail = async (file: File) => {\n if (!file) return resetState()\n\n try {\n // check file is an image\n if (!file.type.includes('image')) {\n throw new Error('File is not an image')\n }\n\n let promises = []\n for (const entity of entities) {\n const { id, entityType, projectName } = entity\n\n if (!projectName) throw new Error('Project name is required')\n\n const promise = axios.post(\n projectName && `/api/projects/${projectName}/${entityType}s/${id}/thumbnail`,\n file,\n {\n onUploadProgress: (e) => {\n setProgress(Math.round((100 * e.loaded) / (e.total || file.size)))\n },\n headers: {\n 'Content-Type': file.type,\n },\n },\n )\n\n promises.push(promise)\n }\n\n const res = await Promise.all(promises)\n\n const updatedEntities = res.map((res, i) => ({\n thumbnailId: res.data.id as string,\n id: entities[i].id,\n }))\n\n handleThumbnailFileUploaded(updatedEntities)\n resetState()\n } catch (error: any) {\n console.error(error)\n toast.error(error.message)\n resetState()\n }\n }\n\n const [updateEntities] = useUpdateEntitiesMutation()\n\n const handleDragEnter = (e: React.DragEvent) => {\n e.preventDefault()\n dragCounterRef.current++\n if (dragCounterRef.current === 1) {\n setIsDraggingFile(true)\n }\n }\n\n const handleDragLeave = (e: React.DragEvent) => {\n e.preventDefault()\n dragCounterRef.current--\n if (dragCounterRef.current === 0) {\n setIsDraggingFile(false)\n setDraggingZone(null)\n }\n }\n\n const handleDragOver = (e: React.DragEvent) => {\n e.preventDefault()\n }\n\n const handleDrop = (e: React.DragEvent) => {\n e.preventDefault()\n dragCounterRef.current = 0\n setIsDraggingFile(false)\n setDraggingZone(null)\n\n if (!e.dataTransfer.files || e.dataTransfer.files.length === 0) {\n return\n }\n\n if (draggingZone === 'thumbnail') {\n setUploadingType('thumbnail')\n const file = e.dataTransfer.files[0]\n // try to upload the thumbnail\n handleUploadThumbnail(file)\n }\n\n if (draggingZone === 'version') {\n setUploadingType('version')\n const files = e.dataTransfer.files\n // try to upload the reviewables using the hook\n handleVersionUpload(files)\n }\n }\n\n // upload thumbnail from input (right click on thumbnail)\n const handleInputUpload = async (event: ChangeEvent<HTMLInputElement>, type: UploadType) => {\n const files = event.target.files\n if (!files || files.length === 0) {\n return\n }\n\n if (type === 'version') {\n setUploadingType('version')\n handleVersionUpload(files)\n }\n if (type === 'thumbnail') {\n setUploadingType('thumbnail')\n handleUploadThumbnail(files[0])\n }\n }\n\n const thumbnailInputRef = useRef<HTMLInputElement>(null)\n const versionsInputRef = useRef<HTMLInputElement>(null)\n\n return (\n <ThumbnailUploadProvider\n entities={entities}\n handleThumbnailUpload={handleThumbnailFileUploaded}\n thumbnailInputRef={thumbnailInputRef}\n versionsInputRef={canUploadVersions ? versionsInputRef : undefined}\n >\n <Styled.DragAndDropWrapper\n className={clsx({ dragging: isDraggingFile })}\n onDragEnter={handleDragEnter}\n onDragLeave={handleDragLeave}\n onDragOver={handleDragOver}\n onDrop={handleDrop}\n >\n <ThumbnailWrapper>\n <div>{children}</div>\n </ThumbnailWrapper>\n {isDraggingFile && (\n <Styled.DropZones>\n {availableDropZones.map((zone) => (\n <Dropzone\n key={zone.id}\n id={zone.id}\n label={zone.label}\n icon={zone.icon}\n isActive={draggingZone === zone.id}\n onDragOver={() => setDraggingZone(zone.id)}\n onDragLeave={() => setDraggingZone(null)}\n />\n ))}\n </Styled.DropZones>\n )}\n {(uploadingType === 'thumbnail' || uploadingType === 'version') && (\n <Styled.DropZones>\n <Styled.UploadingProgress>\n <Styled.Progress\n style={{\n right: `${100 - progress}%`,\n }}\n />\n <span className=\"label\">{`Uploading ${uploadingType}...`}</span>\n </Styled.UploadingProgress>\n <Styled.CancelButton icon={'close'} variant=\"text\" onClick={resetState} />\n </Styled.DropZones>\n )}\n <input\n type=\"file\"\n onChange={(e) => handleInputUpload(e, 'thumbnail')}\n ref={thumbnailInputRef}\n />\n <input\n type=\"file\"\n onChange={(e) => handleInputUpload(e, 'version')}\n ref={versionsInputRef}\n />\n </Styled.DragAndDropWrapper>\n\n {/* Product creation dialog */}\n <EntityPanelUploaderDialog\n isOpen={showProductDialog}\n files={pendingFiles}\n onSubmit={handleDialogSubmit}\n onCancel={handleDialogCancel}\n />\n </ThumbnailUploadProvider>\n )\n}\n"],"names":["dropZones","EntityPanelUploader","children","entityType","entities","projectName","onUploaded","onVersionCreated","dispatch","useDetailsPanelContext","versionUploadCtx","useOptionalVersionUploadContext","isDraggingFile","setIsDraggingFile","useState","draggingZone","setDraggingZone","dragCounterRef","useRef","uploadingType","setUploadingType","progress","setProgress","showProductDialog","setShowProductDialog","pendingFiles","setPendingFiles","singleEntity","taskId","folderId","productId","versionId","canUploadVersions","uploadReviewableFiles","useReviewablesUpload","availableDropZones","zone","resetState","handleDialogSubmit","productName","sanitizedName","sanitizeProductName","toast","productRes","createProductHelper","createProduct","uploadVersionWithProduct","error","handleUploadError","handleDialogCancel","createVersion","useCreateVersionMutation","useCreateProductMutation","handleVersionUpload","files","pending","file","prev","product","linkedTask","nextVersion","getNextVersionNumber","versionRes","createVersionHelper","handleThumbnailFileUploaded","thumbnails","newUpdatedAt","operations","entity","entityToPatch","e","currentAssignees","updateEntities","handleUploadThumbnail","promises","id","promise","axios","updatedEntities","res","i","useUpdateEntitiesMutation","handleDragEnter","handleDragLeave","handleDragOver","handleDrop","handleInputUpload","event","type","thumbnailInputRef","versionsInputRef","jsxs","ThumbnailUploadProvider","Styled.DragAndDropWrapper","clsx","jsx","ThumbnailWrapper","Styled.DropZones","Dropzone","Styled.UploadingProgress","Styled.Progress","Styled.CancelButton","EntityPanelUploaderDialog"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2CA,MAAMA,KAAmD;AAAA,EAC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virtual/jsx-runtime.cjs.js"),o=require("react"),r="https://ynput.
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("../../../../_virtual/jsx-runtime.cjs.js"),o=require("react"),r="https://ynput.cloud/free-trial",c=o.forwardRef(({children:e,...t},n)=>i.jsxRuntimeExports.jsx("a",{href:r,target:"_blank",rel:"noopener noreferrer",...t,ref:n,children:e}));exports.PricingLink=c;exports.pricingUrl=r;
|
|
2
2
|
//# sourceMappingURL=PricingLink.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PricingLink.cjs.js","sources":["../../../../../src/components/Powerpack/PricingLink.tsx"],"sourcesContent":["import { forwardRef } from 'react'\nexport const pricingUrl = 'https://ynput.
|
|
1
|
+
{"version":3,"file":"PricingLink.cjs.js","sources":["../../../../../src/components/Powerpack/PricingLink.tsx"],"sourcesContent":["import { forwardRef } from 'react'\nexport const pricingUrl = 'https://ynput.cloud/free-trial'\n\nexport interface PricingLinkProps extends React.HTMLAttributes<HTMLAnchorElement> {}\n\nexport const PricingLink = forwardRef<HTMLAnchorElement, PricingLinkProps>(\n ({ children, ...props }, ref) => {\n return (\n <a href={pricingUrl} target=\"_blank\" rel=\"noopener noreferrer\" {...props} ref={ref}>\n {children}\n </a>\n )\n },\n)\n"],"names":["pricingUrl","PricingLink","forwardRef","children","props","ref","jsx"],"mappings":"8JACaA,EAAa,iCAIbC,EAAcC,EAAAA,WACzB,CAAC,CAAE,SAAAC,EAAU,GAAGC,CAAA,EAASC,IAErBC,EAAAA,kBAAAA,IAAC,IAAA,CAAE,KAAMN,EAAY,OAAO,SAAS,IAAI,sBAAuB,GAAGI,EAAO,IAAAC,EACvE,SAAAF,CAAA,CACH,CAGN"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { j as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
const i = "https://ynput.
|
|
4
|
-
({ children: r, ...
|
|
1
|
+
import { j as o } from "../../../../_virtual/jsx-runtime.es.js";
|
|
2
|
+
import { forwardRef as n } from "react";
|
|
3
|
+
const i = "https://ynput.cloud/free-trial", s = n(
|
|
4
|
+
({ children: r, ...e }, t) => /* @__PURE__ */ o.jsx("a", { href: i, target: "_blank", rel: "noopener noreferrer", ...e, ref: t, children: r })
|
|
5
5
|
);
|
|
6
6
|
export {
|
|
7
|
-
|
|
7
|
+
s as PricingLink,
|
|
8
8
|
i as pricingUrl
|
|
9
9
|
};
|
|
10
10
|
//# sourceMappingURL=PricingLink.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PricingLink.es.js","sources":["../../../../../src/components/Powerpack/PricingLink.tsx"],"sourcesContent":["import { forwardRef } from 'react'\nexport const pricingUrl = 'https://ynput.
|
|
1
|
+
{"version":3,"file":"PricingLink.es.js","sources":["../../../../../src/components/Powerpack/PricingLink.tsx"],"sourcesContent":["import { forwardRef } from 'react'\nexport const pricingUrl = 'https://ynput.cloud/free-trial'\n\nexport interface PricingLinkProps extends React.HTMLAttributes<HTMLAnchorElement> {}\n\nexport const PricingLink = forwardRef<HTMLAnchorElement, PricingLinkProps>(\n ({ children, ...props }, ref) => {\n return (\n <a href={pricingUrl} target=\"_blank\" rel=\"noopener noreferrer\" {...props} ref={ref}>\n {children}\n </a>\n )\n },\n)\n"],"names":["pricingUrl","PricingLink","forwardRef","children","props","ref","jsx"],"mappings":";;AACO,MAAMA,IAAa,kCAIbC,IAAcC;AAAA,EACzB,CAAC,EAAE,UAAAC,GAAU,GAAGC,EAAA,GAASC,MAErBC,gBAAAA,EAAAA,IAAC,KAAA,EAAE,MAAMN,GAAY,QAAO,UAAS,KAAI,uBAAuB,GAAGI,GAAO,KAAAC,GACvE,UAAAF,EAAA,CACH;AAGN;"}
|