@admin-layout/client 12.2.5-alpha.6 → 12.2.5-alpha.7
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.
- package/lib/index.js +1 -1
- package/lib/index.native.js +1 -1
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/index.d.ts.map +1 -1
- package/lib/utils/resultCards.d.ts +241 -0
- package/lib/utils/resultCards.d.ts.map +1 -0
- package/lib/utils/resultCards.js +640 -0
- package/lib/utils/resultCards.js.map +1 -0
- package/lib/utils/resultCards.test.d.ts +2 -0
- package/lib/utils/resultCards.test.d.ts.map +1 -0
- package/package.json +2 -2
package/lib/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{SearchBarBehavior}from'./interfaces/settings.js';export{APPLICATION_ERROR_SLOT_FILL,CHANGE_LANGUAGE,CHANGE_SETTINGS_ACTION}from'./constants/constants.js';export{BACKEND_ERROR,CLEAR_APPLICATION_ERRORS,DISMISS_APPLICATION_ERROR,LOG_APPLICATION_ERROR,RESTORE_APPLICATION_ERRORS}from'./constants/error.js';export{HEADER_SEARCHBAR_FILL,HEADER_SEARCH_BUTTON_FILL,RIGHT_CONTENT_FILL,SCROLL_END_FILL}from'./constants/layout.js';export{languages}from'./constants/languages.js';export{dismissApplicationError,restoreApplicationError,setApplicationError}from'./redux/actions/error-actions.js';export{applicationErrors,initialErrorsState}from'./redux/reducers/error.js';export{settingsReducer}from'./redux/reducers/settings.js';export{store}from'./redux/store.js';export{useAppDispatch,useAppSelector}from'./redux/hooks.js';export{getMenuSeparation}from'./utils/seperatedMenus.js';export{useComponentSize,useIsomorphicLayoutEffect}from'./utils/componentSize.js';export{matchParentRoute}from'./utils/parentRoute.js';export{addProLayoutParentKeys,filterRoutesWithLocale,menuDataRender,removeUnnecessaryProperties,setLocale,transformData}from'./utils/menuUtils.js';export{getMatchMenuKeys}from'./utils/matchMenuKeys.js';export{generateMenuPath}from'./utils/generateMenuLink.js';export{compareAndSaveSettingsDifferences}from'./utils/settingsDifference.js';export{safeLocalStorage}from'./utils/storage.js';export{getStorageMode,isSpaMode,settingsStorage}from'./utils/settingsStorage.js';export{airlineCode,airlineTone,cabinLabel,dateLabel,dayOffset,durationLabel,flightBadgeLabel,flightNumberLabel,flightPrice,flightPriceValue,flightResultSummary,isFlightAttachment,rankFlightCards,sortFlightCards,stopsLabel,toFlightCard,toFlightCards,wallClock}from'./utils/flightCards.js';export{ApplicationErrorHandlerCommon}from'./components/ApplicationErrorHandlerCommon.js';export{ErrorBoundaryCommon}from'./components/ErrorBoundaryCommon.js';export{ApplicationErrorFillWrapper}from'./components/ApplicationErrorFillWrapper.js';export{LayoutCookieProvider}from'./components/LayoutCookieProvider.js';export{ErrorLink,errorReduxLink}from'./graphql/link/error-link.js';export{systemFont}from'./themes/systemFont/index.js';export{borderRadius,colors,lightLayoutTheme,lightNavigationBarTheme,lightTabBarTheme,shadows,sizes,spacings,textVariants}from'./themes/templates/lightLayoutTheme.js';export{createLayoutTheme}from'./themes/templates/createLayoutTheme.js';export{darkColors,darkLayoutTheme,darkNavigationBarTheme,darkTabBarTheme}from'./themes/templates/darkLayoutTheme.js';export{config}from'./config/env-config.js';export{AMENITIES,DEFAULT_HEADER,DEFAULT_LAYOUT,DEFAULT_SETTINGS,SEARCH_TYPES,SHARED_VIEW_CONFIG}from'./config/defaultSettings.js';export{useLayoutSettings}from'./hooks/useLayoutSettings.js';export{usePermissionAutoFetch,useSetting,useSettingsLoader}from'@adminide-stack/platform-client';export{ClientOnly}from'./hooks/Client-only.js';export{blue}from'./colors/presets/blue.js';export{brinkPink}from'./colors/presets/brinkPink.js';export{cyan}from'./colors/presets/cyan.js';export{green}from'./colors/presets/green.js';export{lime}from'./colors/presets/lime.js';export{orange}from'./colors/presets/orange.js';export{pink}from'./colors/presets/pink.js';export{purple}from'./colors/presets/purple.js';export{red}from'./colors/presets/red.js';export{skyBlue}from'./colors/presets/skyBlue.js';export{turquoise}from'./colors/presets/turquoise.js';export{yellow}from'./colors/presets/yellow.js';export{white}from'./colors/presets/white.js';export{black}from'./colors/presets/black.js';export{colorList,getThemeColors}from'./colors/colorsList.js';//# sourceMappingURL=index.js.map
|
|
1
|
+
export{SearchBarBehavior}from'./interfaces/settings.js';export{APPLICATION_ERROR_SLOT_FILL,CHANGE_LANGUAGE,CHANGE_SETTINGS_ACTION}from'./constants/constants.js';export{BACKEND_ERROR,CLEAR_APPLICATION_ERRORS,DISMISS_APPLICATION_ERROR,LOG_APPLICATION_ERROR,RESTORE_APPLICATION_ERRORS}from'./constants/error.js';export{HEADER_SEARCHBAR_FILL,HEADER_SEARCH_BUTTON_FILL,RIGHT_CONTENT_FILL,SCROLL_END_FILL}from'./constants/layout.js';export{languages}from'./constants/languages.js';export{dismissApplicationError,restoreApplicationError,setApplicationError}from'./redux/actions/error-actions.js';export{applicationErrors,initialErrorsState}from'./redux/reducers/error.js';export{settingsReducer}from'./redux/reducers/settings.js';export{store}from'./redux/store.js';export{useAppDispatch,useAppSelector}from'./redux/hooks.js';export{getMenuSeparation}from'./utils/seperatedMenus.js';export{useComponentSize,useIsomorphicLayoutEffect}from'./utils/componentSize.js';export{matchParentRoute}from'./utils/parentRoute.js';export{addProLayoutParentKeys,filterRoutesWithLocale,menuDataRender,removeUnnecessaryProperties,setLocale,transformData}from'./utils/menuUtils.js';export{getMatchMenuKeys}from'./utils/matchMenuKeys.js';export{generateMenuPath}from'./utils/generateMenuLink.js';export{compareAndSaveSettingsDifferences}from'./utils/settingsDifference.js';export{safeLocalStorage}from'./utils/storage.js';export{getStorageMode,isSpaMode,settingsStorage}from'./utils/settingsStorage.js';export{airlineCode,airlineTone,cabinLabel,dateLabel,dayOffset,durationLabel,flightBadgeLabel,flightNumberLabel,flightPrice,flightPriceValue,flightResultSummary,isFlightAttachment,rankFlightCards,sortFlightCards,stopsLabel,toFlightCard,toFlightCards,wallClock}from'./utils/flightCards.js';export{carSummary,countLabel,daysSince,groundSummary,hostLabel,jobSummary,movieSummary,postedLabel,productSummary,ratingLabel,resultBadgeLabel,sortResultCards,sourceLabelOf,staySummary,toCarCard,toCarCards,toGroundCard,toGroundCards,toJobCard,toJobCards,toMovieCard,toMovieCards,toProductCard,toProductCards,toResumeCard,toStayCard,toStayCards,travelItemKind,travelResultKind,travelResultNoun}from'./utils/resultCards.js';export{ApplicationErrorHandlerCommon}from'./components/ApplicationErrorHandlerCommon.js';export{ErrorBoundaryCommon}from'./components/ErrorBoundaryCommon.js';export{ApplicationErrorFillWrapper}from'./components/ApplicationErrorFillWrapper.js';export{LayoutCookieProvider}from'./components/LayoutCookieProvider.js';export{ErrorLink,errorReduxLink}from'./graphql/link/error-link.js';export{systemFont}from'./themes/systemFont/index.js';export{borderRadius,colors,lightLayoutTheme,lightNavigationBarTheme,lightTabBarTheme,shadows,sizes,spacings,textVariants}from'./themes/templates/lightLayoutTheme.js';export{createLayoutTheme}from'./themes/templates/createLayoutTheme.js';export{darkColors,darkLayoutTheme,darkNavigationBarTheme,darkTabBarTheme}from'./themes/templates/darkLayoutTheme.js';export{config}from'./config/env-config.js';export{AMENITIES,DEFAULT_HEADER,DEFAULT_LAYOUT,DEFAULT_SETTINGS,SEARCH_TYPES,SHARED_VIEW_CONFIG}from'./config/defaultSettings.js';export{useLayoutSettings}from'./hooks/useLayoutSettings.js';export{usePermissionAutoFetch,useSetting,useSettingsLoader}from'@adminide-stack/platform-client';export{ClientOnly}from'./hooks/Client-only.js';export{blue}from'./colors/presets/blue.js';export{brinkPink}from'./colors/presets/brinkPink.js';export{cyan}from'./colors/presets/cyan.js';export{green}from'./colors/presets/green.js';export{lime}from'./colors/presets/lime.js';export{orange}from'./colors/presets/orange.js';export{pink}from'./colors/presets/pink.js';export{purple}from'./colors/presets/purple.js';export{red}from'./colors/presets/red.js';export{skyBlue}from'./colors/presets/skyBlue.js';export{turquoise}from'./colors/presets/turquoise.js';export{yellow}from'./colors/presets/yellow.js';export{white}from'./colors/presets/white.js';export{black}from'./colors/presets/black.js';export{colorList,getThemeColors}from'./colors/colorsList.js';//# sourceMappingURL=index.js.map
|
package/lib/index.native.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{SearchBarBehavior}from'./interfaces/settings.js';export{APPLICATION_ERROR_SLOT_FILL,CHANGE_LANGUAGE,CHANGE_SETTINGS_ACTION}from'./constants/constants.js';export{BACKEND_ERROR,CLEAR_APPLICATION_ERRORS,DISMISS_APPLICATION_ERROR,LOG_APPLICATION_ERROR,RESTORE_APPLICATION_ERRORS}from'./constants/error.js';export{HEADER_SEARCHBAR_FILL,HEADER_SEARCH_BUTTON_FILL,RIGHT_CONTENT_FILL,SCROLL_END_FILL}from'./constants/layout.js';export{languages}from'./constants/languages.js';export{dismissApplicationError,restoreApplicationError,setApplicationError}from'./redux/actions/error-actions.js';export{applicationErrors,initialErrorsState}from'./redux/reducers/error.js';export{settingsReducer}from'./redux/reducers/settings.js';export{store}from'./redux/store.js';export{useAppDispatch,useAppSelector}from'./redux/hooks.js';export{getMenuSeparation}from'./utils/seperatedMenus.js';export{useComponentSize,useIsomorphicLayoutEffect}from'./utils/componentSize.js';export{matchParentRoute}from'./utils/parentRoute.js';export{addProLayoutParentKeys,filterRoutesWithLocale,menuDataRender,removeUnnecessaryProperties,setLocale,transformData}from'./utils/menuUtils.js';export{getMatchMenuKeys}from'./utils/matchMenuKeys.js';export{generateMenuPath}from'./utils/generateMenuLink.js';export{compareAndSaveSettingsDifferences}from'./utils/settingsDifference.js';export{safeLocalStorage}from'./utils/storage.js';export{getStorageMode,isSpaMode,settingsStorage}from'./utils/settingsStorage.js';export{airlineCode,airlineTone,cabinLabel,dateLabel,dayOffset,durationLabel,flightBadgeLabel,flightNumberLabel,flightPrice,flightPriceValue,flightResultSummary,isFlightAttachment,rankFlightCards,sortFlightCards,stopsLabel,toFlightCard,toFlightCards,wallClock}from'./utils/flightCards.js';export{ApplicationErrorHandlerCommon}from'./components/ApplicationErrorHandlerCommon.js';export{ErrorBoundaryCommon}from'./components/ErrorBoundaryCommon.js';export{ApplicationErrorFillWrapper}from'./components/ApplicationErrorFillWrapper.js';export{LayoutCookieProvider}from'./components/LayoutCookieProvider.js';export{ErrorLink,errorReduxLink}from'./graphql/link/error-link.js';export{systemFont}from'./themes/systemFont/index.js';export{borderRadius,colors,lightLayoutTheme,lightNavigationBarTheme,lightTabBarTheme,shadows,sizes,spacings,textVariants}from'./themes/templates/lightLayoutTheme.js';export{createLayoutTheme}from'./themes/templates/createLayoutTheme.js';export{darkColors,darkLayoutTheme,darkNavigationBarTheme,darkTabBarTheme}from'./themes/templates/darkLayoutTheme.js';export{config}from'./config/env-config.js';export{AMENITIES,DEFAULT_HEADER,DEFAULT_LAYOUT,DEFAULT_SETTINGS,SEARCH_TYPES,SHARED_VIEW_CONFIG}from'./config/defaultSettings.js';//# sourceMappingURL=index.native.js.map
|
|
1
|
+
export{SearchBarBehavior}from'./interfaces/settings.js';export{APPLICATION_ERROR_SLOT_FILL,CHANGE_LANGUAGE,CHANGE_SETTINGS_ACTION}from'./constants/constants.js';export{BACKEND_ERROR,CLEAR_APPLICATION_ERRORS,DISMISS_APPLICATION_ERROR,LOG_APPLICATION_ERROR,RESTORE_APPLICATION_ERRORS}from'./constants/error.js';export{HEADER_SEARCHBAR_FILL,HEADER_SEARCH_BUTTON_FILL,RIGHT_CONTENT_FILL,SCROLL_END_FILL}from'./constants/layout.js';export{languages}from'./constants/languages.js';export{dismissApplicationError,restoreApplicationError,setApplicationError}from'./redux/actions/error-actions.js';export{applicationErrors,initialErrorsState}from'./redux/reducers/error.js';export{settingsReducer}from'./redux/reducers/settings.js';export{store}from'./redux/store.js';export{useAppDispatch,useAppSelector}from'./redux/hooks.js';export{getMenuSeparation}from'./utils/seperatedMenus.js';export{useComponentSize,useIsomorphicLayoutEffect}from'./utils/componentSize.js';export{matchParentRoute}from'./utils/parentRoute.js';export{addProLayoutParentKeys,filterRoutesWithLocale,menuDataRender,removeUnnecessaryProperties,setLocale,transformData}from'./utils/menuUtils.js';export{getMatchMenuKeys}from'./utils/matchMenuKeys.js';export{generateMenuPath}from'./utils/generateMenuLink.js';export{compareAndSaveSettingsDifferences}from'./utils/settingsDifference.js';export{safeLocalStorage}from'./utils/storage.js';export{getStorageMode,isSpaMode,settingsStorage}from'./utils/settingsStorage.js';export{airlineCode,airlineTone,cabinLabel,dateLabel,dayOffset,durationLabel,flightBadgeLabel,flightNumberLabel,flightPrice,flightPriceValue,flightResultSummary,isFlightAttachment,rankFlightCards,sortFlightCards,stopsLabel,toFlightCard,toFlightCards,wallClock}from'./utils/flightCards.js';export{carSummary,countLabel,daysSince,groundSummary,hostLabel,jobSummary,movieSummary,postedLabel,productSummary,ratingLabel,resultBadgeLabel,sortResultCards,sourceLabelOf,staySummary,toCarCard,toCarCards,toGroundCard,toGroundCards,toJobCard,toJobCards,toMovieCard,toMovieCards,toProductCard,toProductCards,toResumeCard,toStayCard,toStayCards,travelItemKind,travelResultKind,travelResultNoun}from'./utils/resultCards.js';export{ApplicationErrorHandlerCommon}from'./components/ApplicationErrorHandlerCommon.js';export{ErrorBoundaryCommon}from'./components/ErrorBoundaryCommon.js';export{ApplicationErrorFillWrapper}from'./components/ApplicationErrorFillWrapper.js';export{LayoutCookieProvider}from'./components/LayoutCookieProvider.js';export{ErrorLink,errorReduxLink}from'./graphql/link/error-link.js';export{systemFont}from'./themes/systemFont/index.js';export{borderRadius,colors,lightLayoutTheme,lightNavigationBarTheme,lightTabBarTheme,shadows,sizes,spacings,textVariants}from'./themes/templates/lightLayoutTheme.js';export{createLayoutTheme}from'./themes/templates/createLayoutTheme.js';export{darkColors,darkLayoutTheme,darkNavigationBarTheme,darkTabBarTheme}from'./themes/templates/darkLayoutTheme.js';export{config}from'./config/env-config.js';export{AMENITIES,DEFAULT_HEADER,DEFAULT_LAYOUT,DEFAULT_SETTINGS,SEARCH_TYPES,SHARED_VIEW_CONFIG}from'./config/defaultSettings.js';//# sourceMappingURL=index.native.js.map
|
package/lib/utils/index.d.ts
CHANGED
package/lib/utils/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,WAAW,CAAC;AAC1B,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,WAAW,CAAC;AAC1B,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC"}
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Result cards for every chat widget that is a list of things to pick from:
|
|
3
|
+
* stays, rental cars, trains and buses, products, movie showtimes and jobs,
|
|
4
|
+
* plus the single resume card. Flights keep their own model (flightCards.ts);
|
|
5
|
+
* this file reuses its time, price and monogram helpers so a train reads the
|
|
6
|
+
* way a flight does.
|
|
7
|
+
*
|
|
8
|
+
* Every renderer (the tailwind chat cards on the web, any native twin) builds
|
|
9
|
+
* from these views, so the strings a card shows are decided once, here.
|
|
10
|
+
*
|
|
11
|
+
* Nothing here knows a provider. A seller's name comes from the row itself
|
|
12
|
+
* (`provider`, `merchant`, `sourceLabel`) or from the host of its link, never
|
|
13
|
+
* from a table of known sites.
|
|
14
|
+
*/
|
|
15
|
+
/** A standout a card can be labelled with once its result set is ranked. */
|
|
16
|
+
export type ResultBadge = 'cheapest' | 'fastest' | 'top-rated';
|
|
17
|
+
export declare const resultBadgeLabel: (badge: ResultBadge) => string;
|
|
18
|
+
/** Orderings a result list offers. `recommended` keeps the order the agent returned. */
|
|
19
|
+
export type ResultSort = 'recommended' | 'cheapest' | 'fastest' | 'rating' | 'departure' | 'newest';
|
|
20
|
+
/** The fields of a result row every card may read. Each vertical adds its own. */
|
|
21
|
+
export interface ResultItemLike {
|
|
22
|
+
id?: string;
|
|
23
|
+
title?: string;
|
|
24
|
+
url?: string;
|
|
25
|
+
imageUrl?: string;
|
|
26
|
+
price?: number;
|
|
27
|
+
priceLabel?: string;
|
|
28
|
+
priceUnit?: string;
|
|
29
|
+
currency?: string;
|
|
30
|
+
rating?: number;
|
|
31
|
+
reviewCount?: number;
|
|
32
|
+
reviews?: number;
|
|
33
|
+
source?: string;
|
|
34
|
+
/** The seller or operator as the row names it. */
|
|
35
|
+
provider?: string;
|
|
36
|
+
/** Display name for the source, when the row carries one. */
|
|
37
|
+
sourceLabel?: string;
|
|
38
|
+
[key: string]: unknown;
|
|
39
|
+
}
|
|
40
|
+
export interface ResultSetLike {
|
|
41
|
+
title?: string;
|
|
42
|
+
subtitle?: string;
|
|
43
|
+
totalCount?: number;
|
|
44
|
+
actionLabel?: string;
|
|
45
|
+
currency?: string;
|
|
46
|
+
properties?: ResultItemLike[];
|
|
47
|
+
[key: string]: unknown;
|
|
48
|
+
}
|
|
49
|
+
export interface ResultCardBase {
|
|
50
|
+
key: string;
|
|
51
|
+
url?: string;
|
|
52
|
+
title: string;
|
|
53
|
+
price?: string;
|
|
54
|
+
priceValue?: number;
|
|
55
|
+
rating?: number;
|
|
56
|
+
/** Where the row is sold or listed: "booking.com", "Turo", "FlixBus". */
|
|
57
|
+
sourceLabel?: string;
|
|
58
|
+
badges: ResultBadge[];
|
|
59
|
+
/** One sentence a screen reader announces for the whole card. */
|
|
60
|
+
accessibleLabel: string;
|
|
61
|
+
}
|
|
62
|
+
/** One quick pick in a result header: "Cheapest · $89 · Hotel Lux". */
|
|
63
|
+
export interface ResultPick {
|
|
64
|
+
badge: ResultBadge;
|
|
65
|
+
label: string;
|
|
66
|
+
key: string;
|
|
67
|
+
/** The figure the chip shows: a price, a duration, or a rating. */
|
|
68
|
+
value?: string;
|
|
69
|
+
/** Which card it is, in a word or two. */
|
|
70
|
+
name?: string;
|
|
71
|
+
}
|
|
72
|
+
export interface ResultSummary {
|
|
73
|
+
title: string;
|
|
74
|
+
/** "6 stays · from $89 · Sep 5 – 8" */
|
|
75
|
+
subtitle: string;
|
|
76
|
+
count: number;
|
|
77
|
+
fromPrice?: string;
|
|
78
|
+
picks: ResultPick[];
|
|
79
|
+
}
|
|
80
|
+
/** "www.booking.com" → "booking.com"; undefined for a hash or relative link. */
|
|
81
|
+
export declare const hostLabel: (url?: string) => string | undefined;
|
|
82
|
+
/** The row's own name for where it is sold, else the link's host, else its source key. */
|
|
83
|
+
export declare const sourceLabelOf: (item: ResultItemLike) => string | undefined;
|
|
84
|
+
/** "4.6" or "9.1"; scores over 5 are on a 10 scale and keep one decimal too. */
|
|
85
|
+
export declare const ratingLabel: (rating?: number) => string | undefined;
|
|
86
|
+
/** "1,284" with a compact fallback for very large counts: "12k". */
|
|
87
|
+
export declare const countLabel: (n?: number) => string | undefined;
|
|
88
|
+
interface Rankable {
|
|
89
|
+
priceValue?: number;
|
|
90
|
+
rating?: number;
|
|
91
|
+
reviewCount?: number;
|
|
92
|
+
minutes?: number;
|
|
93
|
+
}
|
|
94
|
+
/** Orders any result cards; a metric a card lacks sorts it last. */
|
|
95
|
+
export declare const sortResultCards: <T extends ResultCardBase & Rankable & {
|
|
96
|
+
departTime?: string;
|
|
97
|
+
postedDays?: number;
|
|
98
|
+
}>(cards: T[], sort: ResultSort) => T[];
|
|
99
|
+
/** What a travel result set holds; flights are read by flightCards.ts. */
|
|
100
|
+
export type TravelResultKind = 'stay' | 'car' | 'train' | 'bus';
|
|
101
|
+
/** The kind of one travel row, from its own `kind`, then its source, then its price unit. */
|
|
102
|
+
export declare const travelItemKind: (item: ResultItemLike) => TravelResultKind;
|
|
103
|
+
/** The kind most rows in the set share, so one card style renders the whole row. */
|
|
104
|
+
export declare const travelResultKind: (a?: ResultSetLike) => TravelResultKind;
|
|
105
|
+
export interface StayCardView extends ResultCardBase, Rankable {
|
|
106
|
+
imageUrl?: string;
|
|
107
|
+
/** "Downtown · 1.2 km from center" or the city. */
|
|
108
|
+
location?: string;
|
|
109
|
+
ratingText?: string;
|
|
110
|
+
reviewsText?: string;
|
|
111
|
+
/** "night", "trip". */
|
|
112
|
+
unit?: string;
|
|
113
|
+
/** "Free cancellation", "Entire home" ... as the row states it. */
|
|
114
|
+
perks: string[];
|
|
115
|
+
description?: string;
|
|
116
|
+
}
|
|
117
|
+
export declare const toStayCard: (item: ResultItemLike, index: number, currency?: string) => StayCardView | null;
|
|
118
|
+
export declare const toStayCards: (a: ResultSetLike) => StayCardView[];
|
|
119
|
+
export interface CarCardView extends ResultCardBase, Rankable {
|
|
120
|
+
imageUrl?: string;
|
|
121
|
+
/** "SUV · 5 seats · Automatic" from whatever the row states. */
|
|
122
|
+
specs?: string;
|
|
123
|
+
description?: string;
|
|
124
|
+
ratingText?: string;
|
|
125
|
+
/** "128 trips" — Turo counts trips, a rental desk counts reviews. */
|
|
126
|
+
reviewsText?: string;
|
|
127
|
+
unit: string;
|
|
128
|
+
/** A search link to a rental site rather than a priced car. */
|
|
129
|
+
isLink: boolean;
|
|
130
|
+
}
|
|
131
|
+
export declare const toCarCard: (item: ResultItemLike, index: number, currency?: string) => CarCardView | null;
|
|
132
|
+
/** Priced cars first, search links after: a link has nothing to compare. */
|
|
133
|
+
export declare const toCarCards: (a: ResultSetLike) => CarCardView[];
|
|
134
|
+
export interface GroundCardView extends ResultCardBase, Rankable {
|
|
135
|
+
mode: 'train' | 'bus';
|
|
136
|
+
operator?: string;
|
|
137
|
+
/** Monogram tile for the operator. */
|
|
138
|
+
operatorCode: string;
|
|
139
|
+
operatorTone: number;
|
|
140
|
+
departTime?: string;
|
|
141
|
+
arriveTime?: string;
|
|
142
|
+
/** "+1" when it arrives a calendar day later. */
|
|
143
|
+
dayOffset?: string;
|
|
144
|
+
/** Station, else the city. */
|
|
145
|
+
origin?: string;
|
|
146
|
+
destination?: string;
|
|
147
|
+
duration?: string;
|
|
148
|
+
stops?: string;
|
|
149
|
+
stopCount?: number;
|
|
150
|
+
/** "Sun, Oct 4". */
|
|
151
|
+
date?: string;
|
|
152
|
+
travelClass?: string;
|
|
153
|
+
/** "3 seats left" when the row says so and it is few. */
|
|
154
|
+
seatsLeft?: string;
|
|
155
|
+
/** A route-planner link (Rome2Rio, Wanderu) rather than one departure. */
|
|
156
|
+
isLink: boolean;
|
|
157
|
+
description?: string;
|
|
158
|
+
}
|
|
159
|
+
export declare const toGroundCard: (item: ResultItemLike, index: number, currency?: string) => GroundCardView | null;
|
|
160
|
+
/** Departures first, planner links after. */
|
|
161
|
+
export declare const toGroundCards: (a: ResultSetLike) => GroundCardView[];
|
|
162
|
+
export interface ProductCardView extends ResultCardBase, Rankable {
|
|
163
|
+
imageUrl?: string;
|
|
164
|
+
ratingText?: string;
|
|
165
|
+
reviewsText?: string;
|
|
166
|
+
/** "Was $129" when the row carries an original price. */
|
|
167
|
+
wasPrice?: string;
|
|
168
|
+
/** "Free delivery", "In stock" as the row states it. */
|
|
169
|
+
note?: string;
|
|
170
|
+
}
|
|
171
|
+
export declare const toProductCard: (item: ResultItemLike, index: number, currency?: string) => ProductCardView | null;
|
|
172
|
+
export declare const toProductCards: (a: ResultSetLike) => ProductCardView[];
|
|
173
|
+
export interface MovieShowtime {
|
|
174
|
+
time: string;
|
|
175
|
+
/** Booking link for that time, when the row has one per time. */
|
|
176
|
+
url?: string;
|
|
177
|
+
}
|
|
178
|
+
export interface MovieCardView extends ResultCardBase, Rankable {
|
|
179
|
+
posterUrl?: string;
|
|
180
|
+
/** "PG-13 · 2h 46m · Sci-Fi". */
|
|
181
|
+
meta?: string;
|
|
182
|
+
ratingText?: string;
|
|
183
|
+
theater?: string;
|
|
184
|
+
/** "1.2 mi · 123 Main St". */
|
|
185
|
+
place?: string;
|
|
186
|
+
/** "Today", "Sat, Oct 4". */
|
|
187
|
+
when?: string;
|
|
188
|
+
format?: string;
|
|
189
|
+
times: MovieShowtime[];
|
|
190
|
+
/** Showtimes past the ones the card shows. */
|
|
191
|
+
moreTimes: number;
|
|
192
|
+
}
|
|
193
|
+
export declare const toMovieCard: (item: ResultItemLike, index: number, currency?: string) => MovieCardView | null;
|
|
194
|
+
export declare const toMovieCards: (a: ResultSetLike) => MovieCardView[];
|
|
195
|
+
export interface JobCardView extends ResultCardBase, Rankable {
|
|
196
|
+
company?: string;
|
|
197
|
+
companyCode: string;
|
|
198
|
+
companyTone: number;
|
|
199
|
+
logoUrl?: string;
|
|
200
|
+
location?: string;
|
|
201
|
+
/** "Remote", "Hybrid", "On-site". */
|
|
202
|
+
workplace?: string;
|
|
203
|
+
salary?: string;
|
|
204
|
+
employmentType?: string;
|
|
205
|
+
/** "Today", "3d ago", "2w ago". */
|
|
206
|
+
posted?: string;
|
|
207
|
+
postedDays?: number;
|
|
208
|
+
snippet?: string;
|
|
209
|
+
easyApply: boolean;
|
|
210
|
+
}
|
|
211
|
+
/** Whole days since an ISO date; undefined for anything unparseable. */
|
|
212
|
+
export declare const daysSince: (iso: string | undefined, now: number) => number | undefined;
|
|
213
|
+
export declare const postedLabel: (days?: number) => string | undefined;
|
|
214
|
+
export declare const toJobCard: (item: ResultItemLike, index: number, now?: number) => JobCardView | null;
|
|
215
|
+
/** Jobs get no badges: "cheapest" means nothing and a rating is rarely there. */
|
|
216
|
+
export declare const toJobCards: (a: ResultSetLike, now?: number) => JobCardView[];
|
|
217
|
+
export interface ResumeCardView {
|
|
218
|
+
title: string;
|
|
219
|
+
subtitle?: string;
|
|
220
|
+
/** The person's name and headline, when the attachment carries the resume. */
|
|
221
|
+
name?: string;
|
|
222
|
+
headline?: string;
|
|
223
|
+
/** Top skills or sections, a few words each. */
|
|
224
|
+
tags: string[];
|
|
225
|
+
template?: string;
|
|
226
|
+
openUrl?: string;
|
|
227
|
+
downloadUrl?: string;
|
|
228
|
+
imageUrl?: string;
|
|
229
|
+
actionLabel: string;
|
|
230
|
+
accessibleLabel: string;
|
|
231
|
+
}
|
|
232
|
+
export declare const toResumeCard: (a: Record<string, unknown> | undefined) => ResumeCardView | null;
|
|
233
|
+
export declare const travelResultNoun: (kind: TravelResultKind) => [string, string];
|
|
234
|
+
export declare const staySummary: (a: ResultSetLike, cards?: StayCardView[]) => ResultSummary;
|
|
235
|
+
export declare const carSummary: (a: ResultSetLike, cards?: CarCardView[]) => ResultSummary;
|
|
236
|
+
export declare const groundSummary: (a: ResultSetLike, cards?: GroundCardView[]) => ResultSummary;
|
|
237
|
+
export declare const productSummary: (a: ResultSetLike, cards?: ProductCardView[]) => ResultSummary;
|
|
238
|
+
export declare const movieSummary: (a: ResultSetLike, cards?: MovieCardView[]) => ResultSummary;
|
|
239
|
+
export declare const jobSummary: (a: ResultSetLike, cards?: JobCardView[]) => ResultSummary;
|
|
240
|
+
export {};
|
|
241
|
+
//# sourceMappingURL=resultCards.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resultCards.d.ts","sourceRoot":"","sources":["../../src/utils/resultCards.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAcH,4EAA4E;AAC5E,MAAM,MAAM,WAAW,GAAG,UAAU,GAAG,SAAS,GAAG,WAAW,CAAC;AAE/D,eAAO,MAAM,gBAAgB,GAAI,OAAO,WAAW,KAAG,MAC+B,CAAC;AAEtF,wFAAwF;AACxF,MAAM,MAAM,UAAU,GAAG,aAAa,GAAG,UAAU,GAAG,SAAS,GAAG,QAAQ,GAAG,WAAW,GAAG,QAAQ,CAAC;AAEpG,kFAAkF;AAClF,MAAM,WAAW,cAAc;IAC3B,EAAE,CAAC,EAAE,MA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AwBhC,eAAO,MAAM,WAAW,GAAI,GAAG,aAAa,EAAE,sBAAsB,KAAG,aAqBlE,CAAC;AAEN,eAAO,MAAM,UAAU,GAAI,GAAG,aAAa,EAAE,qBAAqB,KAAG,aAqBhE,CAAC;AAEN,eAAO,MAAM,aAAa,GAAI,GAAG,aAAa,EAAE,wBAAwB,KAAG,aA0B1E,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,GAAG,aAAa,EAAE,yBAAyB,KAAG,aAuB5E,CAAC;AAEF,eAAO,MAAM,YAAY,GAAI,GAAG,aAAa,EAAE,uBAAuB,KAAG,aAkBxE,CAAC;AAEF,eAAO,MAAM,UAAU,GAAI,GAAG,aAAa,EAAE,qBAAqB,KAAG,aAYpE,CAAC"}
|
|
@@ -0,0 +1,640 @@
|
|
|
1
|
+
import {stopsLabel,dateLabel,durationLabel,airlineTone,airlineCode,flightPrice,flightPriceValue}from'./flightCards.js';/**
|
|
2
|
+
* Result cards for every chat widget that is a list of things to pick from:
|
|
3
|
+
* stays, rental cars, trains and buses, products, movie showtimes and jobs,
|
|
4
|
+
* plus the single resume card. Flights keep their own model (flightCards.ts);
|
|
5
|
+
* this file reuses its time, price and monogram helpers so a train reads the
|
|
6
|
+
* way a flight does.
|
|
7
|
+
*
|
|
8
|
+
* Every renderer (the tailwind chat cards on the web, any native twin) builds
|
|
9
|
+
* from these views, so the strings a card shows are decided once, here.
|
|
10
|
+
*
|
|
11
|
+
* Nothing here knows a provider. A seller's name comes from the row itself
|
|
12
|
+
* (`provider`, `merchant`, `sourceLabel`) or from the host of its link, never
|
|
13
|
+
* from a table of known sites.
|
|
14
|
+
*/
|
|
15
|
+
const resultBadgeLabel = (badge) => badge === 'cheapest' ? 'Cheapest' : badge === 'fastest' ? 'Fastest' : 'Top rated';
|
|
16
|
+
const str = (v) => (typeof v === 'string' && v.trim() ? v.trim() : undefined);
|
|
17
|
+
const num = (v) => (typeof v === 'number' && Number.isFinite(v) ? v : undefined);
|
|
18
|
+
const plural = (n, one, many = `${one}s`) => `${n} ${n === 1 ? one : many}`;
|
|
19
|
+
/** "www.booking.com" → "booking.com"; undefined for a hash or relative link. */
|
|
20
|
+
const hostLabel = (url) => {
|
|
21
|
+
if (!url || !/^https?:\/\//i.test(url))
|
|
22
|
+
return undefined;
|
|
23
|
+
try {
|
|
24
|
+
return new URL(url).hostname.replace(/^www\d?\./i, '') || undefined;
|
|
25
|
+
}
|
|
26
|
+
catch {
|
|
27
|
+
return undefined;
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
/** A source key as a name: "airbnb" → "Airbnb", "home-depot" → "Home depot". */
|
|
31
|
+
const titleCase = (s) => {
|
|
32
|
+
const t = s?.trim().replace(/[-_]+/g, ' ');
|
|
33
|
+
return t ? t.charAt(0).toUpperCase() + t.slice(1) : undefined;
|
|
34
|
+
};
|
|
35
|
+
/** The row's own name for where it is sold, else the link's host, else its source key. */
|
|
36
|
+
const sourceLabelOf = (item) => str(item.sourceLabel) ?? str(item.merchant) ?? str(item.provider) ?? hostLabel(item.url) ?? titleCase(item.source);
|
|
37
|
+
const priceOf = (item, currency) => flightPrice({ title: item.title ?? '', price: item.price, priceLabel: item.priceLabel }, item.currency ?? currency);
|
|
38
|
+
const priceValueOf = (item) => flightPriceValue({ title: item.title ?? '', price: item.price, priceLabel: item.priceLabel });
|
|
39
|
+
const ratingOf = (item) => {
|
|
40
|
+
const r = num(item.rating);
|
|
41
|
+
return r != null && r > 0 ? r : undefined;
|
|
42
|
+
};
|
|
43
|
+
const reviewsOf = (item) => {
|
|
44
|
+
const r = num(item.reviewCount) ?? num(item.reviews);
|
|
45
|
+
return r != null && r > 0 ? r : undefined;
|
|
46
|
+
};
|
|
47
|
+
/** "4.6" or "9.1"; scores over 5 are on a 10 scale and keep one decimal too. */
|
|
48
|
+
const ratingLabel = (rating) => rating != null && rating > 0 ? rating.toFixed(1) : undefined;
|
|
49
|
+
/** "1,284" with a compact fallback for very large counts: "12k". */
|
|
50
|
+
const countLabel = (n) => {
|
|
51
|
+
if (n == null || !Number.isFinite(n) || n <= 0)
|
|
52
|
+
return undefined;
|
|
53
|
+
if (n >= 10_000)
|
|
54
|
+
return `${Math.round(n / 1000)}k`;
|
|
55
|
+
return Math.round(n).toLocaleString('en-US');
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* Labels the standouts: the cheapest price and, per vertical, the fastest
|
|
59
|
+
* trip or the best rated. Each needs two candidates to mean anything, and a
|
|
60
|
+
* card already labelled cheapest is not also called top rated.
|
|
61
|
+
*/
|
|
62
|
+
const rank = (cards, wants) => {
|
|
63
|
+
const chosen = new Map();
|
|
64
|
+
if (wants.includes('cheapest')) {
|
|
65
|
+
const priced = cards.filter((c) => c.priceValue != null);
|
|
66
|
+
if (priced.length >= 2)
|
|
67
|
+
chosen.set('cheapest', [...priced].sort((a, b) => a.priceValue - b.priceValue)[0]);
|
|
68
|
+
}
|
|
69
|
+
if (wants.includes('fastest')) {
|
|
70
|
+
const timed = cards.filter((c) => c.minutes != null);
|
|
71
|
+
if (timed.length >= 2) {
|
|
72
|
+
const fastest = [...timed].sort((a, b) => a.minutes - b.minutes || (a.priceValue ?? Infinity) - (b.priceValue ?? Infinity))[0];
|
|
73
|
+
// A tie for fastest is not a standout.
|
|
74
|
+
if (timed.filter((c) => c.minutes === fastest.minutes).length === 1)
|
|
75
|
+
chosen.set('fastest', fastest);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
if (wants.includes('top-rated')) {
|
|
79
|
+
const rated = cards.filter((c) => c.rating != null);
|
|
80
|
+
if (rated.length >= 2) {
|
|
81
|
+
// Sites score out of 5 or out of 10; compare on one scale. Rating
|
|
82
|
+
// first, then how many people said so.
|
|
83
|
+
const score = (c) => (c.rating > 5 ? c.rating / 2 : c.rating);
|
|
84
|
+
const best = [...rated].sort((a, b) => score(b) - score(a) || (b.reviewCount ?? 0) - (a.reviewCount ?? 0))[0];
|
|
85
|
+
if (best !== chosen.get('cheapest'))
|
|
86
|
+
chosen.set('top-rated', best);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return cards.map((c) => {
|
|
90
|
+
const badges = wants.filter((b) => chosen.get(b) === c);
|
|
91
|
+
if (badges.length === 0)
|
|
92
|
+
return c.badges.length ? { ...c, badges: [] } : c;
|
|
93
|
+
const words = badges.map((b) => resultBadgeLabel(b).toLowerCase()).join(' and ');
|
|
94
|
+
return { ...c, badges, accessibleLabel: `${words}, ${c.accessibleLabel}` };
|
|
95
|
+
});
|
|
96
|
+
};
|
|
97
|
+
const stableSort = (cards, metric) => cards
|
|
98
|
+
.map((c, index) => ({ c, index, m: metric(c) }))
|
|
99
|
+
.sort((a, b) => (a.m < b.m ? -1 : a.m > b.m ? 1 : 0) || a.index - b.index)
|
|
100
|
+
.map((x) => x.c);
|
|
101
|
+
/** Orders any result cards; a metric a card lacks sorts it last. */
|
|
102
|
+
const sortResultCards = (cards, sort) => {
|
|
103
|
+
switch (sort) {
|
|
104
|
+
case 'cheapest':
|
|
105
|
+
return stableSort(cards, (c) => c.priceValue ?? Infinity);
|
|
106
|
+
case 'fastest':
|
|
107
|
+
return stableSort(cards, (c) => c.minutes ?? Infinity);
|
|
108
|
+
case 'rating':
|
|
109
|
+
return stableSort(cards, (c) => (c.rating != null ? -(c.rating > 5 ? c.rating / 2 : c.rating) : Infinity));
|
|
110
|
+
case 'departure':
|
|
111
|
+
return stableSort(cards, (c) => c.departTime ?? '99:99');
|
|
112
|
+
case 'newest':
|
|
113
|
+
return stableSort(cards, (c) => c.postedDays ?? Infinity);
|
|
114
|
+
default:
|
|
115
|
+
return cards;
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
const pickFor = (cards, badge, value, name) => {
|
|
119
|
+
const card = cards.find((c) => c.badges.includes(badge));
|
|
120
|
+
return card ? { badge, label: resultBadgeLabel(badge), key: card.key, value: value(card), name: name(card) } : null;
|
|
121
|
+
};
|
|
122
|
+
const fromPriceOf = (cards) => {
|
|
123
|
+
const priced = cards.filter((c) => c.priceValue != null);
|
|
124
|
+
return priced.length ? [...priced].sort((a, b) => a.priceValue - b.priceValue)[0].price : undefined;
|
|
125
|
+
};
|
|
126
|
+
const shortName = (s, max = 22) => s ? (s.length > max ? `${s.slice(0, max - 1).trimEnd()}…` : s) : undefined;
|
|
127
|
+
const GROUND_SOURCES = { trains: 'train', train: 'train', buses: 'bus', bus: 'bus' };
|
|
128
|
+
/** The kind of one travel row, from its own `kind`, then its source, then its price unit. */
|
|
129
|
+
const travelItemKind = (item) => {
|
|
130
|
+
const kind = str(item.kind)?.toLowerCase();
|
|
131
|
+
if (kind === 'car' || kind === 'train' || kind === 'bus')
|
|
132
|
+
return kind;
|
|
133
|
+
if (kind === 'hotel' || kind === 'stay')
|
|
134
|
+
return 'stay';
|
|
135
|
+
const ground = GROUND_SOURCES[str(item.source)?.toLowerCase() ?? ''];
|
|
136
|
+
if (ground)
|
|
137
|
+
return ground;
|
|
138
|
+
if (item.ground && typeof item.ground === 'object')
|
|
139
|
+
return 'train';
|
|
140
|
+
if (item.car && typeof item.car === 'object')
|
|
141
|
+
return 'car';
|
|
142
|
+
const source = str(item.source)?.toLowerCase();
|
|
143
|
+
if (source === 'cars' || source === 'turo')
|
|
144
|
+
return 'car';
|
|
145
|
+
if (item.priceUnit === 'day')
|
|
146
|
+
return 'car';
|
|
147
|
+
return 'stay';
|
|
148
|
+
};
|
|
149
|
+
/** The kind most rows in the set share, so one card style renders the whole row. */
|
|
150
|
+
const travelResultKind = (a) => {
|
|
151
|
+
const tally = new Map();
|
|
152
|
+
for (const p of a?.properties ?? []) {
|
|
153
|
+
const k = travelItemKind(p);
|
|
154
|
+
tally.set(k, (tally.get(k) ?? 0) + 1);
|
|
155
|
+
}
|
|
156
|
+
let best = 'stay';
|
|
157
|
+
let n = 0;
|
|
158
|
+
tally.forEach((count, k) => {
|
|
159
|
+
if (count > n) {
|
|
160
|
+
best = k;
|
|
161
|
+
n = count;
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
return best;
|
|
165
|
+
};
|
|
166
|
+
const perksOf = (item) => {
|
|
167
|
+
const raw = item.perks ?? item.amenities ?? item.highlights;
|
|
168
|
+
if (!Array.isArray(raw))
|
|
169
|
+
return [];
|
|
170
|
+
return raw
|
|
171
|
+
.map((p) => str(p))
|
|
172
|
+
.filter((p) => !!p)
|
|
173
|
+
.slice(0, 3);
|
|
174
|
+
};
|
|
175
|
+
const toStayCard = (item, index, currency) => {
|
|
176
|
+
const title = str(item.title);
|
|
177
|
+
if (!title)
|
|
178
|
+
return null;
|
|
179
|
+
const rating = ratingOf(item);
|
|
180
|
+
const reviewCount = reviewsOf(item);
|
|
181
|
+
const price = priceOf(item, currency);
|
|
182
|
+
const unit = str(item.priceUnit) ?? 'night';
|
|
183
|
+
const location = [str(item.area) ?? str(item.neighborhood), str(item.city)].filter(Boolean).join(', ') || undefined;
|
|
184
|
+
const sourceLabel = sourceLabelOf(item);
|
|
185
|
+
return {
|
|
186
|
+
key: item.id ?? `stay-${index}`,
|
|
187
|
+
url: str(item.url),
|
|
188
|
+
title,
|
|
189
|
+
imageUrl: str(item.imageUrl),
|
|
190
|
+
price,
|
|
191
|
+
priceValue: priceValueOf(item),
|
|
192
|
+
rating,
|
|
193
|
+
reviewCount,
|
|
194
|
+
ratingText: ratingLabel(rating),
|
|
195
|
+
reviewsText: countLabel(reviewCount),
|
|
196
|
+
unit,
|
|
197
|
+
location,
|
|
198
|
+
perks: perksOf(item),
|
|
199
|
+
description: str(item.description),
|
|
200
|
+
sourceLabel,
|
|
201
|
+
badges: [],
|
|
202
|
+
accessibleLabel: [
|
|
203
|
+
title,
|
|
204
|
+
location,
|
|
205
|
+
rating != null
|
|
206
|
+
? `rated ${ratingLabel(rating)}${reviewCount ? ` from ${countLabel(reviewCount)} reviews` : ''}`
|
|
207
|
+
: undefined,
|
|
208
|
+
price ? `${price} per ${unit}` : undefined,
|
|
209
|
+
sourceLabel && `on ${sourceLabel}`,
|
|
210
|
+
]
|
|
211
|
+
.filter(Boolean)
|
|
212
|
+
.join(', '),
|
|
213
|
+
};
|
|
214
|
+
};
|
|
215
|
+
const toStayCards = (a) => rank((a.properties ?? []).map((p, i) => toStayCard(p, i, a.currency)).filter((c) => !!c), ['cheapest', 'top-rated']);
|
|
216
|
+
const toCarCard = (item, index, currency) => {
|
|
217
|
+
const title = str(item.title);
|
|
218
|
+
if (!title)
|
|
219
|
+
return null;
|
|
220
|
+
const car = (item.car && typeof item.car === 'object' ? item.car : {});
|
|
221
|
+
const seats = num(car.seats) ?? num(item.seats);
|
|
222
|
+
const specs = [
|
|
223
|
+
str(car.vehicleClass) ?? str(item.vehicleClass) ?? str(item.carClass),
|
|
224
|
+
seats ? `${seats} seats` : undefined,
|
|
225
|
+
str(car.transmission) ?? str(item.transmission),
|
|
226
|
+
]
|
|
227
|
+
.filter(Boolean)
|
|
228
|
+
.join(' · ') || undefined;
|
|
229
|
+
const price = priceOf(item, currency);
|
|
230
|
+
const priceValue = priceValueOf(item);
|
|
231
|
+
const rating = ratingOf(item);
|
|
232
|
+
const reviewCount = reviewsOf(item);
|
|
233
|
+
const isTrips = str(item.source)?.toLowerCase() === 'turo';
|
|
234
|
+
const sourceLabel = sourceLabelOf(item);
|
|
235
|
+
const unit = str(item.priceUnit) ?? 'day';
|
|
236
|
+
return {
|
|
237
|
+
key: item.id ?? `car-${index}`,
|
|
238
|
+
url: str(item.url),
|
|
239
|
+
title,
|
|
240
|
+
imageUrl: str(item.imageUrl),
|
|
241
|
+
specs,
|
|
242
|
+
description: str(item.description),
|
|
243
|
+
price,
|
|
244
|
+
priceValue,
|
|
245
|
+
rating,
|
|
246
|
+
reviewCount,
|
|
247
|
+
ratingText: ratingLabel(rating),
|
|
248
|
+
reviewsText: reviewCount
|
|
249
|
+
? isTrips
|
|
250
|
+
? plural(reviewCount, 'trip')
|
|
251
|
+
: `${countLabel(reviewCount)} reviews`
|
|
252
|
+
: undefined,
|
|
253
|
+
unit,
|
|
254
|
+
isLink: priceValue == null,
|
|
255
|
+
sourceLabel,
|
|
256
|
+
badges: [],
|
|
257
|
+
accessibleLabel: [
|
|
258
|
+
title,
|
|
259
|
+
specs,
|
|
260
|
+
price ? `${price} per ${unit}` : 'search link',
|
|
261
|
+
sourceLabel && `on ${sourceLabel}`,
|
|
262
|
+
]
|
|
263
|
+
.filter(Boolean)
|
|
264
|
+
.join(', '),
|
|
265
|
+
};
|
|
266
|
+
};
|
|
267
|
+
/** Priced cars first, search links after: a link has nothing to compare. */
|
|
268
|
+
const toCarCards = (a) => {
|
|
269
|
+
const cards = (a.properties ?? []).map((p, i) => toCarCard(p, i, a.currency)).filter((c) => !!c);
|
|
270
|
+
return rank([...cards.filter((c) => !c.isLink), ...cards.filter((c) => c.isLink)], ['cheapest', 'top-rated']);
|
|
271
|
+
};
|
|
272
|
+
const HHMM = /^(\d{1,2}):(\d{2})/;
|
|
273
|
+
const clockOf = (v) => {
|
|
274
|
+
const s = str(v);
|
|
275
|
+
if (!s)
|
|
276
|
+
return undefined;
|
|
277
|
+
const iso = /T(\d{2}):(\d{2})/.exec(s);
|
|
278
|
+
if (iso)
|
|
279
|
+
return `${iso[1]}:${iso[2]}`;
|
|
280
|
+
const m = HHMM.exec(s);
|
|
281
|
+
return m ? `${m[1].padStart(2, '0')}:${m[2]}` : undefined;
|
|
282
|
+
};
|
|
283
|
+
const toGroundCard = (item, index, currency) => {
|
|
284
|
+
const title = str(item.title);
|
|
285
|
+
if (!title)
|
|
286
|
+
return null;
|
|
287
|
+
// Rows may carry the times flat (the resortifi connector) or in a `ground` block.
|
|
288
|
+
const g = (item.ground && typeof item.ground === 'object' ? item.ground : {});
|
|
289
|
+
const pick = (k) => g[k] ?? item[k];
|
|
290
|
+
const kind = travelItemKind(item);
|
|
291
|
+
const mode = kind === 'bus' ? 'bus' : 'train';
|
|
292
|
+
const departAt = str(pick('departAt'));
|
|
293
|
+
const departTime = clockOf(pick('departTime')) ?? clockOf(departAt);
|
|
294
|
+
const arriveTime = clockOf(pick('arriveTime')) ?? clockOf(pick('arriveAt'));
|
|
295
|
+
const offset = num(pick('arrivalDayOffset'));
|
|
296
|
+
const minutes = num(pick('durationMinutes'));
|
|
297
|
+
const stopCount = num(pick('stops'));
|
|
298
|
+
const operator = str(pick('operator')) ?? str(item.provider);
|
|
299
|
+
const seats = num(pick('seatsLeft'));
|
|
300
|
+
const isLink = str(item.provider) === 'link' || (!departTime && priceValueOf(item) == null);
|
|
301
|
+
const price = priceOf(item, currency);
|
|
302
|
+
const sourceLabel = str(item.provider) === 'link' ? hostLabel(str(item.url)) : sourceLabelOf(item);
|
|
303
|
+
const origin = str(pick('departStation')) ?? str(pick('origin'));
|
|
304
|
+
const destination = str(pick('arriveStation')) ?? str(pick('destination'));
|
|
305
|
+
return {
|
|
306
|
+
key: item.id ?? `${mode}-${index}`,
|
|
307
|
+
url: str(item.url),
|
|
308
|
+
title,
|
|
309
|
+
mode,
|
|
310
|
+
operator,
|
|
311
|
+
operatorCode: airlineCode(operator ?? title),
|
|
312
|
+
operatorTone: airlineTone(operator ?? title),
|
|
313
|
+
departTime,
|
|
314
|
+
arriveTime,
|
|
315
|
+
dayOffset: offset && offset > 0 ? `+${offset}` : undefined,
|
|
316
|
+
origin,
|
|
317
|
+
destination,
|
|
318
|
+
minutes: minutes && minutes > 0 ? minutes : undefined,
|
|
319
|
+
duration: durationLabel(minutes),
|
|
320
|
+
stops: stopsLabel(stopCount),
|
|
321
|
+
stopCount: stopCount != null && stopCount >= 0 ? stopCount : undefined,
|
|
322
|
+
date: dateLabel(str(pick('departDate')) ?? departAt),
|
|
323
|
+
travelClass: str(pick('travelClass')),
|
|
324
|
+
seatsLeft: seats != null && seats > 0 && seats <= 9 ? `${plural(seats, 'seat')} left` : undefined,
|
|
325
|
+
isLink,
|
|
326
|
+
description: str(item.description),
|
|
327
|
+
price,
|
|
328
|
+
priceValue: priceValueOf(item),
|
|
329
|
+
rating: ratingOf(item),
|
|
330
|
+
sourceLabel,
|
|
331
|
+
badges: [],
|
|
332
|
+
accessibleLabel: [
|
|
333
|
+
operator ?? title,
|
|
334
|
+
departTime &&
|
|
335
|
+
`${origin ?? ''} ${departTime} to ${destination ?? ''} ${arriveTime ?? ''}`.replace(/\s+/g, ' ').trim(),
|
|
336
|
+
stopsLabel(stopCount)?.toLowerCase(),
|
|
337
|
+
price,
|
|
338
|
+
sourceLabel && `on ${sourceLabel}`,
|
|
339
|
+
]
|
|
340
|
+
.filter(Boolean)
|
|
341
|
+
.join(', '),
|
|
342
|
+
};
|
|
343
|
+
};
|
|
344
|
+
/** Departures first, planner links after. */
|
|
345
|
+
const toGroundCards = (a) => {
|
|
346
|
+
const cards = (a.properties ?? [])
|
|
347
|
+
.map((p, i) => toGroundCard(p, i, a.currency))
|
|
348
|
+
.filter((c) => !!c);
|
|
349
|
+
return rank([...cards.filter((c) => !c.isLink), ...cards.filter((c) => c.isLink)], ['cheapest', 'fastest']);
|
|
350
|
+
};
|
|
351
|
+
const toProductCard = (item, index, currency) => {
|
|
352
|
+
const title = str(item.title);
|
|
353
|
+
if (!title)
|
|
354
|
+
return null;
|
|
355
|
+
const rating = ratingOf(item);
|
|
356
|
+
const reviewCount = reviewsOf(item);
|
|
357
|
+
const price = priceOf(item, currency);
|
|
358
|
+
const priceValue = priceValueOf(item);
|
|
359
|
+
const was = num(item.originalPrice) ?? num(item.oldPrice);
|
|
360
|
+
const wasPrice = was != null && priceValue != null && was > priceValue
|
|
361
|
+
? flightPrice({ price: was }, item.currency ?? currency)
|
|
362
|
+
: str(item.originalPriceLabel);
|
|
363
|
+
const sourceLabel = sourceLabelOf(item);
|
|
364
|
+
return {
|
|
365
|
+
key: item.id ?? `product-${index}`,
|
|
366
|
+
url: str(item.url),
|
|
367
|
+
title,
|
|
368
|
+
imageUrl: str(item.imageUrl),
|
|
369
|
+
price,
|
|
370
|
+
priceValue,
|
|
371
|
+
wasPrice: wasPrice ? `Was ${wasPrice}` : undefined,
|
|
372
|
+
rating: rating != null && rating <= 5 ? rating : undefined,
|
|
373
|
+
reviewCount,
|
|
374
|
+
ratingText: ratingLabel(rating),
|
|
375
|
+
reviewsText: countLabel(reviewCount),
|
|
376
|
+
note: str(item.delivery) ?? str(item.shipping) ?? str(item.availability),
|
|
377
|
+
sourceLabel,
|
|
378
|
+
badges: [],
|
|
379
|
+
accessibleLabel: [
|
|
380
|
+
title,
|
|
381
|
+
price,
|
|
382
|
+
rating != null
|
|
383
|
+
? `rated ${ratingLabel(rating)} of 5${reviewCount ? ` from ${countLabel(reviewCount)} reviews` : ''}`
|
|
384
|
+
: undefined,
|
|
385
|
+
sourceLabel && `at ${sourceLabel}`,
|
|
386
|
+
]
|
|
387
|
+
.filter(Boolean)
|
|
388
|
+
.join(', '),
|
|
389
|
+
};
|
|
390
|
+
};
|
|
391
|
+
const toProductCards = (a) => rank((a.properties ?? []).map((p, i) => toProductCard(p, i, a.currency)).filter((c) => !!c), ['cheapest', 'top-rated']);
|
|
392
|
+
const MAX_TIMES = 6;
|
|
393
|
+
const toMovieCard = (item, index, currency) => {
|
|
394
|
+
const title = str(item.title);
|
|
395
|
+
if (!title)
|
|
396
|
+
return null;
|
|
397
|
+
const runtime = durationLabel(num(item.runtimeMinutes));
|
|
398
|
+
const genres = Array.isArray(item.genres)
|
|
399
|
+
? item.genres
|
|
400
|
+
.map((g) => str(g))
|
|
401
|
+
.filter(Boolean)
|
|
402
|
+
.slice(0, 2)
|
|
403
|
+
.join(', ')
|
|
404
|
+
: undefined;
|
|
405
|
+
const meta = str(item.meta) ?? ([str(item.contentRating), runtime, genres].filter(Boolean).join(' · ') || undefined);
|
|
406
|
+
const rawTimes = Array.isArray(item.times) ? item.times : Array.isArray(item.showtimes) ? item.showtimes : [];
|
|
407
|
+
const times = rawTimes
|
|
408
|
+
.map((t) => {
|
|
409
|
+
if (typeof t === 'string')
|
|
410
|
+
return str(t) ? { time: t.trim() } : null;
|
|
411
|
+
if (t && typeof t === 'object') {
|
|
412
|
+
const o = t;
|
|
413
|
+
const time = str(o.time) ?? str(o.label);
|
|
414
|
+
return time ? { time, url: str(o.url) } : null;
|
|
415
|
+
}
|
|
416
|
+
return null;
|
|
417
|
+
})
|
|
418
|
+
.filter((t) => !!t);
|
|
419
|
+
const rating = ratingOf(item);
|
|
420
|
+
const priceFrom = num(item.priceFrom);
|
|
421
|
+
const price = priceFrom != null
|
|
422
|
+
? flightPrice({ price: priceFrom }, item.currency ?? currency)
|
|
423
|
+
: priceOf(item, currency);
|
|
424
|
+
const theater = str(item.theater);
|
|
425
|
+
const place = [str(item.distance), str(item.address)].filter(Boolean).join(' · ') || undefined;
|
|
426
|
+
const when = str(item.dateLabel) ?? dateLabel(str(item.date));
|
|
427
|
+
return {
|
|
428
|
+
key: item.id ?? `movie-${index}`,
|
|
429
|
+
url: str(item.url),
|
|
430
|
+
title,
|
|
431
|
+
posterUrl: str(item.imageUrl) ?? str(item.posterUrl),
|
|
432
|
+
meta,
|
|
433
|
+
rating,
|
|
434
|
+
ratingText: ratingLabel(rating),
|
|
435
|
+
theater,
|
|
436
|
+
place,
|
|
437
|
+
when,
|
|
438
|
+
format: str(item.format),
|
|
439
|
+
times: times.slice(0, MAX_TIMES),
|
|
440
|
+
moreTimes: Math.max(0, times.length - MAX_TIMES),
|
|
441
|
+
price: price ? `from ${price}` : undefined,
|
|
442
|
+
priceValue: priceFrom ?? priceValueOf(item),
|
|
443
|
+
sourceLabel: sourceLabelOf(item),
|
|
444
|
+
badges: [],
|
|
445
|
+
accessibleLabel: [
|
|
446
|
+
title,
|
|
447
|
+
meta,
|
|
448
|
+
theater && `at ${theater}`,
|
|
449
|
+
when,
|
|
450
|
+
times.length
|
|
451
|
+
? `showtimes ${times
|
|
452
|
+
.slice(0, MAX_TIMES)
|
|
453
|
+
.map((t) => t.time)
|
|
454
|
+
.join(', ')}`
|
|
455
|
+
: undefined,
|
|
456
|
+
]
|
|
457
|
+
.filter(Boolean)
|
|
458
|
+
.join(', '),
|
|
459
|
+
};
|
|
460
|
+
};
|
|
461
|
+
const toMovieCards = (a) => rank((a.properties ?? []).map((p, i) => toMovieCard(p, i, a.currency)).filter((c) => !!c), ['top-rated']);
|
|
462
|
+
const DAY_MS = 86_400_000;
|
|
463
|
+
/** Whole days since an ISO date; undefined for anything unparseable. */
|
|
464
|
+
const daysSince = (iso, now) => {
|
|
465
|
+
if (!iso)
|
|
466
|
+
return undefined;
|
|
467
|
+
const t = Date.parse(iso);
|
|
468
|
+
if (!Number.isFinite(t))
|
|
469
|
+
return undefined;
|
|
470
|
+
return Math.max(0, Math.floor((now - t) / DAY_MS));
|
|
471
|
+
};
|
|
472
|
+
const postedLabel = (days) => {
|
|
473
|
+
if (days == null)
|
|
474
|
+
return undefined;
|
|
475
|
+
if (days === 0)
|
|
476
|
+
return 'Today';
|
|
477
|
+
if (days < 7)
|
|
478
|
+
return `${days}d ago`;
|
|
479
|
+
if (days < 60)
|
|
480
|
+
return `${Math.floor(days / 7)}w ago`;
|
|
481
|
+
return `${Math.floor(days / 30)}mo ago`;
|
|
482
|
+
};
|
|
483
|
+
const workplaceOf = (item) => {
|
|
484
|
+
const w = str(item.workplace) ?? str(item.workplaceType);
|
|
485
|
+
if (w)
|
|
486
|
+
return titleCase(w.toLowerCase());
|
|
487
|
+
if (item.remote === true)
|
|
488
|
+
return 'Remote';
|
|
489
|
+
return undefined;
|
|
490
|
+
};
|
|
491
|
+
const salaryOf = (item) => {
|
|
492
|
+
const s = item.salary;
|
|
493
|
+
if (typeof s === 'string')
|
|
494
|
+
return str(s);
|
|
495
|
+
if (s && typeof s === 'object') {
|
|
496
|
+
const o = s;
|
|
497
|
+
const cur = str(o.currency) ?? 'USD';
|
|
498
|
+
const fmt = (v) => (v != null ? flightPrice({ price: v }, cur) : undefined);
|
|
499
|
+
const min = fmt(num(o.min));
|
|
500
|
+
const max = fmt(num(o.max));
|
|
501
|
+
const range = min && max && min !== max ? `${min} – ${max}` : (min ?? max);
|
|
502
|
+
const period = str(o.period) ?? str(o.interval);
|
|
503
|
+
return range ? (period ? `${range} / ${period}` : range) : undefined;
|
|
504
|
+
}
|
|
505
|
+
return undefined;
|
|
506
|
+
};
|
|
507
|
+
const toJobCard = (item, index, now = Date.now()) => {
|
|
508
|
+
const title = str(item.title);
|
|
509
|
+
if (!title)
|
|
510
|
+
return null;
|
|
511
|
+
const company = str(item.company) ?? str(item.companyName);
|
|
512
|
+
const postedDays = daysSince(str(item.postedAt) ?? str(item.datePosted), now);
|
|
513
|
+
const location = str(item.location);
|
|
514
|
+
const workplace = workplaceOf(item);
|
|
515
|
+
const salary = salaryOf(item);
|
|
516
|
+
const sourceLabel = sourceLabelOf({ ...item, provider: undefined });
|
|
517
|
+
return {
|
|
518
|
+
key: item.id ?? `job-${index}`,
|
|
519
|
+
url: str(item.url) ?? str(item.applyUrl),
|
|
520
|
+
title,
|
|
521
|
+
company,
|
|
522
|
+
companyCode: airlineCode(company ?? title),
|
|
523
|
+
companyTone: airlineTone(company ?? title),
|
|
524
|
+
logoUrl: str(item.logoUrl) ?? str(item.companyLogo),
|
|
525
|
+
location: workplace && location?.toLowerCase() === workplace.toLowerCase() ? undefined : location,
|
|
526
|
+
workplace,
|
|
527
|
+
salary,
|
|
528
|
+
employmentType: titleCase(str(item.employmentType)?.toLowerCase()),
|
|
529
|
+
postedDays,
|
|
530
|
+
posted: postedLabel(postedDays),
|
|
531
|
+
snippet: str(item.snippet),
|
|
532
|
+
easyApply: item.easyApply === true,
|
|
533
|
+
sourceLabel,
|
|
534
|
+
badges: [],
|
|
535
|
+
accessibleLabel: [
|
|
536
|
+
title,
|
|
537
|
+
company && `at ${company}`,
|
|
538
|
+
location,
|
|
539
|
+
workplace,
|
|
540
|
+
salary,
|
|
541
|
+
postedLabel(postedDays) && `posted ${postedLabel(postedDays).toLowerCase()}`,
|
|
542
|
+
]
|
|
543
|
+
.filter(Boolean)
|
|
544
|
+
.join(', '),
|
|
545
|
+
};
|
|
546
|
+
};
|
|
547
|
+
/** Jobs get no badges: "cheapest" means nothing and a rating is rarely there. */
|
|
548
|
+
const toJobCards = (a, now = Date.now()) => (a.properties ?? []).map((p, i) => toJobCard(p, i, now)).filter((c) => !!c);
|
|
549
|
+
const toResumeCard = (a) => {
|
|
550
|
+
if (!a || typeof a !== 'object')
|
|
551
|
+
return null;
|
|
552
|
+
const resume = (a.resume && typeof a.resume === 'object' ? a.resume : {});
|
|
553
|
+
const basics = (resume.basics && typeof resume.basics === 'object' ? resume.basics : resume);
|
|
554
|
+
const name = str(basics.name) ?? str(a.name);
|
|
555
|
+
const headline = str(basics.label) ?? str(basics.headline) ?? str(a.headline);
|
|
556
|
+
const skillsRaw = Array.isArray(resume.skills) ? resume.skills : Array.isArray(a.tags) ? a.tags : [];
|
|
557
|
+
const tags = skillsRaw
|
|
558
|
+
.map((s) => typeof s === 'string'
|
|
559
|
+
? str(s)
|
|
560
|
+
: s && typeof s === 'object'
|
|
561
|
+
? str(s.name)
|
|
562
|
+
: undefined)
|
|
563
|
+
.filter((s) => !!s)
|
|
564
|
+
.slice(0, 4);
|
|
565
|
+
const title = str(a.title) ?? (name ? `${name} — Resume` : 'Resume');
|
|
566
|
+
const openUrl = str(a.url);
|
|
567
|
+
const downloadUrl = str(a.downloadUrl);
|
|
568
|
+
if (!openUrl && !downloadUrl && !name && !str(a.title))
|
|
569
|
+
return null;
|
|
570
|
+
const template = titleCase(str(a.template));
|
|
571
|
+
return {
|
|
572
|
+
title,
|
|
573
|
+
subtitle: str(a.subtitle),
|
|
574
|
+
name,
|
|
575
|
+
headline,
|
|
576
|
+
tags,
|
|
577
|
+
template,
|
|
578
|
+
openUrl,
|
|
579
|
+
downloadUrl,
|
|
580
|
+
imageUrl: str(a.imageUrl),
|
|
581
|
+
actionLabel: str(a.actionLabel) ?? 'Open resume',
|
|
582
|
+
accessibleLabel: [title, headline, template && `${template} template`].filter(Boolean).join(', '),
|
|
583
|
+
};
|
|
584
|
+
};
|
|
585
|
+
// ─── Summaries for the header strip ──────────────────────────────
|
|
586
|
+
const travelResultNoun = (kind) => kind === 'car'
|
|
587
|
+
? ['car', 'cars']
|
|
588
|
+
: kind === 'train'
|
|
589
|
+
? ['train', 'trains']
|
|
590
|
+
: kind === 'bus'
|
|
591
|
+
? ['bus', 'buses']
|
|
592
|
+
: ['stay', 'stays'];
|
|
593
|
+
const summarise = (a, cards, noun, fallbackTitle, extra, picks, withFromPrice = true) => {
|
|
594
|
+
const count = num(a.totalCount) ?? cards.length;
|
|
595
|
+
const fromPrice = withFromPrice ? fromPriceOf(cards) : undefined;
|
|
596
|
+
return {
|
|
597
|
+
title: str(a.title) ?? fallbackTitle,
|
|
598
|
+
subtitle: str(a.subtitle) ??
|
|
599
|
+
[plural(count, noun[0], noun[1]), fromPrice && `from ${fromPrice}`, ...extra].filter(Boolean).join(' · '),
|
|
600
|
+
count,
|
|
601
|
+
fromPrice,
|
|
602
|
+
picks: picks.filter((p) => !!p),
|
|
603
|
+
};
|
|
604
|
+
};
|
|
605
|
+
const staySummary = (a, cards = toStayCards(a)) => summarise(a, cards, ['stay', 'stays'], str(a.city) ? `Stays in ${a.city}` : 'Stays', [], [
|
|
606
|
+
pickFor(cards, 'cheapest', (c) => c.price, (c) => shortName(c.title)),
|
|
607
|
+
pickFor(cards, 'top-rated', (c) => c.ratingText && `★ ${c.ratingText}`, (c) => shortName(c.title)),
|
|
608
|
+
]);
|
|
609
|
+
const carSummary = (a, cards = toCarCards(a)) => summarise(a, cards, ['car', 'cars'], str(a.city) ? `Cars in ${a.city}` : 'Rental cars', [], [
|
|
610
|
+
pickFor(cards, 'cheapest', (c) => c.price && `${c.price}/${c.unit}`, (c) => shortName(c.title)),
|
|
611
|
+
pickFor(cards, 'top-rated', (c) => c.ratingText && `★ ${c.ratingText}`, (c) => shortName(c.title)),
|
|
612
|
+
]);
|
|
613
|
+
const groundSummary = (a, cards = toGroundCards(a)) => {
|
|
614
|
+
const mode = cards.find((c) => !c.isLink)?.mode ?? cards[0]?.mode ?? 'train';
|
|
615
|
+
const noun = travelResultNoun(mode);
|
|
616
|
+
const dates = new Set(cards.filter((c) => !c.isLink).map((c) => c.date ?? ''));
|
|
617
|
+
const date = dates.size === 1 ? [...dates][0] || undefined : undefined;
|
|
618
|
+
return summarise(a, cards.filter((c) => !c.isLink), noun, mode === 'bus' ? 'Buses' : 'Trains', [date], [
|
|
619
|
+
pickFor(cards, 'cheapest', (c) => c.price, (c) => shortName(c.operator)),
|
|
620
|
+
pickFor(cards, 'fastest', (c) => c.duration, (c) => shortName(c.operator)),
|
|
621
|
+
]);
|
|
622
|
+
};
|
|
623
|
+
const productSummary = (a, cards = toProductCards(a)) => {
|
|
624
|
+
const query = str(a.query);
|
|
625
|
+
return summarise(a, cards, ['product', 'products'], query ? `Products for “${query}”` : 'Products', [], [
|
|
626
|
+
pickFor(cards, 'cheapest', (c) => c.price, (c) => c.sourceLabel ?? shortName(c.title)),
|
|
627
|
+
pickFor(cards, 'top-rated', (c) => c.ratingText && `★ ${c.ratingText}`, (c) => c.sourceLabel ?? shortName(c.title)),
|
|
628
|
+
]);
|
|
629
|
+
};
|
|
630
|
+
const movieSummary = (a, cards = toMovieCards(a)) => {
|
|
631
|
+
const theaters = new Set(cards.map((c) => c.theater).filter(Boolean));
|
|
632
|
+
return summarise(a, cards, ['showing', 'showings'], str(a.city) ? `Showtimes in ${a.city}` : 'Showtimes', [str(a.dateLabel), theaters.size > 1 ? plural(theaters.size, 'theater') : [...theaters][0]], [
|
|
633
|
+
pickFor(cards, 'top-rated', (c) => c.ratingText && `★ ${c.ratingText}`, (c) => shortName(c.title)),
|
|
634
|
+
], false);
|
|
635
|
+
};
|
|
636
|
+
const jobSummary = (a, cards = toJobCards(a)) => {
|
|
637
|
+
const query = str(a.query);
|
|
638
|
+
const remote = cards.filter((c) => c.workplace === 'Remote').length;
|
|
639
|
+
return summarise(a, cards, ['role', 'roles'], query ? `Jobs for “${query}”` : 'Jobs', [remote ? `${remote} remote` : undefined, str(a.location)], [], false);
|
|
640
|
+
};export{carSummary,countLabel,daysSince,groundSummary,hostLabel,jobSummary,movieSummary,postedLabel,productSummary,ratingLabel,resultBadgeLabel,sortResultCards,sourceLabelOf,staySummary,toCarCard,toCarCards,toGroundCard,toGroundCards,toJobCard,toJobCards,toMovieCard,toMovieCards,toProductCard,toProductCards,toResumeCard,toStayCard,toStayCards,travelItemKind,travelResultKind,travelResultNoun};//# sourceMappingURL=resultCards.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resultCards.js","sources":["../../src/utils/resultCards.ts"],"sourcesContent":[null],"names":[],"mappings":"uHAAA;;;;;;;;;;;;;AAaG;AAeS,sBAAc,GAAA,CAAA,UAAa,KAAS,eAAe,GAAA,UAAA,GAAA,KAAA,KAAA,SAAA,GAAA,SAAA,GAAA;AAE/D,MAAA,GAAA,GAAA,CAAA,CAAA,aAAa,CAAA,KAAA,cAA2B,IAAA,EAAA,GAAA,CAAA,CAAW,IAAA,cACmC,CAAA;AAEtF,MAAA,GAAA,GAAA,CAAA,CAAA,MAAA,OAAA,CAAA,KAAA,QAAA,IAAA,MAAA,CAAA,QAAA,CAAA,CAAA,CAAA,GAAA,CAAA,GAAA,SAAA,CAAA;AACA,MAAM,MAAM,GAAA,CAAA,CAAA,EAAA,GAAU,EAAA,IAAG,GAAA,CAAA,EAAA,GAAA,CAAa,OAAG,CAAA,EAAA,CAAA,CAAA,CAAU,EAAA,CAAG,KAAA,CAAA,GAAS,GAAG,GAAA,IAAA,CAAQ,CAAA;AAE1E;eACiB,GAAA,CAAA,GAAA,KAAc;IAC3B,IAAG,CAAE,GAAA,IAAO,CAAA,eAAA,CAAA,IAAA,CAAA,GAAA,CAAA;QACZ,OAAQ,SAAO;IACf,IAAI;QACJ,OAAW,IAAA,GAAO,CAAA,GAAA,CAAA,CAAA,QAAA,CAAA,OAAA,CAAA,YAAA,EAAA,EAAA,CAAA,IAAA,SAAA;IAClB;IACA,MAAA;QACA,OAAU,SAAS;IACnB;;;MAGA,SAAU,GAAA,CAAA,CAAM,KAAC;IACjB,MAAM,CAAC,GAAE,CAAA,EAAA,IAAO,E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,CAAY;AA0CzB,IAAA,MAAA,WAAa,GAAA,SAAA,CAAA,IAAgB,CAAA;AA+B7B,IAAA,MAAA,OAAO,GAAA,eAAqB,CAAA,EAAG,aAAa,KAAE,MAAA;AAuB9C,IAAA,MAAA,WAAa,gBAAiB;AAuB9B,IAAA,MAAA,IAAA,GAAO,GAAA,CAAM,cAAa,CAAA,IAAO;AA4BjC,IAAA,OAAA;AAyBA,QAAA,GAAA,EAAA,IAAO,CAAA,EAAA,gBAAsB,CAAA,CAAA;AAoB7B,QAAA,GAAA,EAAA,GAAO,CAAA,IAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resultCards.test.d.ts","sourceRoot":"","sources":["../../src/utils/resultCards.test.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@admin-layout/client",
|
|
3
|
-
"version": "12.2.5-alpha.
|
|
3
|
+
"version": "12.2.5-alpha.7",
|
|
4
4
|
"description": "Sample client for higher packages to depend on",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"author": "CDMBase LLC",
|
|
@@ -44,5 +44,5 @@
|
|
|
44
44
|
"typescript": {
|
|
45
45
|
"definition": "lib/index.d.ts"
|
|
46
46
|
},
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "dec02b0e09611dc2f8e3685eb5f0cfbba00aae9a"
|
|
48
48
|
}
|