@milkinteractive/react-native-age-range 1.0.4 → 1.0.6
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/README.md +125 -0
- package/ios/StoreAgeSignalsNativeModules.mm +37 -10
- package/ios/StoreAgeSignalsNativeModules.swift +237 -11
- package/lib/commonjs/index.js +186 -5
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/index.js +183 -5
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/src/index.d.ts +142 -5
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/index.tsx +221 -8
package/lib/commonjs/index.js
CHANGED
|
@@ -4,9 +4,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.getAndroidPlayAgeRangeStatus = getAndroidPlayAgeRangeStatus;
|
|
7
|
+
exports.getIOSKnownCommunicationHandles = getIOSKnownCommunicationHandles;
|
|
7
8
|
exports.isAndroidEligibleForAgeFeatures = isAndroidEligibleForAgeFeatures;
|
|
8
9
|
exports.isIOSEligibleForAgeFeatures = isIOSEligibleForAgeFeatures;
|
|
10
|
+
exports.requestIOSCommunicationPermission = requestIOSCommunicationPermission;
|
|
9
11
|
exports.requestIOSDeclaredAgeRange = requestIOSDeclaredAgeRange;
|
|
12
|
+
exports.requestIOSSignificantChangeApproval = requestIOSSignificantChangeApproval;
|
|
10
13
|
var _reactNative = require("react-native");
|
|
11
14
|
const LINKING_ERROR = `The package '@milkinteractive/react-native-age-range' doesn't seem to be linked. Make sure: \n\n` + _reactNative.Platform.select({
|
|
12
15
|
ios: "- You have run 'pod install'\n",
|
|
@@ -49,6 +52,45 @@ const StoreAgeSignalsNativeModules = _reactNative.NativeModules.StoreAgeSignalsN
|
|
|
49
52
|
|
|
50
53
|
// Eligibility Result
|
|
51
54
|
|
|
55
|
+
// ========== PERMISSIONKIT TYPES (iOS 26+) ==========
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Status of significant change approval request.
|
|
59
|
+
* - approved: Parent/guardian approved the change
|
|
60
|
+
* - denied: Parent/guardian denied the change
|
|
61
|
+
* - pending: Request has been sent, awaiting response
|
|
62
|
+
*/
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Result of significant change approval request.
|
|
66
|
+
*/
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Handle type for communication contacts.
|
|
70
|
+
* - phoneNumber: Phone number identifier
|
|
71
|
+
* - email: Email address identifier
|
|
72
|
+
* - custom: Custom identifier (username, handle, etc.)
|
|
73
|
+
*/
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Contact information for communication permission request.
|
|
77
|
+
*/
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Communication actions that can be requested.
|
|
81
|
+
* - message: Text/chat messaging
|
|
82
|
+
* - call: Voice calls
|
|
83
|
+
* - video: Video calls
|
|
84
|
+
*/
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Result of communication permission request.
|
|
88
|
+
*/
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Result of known handles check.
|
|
92
|
+
*/
|
|
93
|
+
|
|
52
94
|
/**
|
|
53
95
|
* Retrieves the age range declaration status from Google Play's Age Signals API.
|
|
54
96
|
* @platform android
|
|
@@ -64,12 +106,16 @@ function getAndroidPlayAgeRangeStatus(config) {
|
|
|
64
106
|
return StoreAgeSignalsNativeModules.getAndroidPlayAgeRangeStatus(config || {});
|
|
65
107
|
}
|
|
66
108
|
|
|
109
|
+
// Minimum iOS version required for DeclaredAgeRange API
|
|
110
|
+
const IOS_MIN_VERSION_DECLARED_AGE_RANGE = 26;
|
|
111
|
+
|
|
67
112
|
/**
|
|
68
113
|
* Requests age range declaration from iOS Declared Age Range API.
|
|
69
114
|
* @platform ios
|
|
70
|
-
* @param firstThresholdAge First age threshold (e.g., 13)
|
|
71
|
-
* @param secondThresholdAge Second age threshold (e.g., 17)
|
|
72
|
-
* @param thirdThresholdAge Third age threshold (e.g., 21)
|
|
115
|
+
* @param firstThresholdAge First age threshold (required, e.g., 13)
|
|
116
|
+
* @param secondThresholdAge Second age threshold (optional, e.g., 17)
|
|
117
|
+
* @param thirdThresholdAge Third age threshold (optional, e.g., 21)
|
|
118
|
+
* @remarks Requires iOS 26.0+. Returns error on older iOS versions.
|
|
73
119
|
*/
|
|
74
120
|
function requestIOSDeclaredAgeRange(firstThresholdAge, secondThresholdAge, thirdThresholdAge) {
|
|
75
121
|
if (_reactNative.Platform.OS !== 'ios') {
|
|
@@ -82,15 +128,31 @@ function requestIOSDeclaredAgeRange(firstThresholdAge, secondThresholdAge, third
|
|
|
82
128
|
error: 'This method is only available on iOS'
|
|
83
129
|
});
|
|
84
130
|
}
|
|
85
|
-
|
|
131
|
+
|
|
132
|
+
// Early return for iOS versions below 26 to prevent native bridge errors
|
|
133
|
+
const iosVersion = parseInt(String(_reactNative.Platform.Version), 10);
|
|
134
|
+
if (iosVersion < IOS_MIN_VERSION_DECLARED_AGE_RANGE) {
|
|
135
|
+
return Promise.resolve({
|
|
136
|
+
status: null,
|
|
137
|
+
lowerBound: null,
|
|
138
|
+
upperBound: null,
|
|
139
|
+
ageRangeDeclaration: null,
|
|
140
|
+
parentalControls: null,
|
|
141
|
+
error: `Requires iOS ${IOS_MIN_VERSION_DECLARED_AGE_RANGE}.0+. Current version: iOS ${iosVersion}`
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
return StoreAgeSignalsNativeModules.requestIOSDeclaredAgeRange(firstThresholdAge, secondThresholdAge ?? null, thirdThresholdAge ?? null);
|
|
86
145
|
}
|
|
87
146
|
|
|
147
|
+
// Minimum iOS version required for isEligibleForAgeFeatures API
|
|
148
|
+
const IOS_MIN_VERSION_ELIGIBLE_CHECK = 26;
|
|
149
|
+
|
|
88
150
|
/**
|
|
89
151
|
* Checks if the current user is eligible for age verification features on iOS.
|
|
90
152
|
* This determines if age checks need to be applied (e.g., user is in an applicable region like Texas).
|
|
91
153
|
* @platform ios
|
|
92
154
|
* @returns Promise<DeclaredAgeEligibilityResult> - Object containing isEligible boolean and error string
|
|
93
|
-
* @remarks Requires iOS 26.
|
|
155
|
+
* @remarks Requires iOS 26.2+. Returns isEligible: false with error message if not available.
|
|
94
156
|
*/
|
|
95
157
|
function isIOSEligibleForAgeFeatures() {
|
|
96
158
|
if (_reactNative.Platform.OS !== 'ios') {
|
|
@@ -99,6 +161,15 @@ function isIOSEligibleForAgeFeatures() {
|
|
|
99
161
|
error: 'This method is only available on iOS'
|
|
100
162
|
});
|
|
101
163
|
}
|
|
164
|
+
|
|
165
|
+
// Early return for iOS versions below 26 to prevent native bridge errors
|
|
166
|
+
const iosVersion = parseInt(String(_reactNative.Platform.Version), 10);
|
|
167
|
+
if (iosVersion < IOS_MIN_VERSION_ELIGIBLE_CHECK) {
|
|
168
|
+
return Promise.resolve({
|
|
169
|
+
isEligible: false,
|
|
170
|
+
error: `Requires iOS ${IOS_MIN_VERSION_ELIGIBLE_CHECK}.0+. Current version: iOS ${iosVersion}`
|
|
171
|
+
});
|
|
172
|
+
}
|
|
102
173
|
return StoreAgeSignalsNativeModules.isEligibleForAgeFeatures();
|
|
103
174
|
}
|
|
104
175
|
|
|
@@ -118,4 +189,114 @@ function isAndroidEligibleForAgeFeatures() {
|
|
|
118
189
|
}
|
|
119
190
|
return StoreAgeSignalsNativeModules.isEligibleForAgeFeatures();
|
|
120
191
|
}
|
|
192
|
+
|
|
193
|
+
// ========== PERMISSIONKIT FUNCTIONS (iOS 26+) ==========
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* Requests parental approval for significant app changes (iOS PermissionKit).
|
|
197
|
+
*
|
|
198
|
+
* Use this when `parentalControls.significantAppChangeApprovalRequired` is `true`
|
|
199
|
+
* from the `requestIOSDeclaredAgeRange()` response.
|
|
200
|
+
*
|
|
201
|
+
* This shows a system dialog to request parental consent for significant app updates.
|
|
202
|
+
* The parent/guardian will receive a notification via Messages.
|
|
203
|
+
*
|
|
204
|
+
* @platform ios
|
|
205
|
+
* @requires iOS 26.0+
|
|
206
|
+
* @returns Promise<SignificantChangeResult> - Contains status ('pending', 'approved', 'denied') and error
|
|
207
|
+
*
|
|
208
|
+
* @example
|
|
209
|
+
* ```typescript
|
|
210
|
+
* const ageResult = await requestIOSDeclaredAgeRange(13, 17, 21);
|
|
211
|
+
* if (ageResult.parentalControls?.significantAppChangeApprovalRequired) {
|
|
212
|
+
* const result = await requestIOSSignificantChangeApproval();
|
|
213
|
+
* if (result.status === 'pending') {
|
|
214
|
+
* // Request sent, await parent response
|
|
215
|
+
* }
|
|
216
|
+
* }
|
|
217
|
+
* ```
|
|
218
|
+
*/
|
|
219
|
+
function requestIOSSignificantChangeApproval() {
|
|
220
|
+
if (_reactNative.Platform.OS !== 'ios') {
|
|
221
|
+
return Promise.resolve({
|
|
222
|
+
status: null,
|
|
223
|
+
error: 'This method is only available on iOS'
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
return StoreAgeSignalsNativeModules.requestSignificantChangeApproval();
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* Requests permission for a child to communicate with specified contacts (iOS PermissionKit).
|
|
231
|
+
*
|
|
232
|
+
* Use this when `parentalControls.communicationLimits` is `true`
|
|
233
|
+
* from the `requestIOSDeclaredAgeRange()` response.
|
|
234
|
+
*
|
|
235
|
+
* This shows a system dialog requesting the parent/guardian to approve
|
|
236
|
+
* communication with the specified contacts. The request is sent via Messages.
|
|
237
|
+
*
|
|
238
|
+
* @platform ios
|
|
239
|
+
* @requires iOS 26.2+
|
|
240
|
+
* @param contacts - Array of contacts to request permission for
|
|
241
|
+
* @param actions - Optional array of communication actions (defaults to ['message'])
|
|
242
|
+
* @returns Promise<CommunicationPermissionResult> - Contains granted boolean and error
|
|
243
|
+
*
|
|
244
|
+
* @example
|
|
245
|
+
* ```typescript
|
|
246
|
+
* const ageResult = await requestIOSDeclaredAgeRange(13, 17, 21);
|
|
247
|
+
* if (ageResult.parentalControls?.communicationLimits) {
|
|
248
|
+
* const result = await requestIOSCommunicationPermission(
|
|
249
|
+
* [{ handle: 'friend@example.com', handleKind: 'email', displayName: 'School Friend' }],
|
|
250
|
+
* ['message', 'call']
|
|
251
|
+
* );
|
|
252
|
+
* }
|
|
253
|
+
* ```
|
|
254
|
+
*/
|
|
255
|
+
function requestIOSCommunicationPermission(contacts, actions) {
|
|
256
|
+
if (_reactNative.Platform.OS !== 'ios') {
|
|
257
|
+
return Promise.resolve({
|
|
258
|
+
granted: false,
|
|
259
|
+
error: 'This method is only available on iOS'
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
return StoreAgeSignalsNativeModules.requestCommunicationPermission(contacts, actions || ['message']);
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* Checks which handles are recognized by the system (known contacts) (iOS PermissionKit).
|
|
267
|
+
*
|
|
268
|
+
* Use this to determine which contacts are already approved before showing
|
|
269
|
+
* a communication permission request.
|
|
270
|
+
*
|
|
271
|
+
* @platform ios
|
|
272
|
+
* @requires iOS 26.2+
|
|
273
|
+
* @param handles - Array of handles to check
|
|
274
|
+
* @returns Promise<KnownHandlesResult> - Contains array of known handle values and error
|
|
275
|
+
*
|
|
276
|
+
* @example
|
|
277
|
+
* ```typescript
|
|
278
|
+
* const result = await getIOSKnownCommunicationHandles([
|
|
279
|
+
* { handle: 'user@example.com', handleKind: 'email' },
|
|
280
|
+
* { handle: 'gamer123', handleKind: 'custom' }
|
|
281
|
+
* ]);
|
|
282
|
+
*
|
|
283
|
+
* const unknownContacts = handles.filter(
|
|
284
|
+
* h => !result.knownHandles.includes(h.handle)
|
|
285
|
+
* );
|
|
286
|
+
*
|
|
287
|
+
* if (unknownContacts.length > 0) {
|
|
288
|
+
* // Request permission for unknown contacts
|
|
289
|
+
* await requestIOSCommunicationPermission(unknownContacts);
|
|
290
|
+
* }
|
|
291
|
+
* ```
|
|
292
|
+
*/
|
|
293
|
+
function getIOSKnownCommunicationHandles(handles) {
|
|
294
|
+
if (_reactNative.Platform.OS !== 'ios') {
|
|
295
|
+
return Promise.resolve({
|
|
296
|
+
knownHandles: [],
|
|
297
|
+
error: 'This method is only available on iOS'
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
return StoreAgeSignalsNativeModules.getKnownCommunicationHandles(handles);
|
|
301
|
+
}
|
|
121
302
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","LINKING_ERROR","Platform","select","ios","default","StoreAgeSignalsNativeModules","NativeModules","Proxy","get","Error","getAndroidPlayAgeRangeStatus","config","OS","Promise","resolve","installId","userStatus","error","requestIOSDeclaredAgeRange","firstThresholdAge","secondThresholdAge","thirdThresholdAge","status","lowerBound","upperBound","ageRangeDeclaration","parentalControls","isIOSEligibleForAgeFeatures","isEligible","isEligibleForAgeFeatures","isAndroidEligibleForAgeFeatures"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"names":["_reactNative","require","LINKING_ERROR","Platform","select","ios","default","StoreAgeSignalsNativeModules","NativeModules","Proxy","get","Error","getAndroidPlayAgeRangeStatus","config","OS","Promise","resolve","installId","userStatus","error","IOS_MIN_VERSION_DECLARED_AGE_RANGE","requestIOSDeclaredAgeRange","firstThresholdAge","secondThresholdAge","thirdThresholdAge","status","lowerBound","upperBound","ageRangeDeclaration","parentalControls","iosVersion","parseInt","String","Version","IOS_MIN_VERSION_ELIGIBLE_CHECK","isIOSEligibleForAgeFeatures","isEligible","isEligibleForAgeFeatures","isAndroidEligibleForAgeFeatures","requestIOSSignificantChangeApproval","requestSignificantChangeApproval","requestIOSCommunicationPermission","contacts","actions","granted","requestCommunicationPermission","getIOSKnownCommunicationHandles","handles","knownHandles","getKnownCommunicationHandles"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;;;;;;;;;;AAAA,IAAAA,YAAA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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASG,+BAA+BA,CAC7CC,OAA+B,EACF;EAC7B,IAAI5C,qBAAQ,CAACW,EAAE,KAAK,KAAK,EAAE;IACzB,OAAOC,OAAO,CAACC,OAAO,CAAC;MACrBgC,YAAY,EAAE,EAAE;MAChB7B,KAAK,EAAE;IACT,CAAC,CAAC;EACJ;EACA,OAAOZ,4BAA4B,CAAC0C,4BAA4B,CAACF,OAAO,CAAC;AAC3E","ignoreList":[]}
|
package/lib/module/index.js
CHANGED
|
@@ -42,6 +42,45 @@ const StoreAgeSignalsNativeModules = NativeModules.StoreAgeSignalsNativeModules
|
|
|
42
42
|
|
|
43
43
|
// Eligibility Result
|
|
44
44
|
|
|
45
|
+
// ========== PERMISSIONKIT TYPES (iOS 26+) ==========
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Status of significant change approval request.
|
|
49
|
+
* - approved: Parent/guardian approved the change
|
|
50
|
+
* - denied: Parent/guardian denied the change
|
|
51
|
+
* - pending: Request has been sent, awaiting response
|
|
52
|
+
*/
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Result of significant change approval request.
|
|
56
|
+
*/
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Handle type for communication contacts.
|
|
60
|
+
* - phoneNumber: Phone number identifier
|
|
61
|
+
* - email: Email address identifier
|
|
62
|
+
* - custom: Custom identifier (username, handle, etc.)
|
|
63
|
+
*/
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Contact information for communication permission request.
|
|
67
|
+
*/
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Communication actions that can be requested.
|
|
71
|
+
* - message: Text/chat messaging
|
|
72
|
+
* - call: Voice calls
|
|
73
|
+
* - video: Video calls
|
|
74
|
+
*/
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Result of communication permission request.
|
|
78
|
+
*/
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Result of known handles check.
|
|
82
|
+
*/
|
|
83
|
+
|
|
45
84
|
/**
|
|
46
85
|
* Retrieves the age range declaration status from Google Play's Age Signals API.
|
|
47
86
|
* @platform android
|
|
@@ -57,12 +96,16 @@ export function getAndroidPlayAgeRangeStatus(config) {
|
|
|
57
96
|
return StoreAgeSignalsNativeModules.getAndroidPlayAgeRangeStatus(config || {});
|
|
58
97
|
}
|
|
59
98
|
|
|
99
|
+
// Minimum iOS version required for DeclaredAgeRange API
|
|
100
|
+
const IOS_MIN_VERSION_DECLARED_AGE_RANGE = 26;
|
|
101
|
+
|
|
60
102
|
/**
|
|
61
103
|
* Requests age range declaration from iOS Declared Age Range API.
|
|
62
104
|
* @platform ios
|
|
63
|
-
* @param firstThresholdAge First age threshold (e.g., 13)
|
|
64
|
-
* @param secondThresholdAge Second age threshold (e.g., 17)
|
|
65
|
-
* @param thirdThresholdAge Third age threshold (e.g., 21)
|
|
105
|
+
* @param firstThresholdAge First age threshold (required, e.g., 13)
|
|
106
|
+
* @param secondThresholdAge Second age threshold (optional, e.g., 17)
|
|
107
|
+
* @param thirdThresholdAge Third age threshold (optional, e.g., 21)
|
|
108
|
+
* @remarks Requires iOS 26.0+. Returns error on older iOS versions.
|
|
66
109
|
*/
|
|
67
110
|
export function requestIOSDeclaredAgeRange(firstThresholdAge, secondThresholdAge, thirdThresholdAge) {
|
|
68
111
|
if (Platform.OS !== 'ios') {
|
|
@@ -75,15 +118,31 @@ export function requestIOSDeclaredAgeRange(firstThresholdAge, secondThresholdAge
|
|
|
75
118
|
error: 'This method is only available on iOS'
|
|
76
119
|
});
|
|
77
120
|
}
|
|
78
|
-
|
|
121
|
+
|
|
122
|
+
// Early return for iOS versions below 26 to prevent native bridge errors
|
|
123
|
+
const iosVersion = parseInt(String(Platform.Version), 10);
|
|
124
|
+
if (iosVersion < IOS_MIN_VERSION_DECLARED_AGE_RANGE) {
|
|
125
|
+
return Promise.resolve({
|
|
126
|
+
status: null,
|
|
127
|
+
lowerBound: null,
|
|
128
|
+
upperBound: null,
|
|
129
|
+
ageRangeDeclaration: null,
|
|
130
|
+
parentalControls: null,
|
|
131
|
+
error: `Requires iOS ${IOS_MIN_VERSION_DECLARED_AGE_RANGE}.0+. Current version: iOS ${iosVersion}`
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
return StoreAgeSignalsNativeModules.requestIOSDeclaredAgeRange(firstThresholdAge, secondThresholdAge ?? null, thirdThresholdAge ?? null);
|
|
79
135
|
}
|
|
80
136
|
|
|
137
|
+
// Minimum iOS version required for isEligibleForAgeFeatures API
|
|
138
|
+
const IOS_MIN_VERSION_ELIGIBLE_CHECK = 26;
|
|
139
|
+
|
|
81
140
|
/**
|
|
82
141
|
* Checks if the current user is eligible for age verification features on iOS.
|
|
83
142
|
* This determines if age checks need to be applied (e.g., user is in an applicable region like Texas).
|
|
84
143
|
* @platform ios
|
|
85
144
|
* @returns Promise<DeclaredAgeEligibilityResult> - Object containing isEligible boolean and error string
|
|
86
|
-
* @remarks Requires iOS 26.
|
|
145
|
+
* @remarks Requires iOS 26.2+. Returns isEligible: false with error message if not available.
|
|
87
146
|
*/
|
|
88
147
|
export function isIOSEligibleForAgeFeatures() {
|
|
89
148
|
if (Platform.OS !== 'ios') {
|
|
@@ -92,6 +151,15 @@ export function isIOSEligibleForAgeFeatures() {
|
|
|
92
151
|
error: 'This method is only available on iOS'
|
|
93
152
|
});
|
|
94
153
|
}
|
|
154
|
+
|
|
155
|
+
// Early return for iOS versions below 26 to prevent native bridge errors
|
|
156
|
+
const iosVersion = parseInt(String(Platform.Version), 10);
|
|
157
|
+
if (iosVersion < IOS_MIN_VERSION_ELIGIBLE_CHECK) {
|
|
158
|
+
return Promise.resolve({
|
|
159
|
+
isEligible: false,
|
|
160
|
+
error: `Requires iOS ${IOS_MIN_VERSION_ELIGIBLE_CHECK}.0+. Current version: iOS ${iosVersion}`
|
|
161
|
+
});
|
|
162
|
+
}
|
|
95
163
|
return StoreAgeSignalsNativeModules.isEligibleForAgeFeatures();
|
|
96
164
|
}
|
|
97
165
|
|
|
@@ -111,4 +179,114 @@ export function isAndroidEligibleForAgeFeatures() {
|
|
|
111
179
|
}
|
|
112
180
|
return StoreAgeSignalsNativeModules.isEligibleForAgeFeatures();
|
|
113
181
|
}
|
|
182
|
+
|
|
183
|
+
// ========== PERMISSIONKIT FUNCTIONS (iOS 26+) ==========
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Requests parental approval for significant app changes (iOS PermissionKit).
|
|
187
|
+
*
|
|
188
|
+
* Use this when `parentalControls.significantAppChangeApprovalRequired` is `true`
|
|
189
|
+
* from the `requestIOSDeclaredAgeRange()` response.
|
|
190
|
+
*
|
|
191
|
+
* This shows a system dialog to request parental consent for significant app updates.
|
|
192
|
+
* The parent/guardian will receive a notification via Messages.
|
|
193
|
+
*
|
|
194
|
+
* @platform ios
|
|
195
|
+
* @requires iOS 26.0+
|
|
196
|
+
* @returns Promise<SignificantChangeResult> - Contains status ('pending', 'approved', 'denied') and error
|
|
197
|
+
*
|
|
198
|
+
* @example
|
|
199
|
+
* ```typescript
|
|
200
|
+
* const ageResult = await requestIOSDeclaredAgeRange(13, 17, 21);
|
|
201
|
+
* if (ageResult.parentalControls?.significantAppChangeApprovalRequired) {
|
|
202
|
+
* const result = await requestIOSSignificantChangeApproval();
|
|
203
|
+
* if (result.status === 'pending') {
|
|
204
|
+
* // Request sent, await parent response
|
|
205
|
+
* }
|
|
206
|
+
* }
|
|
207
|
+
* ```
|
|
208
|
+
*/
|
|
209
|
+
export function requestIOSSignificantChangeApproval() {
|
|
210
|
+
if (Platform.OS !== 'ios') {
|
|
211
|
+
return Promise.resolve({
|
|
212
|
+
status: null,
|
|
213
|
+
error: 'This method is only available on iOS'
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
return StoreAgeSignalsNativeModules.requestSignificantChangeApproval();
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* Requests permission for a child to communicate with specified contacts (iOS PermissionKit).
|
|
221
|
+
*
|
|
222
|
+
* Use this when `parentalControls.communicationLimits` is `true`
|
|
223
|
+
* from the `requestIOSDeclaredAgeRange()` response.
|
|
224
|
+
*
|
|
225
|
+
* This shows a system dialog requesting the parent/guardian to approve
|
|
226
|
+
* communication with the specified contacts. The request is sent via Messages.
|
|
227
|
+
*
|
|
228
|
+
* @platform ios
|
|
229
|
+
* @requires iOS 26.2+
|
|
230
|
+
* @param contacts - Array of contacts to request permission for
|
|
231
|
+
* @param actions - Optional array of communication actions (defaults to ['message'])
|
|
232
|
+
* @returns Promise<CommunicationPermissionResult> - Contains granted boolean and error
|
|
233
|
+
*
|
|
234
|
+
* @example
|
|
235
|
+
* ```typescript
|
|
236
|
+
* const ageResult = await requestIOSDeclaredAgeRange(13, 17, 21);
|
|
237
|
+
* if (ageResult.parentalControls?.communicationLimits) {
|
|
238
|
+
* const result = await requestIOSCommunicationPermission(
|
|
239
|
+
* [{ handle: 'friend@example.com', handleKind: 'email', displayName: 'School Friend' }],
|
|
240
|
+
* ['message', 'call']
|
|
241
|
+
* );
|
|
242
|
+
* }
|
|
243
|
+
* ```
|
|
244
|
+
*/
|
|
245
|
+
export function requestIOSCommunicationPermission(contacts, actions) {
|
|
246
|
+
if (Platform.OS !== 'ios') {
|
|
247
|
+
return Promise.resolve({
|
|
248
|
+
granted: false,
|
|
249
|
+
error: 'This method is only available on iOS'
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
return StoreAgeSignalsNativeModules.requestCommunicationPermission(contacts, actions || ['message']);
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* Checks which handles are recognized by the system (known contacts) (iOS PermissionKit).
|
|
257
|
+
*
|
|
258
|
+
* Use this to determine which contacts are already approved before showing
|
|
259
|
+
* a communication permission request.
|
|
260
|
+
*
|
|
261
|
+
* @platform ios
|
|
262
|
+
* @requires iOS 26.2+
|
|
263
|
+
* @param handles - Array of handles to check
|
|
264
|
+
* @returns Promise<KnownHandlesResult> - Contains array of known handle values and error
|
|
265
|
+
*
|
|
266
|
+
* @example
|
|
267
|
+
* ```typescript
|
|
268
|
+
* const result = await getIOSKnownCommunicationHandles([
|
|
269
|
+
* { handle: 'user@example.com', handleKind: 'email' },
|
|
270
|
+
* { handle: 'gamer123', handleKind: 'custom' }
|
|
271
|
+
* ]);
|
|
272
|
+
*
|
|
273
|
+
* const unknownContacts = handles.filter(
|
|
274
|
+
* h => !result.knownHandles.includes(h.handle)
|
|
275
|
+
* );
|
|
276
|
+
*
|
|
277
|
+
* if (unknownContacts.length > 0) {
|
|
278
|
+
* // Request permission for unknown contacts
|
|
279
|
+
* await requestIOSCommunicationPermission(unknownContacts);
|
|
280
|
+
* }
|
|
281
|
+
* ```
|
|
282
|
+
*/
|
|
283
|
+
export function getIOSKnownCommunicationHandles(handles) {
|
|
284
|
+
if (Platform.OS !== 'ios') {
|
|
285
|
+
return Promise.resolve({
|
|
286
|
+
knownHandles: [],
|
|
287
|
+
error: 'This method is only available on iOS'
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
return StoreAgeSignalsNativeModules.getKnownCommunicationHandles(handles);
|
|
291
|
+
}
|
|
114
292
|
//# sourceMappingURL=index.js.map
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NativeModules","Platform","LINKING_ERROR","select","ios","default","StoreAgeSignalsNativeModules","Proxy","get","Error","getAndroidPlayAgeRangeStatus","config","OS","Promise","resolve","installId","userStatus","error","requestIOSDeclaredAgeRange","firstThresholdAge","secondThresholdAge","thirdThresholdAge","status","lowerBound","upperBound","ageRangeDeclaration","parentalControls","isIOSEligibleForAgeFeatures","isEligible","isEligibleForAgeFeatures","isAndroidEligibleForAgeFeatures"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SAASA,aAAa,EAAEC,QAAQ,QAAQ,cAAc;AAEtD,MAAMC,aAAa,GACjB,kGAAkG,GAClGD,QAAQ,CAACE,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;AAEjC,MAAMC,4BAA4B,GAAGN,aAAa,CAACM,4BAA4B,GAC3EN,aAAa,CAACM,4BAA4B,GAC1C,IAAIC,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACP,aAAa,CAAC;EAChC;AACF,CACF,CAAC;;AAEL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAkCA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAYA;AACA;AACA;;AA2BA;;
|
|
1
|
+
{"version":3,"names":["NativeModules","Platform","LINKING_ERROR","select","ios","default","StoreAgeSignalsNativeModules","Proxy","get","Error","getAndroidPlayAgeRangeStatus","config","OS","Promise","resolve","installId","userStatus","error","IOS_MIN_VERSION_DECLARED_AGE_RANGE","requestIOSDeclaredAgeRange","firstThresholdAge","secondThresholdAge","thirdThresholdAge","status","lowerBound","upperBound","ageRangeDeclaration","parentalControls","iosVersion","parseInt","String","Version","IOS_MIN_VERSION_ELIGIBLE_CHECK","isIOSEligibleForAgeFeatures","isEligible","isEligibleForAgeFeatures","isAndroidEligibleForAgeFeatures","requestIOSSignificantChangeApproval","requestSignificantChangeApproval","requestIOSCommunicationPermission","contacts","actions","granted","requestCommunicationPermission","getIOSKnownCommunicationHandles","handles","knownHandles","getKnownCommunicationHandles"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SAASA,aAAa,EAAEC,QAAQ,QAAQ,cAAc;AAEtD,MAAMC,aAAa,GACjB,kGAAkG,GAClGD,QAAQ,CAACE,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,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E;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,+BAA+BA,CAAA,EAA0C;EACvF,IAAInC,QAAQ,CAACW,EAAE,KAAK,SAAS,EAAE;IAC7B,OAAOC,OAAO,CAACC,OAAO,CAAC;MACrBoB,UAAU,EAAE,KAAK;MACjBjB,KAAK,EAAE;IACT,CAAC,CAAC;EACJ;EACA,OAAOX,4BAA4B,CAAC6B,wBAAwB,CAAC,CAAC;AAChE;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASE,mCAAmCA,CAAA,EAAqC;EACtF,IAAIpC,QAAQ,CAACW,EAAE,KAAK,KAAK,EAAE;IACzB,OAAOC,OAAO,CAACC,OAAO,CAAC;MACrBS,MAAM,EAAE,IAAI;MACZN,KAAK,EAAE;IACT,CAAC,CAAC;EACJ;EACA,OAAOX,4BAA4B,CAACgC,gCAAgC,CAAC,CAAC;AACxE;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,iCAAiCA,CAC/CC,QAAgC,EAChCC,OAA+B,EACS;EACxC,IAAIxC,QAAQ,CAACW,EAAE,KAAK,KAAK,EAAE;IACzB,OAAOC,OAAO,CAACC,OAAO,CAAC;MACrB4B,OAAO,EAAE,KAAK;MACdzB,KAAK,EAAE;IACT,CAAC,CAAC;EACJ;EACA,OAAOX,4BAA4B,CAACqC,8BAA8B,CAChEH,QAAQ,EACRC,OAAO,IAAI,CAAC,SAAS,CACvB,CAAC;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASG,+BAA+BA,CAC7CC,OAA+B,EACF;EAC7B,IAAI5C,QAAQ,CAACW,EAAE,KAAK,KAAK,EAAE;IACzB,OAAOC,OAAO,CAACC,OAAO,CAAC;MACrBgC,YAAY,EAAE,EAAE;MAChB7B,KAAK,EAAE;IACT,CAAC,CAAC;EACJ;EACA,OAAOX,4BAA4B,CAACyC,4BAA4B,CAACF,OAAO,CAAC;AAC3E","ignoreList":[]}
|
|
@@ -75,6 +75,61 @@ export interface DeclaredAgeEligibilityResult {
|
|
|
75
75
|
isEligible: boolean;
|
|
76
76
|
error: string | null;
|
|
77
77
|
}
|
|
78
|
+
/**
|
|
79
|
+
* Status of significant change approval request.
|
|
80
|
+
* - approved: Parent/guardian approved the change
|
|
81
|
+
* - denied: Parent/guardian denied the change
|
|
82
|
+
* - pending: Request has been sent, awaiting response
|
|
83
|
+
*/
|
|
84
|
+
export type SignificantChangeStatus = 'approved' | 'denied' | 'pending' | null;
|
|
85
|
+
/**
|
|
86
|
+
* Result of significant change approval request.
|
|
87
|
+
*/
|
|
88
|
+
export interface SignificantChangeResult {
|
|
89
|
+
status: SignificantChangeStatus;
|
|
90
|
+
error: string | null;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Handle type for communication contacts.
|
|
94
|
+
* - phoneNumber: Phone number identifier
|
|
95
|
+
* - email: Email address identifier
|
|
96
|
+
* - custom: Custom identifier (username, handle, etc.)
|
|
97
|
+
*/
|
|
98
|
+
export type CommunicationHandleKind = 'phoneNumber' | 'email' | 'custom';
|
|
99
|
+
/**
|
|
100
|
+
* Contact information for communication permission request.
|
|
101
|
+
*/
|
|
102
|
+
export interface CommunicationContact {
|
|
103
|
+
/** Unique identifier (phone, email, username) */
|
|
104
|
+
handle: string;
|
|
105
|
+
/** Type of handle */
|
|
106
|
+
handleKind: CommunicationHandleKind;
|
|
107
|
+
/** Optional display name shown to parent/guardian */
|
|
108
|
+
displayName?: string;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Communication actions that can be requested.
|
|
112
|
+
* - message: Text/chat messaging
|
|
113
|
+
* - call: Voice calls
|
|
114
|
+
* - video: Video calls
|
|
115
|
+
*/
|
|
116
|
+
export type CommunicationAction = 'message' | 'call' | 'video';
|
|
117
|
+
/**
|
|
118
|
+
* Result of communication permission request.
|
|
119
|
+
*/
|
|
120
|
+
export interface CommunicationPermissionResult {
|
|
121
|
+
/** Whether the permission request was successfully shown */
|
|
122
|
+
granted: boolean;
|
|
123
|
+
error: string | null;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Result of known handles check.
|
|
127
|
+
*/
|
|
128
|
+
export interface KnownHandlesResult {
|
|
129
|
+
/** Handles that are recognized by the system (known contacts) */
|
|
130
|
+
knownHandles: string[];
|
|
131
|
+
error: string | null;
|
|
132
|
+
}
|
|
78
133
|
export interface AndroidAgeRangeConfig {
|
|
79
134
|
/**
|
|
80
135
|
* Enable mock mode to simulate results without calling Google Play API.
|
|
@@ -114,17 +169,18 @@ export declare function getAndroidPlayAgeRangeStatus(config?: AndroidAgeRangeCon
|
|
|
114
169
|
/**
|
|
115
170
|
* Requests age range declaration from iOS Declared Age Range API.
|
|
116
171
|
* @platform ios
|
|
117
|
-
* @param firstThresholdAge First age threshold (e.g., 13)
|
|
118
|
-
* @param secondThresholdAge Second age threshold (e.g., 17)
|
|
119
|
-
* @param thirdThresholdAge Third age threshold (e.g., 21)
|
|
172
|
+
* @param firstThresholdAge First age threshold (required, e.g., 13)
|
|
173
|
+
* @param secondThresholdAge Second age threshold (optional, e.g., 17)
|
|
174
|
+
* @param thirdThresholdAge Third age threshold (optional, e.g., 21)
|
|
175
|
+
* @remarks Requires iOS 26.0+. Returns error on older iOS versions.
|
|
120
176
|
*/
|
|
121
|
-
export declare function requestIOSDeclaredAgeRange(firstThresholdAge: number, secondThresholdAge
|
|
177
|
+
export declare function requestIOSDeclaredAgeRange(firstThresholdAge: number, secondThresholdAge?: number, thirdThresholdAge?: number): Promise<DeclaredAgeRangeResult>;
|
|
122
178
|
/**
|
|
123
179
|
* Checks if the current user is eligible for age verification features on iOS.
|
|
124
180
|
* This determines if age checks need to be applied (e.g., user is in an applicable region like Texas).
|
|
125
181
|
* @platform ios
|
|
126
182
|
* @returns Promise<DeclaredAgeEligibilityResult> - Object containing isEligible boolean and error string
|
|
127
|
-
* @remarks Requires iOS 26.
|
|
183
|
+
* @remarks Requires iOS 26.2+. Returns isEligible: false with error message if not available.
|
|
128
184
|
*/
|
|
129
185
|
export declare function isIOSEligibleForAgeFeatures(): Promise<DeclaredAgeEligibilityResult>;
|
|
130
186
|
/**
|
|
@@ -135,4 +191,85 @@ export declare function isIOSEligibleForAgeFeatures(): Promise<DeclaredAgeEligib
|
|
|
135
191
|
* @remarks Makes a lightweight API call to determine eligibility. Returns isEligible: false with error message if not available.
|
|
136
192
|
*/
|
|
137
193
|
export declare function isAndroidEligibleForAgeFeatures(): Promise<DeclaredAgeEligibilityResult>;
|
|
194
|
+
/**
|
|
195
|
+
* Requests parental approval for significant app changes (iOS PermissionKit).
|
|
196
|
+
*
|
|
197
|
+
* Use this when `parentalControls.significantAppChangeApprovalRequired` is `true`
|
|
198
|
+
* from the `requestIOSDeclaredAgeRange()` response.
|
|
199
|
+
*
|
|
200
|
+
* This shows a system dialog to request parental consent for significant app updates.
|
|
201
|
+
* The parent/guardian will receive a notification via Messages.
|
|
202
|
+
*
|
|
203
|
+
* @platform ios
|
|
204
|
+
* @requires iOS 26.0+
|
|
205
|
+
* @returns Promise<SignificantChangeResult> - Contains status ('pending', 'approved', 'denied') and error
|
|
206
|
+
*
|
|
207
|
+
* @example
|
|
208
|
+
* ```typescript
|
|
209
|
+
* const ageResult = await requestIOSDeclaredAgeRange(13, 17, 21);
|
|
210
|
+
* if (ageResult.parentalControls?.significantAppChangeApprovalRequired) {
|
|
211
|
+
* const result = await requestIOSSignificantChangeApproval();
|
|
212
|
+
* if (result.status === 'pending') {
|
|
213
|
+
* // Request sent, await parent response
|
|
214
|
+
* }
|
|
215
|
+
* }
|
|
216
|
+
* ```
|
|
217
|
+
*/
|
|
218
|
+
export declare function requestIOSSignificantChangeApproval(): Promise<SignificantChangeResult>;
|
|
219
|
+
/**
|
|
220
|
+
* Requests permission for a child to communicate with specified contacts (iOS PermissionKit).
|
|
221
|
+
*
|
|
222
|
+
* Use this when `parentalControls.communicationLimits` is `true`
|
|
223
|
+
* from the `requestIOSDeclaredAgeRange()` response.
|
|
224
|
+
*
|
|
225
|
+
* This shows a system dialog requesting the parent/guardian to approve
|
|
226
|
+
* communication with the specified contacts. The request is sent via Messages.
|
|
227
|
+
*
|
|
228
|
+
* @platform ios
|
|
229
|
+
* @requires iOS 26.2+
|
|
230
|
+
* @param contacts - Array of contacts to request permission for
|
|
231
|
+
* @param actions - Optional array of communication actions (defaults to ['message'])
|
|
232
|
+
* @returns Promise<CommunicationPermissionResult> - Contains granted boolean and error
|
|
233
|
+
*
|
|
234
|
+
* @example
|
|
235
|
+
* ```typescript
|
|
236
|
+
* const ageResult = await requestIOSDeclaredAgeRange(13, 17, 21);
|
|
237
|
+
* if (ageResult.parentalControls?.communicationLimits) {
|
|
238
|
+
* const result = await requestIOSCommunicationPermission(
|
|
239
|
+
* [{ handle: 'friend@example.com', handleKind: 'email', displayName: 'School Friend' }],
|
|
240
|
+
* ['message', 'call']
|
|
241
|
+
* );
|
|
242
|
+
* }
|
|
243
|
+
* ```
|
|
244
|
+
*/
|
|
245
|
+
export declare function requestIOSCommunicationPermission(contacts: CommunicationContact[], actions?: CommunicationAction[]): Promise<CommunicationPermissionResult>;
|
|
246
|
+
/**
|
|
247
|
+
* Checks which handles are recognized by the system (known contacts) (iOS PermissionKit).
|
|
248
|
+
*
|
|
249
|
+
* Use this to determine which contacts are already approved before showing
|
|
250
|
+
* a communication permission request.
|
|
251
|
+
*
|
|
252
|
+
* @platform ios
|
|
253
|
+
* @requires iOS 26.2+
|
|
254
|
+
* @param handles - Array of handles to check
|
|
255
|
+
* @returns Promise<KnownHandlesResult> - Contains array of known handle values and error
|
|
256
|
+
*
|
|
257
|
+
* @example
|
|
258
|
+
* ```typescript
|
|
259
|
+
* const result = await getIOSKnownCommunicationHandles([
|
|
260
|
+
* { handle: 'user@example.com', handleKind: 'email' },
|
|
261
|
+
* { handle: 'gamer123', handleKind: 'custom' }
|
|
262
|
+
* ]);
|
|
263
|
+
*
|
|
264
|
+
* const unknownContacts = handles.filter(
|
|
265
|
+
* h => !result.knownHandles.includes(h.handle)
|
|
266
|
+
* );
|
|
267
|
+
*
|
|
268
|
+
* if (unknownContacts.length > 0) {
|
|
269
|
+
* // Request permission for unknown contacts
|
|
270
|
+
* await requestIOSCommunicationPermission(unknownContacts);
|
|
271
|
+
* }
|
|
272
|
+
* ```
|
|
273
|
+
*/
|
|
274
|
+
export declare function getIOSKnownCommunicationHandles(handles: CommunicationContact[]): Promise<KnownHandlesResult>;
|
|
138
275
|
//# sourceMappingURL=index.d.ts.map
|