@gbyte/tauri-plugin-in-app-review 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 gbyte
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,108 @@
1
+ # Tauri Plugin in-app-review
2
+
3
+ Allows requesting app ratings within the app, without leaving the current application.
4
+
5
+ > ⚠️ iOS only. This plugin relies on Apple StoreKit APIs and is not available on other platforms.
6
+
7
+ ---
8
+
9
+ When you call this API in your shipping app and the system displays a rating and review request view, the system handles the entire process for you. Although you normally call this method when it makes sense in the user experience flow of your app, App Store policy governs the actual display of a rating and review request view. When your app calls this API, StoreKit uses the following criteria:
10
+
11
+ - If the person hasn’t rated or reviewed your app on this device, StoreKit displays the ratings and review request a maximum of three times within a 365-day period.
12
+
13
+ - If the person has rated or reviewed your app on this device, StoreKit displays the ratings and review request if the app version is new, and if more than 365 days have passed since the person’s previous review.
14
+
15
+ People can review your app at any time on the App Store. To make it easier for people to leave reviews, you may include a persistent link to your App Store product page in your app’s settings or configuration screens. Append the query parameter action=write-review to your product page URL to automatically open the App Store page where users can write a review.
16
+
17
+ You can look [Apple Developer Documentation](https://developer.apple.com/documentation/storekit/requestreviewaction)
18
+
19
+ ---
20
+
21
+ ## Installation
22
+
23
+ ```bash
24
+ pnpm add @gbyte/tauri-plugin-in-app-review
25
+ # or
26
+ npm install @gbyte/tauri-plugin-in-app-review
27
+ # or
28
+ yarn add @gbyte/tauri-plugin-in-app-review
29
+ ```
30
+
31
+ Add the plugin to your Tauri project's `Cargo.toml`:
32
+
33
+ ```toml
34
+ [dependencies]
35
+ tauri-plugin-in-app-review = "0.1"
36
+ ```
37
+
38
+ Or use `cargo add tauri-plugin-in-app-review`.
39
+
40
+ Configure the plugin permissions in your `capabilities/default.json`:
41
+
42
+ ```json
43
+ {
44
+ "permissions": [
45
+ "in-app-review:default"
46
+ ]
47
+ }
48
+ ```
49
+
50
+ Register the plugin in your Tauri app:
51
+
52
+ ```rust
53
+ fn main() {
54
+ tauri::Builder::default()
55
+ .plugin(tauri_plugin_in_app_review::init())
56
+ .run(tauri::generate_context!())
57
+ .expect("error while running tauri application");
58
+ }
59
+ ```
60
+
61
+ ---
62
+
63
+ ## Usage (Conceptual Example)
64
+
65
+ When your app calls this method while it’s in development mode, StoreKit always displays the rating and review request view, so you can test the user interface and experience.
66
+
67
+ However, this method has no effect in apps that you distribute for beta testing using TestFlight.
68
+
69
+ ```tsx
70
+ import { requestReview } from '@gbyte/tauri-plugin-in-app-review'
71
+
72
+ export function SuccessModal({ close }) {
73
+
74
+ const onSuceess = () => {
75
+ close()
76
+ requestReview()
77
+ }
78
+
79
+ return (
80
+ <div>
81
+ <header>
82
+ <h1>Success!</h1>
83
+ </header>
84
+ <main>
85
+ Support this free feature with a quick rating!
86
+ </main>
87
+ <footer>
88
+ {/**
89
+ *
90
+ * Because this API may not present an alert, don’t call it in response to a button tap or other user action.
91
+ *
92
+ * Can see https://developer.apple.com/design/human-interface-guidelines/ratings-and-reviews
93
+ *
94
+ */}
95
+ <button onClick={onSuccess}>Yes</button>
96
+ <button onClick={close}>No</button>
97
+ </footer>
98
+ </div>
99
+ )
100
+ }
101
+
102
+ ```
103
+
104
+ ---
105
+
106
+ ## License
107
+
108
+ MIT
@@ -0,0 +1,17 @@
1
+ 'use strict';
2
+
3
+ var core = require('@tauri-apps/api/core');
4
+
5
+ async function ping(value) {
6
+ return await core.invoke('plugin:in-app-review|ping', {
7
+ payload: {
8
+ value
9
+ }
10
+ }).then((r) => (r.value ? r.value : null));
11
+ }
12
+ async function requestReview() {
13
+ return await core.invoke('plugin:in-app-review|request_review');
14
+ }
15
+
16
+ exports.ping = ping;
17
+ exports.requestReview = requestReview;
@@ -0,0 +1,2 @@
1
+ export declare function ping(value: string): Promise<string | null>;
2
+ export declare function requestReview(): Promise<void>;
@@ -0,0 +1,14 @@
1
+ import { invoke } from '@tauri-apps/api/core';
2
+
3
+ async function ping(value) {
4
+ return await invoke('plugin:in-app-review|ping', {
5
+ payload: {
6
+ value
7
+ }
8
+ }).then((r) => (r.value ? r.value : null));
9
+ }
10
+ async function requestReview() {
11
+ return await invoke('plugin:in-app-review|request_review');
12
+ }
13
+
14
+ export { ping, requestReview };
package/package.json ADDED
@@ -0,0 +1,58 @@
1
+ {
2
+ "name": "@gbyte/tauri-plugin-in-app-review",
3
+ "version": "0.1.0",
4
+ "author": "Gbyte",
5
+ "license": "MIT",
6
+ "description": "Allows requesting app ratings within the app, without leaving the current application.",
7
+ "type": "module",
8
+ "types": "./dist-js/index.d.ts",
9
+ "main": "./dist-js/index.cjs",
10
+ "module": "./dist-js/index.js",
11
+ "exports": {
12
+ "types": "./dist-js/index.d.ts",
13
+ "import": "./dist-js/index.js",
14
+ "require": "./dist-js/index.cjs"
15
+ },
16
+ "files": [
17
+ "dist-js",
18
+ "README.md"
19
+ ],
20
+ "dependencies": {
21
+ "@tauri-apps/api": "^2.0.0"
22
+ },
23
+ "devDependencies": {
24
+ "@rollup/plugin-typescript": "^12.0.0",
25
+ "rollup": "^4.9.6",
26
+ "typescript": "^5.3.3",
27
+ "tslib": "^2.6.2"
28
+ },
29
+ "repository": {
30
+ "type": "git",
31
+ "url": "https://github.com/Gbyte-Group/tauri-plugin-in-app-review.git"
32
+ },
33
+ "homepage": "https://github.com/Gbyte-Group/tauri-plugin-in-app-review#readme",
34
+ "bugs": {
35
+ "url": "https://github.com/Gbyte-Group/tauri-plugin-in-app-review/issues"
36
+ },
37
+ "publishConfig": {
38
+ "access": "public",
39
+ "registry": "https://registry.npmjs.org/"
40
+ },
41
+ "keywords": [
42
+ "tauri",
43
+ "tauri-plugin",
44
+ "iOS",
45
+ "review",
46
+ "app",
47
+ "mobile",
48
+ "native",
49
+ "rust",
50
+ "swift",
51
+ "typescript",
52
+ "applestore"
53
+ ],
54
+ "scripts": {
55
+ "build": "rollup -c",
56
+ "pretest": "pnpm build"
57
+ }
58
+ }