kupos-ui-components-lib 7.0.0 → 7.0.1

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.
@@ -135,50 +135,82 @@ const FilterBarDesktop = ({ t, serviceList, setServiceList, allSchedules, showRe
135
135
  // }
136
136
  }
137
137
  if (isPeru) {
138
- if (fil.type == "seat_types") {
139
- let activeOptions = fil.options.filter((it) => it.active);
140
- filteredRoutes = filteredRoutes.filter((it) => {
141
- if (activeOptions && activeOptions.length) {
142
- // Check if ANY of the active filter options match ANY seat type
143
- for (let f of activeOptions) {
144
- if (f.active) {
145
- const filterValue = f.value.toLowerCase();
146
- // Check if this filter value appears in any seat type label
147
- const hasMatchingSeatType = it.seat_types.some((bt) => { var _a; return ((_a = bt === null || bt === void 0 ? void 0 : bt.label) === null || _a === void 0 ? void 0 : _a.toLowerCase().indexOf(filterValue)) > -1; });
148
- if (hasMatchingSeatType) {
149
- return true;
150
- }
151
- }
152
- }
153
- return false;
154
- }
155
- else {
138
+ // if (fil.type == "seat_types") {
139
+ // let activeOptions = fil.options.filter((it) => it.active);
140
+ // filteredRoutes = filteredRoutes.filter((it) => {
141
+ // if (activeOptions && activeOptions.length) {
142
+ // // Check if ANY of the active filter options match ANY seat type
143
+ // for (let f of activeOptions) {
144
+ // if (f.active) {
145
+ // const filterValue = f.value.toLowerCase();
146
+ // // Check if this filter value appears in any seat type label
147
+ // const hasMatchingSeatType = it.seat_types.some(
148
+ // (bt) => bt?.label?.toLowerCase().indexOf(filterValue) > -1
149
+ // );
150
+ // if (hasMatchingSeatType) {
151
+ // return true;
152
+ // }
153
+ // }
154
+ // }
155
+ // return false;
156
+ // } else {
157
+ // return true;
158
+ // }
159
+ // });
160
+ // }
161
+ if (fil.type === "seat_types") {
162
+ const activeOptions = fil.options.filter((it) => it.active);
163
+ filteredRoutes = filteredRoutes.filter((route) => {
164
+ if (!activeOptions.length)
156
165
  return true;
157
- }
166
+ return activeOptions.some((opt) => {
167
+ const filterValue = opt.value.trim().toLowerCase();
168
+ return route.seat_types.some((seat) => {
169
+ var _a;
170
+ const seatLabel = (_a = seat === null || seat === void 0 ? void 0 : seat.label) === null || _a === void 0 ? void 0 : _a.trim().toLowerCase();
171
+ return seatLabel === filterValue;
172
+ });
173
+ });
158
174
  });
159
175
  }
160
176
  }
161
177
  else {
162
- if (fil.type == "seat_types") {
163
- let activeOptions = fil.options.filter((it) => it.active);
164
- filteredRoutes = filteredRoutes.filter((it) => {
165
- if (activeOptions && activeOptions.length) {
166
- // Check if ANY of the active filter options match ANY seat type
167
- for (let f of activeOptions) {
168
- if (f.active) {
169
- const filterValue = f.value.toLowerCase();
170
- // Check if this filter value appears in any seat type label
171
- const hasMatchingSeatType = it.seat_types.some((bt) => { var _a; return ((_a = bt === null || bt === void 0 ? void 0 : bt.label) === null || _a === void 0 ? void 0 : _a.toLowerCase().indexOf(filterValue)) > -1; });
172
- if (hasMatchingSeatType) {
173
- return true;
174
- }
175
- }
176
- }
177
- return false;
178
- }
179
- else {
178
+ // if (fil.type == "seat_types") {
179
+ // let activeOptions = fil.options.filter((it) => it.active);
180
+ // filteredRoutes = filteredRoutes.filter((it) => {
181
+ // if (activeOptions && activeOptions.length) {
182
+ // // Check if ANY of the active filter options match ANY seat type
183
+ // for (let f of activeOptions) {
184
+ // if (f.active) {
185
+ // const filterValue = f.value.toLowerCase();
186
+ // // Check if this filter value appears in any seat type label
187
+ // const hasMatchingSeatType = it.seat_types.some(
188
+ // (bt) => bt?.label?.toLowerCase().indexOf(filterValue) > -1
189
+ // );
190
+ // if (hasMatchingSeatType) {
191
+ // return true;
192
+ // }
193
+ // }
194
+ // }
195
+ // return false;
196
+ // } else {
197
+ // return true;
198
+ // }
199
+ // });
200
+ // }
201
+ if (fil.type === "seat_types") {
202
+ const activeOptions = fil.options.filter((it) => it.active);
203
+ filteredRoutes = filteredRoutes.filter((route) => {
204
+ if (!activeOptions.length)
180
205
  return true;
181
- }
206
+ return activeOptions.some((opt) => {
207
+ const filterValue = opt.value.trim().toLowerCase();
208
+ return route.seat_types.some((seat) => {
209
+ var _a;
210
+ const seatLabel = (_a = seat === null || seat === void 0 ? void 0 : seat.label) === null || _a === void 0 ? void 0 : _a.trim().toLowerCase();
211
+ return seatLabel === filterValue;
212
+ });
213
+ });
182
214
  });
183
215
  }
184
216
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kupos-ui-components-lib",
3
- "version": "7.0.0",
3
+ "version": "7.0.1",
4
4
  "description": "A reusable UI components package",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -167,53 +167,85 @@ const FilterBarDesktop = ({
167
167
  // }
168
168
  }
169
169
  if (isPeru) {
170
- if (fil.type == "seat_types") {
171
- let activeOptions = fil.options.filter((it) => it.active);
170
+ // if (fil.type == "seat_types") {
171
+ // let activeOptions = fil.options.filter((it) => it.active);
172
172
 
173
- filteredRoutes = filteredRoutes.filter((it) => {
174
- if (activeOptions && activeOptions.length) {
175
- // Check if ANY of the active filter options match ANY seat type
176
- for (let f of activeOptions) {
177
- if (f.active) {
178
- const filterValue = f.value.toLowerCase();
179
- // Check if this filter value appears in any seat type label
180
- const hasMatchingSeatType = it.seat_types.some(
181
- (bt) => bt?.label?.toLowerCase().indexOf(filterValue) > -1
182
- );
183
- if (hasMatchingSeatType) {
184
- return true;
185
- }
186
- }
187
- }
188
- return false;
189
- } else {
190
- return true;
191
- }
173
+ // filteredRoutes = filteredRoutes.filter((it) => {
174
+ // if (activeOptions && activeOptions.length) {
175
+ // // Check if ANY of the active filter options match ANY seat type
176
+ // for (let f of activeOptions) {
177
+ // if (f.active) {
178
+ // const filterValue = f.value.toLowerCase();
179
+ // // Check if this filter value appears in any seat type label
180
+ // const hasMatchingSeatType = it.seat_types.some(
181
+ // (bt) => bt?.label?.toLowerCase().indexOf(filterValue) > -1
182
+ // );
183
+ // if (hasMatchingSeatType) {
184
+ // return true;
185
+ // }
186
+ // }
187
+ // }
188
+ // return false;
189
+ // } else {
190
+ // return true;
191
+ // }
192
+ // });
193
+ // }
194
+ if (fil.type === "seat_types") {
195
+ const activeOptions = fil.options.filter((it) => it.active);
196
+
197
+ filteredRoutes = filteredRoutes.filter((route) => {
198
+ if (!activeOptions.length) return true;
199
+
200
+ return activeOptions.some((opt) => {
201
+ const filterValue = opt.value.trim().toLowerCase();
202
+
203
+ return route.seat_types.some((seat) => {
204
+ const seatLabel = seat?.label?.trim().toLowerCase();
205
+ return seatLabel === filterValue;
206
+ });
207
+ });
192
208
  });
193
209
  }
194
210
  } else {
195
- if (fil.type == "seat_types") {
196
- let activeOptions = fil.options.filter((it) => it.active);
211
+ // if (fil.type == "seat_types") {
212
+ // let activeOptions = fil.options.filter((it) => it.active);
197
213
 
198
- filteredRoutes = filteredRoutes.filter((it) => {
199
- if (activeOptions && activeOptions.length) {
200
- // Check if ANY of the active filter options match ANY seat type
201
- for (let f of activeOptions) {
202
- if (f.active) {
203
- const filterValue = f.value.toLowerCase();
204
- // Check if this filter value appears in any seat type label
205
- const hasMatchingSeatType = it.seat_types.some(
206
- (bt) => bt?.label?.toLowerCase().indexOf(filterValue) > -1
207
- );
208
- if (hasMatchingSeatType) {
209
- return true;
210
- }
211
- }
212
- }
213
- return false;
214
- } else {
215
- return true;
216
- }
214
+ // filteredRoutes = filteredRoutes.filter((it) => {
215
+ // if (activeOptions && activeOptions.length) {
216
+ // // Check if ANY of the active filter options match ANY seat type
217
+ // for (let f of activeOptions) {
218
+ // if (f.active) {
219
+ // const filterValue = f.value.toLowerCase();
220
+ // // Check if this filter value appears in any seat type label
221
+ // const hasMatchingSeatType = it.seat_types.some(
222
+ // (bt) => bt?.label?.toLowerCase().indexOf(filterValue) > -1
223
+ // );
224
+ // if (hasMatchingSeatType) {
225
+ // return true;
226
+ // }
227
+ // }
228
+ // }
229
+ // return false;
230
+ // } else {
231
+ // return true;
232
+ // }
233
+ // });
234
+ // }
235
+ if (fil.type === "seat_types") {
236
+ const activeOptions = fil.options.filter((it) => it.active);
237
+
238
+ filteredRoutes = filteredRoutes.filter((route) => {
239
+ if (!activeOptions.length) return true;
240
+
241
+ return activeOptions.some((opt) => {
242
+ const filterValue = opt.value.trim().toLowerCase();
243
+
244
+ return route.seat_types.some((seat) => {
245
+ const seatLabel = seat?.label?.trim().toLowerCase();
246
+ return seatLabel === filterValue;
247
+ });
248
+ });
217
249
  });
218
250
  }
219
251
  }