toki-app
Version:
Toki - frontend packages
395 lines (392 loc) • 12.9 kB
TypeScript
/**
* Webview will be closed When `closeWebView` triggers
*
* @version 1.2.0
* @see {@link https://library.toki.mn}
*/
declare function closeWebView(): void;
/**
* `buy` when triggers
* Application will navigate to merchant payment screen
* and you need to fill the parameters
*
* If payments succeeds
* Callback function will be called
* also BE will send [POST] request to provided `callbackUrl`
*
* [NOTE] Function throttle 1000ms
*
*
* @param {Object} options Options for payment
* @param {String} options.merchantId The merchant id that you get from our end
* @param {Number} options.amount The payment amount
* @param {String} options.orderId Unique generated string for order
* @param {String} options.description Payment description or note
* @param {String} options.callbackUrl Endpoint that will be requested when payment succeeds
* @param {String} options.paymentType Wallet type
* @param {String} options.requestId MS request id
* @param {Function} callback Function that triggers when payment succeeds
*
*
* @version 1.2.4
* @see {@link https://library.toki.mn}
*
*/
declare const buy: (options: {
merchantId: string;
amount: number;
orderId: string;
description: string;
callbackUrl: string;
requestId?: string;
paymentType?: "HOLD";
discount?: {
originalAmount: number;
percentage: number;
};
hidePaymentStatus?: boolean;
}, callback: Function) => void;
/**
* `selectContact` is function that allows webview to access phone contacts
*
* @param type Boolean value that indicates application to fetch all the contacts or open bottom sheet for single contact
* @param callback when application done fetching contact, callback function will be fired with array or object param
*
* @version 1.2.0
* @see {@link https://library.toki.mn}
*/
declare function selectContact(type: boolean, callback: any): void;
/**
* `checkNotification` is function that checks and prompts to enable notification for application
*
* @param callback The function that returns boolean value which indicates application notification is enabled or not
*
* @version 1.2.0
* @see {@link https://library.toki.mn}
*/
declare function checkNotification(callback: Function): void;
/**
* `setColor` is function that change the color of header
*
* @param color The header color
* @param isStatusDark Header status bar text color
*
* @version 1.2.0
* @see {@link https://library.toki.mn}
*/
declare function setColor(color: string, isStatusDark: boolean): void;
/**
* Function that downloads files to OS
* [NOTE] shows prompt when OS already disabled access to files
* @version 1.2.0
* @see {@link https://library.toki.mn}
*/
declare function setNavigation(props: {
mode: "LIGHT" | "DARK";
}): void;
/**
* `openLink` is function that allows webview to open external browser
*
* @param url
*
* @version 1.2.0
* @see {@link https://library.toki.mn}
*/
declare function openLink(url: string): void;
/**
* `buyfromDynamiclink` is function that opens dynamic link
* only available for payment deeplinks
*
* @param url
*
* @version 1.2.0
* @see {@link https://library.toki.mn}
*/
declare function buyfromDynamiclink(url: string, callback: Function): void;
/**
* Function that enables or desables screenshot or screenrecordings
*
* @param status
*
* @version 1.2.0
* @see {@link https://library.toki.mn}
*/
declare function setScreenProtection(status: boolean): void;
/**
* Function that downloads images to OS
* [NOTE] shows prompt when OS already disabled access to image
*
* @param url The image URL to download
*
* @version 1.2.0
* @see {@link https://library.toki.mn}
*/
declare function downloadImage({ url }: {
url: string;
}, callback: (success: boolean) => void): void;
/**
* Function that downloads images to OS
* [NOTE] shows prompt when OS already disabled access to image
*
* @param url The image URL to download
*
* @version 1.2.2
* @see {@link https://library.toki.mn}
*/
declare function openScanner(callback: (url: string) => void, button?: {
name?: string;
onClick?: () => void;
}): void;
/**
* Function that used for Unit & Data MP
* [NOTE] sends operator data to App FE
*
* @param name The name of operator that user entered
*
* @version 1.2.2
* @see {@link https://library.toki.mn}
*/
declare function setOperatorName(name: string): void;
/**
* Function for Kids MP
*
* @version 1.2.6
* @see {@link https://library.toki.mn}
*/
declare function onNavigateToRoute(route: "topup" | "history" | "invoice" | "debit" | "profile" | "location" | "card", childId: string, successText?: string, callback?: () => void): void;
/**
* Function for Kids MP
*
* @version 1.2.13
* @see {@link https://library.toki.mn}
*/
declare function openUbcab(lat?: number, long?: number, childId?: string, childPhoneNo?: string, childName?: string): void;
/**
* `buyFromBatchPayment` нь олон төлбөрийн багцыг эхлүүлдэг функц.
*
* @param data Төлбөрийн багцын мэдээлэл
* @param callback Худалдан авалтын дараах callback функц (заавал биш)
*
* @version 1.2.2
* @see {@link https://library.toki.mn}
*/
declare function buyFromBatchPayment(data: {
requestId?: string;
parentMerchantId: string;
parentDescription: string;
parentOrderId: string;
parentCheckUrl: string;
feeInfo?: string;
items: {
merchantId: string;
amount: number;
fee?: number;
orderId: string;
description: string;
callbackUrl: string;
checkUrl: string;
}[];
discount?: {
originalAmount: number;
percentage: number;
};
}, callback?: Function): void;
/**
* Function for native share
*
* @version 1.2.21
* @see {@link https://library.toki.mn}
*/
declare function share(props: {
url?: string;
file?: string[];
text?: string;
title?: string;
callback?: (success: boolean) => void;
}): void;
/**
* Function for native shareStory
*
* @version 1.2.21
* @see {@link https://library.toki.mn}
*/
declare function shareStory(props: {
image?: {
src: string;
link?: string;
};
background?: {
src: string;
};
url?: {
name: string;
value: string;
};
method: "FACEBOOK" | "INSTAGRAM";
}, callback: (success: boolean) => void): void;
/**
* Function that downloads files to OS
* [NOTE] shows prompt when OS already disabled access to files
*
* @param url The file URL to download
*
* @version 1.2.0
* @see {@link https://library.toki.mn}
*/
declare function downloadFile(props: {
files: string[];
}, callback: (success: boolean) => void): void;
/**
* Function for native share
*
* @version 1.2.21
* @see {@link https://library.toki.mn}
*/
declare function shareDynamicLink(props: {
title: string;
description: string;
image: string;
url: string;
}, callback?: (success: boolean) => void): void;
/**
* Function that downloads files to OS
* [NOTE] shows prompt when OS already disabled access to files
*
* @param callback notifies if success or not
*
* @version 1.2.0
* @see {@link https://library.toki.mn}
*/
declare function initiateKycCheck(options: {
request_id: string;
}, callback: (props: {
status: boolean;
request_id: string;
}) => void): void;
/**
* Function that downloads files to OS
* [NOTE] shows prompt when OS already disabled access to files
*
* @param callback notifies if success or not
*
* @version 1.2.0
* @see {@link https://library.toki.mn}
*/
declare function navigationBackFrom(callback: (screen: string) => void): void;
/**
* Function that downloads files to OS
* [NOTE] shows prompt when OS already disabled access to files
*
* @param callback notifies if success or not
*
* @version 1.2.0
* @see {@link https://library.toki.mn}
*/
declare function verifyMpin(options: {
request_id: string;
style?: {
backgroundColor?: string;
titleColor?: string;
radio?: {
backgroundColor?: string;
fillColor?: string;
};
numpad?: {
textColor?: string;
backgroundColor?: string;
};
};
}, //#F5F5F5
callback: (props: {
status: boolean;
request_id: string;
}) => void): void;
/**
* Function that downloads files to OS
* [NOTE] shows prompt when OS already disabled access to files
*
* @param callback notifies if success or not
*
* @version 1.2.0
* @see {@link https://library.toki.mn}
*/
declare function getLocation({ callback }: {
callback: (props: {
lat: number | undefined | null;
long: number | undefined | null;
}) => void;
}): void;
/**
* Function that downloads files to OS
* [NOTE] shows prompt when OS already disabled access to files
* @version 1.2.0
* @see {@link https://library.toki.mn}
*/
declare function saveDateToCalendar(props: {
title: string;
description?: string;
startDate: number;
endDate?: number;
alertDate: number;
address?: string;
}): void;
/**
* Function that downloads files to OS
* [NOTE] shows prompt when OS already disabled access to files
*
* @param callback notifies if notification permission is on or not
*
* @version 1.2.0
* @see {@link https://library.toki.mn}
*/
declare function getNotiPermission({ description, callback }: {
description?: string;
callback: (props: {
status: boolean;
}) => void;
}): void;
/**
* Function that downloads files to OS
* [NOTE] shows prompt when OS already disabled access to files
*
* @param callback notifies if eSim initialize is success or not
*
* @version 1.2.0
* @see {@link https://library.toki.mn}
*/
declare function initializeEsim({ eSim, callback }: {
eSim: string;
callback: (props: {
status: boolean;
}) => void;
}): void;
declare const appFunctions_buy: typeof buy;
declare const appFunctions_buyFromBatchPayment: typeof buyFromBatchPayment;
declare const appFunctions_buyfromDynamiclink: typeof buyfromDynamiclink;
declare const appFunctions_checkNotification: typeof checkNotification;
declare const appFunctions_closeWebView: typeof closeWebView;
declare const appFunctions_downloadFile: typeof downloadFile;
declare const appFunctions_downloadImage: typeof downloadImage;
declare const appFunctions_getLocation: typeof getLocation;
declare const appFunctions_getNotiPermission: typeof getNotiPermission;
declare const appFunctions_initializeEsim: typeof initializeEsim;
declare const appFunctions_initiateKycCheck: typeof initiateKycCheck;
declare const appFunctions_navigationBackFrom: typeof navigationBackFrom;
declare const appFunctions_onNavigateToRoute: typeof onNavigateToRoute;
declare const appFunctions_openLink: typeof openLink;
declare const appFunctions_openScanner: typeof openScanner;
declare const appFunctions_openUbcab: typeof openUbcab;
declare const appFunctions_saveDateToCalendar: typeof saveDateToCalendar;
declare const appFunctions_selectContact: typeof selectContact;
declare const appFunctions_setColor: typeof setColor;
declare const appFunctions_setNavigation: typeof setNavigation;
declare const appFunctions_setOperatorName: typeof setOperatorName;
declare const appFunctions_setScreenProtection: typeof setScreenProtection;
declare const appFunctions_share: typeof share;
declare const appFunctions_shareDynamicLink: typeof shareDynamicLink;
declare const appFunctions_shareStory: typeof shareStory;
declare const appFunctions_verifyMpin: typeof verifyMpin;
declare namespace appFunctions {
export { appFunctions_buy as buy, appFunctions_buyFromBatchPayment as buyFromBatchPayment, appFunctions_buyfromDynamiclink as buyfromDynamiclink, appFunctions_checkNotification as checkNotification, appFunctions_closeWebView as closeWebView, appFunctions_downloadFile as downloadFile, appFunctions_downloadImage as downloadImage, appFunctions_getLocation as getLocation, appFunctions_getNotiPermission as getNotiPermission, appFunctions_initializeEsim as initializeEsim, appFunctions_initiateKycCheck as initiateKycCheck, appFunctions_navigationBackFrom as navigationBackFrom, appFunctions_onNavigateToRoute as onNavigateToRoute, appFunctions_openLink as openLink, appFunctions_openScanner as openScanner, appFunctions_openUbcab as openUbcab, appFunctions_saveDateToCalendar as saveDateToCalendar, appFunctions_selectContact as selectContact, appFunctions_setColor as setColor, appFunctions_setNavigation as setNavigation, appFunctions_setOperatorName as setOperatorName, appFunctions_setScreenProtection as setScreenProtection, appFunctions_share as share, appFunctions_shareDynamicLink as shareDynamicLink, appFunctions_shareStory as shareStory, appFunctions_verifyMpin as verifyMpin };
}
export { appFunctions as app };