@wayke-se/components-react 5.2.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,10 +1,8 @@
1
1
  import React from 'react';
2
- import { Branch, InsuranceOption } from '../../@types/codegen/types';
3
- interface InsuranceModal {
4
- id: string;
5
- branch?: Branch | null;
2
+ import { InsuranceProvider } from '../../Gql/ad/types';
3
+ interface InsuranceModalProps {
6
4
  onClose: () => void;
7
- insuranceOptions: InsuranceOption;
5
+ provider: InsuranceProvider;
8
6
  }
9
- declare const InsuranceModal: ({ id, branch, onClose, insuranceOptions }: InsuranceModal) => React.JSX.Element;
7
+ declare const InsuranceModal: ({ onClose, provider }: InsuranceModalProps) => React.JSX.Element;
10
8
  export default InsuranceModal;
@@ -1,9 +1,8 @@
1
1
  import React from 'react';
2
- import { Branch, InsuranceOption } from '../../@types/codegen/types';
3
- interface InsuranceOptions {
4
- id: string;
5
- branch?: Branch | null;
6
- insuranceOptions: InsuranceOption[];
2
+ import { InsuranceProvider } from '../../Gql/ad/types';
3
+ interface InsuranceOptionsProps {
4
+ provider: InsuranceProvider;
7
5
  }
8
- declare const InsuranceOptions: ({ id, branch, insuranceOptions }: InsuranceOptions) => React.JSX.Element | null;
6
+ /** A quote needs a personal number and a distance; without them the offer is just described. */
7
+ declare const InsuranceOptions: ({ provider }: InsuranceOptionsProps) => React.JSX.Element;
9
8
  export default InsuranceOptions;
@@ -1,15 +1,10 @@
1
1
  import React from 'react';
2
- import { Branch, Maybe } from '../../@types/codegen/types';
3
- import { MarketCode } from '../../@types/market';
4
2
  import { LeadCommunication } from '../../hooks/useSubmitLead';
5
3
  export type { LeadCommunication };
6
4
  interface LeadFormProps {
7
- id: string;
8
- branch?: Maybe<Branch>;
9
- marketCode?: MarketCode;
10
5
  communication: LeadCommunication;
11
6
  onClose: () => void;
12
7
  }
13
8
  export declare const normalizeRegistrationNumber: (value: string) => string;
14
- declare const LeadForm: ({ id, branch, marketCode, communication, onClose }: LeadFormProps) => React.JSX.Element;
9
+ declare const LeadForm: ({ communication, onClose }: LeadFormProps) => React.JSX.Element;
15
10
  export default LeadForm;
@@ -1,8 +1,8 @@
1
1
  import React from 'react';
2
- import { Media } from '../../@types/codegen/types';
2
+ import { GalleryMedia } from '../../Gql/ad/view';
3
3
  interface LightboxProps {
4
4
  index: number;
5
- media: Media[];
5
+ media: GalleryMedia[];
6
6
  onClose: () => void;
7
7
  }
8
8
  declare const Lightbox: ({ index, media, onClose }: LightboxProps) => React.JSX.Element;
@@ -1,7 +1,9 @@
1
1
  import React from 'react';
2
- import { Maybe, Position } from '../../@types/codegen/types';
3
2
  interface StaticMapProps {
4
- position?: Maybe<Position>;
3
+ position?: {
4
+ latitude: number;
5
+ longitude: number;
6
+ };
5
7
  }
6
8
  declare const StaticMap: ({ position }: StaticMapProps) => React.JSX.Element | null;
7
9
  export default StaticMap;
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
- import { Maybe, OpeningHours } from '../../@types/codegen/types';
2
+ import { WeekOpeningHours } from '../../Gql/ad/view';
3
3
  interface OpeningHoursProps {
4
- openingHours?: Maybe<OpeningHours>;
4
+ openingHours?: WeekOpeningHours;
5
5
  }
6
6
  declare const OpeningHours: ({ openingHours }: OpeningHoursProps) => React.JSX.Element | null;
7
7
  export default OpeningHours;
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import { SearchHit } from '../../Gql/types';
3
+ interface HitCardProps {
4
+ hit: SearchHit;
5
+ placeholderImage?: string;
6
+ displayBranchName?: boolean;
7
+ }
8
+ /** A search hit as a product card: the search result and the related cars share it. */
9
+ declare const HitCard: ({ hit, placeholderImage, displayBranchName }: HitCardProps) => React.JSX.Element;
10
+ export default HitCard;
@@ -1,27 +1,23 @@
1
1
  import React from 'react';
2
- import { Branch, File } from '../../@types/search';
3
2
  import { ItemProps } from '../UspList';
4
- export interface OnItemClick {
5
- id: string;
6
- branchId?: string;
7
- branchName?: string;
8
- }
9
3
  interface Props {
10
4
  id: string;
11
5
  title: string;
12
- href?: string;
13
- imageFile?: File;
14
- pathRoute?: string;
15
- branch?: Branch;
6
+ /** The ad's first image (a cfit url) */
7
+ image?: string;
8
+ branch?: {
9
+ id: string;
10
+ name?: string;
11
+ };
16
12
  placeholderImage?: string;
17
13
  description?: string;
18
14
  uspList?: ItemProps[];
19
- price: string;
15
+ /** Left out when the ad has no cash price (0), as on wayke.se */
16
+ price?: string;
20
17
  leasingPrice?: string;
21
18
  oldPrice?: string;
22
19
  branchName?: string;
23
20
  businessLeasingPrice?: string;
24
- onClick?: (data: OnItemClick) => void;
25
21
  }
26
- declare const ProductCard: ({ id, title, href, imageFile, pathRoute, placeholderImage, branch, branchName, description, uspList, price, oldPrice, leasingPrice, businessLeasingPrice, onClick, }: Props) => React.JSX.Element;
22
+ declare const ProductCard: ({ id, title, image, placeholderImage, branch, branchName, description, uspList, price, oldPrice, leasingPrice, businessLeasingPrice, }: Props) => React.JSX.Element;
27
23
  export default ProductCard;
@@ -3,6 +3,9 @@ interface SearchBarProps {
3
3
  value: string;
4
4
  setValue: (value: string) => void;
5
5
  onSearch: (value: string) => void;
6
+ /** Typeahead labels shown under the field */
7
+ suggestions?: string[];
8
+ onSelectSuggestion?: (index: number) => void;
6
9
  }
7
- declare const SearchBar: ({ value, setValue, onSearch }: SearchBarProps) => React.JSX.Element;
10
+ declare const SearchBar: ({ value, setValue, onSearch, suggestions, onSelectSuggestion, }: SearchBarProps) => React.JSX.Element;
8
11
  export default SearchBar;
@@ -0,0 +1,10 @@
1
+ export declare const Suggestions: import("styled-components/dist/types").IStyledComponentBase<"web", Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLUListElement>, HTMLUListElement>, "style"> & {
2
+ style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | undefined;
3
+ }, "className"> & Partial<Pick<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLUListElement>, HTMLUListElement>, "style"> & {
4
+ style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | undefined;
5
+ }, "className">>> & string;
6
+ export declare const Suggestion: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Merged<Omit<import("react").DetailedHTMLProps<import("react").LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, "style"> & {
7
+ style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | undefined;
8
+ }, {
9
+ $active: boolean;
10
+ }>> & string;
@@ -1,7 +1,6 @@
1
1
  import React from 'react';
2
- import { DrivingDistance } from '../../@types/codegen/types';
3
2
  export interface OptionProps {
4
- value: number | string | DrivingDistance;
3
+ value: number | string;
5
4
  displayName?: number | string;
6
5
  }
7
6
  interface SortSelectProps {
@@ -21,7 +21,7 @@ export interface SubmitLeadProps {
21
21
  * website-components-react so leads from any Wayke-powered site look the same in Dealer.
22
22
  * `source` (hostname) + `sourceMechanism` is what gives the dealer traceability.
23
23
  */
24
- declare const useSubmitLead: (apiUrl: string | undefined, marketCode?: MarketCode) => {
24
+ declare const useSubmitLead: (leadUrl: string, marketCode?: MarketCode) => {
25
25
  isLoading: boolean;
26
26
  error: string | null;
27
27
  submitLead: ({ itemId, branchId, communication, firstName, lastName, phoneNumber, email, message, tradeInCarRegNo, tradeInCarMileage, }: SubmitLeadProps) => Promise<LeadResponse>;
@@ -1,13 +1,14 @@
1
1
  import type { ConversionOption, ConversionOptionType, ConversionOptionVehicle } from './@types/conversion';
2
2
  import type { SearchFilterNameTypes, SearchFilterTypes } from './@types/filter';
3
+ import type { MarketCode } from './@types/market';
3
4
  import SearchBar from './components/SearchBar';
4
5
  import WaykeSearch, { WaykeSearchProps } from './layouts/search';
5
6
  import WaykeSearchItem, { WaykeSearchItemProps } from './layouts/searchItem';
6
7
  import WaykeComposite, { WaykeCompositeWithProviderProps } from './layouts/WaykeCompositeWithProvider';
7
8
  import WaykeThemeProvider from './providers/themeProvider';
8
- import WaykeItemProvider, { WaykeItemProviderSettings } from './providers/WaykeItemProvidet';
9
- import WaykeProvider, { WaykeProviderSettings } from './providers/WaykeProvider';
10
- import type { CallbackEcom, CallbackEmpty, CallbackHashRouteChange, EventAll, EventEcom, EventFilterApply, EventFinanceClose, EventFinanceInterest, EventFinanceOpen, EventHashRouteChange, EventImagesClick, EventInsuranceClose, EventInsuranceInterest, EventInsuranceOpen, EventItemClicked, EventMailVisible, EventNames, EventOptionsClick, EventPhonenumberCall, EventPhonenumberVisible, EventSearch, EventType, EventView } from './utils/pubsub/Events';
9
+ import WaykeProvider, { EcomSettings, WaykeProviderSettings } from './providers/WaykeProvider';
10
+ import type { Environment, RoutingMode, RoutingSettings } from './State/Settings/settings';
11
11
  import WaykePubSub, { EventSubscriptions } from './utils/pubsub/pubsub';
12
- export { CallbackEcom, CallbackEmpty, CallbackHashRouteChange, ConversionOption, ConversionOptionType, ConversionOptionVehicle, EventAll, EventEcom, EventFilterApply, EventFinanceClose, EventFinanceInterest, EventFinanceOpen, EventHashRouteChange, EventImagesClick, EventInsuranceClose, EventInsuranceInterest, EventInsuranceOpen, EventItemClicked, EventMailVisible, EventNames, EventOptionsClick, EventPhonenumberCall, EventPhonenumberVisible, EventSearch, EventSubscriptions, EventType, EventView, SearchBar, SearchFilterNameTypes, SearchFilterTypes, WaykeCompositeWithProviderProps, WaykeItemProvider, WaykeItemProviderSettings, WaykeProvider, WaykeProviderSettings, WaykePubSub, WaykeSearch, WaykeSearchItem, WaykeSearchItemProps, WaykeSearchProps, WaykeThemeProvider, };
12
+ export { ConversionOption, ConversionOptionType, ConversionOptionVehicle, EcomSettings, Environment, EventSubscriptions, MarketCode, RoutingMode, RoutingSettings, SearchBar, SearchFilterNameTypes, SearchFilterTypes, WaykeCompositeWithProviderProps, WaykeProvider, WaykeProviderSettings, WaykePubSub, WaykeSearch, WaykeSearchItem, WaykeSearchItemProps, WaykeSearchProps, WaykeThemeProvider, };
13
13
  export default WaykeComposite;
14
+ export type * from './utils/pubsub/Events';
@@ -1,12 +1,7 @@
1
1
  import React from 'react';
2
2
  import { WaykeSearchProps } from './search';
3
3
  import { WaykeSearchItemProps } from './searchItem';
4
- type WaykeCompositeBaseProps = Omit<WaykeSearchProps & WaykeSearchItemProps, 'id'>;
5
- export type WaykeCompositeProps = Omit<WaykeCompositeBaseProps, 'hashRoute' | 'onClickSearchItem'> & {
6
- /** @deprecated Has no effect. Hash routing is used unless `pathRoute` is set. */
7
- hashRoute?: WaykeCompositeBaseProps['hashRoute'];
8
- /** @deprecated Has no effect. Subscribe to the `ItemClicked` event with `WaykePubSub` instead. */
9
- onClickSearchItem?: WaykeCompositeBaseProps['onClickSearchItem'];
10
- };
11
- declare const WaykeComposite: ({ marketCode, filterList, initialQueryParams, removeSearchBar, removeFilterOptions, disableResetScrollOnInit, placeholderImage, pathRoute, modifyDocumentTitleItem, modifyDocumentTitleSearch, displayBranchName, conversionOptions, }: WaykeCompositeProps) => React.JSX.Element | null;
4
+ export type WaykeCompositeProps = WaykeSearchProps & Omit<WaykeSearchItemProps, 'id'>;
5
+ /** The search, switching to the vehicle page when a vehicle is opened. */
6
+ declare const WaykeComposite: ({ filterList, initialQueryParams, removeSearchBar, removeFilterOptions, disableResetScrollOnInit, placeholderImage, modifyDocumentTitleItem, modifyDocumentTitleSearch, displayBranchName, conversionOptions, }: WaykeCompositeProps) => React.JSX.Element;
12
7
  export default WaykeComposite;
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import { WaykeProviderProps } from '../providers/WaykeProvider';
3
3
  import { WaykeCompositeProps } from './WaykeComposite';
4
4
  export interface WaykeCompositeWithProviderProps {
5
- provider: WaykeProviderProps;
5
+ provider?: WaykeProviderProps;
6
6
  composite?: WaykeCompositeProps;
7
7
  }
8
8
  declare const WaykeCompositeWithProvider: ({ provider, composite }: WaykeCompositeWithProviderProps) => React.JSX.Element;
@@ -1,19 +1,18 @@
1
1
  import React from 'react';
2
2
  import { SearchFilterTypes } from '../../@types/filter';
3
- import { MarketCode } from '../../@types/market';
4
- import { OnItemClick } from '../../components/ProductCard';
5
3
  export interface WaykeSearchProps {
6
- marketCode?: MarketCode;
4
+ /** The filters to show, in this order. By default all filters. */
7
5
  filterList?: SearchFilterTypes[];
6
+ /** Filters applied when the search loads. */
8
7
  initialQueryParams?: URLSearchParams | string;
9
8
  removeSearchBar?: boolean;
10
9
  removeFilterOptions?: boolean;
10
+ /** Url to an image for vehicles without images. */
11
11
  placeholderImage?: string;
12
- hashRoute?: boolean;
13
- pathRoute?: string;
12
+ /** Sets the page title. */
14
13
  modifyDocumentTitleSearch?: string;
14
+ /** Shows the branch name on the vehicles. */
15
15
  displayBranchName?: boolean;
16
- onClickSearchItem?: (data: OnItemClick) => void;
17
16
  }
18
- declare const WaykeSearch: ({ marketCode, filterList: _filterList, initialQueryParams, hashRoute, pathRoute, removeSearchBar, placeholderImage, removeFilterOptions, modifyDocumentTitleSearch, displayBranchName, onClickSearchItem, }: WaykeSearchProps) => React.JSX.Element | null;
17
+ declare const WaykeSearch: ({ filterList, initialQueryParams, removeSearchBar, placeholderImage, removeFilterOptions, modifyDocumentTitleSearch, displayBranchName, }: WaykeSearchProps) => React.JSX.Element;
19
18
  export default WaykeSearch;
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
- import { Accessory } from '../../../@types/codegen/types';
2
+ import { AdAccessory } from '../../../Gql/ad/types';
3
3
  interface AccesoryModalProps {
4
- accessory: Accessory;
4
+ accessory: AdAccessory;
5
5
  onClose: () => void;
6
6
  }
7
7
  declare const AccesoryModal: ({ accessory, onClose }: AccesoryModalProps) => React.JSX.Element;
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
- import { Accessory } from '../../../@types/codegen/types';
2
+ import { AdAccessory } from '../../../Gql/ad/types';
3
3
  interface AccessoriesSectionProps {
4
- accessories?: Accessory[];
4
+ accessories: AdAccessory[];
5
5
  }
6
6
  declare const AccessoriesSection: ({ accessories }: AccessoriesSectionProps) => React.JSX.Element | null;
7
7
  export default AccessoriesSection;
@@ -1,9 +1,8 @@
1
1
  import React from 'react';
2
- import { Branch, Maybe } from '../../@types/codegen/types';
2
+ import { Ad } from '../../Gql/ad/types';
3
3
  interface BranchProps {
4
- branch?: Maybe<Branch>;
5
- loading: boolean;
4
+ branch: Ad['branch'];
6
5
  displayBranchName?: boolean;
7
6
  }
8
- declare const Branch: ({ branch, loading, displayBranchName }: BranchProps) => React.JSX.Element | null;
7
+ declare const Branch: ({ branch, displayBranchName }: BranchProps) => React.JSX.Element;
9
8
  export default Branch;
@@ -1,21 +1,9 @@
1
1
  import React from 'react';
2
- import { Branch, ContactOptions, Ecommerce, Manufacturer, PackageOption, VehicleData } from '../../@types/codegen/types';
3
2
  import { ConversionOption } from '../../@types/conversion';
4
- import { MarketCode } from '../../@types/market';
5
- interface CheckList {
6
- id: string;
7
- title?: string | null;
8
- vehicleData?: VehicleData | null;
3
+ interface CheckListProps {
4
+ title: string;
9
5
  conversionOptions?: ConversionOption[];
10
- marketCode?: MarketCode;
11
- manufacturer?: Manufacturer | null;
12
- packageOptions: PackageOption[];
13
- ecommerce?: Ecommerce | null;
14
- branch?: Branch | null;
15
- contact?: ContactOptions | null;
16
- loadingCentralStorageVehicle: boolean;
17
- availableFrom?: Date | null;
18
6
  toggleEcomModal?: () => void;
19
7
  }
20
- declare const CheckList: ({ id, title, vehicleData, conversionOptions, marketCode, manufacturer, packageOptions, ecommerce, branch, contact, availableFrom, toggleEcomModal, loadingCentralStorageVehicle, }: CheckList) => React.JSX.Element;
8
+ declare const CheckList: ({ title, conversionOptions, toggleEcomModal }: CheckListProps) => React.JSX.Element;
21
9
  export default CheckList;
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
- import { Scalars } from '../../@types/codegen/types';
2
+ import { AdDocument } from '../../Gql/ad/types';
3
3
  interface DocumentsProps {
4
- documents: Scalars['FileDocument']['input'][];
4
+ documents: AdDocument[];
5
5
  }
6
6
  declare const Documents: ({ documents }: DocumentsProps) => React.JSX.Element | null;
7
7
  export default Documents;
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
- import { Maybe, PackageOption } from '../../@types/codegen/types';
2
+ import { PackageOffer } from '../../Gql/ad/view';
3
3
  interface ManufacturerPackageOption {
4
- packageOption?: Maybe<PackageOption>;
4
+ packageOption?: PackageOffer;
5
5
  }
6
6
  declare const ManufacturerPackageOption: ({ packageOption }: ManufacturerPackageOption) => React.JSX.Element | null;
7
7
  export default ManufacturerPackageOption;
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
- import { PackageOption } from '../../@types/codegen/types';
2
+ import { PackageOffer } from '../../Gql/ad/view';
3
3
  interface PackageOptionsProps {
4
- packageOptions?: PackageOption[] | null;
4
+ packageOptions: PackageOffer[];
5
5
  }
6
- declare const PackageOptions: ({ packageOptions }: PackageOptionsProps) => React.JSX.Element | null;
6
+ declare const PackageOptions: ({ packageOptions }: PackageOptionsProps) => React.JSX.Element;
7
7
  export default PackageOptions;
@@ -1,8 +1,3 @@
1
1
  import React from 'react';
2
- import { VehicleData } from '../../@types/codegen/types';
3
- interface PropertySetProps {
4
- propertySet: any;
5
- vehicleData: VehicleData;
6
- }
7
- declare const PropertySet: ({ propertySet, vehicleData }: PropertySetProps) => React.JSX.Element;
2
+ declare const PropertySet: () => React.JSX.Element;
8
3
  export default PropertySet;
@@ -1,11 +1,10 @@
1
1
  import React from 'react';
2
2
  interface RelatedProps {
3
- id: string;
4
- hashRoute?: boolean;
5
- pathRoute?: string;
6
- authorizedReseller?: boolean;
3
+ adId: string;
4
+ manufacturer?: string;
5
+ placeholderImage?: string;
7
6
  displayBranchName?: boolean;
8
- onClickSearchItem?: (id: string) => void;
9
7
  }
10
- declare const Related: ({ id, hashRoute, pathRoute, authorizedReseller, displayBranchName, onClickSearchItem, }: RelatedProps) => React.JSX.Element | null;
8
+ /** The latest cars of the same make. */
9
+ declare const Related: ({ adId, manufacturer, placeholderImage, displayBranchName }: RelatedProps) => React.JSX.Element | null;
11
10
  export default Related;
@@ -1,17 +1,19 @@
1
1
  import React from 'react';
2
2
  import { ConversionOption } from '../../@types/conversion';
3
- import { MarketCode } from '../../@types/market';
4
3
  export interface WaykeSearchItemProps {
5
- marketCode?: MarketCode;
4
+ /** The id of the vehicle. Older ids are resolved, and the url is updated to the new one. */
6
5
  id: string;
7
- hashRoute?: boolean;
8
- pathRoute?: string;
6
+ /** Keeps the scroll position when the vehicle page opens. By default it scrolls to the top. */
9
7
  disableResetScrollOnInit?: boolean;
8
+ /** Url to an image for vehicles without images. */
10
9
  placeholderImage?: string;
10
+ /** Sets the page title to the vehicle. */
11
11
  modifyDocumentTitleItem?: boolean;
12
+ /** Shows the branch name on related vehicles and where the vehicle is located. */
12
13
  displayBranchName?: boolean;
14
+ /** The buttons on the vehicle page. */
13
15
  conversionOptions?: ConversionOption[];
14
- onClickSearchItem?: (id: string) => void;
15
16
  }
16
- declare const WaykeSearchItem: ({ marketCode, id, hashRoute, pathRoute, disableResetScrollOnInit, placeholderImage, modifyDocumentTitleItem, displayBranchName, conversionOptions, onClickSearchItem, }: WaykeSearchItemProps) => React.JSX.Element | null;
17
+ /** The vehicle page. */
18
+ declare const WaykeSearchItem: ({ id, disableResetScrollOnInit, ...props }: WaykeSearchItemProps) => React.JSX.Element;
17
19
  export default WaykeSearchItem;
@@ -1,8 +1,12 @@
1
- import { Branch, Maybe } from '../../@types/codegen/types';
2
- import { SettingsContextProps } from '../../State/Settings/SettingsContext';
1
+ import { Ad } from '../../Gql/ad/types';
2
+ import { Settings } from '../../State/Settings/settings';
3
3
  interface EcomWeb {
4
4
  start: () => void;
5
5
  destroy: () => void;
6
6
  }
7
- declare function useEcom(id: string, ecomSettings: SettingsContextProps['ecomSettings'], branch?: Maybe<Branch>): import("react").RefObject<EcomWeb | undefined>;
7
+ /**
8
+ * Buy online. ecom-web is keyed on the legacy waykeId: the commerce order flow
9
+ * answers 404 on ad.id for ads from before ads-service.
10
+ */
11
+ declare function useEcom(ad: Ad, ecom: Settings['ecom']): import("react").RefObject<EcomWeb | undefined>;
8
12
  export default useEcom;
@@ -1,26 +1,12 @@
1
1
  import React from 'react';
2
- export interface EcomSettings {
3
- url: string;
4
- /** @deprecated Not used since 3.0.0. Will be removed in the next major version. */
5
- useBankId?: boolean;
6
- /** @deprecated Not used since 3.0.0. Will be removed in the next major version. */
7
- displayBankIdAlert?: boolean;
8
- serviceLogotypeUrl?: string;
9
- bankIdThumbprint?: string;
10
- }
11
- export interface WaykeProviderSettings {
12
- url: string;
13
- urlMlt?: string;
14
- apiKey?: string;
15
- graphQlUrl: string;
16
- ecomSettings?: EcomSettings;
17
- googleMapsApiKey?: string;
18
- googleMapsMarker?: string;
19
- useQueryParamsFromUrl?: boolean;
20
- pathRoute?: string;
21
- }
2
+ import { WaykeProviderSettings } from '../State/Settings/settings';
3
+ export type { EcomSettings, WaykeProviderSettings } from '../State/Settings/settings';
22
4
  export type WaykeProviderProps = WaykeProviderSettings & {
23
5
  children?: React.ReactNode;
24
6
  };
25
- declare const WaykeProvider: ({ url, urlMlt, apiKey, ecomSettings, graphQlUrl, googleMapsApiKey, googleMapsMarker, useQueryParamsFromUrl, pathRoute, children, }: WaykeProviderProps) => React.JSX.Element;
7
+ /**
8
+ * Settings, routing, the search state and the theme for every Wayke component
9
+ * under it. Place it close to the root of the app, so its cache is kept.
10
+ */
11
+ declare const WaykeProvider: ({ children, ...settings }: WaykeProviderProps) => React.JSX.Element;
26
12
  export default WaykeProvider;
@@ -0,0 +1,14 @@
1
+ export type ImageSpec = [width: number, height: number];
2
+ interface ImageOptions {
3
+ width: number;
4
+ height: number;
5
+ webp?: boolean;
6
+ }
7
+ export declare const imageUrl: (src: string, { width, height, webp }: ImageOptions) => string;
8
+ /**
9
+ * Width-limited URL for an image that may come from cfit (allowed widths only)
10
+ * or from a host that takes a free ?w=&h= (legacy media, blob storage).
11
+ */
12
+ export declare const imageWithWidth: (src: string, width: number, height?: number) => string;
13
+ export declare const imageSrcSet: (src: string, specs: ImageSpec[], webp?: boolean) => string;
14
+ export {};
@@ -1,13 +1,4 @@
1
- declare const SortOptionDisplayName: {
2
- PublishedAsc: string;
3
- PublishedDesc: string;
4
- PriceAsc: string;
5
- Pricedesc: string;
6
- ModelAsc: string;
7
- Modeldesc: string;
8
- MileageAsc: string;
9
- Mileagedesc: string;
10
- };
11
- type SortOptionDisplayName = 'relevance' | 'published-asc' | 'published-desc' | 'price-asc' | 'price-desc' | 'model-asc' | 'model-desc' | 'mileage-asc' | 'mileage-desc';
12
- export declare const getTranslatedSortOptionDisplayName: (str: string | SortOptionDisplayName) => string;
13
- export {};
1
+ export declare const sortOptions: () => {
2
+ value: string;
3
+ displayName: string;
4
+ }[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wayke-se/components-react",
3
- "version": "5.2.0",
3
+ "version": "6.0.0-beta.0",
4
4
  "description": "",
5
5
  "module": "dist/index.mjs",
6
6
  "main": "dist/index.js",
@@ -15,7 +15,6 @@
15
15
  "lint": "npx @biomejs/biome check",
16
16
  "lint:fix": "npx @biomejs/biome check --write",
17
17
  "typecheck": "tsc --noEmit --skipLibCheck",
18
- "gen": "graphql-codegen --config ./codegen.yml",
19
18
  "generate-libphonenumber-metadata": "libphonenumber-metadata-generator src/utils/metadata.min.json --countries SE,NO --extended",
20
19
  "prepare": "husky",
21
20
  "start": "node ./esbuild/start.js",
@@ -35,39 +34,34 @@
35
34
  "styled-components": "^6"
36
35
  },
37
36
  "devDependencies": {
38
- "@biomejs/biome": "2.5.15",
39
- "@graphql-codegen/cli": "^7.4.5",
40
- "@graphql-codegen/typescript": "^6.1.1",
41
- "@types/googlemaps": "^3.43.3",
42
- "@types/node": "^24.19.1",
37
+ "@biomejs/biome": "2.6.3",
38
+ "@types/node": "^24.19.2",
43
39
  "@types/react": "^19.3.0",
44
40
  "@types/react-dom": "^19.3.0",
45
41
  "@types/react-slick": "^0.23.13",
46
42
  "@wayke-se/ecom-web": "^2.1.1",
47
- "dotenv": "^18.0.6",
43
+ "dotenv": "^18.0.9",
48
44
  "esbuild": "^0.28.2",
49
45
  "esbuild-plugin-copy": "^2.1.1",
50
46
  "husky": "^9.1.7",
51
47
  "libphonenumber-metadata-generator": "^2.0.6",
52
48
  "lint-staged": "^17.6.0",
53
- "react": "^19.3.0",
54
- "react-dom": "^19.3.0",
49
+ "react": "^19.3.1",
50
+ "react-dom": "^19.3.1",
55
51
  "react-router-dom": "^7.18.4",
56
52
  "rimraf": "^6.1.3",
57
- "styled-components": "^6.5.3",
53
+ "styled-components": "^6.6.0",
58
54
  "typescript": "^7.0.2"
59
55
  },
60
56
  "dependencies": {
61
- "@apollo/client": "^4.3.3",
62
57
  "@emotion/is-prop-valid": "^1.4.0",
63
58
  "@photo-sphere-viewer/core": "^5.15.1",
64
59
  "date-fns": "^4.4.0",
65
- "graphql": "^16.0.0 || ^17.0.0",
66
- "i18next": "^26.4.2",
60
+ "i18next": "^26.5.11",
67
61
  "libphonenumber-js": "^1.13.15",
68
- "marked": "^18.1.0",
62
+ "marked": "^18.1.1",
69
63
  "react-compound-slider": "^3.4.0",
70
- "react-i18next": "^17.0.16",
64
+ "react-i18next": "^17.1.9",
71
65
  "react-slick": "^0.31.0",
72
66
  "scroll-into-view-if-needed": "^3.1.0"
73
67
  },
@@ -1,3 +0,0 @@
1
- export interface BaseAction<T> {
2
- type: T;
3
- }