@configuratorware/configurator-frontendgui 1.31.0 → 1.31.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.
Files changed (28) hide show
  1. package/App/Reducers/Configurator/Actions.js +81 -20
  2. package/App/Screens/Configurator/Components/DesignApproval/index.js +76 -0
  3. package/App/Screens/Configurator/Components/DesignApproval/index.story.js +27 -0
  4. package/App/Screens/Configurator/Components/DesignApproval/index.test.js +31 -0
  5. package/App/{Shared/Components/AcceptPrivacy/index.js → Screens/Configurator/Containers/DesignApproval.js} +71 -78
  6. package/App/Screens/Configurator/ThemeProvider.js +1 -1
  7. package/App/Shared/Components/AddToBasket/index.js +1 -1
  8. package/App/Shared/Components/AmountPrice/index.js +49 -83
  9. package/App/Shared/Components/PriceOverview/index.js +3 -5
  10. package/App/Shared/Components/ReceiveOfferForm/index.js +10 -9
  11. package/App/configuration.js +1 -1
  12. package/package.json +4 -4
  13. package/public/translations/de_DE.json +1 -4
  14. package/public/translations/en_GB.json +1 -4
  15. package/src/App/Reducers/Configurator/Actions.js +37 -6
  16. package/src/App/Screens/Configurator/Components/DesignApproval/__snapshots__/index.test.jsx.snap +91 -0
  17. package/src/App/Screens/Configurator/Components/DesignApproval/index.js +54 -0
  18. package/src/App/Screens/Configurator/Components/DesignApproval/index.story.js +12 -0
  19. package/src/App/Screens/Configurator/Components/DesignApproval/index.test.jsx +17 -0
  20. package/src/App/Screens/Configurator/Containers/DesignApproval.js +76 -0
  21. package/src/App/Screens/Configurator/ThemeProvider.js +2 -2
  22. package/src/App/Shared/Components/AddToBasket/index.js +1 -1
  23. package/src/App/Shared/Components/AmountPrice/index.js +3 -48
  24. package/src/App/Shared/Components/PriceOverview/index.js +0 -3
  25. package/src/App/Shared/Components/ReceiveOfferForm/__snapshots__/index.test.jsx.snap +64 -64
  26. package/src/App/Shared/Components/ReceiveOfferForm/index.js +10 -9
  27. package/src/App/configuration.js +1 -1
  28. package/src/App/Shared/Components/AcceptPrivacy/index.js +0 -78
@@ -71,8 +71,6 @@ var _LoadingOverlay = _interopRequireDefault(require("../../../../Framework/Comp
71
71
 
72
72
  var _core = require("@material-ui/core");
73
73
 
74
- var _AcceptPrivacy = _interopRequireDefault(require("../AcceptPrivacy"));
75
-
76
74
  var _excluded = ["onTouchMove"],
77
75
  _excluded2 = ["wrapperClass", "renderPriceBox"];
78
76
 
@@ -348,8 +346,7 @@ var AmountPrice = /*#__PURE__*/function (_React$Component) {
348
346
  error: null
349
347
  },
350
348
  inView: true,
351
- showErrors: false,
352
- dataPrivacyAccepted: false
349
+ showErrors: false
353
350
  });
354
351
 
355
352
  _defineProperty(_assertThisInitialized(_this), "receiveOfferFormComponentRef", /*#__PURE__*/_react["default"].createRef());
@@ -391,15 +388,6 @@ var AmountPrice = /*#__PURE__*/function (_React$Component) {
391
388
  }
392
389
  });
393
390
  }
394
-
395
- if (!_this.dataPrivacyApproved()) {
396
- _this.setState({
397
- dataPrivacyAccepted: {
398
- value: false,
399
- error: true
400
- }
401
- });
402
- }
403
391
  });
404
392
 
