@doujins/payments-ui 0.1.6 → 0.1.8
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/index.cjs +75 -187
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +37 -65
- package/dist/index.d.ts +37 -65
- package/dist/index.js +75 -186
- package/dist/index.js.map +1 -1
- package/package.json +3 -4
- package/dist/styles.css +0 -2
package/dist/index.js
CHANGED
|
@@ -11,8 +11,8 @@ import { SolflareWalletAdapter } from '@solana/wallet-adapter-solflare';
|
|
|
11
11
|
import { TrustWalletAdapter } from '@solana/wallet-adapter-trust';
|
|
12
12
|
import { CoinbaseWalletAdapter } from '@solana/wallet-adapter-coinbase';
|
|
13
13
|
import * as DialogPrimitive from '@radix-ui/react-dialog';
|
|
14
|
-
import { X, ChevronDown, ChevronUp, Check,
|
|
15
|
-
import { clsx } from 'clsx';
|
|
14
|
+
import { X, ChevronDown, ChevronUp, Check, Loader2, CheckCircle, AlertCircle, Wallet, Ban, TriangleAlert, WalletCards, CreditCard, Trash2, Shield, UserRound, Calendar, KeyRound, XCircle, RotateCcw, RefreshCw } from 'lucide-react';
|
|
15
|
+
import clsx2, { clsx } from 'clsx';
|
|
16
16
|
import { twMerge } from 'tailwind-merge';
|
|
17
17
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
18
18
|
import countryList from 'country-list';
|
|
@@ -683,7 +683,7 @@ var CardDetailsForm = ({
|
|
|
683
683
|
window.CollectJS.startPaymentRequest();
|
|
684
684
|
};
|
|
685
685
|
const errorMessage = localError ?? externalError;
|
|
686
|
-
const collectFieldClass = "flex h-11 w-full items-center rounded-md border
|
|
686
|
+
const collectFieldClass = "flex h-11 w-full items-center rounded-md border bg-white/5 px-3 text-sm text-white";
|
|
687
687
|
return /* @__PURE__ */ jsxs(
|
|
688
688
|
"form",
|
|
689
689
|
{
|
|
@@ -692,12 +692,9 @@ var CardDetailsForm = ({
|
|
|
692
692
|
noValidate: true,
|
|
693
693
|
children: [
|
|
694
694
|
errorMessage && /* @__PURE__ */ jsx("div", { className: "rounded-md border border-red-500/40 bg-red-500/10 px-4 py-2 text-sm text-red-400", children: errorMessage }),
|
|
695
|
-
/* @__PURE__ */ jsxs("div", { className: "
|
|
696
|
-
/* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
697
|
-
/* @__PURE__ */
|
|
698
|
-
/* @__PURE__ */ jsx(User, { className: "h-4 w-4" }),
|
|
699
|
-
" First name"
|
|
700
|
-
] }),
|
|
695
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-4 md:flex-row", children: [
|
|
696
|
+
/* @__PURE__ */ jsxs("div", { className: "flex-1 space-y-2", children: [
|
|
697
|
+
/* @__PURE__ */ jsx(Label, { htmlFor: "payments-first", children: "First name" }),
|
|
701
698
|
/* @__PURE__ */ jsx(
|
|
702
699
|
Input,
|
|
703
700
|
{
|
|
@@ -708,11 +705,8 @@ var CardDetailsForm = ({
|
|
|
708
705
|
}
|
|
709
706
|
)
|
|
710
707
|
] }),
|
|
711
|
-
/* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
712
|
-
/* @__PURE__ */
|
|
713
|
-
/* @__PURE__ */ jsx(User, { className: "h-4 w-4" }),
|
|
714
|
-
" Last name"
|
|
715
|
-
] }),
|
|
708
|
+
/* @__PURE__ */ jsxs("div", { className: "flex-1 space-y-2", children: [
|
|
709
|
+
/* @__PURE__ */ jsx(Label, { htmlFor: "payments-last", children: "Last name" }),
|
|
716
710
|
/* @__PURE__ */ jsx(
|
|
717
711
|
Input,
|
|
718
712
|
{
|
|
@@ -776,10 +770,7 @@ var CardDetailsForm = ({
|
|
|
776
770
|
] }),
|
|
777
771
|
/* @__PURE__ */ jsxs("div", { className: "grid gap-5 md:grid-cols-2", children: [
|
|
778
772
|
/* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
779
|
-
/* @__PURE__ */
|
|
780
|
-
/* @__PURE__ */ jsx(MapPin, { className: "h-4 w-4" }),
|
|
781
|
-
" Postal code"
|
|
782
|
-
] }),
|
|
773
|
+
/* @__PURE__ */ jsx(Label, { htmlFor: "payments-postal", children: "Postal code" }),
|
|
783
774
|
/* @__PURE__ */ jsx(
|
|
784
775
|
Input,
|
|
785
776
|
{
|
|
@@ -821,17 +812,10 @@ var CardDetailsForm = ({
|
|
|
821
812
|
children: submitting || isTokenizing ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
822
813
|
/* @__PURE__ */ jsx(Loader2, { className: "mr-2 h-4 w-4 animate-spin" }),
|
|
823
814
|
" Processing\u2026"
|
|
824
|
-
] }) :
|
|
825
|
-
/* @__PURE__ */ jsx(CreditCard, { className: "mr-2 h-4 w-4" }),
|
|
826
|
-
" ",
|
|
827
|
-
submitLabel
|
|
828
|
-
] })
|
|
815
|
+
] }) : submitLabel
|
|
829
816
|
}
|
|
830
817
|
),
|
|
831
|
-
/* @__PURE__ */
|
|
832
|
-
/* @__PURE__ */ jsx(CreditCard, { className: "h-4 w-4" }),
|
|
833
|
-
" Your payment information is encrypted and processed securely."
|
|
834
|
-
] })
|
|
818
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs text-white/60", children: "Your payment information is encrypted and processed securely." })
|
|
835
819
|
]
|
|
836
820
|
}
|
|
837
821
|
);
|
|
@@ -945,93 +929,44 @@ var formatCardLabel = (method) => {
|
|
|
945
929
|
var StoredPaymentMethods = ({
|
|
946
930
|
selectedMethodId,
|
|
947
931
|
onMethodSelect,
|
|
948
|
-
showAddButton = true
|
|
949
|
-
heading = "Payment Methods",
|
|
950
|
-
description = "Manage your saved cards"
|
|
932
|
+
showAddButton = true
|
|
951
933
|
}) => {
|
|
952
|
-
const { listQuery, createMutation, deleteMutation } = usePaymentMethods();
|
|
953
934
|
const [isModalOpen, setIsModalOpen] = useState(false);
|
|
954
935
|
const [deletingId, setDeletingId] = useState(null);
|
|
936
|
+
const { listQuery, createMutation, deleteMutation } = usePaymentMethods();
|
|
955
937
|
const payments = useMemo(() => listQuery.data?.data ?? [], [listQuery.data]);
|
|
956
938
|
const handleCardTokenize = (token, billing) => {
|
|
957
939
|
createMutation.mutate({ token, billing });
|
|
958
940
|
};
|
|
959
|
-
const handleDelete = (method) => {
|
|
960
|
-
setDeletingId(method.id);
|
|
961
|
-
deleteMutation.mutate(
|
|
962
|
-
{ id: method.id },
|
|
963
|
-
{
|
|
964
|
-
onSettled: () => setDeletingId(null)
|
|
965
|
-
}
|
|
966
|
-
);
|
|
967
|
-
};
|
|
968
941
|
return /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
|
|
969
|
-
/* @__PURE__ */
|
|
970
|
-
|
|
971
|
-
/* @__PURE__ */ jsxs("p", { className: "flex items-center gap-2 text-sm font-medium text-muted-foreground", children: [
|
|
972
|
-
/* @__PURE__ */ jsx(WalletCards, { className: "h-4 w-4" }),
|
|
973
|
-
" ",
|
|
974
|
-
heading
|
|
975
|
-
] }),
|
|
976
|
-
/* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: description })
|
|
977
|
-
] }),
|
|
978
|
-
showAddButton && /* @__PURE__ */ jsxs(Button, { size: "sm", variant: "outline", onClick: () => setIsModalOpen(true), children: [
|
|
979
|
-
/* @__PURE__ */ jsx(CreditCard, { className: "mr-2 h-4 w-4" }),
|
|
980
|
-
" Add card"
|
|
981
|
-
] })
|
|
982
|
-
] }),
|
|
983
|
-
listQuery.isLoading ? /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-center rounded-lg border border-dashed border-border/60 bg-muted/10 py-8 text-sm text-muted-foreground", children: [
|
|
942
|
+
/* @__PURE__ */ jsx("div", { className: "flex items-start justify-between gap-4", children: showAddButton && /* @__PURE__ */ jsx(Button, { size: "sm", variant: "ghost", onClick: () => setIsModalOpen(true), children: "Add card" }) }),
|
|
943
|
+
listQuery.isLoading ? /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-center py-4 text-sm text-muted-foreground", children: [
|
|
984
944
|
/* @__PURE__ */ jsx(Loader2, { className: "mr-2 h-4 w-4 animate-spin" }),
|
|
985
|
-
" Loading cards
|
|
986
|
-
] }) : payments.length === 0 ? /* @__PURE__ */ jsx("div", { className: "
|
|
945
|
+
" Loading cards..."
|
|
946
|
+
] }) : payments.length === 0 ? /* @__PURE__ */ jsx("div", { className: "p-4 text-center text-sm text-muted-foreground", children: "No saved payment methods yet." }) : /* @__PURE__ */ jsx(ScrollArea, { className: "max-h-[320px] pr-2", children: /* @__PURE__ */ jsx("div", { className: "space-y-3", children: payments.map((method) => {
|
|
987
947
|
const isSelected = selectedMethodId === method.id;
|
|
988
948
|
return /* @__PURE__ */ jsxs(
|
|
989
949
|
"div",
|
|
990
950
|
{
|
|
991
951
|
className: cn(
|
|
992
|
-
"flex
|
|
993
|
-
|
|
952
|
+
"flex border border-border rounded-md px-4 py-3 flex-row items-center justify-between",
|
|
953
|
+
{
|
|
954
|
+
"bg-primary/5": isSelected
|
|
955
|
+
}
|
|
994
956
|
),
|
|
995
957
|
children: [
|
|
996
|
-
/* @__PURE__ */
|
|
997
|
-
/* @__PURE__ */ jsx("p", { className: "text-sm font-semibold text-foreground", children: formatCardLabel(method) }),
|
|
998
|
-
/* @__PURE__ */ jsxs("p", { className: "text-xs text-muted-foreground", children: [
|
|
999
|
-
"Added on",
|
|
1000
|
-
" ",
|
|
1001
|
-
method.created_at ? new Date(method.created_at).toLocaleDateString() : "unknown"
|
|
1002
|
-
] })
|
|
1003
|
-
] }),
|
|
958
|
+
/* @__PURE__ */ jsx("div", { className: "text-sm font-semibold text-foreground", children: formatCardLabel(method) }),
|
|
1004
959
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
1005
|
-
/* @__PURE__ */ jsx(
|
|
1006
|
-
Badge,
|
|
1007
|
-
{
|
|
1008
|
-
variant: method.is_active ? "default" : "secondary",
|
|
1009
|
-
className: cn(
|
|
1010
|
-
method.is_active ? "bg-primary/20 text-primary" : "bg-muted text-muted-foreground"
|
|
1011
|
-
),
|
|
1012
|
-
children: method.is_active ? "Active" : "Inactive"
|
|
1013
|
-
}
|
|
1014
|
-
),
|
|
1015
960
|
method.failure_reason && /* @__PURE__ */ jsx(Badge, { variant: "destructive", children: method.failure_reason }),
|
|
1016
961
|
onMethodSelect && /* @__PURE__ */ jsx(
|
|
1017
962
|
Button,
|
|
1018
963
|
{
|
|
1019
964
|
size: "sm",
|
|
1020
|
-
variant:
|
|
965
|
+
variant: "ghost",
|
|
1021
966
|
onClick: () => onMethodSelect(method),
|
|
967
|
+
className: clsx2("px-3", { "bg-muted/90": !isSelected, "bg-background": isSelected }),
|
|
1022
968
|
children: isSelected ? "Selected" : "Use card"
|
|
1023
969
|
}
|
|
1024
|
-
),
|
|
1025
|
-
/* @__PURE__ */ jsx(
|
|
1026
|
-
Button,
|
|
1027
|
-
{
|
|
1028
|
-
size: "icon",
|
|
1029
|
-
variant: "outline",
|
|
1030
|
-
className: "text-destructive",
|
|
1031
|
-
onClick: () => handleDelete(method),
|
|
1032
|
-
disabled: deletingId === method.id && deleteMutation.isPending,
|
|
1033
|
-
children: deletingId === method.id && deleteMutation.isPending ? /* @__PURE__ */ jsx(Loader2, { className: "h-4 w-4 animate-spin" }) : /* @__PURE__ */ jsx(Trash2, { className: "h-4 w-4" })
|
|
1034
|
-
}
|
|
1035
970
|
)
|
|
1036
971
|
] })
|
|
1037
972
|
]
|
|
@@ -1396,9 +1331,9 @@ var QRCodePayment = ({
|
|
|
1396
1331
|
onSuccess: handleQrSuccess
|
|
1397
1332
|
});
|
|
1398
1333
|
if (!selectedToken) {
|
|
1399
|
-
return /* @__PURE__ */ jsx("div", { className: "rounded-md border border-dashed
|
|
1334
|
+
return /* @__PURE__ */ jsx("div", { className: "rounded-md border border-dashed bg-muted/10 px-4 py-6 text-center text-sm text-muted-foreground", children: "Select a token to continue." });
|
|
1400
1335
|
}
|
|
1401
|
-
return /* @__PURE__ */ jsxs(Card, { className: "space-y-4 border
|
|
1336
|
+
return /* @__PURE__ */ jsxs(Card, { className: "space-y-4 border bg-background/80 p-6 shadow-none rounded-md", children: [
|
|
1402
1337
|
/* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between", children: [
|
|
1403
1338
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
1404
1339
|
/* @__PURE__ */ jsx("p", { className: "text-sm font-semibold text-foreground", children: "Scan with Solana Pay" }),
|
|
@@ -1417,7 +1352,7 @@ var QRCodePayment = ({
|
|
|
1417
1352
|
)
|
|
1418
1353
|
] }),
|
|
1419
1354
|
error && /* @__PURE__ */ jsx("div", { className: "rounded-md border border-destructive/40 bg-destructive/10 px-4 py-2 text-sm text-destructive", children: error }),
|
|
1420
|
-
/* @__PURE__ */ jsx("div", { className: "flex items-center justify-center rounded-2xl border border-dashed
|
|
1355
|
+
/* @__PURE__ */ jsx("div", { className: "flex items-center justify-center rounded-2xl border border-dashed bg-muted/5 p-6", children: qrDataUri ? /* @__PURE__ */ jsx("img", { src: qrDataUri, alt: "Solana Pay QR", className: "h-72 w-72 rounded-lg border bg-card" }) : /* @__PURE__ */ jsx("div", { className: "flex flex-col items-center gap-2 text-sm text-muted-foreground", children: isLoading ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1421
1356
|
/* @__PURE__ */ jsx(Loader2, { className: "h-5 w-5 animate-spin" }),
|
|
1422
1357
|
" Generating QR code\u2026"
|
|
1423
1358
|
] }) : "QR code unavailable" }) }),
|
|
@@ -1769,7 +1704,7 @@ var SolanaPaymentView = ({
|
|
|
1769
1704
|
/* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
1770
1705
|
/* @__PURE__ */ jsx("p", { className: "text-sm font-medium text-foreground", children: "Select token" }),
|
|
1771
1706
|
/* @__PURE__ */ jsxs(Select, { value: selectedToken?.symbol ?? "", onValueChange: handleTokenChange, children: [
|
|
1772
|
-
/* @__PURE__ */ jsx(SelectTrigger, { children: /* @__PURE__ */ jsx(SelectValue, { placeholder: "Select token" }) }),
|
|
1707
|
+
/* @__PURE__ */ jsx(SelectTrigger, { className: "border bg-transparent", children: /* @__PURE__ */ jsx(SelectValue, { placeholder: "Select token" }) }),
|
|
1773
1708
|
/* @__PURE__ */ jsx(SelectContent, { className: "max-h-64", children: tokens.map((token) => /* @__PURE__ */ jsxs(SelectItem, { value: token.symbol, children: [
|
|
1774
1709
|
token.name,
|
|
1775
1710
|
" (",
|
|
@@ -1796,7 +1731,7 @@ var SolanaPaymentView = ({
|
|
|
1796
1731
|
/* @__PURE__ */ jsx("p", { className: "text-2xl font-semibold text-foreground", children: "Pay with Solana" }),
|
|
1797
1732
|
/* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: "Choose a supported token and send the payment via Solana Pay QR code." })
|
|
1798
1733
|
] }),
|
|
1799
|
-
onClose && /* @__PURE__ */
|
|
1734
|
+
onClose && /* @__PURE__ */ jsx(
|
|
1800
1735
|
Button,
|
|
1801
1736
|
{
|
|
1802
1737
|
type: "button",
|
|
@@ -1804,11 +1739,8 @@ var SolanaPaymentView = ({
|
|
|
1804
1739
|
variant: "ghost",
|
|
1805
1740
|
onClick: handleClose,
|
|
1806
1741
|
disabled: paymentState === "processing" || paymentState === "confirming",
|
|
1807
|
-
className: "h-8 px-
|
|
1808
|
-
children:
|
|
1809
|
-
/* @__PURE__ */ jsx(ArrowLeft, { className: "mr-2 h-4 w-4" }),
|
|
1810
|
-
" Back"
|
|
1811
|
-
]
|
|
1742
|
+
className: "h-8 px-3 text-sm",
|
|
1743
|
+
children: "Back"
|
|
1812
1744
|
}
|
|
1813
1745
|
)
|
|
1814
1746
|
] }),
|
|
@@ -1839,7 +1771,7 @@ var PaymentExperience = ({
|
|
|
1839
1771
|
const [savedError, setSavedError] = useState(null);
|
|
1840
1772
|
const [newCardStatus, setNewCardStatus] = useState("idle");
|
|
1841
1773
|
const [newCardError, setNewCardError] = useState(null);
|
|
1842
|
-
const { notifyStatus,
|
|
1774
|
+
const { notifyStatus, notifyError } = usePaymentNotifications();
|
|
1843
1775
|
useEffect(() => {
|
|
1844
1776
|
setActiveTab(showStored ? "saved" : "new");
|
|
1845
1777
|
}, [showStored]);
|
|
@@ -1899,7 +1831,7 @@ var PaymentExperience = ({
|
|
|
1899
1831
|
},
|
|
1900
1832
|
[notifyError, notifyStatus, onNewCardPayment]
|
|
1901
1833
|
);
|
|
1902
|
-
|
|
1834
|
+
useCallback(() => {
|
|
1903
1835
|
if (!enableSolanaPay) return;
|
|
1904
1836
|
setMode("solana");
|
|
1905
1837
|
}, [enableSolanaPay]);
|
|
@@ -1927,11 +1859,9 @@ var PaymentExperience = ({
|
|
|
1927
1859
|
/* @__PURE__ */ jsx(
|
|
1928
1860
|
StoredPaymentMethods,
|
|
1929
1861
|
{
|
|
1930
|
-
|
|
1862
|
+
showAddButton: false,
|
|
1931
1863
|
selectedMethodId,
|
|
1932
|
-
onMethodSelect: handleMethodSelect
|
|
1933
|
-
description: "Select one of your stored payment methods.",
|
|
1934
|
-
showAddButton: false
|
|
1864
|
+
onMethodSelect: handleMethodSelect
|
|
1935
1865
|
}
|
|
1936
1866
|
),
|
|
1937
1867
|
/* @__PURE__ */ jsx(
|
|
@@ -1940,7 +1870,7 @@ var PaymentExperience = ({
|
|
|
1940
1870
|
className: "w-full",
|
|
1941
1871
|
disabled: !selectedMethodId || savedStatus === "processing",
|
|
1942
1872
|
onClick: handleSavedPayment,
|
|
1943
|
-
children: savedStatus === "processing" ? "Processing
|
|
1873
|
+
children: savedStatus === "processing" ? "Processing..." : "Pay with selected card"
|
|
1944
1874
|
}
|
|
1945
1875
|
),
|
|
1946
1876
|
savedError && /* @__PURE__ */ jsx("p", { className: "text-sm text-destructive", children: savedError })
|
|
@@ -1961,28 +1891,21 @@ var PaymentExperience = ({
|
|
|
1961
1891
|
}
|
|
1962
1892
|
);
|
|
1963
1893
|
};
|
|
1964
|
-
const renderCardExperience = () => /* @__PURE__ */ jsxs(
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
className: "
|
|
1971
|
-
|
|
1972
|
-
/* @__PURE__ */
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
}
|
|
1980
|
-
),
|
|
1981
|
-
enableSolanaPay && /* @__PURE__ */ jsxs(Button, { className: "w-full", variant: "secondary", onClick: showSolanaView, children: [
|
|
1982
|
-
/* @__PURE__ */ jsx(Sparkles, { className: "mr-2 h-4 w-4" }),
|
|
1983
|
-
" Pay with Solana"
|
|
1984
|
-
] })
|
|
1985
|
-
] });
|
|
1894
|
+
const renderCardExperience = () => /* @__PURE__ */ jsxs(
|
|
1895
|
+
Tabs,
|
|
1896
|
+
{
|
|
1897
|
+
value: activeTab,
|
|
1898
|
+
onValueChange: (value) => setActiveTab(value),
|
|
1899
|
+
children: [
|
|
1900
|
+
/* @__PURE__ */ jsxs(TabsList, { className: "grid w-full grid-cols-2", children: [
|
|
1901
|
+
/* @__PURE__ */ jsx(TabsTrigger, { value: "saved", disabled: !showStored, children: "Use saved card" }),
|
|
1902
|
+
/* @__PURE__ */ jsx(TabsTrigger, { value: "new", disabled: !showNewCard, children: "Add new card" })
|
|
1903
|
+
] }),
|
|
1904
|
+
/* @__PURE__ */ jsx(TabsContent, { value: "saved", children: renderSavedTab() }),
|
|
1905
|
+
/* @__PURE__ */ jsx(TabsContent, { value: "new", children: renderNewTab() })
|
|
1906
|
+
]
|
|
1907
|
+
}
|
|
1908
|
+
);
|
|
1986
1909
|
return /* @__PURE__ */ jsxs("div", { className: "space-y-6 pt-4", children: [
|
|
1987
1910
|
mode === "cards" && renderCardExperience(),
|
|
1988
1911
|
mode === "solana" && enableSolanaPay && /* @__PURE__ */ jsx(
|
|
@@ -2006,7 +1929,7 @@ var SubscriptionSuccessDialog = ({
|
|
|
2006
1929
|
}) => {
|
|
2007
1930
|
return /* @__PURE__ */ jsx(Dialog, { open, onOpenChange: (value) => {
|
|
2008
1931
|
if (!value) onClose();
|
|
2009
|
-
}, children: /* @__PURE__ */ jsxs(DialogContent, { className: "w-full max-w-md overflow-hidden border
|
|
1932
|
+
}, children: /* @__PURE__ */ jsxs(DialogContent, { className: "w-full max-w-md overflow-hidden border bg-background/95 p-0 shadow-2xl", children: [
|
|
2010
1933
|
/* @__PURE__ */ jsxs("div", { className: "bg-gradient-to-b from-primary/25 via-primary/10 to-background px-6 py-8 text-center", children: [
|
|
2011
1934
|
/* @__PURE__ */ jsx("div", { className: "mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-background/60", children: /* @__PURE__ */ jsx(CheckCircle, { className: "h-10 w-10 text-primary" }) }),
|
|
2012
1935
|
/* @__PURE__ */ jsxs(DialogHeader, { children: [
|
|
@@ -2162,11 +2085,11 @@ var SubscriptionCheckoutModal = ({
|
|
|
2162
2085
|
};
|
|
2163
2086
|
const handleNewCardPayment = async ({ token, billing }) => {
|
|
2164
2087
|
const response = await subscribeWithCard({
|
|
2165
|
-
|
|
2088
|
+
billing,
|
|
2166
2089
|
provider,
|
|
2090
|
+
idempotencyKey,
|
|
2167
2091
|
paymentToken: token,
|
|
2168
|
-
|
|
2169
|
-
idempotencyKey
|
|
2092
|
+
priceId: ensurePrice()
|
|
2170
2093
|
});
|
|
2171
2094
|
assertCheckoutSuccess(response.status, response.message);
|
|
2172
2095
|
notifySuccess();
|
|
@@ -2194,9 +2117,9 @@ var SubscriptionCheckoutModal = ({
|
|
|
2194
2117
|
/* @__PURE__ */ jsx(Dialog, { open, onOpenChange: handleClose, children: /* @__PURE__ */ jsx(
|
|
2195
2118
|
DialogContent,
|
|
2196
2119
|
{
|
|
2197
|
-
className: "max-w-3xl max-h-[90vh] overflow-y-auto
|
|
2120
|
+
className: "max-w-3xl max-h-[90vh] overflow-y-auto [&::-webkit-scrollbar]:hidden",
|
|
2198
2121
|
children: /* @__PURE__ */ jsxs("div", { className: "p-6 space-y-6", children: [
|
|
2199
|
-
!priceId && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 rounded-lg
|
|
2122
|
+
!priceId && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 rounded-lg px-3 py-2 text-sm text-destructive", children: [
|
|
2200
2123
|
/* @__PURE__ */ jsx(AlertCircle, { className: "h-4 w-4" }),
|
|
2201
2124
|
" Select a subscription plan to continue."
|
|
2202
2125
|
] }),
|
|
@@ -2205,14 +2128,14 @@ var SubscriptionCheckoutModal = ({
|
|
|
2205
2128
|
{
|
|
2206
2129
|
usdAmount,
|
|
2207
2130
|
priceId: priceId ?? "",
|
|
2208
|
-
|
|
2131
|
+
initialMode,
|
|
2209
2132
|
onSolanaError: solanaError,
|
|
2133
|
+
onSolanaSuccess: solanaSuccess,
|
|
2210
2134
|
enableNewCard: Boolean(priceId),
|
|
2211
2135
|
enableStoredMethods: Boolean(priceId),
|
|
2212
2136
|
enableSolanaPay: enableSolanaPay && Boolean(priceId),
|
|
2213
2137
|
onNewCardPayment: priceId ? handleNewCardPayment : void 0,
|
|
2214
|
-
onSavedMethodPayment: priceId ? handleSavedMethodPayment : void 0
|
|
2215
|
-
initialMode
|
|
2138
|
+
onSavedMethodPayment: priceId ? handleSavedMethodPayment : void 0
|
|
2216
2139
|
}
|
|
2217
2140
|
)
|
|
2218
2141
|
] })
|
|
@@ -2244,8 +2167,8 @@ var wallets = [
|
|
|
2244
2167
|
];
|
|
2245
2168
|
var WalletModal = ({ open, onOpenChange }) => {
|
|
2246
2169
|
const [expandedWallet, setExpandedWallet] = useState(null);
|
|
2247
|
-
return /* @__PURE__ */ jsx(Dialog, { open, onOpenChange, children: /* @__PURE__ */ jsxs(DialogContent, { className: "w-full max-w-lg max-h-[90vh] overflow-y-auto rounded-md border
|
|
2248
|
-
/* @__PURE__ */ jsxs(DialogHeader, { className: "border-b
|
|
2170
|
+
return /* @__PURE__ */ jsx(Dialog, { open, onOpenChange, children: /* @__PURE__ */ jsxs(DialogContent, { className: "w-full max-w-lg max-h-[90vh] overflow-y-auto rounded-md border bg-background/95 p-0 shadow-2xl [&::-webkit-scrollbar]:hidden", children: [
|
|
2171
|
+
/* @__PURE__ */ jsxs(DialogHeader, { className: "border-b bg-gradient-to-r from-primary/10 via-background to-background px-6 py-5 text-left", children: [
|
|
2249
2172
|
/* @__PURE__ */ jsxs(DialogTitle, { className: "flex items-center gap-2 text-foreground", children: [
|
|
2250
2173
|
/* @__PURE__ */ jsx(Wallet, { className: "h-5 w-5 text-primary" }),
|
|
2251
2174
|
" Connect a Solana wallet"
|
|
@@ -2256,7 +2179,7 @@ var WalletModal = ({ open, onOpenChange }) => {
|
|
|
2256
2179
|
wallets.map((wallet) => /* @__PURE__ */ jsxs(
|
|
2257
2180
|
"div",
|
|
2258
2181
|
{
|
|
2259
|
-
className: "rounded-2xl border
|
|
2182
|
+
className: "rounded-2xl border bg-background/80 p-4 shadow-sm",
|
|
2260
2183
|
children: [
|
|
2261
2184
|
/* @__PURE__ */ jsxs(
|
|
2262
2185
|
"button",
|
|
@@ -2291,7 +2214,7 @@ var WalletModal = ({ open, onOpenChange }) => {
|
|
|
2291
2214
|
},
|
|
2292
2215
|
wallet.id
|
|
2293
2216
|
)),
|
|
2294
|
-
/* @__PURE__ */ jsx("div", { className: "rounded-2xl border
|
|
2217
|
+
/* @__PURE__ */ jsx("div", { className: "rounded-2xl border bg-muted/10 p-4 text-xs text-muted-foreground", children: "Don\u2019t see your wallet? Additional providers will be added soon. Contact support if you need manual verification." })
|
|
2295
2218
|
] })
|
|
2296
2219
|
] }) });
|
|
2297
2220
|
};
|
|
@@ -2450,46 +2373,12 @@ var usePaymentContext = () => {
|
|
|
2450
2373
|
}
|
|
2451
2374
|
return context;
|
|
2452
2375
|
};
|
|
2453
|
-
var BillingThemeProvider = ({
|
|
2454
|
-
children,
|
|
2455
|
-
className,
|
|
2456
|
-
dark = false
|
|
2457
|
-
}) => {
|
|
2458
|
-
return /* @__PURE__ */ jsx(
|
|
2459
|
-
"div",
|
|
2460
|
-
{
|
|
2461
|
-
className: cn(
|
|
2462
|
-
"payments-ui-root",
|
|
2463
|
-
dark && "dark",
|
|
2464
|
-
className
|
|
2465
|
-
),
|
|
2466
|
-
children
|
|
2467
|
-
}
|
|
2468
|
-
);
|
|
2469
|
-
};
|
|
2470
|
-
var BillingThemePortal = ({
|
|
2471
|
-
children,
|
|
2472
|
-
className,
|
|
2473
|
-
dark = false
|
|
2474
|
-
}) => {
|
|
2475
|
-
return /* @__PURE__ */ jsx(
|
|
2476
|
-
"div",
|
|
2477
|
-
{
|
|
2478
|
-
className: cn(
|
|
2479
|
-
"payments-ui-portal",
|
|
2480
|
-
dark && "dark",
|
|
2481
|
-
className
|
|
2482
|
-
),
|
|
2483
|
-
children
|
|
2484
|
-
}
|
|
2485
|
-
);
|
|
2486
|
-
};
|
|
2487
2376
|
var SolanaPaymentSelector = ({
|
|
2488
2377
|
isOpen,
|
|
2489
2378
|
onClose,
|
|
2490
2379
|
...props
|
|
2491
2380
|
}) => {
|
|
2492
|
-
return /* @__PURE__ */ jsx(Dialog, { open: isOpen, onOpenChange: (value) => value ? void 0 : onClose(), children: /* @__PURE__ */ jsx(DialogContent, { className: "w-full max-w-2xl max-h-[90vh] overflow-y-auto rounded-md border
|
|
2381
|
+
return /* @__PURE__ */ jsx(Dialog, { open: isOpen, onOpenChange: (value) => value ? void 0 : onClose(), children: /* @__PURE__ */ jsx(DialogContent, { className: "w-full max-w-2xl max-h-[90vh] overflow-y-auto rounded-md border bg-background/95 p-0 shadow-2xl [&::-webkit-scrollbar]:hidden", children: /* @__PURE__ */ jsx(SolanaPaymentView, { ...props, onClose }) }) });
|
|
2493
2382
|
};
|
|
2494
2383
|
var Table = React17.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { className: "relative w-full overflow-auto", children: /* @__PURE__ */ jsx(
|
|
2495
2384
|
"table",
|
|
@@ -2929,8 +2818,8 @@ var BillingHistory = ({
|
|
|
2929
2818
|
/* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: t.reviewActivity }),
|
|
2930
2819
|
enableCancel && /* @__PURE__ */ jsx(CancelMembershipDialog, { onNotify: notify })
|
|
2931
2820
|
] }),
|
|
2932
|
-
/* @__PURE__ */ jsx("div", { className: "max-h-[300px] overflow-y-auto rounded-lg border
|
|
2933
|
-
/* @__PURE__ */ jsx(TableHeader, { children: /* @__PURE__ */ jsxs(TableRow, { className: "
|
|
2821
|
+
/* @__PURE__ */ jsx("div", { className: "max-h-[300px] overflow-y-auto rounded-lg border ", children: /* @__PURE__ */ jsx("div", { className: "overflow-x-auto", children: historyQuery.isLoading ? /* @__PURE__ */ jsx("p", { className: "p-4 text-center text-sm text-muted-foreground", children: t.loading }) : historyQuery.isError ? /* @__PURE__ */ jsx("p", { className: "p-4 text-center text-sm text-destructive", children: t.error }) : /* @__PURE__ */ jsxs(Table, { children: [
|
|
2822
|
+
/* @__PURE__ */ jsx(TableHeader, { children: /* @__PURE__ */ jsxs(TableRow, { className: "", children: [
|
|
2934
2823
|
/* @__PURE__ */ jsx(TableHead, { children: t.reference }),
|
|
2935
2824
|
/* @__PURE__ */ jsx(TableHead, { children: t.date }),
|
|
2936
2825
|
/* @__PURE__ */ jsx(TableHead, { children: t.amount }),
|
|
@@ -2938,7 +2827,7 @@ var BillingHistory = ({
|
|
|
2938
2827
|
/* @__PURE__ */ jsx(TableHead, { children: t.status })
|
|
2939
2828
|
] }) }),
|
|
2940
2829
|
/* @__PURE__ */ jsx(TableBody, { children: payments.map(
|
|
2941
|
-
(page) => page.data.map((payment) => /* @__PURE__ */ jsxs(TableRow, { className: "
|
|
2830
|
+
(page) => page.data.map((payment) => /* @__PURE__ */ jsxs(TableRow, { className: "", children: [
|
|
2942
2831
|
/* @__PURE__ */ jsx(TableCell, { className: "font-mono text-sm", children: payment.id.slice(0, 7).toUpperCase() }),
|
|
2943
2832
|
/* @__PURE__ */ jsx(TableCell, { children: formatDate(payment.purchased_at) }),
|
|
2944
2833
|
/* @__PURE__ */ jsx(TableCell, { children: formatAmount(payment.amount, payment.currency) }),
|
|
@@ -3126,10 +3015,10 @@ var PaymentMethodsSection = ({
|
|
|
3126
3015
|
/* @__PURE__ */ jsx(Loader2, { className: "mr-2 h-5 w-5 animate-spin" }),
|
|
3127
3016
|
" ",
|
|
3128
3017
|
t.loadingCards
|
|
3129
|
-
] }) : payments.length === 0 ? /* @__PURE__ */ jsx("div", { className: "
|
|
3018
|
+
] }) : payments.length === 0 ? /* @__PURE__ */ jsx("div", { className: "p-6 text-sm text-center", children: t.noPaymentMethods }) : /* @__PURE__ */ jsx("div", { className: "space-y-3", children: payments.map((method) => /* @__PURE__ */ jsxs(
|
|
3130
3019
|
"div",
|
|
3131
3020
|
{
|
|
3132
|
-
className: "rounded-lg border
|
|
3021
|
+
className: "rounded-lg border bg-white/5 p-4 shadow-sm",
|
|
3133
3022
|
children: [
|
|
3134
3023
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2 md:flex-row md:items-center md:justify-between", children: [
|
|
3135
3024
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
@@ -3214,7 +3103,7 @@ var PaymentMethodsSection = ({
|
|
|
3214
3103
|
},
|
|
3215
3104
|
externalError: createMutation.error?.message ?? null,
|
|
3216
3105
|
onTokenize: handleCardTokenize,
|
|
3217
|
-
className: "rounded-2xl border
|
|
3106
|
+
className: "rounded-2xl border bg-white/5 p-6"
|
|
3218
3107
|
}
|
|
3219
3108
|
)
|
|
3220
3109
|
] }) }),
|
|
@@ -3237,7 +3126,7 @@ var PaymentMethodsSection = ({
|
|
|
3237
3126
|
},
|
|
3238
3127
|
externalError: replaceMutation.error?.message ?? null,
|
|
3239
3128
|
onTokenize: handleReplaceTokenize,
|
|
3240
|
-
className: "rounded-2xl border
|
|
3129
|
+
className: "rounded-2xl border bg-white/5 p-6"
|
|
3241
3130
|
}
|
|
3242
3131
|
)
|
|
3243
3132
|
] }) })
|
|
@@ -3306,7 +3195,7 @@ var WalletDialog = ({ open, onOpenChange }) => {
|
|
|
3306
3195
|
setForm(initialState);
|
|
3307
3196
|
};
|
|
3308
3197
|
return /* @__PURE__ */ jsx(AlertDialog, { open, onOpenChange, children: /* @__PURE__ */ jsxs(AlertDialogContent, { className: "max-h-[95vh] max-w-lg overflow-y-auto rounded-2xl border border-border bg-background", children: [
|
|
3309
|
-
/* @__PURE__ */ jsxs(AlertDialogHeader, { className: "border-b
|
|
3198
|
+
/* @__PURE__ */ jsxs(AlertDialogHeader, { className: "border-b pb-4", children: [
|
|
3310
3199
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-center gap-2", children: [
|
|
3311
3200
|
/* @__PURE__ */ jsx(Shield, { className: "h-5 w-5 text-primary" }),
|
|
3312
3201
|
/* @__PURE__ */ jsx(AlertDialogTitle, { className: "text-center text-base font-semibold uppercase tracking-wide", children: "Secure Payment via Mobius Pay" })
|
|
@@ -3350,7 +3239,7 @@ var WalletDialog = ({ open, onOpenChange }) => {
|
|
|
3350
3239
|
] })
|
|
3351
3240
|
] })
|
|
3352
3241
|
] }),
|
|
3353
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-start gap-3 rounded-md border
|
|
3242
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-start gap-3 rounded-md border bg-muted/10 p-4", children: [
|
|
3354
3243
|
/* @__PURE__ */ jsx(Checkbox, { id: "terms-agree", checked: form.termsAccepted, onCheckedChange: (checked) => updateField("termsAccepted", Boolean(checked)) }),
|
|
3355
3244
|
/* @__PURE__ */ jsx(Label, { htmlFor: "terms-agree", className: "text-sm text-muted-foreground", children: "By completing this order, I confirm that I am 18 years or older and agree to your privacy policy and terms." })
|
|
3356
3245
|
] }),
|
|
@@ -3758,6 +3647,6 @@ var usePaymentStatus = (options = {}) => {
|
|
|
3758
3647
|
};
|
|
3759
3648
|
};
|
|
3760
3649
|
|
|
3761
|
-
export { BillingHistory,
|
|
3650
|
+
export { BillingHistory, CancelMembershipDialog, CardDetailsForm, ClientApiError, PaymentContext, PaymentExperience, PaymentMethodsSection, PaymentProvider, PaymentsDialogProvider, SolanaPaymentSelector, SolanaPaymentView, StoredPaymentMethods, SubscriptionCheckoutModal, SubscriptionSuccessDialog, WalletDialog, WalletModal, createClient, usePaymentContext, usePaymentDialogs, usePaymentMethods, usePaymentNotifications, usePaymentStatus, useSolanaQrPayment, useSubscriptionActions, useSupportedTokens, useTokenBalance };
|
|
3762
3651
|
//# sourceMappingURL=index.js.map
|
|
3763
3652
|
//# sourceMappingURL=index.js.map
|