@capgo/capacitor-android-age-signals 0.0.1

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 (31) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +103 -0
  3. package/android/build.gradle +59 -0
  4. package/android/src/main/AndroidManifest.xml +3 -0
  5. package/android/src/main/java/app/capgo/androidagesignals/AgeSignals.java +75 -0
  6. package/android/src/main/java/app/capgo/androidagesignals/AgeSignalsPlugin.java +78 -0
  7. package/android/src/main/java/app/capgo/androidagesignals/classes/CustomException.java +19 -0
  8. package/android/src/main/java/app/capgo/androidagesignals/classes/CustomExceptions.java +43 -0
  9. package/android/src/main/java/app/capgo/androidagesignals/classes/results/CheckAgeSignalsResult.java +72 -0
  10. package/android/src/main/java/app/capgo/androidagesignals/enums/UserStatus.java +10 -0
  11. package/android/src/main/java/app/capgo/androidagesignals/interfaces/Callback.java +5 -0
  12. package/android/src/main/java/app/capgo/androidagesignals/interfaces/NonEmptyResultCallback.java +7 -0
  13. package/android/src/main/java/app/capgo/androidagesignals/interfaces/Result.java +7 -0
  14. package/dist/docs.json +203 -0
  15. package/dist/esm/definitions.d.ts +192 -0
  16. package/dist/esm/definitions.js +123 -0
  17. package/dist/esm/definitions.js.map +1 -0
  18. package/dist/esm/index.d.ts +4 -0
  19. package/dist/esm/index.js +7 -0
  20. package/dist/esm/index.js.map +1 -0
  21. package/dist/esm/web.d.ts +5 -0
  22. package/dist/esm/web.js +7 -0
  23. package/dist/esm/web.js.map +1 -0
  24. package/dist/plugin.cjs.js +144 -0
  25. package/dist/plugin.cjs.js.map +1 -0
  26. package/dist/plugin.js +147 -0
  27. package/dist/plugin.js.map +1 -0
  28. package/package.json +75 -0
  29. package/src/definitions.ts +197 -0
  30. package/src/index.ts +10 -0
  31. package/src/web.ts +9 -0
