@dmsi/wedgekit-react 0.0.160 → 0.0.162

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.
Files changed (58) hide show
  1. package/dist/{chunk-NMVSRA5Y.js → chunk-4XA32LKR.js} +2 -3
  2. package/dist/{chunk-4T7F5BZZ.js → chunk-6LN6QT6M.js} +1 -1
  3. package/dist/{chunk-5GOJRLQO.js → chunk-FCREADUH.js} +1 -1
  4. package/dist/{chunk-IDN3IN2A.js → chunk-M3433XEJ.js} +9 -2
  5. package/dist/{chunk-YR7JUKYO.js → chunk-RLK4TBXR.js} +1 -1
  6. package/dist/{chunk-4NCDT5ZY.js → chunk-SBSHZ327.js} +1 -1
  7. package/dist/components/CalendarRange.cjs +2 -3
  8. package/dist/components/CalendarRange.js +1 -1
  9. package/dist/components/DataGridCell.cjs +1 -1
  10. package/dist/components/DataGridCell.js +3 -3
  11. package/dist/components/DataTable.cjs +1 -2
  12. package/dist/components/DataTable.js +1 -3
  13. package/dist/components/DateInput.cjs +12 -6
  14. package/dist/components/DateInput.js +3 -3
  15. package/dist/components/DateRangeInput.cjs +12 -6
  16. package/dist/components/DateRangeInput.js +3 -3
  17. package/dist/components/EditingContext.cjs +1 -2
  18. package/dist/components/EditingContext.js +1 -2
  19. package/dist/components/HorizontalDivider.js +8 -3
  20. package/dist/components/Menu.cjs +1 -1
  21. package/dist/components/Menu.js +2 -2
  22. package/dist/components/MobileDataGrid.cjs +7 -3
  23. package/dist/components/MobileDataGrid.js +7 -3
  24. package/dist/components/Modal.cjs +1 -1
  25. package/dist/components/Modal.js +2 -2
  26. package/dist/components/NavigationTabs.cjs +4 -4
  27. package/dist/components/NavigationTabs.js +4 -4
  28. package/dist/components/PDFViewer.cjs +1 -1
  29. package/dist/components/PDFViewer.js +2 -2
  30. package/dist/components/Radio.js +133 -5
  31. package/dist/components/Time.cjs +1 -1
  32. package/dist/components/Time.js +1 -1
  33. package/dist/components/WorldpayIframe.js +6 -3
  34. package/dist/components/index.cjs +29 -1041
  35. package/dist/components/index.js +3 -19
  36. package/dist/index.css +0 -6
  37. package/dist/utils/index.cjs +9 -2
  38. package/dist/utils/index.js +1 -1
  39. package/package.json +1 -1
  40. package/src/components/CalendarRange.tsx +15 -9
  41. package/src/components/DataTable.tsx +1 -3
  42. package/src/components/EditingContext.tsx +4 -3
  43. package/src/components/MobileDataGrid.tsx +12 -4
  44. package/src/components/NavigationTabs.tsx +1 -1
  45. package/src/components/index.ts +0 -1
  46. package/src/utils/date.ts +65 -35
  47. package/src/utils.ts +1 -1
  48. package/dist/chunk-BATIOCXB.js +0 -138
  49. package/dist/chunk-EPQLWHCL.js +0 -11
  50. package/dist/chunk-NT2ZKA4W.js +0 -266
  51. package/dist/chunk-RUTYNLKS.js +0 -112
  52. package/dist/chunk-WFGKIR5A.js +0 -9
  53. package/dist/components/PaymentOnAccountModal.cjs +0 -2381
  54. package/dist/components/PaymentOnAccountModal.js +0 -35
  55. package/dist/components/SelectPaymentMethod.cjs +0 -1355
  56. package/dist/components/SelectPaymentMethod.js +0 -22
  57. package/src/components/PaymentOnAccountModal.tsx +0 -121
  58. package/src/components/SelectPaymentMethod.tsx +0 -315
