@rozoai/intent-pay 0.1.4 → 0.1.5-beta.2
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/build/hooks/usePayoutPolling.d.ts +34 -0
- package/build/hooks/usePusherPayout.d.ts +33 -0
- package/build/package.json.js +8 -7
- package/build/package.json.js.map +1 -1
- package/build/src/components/Pages/Confirmation/index.js +57 -53
- package/build/src/components/Pages/Confirmation/index.js.map +1 -1
- package/build/src/hooks/usePayoutPolling.js +88 -0
- package/build/src/hooks/usePayoutPolling.js.map +1 -0
- package/build/src/hooks/usePusherPayout.js +183 -0
- package/build/src/hooks/usePusherPayout.js.map +1 -0
- package/package.json +8 -7
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { RozoPayHydratedOrderWithOrg, RozoPayOrder, RozoPayOrderWithOrg } from "@rozoai/intent-common";
|
|
2
|
+
import { PayLogFn } from "../provider/PayContext";
|
|
3
|
+
export interface UsePayoutPollingOptions {
|
|
4
|
+
/** Whether polling is enabled */
|
|
5
|
+
enabled: boolean | undefined;
|
|
6
|
+
/** The Rozo payment ID to poll for */
|
|
7
|
+
rozoPaymentId: string | undefined;
|
|
8
|
+
/** The order object (for logging purposes) */
|
|
9
|
+
order: RozoPayOrder | RozoPayOrderWithOrg | RozoPayHydratedOrderWithOrg | null | undefined;
|
|
10
|
+
/** Whether the payment is done */
|
|
11
|
+
done: boolean | undefined;
|
|
12
|
+
/** Whether to show processing payout */
|
|
13
|
+
showProcessingPayout: boolean | undefined;
|
|
14
|
+
/** Logging function */
|
|
15
|
+
log: PayLogFn;
|
|
16
|
+
/** Function to trigger resize */
|
|
17
|
+
triggerResize: () => void;
|
|
18
|
+
}
|
|
19
|
+
export interface UsePayoutPollingResult {
|
|
20
|
+
/** Whether payout is currently loading */
|
|
21
|
+
payoutLoading: boolean;
|
|
22
|
+
/** The payout transaction hash */
|
|
23
|
+
payoutTxHash: string | undefined;
|
|
24
|
+
/** The URL to view the payout transaction */
|
|
25
|
+
payoutTxHashUrl: string | undefined;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Hook to poll for payout transaction hash.
|
|
29
|
+
* Polls the payment API until a payout transaction hash is found.
|
|
30
|
+
*
|
|
31
|
+
* @param options - Configuration options for payout polling
|
|
32
|
+
* @returns Payout polling state and results
|
|
33
|
+
*/
|
|
34
|
+
export declare const usePayoutPolling: (options: UsePayoutPollingOptions) => UsePayoutPollingResult;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { PaymentStatus } from "@rozoai/intent-common";
|
|
2
|
+
import { PayLogFn } from "../provider/PayContext";
|
|
3
|
+
interface PusherStatusUpdatePayload {
|
|
4
|
+
payment_id: string;
|
|
5
|
+
status: PaymentStatus.PaymentPayoutCompleted;
|
|
6
|
+
source_txhash?: string;
|
|
7
|
+
destination_txhash?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface UsePusherPayoutOptions {
|
|
10
|
+
/** Whether Pusher integration is enabled */
|
|
11
|
+
enabled: boolean | undefined;
|
|
12
|
+
/** The Rozo payment ID to subscribe to */
|
|
13
|
+
rozoPaymentId: string | undefined;
|
|
14
|
+
/** Callback when payout completed status is received */
|
|
15
|
+
onPayoutCompleted?: (payload: PusherStatusUpdatePayload) => void;
|
|
16
|
+
/** Logging function */
|
|
17
|
+
log: PayLogFn;
|
|
18
|
+
}
|
|
19
|
+
export interface UsePusherPayoutResult {
|
|
20
|
+
/** Whether Pusher is connected */
|
|
21
|
+
isConnected: boolean;
|
|
22
|
+
/** Last received status update */
|
|
23
|
+
lastStatusUpdate: PusherStatusUpdatePayload | null;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Hook to subscribe to Pusher real-time payment status updates.
|
|
27
|
+
* Listens for payment_payout_completed status updates.
|
|
28
|
+
*
|
|
29
|
+
* @param options - Configuration options for Pusher integration
|
|
30
|
+
* @returns Pusher connection state and last status update
|
|
31
|
+
*/
|
|
32
|
+
export declare const usePusherPayout: (options: UsePusherPayoutOptions) => UsePusherPayoutResult;
|
|
33
|
+
export {};
|
package/build/package.json.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
var name = "@rozoai/intent-pay";
|
|
2
|
-
var version = "0.1.
|
|
2
|
+
var version = "0.1.5-beta.2";
|
|
3
3
|
var author = "RozoAI";
|
|
4
4
|
var homepage = "https://github.com/RozoAI/intent-pay";
|
|
5
5
|
var license = "BSD-2-Clause";
|
|
@@ -10,10 +10,6 @@ var exports = {
|
|
|
10
10
|
".": {
|
|
11
11
|
"import": "./build/src/index.js",
|
|
12
12
|
types: "./build/index.d.ts"
|
|
13
|
-
},
|
|
14
|
-
"./world": {
|
|
15
|
-
"import": "./build/src/world.js",
|
|
16
|
-
types: "./build/world.d.ts"
|
|
17
13
|
}
|
|
18
14
|
};
|
|
19
15
|
var types = "./build/index.d.ts";
|
|
@@ -49,7 +45,7 @@ var dependencies = {
|
|
|
49
45
|
"@albedo-link/intent": "^0.13.0",
|
|
50
46
|
"@reown/appkit": "^1.7.0",
|
|
51
47
|
"@rollup/plugin-typescript": "^12.1.2",
|
|
52
|
-
"@rozoai/intent-common": "0.1.
|
|
48
|
+
"@rozoai/intent-common": "0.1.6-beta.1",
|
|
53
49
|
"@solana/spl-token": "^0.4.14",
|
|
54
50
|
"@solana/wallet-adapter-base": "^0.9.27",
|
|
55
51
|
"@solana/wallet-adapter-react": "^0.15.39",
|
|
@@ -67,7 +63,8 @@ var dependencies = {
|
|
|
67
63
|
"react-use-measure": "^2.1.1",
|
|
68
64
|
"resize-observer-polyfill": "^1.5.1",
|
|
69
65
|
"styled-components": "^5.3.5",
|
|
70
|
-
"pino-pretty": "^10.0.0"
|
|
66
|
+
"pino-pretty": "^10.0.0",
|
|
67
|
+
"pusher-js": "^8.4.0"
|
|
71
68
|
};
|
|
72
69
|
var peerDependencies = {
|
|
73
70
|
"@creit.tech/stellar-wallets-kit": "^1.9.5",
|
|
@@ -99,7 +96,11 @@ var devDependencies = {
|
|
|
99
96
|
"@types/react-dom": "^18.2.18",
|
|
100
97
|
"@types/rollup-plugin-peer-deps-external": "^2.2.5",
|
|
101
98
|
"@types/styled-components": "^5.1.25",
|
|
99
|
+
"@typescript-eslint/eslint-plugin": "^6.21.0",
|
|
100
|
+
"@typescript-eslint/parser": "^6.21.0",
|
|
102
101
|
"@walletconnect/types": "^2.22.3",
|
|
102
|
+
eslint: "^8.57.0",
|
|
103
|
+
"eslint-plugin-react": "^7.37.0",
|
|
103
104
|
"eslint-plugin-react-hooks": "^5.2.0",
|
|
104
105
|
rollup: "^3.29.5",
|
|
105
106
|
"rollup-plugin-dts": "^6.1.1",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package.json.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"package.json.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -2,28 +2,29 @@ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
|
2
2
|
import React, { useState, useMemo, useEffect } from 'react';
|
|
3
3
|
import { usePayContext } from '../../../hooks/usePayContext.js';
|
|
4
4
|
import { ModalBody, PageContent, ModalContent, ModalH1, Link } from '../../Common/Modal/styles.js';
|
|
5
|
-
import { rozoStellar, rozoSolana, getChainExplorerTxUrl, getOrderDestChainId, assert,
|
|
5
|
+
import { rozoStellar, rozoSolana, getChainExplorerTxUrl, getOrderDestChainId, assert, updatePaymentPayInTxHash, getAddressContraction } from '@rozoai/intent-common';
|
|
6
6
|
import { motion } from 'framer-motion';
|
|
7
7
|
import { TickIcon, LoadingCircleIcon, ExternalLinkIcon } from '../../../assets/icons.js';
|
|
8
8
|
import defaultTheme from '../../../constants/defaultTheme.js';
|
|
9
9
|
import { DEFAULT_ROZO_APP_ID, ROZO_INVOICE_URL } from '../../../constants/rozoConfig.js';
|
|
10
10
|
import { useRozoPay } from '../../../hooks/useDaimoPay.js';
|
|
11
|
+
import { usePayoutPolling } from '../../../hooks/usePayoutPolling.js';
|
|
12
|
+
import { usePusherPayout } from '../../../hooks/usePusherPayout.js';
|
|
11
13
|
import { useSupportedChains } from '../../../hooks/useSupportedChains.js';
|
|
12
14
|
import styled from '../../../styles/styled/index.js';
|
|
13
15
|
import Button from '../../Common/Button/index.js';
|
|
14
16
|
import PoweredByFooter from '../../Common/PoweredByFooter/index.js';
|
|
15
17
|
|
|
16
|
-
const poolDelay = 1000;
|
|
17
18
|
const Confirmation = () => {
|
|
18
19
|
const { confirmationMessage, onSuccess, debugMode, paymentState: paymentStateContext, triggerResize, ...context } = usePayContext();
|
|
19
20
|
const { order, paymentState, setPaymentCompleted, setPaymentPayoutCompleted, } = useRozoPay();
|
|
20
21
|
const [isConfirming, setIsConfirming] = useState(true);
|
|
21
|
-
const [payoutLoading, setPayoutLoading] = useState(false);
|
|
22
|
-
const [payoutTxHashUrl, setPayoutTxHashUrl] = useState(undefined);
|
|
23
|
-
const [payoutTxHash, setPayoutTxHash] = useState(undefined);
|
|
24
22
|
// Track if completion events have been sent to prevent duplicate calls
|
|
25
23
|
const paymentCompletedSent = React.useRef(null);
|
|
26
24
|
const payoutCompletedSent = React.useRef(null);
|
|
25
|
+
// Local state for Pusher payout transaction hash
|
|
26
|
+
const [pusherPayoutTxHash, setPusherPayoutTxHash] = useState(undefined);
|
|
27
|
+
const [pusherPayoutTxHashUrl, setPusherPayoutTxHashUrl] = useState(undefined);
|
|
27
28
|
const showProcessingPayout = useMemo(() => {
|
|
28
29
|
const { payParams, tokenMode } = paymentStateContext;
|
|
29
30
|
if (payParams &&
|
|
@@ -100,54 +101,48 @@ const Confirmation = () => {
|
|
|
100
101
|
}
|
|
101
102
|
return undefined;
|
|
102
103
|
}, [rozoPaymentId, receiptUrl]);
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
catch (error) {
|
|
135
|
-
console.error("[CONFIRMATION] Payout polling error:", error);
|
|
136
|
-
if (isActive) {
|
|
137
|
-
timeoutId = setTimeout(pollPayout, poolDelay);
|
|
104
|
+
// Use payout polling hook
|
|
105
|
+
const { payoutLoading, payoutTxHash, payoutTxHashUrl } = usePayoutPolling({
|
|
106
|
+
enabled: false,
|
|
107
|
+
rozoPaymentId,
|
|
108
|
+
order,
|
|
109
|
+
done,
|
|
110
|
+
showProcessingPayout,
|
|
111
|
+
log: context.log,
|
|
112
|
+
triggerResize,
|
|
113
|
+
});
|
|
114
|
+
// Use Pusher hook for real-time status updates
|
|
115
|
+
usePusherPayout({
|
|
116
|
+
enabled: true,
|
|
117
|
+
rozoPaymentId,
|
|
118
|
+
onPayoutCompleted: (payload) => {
|
|
119
|
+
context.log("[CONFIRMATION] Pusher payout completed:", payload);
|
|
120
|
+
// If we receive payout completed from Pusher and have the destination txhash,
|
|
121
|
+
// we can use it to update the payout state
|
|
122
|
+
if (payload.destination_txhash && rozoPaymentId) {
|
|
123
|
+
const payoutKey = `${payload.destination_txhash}-${rozoPaymentId}`;
|
|
124
|
+
if (payoutCompletedSent.current !== payoutKey) {
|
|
125
|
+
payoutCompletedSent.current = payoutKey;
|
|
126
|
+
// Update local state for UI display
|
|
127
|
+
setPusherPayoutTxHash(payload.destination_txhash);
|
|
128
|
+
// Generate transaction URL if we have the order
|
|
129
|
+
if (order) {
|
|
130
|
+
const destChainId = getOrderDestChainId(order);
|
|
131
|
+
const txUrl = getChainExplorerTxUrl(destChainId, payload.destination_txhash);
|
|
132
|
+
setPusherPayoutTxHashUrl(txUrl);
|
|
138
133
|
}
|
|
134
|
+
// Update payment state
|
|
135
|
+
setPaymentPayoutCompleted(payload.destination_txhash, rozoPaymentId);
|
|
136
|
+
triggerResize();
|
|
139
137
|
}
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
};
|
|
149
|
-
}
|
|
150
|
-
}, [txURL, order, done, rozoPaymentId, showProcessingPayout]);
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
log: context.log,
|
|
141
|
+
});
|
|
142
|
+
/**
|
|
143
|
+
* Sets the payment completed state.
|
|
144
|
+
* This is called when the payment is confirmed and the transaction hash is available.
|
|
145
|
+
*/
|
|
151
146
|
useEffect(() => {
|
|
152
147
|
if (done && rawPayInHash && rozoPaymentId) {
|
|
153
148
|
// Only call once per unique payment hash to prevent duplicate state updates
|
|
@@ -160,10 +155,18 @@ const Confirmation = () => {
|
|
|
160
155
|
rozoPaymentId,
|
|
161
156
|
});
|
|
162
157
|
paymentCompletedSent.current = paymentKey;
|
|
158
|
+
// Update payment pay-in transaction hash on the server
|
|
159
|
+
updatePaymentPayInTxHash(rozoPaymentId, rawPayInHash, "v2").catch((error) => {
|
|
160
|
+
context.log("[CONFIRMATION] Failed to update payment pay-in tx hash:", error);
|
|
161
|
+
});
|
|
163
162
|
setPaymentCompleted(rawPayInHash, rozoPaymentId);
|
|
164
163
|
onSuccess();
|
|
165
164
|
}
|
|
166
|
-
}, [done,
|
|
165
|
+
}, [done, paymentStateContext, rawPayInHash, rozoPaymentId]);
|
|
166
|
+
/**
|
|
167
|
+
* Sets the payout completed state.
|
|
168
|
+
* This is called when the payout is confirmed and the transaction hash is available.
|
|
169
|
+
*/
|
|
167
170
|
useEffect(() => {
|
|
168
171
|
if (done && payoutTxHash && rozoPaymentId) {
|
|
169
172
|
// Only call once per unique payout hash to prevent duplicate state updates
|
|
@@ -198,7 +201,8 @@ const Confirmation = () => {
|
|
|
198
201
|
alignItems: "center",
|
|
199
202
|
gap: 3,
|
|
200
203
|
flexDirection: "column",
|
|
201
|
-
}, children: "Payment Completed" }), txURL && (jsxs(ListContainer, { children: [jsxs(ListItem, { children: [jsx(ModalBody, { children: "Transfer Hash" }), jsx(ModalBody, { children: jsxs(Link, { href: txURL, target: "_blank", rel: "noopener noreferrer", style: { fontSize: 14, fontWeight: 400 }, children: [getAddressContraction(rawPayInHash), jsx(ExternalIcon, {})] }) })] }), showProcessingPayout && (jsxs(ListItem, { children: [jsx(ModalBody, { children: "Receiver Hash" }), jsx(ModalBody, { children: payoutLoading ? (jsx(LoadingText, { children: "Processing payout..." })) :
|
|
204
|
+
}, children: "Payment Completed" }), txURL && (jsxs(ListContainer, { children: [jsxs(ListItem, { children: [jsx(ModalBody, { children: "Transfer Hash" }), jsx(ModalBody, { children: jsxs(Link, { href: txURL, target: "_blank", rel: "noopener noreferrer", style: { fontSize: 14, fontWeight: 400 }, children: [getAddressContraction(rawPayInHash), jsx(ExternalIcon, {})] }) })] }), showProcessingPayout && (jsxs(ListItem, { children: [jsx(ModalBody, { children: "Receiver Hash" }), jsx(ModalBody, { children: payoutLoading ? (jsx(LoadingText, { children: "Processing payout..." })) : (pusherPayoutTxHashUrl && pusherPayoutTxHash) ||
|
|
205
|
+
(payoutTxHashUrl && payoutTxHash) ? (jsxs(Link, { href: pusherPayoutTxHashUrl || payoutTxHashUrl || "#", target: "_blank", rel: "noopener noreferrer", style: { fontSize: 14, fontWeight: 400 }, children: [getAddressContraction(pusherPayoutTxHash || payoutTxHash || ""), jsx(ExternalIcon, {})] })) : (jsx(PlaceholderText, { children: "Pending..." })) })] }))] })), confirmationMessage && (jsx(ModalBody, { children: confirmationMessage }))] })), done && generateReceiptUrl && (jsx(Button, { iconPosition: "right", href: generateReceiptUrl, style: { width: "100%" }, children: "See Receipt" })), jsx(PoweredByFooter, { showSupport: !done, preFilledMessage: `Transaction: ${txURL}` })] }) }));
|
|
202
206
|
};
|
|
203
207
|
const AnimationContainer = styled(motion.div) `
|
|
204
208
|
position: relative;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../src/components/Pages/Confirmation/index.tsx"],"sourcesContent":[null],"names":["_jsx","_jsxs","_Fragment"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../src/components/Pages/Confirmation/index.tsx"],"sourcesContent":[null],"names":["_jsx","_jsxs","_Fragment"],"mappings":";;;;;;;;;;;;;;;;;AAuCM,MAAA,YAAY,GAAa,MAAK;AAClC,IAAA,MAAM,EACJ,mBAAmB,EACnB,SAAS,EACT,SAAS,EACT,YAAY,EAAE,mBAAmB,EACjC,aAAa,EACb,GAAG,OAAO,EACX,GAAG,aAAa,EAAE,CAAC;AACpB,IAAA,MAAM,EACJ,KAAK,EACL,YAAY,EACZ,mBAAmB,EACnB,yBAAyB,GAC1B,GAAG,UAAU,EAAE,CAAC;IAEjB,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAAU,IAAI,CAAC,CAAC;;IAGhE,MAAM,oBAAoB,GAAG,KAAK,CAAC,MAAM,CAAgB,IAAI,CAAC,CAAC;IAC/D,MAAM,mBAAmB,GAAG,KAAK,CAAC,MAAM,CAAgB,IAAI,CAAC,CAAC;;IAG9D,MAAM,CAAC,kBAAkB,EAAE,qBAAqB,CAAC,GAAG,QAAQ,CAE1D,SAAS,CAAC,CAAC;IACb,MAAM,CAAC,qBAAqB,EAAE,wBAAwB,CAAC,GAAG,QAAQ,CAEhE,SAAS,CAAC,CAAC;AAEb,IAAA,MAAM,oBAAoB,GAAG,OAAO,CAAC,MAAK;AACxC,QAAA,MAAM,EAAE,S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;;;;;;;;;;;CAsB9B;;;;"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { getPayment, getChainExplorerTxUrl } from '@rozoai/intent-common';
|
|
2
|
+
import { useState, useEffect } from 'react';
|
|
3
|
+
|
|
4
|
+
const POLL_DELAY = 1000;
|
|
5
|
+
/**
|
|
6
|
+
* Hook to poll for payout transaction hash.
|
|
7
|
+
* Polls the payment API until a payout transaction hash is found.
|
|
8
|
+
*
|
|
9
|
+
* @param options - Configuration options for payout polling
|
|
10
|
+
* @returns Payout polling state and results
|
|
11
|
+
*/
|
|
12
|
+
const usePayoutPolling = (options) => {
|
|
13
|
+
const { enabled, rozoPaymentId, order, done, showProcessingPayout, log, triggerResize, } = options;
|
|
14
|
+
const [payoutLoading, setPayoutLoading] = useState(false);
|
|
15
|
+
const [payoutTxHash, setPayoutTxHash] = useState(undefined);
|
|
16
|
+
const [payoutTxHashUrl, setPayoutTxHashUrl] = useState(undefined);
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
// Only start polling if all conditions are met and polling is enabled
|
|
19
|
+
if (!enabled ||
|
|
20
|
+
!order ||
|
|
21
|
+
!done ||
|
|
22
|
+
!rozoPaymentId ||
|
|
23
|
+
!showProcessingPayout ||
|
|
24
|
+
!("externalId" in order)) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
triggerResize();
|
|
28
|
+
log("[CONFIRMATION] Starting payout polling for order:", order.externalId);
|
|
29
|
+
setPayoutLoading(true);
|
|
30
|
+
let isActive = true;
|
|
31
|
+
let timeoutId;
|
|
32
|
+
const pollPayout = async () => {
|
|
33
|
+
if (!isActive || !rozoPaymentId)
|
|
34
|
+
return;
|
|
35
|
+
try {
|
|
36
|
+
log("[CONFIRMATION] Polling for payout transaction:", rozoPaymentId);
|
|
37
|
+
const response = await getPayment(rozoPaymentId, "v2");
|
|
38
|
+
log("[CONFIRMATION] Payout polling response:", response.data);
|
|
39
|
+
if (isActive &&
|
|
40
|
+
response.data &&
|
|
41
|
+
response.data.destination.txHash &&
|
|
42
|
+
typeof response.data.destination.txHash === "string") {
|
|
43
|
+
const url = getChainExplorerTxUrl(Number(response.data.destination.chainId), response.data.destination.txHash);
|
|
44
|
+
log("[CONFIRMATION] Found payout transaction:", response.data.destination.txHash, "URL:", url);
|
|
45
|
+
setPayoutTxHash(response.data.destination.txHash);
|
|
46
|
+
setPayoutTxHashUrl(url);
|
|
47
|
+
setPayoutLoading(false);
|
|
48
|
+
triggerResize();
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
// Schedule next poll
|
|
52
|
+
if (isActive) {
|
|
53
|
+
timeoutId = setTimeout(pollPayout, POLL_DELAY);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
catch (error) {
|
|
57
|
+
console.error("[CONFIRMATION] Payout polling error:", error);
|
|
58
|
+
if (isActive) {
|
|
59
|
+
timeoutId = setTimeout(pollPayout, POLL_DELAY);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
// Start polling
|
|
64
|
+
timeoutId = setTimeout(pollPayout, 0);
|
|
65
|
+
return () => {
|
|
66
|
+
isActive = false;
|
|
67
|
+
if (timeoutId) {
|
|
68
|
+
clearTimeout(timeoutId);
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
}, [
|
|
72
|
+
enabled,
|
|
73
|
+
order,
|
|
74
|
+
done,
|
|
75
|
+
rozoPaymentId,
|
|
76
|
+
showProcessingPayout,
|
|
77
|
+
log,
|
|
78
|
+
triggerResize,
|
|
79
|
+
]);
|
|
80
|
+
return {
|
|
81
|
+
payoutLoading,
|
|
82
|
+
payoutTxHash,
|
|
83
|
+
payoutTxHashUrl,
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
export { usePayoutPolling };
|
|
88
|
+
//# sourceMappingURL=usePayoutPolling.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usePayoutPolling.js","sources":["../../../src/hooks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,EAAE;QACD,OAAO;QACP,KAAK;QACL,IAAI;QACJ,aAAa;QACb,oBAAoB;QACpB,GAAG;QACH,aAAa;AACd,KAAA,CAAC,CAAC;IAEH,OAAO;QACL,aAAa;QACb,YAAY;QACZ,eAAe;KAChB,CAAC;AACJ;;;;"}
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import { PaymentStatus } from '@rozoai/intent-common';
|
|
2
|
+
import { useState, useRef, useEffect } from 'react';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Pusher configuration constants
|
|
6
|
+
*/
|
|
7
|
+
const PUSHER_CONFIG = {
|
|
8
|
+
appId: "2090164",
|
|
9
|
+
key: "22273733a3d287ae4279",
|
|
10
|
+
cluster: "us2",
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Hook to subscribe to Pusher real-time payment status updates.
|
|
14
|
+
* Listens for payment_payout_completed status updates.
|
|
15
|
+
*
|
|
16
|
+
* @param options - Configuration options for Pusher integration
|
|
17
|
+
* @returns Pusher connection state and last status update
|
|
18
|
+
*/
|
|
19
|
+
const usePusherPayout = (options) => {
|
|
20
|
+
const { enabled, rozoPaymentId, onPayoutCompleted, log } = options;
|
|
21
|
+
const [isConnected, setIsConnected] = useState(false);
|
|
22
|
+
const [lastStatusUpdate, setLastStatusUpdate] = useState(null);
|
|
23
|
+
const pusherRef = useRef(null);
|
|
24
|
+
const channelRef = useRef(null);
|
|
25
|
+
const statusUpdateHandlerRef = useRef(null);
|
|
26
|
+
// Store callbacks in refs to prevent infinite loops
|
|
27
|
+
const onPayoutCompletedRef = useRef(onPayoutCompleted);
|
|
28
|
+
const logRef = useRef(log);
|
|
29
|
+
// Update refs when callbacks change (without triggering re-renders)
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
onPayoutCompletedRef.current = onPayoutCompleted;
|
|
32
|
+
logRef.current = log;
|
|
33
|
+
});
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
// Early return if disabled or missing payment ID
|
|
36
|
+
if (!enabled || !rozoPaymentId) {
|
|
37
|
+
// Clean up if we have an active connection
|
|
38
|
+
if (channelRef.current) {
|
|
39
|
+
channelRef.current.unbind("status-update", statusUpdateHandlerRef.current ?? undefined);
|
|
40
|
+
channelRef.current.unsubscribe();
|
|
41
|
+
channelRef.current = null;
|
|
42
|
+
}
|
|
43
|
+
if (pusherRef.current) {
|
|
44
|
+
pusherRef.current.unsubscribe(`payments-${rozoPaymentId}`);
|
|
45
|
+
pusherRef.current.disconnect();
|
|
46
|
+
pusherRef.current = null;
|
|
47
|
+
}
|
|
48
|
+
setIsConnected(false);
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
// Dynamically import pusher-js to make it optional
|
|
52
|
+
let isActive = true;
|
|
53
|
+
const initializePusher = async () => {
|
|
54
|
+
try {
|
|
55
|
+
// Dynamic import to handle optional dependency
|
|
56
|
+
const PusherModule = await import('pusher-js');
|
|
57
|
+
const Pusher = PusherModule.default || PusherModule;
|
|
58
|
+
// Initialize Pusher client
|
|
59
|
+
const pusher = new Pusher(PUSHER_CONFIG.key, {
|
|
60
|
+
cluster: PUSHER_CONFIG.cluster,
|
|
61
|
+
// enabledTransports: ["ws", "wss"],
|
|
62
|
+
});
|
|
63
|
+
if (!isActive) {
|
|
64
|
+
pusher.disconnect();
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
pusherRef.current = pusher;
|
|
68
|
+
// Subscribe to payment channel
|
|
69
|
+
const channelName = `payments-${rozoPaymentId}`;
|
|
70
|
+
const channel = pusher.subscribe(channelName);
|
|
71
|
+
if (!isActive) {
|
|
72
|
+
channel.unsubscribe();
|
|
73
|
+
pusher.disconnect();
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
channelRef.current = channel;
|
|
77
|
+
// Handle connection state
|
|
78
|
+
pusher.connection.bind("connected", () => {
|
|
79
|
+
if (isActive) {
|
|
80
|
+
logRef.current("[PUSHER] Connected to Pusher");
|
|
81
|
+
setIsConnected(true);
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
pusher.connection.bind("disconnected", () => {
|
|
85
|
+
if (isActive) {
|
|
86
|
+
logRef.current("[PUSHER] Disconnected from Pusher");
|
|
87
|
+
setIsConnected(false);
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
pusher.connection.bind("error", (err) => {
|
|
91
|
+
if (isActive) {
|
|
92
|
+
logRef.current("[PUSHER] Connection error:", err);
|
|
93
|
+
setIsConnected(false);
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
// Handle subscription success
|
|
97
|
+
channel.bind("pusher:subscription_succeeded", () => {
|
|
98
|
+
if (isActive) {
|
|
99
|
+
logRef.current(`[PUSHER] Subscribed to channel: ${channelName}`);
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
channel.bind("pusher:subscription_error", (err) => {
|
|
103
|
+
if (isActive) {
|
|
104
|
+
logRef.current(`[PUSHER] Subscription error for channel ${channelName}:`, err);
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
// Create status update handler
|
|
108
|
+
const handleStatusUpdate = (data) => {
|
|
109
|
+
if (!isActive)
|
|
110
|
+
return;
|
|
111
|
+
logRef.current("[PUSHER] Received status update:", data);
|
|
112
|
+
// Validate payload
|
|
113
|
+
if (!data.payment_id || !data.status) {
|
|
114
|
+
logRef.current("[PUSHER] Invalid status update payload:", data);
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
// Only process payout completed status
|
|
118
|
+
if (data.status === PaymentStatus.PaymentPayoutCompleted) {
|
|
119
|
+
setLastStatusUpdate(data);
|
|
120
|
+
// Trigger callback using ref
|
|
121
|
+
if (onPayoutCompletedRef.current) {
|
|
122
|
+
onPayoutCompletedRef.current(data);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
logRef.current(`[PUSHER] Ignoring status update (not payout completed):`, data.status);
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
statusUpdateHandlerRef.current = handleStatusUpdate;
|
|
130
|
+
// Bind to status-update event
|
|
131
|
+
channel.bind("status-update", handleStatusUpdate);
|
|
132
|
+
logRef.current(`[PUSHER] Listening for status updates on channel: ${channelName}`);
|
|
133
|
+
}
|
|
134
|
+
catch (error) {
|
|
135
|
+
if (isActive) {
|
|
136
|
+
// Handle case where pusher-js is not installed
|
|
137
|
+
if (error instanceof Error &&
|
|
138
|
+
(error.message.includes("Cannot find module") ||
|
|
139
|
+
error.message.includes("Failed to resolve"))) {
|
|
140
|
+
logRef.current("[PUSHER] pusher-js not installed. Install it as a peer dependency to enable Pusher integration.");
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
logRef.current("[PUSHER] Failed to initialize:", error);
|
|
144
|
+
}
|
|
145
|
+
setIsConnected(false);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
initializePusher();
|
|
150
|
+
// Cleanup function
|
|
151
|
+
return () => {
|
|
152
|
+
isActive = false;
|
|
153
|
+
if (channelRef.current && statusUpdateHandlerRef.current) {
|
|
154
|
+
try {
|
|
155
|
+
channelRef.current.unbind("status-update", statusUpdateHandlerRef.current);
|
|
156
|
+
channelRef.current.unsubscribe();
|
|
157
|
+
}
|
|
158
|
+
catch (error) {
|
|
159
|
+
logRef.current("[PUSHER] Error during channel cleanup:", error);
|
|
160
|
+
}
|
|
161
|
+
channelRef.current = null;
|
|
162
|
+
statusUpdateHandlerRef.current = null;
|
|
163
|
+
}
|
|
164
|
+
if (pusherRef.current) {
|
|
165
|
+
try {
|
|
166
|
+
pusherRef.current.disconnect();
|
|
167
|
+
}
|
|
168
|
+
catch (error) {
|
|
169
|
+
logRef.current("[PUSHER] Error during Pusher disconnect:", error);
|
|
170
|
+
}
|
|
171
|
+
pusherRef.current = null;
|
|
172
|
+
}
|
|
173
|
+
setIsConnected(false);
|
|
174
|
+
};
|
|
175
|
+
}, [enabled, rozoPaymentId]);
|
|
176
|
+
return {
|
|
177
|
+
isConnected,
|
|
178
|
+
lastStatusUpdate,
|
|
179
|
+
};
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
export { usePusherPayout };
|
|
183
|
+
//# sourceMappingURL=usePusherPayout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usePusherPayout.js","sources":["../../../src/hooks/usePusherPayout.ts"],"sourcesContent":[null],"names":[],"mappings":";;;AA0CA;;AAEG;AACH,MAAM,aAAa,GAAG;AACpB,IAAA,KAAK,EAAE,SAAS;AAChB,IAAA,GAAG,EAAE,sBAAsB;AAC3B,IAAA,OAAO,EAAE,KAAK;CACN,CAAC;AAEX;;;;;;AAMG;AACU,MAAA,eAAe,GAAG,CAC7B,OAA+B,KACN;IACzB,MAAM,EAAE,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC;IAEnE,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,QAAQ,CAAU,KAAK,CAAC,CAAC;IAC/D,MAAM,CAAC,gBAAgB,EAAE,mBAAmB,CAAC,GAC3C,QAAQ,CAAmC,IAAI,CAAC,CAAC;AAEnD,IAAA,MAAM,SAAS,GAAG,MAAM,CAAgB,IAAI,CAAC,CAAC;AAC9C,IAAA,MAAM,UAAU,GAAG,MAAM,CAAuB,IAAI,CAAC,CAAC;AACtD,IAAA,MAAM,sBAAsB,GAAG,MAAM,CAEnC,IAAI,CAAC,CAAC;;AAGR,IAAA,MAAM,oBAAoB,GAAG,MAAM,CAAC,iBAAiB,CAAC,CAAC;AACvD,IAAA,MAAM,MAAM,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;;IAG3B,SAAS,CAAC,MAAK;AACb,QAAA,oBAAoB,CAAC,OAAO,GAAG,iBAAiB,CAAC;AACjD,QAAA,MAAM,CAAC,OAAO,GAAG,GAAG,CAAC;AACvB,KAAC,CAAC,CAAC;IAEH,SAAS,CAAC,MAAK;;AAEb,QAAA,IAAI,CAAC,OAAO,IAAI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.5-beta.2",
|
|
5
5
|
"author": "RozoAI",
|
|
6
6
|
"homepage": "https://github.com/RozoAI/intent-pay",
|
|
7
7
|
"license": "BSD-2-Clause",
|
|
@@ -12,10 +12,6 @@
|
|
|
12
12
|
".": {
|
|
13
13
|
"import": "./build/src/index.js",
|
|
14
14
|
"types": "./build/index.d.ts"
|
|
15
|
-
},
|
|
16
|
-
"./world": {
|
|
17
|
-
"import": "./build/src/world.js",
|
|
18
|
-
"types": "./build/world.d.ts"
|
|
19
15
|
}
|
|
20
16
|
},
|
|
21
17
|
"types": "./build/index.d.ts",
|
|
@@ -43,7 +39,7 @@
|
|
|
43
39
|
"@albedo-link/intent": "^0.13.0",
|
|
44
40
|
"@reown/appkit": "^1.7.0",
|
|
45
41
|
"@rollup/plugin-typescript": "^12.1.2",
|
|
46
|
-
"@rozoai/intent-common": "0.1.
|
|
42
|
+
"@rozoai/intent-common": "0.1.6-beta.1",
|
|
47
43
|
"@solana/spl-token": "^0.4.14",
|
|
48
44
|
"@solana/wallet-adapter-base": "^0.9.27",
|
|
49
45
|
"@solana/wallet-adapter-react": "^0.15.39",
|
|
@@ -61,7 +57,8 @@
|
|
|
61
57
|
"react-use-measure": "^2.1.1",
|
|
62
58
|
"resize-observer-polyfill": "^1.5.1",
|
|
63
59
|
"styled-components": "^5.3.5",
|
|
64
|
-
"pino-pretty": "^10.0.0"
|
|
60
|
+
"pino-pretty": "^10.0.0",
|
|
61
|
+
"pusher-js": "^8.4.0"
|
|
65
62
|
},
|
|
66
63
|
"peerDependencies": {
|
|
67
64
|
"@creit.tech/stellar-wallets-kit": "^1.9.5",
|
|
@@ -93,7 +90,11 @@
|
|
|
93
90
|
"@types/react-dom": "^18.2.18",
|
|
94
91
|
"@types/rollup-plugin-peer-deps-external": "^2.2.5",
|
|
95
92
|
"@types/styled-components": "^5.1.25",
|
|
93
|
+
"@typescript-eslint/eslint-plugin": "^6.21.0",
|
|
94
|
+
"@typescript-eslint/parser": "^6.21.0",
|
|
96
95
|
"@walletconnect/types": "^2.22.3",
|
|
96
|
+
"eslint": "^8.57.0",
|
|
97
|
+
"eslint-plugin-react": "^7.37.0",
|
|
97
98
|
"eslint-plugin-react-hooks": "^5.2.0",
|
|
98
99
|
"rollup": "^3.29.5",
|
|
99
100
|
"rollup-plugin-dts": "^6.1.1",
|