mautourco-components 0.2.115 → 0.2.116

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.
@@ -68,7 +68,6 @@ var LocationDropdown = function (_a) {
68
68
  id: defaultValue.id,
69
69
  locationName: getDefaultLabel(defaultValue.id),
70
70
  };
71
- console.log('defaultLocationData selected ===>', defaultLocationData);
72
71
  onSelectionChange(defaultLocationData);
73
72
  }
74
73
  // eslint-disable-next-line react-hooks/exhaustive-deps
@@ -85,7 +84,6 @@ var LocationDropdown = function (_a) {
85
84
  id: option.id,
86
85
  locationName: getDefaultLabel(option.id),
87
86
  };
88
- console.log('locationData selected ===>', locationData);
89
87
  onSelectionChange(locationData);
90
88
  setIsOpen(false);
91
89
  setSearchQuery('');
@@ -186,17 +186,19 @@ var TransferLine = function (_a) {
186
186
  };
187
187
  // Helper to convert LocationData to LocationOption
188
188
  var toLocationOption = function (locationData, position) {
189
- console.log('locationData ===>', locationData);
189
+ var _a;
190
190
  if (!locationData)
191
191
  return null;
192
192
  // Try to find in the options to get the type
193
- var _a = filterLocations(position), options = _a.options, groups = _a.groups;
193
+ var _b = filterLocations(position), options = _b.options, groups = _b.groups;
194
194
  var allLocations = getAllLocations(options, groups);
195
195
  var found = allLocations.find(function (loc) { return loc.id === locationData.id; });
196
196
  if (found)
197
197
  return found;
198
+ var currentLocationName = allLocations.find(function (l) { return l.id === locationData.id; });
199
+ var locationName = (_a = currentLocationName === null || currentLocationName === void 0 ? void 0 : currentLocationName.label) !== null && _a !== void 0 ? _a : locationData.locationName;
198
200
  // If not found, infer the type
199
- var name = locationData.locationName.toLowerCase();
201
+ var name = locationName.toLowerCase();
200
202
  var id = String(locationData.id).toLowerCase();
201
203
  var locType = 'accommodation';
202
204
  if (name.includes('harbour') ||
@@ -210,7 +212,7 @@ var TransferLine = function (_a) {
210
212
  }
211
213
  return {
212
214
  id: locationData.id,
213
- label: locationData.locationName,
215
+ label: locationName,
214
216
  type: locType,
215
217
  };
216
218
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mautourco-components",
3
- "version": "0.2.115",
3
+ "version": "0.2.116",
4
4
  "private": false,
5
5
  "description": "Bibliothèque de composants Mautourco pour le redesign",
6
6
  "main": "dist/index.js",
@@ -110,7 +110,6 @@ const LocationDropdown: React.FC<LocationDropdownProps> = ({
110
110
  locationName: getDefaultLabel(defaultValue.id),
111
111
  };
112
112
 
113
- console.log('defaultLocationData selected ===>', defaultLocationData);
114
113
  onSelectionChange(defaultLocationData);
115
114
  }
116
115
  // eslint-disable-next-line react-hooks/exhaustive-deps
@@ -128,7 +127,7 @@ const LocationDropdown: React.FC<LocationDropdownProps> = ({
128
127
  id: option.id,
129
128
  locationName: getDefaultLabel(option.id),
130
129
  };
131
- console.log('locationData selected ===>', locationData);
130
+
132
131
  onSelectionChange(locationData);
133
132
  setIsOpen(false);
134
133
  setSearchQuery('');
@@ -291,7 +291,6 @@ const TransferLine: React.FC<TransferLineProps> = ({
291
291
  locationData: LocationData | null,
292
292
  position: 'pickup' | 'dropoff'
293
293
  ): LocationOption | null => {
294
- console.log('locationData ===>', locationData);
295
294
  if (!locationData) return null;
296
295
 
297
296
  // Try to find in the options to get the type
@@ -300,8 +299,11 @@ const TransferLine: React.FC<TransferLineProps> = ({
300
299
  const found = allLocations.find((loc) => loc.id === locationData.id);
301
300
  if (found) return found;
302
301
 
302
+ const currentLocationName = allLocations.find((l) => l.id === locationData.id);
303
+ const locationName = currentLocationName?.label ?? locationData.locationName;
304
+
303
305
  // If not found, infer the type
304
- const name = locationData.locationName.toLowerCase();
306
+ const name = locationName.toLowerCase();
305
307
  const id = String(locationData.id).toLowerCase();
306
308
  let locType: 'airport' | 'port' | 'accommodation' = 'accommodation';
307
309
  if (
@@ -317,7 +319,7 @@ const TransferLine: React.FC<TransferLineProps> = ({
317
319
 
318
320
  return {
319
321
  id: locationData.id,
320
- label: locationData.locationName,
322
+ label: locationName,
321
323
  type: locType,
322
324
  };
323
325
  };