@thecb/components 4.0.14-beta.0 → 4.0.14

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/.tool-versions ADDED
@@ -0,0 +1 @@
1
+ nodejs 10.15.3
package/dist/index.cjs.js CHANGED
@@ -19917,7 +19917,9 @@ var ERRORS = {
19917
19917
  "71": "Passed invalid pixel value %s to %s(), please pass a value like \"12px\" or 12.\n\n",
19918
19918
  "72": "Passed invalid base value %s to %s(), please pass a value like \"12px\" or 12.\n\n",
19919
19919
  "73": "Please provide a valid CSS variable.\n\n",
19920
- "74": "CSS variable not found.\n"
19920
+ "74": "CSS variable not found and no default was provided.\n\n",
19921
+ "75": "important requires a valid style object, got a %s instead.\n\n",
19922
+ "76": "fromSize and toSize must be provided as stringified numbers with the same units as minScreen and maxScreen.\n"
19921
19923
  };
19922
19924
  /**
19923
19925
  * super basic version of sprintf
@@ -37958,6 +37960,7 @@ var PaymentFormACH = function PaymentFormACH(_ref) {
37958
37960
  fields = _ref.fields,
37959
37961
  actions = _ref.actions,
37960
37962
  showErrors = _ref.showErrors,
37963
+ fees = _ref.fees,
37961
37964
  _ref$handleSubmit = _ref.handleSubmit,
37962
37965
  handleSubmit = _ref$handleSubmit === void 0 ? noop : _ref$handleSubmit;
37963
37966
 
@@ -38092,6 +38095,13 @@ var PaymentFormACH = function PaymentFormACH(_ref) {
38092
38095
  onChange: toggleCheckbox,
38093
38096
  checked: defaultMethod.value,
38094
38097
  hidden: hideDefaultPayment
38098
+ }), !!(fees === null || fees === void 0 ? void 0 : fees.value) && /*#__PURE__*/React__default.createElement(Alert$1, {
38099
+ heading: "Processing Fee",
38100
+ text: "There is a processing fee of ".concat(fees.type === "FLAT" ? "".concat(displayCurrency(fees.value)) : "".concat(fees.value * 100, "%"), " ").concat(ifElse(isNil, always(""), function (a) {
38101
+ return "with a minimum of ".concat(displayCurrency(a), " ");
38102
+ })(fees.minimumInCents), "on all bank account payments."),
38103
+ variant: "info",
38104
+ showQuitLink: false
38095
38105
  })));
38096
38106
  };
38097
38107
 
@@ -38148,6 +38158,7 @@ var PaymentFormCard = function PaymentFormCard(_ref) {
38148
38158
  fields = _ref.fields,
38149
38159
  actions = _ref.actions,
38150
38160
  showErrors = _ref.showErrors,
38161
+ fees = _ref.fees,
38151
38162
  _ref$handleSubmit = _ref.handleSubmit,
38152
38163
  handleSubmit = _ref$handleSubmit === void 0 ? noop : _ref$handleSubmit,
38153
38164
  isMobile = _ref.isMobile;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thecb/components",
3
- "version": "4.0.14-beta.0",
3
+ "version": "4.0.14",
4
4
  "description": "Common lib for CityBase react components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",
@@ -1,5 +1,6 @@
1
1
  import React, { useEffect, useState } from "react";
2
2
  import styled from "styled-components";
3
+ import { ifElse, isNil, always } from "ramda";
3
4
  import Checkbox from "../../atoms/checkbox";
4
5
  import {
5
6
  required,
@@ -13,8 +14,9 @@ import {
13
14
  FormInputColumn,
14
15
  FormContainer
15
16
  } from "../../atoms/form-layouts";
17
+ import Alert from "../../atoms/alert";
16
18
  import AccountAndRoutingModal from "../account-and-routing-modal";
17
- import { noop } from "../../../util/general";
19
+ import { displayCurrency, noop } from "../../../util/general";
18
20
 
19
21
  const ModalWrapper = styled.div``;
20
22
 
@@ -28,6 +30,7 @@ const PaymentFormACH = ({
28
30
  fields,
29
31
  actions,
30
32
  showErrors,
33
+ fees,
31
34
  handleSubmit = noop
32
35
  }) => {
33
36
  if (clearOnDismount) {
@@ -162,6 +165,22 @@ const PaymentFormACH = ({
162
165
  hidden={hideDefaultPayment}
163
166
  />
164
167
  )}
168
+ {!!fees?.value && (
169
+ <Alert
170
+ heading="Processing Fee"
171
+ text={`There is a processing fee of ${
172
+ fees.type === "FLAT"
173
+ ? `${displayCurrency(fees.value)}`
174
+ : `${fees.value * 100}%`
175
+ } ${ifElse(
176
+ isNil,
177
+ always(""),
178
+ a => `with a minimum of ${displayCurrency(a)} `
179
+ )(fees.minimumInCents)}on all bank account payments.`}
180
+ variant="info"
181
+ showQuitLink={false}
182
+ />
183
+ )}
165
184
  </FormInputColumn>
166
185
  </FormContainer>
167
186
  );
@@ -1,6 +1,7 @@
1
1
  import React, { useEffect } from "react";
2
2
  import { required, hasLength, matchesRegex } from "redux-freeform";
3
- import { checkCardBrand, noop } from "../../../util/general";
3
+ import { ifElse, isNil, always } from "ramda";
4
+ import { checkCardBrand, displayCurrency, noop } from "../../../util/general";
4
5
  import { expirationDateFormat, creditCardFormat } from "../../../util/formats";
5
6
  import {
6
7
  FormInput,
@@ -9,6 +10,7 @@ import {
9
10
  FormInputRow
10
11
  } from "../../atoms/form-layouts";
11
12
  import { Box } from "../../atoms/layouts";
13
+ import Alert from "../../atoms/alert";
12
14
 
13
15
  const nameOnCardErrors = {
14
16
  [required.error]: "Name is required"
@@ -38,6 +40,7 @@ const PaymentFormCard = ({
38
40
  fields,
39
41
  actions,
40
42
  showErrors,
43
+ fees,
41
44
  handleSubmit = noop,
42
45
  isMobile
43
46
  }) => {