@wayke-se/components-react 5.2.0-beta.0 → 6.0.0-beta.0

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.
Files changed (126) hide show
  1. package/README.md +222 -122
  2. package/dist/index.js +1365 -1489
  3. package/dist/index.js.map +4 -4
  4. package/dist/index.mjs +1381 -1505
  5. package/dist/index.mjs.map +4 -4
  6. package/dist/types/src/@types/filter.d.ts +7 -1
  7. package/dist/types/src/Gql/ad/legacyWaykeId.d.ts +1 -0
  8. package/dist/types/src/Gql/ad/propertyTree.d.ts +5 -0
  9. package/dist/types/src/Gql/ad/queries.d.ts +9 -0
  10. package/dist/types/src/Gql/ad/types.d.ts +378 -0
  11. package/dist/types/src/Gql/ad/useAd.d.ts +8 -0
  12. package/dist/types/src/Gql/ad/useInsuranceInquiry.d.ts +11 -0
  13. package/dist/types/src/Gql/ad/useLoanCalculation.d.ts +14 -0
  14. package/dist/types/src/Gql/ad/useRelatedAds.d.ts +12 -0
  15. package/dist/types/src/Gql/ad/view.d.ts +94 -0
  16. package/dist/types/src/Gql/client.d.ts +11 -0
  17. package/dist/types/src/Gql/config.d.ts +9 -0
  18. package/dist/types/src/Gql/facets.d.ts +19 -0
  19. package/dist/types/src/Gql/hit.d.ts +5 -0
  20. package/dist/types/src/Gql/legacyParams.d.ts +7 -0
  21. package/dist/types/src/Gql/queries.d.ts +17 -0
  22. package/dist/types/src/Gql/searchParams.d.ts +55 -0
  23. package/dist/types/src/Gql/suggest.d.ts +8 -0
  24. package/dist/types/src/Gql/types.d.ts +131 -0
  25. package/dist/types/src/Gql/useAdsSearch.d.ts +21 -0
  26. package/dist/types/src/State/Ad/AdContext.d.ts +5 -0
  27. package/dist/types/src/State/Router/RouterContext.d.ts +15 -0
  28. package/dist/types/src/State/Router/RouterProvider.d.ts +6 -0
  29. package/dist/types/src/State/Router/useRouter.d.ts +2 -0
  30. package/dist/types/src/State/Search/SearchContext.d.ts +15 -9
  31. package/dist/types/src/State/Search/SearchProvider.d.ts +1 -5
  32. package/dist/types/src/State/Settings/SettingsContext.d.ts +2 -12
  33. package/dist/types/src/State/Settings/settings.d.ts +56 -0
  34. package/dist/types/src/State/Settings/useSettings.d.ts +1 -1
  35. package/dist/types/src/components/ActionList/index.d.ts +3 -10
  36. package/dist/types/src/components/DocumentList/index.d.ts +3 -3
  37. package/dist/types/src/components/Filter/index.d.ts +1 -3
  38. package/dist/types/src/components/FilterPanel/checkListFacet.d.ts +2 -3
  39. package/dist/types/src/components/FilterPanel/colorFacet.d.ts +2 -3
  40. package/dist/types/src/components/FilterPanel/faceSelector.d.ts +2 -3
  41. package/dist/types/src/components/FilterPanel/index.d.ts +8 -15
  42. package/dist/types/src/components/FilterPanel/rangeFacet.d.ts +3 -3
  43. package/dist/types/src/components/FinancialOptions/LoanModal.d.ts +3 -7
  44. package/dist/types/src/components/FinancialOptions/index.d.ts +5 -7
  45. package/dist/types/src/components/FinancialOptions/leasing.d.ts +3 -3
  46. package/dist/types/src/components/FinancialOptions/loan.d.ts +3 -7
  47. package/dist/types/src/components/Gallery/index.d.ts +3 -5
  48. package/dist/types/src/components/Grid/index.d.ts +3 -7
  49. package/dist/types/src/components/InsuranceOptions/Insurance.d.ts +4 -6
  50. package/dist/types/src/components/InsuranceOptions/InsuranceFree.d.ts +5 -7
  51. package/dist/types/src/components/InsuranceOptions/InsuranceFreeModal.d.ts +4 -4
  52. package/dist/types/src/components/InsuranceOptions/InsuranceModal.d.ts +4 -6
  53. package/dist/types/src/components/InsuranceOptions/index.d.ts +5 -6
  54. package/dist/types/src/components/LeadForm/index.d.ts +1 -6
  55. package/dist/types/src/components/Lightbox/index.d.ts +2 -2
  56. package/dist/types/src/components/Map/index.d.ts +4 -2
  57. package/dist/types/src/components/OpeningHours/index.d.ts +2 -2
  58. package/dist/types/src/components/ProductCard/HitCard.d.ts +10 -0
  59. package/dist/types/src/components/ProductCard/index.d.ts +9 -13
  60. package/dist/types/src/components/SearchBar/index.d.ts +4 -1
  61. package/dist/types/src/components/SearchBar/wrapper.d.ts +10 -0
  62. package/dist/types/src/components/SortSelect/index.d.ts +1 -2
  63. package/dist/types/src/hooks/useSubmitLead.d.ts +1 -1
  64. package/dist/types/src/index.d.ts +5 -4
  65. package/dist/types/src/layouts/WaykeComposite.d.ts +3 -8
  66. package/dist/types/src/layouts/WaykeCompositeWithProvider.d.ts +1 -1
  67. package/dist/types/src/layouts/search/index.d.ts +6 -7
  68. package/dist/types/src/layouts/searchItem/Accessories/AccessoryModal.d.ts +2 -2
  69. package/dist/types/src/layouts/searchItem/Accessories/index.d.ts +2 -2
  70. package/dist/types/src/layouts/searchItem/Branch.d.ts +3 -4
  71. package/dist/types/src/layouts/searchItem/CheckList.d.ts +3 -15
  72. package/dist/types/src/layouts/searchItem/Documents.d.ts +2 -2
  73. package/dist/types/src/layouts/searchItem/ManufacturerPackagesOption.d.ts +2 -2
  74. package/dist/types/src/layouts/searchItem/PackageOptions.d.ts +3 -3
  75. package/dist/types/src/layouts/searchItem/Property.d.ts +1 -6
  76. package/dist/types/src/layouts/searchItem/Related.d.ts +5 -6
  77. package/dist/types/src/layouts/searchItem/index.d.ts +8 -6
  78. package/dist/types/src/layouts/searchItem/useEcom.d.ts +7 -3
  79. package/dist/types/src/providers/WaykeProvider.d.ts +7 -21
  80. package/dist/types/src/utils/image.d.ts +14 -0
  81. package/dist/types/src/utils/sortOptions.d.ts +4 -13
  82. package/package.json +10 -16
  83. package/dist/types/src/@types/action.d.ts +0 -3
  84. package/dist/types/src/@types/codegen/types.d.ts +0 -433
  85. package/dist/types/src/@types/queryFilter.d.ts +0 -5
  86. package/dist/types/src/@types/search.d.ts +0 -114
  87. package/dist/types/src/State/CentralStorage/CentralStorageContext.d.ts +0 -5
  88. package/dist/types/src/State/CentralStorage/CentralStorageProvider.d.ts +0 -6
  89. package/dist/types/src/State/CentralStorage/useCentralStorage.d.ts +0 -6
  90. package/dist/types/src/State/Path/PathContext.d.ts +0 -8
  91. package/dist/types/src/State/Path/PathProvider.d.ts +0 -6
  92. package/dist/types/src/State/Path/reducer.d.ts +0 -14
  93. package/dist/types/src/State/Path/usePath.d.ts +0 -3
  94. package/dist/types/src/State/RelatedSearch/RelatedSearchContext.d.ts +0 -9
  95. package/dist/types/src/State/RelatedSearch/RelatedSearchProvider.d.ts +0 -9
  96. package/dist/types/src/State/RelatedSearch/useRelatedSearch.d.ts +0 -2
  97. package/dist/types/src/State/Settings/SettingsProvider.d.ts +0 -11
  98. package/dist/types/src/components/Video/QuickNavVideo.d.ts +0 -7
  99. package/dist/types/src/hooks/apolloTypes.d.ts +0 -6
  100. package/dist/types/src/hooks/useHasBeenVisible.d.ts +0 -2
  101. package/dist/types/src/hooks/useHashGuid.d.ts +0 -2
  102. package/dist/types/src/hooks/useInsurance.d.ts +0 -4
  103. package/dist/types/src/hooks/useLoan.d.ts +0 -4
  104. package/dist/types/src/hooks/useOnScreen.d.ts +0 -2
  105. package/dist/types/src/hooks/usePrevious.d.ts +0 -2
  106. package/dist/types/src/hooks/useSearchItem.d.ts +0 -4
  107. package/dist/types/src/hooks/useSearchItemBranch.d.ts +0 -4
  108. package/dist/types/src/hooks/useSessionStorage.d.ts +0 -7
  109. package/dist/types/src/layouts/searchItem/BranchModal.d.ts +0 -9
  110. package/dist/types/src/providers/WaykeItemProvidet.d.ts +0 -24
  111. package/dist/types/src/providers/graphqlProvider.d.ts +0 -6
  112. package/dist/types/src/queries/INSURANCE_CALCULATION.d.ts +0 -2
  113. package/dist/types/src/queries/LOAN_CALCULATION.d.ts +0 -2
  114. package/dist/types/src/queries/SEARCH_ITEM_BRANCH_QUERY.d.ts +0 -2
  115. package/dist/types/src/queries/SEARCH_ITEM_QUERY.d.ts +0 -2
  116. package/dist/types/src/utils/deep-copy.d.ts +0 -5
  117. package/dist/types/src/utils/regex.d.ts +0 -3
  118. package/dist/types/src/utils/specification.d.ts +0 -28
  119. package/dist/types/src/utils/url.d.ts +0 -1
  120. package/dist/types/src/utils/vehicle-properties/compare-basic-properties.d.ts +0 -3
  121. package/dist/types/src/utils/vehicle-properties/compare-categories.d.ts +0 -3
  122. package/dist/types/src/utils/vehicle-properties/compare-properties.d.ts +0 -3
  123. package/dist/types/src/utils/vehicle-properties/custom-property-adder.d.ts +0 -13
  124. package/dist/types/src/utils/vehicle-properties/property-remover.d.ts +0 -7
  125. package/dist/types/src/utils/vehicle-properties/property-tree-creator.d.ts +0 -31
  126. package/dist/types/src/utils/vehicle-properties/property-tree-sorter.d.ts +0 -3
