@wayke-se/components-react 3.5.0 → 3.5.2
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/README.md +5 -1
- package/dist-node/index.js +72 -23
- package/dist-node/index.js.map +1 -1
- package/dist-src/State/RelatedSearch/useRelatedSearch.js +4 -1
- package/dist-src/components/ActionList/toggle-item.js +1 -4
- package/dist-src/components/FinancialOptions/index.js +1 -1
- package/dist-src/components/FinancialOptions/leasing.js +7 -6
- package/dist-src/components/Grid/index.js +2 -2
- package/dist-src/components/ProductCard/index.js +3 -2
- package/dist-src/components/ProductCard/wrapper.js +6 -1
- package/dist-src/layouts/WaykeComposite.js +2 -2
- package/dist-src/layouts/search/index.js +2 -2
- package/dist-src/layouts/searchItem/Branch.js +6 -4
- package/dist-src/layouts/searchItem/Related.js +3 -3
- package/dist-src/layouts/searchItem/index.js +3 -9
- package/dist-src/queries/SEARCH_ITEM_BRANCH_QUERY.js +1 -0
- package/dist-src/utils/sortOptions.js +6 -0
- package/dist-src/utils/vehicle-properties/property-hint-enricher.js +2 -0
- package/dist-types/@types/codegen/types.d.ts +46 -41
- package/dist-types/@types/filter.d.ts +2 -2
- package/dist-types/State/Path/reducer.d.ts +2 -2
- package/dist-types/State/RelatedSearch/useRelatedSearch.d.ts +1 -1
- package/dist-types/components/Content/index.d.ts +1 -1
- package/dist-types/components/Grid/index.d.ts +2 -1
- package/dist-types/components/Icon/index.d.ts +2 -2
- package/dist-types/components/InputCheckbox/index.d.ts +1 -1
- package/dist-types/components/InputSearch/index.d.ts +2 -2
- package/dist-types/components/InputText/index.d.ts +1 -1
- package/dist-types/components/ProductCard/index.d.ts +2 -1
- package/dist-types/components/ProductCard/wrapper.d.ts +1 -0
- package/dist-types/components/Sphere/Sphere.d.ts +1 -1
- package/dist-types/components/Sphere/SphereLightbox.d.ts +1 -1
- package/dist-types/components/Sphere/SphereViewer.d.ts +1 -1
- package/dist-types/components/ThreeSixty/Rotation.d.ts +1 -1
- package/dist-types/components/ThreeSixty/ThreeSixtLightbox.d.ts +1 -1
- package/dist-types/components/ThreeSixty/ThreeSixty.d.ts +1 -1
- package/dist-types/components/Video/CustomPlayer.d.ts +1 -1
- package/dist-types/components/Video/EmbeddedVideoLightbox.d.ts +1 -1
- package/dist-types/components/Video/VimeoPlayer.d.ts +1 -1
- package/dist-types/components/Video/YoutubePlayer.d.ts +1 -1
- package/dist-types/layout/theme.d.ts +1 -1
- package/dist-types/layouts/WaykeComposite.d.ts +2 -2
- package/dist-types/layouts/search/index.d.ts +2 -1
- package/dist-types/layouts/searchItem/Branch.d.ts +2 -1
- package/dist-types/layouts/searchItem/Related.d.ts +3 -1
- package/dist-types/layouts/searchItem/index.d.ts +2 -1
- package/dist-types/providers/WaykeItemProvidet.d.ts +1 -1
- package/dist-types/providers/WaykeProvider.d.ts +1 -1
- package/dist-types/utils/pubsub/Actions.d.ts +5 -5
- package/dist-types/utils/pubsub/Events.d.ts +7 -7
- package/dist-types/utils/pubsub/pubsub.d.ts +2 -2
- package/dist-types/utils/sortOptions.d.ts +3 -1
- package/dist-types/utils/specification.d.ts +1 -1
- package/dist-web/index.js +48 -31
- package/dist-web/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
|
|
2
|
+
type SharedIconProps = {
|
|
3
3
|
block?: boolean;
|
|
4
4
|
};
|
|
5
|
-
|
|
5
|
+
type IconInfoProps = React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement> & SharedIconProps;
|
|
6
6
|
export declare const IconInfo: ({ block }: IconInfoProps) => JSX.Element;
|
|
7
7
|
export declare const IconCancel: ({ block }: IconInfoProps) => JSX.Element;
|
|
8
8
|
export declare const IconChevronDown: ({ block }: IconInfoProps) => JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
|
|
2
|
+
type Props = React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement> & {
|
|
3
3
|
id: string;
|
|
4
4
|
children: React.ReactNode;
|
|
5
5
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
type InputProps = React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>;
|
|
3
|
+
type Props = InputProps & {
|
|
4
4
|
placeholder: string;
|
|
5
5
|
label: string;
|
|
6
6
|
value?: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
2
|
+
type Props = React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement> & {
|
|
3
3
|
value: string;
|
|
4
4
|
placeholder: string;
|
|
5
5
|
label: string;
|
|
@@ -12,8 +12,9 @@ interface Props {
|
|
|
12
12
|
price: string;
|
|
13
13
|
leasingPrice?: string;
|
|
14
14
|
oldPrice?: string;
|
|
15
|
+
branchName?: string;
|
|
15
16
|
businessLeasingPrice?: string;
|
|
16
17
|
onClick?: (id: string) => void;
|
|
17
18
|
}
|
|
18
|
-
declare const ProductCard: ({ id, title, href, image, pathRoute, placeholderImage, description, uspList, price, oldPrice, leasingPrice, businessLeasingPrice, onClick, }: Props) => JSX.Element;
|
|
19
|
+
declare const ProductCard: ({ id, title, href, image, pathRoute, placeholderImage, branchName, description, uspList, price, oldPrice, leasingPrice, businessLeasingPrice, onClick, }: Props) => JSX.Element;
|
|
19
20
|
export default ProductCard;
|
|
@@ -6,6 +6,7 @@ export declare const Img: import("styled-components").StyledComponent<"img", imp
|
|
|
6
6
|
export declare const Content: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
7
7
|
export declare const ContentBody: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
8
8
|
export declare const ContentFooter: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
9
|
+
export declare const PreHeading: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
9
10
|
export declare const Heading: import("styled-components").StyledComponent<"h1", import("styled-components").DefaultTheme, {
|
|
10
11
|
className: "wayke__theme wayke__font--bold";
|
|
11
12
|
}, "className">;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { WaykeSearchProps } from './search/index';
|
|
3
3
|
import { WaykeSearchItemProps } from './searchItem/index';
|
|
4
|
-
export
|
|
5
|
-
declare const WaykeComposite: ({ filterList, initialQueryParams, removeSearchBar, removeFilterOptions, disableResetScrollOnInit, placeholderImage, pathRoute, modifyDocumentTitleItem, modifyDocumentTitleSearch, }: WaykeCompositeProps) => JSX.Element;
|
|
4
|
+
export type WaykeCompositeProps = Omit<WaykeSearchProps & WaykeSearchItemProps, 'id'>;
|
|
5
|
+
declare const WaykeComposite: ({ filterList, initialQueryParams, removeSearchBar, removeFilterOptions, disableResetScrollOnInit, placeholderImage, pathRoute, modifyDocumentTitleItem, modifyDocumentTitleSearch, displayBranchName, }: WaykeCompositeProps) => JSX.Element;
|
|
6
6
|
export default WaykeComposite;
|
|
@@ -9,7 +9,8 @@ export interface WaykeSearchProps {
|
|
|
9
9
|
hashRoute?: boolean;
|
|
10
10
|
pathRoute?: string;
|
|
11
11
|
modifyDocumentTitleSearch?: string;
|
|
12
|
+
displayBranchName?: boolean;
|
|
12
13
|
onClickSearchItem?: (id: string) => void;
|
|
13
14
|
}
|
|
14
|
-
declare const WaykeSearch: ({ filterList, initialQueryParams, hashRoute, pathRoute, removeSearchBar, placeholderImage, removeFilterOptions, modifyDocumentTitleSearch, onClickSearchItem, }: WaykeSearchProps) => JSX.Element;
|
|
15
|
+
declare const WaykeSearch: ({ filterList, initialQueryParams, hashRoute, pathRoute, removeSearchBar, placeholderImage, removeFilterOptions, modifyDocumentTitleSearch, displayBranchName, onClickSearchItem, }: WaykeSearchProps) => JSX.Element;
|
|
15
16
|
export default WaykeSearch;
|
|
@@ -3,6 +3,7 @@ import { Branch, Maybe } from '../../@types/codegen/types';
|
|
|
3
3
|
interface BranchProps {
|
|
4
4
|
branch?: Maybe<Branch>;
|
|
5
5
|
loading: boolean;
|
|
6
|
+
displayBranchName?: boolean;
|
|
6
7
|
}
|
|
7
|
-
declare const Branch: ({ branch, loading }: BranchProps) => JSX.Element | null;
|
|
8
|
+
declare const Branch: ({ branch, loading, displayBranchName }: BranchProps) => JSX.Element | null;
|
|
8
9
|
export default Branch;
|
|
@@ -3,7 +3,9 @@ interface RelatedProps {
|
|
|
3
3
|
id: string;
|
|
4
4
|
hashRoute?: boolean;
|
|
5
5
|
pathRoute?: string;
|
|
6
|
+
authorizedReseller?: boolean;
|
|
7
|
+
displayBranchName?: boolean;
|
|
6
8
|
onClickSearchItem?: (id: string) => void;
|
|
7
9
|
}
|
|
8
|
-
declare const Related: ({ id, hashRoute, pathRoute, onClickSearchItem }: RelatedProps) => JSX.Element | null;
|
|
10
|
+
declare const Related: ({ id, hashRoute, pathRoute, authorizedReseller, displayBranchName, onClickSearchItem, }: RelatedProps) => JSX.Element | null;
|
|
9
11
|
export default Related;
|
|
@@ -6,7 +6,8 @@ export interface WaykeSearchItemProps {
|
|
|
6
6
|
disableResetScrollOnInit?: boolean;
|
|
7
7
|
placeholderImage?: string;
|
|
8
8
|
modifyDocumentTitleItem?: boolean;
|
|
9
|
+
displayBranchName?: boolean;
|
|
9
10
|
onClickSearchItem?: (id: string) => void;
|
|
10
11
|
}
|
|
11
|
-
declare const WaykeSearchItem: ({ id, hashRoute, pathRoute, disableResetScrollOnInit, placeholderImage, modifyDocumentTitleItem, onClickSearchItem, }: WaykeSearchItemProps) => JSX.Element;
|
|
12
|
+
declare const WaykeSearchItem: ({ id, hashRoute, pathRoute, disableResetScrollOnInit, placeholderImage, modifyDocumentTitleItem, displayBranchName, onClickSearchItem, }: WaykeSearchItemProps) => JSX.Element;
|
|
12
13
|
export default WaykeSearchItem;
|
|
@@ -15,7 +15,7 @@ export interface WaykeItemProviderSettings {
|
|
|
15
15
|
googleMapsApiKey?: string;
|
|
16
16
|
googleMapsMarker?: string;
|
|
17
17
|
}
|
|
18
|
-
export
|
|
18
|
+
export type WaykeItemProviderProps = WaykeItemProviderSettings & {
|
|
19
19
|
children?: React.ReactNode;
|
|
20
20
|
};
|
|
21
21
|
declare const WaykeItemProvider: ({ url, urlMlt, apiKey, ecomSettings, graphQlUrl, googleMapsApiKey, googleMapsMarker, children, }: WaykeItemProviderProps) => JSX.Element;
|
|
@@ -17,7 +17,7 @@ export interface WaykeProviderSettings {
|
|
|
17
17
|
useQueryParamsFromUrl?: boolean;
|
|
18
18
|
pathRoute?: string;
|
|
19
19
|
}
|
|
20
|
-
export
|
|
20
|
+
export type WaykeProviderProps = WaykeProviderSettings & {
|
|
21
21
|
children?: React.ReactNode;
|
|
22
22
|
};
|
|
23
23
|
declare const WaykeProvider: ({ url, urlMlt, apiKey, ecomSettings, graphQlUrl, googleMapsApiKey, googleMapsMarker, useQueryParamsFromUrl, pathRoute, children, }: WaykeProviderProps) => JSX.Element;
|
|
@@ -2,15 +2,15 @@ interface ActionBase<Callback> {
|
|
|
2
2
|
actionName: ActionNames;
|
|
3
3
|
callback: Callback;
|
|
4
4
|
}
|
|
5
|
-
export
|
|
6
|
-
export
|
|
5
|
+
export type ActionCallbackEmpty = () => void;
|
|
6
|
+
export type CallbackOnFilterUpdate = (query: string) => void;
|
|
7
7
|
export interface ActionOnFilterUpdate extends ActionBase<CallbackOnFilterUpdate> {
|
|
8
8
|
actionName: 'onFilterUpdate';
|
|
9
9
|
}
|
|
10
|
-
export
|
|
10
|
+
export type ActionCallbackAll = (eventName: Omit<ActionNames, 'All'>, data: any) => void;
|
|
11
11
|
export interface ActionAll extends ActionBase<ActionCallbackAll> {
|
|
12
12
|
actionName: 'All';
|
|
13
13
|
}
|
|
14
|
-
export
|
|
15
|
-
export
|
|
14
|
+
export type ActionTypes = ActionOnFilterUpdate | ActionAll;
|
|
15
|
+
export type ActionNames = Pick<ActionTypes, 'actionName'>['actionName'];
|
|
16
16
|
export {};
|
|
@@ -2,19 +2,19 @@ interface EventBase<Callback> {
|
|
|
2
2
|
eventName: EventNames;
|
|
3
3
|
callback: Callback;
|
|
4
4
|
}
|
|
5
|
-
export
|
|
6
|
-
export
|
|
5
|
+
export type CallbackEmpty = () => void;
|
|
6
|
+
export type CallbackHashRouteChange = (id?: string) => void;
|
|
7
7
|
export interface EventHashRouteChange extends EventBase<CallbackHashRouteChange> {
|
|
8
8
|
eventName: 'HashRouteChange';
|
|
9
9
|
}
|
|
10
|
-
export
|
|
10
|
+
export type CallbackEventItemClicked = (id: string) => void;
|
|
11
11
|
export interface EventItemClicked extends EventBase<CallbackEventItemClicked> {
|
|
12
12
|
eventName: 'ItemClicked';
|
|
13
13
|
}
|
|
14
14
|
export interface EventEcomOnInit extends EventBase<CallbackEmpty> {
|
|
15
15
|
eventName: 'EcomOnInit';
|
|
16
16
|
}
|
|
17
|
-
export
|
|
17
|
+
export type CallbackEcomOnUserEvent = (userEvent: string, currentStep: string) => void;
|
|
18
18
|
export interface EventEcomOnUser extends EventBase<CallbackEcomOnUserEvent> {
|
|
19
19
|
eventName: 'EcomOnUserEvent';
|
|
20
20
|
}
|
|
@@ -42,10 +42,10 @@ export interface EventInsuranceInterest extends EventBase<CallbackEmpty> {
|
|
|
42
42
|
export interface EventFinanceInterest extends EventBase<CallbackEmpty> {
|
|
43
43
|
eventName: 'FinanceInterest';
|
|
44
44
|
}
|
|
45
|
-
export
|
|
45
|
+
export type CallbackAll = (eventName: Omit<EventNames, 'All'>, data: any) => void;
|
|
46
46
|
export interface EventAll extends EventBase<CallbackAll> {
|
|
47
47
|
eventName: 'All';
|
|
48
48
|
}
|
|
49
|
-
export
|
|
50
|
-
export
|
|
49
|
+
export type EventType = EventHashRouteChange | EventItemClicked | EventEcomOnInit | EventEcomOnUser | EventEcomOnExit | EventImagesClick | EventOptionsClick | EventPhonenumberVisible | EventPhonenumberCall | EventMailVisible | EventInsuranceInterest | EventFinanceInterest | EventAll;
|
|
50
|
+
export type EventNames = Pick<EventType, 'eventName'>['eventName'];
|
|
51
51
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ActionAll, ActionNames, ActionOnFilterUpdate, ActionTypes } from './Actions';
|
|
2
2
|
import { EventHashRouteChange, EventItemClicked, EventEcomOnInit, EventEcomOnUser, EventEcomOnExit, EventImagesClick, EventOptionsClick, EventPhonenumberVisible, EventPhonenumberCall, EventMailVisible, EventInsuranceInterest, EventFinanceInterest, EventAll, EventType, EventNames } from './Events';
|
|
3
|
-
export
|
|
3
|
+
export type EventSubscriptions = {
|
|
4
4
|
HashRouteChange: EventHashRouteChange[];
|
|
5
5
|
ItemClicked: EventItemClicked[];
|
|
6
6
|
EcomOnInit: EventEcomOnInit[];
|
|
@@ -15,7 +15,7 @@ export declare type EventSubscriptions = {
|
|
|
15
15
|
FinanceInterest: EventFinanceInterest[];
|
|
16
16
|
All: EventAll[];
|
|
17
17
|
};
|
|
18
|
-
export
|
|
18
|
+
export type ActionSubscriptions = {
|
|
19
19
|
onFilterUpdate: ActionOnFilterUpdate[];
|
|
20
20
|
All: ActionAll[];
|
|
21
21
|
};
|
|
@@ -5,7 +5,9 @@ declare const SortOptionDisplayName: {
|
|
|
5
5
|
Pricedesc: string;
|
|
6
6
|
ModelAsc: string;
|
|
7
7
|
Modeldesc: string;
|
|
8
|
+
MileageAsc: string;
|
|
9
|
+
Mileagedesc: string;
|
|
8
10
|
};
|
|
9
|
-
|
|
11
|
+
type SortOptionDisplayName = 'relevance' | 'published-asc' | 'published-desc' | 'price-asc' | 'price-desc' | 'model-asc' | 'model-desc' | 'mileage-asc' | 'mileage-desc';
|
|
10
12
|
export declare const getTranslatedSortOptionDisplayName: (str: string | SortOptionDisplayName) => string;
|
|
11
13
|
export {};
|
|
@@ -8,7 +8,7 @@ export interface ItemPropertyType {
|
|
|
8
8
|
value: string | null;
|
|
9
9
|
modal?: ItemPropertModalType;
|
|
10
10
|
}
|
|
11
|
-
|
|
11
|
+
type ValueTypes = number | string | null | undefined | string[] | boolean | {
|
|
12
12
|
[key: string]: string | number | boolean;
|
|
13
13
|
};
|
|
14
14
|
export interface SpecPropertyType {
|
package/dist-web/index.js
CHANGED
|
@@ -665,6 +665,8 @@ const SortOptionDisplayName = {
|
|
|
665
665
|
Pricedesc: 'price-desc',
|
|
666
666
|
ModelAsc: 'model-asc',
|
|
667
667
|
Modeldesc: 'model-desc',
|
|
668
|
+
MileageAsc: 'mileage-asc',
|
|
669
|
+
Mileagedesc: 'mileage-desc',
|
|
668
670
|
};
|
|
669
671
|
const getTranslatedSortOptionDisplayName = (str) => {
|
|
670
672
|
switch (str) {
|
|
@@ -680,6 +682,10 @@ const getTranslatedSortOptionDisplayName = (str) => {
|
|
|
680
682
|
return 'Årsmodell äldst';
|
|
681
683
|
case SortOptionDisplayName.Modeldesc:
|
|
682
684
|
return 'Årsmodell nyast';
|
|
685
|
+
case SortOptionDisplayName.MileageAsc:
|
|
686
|
+
return 'Miltal lägst';
|
|
687
|
+
case SortOptionDisplayName.Mileagedesc:
|
|
688
|
+
return 'Miltal högst';
|
|
683
689
|
default:
|
|
684
690
|
return str;
|
|
685
691
|
}
|
|
@@ -1785,6 +1791,11 @@ const ContentFooter = styled.div `
|
|
|
1785
1791
|
margin-top: auto;
|
|
1786
1792
|
padding-top: ${size(1)};
|
|
1787
1793
|
`;
|
|
1794
|
+
const PreHeading = styled.div `
|
|
1795
|
+
margin-bottom: ${size(0.25)};
|
|
1796
|
+
color: ${(props) => props.theme.color.textDarkLighten};
|
|
1797
|
+
font-size: 0.75rem;
|
|
1798
|
+
`;
|
|
1788
1799
|
const Heading$2 = styled.h1.attrs(() => ({
|
|
1789
1800
|
className: 'wayke__theme wayke__font--bold',
|
|
1790
1801
|
})) `
|
|
@@ -1849,7 +1860,7 @@ const OldPrice = styled.div `
|
|
|
1849
1860
|
`;
|
|
1850
1861
|
const Label$3 = styled.label `
|
|
1851
1862
|
color: ${(props) => props.theme.color.disabledText};
|
|
1852
|
-
font-size: 0.
|
|
1863
|
+
font-size: 0.75rem;
|
|
1853
1864
|
`;
|
|
1854
1865
|
|
|
1855
1866
|
const Item$5 = styled.li `
|
|
@@ -1960,7 +1971,7 @@ const usePath = () => {
|
|
|
1960
1971
|
return context;
|
|
1961
1972
|
};
|
|
1962
1973
|
|
|
1963
|
-
const ProductCard = ({ id, title, href, image, pathRoute, placeholderImage, description, uspList, price, oldPrice, leasingPrice, businessLeasingPrice, onClick, }) => {
|
|
1974
|
+
const ProductCard = ({ id, title, href, image, pathRoute, placeholderImage, branchName, description, uspList, price, oldPrice, leasingPrice, businessLeasingPrice, onClick, }) => {
|
|
1964
1975
|
const { pushState } = usePath();
|
|
1965
1976
|
const _onClick = useMemo(() => (onClick ? () => onClick(id) : undefined), [id]);
|
|
1966
1977
|
const onHrefClick = useCallback((e) => {
|
|
@@ -1981,6 +1992,7 @@ const ProductCard = ({ id, title, href, image, pathRoute, placeholderImage, desc
|
|
|
1981
1992
|
React__default.createElement(Img, { src: placeholderImage || DEFAULT_PLACEHOLDER_IMAGE }))))),
|
|
1982
1993
|
React__default.createElement(Content, null,
|
|
1983
1994
|
React__default.createElement(ContentBody, null,
|
|
1995
|
+
branchName && React__default.createElement(PreHeading, null, branchName),
|
|
1984
1996
|
React__default.createElement(Heading$2, null, href ? (React__default.createElement(Link, { onClick: onHrefClick, href: href, title: title, "aria-label": title }, title)) : (title)),
|
|
1985
1997
|
description && React__default.createElement(Description$1, null, description),
|
|
1986
1998
|
uspList && (React__default.createElement(Usp, null,
|
|
@@ -2005,7 +2017,7 @@ const resolveImage = (document) => {
|
|
|
2005
2017
|
}
|
|
2006
2018
|
return undefined;
|
|
2007
2019
|
};
|
|
2008
|
-
const Grid = ({ documents, placeholderImage, hashRoute, pathRoute, onClickItem }) => {
|
|
2020
|
+
const Grid = ({ documents, placeholderImage, hashRoute, pathRoute, displayBranchName, onClickItem, }) => {
|
|
2009
2021
|
if (!documents) {
|
|
2010
2022
|
return null;
|
|
2011
2023
|
}
|
|
@@ -2032,7 +2044,7 @@ const Grid = ({ documents, placeholderImage, hashRoute, pathRoute, onClickItem }
|
|
|
2032
2044
|
*/
|
|
2033
2045
|
const _pathRoute = pathRoute ? `${pathRoute}/${document._id}` : undefined;
|
|
2034
2046
|
return (React__default.createElement(Item$4, { key: document._id },
|
|
2035
|
-
React__default.createElement(ProductCard, { id: document._id, onClick: onClickItem, title: document.title, pathRoute: pathRoute, href: _pathRoute ? _pathRoute : hashRoute ? `#${document._id}` : undefined, image: resolveImage(document), placeholderImage: placeholderImage, description: document.shortDescription, uspList: [
|
|
2047
|
+
React__default.createElement(ProductCard, { id: document._id, onClick: onClickItem, title: document.title, pathRoute: pathRoute, href: _pathRoute ? _pathRoute : hashRoute ? `#${document._id}` : undefined, image: resolveImage(document), placeholderImage: placeholderImage, description: document.shortDescription, branchName: displayBranchName ? document.branches?.[0]?.name : undefined, uspList: [
|
|
2036
2048
|
{
|
|
2037
2049
|
title: document.modelYear,
|
|
2038
2050
|
},
|
|
@@ -2432,7 +2444,7 @@ PubSub.publish = (eventName, ...args) => {
|
|
|
2432
2444
|
}
|
|
2433
2445
|
};
|
|
2434
2446
|
|
|
2435
|
-
const WaykeSearch = ({ filterList, initialQueryParams, hashRoute, pathRoute, removeSearchBar, placeholderImage, removeFilterOptions, modifyDocumentTitleSearch, onClickSearchItem, }) => {
|
|
2447
|
+
const WaykeSearch = ({ filterList, initialQueryParams, hashRoute, pathRoute, removeSearchBar, placeholderImage, removeFilterOptions, modifyDocumentTitleSearch, displayBranchName, onClickSearchItem, }) => {
|
|
2436
2448
|
const { error, documents, queryFilter, onFilterUpdate, onInitialize } = useSearch();
|
|
2437
2449
|
useEffect(() => {
|
|
2438
2450
|
if (modifyDocumentTitleSearch) {
|
|
@@ -2470,7 +2482,7 @@ const WaykeSearch = ({ filterList, initialQueryParams, hashRoute, pathRoute, rem
|
|
|
2470
2482
|
React__default.createElement(Result, null,
|
|
2471
2483
|
React__default.createElement(React__default.Fragment, null,
|
|
2472
2484
|
error && (React__default.createElement(Snackbar, { severity: "error", icon: true, heading: "Ett fel har intr\u00E4ffat" }, "V\u00E4nligen f\u00F6rs\u00F6k igen.")),
|
|
2473
|
-
!error && documents && documents.length > 0 && (React__default.createElement(Grid, { hashRoute: hashRoute, pathRoute: pathRoute, onClickItem: onItemClicked, documents: documents, placeholderImage: placeholderImage })),
|
|
2485
|
+
!error && documents && documents.length > 0 && (React__default.createElement(Grid, { hashRoute: hashRoute, pathRoute: pathRoute, onClickItem: onItemClicked, documents: documents, placeholderImage: placeholderImage, displayBranchName: displayBranchName })),
|
|
2474
2486
|
!error && documents && documents.length === 0 && (React__default.createElement(Snackbar, { severity: "warning", icon: true, heading: "Inga resultat" }, "Det finns inga resultat som matchar din s\u00F6kning."))))))),
|
|
2475
2487
|
React__default.createElement(PortalElement, { id: DefaultPortal })));
|
|
2476
2488
|
};
|
|
@@ -4436,10 +4448,11 @@ const DataList = ({ items }) => (React__default.createElement(List$7, null, item
|
|
|
4436
4448
|
const Leasing = ({ financialOption }) => {
|
|
4437
4449
|
const [modal, setModal] = useState(false);
|
|
4438
4450
|
const toggleModal = useCallback(() => setModal(!modal), [modal]);
|
|
4439
|
-
const { image, description, monthlyCost, duration, mileage } = financialOption;
|
|
4451
|
+
const { image, description, monthlyCost, duration, mileage, type, name } = financialOption;
|
|
4452
|
+
const title = type === 'leasing' ? 'Privatleasa' : type === 'business-leasing' ? 'Företagsleasa' : type;
|
|
4440
4453
|
return (React__default.createElement(React__default.Fragment, null,
|
|
4441
|
-
modal && (React__default.createElement(Modal, { title:
|
|
4442
|
-
image && React__default.createElement(Image$2, { src: image, alt:
|
|
4454
|
+
modal && (React__default.createElement(Modal, { title: title, onClose: toggleModal },
|
|
4455
|
+
image && React__default.createElement(Image$2, { src: image, alt: title }),
|
|
4443
4456
|
description && React__default.createElement(Content$2, { dangerouslySetInnerHTML: { __html: description } }),
|
|
4444
4457
|
React__default.createElement(ModalFoldout, null,
|
|
4445
4458
|
React__default.createElement(ModalFoldoutBody, null,
|
|
@@ -4461,7 +4474,7 @@ const Leasing = ({ financialOption }) => {
|
|
|
4461
4474
|
React__default.createElement(React__default.Fragment, null, monthlyCost !== null && monthlyCost !== undefined && (React__default.createElement(OptionBoxHeading, null, `ca ${numberSeparator(monthlyCost)} kr/mån`))),
|
|
4462
4475
|
React__default.createElement(OptionBoxContent, null,
|
|
4463
4476
|
React__default.createElement("p", null,
|
|
4464
|
-
|
|
4477
|
+
title,
|
|
4465
4478
|
' ',
|
|
4466
4479
|
mileage?.current && duration?.current && (React__default.createElement(React__default.Fragment, null,
|
|
4467
4480
|
React__default.createElement(UtilityTextPrimary, null,
|
|
@@ -4474,8 +4487,8 @@ const Leasing = ({ financialOption }) => {
|
|
|
4474
4487
|
" m\u00E5n"),
|
|
4475
4488
|
".",
|
|
4476
4489
|
' '))),
|
|
4477
|
-
React__default.createElement("p", null,
|
|
4478
|
-
React__default.createElement(ButtonInline, { onClick: toggleModal }, "L\u00E4s mer"))))));
|
|
4490
|
+
name && (React__default.createElement("p", null,
|
|
4491
|
+
React__default.createElement(ButtonInline, { onClick: toggleModal }, "L\u00E4s mer")))))));
|
|
4479
4492
|
};
|
|
4480
4493
|
|
|
4481
4494
|
const FinancialOptionDetail$1 = gql `
|
|
@@ -4770,7 +4783,7 @@ const FinancialOptions = ({ id, financialOptions }) => (React__default.createEle
|
|
|
4770
4783
|
React__default.createElement(RepeatTiny, null,
|
|
4771
4784
|
React__default.createElement(VisualHeading, null, "Andra finansieringsalternativ")),
|
|
4772
4785
|
React__default.createElement(RepeatTiny, null, financialOptions.map((financialOption, index) => (React__default.createElement(Fragment, { key: index },
|
|
4773
|
-
financialOption.type === 'leasing' && React__default.createElement(Leasing, { financialOption: financialOption }),
|
|
4786
|
+
(financialOption.type === 'leasing' || financialOption.type === 'business-leasing') && (React__default.createElement(Leasing, { financialOption: financialOption })),
|
|
4774
4787
|
financialOption.type === 'loan' && React__default.createElement(Loan, { id: id, financialOption: financialOption })))))));
|
|
4775
4788
|
|
|
4776
4789
|
const Wrapper$n = styled.article `
|
|
@@ -5343,10 +5356,8 @@ const ManufacturerPackageOption = ({ packageOption }) => {
|
|
|
5343
5356
|
React__default.createElement(LogoBox, { logo: packageOption.image, alt: "Logotyp", wide: true })))));
|
|
5344
5357
|
};
|
|
5345
5358
|
|
|
5346
|
-
const initialValue = {};
|
|
5347
|
-
const getInitialValue = (title) => title && !!initialValue[title];
|
|
5348
5359
|
const ToggleItem = ({ title, value, type, onClickVisible, onClickValue }) => {
|
|
5349
|
-
const [visible, setVisible] = useState(
|
|
5360
|
+
const [visible, setVisible] = useState(false);
|
|
5350
5361
|
const _onClickValue = useCallback(() => {
|
|
5351
5362
|
if (onClickValue) {
|
|
5352
5363
|
onClickValue();
|
|
@@ -5354,7 +5365,6 @@ const ToggleItem = ({ title, value, type, onClickVisible, onClickValue }) => {
|
|
|
5354
5365
|
}, []);
|
|
5355
5366
|
const onClick = useCallback(() => {
|
|
5356
5367
|
if (!visible) {
|
|
5357
|
-
initialValue[type] = true;
|
|
5358
5368
|
setVisible(true);
|
|
5359
5369
|
if (onClickVisible) {
|
|
5360
5370
|
onClickVisible();
|
|
@@ -5888,7 +5898,7 @@ const RelatedSearchContext = createContext({
|
|
|
5888
5898
|
fetchRelated: (_) => { },
|
|
5889
5899
|
});
|
|
5890
5900
|
|
|
5891
|
-
const useRelatedSearch = (id) => {
|
|
5901
|
+
const useRelatedSearch = (id, authorizedReseller) => {
|
|
5892
5902
|
const data = useContext(RelatedSearchContext);
|
|
5893
5903
|
useEffect(() => {
|
|
5894
5904
|
const searchParams = new URLSearchParams();
|
|
@@ -5896,6 +5906,9 @@ const useRelatedSearch = (id) => {
|
|
|
5896
5906
|
if (data.moreLikeThisUrl && id) {
|
|
5897
5907
|
searchParams.set('id', id);
|
|
5898
5908
|
}
|
|
5909
|
+
if (authorizedReseller) {
|
|
5910
|
+
searchParams.set('isAuthorizedResellerForManufacturer', 'true');
|
|
5911
|
+
}
|
|
5899
5912
|
data.fetchRelated(searchParams);
|
|
5900
5913
|
}, [id]);
|
|
5901
5914
|
return data;
|
|
@@ -5911,8 +5924,8 @@ const regexPathGuid = (path) => {
|
|
|
5911
5924
|
return r;
|
|
5912
5925
|
};
|
|
5913
5926
|
|
|
5914
|
-
const Related = ({ id, hashRoute, pathRoute, onClickSearchItem }) => {
|
|
5915
|
-
const { loading, response, moreLikeThisUrl } = useRelatedSearch(id);
|
|
5927
|
+
const Related = ({ id, hashRoute, pathRoute, authorizedReseller, displayBranchName, onClickSearchItem, }) => {
|
|
5928
|
+
const { loading, response, moreLikeThisUrl } = useRelatedSearch(id, !!authorizedReseller);
|
|
5916
5929
|
const onItemClicked = useCallback((id) => {
|
|
5917
5930
|
PubSub.publish('ItemClicked', id);
|
|
5918
5931
|
if (onClickSearchItem) {
|
|
@@ -5943,7 +5956,7 @@ const Related = ({ id, hashRoute, pathRoute, onClickSearchItem }) => {
|
|
|
5943
5956
|
? window.location.pathname.replace(r, document._id)
|
|
5944
5957
|
: `${window.location.pathname}${prefix}${document._id}`;
|
|
5945
5958
|
return (React__default.createElement(OverflowGridItem, { key: document._id },
|
|
5946
|
-
React__default.createElement(ProductCard, { id: document._id, onClick: onItemClicked, title: document.title, href: pathRoute ? pathRouteUrl : hashRoute ? `#${document._id}` : undefined, image: document.featuredImage?.files?.[0]?.url, description: document.shortDescription, uspList: [
|
|
5959
|
+
React__default.createElement(ProductCard, { id: document._id, onClick: onItemClicked, title: document.title, href: pathRoute ? pathRouteUrl : hashRoute ? `#${document._id}` : undefined, image: document.featuredImage?.files?.[0]?.url, description: document.shortDescription, branchName: displayBranchName ? document.branches?.[0]?.name : undefined, uspList: [
|
|
5947
5960
|
{
|
|
5948
5961
|
title: document.modelYear,
|
|
5949
5962
|
},
|
|
@@ -6174,7 +6187,7 @@ const StaticMap = ({ position }) => {
|
|
|
6174
6187
|
React__default.createElement(ButtonContent, null, "Visa karta")))));
|
|
6175
6188
|
};
|
|
6176
6189
|
|
|
6177
|
-
const Branch = ({ branch, loading }) => {
|
|
6190
|
+
const Branch = ({ branch, loading, displayBranchName }) => {
|
|
6178
6191
|
const [modal, setModal] = useState(false);
|
|
6179
6192
|
const openModal = useCallback(() => setModal(true), []);
|
|
6180
6193
|
const closeModal = useCallback(() => setModal(false), []);
|
|
@@ -6189,9 +6202,11 @@ const Branch = ({ branch, loading }) => {
|
|
|
6189
6202
|
return (React__default.createElement(React__default.Fragment, null,
|
|
6190
6203
|
modal && (React__default.createElement(BranchModal, { loading: loading, connections: branch?.connections, onClose: closeModal })),
|
|
6191
6204
|
React__default.createElement(Repeat, null,
|
|
6192
|
-
React__default.createElement(H2, { noMargin: true },
|
|
6193
|
-
? `Den här bilen finns på
|
|
6194
|
-
:
|
|
6205
|
+
React__default.createElement(H2, { noMargin: true }, displayBranchName
|
|
6206
|
+
? `Den här bilen finns på ${branch.name}`
|
|
6207
|
+
: branch?.location?.city
|
|
6208
|
+
? `Den här bilen finns på vår anläggning i ${branch?.location?.city}`
|
|
6209
|
+
: 'Kontakt')),
|
|
6195
6210
|
React__default.createElement(Repeat, null,
|
|
6196
6211
|
React__default.createElement(StaticMap, { position: branch?.location?.position })),
|
|
6197
6212
|
(branch?.connections?.length || 0) > 1 && (React__default.createElement(Repeat, null,
|
|
@@ -6259,6 +6274,7 @@ const SEARCH_ITEM_BRANCH_QUERY = gql `
|
|
|
6259
6274
|
mrf
|
|
6260
6275
|
centralStorage
|
|
6261
6276
|
ecommerce
|
|
6277
|
+
authorizedReseller
|
|
6262
6278
|
}
|
|
6263
6279
|
logotype
|
|
6264
6280
|
openingHours {
|
|
@@ -6658,6 +6674,8 @@ const HINTS = Object.freeze({
|
|
|
6658
6674
|
finish: '',
|
|
6659
6675
|
fuelConsumptionCityDriving: 'Bränsleförbrukning vid stadskörning.',
|
|
6660
6676
|
fuelConsumptionCountryRoadDriving: 'Bränsleförbrukning vid landsvägskörning.',
|
|
6677
|
+
fuelConsumptionMixedDrivingNEDC: 'Bränsleförbrukning vid blandad körning.',
|
|
6678
|
+
fuelConsumptionMixedDrivingWLTP: 'Bränsleförbrukning vid blandad körning.',
|
|
6661
6679
|
fuelConsumptionMixedDriving: 'Bränsleförbrukning vid blandad körning. Dvs. stadskörning och landsvägskörning under en och samma färd.',
|
|
6662
6680
|
fuelType: 'Vad bilen ska tankas med och drivs av.',
|
|
6663
6681
|
gearboxName: '',
|
|
@@ -7225,7 +7243,7 @@ const Documents = ({ documents }) => {
|
|
|
7225
7243
|
React__default.createElement(DocumentList, { documents: group.documents }))))));
|
|
7226
7244
|
};
|
|
7227
7245
|
|
|
7228
|
-
const WaykeSearchItem = ({ id, hashRoute, pathRoute, disableResetScrollOnInit, placeholderImage, modifyDocumentTitleItem, onClickSearchItem, }) => {
|
|
7246
|
+
const WaykeSearchItem = ({ id, hashRoute, pathRoute, disableResetScrollOnInit, placeholderImage, modifyDocumentTitleItem, displayBranchName, onClickSearchItem, }) => {
|
|
7229
7247
|
const { ecomSettings } = useSettings();
|
|
7230
7248
|
const ecomContext = useRef();
|
|
7231
7249
|
const { loading, data: result } = useSearchItem(id);
|
|
@@ -7358,13 +7376,12 @@ const WaykeSearchItem = ({ id, hashRoute, pathRoute, disableResetScrollOnInit, p
|
|
|
7358
7376
|
React__default.createElement(UspList, { items: options }))))),
|
|
7359
7377
|
React__default.createElement(Documents, { documents: documents }),
|
|
7360
7378
|
React__default.createElement(ProductPageMainSection, null,
|
|
7361
|
-
React__default.createElement(Branch, { branch: branch, loading: loadingCentralStorageVehicle }),
|
|
7379
|
+
React__default.createElement(Branch, { branch: branch, displayBranchName: displayBranchName, loading: loadingCentralStorageVehicle }),
|
|
7362
7380
|
ecommerce && ecommerce.enabled && (React__default.createElement(Repeat, null,
|
|
7363
7381
|
React__default.createElement(ButtonPrimary, { disabled: !!ecommerce.reserved, title: "K\u00F6p bilen online", onClick: () => ecomContext.current?.start() }, "K\u00F6p bilen online")))),
|
|
7364
7382
|
React__default.createElement(PackageOptions, { packageOptions: packageOptions }),
|
|
7365
7383
|
React__default.createElement(ManufacturerPackageOption, { packageOption: manufacturer?.packageOption }))))),
|
|
7366
|
-
React__default.createElement(Related, { id: id, hashRoute: hashRoute, pathRoute: pathRoute, onClickSearchItem: onClickSearchItem })),
|
|
7367
|
-
false ,
|
|
7384
|
+
React__default.createElement(Related, { id: id, hashRoute: hashRoute, pathRoute: pathRoute, authorizedReseller: !!branch?.flags?.authorizedReseller, displayBranchName: displayBranchName, onClickSearchItem: onClickSearchItem })),
|
|
7368
7385
|
React__default.createElement(PortalElement, { id: DefaultPortal }),
|
|
7369
7386
|
demoCarModal && React__default.createElement(DemoCarModal, { onClose: onToggleDemoCarModal })));
|
|
7370
7387
|
};
|
|
@@ -7727,7 +7744,7 @@ const useHashGuid = () => {
|
|
|
7727
7744
|
return id;
|
|
7728
7745
|
};
|
|
7729
7746
|
|
|
7730
|
-
const WaykeComposite = ({ filterList, initialQueryParams, removeSearchBar, removeFilterOptions, disableResetScrollOnInit, placeholderImage, pathRoute, modifyDocumentTitleItem, modifyDocumentTitleSearch, }) => {
|
|
7747
|
+
const WaykeComposite = ({ filterList, initialQueryParams, removeSearchBar, removeFilterOptions, disableResetScrollOnInit, placeholderImage, pathRoute, modifyDocumentTitleItem, modifyDocumentTitleSearch, displayBranchName, }) => {
|
|
7731
7748
|
const hashId = useHashGuid();
|
|
7732
7749
|
const { id: pathId } = usePath();
|
|
7733
7750
|
useEffect(() => {
|
|
@@ -7741,7 +7758,7 @@ const WaykeComposite = ({ filterList, initialQueryParams, removeSearchBar, remov
|
|
|
7741
7758
|
}
|
|
7742
7759
|
}, [hashId]);
|
|
7743
7760
|
const id = pathId || hashId;
|
|
7744
|
-
return (React__default.createElement(React__default.Fragment, null, id ? (React__default.createElement(WaykeSearchItem, { id: id, hashRoute: !pathRoute, disableResetScrollOnInit: disableResetScrollOnInit, placeholderImage: placeholderImage, pathRoute: pathRoute, modifyDocumentTitleItem: modifyDocumentTitleItem })) : (React__default.createElement(WaykeSearch, { filterList: filterList, initialQueryParams: initialQueryParams, removeSearchBar: removeSearchBar, hashRoute: !pathRoute, placeholderImage: placeholderImage, pathRoute: pathRoute, removeFilterOptions: removeFilterOptions, modifyDocumentTitleSearch: modifyDocumentTitleSearch }))));
|
|
7761
|
+
return (React__default.createElement(React__default.Fragment, null, id ? (React__default.createElement(WaykeSearchItem, { id: id, hashRoute: !pathRoute, disableResetScrollOnInit: disableResetScrollOnInit, placeholderImage: placeholderImage, pathRoute: pathRoute, modifyDocumentTitleItem: modifyDocumentTitleItem, displayBranchName: displayBranchName })) : (React__default.createElement(WaykeSearch, { filterList: filterList, initialQueryParams: initialQueryParams, removeSearchBar: removeSearchBar, hashRoute: !pathRoute, placeholderImage: placeholderImage, pathRoute: pathRoute, removeFilterOptions: removeFilterOptions, modifyDocumentTitleSearch: modifyDocumentTitleSearch, displayBranchName: displayBranchName }))));
|
|
7745
7762
|
};
|
|
7746
7763
|
|
|
7747
7764
|
const WaykeCompositeWithProvider = ({ provider, composite }) => (React__default.createElement(WaykeProvider, { ...provider },
|