@thecb/components 7.11.0-beta.6 → 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 +21 -35
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +21 -35
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/molecules/partial-amount-form/PartialAmountForm.js +1 -20
- package/src/components/molecules/partial-amount-form/PartialAmountForm.state.js +3 -14
- 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,22 +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(maximum, itemAmount) {
|
|
46529
|
-
var errorMessages = amountErrors;
|
|
46530
|
-
|
|
46531
|
-
if (blockPartialPaymentOverpay) {
|
|
46532
|
-
console.log("item amount in form is", itemAmount);
|
|
46533
|
-
var maxAmount = !maximum || itemAmount < maximum ? itemAmount : maximum;
|
|
46534
|
-
var maxAmountError = "There is a maximum payment of ".concat(displayCurrency(maxAmount));
|
|
46535
|
-
console.log("max amount in form is", maxAmount);
|
|
46536
|
-
return _objectSpread2(_objectSpread2({}, errorMessages), {}, _defineProperty({}, numberLessThanOrEqualTo.error, maxAmountError));
|
|
46537
|
-
}
|
|
46538
|
-
|
|
46539
|
-
console.log("error messages are", errorMessages);
|
|
46540
|
-
return errorMessages;
|
|
46541
|
-
};
|
|
46542
|
-
|
|
46543
46526
|
var lineItemsNew = Array.isArray(lineItems) ? lineItems : [];
|
|
46544
46527
|
return /*#__PURE__*/React__default.createElement(FormContainer$1, {
|
|
46545
46528
|
variant: variant,
|
|
@@ -46558,7 +46541,7 @@ var PartialAmountForm = function PartialAmountForm(_ref) {
|
|
|
46558
46541
|
field: fields[li.id],
|
|
46559
46542
|
fieldActions: actions.fields[li.id],
|
|
46560
46543
|
showErrors: showErrors,
|
|
46561
|
-
errorMessages:
|
|
46544
|
+
errorMessages: amountErrors,
|
|
46562
46545
|
style: {
|
|
46563
46546
|
textAlign: "right"
|
|
46564
46547
|
},
|
|
@@ -46577,28 +46560,15 @@ var PartialAmountForm = function PartialAmountForm(_ref) {
|
|
|
46577
46560
|
|
|
46578
46561
|
var createPartialAmountFormState = function createPartialAmountFormState(lineItems, maximum) {
|
|
46579
46562
|
var minimum = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
|
|
46580
|
-
var blockPartialPaymentOverpay = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
46581
|
-
|
|
46582
|
-
var getPaymentMax = function getPaymentMax(maximum, itemAmount) {
|
|
46583
|
-
if (blockPartialPaymentOverpay) {
|
|
46584
|
-
return !maximum || itemAmount < maximum ? itemAmount : maximum;
|
|
46585
|
-
}
|
|
46586
|
-
|
|
46587
|
-
return maximum;
|
|
46588
|
-
};
|
|
46589
|
-
|
|
46590
46563
|
var formConfig = lineItems.reduce(function (acc, item) {
|
|
46591
|
-
console.log("maximum is", maximum);
|
|
46592
|
-
console.log("item amount is", item.amount);
|
|
46593
|
-
console.log("block payment overpay", blockPartialPaymentOverpay);
|
|
46594
46564
|
var validators = [required(), validateSum(numberGreaterThanOrEqualTo(minimum), lineItems.filter(function (lineItem) {
|
|
46595
46565
|
return lineItem != item;
|
|
46596
46566
|
}).reduce(function (acc, curr) {
|
|
46597
46567
|
return [].concat(_toConsumableArray(acc), [curr.id]);
|
|
46598
46568
|
}, []))];
|
|
46599
46569
|
|
|
46600
|
-
if (!!maximum
|
|
46601
|
-
validators.push(validateSum(numberLessThanOrEqualTo(
|
|
46570
|
+
if (!!maximum) {
|
|
46571
|
+
validators.push(validateSum(numberLessThanOrEqualTo(maximum), lineItems.filter(function (lineItem) {
|
|
46602
46572
|
return lineItem != item;
|
|
46603
46573
|
}).reduce(function (acc, curr) {
|
|
46604
46574
|
return [].concat(_toConsumableArray(acc), [curr.id]);
|
|
@@ -48919,7 +48889,9 @@ var WorkflowTile = function WorkflowTile(_ref) {
|
|
|
48919
48889
|
workflowActionName = _ref$workflowActionNa === void 0 ? "Search" : _ref$workflowActionNa,
|
|
48920
48890
|
slug = _ref.slug,
|
|
48921
48891
|
_ref$buttonVariant = _ref.buttonVariant,
|
|
48922
|
-
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;
|
|
48923
48895
|
return /*#__PURE__*/React__default.createElement(Box, {
|
|
48924
48896
|
background: WHITE,
|
|
48925
48897
|
boxShadow: "0px 0px 5px 0px ".concat(GHOST_GREY),
|
|
@@ -48947,7 +48919,21 @@ var WorkflowTile = function WorkflowTile(_ref) {
|
|
|
48947
48919
|
background: ATHENS_GREY,
|
|
48948
48920
|
borderColor: GRECIAN_GREY,
|
|
48949
48921
|
borderWidthOverride: "2px 0 0 0"
|
|
48950
|
-
}, /*#__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, {
|
|
48951
48937
|
variant: buttonVariant,
|
|
48952
48938
|
primary: buttonVariant == "primary",
|
|
48953
48939
|
primaryBG: MATISSE_BLUE,
|