@everfur/sdk 0.1.1 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +703 -4
- package/README.md +63 -23
- package/consent/package.json +8 -0
- package/dist/Chat-BZZ-Py5l.d.ts +128 -0
- package/dist/Chat-Dq4fffIO.d.cts +128 -0
- package/dist/DepthViews-BG3E25MD.d.ts +16 -0
- package/dist/DepthViews-B_hIypI6.d.cts +19 -0
- package/dist/DepthViews-CL75jyRA.d.cts +16 -0
- package/dist/DepthViews-CkYri51q.d.ts +19 -0
- package/dist/ErrorPolicyPort-CNf4uQZP.d.cts +22 -0
- package/dist/ErrorPolicyPort-CwbfmxzJ.d.ts +22 -0
- package/dist/{EverfurResult-D92-uL82.d.cts → EverfurResult-DN9pL2Ab.d.cts} +11 -10
- package/dist/{EverfurResult-D92-uL82.d.ts → EverfurResult-DN9pL2Ab.d.ts} +11 -10
- package/dist/{PhotoController-BItt5M7u.d.cts → PhotoController-3l7MT9jA.d.cts} +1 -1
- package/dist/{PhotoController-D8zMTdcW.d.ts → PhotoController-vzY5bfY_.d.ts} +1 -1
- package/dist/animations/index.cjs +1 -1997
- package/dist/animations/index.d.cts +35 -35
- package/dist/animations/index.d.ts +35 -35
- package/dist/animations/index.js +1 -1972
- package/dist/attachments-BorG422I.d.cts +146 -0
- package/dist/attachments-BrUWQYNK.d.ts +257 -0
- package/dist/attachments-D_SECjr1.d.cts +257 -0
- package/dist/attachments-DpldrvIW.d.ts +146 -0
- package/dist/bookingCopy-CqtDYvCR.d.ts +732 -0
- package/dist/bookingCopy-SREvkG19.d.cts +732 -0
- package/dist/branding-CsRdeNwK.d.cts +566 -0
- package/dist/branding-CsRdeNwK.d.ts +566 -0
- package/dist/callCopy-DoQKG3-L.d.cts +40 -0
- package/dist/callCopy-DoQKG3-L.d.ts +40 -0
- package/dist/casesRepository-DwtZVsbj.d.cts +51 -0
- package/dist/casesRepository-v6QczS9N.d.ts +51 -0
- package/dist/chat/index.cjs +1 -1170
- package/dist/chat/index.d.cts +32 -53
- package/dist/chat/index.d.ts +32 -53
- package/dist/chat/index.js +1 -1167
- package/dist/client/index.cjs +9 -2315
- package/dist/client/index.d.cts +80 -16
- package/dist/client/index.d.ts +80 -16
- package/dist/client/index.js +9 -2215
- package/dist/{config-CiJ0PVBB.d.ts → config--Wu1Umhd.d.cts} +64 -26
- package/dist/{config-BSjBdxrZ.d.cts → config-C7eb_IMD.d.ts} +64 -26
- package/dist/consent/index.cjs +1 -0
- package/dist/consent/index.d.cts +33 -0
- package/dist/consent/index.d.ts +33 -0
- package/dist/consent/index.js +1 -0
- package/dist/context-CL3lyuy1.d.cts +159 -0
- package/dist/context-CahAEha8.d.ts +159 -0
- package/dist/copy-DdVFDL01.d.ts +198 -0
- package/dist/copy-UeUJVk8X.d.cts +198 -0
- package/dist/core/index.cjs +13 -3178
- package/dist/core/index.d.cts +164 -29
- package/dist/core/index.d.ts +164 -29
- package/dist/core/index.js +13 -3166
- package/dist/depth-D5HwcvKC.d.cts +533 -0
- package/dist/depth-DvPwPuT_.d.ts +533 -0
- package/dist/entitlementRepository-B7egEdW6.d.ts +43 -0
- package/dist/entitlementRepository-BpJ7tiwl.d.cts +43 -0
- package/dist/{identity-Brl-lDd6.d.cts → identity-C2-08BZW.d.cts} +20 -7
- package/dist/{identity-DK9zORrG.d.ts → identity-CEi9GRFZ.d.ts} +20 -7
- package/dist/{ids-CJ1S6adf.d.cts → ids-B2GAAifq.d.cts} +1 -1
- package/dist/{ids-CJ1S6adf.d.ts → ids-B2GAAifq.d.ts} +1 -1
- package/dist/index.cjs +12 -4494
- package/dist/index.d.cts +30 -121
- package/dist/index.d.ts +30 -121
- package/dist/index.js +12 -4470
- package/dist/models-B-Uh2LTf.d.ts +214 -0
- package/dist/models-D2EUxPZY.d.cts +214 -0
- package/dist/notifications/index.cjs +2 -0
- package/dist/notifications/index.d.cts +17 -0
- package/dist/notifications/index.d.ts +17 -0
- package/dist/notifications/index.js +2 -0
- package/dist/optionalModule-DbJmsq5f.d.cts +21 -0
- package/dist/optionalModule-DbJmsq5f.d.ts +21 -0
- package/dist/pets-DJv2sj2H.d.ts +92 -0
- package/dist/pets-JVCXgRgR.d.cts +92 -0
- package/dist/petsRepository-B_gKbAzJ.d.cts +142 -0
- package/dist/petsRepository-Bk6GDwLs.d.ts +142 -0
- package/dist/photo/index.cjs +1 -2189
- package/dist/photo/index.d.cts +6 -6
- package/dist/photo/index.d.ts +6 -6
- package/dist/photo/index.js +1 -2186
- package/dist/ports-BN6RHF9W.d.cts +48 -0
- package/dist/ports-BN6RHF9W.d.ts +48 -0
- package/dist/ports-BY2ph0_y.d.cts +376 -0
- package/dist/ports-D7YW8qz9.d.ts +376 -0
- package/dist/profile-CSs1wlXT.d.cts +93 -0
- package/dist/profile-CSs1wlXT.d.ts +93 -0
- package/dist/records/depth/index.cjs +2 -0
- package/dist/records/depth/index.d.cts +13 -0
- package/dist/records/depth/index.d.ts +13 -0
- package/dist/records/depth/index.js +2 -0
- package/dist/records/index.cjs +3 -2839
- package/dist/records/index.d.cts +137 -203
- package/dist/records/index.d.ts +137 -203
- package/dist/records/index.js +3 -2833
- package/dist/requestFunnel-BjDpqqvm.d.cts +110 -0
- package/dist/requestFunnel-DFMGcluw.d.ts +110 -0
- package/dist/{resolve-Dq_4_agU.d.ts → resolve-D4Ywz5OS.d.cts} +10 -4
- package/dist/{resolve-Dq_4_agU.d.cts → resolve-D4Ywz5OS.d.ts} +10 -4
- package/dist/{runtime-Bvr8yqXm.d.cts → runtimeTypes-gZEJu-da.d.cts} +104 -132
- package/dist/{runtime-BIYzf9cK.d.ts → runtimeTypes-w5KqBMcs.d.ts} +104 -132
- package/dist/server/events/index.cjs +2 -0
- package/dist/server/events/index.d.cts +550 -0
- package/dist/server/events/index.d.ts +550 -0
- package/dist/server/events/index.js +2 -0
- package/dist/server/index.cjs +2 -533
- package/dist/server/index.d.cts +73 -18
- package/dist/server/index.d.ts +73 -18
- package/dist/server/index.js +2 -530
- package/dist/species-BXAIMh7I.d.cts +9 -0
- package/dist/species-BXAIMh7I.d.ts +9 -0
- package/dist/televet/booking/index.cjs +1 -0
- package/dist/televet/booking/index.d.cts +294 -0
- package/dist/televet/booking/index.d.ts +294 -0
- package/dist/televet/booking/index.js +1 -0
- package/dist/televet/call/index.cjs +1 -0
- package/dist/televet/call/index.d.cts +141 -0
- package/dist/televet/call/index.d.ts +141 -0
- package/dist/televet/call/index.js +1 -0
- package/dist/televet/index.cjs +1 -0
- package/dist/televet/index.d.cts +142 -0
- package/dist/televet/index.d.ts +142 -0
- package/dist/televet/index.js +1 -0
- package/dist/testing/index.cjs +5 -823
- package/dist/testing/index.d.cts +18 -4
- package/dist/testing/index.d.ts +18 -4
- package/dist/testing/index.js +5 -820
- package/dist/testing/rn/index.cjs +1 -449
- package/dist/testing/rn/index.d.cts +18 -29
- package/dist/testing/rn/index.d.ts +18 -29
- package/dist/testing/rn/index.js +1 -444
- package/dist/testing/web/index.cjs +1 -0
- package/dist/testing/web/index.d.cts +132 -0
- package/dist/testing/web/index.d.ts +132 -0
- package/dist/testing/web/index.js +1 -0
- package/dist/timelineRows-C15jxFFH.d.ts +19 -0
- package/dist/timelineRows-odO8g9r2.d.cts +19 -0
- package/dist/typeStyle-CKqVYD6L.d.cts +111 -0
- package/dist/typeStyle-DmoyacDG.d.ts +111 -0
- package/dist/uploadTransport-D0M0T4hN.d.ts +38 -0
- package/dist/uploadTransport-DKJHs3Yj.d.cts +38 -0
- package/dist/useRecordsDepth-C6rjEaLn.d.cts +237 -0
- package/dist/useRecordsDepth-crhBllQK.d.ts +237 -0
- package/dist/useVetVisit-Bc84hWUU.d.cts +187 -0
- package/dist/useVetVisit-CjmMa896.d.ts +187 -0
- package/dist/video/index.cjs +1 -1941
- package/dist/video/index.d.cts +4 -4
- package/dist/video/index.d.ts +4 -4
- package/dist/video/index.js +1 -1938
- package/dist/view-Bxwxp4xD.d.ts +310 -0
- package/dist/view-DyitEO0m.d.cts +310 -0
- package/dist/visitIntent-D7_yVp1I.d.cts +8 -0
- package/dist/visitIntent-D7_yVp1I.d.ts +8 -0
- package/dist/web/consent/index.cjs +1 -0
- package/dist/web/consent/index.d.cts +34 -0
- package/dist/web/consent/index.d.ts +34 -0
- package/dist/web/consent/index.js +1 -0
- package/dist/web/index.cjs +14 -0
- package/dist/web/index.d.cts +218 -0
- package/dist/web/index.d.ts +218 -0
- package/dist/web/index.js +14 -0
- package/dist/web/notifications/index.cjs +2 -0
- package/dist/web/notifications/index.d.cts +213 -0
- package/dist/web/notifications/index.d.ts +213 -0
- package/dist/web/notifications/index.js +2 -0
- package/dist/web/records/depth/index.cjs +2 -0
- package/dist/web/records/depth/index.d.cts +12 -0
- package/dist/web/records/depth/index.d.ts +12 -0
- package/dist/web/records/depth/index.js +2 -0
- package/dist/web/records/index.cjs +4 -0
- package/dist/web/records/index.d.cts +285 -0
- package/dist/web/records/index.d.ts +285 -0
- package/dist/web/records/index.js +4 -0
- package/dist/web/televet/booking/index.cjs +1 -0
- package/dist/web/televet/booking/index.d.cts +349 -0
- package/dist/web/televet/booking/index.d.ts +349 -0
- package/dist/web/televet/booking/index.js +1 -0
- package/dist/web/televet/call/index.cjs +1 -0
- package/dist/web/televet/call/index.d.cts +142 -0
- package/dist/web/televet/call/index.d.ts +142 -0
- package/dist/web/televet/call/index.js +1 -0
- package/dist/web/televet/index.cjs +1 -0
- package/dist/web/televet/index.d.cts +136 -0
- package/dist/web/televet/index.d.ts +136 -0
- package/dist/web/televet/index.js +1 -0
- package/notifications/package.json +8 -0
- package/package.json +266 -10
- package/records/depth/package.json +8 -0
- package/server/events/device-blocked.cjs +15 -0
- package/server/events/package.json +9 -0
- package/televet/booking/package.json +8 -0
- package/televet/call/package.json +8 -0
- package/televet/package.json +8 -0
- package/testing/web/native-blocked.cjs +12 -0
- package/testing/web/package.json +8 -0
- package/web/consent/native-blocked.cjs +12 -0
- package/web/consent/package.json +8 -0
- package/web/native-blocked.cjs +12 -0
- package/web/notifications/native-blocked.cjs +12 -0
- package/web/notifications/package.json +8 -0
- package/web/package.json +8 -0
- package/web/records/depth/native-blocked.cjs +12 -0
- package/web/records/depth/package.json +8 -0
- package/web/records/native-blocked.cjs +12 -0
- package/web/records/package.json +8 -0
- package/web/televet/booking/native-blocked.cjs +12 -0
- package/web/televet/booking/package.json +8 -0
- package/web/televet/call/native-blocked.cjs +12 -0
- package/web/televet/call/package.json +8 -0
- package/web/televet/native-blocked.cjs +12 -0
- package/web/televet/package.json +8 -0
- package/dist/ChatController-CKdBvPj2.d.ts +0 -146
- package/dist/ChatController-CpUMvvZf.d.cts +0 -146
- package/dist/FilePort-BabWrv7I.d.cts +0 -22
- package/dist/FilePort-BabWrv7I.d.ts +0 -22
- package/dist/petsRepository-BEGb97M9.d.cts +0 -326
- package/dist/petsRepository-Bu18r2kK.d.ts +0 -326
- package/dist/requestFunnel-DuUH-kAe.d.cts +0 -28
- package/dist/requestFunnel-dio5OmR9.d.ts +0 -28
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
import { E as EverfurError } from './EverfurResult-DN9pL2Ab.js';
|
|
2
|
+
import { R as RecordsRequestId, P as PetRef, D as DocumentId } from './ids-B2GAAifq.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The partner-scoped lifecycle, including clinic requests. The server's canonical simple status takes
|
|
6
|
+
* precedence when supplied; upload and review states retain their action-specific distinctions.
|
|
7
|
+
*/
|
|
8
|
+
type RecordsRequestStatus = 'requested' | 'awaiting_clinic' | 'awaiting_upload' | 'received' | 'parsing' | 'in_review' | 'published' | 'failed' | 'revoked';
|
|
9
|
+
/** The backend's seven-state records lifecycle. Unknown future states are not guessed. */
|
|
10
|
+
type RecordsSimpleStatus = Exclude<RecordsRequestStatus, 'awaiting_upload' | 'in_review'>;
|
|
11
|
+
/** Terminal statuses: polling stops here. */
|
|
12
|
+
declare const RECORDS_TERMINAL: readonly RecordsRequestStatus[];
|
|
13
|
+
declare function isTerminalStatus(status: RecordsRequestStatus): boolean;
|
|
14
|
+
interface RecordsRequestView {
|
|
15
|
+
readonly id: RecordsRequestId;
|
|
16
|
+
readonly petRef: PetRef;
|
|
17
|
+
readonly status: RecordsRequestStatus;
|
|
18
|
+
readonly simpleStatus?: RecordsSimpleStatus | null;
|
|
19
|
+
/** Backend-authored machine detail; never used as user-facing copy. */
|
|
20
|
+
readonly simpleStatusDetail?: string | null;
|
|
21
|
+
/** BE-authored copy, rendered verbatim (dumb-renderer rule). */
|
|
22
|
+
readonly statusLabel: string;
|
|
23
|
+
/** Server-authorized actions; absent on older deployments means unavailable. */
|
|
24
|
+
readonly canRetrySend?: boolean;
|
|
25
|
+
readonly canUpdateClinicEmail?: boolean;
|
|
26
|
+
readonly canRevoke?: boolean;
|
|
27
|
+
readonly canConvertToUpload?: boolean;
|
|
28
|
+
readonly dispatchStatus?: string | null;
|
|
29
|
+
readonly reminderCount?: number;
|
|
30
|
+
readonly lastReminderAt?: string | null;
|
|
31
|
+
/** Existing backend-owned follow-up expectations, never reconstructed from raw statuses. */
|
|
32
|
+
readonly waitingExpectation?: string | null;
|
|
33
|
+
/**
|
|
34
|
+
* DEAD, measured 2026-08-22: no plane sends it and nothing in this SDK reads it. The widget
|
|
35
|
+
* `RecordsRequestResponse` omits it, the consumer `RecordsRequestSummary` has no such field either, and a
|
|
36
|
+
* grep of `src/` finds zero render consumers - so it is always the mapper's `0` default.
|
|
37
|
+
*
|
|
38
|
+
* Deliberately NOT deleted here: removing a non-optional public field is a breaking change that needs a
|
|
39
|
+
* major bump, which is a release decision. Documented so nobody reads a count off it.
|
|
40
|
+
*/
|
|
41
|
+
readonly documentCount: number;
|
|
42
|
+
/** facts extracted but awaiting review (badge "N being reviewed"). */
|
|
43
|
+
readonly heldItemCount: number;
|
|
44
|
+
/** ISO; null before first upload. */
|
|
45
|
+
readonly receivedAt: string | null;
|
|
46
|
+
/** drives the timeline "reading your records" step. */
|
|
47
|
+
readonly parsingStartedAt: string | null;
|
|
48
|
+
/** non-null == a parse gap occurred (§5, honest, not silent). */
|
|
49
|
+
readonly reviewStartedAt: string | null;
|
|
50
|
+
readonly createdAt: string;
|
|
51
|
+
readonly updatedAt: string;
|
|
52
|
+
/**
|
|
53
|
+
* The server's own owner-facing status vocabulary (EFBackend `records_schemas.RecordsRequestStatus`:
|
|
54
|
+
* `submitted`, `sent`, `awaiting_response`, `awaiting_upload`, `clinic_responded_no_records`,
|
|
55
|
+
* `records_received`, `parsing`, `in_review`, `published`, `failed`, `revoked`, `clinic_declined`), kept
|
|
56
|
+
* beside the folded `status` because the step rail (`buildRequestTimeline`) is the consumer app's and reads
|
|
57
|
+
* that vocabulary. STRUCTURAL ONLY: never rendered as copy. Absent on a hand-built view.
|
|
58
|
+
*/
|
|
59
|
+
readonly wireStatus?: string;
|
|
60
|
+
/** `clinic_request` or `owner_provided`; null when the wire did not say. */
|
|
61
|
+
readonly source?: string | null;
|
|
62
|
+
/** The consumer app's action-first sentence for a state that needs the member, BE-authored; null otherwise. */
|
|
63
|
+
readonly actionNeededLabel?: string | null;
|
|
64
|
+
/** BE-authored failure sentence for a failed request, rendered verbatim; null otherwise. */
|
|
65
|
+
readonly failureReason?: string | null;
|
|
66
|
+
/** The machine failure code (`no_response`, `hard_bounce`, `dispatch_failed`, `parse_timeout`, `parse_error`). */
|
|
67
|
+
readonly failureCode?: string | null;
|
|
68
|
+
readonly recoveryStage?: string | null;
|
|
69
|
+
/** True only when the server gates the tap-to-call affordance on for this request. */
|
|
70
|
+
readonly showClinicPhone?: boolean;
|
|
71
|
+
/** The clinic the request went to (directory name or the owner's free text); null for an owner upload. */
|
|
72
|
+
readonly clinicName?: string | null;
|
|
73
|
+
readonly clinicEmail?: string | null;
|
|
74
|
+
/** The clinic's verified phone, present only with `showClinicPhone`. */
|
|
75
|
+
readonly clinicPhone?: string | null;
|
|
76
|
+
/** ISO; set once the owner switched this clinic request to uploading their own records. */
|
|
77
|
+
readonly convertedToUploadAt?: string | null;
|
|
78
|
+
/** The multi-clinic group this request belongs to, or null. */
|
|
79
|
+
readonly requestGroupId?: string | null;
|
|
80
|
+
}
|
|
81
|
+
/** `GET /widget/v1/records/request-groups/{id}`: one pet's multi-clinic batch, with the BE-derived counts. */
|
|
82
|
+
interface RecordsRequestGroupView {
|
|
83
|
+
readonly requestGroupId: string;
|
|
84
|
+
readonly petRef: PetRef;
|
|
85
|
+
/** How many clinics the batch created requests for. */
|
|
86
|
+
readonly total: number;
|
|
87
|
+
/** How many of them the clinic has answered (records, a decline, a reply without records). */
|
|
88
|
+
readonly responded: number;
|
|
89
|
+
/** How many are still waiting on the clinic. */
|
|
90
|
+
readonly pending: number;
|
|
91
|
+
/** One request per clinic, in the server's order. */
|
|
92
|
+
readonly members: readonly RecordsRequestView[];
|
|
93
|
+
}
|
|
94
|
+
interface UploadedDocument {
|
|
95
|
+
readonly documentId: DocumentId;
|
|
96
|
+
readonly requestId: RecordsRequestId;
|
|
97
|
+
/** uploads NEVER auto-bind / auto-publish. */
|
|
98
|
+
readonly status: 'received';
|
|
99
|
+
}
|
|
100
|
+
/** One redacted identity row (name / species / breed / owner-safe field). Provenance absent. */
|
|
101
|
+
interface RecordIdentityField {
|
|
102
|
+
readonly label: string;
|
|
103
|
+
readonly value: string;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Who produced a reading. `owner_reported` is owner-entered (a home scale, typed into the pet profile);
|
|
107
|
+
* `clinic_document` is extracted from a vet document. The two now share one series, so a clinician reading a
|
|
108
|
+
* weight can tell them apart before dosing from it.
|
|
109
|
+
*
|
|
110
|
+
* A value this build does not know folds to `null` (unlabelled), never to a guess - see `normalizeOrigin`.
|
|
111
|
+
* `null` therefore means "the backend did not say", NOT "clinic".
|
|
112
|
+
*/
|
|
113
|
+
type RecordOrigin = 'owner_reported' | 'clinic_document';
|
|
114
|
+
/**
|
|
115
|
+
* One extracted clinical fact. No `raw_value` / `source_span` / `source_bbox` / `source_page` /
|
|
116
|
+
* `source_doc_id` / `value_source` / `extraction_method` / `source_precedence` members - `origin` is the only
|
|
117
|
+
* provenance-adjacent field, and it is a display label (see `RecordOrigin`).
|
|
118
|
+
*/
|
|
119
|
+
interface RecordEntity {
|
|
120
|
+
readonly key: string;
|
|
121
|
+
readonly category: string;
|
|
122
|
+
readonly label: string;
|
|
123
|
+
readonly value: string | null;
|
|
124
|
+
readonly unit: string | null;
|
|
125
|
+
readonly observedAt: string | null;
|
|
126
|
+
readonly status: string | null;
|
|
127
|
+
/** Who measured it. `null` when the backend did not label it (an older backend never does). */
|
|
128
|
+
readonly origin: RecordOrigin | null;
|
|
129
|
+
/**
|
|
130
|
+
* The server's stable fact key (`canonical_key`), the identity an owner correction or removal is keyed by
|
|
131
|
+
* (`facts.ts`). Absent or null on a row the backend gave no key: that row is view-only, never editable.
|
|
132
|
+
*/
|
|
133
|
+
readonly canonicalKey?: string | null;
|
|
134
|
+
}
|
|
135
|
+
interface RecordSeriesPoint {
|
|
136
|
+
readonly at: string;
|
|
137
|
+
readonly value: number | null;
|
|
138
|
+
readonly display: string | null;
|
|
139
|
+
/** Who measured this reading. `null` when the backend did not label it - never assume `clinic_document`. */
|
|
140
|
+
readonly origin: RecordOrigin | null;
|
|
141
|
+
}
|
|
142
|
+
/** A time series of one entity (e.g. a weight trend). */
|
|
143
|
+
interface RecordSeries {
|
|
144
|
+
readonly key: string;
|
|
145
|
+
readonly label: string;
|
|
146
|
+
readonly points: readonly RecordSeriesPoint[];
|
|
147
|
+
}
|
|
148
|
+
/** A forward-looking item (a due vaccine / follow-up). */
|
|
149
|
+
interface RecordForwardItem {
|
|
150
|
+
readonly title: string;
|
|
151
|
+
readonly detail: string | null;
|
|
152
|
+
readonly dueAt: string | null;
|
|
153
|
+
}
|
|
154
|
+
/** Metadata for one source document, keyed by its id. No raw bytes / provenance. */
|
|
155
|
+
interface RecordDocumentMeta {
|
|
156
|
+
readonly docId: string;
|
|
157
|
+
readonly title: string | null;
|
|
158
|
+
readonly pageCount: number | null;
|
|
159
|
+
readonly receivedAt: string | null;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* The parsed record, ALREADY partner-redacted server-side (§5). `isEmpty` is the normal pre-parse render;
|
|
163
|
+
* `withheld` is the §5 fail-closed suppression (redaction could not be proven safe) and renders the WITHHELD
|
|
164
|
+
* state, never empty, never raw.
|
|
165
|
+
*/
|
|
166
|
+
interface RecordsView {
|
|
167
|
+
readonly petRef: PetRef;
|
|
168
|
+
readonly schemaVersion: string;
|
|
169
|
+
readonly isEmpty: boolean;
|
|
170
|
+
readonly withheld: boolean;
|
|
171
|
+
readonly generatedAt: string | null;
|
|
172
|
+
readonly identity: readonly RecordIdentityField[];
|
|
173
|
+
readonly entities: readonly RecordEntity[];
|
|
174
|
+
readonly entitySeries: readonly RecordSeries[];
|
|
175
|
+
readonly forwardLooking: readonly RecordForwardItem[];
|
|
176
|
+
readonly documents: Readonly<Record<string, RecordDocumentMeta>>;
|
|
177
|
+
/** BE-authored not-medical-advice notice, rendered verbatim. */
|
|
178
|
+
readonly disclaimer: string;
|
|
179
|
+
}
|
|
180
|
+
interface ConsentState {
|
|
181
|
+
readonly petRef: PetRef;
|
|
182
|
+
readonly granted: boolean;
|
|
183
|
+
/** consent-text version the user agreed to. */
|
|
184
|
+
readonly version: string | null;
|
|
185
|
+
readonly grantedAt: string | null;
|
|
186
|
+
}
|
|
187
|
+
interface CreateUploadRequestInput {
|
|
188
|
+
readonly petRef: PetRef;
|
|
189
|
+
/** /^[A-Za-z0-9._-]{8,128}$/ (§3.1). Idempotent: a replay returns the SAME request. */
|
|
190
|
+
readonly idempotencyKey: string;
|
|
191
|
+
}
|
|
192
|
+
interface GrantConsentInput {
|
|
193
|
+
readonly petRef: PetRef;
|
|
194
|
+
readonly consentVersion: string;
|
|
195
|
+
readonly idempotencyKey: string;
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Why a records read/write was refused. The coarse reason selects the recovery affordance:
|
|
199
|
+
* `consent_required` -> consent CTA, `session_required` -> establish-session CTA, `entitlement` -> the
|
|
200
|
+
* CapabilityGate disabled surface, `pet_not_found` -> the pet the host asked about is not one this tenant
|
|
201
|
+
* holds.
|
|
202
|
+
*
|
|
203
|
+
* `pet_not_found` is NOT a variant of `entitlement`, and keeping them apart is the point. Both arrive as a
|
|
204
|
+
* 404 and both used to fold to the same `accessDenied` sentence, so "this surface is switched off for your
|
|
205
|
+
* tenant" and "the pet you named does not exist here" were one indistinguishable screen. They need different
|
|
206
|
+
* answers because they need different acts: the first is for the partner to have Everfur enable a surface,
|
|
207
|
+
* the second means the host sent a `pet_ref` the tenant does not have. The server already separates them
|
|
208
|
+
* (see `tagReason` in repository.ts for the measured wire shapes).
|
|
209
|
+
*/
|
|
210
|
+
type RecordsDenialReason = 'consent_required' | 'session_required' | 'entitlement' | 'pet_not_found';
|
|
211
|
+
/** Read the records denial reason off any settled error, defensively (null when absent). */
|
|
212
|
+
declare function recordsDenialReasonOf(error: EverfurError | null): RecordsDenialReason | null;
|
|
213
|
+
|
|
214
|
+
export { type CreateUploadRequestInput as C, type GrantConsentInput as G, type RecordDocumentMeta as R, type UploadedDocument as U, type RecordEntity as a, type RecordOrigin as b, type RecordsRequestStatus as c, type RecordsRequestView as d, type RecordsSimpleStatus as e, type RecordsRequestGroupView as f, type RecordsView as g, type ConsentState as h, type RecordsDenialReason as i, RECORDS_TERMINAL as j, type RecordForwardItem as k, type RecordIdentityField as l, type RecordSeries as m, type RecordSeriesPoint as n, isTerminalStatus as o, recordsDenialReasonOf as r };
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
import { E as EverfurError } from './EverfurResult-DN9pL2Ab.cjs';
|
|
2
|
+
import { R as RecordsRequestId, P as PetRef, D as DocumentId } from './ids-B2GAAifq.cjs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The partner-scoped lifecycle, including clinic requests. The server's canonical simple status takes
|
|
6
|
+
* precedence when supplied; upload and review states retain their action-specific distinctions.
|
|
7
|
+
*/
|
|
8
|
+
type RecordsRequestStatus = 'requested' | 'awaiting_clinic' | 'awaiting_upload' | 'received' | 'parsing' | 'in_review' | 'published' | 'failed' | 'revoked';
|
|
9
|
+
/** The backend's seven-state records lifecycle. Unknown future states are not guessed. */
|
|
10
|
+
type RecordsSimpleStatus = Exclude<RecordsRequestStatus, 'awaiting_upload' | 'in_review'>;
|
|
11
|
+
/** Terminal statuses: polling stops here. */
|
|
12
|
+
declare const RECORDS_TERMINAL: readonly RecordsRequestStatus[];
|
|
13
|
+
declare function isTerminalStatus(status: RecordsRequestStatus): boolean;
|
|
14
|
+
interface RecordsRequestView {
|
|
15
|
+
readonly id: RecordsRequestId;
|
|
16
|
+
readonly petRef: PetRef;
|
|
17
|
+
readonly status: RecordsRequestStatus;
|
|
18
|
+
readonly simpleStatus?: RecordsSimpleStatus | null;
|
|
19
|
+
/** Backend-authored machine detail; never used as user-facing copy. */
|
|
20
|
+
readonly simpleStatusDetail?: string | null;
|
|
21
|
+
/** BE-authored copy, rendered verbatim (dumb-renderer rule). */
|
|
22
|
+
readonly statusLabel: string;
|
|
23
|
+
/** Server-authorized actions; absent on older deployments means unavailable. */
|
|
24
|
+
readonly canRetrySend?: boolean;
|
|
25
|
+
readonly canUpdateClinicEmail?: boolean;
|
|
26
|
+
readonly canRevoke?: boolean;
|
|
27
|
+
readonly canConvertToUpload?: boolean;
|
|
28
|
+
readonly dispatchStatus?: string | null;
|
|
29
|
+
readonly reminderCount?: number;
|
|
30
|
+
readonly lastReminderAt?: string | null;
|
|
31
|
+
/** Existing backend-owned follow-up expectations, never reconstructed from raw statuses. */
|
|
32
|
+
readonly waitingExpectation?: string | null;
|
|
33
|
+
/**
|
|
34
|
+
* DEAD, measured 2026-08-22: no plane sends it and nothing in this SDK reads it. The widget
|
|
35
|
+
* `RecordsRequestResponse` omits it, the consumer `RecordsRequestSummary` has no such field either, and a
|
|
36
|
+
* grep of `src/` finds zero render consumers - so it is always the mapper's `0` default.
|
|
37
|
+
*
|
|
38
|
+
* Deliberately NOT deleted here: removing a non-optional public field is a breaking change that needs a
|
|
39
|
+
* major bump, which is a release decision. Documented so nobody reads a count off it.
|
|
40
|
+
*/
|
|
41
|
+
readonly documentCount: number;
|
|
42
|
+
/** facts extracted but awaiting review (badge "N being reviewed"). */
|
|
43
|
+
readonly heldItemCount: number;
|
|
44
|
+
/** ISO; null before first upload. */
|
|
45
|
+
readonly receivedAt: string | null;
|
|
46
|
+
/** drives the timeline "reading your records" step. */
|
|
47
|
+
readonly parsingStartedAt: string | null;
|
|
48
|
+
/** non-null == a parse gap occurred (§5, honest, not silent). */
|
|
49
|
+
readonly reviewStartedAt: string | null;
|
|
50
|
+
readonly createdAt: string;
|
|
51
|
+
readonly updatedAt: string;
|
|
52
|
+
/**
|
|
53
|
+
* The server's own owner-facing status vocabulary (EFBackend `records_schemas.RecordsRequestStatus`:
|
|
54
|
+
* `submitted`, `sent`, `awaiting_response`, `awaiting_upload`, `clinic_responded_no_records`,
|
|
55
|
+
* `records_received`, `parsing`, `in_review`, `published`, `failed`, `revoked`, `clinic_declined`), kept
|
|
56
|
+
* beside the folded `status` because the step rail (`buildRequestTimeline`) is the consumer app's and reads
|
|
57
|
+
* that vocabulary. STRUCTURAL ONLY: never rendered as copy. Absent on a hand-built view.
|
|
58
|
+
*/
|
|
59
|
+
readonly wireStatus?: string;
|
|
60
|
+
/** `clinic_request` or `owner_provided`; null when the wire did not say. */
|
|
61
|
+
readonly source?: string | null;
|
|
62
|
+
/** The consumer app's action-first sentence for a state that needs the member, BE-authored; null otherwise. */
|
|
63
|
+
readonly actionNeededLabel?: string | null;
|
|
64
|
+
/** BE-authored failure sentence for a failed request, rendered verbatim; null otherwise. */
|
|
65
|
+
readonly failureReason?: string | null;
|
|
66
|
+
/** The machine failure code (`no_response`, `hard_bounce`, `dispatch_failed`, `parse_timeout`, `parse_error`). */
|
|
67
|
+
readonly failureCode?: string | null;
|
|
68
|
+
readonly recoveryStage?: string | null;
|
|
69
|
+
/** True only when the server gates the tap-to-call affordance on for this request. */
|
|
70
|
+
readonly showClinicPhone?: boolean;
|
|
71
|
+
/** The clinic the request went to (directory name or the owner's free text); null for an owner upload. */
|
|
72
|
+
readonly clinicName?: string | null;
|
|
73
|
+
readonly clinicEmail?: string | null;
|
|
74
|
+
/** The clinic's verified phone, present only with `showClinicPhone`. */
|
|
75
|
+
readonly clinicPhone?: string | null;
|
|
76
|
+
/** ISO; set once the owner switched this clinic request to uploading their own records. */
|
|
77
|
+
readonly convertedToUploadAt?: string | null;
|
|
78
|
+
/** The multi-clinic group this request belongs to, or null. */
|
|
79
|
+
readonly requestGroupId?: string | null;
|
|
80
|
+
}
|
|
81
|
+
/** `GET /widget/v1/records/request-groups/{id}`: one pet's multi-clinic batch, with the BE-derived counts. */
|
|
82
|
+
interface RecordsRequestGroupView {
|
|
83
|
+
readonly requestGroupId: string;
|
|
84
|
+
readonly petRef: PetRef;
|
|
85
|
+
/** How many clinics the batch created requests for. */
|
|
86
|
+
readonly total: number;
|
|
87
|
+
/** How many of them the clinic has answered (records, a decline, a reply without records). */
|
|
88
|
+
readonly responded: number;
|
|
89
|
+
/** How many are still waiting on the clinic. */
|
|
90
|
+
readonly pending: number;
|
|
91
|
+
/** One request per clinic, in the server's order. */
|
|
92
|
+
readonly members: readonly RecordsRequestView[];
|
|
93
|
+
}
|
|
94
|
+
interface UploadedDocument {
|
|
95
|
+
readonly documentId: DocumentId;
|
|
96
|
+
readonly requestId: RecordsRequestId;
|
|
97
|
+
/** uploads NEVER auto-bind / auto-publish. */
|
|
98
|
+
readonly status: 'received';
|
|
99
|
+
}
|
|
100
|
+
/** One redacted identity row (name / species / breed / owner-safe field). Provenance absent. */
|
|
101
|
+
interface RecordIdentityField {
|
|
102
|
+
readonly label: string;
|
|
103
|
+
readonly value: string;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Who produced a reading. `owner_reported` is owner-entered (a home scale, typed into the pet profile);
|
|
107
|
+
* `clinic_document` is extracted from a vet document. The two now share one series, so a clinician reading a
|
|
108
|
+
* weight can tell them apart before dosing from it.
|
|
109
|
+
*
|
|
110
|
+
* A value this build does not know folds to `null` (unlabelled), never to a guess - see `normalizeOrigin`.
|
|
111
|
+
* `null` therefore means "the backend did not say", NOT "clinic".
|
|
112
|
+
*/
|
|
113
|
+
type RecordOrigin = 'owner_reported' | 'clinic_document';
|
|
114
|
+
/**
|
|
115
|
+
* One extracted clinical fact. No `raw_value` / `source_span` / `source_bbox` / `source_page` /
|
|
116
|
+
* `source_doc_id` / `value_source` / `extraction_method` / `source_precedence` members - `origin` is the only
|
|
117
|
+
* provenance-adjacent field, and it is a display label (see `RecordOrigin`).
|
|
118
|
+
*/
|
|
119
|
+
interface RecordEntity {
|
|
120
|
+
readonly key: string;
|
|
121
|
+
readonly category: string;
|
|
122
|
+
readonly label: string;
|
|
123
|
+
readonly value: string | null;
|
|
124
|
+
readonly unit: string | null;
|
|
125
|
+
readonly observedAt: string | null;
|
|
126
|
+
readonly status: string | null;
|
|
127
|
+
/** Who measured it. `null` when the backend did not label it (an older backend never does). */
|
|
128
|
+
readonly origin: RecordOrigin | null;
|
|
129
|
+
/**
|
|
130
|
+
* The server's stable fact key (`canonical_key`), the identity an owner correction or removal is keyed by
|
|
131
|
+
* (`facts.ts`). Absent or null on a row the backend gave no key: that row is view-only, never editable.
|
|
132
|
+
*/
|
|
133
|
+
readonly canonicalKey?: string | null;
|
|
134
|
+
}
|
|
135
|
+
interface RecordSeriesPoint {
|
|
136
|
+
readonly at: string;
|
|
137
|
+
readonly value: number | null;
|
|
138
|
+
readonly display: string | null;
|
|
139
|
+
/** Who measured this reading. `null` when the backend did not label it - never assume `clinic_document`. */
|
|
140
|
+
readonly origin: RecordOrigin | null;
|
|
141
|
+
}
|
|
142
|
+
/** A time series of one entity (e.g. a weight trend). */
|
|
143
|
+
interface RecordSeries {
|
|
144
|
+
readonly key: string;
|
|
145
|
+
readonly label: string;
|
|
146
|
+
readonly points: readonly RecordSeriesPoint[];
|
|
147
|
+
}
|
|
148
|
+
/** A forward-looking item (a due vaccine / follow-up). */
|
|
149
|
+
interface RecordForwardItem {
|
|
150
|
+
readonly title: string;
|
|
151
|
+
readonly detail: string | null;
|
|
152
|
+
readonly dueAt: string | null;
|
|
153
|
+
}
|
|
154
|
+
/** Metadata for one source document, keyed by its id. No raw bytes / provenance. */
|
|
155
|
+
interface RecordDocumentMeta {
|
|
156
|
+
readonly docId: string;
|
|
157
|
+
readonly title: string | null;
|
|
158
|
+
readonly pageCount: number | null;
|
|
159
|
+
readonly receivedAt: string | null;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* The parsed record, ALREADY partner-redacted server-side (§5). `isEmpty` is the normal pre-parse render;
|
|
163
|
+
* `withheld` is the §5 fail-closed suppression (redaction could not be proven safe) and renders the WITHHELD
|
|
164
|
+
* state, never empty, never raw.
|
|
165
|
+
*/
|
|
166
|
+
interface RecordsView {
|
|
167
|
+
readonly petRef: PetRef;
|
|
168
|
+
readonly schemaVersion: string;
|
|
169
|
+
readonly isEmpty: boolean;
|
|
170
|
+
readonly withheld: boolean;
|
|
171
|
+
readonly generatedAt: string | null;
|
|
172
|
+
readonly identity: readonly RecordIdentityField[];
|
|
173
|
+
readonly entities: readonly RecordEntity[];
|
|
174
|
+
readonly entitySeries: readonly RecordSeries[];
|
|
175
|
+
readonly forwardLooking: readonly RecordForwardItem[];
|
|
176
|
+
readonly documents: Readonly<Record<string, RecordDocumentMeta>>;
|
|
177
|
+
/** BE-authored not-medical-advice notice, rendered verbatim. */
|
|
178
|
+
readonly disclaimer: string;
|
|
179
|
+
}
|
|
180
|
+
interface ConsentState {
|
|
181
|
+
readonly petRef: PetRef;
|
|
182
|
+
readonly granted: boolean;
|
|
183
|
+
/** consent-text version the user agreed to. */
|
|
184
|
+
readonly version: string | null;
|
|
185
|
+
readonly grantedAt: string | null;
|
|
186
|
+
}
|
|
187
|
+
interface CreateUploadRequestInput {
|
|
188
|
+
readonly petRef: PetRef;
|
|
189
|
+
/** /^[A-Za-z0-9._-]{8,128}$/ (§3.1). Idempotent: a replay returns the SAME request. */
|
|
190
|
+
readonly idempotencyKey: string;
|
|
191
|
+
}
|
|
192
|
+
interface GrantConsentInput {
|
|
193
|
+
readonly petRef: PetRef;
|
|
194
|
+
readonly consentVersion: string;
|
|
195
|
+
readonly idempotencyKey: string;
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Why a records read/write was refused. The coarse reason selects the recovery affordance:
|
|
199
|
+
* `consent_required` -> consent CTA, `session_required` -> establish-session CTA, `entitlement` -> the
|
|
200
|
+
* CapabilityGate disabled surface, `pet_not_found` -> the pet the host asked about is not one this tenant
|
|
201
|
+
* holds.
|
|
202
|
+
*
|
|
203
|
+
* `pet_not_found` is NOT a variant of `entitlement`, and keeping them apart is the point. Both arrive as a
|
|
204
|
+
* 404 and both used to fold to the same `accessDenied` sentence, so "this surface is switched off for your
|
|
205
|
+
* tenant" and "the pet you named does not exist here" were one indistinguishable screen. They need different
|
|
206
|
+
* answers because they need different acts: the first is for the partner to have Everfur enable a surface,
|
|
207
|
+
* the second means the host sent a `pet_ref` the tenant does not have. The server already separates them
|
|
208
|
+
* (see `tagReason` in repository.ts for the measured wire shapes).
|
|
209
|
+
*/
|
|
210
|
+
type RecordsDenialReason = 'consent_required' | 'session_required' | 'entitlement' | 'pet_not_found';
|
|
211
|
+
/** Read the records denial reason off any settled error, defensively (null when absent). */
|
|
212
|
+
declare function recordsDenialReasonOf(error: EverfurError | null): RecordsDenialReason | null;
|
|
213
|
+
|
|
214
|
+
export { type CreateUploadRequestInput as C, type GrantConsentInput as G, type RecordDocumentMeta as R, type UploadedDocument as U, type RecordEntity as a, type RecordOrigin as b, type RecordsRequestStatus as c, type RecordsRequestView as d, type RecordsSimpleStatus as e, type RecordsRequestGroupView as f, type RecordsView as g, type ConsentState as h, type RecordsDenialReason as i, RECORDS_TERMINAL as j, type RecordForwardItem as k, type RecordIdentityField as l, type RecordSeries as m, type RecordSeriesPoint as n, isTerminalStatus as o, recordsDenialReasonOf as r };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use strict';var react=require('react'),reactNative=require('react-native');var Ge=Object.defineProperty;var n=(e,t)=>Ge(e,"name",{value:t,configurable:true});function T(e,t){return Object.freeze(t===void 0?{ok:true,value:e}:{ok:true,value:e,warning:t})}n(T,"ok");function u(e){return Object.freeze({ok:false,error:e})}n(u,"err");var j=class j extends Error{constructor(t,r){super(r),this.name="EverfurConfigError",this.kind=t,Object.setPrototypeOf(this,j.prototype);}};n(j,"EverfurConfigError");var P=j;var V=Object.freeze([Object.freeze({wireCode:"AccessDeniedException",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"AuthorizationException",envelope:"http_envelope",httpStatus:401,retryable:false}),Object.freeze({wireCode:"ConflictException",envelope:"http_envelope",httpStatus:409,retryable:true}),Object.freeze({wireCode:"DAILY_QUOTA_EXCEEDED",envelope:"http_envelope",httpStatus:429,retryable:true}),Object.freeze({wireCode:"FILE_TOO_LARGE",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"IDEMPOTENCY_KEY_IN_FLIGHT",envelope:"http_envelope",httpStatus:409,retryable:true}),Object.freeze({wireCode:"IDEMPOTENCY_KEY_REUSED_DIFFERENT_REQUEST",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"INVALID_CONTENT_TYPE",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"InternalFailureException",envelope:"http_envelope",httpStatus:500,retryable:true}),Object.freeze({wireCode:"MethodNotAllowedException",envelope:"http_envelope",httpStatus:405,retryable:false}),Object.freeze({wireCode:"NotImplementedException",envelope:"http_envelope",httpStatus:501,retryable:false}),Object.freeze({wireCode:"PaymentRequiredException",envelope:"http_envelope",httpStatus:402,retryable:false}),Object.freeze({wireCode:"ResourceNotFoundException",envelope:"http_envelope",httpStatus:404,retryable:false}),Object.freeze({wireCode:"ServiceUnavailableException",envelope:"http_envelope",httpStatus:503,retryable:true}),Object.freeze({wireCode:"TIER_UPGRADE_REQUIRED",envelope:"http_envelope",httpStatus:402,retryable:false}),Object.freeze({wireCode:"ThrottlingException",envelope:"http_envelope",httpStatus:429,retryable:true}),Object.freeze({wireCode:"ValidationException",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"accessDenied",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"access_denied",envelope:"oauth_error",httpStatus:302,retryable:false}),Object.freeze({wireCode:"attachment_unreadable",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"authExpired",envelope:"http_envelope",httpStatus:401,retryable:true}),Object.freeze({wireCode:"authRejected",envelope:"http_envelope",httpStatus:401,retryable:false}),Object.freeze({wireCode:"consent_invalid",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"consent_required",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"consent_scope_wrong_route",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"device_cipher_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true}),Object.freeze({wireCode:"email_invalid",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"event_cursor_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"event_filter_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"event_payload_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"event_type_not_available",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"event_type_unknown",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"idempotency_key_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"idempotency_key_required",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"idempotency_key_reused",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"insufficientCapability",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"insufficient_scope",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"internal_error",envelope:"sse_frame",httpStatus:200,retryable:false}),Object.freeze({wireCode:"invalidRequest",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"invalid_client",envelope:"oauth_error",httpStatus:401,retryable:false}),Object.freeze({wireCode:"invalid_client_metadata",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"invalid_grant",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"invalid_redirect_uri",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"invalid_request",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"invalid_scope",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"invalid_target",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"mcp_connection_not_found",envelope:"http_envelope",httpStatus:404,retryable:false}),Object.freeze({wireCode:"mcp_request_conflict",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"mcp_request_gone",envelope:"http_envelope",httpStatus:410,retryable:false}),Object.freeze({wireCode:"mcp_request_not_found",envelope:"http_envelope",httpStatus:404,retryable:false}),Object.freeze({wireCode:"not_found",envelope:"sse_frame",httpStatus:200,retryable:false}),Object.freeze({wireCode:"partner_visit_link_conflict",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"partner_visit_owner_only",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"partner_visit_pet_already_mapped",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"payload_too_large",envelope:"http_envelope",httpStatus:413,retryable:false}),Object.freeze({wireCode:"petRefInUse",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"pet_health_list_removals_unconfirmed",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"pet_health_species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"pet_not_registered",envelope:"http_envelope",httpStatus:404,retryable:false}),Object.freeze({wireCode:"provider_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"rateLimited",envelope:"http_envelope",httpStatus:429,retryable:true}),Object.freeze({wireCode:"record_species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"record_subject_not_found",envelope:"http_envelope",httpStatus:404,retryable:false}),Object.freeze({wireCode:"record_upload_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"records_consent_required",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"sandbox_only",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"session_required",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"share_limit_reached",envelope:"http_envelope",httpStatus:429,retryable:false}),Object.freeze({wireCode:"slow_down",envelope:"oauth_error",httpStatus:429,retryable:true}),Object.freeze({wireCode:"species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"tenant_filter_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"tenant_has_no_capabilities",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"tenant_resource_not_found",envelope:"http_envelope",httpStatus:404,retryable:false}),Object.freeze({wireCode:"tenant_surface_not_enabled",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"timeout",envelope:"sse_frame",httpStatus:200,retryable:true}),Object.freeze({wireCode:"token_invalid",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"unavailable",envelope:"sse_frame",httpStatus:200,retryable:true}),Object.freeze({wireCode:"unavailable",envelope:"http_envelope",httpStatus:503,retryable:true}),Object.freeze({wireCode:"unsupported_grant_type",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"unsupported_response_type",envelope:"oauth_error",httpStatus:302,retryable:false}),Object.freeze({wireCode:"verify_mint_rate_limited",envelope:"http_envelope",httpStatus:429,retryable:true}),Object.freeze({wireCode:"verify_mint_refused",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"verify_mint_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true}),Object.freeze({wireCode:"verify_user_ref_invalid",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"webhook_endpoint_update_empty",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"webhook_endpoint_update_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"webhook_url_rejected",envelope:"http_envelope",httpStatus:400,retryable:false})]);Object.freeze(V.map(e=>e.wireCode));var We=Object.freeze({ValidationException:"validationFailed",AuthorizationException:"authRejected",PaymentRequiredException:"paymentRequired",AccessDeniedException:"accessDenied",ResourceNotFoundException:"resourceNotFound",ConflictException:"conflict",ThrottlingException:"rateLimited",InternalFailureException:"internalError",NotImplementedException:"notImplemented",ServiceUnavailableException:"serviceUnavailable",MethodNotAllowedException:"validationFailed",authExpired:"authExpired",unavailable:"serviceUnavailable",session_required:"sessionRequired",accessDenied:"accessDenied",invalidRequest:"sdkUpdateRequired",authRejected:"authRejected",rateLimited:"rateLimited",insufficientCapability:"accessDenied",event_cursor_invalid:"validationFailed",event_filter_invalid:"validationFailed",event_payload_invalid:"validationFailed",event_type_unknown:"validationFailed",idempotency_key_invalid:"validationFailed",idempotency_key_required:"validationFailed",idempotency_key_reused:"idempotencyConflict",payload_too_large:"validationFailed",webhook_url_rejected:"validationFailed",webhook_endpoint_update_empty:"validationFailed",webhook_endpoint_update_invalid:"validationFailed",event_type_not_available:"conflict",record_subject_not_found:"resourceNotFound",records_consent_required:"conflict",record_species_unsupported:"validationFailed",record_upload_invalid:"validationFailed",FILE_TOO_LARGE:"validationFailed",INVALID_CONTENT_TYPE:"validationFailed",attachment_unreadable:"validationFailed",provider_unsupported:"validationFailed",token_invalid:"validationFailed",device_cipher_unavailable:"serviceUnavailable",email_invalid:"validationFailed",consent_required:"validationFailed",consent_invalid:"validationFailed",consent_scope_wrong_route:"validationFailed",IDEMPOTENCY_KEY_IN_FLIGHT:"idempotencyInFlight",IDEMPOTENCY_KEY_REUSED_DIFFERENT_REQUEST:"idempotencyConflict",DAILY_QUOTA_EXCEEDED:"quotaExceeded",TIER_UPGRADE_REQUIRED:"paymentRequired",not_found:"conversationNotFound",timeout:"streamTimeout",internal_error:"internalError",invalid_request:"validationFailed",invalid_client:"authRejected",invalid_grant:"authRejected",unsupported_grant_type:"validationFailed",invalid_scope:"validationFailed",invalid_target:"validationFailed",invalid_redirect_uri:"validationFailed",invalid_client_metadata:"validationFailed",unsupported_response_type:"validationFailed",access_denied:"accessDenied",slow_down:"rateLimited",mcp_request_not_found:"resourceNotFound",mcp_request_gone:"resourceNotFound",mcp_connection_not_found:"resourceNotFound",mcp_request_conflict:"conflict",sandbox_only:"accessDenied",tenant_has_no_capabilities:"conflict",verify_mint_refused:"accessDenied",verify_mint_rate_limited:"rateLimited",verify_mint_unavailable:"serviceUnavailable",verify_user_ref_invalid:"validationFailed",insufficient_scope:"accessDenied",tenant_filter_invalid:"validationFailed",tenant_resource_not_found:"resourceNotFound",tenant_surface_not_enabled:"conflict",pet_health_species_unsupported:"validationFailed",pet_health_list_removals_unconfirmed:"validationFailed",petRefInUse:"conflict",share_limit_reached:"conflict",pet_not_registered:"resourceNotFound",species_unsupported:"validationFailed",partner_visit_owner_only:"accessDenied",partner_visit_link_conflict:"conflict",partner_visit_pet_already_mapped:"conflict"}),ae=Object.freeze(V.map(e=>Object.freeze({wireCode:e.wireCode,envelope:e.envelope,retryable:e.retryable,normalized:We[e.wireCode]}))),$e=new Map(ae.map(e=>[e.envelope+e.wireCode.toUpperCase(),e])),Qe=Object.freeze(["http_envelope",...[...new Set(ae.map(e=>e.envelope))].filter(e=>e!=="http_envelope").sort()]);function z(e,t){if(typeof e!="string")return;let r=e.trim().toUpperCase();if(r.length!==0)for(let o of [t??"http_envelope",...Qe]){let i=$e.get(o+r);if(i)return i}}n(z,"contractErrorFor");function Xe(e){return e.envelope==="sse_frame"?`/errors#sse-${e.wireCode}`:e.envelope==="oauth_error"?`/errors#oauth-${e.wireCode}`:`/errors#${e.wireCode}`}n(Xe,"contractDocUrl");function se(e){return null}n(se,"publishedDocUrl");var Je=Object.freeze({authExpired:"authentication",authRejected:"authentication",sessionRequired:"authentication",accessDenied:"authorization",paymentRequired:"entitlement",quotaExceeded:"rateLimit",rateLimited:"rateLimit",validationFailed:"invalidRequest",sdkUpdateRequired:"invalidRequest",conversationNotFound:"notFound",petNotFound:"notFound",resourceNotFound:"notFound",conflict:"conflict",idempotencyConflict:"conflict",idempotencyInFlight:"conflict",streamTimeout:"connection",streamIncomplete:"connection",upstreamLlmTimeout:"connection",serviceUnavailable:"connection",internalError:"server",notImplemented:"server",mediaUploadFailed:"media",moderationBlocked:"policy",unknown:"unknown"});function le(e){return Je[e]}n(le,"categoryFor");function ue(e){let t=z(e);if(t)return t.normalized;let r=(e??"").trim().toUpperCase(),o=r.replace(/[^A-Z0-9]/g,"");if(o==="AUTHREJECTED")return "authRejected";if(r.startsWith("AUTH"))return "authExpired";switch(o){case "DAILYQUOTAEXCEEDED":case "QUOTAEXCEEDED":return "quotaExceeded";case "RATELIMITED":case "TOOMANYREQUESTS":return "rateLimited";case "IDEMPOTENCYKEYCONFLICT":case "IDEMPOTENCYCONFLICT":return "idempotencyConflict";case "ACCESSDENIED":case "FORBIDDEN":return "accessDenied";case "NOTFOUND":case "CONVERSATIONNOTFOUND":return "conversationNotFound";case "PETNOTFOUND":return "petNotFound";case "TIMEOUT":case "STREAMTIMEOUT":return "streamTimeout";case "MEDIAUPLOADFAILED":case "UNRECOGNIZEDVIDEOFORMAT":case "FILETOOSMALL":return "mediaUploadFailed";case "MODERATIONBLOCKED":return "moderationBlocked";case "UPSTREAMLLMTIMEOUT":return "upstreamLlmTimeout";case "INTERNALERROR":case "INTERNALSERVERERROR":return "internalError";case "STREAMINCOMPLETE":case "CHATSTREAMINCOMPLETE":return "streamIncomplete";case "INVALIDANALYSISTYPE":case "INVALIDUPLOADPURPOSE":return "unknown";default:return "unknown"}}n(ue,"fromWire");var Ze=new Set(["streamTimeout","rateLimited","internalError","upstreamLlmTimeout","streamIncomplete"]);function B(e){return Ze.has(e)}n(B,"isAutoRetryable");var et=new Set(["serviceUnavailable","conflict","idempotencyInFlight"]);function de(e){return B(e)||et.has(e)}n(de,"isRetryableCode");var tt=500,K=8e3,ce=4;function fe(e,t=Math.random){let r=Math.max(0,e),o=Math.min(tt*2**r,K);return Math.floor(t()*o)}n(fe,"backoffDelayMs");var rt=Object.freeze({authExpired:"Please sign in again to continue.",authRejected:"Please sign in again to continue.",sessionRequired:"This app needs to be updated to keep using Everfur.",accessDenied:"This feature isn't available on your account right now.",paymentRequired:"This is part of a paid plan.",quotaExceeded:"You have used today's messages. This resets tomorrow.",rateLimited:"You are sending messages quickly. Try again in a few seconds.",validationFailed:"Something in that request was not right. Check the details and try again.",sdkUpdateRequired:"This app needs to be updated to keep using Everfur.",conflict:"That is already running. Wait for it to finish, then try again.",idempotencyConflict:"That message was already delivered.",idempotencyInFlight:"That is still processing. Give it a moment.",conversationNotFound:"This conversation is no longer available.",petNotFound:"We could not find that pet. Please pick a pet and try again.",resourceNotFound:"We could not find that.",streamTimeout:"The response timed out. Tap retry to try again.",mediaUploadFailed:"We could not upload that photo. Please attach it again.",moderationBlocked:"This request cannot be answered here.",upstreamLlmTimeout:"The response timed out. Tap retry to try again.",internalError:"We hit a snag on our end. Please try again.",notImplemented:"That is not available yet.",serviceUnavailable:"That service is briefly unavailable. Try again shortly.",streamIncomplete:"The connection dropped mid-answer. Tap retry to continue.",unknown:"Something went wrong. Please try again."});function nt(e){return rt[e]}n(nt,"userFacingError");function pe(e,t,r){Object.defineProperty(e,t,{value:r,enumerable:false,writable:false,configurable:false});}n(pe,"defineHidden");var ot=/^[a-z][a-z0-9_]{0,63}$/;function E(e,t){let r=z(t?.wireCode,t?.wireEnvelope),o={code:e,category:le(e),retryable:t?.retryable??de(e),displayMessage:nt(e)};if(t?.httpStatus!==void 0&&(o.httpStatus=t.httpStatus),t?.requestId&&(o.requestId=t.requestId),typeof t?.reasonCode=="string"&&ot.test(t.reasonCode)&&(o.reasonCode=t.reasonCode),r);return t?.wireMessage&&pe(o,"wireMessage",t.wireMessage),t?.raw!==void 0&&t.raw!==null&&pe(o,"raw",t.raw),Object.freeze(o)}n(E,"makeEverfurError");function ye(e){return Object.freeze({kind:"error",terminal:true,code:e.code,retryable:e.retryable,wireMessage:e.wireMessage,synthesized:e.synthesized,lastEventId:e.lastEventId,serverRequestId:e.serverRequestId??null})}n(ye,"errorFrame");function st(e){let t={};return e.mode==="personalized"?t.authorization=`Bearer ${e.token}`:t["x-everfur-partner-key"]=e.publishableKey,e.userRef&&(t["x-everfur-user-ref"]=e.userRef),e.sessionId&&(t["x-everfur-session-id"]=e.sessionId),t}n(st,"authHeaders");function N(e,t){return {...e,headers:{...lt(e.headers),...st(t)}}}n(N,"withAuthHeaders");function lt(e){if(!e)return {};let t={};for(let[r,o]of Object.entries(e)){let i=r.toLowerCase();i==="authorization"||i==="x-everfur-partner-key"||(t[r]=o);}return t}n(lt,"stripAuthHeaders");async function ve(e,t){if(t.mode==="anonymous")return t.transport.request(N(e,{mode:"anonymous",publishableKey:t.publishableKey,userRef:t.userRef,...t.sessionId?{sessionId:t.sessionId}:{}}));let r;try{r=await t.identity.currentToken();}catch{return u(Y())}let o=await t.transport.request(N(e,{mode:"personalized",token:r,userRef:t.userRef,...t.sessionId?{sessionId:t.sessionId}:{}}));if(o.ok||o.error.httpStatus!==401)return o;let i;try{i=await t.identity.currentToken({forceRefresh:!0});}catch{return u(Y())}let a=await t.transport.request(N(e,{mode:"personalized",token:i,userRef:t.userRef,...t.sessionId?{sessionId:t.sessionId}:{}}));return !a.ok&&a.error.httpStatus===401?u(Y(a.error.httpStatus)):a}n(ve,"authedSend");function Y(e){return E("authRejected",{retryable:false,...e!==void 0?{httpStatus:e}:{}})}n(Y,"authRejectedError");function me(e){return E("internalError",{retryable:true,wireMessage:ut(e)})}n(me,"networkError");function ut(e){return e instanceof Error?e.message:typeof e=="string"?e:"network request failed"}n(ut,"describeCause");var dt=3e4,ct=K*2,ft="idempotency-key",pt=new Set(["POST","PUT","PATCH","DELETE"]),yt=Object.freeze({onEvent(){}}),vt=Object.freeze({setTimeout:n((e,t)=>setTimeout(e,t),"setTimeout"),clearTimeout:n(e=>clearTimeout(e),"clearTimeout"),now:n(()=>Date.now(),"now")});function mt(e){let t=e.trim().replace(/[^A-Za-z0-9_.:-]/g,"-");return t.length===0?null:`efs_${t}`.slice(0,128)}n(mt,"seededIdempotencyKey");function U(e){let t=e.observer??yt,r=e.timers??vt,o=e.rng??Math.random,i=e.sleep??((p,c)=>Ot(p,r,c)),a=e.maxAttempts??ce,s=e.unaryTimeoutMs??dt,l=e.newIdempotencyKey??_t(),d=n(p=>{try{t.onEvent(p);}catch{}},"emit");async function g(p,c,b){let S=b?.maxAttempts,A=Math.max(1,S??a),y=b?.idempotent??pt.has(c.method),v=b?.idempotencyKey===void 0?null:mt(b.idempotencyKey),f=y?v??l():null,m=Et(c,f),h=0;for(;;){let x=n(q=>Object.freeze({call:p,method:c.method,path:c.path,attempt:h,...f?{idempotencyKey:f}:{},...q}),"stamp");d(x({phase:"attempt"}));let ne=It(s,r),oe=kt(ne.signal,c.signal),F;try{F=await ve({...m,signal:oe.signal},e.auth);}catch(q){F=u(me(q));}finally{oe.dispose(),ne.cancel();}if(F.ok)return d(x({phase:"settled",ok:true,reason:"ok"})),F;let w=F.error,D=ht(w,h,{maxAttempts:A,rng:o,now:r.now(),aborted:c.signal?.aborted===true,...S!==void 0?{perCallMaxAttempts:S}:{},...e.errorPolicy!==void 0?{policy:e.errorPolicy}:{}}),L={ok:false,code:w.code,reason:D.reason,...w.httpStatus!==void 0?{httpStatus:w.httpStatus}:{},...w.requestId!==void 0?{requestId:w.requestId}:{}};if(!D.retry)return d(x({phase:"settled",...L})),u(w);if(d(x({phase:"retry",...L,delayMs:D.delayMs})),await i(D.delayMs,c.signal),c.signal?.aborted===true)return d(x({phase:"settled",...L,reason:"aborted"})),u(w);h+=1;}}n(g,"send");async function C(p){return N(p,await St(e.auth))}n(C,"authorize");async function*_(p,c,b){d(Object.freeze({call:p,phase:"stream.open",method:c.method,path:c.path,attempt:0}));try{yield*e.auth.transport.stream(c,b);}catch{yield ye({code:"internal_error",retryable:true,wireMessage:null,synthesized:true,lastEventId:null,serverRequestId:null});}}return n(_,"stream"),Object.freeze({send:g,authorize:C,stream:_})}n(U,"createRequestFunnel");function Et(e,t){let r={};for(let[o,i]of Object.entries(e.headers??{}))o.toLowerCase()!==ft&&(r[o]=i);return t!==null&&(r["Idempotency-Key"]=t),{...e,headers:r}}n(Et,"assembleHeaders");function _t(){let e=0;return ()=>`efk_${Date.now().toString(36)}_${(e++).toString(36)}_${Math.random().toString(36).slice(2,12)}`}n(_t,"defaultIdempotencyKeyFactory");var gt=10;function ht(e,t,r){if(r.aborted)return {retry:false,reason:"aborted"};let o=bt(e);if(o==="quota")return {retry:false,reason:"daily-quota-exhausted"};if(o!=="burst"&&!B(e.code))return {retry:false,reason:"terminal-code"};let i=o==="burst"?"burst-throttle":"retryable-code";if(n(()=>{if(r.policy===void 0)return false;try{return !r.policy.shouldRetry(e.code,t)}catch{return false}},"policyVetoedRetry")())return {retry:false,reason:"terminal-code"};let s=n(()=>{if(r.policy===void 0)return null;let g;try{g=r.policy.maxAttempts(e.code);}catch{return null}return typeof g!="number"||!Number.isFinite(g)?null:Math.max(1,Math.min(gt,Math.floor(g)))},"policyCeiling"),l=r.perCallMaxAttempts??s()??r.maxAttempts;if(t+1>=l)return {retry:false,reason:"attempts-exhausted"};let d=Rt(e,r.now);return d!==null?d>ct?{retry:false,reason:"server-reset-beyond-budget"}:{retry:true,reason:i,delayMs:d}:{retry:true,reason:i,delayMs:fe(t,r.rng)}}n(ht,"decideRetry");function bt(e){let t=e.code==="unknown"?ue(Tt(e.raw)):e.code;return t==="quotaExceeded"?"quota":t==="rateLimited"||e.httpStatus===429?"burst":null}n(bt,"throttleKind");function Rt(e,t){let r=wt(e.raw);if(r===null)return null;let o=r-t;return o>0?o:0}n(Rt,"retryOverrideMs");function wt(e){for(let t of _e(e)){let r=t.resets_at,o=Ct(r);if(o!==null)return o}return null}n(wt,"findResetsAt");function _e(e){if(!Ee(e))return [];let t=[e];for(let r of ["error","detail"]){let o=e[r];Ee(o)&&t.push(o);}return t}n(_e,"candidateScopes");function Ct(e){if(typeof e=="number"&&Number.isFinite(e))return e<1e11?Math.round(e*1e3):Math.round(e);if(typeof e=="string"&&e.trim().length>0){let t=Date.parse(e);return Number.isFinite(t)?t:null}return null}n(Ct,"parseInstantMs");function Tt(e){for(let t of _e(e)){let r=t.code;if(typeof r=="string"&&r.length>0)return r}return null}n(Tt,"rawWireCode");function Ee(e){return typeof e=="object"&&e!==null}n(Ee,"isRecord");async function St(e){return e.mode==="anonymous"?{mode:"anonymous",publishableKey:e.publishableKey,userRef:e.userRef,...e.sessionId?{sessionId:e.sessionId}:{}}:{mode:"personalized",token:await e.identity.currentToken(),userRef:e.userRef,...e.sessionId?{sessionId:e.sessionId}:{}}}n(St,"resolveDeviceAuth");function It(e,t){let r=new AbortController,o=t.setTimeout(()=>r.abort(),e);return {signal:r.signal,cancel:n(()=>t.clearTimeout(o),"cancel")}}n(It,"boundedSignal");function kt(e,t){let r=n(()=>{},"noop");if(!t)return {signal:e,dispose:r};let o=new AbortController;if(e.aborted||t.aborted)return o.abort(),{signal:o.signal,dispose:r};let i=n(()=>o.abort(),"onAbort");return e.addEventListener("abort",i,{once:true}),t.addEventListener("abort",i,{once:true}),{signal:o.signal,dispose:n(()=>{e.removeEventListener("abort",i),t.removeEventListener("abort",i);},"dispose")}}n(kt,"mergeSignals");function Ot(e,t,r){return e<=0||r?.aborted===true?Promise.resolve():new Promise(o=>{let i=t.setTimeout(()=>{r?.removeEventListener("abort",a),o();},e),a=n(()=>{t.clearTimeout(i),o();},"onAbort");r?.addEventListener("abort",a,{once:true});})}n(Ot,"delayAbortable");function xt(e){let t=e.raw;if(typeof t!="object"||t===null)return null;let r=t.code;return typeof r=="string"&&r.length>0?r:null}n(xt,"wireCodeOf");function ge(e,t){let r=xt(e);if(r===null)return e;let o=t[r];return o===void 0?e:E(o.code,{retryable:o.retryable,...e.httpStatus!==void 0?{httpStatus:e.httpStatus}:{},...e.requestId!==void 0?{requestId:e.requestId}:{},wireCode:r,reasonCode:r,...e.wireMessage!==void 0?{wireMessage:e.wireMessage}:{},raw:e.raw})}n(ge,"foldWireReason");var Ce=Object.freeze({provider_unsupported:"Everfur does not send through this push provider yet. Register an Expo push token (provider expo) or an FCM registration token (provider fcm); APNs direct is not available in this version.",token_invalid:"The token is not a push token of the given provider. Expo tokens look like ExponentPushToken[...]; FCM registration tokens are long opaque strings. Pass the token exactly as your notification library printed it.",device_cipher_unavailable:"Everfur could not seal the token at rest, so nothing was stored. Retry the registration later; the SDK retries it on the next launch and login.",credentials_missing:"Everfur holds no push credential for this provider on your tenant, so deliveries to it are skipped. Expo needs nothing unless you enabled push security (then your Expo access token). A bare app using FCM supplies its Firebase service-account JSON to Everfur; push credentials are set by Everfur on your tenant, never through the SDK."}),Ft=new Set(["provider_unsupported","token_invalid","device_cipher_unavailable","credentials_missing"]);function Pt(e){let t=e.reasonCode;return t!==void 0&&Ft.has(t)?Ce[t]:null}n(Pt,"explainNotificationsReason");var Te=new Set(["expo","fcm","apns"]),Se=new Set(["ios","android"]),he=4096,be=128,Re=64,Ie=/[- ]/;function R(e,t){return E("validationFailed",{retryable:false,wireMessage:e,...t?{reasonCode:t}:{}})}n(R,"invalid");function Nt(e){if(typeof e!="object"||e===null)return R("registerDevice needs an input object");let{token:t,provider:r,platform:o,installationId:i}=e;return typeof r!="string"||!Te.has(r)?R("provider must be expo, fcm or apns"):typeof o!="string"||!Se.has(o)?R("platform must be ios or android"):typeof t!="string"||t.trim().length===0||t.length>he||Ie.test(t)?R(`token must be a push token of 1..${he} characters with no whitespace`,"token_invalid"):i!==void 0&&(typeof i!="string"||i.length===0||i.length>be)?R(`installationId must be 1..${be} characters`):null}n(Nt,"validateRegister");function At(e){return typeof e!="string"||e.length===0||e.length>Re?R(`deviceId must be 1..${Re} characters`):Ie.test(e)||e.includes("/")||e==="."||e===".."?R("deviceId is not a device id"):null}n(At,"validateDeviceId");function Dt(e){if(typeof e!="object"||e===null)return R("setPreferences needs an input object");let{pushEnabled:t,emailEnabled:r}=e;return typeof t!="boolean"||typeof r!="boolean"?R("pushEnabled and emailEnabled must both be booleans: the route replaces both switches"):null}n(Dt,"validatePreferences");function I(e){return typeof e=="string"&&e.length>0?e:null}n(I,"str");function jt(e){if(typeof e!="object"||e===null)return null;let t=e,r=I(t.device_id),o=I(t.provider),i=I(t.platform),a=I(t.registered_at),s=I(t.last_seen_at);if(r===null||o===null||i===null||a===null||s===null||!Te.has(o)||!Se.has(i))return null;let l=t.installation_id;return Object.freeze({deviceId:r,provider:o,platform:i,installationId:typeof l=="string"&&l.length>0?l:null,registeredAt:a,lastSeenAt:s})}n(jt,"parseDevice");function zt(e){if(typeof e!="object"||e===null)return null;let t=e,r=I(t.updated_at);return typeof t.push_enabled!="boolean"||typeof t.email_enabled!="boolean"||r===null?null:Object.freeze({pushEnabled:t.push_enabled,emailEnabled:t.email_enabled,updatedAt:r})}n(zt,"parsePreferences");function we(e){return E("internalError",{retryable:false,wireMessage:`${e}: the response was not the documented shape`})}n(we,"malformed");var Ut=Object.freeze({provider_unsupported:{code:"validationFailed",retryable:false},token_invalid:{code:"validationFailed",retryable:false},device_cipher_unavailable:{code:"serviceUnavailable",retryable:true}});function H(e){return ge(e,Ut)}n(H,"refine");function G(e){return E("validationFailed",{retryable:false,wireMessage:`the Everfur runtime is disposed; ${e} was called after unmount`})}n(G,"disposed");function W(e){let t=n(()=>{let{services:r}=e.registry;return $({auth:r.authFor(null),...r.errorPolicy?{errorPolicy:r.errorPolicy}:{}})},"over");return {registerDevice:n((r,o)=>e.isDisposed?Promise.resolve(u(G("registerDevice"))):t().registerDevice(r,o),"registerDevice"),unregisterDevice:n((r,o)=>e.isDisposed?Promise.resolve(u(G("unregisterDevice"))):t().unregisterDevice(r,o),"unregisterDevice"),setPreferences:n((r,o)=>e.isDisposed?Promise.resolve(u(G("setPreferences"))):t().setPreferences(r,o),"setPreferences")}}n(W,"createNotificationsClient");function $(e){let t=e.funnel??U({auth:e.auth,...e.errorPolicy?{errorPolicy:e.errorPolicy}:{}}),r=n((o,i)=>i?{...o,signal:i}:o,"withSignal");return {async registerDevice(o,i){let a=Nt(o);if(a!==null)return u(a);let s={token:o.token,provider:o.provider,platform:o.platform};o.installationId!==void 0&&(s.installation_id=o.installationId);let l=await t.send("notifications.registerDevice",r({method:"POST",path:"/widget/v1/me/devices",body:s},i?.signal));if(!l.ok)return u(H(l.error));let d=jt(l.value);return d===null?u(we("registerDevice")):T(d)},async unregisterDevice(o,i){let a=At(o);if(a!==null)return u(a);let s=await t.send("notifications.unregisterDevice",r({method:"DELETE",path:`/widget/v1/me/devices/${encodeURIComponent(o)}`},i?.signal));return s.ok?T(void 0):u(H(s.error))},async setPreferences(o,i){let a=Dt(o);if(a!==null)return u(a);let s=await t.send("notifications.setPreferences",r({method:"PUT",path:"/widget/v1/me/notification-preferences",body:{push_enabled:o.pushEnabled,email_enabled:o.emailEnabled}},i?.signal));if(!s.ok)return u(H(s.error));let l=zt(s.value);return l===null?u(we("setPreferences")):T(l)}}}n($,"createNotificationsClientOver");var k="everfur.notifications.device";var ke=3e3;var Oe=Symbol.for("@everfur/sdk#EverfurContext@v1"),xe=globalThis,Fe=xe[Oe]??(xe[Oe]=react.createContext(null));Fe.displayName??="EverfurContext";function Q(){let e=react.useContext(Fe);if(e===null)throw new P("not-initialized","Everfur hooks must be called inside <EverfurProvider>. Wrap your tree once, high.");return e}n(Q,"useEverfurContext");var ze=1;async function J(e){try{let t=await e.getItem(k);if(t===null)return null;let r=JSON.parse(t);if(typeof r!="object"||r===null)return null;let{v:o,userRef:i,deviceId:a}=r;return o!==ze||typeof i!="string"||typeof a!="string"||a.length===0?null:{userRef:i,deviceId:a}}catch{return null}}n(J,"readStored");async function Vt(e,t){try{await e.setItem(k,JSON.stringify({v:ze,...t}));}catch{}}n(Vt,"writeStored");async function Ne(e){try{await e.removeItem(k);}catch{}}n(Ne,"clearStored");var Ae=Object.freeze({status:"signed_out",device:null,error:null}),De=Object.freeze({status:"no_token",device:null,error:null});function Z(){return E("sessionRequired",{retryable:false,wireMessage:"notifications need a signed-in user on the provider"})}n(Z,"noUser");function Ue(){let{runtime:e}=Q();return react.useMemo(()=>W(e),[e])}n(Ue,"useEverfurNotificationsClient");function Me(e){let{runtime:t,userRef:r}=Q(),{token:o,provider:i,platform:a,installationId:s}=e,l=t.registry.services.kv,d=Ue(),[g,C]=react.useState(r===null?Ae:De),_=react.useRef(null),p=react.useRef(0);react.useEffect(()=>{if(p.current+=1,_.current=null,C(r===null?Ae:De),r===null)return;let y=true;return J(l).then(v=>{if(!y||v===null||v.userRef!==r)return;let f=_.current;if(f===null){_.current=v;return}f.deviceId!==v.deviceId&&d.unregisterDevice(v.deviceId);}),()=>{y=false;}},[d,l,r]);let c=react.useCallback(async(y,v)=>{let f=p.current+=1;C({status:"registering",device:null,error:null});let m=await d.registerDevice({token:v,provider:i,platform:a,...s===void 0?{}:{installationId:s}});if(f!==p.current)return m;if(!m.ok)return C({status:m.error.httpStatus===404?"unavailable":"failed",device:null,error:m.error}),m;let h=_.current;return _.current={userRef:y,deviceId:m.value.deviceId},C({status:"registered",device:m.value,error:null}),await Vt(l,_.current),h!==null&&h.userRef===y&&h.deviceId!==m.value.deviceId&&d.unregisterDevice(h.deviceId),m},[d,l,i,a,s]);react.useEffect(()=>{r===null||o===null||c(r,o);},[c,r,o]),react.useEffect(()=>t.onBeforeLogout(async({userRef:y,auth:v})=>{let f=_.current??await J(l);if(f===null||f.userRef!==y)return;_.current=null;let m=U({auth:v,maxAttempts:1,unaryTimeoutMs:ke,...t.registry.services.errorPolicy?{errorPolicy:t.registry.services.errorPolicy}:{}}),h=await $({auth:v,funnel:m}).unregisterDevice(f.deviceId);(h.ok||h.error.httpStatus===404)&&await Ne(l);}),[t,l]);let b=react.useCallback(async()=>r===null?u(Z()):o===null?u(E("validationFailed",{retryable:false,reasonCode:"token_invalid",wireMessage:"no push token was given"})):c(r,o),[c,r,o]),S=react.useCallback(async()=>{if(r===null)return u(Z());let y=_.current??await J(l);if(y===null||y.userRef!==r)return T(void 0);let v=p.current+=1,f=await d.unregisterDevice(y.deviceId);return f.ok||f.error.httpStatus===404?(_.current=null,await Ne(l),v===p.current&&C({status:"unregistered",device:null,error:null}),f.ok?f:T(void 0)):f},[d,l,r]),A=react.useCallback(y=>r===null?Promise.resolve(u(Z())):d.setPreferences(y),[d,r]);return react.useMemo(()=>({status:g.status,device:g.device,error:g.error,register:b,unregister:S,setPreferences:A}),[g,b,S,A])}n(Me,"useEverfurNotifications");function Yt(e){let t=Me(e),{status:r,error:o,register:i}=t,a=r==="failed"&&o!==null&&o.retryable;return react.useEffect(()=>{if(!a)return;let s=reactNative.AppState.addEventListener("change",l=>{l==="active"&&i();});return ()=>{s.remove();}},[a,i]),t}n(Yt,"useEverfurNotifications");var Le=Object.freeze({"visit.booked":"visit","visit.reminder":"join","visit.rescheduled":"visit","visit.followup_sent":"messages","visit.message_received":"messages","visit.completed":"summary","visit.ended":"visit","visit.cancelled":null,"visit.no_show":null});function qe(e){return Object.prototype.hasOwnProperty.call(Le,e)?Le[e]:"visit"}n(qe,"vetVisitIntentForEvent");var Be=1,Ke=Object.freeze(["record_request","pet","visit","case"]),Ye=Object.freeze(["record_request.updated","record.ready","pet.vaccination.due","visit.booked","visit.cancelled","visit.completed","visit.no_show","visit.rescheduled","visit.reminder","visit.followup_sent","visit.message_received","visit.ended","chat.follow_up_due","chat.reminder_due","record.activation"]),te=["v","event_id","event_type","target"],Ht=new Set(["kind","conversation_id","request_id","visit_ref","case_ref","pet_ref"]),Gt=new Set(Ye),Wt=new Set(Ke),$t=128,Qt=4096,Xt=/^evt_[A-Za-z0-9]{1,64}$/,Jt=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,Zt=/[-]/;function O(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}n(O,"isRecord");function He(e){return Object.keys(e)}n(He,"keysOf");function er(e){if(O(e))return e;if(typeof e!="string"||e.length===0||e.length>Qt)return null;let t=JSON.parse(e);return O(t)?t:null}n(er,"decodeBlock");function tr(e,t){let r=e;for(let o of t){if(!O(r))return;r=r[o];}return r}n(tr,"at");var rr=[[],["data"],["request","content","data"],["notification","request","content","data"]];function nr(e){if(!O(e))return null;for(let t of rr){let r=tr(e,t);if(O(r)&&"everfur"in r)return r.everfur}return te.every(t=>t in e)?e:null}n(nr,"locateBlock");function re(e){return typeof e!="string"||e.length===0||e.length>$t||Zt.test(e)||e.includes("://")||e.toLowerCase().startsWith("everfur")?null:e}n(re,"opaqueString");function Ve(e,t){if(!(t in e))return {ok:true,value:null};let r=re(e[t]);return r===null?{ok:false}:{ok:true,value:r}}n(Ve,"optional");function ee(e,t){return t in e?re(e[t]):null}n(ee,"required");function or(e,t){if(!O(e))return null;let r=He(e);if(!r.includes("kind")||r.some(s=>!Ht.has(s)))return null;let o=e.kind;if(typeof o!="string"||!Wt.has(o))return null;for(let s of r)if(s!=="kind"&&re(e[s])===null)return null;let i=Ve(e,"pet_ref");if(!i.ok)return null;let a=i.value;switch(o){case "record_request":{let s=ee(e,"request_id");return s===null?null:Object.freeze({kind:"record_request",requestId:s,petRef:a})}case "pet":return a===null?null:Object.freeze({kind:"pet",petRef:a});case "visit":{let s=ee(e,"visit_ref");return s===null?null:Object.freeze({kind:"visit",visitRef:s,petRef:a,intent:qe(t)})}case "case":{let s=ee(e,"case_ref");if(s===null)return null;let l=Ve(e,"conversation_id");return !l.ok||l.value!==null&&!Jt.test(l.value)?null:Object.freeze({kind:"case",caseRef:s,conversationId:l.value,petRef:a})}default:return null}}n(or,"parseTarget");function ir(e){let t=He(e);if(t.length!==te.length||te.some(a=>!t.includes(a))||e.v!==Be)return null;let r=e.event_id;if(typeof r!="string"||!Xt.test(r))return null;let o=e.event_type;if(typeof o!="string"||!Gt.has(o))return null;let i=or(e.target,o);return i===null?null:Object.freeze({eventId:r,eventType:o,target:i})}n(ir,"parseBlock");function ar(e){try{let t=er(nr(e));return t===null?null:ir(t)}catch{return null}}n(ar,"parseEverfurNotification");
|
|
2
|
+
exports.EVERFUR_NOTIFICATION_EVENT_TYPES=Ye;exports.EVERFUR_NOTIFICATION_TARGET_KINDS=Ke;exports.EVERFUR_NOTIFICATION_VERSION=Be;exports.NOTIFICATIONS_REASON_MESSAGES=Ce;exports.createNotificationsClient=W;exports.explainNotificationsReason=Pt;exports.parseEverfurNotification=ar;exports.useEverfurNotifications=Yt;exports.useEverfurNotificationsClient=Ue;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { EverfurNotificationsOptions, EverfurNotificationsState } from '../web/notifications/index.cjs';
|
|
2
|
+
export { DevicePlatform, EVERFUR_NOTIFICATION_EVENT_TYPES, EVERFUR_NOTIFICATION_TARGET_KINDS, EVERFUR_NOTIFICATION_VERSION, EverfurNotification, EverfurNotificationEventType, EverfurNotificationTarget, EverfurNotificationTargetKind, EverfurNotificationsStatus, NOTIFICATIONS_REASON_MESSAGES, NotificationPreferences, NotificationPreferencesInput, NotificationsClient, NotificationsReasonCode, NotificationsRuntime, PushProvider, RegisterDeviceInput, RegisteredDevice, createNotificationsClient, explainNotificationsReason, parseEverfurNotification, useEverfurNotificationsClient } from '../web/notifications/index.cjs';
|
|
3
|
+
export { V as VetVisitIntent } from '../visitIntent-D7_yVp1I.cjs';
|
|
4
|
+
export { A as AuthContext, I as IdentityProvider, M as MintedToken, T as TokenProvider } from '../identity-C2-08BZW.cjs';
|
|
5
|
+
export { A as AcceptedFrame, a as AnalysisCompleteFrame, b as AnalysisStartedFrame, D as DeltaFrame, c as DoneFrame, E as ErrorFrame, d as EverfurRequest, e as EverfurRequestBase, F as Frame, f as FrameBase, g as FrameKind, H as HeartbeatFrame, h as HttpMethod, M as MultipartBody, T as TransportPort, U as UnknownFrame, i as UrgencyLevel } from '../config--Wu1Umhd.cjs';
|
|
6
|
+
export { B as Brand, C as ConversationId, P as PetRef, R as RecordsRequestId, U as UserRef, _ as __brand } from '../ids-B2GAAifq.cjs';
|
|
7
|
+
export { E as EverfurError, a as EverfurErrorCategory, b as EverfurErrorCode, c as EverfurResult } from '../EverfurResult-DN9pL2Ab.cjs';
|
|
8
|
+
export { E as ErrorPolicyPort } from '../ErrorPolicyPort-CNf4uQZP.cjs';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Register this install's push token for the signed-in member, keep it registered as the token and the user
|
|
12
|
+
* change, unregister it before sign-out, and retry a retryable failure on the next foreground. Call it once, high
|
|
13
|
+
* in the tree under `EverfurProvider`.
|
|
14
|
+
*/
|
|
15
|
+
declare function useEverfurNotifications(options: EverfurNotificationsOptions): EverfurNotificationsState;
|
|
16
|
+
|
|
17
|
+
export { EverfurNotificationsOptions, EverfurNotificationsState, useEverfurNotifications };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { EverfurNotificationsOptions, EverfurNotificationsState } from '../web/notifications/index.js';
|
|
2
|
+
export { DevicePlatform, EVERFUR_NOTIFICATION_EVENT_TYPES, EVERFUR_NOTIFICATION_TARGET_KINDS, EVERFUR_NOTIFICATION_VERSION, EverfurNotification, EverfurNotificationEventType, EverfurNotificationTarget, EverfurNotificationTargetKind, EverfurNotificationsStatus, NOTIFICATIONS_REASON_MESSAGES, NotificationPreferences, NotificationPreferencesInput, NotificationsClient, NotificationsReasonCode, NotificationsRuntime, PushProvider, RegisterDeviceInput, RegisteredDevice, createNotificationsClient, explainNotificationsReason, parseEverfurNotification, useEverfurNotificationsClient } from '../web/notifications/index.js';
|
|
3
|
+
export { V as VetVisitIntent } from '../visitIntent-D7_yVp1I.js';
|
|
4
|
+
export { A as AuthContext, I as IdentityProvider, M as MintedToken, T as TokenProvider } from '../identity-CEi9GRFZ.js';
|
|
5
|
+
export { A as AcceptedFrame, a as AnalysisCompleteFrame, b as AnalysisStartedFrame, D as DeltaFrame, c as DoneFrame, E as ErrorFrame, d as EverfurRequest, e as EverfurRequestBase, F as Frame, f as FrameBase, g as FrameKind, H as HeartbeatFrame, h as HttpMethod, M as MultipartBody, T as TransportPort, U as UnknownFrame, i as UrgencyLevel } from '../config-C7eb_IMD.js';
|
|
6
|
+
export { B as Brand, C as ConversationId, P as PetRef, R as RecordsRequestId, U as UserRef, _ as __brand } from '../ids-B2GAAifq.js';
|
|
7
|
+
export { E as EverfurError, a as EverfurErrorCategory, b as EverfurErrorCode, c as EverfurResult } from '../EverfurResult-DN9pL2Ab.js';
|
|
8
|
+
export { E as ErrorPolicyPort } from '../ErrorPolicyPort-CwbfmxzJ.js';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Register this install's push token for the signed-in member, keep it registered as the token and the user
|
|
12
|
+
* change, unregister it before sign-out, and retry a retryable failure on the next foreground. Call it once, high
|
|
13
|
+
* in the tree under `EverfurProvider`.
|
|
14
|
+
*/
|
|
15
|
+
declare function useEverfurNotifications(options: EverfurNotificationsOptions): EverfurNotificationsState;
|
|
16
|
+
|
|
17
|
+
export { EverfurNotificationsOptions, EverfurNotificationsState, useEverfurNotifications };
|