zigap-utils 3.1.0-preview.1 → 3.1.0-preview.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.
- package/dist/hooks/index.d.ts +2 -1
- package/dist/hooks/useAddressProvideReceive.d.ts +17 -0
- package/dist/hooks/useDeeplinkAppSwitch.d.ts +8 -0
- package/dist/hooks/useDeeplinkLogin.d.ts +21 -0
- package/dist/hooks/useDeeplinkPayment.d.ts +22 -0
- package/dist/hooks/useDeeplinkResume.d.ts +25 -0
- package/dist/hooks/useDeeplinkSendTransaction.d.ts +20 -0
- package/dist/hooks/useDeeplinkSignature.d.ts +21 -0
- package/dist/hooks/useRoomExpiry.d.ts +2 -0
- package/dist/hooks/useSocketRoom.d.ts +7 -0
- package/dist/hooks/useZigap.d.ts +1 -0
- package/dist/index.d.ts +0 -1
- package/dist/index.es.js +9478 -9304
- package/dist/utils/deeplinkTransport.d.ts +62 -0
- package/dist/utils/device.d.ts +14 -0
- package/dist/utils/handshake.d.ts +6 -0
- package/dist/utils/resumeLoginResult.d.ts +25 -0
- package/dist/utils/socketService.d.ts +5 -0
- package/dist/zigap/qr.d.ts +0 -1
- package/dist/zigap/scanUrl.d.ts +9 -0
- package/package.json +1 -1
- package/dist/utils/session.d.ts +0 -1
package/dist/hooks/index.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export { default as useZigap } from './useZigap';
|
|
1
|
+
export { default as useZigap, clearSession } from './useZigap';
|
|
2
|
+
export { default as useRoomExpiry } from './useRoomExpiry';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 데스크톱 QR 경로에서 앱이 회신하는 주소를 1회 수신해 onReceive 로 통지하는 훅.
|
|
3
|
+
*
|
|
4
|
+
* qrAddressProvide 가 'addressProvide' 소켓 리스너를 등록하고 회신을 await 한다.
|
|
5
|
+
* cleanup 에서 같은 리스너를 회수해 싱글톤 소켓에 리스너가 누적되는 것을 막는다.
|
|
6
|
+
*
|
|
7
|
+
* onReceive 는 매 렌더 새 함수라 deps 에 넣으면 effect 가 재실행되어 수신 대기가 리셋된다.
|
|
8
|
+
* ref 로 최신 콜백만 유지하고 deps 에서 제외한다.
|
|
9
|
+
*/
|
|
10
|
+
interface UseAddressProvideReceiveArgs {
|
|
11
|
+
roomId: string;
|
|
12
|
+
onReceive: (res: {
|
|
13
|
+
isSuccess: boolean;
|
|
14
|
+
}) => void;
|
|
15
|
+
}
|
|
16
|
+
export declare const useAddressProvideReceive: ({ roomId, onReceive }: UseAddressProvideReceiveArgs) => void;
|
|
17
|
+
export default useAddressProvideReceive;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const shouldNavigateToApp: (isValid: boolean, isMobile: boolean, hasNavigated: boolean) => boolean;
|
|
2
|
+
interface UseDeeplinkAppSwitchArgs {
|
|
3
|
+
qrCode: string;
|
|
4
|
+
isMobile: boolean;
|
|
5
|
+
isValid: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare const useDeeplinkAppSwitch: ({ qrCode, isMobile, isValid }: UseDeeplinkAppSwitchArgs) => void;
|
|
8
|
+
export default useDeeplinkAppSwitch;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { LoginQRProps } from 'src/components/LoginQR/LoginQR.types';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 모바일(같은 폰) 딥링크 로그인 전담 훅 — 앱 전환 + 복귀 재개를 한 곳에 묶는다.
|
|
5
|
+
* 데스크톱은 하위 훅이 isMobile=false 로 알아서 비활성화된다(라이브 QR 흐름은 컴포넌트 담당).
|
|
6
|
+
*/
|
|
7
|
+
interface UseDeeplinkLoginArgs {
|
|
8
|
+
roomId: string;
|
|
9
|
+
nonce: string;
|
|
10
|
+
qrCode: string;
|
|
11
|
+
sigMessage: string;
|
|
12
|
+
expire: LoginQRProps['expire'];
|
|
13
|
+
validSeconds: number;
|
|
14
|
+
isMobile: boolean;
|
|
15
|
+
isValid: boolean;
|
|
16
|
+
onReceive: LoginQRProps['onReceive'];
|
|
17
|
+
}
|
|
18
|
+
export declare const useDeeplinkLogin: ({ roomId, nonce, qrCode, sigMessage, expire, validSeconds, isMobile, isValid, onReceive, }: UseDeeplinkLoginArgs) => {
|
|
19
|
+
isResuming: boolean;
|
|
20
|
+
};
|
|
21
|
+
export default useDeeplinkLogin;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { PaymentQRProps } from 'src/components/PaymentQR/PaymentQR.types';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 모바일(같은 폰) 딥링크 결제 전담 훅 — 앱 전환 + 복귀 재개를 한 곳에 묶는다.
|
|
5
|
+
* 데스크톱은 하위 훅이 isMobile=false 로 알아서 비활성화된다(라이브 QR 흐름은 컴포넌트 담당).
|
|
6
|
+
*/
|
|
7
|
+
interface UseDeeplinkPaymentArgs {
|
|
8
|
+
roomId: string;
|
|
9
|
+
nonce: string;
|
|
10
|
+
qrCode: string;
|
|
11
|
+
network: string;
|
|
12
|
+
address: string;
|
|
13
|
+
amount: string;
|
|
14
|
+
validSeconds: number;
|
|
15
|
+
isMobile: boolean;
|
|
16
|
+
isValid: boolean;
|
|
17
|
+
onReceive: PaymentQRProps['onReceive'];
|
|
18
|
+
}
|
|
19
|
+
export declare const useDeeplinkPayment: ({ roomId, nonce, qrCode, network, address, amount, validSeconds, isMobile, isValid, onReceive, }: UseDeeplinkPaymentArgs) => {
|
|
20
|
+
isResuming: boolean;
|
|
21
|
+
};
|
|
22
|
+
export default useDeeplinkPayment;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { DeeplinkEnvelopeType } from 'src/utils/deeplinkTransport';
|
|
2
|
+
|
|
3
|
+
/** 딥링크로 앱에 다녀온 뒤 끊겼던 연결을 이어주는 훅. type 만 바꾸면 login 외 sendTransaction/payment 에도 쓴다. */
|
|
4
|
+
export type ResumeResult = {
|
|
5
|
+
status: 'SUCCESS';
|
|
6
|
+
result: any;
|
|
7
|
+
} | {
|
|
8
|
+
status: 'TIMEOUT';
|
|
9
|
+
};
|
|
10
|
+
/** type 별 완료 이벤트명. 서버가 같은 채널로 replay 하므로 단일 구독이 LIVE 완료와 RESUME 복귀를 모두 받는다. */
|
|
11
|
+
export declare const completeEventForType: (type?: DeeplinkEnvelopeType | string) => string;
|
|
12
|
+
interface UseDeeplinkResumeArgs {
|
|
13
|
+
roomId: string;
|
|
14
|
+
nonce: string;
|
|
15
|
+
type: DeeplinkEnvelopeType | string;
|
|
16
|
+
payload?: any;
|
|
17
|
+
onResult: (result: ResumeResult) => void;
|
|
18
|
+
/** resume 액션 시점(화면 복귀 후 서버 보관분 pull 직전)에 호출. optional. */
|
|
19
|
+
onResume?: () => void;
|
|
20
|
+
timeoutMs?: number;
|
|
21
|
+
/** false 면 훅 비활성(예: roomId 미정 시). 기본 true. */
|
|
22
|
+
enabled?: boolean;
|
|
23
|
+
}
|
|
24
|
+
export declare const useDeeplinkResume: ({ roomId, nonce, type, payload, onResult, onResume, timeoutMs, enabled, }: UseDeeplinkResumeArgs) => void;
|
|
25
|
+
export default useDeeplinkResume;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { SendTransactionQRProps } from 'src/components/SendTransactionQR/SendTransactionQR.types';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 모바일(같은 폰) 딥링크 트랜잭션 전송 전담 훅 — 앱 전환 + 복귀 재개를 한 곳에 묶는다.
|
|
5
|
+
* 데스크톱은 하위 훅이 isMobile=false 로 알아서 비활성화된다(라이브 QR 흐름은 컴포넌트 담당).
|
|
6
|
+
*/
|
|
7
|
+
interface UseDeeplinkSendTransactionArgs {
|
|
8
|
+
roomId: string;
|
|
9
|
+
nonce: string;
|
|
10
|
+
qrCode: string;
|
|
11
|
+
transaction: SendTransactionQRProps['transaction'];
|
|
12
|
+
validSeconds: number;
|
|
13
|
+
isMobile: boolean;
|
|
14
|
+
isValid: boolean;
|
|
15
|
+
onReceive: SendTransactionQRProps['onReceive'];
|
|
16
|
+
}
|
|
17
|
+
export declare const useDeeplinkSendTransaction: ({ roomId, nonce, qrCode, transaction, validSeconds, isMobile, isValid, onReceive, }: UseDeeplinkSendTransactionArgs) => {
|
|
18
|
+
isResuming: boolean;
|
|
19
|
+
};
|
|
20
|
+
export default useDeeplinkSendTransaction;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { SignatureQRProps } from 'src/components/SignatureQR/SignatureQR.types';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 모바일(같은 폰) 딥링크 서명 전담 훅 — 앱 전환 + 복귀 재개를 한 곳에 묶는다.
|
|
5
|
+
* 데스크톱은 하위 훅이 isMobile=false 로 알아서 비활성화된다(라이브 QR 흐름은 컴포넌트 담당).
|
|
6
|
+
*/
|
|
7
|
+
interface UseDeeplinkSignatureArgs {
|
|
8
|
+
roomId: string;
|
|
9
|
+
nonce: string;
|
|
10
|
+
qrCode: string;
|
|
11
|
+
sigMessage: string;
|
|
12
|
+
expire: SignatureQRProps['expire'];
|
|
13
|
+
validSeconds: number;
|
|
14
|
+
isMobile: boolean;
|
|
15
|
+
isValid: boolean;
|
|
16
|
+
onReceive: SignatureQRProps['onReceive'];
|
|
17
|
+
}
|
|
18
|
+
export declare const useDeeplinkSignature: ({ roomId, nonce, qrCode, sigMessage, expire, validSeconds, isMobile, isValid, onReceive, }: UseDeeplinkSignatureArgs) => {
|
|
19
|
+
isResuming: boolean;
|
|
20
|
+
};
|
|
21
|
+
export default useDeeplinkSignature;
|
package/dist/hooks/useZigap.d.ts
CHANGED
package/dist/index.d.ts
CHANGED