@wayke-se/components-react 3.0.0-beta.8 → 3.0.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.
- package/dist-node/index.js +3203 -1047
- package/dist-node/index.js.map +1 -1
- package/dist-src/State/CentralStorage/useCentralStorage.js +7 -8
- package/dist-src/State/Path/PathProvider.js +1 -1
- package/dist-src/State/RelatedSearch/RelatedSearchProvider.js +1 -1
- package/dist-src/State/Search/SearchProvider.js +7 -10
- package/dist-src/components/ActionList/index.js +2 -3
- package/dist-src/components/Checklist/index.js +1 -1
- package/dist-src/components/ExtendContent/index.js +1 -1
- package/dist-src/components/Filter/index.js +10 -7
- package/dist-src/components/FilterPanel/checkListFacet.js +1 -1
- package/dist-src/components/FilterPanel/colorFacet.js +1 -1
- package/dist-src/components/FilterPanel/index.js +1 -1
- package/dist-src/components/FilterPanel/rangeFacet.js +14 -16
- package/dist-src/components/FinancialOptions/LoanModal.js +27 -29
- package/dist-src/components/FinancialOptions/leasing.js +6 -6
- package/dist-src/components/FinancialOptions/loan.js +5 -6
- package/dist-src/components/Gallery/index.js +11 -16
- package/dist-src/components/Grid/index.js +2 -3
- package/dist-src/components/InputSelect/index.js +1 -1
- package/dist-src/components/InsuranceOptions/InsuranceFree.js +1 -2
- package/dist-src/components/InsuranceOptions/InsuranceFreeModal.js +4 -5
- package/dist-src/components/InsuranceOptions/InsuranceModal.js +3 -3
- package/dist-src/components/Lightbox/index.js +1 -1
- package/dist-src/components/OpeningHours/index.js +9 -9
- package/dist-src/components/RangeSlider/SliderWithLabel.js +1 -1
- package/dist-src/components/Result/index.js +7 -6
- package/dist-src/components/Video/EmbededVideo.js +1 -1
- package/dist-src/components/Video/QuickNavEmbeded.js +2 -2
- package/dist-src/components/Video/useThumbnail.js +1 -1
- package/dist-src/components/Video/utils.js +2 -2
- package/dist-src/hooks/useFetch.js +1 -1
- package/dist-src/hooks/useVimeoThumbnail.js +1 -1
- package/dist-src/layouts/searchItem/Branch.js +9 -10
- package/dist-src/layouts/searchItem/BranchModal.js +1 -1
- package/dist-src/layouts/searchItem/CheckList.js +16 -16
- package/dist-src/layouts/searchItem/ManufacturerPackagesOption.js +1 -2
- package/dist-src/layouts/searchItem/PackageOptionModal.js +7 -10
- package/dist-src/layouts/searchItem/PackageOptions.js +11 -14
- package/dist-src/layouts/searchItem/Property.js +4 -6
- package/dist-src/layouts/searchItem/Related.js +3 -4
- package/dist-src/layouts/searchItem/index.js +15 -17
- package/dist-src/providers/WaykeItemProvidet.js +7 -11
- package/dist-src/providers/WaykeProvider.js +8 -12
- package/dist-src/utils/phonenumbers.js +1 -1
- package/dist-src/utils/specification.js +9 -13
- package/dist-src/utils/vehicle-properties/property-tree-creator.js +5 -5
- package/dist-types/components/InputSearch/index.d.ts +5 -3
- package/dist-types/components/RangeSlider/handle.d.ts +2 -2
- package/dist-types/components/RangeSlider/track.d.ts +2 -2
- package/dist-web/index.js +221 -272
- package/dist-web/index.js.map +1 -1
- package/package.json +18 -25
- package/dist-src/hooks/useEcom.js +0 -18
- package/dist-types/hooks/useEcom.d.ts +0 -3
|
@@ -2,19 +2,15 @@ import React from 'react';
|
|
|
2
2
|
import GraphqlProvider from './graphqlProvider';
|
|
3
3
|
import Theme from './themeProvider';
|
|
4
4
|
import Root from '../components/Root/index';
|
|
5
|
-
import useEcom from '../hooks/useEcom';
|
|
6
5
|
import SettingsProvider from '../State/Settings/SettingsProvider';
|
|
7
6
|
import RelatedSearchProvider from '../State/RelatedSearch/RelatedSearchProvider';
|
|
8
7
|
import CentralStorageProvider from '../State/CentralStorage/CentralStorageProvider';
|
|
9
8
|
import PathProvider from '../State/Path/PathProvider';
|
|
10
|
-
const WaykeItemProvider = ({ url, urlMlt, apiKey, ecomSettings, graphQlUrl, googleMapsApiKey, googleMapsMarker, children, }) =>
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
React.createElement(Theme, null,
|
|
18
|
-
React.createElement(Root, null, children))))))));
|
|
19
|
-
};
|
|
9
|
+
const WaykeItemProvider = ({ url, urlMlt, apiKey, ecomSettings, graphQlUrl, googleMapsApiKey, googleMapsMarker, children, }) => (React.createElement(PathProvider, null,
|
|
10
|
+
React.createElement(SettingsProvider, { googleMapsApiKey: googleMapsApiKey, googleMapsMarker: googleMapsMarker, ecomSettings: ecomSettings },
|
|
11
|
+
React.createElement(CentralStorageProvider, null,
|
|
12
|
+
React.createElement(GraphqlProvider, { uri: graphQlUrl },
|
|
13
|
+
React.createElement(RelatedSearchProvider, { url: url, urlMlt: urlMlt, apiKey: apiKey },
|
|
14
|
+
React.createElement(Theme, null,
|
|
15
|
+
React.createElement(Root, null, children))))))));
|
|
20
16
|
export default WaykeItemProvider;
|
|
@@ -3,20 +3,16 @@ import GraphqlProvider from './graphqlProvider';
|
|
|
3
3
|
import Theme from './themeProvider';
|
|
4
4
|
import SearchProvider from '../State/Search/SearchProvider';
|
|
5
5
|
import Root from '../components/Root/index';
|
|
6
|
-
import useEcom from '../hooks/useEcom';
|
|
7
6
|
import SettingsProvider from '../State/Settings/SettingsProvider';
|
|
8
7
|
import RelatedSearchProvider from '../State/RelatedSearch/RelatedSearchProvider';
|
|
9
8
|
import CentralStorageProvider from '../State/CentralStorage/CentralStorageProvider';
|
|
10
9
|
import PathProvider from '../State/Path/PathProvider';
|
|
11
|
-
const WaykeProvider = ({ url, urlMlt, apiKey, ecomSettings, graphQlUrl, googleMapsApiKey, googleMapsMarker, useQueryParamsFromUrl, pathRoute, children, }) =>
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
React.createElement(Theme, null,
|
|
20
|
-
React.createElement(Root, null, children)))))))));
|
|
21
|
-
};
|
|
10
|
+
const WaykeProvider = ({ url, urlMlt, apiKey, ecomSettings, graphQlUrl, googleMapsApiKey, googleMapsMarker, useQueryParamsFromUrl, pathRoute, children, }) => (React.createElement(PathProvider, null,
|
|
11
|
+
React.createElement(SettingsProvider, { googleMapsApiKey: googleMapsApiKey, googleMapsMarker: googleMapsMarker, ecomSettings: ecomSettings },
|
|
12
|
+
React.createElement(CentralStorageProvider, null,
|
|
13
|
+
React.createElement(GraphqlProvider, { uri: graphQlUrl },
|
|
14
|
+
React.createElement(SearchProvider, { url: url, apiKey: apiKey, useQueryParamsFromUrl: useQueryParamsFromUrl, pathRoute: pathRoute },
|
|
15
|
+
React.createElement(RelatedSearchProvider, { url: url, urlMlt: urlMlt, apiKey: apiKey },
|
|
16
|
+
React.createElement(Theme, null,
|
|
17
|
+
React.createElement(Root, null, children)))))))));
|
|
22
18
|
export default WaykeProvider;
|
|
@@ -4,7 +4,7 @@ const typedMetadata = metadata;
|
|
|
4
4
|
export const formatPhonenumber = (text) => {
|
|
5
5
|
try {
|
|
6
6
|
const parsed = parsePhoneNumberFromString(text.replace('-', '').replace(/ /g, ''), typedMetadata);
|
|
7
|
-
return
|
|
7
|
+
return parsed?.formatNational() || text;
|
|
8
8
|
}
|
|
9
9
|
catch (e) {
|
|
10
10
|
return text;
|
|
@@ -137,10 +137,7 @@ const specLabels = {
|
|
|
137
137
|
},
|
|
138
138
|
height: {
|
|
139
139
|
label: 'Längd/höjd/bredd',
|
|
140
|
-
formatData: (_, data) => {
|
|
141
|
-
var _a, _b, _c;
|
|
142
|
-
return `${((_a = data === null || data === void 0 ? void 0 : data.properties) === null || _a === void 0 ? void 0 : _a.length) || '-'} cm/${((_b = data === null || data === void 0 ? void 0 : data.properties) === null || _b === void 0 ? void 0 : _b.height) || '-'} cm/${((_c = data === null || data === void 0 ? void 0 : data.properties) === null || _c === void 0 ? void 0 : _c.width) || '-'} cm`;
|
|
143
|
-
},
|
|
140
|
+
formatData: (_, data) => `${data?.properties?.length || '-'} cm/${data?.properties?.height || '-'} cm/${data?.properties?.width || '-'} cm`,
|
|
144
141
|
},
|
|
145
142
|
serviceWeight: {
|
|
146
143
|
label: 'Tjänstevikt',
|
|
@@ -437,14 +434,13 @@ const All = [
|
|
|
437
434
|
'annualBonus',
|
|
438
435
|
];
|
|
439
436
|
const extractSpecData = (key, item) => {
|
|
440
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
441
437
|
const spec = specLabels[key];
|
|
442
438
|
let data = null;
|
|
443
439
|
if (!!item[key] || (item[key] || -1) > -1) {
|
|
444
440
|
data = item[key];
|
|
445
441
|
}
|
|
446
|
-
else if (!!
|
|
447
|
-
(typeof
|
|
442
|
+
else if (!!item?.properties?.[key] ||
|
|
443
|
+
(typeof item?.properties?.[key] === 'number' && (item?.properties?.[key] || -1) > -1)) {
|
|
448
444
|
data = item.properties[key];
|
|
449
445
|
}
|
|
450
446
|
if (!spec || !data) {
|
|
@@ -466,23 +462,23 @@ const extractSpecData = (key, item) => {
|
|
|
466
462
|
}
|
|
467
463
|
const modal = spec.modal ? { title: '', text: '' } : undefined;
|
|
468
464
|
if (modal) {
|
|
469
|
-
if (
|
|
465
|
+
if (spec.modal?.dynamicTitle) {
|
|
470
466
|
modal.title = spec.modal.dynamicTitle(item);
|
|
471
467
|
}
|
|
472
|
-
else if (
|
|
468
|
+
else if (spec.modal?.title) {
|
|
473
469
|
modal.title = spec.modal.title;
|
|
474
470
|
}
|
|
475
|
-
if (
|
|
471
|
+
if (spec.modal?.dynamicText) {
|
|
476
472
|
modal.text = spec.modal.dynamicText(item);
|
|
477
473
|
}
|
|
478
|
-
else if (
|
|
474
|
+
else if (spec.modal?.text) {
|
|
479
475
|
modal.text = spec.modal.text;
|
|
480
476
|
}
|
|
481
|
-
if (
|
|
477
|
+
if (spec.modal?.concatPropValue) {
|
|
482
478
|
const concatObj = spec.modal.concatPropValue === key
|
|
483
479
|
? { value }
|
|
484
480
|
: extractSpecData(spec.modal.concatPropValue, item);
|
|
485
|
-
if (concatObj
|
|
481
|
+
if (concatObj?.value) {
|
|
486
482
|
modal.text = modal.text.replace('{insertValue}', concatObj.value);
|
|
487
483
|
}
|
|
488
484
|
else if (spec.modal.nonConcatablePropValue) {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
class PropertyTreeCreator {
|
|
2
2
|
constructor(properties) {
|
|
3
|
-
this.propertiesWithCategory = (propertyKey) =>
|
|
3
|
+
this.propertiesWithCategory = (propertyKey) => !!this.properties[propertyKey].category?.id;
|
|
4
4
|
this.propertiesWithoutCategory = (propertyKey) => !this.propertiesWithCategory(propertyKey);
|
|
5
5
|
this.isList = (property) => property.type === PropertyTreeCreator.TEXT_LIST_TYPE;
|
|
6
6
|
this.isNonList = (property) => !this.isList(property);
|
|
7
|
-
this.hasCategoryWithId = (propertyKey, categoryId) =>
|
|
8
|
-
this.propertiesWithSubCategory = (propertyKey) =>
|
|
7
|
+
this.hasCategoryWithId = (propertyKey, categoryId) => this.properties[propertyKey].category?.id === categoryId;
|
|
8
|
+
this.propertiesWithSubCategory = (propertyKey) => !!this.properties[propertyKey].category?.subCategory?.id;
|
|
9
9
|
this.propertiesWithoutSubCategory = (propertyKey) => !this.propertiesWithSubCategory(propertyKey);
|
|
10
|
-
this.hasSubCategoryWithId = (propertyKey, categoryId) =>
|
|
10
|
+
this.hasSubCategoryWithId = (propertyKey, categoryId) => this.properties[propertyKey].category?.subCategory?.id === categoryId;
|
|
11
11
|
this.properties = properties;
|
|
12
12
|
}
|
|
13
13
|
create() {
|
|
@@ -74,7 +74,7 @@ class PropertyTreeCreator {
|
|
|
74
74
|
const categories = Object.keys(this.properties)
|
|
75
75
|
.filter((key) => this.hasCategoryWithId(key, id))
|
|
76
76
|
.filter(this.propertiesWithSubCategory)
|
|
77
|
-
.map((key) =>
|
|
77
|
+
.map((key) => this.properties[key].category?.subCategory)
|
|
78
78
|
.filter(PropertyTreeCreator.distinctCategories);
|
|
79
79
|
return categories;
|
|
80
80
|
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
declare
|
|
2
|
+
declare type InputProps = React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>;
|
|
3
|
+
declare type Props = InputProps & {
|
|
3
4
|
placeholder: string;
|
|
4
5
|
label: string;
|
|
5
|
-
value?: string
|
|
6
|
+
value?: string;
|
|
6
7
|
id: string;
|
|
7
8
|
onSearch: () => void;
|
|
8
|
-
}
|
|
9
|
+
};
|
|
10
|
+
declare const InputSearch: React.ForwardRefExoticComponent<Pick<Props, "label" | "key" | keyof React.InputHTMLAttributes<HTMLInputElement> | "onSearch"> & React.RefAttributes<HTMLDivElement>>;
|
|
9
11
|
export default InputSearch;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
2
|
import { SliderItem, GetHandleProps } from 'react-compound-slider';
|
|
3
3
|
interface IHandleProps {
|
|
4
4
|
domain: number[];
|
|
5
5
|
handle: SliderItem;
|
|
6
6
|
getHandleProps: GetHandleProps;
|
|
7
7
|
}
|
|
8
|
-
export declare const Handle:
|
|
8
|
+
export declare const Handle: ({ domain: [min, max], handle: { id, value, percent }, getHandleProps, }: IHandleProps) => JSX.Element;
|
|
9
9
|
export {};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
2
|
import { SliderItem, GetTrackProps } from 'react-compound-slider';
|
|
3
3
|
interface ITrackProps {
|
|
4
4
|
source: SliderItem;
|
|
5
5
|
target: SliderItem;
|
|
6
6
|
getTrackProps: GetTrackProps;
|
|
7
7
|
}
|
|
8
|
-
export declare const Track:
|
|
8
|
+
export declare const Track: ({ source, target, getTrackProps }: ITrackProps) => JSX.Element;
|
|
9
9
|
export {};
|