Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 34 additions & 34 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,52 +24,52 @@
"extension:deploy": "node scripts/deploy.mjs --upload --publish"
},
"devDependencies": {
"@babel/core": "^7.24.7",
"@babel/preset-env": "^7.24.7",
"@commitlint/cli": "^19.3.0",
"@eslint/compat": "^1.3.1",
"@eslint/eslintrc": "^3.3.1",
"@eslint/js": "^9.30.0",
"@types/node": "^24.0.8",
"@types/webextension-polyfill": "^0.12.3",
"@types/webpack-env": "^1.18.5",
"@typescript-eslint/eslint-plugin": "^8.35.1",
"@typescript-eslint/parser": "^8.35.1",
"@babel/core": "^7.28.6",
"@babel/preset-env": "^7.28.6",
"@commitlint/cli": "^20.4.0",
"@eslint/compat": "^2.0.2",
"@eslint/eslintrc": "^3.3.3",
"@eslint/js": "^9.39.2",
"@types/node": "^25.1.0",
"@types/webextension-polyfill": "^0.12.4",
"@types/webpack-env": "^1.18.8",
"@typescript-eslint/eslint-plugin": "^8.54.0",
"@typescript-eslint/parser": "^8.54.0",
"archiver": "^7.0.1",
"babel-loader": "^10.0.0",
"chalk": "^5.4.1",
"chalk": "^5.6.2",
"clean-webpack-plugin": "^4.0.0",
"copy-webpack-plugin": "^12.0.2",
"core-js": "3",
"copy-webpack-plugin": "^13.0.1",
"core-js": "^3.48.0",
"crx3": "^2.0.0",
"css-loader": "^7.1.2",
"dotenv": "^17.2.0",
"eslint": "^9.26.0",
"css-loader": "^7.1.3",
"dotenv": "^17.2.3",
"eslint": "^9.39.2",
"eslint-config-standard": "^17.1.0",
"eslint-plugin-import": "^2.32.0",
"eslint-plugin-n": "^17.20.0",
"eslint-plugin-n": "^17.23.2",
"eslint-plugin-promise": "^7.2.1",
"eslint-plugin-unicorn": "^59.0.1",
"globals": "^16.3.0",
"mini-css-extract-plugin": "^2.9.0",
"node-forge": "^1.3.2",
"postcss": "^8.4.38",
"sass": "^1.77.4",
"sass-loader": "^14.2.1",
"stylelint": "^16.6.1",
"stylelint-config-sass-guidelines": "^11.1.0",
"stylelint-scss": "^6.3.1",
"terser-webpack-plugin": "^5.3.10",
"ts-loader": "^9.5.1",
"typescript": "^5.8.3",
"eslint-plugin-unicorn": "^62.0.0",
"globals": "^17.2.0",
"mini-css-extract-plugin": "^2.10.0",
"node-forge": "^1.3.3",
"postcss": "^8.5.6",
"sass": "^1.97.3",
"sass-loader": "^16.0.6",
"stylelint": "^17.1.0",
"stylelint-config-sass-guidelines": "^12.1.0",
"stylelint-scss": "^7.0.0",
"terser-webpack-plugin": "^5.3.16",
"ts-loader": "^9.5.4",
"typescript": "^5.9.3",
"webextension-polyfill": "^0.12.0",
"webpack": "^5.92.0",
"webpack-cli": "^5.1.4",
"webpack": "^5.104.1",
"webpack-cli": "^6.0.1",
"webpack-ext-reloader": "^1.1.13",
"yargs": "^18.0.0"
},
"dependencies": {
"ky": "^1.3.0",
"ky": "^1.14.3",
"serialize-anything": "^1.2.3"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,17 @@ type VuePropertyListComponent = {
}

type HostelworldSearchServiceResult = {
properties: Property[]
properties: Property[],
location: unknown
}

interface HostelworldSearchService {
search (
type: 'New Search Page',
cityId: number,
from: string,
to: string,
showRooms: boolean
cityId: string,
fromDate: string | null,
toDate: string | null,
guests: number,
options: Record<string, unknown>
): Promise<HostelworldSearchServiceResult>
}

Expand Down Expand Up @@ -80,12 +81,12 @@ export class SearchPropertyListComponentPatcher {
if (!store) return

const service: HostelworldSearchService = await store.$services.search()
const { properties } = await service.search('New Search Page', Number(cityId), '1943-04-19', '1943-04-20', true)
const { properties } = await service.search(cityId, null, null, 1, {})

await waitForElement('.property-card .property-card-container')

const loaded: Property[] = store.state.search.properties
const loadedPropertyIds: number[] = pluck(store.state.search.properties, 'id')
const loadedPropertyIds: number[] = pluck(loaded, 'id')

const unavailable: Property[] = [...properties].filter(property => !loadedPropertyIds.includes(property.id))
const allProperties: Property[] = [
Expand Down
20 changes: 3 additions & 17 deletions src/app/Services/Hostelworld/SearchApiRequestsInterceptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ import type { HostelworldSearch } from 'Types/HostelworldSearch'
import { XHRRequestInterceptor } from 'Utils/XHRRequestInterceptor'

export class SearchApiRequestsInterceptor {
private static searchPropertiesRegex: RegExp = /cities\/\d+\/properties\/\?.*(?=date-start=(?!1943-04-19))/
private static searchAllPropertiesRegex: RegExp = /cities\/\d+\/properties\/\?.*date-start=1943-04-19/
private static searchAllPropertiesWithoutDateStartRegex: RegExp = /cities\/\d+\/properties\/(?!.*[?&]date-start=)/
private static searchPropertiesRegex: RegExp = /cities\/\d+\/properties\/\?.*date-start=/
private static searchAllPropertiesRegex: RegExp = /cities\/\d+\/properties\/(?!.*[?&]date-start=)/

public static interceptSearch (
UrlCallback: Callback<URL>,
Expand Down Expand Up @@ -34,27 +33,14 @@ export class SearchApiRequestsInterceptor {
}

public static interceptSearchAll (responseCallback: Callback<HostelworldSearch>): typeof this {
const updateCustomUrlToSearchAll: Callback<string> = (url: string): string => {
const parsed: URL = new URL(url)
parsed.searchParams.delete('guests')
parsed.searchParams.delete('num-nights')
parsed.searchParams.delete('date-start')

return parsed.toString()
}

const parseResponseWithCallback: Callback<string> = (response: string): string => {
const parsed: HostelworldSearch = JSON.parse(response)

return JSON.stringify(responseCallback(parsed))
}

XHRRequestInterceptor
.intercept({ url: this.searchAllPropertiesRegex })
.withUrl(updateCustomUrlToSearchAll)

XHRRequestInterceptor
.intercept({ url: this.searchAllPropertiesWithoutDateStartRegex, status: 200 })
.intercept({ url: this.searchAllPropertiesRegex, status: 200 })
.withResponse(parseResponseWithCallback)

return this
Expand Down
6 changes: 3 additions & 3 deletions src/assets/styles/app.scss
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
justify-content: flex-start;

.avatar-item:not(:last-child) {
margin-right: -0.3rem !important
margin-right: -0.3rem !important;
}
}
}
Expand Down Expand Up @@ -61,7 +61,7 @@
}

&.item {
font-size: .8rem;
font-size: 0.8rem;

.label {
color: var(--wds-color-ink-darker);
Expand All @@ -85,7 +85,7 @@

.note {
text-align: center;
font-size: .8rem;
font-size: 0.8rem;
color: var(--wds-color-ink);
border-top: 0.0625rem solid var(--wds-color-ink-lighter);
}
Expand Down
Loading