@capacitor/contacts 1.1.0-dev.1 → 2.0.0-next.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/docs.json CHANGED
@@ -92,30 +92,6 @@
92
92
  "Contact"
93
93
  ],
94
94
  "slug": "pickcontact"
95
- },
96
- {
97
- "name": "pickContactField",
98
- "signature": "(options: PickContactFieldOptions) => Promise<PickedContactField>",
99
- "parameters": [
100
- {
101
- "name": "options",
102
- "docs": "",
103
- "type": "PickContactFieldOptions"
104
- }
105
- ],
106
- "returns": "Promise<PickedContactField>",
107
- "tags": [
108
- {
109
- "name": "since",
110
- "text": "1.1.0"
111
- }
112
- ],
113
- "docs": "Launches the native contact picker UI, showing only the requested kind of\ninformation, and resolves with the single value the user selects (not a\nfull contact). Rejects with `OS-PLUG-CONT-0006` if the user cancels.\n\nNeeds no contacts permission on either platform, which lets Android apps\nomit READ_CONTACTS from their manifest. Only one data kind can be picked\nper call.",
114
- "complexTypes": [
115
- "PickedContactField",
116
- "PickContactFieldOptions"
117
- ],
118
- "slug": "pickcontactfield"
119
95
  }
120
96
  ],
121
97
  "properties": []
@@ -848,182 +824,6 @@
848
824
  "type": "string"
849
825
  }
850
826
  ]
851
- },
852
- {
853
- "name": "PickedContactField",
854
- "slug": "pickedcontactfield",
855
- "docs": "The value the user picked with {@link ContactsPlugin.pickContactField}. This is\nnot a full contact: it holds only the picked value, its label and the\ncontact's display name.",
856
- "tags": [
857
- {
858
- "text": "1.1.0",
859
- "name": "since"
860
- }
861
- ],
862
- "methods": [],
863
- "properties": [
864
- {
865
- "name": "field",
866
- "tags": [
867
- {
868
- "text": "1.1.0",
869
- "name": "since"
870
- }
871
- ],
872
- "docs": "The kind of value that was picked, as requested.",
873
- "complexTypes": [],
874
- "type": "'phone' | 'email' | 'address'"
875
- },
876
- {
877
- "name": "value",
878
- "tags": [
879
- {
880
- "text": "1.1.0",
881
- "name": "since"
882
- }
883
- ],
884
- "docs": "The picked phone number, email address, or postal address formatted for\ndisplay, depending on `field`.",
885
- "complexTypes": [],
886
- "type": "string"
887
- },
888
- {
889
- "name": "type",
890
- "tags": [
891
- {
892
- "text": "1.1.0",
893
- "name": "since"
894
- }
895
- ],
896
- "docs": "The label of the picked value, e.g. `mobile`, `home`, `work`.",
897
- "complexTypes": [],
898
- "type": "string"
899
- },
900
- {
901
- "name": "displayName",
902
- "tags": [
903
- {
904
- "text": "1.1.0",
905
- "name": "since"
906
- }
907
- ],
908
- "docs": "The display name of the contact the value belongs to, when available.",
909
- "complexTypes": [],
910
- "type": "string | undefined"
911
- },
912
- {
913
- "name": "address",
914
- "tags": [
915
- {
916
- "text": "1.1.0",
917
- "name": "since"
918
- }
919
- ],
920
- "docs": "The parts of the postal address. Only present when `field` is `address`.",
921
- "complexTypes": [
922
- "PickedContactAddress"
923
- ],
924
- "type": "PickedContactAddress"
925
- }
926
- ]
927
- },
928
- {
929
- "name": "PickedContactAddress",
930
- "slug": "pickedcontactaddress",
931
- "docs": "The parts of a postal address returned by {@link ContactsPlugin.pickContactField}.",
932
- "tags": [
933
- {
934
- "text": "1.1.0",
935
- "name": "since"
936
- }
937
- ],
938
- "methods": [],
939
- "properties": [
940
- {
941
- "name": "streetAddress",
942
- "tags": [
943
- {
944
- "text": "1.1.0",
945
- "name": "since"
946
- }
947
- ],
948
- "docs": "The street address.",
949
- "complexTypes": [],
950
- "type": "string | undefined"
951
- },
952
- {
953
- "name": "locality",
954
- "tags": [
955
- {
956
- "text": "1.1.0",
957
- "name": "since"
958
- }
959
- ],
960
- "docs": "The city or locality.",
961
- "complexTypes": [],
962
- "type": "string | undefined"
963
- },
964
- {
965
- "name": "region",
966
- "tags": [
967
- {
968
- "text": "1.1.0",
969
- "name": "since"
970
- }
971
- ],
972
- "docs": "The state or region.",
973
- "complexTypes": [],
974
- "type": "string | undefined"
975
- },
976
- {
977
- "name": "postalCode",
978
- "tags": [
979
- {
980
- "text": "1.1.0",
981
- "name": "since"
982
- }
983
- ],
984
- "docs": "The postal code.",
985
- "complexTypes": [],
986
- "type": "string | undefined"
987
- },
988
- {
989
- "name": "country",
990
- "tags": [
991
- {
992
- "text": "1.1.0",
993
- "name": "since"
994
- }
995
- ],
996
- "docs": "The country.",
997
- "complexTypes": [],
998
- "type": "string | undefined"
999
- }
1000
- ]
1001
- },
1002
- {
1003
- "name": "PickContactFieldOptions",
1004
- "slug": "pickcontactfieldoptions",
1005
- "docs": "Options accepted by {@link ContactsPlugin.pickContactField}.",
1006
- "tags": [
1007
- {
1008
- "text": "1.1.0",
1009
- "name": "since"
1010
- }
1011
- ],
1012
- "methods": [],
1013
- "properties": [
1014
- {
1015
- "name": "field",
1016
- "tags": [
1017
- {
1018
- "text": "1.1.0",
1019
- "name": "since"
1020
- }
1021
- ],
1022
- "docs": "The single kind of contact information to pick. Any other value\nrejects with `OS-PLUG-CONT-0001`.",
1023
- "complexTypes": [],
1024
- "type": "'phone' | 'email' | 'address'"
1025
- }
1026
- ]
1027
827
  }
1028
828
  ],
1029
829
  "enums": [],
@@ -49,18 +49,6 @@ export interface ContactsPlugin {
49
49
  * @since 1.0.0
50
50
  */
51
51
  pickContact(): Promise<Contact>;
52
- /**
53
- * Launches the native contact picker UI, showing only the requested kind of
54
- * information, and resolves with the single value the user selects (not a
55
- * full contact). Rejects with `OS-PLUG-CONT-0006` if the user cancels.
56
- *
57
- * Needs no contacts permission on either platform, which lets Android apps
58
- * omit READ_CONTACTS from their manifest. Only one data kind can be picked
59
- * per call.
60
- *
61
- * @since 1.1.0
62
- */
63
- pickContactField(options: PickContactFieldOptions): Promise<PickedContactField>;
64
52
  }