@@ -1,5 +1,11 @@
1
- export type SearchFilterNameTypes = 'manufacturer' | 'modelSeries' | 'fuelType' | 'gearboxType' | 'branch' | 'color' | 'environmentClass' | 'properties.segment' | 'drivingWheel' | 'price' | 'mileage' | 'odometerValueAsKm' | 'modelYear' | 'leasingPrice' | 'businessLeasingPrice';
1
+ /** The filters the panel can show, named as their URL keys (see Gql/searchParams.ts). */
2
+ export type SearchFilterNameTypes = 'manufacturer' | 'model' | 'modelSeries' | 'fuelType' | 'gearboxType' | 'branchDisplayName' | 'branchCity' | 'colorName' | 'environmentClass' | 'segment' | 'bodyStyle' | 'trimLevel' | 'inventoryStatus' | 'drivetrainType' | 'engineBaseType' | 'price' | 'odometer' | 'modelYear' | 'privateLease' | 'businessLease';
2
3
  export type SearchFilterTypes = {
3
4
  filterName: SearchFilterNameTypes;
4
5
  displayName?: string;
5
6
  };
7
+ /** Filter names from before 6.0 → their name now. */
8
+ export declare const LEGACY_FILTER_NAMES: Record<string, SearchFilterNameTypes>;
9
+ export declare const DEFAULT_FILTER_LIST: SearchFilterTypes[];
10
+ /** The filter list with old names translated and duplicates (mileage + odometerValueAsKm) dropped. */
11
+ export declare const resolveFilterList: (filterList?: SearchFilterTypes[]) => SearchFilterTypes[];
@@ -0,0 +1 @@
1
+ export declare const legacyWaykeIdFromIterationId: (iterationId: string | null | undefined, fallback: string) => string;
@@ -0,0 +1,5 @@
1
+ import { TFunction } from 'i18next';
2
+ import { Tree } from '../../@types/vehicle-properties';
3
+ import { Ad } from './types';
4
+ declare const propertyTree: (ad: Ad, t: TFunction) => Tree;
5
+ export default propertyTree;
@@ -0,0 +1,9 @@
1
+ export declare const AD_QUERY = "\nquery Ad($id: ID!) {\n ads {\n byAdId(ID: $id) {\n id\n branchId\n createdAt\n salesDescription { title enriched }\n packaging {\n isDemoVersion\n certifiedPreOwned\n selectedPackaging { id title description imageUrl ctaUrl ctaName }\n }\n channels {\n __typename\n ... on PlatformChannel {\n status\n inventoryStatus\n publishedAt\n soldAt\n deliveryTime { __typename ... on DeliveryDate { date } ... on DeliveryInterval { from to unit } }\n }\n }\n pricing {\n primaryPriceType\n cash { price { amount } oldPrice { amount } deductibleVat }\n leasing { issuer leasingMonthlyPayment { amount } contractMonthsRemaining contractKilometersRemaining }\n companyLeasing { issuer leasingMonthlyPayment { amount } contractMonthsRemaining contractKilometersRemaining }\n }\n leasingPromos { id title description image periodMonths mileagePerYear isBusinessLeasing link { url name } }\n media(limit: 60) {\n totalCount\n items {\n __typename\n ... on AdImage { id url sortOrder mediaType formats { format url } }\n ... on Ad360ImageGroup { id sortOrder images { id url } }\n ... on AdEmbeddedVideo { id externalUrl sortOrder }\n }\n }\n equipment { items { name } }\n accessories {\n id name price salePrice assemblyPrice shortDescription longDescription logoUrl\n productPageLink productPageLinkText articleNumber manufacturer model\n media { url sortOrder }\n }\n warrantyInfo { content { __typename ... on AdSpecificText { text } ... on StandardText { text } ... on StructuredWarranty { text } } }\n offerings {\n warranties {\n included\n text\n definition { id name description logoUrl externalUrl usps }\n }\n }\n exchangePolicy { enabled }\n contactOption {\n __typename\n ... on Branch { id displayName }\n ... on AdDefaultContactOptions { displayName telephone email title }\n ... on AssignedUser { displayName telephone email title }\n }\n branch {\n id displayName description street zip city latitude longitude homePage logo market\n contactInformation { telephone email }\n adDefaultContactOptions { displayName telephone email title avatarUrl }\n weekOpeningHours { openingHours { dayOfWeek openFrom openTo } }\n isAutomotiveAssociationVerified\n promos { id title description image link { url name } }\n }\n authorizedResellerForManufacturer\n iteration {\n id\n displayName\n item {\n __typename\n ... on Vehicle {\n displayName\n registrationNumber { stringValue }\n vin { formattedValue }\n manufacturer { stringValue }\n modelSeries { stringValue }\n modelName { stringValue }\n modelYear { intValue }\n manufactureYear { intValue }\n salesName { stringValue }\n driveline { fuelTypesString { stringValue } }\n attributes {\n transmission { formattedValue }\n enginePower { intValue formattedValue }\n byCategory {\n categoryId displayName\n values { __typename key label formattedValue }\n categories { categoryId displayName values { __typename key label formattedValue } }\n }\n }\n }\n }\n logistics { odometerReading { value unit } }\n commerce {\n enabled disabledOnWayke allowTradeIn homeDelivery reserved\n insuranceProvider {\n institute identifier logo title description longDescription url\n insuranceHeader ecomInsuranceText requiresPersonalNumber requiresDistance\n }\n paymentDetailsList {\n financialOptionId name description financialInstitution monthlyCost interest effectiveInterest\n setupFee administrationFee totalCreditCost totalResidualValue loanAmount imageUrl link linkText\n duration { min max step default current }\n downPayment { min max step default current }\n residual { min max step default current }\n }\n }\n documents { public { id name contentType uri category sortOrder } }\n }\n }\n }\n}\n";
2
+ /**
3
+ * Older ads carry a legacy id that differs from ad.id. ads.byIterationId accepts a
4
+ * bare GUID and resolves it to the ad, with the same visibility rules as byAdId.
5
+ */
6
+ export declare const AD_ID_BY_LEGACY_ID_QUERY = "\nquery AdIdByLegacyId($id: ID!) {\n ads { byIterationId(iterationId: $id) { ads { id } } }\n}\n";
7
+ export declare const CALCULATE_PAYMENT_QUERY = "\nquery CalculatePayment($id: ID!, $config: PaymentDetailsInput!) {\n ads {\n byAdId(ID: $id) {\n iteration {\n commerce {\n calculatePayment(config: $config) {\n financialOptionId monthlyCost interest effectiveInterest setupFee administrationFee\n totalCreditCost totalResidualValue loanAmount\n duration { min max step default current }\n downPayment { min max step default current }\n residual { min max step default current }\n }\n }\n }\n }\n }\n}\n";
8
+ export declare const INSURANCE_INQUIRY_QUERY = "\nquery InsuranceInquiry($id: ID!, $socialId: String!, $drivingDistance: DrivingDistance!) {\n ads {\n byAdId(ID: $id) {\n iteration {\n commerce {\n insuranceInquiry(socialId: $socialId, drivingDistance: $drivingDistance) {\n insurances {\n name price unit description branding legalUrl legalDescription\n details { institute logo terms }\n insuranceItems { name description }\n addons { id title price description exclude }\n }\n }\n }\n }\n }\n }\n}\n";
9
+ export declare const RELATED_ADS_QUERY = "\nquery RelatedAds($market: [String], $branchGroupId: String, $manufacturer: [String], $perPage: Int) {\n search {\n ads(market: $market, branchGroupId: $branchGroupId, manufacturer: $manufacturer, perPage: $perPage, soldWithinDays: 0, sort: { field: publishedAt, direction: desc }) {\n found\n hits { \n ad {\n id\n salesDescription { title }\n pricing {\n cash { price { amount } oldPrice { amount } deductibleVat }\n leasing { leasingMonthlyPayment { amount } }\n companyLeasing { leasingMonthlyPayment { amount } }\n }\n media(limit: 1) { items { ... on AdImage { id url formats { format url } } } }\n branch { id displayName }\n channels { ... on PlatformChannel { status soldAt } }\n }\n iteration {\n logistics { odometerReading { value unit } }\n item {\n ... on Vehicle {\n displayName\n manufacturer { stringValue }\n modelSeries { stringValue }\n modelYear { intValue }\n registrationNumber { stringValue }\n driveline { fuelTypesString { stringValue } }\n attributes { transmission { formattedValue } }\n }\n }\n }\n }\n }\n }\n}\n";
@@ -0,0 +1,378 @@
1
+ interface Money {
2
+ amount: string;
3
+ }
4
+ export interface AdTextContent {
5
+ content: {
6
+ __typename: string;
7
+ text?: string | null;
8
+ }[] | null;
9
+ }
10
+ export interface AdWarranty {
11
+ included: boolean;
12
+ text: string;
13
+ definition: {
14
+ id: string;
15
+ name: string;
16
+ description: string | null;
17
+ logoUrl: string | null;
18
+ externalUrl: string | null;
19
+ usps: string[];
20
+ };
21
+ }
22
+ export interface PaymentRange {
23
+ min: string | number;
24
+ max: string | number;
25
+ step: string | number;
26
+ default: string | number;
27
+ current: string | number;
28
+ }
29
+ export interface PaymentResponse {
30
+ financialOptionId: string;
31
+ name?: string | null;
32
+ description?: string | null;
33
+ financialInstitution?: string;
34
+ monthlyCost: string | number;
35
+ interest: string | number;
36
+ effectiveInterest: string | number;
37
+ setupFee: string | number;
38
+ administrationFee: string | number;
39
+ totalCreditCost: string | number;
40
+ totalResidualValue: string | number;
41
+ loanAmount: string | number;
42
+ imageUrl?: string | null;
43
+ link?: string | null;
44
+ linkText?: string | null;
45
+ duration: PaymentRange;
46
+ downPayment: PaymentRange;
47
+ residual: PaymentRange | null;
48
+ }
49
+ export interface InsuranceProvider {
50
+ institute: string;
51
+ identifier: string;
52
+ logo: string | null;
53
+ title: string;
54
+ description: string;
55
+ longDescription: string;
56
+ url: string;
57
+ insuranceHeader: string | null;
58
+ ecomInsuranceText: string | null;
59
+ requiresPersonalNumber: boolean;
60
+ requiresDistance: boolean;
61
+ }
62
+ export interface AdMediaItem {
63
+ __typename: 'AdImage' | 'Ad360ImageGroup' | 'AdEmbeddedVideo';
64
+ id: string;
65
+ sortOrder: number;
66
+ url?: string;
67
+ /** SPHERE for a panorama image */
68
+ mediaType?: string | null;
69
+ formats?: {
70
+ format: string;
71
+ url: string;
72
+ }[];
73
+ images?: {
74
+ id: string;
75
+ url: string;
76
+ }[];
77
+ externalUrl?: string;
78
+ }
79
+ export interface AttributeValue {
80
+ __typename?: string;
81
+ key: string;
82
+ label: string;
83
+ formattedValue: string;
84
+ }
85
+ export interface AttributeCategory {
86
+ categoryId: string;
87
+ displayName: string;
88
+ values: AttributeValue[];
89
+ categories?: AttributeCategory[];
90
+ }
91
+ export interface AdDocument {
92
+ id: string;
93
+ name: string;
94
+ contentType: string;
95
+ uri: string;
96
+ category: string | null;
97
+ sortOrder: number | null;
98
+ }
99
+ export interface Ad {
100
+ id: string;
101
+ branchId: string;
102
+ createdAt: string;
103
+ salesDescription: {
104
+ title: string;
105
+ enriched: string;
106
+ } | null;
107
+ packaging: {
108
+ isDemoVersion: boolean;
109
+ certifiedPreOwned: boolean;
110
+ selectedPackaging: {
111
+ id: string;
112
+ title: string;
113
+ description: string;
114
+ imageUrl: string;
115
+ ctaUrl: string;
116
+ ctaName: string;
117
+ }[];
118
+ };
119
+ channels: {
120
+ __typename: string;
121
+ status?: string;
122
+ inventoryStatus?: string;
123
+ publishedAt?: string | null;
124
+ soldAt?: string | null;
125
+ deliveryTime?: {
126
+ __typename: string;
127
+ date?: string;
128
+ from?: string;
129
+ to?: string;
130
+ unit?: string;
131
+ } | null;
132
+ }[];
133
+ pricing: {
134
+ primaryPriceType: string | null;
135
+ cash: {
136
+ price: Money;
137
+ oldPrice: Money | null;
138
+ deductibleVat: boolean;
139
+ } | null;
140
+ leasing: LeasingPrice | null;
141
+ companyLeasing: LeasingPrice | null;
142
+ } | null;
143
+ leasingPromos: {
144
+ id: string;
145
+ title: string | null;
146
+ description: string | null;
147
+ image: string | null;
148
+ periodMonths: number;
149
+ mileagePerYear: number;
150
+ isBusinessLeasing: boolean;
151
+ link: {
152
+ url: string;
153
+ name: string;
154
+ } | null;
155
+ }[];
156
+ media: {
157
+ totalCount: number;
158
+ items: AdMediaItem[];
159
+ };
160
+ equipment: {
161
+ items: {
162
+ name: string;
163
+ }[];
164
+ } | null;
165
+ accessories: {
166
+ id: string;
167
+ name: string;
168
+ price: number | null;
169
+ salePrice: number | null;
170
+ assemblyPrice: number | null;
171
+ shortDescription: string;
172
+ longDescription: string;
173
+ logoUrl: string;
174
+ productPageLink: string | null;
175
+ productPageLinkText: string | null;
176
+ articleNumber: string;
177
+ manufacturer: string | null;
178
+ model: string | null;
179
+ media: {
180
+ url: string;
181
+ sortOrder: number;
182
+ }[];
183
+ }[];
184
+ warrantyInfo: AdTextContent;
185
+ offerings: {
186
+ warranties: AdWarranty[];
187
+ };
188
+ exchangePolicy: {
189
+ enabled: boolean;
190
+ };
191
+ contactOption: {
192
+ __typename: 'Branch' | 'AdDefaultContactOptions' | 'AssignedUser' | string;
193
+ id?: string;
194
+ displayName?: string | null;
195
+ telephone?: string | null;
196
+ email?: string | null;
197
+ title?: string | null;
198
+ };
199
+ branch: {
200
+ id: string;
201
+ displayName: string | null;
202
+ description: string | null;
203
+ street: string | null;
204
+ zip: string | null;
205
+ city: string | null;
206
+ latitude: number | null;
207
+ longitude: number | null;
208
+ homePage: string | null;
209
+ logo: string | null;
210
+ market: string;
211
+ contactInformation: {
212
+ telephone: string | null;
213
+ email: string | null;
214
+ } | null;
215
+ adDefaultContactOptions: {
216
+ displayName: string | null;
217
+ telephone: string | null;
218
+ email: string | null;
219
+ title: string | null;
220
+ avatarUrl: string | null;
221
+ } | null;
222
+ weekOpeningHours: {
223
+ openingHours: ({
224
+ dayOfWeek: string;
225
+ openFrom: string | null;
226
+ openTo: string | null;
227
+ } | null)[] | null;
228
+ } | null;
229
+ isAutomotiveAssociationVerified: boolean | null;
230
+ promos: {
231
+ id: string;
232
+ title: string | null;
233
+ description: string | null;
234
+ image: string | null;
235
+ link: {
236
+ url: string;
237
+ name: string;
238
+ } | null;
239
+ }[];
240
+ };
241
+ authorizedResellerForManufacturer: boolean;
242
+ iteration: {
243
+ id: string;
244
+ displayName: string;
245
+ item: {
246
+ __typename: string;
247
+ displayName?: string;
248
+ registrationNumber?: {
249
+ stringValue: string;
250
+ } | null;
251
+ vin?: {
252
+ formattedValue: string;
253
+ } | null;
254
+ manufacturer?: {
255
+ stringValue: string;
256
+ } | null;
257
+ modelSeries?: {
258
+ stringValue: string;
259
+ } | null;
260
+ modelName?: {
261
+ stringValue: string;
262
+ } | null;
263
+ modelYear?: {
264
+ intValue: number;
265
+ } | null;
266
+ manufactureYear?: {
267
+ intValue: number;
268
+ } | null;
269
+ salesName?: {
270
+ stringValue: string;
271
+ } | null;
272
+ driveline?: {
273
+ fuelTypesString: {
274
+ stringValue: string;
275
+ } | null;
276
+ } | null;
277
+ attributes?: {
278
+ transmission: {
279
+ formattedValue: string;
280
+ } | null;
281
+ enginePower: {
282
+ intValue: number;
283
+ formattedValue: string;
284
+ } | null;
285
+ byCategory: AttributeCategory[];
286
+ } | null;
287
+ } | null;
288
+ logistics: {
289
+ odometerReading: {
290
+ value: number;
291
+ unit: 'KILOMETER' | 'SCANDINAVIAN_MILE';
292
+ } | null;
293
+ } | null;
294
+ commerce: {
295
+ enabled: boolean;
296
+ disabledOnWayke: boolean;
297
+ allowTradeIn: boolean;
298
+ homeDelivery: boolean;
299
+ reserved: boolean;
300
+ insuranceProvider: InsuranceProvider | null;
301
+ paymentDetailsList: PaymentResponse[];
302
+ };
303
+ documents: {
304
+ public: AdDocument[] | null;
305
+ };
306
+ } | null;
307
+ }
308
+ export interface LeasingPrice {
309
+ issuer: string;
310
+ leasingMonthlyPayment: Money | null;
311
+ contractMonthsRemaining: number | null;
312
+ contractKilometersRemaining: number | null;
313
+ }
314
+ export interface AdData {
315
+ ads: {
316
+ byAdId: Ad | null;
317
+ } | null;
318
+ }
319
+ export interface AdIdByLegacyIdData {
320
+ ads: {
321
+ byIterationId: {
322
+ ads: {
323
+ id: string;
324
+ }[] | null;
325
+ } | null;
326
+ } | null;
327
+ }
328
+ export interface CalculatePaymentData {
329
+ ads: {
330
+ byAdId: {
331
+ iteration: {
332
+ commerce: {
333
+ calculatePayment: PaymentResponse | null;
334
+ };
335
+ } | null;
336
+ } | null;
337
+ } | null;
338
+ }
339
+ export interface InsuranceInquiryInsurance {
340
+ name: string;
341
+ price: number;
342
+ unit: string;
343
+ description: string;
344
+ branding: string;
345
+ legalUrl: string;
346
+ legalDescription: string;
347
+ details: {
348
+ institute: string;
349
+ logo: string | null;
350
+ terms: string | null;
351
+ };
352
+ insuranceItems: {
353
+ name: string;
354
+ description: string;
355
+ }[];
356
+ addons: {
357
+ id: string;
358
+ title: string;
359
+ price: number;
360
+ description: string;
361
+ exclude: string[];
362
+ }[] | null;
363
+ }
364
+ export interface InsuranceInquiryData {
365
+ ads: {
366
+ byAdId: {
367
+ iteration: {
368
+ commerce: {
369
+ insuranceInquiry: {
370
+ insurances: (InsuranceInquiryInsurance | null)[] | null;
371
+ };
372
+ };
373
+ } | null;
374
+ } | null;
375
+ } | null;
376
+ }
377
+ export type AdAccessory = Ad['accessories'][number];
378
+ export {};
@@ -0,0 +1,8 @@
1
+ import { PublicApiSettings } from '../config';
2
+ import { Ad } from './types';
3
+ declare const useAd: (id: string, settings: PublicApiSettings) => {
4
+ loading: boolean;
5
+ error: boolean;
6
+ ad: Ad | undefined;
7
+ };
8
+ export default useAd;
@@ -0,0 +1,11 @@
1
+ import { PublicApiSettings } from '../config';
2
+ import { InsuranceInquiryInsurance } from './types';
3
+ /** Yearly driving distance in Swedish mil, as the public API's DrivingDistance enum. */
4
+ export type DrivingDistance = 'BETWEEN_0_AND_1000' | 'BETWEEN_1000_AND_1500' | 'BETWEEN_1500_AND_2000' | 'BETWEEN_2000_AND_2500' | 'OVER_2500';
5
+ /** Insurance quotes through iteration.commerce.insuranceInquiry. */
6
+ declare const useInsuranceInquiry: (settings: PublicApiSettings, adId: string, personalNumber?: string, drivingDistance?: DrivingDistance) => {
7
+ loading: boolean;
8
+ error: boolean;
9
+ insurances: InsuranceInquiryInsurance[] | undefined;
10
+ };
11
+ export default useInsuranceInquiry;
@@ -0,0 +1,14 @@
1
+ import { PublicApiSettings } from '../config';
2
+ import { PaymentResponse } from './types';
3
+ export interface LoanVariables {
4
+ financialOptionId?: string | null;
5
+ duration?: number;
6
+ downPayment?: number;
7
+ residual?: number;
8
+ }
9
+ /** A recalculated loan through iteration.commerce.calculatePayment. */
10
+ declare const useLoanCalculation: (settings: PublicApiSettings, adId: string, { financialOptionId, duration, downPayment, residual }: LoanVariables) => {
11
+ loading: boolean;
12
+ payment: PaymentResponse | undefined;
13
+ };
14
+ export default useLoanCalculation;
@@ -0,0 +1,12 @@
1
+ import { PublicApiSettings } from '../config';
2
+ import { SearchHit } from '../types';
3
+ /**
4
+ * "Fler bilar" on the ad page: the latest cars of the same make, the current
5
+ * ad excluded. There is no more-like-this in the public API; this is what
6
+ * web-ui-v2 does too.
7
+ */
8
+ declare const useRelatedAds: (settings: PublicApiSettings, adId: string, manufacturer?: string, limit?: number) => {
9
+ loading: boolean;
10
+ hits: SearchHit[] | undefined;
11
+ };
12
+ export default useRelatedAds;
@@ -0,0 +1,94 @@
1
+ import { Ad, AdAccessory, AdMediaItem, PaymentRange } from './types';
2
+ /** A number from the API, which sends some amounts as strings. */
3
+ export declare const num: (value: string | number | null | undefined) => number | undefined;
4
+ export declare const str: (value: string | null | undefined) => string | undefined;
5
+ /** What every ad page event carries. */
6
+ export declare const adEvent: (ad: Ad) => {
7
+ id: string;
8
+ branchId: string;
9
+ branchName: string | undefined;
10
+ };
11
+ /** Ecom and ev-calculation are keyed on the legacy waykeId, not on ad.id. */
12
+ export declare const waykeId: (ad: Ad) => string;
13
+ export declare const platformChannel: (ad: Ad) => {
14
+ __typename: string;
15
+ status?: string;
16
+ inventoryStatus?: string;
17
+ publishedAt?: string | null;
18
+ soldAt?: string | null;
19
+ deliveryTime?: {
20
+ __typename: string;
21
+ date?: string;
22
+ from?: string;
23
+ to?: string;
24
+ unit?: string;
25
+ } | null;
26
+ } | undefined;
27
+ export declare const price: (ad: Ad) => number;
28
+ /** How much the price was lowered, when it was. */
29
+ export declare const discount: (ad: Ad) => number | undefined;
30
+ /** The delivery date of a car that is not in stock yet. */
31
+ export declare const availableFrom: (ad: Ad) => Date | undefined;
32
+ export declare const publishedAt: (ad: Ad) => Date | undefined;
33
+ /** Buy online is offered when the branch has it, unless it is switched off for Wayke. */
34
+ export declare const ecom: (ad: Ad) => {
35
+ enabled: boolean;
36
+ reserved: boolean;
37
+ };
38
+ export interface ContactPerson {
39
+ name?: string;
40
+ email?: string;
41
+ phone?: string;
42
+ avatar?: string;
43
+ }
44
+ /** The person to contact about the ad: the assigned salesperson, else the branch's default. */
45
+ export declare const contactPerson: (ad: Ad) => ContactPerson | undefined;
46
+ export type DayKey = 'monday' | 'tuesday' | 'wednesday' | 'thursday' | 'friday' | 'saturday' | 'sunday';
47
+ export type WeekOpeningHours = Partial<Record<DayKey, {
48
+ from: string;
49
+ until: string;
50
+ } | null>>;
51
+ export declare const openingHours: (branch: Ad['branch']) => WeekOpeningHours | undefined;
52
+ export declare const position: (branch: Ad['branch']) => {
53
+ latitude: number;
54
+ longitude: number;
55
+ } | undefined;
56
+ export type MediaType = 'image' | 'sphere' | 'threesixty' | 'embedded';
57
+ /** One slide of the gallery: an image, a panorama, a 360 spin of several images, or a video. */
58
+ export interface GalleryMedia {
59
+ type: MediaType;
60
+ urls: string[];
61
+ }
62
+ export declare const galleryMedia: (items: AdMediaItem[]) => GalleryMedia[];
63
+ export interface Range {
64
+ current: number;
65
+ min: number;
66
+ max: number;
67
+ step: number;
68
+ }
69
+ export declare const range: (r: PaymentRange | null | undefined) => Range | undefined;
70
+ export interface LeasingOffer {
71
+ business: boolean;
72
+ monthlyCost: number;
73
+ months?: number;
74
+ mileagePerYear?: number;
75
+ name?: string;
76
+ description?: string;
77
+ image?: string;
78
+ }
79
+ /** Private and business leasing, with the dealer's promo text when there is one. */
80
+ export declare const leasingOffers: (ad: Ad) => LeasingOffer[];
81
+ export interface PackageOffer {
82
+ title: string;
83
+ description?: string;
84
+ image?: string;
85
+ link?: {
86
+ url: string;
87
+ title?: string;
88
+ };
89
+ }
90
+ export declare const packageOffers: (ad: Ad) => PackageOffer[];
91
+ /** The manufacturer's warranty package of a certified pre-owned car. */
92
+ export declare const manufacturerPackage: (ad: Ad) => PackageOffer | undefined;
93
+ /** An accessory's images, in their order. */
94
+ export declare const accessoryImages: (accessory: AdAccessory) => string[];
@@ -0,0 +1,11 @@
1
+ export interface PublicApiConfig {
2
+ url: string;
3
+ apiKey?: string;
4
+ }
5
+ export type GqlErrorKind = 'unauthorized' | 'rate-limited' | 'graphql' | 'network';
6
+ export declare class GqlError extends Error {
7
+ readonly kind: GqlErrorKind;
8
+ readonly retryAfter?: number;
9
+ constructor(kind: GqlErrorKind, message: string, retryAfter?: number);
10
+ }
11
+ export declare const gqlQuery: <T>(config: PublicApiConfig, query: string, variables: Record<string, unknown>) => Promise<T>;
@@ -0,0 +1,9 @@
1
+ import { MarketCode } from '../@types/market';
2
+ import { PublicApiConfig } from './client';
3
+ /** What every request to the public API needs, resolved once by the provider. */
4
+ export interface PublicApiSettings {
5
+ api: PublicApiConfig;
6
+ /** Narrows the search to a group of branches; without it the key's own scope applies */
7
+ branchGroupId?: string;
8
+ market: MarketCode;
9
+ }
@@ -0,0 +1,19 @@
1
+ import { MarketCode } from '../@types/market';
2
+ import { RangeFilter } from './searchParams';
3
+ import { AdsResult, Facet } from './types';
4
+ export interface FacetOption {
5
+ value: string;
6
+ count: number;
7
+ selected: boolean;
8
+ }
9
+ /**
10
+ * The values of a list filter, with counts from the filtered result (where a
11
+ * selected filter's own facet is counted without it, see useAdsSearch). A
12
+ * selected value is always listed, so it can be unticked.
13
+ */
14
+ export declare const listOptions: (field: string, params: URLSearchParams, facets: Facet[] | undefined) => FacetOption[];
15
+ export declare const isRangeFilter: (key: string) => key is RangeFilter;
16
+ /** The bucket start values of a slider, ascending, from the unfiltered search. */
17
+ export declare const rangeValues: (key: RangeFilter, unfiltered: AdsResult | undefined, market: MarketCode) => number[];
18
+ /** How many values of a filter are picked: list values, or 1 for a set range. */
19
+ export declare const selectedCount: (key: string, params: URLSearchParams) => number;
@@ -0,0 +1,5 @@
1
+ import { Money, SearchHit } from './types';
2
+ /** An amount from the API, or undefined when it is missing or not above zero. */
3
+ export declare const toAmount: (money?: Money | null) => number | undefined;
4
+ /** The first image of a hit, if any. */
5
+ export declare const hitImage: (hit: SearchHit) => string | undefined;
@@ -0,0 +1,7 @@
1
+ /** True when the params carry anything that is not already in the new grammar. */
2
+ export declare const hasLegacyParams: (params: URLSearchParams) => boolean;
3
+ /**
4
+ * Legacy params → canonical new-grammar params. Idempotent: params already in
5
+ * the new grammar come back unchanged (apart from canonical ordering).
6
+ */
7
+ export declare const migrateLegacyParams: (input: URLSearchParams) => URLSearchParams;
@@ -0,0 +1,17 @@
1
+ export declare const SEARCH_HIT_FIELDS = "\n ad {\n id\n salesDescription { title }\n pricing {\n cash { price { amount } oldPrice { amount } deductibleVat }\n leasing { leasingMonthlyPayment { amount } }\n companyLeasing { leasingMonthlyPayment { amount } }\n }\n media(limit: 1) { items { ... on AdImage { id url formats { format url } } } }\n branch { id displayName }\n channels { ... on PlatformChannel { status soldAt } }\n }\n iteration {\n logistics { odometerReading { value unit } }\n item {\n ... on Vehicle {\n displayName\n manufacturer { stringValue }\n modelSeries { stringValue }\n modelYear { intValue }\n registrationNumber { stringValue }\n driveline { fuelTypesString { stringValue } }\n attributes { transmission { formattedValue } }\n }\n }\n }\n";
2
+ export declare const ADS_ARGUMENTS = "\n market: $market\n q: $q\n branchGroupId: $branchGroupId\n page: $page\n perPage: $perPage\n sort: $sort\n soldWithinDays: 0\n manufacturer: $manufacturer\n model: $model\n modelSeries: $modelSeries\n fuelType: $fuelType\n gearboxType: $gearboxType\n branchDisplayName: $branchDisplayName\n colorName: $colorName\n environmentClass: $environmentClass\n segment: $segment\n drivetrainType: $drivetrainType\n bodyStyle: $bodyStyle\n engineBaseType: $engineBaseType\n trimLevel: $trimLevel\n inventoryStatus: $inventoryStatus\n branchCity: $branchCity\n certifiedPreOwned: $certifiedPreOwned\n isDemoVersion: $isDemoVersion\n deductibleVat: $deductibleVat\n ecom: $ecom\n leasing: $leasing\n businessLeasing: $businessLeasing\n cashPriceMin: $cashPriceMin\n cashPriceMax: $cashPriceMax\n odometerReadingMin: $odometerReadingMin\n odometerReadingMax: $odometerReadingMax\n modelYearMin: $modelYearMin\n modelYearMax: $modelYearMax\n leasingPriceMin: $leasingPriceMin\n leasingPriceMax: $leasingPriceMax\n companyLeasingPriceMin: $companyLeasingPriceMin\n companyLeasingPriceMax: $companyLeasingPriceMax\n";
3
+ export declare const ADS_VARIABLE_DEFINITIONS = "\n $market: [String]\n $q: String\n $branchGroupId: String\n $page: Int\n $perPage: Int\n $sort: AdsSort\n $manufacturer: [String]\n $model: [String]\n $modelSeries: [String]\n $fuelType: [String]\n $gearboxType: [String]\n $branchDisplayName: [String]\n $colorName: [String]\n $environmentClass: [String]\n $segment: [String]\n $drivetrainType: [String]\n $bodyStyle: [String]\n $engineBaseType: [String]\n $trimLevel: [String]\n $inventoryStatus: [String]\n $branchCity: [String]\n $certifiedPreOwned: Boolean\n $isDemoVersion: Boolean\n $deductibleVat: Boolean\n $ecom: Boolean\n $leasing: Boolean\n $businessLeasing: Boolean\n $cashPriceMin: Float\n $cashPriceMax: Float\n $odometerReadingMin: Int\n $odometerReadingMax: Int\n $modelYearMin: Int\n $modelYearMax: Int\n $leasingPriceMin: Float\n $leasingPriceMax: Float\n $companyLeasingPriceMin: Float\n $companyLeasingPriceMax: Float\n";
4
+ /** Alias of the facet-only search for one selected list filter, see buildSearchQuery. */
5
+ export declare const multiSelectFacetAlias: (field: string) => string;
6
+ /**
7
+ * One request for the search page: the filtered list with its facets and, for
8
+ * every list filter that has a selection, that facet counted WITHOUT its own
9
+ * filter. The legacy search counted facets that way ("multi-select"), so the
10
+ * other makes stay listed with their counts after picking one; the public API
11
+ * counts facets on the filtered result, where only the picked make remains.
12
+ */
13
+ export declare const buildSearchQuery: (selectedListFilters: string[]) => string;
14
+ export declare const SEARCH_QUERY: string;
15
+ /** Unfiltered facets and histograms: the filter panel's full value lists and slider domains. */
16
+ export declare const FACETS_QUERY = "\nquery SearchFacets($market: [String], $branchGroupId: String) {\n search {\n ads(market: $market, branchGroupId: $branchGroupId, perPage: 0, soldWithinDays: 0) {\n found\n facets { field counts { value count } }\n histograms {\n price { value count }\n odometerReading { value count }\n leasingPrice { value count }\n businessLeasingPrice { value count }\n }\n }\n }\n}\n";
17
+ export declare const SUGGEST_QUERY = "\nquery Suggest($market: [String], $branchGroupId: String, $q: String!, $limit: Int) {\n search {\n ads(market: $market, branchGroupId: $branchGroupId, q: $q, perPage: 0, soldWithinDays: 0) {\n suggest(limit: $limit) { label count dimension filters { field value } }\n }\n }\n}\n";