zigap-utils 3.1.0-preview.1 → 3.1.0-preview.4
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 +10 -0
- package/dist/hooks/useDeeplinkLogin.d.ts +22 -0
- package/dist/hooks/useDeeplinkPayment.d.ts +23 -0
- package/dist/hooks/useDeeplinkResume.d.ts +27 -0
- package/dist/hooks/useDeeplinkRoom.d.ts +18 -0
- package/dist/hooks/useDeeplinkSendTransaction.d.ts +21 -0
- package/dist/hooks/useDeeplinkSignature.d.ts +22 -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 +9498 -9293
- package/dist/utils/deeplinkTransport.d.ts +68 -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 +64 -69
- 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,10 @@
|
|
|
1
|
+
export declare const shouldNavigateToApp: (isValid: boolean, isMobile: boolean, hasNavigated: boolean, resumeFromReload: boolean) => boolean;
|
|
2
|
+
interface UseDeeplinkAppSwitchArgs {
|
|
3
|
+
qrCode: string;
|
|
4
|
+
isMobile: boolean;
|
|
5
|
+
isValid: boolean;
|
|
6
|
+
/** 리로드 복귀면 앱 재전환을 억제한다(무한 바운스 방지). 기본 false. */
|
|
7
|
+
resumeFromReload?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare const useDeeplinkAppSwitch: ({ qrCode, isMobile, isValid, resumeFromReload, }: UseDeeplinkAppSwitchArgs) => void;
|
|
10
|
+
export default useDeeplinkAppSwitch;
|
|
@@ -0,0 +1,22 @@
|
|
|
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
|
+
resumeFromReload: boolean;
|
|
17
|
+
onReceive: LoginQRProps['onReceive'];
|
|
18
|
+
}
|
|
19
|
+
export declare const useDeeplinkLogin: ({ roomId, nonce, qrCode, sigMessage, expire, validSeconds, isMobile, isValid, resumeFromReload, onReceive, }: UseDeeplinkLoginArgs) => {
|
|
20
|
+
isResuming: boolean;
|
|
21
|
+
};
|
|
22
|
+
export default useDeeplinkLogin;
|
|
@@ -0,0 +1,23 @@
|
|
|
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
|
+
resumeFromReload: boolean;
|
|
18
|
+
onReceive: PaymentQRProps['onReceive'];
|
|
19
|
+
}
|
|
20
|
+
export declare const useDeeplinkPayment: ({ roomId, nonce, qrCode, network, address, amount, validSeconds, isMobile, isValid, resumeFromReload, onReceive, }: UseDeeplinkPaymentArgs) => {
|
|
21
|
+
isResuming: boolean;
|
|
22
|
+
};
|
|
23
|
+
export default useDeeplinkPayment;
|
|
@@ -0,0 +1,27 @@
|
|
|
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
|
+
/** 풀 리로드 복귀로 보관 스냅샷을 재사용한 경우. 재등록 없이 마운트 즉시 resume 1회를 발동한다. 기본 false. */
|
|
24
|
+
resumeFromReload?: boolean;
|
|
25
|
+
}
|
|
26
|
+
export declare const useDeeplinkResume: ({ roomId, nonce, type, payload, onResult, onResume, timeoutMs, enabled, resumeFromReload, }: UseDeeplinkResumeArgs) => void;
|
|
27
|
+
export default useDeeplinkResume;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 마운트당 1회 roomId/nonce/qrCode 를 결정하는 훅. 4개 스캔전용 QR 컴포넌트가 공유한다.
|
|
3
|
+
*
|
|
4
|
+
* 모바일 풀 리로드 복귀 시 보관된 pending 스냅샷이 있으면 그 roomId/nonce 를 재사용한다
|
|
5
|
+
* (새로 생성하면 결과가 보관된 "원래 방"을 잃는다). 그 외(첫 진입/데스크톱)에는 generate() 로
|
|
6
|
+
* 새 roomId/qrCode 를 만들고 nonce 를 새로 발급한다.
|
|
7
|
+
*/
|
|
8
|
+
export interface DeeplinkRoom {
|
|
9
|
+
roomId: string;
|
|
10
|
+
nonce: string;
|
|
11
|
+
qrCode: string;
|
|
12
|
+
resumeFromReload: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare const useDeeplinkRoom: (isMobile: boolean, generate: () => {
|
|
15
|
+
qrCode: string;
|
|
16
|
+
roomId: string;
|
|
17
|
+
}) => DeeplinkRoom;
|
|
18
|
+
export default useDeeplinkRoom;
|
|
@@ -0,0 +1,21 @@
|
|
|
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
|
+
resumeFromReload: boolean;
|
|
16
|
+
onReceive: SendTransactionQRProps['onReceive'];
|
|
17
|
+
}
|
|
18
|
+
export declare const useDeeplinkSendTransaction: ({ roomId, nonce, qrCode, transaction, validSeconds, isMobile, isValid, resumeFromReload, onReceive, }: UseDeeplinkSendTransactionArgs) => {
|
|
19
|
+
isResuming: boolean;
|
|
20
|
+
};
|
|
21
|
+
export default useDeeplinkSendTransaction;
|
|
@@ -0,0 +1,22 @@
|
|
|
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
|
+
resumeFromReload: boolean;
|
|
17
|
+
onReceive: SignatureQRProps['onReceive'];
|
|
18
|
+
}
|
|
19
|
+
export declare const useDeeplinkSignature: ({ roomId, nonce, qrCode, sigMessage, expire, validSeconds, isMobile, isValid, resumeFromReload, onReceive, }: UseDeeplinkSignatureArgs) => {
|
|
20
|
+
isResuming: boolean;
|
|
21
|
+
};
|
|
22
|
+
export default useDeeplinkSignature;
|
package/dist/hooks/useZigap.d.ts
CHANGED
package/dist/index.d.ts
CHANGED