@wayke-se/components-react 3.0.0-beta.9 → 3.1.0-beta.1
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 +12 -3
- package/dist-node/index.js +3233 -1031
- 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 +19 -5
- 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/ProductCard/index.js +6 -3
- 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 +5 -6
- package/dist-src/layouts/searchItem/index.js +15 -17
- package/dist-src/utils/phonenumbers.js +1 -1
- package/dist-src/utils/regex.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 +232 -241
- package/dist-web/index.js.map +1 -1
- package/package.json +18 -24
package/dist-web/index.js
CHANGED
|
@@ -679,14 +679,15 @@ const getTranslatedSortOptionDisplayName = (str) => {
|
|
|
679
679
|
};
|
|
680
680
|
|
|
681
681
|
const Result = ({ children }) => {
|
|
682
|
-
var _a;
|
|
683
682
|
const { loading, response, documents, queryFilter, onLoadMore, onFilterUpdate } = useSearch();
|
|
684
683
|
const onSortOptionChange = useCallback((e) => onFilterUpdate(e.currentTarget.value), []);
|
|
685
|
-
const numberOfDocuments =
|
|
686
|
-
const numberOfHits =
|
|
687
|
-
const useSkeletons = !!
|
|
688
|
-
const selectedSortOption =
|
|
689
|
-
const sortOptions = response
|
|
684
|
+
const numberOfDocuments = documents?.length || 0;
|
|
685
|
+
const numberOfHits = response?.documentList.numberOfHits || 0;
|
|
686
|
+
const useSkeletons = !!queryFilter?.concatResult;
|
|
687
|
+
const selectedSortOption = response?.documentList.sortOptions.find((x) => x.selected)?.query;
|
|
688
|
+
const sortOptions = response?.documentList.sortOptions
|
|
689
|
+
.filter((x) => x.displayName !== 'relevance')
|
|
690
|
+
.map((so) => ({
|
|
690
691
|
value: so.query,
|
|
691
692
|
displayName: getTranslatedSortOptionDisplayName(so.displayName),
|
|
692
693
|
}));
|
|
@@ -1196,7 +1197,7 @@ const ChecklistItem = ({ label, onClick, active, radio }) => (React__default.cre
|
|
|
1196
1197
|
active && React__default.createElement(ActionIcon, null, radio ? React__default.createElement(IconRadio, { block: true }) : React__default.createElement(IconCheck, { block: true })),
|
|
1197
1198
|
React__default.createElement(ActionLabel, { className: active ? 'wayke__theme wayke__font--bold wayke__color--primary-text' : '' }, label))));
|
|
1198
1199
|
const Checklist = ({ items, radio }) => {
|
|
1199
|
-
if (!
|
|
1200
|
+
if (!items?.length) {
|
|
1200
1201
|
return null;
|
|
1201
1202
|
}
|
|
1202
1203
|
return (React__default.createElement(List$2, null, items.map((item) => (React__default.createElement(ChecklistItem, { key: item.label, label: item.label, onClick: item.onClick, active: item.active, radio: radio })))));
|
|
@@ -1231,7 +1232,7 @@ const ChecklistFacet = ({ facet }) => {
|
|
|
1231
1232
|
.map((f) => ({
|
|
1232
1233
|
label: f.displayName,
|
|
1233
1234
|
onClick: () => onClick(f),
|
|
1234
|
-
active:
|
|
1235
|
+
active: selected?.[f.displayName] !== undefined ? selected[f.displayName] : f.selected,
|
|
1235
1236
|
})) })));
|
|
1236
1237
|
};
|
|
1237
1238
|
|
|
@@ -1369,7 +1370,7 @@ const ColorSelectFacet = ({ facet }) => {
|
|
|
1369
1370
|
.map((f) => ({
|
|
1370
1371
|
label: f.displayName,
|
|
1371
1372
|
onClick: () => onClick(f),
|
|
1372
|
-
active:
|
|
1373
|
+
active: selected?.[f.displayName] !== undefined ? selected[f.displayName] : f.selected,
|
|
1373
1374
|
hex: [getHexColorFromDisplayName(f.displayName)],
|
|
1374
1375
|
})) }));
|
|
1375
1376
|
};
|
|
@@ -1514,9 +1515,9 @@ const RangeSlider = ({ loading, values, domain, steps, unit, formatValues, maxPr
|
|
|
1514
1515
|
|
|
1515
1516
|
const getInitialValues = (domain, facet, searchParams) => {
|
|
1516
1517
|
const facetMin = domain[0]; //parseInt(facet.filters[0].displayName, 10);
|
|
1517
|
-
const _queryMin =
|
|
1518
|
+
const _queryMin = searchParams?.get(`${facet.id}.min`) || null;
|
|
1518
1519
|
const facetMax = domain[domain.length - 1]; //parseInt(facet.filters[facet.filters.length - 1].displayName, 10);
|
|
1519
|
-
const _queryMax =
|
|
1520
|
+
const _queryMax = searchParams?.get(`${facet.id}.max`) || null;
|
|
1520
1521
|
const queryMin = parseInt(_queryMin === null ? `${facetMin}` : _queryMin, 10);
|
|
1521
1522
|
const min = facetMin > queryMin ? facetMin : queryMin;
|
|
1522
1523
|
const queryMax = parseInt(_queryMax === null ? `${facetMax}` : _queryMax, 10);
|
|
@@ -1538,41 +1539,39 @@ const getSteps$1 = (initialAllValues) => {
|
|
|
1538
1539
|
return initialAllValues;
|
|
1539
1540
|
};
|
|
1540
1541
|
const RangeFacet = ({ facet, unit, formatValues }) => {
|
|
1541
|
-
var _a, _b, _c;
|
|
1542
1542
|
const { loading, queryFilter, initialFacets, onFilterUpdate } = useSearch();
|
|
1543
|
-
const initialFacet = initialFacets
|
|
1544
|
-
const maxPrefix =
|
|
1543
|
+
const initialFacet = initialFacets?.find((x) => x.id === facet.id);
|
|
1544
|
+
const maxPrefix = initialFacet?.filters[initialFacet?.filters.length - 1]?.displayName?.includes('+');
|
|
1545
1545
|
const [state, setValues] = useState(undefined);
|
|
1546
1546
|
useEffect(() => {
|
|
1547
|
-
const _initialAllValues =
|
|
1547
|
+
const _initialAllValues = initialFacet?.filters.map((f) => parseInt(f.displayName.replace(/[\<\>+-]+/g, ''), 10)) || [1, 2];
|
|
1548
1548
|
const _steps = getSteps$1(_initialAllValues);
|
|
1549
1549
|
const domain = [_steps[0], _steps[_steps.length - 1]];
|
|
1550
1550
|
setValues({
|
|
1551
|
-
id: initialFacet
|
|
1551
|
+
id: initialFacet?.id,
|
|
1552
1552
|
steps: _steps,
|
|
1553
1553
|
domain: [_steps[0], _steps[_steps.length - 1]],
|
|
1554
|
-
values:
|
|
1554
|
+
values: initialFacet?.filters.length
|
|
1555
1555
|
? getInitialValues(domain, initialFacet, queryFilter.searchParams)
|
|
1556
1556
|
: [0, 0],
|
|
1557
1557
|
});
|
|
1558
|
-
}, [initialFacet
|
|
1558
|
+
}, [initialFacet?.id]);
|
|
1559
1559
|
useEffect(() => {
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
const init = (initialFacet === null || initialFacet === void 0 ? void 0 : initialFacet.filters.length)
|
|
1560
|
+
if (state?.id) {
|
|
1561
|
+
const init = initialFacet?.filters.length
|
|
1563
1562
|
? getInitialValues(state.domain, initialFacet, queryFilter.searchParams)
|
|
1564
1563
|
: [0, 0];
|
|
1565
|
-
const minStr =
|
|
1566
|
-
const maxStr =
|
|
1564
|
+
const minStr = queryFilter.searchParams?.get(`${facet.id}.min`);
|
|
1565
|
+
const maxStr = queryFilter.searchParams?.get(`${facet.id}.max`);
|
|
1567
1566
|
const min = minStr ? parseFloat(minStr) : init[0];
|
|
1568
1567
|
const max = maxStr ? parseFloat(maxStr) : init[1];
|
|
1569
1568
|
if (min !== state.values[0] || max !== state.values[1]) {
|
|
1570
1569
|
onChange([min, max]);
|
|
1571
1570
|
}
|
|
1572
1571
|
}
|
|
1573
|
-
}, [
|
|
1572
|
+
}, [queryFilter.searchParams?.toString()]);
|
|
1574
1573
|
const onChange = useCallback((nextValues) => {
|
|
1575
|
-
if (state
|
|
1574
|
+
if (state?.id) {
|
|
1576
1575
|
if (state.values[0] !== nextValues[0] || state.values[1] !== nextValues[1]) {
|
|
1577
1576
|
setValues({ ...state, values: nextValues.slice() });
|
|
1578
1577
|
const query = new URLSearchParams(queryFilter.searchParams);
|
|
@@ -1631,7 +1630,7 @@ const FilterPanel = ({ facet, filteredFacets, numberOfHits, loading, onFilterUpd
|
|
|
1631
1630
|
React__default.createElement(ButtonContent, null, `Visa ${numberOfHits} ${numberOfHits === 1 ? 'bil' : 'bilar'}`))))) },
|
|
1632
1631
|
React__default.createElement(Accordion, null, filteredFacets
|
|
1633
1632
|
.filter((x) => x.filters.length)
|
|
1634
|
-
.map((f) => (React__default.createElement(AccordionItem, { key: f.displayName, heading: f.displayName, isActive: f.id ===
|
|
1633
|
+
.map((f) => (React__default.createElement(AccordionItem, { key: f.displayName, heading: f.displayName, isActive: f.id === facet?.id },
|
|
1635
1634
|
React__default.createElement(Repeat, null,
|
|
1636
1635
|
React__default.createElement(FacetSelector, { facet: f }))))))));
|
|
1637
1636
|
};
|
|
@@ -1647,9 +1646,8 @@ const isSelected = (f, searchParams) => {
|
|
|
1647
1646
|
}
|
|
1648
1647
|
};
|
|
1649
1648
|
const Filter = ({ filterList }) => {
|
|
1650
|
-
var _a;
|
|
1651
1649
|
const { queryFilter, initialFacets, loading, response, onFilterUpdate } = useSearch();
|
|
1652
|
-
const facets = response
|
|
1650
|
+
const facets = response?.facets;
|
|
1653
1651
|
const [facet, setFacet] = useState();
|
|
1654
1652
|
const onSelectFacet = useCallback((nextFacet) => setFacet(nextFacet), []);
|
|
1655
1653
|
const onClose = useCallback(() => setFacet(undefined), []);
|
|
@@ -1657,12 +1655,16 @@ const Filter = ({ filterList }) => {
|
|
|
1657
1655
|
return null;
|
|
1658
1656
|
}
|
|
1659
1657
|
const filterNames = filterList ? filterList.map((x) => x.filterName) : undefined;
|
|
1660
|
-
const filteredFacets =
|
|
1658
|
+
const filteredFacets = facets
|
|
1659
|
+
?.filter((x) => x.id !== 'segment')
|
|
1660
|
+
?.filter((f) => (filterNames ? filterNames.includes(f.id) : true))
|
|
1661
|
+
.sort((a, b) => filterNames
|
|
1661
1662
|
? filterNames.indexOf(a.id) -
|
|
1662
1663
|
filterNames.indexOf(b.id)
|
|
1663
|
-
: 0)
|
|
1664
|
-
|
|
1665
|
-
|
|
1664
|
+
: 0)
|
|
1665
|
+
.map((x) => {
|
|
1666
|
+
const match = filterList?.find((y) => y.filterName === x.id);
|
|
1667
|
+
if (match?.displayName) {
|
|
1666
1668
|
return {
|
|
1667
1669
|
...x,
|
|
1668
1670
|
displayName: match.displayName,
|
|
@@ -1674,7 +1676,7 @@ const Filter = ({ filterList }) => {
|
|
|
1674
1676
|
};
|
|
1675
1677
|
});
|
|
1676
1678
|
return (React__default.createElement(React__default.Fragment, null,
|
|
1677
|
-
initialFacets && facet && (React__default.createElement(FilterPanel, { filterList: filterList, facet: facet, loading: loading, filteredFacets: filteredFacets, numberOfHits:
|
|
1679
|
+
initialFacets && facet && (React__default.createElement(FilterPanel, { filterList: filterList, facet: facet, loading: loading, filteredFacets: filteredFacets, numberOfHits: response?.documentList.numberOfHits || 0, onFilterUpdate: onFilterUpdate, onClose: onClose })),
|
|
1678
1680
|
React__default.createElement(List, null, filteredFacets
|
|
1679
1681
|
.filter((x) => x.filters.length)
|
|
1680
1682
|
.map((f) => {
|
|
@@ -1954,9 +1956,12 @@ const ProductCard = ({ id, title, href, image, pathRoute, placeholderImage, desc
|
|
|
1954
1956
|
const { pushState } = usePath();
|
|
1955
1957
|
const _onClick = useMemo(() => (onClick ? () => onClick(id) : undefined), [id]);
|
|
1956
1958
|
const onHrefClick = useCallback((e) => {
|
|
1957
|
-
if (
|
|
1958
|
-
|
|
1959
|
-
|
|
1959
|
+
if (pathRoute && href) {
|
|
1960
|
+
const reg = new RegExp('^((http|https)://)|//');
|
|
1961
|
+
if (!pathRoute.match(reg) && !pathRoute.startsWith(location.origin)) {
|
|
1962
|
+
e.preventDefault();
|
|
1963
|
+
pushState(href);
|
|
1964
|
+
}
|
|
1960
1965
|
}
|
|
1961
1966
|
}, [id, pathRoute, href]);
|
|
1962
1967
|
return (React__default.createElement(Wrapper$8, { onClick: _onClick },
|
|
@@ -1983,8 +1988,7 @@ const ProductCard = ({ id, title, href, image, pathRoute, placeholderImage, desc
|
|
|
1983
1988
|
};
|
|
1984
1989
|
|
|
1985
1990
|
const resolveImage = (document) => {
|
|
1986
|
-
|
|
1987
|
-
const img = (_c = (_b = (_a = document.featuredImage) === null || _a === void 0 ? void 0 : _a.files) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.url;
|
|
1991
|
+
const img = document.featuredImage?.files?.[0]?.url;
|
|
1988
1992
|
if (img) {
|
|
1989
1993
|
return `${img}?w=567&q=72`;
|
|
1990
1994
|
}
|
|
@@ -1996,13 +2000,28 @@ const Grid = ({ documents, placeholderImage, hashRoute, pathRoute, onClickItem }
|
|
|
1996
2000
|
}
|
|
1997
2001
|
return (React__default.createElement(Wrapper$7, null,
|
|
1998
2002
|
React__default.createElement(List$4, null, documents.map((document) => {
|
|
1999
|
-
|
|
2003
|
+
/*
|
|
2004
|
+
const _path = pathRoute?.replace(/^\/|\/$/g, '');
|
|
2005
|
+
|
|
2000
2006
|
const prefix = _path ? `/${_path}/` : '/';
|
|
2001
|
-
|
|
2007
|
+
|
|
2008
|
+
const pathRouteUrl =
|
|
2009
|
+
window.location.pathname === '/'
|
|
2002
2010
|
? `${prefix}${document._id}`
|
|
2003
2011
|
: `${window.location.pathname}${prefix}${document._id}`;
|
|
2012
|
+
*/
|
|
2013
|
+
/*
|
|
2014
|
+
const _pathRoute = pathRoute
|
|
2015
|
+
? pathRoute.startsWith('/')
|
|
2016
|
+
? `${location.pathname}${pathRoute}/${document._id}`
|
|
2017
|
+
: `${pathRoute}/${document._id}`
|
|
2018
|
+
: undefined;
|
|
2019
|
+
|
|
2020
|
+
console.log(_pathRoute);
|
|
2021
|
+
*/
|
|
2022
|
+
const _pathRoute = pathRoute ? `${pathRoute}/${document._id}` : undefined;
|
|
2004
2023
|
return (React__default.createElement(Item$4, { key: document._id },
|
|
2005
|
-
React__default.createElement(ProductCard, { id: document._id, onClick: onClickItem, title: document.title, pathRoute: pathRoute, href:
|
|
2024
|
+
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: [
|
|
2006
2025
|
{
|
|
2007
2026
|
title: document.modelYear,
|
|
2008
2027
|
},
|
|
@@ -2668,7 +2687,7 @@ const ExtendContent = ({ children, actionTitle, onClick }) => {
|
|
|
2668
2687
|
}
|
|
2669
2688
|
}, []);
|
|
2670
2689
|
const onRef = (ref) => {
|
|
2671
|
-
const refHeight =
|
|
2690
|
+
const refHeight = ref?.clientHeight || 0;
|
|
2672
2691
|
if (refHeight < 207) {
|
|
2673
2692
|
setExtend(true);
|
|
2674
2693
|
}
|
|
@@ -3082,7 +3101,7 @@ const getYoutubeThumbnail = (url) => {
|
|
|
3082
3101
|
};
|
|
3083
3102
|
};
|
|
3084
3103
|
const onImageLoad = (e, thumbnail) => {
|
|
3085
|
-
if (
|
|
3104
|
+
if (thumbnail?.length === 2 &&
|
|
3086
3105
|
e.currentTarget.src === thumbnail[0] &&
|
|
3087
3106
|
e.currentTarget.naturalWidth === 120 &&
|
|
3088
3107
|
e.currentTarget.naturalHeight === 90) {
|
|
@@ -3090,7 +3109,7 @@ const onImageLoad = (e, thumbnail) => {
|
|
|
3090
3109
|
}
|
|
3091
3110
|
};
|
|
3092
3111
|
const onImageError = (e, thumbnail) => {
|
|
3093
|
-
if (
|
|
3112
|
+
if (thumbnail?.length === 2) {
|
|
3094
3113
|
e.currentTarget.src = thumbnail[1];
|
|
3095
3114
|
}
|
|
3096
3115
|
};
|
|
@@ -3570,7 +3589,7 @@ const Lightbox = ({ index, media, onClose }) => {
|
|
|
3570
3589
|
onClose();
|
|
3571
3590
|
}
|
|
3572
3591
|
};
|
|
3573
|
-
return (React__default.createElement(Wrapper$h, { ref: (ref) => ref
|
|
3592
|
+
return (React__default.createElement(Wrapper$h, { ref: (ref) => ref?.focus(), onKeyDown: onKeyDown, tabIndex: 0 },
|
|
3574
3593
|
React__default.createElement(UiBlock$1, { onClick: onClose, "aria-hidden": true }),
|
|
3575
3594
|
media.map((m, i) => (React__default.createElement(Item$8, { key: i, ref: index === i ? onRef : undefined },
|
|
3576
3595
|
m.type === 'image' && (React__default.createElement(Img$1, { id: `lightbox-image-${i}`, src: m.files[0].url, alt: `Bild ${i + 1}` })),
|
|
@@ -3582,7 +3601,7 @@ const Lightbox = ({ index, media, onClose }) => {
|
|
|
3582
3601
|
};
|
|
3583
3602
|
|
|
3584
3603
|
const cache = {};
|
|
3585
|
-
const getCachedResult = (key) =>
|
|
3604
|
+
const getCachedResult = (key) => cache?.[key] || undefined;
|
|
3586
3605
|
const setCachedResult = (key, value) => {
|
|
3587
3606
|
cache[key] = value;
|
|
3588
3607
|
};
|
|
@@ -3653,7 +3672,7 @@ const useVimeoThumbnail = (id, small) => {
|
|
|
3653
3672
|
const [thumbnail, setThumbnail] = useState();
|
|
3654
3673
|
const { data } = useFetch(`http://vimeo.com/api/v2/video/${id}.json`, {}, !id || !!thumbnail, true);
|
|
3655
3674
|
useEffect(() => {
|
|
3656
|
-
if (data
|
|
3675
|
+
if (data?.[0]) {
|
|
3657
3676
|
if (small && data[0].thumbnail_small) {
|
|
3658
3677
|
setThumbnail(data[0].thumbnail_small);
|
|
3659
3678
|
}
|
|
@@ -3666,7 +3685,7 @@ const useVimeoThumbnail = (id, small) => {
|
|
|
3666
3685
|
};
|
|
3667
3686
|
|
|
3668
3687
|
const useThumbnail = (url, small) => {
|
|
3669
|
-
if (url
|
|
3688
|
+
if (url?.toLowerCase().endsWith('.mp4'))
|
|
3670
3689
|
return;
|
|
3671
3690
|
const [thumbnail, setThumbnail] = useState();
|
|
3672
3691
|
const vimeoId = url ? getVimeoId(url) : undefined;
|
|
@@ -3825,7 +3844,7 @@ const GalleryEmbed = ({ src, index }) => {
|
|
|
3825
3844
|
const onError = useCallback((e) => onImageError(e, thumbnail), [thumbnail]);
|
|
3826
3845
|
const onLoad = useCallback((e) => onImageLoad(e, thumbnail), [thumbnail]);
|
|
3827
3846
|
const customVideo = src.toLowerCase().endsWith('.mp4');
|
|
3828
|
-
if (
|
|
3847
|
+
if (thumbnail?.length && !customVideo) {
|
|
3829
3848
|
return (React__default.createElement(React__default.Fragment, null,
|
|
3830
3849
|
React__default.createElement(ImageFull, { onLoad: onLoad, src: thumbnail[0], onError: onError, alt: `Bild ${index + 1}` }),
|
|
3831
3850
|
React__default.createElement(MediaButton, { text: "Spela video", onClick: onClick }),
|
|
@@ -3845,8 +3864,8 @@ const QuickNavEmbeded = ({ src, index }) => {
|
|
|
3845
3864
|
const thumbnail = useThumbnail(src);
|
|
3846
3865
|
const onError = useCallback((e) => onImageError(e, thumbnail), [thumbnail]);
|
|
3847
3866
|
const onLoad = useCallback((e) => onImageLoad(e, thumbnail), [thumbnail]);
|
|
3848
|
-
const customVideo = src
|
|
3849
|
-
if (
|
|
3867
|
+
const customVideo = src?.toLowerCase().endsWith('.mp4');
|
|
3868
|
+
if (thumbnail?.length && !customVideo)
|
|
3850
3869
|
return (React__default.createElement(QuickNavImg, { onLoad: onLoad, src: thumbnail[0], onError: onError, alt: `Bild ${index + 1}` }));
|
|
3851
3870
|
if (customVideo)
|
|
3852
3871
|
return React__default.createElement(CustomPlayer, { key: index, url: src, ratio: "66.66%" });
|
|
@@ -3907,8 +3926,7 @@ const Gallery = ({ media, placeholderImage }) => {
|
|
|
3907
3926
|
const [lightbox, setLightbox] = useState(false);
|
|
3908
3927
|
const [navigationDisabled, setNavigationDisabled] = useState(false);
|
|
3909
3928
|
const beforeChange = useCallback((_, newIndex) => {
|
|
3910
|
-
|
|
3911
|
-
const element = (_b = (_a = quickNavRef.current) === null || _a === void 0 ? void 0 : _a.querySelectorAll('li')) === null || _b === void 0 ? void 0 : _b[newIndex];
|
|
3929
|
+
const element = quickNavRef.current?.querySelectorAll('li')?.[newIndex];
|
|
3912
3930
|
if (element) {
|
|
3913
3931
|
scrollIntoView(element, { scrollMode: 'if-needed', block: 'nearest', inline: 'nearest' });
|
|
3914
3932
|
}
|
|
@@ -3926,7 +3944,7 @@ const Gallery = ({ media, placeholderImage }) => {
|
|
|
3926
3944
|
}, []);
|
|
3927
3945
|
const onClick = useCallback(() => {
|
|
3928
3946
|
PubSub.publish('ImagesClick');
|
|
3929
|
-
if (!isDragging.current && !lightbox && !!
|
|
3947
|
+
if (!isDragging.current && !lightbox && !!media?.length) {
|
|
3930
3948
|
setLightbox(true);
|
|
3931
3949
|
}
|
|
3932
3950
|
}, [lightbox, media]);
|
|
@@ -3961,20 +3979,17 @@ const Gallery = ({ media, placeholderImage }) => {
|
|
|
3961
3979
|
setNavigationDisabled(false);
|
|
3962
3980
|
};
|
|
3963
3981
|
const onToggleLightbox = useCallback(() => setLightbox(!lightbox), [lightbox]);
|
|
3964
|
-
const mediaLength =
|
|
3982
|
+
const mediaLength = media?.length || 0;
|
|
3965
3983
|
const placeholder = useMemo(() => placeholderImage || DEFAULT_PLACEHOLDER_IMAGE, [placeholderImage]);
|
|
3966
3984
|
return (React__default.createElement(React__default.Fragment, null,
|
|
3967
3985
|
React__default.createElement(Wrapper$g, null,
|
|
3968
3986
|
React__default.createElement(Main, null,
|
|
3969
3987
|
React__default.createElement(SliderWrapper, { onMouseDown: onMouseDown, onMouseMove: onMouseMove, onClick: onClick },
|
|
3970
|
-
React__default.createElement(Slider$2, { ...sliderSettings, swipe: !navigationDisabled, touchMove: !navigationDisabled, swipeToSlide: !navigationDisabled, ref: slider, beforeChange: beforeChange }, !!
|
|
3971
|
-
|
|
3972
|
-
|
|
3973
|
-
|
|
3974
|
-
|
|
3975
|
-
m.type === 'embedded' && React__default.createElement(GalleryEmbed, { src: m.files[0].url, index: i + 1 }),
|
|
3976
|
-
m.type === 'sphere' && (React__default.createElement(Sphere, { visible: i === index, url: m.files[0].url, preview: m.files[0].url, onDisableNavigation: onDisableNavigation, navigationDisabled: navigationDisabled }))));
|
|
3977
|
-
})) : (React__default.createElement(Item$7, { key: placeholder },
|
|
3988
|
+
React__default.createElement(Slider$2, { ...sliderSettings, swipe: !navigationDisabled, touchMove: !navigationDisabled, swipeToSlide: !navigationDisabled, ref: slider, beforeChange: beforeChange }, !!media?.length ? (media.map((m, i) => (React__default.createElement(Item$7, { key: m.files[0].url || i },
|
|
3989
|
+
m.type === 'image' && (React__default.createElement(Image$1, { src: m.files[0].formats.filter(notEmpty).find((x) => x.format === '1170x')?.url, alt: `Bild ${i + 1}` })),
|
|
3990
|
+
m.type === 'threesixty' && (React__default.createElement(ThreeSixty, { urls: m.files.map((x) => x.url), visible: i === index, onDisableNavigation: onDisableNavigation, navigationDisabled: navigationDisabled })),
|
|
3991
|
+
m.type === 'embedded' && React__default.createElement(GalleryEmbed, { src: m.files[0].url, index: i + 1 }),
|
|
3992
|
+
m.type === 'sphere' && (React__default.createElement(Sphere, { visible: i === index, url: m.files[0].url, preview: m.files[0].url, onDisableNavigation: onDisableNavigation, navigationDisabled: navigationDisabled })))))) : (React__default.createElement(Item$7, { key: placeholder },
|
|
3978
3993
|
React__default.createElement(Image$1, { src: placeholder, alt: `Bild 1` })))),
|
|
3979
3994
|
navigationDisabled && mediaLength > 1 && (React__default.createElement(EnableNavigationButton, null,
|
|
3980
3995
|
React__default.createElement(ButtonSecondary, { onClick: onEnableNavigation, title: "St\u00E4ng" },
|
|
@@ -3985,9 +4000,8 @@ const Gallery = ({ media, placeholderImage }) => {
|
|
|
3985
4000
|
React__default.createElement(ArrowRight, { onClick: nextImage, title: "N\u00E4sta bild" },
|
|
3986
4001
|
React__default.createElement(IconChevronRight, { block: true }))))),
|
|
3987
4002
|
React__default.createElement(Alt, null,
|
|
3988
|
-
React__default.createElement(QuickNav, { ref: quickNavRef }, !!
|
|
3989
|
-
|
|
3990
|
-
const src = ((_a = m.files[0].formats.filter(notEmpty).find((x) => x.format === '225x150')) === null || _a === void 0 ? void 0 : _a.url) ||
|
|
4003
|
+
React__default.createElement(QuickNav, { ref: quickNavRef }, !!media?.length ? (media.map((m, i) => {
|
|
4004
|
+
const src = m.files[0].formats.filter(notEmpty).find((x) => x.format === '225x150')?.url ||
|
|
3991
4005
|
m.files[0].url;
|
|
3992
4006
|
return (React__default.createElement(QuickNavItem, { key: src || i, active: index === i },
|
|
3993
4007
|
React__default.createElement(QuickNavBtn, { onClick: () => goTo(i), title: `Gå till bild ${i + 1}` },
|
|
@@ -3998,7 +4012,7 @@ const Gallery = ({ media, placeholderImage }) => {
|
|
|
3998
4012
|
})) : (React__default.createElement(QuickNavItem, { key: placeholder, active: true },
|
|
3999
4013
|
React__default.createElement(QuickNavBtn, { onClick: () => goTo(0), title: `Gå till bild 0` },
|
|
4000
4014
|
React__default.createElement(QuickNavImg, { src: placeholder, alt: `Bild 1` }))))))),
|
|
4001
|
-
lightbox && !!
|
|
4015
|
+
lightbox && !!media?.length && (React__default.createElement(Lightbox, { media: media, index: index, onClose: onToggleLightbox }))));
|
|
4002
4016
|
};
|
|
4003
4017
|
|
|
4004
4018
|
const ProductPage = styled.div `
|
|
@@ -4418,11 +4432,11 @@ const Leasing = ({ financialOption }) => {
|
|
|
4418
4432
|
},
|
|
4419
4433
|
{
|
|
4420
4434
|
label: 'Bindningstid',
|
|
4421
|
-
value: `${duration
|
|
4435
|
+
value: `${duration?.current} månader`,
|
|
4422
4436
|
},
|
|
4423
4437
|
{
|
|
4424
4438
|
label: 'Årlig körsträcka',
|
|
4425
|
-
value: `${numberSeparator(
|
|
4439
|
+
value: `${numberSeparator(mileage?.current || 0)} mil/år`,
|
|
4426
4440
|
},
|
|
4427
4441
|
] }))))),
|
|
4428
4442
|
React__default.createElement(OptionBox, null,
|
|
@@ -4431,14 +4445,14 @@ const Leasing = ({ financialOption }) => {
|
|
|
4431
4445
|
React__default.createElement("p", null,
|
|
4432
4446
|
"Privatleasing",
|
|
4433
4447
|
' ',
|
|
4434
|
-
|
|
4448
|
+
mileage?.current && duration?.current && (React__default.createElement(React__default.Fragment, null,
|
|
4435
4449
|
React__default.createElement(UtilityTextPrimary, null,
|
|
4436
|
-
numberSeparator(mileage
|
|
4450
|
+
numberSeparator(mileage?.current),
|
|
4437
4451
|
" mil/\u00E5r"),
|
|
4438
4452
|
' ',
|
|
4439
4453
|
"i ",
|
|
4440
|
-
React__default.createElement(UtilityTextPrimary, null,
|
|
4441
|
-
duration
|
|
4454
|
+
React__default.createElement(UtilityTextPrimary, null,
|
|
4455
|
+
duration?.current,
|
|
4442
4456
|
" m\u00E5n"),
|
|
4443
4457
|
".",
|
|
4444
4458
|
' '))),
|
|
@@ -4569,7 +4583,7 @@ const SliderWithLabel = ({ label, values, domain, steps, loading, unit, formatVa
|
|
|
4569
4583
|
}, [loading]);
|
|
4570
4584
|
return (React__default.createElement(React__default.Fragment, null,
|
|
4571
4585
|
React__default.createElement(RepeatTiny, null,
|
|
4572
|
-
React__default.createElement(RangeSliderLabel, { label: label, value: `${numberSeparator(
|
|
4586
|
+
React__default.createElement(RangeSliderLabel, { label: label, value: `${numberSeparator(local?.[0] || values[0])}${unit ? ` ${unit}` : ''}` })),
|
|
4573
4587
|
React__default.createElement(RepeatTiny, null,
|
|
4574
4588
|
React__default.createElement(RangeSliderSimple, { loading: loading, values: values, domain: domain, steps: steps, onChange: onChange, onUpdate: onUpdate, unit: unit, formatValues: formatValues }))));
|
|
4575
4589
|
};
|
|
@@ -4585,7 +4599,6 @@ const stepGenerator = (step, max, steps = [], current) => {
|
|
|
4585
4599
|
return stepGenerator(step, max, steps, nextCurrent);
|
|
4586
4600
|
};
|
|
4587
4601
|
const LoanModal = ({ id, financialOption, onClose }) => {
|
|
4588
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
4589
4602
|
const [tmp, setTmp] = useState();
|
|
4590
4603
|
const [extend, setExtend] = React__default.useState(false);
|
|
4591
4604
|
const onToggleExtend = React__default.useCallback(() => {
|
|
@@ -4595,60 +4608,59 @@ const LoanModal = ({ id, financialOption, onClose }) => {
|
|
|
4595
4608
|
setExtend(!extend);
|
|
4596
4609
|
}, [extend]);
|
|
4597
4610
|
const [variables, setVariables] = useState({
|
|
4598
|
-
duration:
|
|
4599
|
-
downPayment:
|
|
4600
|
-
residual:
|
|
4611
|
+
duration: financialOption.duration?.current,
|
|
4612
|
+
downPayment: financialOption.downPayment?.current,
|
|
4613
|
+
residual: financialOption.residual?.current,
|
|
4601
4614
|
});
|
|
4602
4615
|
const { duration, downPayment, residual } = variables;
|
|
4603
4616
|
const { loading, data } = useLoanCalculation(id, duration, downPayment, residual);
|
|
4604
4617
|
useEffect(() => {
|
|
4605
|
-
var _a, _b, _c, _d, _e, _f;
|
|
4606
4618
|
if (data) {
|
|
4607
4619
|
setTmp(data);
|
|
4608
4620
|
setVariables({
|
|
4609
|
-
duration:
|
|
4610
|
-
downPayment:
|
|
4611
|
-
residual:
|
|
4621
|
+
duration: data?.loan?.duration?.current || 0,
|
|
4622
|
+
downPayment: data?.loan?.downPayment?.current || 0,
|
|
4623
|
+
residual: data?.loan?.residual?.current || 0,
|
|
4612
4624
|
});
|
|
4613
4625
|
}
|
|
4614
4626
|
}, [data]);
|
|
4615
|
-
const loan =
|
|
4616
|
-
const downPaymentCurrent =
|
|
4617
|
-
const downPaymentMin =
|
|
4618
|
-
const downPaymentMax =
|
|
4619
|
-
const downPaymentStep =
|
|
4627
|
+
const loan = data?.loan || tmp?.loan;
|
|
4628
|
+
const downPaymentCurrent = loan?.downPayment?.current || 0;
|
|
4629
|
+
const downPaymentMin = loan?.downPayment?.min || 0;
|
|
4630
|
+
const downPaymentMax = loan?.downPayment?.max || 0;
|
|
4631
|
+
const downPaymentStep = loan?.downPayment?.step || 0;
|
|
4620
4632
|
const downPaymentSteps = stepGenerator(downPaymentStep, downPaymentMax);
|
|
4621
4633
|
const onDownPaymentChange = useCallback((values) => {
|
|
4622
4634
|
PubSub.publish('FinanceInterest');
|
|
4623
4635
|
setVariables({ ...variables, downPayment: values[0] });
|
|
4624
4636
|
}, [variables]);
|
|
4625
|
-
const durationCurrent =
|
|
4626
|
-
const durationMin =
|
|
4627
|
-
const durationMax =
|
|
4628
|
-
const durationStep =
|
|
4637
|
+
const durationCurrent = loan?.duration?.current || 0;
|
|
4638
|
+
const durationMin = loan?.duration?.min || 0;
|
|
4639
|
+
const durationMax = loan?.duration?.max || 0;
|
|
4640
|
+
const durationStep = loan?.duration?.step || 0;
|
|
4629
4641
|
const durationSteps = stepGenerator(durationStep, durationMax);
|
|
4630
4642
|
const onDurationChange = useCallback((values) => {
|
|
4631
4643
|
PubSub.publish('FinanceInterest');
|
|
4632
4644
|
setVariables({ ...variables, duration: values[0] });
|
|
4633
4645
|
}, [variables]);
|
|
4634
|
-
const residualCurrent = (
|
|
4635
|
-
const residualMin = (
|
|
4636
|
-
const residualMax = (
|
|
4637
|
-
const residualStep = (
|
|
4646
|
+
const residualCurrent = (loan?.residual?.current || 0) * 100 || 0;
|
|
4647
|
+
const residualMin = (loan?.residual?.min || 0) * 100 || 0;
|
|
4648
|
+
const residualMax = (loan?.residual?.max || 0) * 100 || 0;
|
|
4649
|
+
const residualStep = (loan?.residual?.step || 0) * 100 || 0;
|
|
4638
4650
|
const residualSteps = stepGenerator(residualStep, residualMax);
|
|
4639
4651
|
const onResidualChange = useCallback((values) => {
|
|
4640
4652
|
PubSub.publish('FinanceInterest');
|
|
4641
4653
|
setVariables({ ...variables, residual: values[0] / 100 });
|
|
4642
4654
|
}, [variables]);
|
|
4643
|
-
const interestText = ((
|
|
4644
|
-
const effectiveInterestText = ((
|
|
4655
|
+
const interestText = ((loan?.interest || 0) * 100).toFixed(2);
|
|
4656
|
+
const effectiveInterestText = ((loan?.effectiveInterest || 0) * 100).toFixed(2);
|
|
4645
4657
|
return (React__default.createElement(Modal, { title: "L\u00E5nealternativ", onClose: onClose },
|
|
4646
4658
|
React__default.createElement(Repeat, null,
|
|
4647
4659
|
React__default.createElement(ContentLogo, null,
|
|
4648
|
-
|
|
4660
|
+
financialOption?.description && (React__default.createElement(ContentLogoText, null,
|
|
4649
4661
|
React__default.createElement(Content$2, null,
|
|
4650
4662
|
React__default.createElement("p", null, financialOption.description)))),
|
|
4651
|
-
|
|
4663
|
+
financialOption?.image && (React__default.createElement(ContentLogoMedia, null,
|
|
4652
4664
|
React__default.createElement(LogoBox, { logo: financialOption.image, alt: financialOption.name || 'Logotyp', wide: true }))))),
|
|
4653
4665
|
React__default.createElement(Repeat, null,
|
|
4654
4666
|
React__default.createElement(RepeatSmall, null,
|
|
@@ -4660,7 +4672,7 @@ const LoanModal = ({ id, financialOption, onClose }) => {
|
|
|
4660
4672
|
React__default.createElement(RepeatSmall, null,
|
|
4661
4673
|
React__default.createElement(RepeatTiny, null,
|
|
4662
4674
|
React__default.createElement(Content$2, { small: true },
|
|
4663
|
-
React__default.createElement("p", null, `*Beräknat på ${interestText} % ränta (effektivt ${effectiveInterestText} %)${
|
|
4675
|
+
React__default.createElement("p", null, `*Beräknat på ${interestText} % ränta (effektivt ${effectiveInterestText} %)${loan?.mileage !== null ? `och en årlig körsträcka om ${loan?.mileage} mil.` : ''}`)))),
|
|
4664
4676
|
React__default.createElement(RepeatSmall, null,
|
|
4665
4677
|
React__default.createElement(ButtonClear, { onClick: onToggleExtend, title: extend ? 'Visa mindre information' : 'Visa mer information' },
|
|
4666
4678
|
React__default.createElement(ButtonContent, null, extend ? 'Mindre information' : 'Mer information'))),
|
|
@@ -4677,28 +4689,27 @@ const LoanModal = ({ id, financialOption, onClose }) => {
|
|
|
4677
4689
|
},
|
|
4678
4690
|
{
|
|
4679
4691
|
label: 'Uppläggningskostnad',
|
|
4680
|
-
value: `${numberSeparator(
|
|
4692
|
+
value: `${numberSeparator(financialOption?.setupFee || 0)} kr`,
|
|
4681
4693
|
},
|
|
4682
4694
|
{
|
|
4683
4695
|
label: 'Administrativa avgifter',
|
|
4684
|
-
value: `${numberSeparator(
|
|
4696
|
+
value: `${numberSeparator(financialOption?.administrationFee || 0)} kr/mån`,
|
|
4685
4697
|
},
|
|
4686
4698
|
{
|
|
4687
4699
|
label: 'Total kreditkostnad',
|
|
4688
|
-
value: `${numberSeparator(
|
|
4700
|
+
value: `${numberSeparator(loan?.totalCreditCost || 0)} kr`,
|
|
4689
4701
|
},
|
|
4690
4702
|
] }))))))));
|
|
4691
4703
|
};
|
|
4692
4704
|
|
|
4693
4705
|
const Loan = ({ id, financialOption }) => {
|
|
4694
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
4695
4706
|
const [modal, setModal] = useState(false);
|
|
4696
4707
|
const toggleModal = useCallback(() => setModal(!modal), [modal]);
|
|
4697
|
-
const { data } = useLoanCalculation(id,
|
|
4698
|
-
const interest =
|
|
4699
|
-
const duration =
|
|
4700
|
-
const monthlyCost =
|
|
4701
|
-
const logo =
|
|
4708
|
+
const { data } = useLoanCalculation(id, financialOption.duration?.current, financialOption.downPayment?.current, financialOption.residual?.current);
|
|
4709
|
+
const interest = data?.loan?.interest;
|
|
4710
|
+
const duration = data?.loan?.duration?.current;
|
|
4711
|
+
const monthlyCost = data?.loan?.monthlyCost;
|
|
4712
|
+
const logo = financialOption?.logotype || 'https://placehold.it/67x10';
|
|
4702
4713
|
// Skeleton?
|
|
4703
4714
|
if (financialOption.loanAmount === undefined ||
|
|
4704
4715
|
financialOption.loanAmount === null ||
|
|
@@ -5044,7 +5055,7 @@ const Icon$4 = styled.div `
|
|
|
5044
5055
|
`;
|
|
5045
5056
|
|
|
5046
5057
|
const InputSelect = ({ value, options, onChange, unit, title }) => (React__default.createElement(Wrapper$s, null,
|
|
5047
|
-
React__default.createElement(Select$1, { value: value, onChange: onChange, title: title, "aria-label": title }, options
|
|
5058
|
+
React__default.createElement(Select$1, { value: value, onChange: onChange, title: title, "aria-label": title }, options?.map((option) => (React__default.createElement(Option$1, { key: option.value, value: option.value },
|
|
5048
5059
|
option.displayName || option.value,
|
|
5049
5060
|
unit ? ` ${unit}` : '')))),
|
|
5050
5061
|
React__default.createElement(Icon$4, null,
|
|
@@ -5159,7 +5170,7 @@ const InsuranceModal = ({ id, branch, onClose, insuranceOptions }) => {
|
|
|
5159
5170
|
drivingDistance: DrivingDistance.Between0And1000,
|
|
5160
5171
|
});
|
|
5161
5172
|
const [payload, setPayload] = useState();
|
|
5162
|
-
const { loading, data, error } = useInsuranceCalculation(id,
|
|
5173
|
+
const { loading, data, error } = useInsuranceCalculation(id, branch?.id ? branch?.id : undefined, ssnIsValid(payload?.ssn) ? payload?.ssn : undefined, payload?.drivingDistance);
|
|
5163
5174
|
const onChangeSsn = useCallback((e) => setForm({ ...form, ssn: e.currentTarget.value }), [form]);
|
|
5164
5175
|
const onChangeDrivingDistance = useCallback((e) => setForm({ ...form, drivingDistance: e.currentTarget.value }), [form]);
|
|
5165
5176
|
const onShowInsurances = useCallback(() => {
|
|
@@ -5179,7 +5190,7 @@ const InsuranceModal = ({ id, branch, onClose, insuranceOptions }) => {
|
|
|
5179
5190
|
{ value: DrivingDistance.Over2500, displayName: '2500+' },
|
|
5180
5191
|
];
|
|
5181
5192
|
return (React__default.createElement(Modal, { title: "F\u00F6rs\u00E4kring", onClose: onClose },
|
|
5182
|
-
(
|
|
5193
|
+
(insuranceOptions?.description || insuranceOptions?.logotype) && (React__default.createElement(Repeat, null,
|
|
5183
5194
|
React__default.createElement(ContentLogo, null,
|
|
5184
5195
|
insuranceOptions.description && (React__default.createElement(ContentLogoText, null,
|
|
5185
5196
|
React__default.createElement(Content$2, null,
|
|
@@ -5207,7 +5218,7 @@ const InsuranceModal = ({ id, branch, onClose, insuranceOptions }) => {
|
|
|
5207
5218
|
React__default.createElement(Loader, null))),
|
|
5208
5219
|
error && (React__default.createElement(Repeat, null,
|
|
5209
5220
|
React__default.createElement(Snackbar, { severity: "error", icon: true, heading: "Ett fel har intr\u00E4ffat" }, "Kunde inte h\u00E4mta f\u00F6rs\u00E4kringar. V\u00E4nligen f\u00F6rs\u00F6k igen."))),
|
|
5210
|
-
React__default.createElement(React__default.Fragment, null,
|
|
5221
|
+
React__default.createElement(React__default.Fragment, null, data?.insurances && (React__default.createElement(Repeat, null, data?.insurances.map((insurance) => (React__default.createElement(Repeat, { key: insurance.name },
|
|
5211
5222
|
React__default.createElement(DetailBox, { heading: `${numberSeparator(insurance.price)} ${insurance.unit}`, description: insurance.name },
|
|
5212
5223
|
React__default.createElement(Repeat, null,
|
|
5213
5224
|
React__default.createElement(React__default.Fragment, null, insurance.description && (React__default.createElement(RepeatTiny, null,
|
|
@@ -5253,20 +5264,18 @@ const Insurance = ({ id, branch, insuranceOptions }) => {
|
|
|
5253
5264
|
};
|
|
5254
5265
|
|
|
5255
5266
|
const InsuranceFreeModal = ({ onClose, insuranceOptions }) => {
|
|
5256
|
-
|
|
5257
|
-
|
|
5258
|
-
(insuranceOptions === null || insuranceOptions === void 0 ? void 0 : insuranceOptions.longDescription) && (React__default.createElement(Repeat, null,
|
|
5267
|
+
return (React__default.createElement(Modal, { title: insuranceOptions?.insuranceHeader ?? 'Försäkring', onClose: onClose },
|
|
5268
|
+
insuranceOptions?.longDescription && (React__default.createElement(Repeat, null,
|
|
5259
5269
|
React__default.createElement(Content$2, { dangerouslySetInnerHTML: {
|
|
5260
5270
|
__html: marked(insuranceOptions.longDescription),
|
|
5261
5271
|
} }))),
|
|
5262
|
-
|
|
5272
|
+
insuranceOptions?.url && (React__default.createElement(Repeat, null,
|
|
5263
5273
|
React__default.createElement(ButtonInline, { as: "a", href: insuranceOptions.url, target: "_blank", rel: "noopener noreferrer" }, "L\u00E4s mer om f\u00F6rs\u00E4kringen (\u00D6ppnas i ett nytt f\u00F6nster)"))),
|
|
5264
|
-
|
|
5274
|
+
insuranceOptions?.logotype && (React__default.createElement(Repeat, null,
|
|
5265
5275
|
React__default.createElement(LogoBox, { logo: insuranceOptions.logotype, alt: insuranceOptions.name || 'Logotyp', wide: true })))));
|
|
5266
5276
|
};
|
|
5267
5277
|
|
|
5268
5278
|
const Insurance$1 = ({ insuranceOptions }) => {
|
|
5269
|
-
var _a, _b;
|
|
5270
5279
|
const [modal, setModal] = useState(false);
|
|
5271
5280
|
const toggleModal = useCallback(() => setModal(!modal), [modal]);
|
|
5272
5281
|
if (!insuranceOptions.length) {
|
|
@@ -5276,7 +5285,7 @@ const Insurance$1 = ({ insuranceOptions }) => {
|
|
|
5276
5285
|
modal && React__default.createElement(InsuranceFreeModal, { onClose: toggleModal, insuranceOptions: insuranceOptions[0] }),
|
|
5277
5286
|
React__default.createElement(Repeat, null,
|
|
5278
5287
|
React__default.createElement(RepeatTiny, null,
|
|
5279
|
-
React__default.createElement(VisualHeading, null,
|
|
5288
|
+
React__default.createElement(VisualHeading, null, insuranceOptions[0]?.insuranceHeader ?? 'Försäkring')),
|
|
5280
5289
|
React__default.createElement(RepeatTiny, null,
|
|
5281
5290
|
React__default.createElement(React__default.Fragment, null, insuranceOptions.map((insuranceOption, index) => (React__default.createElement(OptionBox, { key: `${insuranceOption.url}-${index}`, logo: insuranceOption.logotype || undefined, logoAlt: insuranceOption.name || 'Logotyp' },
|
|
5282
5291
|
insuranceOption.description && (React__default.createElement(Content$2, { dangerouslySetInnerHTML: {
|
|
@@ -5300,7 +5309,6 @@ const InsuranceOptions = ({ id, branch, insuranceOptions }) => {
|
|
|
5300
5309
|
};
|
|
5301
5310
|
|
|
5302
5311
|
const ManufacturerPackageOption = ({ packageOption }) => {
|
|
5303
|
-
var _a;
|
|
5304
5312
|
if (!packageOption) {
|
|
5305
5313
|
return null;
|
|
5306
5314
|
}
|
|
@@ -5309,7 +5317,7 @@ const ManufacturerPackageOption = ({ packageOption }) => {
|
|
|
5309
5317
|
React__default.createElement(H2, { noMargin: true }, packageOption.title)),
|
|
5310
5318
|
packageOption.description && (React__default.createElement(Repeat, null,
|
|
5311
5319
|
React__default.createElement(Content$2, { dangerouslySetInnerHTML: { __html: marked(packageOption.description) } }))),
|
|
5312
|
-
|
|
5320
|
+
packageOption.link?.url && (React__default.createElement(Repeat, null,
|
|
5313
5321
|
React__default.createElement(ButtonInline, { as: "a", href: packageOption.link.url, target: "_blank", rel: "noopener noreferrer" }, packageOption.link.title
|
|
5314
5322
|
? packageOption.link.title
|
|
5315
5323
|
: 'Läs mer (Öppnas i ett nytt fönster)'))),
|
|
@@ -5431,7 +5439,7 @@ const typedMetadata = Metadata;
|
|
|
5431
5439
|
const formatPhonenumber = (text) => {
|
|
5432
5440
|
try {
|
|
5433
5441
|
const parsed = parsePhoneNumberFromString(text.replace('-', '').replace(/ /g, ''), typedMetadata);
|
|
5434
|
-
return
|
|
5442
|
+
return parsed?.formatNational() || text;
|
|
5435
5443
|
}
|
|
5436
5444
|
catch (e) {
|
|
5437
5445
|
return text;
|
|
@@ -5439,9 +5447,8 @@ const formatPhonenumber = (text) => {
|
|
|
5439
5447
|
};
|
|
5440
5448
|
|
|
5441
5449
|
const ActionList = ({ contact, branch }) => {
|
|
5442
|
-
|
|
5443
|
-
const
|
|
5444
|
-
const phonenumber = (contact === null || contact === void 0 ? void 0 : contact.phonenumber) || ((_b = branch === null || branch === void 0 ? void 0 : branch.contact) === null || _b === void 0 ? void 0 : _b.phonenumber);
|
|
5450
|
+
const email = contact?.email || branch?.contact?.email;
|
|
5451
|
+
const phonenumber = contact?.phonenumber || branch?.contact?.phonenumber;
|
|
5445
5452
|
const onClickMailVisible = useCallback(() => PubSub.publish('MailVisible'), []);
|
|
5446
5453
|
const onClickPhoneVisible = useCallback(() => PubSub.publish('PhonenumberVisible'), []);
|
|
5447
5454
|
const onClickPhoneValue = useCallback(() => PubSub.publish('PhonenumberCall'), []);
|
|
@@ -5594,7 +5601,7 @@ const BranchModal = ({ loading, connections, onClose }) => {
|
|
|
5594
5601
|
React__default.createElement("p", null, "V\u00E4lj den anl\u00E4ggning du vill visa kontaktuppgifter f\u00F6r."))),
|
|
5595
5602
|
React__default.createElement(RepeatTiny, null,
|
|
5596
5603
|
React__default.createElement(InputLabel, null, "V\u00E4lj anl\u00E4ggning"),
|
|
5597
|
-
React__default.createElement(InputSelect, { value: localValue, onChange: onChange, options: connections
|
|
5604
|
+
React__default.createElement(InputSelect, { value: localValue, onChange: onChange, options: connections?.map((x) => ({
|
|
5598
5605
|
value: x.id,
|
|
5599
5606
|
displayName: x.name,
|
|
5600
5607
|
})), title: "V\u00E4lj anl\u00E4ggning" }))),
|
|
@@ -5603,16 +5610,13 @@ const BranchModal = ({ loading, connections, onClose }) => {
|
|
|
5603
5610
|
React__default.createElement(ButtonContent, null, "V\u00E4lj")))));
|
|
5604
5611
|
};
|
|
5605
5612
|
|
|
5606
|
-
const PackageOptionModal = ({ packageOption, onClose }) => {
|
|
5607
|
-
|
|
5608
|
-
|
|
5609
|
-
|
|
5610
|
-
|
|
5611
|
-
|
|
5612
|
-
|
|
5613
|
-
((_a = packageOption.link) === null || _a === void 0 ? void 0 : _a.href) && packageOption.link.title && (React__default.createElement(Repeat, null,
|
|
5614
|
-
React__default.createElement(ButtonInline, { as: "a", href: packageOption.link.href, target: "_blank", rel: "noopener noreferrer nofollow" }, packageOption.link.title)))));
|
|
5615
|
-
};
|
|
5613
|
+
const PackageOptionModal = ({ packageOption, onClose }) => (React__default.createElement(Modal, { title: packageOption.title || '', onClose: onClose },
|
|
5614
|
+
packageOption.image && (React__default.createElement(Repeat, null,
|
|
5615
|
+
React__default.createElement(LogoBox, { logo: packageOption.image, alt: packageOption.title || undefined, wide: true }))),
|
|
5616
|
+
packageOption.description && (React__default.createElement(Repeat, null,
|
|
5617
|
+
React__default.createElement(Content$2, { dangerouslySetInnerHTML: { __html: marked(packageOption.description) } }))),
|
|
5618
|
+
packageOption.link?.href && packageOption.link.title && (React__default.createElement(Repeat, null,
|
|
5619
|
+
React__default.createElement(ButtonInline, { as: "a", href: packageOption.link.href, target: "_blank", rel: "noopener noreferrer nofollow" }, packageOption.link.title)))));
|
|
5616
5620
|
|
|
5617
5621
|
const CheckList = ({ manufacturer, packageOptions, ecommerce, branch, contact, toggleEcomModal, loadingCentralStorageVehicle, }) => {
|
|
5618
5622
|
const [modalBranch, setModalBranch] = useState(false);
|
|
@@ -5626,45 +5630,45 @@ const CheckList = ({ manufacturer, packageOptions, ecommerce, branch, contact, t
|
|
|
5626
5630
|
setModalBranch(false);
|
|
5627
5631
|
}
|
|
5628
5632
|
}, [branch, contact]);
|
|
5629
|
-
const packageOption = manufacturer
|
|
5633
|
+
const packageOption = manufacturer?.packageOption;
|
|
5630
5634
|
return (React__default.createElement(React__default.Fragment, null,
|
|
5631
|
-
modalBranch && (React__default.createElement(BranchModal, { loading: loadingCentralStorageVehicle, connections: branch
|
|
5635
|
+
modalBranch && (React__default.createElement(BranchModal, { loading: loadingCentralStorageVehicle, connections: branch?.connections, onClose: closeModalBranch })),
|
|
5632
5636
|
modal && React__default.createElement(PackageOptionModal, { packageOption: modal, onClose: onClose }),
|
|
5633
5637
|
React__default.createElement(Repeat, null,
|
|
5634
5638
|
React__default.createElement(CheckMarkList, null,
|
|
5635
|
-
|
|
5639
|
+
packageOption?.title && (React__default.createElement(CheckMarkListItem, null,
|
|
5636
5640
|
React__default.createElement(React__default.Fragment, null,
|
|
5637
5641
|
"Inkl.",
|
|
5638
5642
|
' ',
|
|
5639
5643
|
React__default.createElement(ButtonInline, { onClick: () => onOpen({
|
|
5640
|
-
title: packageOption
|
|
5641
|
-
image: packageOption
|
|
5642
|
-
description: packageOption
|
|
5643
|
-
link: packageOption
|
|
5644
|
+
title: packageOption?.title,
|
|
5645
|
+
image: packageOption?.image,
|
|
5646
|
+
description: packageOption?.description,
|
|
5647
|
+
link: packageOption?.link,
|
|
5644
5648
|
}) }, packageOption.title),
|
|
5645
5649
|
' ',
|
|
5646
|
-
"begagnatgaranti"))),
|
|
5647
|
-
packageOptions
|
|
5650
|
+
"begagnatgaranti"))),
|
|
5651
|
+
packageOptions?.map((packageOption, index) => (React__default.createElement(CheckMarkListItem, { key: packageOption.title || index },
|
|
5648
5652
|
React__default.createElement(React__default.Fragment, null,
|
|
5649
5653
|
"Inkl.",
|
|
5650
5654
|
' ',
|
|
5651
5655
|
React__default.createElement(ButtonInline, { onClick: () => onOpen({
|
|
5652
|
-
title: packageOption
|
|
5653
|
-
image: packageOption
|
|
5654
|
-
description: packageOption
|
|
5655
|
-
link: packageOption
|
|
5656
|
+
title: packageOption?.title,
|
|
5657
|
+
image: packageOption?.image,
|
|
5658
|
+
description: packageOption?.description,
|
|
5659
|
+
link: packageOption?.link,
|
|
5656
5660
|
}) }, packageOption.title))))),
|
|
5657
|
-
|
|
5661
|
+
ecommerce?.withHomeDelivery && React__default.createElement(CheckMarkListItem, null, "Hemleverans"))),
|
|
5658
5662
|
React__default.createElement(Repeat, null,
|
|
5659
5663
|
ecommerce && ecommerce.enabled && (React__default.createElement(RepeatTiny, null,
|
|
5660
5664
|
React__default.createElement(ButtonPrimary, { disabled: !!ecommerce.reserved, fullWidth: true, onClick: toggleEcomModal },
|
|
5661
5665
|
React__default.createElement(ButtonContent, null, "K\u00F6p bilen online")))),
|
|
5662
|
-
|
|
5666
|
+
ecommerce?.reserved && (React__default.createElement(RepeatTiny, null,
|
|
5663
5667
|
React__default.createElement(SwitchBar, { title: "Bilen \u00E4r reserverad", body: "Denna bil \u00E4r reserverad av en annan k\u00F6pare." },
|
|
5664
5668
|
React__default.createElement(Content$2, null,
|
|
5665
5669
|
React__default.createElement("p", null, "Denna bil \u00E4r reserverad av en annan k\u00F6pare."))))),
|
|
5666
5670
|
React__default.createElement(ActionList, { branch: branch, contact: contact })),
|
|
5667
|
-
(
|
|
5671
|
+
(branch?.connections.length || 0) > 1 && (React__default.createElement(Repeat, null,
|
|
5668
5672
|
React__default.createElement(SwitchBar, { title: "Centrallagerbil", actionTitle: "Byt anl\u00E4ggning", onClick: openModalBranch },
|
|
5669
5673
|
React__default.createElement(Content$2, null,
|
|
5670
5674
|
React__default.createElement("p", null, "Denna bil tillh\u00F6r ett centrallager och g\u00E5r att k\u00F6pa genom flera anl\u00E4ggningar. Byt anl\u00E4ggning f\u00F6r att visa kontaktuppgifter till just den anl\u00E4ggningen.")))))));
|
|
@@ -5776,7 +5780,7 @@ const useRelatedSearch = (id) => {
|
|
|
5776
5780
|
const regexEndGuid = /[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12}$/;
|
|
5777
5781
|
const escapeRegExpString = (s) => s.replace(/[-[\]/{}()*+?.\\^$|]/g, '\\$&');
|
|
5778
5782
|
const regexPathGuid = (path) => {
|
|
5779
|
-
if (!path) {
|
|
5783
|
+
if (!path || path) {
|
|
5780
5784
|
return regexEndGuid;
|
|
5781
5785
|
}
|
|
5782
5786
|
const r = new RegExp(`${escapeRegExpString(path)}${regexEndGuid.source}`, 'gi');
|
|
@@ -5791,7 +5795,7 @@ const Related = ({ id, hashRoute, pathRoute, onClickSearchItem }) => {
|
|
|
5791
5795
|
onClickSearchItem(id);
|
|
5792
5796
|
}
|
|
5793
5797
|
}, []);
|
|
5794
|
-
if (!
|
|
5798
|
+
if (!response?.documentList.documents.length || response?.documentList.documents.length === 0) {
|
|
5795
5799
|
return null;
|
|
5796
5800
|
}
|
|
5797
5801
|
if (loading) {
|
|
@@ -5806,17 +5810,16 @@ const Related = ({ id, hashRoute, pathRoute, onClickSearchItem }) => {
|
|
|
5806
5810
|
React__default.createElement(H2, { noMargin: true }, "Senast inkomna")))),
|
|
5807
5811
|
React__default.createElement(Repeat, null,
|
|
5808
5812
|
React__default.createElement(OverflowGrid, null,
|
|
5809
|
-
React__default.createElement(OverflowGridList, null, response
|
|
5810
|
-
var _a, _b, _c;
|
|
5813
|
+
React__default.createElement(OverflowGridList, null, response?.documentList.documents.map((document) => {
|
|
5811
5814
|
const prefix = pathRoute ? `/${pathRoute}` : '/';
|
|
5812
|
-
const r = regexPathGuid(
|
|
5815
|
+
const r = regexPathGuid();
|
|
5813
5816
|
const pathRouteUrl = window.location.pathname === '/'
|
|
5814
5817
|
? `${prefix}${document._id}`
|
|
5815
5818
|
: r.test(`${pathRoute}${id}`)
|
|
5816
|
-
? window.location.pathname.replace(r,
|
|
5819
|
+
? window.location.pathname.replace(r, document._id)
|
|
5817
5820
|
: `${window.location.pathname}${prefix}${document._id}`;
|
|
5818
5821
|
return (React__default.createElement(OverflowGridItem, { key: document._id },
|
|
5819
|
-
React__default.createElement(ProductCard, { id: document._id, onClick: onItemClicked, title: document.title, href: pathRoute ? pathRouteUrl : hashRoute ? `#${document._id}` : undefined, image:
|
|
5822
|
+
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: [
|
|
5820
5823
|
{
|
|
5821
5824
|
title: document.modelYear,
|
|
5822
5825
|
},
|
|
@@ -5839,20 +5842,17 @@ const PackageOptions = ({ packageOptions }) => {
|
|
|
5839
5842
|
if (!packageOptions) {
|
|
5840
5843
|
return null;
|
|
5841
5844
|
}
|
|
5842
|
-
return (React__default.createElement(React__default.Fragment, null, packageOptions.map((packageOption, index) => {
|
|
5843
|
-
|
|
5844
|
-
|
|
5845
|
-
|
|
5846
|
-
|
|
5847
|
-
|
|
5848
|
-
|
|
5849
|
-
|
|
5850
|
-
|
|
5851
|
-
|
|
5852
|
-
|
|
5853
|
-
packageOption.image && (React__default.createElement(Repeat, null,
|
|
5854
|
-
React__default.createElement(LogoBox, { logo: packageOption.image, alt: "Logotyp", wide: true })))));
|
|
5855
|
-
})));
|
|
5845
|
+
return (React__default.createElement(React__default.Fragment, null, packageOptions.map((packageOption, index) => (React__default.createElement(ProductPageMainSection, { key: packageOption.title || index },
|
|
5846
|
+
React__default.createElement(Repeat, null,
|
|
5847
|
+
React__default.createElement(H2, { noMargin: true }, packageOption.title)),
|
|
5848
|
+
packageOption.description && (React__default.createElement(Repeat, null,
|
|
5849
|
+
React__default.createElement(Content$2, { dangerouslySetInnerHTML: { __html: marked(packageOption.description) } }))),
|
|
5850
|
+
packageOption.link?.url && (React__default.createElement(Repeat, null,
|
|
5851
|
+
React__default.createElement(ButtonInline, { as: "a", href: packageOption.link.url, target: "_blank", rel: "noopener noreferrer" }, packageOption.link.title
|
|
5852
|
+
? packageOption.link.title
|
|
5853
|
+
: 'Läs mer (Öppnas i ett nytt fönster)'))),
|
|
5854
|
+
packageOption.image && (React__default.createElement(Repeat, null,
|
|
5855
|
+
React__default.createElement(LogoBox, { logo: packageOption.image, alt: "Logotyp", wide: true }))))))));
|
|
5856
5856
|
};
|
|
5857
5857
|
|
|
5858
5858
|
const TableColumn = styled.div `
|
|
@@ -5923,15 +5923,15 @@ const arr = [];
|
|
|
5923
5923
|
const GetOpeningHours = (o) => KeyOrder.reduce((prev, current) => {
|
|
5924
5924
|
const title = TranslateWeekDays(current);
|
|
5925
5925
|
const item = o[current];
|
|
5926
|
-
const previous = prev
|
|
5927
|
-
if (previous && previous.from ==
|
|
5926
|
+
const previous = prev?.[prev.length - 1];
|
|
5927
|
+
if (previous && previous.from == item?.from && previous.until === item?.until) {
|
|
5928
5928
|
prev[prev.length - 1].titleTo = title;
|
|
5929
5929
|
}
|
|
5930
5930
|
else {
|
|
5931
5931
|
prev.push({
|
|
5932
5932
|
titleFrom: title,
|
|
5933
|
-
from: item
|
|
5934
|
-
until: item
|
|
5933
|
+
from: item?.from,
|
|
5934
|
+
until: item?.until,
|
|
5935
5935
|
});
|
|
5936
5936
|
}
|
|
5937
5937
|
return prev;
|
|
@@ -5942,8 +5942,8 @@ const GetOpeningHoursToday = (o) => {
|
|
|
5942
5942
|
const current = o[day];
|
|
5943
5943
|
return {
|
|
5944
5944
|
title: current ? 'Öppetider idag' : 'Stängt idag',
|
|
5945
|
-
from: current
|
|
5946
|
-
until: current
|
|
5945
|
+
from: current?.from,
|
|
5946
|
+
until: current?.until,
|
|
5947
5947
|
};
|
|
5948
5948
|
};
|
|
5949
5949
|
const valuOfDateString = (s) => {
|
|
@@ -5954,7 +5954,7 @@ const OpeningHours = ({ openingHours }) => {
|
|
|
5954
5954
|
const today = useMemo(() => (openingHours ? GetOpeningHoursToday(openingHours) : null), [openingHours]);
|
|
5955
5955
|
const currentlyOpen = useMemo(() => {
|
|
5956
5956
|
try {
|
|
5957
|
-
if (
|
|
5957
|
+
if (today?.from && today?.until) {
|
|
5958
5958
|
const currentDate = new Date().valueOf();
|
|
5959
5959
|
const from = valuOfDateString(today.from);
|
|
5960
5960
|
const until = valuOfDateString(today.until);
|
|
@@ -5976,9 +5976,9 @@ const OpeningHours = ({ openingHours }) => {
|
|
|
5976
5976
|
React__default.createElement(TableColumn, null,
|
|
5977
5977
|
React__default.createElement(TableColumnRow, null,
|
|
5978
5978
|
React__default.createElement(TableColumnCell, null,
|
|
5979
|
-
React__default.createElement(UtilityTextBold, null, today
|
|
5979
|
+
React__default.createElement(UtilityTextBold, null, today?.title)),
|
|
5980
5980
|
React__default.createElement(TableColumnCell, null,
|
|
5981
|
-
React__default.createElement(UtilityTextBold, null,
|
|
5981
|
+
React__default.createElement(UtilityTextBold, null, today?.from ? `${today.from}-${today.until}` : 'Stängt'))),
|
|
5982
5982
|
oh.map((o) => (React__default.createElement(TableColumnRow, { key: o.titleFrom },
|
|
5983
5983
|
React__default.createElement(TableColumnCell, null, o.titleTo ? `${o.titleFrom}-${o.titleTo}` : o.titleFrom),
|
|
5984
5984
|
React__default.createElement(TableColumnCell, null, o.from ? `${o.from}-${o.until}` : 'Stängt'))))))));
|
|
@@ -6047,7 +6047,6 @@ const StaticMap = ({ position }) => {
|
|
|
6047
6047
|
};
|
|
6048
6048
|
|
|
6049
6049
|
const Branch = ({ branch, loading }) => {
|
|
6050
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
6051
6050
|
const [modal, setModal] = useState(false);
|
|
6052
6051
|
const openModal = useCallback(() => setModal(true), []);
|
|
6053
6052
|
const closeModal = useCallback(() => setModal(false), []);
|
|
@@ -6060,14 +6059,14 @@ const Branch = ({ branch, loading }) => {
|
|
|
6060
6059
|
return null;
|
|
6061
6060
|
}
|
|
6062
6061
|
return (React__default.createElement(React__default.Fragment, null,
|
|
6063
|
-
modal && (React__default.createElement(BranchModal, { loading: loading, connections: branch
|
|
6062
|
+
modal && (React__default.createElement(BranchModal, { loading: loading, connections: branch?.connections, onClose: closeModal })),
|
|
6064
6063
|
React__default.createElement(Repeat, null,
|
|
6065
|
-
React__default.createElement(H2, { noMargin: true },
|
|
6066
|
-
? `Den här bilen finns på vår anläggning i ${
|
|
6064
|
+
React__default.createElement(H2, { noMargin: true }, branch?.location?.city
|
|
6065
|
+
? `Den här bilen finns på vår anläggning i ${branch?.location?.city}`
|
|
6067
6066
|
: 'Kontakt')),
|
|
6068
6067
|
React__default.createElement(Repeat, null,
|
|
6069
|
-
React__default.createElement(StaticMap, { position:
|
|
6070
|
-
(
|
|
6068
|
+
React__default.createElement(StaticMap, { position: branch?.location?.position })),
|
|
6069
|
+
(branch?.connections?.length || 0) > 1 && (React__default.createElement(Repeat, null,
|
|
6071
6070
|
React__default.createElement(Content$2, null,
|
|
6072
6071
|
React__default.createElement("p", null,
|
|
6073
6072
|
"Denna bil tillh\u00F6r ett centrallager och g\u00E5r att k\u00F6pa genom flera anl\u00E4ggningar.",
|
|
@@ -6078,13 +6077,13 @@ const Branch = ({ branch, loading }) => {
|
|
|
6078
6077
|
React__default.createElement(ProductPageContentLimit, null,
|
|
6079
6078
|
React__default.createElement(Repeat, null,
|
|
6080
6079
|
React__default.createElement(TableColumn, null,
|
|
6081
|
-
|
|
6080
|
+
branch?.location?.streetAddress && branch?.location?.city && (React__default.createElement(TableColumnRow, null,
|
|
6082
6081
|
React__default.createElement(TableColumnCell, null, "Adress"),
|
|
6083
6082
|
React__default.createElement(TableColumnCell, null,
|
|
6084
6083
|
React__default.createElement(ButtonInlineBold, null,
|
|
6085
|
-
React__default.createElement(ButtonContent, null, `${
|
|
6086
|
-
|
|
6087
|
-
|
|
6084
|
+
React__default.createElement(ButtonContent, null, `${branch?.location?.streetAddress}, ${branch?.location?.city}`))))),
|
|
6085
|
+
branch?.contact?.phonenumber && (React__default.createElement(PhoneNumber, { phoneNumber: formatPhonenumber(branch.contact.phonenumber) })))),
|
|
6086
|
+
branch?.openingHours && (React__default.createElement(Repeat, null,
|
|
6088
6087
|
React__default.createElement(OpeningHours, { openingHours: branch.openingHours })))))));
|
|
6089
6088
|
};
|
|
6090
6089
|
|
|
@@ -6210,20 +6209,19 @@ const useSearchItemBranch = (id, branch) => useQuery(SEARCH_ITEM_BRANCH_QUERY, {
|
|
|
6210
6209
|
});
|
|
6211
6210
|
|
|
6212
6211
|
const useCentralStorage = (vehicle) => {
|
|
6213
|
-
var _a, _b;
|
|
6214
6212
|
const { centralStorageId, setCentralStorageId } = useContext(CentralStorageContext);
|
|
6215
|
-
const connections =
|
|
6213
|
+
const connections = vehicle?.branch?.connections;
|
|
6216
6214
|
const branchId = centralStorageId
|
|
6217
|
-
?
|
|
6215
|
+
? connections?.find((x) => x.id === centralStorageId)?.id
|
|
6218
6216
|
: undefined;
|
|
6219
|
-
const { data, loading } = useSearchItemBranch(vehicle
|
|
6217
|
+
const { data, loading } = useSearchItemBranch(vehicle?.id, branchId);
|
|
6220
6218
|
useEffect(() => {
|
|
6221
|
-
if ((
|
|
6219
|
+
if ((connections?.length || 0) > 0) {
|
|
6222
6220
|
const match = centralStorageId
|
|
6223
|
-
? connections
|
|
6221
|
+
? connections?.find((x) => x.id === centralStorageId)
|
|
6224
6222
|
: undefined;
|
|
6225
6223
|
if (!match) {
|
|
6226
|
-
const first = connections
|
|
6224
|
+
const first = connections?.[0];
|
|
6227
6225
|
if (first) {
|
|
6228
6226
|
setCentralStorageId(first.id);
|
|
6229
6227
|
}
|
|
@@ -6231,7 +6229,7 @@ const useCentralStorage = (vehicle) => {
|
|
|
6231
6229
|
}
|
|
6232
6230
|
}, [connections]);
|
|
6233
6231
|
return {
|
|
6234
|
-
vehicle: (
|
|
6232
|
+
vehicle: (connections?.length || 0) > 0 ? data?.vehicle : vehicle,
|
|
6235
6233
|
loading,
|
|
6236
6234
|
};
|
|
6237
6235
|
};
|
|
@@ -6248,14 +6246,14 @@ const PageLoading = () => (React__default.createElement(Page, null,
|
|
|
6248
6246
|
|
|
6249
6247
|
class PropertyTreeCreator {
|
|
6250
6248
|
constructor(properties) {
|
|
6251
|
-
this.propertiesWithCategory = (propertyKey) =>
|
|
6249
|
+
this.propertiesWithCategory = (propertyKey) => !!this.properties[propertyKey].category?.id;
|
|
6252
6250
|
this.propertiesWithoutCategory = (propertyKey) => !this.propertiesWithCategory(propertyKey);
|
|
6253
6251
|
this.isList = (property) => property.type === PropertyTreeCreator.TEXT_LIST_TYPE;
|
|
6254
6252
|
this.isNonList = (property) => !this.isList(property);
|
|
6255
|
-
this.hasCategoryWithId = (propertyKey, categoryId) =>
|
|
6256
|
-
this.propertiesWithSubCategory = (propertyKey) =>
|
|
6253
|
+
this.hasCategoryWithId = (propertyKey, categoryId) => this.properties[propertyKey].category?.id === categoryId;
|
|
6254
|
+
this.propertiesWithSubCategory = (propertyKey) => !!this.properties[propertyKey].category?.subCategory?.id;
|
|
6257
6255
|
this.propertiesWithoutSubCategory = (propertyKey) => !this.propertiesWithSubCategory(propertyKey);
|
|
6258
|
-
this.hasSubCategoryWithId = (propertyKey, categoryId) =>
|
|
6256
|
+
this.hasSubCategoryWithId = (propertyKey, categoryId) => this.properties[propertyKey].category?.subCategory?.id === categoryId;
|
|
6259
6257
|
this.properties = properties;
|
|
6260
6258
|
}
|
|
6261
6259
|
create() {
|
|
@@ -6322,7 +6320,7 @@ class PropertyTreeCreator {
|
|
|
6322
6320
|
const categories = Object.keys(this.properties)
|
|
6323
6321
|
.filter((key) => this.hasCategoryWithId(key, id))
|
|
6324
6322
|
.filter(this.propertiesWithSubCategory)
|
|
6325
|
-
.map((key) =>
|
|
6323
|
+
.map((key) => this.properties[key].category?.subCategory)
|
|
6326
6324
|
.filter(PropertyTreeCreator.distinctCategories);
|
|
6327
6325
|
return categories;
|
|
6328
6326
|
}
|
|
@@ -6951,7 +6949,6 @@ const MetadataCategory = ({ properties, subCategories }) => (React__default.crea
|
|
|
6951
6949
|
!!subCategories.length &&
|
|
6952
6950
|
subCategories.map((subCategory, index) => (React__default.createElement(MetadataSubCategory, { name: subCategory.name, properties: subCategory.properties, key: `${subCategory.name}-${index}` })))));
|
|
6953
6951
|
const PropertySet = ({ propertySet, vehicleData }) => {
|
|
6954
|
-
var _a, _b;
|
|
6955
6952
|
const [activeCategoryId, setActiveCategoryId] = useState(-1);
|
|
6956
6953
|
const mappedProperties = useMemo(() => {
|
|
6957
6954
|
if (!propertySet) {
|
|
@@ -6965,20 +6962,19 @@ const PropertySet = ({ propertySet, vehicleData }) => {
|
|
|
6965
6962
|
return tree;
|
|
6966
6963
|
}, [propertySet]);
|
|
6967
6964
|
useEffect(() => {
|
|
6968
|
-
|
|
6969
|
-
const categories = ((_a = mappedProperties === null || mappedProperties === void 0 ? void 0 : mappedProperties.categories) === null || _a === void 0 ? void 0 : _a.length) !== undefined ? mappedProperties === null || mappedProperties === void 0 ? void 0 : mappedProperties.categories : undefined;
|
|
6965
|
+
const categories = mappedProperties?.categories?.length !== undefined ? mappedProperties?.categories : undefined;
|
|
6970
6966
|
if (activeCategoryId < 0 && categories !== undefined && categories.length > 0) {
|
|
6971
6967
|
setActiveCategoryId(categories[0].id);
|
|
6972
6968
|
}
|
|
6973
6969
|
}, [mappedProperties]);
|
|
6974
6970
|
const onTab = useCallback((id) => setActiveCategoryId(parseInt(id, 10)), []);
|
|
6975
|
-
const activeCategory =
|
|
6971
|
+
const activeCategory = mappedProperties?.categories?.find((category) => category.id === activeCategoryId);
|
|
6976
6972
|
return (React__default.createElement(React__default.Fragment, null,
|
|
6977
6973
|
React__default.createElement(Repeat, null,
|
|
6978
|
-
React__default.createElement(Tabs, { tabs:
|
|
6974
|
+
React__default.createElement(Tabs, { tabs: mappedProperties?.categories?.map((category) => ({
|
|
6979
6975
|
name: `${category.id}`,
|
|
6980
6976
|
displayName: category.name,
|
|
6981
|
-
}))
|
|
6977
|
+
})) || [], active: `${activeCategoryId}`, onClick: onTab })),
|
|
6982
6978
|
activeCategory && (React__default.createElement(Repeat, null,
|
|
6983
6979
|
React__default.createElement(MetadataCategory, { properties: activeCategory.properties, subCategories: activeCategory.subCategories })))));
|
|
6984
6980
|
};
|
|
@@ -7047,11 +7043,10 @@ const PdfDownloadItem = ({ document }) => (React__default.createElement(PdfListI
|
|
|
7047
7043
|
const PdfDownloadContainer = ({ documents }) => (React__default.createElement(PdfContainer, null, documents.map((document, i) => (React__default.createElement(PdfDownloadItem, { key: `${document.url}-${i}`, document: document })))));
|
|
7048
7044
|
|
|
7049
7045
|
const WaykeSearchItem = ({ id, hashRoute, pathRoute, disableResetScrollOnInit, placeholderImage, modifyDocumentTitleItem, onClickSearchItem, }) => {
|
|
7050
|
-
var _a, _b, _c;
|
|
7051
7046
|
const { ecomSettings } = useSettings();
|
|
7052
7047
|
const ecomContext = useRef();
|
|
7053
7048
|
const { loading, data: result } = useSearchItem(id);
|
|
7054
|
-
const { vehicle: centralStorageVehicle, loading: loadingCentralStorageVehicle } = useCentralStorage(result
|
|
7049
|
+
const { vehicle: centralStorageVehicle, loading: loadingCentralStorageVehicle } = useCentralStorage(result?.vehicle);
|
|
7055
7050
|
useEffect(() => {
|
|
7056
7051
|
if (ecomSettings) {
|
|
7057
7052
|
ecomContext.current = new WaykeEcomWeb({
|
|
@@ -7060,7 +7055,7 @@ const WaykeSearchItem = ({ id, hashRoute, pathRoute, disableResetScrollOnInit, p
|
|
|
7060
7055
|
api: {
|
|
7061
7056
|
address: ecomSettings.url,
|
|
7062
7057
|
},
|
|
7063
|
-
bankIdThumbprint: ecomSettings
|
|
7058
|
+
bankIdThumbprint: ecomSettings?.bankIdThumbprint,
|
|
7064
7059
|
},
|
|
7065
7060
|
logo: ecomSettings.serviceLogotypeUrl,
|
|
7066
7061
|
logoX2: ecomSettings.serviceLogotypeUrl,
|
|
@@ -7081,26 +7076,25 @@ const WaykeSearchItem = ({ id, hashRoute, pathRoute, disableResetScrollOnInit, p
|
|
|
7081
7076
|
}
|
|
7082
7077
|
}, []);
|
|
7083
7078
|
useEffect(() => {
|
|
7084
|
-
|
|
7085
|
-
if (((_a = result === null || result === void 0 ? void 0 : result.vehicle) === null || _a === void 0 ? void 0 : _a.data) && modifyDocumentTitleItem) {
|
|
7079
|
+
if (result?.vehicle?.data && modifyDocumentTitleItem) {
|
|
7086
7080
|
const { vehicle } = result;
|
|
7087
7081
|
const { registrationNumber } = vehicle.data;
|
|
7088
7082
|
document.title = `${registrationNumber} | ${vehicle.title} | ${vehicle.shortDescription}`;
|
|
7089
7083
|
}
|
|
7090
7084
|
}, [result]);
|
|
7091
|
-
const options = useMemo(() =>
|
|
7085
|
+
const options = useMemo(() => result?.vehicle?.data?.options?.filter(notEmpty).map((opt) => ({ title: opt })), [result?.vehicle?.data?.options]);
|
|
7092
7086
|
const onShowMoreOptionsClick = useCallback(() => PubSub.publish('OptionsClick'), []);
|
|
7093
7087
|
if (loading) {
|
|
7094
7088
|
return React__default.createElement(PageLoading, null);
|
|
7095
7089
|
}
|
|
7096
|
-
if (!
|
|
7090
|
+
if (!result?.vehicle?.data) {
|
|
7097
7091
|
return React__default.createElement(Page404, null);
|
|
7098
7092
|
}
|
|
7099
7093
|
const { vehicle } = result;
|
|
7100
|
-
const contact = centralStorageVehicle
|
|
7101
|
-
const branch = centralStorageVehicle
|
|
7094
|
+
const contact = centralStorageVehicle?.contact;
|
|
7095
|
+
const branch = centralStorageVehicle?.branch;
|
|
7102
7096
|
const { title, shortDescription, media, description, price, financialOptions, manufacturer, ecommerce, packageOptions, publishedAt, documents, } = vehicle;
|
|
7103
|
-
const insuranceOptions =
|
|
7097
|
+
const insuranceOptions = centralStorageVehicle?.insuranceOptions
|
|
7104
7098
|
? centralStorageVehicle.insuranceOptions
|
|
7105
7099
|
: vehicle.insuranceOptions;
|
|
7106
7100
|
const { fuelType, mileage, gearbox, modelYear, propertySet } = vehicle.data;
|
|
@@ -7131,7 +7125,7 @@ const WaykeSearchItem = ({ id, hashRoute, pathRoute, disableResetScrollOnInit, p
|
|
|
7131
7125
|
React__default.createElement(ButtonContent, null,
|
|
7132
7126
|
React__default.createElement(IconChevronLeft, { block: true })),
|
|
7133
7127
|
React__default.createElement(ButtonContent, null, "Tillbaka till bils\u00F6k"))))) : null,
|
|
7134
|
-
|
|
7128
|
+
manufacturer?.logotype && (React__default.createElement(Repeat, null,
|
|
7135
7129
|
React__default.createElement(LogoBox, { logo: manufacturer.logotype, alt: manufacturer.name }))),
|
|
7136
7130
|
React__default.createElement(Repeat, null,
|
|
7137
7131
|
React__default.createElement(RepeatSmall, null,
|
|
@@ -7144,9 +7138,9 @@ const WaykeSearchItem = ({ id, hashRoute, pathRoute, disableResetScrollOnInit, p
|
|
|
7144
7138
|
React__default.createElement(PriceTable, { price: price })),
|
|
7145
7139
|
(financialOptions.length > 0 || insuranceOptions.length > 0) && (React__default.createElement(ProductPageAsideSection, { mobileOrder: 4 },
|
|
7146
7140
|
financialOptions.length > 0 && (React__default.createElement(FinancialOptions, { id: id, financialOptions: financialOptions })),
|
|
7147
|
-
insuranceOptions.length > 0 && (React__default.createElement(InsuranceOptions, { id: id, branch: centralStorageVehicle
|
|
7141
|
+
insuranceOptions.length > 0 && (React__default.createElement(InsuranceOptions, { id: id, branch: centralStorageVehicle?.branch, insuranceOptions: insuranceOptions })))),
|
|
7148
7142
|
React__default.createElement(ProductPageAsideSection, { mobileOrder: 5 },
|
|
7149
|
-
React__default.createElement(CheckList, { manufacturer: manufacturer, packageOptions: packageOptions, ecommerce: ecommerce, branch: branch, contact: centralStorageVehicle
|
|
7143
|
+
React__default.createElement(CheckList, { manufacturer: manufacturer, packageOptions: packageOptions, ecommerce: ecommerce, branch: branch, contact: centralStorageVehicle?.contact, loadingCentralStorageVehicle: loadingCentralStorageVehicle, toggleEcomModal: () => ecomContext.current?.start() }))),
|
|
7150
7144
|
React__default.createElement(ProductPageMain, null,
|
|
7151
7145
|
React__default.createElement(ProductPageAsideSection, { mobileOrder: 3 },
|
|
7152
7146
|
React__default.createElement(Gallery, { media: media, placeholderImage: placeholderImage })),
|
|
@@ -7161,8 +7155,8 @@ const WaykeSearchItem = ({ id, hashRoute, pathRoute, disableResetScrollOnInit, p
|
|
|
7161
7155
|
description && (React__default.createElement(ProductPageMainSection, null,
|
|
7162
7156
|
React__default.createElement(Blockquote, { author: contact && contact.name ? contact.name : null, date: publishedAt
|
|
7163
7157
|
? dateTimeFormat.format(publishedAt, dateTimeFormat.DayMonth)
|
|
7164
|
-
: undefined, avatar:
|
|
7165
|
-
(
|
|
7158
|
+
: undefined, avatar: contact?.avatar || undefined }, !!description && React__default.createElement("p", null, description)))),
|
|
7159
|
+
(options?.length || 0) > 0 && (React__default.createElement(ProductPageMainSection, null,
|
|
7166
7160
|
React__default.createElement(Repeat, null,
|
|
7167
7161
|
React__default.createElement(H2, { noMargin: true }, "Utrustning")),
|
|
7168
7162
|
React__default.createElement(Repeat, null,
|
|
@@ -7182,9 +7176,9 @@ const WaykeSearchItem = ({ id, hashRoute, pathRoute, disableResetScrollOnInit, p
|
|
|
7182
7176
|
React__default.createElement(ProductPageMainSection, null,
|
|
7183
7177
|
React__default.createElement(Branch, { branch: branch, loading: loadingCentralStorageVehicle }),
|
|
7184
7178
|
ecommerce && ecommerce.enabled && (React__default.createElement(Repeat, null,
|
|
7185
|
-
React__default.createElement(ButtonPrimary, { disabled: !!ecommerce.reserved, title: "K\u00F6p bilen online", onClick: () =>
|
|
7179
|
+
React__default.createElement(ButtonPrimary, { disabled: !!ecommerce.reserved, title: "K\u00F6p bilen online", onClick: () => ecomContext.current?.start() }, "K\u00F6p bilen online")))),
|
|
7186
7180
|
React__default.createElement(PackageOptions, { packageOptions: packageOptions }),
|
|
7187
|
-
React__default.createElement(ManufacturerPackageOption, { packageOption: manufacturer
|
|
7181
|
+
React__default.createElement(ManufacturerPackageOption, { packageOption: manufacturer?.packageOption }))))),
|
|
7188
7182
|
React__default.createElement(Related, { id: id, hashRoute: hashRoute, pathRoute: pathRoute, onClickSearchItem: onClickSearchItem })),
|
|
7189
7183
|
false ,
|
|
7190
7184
|
React__default.createElement(PortalElement, { id: DefaultPortal })));
|
|
@@ -7224,7 +7218,7 @@ const SearchProvider = ({ url, apiKey, useQueryParamsFromUrl, pathRoute, childre
|
|
|
7224
7218
|
'x-api-key': apiKey,
|
|
7225
7219
|
}
|
|
7226
7220
|
: {},
|
|
7227
|
-
}, !initialize || !!
|
|
7221
|
+
}, !initialize || !!queryFilter?.block);
|
|
7228
7222
|
const popStateEvent = (event) => {
|
|
7229
7223
|
const { currentTarget } = event;
|
|
7230
7224
|
if (currentTarget) {
|
|
@@ -7267,7 +7261,7 @@ const SearchProvider = ({ url, apiKey, useQueryParamsFromUrl, pathRoute, childre
|
|
|
7267
7261
|
const nextSearch = nextSearchParams.toString() ? `?${nextSearchParams}` : '';
|
|
7268
7262
|
if (initialize) {
|
|
7269
7263
|
if (window.location.search.localeCompare(nextSearch) !== 0) {
|
|
7270
|
-
const _path = pathRoute
|
|
7264
|
+
const _path = pathRoute?.replace(/^\/|\/$/g, '');
|
|
7271
7265
|
const prefix = _path ? `/${_path}/` : '/';
|
|
7272
7266
|
const index = _path ? window.location.pathname.indexOf(prefix) : -1;
|
|
7273
7267
|
let pathname = window.location.pathname;
|
|
@@ -7280,12 +7274,11 @@ const SearchProvider = ({ url, apiKey, useQueryParamsFromUrl, pathRoute, childre
|
|
|
7280
7274
|
}
|
|
7281
7275
|
}, [queryFilter, initialize, useQueryParamsFromUrl]);
|
|
7282
7276
|
useEffect(() => {
|
|
7283
|
-
var _a;
|
|
7284
7277
|
if (response) {
|
|
7285
7278
|
if (!initialFacets && !useQueryParamsFromUrl) {
|
|
7286
7279
|
setInitialFacets(response.facets);
|
|
7287
7280
|
}
|
|
7288
|
-
if (useQueryParamsFromUrl &&
|
|
7281
|
+
if (useQueryParamsFromUrl && response.query?.parameters) {
|
|
7289
7282
|
const nextSearchParams = new URLSearchParams(response.query.parameters);
|
|
7290
7283
|
nextSearchParams.delete('hits');
|
|
7291
7284
|
nextSearchParams.delete('offset');
|
|
@@ -7298,7 +7291,7 @@ const SearchProvider = ({ url, apiKey, useQueryParamsFromUrl, pathRoute, childre
|
|
|
7298
7291
|
});
|
|
7299
7292
|
}
|
|
7300
7293
|
}
|
|
7301
|
-
if (queryFilter
|
|
7294
|
+
if (queryFilter?.concatResult) {
|
|
7302
7295
|
setDocuments([...(documents || []), ...(response.documentList.documents || [])]);
|
|
7303
7296
|
}
|
|
7304
7297
|
else {
|
|
@@ -7317,10 +7310,9 @@ const SearchProvider = ({ url, apiKey, useQueryParamsFromUrl, pathRoute, childre
|
|
|
7317
7310
|
}
|
|
7318
7311
|
}, [initialize]);
|
|
7319
7312
|
const onLoadMore = useCallback(() => {
|
|
7320
|
-
var _a;
|
|
7321
7313
|
if (response) {
|
|
7322
7314
|
setQueryFilter({
|
|
7323
|
-
searchParams: new URLSearchParams(
|
|
7315
|
+
searchParams: new URLSearchParams(response?.documentList.pagination.nextPage?.query),
|
|
7324
7316
|
concatResult: true,
|
|
7325
7317
|
});
|
|
7326
7318
|
}
|
|
@@ -7333,9 +7325,8 @@ const SearchProvider = ({ url, apiKey, useQueryParamsFromUrl, pathRoute, childre
|
|
|
7333
7325
|
: _initialQueryParams;
|
|
7334
7326
|
if (useQueryParamsFromUrl && _initialQueryParams) {
|
|
7335
7327
|
_initialQueryParams.forEach((value, key) => {
|
|
7336
|
-
|
|
7337
|
-
|
|
7338
|
-
initialQueryParams === null || initialQueryParams === void 0 ? void 0 : initialQueryParams.append(key, value);
|
|
7328
|
+
if (!initialQueryParams?.getAll(key)?.some((v) => v === value)) {
|
|
7329
|
+
initialQueryParams?.append(key, value);
|
|
7339
7330
|
}
|
|
7340
7331
|
});
|
|
7341
7332
|
}
|
|
@@ -7397,7 +7388,7 @@ const SettingsProvider = ({ googleMapsApiKey, googleMapsMarker, ecomSettings, ch
|
|
|
7397
7388
|
|
|
7398
7389
|
const RelatedSearchProvider = ({ url, urlMlt, apiKey, children }) => {
|
|
7399
7390
|
const [queryFilter, setQueryFilter] = useState();
|
|
7400
|
-
const query = queryFilter
|
|
7391
|
+
const query = queryFilter?.searchParams.toString();
|
|
7401
7392
|
const { loading, data: response, error, } = useFetch(`${urlMlt || url}${query ? `?${query}` : ''}`, {
|
|
7402
7393
|
headers: apiKey
|
|
7403
7394
|
? {
|
|
@@ -7502,7 +7493,7 @@ const PathProvider = ({ children }) => {
|
|
|
7502
7493
|
}
|
|
7503
7494
|
dispatch({ type: SET_PATH, path });
|
|
7504
7495
|
}, []);
|
|
7505
|
-
const id = useMemo(() =>
|
|
7496
|
+
const id = useMemo(() => state.path.match(regexGuidAnyWhere)?.pop(), [state.path]);
|
|
7506
7497
|
const value = useMemo(() => ({
|
|
7507
7498
|
...state,
|
|
7508
7499
|
previousPath,
|