@@ -0,0 +1,144 @@
1
+ 'use strict';
2
+
3
+ var core = require('@capacitor/core');
4
+
5
+ /**
6
+ * Status values reported by Google Play Age Signals.
7
+ *
8
+ * @since 0.0.1
9
+ */
10
+ exports.UserStatus = void 0;
11
+ (function (UserStatus) {
12
+ /**
13
+ * The user is over 18 and their age has been verified by Google.
14
+ *
15
+ * @since 0.0.1
16
+ */
17
+ UserStatus["Verified"] = "VERIFIED";
18
+ /**
19
+ * The user has a supervised Google Account managed by a guardian.
20
+ *
21
+ * Use `ageLower` and `ageUpper` to determine the user's age range.
22
+ *
23
+ * @since 0.0.1
24
+ */
25
+ UserStatus["Supervised"] = "SUPERVISED";
26
+ /**
27
+ * The supervised user has pending significant changes awaiting guardian approval.
28
+ *
29
+ * Use `ageLower` and `ageUpper` to determine the user's age range and `mostRecentApprovalDate`
30
+ * to identify the most recent approved change.
31
+ *
32
+ * @since 0.0.1
33
+ */
34
+ UserStatus["SupervisedApprovalPending"] = "SUPERVISED_APPROVAL_PENDING";
35
+ /**
36
+ * The supervised user's guardian denied one or more significant changes.
37
+ *
38
+ * Use `ageLower` and `ageUpper` to determine the user's age range and `mostRecentApprovalDate`
39
+ * to identify the last approved change.
40
+ *
41
+ * @since 0.0.1
42
+ */
43
+ UserStatus["SupervisedApprovalDenied"] = "SUPERVISED_APPROVAL_DENIED";
44
+ /**
45
+ * The user is not verified or supervised in supported regions.
46
+ *
47
+ * You should prompt the user to resolve their status in the Play Store.
48
+ *
49
+ * @since 0.0.1
50
+ */
51
+ UserStatus["Unknown"] = "UNKNOWN";
52
+ /**
53
+ * All other users return this value.
54
+ *
55
+ * @since 0.0.1
56
+ */
57
+ UserStatus["Empty"] = "EMPTY";
58
+ })(exports.UserStatus || (exports.UserStatus = {}));
59
+ /**
60
+ * Error codes representing failures returned by the Play Age Signals API.
61
+ *
62
+ * @since 0.0.1
63
+ */
64
+ exports.ErrorCode = void 0;
65
+ (function (ErrorCode) {
66
+ /**
67
+ * The Play Age Signals API is not available. The installed Play Store version might be outdated.
68
+ *
69
+ * @since 0.0.1
70
+ */
71
+ ErrorCode["ApiNotAvailable"] = "API_NOT_AVAILABLE";
72
+ /**
73
+ * No Play Store app was found on the device.
74
+ *
75
+ * @since 0.0.1
76
+ */
77
+ ErrorCode["PlayStoreNotFound"] = "PLAY_STORE_NOT_FOUND";
78
+ /**
79
+ * No network connection is currently available.
80
+ *
81
+ * @since 0.0.1
82
+ */
83
+ ErrorCode["NetworkError"] = "NETWORK_ERROR";
84
+ /**
85
+ * Google Play services is missing or too old.
86
+ *
87
+ * @since 0.0.1
88
+ */
89
+ ErrorCode["PlayServicesNotFound"] = "PLAY_SERVICES_NOT_FOUND";
90
+ /**
91
+ * The Play Store service binding failed.
92
+ *
93
+ * @since 0.0.1
94
+ */
95
+ ErrorCode["CannotBindToService"] = "CANNOT_BIND_TO_SERVICE";
96
+ /**
97
+ * The Play Store application needs to be updated.
98
+ *
99
+ * @since 0.0.1
100
+ */
101
+ ErrorCode["PlayStoreVersionOutdated"] = "PLAY_STORE_VERSION_OUTDATED";
102
+ /**
103
+ * Google Play services needs to be updated.
104
+ *
105
+ * @since 0.0.1
106
+ */
107
+ ErrorCode["PlayServicesVersionOutdated"] = "PLAY_SERVICES_VERSION_OUTDATED";
108
+ /**
109
+ * A transient error occurred on the client device.
110
+ *
111
+ * @since 0.0.1
112
+ */
113
+ ErrorCode["ClientTransientError"] = "CLIENT_TRANSIENT_ERROR";
114
+ /**
115
+ * The app was not installed through Google Play.
116
+ *
117
+ * @since 0.0.1
118
+ */
119
+ ErrorCode["AppNotOwned"] = "APP_NOT_OWNED";
120
+ /**
121
+ * An unknown internal error occurred.
122
+ *
123
+ * @since 0.0.1
124
+ */
125
+ ErrorCode["InternalError"] = "INTERNAL_ERROR";
126
+ })(exports.ErrorCode || (exports.ErrorCode = {}));
127
+
128
+ const AgeSignals = core.registerPlugin('AgeSignals', {
129
+ web: () => Promise.resolve().then(function () { return web; }).then(m => new m.AgeSignalsWeb()),
130
+ });
131
+
132
+ class AgeSignalsWeb extends core.WebPlugin {
133
+ async checkAgeSignals() {
134
+ throw this.unimplemented('checkAgeSignals is only available on Android.');
135
+ }
136
+ }
137
+
138
+ var web = /*#__PURE__*/Object.freeze({
139
+ __proto__: null,
140
+ AgeSignalsWeb: AgeSignalsWeb
141
+ });
142
+
143
+ exports.AgeSignals = AgeSignals;
144
+ //# sourceMappingURL=plugin.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.cjs.js","sources":["esm/definitions.js","esm/index.js","esm/web.js"],"sourcesContent":["/**\n * Status values reported by Google Play Age Signals.\n *\n * @since 0.0.1\n */\nexport var UserStatus;\n(function (UserStatus) {\n /**\n * The user is over 18 and their age has been verified by Google.\n *\n * @since 0.0.1\n */\n UserStatus[\"Verified\"] = \"VERIFIED\";\n /**\n * The user has a supervised Google Account managed by a guardian.\n *\n * Use `ageLower` and `ageUpper` to determine the user's age range.\n *\n * @since 0.0.1\n */\n UserStatus[\"Supervised\"] = \"SUPERVISED\";\n /**\n * The supervised user has pending significant changes awaiting guardian approval.\n *\n * Use `ageLower` and `ageUpper` to determine the user's age range and `mostRecentApprovalDate`\n * to identify the most recent approved change.\n *\n * @since 0.0.1\n */\n UserStatus[\"SupervisedApprovalPending\"] = \"SUPERVISED_APPROVAL_PENDING\";\n /**\n * The supervised user's guardian denied one or more significant changes.\n *\n * Use `ageLower` and `ageUpper` to determine the user's age range and `mostRecentApprovalDate`\n * to identify the last approved change.\n *\n * @since 0.0.1\n */\n UserStatus[\"SupervisedApprovalDenied\"] = \"SUPERVISED_APPROVAL_DENIED\";\n /**\n * The user is not verified or supervised in supported regions.\n *\n * You should prompt the user to resolve their status in the Play Store.\n *\n * @since 0.0.1\n */\n UserStatus[\"Unknown\"] = \"UNKNOWN\";\n /**\n * All other users return this value.\n *\n * @since 0.0.1\n */\n UserStatus[\"Empty\"] = \"EMPTY\";\n})(UserStatus || (UserStatus = {}));\n/**\n * Error codes representing failures returned by the Play Age Signals API.\n *\n * @since 0.0.1\n */\nexport var ErrorCode;\n(function (ErrorCode) {\n /**\n * The Play Age Signals API is not available. The installed Play Store version might be outdated.\n *\n * @since 0.0.1\n */\n ErrorCode[\"ApiNotAvailable\"] = \"API_NOT_AVAILABLE\";\n /**\n * No Play Store app was found on the device.\n *\n * @since 0.0.1\n */\n ErrorCode[\"PlayStoreNotFound\"] = \"PLAY_STORE_NOT_FOUND\";\n /**\n * No network connection is currently available.\n *\n * @since 0.0.1\n */\n ErrorCode[\"NetworkError\"] = \"NETWORK_ERROR\";\n /**\n * Google Play services is missing or too old.\n *\n * @since 0.0.1\n */\n ErrorCode[\"PlayServicesNotFound\"] = \"PLAY_SERVICES_NOT_FOUND\";\n /**\n * The Play Store service binding failed.\n *\n * @since 0.0.1\n */\n ErrorCode[\"CannotBindToService\"] = \"CANNOT_BIND_TO_SERVICE\";\n /**\n * The Play Store application needs to be updated.\n *\n * @since 0.0.1\n */\n ErrorCode[\"PlayStoreVersionOutdated\"] = \"PLAY_STORE_VERSION_OUTDATED\";\n /**\n * Google Play services needs to be updated.\n *\n * @since 0.0.1\n */\n ErrorCode[\"PlayServicesVersionOutdated\"] = \"PLAY_SERVICES_VERSION_OUTDATED\";\n /**\n * A transient error occurred on the client device.\n *\n * @since 0.0.1\n */\n ErrorCode[\"ClientTransientError\"] = \"CLIENT_TRANSIENT_ERROR\";\n /**\n * The app was not installed through Google Play.\n *\n * @since 0.0.1\n */\n ErrorCode[\"AppNotOwned\"] = \"APP_NOT_OWNED\";\n /**\n * An unknown internal error occurred.\n *\n * @since 0.0.1\n */\n ErrorCode[\"InternalError\"] = \"INTERNAL_ERROR\";\n})(ErrorCode || (ErrorCode = {}));\n//# sourceMappingURL=definitions.js.map","import { registerPlugin } from '@capacitor/core';\nconst AgeSignals = registerPlugin('AgeSignals', {\n web: () => import('./web').then(m => new m.AgeSignalsWeb()),\n});\nexport * from './definitions';\nexport { AgeSignals };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class AgeSignalsWeb extends WebPlugin {\n async checkAgeSignals() {\n throw this.unimplemented('checkAgeSignals is only available on Android.');\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["UserStatus","ErrorCode","registerPlugin","WebPlugin"],"mappings":";;;;AAAA;AACA;AACA;AACA;AACA;AACWA;AACX,CAAC,UAAU,UAAU,EAAE;AACvB;AACA;AACA;AACA;AACA;AACA,IAAI,UAAU,CAAC,UAAU,CAAC,GAAG,UAAU;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,UAAU,CAAC,YAAY,CAAC,GAAG,YAAY;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,UAAU,CAAC,2BAA2B,CAAC,GAAG,6BAA6B;AAC3E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,UAAU,CAAC,0BAA0B,CAAC,GAAG,4BAA4B;AACzE;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,UAAU,CAAC,SAAS,CAAC,GAAG,SAAS;AACrC;AACA;AACA;AACA;AACA;AACA,IAAI,UAAU,CAAC,OAAO,CAAC,GAAG,OAAO;AACjC,CAAC,EAAEA,kBAAU,KAAKA,kBAAU,GAAG,EAAE,CAAC,CAAC;AACnC;AACA;AACA;AACA;AACA;AACWC;AACX,CAAC,UAAU,SAAS,EAAE;AACtB;AACA;AACA;AACA;AACA;AACA,IAAI,SAAS,CAAC,iBAAiB,CAAC,GAAG,mBAAmB;AACtD;AACA;AACA;AACA;AACA;AACA,IAAI,SAAS,CAAC,mBAAmB,CAAC,GAAG,sBAAsB;AAC3D;AACA;AACA;AACA;AACA;AACA,IAAI,SAAS,CAAC,cAAc,CAAC,GAAG,eAAe;AAC/C;AACA;AACA;AACA;AACA;AACA,IAAI,SAAS,CAAC,sBAAsB,CAAC,GAAG,yBAAyB;AACjE;AACA;AACA;AACA;AACA;AACA,IAAI,SAAS,CAAC,qBAAqB,CAAC,GAAG,wBAAwB;AAC/D;AACA;AACA;AACA;AACA;AACA,IAAI,SAAS,CAAC,0BAA0B,CAAC,GAAG,6BAA6B;AACzE;AACA;AACA;AACA;AACA;AACA,IAAI,SAAS,CAAC,6BAA6B,CAAC,GAAG,gCAAgC;AAC/E;AACA;AACA;AACA;AACA;AACA,IAAI,SAAS,CAAC,sBAAsB,CAAC,GAAG,wBAAwB;AAChE;AACA;AACA;AACA;AACA;AACA,IAAI,SAAS,CAAC,aAAa,CAAC,GAAG,eAAe;AAC9C;AACA;AACA;AACA;AACA;AACA,IAAI,SAAS,CAAC,eAAe,CAAC,GAAG,gBAAgB;AACjD,CAAC,EAAEA,iBAAS,KAAKA,iBAAS,GAAG,EAAE,CAAC,CAAC;;ACxH5B,MAAC,UAAU,GAAGC,mBAAc,CAAC,YAAY,EAAE;AAChD,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,aAAa,EAAE,CAAC;AAC/D,CAAC;;ACFM,MAAM,aAAa,SAASC,cAAS,CAAC;AAC7C,IAAI,MAAM,eAAe,GAAG;AAC5B,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,+CAA+C,CAAC;AACjF,IAAI;AACJ;;;;;;;;;"}
package/dist/plugin.js ADDED
@@ -0,0 +1,147 @@
1
+ var capacitorAndroidAgeSignals = (function (exports, core) {
2
+ 'use strict';
3
+
4
+ /**
5
+ * Status values reported by Google Play Age Signals.
6
+ *
7
+ * @since 0.0.1
8
+ */
9
+ exports.UserStatus = void 0;
10
+ (function (UserStatus) {
11
+ /**
12
+ * The user is over 18 and their age has been verified by Google.
13
+ *
14
+ * @since 0.0.1
15
+ */
16
+ UserStatus["Verified"] = "VERIFIED";
17
+ /**
18
+ * The user has a supervised Google Account managed by a guardian.
19
+ *
20
+ * Use `ageLower` and `ageUpper` to determine the user's age range.
21
+ *
22
+ * @since 0.0.1
23
+ */
24
+ UserStatus["Supervised"] = "SUPERVISED";
25
+ /**
26
+ * The supervised user has pending significant changes awaiting guardian approval.
27
+ *
28
+ * Use `ageLower` and `ageUpper` to determine the user's age range and `mostRecentApprovalDate`
29
+ * to identify the most recent approved change.
30
+ *
31
+ * @since 0.0.1
32
+ */
33
+ UserStatus["SupervisedApprovalPending"] = "SUPERVISED_APPROVAL_PENDING";
34
+ /**
35
+ * The supervised user's guardian denied one or more significant changes.
36
+ *
37
+ * Use `ageLower` and `ageUpper` to determine the user's age range and `mostRecentApprovalDate`
38
+ * to identify the last approved change.
39
+ *
40
+ * @since 0.0.1
41
+ */
42
+ UserStatus["SupervisedApprovalDenied"] = "SUPERVISED_APPROVAL_DENIED";
43
+ /**
44
+ * The user is not verified or supervised in supported regions.
45
+ *
46
+ * You should prompt the user to resolve their status in the Play Store.
47
+ *
48
+ * @since 0.0.1
49
+ */
50
+ UserStatus["Unknown"] = "UNKNOWN";
51
+ /**
52
+ * All other users return this value.
53
+ *
54
+ * @since 0.0.1
55
+ */
56
+ UserStatus["Empty"] = "EMPTY";
57
+ })(exports.UserStatus || (exports.UserStatus = {}));
58
+ /**
59
+ * Error codes representing failures returned by the Play Age Signals API.
60
+ *
61
+ * @since 0.0.1
62
+ */
63
+ exports.ErrorCode = void 0;
64
+ (function (ErrorCode) {
65
+ /**
66
+ * The Play Age Signals API is not available. The installed Play Store version might be outdated.
67
+ *
68
+ * @since 0.0.1
69
+ */
70
+ ErrorCode["ApiNotAvailable"] = "API_NOT_AVAILABLE";
71
+ /**
72
+ * No Play Store app was found on the device.
73
+ *
74
+ * @since 0.0.1
75
+ */
76
+ ErrorCode["PlayStoreNotFound"] = "PLAY_STORE_NOT_FOUND";
77
+ /**
78
+ * No network connection is currently available.
79
+ *
80
+ * @since 0.0.1
81
+ */
82
+ ErrorCode["NetworkError"] = "NETWORK_ERROR";
83
+ /**
84
+ * Google Play services is missing or too old.
85
+ *
86
+ * @since 0.0.1
87
+ */
88
+ ErrorCode["PlayServicesNotFound"] = "PLAY_SERVICES_NOT_FOUND";
89
+ /**
90
+ * The Play Store service binding failed.
91
+ *
92
+ * @since 0.0.1
93
+ */
94
+ ErrorCode["CannotBindToService"] = "CANNOT_BIND_TO_SERVICE";
95
+ /**
96
+ * The Play Store application needs to be updated.
97
+ *
98
+ * @since 0.0.1
99
+ */
100
+ ErrorCode["PlayStoreVersionOutdated"] = "PLAY_STORE_VERSION_OUTDATED";
101
+ /**
102
+ * Google Play services needs to be updated.
103
+ *
104
+ * @since 0.0.1
105
+ */
106
+ ErrorCode["PlayServicesVersionOutdated"] = "PLAY_SERVICES_VERSION_OUTDATED";
107
+ /**
108
+ * A transient error occurred on the client device.
109
+ *
110
+ * @since 0.0.1
111
+ */
112
+ ErrorCode["ClientTransientError"] = "CLIENT_TRANSIENT_ERROR";
113
+ /**
114
+ * The app was not installed through Google Play.
115
+ *
116
+ * @since 0.0.1
117
+ */
118
+ ErrorCode["AppNotOwned"] = "APP_NOT_OWNED";
119
+ /**
120
+ * An unknown internal error occurred.
121
+ *
122
+ * @since 0.0.1
123
+ */
124
+ ErrorCode["InternalError"] = "INTERNAL_ERROR";
125
+ })(exports.ErrorCode || (exports.ErrorCode = {}));
126
+
127
+ const AgeSignals = core.registerPlugin('AgeSignals', {
128
+ web: () => Promise.resolve().then(function () { return web; }).then(m => new m.AgeSignalsWeb()),
129
+ });
130
+
131
+ class AgeSignalsWeb extends core.WebPlugin {
132
+ async checkAgeSignals() {
133
+ throw this.unimplemented('checkAgeSignals is only available on Android.');
134
+ }
135
+ }
136
+
137
+ var web = /*#__PURE__*/Object.freeze({
138
+ __proto__: null,
139
+ AgeSignalsWeb: AgeSignalsWeb
140
+ });
141
+
142
+ exports.AgeSignals = AgeSignals;
143
+
144
+ return exports;
145
+
146
+ })({}, capacitorExports);
147
+ //# sourceMappingURL=plugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.js","sources":["esm/definitions.js","esm/index.js","esm/web.js"],"sourcesContent":["/**\n * Status values reported by Google Play Age Signals.\n *\n * @since 0.0.1\n */\nexport var UserStatus;\n(function (UserStatus) {\n /**\n * The user is over 18 and their age has been verified by Google.\n *\n * @since 0.0.1\n */\n UserStatus[\"Verified\"] = \"VERIFIED\";\n /**\n * The user has a supervised Google Account managed by a guardian.\n *\n * Use `ageLower` and `ageUpper` to determine the user's age range.\n *\n * @since 0.0.1\n */\n UserStatus[\"Supervised\"] = \"SUPERVISED\";\n /**\n * The supervised user has pending significant changes awaiting guardian approval.\n *\n * Use `ageLower` and `ageUpper` to determine the user's age range and `mostRecentApprovalDate`\n * to identify the most recent approved change.\n *\n * @since 0.0.1\n */\n UserStatus[\"SupervisedApprovalPending\"] = \"SUPERVISED_APPROVAL_PENDING\";\n /**\n * The supervised user's guardian denied one or more significant changes.\n *\n * Use `ageLower` and `ageUpper` to determine the user's age range and `mostRecentApprovalDate`\n * to identify the last approved change.\n *\n * @since 0.0.1\n */\n UserStatus[\"SupervisedApprovalDenied\"] = \"SUPERVISED_APPROVAL_DENIED\";\n /**\n * The user is not verified or supervised in supported regions.\n *\n * You should prompt the user to resolve their status in the Play Store.\n *\n * @since 0.0.1\n */\n UserStatus[\"Unknown\"] = \"UNKNOWN\";\n /**\n * All other users return this value.\n *\n * @since 0.0.1\n */\n UserStatus[\"Empty\"] = \"EMPTY\";\n})(UserStatus || (UserStatus = {}));\n/**\n * Error codes representing failures returned by the Play Age Signals API.\n *\n * @since 0.0.1\n */\nexport var ErrorCode;\n(function (ErrorCode) {\n /**\n * The Play Age Signals API is not available. The installed Play Store version might be outdated.\n *\n * @since 0.0.1\n */\n ErrorCode[\"ApiNotAvailable\"] = \"API_NOT_AVAILABLE\";\n /**\n * No Play Store app was found on the device.\n *\n * @since 0.0.1\n */\n ErrorCode[\"PlayStoreNotFound\"] = \"PLAY_STORE_NOT_FOUND\";\n /**\n * No network connection is currently available.\n *\n * @since 0.0.1\n */\n ErrorCode[\"NetworkError\"] = \"NETWORK_ERROR\";\n /**\n * Google Play services is missing or too old.\n *\n * @since 0.0.1\n */\n ErrorCode[\"PlayServicesNotFound\"] = \"PLAY_SERVICES_NOT_FOUND\";\n /**\n * The Play Store service binding failed.\n *\n * @since 0.0.1\n */\n ErrorCode[\"CannotBindToService\"] = \"CANNOT_BIND_TO_SERVICE\";\n /**\n * The Play Store application needs to be updated.\n *\n * @since 0.0.1\n */\n ErrorCode[\"PlayStoreVersionOutdated\"] = \"PLAY_STORE_VERSION_OUTDATED\";\n /**\n * Google Play services needs to be updated.\n *\n * @since 0.0.1\n */\n ErrorCode[\"PlayServicesVersionOutdated\"] = \"PLAY_SERVICES_VERSION_OUTDATED\";\n /**\n * A transient error occurred on the client device.\n *\n * @since 0.0.1\n */\n ErrorCode[\"ClientTransientError\"] = \"CLIENT_TRANSIENT_ERROR\";\n /**\n * The app was not installed through Google Play.\n *\n * @since 0.0.1\n */\n ErrorCode[\"AppNotOwned\"] = \"APP_NOT_OWNED\";\n /**\n * An unknown internal error occurred.\n *\n * @since 0.0.1\n */\n ErrorCode[\"InternalError\"] = \"INTERNAL_ERROR\";\n})(ErrorCode || (ErrorCode = {}));\n//# sourceMappingURL=definitions.js.map","import { registerPlugin } from '@capacitor/core';\nconst AgeSignals = registerPlugin('AgeSignals', {\n web: () => import('./web').then(m => new m.AgeSignalsWeb()),\n});\nexport * from './definitions';\nexport { AgeSignals };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class AgeSignalsWeb extends WebPlugin {\n async checkAgeSignals() {\n throw this.unimplemented('checkAgeSignals is only available on Android.');\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["UserStatus","ErrorCode","registerPlugin","WebPlugin"],"mappings":";;;IAAA;IACA;IACA;IACA;IACA;AACWA;IACX,CAAC,UAAU,UAAU,EAAE;IACvB;IACA;IACA;IACA;IACA;IACA,IAAI,UAAU,CAAC,UAAU,CAAC,GAAG,UAAU;IACvC;IACA;IACA;IACA;IACA;IACA;IACA;IACA,IAAI,UAAU,CAAC,YAAY,CAAC,GAAG,YAAY;IAC3C;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA,IAAI,UAAU,CAAC,2BAA2B,CAAC,GAAG,6BAA6B;IAC3E;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA,IAAI,UAAU,CAAC,0BAA0B,CAAC,GAAG,4BAA4B;IACzE;IACA;IACA;IACA;IACA;IACA;IACA;IACA,IAAI,UAAU,CAAC,SAAS,CAAC,GAAG,SAAS;IACrC;IACA;IACA;IACA;IACA;IACA,IAAI,UAAU,CAAC,OAAO,CAAC,GAAG,OAAO;IACjC,CAAC,EAAEA,kBAAU,KAAKA,kBAAU,GAAG,EAAE,CAAC,CAAC;IACnC;IACA;IACA;IACA;IACA;AACWC;IACX,CAAC,UAAU,SAAS,EAAE;IACtB;IACA;IACA;IACA;IACA;IACA,IAAI,SAAS,CAAC,iBAAiB,CAAC,GAAG,mBAAmB;IACtD;IACA;IACA;IACA;IACA;IACA,IAAI,SAAS,CAAC,mBAAmB,CAAC,GAAG,sBAAsB;IAC3D;IACA;IACA;IACA;IACA;IACA,IAAI,SAAS,CAAC,cAAc,CAAC,GAAG,eAAe;IAC/C;IACA;IACA;IACA;IACA;IACA,IAAI,SAAS,CAAC,sBAAsB,CAAC,GAAG,yBAAyB;IACjE;IACA;IACA;IACA;IACA;IACA,IAAI,SAAS,CAAC,qBAAqB,CAAC,GAAG,wBAAwB;IAC/D;IACA;IACA;IACA;IACA;IACA,IAAI,SAAS,CAAC,0BAA0B,CAAC,GAAG,6BAA6B;IACzE;IACA;IACA;IACA;IACA;IACA,IAAI,SAAS,CAAC,6BAA6B,CAAC,GAAG,gCAAgC;IAC/E;IACA;IACA;IACA;IACA;IACA,IAAI,SAAS,CAAC,sBAAsB,CAAC,GAAG,wBAAwB;IAChE;IACA;IACA;IACA;IACA;IACA,IAAI,SAAS,CAAC,aAAa,CAAC,GAAG,eAAe;IAC9C;IACA;IACA;IACA;IACA;IACA,IAAI,SAAS,CAAC,eAAe,CAAC,GAAG,gBAAgB;IACjD,CAAC,EAAEA,iBAAS,KAAKA,iBAAS,GAAG,EAAE,CAAC,CAAC;;ACxH5B,UAAC,UAAU,GAAGC,mBAAc,CAAC,YAAY,EAAE;IAChD,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,aAAa,EAAE,CAAC;IAC/D,CAAC;;ICFM,MAAM,aAAa,SAASC,cAAS,CAAC;IAC7C,IAAI,MAAM,eAAe,GAAG;IAC5B,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,+CAA+C,CAAC;IACjF,IAAI;IACJ;;;;;;;;;;;;;;;"}
package/package.json ADDED
@@ -0,0 +1,75 @@
1
+ {
2
+ "name": "@capgo/capacitor-android-age-signals",
3
+ "version": "0.0.1",
4
+ "description": "Capacitor plugin that exposes Google Play Age Signals to your app.",
5
+ "main": "dist/plugin.cjs.js",
6
+ "module": "dist/esm/index.js",
7
+ "types": "dist/esm/index.d.ts",
8
+ "unpkg": "dist/plugin.js",
9
+ "files": [
10
+ "android/src/main/",
11
+ "android/build.gradle",
12
+ "dist/",
13
+ "src/",
14
+ "README.md"
15
+ ],
16
+ "author": "Martin Donadieu <martin@capgo.app>",
17
+ "license": "MIT",
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "git+https://github.com/Cap-go/capacitor-android-age-signals.git"
21
+ },
22
+ "bugs": {
23
+ "url": "https://github.com/Cap-go/capacitor-android-age-signals/issues"
24
+ },
25
+ "keywords": [
26
+ "capacitor",
27
+ "capacitor-plugin",
28
+ "google-play",
29
+ "age-signals",
30
+ "capgo"
31
+ ],
32
+ "scripts": {
33
+ "verify": "bun run verify:android && bun run verify:web",
34
+ "verify:android": "cd android && ./gradlew clean build test && cd ..",
35
+ "verify:web": "bun run build",
36
+ "lint": "bun run eslint && bun run prettier -- --check",
37
+ "fmt": "bun run eslint -- --fix && bun run prettier -- --write",
38
+ "eslint": "eslint . --ext .ts",
39
+ "prettier": "prettier \"**/*.{css,html,ts,js,java}\" --plugin=prettier-plugin-java",
40
+ "docgen": "docgen --api AgeSignalsPlugin --output-readme README.md --output-json dist/docs.json",
41
+ "build": "bun run clean && bun run docgen && tsc && rollup -c rollup.config.mjs",
42
+ "clean": "rimraf ./dist",
43
+ "watch": "tsc --watch",
44
+ "prepublishOnly": "bun run build"
45
+ },
46
+ "devDependencies": {
47
+ "@capacitor/android": "^7.0.0",
48
+ "@capacitor/cli": "^7.0.0",
49
+ "@capacitor/core": "^7.0.0",
50
+ "@capacitor/docgen": "^0.3.0",
51
+ "@capacitor/ios": "^7.0.0",
52
+ "@ionic/eslint-config": "^0.4.0",
53
+ "@ionic/prettier-config": "^4.0.0",
54
+ "@types/node": "^22.13.1",
55
+ "eslint": "^8.57.0",
56
+ "eslint-plugin-import": "^2.31.0",
57
+ "prettier": "^3.4.2",
58
+ "prettier-plugin-java": "^2.6.7",
59
+ "rimraf": "^6.0.1",
60
+ "rollup": "^4.34.6",
61
+ "typescript": "^5.7.3"
62
+ },
63
+ "peerDependencies": {
64
+ "@capacitor/core": ">=7.0.0"
65
+ },
66
+ "eslintConfig": {
67
+ "extends": "@ionic/eslint-config/recommended"
68
+ },
69
+ "prettier": "@ionic/prettier-config",
70
+ "capacitor": {
71
+ "android": {
72
+ "src": "android"
73
+ }
74
+ }
75
+ }
@@ -0,0 +1,197 @@
1
+ import type { PermissionState } from '@capacitor/core';
2
+
3
+ /**
4
+ * Capacitor interface for retrieving Play Age Signals.
5
+ *
6
+ * @since 0.0.1
7
+ */
8
+ export interface AgeSignalsPlugin {
9
+ /**
10
+ * Request the current Play Age Signals for the active user.
11
+ *
12
+ * Only available on Android devices with Google Play installed.
13
+ *
14
+ * @since 0.0.1
15
+ */
16
+ checkAgeSignals(): Promise<CheckAgeSignalsResult>;
17
+ }
18
+
19
+ /**
20
+ * Structured result returned by {@link AgeSignalsPlugin.checkAgeSignals}.
21
+ *
22
+ * @since 0.0.1
23
+ */
24
+ export interface CheckAgeSignalsResult {
25
+ /**
26
+ * The user's verification status as reported by Google Play.
27
+ *
28
+ * @since 0.0.1
29
+ */
30
+ userStatus: UserStatus;
31
+ /**
32
+ * Inclusive lower bound of the supervised user's age range.
33
+ *
34
+ * Present only when `userStatus` is `SUPERVISED`, `SUPERVISED_APPROVAL_PENDING`, or `SUPERVISED_APPROVAL_DENIED`.
35
+ *
36
+ * @since 0.0.1
37
+ * @example 13
38
+ */
39
+ ageLower?: number;
40
+ /**
41
+ * Inclusive upper bound of the supervised user's age range.
42
+ *
43
+ * Present only when `userStatus` is `SUPERVISED`, `SUPERVISED_APPROVAL_PENDING`, or `SUPERVISED_APPROVAL_DENIED`
44
+ * and the user's age is reported as less than 18.
45
+ *
46
+ * @since 0.0.1
47
+ * @example 15
48
+ */
49
+ ageUpper?: number;
50
+ /**
51
+ * Effective date for the most recent significant change that received guardian approval.
52
+ *
53
+ * Present only when `userStatus` is `SUPERVISED_APPROVAL_PENDING` or `SUPERVISED_APPROVAL_DENIED`.
54
+ *
55
+ * @since 0.0.1
56
+ * @example "2024-01-15"
57
+ */
58
+ mostRecentApprovalDate?: string;
59
+ /**
60
+ * Identifier assigned to supervised installs in Google Play for revocation notifications.
61
+ *
62
+ * Present only when `userStatus` is `SUPERVISED`, `SUPERVISED_APPROVAL_PENDING`, or `SUPERVISED_APPROVAL_DENIED`.
63
+ *
64
+ * @since 0.0.1
65
+ * @example "abc123xyz"
66
+ */
67
+ installId?: string;
68
+ }
69
+
70
+ /**
71
+ * Status values reported by Google Play Age Signals.
72
+ *
73
+ * @since 0.0.1
74
+ */
75
+ export enum UserStatus {
76
+ /**
77
+ * The user is over 18 and their age has been verified by Google.
78
+ *
79
+ * @since 0.0.1
80
+ */
81
+ Verified = 'VERIFIED',
82
+ /**
83
+ * The user has a supervised Google Account managed by a guardian.
84
+ *
85
+ * Use `ageLower` and `ageUpper` to determine the user's age range.
86
+ *
87
+ * @since 0.0.1
88
+ */
89
+ Supervised = 'SUPERVISED',
90
+ /**
91
+ * The supervised user has pending significant changes awaiting guardian approval.
92
+ *
93
+ * Use `ageLower` and `ageUpper` to determine the user's age range and `mostRecentApprovalDate`
94
+ * to identify the most recent approved change.
95
+ *
96
+ * @since 0.0.1
97
+ */
98
+ SupervisedApprovalPending = 'SUPERVISED_APPROVAL_PENDING',
99
+ /**
100
+ * The supervised user's guardian denied one or more significant changes.
101
+ *
102
+ * Use `ageLower` and `ageUpper` to determine the user's age range and `mostRecentApprovalDate`
103
+ * to identify the last approved change.
104
+ *
105
+ * @since 0.0.1
106
+ */
107
+ SupervisedApprovalDenied = 'SUPERVISED_APPROVAL_DENIED',
108
+ /**
109
+ * The user is not verified or supervised in supported regions.
110
+ *
111
+ * You should prompt the user to resolve their status in the Play Store.
112
+ *
113
+ * @since 0.0.1
114
+ */
115
+ Unknown = 'UNKNOWN',
116
+ /**
117
+ * All other users return this value.
118
+ *
119
+ * @since 0.0.1
120
+ */
121
+ Empty = 'EMPTY',
122
+ }
123
+
124
+ /**
125
+ * Error codes representing failures returned by the Play Age Signals API.
126
+ *
127
+ * @since 0.0.1
128
+ */
129
+ export enum ErrorCode {
130
+ /**
131
+ * The Play Age Signals API is not available. The installed Play Store version might be outdated.
132
+ *
133
+ * @since 0.0.1
134
+ */
135
+ ApiNotAvailable = 'API_NOT_AVAILABLE',
136
+ /**
137
+ * No Play Store app was found on the device.
138
+ *
139
+ * @since 0.0.1
140
+ */
141
+ PlayStoreNotFound = 'PLAY_STORE_NOT_FOUND',
142
+ /**
143
+ * No network connection is currently available.
144
+ *
145
+ * @since 0.0.1
146
+ */
147
+ NetworkError = 'NETWORK_ERROR',
148
+ /**
149
+ * Google Play services is missing or too old.
150
+ *
151
+ * @since 0.0.1
152
+ */
153
+ PlayServicesNotFound = 'PLAY_SERVICES_NOT_FOUND',
154
+ /**
155
+ * The Play Store service binding failed.
156
+ *
157
+ * @since 0.0.1
158
+ */
159
+ CannotBindToService = 'CANNOT_BIND_TO_SERVICE',
160
+ /**
161
+ * The Play Store application needs to be updated.
162
+ *
163
+ * @since 0.0.1
164
+ */
165
+ PlayStoreVersionOutdated = 'PLAY_STORE_VERSION_OUTDATED',
166
+ /**
167
+ * Google Play services needs to be updated.
168
+ *
169
+ * @since 0.0.1
170
+ */
171
+ PlayServicesVersionOutdated = 'PLAY_SERVICES_VERSION_OUTDATED',
172
+ /**
173
+ * A transient error occurred on the client device.
174
+ *
175
+ * @since 0.0.1
176
+ */
177
+ ClientTransientError = 'CLIENT_TRANSIENT_ERROR',
178
+ /**
179
+ * The app was not installed through Google Play.
180
+ *
181
+ * @since 0.0.1
182
+ */
183
+ AppNotOwned = 'APP_NOT_OWNED',
184
+ /**
185
+ * An unknown internal error occurred.
186
+ *
187
+ * @since 0.0.1
188
+ */
189
+ InternalError = 'INTERNAL_ERROR',
190
+ }
191
+
192
+ /**
193
+ * @deprecated Permissions are not required for this plugin.
194
+ *
195
+ * @since 0.0.1
196
+ */
197
+ export type AgeSignalsPermissionState = PermissionState;
package/src/index.ts ADDED
@@ -0,0 +1,10 @@
1
+ import { registerPlugin } from '@capacitor/core';
2
+
3
+ import type { AgeSignalsPlugin } from './definitions';
4
+
5
+ const AgeSignals = registerPlugin<AgeSignalsPlugin>('AgeSignals', {
6
+ web: () => import('./web').then(m => new m.AgeSignalsWeb()),
7
+ });
8
+
9
+ export * from './definitions';
10
+ export { AgeSignals };
package/src/web.ts ADDED
@@ -0,0 +1,9 @@
1
+ import { WebPlugin } from '@capacitor/core';
2
+
3
+ import type { AgeSignalsPlugin, CheckAgeSignalsResult } from './definitions';
4
+
5
+ export class AgeSignalsWeb extends WebPlugin implements AgeSignalsPlugin {
6
+ async checkAgeSignals(): Promise<CheckAgeSignalsResult> {
7
+ throw this.unimplemented('checkAgeSignals is only available on Android.');
8
+ }
9
+ }