65
53
  /**
66
54
  * The set of contact fields a {@link ContactsPlugin.find} call can search
@@ -450,94 +438,3 @@ export interface ContactOrganization {
450
438
  */
451
439
  title?: string;
452
440
  }
453
- /**
454
- * Options accepted by {@link ContactsPlugin.pickContactField}.
455
- *
456
- * @since 1.1.0
457
- */
458
- export interface PickContactFieldOptions {
459
- /**
460
- * The single kind of contact information to pick. Any other value
461
- * rejects with `OS-PLUG-CONT-0001`.
462
- *
463
- * @since 1.1.0
464
- */
465
- field: 'phone' | 'email' | 'address';
466
- }
467
- /**
468
- * The value the user picked with {@link ContactsPlugin.pickContactField}. This is
469
- * not a full contact: it holds only the picked value, its label and the
470
- * contact's display name.
471
- *
472
- * @since 1.1.0
473
- */
474
- export interface PickedContactField {
475
- /**
476
- * The kind of value that was picked, as requested.
477
- *
478
- * @since 1.1.0
479
- */
480
- field: 'phone' | 'email' | 'address';
481
- /**
482
- * The picked phone number, email address, or postal address formatted for
483
- * display, depending on `field`.
484
- *
485
- * @since 1.1.0
486
- */
487
- value: string;
488
- /**
489
- * The label of the picked value, e.g. `mobile`, `home`, `work`.
490
- *
491
- * @since 1.1.0
492
- */
493
- type: string;
494
- /**
495
- * The display name of the contact the value belongs to, when available.
496
- *
497
- * @since 1.1.0
498
- */
499
- displayName?: string;
500
- /**
501
- * The parts of the postal address. Only present when `field` is `address`.
502
- *
503
- * @since 1.1.0
504
- */
505
- address?: PickedContactAddress;
506
- }
507
- /**
508
- * The parts of a postal address returned by {@link ContactsPlugin.pickContactField}.
509
- *
510
- * @since 1.1.0
511
- */
512
- export interface PickedContactAddress {
513
- /**
514
- * The street address.
515
- *
516
- * @since 1.1.0
517
- */
518
- streetAddress?: string;
519
- /**
520
- * The city or locality.
521
- *
522
- * @since 1.1.0
523
- */
524
- locality?: string;
525
- /**
526
- * The state or region.
527
- *
528
- * @since 1.1.0
529
- */
530
- region?: string;
531
- /**
532
- * The postal code.
533
- *
534
- * @since 1.1.0
535
- */
536
- postalCode?: string;
537
- /**
538
- * The country.
539
- *
540
- * @since 1.1.0
541
- */
542
- country?: string;
543
- }
@@ -1 +1 @@
1
- {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["export interface ContactsPlugin {\n /**\n * Queries the device contacts database and returns the matching contacts.\n *\n * Requests the READ_CONTACTS (Android) / Contacts (iOS) permission internally\n * the first time it runs; there is no separate permission method.\n *\n * **iOS 18+:** under Limited Access the search runs against (and returns\n * only) the subset of contacts the user shared with the app.\n *\n * @since 1.0.0\n */\n find(options: ContactFindOptions): Promise<ContactFindResult>;\n\n /**\n * Persists a new contact or updates an existing one (matched by `contact.id`).\n * Resolves with the full saved contact.\n *\n * Requests the READ/WRITE_CONTACTS (Android) / Contacts (iOS) permission\n * internally.\n *\n * **iOS 18+:** works under Limited Access: new contacts are added to the\n * app's accessible set; updating requires the target contact to be in that\n * set (otherwise the call rejects with `OS-PLUG-CONT-0001`).\n *\n * @since 1.0.0\n */\n save(options: ContactSaveOptions): Promise<Contact>;\n\n /**\n * Removes the contact with the given `id` from the device contacts database.\n * Rejects with `OS-PLUG-CONT-0001` when no contact has that id (on iOS 18+\n * Limited Access, also when the contact is outside the accessible set).\n *\n * Requests the READ/WRITE_CONTACTS (Android) / Contacts (iOS) permission\n * internally.\n *\n * @since 1.0.0\n */\n remove(options: ContactRemoveOptions): Promise<void>;\n\n /**\n * Launches the native contact picker UI and resolves with the contact the\n * user selects. Rejects with `OS-PLUG-CONT-0006` if the user cancels.\n *\n * On iOS the system picker requires no permission and always shows the full\n * contact list, even under iOS 18+ Limited Access (the picked contact is\n * returned without joining the app's accessible set). On Android the\n * READ_CONTACTS permission is requested internally to read the picked\n * contact's details.\n *\n * @since 1.0.0\n */\n pickContact(): Promise<Contact>;\n\n /**\n * Launches the native contact picker UI, showing only the requested kind of\n * information, and resolves with the single value the user selects (not a\n * full contact). Rejects with `OS-PLUG-CONT-0006` if the user cancels.\n *\n * Needs no contacts permission on either platform, which lets Android apps\n * omit READ_CONTACTS from their manifest. Only one data kind can be picked\n * per call.\n *\n * @since 1.1.0\n */\n pickContactField(options: PickContactFieldOptions): Promise<PickedContactField>;\n}\n\n/**\n * The set of contact fields a {@link ContactsPlugin.find} call can search\n * against or request back. Mirrors the legacy Cordova `ContactFieldType`\n * string values exactly.\n *\n * @since 1.0.0\n */\nexport type ContactFieldType =\n | 'addresses'\n | 'birthday'\n | 'categories'\n | 'country'\n | 'department'\n | 'displayName'\n | 'emails'\n | 'familyName'\n | 'formatted'\n | 'givenName'\n | 'honorificPrefix'\n | 'honorificSuffix'\n | 'id'\n | 'ims'\n | 'locality'\n | 'middleName'\n | 'name'\n | 'nickname'\n | 'note'\n | 'organizations'\n | 'phoneNumbers'\n | 'photos'\n | 'postalCode'\n | 'region'\n | 'streetAddress'\n | 'title'\n | 'urls';\n\n/**\n * Search options accepted by {@link ContactsPlugin.find}.\n *\n * @since 1.0.0\n */\nexport interface ContactFindOptions {\n /**\n * Fields to search against. Pass `['*']` to match every field. An empty\n * array is invalid and rejects with `OS-PLUG-CONT-0001`. The `id` field\n * matches by exact identifier; all other fields match case-insensitive\n * substrings. `photos` and `categories` are not searchable.\n *\n * @since 1.0.0\n */\n fields: ContactFieldType[];\n\n /**\n * Search string matched (case-insensitively) against the selected `fields`.\n * An empty/omitted filter returns every contact.\n *\n * @since 1.0.0\n */\n filter?: string;\n\n /**\n * When `true`, returns every match; when `false` (default), returns at most\n * one contact.\n *\n * @since 1.0.0\n */\n multiple?: boolean;\n\n /**\n * If set, each returned {@link Contact} only includes these fields (plus the\n * always-present `id`).\n *\n * @since 1.0.0\n */\n desiredFields?: ContactFieldType[];\n\n /**\n * OutSystems extension: when `true`, only contacts that have at least one\n * phone number are returned. Defaults to `false`.\n *\n * @since 1.0.0\n */\n hasPhoneNumber?: boolean;\n}\n\n/**\n * Result of a {@link ContactsPlugin.find} call.\n *\n * @since 1.0.0\n */\nexport interface ContactFindResult {\n /**\n * The contacts matching the search criteria.\n *\n * @since 1.0.0\n */\n contacts: Contact[];\n}\n\n/**\n * Options accepted by {@link ContactsPlugin.save}.\n *\n * @since 1.0.0\n */\nexport interface ContactSaveOptions {\n /**\n * The contact to create (no `id`) or update (existing `id`).\n *\n * Update semantics: every field present on the contact replaces the stored\n * value entirely (e.g. `name` replaces the whole structured name,\n * `phoneNumbers` replaces all phone numbers); omitted fields are left\n * unchanged.\n *\n * @since 1.0.0\n */\n contact: Contact;\n}\n\n/**\n * Options accepted by {@link ContactsPlugin.remove}.\n *\n * @since 1.0.0\n */\nexport interface ContactRemoveOptions {\n /**\n * The native id of the contact to remove.\n *\n * @since 1.0.0\n */\n id: string;\n}\n\n/**\n * A single device contact.\n *\n * @since 1.0.0\n */\nexport interface Contact {\n /**\n * Globally unique, platform-assigned identifier. Absent for contacts not yet\n * saved to the device.\n *\n * @since 1.0.0\n */\n id?: string;\n\n /**\n * Android raw-contact id backing this aggregated contact. iOS leaves this\n * unset.\n *\n * @since 1.0.0\n */\n rawId?: string;\n\n /**\n * Name suitable for display to end users.\n *\n * @since 1.0.0\n */\n displayName?: string;\n\n /**\n * The structured name components.\n *\n * @since 1.0.0\n */\n name?: ContactName;\n\n /**\n * A casual name by which to address the contact.\n *\n * @since 1.0.0\n */\n nickname?: string;\n\n /**\n * The contact's phone numbers.\n *\n * @since 1.0.0\n */\n phoneNumbers?: ContactField[];\n\n /**\n * The contact's email addresses.\n *\n * @since 1.0.0\n */\n emails?: ContactField[];\n\n /**\n * The contact's postal addresses.\n *\n * @since 1.0.0\n */\n addresses?: ContactAddress[];\n\n /**\n * The contact's instant-messaging handles.\n *\n * @since 1.0.0\n */\n ims?: ContactField[];\n\n /**\n * The contact's organizations.\n *\n * @since 1.0.0\n */\n organizations?: ContactOrganization[];\n\n /**\n * The contact's birthday as epoch milliseconds.\n *\n * @since 1.0.0\n */\n birthday?: number;\n\n /**\n * A free-form note about the contact.\n *\n * **iOS:** not supported by default: reading/writing a contact's note\n * requires Apple's restricted `com.apple.developer.contacts.notes`\n * entitlement. Without it the field is omitted on read and ignored on save.\n * Android has no such restriction.\n *\n * @since 1.0.0\n */\n note?: string;\n\n /**\n * The contact's photos. Reads return `type: 'url'` with the `value`\n * holding a reference to the image, never image bytes: on Android the\n * contact's `content://` photo URI, on iOS the path of a copy written to\n * the app's temporary directory (cleared by the system). On save, the first entry is\n * applied: pass `type: 'base64'` with base64 data, or `type: 'url'` with a\n * local `file://`/`content://` URI to import.\n *\n * @since 1.0.0\n */\n photos?: ContactField[];\n\n /**\n * User-defined categories associated with the contact. Read-only: populated\n * from the contact's group memberships on Android, never returned on iOS\n * (the Contacts framework has no equivalent), and ignored on save.\n *\n * @since 1.0.0\n */\n categories?: ContactField[];\n\n /**\n * Web pages associated with the contact.\n *\n * @since 1.0.0\n */\n urls?: ContactField[];\n}\n\n/**\n * Structured name of a {@link Contact}.\n *\n * @since 1.0.0\n */\nexport interface ContactName {\n /**\n * The complete formatted name.\n *\n * @since 1.0.0\n */\n formatted?: string;\n\n /**\n * Family (last) name.\n *\n * @since 1.0.0\n */\n familyName?: string;\n\n /**\n * Given (first) name.\n *\n * @since 1.0.0\n */\n givenName?: string;\n\n /**\n * Middle name.\n *\n * @since 1.0.0\n */\n middleName?: string;\n\n /**\n * Honorific prefix (e.g. `Mr.`, `Dr.`).\n *\n * @since 1.0.0\n */\n honorificPrefix?: string;\n\n /**\n * Honorific suffix (e.g. `Esq.`).\n *\n * @since 1.0.0\n */\n honorificSuffix?: string;\n}\n\n/**\n * A generic, repeatable contact field (phone number, email, IM, photo, URL,\n * category).\n *\n * @since 1.0.0\n */\nexport interface ContactField {\n /**\n * The kind of field, e.g. `home`, `work`, `mobile`. For photos, `url` or\n * `base64`.\n *\n * @since 1.0.0\n */\n type?: string;\n\n /**\n * The field value (phone number, email address, URI, etc.).\n *\n * @since 1.0.0\n */\n value?: string;\n\n /**\n * `true` if this is the contact's preferred value for the field.\n *\n * @since 1.0.0\n */\n pref?: boolean;\n\n /**\n * Platform-assigned id of this individual field entry.\n *\n * @since 1.0.0\n */\n id?: string;\n}\n\n/**\n * A postal address of a {@link Contact}.\n *\n * @since 1.0.0\n */\nexport interface ContactAddress {\n /**\n * Platform-assigned id of this address entry.\n *\n * @since 1.0.0\n */\n id?: string;\n\n /**\n * `true` if this is the contact's preferred address.\n *\n * @since 1.0.0\n */\n pref?: boolean;\n\n /**\n * The kind of address, e.g. `home`, `work`.\n *\n * @since 1.0.0\n */\n type?: string;\n\n /**\n * The full address formatted for display.\n *\n * @since 1.0.0\n */\n formatted?: string;\n\n /**\n * The street address.\n *\n * @since 1.0.0\n */\n streetAddress?: string;\n\n /**\n * The city or locality.\n *\n * @since 1.0.0\n */\n locality?: string;\n\n /**\n * The state or region.\n *\n * @since 1.0.0\n */\n region?: string;\n\n /**\n * The ZIP or postal code.\n *\n * @since 1.0.0\n */\n postalCode?: string;\n\n /**\n * The country name.\n *\n * @since 1.0.0\n */\n country?: string;\n}\n\n/**\n * An organization a {@link Contact} belongs to.\n *\n * @since 1.0.0\n */\nexport interface ContactOrganization {\n /**\n * Platform-assigned id of this organization entry. Android only; iOS\n * models the organization as flat contact properties without an id.\n *\n * @since 1.0.0\n */\n id?: string;\n\n /**\n * `true` if this is the contact's preferred organization.\n *\n * @since 1.0.0\n */\n pref?: boolean;\n\n /**\n * The kind of organization, e.g. `work`.\n *\n * @since 1.0.0\n */\n type?: string;\n\n /**\n * The organization name.\n *\n * @since 1.0.0\n */\n name?: string;\n\n /**\n * The department within the organization.\n *\n * @since 1.0.0\n */\n department?: string;\n\n /**\n * The contact's title at the organization.\n *\n * @since 1.0.0\n */\n title?: string;\n}\n\n/**\n * Options accepted by {@link ContactsPlugin.pickContactField}.\n *\n * @since 1.1.0\n */\nexport interface PickContactFieldOptions {\n /**\n * The single kind of contact information to pick. Any other value\n * rejects with `OS-PLUG-CONT-0001`.\n *\n * @since 1.1.0\n */\n field: 'phone' | 'email' | 'address';\n}\n\n/**\n * The value the user picked with {@link ContactsPlugin.pickContactField}. This is\n * not a full contact: it holds only the picked value, its label and the\n * contact's display name.\n *\n * @since 1.1.0\n */\nexport interface PickedContactField {\n /**\n * The kind of value that was picked, as requested.\n *\n * @since 1.1.0\n */\n field: 'phone' | 'email' | 'address';\n\n /**\n * The picked phone number, email address, or postal address formatted for\n * display, depending on `field`.\n *\n * @since 1.1.0\n */\n value: string;\n\n /**\n * The label of the picked value, e.g. `mobile`, `home`, `work`.\n *\n * @since 1.1.0\n */\n type: string;\n\n /**\n * The display name of the contact the value belongs to, when available.\n *\n * @since 1.1.0\n */\n displayName?: string;\n\n /**\n * The parts of the postal address. Only present when `field` is `address`.\n *\n * @since 1.1.0\n */\n address?: PickedContactAddress;\n}\n\n/**\n * The parts of a postal address returned by {@link ContactsPlugin.pickContactField}.\n *\n * @since 1.1.0\n */\nexport interface PickedContactAddress {\n /**\n * The street address.\n *\n * @since 1.1.0\n */\n streetAddress?: string;\n\n /**\n * The city or locality.\n *\n * @since 1.1.0\n */\n locality?: string;\n\n /**\n * The state or region.\n *\n * @since 1.1.0\n */\n region?: string;\n\n /**\n * The postal code.\n *\n * @since 1.1.0\n */\n postalCode?: string;\n\n /**\n * The country.\n *\n * @since 1.1.0\n */\n country?: string;\n}\n"]}
1
+ {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["export interface ContactsPlugin {\n /**\n * Queries the device contacts database and returns the matching contacts.\n *\n * Requests the READ_CONTACTS (Android) / Contacts (iOS) permission internally\n * the first time it runs; there is no separate permission method.\n *\n * **iOS 18+:** under Limited Access the search runs against (and returns\n * only) the subset of contacts the user shared with the app.\n *\n * @since 1.0.0\n */\n find(options: ContactFindOptions): Promise<ContactFindResult>;\n\n /**\n * Persists a new contact or updates an existing one (matched by `contact.id`).\n * Resolves with the full saved contact.\n *\n * Requests the READ/WRITE_CONTACTS (Android) / Contacts (iOS) permission\n * internally.\n *\n * **iOS 18+:** works under Limited Access: new contacts are added to the\n * app's accessible set; updating requires the target contact to be in that\n * set (otherwise the call rejects with `OS-PLUG-CONT-0001`).\n *\n * @since 1.0.0\n */\n save(options: ContactSaveOptions): Promise<Contact>;\n\n /**\n * Removes the contact with the given `id` from the device contacts database.\n * Rejects with `OS-PLUG-CONT-0001` when no contact has that id (on iOS 18+\n * Limited Access, also when the contact is outside the accessible set).\n *\n * Requests the READ/WRITE_CONTACTS (Android) / Contacts (iOS) permission\n * internally.\n *\n * @since 1.0.0\n */\n remove(options: ContactRemoveOptions): Promise<void>;\n\n /**\n * Launches the native contact picker UI and resolves with the contact the\n * user selects. Rejects with `OS-PLUG-CONT-0006` if the user cancels.\n *\n * On iOS the system picker requires no permission and always shows the full\n * contact list, even under iOS 18+ Limited Access (the picked contact is\n * returned without joining the app's accessible set). On Android the\n * READ_CONTACTS permission is requested internally to read the picked\n * contact's details.\n *\n * @since 1.0.0\n */\n pickContact(): Promise<Contact>;\n}\n\n/**\n * The set of contact fields a {@link ContactsPlugin.find} call can search\n * against or request back. Mirrors the legacy Cordova `ContactFieldType`\n * string values exactly.\n *\n * @since 1.0.0\n */\nexport type ContactFieldType =\n | 'addresses'\n | 'birthday'\n | 'categories'\n | 'country'\n | 'department'\n | 'displayName'\n | 'emails'\n | 'familyName'\n | 'formatted'\n | 'givenName'\n | 'honorificPrefix'\n | 'honorificSuffix'\n | 'id'\n | 'ims'\n | 'locality'\n | 'middleName'\n | 'name'\n | 'nickname'\n | 'note'\n | 'organizations'\n | 'phoneNumbers'\n | 'photos'\n | 'postalCode'\n | 'region'\n | 'streetAddress'\n | 'title'\n | 'urls';\n\n/**\n * Search options accepted by {@link ContactsPlugin.find}.\n *\n * @since 1.0.0\n */\nexport interface ContactFindOptions {\n /**\n * Fields to search against. Pass `['*']` to match every field. An empty\n * array is invalid and rejects with `OS-PLUG-CONT-0001`. The `id` field\n * matches by exact identifier; all other fields match case-insensitive\n * substrings. `photos` and `categories` are not searchable.\n *\n * @since 1.0.0\n */\n fields: ContactFieldType[];\n\n /**\n * Search string matched (case-insensitively) against the selected `fields`.\n * An empty/omitted filter returns every contact.\n *\n * @since 1.0.0\n */\n filter?: string;\n\n /**\n * When `true`, returns every match; when `false` (default), returns at most\n * one contact.\n *\n * @since 1.0.0\n */\n multiple?: boolean;\n\n /**\n * If set, each returned {@link Contact} only includes these fields (plus the\n * always-present `id`).\n *\n * @since 1.0.0\n */\n desiredFields?: ContactFieldType[];\n\n /**\n * OutSystems extension: when `true`, only contacts that have at least one\n * phone number are returned. Defaults to `false`.\n *\n * @since 1.0.0\n */\n hasPhoneNumber?: boolean;\n}\n\n/**\n * Result of a {@link ContactsPlugin.find} call.\n *\n * @since 1.0.0\n */\nexport interface ContactFindResult {\n /**\n * The contacts matching the search criteria.\n *\n * @since 1.0.0\n */\n contacts: Contact[];\n}\n\n/**\n * Options accepted by {@link ContactsPlugin.save}.\n *\n * @since 1.0.0\n */\nexport interface ContactSaveOptions {\n /**\n * The contact to create (no `id`) or update (existing `id`).\n *\n * Update semantics: every field present on the contact replaces the stored\n * value entirely (e.g. `name` replaces the whole structured name,\n * `phoneNumbers` replaces all phone numbers); omitted fields are left\n * unchanged.\n *\n * @since 1.0.0\n */\n contact: Contact;\n}\n\n/**\n * Options accepted by {@link ContactsPlugin.remove}.\n *\n * @since 1.0.0\n */\nexport interface ContactRemoveOptions {\n /**\n * The native id of the contact to remove.\n *\n * @since 1.0.0\n */\n id: string;\n}\n\n/**\n * A single device contact.\n *\n * @since 1.0.0\n */\nexport interface Contact {\n /**\n * Globally unique, platform-assigned identifier. Absent for contacts not yet\n * saved to the device.\n *\n * @since 1.0.0\n */\n id?: string;\n\n /**\n * Android raw-contact id backing this aggregated contact. iOS leaves this\n * unset.\n *\n * @since 1.0.0\n */\n rawId?: string;\n\n /**\n * Name suitable for display to end users.\n *\n * @since 1.0.0\n */\n displayName?: string;\n\n /**\n * The structured name components.\n *\n * @since 1.0.0\n */\n name?: ContactName;\n\n /**\n * A casual name by which to address the contact.\n *\n * @since 1.0.0\n */\n nickname?: string;\n\n /**\n * The contact's phone numbers.\n *\n * @since 1.0.0\n */\n phoneNumbers?: ContactField[];\n\n /**\n * The contact's email addresses.\n *\n * @since 1.0.0\n */\n emails?: ContactField[];\n\n /**\n * The contact's postal addresses.\n *\n * @since 1.0.0\n */\n addresses?: ContactAddress[];\n\n /**\n * The contact's instant-messaging handles.\n *\n * @since 1.0.0\n */\n ims?: ContactField[];\n\n /**\n * The contact's organizations.\n *\n * @since 1.0.0\n */\n organizations?: ContactOrganization[];\n\n /**\n * The contact's birthday as epoch milliseconds.\n *\n * @since 1.0.0\n */\n birthday?: number;\n\n /**\n * A free-form note about the contact.\n *\n * **iOS:** not supported by default: reading/writing a contact's note\n * requires Apple's restricted `com.apple.developer.contacts.notes`\n * entitlement. Without it the field is omitted on read and ignored on save.\n * Android has no such restriction.\n *\n * @since 1.0.0\n */\n note?: string;\n\n /**\n * The contact's photos. Reads return `type: 'url'` with the `value`\n * holding a reference to the image, never image bytes: on Android the\n * contact's `content://` photo URI, on iOS the path of a copy written to\n * the app's temporary directory (cleared by the system). On save, the first entry is\n * applied: pass `type: 'base64'` with base64 data, or `type: 'url'` with a\n * local `file://`/`content://` URI to import.\n *\n * @since 1.0.0\n */\n photos?: ContactField[];\n\n /**\n * User-defined categories associated with the contact. Read-only: populated\n * from the contact's group memberships on Android, never returned on iOS\n * (the Contacts framework has no equivalent), and ignored on save.\n *\n * @since 1.0.0\n */\n categories?: ContactField[];\n\n /**\n * Web pages associated with the contact.\n *\n * @since 1.0.0\n */\n urls?: ContactField[];\n}\n\n/**\n * Structured name of a {@link Contact}.\n *\n * @since 1.0.0\n */\nexport interface ContactName {\n /**\n * The complete formatted name.\n *\n * @since 1.0.0\n */\n formatted?: string;\n\n /**\n * Family (last) name.\n *\n * @since 1.0.0\n */\n familyName?: string;\n\n /**\n * Given (first) name.\n *\n * @since 1.0.0\n */\n givenName?: string;\n\n /**\n * Middle name.\n *\n * @since 1.0.0\n */\n middleName?: string;\n\n /**\n * Honorific prefix (e.g. `Mr.`, `Dr.`).\n *\n * @since 1.0.0\n */\n honorificPrefix?: string;\n\n /**\n * Honorific suffix (e.g. `Esq.`).\n *\n * @since 1.0.0\n */\n honorificSuffix?: string;\n}\n\n/**\n * A generic, repeatable contact field (phone number, email, IM, photo, URL,\n * category).\n *\n * @since 1.0.0\n */\nexport interface ContactField {\n /**\n * The kind of field, e.g. `home`, `work`, `mobile`. For photos, `url` or\n * `base64`.\n *\n * @since 1.0.0\n */\n type?: string;\n\n /**\n * The field value (phone number, email address, URI, etc.).\n *\n * @since 1.0.0\n */\n value?: string;\n\n /**\n * `true` if this is the contact's preferred value for the field.\n *\n * @since 1.0.0\n */\n pref?: boolean;\n\n /**\n * Platform-assigned id of this individual field entry.\n *\n * @since 1.0.0\n */\n id?: string;\n}\n\n/**\n * A postal address of a {@link Contact}.\n *\n * @since 1.0.0\n */\nexport interface ContactAddress {\n /**\n * Platform-assigned id of this address entry.\n *\n * @since 1.0.0\n */\n id?: string;\n\n /**\n * `true` if this is the contact's preferred address.\n *\n * @since 1.0.0\n */\n pref?: boolean;\n\n /**\n * The kind of address, e.g. `home`, `work`.\n *\n * @since 1.0.0\n */\n type?: string;\n\n /**\n * The full address formatted for display.\n *\n * @since 1.0.0\n */\n formatted?: string;\n\n /**\n * The street address.\n *\n * @since 1.0.0\n */\n streetAddress?: string;\n\n /**\n * The city or locality.\n *\n * @since 1.0.0\n */\n locality?: string;\n\n /**\n * The state or region.\n *\n * @since 1.0.0\n */\n region?: string;\n\n /**\n * The ZIP or postal code.\n *\n * @since 1.0.0\n */\n postalCode?: string;\n\n /**\n * The country name.\n *\n * @since 1.0.0\n */\n country?: string;\n}\n\n/**\n * An organization a {@link Contact} belongs to.\n *\n * @since 1.0.0\n */\nexport interface ContactOrganization {\n /**\n * Platform-assigned id of this organization entry. Android only; iOS\n * models the organization as flat contact properties without an id.\n *\n * @since 1.0.0\n */\n id?: string;\n\n /**\n * `true` if this is the contact's preferred organization.\n *\n * @since 1.0.0\n */\n pref?: boolean;\n\n /**\n * The kind of organization, e.g. `work`.\n *\n * @since 1.0.0\n */\n type?: string;\n\n /**\n * The organization name.\n *\n * @since 1.0.0\n */\n name?: string;\n\n /**\n * The department within the organization.\n *\n * @since 1.0.0\n */\n department?: string;\n\n /**\n * The contact's title at the organization.\n *\n * @since 1.0.0\n */\n title?: string;\n}\n"]}
package/dist/esm/web.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { WebPlugin } from '@capacitor/core';
2
- import type { Contact, ContactFindOptions, ContactFindResult, ContactRemoveOptions, ContactSaveOptions, ContactsPlugin, PickContactFieldOptions, PickedContactField } from './definitions';
2
+ import type { Contact, ContactFindOptions, ContactFindResult, ContactRemoveOptions, ContactSaveOptions, ContactsPlugin } from './definitions';
3
3
  /**
4
4
  * Web implementation. The browser has no standardized, broadly-available
5
5
  * contacts database API (the Contact Picker API is limited, gated, and
@@ -11,5 +11,4 @@ export declare class ContactsWeb extends WebPlugin implements ContactsPlugin {
11
11
  save(_options: ContactSaveOptions): Promise<Contact>;
12
12
  remove(_options: ContactRemoveOptions): Promise<void>;
13
13
  pickContact(): Promise<Contact>;
14
- pickContactField(_options: PickContactFieldOptions): Promise<PickedContactField>;
15
14
  }
package/dist/esm/web.js CHANGED
@@ -18,8 +18,5 @@ export class ContactsWeb extends WebPlugin {
18
18
  async pickContact() {
19
19
  throw this.unimplemented('Contacts.pickContact() is not available on web.');
20
20
  }
21
- async pickContactField(_options) {
22
- throw this.unimplemented('Contacts.pickContactField() is not available on web.');
23
- }
24
21
  }
25
22
  //# sourceMappingURL=web.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAa5C;;;;;GAKG;AACH,MAAM,OAAO,WAAY,SAAQ,SAAS;IACxC,KAAK,CAAC,IAAI,CAAC,QAA4B;QACrC,MAAM,IAAI,CAAC,aAAa,CAAC,0CAA0C,CAAC,CAAC;IACvE,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,QAA4B;QACrC,MAAM,IAAI,CAAC,aAAa,CAAC,0CAA0C,CAAC,CAAC;IACvE,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,QAA8B;QACzC,MAAM,IAAI,CAAC,aAAa,CAAC,4CAA4C,CAAC,CAAC;IACzE,CAAC;IAED,KAAK,CAAC,WAAW;QACf,MAAM,IAAI,CAAC,aAAa,CAAC,iDAAiD,CAAC,CAAC;IAC9E,CAAC;IAED,KAAK,CAAC,gBAAgB,CAAC,QAAiC;QACtD,MAAM,IAAI,CAAC,aAAa,CAAC,sDAAsD,CAAC,CAAC;IACnF,CAAC;CACF","sourcesContent":["import { WebPlugin } from '@capacitor/core';\n\nimport type {\n Contact,\n ContactFindOptions,\n ContactFindResult,\n ContactRemoveOptions,\n ContactSaveOptions,\n ContactsPlugin,\n PickContactFieldOptions,\n PickedContactField,\n} from './definitions';\n\n/**\n * Web implementation. The browser has no standardized, broadly-available\n * contacts database API (the Contact Picker API is limited, gated, and\n * read-only), so every method throws `unimplemented()`. The plugin is\n * native-only on iOS and Android.\n */\nexport class ContactsWeb extends WebPlugin implements ContactsPlugin {\n async find(_options: ContactFindOptions): Promise<ContactFindResult> {\n throw this.unimplemented('Contacts.find() is not available on web.');\n }\n\n async save(_options: ContactSaveOptions): Promise<Contact> {\n throw this.unimplemented('Contacts.save() is not available on web.');\n }\n\n async remove(_options: ContactRemoveOptions): Promise<void> {\n throw this.unimplemented('Contacts.remove() is not available on web.');\n }\n\n async pickContact(): Promise<Contact> {\n throw this.unimplemented('Contacts.pickContact() is not available on web.');\n }\n\n async pickContactField(_options: PickContactFieldOptions): Promise<PickedContactField> {\n throw this.unimplemented('Contacts.pickContactField() is not available on web.');\n }\n}\n"]}
