@comapeo/core-react 9.0.2 → 10.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.
Files changed (73) hide show
  1. package/README.md +1 -1
  2. package/dist/commonjs/contexts/ClientApi.d.ts +1 -3
  3. package/dist/commonjs/contexts/ClientApi.js +2 -2
  4. package/dist/commonjs/hooks/client.d.ts +74 -33
  5. package/dist/commonjs/hooks/client.js +40 -11
  6. package/dist/commonjs/hooks/documents.d.ts +41 -429
  7. package/dist/commonjs/hooks/documents.js +101 -51
  8. package/dist/commonjs/hooks/invites.d.ts +153 -55
  9. package/dist/commonjs/hooks/invites.js +69 -20
  10. package/dist/commonjs/hooks/maps.d.ts +96 -225
  11. package/dist/commonjs/hooks/maps.js +104 -37
  12. package/dist/commonjs/hooks/projects.d.ts +666 -223
  13. package/dist/commonjs/hooks/projects.js +264 -131
  14. package/dist/commonjs/index.d.ts +2 -2
  15. package/dist/commonjs/lib/map-shares-stores.d.ts +1 -1
  16. package/dist/commonjs/lib/map-shares-stores.js +2 -2
  17. package/dist/commonjs/lib/presets.d.ts +1 -3
  18. package/dist/commonjs/lib/react-query.d.ts +103 -0
  19. package/dist/commonjs/lib/react-query.js +187 -0
  20. package/dist/commonjs/lib/sync.d.ts +2 -5
  21. package/dist/commonjs/lib/sync.js +0 -1
  22. package/dist/commonjs/lib/types.d.ts +4 -6
  23. package/dist/esm/contexts/ClientApi.d.ts +1 -3
  24. package/dist/esm/contexts/ClientApi.js +1 -1
  25. package/dist/esm/hooks/client.d.ts +74 -33
  26. package/dist/esm/hooks/client.js +40 -11
  27. package/dist/esm/hooks/documents.d.ts +41 -429
  28. package/dist/esm/hooks/documents.js +101 -51
  29. package/dist/esm/hooks/invites.d.ts +153 -55
  30. package/dist/esm/hooks/invites.js +69 -20
  31. package/dist/esm/hooks/maps.d.ts +96 -225
  32. package/dist/esm/hooks/maps.js +105 -38
  33. package/dist/esm/hooks/projects.d.ts +666 -223
  34. package/dist/esm/hooks/projects.js +262 -129
  35. package/dist/esm/index.d.ts +2 -2
  36. package/dist/esm/lib/map-shares-stores.d.ts +1 -1
  37. package/dist/esm/lib/map-shares-stores.js +1 -1
  38. package/dist/esm/lib/presets.d.ts +1 -3
  39. package/dist/esm/lib/react-query.d.ts +103 -0
  40. package/dist/esm/lib/react-query.js +162 -0
  41. package/dist/esm/lib/sync.d.ts +2 -5
  42. package/dist/esm/lib/sync.js +1 -1
  43. package/dist/esm/lib/types.d.ts +4 -6
  44. package/docs/API.md +137 -81
  45. package/package.json +39 -35
  46. package/dist/commonjs/lib/react-query/client.d.ts +0 -65
  47. package/dist/commonjs/lib/react-query/client.js +0 -68
  48. package/dist/commonjs/lib/react-query/documents.d.ts +0 -1484
  49. package/dist/commonjs/lib/react-query/documents.js +0 -149
  50. package/dist/commonjs/lib/react-query/invites.d.ts +0 -88
  51. package/dist/commonjs/lib/react-query/invites.js +0 -95
  52. package/dist/commonjs/lib/react-query/maps.d.ts +0 -104
  53. package/dist/commonjs/lib/react-query/maps.js +0 -129
  54. package/dist/commonjs/lib/react-query/mutation-result.d.ts +0 -8
  55. package/dist/commonjs/lib/react-query/mutation-result.js +0 -22
  56. package/dist/commonjs/lib/react-query/projects.d.ts +0 -316
  57. package/dist/commonjs/lib/react-query/projects.js +0 -359
  58. package/dist/commonjs/lib/react-query/shared.d.ts +0 -9
  59. package/dist/commonjs/lib/react-query/shared.js +0 -23
  60. package/dist/esm/lib/react-query/client.d.ts +0 -65
  61. package/dist/esm/lib/react-query/client.js +0 -59
  62. package/dist/esm/lib/react-query/documents.d.ts +0 -1484
  63. package/dist/esm/lib/react-query/documents.js +0 -137
  64. package/dist/esm/lib/react-query/invites.d.ts +0 -88
  65. package/dist/esm/lib/react-query/invites.js +0 -85
  66. package/dist/esm/lib/react-query/maps.d.ts +0 -104
  67. package/dist/esm/lib/react-query/maps.js +0 -119
  68. package/dist/esm/lib/react-query/mutation-result.d.ts +0 -8
  69. package/dist/esm/lib/react-query/mutation-result.js +0 -19
  70. package/dist/esm/lib/react-query/projects.d.ts +0 -316
  71. package/dist/esm/lib/react-query/projects.js +0 -324
  72. package/dist/esm/lib/react-query/shared.d.ts +0 -9
  73. package/dist/esm/lib/react-query/shared.js +0 -18
