@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.
@@ -464,7 +464,7 @@ Paragraph.displayName = "Paragraph";
464
464
  // src/components/Accordion.tsx
465
465
  var import_jsx_runtime5 = require("react/jsx-runtime");
466
466
  function Accordion(props) {
467
- const { isOpen, onClick, className } = props;
467
+ const { isOpen, onClick, className, disabled } = props;
468
468
  const {
469
469
  title,
470
470
  before,
@@ -489,7 +489,8 @@ function Accordion(props) {
489
489
  Card,
490
490
  {
491
491
  className: (0, import_clsx6.default)(
492
- "overflow-hidden select-none cursor-pointer",
492
+ "overflow-hidden select-none",
493
+ { "cursor-pointer": !disabled },
493
494
  className
494
495
  ),
495
496
  selected: isOpen,
@@ -967,8 +968,117 @@ function HorizontalDivider({ id, hideOnMobile }) {
967
968
  return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("hr", { id, className: (0, import_clsx11.default)("w-full border-t border-border-primary-normal", hideOnMobileStyle) });
968
969
  }
969
970
 
970
- // src/components/SelectPaymentMethod.tsx
971
+ // src/components/Spinner.tsx
971
972
  var import_jsx_runtime11 = require("react/jsx-runtime");
973
+ var Spinner = ({ size = "small" }) => {
974
+ const dimension = size === "large" ? 48 : 24;
975
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
976
+ "svg",
977
+ {
978
+ width: dimension,
979
+ height: dimension,
980
+ viewBox: "0 0 24 24",
981
+ xmlns: "http://www.w3.org/2000/svg",
982
+ fill: "#1D1E1E",
983
+ className: size === "large" ? "animate-spin" : "",
984
+ "aria-label": "Loading",
985
+ children: [
986
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("circle", { cx: "12", cy: "4", r: "2", opacity: "1", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
987
+ "animate",
988
+ {
989
+ attributeName: "opacity",
990
+ begin: "0s",
991
+ dur: "1s",
992
+ from: "1",
993
+ to: "0",
994
+ repeatCount: "indefinite"
995
+ }
996
+ ) }),
997
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("circle", { cx: "17.666", cy: "6.334", r: "2", opacity: "0.125", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
998
+ "animate",
999
+ {
1000
+ attributeName: "opacity",
1001
+ begin: "-0.875s",
1002
+ dur: "1s",
1003
+ from: "1",
1004
+ to: "0",
1005
+ repeatCount: "indefinite"
1006
+ }
1007
+ ) }),
1008
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("circle", { cx: "20", cy: "12", r: "2", opacity: "0.25", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1009
+ "animate",
1010
+ {
1011
+ attributeName: "opacity",
1012
+ begin: "-0.75s",
1013
+ dur: "1s",
1014
+ from: "1",
1015
+ to: "0",
1016
+ repeatCount: "indefinite"
1017
+ }
1018
+ ) }),
1019
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("circle", { cx: "17.666", cy: "17.666", r: "2", opacity: "0.375", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1020
+ "animate",
1021
+ {
1022
+ attributeName: "opacity",
1023
+ begin: "-0.625s",
1024
+ dur: "1s",
1025
+ from: "1",
1026
+ to: "0",
1027
+ repeatCount: "indefinite"
1028
+ }
1029
+ ) }),
1030
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("circle", { cx: "12", cy: "20", r: "2", opacity: "0.5", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1031
+ "animate",
1032
+ {
1033
+ attributeName: "opacity",
1034
+ begin: "-0.5s",
1035
+ dur: "1s",
1036
+ from: "1",
1037
+ to: "0",
1038
+ repeatCount: "indefinite"
1039
+ }
1040
+ ) }),
1041
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("circle", { cx: "6.334", cy: "17.666", r: "2", opacity: "0.625", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1042
+ "animate",
1043
+ {
1044
+ attributeName: "opacity",
1045
+ begin: "-0.375s",
1046
+ dur: "1s",
1047
+ from: "1",
1048
+ to: "0",
1049
+ repeatCount: "indefinite"
1050
+ }
1051
+ ) }),
1052
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("circle", { cx: "4", cy: "12", r: "2", opacity: "0.75", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1053
+ "animate",
1054
+ {
1055
+ attributeName: "opacity",
1056
+ begin: "-0.25s",
1057
+ dur: "1s",
1058
+ from: "1",
1059
+ to: "0",
1060
+ repeatCount: "indefinite"
1061
+ }
1062
+ ) }),
1063
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("circle", { cx: "6.334", cy: "6.334", r: "2", opacity: "0.875", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1064
+ "animate",
1065
+ {
1066
+ attributeName: "opacity",
1067
+ begin: "-0.125s",
1068
+ dur: "1s",
1069
+ from: "1",
1070
+ to: "0",
1071
+ repeatCount: "indefinite"
1072
+ }
1073
+ ) })
1074
+ ]
1075
+ }
1076
+ );
1077
+ };
1078
+ Spinner.displayName = "Spinner";
1079
+
1080
+ // src/components/SelectPaymentMethod.tsx
1081
+ var import_jsx_runtime12 = require("react/jsx-runtime");
972
1082
  function SelectPaymentMethod(props) {
973
1083
  const {
974
1084
  amountToPay,
@@ -982,7 +1092,9 @@ function SelectPaymentMethod(props) {
982
1092
  customerBanks,
983
1093
  onPay,
984
1094
  isPayLoading,
985
- withCredits = false
1095
+ withCredits = false,
1096
+ isLoadingCCiframe,
1097
+ cardPaymentUrl
986
1098
  } = props;
987
1099
  const payAllWithCredits = withCredits && amountToPay <= 0;
988
1100
  (0, import_react.useEffect)(() => {
@@ -991,12 +1103,12 @@ function SelectPaymentMethod(props) {
991
1103
  } else {
992
1104
  onSelectMethod("ACHPayment");
993
1105
  }
994
- }, [payAllWithCredits]);
1106
+ }, [onSelectMethod, payAllWithCredits]);
995
1107
  function handleToggle(method) {
996
1108
  onSelectMethod(method);
997
1109
  }
