@capawesome/capacitor-age-signals 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.
Files changed (35) hide show
  1. package/CapawesomeCapacitorAgeSignals.podspec +17 -0
  2. package/LICENSE +201 -0
  3. package/Package.swift +28 -0
  4. package/README.md +111 -0
  5. package/android/build.gradle +60 -0
  6. package/android/src/main/AndroidManifest.xml +2 -0
  7. package/android/src/main/java/io/capawesome/capacitorjs/plugins/agesignals/AgeSignals.java +75 -0
  8. package/android/src/main/java/io/capawesome/capacitorjs/plugins/agesignals/AgeSignalsPlugin.java +69 -0
  9. package/android/src/main/java/io/capawesome/capacitorjs/plugins/agesignals/classes/CustomException.java +20 -0
  10. package/android/src/main/java/io/capawesome/capacitorjs/plugins/agesignals/classes/CustomExceptions.java +36 -0
  11. package/android/src/main/java/io/capawesome/capacitorjs/plugins/agesignals/classes/results/CheckAgeSignalsResult.java +73 -0
  12. package/android/src/main/java/io/capawesome/capacitorjs/plugins/agesignals/enums/UserStatus.java +10 -0
  13. package/android/src/main/java/io/capawesome/capacitorjs/plugins/agesignals/interfaces/Callback.java +5 -0
  14. package/android/src/main/java/io/capawesome/capacitorjs/plugins/agesignals/interfaces/EmptyCallback.java +5 -0
  15. package/android/src/main/java/io/capawesome/capacitorjs/plugins/agesignals/interfaces/NonEmptyCallback.java +7 -0
  16. package/android/src/main/java/io/capawesome/capacitorjs/plugins/agesignals/interfaces/NonEmptyResultCallback.java +7 -0
  17. package/android/src/main/java/io/capawesome/capacitorjs/plugins/agesignals/interfaces/Result.java +7 -0
  18. package/android/src/main/res/.gitkeep +0 -0
  19. package/dist/docs.json +203 -0
  20. package/dist/esm/definitions.d.ts +173 -0
  21. package/dist/esm/definitions.js +115 -0
  22. package/dist/esm/definitions.js.map +1 -0
  23. package/dist/esm/index.d.ts +4 -0
  24. package/dist/esm/index.js +7 -0
  25. package/dist/esm/index.js.map +1 -0
  26. package/dist/esm/web.d.ts +5 -0
  27. package/dist/esm/web.js +7 -0
  28. package/dist/esm/web.js.map +1 -0
  29. package/dist/plugin.cjs.js +136 -0
  30. package/dist/plugin.cjs.js.map +1 -0
  31. package/dist/plugin.js +139 -0
  32. package/dist/plugin.js.map +1 -0
  33. package/ios/Plugin/AgeSignalsPlugin.swift +15 -0
  34. package/ios/Plugin/Info.plist +24 -0
  35. package/package.json +93 -0
