@btsd/aitu-bridge 0.3.56 → 0.3.57

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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.umd.js","sources":["../src/utils.ts","../src/webBridge.ts","../src/index.ts","../src/version.ts"],"sourcesContent":["function createCounter(prefix = 'm:') {\n return {\n current: 0,\n next() {\n return prefix + ++this.current;\n },\n };\n}\n\nfunction createRequestResolver(prefix: string) {\n type PromiseController = {\n resolve: (value: any) => any;\n reject: (reason: any) => any;\n };\n\n const counter = createCounter(prefix);\n const promiseControllers: Record<string, PromiseController | null> = {};\n\n return {\n add(controller: PromiseController, customId = ''): number | string {\n const id = customId + counter.next()\n promiseControllers[id] = controller;\n return id;\n },\n\n resolve<T>(reqId: number | string, data: T, isSuccess: (data: T) => boolean, error: any) {\n const requestPromise = promiseControllers[reqId];\n\n if (requestPromise) {\n if (isSuccess(error)) {\n requestPromise.resolve(data);\n } else {\n requestPromise.reject(error);\n }\n\n promiseControllers[reqId] = null;\n }\n },\n };\n}\n\nfunction handleSubscribe(subscribe: (handler: (event: any) => void) => void, requestResolver: ReturnType<typeof createRequestResolver>) {\n subscribe(event => {\n if (!event.detail) {\n return;\n }\n\n if ('reqId' in event.detail) {\n const { reqId, data, error } = event.detail;\n\n if (reqId) {\n requestResolver.resolve(reqId, data, (error) => !(error), error);\n }\n }\n })\n}\n\nexport function promisifyStorage(storage, subscribe: (fn: any) => void) {\n const requestResolver = createRequestResolver('storage:');\n\n handleSubscribe(subscribe, requestResolver)\n\n return {\n setItem: (keyName: string, keyValue: string): Promise<void> => {\n return new Promise((resolve, reject) => {\n const reqId = requestResolver.add({ resolve, reject });\n storage(reqId, 'setItem', { keyName, keyValue });\n });\n },\n getItem: (keyName: string): Promise<string | null> => {\n return new Promise((resolve, reject) => {\n const reqId = requestResolver.add({ resolve, reject });\n storage(reqId, 'getItem', { keyName });\n });\n },\n clear: (): Promise<void> => {\n return new Promise((resolve, reject) => {\n const reqId = requestResolver.add({ resolve, reject });\n storage(reqId, 'clear', {});\n });\n },\n }\n}\n\nexport function promisifyInvoke(invoke, subscribe: (fn: any) => void) {\n const requestResolver = createRequestResolver('invoke:');\n\n handleSubscribe(subscribe, requestResolver)\n\n return function promisifiedFunc(invokeMethodName: string, props: any = {}): Promise<any | void> {\n return new Promise((resolve, reject) => {\n const reqId = requestResolver.add({ resolve, reject }, invokeMethodName + ':');\n\n invoke(reqId, invokeMethodName, props);\n });\n };\n}\n\nexport function promisifyMethod(method: Function, methodName: string, subscribe: (fn: any) => void) {\n const requestResolver = createRequestResolver(methodName + ':');\n\n handleSubscribe(subscribe, requestResolver)\n\n return function promisifiedFunc(...args: any[]): Promise<any | void> {\n return new Promise((resolve, reject) => {\n const reqId = requestResolver.add({ resolve, reject });\n method(reqId, ...args);\n });\n };\n}\n\n\n\n","import type { AituBridge } from './index';\n\nconst AITU_DOMAIN_PARAM = '__aitu-domain'\n\nconst searchParams = new URLSearchParams(window.location.search)\n\nlet aituOrigin = searchParams.get(AITU_DOMAIN_PARAM)\n\nif(aituOrigin){\n localStorage.setItem('mini-app-domain', aituOrigin)\n}else{\n aituOrigin = localStorage.getItem('mini-app-domain')\n}\ninterface WebBridge {\n execute(method: keyof AituBridge, reqId: string, ...payload: any[] ): void\n origin: string\n}\n\nlet WebBridge: WebBridge | null = null\n\nif (aituOrigin) {\n WebBridge = {\n origin: aituOrigin,\n execute: (method, reqId, ...payload) => {\n window.top.postMessage({\n source: 'aitu-bridge',\n method,\n reqId,\n payload: [...payload],\n },\n WebBridge.origin\n )\n }\n\n }\n window.addEventListener('message', event => {\n if (event.origin === aituOrigin && event.data) {\n\n // dispatch aitu events\n window.dispatchEvent(new CustomEvent('aituEvents', { detail: event.data }));\n\n // try to detect handler call\n if (typeof event.data !== 'string' || event.data === '') {\n return;\n }\n\n try {\n const message = JSON.parse(event.data)\n\n if (message && message['method']) {\n if (message.method === 'setCustomBackArrowOnClickHandler') {\n (window as any).onAituBridgeBackArrowClick()\n } else if (message.method === 'setHeaderMenuItemClickHandler') {\n (window as any).onAituBridgeHeaderMenuItemClick(message.param)\n }\n }\n } catch (e) {\n console.log('Error parsing message data: ' + e);\n }\n }\n })\n}\n\nexport default WebBridge\n","import { LIB_VERSION } from './version';\n\nimport {\n promisifyMethod,\n promisifyStorage,\n promisifyInvoke,\n} from './utils'\n\nimport WebBridge from './webBridge';\n\nenum EInvokeRequest {\n getMe = 'GetMe',\n getPhone = 'GetPhone',\n getContacts = 'GetContacts',\n getUserProfile = 'GetUserProfile',\n enableNotifications = 'AllowNotifications',\n disableNotifications = 'DisableNotifications',\n enablePrivateMessaging = 'EnablePrivateMessaging',\n disablePrivateMessaging = 'DisablePrivateMessaging',\n}\n\ntype SetItemType = (keyName: string, keyValue: string) => Promise<void>;\ntype GetItemType = (keyName: string) => Promise<string | null>;\ntype ClearType = () => Promise<void>;\n\ntype HeaderMenuItemClickHandlerType = (id: string) => Promise<void>;\ntype BackArrowClickHandlerType = () => Promise<void>;\n\nexport interface GetPhoneResponse {\n phone: string;\n sign: string;\n}\n\nexport interface GetMeResponse {\n name: string;\n lastname: string;\n id: string;\n avatar?: string;\n avatarThumb?: string;\n notifications_allowed: boolean;\n private_messaging_enabled: boolean;\n sign: string;\n}\n\nexport interface ResponseObject {\n phone?: string;\n name?: string;\n lastname?: string;\n}\n\nexport interface GetGeoResponse {\n latitude: number;\n longitude: number;\n}\n\nexport interface GetContactsResponse {\n contacts: Array<{\n first_name: string;\n last_name: string;\n phone: string;\n }>;\n sign: string;\n}\n\nexport interface SelectContactResponse {\n phone: string;\n name: string;\n lastname: string;\n}\n\nexport interface GetUserProfileResponse {\n name: string;\n lastname?: string;\n phone?: string;\n avatar?: string;\n avatarThumb?: string;\n}\n\nconst MAX_HEADER_MENU_ITEMS_COUNT = 3;\n\nexport enum HeaderMenuIcon {\n Search = \"Search\",\n ShoppingCart = \"ShoppingCart\",\n Menu = \"Menu\",\n Share = \"Share\",\n Notifications = \"Notifications\",\n Help = \"Help\",\n Error = \"Error\",\n Person = \"Person\",\n Sort = \"Sort\",\n Filter = \"Filter\",\n Close = \"Close\"\n}\n\nexport enum NavigationItemMode {\n SystemBackArrow = \"SystemBackArrow\",\n CustomBackArrow = \"CustomBackArrow\",\n NoItem = \"NoItem\",\n UserProfile = \"UserProfile\",\n}\n\nexport interface HeaderMenuItem {\n id: string;\n icon: HeaderMenuIcon;\n badge?: string;\n}\n\nexport interface UserStepsPerDay {\n date: string;\n steps: number;\n}\n\nexport interface UserStepInfoResponse {\n steps: UserStepsPerDay[];\n}\n\ntype OpenSettingsResponse = 'success' | 'failed';\ntype ShareResponse = 'success' | 'failed';\ntype CopyToClipboardResponse = 'success' | 'failed';\ntype VibrateResponse = 'success' | 'failed';\n// todo: remove duplicates\ntype ResponseType = 'success' | 'failed';\ntype BiometryResponse = 'success' | 'failed' | 'unavailable' | 'cancelled';\n\ntype BridgeInvoke<T extends EInvokeRequest, R> = (method: T, data?: {}) => Promise<R>;\n\ninterface BridgeStorage {\n setItem: SetItemType,\n getItem: GetItemType,\n clear: ClearType\n}\n\nexport interface AituBridge {\n version: string;\n invoke: BridgeInvoke<EInvokeRequest, ResponseObject>;\n storage: BridgeStorage;\n getMe: () => Promise<GetMeResponse>;\n getPhone: () => Promise<GetPhoneResponse>;\n getContacts: () => Promise<GetContactsResponse>;\n getGeo: () => Promise<GetGeoResponse>;\n selectContact: () => Promise<SelectContactResponse>;\n getQr: () => Promise<string>;\n getSMSCode: () => Promise<string>;\n getUserProfile: (userId: string) => Promise<GetUserProfileResponse>;\n share: (text: string) => Promise<ShareResponse>;\n setTitle: (text: string) => Promise<ResponseType>;\n copyToClipboard: (text: string) => Promise<CopyToClipboardResponse>;\n shareImage: (text: string, image: string) => Promise<ShareResponse>;\n shareFile: (text: string, filename: string, base64Data: string) => Promise<ShareResponse>;\n enableNotifications: () => Promise<{}>;\n disableNotifications: () => Promise<{}>;\n enablePrivateMessaging: (appId: string) => Promise<string>;\n disablePrivateMessaging: (appId: string) => Promise<string>;\n openSettings: () => Promise<OpenSettingsResponse>;\n closeApplication: () => Promise<ResponseType>;\n setShakeHandler: (handler: any) => void;\n setTabActiveHandler: (handler: (tabname: string) => void) => void;\n vibrate: (pattern: number[]) => Promise<VibratePattern>;\n isSupported: () => boolean;\n supports: (method: string) => boolean;\n sub: any;\n enableScreenCapture: () => Promise<{}>;\n disableScreenCapture: () => Promise<{}>;\n setHeaderMenuItems: (items: Array<HeaderMenuItem>) => Promise<ResponseType>;\n setHeaderMenuItemClickHandler: (handler: HeaderMenuItemClickHandlerType) => void;\n setCustomBackArrowMode: (enabled: boolean) => Promise<ResponseType>;\n getCustomBackArrowMode: () => Promise<boolean>;\n setCustomBackArrowVisible: (visible: boolean) => Promise<ResponseType>;\n openPayment: (transactionId: string) => Promise<ResponseType>;\n setCustomBackArrowOnClickHandler: (handler: BackArrowClickHandlerType) => void;\n checkBiometry: () => Promise<BiometryResponse>;\n openExternalUrl: (url: string) => Promise<ResponseType>;\n enableSwipeBack: () => Promise<ResponseType>;\n disableSwipeBack: () => Promise<ResponseType>;\n setNavigationItemMode: (mode: NavigationItemMode) => Promise<void>;\n getNavigationItemMode: () => Promise<NavigationItemMode>;\n getUserStepInfo: () => Promise<UserStepInfoResponse>;\n isBiometryAvailable: () =>Promise<boolean>;\n}\n\nconst invokeMethod = 'invoke';\nconst storageMethod = 'storage';\nconst getGeoMethod = 'getGeo';\nconst getQrMethod = 'getQr';\nconst getSMSCodeMethod = 'getSMSCode';\nconst selectContactMethod = 'selectContact';\nconst openSettingsMethod = 'openSettings';\nconst closeApplicationMethod = 'closeApplication';\nconst shareMethod = 'share';\nconst setTitleMethod = 'setTitle';\nconst copyToClipboardMethod = 'copyToClipboard';\nconst shareImageMethod = 'shareImage';\nconst shareFileMethod = 'shareFile';\nconst setShakeHandlerMethod = 'setShakeHandler';\nconst vibrateMethod = 'vibrate';\nconst enableScreenCaptureMethod = 'enableScreenCapture';\nconst disableScreenCaptureMethod = 'disableScreenCapture';\nconst setTabActiveHandlerMethod = 'setTabActiveHandler';\nconst setHeaderMenuItemsMethod = 'setHeaderMenuItems';\nconst setHeaderMenuItemClickHandlerMethod = 'setHeaderMenuItemClickHandler';\nconst setCustomBackArrowModeMethod = 'setCustomBackArrowMode';\nconst getCustomBackArrowModeMethod = 'getCustomBackArrowMode';\nconst setCustomBackArrowVisibleMethod = 'setCustomBackArrowVisible';\nconst openPaymentMethod = 'openPayment'\nconst setCustomBackArrowOnClickHandlerMethod = 'setCustomBackArrowOnClickHandler';\nconst checkBiometryMethod = 'checkBiometry';\nconst openExternalUrlMethod = 'openExternalUrl';\nconst enableSwipeBackMethod = 'enableSwipeBack';\nconst disableSwipeBackMethod = 'disableSwipeBack';\nconst setNavigationItemModeMethod = 'setNavigationItemMode';\nconst getNavigationItemModeMethod = 'getNavigationItemMode';\nconst getUserStepInfoMethod = 'getUserStepInfo';\nconst isBiometryAvailableMethod = 'isBiometryAvailable';\n\nconst android = typeof window !== 'undefined' && (window as any).AndroidBridge;\nconst ios = typeof window !== 'undefined' && (window as any).webkit && (window as any).webkit.messageHandlers;\nconst web = typeof window !== 'undefined' && (window.top !== window) && WebBridge;\n\nconst buildBridge = (): AituBridge => {\n const subs = [];\n\n if (typeof window !== 'undefined') {\n window.addEventListener('aituEvents', (e: any) => {\n [...subs].map((fn) => fn.call(null, e));\n })\n }\n\n const invoke = (reqId, method, data = {}) => {\n const isAndroid = android && android[invokeMethod];\n const isIos = ios && ios[invokeMethod];\n\n if (isAndroid) {\n android[invokeMethod](reqId, method, JSON.stringify(data));\n } else if (isIos) {\n ios[invokeMethod].postMessage({ reqId, method, data });\n } else if (web) {\n web.execute(invokeMethod, reqId, method, data)\n } else if (typeof window !== 'undefined') {\n console.log('--invoke-isUnknown');\n }\n };\n\n const storage = (reqId, method, data = {}) => {\n const isAndroid = android && android[storageMethod];\n const isIos = ios && ios[storageMethod];\n\n if (isAndroid) {\n android[storageMethod](reqId, method, JSON.stringify(data));\n } else if (isIos) {\n ios[storageMethod].postMessage({ reqId, method, data });\n } else if (web) {\n web.execute(storageMethod, reqId, method, data);\n } else if (typeof window !== 'undefined') {\n console.log('--storage-isUnknown');\n }\n }\n\n const getGeo = (reqId) => {\n const isAndroid = android && android[getGeoMethod];\n const isIos = ios && ios[getGeoMethod];\n\n if (isAndroid) {\n android[getGeoMethod](reqId);\n } else if (isIos) {\n ios[getGeoMethod].postMessage({ reqId });\n } else if (web) {\n web.execute(getGeoMethod, reqId);\n } else if (typeof window !== 'undefined') {\n console.log('--getGeo-isUnknown');\n }\n }\n\n const getQr = (reqId) => {\n const isAndroid = android && android[getQrMethod];\n const isIos = ios && ios[getQrMethod];\n\n if (isAndroid) {\n android[getQrMethod](reqId);\n } else if (isIos) {\n ios[getQrMethod].postMessage({ reqId });\n } else if (web) {\n web.execute(getQrMethod, reqId);\n } else if (typeof window !== 'undefined') {\n console.log('--getQr-isUnknown');\n }\n }\n\n const getSMSCode = (reqId) => {\n const isAndroid = android && android[getSMSCodeMethod];\n const isIos = ios && ios[getSMSCodeMethod];\n\n if (isAndroid) {\n android[getSMSCodeMethod](reqId);\n } else if (isIos) {\n ios[getSMSCodeMethod].postMessage({ reqId });\n } else if (web) {\n web.execute(getSMSCodeMethod, reqId);\n } else if (typeof window !== 'undefined') {\n console.log('--getSMSCode-isUnknown');\n }\n }\n\n const selectContact = (reqId) => {\n const isAndroid = android && android[selectContactMethod];\n const isIos = ios && ios[selectContactMethod];\n\n if (isAndroid) {\n android[selectContactMethod](reqId);\n } else if (isIos) {\n ios[selectContactMethod].postMessage({ reqId });\n } else if (web) {\n web.execute(selectContactMethod, reqId);\n } else if (typeof window !== 'undefined') {\n console.log('--selectContact-isUnknown');\n }\n }\n\n const openSettings = (reqId) => {\n const isAndroid = android && android[openSettingsMethod];\n const isIos = ios && ios[openSettingsMethod];\n\n if (isAndroid) {\n android[openSettingsMethod](reqId);\n } else if (isIos) {\n ios[openSettingsMethod].postMessage({ reqId });\n } else if (web) {\n web.execute(openSettingsMethod, reqId);\n } else if (typeof window !== 'undefined') {\n console.log('--openSettings-isUnknown');\n }\n }\n\n const closeApplication = (reqId) => {\n const isAndroid = android && android[closeApplicationMethod];\n const isIos = ios && ios[closeApplicationMethod];\n\n if (isAndroid) {\n android[closeApplicationMethod](reqId);\n } else if (isIos) {\n ios[closeApplicationMethod].postMessage({ reqId });\n } else if (web) {\n web.execute(closeApplicationMethod, reqId);\n } else if (typeof window !== 'undefined') {\n console.log('--closeApplication-isUnknown');\n }\n }\n\n const share = (reqId, text) => {\n const isAndroid = android && android[shareMethod];\n const isIos = ios && ios[shareMethod];\n\n if (isAndroid) {\n android[shareMethod](reqId, text);\n } else if (isIos) {\n ios[shareMethod].postMessage({ reqId, text });\n } else if (web) {\n web.execute(shareMethod, reqId, text);\n } else if (typeof window !== 'undefined') {\n console.log('--share-isUnknown');\n }\n }\n\n const setTitle = (reqId, text) => {\n const isAndroid = android && android[setTitleMethod];\n const isIos = ios && ios[setTitleMethod];\n\n if (isAndroid) {\n android[setTitleMethod](reqId, text);\n } else if (isIos) {\n ios[setTitleMethod].postMessage({ reqId, text });\n } else if (web) {\n web.execute(setTitleMethod, reqId, text);\n } else if (typeof window !== 'undefined') {\n console.log('--setTitle-isUnknown');\n }\n }\n\n const copyToClipboard = (reqId, text) => {\n const isAndroid = android && android[copyToClipboardMethod];\n const isIos = ios && ios[copyToClipboardMethod];\n\n if (isAndroid) {\n android[copyToClipboardMethod](reqId, text);\n } else if (isIos) {\n ios[copyToClipboardMethod].postMessage({ reqId, text });\n } else if (web) {\n web.execute(copyToClipboardMethod, reqId, text);\n } else if (typeof window !== 'undefined') {\n console.log('--copyToClipboard-isUnknown');\n }\n }\n\n const enableScreenCapture = (reqId) => {\n const isAndroid = android && android[enableScreenCaptureMethod];\n const isIos = ios && ios[enableScreenCaptureMethod];\n\n if (isAndroid) {\n android[enableScreenCaptureMethod](reqId);\n } else if (isIos) {\n ios[enableScreenCaptureMethod].postMessage({ reqId });\n } else if (web) {\n web.execute(enableScreenCaptureMethod, reqId);\n } else if (typeof window !== 'undefined') {\n console.log('--enableScreenCapture-isUnknown');\n }\n }\n\n const disableScreenCapture = (reqId) => {\n const isAndroid = android && android[disableScreenCaptureMethod];\n const isIos = ios && ios[disableScreenCaptureMethod];\n\n if (isAndroid) {\n android[disableScreenCaptureMethod](reqId);\n } else if (isIos) {\n ios[disableScreenCaptureMethod].postMessage({ reqId });\n } else if (web) {\n web.execute(disableScreenCaptureMethod, reqId);\n } else if (typeof window !== 'undefined') {\n console.log('--disableScreenCapture-isUnknown');\n }\n }\n\n const shareImage = (reqId, text, image) => {\n // !!!======================!!!\n // !!!===== Deprecated =====!!!\n // !!!======================!!!\n\n // const isAndroid = android && android[shareImageMethod];\n // const isIos = ios && ios[shareImageMethod];\n\n // if (isAndroid) {\n // android[shareImageMethod](reqId, text, image);\n // } else if (isIos) {\n // ios[shareImageMethod].postMessage({ reqId, text, image });\n // } else if (typeof window !== 'undefined') {\n // console.log('--shareImage-isWeb');\n // }\n\n // new one - fallback to shareFile\n const isAndroid = android && android[shareFileMethod];\n const isIos = ios && ios[shareFileMethod];\n\n // get extension from base64 mime type and merge with name\n const ext = image.split(';')[0].split('/')[1];\n const filename = 'image.' + ext;\n // remove mime type\n const base64Data = image.substr(image.indexOf(',') + 1);\n\n if (isAndroid) {\n android[shareFileMethod](reqId, text, filename, base64Data);\n } else if (isIos) {\n ios[shareFileMethod].postMessage({ reqId, text, filename, base64Data });\n } else if (web) {\n web.execute(shareFileMethod, reqId, { text, filename, base64Data });\n } else if (typeof window !== 'undefined') {\n console.log('--shareFile-isUnknown');\n }\n }\n\n const shareFile = (reqId, text, filename, base64Data) => {\n const isAndroid = android && android[shareFileMethod];\n const isIos = ios && ios[shareFileMethod];\n\n if (isAndroid) {\n android[shareFileMethod](reqId, text, filename, base64Data);\n } else if (isIos) {\n ios[shareFileMethod].postMessage({ reqId, text, filename, base64Data });\n } else if (web) {\n web.execute(shareFileMethod, reqId, text, filename, base64Data);\n } else if (typeof window !== 'undefined') {\n console.log('--shareFile-isUnknown');\n }\n }\n\n const enableNotifications = () => invokePromise(EInvokeRequest.enableNotifications);\n\n const disableNotifications = () => invokePromise(EInvokeRequest.disableNotifications);\n\n const setShakeHandler = (handler) => {\n const isAndroid = android && android[setShakeHandlerMethod];\n const isIos = ios && ios[setShakeHandlerMethod];\n\n if (isAndroid || isIos || web) {\n (window as any).onAituBridgeShake = handler;\n } else if (typeof window !== 'undefined') {\n console.log('--setShakeHandler-isUnknown');\n }\n };\n\n const setTabActiveHandler = (handler: (tabname: string) => void) => {\n const isAndroid = android && android[setTabActiveHandlerMethod];\n const isIos = ios && ios[setTabActiveHandlerMethod];\n\n if (isAndroid || isIos || web) {\n (window as any).onAituBridgeTabActive = handler;\n } else if (typeof window !== 'undefined') {\n console.log('--setTabActiveHandler-isUnknown');\n }\n };\n\n const vibrate = (reqId, pattern) => {\n if (\n !Array.isArray(pattern) ||\n pattern.some((timing) => timing < 1 || timing !== Math.floor(timing)) ||\n pattern.reduce((total, timing) => total + timing) > 10000\n ) {\n console.error('Pattern should be an array of positive integers no longer than 10000ms total');\n return;\n }\n\n const isAndroid = android && android[vibrateMethod];\n const isIos = ios && ios[vibrateMethod];\n\n if (isAndroid) {\n android[vibrateMethod](reqId, JSON.stringify(pattern));\n } else if (isIos) {\n ios[vibrateMethod].postMessage({ reqId, pattern });\n } else if (web) {\n web.execute(vibrateMethod, reqId, pattern);\n } else if (typeof window !== 'undefined') {\n console.log('--vibrate-isUnknown');\n }\n }\n\n const isSupported = () => {\n const iosSup = ios && (window as any).webkit.messageHandlers.invoke;\n return Boolean(android || iosSup || web);\n }\n\n // TODO: implement web support\n const supports = (method) =>\n (android && typeof android[method] === 'function') ||\n (ios && ios[method] && typeof ios[method].postMessage === 'function') ||\n (web && typeof web[method] === 'function');\n\n const sub = (listener: any) => {\n subs.push(listener);\n }\n\n const setHeaderMenuItems = (reqId, items: Array<HeaderMenuItem>) => {\n if (items.length > MAX_HEADER_MENU_ITEMS_COUNT) {\n console.error('SetHeaderMenuItems: items count should not be more than ' + MAX_HEADER_MENU_ITEMS_COUNT);\n return;\n }\n\n const isAndroid = android && android[setHeaderMenuItemsMethod];\n const isIos = ios && ios[setHeaderMenuItemsMethod];\n\n const itemsJsonArray = JSON.stringify(items);\n\n if (isAndroid) {\n android[setHeaderMenuItemsMethod](reqId, itemsJsonArray);\n } else if (isIos) {\n ios[setHeaderMenuItemsMethod].postMessage({ reqId, itemsJsonArray });\n } else if (web) {\n web.execute(setHeaderMenuItemsMethod, reqId, itemsJsonArray);\n } else if (typeof window !== 'undefined') {\n console.log('--setHeaderMenuItems-isUnknown');\n }\n }\n\n const setHeaderMenuItemClickHandler = (handler: HeaderMenuItemClickHandlerType) => {\n const isAndroid = android && android[setHeaderMenuItemClickHandlerMethod];\n const isIos = ios && ios[setHeaderMenuItemClickHandlerMethod];\n\n if (isAndroid || isIos || web) {\n (window as any).onAituBridgeHeaderMenuItemClick = handler;\n } else if (typeof window !== 'undefined') {\n console.log('--setHeaderMenuItemClickHandler-isUnknown');\n }\n }\n\n /**\n * @deprecated данный метод не рекомендуется использовать\n * вместо него используйте setNavigationItemMode\n */\n const setCustomBackArrowMode = (reqId, enabled: boolean) => {\n const isAndroid = android && android[setCustomBackArrowModeMethod];\n const isIos = ios && ios[setCustomBackArrowModeMethod];\n\n if (isAndroid) {\n android[setCustomBackArrowModeMethod](reqId, enabled);\n } else if (isIos) {\n ios[setCustomBackArrowModeMethod].postMessage({ reqId, enabled });\n } else if (web) {\n web.execute(setCustomBackArrowModeMethod, reqId, enabled);\n } else if (typeof window !== 'undefined') {\n console.log('--setCustomBackArrowMode-isUnknown');\n }\n }\n\n /**\n * @deprecated данный метод не рекомендуется использовать\n * вместо него используйте getNavigationItemMode\n */\n const getCustomBackArrowMode = (reqId) => {\n const isAndroid = android && android[getCustomBackArrowModeMethod];\n const isIos = ios && ios[getCustomBackArrowModeMethod];\n\n if (isAndroid) {\n android[getCustomBackArrowModeMethod](reqId);\n } else if (isIos) {\n ios[getCustomBackArrowModeMethod].postMessage({ reqId });\n } else if (web) {\n web.execute(getCustomBackArrowModeMethod, reqId);\n } else if (typeof window !== 'undefined') {\n console.log('--getCustomBackArrowMode-isUnknown');\n }\n }\n\n /**\n * @deprecated данный метод не рекомендуется использовать\n * вместо него используйте setNavigationItemMode\n */\n const setCustomBackArrowVisible = (reqId, visible: boolean) => {\n const isAndroid = android && android[setCustomBackArrowVisibleMethod];\n const isIos = ios && ios[setCustomBackArrowVisibleMethod];\n\n if (isAndroid) {\n android[setCustomBackArrowVisibleMethod](reqId, visible);\n } else if (isIos) {\n ios[setCustomBackArrowVisibleMethod].postMessage({ reqId, visible });\n } else if (web) {\n web.execute(setCustomBackArrowVisibleMethod, reqId, visible);\n } else if (typeof window !== 'undefined') {\n console.log('--setCustomBackArrowVisible-isUnknown');\n }\n }\n\n const setCustomBackArrowOnClickHandler = (handler: BackArrowClickHandlerType) => {\n const isAndroid = android && android[setCustomBackArrowOnClickHandlerMethod];\n const isIos = ios && ios[setCustomBackArrowOnClickHandlerMethod];\n\n if (isAndroid || isIos || web) {\n (window as any).onAituBridgeBackArrowClick = handler;\n } else if (typeof window !== 'undefined') {\n console.log('--setCustomBackArrowOnClickHandler-isUnknown');\n }\n }\n\n const openPayment = (reqId, transactionId: string) => {\n const isAndroid = android && android[openPaymentMethod];\n const isIos = ios && ios[openPaymentMethod];\n\n if (isAndroid) {\n android[openPaymentMethod](reqId, transactionId);\n } else if (isIos) {\n ios[openPaymentMethod].postMessage({ reqId, transactionId });\n } else {\n console.log('--openPayment-isUnknown');\n }\n }\n\n const checkBiometry = (reqId) => {\n const isAndroid = android && android[checkBiometryMethod];\n const isIos = ios && ios[checkBiometryMethod];\n\n if (isAndroid) {\n android[checkBiometryMethod](reqId);\n } else if (isIos) {\n ios[checkBiometryMethod].postMessage({ reqId });\n } else if (web) {\n web.execute(checkBiometryMethod, reqId);\n } else if (typeof window !== 'undefined') {\n console.log('--checkBiometry-isUnknown');\n }\n }\n\n const openExternalUrl = (reqId, url: string) => {\n const isAndroid = android && android[openExternalUrlMethod];\n const isIos = ios && ios[openExternalUrlMethod];\n\n if (isAndroid) {\n android[openExternalUrlMethod](reqId, url);\n } else if (isIos) {\n ios[openExternalUrlMethod].postMessage({ reqId, url });\n } else {\n console.log(\"--openExternalUrlMethod-isUnknown\");\n }\n };\n\n const enableSwipeBack = (reqId) => {\n const isAndroid = android && android[enableSwipeBackMethod];\n const isIos = ios && ios[enableSwipeBackMethod];\n\n if (isAndroid) {\n android[enableSwipeBackMethod](reqId);\n } else if (isIos) {\n ios[enableSwipeBackMethod].postMessage({ reqId });\n } else if (web) {\n web.execute(enableSwipeBackMethod, reqId);\n } else if (typeof window !== 'undefined') {\n console.log('--enableSwipeBack-isUnknown');\n }\n }\n\n const disableSwipeBack = (reqId) => {\n const isAndroid = android && android[disableSwipeBackMethod];\n const isIos = ios && ios[disableSwipeBackMethod];\n\n if (isAndroid) {\n android[disableSwipeBackMethod](reqId);\n } else if (isIos) {\n ios[disableSwipeBackMethod].postMessage({ reqId });\n } else if (web) {\n web.execute(disableSwipeBackMethod, reqId);\n } else if (typeof window !== 'undefined') {\n console.log('--disableSwipeBack-isUnknown');\n }\n }\n\n const setNavigationItemMode = (reqId, mode: NavigationItemMode) => {\n const isAndroid = android && android[setNavigationItemModeMethod];\n const isIos = ios && ios[setNavigationItemModeMethod];\n\n if (isAndroid) {\n android[setNavigationItemModeMethod](reqId, mode);\n } else if (isIos) {\n ios[setNavigationItemModeMethod].postMessage({ reqId, mode });\n } else if (web) {\n web.execute(setNavigationItemModeMethod, reqId, mode);\n } else if (typeof window !== 'undefined') {\n console.log('--setNavigationItemMode-isUnknown');\n }\n }\n\n const getNavigationItemMode = (reqId) => {\n const isAndroid = android && android[getNavigationItemModeMethod];\n const isIos = ios && ios[getNavigationItemModeMethod];\n\n if (isAndroid) {\n android[getNavigationItemModeMethod](reqId);\n } else if (isIos) {\n ios[getNavigationItemModeMethod].postMessage({ reqId });\n } else if (web) {\n web.execute(getNavigationItemModeMethod, reqId);\n } else if (typeof window !== 'undefined') {\n console.log('--getNavigationItemMode-isUnknown');\n }\n }\n\n const getUserStepInfo = (reqId) => {\n const isAndroid = android && android[getUserStepInfoMethod];\n const isIos = ios && ios[getUserStepInfoMethod];\n\n if (isAndroid) {\n android[getUserStepInfoMethod](reqId);\n } else if (isIos) {\n ios[getUserStepInfoMethod].postMessage({ reqId });\n } else if (web) {\n console.log('--getUserStepInfo-isWeb');\n } else if (typeof window !== 'undefined') {\n console.log('--getUserStepInfo-isUnknown');\n }\n }\n\n const isBiometryAvailable = (reqId) => {\n const isAndroid = android && android[isBiometryAvailableMethod];\n const isIos = ios && ios[isBiometryAvailableMethod];\n\n if (isAndroid) {\n android[isBiometryAvailableMethod](reqId);\n } else if (isIos) {\n ios[isBiometryAvailableMethod].postMessage({ reqId });\n } else if (web) {\n console.log('--isBiometryAvailable-isWeb');\n } else if (typeof window !== 'undefined') {\n console.log('--isBiometryAvailable-isUnknown');\n }\n }\n\n\n const invokePromise = promisifyInvoke(invoke, sub);\n const storagePromise = promisifyStorage(storage, sub);\n const getGeoPromise = promisifyMethod(getGeo, getGeoMethod, sub);\n const getQrPromise = promisifyMethod(getQr, getQrMethod, sub);\n const getSMSCodePromise = promisifyMethod(getSMSCode, getSMSCodeMethod, sub);\n const selectContactPromise = promisifyMethod(selectContact, selectContactMethod, sub);\n const openSettingsPromise = promisifyMethod(openSettings, openSettingsMethod, sub);\n const closeApplicationPromise = promisifyMethod(closeApplication, closeApplicationMethod, sub);\n const sharePromise = promisifyMethod(share, shareMethod, sub);\n const setTitlePromise = promisifyMethod(setTitle, setTitleMethod, sub);\n const copyToClipboardPromise = promisifyMethod(copyToClipboard, copyToClipboardMethod, sub);\n const shareImagePromise = promisifyMethod(shareImage, shareImageMethod, sub);\n const shareFilePromise = promisifyMethod(shareFile, shareFileMethod, sub);\n const vibratePromise = promisifyMethod(vibrate, vibrateMethod, sub);\n const enableScreenCapturePromise = promisifyMethod(enableScreenCapture, enableScreenCaptureMethod, sub);\n const disableScreenCapturePromise = promisifyMethod(disableScreenCapture, disableScreenCaptureMethod, sub);\n const setHeaderMenuItemsPromise = promisifyMethod(setHeaderMenuItems, setHeaderMenuItemsMethod, sub);\n const setCustomBackArrowModePromise = promisifyMethod(setCustomBackArrowMode, setCustomBackArrowModeMethod, sub);\n const getCustomBackArrowModePromise = promisifyMethod(getCustomBackArrowMode, getCustomBackArrowModeMethod, sub);\n const setCustomBackArrowVisiblePromise = promisifyMethod(setCustomBackArrowVisible, setCustomBackArrowVisibleMethod, sub);\n const openPaymentPromise = promisifyMethod(openPayment, openPaymentMethod, sub);\n const checkBiometryPromise = promisifyMethod(checkBiometry, checkBiometryMethod, sub);\n const openExternalUrlPromise = promisifyMethod(openExternalUrl, openExternalUrlMethod, sub);\n const enableSwipeBackPromise = promisifyMethod(enableSwipeBack, enableSwipeBackMethod, sub);\n const disableSwipeBackPromise = promisifyMethod(disableSwipeBack, disableSwipeBackMethod, sub);\n const setNavigationItemModePromise = promisifyMethod(setNavigationItemMode, setNavigationItemModeMethod, sub);\n const getNavigationItemModePromise = promisifyMethod(getNavigationItemMode, getNavigationItemModeMethod, sub);\n const getUserStepInfoPromise = promisifyMethod(getUserStepInfo, getUserStepInfoMethod, sub);\n const isBiometryAvailablePromise = promisifyMethod(isBiometryAvailable, isBiometryAvailableMethod, sub);\n\n return {\n version: String(LIB_VERSION),\n copyToClipboard: copyToClipboardPromise,\n invoke: invokePromise,\n storage: storagePromise,\n getMe: () => invokePromise(EInvokeRequest.getMe),\n getPhone: () => invokePromise(EInvokeRequest.getPhone),\n getContacts: () => invokePromise(EInvokeRequest.getContacts),\n getGeo: getGeoPromise,\n getQr: getQrPromise,\n getSMSCode: getSMSCodePromise,\n getUserProfile: (id: string) =>\n invokePromise(EInvokeRequest.getUserProfile, { id }),\n selectContact: selectContactPromise,\n enableNotifications,\n disableNotifications,\n enablePrivateMessaging: (appId: string) =>\n invokePromise(EInvokeRequest.enablePrivateMessaging, { appId }),\n disablePrivateMessaging: (appId: string) =>\n invokePromise(EInvokeRequest.disablePrivateMessaging, { appId }),\n openSettings: openSettingsPromise,\n closeApplication: closeApplicationPromise,\n setTitle: setTitlePromise,\n share: sharePromise,\n shareImage: shareImagePromise,\n shareFile: shareFilePromise,\n setShakeHandler,\n setTabActiveHandler,\n vibrate: vibratePromise,\n isSupported,\n supports,\n sub,\n enableScreenCapture: enableScreenCapturePromise,\n disableScreenCapture: disableScreenCapturePromise,\n setHeaderMenuItems: setHeaderMenuItemsPromise,\n setHeaderMenuItemClickHandler,\n setCustomBackArrowMode: setCustomBackArrowModePromise,\n getCustomBackArrowMode: getCustomBackArrowModePromise,\n setCustomBackArrowVisible: setCustomBackArrowVisiblePromise,\n openPayment: openPaymentPromise,\n setCustomBackArrowOnClickHandler,\n checkBiometry: checkBiometryPromise,\n openExternalUrl: openExternalUrlPromise,\n enableSwipeBack: enableSwipeBackPromise,\n disableSwipeBack: disableSwipeBackPromise,\n setNavigationItemMode: setNavigationItemModePromise,\n getNavigationItemMode: getNavigationItemModePromise,\n getUserStepInfo: getUserStepInfoPromise,\n isBiometryAvailable: isBiometryAvailablePromise,\n };\n}\n\nconst bridge = buildBridge();\n\nexport default bridge;\n","export const LIB_VERSION = \"0.3.56\";\n"],"names":["createRequestResolver","prefix","counter","current","next","this","createCounter","promiseControllers","add","controller","customId","id","resolve","reqId","data","isSuccess","error","requestPromise","reject","handleSubscribe","subscribe","requestResolver","event","detail","promisifyMethod","method","methodName","Promise","aituOrigin","URLSearchParams","window","location","search","get","localStorage","setItem","getItem","WebBridge","origin","execute","top","postMessage","source","payload","addEventListener","dispatchEvent","CustomEvent","message","JSON","parse","onAituBridgeBackArrowClick","onAituBridgeHeaderMenuItemClick","param","e","console","log","EInvokeRequest","HeaderMenuIcon","NavigationItemMode","android","AndroidBridge","ios","webkit","messageHandlers","web","bridge","subs","map","fn","call","sub","listener","push","invokePromise","invokeMethodName","props","isIos","stringify","invoke","storagePromise","storage","keyName","keyValue","clear","promisifyStorage","getGeoPromise","getQrPromise","getSMSCodePromise","selectContactPromise","openSettingsPromise","closeApplicationPromise","sharePromise","text","setTitlePromise","copyToClipboardPromise","shareImagePromise","image","isAndroid","filename","split","base64Data","substr","indexOf","shareFilePromise","vibratePromise","pattern","Array","isArray","some","timing","Math","floor","reduce","total","enableScreenCapturePromise","disableScreenCapturePromise","setHeaderMenuItemsPromise","items","length","itemsJsonArray","setCustomBackArrowModePromise","enabled","getCustomBackArrowModePromise","setCustomBackArrowVisiblePromise","visible","openPaymentPromise","transactionId","checkBiometryPromise","openExternalUrlPromise","url","enableSwipeBackPromise","disableSwipeBackPromise","setNavigationItemModePromise","mode","getNavigationItemModePromise","getUserStepInfoPromise","isBiometryAvailablePromise","version","String","copyToClipboard","getMe","getPhone","getContacts","getGeo","getQr","getSMSCode","getUserProfile","selectContact","enableNotifications","disableNotifications","enablePrivateMessaging","appId","disablePrivateMessaging","openSettings","closeApplication","setTitle","share","shareImage","shareFile","setShakeHandler","handler","onAituBridgeShake","setTabActiveHandler","onAituBridgeTabActive","vibrate","isSupported","iosSup","Boolean","supports","enableScreenCapture","disableScreenCapture","setHeaderMenuItems","setHeaderMenuItemClickHandler","setCustomBackArrowMode","getCustomBackArrowMode","setCustomBackArrowVisible","openPayment","setCustomBackArrowOnClickHandler","checkBiometry","openExternalUrl","enableSwipeBack","disableSwipeBack","setNavigationItemMode","getNavigationItemMode","getUserStepInfo","isBiometryAvailable","buildBridge"],"mappings":"0LASA,SAASA,EAAsBC,GAM3B,IAAMC,EAfV,SAAuBD,GACnB,gBADmBA,IAAAA,EAAS,MACrB,CACHE,QAAS,EACTC,gBACI,OAAOH,KAAWI,KAAKF,UAWfG,CAAcL,GACxBM,EAA+D,GAErE,MAAO,CACHC,aAAIC,EAA+BC,YAAAA,IAAAA,EAAW,IAC1C,IAAMC,EAAKD,EAAWR,EAAQE,OAE9B,O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OA,EAAG,qBAEEG,EACvBlC,OAAeqI,sBAAwBH,EACb,oBAAXlI,QAChBwB,QAAQC,IAAI,oCA8Ud6G,QAAS5D,EACT6D,YAnTkB,WAClB,IAAMC,EAASzG,GAAQ/B,OAAegC,OAAOC,gBAAgBe,OAC7D,OAAOyF,QAAQ5G,GAAW2G,GAAUtG,IAkTpCwG,SA9Se,SAAC/I,UACfkC,GAAsC,mBAApBA,EAAQlC,IAC1BoC,GAAOA,EAAIpC,IAA8C,mBAA5BoC,EAAIpC,GAAQgB,aACzCuB,GAA8B,mBAAhBA,EAAIvC,IA4SnB6C,IAAAA,EACAmG,oBAAqBvD,EACrBwD,qBAAsBvD,EACtBwD,mBAAoBvD,EACpBwD,8BApRoC,SAACZ,GACnBrG,GAAWA,EAAO,+BACtBE,GAAOA,EAAG,+BAEEG,EACvBlC,OAAeqB,gCAAkC6G,EACvB,oBAAXlI,QAChBwB,QAAQC,IAAI,8CA8QdsH,uBAAwBrD,EACxBsD,uBAAwBpD,EACxBqD,0BAA2BpD,EAC3BqD,YAAanD,EACboD,iCArNuC,SAACjB,GACtBrG,GAAWA,EAAO,kCACtBE,GAAOA,EAAG,kCAEEG,EACvBlC,OAAeoB,2BAA6B8G,EAClB,oBAAXlI,QAChBwB,QAAQC,IAAI,iDA+Md2H,cAAenD,EACfoD,gBAAiBnD,EACjBoD,gBAAiBlD,EACjBmD,iBAAkBlD,EAClBmD,sBAAuBlD,EACvBmD,sBAAuBjD,EACvBkD,gBAAiBjD,EACjBkD,oBAAqBjD,GAIVkD"}
1
+ {"version":3,"file":"index.umd.js","sources":["../src/utils.ts","../src/webBridge.ts","../src/index.ts","../src/version.ts"],"sourcesContent":["function createCounter(prefix = 'm:') {\n return {\n current: 0,\n next() {\n return prefix + ++this.current;\n },\n };\n}\n\nfunction createRequestResolver(prefix: string) {\n type PromiseController = {\n resolve: (value: any) => any;\n reject: (reason: any) => any;\n };\n\n const counter = createCounter(prefix);\n const promiseControllers: Record<string, PromiseController | null> = {};\n\n return {\n add(controller: PromiseController, customId = ''): number | string {\n const id = customId + counter.next()\n promiseControllers[id] = controller;\n return id;\n },\n\n resolve<T>(reqId: number | string, data: T, isSuccess: (data: T) => boolean, error: any) {\n const requestPromise = promiseControllers[reqId];\n\n if (requestPromise) {\n if (isSuccess(error)) {\n requestPromise.resolve(data);\n } else {\n requestPromise.reject(error);\n }\n\n promiseControllers[reqId] = null;\n }\n },\n };\n}\n\nfunction handleSubscribe(subscribe: (handler: (event: any) => void) => void, requestResolver: ReturnType<typeof createRequestResolver>) {\n subscribe(event => {\n if (!event.detail) {\n return;\n }\n\n if ('reqId' in event.detail) {\n const { reqId, data, error } = event.detail;\n\n if (reqId) {\n requestResolver.resolve(reqId, data, (error) => !(error), error);\n }\n }\n })\n}\n\nexport function promisifyStorage(storage, subscribe: (fn: any) => void) {\n const requestResolver = createRequestResolver('storage:');\n\n handleSubscribe(subscribe, requestResolver)\n\n return {\n setItem: (keyName: string, keyValue: string): Promise<void> => {\n return new Promise((resolve, reject) => {\n const reqId = requestResolver.add({ resolve, reject });\n storage(reqId, 'setItem', { keyName, keyValue });\n });\n },\n getItem: (keyName: string): Promise<string | null> => {\n return new Promise((resolve, reject) => {\n const reqId = requestResolver.add({ resolve, reject });\n storage(reqId, 'getItem', { keyName });\n });\n },\n clear: (): Promise<void> => {\n return new Promise((resolve, reject) => {\n const reqId = requestResolver.add({ resolve, reject });\n storage(reqId, 'clear', {});\n });\n },\n }\n}\n\nexport function promisifyInvoke(invoke, subscribe: (fn: any) => void) {\n const requestResolver = createRequestResolver('invoke:');\n\n handleSubscribe(subscribe, requestResolver)\n\n return function promisifiedFunc(invokeMethodName: string, props: any = {}): Promise<any | void> {\n return new Promise((resolve, reject) => {\n const reqId = requestResolver.add({ resolve, reject }, invokeMethodName + ':');\n\n invoke(reqId, invokeMethodName, props);\n });\n };\n}\n\nexport function promisifyMethod(method: Function, methodName: string, subscribe: (fn: any) => void) {\n const requestResolver = createRequestResolver(methodName + ':');\n\n handleSubscribe(subscribe, requestResolver)\n\n return function promisifiedFunc(...args: any[]): Promise<any | void> {\n return new Promise((resolve, reject) => {\n const reqId = requestResolver.add({ resolve, reject });\n method(reqId, ...args);\n });\n };\n}\n\n\n\n","import type { AituBridge } from './index';\n\nconst AITU_DOMAIN_PARAM = '__aitu-domain'\n\nconst searchParams = new URLSearchParams(window.location.search)\n\nlet aituOrigin = searchParams.get(AITU_DOMAIN_PARAM)\n\nif(aituOrigin){\n localStorage.setItem('mini-app-domain', aituOrigin)\n}else{\n aituOrigin = localStorage.getItem('mini-app-domain')\n}\ninterface WebBridge {\n execute(method: keyof AituBridge, reqId: string, ...payload: any[] ): void\n origin: string\n}\n\nlet WebBridge: WebBridge | null = null\n\nif (aituOrigin) {\n WebBridge = {\n origin: aituOrigin,\n execute: (method, reqId, ...payload) => {\n window.top.postMessage({\n source: 'aitu-bridge',\n method,\n reqId,\n payload: [...payload],\n },\n WebBridge.origin\n )\n }\n\n }\n window.addEventListener('message', event => {\n if (event.origin === aituOrigin && event.data) {\n\n // dispatch aitu events\n window.dispatchEvent(new CustomEvent('aituEvents', { detail: event.data }));\n\n // try to detect handler call\n if (typeof event.data !== 'string' || event.data === '') {\n return;\n }\n\n try {\n const message = JSON.parse(event.data)\n\n if (message && message['method']) {\n if (message.method === 'setCustomBackArrowOnClickHandler') {\n (window as any).onAituBridgeBackArrowClick()\n } else if (message.method === 'setHeaderMenuItemClickHandler') {\n (window as any).onAituBridgeHeaderMenuItemClick(message.param)\n }\n }\n } catch (e) {\n console.log('Error parsing message data: ' + e);\n }\n }\n })\n}\n\nexport default WebBridge\n","import { LIB_VERSION } from './version';\n\nimport {\n promisifyMethod,\n promisifyStorage,\n promisifyInvoke,\n} from './utils'\n\nimport WebBridge from './webBridge';\n\nenum EInvokeRequest {\n getMe = 'GetMe',\n getPhone = 'GetPhone',\n getContacts = 'GetContacts',\n getUserProfile = 'GetUserProfile',\n enableNotifications = 'AllowNotifications',\n disableNotifications = 'DisableNotifications',\n enablePrivateMessaging = 'EnablePrivateMessaging',\n disablePrivateMessaging = 'DisablePrivateMessaging',\n}\n\ntype SetItemType = (keyName: string, keyValue: string) => Promise<void>;\ntype GetItemType = (keyName: string) => Promise<string | null>;\ntype ClearType = () => Promise<void>;\n\ntype HeaderMenuItemClickHandlerType = (id: string) => Promise<void>;\ntype BackArrowClickHandlerType = () => Promise<void>;\n\nexport interface GetPhoneResponse {\n phone: string;\n sign: string;\n}\n\nexport interface GetMeResponse {\n name: string;\n lastname: string;\n id: string;\n avatar?: string;\n avatarThumb?: string;\n notifications_allowed: boolean;\n private_messaging_enabled: boolean;\n sign: string;\n}\n\nexport interface ResponseObject {\n phone?: string;\n name?: string;\n lastname?: string;\n}\n\nexport interface GetGeoResponse {\n latitude: number;\n longitude: number;\n}\n\nexport interface GetContactsResponse {\n contacts: Array<{\n first_name: string;\n last_name: string;\n phone: string;\n }>;\n sign: string;\n}\n\nexport interface SelectContactResponse {\n phone: string;\n name: string;\n lastname: string;\n}\n\nexport interface GetUserProfileResponse {\n name: string;\n lastname?: string;\n phone?: string;\n avatar?: string;\n avatarThumb?: string;\n}\n\nconst MAX_HEADER_MENU_ITEMS_COUNT = 3;\n\nexport enum HeaderMenuIcon {\n Search = \"Search\",\n ShoppingCart = \"ShoppingCart\",\n Menu = \"Menu\",\n Share = \"Share\",\n Notifications = \"Notifications\",\n Help = \"Help\",\n Error = \"Error\",\n Person = \"Person\",\n Sort = \"Sort\",\n Filter = \"Filter\",\n Close = \"Close\"\n}\n\nexport enum NavigationItemMode {\n SystemBackArrow = \"SystemBackArrow\",\n CustomBackArrow = \"CustomBackArrow\",\n NoItem = \"NoItem\",\n UserProfile = \"UserProfile\",\n}\n\nexport interface HeaderMenuItem {\n id: string;\n icon: HeaderMenuIcon;\n badge?: string;\n}\n\nexport interface UserStepsPerDay {\n date: string;\n steps: number;\n}\n\nexport interface UserStepInfoResponse {\n steps: UserStepsPerDay[];\n}\n\ntype OpenSettingsResponse = 'success' | 'failed';\ntype ShareResponse = 'success' | 'failed';\ntype CopyToClipboardResponse = 'success' | 'failed';\ntype VibrateResponse = 'success' | 'failed';\n// todo: remove duplicates\ntype ResponseType = 'success' | 'failed';\ntype BiometryResponse = 'success' | 'failed' | 'unavailable' | 'cancelled';\n\ntype BridgeInvoke<T extends EInvokeRequest, R> = (method: T, data?: {}) => Promise<R>;\n\ninterface BridgeStorage {\n setItem: SetItemType,\n getItem: GetItemType,\n clear: ClearType\n}\n\nexport interface AituBridge {\n version: string;\n invoke: BridgeInvoke<EInvokeRequest, ResponseObject>;\n storage: BridgeStorage;\n getMe: () => Promise<GetMeResponse>;\n getPhone: () => Promise<GetPhoneResponse>;\n getContacts: () => Promise<GetContactsResponse>;\n getGeo: () => Promise<GetGeoResponse>;\n selectContact: () => Promise<SelectContactResponse>;\n getQr: () => Promise<string>;\n getSMSCode: () => Promise<string>;\n getUserProfile: (userId: string) => Promise<GetUserProfileResponse>;\n share: (text: string) => Promise<ShareResponse>;\n setTitle: (text: string) => Promise<ResponseType>;\n copyToClipboard: (text: string) => Promise<CopyToClipboardResponse>;\n shareImage: (text: string, image: string) => Promise<ShareResponse>;\n shareFile: (text: string, filename: string, base64Data: string) => Promise<ShareResponse>;\n enableNotifications: () => Promise<{}>;\n disableNotifications: () => Promise<{}>;\n enablePrivateMessaging: (appId: string) => Promise<string>;\n disablePrivateMessaging: (appId: string) => Promise<string>;\n openSettings: () => Promise<OpenSettingsResponse>;\n closeApplication: () => Promise<ResponseType>;\n setShakeHandler: (handler: any) => void;\n setTabActiveHandler: (handler: (tabname: string) => void) => void;\n vibrate: (pattern: number[]) => Promise<VibratePattern>;\n isSupported: () => boolean;\n supports: (method: string) => boolean;\n sub: any;\n enableScreenCapture: () => Promise<{}>;\n disableScreenCapture: () => Promise<{}>;\n setHeaderMenuItems: (items: Array<HeaderMenuItem>) => Promise<ResponseType>;\n setHeaderMenuItemClickHandler: (handler: HeaderMenuItemClickHandlerType) => void;\n setCustomBackArrowMode: (enabled: boolean) => Promise<ResponseType>;\n getCustomBackArrowMode: () => Promise<boolean>;\n setCustomBackArrowVisible: (visible: boolean) => Promise<ResponseType>;\n openPayment: (transactionId: string) => Promise<ResponseType>;\n setCustomBackArrowOnClickHandler: (handler: BackArrowClickHandlerType) => void;\n checkBiometry: () => Promise<BiometryResponse>;\n openExternalUrl: (url: string) => Promise<ResponseType>;\n enableSwipeBack: () => Promise<ResponseType>;\n disableSwipeBack: () => Promise<ResponseType>;\n setNavigationItemMode: (mode: NavigationItemMode) => Promise<void>;\n getNavigationItemMode: () => Promise<NavigationItemMode>;\n getUserStepInfo: () => Promise<UserStepInfoResponse>;\n}\n\nconst invokeMethod = 'invoke';\nconst storageMethod = 'storage';\nconst getGeoMethod = 'getGeo';\nconst getQrMethod = 'getQr';\nconst getSMSCodeMethod = 'getSMSCode';\nconst selectContactMethod = 'selectContact';\nconst openSettingsMethod = 'openSettings';\nconst closeApplicationMethod = 'closeApplication';\nconst shareMethod = 'share';\nconst setTitleMethod = 'setTitle';\nconst copyToClipboardMethod = 'copyToClipboard';\nconst shareImageMethod = 'shareImage';\nconst shareFileMethod = 'shareFile';\nconst setShakeHandlerMethod = 'setShakeHandler';\nconst vibrateMethod = 'vibrate';\nconst enableScreenCaptureMethod = 'enableScreenCapture';\nconst disableScreenCaptureMethod = 'disableScreenCapture';\nconst setTabActiveHandlerMethod = 'setTabActiveHandler';\nconst setHeaderMenuItemsMethod = 'setHeaderMenuItems';\nconst setHeaderMenuItemClickHandlerMethod = 'setHeaderMenuItemClickHandler';\nconst setCustomBackArrowModeMethod = 'setCustomBackArrowMode';\nconst getCustomBackArrowModeMethod = 'getCustomBackArrowMode';\nconst setCustomBackArrowVisibleMethod = 'setCustomBackArrowVisible';\nconst openPaymentMethod = 'openPayment'\nconst setCustomBackArrowOnClickHandlerMethod = 'setCustomBackArrowOnClickHandler';\nconst checkBiometryMethod = 'checkBiometry';\nconst openExternalUrlMethod = 'openExternalUrl';\nconst enableSwipeBackMethod = 'enableSwipeBack';\nconst disableSwipeBackMethod = 'disableSwipeBack';\nconst setNavigationItemModeMethod = 'setNavigationItemMode';\nconst getNavigationItemModeMethod = 'getNavigationItemMode';\nconst getUserStepInfoMethod = 'getUserStepInfo';\n\nconst android = typeof window !== 'undefined' && (window as any).AndroidBridge;\nconst ios = typeof window !== 'undefined' && (window as any).webkit && (window as any).webkit.messageHandlers;\nconst web = typeof window !== 'undefined' && (window.top !== window) && WebBridge;\n\nconst buildBridge = (): AituBridge => {\n const subs = [];\n\n if (typeof window !== 'undefined') {\n window.addEventListener('aituEvents', (e: any) => {\n [...subs].map((fn) => fn.call(null, e));\n })\n }\n\n const invoke = (reqId, method, data = {}) => {\n const isAndroid = android && android[invokeMethod];\n const isIos = ios && ios[invokeMethod];\n\n if (isAndroid) {\n android[invokeMethod](reqId, method, JSON.stringify(data));\n } else if (isIos) {\n ios[invokeMethod].postMessage({ reqId, method, data });\n } else if (web) {\n web.execute(invokeMethod, reqId, method, data)\n } else if (typeof window !== 'undefined') {\n console.log('--invoke-isUnknown');\n }\n };\n\n const storage = (reqId, method, data = {}) => {\n const isAndroid = android && android[storageMethod];\n const isIos = ios && ios[storageMethod];\n\n if (isAndroid) {\n android[storageMethod](reqId, method, JSON.stringify(data));\n } else if (isIos) {\n ios[storageMethod].postMessage({ reqId, method, data });\n } else if (web) {\n web.execute(storageMethod, reqId, method, data);\n } else if (typeof window !== 'undefined') {\n console.log('--storage-isUnknown');\n }\n }\n\n const getGeo = (reqId) => {\n const isAndroid = android && android[getGeoMethod];\n const isIos = ios && ios[getGeoMethod];\n\n if (isAndroid) {\n android[getGeoMethod](reqId);\n } else if (isIos) {\n ios[getGeoMethod].postMessage({ reqId });\n } else if (web) {\n web.execute(getGeoMethod, reqId);\n } else if (typeof window !== 'undefined') {\n console.log('--getGeo-isUnknown');\n }\n }\n\n const getQr = (reqId) => {\n const isAndroid = android && android[getQrMethod];\n const isIos = ios && ios[getQrMethod];\n\n if (isAndroid) {\n android[getQrMethod](reqId);\n } else if (isIos) {\n ios[getQrMethod].postMessage({ reqId });\n } else if (web) {\n web.execute(getQrMethod, reqId);\n } else if (typeof window !== 'undefined') {\n console.log('--getQr-isUnknown');\n }\n }\n\n const getSMSCode = (reqId) => {\n const isAndroid = android && android[getSMSCodeMethod];\n const isIos = ios && ios[getSMSCodeMethod];\n\n if (isAndroid) {\n android[getSMSCodeMethod](reqId);\n } else if (isIos) {\n ios[getSMSCodeMethod].postMessage({ reqId });\n } else if (web) {\n web.execute(getSMSCodeMethod, reqId);\n } else if (typeof window !== 'undefined') {\n console.log('--getSMSCode-isUnknown');\n }\n }\n\n const selectContact = (reqId) => {\n const isAndroid = android && android[selectContactMethod];\n const isIos = ios && ios[selectContactMethod];\n\n if (isAndroid) {\n android[selectContactMethod](reqId);\n } else if (isIos) {\n ios[selectContactMethod].postMessage({ reqId });\n } else if (web) {\n web.execute(selectContactMethod, reqId);\n } else if (typeof window !== 'undefined') {\n console.log('--selectContact-isUnknown');\n }\n }\n\n const openSettings = (reqId) => {\n const isAndroid = android && android[openSettingsMethod];\n const isIos = ios && ios[openSettingsMethod];\n\n if (isAndroid) {\n android[openSettingsMethod](reqId);\n } else if (isIos) {\n ios[openSettingsMethod].postMessage({ reqId });\n } else if (web) {\n web.execute(openSettingsMethod, reqId);\n } else if (typeof window !== 'undefined') {\n console.log('--openSettings-isUnknown');\n }\n }\n\n const closeApplication = (reqId) => {\n const isAndroid = android && android[closeApplicationMethod];\n const isIos = ios && ios[closeApplicationMethod];\n\n if (isAndroid) {\n android[closeApplicationMethod](reqId);\n } else if (isIos) {\n ios[closeApplicationMethod].postMessage({ reqId });\n } else if (web) {\n web.execute(closeApplicationMethod, reqId);\n } else if (typeof window !== 'undefined') {\n console.log('--closeApplication-isUnknown');\n }\n }\n\n const share = (reqId, text) => {\n const isAndroid = android && android[shareMethod];\n const isIos = ios && ios[shareMethod];\n\n if (isAndroid) {\n android[shareMethod](reqId, text);\n } else if (isIos) {\n ios[shareMethod].postMessage({ reqId, text });\n } else if (web) {\n web.execute(shareMethod, reqId, text);\n } else if (typeof window !== 'undefined') {\n console.log('--share-isUnknown');\n }\n }\n\n const setTitle = (reqId, text) => {\n const isAndroid = android && android[setTitleMethod];\n const isIos = ios && ios[setTitleMethod];\n\n if (isAndroid) {\n android[setTitleMethod](reqId, text);\n } else if (isIos) {\n ios[setTitleMethod].postMessage({ reqId, text });\n } else if (web) {\n web.execute(setTitleMethod, reqId, text);\n } else if (typeof window !== 'undefined') {\n console.log('--setTitle-isUnknown');\n }\n }\n\n const copyToClipboard = (reqId, text) => {\n const isAndroid = android && android[copyToClipboardMethod];\n const isIos = ios && ios[copyToClipboardMethod];\n\n if (isAndroid) {\n android[copyToClipboardMethod](reqId, text);\n } else if (isIos) {\n ios[copyToClipboardMethod].postMessage({ reqId, text });\n } else if (web) {\n web.execute(copyToClipboardMethod, reqId, text);\n } else if (typeof window !== 'undefined') {\n console.log('--copyToClipboard-isUnknown');\n }\n }\n\n const enableScreenCapture = (reqId) => {\n const isAndroid = android && android[enableScreenCaptureMethod];\n const isIos = ios && ios[enableScreenCaptureMethod];\n\n if (isAndroid) {\n android[enableScreenCaptureMethod](reqId);\n } else if (isIos) {\n ios[enableScreenCaptureMethod].postMessage({ reqId });\n } else if (web) {\n web.execute(enableScreenCaptureMethod, reqId);\n } else if (typeof window !== 'undefined') {\n console.log('--enableScreenCapture-isUnknown');\n }\n }\n\n const disableScreenCapture = (reqId) => {\n const isAndroid = android && android[disableScreenCaptureMethod];\n const isIos = ios && ios[disableScreenCaptureMethod];\n\n if (isAndroid) {\n android[disableScreenCaptureMethod](reqId);\n } else if (isIos) {\n ios[disableScreenCaptureMethod].postMessage({ reqId });\n } else if (web) {\n web.execute(disableScreenCaptureMethod, reqId);\n } else if (typeof window !== 'undefined') {\n console.log('--disableScreenCapture-isUnknown');\n }\n }\n\n const shareImage = (reqId, text, image) => {\n // !!!======================!!!\n // !!!===== Deprecated =====!!!\n // !!!======================!!!\n\n // const isAndroid = android && android[shareImageMethod];\n // const isIos = ios && ios[shareImageMethod];\n\n // if (isAndroid) {\n // android[shareImageMethod](reqId, text, image);\n // } else if (isIos) {\n // ios[shareImageMethod].postMessage({ reqId, text, image });\n // } else if (typeof window !== 'undefined') {\n // console.log('--shareImage-isWeb');\n // }\n\n // new one - fallback to shareFile\n const isAndroid = android && android[shareFileMethod];\n const isIos = ios && ios[shareFileMethod];\n\n // get extension from base64 mime type and merge with name\n const ext = image.split(';')[0].split('/')[1];\n const filename = 'image.' + ext;\n // remove mime type\n const base64Data = image.substr(image.indexOf(',') + 1);\n\n if (isAndroid) {\n android[shareFileMethod](reqId, text, filename, base64Data);\n } else if (isIos) {\n ios[shareFileMethod].postMessage({ reqId, text, filename, base64Data });\n } else if (web) {\n web.execute(shareFileMethod, reqId, { text, filename, base64Data });\n } else if (typeof window !== 'undefined') {\n console.log('--shareFile-isUnknown');\n }\n }\n\n const shareFile = (reqId, text, filename, base64Data) => {\n const isAndroid = android && android[shareFileMethod];\n const isIos = ios && ios[shareFileMethod];\n\n if (isAndroid) {\n android[shareFileMethod](reqId, text, filename, base64Data);\n } else if (isIos) {\n ios[shareFileMethod].postMessage({ reqId, text, filename, base64Data });\n } else if (web) {\n web.execute(shareFileMethod, reqId, text, filename, base64Data);\n } else if (typeof window !== 'undefined') {\n console.log('--shareFile-isUnknown');\n }\n }\n\n const enableNotifications = () => invokePromise(EInvokeRequest.enableNotifications);\n\n const disableNotifications = () => invokePromise(EInvokeRequest.disableNotifications);\n\n const setShakeHandler = (handler) => {\n const isAndroid = android && android[setShakeHandlerMethod];\n const isIos = ios && ios[setShakeHandlerMethod];\n\n if (isAndroid || isIos || web) {\n (window as any).onAituBridgeShake = handler;\n } else if (typeof window !== 'undefined') {\n console.log('--setShakeHandler-isUnknown');\n }\n };\n\n const setTabActiveHandler = (handler: (tabname: string) => void) => {\n const isAndroid = android && android[setTabActiveHandlerMethod];\n const isIos = ios && ios[setTabActiveHandlerMethod];\n\n if (isAndroid || isIos || web) {\n (window as any).onAituBridgeTabActive = handler;\n } else if (typeof window !== 'undefined') {\n console.log('--setTabActiveHandler-isUnknown');\n }\n };\n\n const vibrate = (reqId, pattern) => {\n if (\n !Array.isArray(pattern) ||\n pattern.some((timing) => timing < 1 || timing !== Math.floor(timing)) ||\n pattern.reduce((total, timing) => total + timing) > 10000\n ) {\n console.error('Pattern should be an array of positive integers no longer than 10000ms total');\n return;\n }\n\n const isAndroid = android && android[vibrateMethod];\n const isIos = ios && ios[vibrateMethod];\n\n if (isAndroid) {\n android[vibrateMethod](reqId, JSON.stringify(pattern));\n } else if (isIos) {\n ios[vibrateMethod].postMessage({ reqId, pattern });\n } else if (web) {\n web.execute(vibrateMethod, reqId, pattern);\n } else if (typeof window !== 'undefined') {\n console.log('--vibrate-isUnknown');\n }\n }\n\n const isSupported = () => {\n const iosSup = ios && (window as any).webkit.messageHandlers.invoke;\n return Boolean(android || iosSup || web);\n }\n\n // TODO: implement web support\n const supports = (method) =>\n (android && typeof android[method] === 'function') ||\n (ios && ios[method] && typeof ios[method].postMessage === 'function') ||\n (web && typeof web[method] === 'function');\n\n const sub = (listener: any) => {\n subs.push(listener);\n }\n\n const setHeaderMenuItems = (reqId, items: Array<HeaderMenuItem>) => {\n if (items.length > MAX_HEADER_MENU_ITEMS_COUNT) {\n console.error('SetHeaderMenuItems: items count should not be more than ' + MAX_HEADER_MENU_ITEMS_COUNT);\n return;\n }\n\n const isAndroid = android && android[setHeaderMenuItemsMethod];\n const isIos = ios && ios[setHeaderMenuItemsMethod];\n\n const itemsJsonArray = JSON.stringify(items);\n\n if (isAndroid) {\n android[setHeaderMenuItemsMethod](reqId, itemsJsonArray);\n } else if (isIos) {\n ios[setHeaderMenuItemsMethod].postMessage({ reqId, itemsJsonArray });\n } else if (web) {\n web.execute(setHeaderMenuItemsMethod, reqId, itemsJsonArray);\n } else if (typeof window !== 'undefined') {\n console.log('--setHeaderMenuItems-isUnknown');\n }\n }\n\n const setHeaderMenuItemClickHandler = (handler: HeaderMenuItemClickHandlerType) => {\n const isAndroid = android && android[setHeaderMenuItemClickHandlerMethod];\n const isIos = ios && ios[setHeaderMenuItemClickHandlerMethod];\n\n if (isAndroid || isIos || web) {\n (window as any).onAituBridgeHeaderMenuItemClick = handler;\n } else if (typeof window !== 'undefined') {\n console.log('--setHeaderMenuItemClickHandler-isUnknown');\n }\n }\n\n /**\n * @deprecated данный метод не рекомендуется использовать\n * вместо него используйте setNavigationItemMode\n */\n const setCustomBackArrowMode = (reqId, enabled: boolean) => {\n const isAndroid = android && android[setCustomBackArrowModeMethod];\n const isIos = ios && ios[setCustomBackArrowModeMethod];\n\n if (isAndroid) {\n android[setCustomBackArrowModeMethod](reqId, enabled);\n } else if (isIos) {\n ios[setCustomBackArrowModeMethod].postMessage({ reqId, enabled });\n } else if (web) {\n web.execute(setCustomBackArrowModeMethod, reqId, enabled);\n } else if (typeof window !== 'undefined') {\n console.log('--setCustomBackArrowMode-isUnknown');\n }\n }\n\n /**\n * @deprecated данный метод не рекомендуется использовать\n * вместо него используйте getNavigationItemMode\n */\n const getCustomBackArrowMode = (reqId) => {\n const isAndroid = android && android[getCustomBackArrowModeMethod];\n const isIos = ios && ios[getCustomBackArrowModeMethod];\n\n if (isAndroid) {\n android[getCustomBackArrowModeMethod](reqId);\n } else if (isIos) {\n ios[getCustomBackArrowModeMethod].postMessage({ reqId });\n } else if (web) {\n web.execute(getCustomBackArrowModeMethod, reqId);\n } else if (typeof window !== 'undefined') {\n console.log('--getCustomBackArrowMode-isUnknown');\n }\n }\n\n /**\n * @deprecated данный метод не рекомендуется использовать\n * вместо него используйте setNavigationItemMode\n */\n const setCustomBackArrowVisible = (reqId, visible: boolean) => {\n const isAndroid = android && android[setCustomBackArrowVisibleMethod];\n const isIos = ios && ios[setCustomBackArrowVisibleMethod];\n\n if (isAndroid) {\n android[setCustomBackArrowVisibleMethod](reqId, visible);\n } else if (isIos) {\n ios[setCustomBackArrowVisibleMethod].postMessage({ reqId, visible });\n } else if (web) {\n web.execute(setCustomBackArrowVisibleMethod, reqId, visible);\n } else if (typeof window !== 'undefined') {\n console.log('--setCustomBackArrowVisible-isUnknown');\n }\n }\n\n const setCustomBackArrowOnClickHandler = (handler: BackArrowClickHandlerType) => {\n const isAndroid = android && android[setCustomBackArrowOnClickHandlerMethod];\n const isIos = ios && ios[setCustomBackArrowOnClickHandlerMethod];\n\n if (isAndroid || isIos || web) {\n (window as any).onAituBridgeBackArrowClick = handler;\n } else if (typeof window !== 'undefined') {\n console.log('--setCustomBackArrowOnClickHandler-isUnknown');\n }\n }\n\n const openPayment = (reqId, transactionId: string) => {\n const isAndroid = android && android[openPaymentMethod];\n const isIos = ios && ios[openPaymentMethod];\n\n if (isAndroid) {\n android[openPaymentMethod](reqId, transactionId);\n } else if (isIos) {\n ios[openPaymentMethod].postMessage({ reqId, transactionId });\n } else {\n console.log('--openPayment-isUnknown');\n }\n }\n\n const checkBiometry = (reqId) => {\n const isAndroid = android && android[checkBiometryMethod];\n const isIos = ios && ios[checkBiometryMethod];\n\n if (isAndroid) {\n android[checkBiometryMethod](reqId);\n } else if (isIos) {\n ios[checkBiometryMethod].postMessage({ reqId });\n } else if (web) {\n web.execute(checkBiometryMethod, reqId);\n } else if (typeof window !== 'undefined') {\n console.log('--checkBiometry-isUnknown');\n }\n }\n\n const openExternalUrl = (reqId, url: string) => {\n const isAndroid = android && android[openExternalUrlMethod];\n const isIos = ios && ios[openExternalUrlMethod];\n\n if (isAndroid) {\n android[openExternalUrlMethod](reqId, url);\n } else if (isIos) {\n ios[openExternalUrlMethod].postMessage({ reqId, url });\n } else {\n console.log(\"--openExternalUrlMethod-isUnknown\");\n }\n };\n\n const enableSwipeBack = (reqId) => {\n const isAndroid = android && android[enableSwipeBackMethod];\n const isIos = ios && ios[enableSwipeBackMethod];\n\n if (isAndroid) {\n android[enableSwipeBackMethod](reqId);\n } else if (isIos) {\n ios[enableSwipeBackMethod].postMessage({ reqId });\n } else if (web) {\n web.execute(enableSwipeBackMethod, reqId);\n } else if (typeof window !== 'undefined') {\n console.log('--enableSwipeBack-isUnknown');\n }\n }\n\n const disableSwipeBack = (reqId) => {\n const isAndroid = android && android[disableSwipeBackMethod];\n const isIos = ios && ios[disableSwipeBackMethod];\n\n if (isAndroid) {\n android[disableSwipeBackMethod](reqId);\n } else if (isIos) {\n ios[disableSwipeBackMethod].postMessage({ reqId });\n } else if (web) {\n web.execute(disableSwipeBackMethod, reqId);\n } else if (typeof window !== 'undefined') {\n console.log('--disableSwipeBack-isUnknown');\n }\n }\n\n const setNavigationItemMode = (reqId, mode: NavigationItemMode) => {\n const isAndroid = android && android[setNavigationItemModeMethod];\n const isIos = ios && ios[setNavigationItemModeMethod];\n\n if (isAndroid) {\n android[setNavigationItemModeMethod](reqId, mode);\n } else if (isIos) {\n ios[setNavigationItemModeMethod].postMessage({ reqId, mode });\n } else if (web) {\n web.execute(setNavigationItemModeMethod, reqId, mode);\n } else if (typeof window !== 'undefined') {\n console.log('--setNavigationItemMode-isUnknown');\n }\n }\n\n const getNavigationItemMode = (reqId) => {\n const isAndroid = android && android[getNavigationItemModeMethod];\n const isIos = ios && ios[getNavigationItemModeMethod];\n\n if (isAndroid) {\n android[getNavigationItemModeMethod](reqId);\n } else if (isIos) {\n ios[getNavigationItemModeMethod].postMessage({ reqId });\n } else if (web) {\n web.execute(getNavigationItemModeMethod, reqId);\n } else if (typeof window !== 'undefined') {\n console.log('--getNavigationItemMode-isUnknown');\n }\n }\n\n const getUserStepInfo = (reqId) => {\n const isAndroid = android && android[getUserStepInfoMethod];\n const isIos = ios && ios[getUserStepInfoMethod];\n\n if (isAndroid) {\n android[getUserStepInfoMethod](reqId);\n } else if (isIos) {\n ios[getUserStepInfoMethod].postMessage({ reqId });\n } else if (web) {\n console.log('--getUserStepInfo-isWeb');\n } else if (typeof window !== 'undefined') {\n console.log('--getUserStepInfo-isUnknown');\n }\n }\n\n const invokePromise = promisifyInvoke(invoke, sub);\n const storagePromise = promisifyStorage(storage, sub);\n const getGeoPromise = promisifyMethod(getGeo, getGeoMethod, sub);\n const getQrPromise = promisifyMethod(getQr, getQrMethod, sub);\n const getSMSCodePromise = promisifyMethod(getSMSCode, getSMSCodeMethod, sub);\n const selectContactPromise = promisifyMethod(selectContact, selectContactMethod, sub);\n const openSettingsPromise = promisifyMethod(openSettings, openSettingsMethod, sub);\n const closeApplicationPromise = promisifyMethod(closeApplication, closeApplicationMethod, sub);\n const sharePromise = promisifyMethod(share, shareMethod, sub);\n const setTitlePromise = promisifyMethod(setTitle, setTitleMethod, sub);\n const copyToClipboardPromise = promisifyMethod(copyToClipboard, copyToClipboardMethod, sub);\n const shareImagePromise = promisifyMethod(shareImage, shareImageMethod, sub);\n const shareFilePromise = promisifyMethod(shareFile, shareFileMethod, sub);\n const vibratePromise = promisifyMethod(vibrate, vibrateMethod, sub);\n const enableScreenCapturePromise = promisifyMethod(enableScreenCapture, enableScreenCaptureMethod, sub);\n const disableScreenCapturePromise = promisifyMethod(disableScreenCapture, disableScreenCaptureMethod, sub);\n const setHeaderMenuItemsPromise = promisifyMethod(setHeaderMenuItems, setHeaderMenuItemsMethod, sub);\n const setCustomBackArrowModePromise = promisifyMethod(setCustomBackArrowMode, setCustomBackArrowModeMethod, sub);\n const getCustomBackArrowModePromise = promisifyMethod(getCustomBackArrowMode, getCustomBackArrowModeMethod, sub);\n const setCustomBackArrowVisiblePromise = promisifyMethod(setCustomBackArrowVisible, setCustomBackArrowVisibleMethod, sub);\n const openPaymentPromise = promisifyMethod(openPayment, openPaymentMethod, sub);\n const checkBiometryPromise = promisifyMethod(checkBiometry, checkBiometryMethod, sub);\n const openExternalUrlPromise = promisifyMethod(openExternalUrl, openExternalUrlMethod, sub);\n const enableSwipeBackPromise = promisifyMethod(enableSwipeBack, enableSwipeBackMethod, sub);\n const disableSwipeBackPromise = promisifyMethod(disableSwipeBack, disableSwipeBackMethod, sub);\n const setNavigationItemModePromise = promisifyMethod(setNavigationItemMode, setNavigationItemModeMethod, sub);\n const getNavigationItemModePromise = promisifyMethod(getNavigationItemMode, getNavigationItemModeMethod, sub);\n const getUserStepInfoPromise = promisifyMethod(getUserStepInfo, getUserStepInfoMethod, sub);\n\n return {\n version: String(LIB_VERSION),\n copyToClipboard: copyToClipboardPromise,\n invoke: invokePromise,\n storage: storagePromise,\n getMe: () => invokePromise(EInvokeRequest.getMe),\n getPhone: () => invokePromise(EInvokeRequest.getPhone),\n getContacts: () => invokePromise(EInvokeRequest.getContacts),\n getGeo: getGeoPromise,\n getQr: getQrPromise,\n getSMSCode: getSMSCodePromise,\n getUserProfile: (id: string) =>\n invokePromise(EInvokeRequest.getUserProfile, { id }),\n selectContact: selectContactPromise,\n enableNotifications,\n disableNotifications,\n enablePrivateMessaging: (appId: string) =>\n invokePromise(EInvokeRequest.enablePrivateMessaging, { appId }),\n disablePrivateMessaging: (appId: string) =>\n invokePromise(EInvokeRequest.disablePrivateMessaging, { appId }),\n openSettings: openSettingsPromise,\n closeApplication: closeApplicationPromise,\n setTitle: setTitlePromise,\n share: sharePromise,\n shareImage: shareImagePromise,\n shareFile: shareFilePromise,\n setShakeHandler,\n setTabActiveHandler,\n vibrate: vibratePromise,\n isSupported,\n supports,\n sub,\n enableScreenCapture: enableScreenCapturePromise,\n disableScreenCapture: disableScreenCapturePromise,\n setHeaderMenuItems: setHeaderMenuItemsPromise,\n setHeaderMenuItemClickHandler,\n setCustomBackArrowMode: setCustomBackArrowModePromise,\n getCustomBackArrowMode: getCustomBackArrowModePromise,\n setCustomBackArrowVisible: setCustomBackArrowVisiblePromise,\n openPayment: openPaymentPromise,\n setCustomBackArrowOnClickHandler,\n checkBiometry: checkBiometryPromise,\n openExternalUrl: openExternalUrlPromise,\n enableSwipeBack: enableSwipeBackPromise,\n disableSwipeBack: disableSwipeBackPromise,\n setNavigationItemMode: setNavigationItemModePromise,\n getNavigationItemMode: getNavigationItemModePromise,\n getUserStepInfo: getUserStepInfoPromise,\n };\n}\n\nconst bridge = buildBridge();\n\nexport default bridge;\n","export const LIB_VERSION = \"0.3.57\";\n"],"names":["createRequestResolver","prefix","counter","current","next","this","createCounter","promiseControllers","add","controller","customId","id","resolve","reqId","data","isSuccess","error","requestPromise","reject","handleSubscribe","subscribe","requestResolver","event","detail","promisifyMethod","method","methodName","Promise","aituOrigin","URLSearchParams","window","location","search","get","localStorage","setItem","getItem","WebBridge","origin","execute","top","postMessage","source","payload","addEventListener","dispatchEvent","CustomEvent","message","JSON","parse","onAituBridgeBackArrowClick","onAituBridgeHeaderMenuItemClick","param","e","console","log","EInvokeRequest","HeaderMenuIcon","NavigationItemMode","android","AndroidBridge","ios","webkit","messageHandlers","web","bridge","subs","map","fn","call","sub","listener","push","invokePromise","invokeMethodName","props","isIos","stringify","invoke","storagePromise","storage","keyName","keyValue","clear","promisifyStorage","getGeoPromise","getQrPromise","getSMSCodePromise","selectContactPromise","openSettingsPromise","closeApplicationPromise","sharePromise","text","setTitlePromise","copyToClipboardPromise","shareImagePromise","image","isAndroid","filename","split","base64Data","substr","indexOf","shareFilePromise","vibratePromise","pattern","Array","isArray","some","timing","Math","floor","reduce","total","enableScreenCapturePromise","disableScreenCapturePromise","setHeaderMenuItemsPromise","items","length","itemsJsonArray","setCustomBackArrowModePromise","enabled","getCustomBackArrowModePromise","setCustomBackArrowVisiblePromise","visible","openPaymentPromise","transactionId","checkBiometryPromise","openExternalUrlPromise","url","enableSwipeBackPromise","disableSwipeBackPromise","setNavigationItemModePromise","mode","getNavigationItemModePromise","getUserStepInfoPromise","version","String","copyToClipboard","getMe","getPhone","getContacts","getGeo","getQr","getSMSCode","getUserProfile","selectContact","enableNotifications","disableNotifications","enablePrivateMessaging","appId","disablePrivateMessaging","openSettings","closeApplication","setTitle","share","shareImage","shareFile","setShakeHandler","handler","onAituBridgeShake","setTabActiveHandler","onAituBridgeTabActive","vibrate","isSupported","iosSup","Boolean","supports","enableScreenCapture","disableScreenCapture","setHeaderMenuItems","setHeaderMenuItemClickHandler","setCustomBackArrowMode","getCustomBackArrowMode","setCustomBackArrowVisible","openPayment","setCustomBackArrowOnClickHandler","checkBiometry","openExternalUrl","enableSwipeBack","disableSwipeBack","setNavigationItemMode","getNavigationItemMode","getUserStepInfo","buildBridge"],"mappings":"0LASA,SAASA,EAAsBC,GAM3B,IAAMC,EAfV,SAAuBD,GACnB,gBADmBA,IAAAA,EAAS,MACrB,CACHE,QAAS,EACTC,gBACI,OAAOH,KAAWI,KAAKF,UAWfG,CAAcL,GACxBM,EAA+D,GAErE,MAAO,CACHC,aAAIC,EAA+BC,YAAAA,IAAAA,EAAW,IAC1C,IAAMC,EAAKD,EAAWR,EAAQE,OAE9B,OADAG,EAAmBI,GAAMF,EAClBE,GAGXC,iBAAWC,EAAwBC,EAASC,EAAiCC,GACzE,IAAMC,EAAiBV,EAAmBM,GAEtCI,IACIF,EAAUC,GACVC,EAAeL,QAAQE,GAEvBG,EAAeC,OAAOF,GAG1BT,EAAmBM,GAAS,QAM5C,SAASM,EAAgBC,EAAoDC,GACzED,EAAU,SAAAE,GACN,GAAKA,EAAMC,QAIP,UAAWD,EAAMC,OAAQ,OACMD,EAAMC,OAA7BV,IAAAA,MAEJA,GACAQ,EAAgBT,QAAQC,IAHbC,KAG0B,SAACE,UAAYA,KAHjCA,mBAkDjBQ,EAAgBC,EAAkBC,EAAoBN,GAClE,IAAMC,EAAkBrB,EAAsB0B,EAAa,KAI3D,OAFAP,EAAgBC,EAAWC,8BAGvB,WAAWM,QAAQ,SAACf,EAASM,GACzB,IAAML,EAAQQ,EAAgBb,IAAI,CAAEI,QAAAA,EAASM,OAAAA,IAC7CO,gBAAOZ,gCCxGnB,IAIIe,EAFiB,IAAIC,gBAAgBC,OAAOC,SAASC,QAE3BC,IAJJ,iBAMvBL,EACCM,aAAaC,QAAQ,kBAAmBP,GAExCA,EAAaM,aAAaE,QAAQ,mBAOtC,IAAIC,EAA8B,KAE9BT,IACAS,EAAY,CACRC,OAAQV,EACRW,QAAS,SAACd,EAAQZ,GACdiB,OAAOU,IAAIC,YAAY,CACfC,OAAQ,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AEEG,EACvBlC,OAAekI,kBAAoBD,EACT,oBAAXjI,QAChBwB,QAAQC,IAAI,gCAuUd0G,oBAnU0B,SAACF,GACTpG,GAAWA,EAAO,qBACtBE,GAAOA,EAAG,qBAEEG,EACvBlC,OAAeoI,sBAAwBH,EACb,oBAAXjI,QAChBwB,QAAQC,IAAI,oCA6Td4G,QAAS3D,EACT4D,YAlSkB,WAClB,IAAMC,EAASxG,GAAQ/B,OAAegC,OAAOC,gBAAgBe,OAC7D,OAAOwF,QAAQ3G,GAAW0G,GAAUrG,IAiSpCuG,SA7Re,SAAC9I,UACfkC,GAAsC,mBAApBA,EAAQlC,IAC1BoC,GAAOA,EAAIpC,IAA8C,mBAA5BoC,EAAIpC,GAAQgB,aACzCuB,GAA8B,mBAAhBA,EAAIvC,IA2RnB6C,IAAAA,EACAkG,oBAAqBtD,EACrBuD,qBAAsBtD,EACtBuD,mBAAoBtD,EACpBuD,8BAnQoC,SAACZ,GACnBpG,GAAWA,EAAO,+BACtBE,GAAOA,EAAG,+BAEEG,EACvBlC,OAAeqB,gCAAkC4G,EACvB,oBAAXjI,QAChBwB,QAAQC,IAAI,8CA6PdqH,uBAAwBpD,EACxBqD,uBAAwBnD,EACxBoD,0BAA2BnD,EAC3BoD,YAAalD,EACbmD,iCApMuC,SAACjB,GACtBpG,GAAWA,EAAO,kCACtBE,GAAOA,EAAG,kCAEEG,EACvBlC,OAAeoB,2BAA6B6G,EAClB,oBAAXjI,QAChBwB,QAAQC,IAAI,iDA8Ld0H,cAAelD,EACfmD,gBAAiBlD,EACjBmD,gBAAiBjD,EACjBkD,iBAAkBjD,EAClBkD,sBAAuBjD,EACvBkD,sBAAuBhD,EACvBiD,gBAAiBhD,GAINiD"}
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const LIB_VERSION = "0.3.56";
1
+ export declare const LIB_VERSION = "0.3.57";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@btsd/aitu-bridge",
3
- "version": "0.3.56",
3
+ "version": "0.3.57",
4
4
  "description": "",
5
5
  "source": "src/index.ts",
6
6
  "main": "dist/index.js",
package/src/index.ts CHANGED
@@ -175,7 +175,6 @@ export interface AituBridge {
175
175
  setNavigationItemMode: (mode: NavigationItemMode) => Promise<void>;
176
176
  getNavigationItemMode: () => Promise<NavigationItemMode>;
177
177
  getUserStepInfo: () => Promise<UserStepInfoResponse>;
178
- isBiometryAvailable: () =>Promise<boolean>;
179
178
  }
180
179
 
181
180
  const invokeMethod = 'invoke';
@@ -210,7 +209,6 @@ const disableSwipeBackMethod = 'disableSwipeBack';
210
209
  const setNavigationItemModeMethod = 'setNavigationItemMode';
211
210
  const getNavigationItemModeMethod = 'getNavigationItemMode';
212
211
  const getUserStepInfoMethod = 'getUserStepInfo';
213
- const isBiometryAvailableMethod = 'isBiometryAvailable';
214
212
 
215
213
  const android = typeof window !== 'undefined' && (window as any).AndroidBridge;
216
214
  const ios = typeof window !== 'undefined' && (window as any).webkit && (window as any).webkit.messageHandlers;
@@ -754,22 +752,6 @@ const buildBridge = (): AituBridge => {
754
752
  }
755
753
  }
756
754
 
757
- const isBiometryAvailable = (reqId) => {
758
- const isAndroid = android && android[isBiometryAvailableMethod];
759
- const isIos = ios && ios[isBiometryAvailableMethod];
760
-
761
- if (isAndroid) {
762
- android[isBiometryAvailableMethod](reqId);
763
- } else if (isIos) {
764
- ios[isBiometryAvailableMethod].postMessage({ reqId });
765
- } else if (web) {
766
- console.log('--isBiometryAvailable-isWeb');
767
- } else if (typeof window !== 'undefined') {
768
- console.log('--isBiometryAvailable-isUnknown');
769
- }
770
- }
771
-
772
-
773
755
  const invokePromise = promisifyInvoke(invoke, sub);
774
756
  const storagePromise = promisifyStorage(storage, sub);
775
757
  const getGeoPromise = promisifyMethod(getGeo, getGeoMethod, sub);
@@ -798,7 +780,6 @@ const buildBridge = (): AituBridge => {
798
780
  const setNavigationItemModePromise = promisifyMethod(setNavigationItemMode, setNavigationItemModeMethod, sub);
799
781
  const getNavigationItemModePromise = promisifyMethod(getNavigationItemMode, getNavigationItemModeMethod, sub);
800
782
  const getUserStepInfoPromise = promisifyMethod(getUserStepInfo, getUserStepInfoMethod, sub);
801
- const isBiometryAvailablePromise = promisifyMethod(isBiometryAvailable, isBiometryAvailableMethod, sub);
802
783
 
803
784
  return {
804
785
  version: String(LIB_VERSION),
@@ -848,7 +829,6 @@ const buildBridge = (): AituBridge => {
848
829
  setNavigationItemMode: setNavigationItemModePromise,
849
830
  getNavigationItemMode: getNavigationItemModePromise,
850
831
  getUserStepInfo: getUserStepInfoPromise,
851
- isBiometryAvailable: isBiometryAvailablePromise,
852
832
  };
853
833
  }
854
834
 
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const LIB_VERSION = "0.3.56";
1
+ export const LIB_VERSION = "0.3.57";