1
+ {"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAW5C;;;;;GAKG;AACH,MAAM,OAAO,WAAY,SAAQ,SAAS;IACxC,KAAK,CAAC,IAAI,CAAC,QAA4B;QACrC,MAAM,IAAI,CAAC,aAAa,CAAC,0CAA0C,CAAC,CAAC;IACvE,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,QAA4B;QACrC,MAAM,IAAI,CAAC,aAAa,CAAC,0CAA0C,CAAC,CAAC;IACvE,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,QAA8B;QACzC,MAAM,IAAI,CAAC,aAAa,CAAC,4CAA4C,CAAC,CAAC;IACzE,CAAC;IAED,KAAK,CAAC,WAAW;QACf,MAAM,IAAI,CAAC,aAAa,CAAC,iDAAiD,CAAC,CAAC;IAC9E,CAAC;CACF","sourcesContent":["import { WebPlugin } from '@capacitor/core';\n\nimport type {\n Contact,\n ContactFindOptions,\n ContactFindResult,\n ContactRemoveOptions,\n ContactSaveOptions,\n ContactsPlugin,\n} from './definitions';\n\n/**\n * Web implementation. The browser has no standardized, broadly-available\n * contacts database API (the Contact Picker API is limited, gated, and\n * read-only), so every method throws `unimplemented()`. The plugin is\n * native-only on iOS and Android.\n */\nexport class ContactsWeb extends WebPlugin implements ContactsPlugin {\n async find(_options: ContactFindOptions): Promise<ContactFindResult> {\n throw this.unimplemented('Contacts.find() is not available on web.');\n }\n\n async save(_options: ContactSaveOptions): Promise<Contact> {\n throw this.unimplemented('Contacts.save() is not available on web.');\n }\n\n async remove(_options: ContactRemoveOptions): Promise<void> {\n throw this.unimplemented('Contacts.remove() is not available on web.');\n }\n\n async pickContact(): Promise<Contact> {\n throw this.unimplemented('Contacts.pickContact() is not available on web.');\n }\n}\n"]}
@@ -25,9 +25,6 @@ class ContactsWeb extends core.WebPlugin {
25
25
  async pickContact() {
26
26
  throw this.unimplemented('Contacts.pickContact() is not available on web.');
27
27
  }
28
- async pickContactField(_options) {
29
- throw this.unimplemented('Contacts.pickContactField() is not available on web.');
30
- }
31
28
  }
