> For the complete documentation index, see [llms.txt](https://docs.mod91.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.mod91.io/mod91-webview-sdk/api-reference/utilsapi.md).

# UtilsAPI

Docs for UtilsAPI methods

## 1. showToast

```typescript
showToast(toastData: ToastParams): Promise<void>
```

Shows native android toasts of type \[error, success, info]

***

Accepts `ToastParams :`&#x20;

`type : ToastType : [error, success, info]`

`message: string`: message to be shown in toast

### 2. scanQr

```typescript
scanQr(minLength: number): Promise<string>
```

Opens scanner to scan qr codes.

***

Accepts `minLength : number` as paramter. This is the minimum length of QR content to be scanned.

***

Returns `string`content of QR scanned.

### 3. scanBarcode

```typescript
scanBarcode(minLength: number): Promise<string>
```

Opens scanner to scan barcode.

***

Accepts `minLength : number` as paramter. This is the minimum length of barcode content to be scanned.

***

Returns `string` content of barcode scanned.

### 4. getMerchantData

```typescript
getMerchantData(): Promise<MerchantData>
```

Gives data about the merchant.

***

Returns `MerchantData` :&#x20;

`shopName : string` : Shop name of the merchant

`shopAddress : string` : Shop address of the merchant

`mobileNumber : string` : Mobile number of the merchant

`supportNumber : string` : Support number of the merchant

### 5. showDialog

```typescript
showDialog(dialogData: DialogData): Promise<DialogAction>
```

Show native android dialog of types : `[success, error, confirmation]`

***

Aceepts `DialogData` as parameter **:**&#x20;

`type : DialogType [success, error, confirmation]` : Type of dialog to be shown

`title : string` : Title of the dialog&#x20;

`message : string` : Message to be shown in the dialog

`positiveBtnText : string | null | undefined` : Text to be shown in positive button of dialog if type of dialog is **confirmation**

`negativeBtnText : string | null | undefined` : Text to be shown in negative button of dialog if type of dialog is **confirmation**

***

Returns `DialogAction` :&#x20;

`actoin : 0 | 1` : Is 0 if negative button is pushed or 1 if postive button is pushed in dialog type confirmation. All other types 1 is returned.&#x20;

### 6. onClientError

```typescript
onClientError(message: string): Promise<void>
```

Shows android native error page with message provided.

***

Accepts `message : string` : Message to be shown on error page.

### 7. toggleAppLoader&#x20;

Toggles android native loader

```typescript
toggleAppLoader(loaderParams: ToggleAppLoaderParams): Promise<void> 
```

***

Accepts `ToggleAppLoaderParams` :&#x20;

`showLoader:  boolean` : Show or hide loader

`loaderText : string | null | undefined` : Loader text to be shown when shwoing the loader

### 8. checkIfTerminal

Checks if device is a POS terminal.

```typescript
checkIfTerminal(): Promise<TerminalModelData>
```

***

Returns `boolean` : true if terminal , false for any other device.

### 9. openQrDialog

Opens QR dialog with the content provided

```typescript
openQrDialog(qrDialogInput: QrDialogData): Promise<void>
```

***

Accepts `qrDialogInput: QrDialogData`:&#x20;

`title : string` : Title of the QR Dialog&#x20;

`qrData: string` : QR data for which the qr is to be shown
