@nkhang1902/strapi-plugin-export-import-clsx 1.4.4 → 1.4.6

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.
@@ -60,6 +60,7 @@ const ExportButtonsEditView = (props) => {
60
60
  const queryParams = new URLSearchParams({
61
61
  format: "excel",
62
62
  contentType: contentType,
63
+ mode: "participant",
63
64
  });
64
65
 
65
66
  // Add event filter if we're in event manager
@@ -70,7 +71,7 @@ const ExportButtonsEditView = (props) => {
70
71
  );
71
72
  }
72
73
 
73
- const response = await fetch(`/export-import-clsx/export?${queryParams}&mode=participant`);
74
+ const response = await fetch(`/export-import-clsx/export?${queryParams}`);
74
75
 
75
76
  if (response.ok) {
76
77
  const blob = await response.blob();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nkhang1902/strapi-plugin-export-import-clsx",
3
- "version": "1.4.4",
3
+ "version": "1.4.6",
4
4
  "description": "A powerful Strapi plugin for exporting and importing data with Excel support and advanced filtering",
5
5
  "main": "./strapi-server.js",
6
6
  "scripts": {
@@ -2,6 +2,7 @@ module.exports = ({ strapi }) => ({
2
2
  async export(ctx) {
3
3
  try {
4
4
  const { format = "excel", contentType, mode, ...filters } = ctx.query;
5
+ console.log(ctx.query)
5
6
  const exportService = strapi
6
7
  .plugin("export-import-clsx")
7
8
  .service("export-service");
@@ -1,7 +1,7 @@
1
1
  const XLSX = require("xlsx");
2
2
 
3
3
  module.exports = ({ strapi }) => ({
4
- async exportData(format = "json", contentType = null, rawFilters = {}, mode) {
4
+ async exportData(format = "json", contentType = null, rawFilters = {}, mode = '') {
5
5
  // Normalize content type - handle both content-manager and event-manager formats
6
6
  if (contentType && !contentType.startsWith("api::")) {
7
7
  // If it's already in api:: format from event-manager, use as is
@@ -398,18 +398,16 @@ module.exports = ({ strapi }) => ({
398
398
  convertExperienceParticipantsToExcel(experienceData) {
399
399
  const workbook = XLSX.utils.book_new();
400
400
 
401
- const corporates = experienceData?.corporates ?? [];
402
- const investors = experienceData?.investors ?? [];
403
- const vipGuests = experienceData?.vipGuests ?? [];
404
-
401
+ const tag = (list, type) =>
402
+ (list ?? []).map(item => ({ ...item, type }));
405
403
  const participants = [
406
- ...corporates,
407
- ...investors,
408
- ...vipGuests,
404
+ ...tag(experienceData?.corporates, 'corporate'),
405
+ ...tag(experienceData?.investors, 'investor'),
406
+ ...tag(experienceData?.vipGuests, 'vip'),
409
407
  ];
410
- console.log(participants)
411
408
 
412
409
  const data = participants.map((p) => ({
410
+ type: p.type,
413
411
  corporateName: p.corporateName ?? '',
414
412
  tickerCode: p.tickerCode ?? '',
415
413
  fullName:
@@ -422,6 +420,7 @@ module.exports = ({ strapi }) => ({
422
420
  mobile: p.mobile ?? '',
423
421
  }));
424
422
 
423
+ console.log(data)
425
424
  const worksheet = XLSX.utils.json_to_sheet(data);
426
425
  XLSX.utils.book_append_sheet(
427
426
  workbook,