@crystaldesign/diva-backoffice 25.16.1-rc.2 → 25.16.1-rc.4

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.
@@ -16274,7 +16274,7 @@ var DownloadStore = /*#__PURE__*/function () {
16274
16274
  value: function () {
16275
16275
  var _downloadRequest = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5(download, data) {
16276
16276
  var _this$_rootStore3;
16277
- var url, result, contentType, contentDisposition, fileName, fileNameMatch, extension, blob, base64File, a, mimeType, res;
16277
+ var url, result, contentDisposition, fileName, fileNameMatch, lastDotIndex, potentialExtension, hasValidExtension, extension, blob, base64File, a, mimeType, res;
16278
16278
  return _regeneratorRuntime.wrap(function _callee5$(_context6) {
16279
16279
  while (1) switch (_context6.prev = _context6.next) {
16280
16280
  case 0:
@@ -16303,7 +16303,6 @@ var DownloadStore = /*#__PURE__*/function () {
16303
16303
  LOG$e.error(new DivaError("Download request failed: ".concat(result.status, " ").concat(result.statusText)));
16304
16304
  throw new Error("Download failed: ".concat(result.status, " ").concat(result.statusText));
16305
16305
  case 7:
16306
- contentType = result.headers.get('Content-Type');
16307
16306
  contentDisposition = result.headers.get('Content-Disposition');
16308
16307
  fileName = 'download'; // Use fileName from data if available
16309
16308
  if (data !== null && data !== void 0 && data['fileName']) {
@@ -16318,42 +16317,45 @@ var DownloadStore = /*#__PURE__*/function () {
16318
16317
  }
16319
16318
  }
16320
16319
 
16321
- // If filename has no extension, derive it from contentType
16322
- if (fileName && !fileName.includes('.') && contentType) {
16323
- extension = this.getExtensionFromMimeType(contentType);
16320
+ // Get the part after the last dot
16321
+ lastDotIndex = fileName.lastIndexOf('.');
16322
+ potentialExtension = lastDotIndex > -1 ? fileName.substring(lastDotIndex + 1).toLowerCase() : ''; // Check if it looks like a valid extension (2-5 chars, alphabetic only)
16323
+ hasValidExtension = /^[a-z]{2,5}$/.test(potentialExtension); // If filename has no extension, derive it from contentType
16324
+ if (fileName && !hasValidExtension) {
16325
+ extension = data === null || data === void 0 ? void 0 : data['fileFormat'];
16324
16326
  if (extension) {
16325
- fileName = "".concat(fileName, ".").concat(extension);
16327
+ fileName = "".concat(fileName, ".").concat(extension); // Add the extension
16326
16328
  }
16327
16329
  }
16328
16330
  _context6.t0 = download.mediaType;
16329
- _context6.next = _context6.t0 === 'file' ? 16 : _context6.t0 === 'base64' ? 21 : _context6.t0 === 'json' ? 30 : 35;
16331
+ _context6.next = _context6.t0 === 'file' ? 18 : _context6.t0 === 'base64' ? 23 : _context6.t0 === 'json' ? 32 : 37;
16330
16332
  break;
16331
- case 16:
16332
- _context6.next = 18;
16333
- return result.blob();
16334
16333
  case 18:
16334
+ _context6.next = 20;
16335
+ return result.blob();
16336
+ case 20:
16335
16337
  blob = _context6.sent;
16336
16338
  DownloadStore.downloadBlob(blob, fileName);
16337
- return _context6.abrupt("break", 35);
16338
- case 21:
16339
- _context6.next = 23;
16340
- return result.json();
16339
+ return _context6.abrupt("break", 37);
16341
16340
  case 23:
16341
+ _context6.next = 25;
16342
+ return result.json();
16343
+ case 25:
16342
16344
  base64File = _context6.sent;
16343
16345
  a = document.createElement('a'); //Create <a>
16344
16346
  mimeType = (data === null || data === void 0 ? void 0 : data['fileFormat']) == 'glb' ? 'model/gltf-binary' : (data === null || data === void 0 ? void 0 : data['fileFormat']) == 'jpg' ? 'image/jpeg' : 'image/png';
16345
16347
  a.href = 'data:' + mimeType + ';base64,' + base64File; //Image Base64 Goes here
16346
- a.download = (data === null || data === void 0 ? void 0 : data['fileName']) + '.' + (data === null || data === void 0 ? void 0 : data['fileFormat']); //File name Here
16348
+ a.download = fileName;
16347
16349
  a.click();
16348
- return _context6.abrupt("break", 35);
16349
- case 30:
16350
- _context6.next = 32;
16351
- return result.json();
16350
+ return _context6.abrupt("break", 37);
16352
16351
  case 32:
16352
+ _context6.next = 34;
16353
+ return result.json();
16354
+ case 34:
16353
16355
  res = _context6.sent;
16354
16356
  DownloadStore.downloadText('hqRenderScript_' + (data === null || data === void 0 ? void 0 : data['fileName']) + '.json', JSON.stringify(res), 'application/json');
16355
- return _context6.abrupt("break", 35);
16356
- case 35:
16357
+ return _context6.abrupt("break", 37);
16358
+ case 37:
16357
16359
  case "end":
16358
16360
  return _context6.stop();
16359
16361
  }
@@ -16373,35 +16375,6 @@ var DownloadStore = /*#__PURE__*/function () {
16373
16375
  return false;
16374
16376
  }
16375
16377
  }
16376
- }, {
16377
- key: "getExtensionFromMimeType",
16378
- value: function getExtensionFromMimeType(mimeType) {
16379
- var mimeToExt = {
16380
- 'application/pdf': 'pdf',
16381
- 'application/json': 'json',
16382
- 'application/xml': 'xml',
16383
- 'application/zip': 'zip',
16384
- 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet': 'xlsx',
16385
- 'application/vnd.ms-excel': 'xls',
16386
- 'application/vnd.openxmlformats-officedocument.wordprocessingml.document': 'docx',
16387
- 'application/msword': 'doc',
16388
- 'text/plain': 'txt',
16389
- 'text/csv': 'csv',
16390
- 'text/html': 'html',
16391
- 'image/png': 'png',
16392
- 'image/jpeg': 'jpg',
16393
- 'image/gif': 'gif',
16394
- 'image/webp': 'webp',
16395
- 'image/tiff': 'tiff',
16396
- 'image/svg+xml': 'svg',
16397
- 'model/gltf-binary': 'glb',
16398
- 'model/gltf+json': 'gltf'
16399
- };
16400
-
16401
- // Handle mimeType with charset or other parameters (e.g., "text/plain; charset=utf-8")
16402
- var baseMimeType = mimeType.split(';')[0].trim().toLowerCase();
16403
- return mimeToExt[baseMimeType] || null;
16404
- }
16405
16378
  }, {
16406
16379
  key: "openDownload",
16407
16380
  value: function () {
@@ -27684,6 +27657,10 @@ var TableWrapper = function TableWrapper(_ref) {
27684
27657
  message.error(t('backoffice.download.allFailed', {
27685
27658
  failed: result.failed
27686
27659
  }));
27660
+ } else if (result.success > 0) {
27661
+ message.success(t('backoffice.download.success', {
27662
+ success: result.success
27663
+ }));
27687
27664
  }
27688
27665
  _context.next = 12;
27689
27666
  break;
@@ -21,7 +21,6 @@ export default class DownloadStore {
21
21
  }>;
22
22
  downloadRequest(download: downloadRequest, data: any): Promise<void>;
23
23
  checkCondition(download: downloadPrefab | downloadRequest | downloadField | downloadUrl, data: any): boolean;
24
- private getExtensionFromMimeType;
25
24
  executeDownload: ({ data, action, catalogCodex, dealerId, currentUrl, sessionGuid }: DownloadProps) => Promise<void>;
26
25
  openDownload(props: DownloadProps): Promise<{
27
26
  success: number;
@@ -1 +1 @@
1
- {"version":3,"file":"DownloadStore.d.ts","sourceRoot":"","sources":["../../../../../src/store/DownloadStore.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,eAAe,EAAE,aAAa,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACpH,OAAO,SAAS,MAAM,aAAa,CAAC;AAKpC,UAAU,aAAa;IACrB,IAAI,EAAE,GAAG,CAAC;IACV,MAAM,EAAE,QAAQ,GAAG,SAAS,CAAC;IAC7B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,CAAC,OAAO,OAAO,aAAa;IACpB,OAAO,CAAC,UAAU;gBAAV,UAAU,EAAE,SAAS;IASzC,MAAM,CAAC,YAAY,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM;IAmB5C,MAAM,CAAC,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,GAAE,MAAqB;IAKzE,YAAY,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE,MAAM;IAapC,cAAc,CAAC,QAAQ,EAAE,cAAc,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MA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AI,EAAE,MAAM,EAAE,IAAI,GAAE,MAAqB;IAKzE,YAAY,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE,MAAM;IAapC,cAAc,CAAC,QAAQ,EAAE,cAAc,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM;IAiCzG,iBAAiB,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,GAAG,UAAU;;;;IA2B1D,eAAe,CAAC,QAAQ,EAAE,eAAe,EAAE,IAAI,EAAE,GAAG;IAwE1D,cAAc,CAAC,QAAQ,EAAE,cAAc,GAAG,eAAe,GAAG,aAAa,GAAG,WAAW,EAAE,IAAI,EAAE,GAAG;IAWlG,eAAe,sEAA6E,aAAa,KAAG,OAAO,CAAC,IAAI,CAAC,CAoDvH;IAEI,YAAY,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IAgDtF,SAAS,CAAC,MAAM,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM;CAOzC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/ui/Table/BaseTable/index.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAuC,MAAM,OAAO,CAAC;AAK5D,OAAO,EAAE,KAAK,EAAwB,MAAM,UAAU,CAAC;AA8BvD,eAAO,MAAM,UAAU,yCAAoB,CAAC;AAG5C,UAAU,KAAK,CAAC,CAAC;IACf,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;CACjB;0BAEqB,CAAC,SAAS,MAAM,aAAa,KAAK,CAAC,CAAC,CAAC;;;AA2W3D,wBAAsC;AACtC,cAAc,UAAU,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/ui/Table/BaseTable/index.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAuC,MAAM,OAAO,CAAC;AAK5D,OAAO,EAAE,KAAK,EAAwB,MAAM,UAAU,CAAC;AA8BvD,eAAO,MAAM,UAAU,yCAAoB,CAAC;AAG5C,UAAU,KAAK,CAAC,CAAC;IACf,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;CACjB;0BAEqB,CAAC,SAAS,MAAM,aAAa,KAAK,CAAC,CAAC,CAAC;;;AAiX3D,wBAAsC;AACtC,cAAc,UAAU,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crystaldesign/diva-backoffice",
3
- "version": "25.16.1-rc.2",
3
+ "version": "25.16.1-rc.4",
4
4
  "license": "COMMERCIAL",
5
5
  "devDependencies": {
6
6
  "@testing-library/jest-dom": "^6.5.0",
@@ -15,13 +15,13 @@
15
15
  "dependencies": {
16
16
  "@ant-design/icons": "5.4.0",
17
17
  "@babel/runtime": "7.24.7",
18
- "@crystaldesign/content-box": "25.16.1-rc.2",
19
- "@crystaldesign/content-item": "25.16.1-rc.2",
20
- "@crystaldesign/diva-core": "25.16.1-rc.2",
21
- "@crystaldesign/diva-utils": "25.16.1-rc.2",
22
- "@crystaldesign/media-upload": "25.16.1-rc.2",
23
- "@crystaldesign/rtf-editor": "25.16.1-rc.2",
24
- "@crystaldesign/spreadsheet": "25.16.1-rc.2",
18
+ "@crystaldesign/content-box": "25.16.1-rc.4",
19
+ "@crystaldesign/content-item": "25.16.1-rc.4",
20
+ "@crystaldesign/diva-core": "25.16.1-rc.4",
21
+ "@crystaldesign/diva-utils": "25.16.1-rc.4",
22
+ "@crystaldesign/media-upload": "25.16.1-rc.4",
23
+ "@crystaldesign/rtf-editor": "25.16.1-rc.4",
24
+ "@crystaldesign/spreadsheet": "25.16.1-rc.4",
25
25
  "@google/model-viewer": "3.5.0",
26
26
  "ag-charts-community": "^10.1.0",
27
27
  "ag-charts-react": "^10.1.0",
@@ -51,5 +51,5 @@
51
51
  },
52
52
  "module": "build/esm/index.js",
53
53
  "types": "./build/types/backoffice/src/index.d.ts",
54
- "gitHead": "647a0673151d60ffc8f509e34ee5450b872e2170"
54
+ "gitHead": "d2df5756cd461c7448b38c42ea558a9f901cc37f"
55
55
  }