@dmsi/wedgekit-react 0.0.151 → 0.0.153

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.
@@ -14,7 +14,8 @@ import {
14
14
  Checkbox
15
15
  } from "./chunk-WFQEE2OO.js";
16
16
  import {
17
- formatCurrencyDisplay
17
+ formatCurrencyDisplay,
18
+ formatDecimalValue
18
19
  } from "./chunk-5UH6QUFB.js";
19
20
  import {
20
21
  Subheader
@@ -136,7 +137,16 @@ function SelectPaymentMethod(props) {
136
137
  children: isPayLoading ? "Processing..." : "Submit Payment"
137
138
  }
138
139
  ),
139
- payAllWithCredits && /* @__PURE__ */ jsx(Button, { testid: testid ? `${testid}-submit-payment-button` : void 0, block: true, onClick: onPay, disabled: isPayLoading, children: isPayLoading ? "Processing..." : "Submit Payment" })
140
+ payAllWithCredits && /* @__PURE__ */ jsx(
141
+ Button,
142
+ {
143
+ testid: testid ? `${testid}-submit-payment-button` : void 0,
144
+ block: true,
145
+ onClick: onPay,
146
+ disabled: isPayLoading,
147
+ children: isPayLoading ? "Processing..." : "Submit Payment"
148
+ }
149
+ )
140
150
  ] });
141
151
  }
142
152
  function ACHSelector(props) {
@@ -227,12 +237,19 @@ function CreditsSelector(props) {
227
237
  )
228
238
  }
229
239
  ),
230
- /* @__PURE__ */ jsxs(Subheader, { testid: testid ? `${testid}-credit-${credits.InvoiceNumber}-InvoiceBalanceDue` : void 0, className: " pr-desktop-component-padding", children: [
231
- "$",
232
- formatCurrencyDisplay(
233
- `${Math.abs(credits.InvoiceBalanceDue)}`
234
- )
235
- ] })
240
+ /* @__PURE__ */ jsxs(
241
+ Subheader,
242
+ {
243
+ testid: testid ? `${testid}-credit-${credits.InvoiceNumber}-InvoiceBalanceDue` : void 0,
244
+ className: " pr-desktop-component-padding",
245
+ children: [
246
+ "$",
247
+ formatCurrencyDisplay(
248
+ formatDecimalValue(Math.abs(credits.InvoiceBalanceDue), 2)
249
+ )
250
+ ]
251
+ }
252
+ )
236
253
  ]
237
254
  },
238
255
  credits.AROpenGUID
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  SelectPaymentMethod
3
- } from "./chunk-ODWBREZN.js";
3
+ } from "./chunk-2VIJAGJ3.js";
4
4
  import {
5
5
  Modal
6
6
  } from "./chunk-5GOJRLQO.js";
@@ -121,7 +121,14 @@ export {
121
121
  parseInputDate,
122
122
  isValidDate,
123
123
  formatInputValue,
124
+ isDigit,
125
+ isSlash,
126
+ countDigitsUpToCursor,
127
+ findPositionAfterDigitCount,
124
128
  calculateCursorPosition,
129
+ parseDateParts,
130
+ isValidDateRange,
131
+ formatDatePartsToDisplay,
125
132
  formatDate,
126
133
  isValidDateRangeOrder
127
134
  };
@@ -4,7 +4,7 @@ import {
4
4
  formatInputValue,
5
5
  isValidDate,
6
6
  parseInputDate
7
- } from "../chunk-KHQX42T7.js";
7
+ } from "../chunk-IDN3IN2A.js";
8
8
  import {
9
9
  findDocumentRoot
10
10
  } from "../chunk-4T7F5BZZ.js";
@@ -5,7 +5,7 @@ import {
5
5
  isValidDate,
6
6
  isValidDateRangeOrder,
7
7
  parseInputDate
8
- } from "../chunk-KHQX42T7.js";
8
+ } from "../chunk-IDN3IN2A.js";
9
9
  import {
10
10
  findDocumentRoot
11
11
  } from "../chunk-4T7F5BZZ.js";
@@ -2170,7 +2170,16 @@ function SelectPaymentMethod(props) {
2170
2170
  children: isPayLoading ? "Processing..." : "Submit Payment"
2171
2171
  }
2172
2172
  ),
