@doujins/payments-ui 0.0.7 → 0.0.9

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 CHANGED
@@ -1820,6 +1820,8 @@ var useSolanaQrPayment = (options) => {
1820
1820
  const { priceId, selectedToken, onSuccess, onError } = options;
1821
1821
  const solanaService = useSolanaService();
1822
1822
  const tokenSymbol = selectedToken?.symbol ?? null;
1823
+ const onSuccessRef = React3.useRef(onSuccess);
1824
+ const onErrorRef = React3.useRef(onError);
1823
1825
  const [intent, setIntent] = React3.useState(null);
1824
1826
  const [qrDataUri, setQrDataUri] = React3.useState(null);
1825
1827
  const [isLoading, setIsLoading] = React3.useState(false);
@@ -1856,16 +1858,22 @@ var useSolanaQrPayment = (options) => {
1856
1858
  },
1857
1859
  [clearTimers]
1858
1860
  );
1861
+ React3.useEffect(() => {
1862
+ onSuccessRef.current = onSuccess;
1863
+ }, [onSuccess]);
1864
+ React3.useEffect(() => {
1865
+ onErrorRef.current = onError;
1866
+ }, [onError]);
1859
1867
  const handleError = React3.useCallback(
1860
1868
  (message, notifyParent = false) => {
1861
1869
  console.error("[payments-ui] Solana Pay QR error:", message);
1862
1870
  clearTimers();
1863
1871
  resetState(message);
1864
1872
  if (notifyParent) {
1865
- onError(message);
1873
+ onErrorRef.current?.(message);
1866
1874
  }
1867
1875
  },
1868
- [clearTimers, onError, resetState]
1876
+ [clearTimers, resetState]
1869
1877
  );
1870
1878
  const handleSuccess = React3.useCallback(
1871
1879
  (status) => {
@@ -1875,9 +1883,9 @@ var useSolanaQrPayment = (options) => {
1875
1883
  paymentId: status.payment_id,
1876
1884
  intentId: status.intent_id
1877
1885
  });
1878
- onSuccess(status.payment_id, status.transaction || "");
1886
+ onSuccessRef.current?.(status.payment_id, status.transaction || "");
1879
1887
  },
1880
- [clearTimers, onSuccess, resetState]
1888
+ [clearTimers, resetState]
1881
1889
  );
1882
1890
  const pollStatus = React3.useCallback(
1883
1891
  async (reference) => {
@@ -2500,7 +2508,7 @@ var SolanaPaymentSelector = ({
2500
2508
  " Scan QR Code"
2501
2509
  ] })
2502
2510
  ] }),
2503
- /* @__PURE__ */ jsxRuntime.jsx(TabsContent, { value: "wallet", className: "mt-4", children: /* @__PURE__ */ jsxRuntime.jsx(
2511
+ /* @__PURE__ */ jsxRuntime.jsx(TabsContent, { value: "wallet", className: "mt-4", children: activeTab === "wallet" && /* @__PURE__ */ jsxRuntime.jsx(
2504
2512
  DirectPayment,
2505
2513
  {
2506
2514
  priceId,
@@ -2513,7 +2521,7 @@ var SolanaPaymentSelector = ({
2513
2521
  onPaymentError: handlePaymentError
2514
2522
  }
2515
2523
  ) }),
2516
- /* @__PURE__ */ jsxRuntime.jsx(TabsContent, { value: "qr", className: "mt-4", children: /* @__PURE__ */ jsxRuntime.jsx(
2524
+ /* @__PURE__ */ jsxRuntime.jsx(TabsContent, { value: "qr", className: "mt-4", children: activeTab === "qr" && /* @__PURE__ */ jsxRuntime.jsx(
2517
2525
  QRCodePayment,
2518
2526
  {
2519
2527
  priceId,