package/docs/API.md CHANGED
@@ -17,6 +17,7 @@
17
17
  - [createMapServerApi](#createmapserverapi)
18
18
  - [MapServerProvider](#mapserverprovider)
19
19
  - [useMapServerApi](#usemapserverapi)
20
+ - [ComapeoCoreProvider](#comapeocoreprovider)
20
21
  - [useProjectSettings](#useprojectsettings)
21
22
  - [useSingleProject](#usesingleproject)
22
23
  - [useManyProjects](#usemanyprojects)
@@ -60,6 +61,9 @@
60
61
  - [useSendInvite](#usesendinvite)
61
62
  - [useRequestCancelInvite](#userequestcancelinvite)
62
63
  - [useMapStyleUrl](#usemapstyleurl)
64
+ - [useImportCustomMapFile](#useimportcustommapfile)
65
+ - [useRemoveCustomMapFile](#useremovecustommapfile)
66
+ - [useGetCustomMapInfo](#usegetcustommapinfo)
63
67
  - [useManyReceivedMapShares](#usemanyreceivedmapshares)
64
68
  - [useSingleReceivedMapShare](#usesinglereceivedmapshare)
65
69
  - [useDownloadReceivedMapShare](#usedownloadreceivedmapshare)
@@ -75,7 +79,7 @@ Create a context provider that holds a CoMapeo API client instance.
75
79
 
76
80
  | Function | Type |
77
81
  | ---------- | ---------- |
78
- | `ClientApiProvider` | `({ children, clientApi, }: PropsWithChildren<{ clientApi: any; }>) => Element` |
82
+ | `ClientApiProvider` | `({ children, clientApi, }: ClientApiProviderProps) => Element` |
79
83
 
80
84
  Parameters:
81
85
 
@@ -122,7 +126,7 @@ Retrieve info about the current device.
122
126
 
123
127
  | Function | Type |
124
128
  | ---------- | ---------- |
125
- | `useOwnDeviceInfo` | `() => { data: any; error: Error or null; isRefetching: boolean; }` |
129
+ | `useOwnDeviceInfo` | `() => Pick<UseSuspenseQueryResult<any>, "data" or "error" or "isRefetching">` |
126
130
 
127
131
  Examples:
128
132
 
@@ -156,7 +160,7 @@ Update the device info for the current device.
156
160
 
157
161
  | Function | Type |
158
162
  | ---------- | ---------- |
159
- | `useSetOwnDeviceInfo` | `() => { error: Error; mutate: UseMutateFunction<any, Error, { name: string; deviceType: "device_type_unspecified" or "mobile" or "tablet" or "desktop" or "selfHostedServer" or "UNRECOGNIZED"; }, unknown>; mutateAsync: UseMutateAsyncFunction<...>; reset: () => void; status: "error"; } or { ...; }` |
163
+ | `useSetOwnDeviceInfo` | `() => Pick<Override<MutationObserverIdleResult<any, Error, { name: string; deviceType: DeviceInfo; }, unknown>, { mutate: UseMutateFunction<any, Error, { name: string; deviceType: DeviceInfo; }, unknown>; }> and { ...; }, "error" or ... 3 more ... or "mutateAsync"> or Pick<...> or Pick<...> or Pick<...>` |
160
164
 
161
165
  ### useSetIsArchiveDevice
162
166
 
@@ -164,13 +168,13 @@ Set or unset the current device as an archive device.
164
168
 
165
169
  | Function | Type |
166
170
  | ---------- | ---------- |
167
- | `useSetIsArchiveDevice` | `() => { error: Error; mutate: UseMutateFunction<any, Error, { isArchiveDevice: boolean; }, unknown>; mutateAsync: UseMutateAsyncFunction<any, Error, { isArchiveDevice: boolean; }, unknown>; reset: () => void; status: "error"; } or { ...; }` |
171
+ | `useSetIsArchiveDevice` | `() => Pick<Override<MutationObserverIdleResult<any, Error, { isArchiveDevice: boolean; }, unknown>, { mutate: UseMutateFunction<any, Error, { isArchiveDevice: boolean; }, unknown>; }> and { ...; }, "error" or ... 3 more ... or "mutateAsync"> or Pick<...> or Pick<...> or Pick<...>` |
168
172
 
169
173
  ### ReceivedMapSharesProvider
170
174
 
171
175
  | Function | Type |
172
176
  | ---------- | ---------- |
173
- | `ReceivedMapSharesProvider` | `({ children, clientApi, mapServerApi, }: MapSharesProviderProps) => Element` |
177
+ | `ReceivedMapSharesProvider` | `({ children, clientApi, mapServerApi, queryClient, }: { clientApi: any; mapServerApi: MapServerApi; } and { children?: ReactNode; } and { queryClient: QueryClient; }) => Element` |
174
178
 
175
179
  ### SentMapSharesProvider
176
180
 
@@ -236,7 +240,7 @@ for the map server to be ready before making requests.
236
240
 
237
241
  | Function | Type |
238
242
  | ---------- | ---------- |
239
- | `MapServerProvider` | `({ children, getBaseUrl, fetch, }: MapServerProviderProps) => Element` |
243
+ | `MapServerProvider` | `({ children, getBaseUrl, fetch, queryClient, }: MapServerProviderProps) => Element` |
240
244
 
241
245
  Parameters:
242
246
 
@@ -279,13 +283,19 @@ Throws if used outside of MapServerProvider.
279
283
  | ---------- | ---------- |
280
284
  | `useMapServerApi` | `() => MapServerApi` |
281
285
 
286
+ ### ComapeoCoreProvider
287
+
288
+ | Function | Type |
289
+ | ---------- | ---------- |
290
+ | `ComapeoCoreProvider` | `({ children, clientApi, getMapServerBaseUrl, fetch, queryClient, }: ComapeoCoreProviderProps) => Element` |
291
+
282
292
  ### useProjectSettings
283
293
 
284
294
  Retrieve the project settings for a project.
285
295
 
286
296
  | Function | Type |
287
297
  | ---------- | ---------- |
288
- | `useProjectSettings` | `({ projectId }: { projectId: string; }) => { data: any; error: Error or null; isRefetching: boolean; }` |
298
+ | `useProjectSettings` | `({ projectId, }: { projectId: string; }) => Pick<UseSuspenseQueryResult<any>, "data" or "error" or "isRefetching">` |
289
299
 
290
300
  Parameters:
291
301
 
@@ -311,7 +321,7 @@ This is mostly used internally by the other hooks and should only be used if cer
311
321
 
312
322
  | Function | Type |
313
323
  | ---------- | ---------- |
314
- | `useSingleProject` | `({ projectId }: { projectId: string; }) => { data: any; error: Error or null; isRefetching: boolean; }` |
324
+ | `useSingleProject` | `({ projectId, }: { projectId: string; }) => Pick<UseSuspenseQueryResult<any>, "data" or "error" or "isRefetching">` |
315
325
 
316
326
  Parameters:
317
327
 
@@ -333,7 +343,7 @@ Retrieve project information for each project that exists.
333
343
 
334
344
  | Function | Type |
335
345
  | ---------- | ---------- |
336
- | `useManyProjects` | `() => { data: any; error: Error or null; isRefetching: boolean; }` |
346
+ | `useManyProjects` | `() => Pick<UseSuspenseQueryResult<any>, "data" or "error" or "isRefetching">` |
337
347
 
338
348
  Examples:
339
349
 
@@ -352,7 +362,7 @@ Retrieve a single member of a project.
352
362
 
353
363
  | Function | Type |
354
364
  | ---------- | ---------- |
355
- | `useSingleMember` | `({ projectId, deviceId, }: { projectId: string; deviceId: string; }) => { data: any; error: Error or null; isRefetching: boolean; }` |
365
+ | `useSingleMember` | `({ projectId, deviceId, }: { projectId: string; deviceId: string; }) => Pick<UseSuspenseQueryResult<any>, "data" or "error" or "isRefetching">` |
356
366
 
357
367
  Parameters:
358
368
 
@@ -377,7 +387,7 @@ Retrieve all members of a project.
377
387
 
378
388
  | Function | Type |
379
389
  | ---------- | ---------- |
380
- | `useManyMembers` | `({ projectId }: { projectId: string; }) => { data: any; error: Error or null; isRefetching: boolean; }` |
390
+ | `useManyMembers` | `<T extends boolean>({ projectId, includeLeft, }: { projectId: string; includeLeft?: T or undefined; }) => Pick<UseSuspenseQueryResult<T extends true ? MemberInfo[] : ActiveMemberInfo[]>, "data" or ... 1 more ... or "isRefetching">` |
381
391
 
382
392
  Parameters:
383
393
 
@@ -388,9 +398,10 @@ Examples:
388
398
 
389
399
  ```tsx
390
400
  function BasicExample() {
391
- const { data } = useManyMembers({ projectId: '...' })
401
+ const activeMembers1 = useManyMembers({ projectId: '...' })
402
+ const activeMembers2 = useManyMembers({ projectId: '...', includeLeft: false })
392
403
 
393
- console.log(data.role)
404
+ const allMembers = useManyMembers({ projectId: '...', includeLeft: true })
394
405
  }
395
406
  ```
396
407
 
@@ -534,7 +545,7 @@ This is a more convenient alternative to using the `useOwnDeviceInfo` and `useMa
534
545
 
535
546
  | Function | Type |
536
547
  | ---------- | ---------- |
537
- | `useOwnRoleInProject` | `({ projectId }: { projectId: string; }) => { data: any; error: Error or null; isRefetching: boolean; }` |
548
+ | `useOwnRoleInProject` | `({ projectId, }: { projectId: string; }) => Pick<UseSuspenseQueryResult<any>, "data" or "error" or "isRefetching">` |
538
549
 
539
550
  Parameters:
540
551
 
@@ -556,13 +567,13 @@ function BasicExample() {
556
567
 
557
568
  | Function | Type |
558
569
  | ---------- | ---------- |
559
- | `useAddServerPeer` | `({ projectId }: { projectId: string; }) => { error: Error; mutate: UseMutateFunction<any, Error, { baseUrl: string; dangerouslyAllowInsecureConnections?: boolean or undefined; }, unknown>; mutateAsync: UseMutateAsyncFunction<...>; reset: () => void; status: "error"; } or { ...; }` |
570
+ | `useAddServerPeer` | `({ projectId }: { projectId: string; }) => Pick<Override<MutationObserverIdleResult<any, Error, { baseUrl: string; dangerouslyAllowInsecureConnections?: boolean or undefined; }, unknown>, { ...; }> and { ...; }, "error" or ... 3 more ... or "mutateAsync"> or Pick<...> or Pick<...> or Pick<...>` |
560
571
 
561
572
  ### useRemoveServerPeer
562
573
 
563
574
  | Function | Type |
564
575
  | ---------- | ---------- |
565
- | `useRemoveServerPeer` | `({ projectId }: { projectId: string; }) => { error: Error; mutate: UseMutateFunction<any, Error, { serverDeviceId: string; dangerouslyAllowInsecureConnections?: boolean or undefined; }, unknown>; mutateAsync: UseMutateAsyncFunction<...>; reset: () => void; status: "error"; } or { ...; }` |
576
+ | `useRemoveServerPeer` | `({ projectId }: { projectId: string; }) => Pick<Override<MutationObserverIdleResult<any, Error, { serverDeviceId: string; dangerouslyAllowInsecureConnections?: boolean or undefined; }, unknown>, { ...; }> and { ...; }, "error" or ... 3 more ... or "mutateAsync"> or Pick<...> or Pick<...> or Pick<...>` |
566
577
 
567
578
  ### useCreateProject
568
579
 
@@ -570,7 +581,7 @@ Create a new project.
570
581
 
571
582
  | Function | Type |
572
583
  | ---------- | ---------- |
573
- | `useCreateProject` | `() => { error: Error; mutate: UseMutateFunction<any, Error, { name?: string or undefined; configPath?: string or undefined; } or undefined, unknown>; mutateAsync: UseMutateAsyncFunction<...>; reset: () => void; status: "error"; } or { ...; }` |
584
+ | `useCreateProject` | `() => Pick<Override<MutationObserverIdleResult<any, Error, any, unknown>, { mutate: UseMutateFunction<any, Error, any, unknown>; }> and { ...; }, "error" or ... 3 more ... or "mutateAsync"> or Pick<...> or Pick<...> or Pick<...>` |
574
585
 
575
586
  ### useLeaveProject
576
587
 
@@ -578,7 +589,7 @@ Leave an existing project.
578
589
 
579
590
  | Function | Type |
580
591
  | ---------- | ---------- |
581
- | `useLeaveProject` | `() => { error: Error; mutate: UseMutateFunction<any, Error, { projectId: string; }, unknown>; mutateAsync: UseMutateAsyncFunction<any, Error, { projectId: string; }, unknown>; reset: () => void; status: "error"; } or { ...; }` |
592
+ | `useLeaveProject` | `() => Pick<Override<MutationObserverIdleResult<any, Error, { projectId: string; }, unknown>, { mutate: UseMutateFunction<any, Error, { projectId: string; }, unknown>; }> and { ...; }, "error" or ... 3 more ... or "mutateAsync"> or Pick<...> or Pick<...> or Pick<...>` |
582
593
 
583
594
  ### useImportProjectCategories
584
595
 
@@ -586,7 +597,7 @@ Update the categories of a project using an external file.
586
597
 
587
598
  | Function | Type |
588
599
  | ---------- | ---------- |
589
- | `useImportProjectCategories` | `({ projectId, }: { projectId: string; }) => { error: Error; mutate: UseMutateFunction<unknown, Error, { filePath: string; }, unknown>; mutateAsync: UseMutateAsyncFunction<unknown, Error, { filePath: string; }, unknown>; reset: () => void; status: "error"; } or { ...; }` |
600
+ | `useImportProjectCategories` | `({ projectId, }: { projectId: string; }) => Pick<Override<MutationObserverIdleResult<unknown, Error, { filePath: string; }, unknown>, { mutate: UseMutateFunction<unknown, Error, { filePath: string; }, unknown>; }> and { ...; }, "error" or ... 3 more ... or "mutateAsync"> or Pick<...> or Pick<...> or Pick<...>` |
590
601
 
591
602
  Parameters:
592
603
 
@@ -599,7 +610,7 @@ Update the configuration of a project using an external file.
599
610
 
600
611
  | Function | Type |
601
612
  | ---------- | ---------- |
602
- | `useImportProjectConfig` | `({ projectId }: { projectId: string; }) => { error: Error; mutate: UseMutateFunction<unknown, Error, { configPath: string; }, unknown>; mutateAsync: UseMutateAsyncFunction<unknown, Error, { configPath: string; }, unknown>; reset: () => void; status: "error"; } or { ...; }` |
613
+ | `useImportProjectConfig` | `({ projectId }: { projectId: string; }) => Pick<Override<MutationObserverIdleResult<unknown, Error, { configPath: string; }, unknown>, { mutate: UseMutateFunction<unknown, Error, { configPath: string; }, unknown>; }> and { ...; }, "error" or ... 3 more ... or "mutateAsync"> or Pick<...> or Pick<...> or Pick<...>` |
603
614
 
604
615
  Parameters:
605
616
 
@@ -612,7 +623,7 @@ Update the settings of a project.
612
623
 
613
624
  | Function | Type |
614
625
  | ---------- | ---------- |
615
- | `useUpdateProjectSettings` | `({ projectId }: { projectId: string; }) => { error: Error; mutate: UseMutateFunction<any, Error, Partial<EditableProjectSettings>, unknown>; mutateAsync: UseMutateAsyncFunction<...>; reset: () => void; status: "error"; } or { ...; }` |
626
+ | `useUpdateProjectSettings` | `({ projectId, }: { projectId: string; }) => FilteredMutationResult<UseMutationResult<EditableProjectSettings, Error, Partial<EditableProjectSettings>>>` |
616
627
 
617
628
  Parameters:
618
629
 
@@ -625,7 +636,7 @@ Change a project member's role.
625
636
 
626
637
  | Function | Type |
627
638
  | ---------- | ---------- |
628
- | `useChangeMemberRole` | `({ projectId }: { projectId: string; }) => { error: Error; mutate: UseMutateFunction<any, Error, { deviceId: string; roleId: "f7c150f5a3a9a855" or "012fd2d431c0bf60" or "9e6d29263cba36c9"; }, unknown>; mutateAsync: UseMutateAsyncFunction<...>; reset: () => void; status: "error"; } or { ...; }` |
639
+ | `useChangeMemberRole` | `({ projectId }: { projectId: string; }) => Pick<Override<MutationObserverIdleResult<any, Error, { deviceId: string; roleId: "f7c150f5a3a9a855" or "012fd2d431c0bf60" or "9e6d29263cba36c9"; }, unknown>, { ...; }> and { ...; }, "error" or ... 3 more ... or "mutateAsync"> or Pick<...> or Pick<...> or Pick<...>` |
629
640
 
630
641
  Parameters:
631
642
 
@@ -651,7 +662,7 @@ Do NOT use this for removing your own device from a project. Use `useLeaveProjec
651
662
 
652
663
  | Function | Type |
653
664
  | ---------- | ---------- |
654
- | `useRemoveMember` | `({ projectId }: { projectId: string; }) => { error: Error; mutate: UseMutateFunction<any, Error, { deviceId: string; reason?: string or undefined; }, unknown>; mutateAsync: UseMutateAsyncFunction<...>; reset: () => void; status: "error"; } or { ...; }` |
665
+ | `useRemoveMember` | `({ projectId }: { projectId: string; }) => Pick<Override<MutationObserverIdleResult<any, Error, { deviceId: string; reason?: string or undefined; }, unknown>, { mutate: UseMutateFunction<...>; }> and { ...; }, "error" or ... 3 more ... or "mutateAsync"> or Pick<...> or Pick<...> or Pick<...>` |
655
666
 
656
667
  Parameters:
657
668
 
@@ -680,29 +691,31 @@ based on role change events that are received in the background.
680
691
 
681
692
  | Function | Type |
682
693
  | ---------- | ---------- |
683
- | `useProjectOwnRoleChangeListener` | `({ projectId, listener, }: { projectId: string; listener?: ((event: RoleChangeEvent) => void) or undefined; }) => void` |
684
-
685
- Parameters:
686
-
687
- * `opts.listener`: Optional listener to invoke when role changes
688
-
694
+ | `useProjectOwnRoleChangeListener` | `({ projectId, }: { projectId: string; }) => void` |
689
695
 
690
696
  Examples:
691
697
 
692
698
  ```tsx
693
- function SomeComponent({ projectId }: { projectId: string }) {
699
+ function ListenerComponent({ projectId }: { projectId: string }) {
700
+ // Set up the listener
694
701
  useProjectOwnRoleChangeListener({ projectId })
695
702
  }
696
- ```
697
- ```tsx
698
- function ComponentWithListener({ projectId }: { projectId: string }) {
699
- useProjectOwnRoleChangeListener({
700
- projectId,
701
- listener: (event) => {
702
- // Handle role change, e.g., navigate to default project
703
- console.log('New role:', event.role)
703
+
704
+ // Handle role change events separately
705
+ function EventHandlerComponent() {
706
+ const { data: projectApi } = useSingleProject({ projectId })
707
+
708
+ useEffect(() => {
709
+ function handleRoleChangeEvent(event) {
710
+ // Do something with event...
704
711
  }
705
- })
712
+
713
+ projectApi.addListener('own-role-change', handleRoleChangeEvent)
714
+
715
+ return () => {
716
+ projectApi.removeListener('own-role-change', handleRoleChangeEvent)
717
+ }
718
+ }, [projectApi])
706
719
  }
707
720
  ```
708
721
 
@@ -713,7 +726,7 @@ Create a blob for a project.
713
726
 
714
727
  | Function | Type |
715
728
  | ---------- | ---------- |
716
- | `useCreateBlob` | `({ projectId }: { projectId: string; }) => { error: Error; mutate: UseMutateFunction<any, Error, { original: string; preview?: string or undefined; thumbnail?: string or undefined; metadata: Metadata; }, unknown>; mutateAsync: UseMutateAsyncFunction<...>; reset: () => void; status: "error"; } or { ...; }` |
729
+ | `useCreateBlob` | `({ projectId }: { projectId: string; }) => Pick<Override<MutationObserverIdleResult<any, Error, { original: string; preview?: string or undefined; thumbnail?: string or undefined; metadata: Metadata; }, unknown>, { ...; }> and { ...; }, "error" or ... 3 more ... or "mutateAsync"> or Pick<...> or Pick<...> or Pick<...>` |
717
730
 
718
731
  Parameters:
719
732
 
@@ -768,31 +781,31 @@ Returns:
768
781
 
769
782
  | Function | Type |
770
783
  | ---------- | ---------- |
771
- | `useStartSync` | `({ projectId }: { projectId: string; }) => { error: Error; mutate: UseMutateFunction<any, Error, { autostopDataSyncAfter: number or null; } or undefined, unknown>; mutateAsync: UseMutateAsyncFunction<...>; reset: () => void; status: "error"; } or { ...; }` |
784
+ | `useStartSync` | `({ projectId }: { projectId: string; }) => Pick<Override<MutationObserverIdleResult<any, Error, { autostopDataSyncAfter: number or null; } or undefined, unknown>, { ...; }> and { ...; }, "error" or ... 3 more ... or "mutateAsync"> or Pick<...> or Pick<...> or Pick<...>` |
772
785
 
773
786
  ### useStopSync
774
787
 
775
788
  | Function | Type |
776
789
  | ---------- | ---------- |
777
- | `useStopSync` | `({ projectId }: { projectId: string; }) => { error: Error; mutate: UseMutateFunction<any, Error, void, unknown>; mutateAsync: UseMutateAsyncFunction<any, Error, void, unknown>; reset: () => void; status: "error"; } or { ...; }` |
790
+ | `useStopSync` | `({ projectId }: { projectId: string; }) => Pick<Override<MutationObserverIdleResult<any, Error, void, unknown>, { mutate: UseMutateFunction<any, Error, void, unknown>; }> and { ...; }, "error" or ... 3 more ... or "mutateAsync"> or Pick<...> or Pick<...> or Pick<...>` |
778
791
 
779
792
  ### useConnectSyncServers
780
793
 
781
794
  | Function | Type |
782
795
  | ---------- | ---------- |
783
- | `useConnectSyncServers` | `({ projectId }: { projectId: string; }) => { error: Error; mutate: UseMutateFunction<any, Error, void, unknown>; mutateAsync: UseMutateAsyncFunction<any, Error, void, unknown>; reset: () => void; status: "error"; } or { ...; }` |
796
+ | `useConnectSyncServers` | `({ projectId }: { projectId: string; }) => Pick<Override<MutationObserverIdleResult<any, Error, void, unknown>, { mutate: UseMutateFunction<any, Error, void, unknown>; }> and { ...; }, "error" or ... 3 more ... or "mutateAsync"> or Pick<...> or Pick<...> or Pick<...>` |
784
797
 
785
798
  ### useDisconnectSyncServers
786
799
 
787
800
  | Function | Type |
788
801
  | ---------- | ---------- |
789
- | `useDisconnectSyncServers` | `({ projectId }: { projectId: string; }) => { error: Error; mutate: UseMutateFunction<any, Error, void, unknown>; mutateAsync: UseMutateAsyncFunction<any, Error, void, unknown>; reset: () => void; status: "error"; } or { ...; }` |
802
+ | `useDisconnectSyncServers` | `({ projectId }: { projectId: string; }) => Pick<Override<MutationObserverIdleResult<any, Error, void, unknown>, { mutate: UseMutateFunction<any, Error, void, unknown>; }> and { ...; }, "error" or ... 3 more ... or "mutateAsync"> or Pick<...> or Pick<...> or Pick<...>` |
790
803
 
791
804
  ### useSetAutostopDataSyncTimeout
792
805
 
793
806
  | Function | Type |
794
807
  | ---------- | ---------- |
795
- | `useSetAutostopDataSyncTimeout` | `({ projectId, }: { projectId: string; }) => { error: Error; mutate: UseMutateFunction<any, Error, { after: number or null; }, unknown>; mutateAsync: UseMutateAsyncFunction<any, Error, { ...; }, unknown>; reset: () => void; status: "error"; } or { ...; }` |
808
+ | `useSetAutostopDataSyncTimeout` | `({ projectId, }: { projectId: string; }) => Pick<Override<MutationObserverIdleResult<any, Error, { after: number or null; }, unknown>, { mutate: UseMutateFunction<any, Error, { ...; }, unknown>; }> and { ...; }, "error" or ... 3 more ... or "mutateAsync"> or Pick<...> or Pick<...> or Pick<...>` |
796
809
 
797
810
  ### useExportGeoJSON
798
811
 
@@ -800,7 +813,7 @@ Creates a GeoJson file with all the observations and/or tracks in the project.
800
813
 
801
814
  | Function | Type |
802
815
  | ---------- | ---------- |
803
- | `useExportGeoJSON` | `({ projectId }: { projectId: string; }) => { error: Error; mutate: UseMutateFunction<any, Error, { path: string; exportOptions: { observations?: boolean or undefined; tracks?: boolean or undefined; lang?: string or undefined; }; }, unknown>; mutateAsync: UseMutateAsyncFunction<...>; reset: () => void; status: "error"; ...` |
816
+ | `useExportGeoJSON` | `({ projectId }: { projectId: string; }) => Pick<Override<MutationObserverIdleResult<any, Error, { path: string; exportOptions: { observations?: boolean or undefined; tracks?: boolean or undefined; lang?: string or undefined; }; }, unknown>, { ...; }> and { ...; }, "error" or ... 3 more ... or "mutateAsync"> or Pick<...> or P...` |
804
817
 
805
818
  Parameters:
806
819
 
@@ -813,7 +826,7 @@ Creates a zip file containing a GeoJson file with all the observations and/or tr
813
826
 
814
827
  | Function | Type |
815
828
  | ---------- | ---------- |
816
- | `useExportZipFile` | `({ projectId }: { projectId: string; }) => { error: Error; mutate: UseMutateFunction<any, Error, { path: string; exportOptions: { observations?: boolean or undefined; tracks?: boolean or undefined; lang?: string or undefined; attachments?: boolean or undefined; }; }, unknown>; mutateAsync: UseMutateAsyncFunction<...>; r...` |
829
+ | `useExportZipFile` | `({ projectId }: { projectId: string; }) => Pick<Override<MutationObserverIdleResult<any, Error, { path: string; exportOptions: { observations?: boolean or undefined; tracks?: boolean or undefined; lang?: string or undefined; attachments?: boolean or undefined; }; }, unknown>, { ...; }> and { ...; }, "error" or ... 3 more ....` |
817
830
 
818
831
  Parameters:
819
832
 
@@ -828,7 +841,7 @@ Triggers the closest error boundary if the document cannot be found
828
841
 
829
842
  | Function | Type |
830
843
  | ---------- | ---------- |
831
- | `useSingleDocByDocId` | `<D extends WriteableDocumentType>({ projectId, docType, docId, lang, }: { projectId: string; docType: D; docId: string; lang?: string or undefined; }) => { data: any; error: Error or null; isRefetching: boolean; }` |
844
+ | `useSingleDocByDocId` | `<D extends WriteableDocumentType>({ projectId, docType, docId, lang, }: { projectId: string; docType: D; docId: string; lang?: string or undefined; }) => Pick<UseSuspenseQueryResult<any>, "data" or "error" or "isRefetching">` |
832
845
 
833
846
  Parameters:
834
847
 
@@ -861,7 +874,7 @@ Triggers the closest error boundary if the document cannot be found.
861
874
 
862
875
  | Function | Type |
863
876
  | ---------- | ---------- |
864
- | `useSingleDocByVersionId` | `<D extends WriteableDocumentType>({ projectId, docType, versionId, lang, }: { projectId: string; docType: D; versionId: string; lang?: string or undefined; }) => { data: any; error: Error or null; isRefetching: boolean; }` |
877
+ | `useSingleDocByVersionId` | `<D extends WriteableDocumentType>({ projectId, docType, versionId, lang, }: { projectId: string; docType: D; versionId: string; lang?: string or undefined; }) => Pick<UseSuspenseQueryResult<any>, "data" or "error" or "isRefetching">` |
865
878
 
866
879
  Parameters:
867
880
 
@@ -894,7 +907,7 @@ Retrieve all documents of a specific `docType`.
894
907
 
895
908
  | Function | Type |
896
909
  | ---------- | ---------- |
897
- | `useManyDocs` | `<D extends WriteableDocumentType>({ projectId, docType, includeDeleted, lang, }: { projectId: string; docType: D; includeDeleted?: boolean or undefined; lang?: string or undefined; }) => { data: any; error: Error or null; isRefetching: boolean; }` |
910
+ | `useManyDocs` | `<D extends WriteableDocumentType>({ projectId, docType, includeDeleted, lang, }: { projectId: string; docType: D; includeDeleted?: boolean or undefined; lang?: string or undefined; }) => Pick<UseSuspenseQueryResult<any>, "data" or ... 1 more ... or "isRefetching">` |
898
911
 
899
912
  Parameters:
900
913
 
@@ -938,7 +951,7 @@ Create a document for a project.
938
951
 
939
952
  | Function | Type |
940
953
  | ---------- | ---------- |
941
- | `useCreateDocument` | `<D extends WriteableDocumentType>({ docType, projectId, }: { docType: D; projectId: string; }) => { error: Error; mutate: UseMutateFunction<WriteableDocument<D> and DerivedDocFields, Error, { ...; }, unknown>; mutateAsync: UseMutateAsyncFunction<...>; reset: () => void; status: "error"; } or { ...; }` |
954
+ | `useCreateDocument` | `<D extends WriteableDocumentType>({ docType, projectId, }: { docType: D; projectId: string; }) => FilteredMutationResult<UseMutationResult<any, Error, { value: Omit<any, "schemaName">; }>>` |
942
955
 
943
956
  Parameters:
944
957
 
@@ -952,7 +965,7 @@ Update a document within a project.
952
965
 
953
966
  | Function | Type |
954
967
  | ---------- | ---------- |
955
- | `useUpdateDocument` | `<D extends WriteableDocumentType>({ docType, projectId, }: { docType: D; projectId: string; }) => { error: Error; mutate: UseMutateFunction<WriteableDocument<D> and DerivedDocFields, Error, { ...; }, unknown>; mutateAsync: UseMutateAsyncFunction<...>; reset: () => void; status: "error"; } or { ...; }` |
968
+ | `useUpdateDocument` | `<D extends WriteableDocumentType>({ docType, projectId, }: { docType: D; projectId: string; }) => FilteredMutationResult<UseMutationResult<any, Error, { value: Omit<any, "schemaName">; }>>` |
956
969
 
957
970
  Parameters:
958
971
 
@@ -966,7 +979,7 @@ Delete a document within a project.
966
979
 
967
980
  | Function | Type |
968
981
  | ---------- | ---------- |
969
- | `useDeleteDocument` | `<D extends WriteableDocumentType>({ docType, projectId, }: { docType: D; projectId: string; }) => { error: Error; mutate: UseMutateFunction<WriteableDocument<D> and DerivedDocFields, Error, { ...; }, unknown>; mutateAsync: UseMutateAsyncFunction<...>; reset: () => void; status: "error"; } or { ...; }` |
982
+ | `useDeleteDocument` | `<D extends WriteableDocumentType>({ docType, projectId, }: { docType: D; projectId: string; }) => FilteredMutationResult<UseMutationResult<any, Error, { docId: string; }>>` |
970
983
 
971
984
  Parameters:
972
985
 
@@ -983,7 +996,7 @@ specified data type. Falls back to alphabetical order (by preset name) if no def
983
996
 
984
997
  | Function | Type |
985
998
  | ---------- | ---------- |
986
- | `usePresetsSelection` | `({ projectId, dataType, lang, }: { projectId: string; dataType: "track" or "observation"; lang?: string or undefined; }) => { schemaName: "preset"; name: string; geometry: ("point" or "vertex" or "line" or "area" or "relation")[]; ... 13 more ...; deleted: boolean; }[]` |
999
+ | `usePresetsSelection` | `({ projectId, dataType, lang, }: { projectId: string; dataType: "observation" or "track"; lang?: string or undefined; }) => Preset[]` |
987
1000
 
988
1001
  Parameters:
989
1002
 
@@ -1019,7 +1032,7 @@ Get all invites that the device has received.
1019
1032
 
1020
1033
  | Function | Type |
1021
1034
  | ---------- | ---------- |
1022
- | `useManyInvites` | `() => { data: any; error: Error or null; isRefetching: boolean; }` |
1035
+ | `useManyInvites` | `() => Pick<UseSuspenseQueryResult<Invite[]>, "data" or "error" or "isRefetching">` |
1023
1036
 
1024
1037
  Examples:
1025
1038
 
@@ -1036,7 +1049,7 @@ Get a single invite based on its ID.
1036
1049
 
1037
1050
  | Function | Type |
1038
1051
  | ---------- | ---------- |
1039
- | `useSingleInvite` | `({ inviteId }: { inviteId: string; }) => { data: any; error: Error or null; isRefetching: boolean; }` |
1052
+ | `useSingleInvite` | `({ inviteId, }: { inviteId: string; }) => Pick<UseSuspenseQueryResult<Invite>, "data" or "error" or "isRefetching">` |
1040
1053
 
1041
1054
  Parameters:
1042
1055
 
@@ -1058,7 +1071,7 @@ Accept an invite that has been received.
1058
1071
 
1059
1072
  | Function | Type |
1060
1073
  | ---------- | ---------- |
1061
- | `useAcceptInvite` | `() => { error: Error; mutate: UseMutateFunction<any, Error, { inviteId: string; }, unknown>; mutateAsync: UseMutateAsyncFunction<any, Error, { inviteId: string; }, unknown>; reset: () => void; status: "error"; } or { ...; }` |
1074
+ | `useAcceptInvite` | `() => Pick<Override<MutationObserverIdleResult<any, Error, { inviteId: string; }, unknown>, { mutate: UseMutateFunction<any, Error, { inviteId: string; }, unknown>; }> and { ...; }, "error" or ... 3 more ... or "mutateAsync"> or Pick<...> or Pick<...> or Pick<...>` |
1062
1075
 
1063
1076
  ### useRejectInvite
1064
1077
 
@@ -1066,7 +1079,7 @@ Reject an invite that has been received.
1066
1079
 
1067
1080
  | Function | Type |
1068
1081
  | ---------- | ---------- |
1069
- | `useRejectInvite` | `() => { error: Error; mutate: UseMutateFunction<any, Error, { inviteId: string; }, unknown>; mutateAsync: UseMutateAsyncFunction<any, Error, { inviteId: string; }, unknown>; reset: () => void; status: "error"; } or { ...; }` |
1082
+ | `useRejectInvite` | `() => Pick<Override<MutationObserverIdleResult<any, Error, { inviteId: string; }, unknown>, { mutate: UseMutateFunction<any, Error, { inviteId: string; }, unknown>; }> and { ...; }, "error" or ... 3 more ... or "mutateAsync"> or Pick<...> or Pick<...> or Pick<...>` |
1070
1083
 
1071
1084
  ### useSendInvite
1072
1085
 
@@ -1074,7 +1087,7 @@ Send an invite for a project.
1074
1087
 
1075
1088
  | Function | Type |
1076
1089
  | ---------- | ---------- |
1077
- | `useSendInvite` | `({ projectId }: { projectId: string; }) => { error: Error; mutate: UseMutateFunction<any, Error, { deviceId: string; roleDescription?: string or undefined; roleId: "f7c150f5a3a9a855" or "012fd2d431c0bf60" or "9e6d29263cba36c9"; roleName?: string or undefined; }, unknown>; mutateAsync: UseMutateAsyncFunction<...>; reset:...` |
1090
+ | `useSendInvite` | `({ projectId }: { projectId: string; }) => Pick<Override<MutationObserverIdleResult<any, Error, { deviceId: string; roleDescription?: string or undefined; roleId: "f7c150f5a3a9a855" or "012fd2d431c0bf60" or "9e6d29263cba36c9"; roleName?: string or undefined; }, unknown>, { ...; }> and { ...; }, "error" or ... 3 more ... or ...` |
1078
1091
 
1079
1092
  Parameters:
1080
1093
 
@@ -1087,7 +1100,7 @@ Request a cancellation of an invite sent to another device.
1087
1100
 
1088
1101
  | Function | Type |
1089
1102
  | ---------- | ---------- |
1090
- | `useRequestCancelInvite` | `({ projectId }: { projectId: string; }) => { error: Error; mutate: UseMutateFunction<any, Error, { deviceId: string; }, unknown>; mutateAsync: UseMutateAsyncFunction<any, Error, { ...; }, unknown>; reset: () => void; status: "error"; } or { ...; }` |
1103
+ | `useRequestCancelInvite` | `({ projectId }: { projectId: string; }) => Pick<Override<MutationObserverIdleResult<any, Error, { deviceId: string; }, unknown>, { mutate: UseMutateFunction<any, Error, { deviceId: string; }, unknown>; }> and { ...; }, "error" or ... 3 more ... or "mutateAsync"> or Pick<...> or Pick<...> or Pick<...>` |
1091
1104
 
1092
1105
  Parameters:
1093
1106
 
@@ -1103,7 +1116,7 @@ due to hidden internal details by consuming components (e.g. map component from
1103
1116
 
1104
1117
  | Function | Type |
1105
1118
  | ---------- | ---------- |
1106
- | `useMapStyleUrl` | `({ refreshToken, }?: { refreshToken?: string or undefined; }) => { data: string; error: Error or null; isRefetching: boolean; }` |
1119
+ | `useMapStyleUrl` | `() => { data: string; error: Error or null; isRefetching: boolean; }` |
1107
1120
 
1108
1121
  Parameters:
1109
1122
 
@@ -1130,6 +1143,37 @@ function ExampleWithRefreshToken() {
1130
1143
  ```
1131
1144
 
1132
1145
 
1146
+ ### useImportCustomMapFile
1147
+
1148
+ Import a custom SMP map file, replacing any existing custom map. The mutation
1149
+ resolves once the file is successfully uploaded and processed by the server.
1150
+
1151
+ | Function | Type |
1152
+ | ---------- | ---------- |
1153
+ | `useImportCustomMapFile` | `() => Pick<Override<MutationObserverIdleResult<Response, Error, { file: File or ExpoFileDuckType; }, unknown>, { mutate: UseMutateFunction<...>; }> and { ...; }, "error" or ... 3 more ... or "mutateAsync"> or Pick<...> or Pick<...> or Pick<...>` |
1154
+
1155
+ Examples:
1156
+
1157
+ ```tsx
1158
+ function MapImportExample() {
1159
+ const { mutate: importMap } = useImportCustomMapFile()
1160
+
1161
+ }
1162
+ ```
1163
+
1164
+
1165
+ ### useRemoveCustomMapFile
1166
+
1167
+ | Function | Type |
1168
+ | ---------- | ---------- |
1169
+ | `useRemoveCustomMapFile` | `() => Pick<Override<MutationObserverIdleResult<Response, Error, void, unknown>, { mutate: UseMutateFunction<Response, Error, void, unknown>; }> and { ...; }, "error" or ... 3 more ... or "mutateAsync"> or Pick<...> or Pick<...> or Pick<...>` |
1170
+
1171
+ ### useGetCustomMapInfo
1172
+
1173
+ | Function | Type |
1174
+ | ---------- | ---------- |
1175
+ | `useGetCustomMapInfo` | `() => { data: any; error: Error or null; isRefetching: boolean; }` |
1176
+
1133
1177
  ### useManyReceivedMapShares
1134
1178
 
1135
1179
  Get all map shares that the device has received. Automatically updates when
@@ -1194,7 +1238,7 @@ start (e.g. if the shareId if invalid).
1194
1238
 
1195
1239
  | Function | Type |
1196
1240
  | ---------- | ---------- |
1197
- | `useDownloadReceivedMapShare` | `() => Pick<Override<MutationObserverIdleResult<Promise<void>, Error, Omit<DownloadMapShareOptions, "projectId">, unknown>, { ...; }> and { ...; }, "error" or ... 3 more ... or "mutateAsync"> or Pick<...> or Pick<...> or Pick<...>` |
1241
+ | `useDownloadReceivedMapShare` | `() => Pick<Override<MutationObserverIdleResult<void, Error, DownloadMapShareOptions, unknown>, { mutate: UseMutateFunction<void, Error, DownloadMapShareOptions, unknown>; }> and { ...; }, "error" or ... 3 more ... or "mutateAsync"> or Pick<...> or Pick<...> or Pick<...>` |
1198
1242
 
1199
1243
  Examples:
1200
1244
 
@@ -1218,16 +1262,17 @@ Throws if decline request fails (e.g. network error)
1218
1262
 
1219
1263
  | Function | Type |
1220
1264
  | ---------- | ---------- |
1221
- | `useDeclineReceivedMapShare` | `() => Pick<Override<MutationObserverIdleResult<Promise<void>, Error, Omit<DeclineMapShareOptions, "projectId">, unknown>, { ...; }> and { ...; }, "error" or ... 3 more ... or "mutateAsync"> or Pick<...> or Pick<...> or Pick<...>` |
1265
+ | `useDeclineReceivedMapShare` | `() => Pick<Override<MutationObserverIdleResult<void, Error, DeclineMapShareOptions, unknown>, { mutate: UseMutateFunction<void, Error, DeclineMapShareOptions, unknown>; }> and { ...; }, "error" or ... 3 more ... or "mutateAsync"> or Pick<...> or Pick<...> or Pick<...>` |
1222
1266
 
1223
1267
  Examples:
1224
1268
 
1225
1269
  ```tsx
1270
+ import { DeclineReason } from '@comapeo/core-react'
1226
1271
  function DeclineButton({ shareId }: { shareId: string }) {
1227
1272
  const { mutate: decline } = useDeclineMapShare()
1228
1273
 
1229
1274
  return (
1230
- <button onClick={() => decline({ shareId, reason: 'user_rejected' })}>
1275
+ <button onClick={() => decline({ shareId, reason: DeclineReason.user_rejected })}>
1231
1276
  Decline
1232
1277
  </button>
1233
1278
  )
@@ -1244,7 +1289,7 @@ Throws if shareId is invalid
1244
1289
 
1245
1290
  | Function | Type |
1246
1291
  | ---------- | ---------- |
1247
- | `useAbortReceivedMapShareDownload` | `() => Pick<Override<MutationObserverIdleResult<Promise<void>, Error, Omit<AbortMapShareOptions, "projectId">, unknown>, { ...; }> and { ...; }, "error" or ... 3 more ... or "mutateAsync"> or Pick<...> or Pick<...> or Pick<...>` |
1292
+ | `useAbortReceivedMapShareDownload` | `() => Pick<Override<MutationObserverIdleResult<void, Error, AbortMapShareOptions, unknown>, { mutate: UseMutateFunction<void, Error, AbortMapShareOptions, unknown>; }> and { ...; }, "error" or ... 3 more ... or "mutateAsync"> or Pick<...> or Pick<...> or Pick<...>` |
1248
1293
 
1249
1294
  Examples:
1250
1295
 
@@ -1266,7 +1311,7 @@ can be used to track the share status with `useSingleSentMapShare`.
1266
1311
 
1267
1312
  | Function | Type |
1268
1313
  | ---------- | ---------- |
1269
- | `useSendMapShare` | `({ projectId }: { projectId: string; }) => Pick<Override<MutationObserverIdleResult<Promise<ServerMapShareState>, Error, CreateAndSendMapShareOptions, unknown>, { ...; }> and { ...; }, "error" or ... 3 more ... or "mutateAsync"> or Pick<...> or Pick<...> or Pick<...>` |
1314
+ | `useSendMapShare` | `() => Pick<Override<MutationObserverIdleResult<ServerMapShareState, Error, CreateAndSendMapShareOptions, unknown>, { mutate: UseMutateFunction<ServerMapShareState, Error, CreateAndSendMapShareOptions, unknown>; }> and { ...; }, "error" or ... 3 more ... or "mutateAsync"> or Pick<...> or Pick<...> or Pick<...>` |
1270
1315
 
1271
1316
  Parameters:
1272
1317
 
@@ -1277,17 +1322,21 @@ Examples:
1277
1322
 
1278
1323
  ```tsx
1279
1324
  function SendMapButton({ projectId, deviceId }: { projectId: string; deviceId: string }) {
1280
- const { mutate: send } = useSendMapShare({ projectId }, {
1281
- onSuccess: (mapShare) => {
1282
- console.log('Share sent with id', mapShare.shareId)
1283
- }
1284
- })
1285
-
1286
- return (
1287
- <button onClick={() => send({ receiverDeviceId: deviceId, mapId: 'custom' })}>
1288
- Send Map
1289
- </button>
1290
- )
1325
+ const { mutate: send } = useSendMapShare()
1326
+
1327
+ return (
1328
+ <button
1329
+ onClick={() =>
1330
+ send({ projectId, receiverDeviceId: deviceId, mapId: 'custom' }, {
1331
+ onSuccess: (mapShare) => {
1332
+ console.log('Share sent with id', mapShare.shareId)
1333
+ }
1334
+ )
1335
+ }
1336
+ >
1337
+ Send Map
1338
+ </button>
1339
+ )
1291
1340
  }
1292
1341
  ```
1293
1342
 
@@ -1302,7 +1351,7 @@ is already complete, this action will throw an error.
1302
1351
 
1303
1352
  | Function | Type |
1304
1353
  | ---------- | ---------- |
1305
- | `useCancelSentMapShare` | `() => Pick<Override<MutationObserverIdleResult<Promise<void>, Error, Omit<CancelMapShareOptions, "projectId">, unknown>, { ...; }> and { ...; }, "error" or ... 3 more ... or "mutateAsync"> or Pick<...> or Pick<...> or Pick<...>` |
1354
+ | `useCancelSentMapShare` | `() => Pick<Override<MutationObserverIdleResult<void, Error, CancelMapShareOptions, unknown>, { mutate: UseMutateFunction<void, Error, CancelMapShareOptions, unknown>; }> and { ...; }, "error" or ... 3 more ... or "mutateAsync"> or Pick<...> or Pick<...> or Pick<...>` |
1306
1355
 
1307
1356
  Parameters:
1308
1357
 
@@ -1390,25 +1439,32 @@ function SentShareStatus({ shareId }: { shareId: string }) {
1390
1439
 
1391
1440
  ## Types
1392
1441
 
1442
+ - [ClientApiProviderProps](#clientapiproviderprops)
1393
1443
  - [MapServerApiOptions](#mapserverapioptions)
1394
1444
  - [MapServerApi](#mapserverapi)
1395
1445
  - [MapServerProviderProps](#mapserverproviderprops)
1396
1446
 
1447
+ ### ClientApiProviderProps
1448
+
1449
+ | Type | Type |
1450
+ | ---------- | ---------- |
1451
+ | `ClientApiProviderProps` | `PropsWithChildren<{ clientApi: MapeoClientApi }>` |
1452
+
1397
1453
  ### MapServerApiOptions
1398
1454
 
1399
1455
  | Type | Type |
1400
1456
  | ---------- | ---------- |
1401
- | `MapServerApiOptions` | `{ getBaseUrl(): Promise<URL> fetch?( input: string or URL or Request, options?: RequestInit, ): Promise<Response> }` |
1457
+ | `MapServerApiOptions` | `{ getBaseUrl(): Promise<URL> /** * We assume the passed fetch implementation will only accept a `string` as * input, not a `URL` or `Request`, because right now the expo/fetch * implementation will only accept a `string`. Adding this restriction will * catch potential issues if we try to pass a URL in our code. Can be relaxed * when https://github.com/expo/expo/issues/43193 is fixed upstream. */ fetch?(input: string, options?: RequestInit): Promise<Response> }` |
1402
1458
 
1403
1459
  ### MapServerApi
1404
1460
 
1405
1461
  | Type | Type |
1406
1462
  | ---------- | ---------- |
1407
- | `MapServerApi` | `KyInstance and { createEventSource(options: EventSourceOptions): EventSourceClient getMapStyleJsonUrl(mapId: string): Promise<string> }` |
1463
+ | `MapServerApi` | `ReturnType<typeof createHttp> and { createEventSource(options: EventSourceOptions): EventSourceClient getMapStyleJsonUrl(mapId: string): Promise<string> }` |
1408
1464
 
1409
1465
  ### MapServerProviderProps
1410
1466
 
1411
1467
  | Type | Type |
1412
1468
  | ---------- | ---------- |
1413
- | `MapServerProviderProps` | `PropsWithChildren<MapServerApiOptions>` |
1469
+ | `MapServerProviderProps` | `PropsWithChildren< MapServerApiOptions and { queryClient: QueryClient } >` |
1414
1470