azirid-react 0.7.0 → 0.8.0
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 +414 -359
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +76 -5
- package/dist/index.d.ts +76 -5
- package/dist/index.js +414 -360
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
package/dist/index.js
CHANGED
|
@@ -511,6 +511,86 @@ function removeStyles() {
|
|
|
511
511
|
document.getElementById(STYLE_ID)?.remove();
|
|
512
512
|
injected = false;
|
|
513
513
|
}
|
|
514
|
+
function useAuthMutations(deps) {
|
|
515
|
+
const {
|
|
516
|
+
client,
|
|
517
|
+
props,
|
|
518
|
+
setUser,
|
|
519
|
+
setError,
|
|
520
|
+
updateAccessToken,
|
|
521
|
+
saveSessionTokens,
|
|
522
|
+
normalizeToken,
|
|
523
|
+
withAppContext,
|
|
524
|
+
clearSession
|
|
525
|
+
} = deps;
|
|
526
|
+
const queryClient = useQueryClient();
|
|
527
|
+
const loginMutation = useMutation({
|
|
528
|
+
mutationFn: (data) => client.post(client.paths.login, withAppContext(data)),
|
|
529
|
+
onSuccess: (data) => {
|
|
530
|
+
setUser(data.user);
|
|
531
|
+
updateAccessToken(normalizeToken(data));
|
|
532
|
+
saveSessionTokens(data);
|
|
533
|
+
setError(null);
|
|
534
|
+
props.onLoginSuccess?.(data);
|
|
535
|
+
},
|
|
536
|
+
onError: (err) => {
|
|
537
|
+
setError(err.message);
|
|
538
|
+
props.onError?.(err.message);
|
|
539
|
+
}
|
|
540
|
+
});
|
|
541
|
+
const signupMutation = useMutation({
|
|
542
|
+
mutationFn: (data) => {
|
|
543
|
+
const { confirmPassword: _, ...payload } = data;
|
|
544
|
+
return client.post(client.paths.signup, withAppContext({ ...payload }));
|
|
545
|
+
},
|
|
546
|
+
onSuccess: (data) => {
|
|
547
|
+
setUser(data.user);
|
|
548
|
+
updateAccessToken(normalizeToken(data));
|
|
549
|
+
saveSessionTokens(data);
|
|
550
|
+
setError(null);
|
|
551
|
+
props.onSignupSuccess?.(data);
|
|
552
|
+
},
|
|
553
|
+
onError: (err) => {
|
|
554
|
+
setError(err.message);
|
|
555
|
+
props.onError?.(err.message);
|
|
556
|
+
}
|
|
557
|
+
});
|
|
558
|
+
const logoutMutation = useMutation({
|
|
559
|
+
mutationFn: () => client.post(client.paths.logout),
|
|
560
|
+
onSettled: () => {
|
|
561
|
+
clearSession();
|
|
562
|
+
setError(null);
|
|
563
|
+
queryClient.clear();
|
|
564
|
+
props.onLogoutSuccess?.();
|
|
565
|
+
}
|
|
566
|
+
});
|
|
567
|
+
const refreshFn = useCallback(async () => {
|
|
568
|
+
try {
|
|
569
|
+
await client.refreshSession();
|
|
570
|
+
updateAccessToken(client.getAccessToken());
|
|
571
|
+
} catch (err) {
|
|
572
|
+
clearSession();
|
|
573
|
+
queryClient.clear();
|
|
574
|
+
props.onSessionExpired?.();
|
|
575
|
+
throw err;
|
|
576
|
+
}
|
|
577
|
+
}, [client, queryClient, props, updateAccessToken, clearSession]);
|
|
578
|
+
const switchTenantFn = useCallback(
|
|
579
|
+
async (tenantId) => {
|
|
580
|
+
await client.refreshSession({ tenantId });
|
|
581
|
+
updateAccessToken(client.getAccessToken());
|
|
582
|
+
await queryClient.invalidateQueries({ queryKey: ["azirid-access"] });
|
|
583
|
+
},
|
|
584
|
+
[client, queryClient, updateAccessToken]
|
|
585
|
+
);
|
|
586
|
+
return {
|
|
587
|
+
loginMutation,
|
|
588
|
+
signupMutation,
|
|
589
|
+
logoutMutation,
|
|
590
|
+
refreshFn,
|
|
591
|
+
switchTenantFn
|
|
592
|
+
};
|
|
593
|
+
}
|
|
514
594
|
var AziridContext = createContext(null);
|
|
515
595
|
AziridContext.displayName = "AziridContext";
|
|
516
596
|
var ClientContext = createContext(null);
|
|
@@ -543,7 +623,6 @@ function AziridProviderInner({
|
|
|
543
623
|
client,
|
|
544
624
|
props
|
|
545
625
|
}) {
|
|
546
|
-
const queryClient = useQueryClient();
|
|
547
626
|
const [user, setUser] = useState(null);
|
|
548
627
|
const [accessToken, setAccessToken] = useState(null);
|
|
549
628
|
const [error, setError] = useState(null);
|
|
@@ -681,65 +760,23 @@ function AziridProviderInner({
|
|
|
681
760
|
(data) => data.at ?? data.accessToken,
|
|
682
761
|
[]
|
|
683
762
|
);
|
|
684
|
-
const
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
const { confirmPassword: _, ...payload } = data;
|
|
701
|
-
return client.post(client.paths.signup, withAppContext({ ...payload }));
|
|
702
|
-
},
|
|
703
|
-
onSuccess: (data) => {
|
|
704
|
-
setUser(data.user);
|
|
705
|
-
updateAccessToken(normalizeToken(data));
|
|
706
|
-
saveSessionTokens(data);
|
|
707
|
-
setError(null);
|
|
708
|
-
props.onSignupSuccess?.(data);
|
|
709
|
-
},
|
|
710
|
-
onError: (err) => {
|
|
711
|
-
setError(err.message);
|
|
712
|
-
props.onError?.(err.message);
|
|
713
|
-
}
|
|
714
|
-
});
|
|
715
|
-
const logoutMutation = useMutation({
|
|
716
|
-
mutationFn: () => client.post(client.paths.logout),
|
|
717
|
-
onSettled: () => {
|
|
718
|
-
clearSession();
|
|
719
|
-
setError(null);
|
|
720
|
-
queryClient.clear();
|
|
721
|
-
props.onLogoutSuccess?.();
|
|
722
|
-
}
|
|
763
|
+
const {
|
|
764
|
+
loginMutation,
|
|
765
|
+
signupMutation,
|
|
766
|
+
logoutMutation,
|
|
767
|
+
refreshFn,
|
|
768
|
+
switchTenantFn
|
|
769
|
+
} = useAuthMutations({
|
|
770
|
+
client,
|
|
771
|
+
props,
|
|
772
|
+
setUser,
|
|
773
|
+
setError,
|
|
774
|
+
updateAccessToken,
|
|
775
|
+
saveSessionTokens,
|
|
776
|
+
normalizeToken,
|
|
777
|
+
withAppContext,
|
|
778
|
+
clearSession
|
|
723
779
|
});
|
|
724
|
-
const refreshFn = useCallback(async () => {
|
|
725
|
-
try {
|
|
726
|
-
await client.refreshSession();
|
|
727
|
-
updateAccessToken(client.getAccessToken());
|
|
728
|
-
} catch (err) {
|
|
729
|
-
clearSession();
|
|
730
|
-
queryClient.clear();
|
|
731
|
-
props.onSessionExpired?.();
|
|
732
|
-
throw err;
|
|
733
|
-
}
|
|
734
|
-
}, [client, queryClient, props, updateAccessToken, clearSession]);
|
|
735
|
-
const switchTenantFn = useCallback(
|
|
736
|
-
async (tenantId) => {
|
|
737
|
-
await client.refreshSession({ tenantId });
|
|
738
|
-
updateAccessToken(client.getAccessToken());
|
|
739
|
-
await queryClient.invalidateQueries({ queryKey: ["azirid-access"] });
|
|
740
|
-
},
|
|
741
|
-
[client, queryClient, updateAccessToken]
|
|
742
|
-
);
|
|
743
780
|
const login = useCallback(
|
|
744
781
|
(data) => loginMutation.mutate(data),
|
|
745
782
|
[loginMutation]
|
|
@@ -1714,6 +1751,20 @@ function ReferralStats({ className, style }) {
|
|
|
1714
1751
|
] });
|
|
1715
1752
|
}
|
|
1716
1753
|
ReferralStats.displayName = "ReferralStats";
|
|
1754
|
+
|
|
1755
|
+
// ../shared/dist/index.js
|
|
1756
|
+
function formatAmount(amount, currency) {
|
|
1757
|
+
try {
|
|
1758
|
+
return new Intl.NumberFormat(void 0, {
|
|
1759
|
+
style: "currency",
|
|
1760
|
+
currency,
|
|
1761
|
+
minimumFractionDigits: 0,
|
|
1762
|
+
maximumFractionDigits: 2
|
|
1763
|
+
}).format(amount / 100);
|
|
1764
|
+
} catch {
|
|
1765
|
+
return `${currency} ${(amount / 100).toFixed(2)}`;
|
|
1766
|
+
}
|
|
1767
|
+
}
|
|
1717
1768
|
function usePlans() {
|
|
1718
1769
|
const client = useAccessClient();
|
|
1719
1770
|
return useQuery({
|
|
@@ -1879,30 +1930,42 @@ var cancelStyle = {
|
|
|
1879
1930
|
cursor: "pointer",
|
|
1880
1931
|
fontFamily: "inherit"
|
|
1881
1932
|
};
|
|
1933
|
+
var styles3 = {
|
|
1934
|
+
featuresList: {
|
|
1935
|
+
listStyle: "none",
|
|
1936
|
+
padding: 0,
|
|
1937
|
+
margin: "0 0 24px 0",
|
|
1938
|
+
flex: 1
|
|
1939
|
+
},
|
|
1940
|
+
featureItem: {
|
|
1941
|
+
display: "flex",
|
|
1942
|
+
alignItems: "center",
|
|
1943
|
+
gap: "8px",
|
|
1944
|
+
padding: "6px 0",
|
|
1945
|
+
fontSize: "14px",
|
|
1946
|
+
color: "#374151"
|
|
1947
|
+
},
|
|
1948
|
+
checkmark: {
|
|
1949
|
+
color: "#10b981",
|
|
1950
|
+
fontSize: "16px",
|
|
1951
|
+
fontWeight: 700,
|
|
1952
|
+
flexShrink: 0
|
|
1953
|
+
}
|
|
1954
|
+
};
|
|
1955
|
+
function PricingFeatureList({ features }) {
|
|
1956
|
+
if (!features || features.length === 0) return null;
|
|
1957
|
+
return /* @__PURE__ */ jsx("ul", { style: styles3.featuresList, children: features.map((feature, i) => /* @__PURE__ */ jsxs("li", { style: styles3.featureItem, children: [
|
|
1958
|
+
/* @__PURE__ */ jsx("span", { style: styles3.checkmark, "aria-hidden": "true", children: "\u2713" }),
|
|
1959
|
+
feature
|
|
1960
|
+
] }, i)) });
|
|
1961
|
+
}
|
|
1962
|
+
PricingFeatureList.displayName = "PricingFeatureList";
|
|
1882
1963
|
var intervalLabels = {
|
|
1883
1964
|
MONTHLY: "/mo",
|
|
1884
1965
|
YEARLY: "/yr",
|
|
1885
1966
|
ONE_TIME: ""
|
|
1886
1967
|
};
|
|
1887
|
-
|
|
1888
|
-
try {
|
|
1889
|
-
return new Intl.NumberFormat(void 0, {
|
|
1890
|
-
style: "currency",
|
|
1891
|
-
currency,
|
|
1892
|
-
minimumFractionDigits: 0,
|
|
1893
|
-
maximumFractionDigits: 2
|
|
1894
|
-
}).format(amount / 100);
|
|
1895
|
-
} catch {
|
|
1896
|
-
return `${currency} ${(amount / 100).toFixed(2)}`;
|
|
1897
|
-
}
|
|
1898
|
-
}
|
|
1899
|
-
var styles3 = {
|
|
1900
|
-
grid: (columns) => ({
|
|
1901
|
-
display: "grid",
|
|
1902
|
-
gridTemplateColumns: `repeat(${columns}, 1fr)`,
|
|
1903
|
-
gap: "24px",
|
|
1904
|
-
fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif'
|
|
1905
|
-
}),
|
|
1968
|
+
var styles4 = {
|
|
1906
1969
|
card: (isCurrentPlan) => ({
|
|
1907
1970
|
border: isCurrentPlan ? "2px solid #6366f1" : "1px solid #e5e7eb",
|
|
1908
1971
|
borderRadius: "12px",
|
|
@@ -1953,26 +2016,6 @@ var styles3 = {
|
|
|
1953
2016
|
fontSize: "16px",
|
|
1954
2017
|
color: "#6b7280"
|
|
1955
2018
|
},
|
|
1956
|
-
featuresList: {
|
|
1957
|
-
listStyle: "none",
|
|
1958
|
-
padding: 0,
|
|
1959
|
-
margin: "0 0 24px 0",
|
|
1960
|
-
flex: 1
|
|
1961
|
-
},
|
|
1962
|
-
featureItem: {
|
|
1963
|
-
display: "flex",
|
|
1964
|
-
alignItems: "center",
|
|
1965
|
-
gap: "8px",
|
|
1966
|
-
padding: "6px 0",
|
|
1967
|
-
fontSize: "14px",
|
|
1968
|
-
color: "#374151"
|
|
1969
|
-
},
|
|
1970
|
-
checkmark: {
|
|
1971
|
-
color: "#10b981",
|
|
1972
|
-
fontSize: "16px",
|
|
1973
|
-
fontWeight: 700,
|
|
1974
|
-
flexShrink: 0
|
|
1975
|
-
},
|
|
1976
2019
|
selectButton: (isCurrentPlan) => ({
|
|
1977
2020
|
width: "100%",
|
|
1978
2021
|
padding: "12px 24px",
|
|
@@ -1984,11 +2027,46 @@ var styles3 = {
|
|
|
1984
2027
|
fontWeight: 600,
|
|
1985
2028
|
cursor: isCurrentPlan ? "default" : "pointer",
|
|
1986
2029
|
transition: "background-color 0.15s"
|
|
2030
|
+
})
|
|
2031
|
+
};
|
|
2032
|
+
function PricingCard({
|
|
2033
|
+
plan,
|
|
2034
|
+
isCurrentPlan,
|
|
2035
|
+
isCheckoutPending,
|
|
2036
|
+
onSelect
|
|
2037
|
+
}) {
|
|
2038
|
+
return /* @__PURE__ */ jsxs("div", { style: styles4.card(isCurrentPlan), children: [
|
|
2039
|
+
isCurrentPlan && /* @__PURE__ */ jsx("span", { style: styles4.currentBadge, children: "Current Plan" }),
|
|
2040
|
+
/* @__PURE__ */ jsx("h3", { style: styles4.planName, children: plan.name }),
|
|
2041
|
+
plan.description && /* @__PURE__ */ jsx("p", { style: styles4.planDescription, children: plan.description }),
|
|
2042
|
+
/* @__PURE__ */ jsxs("div", { style: styles4.priceRow, children: [
|
|
2043
|
+
/* @__PURE__ */ jsx("span", { style: styles4.priceAmount, children: formatAmount(plan.amount, plan.currency) }),
|
|
2044
|
+
/* @__PURE__ */ jsx("span", { style: styles4.priceInterval, children: intervalLabels[plan.interval] })
|
|
2045
|
+
] }),
|
|
2046
|
+
plan.features && plan.features.length > 0 && /* @__PURE__ */ jsx(PricingFeatureList, { features: plan.features }),
|
|
2047
|
+
/* @__PURE__ */ jsx(
|
|
2048
|
+
"button",
|
|
2049
|
+
{
|
|
2050
|
+
type: "button",
|
|
2051
|
+
onClick: () => onSelect(plan),
|
|
2052
|
+
disabled: isCurrentPlan || isCheckoutPending,
|
|
2053
|
+
style: {
|
|
2054
|
+
...styles4.selectButton(isCurrentPlan),
|
|
2055
|
+
...isCheckoutPending && !isCurrentPlan ? { opacity: 0.6 } : {}
|
|
2056
|
+
},
|
|
2057
|
+
children: isCurrentPlan ? "Current Plan" : "Subscribe"
|
|
2058
|
+
}
|
|
2059
|
+
)
|
|
2060
|
+
] });
|
|
2061
|
+
}
|
|
2062
|
+
PricingCard.displayName = "PricingCard";
|
|
2063
|
+
var styles5 = {
|
|
2064
|
+
grid: (columns) => ({
|
|
2065
|
+
display: "grid",
|
|
2066
|
+
gridTemplateColumns: `repeat(${columns}, 1fr)`,
|
|
2067
|
+
gap: "24px",
|
|
2068
|
+
fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif'
|
|
1987
2069
|
}),
|
|
1988
|
-
skeleton: {
|
|
1989
|
-
backgroundColor: "#f3f4f6",
|
|
1990
|
-
borderRadius: "12px"
|
|
1991
|
-
},
|
|
1992
2070
|
skeletonCard: {
|
|
1993
2071
|
border: "1px solid #e5e7eb",
|
|
1994
2072
|
borderRadius: "12px",
|
|
@@ -2090,8 +2168,8 @@ function ProviderSelectModal({
|
|
|
2090
2168
|
onSelect,
|
|
2091
2169
|
onClose
|
|
2092
2170
|
}) {
|
|
2093
|
-
return /* @__PURE__ */ jsx("div", { style:
|
|
2094
|
-
/* @__PURE__ */ jsx("h2", { style:
|
|
2171
|
+
return /* @__PURE__ */ jsx("div", { style: styles5.overlay, onClick: onClose, children: /* @__PURE__ */ jsxs("div", { style: styles5.modal, onClick: (e) => e.stopPropagation(), children: [
|
|
2172
|
+
/* @__PURE__ */ jsx("h2", { style: styles5.modalTitle, children: "Select payment method" }),
|
|
2095
2173
|
/* @__PURE__ */ jsx("div", { style: { display: "flex", flexDirection: "column", gap: "8px" }, children: providers.map((p) => /* @__PURE__ */ jsxs(
|
|
2096
2174
|
"button",
|
|
2097
2175
|
{
|
|
@@ -2119,17 +2197,22 @@ function ProviderSelectModal({
|
|
|
2119
2197
|
},
|
|
2120
2198
|
p.provider
|
|
2121
2199
|
)) }),
|
|
2122
|
-
/* @__PURE__ */ jsx("button", { type: "button", style:
|
|
2200
|
+
/* @__PURE__ */ jsx("button", { type: "button", style: styles5.closeButton, onClick: onClose, children: "Cancel" })
|
|
2123
2201
|
] }) });
|
|
2124
2202
|
}
|
|
2203
|
+
var intervalLabels2 = {
|
|
2204
|
+
MONTHLY: "/mo",
|
|
2205
|
+
YEARLY: "/yr",
|
|
2206
|
+
ONE_TIME: ""
|
|
2207
|
+
};
|
|
2125
2208
|
function TransferModal({
|
|
2126
2209
|
data,
|
|
2127
2210
|
onClose
|
|
2128
2211
|
}) {
|
|
2129
2212
|
const bankDetails = data.bankDetails;
|
|
2130
|
-
return /* @__PURE__ */ jsx("div", { style:
|
|
2131
|
-
/* @__PURE__ */ jsx("h2", { style:
|
|
2132
|
-
/* @__PURE__ */ jsxs("p", { style:
|
|
2213
|
+
return /* @__PURE__ */ jsx("div", { style: styles5.overlay, onClick: onClose, children: /* @__PURE__ */ jsxs("div", { style: styles5.modal, onClick: (e) => e.stopPropagation(), children: [
|
|
2214
|
+
/* @__PURE__ */ jsx("h2", { style: styles5.modalTitle, children: "Manual Transfer" }),
|
|
2215
|
+
/* @__PURE__ */ jsxs("p", { style: styles5.modalSubtitle, children: [
|
|
2133
2216
|
"Transfer the amount below to subscribe to",
|
|
2134
2217
|
" ",
|
|
2135
2218
|
/* @__PURE__ */ jsx("strong", { children: data.plan?.name })
|
|
@@ -2146,7 +2229,7 @@ function TransferModal({
|
|
|
2146
2229
|
},
|
|
2147
2230
|
children: [
|
|
2148
2231
|
/* @__PURE__ */ jsx("div", { style: { fontSize: "32px", fontWeight: 700, color: "#111827" }, children: data.plan ? formatAmount(data.plan.amount, data.plan.currency) : "" }),
|
|
2149
|
-
/* @__PURE__ */ jsx("div", { style: { fontSize: "14px", color: "#6b7280" }, children: data.plan?.interval ?
|
|
2232
|
+
/* @__PURE__ */ jsx("div", { style: { fontSize: "14px", color: "#6b7280" }, children: data.plan?.interval ? intervalLabels2[data.plan.interval] ?? "" : "" })
|
|
2150
2233
|
]
|
|
2151
2234
|
}
|
|
2152
2235
|
),
|
|
@@ -2163,12 +2246,12 @@ function TransferModal({
|
|
|
2163
2246
|
children: "Bank Details"
|
|
2164
2247
|
}
|
|
2165
2248
|
),
|
|
2166
|
-
Object.entries(bankDetails).filter(([, v]) => v).map(([key, value]) => /* @__PURE__ */ jsxs("div", { style:
|
|
2167
|
-
/* @__PURE__ */ jsx("span", { style:
|
|
2168
|
-
/* @__PURE__ */ jsx("span", { style:
|
|
2249
|
+
Object.entries(bankDetails).filter(([, v]) => v).map(([key, value]) => /* @__PURE__ */ jsxs("div", { style: styles5.bankDetailRow, children: [
|
|
2250
|
+
/* @__PURE__ */ jsx("span", { style: styles5.bankDetailLabel, children: key.replace(/([A-Z])/g, " $1").replace(/^./, (s) => s.toUpperCase()) }),
|
|
2251
|
+
/* @__PURE__ */ jsx("span", { style: styles5.bankDetailValue, children: value })
|
|
2169
2252
|
] }, key))
|
|
2170
2253
|
] }),
|
|
2171
|
-
data.transferInstructions && /* @__PURE__ */ jsx("div", { style:
|
|
2254
|
+
data.transferInstructions && /* @__PURE__ */ jsx("div", { style: styles5.instructions, children: data.transferInstructions }),
|
|
2172
2255
|
/* @__PURE__ */ jsx(
|
|
2173
2256
|
"p",
|
|
2174
2257
|
{
|
|
@@ -2180,7 +2263,7 @@ function TransferModal({
|
|
|
2180
2263
|
children: "After completing the transfer, submit your proof of payment. Your subscription will be activated once the transfer is verified."
|
|
2181
2264
|
}
|
|
2182
2265
|
),
|
|
2183
|
-
/* @__PURE__ */ jsx("button", { type: "button", style:
|
|
2266
|
+
/* @__PURE__ */ jsx("button", { type: "button", style: styles5.closeButton, onClick: onClose, children: "Close" })
|
|
2184
2267
|
] }) });
|
|
2185
2268
|
}
|
|
2186
2269
|
function PricingTable({
|
|
@@ -2231,12 +2314,12 @@ function PricingTable({
|
|
|
2231
2314
|
checkout({ planId: plan.id, provider, successUrl, cancelUrl });
|
|
2232
2315
|
};
|
|
2233
2316
|
if (plansLoading) {
|
|
2234
|
-
return /* @__PURE__ */ jsx("div", { className, style: { ...
|
|
2317
|
+
return /* @__PURE__ */ jsx("div", { className, style: { ...styles5.grid(columns), ...style }, children: Array.from({ length: columns }).map((_, i) => /* @__PURE__ */ jsxs("div", { style: styles5.skeletonCard, children: [
|
|
2235
2318
|
/* @__PURE__ */ jsx(
|
|
2236
2319
|
"div",
|
|
2237
2320
|
{
|
|
2238
2321
|
style: {
|
|
2239
|
-
...
|
|
2322
|
+
...styles5.skeletonLine,
|
|
2240
2323
|
width: "60%",
|
|
2241
2324
|
height: "20px"
|
|
2242
2325
|
}
|
|
@@ -2246,7 +2329,7 @@ function PricingTable({
|
|
|
2246
2329
|
"div",
|
|
2247
2330
|
{
|
|
2248
2331
|
style: {
|
|
2249
|
-
...
|
|
2332
|
+
...styles5.skeletonLine,
|
|
2250
2333
|
width: "80%",
|
|
2251
2334
|
height: "14px"
|
|
2252
2335
|
}
|
|
@@ -2256,7 +2339,7 @@ function PricingTable({
|
|
|
2256
2339
|
"div",
|
|
2257
2340
|
{
|
|
2258
2341
|
style: {
|
|
2259
|
-
...
|
|
2342
|
+
...styles5.skeletonLine,
|
|
2260
2343
|
width: "40%",
|
|
2261
2344
|
height: "36px",
|
|
2262
2345
|
marginTop: "8px"
|
|
@@ -2267,7 +2350,7 @@ function PricingTable({
|
|
|
2267
2350
|
"div",
|
|
2268
2351
|
{
|
|
2269
2352
|
style: {
|
|
2270
|
-
...
|
|
2353
|
+
...styles5.skeletonLine,
|
|
2271
2354
|
width: "90%",
|
|
2272
2355
|
height: "14px"
|
|
2273
2356
|
}
|
|
@@ -2278,7 +2361,7 @@ function PricingTable({
|
|
|
2278
2361
|
"div",
|
|
2279
2362
|
{
|
|
2280
2363
|
style: {
|
|
2281
|
-
...
|
|
2364
|
+
...styles5.skeletonLine,
|
|
2282
2365
|
width: "100%",
|
|
2283
2366
|
height: "44px",
|
|
2284
2367
|
marginTop: "16px"
|
|
@@ -2293,35 +2376,19 @@ function PricingTable({
|
|
|
2293
2376
|
"div",
|
|
2294
2377
|
{
|
|
2295
2378
|
className,
|
|
2296
|
-
style: { ...
|
|
2379
|
+
style: { ...styles5.grid(columns), ...style },
|
|
2297
2380
|
children: sortedPlans.map((plan) => {
|
|
2298
2381
|
const isCurrentPlan = subscription?.planId === plan.id && subscription.status === "ACTIVE";
|
|
2299
|
-
return /* @__PURE__ */
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
plan.
|
|
2308
|
-
|
|
2309
|
-
feature
|
|
2310
|
-
] }, i)) }),
|
|
2311
|
-
/* @__PURE__ */ jsx(
|
|
2312
|
-
"button",
|
|
2313
|
-
{
|
|
2314
|
-
type: "button",
|
|
2315
|
-
onClick: () => handleSelect(plan),
|
|
2316
|
-
disabled: isCurrentPlan || checkoutPending,
|
|
2317
|
-
style: {
|
|
2318
|
-
...styles3.selectButton(isCurrentPlan),
|
|
2319
|
-
...checkoutPending && !isCurrentPlan ? { opacity: 0.6 } : {}
|
|
2320
|
-
},
|
|
2321
|
-
children: isCurrentPlan ? "Current Plan" : "Subscribe"
|
|
2322
|
-
}
|
|
2323
|
-
)
|
|
2324
|
-
] }, plan.id);
|
|
2382
|
+
return /* @__PURE__ */ jsx(
|
|
2383
|
+
PricingCard,
|
|
2384
|
+
{
|
|
2385
|
+
plan,
|
|
2386
|
+
isCurrentPlan,
|
|
2387
|
+
isCheckoutPending: checkoutPending,
|
|
2388
|
+
onSelect: handleSelect
|
|
2389
|
+
},
|
|
2390
|
+
plan.id
|
|
2391
|
+
);
|
|
2325
2392
|
})
|
|
2326
2393
|
}
|
|
2327
2394
|
),
|
|
@@ -2407,126 +2474,62 @@ var PROVIDER_ICONS2 = {
|
|
|
2407
2474
|
NUVEI: "\u{1F4B3}",
|
|
2408
2475
|
MANUAL_TRANSFER: "\u{1F3E6}"
|
|
2409
2476
|
};
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
}
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
}
|
|
2465
|
-
|
|
2466
|
-
onProviderSelect?.(provider);
|
|
2467
|
-
checkout({
|
|
2468
|
-
planId,
|
|
2469
|
-
intentId,
|
|
2470
|
-
provider,
|
|
2471
|
-
successUrl,
|
|
2472
|
-
cancelUrl
|
|
2473
|
-
});
|
|
2474
|
-
};
|
|
2475
|
-
const isDisabled = disabled || isPending || providersLoading || !planId && !intentId;
|
|
2476
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2477
|
-
/* @__PURE__ */ jsx(
|
|
2478
|
-
"button",
|
|
2479
|
-
{
|
|
2480
|
-
type: "button",
|
|
2481
|
-
className,
|
|
2482
|
-
style: {
|
|
2483
|
-
padding: "10px 24px",
|
|
2484
|
-
fontSize: "14px",
|
|
2485
|
-
fontWeight: 600,
|
|
2486
|
-
color: "#fff",
|
|
2487
|
-
backgroundColor: isDisabled ? "#9ca3af" : "#111827",
|
|
2488
|
-
border: "none",
|
|
2489
|
-
borderRadius: "8px",
|
|
2490
|
-
cursor: isDisabled ? "not-allowed" : "pointer",
|
|
2491
|
-
fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',
|
|
2492
|
-
...style
|
|
2493
|
-
},
|
|
2494
|
-
onClick: handleClick,
|
|
2495
|
-
disabled: isDisabled,
|
|
2496
|
-
children: isPending ? billing?.processing ?? "Processing..." : children ?? (billing?.pay ?? "Pay")
|
|
2497
|
-
}
|
|
2498
|
-
),
|
|
2499
|
-
showProviderModal && providers && providers.length > 1 && /* @__PURE__ */ jsx(
|
|
2500
|
-
ProviderModal,
|
|
2501
|
-
{
|
|
2502
|
-
providers,
|
|
2503
|
-
isPending,
|
|
2504
|
-
onSelect: doCheckout,
|
|
2505
|
-
onClose: () => setShowProviderModal(false),
|
|
2506
|
-
labels: billing
|
|
2507
|
-
}
|
|
2508
|
-
),
|
|
2509
|
-
showTransferModal && transferData && /* @__PURE__ */ jsx(
|
|
2510
|
-
TransferModal2,
|
|
2511
|
-
{
|
|
2512
|
-
data: transferData,
|
|
2513
|
-
onClose: () => {
|
|
2514
|
-
setShowTransferModal(false);
|
|
2515
|
-
setTransferData(null);
|
|
2516
|
-
},
|
|
2517
|
-
labels: billing
|
|
2518
|
-
}
|
|
2519
|
-
),
|
|
2520
|
-
payphoneData?.widgetConfig && /* @__PURE__ */ jsx(
|
|
2521
|
-
PayphoneModal,
|
|
2522
|
-
{
|
|
2523
|
-
config: payphoneData.widgetConfig,
|
|
2524
|
-
successUrl,
|
|
2525
|
-
onClose: () => setPayphoneData(null)
|
|
2526
|
-
}
|
|
2527
|
-
)
|
|
2528
|
-
] });
|
|
2529
|
-
}
|
|
2477
|
+
var modalStyles = {
|
|
2478
|
+
overlay: {
|
|
2479
|
+
position: "fixed",
|
|
2480
|
+
inset: 0,
|
|
2481
|
+
backgroundColor: "rgba(0,0,0,0.5)",
|
|
2482
|
+
display: "flex",
|
|
2483
|
+
alignItems: "center",
|
|
2484
|
+
justifyContent: "center",
|
|
2485
|
+
zIndex: 9999,
|
|
2486
|
+
fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif'
|
|
2487
|
+
},
|
|
2488
|
+
card: {
|
|
2489
|
+
backgroundColor: "#fff",
|
|
2490
|
+
borderRadius: "12px",
|
|
2491
|
+
padding: "24px",
|
|
2492
|
+
maxWidth: "420px",
|
|
2493
|
+
width: "90%",
|
|
2494
|
+
boxShadow: "0 25px 50px -12px rgba(0,0,0,0.25)"
|
|
2495
|
+
},
|
|
2496
|
+
title: {
|
|
2497
|
+
fontSize: "18px",
|
|
2498
|
+
fontWeight: 700,
|
|
2499
|
+
color: "#111827",
|
|
2500
|
+
margin: "0 0 20px 0",
|
|
2501
|
+
textAlign: "center"
|
|
2502
|
+
},
|
|
2503
|
+
providerButton: {
|
|
2504
|
+
display: "flex",
|
|
2505
|
+
alignItems: "center",
|
|
2506
|
+
width: "100%",
|
|
2507
|
+
padding: "12px 16px",
|
|
2508
|
+
border: "1px solid #e5e7eb",
|
|
2509
|
+
borderRadius: "8px",
|
|
2510
|
+
backgroundColor: "#fff",
|
|
2511
|
+
cursor: "pointer",
|
|
2512
|
+
fontSize: "14px",
|
|
2513
|
+
fontWeight: 500,
|
|
2514
|
+
color: "#111827",
|
|
2515
|
+
transition: "background-color 0.15s",
|
|
2516
|
+
fontFamily: "inherit"
|
|
2517
|
+
},
|
|
2518
|
+
cancelButton: {
|
|
2519
|
+
display: "block",
|
|
2520
|
+
width: "100%",
|
|
2521
|
+
marginTop: "16px",
|
|
2522
|
+
padding: "10px",
|
|
2523
|
+
border: "none",
|
|
2524
|
+
borderRadius: "8px",
|
|
2525
|
+
backgroundColor: "#f3f4f6",
|
|
2526
|
+
color: "#6b7280",
|
|
2527
|
+
fontSize: "14px",
|
|
2528
|
+
fontWeight: 500,
|
|
2529
|
+
cursor: "pointer",
|
|
2530
|
+
fontFamily: "inherit"
|
|
2531
|
+
}
|
|
2532
|
+
};
|
|
2530
2533
|
function ProviderModal({
|
|
2531
2534
|
providers,
|
|
2532
2535
|
isPending,
|
|
@@ -2564,7 +2567,7 @@ function TransferModal2({
|
|
|
2564
2567
|
const bankDetails = data.bankDetails;
|
|
2565
2568
|
const plan = data.plan;
|
|
2566
2569
|
const intent = data.intent;
|
|
2567
|
-
const displayAmount = plan ?
|
|
2570
|
+
const displayAmount = plan ? formatAmount(plan.amount, plan.currency) : intent ? formatAmount(intent.amount, intent.currency) : "";
|
|
2568
2571
|
return /* @__PURE__ */ jsx("div", { style: modalStyles.overlay, onClick: onClose, children: /* @__PURE__ */ jsxs("div", { style: modalStyles.card, onClick: (e) => e.stopPropagation(), children: [
|
|
2569
2572
|
/* @__PURE__ */ jsx("h2", { style: modalStyles.title, children: labels?.bankTransfer ?? "Bank Transfer" }),
|
|
2570
2573
|
displayAmount && /* @__PURE__ */ jsxs(
|
|
@@ -2644,62 +2647,114 @@ function TransferModal2({
|
|
|
2644
2647
|
/* @__PURE__ */ jsx("button", { type: "button", style: modalStyles.cancelButton, onClick: onClose, children: "Close" })
|
|
2645
2648
|
] }) });
|
|
2646
2649
|
}
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
2650
|
+
function PayButton({
|
|
2651
|
+
planId,
|
|
2652
|
+
intentId,
|
|
2653
|
+
successUrl,
|
|
2654
|
+
cancelUrl,
|
|
2655
|
+
className,
|
|
2656
|
+
style,
|
|
2657
|
+
children,
|
|
2658
|
+
disabled,
|
|
2659
|
+
onSuccess,
|
|
2660
|
+
onError,
|
|
2661
|
+
onProviderSelect
|
|
2662
|
+
}) {
|
|
2663
|
+
const messages = useMessages();
|
|
2664
|
+
const billing = messages?.billing;
|
|
2665
|
+
const [showProviderModal, setShowProviderModal] = useState(false);
|
|
2666
|
+
const [showTransferModal, setShowTransferModal] = useState(false);
|
|
2667
|
+
const [transferData, setTransferData] = useState(null);
|
|
2668
|
+
const [payphoneData, setPayphoneData] = useState(null);
|
|
2669
|
+
const { data: providers, isLoading: providersLoading } = usePaymentProviders();
|
|
2670
|
+
const { checkout, isPending } = useCheckout({
|
|
2671
|
+
redirectOnSuccess: true,
|
|
2672
|
+
onSuccess: (data) => {
|
|
2673
|
+
if (data.provider === "MANUAL_TRANSFER") {
|
|
2674
|
+
setTransferData(data);
|
|
2675
|
+
setShowTransferModal(true);
|
|
2676
|
+
setShowProviderModal(false);
|
|
2677
|
+
} else if (data.provider === "PAYPHONE" && data.widgetConfig) {
|
|
2678
|
+
setPayphoneData(data);
|
|
2679
|
+
setShowProviderModal(false);
|
|
2680
|
+
}
|
|
2681
|
+
onSuccess?.(data);
|
|
2682
|
+
},
|
|
2683
|
+
onError
|
|
2684
|
+
});
|
|
2685
|
+
const handleClick = () => {
|
|
2686
|
+
if (!providers || providers.length === 0) return;
|
|
2687
|
+
if (providers.length === 1) {
|
|
2688
|
+
doCheckout(providers[0].provider);
|
|
2689
|
+
} else {
|
|
2690
|
+
setShowProviderModal(true);
|
|
2691
|
+
}
|
|
2692
|
+
};
|
|
2693
|
+
const doCheckout = (provider) => {
|
|
2694
|
+
onProviderSelect?.(provider);
|
|
2695
|
+
checkout({
|
|
2696
|
+
planId,
|
|
2697
|
+
intentId,
|
|
2698
|
+
provider,
|
|
2699
|
+
successUrl,
|
|
2700
|
+
cancelUrl
|
|
2701
|
+
});
|
|
2702
|
+
};
|
|
2703
|
+
const isDisabled = disabled || isPending || providersLoading || !planId && !intentId;
|
|
2704
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2705
|
+
/* @__PURE__ */ jsx(
|
|
2706
|
+
"button",
|
|
2707
|
+
{
|
|
2708
|
+
type: "button",
|
|
2709
|
+
className,
|
|
2710
|
+
style: {
|
|
2711
|
+
padding: "10px 24px",
|
|
2712
|
+
fontSize: "14px",
|
|
2713
|
+
fontWeight: 600,
|
|
2714
|
+
color: "#fff",
|
|
2715
|
+
backgroundColor: isDisabled ? "#9ca3af" : "#111827",
|
|
2716
|
+
border: "none",
|
|
2717
|
+
borderRadius: "8px",
|
|
2718
|
+
cursor: isDisabled ? "not-allowed" : "pointer",
|
|
2719
|
+
fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',
|
|
2720
|
+
...style
|
|
2721
|
+
},
|
|
2722
|
+
onClick: handleClick,
|
|
2723
|
+
disabled: isDisabled,
|
|
2724
|
+
children: isPending ? billing?.processing ?? "Processing..." : children ?? (billing?.pay ?? "Pay")
|
|
2725
|
+
}
|
|
2726
|
+
),
|
|
2727
|
+
showProviderModal && providers && providers.length > 1 && /* @__PURE__ */ jsx(
|
|
2728
|
+
ProviderModal,
|
|
2729
|
+
{
|
|
2730
|
+
providers,
|
|
2731
|
+
isPending,
|
|
2732
|
+
onSelect: doCheckout,
|
|
2733
|
+
onClose: () => setShowProviderModal(false),
|
|
2734
|
+
labels: billing
|
|
2735
|
+
}
|
|
2736
|
+
),
|
|
2737
|
+
showTransferModal && transferData && /* @__PURE__ */ jsx(
|
|
2738
|
+
TransferModal2,
|
|
2739
|
+
{
|
|
2740
|
+
data: transferData,
|
|
2741
|
+
onClose: () => {
|
|
2742
|
+
setShowTransferModal(false);
|
|
2743
|
+
setTransferData(null);
|
|
2744
|
+
},
|
|
2745
|
+
labels: billing
|
|
2746
|
+
}
|
|
2747
|
+
),
|
|
2748
|
+
payphoneData?.widgetConfig && /* @__PURE__ */ jsx(
|
|
2749
|
+
PayphoneModal,
|
|
2750
|
+
{
|
|
2751
|
+
config: payphoneData.widgetConfig,
|
|
2752
|
+
successUrl,
|
|
2753
|
+
onClose: () => setPayphoneData(null)
|
|
2754
|
+
}
|
|
2755
|
+
)
|
|
2756
|
+
] });
|
|
2757
|
+
}
|
|
2703
2758
|
function usePayphoneConfirm(options) {
|
|
2704
2759
|
const client = useAccessClient();
|
|
2705
2760
|
return useMutation({
|
|
@@ -2765,7 +2820,7 @@ var statusConfig = {
|
|
|
2765
2820
|
UNPAID: { bg: "#fee2e2", color: "#991b1b", label: "Unpaid" },
|
|
2766
2821
|
INCOMPLETE: { bg: "#f3f4f6", color: "#6b7280", label: "Incomplete" }
|
|
2767
2822
|
};
|
|
2768
|
-
var
|
|
2823
|
+
var styles6 = {
|
|
2769
2824
|
badge: {
|
|
2770
2825
|
display: "inline-flex",
|
|
2771
2826
|
alignItems: "center",
|
|
@@ -2794,7 +2849,7 @@ var styles4 = {
|
|
|
2794
2849
|
function SubscriptionBadge({ className, style }) {
|
|
2795
2850
|
const { data: subscription, isLoading } = useSubscription();
|
|
2796
2851
|
if (isLoading) {
|
|
2797
|
-
return /* @__PURE__ */ jsx("span", { className, style: { ...
|
|
2852
|
+
return /* @__PURE__ */ jsx("span", { className, style: { ...styles6.skeleton, ...style } });
|
|
2798
2853
|
}
|
|
2799
2854
|
if (!subscription) {
|
|
2800
2855
|
return /* @__PURE__ */ jsx(
|
|
@@ -2802,7 +2857,7 @@ function SubscriptionBadge({ className, style }) {
|
|
|
2802
2857
|
{
|
|
2803
2858
|
className,
|
|
2804
2859
|
style: {
|
|
2805
|
-
...
|
|
2860
|
+
...styles6.badge,
|
|
2806
2861
|
backgroundColor: "#f3f4f6",
|
|
2807
2862
|
color: "#6b7280",
|
|
2808
2863
|
...style
|
|
@@ -2817,13 +2872,13 @@ function SubscriptionBadge({ className, style }) {
|
|
|
2817
2872
|
{
|
|
2818
2873
|
className,
|
|
2819
2874
|
style: {
|
|
2820
|
-
...
|
|
2875
|
+
...styles6.badge,
|
|
2821
2876
|
backgroundColor: config.bg,
|
|
2822
2877
|
color: config.color,
|
|
2823
2878
|
...style
|
|
2824
2879
|
},
|
|
2825
2880
|
children: [
|
|
2826
|
-
/* @__PURE__ */ jsx("span", { style:
|
|
2881
|
+
/* @__PURE__ */ jsx("span", { style: styles6.dot(config.color), "aria-hidden": "true" }),
|
|
2827
2882
|
subscription.plan.name,
|
|
2828
2883
|
" \xB7 ",
|
|
2829
2884
|
config.label
|
|
@@ -2857,19 +2912,7 @@ function formatDate2(dateStr) {
|
|
|
2857
2912
|
return dateStr;
|
|
2858
2913
|
}
|
|
2859
2914
|
}
|
|
2860
|
-
|
|
2861
|
-
try {
|
|
2862
|
-
return new Intl.NumberFormat(void 0, {
|
|
2863
|
-
style: "currency",
|
|
2864
|
-
currency,
|
|
2865
|
-
minimumFractionDigits: 0,
|
|
2866
|
-
maximumFractionDigits: 2
|
|
2867
|
-
}).format(amount / 100);
|
|
2868
|
-
} catch {
|
|
2869
|
-
return `${currency} ${(amount / 100).toFixed(2)}`;
|
|
2870
|
-
}
|
|
2871
|
-
}
|
|
2872
|
-
var styles5 = {
|
|
2915
|
+
var styles7 = {
|
|
2873
2916
|
container: {
|
|
2874
2917
|
border: "1px solid #e5e7eb",
|
|
2875
2918
|
borderRadius: "12px",
|
|
@@ -2938,41 +2981,41 @@ var styles5 = {
|
|
|
2938
2981
|
function InvoiceList({ className, style }) {
|
|
2939
2982
|
const { data: invoices, isLoading } = useInvoices();
|
|
2940
2983
|
if (isLoading) {
|
|
2941
|
-
return /* @__PURE__ */ jsxs("div", { className, style: { ...
|
|
2942
|
-
/* @__PURE__ */ jsx("div", { style:
|
|
2984
|
+
return /* @__PURE__ */ jsxs("div", { className, style: { ...styles7.container, ...style }, children: [
|
|
2985
|
+
/* @__PURE__ */ jsx("div", { style: styles7.header, children: /* @__PURE__ */ jsx("div", { style: { ...styles7.skeleton, width: "100px", height: "18px" } }) }),
|
|
2943
2986
|
/* @__PURE__ */ jsx("div", { style: { padding: "24px" }, children: [1, 2, 3].map((i) => /* @__PURE__ */ jsx(
|
|
2944
2987
|
"div",
|
|
2945
2988
|
{
|
|
2946
|
-
style: { ...
|
|
2989
|
+
style: { ...styles7.skeleton, width: "100%", height: "16px", marginBottom: "16px" }
|
|
2947
2990
|
},
|
|
2948
2991
|
i
|
|
2949
2992
|
)) })
|
|
2950
2993
|
] });
|
|
2951
2994
|
}
|
|
2952
|
-
return /* @__PURE__ */ jsxs("div", { className, style: { ...
|
|
2953
|
-
/* @__PURE__ */ jsx("div", { style:
|
|
2954
|
-
/* @__PURE__ */ jsxs("table", { style:
|
|
2995
|
+
return /* @__PURE__ */ jsxs("div", { className, style: { ...styles7.container, ...style }, children: [
|
|
2996
|
+
/* @__PURE__ */ jsx("div", { style: styles7.header, children: /* @__PURE__ */ jsx("h3", { style: styles7.title, children: "Invoices" }) }),
|
|
2997
|
+
/* @__PURE__ */ jsxs("table", { style: styles7.table, children: [
|
|
2955
2998
|
/* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { children: [
|
|
2956
|
-
/* @__PURE__ */ jsx("th", { style:
|
|
2957
|
-
/* @__PURE__ */ jsx("th", { style:
|
|
2958
|
-
/* @__PURE__ */ jsx("th", { style:
|
|
2959
|
-
/* @__PURE__ */ jsx("th", { style:
|
|
2999
|
+
/* @__PURE__ */ jsx("th", { style: styles7.th, children: "Date" }),
|
|
3000
|
+
/* @__PURE__ */ jsx("th", { style: styles7.th, children: "Amount" }),
|
|
3001
|
+
/* @__PURE__ */ jsx("th", { style: styles7.th, children: "Status" }),
|
|
3002
|
+
/* @__PURE__ */ jsx("th", { style: styles7.th, children: "Invoice" })
|
|
2960
3003
|
] }) }),
|
|
2961
3004
|
/* @__PURE__ */ jsxs("tbody", { children: [
|
|
2962
|
-
(!invoices || invoices.length === 0) && /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("td", { colSpan: 4, style:
|
|
3005
|
+
(!invoices || invoices.length === 0) && /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("td", { colSpan: 4, style: styles7.emptyRow, children: "No invoices yet." }) }),
|
|
2963
3006
|
invoices?.map((invoice) => {
|
|
2964
3007
|
const sc = statusColors2[invoice.status];
|
|
2965
3008
|
return /* @__PURE__ */ jsxs("tr", { children: [
|
|
2966
|
-
/* @__PURE__ */ jsx("td", { style:
|
|
2967
|
-
/* @__PURE__ */ jsx("td", { style:
|
|
2968
|
-
/* @__PURE__ */ jsx("td", { style:
|
|
2969
|
-
/* @__PURE__ */ jsx("td", { style:
|
|
3009
|
+
/* @__PURE__ */ jsx("td", { style: styles7.td, children: formatDate2(invoice.createdAt) }),
|
|
3010
|
+
/* @__PURE__ */ jsx("td", { style: styles7.td, children: formatAmount(invoice.amount, invoice.currency) }),
|
|
3011
|
+
/* @__PURE__ */ jsx("td", { style: styles7.td, children: /* @__PURE__ */ jsx("span", { style: styles7.badge(sc.bg, sc.color), children: invoice.status }) }),
|
|
3012
|
+
/* @__PURE__ */ jsx("td", { style: styles7.td, children: invoice.invoiceUrl ? /* @__PURE__ */ jsx(
|
|
2970
3013
|
"a",
|
|
2971
3014
|
{
|
|
2972
3015
|
href: invoice.invoiceUrl,
|
|
2973
3016
|
target: "_blank",
|
|
2974
3017
|
rel: "noopener noreferrer",
|
|
2975
|
-
style:
|
|
3018
|
+
style: styles7.link,
|
|
2976
3019
|
children: "View"
|
|
2977
3020
|
}
|
|
2978
3021
|
) : /* @__PURE__ */ jsx("span", { style: { color: "#d1d5db" }, children: "\u2014" }) })
|
|
@@ -3255,6 +3298,17 @@ function useSwitchTenant() {
|
|
|
3255
3298
|
};
|
|
3256
3299
|
return { switchTenant };
|
|
3257
3300
|
}
|
|
3301
|
+
function createMutationHook(config) {
|
|
3302
|
+
return function useGeneratedMutation(options) {
|
|
3303
|
+
const client = useAccessClient();
|
|
3304
|
+
return useMutation({
|
|
3305
|
+
mutationKey: config.mutationKey,
|
|
3306
|
+
mutationFn: (input) => config.mutationFn(client, input),
|
|
3307
|
+
onSuccess: options?.onSuccess,
|
|
3308
|
+
onError: options?.onError
|
|
3309
|
+
});
|
|
3310
|
+
};
|
|
3311
|
+
}
|
|
3258
3312
|
function zodToFieldErrors(zodError) {
|
|
3259
3313
|
return zodError.issues.map((issue) => ({
|
|
3260
3314
|
field: issue.path.join("."),
|
|
@@ -3311,8 +3365,8 @@ function usePasswordToggle() {
|
|
|
3311
3365
|
}
|
|
3312
3366
|
|
|
3313
3367
|
// src/index.ts
|
|
3314
|
-
var SDK_VERSION = "0.
|
|
3368
|
+
var SDK_VERSION = "0.8.0";
|
|
3315
3369
|
|
|
3316
|
-
export { AziridProvider, BASE_PATHS, CheckoutButton, InvoiceList, LoginForm, PATHS, PayButton, PayphoneCallback, PricingTable, ReferralCard, ReferralStats, SDK_VERSION, SignupForm, SubscriptionBadge, buildPaths, changePasswordSchema, cn, createAccessClient, createLoginSchema, createSignupSchema, en, es, isAuthError, loginSchema, magicLinkRequestSchema, magicLinkVerifySchema, passkeyRegisterStartSchema, removeStyles, resolveMessages, signupSchema, socialLoginSchema, useAccessClient, useAzirid, useBootstrap, useBranding, useChangePassword, useCheckout, useFormState, useInvoices, useLogin, useLogout, useMagicLink, useMessages, usePasskeys, usePasswordToggle, usePaymentProviders, usePayphoneConfirm, usePlans, useReferral, useReferralStats, useRefresh, useSession, useSignup, useSocialLogin, useSubmitTransferProof, useSubscription, useSwitchTenant, useTenantMembers, useTenants, useTransferProofs };
|
|
3370
|
+
export { AziridProvider, BASE_PATHS, CheckoutButton, InvoiceList, LoginForm, PATHS, PayButton, PayphoneCallback, PricingTable, ReferralCard, ReferralStats, SDK_VERSION, SignupForm, SubscriptionBadge, buildPaths, changePasswordSchema, cn, createAccessClient, createLoginSchema, createMutationHook, createSignupSchema, en, es, isAuthError, loginSchema, magicLinkRequestSchema, magicLinkVerifySchema, passkeyRegisterStartSchema, removeStyles, resolveMessages, signupSchema, socialLoginSchema, useAccessClient, useAzirid, useBootstrap, useBranding, useChangePassword, useCheckout, useFormState, useInvoices, useLogin, useLogout, useMagicLink, useMessages, usePasskeys, usePasswordToggle, usePaymentProviders, usePayphoneConfirm, usePlans, useReferral, useReferralStats, useRefresh, useSession, useSignup, useSocialLogin, useSubmitTransferProof, useSubscription, useSwitchTenant, useTenantMembers, useTenants, useTransferProofs };
|
|
3317
3371
|
//# sourceMappingURL=index.js.map
|
|
3318
3372
|
//# sourceMappingURL=index.js.map
|