@everfur/sdk 0.1.0 → 0.3.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 +648 -1
- package/README.md +58 -23
- package/consent/package.json +8 -0
- package/dist/Chat-DPUD6dnc.d.cts +128 -0
- package/dist/Chat-DwAC2vhB.d.ts +128 -0
- package/dist/DepthViews-DNEM96Se.d.ts +16 -0
- package/dist/DepthViews-DP0R-DhB.d.cts +19 -0
- package/dist/DepthViews-D_3hl4xk.d.ts +19 -0
- package/dist/DepthViews-DbFhR4Du.d.cts +16 -0
- package/dist/ErrorPolicyPort-CNf4uQZP.d.cts +22 -0
- package/dist/ErrorPolicyPort-CwbfmxzJ.d.ts +22 -0
- package/dist/{EverfurResult-D92-uL82.d.cts → EverfurResult-DN9pL2Ab.d.cts} +11 -10
- package/dist/{EverfurResult-D92-uL82.d.ts → EverfurResult-DN9pL2Ab.d.ts} +11 -10
- package/dist/{PhotoController-BItt5M7u.d.cts → PhotoController-3l7MT9jA.d.cts} +1 -1
- package/dist/{PhotoController-D8zMTdcW.d.ts → PhotoController-vzY5bfY_.d.ts} +1 -1
- package/dist/animations/index.cjs +1 -1997
- package/dist/animations/index.d.cts +35 -35
- package/dist/animations/index.d.ts +35 -35
- package/dist/animations/index.js +1 -1972
- package/dist/attachments-5NeobOCd.d.ts +256 -0
- package/dist/attachments-Bw3iMQgu.d.ts +146 -0
- package/dist/attachments-CQgFrEQ7.d.cts +146 -0
- package/dist/attachments-D8T5re7e.d.cts +256 -0
- package/dist/casesRepository-ClLv6qMl.d.ts +188 -0
- package/dist/casesRepository-DHwtGRYY.d.cts +188 -0
- package/dist/chat/index.cjs +1 -1170
- package/dist/chat/index.d.cts +31 -53
- package/dist/chat/index.d.ts +31 -53
- package/dist/chat/index.js +1 -1167
- package/dist/client/index.cjs +9 -2315
- package/dist/client/index.d.cts +77 -15
- package/dist/client/index.d.ts +77 -15
- package/dist/client/index.js +9 -2215
- package/dist/{config-CiJ0PVBB.d.ts → config-CzTZGlfF.d.cts} +63 -25
- package/dist/{config-BSjBdxrZ.d.cts → config-DW60uRb9.d.ts} +63 -25
- package/dist/consent/index.cjs +1 -0
- package/dist/consent/index.d.cts +33 -0
- package/dist/consent/index.d.ts +33 -0
- package/dist/consent/index.js +1 -0
- package/dist/context-DXhqHlPU.d.ts +159 -0
- package/dist/context-XvTzq1tE.d.cts +159 -0
- package/dist/copy-Mjoo91aS.d.ts +198 -0
- package/dist/copy-bKDNigLb.d.cts +198 -0
- package/dist/core/index.cjs +13 -3175
- package/dist/core/index.d.cts +58 -12
- package/dist/core/index.d.ts +58 -12
- package/dist/core/index.js +13 -3163
- package/dist/depth-CErXCU8J.d.cts +502 -0
- package/dist/depth-DjDcJ6kH.d.ts +502 -0
- package/dist/entitlementRepository-DKdXFgTo.d.cts +698 -0
- package/dist/entitlementRepository-DSbzuyAW.d.ts +698 -0
- package/dist/{identity-DK9zORrG.d.ts → identity-BMx2SUOM.d.ts} +19 -6
- package/dist/{identity-Brl-lDd6.d.cts → identity-DI4eVx9S.d.cts} +19 -6
- package/dist/{ids-CJ1S6adf.d.cts → ids-B2GAAifq.d.cts} +1 -1
- package/dist/{ids-CJ1S6adf.d.ts → ids-B2GAAifq.d.ts} +1 -1
- package/dist/index.cjs +12 -4488
- package/dist/index.d.cts +29 -121
- package/dist/index.d.ts +29 -121
- package/dist/index.js +12 -4464
- package/dist/models-B-Uh2LTf.d.ts +214 -0
- package/dist/models-D2EUxPZY.d.cts +214 -0
- package/dist/notifications/index.cjs +2 -0
- package/dist/notifications/index.d.cts +17 -0
- package/dist/notifications/index.d.ts +17 -0
- package/dist/notifications/index.js +2 -0
- package/dist/pets-CtQdRpWo.d.ts +92 -0
- package/dist/pets-aB8q0JyX.d.cts +92 -0
- package/dist/photo/index.cjs +1 -2189
- package/dist/photo/index.d.cts +6 -6
- package/dist/photo/index.d.ts +6 -6
- package/dist/photo/index.js +1 -2186
- package/dist/ports-BN6RHF9W.d.cts +48 -0
- package/dist/ports-BN6RHF9W.d.ts +48 -0
- package/dist/ports-DEBzEhbp.d.cts +386 -0
- package/dist/ports-DMolTRzU.d.ts +386 -0
- package/dist/profile-CSs1wlXT.d.cts +93 -0
- package/dist/profile-CSs1wlXT.d.ts +93 -0
- package/dist/records/depth/index.cjs +2 -0
- package/dist/records/depth/index.d.cts +13 -0
- package/dist/records/depth/index.d.ts +13 -0
- package/dist/records/depth/index.js +2 -0
- package/dist/records/index.cjs +3 -2839
- package/dist/records/index.d.cts +137 -203
- package/dist/records/index.d.ts +137 -203
- package/dist/records/index.js +3 -2833
- package/dist/requestFunnel-CjW7uDuA.d.ts +87 -0
- package/dist/requestFunnel-L-BQfi0z.d.cts +87 -0
- package/dist/{resolve-Dq_4_agU.d.ts → resolve-D4Ywz5OS.d.cts} +10 -4
- package/dist/{resolve-Dq_4_agU.d.cts → resolve-D4Ywz5OS.d.ts} +10 -4
- package/dist/{runtime-BgQnA594.d.cts → runtime-B8s-_hv8.d.cts} +134 -59
- package/dist/{runtime-CBA-LvdM.d.ts → runtime-BR9ysG0J.d.ts} +134 -59
- package/dist/server/events/index.cjs +2 -0
- package/dist/server/events/index.d.cts +550 -0
- package/dist/server/events/index.d.ts +550 -0
- package/dist/server/events/index.js +2 -0
- package/dist/server/index.cjs +2 -533
- package/dist/server/index.d.cts +73 -18
- package/dist/server/index.d.ts +73 -18
- package/dist/server/index.js +2 -530
- package/dist/species-BXAIMh7I.d.cts +9 -0
- package/dist/species-BXAIMh7I.d.ts +9 -0
- package/dist/televet/index.cjs +1 -0
- package/dist/televet/index.d.cts +60 -0
- package/dist/televet/index.d.ts +60 -0
- package/dist/televet/index.js +1 -0
- package/dist/testing/index.cjs +5 -823
- package/dist/testing/index.d.cts +17 -3
- package/dist/testing/index.d.ts +17 -3
- package/dist/testing/index.js +5 -820
- package/dist/testing/rn/index.cjs +1 -449
- package/dist/testing/rn/index.d.cts +17 -29
- package/dist/testing/rn/index.d.ts +17 -29
- package/dist/testing/rn/index.js +1 -444
- package/dist/testing/web/index.cjs +1 -0
- package/dist/testing/web/index.d.cts +131 -0
- package/dist/testing/web/index.d.ts +131 -0
- package/dist/testing/web/index.js +1 -0
- package/dist/timelineRows-CaohZzXS.d.cts +19 -0
- package/dist/timelineRows-DZed6dAM.d.ts +19 -0
- package/dist/typeStyle-0TydiZ1w.d.cts +19 -0
- package/dist/typeStyle-CWMsoe6b.d.ts +19 -0
- package/dist/uploadTransport-D0M0T4hN.d.ts +38 -0
- package/dist/uploadTransport-DKJHs3Yj.d.cts +38 -0
- package/dist/useRecordsDepth-BHBzJ76R.d.cts +237 -0
- package/dist/useRecordsDepth-BU-OhzH6.d.ts +237 -0
- package/dist/useVetVisit-Bc84hWUU.d.cts +187 -0
- package/dist/useVetVisit-CjmMa896.d.ts +187 -0
- package/dist/video/index.cjs +1 -1941
- package/dist/video/index.d.cts +4 -4
- package/dist/video/index.d.ts +4 -4
- package/dist/video/index.js +1 -1938
- package/dist/view-C3qPIXGX.d.cts +310 -0
- package/dist/view-DtSPYpKa.d.ts +310 -0
- package/dist/visitIntent-D7_yVp1I.d.cts +8 -0
- package/dist/visitIntent-D7_yVp1I.d.ts +8 -0
- package/dist/web/consent/index.cjs +1 -0
- package/dist/web/consent/index.d.cts +34 -0
- package/dist/web/consent/index.d.ts +34 -0
- package/dist/web/consent/index.js +1 -0
- package/dist/web/index.cjs +14 -0
- package/dist/web/index.d.cts +217 -0
- package/dist/web/index.d.ts +217 -0
- package/dist/web/index.js +14 -0
- package/dist/web/notifications/index.cjs +2 -0
- package/dist/web/notifications/index.d.cts +213 -0
- package/dist/web/notifications/index.d.ts +213 -0
- package/dist/web/notifications/index.js +2 -0
- package/dist/web/records/depth/index.cjs +2 -0
- package/dist/web/records/depth/index.d.cts +12 -0
- package/dist/web/records/depth/index.d.ts +12 -0
- package/dist/web/records/depth/index.js +2 -0
- package/dist/web/records/index.cjs +4 -0
- package/dist/web/records/index.d.cts +194 -0
- package/dist/web/records/index.d.ts +194 -0
- package/dist/web/records/index.js +4 -0
- package/dist/web/televet/index.cjs +1 -0
- package/dist/web/televet/index.d.cts +50 -0
- package/dist/web/televet/index.d.ts +50 -0
- package/dist/web/televet/index.js +1 -0
- package/notifications/package.json +8 -0
- package/package.json +197 -9
- package/records/depth/package.json +8 -0
- package/server/events/device-blocked.cjs +15 -0
- package/server/events/package.json +9 -0
- package/televet/package.json +8 -0
- package/testing/web/native-blocked.cjs +12 -0
- package/testing/web/package.json +8 -0
- package/web/consent/native-blocked.cjs +12 -0
- package/web/consent/package.json +8 -0
- package/web/native-blocked.cjs +12 -0
- package/web/notifications/native-blocked.cjs +12 -0
- package/web/notifications/package.json +8 -0
- package/web/package.json +8 -0
- package/web/records/depth/native-blocked.cjs +12 -0
- package/web/records/depth/package.json +8 -0
- package/web/records/native-blocked.cjs +12 -0
- package/web/records/package.json +8 -0
- package/web/televet/native-blocked.cjs +12 -0
- package/web/televet/package.json +8 -0
- package/dist/ChatController-CKdBvPj2.d.ts +0 -146
- package/dist/ChatController-CpUMvvZf.d.cts +0 -146
- package/dist/FilePort-BabWrv7I.d.cts +0 -22
- package/dist/FilePort-BabWrv7I.d.ts +0 -22
- package/dist/petsRepository-BEGb97M9.d.cts +0 -326
- package/dist/petsRepository-Bu18r2kK.d.ts +0 -326
- package/dist/requestFunnel-DuUH-kAe.d.cts +0 -28
- package/dist/requestFunnel-dio5OmR9.d.ts +0 -28
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { c as EverfurResult, E as EverfurError } from './EverfurResult-DN9pL2Ab.cjs';
|
|
2
2
|
|
|
3
3
|
/** The closed set of frame discriminators. `unknown` is the forward-compat catch-all. */
|
|
4
4
|
type FrameKind = 'accepted' | 'heartbeat' | 'delta' | 'done' | 'error' | 'analysisStarted' | 'analysisComplete' | 'unknown';
|
|
@@ -49,20 +49,18 @@ interface DoneFrame extends FrameBase {
|
|
|
49
49
|
readonly conversationId: string;
|
|
50
50
|
readonly messageId: string | null;
|
|
51
51
|
/**
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
* `
|
|
52
|
+
* Populated on the CONSUMER chat plane, whose `_sse_done` writes it onto the done payload. On the
|
|
53
|
+
* `/widget/v1` partner plane, servers built on the shared turn pipeline (`widget_chat_turn_sse.py`) emit the
|
|
54
|
+
* legacy `{"metadata": true}` frame first and then ONE done carrying the available `title`,
|
|
55
|
+
* `follow_up_questions` and urgency. Older widget deployments sent a done without them and deferred
|
|
56
|
+
* `title` / urgency to a metadata frame AFTER done, so this field is null against those servers.
|
|
57
57
|
*
|
|
58
|
-
* The parse is deliberately kept:
|
|
59
|
-
*
|
|
58
|
+
* The parse is deliberately kept: the cross-language SSE conformance vectors pin it, and these are public
|
|
59
|
+
* fields a partner may already read via `handlers.onFrame`.
|
|
60
60
|
*
|
|
61
|
-
* Do NOT
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
* turn into a user-visible failure. If the widget plane needs urgency, the field belongs on the server's
|
|
65
|
-
* done payload, at the cost of re-serializing the 1-5s metadata generation ahead of it.
|
|
61
|
+
* Do NOT make `done` non-terminal to catch a trailing metadata frame from an older server. A turn with no
|
|
62
|
+
* title/urgency ends right after `done`, and this parser's EOF path would then synthesize a terminal
|
|
63
|
+
* `streamIncomplete` ERROR on every such turn, converting a working turn into a user-visible failure.
|
|
66
64
|
*/
|
|
67
65
|
readonly title: string | null;
|
|
68
66
|
/**
|
|
@@ -74,11 +72,19 @@ interface DoneFrame extends FrameBase {
|
|
|
74
72
|
readonly citationStatus: string | null;
|
|
75
73
|
/**
|
|
76
74
|
* null = slot present but empty; absent on non-urgency turns (folded to null here).
|
|
77
|
-
*
|
|
75
|
+
* Null against older `/widget/v1` servers, see `title`.
|
|
78
76
|
*/
|
|
79
77
|
readonly urgencyLevel: UrgencyLevel | null;
|
|
80
|
-
/**
|
|
78
|
+
/** Null against older `/widget/v1` servers, see `title`. */
|
|
81
79
|
readonly urgencyReason: string | null;
|
|
80
|
+
/**
|
|
81
|
+
* True when the wire CARRIED the `urgency_level` slot: a tier, or an explicit null. The server folds two
|
|
82
|
+
* different things to the same null here (`widget_chat_turn_sse.py` `_metadata`): a turn the classifier
|
|
83
|
+
* judged informational sends `urgency_level: null`, a turn it never classified omits the key. The consumer
|
|
84
|
+
* app reads the first as its calm "Good to know" state (`stream.ts` `extractUrgencyMetadata`), and only
|
|
85
|
+
* the second as "no urgency". A slot holding an unrecognised string counts as absent, as the app does.
|
|
86
|
+
*/
|
|
87
|
+
readonly urgencyProvided: boolean;
|
|
82
88
|
/** present on the terminal frame of an analyze stream. */
|
|
83
89
|
readonly resultId: string | null;
|
|
84
90
|
}
|
|
@@ -139,7 +145,10 @@ declare function assertNever(x: never): never;
|
|
|
139
145
|
declare function acceptedFrame(streamId: string | null, lastEventId: string | null, serverRequestId?: string | null): AcceptedFrame;
|
|
140
146
|
declare function heartbeatFrame(lastEventId: string | null, serverRequestId?: string | null): HeartbeatFrame;
|
|
141
147
|
declare function deltaFrame(delta: string, lastEventId: string | null, serverRequestId?: string | null): DeltaFrame;
|
|
142
|
-
declare function doneFrame(fields: Omit<DoneFrame, 'kind' | 'terminal' | 'serverRequestId'
|
|
148
|
+
declare function doneFrame(fields: Omit<DoneFrame, 'kind' | 'terminal' | 'serverRequestId' | 'urgencyProvided'> & {
|
|
149
|
+
/** Defaults to "a tier is present": a caller that builds a frame from a level never has to say so twice. */
|
|
150
|
+
readonly urgencyProvided?: boolean;
|
|
151
|
+
}, serverRequestId?: string | null): DoneFrame;
|
|
143
152
|
declare function errorFrame(fields: {
|
|
144
153
|
code: string;
|
|
145
154
|
retryable: boolean;
|
|
@@ -399,11 +408,33 @@ declare function getGlobalFetch(): FetchLike;
|
|
|
399
408
|
* Package semver, sent as X-Everfur-SDK-Version. MUST track package.json version (release checklist Item 12
|
|
400
409
|
* keeps the npm semver tag and this constant in lockstep). Set inside the SDK, never by partner code.
|
|
401
410
|
*/
|
|
402
|
-
declare const SDK_VERSION = "0.
|
|
403
|
-
/**
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
411
|
+
declare const SDK_VERSION = "0.3.0";
|
|
412
|
+
/**
|
|
413
|
+
* The platforms this package ships an entry point for, as the wire names them (X-Everfur-SDK-Platform).
|
|
414
|
+
*
|
|
415
|
+
* The server allow-lists the header and its logs and diagnostics read it, so a web build that reported
|
|
416
|
+
* `react-native` would read as a native app in every log line (and be mis-sorted the day the min-version
|
|
417
|
+
* gate keys on it). The value is decided by the FACADE that builds the runtime (rn or web), never by partner
|
|
418
|
+
* config: a partner cannot make a web page claim to be a phone.
|
|
419
|
+
*/
|
|
420
|
+
type SdkPlatform = 'react-native' | 'web';
|
|
421
|
+
/** Sent as X-Everfur-SDK-Platform when no facade names another. The RN facade is the historical default. */
|
|
422
|
+
declare const SDK_PLATFORM: SdkPlatform;
|
|
423
|
+
/**
|
|
424
|
+
* Dated wire contract axis (SPEC-00 §4.2). Override via config.contractVersion.
|
|
425
|
+
*
|
|
426
|
+
* 2026-09-19 is EFBackend's `PET_PROFILE_STRICT_CONTRACT` (widget_schemas.py, PF-05): from it, an unknown field in
|
|
427
|
+
* the partner pet body is a 400 rather than silently dropped. The SDK only ever sends named pet fields, so the strict
|
|
428
|
+
* answer can never meet an SDK call; a caller pinned to an older date keeps the one-release leniency and an
|
|
429
|
+
* `X-Everfur-Warning` header naming what was ignored. Where the min-version gate is armed, the platform's
|
|
430
|
+
* `PARTNER_SUPPORTED_CONTRACTS` must list this date.
|
|
431
|
+
*
|
|
432
|
+
* THE GRACE IS NOT A REJECTION, measured on the wire 2026-09-19: the warning names the ignored KEY and never its
|
|
433
|
+
* value, and the graced write still lands every field Everfur does know. So a caller on an older date must not
|
|
434
|
+
* treat the header as "my write did not apply" and re-send, or drop the rest of the body; the rest already
|
|
435
|
+
* landed. The SDK neither reads nor surfaces the header, because on this contract date it can never be sent.
|
|
436
|
+
*/
|
|
437
|
+
declare const DEFAULT_CONTRACT_VERSION = "2026-09-19";
|
|
407
438
|
/** The environment variable the base URL is derived from when config.apiBaseUrl is absent. */
|
|
408
439
|
declare const ENV_API_BASE_URL = "EVERFUR_API_BASE_URL";
|
|
409
440
|
interface EverfurConfig {
|
|
@@ -427,9 +458,16 @@ interface ResolvedClientConfig {
|
|
|
427
458
|
readonly apiBaseUrl: string;
|
|
428
459
|
readonly contractVersion: string;
|
|
429
460
|
readonly sdkVersion: string;
|
|
430
|
-
readonly platform:
|
|
461
|
+
readonly platform: SdkPlatform;
|
|
431
462
|
readonly debug: boolean;
|
|
432
463
|
}
|
|
464
|
+
/**
|
|
465
|
+
* What the FACADE knows and partner config must not decide. Threaded from the runtime factory into
|
|
466
|
+
* config resolution so `X-Everfur-SDK-Platform` names the entry point that actually built the runtime.
|
|
467
|
+
*/
|
|
468
|
+
interface ResolveClientConfigOptions {
|
|
469
|
+
readonly platform?: SdkPlatform;
|
|
470
|
+
}
|
|
433
471
|
/**
|
|
434
472
|
* CONFIG FAILURE IS A VALUE, NOT A THROW.
|
|
435
473
|
*
|
|
@@ -481,13 +519,13 @@ type BaseUrlOutcome = {
|
|
|
481
519
|
*/
|
|
482
520
|
declare function checkPublishableKey(raw: unknown): ClientConfigFailure | null;
|
|
483
521
|
/** Validate the partner-supplied config into the frozen client subset. Settles; never throws. */
|
|
484
|
-
declare function tryResolveClientConfig(config: EverfurConfig): ClientConfigOutcome;
|
|
522
|
+
declare function tryResolveClientConfig(config: EverfurConfig, options?: ResolveClientConfigOptions): ClientConfigOutcome;
|
|
485
523
|
/**
|
|
486
524
|
* Validate the partner-supplied config into the frozen client subset. Throws EverfurConfigError
|
|
487
525
|
* synchronously for programmer error (missing publishableKey, unresolvable/invalid base URL) -- never for
|
|
488
526
|
* network/domain failure. Prefer `tryResolveClientConfig` wherever a blank screen is the alternative.
|
|
489
527
|
*/
|
|
490
|
-
declare function resolveClientConfig(config: EverfurConfig): ResolvedClientConfig;
|
|
528
|
+
declare function resolveClientConfig(config: EverfurConfig, options?: ResolveClientConfigOptions): ResolvedClientConfig;
|
|
491
529
|
/**
|
|
492
530
|
* Resolve the base URL from (in order) an explicit value then EVERFUR_API_BASE_URL, then normalize.
|
|
493
531
|
* Settles; never throws. There is deliberately no hardcoded host default (INV-ORG-AGNOSTIC).
|
|
@@ -498,4 +536,4 @@ declare function resolveApiBaseUrl(apiBaseUrl?: string): string;
|
|
|
498
536
|
/** The always-on SDK protocol headers (version / platform / contract). Set inside the transport only. */
|
|
499
537
|
declare function buildBaseHeaders(cfg: Pick<ResolvedClientConfig, 'sdkVersion' | 'platform' | 'contractVersion'>): Record<string, string>;
|
|
500
538
|
|
|
501
|
-
export {
|
|
539
|
+
export { eventSourceByteSource as $, type AcceptedFrame as A, type ByteSource as B, type ClientConfigFailure as C, type DeltaFrame as D, type ErrorFrame as E, type Frame as F, type SdkPlatform as G, type HeartbeatFrame as H, type ServerRequestIdSource as I, type TransportDeps as J, acceptedFrame as K, analysisCompleteFrame as L, type MultipartBody as M, analysisStartedFrame as N, assertNever as O, bufferedTextByteSource as P, buildBaseHeaders as Q, type RawResponse as R, SDK_PLATFORM as S, type TransportPort as T, type UnknownFrame as U, checkPublishableKey as V, createHttpTransport as W, deltaFrame as X, doneFrame as Y, errorFrame as Z, errorFromResponse as _, type AnalysisCompleteFrame as a, eventSourceRequestId as a0, fetchByteSource as a1, getGlobalFetch as a2, heartbeatFrame as a3, networkError as a4, parseSse as a5, requestIdOf as a6, requestJson as a7, requestRaw as a8, resolveApiBaseUrl as a9, resolveClientConfig as aa, tryResolveApiBaseUrl as ab, tryResolveClientConfig as ac, unknownFrame as ad, type AnalysisStartedFrame as b, type DoneFrame as c, type EverfurRequest as d, type EverfurRequestBase as e, type FrameBase as f, type FrameKind as g, type HttpMethod as h, type UrgencyLevel as i, type FetchLike as j, type ClientConfigFailureReason as k, type ClientConfigOutcome as l, DEFAULT_CONTRACT_VERSION as m, EMPTY_FRAME_ARRAYS as n, ENV_API_BASE_URL as o, type EventSourceFactory as p, type EventSourceInit as q, type EventSourceLike as r, type EventSourceMessage as s, type EverfurConfig as t, type FetchInit as u, type FetchResponseLike as v, type ReadableStreamLike as w, type ResolveClientConfigOptions as x, type ResolvedClientConfig as y, SDK_VERSION as z };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { c as EverfurResult, E as EverfurError } from './EverfurResult-DN9pL2Ab.js';
|
|
2
2
|
|
|
3
3
|
/** The closed set of frame discriminators. `unknown` is the forward-compat catch-all. */
|
|
4
4
|
type FrameKind = 'accepted' | 'heartbeat' | 'delta' | 'done' | 'error' | 'analysisStarted' | 'analysisComplete' | 'unknown';
|
|
@@ -49,20 +49,18 @@ interface DoneFrame extends FrameBase {
|
|
|
49
49
|
readonly conversationId: string;
|
|
50
50
|
readonly messageId: string | null;
|
|
51
51
|
/**
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
* `
|
|
52
|
+
* Populated on the CONSUMER chat plane, whose `_sse_done` writes it onto the done payload. On the
|
|
53
|
+
* `/widget/v1` partner plane, servers built on the shared turn pipeline (`widget_chat_turn_sse.py`) emit the
|
|
54
|
+
* legacy `{"metadata": true}` frame first and then ONE done carrying the available `title`,
|
|
55
|
+
* `follow_up_questions` and urgency. Older widget deployments sent a done without them and deferred
|
|
56
|
+
* `title` / urgency to a metadata frame AFTER done, so this field is null against those servers.
|
|
57
57
|
*
|
|
58
|
-
* The parse is deliberately kept:
|
|
59
|
-
*
|
|
58
|
+
* The parse is deliberately kept: the cross-language SSE conformance vectors pin it, and these are public
|
|
59
|
+
* fields a partner may already read via `handlers.onFrame`.
|
|
60
60
|
*
|
|
61
|
-
* Do NOT
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
* turn into a user-visible failure. If the widget plane needs urgency, the field belongs on the server's
|
|
65
|
-
* done payload, at the cost of re-serializing the 1-5s metadata generation ahead of it.
|
|
61
|
+
* Do NOT make `done` non-terminal to catch a trailing metadata frame from an older server. A turn with no
|
|
62
|
+
* title/urgency ends right after `done`, and this parser's EOF path would then synthesize a terminal
|
|
63
|
+
* `streamIncomplete` ERROR on every such turn, converting a working turn into a user-visible failure.
|
|
66
64
|
*/
|
|
67
65
|
readonly title: string | null;
|
|
68
66
|
/**
|
|
@@ -74,11 +72,19 @@ interface DoneFrame extends FrameBase {
|
|
|
74
72
|
readonly citationStatus: string | null;
|
|
75
73
|
/**
|
|
76
74
|
* null = slot present but empty; absent on non-urgency turns (folded to null here).
|
|
77
|
-
*
|
|
75
|
+
* Null against older `/widget/v1` servers, see `title`.
|
|
78
76
|
*/
|
|
79
77
|
readonly urgencyLevel: UrgencyLevel | null;
|
|
80
|
-
/**
|
|
78
|
+
/** Null against older `/widget/v1` servers, see `title`. */
|
|
81
79
|
readonly urgencyReason: string | null;
|
|
80
|
+
/**
|
|
81
|
+
* True when the wire CARRIED the `urgency_level` slot: a tier, or an explicit null. The server folds two
|
|
82
|
+
* different things to the same null here (`widget_chat_turn_sse.py` `_metadata`): a turn the classifier
|
|
83
|
+
* judged informational sends `urgency_level: null`, a turn it never classified omits the key. The consumer
|
|
84
|
+
* app reads the first as its calm "Good to know" state (`stream.ts` `extractUrgencyMetadata`), and only
|
|
85
|
+
* the second as "no urgency". A slot holding an unrecognised string counts as absent, as the app does.
|
|
86
|
+
*/
|
|
87
|
+
readonly urgencyProvided: boolean;
|
|
82
88
|
/** present on the terminal frame of an analyze stream. */
|
|
83
89
|
readonly resultId: string | null;
|
|
84
90
|
}
|
|
@@ -139,7 +145,10 @@ declare function assertNever(x: never): never;
|
|
|
139
145
|
declare function acceptedFrame(streamId: string | null, lastEventId: string | null, serverRequestId?: string | null): AcceptedFrame;
|
|
140
146
|
declare function heartbeatFrame(lastEventId: string | null, serverRequestId?: string | null): HeartbeatFrame;
|
|
141
147
|
declare function deltaFrame(delta: string, lastEventId: string | null, serverRequestId?: string | null): DeltaFrame;
|
|
142
|
-
declare function doneFrame(fields: Omit<DoneFrame, 'kind' | 'terminal' | 'serverRequestId'
|
|
148
|
+
declare function doneFrame(fields: Omit<DoneFrame, 'kind' | 'terminal' | 'serverRequestId' | 'urgencyProvided'> & {
|
|
149
|
+
/** Defaults to "a tier is present": a caller that builds a frame from a level never has to say so twice. */
|
|
150
|
+
readonly urgencyProvided?: boolean;
|
|
151
|
+
}, serverRequestId?: string | null): DoneFrame;
|
|
143
152
|
declare function errorFrame(fields: {
|
|
144
153
|
code: string;
|
|
145
154
|
retryable: boolean;
|
|
@@ -399,11 +408,33 @@ declare function getGlobalFetch(): FetchLike;
|
|
|
399
408
|
* Package semver, sent as X-Everfur-SDK-Version. MUST track package.json version (release checklist Item 12
|
|
400
409
|
* keeps the npm semver tag and this constant in lockstep). Set inside the SDK, never by partner code.
|
|
401
410
|
*/
|
|
402
|
-
declare const SDK_VERSION = "0.
|
|
403
|
-
/**
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
411
|
+
declare const SDK_VERSION = "0.3.0";
|
|
412
|
+
/**
|
|
413
|
+
* The platforms this package ships an entry point for, as the wire names them (X-Everfur-SDK-Platform).
|
|
414
|
+
*
|
|
415
|
+
* The server allow-lists the header and its logs and diagnostics read it, so a web build that reported
|
|
416
|
+
* `react-native` would read as a native app in every log line (and be mis-sorted the day the min-version
|
|
417
|
+
* gate keys on it). The value is decided by the FACADE that builds the runtime (rn or web), never by partner
|
|
418
|
+
* config: a partner cannot make a web page claim to be a phone.
|
|
419
|
+
*/
|
|
420
|
+
type SdkPlatform = 'react-native' | 'web';
|
|
421
|
+
/** Sent as X-Everfur-SDK-Platform when no facade names another. The RN facade is the historical default. */
|
|
422
|
+
declare const SDK_PLATFORM: SdkPlatform;
|
|
423
|
+
/**
|
|
424
|
+
* Dated wire contract axis (SPEC-00 §4.2). Override via config.contractVersion.
|
|
425
|
+
*
|
|
426
|
+
* 2026-09-19 is EFBackend's `PET_PROFILE_STRICT_CONTRACT` (widget_schemas.py, PF-05): from it, an unknown field in
|
|
427
|
+
* the partner pet body is a 400 rather than silently dropped. The SDK only ever sends named pet fields, so the strict
|
|
428
|
+
* answer can never meet an SDK call; a caller pinned to an older date keeps the one-release leniency and an
|
|
429
|
+
* `X-Everfur-Warning` header naming what was ignored. Where the min-version gate is armed, the platform's
|
|
430
|
+
* `PARTNER_SUPPORTED_CONTRACTS` must list this date.
|
|
431
|
+
*
|
|
432
|
+
* THE GRACE IS NOT A REJECTION, measured on the wire 2026-09-19: the warning names the ignored KEY and never its
|
|
433
|
+
* value, and the graced write still lands every field Everfur does know. So a caller on an older date must not
|
|
434
|
+
* treat the header as "my write did not apply" and re-send, or drop the rest of the body; the rest already
|
|
435
|
+
* landed. The SDK neither reads nor surfaces the header, because on this contract date it can never be sent.
|
|
436
|
+
*/
|
|
437
|
+
declare const DEFAULT_CONTRACT_VERSION = "2026-09-19";
|
|
407
438
|
/** The environment variable the base URL is derived from when config.apiBaseUrl is absent. */
|
|
408
439
|
declare const ENV_API_BASE_URL = "EVERFUR_API_BASE_URL";
|
|
409
440
|
interface EverfurConfig {
|
|
@@ -427,9 +458,16 @@ interface ResolvedClientConfig {
|
|
|
427
458
|
readonly apiBaseUrl: string;
|
|
428
459
|
readonly contractVersion: string;
|
|
429
460
|
readonly sdkVersion: string;
|
|
430
|
-
readonly platform:
|
|
461
|
+
readonly platform: SdkPlatform;
|
|
431
462
|
readonly debug: boolean;
|
|
432
463
|
}
|
|
464
|
+
/**
|
|
465
|
+
* What the FACADE knows and partner config must not decide. Threaded from the runtime factory into
|
|
466
|
+
* config resolution so `X-Everfur-SDK-Platform` names the entry point that actually built the runtime.
|
|
467
|
+
*/
|
|
468
|
+
interface ResolveClientConfigOptions {
|
|
469
|
+
readonly platform?: SdkPlatform;
|
|
470
|
+
}
|
|
433
471
|
/**
|
|
434
472
|
* CONFIG FAILURE IS A VALUE, NOT A THROW.
|
|
435
473
|
*
|
|
@@ -481,13 +519,13 @@ type BaseUrlOutcome = {
|
|
|
481
519
|
*/
|
|
482
520
|
declare function checkPublishableKey(raw: unknown): ClientConfigFailure | null;
|
|
483
521
|
/** Validate the partner-supplied config into the frozen client subset. Settles; never throws. */
|
|
484
|
-
declare function tryResolveClientConfig(config: EverfurConfig): ClientConfigOutcome;
|
|
522
|
+
declare function tryResolveClientConfig(config: EverfurConfig, options?: ResolveClientConfigOptions): ClientConfigOutcome;
|
|
485
523
|
/**
|
|
486
524
|
* Validate the partner-supplied config into the frozen client subset. Throws EverfurConfigError
|
|
487
525
|
* synchronously for programmer error (missing publishableKey, unresolvable/invalid base URL) -- never for
|
|
488
526
|
* network/domain failure. Prefer `tryResolveClientConfig` wherever a blank screen is the alternative.
|
|
489
527
|
*/
|
|
490
|
-
declare function resolveClientConfig(config: EverfurConfig): ResolvedClientConfig;
|
|
528
|
+
declare function resolveClientConfig(config: EverfurConfig, options?: ResolveClientConfigOptions): ResolvedClientConfig;
|
|
491
529
|
/**
|
|
492
530
|
* Resolve the base URL from (in order) an explicit value then EVERFUR_API_BASE_URL, then normalize.
|
|
493
531
|
* Settles; never throws. There is deliberately no hardcoded host default (INV-ORG-AGNOSTIC).
|
|
@@ -498,4 +536,4 @@ declare function resolveApiBaseUrl(apiBaseUrl?: string): string;
|
|
|
498
536
|
/** The always-on SDK protocol headers (version / platform / contract). Set inside the transport only. */
|
|
499
537
|
declare function buildBaseHeaders(cfg: Pick<ResolvedClientConfig, 'sdkVersion' | 'platform' | 'contractVersion'>): Record<string, string>;
|
|
500
538
|
|
|
501
|
-
export {
|
|
539
|
+
export { eventSourceByteSource as $, type AcceptedFrame as A, type ByteSource as B, type ClientConfigFailure as C, type DeltaFrame as D, type ErrorFrame as E, type Frame as F, type SdkPlatform as G, type HeartbeatFrame as H, type ServerRequestIdSource as I, type TransportDeps as J, acceptedFrame as K, analysisCompleteFrame as L, type MultipartBody as M, analysisStartedFrame as N, assertNever as O, bufferedTextByteSource as P, buildBaseHeaders as Q, type RawResponse as R, SDK_PLATFORM as S, type TransportPort as T, type UnknownFrame as U, checkPublishableKey as V, createHttpTransport as W, deltaFrame as X, doneFrame as Y, errorFrame as Z, errorFromResponse as _, type AnalysisCompleteFrame as a, eventSourceRequestId as a0, fetchByteSource as a1, getGlobalFetch as a2, heartbeatFrame as a3, networkError as a4, parseSse as a5, requestIdOf as a6, requestJson as a7, requestRaw as a8, resolveApiBaseUrl as a9, resolveClientConfig as aa, tryResolveApiBaseUrl as ab, tryResolveClientConfig as ac, unknownFrame as ad, type AnalysisStartedFrame as b, type DoneFrame as c, type EverfurRequest as d, type EverfurRequestBase as e, type FrameBase as f, type FrameKind as g, type HttpMethod as h, type UrgencyLevel as i, type FetchLike as j, type ClientConfigFailureReason as k, type ClientConfigOutcome as l, DEFAULT_CONTRACT_VERSION as m, EMPTY_FRAME_ARRAYS as n, ENV_API_BASE_URL as o, type EventSourceFactory as p, type EventSourceInit as q, type EventSourceLike as r, type EventSourceMessage as s, type EverfurConfig as t, type FetchInit as u, type FetchResponseLike as v, type ReadableStreamLike as w, type ResolveClientConfigOptions as x, type ResolvedClientConfig as y, SDK_VERSION as z };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var react=require('react'),reactNative=require('react-native'),jsxRuntime=require('react/jsx-runtime');var ar=Object.defineProperty;var n=(e,r)=>ar(e,"name",{value:r,configurable:true});var ir=Object.freeze({regular:"regular",medium:"medium",bold:"bold",mono:"regular",monoMedium:"medium",monoBold:"bold"});function A(e,r){let t=e.type,o=t.families[r];return r==="mono"||t.namedFaces[r]?{fontFamily:o}:{fontFamily:o,fontWeight:t.weight[ir[r]]}}n(A,"face");var T=Object.freeze({loading:"Loading",retry:"Try again",signedOut:"Sign in required",changeable:"You can change this at any time.",saving:"Saving"}),G=Object.freeze({transcript_exposure:Object.freeze({title:"Conversation sharing",body:n(e=>`Let ${e} read the conversations you have with Everfur.`,"body")}),partner_context:Object.freeze({title:"Pet details",body:n(e=>`Let Everfur use the pet details ${e} already holds as background in your conversations.`,"body")})});function $(e,r){if(e.status==="signed_out")return {kind:"signedOut"};let t=e.scopes.find(o=>o.scope===r);return t===void 0?e.error!==null?{kind:"failed",error:e.error}:{kind:"loading"}:t.loaded?{kind:"row",scope:t.scope,granted:t.granted,hasDecision:t.hasDecision,saving:t.saving,error:t.error}:t.error!==null?{kind:"failed",error:t.error}:{kind:"loading"}}n($,"consentRowView");var Q=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(Q.map(e=>e.wireCode));var sr=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"}),ve=Object.freeze(Q.map(e=>Object.freeze({wireCode:e.wireCode,envelope:e.envelope,retryable:e.retryable,normalized:sr[e.wireCode]}))),lr=new Map(ve.map(e=>[e.envelope+e.wireCode.toUpperCase(),e])),ur=Object.freeze(["http_envelope",...[...new Set(ve.map(e=>e.envelope))].filter(e=>e!=="http_envelope").sort()]);function B(e,r){if(typeof e!="string")return;let t=e.trim().toUpperCase();if(t.length!==0)for(let o of [r??"http_envelope",...ur]){let a=lr.get(o+t);if(a)return a}}n(B,"contractErrorFor");function dr(e){return e.envelope==="sse_frame"?`/errors#sse-${e.wireCode}`:e.envelope==="oauth_error"?`/errors#oauth-${e.wireCode}`:`/errors#${e.wireCode}`}n(dr,"contractDocUrl");function Ee(e){return null}n(Ee,"publishedDocUrl");var cr=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 be(e){return cr[e]}n(be,"categoryFor");function ge(e){let r=B(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(ge,"fromWire");var pr=new Set(["streamTimeout","rateLimited","internalError","upstreamLlmTimeout","streamIncomplete"]);function X(e){return pr.has(e)}n(X,"isAutoRetryable");var fr=new Set(["serviceUnavailable","conflict","idempotencyInFlight"]);function he(e){return X(e)||fr.has(e)}n(he,"isRetryableCode");var yr=500,J=8e3,_e=4;function Ce(e,r=Math.random){let t=Math.max(0,e),o=Math.min(yr*2**t,J);return Math.floor(r()*o)}n(Ce,"backoffDelayMs");var mr=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 vr(e){return mr[e]}n(vr,"userFacingError");function Re(e,r,t){Object.defineProperty(e,r,{value:t,enumerable:false,writable:false,configurable:false});}n(Re,"defineHidden");var Er=/^[a-z][a-z0-9_]{0,63}$/;function S(e,r){let t=B(r?.wireCode,r?.wireEnvelope),o={code:e,category:be(e),retryable:r?.retryable??he(e),displayMessage:vr(e)};if(r?.httpStatus!==void 0&&(o.httpStatus=r.httpStatus),r?.requestId&&(o.requestId=r.requestId),typeof r?.reasonCode=="string"&&Er.test(r.reasonCode)&&(o.reasonCode=r.reasonCode),t);return r?.wireMessage&&Re(o,"wireMessage",r.wireMessage),r?.raw!==void 0&&r.raw!==null&&Re(o,"raw",r.raw),Object.freeze(o)}n(S,"makeEverfurError");function Z(e,r){return Object.freeze(r===void 0?{ok:true,value:e}:{ok:true,value:e,warning:r})}n(Z,"ok");function c(e){return Object.freeze({ok:false,error:e})}n(c,"err");var q=class q extends Error{constructor(r,t){super(t),this.name="EverfurConfigError",this.kind=r,Object.setPrototypeOf(this,q.prototype);}};n(q,"EverfurConfigError");var D=q;function Te(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(Te,"errorFrame");function hr(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(hr,"authHeaders");function N(e,r){return {...e,headers:{..._r(e.headers),...hr(r)}}}n(N,"withAuthHeaders");function _r(e){if(!e)return {};let r={};for(let[t,o]of Object.entries(e)){let a=t.toLowerCase();a==="authorization"||a==="x-everfur-partner-key"||(r[t]=o);}return r}n(_r,"stripAuthHeaders");async function Se(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 c(ee())}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 a;try{a=await r.identity.currentToken({forceRefresh:!0});}catch{return c(ee())}let l=await r.transport.request(N(e,{mode:"personalized",token:a,userRef:r.userRef,...r.sessionId?{sessionId:r.sessionId}:{}}));return !l.ok&&l.error.httpStatus===401?c(ee(l.error.httpStatus)):l}n(Se,"authedSend");function ee(e){return S("authRejected",{retryable:false,...e!==void 0?{httpStatus:e}:{}})}n(ee,"authRejectedError");function we(e){return S("internalError",{retryable:true,wireMessage:Cr(e)})}n(we,"networkError");function Cr(e){return e instanceof Error?e.message:typeof e=="string"?e:"network request failed"}n(Cr,"describeCause");var Rr=3e4,Tr=J*2,Sr="idempotency-key",wr=new Set(["POST","PUT","PATCH","DELETE"]),xr=Object.freeze({onEvent(){}}),Fr=Object.freeze({setTimeout:n((e,r)=>setTimeout(e,r),"setTimeout"),clearTimeout:n(e=>clearTimeout(e),"clearTimeout"),now:n(()=>Date.now(),"now")});function Fe(e){let r=e.observer??xr,t=e.timers??Fr,o=e.rng??Math.random,a=e.sleep??((m,u)=>Br(m,t,u)),l=e.maxAttempts??_e,i=e.unaryTimeoutMs??Rr,p=e.newIdempotencyKey??Or(),s=n(m=>{try{r.onEvent(m);}catch{}},"emit");async function y(m,u,v){let f=v?.maxAttempts,R=Math.max(1,f??l),h=v?.idempotent??wr.has(u.method)?p():null,d=kr(u,h),b=0;for(;;){let g=n(W=>Object.freeze({call:m,method:u.method,path:u.path,attempt:b,...h?{idempotencyKey:h}:{},...W}),"stamp");s(g({phase:"attempt"}));let k=Lr(i,t),j=Ur(k.signal,u.signal),O;try{O=await Se({...d,signal:j.signal},e.auth);}catch(W){O=c(we(W));}finally{j.dispose(),k.cancel();}if(O.ok)return s(g({phase:"settled",ok:true,reason:"ok"})),O;let w=O.error,U=Ir(w,b,{maxAttempts:R,rng:o,now:t.now(),aborted:u.signal?.aborted===true,...f!==void 0?{perCallMaxAttempts:f}:{},...e.errorPolicy!==void 0?{policy:e.errorPolicy}:{}}),K={ok:false,code:w.code,reason:U.reason,...w.httpStatus!==void 0?{httpStatus:w.httpStatus}:{},...w.requestId!==void 0?{requestId:w.requestId}:{}};if(!U.retry)return s(g({phase:"settled",...K})),c(w);if(s(g({phase:"retry",...K,delayMs:U.delayMs})),await a(U.delayMs,u.signal),u.signal?.aborted===true)return s(g({phase:"settled",...K,reason:"aborted"})),c(w);b+=1;}}n(y,"send");async function x(m){return N(m,await Mr(e.auth))}n(x,"authorize");async function*C(m,u,v){s(Object.freeze({call:m,phase:"stream.open",method:u.method,path:u.path,attempt:0}));try{yield*e.auth.transport.stream(u,v);}catch{yield Te({code:"internal_error",retryable:true,wireMessage:null,synthesized:true,lastEventId:null,serverRequestId:null});}}return n(C,"stream"),Object.freeze({send:y,authorize:x,stream:C})}n(Fe,"createRequestFunnel");function kr(e,r){let t={};for(let[o,a]of Object.entries(e.headers??{}))o.toLowerCase()!==Sr&&(t[o]=a);return r!==null&&(t["Idempotency-Key"]=r),{...e,headers:t}}n(kr,"assembleHeaders");function Or(){let e=0;return ()=>`efk_${Date.now().toString(36)}_${(e++).toString(36)}_${Math.random().toString(36).slice(2,12)}`}n(Or,"defaultIdempotencyKeyFactory");var Ar=10;function Ir(e,r,t){if(t.aborted)return {retry:false,reason:"aborted"};let o=Pr(e);if(o==="quota")return {retry:false,reason:"daily-quota-exhausted"};if(o!=="burst"&&!X(e.code))return {retry:false,reason:"terminal-code"};let a=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 i=n(()=>{if(t.policy===void 0)return null;let y;try{y=t.policy.maxAttempts(e.code);}catch{return null}return typeof y!="number"||!Number.isFinite(y)?null:Math.max(1,Math.min(Ar,Math.floor(y)))},"policyCeiling"),p=t.perCallMaxAttempts??i()??t.maxAttempts;if(r+1>=p)return {retry:false,reason:"attempts-exhausted"};let s=zr(e,t.now);return s!==null?s>Tr?{retry:false,reason:"server-reset-beyond-budget"}:{retry:true,reason:a,delayMs:s}:{retry:true,reason:a,delayMs:Ce(r,t.rng)}}n(Ir,"decideRetry");function Pr(e){let r=e.code==="unknown"?ge(Nr(e.raw)):e.code;return r==="quotaExceeded"?"quota":r==="rateLimited"||e.httpStatus===429?"burst":null}n(Pr,"throttleKind");function zr(e,r){let t=jr(e.raw);if(t===null)return null;let o=t-r;return o>0?o:0}n(zr,"retryOverrideMs");function jr(e){for(let r of ke(e)){let t=r.resets_at,o=Dr(t);if(o!==null)return o}return null}n(jr,"findResetsAt");function ke(e){if(!xe(e))return [];let r=[e];for(let t of ["error","detail"]){let o=e[t];xe(o)&&r.push(o);}return r}n(ke,"candidateScopes");function Dr(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(Dr,"parseInstantMs");function Nr(e){for(let r of ke(e)){let t=r.code;if(typeof t=="string"&&t.length>0)return t}return null}n(Nr,"rawWireCode");function xe(e){return typeof e=="object"&&e!==null}n(xe,"isRecord");async function Mr(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(Mr,"resolveDeviceAuth");function Lr(e,r){let t=new AbortController,o=r.setTimeout(()=>t.abort(),e);return {signal:t.signal,cancel:n(()=>r.clearTimeout(o),"cancel")}}n(Lr,"boundedSignal");function Ur(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 a=n(()=>o.abort(),"onAbort");return e.addEventListener("abort",a,{once:true}),r.addEventListener("abort",a,{once:true}),{signal:o.signal,dispose:n(()=>{e.removeEventListener("abort",a),r.removeEventListener("abort",a);},"dispose")}}n(Ur,"mergeSignals");function Br(e,r,t){return e<=0||t?.aborted===true?Promise.resolve():new Promise(o=>{let a=r.setTimeout(()=>{t?.removeEventListener("abort",l),o();},e),l=n(()=>{r.clearTimeout(a),o();},"onAbort");t?.addEventListener("abort",l,{once:true});})}n(Br,"delayAbortable");var Oe="/widget/v1/consent",M=Object.freeze(["transcript_exposure","partner_context"]),Ae="records_content",te=64,qr=new Set(M);function V(e){return typeof e=="string"&&qr.has(e)}n(V,"isEverfurConsentScope");function z(e){return S("validationFailed",{retryable:false,wireMessage:e})}n(z,"invalid");function je(e){return V(e)?null:z(e===Ae?`'${Ae}' is not recorded here: the records release a member grants and revokes is PUT and DELETE /widget/v1/records/pets/{pet_ref}/consent, which the records surface wires and which also kills the pet's live share links on a revoke. A row on the scoped ledger would not gate any read.`:`scope must be one of ${M.join(", ")}`)}n(je,"validateScope");function Vr(e){if(typeof e!="object"||e===null)return z("write needs a decision object");let{scope:r,granted:t,consentVersion:o}=e,a=je(r);return a!==null?a:typeof t!="boolean"?z("granted must be true to grant or false to withdraw"):o!==void 0&&(typeof o!="string"||o.length===0||o.length>te)?z(`consentVersion must be 1..${te} characters`):null}n(Vr,"validateDecision");var re=n(e=>typeof e=="string"&&e.length>0?e:null,"str");function Ie(e,r){if(typeof e!="object"||e===null)return null;let t=e;return typeof t.granted!="boolean"||typeof t.has_decision!="boolean"?null:Object.freeze({scope:r,granted:t.granted,hasDecision:t.has_decision,consentVersion:re(t.consent_version),actor:re(t.actor),recordedAt:re(t.recorded_at)})}n(Ie,"verdictFromWire");function Pe(e){return S("internalError",{retryable:false,httpStatus:502,wireMessage:`${e}: the response carried no granted/has_decision pair`})}n(Pe,"malformed");function ze(e){return z(`the Everfur runtime is disposed; ${e} was called after unmount`)}n(ze,"disposed");function ne(e){let r=n(()=>{let{services:t}=e.registry;return De({auth:t.authFor(null),...t.errorPolicy?{errorPolicy:t.errorPolicy}:{}})},"over");return {read:n((t,o)=>e.isDisposed?Promise.resolve(c(ze("read"))):r().read(t,o),"read"),write:n((t,o)=>e.isDisposed?Promise.resolve(c(ze("write"))):r().write(t,o),"write")}}n(ne,"createConsentRepository");function De(e){let r=e.funnel??Fe({auth:e.auth,...e.errorPolicy?{errorPolicy:e.errorPolicy}:{}}),t=n((o,a)=>a?{...o,signal:a}:o,"withSignal");return {async read(o,a){let l=je(o);if(l!==null)return c(l);let i=await r.send("consent.read",t({method:"GET",path:Oe,query:{scope:o}},a?.signal));if(!i.ok)return c(i.error);let p=Ie(i.value,o);return p===null?c(Pe("consent.read")):Z(p)},async write(o,a){let l=Vr(o);if(l!==null)return c(l);let i={scope:o.scope,granted:o.granted};o.consentVersion!==void 0&&(i.consent_version=o.consentVersion);let p=await r.send("consent.write",t({method:"PUT",path:Oe,body:i},a?.signal));if(!p.ok)return c(p.error);let s=Ie(p.value,o.scope);return s===null?c(Pe("consent.write")):Z(s)}}}n(De,"createConsentRepositoryOver");var Ne=Symbol.for("@everfur/sdk#EverfurContext@v1"),Me=globalThis,Le=Me[Ne]??(Me[Ne]=react.createContext(null));Le.displayName??="EverfurContext";function oe(){let e=react.useContext(Le);if(e===null)throw new D("not-initialized","Everfur hooks must be called inside <EverfurProvider>. Wrap your tree once, high.");return e}n(oe,"useEverfurContext");function ie(e,r){return Object.freeze({scope:e,granted:false,hasDecision:false,consentVersion:null,recordedAt:null,loaded:false,saving:false,error:r})}n(ie,"blank");function Be(e){return Object.freeze({scope:e.scope,granted:e.granted,hasDecision:e.hasDecision,consentVersion:e.consentVersion,recordedAt:e.recordedAt,loaded:true,saving:false,error:null})}n(Be,"settled");function Gr(){return S("sessionRequired",{retryable:false,wireMessage:"a consent decision is authored by the member; sign a user in on the provider first"})}n(Gr,"noMember");function qe(){let{runtime:e}=oe();return react.useMemo(()=>ne(e),[e])}n(qe,"useEverfurConsentRepository");function le(e){let{userRef:r}=oe(),t=qe(),o=(e?.scopes??[]).filter(V).join(","),a=react.useMemo(()=>{let v=o.length===0?[]:o.split(",");return v.length===0?M:Object.freeze(v)},[o]),[l,i]=react.useState(r===null?"signed_out":"loading"),[p,s]=react.useState([]),[y,x]=react.useState(null),C=react.useRef(0),m=react.useCallback(async()=>{if(r===null){C.current+=1,i("signed_out"),s([]),x(null);return}let v=C.current+=1;i("loading"),x(null);let f=await Promise.all(a.map(d=>t.read(d)));if(v!==C.current)return;let R=f.map((d,b)=>{let g=a[b];return d.ok?Be(d.value):ie(g,d.error)}),F=f.find(d=>!d.ok),h=f.every(d=>!d.ok);s(Object.freeze(R)),i(h?"failed":"ready"),x(h&&F!==void 0&&!F.ok?F.error:null);},[t,a,r]);react.useEffect(()=>{m();},[m]);let u=react.useCallback(async(v,f)=>{if(r===null)return c(Gr());let R=C.current,F=null;s(d=>{let b=d.findIndex(O=>O.scope===v),g=b===-1?ie(v,null):d[b];F=g;let k=Object.freeze({...g,granted:f,hasDecision:true,saving:true,error:null});if(b===-1)return Object.freeze([...d,k]);let j=[...d];return j[b]=k,Object.freeze(j)});let h=await t.write({scope:v,granted:f});return R!==C.current||s(d=>{let b=d.findIndex(k=>k.scope===v);if(b===-1)return d;let g=[...d];return g[b]=h.ok?Be(h.value):Object.freeze({...F??ie(v,null),saving:false,error:h.error}),Object.freeze(g)}),h},[t,r]);return react.useMemo(()=>({status:l,scopes:p,error:y,setConsent:u,refresh:m}),[l,p,y,u,m])}n(le,"useEverfurConsent");function Ve(e){let r=globalThis.console;try{r?.error?.("[everfur] A host callback threw; the SDK ignored it.",e);}catch{}}n(Ve,"reportHostFailure");function $r(e){return (typeof e=="object"||typeof e=="function")&&e!==null&&typeof e.then=="function"}n($r,"isThenable");function Qr(e,...r){if(typeof e=="function")try{let t=e(...r);return $r(t)&&Promise.resolve(t).then(void 0,Ve),t}catch(t){Ve(t);return}}n(Qr,"callHost");var He=new WeakMap;function Xr(e){if(typeof e!="function")return;let r=He.get(e);if(r!==void 0)return r;let t=n((...o)=>{Qr(e,...o);},"guarded");return He.set(e,t),t}n(Xr,"guardHost");function Ye(e,r){let t=null;for(let o of r){let a=e[o];typeof a=="function"&&(t??={...e},t[o]=Xr(a));}return t??e}n(Ye,"guardHostProps");var de=class de extends react.Component{constructor(){super(...arguments);this.state={failed:false,key:this.props.resetKey};}static getDerivedStateFromError(){return {failed:true}}static getDerivedStateFromProps(t,o){return Object.is(t.resetKey,o.key)?null:{failed:false,key:t.resetKey}}render(){return this.state.failed?this.props.fallback:this.props.children}};n(de,"HostRenderBoundary");var ue=de;function Zr({render:e}){return e()}n(Zr,"RenderHost");function We({render:e,fallback:r,resetKey:t}){return react.createElement(ue,{fallback:r,resetKey:t,children:react.createElement(Zr,{render:e})})}n(We,"HostRender");function fe(e){if(e!==null&&typeof e=="object"&&!Object.isFrozen(e)){Object.freeze(e);for(let r of Object.keys(e))fe(e[r]);}return e}n(fe,"deepFreeze");var et=Object.freeze({content:0,heading:2,control:1.8,compact:1.5,badge:1.3}),$e={xs:4,sm:8,md:12,lg:16,xl:24,xxl:32},Qe={tile:5,xs:6,sm:10,md:14,lg:20,xl:28,pill:500},Ge={nano:8,small:9,micro:10,tiny:11,caption:12,bodyTight:13,body:14,subtitle:16,heading:18,verdict:24},rt={tight:1.15,snug:1.3,normal:1.4,relaxed:1.55},tt={regular:"400",medium:"500",bold:"700"},nt={eyebrow:1,monoWide:.9,headerBrand:-0.42,tight:-0.35},ot=0,H="System",Y="monospace",at=["content","heading","control","compact","badge"];function it(e){let r={};for(let t of at)r[t]=e;return r}n(it,"authoredTierSizes");function Xe(){return {family:H,mono:Y,fontUrl:null,families:{regular:H,medium:H,bold:H,mono:Y,monoMedium:Y,monoBold:Y},namedFaces:{regular:false,medium:false,bold:false,mono:false,monoMedium:false,monoBold:false},fontUrls:{},size:Ge,tierSizes:it(Ge),lineHeight:rt,weight:tt,letterSpacing:nt,scale:1,maxScale:ot,scaleCaps:et}}n(Xe,"baseType");var Je={},ce=Object.freeze({standard:Object.freeze([.2,0,0,1]),emphasized:Object.freeze([.2,.8,.2,1]),exit:Object.freeze([.4,0,1,1])});function pe(e){return `cubic-bezier(${e.join(", ")})`}n(pe,"cssCubicBezier");var Ze={duration:{instant:80,fast:140,normal:220,slow:320},spring:{gentle:{damping:18,stiffness:200}},easing:{standard:pe(ce.standard),emphasized:pe(ce.emphasized),exit:pe(ce.exit)},reducedMotion:false},st={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)"},er=fe({brightness:"light",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false},color:st,space:$e,radius:Qe,type:Xe(),motion:Ze,slots:Je}),lt={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)"};fe({brightness:"dark",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false},color:lt,space:$e,radius:Qe,type:Xe(),motion:Ze,slots:Je});var rr=Symbol.for("@everfur/sdk#EverfurThemeContext@v1"),tr=globalThis,ye=tr[rr]??(tr[rr]=react.createContext(er));ye.displayName??="EverfurThemeContext";function L(){return react.useContext(ye)}n(L,"useEverfurTheme");function yt(e,r){let t=e.scaleCaps[r];return t>0?t:void 0}n(yt,"tierMultiplier");function _({tier:e="content",...r}){let{type:t}=L(),o=yt(t,e);return react.createElement(reactNative.Text,o===void 0?r:{maxFontSizeMultiplier:o,...r})}n(_,"Text");react.forwardRef(n(function(r,t){return react.createElement(reactNative.TextInput,{...r,...t===null?{}:{ref:t}})},"TextInput"));function ht(e){let{scope:r,onChange:t,renderNotice:o,style:a}=Ye(e,["onChange"]),l=L(),i=react.useMemo(()=>_t(l),[l]),p=le({scopes:[r]}),s=$(p,r),y=G[r],[x,C]=react.useState(null),m=react.useCallback(async f=>{C(f);let R=await p.setConsent(r,f);R.ok&&(C(null),t?.(R.value.granted));},[p,t,r]),u=n((f,R)=>jsxRuntime.jsxs(reactNative.View,{style:i.notice,children:[jsxRuntime.jsx(We,{resetKey:f,render:()=>o?o(f):jsxRuntime.jsx(_,{style:i.noticeText,children:f.displayMessage}),fallback:jsxRuntime.jsx(_,{style:i.noticeText,children:f.displayMessage})}),jsxRuntime.jsx(reactNative.Pressable,{onPress:R,accessibilityRole:"button",accessibilityLabel:T.retry,style:i.retry,children:jsxRuntime.jsx(_,{tier:"control",style:i.retryLabel,children:T.retry})})]}),"notice");if(s.kind==="signedOut")return jsxRuntime.jsxs(reactNative.View,{style:[i.container,a],accessible:true,accessibilityRole:"text",accessibilityLabel:T.signedOut,children:[jsxRuntime.jsx(_,{style:i.title,children:y.title}),jsxRuntime.jsx(_,{style:i.body,children:T.signedOut})]});if(s.kind==="loading")return jsxRuntime.jsxs(reactNative.View,{style:[i.container,a],accessible:true,accessibilityRole:"progressbar",accessibilityLabel:T.loading,children:[jsxRuntime.jsx(_,{style:i.title,children:y.title}),jsxRuntime.jsx(reactNative.ActivityIndicator,{color:l.color.brandInk})]});if(s.kind==="failed")return jsxRuntime.jsxs(reactNative.View,{style:[i.container,a],children:[jsxRuntime.jsx(_,{style:i.title,children:y.title}),u(s.error,()=>{p.refresh();})]});let v=`${y.title}. ${y.body(l.meta.displayName)}`;return jsxRuntime.jsxs(reactNative.View,{style:[i.container,a],children:[jsxRuntime.jsxs(reactNative.Pressable,{onPress:()=>{s.saving||m(!s.granted);},disabled:s.saving,accessibilityRole:"checkbox",accessibilityState:{checked:s.granted,disabled:s.saving},accessibilityLabel:v,accessibilityHint:s.saving?T.saving:void 0,hitSlop:{top:6,bottom:6,left:6,right:6},style:[i.row,s.granted?i.rowChecked:null],children:[jsxRuntime.jsx(reactNative.View,{style:[i.box,s.granted?i.boxChecked:null],accessibilityElementsHidden:true,importantForAccessibility:"no",children:s.granted?jsxRuntime.jsx(_,{style:i.tick,children:"\u2713"}):null}),jsxRuntime.jsxs(reactNative.View,{style:i.copy,children:[jsxRuntime.jsx(_,{style:i.title,children:y.title}),jsxRuntime.jsx(_,{style:i.body,children:y.body(l.meta.displayName)}),jsxRuntime.jsx(_,{style:i.footnote,children:T.changeable})]})]}),s.error===null?null:u(s.error,()=>{m(x??!s.granted);})]})}n(ht,"EverfurConsentToggle");function _t(e){let{color:r,radius:t,space:o,type:a}=e;return reactNative.StyleSheet.create({container:{gap:o.sm,paddingHorizontal:o.lg,paddingVertical:o.md},row:{flexDirection:"row",alignItems:"flex-start",gap:o.md,borderRadius:t.md,borderWidth:1,borderColor:r.brandBorder,backgroundColor:r.surface,paddingHorizontal:o.lg,paddingVertical:o.lg},rowChecked:{borderColor:r.brand,backgroundColor:r.brandSoft},box:{width:24,height:24,borderRadius:t.xs,borderWidth:1,borderColor:r.brandBorder,backgroundColor:r.surface,alignItems:"center",justifyContent:"center"},boxChecked:{borderColor:r.brand,backgroundColor:r.brand},tick:{...A(e,"bold"),fontSize:a.size.caption,color:r.text.onBrand},copy:{flex:1,gap:o.xs},title:{...A(e,"bold"),fontSize:a.size.body,lineHeight:Math.round(a.size.body*a.lineHeight.snug),color:r.text.primary},body:{...A(e,"regular"),fontSize:a.size.caption,lineHeight:Math.round(a.size.caption*a.lineHeight.snug),color:r.text.secondary},footnote:{...A(e,"regular"),fontSize:a.size.caption,lineHeight:Math.round(a.size.caption*a.lineHeight.snug),color:r.text.muted},notice:{gap:o.xs,paddingTop:o.xs},noticeText:{...A(e,"regular"),fontSize:a.size.caption,lineHeight:Math.round(a.size.caption*a.lineHeight.snug),color:r.errorRed},retry:{alignSelf:"flex-start",minHeight:44,justifyContent:"center"},retryLabel:{...A(e,"bold"),fontSize:a.size.caption,color:r.linkInk}})}n(_t,"makeStyles");exports.CONSENT_COPY=T;exports.CONSENT_SCOPE_COPY=G;exports.CONSENT_VERSION_MAX=te;exports.EVERFUR_CONSENT_SCOPES=M;exports.EverfurConsentToggle=ht;exports.consentRowView=$;exports.createConsentRepository=ne;exports.createConsentRepositoryOver=De;exports.isEverfurConsentScope=V;exports.useEverfurConsent=le;exports.useEverfurConsentRepository=qe;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { StyleProp, ViewStyle } from 'react-native';
|
|
3
|
+
import { E as EverfurConsentScope } from '../copy-bKDNigLb.cjs';
|
|
4
|
+
export { C as CONSENT_COPY, a as CONSENT_SCOPE_COPY, b as CONSENT_VERSION_MAX, c as ConsentRepository, d as ConsentRepositoryDeps, e as ConsentRowView, f as ConsentRuntime, g as ConsentScopeCopy, h as EVERFUR_CONSENT_SCOPES, i as EverfurConsentDecision, j as EverfurConsentOptions, k as EverfurConsentScopeState, l as EverfurConsentState, m as EverfurConsentStatus, n as EverfurConsentVerdict, o as consentRowView, p as createConsentRepository, q as createConsentRepositoryOver, r as isEverfurConsentScope, u as useEverfurConsent, s as useEverfurConsentRepository } from '../copy-bKDNigLb.cjs';
|
|
5
|
+
import { E as EverfurError } from '../EverfurResult-DN9pL2Ab.cjs';
|
|
6
|
+
export { a as EverfurErrorCategory, b as EverfurErrorCode, c as EverfurResult } from '../EverfurResult-DN9pL2Ab.cjs';
|
|
7
|
+
export { A as AuthContext, I as IdentityProvider, M as MintedToken, T as TokenProvider } from '../identity-DI4eVx9S.cjs';
|
|
8
|
+
export { A as AcceptedFrame, a as AnalysisCompleteFrame, b as AnalysisStartedFrame, D as DeltaFrame, c as DoneFrame, E as ErrorFrame, d as EverfurRequest, e as EverfurRequestBase, F as Frame, f as FrameBase, g as FrameKind, H as HeartbeatFrame, h as HttpMethod, M as MultipartBody, T as TransportPort, U as UnknownFrame, i as UrgencyLevel } from '../config-CzTZGlfF.cjs';
|
|
9
|
+
export { B as Brand, C as ConversationId, P as PetRef, R as RecordsRequestId, U as UserRef, _ as __brand } from '../ids-B2GAAifq.cjs';
|
|
10
|
+
export { E as ErrorPolicyPort } from '../ErrorPolicyPort-CNf4uQZP.cjs';
|
|
11
|
+
import '../requestFunnel-L-BQfi0z.cjs';
|
|
12
|
+
|
|
13
|
+
interface EverfurConsentToggleProps {
|
|
14
|
+
/** Which act this row is. One row is one act; two acts are two rows, never one switch. */
|
|
15
|
+
readonly scope: EverfurConsentScope;
|
|
16
|
+
/**
|
|
17
|
+
* Called with the settled answer after a decision lands, so a host can react (close a sheet, log its own
|
|
18
|
+
* analytics). A throw from it is swallowed by the SDK's host-callback guard and never reaches your tree.
|
|
19
|
+
*/
|
|
20
|
+
readonly onChange?: (granted: boolean) => void;
|
|
21
|
+
/**
|
|
22
|
+
* Your own wording for a refusal, in place of the SDK's line. It runs inside the SDK's error boundary; a
|
|
23
|
+
* throw falls back to the SDK's own text. The RETRY control is always the SDK's, so replacing the wording
|
|
24
|
+
* can never remove the way out.
|
|
25
|
+
*/
|
|
26
|
+
readonly renderNotice?: (error: EverfurError) => ReactNode;
|
|
27
|
+
/** Layout tokens only (spacing / surface). */
|
|
28
|
+
readonly style?: StyleProp<ViewStyle>;
|
|
29
|
+
}
|
|
30
|
+
/** One consent act the member can read and change, on the React Native band. */
|
|
31
|
+
declare function EverfurConsentToggle(props: EverfurConsentToggleProps): ReactNode;
|
|
32
|
+
|
|
33
|
+
export { EverfurConsentScope, EverfurConsentToggle, type EverfurConsentToggleProps, EverfurError };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { StyleProp, ViewStyle } from 'react-native';
|
|
3
|
+
import { E as EverfurConsentScope } from '../copy-Mjoo91aS.js';
|
|
4
|
+
export { C as CONSENT_COPY, a as CONSENT_SCOPE_COPY, b as CONSENT_VERSION_MAX, c as ConsentRepository, d as ConsentRepositoryDeps, e as ConsentRowView, f as ConsentRuntime, g as ConsentScopeCopy, h as EVERFUR_CONSENT_SCOPES, i as EverfurConsentDecision, j as EverfurConsentOptions, k as EverfurConsentScopeState, l as EverfurConsentState, m as EverfurConsentStatus, n as EverfurConsentVerdict, o as consentRowView, p as createConsentRepository, q as createConsentRepositoryOver, r as isEverfurConsentScope, u as useEverfurConsent, s as useEverfurConsentRepository } from '../copy-Mjoo91aS.js';
|
|
5
|
+
import { E as EverfurError } from '../EverfurResult-DN9pL2Ab.js';
|
|
6
|
+
export { a as EverfurErrorCategory, b as EverfurErrorCode, c as EverfurResult } from '../EverfurResult-DN9pL2Ab.js';
|
|
7
|
+
export { A as AuthContext, I as IdentityProvider, M as MintedToken, T as TokenProvider } from '../identity-BMx2SUOM.js';
|
|
8
|
+
export { A as AcceptedFrame, a as AnalysisCompleteFrame, b as AnalysisStartedFrame, D as DeltaFrame, c as DoneFrame, E as ErrorFrame, d as EverfurRequest, e as EverfurRequestBase, F as Frame, f as FrameBase, g as FrameKind, H as HeartbeatFrame, h as HttpMethod, M as MultipartBody, T as TransportPort, U as UnknownFrame, i as UrgencyLevel } from '../config-DW60uRb9.js';
|
|
9
|
+
export { B as Brand, C as ConversationId, P as PetRef, R as RecordsRequestId, U as UserRef, _ as __brand } from '../ids-B2GAAifq.js';
|
|
10
|
+
export { E as ErrorPolicyPort } from '../ErrorPolicyPort-CwbfmxzJ.js';
|
|
11
|
+
import '../requestFunnel-CjW7uDuA.js';
|
|
12
|
+
|
|
13
|
+
interface EverfurConsentToggleProps {
|
|
14
|
+
/** Which act this row is. One row is one act; two acts are two rows, never one switch. */
|
|
15
|
+
readonly scope: EverfurConsentScope;
|
|
16
|
+
/**
|
|
17
|
+
* Called with the settled answer after a decision lands, so a host can react (close a sheet, log its own
|
|
18
|
+
* analytics). A throw from it is swallowed by the SDK's host-callback guard and never reaches your tree.
|
|
19
|
+
*/
|
|
20
|
+
readonly onChange?: (granted: boolean) => void;
|
|
21
|
+
/**
|
|
22
|
+
* Your own wording for a refusal, in place of the SDK's line. It runs inside the SDK's error boundary; a
|
|
23
|
+
* throw falls back to the SDK's own text. The RETRY control is always the SDK's, so replacing the wording
|
|
24
|
+
* can never remove the way out.
|
|
25
|
+
*/
|
|
26
|
+
readonly renderNotice?: (error: EverfurError) => ReactNode;
|
|
27
|
+
/** Layout tokens only (spacing / surface). */
|
|
28
|
+
readonly style?: StyleProp<ViewStyle>;
|
|
29
|
+
}
|
|
30
|
+
/** One consent act the member can read and change, on the React Native band. */
|
|
31
|
+
declare function EverfurConsentToggle(props: EverfurConsentToggleProps): ReactNode;
|
|
32
|
+
|
|
33
|
+
export { EverfurConsentScope, EverfurConsentToggle, type EverfurConsentToggleProps, EverfurError };
|