@thecb/components 7.11.0-beta.7 → 7.13.0-beta.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.
- package/dist/index.cjs.js +19 -26
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +19 -26
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/molecules/partial-amount-form/PartialAmountForm.js +1 -18
- package/src/components/molecules/partial-amount-form/PartialAmountForm.state.js +1 -9
- package/src/components/molecules/workflow-tile/WorkflowTile.js +35 -14
package/dist/index.cjs.js
CHANGED
|
@@ -46508,7 +46508,6 @@ var PartialAmountForm = function PartialAmountForm(_ref) {
|
|
|
46508
46508
|
maximum = _ref.maximum,
|
|
46509
46509
|
_ref$minimum = _ref.minimum,
|
|
46510
46510
|
minimum = _ref$minimum === void 0 ? 1 : _ref$minimum,
|
|
46511
|
-
blockPartialPaymentOverpay = _ref.blockPartialPaymentOverpay,
|
|
46512
46511
|
clearOnDismount = _ref.clearOnDismount,
|
|
46513
46512
|
fields = _ref.fields,
|
|
46514
46513
|
actions = _ref.actions,
|
|
@@ -46524,20 +46523,6 @@ var PartialAmountForm = function PartialAmountForm(_ref) {
|
|
|
46524
46523
|
}
|
|
46525
46524
|
|
|
46526
46525
|
var amountErrors = (_amountErrors = {}, _defineProperty(_amountErrors, required.error, "Amount is required"), _defineProperty(_amountErrors, numberGreaterThanOrEqualTo.error, "There is a minimum payment of ".concat(displayCurrency(minimum))), _defineProperty(_amountErrors, numberLessThanOrEqualTo.error, "There is a maximum payment of ".concat(displayCurrency(maximum))), _amountErrors);
|
|
46527
|
-
|
|
46528
|
-
var getPartialAmountFormErrors = function getPartialAmountFormErrors(itemAmount) {
|
|
46529
|
-
var errorMessages = amountErrors;
|
|
46530
|
-
|
|
46531
|
-
if (blockPartialPaymentOverpay) {
|
|
46532
|
-
console.log("item amount in form is", itemAmount);
|
|
46533
|
-
var maxAmountError = "There is a maximum payment of ".concat(displayCurrency(itemAmount));
|
|
46534
|
-
return _objectSpread2(_objectSpread2({}, errorMessages), {}, _defineProperty({}, numberLessThanOrEqualTo.error, maxAmountError));
|
|
46535
|
-
}
|
|
46536
|
-
|
|
46537
|
-
console.log("error messages are", errorMessages);
|
|
46538
|
-
return errorMessages;
|
|
46539
|
-
};
|
|
46540
|
-
|
|
46541
46526
|
var lineItemsNew = Array.isArray(lineItems) ? lineItems : [];
|
|
46542
46527
|
return /*#__PURE__*/React__default.createElement(FormContainer$1, {
|
|
46543
46528
|
variant: variant,
|
|
@@ -46556,7 +46541,7 @@ var PartialAmountForm = function PartialAmountForm(_ref) {
|
|
|
46556
46541
|
field: fields[li.id],
|
|
46557
46542
|
fieldActions: actions.fields[li.id],
|
|
46558
46543
|
showErrors: showErrors,
|
|
46559
|
-
errorMessages:
|
|
46544
|
+
errorMessages: amountErrors,
|
|
46560
46545
|
style: {
|
|
46561
46546
|
textAlign: "right"
|
|
46562
46547
|
},
|
|
@@ -46575,11 +46560,7 @@ var PartialAmountForm = function PartialAmountForm(_ref) {
|
|
|
46575
46560
|
|
|
46576
46561
|
var createPartialAmountFormState = function createPartialAmountFormState(lineItems, maximum) {
|
|
46577
46562
|
var minimum = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
|
|
46578
|
-
var blockPartialPaymentOverpay = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
46579
46563
|
var formConfig = lineItems.reduce(function (acc, item) {
|
|
46580
|
-
console.log("maximum is", maximum);
|
|
46581
|
-
console.log("item amount is", item.amount);
|
|
46582
|
-
console.log("block payment overpay", blockPartialPaymentOverpay);
|
|
46583
46564
|
var validators = [required(), validateSum(numberGreaterThanOrEqualTo(minimum), lineItems.filter(function (lineItem) {
|
|
46584
46565
|
return lineItem != item;
|
|
46585
46566
|
}).reduce(function (acc, curr) {
|
|
@@ -46594,10 +46575,6 @@ var createPartialAmountFormState = function createPartialAmountFormState(lineIte
|
|
|
46594
46575
|
}, [])));
|
|
46595
46576
|
}
|
|
46596
46577
|
|
|
46597
|
-
if (blockPartialPaymentOverpay) {
|
|
46598
|
-
validators.push(numberLessThanOrEqualTo(item.amount));
|
|
46599
|
-
}
|
|
46600
|
-
|
|
46601
46578
|
return _objectSpread2(_objectSpread2({}, acc), {}, _defineProperty({}, item.id, {
|
|
46602
46579
|
validators: validators,
|
|
46603
46580
|
constraints: [onlyNaturals()],
|
|
@@ -48912,7 +48889,9 @@ var WorkflowTile = function WorkflowTile(_ref) {
|
|
|
48912
48889
|
workflowActionName = _ref$workflowActionNa === void 0 ? "Search" : _ref$workflowActionNa,
|
|
48913
48890
|
slug = _ref.slug,
|
|
48914
48891
|
_ref$buttonVariant = _ref.buttonVariant,
|
|
48915
|
-
buttonVariant = _ref$buttonVariant === void 0 ? "primary" : _ref$buttonVariant
|
|
48892
|
+
buttonVariant = _ref$buttonVariant === void 0 ? "primary" : _ref$buttonVariant,
|
|
48893
|
+
selectWorkflowAction = _ref.selectWorkflowAction,
|
|
48894
|
+
navigate = _ref.navigate;
|
|
48916
48895
|
return /*#__PURE__*/React__default.createElement(Box, {
|
|
48917
48896
|
background: WHITE,
|
|
48918
48897
|
boxShadow: "0px 0px 5px 0px ".concat(GHOST_GREY),
|
|
@@ -48940,7 +48919,21 @@ var WorkflowTile = function WorkflowTile(_ref) {
|
|
|
48940
48919
|
background: ATHENS_GREY,
|
|
48941
48920
|
borderColor: GRECIAN_GREY,
|
|
48942
48921
|
borderWidthOverride: "2px 0 0 0"
|
|
48943
|
-
}, /*#__PURE__*/React__default.createElement(
|
|
48922
|
+
}, selectWorkflowAction ? /*#__PURE__*/React__default.createElement(ButtonWithAction, {
|
|
48923
|
+
variant: buttonVariant,
|
|
48924
|
+
primary: buttonVariant == "primary",
|
|
48925
|
+
primaryBG: MATISSE_BLUE,
|
|
48926
|
+
fontWeight: FONT_WEIGHT_SEMIBOLD,
|
|
48927
|
+
fontSize: "1.125rem",
|
|
48928
|
+
text: workflowActionName,
|
|
48929
|
+
minWidth: "100%",
|
|
48930
|
+
extraStyles: "width: 100%; margin: 0; text-align: center;",
|
|
48931
|
+
dataQa: slug,
|
|
48932
|
+
action: function action() {
|
|
48933
|
+
selectWorkflowAction(slug);
|
|
48934
|
+
navigate("/service/".concat(slug));
|
|
48935
|
+
}
|
|
48936
|
+
}) : /*#__PURE__*/React__default.createElement(ButtonWithLink, {
|
|
48944
48937
|
variant: buttonVariant,
|
|
48945
48938
|
primary: buttonVariant == "primary",
|
|
48946
48939
|
primaryBG: MATISSE_BLUE,
|