@symbiote-native/contacts 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.
Files changed (117) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +174 -0
  3. package/build/angular/contact-access-button/index.d.ts +18 -0
  4. package/build/angular/contact-access-button/index.js +123 -0
  5. package/build/angular/index.d.ts +2 -0
  6. package/build/angular/index.js +3 -0
  7. package/build/core/contact-access-button.d.ts +29 -0
  8. package/build/core/contact-access-button.js +27 -0
  9. package/build/core/contact.d.ts +3 -0
  10. package/build/core/contact.js +3 -0
  11. package/build/core/container.d.ts +5 -0
  12. package/build/core/container.js +5 -0
  13. package/build/core/enums.d.ts +53 -0
  14. package/build/core/enums.js +56 -0
  15. package/build/core/group.d.ts +5 -0
  16. package/build/core/group.js +4 -0
  17. package/build/core/index.d.ts +8 -0
  18. package/build/core/index.js +7 -0
  19. package/build/core/listeners.d.ts +3 -0
  20. package/build/core/listeners.js +11 -0
  21. package/build/core/native-module.d.ts +177 -0
  22. package/build/core/native-module.js +63 -0
  23. package/build/core/permissions.d.ts +3 -0
  24. package/build/core/permissions.js +7 -0
  25. package/build/core/types.d.ts +244 -0
  26. package/build/core/types.js +1 -0
  27. package/build/legacy/contacts.d.ts +30 -0
  28. package/build/legacy/contacts.js +177 -0
  29. package/build/legacy/enums.d.ts +68 -0
  30. package/build/legacy/enums.js +73 -0
  31. package/build/legacy/index.d.ts +3 -0
  32. package/build/legacy/index.js +3 -0
  33. package/build/legacy/native-module.d.ts +30 -0
  34. package/build/legacy/native-module.js +4 -0
  35. package/build/legacy/types.d.ts +158 -0
  36. package/build/legacy/types.js +1 -0
  37. package/build/react/contact-access-button.d.ts +10 -0
  38. package/build/react/contact-access-button.js +11 -0
  39. package/build/react/index.d.ts +2 -0
  40. package/build/react/index.js +2 -0
  41. package/build/solid/contact-access-button.d.ts +10 -0
  42. package/build/solid/contact-access-button.js +15 -0
  43. package/build/solid/index.d.ts +2 -0
  44. package/build/solid/index.js +2 -0
  45. package/build/svelte/contact-access-button.svelte +18 -0
  46. package/build/svelte/contact-access-button.svelte.d.ts +4 -0
  47. package/build/svelte/index.d.ts +7 -0
  48. package/build/svelte/index.js +8 -0
  49. package/build/vue/contact-access-button.d.ts +19 -0
  50. package/build/vue/contact-access-button.js +19 -0
  51. package/build/vue/index.d.ts +2 -0
  52. package/build/vue/index.js +2 -0
  53. package/build-ngc/angular/contact-access-button/index.d.ts +21 -0
  54. package/build-ngc/angular/contact-access-button/index.js +59 -0
  55. package/build-ngc/angular/contact-access-button/index.js.map +1 -0
  56. package/build-ngc/angular/index.d.ts +2 -0
  57. package/build-ngc/angular/index.js +4 -0
  58. package/build-ngc/angular/index.js.map +1 -0
  59. package/build-ngc/core/contact-access-button.d.ts +29 -0
  60. package/build-ngc/core/contact-access-button.js +28 -0
  61. package/build-ngc/core/contact-access-button.js.map +1 -0
  62. package/build-ngc/core/contact.d.ts +3 -0
  63. package/build-ngc/core/contact.js +4 -0
  64. package/build-ngc/core/contact.js.map +1 -0
  65. package/build-ngc/core/container.d.ts +5 -0
  66. package/build-ngc/core/container.js +6 -0
  67. package/build-ngc/core/container.js.map +1 -0
  68. package/build-ngc/core/enums.d.ts +53 -0
  69. package/build-ngc/core/enums.js +57 -0
  70. package/build-ngc/core/enums.js.map +1 -0
  71. package/build-ngc/core/group.d.ts +5 -0
  72. package/build-ngc/core/group.js +5 -0
  73. package/build-ngc/core/group.js.map +1 -0
  74. package/build-ngc/core/index.d.ts +8 -0
  75. package/build-ngc/core/index.js +8 -0
  76. package/build-ngc/core/index.js.map +1 -0
  77. package/build-ngc/core/listeners.d.ts +3 -0
  78. package/build-ngc/core/listeners.js +12 -0
  79. package/build-ngc/core/listeners.js.map +1 -0
  80. package/build-ngc/core/native-module.d.ts +177 -0
  81. package/build-ngc/core/native-module.js +64 -0
  82. package/build-ngc/core/native-module.js.map +1 -0
  83. package/build-ngc/core/permissions.d.ts +3 -0
  84. package/build-ngc/core/permissions.js +8 -0
  85. package/build-ngc/core/permissions.js.map +1 -0
  86. package/build-ngc/core/types.d.ts +244 -0
  87. package/build-ngc/core/types.js +2 -0
  88. package/build-ngc/core/types.js.map +1 -0
  89. package/native-link.json +26 -0
  90. package/package.json +152 -0
  91. package/src/angular/contact-access-button/index.ts +45 -0
  92. package/src/angular/index.ts +3 -0
  93. package/src/core/contact-access-button.ts +83 -0
  94. package/src/core/contact.ts +3 -0
  95. package/src/core/container.ts +5 -0
  96. package/src/core/enums.ts +55 -0
  97. package/src/core/group.ts +4 -0
  98. package/src/core/index.ts +14 -0
  99. package/src/core/listeners.ts +19 -0
  100. package/src/core/native-module.ts +281 -0
  101. package/src/core/permissions.ts +10 -0
  102. package/src/core/types.ts +220 -0
  103. package/src/legacy/contacts.ts +274 -0
  104. package/src/legacy/enums.ts +72 -0
  105. package/src/legacy/index.ts +3 -0
  106. package/src/legacy/native-module.ts +66 -0
  107. package/src/legacy/types.ts +159 -0
  108. package/src/react/contact-access-button.ts +20 -0
  109. package/src/react/index.ts +2 -0
  110. package/src/solid/contact-access-button.ts +24 -0
  111. package/src/solid/index.ts +2 -0
  112. package/src/svelte/contact-access-button.svelte +18 -0
  113. package/src/svelte/index.ts +10 -0
  114. package/src/svelte/svelte-ambient.d.ts +3 -0
  115. package/src/svelte/svelte-compile.test-helper.ts +7 -0
  116. package/src/vue/contact-access-button.ts +24 -0
  117. package/src/vue/index.ts +2 -0
