@comet/cms-admin 8.32.1 → 8.32.2

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.
@@ -1 +1 @@
1
- {"version":3,"file":"useDamFileUpload.d.ts","sourceRoot":"","sources":["../../../../src/dam/DataGrid/fileUpload/useDamFileUpload.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,SAAS,EAAkC,MAAM,OAAO,CAAC;AACvE,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAMjE,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAWlE,OAAO,EAAE,KAAK,iBAAiB,EAAwB,MAAM,qBAAqB,CAAC;AAoBnF,MAAM,WAAW,yBAA0B,SAAQ,IAAI;IACnD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,eAAe,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,YAAY,CAAC;CAC/B;AAED,MAAM,WAAW,kBAAmB,SAAQ,yBAAyB;IACjE,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,UAAU,oBAAoB;IAC1B,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;CAChC;AAED,UAAU,KAAK;IACX,aAAa,EAAE,yBAAyB,EAAE,CAAC;IAC3C,cAAc,EAAE,aAAa,EAAE,CAAC;CACnC;AAED,KAAK,YAAY,GAAG;IAAE,gBAAgB,EAAE,KAAK,CAAC;IAAC,cAAc,EAAE,KAAK,CAAA;CAAE,GAAG;IAAE,gBAAgB,EAAE,MAAM,CAAC;IAAC,cAAc,EAAE,MAAM,CAAA;CAAE,CAAC;AAE9H,UAAU,kBAAkB;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,YAAY,CAAC,EAAE,YAAY,CAAC;CAC/B;AAED,MAAM,WAAW,aAAa;IAC1B,WAAW,EAAE,CACT,EAAE,aAAa,EAAE,cAAc,EAAE,EAAE,KAAK,EACxC,EAAE,QAAQ,EAAE,YAAY,EAAE,EAAE,kBAAkB,KAC7C,OAAO,CAAC;QAAE,QAAQ,EAAE,OAAO,CAAC;QAAC,aAAa,EAAE,YAAY,EAAE,CAAC;QAAC,aAAa,EAAE,iBAAiB,EAAE,CAAA;KAAE,CAAC,CAAC;IACvG,gBAAgB,CAAC,EAAE,yBAAyB,EAAE,CAAC;IAC/C,kBAAkB,EAAE,MAAM,CAAC;IAC3B,OAAO,EAAE,SAAS,CAAC;IACnB,cAAc,EAAE;QACZ,MAAM,EAAE,MAAM,CAAC;QACf,QAAQ,EAAE,OAAO,CAAC;QAClB,OAAO,EAAE,MAAM,CAAC;KACnB,CAAC;IACF,kBAAkB,EAAE,iBAAiB,EAAE,CAAC;CAC3C;AAED,MAAM,WAAW,yBAAyB;IACtC,IAAI,EAAE,IAAI,CAAC,kBAAkB,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;IAChD,OAAO,EAAE,SAAS,CAAC;CACtB;AAED,UAAU,YAAY;IAClB,IAAI,EAAE,IAAI,CAAC;CACd;AAwCD,eAAO,MAAM,gBAAgB,GAAI,SAAS,oBAAoB,KAAG,aA6YhE,CAAC"}
1
+ {"version":3,"file":"useDamFileUpload.d.ts","sourceRoot":"","sources":["../../../../src/dam/DataGrid/fileUpload/useDamFileUpload.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,SAAS,EAAkC,MAAM,OAAO,CAAC;AACvE,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAMjE,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAWlE,OAAO,EAAE,KAAK,iBAAiB,EAAwB,MAAM,qBAAqB,CAAC;AAoBnF,MAAM,WAAW,yBAA0B,SAAQ,IAAI;IACnD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,eAAe,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,YAAY,CAAC;CAC/B;AAED,MAAM,WAAW,kBAAmB,SAAQ,yBAAyB;IACjE,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,UAAU,oBAAoB;IAC1B,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;CAChC;AAED,UAAU,KAAK;IACX,aAAa,EAAE,yBAAyB,EAAE,CAAC;IAC3C,cAAc,EAAE,aAAa,EAAE,CAAC;CACnC;AAED,KAAK,YAAY,GAAG;IAAE,gBAAgB,EAAE,KAAK,CAAC;IAAC,cAAc,EAAE,KAAK,CAAA;CAAE,GAAG;IAAE,gBAAgB,EAAE,MAAM,CAAC;IAAC,cAAc,EAAE,MAAM,CAAA;CAAE,CAAC;AAE9H,UAAU,kBAAkB;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,YAAY,CAAC,EAAE,YAAY,CAAC;CAC/B;AAED,MAAM,WAAW,aAAa;IAC1B,WAAW,EAAE,CACT,EAAE,aAAa,EAAE,cAAc,EAAE,EAAE,KAAK,EACxC,EAAE,QAAQ,EAAE,YAAY,EAAE,EAAE,kBAAkB,KAC7C,OAAO,CAAC;QAAE,QAAQ,EAAE,OAAO,CAAC;QAAC,aAAa,EAAE,YAAY,EAAE,CAAC;QAAC,aAAa,EAAE,iBAAiB,EAAE,CAAA;KAAE,CAAC,CAAC;IACvG,gBAAgB,CAAC,EAAE,yBAAyB,EAAE,CAAC;IAC/C,kBAAkB,EAAE,MAAM,CAAC;IAC3B,OAAO,EAAE,SAAS,CAAC;IACnB,cAAc,EAAE;QACZ,MAAM,EAAE,MAAM,CAAC;QACf,QAAQ,EAAE,OAAO,CAAC;QAClB,OAAO,EAAE,MAAM,CAAC;KACnB,CAAC;IACF,kBAAkB,EAAE,iBAAiB,EAAE,CAAC;CAC3C;AAED,MAAM,WAAW,yBAAyB;IACtC,IAAI,EAAE,IAAI,CAAC,kBAAkB,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;IAChD,OAAO,EAAE,SAAS,CAAC;CACtB;AAED,UAAU,YAAY;IAClB,IAAI,EAAE,IAAI,CAAC;CACd;AAoCD,eAAO,MAAM,gBAAgB,GAAI,SAAS,oBAAoB,KAAG,aA6YhE,CAAC"}
@@ -29,6 +29,10 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
29
29
  function _regeneratorValues(e) { if (null != e) { var t = e["function" == typeof Symbol && Symbol.iterator || "@@iterator"], r = 0; if (t) return t.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) return { next: function next() { return e && r >= e.length && (e = void 0), { value: e && e[r++], done: !e }; } }; } throw new TypeError(_typeof(e) + " is not iterable"); }
30
30
  function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
31
31
  function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
32
+ function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
33
+ function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
34
+ function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
35
+ function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
32
36
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
33
37
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
34
38
  function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
@@ -42,84 +46,52 @@ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLim
42
46
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
43
47
  function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
44
48
  function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
45
- function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
46
- function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
47
49
  function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
48
50
  function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
49
51
  function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
50
- function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
51
- function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
52
- var addFolderPathToFiles = /*#__PURE__*/function () {
53
- var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(acceptedFiles) {
54
- var newFiles, _iterator, _step, _file$path, _file$path2, _harmonizedPath, file, harmonizedPath, _file$path3, buffer, newFile, folderPath, _t;
55
- return _regenerator().w(function (_context) {
56
- while (1) switch (_context.p = _context.n) {
57
- case 0:
58
- newFiles = [];
59
- _iterator = _createForOfIteratorHelper(acceptedFiles);
60
- _context.p = 1;
61
- _iterator.s();
62
- case 2:
63
- if ((_step = _iterator.n()).done) {
64
- _context.n = 5;
65
- break;
66
- }
67
- file = _step.value;
68
- harmonizedPath = void 0; // when a file is uploaded, the file path is prefixed with "./"
69
- // when a folder is uploaded via drag and drop, the file paths are prefixed with "/"
70
- // when a folder is uploaded via input field, the file paths don't have any prefix
71
- if ((_file$path = file.path) !== null && _file$path !== void 0 && _file$path.startsWith("./") || (_file$path2 = file.path) !== null && _file$path2 !== void 0 && _file$path2.startsWith("/")) {
72
- // if the path has a "./" or "/" prefix, this prefix is removed => path is harmonized
73
- harmonizedPath = (_file$path3 = file.path) === null || _file$path3 === void 0 ? void 0 : _file$path3.split("/").splice(1).join("/");
74
- } else {
75
- harmonizedPath = file.path;
76
- }
77
-
78
- // Create a new file because of a strange bug in Firefox that when uploading a folder via drag and drop
79
- // changes the mimetype of all uploaded files to "application/octet-stream". This behavior only happens in Firefox
80
- // (not in Chrome or Safari) and I couldn't find the reason for it.
81
- // When looking at the formData in the web dev tools, the mimetype is still correct. It is only changed to a
82
- // wrong type in the actual request.
83
- // The bug could be avoided by creating a new file. Maybe an issue with Dropzone?
84
- _context.n = 3;
85
- return file.arrayBuffer();
86
- case 3:
87
- buffer = _context.v;
88
- newFile = new File([buffer], file.name, {
89
- lastModified: file.lastModified,
90
- type: file.type
91
- });
92
- newFile.path = file.path;
93
- newFile.license = file.license;
94
- newFile.title = file.title;
95
- newFile.altText = file.altText;
96
- newFile.importSource = file.importSource;
97
- folderPath = (_harmonizedPath = harmonizedPath) === null || _harmonizedPath === void 0 ? void 0 : _harmonizedPath.split("/").slice(0, -1).join("/");
98
- newFile.folderPath = folderPath && (folderPath === null || folderPath === void 0 ? void 0 : folderPath.length) > 0 ? folderPath : undefined;
99
- newFiles.push(newFile);
100
- case 4:
101
- _context.n = 2;
102
- break;
103
- case 5:
104
- _context.n = 7;
105
- break;
106
- case 6:
107
- _context.p = 6;
108
- _t = _context.v;
109
- _iterator.e(_t);
110
- case 7:
111
- _context.p = 7;
112
- _iterator.f();
113
- return _context.f(7);
114
- case 8:
115
- return _context.a(2, newFiles);
52
+ var addFolderPathToFiles = function addFolderPathToFiles(acceptedFiles) {
53
+ var newFiles = [];
54
+ var _iterator = _createForOfIteratorHelper(acceptedFiles),
55
+ _step;
56
+ try {
57
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
58
+ var _file$path, _file$path2, _harmonizedPath;
59
+ var file = _step.value;
60
+ var harmonizedPath = void 0;
61
+ // when a file is uploaded, the file path is prefixed with "./"
62
+ // when a folder is uploaded via drag and drop, the file paths are prefixed with "/"
63
+ // when a folder is uploaded via input field, the file paths don't have any prefix
64
+ if ((_file$path = file.path) !== null && _file$path !== void 0 && _file$path.startsWith("./") || (_file$path2 = file.path) !== null && _file$path2 !== void 0 && _file$path2.startsWith("/")) {
65
+ var _file$path3;
66
+ // if the path has a "./" or "/" prefix, this prefix is removed => path is harmonized
67
+ harmonizedPath = (_file$path3 = file.path) === null || _file$path3 === void 0 ? void 0 : _file$path3.split("/").splice(1).join("/");
68
+ } else {
69
+ harmonizedPath = file.path;
116
70
  }
117
- }, _callee, null, [[1, 6, 7, 8]]);
118
- }));
119
- return function addFolderPathToFiles(_x) {
120
- return _ref.apply(this, arguments);
121
- };
122
- }();
71
+
72
+ // Firefox doesn't set a MIME type for files from an uploaded folder. Dropzone only patches the `type` property
73
+ // in JS, so the request would still be sent with "application/octet-stream". Wrapping the file in a new File
74
+ // sets the actual type without reading the file into memory.
75
+ var newFile = new File([file], file.name, {
76
+ lastModified: file.lastModified,
77
+ type: file.type
78
+ });
79
+ newFile.path = file.path;
80
+ newFile.license = file.license;
81
+ newFile.title = file.title;
82
+ newFile.altText = file.altText;
83
+ newFile.importSource = file.importSource;
84
+ var folderPath = (_harmonizedPath = harmonizedPath) === null || _harmonizedPath === void 0 ? void 0 : _harmonizedPath.split("/").slice(0, -1).join("/");
85
+ newFile.folderPath = folderPath && (folderPath === null || folderPath === void 0 ? void 0 : folderPath.length) > 0 ? folderPath : undefined;
86
+ newFiles.push(newFile);
87
+ }
88
+ } catch (err) {
89
+ _iterator.e(err);
90
+ } finally {
91
+ _iterator.f();
92
+ }
93
+ return newFiles;
94
+ };
123
95
  var useDamFileUpload = exports.useDamFileUpload = function useDamFileUpload(options) {
124
96
  var _useCometConfig = (0, _CometConfigContext.useCometConfig)(),
125
97
  apiUrl = _useCometConfig.apiUrl;
@@ -207,13 +179,13 @@ var useDamFileUpload = exports.useDamFileUpload = function useDamFileUpload(opti
207
179
  }
208
180
  }, [accept, maxFileSizeInBytes]);
