@wayke-se/components-react 2.16.0 → 3.0.0-beta.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/README.md +33 -2
  2. package/dist-node/index.js +3254 -1142
  3. package/dist-node/index.js.map +1 -1
  4. package/dist-src/State/CentralStorage/useCentralStorage.js +7 -8
  5. package/dist-src/State/Path/PathProvider.js +1 -1
  6. package/dist-src/State/RelatedSearch/RelatedSearchProvider.js +1 -1
  7. package/dist-src/State/Search/SearchProvider.js +7 -10
  8. package/dist-src/components/ActionList/index.js +2 -3
  9. package/dist-src/components/Checklist/index.js +1 -1
  10. package/dist-src/components/ExtendContent/index.js +1 -1
  11. package/dist-src/components/Filter/index.js +10 -7
  12. package/dist-src/components/FilterPanel/checkListFacet.js +1 -1
  13. package/dist-src/components/FilterPanel/colorFacet.js +1 -1
  14. package/dist-src/components/FilterPanel/index.js +1 -1
  15. package/dist-src/components/FilterPanel/rangeFacet.js +14 -16
  16. package/dist-src/components/FinancialOptions/LoanModal.js +27 -29
  17. package/dist-src/components/FinancialOptions/leasing.js +6 -6
  18. package/dist-src/components/FinancialOptions/loan.js +5 -6
  19. package/dist-src/components/Gallery/index.js +11 -16
  20. package/dist-src/components/Grid/index.js +2 -3
  21. package/dist-src/components/InputSelect/index.js +1 -1
  22. package/dist-src/components/InsuranceOptions/InsuranceFree.js +1 -2
  23. package/dist-src/components/InsuranceOptions/InsuranceFreeModal.js +4 -5
  24. package/dist-src/components/InsuranceOptions/InsuranceModal.js +3 -3
  25. package/dist-src/components/Lightbox/index.js +1 -1
  26. package/dist-src/components/OpeningHours/index.js +9 -9
  27. package/dist-src/components/RangeSlider/SliderWithLabel.js +1 -1
  28. package/dist-src/components/Result/index.js +7 -6
  29. package/dist-src/components/Video/EmbededVideo.js +1 -1
  30. package/dist-src/components/Video/QuickNavEmbeded.js +2 -2
  31. package/dist-src/components/Video/useThumbnail.js +1 -1
  32. package/dist-src/components/Video/utils.js +2 -2
  33. package/dist-src/hooks/useFetch.js +1 -1
  34. package/dist-src/hooks/useVimeoThumbnail.js +1 -1
  35. package/dist-src/layouts/searchItem/Branch.js +9 -10
  36. package/dist-src/layouts/searchItem/BranchModal.js +1 -1
  37. package/dist-src/layouts/searchItem/CheckList.js +16 -16
  38. package/dist-src/layouts/searchItem/ManufacturerPackagesOption.js +1 -2
  39. package/dist-src/layouts/searchItem/PackageOptionModal.js +7 -10
  40. package/dist-src/layouts/searchItem/PackageOptions.js +11 -14
  41. package/dist-src/layouts/searchItem/Property.js +4 -6
  42. package/dist-src/layouts/searchItem/Related.js +3 -4
  43. package/dist-src/layouts/searchItem/index.js +42 -21
  44. package/dist-src/providers/WaykeItemProvidet.js +7 -11
  45. package/dist-src/providers/WaykeProvider.js +8 -12
  46. package/dist-src/utils/phonenumbers.js +1 -1
  47. package/dist-src/utils/specification.js +9 -13
  48. package/dist-src/utils/vehicle-properties/property-tree-creator.js +5 -5
  49. package/dist-types/State/CentralStorage/useCentralStorage.d.ts +1 -1
  50. package/dist-types/State/Settings/SettingsContext.d.ts +1 -0
  51. package/dist-types/components/InputSearch/index.d.ts +5 -3
  52. package/dist-types/components/RangeSlider/handle.d.ts +2 -2
  53. package/dist-types/components/RangeSlider/track.d.ts +2 -2
  54. package/dist-types/components/Video/useThumbnail.d.ts +1 -1
  55. package/dist-types/components/Video/utils.d.ts +2 -2
  56. package/dist-types/hooks/useFetch.d.ts +1 -1
  57. package/dist-types/hooks/useInsurance.d.ts +1 -1
  58. package/dist-types/hooks/useLoan.d.ts +1 -1
  59. package/dist-types/hooks/useSearchItem.d.ts +1 -1
  60. package/dist-types/hooks/useSearchItemBranch.d.ts +1 -1
  61. package/dist-types/hooks/useVimeoThumbnail.d.ts +1 -1
  62. package/dist-types/utils/regex.d.ts +1 -1
  63. package/dist-types/utils/ssn.d.ts +1 -1
  64. package/dist-web/index.js +250 -323
  65. package/dist-web/index.js.map +1 -1
  66. package/package.json +18 -26
  67. package/dist-src/components/Ecom/index.js +0 -48
  68. package/dist-src/hooks/useEcom.js +0 -18
  69. package/dist-types/components/Ecom/index.d.ts +0 -10
  70. package/dist-types/hooks/useEcom.d.ts +0 -3
