coinley-checkout 0.6.1 → 0.6.3

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.
@@ -20596,10 +20596,37 @@ const PaymentStatus = ({
20596
20596
  transactionHash = null,
20597
20597
  selectedPaymentMethod = null,
20598
20598
  merchantName = "Merchant",
20599
- onClose = null
20599
+ onClose = null,
20600
20600
  // The onClose prop for the close button
20601
+ // New props for enhanced processing feedback
20602
+ processingStartTime = null,
20603
+ // Time when processing started
20604
+ paymentNetwork = null
20605
+ // Current payment network
20601
20606
  }) => {
20602
20607
  const [copiedHash, setCopiedHash] = useState(false);
20608
+ const [processingSeconds, setProcessingSeconds] = useState(0);
20609
+ const [showEarlySuccessOption, setShowEarlySuccessOption] = useState(false);
20610
+ const [progressStage, setProgressStage] = useState(1);
20611
+ useEffect(() => {
20612
+ let timer;
20613
+ if (status === "processing" && processingStartTime) {
20614
+ timer = setInterval(() => {
20615
+ const elapsed = Math.floor((Date.now() - processingStartTime) / 1e3);
20616
+ setProcessingSeconds(elapsed);
20617
+ if (elapsed >= 5 && progressStage === 1) {
20618
+ setProgressStage(2);
20619
+ }
20620
+ if (elapsed >= 15 && progressStage === 2) {
20621
+ setProgressStage(3);
20622
+ }
20623
+ if (elapsed >= 30 && !showEarlySuccessOption) {
20624
+ setShowEarlySuccessOption(true);
20625
+ }
20626
+ }, 1e3);
20627
+ }
20628
+ return () => clearInterval(timer);
20629
+ }, [status, processingStartTime, progressStage, showEarlySuccessOption]);
20603
20630
  const copyTransactionHash = () => __async(void 0, null, function* () {
20604
20631
  if (transactionHash) {
20605
20632
  try {
@@ -20617,6 +20644,11 @@ const PaymentStatus = ({
20617
20644
  onClose();
20618
20645
  }
20619
20646
  };
20647
+ const handleEarlySuccess = () => {
20648
+ if (onClose) {
20649
+ onClose();
20650
+ }
20651
+ };
20620
20652
  const formatTransactionHash = (hash2) => {
20621
20653
  if (!hash2)
20622
20654
  return "";
@@ -20633,6 +20665,16 @@ const PaymentStatus = ({
20633
20665
  };
20634
20666
  return names2[network] || network;
20635
20667
  };
20668
+ const getEstimatedConfirmationTime = (network) => {
20669
+ const times = {
20670
+ ethereum: "1-2 minutes",
20671
+ bsc: "15-30 seconds",
20672
+ tron: "30-60 seconds",
20673
+ algorand: "5-10 seconds",
20674
+ solana: "10-15 seconds"
20675
+ };
20676
+ return times[network] || "1-2 minutes";
20677
+ };
20636
20678
  const formatRecipientAddress = (address) => {
20637
20679
  if (!address)
20638
20680
  return "N/A";
@@ -20640,6 +20682,11 @@ const PaymentStatus = ({
20640
20682
  return address;
20641
20683
  return `${address.slice(0, 6)}...${address.slice(-4)}`;
20642
20684
  };
20685
+ const formatTime = (seconds) => {
20686
+ const mins = Math.floor(seconds / 60);
20687
+ const secs = seconds % 60;
20688
+ return `${mins}:${secs < 10 ? "0" : ""}${secs}`;
20689
+ };
20643
20690
  const renderIcon = () => {
20644
20691
  switch (status) {
20645
20692
  case "processing":
@@ -20701,12 +20748,14 @@ const PaymentStatus = ({
20701
20748
  if (status === "success") {
20702
20749
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col items-center justify-center py-6", children: [
20703
20750
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mb-6", children: renderIcon() }),
20704
- /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: `text-2xl font-bold mb-3 ${theme2 === "dark" ? "text-white" : "text-gray-900"}`, children: "Payment Successful" }),
20705
- payment && selectedPaymentMethod && /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: `text-center mb-6 ${theme2 === "dark" ? "text-gray-300" : "text-gray-600"}`, children: [
20751
+ /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: `text-2xl font-bold mb-3 ${theme2 === "dark" ? "text-white" : "text-gray-900"}`, children: "Payment Successful!" }),
20752
+ payment && selectedPaymentMethod && /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: `text-center max-w-[235px] mb-6 ${theme2 === "dark" ? "text-gray-300" : "text-gray-600"}`, children: [
20706
20753
  "Your payment of ",
20707
- payment.totalAmount || payment.amount,
20708
- " ",
20709
- selectedPaymentMethod.currency,
20754
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "text-[#7042D2] font-semibold", children: [
20755
+ payment.totalAmount || payment.amount,
20756
+ " ",
20757
+ selectedPaymentMethod.currency
20758
+ ] }),
20710
20759
  " has been completed."
20711
20760
  ] }),
20712
20761
  transactionHash && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "w-full mb-6", children: [
@@ -20761,12 +20810,66 @@ const PaymentStatus = ({
20761
20810
  )
20762
20811
  ] });
20763
20812
  }
20813
+ if (status === "processing") {
20814
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col items-center justify-center py-6", children: [
20815
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mb-4", children: renderIcon() }),
20816
+ /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: `text-xl font-bold mb-2 ${theme2 === "dark" ? "text-white" : "text-gray-900"}`, children: getStatusTitle() }),
20817
+ /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: `text-center ${getMessageClasses()}`, children: message }),
20818
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-full mt-6 mb-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-full bg-gray-200 rounded-full h-2.5", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
20819
+ "div",
20820
+ {
20821
+ className: "bg-blue-600 h-2.5 rounded-full transition-all duration-500",
20822
+ style: {
20823
+ width: `${Math.min(100, progressStage / 3 * 100)}%`
20824
+ }
20825
+ }
20826
+ ) }) }),
20827
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "w-full grid grid-cols-3 gap-1 mb-4", children: [
20828
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `text-xs text-center ${progressStage >= 1 ? "text-blue-600 font-medium" : "text-gray-400"}`, children: "Submitted" }),
20829
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `text-xs text-center ${progressStage >= 2 ? "text-blue-600 font-medium" : "text-gray-400"}`, children: "Detected" }),
20830
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `text-xs text-center ${progressStage >= 3 ? "text-blue-600 font-medium" : "text-gray-400"}`, children: "Confirming" })
20831
+ ] }),
20832
+ transactionHash && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "w-full my-3 px-4", children: [
20833
+ /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-xs text-center text-gray-600 mb-2", children: "Transaction ID:" }),
20834
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "bg-gray-50 border border-gray-200 rounded-md p-2 text-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs font-mono text-gray-700", children: formatTransactionHash(transactionHash) }) })
20835
+ ] }),
20836
+ paymentNetwork && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "w-full mt-4 mb-2 p-3 bg-blue-50 rounded-md text-center", children: [
20837
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: "text-xs text-blue-800", children: [
20838
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-medium", children: "Estimated confirmation time:" }),
20839
+ " ",
20840
+ getEstimatedConfirmationTime(paymentNetwork)
20841
+ ] }),
20842
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: "text-xs text-blue-600 mt-1", children: [
20843
+ "Processing time: ",
20844
+ formatTime(processingSeconds)
20845
+ ] })
20846
+ ] }),
20847
+ showEarlySuccessOption && onClose && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "w-full mt-4", children: [
20848
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mb-2 p-3 bg-yellow-50 rounded-md", children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-xs text-center text-yellow-800", children: "Taking longer than expected? Your payment may already be complete. You can proceed now or continue waiting for confirmation." }) }),
20849
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
20850
+ "button",
20851
+ {
20852
+ onClick: handleEarlySuccess,
20853
+ className: "w-full py-2 px-4 bg-gray-200 text-purple-600 font-medium rounded-md hover:bg-gray-300 transition-colors",
20854
+ children: "Continue to Order Confirmation"
20855
+ }
20856
+ )
20857
+ ] }),
20858
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `mt-4 text-xs ${theme2 === "dark" ? "text-gray-400" : "text-gray-500"}`, children: "Blockchain transactions can take a few moments to confirm. Please wait..." })
20859
+ ] });
20860
+ }
20861
+ if (status === "error") {
20862
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col items-center justify-center py-6", children: [
20863
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mb-4", children: renderIcon() }),
20864
+ /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: `text-xl font-bold mb-2 ${theme2 === "dark" ? "text-white" : "text-gray-900"}`, children: "Payment Failed" }),
20865
+ /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: `text-center ${getMessageClasses()}`, children: message }),
20866
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `mt-4 p-2 rounded ${theme2 === "dark" ? "bg-gray-700" : "bg-gray-100"}`, children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: `text-xs ${theme2 === "dark" ? "text-gray-300" : "text-gray-600"}`, children: "Please try again or contact support if the problem persists." }) })
20867
+ ] });
20868
+ }
20764
20869
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col items-center justify-center py-6", children: [
20765
20870
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mb-4", children: renderIcon() }),
20766
20871
  /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: `text-xl font-bold mb-2 ${theme2 === "dark" ? "text-white" : "text-gray-900"}`, children: getStatusTitle() }),