2173
- payAllWithCredits && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Button, { testid: testid ? `${testid}-submit-payment-button` : void 0, block: true, onClick: onPay, disabled: isPayLoading, children: isPayLoading ? "Processing..." : "Submit Payment" })
2173
+ payAllWithCredits && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2174
+ Button,
2175
+ {
2176
+ testid: testid ? `${testid}-submit-payment-button` : void 0,
2177
+ block: true,
2178
+ onClick: onPay,
2179
+ disabled: isPayLoading,
2180
+ children: isPayLoading ? "Processing..." : "Submit Payment"
2181
+ }
2182
+ )
2174
2183
  ] });
2175
2184
  }
2176
2185
  function ACHSelector(props) {
@@ -2261,12 +2270,19 @@ function CreditsSelector(props) {
2261
2270
  )
2262
2271
  }
2263
2272
  ),
2264
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Subheader, { testid: testid ? `${testid}-credit-${credits.InvoiceNumber}-InvoiceBalanceDue` : void 0, className: " pr-desktop-component-padding", children: [
2265
- "$",
2266
- formatCurrencyDisplay(
2267
- `${Math.abs(credits.InvoiceBalanceDue)}`
2268
- )
2269
- ] })
2273
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
2274
+ Subheader,
2275
+ {
2276
+ testid: testid ? `${testid}-credit-${credits.InvoiceNumber}-InvoiceBalanceDue` : void 0,
2277
+ className: " pr-desktop-component-padding",
2278
+ children: [
2279
+ "$",
2280
+ formatCurrencyDisplay(
2281
+ formatDecimalValue(Math.abs(credits.InvoiceBalanceDue), 2)
2282
+ )
2283
+ ]
2284
+ }
2285
+ )
2270
2286
  ]
2271
2287
  },
2272
2288
  credits.AROpenGUID
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  PaymentOnAccountModal,
3
3
  calculateSurcharge
4
- } from "../chunk-AMM762XG.js";
5
- import "../chunk-ODWBREZN.js";
4
+ } from "../chunk-FAGNATAJ.js";
5
+ import "../chunk-2VIJAGJ3.js";
6
6
  import "../chunk-WFGKIR5A.js";
7
7
  import "../chunk-BATIOCXB.js";
8
8
  import "../chunk-5GOJRLQO.js";
@@ -975,6 +975,19 @@ var Subheader = (_a) => {
975
975
  Subheader.displayName = "Subheader";
976
976
 
977
977
  // src/utils/formatting.tsx
978
+ function formatDecimalValue(value, decimals) {
979
+ if (!value || value === "") {
980
+ return "";
981
+ }
982
+ const numValue = typeof value === "string" ? parseFloat(value) : value;
983
+ if (isNaN(numValue)) {
984
+ return "";
985
+ }
986
+ if (!decimals || decimals <= 0) {
987
+ return String(Math.round(numValue));
988
+ }
989
+ return numValue.toFixed(decimals);
990
+ }
978
991
  function formatCurrencyDisplay(value) {
979
992
  if (!value || value === "") {
980
993
  return "";
@@ -1213,7 +1226,16 @@ function SelectPaymentMethod(props) {
1213
1226
  children: isPayLoading ? "Processing..." : "Submit Payment"
1214
1227
  }
1215
1228
  ),
1216
- payAllWithCredits && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Button, { testid: testid ? `${testid}-submit-payment-button` : void 0, block: true, onClick: onPay, disabled: isPayLoading, children: isPayLoading ? "Processing..." : "Submit Payment" })
1229
+ payAllWithCredits && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1230
+ Button,
1231
+ {
1232
+ testid: testid ? `${testid}-submit-payment-button` : void 0,
1233
+ block: true,
1234
+ onClick: onPay,
1235
+ disabled: isPayLoading,
1236
+ children: isPayLoading ? "Processing..." : "Submit Payment"
1237
+ }
1238
+ )
1217
1239
  ] });
1218
1240
  }
1219
1241
  function ACHSelector(props) {
@@ -1304,12 +1326,19 @@ function CreditsSelector(props) {
1304
1326
  )
1305
1327
  }
1306
1328
  ),
1307
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(Subheader, { testid: testid ? `${testid}-credit-${credits.InvoiceNumber}-InvoiceBalanceDue` : void 0, className: " pr-desktop-component-padding", children: [
1308
- "$",
1309
- formatCurrencyDisplay(
1310
- `${Math.abs(credits.InvoiceBalanceDue)}`
1311
- )
1312
- ] })
1329
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
1330
+ Subheader,
1331
+ {
1332
+ testid: testid ? `${testid}-credit-${credits.InvoiceNumber}-InvoiceBalanceDue` : void 0,
1333
+ className: " pr-desktop-component-padding",
1334
+ children: [
1335
+ "$",
1336
+ formatCurrencyDisplay(
1337
+ formatDecimalValue(Math.abs(credits.InvoiceBalanceDue), 2)
1338
+ )
1339
+ ]
1340
+ }
1341
+ )
1313
1342
  ]
1314
1343
  },
1315
1344
  credits.AROpenGUID
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import {
3
3
  SelectPaymentMethod
4
- } from "../chunk-ODWBREZN.js";
4
+ } from "../chunk-2VIJAGJ3.js";
5
5
  import "../chunk-WFGKIR5A.js";
6
6
  import "../chunk-BATIOCXB.js";
7
7
  import "../chunk-GG5JOFS6.js";
@@ -4766,7 +4766,16 @@ function SelectPaymentMethod(props) {
4766
4766
  children: isPayLoading ? "Processing..." : "Submit Payment"
4767
4767
  }
4768
4768
  ),
4769
- payAllWithCredits && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Button, { testid: testid ? `${testid}-submit-payment-button` : void 0, block: true, onClick: onPay, disabled: isPayLoading, children: isPayLoading ? "Processing..." : "Submit Payment" })
4769
+ payAllWithCredits && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
4770
+ Button,
4771
+ {
4772
+ testid: testid ? `${testid}-submit-payment-button` : void 0,
4773
+ block: true,
4774
+ onClick: onPay,
4775
+ disabled: isPayLoading,
4776
+ children: isPayLoading ? "Processing..." : "Submit Payment"
4777
+ }
4778
+ )
4770
4779
  ] });
4771
4780
  }
4772
4781
  function ACHSelector(props) {
@@ -4857,12 +4866,19 @@ function CreditsSelector(props) {
4857
4866
  )
4858
4867
  }
4859
4868
  ),
4860
- /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(Subheader, { testid: testid ? `${testid}-credit-${credits.InvoiceNumber}-InvoiceBalanceDue` : void 0, className: " pr-desktop-component-padding", children: [
4861
- "$",
4862
- formatCurrencyDisplay(
4863
- `${Math.abs(credits.InvoiceBalanceDue)}`
4864
- )
4865
- ] })
4869
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
4870
+ Subheader,
4871
+ {
4872
+ testid: testid ? `${testid}-credit-${credits.InvoiceNumber}-InvoiceBalanceDue` : void 0,
4873
+ className: " pr-desktop-component-padding",
4874
+ children: [
4875
+ "$",
4876
+ formatCurrencyDisplay(
4877
+ formatDecimalValue(Math.abs(credits.InvoiceBalanceDue), 2)
4878
+ )
4879
+ ]
4880
+ }
4881
+ )
4866
4882
  ]
4867
4883
  },
4868
4884
  credits.AROpenGUID
@@ -6,8 +6,8 @@ import {
6
6
  } from "../chunk-56Y5DDG3.js";
7
7
  import {
8
8
  PaymentOnAccountModal
9
- } from "../chunk-AMM762XG.js";
10
- import "../chunk-ODWBREZN.js";
9
+ } from "../chunk-FAGNATAJ.js";
10
+ import "../chunk-2VIJAGJ3.js";
11
11
  import "../chunk-WFGKIR5A.js";
12
12
  import "../chunk-BATIOCXB.js";
13
13
  import "../chunk-5GOJRLQO.js";
