# @awesome-cordova-library/ratedialog

> A plugin to provide rate this app functionality into your cordova application.

Latest version **1.0.6** (published 2023-09-12) · SEE LICENSE IN LICENSE license · 0 weekly downloads

## Install

```sh
npm install @awesome-cordova-library/ratedialog
pnpm add @awesome-cordova-library/ratedialog
yarn add @awesome-cordova-library/ratedialog
bun add @awesome-cordova-library/ratedialog
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.6 |
| Published | 2023-09-12 |
| First published | 2022-10-14 |
| Weekly downloads | 0 |
| License | SEE LICENSE IN LICENSE |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 20.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 7 |
| Author | Jordan AZOULAY |
| Maintainers | joazco |
| Keywords | cordova, capacitor, ionic, javascript, mobile, rate, cordova-rate-dialog, apprate, cordova-app-rate |

## Links

- npm: https://www.npmjs.com/package/@awesome-cordova-library/ratedialog
- Repository: https://github.com/joazco/awesome-cordova-library
- Issues: https://github.com/joazco/awesome-cordova-library/issues
- npm.io page: https://npm.io/package/@awesome-cordova-library/ratedialog

## Dependencies (4)

- [@awesome-cordova-library/device](https://npm.io/package/@awesome-cordova-library/device.md) ^1.0.6
- [@awesome-cordova-library/dialogs](https://npm.io/package/@awesome-cordova-library/dialogs.md) ^1.0.0
- [@awesome-cordova-library/inappbrowser](https://npm.io/package/@awesome-cordova-library/inappbrowser.md) ^1.0.1
- [@awesome-cordova-library/localstorage](https://npm.io/package/@awesome-cordova-library/localstorage.md) ^1.0.3

## Alternatives

- [react-native-root-siblings](https://npm.io/package/react-native-root-siblings.md) — 102.9K weekly downloads
- [post-robot](https://npm.io/package/post-robot.md) — 93.7K weekly downloads
- [@praxisui/dialog](https://npm.io/package/@praxisui/dialog.md) — 2.0K weekly downloads
- [easy-toggle-state](https://npm.io/package/easy-toggle-state.md) — 350 weekly downloads
- [ngx-lightbox-evp](https://npm.io/package/ngx-lightbox-evp.md) — 19 weekly downloads

## Recent versions

- 1.0.6 (latest) — 2023-09-12
- 1.0.5 — 2022-10-19
- 1.0.4 — 2022-10-17
- 1.0.3 — 2022-10-14
- 1.0.2 — 2022-10-14
- 1.0.1 — 2022-10-14
- 1.0.0 — 2022-10-14

## README

---
id: plugin-ratedialog
title: Ratedialog
tags:
  - cordova
  - capacitor
  - ionic
  - javascript
  - typescript
  - plugin
  - mobile
  - ratedialog
---

# Ratedialog

A plugin to provide rate this app functionality into your cordova application.

[Online documentation](https://awesomecordovalibrary.com)

## Installation

### Cordova

```sh
cordova plugin add cordova-plugin-dialogs
cordova plugin add cordova-plugin-device
cordova plugin add cordova-plugin-inappbrowser
npm i @awesome-cordova-library/ratedialog
```

### Capacitor / Ionic

```bash
npm install cordova-plugin-dialogs
npm install cordova-plugin-device
npm install cordova-plugin-inappbrowser
npm install @awesome-cordova-library/ratedialog
npx cap sync
```

## Options

| Option                                      | Type       | Description                                                            |
| :------------------------------------------ | :--------- | :--------------------------------------------------------------------- |
| appName                                     | String     | App name                                                               |
| locale                                      | 'en', 'fr' | Locale have to use, if you use other language use **forceText** option |
| usesUntilPrompt                             | number     | Count of runs of application before dialog will be displayed           |
| storeAppURL.ios                             | number     | application id in AppStore (ex: 1234567)                               |
| storeAppURL.android                         | number     | application id in Google Store (ex: com.joazco.cordovaawesomelibrary)  |
| forceText.rate_dialog_modal_title           | string     | **optional** Title of modal                                            |
| forceText.rate_dialog_content               | string     | **optional** Content of modal                                          |
| forceText.rate_dialog_modal_btn_ratenow     | string     | **optional** Text of button rate now                                   |
| forceText.rate_dialog_modal_btn_no          | string     | **optional** Text of button no                                         |
| forceText.rate_dialog_modal_btn_maybe_later | string     | **optional** Text of button maybe later                                |

## Vanilla

### Declaration

```typescript
class RateDialog {
  /**
   * Set preferences for use RateDialog
   * @param options {DialogRateOption}
   */
  static setPreference(options: DialogRateOption): void;
  /**
   * Show dialog rating if user open app usesUntilPrompt times. You can force open dialog with force = true. If user had select no or rate now dialog won't open again. If user selected later usesUntilPrompt is reset at 0.
   * @param force {boolean}
   */
  static promptForRating(force?: boolean): void;
  /**
   * Reset usesUntilPrompt at 0 and dialog will be open again after user open app usesUntilPrompt times
   */
  static resetUserRatedOrRefused(): void;
  /**
   * Get information if user select no or rate now
   * @returns {bool|undefined}
   */
  static getUserRatedOrRefused(): boolean | undefined;
  /**
   * Get number of times user open app since the first call promptForRating
   * @returns {number|undefined}
   */
  static getNbUseApp(): number | undefined;
  /**
   * Override langage
   * @param locale {DialogRateLanguagesAccepted}
   * @returns
   */
  static setLocale(locale: DialogRateLanguagesAccepted): void;
}
```

### Usages

```typescript
import RateDialog from '@awesome-cordova-library/ratedialog';

RateDialog.setPreference({
  appName: 'Cordova Awesome Library',
  locale: 'en',
  usesUntilPrompt: 3,
  storeAppURL: {
    ios: '1234567',
    android: 'com.joazco.cordovaawesomelibrary',
  },
});
RateDialog.promptForRating();
```

## React

### Declaration

```typescript
const useRateDialog: (initOptions: DialogRateOption) => {
  setPreference: (options: DialogRateOption) => void;
  promptForRating: (force?: boolean) => void;
  resetUserRatedOrRefused: () => void;
  getUserRatedOrRefused: () => boolean | undefined;
  getNbUseApp: () => number | undefined;
  setLocale: (locale: DialogRateLanguagesAccepted) => void;
};
```

### Usages

```typescript
import { useEffect } from 'react';
import useRateDialog from '@awesome-cordova-library/ratedialog/lib/react';

function App() {
  const { promptForRating } = useRateDialog({
    appName: 'Cordova Awesome Library',
    locale: 'en',
    usesUntilPrompt: 3,
    storeAppURL: {
      ios: '1234567',
      android: 'com.joazco.cordovaawesomelibrary',
    },
  });

  useEffect(() => {
    promptForRating();
  }, [promptForRating]);

  return <div />;
}
```

---
_Source: https://npm.io/package/@awesome-cordova-library/ratedialog · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