998
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Stack, { sizing: "layout-group", width: "full", minWidth: 400, children: [
999
- !!(allCredits == null ? void 0 : allCredits.length) && withCredits && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1110
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Stack, { sizing: "layout-group", width: "full", minWidth: 400, children: [
1111
+ !!(allCredits == null ? void 0 : allCredits.length) && withCredits && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1000
1112
  CreditsSelector,
1001
1113
  {
1002
1114
  selectedCredits: selectedCredits || [],
@@ -1005,7 +1117,7 @@ function SelectPaymentMethod(props) {
1005
1117
  })
1006
1118
  }
1007
1119
  ),
1008
- (allowedMethods == null ? void 0 : allowedMethods.includes("ACHPayment")) && !!(customerBanks == null ? void 0 : customerBanks.length) && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1120
+ (allowedMethods == null ? void 0 : allowedMethods.includes("ACHPayment")) && !!(customerBanks == null ? void 0 : customerBanks.length) && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1009
1121
  ACHSelector,
1010
1122
  {
1011
1123
  selectedMethod,
@@ -1016,31 +1128,59 @@ function SelectPaymentMethod(props) {
1016
1128
  customerBanks: customerBanks || [],
1017
1129
  onPay,
1018
1130
  isPayLoading: isPayLoading || false,
1019
- disabled: payAllWithCredits
1131
+ disabled: payAllWithCredits || !amountToPay
1020
1132
  }
1021
1133
  ),
1022
- (allowedMethods == null ? void 0 : allowedMethods.includes("CCPayment")) && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1134
+ (allowedMethods == null ? void 0 : allowedMethods.includes("CCPayment")) && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1023
1135
  Accordion,
1024
1136
  {
1025
1137
  isOpen: !payAllWithCredits && selectedMethod === "CCPayment",
1026
- title: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1138
+ title: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1027
1139
  Radio,
1028
1140
  {
1029
1141
  label: "Pay by Credit/Debit Card",
1030
1142
  checked: !payAllWithCredits && selectedMethod === "CCPayment",
1031
1143
  onChange: (e) => e.stopPropagation(),
1032
- disabled: amountToPay <= 0
1144
+ disabled: payAllWithCredits || !amountToPay
1033
1145
  }
1034
1146
  ),
1035
1147
  onClick: () => {
1036
- if (payAllWithCredits) return;
1148
+ if (payAllWithCredits || !amountToPay) return;
1037
1149
  handleToggle(selectedMethod === "CCPayment" ? null : "CCPayment");
1038
1150
  },
1039
- children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Button, { className: "w-full", onClick: onPay, disabled: isPayLoading, children: isPayLoading ? "Processing..." : "Proceed to Payment" })
1151
+ disabled: payAllWithCredits || !amountToPay,
1152
+ children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1153
+ Stack,
1154
+ {
1155
+ sizing: "layout-group",
1156
+ width: "full",
1157
+ items: "center",
1158
+ justify: "center",
1159
+ style: {
1160
+ flex: 1
1161
+ },
1162
+ minHeight: 245,
1163
+ children: !isLoadingCCiframe && cardPaymentUrl ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1164
+ "iframe",
1165
+ {
1166
+ src: cardPaymentUrl,
1167
+ style: { width: "100%", height: "100%", flex: 1 }
1168
+ }
1169
+ ) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Spinner, {})
1170
+ }
1171
+ )
1040
1172
  }
