@arbidocs/react 0.5.84 → 0.5.85

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/README.md CHANGED
@@ -257,6 +257,37 @@ live connection (a dropped socket counts once it has been up) and the person's "
257
257
  choice (`useWorkOffline`, a transient session view, `WORK_OFFLINE_VIEW`). `useReconnect` takes the
258
258
  cheapest way back: it clears "Work offline", says there is no network, or reloads.
259
259
 
260
+ ## Offline mail and calendar
261
+
262
+ Mail can be kept on the device, sealed at rest to the signed-in user's key, bound to that account
263
+ and readable only by them: offline reading and search, an Outbox whose sends go out exactly once
264
+ on reconnect (each keeps its `request_id`), and drafts written offline. A host turns it on with
265
+ three pieces:
266
+
267
+ ```tsx
268
+ import { createMailClient, offlineMailReads, useOfflineMailRuntime, wipeOfflineMail } from '@arbidocs/react'
269
+
270
+ const client = createMailClient((path, init) => getArbi().mail.fetch(path, init), {
271
+ ...offlineMailReads(getArbi), // reads answer from the device offline
272
+ })
273
+ useOfflineMailRuntime({ openOutbox }) // mounted once: sends the Outbox, uploads drafts, syncs
274
+ await wipeOfflineMail() // at sign-out
275
+ ```
276
+
277
+ The mailbox kit's device storage is `offlineMailSupport` (`@arbidocs/blocks/connect`); the
278
+ per-device settings are `ConnectedMailOfflineSettings`.
279
+
280
+ The calendar is kept the same way (its own sealed database): reads are answered from the device
281
+ offline, and event writes made offline wait in an outbox that is replayed in order once back online.
282
+
283
+ ```tsx
284
+ import { calendarOfflineSupport, useCalendarOfflineRuntime, wipeCalendarOffline } from '@arbidocs/react'
285
+
286
+ <ArbiHost config={{ calendar: { offline: calendarOfflineSupport } }}>…</ArbiHost>
287
+ useCalendarOfflineRuntime() // mounted once: replays the outbox on reconnect
288
+ await wipeCalendarOffline() // at sign-out
289
+ ```
290
+
260
291
  ## The live connection
261
292
 
262
293
  `<ArbiWebSocketProvider>` holds the one reconnecting socket and applies what every site applies: