@btsd/aitu-bridge 0.7.2-canary.2 → 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 -295
- 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/error.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @public
|
|
3
|
-
*/
|
|
4
|
-
export declare enum BridgeErrors {
|
|
5
|
-
PermissionDenyError = 0,
|
|
6
|
-
PermissionSecurityDenyError = 1,
|
|
7
|
-
OtherError = 2
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* @public
|
|
11
|
-
*/
|
|
12
|
-
export declare const classifyBridgeError: (e: any) => BridgeErrors;
|
|
1
|
+
/**
|
|
2
|
+
* @public
|
|
3
|
+
*/
|
|
4
|
+
export declare enum BridgeErrors {
|
|
5
|
+
PermissionDenyError = 0,
|
|
6
|
+
PermissionSecurityDenyError = 1,
|
|
7
|
+
OtherError = 2
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
12
|
+
export declare const classifyBridgeError: (e: any) => BridgeErrors;
|
|
13
13
|
//# sourceMappingURL=error.d.ts.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,296 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
type HeaderMenuItemClickHandlerType = (id: string) => Promise<void>;
|
|
16
|
-
type BackArrowClickHandlerType = () => Promise<void>;
|
|
17
|
-
/**
|
|
18
|
-
* @public
|
|
19
|
-
* Represents an error that can occur during NFC passport operations.
|
|
20
|
-
*/
|
|
21
|
-
export interface NFCPassportError {
|
|
22
|
-
/**
|
|
23
|
-
* Error code indicating the type of NFC passport issue.
|
|
24
|
-
*
|
|
25
|
-
* - `nfc_passport_mismatch` — The passport does not match the requested parameters
|
|
26
|
-
* (date of birth, passport number, expiration date).
|
|
27
|
-
* - `nfc_document_read_failure` — Document reading error
|
|
28
|
-
* (read errors, algorithm errors, unknown algorithms, other documents that are not passports, etc.).
|
|
29
|
-
* - `nfc_session_timeout` — Session timeout: the document reading was not completed
|
|
30
|
-
* in time (depends on the OS).
|
|
31
|
-
* - `nfc_permission_denied` — The user denied NFC permission or the device has no NFC chip.
|
|
32
|
-
* - `nfc_session_cancelled` — The user cancelled the NFC session (iOS).
|
|
33
|
-
*/
|
|
34
|
-
code: 'nfc_passport_mismatch' | 'nfc_document_read_failure' | 'nfc_session_timeout' | 'nfc_permission_denied' | 'nfc_session_cancelled';
|
|
35
|
-
/**
|
|
36
|
-
* Human-readable error message describing the issue.
|
|
37
|
-
*/
|
|
38
|
-
msg: string;
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* @public
|
|
42
|
-
*/
|
|
43
|
-
export interface GetPhoneResponse {
|
|
44
|
-
phone: string;
|
|
45
|
-
sign: string;
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* @public
|
|
49
|
-
*/
|
|
50
|
-
export interface GetMeResponse {
|
|
51
|
-
name: string;
|
|
52
|
-
lastname: string;
|
|
53
|
-
id: string;
|
|
54
|
-
avatar?: string;
|
|
55
|
-
avatarThumb?: string;
|
|
56
|
-
notifications_allowed: boolean;
|
|
57
|
-
private_messaging_enabled: boolean;
|
|
58
|
-
sign: string;
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* @public
|
|
62
|
-
*/
|
|
63
|
-
export interface ResponseObject {
|
|
64
|
-
phone?: string;
|
|
65
|
-
name?: string;
|
|
66
|
-
lastname?: string;
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* @public
|
|
70
|
-
*/
|
|
71
|
-
export interface GetGeoResponse {
|
|
72
|
-
latitude: number;
|
|
73
|
-
longitude: number;
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* @public
|
|
77
|
-
*/
|
|
78
|
-
export interface GetContactsResponse {
|
|
79
|
-
contacts: Array<{
|
|
80
|
-
first_name: string;
|
|
81
|
-
last_name: string;
|
|
82
|
-
phone: string;
|
|
83
|
-
}>;
|
|
84
|
-
sign: string;
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* @public
|
|
88
|
-
*/
|
|
89
|
-
export interface SelectContactResponse {
|
|
90
|
-
phone: string;
|
|
91
|
-
name: string;
|
|
92
|
-
lastname: string;
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* @public
|
|
96
|
-
*/
|
|
97
|
-
export interface GetUserProfileResponse {
|
|
98
|
-
name: string;
|
|
99
|
-
lastname?: string;
|
|
100
|
-
phone?: string;
|
|
101
|
-
avatar?: string;
|
|
102
|
-
avatarThumb?: string;
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* @public
|
|
106
|
-
*/
|
|
107
|
-
export declare enum HeaderMenuIcon {
|
|
108
|
-
Search = "Search",
|
|
109
|
-
ShoppingCart = "ShoppingCart",
|
|
110
|
-
Menu = "Menu",
|
|
111
|
-
Share = "Share",
|
|
112
|
-
Notifications = "Notifications",
|
|
113
|
-
Help = "Help",
|
|
114
|
-
Error = "Error",
|
|
115
|
-
Person = "Person",
|
|
116
|
-
Sort = "Sort",
|
|
117
|
-
Filter = "Filter",
|
|
118
|
-
Close = "Close",
|
|
119
|
-
SystemNotifications = "SystemNotifications"
|
|
120
|
-
}
|
|
121
|
-
/**
|
|
122
|
-
* @public
|
|
123
|
-
*/
|
|
124
|
-
export declare enum NavigationItemMode {
|
|
125
|
-
SystemBackArrow = "SystemBackArrow",
|
|
126
|
-
CustomBackArrow = "CustomBackArrow",
|
|
127
|
-
NoItem = "NoItem",
|
|
128
|
-
UserProfile = "UserProfile"
|
|
129
|
-
}
|
|
130
|
-
/**
|
|
131
|
-
* @public
|
|
132
|
-
*/
|
|
133
|
-
export interface HeaderMenuItem {
|
|
134
|
-
id: string;
|
|
135
|
-
icon: HeaderMenuIcon;
|
|
136
|
-
badge?: string;
|
|
137
|
-
}
|
|
138
|
-
/**
|
|
139
|
-
* @public
|
|
140
|
-
*/
|
|
141
|
-
export interface UserStepsPerDay {
|
|
142
|
-
date: string;
|
|
143
|
-
steps: number;
|
|
144
|
-
}
|
|
145
|
-
/**
|
|
146
|
-
* @public
|
|
147
|
-
*/
|
|
148
|
-
export interface UserStepInfoResponse {
|
|
149
|
-
steps: UserStepsPerDay[];
|
|
150
|
-
}
|
|
151
|
-
/**
|
|
152
|
-
* @public
|
|
153
|
-
* Represents the status of a response.
|
|
154
|
-
*
|
|
155
|
-
* - `success` — The operation completed successfully.
|
|
156
|
-
* - `failed` — The operation failed.
|
|
157
|
-
*/
|
|
158
|
-
export type ResponseType = 'success' | 'failed';
|
|
159
|
-
/**
|
|
160
|
-
* @public
|
|
161
|
-
*/
|
|
162
|
-
type BiometryResponse = ResponseType | 'unavailable' | 'cancelled';
|
|
163
|
-
/**
|
|
164
|
-
* @public
|
|
165
|
-
*/
|
|
166
|
-
export interface PassportDataResponse {
|
|
167
|
-
documentNumber: string;
|
|
168
|
-
dateOfBirth: string;
|
|
169
|
-
dateOfExpiry: string;
|
|
170
|
-
firstName: string;
|
|
171
|
-
lastName: string;
|
|
172
|
-
gender: string;
|
|
173
|
-
nationality: string;
|
|
174
|
-
documentType: string;
|
|
175
|
-
}
|
|
176
|
-
type BridgeInvoke<T extends EInvokeRequest, R> = (method: T, data?: {}) => Promise<R>;
|
|
177
|
-
interface BridgeStorage {
|
|
178
|
-
setItem: SetItemType;
|
|
179
|
-
getItem: GetItemType;
|
|
180
|
-
clear: ClearType;
|
|
181
|
-
}
|
|
182
|
-
/**
|
|
183
|
-
* @public
|
|
184
|
-
*/
|
|
185
|
-
export interface AituBridge {
|
|
186
|
-
version: string;
|
|
187
|
-
invoke: BridgeInvoke<EInvokeRequest, ResponseObject>;
|
|
188
|
-
storage: BridgeStorage;
|
|
189
|
-
getMe: () => Promise<GetMeResponse>;
|
|
190
|
-
getPhone: () => Promise<GetPhoneResponse>;
|
|
191
|
-
getContacts: () => Promise<GetContactsResponse>;
|
|
192
|
-
getGeo: () => Promise<GetGeoResponse>;
|
|
193
|
-
selectContact: () => Promise<SelectContactResponse>;
|
|
194
|
-
getQr: () => Promise<string>;
|
|
195
|
-
getSMSCode: () => Promise<string>;
|
|
196
|
-
getUserProfile: (userId: string) => Promise<GetUserProfileResponse>;
|
|
197
|
-
/**
|
|
198
|
-
* Opens the user's profile within the host application.
|
|
199
|
-
* @returns A promise that resolves with a {@link ResponseType} indicating the result of the operation.
|
|
200
|
-
*/
|
|
201
|
-
openUserProfile: () => Promise<ResponseType>;
|
|
202
|
-
share: (text: string) => Promise<ResponseType>;
|
|
203
|
-
setTitle: (text: string) => Promise<ResponseType>;
|
|
204
|
-
copyToClipboard: (text: string) => Promise<ResponseType>;
|
|
205
|
-
shareImage: (text: string, image: string) => Promise<ResponseType>;
|
|
206
|
-
shareFile: (text: string, filename: string, base64Data: string) => Promise<ResponseType>;
|
|
207
|
-
enableNotifications: () => Promise<{}>;
|
|
208
|
-
disableNotifications: () => Promise<{}>;
|
|
209
|
-
enablePrivateMessaging: (appId: string) => Promise<string>;
|
|
210
|
-
disablePrivateMessaging: (appId: string) => Promise<string>;
|
|
211
|
-
openSettings: () => Promise<ResponseType>;
|
|
212
|
-
closeApplication: () => Promise<ResponseType>;
|
|
213
|
-
setShakeHandler: (handler: any) => void;
|
|
214
|
-
setTabActiveHandler: (handler: (tabname: string) => void) => void;
|
|
215
|
-
vibrate: (pattern: number[]) => Promise<VibratePattern>;
|
|
216
|
-
isSupported: () => boolean;
|
|
217
|
-
supports: (method: string) => boolean;
|
|
218
|
-
sub: any;
|
|
219
|
-
enableScreenCapture: () => Promise<{}>;
|
|
220
|
-
disableScreenCapture: () => Promise<{}>;
|
|
221
|
-
setHeaderMenuItems: (items: Array<HeaderMenuItem>) => Promise<ResponseType>;
|
|
222
|
-
setHeaderMenuItemClickHandler: (handler: HeaderMenuItemClickHandlerType) => void;
|
|
223
|
-
setCustomBackArrowMode: (enabled: boolean) => Promise<ResponseType>;
|
|
224
|
-
getCustomBackArrowMode: () => Promise<boolean>;
|
|
225
|
-
setCustomBackArrowVisible: (visible: boolean) => Promise<ResponseType>;
|
|
226
|
-
openPayment: (transactionId: string) => Promise<ResponseType>;
|
|
227
|
-
setCustomBackArrowOnClickHandler: (handler: BackArrowClickHandlerType) => void;
|
|
228
|
-
checkBiometry: () => Promise<BiometryResponse>;
|
|
229
|
-
openExternalUrl: (url: string) => Promise<ResponseType>;
|
|
230
|
-
enableSwipeBack: () => Promise<ResponseType>;
|
|
231
|
-
disableSwipeBack: () => Promise<ResponseType>;
|
|
232
|
-
setNavigationItemMode: (mode: NavigationItemMode) => Promise<void>;
|
|
233
|
-
getNavigationItemMode: () => Promise<NavigationItemMode>;
|
|
234
|
-
getUserStepInfo: () => Promise<UserStepInfoResponse>;
|
|
235
|
-
isESimSupported: () => Promise<ResponseType>;
|
|
236
|
-
activateESim: (activationCode: string) => Promise<ResponseType>;
|
|
237
|
-
readNFCData: () => Promise<string>;
|
|
238
|
-
/**
|
|
239
|
-
* Subscribes to user step updates from HealthKit/Google Fit.
|
|
240
|
-
*
|
|
241
|
-
* Establishes a real-time subscription that listens for step count changes
|
|
242
|
-
* from the underlying health data provider. The promise resolves once the
|
|
243
|
-
* subscription request has been processed. To stop receiving updates, call
|
|
244
|
-
* {@link AituBridge.unsubscribeUserStepInfo}.
|
|
245
|
-
*
|
|
246
|
-
* @returns A promise that resolves with a `ResponseType` indicating
|
|
247
|
-
* whether the subscription was successfully created.
|
|
248
|
-
*/
|
|
249
|
-
subscribeUserStepInfo: () => Promise<ResponseType>;
|
|
250
|
-
/**
|
|
251
|
-
* Unsubscribes from user step updates from HealthKit/Google Fit.
|
|
252
|
-
*
|
|
253
|
-
* Stops the active step-count subscription created by
|
|
254
|
-
* {@link AituBridge.subscribeUserStepInfo}. Once unsubscribed, no further step updates
|
|
255
|
-
* will be delivered.
|
|
256
|
-
*
|
|
257
|
-
* @returns A promise that resolves with a `ResponseType` indicating
|
|
258
|
-
* whether the unsubscription was successful.
|
|
259
|
-
*/
|
|
260
|
-
unsubscribeUserStepInfo: () => Promise<ResponseType>;
|
|
261
|
-
/**
|
|
262
|
-
* Reads data from the NFC chip of an ePassport using BAC (Basic Access Control).
|
|
263
|
-
*
|
|
264
|
-
* Initiates a BAC-protected NFC read operation on an ePassport. The caller must
|
|
265
|
-
* provide the passport number, date of birth, and expiration date—values taken
|
|
266
|
-
* from the machine-readable zone (MRZ). These values are used to derive the
|
|
267
|
-
* cryptographic access keys required by BAC to open a secure session with the
|
|
268
|
-
* passport’s NFC chip.
|
|
269
|
-
*
|
|
270
|
-
* Once BAC is successfully established, the function retrieves data groups
|
|
271
|
-
* from the chip, typically including the holder’s biographical information
|
|
272
|
-
* (DG1) and, if supported and permitted, biometric data such as the facial
|
|
273
|
-
* image (DG2).
|
|
274
|
-
*
|
|
275
|
-
* @param passportNumber - Passport number taken from the MRZ.
|
|
276
|
-
* @param dateOfBirth - Holder’s date of birth (MRZ format: YYMMDD).
|
|
277
|
-
* @param expirationDate - Passport expiration date (MRZ format: YYMMDD).
|
|
278
|
-
*
|
|
279
|
-
* @returns A promise resolving to a `PassportDataResponse` containing the decoded
|
|
280
|
-
* data groups read from the passport’s NFC chip.
|
|
281
|
-
*
|
|
282
|
-
* @throws {@link NFCPassportError} When an NFC passport operation fails. Possible codes:
|
|
283
|
-
* - `nfc_passport_mismatch` — Passport does not match the provided MRZ values.
|
|
284
|
-
* - `nfc_document_read_failure` — General failure to read the document.
|
|
285
|
-
* - `nfc_session_timeout` — NFC session timed out before completion.
|
|
286
|
-
* - `nfc_permission_denied` — NFC permission denied or NFC unavailable.
|
|
287
|
-
* - `nfc_session_cancelled` — User cancelled the NFC session (iOS).
|
|
288
|
-
*/
|
|
289
|
-
readNFCPassport: (passportNumber: string, dateOfBirth: string, expirationDate: string) => Promise<PassportDataResponse>;
|
|
290
|
-
}
|
|
291
|
-
/**
|
|
292
|
-
* @public
|
|
293
|
-
*/
|
|
294
|
-
declare const bridge: AituBridge;
|
|
295
|
-
export default bridge;
|
|
1
|
+
/**
|
|
2
|
+
* Aitu Bridge is a JavaScript library designed to simplify integration with the Aitu Superapp.
|
|
3
|
+
* It allows your application to access platform features such as retrieving a user’s phone number or geolocation.
|
|
4
|
+
* {@link https://docs.aitu.io/aituapps/aitu.apps/methods | Read the official documentation to learn more.}
|
|
5
|
+
* @packageDocumentation
|
|
6
|
+
*/
|
|
7
|
+
export * from './error';
|
|
8
|
+
export type { BackArrowClickHandlerType, HeaderMenuItemClickHandlerType, NFCPassportError, PermissionDeniedError, AppUrlDoesntMatchError, AituEventHandler, EInvokeRequest, GetPhoneResponse, GetMeResponse, ResponseObject, GetGeoResponse, GetContactsResponse, SelectContactResponse, GetUserProfileResponse, HeaderMenuIcon, NavigationItemMode, HeaderMenuItem, UserStepsPerDay, UserStepInfoResponse, SuccessResponse, BiometryResponse, PassportDataResponse, BridgeInvoke, BridgeStorage, AituBridge, } from './types';
|
|
9
|
+
/**
|
|
10
|
+
* @public
|
|
11
|
+
* AituBridge instance for interacting with the Aitu mini-app environment.
|
|
12
|
+
*/
|
|
13
|
+
declare const bridge: import("./types").AituBridge;
|
|
14
|
+
export default bridge;
|
|
296
15
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function e(){return e=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var o=arguments[n];for(var t in o)({}).hasOwnProperty.call(o,t)&&(e[t]=o[t])}return e},e.apply(null,arguments)}function n(e){var n=function(e){return void 0===e&&(e="m:"),{current:0,next:function(){return e+ ++this.current}}}(e),o={};return{add:function(e,t){void 0===t&&(t="");var r=t+n.next();return o[r]=e,r},resolve:function(e,n,t,r){var i=o[e];i&&(t(r)?i.resolve(n):i.reject(r),o[e]=null)}}}function o(e,n){e(function(e){if(e.detail&&"reqId"in e.detail){var o=e.detail,t=o.reqId;t&&n.resolve(t,o.data,function(e){return!e},o.error)}})}function t(e,t,r){var i=n(t+":");return o(r,i),function(){var n=arguments;return new Promise(function(o,t){var r=i.add({resolve:o,reject:t});e.apply(void 0,[r].concat([].slice.call(n)))})}}var r=new URLSearchParams(window.location.search).get("__aitu-domain");r?localStorage.setItem("mini-app-domain",r):r=localStorage.getItem("mini-app-domain");var i=null;r&&(i={origin:r,execute:function(e,n){window.top.postMessage({source:"aitu-bridge",method:e,reqId:n,payload:[].concat([].slice.call(arguments,2))},i.origin)}},window.addEventListener("message",function(e){if(e.origin===r&&e.data){if(window.dispatchEvent(new CustomEvent("aituEvents",{detail:e.data})),"string"!=typeof e.data||""===e.data)return;try{var n=JSON.parse(e.data);n&&n.method&&("setCustomBackArrowOnClickHandler"===n.method?window.onAituBridgeBackArrowClick():"setHeaderMenuItemClickHandler"===n.method&&window.onAituBridgeHeaderMenuItemClick(n.param))}catch(e){console.log("Error parsing message data: "+e)}}}));var s,a,d,c,u=i;exports.BridgeErrors=void 0,(s=exports.BridgeErrors||(exports.BridgeErrors={}))[s.PermissionDenyError=0]="PermissionDenyError",s[s.PermissionSecurityDenyError=1]="PermissionSecurityDenyError",s[s.OtherError=2]="OtherError",function(e){e.getMe="GetMe",e.getPhone="GetPhone",e.getContacts="GetContacts",e.getUserProfile="GetUserProfile",e.enableNotifications="AllowNotifications",e.disableNotifications="DisableNotifications",e.enablePrivateMessaging="EnablePrivateMessaging",e.disablePrivateMessaging="DisablePrivateMessaging"}(a||(a={})),exports.HeaderMenuIcon=void 0,(d=exports.HeaderMenuIcon||(exports.HeaderMenuIcon={})).Search="Search",d.ShoppingCart="ShoppingCart",d.Menu="Menu",d.Share="Share",d.Notifications="Notifications",d.Help="Help",d.Error="Error",d.Person="Person",d.Sort="Sort",d.Filter="Filter",d.Close="Close",d.SystemNotifications="SystemNotifications",exports.NavigationItemMode=void 0,(c=exports.NavigationItemMode||(exports.NavigationItemMode={})).SystemBackArrow="SystemBackArrow",c.CustomBackArrow="CustomBackArrow",c.NoItem="NoItem",c.UserProfile="UserProfile";var l="invoke",f="storage",p="getGeo",g="getQr",w="getSMSCode",m="selectContact",v="openSettings",k="closeApplication",y="share",M="setTitle",I="copyToClipboard",b="shareFile",S="setShakeHandler",C="vibrate",x="enableScreenCapture",h="disableScreenCapture",U="setTabActiveHandler",B="setHeaderMenuItems",P="setHeaderMenuItemClickHandler",A="setCustomBackArrowMode",N="getCustomBackArrowMode",E="setCustomBackArrowVisible",q="openPayment",H="setCustomBackArrowOnClickHandler",O="checkBiometry",D="openExternalUrl",T="enableSwipeBack",j="disableSwipeBack",F="setNavigationItemMode",G="getNavigationItemMode",J="getUserStepInfo",V="undefined"!=typeof window&&window.AndroidBridge,W="undefined"!=typeof window&&window.webkit&&window.webkit.messageHandlers,L="undefined"!=typeof window&&window.top!==window&&u,Q=function(){var r=[];"undefined"!=typeof window&&window.addEventListener("aituEvents",function(e){[].concat(r).map(function(n){return n.call(null,e)})});var i,s=function(e){r.push(e)},d=function(n,o){return t(function(t){var r=[].slice.call(arguments,1),i=!!W&&!!W[n],s=!(null==o||!o.isWebSupported||!L);V&&V[n]?V[n].apply(V,[t].concat(r)):i?W[n].postMessage(e({reqId:t},null==o||null==o.transformToObject?void 0:o.transformToObject(r))):s?L.execute.apply(L,[n,t].concat(r)):"undefined"!=typeof window&&console.log("--"+n+"-isUnknown")},n,s)},c=(o(s,i=n("invoke:")),function(e,n){return void 0===n&&(n={}),new Promise(function(o,t){!function(e,n,o){void 0===o&&(o={});var t=W&&W[l];V&&V[l]?V[l](e,n,JSON.stringify(o)):t?W[l].postMessage({reqId:e,method:n,data:o}):L?L.execute(l,e,n,o):"undefined"!=typeof window&&console.log("--invoke-isUnknown")}(i.add({resolve:o,reject:t},e+":"),e,n)})}),u=function(e,t){var r=n("storage:");return o(t,r),{setItem:function(n,o){return new Promise(function(t,i){var s=r.add({resolve:t,reject:i});e(s,"setItem",{keyName:n,keyValue:o})})},getItem:function(n){return new Promise(function(o,t){var i=r.add({resolve:o,reject:t});e(i,"getItem",{keyName:n})})},clear:function(){return new Promise(function(n,o){var t=r.add({resolve:n,reject:o});e(t,"clear",{})})}}}(function(e,n,o){void 0===o&&(o={});var t=W&&W[f];V&&V[f]?V[f](e,n,JSON.stringify(o)):t?W[f].postMessage({reqId:e,method:n,data:o}):L?L.execute(f,e,n,o):"undefined"!=typeof window&&console.log("--storage-isUnknown")},s),Q=t(function(e){var n=W&&W[p];V&&V[p]?V[p](e):n?W[p].postMessage({reqId:e}):L?L.execute(p,e):"undefined"!=typeof window&&console.log("--getGeo-isUnknown")},p,s),_=t(function(e){var n=W&&W[g];V&&V[g]?V[g](e):n?W[g].postMessage({reqId:e}):L?L.execute(g,e):"undefined"!=typeof window&&console.log("--getQr-isUnknown")},g,s),R=t(function(e){var n=W&&W[w];V&&V[w]?V[w](e):n?W[w].postMessage({reqId:e}):L?L.execute(w,e):"undefined"!=typeof window&&console.log("--getSMSCode-isUnknown")},w,s),z=t(function(e){var n=W&&W[m];V&&V[m]?V[m](e):n?W[m].postMessage({reqId:e}):L?L.execute(m,e):"undefined"!=typeof window&&console.log("--selectContact-isUnknown")},m,s),K=t(function(e){var n=W&&W[v];V&&V[v]?V[v](e):n?W[v].postMessage({reqId:e}):L?L.execute(v,e):"undefined"!=typeof window&&console.log("--openSettings-isUnknown")},v,s),X=t(function(e){var n=W&&W[k];V&&V[k]?V[k](e):n?W[k].postMessage({reqId:e}):L?L.execute(k,e):"undefined"!=typeof window&&console.log("--closeApplication-isUnknown")},k,s),Y=t(function(e,n){var o=W&&W[y];V&&V[y]?V[y](e,n):o?W[y].postMessage({reqId:e,text:n}):L?L.execute(y,e,n):"undefined"!=typeof window&&console.log("--share-isUnknown")},y,s),Z=t(function(e,n){var o=W&&W[M];V&&V[M]?V[M](e,n):o?W[M].postMessage({reqId:e,text:n}):L?L.execute(M,e,n):"undefined"!=typeof window&&console.log("--setTitle-isUnknown")},M,s),$=t(function(e,n){var o=W&&W[I];V&&V[I]?V[I](e,n):o?W[I].postMessage({reqId:e,text:n}):L?L.execute(I,e,n):"undefined"!=typeof window&&console.log("--copyToClipboard-isUnknown")},I,s),ee=t(function(e,n,o){var t=V&&V[b],r=W&&W[b],i="image."+o.split(";")[0].split("/")[1],s=o.substr(o.indexOf(",")+1);t?V[b](e,n,i,s):r?W[b].postMessage({reqId:e,text:n,filename:i,base64Data:s}):L?L.execute(b,e,{text:n,filename:i,base64Data:s}):"undefined"!=typeof window&&console.log("--shareFile-isUnknown")},"shareImage",s),ne=t(function(e,n,o,t){var r=W&&W[b];V&&V[b]?V[b](e,n,o,t):r?W[b].postMessage({reqId:e,text:n,filename:o,base64Data:t}):L?L.execute(b,e,n,o,t):"undefined"!=typeof window&&console.log("--shareFile-isUnknown")},b,s),oe=t(function(e,n){if(!Array.isArray(n)||n.some(function(e){return e<1||e!==Math.floor(e)})||n.reduce(function(e,n){return e+n})>1e4)console.error("Pattern should be an array of positive integers no longer than 10000ms total");else{var o=W&&W[C];V&&V[C]?V[C](e,JSON.stringify(n)):o?W[C].postMessage({reqId:e,pattern:n}):L?L.execute(C,e,n):"undefined"!=typeof window&&console.log("--vibrate-isUnknown")}},C,s),te=t(function(e){var n=W&&W[x];V&&V[x]?V[x](e):n?W[x].postMessage({reqId:e}):L?L.execute(x,e):"undefined"!=typeof window&&console.log("--enableScreenCapture-isUnknown")},x,s),re=t(function(e){var n=W&&W[h];V&&V[h]?V[h](e):n?W[h].postMessage({reqId:e}):L?L.execute(h,e):"undefined"!=typeof window&&console.log("--disableScreenCapture-isUnknown")},h,s),ie=t(function(e,n){if(n.length>3)console.error("SetHeaderMenuItems: items count should not be more than 3");else{var o=V&&V[B],t=W&&W[B],r=JSON.stringify(n);o?V[B](e,r):t?W[B].postMessage({reqId:e,itemsJsonArray:r}):L?L.execute(B,e,r):"undefined"!=typeof window&&console.log("--setHeaderMenuItems-isUnknown")}},B,s),se=t(function(e,n){var o=W&&W[A];V&&V[A]?V[A](e,n):o?W[A].postMessage({reqId:e,enabled:n}):L?L.execute(A,e,n):"undefined"!=typeof window&&console.log("--setCustomBackArrowMode-isUnknown")},A,s),ae=t(function(e){var n=W&&W[N];V&&V[N]?V[N](e):n?W[N].postMessage({reqId:e}):L?L.execute(N,e):"undefined"!=typeof window&&console.log("--getCustomBackArrowMode-isUnknown")},N,s),de=t(function(e,n){var o=W&&W[E];V&&V[E]?V[E](e,n):o?W[E].postMessage({reqId:e,visible:n}):L?L.execute(E,e,n):"undefined"!=typeof window&&console.log("--setCustomBackArrowVisible-isUnknown")},E,s),ce=t(function(e,n){var o=W&&W[q];V&&V[q]?V[q](e,n):o?W[q].postMessage({reqId:e,transactionId:n}):console.log("--openPayment-isUnknown")},q,s),ue=t(function(e){var n=W&&W[O];V&&V[O]?V[O](e):n?W[O].postMessage({reqId:e}):L?L.execute(O,e):"undefined"!=typeof window&&console.log("--checkBiometry-isUnknown")},O,s),le=t(function(e,n){var o=W&&W[D];V&&V[D]?V[D](e,n):o?W[D].postMessage({reqId:e,url:n}):console.log("--openExternalUrlMethod-isUnknown")},D,s),fe=t(function(e){var n=W&&W[T];V&&V[T]?V[T](e):n?W[T].postMessage({reqId:e}):L?L.execute(T,e):"undefined"!=typeof window&&console.log("--enableSwipeBack-isUnknown")},T,s),pe=t(function(e){var n=W&&W[j];V&&V[j]?V[j](e):n?W[j].postMessage({reqId:e}):L?L.execute(j,e):"undefined"!=typeof window&&console.log("--disableSwipeBack-isUnknown")},j,s),ge=t(function(e,n){var o=W&&W[F];V&&V[F]?V[F](e,n):o?W[F].postMessage({reqId:e,mode:n}):L?L.execute(F,e,n):"undefined"!=typeof window&&console.log("--setNavigationItemMode-isUnknown")},F,s),we=t(function(e){var n=W&&W[G];V&&V[G]?V[G](e):n?W[G].postMessage({reqId:e}):L?L.execute(G,e):"undefined"!=typeof window&&console.log("--getNavigationItemMode-isUnknown")},G,s),me=t(function(e){var n=W&&W[J];V&&V[J]?V[J](e):n?W[J].postMessage({reqId:e}):L?console.log("--getUserStepInfo-isWeb"):"undefined"!=typeof window&&console.log("--getUserStepInfo-isUnknown")},J,s),ve=d("isESimSupported"),ke=d("activateESim",{transformToObject:function(e){return{activationCode:e[0]}}}),ye=d("readNFCData"),Me=d("readNFCPassport",{transformToObject:function(e){return{passportNumber:e[0],dateOfBirth:e[1],expirationDate:e[2]}}}),Ie=d("subscribeUserStepInfo"),be=d("unsubscribeUserStepInfo"),Se=d("openUserProfile");return{version:"0.7.2-canary.2",copyToClipboard:$,invoke:c,storage:u,getMe:function(){return c(a.getMe)},getPhone:function(){return c(a.getPhone)},getContacts:function(){return c(a.getContacts)},getGeo:Q,getQr:_,getSMSCode:R,getUserProfile:function(e){return c(a.getUserProfile,{id:e})},openUserProfile:Se,selectContact:z,enableNotifications:function(){return c(a.enableNotifications)},disableNotifications:function(){return c(a.disableNotifications)},enablePrivateMessaging:function(e){return c(a.enablePrivateMessaging,{appId:e})},disablePrivateMessaging:function(e){return c(a.disablePrivateMessaging,{appId:e})},openSettings:K,closeApplication:X,setTitle:Z,share:Y,shareImage:ee,shareFile:ne,setShakeHandler:function(e){V&&V[S]||W&&W[S]||L?window.onAituBridgeShake=e:"undefined"!=typeof window&&console.log("--setShakeHandler-isUnknown")},setTabActiveHandler:function(e){V&&V[U]||W&&W[U]||L?window.onAituBridgeTabActive=e:"undefined"!=typeof window&&console.log("--setTabActiveHandler-isUnknown")},vibrate:oe,isSupported:function(){var e=W&&window.webkit.messageHandlers.invoke;return Boolean(V||e||L)},supports:function(e){return V&&"function"==typeof V[e]||W&&W[e]&&"function"==typeof W[e].postMessage||L&&"function"==typeof L[e]},sub:s,enableScreenCapture:te,disableScreenCapture:re,setHeaderMenuItems:ie,setHeaderMenuItemClickHandler:function(e){V&&V[P]||W&&W[P]||L?window.onAituBridgeHeaderMenuItemClick=e:"undefined"!=typeof window&&console.log("--setHeaderMenuItemClickHandler-isUnknown")},setCustomBackArrowMode:se,getCustomBackArrowMode:ae,setCustomBackArrowVisible:de,openPayment:ce,setCustomBackArrowOnClickHandler:function(e){V&&V[H]||W&&W[H]||L?window.onAituBridgeBackArrowClick=e:"undefined"!=typeof window&&console.log("--setCustomBackArrowOnClickHandler-isUnknown")},checkBiometry:ue,openExternalUrl:le,enableSwipeBack:fe,disableSwipeBack:pe,setNavigationItemMode:ge,getNavigationItemMode:we,getUserStepInfo:me,isESimSupported:ve,activateESim:ke,readNFCData:ye,subscribeUserStepInfo:Ie,unsubscribeUserStepInfo:be,readNFCPassport:Me}}();exports.classifyBridgeError=function(e){if(e.msg){if(e.msg.startsWith("permission deny"))return exports.BridgeErrors.PermissionDenyError;if(e.msg.startsWith("permission security deny"))return exports.BridgeErrors.PermissionSecurityDenyError}return exports.BridgeErrors.OtherError},exports.default=Q;
|
|
1
|
+
var e,n,o,t;function r(){return r=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var o=arguments[n];for(var t in o)({}).hasOwnProperty.call(o,t)&&(e[t]=o[t])}return e},r.apply(null,arguments)}function i(e){void 0===e&&(e="m:");var n=0;return{next:function(){return e+ ++n}}}function s(e){var n=i(e),o={};return{add:function(e,t){void 0===t&&(t="");var r=t+n.next();return o[r]=e,r},resolve:function(e,n,t,r){var i=o[e];i&&(t(r)?i.resolve(n):i.reject(r),o[e]=null)}}}function a(e,n){e(function(e){if(e.detail&&"reqId"in e.detail){var o=e.detail,t=o.reqId;t&&n.resolve(t,o.data,function(e){return!e},o.error)}})}function d(e,n,o){var t=s(n+":");return a(o,t),function(){var n=arguments;return new Promise(function(o,r){var i=t.add({resolve:o,reject:r});e.apply(void 0,[i].concat([].slice.call(n)))})}}exports.BridgeErrors=void 0,(e=exports.BridgeErrors||(exports.BridgeErrors={}))[e.PermissionDenyError=0]="PermissionDenyError",e[e.PermissionSecurityDenyError=1]="PermissionSecurityDenyError",e[e.OtherError=2]="OtherError",function(e){e.getMe="GetMe",e.getPhone="GetPhone",e.getContacts="GetContacts",e.getUserProfile="GetUserProfile",e.enableNotifications="AllowNotifications",e.disableNotifications="DisableNotifications",e.enablePrivateMessaging="EnablePrivateMessaging",e.disablePrivateMessaging="DisablePrivateMessaging"}(n||(n={})),function(e){e.Search="Search",e.ShoppingCart="ShoppingCart",e.Menu="Menu",e.Share="Share",e.Notifications="Notifications",e.Help="Help",e.Error="Error",e.Person="Person",e.Sort="Sort",e.Filter="Filter",e.Close="Close",e.SystemNotifications="SystemNotifications"}(o||(o={})),function(e){e.SystemBackArrow="SystemBackArrow",e.CustomBackArrow="CustomBackArrow",e.NoItem="NoItem",e.UserProfile="UserProfile"}(t||(t={}));var c=function(){var e,o,t="invoke",c="storage",u="getGeo",l="getQr",f="getSMSCode",g="selectContact",w="share",p="setTitle",v="copyToClipboard",m="shareFile",k="setShakeHandler",y="vibrate",b="enableScreenCapture",M="disableScreenCapture",I="setTabActiveHandler",S="setHeaderMenuItems",C="setHeaderMenuItemClickHandler",h="setCustomBackArrowMode",U="getCustomBackArrowMode",x="setCustomBackArrowVisible",B="openPayment",P="setCustomBackArrowOnClickHandler",A="checkBiometry",E="openExternalUrl",N="setNavigationItemMode",q="getNavigationItemMode",H="getUserStepInfo",O="undefined"!=typeof window,T=O&&window.AndroidBridge,D=O&&window.webkit&&window.webkit.messageHandlers,j=O&&function(){if(!globalThis.window)return!1;try{return window.self!==window.top}catch(e){return!0}}()&&((o=new URLSearchParams(window.location.search).get("__aitu-domain"))?localStorage.setItem("mini-app-domain",o):o=localStorage.getItem("mini-app-domain"),o?(e={origin:o,execute:function(e,n){var t;null==(t=window)||null==(t=t.top)||t.postMessage({source:"aitu-bridge",method:e,reqId:n,payload:[].concat([].slice.call(arguments,2))},o)}},window.addEventListener("message",function(e){if(e.origin===o&&e.data){if(window.dispatchEvent(new CustomEvent("aituEvents",{detail:e.data})),"string"!=typeof e.data||""===e.data)return;try{var n=JSON.parse(e.data);n&&n.method&&("setCustomBackArrowOnClickHandler"===n.method?null==window.onAituBridgeBackArrowClick||window.onAituBridgeBackArrowClick():"setHeaderMenuItemClickHandler"===n.method&&(null==window.onAituBridgeHeaderMenuItemClick||window.onAituBridgeHeaderMenuItemClick(n.param)))}catch(e){console.log("Error parsing message data: "+e)}}}),e):null),F=[];O&&window.addEventListener("aituEvents",function(e){[].concat(F).map(function(n){return n.call(null,e)})});var G,J=function(e){F.push(e)},L=function(e,n){var o=i(e+":");return function(){var t=[].slice.call(arguments),i=o.next(),s=!!D&&!!D[e],a=!!j;return T&&T[e]?T[e].apply(T,[i].concat(t)):s?D[e].postMessage(r({reqId:i},null==n||null==n.transformToObject?void 0:n.transformToObject(t))):a?j.execute.apply(j,[e,i].concat(t)):"undefined"!=typeof window&&console.log("--"+e+"-isUnknown"),function(e){return new Promise(function(n,o){var t=function(r){var i;if((null==(i=r.detail)?void 0:i.reqId)===e){var s=r.detail,a=s.data,d=s.error;a?n(a):o(d),window.removeEventListener("aituEvents",t)}};window.addEventListener("aituEvents",t)})}(i)}},V=(a(J,G=s("invoke:")),function(e,n){return void 0===n&&(n={}),new Promise(function(o,r){!function(e,n,o){void 0===o&&(o={});var r=D&&D[t];T&&T[t]?T[t](e,n,JSON.stringify(o)):r?D[t].postMessage({reqId:e,method:n,data:o}):j?j.execute(t,e,n,o):"undefined"!=typeof window&&console.log("--invoke-isUnknown")}(G.add({resolve:o,reject:r},e+":"),e,n)})}),Q=function(e,n){var o=s("storage:");return a(n,o),{setItem:function(n,t){return new Promise(function(r,i){var s=o.add({resolve:r,reject:i});e(s,"setItem",{keyName:n,keyValue:t})})},getItem:function(n){return new Promise(function(t,r){var i=o.add({resolve:t,reject:r});e(i,"getItem",{keyName:n})})},clear:function(){return new Promise(function(n,t){var r=o.add({resolve:n,reject:t});e(r,"clear",{})})}}}(function(e,n,o){void 0===o&&(o={});var t=D&&D[c];T&&T[c]?T[c](e,n,JSON.stringify(o)):t?D[c].postMessage({reqId:e,method:n,data:o}):j?j.execute(c,e,n,o):"undefined"!=typeof window&&console.log("--storage-isUnknown")},J),W=d(function(e){var n=D&&D[u];T&&T[u]?T[u](e):n?D[u].postMessage({reqId:e}):j?j.execute(u,e):"undefined"!=typeof window&&console.log("--getGeo-isUnknown")},u,J),_=d(function(e){var n=D&&D[l];T&&T[l]?T[l](e):n?D[l].postMessage({reqId:e}):j?j.execute(l,e):"undefined"!=typeof window&&console.log("--getQr-isUnknown")},l,J),R=d(function(e){var n=D&&D[f];T&&T[f]?T[f](e):n?D[f].postMessage({reqId:e}):j?j.execute(f,e):"undefined"!=typeof window&&console.log("--getSMSCode-isUnknown")},f,J),z=d(function(e){var n=D&&D[g];T&&T[g]?T[g](e):n?D[g].postMessage({reqId:e}):j?j.execute(g,e):"undefined"!=typeof window&&console.log("--selectContact-isUnknown")},g,J),K=d(function(e,n){var o=D&&D[w];T&&T[w]?T[w](e,n):o?D[w].postMessage({reqId:e,text:n}):j?j.execute(w,e,n):"undefined"!=typeof window&&console.log("--share-isUnknown")},w,J),X=d(function(e,n){var o=D&&D[p];T&&T[p]?T[p](e,n):o?D[p].postMessage({reqId:e,text:n}):j?j.execute(p,e,n):"undefined"!=typeof window&&console.log("--setTitle-isUnknown")},p,J),Y=d(function(e,n){var o=D&&D[v];T&&T[v]?T[v](e,n):o?D[v].postMessage({reqId:e,text:n}):j?j.execute(v,e,n):"undefined"!=typeof window&&console.log("--copyToClipboard-isUnknown")},v,J),Z=d(function(e,n,o){var t,r,i=T&&T[m],s=D&&D[m],a="image."+(null!=(t=null==(r=o.split(";"))||null==(r=r[0])?void 0:r.split("/")[1])?t:""),d=o.substr(o.indexOf(",")+1);i?T[m](e,n,a,d):s?D[m].postMessage({reqId:e,text:n,filename:a,base64Data:d}):j?j.execute(m,e,{text:n,filename:a,base64Data:d}):"undefined"!=typeof window&&console.log("--shareFile-isUnknown")},"shareImage",J),$=d(function(e,n,o,t){var r=D&&D[m];T&&T[m]?T[m](e,n,o,t):r?D[m].postMessage({reqId:e,text:n,filename:o,base64Data:t}):j?j.execute(m,e,n,o,t):"undefined"!=typeof window&&console.log("--shareFile-isUnknown")},m,J),ee=d(function(e,n){if(!Array.isArray(n)||n.some(function(e){return e<1||e!==Math.floor(e)})||n.reduce(function(e,n){return e+n})>1e4)console.error("Pattern should be an array of positive integers no longer than 10000ms total");else{var o=D&&D[y];T&&T[y]?T[y](e,JSON.stringify(n)):o?D[y].postMessage({reqId:e,pattern:n}):j?j.execute(y,e,n):"undefined"!=typeof window&&console.log("--vibrate-isUnknown")}},y,J),ne=d(function(e){var n=D&&D[b];T&&T[b]?T[b](e):n?D[b].postMessage({reqId:e}):j?j.execute(b,e):"undefined"!=typeof window&&console.log("--enableScreenCapture-isUnknown")},b,J),oe=d(function(e){var n=D&&D[M];T&&T[M]?T[M](e):n?D[M].postMessage({reqId:e}):j?j.execute(M,e):"undefined"!=typeof window&&console.log("--disableScreenCapture-isUnknown")},M,J),te=d(function(e,n){if(n.length>3)console.error("SetHeaderMenuItems: items count should not be more than 3");else{var o=T&&T[S],t=D&&D[S],r=JSON.stringify(n);o?T[S](e,r):t?D[S].postMessage({reqId:e,itemsJsonArray:r}):j?j.execute(S,e,r):"undefined"!=typeof window&&console.log("--setHeaderMenuItems-isUnknown")}},S,J),re=d(function(e,n){var o=D&&D[h];T&&T[h]?T[h](e,n):o?D[h].postMessage({reqId:e,enabled:n}):j?j.execute(h,e,n):"undefined"!=typeof window&&console.log("--setCustomBackArrowMode-isUnknown")},h,J),ie=d(function(e){var n=D&&D[U];T&&T[U]?T[U](e):n?D[U].postMessage({reqId:e}):j?j.execute(U,e):"undefined"!=typeof window&&console.log("--getCustomBackArrowMode-isUnknown")},U,J),se=d(function(e,n){var o=D&&D[x];T&&T[x]?T[x](e,n):o?D[x].postMessage({reqId:e,visible:n}):j?j.execute(x,e,n):"undefined"!=typeof window&&console.log("--setCustomBackArrowVisible-isUnknown")},x,J),ae=d(function(e,n){var o=D&&D[B];T&&T[B]?T[B](e,n):o?D[B].postMessage({reqId:e,transactionId:n}):console.log("--openPayment-isUnknown")},B,J),de=d(function(e){var n=D&&D[A];T&&T[A]?T[A](e):n?D[A].postMessage({reqId:e}):j?j.execute(A,e):"undefined"!=typeof window&&console.log("--checkBiometry-isUnknown")},A,J),ce=d(function(e,n){var o=D&&D[E];T&&T[E]?T[E](e,n):o?D[E].postMessage({reqId:e,url:n}):console.log("--openExternalUrlMethod-isUnknown")},E,J),ue=d(function(e,n){var o=D&&D[N];T&&T[N]?T[N](e,n):o?D[N].postMessage({reqId:e,mode:n}):j?j.execute(N,e,n):"undefined"!=typeof window&&console.log("--setNavigationItemMode-isUnknown")},N,J),le=d(function(e){var n=D&&D[q];T&&T[q]?T[q](e):n?D[q].postMessage({reqId:e}):j?j.execute(q,e):"undefined"!=typeof window&&console.log("--getNavigationItemMode-isUnknown")},q,J),fe=d(function(e){var n=D&&D[H];T&&T[H]?T[H](e):n?D[H].postMessage({reqId:e}):j?console.log("--getUserStepInfo-isWeb"):"undefined"!=typeof window&&console.log("--getUserStepInfo-isUnknown")},H,J),ge=L("isESimSupported"),we=L("activateESim",{transformToObject:function(e){return{activationCode:e[0]}}}),pe=L("readNFCData"),ve=L("readNFCPassport",{transformToObject:function(e){return{passportNumber:e[0],dateOfBirth:e[1],expirationDate:e[2]}}}),me=L("subscribeUserStepInfo"),ke=L("unsubscribeUserStepInfo"),ye=L("openUserProfile"),be=L("openSettings"),Me=L("closeApplication"),Ie=L("enableSwipeBack"),Se=L("disableSwipeBack");return{version:"0.8.0-canary.4",copyToClipboard:Y,invoke:V,storage:Q,getMe:function(){return V(n.getMe)},getPhone:function(){return V(n.getPhone)},getContacts:function(){return V(n.getContacts)},getGeo:W,getQr:_,getSMSCode:R,getUserProfile:function(e){return V(n.getUserProfile,{id:e})},openUserProfile:ye,selectContact:z,enableNotifications:function(){return V(n.enableNotifications)},disableNotifications:function(){return V(n.disableNotifications)},enablePrivateMessaging:function(e){return V(n.enablePrivateMessaging,{appId:e})},disablePrivateMessaging:function(e){return V(n.disablePrivateMessaging,{appId:e})},openSettings:be,closeApplication:Me,setTitle:X,share:K,shareImage:Z,shareFile:$,setShakeHandler:function(e){T&&T[k]||D&&D[k]||j?window.onAituBridgeShake=e:"undefined"!=typeof window&&console.log("--setShakeHandler-isUnknown")},setTabActiveHandler:function(e){T&&T[I]||D&&D[I]||j?window.onAituBridgeTabActive=e:"undefined"!=typeof window&&console.log("--setTabActiveHandler-isUnknown")},vibrate:ee,isSupported:function(){var e,n=D&&(null==(e=window.webkit)||null==(e=e.messageHandlers)?void 0:e.invoke);return Boolean(T||n||j)},supports:function(e){return!!T&&"function"==typeof T[e]||!!D&&!!D[e]&&"function"==typeof D[e].postMessage||!!j&&"function"==typeof j[e]},sub:J,enableScreenCapture:ne,disableScreenCapture:oe,setHeaderMenuItems:te,setHeaderMenuItemClickHandler:function(e){T&&T[C]||D&&D[C]||j?window.onAituBridgeHeaderMenuItemClick=e:"undefined"!=typeof window&&console.log("--setHeaderMenuItemClickHandler-isUnknown")},setCustomBackArrowMode:re,getCustomBackArrowMode:ie,setCustomBackArrowVisible:se,openPayment:ae,setCustomBackArrowOnClickHandler:function(e){T&&T[P]||D&&D[P]||j?window.onAituBridgeBackArrowClick=e:"undefined"!=typeof window&&console.log("--setCustomBackArrowOnClickHandler-isUnknown")},checkBiometry:de,openExternalUrl:ce,enableSwipeBack:Ie,disableSwipeBack:Se,setNavigationItemMode:ue,getNavigationItemMode:le,getUserStepInfo:fe,isESimSupported:ge,activateESim:we,readNFCData:pe,subscribeUserStepInfo:me,unsubscribeUserStepInfo:ke,readNFCPassport:ve}}();exports.classifyBridgeError=function(e){if(e.msg){if(e.msg.startsWith("permission deny"))return exports.BridgeErrors.PermissionDenyError;if(e.msg.startsWith("permission security deny"))return exports.BridgeErrors.PermissionSecurityDenyError}return exports.BridgeErrors.OtherError},exports.default=c;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/index.modern.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function e(){return e=Object.assign?Object.assign.bind():function(e){for(var o=1;o<arguments.length;o++){var n=arguments[o];for(var t in n)({}).hasOwnProperty.call(n,t)&&(e[t]=n[t])}return e},e.apply(null,arguments)}function o(e){const o=function(e="m:"){return{current:0,next(){return e+ ++this.current}}}(e),n={};return{add(e,t=""){const s=t+o.next();return n[s]=e,s},resolve(e,o,t,s){const i=n[e];i&&(t(s)?i.resolve(o):i.reject(s),n[e]=null)}}}function n(e,o){e(e=>{if(e.detail&&"reqId"in e.detail){const{reqId:n,data:t,error:s}=e.detail;n&&o.resolve(n,t,e=>!e,s)}})}function t(e,t,s){const i=o(t+":");return n(s,i),function(...o){return new Promise((n,t)=>{const s=i.add({resolve:n,reject:t});e(s,...o)})}}let s=new URLSearchParams(window.location.search).get("__aitu-domain");s?localStorage.setItem("mini-app-domain",s):s=localStorage.getItem("mini-app-domain");let i=null;s&&(i={origin:s,execute:(e,o,...n)=>{window.top.postMessage({source:"aitu-bridge",method:e,reqId:o,payload:[...n]},i.origin)}},window.addEventListener("message",e=>{if(e.origin===s&&e.data){if(window.dispatchEvent(new CustomEvent("aituEvents",{detail:e.data})),"string"!=typeof e.data||""===e.data)return;try{const o=JSON.parse(e.data);o&&o.method&&("setCustomBackArrowOnClickHandler"===o.method?window.onAituBridgeBackArrowClick():"setHeaderMenuItemClickHandler"===o.method&&window.onAituBridgeHeaderMenuItemClick(o.param))}catch(e){console.log("Error parsing message data: "+e)}}}));var r,a=i;!function(e){e[e.PermissionDenyError=0]="PermissionDenyError",e[e.PermissionSecurityDenyError=1]="PermissionSecurityDenyError",e[e.OtherError=2]="OtherError"}(r||(r={}));const d=e=>{if(e.msg){if(e.msg.startsWith("permission deny"))return r.PermissionDenyError;if(e.msg.startsWith("permission security deny"))return r.PermissionSecurityDenyError}return r.OtherError};var c,l,u;!function(e){e.getMe="GetMe",e.getPhone="GetPhone",e.getContacts="GetContacts",e.getUserProfile="GetUserProfile",e.enableNotifications="AllowNotifications",e.disableNotifications="DisableNotifications",e.enablePrivateMessaging="EnablePrivateMessaging",e.disablePrivateMessaging="DisablePrivateMessaging"}(c||(c={})),function(e){e.Search="Search",e.ShoppingCart="ShoppingCart",e.Menu="Menu",e.Share="Share",e.Notifications="Notifications",e.Help="Help",e.Error="Error",e.Person="Person",e.Sort="Sort",e.Filter="Filter",e.Close="Close",e.SystemNotifications="SystemNotifications"}(l||(l={})),function(e){e.SystemBackArrow="SystemBackArrow",e.CustomBackArrow="CustomBackArrow",e.NoItem="NoItem",e.UserProfile="UserProfile"}(u||(u={}));const w="invoke",g="storage",p="getGeo",f="getQr",m="getSMSCode",k="selectContact",y="openSettings",M="closeApplication",b="share",I="setTitle",S="copyToClipboard",C="shareFile",v="setShakeHandler",h="vibrate",U="enableScreenCapture",x="disableScreenCapture",P="setTabActiveHandler",A="setHeaderMenuItems",B="setHeaderMenuItemClickHandler",q="setCustomBackArrowMode",N="getCustomBackArrowMode",H="setCustomBackArrowVisible",E="openPayment",O="setCustomBackArrowOnClickHandler",D="checkBiometry",T="openExternalUrl",j="enableSwipeBack",F="disableSwipeBack",G="setNavigationItemMode",J="getNavigationItemMode",V="getUserStepInfo",W="undefined"!=typeof window&&window.AndroidBridge,L="undefined"!=typeof window&&window.webkit&&window.webkit.messageHandlers,Q="undefined"!=typeof window&&window.top!==window&&a,_=(()=>{const s=[];"undefined"!=typeof window&&window.addEventListener("aituEvents",e=>{[...s].map(o=>o.call(null,e))});const i=e=>{s.push(e)},r=(o,n)=>t((t,...s)=>{const i=!!L&&!!L[o],r=!(null==n||!n.isWebSupported||!Q);W&&W[o]?W[o](t,...s):i?L[o].postMessage(e({reqId:t},null==n||null==n.transformToObject?void 0:n.transformToObject(s))):r?Q.execute(o,t,...s):"undefined"!=typeof window&&console.log(`--${o}-isUnknown`)},o,i),a=function(e,t){const s=o("invoke:");return n(t,s),function(e,o={}){return new Promise((n,t)=>{((e,o,n={})=>{const t=L&&L[w];W&&W[w]?W[w](e,o,JSON.stringify(n)):t?L[w].postMessage({reqId:e,method:o,data:n}):Q?Q.execute(w,e,o,n):"undefined"!=typeof window&&console.log("--invoke-isUnknown")})(s.add({resolve:n,reject:t},e+":"),e,o)})}}(0,i),d=function(e,t){const s=o("storage:");return n(t,s),{setItem:(o,n)=>new Promise((t,i)=>{const r=s.add({resolve:t,reject:i});e(r,"setItem",{keyName:o,keyValue:n})}),getItem:o=>new Promise((n,t)=>{const i=s.add({resolve:n,reject:t});e(i,"getItem",{keyName:o})}),clear:()=>new Promise((o,n)=>{const t=s.add({resolve:o,reject:n});e(t,"clear",{})})}}((e,o,n={})=>{const t=L&&L[g];W&&W[g]?W[g](e,o,JSON.stringify(n)):t?L[g].postMessage({reqId:e,method:o,data:n}):Q?Q.execute(g,e,o,n):"undefined"!=typeof window&&console.log("--storage-isUnknown")},i),l=t(e=>{const o=L&&L[p];W&&W[p]?W[p](e):o?L[p].postMessage({reqId:e}):Q?Q.execute(p,e):"undefined"!=typeof window&&console.log("--getGeo-isUnknown")},p,i),u=t(e=>{const o=L&&L[f];W&&W[f]?W[f](e):o?L[f].postMessage({reqId:e}):Q?Q.execute(f,e):"undefined"!=typeof window&&console.log("--getQr-isUnknown")},f,i),_=t(e=>{const o=L&&L[m];W&&W[m]?W[m](e):o?L[m].postMessage({reqId:e}):Q?Q.execute(m,e):"undefined"!=typeof window&&console.log("--getSMSCode-isUnknown")},m,i),R=t(e=>{const o=L&&L[k];W&&W[k]?W[k](e):o?L[k].postMessage({reqId:e}):Q?Q.execute(k,e):"undefined"!=typeof window&&console.log("--selectContact-isUnknown")},k,i),$=t(e=>{const o=L&&L[y];W&&W[y]?W[y](e):o?L[y].postMessage({reqId:e}):Q?Q.execute(y,e):"undefined"!=typeof window&&console.log("--openSettings-isUnknown")},y,i),z=t(e=>{const o=L&&L[M];W&&W[M]?W[M](e):o?L[M].postMessage({reqId:e}):Q?Q.execute(M,e):"undefined"!=typeof window&&console.log("--closeApplication-isUnknown")},M,i),K=t((e,o)=>{const n=L&&L[b];W&&W[b]?W[b](e,o):n?L[b].postMessage({reqId:e,text:o}):Q?Q.execute(b,e,o):"undefined"!=typeof window&&console.log("--share-isUnknown")},b,i),X=t((e,o)=>{const n=L&&L[I];W&&W[I]?W[I](e,o):n?L[I].postMessage({reqId:e,text:o}):Q?Q.execute(I,e,o):"undefined"!=typeof window&&console.log("--setTitle-isUnknown")},I,i),Y=t((e,o)=>{const n=L&&L[S];W&&W[S]?W[S](e,o):n?L[S].postMessage({reqId:e,text:o}):Q?Q.execute(S,e,o):"undefined"!=typeof window&&console.log("--copyToClipboard-isUnknown")},S,i),Z=t((e,o,n)=>{const t=W&&W[C],s=L&&L[C],i="image."+n.split(";")[0].split("/")[1],r=n.substr(n.indexOf(",")+1);t?W[C](e,o,i,r):s?L[C].postMessage({reqId:e,text:o,filename:i,base64Data:r}):Q?Q.execute(C,e,{text:o,filename:i,base64Data:r}):"undefined"!=typeof window&&console.log("--shareFile-isUnknown")},"shareImage",i),ee=t((e,o,n,t)=>{const s=L&&L[C];W&&W[C]?W[C](e,o,n,t):s?L[C].postMessage({reqId:e,text:o,filename:n,base64Data:t}):Q?Q.execute(C,e,o,n,t):"undefined"!=typeof window&&console.log("--shareFile-isUnknown")},C,i),oe=t((e,o)=>{if(!Array.isArray(o)||o.some(e=>e<1||e!==Math.floor(e))||o.reduce((e,o)=>e+o)>1e4)return void console.error("Pattern should be an array of positive integers no longer than 10000ms total");const n=L&&L[h];W&&W[h]?W[h](e,JSON.stringify(o)):n?L[h].postMessage({reqId:e,pattern:o}):Q?Q.execute(h,e,o):"undefined"!=typeof window&&console.log("--vibrate-isUnknown")},h,i),ne=t(e=>{const o=L&&L[U];W&&W[U]?W[U](e):o?L[U].postMessage({reqId:e}):Q?Q.execute(U,e):"undefined"!=typeof window&&console.log("--enableScreenCapture-isUnknown")},U,i),te=t(e=>{const o=L&&L[x];W&&W[x]?W[x](e):o?L[x].postMessage({reqId:e}):Q?Q.execute(x,e):"undefined"!=typeof window&&console.log("--disableScreenCapture-isUnknown")},x,i),se=t((e,o)=>{if(o.length>3)return void console.error("SetHeaderMenuItems: items count should not be more than 3");const n=W&&W[A],t=L&&L[A],s=JSON.stringify(o);n?W[A](e,s):t?L[A].postMessage({reqId:e,itemsJsonArray:s}):Q?Q.execute(A,e,s):"undefined"!=typeof window&&console.log("--setHeaderMenuItems-isUnknown")},A,i),ie=t((e,o)=>{const n=L&&L[q];W&&W[q]?W[q](e,o):n?L[q].postMessage({reqId:e,enabled:o}):Q?Q.execute(q,e,o):"undefined"!=typeof window&&console.log("--setCustomBackArrowMode-isUnknown")},q,i),re=t(e=>{const o=L&&L[N];W&&W[N]?W[N](e):o?L[N].postMessage({reqId:e}):Q?Q.execute(N,e):"undefined"!=typeof window&&console.log("--getCustomBackArrowMode-isUnknown")},N,i),ae=t((e,o)=>{const n=L&&L[H];W&&W[H]?W[H](e,o):n?L[H].postMessage({reqId:e,visible:o}):Q?Q.execute(H,e,o):"undefined"!=typeof window&&console.log("--setCustomBackArrowVisible-isUnknown")},H,i),de=t((e,o)=>{const n=L&&L[E];W&&W[E]?W[E](e,o):n?L[E].postMessage({reqId:e,transactionId:o}):console.log("--openPayment-isUnknown")},E,i),ce=t(e=>{const o=L&&L[D];W&&W[D]?W[D](e):o?L[D].postMessage({reqId:e}):Q?Q.execute(D,e):"undefined"!=typeof window&&console.log("--checkBiometry-isUnknown")},D,i),le=t((e,o)=>{const n=L&&L[T];W&&W[T]?W[T](e,o):n?L[T].postMessage({reqId:e,url:o}):console.log("--openExternalUrlMethod-isUnknown")},T,i),ue=t(e=>{const o=L&&L[j];W&&W[j]?W[j](e):o?L[j].postMessage({reqId:e}):Q?Q.execute(j,e):"undefined"!=typeof window&&console.log("--enableSwipeBack-isUnknown")},j,i),we=t(e=>{const o=L&&L[F];W&&W[F]?W[F](e):o?L[F].postMessage({reqId:e}):Q?Q.execute(F,e):"undefined"!=typeof window&&console.log("--disableSwipeBack-isUnknown")},F,i),ge=t((e,o)=>{const n=L&&L[G];W&&W[G]?W[G](e,o):n?L[G].postMessage({reqId:e,mode:o}):Q?Q.execute(G,e,o):"undefined"!=typeof window&&console.log("--setNavigationItemMode-isUnknown")},G,i),pe=t(e=>{const o=L&&L[J];W&&W[J]?W[J](e):o?L[J].postMessage({reqId:e}):Q?Q.execute(J,e):"undefined"!=typeof window&&console.log("--getNavigationItemMode-isUnknown")},J,i),fe=t(e=>{const o=L&&L[V];W&&W[V]?W[V](e):o?L[V].postMessage({reqId:e}):Q?console.log("--getUserStepInfo-isWeb"):"undefined"!=typeof window&&console.log("--getUserStepInfo-isUnknown")},V,i),me=r("isESimSupported"),ke=r("activateESim",{transformToObject:([e])=>({activationCode:e})}),ye=r("readNFCData"),Me=r("readNFCPassport",{transformToObject:([e,o,n])=>({passportNumber:e,dateOfBirth:o,expirationDate:n})}),be=r("subscribeUserStepInfo"),Ie=r("unsubscribeUserStepInfo"),Se=r("openUserProfile");return{version:"0.7.2-canary.2",copyToClipboard:Y,invoke:a,storage:d,getMe:()=>a(c.getMe),getPhone:()=>a(c.getPhone),getContacts:()=>a(c.getContacts),getGeo:l,getQr:u,getSMSCode:_,getUserProfile:e=>a(c.getUserProfile,{id:e}),openUserProfile:Se,selectContact:R,enableNotifications:()=>a(c.enableNotifications),disableNotifications:()=>a(c.disableNotifications),enablePrivateMessaging:e=>a(c.enablePrivateMessaging,{appId:e}),disablePrivateMessaging:e=>a(c.disablePrivateMessaging,{appId:e}),openSettings:$,closeApplication:z,setTitle:X,share:K,shareImage:Z,shareFile:ee,setShakeHandler:e=>{W&&W[v]||L&&L[v]||Q?window.onAituBridgeShake=e:"undefined"!=typeof window&&console.log("--setShakeHandler-isUnknown")},setTabActiveHandler:e=>{W&&W[P]||L&&L[P]||Q?window.onAituBridgeTabActive=e:"undefined"!=typeof window&&console.log("--setTabActiveHandler-isUnknown")},vibrate:oe,isSupported:()=>{const e=L&&window.webkit.messageHandlers.invoke;return Boolean(W||e||Q)},supports:e=>W&&"function"==typeof W[e]||L&&L[e]&&"function"==typeof L[e].postMessage||Q&&"function"==typeof Q[e],sub:i,enableScreenCapture:ne,disableScreenCapture:te,setHeaderMenuItems:se,setHeaderMenuItemClickHandler:e=>{W&&W[B]||L&&L[B]||Q?window.onAituBridgeHeaderMenuItemClick=e:"undefined"!=typeof window&&console.log("--setHeaderMenuItemClickHandler-isUnknown")},setCustomBackArrowMode:ie,getCustomBackArrowMode:re,setCustomBackArrowVisible:ae,openPayment:de,setCustomBackArrowOnClickHandler:e=>{W&&W[O]||L&&L[O]||Q?window.onAituBridgeBackArrowClick=e:"undefined"!=typeof window&&console.log("--setCustomBackArrowOnClickHandler-isUnknown")},checkBiometry:ce,openExternalUrl:le,enableSwipeBack:ue,disableSwipeBack:we,setNavigationItemMode:ge,getNavigationItemMode:pe,getUserStepInfo:fe,isESimSupported:me,activateESim:ke,readNFCData:ye,subscribeUserStepInfo:be,unsubscribeUserStepInfo:Ie,readNFCPassport:Me}})();export{r as BridgeErrors,l as HeaderMenuIcon,u as NavigationItemMode,d as classifyBridgeError,_ as default};
|
|
1
|
+
var e;!function(e){e[e.PermissionDenyError=0]="PermissionDenyError",e[e.PermissionSecurityDenyError=1]="PermissionSecurityDenyError",e[e.OtherError=2]="OtherError"}(e||(e={}));const n=n=>{if(n.msg){if(n.msg.startsWith("permission deny"))return e.PermissionDenyError;if(n.msg.startsWith("permission security deny"))return e.PermissionSecurityDenyError}return e.OtherError};function o(){return o=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var o=arguments[n];for(var t in o)({}).hasOwnProperty.call(o,t)&&(e[t]=o[t])}return e},o.apply(null,arguments)}function t(e="m:"){let n=0;return{next:()=>e+ ++n}}function s(e){const n=t(e),o={};return{add(e,t=""){const s=t+n.next();return o[s]=e,s},resolve(e,n,t,s){const i=o[e];i&&(t(s)?i.resolve(n):i.reject(s),o[e]=null)}}}function i(e,n){e(e=>{if(e.detail&&"reqId"in e.detail){const{reqId:o,data:t,error:s}=e.detail;o&&n.resolve(o,t,e=>!e,s)}})}function r(e,n,o){const t=s(n+":");return i(o,t),function(...n){return new Promise((o,s)=>{const i=t.add({resolve:o,reject:s});e(i,...n)})}}var a,d,c;!function(e){e.getMe="GetMe",e.getPhone="GetPhone",e.getContacts="GetContacts",e.getUserProfile="GetUserProfile",e.enableNotifications="AllowNotifications",e.disableNotifications="DisableNotifications",e.enablePrivateMessaging="EnablePrivateMessaging",e.disablePrivateMessaging="DisablePrivateMessaging"}(a||(a={})),function(e){e.Search="Search",e.ShoppingCart="ShoppingCart",e.Menu="Menu",e.Share="Share",e.Notifications="Notifications",e.Help="Help",e.Error="Error",e.Person="Person",e.Sort="Sort",e.Filter="Filter",e.Close="Close",e.SystemNotifications="SystemNotifications"}(d||(d={})),function(e){e.SystemBackArrow="SystemBackArrow",e.CustomBackArrow="CustomBackArrow",e.NoItem="NoItem",e.UserProfile="UserProfile"}(c||(c={}));const l=(()=>{const e="invoke",n="storage",d="getGeo",c="getQr",l="getSMSCode",u="selectContact",w="share",g="setTitle",p="copyToClipboard",f="shareFile",m="setShakeHandler",k="vibrate",y="enableScreenCapture",b="disableScreenCapture",M="setTabActiveHandler",I="setHeaderMenuItems",v="setHeaderMenuItemClickHandler",S="setCustomBackArrowMode",C="getCustomBackArrowMode",h="setCustomBackArrowVisible",U="openPayment",P="setCustomBackArrowOnClickHandler",A="checkBiometry",x="openExternalUrl",B="setNavigationItemMode",N="getNavigationItemMode",E="getUserStepInfo",q="undefined"!=typeof window,H=q&&window.AndroidBridge,O=q&&window.webkit&&window.webkit.messageHandlers,T=q&&function(){if(!globalThis.window)return!1;try{return window.self!==window.top}catch(e){return!0}}()&&(()=>{let e=new URLSearchParams(window.location.search).get("__aitu-domain"),n=null;return e?localStorage.setItem("mini-app-domain",e):e=localStorage.getItem("mini-app-domain"),e?(n={origin:e,execute:(n,o,...t)=>{var s;null==(s=window)||null==(s=s.top)||s.postMessage({source:"aitu-bridge",method:n,reqId:o,payload:[...t]},e)}},window.addEventListener("message",n=>{if(n.origin===e&&n.data){if(window.dispatchEvent(new CustomEvent("aituEvents",{detail:n.data})),"string"!=typeof n.data||""===n.data)return;try{const e=JSON.parse(n.data);e&&e.method&&("setCustomBackArrowOnClickHandler"===e.method?null==window.onAituBridgeBackArrowClick||window.onAituBridgeBackArrowClick():"setHeaderMenuItemClickHandler"===e.method&&(null==window.onAituBridgeHeaderMenuItemClick||window.onAituBridgeHeaderMenuItemClick(e.param)))}catch(e){console.log("Error parsing message data: "+e)}}}),n):null})(),D=[];q&&window.addEventListener("aituEvents",e=>{[...D].map(n=>n.call(null,e))});const j=e=>{D.push(e)},F=(e,n)=>{const s=t(e+":");return(...t)=>{const i=s.next(),r=!!O&&!!O[e],a=!!T;return H&&H[e]?H[e](i,...t):r?O[e].postMessage(o({reqId:i},null==n||null==n.transformToObject?void 0:n.transformToObject(t))):a?T.execute(e,i,...t):"undefined"!=typeof window&&console.log(`--${e}-isUnknown`),(e=>new Promise((n,o)=>{const t=s=>{var i;if((null==(i=s.detail)?void 0:i.reqId)!==e)return;const{data:r,error:a}=s.detail;r?n(r):o(a),window.removeEventListener("aituEvents",t)};window.addEventListener("aituEvents",t)}))(i)}},G=function(n,o){const t=s("invoke:");return i(o,t),function(n,o={}){return new Promise((s,i)=>{((n,o,t={})=>{const s=O&&O[e];H&&H[e]?H[e](n,o,JSON.stringify(t)):s?O[e].postMessage({reqId:n,method:o,data:t}):T?T.execute(e,n,o,t):"undefined"!=typeof window&&console.log("--invoke-isUnknown")})(t.add({resolve:s,reject:i},n+":"),n,o)})}}(0,j),J=function(e,n){const o=s("storage:");return i(n,o),{setItem:(n,t)=>new Promise((s,i)=>{const r=o.add({resolve:s,reject:i});e(r,"setItem",{keyName:n,keyValue:t})}),getItem:n=>new Promise((t,s)=>{const i=o.add({resolve:t,reject:s});e(i,"getItem",{keyName:n})}),clear:()=>new Promise((n,t)=>{const s=o.add({resolve:n,reject:t});e(s,"clear",{})})}}((e,o,t={})=>{const s=O&&O[n];H&&H[n]?H[n](e,o,JSON.stringify(t)):s?O[n].postMessage({reqId:e,method:o,data:t}):T?T.execute(n,e,o,t):"undefined"!=typeof window&&console.log("--storage-isUnknown")},j),L=r(e=>{const n=O&&O[d];H&&H[d]?H[d](e):n?O[d].postMessage({reqId:e}):T?T.execute(d,e):"undefined"!=typeof window&&console.log("--getGeo-isUnknown")},d,j),V=r(e=>{const n=O&&O[c];H&&H[c]?H[c](e):n?O[c].postMessage({reqId:e}):T?T.execute(c,e):"undefined"!=typeof window&&console.log("--getQr-isUnknown")},c,j),Q=r(e=>{const n=O&&O[l];H&&H[l]?H[l](e):n?O[l].postMessage({reqId:e}):T?T.execute(l,e):"undefined"!=typeof window&&console.log("--getSMSCode-isUnknown")},l,j),W=r(e=>{const n=O&&O[u];H&&H[u]?H[u](e):n?O[u].postMessage({reqId:e}):T?T.execute(u,e):"undefined"!=typeof window&&console.log("--selectContact-isUnknown")},u,j),_=r((e,n)=>{const o=O&&O[w];H&&H[w]?H[w](e,n):o?O[w].postMessage({reqId:e,text:n}):T?T.execute(w,e,n):"undefined"!=typeof window&&console.log("--share-isUnknown")},w,j),R=r((e,n)=>{const o=O&&O[g];H&&H[g]?H[g](e,n):o?O[g].postMessage({reqId:e,text:n}):T?T.execute(g,e,n):"undefined"!=typeof window&&console.log("--setTitle-isUnknown")},g,j),$=r((e,n)=>{const o=O&&O[p];H&&H[p]?H[p](e,n):o?O[p].postMessage({reqId:e,text:n}):T?T.execute(p,e,n):"undefined"!=typeof window&&console.log("--copyToClipboard-isUnknown")},p,j),z=r((e,n,o)=>{var t,s;const i=H&&H[f],r=O&&O[f],a="image."+(null!=(t=null==(s=o.split(";"))||null==(s=s[0])?void 0:s.split("/")[1])?t:""),d=o.substr(o.indexOf(",")+1);i?H[f](e,n,a,d):r?O[f].postMessage({reqId:e,text:n,filename:a,base64Data:d}):T?T.execute(f,e,{text:n,filename:a,base64Data:d}):"undefined"!=typeof window&&console.log("--shareFile-isUnknown")},"shareImage",j),K=r((e,n,o,t)=>{const s=O&&O[f];H&&H[f]?H[f](e,n,o,t):s?O[f].postMessage({reqId:e,text:n,filename:o,base64Data:t}):T?T.execute(f,e,n,o,t):"undefined"!=typeof window&&console.log("--shareFile-isUnknown")},f,j),X=r((e,n)=>{if(!Array.isArray(n)||n.some(e=>e<1||e!==Math.floor(e))||n.reduce((e,n)=>e+n)>1e4)return void console.error("Pattern should be an array of positive integers no longer than 10000ms total");const o=O&&O[k];H&&H[k]?H[k](e,JSON.stringify(n)):o?O[k].postMessage({reqId:e,pattern:n}):T?T.execute(k,e,n):"undefined"!=typeof window&&console.log("--vibrate-isUnknown")},k,j),Y=r(e=>{const n=O&&O[y];H&&H[y]?H[y](e):n?O[y].postMessage({reqId:e}):T?T.execute(y,e):"undefined"!=typeof window&&console.log("--enableScreenCapture-isUnknown")},y,j),Z=r(e=>{const n=O&&O[b];H&&H[b]?H[b](e):n?O[b].postMessage({reqId:e}):T?T.execute(b,e):"undefined"!=typeof window&&console.log("--disableScreenCapture-isUnknown")},b,j),ee=r((e,n)=>{if(n.length>3)return void console.error("SetHeaderMenuItems: items count should not be more than 3");const o=H&&H[I],t=O&&O[I],s=JSON.stringify(n);o?H[I](e,s):t?O[I].postMessage({reqId:e,itemsJsonArray:s}):T?T.execute(I,e,s):"undefined"!=typeof window&&console.log("--setHeaderMenuItems-isUnknown")},I,j),ne=r((e,n)=>{const o=O&&O[S];H&&H[S]?H[S](e,n):o?O[S].postMessage({reqId:e,enabled:n}):T?T.execute(S,e,n):"undefined"!=typeof window&&console.log("--setCustomBackArrowMode-isUnknown")},S,j),oe=r(e=>{const n=O&&O[C];H&&H[C]?H[C](e):n?O[C].postMessage({reqId:e}):T?T.execute(C,e):"undefined"!=typeof window&&console.log("--getCustomBackArrowMode-isUnknown")},C,j),te=r((e,n)=>{const o=O&&O[h];H&&H[h]?H[h](e,n):o?O[h].postMessage({reqId:e,visible:n}):T?T.execute(h,e,n):"undefined"!=typeof window&&console.log("--setCustomBackArrowVisible-isUnknown")},h,j),se=r((e,n)=>{const o=O&&O[U];H&&H[U]?H[U](e,n):o?O[U].postMessage({reqId:e,transactionId:n}):console.log("--openPayment-isUnknown")},U,j),ie=r(e=>{const n=O&&O[A];H&&H[A]?H[A](e):n?O[A].postMessage({reqId:e}):T?T.execute(A,e):"undefined"!=typeof window&&console.log("--checkBiometry-isUnknown")},A,j),re=r((e,n)=>{const o=O&&O[x];H&&H[x]?H[x](e,n):o?O[x].postMessage({reqId:e,url:n}):console.log("--openExternalUrlMethod-isUnknown")},x,j),ae=r((e,n)=>{const o=O&&O[B];H&&H[B]?H[B](e,n):o?O[B].postMessage({reqId:e,mode:n}):T?T.execute(B,e,n):"undefined"!=typeof window&&console.log("--setNavigationItemMode-isUnknown")},B,j),de=r(e=>{const n=O&&O[N];H&&H[N]?H[N](e):n?O[N].postMessage({reqId:e}):T?T.execute(N,e):"undefined"!=typeof window&&console.log("--getNavigationItemMode-isUnknown")},N,j),ce=r(e=>{const n=O&&O[E];H&&H[E]?H[E](e):n?O[E].postMessage({reqId:e}):T?console.log("--getUserStepInfo-isWeb"):"undefined"!=typeof window&&console.log("--getUserStepInfo-isUnknown")},E,j),le=F("isESimSupported"),ue=F("activateESim",{transformToObject:([e])=>({activationCode:e})}),we=F("readNFCData"),ge=F("readNFCPassport",{transformToObject:([e,n,o])=>({passportNumber:e,dateOfBirth:n,expirationDate:o})}),pe=F("subscribeUserStepInfo"),fe=F("unsubscribeUserStepInfo"),me=F("openUserProfile"),ke=F("openSettings"),ye=F("closeApplication"),be=F("enableSwipeBack"),Me=F("disableSwipeBack");return{version:"0.8.0-canary.4",copyToClipboard:$,invoke:G,storage:J,getMe:()=>G(a.getMe),getPhone:()=>G(a.getPhone),getContacts:()=>G(a.getContacts),getGeo:L,getQr:V,getSMSCode:Q,getUserProfile:e=>G(a.getUserProfile,{id:e}),openUserProfile:me,selectContact:W,enableNotifications:()=>G(a.enableNotifications),disableNotifications:()=>G(a.disableNotifications),enablePrivateMessaging:e=>G(a.enablePrivateMessaging,{appId:e}),disablePrivateMessaging:e=>G(a.disablePrivateMessaging,{appId:e}),openSettings:ke,closeApplication:ye,setTitle:R,share:_,shareImage:z,shareFile:K,setShakeHandler:e=>{H&&H[m]||O&&O[m]||T?window.onAituBridgeShake=e:"undefined"!=typeof window&&console.log("--setShakeHandler-isUnknown")},setTabActiveHandler:e=>{H&&H[M]||O&&O[M]||T?window.onAituBridgeTabActive=e:"undefined"!=typeof window&&console.log("--setTabActiveHandler-isUnknown")},vibrate:X,isSupported:()=>{var e;const n=O&&(null==(e=window.webkit)||null==(e=e.messageHandlers)?void 0:e.invoke);return Boolean(H||n||T)},supports:e=>!!H&&"function"==typeof H[e]||!!O&&!!O[e]&&"function"==typeof O[e].postMessage||!!T&&"function"==typeof T[e],sub:j,enableScreenCapture:Y,disableScreenCapture:Z,setHeaderMenuItems:ee,setHeaderMenuItemClickHandler:e=>{H&&H[v]||O&&O[v]||T?window.onAituBridgeHeaderMenuItemClick=e:"undefined"!=typeof window&&console.log("--setHeaderMenuItemClickHandler-isUnknown")},setCustomBackArrowMode:ne,getCustomBackArrowMode:oe,setCustomBackArrowVisible:te,openPayment:se,setCustomBackArrowOnClickHandler:e=>{H&&H[P]||O&&O[P]||T?window.onAituBridgeBackArrowClick=e:"undefined"!=typeof window&&console.log("--setCustomBackArrowOnClickHandler-isUnknown")},checkBiometry:ie,openExternalUrl:re,enableSwipeBack:be,disableSwipeBack:Me,setNavigationItemMode:ae,getNavigationItemMode:de,getUserStepInfo:ce,isESimSupported:le,activateESim:ue,readNFCData:we,subscribeUserStepInfo:pe,unsubscribeUserStepInfo:fe,readNFCPassport:ge}})();export{e as BridgeErrors,n as classifyBridgeError,l as default};
|
|
2
2
|
//# sourceMappingURL=index.modern.mjs.map
|
package/dist/index.module.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function e(){return e=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var o=arguments[n];for(var t in o)({}).hasOwnProperty.call(o,t)&&(e[t]=o[t])}return e},e.apply(null,arguments)}function n(e){var n=function(e){return void 0===e&&(e="m:"),{current:0,next:function(){return e+ ++this.current}}}(e),o={};return{add:function(e,t){void 0===t&&(t="");var i=t+n.next();return o[i]=e,i},resolve:function(e,n,t,i){var r=o[e];r&&(t(i)?r.resolve(n):r.reject(i),o[e]=null)}}}function o(e,n){e(function(e){if(e.detail&&"reqId"in e.detail){var o=e.detail,t=o.reqId;t&&n.resolve(t,o.data,function(e){return!e},o.error)}})}function t(e,t,i){var r=n(t+":");return o(i,r),function(){var n=arguments;return new Promise(function(o,t){var i=r.add({resolve:o,reject:t});e.apply(void 0,[i].concat([].slice.call(n)))})}}var i=new URLSearchParams(window.location.search).get("__aitu-domain");i?localStorage.setItem("mini-app-domain",i):i=localStorage.getItem("mini-app-domain");var r=null;i&&(r={origin:i,execute:function(e,n){window.top.postMessage({source:"aitu-bridge",method:e,reqId:n,payload:[].concat([].slice.call(arguments,2))},r.origin)}},window.addEventListener("message",function(e){if(e.origin===i&&e.data){if(window.dispatchEvent(new CustomEvent("aituEvents",{detail:e.data})),"string"!=typeof e.data||""===e.data)return;try{var n=JSON.parse(e.data);n&&n.method&&("setCustomBackArrowOnClickHandler"===n.method?window.onAituBridgeBackArrowClick():"setHeaderMenuItemClickHandler"===n.method&&window.onAituBridgeHeaderMenuItemClick(n.param))}catch(e){console.log("Error parsing message data: "+e)}}}));var s,a=r;!function(e){e[e.PermissionDenyError=0]="PermissionDenyError",e[e.PermissionSecurityDenyError=1]="PermissionSecurityDenyError",e[e.OtherError=2]="OtherError"}(s||(s={}));var c,d,u,l=function(e){if(e.msg){if(e.msg.startsWith("permission deny"))return s.PermissionDenyError;if(e.msg.startsWith("permission security deny"))return s.PermissionSecurityDenyError}return s.OtherError};!function(e){e.getMe="GetMe",e.getPhone="GetPhone",e.getContacts="GetContacts",e.getUserProfile="GetUserProfile",e.enableNotifications="AllowNotifications",e.disableNotifications="DisableNotifications",e.enablePrivateMessaging="EnablePrivateMessaging",e.disablePrivateMessaging="DisablePrivateMessaging"}(c||(c={})),function(e){e.Search="Search",e.ShoppingCart="ShoppingCart",e.Menu="Menu",e.Share="Share",e.Notifications="Notifications",e.Help="Help",e.Error="Error",e.Person="Person",e.Sort="Sort",e.Filter="Filter",e.Close="Close",e.SystemNotifications="SystemNotifications"}(d||(d={})),function(e){e.SystemBackArrow="SystemBackArrow",e.CustomBackArrow="CustomBackArrow",e.NoItem="NoItem",e.UserProfile="UserProfile"}(u||(u={}));var f="invoke",w="storage",g="getGeo",p="getQr",m="getSMSCode",v="selectContact",k="openSettings",y="closeApplication",M="share",b="setTitle",I="copyToClipboard",S="shareFile",C="setShakeHandler",h="vibrate",U="enableScreenCapture",x="disableScreenCapture",P="setTabActiveHandler",A="setHeaderMenuItems",B="setHeaderMenuItemClickHandler",q="setCustomBackArrowMode",N="getCustomBackArrowMode",H="setCustomBackArrowVisible",E="openPayment",O="setCustomBackArrowOnClickHandler",D="checkBiometry",T="openExternalUrl",j="enableSwipeBack",F="disableSwipeBack",G="setNavigationItemMode",J="getNavigationItemMode",V="getUserStepInfo",W="undefined"!=typeof window&&window.AndroidBridge,L="undefined"!=typeof window&&window.webkit&&window.webkit.messageHandlers,Q="undefined"!=typeof window&&window.top!==window&&a,_=function(){var i=[];"undefined"!=typeof window&&window.addEventListener("aituEvents",function(e){[].concat(i).map(function(n){return n.call(null,e)})});var r,s=function(e){i.push(e)},a=function(n,o){return t(function(t){var i=[].slice.call(arguments,1),r=!!L&&!!L[n],s=!(null==o||!o.isWebSupported||!Q);W&&W[n]?W[n].apply(W,[t].concat(i)):r?L[n].postMessage(e({reqId:t},null==o||null==o.transformToObject?void 0:o.transformToObject(i))):s?Q.execute.apply(Q,[n,t].concat(i)):"undefined"!=typeof window&&console.log("--"+n+"-isUnknown")},n,s)},d=(o(s,r=n("invoke:")),function(e,n){return void 0===n&&(n={}),new Promise(function(o,t){!function(e,n,o){void 0===o&&(o={});var t=L&&L[f];W&&W[f]?W[f](e,n,JSON.stringify(o)):t?L[f].postMessage({reqId:e,method:n,data:o}):Q?Q.execute(f,e,n,o):"undefined"!=typeof window&&console.log("--invoke-isUnknown")}(r.add({resolve:o,reject:t},e+":"),e,n)})}),u=function(e,t){var i=n("storage:");return o(t,i),{setItem:function(n,o){return new Promise(function(t,r){var s=i.add({resolve:t,reject:r});e(s,"setItem",{keyName:n,keyValue:o})})},getItem:function(n){return new Promise(function(o,t){var r=i.add({resolve:o,reject:t});e(r,"getItem",{keyName:n})})},clear:function(){return new Promise(function(n,o){var t=i.add({resolve:n,reject:o});e(t,"clear",{})})}}}(function(e,n,o){void 0===o&&(o={});var t=L&&L[w];W&&W[w]?W[w](e,n,JSON.stringify(o)):t?L[w].postMessage({reqId:e,method:n,data:o}):Q?Q.execute(w,e,n,o):"undefined"!=typeof window&&console.log("--storage-isUnknown")},s),l=t(function(e){var n=L&&L[g];W&&W[g]?W[g](e):n?L[g].postMessage({reqId:e}):Q?Q.execute(g,e):"undefined"!=typeof window&&console.log("--getGeo-isUnknown")},g,s),_=t(function(e){var n=L&&L[p];W&&W[p]?W[p](e):n?L[p].postMessage({reqId:e}):Q?Q.execute(p,e):"undefined"!=typeof window&&console.log("--getQr-isUnknown")},p,s),R=t(function(e){var n=L&&L[m];W&&W[m]?W[m](e):n?L[m].postMessage({reqId:e}):Q?Q.execute(m,e):"undefined"!=typeof window&&console.log("--getSMSCode-isUnknown")},m,s),z=t(function(e){var n=L&&L[v];W&&W[v]?W[v](e):n?L[v].postMessage({reqId:e}):Q?Q.execute(v,e):"undefined"!=typeof window&&console.log("--selectContact-isUnknown")},v,s),K=t(function(e){var n=L&&L[k];W&&W[k]?W[k](e):n?L[k].postMessage({reqId:e}):Q?Q.execute(k,e):"undefined"!=typeof window&&console.log("--openSettings-isUnknown")},k,s),X=t(function(e){var n=L&&L[y];W&&W[y]?W[y](e):n?L[y].postMessage({reqId:e}):Q?Q.execute(y,e):"undefined"!=typeof window&&console.log("--closeApplication-isUnknown")},y,s),Y=t(function(e,n){var o=L&&L[M];W&&W[M]?W[M](e,n):o?L[M].postMessage({reqId:e,text:n}):Q?Q.execute(M,e,n):"undefined"!=typeof window&&console.log("--share-isUnknown")},M,s),Z=t(function(e,n){var o=L&&L[b];W&&W[b]?W[b](e,n):o?L[b].postMessage({reqId:e,text:n}):Q?Q.execute(b,e,n):"undefined"!=typeof window&&console.log("--setTitle-isUnknown")},b,s),$=t(function(e,n){var o=L&&L[I];W&&W[I]?W[I](e,n):o?L[I].postMessage({reqId:e,text:n}):Q?Q.execute(I,e,n):"undefined"!=typeof window&&console.log("--copyToClipboard-isUnknown")},I,s),ee=t(function(e,n,o){var t=W&&W[S],i=L&&L[S],r="image."+o.split(";")[0].split("/")[1],s=o.substr(o.indexOf(",")+1);t?W[S](e,n,r,s):i?L[S].postMessage({reqId:e,text:n,filename:r,base64Data:s}):Q?Q.execute(S,e,{text:n,filename:r,base64Data:s}):"undefined"!=typeof window&&console.log("--shareFile-isUnknown")},"shareImage",s),ne=t(function(e,n,o,t){var i=L&&L[S];W&&W[S]?W[S](e,n,o,t):i?L[S].postMessage({reqId:e,text:n,filename:o,base64Data:t}):Q?Q.execute(S,e,n,o,t):"undefined"!=typeof window&&console.log("--shareFile-isUnknown")},S,s),oe=t(function(e,n){if(!Array.isArray(n)||n.some(function(e){return e<1||e!==Math.floor(e)})||n.reduce(function(e,n){return e+n})>1e4)console.error("Pattern should be an array of positive integers no longer than 10000ms total");else{var o=L&&L[h];W&&W[h]?W[h](e,JSON.stringify(n)):o?L[h].postMessage({reqId:e,pattern:n}):Q?Q.execute(h,e,n):"undefined"!=typeof window&&console.log("--vibrate-isUnknown")}},h,s),te=t(function(e){var n=L&&L[U];W&&W[U]?W[U](e):n?L[U].postMessage({reqId:e}):Q?Q.execute(U,e):"undefined"!=typeof window&&console.log("--enableScreenCapture-isUnknown")},U,s),ie=t(function(e){var n=L&&L[x];W&&W[x]?W[x](e):n?L[x].postMessage({reqId:e}):Q?Q.execute(x,e):"undefined"!=typeof window&&console.log("--disableScreenCapture-isUnknown")},x,s),re=t(function(e,n){if(n.length>3)console.error("SetHeaderMenuItems: items count should not be more than 3");else{var o=W&&W[A],t=L&&L[A],i=JSON.stringify(n);o?W[A](e,i):t?L[A].postMessage({reqId:e,itemsJsonArray:i}):Q?Q.execute(A,e,i):"undefined"!=typeof window&&console.log("--setHeaderMenuItems-isUnknown")}},A,s),se=t(function(e,n){var o=L&&L[q];W&&W[q]?W[q](e,n):o?L[q].postMessage({reqId:e,enabled:n}):Q?Q.execute(q,e,n):"undefined"!=typeof window&&console.log("--setCustomBackArrowMode-isUnknown")},q,s),ae=t(function(e){var n=L&&L[N];W&&W[N]?W[N](e):n?L[N].postMessage({reqId:e}):Q?Q.execute(N,e):"undefined"!=typeof window&&console.log("--getCustomBackArrowMode-isUnknown")},N,s),ce=t(function(e,n){var o=L&&L[H];W&&W[H]?W[H](e,n):o?L[H].postMessage({reqId:e,visible:n}):Q?Q.execute(H,e,n):"undefined"!=typeof window&&console.log("--setCustomBackArrowVisible-isUnknown")},H,s),de=t(function(e,n){var o=L&&L[E];W&&W[E]?W[E](e,n):o?L[E].postMessage({reqId:e,transactionId:n}):console.log("--openPayment-isUnknown")},E,s),ue=t(function(e){var n=L&&L[D];W&&W[D]?W[D](e):n?L[D].postMessage({reqId:e}):Q?Q.execute(D,e):"undefined"!=typeof window&&console.log("--checkBiometry-isUnknown")},D,s),le=t(function(e,n){var o=L&&L[T];W&&W[T]?W[T](e,n):o?L[T].postMessage({reqId:e,url:n}):console.log("--openExternalUrlMethod-isUnknown")},T,s),fe=t(function(e){var n=L&&L[j];W&&W[j]?W[j](e):n?L[j].postMessage({reqId:e}):Q?Q.execute(j,e):"undefined"!=typeof window&&console.log("--enableSwipeBack-isUnknown")},j,s),we=t(function(e){var n=L&&L[F];W&&W[F]?W[F](e):n?L[F].postMessage({reqId:e}):Q?Q.execute(F,e):"undefined"!=typeof window&&console.log("--disableSwipeBack-isUnknown")},F,s),ge=t(function(e,n){var o=L&&L[G];W&&W[G]?W[G](e,n):o?L[G].postMessage({reqId:e,mode:n}):Q?Q.execute(G,e,n):"undefined"!=typeof window&&console.log("--setNavigationItemMode-isUnknown")},G,s),pe=t(function(e){var n=L&&L[J];W&&W[J]?W[J](e):n?L[J].postMessage({reqId:e}):Q?Q.execute(J,e):"undefined"!=typeof window&&console.log("--getNavigationItemMode-isUnknown")},J,s),me=t(function(e){var n=L&&L[V];W&&W[V]?W[V](e):n?L[V].postMessage({reqId:e}):Q?console.log("--getUserStepInfo-isWeb"):"undefined"!=typeof window&&console.log("--getUserStepInfo-isUnknown")},V,s),ve=a("isESimSupported"),ke=a("activateESim",{transformToObject:function(e){return{activationCode:e[0]}}}),ye=a("readNFCData"),Me=a("readNFCPassport",{transformToObject:function(e){return{passportNumber:e[0],dateOfBirth:e[1],expirationDate:e[2]}}}),be=a("subscribeUserStepInfo"),Ie=a("unsubscribeUserStepInfo"),Se=a("openUserProfile");return{version:"0.7.2-canary.2",copyToClipboard:$,invoke:d,storage:u,getMe:function(){return d(c.getMe)},getPhone:function(){return d(c.getPhone)},getContacts:function(){return d(c.getContacts)},getGeo:l,getQr:_,getSMSCode:R,getUserProfile:function(e){return d(c.getUserProfile,{id:e})},openUserProfile:Se,selectContact:z,enableNotifications:function(){return d(c.enableNotifications)},disableNotifications:function(){return d(c.disableNotifications)},enablePrivateMessaging:function(e){return d(c.enablePrivateMessaging,{appId:e})},disablePrivateMessaging:function(e){return d(c.disablePrivateMessaging,{appId:e})},openSettings:K,closeApplication:X,setTitle:Z,share:Y,shareImage:ee,shareFile:ne,setShakeHandler:function(e){W&&W[C]||L&&L[C]||Q?window.onAituBridgeShake=e:"undefined"!=typeof window&&console.log("--setShakeHandler-isUnknown")},setTabActiveHandler:function(e){W&&W[P]||L&&L[P]||Q?window.onAituBridgeTabActive=e:"undefined"!=typeof window&&console.log("--setTabActiveHandler-isUnknown")},vibrate:oe,isSupported:function(){var e=L&&window.webkit.messageHandlers.invoke;return Boolean(W||e||Q)},supports:function(e){return W&&"function"==typeof W[e]||L&&L[e]&&"function"==typeof L[e].postMessage||Q&&"function"==typeof Q[e]},sub:s,enableScreenCapture:te,disableScreenCapture:ie,setHeaderMenuItems:re,setHeaderMenuItemClickHandler:function(e){W&&W[B]||L&&L[B]||Q?window.onAituBridgeHeaderMenuItemClick=e:"undefined"!=typeof window&&console.log("--setHeaderMenuItemClickHandler-isUnknown")},setCustomBackArrowMode:se,getCustomBackArrowMode:ae,setCustomBackArrowVisible:ce,openPayment:de,setCustomBackArrowOnClickHandler:function(e){W&&W[O]||L&&L[O]||Q?window.onAituBridgeBackArrowClick=e:"undefined"!=typeof window&&console.log("--setCustomBackArrowOnClickHandler-isUnknown")},checkBiometry:ue,openExternalUrl:le,enableSwipeBack:fe,disableSwipeBack:we,setNavigationItemMode:ge,getNavigationItemMode:pe,getUserStepInfo:me,isESimSupported:ve,activateESim:ke,readNFCData:ye,subscribeUserStepInfo:be,unsubscribeUserStepInfo:Ie,readNFCPassport:Me}}();export{s as BridgeErrors,d as HeaderMenuIcon,u as NavigationItemMode,l as classifyBridgeError,_ as default};
|
|
1
|
+
var e;!function(e){e[e.PermissionDenyError=0]="PermissionDenyError",e[e.PermissionSecurityDenyError=1]="PermissionSecurityDenyError",e[e.OtherError=2]="OtherError"}(e||(e={}));var n,o,t,i=function(n){if(n.msg){if(n.msg.startsWith("permission deny"))return e.PermissionDenyError;if(n.msg.startsWith("permission security deny"))return e.PermissionSecurityDenyError}return e.OtherError};function r(){return r=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var o=arguments[n];for(var t in o)({}).hasOwnProperty.call(o,t)&&(e[t]=o[t])}return e},r.apply(null,arguments)}function s(e){void 0===e&&(e="m:");var n=0;return{next:function(){return e+ ++n}}}function a(e){var n=s(e),o={};return{add:function(e,t){void 0===t&&(t="");var i=t+n.next();return o[i]=e,i},resolve:function(e,n,t,i){var r=o[e];r&&(t(i)?r.resolve(n):r.reject(i),o[e]=null)}}}function c(e,n){e(function(e){if(e.detail&&"reqId"in e.detail){var o=e.detail,t=o.reqId;t&&n.resolve(t,o.data,function(e){return!e},o.error)}})}function d(e,n,o){var t=a(n+":");return c(o,t),function(){var n=arguments;return new Promise(function(o,i){var r=t.add({resolve:o,reject:i});e.apply(void 0,[r].concat([].slice.call(n)))})}}!function(e){e.getMe="GetMe",e.getPhone="GetPhone",e.getContacts="GetContacts",e.getUserProfile="GetUserProfile",e.enableNotifications="AllowNotifications",e.disableNotifications="DisableNotifications",e.enablePrivateMessaging="EnablePrivateMessaging",e.disablePrivateMessaging="DisablePrivateMessaging"}(n||(n={})),function(e){e.Search="Search",e.ShoppingCart="ShoppingCart",e.Menu="Menu",e.Share="Share",e.Notifications="Notifications",e.Help="Help",e.Error="Error",e.Person="Person",e.Sort="Sort",e.Filter="Filter",e.Close="Close",e.SystemNotifications="SystemNotifications"}(o||(o={})),function(e){e.SystemBackArrow="SystemBackArrow",e.CustomBackArrow="CustomBackArrow",e.NoItem="NoItem",e.UserProfile="UserProfile"}(t||(t={}));var u=function(){var e,o,t="invoke",i="storage",u="getGeo",l="getQr",f="getSMSCode",w="selectContact",g="share",p="setTitle",v="copyToClipboard",m="shareFile",k="setShakeHandler",y="vibrate",b="enableScreenCapture",M="disableScreenCapture",I="setTabActiveHandler",S="setHeaderMenuItems",C="setHeaderMenuItemClickHandler",h="setCustomBackArrowMode",U="getCustomBackArrowMode",P="setCustomBackArrowVisible",A="openPayment",x="setCustomBackArrowOnClickHandler",B="checkBiometry",N="openExternalUrl",E="setNavigationItemMode",q="getNavigationItemMode",H="getUserStepInfo",O="undefined"!=typeof window,T=O&&window.AndroidBridge,D=O&&window.webkit&&window.webkit.messageHandlers,j=O&&function(){if(!globalThis.window)return!1;try{return window.self!==window.top}catch(e){return!0}}()&&((o=new URLSearchParams(window.location.search).get("__aitu-domain"))?localStorage.setItem("mini-app-domain",o):o=localStorage.getItem("mini-app-domain"),o?(e={origin:o,execute:function(e,n){var t;null==(t=window)||null==(t=t.top)||t.postMessage({source:"aitu-bridge",method:e,reqId:n,payload:[].concat([].slice.call(arguments,2))},o)}},window.addEventListener("message",function(e){if(e.origin===o&&e.data){if(window.dispatchEvent(new CustomEvent("aituEvents",{detail:e.data})),"string"!=typeof e.data||""===e.data)return;try{var n=JSON.parse(e.data);n&&n.method&&("setCustomBackArrowOnClickHandler"===n.method?null==window.onAituBridgeBackArrowClick||window.onAituBridgeBackArrowClick():"setHeaderMenuItemClickHandler"===n.method&&(null==window.onAituBridgeHeaderMenuItemClick||window.onAituBridgeHeaderMenuItemClick(n.param)))}catch(e){console.log("Error parsing message data: "+e)}}}),e):null),F=[];O&&window.addEventListener("aituEvents",function(e){[].concat(F).map(function(n){return n.call(null,e)})});var G,J=function(e){F.push(e)},L=function(e,n){var o=s(e+":");return function(){var t=[].slice.call(arguments),i=o.next(),s=!!D&&!!D[e],a=!!j;return T&&T[e]?T[e].apply(T,[i].concat(t)):s?D[e].postMessage(r({reqId:i},null==n||null==n.transformToObject?void 0:n.transformToObject(t))):a?j.execute.apply(j,[e,i].concat(t)):"undefined"!=typeof window&&console.log("--"+e+"-isUnknown"),function(e){return new Promise(function(n,o){var t=function(i){var r;if((null==(r=i.detail)?void 0:r.reqId)===e){var s=i.detail,a=s.data,c=s.error;a?n(a):o(c),window.removeEventListener("aituEvents",t)}};window.addEventListener("aituEvents",t)})}(i)}},V=(c(J,G=a("invoke:")),function(e,n){return void 0===n&&(n={}),new Promise(function(o,i){!function(e,n,o){void 0===o&&(o={});var i=D&&D[t];T&&T[t]?T[t](e,n,JSON.stringify(o)):i?D[t].postMessage({reqId:e,method:n,data:o}):j?j.execute(t,e,n,o):"undefined"!=typeof window&&console.log("--invoke-isUnknown")}(G.add({resolve:o,reject:i},e+":"),e,n)})}),Q=function(e,n){var o=a("storage:");return c(n,o),{setItem:function(n,t){return new Promise(function(i,r){var s=o.add({resolve:i,reject:r});e(s,"setItem",{keyName:n,keyValue:t})})},getItem:function(n){return new Promise(function(t,i){var r=o.add({resolve:t,reject:i});e(r,"getItem",{keyName:n})})},clear:function(){return new Promise(function(n,t){var i=o.add({resolve:n,reject:t});e(i,"clear",{})})}}}(function(e,n,o){void 0===o&&(o={});var t=D&&D[i];T&&T[i]?T[i](e,n,JSON.stringify(o)):t?D[i].postMessage({reqId:e,method:n,data:o}):j?j.execute(i,e,n,o):"undefined"!=typeof window&&console.log("--storage-isUnknown")},J),W=d(function(e){var n=D&&D[u];T&&T[u]?T[u](e):n?D[u].postMessage({reqId:e}):j?j.execute(u,e):"undefined"!=typeof window&&console.log("--getGeo-isUnknown")},u,J),_=d(function(e){var n=D&&D[l];T&&T[l]?T[l](e):n?D[l].postMessage({reqId:e}):j?j.execute(l,e):"undefined"!=typeof window&&console.log("--getQr-isUnknown")},l,J),R=d(function(e){var n=D&&D[f];T&&T[f]?T[f](e):n?D[f].postMessage({reqId:e}):j?j.execute(f,e):"undefined"!=typeof window&&console.log("--getSMSCode-isUnknown")},f,J),z=d(function(e){var n=D&&D[w];T&&T[w]?T[w](e):n?D[w].postMessage({reqId:e}):j?j.execute(w,e):"undefined"!=typeof window&&console.log("--selectContact-isUnknown")},w,J),K=d(function(e,n){var o=D&&D[g];T&&T[g]?T[g](e,n):o?D[g].postMessage({reqId:e,text:n}):j?j.execute(g,e,n):"undefined"!=typeof window&&console.log("--share-isUnknown")},g,J),X=d(function(e,n){var o=D&&D[p];T&&T[p]?T[p](e,n):o?D[p].postMessage({reqId:e,text:n}):j?j.execute(p,e,n):"undefined"!=typeof window&&console.log("--setTitle-isUnknown")},p,J),Y=d(function(e,n){var o=D&&D[v];T&&T[v]?T[v](e,n):o?D[v].postMessage({reqId:e,text:n}):j?j.execute(v,e,n):"undefined"!=typeof window&&console.log("--copyToClipboard-isUnknown")},v,J),Z=d(function(e,n,o){var t,i,r=T&&T[m],s=D&&D[m],a="image."+(null!=(t=null==(i=o.split(";"))||null==(i=i[0])?void 0:i.split("/")[1])?t:""),c=o.substr(o.indexOf(",")+1);r?T[m](e,n,a,c):s?D[m].postMessage({reqId:e,text:n,filename:a,base64Data:c}):j?j.execute(m,e,{text:n,filename:a,base64Data:c}):"undefined"!=typeof window&&console.log("--shareFile-isUnknown")},"shareImage",J),$=d(function(e,n,o,t){var i=D&&D[m];T&&T[m]?T[m](e,n,o,t):i?D[m].postMessage({reqId:e,text:n,filename:o,base64Data:t}):j?j.execute(m,e,n,o,t):"undefined"!=typeof window&&console.log("--shareFile-isUnknown")},m,J),ee=d(function(e,n){if(!Array.isArray(n)||n.some(function(e){return e<1||e!==Math.floor(e)})||n.reduce(function(e,n){return e+n})>1e4)console.error("Pattern should be an array of positive integers no longer than 10000ms total");else{var o=D&&D[y];T&&T[y]?T[y](e,JSON.stringify(n)):o?D[y].postMessage({reqId:e,pattern:n}):j?j.execute(y,e,n):"undefined"!=typeof window&&console.log("--vibrate-isUnknown")}},y,J),ne=d(function(e){var n=D&&D[b];T&&T[b]?T[b](e):n?D[b].postMessage({reqId:e}):j?j.execute(b,e):"undefined"!=typeof window&&console.log("--enableScreenCapture-isUnknown")},b,J),oe=d(function(e){var n=D&&D[M];T&&T[M]?T[M](e):n?D[M].postMessage({reqId:e}):j?j.execute(M,e):"undefined"!=typeof window&&console.log("--disableScreenCapture-isUnknown")},M,J),te=d(function(e,n){if(n.length>3)console.error("SetHeaderMenuItems: items count should not be more than 3");else{var o=T&&T[S],t=D&&D[S],i=JSON.stringify(n);o?T[S](e,i):t?D[S].postMessage({reqId:e,itemsJsonArray:i}):j?j.execute(S,e,i):"undefined"!=typeof window&&console.log("--setHeaderMenuItems-isUnknown")}},S,J),ie=d(function(e,n){var o=D&&D[h];T&&T[h]?T[h](e,n):o?D[h].postMessage({reqId:e,enabled:n}):j?j.execute(h,e,n):"undefined"!=typeof window&&console.log("--setCustomBackArrowMode-isUnknown")},h,J),re=d(function(e){var n=D&&D[U];T&&T[U]?T[U](e):n?D[U].postMessage({reqId:e}):j?j.execute(U,e):"undefined"!=typeof window&&console.log("--getCustomBackArrowMode-isUnknown")},U,J),se=d(function(e,n){var o=D&&D[P];T&&T[P]?T[P](e,n):o?D[P].postMessage({reqId:e,visible:n}):j?j.execute(P,e,n):"undefined"!=typeof window&&console.log("--setCustomBackArrowVisible-isUnknown")},P,J),ae=d(function(e,n){var o=D&&D[A];T&&T[A]?T[A](e,n):o?D[A].postMessage({reqId:e,transactionId:n}):console.log("--openPayment-isUnknown")},A,J),ce=d(function(e){var n=D&&D[B];T&&T[B]?T[B](e):n?D[B].postMessage({reqId:e}):j?j.execute(B,e):"undefined"!=typeof window&&console.log("--checkBiometry-isUnknown")},B,J),de=d(function(e,n){var o=D&&D[N];T&&T[N]?T[N](e,n):o?D[N].postMessage({reqId:e,url:n}):console.log("--openExternalUrlMethod-isUnknown")},N,J),ue=d(function(e,n){var o=D&&D[E];T&&T[E]?T[E](e,n):o?D[E].postMessage({reqId:e,mode:n}):j?j.execute(E,e,n):"undefined"!=typeof window&&console.log("--setNavigationItemMode-isUnknown")},E,J),le=d(function(e){var n=D&&D[q];T&&T[q]?T[q](e):n?D[q].postMessage({reqId:e}):j?j.execute(q,e):"undefined"!=typeof window&&console.log("--getNavigationItemMode-isUnknown")},q,J),fe=d(function(e){var n=D&&D[H];T&&T[H]?T[H](e):n?D[H].postMessage({reqId:e}):j?console.log("--getUserStepInfo-isWeb"):"undefined"!=typeof window&&console.log("--getUserStepInfo-isUnknown")},H,J),we=L("isESimSupported"),ge=L("activateESim",{transformToObject:function(e){return{activationCode:e[0]}}}),pe=L("readNFCData"),ve=L("readNFCPassport",{transformToObject:function(e){return{passportNumber:e[0],dateOfBirth:e[1],expirationDate:e[2]}}}),me=L("subscribeUserStepInfo"),ke=L("unsubscribeUserStepInfo"),ye=L("openUserProfile"),be=L("openSettings"),Me=L("closeApplication"),Ie=L("enableSwipeBack"),Se=L("disableSwipeBack");return{version:"0.8.0-canary.4",copyToClipboard:Y,invoke:V,storage:Q,getMe:function(){return V(n.getMe)},getPhone:function(){return V(n.getPhone)},getContacts:function(){return V(n.getContacts)},getGeo:W,getQr:_,getSMSCode:R,getUserProfile:function(e){return V(n.getUserProfile,{id:e})},openUserProfile:ye,selectContact:z,enableNotifications:function(){return V(n.enableNotifications)},disableNotifications:function(){return V(n.disableNotifications)},enablePrivateMessaging:function(e){return V(n.enablePrivateMessaging,{appId:e})},disablePrivateMessaging:function(e){return V(n.disablePrivateMessaging,{appId:e})},openSettings:be,closeApplication:Me,setTitle:X,share:K,shareImage:Z,shareFile:$,setShakeHandler:function(e){T&&T[k]||D&&D[k]||j?window.onAituBridgeShake=e:"undefined"!=typeof window&&console.log("--setShakeHandler-isUnknown")},setTabActiveHandler:function(e){T&&T[I]||D&&D[I]||j?window.onAituBridgeTabActive=e:"undefined"!=typeof window&&console.log("--setTabActiveHandler-isUnknown")},vibrate:ee,isSupported:function(){var e,n=D&&(null==(e=window.webkit)||null==(e=e.messageHandlers)?void 0:e.invoke);return Boolean(T||n||j)},supports:function(e){return!!T&&"function"==typeof T[e]||!!D&&!!D[e]&&"function"==typeof D[e].postMessage||!!j&&"function"==typeof j[e]},sub:J,enableScreenCapture:ne,disableScreenCapture:oe,setHeaderMenuItems:te,setHeaderMenuItemClickHandler:function(e){T&&T[C]||D&&D[C]||j?window.onAituBridgeHeaderMenuItemClick=e:"undefined"!=typeof window&&console.log("--setHeaderMenuItemClickHandler-isUnknown")},setCustomBackArrowMode:ie,getCustomBackArrowMode:re,setCustomBackArrowVisible:se,openPayment:ae,setCustomBackArrowOnClickHandler:function(e){T&&T[x]||D&&D[x]||j?window.onAituBridgeBackArrowClick=e:"undefined"!=typeof window&&console.log("--setCustomBackArrowOnClickHandler-isUnknown")},checkBiometry:ce,openExternalUrl:de,enableSwipeBack:Ie,disableSwipeBack:Se,setNavigationItemMode:ue,getNavigationItemMode:le,getUserStepInfo:fe,isESimSupported:we,activateESim:ge,readNFCData:pe,subscribeUserStepInfo:me,unsubscribeUserStepInfo:ke,readNFCPassport:ve}}();export{e as BridgeErrors,i as classifyBridgeError,u as default};
|
|
2
2
|
//# sourceMappingURL=index.module.js.map
|
package/dist/index.umd.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e||self).aituBridge={})}(this,function(e){function n(){return n=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var o=arguments[n];for(var t in o)({}).hasOwnProperty.call(o,t)&&(e[t]=o[t])}return e},n.apply(null,arguments)}function o(e){var n=function(e){return void 0===e&&(e="m:"),{current:0,next:function(){return e+ ++this.current}}}(e),o={};return{add:function(e,t){void 0===t&&(t="");var i=t+n.next();return o[i]=e,i},resolve:function(e,n,t,i){var r=o[e];r&&(t(i)?r.resolve(n):r.reject(i),o[e]=null)}}}function t(e,n){e(function(e){if(e.detail&&"reqId"in e.detail){var o=e.detail,t=o.reqId;t&&n.resolve(t,o.data,function(e){return!e},o.error)}})}function i(e,n,i){var r=o(n+":");return t(i,r),function(){var n=arguments;return new Promise(function(o,t){var i=r.add({resolve:o,reject:t});e.apply(void 0,[i].concat([].slice.call(n)))})}}var r=new URLSearchParams(window.location.search).get("__aitu-domain");r?localStorage.setItem("mini-app-domain",r):r=localStorage.getItem("mini-app-domain");var s=null;r&&(s={origin:r,execute:function(e,n){window.top.postMessage({source:"aitu-bridge",method:e,reqId:n,payload:[].concat([].slice.call(arguments,2))},s.origin)}},window.addEventListener("message",function(e){if(e.origin===r&&e.data){if(window.dispatchEvent(new CustomEvent("aituEvents",{detail:e.data})),"string"!=typeof e.data||""===e.data)return;try{var n=JSON.parse(e.data);n&&n.method&&("setCustomBackArrowOnClickHandler"===n.method?window.onAituBridgeBackArrowClick():"setHeaderMenuItemClickHandler"===n.method&&window.onAituBridgeHeaderMenuItemClick(n.param))}catch(e){console.log("Error parsing message data: "+e)}}}));var a,d,c,u,l=s;e.BridgeErrors=void 0,(a=e.BridgeErrors||(e.BridgeErrors={}))[a.PermissionDenyError=0]="PermissionDenyError",a[a.PermissionSecurityDenyError=1]="PermissionSecurityDenyError",a[a.OtherError=2]="OtherError",function(e){e.getMe="GetMe",e.getPhone="GetPhone",e.getContacts="GetContacts",e.getUserProfile="GetUserProfile",e.enableNotifications="AllowNotifications",e.disableNotifications="DisableNotifications",e.enablePrivateMessaging="EnablePrivateMessaging",e.disablePrivateMessaging="DisablePrivateMessaging"}(d||(d={})),e.HeaderMenuIcon=void 0,(c=e.HeaderMenuIcon||(e.HeaderMenuIcon={})).Search="Search",c.ShoppingCart="ShoppingCart",c.Menu="Menu",c.Share="Share",c.Notifications="Notifications",c.Help="Help",c.Error="Error",c.Person="Person",c.Sort="Sort",c.Filter="Filter",c.Close="Close",c.SystemNotifications="SystemNotifications",e.NavigationItemMode=void 0,(u=e.NavigationItemMode||(e.NavigationItemMode={})).SystemBackArrow="SystemBackArrow",u.CustomBackArrow="CustomBackArrow",u.NoItem="NoItem",u.UserProfile="UserProfile";var f="invoke",g="storage",w="getGeo",p="getQr",m="getSMSCode",v="selectContact",k="openSettings",y="closeApplication",M="share",I="setTitle",b="copyToClipboard",S="shareFile",h="setShakeHandler",C="vibrate",U="enableScreenCapture",B="disableScreenCapture",x="setTabActiveHandler",P="setHeaderMenuItems",A="setHeaderMenuItemClickHandler",N="setCustomBackArrowMode",E="getCustomBackArrowMode",q="setCustomBackArrowVisible",H="openPayment",O="setCustomBackArrowOnClickHandler",T="checkBiometry",D="openExternalUrl",j="enableSwipeBack",F="disableSwipeBack",G="setNavigationItemMode",J="getNavigationItemMode",V="getUserStepInfo",W="undefined"!=typeof window&&window.AndroidBridge,L="undefined"!=typeof window&&window.webkit&&window.webkit.messageHandlers,Q="undefined"!=typeof window&&window.top!==window&&l,_=function(){var e=[];"undefined"!=typeof window&&window.addEventListener("aituEvents",function(n){[].concat(e).map(function(e){return e.call(null,n)})});var r,s=function(n){e.push(n)},a=function(e,o){return i(function(t){var i=[].slice.call(arguments,1),r=!!L&&!!L[e],s=!(null==o||!o.isWebSupported||!Q);W&&W[e]?W[e].apply(W,[t].concat(i)):r?L[e].postMessage(n({reqId:t},null==o||null==o.transformToObject?void 0:o.transformToObject(i))):s?Q.execute.apply(Q,[e,t].concat(i)):"undefined"!=typeof window&&console.log("--"+e+"-isUnknown")},e,s)},c=(t(s,r=o("invoke:")),function(e,n){return void 0===n&&(n={}),new Promise(function(o,t){!function(e,n,o){void 0===o&&(o={});var t=L&&L[f];W&&W[f]?W[f](e,n,JSON.stringify(o)):t?L[f].postMessage({reqId:e,method:n,data:o}):Q?Q.execute(f,e,n,o):"undefined"!=typeof window&&console.log("--invoke-isUnknown")}(r.add({resolve:o,reject:t},e+":"),e,n)})}),u=function(e,n){var i=o("storage:");return t(n,i),{setItem:function(n,o){return new Promise(function(t,r){var s=i.add({resolve:t,reject:r});e(s,"setItem",{keyName:n,keyValue:o})})},getItem:function(n){return new Promise(function(o,t){var r=i.add({resolve:o,reject:t});e(r,"getItem",{keyName:n})})},clear:function(){return new Promise(function(n,o){var t=i.add({resolve:n,reject:o});e(t,"clear",{})})}}}(function(e,n,o){void 0===o&&(o={});var t=L&&L[g];W&&W[g]?W[g](e,n,JSON.stringify(o)):t?L[g].postMessage({reqId:e,method:n,data:o}):Q?Q.execute(g,e,n,o):"undefined"!=typeof window&&console.log("--storage-isUnknown")},s),l=i(function(e){var n=L&&L[w];W&&W[w]?W[w](e):n?L[w].postMessage({reqId:e}):Q?Q.execute(w,e):"undefined"!=typeof window&&console.log("--getGeo-isUnknown")},w,s),_=i(function(e){var n=L&&L[p];W&&W[p]?W[p](e):n?L[p].postMessage({reqId:e}):Q?Q.execute(p,e):"undefined"!=typeof window&&console.log("--getQr-isUnknown")},p,s),R=i(function(e){var n=L&&L[m];W&&W[m]?W[m](e):n?L[m].postMessage({reqId:e}):Q?Q.execute(m,e):"undefined"!=typeof window&&console.log("--getSMSCode-isUnknown")},m,s),z=i(function(e){var n=L&&L[v];W&&W[v]?W[v](e):n?L[v].postMessage({reqId:e}):Q?Q.execute(v,e):"undefined"!=typeof window&&console.log("--selectContact-isUnknown")},v,s),K=i(function(e){var n=L&&L[k];W&&W[k]?W[k](e):n?L[k].postMessage({reqId:e}):Q?Q.execute(k,e):"undefined"!=typeof window&&console.log("--openSettings-isUnknown")},k,s),X=i(function(e){var n=L&&L[y];W&&W[y]?W[y](e):n?L[y].postMessage({reqId:e}):Q?Q.execute(y,e):"undefined"!=typeof window&&console.log("--closeApplication-isUnknown")},y,s),Y=i(function(e,n){var o=L&&L[M];W&&W[M]?W[M](e,n):o?L[M].postMessage({reqId:e,text:n}):Q?Q.execute(M,e,n):"undefined"!=typeof window&&console.log("--share-isUnknown")},M,s),Z=i(function(e,n){var o=L&&L[I];W&&W[I]?W[I](e,n):o?L[I].postMessage({reqId:e,text:n}):Q?Q.execute(I,e,n):"undefined"!=typeof window&&console.log("--setTitle-isUnknown")},I,s),$=i(function(e,n){var o=L&&L[b];W&&W[b]?W[b](e,n):o?L[b].postMessage({reqId:e,text:n}):Q?Q.execute(b,e,n):"undefined"!=typeof window&&console.log("--copyToClipboard-isUnknown")},b,s),ee=i(function(e,n,o){var t=W&&W[S],i=L&&L[S],r="image."+o.split(";")[0].split("/")[1],s=o.substr(o.indexOf(",")+1);t?W[S](e,n,r,s):i?L[S].postMessage({reqId:e,text:n,filename:r,base64Data:s}):Q?Q.execute(S,e,{text:n,filename:r,base64Data:s}):"undefined"!=typeof window&&console.log("--shareFile-isUnknown")},"shareImage",s),ne=i(function(e,n,o,t){var i=L&&L[S];W&&W[S]?W[S](e,n,o,t):i?L[S].postMessage({reqId:e,text:n,filename:o,base64Data:t}):Q?Q.execute(S,e,n,o,t):"undefined"!=typeof window&&console.log("--shareFile-isUnknown")},S,s),oe=i(function(e,n){if(!Array.isArray(n)||n.some(function(e){return e<1||e!==Math.floor(e)})||n.reduce(function(e,n){return e+n})>1e4)console.error("Pattern should be an array of positive integers no longer than 10000ms total");else{var o=L&&L[C];W&&W[C]?W[C](e,JSON.stringify(n)):o?L[C].postMessage({reqId:e,pattern:n}):Q?Q.execute(C,e,n):"undefined"!=typeof window&&console.log("--vibrate-isUnknown")}},C,s),te=i(function(e){var n=L&&L[U];W&&W[U]?W[U](e):n?L[U].postMessage({reqId:e}):Q?Q.execute(U,e):"undefined"!=typeof window&&console.log("--enableScreenCapture-isUnknown")},U,s),ie=i(function(e){var n=L&&L[B];W&&W[B]?W[B](e):n?L[B].postMessage({reqId:e}):Q?Q.execute(B,e):"undefined"!=typeof window&&console.log("--disableScreenCapture-isUnknown")},B,s),re=i(function(e,n){if(n.length>3)console.error("SetHeaderMenuItems: items count should not be more than 3");else{var o=W&&W[P],t=L&&L[P],i=JSON.stringify(n);o?W[P](e,i):t?L[P].postMessage({reqId:e,itemsJsonArray:i}):Q?Q.execute(P,e,i):"undefined"!=typeof window&&console.log("--setHeaderMenuItems-isUnknown")}},P,s),se=i(function(e,n){var o=L&&L[N];W&&W[N]?W[N](e,n):o?L[N].postMessage({reqId:e,enabled:n}):Q?Q.execute(N,e,n):"undefined"!=typeof window&&console.log("--setCustomBackArrowMode-isUnknown")},N,s),ae=i(function(e){var n=L&&L[E];W&&W[E]?W[E](e):n?L[E].postMessage({reqId:e}):Q?Q.execute(E,e):"undefined"!=typeof window&&console.log("--getCustomBackArrowMode-isUnknown")},E,s),de=i(function(e,n){var o=L&&L[q];W&&W[q]?W[q](e,n):o?L[q].postMessage({reqId:e,visible:n}):Q?Q.execute(q,e,n):"undefined"!=typeof window&&console.log("--setCustomBackArrowVisible-isUnknown")},q,s),ce=i(function(e,n){var o=L&&L[H];W&&W[H]?W[H](e,n):o?L[H].postMessage({reqId:e,transactionId:n}):console.log("--openPayment-isUnknown")},H,s),ue=i(function(e){var n=L&&L[T];W&&W[T]?W[T](e):n?L[T].postMessage({reqId:e}):Q?Q.execute(T,e):"undefined"!=typeof window&&console.log("--checkBiometry-isUnknown")},T,s),le=i(function(e,n){var o=L&&L[D];W&&W[D]?W[D](e,n):o?L[D].postMessage({reqId:e,url:n}):console.log("--openExternalUrlMethod-isUnknown")},D,s),fe=i(function(e){var n=L&&L[j];W&&W[j]?W[j](e):n?L[j].postMessage({reqId:e}):Q?Q.execute(j,e):"undefined"!=typeof window&&console.log("--enableSwipeBack-isUnknown")},j,s),ge=i(function(e){var n=L&&L[F];W&&W[F]?W[F](e):n?L[F].postMessage({reqId:e}):Q?Q.execute(F,e):"undefined"!=typeof window&&console.log("--disableSwipeBack-isUnknown")},F,s),we=i(function(e,n){var o=L&&L[G];W&&W[G]?W[G](e,n):o?L[G].postMessage({reqId:e,mode:n}):Q?Q.execute(G,e,n):"undefined"!=typeof window&&console.log("--setNavigationItemMode-isUnknown")},G,s),pe=i(function(e){var n=L&&L[J];W&&W[J]?W[J](e):n?L[J].postMessage({reqId:e}):Q?Q.execute(J,e):"undefined"!=typeof window&&console.log("--getNavigationItemMode-isUnknown")},J,s),me=i(function(e){var n=L&&L[V];W&&W[V]?W[V](e):n?L[V].postMessage({reqId:e}):Q?console.log("--getUserStepInfo-isWeb"):"undefined"!=typeof window&&console.log("--getUserStepInfo-isUnknown")},V,s),ve=a("isESimSupported"),ke=a("activateESim",{transformToObject:function(e){return{activationCode:e[0]}}}),ye=a("readNFCData"),Me=a("readNFCPassport",{transformToObject:function(e){return{passportNumber:e[0],dateOfBirth:e[1],expirationDate:e[2]}}}),Ie=a("subscribeUserStepInfo"),be=a("unsubscribeUserStepInfo"),Se=a("openUserProfile");return{version:"0.7.2-canary.2",copyToClipboard:$,invoke:c,storage:u,getMe:function(){return c(d.getMe)},getPhone:function(){return c(d.getPhone)},getContacts:function(){return c(d.getContacts)},getGeo:l,getQr:_,getSMSCode:R,getUserProfile:function(e){return c(d.getUserProfile,{id:e})},openUserProfile:Se,selectContact:z,enableNotifications:function(){return c(d.enableNotifications)},disableNotifications:function(){return c(d.disableNotifications)},enablePrivateMessaging:function(e){return c(d.enablePrivateMessaging,{appId:e})},disablePrivateMessaging:function(e){return c(d.disablePrivateMessaging,{appId:e})},openSettings:K,closeApplication:X,setTitle:Z,share:Y,shareImage:ee,shareFile:ne,setShakeHandler:function(e){W&&W[h]||L&&L[h]||Q?window.onAituBridgeShake=e:"undefined"!=typeof window&&console.log("--setShakeHandler-isUnknown")},setTabActiveHandler:function(e){W&&W[x]||L&&L[x]||Q?window.onAituBridgeTabActive=e:"undefined"!=typeof window&&console.log("--setTabActiveHandler-isUnknown")},vibrate:oe,isSupported:function(){var e=L&&window.webkit.messageHandlers.invoke;return Boolean(W||e||Q)},supports:function(e){return W&&"function"==typeof W[e]||L&&L[e]&&"function"==typeof L[e].postMessage||Q&&"function"==typeof Q[e]},sub:s,enableScreenCapture:te,disableScreenCapture:ie,setHeaderMenuItems:re,setHeaderMenuItemClickHandler:function(e){W&&W[A]||L&&L[A]||Q?window.onAituBridgeHeaderMenuItemClick=e:"undefined"!=typeof window&&console.log("--setHeaderMenuItemClickHandler-isUnknown")},setCustomBackArrowMode:se,getCustomBackArrowMode:ae,setCustomBackArrowVisible:de,openPayment:ce,setCustomBackArrowOnClickHandler:function(e){W&&W[O]||L&&L[O]||Q?window.onAituBridgeBackArrowClick=e:"undefined"!=typeof window&&console.log("--setCustomBackArrowOnClickHandler-isUnknown")},checkBiometry:ue,openExternalUrl:le,enableSwipeBack:fe,disableSwipeBack:ge,setNavigationItemMode:we,getNavigationItemMode:pe,getUserStepInfo:me,isESimSupported:ve,activateESim:ke,readNFCData:ye,subscribeUserStepInfo:Ie,unsubscribeUserStepInfo:be,readNFCPassport:Me}}();e.classifyBridgeError=function(n){if(n.msg){if(n.msg.startsWith("permission deny"))return e.BridgeErrors.PermissionDenyError;if(n.msg.startsWith("permission security deny"))return e.BridgeErrors.PermissionSecurityDenyError}return e.BridgeErrors.OtherError},e.default=_});
|
|
1
|
+
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e||self).aituBridge={})}(this,function(e){var n,o,t,r;function i(){return i=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var o=arguments[n];for(var t in o)({}).hasOwnProperty.call(o,t)&&(e[t]=o[t])}return e},i.apply(null,arguments)}function s(e){void 0===e&&(e="m:");var n=0;return{next:function(){return e+ ++n}}}function a(e){var n=s(e),o={};return{add:function(e,t){void 0===t&&(t="");var r=t+n.next();return o[r]=e,r},resolve:function(e,n,t,r){var i=o[e];i&&(t(r)?i.resolve(n):i.reject(r),o[e]=null)}}}function d(e,n){e(function(e){if(e.detail&&"reqId"in e.detail){var o=e.detail,t=o.reqId;t&&n.resolve(t,o.data,function(e){return!e},o.error)}})}function c(e,n,o){var t=a(n+":");return d(o,t),function(){var n=arguments;return new Promise(function(o,r){var i=t.add({resolve:o,reject:r});e.apply(void 0,[i].concat([].slice.call(n)))})}}e.BridgeErrors=void 0,(n=e.BridgeErrors||(e.BridgeErrors={}))[n.PermissionDenyError=0]="PermissionDenyError",n[n.PermissionSecurityDenyError=1]="PermissionSecurityDenyError",n[n.OtherError=2]="OtherError",function(e){e.getMe="GetMe",e.getPhone="GetPhone",e.getContacts="GetContacts",e.getUserProfile="GetUserProfile",e.enableNotifications="AllowNotifications",e.disableNotifications="DisableNotifications",e.enablePrivateMessaging="EnablePrivateMessaging",e.disablePrivateMessaging="DisablePrivateMessaging"}(o||(o={})),function(e){e.Search="Search",e.ShoppingCart="ShoppingCart",e.Menu="Menu",e.Share="Share",e.Notifications="Notifications",e.Help="Help",e.Error="Error",e.Person="Person",e.Sort="Sort",e.Filter="Filter",e.Close="Close",e.SystemNotifications="SystemNotifications"}(t||(t={})),function(e){e.SystemBackArrow="SystemBackArrow",e.CustomBackArrow="CustomBackArrow",e.NoItem="NoItem",e.UserProfile="UserProfile"}(r||(r={}));var u=function(){var e,n,t="invoke",r="storage",u="getGeo",l="getQr",f="getSMSCode",g="selectContact",w="share",p="setTitle",m="copyToClipboard",v="shareFile",k="setShakeHandler",y="vibrate",b="enableScreenCapture",M="disableScreenCapture",I="setTabActiveHandler",S="setHeaderMenuItems",C="setHeaderMenuItemClickHandler",h="setCustomBackArrowMode",U="getCustomBackArrowMode",B="setCustomBackArrowVisible",P="openPayment",x="setCustomBackArrowOnClickHandler",A="checkBiometry",E="openExternalUrl",N="setNavigationItemMode",q="getNavigationItemMode",H="getUserStepInfo",O="undefined"!=typeof window,T=O&&window.AndroidBridge,D=O&&window.webkit&&window.webkit.messageHandlers,j=O&&function(){if(!globalThis.window)return!1;try{return window.self!==window.top}catch(e){return!0}}()&&((n=new URLSearchParams(window.location.search).get("__aitu-domain"))?localStorage.setItem("mini-app-domain",n):n=localStorage.getItem("mini-app-domain"),n?(e={origin:n,execute:function(e,o){var t;null==(t=window)||null==(t=t.top)||t.postMessage({source:"aitu-bridge",method:e,reqId:o,payload:[].concat([].slice.call(arguments,2))},n)}},window.addEventListener("message",function(e){if(e.origin===n&&e.data){if(window.dispatchEvent(new CustomEvent("aituEvents",{detail:e.data})),"string"!=typeof e.data||""===e.data)return;try{var o=JSON.parse(e.data);o&&o.method&&("setCustomBackArrowOnClickHandler"===o.method?null==window.onAituBridgeBackArrowClick||window.onAituBridgeBackArrowClick():"setHeaderMenuItemClickHandler"===o.method&&(null==window.onAituBridgeHeaderMenuItemClick||window.onAituBridgeHeaderMenuItemClick(o.param)))}catch(e){console.log("Error parsing message data: "+e)}}}),e):null),F=[];O&&window.addEventListener("aituEvents",function(e){[].concat(F).map(function(n){return n.call(null,e)})});var G,J=function(e){F.push(e)},L=function(e,n){var o=s(e+":");return function(){var t=[].slice.call(arguments),r=o.next(),s=!!D&&!!D[e],a=!!j;return T&&T[e]?T[e].apply(T,[r].concat(t)):s?D[e].postMessage(i({reqId:r},null==n||null==n.transformToObject?void 0:n.transformToObject(t))):a?j.execute.apply(j,[e,r].concat(t)):"undefined"!=typeof window&&console.log("--"+e+"-isUnknown"),function(e){return new Promise(function(n,o){var t=function(r){var i;if((null==(i=r.detail)?void 0:i.reqId)===e){var s=r.detail,a=s.data,d=s.error;a?n(a):o(d),window.removeEventListener("aituEvents",t)}};window.addEventListener("aituEvents",t)})}(r)}},V=(d(J,G=a("invoke:")),function(e,n){return void 0===n&&(n={}),new Promise(function(o,r){!function(e,n,o){void 0===o&&(o={});var r=D&&D[t];T&&T[t]?T[t](e,n,JSON.stringify(o)):r?D[t].postMessage({reqId:e,method:n,data:o}):j?j.execute(t,e,n,o):"undefined"!=typeof window&&console.log("--invoke-isUnknown")}(G.add({resolve:o,reject:r},e+":"),e,n)})}),Q=function(e,n){var o=a("storage:");return d(n,o),{setItem:function(n,t){return new Promise(function(r,i){var s=o.add({resolve:r,reject:i});e(s,"setItem",{keyName:n,keyValue:t})})},getItem:function(n){return new Promise(function(t,r){var i=o.add({resolve:t,reject:r});e(i,"getItem",{keyName:n})})},clear:function(){return new Promise(function(n,t){var r=o.add({resolve:n,reject:t});e(r,"clear",{})})}}}(function(e,n,o){void 0===o&&(o={});var t=D&&D[r];T&&T[r]?T[r](e,n,JSON.stringify(o)):t?D[r].postMessage({reqId:e,method:n,data:o}):j?j.execute(r,e,n,o):"undefined"!=typeof window&&console.log("--storage-isUnknown")},J),W=c(function(e){var n=D&&D[u];T&&T[u]?T[u](e):n?D[u].postMessage({reqId:e}):j?j.execute(u,e):"undefined"!=typeof window&&console.log("--getGeo-isUnknown")},u,J),_=c(function(e){var n=D&&D[l];T&&T[l]?T[l](e):n?D[l].postMessage({reqId:e}):j?j.execute(l,e):"undefined"!=typeof window&&console.log("--getQr-isUnknown")},l,J),R=c(function(e){var n=D&&D[f];T&&T[f]?T[f](e):n?D[f].postMessage({reqId:e}):j?j.execute(f,e):"undefined"!=typeof window&&console.log("--getSMSCode-isUnknown")},f,J),z=c(function(e){var n=D&&D[g];T&&T[g]?T[g](e):n?D[g].postMessage({reqId:e}):j?j.execute(g,e):"undefined"!=typeof window&&console.log("--selectContact-isUnknown")},g,J),K=c(function(e,n){var o=D&&D[w];T&&T[w]?T[w](e,n):o?D[w].postMessage({reqId:e,text:n}):j?j.execute(w,e,n):"undefined"!=typeof window&&console.log("--share-isUnknown")},w,J),X=c(function(e,n){var o=D&&D[p];T&&T[p]?T[p](e,n):o?D[p].postMessage({reqId:e,text:n}):j?j.execute(p,e,n):"undefined"!=typeof window&&console.log("--setTitle-isUnknown")},p,J),Y=c(function(e,n){var o=D&&D[m];T&&T[m]?T[m](e,n):o?D[m].postMessage({reqId:e,text:n}):j?j.execute(m,e,n):"undefined"!=typeof window&&console.log("--copyToClipboard-isUnknown")},m,J),Z=c(function(e,n,o){var t,r,i=T&&T[v],s=D&&D[v],a="image."+(null!=(t=null==(r=o.split(";"))||null==(r=r[0])?void 0:r.split("/")[1])?t:""),d=o.substr(o.indexOf(",")+1);i?T[v](e,n,a,d):s?D[v].postMessage({reqId:e,text:n,filename:a,base64Data:d}):j?j.execute(v,e,{text:n,filename:a,base64Data:d}):"undefined"!=typeof window&&console.log("--shareFile-isUnknown")},"shareImage",J),$=c(function(e,n,o,t){var r=D&&D[v];T&&T[v]?T[v](e,n,o,t):r?D[v].postMessage({reqId:e,text:n,filename:o,base64Data:t}):j?j.execute(v,e,n,o,t):"undefined"!=typeof window&&console.log("--shareFile-isUnknown")},v,J),ee=c(function(e,n){if(!Array.isArray(n)||n.some(function(e){return e<1||e!==Math.floor(e)})||n.reduce(function(e,n){return e+n})>1e4)console.error("Pattern should be an array of positive integers no longer than 10000ms total");else{var o=D&&D[y];T&&T[y]?T[y](e,JSON.stringify(n)):o?D[y].postMessage({reqId:e,pattern:n}):j?j.execute(y,e,n):"undefined"!=typeof window&&console.log("--vibrate-isUnknown")}},y,J),ne=c(function(e){var n=D&&D[b];T&&T[b]?T[b](e):n?D[b].postMessage({reqId:e}):j?j.execute(b,e):"undefined"!=typeof window&&console.log("--enableScreenCapture-isUnknown")},b,J),oe=c(function(e){var n=D&&D[M];T&&T[M]?T[M](e):n?D[M].postMessage({reqId:e}):j?j.execute(M,e):"undefined"!=typeof window&&console.log("--disableScreenCapture-isUnknown")},M,J),te=c(function(e,n){if(n.length>3)console.error("SetHeaderMenuItems: items count should not be more than 3");else{var o=T&&T[S],t=D&&D[S],r=JSON.stringify(n);o?T[S](e,r):t?D[S].postMessage({reqId:e,itemsJsonArray:r}):j?j.execute(S,e,r):"undefined"!=typeof window&&console.log("--setHeaderMenuItems-isUnknown")}},S,J),re=c(function(e,n){var o=D&&D[h];T&&T[h]?T[h](e,n):o?D[h].postMessage({reqId:e,enabled:n}):j?j.execute(h,e,n):"undefined"!=typeof window&&console.log("--setCustomBackArrowMode-isUnknown")},h,J),ie=c(function(e){var n=D&&D[U];T&&T[U]?T[U](e):n?D[U].postMessage({reqId:e}):j?j.execute(U,e):"undefined"!=typeof window&&console.log("--getCustomBackArrowMode-isUnknown")},U,J),se=c(function(e,n){var o=D&&D[B];T&&T[B]?T[B](e,n):o?D[B].postMessage({reqId:e,visible:n}):j?j.execute(B,e,n):"undefined"!=typeof window&&console.log("--setCustomBackArrowVisible-isUnknown")},B,J),ae=c(function(e,n){var o=D&&D[P];T&&T[P]?T[P](e,n):o?D[P].postMessage({reqId:e,transactionId:n}):console.log("--openPayment-isUnknown")},P,J),de=c(function(e){var n=D&&D[A];T&&T[A]?T[A](e):n?D[A].postMessage({reqId:e}):j?j.execute(A,e):"undefined"!=typeof window&&console.log("--checkBiometry-isUnknown")},A,J),ce=c(function(e,n){var o=D&&D[E];T&&T[E]?T[E](e,n):o?D[E].postMessage({reqId:e,url:n}):console.log("--openExternalUrlMethod-isUnknown")},E,J),ue=c(function(e,n){var o=D&&D[N];T&&T[N]?T[N](e,n):o?D[N].postMessage({reqId:e,mode:n}):j?j.execute(N,e,n):"undefined"!=typeof window&&console.log("--setNavigationItemMode-isUnknown")},N,J),le=c(function(e){var n=D&&D[q];T&&T[q]?T[q](e):n?D[q].postMessage({reqId:e}):j?j.execute(q,e):"undefined"!=typeof window&&console.log("--getNavigationItemMode-isUnknown")},q,J),fe=c(function(e){var n=D&&D[H];T&&T[H]?T[H](e):n?D[H].postMessage({reqId:e}):j?console.log("--getUserStepInfo-isWeb"):"undefined"!=typeof window&&console.log("--getUserStepInfo-isUnknown")},H,J),ge=L("isESimSupported"),we=L("activateESim",{transformToObject:function(e){return{activationCode:e[0]}}}),pe=L("readNFCData"),me=L("readNFCPassport",{transformToObject:function(e){return{passportNumber:e[0],dateOfBirth:e[1],expirationDate:e[2]}}}),ve=L("subscribeUserStepInfo"),ke=L("unsubscribeUserStepInfo"),ye=L("openUserProfile"),be=L("openSettings"),Me=L("closeApplication"),Ie=L("enableSwipeBack"),Se=L("disableSwipeBack");return{version:"0.8.0-canary.4",copyToClipboard:Y,invoke:V,storage:Q,getMe:function(){return V(o.getMe)},getPhone:function(){return V(o.getPhone)},getContacts:function(){return V(o.getContacts)},getGeo:W,getQr:_,getSMSCode:R,getUserProfile:function(e){return V(o.getUserProfile,{id:e})},openUserProfile:ye,selectContact:z,enableNotifications:function(){return V(o.enableNotifications)},disableNotifications:function(){return V(o.disableNotifications)},enablePrivateMessaging:function(e){return V(o.enablePrivateMessaging,{appId:e})},disablePrivateMessaging:function(e){return V(o.disablePrivateMessaging,{appId:e})},openSettings:be,closeApplication:Me,setTitle:X,share:K,shareImage:Z,shareFile:$,setShakeHandler:function(e){T&&T[k]||D&&D[k]||j?window.onAituBridgeShake=e:"undefined"!=typeof window&&console.log("--setShakeHandler-isUnknown")},setTabActiveHandler:function(e){T&&T[I]||D&&D[I]||j?window.onAituBridgeTabActive=e:"undefined"!=typeof window&&console.log("--setTabActiveHandler-isUnknown")},vibrate:ee,isSupported:function(){var e,n=D&&(null==(e=window.webkit)||null==(e=e.messageHandlers)?void 0:e.invoke);return Boolean(T||n||j)},supports:function(e){return!!T&&"function"==typeof T[e]||!!D&&!!D[e]&&"function"==typeof D[e].postMessage||!!j&&"function"==typeof j[e]},sub:J,enableScreenCapture:ne,disableScreenCapture:oe,setHeaderMenuItems:te,setHeaderMenuItemClickHandler:function(e){T&&T[C]||D&&D[C]||j?window.onAituBridgeHeaderMenuItemClick=e:"undefined"!=typeof window&&console.log("--setHeaderMenuItemClickHandler-isUnknown")},setCustomBackArrowMode:re,getCustomBackArrowMode:ie,setCustomBackArrowVisible:se,openPayment:ae,setCustomBackArrowOnClickHandler:function(e){T&&T[x]||D&&D[x]||j?window.onAituBridgeBackArrowClick=e:"undefined"!=typeof window&&console.log("--setCustomBackArrowOnClickHandler-isUnknown")},checkBiometry:de,openExternalUrl:ce,enableSwipeBack:Ie,disableSwipeBack:Se,setNavigationItemMode:ue,getNavigationItemMode:le,getUserStepInfo:fe,isESimSupported:ge,activateESim:we,readNFCData:pe,subscribeUserStepInfo:ve,unsubscribeUserStepInfo:ke,readNFCPassport:me}}();e.classifyBridgeError=function(n){if(n.msg){if(n.msg.startsWith("permission deny"))return e.BridgeErrors.PermissionDenyError;if(n.msg.startsWith("permission security deny"))return e.BridgeErrors.PermissionSecurityDenyError}return e.BridgeErrors.OtherError},e.default=u});
|
|
2
2
|
//# sourceMappingURL=index.umd.js.map
|