/* 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. */ /** * BoxoCustomEvent for handle events from miniapp and send to miniapp. * */ export interface BoxoCustomEvent { /** * Miniapp id * */ app_id: string /** * Custom event body * */ custom_event: BoxoCustomEventBody } /** * Custom event body * */ export interface BoxoCustomEventBody { /** * Error type if an error occurred * */ error_type?: string /** * Event payload * */ payload: Payload /** * Event type * * */ type: EventType /** * Event request id * */ request_id: string } /** * Boxo Miniapp lifecycle hooks callbacks * */ export interface LifecycleHooksCallbacks { onLaunch: (appId: string) => void onResume: (appId: string) => void onPause: (appId: string) => void onClose: (appId: string) => void onAuth: (appId: string) => void onUserInteraction: (appId: string) => void onError: (appId: string, error: string) => void } /** * miniapp data body * */ export interface MiniappData{ app_id: string name: string description: string category: string logo?: string } /** * Boxo payment events interface * */ export interface BoxoPaymentEvent { app_id: string payment_event: { transaction_token: string order_payment_id: string miniapp_order_id: string amount: number currency: string status: string hostapp_order_id: string extra_params?: { [key: string]: any } } }