zigap-utils 0.0.505 → 0.0.507
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/README.md +18 -14
- package/dist/components/LoginQR/LoginQR.d.ts +1 -1
- package/dist/components/LoginQR/LoginQR.types.d.ts +10 -1
- package/dist/hooks/useZigap.d.ts +1 -0
- package/dist/index.es.js +1686 -1670
- package/dist/utils/login.d.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -28,9 +28,10 @@ const App = () => {
|
|
|
28
28
|
sigMessage="hello world"
|
|
29
29
|
expire={{ type: 'EXTEND', seconds: 3600 }}
|
|
30
30
|
icon="http://sample.icon-url.com"
|
|
31
|
-
onReceive={({
|
|
32
|
-
if(
|
|
31
|
+
onReceive={({ status }) => {
|
|
32
|
+
if(status === 'SUCCESS') {
|
|
33
33
|
// something to do after login (refresh page...)
|
|
34
|
+
// status type: 'REQUEST' | 'ACCOUNT' | 'SUCCESS' | 'ERROR'
|
|
34
35
|
}
|
|
35
36
|
}}
|
|
36
37
|
/>
|
|
@@ -52,22 +53,23 @@ const App = () => {
|
|
|
52
53
|
| `availableNetworks` | string[] | List of connectable networks in dapp |
|
|
53
54
|
| `sigMessage` | string | Messages signed to verify the identity of the user |
|
|
54
55
|
| `validSeconds` | number | QR code valid time(minutes) |
|
|
55
|
-
| `onReceive` | (
|
|
56
|
+
| `onReceive` | (res) => void | Function called after login request |
|
|
56
57
|
| `expire` | {type: "NONE / FIX / EXTEND", seconds: number} | time and type for user login to expire |
|
|
57
58
|
| `icon` | string | Your dapp icon url to be displayed on zigap app |
|
|
59
|
+
| `processingMark` | {type: "DEFAULT" / "CUSTOM" / "NONE", component: React.ReactNode} | How to show the QR image when it's being processed |
|
|
58
60
|
|
|
59
61
|
<br>
|
|
60
62
|
|
|
61
63
|
### `AddressProvideQR` props
|
|
62
64
|
|
|
63
|
-
| prop type | type
|
|
64
|
-
| ------------------- |
|
|
65
|
-
| `dapp` | string
|
|
66
|
-
| `url` | string
|
|
67
|
-
| `availableNetworks` | string[]
|
|
68
|
-
| `validSeconds` | number
|
|
69
|
-
| `onReceive` | (
|
|
70
|
-
| `icon` | string
|
|
65
|
+
| prop type | type | description |
|
|
66
|
+
| ------------------- | ------------- | ----------------------------------------------- |
|
|
67
|
+
| `dapp` | string | Name of the dapp to use |
|
|
68
|
+
| `url` | string | The url of dapp to connect |
|
|
69
|
+
| `availableNetworks` | string[] | List of connectable networks in dapp |
|
|
70
|
+
| `validSeconds` | number | QR code valid time(seconds) |
|
|
71
|
+
| `onReceive` | (res) => void | Function called after login request |
|
|
72
|
+
| `icon` | string | Your dapp icon url to be displayed on zigap app |
|
|
71
73
|
|
|
72
74
|
<br>
|
|
73
75
|
|
|
@@ -94,11 +96,13 @@ import { useZigap } from 'zigap-utils';
|
|
|
94
96
|
...
|
|
95
97
|
|
|
96
98
|
const Component = () => {
|
|
97
|
-
const { userInfo, logout } = useZigap();
|
|
99
|
+
const { userInfo, logout, isWindowLoaded } = useZigap();
|
|
98
100
|
|
|
99
101
|
const handleLogout = () => {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
+
if(isWindowLoaded) {
|
|
103
|
+
logout();
|
|
104
|
+
window.location.reload();
|
|
105
|
+
}
|
|
102
106
|
}
|
|
103
107
|
|
|
104
108
|
return (
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { LoginQRProps } from './LoginQR.types';
|
|
2
2
|
|
|
3
|
-
declare const LoginQR: ({ availableNetworks, dapp, url, sigMessage, onReceive, validSeconds, isShowLogo, logoSize, expire, icon, size, ...props }: LoginQRProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
declare const LoginQR: ({ availableNetworks, dapp, url, sigMessage, onReceive, validSeconds, isShowLogo, logoSize, expire, icon, size, processingMark, ...props }: LoginQRProps) => import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
export default LoginQR;
|
|
@@ -34,6 +34,14 @@ export type LoginResultType = {
|
|
|
34
34
|
issuedDateTime: string;
|
|
35
35
|
expire: LoginExpireType;
|
|
36
36
|
};
|
|
37
|
+
export type ProcessingMarkType = {
|
|
38
|
+
type: 'DEFAULT';
|
|
39
|
+
} | {
|
|
40
|
+
type: 'CUSTOM';
|
|
41
|
+
component: React.ReactNode;
|
|
42
|
+
} | {
|
|
43
|
+
type: 'NONE';
|
|
44
|
+
};
|
|
37
45
|
export type LoginQRProps = {
|
|
38
46
|
availableNetworks: string[];
|
|
39
47
|
dapp: string;
|
|
@@ -41,8 +49,9 @@ export type LoginQRProps = {
|
|
|
41
49
|
sigMessage: string;
|
|
42
50
|
validSeconds: number;
|
|
43
51
|
onReceive?: (res: {
|
|
44
|
-
|
|
52
|
+
status: 'REQUEST' | 'ACCOUNT' | 'SUCCESS' | 'ERROR';
|
|
45
53
|
}) => void;
|
|
46
54
|
expire: LoginExpireType;
|
|
47
55
|
icon?: string;
|
|
56
|
+
processingMark?: ProcessingMarkType;
|
|
48
57
|
} & CommonStyleType;
|