@dmsi/wedgekit-react 0.0.136 → 0.0.137
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/{chunk-XEUPUTYP.js → chunk-QTD7K43M.js} +3 -2
- package/dist/{chunk-EQQMFT5H.js → chunk-XCIBYDVK.js} +41 -8
- package/dist/{chunk-DIMHNC5S.js → chunk-Z36QJ7ZF.js} +14 -3
- package/dist/components/Accordion.cjs +3 -2
- package/dist/components/Accordion.js +1 -1
- package/dist/components/PaymentOnAccountModal.cjs +187 -36
- package/dist/components/PaymentOnAccountModal.js +4 -3
- package/dist/components/SelectPaymentMethod.cjs +165 -25
- package/dist/components/SelectPaymentMethod.js +3 -2
- package/dist/components/index.cjs +187 -36
- package/dist/components/index.js +4 -3
- package/package.json +1 -1
- package/src/components/Accordion.tsx +4 -2
- package/src/components/PaymentOnAccountModal.tsx +16 -2
- package/src/components/SelectPaymentMethod.tsx +35 -8
|
@@ -4232,7 +4232,7 @@ var import_react20 = require("react");
|
|
|
4232
4232
|
var import_clsx27 = __toESM(require("clsx"), 1);
|
|
4233
4233
|
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
4234
4234
|
function Accordion(props) {
|
|
4235
|
-
const { isOpen, onClick, className } = props;
|
|
4235
|
+
const { isOpen, onClick, className, disabled } = props;
|
|
4236
4236
|
const {
|
|
4237
4237
|
title,
|
|
4238
4238
|
before,
|
|
@@ -4257,7 +4257,8 @@ function Accordion(props) {
|
|
|
4257
4257
|
Card,
|
|
4258
4258
|
{
|
|
4259
4259
|
className: (0, import_clsx27.default)(
|
|
4260
|
-
"overflow-hidden select-none
|
|
4260
|
+
"overflow-hidden select-none",
|
|
4261
|
+
{ "cursor-pointer": !disabled },
|
|
4261
4262
|
className
|
|
4262
4263
|
),
|
|
4263
4264
|
selected: isOpen,
|
|
@@ -4424,8 +4425,117 @@ function HorizontalDivider({ id, hideOnMobile }) {
|
|
|
4424
4425
|
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("hr", { id, className: (0, import_clsx29.default)("w-full border-t border-border-primary-normal", hideOnMobileStyle) });
|
|
4425
4426
|
}
|
|
4426
4427
|
|
|
4427
|
-
// src/components/
|
|
4428
|
+
// src/components/Spinner.tsx
|
|
4428
4429
|
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
4430
|
+
var Spinner = ({ size = "small" }) => {
|
|
4431
|
+
const dimension = size === "large" ? 48 : 24;
|
|
4432
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
|
|
4433
|
+
"svg",
|
|
4434
|
+
{
|
|
4435
|
+
width: dimension,
|
|
4436
|
+
height: dimension,
|
|
4437
|
+
viewBox: "0 0 24 24",
|
|
4438
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
4439
|
+
fill: "#1D1E1E",
|
|
4440
|
+
className: size === "large" ? "animate-spin" : "",
|
|
4441
|
+
"aria-label": "Loading",
|
|
4442
|
+
children: [
|
|
4443
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("circle", { cx: "12", cy: "4", r: "2", opacity: "1", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
4444
|
+
"animate",
|
|
4445
|
+
{
|
|
4446
|
+
attributeName: "opacity",
|
|
4447
|
+
begin: "0s",
|
|
4448
|
+
dur: "1s",
|
|
4449
|
+
from: "1",
|
|
4450
|
+
to: "0",
|
|
4451
|
+
repeatCount: "indefinite"
|
|
4452
|
+
}
|
|
4453
|
+
) }),
|
|
4454
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("circle", { cx: "17.666", cy: "6.334", r: "2", opacity: "0.125", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
4455
|
+
"animate",
|
|
4456
|
+
{
|
|
4457
|
+
attributeName: "opacity",
|
|
4458
|
+
begin: "-0.875s",
|
|
4459
|
+
dur: "1s",
|
|
4460
|
+
from: "1",
|
|
4461
|
+
to: "0",
|
|
4462
|
+
repeatCount: "indefinite"
|
|
4463
|
+
}
|
|
4464
|
+
) }),
|
|
4465
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("circle", { cx: "20", cy: "12", r: "2", opacity: "0.25", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
4466
|
+
"animate",
|
|
4467
|
+
{
|
|
4468
|
+
attributeName: "opacity",
|
|
4469
|
+
begin: "-0.75s",
|
|
4470
|
+
dur: "1s",
|
|
4471
|
+
from: "1",
|
|
4472
|
+
to: "0",
|
|
4473
|
+
repeatCount: "indefinite"
|
|
4474
|
+
}
|
|
4475
|
+
) }),
|
|
4476
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("circle", { cx: "17.666", cy: "17.666", r: "2", opacity: "0.375", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
4477
|
+
"animate",
|
|
4478
|
+
{
|
|
4479
|
+
attributeName: "opacity",
|
|
4480
|
+
begin: "-0.625s",
|
|
4481
|
+
dur: "1s",
|
|
4482
|
+
from: "1",
|
|
4483
|
+
to: "0",
|
|
4484
|
+
repeatCount: "indefinite"
|
|
4485
|
+
}
|
|
4486
|
+
) }),
|
|
4487
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("circle", { cx: "12", cy: "20", r: "2", opacity: "0.5", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
4488
|
+
"animate",
|
|
4489
|
+
{
|
|
4490
|
+
attributeName: "opacity",
|
|
4491
|
+
begin: "-0.5s",
|
|
4492
|
+
dur: "1s",
|
|
4493
|
+
from: "1",
|
|
4494
|
+
to: "0",
|
|
4495
|
+
repeatCount: "indefinite"
|
|
4496
|
+
}
|
|
4497
|
+
) }),
|
|
4498
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("circle", { cx: "6.334", cy: "17.666", r: "2", opacity: "0.625", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
4499
|
+
"animate",
|
|
4500
|
+
{
|
|
4501
|
+
attributeName: "opacity",
|
|
4502
|
+
begin: "-0.375s",
|
|
4503
|
+
dur: "1s",
|
|
4504
|
+
from: "1",
|
|
4505
|
+
to: "0",
|
|
4506
|
+
repeatCount: "indefinite"
|
|
4507
|
+
}
|
|
4508
|
+
) }),
|
|
4509
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("circle", { cx: "4", cy: "12", r: "2", opacity: "0.75", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
4510
|
+
"animate",
|
|
4511
|
+
{
|
|
4512
|
+
attributeName: "opacity",
|
|
4513
|
+
begin: "-0.25s",
|
|
4514
|
+
dur: "1s",
|
|
4515
|
+
from: "1",
|
|
4516
|
+
to: "0",
|
|
4517
|
+
repeatCount: "indefinite"
|
|
4518
|
+
}
|
|
4519
|
+
) }),
|
|
4520
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("circle", { cx: "6.334", cy: "6.334", r: "2", opacity: "0.875", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
4521
|
+
"animate",
|
|
4522
|
+
{
|
|
4523
|
+
attributeName: "opacity",
|
|
4524
|
+
begin: "-0.125s",
|
|
4525
|
+
dur: "1s",
|
|
4526
|
+
from: "1",
|
|
4527
|
+
to: "0",
|
|
4528
|
+
repeatCount: "indefinite"
|
|
4529
|
+
}
|
|
4530
|
+
) })
|
|
4531
|
+
]
|
|
4532
|
+
}
|
|
4533
|
+
);
|
|
4534
|
+
};
|
|
4535
|
+
Spinner.displayName = "Spinner";
|
|
4536
|
+
|
|
4537
|
+
// src/components/SelectPaymentMethod.tsx
|
|
4538
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
4429
4539
|
function SelectPaymentMethod(props) {
|
|
4430
4540
|
const {
|
|
4431
4541
|
amountToPay,
|
|
@@ -4439,7 +4549,9 @@ function SelectPaymentMethod(props) {
|
|
|
4439
4549
|
customerBanks,
|
|
4440
4550
|
onPay,
|
|
4441
4551
|
isPayLoading,
|
|
4442
|
-
withCredits = false
|
|
4552
|
+
withCredits = false,
|
|
4553
|
+
isLoadingCCiframe,
|
|
4554
|
+
cardPaymentUrl
|
|
4443
4555
|
} = props;
|
|
4444
4556
|
const payAllWithCredits = withCredits && amountToPay <= 0;
|
|
4445
4557
|
(0, import_react20.useEffect)(() => {
|
|
@@ -4448,12 +4560,12 @@ function SelectPaymentMethod(props) {
|
|
|
4448
4560
|
} else {
|
|
4449
4561
|
onSelectMethod("ACHPayment");
|
|
4450
4562
|
}
|
|
4451
|
-
}, [payAllWithCredits]);
|
|
4563
|
+
}, [onSelectMethod, payAllWithCredits]);
|
|
4452
4564
|
function handleToggle(method) {
|
|
4453
4565
|
onSelectMethod(method);
|
|
4454
4566
|
}
|
|
4455
|
-
return /* @__PURE__ */ (0,
|
|
4456
|
-
!!(allCredits == null ? void 0 : allCredits.length) && withCredits && /* @__PURE__ */ (0,
|
|
4567
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(Stack, { sizing: "layout-group", width: "full", minWidth: 400, children: [
|
|
4568
|
+
!!(allCredits == null ? void 0 : allCredits.length) && withCredits && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
4457
4569
|
CreditsSelector,
|
|
4458
4570
|
{
|
|
4459
4571
|
selectedCredits: selectedCredits || [],
|
|
@@ -4462,7 +4574,7 @@ function SelectPaymentMethod(props) {
|
|
|
4462
4574
|
})
|
|
4463
4575
|
}
|
|
4464
4576
|
),
|
|
4465
|
-
(allowedMethods == null ? void 0 : allowedMethods.includes("ACHPayment")) && !!(customerBanks == null ? void 0 : customerBanks.length) && /* @__PURE__ */ (0,
|
|
4577
|
+
(allowedMethods == null ? void 0 : allowedMethods.includes("ACHPayment")) && !!(customerBanks == null ? void 0 : customerBanks.length) && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
4466
4578
|
ACHSelector,
|
|
4467
4579
|
{
|
|
4468
4580
|
selectedMethod,
|
|
@@ -4473,31 +4585,59 @@ function SelectPaymentMethod(props) {
|
|
|
4473
4585
|
customerBanks: customerBanks || [],
|
|
4474
4586
|
onPay,
|
|
4475
4587
|
isPayLoading: isPayLoading || false,
|
|
4476
|
-
disabled: payAllWithCredits
|
|
4588
|
+
disabled: payAllWithCredits || !amountToPay
|
|
4477
4589
|
}
|
|
4478
4590
|
),
|
|
4479
|
-
(allowedMethods == null ? void 0 : allowedMethods.includes("CCPayment")) && /* @__PURE__ */ (0,
|
|
4591
|
+
(allowedMethods == null ? void 0 : allowedMethods.includes("CCPayment")) && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
4480
4592
|
Accordion,
|
|
4481
4593
|
{
|
|
4482
4594
|
isOpen: !payAllWithCredits && selectedMethod === "CCPayment",
|
|
4483
|
-
title: /* @__PURE__ */ (0,
|
|
4595
|
+
title: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
4484
4596
|
Radio,
|
|
4485
4597
|
{
|
|
4486
4598
|
label: "Pay by Credit/Debit Card",
|
|
4487
4599
|
checked: !payAllWithCredits && selectedMethod === "CCPayment",
|
|
4488
4600
|
onChange: (e) => e.stopPropagation(),
|
|
4489
|
-
disabled:
|
|
4601
|
+
disabled: payAllWithCredits || !amountToPay
|
|
4490
4602
|
}
|
|
4491
4603
|
),
|
|
4492
4604
|
onClick: () => {
|
|
4493
|
-
if (payAllWithCredits) return;
|
|
4605
|
+
if (payAllWithCredits || !amountToPay) return;
|
|
4494
4606
|
handleToggle(selectedMethod === "CCPayment" ? null : "CCPayment");
|
|
4495
4607
|
},
|
|
4496
|
-
|
|
4608
|
+
disabled: payAllWithCredits || !amountToPay,
|
|
4609
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
4610
|
+
Stack,
|
|
4611
|
+
{
|
|
4612
|
+
sizing: "layout-group",
|
|
4613
|
+
width: "full",
|
|
4614
|
+
items: "center",
|
|
4615
|
+
justify: "center",
|
|
4616
|
+
style: {
|
|
4617
|
+
flex: 1
|
|
4618
|
+
},
|
|
4619
|
+
minHeight: 245,
|
|
4620
|
+
children: !isLoadingCCiframe && cardPaymentUrl ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
4621
|
+
"iframe",
|
|
4622
|
+
{
|
|
4623
|
+
src: cardPaymentUrl,
|
|
4624
|
+
style: { width: "100%", height: "100%", flex: 1 }
|
|
4625
|
+
}
|
|
4626
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Spinner, {})
|
|
4627
|
+
}
|
|
4628
|
+
)
|
|
4629
|
+
}
|
|
4630
|
+
),
|
|
4631
|
+
selectedMethod === "ACHPayment" && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
4632
|
+
Button,
|
|
4633
|
+
{
|
|
4634
|
+
block: true,
|
|
4635
|
+
onClick: onPay,
|
|
4636
|
+
disabled: isPayLoading || amountToPay <= 0,
|
|
4637
|
+
children: isPayLoading ? "Processing..." : "Submit Payment"
|
|
4497
4638
|
}
|
|
4498
4639
|
),
|
|
4499
|
-
|
|
4500
|
-
payAllWithCredits && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Button, { block: true, onClick: onPay, disabled: isPayLoading, children: isPayLoading ? "Processing..." : "Submit Payment" })
|
|
4640
|
+
payAllWithCredits && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Button, { block: true, onClick: onPay, disabled: isPayLoading, children: isPayLoading ? "Processing..." : "Submit Payment" })
|
|
4501
4641
|
] });
|
|
4502
4642
|
}
|
|
4503
4643
|
function ACHSelector(props) {
|
|
@@ -4515,12 +4655,12 @@ function ACHSelector(props) {
|
|
|
4515
4655
|
setSelectedBankGuid(bankGuid);
|
|
4516
4656
|
handleToggle("ACHPayment");
|
|
4517
4657
|
}
|
|
4518
|
-
return /* @__PURE__ */ (0,
|
|
4658
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_jsx_runtime34.Fragment, { children: customerBanks.map((bank) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
4519
4659
|
Card,
|
|
4520
4660
|
{
|
|
4521
4661
|
onClick: (e) => handleBankSelect(e, bank.CustBankGUID),
|
|
4522
4662
|
selected: !disabled && selectedMethod === "ACHPayment" && selectedBankGuid === bank.CustBankGUID,
|
|
4523
|
-
children: /* @__PURE__ */ (0,
|
|
4663
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
4524
4664
|
Radio,
|
|
4525
4665
|
{
|
|
4526
4666
|
label: `Pay by ${bank.AccountDisplayString}`,
|
|
@@ -4543,22 +4683,22 @@ function CreditsSelector(props) {
|
|
|
4543
4683
|
);
|
|
4544
4684
|
}
|
|
4545
4685
|
};
|
|
4546
|
-
return /* @__PURE__ */ (0,
|
|
4686
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
4547
4687
|
Accordion,
|
|
4548
4688
|
{
|
|
4549
4689
|
isOpen,
|
|
4550
4690
|
title: "Available Credits",
|
|
4551
4691
|
onClick: () => setIsOpen((prev) => !prev),
|
|
4552
4692
|
children: [
|
|
4553
|
-
/* @__PURE__ */ (0,
|
|
4554
|
-
/* @__PURE__ */ (0,
|
|
4693
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(HorizontalDivider, {}),
|
|
4694
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Stack, { sizing: "layout-group", width: "full", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
4555
4695
|
Stack,
|
|
4556
4696
|
{
|
|
4557
4697
|
sizing: "layout-group",
|
|
4558
4698
|
width: "full",
|
|
4559
4699
|
overflowY: "auto",
|
|
4560
4700
|
maxHeight: 300,
|
|
4561
|
-
children: allCredits.map((credits) => /* @__PURE__ */ (0,
|
|
4701
|
+
children: allCredits.map((credits) => /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
4562
4702
|
Stack,
|
|
4563
4703
|
{
|
|
4564
4704
|
horizontal: true,
|
|
@@ -4566,14 +4706,14 @@ function CreditsSelector(props) {
|
|
|
4566
4706
|
items: "center",
|
|
4567
4707
|
sizing: "layout-group",
|
|
4568
4708
|
children: [
|
|
4569
|
-
/* @__PURE__ */ (0,
|
|
4709
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
4570
4710
|
Stack,
|
|
4571
4711
|
{
|
|
4572
4712
|
sizing: "layout-group",
|
|
4573
4713
|
onClick: () => handleCreditSelect(credits),
|
|
4574
4714
|
paddingY: true,
|
|
4575
4715
|
flexGrow: 1,
|
|
4576
|
-
children: /* @__PURE__ */ (0,
|
|
4716
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
4577
4717
|
Checkbox,
|
|
4578
4718
|
{
|
|
4579
4719
|
label: credits.InvoiceNumber,
|
|
@@ -4583,7 +4723,7 @@ function CreditsSelector(props) {
|
|
|
4583
4723
|
)
|
|
4584
4724
|
}
|
|
4585
4725
|
),
|
|
4586
|
-
/* @__PURE__ */ (0,
|
|
4726
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(Subheader, { className: " pr-desktop-component-padding", children: [
|
|
4587
4727
|
"$",
|
|
4588
4728
|
formatCurrencyDisplay(
|
|
4589
4729
|
`${Math.abs(credits.InvoiceBalanceDue)}`
|
|
@@ -4601,9 +4741,17 @@ function CreditsSelector(props) {
|
|
|
4601
4741
|
}
|
|
4602
4742
|
|
|
4603
4743
|
// src/components/PaymentOnAccountModal.tsx
|
|
4604
|
-
var
|
|
4744
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
4605
4745
|
function PaymentOnAccountModal(props) {
|
|
4606
|
-
const {
|
|
4746
|
+
const {
|
|
4747
|
+
isOpen,
|
|
4748
|
+
paymentProps,
|
|
4749
|
+
onClose,
|
|
4750
|
+
onAmountChange,
|
|
4751
|
+
cardPaymentUrl,
|
|
4752
|
+
setCardPaymentUrl,
|
|
4753
|
+
isLoadingCCiframe
|
|
4754
|
+
} = props;
|
|
4607
4755
|
const [amount, setAmount] = (0, import_react21.useState)(paymentProps.amountToPay);
|
|
4608
4756
|
const { creditCardSettings, selectedMethod } = paymentProps;
|
|
4609
4757
|
(0, import_react21.useEffect)(() => {
|
|
@@ -4630,17 +4778,17 @@ function PaymentOnAccountModal(props) {
|
|
|
4630
4778
|
}
|
|
4631
4779
|
return 0;
|
|
4632
4780
|
}, [creditCardSettings, amount, selectedMethod]);
|
|
4633
|
-
return /* @__PURE__ */ (0,
|
|
4634
|
-
selectedMethod === "CCPayment" && /* @__PURE__ */ (0,
|
|
4635
|
-
/* @__PURE__ */ (0,
|
|
4636
|
-
/* @__PURE__ */ (0,
|
|
4781
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Modal, { open: isOpen, onClose, title: "Payment on Account", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(Stack, { sizing: "layout-group", width: "full", children: [
|
|
4782
|
+
selectedMethod === "CCPayment" && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(Stack, { horizontal: true, justify: "between", items: "center", children: [
|
|
4783
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Paragraph, { children: "Surcharge" }),
|
|
4784
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(Paragraph, { children: [
|
|
4637
4785
|
"$",
|
|
4638
4786
|
formatCurrencyDisplay(creditCardSurcharge.toFixed(2))
|
|
4639
4787
|
] })
|
|
4640
4788
|
] }),
|
|
4641
|
-
/* @__PURE__ */ (0,
|
|
4642
|
-
/* @__PURE__ */ (0,
|
|
4643
|
-
/* @__PURE__ */ (0,
|
|
4789
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Card, { className: "py-desktop-component-padding", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(Stack, { sizing: "component", justify: "between", items: "center", horizontal: true, children: [
|
|
4790
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Paragraph, { className: "w-full", children: "Amount to Pay" }),
|
|
4791
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
4644
4792
|
Input,
|
|
4645
4793
|
{
|
|
4646
4794
|
type: "number",
|
|
@@ -4652,10 +4800,13 @@ function PaymentOnAccountModal(props) {
|
|
|
4652
4800
|
}
|
|
4653
4801
|
) })
|
|
4654
4802
|
] }) }),
|
|
4655
|
-
/* @__PURE__ */ (0,
|
|
4803
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
4656
4804
|
SelectPaymentMethod,
|
|
4657
4805
|
__spreadProps(__spreadValues({}, paymentProps), {
|
|
4658
|
-
amountToPay: amount + creditCardSurcharge
|
|
4806
|
+
amountToPay: amount + creditCardSurcharge,
|
|
4807
|
+
cardPaymentUrl,
|
|
4808
|
+
setCardPaymentUrl,
|
|
4809
|
+
isLoadingCCiframe
|
|
4659
4810
|
})
|
|
4660
4811
|
)
|
|
4661
4812
|
] }) });
|
package/dist/components/index.js
CHANGED
|
@@ -6,8 +6,8 @@ import {
|
|
|
6
6
|
} from "../chunk-Y4HUYAI5.js";
|
|
7
7
|
import {
|
|
8
8
|
PaymentOnAccountModal
|
|
9
|
-
} from "../chunk-
|
|
10
|
-
import "../chunk-
|
|
9
|
+
} from "../chunk-Z36QJ7ZF.js";
|
|
10
|
+
import "../chunk-XCIBYDVK.js";
|
|
11
11
|
import "../chunk-TTO4PL7Y.js";
|
|
12
12
|
import "../chunk-D2YP2BTN.js";
|
|
13
13
|
import "../chunk-4RJKB7LC.js";
|
|
@@ -15,6 +15,7 @@ import "../chunk-CG2NIXZE.js";
|
|
|
15
15
|
import "../chunk-FWPJ73IK.js";
|
|
16
16
|
import "../chunk-6UI5GABI.js";
|
|
17
17
|
import "../chunk-4JLU7TAC.js";
|
|
18
|
+
import "../chunk-4F6VQXKY.js";
|
|
18
19
|
import "../chunk-J6LETUNM.js";
|
|
19
20
|
import "../chunk-3ZUSYRI7.js";
|
|
20
21
|
import {
|
|
@@ -53,7 +54,7 @@ import {
|
|
|
53
54
|
} from "../chunk-O4M2GISS.js";
|
|
54
55
|
import {
|
|
55
56
|
Accordion
|
|
56
|
-
} from "../chunk-
|
|
57
|
+
} from "../chunk-QTD7K43M.js";
|
|
57
58
|
import "../chunk-EO3JJWFW.js";
|
|
58
59
|
import {
|
|
59
60
|
Card
|
package/package.json
CHANGED
|
@@ -15,10 +15,11 @@ interface AccordionProps {
|
|
|
15
15
|
after?: React.ReactNode;
|
|
16
16
|
onClick?: () => void;
|
|
17
17
|
className?: string;
|
|
18
|
+
disabled?: boolean;
|
|
18
19
|
}
|
|
19
20
|
|
|
20
21
|
export function Accordion(props: AccordionProps) {
|
|
21
|
-
const { isOpen, onClick, className } = props;
|
|
22
|
+
const { isOpen, onClick, className, disabled } = props;
|
|
22
23
|
const {
|
|
23
24
|
title,
|
|
24
25
|
before,
|
|
@@ -43,7 +44,8 @@ export function Accordion(props: AccordionProps) {
|
|
|
43
44
|
return (
|
|
44
45
|
<Card
|
|
45
46
|
className={clsx(
|
|
46
|
-
"overflow-hidden select-none
|
|
47
|
+
"overflow-hidden select-none",
|
|
48
|
+
{ "cursor-pointer": !disabled },
|
|
47
49
|
className,
|
|
48
50
|
)}
|
|
49
51
|
selected={isOpen}
|
|
@@ -15,9 +15,20 @@ type PaymentOnAccountModalProps = {
|
|
|
15
15
|
onClose: () => void;
|
|
16
16
|
paymentProps: SelectPaymentMethodProps;
|
|
17
17
|
onAmountChange?: (amount: number) => void;
|
|
18
|
+
cardPaymentUrl: string | null;
|
|
19
|
+
setCardPaymentUrl: (url: string | null) => void;
|
|
20
|
+
isLoadingCCiframe?: boolean;
|
|
18
21
|
};
|
|
19
22
|
export function PaymentOnAccountModal(props: PaymentOnAccountModalProps) {
|
|
20
|
-
const {
|
|
23
|
+
const {
|
|
24
|
+
isOpen,
|
|
25
|
+
paymentProps,
|
|
26
|
+
onClose,
|
|
27
|
+
onAmountChange,
|
|
28
|
+
cardPaymentUrl,
|
|
29
|
+
setCardPaymentUrl,
|
|
30
|
+
isLoadingCCiframe,
|
|
31
|
+
} = props;
|
|
21
32
|
const [amount, setAmount] = useState<number>(paymentProps.amountToPay);
|
|
22
33
|
const { creditCardSettings, selectedMethod } =
|
|
23
34
|
paymentProps as typeof paymentProps & {
|
|
@@ -36,7 +47,7 @@ export function PaymentOnAccountModal(props: PaymentOnAccountModalProps) {
|
|
|
36
47
|
const inputValue = event.target.value.replace(/[^0-9.-]+/g, "");
|
|
37
48
|
const value = +inputValue || 0;
|
|
38
49
|
setAmount(value);
|
|
39
|
-
onAmountChange?.(value)
|
|
50
|
+
onAmountChange?.(value);
|
|
40
51
|
}
|
|
41
52
|
|
|
42
53
|
const creditCardSurcharge = useMemo(() => {
|
|
@@ -85,6 +96,9 @@ export function PaymentOnAccountModal(props: PaymentOnAccountModalProps) {
|
|
|
85
96
|
<SelectPaymentMethod
|
|
86
97
|
{...paymentProps}
|
|
87
98
|
amountToPay={amount + creditCardSurcharge}
|
|
99
|
+
cardPaymentUrl={cardPaymentUrl}
|
|
100
|
+
setCardPaymentUrl={setCardPaymentUrl}
|
|
101
|
+
isLoadingCCiframe={isLoadingCCiframe}
|
|
88
102
|
/>
|
|
89
103
|
</Stack>
|
|
90
104
|
</Modal>
|
|
@@ -10,6 +10,7 @@ import { Checkbox } from "./Checkbox";
|
|
|
10
10
|
import { Subheader } from "./Subheader";
|
|
11
11
|
import { formatCurrencyDisplay } from "../utils/formatting";
|
|
12
12
|
import { HorizontalDivider } from "./HorizontalDivider";
|
|
13
|
+
import { Spinner } from "./Spinner";
|
|
13
14
|
|
|
14
15
|
export type PaymentMethodType = "ACHPayment" | "CCPayment" | "CreditsOnly";
|
|
15
16
|
export type CustomerBank = {
|
|
@@ -31,7 +32,10 @@ export type SelectPaymentMethodProps = {
|
|
|
31
32
|
allInvoices?: unknown[];
|
|
32
33
|
creditCardSettings?: unknown;
|
|
33
34
|
withCredits?: boolean;
|
|
35
|
+
cardPaymentUrl?: string | null;
|
|
36
|
+
isLoadingCCiframe?: boolean;
|
|
34
37
|
|
|
38
|
+
setCardPaymentUrl?: (url: string | null) => void;
|
|
35
39
|
onSelectMethod: (method: PaymentMethodType | null) => void;
|
|
36
40
|
onPay: () => void;
|
|
37
41
|
setSelectedCredits?: React.Dispatch<React.SetStateAction<unknown[]>>;
|
|
@@ -52,6 +56,8 @@ export function SelectPaymentMethod(props: SelectPaymentMethodProps) {
|
|
|
52
56
|
onPay,
|
|
53
57
|
isPayLoading,
|
|
54
58
|
withCredits = false,
|
|
59
|
+
isLoadingCCiframe,
|
|
60
|
+
cardPaymentUrl,
|
|
55
61
|
} = props;
|
|
56
62
|
|
|
57
63
|
const payAllWithCredits = withCredits && amountToPay <= 0;
|
|
@@ -62,7 +68,7 @@ export function SelectPaymentMethod(props: SelectPaymentMethodProps) {
|
|
|
62
68
|
} else {
|
|
63
69
|
onSelectMethod("ACHPayment");
|
|
64
70
|
}
|
|
65
|
-
}, [payAllWithCredits]);
|
|
71
|
+
}, [onSelectMethod, payAllWithCredits]);
|
|
66
72
|
|
|
67
73
|
function handleToggle(method: PaymentMethodType | null) {
|
|
68
74
|
onSelectMethod(method);
|
|
@@ -85,7 +91,7 @@ export function SelectPaymentMethod(props: SelectPaymentMethodProps) {
|
|
|
85
91
|
customerBanks={customerBanks || []}
|
|
86
92
|
onPay={onPay}
|
|
87
93
|
isPayLoading={isPayLoading || false}
|
|
88
|
-
disabled={payAllWithCredits}
|
|
94
|
+
disabled={payAllWithCredits || !amountToPay}
|
|
89
95
|
/>
|
|
90
96
|
)}
|
|
91
97
|
{allowedMethods?.includes("CCPayment") && (
|
|
@@ -96,22 +102,43 @@ export function SelectPaymentMethod(props: SelectPaymentMethodProps) {
|
|
|
96
102
|
label="Pay by Credit/Debit Card"
|
|
97
103
|
checked={!payAllWithCredits && selectedMethod === "CCPayment"}
|
|
98
104
|
onChange={(e) => e.stopPropagation()}
|
|
99
|
-
disabled={
|
|
105
|
+
disabled={payAllWithCredits || !amountToPay}
|
|
100
106
|
/>
|
|
101
107
|
}
|
|
102
108
|
onClick={() => {
|
|
103
|
-
if (payAllWithCredits) return;
|
|
109
|
+
if (payAllWithCredits || !amountToPay) return;
|
|
104
110
|
handleToggle(selectedMethod === "CCPayment" ? null : "CCPayment");
|
|
105
111
|
}}
|
|
112
|
+
disabled={payAllWithCredits || !amountToPay}
|
|
106
113
|
>
|
|
107
|
-
<
|
|
108
|
-
|
|
109
|
-
|
|
114
|
+
<Stack
|
|
115
|
+
sizing="layout-group"
|
|
116
|
+
width="full"
|
|
117
|
+
items="center"
|
|
118
|
+
justify="center"
|
|
119
|
+
style={{
|
|
120
|
+
flex: 1,
|
|
121
|
+
}}
|
|
122
|
+
minHeight={245}
|
|
123
|
+
>
|
|
124
|
+
{!isLoadingCCiframe && cardPaymentUrl ? (
|
|
125
|
+
<iframe
|
|
126
|
+
src={cardPaymentUrl}
|
|
127
|
+
style={{ width: "100%", height: "100%", flex: 1 }}
|
|
128
|
+
/>
|
|
129
|
+
) : (
|
|
130
|
+
<Spinner />
|
|
131
|
+
)}
|
|
132
|
+
</Stack>
|
|
110
133
|
</Accordion>
|
|
111
134
|
)}
|
|
112
135
|
|
|
113
136
|
{selectedMethod === "ACHPayment" && (
|
|
114
|
-
<Button
|
|
137
|
+
<Button
|
|
138
|
+
block
|
|
139
|
+
onClick={onPay}
|
|
140
|
+
disabled={isPayLoading || amountToPay <= 0}
|
|
141
|
+
>
|
|
115
142
|
{isPayLoading ? "Processing..." : "Submit Payment"}
|
|
116
143
|
</Button>
|
|
117
144
|
)}
|