/* Copyright 2020 Appboxo pte. ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ import { BoxoCustomEvent, LifecycleHooksCallbacks, MiniappData, BoxoPaymentEvent } from './types' declare module '@appboxo/react-native-sdk' { /** * Set Boxo clientId * @param {string} clientId Boxo clientId * @param {object} options - Boxo global config * userId - hostapp userId for consent management * sandboxMode (by default false) * theme {'dark' | 'light'} theme Miniapp theme (by default 'system') * */ export function setConfig( clientId: string, options?: { userId?: string, language?: string, sandboxMode?: boolean, theme?: 'dark' | 'light', isDebug?: boolean, showPermissionsPage? : boolean, showClearCache?: boolean, showAboutPage?: boolean, splashScreenOptions?: { lightProgressIndicator: string, lightProgressTrack: string, darkProgressIndicator: string, darkProgressTrack: string, lightBackground: string, darkBackground: string } } ): void /** * Launch miniapp by id with payload and custom data * @param {string} miniAppId Boxo miniAppId * @param {object} options Boxo options: data for send to miniapp, * theme Miniapp theme (by default is value of "theme" argument in setConfig function) * */ export function openMiniapp( miniAppId: string, options?: { data?: object, theme?: 'dark' | 'light' | 'system', extraUrlParams?: { [key: string]: string }, urlSuffix?: string, colors?: { primaryColor: string, secondaryColor: string, tertiaryColor: string }, enableSplash?: boolean, saveState?: boolean, pageAnimation?: 'BOTTOM_TO_TOP' | 'TOP_TO_BOTTOM' | 'LEFT_TO_RIGHT' | 'RIGHT_TO_LEFT' | 'FADE_IN' }, ): void export function closeMiniapp(appId: string): void /** * Boxo custom events system for handle events from miniapp and send to miniapp. * */ export const customEvents: { /** * Subscribe to events from miniapp * @param {function} eventHandler the custom event handler * @param {function} errorHandler the custom event error handler * @returns {function} unsubscribe events from miniapp * */ subscribe: ( eventHandler: (event: BoxoCustomEvent) => void, errorHandler?: (errorType: string) => void, ) => () => void /** * Send events to miniapp * @param {BoxoCustomEvent} event to send to miniapp * */ send(event: BoxoCustomEvent): void } /** * Hide all miniapps * */ export function hideMiniapps(): void /** * On logout from your app, call this method to clear all miniapps data. * */ export function logout(): void /** * Boxo Miniapp lifecycle hooks listener * */ export function lifecycleHooksListener(callbacks: Partial): () => void /** * Trigger fetching miniapps list from Boxo platform. * The result will be available through miniapps.subscribe() method * */ export function getMiniapps(): void /** * Boxo miniapps system for handling miniapps list events. * */ export const miniapps: { /** * Subscribe to miniapp list events * @param {function} eventHandler the miniapp list handler * @param {function} errorHandler the miniapp list error handler * @returns {function} unsubscribe from miniapp list events * */ subscribe: ( eventHandler: (miniapps: MiniappData[]) => void, errorHandler?: (error: string) => void, ) => () => void } /** * Set authentication code for a miniapp * @param {string} miniAppId Boxo miniAppId * @param {string} authCode Authentication code for the miniapp * */ export function setAuthCode(miniAppId: string, authCode: string): void export function setAuthTokens(appId: string, tokens: { [key: string]: string }): void /** * Boxo payment events system for handling payment events from miniapps. * */ export const paymentEvents: { /** * Subscribe to payment events from miniapp * @param {function} eventHandler the payment event handler * @returns {function} unsubscribe from payment events * */ subscribe: (eventHandler: (event: BoxoPaymentEvent) => void) => () => void /** * Send payment events to miniapp * @param {BoxoPaymentEvent} event to send to miniapp * */ send(event: BoxoPaymentEvent): void } } export * from './types'