@@ -74,7 +74,6 @@ __export(components_exports, {
74
74
  Menu: () => Menu,
75
75
  MenuOption: () => MenuOption,
76
76
  Paragraph: () => Paragraph,
77
- PaymentOnAccountModal: () => PaymentOnAccountModal,
78
77
  Search: () => Search,
79
78
  Select: () => Select,
80
79
  Subheader: () => Subheader,
@@ -1238,7 +1237,7 @@ function findDocumentRoot(element) {
1238
1237
  if (!element || !(element instanceof Node)) {
1239
1238
  return window.document.body;
1240
1239
  }
1241
- var currentElement = element;
1240
+ let currentElement = element;
1242
1241
  while (currentElement && currentElement.parentNode) {
1243
1242
  if (currentElement.parentNode === document) {
1244
1243
  return document.body;
@@ -3703,461 +3702,32 @@ var Tooltip = ({
3703
3702
  };
3704
3703
  Tooltip.displayName = "Tooltip";
3705
3704
 
3706
- // src/components/Modal.tsx
3707
- var import_clsx24 = __toESM(require("clsx"), 1);
3708
- var import_react19 = require("react");
3705
+ // src/components/Accordion.tsx
3706
+ var import_clsx21 = __toESM(require("clsx"), 1);
3709
3707
 
3710
- // src/components/Heading.tsx
3708
+ // src/components/Card.tsx
3711
3709
  var import_clsx19 = __toESM(require("clsx"), 1);
3712
3710
  var import_jsx_runtime22 = require("react/jsx-runtime");
3713
- var Heading = (_a) => {
3714
- var _b = _a, {
3715
- className,
3716
- children,
3717
- as,
3718
- color,
3719
- align,
3720
- variant = "heading1",
3721
- id,
3722
- testid
3723
- } = _b, props = __objRest(_b, [
3724
- "className",
3725
- "children",
3726
- "as",
3727
- "color",
3728
- "align",
3729
- "variant",
3730
- "id",
3731
- "testid"
3732
- ]);
3733
- const defaultElement = variant === "heading1" ? "h1" : variant === "heading2" ? "h2" : "h3";
3734
- const Element = as != null ? as : defaultElement;
3711
+ function Card(props) {
3712
+ const _a = props, { children, selected, testid } = _a, rest = __objRest(_a, ["children", "selected", "testid"]);
3735
3713
  return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3736
- Element,
3737
- __spreadProps(__spreadValues({
3738
- id,
3714
+ "div",
3715
+ __spreadProps(__spreadValues({}, rest), {
3739
3716
  "data-testid": testid,
3740
3717
  className: (0, import_clsx19.default)(
3741
- typography[variant],
3742
- className,
3743
- align === "left" && "text-left",
3744
- align === "center" && "text-center",
3745
- align === "right" && "text-right"
3718
+ "rounded-sm p-desktop-layout-padding",
3719
+ selected ? "border-2 border-border-primary-focus" : "border border-border-primary-normal",
3720
+ rest.className
3746
3721
  ),
3747
- style: __spreadProps(__spreadValues({}, props.style), {
3748
- color: color ? `var(--color-${color})` : void 0
3749
- })
3750
- }, props), {
3751
3722
  children
3752
3723
  })
3753
3724
  );
3754
- };
3755
- Heading.displayName = "Heading";
3756
- var Heading1 = (props) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Heading, __spreadProps(__spreadValues({}, props), { variant: "heading1" }));
3757
- var Heading2 = (props) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Heading, __spreadProps(__spreadValues({}, props), { variant: "heading2" }));
3758
- var Heading3 = (props) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Heading, __spreadProps(__spreadValues({}, props), { variant: "heading3" }));
3759
- Heading1.displayName = "Heading1";
3760
- Heading2.displayName = "Heading2";
3761
- Heading3.displayName = "Heading3";
3762
-
3763
- // src/components/ModalHeader.tsx
3764
- var import_clsx20 = __toESM(require("clsx"), 1);
3765
- var import_jsx_runtime23 = require("react/jsx-runtime");
3766
- var ModalHeader = ({
3767
- title,
3768
- hideCloseIcon,
3769
- headerIcon,
3770
- onClose,
3771
- id,
3772
- testid
3773
- }) => {
3774
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
3775
- "div",
3776
- {
3777
- id,
3778
- "data-testid": testid,
3779
- className: (0, import_clsx20.default)(
3780
- "flex justify-between items-center",
3781
- layoutPaddding,
3782
- layoutGroupGap
3783
- ),
3784
- children: [
3785
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: (0, import_clsx20.default)("flex items-center", layoutGroupGap), children: [
3786
- headerIcon,
3787
- title && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Heading2, { id: id ? `${id}-title` : void 0, testid: testid ? `${testid}-title` : void 0, as: "p", children: title })
3788
- ] }),
3789
- !hideCloseIcon && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3790
- Button,
3791
- {
3792
- id: id ? `${id}-close-button` : void 0,
3793
- testid: testid ? `${testid}-close-button` : void 0,
3794
- iconOnly: true,
3795
- variant: "tertiary",
3796
- onClick: onClose,
3797
- leftIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "text-icon-primary-normal contents", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Icon, { name: "close", size: 24 }) })
3798
- }
3799
- )
3800
- ]
3801
- }
3802
- );
3803
- };
3804
- ModalHeader.displayName = "ModalHeader";
3805
-
3806
- // src/components/ModalContent.tsx
3807
- var import_clsx21 = __toESM(require("clsx"), 1);
3808
- var import_jsx_runtime24 = require("react/jsx-runtime");
3809
- function ModalContent({
3810
- fixedHeightScrolling,
3811
- children,
3812
- id,
3813
- testid
3814
- }) {
3815
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3816
- "div",
3817
- {
3818
- id,
3819
- "data-testid": testid,
3820
- className: (0, import_clsx21.default)(
3821
- "flex-grow desktop:flex-grow-0",
3822
- layoutPaddding,
3823
- fixedHeightScrolling && "overflow-auto"
3824
- ),
3825
- children
3826
- }
3827
- );
3828
3725
  }
