thm-p3-configurator 0.0.183 → 0.0.185

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.
@@ -509,6 +509,10 @@ const useQuestionsQuery = questionParams => {
509
509
  licensePlate,
510
510
  model
511
511
  } = questionParams;
512
+ if (questionParams.buildYear) {
513
+ questionParams.constructionYear = questionParams.buildYear;
514
+ }
515
+ delete questionParams.buildYear;
512
516
  const questionsParamsString = new URLSearchParams((0, _helpers__.removeNullishProps)(questionParams)).toString();
513
517
  const questionsQuery = (0, _reactQuery.useQuery)(['questions', questionsParamsString], {
514
518
  enabled: (licensePlate === null || licensePlate === void 0 ? void 0 : licensePlate.length) > 5 || !!(model !== null && model !== void 0 && model.length),
@@ -66,7 +66,8 @@ const LicensePlateForm = _ref => {
66
66
  const [{
67
67
  licensePlate,
68
68
  discountCode,
69
- singleOrderFormulaCode
69
+ singleOrderFormulaCode,
70
+ buildYear
70
71
  }, dispatch] = (0, _OrderSessionContext.useOrderSession)();
71
72
  const [filterLicensePlate, setFilterLicensePlate] = (0, _react.useState)(initialValue || '');
72
73
  const history = (0, _reactRouter.useHistory)();
@@ -78,7 +79,8 @@ const LicensePlateForm = _ref => {
78
79
  (0, _queries.useQuestionsQuery)({
79
80
  licensePlate,
80
81
  formula,
81
- discountCode
82
+ discountCode,
83
+ buildYear
82
84
  }); // Prefetch
83
85
  (0, _queries.useBrandsQuery)(); // Prefetch
84
86
  }
@@ -96,7 +96,8 @@ const ManualSelectionForm = _ref => {
96
96
  (0, _queries.useQuestionsQuery)({
97
97
  model,
98
98
  formula,
99
- discountCode
99
+ discountCode,
100
+ buildYear
100
101
  }); // Prefetch
101
102
 
102
103
  const {
@@ -2,7 +2,6 @@
2
2
 
3
3
  require("core-js/modules/es.symbol.description.js");
4
4
  require("core-js/modules/es.weak-map.js");
5
- require("core-js/modules/esnext.iterator.map.js");
6
5
  require("core-js/modules/web.dom-collections.iterator.js");
7
6
  require("core-js/modules/es.weak-map.js");
8
7
  Object.defineProperty(exports, "__esModule", {
@@ -10,8 +9,8 @@ Object.defineProperty(exports, "__esModule", {
10
9
  });
11
10
  exports.default = void 0;
12
11
  require("core-js/modules/es.symbol.description.js");
13
- require("core-js/modules/esnext.iterator.map.js");
14
12
  require("core-js/modules/web.dom-collections.iterator.js");
13
+ var _quillDeltaToHtml = require("quill-delta-to-html");
15
14
  var _react = _interopRequireWildcard(require("react"));
16
15
  var _queries = require("../__api__/queries");
17
16
  var _CardWide = _interopRequireDefault(require("../__components__/Cards/CardWide"));
@@ -52,7 +51,7 @@ function _interopRequireWildcard(e, r) {
52
51
  return n.default = e, t && t.set(e, n), n;
53
52
  }
54
53
  const ProductDiscountCard = () => {
55
- var _discountCodeInfo$ima3, _discountCodeInfo$des, _discountCodeInfo$des2;
54
+ var _discountCodeInfo$des2, _discountCodeInfo$ima3;
56
55
  const [{
57
56
  licensePlate,
58
57
  model,
@@ -76,6 +75,14 @@ const ProductDiscountCard = () => {
76
75
  discountCode,
77
76
  priceCalculationDate
78
77
  });
78
+ const discountDescriptionHtml = (0, _react.useMemo)(() => {
79
+ var _discountCodeInfo$des;
80
+ if (discountCodeInfo !== null && discountCodeInfo !== void 0 && (_discountCodeInfo$des = discountCodeInfo.description) !== null && _discountCodeInfo$des !== void 0 && _discountCodeInfo$des.ops) {
81
+ const converter = new _quillDeltaToHtml.QuillDeltaToHtmlConverter(discountCodeInfo.description.ops, {});
82
+ return converter.convert();
83
+ }
84
+ return '';
85
+ }, [discountCodeInfo === null || discountCodeInfo === void 0 || (_discountCodeInfo$des2 = discountCodeInfo.description) === null || _discountCodeInfo$des2 === void 0 ? void 0 : _discountCodeInfo$des2.ops]);
79
86
 
80
87
  /**
81
88
  * @description Memoized and parsed discount image from Hyper
@@ -102,9 +109,11 @@ const ProductDiscountCard = () => {
102
109
  className: (0, _helpers__.withStyle)('row')
103
110
  }, /*#__PURE__*/_react.default.createElement("div", {
104
111
  className: (0, _helpers__.withStyle)('col-12')
105
- }, /*#__PURE__*/_react.default.createElement("ul", null, ((_discountCodeInfo$des = discountCodeInfo === null || discountCodeInfo === void 0 || (_discountCodeInfo$des2 = discountCodeInfo.description) === null || _discountCodeInfo$des2 === void 0 || (_discountCodeInfo$des2 = _discountCodeInfo$des2.ops) === null || _discountCodeInfo$des2 === void 0 || (_discountCodeInfo$des2 = _discountCodeInfo$des2[0]) === null || _discountCodeInfo$des2 === void 0 ? void 0 : _discountCodeInfo$des2.insert) !== null && _discountCodeInfo$des !== void 0 ? _discountCodeInfo$des : '').split('\n').map(line => /*#__PURE__*/_react.default.createElement("li", {
106
- key: line
107
- }, line))), /*#__PURE__*/_react.default.createElement(_ANWBMembershipInput.default, null)), /*#__PURE__*/_react.default.createElement("div", {
112
+ }, discountDescriptionHtml && /*#__PURE__*/_react.default.createElement("div", {
113
+ dangerouslySetInnerHTML: {
114
+ __html: discountDescriptionHtml
115
+ }
116
+ }), /*#__PURE__*/_react.default.createElement(_ANWBMembershipInput.default, null)), /*#__PURE__*/_react.default.createElement("div", {
108
117
  className: (0, _helpers__.withStyle)('col-12 col-md-6')
109
118
  }, /*#__PURE__*/_react.default.createElement("p", {
110
119
  className: (0, _helpers__.withStyle)('fw-bold mb-2')
@@ -104,7 +104,8 @@ const QuestionsForm = _ref => {
104
104
  onSubmit = () => {},
105
105
  isFilter = false,
106
106
  initialLicensePlate = null,
107
- initialModel = null
107
+ initialModel = null,
108
+ initialBuildYear = null
108
109
  } = _ref;
109
110
  const [filterAnswers, setFilterAnswers] = (0, _react.useState)({
110
111
  executionAnswer1: '',
@@ -123,6 +124,7 @@ const QuestionsForm = _ref => {
123
124
  model,
124
125
  durationAnswer,
125
126
  executionAnswer1,
127
+ buildYear,
126
128
  executionAnswer2,
127
129
  discountCode,
128
130
  execution1Options,
@@ -158,12 +160,14 @@ const QuestionsForm = _ref => {
158
160
  licensePlate: initialLicensePlate !== null && initialLicensePlate !== void 0 ? initialLicensePlate : licensePlate,
159
161
  model: initialModel !== null && initialModel !== void 0 ? initialModel : model,
160
162
  formula,
163
+ buildYear: initialBuildYear !== null && initialBuildYear !== void 0 ? initialBuildYear : buildYear,
161
164
  discountCode,
162
165
  executionAnswer1,
163
166
  executionAnswer2,
164
167
  durationAnswer: durationAnswer
165
168
  };
166
169
  };
170
+ const questionsObject = (0, _queries.useQuestionsQuery)(createQueryParams());
167
171
  const {
168
172
  isLoadingQuestions,
169
173
  execution1AnswerOptions,
@@ -171,7 +175,7 @@ const QuestionsForm = _ref => {
171
175
  durationAnswer: durationAnswerPrefilled,
172
176
  questionsError,
173
177
  durationQuestion
174
- } = (0, _queries.useQuestionsQuery)(createQueryParams());
178
+ } = questionsObject;
175
179
 
176
180
  // Store initial options when they first arrive
177
181
  (0, _react.useEffect)(() => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "thm-p3-configurator",
3
- "version": "0.0.183",
3
+ "version": "0.0.185",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "author": "EnoRm.",
@@ -39,6 +39,7 @@
39
39
  "moment": "^2.29.1",
40
40
  "node-gyp": "^10.0.1",
41
41
  "path": "^0.12.7",
42
+ "quill-delta-to-html": "^0.12.1",
42
43
  "react": "^17.0.2",
43
44
  "react-datepicker": "^4.2.0",
44
45
  "react-dom": "^17.0.2",