@configuratorware/configurator-frontendgui 1.36.0-beta.0 → 1.36.0

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 (24) hide show
  1. package/App/Modules/Creator/Components/Option/index.js +7 -1
  2. package/App/Modules/Creator/Components/Optiondetail/index.js +17 -14
  3. package/App/Modules/Creator/CreatorScreen.js +1 -4
  4. package/App/Modules/Designer/Components/DesignerSelectionToolbox/DesignerSelectionToolbox.js +20 -4
  5. package/App/Modules/Designer/DesignerScreen.js +1 -4
  6. package/App/Reducers/Configurator/Reducer.js +1 -1
  7. package/App/Reducers/DesignArea/Selectors.js +31 -13
  8. package/App/Shared/Components/AmountPrice/index.js +18 -6
  9. package/Framework/Components/Carousel/index.js +17 -20
  10. package/package.json +23 -16
  11. package/src/App/Modules/Creator/Components/Option/index.js +8 -1
  12. package/src/App/Modules/Creator/Components/Optiondetail/__snapshots__/index.test.js.snap +75 -69
  13. package/src/App/Modules/Creator/Components/Optiondetail/index.js +50 -45
  14. package/src/App/Modules/Creator/CreatorScreen.js +0 -2
  15. package/src/App/Modules/Designer/Components/DesignerSelectionToolbox/DesignerSelectionToolbox.js +20 -5
  16. package/src/App/Modules/Designer/DesignerScreen.js +0 -2
  17. package/src/App/Reducers/Configurator/Reducer.js +4 -1
  18. package/src/App/Reducers/DesignArea/Selectors.js +15 -0
  19. package/src/App/Reducers/DesignArea/__tests__/Selectors.test.js +5 -0
  20. package/src/App/Services/__tests__/DesignDataService.test.js +81 -0
  21. package/src/App/Shared/Components/AmountPrice/index.js +32 -21
  22. package/src/Framework/Components/Carousel/index.js +16 -17
  23. package/Shared/Components/Swipeable.js +0 -57
  24. package/src/Shared/Components/Swipeable.js +0 -10
@@ -339,6 +339,8 @@ class AmountPrice extends React.Component {
339
339
  receiveOfferFormComponentRef = React.createRef();
340
340
  dialogContentRef = React.createRef();
341
341
  priceListRef = React.createRef();
342
+ acceptDesignRef = React.createRef();
343
+ acceptDataPrivacyRef = React.createRef();
342
344
 
343
345
  handleChange = event => {
344
346
  this.setState({
@@ -349,10 +351,9 @@ class AmountPrice extends React.Component {
349
351
  });
350
352
  };
351
353
 
352
- verifyRequestErrors = () => {
354
+ verifyRequestErrors = hasFormValidationErrors => {
353
355
  const { bulkNameErrors, displayAcceptDesign } = this.props;
354
356
  const designApproved = this.state.approval.value;
355
-
356
357
  if (bulkNameErrors && bulkNameErrors.length > 0) {
357
358
  this.setState({ showErrors: true });
358
359
  this.setState({ bulkNameErrors });
@@ -365,6 +366,9 @@ class AmountPrice extends React.Component {
365
366
  error: true,
366
367
  },
367
368
  });
369
+ !hasFormValidationErrors &&
370
+ this.acceptDesignRef.current &&
371
+ this.acceptDesignRef.current.scrollIntoView();
368
372
  }
369
373
  if (!this.dataPrivacyApproved()) {
370
374
  this.setState({
@@ -373,6 +377,9 @@ class AmountPrice extends React.Component {
373
377
  error: true,
374
378
  },
375
379
  });
380
+ !hasFormValidationErrors &&
381
+ this.acceptDataPrivacyRef.current &&
382
+ this.acceptDataPrivacyRef.current.scrollIntoView();
376
383
  }
377
384
  };
378
385
 
@@ -449,7 +456,7 @@ class AmountPrice extends React.Component {
449
456
  this.setState({ hasErrorReceiveOfferForm: false });
450
457
  }
451
458
  } else {
452
- this.verifyRequestErrors();
459
+ this.verifyRequestErrors(formValidation.hasError);
453
460
  }
454
461
  };
455
462
 
