@wayke-se/components-react 3.5.3 → 3.6.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 (40) hide show
  1. package/dist-node/index.js +622 -127
  2. package/dist-node/index.js.map +1 -1
  3. package/dist-src/components/AccessoryCard/index.js +14 -0
  4. package/dist-src/components/AccessoryCard/wrapper.js +90 -0
  5. package/dist-src/components/DocumentList/wrapper.js +1 -1
  6. package/dist-src/components/Gallery/index.js +7 -4
  7. package/dist-src/components/Gallery/wrapper.js +1 -38
  8. package/dist-src/components/Icon/index.js +2 -0
  9. package/dist-src/components/Image/index.js +5 -0
  10. package/dist-src/components/Link/index.js +28 -0
  11. package/dist-src/components/NavButton/index.js +42 -0
  12. package/dist-src/components/OverflowGrid/index.js +56 -66
  13. package/dist-src/components/OverflowGrid/wrapper.js +144 -0
  14. package/dist-src/components/PriceBox/index.js +6 -0
  15. package/dist-src/components/PriceBox/wrapper.js +34 -0
  16. package/dist-src/layout/theme.js +8 -0
  17. package/dist-src/layouts/searchItem/Accessories/AccessoryModal.js +51 -0
  18. package/dist-src/layouts/searchItem/Accessories/index.js +32 -0
  19. package/dist-src/layouts/searchItem/Related.js +23 -25
  20. package/dist-src/layouts/searchItem/index.js +3 -1
  21. package/dist-src/queries/SEARCH_ITEM_BRANCH_QUERY.js +18 -0
  22. package/dist-src/queries/SEARCH_ITEM_QUERY.js +18 -0
  23. package/dist-types/@types/codegen/types.d.ts +17 -0
  24. package/dist-types/components/AccessoryCard/index.d.ts +16 -0
  25. package/dist-types/components/AccessoryCard/wrapper.d.ts +18 -0
  26. package/dist-types/components/Gallery/wrapper.d.ts +2 -6
  27. package/dist-types/components/Icon/index.d.ts +1 -0
  28. package/dist-types/components/Image/index.d.ts +1 -0
  29. package/dist-types/components/Link/index.d.ts +7 -0
  30. package/dist-types/components/NavButton/index.d.ts +3 -0
  31. package/dist-types/components/OverflowGrid/index.d.ts +12 -3
  32. package/dist-types/components/OverflowGrid/wrapper.d.ts +18 -0
  33. package/dist-types/components/PriceBox/index.d.ts +11 -0
  34. package/dist-types/components/PriceBox/wrapper.d.ts +10 -0
  35. package/dist-types/layout/theme.d.ts +8 -0
  36. package/dist-types/layouts/searchItem/Accessories/AccessoryModal.d.ts +8 -0
  37. package/dist-types/layouts/searchItem/Accessories/index.d.ts +7 -0
  38. package/dist-web/index.js +535 -122
  39. package/dist-web/index.js.map +1 -1
  40. package/package.json +1 -1
@@ -0,0 +1,32 @@
1
+ import React, { useState } from 'react';
2
+ import { numberSeparator } from '../../../utils/formats';
3
+ import { ProductPageMainSection } from '../../../components/ProductPage/index';
4
+ import { Repeat } from '../../../components/Repeat/index';
5
+ import { H2 } from '../../../components/Heading/index';
6
+ import Content from '../../../components/Content/index';
7
+ import AccessoryCard from '../../../components/AccessoryCard/index';
8
+ import OverflowGrid from '../../../components/OverflowGrid/index';
9
+ import AccesoryModal from './AccessoryModal';
10
+ const AccessoriesSection = ({ accessories }) => {
11
+ const [modal, setModal] = useState();
12
+ const onOpenModal = (accessory) => setModal(accessory);
13
+ const onCloseModal = () => setModal(undefined);
14
+ if (!accessories?.length)
15
+ return null;
16
+ return (React.createElement(React.Fragment, null,
17
+ modal && React.createElement(AccesoryModal, { accessory: modal, onClose: onCloseModal }),
18
+ React.createElement(ProductPageMainSection, null,
19
+ React.createElement(Repeat, null,
20
+ React.createElement(H2, { noMargin: true }, "Tillbeh\u00F6r")),
21
+ React.createElement(Repeat, null,
22
+ React.createElement(Content, null,
23
+ React.createElement("p", null, "Tillbeh\u00F6r som passar till detta fordon."))),
24
+ React.createElement(Repeat, null,
25
+ React.createElement(OverflowGrid, { columns: 1.05, columnsSm: 2.1, columnsMd: 2, spacing: 2, items: accessories.map((accessory) => (React.createElement(AccessoryCard, { key: accessory.id, title: accessory.name, image: accessory.images?.[0]
26
+ ? {
27
+ src: `${accessory.images?.[0]}?w=539&h=303`,
28
+ alt: accessory.name,
29
+ }
30
+ : undefined, price: `${numberSeparator(accessory.price)} kr`, preamble: accessory.excerpt, readMoreCta: () => onOpenModal(accessory) }))) })))));
31
+ };
32
+ export default AccessoriesSection;
@@ -3,7 +3,7 @@ import Container from '../../components/Container/index';
3
3
  import { Repeat } from '../../components/Repeat/index';
