@everfur/sdk 0.4.0 → 0.5.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 +182 -0
- package/README.md +9 -8
- package/dist/{Chat-BZZ-Py5l.d.ts → Chat-BOX-03ho.d.ts} +17 -3
- package/dist/{Chat-Dq4fffIO.d.cts → Chat-TA-aTcVF.d.cts} +17 -3
- package/dist/{DepthViews-CkYri51q.d.ts → DepthViews-CgjX2AJ5.d.ts} +1 -1
- package/dist/{DepthViews-CL75jyRA.d.cts → DepthViews-Cviea-ri.d.cts} +1 -1
- package/dist/{DepthViews-BG3E25MD.d.ts → DepthViews-D2dRqWRq.d.ts} +1 -1
- package/dist/{DepthViews-B_hIypI6.d.cts → DepthViews-DSFyaSeL.d.cts} +1 -1
- package/dist/{ErrorPolicyPort-CwbfmxzJ.d.ts → ErrorPolicyPort-D22LUVrK.d.ts} +1 -1
- package/dist/{ErrorPolicyPort-CNf4uQZP.d.cts → ErrorPolicyPort-D6CybiqJ.d.cts} +1 -1
- package/dist/{EverfurResult-DN9pL2Ab.d.cts → EverfurError-DmELDpXp.d.cts} +1 -67
- package/dist/{EverfurResult-DN9pL2Ab.d.ts → EverfurError-DmELDpXp.d.ts} +1 -67
- package/dist/EverfurResult-SGvHKsCB.d.ts +69 -0
- package/dist/EverfurResult-ZtH-YV1h.d.cts +69 -0
- package/dist/animations/index.d.cts +6 -5
- package/dist/animations/index.d.ts +6 -5
- package/dist/{attachments-BrUWQYNK.d.ts → attachments-C_vtFu2f.d.ts} +7 -6
- package/dist/{attachments-D_SECjr1.d.cts → attachments-DHvnITuE.d.cts} +7 -6
- package/dist/{attachments-DpldrvIW.d.ts → attachments-oD5U2fXI.d.ts} +3 -3
- package/dist/{attachments-BorG422I.d.cts → attachments-pIdGOQfm.d.cts} +3 -3
- package/dist/{bookingCopy-CqtDYvCR.d.ts → bookingCopy-CJir9mjb.d.ts} +417 -14
- package/dist/{bookingCopy-SREvkG19.d.cts → bookingCopy-DfuA13dh.d.cts} +417 -14
- package/dist/branding-Xb_wL8N1.d.cts +212 -0
- package/dist/branding-xpQ056sM.d.ts +212 -0
- package/dist/callCopy-rDH9JTFo.d.cts +45 -0
- package/dist/callCopy-rDH9JTFo.d.ts +45 -0
- package/dist/callRoom-7wrE3RP2.d.ts +62 -0
- package/dist/callRoom-B_EqaUzx.d.cts +62 -0
- package/dist/{casesRepository-DwtZVsbj.d.cts → casesRepository-B-Eg8ZJ3.d.cts} +14 -2
- package/dist/{casesRepository-v6QczS9N.d.ts → casesRepository-DHgIYKN9.d.ts} +14 -2
- package/dist/chat/index.cjs +1 -1
- package/dist/chat/index.d.cts +12 -11
- package/dist/chat/index.d.ts +12 -11
- package/dist/chat/index.js +1 -1
- package/dist/client/index.cjs +5 -5
- package/dist/client/index.d.cts +14 -12
- package/dist/client/index.d.ts +14 -12
- package/dist/client/index.js +5 -5
- package/dist/{config--Wu1Umhd.d.cts → config-ClI7QxB0.d.ts} +3 -2
- package/dist/{config-C7eb_IMD.d.ts → config-DAFbf721.d.cts} +3 -2
- package/dist/consent/index.d.cts +9 -8
- package/dist/consent/index.d.ts +9 -8
- package/dist/{context-CL3lyuy1.d.cts → context-B-dUM1Qf.d.cts} +9 -8
- package/dist/{context-CahAEha8.d.ts → context-CZbgF_OH.d.ts} +9 -8
- package/dist/{copy-DdVFDL01.d.ts → copy-CeRH3NXy.d.ts} +5 -4
- package/dist/{copy-UeUJVk8X.d.cts → copy-CneuYdrO.d.cts} +5 -4
- package/dist/core/index.cjs +9 -9
- package/dist/core/index.d.cts +19 -17
- package/dist/core/index.d.ts +19 -17
- package/dist/core/index.js +9 -9
- package/dist/{depth-D5HwcvKC.d.cts → depth-B3NFKlF9.d.cts} +6 -5
- package/dist/{depth-DvPwPuT_.d.ts → depth-DO3Ko_qs.d.ts} +6 -5
- package/dist/{entitlementRepository-B7egEdW6.d.ts → entitlementRepository-74kW5mK0.d.ts} +4 -4
- package/dist/{entitlementRepository-BpJ7tiwl.d.cts → entitlementRepository-m6zLUmiB.d.cts} +4 -4
- package/dist/{identity-C2-08BZW.d.cts → identity-C7uxGwfT.d.cts} +2 -2
- package/dist/{identity-CEi9GRFZ.d.ts → identity-CLAUq-K4.d.ts} +2 -2
- package/dist/index.cjs +6 -6
- package/dist/index.d.cts +19 -17
- package/dist/index.d.ts +19 -17
- package/dist/index.js +6 -6
- package/dist/{models-D2EUxPZY.d.cts → models-Bn2z0NNo.d.cts} +1 -1
- package/dist/{models-B-Uh2LTf.d.ts → models-DSqA5Ahs.d.ts} +1 -1
- package/dist/notifications/index.d.cts +5 -4
- package/dist/notifications/index.d.ts +5 -4
- package/dist/{pets-JVCXgRgR.d.cts → pets-BoB5B7kp.d.cts} +2 -2
- package/dist/{pets-DJv2sj2H.d.ts → pets-w4M9d-Dn.d.ts} +2 -2
- package/dist/{petsRepository-Bk6GDwLs.d.ts → petsRepository-BjKJ8UsN.d.ts} +2 -2
- package/dist/{petsRepository-B_gKbAzJ.d.cts → petsRepository-DZZoEG3r.d.cts} +2 -2
- package/dist/photo/index.d.cts +3 -2
- package/dist/photo/index.d.ts +3 -2
- package/dist/{ports-D7YW8qz9.d.ts → ports-BO3bzTJg.d.ts} +13 -6
- package/dist/{ports-BY2ph0_y.d.cts → ports-C2EVK416.d.cts} +13 -6
- package/dist/records/depth/index.d.cts +11 -10
- package/dist/records/depth/index.d.ts +11 -10
- package/dist/records/index.cjs +3 -3
- package/dist/records/index.d.cts +25 -14
- package/dist/records/index.d.ts +25 -14
- package/dist/records/index.js +3 -3
- package/dist/{requestFunnel-DFMGcluw.d.ts → requestFunnel-D7ipek3e.d.ts} +5 -4
- package/dist/{requestFunnel-BjDpqqvm.d.cts → requestFunnel-Djjwgoe9.d.cts} +5 -4
- package/dist/{runtimeTypes-w5KqBMcs.d.ts → runtimeTypes-CTL3yToK.d.ts} +7 -7
- package/dist/{runtimeTypes-gZEJu-da.d.cts → runtimeTypes-D2C9uD85.d.cts} +7 -7
- package/dist/server/events/index.cjs +1 -1
- package/dist/server/events/index.d.cts +4 -3
- package/dist/server/events/index.d.ts +4 -3
- package/dist/server/events/index.js +1 -1
- package/dist/server/index.cjs +1 -1
- package/dist/server/index.d.cts +5 -4
- package/dist/server/index.d.ts +5 -4
- package/dist/server/index.js +1 -1
- package/dist/televet/booking/index.cjs +1 -1
- package/dist/televet/booking/index.d.cts +303 -31
- package/dist/televet/booking/index.d.ts +303 -31
- package/dist/televet/booking/index.js +1 -1
- package/dist/televet/call/index.cjs +1 -1
- package/dist/televet/call/index.d.cts +25 -5
- package/dist/televet/call/index.d.ts +25 -5
- package/dist/televet/call/index.js +1 -1
- package/dist/televet/index.cjs +1 -1
- package/dist/televet/index.d.cts +41 -71
- package/dist/televet/index.d.ts +41 -71
- package/dist/televet/index.js +1 -1
- package/dist/televetGlobal-CEk0_cW9.d.cts +34 -0
- package/dist/televetGlobal-Cs9Wbqsy.d.ts +34 -0
- package/dist/testing/index.cjs +4 -4
- package/dist/testing/index.d.cts +3 -2
- package/dist/testing/index.d.ts +3 -2
- package/dist/testing/index.js +4 -4
- package/dist/testing/rn/index.cjs +1 -1
- package/dist/testing/rn/index.d.cts +13 -11
- package/dist/testing/rn/index.d.ts +13 -11
- package/dist/testing/rn/index.js +1 -1
- package/dist/testing/web/index.d.cts +14 -13
- package/dist/testing/web/index.d.ts +14 -13
- package/dist/{timelineRows-C15jxFFH.d.ts → timelineRows-7yFNK_rU.d.ts} +1 -1
- package/dist/{timelineRows-odO8g9r2.d.cts → timelineRows-CzR1T2DR.d.cts} +1 -1
- package/dist/{branding-CsRdeNwK.d.cts → tokens-CIngRkvt.d.cts} +7 -211
- package/dist/{branding-CsRdeNwK.d.ts → tokens-CIngRkvt.d.ts} +7 -211
- package/dist/{typeStyle-DmoyacDG.d.ts → typeStyle-DHJzDaUo.d.cts} +2 -1
- package/dist/{typeStyle-CKqVYD6L.d.cts → typeStyle-YPS_MXeI.d.ts} +2 -1
- package/dist/{useRecordsDepth-C6rjEaLn.d.cts → useRecordsDepth-Bnw36jPr.d.cts} +24 -5
- package/dist/{useRecordsDepth-crhBllQK.d.ts → useRecordsDepth-DFF7Faxx.d.ts} +24 -5
- package/dist/{useVetVisit-CjmMa896.d.ts → useVetVisit-BsjoDO-n.d.ts} +21 -6
- package/dist/{useVetVisit-Bc84hWUU.d.cts → useVetVisit-Ds8f1peV.d.cts} +21 -6
- package/dist/video/index.d.cts +3 -2
- package/dist/video/index.d.ts +3 -2
- package/dist/{view-Bxwxp4xD.d.ts → view-BqcOYFTr.d.ts} +5 -4
- package/dist/{view-DyitEO0m.d.cts → view-CaJs8WFH.d.cts} +5 -4
- package/dist/web/consent/index.d.cts +9 -8
- package/dist/web/consent/index.d.ts +9 -8
- package/dist/web/index.cjs +10 -10
- package/dist/web/index.d.cts +42 -19
- package/dist/web/index.d.ts +42 -19
- package/dist/web/index.js +10 -10
- package/dist/web/notifications/index.d.cts +7 -6
- package/dist/web/notifications/index.d.ts +7 -6
- package/dist/web/records/depth/index.cjs +2 -2
- package/dist/web/records/depth/index.d.cts +11 -10
- package/dist/web/records/depth/index.d.ts +11 -10
- package/dist/web/records/depth/index.js +2 -2
- package/dist/web/records/index.cjs +3 -3
- package/dist/web/records/index.d.cts +53 -35
- package/dist/web/records/index.d.ts +53 -35
- package/dist/web/records/index.js +3 -3
- package/dist/web/televet/booking/index.cjs +2 -1
- package/dist/web/televet/booking/index.d.cts +453 -32
- package/dist/web/televet/booking/index.d.ts +453 -32
- package/dist/web/televet/booking/index.js +2 -1
- package/dist/web/televet/call/index.cjs +1 -1
- package/dist/web/televet/call/index.d.cts +3 -1
- package/dist/web/televet/call/index.d.ts +3 -1
- package/dist/web/televet/call/index.js +1 -1
- package/dist/web/televet/index.cjs +1 -1
- package/dist/web/televet/index.d.cts +40 -74
- package/dist/web/televet/index.d.ts +40 -74
- package/dist/web/televet/index.js +1 -1
- package/package.json +3 -2
- package/dist/callCopy-DoQKG3-L.d.cts +0 -40
- package/dist/callCopy-DoQKG3-L.d.ts +0 -40
package/dist/televet/index.d.ts
CHANGED
|
@@ -1,67 +1,44 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { B as Brand, _ as __brand } from '../ids-B2GAAifq.js';
|
|
3
|
-
import { U as UseVetVisitOptions, a as UseVetVisitState, V as VetVisitEntry, b as VetVisitErrorReason, c as VetVisitController } from '../useVetVisit-CjmMa896.js';
|
|
4
|
-
export { d as VetVisitAvailability, e as VetVisitHandoff, f as VetVisitHandoffOptions, g as VetVisitHandoffVisit, h as VetVisitOpenResult, i as VetVisitReturn, j as VetVisitStatus, p as parseVetVisitReturn, v as vetVisitErrorReasonOf } from '../useVetVisit-CjmMa896.js';
|
|
1
|
+
import { E as EverfurTelevetFlowRequest, a as EverfurTelevetFlowPresenter } from '../televetGlobal-Cs9Wbqsy.js';
|
|
5
2
|
import { ReactNode } from 'react';
|
|
3
|
+
import { U as UseVetVisitOptions, a as UseVetVisitState, V as VetVisitEntry, b as VetVisitErrorReason, c as VetVisitController } from '../useVetVisit-BsjoDO-n.js';
|
|
4
|
+
export { d as VetVisitAvailability, e as VetVisitHandoff, f as VetVisitHandoffOptions, g as VetVisitHandoffVisit, h as VetVisitOpenResult, i as VetVisitReturn, j as VetVisitStatus, p as parseVetVisitReturn, v as vetVisitErrorReasonOf } from '../useVetVisit-BsjoDO-n.js';
|
|
6
5
|
import { StyleProp, ViewStyle, TextStyle } from 'react-native';
|
|
7
|
-
import { E as EverfurError } from '../
|
|
8
|
-
export { a as EverfurErrorCategory, b as EverfurErrorCode
|
|
6
|
+
import { E as EverfurError } from '../EverfurError-DmELDpXp.js';
|
|
7
|
+
export { a as EverfurErrorCategory, b as EverfurErrorCode } from '../EverfurError-DmELDpXp.js';
|
|
8
|
+
import { P as PetRef } from '../ids-B2GAAifq.js';
|
|
9
|
+
export { B as Brand, _ as __brand } from '../ids-B2GAAifq.js';
|
|
9
10
|
import { V as VetVisitIntent } from '../visitIntent-D7_yVp1I.js';
|
|
10
11
|
export { a as VET_VISIT_INTENTS, i as isVetVisitIntent } from '../visitIntent-D7_yVp1I.js';
|
|
12
|
+
export { E as EverfurResult } from '../EverfurResult-SGvHKsCB.js';
|
|
11
13
|
|
|
12
14
|
/**
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* Deliberately the scoping the BUTTON was given and nothing more. The host already holds the session, the
|
|
16
|
-
* theme and the navigator; what it cannot know is which pet and which state this particular button was
|
|
17
|
-
* placed for, so that, and only that, travels.
|
|
18
|
-
*/
|
|
19
|
-
interface EverfurTelevetFlowRequest {
|
|
20
|
-
/** The pet this button was scoped to, when it was scoped to one. */
|
|
21
|
-
readonly petRef?: PetRef | null | undefined;
|
|
22
|
-
/** The member's US state, when the host gave one. The booking screens preflight availability with it. */
|
|
23
|
-
readonly usState?: string | null | undefined;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* The host's presenter: show the Everfur booking flow. Called on press, and expected to navigate or present.
|
|
27
|
-
*
|
|
28
|
-
* It returns nothing. The button is not waiting on it and has nothing to do with the result: presenting a
|
|
29
|
-
* screen is the host's business, and a presenter that throws is contained (see `presentEverfurTelevetFlow`)
|
|
30
|
-
* rather than allowed to break the press.
|
|
31
|
-
*/
|
|
32
|
-
type EverfurTelevetFlowPresenter = (request: EverfurTelevetFlowRequest) => void;
|
|
33
|
-
/**
|
|
34
|
-
* Register how this app presents the in-app vet visit. Call it ONCE, in your app entry:
|
|
15
|
+
* Register how this app presents a vet visit. Call it ONCE, in your app entry, only if you want to own the
|
|
16
|
+
* destination:
|
|
35
17
|
*
|
|
36
18
|
* ```ts
|
|
37
19
|
* import { registerEverfurTelevetFlow } from '@everfur/sdk/televet';
|
|
38
|
-
* registerEverfurTelevetFlow(() => navigationRef.navigate('
|
|
20
|
+
* registerEverfurTelevetFlow((request) => navigationRef.navigate('EverfurVisit', request));
|
|
39
21
|
* ```
|
|
40
22
|
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
* and what a partner does to go back to the hosted visit everywhere at once.
|
|
23
|
+
* Without it every vet entry opens the in-app experience Everfur provides. Passing `null` unregisters it,
|
|
24
|
+
* which is what a test does between cases.
|
|
44
25
|
*/
|
|
45
26
|
declare function registerEverfurTelevetFlow(next: EverfurTelevetFlowPresenter | null): void;
|
|
46
|
-
/** Is
|
|
27
|
+
/** Is a presenter registered? */
|
|
47
28
|
declare function hasEverfurTelevetFlow(): boolean;
|
|
48
29
|
/**
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
* A THROWING PRESENTER IS NOT A DEAD BUTTON. A host navigator can throw (an unmounted ref, a route that was
|
|
53
|
-
* renamed), and the member pressing the button has no idea any of that happened. So a throw is caught and
|
|
54
|
-
* reported as "not handed over", and the caller then mints and opens the hosted visit: the member reaches a
|
|
55
|
-
* vet either way, which is the floor this whole file is built around. The throw is not swallowed silently -
|
|
56
|
-
* it is re-surfaced to the partner's engineer through the console, because a navigator that throws on every
|
|
57
|
-
* press is a defect in their app that they need to see.
|
|
30
|
+
* Hand a request to the registered presenter. Answers whether it PRESENTED: false when nothing is registered,
|
|
31
|
+
* when the presenter declined (returned false), and when it threw (reported to the console, never rendered).
|
|
58
32
|
*/
|
|
59
33
|
declare function presentEverfurTelevetFlow(request: EverfurTelevetFlowRequest): boolean;
|
|
60
34
|
|
|
35
|
+
/** Renders the in-app vet visit Everfur provides, while one is open. Renders nothing otherwise. */
|
|
36
|
+
declare function EverfurTelevetHost(): ReactNode;
|
|
37
|
+
|
|
61
38
|
interface UseNativeVetVisitOptions extends UseVetVisitOptions {
|
|
62
39
|
/**
|
|
63
|
-
*
|
|
64
|
-
* and never log, store or share it.
|
|
40
|
+
* `prefer: 'redirect'` only: opens the minted visit URL. Defaults to `Linking.openURL`. Receives a
|
|
41
|
+
* single-use URL: open it once, now, and never log, store or share it.
|
|
65
42
|
*/
|
|
66
43
|
readonly openUrl?: ((url: string) => Promise<unknown>) | undefined;
|
|
67
44
|
}
|
|
@@ -69,6 +46,10 @@ interface UseNativeVetVisitOptions extends UseVetVisitOptions {
|
|
|
69
46
|
* The vet visit hook for a React Native app. `available` is false (render nothing) unless Everfur grants vet
|
|
70
47
|
* visits to this signed-in user. Requires a signed session: pass `user` with a `getToken` backed by your
|
|
71
48
|
* server's session mint.
|
|
49
|
+
*
|
|
50
|
+
* The visit opens IN YOUR APP: your registered presenter, else the in-app experience rendered by a mounted
|
|
51
|
+
* `EverfurTelevetHost` (mount one once at your root if no `VetVisitButton` or `EverfurChat` is mounted, for
|
|
52
|
+
* example to open a tapped notification). Pass `prefer: 'redirect'` for the hosted visit instead.
|
|
72
53
|
*/
|
|
73
54
|
declare function useVetVisit(opts?: UseNativeVetVisitOptions): UseVetVisitState;
|
|
74
55
|
|
|
@@ -78,15 +59,14 @@ interface VetVisitButtonProps {
|
|
|
78
59
|
/** The button label. Defaults to Everfur's label. */
|
|
79
60
|
readonly label?: string | undefined;
|
|
80
61
|
/**
|
|
81
|
-
*
|
|
62
|
+
* `prefer="redirect"` only: opens the minted URL. Defaults to `Linking.openURL` (the system browser).
|
|
82
63
|
*
|
|
83
|
-
* This is the redirect path's opener, not the button's destination
|
|
84
|
-
* `prefer` plus what the app registered; see the note on `prefer`.
|
|
64
|
+
* This is the redirect path's opener, not the button's destination; see the note on `prefer`.
|
|
85
65
|
*/
|
|
86
66
|
readonly openUrl?: ((url: string) => Promise<unknown>) | undefined;
|
|
87
|
-
/**
|
|
67
|
+
/** `prefer="redirect"` only: called after the URL was handed to the browser, with the return flow id. */
|
|
88
68
|
readonly onOpened?: ((flowId: string | null) => void) | undefined;
|
|
89
|
-
/**
|
|
69
|
+
/** `prefer="redirect"` only: the KEY of a return destination your tenant registered with Everfur. */
|
|
90
70
|
readonly returnTo?: string | null | undefined;
|
|
91
71
|
/** The user's US state. When set, the button renders only once Everfur confirms a visit is available there. */
|
|
92
72
|
readonly usState?: string | null | undefined;
|
|
@@ -94,7 +74,8 @@ interface VetVisitButtonProps {
|
|
|
94
74
|
readonly entry?: VetVisitEntry | null | undefined;
|
|
95
75
|
/**
|
|
96
76
|
* TV-01. A visit this member already has. The button then OPENS that visit rather than starting a booking:
|
|
97
|
-
* put the `visitRef` a tapped push carries here.
|
|
77
|
+
* put the `visitRef` a tapped push carries here. It opens in your app like a booking does, carried to your
|
|
78
|
+
* destination as `request.visitRef`; only `prefer="redirect"` sends it to the hosted visit.
|
|
98
79
|
*/
|
|
99
80
|
readonly visitRef?: string | null | undefined;
|
|
100
81
|
/** What to open for `visitRef`: `visit` (the default), `join`, `summary` or `messages`. */
|
|
@@ -102,31 +83,20 @@ interface VetVisitButtonProps {
|
|
|
102
83
|
/** Called when the visit could not be opened. `error` is null for a device-side failure. */
|
|
103
84
|
readonly onError?: ((reason: VetVisitErrorReason, error: EverfurError | null) => void) | undefined;
|
|
104
85
|
/**
|
|
105
|
-
*
|
|
106
|
-
*
|
|
107
|
-
*
|
|
108
|
-
*
|
|
109
|
-
* mounts, and the SDK owns no navigator, so the host is the only thing that can say where it lives - which
|
|
110
|
-
* is why this is a callback and not a `mode` flag the button could not honour.
|
|
111
|
-
*
|
|
112
|
-
* `visitRef` still wins over it: a tapped push that names an existing visit opens THAT visit, and there is
|
|
113
|
-
* no in-app surface for one yet. Sending an owner into a fresh booking funnel because they tapped a reminder
|
|
114
|
-
* for the visit they already have is the wrong screen, loudly.
|
|
86
|
+
* Your own destination for THIS button, called with the request (the pet, the state and, for an existing
|
|
87
|
+
* visit, `visitRef` and `intent`). It wins over the registry and over the SDK's own experience: a host that
|
|
88
|
+
* threaded a callback into one button said where that button goes. Omit it and the press opens your
|
|
89
|
+
* registered presenter, else the in-app experience Everfur provides.
|
|
115
90
|
*/
|
|
116
|
-
readonly onStartInApp?: (() => void) | undefined;
|
|
91
|
+
readonly onStartInApp?: ((request: EverfurTelevetFlowRequest) => void) | undefined;
|
|
117
92
|
/**
|
|
118
93
|
* Which destination a press takes. Defaults to `'in-app'`.
|
|
119
94
|
*
|
|
120
|
-
*
|
|
121
|
-
*
|
|
122
|
-
* the press mints and opens the hosted visit exactly as 0.3.0 did. That is the floor: an app that upgrades
|
|
123
|
-
* and changes nothing keeps a working button, and the member always reaches a vet.
|
|
124
|
-
*
|
|
125
|
-
* `'redirect'` is the explicit opt-in back to the browser handoff. It ignores the registry entirely, which
|
|
126
|
-
* is what a partner wants for a surface they deliberately keep hosted.
|
|
95
|
+
* `'in-app'` keeps the member in your app: `onStartInApp`, else your registered presenter, else the in-app
|
|
96
|
+
* experience Everfur provides. Nothing is minted and nothing opens the browser.
|
|
127
97
|
*
|
|
128
|
-
* `
|
|
129
|
-
* is
|
|
98
|
+
* `'redirect'` is the explicit opt-in to the hosted Everfur visit in the browser (or `openUrl`). It ignores
|
|
99
|
+
* `onStartInApp` and the registry, which is what a partner wants for a surface they deliberately keep hosted.
|
|
130
100
|
*/
|
|
131
101
|
readonly prefer?: 'in-app' | 'redirect' | undefined;
|
|
132
102
|
/** Merged over the button's own style. */
|
|
@@ -139,4 +109,4 @@ interface VetVisitButtonProps {
|
|
|
139
109
|
/** Opens the Everfur vet visit, in-app by default. Renders nothing unless vet visits are granted. */
|
|
140
110
|
declare function VetVisitButton(props: VetVisitButtonProps): ReactNode;
|
|
141
111
|
|
|
142
|
-
export { EverfurError,
|
|
112
|
+
export { EverfurError, EverfurTelevetFlowPresenter, EverfurTelevetFlowRequest, EverfurTelevetHost, PetRef, type UseNativeVetVisitOptions, UseVetVisitOptions, UseVetVisitState, VetVisitButton, type VetVisitButtonProps, VetVisitController, VetVisitEntry, VetVisitErrorReason, VetVisitIntent, hasEverfurTelevetFlow, presentEverfurTelevetFlow, registerEverfurTelevetFlow, useVetVisit };
|
package/dist/televet/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import {createContext,forwardRef,useMemo,createElement,useRef,useContext,useSyncExternalStore,useState,useEffect,useCallback}from'react';import {Linking,TextInput,Pressable,StyleSheet,Text}from'react-native';import {jsx}from'react/jsx-runtime';var pr=Object.defineProperty;var n=(e,r)=>pr(e,"name",{value:r,configurable:true});var Q=null;function yr(e){Q=e;}n(yr,"registerEverfurTelevetFlow");function X(){return Q!==null}n(X,"hasEverfurTelevetFlow");function Z(e){let r=Q;if(r===null)return false;try{return r(e),!0}catch(t){return console.warn("[everfur] The in-app vet visit presenter registered with registerEverfurTelevetFlow threw, so this press fell back to the hosted visit in the browser. The member reached a vet, but your navigation did not run - check the destination you registered.",t),false}}n(Z,"presentEverfurTelevetFlow");var J=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(J.map(e=>e.wireCode));var mr=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"}),Ee=Object.freeze(J.map(e=>Object.freeze({wireCode:e.wireCode,envelope:e.envelope,retryable:e.retryable,normalized:mr[e.wireCode]}))),vr=new Map(Ee.map(e=>[e.envelope+e.wireCode.toUpperCase(),e])),br=Object.freeze(["http_envelope",...[...new Set(Ee.map(e=>e.envelope))].filter(e=>e!=="http_envelope").sort()]);function L(e,r){if(typeof e!="string")return;let t=e.trim().toUpperCase();if(t.length!==0)for(let o of [r??"http_envelope",...br]){let i=vr.get(o+t);if(i)return i}}n(L,"contractErrorFor");function Er(e){return e.envelope==="sse_frame"?`/errors#sse-${e.wireCode}`:e.envelope==="oauth_error"?`/errors#oauth-${e.wireCode}`:`/errors#${e.wireCode}`}n(Er,"contractDocUrl");function ge(e){return null}n(ge,"publishedDocUrl");var gr=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 he(e){return gr[e]}n(he,"categoryFor");function _e(e){let r=L(e);if(r)return r.normalized;let t=(e??"").trim().toUpperCase(),o=t.replace(/[^A-Z0-9]/g,"");if(o==="AUTHREJECTED")return "authRejected";if(t.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(_e,"fromWire");var hr=new Set(["streamTimeout","rateLimited","internalError","upstreamLlmTimeout","streamIncomplete"]);function ee(e){return hr.has(e)}n(ee,"isAutoRetryable");var _r=new Set(["serviceUnavailable","conflict","idempotencyInFlight"]);function Re(e){return ee(e)||_r.has(e)}n(Re,"isRetryableCode");var Rr=500,re=8e3,Te=4;function Ce(e,r=Math.random){let t=Math.max(0,e),o=Math.min(Rr*2**t,re);return Math.floor(r()*o)}n(Ce,"backoffDelayMs");var Tr=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 te(e){return Tr[e]}n(te,"userFacingError");function we(e,r,t){Object.defineProperty(e,r,{value:t,enumerable:false,writable:false,configurable:false});}n(we,"defineHidden");var Cr=/^[a-z][a-z0-9_]{0,63}$/;function F(e,r){let t=L(r?.wireCode,r?.wireEnvelope),o={code:e,category:he(e),retryable:r?.retryable??Re(e),displayMessage:te(e)};if(r?.httpStatus!==void 0&&(o.httpStatus=r.httpStatus),r?.requestId&&(o.requestId=r.requestId),typeof r?.reasonCode=="string"&&Cr.test(r.reasonCode)&&(o.reasonCode=r.reasonCode),t);return r?.wireMessage&&we(o,"wireMessage",r.wireMessage),r?.raw!==void 0&&r.raw!==null&&we(o,"raw",r.raw),Object.freeze(o)}n(F,"makeEverfurError");function ne(e,r){return Object.freeze(r===void 0?{ok:true,value:e}:{ok:true,value:e,warning:r})}n(ne,"ok");function h(e){return Object.freeze({ok:false,error:e})}n(h,"err");var U=class U extends Error{constructor(r,t){super(t),this.name="EverfurConfigError",this.kind=r,Object.setPrototypeOf(this,U.prototype);}};n(U,"EverfurConfigError");var z=U;function xe(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(xe,"errorFrame");function Sr(e){let r={};return e.mode==="personalized"?r.authorization=`Bearer ${e.token}`:r["x-everfur-partner-key"]=e.publishableKey,e.userRef&&(r["x-everfur-user-ref"]=e.userRef),e.sessionId&&(r["x-everfur-session-id"]=e.sessionId),r}n(Sr,"authHeaders");function j(e,r){return {...e,headers:{...kr(e.headers),...Sr(r)}}}n(j,"withAuthHeaders");function kr(e){if(!e)return {};let r={};for(let[t,o]of Object.entries(e)){let i=t.toLowerCase();i==="authorization"||i==="x-everfur-partner-key"||(r[t]=o);}return r}n(kr,"stripAuthHeaders");async function Se(e,r){if(r.mode==="anonymous")return r.transport.request(j(e,{mode:"anonymous",publishableKey:r.publishableKey,userRef:r.userRef,...r.sessionId?{sessionId:r.sessionId}:{}}));let t;try{t=await r.identity.currentToken();}catch{return h(oe())}let o=await r.transport.request(j(e,{mode:"personalized",token:t,userRef:r.userRef,...r.sessionId?{sessionId:r.sessionId}:{}}));if(o.ok||o.error.httpStatus!==401)return o;let i;try{i=await r.identity.currentToken({forceRefresh:!0});}catch{return h(oe())}let a=await r.transport.request(j(e,{mode:"personalized",token:i,userRef:r.userRef,...r.sessionId?{sessionId:r.sessionId}:{}}));return !a.ok&&a.error.httpStatus===401?h(oe(a.error.httpStatus)):a}n(Se,"authedSend");function oe(e){return F("authRejected",{retryable:false,...e!==void 0?{httpStatus:e}:{}})}n(oe,"authRejectedError");function ke(e){return F("internalError",{retryable:true,wireMessage:Fr(e)})}n(ke,"networkError");function Fr(e){return e instanceof Error?e.message:typeof e=="string"?e:"network request failed"}n(Fr,"describeCause");var Or=3e4,Vr=re*2,Ir="idempotency-key",Ar=new Set(["POST","PUT","PATCH","DELETE"]),Pr=Object.freeze({onEvent(){}}),zr=Object.freeze({setTimeout:n((e,r)=>setTimeout(e,r),"setTimeout"),clearTimeout:n(e=>clearTimeout(e),"clearTimeout"),now:n(()=>Date.now(),"now")});function jr(e){let r=e.trim().replace(/[^A-Za-z0-9_.:-]/g,"-");return r.length===0?null:`efs_${r}`.slice(0,128)}n(jr,"seededIdempotencyKey");function Oe(e){let r=e.observer??Pr,t=e.timers??zr,o=e.rng??Math.random,i=e.sleep??((d,f)=>$r(d,t,f)),a=e.maxAttempts??Te,l=e.unaryTimeoutMs??Or,u=e.newIdempotencyKey??Nr(),s=n(d=>{try{r.onEvent(d);}catch{}},"emit");async function p(d,f,y){let _=y?.maxAttempts,c=Math.max(1,_??a),O=y?.idempotent??Ar.has(f.method),C=y?.idempotencyKey===void 0?null:jr(y.idempotencyKey),w=O?C??u():null,S=Dr(f,w),k=0;for(;;){let R=n(A=>Object.freeze({call:d,method:f.method,path:f.path,attempt:k,...w?{idempotencyKey:w}:{},...A}),"stamp");s(R({phase:"attempt"}));let V=Kr(l,t),I=Gr(V.signal,f.signal),m;try{m=await Se({...S,signal:I.signal},e.auth);}catch(A){m=h(ke(A));}finally{I.dispose(),V.cancel();}if(m.ok)return s(R({phase:"settled",ok:true,reason:"ok"})),m;let v=m.error,b=Ur(v,k,{maxAttempts:c,rng:o,now:t.now(),aborted:f.signal?.aborted===true,..._!==void 0?{perCallMaxAttempts:_}:{},...e.errorPolicy!==void 0?{policy:e.errorPolicy}:{}}),x={ok:false,code:v.code,reason:b.reason,...v.httpStatus!==void 0?{httpStatus:v.httpStatus}:{},...v.requestId!==void 0?{requestId:v.requestId}:{}};if(!b.retry)return s(R({phase:"settled",...x})),h(v);if(s(R({phase:"retry",...x,delayMs:b.delayMs})),await i(b.delayMs,f.signal),f.signal?.aborted===true)return s(R({phase:"settled",...x,reason:"aborted"})),h(v);k+=1;}}n(p,"send");async function E(d){return j(d,await Wr(e.auth))}n(E,"authorize");async function*g(d,f,y){s(Object.freeze({call:d,phase:"stream.open",method:f.method,path:f.path,attempt:0}));try{yield*e.auth.transport.stream(f,y);}catch{yield xe({code:"internal_error",retryable:true,wireMessage:null,synthesized:true,lastEventId:null,serverRequestId:null});}}return n(g,"stream"),Object.freeze({send:p,authorize:E,stream:g})}n(Oe,"createRequestFunnel");function Dr(e,r){let t={};for(let[o,i]of Object.entries(e.headers??{}))o.toLowerCase()!==Ir&&(t[o]=i);return r!==null&&(t["Idempotency-Key"]=r),{...e,headers:t}}n(Dr,"assembleHeaders");function Nr(){let e=0;return ()=>`efk_${Date.now().toString(36)}_${(e++).toString(36)}_${Math.random().toString(36).slice(2,12)}`}n(Nr,"defaultIdempotencyKeyFactory");var Lr=10;function Ur(e,r,t){if(t.aborted)return {retry:false,reason:"aborted"};let o=Mr(e);if(o==="quota")return {retry:false,reason:"daily-quota-exhausted"};if(o!=="burst"&&!ee(e.code))return {retry:false,reason:"terminal-code"};let i=o==="burst"?"burst-throttle":"retryable-code";if(n(()=>{if(t.policy===void 0)return false;try{return !t.policy.shouldRetry(e.code,r)}catch{return false}},"policyVetoedRetry")())return {retry:false,reason:"terminal-code"};let l=n(()=>{if(t.policy===void 0)return null;let p;try{p=t.policy.maxAttempts(e.code);}catch{return null}return typeof p!="number"||!Number.isFinite(p)?null:Math.max(1,Math.min(Lr,Math.floor(p)))},"policyCeiling"),u=t.perCallMaxAttempts??l()??t.maxAttempts;if(r+1>=u)return {retry:false,reason:"attempts-exhausted"};let s=Br(e,t.now);return s!==null?s>Vr?{retry:false,reason:"server-reset-beyond-budget"}:{retry:true,reason:i,delayMs:s}:{retry:true,reason:i,delayMs:Ce(r,t.rng)}}n(Ur,"decideRetry");function Mr(e){let r=e.code==="unknown"?_e(Yr(e.raw)):e.code;return r==="quotaExceeded"?"quota":r==="rateLimited"||e.httpStatus===429?"burst":null}n(Mr,"throttleKind");function Br(e,r){let t=qr(e.raw);if(t===null)return null;let o=t-r;return o>0?o:0}n(Br,"retryOverrideMs");function qr(e){for(let r of Ve(e)){let t=r.resets_at,o=Hr(t);if(o!==null)return o}return null}n(qr,"findResetsAt");function Ve(e){if(!Fe(e))return [];let r=[e];for(let t of ["error","detail"]){let o=e[t];Fe(o)&&r.push(o);}return r}n(Ve,"candidateScopes");function Hr(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 r=Date.parse(e);return Number.isFinite(r)?r:null}return null}n(Hr,"parseInstantMs");function Yr(e){for(let r of Ve(e)){let t=r.code;if(typeof t=="string"&&t.length>0)return t}return null}n(Yr,"rawWireCode");function Fe(e){return typeof e=="object"&&e!==null}n(Fe,"isRecord");async function Wr(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(Wr,"resolveDeviceAuth");function Kr(e,r){let t=new AbortController,o=r.setTimeout(()=>t.abort(),e);return {signal:t.signal,cancel:n(()=>r.clearTimeout(o),"cancel")}}n(Kr,"boundedSignal");function Gr(e,r){let t=n(()=>{},"noop");if(!r)return {signal:e,dispose:t};let o=new AbortController;if(e.aborted||r.aborted)return o.abort(),{signal:o.signal,dispose:t};let i=n(()=>o.abort(),"onAbort");return e.addEventListener("abort",i,{once:true}),r.addEventListener("abort",i,{once:true}),{signal:o.signal,dispose:n(()=>{e.removeEventListener("abort",i),r.removeEventListener("abort",i);},"dispose")}}n(Gr,"mergeSignals");function $r(e,r,t){return e<=0||t?.aborted===true?Promise.resolve():new Promise(o=>{let i=r.setTimeout(()=>{t?.removeEventListener("abort",a),o();},e),a=n(()=>{r.clearTimeout(i),o();},"onAbort");t?.addEventListener("abort",a,{once:true});})}n($r,"delayAbortable");var M=Object.freeze(["visit","join","summary","messages"]);function B(e){return typeof e=="string"&&M.includes(e)}n(B,"isVetVisitIntent");var Qr="/widget/v1/televet/handoffs",Xr="/widget/v1/televet/availability",Zr="/widget/v1/televet/chat-entry",Jr=/^[a-z0-9][a-z0-9_-]{0,39}$/,Ne=/^[A-Za-z0-9_-]{22}$/,Ie="everfur_flow",Ae=32,Pe=128,ze=64;function q(e){let r=e.httpStatus;switch(e.code){case "sessionRequired":return "sessionRequired";case "authExpired":case "authRejected":return "authRejected";case "sdkUpdateRequired":return "sdkUpdateRequired";case "validationFailed":return "invalidRequest";case "rateLimited":case "quotaExceeded":return "rateLimited";}return r===void 0?e.code==="internalError"?"network":"unknown":r===429?"rateLimited":r===404?"unavailable":r===403?"accessDenied":r===401?"authRejected":r===400||r===422?"invalidRequest":r>=500?"serverError":"unknown"}n(q,"vetVisitErrorReasonOf");function je(e){return h(F("validationFailed",{retryable:false,wireMessage:e}))}n(je,"invalid");function ie(e){return h(F("internalError",{retryable:false,httpStatus:502,wireMessage:e}))}n(ie,"unusable");function et(e,r){let t={};e!==void 0&&(t.pet_ref=e);let o=r?.returnTo;if(o!=null){if(typeof o!="string"||!Jr.test(o))return {ok:false,message:"returnTo must be a registered return destination key"};t.return_to=o;}let i=r?.entry;if(i!=null){if(i!=="chat"||e===void 0)return {ok:false,message:"entry 'chat' needs the pet the chat is about"};t.entry=i;}let a=r?.visitRef,l=r?.intent,u=a!=null;if(u){let s=typeof a=="string"?a.trim():"";if(s.length<1||[...s].length>ze)return {ok:false,message:`visitRef must be 1..${ze} characters`};t.visit_ref=s;}if(l!=null){if(!u)return {ok:false,message:"intent needs the visitRef it opens"};if(!B(l))return {ok:false,message:`intent must be one of ${M.join(", ")}`};t.intent=l;}return {ok:true,body:t}}n(et,"handoffBody");function rt(e){if(typeof e!="object"||e===null)return null;let{visit_ref:r,intent:t}=e;return typeof r!="string"||r.length===0||!B(t)?null:Object.freeze({visitRef:r,intent:t})}n(rt,"parseVisitEcho");function Le(e){let r=e.funnel??Oe({auth:e.auth,...e.errorPolicy?{errorPolicy:e.errorPolicy}:{}}),t=e.telemetry,o=n(i=>(De(t,"televet.visit.handoff_failed",{reason:q(i)}),h(i)),"failed");return {async createHandoff(i,a){let l;if(i!=null){let c=typeof i=="string"?[...i].length:0;if(c<1||c>Pe)return o(F("validationFailed",{retryable:false,wireMessage:`pet_ref must be 1..${Pe} characters`}));l=i;}let u=et(l,a);if(!u.ok){let c=je(u.message);return c.ok?c:o(c.error)}let s=u.body,p=await r.send("televet.visit.handoff",{method:"POST",path:Qr,body:s},{idempotent:false,maxAttempts:1});if(!p.ok)return o(p.error);let E=nt(p.value),g=s.return_to!==void 0,d=g?p.value?.flow_id:void 0;if(g&&(typeof d!="string"||!Ne.test(d))){let c=ie("the handoff response carried no usable return flow id");return c.ok?c:o(c.error)}let f=s.visit_ref!==void 0,y=f?rt(p.value?.visit):null;if(f&&y===null){let c=ie("the handoff response did not confirm the visit it opens");return c.ok?c:o(c.error)}let _=E===null?null:Object.freeze({...E,...g?{flowId:d}:{},...y!==null?{visit:y}:{}});return _===null?o(F("internalError",{retryable:false,httpStatus:502,wireMessage:"the handoff response carried no usable visit url"})):(De(t,"televet.visit.handoff_created",{pet_scoped:s.pet_ref!==void 0}),ne(_))},async checkAvailability(i){if(typeof i!="string"||i.length>Ae)return je(`state must be at most ${Ae} characters`);let a=await r.send("televet.visit.availability",{method:"POST",path:Xr,body:{state:i}},{idempotent:false,maxAttempts:1});if(!a.ok)return h(a.error);let l=a.value?.available;return typeof l!="boolean"?ie("the availability response carried no usable answer"):ne(Object.freeze({available:l}))},async chatEntryOpen(){try{let i=await r.send("televet.visit.chat_entry",{method:"GET",path:Zr},{maxAttempts:1});return i.ok&&i.value?.open===!0}catch{return false}}}}n(Le,"createVetVisitController");function tt(e){if(typeof e!="string")return null;let r=e.indexOf("#"),t=r<0?e:e.slice(0,r),o=t.indexOf("?");if(o<0)return null;let i=t.slice(o+1).split("&").filter(a=>a.startsWith(`${Ie}=`)).map(a=>a.slice(Ie.length+1));return i.length!==1||!Ne.test(i[0]??"")?null:Object.freeze({flowId:i[0]})}n(tt,"parseVetVisitReturn");function nt(e){if(typeof e!="object"||e===null)return null;let{url:r,expires_at:t}=e;return typeof r!="string"||typeof t!="string"||t.length===0||!st(r)?null:Object.freeze({url:r,expiresAt:t})}n(nt,"parseHandoff");var ot=new Set(["localhost","127.0.0.1","[::1]"]),it=/^([A-Za-z][A-Za-z0-9+.-]*):\/\/([^/?#]*)/,at=/[\s\u0000-\u001f\u007f]/;function st(e){if(at.test(e))return false;let r=it.exec(e);if(r===null)return false;let t=(r[1]??"").toLowerCase(),o=r[2]??"";if(o.length===0||o.includes("@"))return false;let i=o.replace(/:\d+$/,"").toLowerCase(),a=t==="https",l=t==="http"&&ot.has(i);if(!a&&!l)return false;let u=e.indexOf("#");if(u<0)return false;let s=e.slice(u);return s.startsWith("#h=")&&s.length>3}n(st,"isOpenableVisitUrl");function De(e,r,t){if(e)try{e.track(r,t);}catch{}}n(De,"safeTrack");var Ue=Symbol.for("@everfur/sdk#EverfurContext@v1"),Me=globalThis,Be=Me[Ue]??(Me[Ue]=createContext(null));Be.displayName??="EverfurContext";function H(){let e=useContext(Be);if(e===null)throw new z("not-initialized","Everfur hooks must be called inside <EverfurProvider>. Wrap your tree once, high.");return e}n(H,"useEverfurContext");var dt=Object.freeze({chat:Object.freeze(["chat.message.create"]),records:Object.freeze(["records.upload.create","records.record.read"]),recordsClinic:Object.freeze(["records.clinic.create"]),video:Object.freeze(["video.gait.execute"]),photo:Object.freeze(["photo.checkup.execute"]),animations:Object.freeze(["animations.state.read"]),televet:Object.freeze(["televet.visit.create"])});function ct(e){return dt[e]}n(ct,"requires");function qe(e,r,t){let o=ct(e),i=new Map;for(let u of r)i.set(u.resource,u);if(t?.isPending===true&&o.some(u=>!i.has(u)))return ae({name:e,enabled:false,isPending:true,limits:{}});let a=ft(o,i);return o.filter(u=>i.get(u)?.granted!==true).length===0?ae({name:e,enabled:true,isPending:false,limits:a}):ae({name:e,enabled:false,isPending:false,limits:a,disabled:pt(o,i)})}n(qe,"decideCapability");function ft(e,r){let t={};for(let o of e){let i=r.get(o)?.limits;if(i)for(let[a,l]of Object.entries(i)){let u=t[a];t[a]=u===void 0?l:Math.min(u,l);}}return t}n(ft,"mergeLimits");function pt(e,r){for(let t of e){let o=r.get(t)?.disabled;if(o)return Object.freeze({reason:o.reason,level:o.level,recoverable:o.recoverable})}return Object.freeze({reason:te("accessDenied"),level:"user_entitlement",recoverable:false})}n(pt,"disabledFor");function ae(e){let r={name:e.name,enabled:e.enabled,isPending:e.isPending,limits:Object.freeze({...e.limits})};return e.disabled!==void 0&&(r.disabled=e.disabled),Object.freeze(r)}n(ae,"freezeDecision");function He(e){let{runtime:r}=H(),t=r.entitlements,o=useSyncExternalStore(t.subscribe,t.getSnapshot,t.getSnapshot);return useMemo(()=>qe(e,o.decisions,{isPending:o.isPending}),[e,o])}n(He,"useCapability");var We=Object.freeze({status:"idle",error:null,errorReason:null});function bt(e,r,t){let{usState:o,chat:i,scope:a}=t,l=r&&(o!==null||i),u=`${o??""}|${i?"chat":""}`,[s,p]=useState(null);if(useEffect(()=>{if(!l)return;let g=true,d=e.current;return p(null),n(async()=>{try{if(i&&!(d.chatEntryOpen&&await d.chatEntryOpen()))return !1;if(o===null)return !0;if(!d.checkAvailability)return !1;let y=await d.checkAvailability(o);return y.ok&&y.value.available}catch{return false}},"ask")().then(y=>{g&&p({key:u,open:y});}),()=>{g=false;}},[l,u,o,i,a,e]),!l)return null;let E=s!==null&&s.key===u;return {open:E&&s.open,pending:!E}}n(bt,"usePreflight");var Et=Object.freeze({status:"opening",error:null,errorReason:null});function Ge(e,r={}){let{runtime:t,userRef:o,scopeEpoch:i}=H(),a=He("televet"),l=a.enabled&&o!==null,u=r.usState??null,s=r.entry==="chat",p=r.petRef??null,E=useMemo(()=>{if(r.controller)return r.controller;let{services:m}=t.registry;return Le({auth:m.authFor(o),telemetry:m.telemetry,...m.errorPolicy?{errorPolicy:m.errorPolicy}:{}})},[t,o,i,r.controller]),g=useRef(E);g.current=E;let d=useMemo(()=>({runtime:t,userRef:o,scopeEpoch:i}),[t,o,i]),f=bt(g,l,{usState:u,chat:s,scope:d}),y=l&&(f===null||f.open)&&(!s||p!==null),_=r.returnTo??null,[c,O]=useState(We),C=useRef(null),w=useRef({runtime:t,userRef:o,scopeEpoch:i});w.current={runtime:t,userRef:o,scopeEpoch:i};let S=useRef(E);S.current=E;let k=useRef(y);k.current=y;let R=useCallback((m,v)=>{if(C.current)return C.current;let b=n((T,P)=>(O({status:T==="cancelled"?"idle":"error",error:P,errorReason:T==="cancelled"?null:T}),Object.freeze({opened:false,reason:T,error:P})),"fail");if(!k.current)return Promise.resolve(b("unavailable",null));let x=e.prepare();if(!x.ok)return Promise.resolve(b(x.reason,null));let A=w.current,pe=S.current;O(Et);let G=(async()=>{let T,P={..._!==null?{returnTo:_}:{},...s?{entry:"chat"}:{},...v!==null?{visitRef:v.visitRef}:{},...v!==null&&v.intent!==null&&v.intent!==void 0?{intent:v.intent}:{}},ye=Object.keys(P).length===0?void 0:P,me=m===void 0?p:m;try{T=await(ye===void 0?pe.createHandoff(me):pe.createHandoff(me,ye));}catch{return e.abandon(x.value),b("unknown",null)}let $=w.current;if($.runtime!==A.runtime||$.userRef!==A.userRef||$.scopeEpoch!==A.scopeEpoch)return e.abandon(x.value),b("cancelled",null);if(!T.ok)return e.abandon(x.value),b(q(T.error),T.error);let ve=await e.finish(x.value,T.value);return ve!==null?b(ve,null):(O(We),Object.freeze(T.value.flowId===void 0?{opened:true}:{opened:true,flowId:T.value.flowId}))})().finally(()=>{C.current===G&&(C.current=null);});return C.current=G,G},[e,p,_,s]),V=useCallback(m=>R(m,null),[R]),I=useCallback((m,v)=>R(void 0,{visitRef:m,intent:v??null}),[R]);return {available:y,isPending:a.isPending||(f?.pending??false),status:c.status,error:c.error,errorReason:c.errorReason,open:V,openVisit:I}}n(Ge,"useVetVisitWith");var _t=n(e=>Linking.openURL(e),"defaultOpenUrl");function le(e={}){let{openUrl:r,...t}=e,o=useMemo(()=>{let i=r??_t;return {prepare:n(()=>({ok:true,value:null}),"prepare"),async finish(a,l){try{return await i(l.url),null}catch{return "openFailed"}},abandon:n(()=>{},"abandon")}},[r]);return Ge(o,t)}n(le,"useVetVisit");function ce(e){if(e!==null&&typeof e=="object"&&!Object.isFrozen(e)){Object.freeze(e);for(let r of Object.keys(e))ce(e[r]);}return e}n(ce,"deepFreeze");var Rt=Object.freeze({content:0,heading:2,control:1.8,compact:1.5,badge:1.3}),Qe={xs:4,sm:8,md:12,lg:16,xl:24,xxl:32},Xe={tile:5,xs:6,sm:10,md:14,lg:20,xl:28,pill:500},$e={nano:8,small:9,micro:10,tiny:11,caption:12,bodyTight:13,body:14,subtitle:16,heading:18,verdict:24},Tt={tight:1.15,snug:1.3,normal:1.4,relaxed:1.55},Ct={regular:"400",medium:"500",bold:"700"},wt={eyebrow:1,monoWide:.9,headerBrand:-0.42,tight:-0.35},xt=0,Y="System",W="monospace",St=["content","heading","control","compact","badge"];function kt(e){let r={};for(let t of St)r[t]=e;return r}n(kt,"authoredTierSizes");function Ze(){return {family:Y,mono:W,fontUrl:null,families:{regular:Y,medium:Y,bold:Y,mono:W,monoMedium:W,monoBold:W},namedFaces:{regular:false,medium:false,bold:false,mono:false,monoMedium:false,monoBold:false},fontUrls:{},size:$e,tierSizes:kt($e),lineHeight:Tt,weight:Ct,letterSpacing:wt,scale:1,maxScale:xt,scaleCaps:Rt}}n(Ze,"baseType");var Je={},ue=Object.freeze({standard:Object.freeze([.2,0,0,1]),emphasized:Object.freeze([.2,.8,.2,1]),exit:Object.freeze([.4,0,1,1])});function de(e){return `cubic-bezier(${e.join(", ")})`}n(de,"cssCubicBezier");var er={duration:{instant:80,fast:140,normal:220,slow:320},spring:{gentle:{damping:18,stiffness:200}},easing:{standard:de(ue.standard),emphasized:de(ue.emphasized),exit:de(ue.exit)},reducedMotion:false},Ft={brand:"#10462E",brandSoft:"rgba(16,70,46,0.10)",brandSofter:"rgba(16,70,46,0.15)",brandBorder:"rgba(16,70,46,0.18)",borderHairlineGreen:"rgba(16,70,46,0.25)",brandBorderStrong:"rgba(16,70,46,0.55)",brandInk:"#10462E",linkInk:"#10462E",surface:"#FFFFFF",surfaceCream:"#FDFBF8",surfaceSubtle:"#EFE9E3",background:"#FFFFFF",borderRingCream:"#D8D2C8",chatGround:"#FFFFFF",composerFill:"#FDFBF8",composerBorder:"rgba(16,70,46,0.75)",shadow:"#0B3421",text:{primary:"#111111",secondary:"#0E462E",muted:"#6E6660",placeholder:"rgba(61,61,61,0.75)",onBrand:"#FFFFFF",metaCool:"#3D3D3D",timestamp:"rgba(61,61,61,0.75)"},primary:"#10462E",onPrimary:"#FFFFFF",accent:"#10462E",onAccent:"#FFFFFF",accentEdge:"#07C168",success:"#07C168",danger:"#B91C1C",errorRed:"#FF1B00",warningStrong:"#A45610",cautionAccent:"#D9821D",riskConcern:"#EFA700",sentiment:{up:"#07C168",neutral:"#FBC558",down:"#FF1B00"},badgeBgPositive:"rgba(7,193,104,0.12)",badgeBgCaution:"rgba(217,130,29,0.14)",badgeBgCritical:"rgba(185,28,28,0.12)",badgeBgNeutral:"rgba(110,102,96,0.12)",bubbleUser:"#10462E",bubbleAssistant:"#FFFFFF",skeleton:"#EFE9E3",scanButtonPink:"#FFC3BC",checkupCardLowRiskBg:"rgba(7,193,104,0.10)",checkupCardConcernBg:"rgba(239,167,0,0.10)"},rr=ce({brightness:"light",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false},color:Ft,space:Qe,radius:Xe,type:Ze(),motion:er,slots:Je}),Ot={brand:"#6BD39A",brandSoft:"rgba(107,211,154,0.12)",brandSofter:"rgba(107,211,154,0.18)",brandBorder:"rgba(107,211,154,0.22)",borderHairlineGreen:"rgba(107,211,154,0.28)",brandBorderStrong:"rgba(107,211,154,0.55)",brandInk:"#6BD39A",linkInk:"#6BD39A",surface:"#1C1F23",surfaceCream:"#23272C",surfaceSubtle:"#23272C",background:"#15171A",borderRingCream:"#3A3F45",chatGround:"#1C1F23",composerFill:"#23272C",composerBorder:"rgba(107,211,154,0.75)",shadow:"#000000",text:{primary:"#F5F3F0",secondary:"#A9E4C4",muted:"#9A938C",placeholder:"rgba(255,255,255,0.55)",onBrand:"#0E1F17",metaCool:"#C9C9C9",timestamp:"rgba(245,243,240,0.7)"},primary:"#6BD39A",onPrimary:"#0E1F17",accent:"#6BD39A",onAccent:"#0E1F17",accentEdge:"#34D888",success:"#07C168",danger:"#F87171",errorRed:"#FF6B5B",warningStrong:"#F0A35E",cautionAccent:"#D9821D",riskConcern:"#EFA700",sentiment:{up:"#07C168",neutral:"#FBC558",down:"#FF1B00"},badgeBgPositive:"rgba(7,193,104,0.18)",badgeBgCaution:"rgba(217,130,29,0.20)",badgeBgCritical:"rgba(185,28,28,0.22)",badgeBgNeutral:"rgba(255,255,255,0.10)",bubbleUser:"#6BD39A",bubbleAssistant:"#1C1F23",skeleton:"#23272C",scanButtonPink:"#FFC3BC",checkupCardLowRiskBg:"rgba(7,193,104,0.16)",checkupCardConcernBg:"rgba(239,167,0,0.16)"};ce({brightness:"dark",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false},color:Ot,space:Qe,radius:Xe,type:Ze(),motion:er,slots:Je});var tr=Symbol.for("@everfur/sdk#EverfurThemeContext@v1"),nr=globalThis,fe=nr[tr]??(nr[tr]=createContext(rr));fe.displayName??="EverfurThemeContext";function N(){return useContext(fe)}n(N,"useEverfurTheme");function jt(e,r){let t=e.scaleCaps[r];return t>0?t:void 0}n(jt,"tierMultiplier");function ir({tier:e="content",...r}){let{type:t}=N(),o=jt(t,e);return createElement(Text,o===void 0?r:{maxFontSizeMultiplier:o,...r})}n(ir,"Text");forwardRef(n(function(r,t){return createElement(TextInput,{...r,...t===null?{}:{ref:t}})},"TextInput"));function ar(e,r){if(e===void 0)return {};let t={};return e.backgroundColor!==void 0&&(t.backgroundColor=e.backgroundColor),e.borderColor!==void 0&&(t.borderColor=e.borderColor,t.borderWidth=r??1),e.borderRadius!==void 0&&(t.borderRadius=e.borderRadius),t}n(ar,"slotBox");function sr(e){return e?.textColor===void 0?{}:{color:e.textColor}}n(sr,"slotText");var Dt=Object.freeze({regular:"regular",medium:"medium",bold:"bold",mono:"regular",monoMedium:"medium",monoBold:"bold"});function lr(e,r){let t=e.type,o=t.families[r];return r==="mono"||t.namedFaces[r]?{fontFamily:o}:{fontFamily:o,fontWeight:t.weight[Dt[r]]}}n(lr,"face");function ur(e){let r=globalThis.console;try{r?.error?.("[everfur] A host callback threw; the SDK ignored it.",e);}catch{}}n(ur,"reportHostFailure");function Nt(e){return (typeof e=="object"||typeof e=="function")&&e!==null&&typeof e.then=="function"}n(Nt,"isThenable");function K(e,...r){if(typeof e=="function")try{let t=e(...r);return Nt(t)&&Promise.resolve(t).then(void 0,ur),t}catch(t){ur(t);return}}n(K,"callHost");var dr=Object.freeze({visitButton:"Talk to a vet"});var cr=44,qt=.6;function Ht(e){let{petRef:r,label:t,openUrl:o,onOpened:i,onError:a,style:l,labelStyle:u,controller:s,returnTo:p,usState:E,entry:g,visitRef:d,intent:f,onStartInApp:y,prefer:_}=e,c=le({...p!==void 0?{returnTo:p}:{},...E!==void 0?{usState:E}:{},...g!==void 0?{entry:g}:{},...r!==void 0?{petRef:r}:{},...o!==void 0?{openUrl:o}:{},...s!==void 0?{controller:s}:{}}),O=N(),C=useMemo(()=>Yt(O),[O]),w=useRef(false);if(!c.available)return null;let S=c.status==="opening",k=t??dr.visitButton,R=d!=null,V=_==="redirect"||R,I=!V&&y!==void 0,m=!V&&!I&&X();return jsx(Pressable,{onPress:n(()=>{if(!(S||w.current)){if(I){K(y);return}m&&Z({...r!==void 0?{petRef:r}:{},...E!==void 0?{usState:E}:{}})||(w.current=true,(d==null?c.open():c.openVisit(d,f??null)).then(b=>{b.opened?K(i,b.flowId??null):b.reason!=="cancelled"&&K(a,b.reason,b.error);}).finally(()=>{w.current=false;}));}},"onPress"),accessibilityRole:"button",accessibilityLabel:k,accessibilityState:{busy:S,disabled:S},style:[C.button,S?C.busy:null,l],children:jsx(ir,{style:[C.label,u],children:k})})}n(Ht,"VetVisitButton");function Yt(e){let{color:r,space:t,radius:o,type:i,slots:a}=e;return StyleSheet.create({button:{minHeight:cr,minWidth:cr,alignItems:"center",justifyContent:"center",paddingHorizontal:t.xl,paddingVertical:t.sm,borderRadius:o.pill,backgroundColor:r.primary,...ar(a.vetVisitButton)},busy:{opacity:qt},label:{...lr(e,"medium"),color:r.onPrimary,fontSize:i.size.body,lineHeight:i.size.body*i.lineHeight.snug,...sr(a.vetVisitButton)}})}n(Yt,"makeStyles");export{M as VET_VISIT_INTENTS,Ht as VetVisitButton,X as hasEverfurTelevetFlow,B as isVetVisitIntent,tt as parseVetVisitReturn,Z as presentEverfurTelevetFlow,yr as registerEverfurTelevetFlow,le as useVetVisit,q as vetVisitErrorReasonOf};
|
|
1
|
+
import {createContext,forwardRef,useMemo,createElement,useRef,useState,useEffect,useSyncExternalStore,useContext,useCallback}from'react';import {jsx,jsxs,Fragment}from'react/jsx-runtime';import {Linking,TextInput,Pressable,StyleSheet,Text}from'react-native';var Pr=Object.defineProperty;var n=(e,r)=>Pr(e,"name",{value:r,configurable:true});var xe=Symbol.for("@everfur/sdk/televet");function F(){let e=globalThis,r=e[xe];if(r!==void 0)return r;let t={presenter:null,snapshot:Object.freeze({request:null,serial:0,activeHost:null}),hosts:[],nextHost:1,listeners:new Set,dailyRegistered:false};return e[xe]=t,t}n(F,"televetGlobal");function q(e){let r=F();r.snapshot=Object.freeze({...r.snapshot,...e});for(let t of [...r.listeners])try{t();}catch{}}n(q,"publish");function we(e){F().presenter=e;}n(we,"setTelevetPresenter");function Se(){return F().presenter!==null}n(Se,"hasTelevetPresenter");function B(e){let r=F().presenter;if(r===null)return "absent";try{return r(e)===!1?"declined":"presented"}catch(t){return console.warn("[everfur] Your registerEverfurTelevetFlow presenter threw; the in-app visit opened instead.",t),"threw"}}n(B,"callTelevetPresenter");function Fe(e){let r=F();return r.listeners.add(e),()=>{r.listeners.delete(e);}}n(Fe,"subscribeTelevetExperience");function ie(){return F().snapshot}n(ie,"televetExperienceSnapshot");function Ar(){return F().hosts.length>0}n(Ar,"hasTelevetHost");function ke(e){if(!Ar())return false;let r=Object.freeze({...e});return q({request:r,serial:F().snapshot.serial+1}),true}n(ke,"presentTelevetExperience");function ae(){F().snapshot.request!==null&&q({request:null});}n(ae,"dismissTelevetExperience");function Oe(){let e=F(),r=e.nextHost;return e.nextHost+=1,e.hosts=[...e.hosts,r],q({activeHost:e.hosts[0]??null}),r}n(Oe,"claimTelevetHost");function Ve(e){let r=F();r.hosts=r.hosts.filter(o=>o!==e);let t=r.hosts[0]??null;q(t===null?{activeHost:t,request:null}:{activeHost:t});}n(Ve,"releaseTelevetHost");function zr(e){we(e);}n(zr,"registerEverfurTelevetFlow");function jr(){return Se()}n(jr,"hasEverfurTelevetFlow");function Dr(e){return B(e)==="presented"}n(Dr,"presentEverfurTelevetFlow");function Ae(e){let r=null;return ()=>{if(r!==null)return r;let t=e();return r=t,t.then(void 0,()=>{r===t&&(r=null);}),t}}n(Ae,"memoizeTelevetLoader");function ze(e){let[r,t]=useState(null);useEffect(()=>{let d=Oe();return t(d),()=>{Ve(d);}},[]);let o=useSyncExternalStore(Fe,ie,ie),a=r!==null&&o.activeHost===r?o.request:null,[u,l]=useState(null),s=a!==null&&u===null;return useEffect(()=>{if(!s)return;let d=true;return e().then(y=>{d&&l(()=>y);},y=>{d&&(console.warn("[everfur] The in-app vet visit could not load its screens.",y),ae());}),()=>{d=false;}},[s,e]),a===null||u===null?null:{module:u,request:a,serial:o.serial,dismiss:ae}}n(ze,"useTelevetExperienceHost");var Nr=Ae(()=>import('@everfur/sdk/televet/booking'));function H(){let e=ze(Nr);if(e===null)return null;let{EverfurTelevetModal:r}=e.module;return jsx(r,{request:e.request,onClose:e.dismiss},e.serial)}n(H,"EverfurTelevetHost");var se=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(se.map(e=>e.wireCode));var Ur=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"}),De=Object.freeze(se.map(e=>Object.freeze({wireCode:e.wireCode,envelope:e.envelope,retryable:e.retryable,normalized:Ur[e.wireCode]}))),qr=new Map(De.map(e=>[e.envelope+e.wireCode.toUpperCase(),e])),Br=Object.freeze(["http_envelope",...[...new Set(De.map(e=>e.envelope))].filter(e=>e!=="http_envelope").sort()]);function Y(e,r){if(typeof e!="string")return;let t=e.trim().toUpperCase();if(t.length!==0)for(let o of [r??"http_envelope",...Br]){let i=qr.get(o+t);if(i)return i}}n(Y,"contractErrorFor");function Hr(e){return e.envelope==="sse_frame"?`/errors#sse-${e.wireCode}`:e.envelope==="oauth_error"?`/errors#oauth-${e.wireCode}`:`/errors#${e.wireCode}`}n(Hr,"contractDocUrl");function Me(e){return null}n(Me,"publishedDocUrl");var Yr=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 Ne(e){return Yr[e]}n(Ne,"categoryFor");function Le(e){let r=Y(e);if(r)return r.normalized;let t=(e??"").trim().toUpperCase(),o=t.replace(/[^A-Z0-9]/g,"");if(o==="AUTHREJECTED")return "authRejected";if(t.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(Le,"fromWire");var Wr=new Set(["streamTimeout","rateLimited","internalError","upstreamLlmTimeout","streamIncomplete"]);function le(e){return Wr.has(e)}n(le,"isAutoRetryable");var Gr=new Set(["serviceUnavailable","conflict","idempotencyInFlight"]);function Ue(e){return le(e)||Gr.has(e)}n(Ue,"isRetryableCode");var Kr=500,ue=8e3,qe=4;function Be(e,r=Math.random){let t=Math.max(0,e),o=Math.min(Kr*2**t,ue);return Math.floor(r()*o)}n(Be,"backoffDelayMs");var $r=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 de(e){return $r[e]}n(de,"userFacingError");function He(e,r,t){Object.defineProperty(e,r,{value:t,enumerable:false,writable:false,configurable:false});}n(He,"defineHidden");var Qr=/^[a-z][a-z0-9_]{0,63}$/;function I(e,r){let t=Y(r?.wireCode,r?.wireEnvelope),o={code:e,category:Ne(e),retryable:r?.retryable??Ue(e),displayMessage:de(e)};if(r?.httpStatus!==void 0&&(o.httpStatus=r.httpStatus),r?.requestId&&(o.requestId=r.requestId),typeof r?.reasonCode=="string"&&Qr.test(r.reasonCode)&&(o.reasonCode=r.reasonCode),t);return r?.wireMessage&&He(o,"wireMessage",r.wireMessage),r?.raw!==void 0&&r.raw!==null&&He(o,"raw",r.raw),Object.freeze(o)}n(I,"makeEverfurError");function ce(e,r){return Object.freeze(r===void 0?{ok:true,value:e}:{ok:true,value:e,warning:r})}n(ce,"ok");function R(e){return Object.freeze({ok:false,error:e})}n(R,"err");var W=class W extends Error{constructor(r,t){super(t),this.name="EverfurConfigError",this.kind=r,Object.setPrototypeOf(this,W.prototype);}};n(W,"EverfurConfigError");var M=W;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 Jr(e){let r={};return e.mode==="personalized"?r.authorization=`Bearer ${e.token}`:r["x-everfur-partner-key"]=e.publishableKey,e.userRef&&(r["x-everfur-user-ref"]=e.userRef),e.sessionId&&(r["x-everfur-session-id"]=e.sessionId),r}n(Jr,"authHeaders");function N(e,r){return {...e,headers:{...et(e.headers),...Jr(r)}}}n(N,"withAuthHeaders");function et(e){if(!e)return {};let r={};for(let[t,o]of Object.entries(e)){let i=t.toLowerCase();i==="authorization"||i==="x-everfur-partner-key"||(r[t]=o);}return r}n(et,"stripAuthHeaders");async function We(e,r){if(r.mode==="anonymous")return r.transport.request(N(e,{mode:"anonymous",publishableKey:r.publishableKey,userRef:r.userRef,...r.sessionId?{sessionId:r.sessionId}:{}}));let t;try{t=await r.identity.currentToken();}catch{return R(fe())}let o=await r.transport.request(N(e,{mode:"personalized",token:t,userRef:r.userRef,...r.sessionId?{sessionId:r.sessionId}:{}}));if(o.ok||o.error.httpStatus!==401)return o;let i;try{i=await r.identity.currentToken({forceRefresh:!0});}catch{return R(fe())}let a=await r.transport.request(N(e,{mode:"personalized",token:i,userRef:r.userRef,...r.sessionId?{sessionId:r.sessionId}:{}}));return !a.ok&&a.error.httpStatus===401?R(fe(a.error.httpStatus)):a}n(We,"authedSend");function fe(e){return I("authRejected",{retryable:false,...e!==void 0?{httpStatus:e}:{}})}n(fe,"authRejectedError");function Ge(e){return I("internalError",{retryable:true,wireMessage:rt(e)})}n(Ge,"networkError");function rt(e){return e instanceof Error?e.message:typeof e=="string"?e:"network request failed"}n(rt,"describeCause");var tt=3e4,nt=ue*2,ot="idempotency-key",it=new Set(["POST","PUT","PATCH","DELETE"]),at=Object.freeze({onEvent(){}}),st=Object.freeze({setTimeout:n((e,r)=>setTimeout(e,r),"setTimeout"),clearTimeout:n(e=>clearTimeout(e),"clearTimeout"),now:n(()=>Date.now(),"now")});function lt(e){let r=e.trim().replace(/[^A-Za-z0-9_.:-]/g,"-");return r.length===0?null:`efs_${r}`.slice(0,128)}n(lt,"seededIdempotencyKey");function $e(e){let r=e.observer??at,t=e.timers??st,o=e.rng??Math.random,i=e.sleep??((c,f)=>_t(c,t,f)),a=e.maxAttempts??qe,u=e.unaryTimeoutMs??tt,l=e.newIdempotencyKey??dt(),s=n(c=>{try{r.onEvent(c);}catch{}},"emit");async function d(c,f,m){let T=m?.maxAttempts,p=Math.max(1,T??a),k=m?.idempotent??it.has(f.method),w=m?.idempotencyKey===void 0?null:lt(m.idempotencyKey),h=k?w??l():null,V=ut(f,h),S=0;for(;;){let C=n(_=>Object.freeze({call:c,method:f.method,path:f.path,attempt:S,...h?{idempotencyKey:h}:{},..._}),"stamp");s(C({phase:"attempt"}));let P=gt(u,t),g=ht(P.signal,f.signal),z;try{z=await We({...V,signal:g.signal},e.auth);}catch(_){z=R(Ge(_));}finally{g.dispose(),P.cancel();}if(z.ok)return s(C({phase:"settled",ok:true,reason:"ok"})),z;let O=z.error,v=ft(O,S,{maxAttempts:p,rng:o,now:t.now(),aborted:f.signal?.aborted===true,...T!==void 0?{perCallMaxAttempts:T}:{},...e.errorPolicy!==void 0?{policy:e.errorPolicy}:{}}),b={ok:false,code:O.code,reason:v.reason,...O.httpStatus!==void 0?{httpStatus:O.httpStatus}:{},...O.requestId!==void 0?{requestId:O.requestId}:{}};if(!v.retry)return s(C({phase:"settled",...b})),R(O);if(s(C({phase:"retry",...b,delayMs:v.delayMs})),await i(v.delayMs,f.signal),f.signal?.aborted===true)return s(C({phase:"settled",...b,reason:"aborted"})),R(O);S+=1;}}n(d,"send");async function y(c){return N(c,await Et(e.auth))}n(y,"authorize");async function*E(c,f,m){s(Object.freeze({call:c,phase:"stream.open",method:f.method,path:f.path,attempt:0}));try{yield*e.auth.transport.stream(f,m);}catch{yield Ye({code:"internal_error",retryable:true,wireMessage:null,synthesized:true,lastEventId:null,serverRequestId:null});}}return n(E,"stream"),Object.freeze({send:d,authorize:y,stream:E})}n($e,"createRequestFunnel");function ut(e,r){let t={};for(let[o,i]of Object.entries(e.headers??{}))o.toLowerCase()!==ot&&(t[o]=i);return r!==null&&(t["Idempotency-Key"]=r),{...e,headers:t}}n(ut,"assembleHeaders");function dt(){let e=0;return ()=>`efk_${Date.now().toString(36)}_${(e++).toString(36)}_${Math.random().toString(36).slice(2,12)}`}n(dt,"defaultIdempotencyKeyFactory");var ct=10;function ft(e,r,t){if(t.aborted)return {retry:false,reason:"aborted"};let o=pt(e);if(o==="quota")return {retry:false,reason:"daily-quota-exhausted"};if(o!=="burst"&&!le(e.code))return {retry:false,reason:"terminal-code"};let i=o==="burst"?"burst-throttle":"retryable-code";if(n(()=>{if(t.policy===void 0)return false;try{return !t.policy.shouldRetry(e.code,r)}catch{return false}},"policyVetoedRetry")())return {retry:false,reason:"terminal-code"};let u=n(()=>{if(t.policy===void 0)return null;let d;try{d=t.policy.maxAttempts(e.code);}catch{return null}return typeof d!="number"||!Number.isFinite(d)?null:Math.max(1,Math.min(ct,Math.floor(d)))},"policyCeiling"),l=t.perCallMaxAttempts??u()??t.maxAttempts;if(r+1>=l)return {retry:false,reason:"attempts-exhausted"};let s=yt(e,t.now);return s!==null?s>nt?{retry:false,reason:"server-reset-beyond-budget"}:{retry:true,reason:i,delayMs:s}:{retry:true,reason:i,delayMs:Be(r,t.rng)}}n(ft,"decideRetry");function pt(e){let r=e.code==="unknown"?Le(bt(e.raw)):e.code;return r==="quotaExceeded"?"quota":r==="rateLimited"||e.httpStatus===429?"burst":null}n(pt,"throttleKind");function yt(e,r){let t=mt(e.raw);if(t===null)return null;let o=t-r;return o>0?o:0}n(yt,"retryOverrideMs");function mt(e){for(let r of Qe(e)){let t=r.resets_at,o=vt(t);if(o!==null)return o}return null}n(mt,"findResetsAt");function Qe(e){if(!Ke(e))return [];let r=[e];for(let t of ["error","detail"]){let o=e[t];Ke(o)&&r.push(o);}return r}n(Qe,"candidateScopes");function vt(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 r=Date.parse(e);return Number.isFinite(r)?r:null}return null}n(vt,"parseInstantMs");function bt(e){for(let r of Qe(e)){let t=r.code;if(typeof t=="string"&&t.length>0)return t}return null}n(bt,"rawWireCode");function Ke(e){return typeof e=="object"&&e!==null}n(Ke,"isRecord");async function Et(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(Et,"resolveDeviceAuth");function gt(e,r){let t=new AbortController,o=r.setTimeout(()=>t.abort(),e);return {signal:t.signal,cancel:n(()=>r.clearTimeout(o),"cancel")}}n(gt,"boundedSignal");function ht(e,r){let t=n(()=>{},"noop");if(!r)return {signal:e,dispose:t};let o=new AbortController;if(e.aborted||r.aborted)return o.abort(),{signal:o.signal,dispose:t};let i=n(()=>o.abort(),"onAbort");return e.addEventListener("abort",i,{once:true}),r.addEventListener("abort",i,{once:true}),{signal:o.signal,dispose:n(()=>{e.removeEventListener("abort",i),r.removeEventListener("abort",i);},"dispose")}}n(ht,"mergeSignals");function _t(e,r,t){return e<=0||t?.aborted===true?Promise.resolve():new Promise(o=>{let i=r.setTimeout(()=>{t?.removeEventListener("abort",a),o();},e),a=n(()=>{r.clearTimeout(i),o();},"onAbort");t?.addEventListener("abort",a,{once:true});})}n(_t,"delayAbortable");var G=Object.freeze(["visit","join","summary","messages"]);function K(e){return typeof e=="string"&&G.includes(e)}n(K,"isVetVisitIntent");var Rt="/widget/v1/televet/handoffs",Tt="/widget/v1/televet/availability",Ct="/widget/v1/televet/chat-entry",xt=/^[a-z0-9][a-z0-9_-]{0,39}$/,nr=/^[A-Za-z0-9_-]{22}$/,Xe="everfur_flow",Ze=32,Je=128,er=64;function $(e){let r=e.httpStatus;switch(e.code){case "sessionRequired":return "sessionRequired";case "authExpired":case "authRejected":return "authRejected";case "sdkUpdateRequired":return "sdkUpdateRequired";case "validationFailed":return "invalidRequest";case "rateLimited":case "quotaExceeded":return "rateLimited";}return r===void 0?e.code==="internalError"?"network":"unknown":r===429?"rateLimited":r===404?"unavailable":r===403?"accessDenied":r===401?"authRejected":r===400||r===422?"invalidRequest":r>=500?"serverError":"unknown"}n($,"vetVisitErrorReasonOf");function rr(e){return R(I("validationFailed",{retryable:false,wireMessage:e}))}n(rr,"invalid");function pe(e){return R(I("internalError",{retryable:false,httpStatus:502,wireMessage:e}))}n(pe,"unusable");function wt(e,r){let t={};e!==void 0&&(t.pet_ref=e);let o=r?.returnTo;if(o!=null){if(typeof o!="string"||!xt.test(o))return {ok:false,message:"returnTo must be a registered return destination key"};t.return_to=o;}let i=r?.entry;if(i!=null){if(i!=="chat"||e===void 0)return {ok:false,message:"entry 'chat' needs the pet the chat is about"};t.entry=i;}let a=r?.visitRef,u=r?.intent,l=a!=null;if(l){let s=typeof a=="string"?a.trim():"";if(s.length<1||[...s].length>er)return {ok:false,message:`visitRef must be 1..${er} characters`};t.visit_ref=s;}if(u!=null){if(!l)return {ok:false,message:"intent needs the visitRef it opens"};if(!K(u))return {ok:false,message:`intent must be one of ${G.join(", ")}`};t.intent=u;}return {ok:true,body:t}}n(wt,"handoffBody");function St(e){if(typeof e!="object"||e===null)return null;let{visit_ref:r,intent:t}=e;return typeof r!="string"||r.length===0||!K(t)?null:Object.freeze({visitRef:r,intent:t})}n(St,"parseVisitEcho");function or(e){let r=e.funnel??$e({auth:e.auth,...e.errorPolicy?{errorPolicy:e.errorPolicy}:{}}),t=e.telemetry,o=n(i=>(tr(t,"televet.visit.handoff_failed",{reason:$(i)}),R(i)),"failed");return {async createHandoff(i,a){let u;if(i!=null){let p=typeof i=="string"?[...i].length:0;if(p<1||p>Je)return o(I("validationFailed",{retryable:false,wireMessage:`pet_ref must be 1..${Je} characters`}));u=i;}let l=wt(u,a);if(!l.ok){let p=rr(l.message);return p.ok?p:o(p.error)}let s=l.body,d=await r.send("televet.visit.handoff",{method:"POST",path:Rt,body:s},{idempotent:false,maxAttempts:1});if(!d.ok)return o(d.error);let y=kt(d.value),E=s.return_to!==void 0,c=E?d.value?.flow_id:void 0;if(E&&(typeof c!="string"||!nr.test(c))){let p=pe("the handoff response carried no usable return flow id");return p.ok?p:o(p.error)}let f=s.visit_ref!==void 0,m=f?St(d.value?.visit):null;if(f&&m===null){let p=pe("the handoff response did not confirm the visit it opens");return p.ok?p:o(p.error)}let T=y===null?null:Object.freeze({...y,...E?{flowId:c}:{},...m!==null?{visit:m}:{}});return T===null?o(I("internalError",{retryable:false,httpStatus:502,wireMessage:"the handoff response carried no usable visit url"})):(tr(t,"televet.visit.handoff_created",{pet_scoped:s.pet_ref!==void 0}),ce(T))},async checkAvailability(i){if(typeof i!="string"||i.length>Ze)return rr(`state must be at most ${Ze} characters`);let a=await r.send("televet.visit.availability",{method:"POST",path:Tt,body:{state:i}},{idempotent:false,maxAttempts:1});if(!a.ok)return R(a.error);let u=a.value?.available;return typeof u!="boolean"?pe("the availability response carried no usable answer"):ce(Object.freeze({available:u}))},async chatEntryOpen(){try{let i=await r.send("televet.visit.chat_entry",{method:"GET",path:Ct},{maxAttempts:1});return i.ok&&i.value?.open===!0}catch{return false}}}}n(or,"createVetVisitController");function Ft(e){if(typeof e!="string")return null;let r=e.indexOf("#"),t=r<0?e:e.slice(0,r),o=t.indexOf("?");if(o<0)return null;let i=t.slice(o+1).split("&").filter(a=>a.startsWith(`${Xe}=`)).map(a=>a.slice(Xe.length+1));return i.length!==1||!nr.test(i[0]??"")?null:Object.freeze({flowId:i[0]})}n(Ft,"parseVetVisitReturn");function kt(e){if(typeof e!="object"||e===null)return null;let{url:r,expires_at:t}=e;return typeof r!="string"||typeof t!="string"||t.length===0||!Pt(r)?null:Object.freeze({url:r,expiresAt:t})}n(kt,"parseHandoff");var Ot=new Set(["localhost","127.0.0.1","[::1]"]),Vt=/^([A-Za-z][A-Za-z0-9+.-]*):\/\/([^/?#]*)/,It=/[\s\u0000-\u001f\u007f]/;function Pt(e){if(It.test(e))return false;let r=Vt.exec(e);if(r===null)return false;let t=(r[1]??"").toLowerCase(),o=r[2]??"";if(o.length===0||o.includes("@"))return false;let i=o.replace(/:\d+$/,"").toLowerCase(),a=t==="https",u=t==="http"&&Ot.has(i);if(!a&&!u)return false;let l=e.indexOf("#");if(l<0)return false;let s=e.slice(l);return s.startsWith("#h=")&&s.length>3}n(Pt,"isOpenableVisitUrl");function tr(e,r,t){if(e)try{e.track(r,t);}catch{}}n(tr,"safeTrack");var ir=Symbol.for("@everfur/sdk#EverfurContext@v1"),ar=globalThis,sr=ar[ir]??(ar[ir]=createContext(null));sr.displayName??="EverfurContext";function Q(){let e=useContext(sr);if(e===null)throw new M("not-initialized","Everfur hooks must be called inside <EverfurProvider>. Wrap your tree once, high.");return e}n(Q,"useEverfurContext");var jt=Object.freeze({chat:Object.freeze(["chat.message.create"]),records:Object.freeze(["records.upload.create","records.record.read"]),recordsClinic:Object.freeze(["records.clinic.create"]),video:Object.freeze(["video.gait.execute"]),photo:Object.freeze(["photo.checkup.execute"]),animations:Object.freeze(["animations.state.read"]),televet:Object.freeze(["televet.visit.create"])});function Dt(e){return jt[e]}n(Dt,"requires");function lr(e,r,t){let o=Dt(e),i=new Map;for(let l of r)i.set(l.resource,l);if(t?.isPending===true&&o.some(l=>!i.has(l)))return ye({name:e,enabled:false,isPending:true,limits:{}});let a=Mt(o,i);return o.filter(l=>i.get(l)?.granted!==true).length===0?ye({name:e,enabled:true,isPending:false,limits:a}):ye({name:e,enabled:false,isPending:false,limits:a,disabled:Nt(o,i)})}n(lr,"decideCapability");function Mt(e,r){let t={};for(let o of e){let i=r.get(o)?.limits;if(i)for(let[a,u]of Object.entries(i)){let l=t[a];t[a]=l===void 0?u:Math.min(l,u);}}return t}n(Mt,"mergeLimits");function Nt(e,r){for(let t of e){let o=r.get(t)?.disabled;if(o)return Object.freeze({reason:o.reason,level:o.level,recoverable:o.recoverable})}return Object.freeze({reason:de("accessDenied"),level:"user_entitlement",recoverable:false})}n(Nt,"disabledFor");function ye(e){let r={name:e.name,enabled:e.enabled,isPending:e.isPending,limits:Object.freeze({...e.limits})};return e.disabled!==void 0&&(r.disabled=e.disabled),Object.freeze(r)}n(ye,"freezeDecision");function ur(e){let{runtime:r}=Q(),t=r.entitlements,o=useSyncExternalStore(t.subscribe,t.getSnapshot,t.getSnapshot);return useMemo(()=>lr(e,o.decisions,{isPending:o.isPending}),[e,o])}n(ur,"useCapability");function dr(e){let r=globalThis.console;try{r?.error?.("[everfur] A host callback threw; the SDK ignored it.",e);}catch{}}n(dr,"reportHostFailure");function qt(e){return (typeof e=="object"||typeof e=="function")&&e!==null&&typeof e.then=="function"}n(qt,"isThenable");function j(e,...r){if(typeof e=="function")try{let t=e(...r);return qt(t)&&Promise.resolve(t).then(void 0,dr),t}catch(t){dr(t);return}}n(j,"callHost");var cr=false;function X(e,r){return r!==void 0?(j(r,e),"onStartInApp"):B(e)==="presented"?"presenter":ke(e)?"experience":(cr||(cr=true,console.warn("[everfur] A vet visit had nowhere to open: mount <EverfurTelevetHost /> in your EverfurProvider, or pass prefer: 'redirect'.")),null)}n(X,"openVetVisitInApp");var me=Object.freeze({status:"idle",error:null,errorReason:null});function Ht(e,r,t){let{usState:o,chat:i,scope:a}=t,u=r&&(o!==null||i),l=`${o??""}|${i?"chat":""}`,[s,d]=useState(null);if(useEffect(()=>{if(!u)return;let E=true,c=e.current;return d(null),n(async()=>{try{if(i&&!(c.chatEntryOpen&&await c.chatEntryOpen()))return !1;if(o===null)return !0;if(!c.checkAvailability)return !1;let m=await c.checkAvailability(o);return m.ok&&m.value.available}catch{return false}},"ask")().then(m=>{E&&d({key:l,open:m});}),()=>{E=false;}},[u,l,o,i,a,e]),!u)return null;let y=s!==null&&s.key===l;return {open:y&&s.open,pending:!y}}n(Ht,"usePreflight");var Yt=Object.freeze({status:"opening",error:null,errorReason:null});function yr(e,r={}){let{runtime:t,userRef:o,scopeEpoch:i}=Q(),a=ur("televet"),u=a.enabled&&o!==null,l=r.usState??null,s=r.entry==="chat",d=r.petRef??null,y=r.prefer==="redirect",E=useMemo(()=>{if(r.controller)return r.controller;let{services:v}=t.registry;return or({auth:v.authFor(o),telemetry:v.telemetry,...v.errorPolicy?{errorPolicy:v.errorPolicy}:{}})},[t,o,i,r.controller]),c=useRef(E);c.current=E;let f=useMemo(()=>({runtime:t,userRef:o,scopeEpoch:i}),[t,o,i]),m=Ht(c,u,{usState:l,chat:s,scope:f}),T=u&&(m===null||m.open)&&(!s||d!==null),p=r.returnTo??null,[k,w]=useState(me),h=useRef(null),V=useRef({runtime:t,userRef:o,scopeEpoch:i});V.current={runtime:t,userRef:o,scopeEpoch:i};let S=useRef(E);S.current=E;let C=useRef(T);C.current=T;let P=useCallback((v,b)=>{if(h.current)return h.current;let _=n((x,D)=>(w({status:x==="cancelled"?"idle":"error",error:D,errorReason:x==="cancelled"?null:x}),Object.freeze({opened:false,reason:x,error:D})),"fail");if(!C.current)return Promise.resolve(_("unavailable",null));let A=e.prepare();if(!A.ok)return Promise.resolve(_(A.reason,null));let te=V.current,_e=S.current;w(Yt);let ne=(async()=>{let x,D={...p!==null?{returnTo:p}:{},...s?{entry:"chat"}:{},...b!==null?{visitRef:b.visitRef}:{},...b!==null&&b.intent!==null&&b.intent!==void 0?{intent:b.intent}:{}},Re=Object.keys(D).length===0?void 0:D,Te=v===void 0?d:v;try{x=await(Re===void 0?_e.createHandoff(Te):_e.createHandoff(Te,Re));}catch{return e.abandon(A.value),_("unknown",null)}let oe=V.current;if(oe.runtime!==te.runtime||oe.userRef!==te.userRef||oe.scopeEpoch!==te.scopeEpoch)return e.abandon(A.value),_("cancelled",null);if(!x.ok)return e.abandon(A.value),_($(x.error),x.error);let Ce=await e.finish(A.value,x.value);return Ce!==null?_(Ce,null):(w(me),Object.freeze(x.value.flowId===void 0?{opened:true}:{opened:true,flowId:x.value.flowId}))})().finally(()=>{h.current===ne&&(h.current=null);});return h.current=ne,ne},[e,d,p,s]),g=useCallback((v,b)=>{if(!C.current)return w({status:"error",error:null,errorReason:"unavailable"}),Promise.resolve(Object.freeze({opened:false,reason:"unavailable",error:null}));let _=v===void 0?d:v,A={..._!==null?{petRef:_}:{},...l!==null?{usState:l}:{},...b!==null?{visitRef:b.visitRef,intent:b.intent}:{}};return X(A)===null?(w({status:"error",error:null,errorReason:"unavailable"}),Promise.resolve(Object.freeze({opened:false,reason:"unavailable",error:null}))):(w(me),Promise.resolve(Object.freeze({opened:true})))},[d,l]),z=useCallback(v=>y?P(v,null):g(v,null),[y,P,g]),O=useCallback((v,b)=>y?P(void 0,{visitRef:v,intent:b??null}):g(void 0,{visitRef:v,intent:b??null}),[y,P,g]);return {available:T,isPending:a.isPending||(m?.pending??false),status:k.status,error:k.error,errorReason:k.errorReason,open:z,openVisit:O}}n(yr,"useVetVisitWith");var Kt=n(e=>Linking.openURL(e),"defaultOpenUrl");function ve(e={}){let{openUrl:r,...t}=e,o=useMemo(()=>{let i=r??Kt;return {prepare:n(()=>({ok:true,value:null}),"prepare"),async finish(a,u){try{return await i(u.url),null}catch{return "openFailed"}},abandon:n(()=>{},"abandon")}},[r]);return yr(o,t)}n(ve,"useVetVisit");function ge(e){if(e!==null&&typeof e=="object"&&!Object.isFrozen(e)){Object.freeze(e);for(let r of Object.keys(e))ge(e[r]);}return e}n(ge,"deepFreeze");var $t=Object.freeze({content:0,heading:2,control:1.8,compact:1.5,badge:1.3}),vr={xs:4,sm:8,md:12,lg:16,xl:24,xxl:32},br={tile:5,xs:6,sm:10,md:14,lg:20,xl:28,pill:500},mr={nano:8,small:9,micro:10,tiny:11,caption:12,bodyTight:13,body:14,subtitle:16,heading:18,verdict:24},Qt={tight:1.15,snug:1.3,normal:1.4,relaxed:1.55},Xt={regular:"400",medium:"500",bold:"700"},Zt={eyebrow:1,monoWide:.9,headerBrand:-0.42,tight:-0.35},Jt=0,J="System",ee="monospace",en=["content","heading","control","compact","badge"];function rn(e){let r={};for(let t of en)r[t]=e;return r}n(rn,"authoredTierSizes");function Er(){return {family:J,mono:ee,fontUrl:null,families:{regular:J,medium:J,bold:J,mono:ee,monoMedium:ee,monoBold:ee},namedFaces:{regular:false,medium:false,bold:false,mono:false,monoMedium:false,monoBold:false},fontUrls:{},size:mr,tierSizes:rn(mr),lineHeight:Qt,weight:Xt,letterSpacing:Zt,scale:1,maxScale:Jt,scaleCaps:$t}}n(Er,"baseType");var gr={},be=Object.freeze({standard:Object.freeze([.2,0,0,1]),emphasized:Object.freeze([.2,.8,.2,1]),exit:Object.freeze([.4,0,1,1])});function Ee(e){return `cubic-bezier(${e.join(", ")})`}n(Ee,"cssCubicBezier");var hr={duration:{instant:80,fast:140,normal:220,slow:320},spring:{gentle:{damping:18,stiffness:200}},easing:{standard:Ee(be.standard),emphasized:Ee(be.emphasized),exit:Ee(be.exit)},reducedMotion:false},tn={brand:"#10462E",brandSoft:"rgba(16,70,46,0.10)",brandSofter:"rgba(16,70,46,0.15)",brandBorder:"rgba(16,70,46,0.18)",borderHairlineGreen:"rgba(16,70,46,0.25)",brandBorderStrong:"rgba(16,70,46,0.55)",brandInk:"#10462E",linkInk:"#10462E",surface:"#FFFFFF",surfaceCream:"#FDFBF8",surfaceSubtle:"#EFE9E3",background:"#FFFFFF",borderRingCream:"#D8D2C8",chatGround:"#FFFFFF",composerFill:"#FDFBF8",composerBorder:"rgba(16,70,46,0.75)",shadow:"#0B3421",text:{primary:"#111111",secondary:"#0E462E",muted:"#6E6660",placeholder:"rgba(61,61,61,0.75)",onBrand:"#FFFFFF",metaCool:"#3D3D3D",timestamp:"rgba(61,61,61,0.75)"},primary:"#10462E",onPrimary:"#FFFFFF",accent:"#10462E",onAccent:"#FFFFFF",accentEdge:"#07C168",success:"#07C168",danger:"#B91C1C",errorRed:"#FF1B00",warningStrong:"#A45610",cautionAccent:"#D9821D",riskConcern:"#EFA700",sentiment:{up:"#07C168",neutral:"#FBC558",down:"#FF1B00"},badgeBgPositive:"rgba(7,193,104,0.12)",badgeBgCaution:"rgba(217,130,29,0.14)",badgeBgCritical:"rgba(185,28,28,0.12)",badgeBgNeutral:"rgba(110,102,96,0.12)",bubbleUser:"#10462E",bubbleAssistant:"#FFFFFF",skeleton:"#EFE9E3",scanButtonPink:"#FFC3BC",checkupCardLowRiskBg:"rgba(7,193,104,0.10)",checkupCardConcernBg:"rgba(239,167,0,0.10)"},_r=ge({brightness:"light",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false},color:tn,space:vr,radius:br,type:Er(),motion:hr,slots:gr}),nn={brand:"#6BD39A",brandSoft:"rgba(107,211,154,0.12)",brandSofter:"rgba(107,211,154,0.18)",brandBorder:"rgba(107,211,154,0.22)",borderHairlineGreen:"rgba(107,211,154,0.28)",brandBorderStrong:"rgba(107,211,154,0.55)",brandInk:"#6BD39A",linkInk:"#6BD39A",surface:"#1C1F23",surfaceCream:"#23272C",surfaceSubtle:"#23272C",background:"#15171A",borderRingCream:"#3A3F45",chatGround:"#1C1F23",composerFill:"#23272C",composerBorder:"rgba(107,211,154,0.75)",shadow:"#000000",text:{primary:"#F5F3F0",secondary:"#A9E4C4",muted:"#9A938C",placeholder:"rgba(255,255,255,0.55)",onBrand:"#0E1F17",metaCool:"#C9C9C9",timestamp:"rgba(245,243,240,0.7)"},primary:"#6BD39A",onPrimary:"#0E1F17",accent:"#6BD39A",onAccent:"#0E1F17",accentEdge:"#34D888",success:"#07C168",danger:"#F87171",errorRed:"#FF6B5B",warningStrong:"#F0A35E",cautionAccent:"#D9821D",riskConcern:"#EFA700",sentiment:{up:"#07C168",neutral:"#FBC558",down:"#FF1B00"},badgeBgPositive:"rgba(7,193,104,0.18)",badgeBgCaution:"rgba(217,130,29,0.20)",badgeBgCritical:"rgba(185,28,28,0.22)",badgeBgNeutral:"rgba(255,255,255,0.10)",bubbleUser:"#6BD39A",bubbleAssistant:"#1C1F23",skeleton:"#23272C",scanButtonPink:"#FFC3BC",checkupCardLowRiskBg:"rgba(7,193,104,0.16)",checkupCardConcernBg:"rgba(239,167,0,0.16)"};ge({brightness:"dark",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false},color:nn,space:vr,radius:br,type:Er(),motion:hr,slots:gr});var Rr=Symbol.for("@everfur/sdk#EverfurThemeContext@v1"),Tr=globalThis,he=Tr[Rr]??(Tr[Rr]=createContext(_r));he.displayName??="EverfurThemeContext";function U(){return useContext(he)}n(U,"useEverfurTheme");function dn(e,r){let t=e.scaleCaps[r];return t>0?t:void 0}n(dn,"tierMultiplier");function xr({tier:e="content",...r}){let{type:t}=U(),o=dn(t,e);return createElement(Text,o===void 0?r:{maxFontSizeMultiplier:o,...r})}n(xr,"Text");forwardRef(n(function(r,t){return createElement(TextInput,{...r,...t===null?{}:{ref:t}})},"TextInput"));function wr(e,r){if(e===void 0)return {};let t={};return e.backgroundColor!==void 0&&(t.backgroundColor=e.backgroundColor),e.borderColor!==void 0&&(t.borderColor=e.borderColor,t.borderWidth=r??1),e.borderRadius!==void 0&&(t.borderRadius=e.borderRadius),t}n(wr,"slotBox");function Sr(e){return e?.textColor===void 0?{}:{color:e.textColor}}n(Sr,"slotText");var cn=Object.freeze({regular:"regular",medium:"medium",bold:"bold",mono:"regular",monoMedium:"medium",monoBold:"bold"});function Fr(e,r){let t=e.type,o=t.families[r];return r==="mono"||t.namedFaces[r]?{fontFamily:o}:{fontFamily:o,fontWeight:t.weight[cn[r]]}}n(Fr,"face");var kr=Object.freeze({visitButton:"Talk to a vet"});var Or=44,vn=.6;function bn(e){let{petRef:r,label:t,openUrl:o,onOpened:i,onError:a,style:u,labelStyle:l,controller:s,returnTo:d,usState:y,entry:E,visitRef:c,intent:f,onStartInApp:m,prefer:T}=e,p=T==="redirect",k=ve({...d!==void 0?{returnTo:d}:{},...y!==void 0?{usState:y}:{},...E!==void 0?{entry:E}:{},...r!==void 0?{petRef:r}:{},...o!==void 0?{openUrl:o}:{},...s!==void 0?{controller:s}:{},prefer:p?"redirect":"in-app"}),w=U(),h=useMemo(()=>En(w),[w]),V=useRef(false);if(!k.available)return jsxs(Fragment,{children:[null,jsx(H,{})]});let S=k.status==="opening",C=t??kr.visitButton;return jsxs(Fragment,{children:[jsx(Pressable,{onPress:n(()=>{if(!(S||V.current)){if(!p){let g={...r!==void 0?{petRef:r}:{},...y!==void 0?{usState:y}:{},...c!=null?{visitRef:c,intent:f??null}:{}};X(g,m)===null&&j(a,"unavailable",null);return}V.current=true,(c==null?k.open():k.openVisit(c,f??null)).then(g=>{g.opened?j(i,g.flowId??null):g.reason!=="cancelled"&&j(a,g.reason,g.error);}).finally(()=>{V.current=false;});}},"onPress"),accessibilityRole:"button",accessibilityLabel:C,accessibilityState:{busy:S,disabled:S},style:[h.button,S?h.busy:null,u],children:jsx(xr,{style:[h.label,l],children:C})}),jsx(H,{})]})}n(bn,"VetVisitButton");function En(e){let{color:r,space:t,radius:o,type:i,slots:a}=e;return StyleSheet.create({button:{minHeight:Or,minWidth:Or,alignItems:"center",justifyContent:"center",paddingHorizontal:t.xl,paddingVertical:t.sm,borderRadius:o.pill,backgroundColor:r.primary,...wr(a.vetVisitButton)},busy:{opacity:vn},label:{...Fr(e,"medium"),color:r.onPrimary,fontSize:i.size.body,lineHeight:i.size.body*i.lineHeight.snug,...Sr(a.vetVisitButton)}})}n(En,"makeStyles");export{H as EverfurTelevetHost,G as VET_VISIT_INTENTS,bn as VetVisitButton,jr as hasEverfurTelevetFlow,K as isVetVisitIntent,Ft as parseVetVisitReturn,Dr as presentEverfurTelevetFlow,zr as registerEverfurTelevetFlow,ve as useVetVisit,$ as vetVisitErrorReasonOf};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { P as PetRef } from './ids-B2GAAifq.cjs';
|
|
2
|
+
import { V as VetVisitIntent } from './visitIntent-D7_yVp1I.cjs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* What opening a vet visit carries to its destination, whichever destination that is.
|
|
6
|
+
*
|
|
7
|
+
* Deliberately the scoping the entry point was given and nothing more. The host already holds the session,
|
|
8
|
+
* the theme and its navigator; what it cannot know is which pet, which state and, for a visit the member
|
|
9
|
+
* already has, which visit. Identical on both platforms, so one presenter satisfies an app and a site.
|
|
10
|
+
*/
|
|
11
|
+
interface EverfurTelevetFlowRequest {
|
|
12
|
+
/** The pet this entry was scoped to, when it was scoped to one. */
|
|
13
|
+
readonly petRef?: PetRef | null | undefined;
|
|
14
|
+
/** The member's US state, when the host gave one. The booking screens preflight availability with it. */
|
|
15
|
+
readonly usState?: string | null | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* A visit this member ALREADY has (the `visitRef` a tapped push carries). Present, the request is to open
|
|
18
|
+
* that visit, not to book a new one; absent, it is a booking.
|
|
19
|
+
*/
|
|
20
|
+
readonly visitRef?: string | null | undefined;
|
|
21
|
+
/** What to open for `visitRef`: `visit`, `join`, `summary` or `messages`. Null means `visit`. */
|
|
22
|
+
readonly intent?: VetVisitIntent | null | undefined;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* The host's presenter: show the Everfur visit for this request. Called on the press, and expected to route
|
|
26
|
+
* or present synchronously.
|
|
27
|
+
*
|
|
28
|
+
* Return nothing (or `true`) when it presented. Return `false` to DECLINE a request it does not handle (a
|
|
29
|
+
* presenter written only for booking, handed a `visitRef`), and the SDK opens its own in-app experience for
|
|
30
|
+
* it instead. A presenter that throws is contained and treated as a decline.
|
|
31
|
+
*/
|
|
32
|
+
type EverfurTelevetFlowPresenter = (request: EverfurTelevetFlowRequest) => void | boolean;
|
|
33
|
+
|
|
34
|
+
export type { EverfurTelevetFlowRequest as E, EverfurTelevetFlowPresenter as a };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { P as PetRef } from './ids-B2GAAifq.js';
|
|
2
|
+
import { V as VetVisitIntent } from './visitIntent-D7_yVp1I.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* What opening a vet visit carries to its destination, whichever destination that is.
|
|
6
|
+
*
|
|
7
|
+
* Deliberately the scoping the entry point was given and nothing more. The host already holds the session,
|
|
8
|
+
* the theme and its navigator; what it cannot know is which pet, which state and, for a visit the member
|
|
9
|
+
* already has, which visit. Identical on both platforms, so one presenter satisfies an app and a site.
|
|
10
|
+
*/
|
|
11
|
+
interface EverfurTelevetFlowRequest {
|
|
12
|
+
/** The pet this entry was scoped to, when it was scoped to one. */
|
|
13
|
+
readonly petRef?: PetRef | null | undefined;
|
|
14
|
+
/** The member's US state, when the host gave one. The booking screens preflight availability with it. */
|
|
15
|
+
readonly usState?: string | null | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* A visit this member ALREADY has (the `visitRef` a tapped push carries). Present, the request is to open
|
|
18
|
+
* that visit, not to book a new one; absent, it is a booking.
|
|
19
|
+
*/
|
|
20
|
+
readonly visitRef?: string | null | undefined;
|
|
21
|
+
/** What to open for `visitRef`: `visit`, `join`, `summary` or `messages`. Null means `visit`. */
|
|
22
|
+
readonly intent?: VetVisitIntent | null | undefined;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* The host's presenter: show the Everfur visit for this request. Called on the press, and expected to route
|
|
26
|
+
* or present synchronously.
|
|
27
|
+
*
|
|
28
|
+
* Return nothing (or `true`) when it presented. Return `false` to DECLINE a request it does not handle (a
|
|
29
|
+
* presenter written only for booking, handed a `visitRef`), and the SDK opens its own in-app experience for
|
|
30
|
+
* it instead. A presenter that throws is contained and treated as a decline.
|
|
31
|
+
*/
|
|
32
|
+
type EverfurTelevetFlowPresenter = (request: EverfurTelevetFlowRequest) => void | boolean;
|
|
33
|
+
|
|
34
|
+
export type { EverfurTelevetFlowRequest as E, EverfurTelevetFlowPresenter as a };
|