@@ -0,0 +1,55 @@
1
+ export enum ContactField {
2
+ IS_FAVOURITE = 'isFavourite',
3
+ FULL_NAME = 'fullName',
4
+ GIVEN_NAME = 'givenName',
5
+ MIDDLE_NAME = 'middleName',
6
+ FAMILY_NAME = 'familyName',
7
+ MAIDEN_NAME = 'maidenName',
8
+ NICKNAME = 'nickname',
9
+ PREFIX = 'prefix',
10
+ SUFFIX = 'suffix',
11
+ PHONETIC_GIVEN_NAME = 'phoneticGivenName',
12
+ PHONETIC_MIDDLE_NAME = 'phoneticMiddleName',
13
+ PHONETIC_FAMILY_NAME = 'phoneticFamilyName',
14
+ COMPANY = 'company',
15
+ PHONETIC_COMPANY_NAME = 'phoneticCompanyName',
16
+ DEPARTMENT = 'department',
17
+ JOB_TITLE = 'jobTitle',
18
+ NOTE = 'note',
19
+ IMAGE = 'image',
20
+ THUMBNAIL = 'thumbnail',
21
+ BIRTHDAY = 'birthday',
22
+ NON_GREGORIAN_BIRTHDAY = 'nonGregorianBirthday',
23
+ EMAILS = 'emails',
24
+ PHONES = 'phones',
25
+ ADDRESSES = 'addresses',
26
+ EXTRA_NAMES = 'extraNames',
27
+ DATES = 'dates',
28
+ RELATIONS = 'relations',
29
+ URL_ADDRESSES = 'urlAddresses',
30
+ SOCIAL_PROFILES = 'socialProfiles',
31
+ IM_ADDRESSES = 'imAddresses',
32
+ }
33
+
34
+ export enum ContactsSortOrder {
35
+ UserDefault = 'userDefault',
36
+ GivenName = 'givenName',
37
+ FamilyName = 'familyName',
38
+ None = 'none',
39
+ }
40
+
41
+ /** @platform ios */
42
+ export enum NonGregorianCalendar {
43
+ buddhist = 'buddhist',
44
+ chinese = 'chinese',
45
+ coptic = 'coptic',
46
+ ethiopicAmeteMihret = 'ethiopicAmeteMihret',
47
+ ethiopicAmeteAlem = 'ethiopicAmeteAlem',
48
+ hebrew = 'hebrew',
49
+ indian = 'indian',
50
+ islamic = 'islamic',
51
+ islamicCivil = 'islamicCivil',
52
+ japanese = 'japanese',
53
+ persian = 'persian',
54
+ republicOfChina = 'republicOfChina',
55
+ }
@@ -0,0 +1,4 @@
1
+ import { expoContactsNext, FallbackGroup } from './native-module';
2
+
3
+ /** @platform ios - Android has no Group concept in expo-contacts. */
4
+ export class Group extends (expoContactsNext.Group ?? FallbackGroup) {}
@@ -0,0 +1,14 @@
1
+ export * from './enums';
2
+ export * from './types';
3
+ export type {
4
+ IContactAccessButtonCaption,
5
+ IContactAccessButtonProps,
6
+ } from './contact-access-button';
7
+ export { Contact } from './contact';
8
+ export { Group } from './group';
9
+ export { Container } from './container';
10
+ export { getPermissionsAsync, requestPermissionsAsync } from './permissions';
11
+ export {
12
+ addContactsChangeListener,
13
+ removeAllContactsChangeListeners,
14
+ } from './listeners';
@@ -0,0 +1,19 @@
1
+ import { UnavailabilityError } from 'expo-modules-core';
2
+ import type { EventSubscription } from 'expo-modules-core';
3
+ import {
4
+ expoContactsNext,
5
+ ON_CONTACTS_CHANGE_EVENT_NAME,
6
+ } from './native-module';
7
+
8
+ export function addContactsChangeListener(
9
+ listener: () => void,
10
+ ): EventSubscription {
11
+ if (!expoContactsNext.addListener) {
12
+ throw new UnavailabilityError('Contacts', 'addContactsChangeListener');
13
+ }
14
+ return expoContactsNext.addListener(ON_CONTACTS_CHANGE_EVENT_NAME, listener);
15
+ }
16
+
17
+ export function removeAllContactsChangeListeners(): void {
18
+ expoContactsNext.removeAllListeners?.(ON_CONTACTS_CHANGE_EVENT_NAME);
19
+ }
@@ -0,0 +1,281 @@
1
+ import { Platform, requireNativeModule } from 'expo-modules-core';
2
+ import type { EventSubscription } from 'expo-modules-core';
3
+ import type {
4
+ ContactDate,
5
+ ContactPatch,
6
+ ContactQueryOptions,
7
+ ContactsPermissionResponse,
8
+ CreateContactRecord,
9
+ CreateFormOptions,
10
+ ExistingAddress,
11
+ ExistingDate,
12
+ ExistingEmail,
13
+ ExistingExtraName,
14
+ ExistingImAddress,
15
+ ExistingPhone,
16
+ ExistingRelation,
17
+ ExistingSocialProfile,
18
+ ExistingUrlAddress,
19
+ FormOptions,
20
+ NewAddress,
21
+ NewDate,
22
+ NewEmail,
23
+ NewExtraName,
24
+ NewImAddress,
25
+ NewPhone,
26
+ NewRelation,
27
+ NewSocialProfile,
28
+ NewUrlAddress,
29
+ NonGregorianBirthday,
30
+ PartialContactDetails,
31
+ } from './types';
32
+ import type { ContactField } from './enums';
33
+
34
+ const EXPO_CONTACTS_NEXT_MODULE_NAME = 'ExpoContactsNext';
35
+ export const ON_CONTACTS_CHANGE_EVENT_NAME = 'contactsDidChange';
36
+
37
+ export declare class NativeContact {
38
+ constructor(id: string);
39
+ readonly id: string;
40
+
41
+ delete(): Promise<void>;
42
+ patch(contact: ContactPatch): Promise<void>;
43
+ update(contact: CreateContactRecord): Promise<void>;
44
+ getDetails<T extends readonly ContactField[]>(
45
+ fields?: T,
46
+ ): Promise<PartialContactDetails<T>>;
47
+
48
+ addEmail(email: NewEmail): Promise<string>;
49
+ getEmails(): Promise<ExistingEmail[]>;
50
+ deleteEmail(email: ExistingEmail): Promise<void>;
51
+ updateEmail(updatedEmail: ExistingEmail): Promise<void>;
52
+
53
+ addPhone(phone: NewPhone): Promise<string>;
54
+ getPhones(): Promise<ExistingPhone[]>;
55
+ deletePhone(phone: ExistingPhone): Promise<void>;
56
+ updatePhone(updatedPhone: ExistingPhone): Promise<void>;
57
+
58
+ addDate(date: NewDate): Promise<string>;
59
+ getDates(): Promise<ExistingDate[]>;
60
+ deleteDate(date: ExistingDate): Promise<void>;
61
+ updateDate(updatedDate: ExistingDate): Promise<void>;
62
+
63
+ /** @platform android */
64
+ addExtraName(extraName: NewExtraName): Promise<string>;
65
+ /** @platform android */
66
+ getExtraNames(): Promise<ExistingExtraName[]>;
67
+ /** @platform android */
68
+ deleteExtraName(extraName: ExistingExtraName | string): Promise<void>;
69
+ /** @platform android */
70
+ updateExtraName(updatedExtraName: ExistingExtraName): Promise<void>;
71
+
72
+ addAddress(address: NewAddress): Promise<string>;
73
+ getAddresses(): Promise<ExistingAddress[]>;
74
+ deleteAddress(address: ExistingAddress): Promise<void>;
75
+ updateAddress(updatedAddress: ExistingAddress): Promise<void>;
76
+
77
+ addRelation(relation: NewRelation): Promise<string>;
78
+ getRelations(): Promise<ExistingRelation[]>;
79
+ deleteRelation(relation: ExistingRelation | string): Promise<void>;
80
+ updateRelation(updatedRelation: ExistingRelation): Promise<void>;
81
+
82
+ addUrlAddress(urlAddress: NewUrlAddress): Promise<string>;
83
+ getUrlAddresses(): Promise<ExistingUrlAddress[]>;
84
+ deleteUrlAddress(urlAddress: ExistingUrlAddress): Promise<void>;
85
+ updateUrlAddress(updatedUrlAddress: ExistingUrlAddress): Promise<void>;
86
+
87
+ /** @platform ios */
88
+ addSocialProfile?(socialProfile: NewSocialProfile): Promise<string>;
89
+ /** @platform ios */
90
+ getSocialProfiles?(): Promise<ExistingSocialProfile[]>;
91
+ /** @platform ios */
92
+ deleteSocialProfile?(socialProfile: ExistingSocialProfile): Promise<void>;
93
+ /** @platform ios */
94
+ updateSocialProfile?(
95
+ updatedSocialProfile: ExistingSocialProfile,
96
+ ): Promise<void>;
97
+
98
+ /** @platform ios */
99
+ addImAddress?(imAddress: NewImAddress): Promise<string>;
100
+ /** @platform ios */
101
+ getImAddresses?(): Promise<ExistingImAddress[]>;
102
+ /** @platform ios */
103
+ deleteImAddress?(imAddress: ExistingImAddress): Promise<void>;
104
+ /** @platform ios */
105
+ updateImAddress?(updatedImAddress: ExistingImAddress): Promise<void>;
106
+
107
+ editWithForm(options?: FormOptions): Promise<boolean>;
108
+ getFullName(): Promise<string>;
109
+
110
+ /** @platform android */
111
+ getIsFavourite?(): Promise<boolean>;
112
+ /** @platform android */
113
+ setIsFavourite?(isFavourite: boolean): Promise<boolean>;
114
+
115
+ getGivenName(): Promise<string | null>;
116
+ setGivenName(givenName: string | null): Promise<boolean>;
117
+ getFamilyName(): Promise<string | null>;
118
+ setFamilyName(familyName: string | null): Promise<boolean>;
119
+ getMiddleName(): Promise<string | null>;
120
+ setMiddleName(middleName: string | null): Promise<boolean>;
121
+
122
+ /** @platform ios */
123
+ getMaidenName?(): Promise<string | null>;
124
+ /** @platform ios */
125
+ setMaidenName?(maidenName: string | null): Promise<boolean>;
126
+ /** @platform ios */
127
+ getNickname?(): Promise<string | null>;
128
+ /** @platform ios */
129
+ setNickname?(nickname: string | null): Promise<boolean>;
130
+
131
+ getPrefix(): Promise<string | null>;
132
+ setPrefix(prefix: string | null): Promise<boolean>;
133
+ getSuffix(): Promise<string | null>;
134
+ setSuffix(suffix: string | null): Promise<boolean>;
135
+ getPhoneticGivenName(): Promise<string | null>;
136
+ setPhoneticGivenName(phoneticGivenName: string | null): Promise<boolean>;
137
+ getPhoneticMiddleName(): Promise<string | null>;
138
+ setPhoneticMiddleName(phoneticMiddleName: string | null): Promise<boolean>;
139
+ getPhoneticFamilyName(): Promise<string | null>;
140
+ setPhoneticFamilyName(phoneticFamilyName: string | null): Promise<boolean>;
141
+ getCompany(): Promise<string | null>;
142
+ setCompany(company: string | null): Promise<boolean>;
143
+ getDepartment(): Promise<string | null>;
144
+ setDepartment(department: string | null): Promise<boolean>;
145
+ getJobTitle(): Promise<string | null>;
146
+ setJobTitle(jobTitle: string | null): Promise<boolean>;
147
+ getPhoneticCompanyName(): Promise<string | null>;
148
+ setPhoneticCompanyName(phoneticCompanyName: string | null): Promise<boolean>;
149
+ getNote(): Promise<string | null>;
150
+ setNote(note: string | null): Promise<boolean>;
151
+ getImage(): Promise<string | null>;
152
+ setImage(imageUri: string | null): Promise<boolean>;
153
+ getThumbnail(): Promise<string | null>;
154
+
155
+ /** @platform ios */
156
+ getBirthday?(): Promise<ContactDate | null>;
157
+ /** @platform ios */
158
+ setBirthday?(birthday: ContactDate | null): Promise<boolean>;
159
+ /** @platform ios */
160
+ getNonGregorianBirthday?(): Promise<NonGregorianBirthday | null>;
161
+ /** @platform ios */
162
+ setNonGregorianBirthday?(
163
+ nonGregorianBirthday: NonGregorianBirthday | null,
164
+ ): Promise<boolean>;
165
+
166
+ static getAll(options?: ContactQueryOptions): Promise<NativeContact[]>;
167
+ static create(contact: CreateContactRecord): Promise<NativeContact>;
168
+ static presentCreateForm(
169
+ contact?: CreateContactRecord,
170
+ options?: CreateFormOptions,
171
+ ): Promise<boolean>;
172
+ static getCount(): Promise<number>;
173
+ static hasAny(): Promise<boolean>;
174
+ static presentPicker(): Promise<NativeContact | null>;
175
+ /** @platform ios */
176
+ static presentAccessPicker?(): Promise<NativeContact[]>;
177
+ static getAllDetails<T extends readonly ContactField[]>(
178
+ fields: T,
179
+ options?: ContactQueryOptions,
180
+ ): Promise<PartialContactDetails<T>[]>;
181
+ }
182
+
183
+ /** @platform ios - Android has no Group concept in expo-contacts. */
184
+ export declare class NativeGroup {
185
+ constructor(id: string);
186
+ readonly id: string;
187
+ getName(): Promise<string | null>;
188
+ setName(name: string): Promise<void>;
189
+ addContact(contact: NativeContact): Promise<void>;
190
+ removeContact(contact: NativeContact): Promise<void>;
191
+ getContacts(options?: ContactQueryOptions): Promise<NativeContact[]>;
192
+ delete(): Promise<void>;
193
+ static create(name: string, containerId?: string): Promise<NativeGroup>;
194
+ static getAll(containerId?: string): Promise<NativeGroup[]>;
195
+ }
196
+
197
+ /** @platform ios - Android has no Container concept in expo-contacts. */
198
+ export declare class NativeContainer {
199
+ constructor(id: string);
200
+ readonly id: string;
201
+ getName(): Promise<string | null>;
202
+ getType(): Promise<string | null>;
203
+ getGroups(): Promise<NativeGroup[]>;
204
+ getContacts(): Promise<NativeContact[]>;
205
+ static getAll(): Promise<NativeContainer[]>;
206
+ static getDefault(): Promise<NativeContainer | null>;
207
+ }
208
+
209
+ export class FallbackGroup {
210
+ constructor(public readonly id: string) {}
211
+ getName(): Promise<string | null> {
212
+ throw new Error('Not implemented');
213
+ }
214
+ setName(_name: string): Promise<void> {
215
+ throw new Error('Not implemented');
216
+ }
217
+ addContact(_contact: NativeContact): Promise<void> {
218
+ throw new Error('Not implemented');
219
+ }
220
+ removeContact(_contact: NativeContact): Promise<void> {
221
+ throw new Error('Not implemented');
222
+ }
223
+ getContacts(): Promise<NativeContact[]> {
224
+ throw new Error('Not implemented');
225
+ }
226
+ delete(): Promise<void> {
227
+ throw new Error('Not implemented');
228
+ }
229
+ static create(_name: string, _containerId?: string): Promise<FallbackGroup> {
230
+ throw new Error('Not implemented');
231
+ }
232
+ static getAll(_containerId?: string): Promise<FallbackGroup[]> {
233
+ throw new Error('Not implemented');
234
+ }
235
+ }
236
+
237
+ export class FallbackContainer {
238
+ constructor(public readonly id: string) {}
239
+ getName(): Promise<string | null> {
240
+ throw new Error('Not implemented');
241
+ }
242
+ getType(): Promise<string | null> {
243
+ throw new Error('Not implemented');
244
+ }
245
+ getGroups(): Promise<FallbackGroup[]> {
246
+ throw new Error('Not implemented');
247
+ }
248
+ getContacts(): Promise<NativeContact[]> {
249
+ throw new Error('Not implemented');
250
+ }
251
+ static getAll(): Promise<FallbackContainer[]> {
252
+ throw new Error('Not implemented');
253
+ }
254
+ static getDefault(): Promise<FallbackContainer | null> {
255
+ throw new Error('Not implemented');
256
+ }
257
+ }
258
+
259
+ export type INativeContactsNextModule = {
260
+ ContactNext?: typeof NativeContact;
261
+ Contact: typeof NativeContact;
262
+ Group?: typeof NativeGroup;
263
+ Container?: typeof NativeContainer;
264
+ getPermissionsAsync(): Promise<ContactsPermissionResponse>;
265
+ requestPermissionsAsync(): Promise<ContactsPermissionResponse>;
266
+ addListener?(
267
+ eventName: typeof ON_CONTACTS_CHANGE_EVENT_NAME,
268
+ listener: () => void,
269
+ ): EventSubscription;
270
+ removeAllListeners?(eventName: typeof ON_CONTACTS_CHANGE_EVENT_NAME): void;
271
+ };
272
+
273
+ export const expoContactsNext = requireNativeModule<INativeContactsNextModule>(
274
+ EXPO_CONTACTS_NEXT_MODULE_NAME,
275
+ );
276
+
277
+ // iOS registers the class as `ContactNext` (distinct from the deprecated legacy `Contact` JS
278
+ // class); Android registers it directly as `Contact`. Alias so both platforms expose `.Contact`.
279
+ if (Platform.OS === 'ios' && expoContactsNext.ContactNext) {
280
+ expoContactsNext.Contact = expoContactsNext.ContactNext;
281
+ }
@@ -0,0 +1,10 @@
1
+ import { expoContactsNext } from './native-module';
2
+ import type { ContactsPermissionResponse } from './types';
3
+
4
+ export async function getPermissionsAsync(): Promise<ContactsPermissionResponse> {
5
+ return expoContactsNext.getPermissionsAsync();
6
+ }
7
+
8
+ export async function requestPermissionsAsync(): Promise<ContactsPermissionResponse> {
9
+ return expoContactsNext.requestPermissionsAsync();
10
+ }
@@ -0,0 +1,220 @@
1
+ import type { PermissionResponse } from 'expo-modules-core';
2
+ import type {
3
+ ContactField,
4
+ ContactsSortOrder,
5
+ NonGregorianCalendar,
6
+ } from './enums';
7
+
8
+ export type ContactsPermissionResponse = PermissionResponse & {
9
+ accessPrivileges?: 'all' | 'limited' | 'none';
10
+ };
11
+
12
+ export type ContactQueryOptions = {
13
+ limit?: number;
14
+ offset?: number;
15
+ sortOrder?: ContactsSortOrder;
16
+ name?: string;
17
+ /** @platform ios */
18
+ rawContacts?: boolean;
19
+ };
20
+
21
+ export type FormOptions = {
22
+ displayedPropertyKeys?: ContactField[];
23
+ message?: string;
24
+ alternateName?: string;
25
+ allowsEditing?: boolean;
26
+ allowsActions?: boolean;
27
+ shouldShowLinkedContacts?: boolean;
28
+ isNew?: boolean;
29
+ cancelButtonTitle?: string;
30
+ showsCancelButton?: boolean;
31
+ preventAnimation?: boolean;
32
+ groupId?: string;
33
+ };
34
+
35
+ export type CreateFormOptions = {
36
+ cancelButtonTitle?: string;
37
+ showsCancelButton?: boolean;
38
+ preventAnimation?: boolean;
39
+ };
40
+
41
+ export type NewEmail = { label?: string; address?: string };
42
+ export type ExistingEmail = NewEmail & { id: string };
43
+ export type NewPhone = { label?: string; number?: string };
44
+ export type ExistingPhone = NewPhone & { id: string };
45
+ export type NewDate = { label?: string; date?: ContactDate };
46
+ export type ExistingDate = NewDate & { id: string };
47
+ export type NewExtraName = { label?: string; name?: string };
48
+ export type ExistingExtraName = NewExtraName & { id: string };
49
+ export type NewAddress = {
50
+ label?: string;
51
+ street?: string;
52
+ city?: string;
53
+ state?: string;
54
+ postcode?: string;
55
+ region?: string;
56
+ country?: string;
57
+ };
58
+ export type ExistingAddress = NewAddress & { id: string };
59
+ export type NewRelation = { label?: string; name?: string };
60
+ export type ExistingRelation = NewRelation & { id: string };
61
+ export type NewUrlAddress = { label?: string; url?: string };
62
+ export type ExistingUrlAddress = NewUrlAddress & { id: string };
63
+ export type NewImAddress = {
64
+ label?: string;
65
+ username?: string;
66
+ service?: string;
67
+ };
68
+ export type ExistingImAddress = NewImAddress & { id: string };
69
+ export type NewSocialProfile = {
70
+ label?: string;
71
+ username?: string;
72
+ service?: string;
73
+ url?: string;
74
+ userId?: string;
75
+ };
76
+ export type ExistingSocialProfile = NewSocialProfile & { id: string };
77
+
78
+ export type ContactDate = { year?: number; month: number; day: number };
79
+
80
+ /** @platform ios */
81
+ export type NonGregorianBirthday = {
82
+ year?: number;
83
+ month: number;
84
+ day: number;
85
+ calendar: NonGregorianCalendar;
86
+ };
87
+
88
+ export type ContactPatch = {
89
+ isFavourite?: boolean | null;
90
+ givenName?: string | null;
91
+ middleName?: string | null;
92
+ familyName?: string | null;
93
+ nickname?: string | null;
94
+ maidenName?: string | null;
95
+ prefix?: string | null;
96
+ suffix?: string | null;
97
+ phoneticGivenName?: string | null;
98
+ phoneticMiddleName?: string | null;
99
+ phoneticFamilyName?: string | null;
100
+ company?: string | null;
101
+ department?: string | null;
102
+ jobTitle?: string | null;
103
+ phoneticCompanyName?: string | null;
104
+ note?: string | null;
105
+ image?: string | null;
106
+ birthday?: ContactDate | null;
107
+ nonGregorianBirthday?: NonGregorianBirthday | null;
108
+ emails?: (ExistingEmail | NewEmail)[];
109
+ phones?: (ExistingPhone | NewPhone)[];
110
+ dates?: (ExistingDate | NewDate)[];
111
+ extraNames?: (ExistingExtraName | NewExtraName)[];
112
+ addresses?: (ExistingAddress | NewAddress)[];
113
+ relations?: (ExistingRelation | NewRelation)[];
114
+ urlAddresses?: (ExistingUrlAddress | NewUrlAddress)[];
115
+ socialProfiles?: (ExistingSocialProfile | NewSocialProfile)[];
116
+ imAddresses?: (ExistingImAddress | NewImAddress)[];
117
+ };
118
+
119
+ export type CreateContactRecord = {
120
+ isFavourite?: boolean;
121
+ givenName?: string;
122
+ middleName?: string;
123
+ familyName?: string;
124
+ maidenName?: string;
125
+ nickname?: string;
126
+ prefix?: string;
127
+ suffix?: string;
128
+ phoneticGivenName?: string;
129
+ phoneticMiddleName?: string;
130
+ phoneticFamilyName?: string;
131
+ company?: string;
132
+ department?: string;
133
+ jobTitle?: string;
134
+ phoneticCompanyName?: string;
135
+ note?: string;
136
+ image?: string;
137
+ birthday?: ContactDate;
138
+ nonGregorianBirthday?: NonGregorianBirthday;
139
+ emails?: NewEmail[];
140
+ dates?: NewDate[];
141
+ phones?: NewPhone[];
142
+ addresses?: NewAddress[];
143
+ relations?: NewRelation[];
144
+ urlAddresses?: NewUrlAddress[];
145
+ imAddresses?: NewImAddress[];
146
+ socialProfiles?: NewSocialProfile[];
147
+ extraNames?: NewExtraName[];
148
+ };
149
+
150
+ export type ContactDetails = {
151
+ isFavourite: boolean;
152
+ fullName: string | null;
153
+ givenName: string | null;
154
+ middleName: string | null;
155
+ familyName: string | null;
156
+ maidenName?: string | null;
157
+ nickname?: string | null;
158
+ prefix: string | null;
159
+ suffix: string | null;
160
+ phoneticGivenName: string | null;
161
+ phoneticMiddleName: string | null;
162
+ phoneticFamilyName: string | null;
163
+ company: string | null;
164
+ department: string | null;
165
+ jobTitle?: string;
166
+ phoneticCompanyName?: string;
167
+ note: string | null;
168
+ image: string | null;
169
+ thumbnail: string | null;
170
+ birthday?: ContactDate | null;
171
+ nonGregorianBirthday?: NonGregorianBirthday | null;
172
+ emails: ExistingEmail[];
173
+ dates: ExistingDate[];
174
+ phones: ExistingPhone[];
175
+ extraNames: ExistingExtraName[];
176
+ addresses: ExistingAddress[];
177
+ relations: ExistingRelation[];
178
+ urlAddresses: ExistingUrlAddress[];
179
+ socialProfiles: ExistingSocialProfile[];
180
+ imAddresses: ExistingImAddress[];
181
+ };
182
+
183
+ export type ContactFieldKey = {
184
+ [ContactField.IS_FAVOURITE]: 'isFavourite';
185
+ [ContactField.FULL_NAME]: 'fullName';
186
+ [ContactField.GIVEN_NAME]: 'givenName';
187
+ [ContactField.MIDDLE_NAME]: 'middleName';
188
+ [ContactField.FAMILY_NAME]: 'familyName';
189
+ [ContactField.MAIDEN_NAME]: 'maidenName';
190
+ [ContactField.NICKNAME]: 'nickname';
191
+ [ContactField.PREFIX]: 'prefix';
192
+ [ContactField.SUFFIX]: 'suffix';
193
+ [ContactField.PHONETIC_GIVEN_NAME]: 'phoneticGivenName';
194
+ [ContactField.PHONETIC_MIDDLE_NAME]: 'phoneticMiddleName';
195
+ [ContactField.PHONETIC_FAMILY_NAME]: 'phoneticFamilyName';
196
+ [ContactField.COMPANY]: 'company';
197
+ [ContactField.PHONETIC_COMPANY_NAME]: 'phoneticCompanyName';
198
+ [ContactField.DEPARTMENT]: 'department';
199
+ [ContactField.JOB_TITLE]: 'jobTitle';
200
+ [ContactField.NOTE]: 'note';
201
+ [ContactField.IMAGE]: 'image';
202
+ [ContactField.THUMBNAIL]: 'thumbnail';
203
+ [ContactField.BIRTHDAY]: 'birthday';
204
+ [ContactField.NON_GREGORIAN_BIRTHDAY]: 'nonGregorianBirthday';
205
+ [ContactField.EMAILS]: 'emails';
206
+ [ContactField.PHONES]: 'phones';
207
+ [ContactField.ADDRESSES]: 'addresses';
208
+ [ContactField.DATES]: 'dates';
209
+ [ContactField.EXTRA_NAMES]: 'extraNames';
210
+ [ContactField.RELATIONS]: 'relations';
211
+ [ContactField.URL_ADDRESSES]: 'urlAddresses';
212
+ [ContactField.SOCIAL_PROFILES]: 'socialProfiles';
213
+ [ContactField.IM_ADDRESSES]: 'imAddresses';
214
+ };
215
+
216
+ export type PartialContactDetails<T extends readonly ContactField[]> = {
217
+ id: string;
218
+ } & {
219
+ [K in T[number]]: ContactDetails[K];
220
+ };