4
4
  import { PageSection } from '../../components/Page/index';
5
5
  import SectionHeader from '../../components/SectionHeader/index';
6
- import { OverflowGridList, OverflowGrid, OverflowGridItem, } from '../../components/OverflowGrid/index';
6
+ import OverflowGrid from '../../components/OverflowGrid/index';
7
7
  import ProductCard from '../../components/ProductCard/index';
8
8
  import { H2 } from '../../components/Heading/index';
9
9
  import useRelatedSearch from '../../State/RelatedSearch/useRelatedSearch';
@@ -33,8 +33,7 @@ const Related = ({ id, hashRoute, pathRoute, authorizedReseller, displayBranchNa
33
33
  React.createElement(SectionHeader, { onClick: () => { }, actionTitle: "Visa alla" },
34
34
  React.createElement(H2, { noMargin: true }, "Senast inkomna")))),
35
35
  React.createElement(Repeat, null,
36
- React.createElement(OverflowGrid, null,
37
- React.createElement(OverflowGridList, null, response?.documentList.documents.map((document) => {
36
+ React.createElement(OverflowGrid, { accentBg: true, columns: 1.05, columnsSm: 2.1, columnsMd: 3, spacing: 2, items: response?.documentList.documents.map((document) => {
38
37
  const prefix = pathRoute ? `/${pathRoute}` : '/';
39
38
  const r = regexPathGuid();
40
39
  const pathRouteUrl = window.location.pathname === '/'
@@ -42,27 +41,26 @@ const Related = ({ id, hashRoute, pathRoute, authorizedReseller, displayBranchNa
42
41
  : r.test(`${pathRoute}${id}`)
43
42
  ? window.location.pathname.replace(r, document._id)
44
43
  : `${window.location.pathname}${prefix}${document._id}`;
45
- return (React.createElement(OverflowGridItem, { key: document._id },
46
- React.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: [
47
- {
48
- title: document.modelYear,
49
- },
50
- {
51
- title: `${numberSeparator(document.mileage)} mil`,
52
- },
53
- {
54
- title: document.gearboxType,
55
- },
56
- {
57
- title: document.fuelType,
58
- },
59
- ], price: `${numberSeparator(document.price)} kr`, oldPrice: document.oldPrice !== undefined && document.price < document.oldPrice
60
- ? `${numberSeparator(document.oldPrice)} kr`
61
- : undefined, leasingPrice: document.leasingPrice !== undefined
62
- ? `${numberSeparator(document.leasingPrice)} kr/mån`
63
- : undefined, businessLeasingPrice: document.businessLeasingPrice !== undefined
64
- ? `${numberSeparator(document.businessLeasingPrice)} kr/mån`
65
- : undefined, pathRoute: pathRoute })));
66
- })))))));
44
+ return (React.createElement(ProductCard, { key: document._id, 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: [
45
+ {
46
+ title: document.modelYear,
47
+ },
48
+ {
49
+ title: `${numberSeparator(document.mileage)} mil`,
50
+ },
51
+ {
52
+ title: document.gearboxType,
53
+ },
54
+ {
55
+ title: document.fuelType,
56
+ },
57
+ ], price: `${numberSeparator(document.price)} kr`, oldPrice: document.oldPrice !== undefined && document.price < document.oldPrice
58
+ ? `${numberSeparator(document.oldPrice)} kr`
59
+ : undefined, leasingPrice: document.leasingPrice !== undefined
60
+ ? `${numberSeparator(document.leasingPrice)} kr/mån`
61
+ : undefined, businessLeasingPrice: document.businessLeasingPrice !== undefined
62
+ ? `${numberSeparator(document.businessLeasingPrice)} kr/mån`
63
+ : undefined, pathRoute: pathRoute }));
64
+ }) })))));
67
65
  };