@@ -0,0 +1,211 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/utils/index.ts
21
+ var utils_exports = {};
22
+ __export(utils_exports, {
23
+ calculateCursorPosition: () => calculateCursorPosition,
24
+ countDigitsUpToCursor: () => countDigitsUpToCursor,
25
+ findPositionAfterDigitCount: () => findPositionAfterDigitCount,
26
+ formatCurrencyDisplay: () => formatCurrencyDisplay,
27
+ formatDate: () => formatDate,
28
+ formatDatePartsToDisplay: () => formatDatePartsToDisplay,
29
+ formatDecimalValue: () => formatDecimalValue,
30
+ formatInputValue: () => formatInputValue,
31
+ getDecimalPlaceholder: () => getDecimalPlaceholder,
32
+ isDigit: () => isDigit,
33
+ isSlash: () => isSlash,
34
+ isValidDate: () => isValidDate,
35
+ isValidDateRange: () => isValidDateRange,
36
+ isValidDateRangeOrder: () => isValidDateRangeOrder,
37
+ parseDateParts: () => parseDateParts,
38
+ parseInputDate: () => parseInputDate
39
+ });
40
+ module.exports = __toCommonJS(utils_exports);
41
+
42
+ // src/utils/formatting.tsx
43
+ function getDecimalPlaceholder(decimals) {
44
+ if (!decimals || decimals <= 0) {
45
+ return {};
46
+ }
47
+ return {
48
+ placeholder: `0.${"0".repeat(decimals)}`
49
+ };
50
+ }
51
+ function formatDecimalValue(value, decimals) {
52
+ if (!value || value === "") {
53
+ return "";
54
+ }
55
+ const numValue = typeof value === "string" ? parseFloat(value) : value;
56
+ if (isNaN(numValue)) {
57
+ return "";
58
+ }
59
+ if (!decimals || decimals <= 0) {
60
+ return String(Math.round(numValue));
61
+ }
62
+ return numValue.toFixed(decimals);
63
+ }
64
+ function formatCurrencyDisplay(value) {
65
+ if (!value || value === "") {
66
+ return "";
67
+ }
68
+ const parts = value.split(".");
69
+ const integerPart = parts[0];
70
+ const decimalPart = parts[1];
71
+ const formattedInteger = integerPart.replace(/\B(?=(\d{3})+(?!\d))/g, ",");
72
+ return decimalPart !== void 0 ? `${formattedInteger}.${decimalPart}` : formattedInteger;
73
+ }
74
+
75
+ // src/utils/date.ts
76
+ function parseInputDate(input) {
77
+ const match = input.match(/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/);
78
+ if (!match) {
79
+ return null;
80
+ }
81
+ const [, month, day, year] = match;
82
+ const paddedMonth = month.padStart(2, "0");
83
+ const paddedDay = day.padStart(2, "0");
84
+ return `${year}-${paddedMonth}-${paddedDay}`;
85
+ }
86
+ function isValidDate(dateString) {
87
+ const date = new Date(dateString);
88
+ return date instanceof Date && !isNaN(date.getTime()) && dateString === date.toISOString().split("T")[0];
89
+ }
90
+ function formatInputValue(value) {
91
+ const digits = value.replace(/\D/g, "");
92
+ if (digits.length < 2) {
93
+ return digits;
94
+ }
95
+ if (digits.length >= 4) {
96
+ return `${digits.slice(0, 2)}/${digits.slice(2, 4)}/${digits.slice(4, 8)}`;
97
+ }
98
+ return `${digits.slice(0, 2)}/${digits.slice(2)}`;
99
+ }
100
+ function isDigit(character) {
101
+ return /\d/.test(character);
102
+ }
103
+ function isSlash(character) {
104
+ return character === "/";
105
+ }
106
+ function countDigitsUpToCursor(value, cursorPosition) {
107
+ let digitCount = 0;
108
+ for (let i = 0; i < cursorPosition && i < value.length; i++) {
109
+ if (!isDigit(value[i])) {
110
+ continue;
111
+ }
112
+ digitCount++;
113
+ }
114
+ return digitCount;
115
+ }
116
+ function findPositionAfterDigitCount(formattedValue, targetDigitCount) {
117
+ let currentDigitCount = 0;
118
+ for (let i = 0; i < formattedValue.length; i++) {
119
+ if (!isDigit(formattedValue[i])) {
120
+ continue;
121
+ }
122
+ currentDigitCount++;
123
+ if (currentDigitCount !== targetDigitCount) {
124
+ continue;
125
+ }
126
+ const positionAfterDigit = i + 1;
127
+ const nextCharacter = formattedValue[positionAfterDigit];
128
+ if (nextCharacter && isSlash(nextCharacter)) {
129
+ return positionAfterDigit + 1;
130
+ }
131
+ return positionAfterDigit;
132
+ }
133
+ return formattedValue.length;
134
+ }
135
+ function calculateCursorPosition(originalValue, formattedValue, originalPosition) {
136
+ const targetDigitCount = countDigitsUpToCursor(originalValue, originalPosition);
137
+ const newPosition = findPositionAfterDigitCount(formattedValue, targetDigitCount);
138
+ return Math.min(newPosition, formattedValue.length);
139
+ }
140
+ function parseDateParts(dateString) {
141
+ const [yearStr, monthStr, dayStr] = dateString.split("-");
142
+ if (!yearStr || !monthStr || !dayStr) {
143
+ return null;
144
+ }
145
+ const year = parseInt(yearStr, 10);
146
+ const month = parseInt(monthStr, 10);
147
+ const day = parseInt(dayStr, 10);
148
+ if (isNaN(year) || isNaN(month) || isNaN(day)) {
149
+ return null;
150
+ }
151
+ return { year, month, day };
152
+ }
153
+ function isValidDateRange(month, day) {
154
+ if (month < 1 || month > 12) {
155
+ return false;
156
+ }
157
+ if (day < 1 || day > 31) {
158
+ return false;
159
+ }
160
+ return true;
161
+ }
162
+ function formatDatePartsToDisplay(year, month, day) {
163
+ const paddedMonth = month.toString().padStart(2, "0");
164
+ const paddedDay = day.toString().padStart(2, "0");
165
+ return `${paddedMonth}/${paddedDay}/${year}`;
166
+ }
167
+ function formatDate(date) {
168
+ if (!date) {
169
+ return "";
170
+ }
171
+ try {
172
+ const dateParts = parseDateParts(date);
173
+ if (!dateParts) {
174
+ return "";
175
+ }
176
+ const { year, month, day } = dateParts;
177
+ if (!isValidDateRange(month, day)) {
178
+ return "";
179
+ }
180
+ return formatDatePartsToDisplay(year, month, day);
181
+ } catch (error) {
182
+ return "";
183
+ }
184
+ }
185
+ function isValidDateRangeOrder(fromDate, toDate) {
186
+ if (!fromDate || !toDate || !isValidDate(fromDate) || !isValidDate(toDate)) {
187
+ return false;
188
+ }
189
+ const from = new Date(fromDate);
190
+ const to = new Date(toDate);
191
+ return to >= from;
192
+ }
193
+ // Annotate the CommonJS export names for ESM import in node:
194
+ 0 && (module.exports = {
195
+ calculateCursorPosition,
196
+ countDigitsUpToCursor,
197
+ findPositionAfterDigitCount,
198
+ formatCurrencyDisplay,
199
+ formatDate,
200
+ formatDatePartsToDisplay,
201
+ formatDecimalValue,
202
+ formatInputValue,
203
+ getDecimalPlaceholder,
204
+ isDigit,
205
+ isSlash,
206
+ isValidDate,
207
+ isValidDateRange,
208
+ isValidDateRangeOrder,
209
+ parseDateParts,
210
+ parseInputDate
211
+ });
@@ -0,0 +1,39 @@
1
+ import {
2
+ calculateCursorPosition,
3
+ countDigitsUpToCursor,
4
+ findPositionAfterDigitCount,
5
+ formatDate,
6
+ formatDatePartsToDisplay,
7
+ formatInputValue,
8
+ isDigit,
9
+ isSlash,
10
+ isValidDate,
11
+ isValidDateRange,
12
+ isValidDateRangeOrder,
13
+ parseDateParts,
14
+ parseInputDate
15
+ } from "../chunk-IDN3IN2A.js";
16
+ import {
17
+ formatCurrencyDisplay,
18
+ formatDecimalValue,
19
+ getDecimalPlaceholder
20
+ } from "../chunk-5UH6QUFB.js";
21
+ import "../chunk-ORMEWXMH.js";
22
+ export {
23
+ calculateCursorPosition,
24
+ countDigitsUpToCursor,
25
+ findPositionAfterDigitCount,
26
+ formatCurrencyDisplay,
27
+ formatDate,
28
+ formatDatePartsToDisplay,
29
+ formatDecimalValue,
30
+ formatInputValue,
31
+ getDecimalPlaceholder,
32
+ isDigit,
33
+ isSlash,
34
+ isValidDate,
35
+ isValidDateRange,
36
+ isValidDateRangeOrder,
37
+ parseDateParts,
38
+ parseInputDate
39
+ };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dmsi/wedgekit-react",
3
3
  "private": false,