32
29
 
33
30
  var web = /*#__PURE__*/Object.freeze({
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst Contacts = registerPlugin('Contacts', {\n web: () => import('./web').then((m) => new m.ContactsWeb()),\n});\nexport * from './definitions';\nexport { Contacts };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\n/**\n * Web implementation. The browser has no standardized, broadly-available\n * contacts database API (the Contact Picker API is limited, gated, and\n * read-only), so every method throws `unimplemented()`. The plugin is\n * native-only on iOS and Android.\n */\nexport class ContactsWeb extends WebPlugin {\n async find(_options) {\n throw this.unimplemented('Contacts.find() is not available on web.');\n }\n async save(_options) {\n throw this.unimplemented('Contacts.save() is not available on web.');\n }\n async remove(_options) {\n throw this.unimplemented('Contacts.remove() is not available on web.');\n }\n async pickContact() {\n throw this.unimplemented('Contacts.pickContact() is not available on web.');\n }\n async pickContactField(_options) {\n throw this.unimplemented('Contacts.pickContactField() is not available on web.');\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;AACK,MAAC,QAAQ,GAAGA,mBAAc,CAAC,UAAU,EAAE;AAC5C,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC;AAC/D,CAAC;;ACFD;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,WAAW,SAASC,cAAS,CAAC;AAC3C,IAAI,MAAM,IAAI,CAAC,QAAQ,EAAE;AACzB,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,0CAA0C,CAAC;AAC5E,IAAI;AACJ,IAAI,MAAM,IAAI,CAAC,QAAQ,EAAE;AACzB,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,0CAA0C,CAAC;AAC5E,IAAI;AACJ,IAAI,MAAM,MAAM,CAAC,QAAQ,EAAE;AAC3B,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,4CAA4C,CAAC;AAC9E,IAAI;AACJ,IAAI,MAAM,WAAW,GAAG;AACxB,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,iDAAiD,CAAC;AACnF,IAAI;AACJ,IAAI,MAAM,gBAAgB,CAAC,QAAQ,EAAE;AACrC,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,sDAAsD,CAAC;AACxF,IAAI;AACJ;;;;;;;"}
1
+ {"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst Contacts = registerPlugin('Contacts', {\n web: () => import('./web').then((m) => new m.ContactsWeb()),\n});\nexport * from './definitions';\nexport { Contacts };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\n/**\n * Web implementation. The browser has no standardized, broadly-available\n * contacts database API (the Contact Picker API is limited, gated, and\n * read-only), so every method throws `unimplemented()`. The plugin is\n * native-only on iOS and Android.\n */\nexport class ContactsWeb extends WebPlugin {\n async find(_options) {\n throw this.unimplemented('Contacts.find() is not available on web.');\n }\n async save(_options) {\n throw this.unimplemented('Contacts.save() is not available on web.');\n }\n async remove(_options) {\n throw this.unimplemented('Contacts.remove() is not available on web.');\n }\n async pickContact() {\n throw this.unimplemented('Contacts.pickContact() is not available on web.');\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;AACK,MAAC,QAAQ,GAAGA,mBAAc,CAAC,UAAU,EAAE;AAC5C,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC;AAC/D,CAAC;;ACFD;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,WAAW,SAASC,cAAS,CAAC;AAC3C,IAAI,MAAM,IAAI,CAAC,QAAQ,EAAE;AACzB,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,0CAA0C,CAAC;AAC5E,IAAI;AACJ,IAAI,MAAM,IAAI,CAAC,QAAQ,EAAE;AACzB,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,0CAA0C,CAAC;AAC5E,IAAI;AACJ,IAAI,MAAM,MAAM,CAAC,QAAQ,EAAE;AAC3B,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,4CAA4C,CAAC;AAC9E,IAAI;AACJ,IAAI,MAAM,WAAW,GAAG;AACxB,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,iDAAiD,CAAC;AACnF,IAAI;AACJ;;;;;;;"}
package/dist/plugin.js CHANGED
@@ -24,9 +24,6 @@ var capacitorContacts = (function (exports, core) {
24
24
  async pickContact() {
25
25
  throw this.unimplemented('Contacts.pickContact() is not available on web.');
26
26
  }
27
- async pickContactField(_options) {
28
- throw this.unimplemented('Contacts.pickContactField() is not available on web.');
29
- }
30
27
  }
31
28
 
32
29
  var web = /*#__PURE__*/Object.freeze({
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst Contacts = registerPlugin('Contacts', {\n web: () => import('./web').then((m) => new m.ContactsWeb()),\n});\nexport * from './definitions';\nexport { Contacts };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\n/**\n * Web implementation. The browser has no standardized, broadly-available\n * contacts database API (the Contact Picker API is limited, gated, and\n * read-only), so every method throws `unimplemented()`. The plugin is\n * native-only on iOS and Android.\n */\nexport class ContactsWeb extends WebPlugin {\n async find(_options) {\n throw this.unimplemented('Contacts.find() is not available on web.');\n }\n async save(_options) {\n throw this.unimplemented('Contacts.save() is not available on web.');\n }\n async remove(_options) {\n throw this.unimplemented('Contacts.remove() is not available on web.');\n }\n async pickContact() {\n throw this.unimplemented('Contacts.pickContact() is not available on web.');\n }\n async pickContactField(_options) {\n throw this.unimplemented('Contacts.pickContactField() is not available on web.');\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;AACK,UAAC,QAAQ,GAAGA,mBAAc,CAAC,UAAU,EAAE;IAC5C,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC;IAC/D,CAAC;;ICFD;IACA;IACA;IACA;IACA;IACA;IACO,MAAM,WAAW,SAASC,cAAS,CAAC;IAC3C,IAAI,MAAM,IAAI,CAAC,QAAQ,EAAE;IACzB,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,0CAA0C,CAAC;IAC5E,IAAI;IACJ,IAAI,MAAM,IAAI,CAAC,QAAQ,EAAE;IACzB,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,0CAA0C,CAAC;IAC5E,IAAI;IACJ,IAAI,MAAM,MAAM,CAAC,QAAQ,EAAE;IAC3B,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,4CAA4C,CAAC;IAC9E,IAAI;IACJ,IAAI,MAAM,WAAW,GAAG;IACxB,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,iDAAiD,CAAC;IACnF,IAAI;IACJ,IAAI,MAAM,gBAAgB,CAAC,QAAQ,EAAE;IACrC,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,sDAAsD,CAAC;IACxF,IAAI;IACJ;;;;;;;;;;;"}
1
+ {"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst Contacts = registerPlugin('Contacts', {\n web: () => import('./web').then((m) => new m.ContactsWeb()),\n});\nexport * from './definitions';\nexport { Contacts };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\n/**\n * Web implementation. The browser has no standardized, broadly-available\n * contacts database API (the Contact Picker API is limited, gated, and\n * read-only), so every method throws `unimplemented()`. The plugin is\n * native-only on iOS and Android.\n */\nexport class ContactsWeb extends WebPlugin {\n async find(_options) {\n throw this.unimplemented('Contacts.find() is not available on web.');\n }\n async save(_options) {\n throw this.unimplemented('Contacts.save() is not available on web.');\n }\n async remove(_options) {\n throw this.unimplemented('Contacts.remove() is not available on web.');\n }\n async pickContact() {\n throw this.unimplemented('Contacts.pickContact() is not available on web.');\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;AACK,UAAC,QAAQ,GAAGA,mBAAc,CAAC,UAAU,EAAE;IAC5C,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC;IAC/D,CAAC;;ICFD;IACA;IACA;IACA;IACA;IACA;IACO,MAAM,WAAW,SAASC,cAAS,CAAC;IAC3C,IAAI,MAAM,IAAI,CAAC,QAAQ,EAAE;IACzB,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,0CAA0C,CAAC;IAC5E,IAAI;IACJ,IAAI,MAAM,IAAI,CAAC,QAAQ,EAAE;IACzB,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,0CAA0C,CAAC;IAC5E,IAAI;IACJ,IAAI,MAAM,MAAM,CAAC,QAAQ,EAAE;IAC3B,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,4CAA4C,CAAC;IAC9E,IAAI;IACJ,IAAI,MAAM,WAAW,GAAG;IACxB,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,iDAAiD,CAAC;IACnF,IAAI;IACJ;;;;;;;;;;;"}
@@ -132,25 +132,14 @@ extension Contacts {
132
132
  address["pref"] = false
133
133
  address["type"] = canonicalLabel(labeled.label)
134
134
  address["formatted"] = CNPostalAddressFormatter.string(from: postal, style: .mailingAddress)
135
- address.merge(postalParts(postal)) { _, new in new }
135
+ address["streetAddress"] = postal.street
136
+ address["locality"] = postal.city
137
+ address["region"] = postal.state
138
+ address["postalCode"] = postal.postalCode
139
+ address["country"] = postal.country
136
140
  return address
137
141
  }
138
142
 
139
- /// The postal parts of a `CNPostalAddress`, shared by the full-contact and
140
- /// picked-field results.
141
- ///
142
- /// - Parameter postal: the address to read.
143
- /// - Returns: `streetAddress`, `locality`, `region`, `postalCode` and `country`.
144
- private func postalParts(_ postal: CNPostalAddress) -> [String: Any] {
145
- return [
146
- "streetAddress": postal.street,
147
- "locality": postal.city,
148
- "region": postal.state,
149
- "postalCode": postal.postalCode,
150
- "country": postal.country
151
- ]
152
- }
153
-
154
143
  private func field(id: String?, value: String, type: String) -> [String: Any] {
155
144
  var result: [String: Any] = [:]
156
145
  if let id = id { result["id"] = id }
@@ -186,57 +175,6 @@ extension Contacts {
186
175
  }
187
176
  }
188
177
 
189
- // MARK: - Mapping a picked contact property -> dictionary
190
-
191
- /// The `CNContact` key behind each `pickContactField` kind.
192
- ///
193
- /// - Parameter field: `phone`, `email` or `address`.
194
- /// - Returns: the matching `CNContact` key, or `nil` for an unknown kind.
195
- func pickerPropertyKey(forField field: String) -> String? {
196
- switch field {
197
- case "phone": return CNContactPhoneNumbersKey
198
- case "email": return CNContactEmailAddressesKey
199
- case "address": return CNContactPostalAddressesKey
200
- default: return nil
201
- }
202
- }
203
-
204
- /// Maps the property the user tapped in the system picker to the
205
- /// `pickContactField` result: the picked `value` and its `type` label, plus
206
- /// the contact's `displayName` when available. Same shape Android returns.
207
- ///
208
- /// - Parameters:
209
- /// - contact: the contact the property belongs to.
210
- /// - key: the `CNContact` key of the tapped property.
211
- /// - label: the property's label, e.g. `CNLabelHome`.
212
- /// - value: the property's value (`CNPhoneNumber`, `String` or `CNPostalAddress`).
213
- /// - Returns: the result dictionary, or `nil` when `value` isn't the type
214
- /// expected for `key`.
215
- func pickedPropertyToDictionary(contact: CNContact, key: String, label: String?, value: Any) -> [String: Any]? {
216
- var dict: [String: Any] = [:]
217
- switch (key, value) {
218
- case (CNContactPhoneNumbersKey, let phone as CNPhoneNumber):
219
- dict["field"] = "phone"
220
- dict["value"] = phone.stringValue
221
- case (CNContactEmailAddressesKey, let email as String):
222
- dict["field"] = "email"
223
- dict["value"] = email
224
- case (CNContactPostalAddressesKey, let postal as CNPostalAddress):
225
- dict["field"] = "address"
226
- dict["value"] = CNPostalAddressFormatter.string(from: postal, style: .mailingAddress)
227
- dict["address"] = postalParts(postal)
228
- default:
229
- return nil
230
- }
231
- dict["type"] = canonicalLabel(label)
232
- let fullName = [CNContactFormatter.descriptorForRequiredKeys(for: .fullName)]
233
- if contact.areKeysAvailable(fullName),
234
- let name = CNContactFormatter.string(from: contact, style: .fullName), !name.isEmpty {
235
- dict["displayName"] = name
236
- }
237
- return dict
238
- }
239
-
240
178
  // MARK: - Mapping dictionary -> CNMutableContact
241
179
 
242
180
  func apply(_ dict: [String: Any], to contact: CNMutableContact) {