@configuratorware/configurator-frontendgui 1.30.3 → 1.31.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 (28) hide show
  1. package/App/Reducers/Configurator/Actions.js +20 -81
  2. package/App/Screens/Configurator/ThemeProvider.js +1 -1
  3. package/App/{Screens/Configurator/Containers/DesignApproval.js → Shared/Components/AcceptPrivacy/index.js} +78 -71
  4. package/App/Shared/Components/AddToBasket/index.js +1 -1
  5. package/App/Shared/Components/AmountPrice/index.js +83 -49
  6. package/App/Shared/Components/PriceOverview/index.js +5 -3
  7. package/App/Shared/Components/ReceiveOfferForm/index.js +9 -10
  8. package/App/configuration.js +1 -1
  9. package/package.json +4 -4
  10. package/public/translations/de_DE.json +4 -1
  11. package/public/translations/en_GB.json +4 -1
  12. package/src/App/Reducers/Configurator/Actions.js +6 -37
  13. package/src/App/Screens/Configurator/ThemeProvider.js +2 -2
  14. package/src/App/Shared/Components/AcceptPrivacy/index.js +78 -0
  15. package/src/App/Shared/Components/AddToBasket/index.js +1 -1
  16. package/src/App/Shared/Components/AmountPrice/index.js +48 -3
  17. package/src/App/Shared/Components/PriceOverview/index.js +3 -0
  18. package/src/App/Shared/Components/ReceiveOfferForm/__snapshots__/index.test.jsx.snap +64 -64
  19. package/src/App/Shared/Components/ReceiveOfferForm/index.js +9 -10
  20. package/src/App/configuration.js +1 -1
  21. package/App/Screens/Configurator/Components/DesignApproval/index.js +0 -76
  22. package/App/Screens/Configurator/Components/DesignApproval/index.story.js +0 -27
  23. package/App/Screens/Configurator/Components/DesignApproval/index.test.js +0 -31
  24. package/src/App/Screens/Configurator/Components/DesignApproval/__snapshots__/index.test.jsx.snap +0 -91
  25. package/src/App/Screens/Configurator/Components/DesignApproval/index.js +0 -54
  26. package/src/App/Screens/Configurator/Components/DesignApproval/index.story.js +0 -12
  27. package/src/App/Screens/Configurator/Components/DesignApproval/index.test.jsx +0 -17
  28. package/src/App/Screens/Configurator/Containers/DesignApproval.js +0 -76
@@ -1,91 +0,0 @@
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
- `;
@@ -1,54 +0,0 @@
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);
@@ -1,12 +0,0 @@
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
- ));
@@ -1,17 +0,0 @@
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
- });
@@ -1,76 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import { getClientTexts } from 'App/Reducers/Configurator/Selectors';
4
- import DesignApproval from '../Components/DesignApproval';
5
- import { containerConnect } from 'Framework/ComponentContainer';
6
-
7
- class DesignApprovalContainer extends React.Component {
8
- static propTypes = {
9
- termsAndConditionsLink: PropTypes.string,
10
- DesignApprovalComponent: PropTypes.func,
11
- };
12
-
13
- static defaultProps = {
14
- DesignApprovalComponent: DesignApproval,
15
- };
16
-
17
- constructor(props) {
18
- super(props);
19
-
20
- this.state = {
21
- approval: {
22
- checked: false,
23
- error: false,
24
- },
25
- };
26
- }
27
-
28
- handleApprovalChange = checked => {
29
- this.setState({
30
- approval: {
31
- checked,
32
- error: false,
33
- },
34
- });
35
- };
36
-
37
- validate() {
38
- const {
39
- approval: { checked },
40
- } = this.state;
41
-
42
- if (checked) {
43
- return true;
44
- }
45
-
46
- this.setState({
47
- approval: {
48
- checked,
49
- error: true,
50
- },
51
- });
52
-
53
- return false;
54
- }
55
-
56
- render() {
57
- const { approval } = this.state;
58
- const { termsAndConditionsLink, DesignApprovalComponent } = this.props;
59
-
60
- return (
61
- <DesignApprovalComponent
62
- checked={approval.checked}
63
- error={approval.error}
64
- link={termsAndConditionsLink}
65
- onChange={this.handleApprovalChange}
66
- />
67
- );
68
- }
69
- }
70
-
71
- const mapStateToProps = ({ configurator }) => ({
72
- Component: DesignApprovalContainer,
73
- termsAndConditionsLink: getClientTexts(configurator).termsAndConditionsLink,
74
- });
75
-
76
- export default containerConnect(mapStateToProps);