20767
- /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: `text-center ${getMessageClasses()}`, children: message }),
20768
- status === "processing" && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `mt-4 text-xs ${theme2 === "dark" ? "text-gray-400" : "text-gray-500"}`, children: "This may take a few moments. Please do not close this window." }),
20769
- status === "error" && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `mt-4 p-2 rounded ${theme2 === "dark" ? "bg-gray-700" : "bg-gray-100"}`, children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: `text-xs ${theme2 === "dark" ? "text-gray-300" : "text-gray-600"}`, children: "Please try again or contact support if the problem persists." }) })
20872
+ /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: `text-center ${getMessageClasses()}`, children: message })
20770
20873
  ] });
20771
20874
  };
20772
20875
  const PaymentMethods = ({ onSelect, selected, theme: theme2 = "light", supportedNetworks = [] }) => {
@@ -21142,7 +21245,12 @@ const CoinleyModal = ({
21142
21245
  supportedWallets = [],
21143
21246
  step = "select-currency",
21144
21247
  merchantWalletAddresses = {},
21145
- debug = false
21248
+ debug = false,
21249
+ // New props for enhanced processing feedback
21250
+ processingStartTime = null,
21251
+ transactionDetected = false,
21252
+ paymentNetwork = null,
21253
+ onEarlySuccess = null
21146
21254
  }) => {
21147
21255
  const [paymentType, setPaymentType] = useState("wallet");
21148
21256
  const getWalletAddressForNetwork = () => {
@@ -21163,6 +21271,12 @@ const CoinleyModal = ({
21163
21271
  onClose();
21164
21272
  }
21165
21273
  };
21274
+ const handleEarlySuccess = () => {
21275
+ console.log("Early success button clicked");
21276
+ if (onEarlySuccess) {
21277
+ onEarlySuccess();
21278
+ }
21279
+ };
21166
21280
  const formatAmount = (amount) => {
21167
21281
  return parseFloat(amount).toFixed(2);
21168
21282
  };
@@ -21198,7 +21312,7 @@ const CoinleyModal = ({
21198
21312
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "fixed inset-0 z-50 overflow-y-auto", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex min-h-screen items-center justify-center p-4", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
21199
21313
  "div",
21200
21314
  {
21201
- className: "coinley-modal relative p-6 max-w-[490px] mx-auto rounded-3xl shadow-xl bg-gray-100",
21315
+ className: "coinley-modal relative p-6 w-full max-w-[490px] mx-auto rounded-3xl shadow-xl bg-gray-100",
21202
21316
  style: {
21203
21317
  maxWidth: "490px !important",
21204
21318
  width: "100% !important",
@@ -21210,7 +21324,7 @@ const CoinleyModal = ({
21210
21324
  /* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: logo, className: "w-auto h-auto", alt: "Coinley Logo" }),
21211
21325
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-lg font-semibold text-gray-800", children: "Payment Details" })
21212
21326
  ] }),
21213
- step !== "success" && /* @__PURE__ */ jsxRuntimeExports.jsx(
21327
+ step !== "success" && step !== "processing" && /* @__PURE__ */ jsxRuntimeExports.jsx(
21214
21328
  "button",
21215
21329
  {
21216
21330
  onClick: onClose,
@@ -21389,7 +21503,11 @@ const CoinleyModal = ({
21389
21503
  {
21390
21504
  status: "processing",
21391
21505
  theme: theme2,
21392
- message: "Processing your payment..."
21506
+ message: transactionDetected ? "Transaction detected! Waiting for blockchain confirmation..." : "Processing your payment...",
21507
+ processingStartTime,
21508
+ paymentNetwork: paymentNetwork || (selectedPaymentMethod == null ? void 0 : selectedPaymentMethod.network),
21509
+ transactionHash,
21510
+ onEarlySuccess: handleEarlySuccess
21393
21511
  }
21394
21512
  ),
21395
21513
  step === "success" && /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -21456,7 +21574,12 @@ const CoinleyCheckout = forwardRef(({
21456
21574
  testMode = false,
21457
21575
  supportedNetworks = [],
21458
21576
  preferredNetwork = NETWORK_TYPES.ETHEREUM,
21459
- preferredWallet = WALLET_TYPES.METAMASK
21577
+ preferredWallet = WALLET_TYPES.METAMASK,
21578
+ // New props for payment processing
21579
+ confirmations = 1,
21580
+ // Minimum confirmations required (lower = faster)
21581
+ fastMode = false
21582
+ // When true, will show success screen faster with fewer confirmations
21460
21583
  }, ref) => {
21461
21584
  const coinleyContext = useCoinley();
21462
21585
  const { theme: contextTheme } = useTheme();
@@ -21470,6 +21593,10 @@ const CoinleyCheckout = forwardRef(({
21470
21593
  const [availableWallets, setAvailableWallets] = useState({});
21471
21594
  const [step, setStep] = useState("select-currency");
21472
21595
  const [actualMerchantWallets, setActualMerchantWallets] = useState({});
21596
+ const [processingStartTime, setProcessingStartTime] = useState(null);
21597
+ const [transactionDetected, setTransactionDetected] = useState(false);
21598
+ const [checkingInterval, setCheckingInterval] = useState(null);
21599
+ const processingTimerRef = useRef(null);
21473
21600
  const effectiveApiKey = apiKey || (coinleyContext == null ? void 0 : coinleyContext.apiKey);
21474
21601
  const effectiveApiSecret = apiSecret || (coinleyContext == null ? void 0 : coinleyContext.apiSecret);
21475
21602
  apiUrl || (coinleyContext == null ? void 0 : coinleyContext.apiUrl);
@@ -21507,6 +21634,86 @@ const CoinleyCheckout = forwardRef(({
21507
21634
  detectWalletsAsync();
21508
21635
  }
21509
21636
  }, [effectiveDebug]);
21637
+ useEffect(() => {
21638
+ return () => {
21639
+ if (processingTimerRef.current) {
21640
+ clearTimeout(processingTimerRef.current);
21641
+ }
21642
+ if (checkingInterval) {
21643
+ clearInterval(checkingInterval);
21644
+ }
21645
+ };
21646
+ }, [checkingInterval]);
21647
+ useEffect(() => {
21648
+ if (transactionHash && paymentStatus === "loading" && step === "processing" && !checkingInterval) {
21649
+ setTransactionDetected(true);
21650
+ if (!testMode) {
21651
+ const interval = setInterval(() => __async(void 0, null, function* () {
21652
+ try {
21653
+ const processingTime = Date.now() - processingStartTime;
21654
+ if (fastMode && processingTime > getMinimumProcessingTime()) {
21655
+ log("Fast mode: Moving to success state early");
21656
+ clearInterval(interval);
21657
+ setCheckingInterval(null);
21658
+ handleEarlySuccess();
21659
+ return;
21660
+ }
21661
+ } catch (err) {
21662
+ log("Error checking transaction status:", err);
21663
+ }
21664
+ }), 5e3);
21665
+ setCheckingInterval(interval);
21666
+ }
21667
+ }
21668
+ return () => {
21669
+ if (checkingInterval) {
21670
+ clearInterval(checkingInterval);
21671
+ }
21672
+ };
21673
+ }, [transactionHash, paymentStatus, step, testMode, processingStartTime, fastMode]);
21674
+ const getMinimumProcessingTime = () => {
21675
+ if (!selectedPaymentMethod)
21676
+ return 2e4;
21677
+ const times = {
21678
+ [NETWORK_TYPES.ETHEREUM]: 15e3,
21679
+ // 15 seconds for Ethereum
21680
+ [NETWORK_TYPES.BSC]: 1e4,
21681
+ // 10 seconds for BSC
21682
+ [NETWORK_TYPES.TRON]: 8e3,
21683
+ // 8 seconds for Tron
21684
+ [NETWORK_TYPES.ALGORAND]: 5e3
21685
+ // 5 seconds for Algorand
21686
+ };
21687
+ return times[selectedPaymentMethod.network] || 15e3;
21688
+ };
21689
+ const handleEarlySuccess = () => __async(void 0, null, function* () {
21690
+ if (!payment || !selectedPaymentMethod || !transactionHash) {
21691
+ return;
21692
+ }
21693
+ log("Moving to early success state with transaction:", transactionHash);
21694
+ try {
21695
+ const processResponse = yield processPayment({
21696
+ paymentId: payment.id,
21697
+ transactionHash,
21698
+ network: selectedPaymentMethod.network,
21699
+ currency: selectedPaymentMethod.currency,
21700
+ senderAddress: walletConnection == null ? void 0 : walletConnection.address,
21701
+ early: true
21702
+ });
21703
+ log("Early payment processed:", processResponse);
21704
+ setPaymentStatus("success");
21705
+ setStep("success");
21706
+ if (onSuccess) {
21707
+ onSuccess(payment.id, transactionHash, {
21708
+ network: selectedPaymentMethod.network,
21709
+ currency: selectedPaymentMethod.currency,
21710
+ amount: payment.totalAmount || payment.amount
21711
+ });
21712
+ }
21713
+ } catch (err) {
21714
+ log("Early success processing error:", err);
21715
+ }
21716
+ });
21510
21717
  useImperativeHandle(ref, () => ({
21511
21718
  open: (paymentDetails) => {
21512
21719
  handleOpen(paymentDetails);
@@ -21563,11 +21770,21 @@ const CoinleyCheckout = forwardRef(({
21563
21770
  }
21564
21771
  });
21565
21772
  const handleClose = () => {
21773
+ if (checkingInterval) {
21774
+ clearInterval(checkingInterval);
21775
+ setCheckingInterval(null);
21776
+ }
21777
+ if (processingTimerRef.current) {
21778
+ clearTimeout(processingTimerRef.current);
21779
+ processingTimerRef.current = null;
21780
+ }
21566
21781
  setIsOpen(false);
21567
21782
  setTransactionHash(null);
21568
21783
  setWalletConnection(null);
21569
21784
  setSelectedPaymentMethod(null);
21570
21785
  setStep("select-currency");
21786
+ setProcessingStartTime(null);
21787
+ setTransactionDetected(false);
21571
21788
  if (onClose)
21572
21789
  onClose();
21573
21790
  };
@@ -21630,11 +21847,14 @@ const CoinleyCheckout = forwardRef(({
21630
21847
  setPaymentStatus("loading");
21631
21848
  setTransactionHash(null);
21632
21849
  setStep("processing");
21850
+ setProcessingStartTime(Date.now());
21851
+ setTransactionDetected(false);
21633
21852
  try {
21634
21853
  let txHash;
21635
21854
  if (testMode) {
21636
21855
  log("Test mode: Generating mock transaction...");
21637
21856
  txHash = `test_${Date.now().toString(16)}_${Math.random().toString(16).substring(2, 10)}`;
21857
+ yield new Promise((resolve) => setTimeout(resolve, 2e3));
21638
21858
  } else {
21639
21859
  let merchantAddress;
21640
21860
  if (payment.recipientWallet) {
@@ -21657,24 +21877,46 @@ const CoinleyCheckout = forwardRef(({
21657
21877
  }
21658
21878
  log("Transaction hash:", txHash);
21659
21879
  setTransactionHash(txHash);
21660
- log("Processing payment with backend...");
21661
- const processResponse = yield processPayment({
21662
- paymentId: payment.id,
21663
- transactionHash: txHash,
21664
- network: selectedPaymentMethod.network,
21665
- currency: selectedPaymentMethod.currency,
21666
- senderAddress: walletConnection == null ? void 0 : walletConnection.address
21667
- });
21668
- log("Payment processed successfully:", processResponse);
21669
- setPaymentStatus("success");
21670
- setStep("success");
21671
- if (onSuccess) {
21672
- log("Calling onSuccess callback...");
21673
- onSuccess(payment.id, txHash, {
21880
+ if (testMode) {
21881
+ processingTimerRef.current = setTimeout(() => {
21882
+ log("Test mode: Moving to success state");
21883
+ setPaymentStatus("success");
21884
+ setStep("success");
21885
+ if (onSuccess) {
21886
+ log("Calling onSuccess callback...");
21887
+ onSuccess(payment.id, txHash, {
21888
+ network: selectedPaymentMethod.network,
21889
+ currency: selectedPaymentMethod.currency,
21890
+ amount: payment.totalAmount || payment.amount
21891
+ });
21892
+ }
21893
+ }, 2e3);
21894
+ return;
21895
+ }
21896
+ try {
21897
+ log("Processing payment with backend...");
21898
+ const processResponse = yield processPayment({
21899
+ paymentId: payment.id,
21900
+ transactionHash: txHash,
21674
21901
  network: selectedPaymentMethod.network,
21675
21902
  currency: selectedPaymentMethod.currency,
21676
- amount: payment.totalAmount || payment.amount
21903
+ senderAddress: walletConnection == null ? void 0 : walletConnection.address,
21904
+ confirmations
21905
+ // Use specified confirmation level
21677
21906
  });
21907
+ log("Payment processed successfully:", processResponse);
21908
+ setPaymentStatus("success");
21909
+ setStep("success");
21910
+ if (onSuccess) {
21911
+ log("Calling onSuccess callback...");
21912
+ onSuccess(payment.id, txHash, {
21913
+ network: selectedPaymentMethod.network,
21914
+ currency: selectedPaymentMethod.currency,
21915
+ amount: payment.totalAmount || payment.amount
21916
+ });
21917
+ }
21918
+ } catch (processError) {
21919
+ log("Payment processing error, but transaction was sent:", processError);
21678
21920
  }
21679
21921
  } catch (err) {
21680
21922
  log("Payment error:", err);
@@ -21713,7 +21955,11 @@ const CoinleyCheckout = forwardRef(({
21713
21955
  supportedWallets: getSupportedWallets(),
21714
21956
  step,
21715
21957
  merchantWalletAddresses: actualMerchantWallets,
21716
- debug: effectiveDebug
21958
+ debug: effectiveDebug,
21959
+ processingStartTime,
21960
+ transactionDetected,
21961
+ paymentNetwork: selectedPaymentMethod == null ? void 0 : selectedPaymentMethod.network,
21962
+ onEarlySuccess: handleEarlySuccess
21717
21963
  }
21718
21964
  ) });
21719
21965
  });