mautourco-components 0.2.172 → 0.2.173

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.
@@ -102,10 +102,20 @@ export function BookingPaxClient(props) {
102
102
  var prevErrorRef = useRef(undefined);
103
103
  useEffect(function () {
104
104
  var _a;
105
- var hasError = ((_a = selectedClientsInfoIds[selectedIndex]) === null || _a === void 0 ? void 0 : _a.length) !== paxCount;
106
- if (prevErrorRef.current !== hasError) {
107
- prevErrorRef.current = hasError;
108
- onError === null || onError === void 0 ? void 0 : onError(hasError);
105
+ var selectedError = clients.length === paxCount;
106
+ if (selectedError) {
107
+ if (prevErrorRef.current !== selectedError) {
108
+ prevErrorRef.current = selectedError;
109
+ onError === null || onError === void 0 ? void 0 : onError(false);
110
+ }
111
+ }
112
+ else {
113
+ var hasError_1 = ((_a = selectedClientsInfoIds[selectedIndex]) === null || _a === void 0 ? void 0 : _a.length) !== paxCount ||
114
+ clients.length === paxCount;
115
+ if (prevErrorRef.current !== hasError_1) {
116
+ prevErrorRef.current = hasError_1;
117
+ onError === null || onError === void 0 ? void 0 : onError(hasError_1);
118
+ }
109
119
  }
110
120
  }, [selectedClientsInfoIds, selectedIndex, paxCount, onError]);
111
121
  return (_jsxs("div", { className: "booking_spacing-y-2", children: [_jsxs(Text, { children: ["Please confirm the pax which applies on this service (", paxCount, " Pax)", ' ', _jsx(Text, { color: "state-error", as: "span", children: "*" })] }), _jsx("div", { className: cn('booking-pax-client', {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mautourco-components",
3
- "version": "0.2.172",
3
+ "version": "0.2.173",
4
4
  "private": false,
5
5
  "description": "Bibliothèque de composants Mautourco pour le redesign",
6
6
  "main": "dist/index.js",
@@ -217,10 +217,20 @@ export function BookingPaxClient(props: BookingPaxClientProps) {
217
217
  const prevErrorRef = useRef<boolean | undefined>(undefined);
218
218
 
219
219
  useEffect(() => {
220
- const hasError = selectedClientsInfoIds[selectedIndex]?.length !== paxCount;
221
- if (prevErrorRef.current !== hasError) {
222
- prevErrorRef.current = hasError;
223
- onError?.(hasError);
220
+ const selectedError = clients.length === paxCount;
221
+ if (selectedError) {
222
+ if (prevErrorRef.current !== selectedError) {
223
+ prevErrorRef.current = selectedError;
224
+ onError?.(false);
225
+ }
226
+ } else {
227
+ const hasError =
228
+ selectedClientsInfoIds[selectedIndex]?.length !== paxCount ||
229
+ clients.length === paxCount;
230
+ if (prevErrorRef.current !== hasError) {
231
+ prevErrorRef.current = hasError;
232
+ onError?.(hasError);
233
+ }
224
234
  }
225
235
  }, [selectedClientsInfoIds, selectedIndex, paxCount, onError]);
226
236