68
66
  export default Related;
@@ -33,6 +33,7 @@ import Property from './Property';
33
33
  import DemoCarModal from './DemoCarModal';
34
34
  import useSettings from '../../State/Settings/useSettings';
35
35
  import Documents from './Documents';
36
+ import AccessoriesSection from './Accessories/index';
36
37
  const WaykeSearchItem = ({ id, hashRoute, pathRoute, disableResetScrollOnInit, placeholderImage, modifyDocumentTitleItem, displayBranchName, onClickSearchItem, }) => {
37
38
  const { ecomSettings } = useSettings();
38
39
  const ecomContext = useRef();
@@ -86,7 +87,7 @@ const WaykeSearchItem = ({ id, hashRoute, pathRoute, disableResetScrollOnInit, p
86
87
  const { vehicle } = result;
87
88
  const contact = centralStorageVehicle?.contact;
88
89
  const branch = centralStorageVehicle?.branch;
89
- const { title, shortDescription, media, description, price, discount, financialOptions, manufacturer, ecommerce, packageOptions, publishedAt, documents, availableFrom, flags, } = vehicle;
90
+ const { title, accessories, shortDescription, media, description, price, discount, financialOptions, manufacturer, ecommerce, packageOptions, publishedAt, documents, availableFrom, flags, } = vehicle;
90
91
  const insuranceOptions = centralStorageVehicle?.insuranceOptions
91
92
  ? centralStorageVehicle.insuranceOptions
92
93
  : vehicle.insuranceOptions;
@@ -169,6 +170,7 @@ const WaykeSearchItem = ({ id, hashRoute, pathRoute, disableResetScrollOnInit, p
169
170
  React.createElement(Branch, { branch: branch, displayBranchName: displayBranchName, loading: loadingCentralStorageVehicle }),
170
171
  ecommerce && ecommerce.enabled && (React.createElement(Repeat, null,
171
172
  React.createElement(ButtonPrimary, { disabled: !!ecommerce.reserved, title: "K\u00F6p bilen online", onClick: () => ecomContext.current?.start() }, "K\u00F6p bilen online")))),
173
+ React.createElement(AccessoriesSection, { accessories: accessories }),
172
174
  React.createElement(PackageOptions, { packageOptions: packageOptions }),
173
175
  React.createElement(ManufacturerPackageOption, { packageOption: manufacturer?.packageOption }))))),
174
176
  React.createElement(Related, { id: id, hashRoute: hashRoute, pathRoute: pathRoute, authorizedReseller: !!branch?.flags?.authorizedReseller, displayBranchName: displayBranchName, onClickSearchItem: onClickSearchItem })),
@@ -14,6 +14,24 @@ const SEARCH_ITEM_BRANCH_QUERY = gql `
14
14
  phonenumber
15
15
  avatar
16
16
  }
17
+ accessories {
18
+ articleNumber
19
+ description
20
+ excerpt
21
+ id
22
+ images
23
+ logotype
24
+ manufacturer
25
+ model
26
+ name
27
+ price
28
+ assemblyPrice
29
+ productPage {
30
+ title
31
+ url
32
+ }
33
+ salePrice
34
+ }
17
35
  branch {
18
36
  connections {
19
37
  id
@@ -25,6 +25,24 @@ const SEARCH_ITEM_QUERY = gql `
25
25
  phonenumber
26
26
  avatar
27
27
  }
28
+ accessories {
29
+ articleNumber
30
+ description
31
+ excerpt
32
+ id
33
+ images
34
+ logotype
35
+ manufacturer
36
+ model
37
+ name
38
+ price
39
+ assemblyPrice
40
+ productPage {
41
+ title
42
+ url
43
+ }
44
+ salePrice
45
+ }
28
46
  manufacturer {
29
47
  description
30
48
  logotype
@@ -36,6 +36,22 @@ export type Scalars = {
36
36
  };
37
37
  VehicleDataPropertySet: any;
38
38
  };
