@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.
- package/App/Reducers/Configurator/Actions.js +81 -20
- package/App/Screens/Configurator/Components/DesignApproval/index.js +76 -0
- package/App/Screens/Configurator/Components/DesignApproval/index.story.js +27 -0
- package/App/Screens/Configurator/Components/DesignApproval/index.test.js +31 -0
- package/App/{Shared/Components/AcceptPrivacy/index.js → Screens/Configurator/Containers/DesignApproval.js} +71 -78
- package/App/Screens/Configurator/ThemeProvider.js +1 -1
- package/App/Shared/Components/AddToBasket/index.js +1 -1
- package/App/Shared/Components/AmountPrice/index.js +49 -83
- package/App/Shared/Components/PriceOverview/index.js +3 -5
- package/App/Shared/Components/ReceiveOfferForm/index.js +10 -9
- package/App/configuration.js +1 -1
- package/package.json +4 -4
- package/public/translations/de_DE.json +1 -4
- package/public/translations/en_GB.json +1 -4
- package/src/App/Reducers/Configurator/Actions.js +37 -6
- package/src/App/Screens/Configurator/Components/DesignApproval/__snapshots__/index.test.jsx.snap +91 -0
- package/src/App/Screens/Configurator/Components/DesignApproval/index.js +54 -0
- package/src/App/Screens/Configurator/Components/DesignApproval/index.story.js +12 -0
- package/src/App/Screens/Configurator/Components/DesignApproval/index.test.jsx +17 -0
- package/src/App/Screens/Configurator/Containers/DesignApproval.js +76 -0
- package/src/App/Screens/Configurator/ThemeProvider.js +2 -2
- package/src/App/Shared/Components/AddToBasket/index.js +1 -1
- package/src/App/Shared/Components/AmountPrice/index.js +3 -48
- package/src/App/Shared/Components/PriceOverview/index.js +0 -3
- package/src/App/Shared/Components/ReceiveOfferForm/__snapshots__/index.test.jsx.snap +64 -64
- package/src/App/Shared/Components/ReceiveOfferForm/index.js +10 -9
- package/src/App/configuration.js +1 -1
- package/src/App/Shared/Components/AcceptPrivacy/index.js +0 -78
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.setSelectedCalculation = exports.switchSelectedAmount = exports.setComment = exports.deleteSelectedAmounts = exports.setSelectedAmounts = exports.deleteSelectedAmount = exports.clearBulkNames = exports.saveBulkNames = exports.setSelectedAmount = exports.loadDesignerData = exports.receiveDesignerData = exports.loadConfiguration = exports.viewOptionDetails = exports.selectMultipleOptions = exports.selectOption = exports.resolveConflicts = exports.loadInitialOptionclassification = exports.fetchInitialConfiguration = exports.setConflictingSwitchoptionData = exports.setOptionclassificationChecked = exports.setCalculationEnabled = exports.setSelectedVariantIdentifier = exports.setStockInformationOption = exports.setLoadIdentifier = exports.setLoadCode = exports.fetchInspirations = exports.fetchClientData = exports.fetchCodesnippets = exports.fetchConfigurationVariants = exports.validateConfiguration = exports.saveConfiguration = exports.fetchOptionDetails = exports.doCalculation = exports.switchOptions = exports.switchOptionsBasic = exports.fetchOptions = exports.fetchConfigurationByCodeAsync = exports.fetchConfigurationByCode = exports.fetchConfiguration = exports.inspectValidationResults = exports.inspectCheckResults = exports.setCustomTitle = exports.receiveInspirations = exports.receiveClientData = exports.fetchConfigurationForDesignerProductPreview = exports.receiveCodesnippets = exports.receiveConfigurationVariants = exports.receiveValidation = exports.receiveSavedConfiguration = exports.clearOptionDetails = exports.receiveOptionDetails = exports.skipNextAutoResolve = exports.setCalculationAutoResolveEnabled = exports.setCalculationErrorsResolved = exports.invalidateCalculation = exports.receiveCalculation = exports.receiveSwitchoptionsresult = exports.receiveOptions = exports.selectOptionclassification = exports.applyVariantAmountPreSelection = exports.setDefaultSelectedVariantIdentifier = exports.deleteMissingVariants = exports.receiveConfiguration = exports.DELETE_SELECTED_AMOUNTS = exports.SET_SELECTED_AMOUNTS = exports.SET_COMMENT = exports.SET_SELECTED_CALCULATION = exports.DELETE_SELECTED_AMOUNT = exports.CLEAR_BULKNAMES = exports.SAVE_BULKNAMES = exports.SWITCH_SELECTED_AMOUNT = exports.SET_SELECTED_AMOUNT = exports.SET_CONFLICTING_SWITCHOPTION_DATA = exports.SET_OPTIONCLASSIFICATION_CHECKED = exports.SET_CALCULATION_AUTO_RESOLVE_ENABLED = exports.SET_CALCULATION_ERRORS_RESOLVED = exports.SET_CALCULATION_ENABLED = exports.SET_SELECTED_VARIANT_IDENTIFIER = exports.SET_STOCK_INFORMATION_OPTION = exports.SET_LOAD_IDENTIFIER = exports.SET_LOAD_CODE = exports.SET_CUSTOM_TITLE = exports.RECEIVE_INSPIRATIONS = exports.RECEIVE_CLIENT_DATA = exports.RECEIVE_CODESNIPPETS = exports.RECEIVE_CONFIGURATIONVARIANTS = exports.RECEIVE_VALIDATION = exports.RECEIVE_SAVEDCONFIGURATION = exports.RECEIVE_OPTIONDETAILS = exports.INVALIDATE_CALCULATION = exports.RECEIVE_CALCULATION = exports.RECEIVE_SWITCHOPTIONSRESULT = exports.RECEIVE_OPTIONS = exports.SELECT_OPTIONCLASSIFICATION = exports.RECEIVE_DESIGNER_DATA = exports.RECEIVE_CONFIGURATION = void 0;
|
|
6
|
+
exports.setSelectedCalculation = exports.switchSelectedAmount = exports.setComment = exports.deleteSelectedAmounts = exports.setSelectedAmounts = exports.deleteSelectedAmount = exports.clearBulkNames = exports.saveBulkNames = exports.setSelectedAmount = exports.loadDesignerData = exports.receiveDesignerData = exports.loadConfiguration = exports.viewOptionDetails = exports.selectMultipleOptions = exports.selectOption = exports.resolveConflicts = exports.loadInitialOptionclassification = exports.fetchInitialConfiguration = exports.setConflictingSwitchoptionData = exports.setOptionclassificationChecked = exports.setCalculationEnabled = exports.setSelectedVariantIdentifier = exports.setStockInformationOption = exports.setLoadIdentifier = exports.setLoadCode = exports.fetchInspirations = exports.fetchClientData = exports.fetchCodesnippets = exports.fetchConfigurationVariants = exports.validateConfiguration = exports.saveConfiguration = exports.fetchOptionDetails = exports.doCalculation = exports.switchOptions = exports.switchOptionArrays = exports.switchOptionsBasic = exports.fetchOptions = exports.fetchConfigurationByCodeAsync = exports.fetchConfigurationByCode = exports.fetchConfiguration = exports.inspectValidationResults = exports.inspectCheckResults = exports.setCustomTitle = exports.receiveInspirations = exports.receiveClientData = exports.fetchConfigurationForDesignerProductPreview = exports.receiveCodesnippets = exports.receiveConfigurationVariants = exports.receiveValidation = exports.receiveSavedConfiguration = exports.clearOptionDetails = exports.receiveOptionDetails = exports.skipNextAutoResolve = exports.setCalculationAutoResolveEnabled = exports.setCalculationErrorsResolved = exports.invalidateCalculation = exports.receiveCalculation = exports.receiveSwitchoptionsresult = exports.receiveOptions = exports.selectOptionclassification = exports.applyVariantAmountPreSelection = exports.setDefaultSelectedVariantIdentifier = exports.deleteMissingVariants = exports.receiveConfiguration = exports.DELETE_SELECTED_AMOUNTS = exports.SET_SELECTED_AMOUNTS = exports.SET_COMMENT = exports.SET_SELECTED_CALCULATION = exports.DELETE_SELECTED_AMOUNT = exports.CLEAR_BULKNAMES = exports.SAVE_BULKNAMES = exports.SWITCH_SELECTED_AMOUNT = exports.SET_SELECTED_AMOUNT = exports.SET_CONFLICTING_SWITCHOPTION_DATA = exports.SET_OPTIONCLASSIFICATION_CHECKED = exports.SET_CALCULATION_AUTO_RESOLVE_ENABLED = exports.SET_CALCULATION_ERRORS_RESOLVED = exports.SET_CALCULATION_ENABLED = exports.SET_SELECTED_VARIANT_IDENTIFIER = exports.SET_STOCK_INFORMATION_OPTION = exports.SET_LOAD_IDENTIFIER = exports.SET_LOAD_CODE = exports.SET_CUSTOM_TITLE = exports.RECEIVE_INSPIRATIONS = exports.RECEIVE_CLIENT_DATA = exports.RECEIVE_CODESNIPPETS = exports.RECEIVE_CONFIGURATIONVARIANTS = exports.RECEIVE_VALIDATION = exports.RECEIVE_SAVEDCONFIGURATION = exports.RECEIVE_OPTIONDETAILS = exports.INVALIDATE_CALCULATION = exports.RECEIVE_CALCULATION = exports.RECEIVE_SWITCHOPTIONSRESULT = exports.RECEIVE_OPTIONS = exports.SELECT_OPTIONCLASSIFICATION = exports.RECEIVE_DESIGNER_DATA = exports.RECEIVE_CONFIGURATION = void 0;
|
|
7
7
|
|
|
8
8
|
var apiActions = _interopRequireWildcard(require("../Actions"));
|
|
9
9
|
|
|
@@ -57,9 +57,17 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
57
57
|
|
|
58
58
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
59
59
|
|
|
60
|
+
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
61
|
+
|
|
60
62
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
61
63
|
|
|
62
|
-
function
|
|
64
|
+
function _toArray(arr) { return _arrayWithHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableRest(); }
|
|
65
|
+
|
|
66
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
67
|
+
|
|
68
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
69
|
+
|
|
70
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
63
71
|
|
|
64
72
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
65
73
|
|
|
@@ -745,7 +753,7 @@ var fetchOptions = function fetchOptions(itemidentifier, optionclassification, c
|
|
|
745
753
|
|
|
746
754
|
exports.fetchOptions = fetchOptions;
|
|
747
755
|
|
|
748
|
-
var switchOptionsBasic = function switchOptionsBasic(configuration,
|
|
756
|
+
var switchOptionsBasic = function switchOptionsBasic(configuration, switchedoptions) {
|
|
749
757
|
var noCheck = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
750
758
|
var config = {};
|
|
751
759
|
|
|
@@ -757,7 +765,7 @@ var switchOptionsBasic = function switchOptionsBasic(configuration, switchedOpti
|
|
|
757
765
|
|
|
758
766
|
return apiActions.postData('configuration/switchoption', {
|
|
759
767
|
configuration: configuration,
|
|
760
|
-
|
|
768
|
+
switchedoptions: switchedoptions
|
|
761
769
|
}, function (data) {
|
|
762
770
|
return {
|
|
763
771
|
// dummy receiver
|
|
@@ -769,12 +777,65 @@ var switchOptionsBasic = function switchOptionsBasic(configuration, switchedOpti
|
|
|
769
777
|
|
|
770
778
|
exports.switchOptionsBasic = switchOptionsBasic;
|
|
771
779
|
|
|
780
|
+
var switchOptionArrays = function switchOptionArrays(configuration, switchOptionData) {
|
|
781
|
+
var noCheck = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
782
|
+
return function (dispatch) {
|
|
783
|
+
var switchedoptions = {};
|
|
784
|
+
var afterSwitch = [];
|
|
785
|
+
|
|
786
|
+
for (var componentIdentifier in switchOptionData) {
|
|
787
|
+
if ((0, _lodash.isArray)(switchOptionData[componentIdentifier])) {
|
|
788
|
+
var _switchOptionData$com = _toArray(switchOptionData[componentIdentifier]),
|
|
789
|
+
firstOption = _switchOptionData$com[0],
|
|
790
|
+
otherOptions = _switchOptionData$com.slice(1);
|
|
791
|
+
|
|
792
|
+
switchedoptions[componentIdentifier] = firstOption;
|
|
793
|
+
|
|
794
|
+
if (otherOptions.length > 0) {
|
|
795
|
+
var _iterator2 = _createForOfIteratorHelper(otherOptions),
|
|
796
|
+
_step2;
|
|
797
|
+
|
|
798
|
+
try {
|
|
799
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
800
|
+
var optionData = _step2.value;
|
|
801
|
+
afterSwitch.push(_defineProperty({}, componentIdentifier, optionData));
|
|
802
|
+
}
|
|
803
|
+
} catch (err) {
|
|
804
|
+
_iterator2.e(err);
|
|
805
|
+
} finally {
|
|
806
|
+
_iterator2.f();
|
|
807
|
+
}
|
|
808
|
+
}
|
|
809
|
+
} else {
|
|
810
|
+
switchedoptions[componentIdentifier] = switchOptionData[componentIdentifier];
|
|
811
|
+
}
|
|
812
|
+
}
|
|
813
|
+
|
|
814
|
+
var p = dispatch(switchOptionsBasic(configuration, switchedoptions, noCheck));
|
|
815
|
+
|
|
816
|
+
var _loop = function _loop() {
|
|
817
|
+
var switchOption = _afterSwitch[_i];
|
|
818
|
+
p = p.then(function (action) {
|
|
819
|
+
return dispatch(switchOptionsBasic(action.data, switchOption, noCheck));
|
|
820
|
+
});
|
|
821
|
+
};
|
|
822
|
+
|
|
823
|
+
for (var _i = 0, _afterSwitch = afterSwitch; _i < _afterSwitch.length; _i++) {
|
|
824
|
+
_loop();
|
|
825
|
+
}
|
|
826
|
+
|
|
827
|
+
return p;
|
|
828
|
+
};
|
|
829
|
+
};
|
|
830
|
+
|
|
831
|
+
exports.switchOptionArrays = switchOptionArrays;
|
|
832
|
+
|
|
772
833
|
var switchOptions = function switchOptions(configuration, switchOptionData) {
|
|
773
834
|
var noCheck = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
774
835
|
var refreshOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
775
836
|
var setChecked = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
776
837
|
return function (dispatch) {
|
|
777
|
-
return dispatch(
|
|
838
|
+
return dispatch(switchOptionArrays(configuration, switchOptionData, noCheck)).then(function (action) {
|
|
778
839
|
var extraData = {
|
|
779
840
|
switchOptionData: switchOptionData,
|
|
780
841
|
noCheck: noCheck,
|
|
@@ -999,12 +1060,12 @@ var resolveConflicts = function resolveConflicts() {
|
|
|
999
1060
|
if ((0, _lodash.isArray)(incompatibilityCheckResults.check_results)) {
|
|
1000
1061
|
dispatch(setCalculationEnabled(false)); // disable calculation while waiting for all options to be switched
|
|
1001
1062
|
|
|
1002
|
-
var
|
|
1003
|
-
|
|
1063
|
+
var _iterator3 = _createForOfIteratorHelper(incompatibilityCheckResults.check_results),
|
|
1064
|
+
_step3;
|
|
1004
1065
|
|
|
1005
1066
|
try {
|
|
1006
|
-
for (
|
|
1007
|
-
var result =
|
|
1067
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
1068
|
+
var result = _step3.value;
|
|
1008
1069
|
|
|
1009
1070
|
if (result.status === false) {
|
|
1010
1071
|
(function () {
|
|
@@ -1014,19 +1075,19 @@ var resolveConflicts = function resolveConflicts() {
|
|
|
1014
1075
|
if (switchOptionsData) {
|
|
1015
1076
|
if (p) {
|
|
1016
1077
|
p = p.then(function (action) {
|
|
1017
|
-
return dispatch(
|
|
1078
|
+
return dispatch(switchOptionArrays(action.data, switchOptionsData, true));
|
|
1018
1079
|
});
|
|
1019
1080
|
} else {
|
|
1020
|
-
p = dispatch(
|
|
1081
|
+
p = dispatch(switchOptionArrays(configuration, switchOptionsData, true));
|
|
1021
1082
|
}
|
|
1022
1083
|
}
|
|
1023
1084
|
})();
|
|
1024
1085
|
}
|
|
1025
1086
|
}
|
|
1026
1087
|
} catch (err) {
|
|
1027
|
-
|
|
1088
|
+
_iterator3.e(err);
|
|
1028
1089
|
} finally {
|
|
1029
|
-
|
|
1090
|
+
_iterator3.f();
|
|
1030
1091
|
}
|
|
1031
1092
|
|
|
1032
1093
|
if (p) {
|
|
@@ -1099,26 +1160,26 @@ var selectMultipleOptions = function selectMultipleOptions(optionsList) {
|
|
|
1099
1160
|
var configuration = (0, _Selectors.getConfiguration)((0, _Selectors.getConfigurator)(getState()));
|
|
1100
1161
|
var switchOptionData = {};
|
|
1101
1162
|
|
|
1102
|
-
var
|
|
1103
|
-
|
|
1163
|
+
var _iterator4 = _createForOfIteratorHelper(optionsList),
|
|
1164
|
+
_step4;
|
|
1104
1165
|
|
|
1105
1166
|
try {
|
|
1106
|
-
for (
|
|
1107
|
-
var component =
|
|
1167
|
+
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
1168
|
+
var component = _step4.value;
|
|
1108
1169
|
switchOptionData[component.identifier] = component.selectedoptions.map(function (_ref5) {
|
|
1109
1170
|
var identifier = _ref5.identifier,
|
|
1110
1171
|
amount = _ref5.amount;
|
|
1111
1172
|
return {
|
|
1112
1173
|
identifier: identifier,
|
|
1113
|
-
amount:
|
|
1174
|
+
amount: amount || 1,
|
|
1114
1175
|
check_results: null
|
|
1115
1176
|
};
|
|
1116
1177
|
});
|
|
1117
1178
|
}
|
|
1118
1179
|
} catch (err) {
|
|
1119
|
-
|
|
1180
|
+
_iterator4.e(err);
|
|
1120
1181
|
} finally {
|
|
1121
|
-
|
|
1182
|
+
_iterator4.f();
|
|
1122
1183
|
}
|
|
1123
1184
|
|
|
1124
1185
|
return dispatch(switchOptions(configuration, switchOptionData, false, false, true));
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
10
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
+
|
|
12
|
+
var _core = require("@material-ui/core");
|
|
13
|
+
|
|
14
|
+
var _FormControlLabel = _interopRequireDefault(require("@material-ui/core/FormControlLabel"));
|
|
15
|
+
|
|
16
|
+
var _Checkbox = _interopRequireDefault(require("@material-ui/core/Checkbox"));
|
|
17
|
+
|
|
18
|
+
var _FormHelperText = _interopRequireDefault(require("@material-ui/core/FormHelperText"));
|
|
19
|
+
|
|
20
|
+
var _i18n = require("../../../../../Framework/i18n");
|
|
21
|
+
|
|
22
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
23
|
+
|
|
24
|
+
var styles = function styles(theme) {
|
|
25
|
+
return {
|
|
26
|
+
link: {
|
|
27
|
+
'& a': {
|
|
28
|
+
color: theme.palette.primary.main
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
var DesignApproval = function DesignApproval(props) {
|
|
35
|
+
var handleChange = function handleChange(event) {
|
|
36
|
+
var onChange = props.onChange;
|
|
37
|
+
onChange(event.target.checked);
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
var classes = props.classes,
|
|
41
|
+
checked = props.checked,
|
|
42
|
+
error = props.error,
|
|
43
|
+
link = props.link;
|
|
44
|
+
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_FormControlLabel["default"], {
|
|
45
|
+
control: /*#__PURE__*/_react["default"].createElement(_Checkbox["default"], {
|
|
46
|
+
name: "approval",
|
|
47
|
+
checked: checked,
|
|
48
|
+
onChange: handleChange,
|
|
49
|
+
color: "primary"
|
|
50
|
+
}),
|
|
51
|
+
label: /*#__PURE__*/_react["default"].createElement("div", {
|
|
52
|
+
className: classes.link,
|
|
53
|
+
dangerouslySetInnerHTML: {
|
|
54
|
+
__html: (0, _i18n.t)('receiveOfferForm.approval', {
|
|
55
|
+
link: link
|
|
56
|
+
})
|
|
57
|
+
}
|
|
58
|
+
})
|
|
59
|
+
}), error && /*#__PURE__*/_react["default"].createElement(_FormHelperText["default"], {
|
|
60
|
+
error: true
|
|
61
|
+
}, (0, _i18n.t)('receiveOfferForm.errors.notApproved')));
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
DesignApproval.propTypes = {
|
|
65
|
+
classes: _propTypes["default"].object,
|
|
66
|
+
onChange: _propTypes["default"].func,
|
|
67
|
+
checked: _propTypes["default"].bool,
|
|
68
|
+
error: _propTypes["default"].bool,
|
|
69
|
+
link: _propTypes["default"].string
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
var _default = (0, _core.withStyles)(styles, {
|
|
73
|
+
name: 'DesignApproval'
|
|
74
|
+
})(DesignApproval);
|
|
75
|
+
|
|
76
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _react = _interopRequireDefault(require("react"));
|
|
4
|
+
|
|
5
|
+
var _noop = _interopRequireDefault(require("lodash/noop"));
|
|
6
|
+
|
|
7
|
+
var _react2 = require("@storybook/react");
|
|
8
|
+
|
|
9
|
+
var _index = _interopRequireDefault(require("./index"));
|
|
10
|
+
|
|
11
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
12
|
+
|
|
13
|
+
(0, _react2.storiesOf)('DesignApproval', module).add('without error', function () {
|
|
14
|
+
return /*#__PURE__*/_react["default"].createElement(_index["default"], {
|
|
15
|
+
checked: true,
|
|
16
|
+
error: false,
|
|
17
|
+
link: 'fakeLink',
|
|
18
|
+
onChange: _noop["default"]
|
|
19
|
+
});
|
|
20
|
+
}).add('with error', function () {
|
|
21
|
+
return /*#__PURE__*/_react["default"].createElement(_index["default"], {
|
|
22
|
+
checked: false,
|
|
23
|
+
error: true,
|
|
24
|
+
link: 'fakeLink',
|
|
25
|
+
onChange: _noop["default"]
|
|
26
|
+
});
|
|
27
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _react = _interopRequireDefault(require("react"));
|
|
4
|
+
|
|
5
|
+
var _noop = _interopRequireDefault(require("lodash/noop"));
|
|
6
|
+
|
|
7
|
+
var _enzyme = require("enzyme");
|
|
8
|
+
|
|
9
|
+
var _index = _interopRequireDefault(require("./index"));
|
|
10
|
+
|
|
11
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
12
|
+
|
|
13
|
+
/* eslint-env jest */
|
|
14
|
+
it('renders correctly without error', function () {
|
|
15
|
+
var tree = (0, _enzyme.render)( /*#__PURE__*/_react["default"].createElement(_index["default"], {
|
|
16
|
+
checked: true,
|
|
17
|
+
error: false,
|
|
18
|
+
link: 'fakeLink',
|
|
19
|
+
onChange: _noop["default"]
|
|
20
|
+
}));
|
|
21
|
+
expect(tree).toMatchSnapshot();
|
|
22
|
+
});
|
|
23
|
+
it('renders correctly with error', function () {
|
|
24
|
+
var tree = (0, _enzyme.render)( /*#__PURE__*/_react["default"].createElement(_index["default"], {
|
|
25
|
+
checked: false,
|
|
26
|
+
error: true,
|
|
27
|
+
link: 'fakeLink',
|
|
28
|
+
onChange: _noop["default"]
|
|
29
|
+
}));
|
|
30
|
+
expect(tree).toMatchSnapshot();
|
|
31
|
+
});
|
|
@@ -9,21 +9,13 @@ exports["default"] = void 0;
|
|
|
9
9
|
|
|
10
10
|
var _react = _interopRequireDefault(require("react"));
|
|
11
11
|
|
|
12
|
-
var
|
|
13
|
-
|
|
14
|
-
var _i18n = require("../../../../Framework/i18n");
|
|
15
|
-
|
|
16
|
-
var _withWidth = _interopRequireDefault(require("@material-ui/core/withWidth/withWidth"));
|
|
17
|
-
|
|
18
|
-
var _Grid = _interopRequireDefault(require("@material-ui/core/Grid/Grid"));
|
|
19
|
-
|
|
20
|
-
var _FormControlLabel = _interopRequireDefault(require("@material-ui/core/FormControlLabel"));
|
|
12
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
21
13
|
|
|
22
|
-
var
|
|
14
|
+
var _Selectors = require("../../../Reducers/Configurator/Selectors");
|
|
23
15
|
|
|
24
|
-
var
|
|
16
|
+
var _DesignApproval = _interopRequireDefault(require("../Components/DesignApproval"));
|
|
25
17
|
|
|
26
|
-
var
|
|
18
|
+
var _ComponentContainer = require("../../../../Framework/ComponentContainer");
|
|
27
19
|
|
|
28
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
29
21
|
|
|
@@ -49,88 +41,89 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
|
49
41
|
|
|
50
42
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
51
43
|
|
|
52
|
-
var
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
paddingLeft: 15,
|
|
57
|
-
paddingBottom: 12
|
|
58
|
-
}, theme.breakpoints.down('xs'), {
|
|
59
|
-
paddingLeft: 12
|
|
60
|
-
}),
|
|
61
|
-
checkbox: {
|
|
62
|
-
alignSelf: 'flex-start',
|
|
63
|
-
top: -10
|
|
64
|
-
},
|
|
65
|
-
formHelperText: {
|
|
66
|
-
marginLeft: 45,
|
|
67
|
-
marginBottom: 15
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
};
|
|
44
|
+
var DesignApprovalContainer = /*#__PURE__*/function (_React$Component) {
|
|
45
|
+
_inherits(DesignApprovalContainer, _React$Component);
|
|
46
|
+
|
|
47
|
+
var _super = _createSuper(DesignApprovalContainer);
|
|
71
48
|
|
|
72
|
-
|
|
73
|
-
|
|
49
|
+
function DesignApprovalContainer(props) {
|
|
50
|
+
var _this;
|
|
74
51
|
|
|
75
|
-
|
|
52
|
+
_classCallCheck(this, DesignApprovalContainer);
|
|
76
53
|
|
|
77
|
-
|
|
78
|
-
_classCallCheck(this, AcceptPrivacy);
|
|
54
|
+
_this = _super.call(this, props);
|
|
79
55
|
|
|
80
|
-
|
|
56
|
+
_defineProperty(_assertThisInitialized(_this), "handleApprovalChange", function (checked) {
|
|
57
|
+
_this.setState({
|
|
58
|
+
approval: {
|
|
59
|
+
checked: checked,
|
|
60
|
+
error: false
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
_this.state = {
|
|
66
|
+
approval: {
|
|
67
|
+
checked: false,
|
|
68
|
+
error: false
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
return _this;
|
|
81
72
|
}
|
|
82
73
|
|
|
83
|
-
_createClass(
|
|
74
|
+
_createClass(DesignApprovalContainer, [{
|
|
75
|
+
key: "validate",
|
|
76
|
+
value: function validate() {
|
|
77
|
+
var checked = this.state.approval.checked;
|
|
78
|
+
|
|
79
|
+
if (checked) {
|
|
80
|
+
return true;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
this.setState({
|
|
84
|
+
approval: {
|
|
85
|
+
checked: checked,
|
|
86
|
+
error: true
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
return false;
|
|
90
|
+
}
|
|
91
|
+
}, {
|
|
84
92
|
key: "render",
|
|
85
93
|
value: function render() {
|
|
94
|
+
var approval = this.state.approval;
|
|
86
95
|
var _this$props = this.props,
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
96
|
+
termsAndConditionsLink = _this$props.termsAndConditionsLink,
|
|
97
|
+
DesignApprovalComponent = _this$props.DesignApprovalComponent;
|
|
98
|
+
return /*#__PURE__*/_react["default"].createElement(DesignApprovalComponent, {
|
|
99
|
+
checked: approval.checked,
|
|
100
|
+
error: approval.error,
|
|
101
|
+
link: termsAndConditionsLink,
|
|
102
|
+
onChange: this.handleApprovalChange
|
|
94
103
|
});
|
|
95
|
-
return /*#__PURE__*/_react["default"].createElement(_Grid["default"], {
|
|
96
|
-
container: true
|
|
97
|
-
}, /*#__PURE__*/_react["default"].createElement(_Grid["default"], {
|
|
98
|
-
item: true,
|
|
99
|
-
xs: 12
|
|
100
|
-
}, /*#__PURE__*/_react["default"].createElement(_FormControlLabel["default"], {
|
|
101
|
-
className: classes.checkboxLabel,
|
|
102
|
-
control: /*#__PURE__*/_react["default"].createElement(_Checkbox["default"], {
|
|
103
|
-
className: classes.checkbox,
|
|
104
|
-
name: "dataPrivacyAccepted",
|
|
105
|
-
checked: approval.value,
|
|
106
|
-
onChange: handleChangeCheckboxApproval,
|
|
107
|
-
color: "primary"
|
|
108
|
-
}),
|
|
109
|
-
label: /*#__PURE__*/_react["default"].createElement("span", {
|
|
110
|
-
dangerouslySetInnerHTML: {
|
|
111
|
-
__html: privacyNotice
|
|
112
|
-
}
|
|
113
|
-
})
|
|
114
|
-
}), approval.error && /*#__PURE__*/_react["default"].createElement(_FormHelperText["default"], {
|
|
115
|
-
error: true,
|
|
116
|
-
className: classes.formHelperText
|
|
117
|
-
}, (0, _i18n.t)('receiveOfferForm.selectionError'))));
|
|
118
104
|
}
|
|
119
105
|
}]);
|
|
120
106
|
|
|
121
|
-
return
|
|
107
|
+
return DesignApprovalContainer;
|
|
122
108
|
}(_react["default"].Component);
|
|
123
109
|
|
|
124
|
-
_defineProperty(
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
handleChangeCheckboxApproval: _propTypes["default"].func,
|
|
128
|
-
approval: _propTypes["default"].object,
|
|
129
|
-
dataPrivacyLink: _propTypes["default"].string
|
|
110
|
+
_defineProperty(DesignApprovalContainer, "propTypes", {
|
|
111
|
+
termsAndConditionsLink: _propTypes["default"].string,
|
|
112
|
+
DesignApprovalComponent: _propTypes["default"].func
|
|
130
113
|
});
|
|
131
114
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
})
|
|
115
|
+
_defineProperty(DesignApprovalContainer, "defaultProps", {
|
|
116
|
+
DesignApprovalComponent: _DesignApproval["default"]
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
var mapStateToProps = function mapStateToProps(_ref) {
|
|
120
|
+
var configurator = _ref.configurator;
|
|
121
|
+
return {
|
|
122
|
+
Component: DesignApprovalContainer,
|
|
123
|
+
termsAndConditionsLink: (0, _Selectors.getClientTexts)(configurator).termsAndConditionsLink
|
|
124
|
+
};
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
var _default = (0, _ComponentContainer.containerConnect)(mapStateToProps);
|
|
135
128
|
|
|
136
129
|
exports["default"] = _default;
|
|
@@ -267,7 +267,7 @@ var ThemeMixer = function ThemeMixer(_ref) {
|
|
|
267
267
|
withTheme = _ref.withTheme,
|
|
268
268
|
children = _ref.children;
|
|
269
269
|
var themeMix = (0, _react.useMemo)(function () {
|
|
270
|
-
var theme = (0, _styles.
|
|
270
|
+
var theme = (0, _styles.createMuiTheme)(createThemeFromClientTheme(client && client.theme ? client.theme : {}, customTheme || {}));
|
|
271
271
|
|
|
272
272
|
if (typeof withTheme === 'function') {
|
|
273
273
|
withTheme(theme);
|