@@ -574,28 +581,32 @@ class AmountPrice extends React.Component {
574
581
  amount={amount}
575
582
  acceptDesignComponent={
576
583
  showCallToAction ? (
577
- <AcceptDesignComponent
578
- termsAndConditionsLink={termsAndConditionsLink}
579
- displayAcceptDesign={displayAcceptDesign}
580
- handleChangeCheckboxApproval={this.handleChange}
581
- approval={approval}
582
- closeProductOverviewDialog={this.handleClose}
583
- notice={notice}
584
- noteLabel={t('amountPrice.notice')}
585
- handleChange={this.handleBasketNoticeChange}
586
- />
584
+ <div ref={this.acceptDesignRef}>
585
+ <AcceptDesignComponent
586
+ termsAndConditionsLink={termsAndConditionsLink}
587
+ displayAcceptDesign={displayAcceptDesign}
588
+ handleChangeCheckboxApproval={this.handleChange}
589
+ approval={approval}
590
+ closeProductOverviewDialog={this.handleClose}
591
+ notice={notice}
592
+ noteLabel={t('amountPrice.notice')}
593
+ handleChange={this.handleBasketNoticeChange}
594
+ />
595
+ </div>
587
596
  ) : null
588
597
  }
589
598
  acceptDataPrivacyComponent={
590
599
  showReceiveOfferForm && dataPrivacyLink ? (
591
- <AcceptPrivacyComponent
592
- dataPrivacyLink={dataPrivacyLink}
593
- displayAcceptDesign={true}
594
- handleChangeCheckboxApproval={this.handleChange}
595
- approval={dataPrivacyAccepted}
596
- closeProductOverviewDialog={this.handleClose}
597
- displayNote={false}
598
- />
600
+ <div ref={this.acceptDataPrivacyRef}>
601
+ <AcceptPrivacyComponent
602
+ dataPrivacyLink={dataPrivacyLink}
603
+ displayAcceptDesign={true}
604
+ handleChangeCheckboxApproval={this.handleChange}
605
+ approval={dataPrivacyAccepted}
606
+ closeProductOverviewDialog={this.handleClose}
607
+ displayNote={false}
608
+ />
609
+ </div>
599
610
  ) : null
600
611
  }
601
612
  notificationComponent={mergedNotifications.map(
@@ -1,11 +1,11 @@
1
1
  import React from 'react';
2
+ import { Swipeable } from 'react-swipeable';
2
3
  import _ from 'lodash';
3
4
 
4
5
  import './Styles.scss';
5
6
  import PropTypes from 'prop-types';
6
7
  import clsx from 'clsx';
7
8
  import { withStyles } from '@material-ui/core/styles';
8
- import { DOWN, LEFT, RIGHT, Swipeable, UP } from '../../../Shared/Components/Swipeable';
9
9
 
10
10
  const styles = theme => ({
11
11
  carousel: {
@@ -37,12 +37,10 @@ class Carousel extends React.Component {
37
37
  }
38
38
 
39
39
  componentDidMount() {
40
+ this.init();
40
41
  const { carousel } = this.refs;
41
- if (carousel) {
42
- this.init();
43
- const wheelEventName = 'onwheel' in carousel ? 'wheel' : 'mousewheel';
44
- carousel.addEventListener(wheelEventName, this.scrolled);
45
- }
42
+ const wheelEventName = 'onwheel' in carousel ? 'wheel' : 'mousewheel';
43
+ carousel.addEventListener(wheelEventName, this.scrolled);
46
44
  }
47
45
 
48
46
  componentDidUpdate() {
@@ -142,16 +140,19 @@ class Carousel extends React.Component {
142
140
  };
143
141
 
144
142
  swiped = e => {
145
- if (this.props.vertical) {
146
- if (e.dir === UP) {
143
+ // if it's vertical deltaY should be the bigger
144
+ if (this.props.vertical && Math.abs(e.deltaY) >= Math.abs(e.deltaX)) {
145
+ if (e.deltaY > 0) {
147
146
  this.next();
148
- } else if (e.dir === DOWN) {
147
+ } else {
149
148
  this.prev();
150
149
  }
151
- } else {
152
- if (e.dir === LEFT) {
150
+ }
151
+ // if it's not vertical deltaX should be the bigger
152
+ else if (!this.props.vertical && Math.abs(e.deltaX) >= Math.abs(e.deltaY)) {
153
+ if (e.deltaX > 0) {
153
154
  this.next();
154
- } else if (e.dir === RIGHT) {
155
+ } else {
155
156
  this.prev();
156
157
  }
157
158
  }
@@ -198,11 +199,9 @@ class Carousel extends React.Component {
198
199
  )}
199
200
  <Swipeable
200
201
  className={'carousel-frame'}
201
- options={{
202
- trackMouse: true,
203
- onSwiping: this.swiping,
204
- onSwiped: this.swiped,
205
- }}
202
+ trackMouse={true}
203
+ onSwiping={this.swiping}
204
+ onSwiped={this.swiped}
206
205
  >
207
206
  <div
208
207
  className="carousel-slider"
@@ -1,57 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "UP", {
7
- enumerable: true,
8
- get: function get() {
9
- return _reactSwipeable.UP;
10
- }
11
- });
12
- Object.defineProperty(exports, "DOWN", {
13
- enumerable: true,
14
- get: function get() {
15
- return _reactSwipeable.DOWN;
16
- }
17
- });
18
- Object.defineProperty(exports, "LEFT", {
19
- enumerable: true,
20
- get: function get() {
21
- return _reactSwipeable.LEFT;
22
- }
23
- });
24
- Object.defineProperty(exports, "RIGHT", {
25
- enumerable: true,
26
- get: function get() {
27
- return _reactSwipeable.RIGHT;
28
- }
29
- });
30
- exports.Swipeable = void 0;
31
-
32
- var _react = _interopRequireDefault(require("react"));
33
-
34
- var _reactSwipeable = require("react-swipeable");
35
-
36
- var _excluded = ["options"];
37
-
38
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
39
-
40
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
41
-
42
- function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
43
-
44
- function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
45
-
46
- // eslint-disable-next-line react/prop-types,react/display-name
47
- var Swipeable = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
48
- var options = _ref.options,
49
- props = _objectWithoutProperties(_ref, _excluded);
50
-
51
- var handlers = (0, _reactSwipeable.useSwipeable)(options);
52
- return /*#__PURE__*/_react["default"].createElement("div", _extends({}, handlers, props, {
53
- ref: ref
54
- }));
55
- });
56
-
57
- exports.Swipeable = Swipeable;
@@ -1,10 +0,0 @@
1
- import React from 'react';
2
- import { useSwipeable, UP, DOWN, LEFT, RIGHT } from 'react-swipeable';
3
-
4
- export { UP, DOWN, LEFT, RIGHT };
5
-
6
- // eslint-disable-next-line react/prop-types,react/display-name
7
- export const Swipeable = React.forwardRef(({ options, ...props }, ref) => {
8
- const handlers = useSwipeable(options);
9
- return <div {...handlers} {...props} ref={ref} />;
10
- });