@globules-io/cordova-plugin-age-check 1.0.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 +21 -0
- package/README.md +52 -0
- package/package.json +44 -0
- package/plugin.xml +33 -0
- package/www/AgeCheck.js +51 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 globules.io
|
|
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,52 @@
|
|
|
1
|
+
# cordova-plugin-age-check
|
|
2
|
+
|
|
3
|
+
Unified cross-platform age verification plugin for Cordova.
|
|
4
|
+
This plugin acts as a **thin wrapper** that provides a consistent API for age verification on both Android and iOS.
|
|
5
|
+
|
|
6
|
+
## Features
|
|
7
|
+
|
|
8
|
+
- Single unified API: `AgeCheck.checkAge()`
|
|
9
|
+
- On **Android**: Uses [Google Play Age Signals API](https://github.com/globules-io/cordova-plugin-google-play-age)
|
|
10
|
+
- On **iOS**: Uses [Apple Declared Age Range API](https://github.com/globules-io/cordova-plugin-apple-age-check)
|
|
11
|
+
- Normalized `userStatus` values across platforms
|
|
12
|
+
- Simple and lightweight
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
cordova plugin add @globules-io/cordova-plugin-age-check
|
|
18
|
+
cordova plugin rm @globules-io/cordova-plugin-age-check
|
|
19
|
+
```
|
|
20
|
+
## Supported Platforms
|
|
21
|
+
|
|
22
|
+
Android (35+)
|
|
23
|
+
iOS (26+)
|
|
24
|
+
|
|
25
|
+
## JS API
|
|
26
|
+
```bash
|
|
27
|
+
AgeCheck.checkAge(
|
|
28
|
+
function(result) {
|
|
29
|
+
console.log("Age Check Result:", result);
|
|
30
|
+
|
|
31
|
+
switch (result.userStatus) {
|
|
32
|
+
case "VERIFIED":
|
|
33
|
+
case "DECLARED":
|
|
34
|
+
// Full access
|
|
35
|
+
break;
|
|
36
|
+
case "DECLINED":
|
|
37
|
+
case "SUPERVISED_APPROVAL_DENIED":
|
|
38
|
+
// Restricted mode
|
|
39
|
+
break;
|
|
40
|
+
default:
|
|
41
|
+
// Unknown or fallback
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
function(error) {
|
|
45
|
+
console.error("Age check failed:", error);
|
|
46
|
+
}
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
AgeCheck.isSupported(function(supported) {
|
|
50
|
+
console.log("AgeCheck supported:", supported);
|
|
51
|
+
});
|
|
52
|
+
```
|
package/package.json
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@globules-io/cordova-plugin-age-check",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Unified cross-platform age verification plugin for Cordova. Uses Google Play Age Signals on Android and Apple's Declared Age Range on iOS.",
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "Globules.io"
|
|
7
|
+
},
|
|
8
|
+
"license": "MIT",
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "https://github.com/globules-io/cordova-plugin-age-check.git"
|
|
12
|
+
},
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/globules-io/cordova-plugin-age-check/issues"
|
|
15
|
+
},
|
|
16
|
+
"homepage": "https://github.com/globules-io/cordova-plugin-age-check#readme",
|
|
17
|
+
"keywords": [
|
|
18
|
+
"ecosystem:cordova",
|
|
19
|
+
"cordova",
|
|
20
|
+
"cordova-android",
|
|
21
|
+
"cordova-ios",
|
|
22
|
+
"age",
|
|
23
|
+
"age-verification",
|
|
24
|
+
"age-check",
|
|
25
|
+
"age-signals",
|
|
26
|
+
"play-age-signals",
|
|
27
|
+
"declared-age-range",
|
|
28
|
+
"declaredagerange"
|
|
29
|
+
],
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"@globules-io/cordova-plugin-google-play-age": "*",
|
|
32
|
+
"@globules-io/cordova-plugin-apple-age-check": "*"
|
|
33
|
+
},
|
|
34
|
+
"cordova": {
|
|
35
|
+
"id": "@globules-io/cordova-plugin-age-check",
|
|
36
|
+
"platforms": [
|
|
37
|
+
"android",
|
|
38
|
+
"ios"
|
|
39
|
+
]
|
|
40
|
+
},
|
|
41
|
+
"engines": {
|
|
42
|
+
"cordova": ">=10.0.0"
|
|
43
|
+
}
|
|
44
|
+
}
|
package/plugin.xml
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
|
|
3
|
+
id="@globules-io/cordova-plugin-age-check"
|
|
4
|
+
version="1.0.0">
|
|
5
|
+
<name>AgeCheck</name>
|
|
6
|
+
<description>Unified age verification plugin. Routes to Google Play Age Signals on Android and Apple Declared Age Range on iOS.</description>
|
|
7
|
+
<license>MIT</license>
|
|
8
|
+
<keywords>cordova,age,verification,google,apple</keywords>
|
|
9
|
+
<author email="info@globules.io">globules.io</author>
|
|
10
|
+
<repository url="https://github.com/globules-io/cordova-plugin-age-check.git" />
|
|
11
|
+
<engines>
|
|
12
|
+
<engine name="cordova" version=">=10.0.0" />
|
|
13
|
+
</engines>
|
|
14
|
+
<dependency id="@globules-io/cordova-plugin-google-play-age" version="*" />
|
|
15
|
+
<dependency id="@globules-io/cordova-plugin-apple-age-check" version="*" />
|
|
16
|
+
<platform name="android">
|
|
17
|
+
<config-file target="res/xml/config.xml" parent="/*">
|
|
18
|
+
<feature name="AgeCheck">
|
|
19
|
+
<param name="android-package" value="io.globules.cordova.googleplayage.AgeSignalsPlugin" />
|
|
20
|
+
</feature>
|
|
21
|
+
</config-file>
|
|
22
|
+
</platform>
|
|
23
|
+
<platform name="ios">
|
|
24
|
+
<config-file target="config.xml" parent="/widget">
|
|
25
|
+
<feature name="AgeCheck">
|
|
26
|
+
<param name="ios-package" value="AgeCheckPlugin" />
|
|
27
|
+
</feature>
|
|
28
|
+
</config-file>
|
|
29
|
+
</platform>
|
|
30
|
+
<js-module src="www/AgeCheck.js" name="AgeCheck">
|
|
31
|
+
<clobbers target="AgeCheck" />
|
|
32
|
+
</js-module>
|
|
33
|
+
</plugin>
|
package/www/AgeCheck.js
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
var exec = require('cordova/exec');
|
|
2
|
+
var AgeCheck = {};
|
|
3
|
+
/**
|
|
4
|
+
* Check age verification status.
|
|
5
|
+
*
|
|
6
|
+
* On Android → calls AgeSignalsPlugin.checkAgeSignals
|
|
7
|
+
* On iOS → calls AgeCheckPlugin.checkAge
|
|
8
|
+
*/
|
|
9
|
+
AgeCheck.checkAge = function(successCallback, errorCallback) {
|
|
10
|
+
if (typeof successCallback !== 'function') {
|
|
11
|
+
console.warn('AgeCheck.checkAge: successCallback is required');
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
if (typeof errorCallback !== 'function') {
|
|
15
|
+
errorCallback = function(err) {
|
|
16
|
+
console.error('AgeCheck error:', err);
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
const platform = cordova.platformId;
|
|
20
|
+
let serviceName = 'AgeCheck';
|
|
21
|
+
let actionName = 'checkAge';
|
|
22
|
+
if (platform === 'android') {
|
|
23
|
+
serviceName = 'AgeSignalsPlugin'; // Use the actual service name from Android plugin
|
|
24
|
+
actionName = 'checkAgeSignals';
|
|
25
|
+
}
|
|
26
|
+
// On iOS we keep serviceName = 'AgeCheck' and actionName = 'checkAge'
|
|
27
|
+
exec(
|
|
28
|
+
successCallback,
|
|
29
|
+
errorCallback,
|
|
30
|
+
serviceName,
|
|
31
|
+
actionName,
|
|
32
|
+
[]
|
|
33
|
+
);
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Check if age verification is supported on this platform.
|
|
37
|
+
*/
|
|
38
|
+
AgeCheck.isSupported = function(successCallback, errorCallback) {
|
|
39
|
+
if (typeof successCallback !== 'function') return;
|
|
40
|
+
|
|
41
|
+
const platform = cordova.platformId;
|
|
42
|
+
|
|
43
|
+
if (platform === 'android') {
|
|
44
|
+
successCallback(true);
|
|
45
|
+
} else if (platform === 'ios') {
|
|
46
|
+
exec(successCallback, errorCallback || function(){}, 'AgeCheck', 'isSupported', []);
|
|
47
|
+
} else {
|
|
48
|
+
successCallback(false);
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
module.exports = AgeCheck;
|