405
393
  _defineProperty(_assertThisInitialized(_this), "requestHasErrors", function () {
@@ -408,7 +396,7 @@ var AmountPrice = /*#__PURE__*/function (_React$Component) {
408
396
  displayAcceptDesign = _this$props2.displayAcceptDesign;
409
397
  var designApproved = _this.state.approval.value;
410
398
 
411
- if (bulkNameErrors && bulkNameErrors.length > 0 || displayAcceptDesign && !designApproved || !_this.dataPrivacyApproved()) {
399
+ if (bulkNameErrors && bulkNameErrors.length > 0 || displayAcceptDesign && !designApproved) {
412
400
  return true;
413
401
  }
414
402
 
@@ -425,15 +413,6 @@ var AmountPrice = /*#__PURE__*/function (_React$Component) {
425
413
  }
426
414
  });
427
415
 
428
- _defineProperty(_assertThisInitialized(_this), "dataPrivacyApproved", function () {
429
- var _this$props3 = _this.props,
430
- showReceiveOfferForm = _this$props3.showReceiveOfferForm,
431
- clientTexts = _this$props3.clientTexts;
432
- var dataPrivacyLink = clientTexts.dataPrivacyLink;
433
- var dataPrivacyApproved = _this.state.dataPrivacyAccepted.value;
434
- return showReceiveOfferForm && dataPrivacyApproved && dataPrivacyLink;
435
- });
436
-
437
416
  _defineProperty(_assertThisInitialized(_this), "handleTouchMove", function (evt) {
438
417
  var dialogContent = _this.dialogContentRef.current;
439
418
  evt.preventDefault();
@@ -575,18 +554,18 @@ var AmountPrice = /*#__PURE__*/function (_React$Component) {
575
554
  });
576
555
 
577
556
  _defineProperty(_assertThisInitialized(_this), "renderDefaultPriceBox", function () {
578
- var _this$props4 = _this.props,
579
- classes = _this$props4.classes,
580
- amount = _this$props4.amount,
581
- boxed = _this$props4.boxed,
582
- priceFormatted = _this$props4.priceFormatted,
583
- hidePrices = _this$props4.hidePrices,
584
- hidePieces = _this$props4.hidePieces,
585
- vatNotice = _this$props4.vatNotice,
586
- showReceiveOfferForm = _this$props4.showReceiveOfferForm,
587
- showCallToAction = _this$props4.showCallToAction,
588
- showConfigurationModeSwitch = _this$props4.showConfigurationModeSwitch,
589
- ConfigurationModeSwitchComponent = _this$props4.ConfigurationModeSwitchComponent;
557
+ var _this$props3 = _this.props,
558
+ classes = _this$props3.classes,
559
+ amount = _this$props3.amount,
560
+ boxed = _this$props3.boxed,
561
+ priceFormatted = _this$props3.priceFormatted,
562
+ hidePrices = _this$props3.hidePrices,
563
+ hidePieces = _this$props3.hidePieces,
564
+ vatNotice = _this$props3.vatNotice,
565
+ showReceiveOfferForm = _this$props3.showReceiveOfferForm,
566
+ showCallToAction = _this$props3.showCallToAction,
567
+ showConfigurationModeSwitch = _this$props3.showConfigurationModeSwitch,
568
+ ConfigurationModeSwitchComponent = _this$props3.ConfigurationModeSwitchComponent;
590
569
  var boxStyle = boxed ? classes.card : classes.cardUnboxed;
591
570
  return /*#__PURE__*/_react["default"].createElement(_Card["default"], {
592
571
  className: (0, _clsx["default"])(boxStyle, (0, _customClassName["default"])('cta-box'))
@@ -674,9 +653,9 @@ var AmountPrice = /*#__PURE__*/function (_React$Component) {
674
653
  _createClass(AmountPrice, [{
675
654
  key: "componentDidUpdate",
676
655
  value: function componentDidUpdate(prevProps, prevState) {
677
- var _this$props5 = this.props,
678
- error = _this$props5.error,
679
- bulkNameErrors = _this$props5.bulkNameErrors;
656
+ var _this$props4 = this.props,
657
+ error = _this$props4.error,
658
+ bulkNameErrors = _this$props4.bulkNameErrors;
680
659
 
681
660
  if (error && !(0, _isEqual["default"])(error, prevProps.error) && this.dialogContentRef.current) {
682
661
  this.dialogContentRef.current.scrollTo(0, 0);
@@ -716,35 +695,32 @@ var AmountPrice = /*#__PURE__*/function (_React$Component) {
716
695
  approval = _this$state.approval,
717
696
  inView = _this$state.inView,
718
697
  showErrors = _this$state.showErrors,
719
- bulkNameErrors = _this$state.bulkNameErrors,
720
- dataPrivacyAccepted = _this$state.dataPrivacyAccepted;
721
- var _this$props6 = this.props,
722
- amount = _this$props6.amount,
723
- priceList = _this$props6.priceList,
724
- priceFormatted = _this$props6.priceFormatted,
725
- onSelectableChanged = _this$props6.onSelectableChanged,
726
- showProductVariants = _this$props6.showProductVariants,
727
- ProductVariantComponent = _this$props6.ProductVariantComponent,
728
- error = _this$props6.error,
729
- width = _this$props6.width,
730
- hidePrices = _this$props6.hidePrices,
731
- title = _this$props6.title,
732
- classes = _this$props6.classes,
733
- showReceiveOfferForm = _this$props6.showReceiveOfferForm,
734
- vatNotice = _this$props6.vatNotice,
735
- clientTexts = _this$props6.clientTexts,
736
- displayAcceptDesign = _this$props6.displayAcceptDesign,
737
- notifications = _this$props6.notifications,
738
- showCallToAction = _this$props6.showCallToAction,
739
- ReceiveOfferFormComponent = _this$props6.ReceiveOfferFormComponent,
740
- AcceptDesignComponent = _this$props6.AcceptDesignComponent,
741
- PriceOverviewComponent = _this$props6.PriceOverviewComponent,
742
- NotificationComponent = _this$props6.NotificationComponent,
743
- PriceListComponent = _this$props6.PriceListComponent,
744
- AddToCartComponent = _this$props6.AddToCartComponent,
745
- AcceptPrivacyComponent = _this$props6.AcceptPrivacyComponent;
746
- var termsAndConditionsLink = clientTexts.termsAndConditionsLink,
747
- dataPrivacyLink = clientTexts.dataPrivacyLink;
698
+ bulkNameErrors = _this$state.bulkNameErrors;
699
+ var _this$props5 = this.props,
700
+ amount = _this$props5.amount,
701
+ priceList = _this$props5.priceList,
702
+ priceFormatted = _this$props5.priceFormatted,
703
+ onSelectableChanged = _this$props5.onSelectableChanged,
704
+ showProductVariants = _this$props5.showProductVariants,
705
+ ProductVariantComponent = _this$props5.ProductVariantComponent,
706
+ error = _this$props5.error,
707
+ width = _this$props5.width,
708
+ hidePrices = _this$props5.hidePrices,
709
+ title = _this$props5.title,
710
+ classes = _this$props5.classes,
711
+ showReceiveOfferForm = _this$props5.showReceiveOfferForm,
712
+ vatNotice = _this$props5.vatNotice,
713
+ clientTexts = _this$props5.clientTexts,
714
+ displayAcceptDesign = _this$props5.displayAcceptDesign,
715
+ notifications = _this$props5.notifications,
716
+ showCallToAction = _this$props5.showCallToAction,
717
+ ReceiveOfferFormComponent = _this$props5.ReceiveOfferFormComponent,
718
+ AcceptDesignComponent = _this$props5.AcceptDesignComponent,
719
+ PriceOverviewComponent = _this$props5.PriceOverviewComponent,
720
+ NotificationComponent = _this$props5.NotificationComponent,
721
+ PriceListComponent = _this$props5.PriceListComponent,
722
+ AddToCartComponent = _this$props5.AddToCartComponent;
723
+ var termsAndConditionsLink = clientTexts.termsAndConditionsLink;
748
724
  var mergedNotifications = _toConsumableArray(notifications) || [];
749
725
 
750
726
  if (showErrors && bulkNameErrors && bulkNameErrors.length > 0) {
@@ -809,14 +785,6 @@ var AmountPrice = /*#__PURE__*/function (_React$Component) {
809
785
  noteLabel: (0, _i18n.t)('amountPrice.notice'),
810
786
  handleChange: this.handleBasketNoticeChange
811
787
  }) : null,
812
- acceptDataPrivacyComponent: showReceiveOfferForm && dataPrivacyLink ? /*#__PURE__*/_react["default"].createElement(AcceptPrivacyComponent, {
813
- dataPrivacyLink: dataPrivacyLink,
814
- displayAcceptDesign: true,
815
- handleChangeCheckboxApproval: this.handleChange,
816
- approval: dataPrivacyAccepted,
817
- closeProductOverviewDialog: this.handleClose,
818
- displayNote: false
819
- }) : null,
820
788
  notificationComponent: mergedNotifications.map(function (_ref4, key) {
821
789
  var message = _ref4.message,
822
790
  level = _ref4.level,
@@ -871,10 +839,10 @@ var AmountPrice = /*#__PURE__*/function (_React$Component) {
871
839
  }, {
872
840
  key: "render",
873
841
  value: function render() {
874
- var _this$props7 = this.props,
875
- wrapperClass = _this$props7.wrapperClass,
876
- renderPriceBox = _this$props7.renderPriceBox,
877
- props = _objectWithoutProperties(_this$props7, _excluded2);
842
+ var _this$props6 = this.props,
843
+ wrapperClass = _this$props6.wrapperClass,
844
+ renderPriceBox = _this$props6.renderPriceBox,
845
+ props = _objectWithoutProperties(_this$props6, _excluded2);
878
846
 
879
847
  var showPriceOverview = this.state.showPriceOverview;
880
848
  var openPriceOverview = this.openPriceOverview,
@@ -931,8 +899,7 @@ _defineProperty(AmountPrice, "propTypes", {
931
899
  PriceListComponent: _propTypes["default"].elementType,
932
900
  AddToCartComponent: _propTypes["default"].elementType,
933
901
  renderPriceBox: _propTypes["default"].func,
934
- userComment: _propTypes["default"].string,
935
- AcceptPrivacyComponent: _propTypes["default"].elementType
902
+ userComment: _propTypes["default"].string
936
903
  });
937
904
 
938
905
  _defineProperty(AmountPrice, "defaultProps", {
@@ -948,8 +915,7 @@ _defineProperty(AmountPrice, "defaultProps", {
948
915
  PriceOverviewComponent: _PriceOverview["default"],
949
916
  NotificationComponent: _Notification["default"],
950
917
  PriceListComponent: _PriceList["default"],
951
- AddToCartComponent: _AddToBasket["default"],
952
- AcceptPrivacyComponent: _AcceptPrivacy["default"]
918
+ AddToCartComponent: _AddToBasket["default"]
953
919
  });
954
920
 
955
921
  var _default = (0, _withWidth["default"])()((0, _styles.withStyles)(styles, {
@@ -97,8 +97,7 @@ var PriceOverview = /*#__PURE__*/function (_React$Component) {
97
97
  receiveOfferFormComponent = _this$props.receiveOfferFormComponent,
98
98
  showReceiveOfferForm = _this$props.showReceiveOfferForm,
99
99
  amount = _this$props.amount,
100
- acceptDesignComponent = _this$props.acceptDesignComponent,
101
- acceptDataPrivacyComponent = _this$props.acceptDataPrivacyComponent;
100
+ acceptDesignComponent = _this$props.acceptDesignComponent;
102
101
  return /*#__PURE__*/_react["default"].createElement(_Grid["default"], {
103
102
  item: true,
104
103
  xs: 12,
@@ -125,7 +124,7 @@ var PriceOverview = /*#__PURE__*/function (_React$Component) {
125
124
  }, /*#__PURE__*/_react["default"].createElement("b", null, contactData)), receiveOfferFormComponent), /*#__PURE__*/_react["default"].createElement(_Grid["default"], {
126
125
  item: true,
127
126
  xs: 12
128
- }, acceptDesignComponent, acceptDataPrivacyComponent, amount > 0 && /*#__PURE__*/_react["default"].createElement(_Divider["default"], null), priceListComponent), /*#__PURE__*/_react["default"].createElement(_Grid["default"], {
127
+ }, acceptDesignComponent, amount > 0 && /*#__PURE__*/_react["default"].createElement(_Divider["default"], null), priceListComponent), /*#__PURE__*/_react["default"].createElement(_Grid["default"], {
129
128
  item: true,
130
129
  xs: 12
131
130
  }, addToCartComponent && /*#__PURE__*/_react["default"].createElement(_Divider["default"], null), addToCartComponent)), !showReceiveOfferForm && /*#__PURE__*/_react["default"].createElement(_Grid["default"], {
@@ -168,8 +167,7 @@ _defineProperty(PriceOverview, "propTypes", {
168
167
  receiveOfferFormComponent: _propTypes["default"].element,
169
168
  showReceiveOfferForm: _propTypes["default"].bool,
170
169
  amount: _propTypes["default"].number,
171
- acceptDesignComponent: _propTypes["default"].element,
172
- acceptDataPrivacyComponent: _propTypes["default"].element
170
+ acceptDesignComponent: _propTypes["default"].element
173
171
  });
174
172
 
175
173
  var _default = (0, _styles.withStyles)(styles, {
@@ -58,7 +58,7 @@ var styles = function styles(theme) {
58
58
  marginTop: 0
59
59
  },
60
60
  outlinedInput: _defineProperty({
61
- padding: 10,
61
+ padding: 14,
62
62
  fontSize: 15
63
63
  }, theme.breakpoints.down('xs'), {
64
64
  padding: 19
@@ -143,6 +143,7 @@ var ReceiveOfferForm = /*#__PURE__*/function (_React$Component) {
143
143
  _this.handleChange = _this.handleChange.bind(_assertThisInitialized(_this));
144
144
  _this.handleBlur = _this.handleBlur.bind(_assertThisInitialized(_this));
145
145
  _this.setInputRef = _this.setInputRef.bind(_assertThisInitialized(_this));
146
+ _this.designApprovalRef = /*#__PURE__*/_react["default"].createRef();
146
147
  return _this;
147
148
  }
148
149
 
@@ -230,7 +231,7 @@ var ReceiveOfferForm = /*#__PURE__*/function (_React$Component) {
230
231
  onChange: this.handleChange,
231
232
  onBlur: this.handleBlur,
232
233
  label: (0, _i18n.t)('receiveOfferForm.email'),
233
- margin: "dense",
234
+ margin: "normal",
234
235
  variant: "outlined",
235
236
  fullWidth: true,
236
237
  error: !!email.error,
@@ -255,7 +256,7 @@ var ReceiveOfferForm = /*#__PURE__*/function (_React$Component) {
255
256
  onChange: this.handleChange,
256
257
  onBlur: this.handleBlur,
257
258
  label: (0, _i18n.t)('receiveOfferForm.name'),
258
- margin: "dense",
259
+ margin: "normal",
259
260
  variant: "outlined",
260
261
  fullWidth: true,
261
262
  error: !!name.error,
@@ -277,7 +278,7 @@ var ReceiveOfferForm = /*#__PURE__*/function (_React$Component) {
277
278
  onChange: this.handleChange,
278
279
  onBlur: this.handleBlur,
279
280
  label: (0, _i18n.t)('receiveOfferForm.company'),
280
- margin: "dense",
281
+ margin: "normal",
281
282
  variant: "outlined",
282
283
  fullWidth: true,
283
284
  error: !!company.error,
@@ -299,7 +300,7 @@ var ReceiveOfferForm = /*#__PURE__*/function (_React$Component) {
299
300
  onChange: this.handleChange,
300
301
  onBlur: this.handleBlur,
301
302
  label: (0, _i18n.t)('receiveOfferForm.phonenumber'),
302
- margin: "dense",
303
+ margin: "normal",
303
304
  variant: "outlined",
304
305
  fullWidth: true,
305
306
  error: !!phonenumber.error,
@@ -328,7 +329,7 @@ var ReceiveOfferForm = /*#__PURE__*/function (_React$Component) {
328
329
  onChange: this.handleChange,
329
330
  onBlur: this.handleBlur,
330
331
  label: (0, _i18n.t)('receiveOfferForm.zip'),
331
- margin: "dense",
332
+ margin: "normal",
332
333
  variant: "outlined",
333
334
  fullWidth: true,
334
335
  error: !!zip.error,
@@ -354,7 +355,7 @@ var ReceiveOfferForm = /*#__PURE__*/function (_React$Component) {
354
355
  onChange: this.handleChange,
355
356
  onBlur: this.handleBlur,
356
357
  label: (0, _i18n.t)('receiveOfferForm.city'),
357
- margin: "dense",
358
+ margin: "normal",
358
359
  variant: "outlined",
359
360
  fullWidth: true,
360
361
  error: !!city.error,
@@ -376,7 +377,7 @@ var ReceiveOfferForm = /*#__PURE__*/function (_React$Component) {
376
377
  onChange: this.handleChange,
377
378
  onBlur: this.handleBlur,
378
379
  label: (0, _i18n.t)('receiveOfferForm.street'),
379
- margin: "dense",
380
+ margin: "normal",
380
381
  variant: "outlined",
381
382
  fullWidth: true,
382
383
  error: !!street.error,
@@ -398,7 +399,7 @@ var ReceiveOfferForm = /*#__PURE__*/function (_React$Component) {
398
399
  onChange: this.handleChange,
399
400
  onBlur: this.handleBlur,
400
401
  label: (0, _i18n.t)('receiveOfferForm.country'),
401
- margin: "dense",
402
+ margin: "normal",
402
403
  variant: "outlined",
403
404
  fullWidth: true,
404
405
  error: !!country.error,
@@ -31,7 +31,7 @@ var DEVELOPMENT_HOST_INT = 'http://int.configuratorware.local'; // eslint-disabl
31
31
  var DEVELOPMENT_HOST_LOCAL = 'http://localhost:10030';
32
32
  var hostsByNodeEnv = {
33
33
  production: '',
34
- development: DEVELOPMENT_HOST_INT,
34
+ development: DEVELOPMENT_HOST_LOCAL,
35
35
  test: ''
36
36
  };
37
37
  var resourceUrlsByNodeEnv = {
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@configuratorware/configurator-frontendgui",
3
- "version": "1.31.0",
3
+ "version": "1.31.1",
4
4
  "license": "UNLICENSED",
5
5
  "private": false,
6
6
  "main": "./index.js",
7
7
  "dependencies": {
8
8
  "@babel/polyfill": "^7.12.1",
9
- "@configuratorware/scripts": "1.31.0",
9
+ "@configuratorware/scripts": "1.31.1",
10
10
  "@hot-loader/react-dom": "^17.0.1",
11
11
  "@material-ui/core": "^4.12.2",
12
12
  "@material-ui/icons": "^4.11.2",
@@ -39,8 +39,8 @@
39
39
  "react-router-dom": "^5.2.0",
40
40
  "react-swipeable": "^5.5.1",
41
41
  "react-zoom-pan-pinch": "^2.1.3",
42
- "redhotmagma-graphics-editor": "1.31.0",
43
- "redhotmagma-visualization": "1.31.0",
42
+ "redhotmagma-graphics-editor": "1.31.1",
43
+ "redhotmagma-visualization": "1.31.1",
44
44
  "redux": "^4.1.0",
45
45
  "redux-logger": "^3.0.6",
46
46
  "redux-persist": "^5.10.0",
@@ -158,10 +158,7 @@
158
158
  "checkInputsInForm": "Bitte Eingaben im Formular prüfen",
159
159
  "sentOk": "Anfrage wurde erfolgreich versandt.",
160
160
  "sentError": "Fehler beim Senden der Anfrage.",
161
- "sendButton": "Angebot anfordern",
162
- "privacyNotice": "Ich willige darin ein, dass die von mir überreichten Informationen und Kontaktdaten dazu verwendet werden, um mit mir anlässlich meiner Kontaktaufnahme in Verbindung zu treten, hierüber zu kommunizieren und meine Anfrage abzuwickeln. Dies gilt insbesondere für die Verwendung der E-Mail-Adresse zum vorgenannten Zweck. Die Einwilligung kann jederzeit mit Wirkung für die Zukunft per E-Mail widerrufen werden. Die Datenschutzerklärung kann %{privacyLink} eingesehen werden.",
163
- "privacyLinkLabel": "hier",
164
- "selectionError": "Checkbox nicht bestätigt"
161
+ "sendButton": "Angebot anfordern"
165
162
  },
166
163
  "acceptDesignScreen": {
167
164
  "selectionError": "Checkbox nicht bestätigt",
@@ -159,10 +159,7 @@
159
159
  "checkInputsInForm": "Please check the form inputs below",
160
160
  "sentOk": "Request was successfully sent.",
161
161
  "sentError": "Error sending the request.",
162
- "sendButton": "Request a quote",
163
- "privacyNotice": "I consent to the information and contact details I have provided being used to contact me, to communicate about and to process my request. This applies in particular to the use of the e-mail address for the aforementioned purpose. The consent can be revoked at any time with effect for the future by e-mail. The privacy policy can be viewed %{privacyLink}.",
164
- "privacyLinkLabel": "here",
165
- "selectionError": "No consent given"
162
+ "sendButton": "Request a quote"
166
163
  },
167
164
  "acceptDesignScreen": {
168
165
  "checkedSelectionActive": "I have checked all provided data and the design and I approve the configuration",
@@ -480,14 +480,14 @@ export const fetchOptions = (itemidentifier, optionclassification, configuration
480
480
  );
481
481
  };
482
482
 
483
- export const switchOptionsBasic = (configuration, switchedOptions, noCheck = false) => {
483
+ export const switchOptionsBasic = (configuration, switchedoptions, noCheck = false) => {
484
484
  const config = {};
485
485
  if (noCheck) {
486
486
  config.params = { nocheck: 1 };
487
487
  }
488
488
  return apiActions.postData(
489
489
  'configuration/switchoption',
490
- { configuration, switchedOptions },
490
+ { configuration, switchedoptions },
491
491
  data => ({
492
492
  // dummy receiver
493
493
  type: 'RECEIVE_SWITCHOPTIONSRESULT_BASIC',
@@ -497,6 +497,37 @@ export const switchOptionsBasic = (configuration, switchedOptions, noCheck = fal
497
497
  );
498
498
  };
499
499
 
500
+ export const switchOptionArrays = (configuration, switchOptionData, noCheck = false) => dispatch => {
501
+ const switchedoptions = {};
502
+ const afterSwitch = [];
503
+
504
+ for (const componentIdentifier in switchOptionData) {
505
+ if (isArray(switchOptionData[componentIdentifier])) {
506
+ const [firstOption, ...otherOptions] = switchOptionData[componentIdentifier];
507
+
508
+ switchedoptions[componentIdentifier] = firstOption;
509
+
510
+ if (otherOptions.length > 0) {
511
+ for (let optionData of otherOptions) {
512
+ afterSwitch.push({
513
+ [componentIdentifier]: optionData,
514
+ });
515
+ }
516
+ }
517
+ } else {
518
+ switchedoptions[componentIdentifier] = switchOptionData[componentIdentifier];
519
+ }
520
+ }
521
+
522
+ let p = dispatch(switchOptionsBasic(configuration, switchedoptions, noCheck));
523
+ for (let switchOption of afterSwitch) {
524
+ p = p.then(action => {
525
+ return dispatch(switchOptionsBasic(action.data, switchOption, noCheck));
526
+ });
527
+ }
528
+ return p;
529
+ };
530
+
500
531
  export const switchOptions = (
501
532
  configuration,
502
533
  switchOptionData,
@@ -504,7 +535,7 @@ export const switchOptions = (
504
535
  refreshOptions = false,
505
536
  setChecked = false
506
537
  ) => dispatch => {
507
- return dispatch(switchOptionsBasic(configuration, switchOptionData, noCheck)).then(action => {
538
+ return dispatch(switchOptionArrays(configuration, switchOptionData, noCheck)).then(action => {
508
539
  const extraData = { switchOptionData, noCheck, refreshOptions, setChecked };
509
540
  return dispatch(receiveSwitchoptionsresult(action.data, extraData));
510
541
  });
@@ -670,10 +701,10 @@ export const resolveConflicts = () => (dispatch, getState) => {
670
701
  if (switchOptionsData) {
671
702
  if (p) {
672
703
  p = p.then(action => {
673
- return dispatch(switchOptionsBasic(action.data, switchOptionsData, true));
704
+ return dispatch(switchOptionArrays(action.data, switchOptionsData, true));
674
705
  });
675
706
  } else {
676
- p = dispatch(switchOptionsBasic(configuration, switchOptionsData, true));
707
+ p = dispatch(switchOptionArrays(configuration, switchOptionsData, true));
677
708
  }
678
709
  }
679
710
  }
@@ -750,7 +781,7 @@ export const selectMultipleOptions = optionsList => (dispatch, getState) => {
750
781
  for (const component of optionsList) {
751
782
  switchOptionData[component.identifier] = component.selectedoptions.map(({ identifier, amount }) => ({
752
783
  identifier,
753
- amount: typeof amount === 'undefined' ? 1 : amount,
784
+ amount: amount || 1,
754
785
  check_results: null,
755
786
  }));
756
787
  }
@@ -0,0 +1,91 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`renders correctly with error 1`] = `
4
+ Array [
5
+ <label
6
+ class="MuiFormControlLabel-root"
7
+ >
8
+ <span
9
+ aria-disabled="false"
10
+ class="MuiButtonBase-root MuiIconButton-root PrivateSwitchBase-root-2 MuiCheckbox-root MuiCheckbox-colorPrimary MuiIconButton-colorPrimary"
11
+ >
12
+ <span
13
+ class="MuiIconButton-label"
14
+ >
15
+ <input
16
+ class="PrivateSwitchBase-input-5"
17
+ data-indeterminate="false"
18
+ name="approval"
19
+ type="checkbox"
20
+ />
21
+ <svg
22
+ aria-hidden="true"
23
+ class="MuiSvgIcon-root"
24
+ focusable="false"
25
+ viewBox="0 0 24 24"
26
+ >
27
+ <path
28
+ d="M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z"
29
+ />
30
+ </svg>
31
+ </span>
32
+ </span>
33
+ <span
34
+ class="MuiTypography-root MuiFormControlLabel-label MuiTypography-body1"
35
+ >
36
+ <div
37
+ class="DesignApproval-link-1"
38
+ >
39
+ receiveOfferForm.approval
40
+ </div>
41
+ </span>
42
+ </label>,
43
+ <p
44
+ class="MuiFormHelperText-root Mui-error"
45
+ >
46
+ receiveOfferForm.errors.notApproved
47
+ </p>,
48
+ ]
49
+ `;
50
+
51
+ exports[`renders correctly without error 1`] = `
52
+ <label
53
+ class="MuiFormControlLabel-root"
54
+ >
55
+ <span
56
+ aria-disabled="false"
57
+ class="MuiButtonBase-root MuiIconButton-root PrivateSwitchBase-root-2 MuiCheckbox-root MuiCheckbox-colorPrimary PrivateSwitchBase-checked-3 Mui-checked MuiIconButton-colorPrimary"
58
+ >
59
+ <span
60
+ class="MuiIconButton-label"
61
+ >
62
+ <input
63
+ checked=""
64
+ class="PrivateSwitchBase-input-5"
65
+ data-indeterminate="false"
66
+ name="approval"
67
+ type="checkbox"
68
+ />
69
+ <svg
70
+ aria-hidden="true"
71
+ class="MuiSvgIcon-root"
72
+ focusable="false"
73
+ viewBox="0 0 24 24"
74
+ >
75
+ <path
76
+ d="M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.11 0 2-.9 2-2V5c0-1.1-.89-2-2-2zm-9 14l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"
77
+ />
78
+ </svg>
79
+ </span>
80
+ </span>
81
+ <span
82
+ class="MuiTypography-root MuiFormControlLabel-label MuiTypography-body1"
83
+ >
84
+ <div
85
+ class="DesignApproval-link-1"
86
+ >
87
+ receiveOfferForm.approval
88
+ </div>
89
+ </span>
90
+ </label>
91
+ `;
@@ -0,0 +1,54 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import { withStyles } from '@material-ui/core';
4
+ import FormControlLabel from '@material-ui/core/FormControlLabel';
5
+ import Checkbox from '@material-ui/core/Checkbox';
6
+ import FormHelperText from '@material-ui/core/FormHelperText';
7
+ import { t } from 'Framework/i18n';
8
+
9
+ const styles = theme => ({
10
+ link: {
11
+ '& a': {
12
+ color: theme.palette.primary.main,
13
+ },
14
+ },
15
+ });
16
+
17
+ const DesignApproval = props => {
18
+ const handleChange = event => {
19
+ const { onChange } = props;
20
+
21
+ onChange(event.target.checked);
22
+ };
23
+
24
+ const { classes, checked, error, link } = props;
25
+
26
+ return (
27
+ <React.Fragment>
28
+ <FormControlLabel
29
+ control={
30
+ <Checkbox name="approval" checked={checked} onChange={handleChange} color="primary" />
31
+ }
32
+ label={
33
+ <div
34
+ className={classes.link}
35
+ dangerouslySetInnerHTML={{ __html: t('receiveOfferForm.approval', { link }) }}
36
+ />
37
+ }
38
+ />
39
+ {error && (
40
+ <FormHelperText error={true}>{t('receiveOfferForm.errors.notApproved')}</FormHelperText>
41
+ )}
42
+ </React.Fragment>
43
+ );
44
+ };
45
+
46
+ DesignApproval.propTypes = {
47
+ classes: PropTypes.object,
48
+ onChange: PropTypes.func,
49
+ checked: PropTypes.bool,
50
+ error: PropTypes.bool,
51
+ link: PropTypes.string,
52
+ };
53
+
54
+ export default withStyles(styles, { name: 'DesignApproval' })(DesignApproval);
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import noop from 'lodash/noop';
3
+ import { storiesOf } from '@storybook/react';
4
+ import DesignApproval from './index';
5
+
6
+ storiesOf('DesignApproval', module)
7
+ .add('without error', () => (
8
+ <DesignApproval checked={true} error={false} link={'fakeLink'} onChange={noop} />
9
+ ))
10
+ .add('with error', () => (
11
+ <DesignApproval checked={false} error={true} link={'fakeLink'} onChange={noop} />
12
+ ));
@@ -0,0 +1,17 @@
1
+ /* eslint-env jest */
2
+ import React from 'react';
3
+ import noop from 'lodash/noop';
4
+ import { render } from 'enzyme';
5
+ import DesignApproval from './index';
6
+
7
+ it('renders correctly without error', () => {
8
+ const tree = render(<DesignApproval checked={true} error={false} link={'fakeLink'} onChange={noop} />);
9
+
10
+ expect(tree).toMatchSnapshot();
11
+ });
12
+
13
+ it('renders correctly with error', () => {
14
+ const tree = render(<DesignApproval checked={false} error={true} link={'fakeLink'} onChange={noop} />);
15
+
16
+ expect(tree).toMatchSnapshot();
17
+ });