209
181
  var lookupDamFolder = (0, _react.useCallback)(/*#__PURE__*/function () {
210
- var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(folderName, parentId) {
182
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(folderName, parentId) {
211
183
  var _data$damFolder;
212
184
  var _yield$client$query, data;
213
- return _regenerator().w(function (_context2) {
214
- while (1) switch (_context2.n) {
185
+ return _regenerator().w(function (_context) {
186
+ while (1) switch (_context.n) {
215
187
  case 0:
216
- _context2.n = 1;
188
+ _context.n = 1;
217
189
  return client.query({
218
190
  query: _useDamFileUpload.damFolderByNameAndParentId,
219
191
  variables: {
@@ -224,23 +196,23 @@ var useDamFileUpload = exports.useDamFileUpload = function useDamFileUpload(opti
224
196
  fetchPolicy: "network-only"
225
197
  });
226
198
  case 1:
227
- _yield$client$query = _context2.v;
199
+ _yield$client$query = _context.v;
228
200
  data = _yield$client$query.data;
229
- return _context2.a(2, (_data$damFolder = data.damFolder) === null || _data$damFolder === void 0 ? void 0 : _data$damFolder.id);
201
+ return _context.a(2, (_data$damFolder = data.damFolder) === null || _data$damFolder === void 0 ? void 0 : _data$damFolder.id);
230
202
  }
231
- }, _callee2);
203
+ }, _callee);
232
204
  }));
233
- return function (_x2, _x3) {
234
- return _ref2.apply(this, arguments);
205
+ return function (_x, _x2) {
206
+ return _ref.apply(this, arguments);
235
207
  };
236
208
  }(), [client, scope]);
237
209
  var createDamFolder = (0, _react.useCallback)(/*#__PURE__*/function () {
238
- var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(folderName, parentId) {
210
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(folderName, parentId) {
239
211
  var _yield$client$mutate, data;
240
- return _regenerator().w(function (_context3) {
241
- while (1) switch (_context3.n) {
212
+ return _regenerator().w(function (_context2) {
213
+ while (1) switch (_context2.n) {
242
214
  case 0:
243
- _context3.n = 1;
215
+ _context2.n = 1;
244
216
  return client.mutate({
245
217
  mutation: _useDamFileUpload.createDamFolderForFolderUpload,
246
218
  variables: {
@@ -250,51 +222,51 @@ var useDamFileUpload = exports.useDamFileUpload = function useDamFileUpload(opti
250
222
  }
251
223
  });
252
224
  case 1:
253
- _yield$client$mutate = _context3.v;
225
+ _yield$client$mutate = _context2.v;
254
226
  data = _yield$client$mutate.data;
255
227
  if (data) {
256
- _context3.n = 2;
228
+ _context2.n = 2;
257
229
  break;
258
230
  }
259
231
  throw new Error("Could not create Folder");
260
232
  case 2:
261
- return _context3.a(2, data.createDamFolder.id);
233
+ return _context2.a(2, data.createDamFolder.id);
262
234
  }
263
- }, _callee3);
235
+ }, _callee2);
264
236
  }));
265
- return function (_x4, _x5) {
266
- return _ref3.apply(this, arguments);
237
+ return function (_x3, _x4) {
238
+ return _ref2.apply(this, arguments);
267
239
  };
268
240
  }(), [client, scope]);
269
241
  var createInitialFolderIdMap = (0, _react.useCallback)(/*#__PURE__*/function () {
270
- var _ref4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(files, currFolderId) {
271
- var folderIdMap, lookupCache, _iterator3, _step3, file, noLookup, pathArr, i, path, completePath, folderName, parentPath, parentId, id, _t2;
272
- return _regenerator().w(function (_context4) {
273
- while (1) switch (_context4.p = _context4.n) {
242
+ var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(files, currFolderId) {
243
+ var folderIdMap, lookupCache, _iterator3, _step3, file, noLookup, pathArr, i, path, completePath, folderName, parentPath, parentId, id, _t;
244
+ return _regenerator().w(function (_context3) {
245
+ while (1) switch (_context3.p = _context3.n) {
274
246
  case 0:
275
247
  folderIdMap = new Map();
276
248
  lookupCache = new Map();
277
249
  _iterator3 = _createForOfIteratorHelper(files);
278
- _context4.p = 1;
250
+ _context3.p = 1;
279
251
  _iterator3.s();
280
252
  case 2:
281
253
  if ((_step3 = _iterator3.n()).done) {
282
- _context4.n = 11;
254
+ _context3.n = 11;
283
255
  break;
284
256
  }
285
257
  file = _step3.value;
286
258
  noLookup = false;
287
259
  if (!(file.folderPath === undefined)) {
288
- _context4.n = 3;
260
+ _context3.n = 3;
289
261
  break;
290
262
  }
291
- return _context4.a(2, folderIdMap);
263
+ return _context3.a(2, folderIdMap);
292
264
  case 3:
293
265
  pathArr = file.folderPath.split("/");
294
266
  i = 1;
295
267
  case 4:
296
268
  if (!(i <= pathArr.length)) {
297
- _context4.n = 10;
269
+ _context3.n = 10;
298
270
  break;
299
271
  }
300
272
  path = pathArr.slice(0, i);
@@ -302,29 +274,29 @@ var useDamFileUpload = exports.useDamFileUpload = function useDamFileUpload(opti
302
274
  folderName = path[path.length - 1];
303
275
  parentPath = path.slice(0, -1).join("/");
304
276
  if (!folderIdMap.has(completePath)) {
305
- _context4.n = 5;
277
+ _context3.n = 5;
306
278
  break;
307
279
  }
308
- return _context4.a(3, 9);
280
+ return _context3.a(3, 9);
309
281
  case 5:
310
282
  parentId = folderIdMap.has(parentPath) ? folderIdMap.get(parentPath) : currFolderId;
311
283
  if (noLookup) {
312
- _context4.n = 9;
284
+ _context3.n = 9;
313
285
  break;
314
286
  }
315
287
  id = void 0;
316
288
  if (!lookupCache.has("".concat(folderName, ":").concat(parentId))) {
317
- _context4.n = 6;
289
+ _context3.n = 6;
318
290
  break;
319
291
  }
320
292
  id = lookupCache.get("".concat(folderName, ":").concat(parentId));
321
- _context4.n = 8;
293
+ _context3.n = 8;
322
294
  break;
323
295
  case 6:
324
- _context4.n = 7;
296
+ _context3.n = 7;
325
297
  return lookupDamFolder(folderName, parentId);
326
298
  case 7:
327
- id = _context4.v;
299
+ id = _context3.v;
328
300
  lookupCache.set("".concat(folderName, ":").concat(parentId), id);
329
301
  case 8:
330
302
  if (id === undefined) {
@@ -339,44 +311,44 @@ var useDamFileUpload = exports.useDamFileUpload = function useDamFileUpload(opti
339
311
  }
340
312
  case 9:
341
313
  i++;
342
- _context4.n = 4;
314
+ _context3.n = 4;
343
315
  break;
344
316
  case 10:
345
- _context4.n = 2;
317
+ _context3.n = 2;
346
318
  break;
347
319
  case 11:
348
- _context4.n = 13;
320
+ _context3.n = 13;
349
321
  break;
350
322
  case 12:
351
- _context4.p = 12;
352
- _t2 = _context4.v;
353
- _iterator3.e(_t2);
323
+ _context3.p = 12;
324
+ _t = _context3.v;
325
+ _iterator3.e(_t);
354
326
  case 13:
355
- _context4.p = 13;
327
+ _context3.p = 13;
356
328
  _iterator3.f();
357
- return _context4.f(13);
329
+ return _context3.f(13);
358
330
  case 14:
359
- return _context4.a(2, folderIdMap);
331
+ return _context3.a(2, folderIdMap);
360
332
  }
361
- }, _callee4, null, [[1, 12, 13, 14]]);
333
+ }, _callee3, null, [[1, 12, 13, 14]]);
362
334
  }));
363
- return function (_x6, _x7) {
364
- return _ref4.apply(this, arguments);
335
+ return function (_x5, _x6) {
336
+ return _ref3.apply(this, arguments);
365
337
  };
366
338
  }(), [lookupDamFolder]);
367
339
  var createFoldersIfNecessary = (0, _react.useCallback)(/*#__PURE__*/function () {
368
- var _ref5 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(externalFolderIdMap, file, currFolderId) {
340
+ var _ref4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(externalFolderIdMap, file, currFolderId) {
369
341
  var newlyCreatedFolderIds, folderIdMap, pathArr, i, path, completePath, folderName, parentPath, parentId, id;
370
- return _regenerator().w(function (_context5) {
371
- while (1) switch (_context5.n) {
342
+ return _regenerator().w(function (_context4) {
343
+ while (1) switch (_context4.n) {
372
344
  case 0:
373
345
  newlyCreatedFolderIds = [];
374
346
  folderIdMap = new Map(externalFolderIdMap);
375
347
  if (!(file.folderPath === undefined)) {
376
- _context5.n = 1;
348
+ _context4.n = 1;
377
349
  break;
378
350
  }
379
- return _context5.a(2, {
351
+ return _context4.a(2, {
380
352
  folderIdMap: folderIdMap,
381
353
  newlyCreatedFolderIds: newlyCreatedFolderIds
382
354
  });
@@ -385,7 +357,7 @@ var useDamFileUpload = exports.useDamFileUpload = function useDamFileUpload(opti
385
357
  i = 1;
386
358
  case 2:
387
359
  if (!(i <= pathArr.length)) {
388
- _context5.n = 6;
360
+ _context4.n = 6;
389
361
  break;
390
362
  }
391
363
  path = pathArr.slice(0, i);
@@ -393,16 +365,16 @@ var useDamFileUpload = exports.useDamFileUpload = function useDamFileUpload(opti
393
365
  folderName = path[path.length - 1];
394
366
  parentPath = path.slice(0, -1).join("/");
395
367
  if (!folderIdMap.has(completePath)) {
396
- _context5.n = 3;
368
+ _context4.n = 3;
397
369
  break;
398
370
  }
399
- return _context5.a(3, 5);
371
+ return _context4.a(3, 5);
400
372
  case 3:
401
373
  parentId = folderIdMap.has(parentPath) ? folderIdMap.get(parentPath) : currFolderId;
402
- _context5.n = 4;
374
+ _context4.n = 4;
403
375
  return createDamFolder(folderName, parentId);
404
376
  case 4:
405
- id = _context5.v;
377
+ id = _context4.v;
406
378
  newlyCreatedFolderIds.push({
407
379
  id: id,
408
380
  parentId: parentId
@@ -410,18 +382,18 @@ var useDamFileUpload = exports.useDamFileUpload = function useDamFileUpload(opti
410
382
  folderIdMap.set(completePath, id);
411
383
  case 5:
412
384
  i++;
413
- _context5.n = 2;
385
+ _context4.n = 2;
414
386
  break;
415
387
  case 6:
416
- return _context5.a(2, {
388
+ return _context4.a(2, {
417
389
  folderIdMap: folderIdMap,
418
390
  newlyCreatedFolderIds: newlyCreatedFolderIds
419
391
  });
420
392
  }
421
- }, _callee5);
393
+ }, _callee4);
422
394
  }));
423
- return function (_x8, _x9, _x0) {
424
- return _ref5.apply(this, arguments);
395
+ return function (_x7, _x8, _x9) {
396
+ return _ref4.apply(this, arguments);
425
397
  };
426
398
  }(), [createDamFolder]);
427
399
  var mapFilenameDataToFiles = function mapFilenameDataToFiles(filenameDataList, files, currentFolderId, folderIdMap) {
@@ -434,16 +406,16 @@ var useDamFileUpload = exports.useDamFileUpload = function useDamFileUpload(opti
434
406
  return filesToUpload;
435
407
  };
436
408
  var handleDuplicatedFilenames = (0, _react.useCallback)(/*#__PURE__*/function () {
437
- var _ref6 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(filesWithFolderPaths, currentFolderId, folderIdMap) {
409
+ var _ref5 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(filesWithFolderPaths, currentFolderId, folderIdMap) {
438
410
  var filesInNewDir, filesInExistingDir, _iterator4, _step4, file, userSelection, filesToUpload;
439
- return _regenerator().w(function (_context6) {
440
- while (1) switch (_context6.n) {
411
+ return _regenerator().w(function (_context5) {
412
+ while (1) switch (_context5.n) {
441
413
  case 0:
442
414
  if (!(manualDuplicatedFilenamesHandler === undefined)) {
443
- _context6.n = 1;
415
+ _context5.n = 1;
444
416
  break;
445
417
  }
446
- return _context6.a(2, {
418
+ return _context5.a(2, {
447
419
  filesToUpload: filesWithFolderPaths,
448
420
  duplicateAction: "skip"
449
421
  });
@@ -470,7 +442,7 @@ var useDamFileUpload = exports.useDamFileUpload = function useDamFileUpload(opti
470
442
  } finally {
471
443
  _iterator4.f();
472
444
  }
473
- _context6.n = 2;
445
+ _context5.n = 2;
474
446
  return manualDuplicatedFilenamesHandler === null || manualDuplicatedFilenamesHandler === void 0 ? void 0 : manualDuplicatedFilenamesHandler.letUserHandleDuplicates(filesInExistingDir.map(function (file) {
475
447
  return {
476
448
  name: file.name,
@@ -478,28 +450,28 @@ var useDamFileUpload = exports.useDamFileUpload = function useDamFileUpload(opti
478
450
  };
479
451
  }));
480
452
  case 2:
481
- userSelection = _context6.v;
453
+ userSelection = _context5.v;
482
454
  filesToUpload = mapFilenameDataToFiles(userSelection.filenames, filesWithFolderPaths, currentFolderId, folderIdMap);
483
455
  filesToUpload.push.apply(filesToUpload, filesInNewDir);
484
- return _context6.a(2, {
456
+ return _context5.a(2, {
485
457
  filesToUpload: filesToUpload,
486
458
  duplicateAction: userSelection.duplicateAction
487
459
  });
488
460
  }
489
- }, _callee6);
461
+ }, _callee5);
490
462
  }));
491
- return function (_x1, _x10, _x11) {
492
- return _ref6.apply(this, arguments);
463
+ return function (_x0, _x1, _x10) {
464
+ return _ref5.apply(this, arguments);
493
465
  };
494
466
  }(), [manualDuplicatedFilenamesHandler]);
495
467
  var uploadFiles = /*#__PURE__*/function () {
496
- var _ref9 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(_ref7, _ref8) {
497
- var acceptedFiles, fileRejections, folderId, importSource, uploadedFolders, uploadedFiles, rejectedFiles, errorOccurred, filesWithFolderPaths, folderIdMap, fileSizes, _iterator5, _step5, _file$path4, file, _yield$handleDuplicat, filesToUpload, duplicateAction, _iterator6, _step6, _loop, tooLargeVideoCount, _t5;
498
- return _regenerator().w(function (_context8) {
499
- while (1) switch (_context8.p = _context8.n) {
468
+ var _ref8 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(_ref6, _ref7) {
469
+ var acceptedFiles, fileRejections, folderId, importSource, uploadedFolders, uploadedFiles, rejectedFiles, errorOccurred, filesWithFolderPaths, folderIdMap, fileSizes, _iterator5, _step5, _file$path4, file, _yield$handleDuplicat, filesToUpload, duplicateAction, _iterator6, _step6, _loop, tooLargeVideoCount, _t4;
470
+ return _regenerator().w(function (_context7) {
471
+ while (1) switch (_context7.p = _context7.n) {
500
472
  case 0:
501
- acceptedFiles = _ref7.acceptedFiles, fileRejections = _ref7.fileRejections;
502
- folderId = _ref8.folderId, importSource = _ref8.importSource;
473
+ acceptedFiles = _ref6.acceptedFiles, fileRejections = _ref6.fileRejections;
474
+ folderId = _ref7.folderId, importSource = _ref7.importSource;
503
475
  setProgressDialogOpen(true);
504
476
  setValidationErrors(undefined);
505
477
  uploadedFolders = [];
@@ -509,24 +481,21 @@ var useDamFileUpload = exports.useDamFileUpload = function useDamFileUpload(opti
509
481
  if (fileRejections.length > 0) {
510
482
  errorOccurred = true;
511
483
  generateValidationErrorsForRejectedFiles(fileRejections);
512
- rejectedFiles.push.apply(rejectedFiles, _toConsumableArray(fileRejections.map(function (_ref0) {
513
- var errors = _ref0.errors,
514
- rejection = _objectWithoutProperties(_ref0, _excluded);
484
+ rejectedFiles.push.apply(rejectedFiles, _toConsumableArray(fileRejections.map(function (_ref9) {
485
+ var errors = _ref9.errors,
486
+ rejection = _objectWithoutProperties(_ref9, _excluded);
515
487
  return rejection;
516
488
  })));
517
489
  }
518
490
  if (!(acceptedFiles.length > 0)) {
519
- _context8.n = 12;
491
+ _context7.n = 11;
520
492
  break;
521
493
  }
522
- _context8.n = 1;
523
- return addFolderPathToFiles(acceptedFiles);
524
- case 1:
525
- filesWithFolderPaths = _context8.v;
526
- _context8.n = 2;
494
+ filesWithFolderPaths = addFolderPathToFiles(acceptedFiles);
495
+ _context7.n = 1;
527
496
  return createInitialFolderIdMap(filesWithFolderPaths, folderId);
528
- case 2:
529
- folderIdMap = _context8.v;
497
+ case 1:
498
+ folderIdMap = _context7.v;
530
499
  fileSizes = {};
531
500
  _iterator5 = _createForOfIteratorHelper(filesWithFolderPaths);
532
501
  try {
@@ -540,24 +509,24 @@ var useDamFileUpload = exports.useDamFileUpload = function useDamFileUpload(opti
540
509
  _iterator5.f();
541
510
  }
542
511
  setTotalSizes(fileSizes);
543
- _context8.n = 3;
512
+ _context7.n = 2;
544
513
  return handleDuplicatedFilenames(filesWithFolderPaths, folderId, folderIdMap);
545
- case 3:
546
- _yield$handleDuplicat = _context8.v;
514
+ case 2:
515
+ _yield$handleDuplicat = _context7.v;
547
516
  filesToUpload = _yield$handleDuplicat.filesToUpload;
548
517
  duplicateAction = _yield$handleDuplicat.duplicateAction;
549
518
  _iterator6 = _createForOfIteratorHelper(filesToUpload);
550
- _context8.p = 4;
519
+ _context7.p = 3;
551
520
  _loop = /*#__PURE__*/_regenerator().m(function _loop() {
552
- var file, _yield$createFoldersI, newFolderIdMap, newlyCreatedFolderIds, targetFolderId, uploadConfig, onUploadProgress, uploadParams, uploadResult, response, _err$response, _err$response2, message, extension, _t3, _t4;
553
- return _regenerator().w(function (_context7) {
554
- while (1) switch (_context7.p = _context7.n) {
521
+ var file, _yield$createFoldersI, newFolderIdMap, newlyCreatedFolderIds, targetFolderId, uploadConfig, onUploadProgress, uploadParams, uploadResult, response, _err$response, _err$response2, message, extension, _t2, _t3;
522
+ return _regenerator().w(function (_context6) {
523
+ while (1) switch (_context6.p = _context6.n) {
555
524
  case 0:
556
525
  file = _step6.value;
557
- _context7.n = 1;
526
+ _context6.n = 1;
558
527
  return createFoldersIfNecessary(folderIdMap, file, folderId);
559
528
  case 1:
560
- _yield$createFoldersI = _context7.v;
529
+ _yield$createFoldersI = _context6.v;
561
530
  newFolderIdMap = _yield$createFoldersI.folderIdMap;
562
531
  newlyCreatedFolderIds = _yield$createFoldersI.newlyCreatedFolderIds;
563
532
  folderIdMap = newFolderIdMap;
@@ -569,7 +538,7 @@ var useDamFileUpload = exports.useDamFileUpload = function useDamFileUpload(opti
569
538
  };
570
539
  })));
571
540
  targetFolderId = file.folderPath && folderIdMap.has(file.folderPath) ? folderIdMap.get(file.folderPath) : folderId;
572
- _context7.p = 2;
541
+ _context6.p = 2;
573
542
  uploadConfig = {
574
543
  file: file,
575
544
  folderId: targetFolderId,
@@ -590,44 +559,44 @@ var useDamFileUpload = exports.useDamFileUpload = function useDamFileUpload(opti
590
559
  damBasePath: damBasePath
591
560
  };
592
561
  if (!(duplicateAction === "replace")) {
593
- _context7.n = 4;
562
+ _context6.n = 4;
594
563
  break;
595
564
  }
596
- _context7.n = 3;
565
+ _context6.n = 3;
597
566
  return (0, _upload.replaceByFilenameAndFolder)(uploadParams);
598
567
  case 3:
599
- _t3 = _context7.v;
600
- _context7.n = 6;
568
+ _t2 = _context6.v;
569
+ _context6.n = 6;
601
570
  break;
602
571
  case 4:
603
- _context7.n = 5;
572
+ _context6.n = 5;
604
573
  return (0, _upload.upload)(uploadParams);
605
574
  case 5:
606
- _t3 = _context7.v;
575
+ _t2 = _context6.v;
607
576
  case 6:
608
- uploadResult = _t3;
609
- _context7.n = 7;
577
+ uploadResult = _t2;
578
+ _context6.n = 7;
610
579
  return uploadResult;
611
580
  case 7:
612
- response = _context7.v;
581
+ response = _context6.v;
613
582
  uploadedFiles.push({
614
583
  id: response.data.id,
615
584
  parentId: targetFolderId,
616
585
  type: "file",
617
586
  file: file
618
587
  });
619
- _context7.n = 9;
588
+ _context6.n = 9;
620
589
  break;
621
590
  case 8:
622
- _context7.p = 8;
623
- _t4 = _context7.v;
591
+ _context6.p = 8;
592
+ _t3 = _context6.v;
624
593
  errorOccurred = true;
625
- if (hasObjectErrorData(_t4) && ((_err$response = _t4.response) === null || _err$response === void 0 ? void 0 : _err$response.data.error) === "CometImageResolutionException") {
594
+ if (hasObjectErrorData(_t3) && ((_err$response = _t3.response) === null || _err$response === void 0 ? void 0 : _err$response.data.error) === "CometImageResolutionException") {
626
595
  addValidationError(file, /*#__PURE__*/(0, _jsxRuntime.jsx)(_fileUploadErrorMessages.MaxResolutionError, {
627
596
  maxResolution: damConfig.maxSrcResolution
628
597
  }));
629
- } else if (hasObjectErrorData(_t4) && ((_err$response2 = _t4.response) === null || _err$response2 === void 0 ? void 0 : _err$response2.data.error) === "CometValidationException") {
630
- message = _t4.response.data.message;
598
+ } else if (hasObjectErrorData(_t3) && ((_err$response2 = _t3.response) === null || _err$response2 === void 0 ? void 0 : _err$response2.data.error) === "CometValidationException") {
599
+ message = _t3.response.data.message;
631
600
  extension = ".".concat(file.name.split(".").pop());
632
601
  if (message.includes("Unsupported mime type")) {
633
602
  addValidationError(file, /*#__PURE__*/(0, _jsxRuntime.jsx)(_fileUploadErrorMessages.UnsupportedTypeError, {
@@ -645,9 +614,9 @@ var useDamFileUpload = exports.useDamFileUpload = function useDamFileUpload(opti
645
614
  } else {
646
615
  addValidationError(file, /*#__PURE__*/(0, _jsxRuntime.jsx)(_errorMessages.UnknownError, {}));
647
616
  }
648
- } else if (hasStringErrorData(_t4) && _t4.response.data.includes("SVG contains forbidden content")) {
617
+ } else if (hasStringErrorData(_t3) && _t3.response.data.includes("SVG contains forbidden content")) {
649
618
  addValidationError(file, /*#__PURE__*/(0, _jsxRuntime.jsx)(_fileUploadErrorMessages.SvgContainsJavaScriptError, {}));
650
- } else if (hasRequestData(_t4)) {
619
+ } else if (hasRequestData(_t3)) {
651
620
  addValidationError(file, /*#__PURE__*/(0, _jsxRuntime.jsx)(_errorMessages.NetworkError, {}));
652
621
  } else {
653
622
  addValidationError(file, /*#__PURE__*/(0, _jsxRuntime.jsx)(_errorMessages.UnknownError, {}));
@@ -656,37 +625,37 @@ var useDamFileUpload = exports.useDamFileUpload = function useDamFileUpload(opti
656
625
  file: file
657
626
  });
658
627
  case 9:
659
- return _context7.a(2);
628
+ return _context6.a(2);
660
629
  }
661
630
  }, _loop, null, [[2, 8]]);
662
631
  });
663
632
  _iterator6.s();
664
- case 5:
633
+ case 4:
665
634
  if ((_step6 = _iterator6.n()).done) {
666
- _context8.n = 7;
635
+ _context7.n = 6;
667
636
  break;
668
637
  }
669
- return _context8.d(_regeneratorValues(_loop()), 6);
638
+ return _context7.d(_regeneratorValues(_loop()), 5);
639
+ case 5:
640
+ _context7.n = 4;
641
+ break;
670
642
  case 6:
671
- _context8.n = 5;
643
+ _context7.n = 8;
672
644
  break;
673
645
  case 7:
674
- _context8.n = 9;
675
- break;
646
+ _context7.p = 7;
647
+ _t4 = _context7.v;
648
+ _iterator6.e(_t4);
676
649
  case 8:
677
- _context8.p = 8;
678
- _t5 = _context8.v;
679
- _iterator6.e(_t5);
680
- case 9:
681
- _context8.p = 9;
650
+ _context7.p = 8;
682
651
  _iterator6.f();
683
- return _context8.f(9);
684
- case 10:
685
- _context8.n = 11;
652
+ return _context7.f(8);
653
+ case 9:
654
+ _context7.n = 10;
686
655
  return client.reFetchObservableQueries();
687
- case 11:
656
+ case 10:
688
657
  (0, _clearDamItemCache.clearDamItemCache)(client.cache);
689
- case 12:
658
+ case 11:
690
659
  setProgressDialogOpen(false);
691
660
  if (errorOccurred) {
692
661
  setErrorDialogOpen(true);
@@ -694,8 +663,8 @@ var useDamFileUpload = exports.useDamFileUpload = function useDamFileUpload(opti
694
663
  setTotalSizes({});
695
664
  setUploadedSizes({});
696
665
  addNewlyUploadedItems([].concat(uploadedFolders, uploadedFiles));
697
- tooLargeVideoCount = uploadedFiles.filter(function (_ref1) {
698
- var file = _ref1.file;
666
+ tooLargeVideoCount = uploadedFiles.filter(function (_ref0) {
667
+ var file = _ref0.file;
699
668
  return file !== undefined && isVideoTooLarge({
700
669
  mimetype: file.type,
701
670
  size: file.size
@@ -716,16 +685,16 @@ var useDamFileUpload = exports.useDamFileUpload = function useDamFileUpload(opti
716
685
  })
717
686
  }));
718
687
  }
719
- return _context8.a(2, {
688
+ return _context7.a(2, {
720
689
  hasError: errorOccurred,
721
690
  rejectedFiles: rejectedFiles,
722
691
  uploadedItems: [].concat(uploadedFolders, uploadedFiles)
723
692
  });
724
693
  }
725
- }, _callee7, null, [[4, 8, 9, 10]]);
694
+ }, _callee6, null, [[3, 7, 8, 9]]);
726
695
  }));
727
- return function uploadFiles(_x12, _x13) {
728
- return _ref9.apply(this, arguments);
696
+ return function uploadFiles(_x11, _x12) {
697
+ return _ref8.apply(this, arguments);
729
698
  };
730
699
  }();
731
700
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@comet/cms-admin",
3
- "version": "8.32.1",
3
+ "version": "8.32.2",
4
4
  "description": "Comet CMS Admin package",
5
5
  "repository": {
6
6
  "directory": "packages/admin/cms-admin",
@@ -42,10 +42,10 @@
42
42
  "use-debounce": "^10.0.6",
43
43
  "uuid": "^11.1.0",
44
44
  "zod": "^3.23.8",
45
- "@comet/admin": "8.32.1",
46
- "@comet/admin-date-time": "8.32.1",
47
- "@comet/admin-icons": "8.32.1",
48
- "@comet/admin-rte": "8.32.1"
45
+ "@comet/admin": "8.32.2",
46
+ "@comet/admin-date-time": "8.32.2",
47
+ "@comet/admin-icons": "8.32.2",
48
+ "@comet/admin-rte": "8.32.2"
49
49
  },
50
50
  "devDependencies": {
51
51
  "@apollo/client": "^3.14.0",
@@ -100,9 +100,9 @@
100
100
  "typescript": "5.9.3",
101
101
  "vite-tsconfig-paths": "^6.0.3",
102
102
  "vitest": "^4.0.16",
103
- "@comet/admin-babel-preset": "8.32.1",
104
- "@comet/cli": "8.32.1",
105
- "@comet/eslint-config": "8.32.1"
103
+ "@comet/admin-babel-preset": "8.32.2",
104
+ "@comet/cli": "8.32.2",
105
+ "@comet/eslint-config": "8.32.2"
106
106
  },
107
107
  "peerDependencies": {
108
108
  "@apollo/client": "^3.7.0",