@@ -1,4 +1,5 @@
1
- import React, { useMemo, useState, useCallback, useEffect } from 'react';
1
+ import React, { useMemo, useRef, useCallback, useEffect } from 'react';
2
+ import WaykeEcomWeb from '@wayke-se/ecom-web';
2
3
  import Container from '../../components/Container/index';
3
4
  import UspList from '../../components/UspList/index';
4
5
  import { Repeat, RepeatSmall } from '../../components/Repeat/index';
@@ -20,7 +21,6 @@ import { PortalNamespace, PortalElement } from '../../components/Portal/index';
20
21
  import Modal from '../../components/Modal/index';
21
22
  import FinancialOptions from '../../components/FinancialOptions/index';
22
23
  import InsuranceOptions from '../../components/InsuranceOptions/index';
23
- import Ecom from '../../components/Ecom/index';
24
24
  import ManufacturerPackageOption from './ManufacturerPackagesOption';
25
25
  import CheckList from './CheckList';
26
26
  import Related from './Related';
@@ -32,38 +32,60 @@ import PageLoading from './PageLoading';
32
32
  import PubSub from '../../utils/pubsub/pubsub';
33
33
  import Property from './Property';
34
34
  import PdfDownloadContainer from '../../components/Pdf/index';
35
+ import useSettings from '../../State/Settings/useSettings';
35
36
  const WaykeSearchItem = ({ id, hashRoute, pathRoute, disableResetScrollOnInit, placeholderImage, modifyDocumentTitleItem, onClickSearchItem, }) => {
36
- var _a, _b, _c;
37
- const [ecomModal, setEcomModal] = useState(false);
37
+ const { ecomSettings } = useSettings();
38
+ const ecomContext = useRef();
38
39
  const { loading, data: result } = useSearchItem(id);
39
- const toggleEcomModal = useCallback(() => setEcomModal(!ecomModal), [ecomModal]);
40
- const { vehicle: centralStorageVehicle, loading: loadingCentralStorageVehicle } = useCentralStorage(result === null || result === void 0 ? void 0 : result.vehicle);
40
+ const { vehicle: centralStorageVehicle, loading: loadingCentralStorageVehicle } = useCentralStorage(result?.vehicle);
41
+ useEffect(() => {
42
+ if (ecomSettings) {
43
+ ecomContext.current = new WaykeEcomWeb({
44
+ id,
45
+ ecomSdkConfig: {
46
+ api: {
47
+ address: ecomSettings.url,
48
+ },
49
+ bankIdThumbprint: ecomSettings?.bankIdThumbprint,
50
+ },
51
+ logo: ecomSettings.serviceLogotypeUrl,
52
+ logoX2: ecomSettings.serviceLogotypeUrl,
53
+ onEvent(view, event, currentStep, data) {
54
+ PubSub.publish('EcomOnUserEvent', view, event, currentStep, data);
55
+ },
56
+ });
57
+ }
58
+ return () => {
59
+ if (ecomContext.current) {
60
+ ecomContext.current.destroy();
61
+ }
62
+ };
63
+ }, []);
41
64
  useEffect(() => {
42
65
  if (!disableResetScrollOnInit) {
43
66
  window.scrollTo(0, 0);
44
67
  }
45
68
  }, []);
46
69
  useEffect(() => {
47
- var _a;
48
- if (((_a = result === null || result === void 0 ? void 0 : result.vehicle) === null || _a === void 0 ? void 0 : _a.data) && modifyDocumentTitleItem) {
70
+ if (result?.vehicle?.data && modifyDocumentTitleItem) {
49
71
  const { vehicle } = result;
50
72
  const { registrationNumber } = vehicle.data;
51
73
  document.title = `${registrationNumber} | ${vehicle.title} | ${vehicle.shortDescription}`;
52
74
  }
53
75
  }, [result]);
54
- const options = useMemo(() => { var _a, _b, _c; return (_c = (_b = (_a = result === null || result === void 0 ? void 0 : result.vehicle) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.options) === null || _c === void 0 ? void 0 : _c.filter(notEmpty).map((opt) => ({ title: opt })); }, [(_b = (_a = result === null || result === void 0 ? void 0 : result.vehicle) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.options]);
76
+ const options = useMemo(() => result?.vehicle?.data?.options?.filter(notEmpty).map((opt) => ({ title: opt })), [result?.vehicle?.data?.options]);
55
77
  const onShowMoreOptionsClick = useCallback(() => PubSub.publish('OptionsClick'), []);
56
78
  if (loading) {
57
79
  return React.createElement(PageLoading, null);
58
80
  }
59
- if (!((_c = result === null || result === void 0 ? void 0 : result.vehicle) === null || _c === void 0 ? void 0 : _c.data)) {
81
+ if (!result?.vehicle?.data) {
60
82
  return React.createElement(Page404, null);
61
83
  }
62
84
  const { vehicle } = result;
63
- const contact = centralStorageVehicle === null || centralStorageVehicle === void 0 ? void 0 : centralStorageVehicle.contact;
64
- const branch = centralStorageVehicle === null || centralStorageVehicle === void 0 ? void 0 : centralStorageVehicle.branch;
85
+ const contact = centralStorageVehicle?.contact;
86
+ const branch = centralStorageVehicle?.branch;
65
87
  const { title, shortDescription, media, description, price, financialOptions, manufacturer, ecommerce, packageOptions, publishedAt, documents, } = vehicle;
66
- const insuranceOptions = (centralStorageVehicle === null || centralStorageVehicle === void 0 ? void 0 : centralStorageVehicle.insuranceOptions)
88
+ const insuranceOptions = centralStorageVehicle?.insuranceOptions
67
89
  ? centralStorageVehicle.insuranceOptions
68
90
  : vehicle.insuranceOptions;
69
91
  const { fuelType, mileage, gearbox, modelYear, propertySet } = vehicle.data;
@@ -82,7 +104,6 @@ const WaykeSearchItem = ({ id, hashRoute, pathRoute, disableResetScrollOnInit, p
82
104
  uspList.push({ title: fuelType });
83
105
  }
84
106
  return (React.createElement(React.Fragment, null,
85
- ecomModal && React.createElement(Ecom, { vehicle: vehicle, manufacturer: manufacturer, onExit: toggleEcomModal }),
86
107
  React.createElement(Page, null,
87
108
  React.createElement(PageSection, { large: true },
88
109
  React.createElement(Container, null,
@@ -95,7 +116,7 @@ const WaykeSearchItem = ({ id, hashRoute, pathRoute, disableResetScrollOnInit, p
95
116
  React.createElement(ButtonContent, null,
96
117
  React.createElement(IconChevronLeft, { block: true })),
97
118
  React.createElement(ButtonContent, null, "Tillbaka till bils\u00F6k"))))) : null,
98
- (manufacturer === null || manufacturer === void 0 ? void 0 : manufacturer.logotype) && (React.createElement(Repeat, null,
119
+ manufacturer?.logotype && (React.createElement(Repeat, null,
99
120
  React.createElement(LogoBox, { logo: manufacturer.logotype, alt: manufacturer.name }))),
100
121
  React.createElement(Repeat, null,
101
122
  React.createElement(RepeatSmall, null,
@@ -108,9 +129,9 @@ const WaykeSearchItem = ({ id, hashRoute, pathRoute, disableResetScrollOnInit, p
108
129
  React.createElement(PriceTable, { price: price })),
109
130
  (financialOptions.length > 0 || insuranceOptions.length > 0) && (React.createElement(ProductPageAsideSection, { mobileOrder: 4 },
110
131
  financialOptions.length > 0 && (React.createElement(FinancialOptions, { id: id, financialOptions: financialOptions })),
111
- insuranceOptions.length > 0 && (React.createElement(InsuranceOptions, { id: id, branch: centralStorageVehicle === null || centralStorageVehicle === void 0 ? void 0 : centralStorageVehicle.branch, insuranceOptions: insuranceOptions })))),
132
+ insuranceOptions.length > 0 && (React.createElement(InsuranceOptions, { id: id, branch: centralStorageVehicle?.branch, insuranceOptions: insuranceOptions })))),
112
133
  React.createElement(ProductPageAsideSection, { mobileOrder: 5 },
113
- React.createElement(CheckList, { manufacturer: manufacturer, packageOptions: packageOptions, ecommerce: ecommerce, branch: branch, contact: centralStorageVehicle === null || centralStorageVehicle === void 0 ? void 0 : centralStorageVehicle.contact, loadingCentralStorageVehicle: loadingCentralStorageVehicle, toggleEcomModal: toggleEcomModal }))),
134
+ React.createElement(CheckList, { manufacturer: manufacturer, packageOptions: packageOptions, ecommerce: ecommerce, branch: branch, contact: centralStorageVehicle?.contact, loadingCentralStorageVehicle: loadingCentralStorageVehicle, toggleEcomModal: () => ecomContext.current?.start() }))),
114
135
  React.createElement(ProductPageMain, null,
115
136
  React.createElement(ProductPageAsideSection, { mobileOrder: 3 },
116
137
  React.createElement(Gallery, { media: media, placeholderImage: placeholderImage })),
@@ -125,8 +146,8 @@ const WaykeSearchItem = ({ id, hashRoute, pathRoute, disableResetScrollOnInit, p
125
146
  description && (React.createElement(ProductPageMainSection, null,
126
147
  React.createElement(Blockquote, { author: contact && contact.name ? contact.name : null, date: publishedAt
127
148
  ? dateTimeFormat.format(publishedAt, dateTimeFormat.DayMonth)
128
- : undefined, avatar: (contact === null || contact === void 0 ? void 0 : contact.avatar) || undefined }, !!description && React.createElement("p", null, description)))),
129
- ((options === null || options === void 0 ? void 0 : options.length) || 0) > 0 && (React.createElement(ProductPageMainSection, null,
149
+ : undefined, avatar: contact?.avatar || undefined }, !!description && React.createElement("p", null, description)))),
150
+ (options?.length || 0) > 0 && (React.createElement(ProductPageMainSection, null,
130
151
  React.createElement(Repeat, null,
131
152
  React.createElement(H2, { noMargin: true }, "Utrustning")),
132
153
  React.createElement(Repeat, null,
@@ -146,9 +167,9 @@ const WaykeSearchItem = ({ id, hashRoute, pathRoute, disableResetScrollOnInit, p
146
167
  React.createElement(ProductPageMainSection, null,
147
168
  React.createElement(Branch, { branch: branch, loading: loadingCentralStorageVehicle }),
148
169
  ecommerce && ecommerce.enabled && (React.createElement(Repeat, null,
149
- React.createElement(ButtonPrimary, { disabled: !!ecommerce.reserved, title: "K\u00F6p bilen online", onClick: toggleEcomModal }, "K\u00F6p bilen online")))),
170
+ React.createElement(ButtonPrimary, { disabled: !!ecommerce.reserved, title: "K\u00F6p bilen online", onClick: () => ecomContext.current?.start() }, "K\u00F6p bilen online")))),
150
171
  React.createElement(PackageOptions, { packageOptions: packageOptions }),
151
- React.createElement(ManufacturerPackageOption, { packageOption: manufacturer === null || manufacturer === void 0 ? void 0 : manufacturer.packageOption }))))),
172
+ React.createElement(ManufacturerPackageOption, { packageOption: manufacturer?.packageOption }))))),
152
173
  React.createElement(Related, { id: id, hashRoute: hashRoute, pathRoute: pathRoute, onClickSearchItem: onClickSearchItem })),
153
174
  false && (React.createElement(Modal, { title: "Modal", onClose: () => { } },
154
175
  React.createElement(Content, null,
@@ -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
- useEcom(ecomSettings);
12
- return (React.createElement(PathProvider, null,
13
- React.createElement(SettingsProvider, { googleMapsApiKey: googleMapsApiKey, googleMapsMarker: googleMapsMarker, ecomSettings: ecomSettings },
14
- React.createElement(CentralStorageProvider, null,
15
- React.createElement(GraphqlProvider, { uri: graphQlUrl },
16
- React.createElement(RelatedSearchProvider, { url: url, urlMlt: urlMlt, apiKey: apiKey },
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
- useEcom(ecomSettings);
13
- return (React.createElement(PathProvider, null,
14
- React.createElement(SettingsProvider, { googleMapsApiKey: googleMapsApiKey, googleMapsMarker: googleMapsMarker, ecomSettings: ecomSettings },
15
- React.createElement(CentralStorageProvider, null,
16
- React.createElement(GraphqlProvider, { uri: graphQlUrl },
17
- React.createElement(SearchProvider, { url: url, apiKey: apiKey, useQueryParamsFromUrl: useQueryParamsFromUrl, pathRoute: pathRoute },
18
- React.createElement(RelatedSearchProvider, { url: url, urlMlt: urlMlt, apiKey: apiKey },
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 (parsed === null || parsed === void 0 ? void 0 : parsed.formatNational()) || text;
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 (!!((_a = item === null || item === void 0 ? void 0 : item.properties) === null || _a === void 0 ? void 0 : _a[key]) ||
447
- (typeof ((_b = item === null || item === void 0 ? void 0 : item.properties) === null || _b === void 0 ? void 0 : _b[key]) === 'number' && (((_c = item === null || item === void 0 ? void 0 : item.properties) === null || _c === void 0 ? void 0 : _c[key]) || -1) > -1)) {
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 ((_d = spec.modal) === null || _d === void 0 ? void 0 : _d.dynamicTitle) {
465
+ if (spec.modal?.dynamicTitle) {
470
466
  modal.title = spec.modal.dynamicTitle(item);
471
467
  }
472
- else if ((_e = spec.modal) === null || _e === void 0 ? void 0 : _e.title) {
468
+ else if (spec.modal?.title) {
473
469
  modal.title = spec.modal.title;
474
470
  }
475
- if ((_f = spec.modal) === null || _f === void 0 ? void 0 : _f.dynamicText) {
471
+ if (spec.modal?.dynamicText) {
476
472
  modal.text = spec.modal.dynamicText(item);
477
473
  }
478
- else if ((_g = spec.modal) === null || _g === void 0 ? void 0 : _g.text) {
474
+ else if (spec.modal?.text) {
479
475
  modal.text = spec.modal.text;
480
476
  }
481
- if ((_h = spec.modal) === null || _h === void 0 ? void 0 : _h.concatPropValue) {
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 === null || concatObj === void 0 ? void 0 : concatObj.value) {
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) => { var _a; return !!((_a = this.properties[propertyKey].category) === null || _a === void 0 ? void 0 : _a.id); };
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) => { var _a; return ((_a = this.properties[propertyKey].category) === null || _a === void 0 ? void 0 : _a.id) === categoryId; };
8
- this.propertiesWithSubCategory = (propertyKey) => { var _a, _b; return !!((_b = (_a = this.properties[propertyKey].category) === null || _a === void 0 ? void 0 : _a.subCategory) === null || _b === void 0 ? void 0 : _b.id); };
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) => { var _a, _b; return ((_b = (_a = this.properties[propertyKey].category) === null || _a === void 0 ? void 0 : _a.subCategory) === null || _b === void 0 ? void 0 : _b.id) === 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) => { var _a; return (_a = this.properties[key].category) === null || _a === void 0 ? void 0 : _a.subCategory; })
77
+ .map((key) => this.properties[key].category?.subCategory)
78
78
  .filter(PropertyTreeCreator.distinctCategories);
79
79
  return categories;
80
80
  }
@@ -1,5 +1,5 @@
1
1
  import { Vehicle } from '../../@types/codegen/types';
2
- declare const useCentralStorage: (vehicle?: Vehicle | null | undefined) => {
2
+ declare const useCentralStorage: (vehicle?: Vehicle | null) => {
3
3
  vehicle: import("../../@types/codegen/types").Maybe<Vehicle> | undefined;
4
4
  loading: boolean;
5
5
  };
@@ -3,6 +3,7 @@ export interface SettingsContextProps {
3
3
  googleMapsApiKey?: string;
4
4
  googleMapsMarker?: string;
5
5
  ecomSettings?: {
6
+ url: string;
6
7
  useBankId?: boolean;
7
8
  displayBankIdAlert?: boolean;
8
9
  serviceLogotypeUrl?: string;
@@ -1,9 +1,11 @@
1
1
  import React from 'react';
2
- declare const InputSearch: React.ForwardRefExoticComponent<Pick<React.ClassAttributes<HTMLInputElement> & React.InputHTMLAttributes<HTMLInputElement> & {
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 | undefined;
6
+ value?: string;
6
7
  id: string;
7
8
  onSearch: () => void;
8
- }, "label" | "key" | keyof React.InputHTMLAttributes<HTMLInputElement> | "onSearch"> & React.RefAttributes<HTMLDivElement>>;
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
- import React from 'react';
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: React.SFC<IHandleProps>;
8
+ export declare const Handle: ({ domain: [min, max], handle: { id, value, percent }, getHandleProps, }: IHandleProps) => JSX.Element;
9
9
  export {};
@@ -1,9 +1,9 @@
1
- import React from 'react';
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: React.SFC<ITrackProps>;
8
+ export declare const Track: ({ source, target, getTrackProps }: ITrackProps) => JSX.Element;
9
9
  export {};
@@ -1,2 +1,2 @@
1
- declare const useThumbnail: (url?: string | null | undefined, small?: boolean | undefined) => string[] | undefined;
1
+ declare const useThumbnail: (url?: string | null, small?: boolean) => string[] | undefined;
2
2
  export default useThumbnail;
@@ -5,5 +5,5 @@ export declare const getYoutubeThumbnail: (url: string) => {
5
5
  hqdefault: string;
6
6
  mqdefault: string;
7
7
  } | undefined;
8
- export declare const onImageLoad: (e: React.SyntheticEvent<HTMLImageElement, Event>, thumbnail?: string[] | undefined) => void;
9
- export declare const onImageError: (e: React.SyntheticEvent<HTMLImageElement, Event>, thumbnail?: string[] | undefined) => void;
8
+ export declare const onImageLoad: (e: React.SyntheticEvent<HTMLImageElement, Event>, thumbnail?: string[]) => void;
9
+ export declare const onImageError: (e: React.SyntheticEvent<HTMLImageElement, Event>, thumbnail?: string[]) => void;
@@ -3,5 +3,5 @@ interface Response<T> {
3
3
  data?: T;
4
4
  error: boolean;
5
5
  }
6
- declare const useFetch: <T>(path: RequestInfo, options?: RequestInit | undefined, skip?: boolean | undefined, promiseCache?: boolean | undefined) => Response<T>;
6
+ declare const useFetch: <T>(path: RequestInfo, options?: RequestInit, skip?: boolean, promiseCache?: boolean) => Response<T>;
7
7
  export default useFetch;
@@ -1,4 +1,4 @@
1
1
  import { QueryResult } from '@apollo/client';
2
2
  import { DrivingDistance, QueryInsurancesArgs, Query } from '../@types/codegen/types';
3
- declare const useInsuranceCalculation: (id: string, branchId?: string | undefined, personalNumber?: string | undefined, drivingDistance?: DrivingDistance | undefined) => QueryResult<Query, QueryInsurancesArgs>;
3
+ declare const useInsuranceCalculation: (id: string, branchId?: string, personalNumber?: string, drivingDistance?: DrivingDistance) => QueryResult<Query, QueryInsurancesArgs>;
4
4
  export default useInsuranceCalculation;
@@ -1,4 +1,4 @@
1
1
  import { QueryResult } from '@apollo/client';
2
2
  import { QueryLoanArgs, Query } from '../@types/codegen/types';
3
- declare const useLoanCalculation: (id: string, duration?: number | undefined, downPayment?: number | undefined, residual?: number | undefined) => QueryResult<Query, QueryLoanArgs>;
3
+ declare const useLoanCalculation: (id: string, duration?: number, downPayment?: number, residual?: number) => QueryResult<Query, QueryLoanArgs>;
4
4
  export default useLoanCalculation;
@@ -1,4 +1,4 @@
1
1
  import { QueryResult } from '@apollo/client';
2
2
  import { QueryVehicleArgs, Query } from '../@types/codegen/types';
3
- declare const useSearchItem: (id?: string | undefined) => QueryResult<Query, QueryVehicleArgs>;
3
+ declare const useSearchItem: (id?: string) => QueryResult<Query, QueryVehicleArgs>;
4
4
  export default useSearchItem;
@@ -1,4 +1,4 @@
1
1
  import { QueryResult } from '@apollo/client';
2
2
  import { QueryVehicleArgs, Query } from '../@types/codegen/types';
3
- declare const useSearchItemBranch: (id?: string | null | undefined, branch?: string | null | undefined) => QueryResult<Query, QueryVehicleArgs>;
3
+ declare const useSearchItemBranch: (id?: string | null, branch?: string | null) => QueryResult<Query, QueryVehicleArgs>;
4
4
  export default useSearchItemBranch;
@@ -1,2 +1,2 @@
1
- declare const useVimeoThumbnail: (id?: string | undefined, small?: boolean | undefined) => string | undefined;
1
+ declare const useVimeoThumbnail: (id?: string, small?: boolean) => string | undefined;
2
2
  export default useVimeoThumbnail;
@@ -1,3 +1,3 @@
1
1
  export declare const regexGuid: RegExp;
2
2
  export declare const escapeRegExpString: (s: string) => string;
3
- export declare const regexPathGuid: (path?: string | undefined) => RegExp;
3
+ export declare const regexPathGuid: (path?: string) => RegExp;
@@ -1 +1 @@
1
- export declare const ssnIsValid: (s?: string | undefined) => boolean;
1
+ export declare const ssnIsValid: (s?: string) => boolean;