@@ -0,0 +1,73 @@
1
+ package io.capawesome.capacitorjs.plugins.agesignals.classes.results;
2
+
3
+ import androidx.annotation.NonNull;
4
+ import androidx.annotation.Nullable;
5
+ import com.getcapacitor.JSObject;
6
+ import com.google.android.play.agesignals.AgeSignalsResult;
7
+ import io.capawesome.capacitorjs.plugins.agesignals.enums.UserStatus;
8
+ import io.capawesome.capacitorjs.plugins.agesignals.interfaces.Result;
9
+
10
+ public class CheckAgeSignalsResult implements Result {
11
+
12
+ @NonNull
13
+ private final UserStatus userStatus;
14
+
15
+ @Nullable
16
+ private final Integer ageLower;
17
+
18
+ @Nullable
19
+ private final Integer ageUpper;
20
+
21
+ @Nullable
22
+ private final String mostRecentApprovalDate;
23
+
24
+ @Nullable
25
+ private final String installId;
26
+
27
+ public CheckAgeSignalsResult(@NonNull AgeSignalsResult ageSignalsResult) {
28
+ this.userStatus = mapUserStatus(ageSignalsResult.userStatus().toString());
29
+ this.ageLower = ageSignalsResult.ageLower();
30
+ this.ageUpper = ageSignalsResult.ageUpper();
31
+ this.mostRecentApprovalDate = ageSignalsResult.mostRecentApprovalDate() != null
32
+ ? ageSignalsResult.mostRecentApprovalDate().toString()
33
+ : null;
34
+ this.installId = ageSignalsResult.installId();
35
+ }
36
+
37
+ @NonNull
38
+ public JSObject toJSObject() {
39
+ JSObject result = new JSObject();
40
+ result.put("userStatus", userStatus.name());
41
+ if (ageLower != null) {
42
+ result.put("ageLower", ageLower);
43
+ }
44
+ if (ageUpper != null) {
45
+ result.put("ageUpper", ageUpper);
46
+ }
47
+ if (mostRecentApprovalDate != null) {
48
+ result.put("mostRecentApprovalDate", mostRecentApprovalDate);
49
+ }
50
+ if (installId != null) {
51
+ result.put("installId", installId);
52
+ }
53
+ return result;
54
+ }
55
+
56
+ @NonNull
57
+ private UserStatus mapUserStatus(@NonNull String status) {
58
+ switch (status) {
59
+ case "VERIFIED":
60
+ return UserStatus.VERIFIED;
61
+ case "SUPERVISED":
62
+ return UserStatus.SUPERVISED;
63
+ case "SUPERVISED_APPROVAL_PENDING":
64
+ return UserStatus.SUPERVISED_APPROVAL_PENDING;
65
+ case "SUPERVISED_APPROVAL_DENIED":
66
+ return UserStatus.SUPERVISED_APPROVAL_DENIED;
67
+ case "UNKNOWN":
68
+ return UserStatus.UNKNOWN;
69
+ default:
70
+ return UserStatus.EMPTY;
71
+ }
72
+ }
73
+ }
@@ -0,0 +1,10 @@
1
+ package io.capawesome.capacitorjs.plugins.agesignals.enums;
2
+
3
+ public enum UserStatus {
4
+ VERIFIED,
5
+ SUPERVISED,
6
+ SUPERVISED_APPROVAL_PENDING,
7
+ SUPERVISED_APPROVAL_DENIED,
8
+ UNKNOWN,
9
+ EMPTY
10
+ }
@@ -0,0 +1,5 @@
1
+ package io.capawesome.capacitorjs.plugins.agesignals.interfaces;
2
+
3
+ public interface Callback {
4
+ void error(Exception exception);
5
+ }
@@ -0,0 +1,5 @@
1
+ package io.capawesome.capacitorjs.plugins.agesignals.interfaces;
2
+
3
+ public interface EmptyCallback extends Callback {
4
+ void success();
5
+ }
@@ -0,0 +1,7 @@
1
+ package io.capawesome.capacitorjs.plugins.agesignals.interfaces;
2
+
3
+ import androidx.annotation.NonNull;
4
+
5
+ public interface NonEmptyCallback<T> extends Callback {
6
+ void success(@NonNull T result);
7
+ }
@@ -0,0 +1,7 @@
1
+ package io.capawesome.capacitorjs.plugins.agesignals.interfaces;
2
+
3
+ import androidx.annotation.NonNull;
4
+
5
+ public interface NonEmptyResultCallback<T extends Result> extends Callback {
6
+ void success(@NonNull T result);
7
+ }
@@ -0,0 +1,7 @@
1
+ package io.capawesome.capacitorjs.plugins.agesignals.interfaces;
2
+
3
+ import com.getcapacitor.JSObject;
4
+
5
+ public interface Result {
6
+ JSObject toJSObject();
7
+ }
File without changes
package/dist/docs.json ADDED
@@ -0,0 +1,203 @@
1
+ {
2
+ "api": {
3
+ "name": "AgeSignalsPlugin",
4
+ "slug": "agesignalsplugin",
5
+ "docs": "",
6
+ "tags": [
7
+ {
8
+ "text": "0.0.1",
9
+ "name": "since"
10
+ }
11
+ ],
12
+ "methods": [
13
+ {
14
+ "name": "checkAgeSignals",
15
+ "signature": "() => Promise<CheckAgeSignalsResult>",
16
+ "parameters": [],
17
+ "returns": "Promise<CheckAgeSignalsResult>",
18
+ "tags": [
19
+ {
20
+ "name": "since",
21
+ "text": "0.0.1"
22
+ }
23
+ ],
24
+ "docs": "Request the user's age signals from Google Play.\n\nOnly available on Android.",
25
+ "complexTypes": [
26
+ "CheckAgeSignalsResult"
27
+ ],
28
+ "slug": "checkagesignals"
29
+ }
30
+ ],
31
+ "properties": []
32
+ },
33
+ "interfaces": [
34
+ {
35
+ "name": "CheckAgeSignalsResult",
36
+ "slug": "checkagesignalsresult",
37
+ "docs": "",
38
+ "tags": [
39
+ {
40
+ "text": "0.0.1",
41
+ "name": "since"
42
+ }
43
+ ],
44
+ "methods": [],
45
+ "properties": [
46
+ {
47
+ "name": "userStatus",
48
+ "tags": [
49
+ {
50
+ "text": "0.0.1",
51
+ "name": "since"
52
+ }
53
+ ],
54
+ "docs": "The user's verification status.",
55
+ "complexTypes": [
56
+ "UserStatus"
57
+ ],
58
+ "type": "UserStatus"
59
+ },
60
+ {
61
+ "name": "ageLower",
62
+ "tags": [
63
+ {
64
+ "text": "0.0.1",
65
+ "name": "since"
66
+ },
67
+ {
68
+ "text": "13",
69
+ "name": "example"
70
+ }
71
+ ],
72
+ "docs": "The (inclusive) lower bound of a supervised user's age range.\n\nOnly available when `userStatus` is `SUPERVISED`, `SUPERVISED_APPROVAL_PENDING`, or `SUPERVISED_APPROVAL_DENIED`.",
73
+ "complexTypes": [],
74
+ "type": "number | undefined"
75
+ },
76
+ {
77
+ "name": "ageUpper",
78
+ "tags": [
79
+ {
80
+ "text": "0.0.1",
81
+ "name": "since"
82
+ },
83
+ {
84
+ "text": "15",
85
+ "name": "example"
86
+ }
87
+ ],
88
+ "docs": "The (inclusive) upper bound of a supervised user's age range.\n\nOnly available when `userStatus` is `SUPERVISED`, `SUPERVISED_APPROVAL_PENDING`, or `SUPERVISED_APPROVAL_DENIED` and the user's age is under 18.",
89
+ "complexTypes": [],
90
+ "type": "number | undefined"
91
+ },
92
+ {
93
+ "name": "mostRecentApprovalDate",
94
+ "tags": [
95
+ {
96
+ "text": "0.0.1",
97
+ "name": "since"
98
+ },
99
+ {
100
+ "text": "\"2024-01-15\"",
101
+ "name": "example"
102
+ }
103
+ ],
104
+ "docs": "The effective from date of the most recent significant change that was approved.\nWhen an app is installed, the date of the most recent significant change prior to install is used.\n\nOnly available when `userStatus` is `SUPERVISED_APPROVAL_PENDING` or `SUPERVISED_APPROVAL_DENIED`.",
105
+ "complexTypes": [],
106
+ "type": "string | undefined"
107
+ },
108
+ {
109
+ "name": "installId",
110
+ "tags": [
111
+ {
112
+ "text": "0.0.1",
113
+ "name": "since"
114
+ },
115
+ {
116
+ "text": "\"abc123xyz\"",
117
+ "name": "example"
118
+ }
119
+ ],
120
+ "docs": "An ID assigned to supervised user installs by Google Play, used for the purposes of notifying you of revoked app approval.\n\nOnly available when `userStatus` is `SUPERVISED`, `SUPERVISED_APPROVAL_PENDING`, or `SUPERVISED_APPROVAL_DENIED`.",
121
+ "complexTypes": [],
122
+ "type": "string | undefined"
123
+ }
124
+ ]
125
+ }
126
+ ],
127
+ "enums": [
128
+ {
129
+ "name": "UserStatus",
130
+ "slug": "userstatus",
131
+ "members": [
132
+ {
133
+ "name": "Verified",
134
+ "value": "'VERIFIED'",
135
+ "tags": [
136
+ {
137
+ "text": "0.0.1",
138
+ "name": "since"
139
+ }
140
+ ],
141
+ "docs": "The user is over 18. Google verified the user's age using a commercially reasonable method such as a government-issued ID, credit card, or facial age estimation."
142
+ },
143
+ {
144
+ "name": "Supervised",
145
+ "value": "'SUPERVISED'",
146
+ "tags": [
147
+ {
148
+ "text": "0.0.1",
149
+ "name": "since"
150
+ }
151
+ ],
152
+ "docs": "The user has a supervised Google Account managed by a parent who sets their age.\nUse `ageLower` and `ageUpper` to determine the user's age range."
153
+ },
154
+ {
155
+ "name": "SupervisedApprovalPending",
156
+ "value": "'SUPERVISED_APPROVAL_PENDING'",
157
+ "tags": [
158
+ {
159
+ "text": "0.0.1",
160
+ "name": "since"
161
+ }
162
+ ],
163
+ "docs": "The user has a supervised Google Account, and their supervising parent has not yet approved one or more pending significant changes.\nUse `ageLower` and `ageUpper` to determine the user's age range.\nUse `mostRecentApprovalDate` to determine the last significant change that was approved."
164
+ },
165
+ {
166
+ "name": "SupervisedApprovalDenied",
167
+ "value": "'SUPERVISED_APPROVAL_DENIED'",
168
+ "tags": [
169
+ {
170
+ "text": "0.0.1",
171
+ "name": "since"
172
+ }
173
+ ],
174
+ "docs": "The user has a supervised Google Account, and their supervising parent denied approval for one or more significant changes.\nUse `ageLower` and `ageUpper` to determine the user's age range.\nUse `mostRecentApprovalDate` to determine the last significant change that was approved."
175
+ },
176
+ {
177
+ "name": "Unknown",
178
+ "value": "'UNKNOWN'",
179
+ "tags": [
180
+ {
181
+ "text": "0.0.1",
182
+ "name": "since"
183
+ }
184
+ ],
185
+ "docs": "The user is not verified or supervised in applicable jurisdictions and regions. These users could be over or under 18.\nTo obtain an age signal from Google Play, ask the user to visit the Play Store to resolve their status."
186
+ },
187
+ {
188
+ "name": "Empty",
189
+ "value": "'EMPTY'",
190
+ "tags": [
191
+ {
192
+ "text": "0.0.1",
193
+ "name": "since"
194
+ }
195
+ ],
196
+ "docs": "All other users return this value."
197
+ }
198
+ ]
199
+ }
200
+ ],
201
+ "typeAliases": [],
202
+ "pluginConfigs": []
203
+ }
@@ -0,0 +1,173 @@
1
+ /**
2
+ * @since 0.0.1
3
+ */
4
+ export interface AgeSignalsPlugin {
5
+ /**
6
+ * Request the user's age signals from Google Play.
7
+ *
8
+ * Only available on Android.
9
+ *
10
+ * @since 0.0.1
11
+ */
12
+ checkAgeSignals(): Promise<CheckAgeSignalsResult>;
13
+ }
14
+ /**
15
+ * @since 0.0.1
16
+ */
17
+ export interface CheckAgeSignalsResult {
18
+ /**
19
+ * The user's verification status.
20
+ *
21
+ * @since 0.0.1
22
+ */
23
+ userStatus: UserStatus;
24
+ /**
25
+ * The (inclusive) lower bound of a supervised user's age range.
26
+ *
27
+ * Only available when `userStatus` is `SUPERVISED`, `SUPERVISED_APPROVAL_PENDING`, or `SUPERVISED_APPROVAL_DENIED`.
28
+ *
29
+ * @since 0.0.1
30
+ * @example 13
31
+ */
32
+ ageLower?: number;
33
+ /**
34
+ * The (inclusive) upper bound of a supervised user's age range.
35
+ *
36
+ * Only available when `userStatus` is `SUPERVISED`, `SUPERVISED_APPROVAL_PENDING`, or `SUPERVISED_APPROVAL_DENIED` and the user's age is under 18.
37
+ *
38
+ * @since 0.0.1
39
+ * @example 15
40
+ */
41
+ ageUpper?: number;
42
+ /**
43
+ * The effective from date of the most recent significant change that was approved.
44
+ * When an app is installed, the date of the most recent significant change prior to install is used.
45
+ *
46
+ * Only available when `userStatus` is `SUPERVISED_APPROVAL_PENDING` or `SUPERVISED_APPROVAL_DENIED`.
47
+ *
48
+ * @since 0.0.1
49
+ * @example "2024-01-15"
50
+ */
51
+ mostRecentApprovalDate?: string;
52
+ /**
53
+ * An ID assigned to supervised user installs by Google Play, used for the purposes of notifying you of revoked app approval.
54
+ *
55
+ * Only available when `userStatus` is `SUPERVISED`, `SUPERVISED_APPROVAL_PENDING`, or `SUPERVISED_APPROVAL_DENIED`.
56
+ *
57
+ * @since 0.0.1
58
+ * @example "abc123xyz"
59
+ */
60
+ installId?: string;
61
+ }
62
+ /**
63
+ * @since 0.0.1
64
+ */
65
+ export declare enum UserStatus {
66
+ /**
67
+ * The user is over 18. Google verified the user's age using a commercially reasonable method such as a government-issued ID, credit card, or facial age estimation.
68
+ *
69
+ * @since 0.0.1
70
+ */
71
+ Verified = "VERIFIED",
72
+ /**
73
+ * The user has a supervised Google Account managed by a parent who sets their age.
74
+ * Use `ageLower` and `ageUpper` to determine the user's age range.
75
+ *
76
+ * @since 0.0.1
77
+ */
78
+ Supervised = "SUPERVISED",
79
+ /**
80
+ * The user has a supervised Google Account, and their supervising parent has not yet approved one or more pending significant changes.
81
+ * Use `ageLower` and `ageUpper` to determine the user's age range.
82
+ * Use `mostRecentApprovalDate` to determine the last significant change that was approved.
83
+ *
84
+ * @since 0.0.1
85
+ */
86
+ SupervisedApprovalPending = "SUPERVISED_APPROVAL_PENDING",
87
+ /**
88
+ * The user has a supervised Google Account, and their supervising parent denied approval for one or more significant changes.
89
+ * Use `ageLower` and `ageUpper` to determine the user's age range.
90
+ * Use `mostRecentApprovalDate` to determine the last significant change that was approved.
91
+ *
92
+ * @since 0.0.1
93
+ */
94
+ SupervisedApprovalDenied = "SUPERVISED_APPROVAL_DENIED",
95
+ /**
96
+ * The user is not verified or supervised in applicable jurisdictions and regions. These users could be over or under 18.
97
+ * To obtain an age signal from Google Play, ask the user to visit the Play Store to resolve their status.
98
+ *
99
+ * @since 0.0.1
100
+ */
101
+ Unknown = "UNKNOWN",
102
+ /**
103
+ * All other users return this value.
104
+ *
105
+ * @since 0.0.1
106
+ */
107
+ Empty = "EMPTY"
108
+ }
109
+ /**
110
+ * @since 0.0.1
111
+ */
112
+ export declare enum ErrorCode {
113
+ /**
114
+ * The Play Age Signals API is not available. The Play Store app version installed on the device might be old.
115
+ *
116
+ * @since 0.0.1
117
+ */
118
+ ApiNotAvailable = "API_NOT_AVAILABLE",
119
+ /**
120
+ * No Play Store app is found on the device.
121
+ *
122
+ * @since 0.0.1
123
+ */
124
+ PlayStoreNotFound = "PLAY_STORE_NOT_FOUND",
125
+ /**
126
+ * No available network is found.
127
+ *
128
+ * @since 0.0.1
129
+ */
130
+ NetworkError = "NETWORK_ERROR",
131
+ /**
132
+ * Play Services is not available or its version is too old.
133
+ *
134
+ * @since 0.0.1
135
+ */
136
+ PlayServicesNotFound = "PLAY_SERVICES_NOT_FOUND",
137
+ /**
138
+ * Binding to the service in the Play Store has failed. This can be due to having an old Play Store version installed on the device or device memory is overloaded.
139
+ *
140
+ * @since 0.0.1
141
+ */
142
+ CannotBindToService = "CANNOT_BIND_TO_SERVICE",
143
+ /**
144
+ * The Play Store app needs to be updated.
145
+ *
146
+ * @since 0.0.1
147
+ */
148
+ PlayStoreVersionOutdated = "PLAY_STORE_VERSION_OUTDATED",
149
+ /**
150
+ * Play Services needs to be updated.
151
+ *
152
+ * @since 0.0.1
153
+ */
154
+ PlayServicesVersionOutdated = "PLAY_SERVICES_VERSION_OUTDATED",
155
+ /**
156
+ * There was a transient error in the client device.
157
+ *
158
+ * @since 0.0.1
159
+ */
160
+ ClientTransientError = "CLIENT_TRANSIENT_ERROR",
161
+ /**
162
+ * The app was not installed by Google Play.
163
+ *
164
+ * @since 0.0.1
165
+ */
166
+ AppNotOwned = "APP_NOT_OWNED",
167
+ /**
168
+ * Unknown internal error.
169
+ *
170
+ * @since 0.0.1
171
+ */
172
+ InternalError = "INTERNAL_ERROR"
173
+ }
@@ -0,0 +1,115 @@
1
+ /**
2
+ * @since 0.0.1
3
+ */
4
+ export var UserStatus;
5
+ (function (UserStatus) {
6
+ /**
7
+ * The user is over 18. Google verified the user's age using a commercially reasonable method such as a government-issued ID, credit card, or facial age estimation.
8
+ *
9
+ * @since 0.0.1
10
+ */
11
+ UserStatus["Verified"] = "VERIFIED";
12
+ /**
13
+ * The user has a supervised Google Account managed by a parent who sets their age.
14
+ * Use `ageLower` and `ageUpper` to determine the user's age range.
15
+ *
16
+ * @since 0.0.1
17
+ */
18
+ UserStatus["Supervised"] = "SUPERVISED";
19
+ /**
20
+ * The user has a supervised Google Account, and their supervising parent has not yet approved one or more pending significant changes.
21
+ * Use `ageLower` and `ageUpper` to determine the user's age range.
22
+ * Use `mostRecentApprovalDate` to determine the last significant change that was approved.
23
+ *
24
+ * @since 0.0.1
25
+ */
26
+ UserStatus["SupervisedApprovalPending"] = "SUPERVISED_APPROVAL_PENDING";
27
+ /**
28
+ * The user has a supervised Google Account, and their supervising parent denied approval for one or more significant changes.
29
+ * Use `ageLower` and `ageUpper` to determine the user's age range.
30
+ * Use `mostRecentApprovalDate` to determine the last significant change that was approved.
31
+ *
32
+ * @since 0.0.1
33
+ */
34
+ UserStatus["SupervisedApprovalDenied"] = "SUPERVISED_APPROVAL_DENIED";
35
+ /**
36
+ * The user is not verified or supervised in applicable jurisdictions and regions. These users could be over or under 18.
37
+ * To obtain an age signal from Google Play, ask the user to visit the Play Store to resolve their status.
38
+ *
39
+ * @since 0.0.1
40
+ */
41
+ UserStatus["Unknown"] = "UNKNOWN";
42
+ /**
43
+ * All other users return this value.
44
+ *
45
+ * @since 0.0.1
46
+ */
47
+ UserStatus["Empty"] = "EMPTY";
48
+ })(UserStatus || (UserStatus = {}));
49
+ /**
50
+ * @since 0.0.1
51
+ */
52
+ export var ErrorCode;
53
+ (function (ErrorCode) {
54
+ /**
55
+ * The Play Age Signals API is not available. The Play Store app version installed on the device might be old.
56
+ *
57
+ * @since 0.0.1
58
+ */
59
+ ErrorCode["ApiNotAvailable"] = "API_NOT_AVAILABLE";
60
+ /**
61
+ * No Play Store app is found on the device.
62
+ *
63
+ * @since 0.0.1
64
+ */
65
+ ErrorCode["PlayStoreNotFound"] = "PLAY_STORE_NOT_FOUND";
66
+ /**
67
+ * No available network is found.
68
+ *
69
+ * @since 0.0.1
70
+ */
71
+ ErrorCode["NetworkError"] = "NETWORK_ERROR";
72
+ /**
73
+ * Play Services is not available or its version is too old.
74
+ *
75
+ * @since 0.0.1
76
+ */
77
+ ErrorCode["PlayServicesNotFound"] = "PLAY_SERVICES_NOT_FOUND";
78
+ /**
79
+ * Binding to the service in the Play Store has failed. This can be due to having an old Play Store version installed on the device or device memory is overloaded.
80
+ *
81
+ * @since 0.0.1
82
+ */
83
+ ErrorCode["CannotBindToService"] = "CANNOT_BIND_TO_SERVICE";
84
+ /**
85
+ * The Play Store app needs to be updated.
86
+ *
87
+ * @since 0.0.1
88
+ */
89
+ ErrorCode["PlayStoreVersionOutdated"] = "PLAY_STORE_VERSION_OUTDATED";
90
+ /**
91
+ * Play Services needs to be updated.
92
+ *
93
+ * @since 0.0.1
94
+ */
95
+ ErrorCode["PlayServicesVersionOutdated"] = "PLAY_SERVICES_VERSION_OUTDATED";
96
+ /**
97
+ * There was a transient error in the client device.
98
+ *
99
+ * @since 0.0.1
100
+ */
101
+ ErrorCode["ClientTransientError"] = "CLIENT_TRANSIENT_ERROR";
102
+ /**
103
+ * The app was not installed by Google Play.
104
+ *
105
+ * @since 0.0.1
106
+ */
107
+ ErrorCode["AppNotOwned"] = "APP_NOT_OWNED";
108
+ /**
109
+ * Unknown internal error.
110
+ *
111
+ * @since 0.0.1
112
+ */
113
+ ErrorCode["InternalError"] = "INTERNAL_ERROR";
114
+ })(ErrorCode || (ErrorCode = {}));
115
+ //# sourceMappingURL=definitions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AA+DA;;GAEG;AACH,MAAM,CAAN,IAAY,UA2CX;AA3CD,WAAY,UAAU;IACpB;;;;OAIG;IACH,mCAAqB,CAAA;IACrB;;;;;OAKG;IACH,uCAAyB,CAAA;IACzB;;;;;;OAMG;IACH,uEAAyD,CAAA;IACzD;;;;;;OAMG;IACH,qEAAuD,CAAA;IACvD;;;;;OAKG;IACH,iCAAmB,CAAA;IACnB;;;;OAIG;IACH,6BAAe,CAAA;AACjB,CAAC,EA3CW,UAAU,KAAV,UAAU,QA2CrB;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,SA6DX;AA7DD,WAAY,SAAS;IACnB;;;;OAIG;IACH,kDAAqC,CAAA;IACrC;;;;OAIG;IACH,uDAA0C,CAAA;IAC1C;;;;OAIG;IACH,2CAA8B,CAAA;IAC9B;;;;OAIG;IACH,6DAAgD,CAAA;IAChD;;;;OAIG;IACH,2DAA8C,CAAA;IAC9C;;;;OAIG;IACH,qEAAwD,CAAA;IACxD;;;;OAIG;IACH,2EAA8D,CAAA;IAC9D;;;;OAIG;IACH,4DAA+C,CAAA;IAC/C;;;;OAIG;IACH,0CAA6B,CAAA;IAC7B;;;;OAIG;IACH,6CAAgC,CAAA;AAClC,CAAC,EA7DW,SAAS,KAAT,SAAS,QA6DpB","sourcesContent":["/**\n * @since 0.0.1\n */\nexport interface AgeSignalsPlugin {\n /**\n * Request the user's age signals from Google Play.\n *\n * Only available on Android.\n *\n * @since 0.0.1\n */\n checkAgeSignals(): Promise<CheckAgeSignalsResult>;\n}\n\n/**\n * @since 0.0.1\n */\nexport interface CheckAgeSignalsResult {\n /**\n * The user's verification status.\n *\n * @since 0.0.1\n */\n userStatus: UserStatus;\n /**\n * The (inclusive) lower bound of a supervised user's age range.\n *\n * Only available when `userStatus` is `SUPERVISED`, `SUPERVISED_APPROVAL_PENDING`, or `SUPERVISED_APPROVAL_DENIED`.\n *\n * @since 0.0.1\n * @example 13\n */\n ageLower?: number;\n /**\n * The (inclusive) upper bound of a supervised user's age range.\n *\n * Only available when `userStatus` is `SUPERVISED`, `SUPERVISED_APPROVAL_PENDING`, or `SUPERVISED_APPROVAL_DENIED` and the user's age is under 18.\n *\n * @since 0.0.1\n * @example 15\n */\n ageUpper?: number;\n /**\n * The effective from date of the most recent significant change that was approved.\n * When an app is installed, the date of the most recent significant change prior to install is used.\n *\n * Only available when `userStatus` is `SUPERVISED_APPROVAL_PENDING` or `SUPERVISED_APPROVAL_DENIED`.\n *\n * @since 0.0.1\n * @example \"2024-01-15\"\n */\n mostRecentApprovalDate?: string;\n /**\n * An ID assigned to supervised user installs by Google Play, used for the purposes of notifying you of revoked app approval.\n *\n * Only available when `userStatus` is `SUPERVISED`, `SUPERVISED_APPROVAL_PENDING`, or `SUPERVISED_APPROVAL_DENIED`.\n *\n * @since 0.0.1\n * @example \"abc123xyz\"\n */\n installId?: string;\n}\n\n/**\n * @since 0.0.1\n */\nexport enum UserStatus {\n /**\n * The user is over 18. Google verified the user's age using a commercially reasonable method such as a government-issued ID, credit card, or facial age estimation.\n *\n * @since 0.0.1\n */\n Verified = 'VERIFIED',\n /**\n * The user has a supervised Google Account managed by a parent who sets their age.\n * Use `ageLower` and `ageUpper` to determine the user's age range.\n *\n * @since 0.0.1\n */\n Supervised = 'SUPERVISED',\n /**\n * The user has a supervised Google Account, and their supervising parent has not yet approved one or more pending significant changes.\n * Use `ageLower` and `ageUpper` to determine the user's age range.\n * Use `mostRecentApprovalDate` to determine the last significant change that was approved.\n *\n * @since 0.0.1\n */\n SupervisedApprovalPending = 'SUPERVISED_APPROVAL_PENDING',\n /**\n * The user has a supervised Google Account, and their supervising parent denied approval for one or more significant changes.\n * Use `ageLower` and `ageUpper` to determine the user's age range.\n * Use `mostRecentApprovalDate` to determine the last significant change that was approved.\n *\n * @since 0.0.1\n */\n SupervisedApprovalDenied = 'SUPERVISED_APPROVAL_DENIED',\n /**\n * The user is not verified or supervised in applicable jurisdictions and regions. These users could be over or under 18.\n * To obtain an age signal from Google Play, ask the user to visit the Play Store to resolve their status.\n *\n * @since 0.0.1\n */\n Unknown = 'UNKNOWN',\n /**\n * All other users return this value.\n *\n * @since 0.0.1\n */\n Empty = 'EMPTY',\n}\n\n/**\n * @since 0.0.1\n */\nexport enum ErrorCode {\n /**\n * The Play Age Signals API is not available. The Play Store app version installed on the device might be old.\n *\n * @since 0.0.1\n */\n ApiNotAvailable = 'API_NOT_AVAILABLE',\n /**\n * No Play Store app is found on the device.\n *\n * @since 0.0.1\n */\n PlayStoreNotFound = 'PLAY_STORE_NOT_FOUND',\n /**\n * No available network is found.\n *\n * @since 0.0.1\n */\n NetworkError = 'NETWORK_ERROR',\n /**\n * Play Services is not available or its version is too old.\n *\n * @since 0.0.1\n */\n PlayServicesNotFound = 'PLAY_SERVICES_NOT_FOUND',\n /**\n * Binding to the service in the Play Store has failed. This can be due to having an old Play Store version installed on the device or device memory is overloaded.\n *\n * @since 0.0.1\n */\n CannotBindToService = 'CANNOT_BIND_TO_SERVICE',\n /**\n * The Play Store app needs to be updated.\n *\n * @since 0.0.1\n */\n PlayStoreVersionOutdated = 'PLAY_STORE_VERSION_OUTDATED',\n /**\n * Play Services needs to be updated.\n *\n * @since 0.0.1\n */\n PlayServicesVersionOutdated = 'PLAY_SERVICES_VERSION_OUTDATED',\n /**\n * There was a transient error in the client device.\n *\n * @since 0.0.1\n */\n ClientTransientError = 'CLIENT_TRANSIENT_ERROR',\n /**\n * The app was not installed by Google Play.\n *\n * @since 0.0.1\n */\n AppNotOwned = 'APP_NOT_OWNED',\n /**\n * Unknown internal error.\n *\n * @since 0.0.1\n */\n InternalError = 'INTERNAL_ERROR',\n}\n"]}
@@ -0,0 +1,4 @@
1
+ import type { AgeSignalsPlugin } from './definitions';
2
+ declare const AgeSignals: AgeSignalsPlugin;
3
+ export * from './definitions';
4
+ export { AgeSignals };
@@ -0,0 +1,7 @@
1
+ import { registerPlugin } from '@capacitor/core';
2
+ const AgeSignals = registerPlugin('AgeSignals', {
3
+ web: () => import('./web').then(m => new m.AgeSignalsWeb()),
4
+ });
5
+ export * from './definitions';
6
+ export { AgeSignals };
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAIjD,MAAM,UAAU,GAAG,cAAc,CAAmB,YAAY,EAAE;IAChE,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,aAAa,EAAE,CAAC;CAC5D,CAAC,CAAC;AAEH,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,UAAU,EAAE,CAAC","sourcesContent":["import { registerPlugin } from '@capacitor/core';\n\nimport type { AgeSignalsPlugin } from './definitions';\n\nconst AgeSignals = registerPlugin<AgeSignalsPlugin>('AgeSignals', {\n web: () => import('./web').then(m => new m.AgeSignalsWeb()),\n});\n\nexport * from './definitions';\nexport { AgeSignals };\n"]}
@@ -0,0 +1,5 @@
1
+ import { WebPlugin } from '@capacitor/core';
2
+ import type { AgeSignalsPlugin, CheckAgeSignalsResult } from './definitions';
3
+ export declare class AgeSignalsWeb extends WebPlugin implements AgeSignalsPlugin {
4
+ checkAgeSignals(): Promise<CheckAgeSignalsResult>;
5
+ }
@@ -0,0 +1,7 @@
1
+ import { WebPlugin } from '@capacitor/core';
2
+ export class AgeSignalsWeb extends WebPlugin {
3
+ async checkAgeSignals() {
4
+ throw this.unimplemented('Not implemented on web.');
5
+ }
6
+ }
7
+ //# sourceMappingURL=web.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAI5C,MAAM,OAAO,aAAc,SAAQ,SAAS;IAC1C,KAAK,CAAC,eAAe;QACnB,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;IACtD,CAAC;CACF","sourcesContent":["import { WebPlugin } from '@capacitor/core';\n\nimport type { AgeSignalsPlugin, CheckAgeSignalsResult } from './definitions';\n\nexport class AgeSignalsWeb extends WebPlugin implements AgeSignalsPlugin {\n async checkAgeSignals(): Promise<CheckAgeSignalsResult> {\n throw this.unimplemented('Not implemented on web.');\n }\n}\n"]}