4
- "version": "0.0.151",
4
+ "version": "0.0.153",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "build": "tsup",
@@ -37,6 +37,11 @@
37
37
  "import": "./dist/types.js",
38
38
  "require": "./dist/types.cjs"
39
39
  },
40
+ "./utils": {
41
+ "types": "./src/utils/index.ts",
42
+ "import": "./dist/utils/index.js",
43
+ "require": "./dist/utils/index.cjs"
44
+ },
40
45
  "./styles.css": "./dist/index.css",
41
46
  "./fonts.css": "./dist/fonts.css",
42
47
  "./package.json": "./package.json"
@@ -8,7 +8,7 @@ import { Radio } from "./Radio";
8
8
  import { Stack } from "./Stack";
9
9
  import { Checkbox } from "./Checkbox";
10
10
  import { Subheader } from "./Subheader";
11
- import { formatCurrencyDisplay } from "../utils/formatting";
11
+ import { formatCurrencyDisplay, formatDecimalValue } from "../utils/formatting";
12
12
  import { HorizontalDivider } from "./HorizontalDivider";
13
13
  import { Spinner } from "./Spinner";
14
14
  import { WorldpayIframe } from "./WorldpayIframe";
@@ -60,7 +60,7 @@ export function SelectPaymentMethod(props: SelectPaymentMethodProps) {
60
60
  withCredits = false,
61
61
  isLoadingCCiframe,
62
62
  cardPaymentUrl,
63
- testid
63
+ testid,
64
64
  } = props;