39
+ export type Accessory = {
40
+ __typename?: 'Accessory';
41
+ articleNumber?: Maybe<Scalars['String']>;
42
+ assemblyPrice?: Maybe<Scalars['Float']>;
43
+ description: Scalars['String'];
44
+ excerpt: Scalars['String'];
45
+ id: Scalars['ID'];
46
+ images: Array<Scalars['String']>;
47
+ logotype?: Maybe<Scalars['String']>;
48
+ manufacturer?: Maybe<Scalars['String']>;
49
+ model?: Maybe<Scalars['String']>;
50
+ name: Scalars['String'];
51
+ price: Scalars['Float'];
52
+ productPage?: Maybe<Link>;
53
+ salePrice?: Maybe<Scalars['Float']>;
54
+ };
39
55
  export type Branch = {
40
56
  __typename?: 'Branch';
41
57
  connections: Array<BranchConnection>;
@@ -294,6 +310,7 @@ export type Service = {
294
310
  };
295
311
  export type Vehicle = {
296
312
  __typename?: 'Vehicle';
313
+ accessories: Array<Accessory>;
297
314
  availableFrom?: Maybe<Scalars['DateTime']>;
298
315
  branch?: Maybe<Branch>;
299
316
  contact?: Maybe<ContactOptions>;
@@ -0,0 +1,16 @@
1
+ /// <reference types="react" />
2
+ interface AccessoryCardImageProps {
3
+ src: string;
4
+ srcSet?: string;
5
+ alt: string;
6
+ }
7
+ interface AccessoryCardProps {
8
+ title: string;
9
+ image?: AccessoryCardImageProps;
10
+ branding?: AccessoryCardImageProps;
11
+ price?: string;
12
+ preamble?: string;
13
+ readMoreCta?: () => void;
14
+ }
15
+ declare const AccessoryCard: ({ title, image, branding, price, preamble, readMoreCta, }: AccessoryCardProps) => JSX.Element;
16
+ export default AccessoryCard;
@@ -0,0 +1,18 @@
1
+ export declare const Wrapper: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
2
+ export declare const Image: import("styled-components").StyledComponent<"img", import("styled-components").DefaultTheme, {}, never>;
3
+ export declare const ImageaPlaceholder: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
4
+ export declare const Body: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
5
+ export declare const Heading: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
6
+ export declare const Title: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {
7
+ className: "wayke__theme wayke__font--bold";
8
+ }, "className">;
9
+ export declare const Branding: import("styled-components").StyledComponent<"img", import("styled-components").DefaultTheme, {}, never>;
10
+ export declare const Price: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {
11
+ className: "wayke__theme wayke__font--bold";
12
+ }, "className">;
13
+ export declare const Preamble: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
14
+ export declare const ReadMoreBtn: import("styled-components").StyledComponent<"button", import("styled-components").DefaultTheme, {
15
+ type: "button";
16
+ } & {
17
+ className: "wayke__theme wayke__font--bold wayke__color--primary-text";
18
+ }, "type" | "className">;
@@ -6,12 +6,8 @@ export declare const Item: import("styled-components").StyledComponent<"div", im
6
6
  export declare const SliderWrapper: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
7
7
  export declare const Image: import("styled-components").StyledComponent<"img", import("styled-components").DefaultTheme, {}, never>;
8
8
  export declare const ImageFull: import("styled-components").StyledComponent<"img", import("styled-components").DefaultTheme, {}, never>;
9
- export declare const ArrowLeft: import("styled-components").StyledComponent<"button", import("styled-components").DefaultTheme, {
10
- type: "button";
11
- }, "type">;
12
- export declare const ArrowRight: import("styled-components").StyledComponent<"button", import("styled-components").DefaultTheme, {
13
- type: "button";
14
- }, "type">;
9
+ export declare const ArrowLeft: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
10
+ export declare const ArrowRight: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
15
11
  export declare const QuickNav: import("styled-components").StyledComponent<"ul", import("styled-components").DefaultTheme, {}, never>;
16
12
  export declare const QuickNavItem: import("styled-components").StyledComponent<"li", import("styled-components").DefaultTheme, {
17
13
  className: "wayke__theme wayke__color--primary-text";
@@ -13,4 +13,5 @@ export declare const IconRadio: ({ block }: IconInfoProps) => JSX.Element;
13
13
  export declare const IconSearch: ({ block }: IconInfoProps) => JSX.Element;
14
14
  export declare const IconExclamationCircle: ({ block }: IconInfoProps) => JSX.Element;
15
15
  export declare const IconExclamationTriangle: ({ block }: IconInfoProps) => JSX.Element;
16
+ export declare const IconImage: ({ block }: IconInfoProps) => JSX.Element;
16
17
  export {};
@@ -0,0 +1 @@
1
+ export declare const Image: import("styled-components").StyledComponent<"img", import("styled-components").DefaultTheme, {}, never>;
@@ -0,0 +1,7 @@
1
+ interface LinkProps {
2
+ $hoverGhost?: boolean;
3
+ }
4
+ export declare const Link: import("styled-components").StyledComponent<"a", import("styled-components").DefaultTheme, {
5
+ className: "wayke__theme wayke__color--primary-text";
6
+ } & LinkProps, "className">;
7
+ export {};
@@ -0,0 +1,3 @@
1
+ export declare const NavButton: import("styled-components").StyledComponent<"button", import("styled-components").DefaultTheme, {
2
+ type: "button";
3
+ }, "type">;
@@ -1,3 +1,12 @@
1
- export declare const OverflowGrid: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
2
- export declare const OverflowGridList: import("styled-components").StyledComponent<"ul", import("styled-components").DefaultTheme, {}, never>;
3
- export declare const OverflowGridItem: import("styled-components").StyledComponent<"li", import("styled-components").DefaultTheme, {}, never>;
1
+ import React from 'react';
2
+ export interface IOverflowGrid {
3
+ items: React.ReactNode[];
4
+ itemKeyBase?: string;
5
+ spacing?: number;
6
+ columns?: number;
7
+ columnsSm?: number;
8
+ columnsMd?: number;
9
+ accentBg?: boolean;
10
+ }
11
+ declare const OverflowGrid: ({ items, itemKeyBase, spacing, columns, columnsSm, columnsMd, accentBg, }: IOverflowGrid) => JSX.Element;
12
+ export default OverflowGrid;
@@ -0,0 +1,18 @@
1
+ interface WrapperProps {
2
+ $accentBg?: boolean;
3
+ }
4
+ export declare const Wrapper: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, WrapperProps, never>;
5
+ export declare const Item: import("styled-components").StyledComponent<"li", import("styled-components").DefaultTheme, {}, never>;
6
+ interface ListProps {
7
+ $columns?: number;
8
+ $columnsSm?: number;
9
+ $columnsMd?: number;
10
+ }
11
+ export declare const List: import("styled-components").StyledComponent<"ul", import("styled-components").DefaultTheme, ListProps, never>;
12
+ interface ListWrapperProps {
13
+ $spacing?: number;
14
+ }
15
+ export declare const ListWrapper: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, ListWrapperProps, never>;
16
+ export declare const PrevBtn: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
17
+ export declare const NextBtn: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
18
+ export {};
@@ -0,0 +1,11 @@
1
+ /// <reference types="react" />
2
+ interface PriceBoxItemProps {
3
+ label: string;
4
+ price: string;
5
+ oldPrice?: boolean;
6
+ }
7
+ interface PriceBoxProps {
8
+ prices: PriceBoxItemProps[];
9
+ }
10
+ declare const PriceBox: ({ prices }: PriceBoxProps) => JSX.Element;
11
+ export default PriceBox;
@@ -0,0 +1,10 @@
1
+ export declare const Wrapper: import("styled-components").StyledComponent<"ul", import("styled-components").DefaultTheme, {}, never>;
2
+ interface RowProps {
3
+ $oldPrice?: boolean;
4
+ }
5
+ export declare const Row: import("styled-components").StyledComponent<"li", import("styled-components").DefaultTheme, RowProps, never>;
6
+ export declare const Label: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
7
+ export declare const Price: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {
8
+ className: "wayke__theme wayke__font--bold";
9
+ }, "className">;
10
+ export {};
@@ -31,6 +31,14 @@ declare const theme: {
31
31
  Lg: string;
32
32
  LtLg: string;
33
33
  };
34
+ mask: {
35
+ gradient: {
36
+ toTop: string;
37
+ toBottom: string;
38
+ toLeft: string;
39
+ toRight: string;
40
+ };
41
+ };
34
42
  distances: {
35
43
  baseUnit: string;
36
44
  inputHeight: string;
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ import { Accessory } from '../../../@types/codegen/types';
3
+ interface AccesoryModalProps {
4
+ accessory: Accessory;
5
+ onClose: () => void;
6
+ }
7
+ declare const AccesoryModal: ({ accessory, onClose }: AccesoryModalProps) => JSX.Element;
8
+ export default AccesoryModal;
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ import { Accessory } from '../../../@types/codegen/types';
3
+ interface AccessoriesSectionProps {
4
+ accessories?: Accessory[];
5
+ }
6
+ declare const AccessoriesSection: ({ accessories }: AccessoriesSectionProps) => JSX.Element | null;
7
+ export default AccessoriesSection;