3829
- ModalContent.displayName = "ModalContent";
3830
-
3831
- // src/components/ModalButtons.tsx
3832
- var import_clsx22 = __toESM(require("clsx"), 1);
3833
- var import_jsx_runtime25 = require("react/jsx-runtime");
3834
- var ModalButtons = ({
3835
- onClose,
3836
- onContinue,
3837
- customActions,
3838
- id,
3839
- testid
3840
- }) => {
3841
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3842
- "div",
3843
- {
3844
- id,
3845
- "data-testid": testid,
3846
- className: (0, import_clsx22.default)(
3847
- "border-t border-neutral-300 flex justify-end",
3848
- layoutPaddding,
3849
- layoutGroupGap
3850
- ),
3851
- children: customActions != null ? customActions : /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
3852
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3853
- Button,
3854
- {
3855
- id: id ? `${id}-close-button` : void 0,
3856
- testid: testid ? `${testid}-close-button` : void 0,
3857
- variant: "secondary",
3858
- leftIcon: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Icon, { name: "close", size: 24 }),
3859
- onClick: onClose,
3860
- className: "max-sm:w-full",
3861
- children: "Close"
3862
- }
3863
- ),
3864
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3865
- Button,
3866
- {
3867
- id: id ? `${id}-continue-button` : void 0,
3868
- testid: testid ? `${testid}-continue-button` : void 0,
3869
- variant: "primary",
3870
- leftIcon: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Icon, { name: "check", size: 24 }),
3871
- className: "max-sm:w-full",
3872
- onClick: onContinue,
3873
- children: "Continue"
3874
- }
3875
- )
3876
- ] })
3877
- }
3878
- );
3879
- };
3880
- ModalButtons.displayName = "ModalButtons";
3881
-
3882
- // src/components/ModalScrim.tsx
3883
- var import_clsx23 = __toESM(require("clsx"), 1);
3884
- var import_jsx_runtime26 = require("react/jsx-runtime");
3885
- var ModalScrim = ({
3886
- show = false,
3887
- size = "small",
3888
- children,
3889
- onClick,
3890
- ref,
3891
- id,
3892
- testid
3893
- }) => {
3894
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3895
- "div",
3896
- {
3897
- id,
3898
- "data-testid": testid,
3899
- className: (0, import_clsx23.default)(
3900
- "overflow-y-auto h-screen transition-[visibility,opacity,background] ease-in-out duration-100 grid place-content-center desktop:p-4 group bg-neutral-600/50 fixed opacity-0",
3901
- !show && " pointer-events-none",
3902
- size === "small" && "p-4",
3903
- "inset-0 z-50"
3904
- ),
3905
- onMouseDown: onClick,
3906
- ref,
3907
- children
3908
- }
3909
- );
3910
- };
3911
- ModalScrim.displayName = "ModalScrim";
3912
-
3913
- // src/components/Modal.tsx
3914
- var import_react_dom3 = require("react-dom");
3915
- var import_react_use = require("react-use");
3916
-
3917
- // src/components/useMounted.tsx
3918
- var import_react18 = require("react");
3919
- var useMounted = () => {
3920
- const [isMounted, setIsMounted] = (0, import_react18.useState)(false);
3921
- (0, import_react18.useEffect)(() => {
3922
- setIsMounted(true);
3923
- return () => setIsMounted(false);
3924
- }, []);
3925
- return isMounted;
3926
- };
3927
-
3928
- // src/components/Modal.tsx
3929
- var import_jsx_runtime27 = require("react/jsx-runtime");
3930
- var fadeInScale = (element, duration = 300) => element.animate(
3931
- [
3932
- { opacity: 0, transform: "scale(0.95)" },
3933
- { opacity: 1, transform: "scale(1)" }
3934
- ],
3935
- {
3936
- duration,
3937
- easing: "cubic-bezier(0.4, 0, 0.2, 1)",
3938
- fill: "both"
3939
- }
3940
- );
3941
- var fadeOutScale = (element, duration = 200) => element.animate(
3942
- [
3943
- { opacity: 1, transform: "scale(1)" },
3944
- { opacity: 0, transform: "scale(0.95)" }
3945
- ],
3946
- {
3947
- duration,
3948
- easing: "ease-in-out",
3949
- fill: "both"
3950
- }
3951
- );
3952
- var bgFadeIn = (element, duration = 300) => element.animate([{ opacity: 0 }, { opacity: 1 }], {
3953
- duration,
3954
- easing: "cubic-bezier(0.4, 0, 0.2, 1)",
3955
- fill: "both"
3956
- });
3957
- var bgFadeOut = (element, duration = 200) => element.animate([{ opacity: 1 }, { opacity: 0 }], {
3958
- duration,
3959
- easing: "ease-in-out",
3960
- fill: "both"
3961
- });
3962
- var whenAllAnimationsFinish = (animations, callback) => {
3963
- let finishedCount = 0;
3964
- animations.forEach((animation) => {
3965
- animation.onfinish = () => {
3966
- finishedCount += 1;
3967
- if (finishedCount === animations.length) {
3968
- callback();
3969
- }
3970
- };
3971
- });
3972
- };
3973
- var sizes = {
3974
- small: {
3975
- sizeClass: "max-h-screen desktop:max-w-120 rounded-sm"
3976
- },
3977
- medium: {
3978
- sizeClass: "desktop:max-w-180 w-screen desktop:h-fit h-screen desktop:w-full max-w-240"
3979
- },
3980
- large: {
3981
- sizeClass: "desktop:max-w-240 w-screen desktop:h-fit h-screen desktop:w-full max-w-240"
3982
- },
3983
- "x-large": {
3984
- sizeClass: "desktop:max-w-300 w-screen desktop:h-fit h-screen desktop:w-full max-w-240"
3985
- }
3986
- };
3987
- var Modal = ({
3988
- id,
3989
- testid,
3990
- title,
3991
- open = false,
3992
- size = "small",
3993
- className,
3994
- children,
3995
- onClose,
3996
- onContinue,
3997
- closeOnBackdropClick = true,
3998
- showButtons = false,
3999
- hideCloseIcon = false,
4000
- headerIcon,
4001
- fixedHeightScrolling = false,
4002
- customActions
4003
- }) => {
4004
- var _a;
4005
- const mounted = useMounted();
4006
- const modalRef = (0, import_react19.useRef)(null);
4007
- const bgRef = (0, import_react19.useRef)(null);
4008
- const wasOpen = (0, import_react_use.usePrevious)(open);
4009
- const isMobile = useMatchesMobile();
4010
- const computedFixedHeightScrolling = isMobile || fixedHeightScrolling;
4011
- (0, import_react19.useEffect)(() => {
4012
- if (!mounted) return;
4013
- if (!modalRef.current || !bgRef.current) {
4014
- console.error("Modal or background reference is not set.");
4015
- return;
4016
- }
4017
- if (wasOpen === void 0) return;
4018
- if (wasOpen && !open) {
4019
- const modalAnimation = fadeOutScale(modalRef.current);
4020
- const bgAnimation = bgFadeOut(bgRef.current);
4021
- whenAllAnimationsFinish([modalAnimation, bgAnimation], () => {
4022
- if (onClose) {
4023
- onClose();
4024
- }
4025
- });
4026
- } else if (!wasOpen && open) {
4027
- fadeInScale(modalRef.current);
4028
- bgFadeIn(bgRef.current);
4029
- }
4030
- }, [mounted, open]);
4031
- const handleKeyDown = (0, import_react19.useCallback)(
4032
- (e) => {
4033
- if (e.key === "Escape") {
4034
- if (onClose) {
4035
- e.preventDefault();
4036
- onClose();
4037
- }
4038
- }
4039
- },
4040
- [onClose, bgRef, modalRef]
4041
- );
4042
- const handleClose = (0, import_react19.useCallback)(() => {
4043
- if (onClose) {
4044
- onClose();
4045
- }
4046
- }, [onClose]);
4047
- (0, import_react19.useEffect)(() => {
4048
- if (open) {
4049
- document.addEventListener("keyup", handleKeyDown);
4050
- }
4051
- return () => {
4052
- document.removeEventListener("keyup", handleKeyDown);
4053
- };
4054
- }, [open, handleKeyDown]);
4055
- (0, import_react19.useEffect)(() => {
4056
- if (!open) return;
4057
- const scrollY = window.scrollY;
4058
- const body = document.body;
4059
- body.style.position = "fixed";
4060
- body.style.top = `-${scrollY}px`;
4061
- body.style.left = "0";
4062
- body.style.right = "0";
4063
- body.style.overflow = "hidden";
4064
- body.style.width = "100%";
4065
- return () => {
4066
- body.style.position = "";
4067
- body.style.top = "";
4068
- body.style.left = "";
4069
- body.style.right = "";
4070
- body.style.overflow = "";
4071
- body.style.width = "";
4072
- window.scrollTo(0, scrollY);
4073
- };
4074
- }, [open]);
4075
- const { sizeClass } = (_a = sizes[size]) != null ? _a : sizes.small;
4076
- const backgroundClickHandler = (0, import_react19.useCallback)(
4077
- (e) => {
4078
- const target = e.target;
4079
- const currentTarget = e.currentTarget;
4080
- if (currentTarget.contains(target) && currentTarget !== target) {
4081
- e.stopPropagation();
4082
- return;
4083
- }
4084
- if (open && closeOnBackdropClick) {
4085
- handleClose();
4086
- }
4087
- },
4088
- [open, closeOnBackdropClick, handleClose]
4089
- );
4090
- if (!mounted) {
4091
- return null;
4092
- }
4093
- return (0, import_react_dom3.createPortal)(
4094
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
4095
- ModalScrim,
4096
- {
4097
- id: id ? `${id}-scrim` : void 0,
4098
- testid: testid ? `${testid}-scrim` : void 0,
4099
- size,
4100
- ref: bgRef,
4101
- show: open,
4102
- onClick: backgroundClickHandler,
4103
- children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
4104
- "div",
4105
- {
4106
- id,
4107
- "data-testid": testid,
4108
- ref: modalRef,
4109
- className: (0, import_clsx24.default)(
4110
- "bg-white shadow-md rounded-sm flex flex-col overflow-hidden w-full opacity-0 h-fit",
4111
- computedFixedHeightScrolling && "desktop:max-h-[calc(100vh-32px)] desktop:h-auto",
4112
- className,
4113
- sizeClass
4114
- ),
4115
- onClick: (e) => e.stopPropagation(),
4116
- children: [
4117
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
4118
- ModalHeader,
4119
- {
4120
- id: id ? `${id}-header` : void 0,
4121
- testid: testid ? `${testid}-header` : void 0,
4122
- title,
4123
- onClose: handleClose,
4124
- hideCloseIcon,
4125
- headerIcon
4126
- }
4127
- ),
4128
- children && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
4129
- ModalContent,
4130
- {
4131
- id: id ? `${id}-content` : void 0,
4132
- testid: testid ? `${testid}-content` : void 0,
4133
- fixedHeightScrolling: computedFixedHeightScrolling,
4134
- children
4135
- }
4136
- ),
4137
- showButtons && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
4138
- ModalButtons,
4139
- {
4140
- id: id ? `${id}-buttons` : void 0,
4141
- testid: testid ? `${testid}-buttons` : void 0,
4142
- onClose: handleClose,
4143
- onContinue,
4144
- customActions
4145
- }
4146
- )
4147
- ]
4148
- }
4149
- )
4150
- }
4151
- ),
4152
- findDocumentRoot(bgRef.current)
4153
- );
4154
- };
4155
- Modal.displayName = "Modal";
4156
3726
 