65
65
 
66
66
  const payAllWithCredits = withCredits && amountToPay <= 0;
@@ -148,7 +148,12 @@ export function SelectPaymentMethod(props: SelectPaymentMethodProps) {
148
148
  </Button>
149
149
  )}
150
150
  {payAllWithCredits && (
151
- <Button testid={testid ? `${testid}-submit-payment-button` : undefined} block onClick={onPay} disabled={isPayLoading}>
151
+ <Button
152
+ testid={testid ? `${testid}-submit-payment-button` : undefined}
153
+ block
154
+ onClick={onPay}
155
+ disabled={isPayLoading}
156
+ >
152
157
  {isPayLoading ? "Processing..." : "Submit Payment"}
153
158
  </Button>
154
159
  )}
@@ -175,7 +180,7 @@ function ACHSelector(props: ACHSelectorProps) {
175
180
  setSelectedBankGuid,
176
181
  customerBanks,
177
182
  disabled,
178
- testid
183
+ testid,
179
184
  } = props;
180
185
 
181
186
  function handleBankSelect(
@@ -220,7 +225,7 @@ type CreditsSelectorProps = {
220
225
  selectedCredits: unknown[];
221
226
  allCredits: unknown[];
222
227
  setSelectedCredits: React.Dispatch<React.SetStateAction<unknown[]>>;
223
- testid?: string
228
+ testid?: string;
224
229
  };
225
230
  function CreditsSelector(props: CreditsSelectorProps) {
226
231
  const { selectedCredits, allCredits, setSelectedCredits, testid } = props;
@@ -270,20 +275,35 @@ function CreditsSelector(props: CreditsSelectorProps) {
270
275
  onClick={() => handleCreditSelect(credits)}
271
276
  paddingY
272
277
  flexGrow={1}
273
- testid={testid ? `${testid}-credit-${credits.InvoiceNumber}` : undefined}
278
+ testid={
279
+ testid
280
+ ? `${testid}-credit-${credits.InvoiceNumber}`
281
+ : undefined
282
+ }
274
283
  >
275
284
  <Checkbox
276
- testid={testid ? `${testid}-credit-${credits.InvoiceNumber}-checkbox` : undefined}
285
+ testid={
286
+ testid
287
+ ? `${testid}-credit-${credits.InvoiceNumber}-checkbox`
288
+ : undefined
289
+ }
277
290
  label={credits.InvoiceNumber}
278
291
  checked={selectedCredits?.includes(credits)}
279
292
  onChange={() => handleCreditSelect(credits)}
280
293
  />
281
294
  </Stack>
282
295
 
283
- <Subheader testid={testid ? `${testid}-credit-${credits.InvoiceNumber}-InvoiceBalanceDue` : undefined} className=" pr-desktop-component-padding">
296
+ <Subheader
297
+ testid={
298
+ testid
299
+ ? `${testid}-credit-${credits.InvoiceNumber}-InvoiceBalanceDue`
300
+ : undefined
301
+ }
302
+ className=" pr-desktop-component-padding"
303
+ >
284
304
  $
285
305
  {formatCurrencyDisplay(
286
- `${Math.abs(credits.InvoiceBalanceDue)}`,
306
+ formatDecimalValue(Math.abs(credits.InvoiceBalanceDue), 2),
287
307
  )}
288
308
  </Subheader>
289
309
  </Stack>
@@ -0,0 +1,2 @@
1
+ export * from "./formatting";
2
+ export * from "./date";