heroes-of-chess-components 0.6.68 → 0.6.70

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.
@@ -121,7 +121,7 @@ var ClientCalendarComponent = function ClientCalendarComponent(_ref2) {
121
121
  });
122
122
  return;
123
123
  }
124
- // 🔥 Validar disponibilidad de specialChildren para clases de test (firstTime)
124
+ // 🔥 Validar disponibilidad de specialChildren SOLO para primera reserva (no cambios) con fallback
125
125
  if (!masterConsole && firstTime) {
126
126
  var _groupInfo$dataDays, _dataDayForSelectedDa;
127
127
  var dataDayForSelectedDay = groupInfo === null || groupInfo === void 0 || (_groupInfo$dataDays = groupInfo.dataDays) === null || _groupInfo$dataDays === void 0 ? void 0 : _groupInfo$dataDays.find(function (d) {
@@ -129,7 +129,14 @@ var ClientCalendarComponent = function ClientCalendarComponent(_ref2) {
129
129
  });
130
130
  var specialChildrenCount = (dataDayForSelectedDay === null || dataDayForSelectedDay === void 0 || (_dataDayForSelectedDa = dataDayForSelectedDay.specialChildren) === null || _dataDayForSelectedDa === void 0 ? void 0 : _dataDayForSelectedDa.length) || 0;
131
131
  var specialChildrenCapacity = (dataDayForSelectedDay === null || dataDayForSelectedDay === void 0 ? void 0 : dataDayForSelectedDay.specialChildrenCapacity) || 3;
132
- if (specialChildrenCount >= specialChildrenCapacity) {
132
+
133
+ // Verificar si hay espacio en children como fallback
134
+ var childrenCount = ((dataDayForSelectedDay === null || dataDayForSelectedDay === void 0 ? void 0 : dataDayForSelectedDay.children) || []).filter(function (child) {
135
+ return !(child !== null && child !== void 0 && child.changed);
136
+ }).length;
137
+ var childrenCapacity = (dataDayForSelectedDay === null || dataDayForSelectedDay === void 0 ? void 0 : dataDayForSelectedDay.childrenCapacity) || 17;
138
+ var hasChildrenSpaceForFallback = childrenCount < childrenCapacity;
139
+ if (specialChildrenCount >= specialChildrenCapacity && !hasChildrenSpaceForFallback) {
133
140
  HPopUp({
134
141
  type: "info",
135
142
  message: "Non ci sono più posti disponibili per la lezione di prova in questo giorno."
@@ -23,6 +23,16 @@ export function captureCalendarValidations(_ref) {
23
23
  var specialChildrenCount = (dataDayForSelectedDay === null || dataDayForSelectedDay === void 0 || (_dataDayForSelectedDa = dataDayForSelectedDay.specialChildren) === null || _dataDayForSelectedDa === void 0 ? void 0 : _dataDayForSelectedDa.length) || 0;
24
24
  var specialChildrenCapacity = (dataDayForSelectedDay === null || dataDayForSelectedDay === void 0 ? void 0 : dataDayForSelectedDay.specialChildrenCapacity) || 3;
25
25
  var hasSpecialChildrenSpace = specialChildrenCount < specialChildrenCapacity;
26
+
27
+ // 🔥 Validar si hay espacio en children como fallback
28
+ var childrenCount = ((dataDayForSelectedDay === null || dataDayForSelectedDay === void 0 ? void 0 : dataDayForSelectedDay.children) || []).filter(function (child) {
29
+ return !(child !== null && child !== void 0 && child.changed);
30
+ }).length;
31
+ var childrenCapacity = (dataDayForSelectedDay === null || dataDayForSelectedDay === void 0 ? void 0 : dataDayForSelectedDay.childrenCapacity) || 17;
32
+ var hasChildrenSpaceForFallback = childrenCount < childrenCapacity;
33
+
34
+ // 🔥 Calcular si hay espacio disponible considerando el fallback
35
+ var hasSpaceAvailable = hasSpecialChildrenSpace || hasChildrenSpaceForFallback;
26
36
  return {
27
37
  checkDisabled: {
28
38
  allowed: (available === null || available === void 0 ? void 0 : available.allowed) || false,
@@ -62,13 +72,15 @@ export function captureCalendarValidations(_ref) {
62
72
  })) === null || _groupInfo$changedChi === void 0 ? void 0 : _groupInfo$changedChi.length) || 0,
63
73
  isFull: participantsCount >= ((groupInfo === null || groupInfo === void 0 ? void 0 : groupInfo.childrenCapacity) || 0)
64
74
  },
65
- // 🔥 Nueva validación para specialChildren (clases de test)
75
+ // 🔥 Validación para specialChildren (solo primera reserva) con fallback a children
66
76
  specialChildrenAvailability: {
67
- passed: firstTime ? hasSpecialChildrenSpace : true,
77
+ passed: firstTime ? hasSpaceAvailable : true,
68
78
  currentCount: specialChildrenCount,
69
79
  maxCapacity: specialChildrenCapacity,
70
80
  hasSpace: hasSpecialChildrenSpace,
71
- isTestClass: !!firstTime
81
+ hasChildrenFallback: hasChildrenSpaceForFallback,
82
+ willUseChildrenCapacity: !hasSpecialChildrenSpace && hasChildrenSpaceForFallback,
83
+ isFirstBooking: !!firstTime
72
84
  }
73
85
  };
74
86
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "heroes-of-chess-components",
3
- "version": "0.6.68",
3
+ "version": "0.6.70",
4
4
  "description": "Reusable React Components for Heroes of Chess Apps",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",