@byvik/capacitor-ump-consent 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +283 -2
- package/android/build.gradle +57 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/java/com/byvik/capacitor/umpconsent/FirebaseConsentMode.java +33 -0
- package/android/src/main/java/com/byvik/capacitor/umpconsent/UmpConsentPlugin.java +285 -0
- package/android/src/main/res/.gitkeep +0 -0
- package/dist/docs.json +369 -0
- package/dist/esm/definitions.d.ts +147 -0
- package/dist/esm/definitions.js +3 -0
- package/dist/esm/definitions.js.map +1 -0
- package/dist/esm/index.d.ts +4 -0
- package/dist/esm/index.js +7 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/web.d.ts +8 -0
- package/dist/esm/web.js +17 -0
- package/dist/esm/web.js.map +1 -0
- package/dist/plugin.cjs.js +31 -0
- package/dist/plugin.cjs.js.map +1 -0
- package/dist/plugin.js +34 -0
- package/dist/plugin.js.map +1 -0
- package/package.json +79 -4
|
File without changes
|
package/dist/docs.json
ADDED
|
@@ -0,0 +1,369 @@
|
|
|
1
|
+
{
|
|
2
|
+
"api": {
|
|
3
|
+
"name": "UmpConsentPlugin",
|
|
4
|
+
"slug": "umpconsentplugin",
|
|
5
|
+
"docs": "",
|
|
6
|
+
"tags": [],
|
|
7
|
+
"methods": [
|
|
8
|
+
{
|
|
9
|
+
"name": "requestConsent",
|
|
10
|
+
"signature": "(options?: RequestConsentOptions | undefined) => Promise<ConsentState>",
|
|
11
|
+
"parameters": [
|
|
12
|
+
{
|
|
13
|
+
"name": "options",
|
|
14
|
+
"docs": "",
|
|
15
|
+
"type": "RequestConsentOptions | undefined"
|
|
16
|
+
}
|
|
17
|
+
],
|
|
18
|
+
"returns": "Promise<ConsentState>",
|
|
19
|
+
"tags": [
|
|
20
|
+
{
|
|
21
|
+
"name": "since",
|
|
22
|
+
"text": "0.1.0"
|
|
23
|
+
}
|
|
24
|
+
],
|
|
25
|
+
"docs": "Update the consent information and show the consent form if it is\nrequired. Call it on every app launch, before initializing any ads SDK.\n\nNever rejects: when the request or the form fails it resolves with the\nstored state and an `error` message.",
|
|
26
|
+
"complexTypes": [
|
|
27
|
+
"ConsentState",
|
|
28
|
+
"RequestConsentOptions"
|
|
29
|
+
],
|
|
30
|
+
"slug": "requestconsent"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"name": "showPrivacyOptionsForm",
|
|
34
|
+
"signature": "() => Promise<ConsentState>",
|
|
35
|
+
"parameters": [],
|
|
36
|
+
"returns": "Promise<ConsentState>",
|
|
37
|
+
"tags": [
|
|
38
|
+
{
|
|
39
|
+
"name": "since",
|
|
40
|
+
"text": "0.1.0"
|
|
41
|
+
}
|
|
42
|
+
],
|
|
43
|
+
"docs": "Show the privacy options form so the user can change their choice.\nOffer it when `privacyOptionsRequired` is `true`. Never rejects.",
|
|
44
|
+
"complexTypes": [
|
|
45
|
+
"ConsentState"
|
|
46
|
+
],
|
|
47
|
+
"slug": "showprivacyoptionsform"
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"name": "getConsentState",
|
|
51
|
+
"signature": "() => Promise<ConsentState>",
|
|
52
|
+
"parameters": [],
|
|
53
|
+
"returns": "Promise<ConsentState>",
|
|
54
|
+
"tags": [
|
|
55
|
+
{
|
|
56
|
+
"name": "since",
|
|
57
|
+
"text": "0.1.0"
|
|
58
|
+
}
|
|
59
|
+
],
|
|
60
|
+
"docs": "The stored consent state, without any network request or UI.\n\n`gdprApplies`, `purposeConsents` and `consentMode` are read from storage\nand are valid from the start. `status` and `canRequestAds` come from UMP,\nwhich reports `'unknown'` and `false` until `requestConsent()` has been\ncalled in the current launch.",
|
|
61
|
+
"complexTypes": [
|
|
62
|
+
"ConsentState"
|
|
63
|
+
],
|
|
64
|
+
"slug": "getconsentstate"
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"name": "reset",
|
|
68
|
+
"signature": "() => Promise<void>",
|
|
69
|
+
"parameters": [],
|
|
70
|
+
"returns": "Promise<void>",
|
|
71
|
+
"tags": [
|
|
72
|
+
{
|
|
73
|
+
"name": "since",
|
|
74
|
+
"text": "0.1.0"
|
|
75
|
+
}
|
|
76
|
+
],
|
|
77
|
+
"docs": "Forget the stored consent so the form shows again. For testing only.",
|
|
78
|
+
"complexTypes": [],
|
|
79
|
+
"slug": "reset"
|
|
80
|
+
}
|
|
81
|
+
],
|
|
82
|
+
"properties": []
|
|
83
|
+
},
|
|
84
|
+
"interfaces": [
|
|
85
|
+
{
|
|
86
|
+
"name": "ConsentState",
|
|
87
|
+
"slug": "consentstate",
|
|
88
|
+
"docs": "",
|
|
89
|
+
"tags": [],
|
|
90
|
+
"methods": [],
|
|
91
|
+
"properties": [
|
|
92
|
+
{
|
|
93
|
+
"name": "canRequestAds",
|
|
94
|
+
"tags": [
|
|
95
|
+
{
|
|
96
|
+
"text": "0.1.0",
|
|
97
|
+
"name": "since"
|
|
98
|
+
}
|
|
99
|
+
],
|
|
100
|
+
"docs": "Whether ads can be requested. Initialize your ads SDK only when this is\n`true`.",
|
|
101
|
+
"complexTypes": [],
|
|
102
|
+
"type": "boolean"
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
"name": "status",
|
|
106
|
+
"tags": [
|
|
107
|
+
{
|
|
108
|
+
"text": "0.1.0",
|
|
109
|
+
"name": "since"
|
|
110
|
+
}
|
|
111
|
+
],
|
|
112
|
+
"docs": "UMP's consent status.",
|
|
113
|
+
"complexTypes": [
|
|
114
|
+
"ConsentStatus"
|
|
115
|
+
],
|
|
116
|
+
"type": "ConsentStatus"
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
"name": "privacyOptionsRequired",
|
|
120
|
+
"tags": [
|
|
121
|
+
{
|
|
122
|
+
"text": "0.1.0",
|
|
123
|
+
"name": "since"
|
|
124
|
+
}
|
|
125
|
+
],
|
|
126
|
+
"docs": "Whether the app must offer a way to reopen the privacy options form, for\nexample a row in its settings screen that calls `showPrivacyOptionsForm()`.",
|
|
127
|
+
"complexTypes": [],
|
|
128
|
+
"type": "boolean"
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
"name": "gdprApplies",
|
|
132
|
+
"tags": [
|
|
133
|
+
{
|
|
134
|
+
"text": "0.1.0",
|
|
135
|
+
"name": "since"
|
|
136
|
+
}
|
|
137
|
+
],
|
|
138
|
+
"docs": "Whether GDPR applies to this user, as stored by UMP in `IABTCF_gdprApplies`.",
|
|
139
|
+
"complexTypes": [],
|
|
140
|
+
"type": "boolean"
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
"name": "purposeConsents",
|
|
144
|
+
"tags": [
|
|
145
|
+
{
|
|
146
|
+
"text": "0.1.0",
|
|
147
|
+
"name": "since"
|
|
148
|
+
}
|
|
149
|
+
],
|
|
150
|
+
"docs": "The raw `IABTCF_PurposeConsents` string: character `n - 1` is `'1'` when\nTCF purpose `n` is consented. Empty when there is none.",
|
|
151
|
+
"complexTypes": [],
|
|
152
|
+
"type": "string"
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
"name": "consentMode",
|
|
156
|
+
"tags": [
|
|
157
|
+
{
|
|
158
|
+
"text": "0.1.0",
|
|
159
|
+
"name": "since"
|
|
160
|
+
}
|
|
161
|
+
],
|
|
162
|
+
"docs": "The answer translated to Consent Mode v2. Everything is `false` until UMP\nknows whether this user has to be asked.",
|
|
163
|
+
"complexTypes": [
|
|
164
|
+
"ConsentModeSignals"
|
|
165
|
+
],
|
|
166
|
+
"type": "ConsentModeSignals"
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
"name": "error",
|
|
170
|
+
"tags": [
|
|
171
|
+
{
|
|
172
|
+
"text": "0.1.0",
|
|
173
|
+
"name": "since"
|
|
174
|
+
}
|
|
175
|
+
],
|
|
176
|
+
"docs": "Message of the error that interrupted the request or the form, if any.\nThe rest of the state is still valid: it reflects what UMP has stored.",
|
|
177
|
+
"complexTypes": [],
|
|
178
|
+
"type": "string | undefined"
|
|
179
|
+
}
|
|
180
|
+
]
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
"name": "ConsentModeSignals",
|
|
184
|
+
"slug": "consentmodesignals",
|
|
185
|
+
"docs": "",
|
|
186
|
+
"tags": [],
|
|
187
|
+
"methods": [],
|
|
188
|
+
"properties": [
|
|
189
|
+
{
|
|
190
|
+
"name": "analyticsStorage",
|
|
191
|
+
"tags": [
|
|
192
|
+
{
|
|
193
|
+
"text": "0.1.0",
|
|
194
|
+
"name": "since"
|
|
195
|
+
}
|
|
196
|
+
],
|
|
197
|
+
"docs": "",
|
|
198
|
+
"complexTypes": [],
|
|
199
|
+
"type": "boolean"
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
"name": "adStorage",
|
|
203
|
+
"tags": [
|
|
204
|
+
{
|
|
205
|
+
"text": "0.1.0",
|
|
206
|
+
"name": "since"
|
|
207
|
+
}
|
|
208
|
+
],
|
|
209
|
+
"docs": "",
|
|
210
|
+
"complexTypes": [],
|
|
211
|
+
"type": "boolean"
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
"name": "adUserData",
|
|
215
|
+
"tags": [
|
|
216
|
+
{
|
|
217
|
+
"text": "0.1.0",
|
|
218
|
+
"name": "since"
|
|
219
|
+
}
|
|
220
|
+
],
|
|
221
|
+
"docs": "",
|
|
222
|
+
"complexTypes": [],
|
|
223
|
+
"type": "boolean"
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
"name": "adPersonalization",
|
|
227
|
+
"tags": [
|
|
228
|
+
{
|
|
229
|
+
"text": "0.1.0",
|
|
230
|
+
"name": "since"
|
|
231
|
+
}
|
|
232
|
+
],
|
|
233
|
+
"docs": "",
|
|
234
|
+
"complexTypes": [],
|
|
235
|
+
"type": "boolean"
|
|
236
|
+
}
|
|
237
|
+
]
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
"name": "RequestConsentOptions",
|
|
241
|
+
"slug": "requestconsentoptions",
|
|
242
|
+
"docs": "",
|
|
243
|
+
"tags": [],
|
|
244
|
+
"methods": [],
|
|
245
|
+
"properties": [
|
|
246
|
+
{
|
|
247
|
+
"name": "tagForUnderAgeOfConsent",
|
|
248
|
+
"tags": [
|
|
249
|
+
{
|
|
250
|
+
"text": "false",
|
|
251
|
+
"name": "default"
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
"text": "0.1.0",
|
|
255
|
+
"name": "since"
|
|
256
|
+
}
|
|
257
|
+
],
|
|
258
|
+
"docs": "Tell UMP the user is under the age of consent.",
|
|
259
|
+
"complexTypes": [],
|
|
260
|
+
"type": "boolean | undefined"
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
"name": "debugGeography",
|
|
264
|
+
"tags": [
|
|
265
|
+
{
|
|
266
|
+
"text": "0.1.0",
|
|
267
|
+
"name": "since"
|
|
268
|
+
}
|
|
269
|
+
],
|
|
270
|
+
"docs": "Make a test device behave as if it were in this geography. Only applies to\ndevices listed in `testDeviceIds`.",
|
|
271
|
+
"complexTypes": [
|
|
272
|
+
"DebugGeography"
|
|
273
|
+
],
|
|
274
|
+
"type": "DebugGeography"
|
|
275
|
+
},
|
|
276
|
+
{
|
|
277
|
+
"name": "testDeviceIds",
|
|
278
|
+
"tags": [
|
|
279
|
+
{
|
|
280
|
+
"text": "0.1.0",
|
|
281
|
+
"name": "since"
|
|
282
|
+
}
|
|
283
|
+
],
|
|
284
|
+
"docs": "Hashed IDs of the test devices. UMP prints the ID of the current device to\nlogcat the first time consent is requested.",
|
|
285
|
+
"complexTypes": [],
|
|
286
|
+
"type": "string[] | undefined"
|
|
287
|
+
}
|
|
288
|
+
]
|
|
289
|
+
}
|
|
290
|
+
],
|
|
291
|
+
"enums": [],
|
|
292
|
+
"typeAliases": [
|
|
293
|
+
{
|
|
294
|
+
"name": "ConsentStatus",
|
|
295
|
+
"slug": "consentstatus",
|
|
296
|
+
"docs": "",
|
|
297
|
+
"types": [
|
|
298
|
+
{
|
|
299
|
+
"text": "'unknown'",
|
|
300
|
+
"complexTypes": []
|
|
301
|
+
},
|
|
302
|
+
{
|
|
303
|
+
"text": "'notRequired'",
|
|
304
|
+
"complexTypes": []
|
|
305
|
+
},
|
|
306
|
+
{
|
|
307
|
+
"text": "'required'",
|
|
308
|
+
"complexTypes": []
|
|
309
|
+
},
|
|
310
|
+
{
|
|
311
|
+
"text": "'obtained'",
|
|
312
|
+
"complexTypes": []
|
|
313
|
+
}
|
|
314
|
+
]
|
|
315
|
+
},
|
|
316
|
+
{
|
|
317
|
+
"name": "DebugGeography",
|
|
318
|
+
"slug": "debuggeography",
|
|
319
|
+
"docs": "",
|
|
320
|
+
"types": [
|
|
321
|
+
{
|
|
322
|
+
"text": "'disabled'",
|
|
323
|
+
"complexTypes": []
|
|
324
|
+
},
|
|
325
|
+
{
|
|
326
|
+
"text": "'eea'",
|
|
327
|
+
"complexTypes": []
|
|
328
|
+
},
|
|
329
|
+
{
|
|
330
|
+
"text": "'regulatedUsState'",
|
|
331
|
+
"complexTypes": []
|
|
332
|
+
},
|
|
333
|
+
{
|
|
334
|
+
"text": "'other'",
|
|
335
|
+
"complexTypes": []
|
|
336
|
+
}
|
|
337
|
+
]
|
|
338
|
+
}
|
|
339
|
+
],
|
|
340
|
+
"pluginConfigs": [
|
|
341
|
+
{
|
|
342
|
+
"name": "UmpConsent",
|
|
343
|
+
"slug": "umpconsent",
|
|
344
|
+
"properties": [
|
|
345
|
+
{
|
|
346
|
+
"name": "firebaseConsentMode",
|
|
347
|
+
"tags": [
|
|
348
|
+
{
|
|
349
|
+
"text": "0.1.0",
|
|
350
|
+
"name": "since"
|
|
351
|
+
},
|
|
352
|
+
{
|
|
353
|
+
"text": "true",
|
|
354
|
+
"name": "default"
|
|
355
|
+
},
|
|
356
|
+
{
|
|
357
|
+
"text": "false",
|
|
358
|
+
"name": "example"
|
|
359
|
+
}
|
|
360
|
+
],
|
|
361
|
+
"docs": "Apply the consent to Firebase Analytics (Consent Mode v2) every time\nthe consent is requested or changed. Has no effect in apps that do not\ninclude Firebase Analytics.\n\nSet it to `false` if you apply Consent Mode yourself from\n`ConsentState.consentMode`.",
|
|
362
|
+
"complexTypes": [],
|
|
363
|
+
"type": "boolean | undefined"
|
|
364
|
+
}
|
|
365
|
+
],
|
|
366
|
+
"docs": ""
|
|
367
|
+
}
|
|
368
|
+
]
|
|
369
|
+
}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
declare module '@capacitor/cli' {
|
|
2
|
+
interface PluginsConfig {
|
|
3
|
+
UmpConsent?: {
|
|
4
|
+
/**
|
|
5
|
+
* Apply the consent to Firebase Analytics (Consent Mode v2) every time
|
|
6
|
+
* the consent is requested or changed. Has no effect in apps that do not
|
|
7
|
+
* include Firebase Analytics.
|
|
8
|
+
*
|
|
9
|
+
* Set it to `false` if you apply Consent Mode yourself from
|
|
10
|
+
* `ConsentState.consentMode`.
|
|
11
|
+
*
|
|
12
|
+
* @since 0.1.0
|
|
13
|
+
* @default true
|
|
14
|
+
* @example false
|
|
15
|
+
*/
|
|
16
|
+
firebaseConsentMode?: boolean;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
export type ConsentStatus = 'unknown' | 'notRequired' | 'required' | 'obtained';
|
|
21
|
+
export type DebugGeography = 'disabled' | 'eea' | 'regulatedUsState' | 'other';
|
|
22
|
+
export interface RequestConsentOptions {
|
|
23
|
+
/**
|
|
24
|
+
* Tell UMP the user is under the age of consent.
|
|
25
|
+
*
|
|
26
|
+
* @default false
|
|
27
|
+
* @since 0.1.0
|
|
28
|
+
*/
|
|
29
|
+
tagForUnderAgeOfConsent?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Make a test device behave as if it were in this geography. Only applies to
|
|
32
|
+
* devices listed in `testDeviceIds`.
|
|
33
|
+
*
|
|
34
|
+
* @since 0.1.0
|
|
35
|
+
*/
|
|
36
|
+
debugGeography?: DebugGeography;
|
|
37
|
+
/**
|
|
38
|
+
* Hashed IDs of the test devices. UMP prints the ID of the current device to
|
|
39
|
+
* logcat the first time consent is requested.
|
|
40
|
+
*
|
|
41
|
+
* @since 0.1.0
|
|
42
|
+
*/
|
|
43
|
+
testDeviceIds?: string[];
|
|
44
|
+
}
|
|
45
|
+
export interface ConsentModeSignals {
|
|
46
|
+
/**
|
|
47
|
+
* @since 0.1.0
|
|
48
|
+
*/
|
|
49
|
+
analyticsStorage: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* @since 0.1.0
|
|
52
|
+
*/
|
|
53
|
+
adStorage: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* @since 0.1.0
|
|
56
|
+
*/
|
|
57
|
+
adUserData: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* @since 0.1.0
|
|
60
|
+
*/
|
|
61
|
+
adPersonalization: boolean;
|
|
62
|
+
}
|
|
63
|
+
export interface ConsentState {
|
|
64
|
+
/**
|
|
65
|
+
* Whether ads can be requested. Initialize your ads SDK only when this is
|
|
66
|
+
* `true`.
|
|
67
|
+
*
|
|
68
|
+
* @since 0.1.0
|
|
69
|
+
*/
|
|
70
|
+
canRequestAds: boolean;
|
|
71
|
+
/**
|
|
72
|
+
* UMP's consent status.
|
|
73
|
+
*
|
|
74
|
+
* @since 0.1.0
|
|
75
|
+
*/
|
|
76
|
+
status: ConsentStatus;
|
|
77
|
+
/**
|
|
78
|
+
* Whether the app must offer a way to reopen the privacy options form, for
|
|
79
|
+
* example a row in its settings screen that calls `showPrivacyOptionsForm()`.
|
|
80
|
+
*
|
|
81
|
+
* @since 0.1.0
|
|
82
|
+
*/
|
|
83
|
+
privacyOptionsRequired: boolean;
|
|
84
|
+
/**
|
|
85
|
+
* Whether GDPR applies to this user, as stored by UMP in `IABTCF_gdprApplies`.
|
|
86
|
+
*
|
|
87
|
+
* @since 0.1.0
|
|
88
|
+
*/
|
|
89
|
+
gdprApplies: boolean;
|
|
90
|
+
/**
|
|
91
|
+
* The raw `IABTCF_PurposeConsents` string: character `n - 1` is `'1'` when
|
|
92
|
+
* TCF purpose `n` is consented. Empty when there is none.
|
|
93
|
+
*
|
|
94
|
+
* @since 0.1.0
|
|
95
|
+
*/
|
|
96
|
+
purposeConsents: string;
|
|
97
|
+
/**
|
|
98
|
+
* The answer translated to Consent Mode v2. Everything is `false` until UMP
|
|
99
|
+
* knows whether this user has to be asked.
|
|
100
|
+
*
|
|
101
|
+
* @since 0.1.0
|
|
102
|
+
*/
|
|
103
|
+
consentMode: ConsentModeSignals;
|
|
104
|
+
/**
|
|
105
|
+
* Message of the error that interrupted the request or the form, if any.
|
|
106
|
+
* The rest of the state is still valid: it reflects what UMP has stored.
|
|
107
|
+
*
|
|
108
|
+
* @since 0.1.0
|
|
109
|
+
*/
|
|
110
|
+
error?: string;
|
|
111
|
+
}
|
|
112
|
+
export interface UmpConsentPlugin {
|
|
113
|
+
/**
|
|
114
|
+
* Update the consent information and show the consent form if it is
|
|
115
|
+
* required. Call it on every app launch, before initializing any ads SDK.
|
|
116
|
+
*
|
|
117
|
+
* Never rejects: when the request or the form fails it resolves with the
|
|
118
|
+
* stored state and an `error` message.
|
|
119
|
+
*
|
|
120
|
+
* @since 0.1.0
|
|
121
|
+
*/
|
|
122
|
+
requestConsent(options?: RequestConsentOptions): Promise<ConsentState>;
|
|
123
|
+
/**
|
|
124
|
+
* Show the privacy options form so the user can change their choice.
|
|
125
|
+
* Offer it when `privacyOptionsRequired` is `true`. Never rejects.
|
|
126
|
+
*
|
|
127
|
+
* @since 0.1.0
|
|
128
|
+
*/
|
|
129
|
+
showPrivacyOptionsForm(): Promise<ConsentState>;
|
|
130
|
+
/**
|
|
131
|
+
* The stored consent state, without any network request or UI.
|
|
132
|
+
*
|
|
133
|
+
* `gdprApplies`, `purposeConsents` and `consentMode` are read from storage
|
|
134
|
+
* and are valid from the start. `status` and `canRequestAds` come from UMP,
|
|
135
|
+
* which reports `'unknown'` and `false` until `requestConsent()` has been
|
|
136
|
+
* called in the current launch.
|
|
137
|
+
*
|
|
138
|
+
* @since 0.1.0
|
|
139
|
+
*/
|
|
140
|
+
getConsentState(): Promise<ConsentState>;
|
|
141
|
+
/**
|
|
142
|
+
* Forget the stored consent so the form shows again. For testing only.
|
|
143
|
+
*
|
|
144
|
+
* @since 0.1.0
|
|
145
|
+
*/
|
|
146
|
+
reset(): Promise<void>;
|
|
147
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAAA,wCAAwC","sourcesContent":["/// <reference types=\"@capacitor/cli\" />\n\ndeclare module '@capacitor/cli' {\n export interface PluginsConfig {\n UmpConsent?: {\n /**\n * Apply the consent to Firebase Analytics (Consent Mode v2) every time\n * the consent is requested or changed. Has no effect in apps that do not\n * include Firebase Analytics.\n *\n * Set it to `false` if you apply Consent Mode yourself from\n * `ConsentState.consentMode`.\n *\n * @since 0.1.0\n * @default true\n * @example false\n */\n firebaseConsentMode?: boolean;\n };\n }\n}\n\nexport type ConsentStatus = 'unknown' | 'notRequired' | 'required' | 'obtained';\n\nexport type DebugGeography = 'disabled' | 'eea' | 'regulatedUsState' | 'other';\n\nexport interface RequestConsentOptions {\n /**\n * Tell UMP the user is under the age of consent.\n *\n * @default false\n * @since 0.1.0\n */\n tagForUnderAgeOfConsent?: boolean;\n\n /**\n * Make a test device behave as if it were in this geography. Only applies to\n * devices listed in `testDeviceIds`.\n *\n * @since 0.1.0\n */\n debugGeography?: DebugGeography;\n\n /**\n * Hashed IDs of the test devices. UMP prints the ID of the current device to\n * logcat the first time consent is requested.\n *\n * @since 0.1.0\n */\n testDeviceIds?: string[];\n}\n\nexport interface ConsentModeSignals {\n /**\n * @since 0.1.0\n */\n analyticsStorage: boolean;\n\n /**\n * @since 0.1.0\n */\n adStorage: boolean;\n\n /**\n * @since 0.1.0\n */\n adUserData: boolean;\n\n /**\n * @since 0.1.0\n */\n adPersonalization: boolean;\n}\n\nexport interface ConsentState {\n /**\n * Whether ads can be requested. Initialize your ads SDK only when this is\n * `true`.\n *\n * @since 0.1.0\n */\n canRequestAds: boolean;\n\n /**\n * UMP's consent status.\n *\n * @since 0.1.0\n */\n status: ConsentStatus;\n\n /**\n * Whether the app must offer a way to reopen the privacy options form, for\n * example a row in its settings screen that calls `showPrivacyOptionsForm()`.\n *\n * @since 0.1.0\n */\n privacyOptionsRequired: boolean;\n\n /**\n * Whether GDPR applies to this user, as stored by UMP in `IABTCF_gdprApplies`.\n *\n * @since 0.1.0\n */\n gdprApplies: boolean;\n\n /**\n * The raw `IABTCF_PurposeConsents` string: character `n - 1` is `'1'` when\n * TCF purpose `n` is consented. Empty when there is none.\n *\n * @since 0.1.0\n */\n purposeConsents: string;\n\n /**\n * The answer translated to Consent Mode v2. Everything is `false` until UMP\n * knows whether this user has to be asked.\n *\n * @since 0.1.0\n */\n consentMode: ConsentModeSignals;\n\n /**\n * Message of the error that interrupted the request or the form, if any.\n * The rest of the state is still valid: it reflects what UMP has stored.\n *\n * @since 0.1.0\n */\n error?: string;\n}\n\nexport interface UmpConsentPlugin {\n /**\n * Update the consent information and show the consent form if it is\n * required. Call it on every app launch, before initializing any ads SDK.\n *\n * Never rejects: when the request or the form fails it resolves with the\n * stored state and an `error` message.\n *\n * @since 0.1.0\n */\n requestConsent(options?: RequestConsentOptions): Promise<ConsentState>;\n\n /**\n * Show the privacy options form so the user can change their choice.\n * Offer it when `privacyOptionsRequired` is `true`. Never rejects.\n *\n * @since 0.1.0\n */\n showPrivacyOptionsForm(): Promise<ConsentState>;\n\n /**\n * The stored consent state, without any network request or UI.\n *\n * `gdprApplies`, `purposeConsents` and `consentMode` are read from storage\n * and are valid from the start. `status` and `canRequestAds` come from UMP,\n * which reports `'unknown'` and `false` until `requestConsent()` has been\n * called in the current launch.\n *\n * @since 0.1.0\n */\n getConsentState(): Promise<ConsentState>;\n\n /**\n * Forget the stored consent so the form shows again. For testing only.\n *\n * @since 0.1.0\n */\n reset(): Promise<void>;\n}\n"]}
|
|
@@ -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,EAAE,CAAC,IAAI,CAAC,CAAC,aAAa,EAAE,CAAC;CAC9D,CAAC,CAAC;AAEH,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,UAAU,EAAE,CAAC","sourcesContent":["import { registerPlugin } from '@capacitor/core';\n\nimport type { UmpConsentPlugin } from './definitions';\n\nconst UmpConsent = registerPlugin<UmpConsentPlugin>('UmpConsent', {\n web: () => import('./web').then((m) => new m.UmpConsentWeb()),\n});\n\nexport * from './definitions';\nexport { UmpConsent };\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { WebPlugin } from '@capacitor/core';
|
|
2
|
+
import type { ConsentState, UmpConsentPlugin } from './definitions';
|
|
3
|
+
export declare class UmpConsentWeb extends WebPlugin implements UmpConsentPlugin {
|
|
4
|
+
requestConsent(): Promise<ConsentState>;
|
|
5
|
+
showPrivacyOptionsForm(): Promise<ConsentState>;
|
|
6
|
+
getConsentState(): Promise<ConsentState>;
|
|
7
|
+
reset(): Promise<void>;
|
|
8
|
+
}
|
package/dist/esm/web.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { WebPlugin } from '@capacitor/core';
|
|
2
|
+
const UNAVAILABLE = 'UMP consent is only available on Android.';
|
|
3
|
+
export class UmpConsentWeb extends WebPlugin {
|
|
4
|
+
async requestConsent() {
|
|
5
|
+
throw this.unavailable(UNAVAILABLE);
|
|
6
|
+
}
|
|
7
|
+
async showPrivacyOptionsForm() {
|
|
8
|
+
throw this.unavailable(UNAVAILABLE);
|
|
9
|
+
}
|
|
10
|
+
async getConsentState() {
|
|
11
|
+
throw this.unavailable(UNAVAILABLE);
|
|
12
|
+
}
|
|
13
|
+
async reset() {
|
|
14
|
+
throw this.unavailable(UNAVAILABLE);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
//# 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,WAAW,GAAG,2CAA2C,CAAC;AAEhE,MAAM,OAAO,aAAc,SAAQ,SAAS;IAC1C,KAAK,CAAC,cAAc;QAClB,MAAM,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;IACtC,CAAC;IAED,KAAK,CAAC,sBAAsB;QAC1B,MAAM,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;IACtC,CAAC;IAED,KAAK,CAAC,eAAe;QACnB,MAAM,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;IACtC,CAAC;IAED,KAAK,CAAC,KAAK;QACT,MAAM,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;IACtC,CAAC;CACF","sourcesContent":["import { WebPlugin } from '@capacitor/core';\n\nimport type { ConsentState, UmpConsentPlugin } from './definitions';\n\nconst UNAVAILABLE = 'UMP consent is only available on Android.';\n\nexport class UmpConsentWeb extends WebPlugin implements UmpConsentPlugin {\n async requestConsent(): Promise<ConsentState> {\n throw this.unavailable(UNAVAILABLE);\n }\n\n async showPrivacyOptionsForm(): Promise<ConsentState> {\n throw this.unavailable(UNAVAILABLE);\n }\n\n async getConsentState(): Promise<ConsentState> {\n throw this.unavailable(UNAVAILABLE);\n }\n\n async reset(): Promise<void> {\n throw this.unavailable(UNAVAILABLE);\n }\n}\n"]}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var core = require('@capacitor/core');
|
|
4
|
+
|
|
5
|
+
const UmpConsent = core.registerPlugin('UmpConsent', {
|
|
6
|
+
web: () => Promise.resolve().then(function () { return web; }).then((m) => new m.UmpConsentWeb()),
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
const UNAVAILABLE = 'UMP consent is only available on Android.';
|
|
10
|
+
class UmpConsentWeb extends core.WebPlugin {
|
|
11
|
+
async requestConsent() {
|
|
12
|
+
throw this.unavailable(UNAVAILABLE);
|
|
13
|
+
}
|
|
14
|
+
async showPrivacyOptionsForm() {
|
|
15
|
+
throw this.unavailable(UNAVAILABLE);
|
|
16
|
+
}
|
|
17
|
+
async getConsentState() {
|
|
18
|
+
throw this.unavailable(UNAVAILABLE);
|
|
19
|
+
}
|
|
20
|
+
async reset() {
|
|
21
|
+
throw this.unavailable(UNAVAILABLE);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
var web = /*#__PURE__*/Object.freeze({
|
|
26
|
+
__proto__: null,
|
|
27
|
+
UmpConsentWeb: UmpConsentWeb
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
exports.UmpConsent = UmpConsent;
|
|
31
|
+
//# sourceMappingURL=plugin.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst UmpConsent = registerPlugin('UmpConsent', {\n web: () => import('./web').then((m) => new m.UmpConsentWeb()),\n});\nexport * from './definitions';\nexport { UmpConsent };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nconst UNAVAILABLE = 'UMP consent is only available on Android.';\nexport class UmpConsentWeb extends WebPlugin {\n async requestConsent() {\n throw this.unavailable(UNAVAILABLE);\n }\n async showPrivacyOptionsForm() {\n throw this.unavailable(UNAVAILABLE);\n }\n async getConsentState() {\n throw this.unavailable(UNAVAILABLE);\n }\n async reset() {\n throw this.unavailable(UNAVAILABLE);\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;AACK,MAAC,UAAU,GAAGA,mBAAc,CAAC,YAAY,EAAE;AAChD,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,aAAa,EAAE,CAAC;AACjE,CAAC;;ACFD,MAAM,WAAW,GAAG,2CAA2C;AACxD,MAAM,aAAa,SAASC,cAAS,CAAC;AAC7C,IAAI,MAAM,cAAc,GAAG;AAC3B,QAAQ,MAAM,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC;AAC3C,IAAI;AACJ,IAAI,MAAM,sBAAsB,GAAG;AACnC,QAAQ,MAAM,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC;AAC3C,IAAI;AACJ,IAAI,MAAM,eAAe,GAAG;AAC5B,QAAQ,MAAM,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC;AAC3C,IAAI;AACJ,IAAI,MAAM,KAAK,GAAG;AAClB,QAAQ,MAAM,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC;AAC3C,IAAI;AACJ;;;;;;;"}
|
package/dist/plugin.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
var capacitorUmpConsent = (function (exports, core) {
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
const UmpConsent = core.registerPlugin('UmpConsent', {
|
|
5
|
+
web: () => Promise.resolve().then(function () { return web; }).then((m) => new m.UmpConsentWeb()),
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
const UNAVAILABLE = 'UMP consent is only available on Android.';
|
|
9
|
+
class UmpConsentWeb extends core.WebPlugin {
|
|
10
|
+
async requestConsent() {
|
|
11
|
+
throw this.unavailable(UNAVAILABLE);
|
|
12
|
+
}
|
|
13
|
+
async showPrivacyOptionsForm() {
|
|
14
|
+
throw this.unavailable(UNAVAILABLE);
|
|
15
|
+
}
|
|
16
|
+
async getConsentState() {
|
|
17
|
+
throw this.unavailable(UNAVAILABLE);
|
|
18
|
+
}
|
|
19
|
+
async reset() {
|
|
20
|
+
throw this.unavailable(UNAVAILABLE);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
var web = /*#__PURE__*/Object.freeze({
|
|
25
|
+
__proto__: null,
|
|
26
|
+
UmpConsentWeb: UmpConsentWeb
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
exports.UmpConsent = UmpConsent;
|
|
30
|
+
|
|
31
|
+
return exports;
|
|
32
|
+
|
|
33
|
+
})({}, capacitorExports);
|
|
34
|
+
//# sourceMappingURL=plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst UmpConsent = registerPlugin('UmpConsent', {\n web: () => import('./web').then((m) => new m.UmpConsentWeb()),\n});\nexport * from './definitions';\nexport { UmpConsent };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nconst UNAVAILABLE = 'UMP consent is only available on Android.';\nexport class UmpConsentWeb extends WebPlugin {\n async requestConsent() {\n throw this.unavailable(UNAVAILABLE);\n }\n async showPrivacyOptionsForm() {\n throw this.unavailable(UNAVAILABLE);\n }\n async getConsentState() {\n throw this.unavailable(UNAVAILABLE);\n }\n async reset() {\n throw this.unavailable(UNAVAILABLE);\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;AACK,UAAC,UAAU,GAAGA,mBAAc,CAAC,YAAY,EAAE;IAChD,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,aAAa,EAAE,CAAC;IACjE,CAAC;;ICFD,MAAM,WAAW,GAAG,2CAA2C;IACxD,MAAM,aAAa,SAASC,cAAS,CAAC;IAC7C,IAAI,MAAM,cAAc,GAAG;IAC3B,QAAQ,MAAM,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC;IAC3C,IAAI;IACJ,IAAI,MAAM,sBAAsB,GAAG;IACnC,QAAQ,MAAM,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC;IAC3C,IAAI;IACJ,IAAI,MAAM,eAAe,GAAG;IAC5B,QAAQ,MAAM,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC;IAC3C,IAAI;IACJ,IAAI,MAAM,KAAK,GAAG;IAClB,QAAQ,MAAM,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC;IAC3C,IAAI;IACJ;;;;;;;;;;;"}
|