@bytebrand/fe-ui-core 4.8.113 → 4.8.114

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bytebrand/fe-ui-core",
3
- "version": "4.8.113",
3
+ "version": "4.8.114",
4
4
  "description": "UI components for the auto.de project",
5
5
  "main": "index.ts",
6
6
  "module": "dist/common.js",
@@ -104,7 +104,7 @@
104
104
  "@types/react": "^16.8.3"
105
105
  },
106
106
  "scripts": {
107
- "prepare": "node -e 0",
107
+ "prepare": "husky",
108
108
  "storybook": "start-storybook -p 6006",
109
109
  "clean": "rm -rf ./dist/*.*",
110
110
  "build:lib": "yarn clean && webpack --config ./webpack.config.js --progress",
@@ -74,20 +74,24 @@ const withStats = (WrappedComponent: any) => ({
74
74
  const MIN_PRICE_DIFFERENCE = 500;
75
75
 
76
76
  const [showByLocalStorage, setShowByLocalStorage] = React.useState(false);
77
- const [lsFinancingFirst, setLsFinancingFirst] = React.useState<number | undefined>(undefined);
77
+ const [anyLsBlocked, setAnyLsBlocked] = React.useState(false);
78
78
 
79
79
  React.useEffect(() => {
80
80
  const raw = localStorage.getItem('financing_store');
81
81
  const parsed = raw ? JSON.parse(raw) : null;
82
82
  const fin = parsed?.userCommonConfig?.financing?.firstInstallment;
83
83
  const lea = parsed?.userCommonConfig?.leasing?.firstInstallment;
84
- setLsFinancingFirst(fin);
85
- setShowByLocalStorage(fin === 0 || lea === 0);
84
+ const finBlocked = fin !== undefined && fin !== null && fin !== 0;
85
+ const leaBlocked = lea !== undefined && lea !== null && lea !== 0;
86
+ const anyBlocked = finBlocked || leaBlocked;
87
+ const hasZero = fin === 0 || lea === 0;
88
+ setAnyLsBlocked(anyBlocked);
89
+ setShowByLocalStorage(hasZero && !anyBlocked);
86
90
  }, []);
87
91
 
88
92
  const showByBackend = disableDownPaymentLocalStorage
89
93
  ? !!showDownPayment
90
- : showDownPayment && (lsFinancingFirst === undefined || lsFinancingFirst === null);
94
+ : showDownPayment && !anyLsBlocked;
91
95
  const effectiveShowByLocalStorage = disableDownPaymentLocalStorage ? false : showByLocalStorage;
92
96
 
93
97
  const onHandleSlideChange = (activeSlide: number) => {