@nnc-digital/nnc-design-system 0.4.30 → 0.4.32

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.
@@ -4343,12 +4343,25 @@ var BinCollection = function (_a) {
4343
4343
  setErrorText('No addresses found for the provided postcode.');
4344
4344
  return;
4345
4345
  }
4346
- // Transform the response data into the expected format
4347
- var transformedAddresses = response.data.data.map(function (item) { return ({
4348
- value: item.UPRN,
4349
- title: "".concat(item.Address)
4350
- }); });
4351
- setAddressOptions(transformedAddresses);
4346
+ // Separate numeric and named addresses
4347
+ var numericAddresses = [];
4348
+ var namedAddresses = [];
4349
+ response.data.data.forEach(function (item) {
4350
+ var address = "".concat(item.Address);
4351
+ if (/^\d/.test(address)) { // Address starts with a number
4352
+ numericAddresses.push({ value: item.UPRN, title: address });
4353
+ }
4354
+ else {
4355
+ namedAddresses.push({ value: item.UPRN, title: address });
4356
+ }
4357
+ });
4358
+ // Sort numeric addresses by the whole number
4359
+ numericAddresses.sort(function (a, b) { return parseInt(a.title, 10) - parseInt(b.title, 10); });
4360
+ // Sort named addresses alphabetically
4361
+ namedAddresses.sort(function (a, b) { return a.title.localeCompare(b.title); });
4362
+ // Combine the sorted arrays
4363
+ var sortedAddresses = numericAddresses.concat(namedAddresses);
4364
+ setAddressOptions(sortedAddresses);
4352
4365
  })
4353
4366
  .catch(function (error) {
4354
4367
  setIsLoading(false);
@@ -4390,7 +4403,7 @@ var BinCollection = function (_a) {
4390
4403
  var selectedUPRN = e.target.value;
4391
4404
  if (selectedUPRN) {
4392
4405
  var startDate_1 = getFormattedDate();
4393
- var endDate_1 = getFormattedDate(28);
4406
+ var endDate_1 = getFormattedDate(42);
4394
4407
  // Fetch calendar events for the selected UPRN
4395
4408
  axios.get("".concat(CalendarEventsApiUrl).concat(selectedUPRN, "/").concat(startDate_1, "/").concat(endDate_1))
4396
4409
  .then(function (response) {