@capgo/capacitor-nfc 7.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/dist/docs.json ADDED
@@ -0,0 +1,499 @@
1
+ {
2
+ "api": {
3
+ "name": "CapacitorNfcPlugin",
4
+ "slug": "capacitornfcplugin",
5
+ "docs": "Public API surface for the Capacitor NFC plugin.\n\nThe interface intentionally mirrors the behaviour of the reference PhoneGap\nimplementation to ease migration while embracing idiomatic Capacitor APIs.",
6
+ "tags": [],
7
+ "methods": [
8
+ {
9
+ "name": "startScanning",
10
+ "signature": "(options?: StartScanningOptions | undefined) => Promise<void>",
11
+ "parameters": [
12
+ {
13
+ "name": "options",
14
+ "docs": "",
15
+ "type": "StartScanningOptions | undefined"
16
+ }
17
+ ],
18
+ "returns": "Promise<void>",
19
+ "tags": [],
20
+ "docs": "Starts listening for NFC tags.",
21
+ "complexTypes": [
22
+ "StartScanningOptions"
23
+ ],
24
+ "slug": "startscanning"
25
+ },
26
+ {
27
+ "name": "stopScanning",
28
+ "signature": "() => Promise<void>",
29
+ "parameters": [],
30
+ "returns": "Promise<void>",
31
+ "tags": [],
32
+ "docs": "Stops the ongoing NFC scanning session.",
33
+ "complexTypes": [],
34
+ "slug": "stopscanning"
35
+ },
36
+ {
37
+ "name": "write",
38
+ "signature": "(options: WriteTagOptions) => Promise<void>",
39
+ "parameters": [
40
+ {
41
+ "name": "options",
42
+ "docs": "",
43
+ "type": "WriteTagOptions"
44
+ }
45
+ ],
46
+ "returns": "Promise<void>",
47
+ "tags": [],
48
+ "docs": "Writes the provided NDEF records to the last discovered tag.",
49
+ "complexTypes": [
50
+ "WriteTagOptions"
51
+ ],
52
+ "slug": "write"
53
+ },
54
+ {
55
+ "name": "erase",
56
+ "signature": "() => Promise<void>",
57
+ "parameters": [],
58
+ "returns": "Promise<void>",
59
+ "tags": [],
60
+ "docs": "Attempts to erase the last discovered tag by writing an empty NDEF message.",
61
+ "complexTypes": [],
62
+ "slug": "erase"
63
+ },
64
+ {
65
+ "name": "makeReadOnly",
66
+ "signature": "() => Promise<void>",
67
+ "parameters": [],
68
+ "returns": "Promise<void>",
69
+ "tags": [],
70
+ "docs": "Attempts to make the last discovered tag read-only.",
71
+ "complexTypes": [],
72
+ "slug": "makereadonly"
73
+ },
74
+ {
75
+ "name": "share",
76
+ "signature": "(options: ShareTagOptions) => Promise<void>",
77
+ "parameters": [
78
+ {
79
+ "name": "options",
80
+ "docs": "",
81
+ "type": "ShareTagOptions"
82
+ }
83
+ ],
84
+ "returns": "Promise<void>",
85
+ "tags": [],
86
+ "docs": "Shares an NDEF message with another device via peer-to-peer (Android only).",
87
+ "complexTypes": [
88
+ "ShareTagOptions"
89
+ ],
90
+ "slug": "share"
91
+ },
92
+ {
93
+ "name": "unshare",
94
+ "signature": "() => Promise<void>",
95
+ "parameters": [],
96
+ "returns": "Promise<void>",
97
+ "tags": [],
98
+ "docs": "Stops sharing previously provided NDEF message (Android only).",
99
+ "complexTypes": [],
100
+ "slug": "unshare"
101
+ },
102
+ {
103
+ "name": "getStatus",
104
+ "signature": "() => Promise<{ status: NfcStatus; }>",
105
+ "parameters": [],
106
+ "returns": "Promise<{ status: NfcStatus; }>",
107
+ "tags": [],
108
+ "docs": "Returns the current NFC adapter status.",
109
+ "complexTypes": [
110
+ "NfcStatus"
111
+ ],
112
+ "slug": "getstatus"
113
+ },
114
+ {
115
+ "name": "showSettings",
116
+ "signature": "() => Promise<void>",
117
+ "parameters": [],
118
+ "returns": "Promise<void>",
119
+ "tags": [],
120
+ "docs": "Opens the system settings page where the user can enable NFC.",
121
+ "complexTypes": [],
122
+ "slug": "showsettings"
123
+ },
124
+ {
125
+ "name": "getPluginVersion",
126
+ "signature": "() => Promise<{ version: string; }>",
127
+ "parameters": [],
128
+ "returns": "Promise<{ version: string; }>",
129
+ "tags": [],
130
+ "docs": "Returns the version string baked into the native plugin.",
131
+ "complexTypes": [],
132
+ "slug": "getpluginversion"
133
+ },
134
+ {
135
+ "name": "addListener",
136
+ "signature": "(eventName: 'nfcEvent', listenerFunc: (event: NfcEvent) => void) => Promise<PluginListenerHandle>",
137
+ "parameters": [
138
+ {
139
+ "name": "eventName",
140
+ "docs": "",
141
+ "type": "'nfcEvent'"
142
+ },
143
+ {
144
+ "name": "listenerFunc",
145
+ "docs": "",
146
+ "type": "(event: NfcEvent) => void"
147
+ }
148
+ ],
149
+ "returns": "Promise<PluginListenerHandle>",
150
+ "tags": [],
151
+ "docs": "",
152
+ "complexTypes": [
153
+ "PluginListenerHandle",
154
+ "NfcEvent"
155
+ ],
156
+ "slug": "addlistenernfcevent-"
157
+ },
158
+ {
159
+ "name": "addListener",
160
+ "signature": "(eventName: 'tagDiscovered' | 'ndefDiscovered' | 'ndefMimeDiscovered' | 'ndefFormatableDiscovered', listenerFunc: (event: NfcEvent) => void) => Promise<PluginListenerHandle>",
161
+ "parameters": [
162
+ {
163
+ "name": "eventName",
164
+ "docs": "",
165
+ "type": "'tagDiscovered' | 'ndefDiscovered' | 'ndefMimeDiscovered' | 'ndefFormatableDiscovered'"
166
+ },
167
+ {
168
+ "name": "listenerFunc",
169
+ "docs": "",
170
+ "type": "(event: NfcEvent) => void"
171
+ }
172
+ ],
173
+ "returns": "Promise<PluginListenerHandle>",
174
+ "tags": [],
175
+ "docs": "",
176
+ "complexTypes": [
177
+ "PluginListenerHandle",
178
+ "NfcEvent"
179
+ ],
180
+ "slug": "addlistenertagdiscovered--ndefdiscovered--ndefmimediscovered--ndefformatablediscovered-"
181
+ },
182
+ {
183
+ "name": "addListener",
184
+ "signature": "(eventName: 'nfcStateChange', listenerFunc: (event: NfcStateChangeEvent) => void) => Promise<PluginListenerHandle>",
185
+ "parameters": [
186
+ {
187
+ "name": "eventName",
188
+ "docs": "",
189
+ "type": "'nfcStateChange'"
190
+ },
191
+ {
192
+ "name": "listenerFunc",
193
+ "docs": "",
194
+ "type": "(event: NfcStateChangeEvent) => void"
195
+ }
196
+ ],
197
+ "returns": "Promise<PluginListenerHandle>",
198
+ "tags": [],
199
+ "docs": "",
200
+ "complexTypes": [
201
+ "PluginListenerHandle",
202
+ "NfcStateChangeEvent"
203
+ ],
204
+ "slug": "addlistenernfcstatechange-"
205
+ }
206
+ ],
207
+ "properties": []
208
+ },
209
+ "interfaces": [
210
+ {
211
+ "name": "StartScanningOptions",
212
+ "slug": "startscanningoptions",
213
+ "docs": "Options controlling the behaviour of {@link CapacitorNfcPlugin.startScanning}.",
214
+ "tags": [],
215
+ "methods": [],
216
+ "properties": [
217
+ {
218
+ "name": "invalidateAfterFirstRead",
219
+ "tags": [],
220
+ "docs": "iOS-only: closes the NFC session automatically after the first successful tag read.\nDefaults to `true`.",
221
+ "complexTypes": [],
222
+ "type": "boolean | undefined"
223
+ },
224
+ {
225
+ "name": "alertMessage",
226
+ "tags": [],
227
+ "docs": "iOS-only: custom message displayed in the NFC system sheet while scanning.",
228
+ "complexTypes": [],
229
+ "type": "string | undefined"
230
+ },
231
+ {
232
+ "name": "androidReaderModeFlags",
233
+ "tags": [],
234
+ "docs": "Android-only: raw flags passed to `NfcAdapter.enableReaderMode`.\nDefaults to enabling all tag types with skipping NDEF checks.",
235
+ "complexTypes": [],
236
+ "type": "number | undefined"
237
+ }
238
+ ]
239
+ },
240
+ {
241
+ "name": "WriteTagOptions",
242
+ "slug": "writetagoptions",
243
+ "docs": "Options used when writing an NDEF message on the current tag.",
244
+ "tags": [],
245
+ "methods": [],
246
+ "properties": [
247
+ {
248
+ "name": "records",
249
+ "tags": [],
250
+ "docs": "Array of records that compose the NDEF message to be written.",
251
+ "complexTypes": [
252
+ "NdefRecord"
253
+ ],
254
+ "type": "NdefRecord[]"
255
+ },
256
+ {
257
+ "name": "allowFormat",
258
+ "tags": [],
259
+ "docs": "When `true`, the plugin attempts to format NDEF-formattable tags before writing.\nDefaults to `true`.",
260
+ "complexTypes": [],
261
+ "type": "boolean | undefined"
262
+ }
263
+ ]
264
+ },
265
+ {
266
+ "name": "NdefRecord",
267
+ "slug": "ndefrecord",
268
+ "docs": "JSON structure representing a single NDEF record.\n\nMirrors the data format returned by the legacy Cordova implementation and\nuses integer arrays instead of strings to preserve the original payload\nbytes.",
269
+ "tags": [],
270
+ "methods": [],
271
+ "properties": [
272
+ {
273
+ "name": "tnf",
274
+ "tags": [],
275
+ "docs": "Type Name Format identifier.",
276
+ "complexTypes": [],
277
+ "type": "number"
278
+ },
279
+ {
280
+ "name": "type",
281
+ "tags": [],
282
+ "docs": "Type field expressed as an array of byte values.",
283
+ "complexTypes": [],
284
+ "type": "number[]"
285
+ },
286
+ {
287
+ "name": "id",
288
+ "tags": [],
289
+ "docs": "Record identifier expressed as an array of byte values.",
290
+ "complexTypes": [],
291
+ "type": "number[]"
292
+ },
293
+ {
294
+ "name": "payload",
295
+ "tags": [],
296
+ "docs": "Raw payload expressed as an array of byte values.",
297
+ "complexTypes": [],
298
+ "type": "number[]"
299
+ }
300
+ ]
301
+ },
302
+ {
303
+ "name": "ShareTagOptions",
304
+ "slug": "sharetagoptions",
305
+ "docs": "Options used when sharing an NDEF message with another device using Android Beam / P2P mode.",
306
+ "tags": [],
307
+ "methods": [],
308
+ "properties": [
309
+ {
310
+ "name": "records",
311
+ "tags": [],
312
+ "docs": "",
313
+ "complexTypes": [
314
+ "NdefRecord"
315
+ ],
316
+ "type": "NdefRecord[]"
317
+ }
318
+ ]
319
+ },
320
+ {
321
+ "name": "PluginListenerHandle",
322
+ "slug": "pluginlistenerhandle",
323
+ "docs": "",
324
+ "tags": [],
325
+ "methods": [],
326
+ "properties": [
327
+ {
328
+ "name": "remove",
329
+ "tags": [],
330
+ "docs": "",
331
+ "complexTypes": [],
332
+ "type": "() => Promise<void>"
333
+ }
334
+ ]
335
+ },
336
+ {
337
+ "name": "NfcEvent",
338
+ "slug": "nfcevent",
339
+ "docs": "Generic NFC discovery event dispatched by the plugin.",
340
+ "tags": [],
341
+ "methods": [],
342
+ "properties": [
343
+ {
344
+ "name": "type",
345
+ "tags": [],
346
+ "docs": "",
347
+ "complexTypes": [
348
+ "NfcEventType"
349
+ ],
350
+ "type": "NfcEventType"
351
+ },
352
+ {
353
+ "name": "tag",
354
+ "tags": [],
355
+ "docs": "",
356
+ "complexTypes": [
357
+ "NfcTag"
358
+ ],
359
+ "type": "NfcTag"
360
+ }
361
+ ]
362
+ },
363
+ {
364
+ "name": "NfcTag",
365
+ "slug": "nfctag",
366
+ "docs": "Representation of the full tag information returned by the native layers.",
367
+ "tags": [],
368
+ "methods": [],
369
+ "properties": [
370
+ {
371
+ "name": "id",
372
+ "tags": [],
373
+ "docs": "Raw identifier bytes for the tag.",
374
+ "complexTypes": [],
375
+ "type": "number[] | undefined"
376
+ },
377
+ {
378
+ "name": "techTypes",
379
+ "tags": [],
380
+ "docs": "List of Android tech strings (e.g. `android.nfc.tech.Ndef`).",
381
+ "complexTypes": [],
382
+ "type": "string[] | undefined"
383
+ },
384
+ {
385
+ "name": "type",
386
+ "tags": [],
387
+ "docs": "Human readable tag type when available (e.g. `NFC Forum Type 2`).",
388
+ "complexTypes": [],
389
+ "type": "string | null | undefined"
390
+ },
391
+ {
392
+ "name": "maxSize",
393
+ "tags": [],
394
+ "docs": "Maximum writable size in bytes for tags that expose NDEF information.",
395
+ "complexTypes": [],
396
+ "type": "number | null | undefined"
397
+ },
398
+ {
399
+ "name": "isWritable",
400
+ "tags": [],
401
+ "docs": "Indicates whether the tag can be written to.",
402
+ "complexTypes": [],
403
+ "type": "boolean | null | undefined"
404
+ },
405
+ {
406
+ "name": "canMakeReadOnly",
407
+ "tags": [],
408
+ "docs": "Indicates whether the tag can be permanently locked.",
409
+ "complexTypes": [],
410
+ "type": "boolean | null | undefined"
411
+ },
412
+ {
413
+ "name": "ndefMessage",
414
+ "tags": [],
415
+ "docs": "Array of NDEF records discovered on the tag.",
416
+ "complexTypes": [
417
+ "NdefRecord"
418
+ ],
419
+ "type": "NdefRecord[] | null | undefined"
420
+ }
421
+ ]
422
+ },
423
+ {
424
+ "name": "NfcStateChangeEvent",
425
+ "slug": "nfcstatechangeevent",
426
+ "docs": "Event emitted whenever the NFC adapter availability changes.",
427
+ "tags": [],
428
+ "methods": [],
429
+ "properties": [
430
+ {
431
+ "name": "status",
432
+ "tags": [],
433
+ "docs": "",
434
+ "complexTypes": [
435
+ "NfcStatus"
436
+ ],
437
+ "type": "NfcStatus"
438
+ },
439
+ {
440
+ "name": "enabled",
441
+ "tags": [],
442
+ "docs": "",
443
+ "complexTypes": [],
444
+ "type": "boolean"
445
+ }
446
+ ]
447
+ }
448
+ ],
449
+ "enums": [],
450
+ "typeAliases": [
451
+ {
452
+ "name": "NfcStatus",
453
+ "slug": "nfcstatus",
454
+ "docs": "Possible NFC adapter states returned by {@link CapacitorNfcPlugin.getStatus}.\n\nMatches the constants provided by the original PhoneGap NFC plugin for\ncompatibility with existing applications.",
455
+ "types": [
456
+ {
457
+ "text": "'NFC_OK'",
458
+ "complexTypes": []
459
+ },
460
+ {
461
+ "text": "'NO_NFC'",
462
+ "complexTypes": []
463
+ },
464
+ {
465
+ "text": "'NFC_DISABLED'",
466
+ "complexTypes": []
467
+ },
468
+ {
469
+ "text": "'NDEF_PUSH_DISABLED'",
470
+ "complexTypes": []
471
+ }
472
+ ]
473
+ },
474
+ {
475
+ "name": "NfcEventType",
476
+ "slug": "nfceventtype",
477
+ "docs": "Event type describing the kind of NFC discovery that happened.\n\n- `tag`: A generic NFC tag (no NDEF payload).\n- `ndef`: A tag exposing an NDEF payload.\n- `ndef-mime`: An NDEF tag that matched one of the MIME type filters.\n- `ndef-formatable`: A tag that can be formatted to NDEF.",
478
+ "types": [
479
+ {
480
+ "text": "'tag'",
481
+ "complexTypes": []
482
+ },
483
+ {
484
+ "text": "'ndef'",
485
+ "complexTypes": []
486
+ },
487
+ {
488
+ "text": "'ndef-mime'",
489
+ "complexTypes": []
490
+ },
491
+ {
492
+ "text": "'ndef-formatable'",
493
+ "complexTypes": []
494
+ }
495
+ ]
496
+ }
497
+ ],
498
+ "pluginConfigs": []
499
+ }
@@ -0,0 +1,184 @@
1
+ import type { PluginListenerHandle } from '@capacitor/core';
2
+ /**
3
+ * Possible NFC adapter states returned by {@link CapacitorNfcPlugin.getStatus}.
4
+ *
5
+ * Matches the constants provided by the original PhoneGap NFC plugin for
6
+ * compatibility with existing applications.
7
+ */
8
+ export type NfcStatus = 'NFC_OK' | 'NO_NFC' | 'NFC_DISABLED' | 'NDEF_PUSH_DISABLED';
9
+ /**
10
+ * Event type describing the kind of NFC discovery that happened.
11
+ *
12
+ * - `tag`: A generic NFC tag (no NDEF payload).
13
+ * - `ndef`: A tag exposing an NDEF payload.
14
+ * - `ndef-mime`: An NDEF tag that matched one of the MIME type filters.
15
+ * - `ndef-formatable`: A tag that can be formatted to NDEF.
16
+ */
17
+ export type NfcEventType = 'tag' | 'ndef' | 'ndef-mime' | 'ndef-formatable';
18
+ /**
19
+ * JSON structure representing a single NDEF record.
20
+ *
21
+ * Mirrors the data format returned by the legacy Cordova implementation and
22
+ * uses integer arrays instead of strings to preserve the original payload
23
+ * bytes.
24
+ */
25
+ export interface NdefRecord {
26
+ /**
27
+ * Type Name Format identifier.
28
+ */
29
+ tnf: number;
30
+ /**
31
+ * Type field expressed as an array of byte values.
32
+ */
33
+ type: number[];
34
+ /**
35
+ * Record identifier expressed as an array of byte values.
36
+ */
37
+ id: number[];
38
+ /**
39
+ * Raw payload expressed as an array of byte values.
40
+ */
41
+ payload: number[];
42
+ }
43
+ /**
44
+ * Representation of the full tag information returned by the native layers.
45
+ */
46
+ export interface NfcTag {
47
+ /**
48
+ * Raw identifier bytes for the tag.
49
+ */
50
+ id?: number[];
51
+ /**
52
+ * List of Android tech strings (e.g. `android.nfc.tech.Ndef`).
53
+ */
54
+ techTypes?: string[];
55
+ /**
56
+ * Human readable tag type when available (e.g. `NFC Forum Type 2`).
57
+ */
58
+ type?: string | null;
59
+ /**
60
+ * Maximum writable size in bytes for tags that expose NDEF information.
61
+ */
62
+ maxSize?: number | null;
63
+ /**
64
+ * Indicates whether the tag can be written to.
65
+ */
66
+ isWritable?: boolean | null;
67
+ /**
68
+ * Indicates whether the tag can be permanently locked.
69
+ */
70
+ canMakeReadOnly?: boolean | null;
71
+ /**
72
+ * Array of NDEF records discovered on the tag.
73
+ */
74
+ ndefMessage?: NdefRecord[] | null;
75
+ }
76
+ /**
77
+ * Generic NFC discovery event dispatched by the plugin.
78
+ */
79
+ export interface NfcEvent {
80
+ type: NfcEventType;
81
+ tag: NfcTag;
82
+ }
83
+ /**
84
+ * Options controlling the behaviour of {@link CapacitorNfcPlugin.startScanning}.
85
+ */
86
+ export interface StartScanningOptions {
87
+ /**
88
+ * iOS-only: closes the NFC session automatically after the first successful tag read.
89
+ * Defaults to `true`.
90
+ */
91
+ invalidateAfterFirstRead?: boolean;
92
+ /**
93
+ * iOS-only: custom message displayed in the NFC system sheet while scanning.
94
+ */
95
+ alertMessage?: string;
96
+ /**
97
+ * Android-only: raw flags passed to `NfcAdapter.enableReaderMode`.
98
+ * Defaults to enabling all tag types with skipping NDEF checks.
99
+ */
100
+ androidReaderModeFlags?: number;
101
+ }
102
+ /**
103
+ * Options used when writing an NDEF message on the current tag.
104
+ */
105
+ export interface WriteTagOptions {
106
+ /**
107
+ * Array of records that compose the NDEF message to be written.
108
+ */
109
+ records: NdefRecord[];
110
+ /**
111
+ * When `true`, the plugin attempts to format NDEF-formattable tags before writing.
112
+ * Defaults to `true`.
113
+ */
114
+ allowFormat?: boolean;
115
+ }
116
+ /**
117
+ * Options used when sharing an NDEF message with another device using Android Beam / P2P mode.
118
+ */
119
+ export interface ShareTagOptions {
120
+ records: NdefRecord[];
121
+ }
122
+ /**
123
+ * Event emitted whenever the NFC adapter availability changes.
124
+ */
125
+ export interface NfcStateChangeEvent {
126
+ status: NfcStatus;
127
+ enabled: boolean;
128
+ }
129
+ /**
130
+ * Public API surface for the Capacitor NFC plugin.
131
+ *
132
+ * The interface intentionally mirrors the behaviour of the reference PhoneGap
133
+ * implementation to ease migration while embracing idiomatic Capacitor APIs.
134
+ */
135
+ export interface CapacitorNfcPlugin {
136
+ /**
137
+ * Starts listening for NFC tags.
138
+ */
139
+ startScanning(options?: StartScanningOptions): Promise<void>;
140
+ /**
141
+ * Stops the ongoing NFC scanning session.
142
+ */
143
+ stopScanning(): Promise<void>;
144
+ /**
145
+ * Writes the provided NDEF records to the last discovered tag.
146
+ */
147
+ write(options: WriteTagOptions): Promise<void>;
148
+ /**
149
+ * Attempts to erase the last discovered tag by writing an empty NDEF message.
150
+ */
151
+ erase(): Promise<void>;
152
+ /**
153
+ * Attempts to make the last discovered tag read-only.
154
+ */
155
+ makeReadOnly(): Promise<void>;
156
+ /**
157
+ * Shares an NDEF message with another device via peer-to-peer (Android only).
158
+ */
159
+ share(options: ShareTagOptions): Promise<void>;
160
+ /**
161
+ * Stops sharing previously provided NDEF message (Android only).
162
+ */
163
+ unshare(): Promise<void>;
164
+ /**
165
+ * Returns the current NFC adapter status.
166
+ */
167
+ getStatus(): Promise<{
168
+ status: NfcStatus;
169
+ }>;
170
+ /**
171
+ * Opens the system settings page where the user can enable NFC.
172
+ */
173
+ showSettings(): Promise<void>;
174
+ /**
175
+ * Returns the version string baked into the native plugin.
176
+ */
177
+ getPluginVersion(): Promise<{
178
+ version: string;
179
+ }>;
180
+ addListener(eventName: 'nfcEvent', listenerFunc: (event: NfcEvent) => void): Promise<PluginListenerHandle>;
181
+ addListener(eventName: 'tagDiscovered' | 'ndefDiscovered' | 'ndefMimeDiscovered' | 'ndefFormatableDiscovered', listenerFunc: (event: NfcEvent) => void): Promise<PluginListenerHandle>;
182
+ addListener(eventName: 'nfcStateChange', listenerFunc: (event: NfcStateChangeEvent) => void): Promise<PluginListenerHandle>;
183
+ }
184
+ export type { PluginListenerHandle } from '@capacitor/core';
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=definitions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["import type { PluginListenerHandle } from '@capacitor/core';\n\n/**\n * Possible NFC adapter states returned by {@link CapacitorNfcPlugin.getStatus}.\n *\n * Matches the constants provided by the original PhoneGap NFC plugin for\n * compatibility with existing applications.\n */\nexport type NfcStatus = 'NFC_OK' | 'NO_NFC' | 'NFC_DISABLED' | 'NDEF_PUSH_DISABLED';\n\n/**\n * Event type describing the kind of NFC discovery that happened.\n *\n * - `tag`: A generic NFC tag (no NDEF payload).\n * - `ndef`: A tag exposing an NDEF payload.\n * - `ndef-mime`: An NDEF tag that matched one of the MIME type filters.\n * - `ndef-formatable`: A tag that can be formatted to NDEF.\n */\nexport type NfcEventType = 'tag' | 'ndef' | 'ndef-mime' | 'ndef-formatable';\n\n/**\n * JSON structure representing a single NDEF record.\n *\n * Mirrors the data format returned by the legacy Cordova implementation and\n * uses integer arrays instead of strings to preserve the original payload\n * bytes.\n */\nexport interface NdefRecord {\n /**\n * Type Name Format identifier.\n */\n tnf: number;\n /**\n * Type field expressed as an array of byte values.\n */\n type: number[];\n /**\n * Record identifier expressed as an array of byte values.\n */\n id: number[];\n /**\n * Raw payload expressed as an array of byte values.\n */\n payload: number[];\n}\n\n/**\n * Representation of the full tag information returned by the native layers.\n */\nexport interface NfcTag {\n /**\n * Raw identifier bytes for the tag.\n */\n id?: number[];\n /**\n * List of Android tech strings (e.g. `android.nfc.tech.Ndef`).\n */\n techTypes?: string[];\n /**\n * Human readable tag type when available (e.g. `NFC Forum Type 2`).\n */\n type?: string | null;\n /**\n * Maximum writable size in bytes for tags that expose NDEF information.\n */\n maxSize?: number | null;\n /**\n * Indicates whether the tag can be written to.\n */\n isWritable?: boolean | null;\n /**\n * Indicates whether the tag can be permanently locked.\n */\n canMakeReadOnly?: boolean | null;\n /**\n * Array of NDEF records discovered on the tag.\n */\n ndefMessage?: NdefRecord[] | null;\n}\n\n/**\n * Generic NFC discovery event dispatched by the plugin.\n */\nexport interface NfcEvent {\n type: NfcEventType;\n tag: NfcTag;\n}\n\n/**\n * Options controlling the behaviour of {@link CapacitorNfcPlugin.startScanning}.\n */\nexport interface StartScanningOptions {\n /**\n * iOS-only: closes the NFC session automatically after the first successful tag read.\n * Defaults to `true`.\n */\n invalidateAfterFirstRead?: boolean;\n /**\n * iOS-only: custom message displayed in the NFC system sheet while scanning.\n */\n alertMessage?: string;\n /**\n * Android-only: raw flags passed to `NfcAdapter.enableReaderMode`.\n * Defaults to enabling all tag types with skipping NDEF checks.\n */\n androidReaderModeFlags?: number;\n}\n\n/**\n * Options used when writing an NDEF message on the current tag.\n */\nexport interface WriteTagOptions {\n /**\n * Array of records that compose the NDEF message to be written.\n */\n records: NdefRecord[];\n /**\n * When `true`, the plugin attempts to format NDEF-formattable tags before writing.\n * Defaults to `true`.\n */\n allowFormat?: boolean;\n}\n\n/**\n * Options used when sharing an NDEF message with another device using Android Beam / P2P mode.\n */\nexport interface ShareTagOptions {\n records: NdefRecord[];\n}\n\n/**\n * Event emitted whenever the NFC adapter availability changes.\n */\nexport interface NfcStateChangeEvent {\n status: NfcStatus;\n enabled: boolean;\n}\n\n/**\n * Public API surface for the Capacitor NFC plugin.\n *\n * The interface intentionally mirrors the behaviour of the reference PhoneGap\n * implementation to ease migration while embracing idiomatic Capacitor APIs.\n */\nexport interface CapacitorNfcPlugin {\n /**\n * Starts listening for NFC tags.\n */\n startScanning(options?: StartScanningOptions): Promise<void>;\n /**\n * Stops the ongoing NFC scanning session.\n */\n stopScanning(): Promise<void>;\n /**\n * Writes the provided NDEF records to the last discovered tag.\n */\n write(options: WriteTagOptions): Promise<void>;\n /**\n * Attempts to erase the last discovered tag by writing an empty NDEF message.\n */\n erase(): Promise<void>;\n /**\n * Attempts to make the last discovered tag read-only.\n */\n makeReadOnly(): Promise<void>;\n /**\n * Shares an NDEF message with another device via peer-to-peer (Android only).\n */\n share(options: ShareTagOptions): Promise<void>;\n /**\n * Stops sharing previously provided NDEF message (Android only).\n */\n unshare(): Promise<void>;\n /**\n * Returns the current NFC adapter status.\n */\n getStatus(): Promise<{ status: NfcStatus }>;\n /**\n * Opens the system settings page where the user can enable NFC.\n */\n showSettings(): Promise<void>;\n /**\n * Returns the version string baked into the native plugin.\n */\n getPluginVersion(): Promise<{ version: string }>;\n\n addListener(eventName: 'nfcEvent', listenerFunc: (event: NfcEvent) => void): Promise<PluginListenerHandle>;\n addListener(\n eventName: 'tagDiscovered' | 'ndefDiscovered' | 'ndefMimeDiscovered' | 'ndefFormatableDiscovered',\n listenerFunc: (event: NfcEvent) => void,\n ): Promise<PluginListenerHandle>;\n addListener(\n eventName: 'nfcStateChange',\n listenerFunc: (event: NfcStateChangeEvent) => void,\n ): Promise<PluginListenerHandle>;\n}\n\nexport type { PluginListenerHandle } from '@capacitor/core';\n"]}