zopassport 0.1.0
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/LICENSE +22 -0
- package/README.md +407 -0
- package/app/.env.example +15 -0
- package/app/README.md +28 -0
- package/app/package.json +24 -0
- package/app/reanimated-mock.js +102 -0
- package/app/reanimated-mock.jsx +97 -0
- package/app/src/App.tsx +331 -0
- package/app/src/components/FounderBadge.tsx +26 -0
- package/app/src/components/OTPInput.tsx +149 -0
- package/app/src/components/PhoneInput.tsx +109 -0
- package/app/src/components/ZoAuth.tsx +320 -0
- package/app/src/components/ZoAvatar.tsx +87 -0
- package/app/src/components/ZoLanding.tsx +231 -0
- package/app/src/components/ZoOnboarding.tsx +524 -0
- package/app/src/components/ZoPassportCard.tsx +183 -0
- package/app/src/components/ZoProgressRing.tsx +57 -0
- package/app/src/components/index.ts +16 -0
- package/app/src/components/wallet/MovingShine.tsx +43 -0
- package/app/src/components/wallet/TransactionItem.tsx +84 -0
- package/app/src/components/wallet/TransactionList.tsx +65 -0
- package/app/src/components/wallet/WalletCard.tsx +152 -0
- package/app/src/components/wallet/WalletScreen.tsx +190 -0
- package/app/src/components/wallet/ZoToken.tsx +69 -0
- package/app/src/components/wallet/index.ts +8 -0
- package/app/src/components/wallet/styles/index.ts +4 -0
- package/app/src/components/wallet/styles/walletStyles.ts +210 -0
- package/app/src/sdk/ZoPassportSDK.ts +277 -0
- package/app/src/sdk/lib/api/auth.ts +223 -0
- package/app/src/sdk/lib/api/avatar.ts +155 -0
- package/app/src/sdk/lib/api/client.ts +135 -0
- package/app/src/sdk/lib/api/index.ts +8 -0
- package/app/src/sdk/lib/api/profile.ts +80 -0
- package/app/src/sdk/lib/api/wallet.ts +59 -0
- package/app/src/sdk/lib/types/auth.ts +78 -0
- package/app/src/sdk/lib/types/avatar.ts +22 -0
- package/app/src/sdk/lib/types/index.ts +8 -0
- package/app/src/sdk/lib/types/profile.ts +18 -0
- package/app/src/sdk/lib/types/wallet.ts +103 -0
- package/app/src/sdk/lib/types.ts +205 -0
- package/app/src/sdk/lib/utils/index.ts +6 -0
- package/app/src/sdk/lib/utils/phone.ts +71 -0
- package/app/src/sdk/lib/utils/storage.ts +116 -0
- package/app/src/sdk/lib/utils/wallet.ts +73 -0
- package/app/src/sdk/types.ts +205 -0
- package/app/src/styles.css +154 -0
- package/app/svg-mock.js +125 -0
- package/app/svg-mock.jsx +120 -0
- package/app/vite.config.ts +70 -0
- package/assets/ASSETS_MANIFEST.md +124 -0
- package/assets/bae.png +0 -0
- package/assets/bro.png +0 -0
- package/assets/cultural-stickers/Business.png +0 -0
- package/assets/cultural-stickers/Default (2).jpg +0 -0
- package/assets/cultural-stickers/Design.png +0 -0
- package/assets/cultural-stickers/FollowYourHeart.png +0 -0
- package/assets/cultural-stickers/Food.png +0 -0
- package/assets/cultural-stickers/Game.png +0 -0
- package/assets/cultural-stickers/Health&Fitness.png +0 -0
- package/assets/cultural-stickers/Home&Lifestyle.png +0 -0
- package/assets/cultural-stickers/Law.png +0 -0
- package/assets/cultural-stickers/Literature&Stories.png +0 -0
- package/assets/cultural-stickers/Music&Entertainment.png +0 -0
- package/assets/cultural-stickers/Nature&Wildlife.png +0 -0
- package/assets/cultural-stickers/Photography.png +0 -0
- package/assets/cultural-stickers/Science&Technology.png +0 -0
- package/assets/cultural-stickers/Spiritual.png +0 -0
- package/assets/cultural-stickers/Sport.png +0 -0
- package/assets/cultural-stickers/Stories&Journal.png +0 -0
- package/assets/cultural-stickers/Television&Cinema.png +0 -0
- package/assets/cultural-stickers/Travel&Adventure.png +0 -0
- package/assets/cultural-stickers/z.jpg (1).jpg +0 -0
- package/assets/figma-assets/landing-zo-logo.png +0 -0
- package/assets/images/rank1.jpeg +0 -0
- package/assets/index.ts +76 -0
- package/assets/lotties/loader.json +1216 -0
- package/assets/lotties/spinner.json +1 -0
- package/assets/videos/loading-screen-background.mp4 +0 -0
- package/assets/videos/opening-disks.mp4 +0 -0
- package/assets/wallet/constants.ts +38 -0
- package/assets/zo-coin.gif +0 -0
- package/assets/zo-fallback.png +0 -0
- package/dist/assets/index.d.mts +136 -0
- package/dist/assets/index.d.ts +136 -0
- package/dist/assets/index.js +133 -0
- package/dist/assets/index.js.map +1 -0
- package/dist/assets/index.mjs +100 -0
- package/dist/assets/index.mjs.map +1 -0
- package/dist/index.d.mts +789 -0
- package/dist/index.d.ts +789 -0
- package/dist/index.js +1118 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +1060 -0
- package/dist/index.mjs.map +1 -0
- package/dist/react-native.d.mts +537 -0
- package/dist/react-native.d.ts +537 -0
- package/dist/react-native.js +1617 -0
- package/dist/react-native.js.map +1 -0
- package/dist/react-native.mjs +1588 -0
- package/dist/react-native.mjs.map +1 -0
- package/dist/react.d.mts +824 -0
- package/dist/react.d.ts +824 -0
- package/dist/react.js +3856 -0
- package/dist/react.js.map +1 -0
- package/dist/react.mjs +3801 -0
- package/dist/react.mjs.map +1 -0
- package/package.json +112 -0
- package/scripts/init.js +196 -0
- package/scripts/postinstall.js +174 -0
- package/scripts/verify-build.js +121 -0
package/dist/react.d.mts
ADDED
|
@@ -0,0 +1,824 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import React, { ReactNode } from 'react';
|
|
3
|
+
import { AxiosInstance } from 'axios';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Storage adapter interface
|
|
7
|
+
* Implement this to provide custom storage (e.g., AsyncStorage for React Native)
|
|
8
|
+
*/
|
|
9
|
+
interface StorageAdapter {
|
|
10
|
+
getItem(key: string): Promise<string | null>;
|
|
11
|
+
setItem(key: string, value: string): Promise<void>;
|
|
12
|
+
removeItem(key: string): Promise<void>;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
interface ZoPassportConfig {
|
|
16
|
+
/** Your ZO client key (required) */
|
|
17
|
+
clientKey: string;
|
|
18
|
+
/** API base URL (default: https://api.io.zo.xyz) */
|
|
19
|
+
baseUrl?: string;
|
|
20
|
+
/** Request timeout in ms (default: 10000) */
|
|
21
|
+
timeout?: number;
|
|
22
|
+
/** Storage adapter for tokens (default: LocalStorageAdapter) */
|
|
23
|
+
storageAdapter?: StorageAdapter;
|
|
24
|
+
}
|
|
25
|
+
declare class ZoApiClient {
|
|
26
|
+
private client;
|
|
27
|
+
private config;
|
|
28
|
+
private storage;
|
|
29
|
+
constructor(config: ZoPassportConfig);
|
|
30
|
+
private setupInterceptors;
|
|
31
|
+
private getOrCreateDeviceCredentials;
|
|
32
|
+
get axiosInstance(): AxiosInstance;
|
|
33
|
+
getStorage(): StorageAdapter;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
interface ZoWallet$1 {
|
|
37
|
+
address: string;
|
|
38
|
+
network: 'base' | 'avalanche';
|
|
39
|
+
balance?: number;
|
|
40
|
+
}
|
|
41
|
+
interface ZoTokenBalanceResponse {
|
|
42
|
+
balance: number;
|
|
43
|
+
currency: {
|
|
44
|
+
name: string;
|
|
45
|
+
symbol: string;
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
interface WalletBalance {
|
|
49
|
+
total_amount: number;
|
|
50
|
+
currency: string;
|
|
51
|
+
}
|
|
52
|
+
interface Transaction {
|
|
53
|
+
id: string;
|
|
54
|
+
created_at: string;
|
|
55
|
+
updated_at: string;
|
|
56
|
+
amount: number;
|
|
57
|
+
description: string;
|
|
58
|
+
claimed_at: string;
|
|
59
|
+
grant: {
|
|
60
|
+
id: string;
|
|
61
|
+
name: string;
|
|
62
|
+
description: string;
|
|
63
|
+
};
|
|
64
|
+
action: 'deposit' | 'spend';
|
|
65
|
+
}
|
|
66
|
+
interface WalletUser {
|
|
67
|
+
avatar?: {
|
|
68
|
+
image: string;
|
|
69
|
+
};
|
|
70
|
+
first_name: string;
|
|
71
|
+
nickname?: string;
|
|
72
|
+
wallet_address: string;
|
|
73
|
+
}
|
|
74
|
+
interface BalanceResponse {
|
|
75
|
+
data: {
|
|
76
|
+
total_amount: number;
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
interface TransactionsResponse {
|
|
80
|
+
data: {
|
|
81
|
+
results: Transaction[];
|
|
82
|
+
next?: string;
|
|
83
|
+
previous?: string;
|
|
84
|
+
count: number;
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
interface FormattedTransaction {
|
|
88
|
+
id: string;
|
|
89
|
+
description: string;
|
|
90
|
+
amount: string;
|
|
91
|
+
date: string;
|
|
92
|
+
timestamp: string;
|
|
93
|
+
action: 'deposit' | 'spend';
|
|
94
|
+
color: string;
|
|
95
|
+
}
|
|
96
|
+
interface WalletCardProps {
|
|
97
|
+
balance: number;
|
|
98
|
+
user: WalletUser;
|
|
99
|
+
isOpen?: boolean;
|
|
100
|
+
onToggle?: () => void;
|
|
101
|
+
isLoading?: boolean;
|
|
102
|
+
}
|
|
103
|
+
interface TransactionItemProps {
|
|
104
|
+
transaction: Transaction;
|
|
105
|
+
showDate?: boolean;
|
|
106
|
+
}
|
|
107
|
+
interface TransactionListProps {
|
|
108
|
+
transactions: Transaction[];
|
|
109
|
+
isLoading?: boolean;
|
|
110
|
+
onEndReached?: () => void;
|
|
111
|
+
}
|
|
112
|
+
interface MovingShineProps {
|
|
113
|
+
duration?: number;
|
|
114
|
+
}
|
|
115
|
+
interface WalletScreenProps {
|
|
116
|
+
/** User data for the wallet */
|
|
117
|
+
user: WalletUser;
|
|
118
|
+
/** Current balance */
|
|
119
|
+
balance: number;
|
|
120
|
+
/** Transaction history */
|
|
121
|
+
transactions: Transaction[];
|
|
122
|
+
/** Loading state */
|
|
123
|
+
isLoading?: boolean;
|
|
124
|
+
/** Callback when back button is pressed */
|
|
125
|
+
onBack?: () => void;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
interface ZoUser {
|
|
129
|
+
id: string;
|
|
130
|
+
first_name?: string;
|
|
131
|
+
last_name?: string;
|
|
132
|
+
bio?: string;
|
|
133
|
+
date_of_birth?: string;
|
|
134
|
+
place_name?: string;
|
|
135
|
+
body_type?: 'bro' | 'bae';
|
|
136
|
+
pfp_image?: string;
|
|
137
|
+
email_address?: string;
|
|
138
|
+
mobile_country_code?: string;
|
|
139
|
+
mobile_number?: string;
|
|
140
|
+
wallet_address?: string;
|
|
141
|
+
membership?: 'citizen' | 'founder';
|
|
142
|
+
cultures?: string[];
|
|
143
|
+
avatar?: {
|
|
144
|
+
status: 'pending' | 'processing' | 'completed' | 'failed';
|
|
145
|
+
image?: string;
|
|
146
|
+
};
|
|
147
|
+
role?: string;
|
|
148
|
+
created_at?: string;
|
|
149
|
+
updated_at?: string;
|
|
150
|
+
}
|
|
151
|
+
interface ZoProfileResponse {
|
|
152
|
+
id: string;
|
|
153
|
+
first_name?: string;
|
|
154
|
+
last_name?: string;
|
|
155
|
+
bio?: string;
|
|
156
|
+
date_of_birth?: string;
|
|
157
|
+
location?: {
|
|
158
|
+
place_name?: string;
|
|
159
|
+
latitude?: number;
|
|
160
|
+
longitude?: number;
|
|
161
|
+
};
|
|
162
|
+
body_type?: 'bro' | 'bae';
|
|
163
|
+
pfp_image?: string;
|
|
164
|
+
email_address?: string;
|
|
165
|
+
mobile_country_code?: string;
|
|
166
|
+
mobile_number?: string;
|
|
167
|
+
wallet_address?: string;
|
|
168
|
+
zo_membership?: string;
|
|
169
|
+
cultures?: string[];
|
|
170
|
+
avatar?: {
|
|
171
|
+
status: 'pending' | 'processing' | 'completed' | 'failed';
|
|
172
|
+
image?: string;
|
|
173
|
+
};
|
|
174
|
+
founder_nfts?: any[];
|
|
175
|
+
founder_nfts_count?: number;
|
|
176
|
+
role?: string;
|
|
177
|
+
}
|
|
178
|
+
interface ZoProfileUpdatePayload {
|
|
179
|
+
first_name?: string;
|
|
180
|
+
last_name?: string;
|
|
181
|
+
bio?: string;
|
|
182
|
+
date_of_birth?: string;
|
|
183
|
+
place_name?: string;
|
|
184
|
+
body_type?: 'bro' | 'bae';
|
|
185
|
+
pfp_image?: string;
|
|
186
|
+
cultures?: string[];
|
|
187
|
+
}
|
|
188
|
+
interface ZoAuthOTPRequest {
|
|
189
|
+
mobile_country_code: string;
|
|
190
|
+
mobile_number: string;
|
|
191
|
+
message_channel: string;
|
|
192
|
+
}
|
|
193
|
+
interface ZoAuthOTPVerifyRequest {
|
|
194
|
+
mobile_country_code: string;
|
|
195
|
+
mobile_number: string;
|
|
196
|
+
otp: string;
|
|
197
|
+
}
|
|
198
|
+
interface ZoAuthResponse {
|
|
199
|
+
user: ZoUser;
|
|
200
|
+
access_token: string;
|
|
201
|
+
refresh_token: string;
|
|
202
|
+
access_token_expiry: string;
|
|
203
|
+
refresh_token_expiry: string;
|
|
204
|
+
device_id?: string;
|
|
205
|
+
device_secret?: string;
|
|
206
|
+
}
|
|
207
|
+
interface ZoTokenRefreshResponse {
|
|
208
|
+
access: string;
|
|
209
|
+
refresh: string;
|
|
210
|
+
access_expiry: string;
|
|
211
|
+
refresh_expiry: string;
|
|
212
|
+
}
|
|
213
|
+
interface ZoAvatarGenerateRequest {
|
|
214
|
+
body_type: 'bro' | 'bae';
|
|
215
|
+
}
|
|
216
|
+
interface ZoAvatarGenerateResponse {
|
|
217
|
+
task_id: string;
|
|
218
|
+
status: 'pending' | 'processing' | 'completed' | 'failed';
|
|
219
|
+
}
|
|
220
|
+
interface ZoAvatarStatusResponse {
|
|
221
|
+
task_id: string;
|
|
222
|
+
status: 'pending' | 'processing' | 'completed' | 'failed';
|
|
223
|
+
result?: {
|
|
224
|
+
avatar_url?: string;
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
interface ZoErrorResponse {
|
|
228
|
+
success?: boolean;
|
|
229
|
+
error?: string;
|
|
230
|
+
message?: string;
|
|
231
|
+
detail?: string;
|
|
232
|
+
errors?: string[];
|
|
233
|
+
}
|
|
234
|
+
interface ZoPassportProfile {
|
|
235
|
+
avatar?: string;
|
|
236
|
+
name?: string;
|
|
237
|
+
isFounder?: boolean;
|
|
238
|
+
}
|
|
239
|
+
interface ZoPassportCompletion {
|
|
240
|
+
done: number;
|
|
241
|
+
total: number;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
declare class ZoAuth$1 {
|
|
245
|
+
private client;
|
|
246
|
+
constructor(client: ZoApiClient);
|
|
247
|
+
/**
|
|
248
|
+
* Send OTP to phone number
|
|
249
|
+
* Step 1 of ZO phone authentication
|
|
250
|
+
*/
|
|
251
|
+
sendOTP(countryCode: string, phoneNumber: string): Promise<{
|
|
252
|
+
success: boolean;
|
|
253
|
+
message: string;
|
|
254
|
+
}>;
|
|
255
|
+
/**
|
|
256
|
+
* Verify OTP and authenticate user
|
|
257
|
+
* Step 2 of ZO phone authentication
|
|
258
|
+
* Returns full auth response with tokens and user profile
|
|
259
|
+
*/
|
|
260
|
+
verifyOTP(countryCode: string, phoneNumber: string, otp: string): Promise<{
|
|
261
|
+
success: boolean;
|
|
262
|
+
data?: ZoAuthResponse;
|
|
263
|
+
error?: string;
|
|
264
|
+
}>;
|
|
265
|
+
/**
|
|
266
|
+
* Refresh access token using refresh token
|
|
267
|
+
*/
|
|
268
|
+
refreshAccessToken(refreshToken: string): Promise<{
|
|
269
|
+
success: boolean;
|
|
270
|
+
tokens?: {
|
|
271
|
+
access: string;
|
|
272
|
+
refresh: string;
|
|
273
|
+
access_expiry: string;
|
|
274
|
+
refresh_expiry: string;
|
|
275
|
+
};
|
|
276
|
+
error?: string;
|
|
277
|
+
}>;
|
|
278
|
+
/**
|
|
279
|
+
* Check if user is authenticated
|
|
280
|
+
*/
|
|
281
|
+
checkLoginStatus(accessToken: string): Promise<{
|
|
282
|
+
success: boolean;
|
|
283
|
+
isAuthenticated: boolean;
|
|
284
|
+
}>;
|
|
285
|
+
/**
|
|
286
|
+
* Extract error message from various ZO API error formats
|
|
287
|
+
*/
|
|
288
|
+
private extractErrorMessage;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
declare class ZoProfile {
|
|
292
|
+
private client;
|
|
293
|
+
constructor(client: ZoApiClient);
|
|
294
|
+
/**
|
|
295
|
+
* Get user profile
|
|
296
|
+
*/
|
|
297
|
+
getProfile(accessToken: string): Promise<{
|
|
298
|
+
success: boolean;
|
|
299
|
+
profile?: ZoProfileResponse;
|
|
300
|
+
error?: string;
|
|
301
|
+
}>;
|
|
302
|
+
/**
|
|
303
|
+
* Update user profile (partial updates supported)
|
|
304
|
+
*/
|
|
305
|
+
updateProfile(accessToken: string, updates: ZoProfileUpdatePayload): Promise<{
|
|
306
|
+
success: boolean;
|
|
307
|
+
profile?: ZoProfileResponse;
|
|
308
|
+
error?: string;
|
|
309
|
+
}>;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
declare class ZoAvatar$1 {
|
|
313
|
+
private client;
|
|
314
|
+
constructor(client: ZoApiClient);
|
|
315
|
+
/**
|
|
316
|
+
* Generate avatar for user
|
|
317
|
+
*/
|
|
318
|
+
generateAvatar(accessToken: string, bodyType: 'bro' | 'bae'): Promise<{
|
|
319
|
+
success: boolean;
|
|
320
|
+
task_id?: string;
|
|
321
|
+
status?: string;
|
|
322
|
+
error?: string;
|
|
323
|
+
}>;
|
|
324
|
+
/**
|
|
325
|
+
* Check avatar generation status
|
|
326
|
+
*/
|
|
327
|
+
getAvatarStatus(accessToken: string, taskId: string): Promise<{
|
|
328
|
+
success: boolean;
|
|
329
|
+
status?: 'pending' | 'processing' | 'completed' | 'failed';
|
|
330
|
+
avatarUrl?: string;
|
|
331
|
+
error?: string;
|
|
332
|
+
}>;
|
|
333
|
+
/**
|
|
334
|
+
* Poll avatar status until completion
|
|
335
|
+
*/
|
|
336
|
+
pollAvatarStatus(accessToken: string, taskId: string, options?: {
|
|
337
|
+
onProgress?: (status: string) => void;
|
|
338
|
+
onComplete?: (avatarUrl: string) => void;
|
|
339
|
+
onError?: (error: string) => void;
|
|
340
|
+
maxAttempts?: number;
|
|
341
|
+
interval?: number;
|
|
342
|
+
}): Promise<void>;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
declare class ZoWallet {
|
|
346
|
+
private client;
|
|
347
|
+
private cachedBalance;
|
|
348
|
+
private userWalletAddress;
|
|
349
|
+
private network;
|
|
350
|
+
constructor(client: ZoApiClient);
|
|
351
|
+
/**
|
|
352
|
+
* Set the user's wallet address for on-chain queries
|
|
353
|
+
*/
|
|
354
|
+
setWalletAddress(address: string, network?: 'base' | 'avalanche'): void;
|
|
355
|
+
/**
|
|
356
|
+
* Get wallet balance - tries on-chain first, then API fallback
|
|
357
|
+
* @returns Wallet balance amount
|
|
358
|
+
*/
|
|
359
|
+
getBalance(): Promise<number>;
|
|
360
|
+
/**
|
|
361
|
+
* Fetch balance directly from blockchain via JSON-RPC
|
|
362
|
+
*/
|
|
363
|
+
private getOnChainBalance;
|
|
364
|
+
/**
|
|
365
|
+
* Fetch balance from Zo API endpoints (tries multiple endpoints with fallback)
|
|
366
|
+
*/
|
|
367
|
+
private getBalanceFromAPI;
|
|
368
|
+
/**
|
|
369
|
+
* Get transaction history
|
|
370
|
+
* @param page - Optional page number for pagination
|
|
371
|
+
* @returns Array of transactions
|
|
372
|
+
*/
|
|
373
|
+
getTransactions(page?: number): Promise<{
|
|
374
|
+
transactions: Transaction[];
|
|
375
|
+
next?: string;
|
|
376
|
+
previous?: string;
|
|
377
|
+
count: number;
|
|
378
|
+
}>;
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
interface ZoPassportSDKConfig extends ZoPassportConfig {
|
|
382
|
+
/** Optional: Provide a custom storage adapter (default: LocalStorageAdapter) */
|
|
383
|
+
storageAdapter?: StorageAdapter;
|
|
384
|
+
/** Optional: Enable auto token refresh (default: true) */
|
|
385
|
+
autoRefresh?: boolean;
|
|
386
|
+
/** Optional: Token refresh interval in ms (default: 60000 = 1 minute) */
|
|
387
|
+
refreshInterval?: number;
|
|
388
|
+
/** Optional: Enable debug logging (default: false) */
|
|
389
|
+
debug?: boolean;
|
|
390
|
+
}
|
|
391
|
+
declare class ZoPassportSDK {
|
|
392
|
+
private client;
|
|
393
|
+
private storage;
|
|
394
|
+
private refreshTimer;
|
|
395
|
+
private _readyPromise;
|
|
396
|
+
auth: ZoAuth$1;
|
|
397
|
+
profile: ZoProfile;
|
|
398
|
+
avatar: ZoAvatar$1;
|
|
399
|
+
wallet: ZoWallet;
|
|
400
|
+
private _user;
|
|
401
|
+
private _isAuthenticated;
|
|
402
|
+
constructor(config: ZoPassportSDKConfig);
|
|
403
|
+
/**
|
|
404
|
+
* Wait for the SDK to be ready (session loaded from storage)
|
|
405
|
+
* Use this if you need to check isAuthenticated immediately after construction
|
|
406
|
+
*/
|
|
407
|
+
ready(): Promise<void>;
|
|
408
|
+
private loadSession;
|
|
409
|
+
private saveSession;
|
|
410
|
+
clearSession(): Promise<void>;
|
|
411
|
+
private startAutoRefresh;
|
|
412
|
+
private stopAutoRefresh;
|
|
413
|
+
private refreshTokenIfNeeded;
|
|
414
|
+
get user(): ZoUser | null;
|
|
415
|
+
get isAuthenticated(): boolean;
|
|
416
|
+
/**
|
|
417
|
+
* Complete phone authentication flow
|
|
418
|
+
*/
|
|
419
|
+
loginWithPhone(countryCode: string, phoneNumber: string, otp: string): Promise<{
|
|
420
|
+
success: boolean;
|
|
421
|
+
user?: ZoUser;
|
|
422
|
+
error?: string;
|
|
423
|
+
}>;
|
|
424
|
+
/**
|
|
425
|
+
* Logout and clear session
|
|
426
|
+
*/
|
|
427
|
+
logout(): Promise<void>;
|
|
428
|
+
/**
|
|
429
|
+
* Get current user profile
|
|
430
|
+
*/
|
|
431
|
+
getProfile(): Promise<ZoUser | null>;
|
|
432
|
+
/**
|
|
433
|
+
* Update user profile
|
|
434
|
+
*/
|
|
435
|
+
updateProfile(updates: {
|
|
436
|
+
first_name?: string;
|
|
437
|
+
last_name?: string;
|
|
438
|
+
bio?: string;
|
|
439
|
+
date_of_birth?: string;
|
|
440
|
+
place_name?: string;
|
|
441
|
+
body_type?: 'bro' | 'bae';
|
|
442
|
+
}): Promise<{
|
|
443
|
+
success: boolean;
|
|
444
|
+
profile?: ZoUser;
|
|
445
|
+
error?: string;
|
|
446
|
+
}>;
|
|
447
|
+
/**
|
|
448
|
+
* Generate avatar
|
|
449
|
+
*/
|
|
450
|
+
generateAvatar(bodyType: 'bro' | 'bae'): Promise<{
|
|
451
|
+
success: boolean;
|
|
452
|
+
avatarUrl?: string;
|
|
453
|
+
error?: string;
|
|
454
|
+
}>;
|
|
455
|
+
/**
|
|
456
|
+
* Get wallet balance
|
|
457
|
+
*/
|
|
458
|
+
getWalletBalance(): Promise<number>;
|
|
459
|
+
/**
|
|
460
|
+
* Get wallet transactions
|
|
461
|
+
*/
|
|
462
|
+
getWalletTransactions(page?: number): Promise<{
|
|
463
|
+
transactions: Transaction[];
|
|
464
|
+
next?: string;
|
|
465
|
+
previous?: string;
|
|
466
|
+
count: number;
|
|
467
|
+
}>;
|
|
468
|
+
/**
|
|
469
|
+
* Cleanup
|
|
470
|
+
*/
|
|
471
|
+
destroy(): void;
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
interface ZoPassportCardProps {
|
|
475
|
+
/** User profile data */
|
|
476
|
+
profile: {
|
|
477
|
+
avatar?: string;
|
|
478
|
+
name?: string;
|
|
479
|
+
isFounder?: boolean;
|
|
480
|
+
};
|
|
481
|
+
/** Profile completion */
|
|
482
|
+
completion: {
|
|
483
|
+
done: number;
|
|
484
|
+
total: number;
|
|
485
|
+
};
|
|
486
|
+
/** Additional CSS class */
|
|
487
|
+
className?: string;
|
|
488
|
+
/** Optional: Override founder background URL */
|
|
489
|
+
founderBgUrl?: string;
|
|
490
|
+
/** Optional: Override citizen background URL */
|
|
491
|
+
citizenBgUrl?: string;
|
|
492
|
+
/** Optional: Default avatar fallback URL */
|
|
493
|
+
defaultAvatarUrl?: string;
|
|
494
|
+
}
|
|
495
|
+
declare const ZoPassportCard: React.FC<ZoPassportCardProps>;
|
|
496
|
+
|
|
497
|
+
interface ZoPassportPageProps {
|
|
498
|
+
user: ZoUser | null;
|
|
499
|
+
balance?: number;
|
|
500
|
+
completion?: {
|
|
501
|
+
done: number;
|
|
502
|
+
total: number;
|
|
503
|
+
};
|
|
504
|
+
walletOpen?: boolean;
|
|
505
|
+
onWalletToggle?: () => void;
|
|
506
|
+
onRemoveCulture?: (cultureKey: string) => void;
|
|
507
|
+
}
|
|
508
|
+
declare const ZoPassportPage: React.FC<ZoPassportPageProps>;
|
|
509
|
+
|
|
510
|
+
interface ZoProgressRingProps {
|
|
511
|
+
/** Progress percentage (0-100) */
|
|
512
|
+
progress: number;
|
|
513
|
+
/** Size in pixels (default: 140) */
|
|
514
|
+
size?: number;
|
|
515
|
+
/** Stroke width in pixels (default: 4) */
|
|
516
|
+
strokeWidth?: number;
|
|
517
|
+
/** Primary stroke color (default: #FFFFFF) */
|
|
518
|
+
primaryColor?: string;
|
|
519
|
+
/** Secondary/background stroke color (default: rgba(255,255,255,0.2)) */
|
|
520
|
+
secondaryColor?: string;
|
|
521
|
+
}
|
|
522
|
+
declare const ZoProgressRing: React.FC<ZoProgressRingProps>;
|
|
523
|
+
|
|
524
|
+
interface ZoAvatarProps {
|
|
525
|
+
/** Avatar image URL */
|
|
526
|
+
src?: string;
|
|
527
|
+
/** User name (for alt text and fallback) */
|
|
528
|
+
name?: string;
|
|
529
|
+
/** Size in pixels (default: 120) */
|
|
530
|
+
size?: number;
|
|
531
|
+
/** Fallback image URL */
|
|
532
|
+
fallbackUrl?: string;
|
|
533
|
+
/** Additional CSS class */
|
|
534
|
+
className?: string;
|
|
535
|
+
}
|
|
536
|
+
declare const ZoAvatar: React.FC<ZoAvatarProps>;
|
|
537
|
+
|
|
538
|
+
interface PhoneInputProps {
|
|
539
|
+
/** Current phone number value */
|
|
540
|
+
value: string;
|
|
541
|
+
/** Current country code (without +) */
|
|
542
|
+
countryCode: string;
|
|
543
|
+
/** Callback when phone number changes */
|
|
544
|
+
onChange: (phone: string) => void;
|
|
545
|
+
/** Callback when country code changes */
|
|
546
|
+
onCountryChange: (code: string) => void;
|
|
547
|
+
/** Placeholder text */
|
|
548
|
+
placeholder?: string;
|
|
549
|
+
/** Disabled state */
|
|
550
|
+
disabled?: boolean;
|
|
551
|
+
/** Error message */
|
|
552
|
+
error?: string;
|
|
553
|
+
/** Additional CSS class */
|
|
554
|
+
className?: string;
|
|
555
|
+
}
|
|
556
|
+
declare const PhoneInput: React.FC<PhoneInputProps>;
|
|
557
|
+
|
|
558
|
+
interface OTPInputProps {
|
|
559
|
+
/** Current OTP value array */
|
|
560
|
+
value: string[];
|
|
561
|
+
/** Callback when OTP changes */
|
|
562
|
+
onChange: (otp: string[]) => void;
|
|
563
|
+
/** Callback when all 6 digits entered */
|
|
564
|
+
onComplete?: (otp: string) => void;
|
|
565
|
+
/** Number of digits (default: 6) */
|
|
566
|
+
length?: number;
|
|
567
|
+
/** Disabled state */
|
|
568
|
+
disabled?: boolean;
|
|
569
|
+
/** Error message */
|
|
570
|
+
error?: string;
|
|
571
|
+
/** Auto-focus first input */
|
|
572
|
+
autoFocus?: boolean;
|
|
573
|
+
/** Additional CSS class */
|
|
574
|
+
className?: string;
|
|
575
|
+
}
|
|
576
|
+
declare const OTPInput: React.FC<OTPInputProps>;
|
|
577
|
+
|
|
578
|
+
interface ZoAuthProps {
|
|
579
|
+
/** Callback when auth is successful */
|
|
580
|
+
onSuccess: (userId: string, user: any) => void;
|
|
581
|
+
/** Callback to close modal */
|
|
582
|
+
onClose?: () => void;
|
|
583
|
+
/** Send OTP function (from SDK) */
|
|
584
|
+
sendOTP: (countryCode: string, phoneNumber: string) => Promise<{
|
|
585
|
+
success: boolean;
|
|
586
|
+
message: string;
|
|
587
|
+
}>;
|
|
588
|
+
/** Verify OTP function (from SDK) */
|
|
589
|
+
verifyOTP: (countryCode: string, phoneNumber: string, otp: string) => Promise<{
|
|
590
|
+
success: boolean;
|
|
591
|
+
user?: ZoUser;
|
|
592
|
+
error?: string;
|
|
593
|
+
}>;
|
|
594
|
+
/** Default country code (default: '91') */
|
|
595
|
+
defaultCountryCode?: string;
|
|
596
|
+
/** Show close button */
|
|
597
|
+
showCloseButton?: boolean;
|
|
598
|
+
/** Additional CSS class */
|
|
599
|
+
className?: string;
|
|
600
|
+
}
|
|
601
|
+
declare const ZoAuth: React.FC<ZoAuthProps>;
|
|
602
|
+
|
|
603
|
+
interface ZoLandingProps {
|
|
604
|
+
/** Callback when user successfully authenticates */
|
|
605
|
+
onAuthSuccess: (userId: string, user: any) => void;
|
|
606
|
+
/** Send OTP function (from SDK) */
|
|
607
|
+
sendOTP: (countryCode: string, phoneNumber: string) => Promise<{
|
|
608
|
+
success: boolean;
|
|
609
|
+
message: string;
|
|
610
|
+
}>;
|
|
611
|
+
/** Verify OTP function (from SDK) */
|
|
612
|
+
verifyOTP: (countryCode: string, phoneNumber: string, otp: string) => Promise<{
|
|
613
|
+
success: boolean;
|
|
614
|
+
error?: string;
|
|
615
|
+
}>;
|
|
616
|
+
/** Video background URL */
|
|
617
|
+
videoUrl?: string;
|
|
618
|
+
/** Zo logo URL */
|
|
619
|
+
logoUrl?: string;
|
|
620
|
+
/** Title text */
|
|
621
|
+
title?: string;
|
|
622
|
+
/** Subtitle lines */
|
|
623
|
+
subtitles?: string[];
|
|
624
|
+
/** Button text */
|
|
625
|
+
buttonText?: string;
|
|
626
|
+
/** Additional CSS class */
|
|
627
|
+
className?: string;
|
|
628
|
+
}
|
|
629
|
+
declare const ZoLanding: React.FC<ZoLandingProps>;
|
|
630
|
+
|
|
631
|
+
interface ZoOnboardingProps {
|
|
632
|
+
/** Callback when onboarding is complete */
|
|
633
|
+
onComplete: (userData: OnboardingData) => void;
|
|
634
|
+
/** Update profile function (from SDK) */
|
|
635
|
+
updateProfile: (updates: {
|
|
636
|
+
first_name?: string;
|
|
637
|
+
body_type?: 'bro' | 'bae';
|
|
638
|
+
place_name?: string;
|
|
639
|
+
}) => Promise<{
|
|
640
|
+
success: boolean;
|
|
641
|
+
error?: string;
|
|
642
|
+
}>;
|
|
643
|
+
/** Get profile function (from SDK) to poll for avatar */
|
|
644
|
+
getProfile: () => Promise<any>;
|
|
645
|
+
/** Video background URL */
|
|
646
|
+
videoUrl?: string;
|
|
647
|
+
/** Zo logo URL */
|
|
648
|
+
logoUrl?: string;
|
|
649
|
+
/** Bro avatar preview URL */
|
|
650
|
+
broAvatarUrl?: string;
|
|
651
|
+
/** Bae avatar preview URL */
|
|
652
|
+
baeAvatarUrl?: string;
|
|
653
|
+
/** Additional CSS class */
|
|
654
|
+
className?: string;
|
|
655
|
+
}
|
|
656
|
+
interface OnboardingData {
|
|
657
|
+
nickname: string;
|
|
658
|
+
bodyType: 'bro' | 'bae';
|
|
659
|
+
city: string;
|
|
660
|
+
avatarUrl: string | null;
|
|
661
|
+
}
|
|
662
|
+
declare const ZoOnboarding: React.FC<ZoOnboardingProps>;
|
|
663
|
+
|
|
664
|
+
interface FounderBadgeProps {
|
|
665
|
+
/** Size in pixels (default: 32) */
|
|
666
|
+
size?: number;
|
|
667
|
+
}
|
|
668
|
+
declare const FounderBadge: React.FC<FounderBadgeProps>;
|
|
669
|
+
|
|
670
|
+
declare const WalletCardWeb: React.FC<WalletCardProps>;
|
|
671
|
+
|
|
672
|
+
interface WalletFullPageProps {
|
|
673
|
+
user: ZoUser | null;
|
|
674
|
+
balance: number;
|
|
675
|
+
onClose: () => void;
|
|
676
|
+
zoCoinUrl?: string;
|
|
677
|
+
isLoading?: boolean;
|
|
678
|
+
onRefresh?: () => void;
|
|
679
|
+
}
|
|
680
|
+
declare const WalletFullPage: React.FC<WalletFullPageProps>;
|
|
681
|
+
|
|
682
|
+
declare function useAuth(): {
|
|
683
|
+
user: ZoUser | null;
|
|
684
|
+
isAuthenticated: boolean;
|
|
685
|
+
isLoading: boolean;
|
|
686
|
+
otpSent: boolean;
|
|
687
|
+
phoneNumber: string;
|
|
688
|
+
countryCode: string;
|
|
689
|
+
sendOTP: (code: string, phone: string) => Promise<{
|
|
690
|
+
success: boolean;
|
|
691
|
+
message: string;
|
|
692
|
+
}>;
|
|
693
|
+
verifyOTP: (otp: string) => Promise<{
|
|
694
|
+
success: boolean;
|
|
695
|
+
error?: string;
|
|
696
|
+
}>;
|
|
697
|
+
logout: () => Promise<void>;
|
|
698
|
+
};
|
|
699
|
+
|
|
700
|
+
declare function useProfile(): {
|
|
701
|
+
user: ZoUser | null;
|
|
702
|
+
isAuthenticated: boolean;
|
|
703
|
+
isLoading: boolean;
|
|
704
|
+
error: string | null;
|
|
705
|
+
completion: {
|
|
706
|
+
done: number;
|
|
707
|
+
total: number;
|
|
708
|
+
percentage: number;
|
|
709
|
+
};
|
|
710
|
+
isFounder: boolean;
|
|
711
|
+
updateProfile: (updates: ZoProfileUpdatePayload) => Promise<{
|
|
712
|
+
success: boolean;
|
|
713
|
+
profile?: ZoUser;
|
|
714
|
+
error?: string;
|
|
715
|
+
}>;
|
|
716
|
+
reload: () => Promise<void>;
|
|
717
|
+
};
|
|
718
|
+
|
|
719
|
+
declare function useAvatar(): {
|
|
720
|
+
avatarUrl: string | undefined;
|
|
721
|
+
avatarStatus: "pending" | "processing" | "completed" | "failed";
|
|
722
|
+
isGenerating: boolean;
|
|
723
|
+
progress: string | null;
|
|
724
|
+
error: string | null;
|
|
725
|
+
generateAvatar: (bodyType: "bro" | "bae") => Promise<{
|
|
726
|
+
success: boolean;
|
|
727
|
+
avatarUrl?: string;
|
|
728
|
+
error?: string;
|
|
729
|
+
}>;
|
|
730
|
+
};
|
|
731
|
+
|
|
732
|
+
interface ApiClient$2 {
|
|
733
|
+
get: AxiosInstance['get'];
|
|
734
|
+
}
|
|
735
|
+
interface UseWalletOptions {
|
|
736
|
+
autoRefetch?: boolean;
|
|
737
|
+
refetchInterval?: number;
|
|
738
|
+
}
|
|
739
|
+
/**
|
|
740
|
+
* Combined hook for wallet functionality
|
|
741
|
+
* Fetches both balance and transactions
|
|
742
|
+
*
|
|
743
|
+
* @param apiClient - Axios instance or compatible client with .get() method
|
|
744
|
+
* @param options - Configuration options
|
|
745
|
+
*/
|
|
746
|
+
declare const useWallet: (apiClient?: ApiClient$2 | null, options?: UseWalletOptions) => {
|
|
747
|
+
balance: number;
|
|
748
|
+
transactions: Transaction[];
|
|
749
|
+
isLoading: boolean;
|
|
750
|
+
error: Error | null;
|
|
751
|
+
refetch: () => Promise<void>;
|
|
752
|
+
loadMore: () => Promise<void>;
|
|
753
|
+
};
|
|
754
|
+
|
|
755
|
+
interface ApiClient$1 {
|
|
756
|
+
get: AxiosInstance['get'];
|
|
757
|
+
}
|
|
758
|
+
interface UseWalletBalanceOptions {
|
|
759
|
+
autoRefetch?: boolean;
|
|
760
|
+
refetchInterval?: number;
|
|
761
|
+
}
|
|
762
|
+
/**
|
|
763
|
+
* Hook to fetch wallet balance
|
|
764
|
+
* Uses API: GET /api/v1/web3/token/airdrops/summary
|
|
765
|
+
*
|
|
766
|
+
* @param apiClient - Axios instance or compatible client with .get() method
|
|
767
|
+
* @param options - Configuration options
|
|
768
|
+
*/
|
|
769
|
+
declare const useWalletBalance: (apiClient?: ApiClient$1 | null, options?: UseWalletBalanceOptions) => {
|
|
770
|
+
balance: number;
|
|
771
|
+
isLoading: boolean;
|
|
772
|
+
error: Error | null;
|
|
773
|
+
refetch: () => Promise<void>;
|
|
774
|
+
};
|
|
775
|
+
|
|
776
|
+
interface ApiClient {
|
|
777
|
+
get: AxiosInstance['get'];
|
|
778
|
+
}
|
|
779
|
+
interface UseTransactionsOptions {
|
|
780
|
+
limit?: number;
|
|
781
|
+
autoRefetch?: boolean;
|
|
782
|
+
}
|
|
783
|
+
/**
|
|
784
|
+
* Hook to fetch transaction history
|
|
785
|
+
* Uses API: GET /api/v1/profile/completion-grants/claims
|
|
786
|
+
*
|
|
787
|
+
* @param apiClient - Axios instance or compatible client with .get() method
|
|
788
|
+
* @param options - Configuration options
|
|
789
|
+
*/
|
|
790
|
+
declare const useTransactions: (apiClient?: ApiClient | null, options?: UseTransactionsOptions) => {
|
|
791
|
+
transactions: Transaction[];
|
|
792
|
+
isLoading: boolean;
|
|
793
|
+
error: Error | null;
|
|
794
|
+
hasMore: boolean;
|
|
795
|
+
refetch: () => Promise<void>;
|
|
796
|
+
loadMore: () => Promise<void>;
|
|
797
|
+
};
|
|
798
|
+
|
|
799
|
+
interface ZoPassportContextValue {
|
|
800
|
+
sdk: ZoPassportSDK | null;
|
|
801
|
+
user: ZoUser | null;
|
|
802
|
+
isAuthenticated: boolean;
|
|
803
|
+
isLoading: boolean;
|
|
804
|
+
sendOTP: (countryCode: string, phoneNumber: string) => Promise<{
|
|
805
|
+
success: boolean;
|
|
806
|
+
message: string;
|
|
807
|
+
}>;
|
|
808
|
+
verifyOTP: (countryCode: string, phoneNumber: string, otp: string) => Promise<{
|
|
809
|
+
success: boolean;
|
|
810
|
+
error?: string;
|
|
811
|
+
}>;
|
|
812
|
+
logout: () => Promise<void>;
|
|
813
|
+
refreshProfile: () => Promise<void>;
|
|
814
|
+
}
|
|
815
|
+
interface ZoPassportProviderProps {
|
|
816
|
+
children: ReactNode;
|
|
817
|
+
clientKey: string;
|
|
818
|
+
baseUrl?: string;
|
|
819
|
+
autoRefresh?: boolean;
|
|
820
|
+
}
|
|
821
|
+
declare function ZoPassportProvider({ children, clientKey, baseUrl, autoRefresh, }: ZoPassportProviderProps): react_jsx_runtime.JSX.Element;
|
|
822
|
+
declare function useZoPassport(): ZoPassportContextValue;
|
|
823
|
+
|
|
824
|
+
export { type BalanceResponse, type FormattedTransaction, FounderBadge, type MovingShineProps, OTPInput, type OTPInputProps, PhoneInput, type PhoneInputProps, type Transaction, type TransactionItemProps, type TransactionListProps, type TransactionsResponse, type WalletBalance, WalletCardWeb as WalletCard, type WalletCardProps, WalletFullPage, type WalletScreenProps, type WalletUser, ZoAuth, type ZoAuthOTPRequest, type ZoAuthOTPVerifyRequest, type ZoAuthProps, type ZoAuthResponse, ZoAvatar, type ZoAvatarGenerateRequest, type ZoAvatarGenerateResponse, type ZoAvatarProps, type ZoAvatarStatusResponse, type ZoErrorResponse, ZoLanding, type ZoLandingProps, ZoOnboarding, type ZoOnboardingProps, ZoPassportCard, type ZoPassportCardProps, type ZoPassportCompletion, ZoPassportPage, type ZoPassportPageProps, type ZoPassportProfile, ZoPassportProvider, type ZoPassportProviderProps, ZoPassportSDK, type ZoProfileResponse, type ZoProfileUpdatePayload, ZoProgressRing, type ZoProgressRingProps, type ZoTokenBalanceResponse, type ZoTokenRefreshResponse, type ZoUser, type ZoWallet$1 as ZoWallet, useAuth, useAvatar, useProfile, useTransactions, useWallet, useWalletBalance, useZoPassport };
|