1041
1173
  ),
1042
- selectedMethod === "ACHPayment" && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Button, { block: true, onClick: onPay, disabled: isPayLoading, children: isPayLoading ? "Processing..." : "Submit Payment" }),
1043
- payAllWithCredits && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Button, { block: true, onClick: onPay, disabled: isPayLoading, children: isPayLoading ? "Processing..." : "Submit Payment" })
1174
+ selectedMethod === "ACHPayment" && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1175
+ Button,
1176
+ {
1177
+ block: true,
1178
+ onClick: onPay,
1179
+ disabled: isPayLoading || amountToPay <= 0,
1180
+ children: isPayLoading ? "Processing..." : "Submit Payment"
1181
+ }
1182
+ ),
1183
+ payAllWithCredits && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Button, { block: true, onClick: onPay, disabled: isPayLoading, children: isPayLoading ? "Processing..." : "Submit Payment" })
1044
1184
  ] });
1045
1185
  }
1046
1186
  function ACHSelector(props) {
@@ -1058,12 +1198,12 @@ function ACHSelector(props) {
1058
1198
  setSelectedBankGuid(bankGuid);
1059
1199
  handleToggle("ACHPayment");
1060
1200
  }
1061
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_jsx_runtime11.Fragment, { children: customerBanks.map((bank) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1201
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_jsx_runtime12.Fragment, { children: customerBanks.map((bank) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1062
1202
  Card,
1063
1203
  {
1064
1204
  onClick: (e) => handleBankSelect(e, bank.CustBankGUID),
1065
1205
  selected: !disabled && selectedMethod === "ACHPayment" && selectedBankGuid === bank.CustBankGUID,
1066
- children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1206
+ children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1067
1207
  Radio,
1068
1208
  {
1069
1209
  label: `Pay by ${bank.AccountDisplayString}`,
@@ -1086,22 +1226,22 @@ function CreditsSelector(props) {
1086
1226
  );
1087
1227
  }
1088
1228
  };
1089
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
1229
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
1090
1230
  Accordion,
1091
1231
  {
1092
1232
  isOpen,
1093
1233
  title: "Available Credits",
1094
1234
  onClick: () => setIsOpen((prev) => !prev),
1095
1235
  children: [
1096
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(HorizontalDivider, {}),
1097
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Stack, { sizing: "layout-group", width: "full", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1236
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(HorizontalDivider, {}),
1237
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Stack, { sizing: "layout-group", width: "full", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1098
1238
  Stack,
1099
1239
  {
1100
1240
  sizing: "layout-group",
1101
1241
  width: "full",
1102
1242
  overflowY: "auto",
1103
1243
  maxHeight: 300,
1104
- children: allCredits.map((credits) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
1244
+ children: allCredits.map((credits) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
1105
1245
  Stack,
1106
1246
  {
1107
1247
  horizontal: true,
@@ -1109,14 +1249,14 @@ function CreditsSelector(props) {
1109
1249
  items: "center",
1110
1250
  sizing: "layout-group",
1111
1251
  children: [
1112
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1252
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1113
1253
  Stack,
1114
1254
  {
1115
1255
  sizing: "layout-group",
1116
1256
  onClick: () => handleCreditSelect(credits),
1117
1257
  paddingY: true,
1118
1258
  flexGrow: 1,
1119
- children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1259
+ children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1120
1260
  Checkbox,
1121
1261
  {
1122
1262
  label: credits.InvoiceNumber,
@@ -1126,7 +1266,7 @@ function CreditsSelector(props) {
1126
1266
  )
1127
1267
  }
1128
1268
  ),
1129
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Subheader, { className: " pr-desktop-component-padding", children: [
1269
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Subheader, { className: " pr-desktop-component-padding", children: [
1130
1270
  "$",
1131
1271
  formatCurrencyDisplay(
1132
1272
  `${Math.abs(credits.InvoiceBalanceDue)}`
@@ -1,13 +1,14 @@
1
1
  "use client";
2
2
  import {
3
3
  SelectPaymentMethod
4
- } from "../chunk-EQQMFT5H.js";
4
+ } from "../chunk-XCIBYDVK.js";
5
5
  import "../chunk-TTO4PL7Y.js";
6
+ import "../chunk-4F6VQXKY.js";
6
7
  import "../chunk-3ZUSYRI7.js";
7
8
  import "../chunk-WT5XXW6G.js";
8
9
  import "../chunk-5UH6QUFB.js";
9
10
  import "../chunk-O4M2GISS.js";
10
- import "../chunk-XEUPUTYP.js";
11
+ import "../chunk-QTD7K43M.js";
11
12
  import "../chunk-EO3JJWFW.js";
12
13
  import "../chunk-4OS6APPF.js";
13
14
  import "../chunk-VG4EPHJA.js";