@btsd/aitu-bridge 0.7.2-canary.3 → 0.8.0-canary.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/buildBridge.d.ts +3 -0
- package/dist/error.d.ts +12 -12
- package/dist/index.d.ts +14 -576
- package/dist/index.js +1 -1
- package/dist/index.modern.mjs +1 -1
- package/dist/index.module.js +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/lib/createCounter.d.ts +4 -0
- package/dist/lib/isBrowser.d.ts +2 -0
- package/dist/lib/isIframe.d.ts +2 -0
- package/dist/types.d.ts +734 -0
- package/dist/utils.d.ts +8 -7
- package/dist/waitResponse.d.ts +3 -0
- package/dist/webBridge.d.ts +6 -7
- package/package.json +10 -4
- package/dist/error.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/index.modern.mjs.map +0 -1
- package/dist/index.module.js.map +0 -1
- package/dist/index.umd.js.map +0 -1
- package/dist/utils.d.ts.map +0 -1
- package/dist/webBridge.d.ts.map +0 -1
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,734 @@
|
|
|
1
|
+
type NavigationItemModeValue = 'SystemBackArrow' | 'CustomBackArrow' | 'NoItem' | 'UserProfile';
|
|
2
|
+
type PostMessageMethod<T extends Record<string, unknown> = Record<string, unknown>> = {
|
|
3
|
+
postMessage(data: T & {
|
|
4
|
+
reqId: string;
|
|
5
|
+
}): void;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* @public
|
|
9
|
+
* Represents a header menu item click handler.
|
|
10
|
+
*/
|
|
11
|
+
export type HeaderMenuItemClickHandlerType = (id: string) => Promise<void>;
|
|
12
|
+
/**
|
|
13
|
+
* @public
|
|
14
|
+
* Represents a back arrow click handler.
|
|
15
|
+
*/
|
|
16
|
+
export type BackArrowClickHandlerType = () => Promise<void>;
|
|
17
|
+
export type RequestMethods = 'copyToClipboard' | 'invoke' | 'storage' | 'share' | 'getGeo' | 'getQr' | 'getSMSCode' | 'selectContact' | 'openSettings' | 'closeApplication' | 'setTitle' | 'enableScreenCapture' | 'disableScreenCapture' | 'vibrate' | 'setHeaderMenuItems' | 'shareFile' | 'getUserStepInfo' | 'getCustomBackArrowMode' | 'setCustomBackArrowMode' | 'setCustomBackArrowVisible' | 'openPayment' | 'checkBiometry' | 'openExternalUrl' | 'enableSwipeBack' | 'disableSwipeBack' | 'setNavigationItemMode' | 'getNavigationItemMode' | 'isESimSupported' | 'activateESim' | 'readNFCData' | 'readNFCPassport' | 'subscribeUserStepInfo' | 'unsubscribeUserStepInfo' | 'openUserProfile';
|
|
18
|
+
type AndroidBridgeShape<Methods extends string, T extends Record<Methods, unknown[]>> = {
|
|
19
|
+
[P in keyof T]: (reqId: string, ...args: T[P]) => void;
|
|
20
|
+
};
|
|
21
|
+
type IosBridgeShape<Methods extends string, T extends Record<Methods, Record<string, unknown>>> = {
|
|
22
|
+
[P in keyof T]: PostMessageMethod<T[P]>;
|
|
23
|
+
};
|
|
24
|
+
type HandlerMethodsMap = {
|
|
25
|
+
setShakeHandler: (handler: (() => void) | null) => void;
|
|
26
|
+
setTabActiveHandler: (handler: (tabname: string) => void) => void;
|
|
27
|
+
setCustomBackArrowOnClickHandler: (handler: BackArrowClickHandlerType) => void;
|
|
28
|
+
setHeaderMenuItemClickHandler: (handler: HeaderMenuItemClickHandlerType) => void;
|
|
29
|
+
};
|
|
30
|
+
export type AndroidBridge = AndroidBridgeShape<RequestMethods, {
|
|
31
|
+
copyToClipboard: [text: string];
|
|
32
|
+
invoke: [method: string, data: string];
|
|
33
|
+
storage: [method: string, data: string];
|
|
34
|
+
share: [text: string];
|
|
35
|
+
getGeo: [];
|
|
36
|
+
getQr: [];
|
|
37
|
+
getSMSCode: [];
|
|
38
|
+
selectContact: [];
|
|
39
|
+
openSettings: [];
|
|
40
|
+
closeApplication: [];
|
|
41
|
+
setTitle: [title: string];
|
|
42
|
+
enableScreenCapture: [];
|
|
43
|
+
disableScreenCapture: [];
|
|
44
|
+
vibrate: [pattern: string];
|
|
45
|
+
setHeaderMenuItems: [itemsJsonArray: string];
|
|
46
|
+
shareFile: [text: string, filename: string, base64Data: string];
|
|
47
|
+
getUserStepInfo: [];
|
|
48
|
+
getCustomBackArrowMode: [];
|
|
49
|
+
setCustomBackArrowMode: [enabled: boolean];
|
|
50
|
+
setCustomBackArrowVisible: [visible: boolean];
|
|
51
|
+
openPayment: [transactionId: string];
|
|
52
|
+
checkBiometry: [];
|
|
53
|
+
openExternalUrl: [url: string];
|
|
54
|
+
enableSwipeBack: [];
|
|
55
|
+
disableSwipeBack: [];
|
|
56
|
+
setNavigationItemMode: [mode: NavigationItemModeValue];
|
|
57
|
+
getNavigationItemMode: [];
|
|
58
|
+
isESimSupported: [];
|
|
59
|
+
activateESim: [activationCode: string];
|
|
60
|
+
readNFCData: [];
|
|
61
|
+
readNFCPassport: [passportNumber: string, dateOfBirth: string, expirationDate: string];
|
|
62
|
+
subscribeUserStepInfo: [];
|
|
63
|
+
unsubscribeUserStepInfo: [];
|
|
64
|
+
openUserProfile: [];
|
|
65
|
+
}> & HandlerMethodsMap;
|
|
66
|
+
type IosBridgeParamsMap = {
|
|
67
|
+
copyToClipboard: {
|
|
68
|
+
text: string;
|
|
69
|
+
};
|
|
70
|
+
invoke: {
|
|
71
|
+
method: string;
|
|
72
|
+
data: unknown;
|
|
73
|
+
};
|
|
74
|
+
storage: {
|
|
75
|
+
method: string;
|
|
76
|
+
data: unknown;
|
|
77
|
+
};
|
|
78
|
+
share: {
|
|
79
|
+
text: string;
|
|
80
|
+
};
|
|
81
|
+
getGeo: {};
|
|
82
|
+
getQr: {};
|
|
83
|
+
getSMSCode: {};
|
|
84
|
+
selectContact: {};
|
|
85
|
+
openSettings: {};
|
|
86
|
+
closeApplication: {};
|
|
87
|
+
setTitle: {
|
|
88
|
+
text: string;
|
|
89
|
+
};
|
|
90
|
+
enableScreenCapture: {};
|
|
91
|
+
disableScreenCapture: {};
|
|
92
|
+
vibrate: {
|
|
93
|
+
pattern: number[];
|
|
94
|
+
};
|
|
95
|
+
setHeaderMenuItems: {
|
|
96
|
+
itemsJsonArray: string;
|
|
97
|
+
};
|
|
98
|
+
shareFile: {
|
|
99
|
+
text: string;
|
|
100
|
+
filename: string;
|
|
101
|
+
base64Data: string;
|
|
102
|
+
};
|
|
103
|
+
getUserStepInfo: {};
|
|
104
|
+
getCustomBackArrowMode: {};
|
|
105
|
+
setCustomBackArrowMode: {
|
|
106
|
+
enabled: boolean;
|
|
107
|
+
};
|
|
108
|
+
setCustomBackArrowVisible: {
|
|
109
|
+
visible: boolean;
|
|
110
|
+
};
|
|
111
|
+
openPayment: {
|
|
112
|
+
transactionId: string;
|
|
113
|
+
};
|
|
114
|
+
checkBiometry: {};
|
|
115
|
+
openExternalUrl: {
|
|
116
|
+
url: string;
|
|
117
|
+
};
|
|
118
|
+
enableSwipeBack: {};
|
|
119
|
+
disableSwipeBack: {};
|
|
120
|
+
setNavigationItemMode: {
|
|
121
|
+
mode: NavigationItemModeValue;
|
|
122
|
+
};
|
|
123
|
+
getNavigationItemMode: {};
|
|
124
|
+
isESimSupported: {};
|
|
125
|
+
activateESim: {
|
|
126
|
+
activationCode: string;
|
|
127
|
+
};
|
|
128
|
+
readNFCData: {};
|
|
129
|
+
readNFCPassport: {
|
|
130
|
+
passportNumber: string;
|
|
131
|
+
dateOfBirth: string;
|
|
132
|
+
expirationDate: string;
|
|
133
|
+
};
|
|
134
|
+
subscribeUserStepInfo: {};
|
|
135
|
+
unsubscribeUserStepInfo: {};
|
|
136
|
+
openUserProfile: {};
|
|
137
|
+
};
|
|
138
|
+
export type IosParams<F extends RequestMethods> = IosBridgeParamsMap[F];
|
|
139
|
+
export type IosBridge = IosBridgeShape<RequestMethods, IosBridgeParamsMap> & HandlerMethodsMap;
|
|
140
|
+
export type UnsafeAndroidBridge = {
|
|
141
|
+
[K in RequestMethods]: (reqId: string, ...args: unknown[]) => void;
|
|
142
|
+
} & HandlerMethodsMap;
|
|
143
|
+
export type UnsafeIosBridge = {
|
|
144
|
+
[key in RequestMethods]: PostMessageMethod<{
|
|
145
|
+
[key: string]: unknown;
|
|
146
|
+
}>;
|
|
147
|
+
} & HandlerMethodsMap;
|
|
148
|
+
/**
|
|
149
|
+
* @public
|
|
150
|
+
* Represents an event handler for Aitu bridge events.
|
|
151
|
+
*/
|
|
152
|
+
export type AituEventHandler = (event: WindowEventMap['aituEvents']) => void;
|
|
153
|
+
export type AituEvent = CustomEvent<{
|
|
154
|
+
reqId: string;
|
|
155
|
+
data: unknown;
|
|
156
|
+
status?: number;
|
|
157
|
+
error: unknown;
|
|
158
|
+
}>;
|
|
159
|
+
declare global {
|
|
160
|
+
interface Window {
|
|
161
|
+
onAituBridgeBackArrowClick?: BackArrowClickHandlerType;
|
|
162
|
+
onAituBridgeShake?: (() => void) | null;
|
|
163
|
+
onAituBridgeHeaderMenuItemClick?: HeaderMenuItemClickHandlerType;
|
|
164
|
+
onAituBridgeTabActive?: (tabname: string) => void;
|
|
165
|
+
AndroidBridge?: AndroidBridge;
|
|
166
|
+
webkit?: {
|
|
167
|
+
messageHandlers?: IosBridge;
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
interface WindowEventMap {
|
|
171
|
+
aituEvents: AituEvent;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* @public
|
|
176
|
+
* Represents an error that can occur during NFC passport operations.
|
|
177
|
+
*/
|
|
178
|
+
export interface NFCPassportError {
|
|
179
|
+
/**
|
|
180
|
+
* Error code indicating the type of NFC passport issue.
|
|
181
|
+
*
|
|
182
|
+
* - `nfc_passport_mismatch` — The passport does not match the requested parameters
|
|
183
|
+
* (date of birth, passport number, expiration date).
|
|
184
|
+
* - `nfc_document_read_failure` — Document reading error
|
|
185
|
+
* (read errors, algorithm errors, unknown algorithms, other documents that are not passports, etc.).
|
|
186
|
+
* - `nfc_session_timeout` — Session timeout: the document reading was not completed
|
|
187
|
+
* in time (depends on the OS).
|
|
188
|
+
* - `nfc_permission_denied` — The user denied NFC permission or the device has no NFC chip.
|
|
189
|
+
* - `nfc_session_cancelled` — The user cancelled the NFC session (iOS).
|
|
190
|
+
*/
|
|
191
|
+
code: 'nfc_passport_mismatch' | 'nfc_document_read_failure' | 'nfc_session_timeout' | 'nfc_permission_denied' | 'nfc_session_cancelled';
|
|
192
|
+
/**
|
|
193
|
+
* Human-readable error message describing the issue.
|
|
194
|
+
*/
|
|
195
|
+
msg: string;
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* @public
|
|
199
|
+
* Represents an error indicating that the app URL does not match the expected value.
|
|
200
|
+
*/
|
|
201
|
+
export interface AppUrlDoesntMatchError {
|
|
202
|
+
code: 'url_does_not_match';
|
|
203
|
+
msg: string;
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* @public
|
|
207
|
+
* Represents a permission denied error.
|
|
208
|
+
*/
|
|
209
|
+
export interface PermissionDeniedError {
|
|
210
|
+
code: 'permission_denied';
|
|
211
|
+
msg: string;
|
|
212
|
+
meta: {
|
|
213
|
+
can_retry: boolean;
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* @public
|
|
218
|
+
*/
|
|
219
|
+
export declare enum EInvokeRequest {
|
|
220
|
+
getMe = "GetMe",
|
|
221
|
+
getPhone = "GetPhone",
|
|
222
|
+
getContacts = "GetContacts",
|
|
223
|
+
getUserProfile = "GetUserProfile",
|
|
224
|
+
enableNotifications = "AllowNotifications",
|
|
225
|
+
disableNotifications = "DisableNotifications",
|
|
226
|
+
enablePrivateMessaging = "EnablePrivateMessaging",
|
|
227
|
+
disablePrivateMessaging = "DisablePrivateMessaging"
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* @public
|
|
231
|
+
* Represents phone number response.
|
|
232
|
+
*/
|
|
233
|
+
export interface GetPhoneResponse {
|
|
234
|
+
phone: string;
|
|
235
|
+
sign: string;
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* @public
|
|
239
|
+
* Represents user information response.
|
|
240
|
+
*/
|
|
241
|
+
export interface GetMeResponse {
|
|
242
|
+
name: string;
|
|
243
|
+
lastname: string;
|
|
244
|
+
id: string;
|
|
245
|
+
avatar?: string;
|
|
246
|
+
avatarThumb?: string;
|
|
247
|
+
notifications_allowed: boolean;
|
|
248
|
+
private_messaging_enabled: boolean;
|
|
249
|
+
sign: string;
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* @public
|
|
253
|
+
* Represents a generic response object.
|
|
254
|
+
*/
|
|
255
|
+
export interface ResponseObject {
|
|
256
|
+
phone?: string;
|
|
257
|
+
name?: string;
|
|
258
|
+
lastname?: string;
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* @public
|
|
262
|
+
* Represents a geographic location response.
|
|
263
|
+
*/
|
|
264
|
+
export interface GetGeoResponse {
|
|
265
|
+
latitude: number;
|
|
266
|
+
longitude: number;
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* @public
|
|
270
|
+
* Represents a contacts list response.
|
|
271
|
+
*/
|
|
272
|
+
export interface GetContactsResponse {
|
|
273
|
+
contacts: Array<{
|
|
274
|
+
first_name: string;
|
|
275
|
+
last_name: string;
|
|
276
|
+
phone: string;
|
|
277
|
+
}>;
|
|
278
|
+
sign: string;
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* @public
|
|
282
|
+
* Represents a selected contact response.
|
|
283
|
+
*/
|
|
284
|
+
export interface SelectContactResponse {
|
|
285
|
+
phone: string;
|
|
286
|
+
name: string;
|
|
287
|
+
lastname: string;
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* @public
|
|
291
|
+
* Represents a user profile response.
|
|
292
|
+
*/
|
|
293
|
+
export interface GetUserProfileResponse {
|
|
294
|
+
name: string;
|
|
295
|
+
lastname?: string;
|
|
296
|
+
phone?: string;
|
|
297
|
+
avatar?: string;
|
|
298
|
+
avatarThumb?: string;
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* @public
|
|
302
|
+
* Represents header menu item icons.
|
|
303
|
+
*/
|
|
304
|
+
export declare enum HeaderMenuIcon {
|
|
305
|
+
Search = "Search",
|
|
306
|
+
ShoppingCart = "ShoppingCart",
|
|
307
|
+
Menu = "Menu",
|
|
308
|
+
Share = "Share",
|
|
309
|
+
Notifications = "Notifications",
|
|
310
|
+
Help = "Help",
|
|
311
|
+
Error = "Error",
|
|
312
|
+
Person = "Person",
|
|
313
|
+
Sort = "Sort",
|
|
314
|
+
Filter = "Filter",
|
|
315
|
+
Close = "Close",
|
|
316
|
+
SystemNotifications = "SystemNotifications"
|
|
317
|
+
}
|
|
318
|
+
/**
|
|
319
|
+
* @public
|
|
320
|
+
* Represents navigation item display modes.
|
|
321
|
+
*/
|
|
322
|
+
export declare enum NavigationItemMode {
|
|
323
|
+
SystemBackArrow = "SystemBackArrow",
|
|
324
|
+
CustomBackArrow = "CustomBackArrow",
|
|
325
|
+
NoItem = "NoItem",
|
|
326
|
+
UserProfile = "UserProfile"
|
|
327
|
+
}
|
|
328
|
+
/**
|
|
329
|
+
* @public
|
|
330
|
+
* Represents a header menu item.
|
|
331
|
+
*/
|
|
332
|
+
export interface HeaderMenuItem {
|
|
333
|
+
id: string;
|
|
334
|
+
icon: HeaderMenuIcon;
|
|
335
|
+
badge?: string;
|
|
336
|
+
}
|
|
337
|
+
/**
|
|
338
|
+
* @public
|
|
339
|
+
* Represents user steps per day.
|
|
340
|
+
*/
|
|
341
|
+
export interface UserStepsPerDay {
|
|
342
|
+
/**
|
|
343
|
+
* The date for which the number of steps was received, in the format DD.MM.YYYY.
|
|
344
|
+
*/
|
|
345
|
+
date: string;
|
|
346
|
+
/**
|
|
347
|
+
* The number of steps taken by the user on the specified date.
|
|
348
|
+
*/
|
|
349
|
+
steps: number;
|
|
350
|
+
}
|
|
351
|
+
/**
|
|
352
|
+
* @public
|
|
353
|
+
* Represents a user step information response.
|
|
354
|
+
*/
|
|
355
|
+
export interface UserStepInfoResponse {
|
|
356
|
+
steps: UserStepsPerDay[];
|
|
357
|
+
}
|
|
358
|
+
/**
|
|
359
|
+
* @public
|
|
360
|
+
* Represents a successful response.
|
|
361
|
+
*/
|
|
362
|
+
export type SuccessResponse = 'success';
|
|
363
|
+
/**
|
|
364
|
+
* @public
|
|
365
|
+
* Represents biometry check response.
|
|
366
|
+
*/
|
|
367
|
+
export type BiometryResponse = SuccessResponse | 'unavailable' | 'cancelled';
|
|
368
|
+
/**
|
|
369
|
+
* @public
|
|
370
|
+
* Represents passport data read from an NFC chip.
|
|
371
|
+
*/
|
|
372
|
+
export interface PassportDataResponse {
|
|
373
|
+
documentNumber: string;
|
|
374
|
+
dateOfBirth: string;
|
|
375
|
+
dateOfExpiry: string;
|
|
376
|
+
firstName: string;
|
|
377
|
+
lastName: string;
|
|
378
|
+
gender: string;
|
|
379
|
+
nationality: string;
|
|
380
|
+
documentType: string;
|
|
381
|
+
}
|
|
382
|
+
/**
|
|
383
|
+
* @public
|
|
384
|
+
* Generic bridge invocation type.
|
|
385
|
+
*/
|
|
386
|
+
export type BridgeInvoke<T extends EInvokeRequest, R> = (method: T, data?: {}) => Promise<R>;
|
|
387
|
+
/**
|
|
388
|
+
* @public
|
|
389
|
+
* Interface for persistent key-value storage.
|
|
390
|
+
*/
|
|
391
|
+
export interface BridgeStorage {
|
|
392
|
+
setItem: (keyName: string, keyValue: string) => Promise<void>;
|
|
393
|
+
getItem: (keyName: string) => Promise<string | null>;
|
|
394
|
+
clear: () => Promise<void>;
|
|
395
|
+
}
|
|
396
|
+
/**
|
|
397
|
+
* @public
|
|
398
|
+
* Main interface for interacting with the Aitu Bridge API.
|
|
399
|
+
*/
|
|
400
|
+
export interface AituBridge {
|
|
401
|
+
/**
|
|
402
|
+
* Version of the Aitu Bridge API available in SemVer format.
|
|
403
|
+
*/
|
|
404
|
+
version: string;
|
|
405
|
+
/**
|
|
406
|
+
* Low-level bridge invocation method used internally
|
|
407
|
+
* to communicate with native Aitu functionality.
|
|
408
|
+
*/
|
|
409
|
+
invoke: BridgeInvoke<EInvokeRequest, ResponseObject>;
|
|
410
|
+
/**
|
|
411
|
+
* Provides access to persistent key-value storage
|
|
412
|
+
* scoped to the current mini-app.
|
|
413
|
+
*/
|
|
414
|
+
storage: BridgeStorage;
|
|
415
|
+
/**
|
|
416
|
+
* Returns basic information about the currently authorized user.
|
|
417
|
+
* @returns A promise resolving to a {@link GetMeResponse} containing user details.
|
|
418
|
+
*/
|
|
419
|
+
getMe: () => Promise<GetMeResponse>;
|
|
420
|
+
/**
|
|
421
|
+
* Requests the user's phone number after explicit user confirmation.
|
|
422
|
+
* @returns A promise resolving to a {@link GetPhoneResponse} containing the phone number.
|
|
423
|
+
*/
|
|
424
|
+
getPhone: () => Promise<GetPhoneResponse>;
|
|
425
|
+
/**
|
|
426
|
+
* Requests access to the user's contact list.
|
|
427
|
+
* @returns A promise resolving to a {@link GetContactsResponse} containing the contacts.
|
|
428
|
+
*/
|
|
429
|
+
getContacts: () => Promise<GetContactsResponse>;
|
|
430
|
+
/**
|
|
431
|
+
* Retrieves the user's current geographic location.
|
|
432
|
+
* @returns A promise resolving to a {@link GetGeoResponse} containing latitude and longitude.
|
|
433
|
+
*/
|
|
434
|
+
getGeo: () => Promise<GetGeoResponse>;
|
|
435
|
+
/**
|
|
436
|
+
* Opens the native contact picker UI and allows the user
|
|
437
|
+
* to select a single contact.
|
|
438
|
+
* @returns A promise resolving to a {@link SelectContactResponse} containing the selected contact details.
|
|
439
|
+
*/
|
|
440
|
+
selectContact: () => Promise<SelectContactResponse>;
|
|
441
|
+
/**
|
|
442
|
+
* Opens the device camera and scans a QR code.
|
|
443
|
+
* @returns A string with the result of scanning the QR code is returned.
|
|
444
|
+
*/
|
|
445
|
+
getQr: () => Promise<string>;
|
|
446
|
+
/**
|
|
447
|
+
* Requests an SMS verification code from the user.
|
|
448
|
+
* @returns A string with code is returned.
|
|
449
|
+
*/
|
|
450
|
+
getSMSCode: () => Promise<string>;
|
|
451
|
+
/**
|
|
452
|
+
* Retrieves public profile information for a specific user.
|
|
453
|
+
*
|
|
454
|
+
* @param userId - Aitu user identifier
|
|
455
|
+
* @returns A promise resolving to a {@link GetUserProfileResponse} containing the user's profile data.
|
|
456
|
+
*/
|
|
457
|
+
getUserProfile: (userId: string) => Promise<GetUserProfileResponse>;
|
|
458
|
+
/**
|
|
459
|
+
* Opens the user's profile within the host application.
|
|
460
|
+
* @returns A promise that resolves with a {@link SuccessResponse} indicating the result of the operation.
|
|
461
|
+
*/
|
|
462
|
+
openUserProfile: () => Promise<SuccessResponse>;
|
|
463
|
+
/**
|
|
464
|
+
* Opens the system share dialog with a text payload.
|
|
465
|
+
*
|
|
466
|
+
* @param text - Text to share
|
|
467
|
+
* @returns A promise resolving to a {@link SuccessResponse} indicating the result of the sharing operation.
|
|
468
|
+
*/
|
|
469
|
+
share: (text: string) => Promise<SuccessResponse>;
|
|
470
|
+
/**
|
|
471
|
+
* Sets the title displayed in the mini-app header.
|
|
472
|
+
*
|
|
473
|
+
* @param text - Header title
|
|
474
|
+
* @returns A promise resolving to a {@link SuccessResponse} indicating the result of the operation.
|
|
475
|
+
*/
|
|
476
|
+
setTitle: (text: string) => Promise<SuccessResponse>;
|
|
477
|
+
/**
|
|
478
|
+
* Copies the specified text to the system clipboard.
|
|
479
|
+
*
|
|
480
|
+
* @param text - Text to copy
|
|
481
|
+
* @returns A promise resolving to a {@link SuccessResponse} indicating the result of the copy operation.
|
|
482
|
+
*/
|
|
483
|
+
copyToClipboard: (text: string) => Promise<SuccessResponse>;
|
|
484
|
+
/**
|
|
485
|
+
* Shares an image with an optional text description.
|
|
486
|
+
*
|
|
487
|
+
* @deprecated Use {@link AituBridge.shareFile} instead.
|
|
488
|
+
* @param text - Description text
|
|
489
|
+
* @param image - Image data encoded in Base64
|
|
490
|
+
* @returns A promise resolving to a {@link SuccessResponse} indicating the result of the sharing operation.
|
|
491
|
+
*/
|
|
492
|
+
shareImage: (text: string, image: string) => Promise<SuccessResponse>;
|
|
493
|
+
/**
|
|
494
|
+
* Shares a file via the system sharing interface.
|
|
495
|
+
*
|
|
496
|
+
* @param text - Description text
|
|
497
|
+
* @param filename - Name of the file
|
|
498
|
+
* @param base64Data - File data encoded in Base64
|
|
499
|
+
* @returns A promise resolving to a {@link SuccessResponse} indicating the result of the sharing operation.
|
|
500
|
+
*/
|
|
501
|
+
shareFile: (text: string, filename: string, base64Data: string) => Promise<SuccessResponse>;
|
|
502
|
+
/**
|
|
503
|
+
* Enables push notifications for the mini-app.
|
|
504
|
+
*/
|
|
505
|
+
enableNotifications: () => Promise<{}>;
|
|
506
|
+
/**
|
|
507
|
+
* Disables push notifications for the mini-app.
|
|
508
|
+
*/
|
|
509
|
+
disableNotifications: () => Promise<{}>;
|
|
510
|
+
/**
|
|
511
|
+
* Enables private messaging between the mini-app and the user.
|
|
512
|
+
*
|
|
513
|
+
* @param appId - Mini-app identifier
|
|
514
|
+
*/
|
|
515
|
+
enablePrivateMessaging: (appId: string) => Promise<string>;
|
|
516
|
+
/**
|
|
517
|
+
* Disables private messaging between the mini-app and the user.
|
|
518
|
+
*
|
|
519
|
+
* @param appId - Mini-app identifier
|
|
520
|
+
*/
|
|
521
|
+
disablePrivateMessaging: (appId: string) => Promise<string>;
|
|
522
|
+
/**
|
|
523
|
+
* Opens the Aitu application settings screen.
|
|
524
|
+
* @returns A promise resolving to a SuccessResponse indicating the result of the operation.
|
|
525
|
+
*/
|
|
526
|
+
openSettings: () => Promise<SuccessResponse>;
|
|
527
|
+
/**
|
|
528
|
+
* Closes the current mini-app.
|
|
529
|
+
* @returns A promise resolving to a SuccessResponse indicating the result of the operation.
|
|
530
|
+
*/
|
|
531
|
+
closeApplication: () => Promise<SuccessResponse>;
|
|
532
|
+
/**
|
|
533
|
+
* Registers a handler that is triggered when the device is shaken.
|
|
534
|
+
* @param handler - Shake event handler
|
|
535
|
+
*/
|
|
536
|
+
setShakeHandler: (handler: (() => void) | null) => void;
|
|
537
|
+
/**
|
|
538
|
+
* Registers a handler that is triggered when a tab becomes active.
|
|
539
|
+
*
|
|
540
|
+
* @param handler - Callback with active tab name
|
|
541
|
+
*/
|
|
542
|
+
setTabActiveHandler: (handler: (tabname: string) => void) => void;
|
|
543
|
+
/**
|
|
544
|
+
* Triggers device vibration using a custom vibration pattern.
|
|
545
|
+
*
|
|
546
|
+
* @param pattern - Array of vibration durations in milliseconds
|
|
547
|
+
* @returns A promise resolving to a {@link SuccessResponse} indicating the result of the vibration operation.
|
|
548
|
+
*/
|
|
549
|
+
vibrate: (pattern: number[]) => Promise<SuccessResponse>;
|
|
550
|
+
/**
|
|
551
|
+
* Indicates whether the current environment supports Aitu Bridge.
|
|
552
|
+
* @returns A boolean indicating support status.
|
|
553
|
+
*/
|
|
554
|
+
isSupported: () => boolean;
|
|
555
|
+
/**
|
|
556
|
+
* Checks whether a specific bridge method is supported.
|
|
557
|
+
*
|
|
558
|
+
* @param method - Method name
|
|
559
|
+
* @returns A boolean indicating support status.
|
|
560
|
+
*/
|
|
561
|
+
supports: (method: string) => boolean;
|
|
562
|
+
/**
|
|
563
|
+
* Subscribes to Aitu Bridge events.
|
|
564
|
+
*/
|
|
565
|
+
sub: (listener: AituEventHandler) => void;
|
|
566
|
+
/**
|
|
567
|
+
* Enables protection against screenshots and screen recording.
|
|
568
|
+
*/
|
|
569
|
+
enableScreenCapture: () => Promise<{}>;
|
|
570
|
+
/**
|
|
571
|
+
* Disables protection against screenshots and screen recording.
|
|
572
|
+
*/
|
|
573
|
+
disableScreenCapture: () => Promise<{}>;
|
|
574
|
+
/**
|
|
575
|
+
* Sets custom menu items in the mini-app header.
|
|
576
|
+
*
|
|
577
|
+
* @param items - Header menu configuration
|
|
578
|
+
* @returns A promise resolving to a {@link SuccessResponse} indicating the result of the operation.
|
|
579
|
+
*/
|
|
580
|
+
setHeaderMenuItems: (items: Array<HeaderMenuItem>) => Promise<SuccessResponse>;
|
|
581
|
+
/**
|
|
582
|
+
* Registers a click handler for header menu items.
|
|
583
|
+
* @param handler - Header menu item click handler
|
|
584
|
+
*/
|
|
585
|
+
setHeaderMenuItemClickHandler: (handler: HeaderMenuItemClickHandlerType) => void;
|
|
586
|
+
/**
|
|
587
|
+
* Enables or disables custom back arrow handling.
|
|
588
|
+
*
|
|
589
|
+
* @param enabled - Whether custom handling is enabled
|
|
590
|
+
* @returns A promise resolving to a SuccessResponse indicating the result of the operation.
|
|
591
|
+
*/
|
|
592
|
+
setCustomBackArrowMode: (enabled: boolean) => Promise<SuccessResponse>;
|
|
593
|
+
/**
|
|
594
|
+
* Returns whether custom back arrow mode is enabled.
|
|
595
|
+
* @returns A promise resolving to a boolean indicating the current mode.
|
|
596
|
+
*/
|
|
597
|
+
getCustomBackArrowMode: () => Promise<boolean>;
|
|
598
|
+
/**
|
|
599
|
+
* Controls the visibility of the custom back arrow.
|
|
600
|
+
*
|
|
601
|
+
* @param visible - Arrow visibility state
|
|
602
|
+
* @returns A promise resolving to a {@link SuccessResponse} indicating the result of the operation.
|
|
603
|
+
*/
|
|
604
|
+
setCustomBackArrowVisible: (visible: boolean) => Promise<SuccessResponse>;
|
|
605
|
+
/**
|
|
606
|
+
* Opens the payment interface for a specified transaction.
|
|
607
|
+
* @param transactionId - Transaction identifier
|
|
608
|
+
* @returns A promise resolving to a {@link SuccessResponse} indicating the result of the payment operation.
|
|
609
|
+
*/
|
|
610
|
+
openPayment: (transactionId: string) => Promise<SuccessResponse>;
|
|
611
|
+
/**
|
|
612
|
+
* Sets a custom handler for back arrow click events.
|
|
613
|
+
* @param handler - Back arrow click handler
|
|
614
|
+
*/
|
|
615
|
+
setCustomBackArrowOnClickHandler: (handler: BackArrowClickHandlerType) => void;
|
|
616
|
+
/**
|
|
617
|
+
* Checks biometric authentication status.
|
|
618
|
+
* @returns A promise resolving to a {@link BiometryResponse} indicating the result of the check.
|
|
619
|
+
*/
|
|
620
|
+
checkBiometry: () => Promise<BiometryResponse>;
|
|
621
|
+
/**
|
|
622
|
+
* Opens an external URL outside the mini-app context.
|
|
623
|
+
*
|
|
624
|
+
* @param url - External URL to open
|
|
625
|
+
* @returns A promise resolving to a {@link SuccessResponse} indicating the result of the operation.
|
|
626
|
+
*/
|
|
627
|
+
openExternalUrl: (url: string) => Promise<SuccessResponse>;
|
|
628
|
+
/**
|
|
629
|
+
* Enables swipe-back navigation gesture.
|
|
630
|
+
* @returns A promise resolving to a {@link SuccessResponse} when the gesture is enabled.
|
|
631
|
+
*/
|
|
632
|
+
enableSwipeBack: () => Promise<SuccessResponse>;
|
|
633
|
+
/**
|
|
634
|
+
* Disables swipe-back navigation gesture.
|
|
635
|
+
* @returns A promise resolving to a {@link SuccessResponse} when the gesture is disabled.
|
|
636
|
+
*/
|
|
637
|
+
disableSwipeBack: () => Promise<SuccessResponse>;
|
|
638
|
+
/**
|
|
639
|
+
* Sets the navigation item display mode.
|
|
640
|
+
*
|
|
641
|
+
* @param mode - Navigation item mode
|
|
642
|
+
* @returns A promise that resolves when the mode is set.
|
|
643
|
+
*/
|
|
644
|
+
setNavigationItemMode: (mode: NavigationItemMode) => Promise<void>;
|
|
645
|
+
/**
|
|
646
|
+
* Returns the current navigation item mode.
|
|
647
|
+
* @returns A promise resolving to the current {@link NavigationItemMode}.
|
|
648
|
+
*/
|
|
649
|
+
getNavigationItemMode: () => Promise<NavigationItemMode>;
|
|
650
|
+
/**
|
|
651
|
+
* Retrieves step count data from HealthKit or Google Fit over the past 10 days.
|
|
652
|
+
* @returns A promise resolving to a {@link UserStepInfoResponse} containing the user's step data.
|
|
653
|
+
*/
|
|
654
|
+
getUserStepInfo: () => Promise<UserStepInfoResponse>;
|
|
655
|
+
/**
|
|
656
|
+
* Checks whether eSIM is supported on the device.
|
|
657
|
+
* @returns A promise resolving to a {@link SuccessResponse} indicating if eSIM is supported.
|
|
658
|
+
*/
|
|
659
|
+
isESimSupported: () => Promise<SuccessResponse>;
|
|
660
|
+
/**
|
|
661
|
+
* Activates an eSIM using the provided activation code.
|
|
662
|
+
*
|
|
663
|
+
* @param activationCode - eSIM activation code
|
|
664
|
+
* @returns A promise resolving to a {@link SuccessResponse} indicating the result of the activation.
|
|
665
|
+
*/
|
|
666
|
+
activateESim: (activationCode: string) => Promise<SuccessResponse>;
|
|
667
|
+
/**
|
|
668
|
+
* Reads raw data from an NFC tag.
|
|
669
|
+
* @returns A promise resolving to a string containing the raw NFC data.
|
|
670
|
+
*/
|
|
671
|
+
readNFCData: () => Promise<string>;
|
|
672
|
+
/**
|
|
673
|
+
* Subscribes to user step updates from HealthKit/Google Fit.
|
|
674
|
+
*
|
|
675
|
+
* Establishes a real-time subscription that listens for step count changes
|
|
676
|
+
* from the underlying health data provider. The promise resolves once the
|
|
677
|
+
* subscription request has been processed. To stop receiving updates, call
|
|
678
|
+
* {@link AituBridge.unsubscribeUserStepInfo}.
|
|
679
|
+
*
|
|
680
|
+
* @returns A promise that resolves with a `SuccessResponse` indicating
|
|
681
|
+
* whether the subscription was successfully created.
|
|
682
|
+
*/
|
|
683
|
+
subscribeUserStepInfo: () => Promise<SuccessResponse>;
|
|
684
|
+
/**
|
|
685
|
+
* Unsubscribes from user step updates from HealthKit/Google Fit.
|
|
686
|
+
*
|
|
687
|
+
* Stops the active step-count subscription created by
|
|
688
|
+
* {@link AituBridge.subscribeUserStepInfo}. Once unsubscribed, no further step updates
|
|
689
|
+
* will be delivered.
|
|
690
|
+
*
|
|
691
|
+
* @returns A promise that resolves with a `SuccessResponse` indicating
|
|
692
|
+
* whether the unsubscription was successful.
|
|
693
|
+
*/
|
|
694
|
+
unsubscribeUserStepInfo: () => Promise<SuccessResponse>;
|
|
695
|
+
/**
|
|
696
|
+
* Reads data from the NFC chip of an ePassport using BAC (Basic Access Control).
|
|
697
|
+
*
|
|
698
|
+
* Initiates a BAC-protected NFC read operation on an ePassport. The caller must
|
|
699
|
+
* provide the passport number, date of birth, and expiration date—values taken
|
|
700
|
+
* from the machine-readable zone (MRZ). These values are used to derive the
|
|
701
|
+
* cryptographic access keys required by BAC to open a secure session with the
|
|
702
|
+
* passport’s NFC chip.
|
|
703
|
+
*
|
|
704
|
+
* Once BAC is successfully established, the function retrieves data groups
|
|
705
|
+
* from the chip, typically including the holder’s biographical information
|
|
706
|
+
* (DG1) and, if supported and permitted, biometric data such as the facial
|
|
707
|
+
* image (DG2).
|
|
708
|
+
*
|
|
709
|
+
* @param passportNumber - Passport number taken from the MRZ.
|
|
710
|
+
* @param dateOfBirth - Holder’s date of birth (MRZ format: YYMMDD).
|
|
711
|
+
* @param expirationDate - Passport expiration date (MRZ format: YYMMDD).
|
|
712
|
+
*
|
|
713
|
+
* @returns A promise resolving to a `PassportDataResponse` containing the decoded
|
|
714
|
+
* data groups read from the passport’s NFC chip.
|
|
715
|
+
*
|
|
716
|
+
* @throws {@link NFCPassportError} When an NFC passport operation fails. Possible codes:
|
|
717
|
+
* - `nfc_passport_mismatch` — Passport does not match the provided MRZ values.
|
|
718
|
+
* - `nfc_document_read_failure` — General failure to read the document.
|
|
719
|
+
* - `nfc_session_timeout` — NFC session timed out before completion.
|
|
720
|
+
* - `nfc_permission_denied` — NFC permission denied or NFC unavailable.
|
|
721
|
+
* - `nfc_session_cancelled` — User cancelled the NFC session (iOS).
|
|
722
|
+
*/
|
|
723
|
+
readNFCPassport: (passportNumber: string, dateOfBirth: string, expirationDate: string) => Promise<PassportDataResponse>;
|
|
724
|
+
}
|
|
725
|
+
/**
|
|
726
|
+
* @internal
|
|
727
|
+
*/
|
|
728
|
+
export type PublicApiMethods = Exclude<keyof Pick<AituBridge, RequestMethods>, 'storage'>;
|
|
729
|
+
/**
|
|
730
|
+
* @internal
|
|
731
|
+
*/
|
|
732
|
+
export type BridgeMethodResult<T extends PublicApiMethods> = Awaited<ReturnType<AituBridge[T]>>;
|
|
733
|
+
export {};
|
|
734
|
+
//# sourceMappingURL=types.d.ts.map
|