4157
3727
  // src/components/Stack.tsx
4158
- var import_clsx25 = __toESM(require("clsx"), 1);
4159
- var import_jsx_runtime28 = require("react/jsx-runtime");
4160
- var getFlexClassNames = ({ items, justify, grow }) => (0, import_clsx25.default)(
3728
+ var import_clsx20 = __toESM(require("clsx"), 1);
3729
+ var import_jsx_runtime23 = require("react/jsx-runtime");
3730
+ var getFlexClassNames = ({ items, justify, grow }) => (0, import_clsx20.default)(
4161
3731
  "flex",
4162
3732
  items === "start" && "items-start",
4163
3733
  grow && "grow",
@@ -4173,7 +3743,7 @@ var getFlexClassNames = ({ items, justify, grow }) => (0, import_clsx25.default)
4173
3743
  justify === "around" && "justify-around"
4174
3744
  );
4175
3745
  var useGapClassNames = (sizing) => {
4176
- return (0, import_clsx25.default)(
3746
+ return (0, import_clsx20.default)(
4177
3747
  sizing === "layout-group" && "gap-mobile-layout-group-gap desktop:gap-desktop-layout-group-gap compact:gap-compact-layout-group-gap",
4178
3748
  sizing === "layout" && "gap-mobile-layout-gap desktop:gap-desktop-layout-gap compact:gap-compact-layout-gap",
4179
3749
  sizing === "container" && "gap-mobile-container-gap desktop:gap-desktop-container-gap compact:gap-compact-container-gap",
@@ -4258,7 +3828,7 @@ var Stack = (_a) => {
4258
3828
  ]);
4259
3829
  const flexClassNames = getFlexClassNames({ items, justify, grow });
4260
3830
  const gapClassNames = useGapClassNames(sizing);
4261
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3831
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
4262
3832
  "div",
4263
3833
  __spreadProps(__spreadValues({
4264
3834
  id,
@@ -4279,7 +3849,7 @@ var Stack = (_a) => {
4279
3849
  top: top !== void 0 ? `${top}px` : void 0,
4280
3850
  left: left !== void 0 ? `${left}px` : void 0
4281
3851
  },
4282
- className: (0, import_clsx25.default)(
3852
+ className: (0, import_clsx20.default)(
4283
3853
  "scrollbar-thin",
4284
3854
  "max-w-screen",
4285
3855
  width !== "fit" && "w-full",
@@ -4324,44 +3894,18 @@ var Stack = (_a) => {
4324
3894
  );
4325
3895
  };
4326
3896
 
4327
- // src/components/Card.tsx
4328
- var import_clsx26 = __toESM(require("clsx"), 1);
4329
- var import_jsx_runtime29 = require("react/jsx-runtime");
4330
- function Card(props) {
4331
- const _a = props, { children, selected, testid } = _a, rest = __objRest(_a, ["children", "selected", "testid"]);
4332
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4333
- "div",
4334
- __spreadProps(__spreadValues({}, rest), {
4335
- "data-testid": testid,
4336
- className: (0, import_clsx26.default)(
4337
- "rounded-sm p-desktop-layout-padding",
4338
- selected ? "border-2 border-border-primary-focus" : "border border-border-primary-normal",
4339
- rest.className
4340
- ),
4341
- children
4342
- })
4343
- );
4344
- }
4345
-
4346
- // src/components/PaymentOnAccountModal.tsx
4347
- var import_react21 = require("react");
4348
-
4349
- // src/components/SelectPaymentMethod.tsx
4350
- var import_react20 = require("react");
4351
-
4352
3897
  // src/components/Accordion.tsx
4353
- var import_clsx27 = __toESM(require("clsx"), 1);
4354
- var import_jsx_runtime30 = require("react/jsx-runtime");
3898
+ var import_jsx_runtime24 = require("react/jsx-runtime");
4355
3899
  function Accordion(props) {
4356
3900
  const { isOpen, onClick, className, disabled, testid } = props;
4357
3901
  const {
4358
3902
  title,
4359
3903
  before,
4360
- after = /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
3904
+ after = /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
4361
3905
  Icon,
4362
3906
  {
4363
3907
  name: "expand_more",
4364
- className: (0, import_clsx27.default)(
3908
+ className: (0, import_clsx21.default)(
4365
3909
  "text-icon-primary-normal transform transition-all duration-300 ease-in-out",
4366
3910
  isOpen ? "rotate-180" : "rotate-0"
4367
3911
  )
@@ -4374,10 +3918,10 @@ function Accordion(props) {
4374
3918
  e.preventDefault();
4375
3919
  onClick == null ? void 0 : onClick();
4376
3920
  }
4377
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
3921
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
4378
3922
  Card,
4379
3923
  {
4380
- className: (0, import_clsx27.default)(
3924
+ className: (0, import_clsx21.default)(
4381
3925
  "overflow-hidden select-none",
4382
3926
  { "cursor-pointer": !disabled },
4383
3927
  className
@@ -4386,25 +3930,25 @@ function Accordion(props) {
4386
3930
  onClick: handleClick,
4387
3931
  testid,
4388
3932
  children: [
4389
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(Stack, { sizing: "component", horizontal: true, justify: "between", items: "center", children: [
4390
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(Stack, { sizing: "layout-group", horizontal: true, items: "center", children: [
3933
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(Stack, { sizing: "component", horizontal: true, justify: "between", items: "center", children: [
3934
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(Stack, { sizing: "layout-group", horizontal: true, items: "center", children: [
4391
3935
  before,
4392
- typeof title === "string" ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Paragraph, { testid: testid ? `${testid}-title` : void 0, className: "text-text-primary-normal", children: title }) : title
3936
+ typeof title === "string" ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Paragraph, { testid: testid ? `${testid}-title` : void 0, className: "text-text-primary-normal", children: title }) : title
4393
3937
  ] }),
4394
3938
  after
4395
3939
  ] }),
4396
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
3940
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
4397
3941
  "div",
4398
3942
  {
4399
- className: (0, import_clsx27.default)("grid transition-all duration-300 ease-in-out"),
3943
+ className: (0, import_clsx21.default)("grid transition-all duration-300 ease-in-out"),
4400
3944
  style: {
4401
3945
  gridTemplateRows: isOpen ? "1fr" : "0fr"
4402
3946
  },
4403
3947
  "data-testid": testid ? `${testid}-content-container` : void 0,
4404
- children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "overflow-hidden", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
3948
+ children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "overflow-hidden", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
4405
3949
  "div",
4406
3950
  {
4407
- className: (0, import_clsx27.default)(
3951
+ className: (0, import_clsx21.default)(
4408
3952
  typography.paragraph,
4409
3953
  "text-text-primary-normal desktop:pt-desktop-layout-gap",
4410
3954
  "flex flex-col gap-desktop-layout-gap"
@@ -4419,561 +3963,6 @@ function Accordion(props) {
4419
3963
  }
4420
3964
  );
4421
3965
  }
4422
-
4423
- // src/components/Radio.tsx
4424
- var import_clsx28 = __toESM(require("clsx"), 1);
4425
- var import_jsx_runtime31 = require("react/jsx-runtime");
4426
- var Radio = (_a) => {
4427
- var _b = _a, {
4428
- className,
4429
- label,
4430
- error,
4431
- disabled,
4432
- checked,
4433
- readOnly,
4434
- id,
4435
- testid
4436
- } = _b, props = __objRest(_b, [
4437
- "className",
4438
- "label",
4439
- "error",
4440
- "disabled",
4441
- "checked",
4442
- "readOnly",
4443
- "id",
4444
- "testid"
4445
- ]);
4446
- const radioId = id;
4447
- const paragraphColor = disabled ? "text-primary-disabled" : error ? "text-primary-error" : "text-primary-normal";
4448
- const defaultClassName = (0, import_clsx28.default)(
4449
- !error && !disabled && "border-border-primary-normal peer-hover:border-border-action-hover peer-hover:bg-background-action-secondary-hover peer-focus:border-border-action-hover peer-focus:bg-background-action-secondary-hover peer-active:border-border-action-active peer-active:bg-background-action-secondary-active peer-checked:border-0 peer-checked:bg-background-action-secondary-hover"
4450
- );
4451
- const errorClassName = (0, import_clsx28.default)(
4452
- error && !disabled && "border-border-action-critical-normal peer-hover:border-border-action-critical-hover peer-hover:bg-background-action-critical-secondary-hover peer-focus:border-border-action-critical-hover peer-focus:bg-background-action-critical-secondary-hover peer-active:border-border-action-critical-active peer-active:bg-background-action-secondary-active peer-checked:bg-background-action-critical-secondary-hover peer-checked:border-0 "
4453
- );
4454
- const disabledClassName = (0, import_clsx28.default)(
4455
- disabled && "peer-disabled:bg-background-action-secondary-disabled peer-disabled:border-border-primary-normal peer-checked:border-0"
4456
- );
4457
- const readonlyClassName = (0, import_clsx28.default)(
4458
- readOnly && "peer-read-only:bg-background-action-secondary-disabled peer-read-only:border-border-primary-normal peer-checked:border-0"
4459
- );
4460
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
4461
- "label",
4462
- {
4463
- htmlFor: radioId,
4464
- className: (0, import_clsx28.default)(
4465
- "flex items-center",
4466
- componentGap,
4467
- disabled ? "cursor-default" : "cursor-pointer",
4468
- className
4469
- ),
4470
- children: [
4471
- /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "relative", children: [
4472
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4473
- "input",
4474
- __spreadValues({
4475
- id: radioId,
4476
- "data-testid": testid,
4477
- type: "radio",
4478
- className: "sr-only peer",
4479
- disabled,
4480
- checked,
4481
- readOnly
4482
- }, props)
4483
- ),
4484
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4485
- "div",
4486
- {
4487
- className: (0, import_clsx28.default)(
4488
- "size-6 rounded-full border flex items-center justify-center",
4489
- baseTransition,
4490
- defaultClassName,
4491
- errorClassName,
4492
- disabledClassName,
4493
- readonlyClassName
4494
- ),
4495
- children: checked && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4496
- RadioIcon,
4497
- {
4498
- className: (0, import_clsx28.default)(
4499
- "transition-colors",
4500
- !error && !disabled && "text-icon-on-action-secondary-normal hover:text-icon-on-action-secondary-hover active:text-icon-on-action-secondary-active peer-hover:text-icon-on-action-secondary-hover peer-focus:text-icon-on-action-secondary-hover peer-active:text-icon-on-action-secondary-active",
4501
- error && !disabled && "text-icon-action-critical-secondary-normal hover:text-icon-action-critical-secondary-hover active:text-icon-action-critical-secondary-active peer-hover:text-icon-action-critical-secondary-hover peer-focus:text-icon-action-critical-secondary-hover peer-active:text-icon-action-critical-secondary-active",
4502
- disabled && "text-icon-on-action-secondary-disabled",
4503
- readOnly && "text-icon-on-action-secondary-disabled"
4504
- )
4505
- }
4506
- )
4507
- }
4508
- )
4509
- ] }),
4510
- label && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Paragraph, { id: radioId ? `${radioId}-label` : void 0, testid: testid ? `${testid}-label` : void 0, padded: true, color: paragraphColor, children: label })
4511
- ]
4512
- }
4513
- );
4514
- };
4515
- Radio.displayName = "Radio";
4516
- var RadioIcon = ({ className }) => {
4517
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
4518
- "svg",
4519
- {
4520
- className,
4521
- xmlns: "http://www.w3.org/2000/svg",
4522
- width: "24",
4523
- height: "24",
4524
- viewBox: "0 0 24 24",
4525
- fill: "none",
4526
- children: [
4527
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4528
- "rect",
4529
- {
4530
- x: "1",
4531
- y: "1",
4532
- width: "22",
4533
- height: "22",
4534
- rx: "11",
4535
- stroke: "currentColor",
4536
- strokeWidth: "2"
4537
- }
4538
- ),
4539
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("rect", { x: "4", y: "4", width: "16", height: "16", rx: "8", fill: "currentColor" })
4540
- ]
4541
- }
4542
- );
4543
- };
4544
- RadioIcon.displayName = "RadioIcon";
4545
-
4546
- // src/components/HorizontalDivider.tsx
4547
- var import_clsx29 = __toESM(require("clsx"), 1);
4548
- var import_jsx_runtime32 = require("react/jsx-runtime");
4549
- function HorizontalDivider({ id, testid, hideOnMobile }) {
4550
- const hideOnMobileStyle = (0, import_clsx29.default)(hideOnMobile && "hidden desktop:block");
4551
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("hr", { id, "data-testid": testid, className: (0, import_clsx29.default)("w-full border-t border-border-primary-normal", hideOnMobileStyle) });
4552
- }
4553
-
4554
- // src/components/Spinner.tsx
4555
- var import_jsx_runtime33 = require("react/jsx-runtime");
4556
- var Spinner = ({ size = "small", testid }) => {
4557
- const dimension = size === "large" ? 48 : 24;
4558
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
4559
- "svg",
4560
- {
4561
- "data-testid": testid,
4562
- width: dimension,
4563
- height: dimension,
4564
- viewBox: "0 0 24 24",
4565
- xmlns: "http://www.w3.org/2000/svg",
4566
- fill: "#1D1E1E",
4567
- className: "animate-spin",
4568
- "aria-label": "Loading",
4569
- children: [
4570
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("circle", { cx: "12", cy: "4", r: "2", opacity: "1", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
4571
- "animate",
4572
- {
4573
- attributeName: "opacity",
4574
- begin: "0s",
4575
- dur: "1s",
4576
- from: "1",
4577
- to: "0",
4578
- repeatCount: "indefinite"
4579
- }
4580
- ) }),
4581
- /* @__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)(
4582
- "animate",
4583
- {
4584
- attributeName: "opacity",
4585
- begin: "-0.875s",
4586
- dur: "1s",
4587
- from: "1",
4588
- to: "0",
4589
- repeatCount: "indefinite"
4590
- }
4591
- ) }),
4592
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("circle", { cx: "20", cy: "12", r: "2", opacity: "0.25", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
4593
- "animate",
4594
- {
4595
- attributeName: "opacity",
4596
- begin: "-0.75s",
4597
- dur: "1s",
4598
- from: "1",
4599
- to: "0",
4600
- repeatCount: "indefinite"
4601
- }
4602
- ) }),
4603
- /* @__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)(
4604
- "animate",
4605
- {
4606
- attributeName: "opacity",
4607
- begin: "-0.625s",
4608
- dur: "1s",
4609
- from: "1",
4610
- to: "0",
4611
- repeatCount: "indefinite"
4612
- }
4613
- ) }),
4614
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("circle", { cx: "12", cy: "20", r: "2", opacity: "0.5", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
4615
- "animate",
4616
- {
4617
- attributeName: "opacity",
4618
- begin: "-0.5s",
4619
- dur: "1s",
4620
- from: "1",
4621
- to: "0",
4622
- repeatCount: "indefinite"
4623
- }
4624
- ) }),
4625
- /* @__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)(
4626
- "animate",
4627
- {
4628
- attributeName: "opacity",
4629
- begin: "-0.375s",
4630
- dur: "1s",
4631
- from: "1",
4632
- to: "0",
4633
- repeatCount: "indefinite"
4634
- }
4635
- ) }),
4636
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("circle", { cx: "4", cy: "12", r: "2", opacity: "0.75", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
4637
- "animate",
4638
- {
4639
- attributeName: "opacity",
4640
- begin: "-0.25s",
4641
- dur: "1s",
4642
- from: "1",
4643
- to: "0",
4644
- repeatCount: "indefinite"
4645
- }
4646
- ) }),
4647
- /* @__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)(
4648
- "animate",
4649
- {
4650
- attributeName: "opacity",
4651
- begin: "-0.125s",
4652
- dur: "1s",
4653
- from: "1",
4654
- to: "0",
4655
- repeatCount: "indefinite"
4656
- }
4657
- ) })
4658
- ]
4659
- }
4660
- );
4661
- };
4662
- Spinner.displayName = "Spinner";
4663
-
4664
- // src/components/WorldpayIframe.tsx
4665
- var import_jsx_runtime34 = require("react/jsx-runtime");
4666
- function WorldpayIframe({ url }) {
4667
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("iframe", { src: url, style: { width: "100%", height: "100%", flex: 1 } });
4668
- }
4669
-
4670
- // src/components/SelectPaymentMethod.tsx
4671
- var import_jsx_runtime35 = require("react/jsx-runtime");
4672
- function SelectPaymentMethod(props) {
4673
- const {
4674
- amountToPay,
4675
- selectedMethod,
4676
- onSelectMethod,
4677
- selectedCredits,
4678
- allCredits,
4679
- allowedMethods,
4680
- selectedACHBankGuid,
4681
- setSelectedACHBankGuid,
4682
- customerBanks,
4683
- onPay,
4684
- isPayLoading,
4685
- withCredits = false,
4686
- isLoadingCCiframe,
4687
- cardPaymentUrl,
4688
- testid
4689
- } = props;
4690
- const payAllWithCredits = withCredits && amountToPay <= 0;
4691
- (0, import_react20.useEffect)(() => {
4692
- if (payAllWithCredits) {
4693
- onSelectMethod("CreditsOnly");
4694
- } else {
4695
- onSelectMethod(null);
4696
- }
4697
- }, [onSelectMethod, payAllWithCredits]);
4698
- function handleToggle(method) {
4699
- onSelectMethod(method);
4700
- }
4701
- return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(Stack, { sizing: "layout-group", width: "full", minWidth: 400, children: [
4702
- !!(allCredits == null ? void 0 : allCredits.length) && withCredits && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
4703
- CreditsSelector,
4704
- {
4705
- testid: testid ? `${testid}-credit-selector` : void 0,
4706
- selectedCredits: selectedCredits || [],
4707
- allCredits: allCredits || [],
4708
- setSelectedCredits: props.setSelectedCredits || (() => {
4709
- })
4710
- }
4711
- ),
4712
- (allowedMethods == null ? void 0 : allowedMethods.includes("ACHPayment")) && !!(customerBanks == null ? void 0 : customerBanks.length) && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
4713
- ACHSelector,
4714
- {
4715
- testid: testid ? `${testid}-ach-selector` : void 0,
4716
- selectedMethod,
4717
- handleToggle,
4718
- selectedBankGuid: selectedACHBankGuid || null,
4719
- setSelectedBankGuid: setSelectedACHBankGuid || (() => {
4720
- }),
4721
- customerBanks: customerBanks || [],
4722
- onPay,
4723
- isPayLoading: isPayLoading || false,
4724
- disabled: payAllWithCredits || !amountToPay
4725
- }
4726
- ),
4727
- (allowedMethods == null ? void 0 : allowedMethods.includes("CCPayment")) && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
4728
- Accordion,
4729
- {
4730
- testid: testid ? `${testid}-cc-payment` : void 0,
4731
- isOpen: !payAllWithCredits && selectedMethod === "CCPayment",
4732
- title: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
4733
- Radio,
4734
- {
4735
- testid: testid ? `${testid}-cc-payment-radio` : void 0,
4736
- label: "Pay by Credit/Debit Card",
4737
- checked: !payAllWithCredits && selectedMethod === "CCPayment",
4738
- onChange: (e) => e.stopPropagation(),
4739
- disabled: payAllWithCredits || !amountToPay
4740
- }
4741
- ),
4742
- onClick: () => {
4743
- if (payAllWithCredits || !amountToPay) return;
4744
- handleToggle(selectedMethod === "CCPayment" ? null : "CCPayment");
4745
- },
4746
- disabled: payAllWithCredits || !amountToPay,
4747
- children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
4748
- Stack,
4749
- {
4750
- sizing: "layout-group",
4751
- width: "full",
4752
- items: "center",
4753
- justify: "center",
4754
- style: {
4755
- flex: 1
4756
- },
4757
- minHeight: 245,
4758
- children: !isLoadingCCiframe && cardPaymentUrl ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(WorldpayIframe, { url: cardPaymentUrl }) : /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Spinner, {})
4759
- }
4760
- )
4761
- }
4762
- ),
4763
- selectedMethod === "ACHPayment" && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
4764
- Button,
4765
- {
4766
- block: true,
4767
- onClick: onPay,
4768
- disabled: isPayLoading || amountToPay <= 0,
4769
- testid: testid ? `${testid}-submit-payment-button` : void 0,
4770
- children: isPayLoading ? "Processing..." : "Submit Payment"
4771
- }
4772
- ),
4773
- payAllWithCredits && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
4774
- Button,
4775
- {
4776
- testid: testid ? `${testid}-submit-payment-button` : void 0,
4777
- block: true,
4778
- onClick: onPay,
4779
- disabled: isPayLoading,
4780
- children: isPayLoading ? "Processing..." : "Submit Payment"
4781
- }
4782
- )
4783
- ] });
4784
- }
4785
- function ACHSelector(props) {
4786
- const {
4787
- selectedMethod,
4788
- handleToggle,
4789
- selectedBankGuid,
4790
- setSelectedBankGuid,
4791
- customerBanks,
4792
- disabled,
4793
- testid
4794
- } = props;
4795
- function handleBankSelect(e, bankGuid) {
4796
- if (disabled) return;
4797
- e.stopPropagation();
4798
- setSelectedBankGuid(bankGuid);
4799
- handleToggle("ACHPayment");
4800
- }
4801
- return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_jsx_runtime35.Fragment, { children: customerBanks.map((bank) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
4802
- Card,
4803
- {
4804
- testid: testid ? `${testid}-bank-${bank.CustBankGUID}` : void 0,
4805
- onClick: (e) => handleBankSelect(e, bank.CustBankGUID),
4806
- selected: !disabled && selectedMethod === "ACHPayment" && selectedBankGuid === bank.CustBankGUID,
4807
- children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
4808
- Radio,
4809
- {
4810
- label: `Pay by ${bank.AccountDisplayString}`,
4811
- checked: !disabled && selectedMethod === "ACHPayment" && selectedBankGuid === bank.CustBankGUID,
4812
- disabled,
4813
- onChange: (e) => e.stopPropagation()
4814
- }
4815
- )
4816
- },
4817
- bank.CustBankGUID
4818
- )) });
4819
- }
4820
- function CreditsSelector(props) {
4821
- const { selectedCredits, allCredits, setSelectedCredits, testid } = props;
4822
- const [isOpen, setIsOpen] = (0, import_react20.useState)(true);
4823
- const handleCreditSelect = (credit) => {
4824
- if (setSelectedCredits) {
4825
- setSelectedCredits(
4826
- (prev) => prev.includes(credit) ? prev.filter((c) => c !== credit) : [...prev, credit]
4827
- );
4828
- }
4829
- };
4830
- return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
4831
- Accordion,
4832
- {
4833
- isOpen,
4834
- title: "Available Credits",
4835
- onClick: () => setIsOpen((prev) => !prev),
4836
- testid,
4837
- children: [
4838
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(HorizontalDivider, {}),
4839
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Stack, { sizing: "layout-group", width: "full", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
4840
- Stack,
4841
- {
4842
- sizing: "layout-group",
4843
- width: "full",
4844
- overflowY: "auto",
4845
- maxHeight: 300,
4846
- children: allCredits.map((credits) => /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
4847
- Stack,
4848
- {
4849
- horizontal: true,
4850
- justify: "between",
4851
- items: "center",
4852
- sizing: "layout-group",
4853
- children: [
4854
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
4855
- Stack,
4856
- {
4857
- sizing: "layout-group",
4858
- onClick: () => handleCreditSelect(credits),
4859
- paddingY: true,
4860
- flexGrow: 1,
4861
- testid: testid ? `${testid}-credit-${credits.InvoiceNumber}` : void 0,
4862
- children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
4863
- Checkbox,
4864
- {
4865
- testid: testid ? `${testid}-credit-${credits.InvoiceNumber}-checkbox` : void 0,
4866
- label: credits.InvoiceNumber,
4867
- checked: selectedCredits == null ? void 0 : selectedCredits.includes(credits),
4868
- onChange: () => handleCreditSelect(credits)
4869
- }
4870
- )
4871
- }
4872
- ),
4873
- /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
4874
- Subheader,
4875
- {
4876
- testid: testid ? `${testid}-credit-${credits.InvoiceNumber}-InvoiceBalanceDue` : void 0,
4877
- className: " pr-desktop-component-padding",
4878
- children: [
4879
- "$",
4880
- formatCurrencyDisplay(
4881
- formatDecimalValue(Math.abs(credits.InvoiceBalanceDue), 2)
4882
- )
4883
- ]
4884
- }
4885
- )
4886
- ]
4887
- },
4888
- credits.AROpenGUID
4889
- ))
4890
- }
4891
- ) })
4892
- ]
4893
- }
4894
- );
4895
- }
4896
-
4897
- // src/components/PaymentOnAccountModal.tsx
4898
- var import_jsx_runtime36 = require("react/jsx-runtime");
4899
- function PaymentOnAccountModal(props) {
4900
- const {
4901
- isOpen,
4902
- paymentProps,
4903
- onClose,
4904
- onAmountChange,
4905
- cardPaymentUrl,
4906
- setCardPaymentUrl,
4907
- isLoadingCCiframe,
4908
- testid
4909
- } = props;
4910
- const [amount, setAmount] = (0, import_react21.useState)(paymentProps.amountToPay);
4911
- const { creditCardSettings, selectedMethod } = paymentProps;
4912
- (0, import_react21.useEffect)(() => {
4913
- setAmount(paymentProps.amountToPay);
4914
- }, [paymentProps.amountToPay]);
4915
- function handleAmountChange(event) {
4916
- const inputValue = event.target.value.replace(/[^0-9.-]+/g, "");
4917
- const value = +inputValue || 0;
4918
- setAmount(value);
4919
- onAmountChange == null ? void 0 : onAmountChange(value);
4920
- }
4921
- const creditCardSurcharge = (0, import_react21.useMemo)(() => {
4922
- const applySurcharge = (creditCardSettings == null ? void 0 : creditCardSettings.ApplySurcharge) || false;
4923
- if (!applySurcharge || selectedMethod !== "CCPayment") {
4924
- return 0;
4925
- }
4926
- const surchargeType = creditCardSettings == null ? void 0 : creditCardSettings.SurchargeBasisType;
4927
- const surchargeRate = (creditCardSettings == null ? void 0 : creditCardSettings.SurchargeBasisAmount) || 0;
4928
- if (surchargeType === "Percent") {
4929
- return calculateSurcharge(amount, surchargeRate);
4930
- }
4931
- if (surchargeType === "Fixed") {
4932
- return surchargeRate;
4933
- }
4934
- return 0;
4935
- }, [creditCardSettings, amount, selectedMethod]);
4936
- return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Modal, { testid, open: isOpen, onClose, title: "Payment on Account", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(Stack, { sizing: "layout-group", width: "full", children: [
4937
- selectedMethod === "CCPayment" && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(Stack, { horizontal: true, justify: "between", items: "center", children: [
4938
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Paragraph, { children: "Surcharge" }),
4939
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(Paragraph, { testid: testid ? `${testid}-surcharge` : void 0, children: [
4940
- "$",
4941
- formatCurrencyDisplay(creditCardSurcharge.toFixed(2))
4942
- ] })
4943
- ] }),
4944
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Card, { className: "py-desktop-component-padding", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(Stack, { sizing: "component", justify: "between", items: "center", horizontal: true, children: [
4945
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Paragraph, { className: "w-full", children: "Amount to Pay" }),
4946
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
4947
- Input,
4948
- {
4949
- testid: testid ? `${testid}-amount-to-pay` : void 0,
4950
- type: "number",
4951
- placeholder: "$0.00",
4952
- align: "right",
4953
- value: amount === 0 ? "" : amount,
4954
- onChange: handleAmountChange,
4955
- before: "$"
4956
- }
4957
- ) })
4958
- ] }) }),
4959
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
4960
- SelectPaymentMethod,
4961
- __spreadProps(__spreadValues({}, paymentProps), {
4962
- testid: testid ? `${testid}-select-payment-method` : void 0,
4963
- amountToPay: amount + creditCardSurcharge,
4964
- cardPaymentUrl,
4965
- setCardPaymentUrl,
4966
- isLoadingCCiframe
4967
- })
4968
- )
4969
- ] }) });
4970
- }
4971
- function calculateSurcharge(amountInDollars, surchargeRate) {
4972
- const amountInCents = amountInDollars * 100;
4973
- const surchargeInCents = amountInCents * surchargeRate / 100;
4974
- const roundedSurchargeInCents = Math.round(surchargeInCents);
4975
- return roundedSurchargeInCents / 100;
4976
- }
4977
3966
  // Annotate the CommonJS export names for ESM import in node:
4978
3967
  0 && (module.exports = {
4979
3968
  Accordion,
@@ -4991,7 +3980,6 @@ function calculateSurcharge(amountInDollars, surchargeRate) {
4991
3980
  Menu,
4992
3981
  MenuOption,
4993
3982
  Paragraph,
4994
- PaymentOnAccountModal,
4995
3983
  Search,
4996
3984
  Select,
4997
3985
  Subheader,