@everfur/sdk 0.14.0 → 0.15.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 +80 -0
- package/dist/{Chat.d-aycmX1CA.d.cts → Chat.d-CtfANk3A.d.cts} +3 -3
- package/dist/{Chat.d-puminpyi.d.ts → Chat.d-a7Ksz7NZ.d.ts} +3 -3
- package/dist/{DepthViews.d-BdvFZgPs.d.cts → DepthViews.d-BqMnWSMu.d.cts} +1 -1
- package/dist/{DepthViews.d-Dy0Zl-s-.d.ts → DepthViews.d-CuBElgEc.d.ts} +1 -1
- package/dist/{DepthViews.d-DIvxzLDf.d.ts → DepthViews.d-DbJejGm3.d.ts} +1 -1
- package/dist/{DepthViews.d-wLNkzk9f.d.cts → DepthViews.d-dXWL6ToG.d.cts} +1 -1
- package/dist/{RecordsPage.d-9Ank15PT.d.ts → RecordsPage.d-DKrZ9rHX.d.ts} +1 -1
- package/dist/{RecordsPage.d-DMKU0IKc.d.cts → RecordsPage.d-DRPdUAo4.d.cts} +1 -1
- package/dist/animations/index.cjs +1 -1
- package/dist/animations/index.d.cts +5 -3
- package/dist/animations/index.d.ts +5 -3
- package/dist/animations/index.js +1 -1
- package/dist/{attachments.d-rp3xs-Q3.d.ts → attachments.d-BGn2_knv.d.ts} +5 -5
- package/dist/{attachments.d--sIsfk6e.d.ts → attachments.d-CoQhXrP9.d.ts} +2 -2
- package/dist/{attachments.d-DNUCiyy5.d.cts → attachments.d-CpaOfi2g.d.cts} +5 -5
- package/dist/{attachments.d-ZEpTUeWN.d.cts → attachments.d-CqHMGoER.d.cts} +2 -2
- package/dist/{bookingCopy.d-DUrmVcLs.d.cts → bookingCopy.d-Bnq2zk0F.d.cts} +2 -2
- package/dist/{bookingCopy.d-D0uIIFAJ.d.ts → bookingCopy.d-BwCOCZUj.d.ts} +2 -2
- package/dist/{branding.d-CTXTUg_8.d.cts → branding.d-Bbc6p1XY.d.cts} +1 -1
- package/dist/{branding.d-DxJSoFce.d.ts → branding.d-y6c0UwhE.d.ts} +1 -1
- package/dist/{casesRepository.d-DCnix2pT.d.cts → casesRepository.d-CsUJ2Oyb.d.cts} +1 -1
- package/dist/{casesRepository.d-DbirgbyH.d.ts → casesRepository.d-DG83Ggbq.d.ts} +1 -1
- package/dist/chat/index.cjs +3 -3
- package/dist/chat/index.d.cts +9 -9
- package/dist/chat/index.d.ts +9 -9
- package/dist/chat/index.js +3 -3
- package/dist/client/index.cjs +3 -3
- package/dist/client/index.d.cts +10 -10
- package/dist/client/index.d.ts +10 -10
- package/dist/client/index.js +3 -3
- package/dist/{clinicBatch.d-Ccmrngcu.d.cts → clinicBatch.d-BLpbpS51.d.cts} +2 -2
- package/dist/{clinicBatch.d-D9Ci7IpP.d.ts → clinicBatch.d-Byjx4y_W.d.ts} +2 -2
- package/dist/{config.d-DJ4mvf_w.d.cts → config.d-C0WgjutL.d.cts} +1 -1
- package/dist/{config.d-MX7IKP2f.d.ts → config.d-zd2eTb2L.d.ts} +1 -1
- package/dist/consent/index.d.cts +5 -5
- package/dist/consent/index.d.ts +5 -5
- package/dist/{context.d-BdnBe8Oe.d.ts → context.d-BBjmV0rz.d.ts} +7 -7
- package/dist/{context.d-C6MJsMpN.d.cts → context.d-Du_UPxa1.d.cts} +7 -7
- package/dist/{copy.d-BIfQOoDB.d.ts → copy.d-D_VVj01o.d.ts} +2 -2
- package/dist/{copy.d-C_u7shha.d.cts → copy.d-Da_PP2K3.d.cts} +2 -2
- package/dist/core/index.cjs +2 -2
- package/dist/core/index.d.cts +16 -16
- package/dist/core/index.d.ts +16 -16
- package/dist/core/index.js +2 -2
- package/dist/{depth.d-COFxYWLU.d.ts → depth.d-BEedifOR.d.ts} +2 -2
- package/dist/{depth.d-D2e5WZuE.d.cts → depth.d-RTV61QNf.d.cts} +2 -2
- package/dist/{entitlementRepository.d-DLuxnGi5.d.ts → entitlementRepository.d-BwThmh3V.d.ts} +3 -3
- package/dist/{entitlementRepository.d-BP15dFbe.d.cts → entitlementRepository.d-C-stdRyA.d.cts} +3 -3
- package/dist/{focus.d-C0Tr0oVJ.d.ts → focus.d-CtotIyEt.d.ts} +20 -4
- package/dist/{focus.d-jQWp0hdK.d.cts → focus.d-Dsm39DjO.d.cts} +20 -4
- package/dist/health-plan/index.cjs +46 -41
- package/dist/health-plan/index.d.cts +8 -8
- package/dist/health-plan/index.d.ts +8 -8
- package/dist/health-plan/index.js +47 -42
- package/dist/{idempotency.d-DXb1BN2A.d.ts → idempotency.d-Bfm7oIxS.d.cts} +8 -1
- package/dist/{idempotency.d-HF6fyRt2.d.cts → idempotency.d-Cv-B7SfC.d.ts} +8 -1
- package/dist/{identity.d-BePPZ7Uv.d.ts → identity.d-BksOEa6m.d.ts} +1 -1
- package/dist/{identity.d-CJfnWOdH.d.cts → identity.d-CioQhZrq.d.cts} +1 -1
- package/dist/index.cjs +6 -6
- package/dist/index.d.cts +16 -16
- package/dist/index.d.ts +16 -16
- package/dist/index.js +6 -6
- package/dist/{introEvents.d-BkGDT_kG.d.cts → introEvents.d-fAZitxMA.d.cts} +1 -1
- package/dist/{introEvents.d-DHlMvmC7.d.ts → introEvents.d-tOi4o3F4.d.ts} +1 -1
- package/dist/notifications/index.d.cts +4 -4
- package/dist/notifications/index.d.ts +4 -4
- package/dist/{optInView.d-s-w4aGN3.d.ts → optInView.d-B8zTORO2.d.ts} +2 -2
- package/dist/{optInView.d-0iI5JoAf.d.cts → optInView.d-BkNSv4Gk.d.cts} +2 -2
- package/dist/{parse.d-COt1qVA6.d.ts → parse.d-B5JHS6Pr.d.ts} +1 -1
- package/dist/{parse.d-EmsgOUMQ.d.cts → parse.d-BgjO82mY.d.cts} +1 -1
- package/dist/{pets.d-nNAVnw7f.d.cts → pets.d-B_LoizOv.d.cts} +1 -1
- package/dist/{pets.d-BFT_b53y.d.ts → pets.d-OWxskXCP.d.ts} +1 -1
- package/dist/{petsRepository.d-B2TpRE7r.d.cts → petsRepository.d-B5DWzU7C.d.cts} +1 -1
- package/dist/{petsRepository.d-RGwSZcYl.d.ts → petsRepository.d-Ba3xhJcj.d.ts} +1 -1
- package/dist/{planSignals.d-BDbp2e-k.d.cts → planSignals.d-Cl6n5QpS.d.cts} +2 -2
- package/dist/{planSignals.d-DSnxKoWe.d.ts → planSignals.d-DtxZoWGM.d.ts} +2 -2
- package/dist/{ports.d-D2n4HRUy.d.ts → ports.d-BDtwHxmW.d.ts} +4 -4
- package/dist/{ports.d-DBA_gsq5.d.cts → ports.d-gZNTn8Qf.d.cts} +4 -4
- package/dist/records/depth/index.d.cts +9 -9
- package/dist/records/depth/index.d.ts +9 -9
- package/dist/records/index.cjs +62 -52
- package/dist/records/index.d.cts +21 -15
- package/dist/records/index.d.ts +21 -15
- package/dist/records/index.js +63 -53
- package/dist/{requestFunnel.d-RZex94XX.d.cts → requestFunnel.d-CR4akGCY.d.cts} +2 -2
- package/dist/{requestFunnel.d-D9edIEjZ.d.ts → requestFunnel.d-DFf9C__p.d.ts} +2 -2
- package/dist/{runtimeTypes.d-BYq38b17.d.ts → runtimeTypes.d-BqBOrZxa.d.ts} +5 -5
- package/dist/{runtimeTypes.d-LkwZaF7z.d.cts → runtimeTypes.d-CHdH-y2c.d.cts} +5 -5
- package/dist/{screenProps.d-CQ0qZJkr.d.cts → screenProps.d-B1dIANI0.d.cts} +1 -1
- package/dist/{screenProps.d-BVzRzowC.d.ts → screenProps.d-CVqFJw-J.d.ts} +1 -1
- package/dist/server/events/index.cjs +1 -1
- package/dist/server/events/index.d.cts +2 -2
- package/dist/server/events/index.d.ts +2 -2
- package/dist/server/events/index.js +1 -1
- package/dist/server/index.cjs +1 -1
- package/dist/server/index.d.cts +3 -3
- package/dist/server/index.d.ts +3 -3
- package/dist/server/index.js +1 -1
- package/dist/shop/index.cjs +5 -4
- package/dist/shop/index.d.cts +15 -3
- package/dist/shop/index.d.ts +15 -3
- package/dist/shop/index.js +5 -4
- package/dist/tabs/index.cjs +3 -3
- package/dist/tabs/index.d.cts +9 -8
- package/dist/tabs/index.d.ts +9 -8
- package/dist/tabs/index.js +3 -3
- package/dist/televet/booking/index.d.cts +6 -6
- package/dist/televet/booking/index.d.ts +6 -6
- package/dist/testing/index.cjs +1 -1
- package/dist/testing/index.d.cts +1 -1
- package/dist/testing/index.d.ts +1 -1
- package/dist/testing/index.js +1 -1
- package/dist/testing/rn/index.d.cts +9 -9
- package/dist/testing/rn/index.d.ts +9 -9
- package/dist/testing/web/index.d.cts +9 -9
- package/dist/testing/web/index.d.ts +9 -9
- package/dist/texting/index.d.cts +5 -5
- package/dist/texting/index.d.ts +5 -5
- package/dist/{threadOptions.d-9r4Csa7k.d.cts → threadOptions.d-CnSfFVMr.d.cts} +2 -2
- package/dist/{threadOptions.d-B6GA09aM.d.ts → threadOptions.d-DZ0AoQGk.d.ts} +2 -2
- package/dist/{timelineRows.d-BvM2A7_G.d.cts → timelineRows.d-CF1KvLcQ.d.cts} +1 -1
- package/dist/{timelineRows.d-Bes8ip2v.d.ts → timelineRows.d-CtL0y7y1.d.ts} +1 -1
- package/dist/{tokens.d-DarDaV39.d.cts → tokens.d-BUVqme2D.d.cts} +1 -1
- package/dist/{tokens.d-DarDaV39.d.ts → tokens.d-BUVqme2D.d.ts} +1 -1
- package/dist/{typeStyle.d-Co5KF0up.d.ts → typeStyle.d-B3Kdtjie.d.ts} +2 -2
- package/dist/{typeStyle.d-xIZj02Ru.d.cts → typeStyle.d-DmlwyJq-.d.cts} +2 -2
- package/dist/{usePresentation.d-BGz32Vlm.d.ts → usePresentation.d-BsR08Wxt.d.ts} +1 -1
- package/dist/{usePresentation.d-DYTF_ZGf.d.cts → usePresentation.d-CZS0qlLI.d.cts} +1 -1
- package/dist/{useRecordsDepth.d-BQRL0Hez.d.ts → useRecordsDepth.d-DTAxFf5s.d.ts} +1 -1
- package/dist/{useRecordsDepth.d--LLA_4ga.d.cts → useRecordsDepth.d-k-zYIHTe.d.cts} +1 -1
- package/dist/{view.d-DqbCADFa.d.ts → view.d-BE7VOlsB.d.ts} +3 -3
- package/dist/{view.d-0yBjLTV3.d.cts → view.d-CAWQjcY_.d.cts} +3 -3
- package/dist/web/consent/index.d.cts +5 -5
- package/dist/web/consent/index.d.ts +5 -5
- package/dist/web/health-plan/index.cjs +35 -30
- package/dist/web/health-plan/index.d.cts +10 -10
- package/dist/web/health-plan/index.d.ts +10 -10
- package/dist/web/health-plan/index.js +35 -30
- package/dist/web/index.cjs +9 -9
- package/dist/web/index.d.cts +30 -29
- package/dist/web/index.d.ts +30 -29
- package/dist/web/index.js +9 -9
- package/dist/web/intro/index.d.cts +6 -6
- package/dist/web/intro/index.d.ts +6 -6
- package/dist/web/notifications/index.d.cts +3 -3
- package/dist/web/notifications/index.d.ts +3 -3
- package/dist/web/records/depth/index.d.cts +9 -9
- package/dist/web/records/depth/index.d.ts +9 -9
- package/dist/web/records/index.cjs +2 -2
- package/dist/web/records/index.d.cts +11 -11
- package/dist/web/records/index.d.ts +11 -11
- package/dist/web/records/index.js +2 -2
- package/dist/web/records-sheet/index.cjs +87 -62
- package/dist/web/records-sheet/index.d.cts +9 -2
- package/dist/web/records-sheet/index.d.ts +9 -2
- package/dist/web/records-sheet/index.js +87 -62
- package/dist/web/shop/index.cjs +7 -6
- package/dist/web/shop/index.d.cts +3 -3
- package/dist/web/shop/index.d.ts +3 -3
- package/dist/web/shop/index.js +7 -6
- package/dist/web/televet/booking/index.d.cts +7 -7
- package/dist/web/televet/booking/index.d.ts +7 -7
- package/dist/web/texting/index.d.cts +5 -5
- package/dist/web/texting/index.d.ts +5 -5
- package/package.json +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,86 @@ changes that has not been earned by any production integration yet.
|
|
|
10
10
|
|
|
11
11
|
## [Unreleased]
|
|
12
12
|
|
|
13
|
+
## [0.15.0] - 2026-10-22
|
|
14
|
+
|
|
15
|
+
### Added
|
|
16
|
+
|
|
17
|
+
- **Health Plan from the page's own data (web and React Native).** The plan page's mapper now reads the waiting card
|
|
18
|
+
(`wait`, results not back), a pick with no product part at all (`pick.hidden`, with `none`: the everyday plan and the
|
|
19
|
+
waiting screen draw no product and no "no supplement" line), `subtitleNoRecords` (drawn while her vet records are
|
|
20
|
+
missing), the tips' `tone` and `icon`, every icon the layout draws, and More from Embark offers that name a plan
|
|
21
|
+
item (`productId`; `added` may be left out for them). Such an offer is drawn with the shop on or a checkout, at
|
|
22
|
+
its plan item's price when it states none, and Add puts it in the cart; when any offer names a plan item, the
|
|
23
|
+
plan's other items are no longer listed under the pick. In the tabs shells the waiting card's button opens Ask.
|
|
24
|
+
- **Tabs: results pending from the plan page (web and React Native).** With no `resultsPending` from you, the tabs
|
|
25
|
+
shells read it from the pet's Health Plan page: a page drawing its waiting card (`wait`) means her results are not
|
|
26
|
+
back, so Ask draws no focus card and no pill, offers your `pendingStarterPrompts`, and the intro uses its waiting
|
|
27
|
+
lines. Pass `resultsPending` to override it either way.
|
|
28
|
+
- **Records: the repeat-tap note (React Native).** As on the web, "Request from a clinic" tapped while a clinic
|
|
29
|
+
request for the pet is out opens no picker again and says "Requested from {clinic}. Clinics usually take 2 to 5
|
|
30
|
+
days." for 2.6s. "Another clinic" on the request tracker still asks a new clinic.
|
|
31
|
+
- **Raph's motion on the Health Plan.** His press scales (`:active`, generated from his CSS as `PLAN_PRESS` on the
|
|
32
|
+
web) and the cart badge bump (320ms, 1.25 at 40%, his ease-out on each keyframe), on web and React Native. His
|
|
33
|
+
overlays now move as his demo does, on both: sheets rise 320ms on his drawer curve and fall 220ms under a scrim
|
|
34
|
+
that fades 240ms in and 200ms out, pushed screens (cart, orders, an order) slide in 300ms and out 220ms, and the
|
|
35
|
+
toast fades in 220ms and out 160ms; each is kept drawn through its exit. Under reduced motion the bump does not
|
|
36
|
+
play, sheets and pushed screens fade 160ms in place, the scrim keeps its fade and the toast does not rise; the
|
|
37
|
+
press scales stay on both (his reduced-motion block keeps them) and on the web "See it" jumps instead of gliding. On React
|
|
38
|
+
Native the sheet's `Modal` no longer uses the platform slide (`animationType` is `none`).
|
|
39
|
+
- **Theme slots `planWash` and `planChip` (web and React Native).** A partner's own link washes for the Health Plan
|
|
40
|
+
(`backgroundColor` only: his `cyan-1` and chip tint), used on a light page in place of the mix of your link color
|
|
41
|
+
into the card. Unset, or on a dark page, the plan keeps the mix.
|
|
42
|
+
- **`PetStateRepository.getState` takes `maxAttempts`.** A reader that keeps its own retry schedule (the records
|
|
43
|
+
pet art) caps the read at that many attempts instead of the transport's default retries.
|
|
44
|
+
|
|
45
|
+
### Changed
|
|
46
|
+
|
|
47
|
+
- **Records: the pet on grass in every state (web and React Native).** The records sheet draws the pet as our app's
|
|
48
|
+
Health tab does without any art from you: our grass, shipped by the SDK (on the web from `https://sdk.everfur.com`
|
|
49
|
+
at the package's version, on React Native from the same URL as an `Image` `{ uri }`, so no image is bundled and a
|
|
50
|
+
Jest setup needs no image transformer; a strip that does not load leaves the stage bare), and the pet's own breed
|
|
51
|
+
drawing from the new
|
|
52
|
+
`GET /widget/v1/pets/{pet_ref}/state`, with the web app's skeleton, monogram and fade-ins and the mobile app's hero
|
|
53
|
+
settle, all still under reduced motion. A `stage` you pass still wins (and `renderStage` on React Native). New
|
|
54
|
+
React Native option `handFontFamily` names the hand face for the line over the pet when you pass no `stage`. Web
|
|
55
|
+
pages that run records in-page add `https://sdk.everfur.com` and `https://media.everfur.com` to `img-src`; the
|
|
56
|
+
records frame carries both itself.
|
|
57
|
+
|
|
58
|
+
- **Health Plan: whole prices on More from Embark (web and React Native).** Those cards print a whole price without
|
|
59
|
+
cents (`$139`), as his demo does; every other price keeps its cents. A `priceFormat` you pass still wins.
|
|
60
|
+
- **Health Plan: icons from his sprite (web).** The plan's icons are generated from Raph's icon sprite, his paths and
|
|
61
|
+
stroke widths, in place of the SDK's hand-drawn set.
|
|
62
|
+
- **Health Plan: the reviews are one swipe row (web).** His reviews row scrolls and snaps side to side and is one
|
|
63
|
+
keyboard stop; its keyboard ring has his 18px corners, and on a wide screen it draws his thin scrollbar with 10px
|
|
64
|
+
under the cards.
|
|
65
|
+
- **Health Plan: the focus ring (web).** A plan control the keyboard reaches draws 2px of his ink, in its sheets and
|
|
66
|
+
pushed screens too, and none on a pointer press; the weight field draws his own 2.5px inset ring as it takes focus.
|
|
67
|
+
- **Health Plan: the vet comes only from the page (web).** The byline 0.14.0 drew on a vet-reviewed page whose
|
|
68
|
+
backend sent none is gone: a page with no byline draws none. React Native already drew only the page's.
|
|
69
|
+
|
|
70
|
+
### Fixed
|
|
71
|
+
|
|
72
|
+
- **Shop: prescribed products first, whatever catalog page they are on.** `useShopScreen` (web and React Native
|
|
73
|
+
shops) reads the offers the member's ready prescriptions name by id and shows them above the catalog, which no
|
|
74
|
+
longer repeats them. A never-filled prescription gets its own shelf, "Prescribed for {pets}" (new
|
|
75
|
+
`ShopCopy.prescribedFor`, draft copy pending design), instead of "Refill soon"; refills keep "Refill soon".
|
|
76
|
+
- **Shop: drug-form tiles.** A prescription tile draws its form from the title or the prescription (tablet or
|
|
77
|
+
capsule: pill; liquid: flask; injection: syringe; chew: bowl; topical: shield), from the existing icon set. An
|
|
78
|
+
offer's https `image_url`, when the catalog sends one, is drawn over the tile once it loads; the tile stays while it
|
|
79
|
+
loads and when it fails.
|
|
80
|
+
- **Records: the pet card with no `stage`.** With no host art the records pet card no longer collapses to a cramped
|
|
81
|
+
top (seen at 393 and 1440): the stage is now drawn in every state.
|
|
82
|
+
- **Records: the sheet's stage pieces arrive when drawn late (web).** A piece mounted after the sheet opened (the
|
|
83
|
+
pet once its art loads) now fades in when it is seen instead of staying hidden, and the pet leans as the stage
|
|
84
|
+
scrolls. The grass and the chart line end their reveal on a zero inset, which Chrome animates. A grass strip that
|
|
85
|
+
does not load is hidden instead of drawing a broken image.
|
|
86
|
+
- **Health Plan: a pet with no plan items on a page that needs none (web and React Native).** A pending dog (the
|
|
87
|
+
waiting card) or the everyday plan now draws its page and keeps the Plan tab; any other pet with no items still has
|
|
88
|
+
no plan.
|
|
89
|
+
- **One plan page read per pet, across bundles.** The shared read is kept per runtime on `globalThis`, so the tabs
|
|
90
|
+
shell and a separately imported Health Plan share it, and it is shared for 60 seconds (the plan's staleness
|
|
91
|
+
window) instead of 5.
|
|
92
|
+
|
|
13
93
|
## [0.14.0] - 2026-10-22
|
|
14
94
|
|
|
15
95
|
### Added
|
|
@@ -2,11 +2,11 @@ import { ReactNode } from 'react';
|
|
|
2
2
|
import { StyleProp, ViewStyle } from 'react-native';
|
|
3
3
|
import { P as PetRef, C as ConversationId } from './ids.d-B2GAAifq.cjs';
|
|
4
4
|
import { i as EverfurPresentationInput } from './presentation.d-vy8kTGfR.cjs';
|
|
5
|
-
import { a as ChatCheckinTarget } from './ports.d-
|
|
6
|
-
import { W as WidgetPet, P as PetProfileInput } from './petsRepository.d-
|
|
5
|
+
import { a as ChatCheckinTarget } from './ports.d-gZNTn8Qf.cjs';
|
|
6
|
+
import { W as WidgetPet, P as PetProfileInput } from './petsRepository.d-B5DWzU7C.cjs';
|
|
7
7
|
import { E as EverfurStarterPrompt } from './quickPrompts.d-NM_81Jc1.cjs';
|
|
8
8
|
import { L as LifecyclePort } from './LifecyclePort.d-Cr1p33a7.cjs';
|
|
9
|
-
import { U as UrgencyDisplayLevel, E as EverfurChatDraftStore } from './attachments.d-
|
|
9
|
+
import { U as UrgencyDisplayLevel, E as EverfurChatDraftStore } from './attachments.d-CpaOfi2g.cjs';
|
|
10
10
|
import { F as FileHandle } from './ports.d-BX4f4UsB.cjs';
|
|
11
11
|
|
|
12
12
|
/** Where a picked image comes from: the host's photo library, or its camera. */
|
|
@@ -2,11 +2,11 @@ import { ReactNode } from 'react';
|
|
|
2
2
|
import { StyleProp, ViewStyle } from 'react-native';
|
|
3
3
|
import { P as PetRef, C as ConversationId } from './ids.d-B2GAAifq.js';
|
|
4
4
|
import { i as EverfurPresentationInput } from './presentation.d-vy8kTGfR.js';
|
|
5
|
-
import { a as ChatCheckinTarget } from './ports.d-
|
|
6
|
-
import { W as WidgetPet, P as PetProfileInput } from './petsRepository.d-
|
|
5
|
+
import { a as ChatCheckinTarget } from './ports.d-BDtwHxmW.js';
|
|
6
|
+
import { W as WidgetPet, P as PetProfileInput } from './petsRepository.d-Ba3xhJcj.js';
|
|
7
7
|
import { E as EverfurStarterPrompt } from './quickPrompts.d-NM_81Jc1.js';
|
|
8
8
|
import { L as LifecyclePort } from './LifecyclePort.d-Cr1p33a7.js';
|
|
9
|
-
import { U as UrgencyDisplayLevel, E as EverfurChatDraftStore } from './attachments.d-
|
|
9
|
+
import { U as UrgencyDisplayLevel, E as EverfurChatDraftStore } from './attachments.d-BGn2_knv.js';
|
|
10
10
|
import { F as FileHandle } from './ports.d-BX4f4UsB.js';
|
|
11
11
|
|
|
12
12
|
/** Where a picked image comes from: the host's photo library, or its camera. */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { StyleProp, ViewStyle } from 'react-native';
|
|
3
|
-
import { c as RecordsScreenBaseProps } from './screenProps.d-
|
|
3
|
+
import { c as RecordsScreenBaseProps } from './screenProps.d-B1dIANI0.cjs';
|
|
4
4
|
|
|
5
5
|
interface EverfurRecordsDepthProps extends Pick<RecordsScreenBaseProps, 'petRef' | 'petName' | 'onNavigate' | 'onBack'> {
|
|
6
6
|
readonly style?: StyleProp<ViewStyle>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { StyleProp, ViewStyle } from 'react-native';
|
|
3
|
-
import { c as RecordsScreenBaseProps } from './screenProps.d-
|
|
3
|
+
import { c as RecordsScreenBaseProps } from './screenProps.d-CVqFJw-J.js';
|
|
4
4
|
|
|
5
5
|
interface EverfurRecordsDepthProps extends Pick<RecordsScreenBaseProps, 'petRef' | 'petName' | 'onNavigate' | 'onBack'> {
|
|
6
6
|
readonly style?: StyleProp<ViewStyle>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CSSProperties, ReactNode } from 'react';
|
|
2
|
-
import { c as RecordsScreenBaseProps } from './screenProps.d-
|
|
2
|
+
import { c as RecordsScreenBaseProps } from './screenProps.d-CVqFJw-J.js';
|
|
3
3
|
|
|
4
4
|
interface EverfurRecordsDepthProps extends Pick<RecordsScreenBaseProps, 'petRef' | 'petName' | 'onNavigate' | 'onBack'> {
|
|
5
5
|
readonly style?: CSSProperties;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CSSProperties, ReactNode } from 'react';
|
|
2
|
-
import { c as RecordsScreenBaseProps } from './screenProps.d-
|
|
2
|
+
import { c as RecordsScreenBaseProps } from './screenProps.d-B1dIANI0.cjs';
|
|
3
3
|
|
|
4
4
|
interface EverfurRecordsDepthProps extends Pick<RecordsScreenBaseProps, 'petRef' | 'petName' | 'onNavigate' | 'onBack'> {
|
|
5
5
|
readonly style?: CSSProperties;
|
|
@@ -2,7 +2,7 @@ import { CSSProperties, ReactNode } from 'react';
|
|
|
2
2
|
import { R as RecordsClinicController, C as CaptureRecordsSignature } from './clinicRequestProps.d-CjsMg_OD.js';
|
|
3
3
|
import { R as RecordsController } from './useRecords.d-DWk61a4c.js';
|
|
4
4
|
import { c as RecordForwardItem } from './models.d-DOwnr8fi.js';
|
|
5
|
-
import { c as RecordsScreenBaseProps } from './screenProps.d-
|
|
5
|
+
import { c as RecordsScreenBaseProps } from './screenProps.d-CVqFJw-J.js';
|
|
6
6
|
import { E as EverfurRecordsSheet } from './sheetSeam.d-B09jf4YC.js';
|
|
7
7
|
|
|
8
8
|
interface EverfurRecordsPageProps extends RecordsScreenBaseProps {
|
|
@@ -2,7 +2,7 @@ import { CSSProperties, ReactNode } from 'react';
|
|
|
2
2
|
import { R as RecordsClinicController, C as CaptureRecordsSignature } from './clinicRequestProps.d-1dCtouGA.cjs';
|
|
3
3
|
import { R as RecordsController } from './useRecords.d-BYNX01El.cjs';
|
|
4
4
|
import { c as RecordForwardItem } from './models.d-BSqvbTE1.cjs';
|
|
5
|
-
import { c as RecordsScreenBaseProps } from './screenProps.d-
|
|
5
|
+
import { c as RecordsScreenBaseProps } from './screenProps.d-B1dIANI0.cjs';
|
|
6
6
|
import { E as EverfurRecordsSheet } from './sheetSeam.d-BBuEIVsa.cjs';
|
|
7
7
|
|
|
8
8
|
interface EverfurRecordsPageProps extends RecordsScreenBaseProps {
|
|
@@ -100,7 +100,7 @@ return Object.freeze({ok:false,error:error})}var EverfurConfigError=class _Everf
|
|
|
100
100
|
return jsxRuntime.jsx(reactNative.View,{style:[styles.offstate,style],accessible:true,accessibilityState:{busy:true},accessibilityLabel:`Loading ${capability}`,children:/* @__PURE__ */jsxRuntime.jsx(reactNative.View,{style:styles.skeletonBar})})}function OffState({decision:decision,style:style}){let theme=useEverfurTheme(),styles=react.useMemo(()=>makeStyles(theme),[theme]),message=decision.disabled?.reason??"";/* @__PURE__ */
|
|
101
101
|
return jsxRuntime.jsx(reactNative.View,{style:[styles.offstate,style],accessible:true,accessibilityRole:"text",accessibilityLabel:message,children:message.length>0?/* @__PURE__ */jsxRuntime.jsx(Text,{style:styles.offstateText,children:message}):null})}function makeStyles(theme){let{color:color,space:space,radius:radius,type:type}=theme;return reactNative.StyleSheet.create({offstate:{minHeight:MIN_OFFSTATE_HEIGHT,justifyContent:"center",paddingHorizontal:space.lg,paddingVertical:space.md,backgroundColor:color.surfaceCream,borderRadius:radius.md,borderWidth:reactNative.StyleSheet.hairlineWidth,borderColor:color.brandBorder},offstateText:{...face(theme,"regular"),fontSize:type.size.body,lineHeight:Math.round(type.size.body*type.lineHeight.normal),color:color.text.muted},skeletonBar:{height:space.md,borderRadius:radius.xs,backgroundColor:color.brandSofter}})}function mintFailedError(cause,refusal){let message=cause instanceof Error?cause.message:typeof cause=="string"?cause:null;return makeEverfurError("authRejected",{retryable:false,...refusal?.wireCode?{wireCode:refusal.wireCode}:{},...refusal?.requestId?{requestId:refusal.requestId}:{},...message?{wireMessage:message}:{},...cause!=null?{raw:cause}:{}})}function newSessionId(){let bytes=new Uint8Array(16),cryptoObj=globalThis.crypto;if(typeof cryptoObj?.getRandomValues=="function")cryptoObj.getRandomValues(bytes);else for(let i=0;i<bytes.length;i+=1)bytes[i]=Math.floor(Math.random()*256);bytes[6]=bytes[6]&15|64,bytes[8]=bytes[8]&63|128;let hex=[];for(let i=0;i<bytes.length;i+=1)hex.push(bytes[i].toString(16).padStart(2,"0"));return hex.slice(0,4).join("")+"-"+hex.slice(4,6).join("")+"-"+hex.slice(6,8).join("")+"-"+hex.slice(8,10).join("")+"-"+hex.slice(10,16).join("")}function authHeaders(auth){let headers={};return auth.mode==="personalized"?headers.authorization=`Bearer ${auth.token}`:headers["x-everfur-partner-key"]=auth.publishableKey,auth.userRef&&(headers["x-everfur-user-ref"]=auth.userRef),auth.sessionId&&(headers["x-everfur-session-id"]=auth.sessionId),headers}function withAuthHeaders(req,auth){return{...req,headers:{...stripAuthHeaders(req.headers),...authHeaders(auth)}}}function stripAuthHeaders(headers){if(!headers)return{};let out={};for(let[key,value]of Object.entries(headers)){let lower=key.toLowerCase();lower==="authorization"||lower==="x-everfur-partner-key"||(out[key]=value)}return out}async function authedSend(req,ctx){if(ctx.mode==="anonymous")return ctx.transport.request(withAuthHeaders(req,{mode:"anonymous",publishableKey:ctx.publishableKey,userRef:ctx.userRef,...ctx.sessionId?{sessionId:ctx.sessionId}:{}}));let token;try{token=await ctx.identity.currentToken()}catch(cause){return ctx.identity.reportRejected?.(),err(mintFailedError(cause))}let first=await ctx.transport.request(withAuthHeaders(req,{mode:"personalized",token:token,userRef:ctx.userRef,...ctx.sessionId?{sessionId:ctx.sessionId}:{}}));if(first.ok||first.error.httpStatus!==401)return first;let refreshed;try{refreshed=await ctx.identity.currentToken({forceRefresh:!0})}catch(cause){return ctx.identity.reportRejected?.(),err(mintFailedError(cause,{wireCode:wireCodeOf(first.error.raw),requestId:first.error.requestId}))}let retry=await ctx.transport.request(withAuthHeaders(req,{mode:"personalized",token:refreshed,userRef:ctx.userRef,...ctx.sessionId?{sessionId:ctx.sessionId}:{}}));return!retry.ok&&retry.error.httpStatus===401?(ctx.identity.reportRejected?.(),err(refusedAfterRemintError(retry.error))):retry}function refusedAfterRemintError(refusal){let raw=refusal.raw,wireCode=wireCodeOf(raw);return makeEverfurError("authRejected",{retryable:false,...refusal.httpStatus!==void 0?{httpStatus:refusal.httpStatus}:{},...refusal.requestId?{requestId:refusal.requestId}:{},...wireCode?{wireCode:wireCode}:{},...refusal.reasonCode?{reasonCode:refusal.reasonCode}:{},...refusal.wireMessage?{wireMessage:refusal.wireMessage}:{},...raw!=null?{raw:raw}:{}})}function wireCodeOf(body){if(typeof body!="object"||body===null)return null;let b=body,code=(typeof b.error=="object"&&b.error!==null?b.error.code:void 0)??b.code;return typeof code=="string"&&code.length>0?code:null}function networkError(cause){return makeEverfurError("internalError",{retryable:true,wireMessage:describeCause(cause)})}function describeCause(cause){return cause instanceof Error?cause.message:typeof cause=="string"?cause:"network request failed"}var FUNNEL_UNARY_TIMEOUT_MS=3e4,RETRY_OVERRIDE_MAX_MS=BACKOFF_CAP_MS*2,IDEMPOTENCY_HEADER="idempotency-key",MUTATING_METHODS=/* @__PURE__ */new Set(["POST","PUT","PATCH","DELETE"]),NOOP_OBSERVER=/* @__PURE__ */Object.freeze({onEvent(){}}),defaultFunnelTimers=/* @__PURE__ */Object.freeze({setTimeout:(handler,ms)=>setTimeout(handler,ms),clearTimeout:handle=>clearTimeout(handle),now:()=>Date.now()});function seededIdempotencyKey(seed){let safe=seed.trim().replace(/[^A-Za-z0-9_.:-]/g,"-");return safe.length===0?null:`efs_${safe}`.slice(0,128)}function createRequestFunnel(deps){let observer=deps.observer??NOOP_OBSERVER,timers=deps.timers??defaultFunnelTimers,rng=deps.rng??Math.random,sleep=deps.sleep??((ms,signal)=>delayAbortable(ms,timers,signal)),ceiling=deps.maxAttempts??MAX_RETRY_ATTEMPTS,timeoutMs=deps.unaryTimeoutMs??FUNNEL_UNARY_TIMEOUT_MS,mintKey=deps.newIdempotencyKey??defaultIdempotencyKeyFactory(),emit=event=>{try{observer.onEvent(event)}catch{}};async function send(call,req,opts){let perCallMaxAttempts=opts?.maxAttempts,maxAttempts=Math.max(1,perCallMaxAttempts??ceiling),idempotent=opts?.idempotent??MUTATING_METHODS.has(req.method),seeded=opts?.idempotencyKey===void 0?null:seededIdempotencyKey(opts.idempotencyKey),idempotencyKey=idempotent?seeded??mintKey():null,base=assembleHeaders(req,idempotencyKey),attempt=0;for(;;){let stamp=extra=>/* @__PURE__ */Object.freeze({call:call,method:req.method,path:req.path,attempt:attempt,...idempotencyKey?{idempotencyKey:idempotencyKey}:{},...extra});emit(stamp({phase:"attempt"}));let deadline=boundedSignal(timeoutMs,timers),merged=mergeSignals(deadline.signal,req.signal),settled;try{settled=await authedSend({...base,signal:merged.signal},deps.auth)}catch(cause){settled=err(networkError(cause))}finally{merged.dispose(),deadline.cancel()}if(settled.ok)return emit(stamp({phase:"settled",ok:true,reason:"ok"})),settled;let error=settled.error,decision=decideRetry(error,attempt,{maxAttempts:maxAttempts,rng:rng,now:timers.now(),aborted:req.signal?.aborted===true,...perCallMaxAttempts!==void 0?{perCallMaxAttempts:perCallMaxAttempts}:{},...deps.errorPolicy!==void 0?{policy:deps.errorPolicy}:{}}),settledEvent={ok:false,code:error.code,reason:decision.reason,...error.httpStatus!==void 0?{httpStatus:error.httpStatus}:{},...error.requestId!==void 0?{requestId:error.requestId}:{}};if(!decision.retry)return emit(stamp({phase:"settled",...settledEvent})),err(error);if(emit(stamp({phase:"retry",...settledEvent,delayMs:decision.delayMs})),await sleep(decision.delayMs,req.signal),req.signal?.aborted===true)return emit(stamp({phase:"settled",...settledEvent,reason:"aborted"})),err(error);attempt+=1}}async function authorize(req){return withAuthHeaders(req,await resolveDeviceAuth(deps.auth))}async function*stream(call,req,signal){emit(
|
|
102
102
|
/* @__PURE__ */Object.freeze({call:call,phase:"stream.open",method:req.method,path:req.path,attempt:0}));try{yield*deps.auth.transport.stream(req,signal)}catch{yield errorFrame({code:"internal_error",retryable:true,wireMessage:null,synthesized:true,lastEventId:null})}}/* @__PURE__ */
|
|
103
|
-
return Object.freeze({send:send,authorize:authorize,stream:stream})}function assembleHeaders(req,idempotencyKey){let headers={};for(let[key,value]of Object.entries(req.headers??{}))key.toLowerCase()!==IDEMPOTENCY_HEADER&&(headers[key]=value);return idempotencyKey!==null&&(headers["Idempotency-Key"]=idempotencyKey),{...req,headers:headers}}function defaultIdempotencyKeyFactory(){let counter=0;return()=>`efk_${Date.now().toString(36)}_${(counter++).toString(36)}_${Math.random().toString(36).slice(2,12)}`}var POLICY_MAX_ATTEMPTS_CAP=10;function decideRetry(error,attempt,ctx){if(ctx.aborted)return{retry:false,reason:"aborted"};let throttle=throttleKind(error);if(throttle==="quota")return{retry:false,reason:"daily-quota-exhausted"};if(throttle!=="burst"&&!isAutoRetryable(error.code))return{retry:false,reason:"terminal-code"};let reason=throttle==="burst"?"burst-throttle":"retryable-code";if((()=>{if(ctx.policy===void 0)return false;try{return!ctx.policy.shouldRetry(error.code,attempt)}catch{return false}})())return{retry:false,reason:"terminal-code"};let policyCeiling=()=>{if(ctx.policy===void 0)return null;let raw;try{raw=ctx.policy.maxAttempts(error.code)}catch{return null}return typeof raw!="number"||!Number.isFinite(raw)?null:Math.max(1,Math.min(POLICY_MAX_ATTEMPTS_CAP,Math.floor(raw)))},ceiling=ctx.perCallMaxAttempts??policyCeiling()??ctx.maxAttempts;if(attempt+1>=ceiling)return{retry:false,reason:"attempts-exhausted"};let override=retryOverrideMs(error,ctx.now);return override!==null?override>RETRY_OVERRIDE_MAX_MS?{retry:false,reason:"server-reset-beyond-budget"}:{retry:true,reason:reason,delayMs:override}:{retry:true,reason:reason,delayMs:backoffDelayMs(attempt,ctx.rng)}}function throttleKind(error){let code=error.code==="unknown"?fromWire(rawWireCode(error.raw)):error.code;return code==="quotaExceeded"?"quota":code==="rateLimited"||error.httpStatus===429?"burst":null}function retryOverrideMs(error,now){let at=findResetsAt(error.raw);if(at!==null){let delta=at-now;return delta>0?delta:0}let wait=findRetryAfterSeconds(error.raw);return wait===null?null:Math.round(wait*1e3)}function findRetryAfterSeconds(raw){for(let scope of candidateScopes(raw)){let value=scope.retry_after_seconds;if(typeof value=="number"&&Number.isFinite(value)&&value>=0)return value}return null}function findResetsAt(raw){for(let scope of candidateScopes(raw)){let value=scope.resets_at,parsed=parseInstantMs(value);if(parsed!==null)return parsed}return null}function candidateScopes(raw){if(!isRecord(raw))return[];let out=[raw];for(let nested of["error","detail"]){let value=raw[nested];isRecord(value)&&out.push(value)}return out}function parseInstantMs(value){if(typeof value=="number"&&Number.isFinite(value))return value<1e11?Math.round(value*1e3):Math.round(value);if(typeof value=="string"&&value.trim().length>0){let parsed=Date.parse(value);return Number.isFinite(parsed)?parsed:null}return null}function rawWireCode(raw){for(let scope of candidateScopes(raw)){let code=scope.code;if(typeof code=="string"&&code.length>0)return code}return null}function isRecord(value){return typeof value=="object"&&value!==null}async function resolveDeviceAuth(auth){return auth.mode==="anonymous"?{mode:"anonymous",publishableKey:auth.publishableKey,userRef:auth.userRef,...auth.sessionId?{sessionId:auth.sessionId}:{}}:{mode:"personalized",token:await auth.identity.currentToken(),userRef:auth.userRef,...auth.sessionId?{sessionId:auth.sessionId}:{}}}function boundedSignal(ms,timers){let ctrl=new AbortController,handle=timers.setTimeout(()=>ctrl.abort(),ms);return{signal:ctrl.signal,cancel:()=>timers.clearTimeout(handle)}}function mergeSignals(deadline,caller){let noop=()=>{};if(!caller)return{signal:deadline,dispose:noop};let ctrl=new AbortController;if(deadline.aborted||caller.aborted)return ctrl.abort(),{signal:ctrl.signal,dispose:noop};let onAbort=()=>ctrl.abort();return deadline.addEventListener("abort",onAbort,{once:true}),caller.addEventListener("abort",onAbort,{once:true}),{signal:ctrl.signal,dispose:()=>{deadline.removeEventListener("abort",onAbort),caller.removeEventListener("abort",onAbort)}}}function delayAbortable(ms,timers,signal){return ms<=0||signal?.aborted===true?Promise.resolve():new Promise(resolve=>{let handle=timers.setTimeout(()=>{signal?.removeEventListener("abort",onAbort),resolve()},ms),onAbort=()=>{timers.clearTimeout(handle),resolve()};signal?.addEventListener("abort",onAbort,{once:true})})}function hasLoneSurrogate(value){for(let i=0;i<value.length;i+=1){let code=value.charCodeAt(i);if(code>=55296&&code<=56319){let low=value.charCodeAt(i+1);if(!(low>=56320&&low<=57343))return true;i+=1}else if(code>=56320&&code<=57343)return true}return false}function mapTier(wire){let tier={url:wire.url,kind:wire.kind,expiresAt:wire.expires_at};return typeof wire.loop_duration_ms=="number"&&(tier.loopDurationMs=wire.loop_duration_ms),typeof wire.cache_key=="string"&&wire.cache_key.length>0&&(tier.cacheKey=wire.cache_key),/* @__PURE__ */Object.freeze(tier)}function mapPetStateResponse(wire){let tiers={};wire.tiers.animation&&(tiers.animation=mapTier(wire.tiers.animation)),wire.tiers.image&&(tiers.image=mapTier(wire.tiers.image));let overlays={};wire.overlays.weather_alert&&(overlays.weatherAlert=mapTier(wire.overlays.weather_alert));let response={category:wire.category,tiers:/* @__PURE__ */Object.freeze(tiers),overlays:/* @__PURE__ */Object.freeze(overlays),idle:"bundled",ttlSeconds:wire.ttl_seconds,degraded:wire.degraded};return typeof wire.cache_epoch=="number"&&(response.cacheEpoch=wire.cache_epoch),/* @__PURE__ */Object.freeze(response)}var mediaKindWireSchema=/* @__PURE__ */zod.z.enum(["webp","video"]),categoryWireSchema=/* @__PURE__ */zod.z.enum(["health","attention","moment","activity","mood","idle"]),petStateTierWireSchema=/* @__PURE__ */zod.z.object({url:/* @__PURE__ */zod.z.string(),kind:/* @__PURE__ */mediaKindWireSchema.default("webp"),loop_duration_ms:/* @__PURE__ */zod.z.number().nullish(),expires_at:/* @__PURE__ */zod.z.string(),cache_key:/* @__PURE__ */zod.z.string().nullish()}),petStateResponseWireSchema=/* @__PURE__ */zod.z.object({category:categoryWireSchema,tiers:/* @__PURE__ */zod.z.object({animation:/* @__PURE__ */petStateTierWireSchema.optional(),image:/* @__PURE__ */petStateTierWireSchema.optional()}).default({}),overlays:/* @__PURE__ */zod.z.object({weather_alert:/* @__PURE__ */petStateTierWireSchema.optional()}).default({}),idle:/* @__PURE__ */zod.z.literal("bundled").default("bundled"),ttl_seconds:/* @__PURE__ */zod.z.number(),degraded:/* @__PURE__ */zod.z.boolean().default(false),cache_epoch:/* @__PURE__ */zod.z.number().default(0)});function parsePetStateWire(raw){let parsed=petStateResponseWireSchema.safeParse(raw);return parsed.success?parsed.data:null}function createPetStateRepository(auth){return createPetStateRepositoryOver(createRequestFunnel({auth:auth}))}function createPetStateRepositoryOver(funnel){return{async getState(petRef,opts){if(hasLoneSurrogate(petRef))return err(makeEverfurError("validationFailed",{retryable:false,wireMessage:"pet_ref contains an unpaired surrogate and cannot be encoded"}));let path=`/widget/v1/pets/${encodeURIComponent(petRef)}/state`,res=await funnel.send("animations.getState",opts?.signal?{method:"GET",path:path,signal:opts.signal}:{method:"GET",path:path});if(res.ok){let wire=parsePetStateWire(res.value);return wire===null?err(makeEverfurError("internalError",{retryable:true})):ok(mapPetStateResponse(wire))}return res.error.httpStatus===404?ok(null):err(res.error)}}}function stableMediaKey(source){if(source===void 0)return"bundled:none";if(typeof source=="number")return`bundled:${source}`;if("kind"in source)return`bundled:${source.id}`;let uri=source.uri,q=uri.indexOf("?");return q===-1?uri:uri.slice(0,q)}function selectTier(i){return i.hasPhoto&&!i.photoFailed?"photo":i.canAnimate&&!i.animationFailed?"animation":i.hasImage&&!i.imageFailed?"image":"idle"}function retireTier(current,failed){switch(current){case"photo":return{failed:freezeFailed({...failed,photo:true}),reason:"network_error"};case"animation":return{failed:freezeFailed({...failed,animation:true}),reason:"network_error"};case"image":return{failed:freezeFailed({...failed,image:true}),reason:"network_error"};case"idle":return{failed:freezeFailed(failed),reason:"idle_asset_failed"};default:return{failed:freezeFailed(failed),reason:"network_error"}}}var NO_FAILURES=/* @__PURE__ */Object.freeze({photo:false,animation:false,image:false});function freezeFailed(f){/* @__PURE__ */
|
|
103
|
+
return Object.freeze({send:send,authorize:authorize,stream:stream})}function assembleHeaders(req,idempotencyKey){let headers={};for(let[key,value]of Object.entries(req.headers??{}))key.toLowerCase()!==IDEMPOTENCY_HEADER&&(headers[key]=value);return idempotencyKey!==null&&(headers["Idempotency-Key"]=idempotencyKey),{...req,headers:headers}}function defaultIdempotencyKeyFactory(){let counter=0;return()=>`efk_${Date.now().toString(36)}_${(counter++).toString(36)}_${Math.random().toString(36).slice(2,12)}`}var POLICY_MAX_ATTEMPTS_CAP=10;function decideRetry(error,attempt,ctx){if(ctx.aborted)return{retry:false,reason:"aborted"};let throttle=throttleKind(error);if(throttle==="quota")return{retry:false,reason:"daily-quota-exhausted"};if(throttle!=="burst"&&!isAutoRetryable(error.code))return{retry:false,reason:"terminal-code"};let reason=throttle==="burst"?"burst-throttle":"retryable-code";if((()=>{if(ctx.policy===void 0)return false;try{return!ctx.policy.shouldRetry(error.code,attempt)}catch{return false}})())return{retry:false,reason:"terminal-code"};let policyCeiling=()=>{if(ctx.policy===void 0)return null;let raw;try{raw=ctx.policy.maxAttempts(error.code)}catch{return null}return typeof raw!="number"||!Number.isFinite(raw)?null:Math.max(1,Math.min(POLICY_MAX_ATTEMPTS_CAP,Math.floor(raw)))},ceiling=ctx.perCallMaxAttempts??policyCeiling()??ctx.maxAttempts;if(attempt+1>=ceiling)return{retry:false,reason:"attempts-exhausted"};let override=retryOverrideMs(error,ctx.now);return override!==null?override>RETRY_OVERRIDE_MAX_MS?{retry:false,reason:"server-reset-beyond-budget"}:{retry:true,reason:reason,delayMs:override}:{retry:true,reason:reason,delayMs:backoffDelayMs(attempt,ctx.rng)}}function throttleKind(error){let code=error.code==="unknown"?fromWire(rawWireCode(error.raw)):error.code;return code==="quotaExceeded"?"quota":code==="rateLimited"||error.httpStatus===429?"burst":null}function retryOverrideMs(error,now){let at=findResetsAt(error.raw);if(at!==null){let delta=at-now;return delta>0?delta:0}let wait=findRetryAfterSeconds(error.raw);return wait===null?null:Math.round(wait*1e3)}function findRetryAfterSeconds(raw){for(let scope of candidateScopes(raw)){let value=scope.retry_after_seconds;if(typeof value=="number"&&Number.isFinite(value)&&value>=0)return value}return null}function findResetsAt(raw){for(let scope of candidateScopes(raw)){let value=scope.resets_at,parsed=parseInstantMs(value);if(parsed!==null)return parsed}return null}function candidateScopes(raw){if(!isRecord(raw))return[];let out=[raw];for(let nested of["error","detail"]){let value=raw[nested];isRecord(value)&&out.push(value)}return out}function parseInstantMs(value){if(typeof value=="number"&&Number.isFinite(value))return value<1e11?Math.round(value*1e3):Math.round(value);if(typeof value=="string"&&value.trim().length>0){let parsed=Date.parse(value);return Number.isFinite(parsed)?parsed:null}return null}function rawWireCode(raw){for(let scope of candidateScopes(raw)){let code=scope.code;if(typeof code=="string"&&code.length>0)return code}return null}function isRecord(value){return typeof value=="object"&&value!==null}async function resolveDeviceAuth(auth){return auth.mode==="anonymous"?{mode:"anonymous",publishableKey:auth.publishableKey,userRef:auth.userRef,...auth.sessionId?{sessionId:auth.sessionId}:{}}:{mode:"personalized",token:await auth.identity.currentToken(),userRef:auth.userRef,...auth.sessionId?{sessionId:auth.sessionId}:{}}}function boundedSignal(ms,timers){let ctrl=new AbortController,handle=timers.setTimeout(()=>ctrl.abort(),ms);return{signal:ctrl.signal,cancel:()=>timers.clearTimeout(handle)}}function mergeSignals(deadline,caller){let noop=()=>{};if(!caller)return{signal:deadline,dispose:noop};let ctrl=new AbortController;if(deadline.aborted||caller.aborted)return ctrl.abort(),{signal:ctrl.signal,dispose:noop};let onAbort=()=>ctrl.abort();return deadline.addEventListener("abort",onAbort,{once:true}),caller.addEventListener("abort",onAbort,{once:true}),{signal:ctrl.signal,dispose:()=>{deadline.removeEventListener("abort",onAbort),caller.removeEventListener("abort",onAbort)}}}function delayAbortable(ms,timers,signal){return ms<=0||signal?.aborted===true?Promise.resolve():new Promise(resolve=>{let handle=timers.setTimeout(()=>{signal?.removeEventListener("abort",onAbort),resolve()},ms),onAbort=()=>{timers.clearTimeout(handle),resolve()};signal?.addEventListener("abort",onAbort,{once:true})})}function hasLoneSurrogate(value){for(let i=0;i<value.length;i+=1){let code=value.charCodeAt(i);if(code>=55296&&code<=56319){let low=value.charCodeAt(i+1);if(!(low>=56320&&low<=57343))return true;i+=1}else if(code>=56320&&code<=57343)return true}return false}function mapTier(wire){let tier={url:wire.url,kind:wire.kind,expiresAt:wire.expires_at};return typeof wire.loop_duration_ms=="number"&&(tier.loopDurationMs=wire.loop_duration_ms),typeof wire.cache_key=="string"&&wire.cache_key.length>0&&(tier.cacheKey=wire.cache_key),/* @__PURE__ */Object.freeze(tier)}function mapPetStateResponse(wire){let tiers={};wire.tiers.animation&&(tiers.animation=mapTier(wire.tiers.animation)),wire.tiers.image&&(tiers.image=mapTier(wire.tiers.image));let overlays={};wire.overlays.weather_alert&&(overlays.weatherAlert=mapTier(wire.overlays.weather_alert));let response={category:wire.category,tiers:/* @__PURE__ */Object.freeze(tiers),overlays:/* @__PURE__ */Object.freeze(overlays),idle:"bundled",ttlSeconds:wire.ttl_seconds,degraded:wire.degraded};return typeof wire.cache_epoch=="number"&&(response.cacheEpoch=wire.cache_epoch),/* @__PURE__ */Object.freeze(response)}var mediaKindWireSchema=/* @__PURE__ */zod.z.enum(["webp","video"]),categoryWireSchema=/* @__PURE__ */zod.z.enum(["health","attention","moment","activity","mood","idle"]),petStateTierWireSchema=/* @__PURE__ */zod.z.object({url:/* @__PURE__ */zod.z.string(),kind:/* @__PURE__ */mediaKindWireSchema.default("webp"),loop_duration_ms:/* @__PURE__ */zod.z.number().nullish(),expires_at:/* @__PURE__ */zod.z.string(),cache_key:/* @__PURE__ */zod.z.string().nullish()}),petStateResponseWireSchema=/* @__PURE__ */zod.z.object({category:categoryWireSchema,tiers:/* @__PURE__ */zod.z.object({animation:/* @__PURE__ */petStateTierWireSchema.optional(),image:/* @__PURE__ */petStateTierWireSchema.optional()}).default({}),overlays:/* @__PURE__ */zod.z.object({weather_alert:/* @__PURE__ */petStateTierWireSchema.optional()}).default({}),idle:/* @__PURE__ */zod.z.literal("bundled").default("bundled"),ttl_seconds:/* @__PURE__ */zod.z.number(),degraded:/* @__PURE__ */zod.z.boolean().default(false),cache_epoch:/* @__PURE__ */zod.z.number().default(0)});function parsePetStateWire(raw){let parsed=petStateResponseWireSchema.safeParse(raw);return parsed.success?parsed.data:null}function createPetStateRepository(auth){return createPetStateRepositoryOver(createRequestFunnel({auth:auth}))}function createPetStateRepositoryOver(funnel){return{async getState(petRef,opts){if(hasLoneSurrogate(petRef))return err(makeEverfurError("validationFailed",{retryable:false,wireMessage:"pet_ref contains an unpaired surrogate and cannot be encoded"}));let path=`/widget/v1/pets/${encodeURIComponent(petRef)}/state`,res=await funnel.send("animations.getState",opts?.signal?{method:"GET",path:path,signal:opts.signal}:{method:"GET",path:path},opts?.maxAttempts!==void 0?{maxAttempts:opts.maxAttempts}:void 0);if(res.ok){let wire=parsePetStateWire(res.value);return wire===null?err(makeEverfurError("internalError",{retryable:true})):ok(mapPetStateResponse(wire))}return res.error.httpStatus===404?ok(null):err(res.error)}}}function stableMediaKey(source){if(source===void 0)return"bundled:none";if(typeof source=="number")return`bundled:${source}`;if("kind"in source)return`bundled:${source.id}`;let uri=source.uri,q=uri.indexOf("?");return q===-1?uri:uri.slice(0,q)}function selectTier(i){return i.hasPhoto&&!i.photoFailed?"photo":i.canAnimate&&!i.animationFailed?"animation":i.hasImage&&!i.imageFailed?"image":"idle"}function retireTier(current,failed){switch(current){case"photo":return{failed:freezeFailed({...failed,photo:true}),reason:"network_error"};case"animation":return{failed:freezeFailed({...failed,animation:true}),reason:"network_error"};case"image":return{failed:freezeFailed({...failed,image:true}),reason:"network_error"};case"idle":return{failed:freezeFailed(failed),reason:"idle_asset_failed"};default:return{failed:freezeFailed(failed),reason:"network_error"}}}var NO_FAILURES=/* @__PURE__ */Object.freeze({photo:false,animation:false,image:false});function freezeFailed(f){/* @__PURE__ */
|
|
104
104
|
return Object.freeze({photo:f.photo,animation:f.animation,image:f.image})}function isLoaderSafeCategory(category){switch(category){case"activity":case"mood":case"moment":case"idle":return true;case"health":case"attention":return false;default:return false}}var CACHE_EPOCH_STORAGE_KEY="everfur.petState.cacheEpoch";function createCacheEpochGuard(deps){let lastActed=0,loaded=false,inFlight=null,run=async serverEpoch=>{if(loaded||(lastActed=await readStoredEpoch(deps.kv),loaded=true),serverEpoch<=lastActed)return false;try{await deps.kv.setItem(CACHE_EPOCH_STORAGE_KEY,String(serverEpoch))}catch{}lastActed=serverEpoch;try{await deps.cache.clearMemoryCache()}catch{}try{await deps.cache.clearDiskCache()}catch{}return true};return{async sync(serverEpoch){return typeof serverEpoch!="number"||!Number.isFinite(serverEpoch)||serverEpoch<=0||loaded&&serverEpoch<=lastActed?false:inFlight||(inFlight=run(serverEpoch).finally(()=>{inFlight=null}),inFlight)}}}async function readStoredEpoch(kv){let raw;try{raw=await kv.getItem(CACHE_EPOCH_STORAGE_KEY)}catch{return 0}if(raw===null)return 0;let parsed=Number(raw);return Number.isFinite(parsed)&&parsed>0?parsed:0}var SUPPORTED_SCHEMA_VERSION=1,MANIFEST_LKG_STORAGE_KEY="everfur.manifest.lastKnownGood",COMPILED_DEFAULT_IDLE=/* @__PURE__ */Object.freeze({kind:"bundled",id:"everfur-idle"}),COMPILED_DEFAULT_MANIFEST=/* @__PURE__ */Object.freeze({schemaVersion:SUPPORTED_SCHEMA_VERSION,revision:"compiled-default",surfaces:/* @__PURE__ */Object.freeze({animations:/* @__PURE__ */Object.freeze({enabled:true,idle:COMPILED_DEFAULT_IDLE})})}),bundledIdleSchema=/* @__PURE__ */zod.z.object({kind:/* @__PURE__ */zod.z.literal("bundled"),id:/* @__PURE__ */zod.z.string().min(1)}),animationsSurfaceWireSchema=/* @__PURE__ */zod.z.object({enabled:/* @__PURE__ */zod.z.boolean().default(true),idle:/* @__PURE__ */bundledIdleSchema.optional()}),manifestWireSchema=/* @__PURE__ */zod.z.object({schema_version:/* @__PURE__ */zod.z.number().int(),revision:/* @__PURE__ */zod.z.string().default(""),surfaces:/* @__PURE__ */zod.z.object({animations:/* @__PURE__ */animationsSurfaceWireSchema.optional()}).default({})});function parseManifest(raw){let parsed=manifestWireSchema.safeParse(raw);if(!parsed.success)return{ok:false,reason:"unparseable"};if(parsed.data.schema_version>SUPPORTED_SCHEMA_VERSION)return{ok:false,reason:"newer_schema"};let animationsWire=parsed.data.surfaces.animations,surfaces={};return animationsWire&&(surfaces.animations=/* @__PURE__ */Object.freeze({enabled:animationsWire.enabled,idle:animationsWire.idle?/* @__PURE__ */Object.freeze({...animationsWire.idle}):COMPILED_DEFAULT_IDLE})),{ok:true,manifest:/* @__PURE__ */Object.freeze({schemaVersion:parsed.data.schema_version,revision:parsed.data.revision,surfaces:/* @__PURE__ */Object.freeze(surfaces)})}}async function resolveManifest(liveRaw,kv,tel){if(liveRaw!=null){let parsed=parseManifest(liveRaw);if(parsed.ok)return await writeLastKnownGood(kv,liveRaw),tel.track("manifest.fallback",{source:"live"}),/* @__PURE__ */Object.freeze({manifest:parsed.manifest,source:"live"});parsed.reason==="newer_schema"&&tel.track("manifest.refused_newer",{})}let lkg=await readLastKnownGood(kv);return lkg?(tel.track("manifest.fallback",{source:"last-known-good"}),/* @__PURE__ */Object.freeze({manifest:lkg,source:"last-known-good"})):(tel.track("manifest.fallback",{source:"compiled-default"}),/* @__PURE__ */Object.freeze({manifest:COMPILED_DEFAULT_MANIFEST,source:"compiled-default"}))}function animationsSurfaceOf(manifest){return manifest.surfaces.animations??COMPILED_DEFAULT_MANIFEST.surfaces.animations??{enabled:true,idle:COMPILED_DEFAULT_IDLE}}async function writeLastKnownGood(kv,raw){try{await kv.setItem(MANIFEST_LKG_STORAGE_KEY,JSON.stringify(raw))}catch{}}async function readLastKnownGood(kv){let stored;try{stored=await kv.getItem(MANIFEST_LKG_STORAGE_KEY)}catch{return null}if(stored===null)return null;let json;try{json=JSON.parse(stored)}catch{return null}let parsed=parseManifest(json);return parsed.ok?parsed.manifest:null}var EMPTY_SNAPSHOT=/* @__PURE__ */Object.freeze({data:null,isPending:false,isError:false,error:null,isDark:false});function createPetStateStore(deps){let{repo:repo,cacheEpoch:cacheEpoch,timers:timers}=deps,listeners=/* @__PURE__ */new Set,warm=/* @__PURE__ */new Map,snapshot=EMPTY_SNAPSHOT,currentPetRef=null,dataPetRef=null,isFocused=false,terminatedPetRef=null,remintHandle=null,inFlight=null,epoch=0,emit=()=>{for(let listener of listeners)listener()},patch=partial=>{snapshot=/* @__PURE__ */Object.freeze({...snapshot,...partial}),emit()},clearRemint=()=>{remintHandle!==null&&(timers.clearTimeout(remintHandle),remintHandle=null)},staleMs=data=>data?Math.max(1,data.ttlSeconds)*1e3:6e4,touchWarm=petRef=>{let entry=warm.get(petRef);entry!==void 0&&(warm.delete(petRef),warm.set(petRef,entry))},setWarm=(petRef,data)=>{for(warm.delete(petRef),warm.set(petRef,/* @__PURE__ */Object.freeze({data:data,fetchedAt:timers.now()}));warm.size>32;){let oldest=warm.keys().next().value;if(oldest===void 0||oldest===petRef)break;warm.delete(oldest)}},hasGoodTiers=petRef=>{let entry=warm.get(petRef);return entry?!!(entry.data.tiers.animation||entry.data.tiers.image):false},scheduleRemint=(petRef,ttlSeconds)=>{if(clearRemint(),!isFocused)return;let ms=Math.max(1,ttlSeconds)*1e3,scheduledEpoch=epoch;remintHandle=timers.setTimeout(()=>{remintHandle=null,!(scheduledEpoch!==epoch||currentPetRef!==petRef||!isFocused)&&fetchOnce(petRef,0)},ms)},fetchOnce=async(petRef,attempt)=>{if(currentPetRef!==petRef||terminatedPetRef===petRef||!isFocused)return;let myEpoch=epoch;inFlight?.abort();let ctrl=new AbortController;inFlight=ctrl;let res=await repo.getState(petRef,{signal:ctrl.signal});if(!(myEpoch!==epoch||currentPetRef!==petRef)){if(res.ok){let resp=res.value;if(resp===null){onTerminalDark(petRef);return}cacheEpoch.sync(resp.cacheEpoch);let respHasTiers=!!(resp.tiers.animation||resp.tiers.image);if(resp.degraded&&!respHasTiers&&hasGoodTiers(petRef)){patch({isError:false,error:null,isPending:false,isDark:false}),scheduleRemint(petRef,resp.ttlSeconds);return}setWarm(petRef,resp),dataPetRef=petRef,patch({data:resp,isPending:false,isError:false,error:null,isDark:false}),scheduleRemint(petRef,resp.ttlSeconds);return}if(isTerminalPetStateError(res.error)){onTerminalDisabled(petRef,res.error);return}if(patch({isError:true,error:res.error,isPending:snapshot.data===null&&dataPetRef!==petRef}),attempt<2){clearRemint();let backoff=500*(attempt+1),scheduledEpoch=epoch;remintHandle=timers.setTimeout(()=>{remintHandle=null,!(scheduledEpoch!==epoch||currentPetRef!==petRef||!isFocused)&&fetchOnce(petRef,attempt+1)},backoff)}else scheduleRemint(petRef,5)}},onTerminalDark=petRef=>{terminatedPetRef=petRef,warm.delete(petRef),clearRemint(),dataPetRef=petRef,patch({data:null,isPending:false,isError:false,error:null,isDark:true})},onTerminalDisabled=(petRef,error)=>{terminatedPetRef=petRef,warm.delete(petRef),clearRemint(),dataPetRef=petRef,patch({data:null,isPending:false,isError:false,error:error,isDark:true})};return{observe(petRef,opts){let focusChanged=opts.isFocused!==isFocused;if(isFocused=opts.isFocused,petRef!==currentPetRef){if(epoch+=1,inFlight?.abort(),inFlight=null,clearRemint(),terminatedPetRef=null,currentPetRef=petRef,petRef===null){dataPetRef=null,snapshot=EMPTY_SNAPSHOT,emit();return}let warmEntry=warm.get(petRef),fresh=warmEntry&&timers.now()-warmEntry.fetchedAt<staleMs(warmEntry.data)?warmEntry:null;fresh?(touchWarm(petRef),dataPetRef=petRef,patch({data:fresh.data,isPending:false,isError:false,error:null,isDark:false})):patch({isPending:true,isError:false,error:null,isDark:false}),isFocused&&fetchOnce(petRef,0);return}if(!focusChanged||petRef===null)return;if(!isFocused){clearRemint();return}let entry=warm.get(petRef);!entry||timers.now()-entry.fetchedAt>=staleMs(entry.data)?terminatedPetRef!==petRef&&fetchOnce(petRef,0):scheduleRemint(petRef,entry.data.ttlSeconds)},getSnapshot(){return snapshot},subscribe(listener){return listeners.add(listener),()=>{listeners.delete(listener)}},getCachedPetStateMedia(petRef){let entry=warm.get(petRef);return!entry||timers.now()-entry.fetchedAt>=staleMs(entry.data)?null:(touchWarm(petRef),entry.data)},dispose(){epoch+=1,inFlight?.abort(),inFlight=null,clearRemint(),listeners.clear(),warm.clear()}}}function isTerminalPetStateError(error){if(typeof error!="object"||error===null)return false;let record=error,status=typeof record.status=="number"?record.status:record.httpStatus;return status===403||status===404}var noopTelemetry=/* @__PURE__ */Object.freeze({track(){},trackExpectedFailure(){}});function createAnimationController(deps){let telemetry=deps.telemetry??noopTelemetry,timers=deps.timers??defaultTimers(deps.now),store=createPetStateStore({repo:deps.repo,cacheEpoch:createCacheEpochGuard({kv:deps.kv,cache:deps.cache}),timers:timers}),listeners=/* @__PURE__ */new Set,failed=NO_FAILURES,fallbackReason="none",paused=false,photoUrl=null,lastData=null,lastDark=false,dataToken=0,lastShownKey="",view=pendingView(surface()),disposed=false;function surface(){let manifest=deps.manifest?deps.manifest():COMPILED_DEFAULT_MANIFEST;return animationsSurfaceOf(manifest)}let emit=()=>{for(let listener of listeners)listener()},unsubscribeStore=store.subscribe(()=>{onStoreChange()});function onStoreChange(){let snap=store.getSnapshot();(snap.data!==lastData||snap.isDark!==lastDark)&&(lastData=snap.data,lastDark=snap.isDark,failed=NO_FAILURES,fallbackReason=snap.isDark?"dark_or_missing":"none",dataToken+=1),recompute(snap)}function recompute(snap=store.getSnapshot()){let surf=surface(),next=buildView(surf,snap,{failed:failed,fallbackReason:fallbackReason,paused:paused,photoUrl:photoUrl,reducedMotion:deps.reducedMotion()});view=next,maybeEmitShown(next),emit()}function maybeEmitShown(next){if(next.kind!=="ready")return;let key=`${next.category}|${next.tier}|${next.fallbackReason}|${next.reducedMotion?1:0}`;key!==lastShownKey&&(lastShownKey=key,telemetry.track("pet_state_shown",{category:next.category,tier:next.tier,fallback_reason:next.fallbackReason,reduced_motion:next.reducedMotion}),next.fallbackReason==="idle_asset_failed"&&telemetry.trackExpectedFailure("idle_asset_failed",{category:next.category}))}return{observe(petRef,opts){disposed||(photoUrl=opts.photoUrl??null,failed=NO_FAILURES,store.observe(petRef,{isFocused:opts.isFocused}),onStoreChange())},getState(){return view},subscribe(listener){return listeners.add(listener),()=>{listeners.delete(listener)}},onMediaError(){if(disposed||view.kind!=="ready")return;let retired=retireTier(view.tier,failed);failed=retired.failed,fallbackReason=retired.reason,recompute()},setPaused(next){disposed||paused===next||(paused=next,recompute())},dispose(){disposed||(disposed=true,unsubscribeStore(),store.dispose(),listeners.clear())}}}function buildView(surf,snap,inputs){let idleSource=surf.idle;if(!surf.enabled)/* @__PURE__ */
|
|
105
105
|
return Object.freeze({kind:"disabled",reason:userFacingError("accessDenied"),level:"partner_config",source:idleSource,idle:surf.idle});if(snap.isPending&&snap.data===null&&!snap.isDark)/* @__PURE__ */
|
|
106
106
|
return Object.freeze({kind:"pending",showSkeleton:true,source:idleSource});let data=snap.data,category=data?.category??"idle",animation=data?.tiers.animation,image=data?.tiers.image,canAnimate=!!animation&&animation?.kind==="webp"&&!inputs.reducedMotion&&!inputs.failed.animation,tier=selectTier({hasPhoto:inputs.photoUrl!==null&&inputs.photoUrl.length>0,photoFailed:inputs.failed.photo,canAnimate:canAnimate,animationFailed:inputs.failed.animation,hasImage:!!image,imageFailed:inputs.failed.image}),source=idleSource,loopDurationMs=null,cacheHit=false;tier==="photo"&&inputs.photoUrl?source=uriSource(inputs.photoUrl,void 0):tier==="animation"&&animation?(source=uriSource(animation.url,animation.cacheKey),loopDurationMs=animation.loopDurationMs??null,cacheHit=animation.cacheKey!==void 0):tier==="image"&&image&&(source=uriSource(image.url,image.cacheKey),cacheHit=image.cacheKey!==void 0);let recyclingKey=source.kind==="uri"?source.cacheKey:`bundled:${source.id}`;/* @__PURE__ */
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { StyleProp, ViewStyle } from 'react-native';
|
|
3
3
|
import { E as EverfurResult } from '../EverfurResult.d-BFH-3s6E.cjs';
|
|
4
|
-
import { A as AuthContext } from '../identity.d-
|
|
5
|
-
export { I as IdentityProvider, n as newSessionId } from '../identity.d-
|
|
4
|
+
import { A as AuthContext } from '../identity.d-CioQhZrq.cjs';
|
|
5
|
+
export { I as IdentityProvider, n as newSessionId } from '../identity.d-CioQhZrq.cjs';
|
|
6
6
|
import { P as PetRef } from '../ids.d-B2GAAifq.cjs';
|
|
7
7
|
export { B as Brand, U as UserRef, _ as __brand } from '../ids.d-B2GAAifq.cjs';
|
|
8
8
|
import { z } from 'zod';
|
|
@@ -13,7 +13,7 @@ import { E as EverfurError } from '../EverfurError.d-8NHtlgzA.cjs';
|
|
|
13
13
|
export { a as EverfurErrorCategory, b as EverfurErrorCode } from '../EverfurError.d-8NHtlgzA.cjs';
|
|
14
14
|
import { D as DisabledLevel, a as CapabilityDecision } from '../resolve.d-CoQWUy1Y.cjs';
|
|
15
15
|
export { b as CapabilityDisabled, C as CapabilityName } from '../resolve.d-CoQWUy1Y.cjs';
|
|
16
|
-
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.d-
|
|
16
|
+
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.d-C0WgjutL.cjs';
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* The full /state payload. `degraded` + `cache_epoch` + `cache_key` are additive fields an older backend
|
|
@@ -249,6 +249,8 @@ interface PetStateRepository {
|
|
|
249
249
|
*/
|
|
250
250
|
getState(petRef: PetRef, opts?: {
|
|
251
251
|
signal?: AbortSignal;
|
|
252
|
+
/** Attempt ceiling for this read (a reader that keeps its own retry schedule passes 1). */
|
|
253
|
+
maxAttempts?: number;
|
|
252
254
|
}): Promise<EverfurResult<PetStateResponse | null>>;
|
|
253
255
|
}
|
|
254
256
|
/** Build the repository over a device AuthContext (personalized bearer XOR anonymous pk). */
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { StyleProp, ViewStyle } from 'react-native';
|
|
3
3
|
import { E as EverfurResult } from '../EverfurResult.d-D_-254ZY.js';
|
|
4
|
-
import { A as AuthContext } from '../identity.d-
|
|
5
|
-
export { I as IdentityProvider, n as newSessionId } from '../identity.d-
|
|
4
|
+
import { A as AuthContext } from '../identity.d-BksOEa6m.js';
|
|
5
|
+
export { I as IdentityProvider, n as newSessionId } from '../identity.d-BksOEa6m.js';
|
|
6
6
|
import { P as PetRef } from '../ids.d-B2GAAifq.js';
|
|
7
7
|
export { B as Brand, U as UserRef, _ as __brand } from '../ids.d-B2GAAifq.js';
|
|
8
8
|
import { z } from 'zod';
|
|
@@ -13,7 +13,7 @@ import { E as EverfurError } from '../EverfurError.d-8NHtlgzA.js';
|
|
|
13
13
|
export { a as EverfurErrorCategory, b as EverfurErrorCode } from '../EverfurError.d-8NHtlgzA.js';
|
|
14
14
|
import { D as DisabledLevel, a as CapabilityDecision } from '../resolve.d-CoQWUy1Y.js';
|
|
15
15
|
export { b as CapabilityDisabled, C as CapabilityName } from '../resolve.d-CoQWUy1Y.js';
|
|
16
|
-
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.d-
|
|
16
|
+
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.d-zd2eTb2L.js';
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* The full /state payload. `degraded` + `cache_epoch` + `cache_key` are additive fields an older backend
|
|
@@ -249,6 +249,8 @@ interface PetStateRepository {
|
|
|
249
249
|
*/
|
|
250
250
|
getState(petRef: PetRef, opts?: {
|
|
251
251
|
signal?: AbortSignal;
|
|
252
|
+
/** Attempt ceiling for this read (a reader that keeps its own retry schedule passes 1). */
|
|
253
|
+
maxAttempts?: number;
|
|
252
254
|
}): Promise<EverfurResult<PetStateResponse | null>>;
|
|
253
255
|
}
|
|
254
256
|
/** Build the repository over a device AuthContext (personalized bearer XOR anonymous pk). */
|
package/dist/animations/index.js
CHANGED
|
@@ -100,7 +100,7 @@ return Object.freeze({ok:false,error:error})}var EverfurConfigError=class _Everf
|
|
|
100
100
|
return jsx(View,{style:[styles.offstate,style],accessible:true,accessibilityState:{busy:true},accessibilityLabel:`Loading ${capability}`,children:/* @__PURE__ */jsx(View,{style:styles.skeletonBar})})}function OffState({decision:decision,style:style}){let theme=useEverfurTheme(),styles=useMemo(()=>makeStyles(theme),[theme]),message=decision.disabled?.reason??"";/* @__PURE__ */
|
|
101
101
|
return jsx(View,{style:[styles.offstate,style],accessible:true,accessibilityRole:"text",accessibilityLabel:message,children:message.length>0?/* @__PURE__ */jsx(Text,{style:styles.offstateText,children:message}):null})}function makeStyles(theme){let{color:color,space:space,radius:radius,type:type}=theme;return StyleSheet.create({offstate:{minHeight:MIN_OFFSTATE_HEIGHT,justifyContent:"center",paddingHorizontal:space.lg,paddingVertical:space.md,backgroundColor:color.surfaceCream,borderRadius:radius.md,borderWidth:StyleSheet.hairlineWidth,borderColor:color.brandBorder},offstateText:{...face(theme,"regular"),fontSize:type.size.body,lineHeight:Math.round(type.size.body*type.lineHeight.normal),color:color.text.muted},skeletonBar:{height:space.md,borderRadius:radius.xs,backgroundColor:color.brandSofter}})}function mintFailedError(cause,refusal){let message=cause instanceof Error?cause.message:typeof cause=="string"?cause:null;return makeEverfurError("authRejected",{retryable:false,...refusal?.wireCode?{wireCode:refusal.wireCode}:{},...refusal?.requestId?{requestId:refusal.requestId}:{},...message?{wireMessage:message}:{},...cause!=null?{raw:cause}:{}})}function newSessionId(){let bytes=new Uint8Array(16),cryptoObj=globalThis.crypto;if(typeof cryptoObj?.getRandomValues=="function")cryptoObj.getRandomValues(bytes);else for(let i=0;i<bytes.length;i+=1)bytes[i]=Math.floor(Math.random()*256);bytes[6]=bytes[6]&15|64,bytes[8]=bytes[8]&63|128;let hex=[];for(let i=0;i<bytes.length;i+=1)hex.push(bytes[i].toString(16).padStart(2,"0"));return hex.slice(0,4).join("")+"-"+hex.slice(4,6).join("")+"-"+hex.slice(6,8).join("")+"-"+hex.slice(8,10).join("")+"-"+hex.slice(10,16).join("")}function authHeaders(auth){let headers={};return auth.mode==="personalized"?headers.authorization=`Bearer ${auth.token}`:headers["x-everfur-partner-key"]=auth.publishableKey,auth.userRef&&(headers["x-everfur-user-ref"]=auth.userRef),auth.sessionId&&(headers["x-everfur-session-id"]=auth.sessionId),headers}function withAuthHeaders(req,auth){return{...req,headers:{...stripAuthHeaders(req.headers),...authHeaders(auth)}}}function stripAuthHeaders(headers){if(!headers)return{};let out={};for(let[key,value]of Object.entries(headers)){let lower=key.toLowerCase();lower==="authorization"||lower==="x-everfur-partner-key"||(out[key]=value)}return out}async function authedSend(req,ctx){if(ctx.mode==="anonymous")return ctx.transport.request(withAuthHeaders(req,{mode:"anonymous",publishableKey:ctx.publishableKey,userRef:ctx.userRef,...ctx.sessionId?{sessionId:ctx.sessionId}:{}}));let token;try{token=await ctx.identity.currentToken()}catch(cause){return ctx.identity.reportRejected?.(),err(mintFailedError(cause))}let first=await ctx.transport.request(withAuthHeaders(req,{mode:"personalized",token:token,userRef:ctx.userRef,...ctx.sessionId?{sessionId:ctx.sessionId}:{}}));if(first.ok||first.error.httpStatus!==401)return first;let refreshed;try{refreshed=await ctx.identity.currentToken({forceRefresh:!0})}catch(cause){return ctx.identity.reportRejected?.(),err(mintFailedError(cause,{wireCode:wireCodeOf(first.error.raw),requestId:first.error.requestId}))}let retry=await ctx.transport.request(withAuthHeaders(req,{mode:"personalized",token:refreshed,userRef:ctx.userRef,...ctx.sessionId?{sessionId:ctx.sessionId}:{}}));return!retry.ok&&retry.error.httpStatus===401?(ctx.identity.reportRejected?.(),err(refusedAfterRemintError(retry.error))):retry}function refusedAfterRemintError(refusal){let raw=refusal.raw,wireCode=wireCodeOf(raw);return makeEverfurError("authRejected",{retryable:false,...refusal.httpStatus!==void 0?{httpStatus:refusal.httpStatus}:{},...refusal.requestId?{requestId:refusal.requestId}:{},...wireCode?{wireCode:wireCode}:{},...refusal.reasonCode?{reasonCode:refusal.reasonCode}:{},...refusal.wireMessage?{wireMessage:refusal.wireMessage}:{},...raw!=null?{raw:raw}:{}})}function wireCodeOf(body){if(typeof body!="object"||body===null)return null;let b=body,code=(typeof b.error=="object"&&b.error!==null?b.error.code:void 0)??b.code;return typeof code=="string"&&code.length>0?code:null}function networkError(cause){return makeEverfurError("internalError",{retryable:true,wireMessage:describeCause(cause)})}function describeCause(cause){return cause instanceof Error?cause.message:typeof cause=="string"?cause:"network request failed"}var FUNNEL_UNARY_TIMEOUT_MS=3e4,RETRY_OVERRIDE_MAX_MS=BACKOFF_CAP_MS*2,IDEMPOTENCY_HEADER="idempotency-key",MUTATING_METHODS=/* @__PURE__ */new Set(["POST","PUT","PATCH","DELETE"]),NOOP_OBSERVER=/* @__PURE__ */Object.freeze({onEvent(){}}),defaultFunnelTimers=/* @__PURE__ */Object.freeze({setTimeout:(handler,ms)=>setTimeout(handler,ms),clearTimeout:handle=>clearTimeout(handle),now:()=>Date.now()});function seededIdempotencyKey(seed){let safe=seed.trim().replace(/[^A-Za-z0-9_.:-]/g,"-");return safe.length===0?null:`efs_${safe}`.slice(0,128)}function createRequestFunnel(deps){let observer=deps.observer??NOOP_OBSERVER,timers=deps.timers??defaultFunnelTimers,rng=deps.rng??Math.random,sleep=deps.sleep??((ms,signal)=>delayAbortable(ms,timers,signal)),ceiling=deps.maxAttempts??MAX_RETRY_ATTEMPTS,timeoutMs=deps.unaryTimeoutMs??FUNNEL_UNARY_TIMEOUT_MS,mintKey=deps.newIdempotencyKey??defaultIdempotencyKeyFactory(),emit=event=>{try{observer.onEvent(event)}catch{}};async function send(call,req,opts){let perCallMaxAttempts=opts?.maxAttempts,maxAttempts=Math.max(1,perCallMaxAttempts??ceiling),idempotent=opts?.idempotent??MUTATING_METHODS.has(req.method),seeded=opts?.idempotencyKey===void 0?null:seededIdempotencyKey(opts.idempotencyKey),idempotencyKey=idempotent?seeded??mintKey():null,base=assembleHeaders(req,idempotencyKey),attempt=0;for(;;){let stamp=extra=>/* @__PURE__ */Object.freeze({call:call,method:req.method,path:req.path,attempt:attempt,...idempotencyKey?{idempotencyKey:idempotencyKey}:{},...extra});emit(stamp({phase:"attempt"}));let deadline=boundedSignal(timeoutMs,timers),merged=mergeSignals(deadline.signal,req.signal),settled;try{settled=await authedSend({...base,signal:merged.signal},deps.auth)}catch(cause){settled=err(networkError(cause))}finally{merged.dispose(),deadline.cancel()}if(settled.ok)return emit(stamp({phase:"settled",ok:true,reason:"ok"})),settled;let error=settled.error,decision=decideRetry(error,attempt,{maxAttempts:maxAttempts,rng:rng,now:timers.now(),aborted:req.signal?.aborted===true,...perCallMaxAttempts!==void 0?{perCallMaxAttempts:perCallMaxAttempts}:{},...deps.errorPolicy!==void 0?{policy:deps.errorPolicy}:{}}),settledEvent={ok:false,code:error.code,reason:decision.reason,...error.httpStatus!==void 0?{httpStatus:error.httpStatus}:{},...error.requestId!==void 0?{requestId:error.requestId}:{}};if(!decision.retry)return emit(stamp({phase:"settled",...settledEvent})),err(error);if(emit(stamp({phase:"retry",...settledEvent,delayMs:decision.delayMs})),await sleep(decision.delayMs,req.signal),req.signal?.aborted===true)return emit(stamp({phase:"settled",...settledEvent,reason:"aborted"})),err(error);attempt+=1}}async function authorize(req){return withAuthHeaders(req,await resolveDeviceAuth(deps.auth))}async function*stream(call,req,signal){emit(
|
|
102
102
|
/* @__PURE__ */Object.freeze({call:call,phase:"stream.open",method:req.method,path:req.path,attempt:0}));try{yield*deps.auth.transport.stream(req,signal)}catch{yield errorFrame({code:"internal_error",retryable:true,wireMessage:null,synthesized:true,lastEventId:null})}}/* @__PURE__ */
|
|
103
|
-
return Object.freeze({send:send,authorize:authorize,stream:stream})}function assembleHeaders(req,idempotencyKey){let headers={};for(let[key,value]of Object.entries(req.headers??{}))key.toLowerCase()!==IDEMPOTENCY_HEADER&&(headers[key]=value);return idempotencyKey!==null&&(headers["Idempotency-Key"]=idempotencyKey),{...req,headers:headers}}function defaultIdempotencyKeyFactory(){let counter=0;return()=>`efk_${Date.now().toString(36)}_${(counter++).toString(36)}_${Math.random().toString(36).slice(2,12)}`}var POLICY_MAX_ATTEMPTS_CAP=10;function decideRetry(error,attempt,ctx){if(ctx.aborted)return{retry:false,reason:"aborted"};let throttle=throttleKind(error);if(throttle==="quota")return{retry:false,reason:"daily-quota-exhausted"};if(throttle!=="burst"&&!isAutoRetryable(error.code))return{retry:false,reason:"terminal-code"};let reason=throttle==="burst"?"burst-throttle":"retryable-code";if((()=>{if(ctx.policy===void 0)return false;try{return!ctx.policy.shouldRetry(error.code,attempt)}catch{return false}})())return{retry:false,reason:"terminal-code"};let policyCeiling=()=>{if(ctx.policy===void 0)return null;let raw;try{raw=ctx.policy.maxAttempts(error.code)}catch{return null}return typeof raw!="number"||!Number.isFinite(raw)?null:Math.max(1,Math.min(POLICY_MAX_ATTEMPTS_CAP,Math.floor(raw)))},ceiling=ctx.perCallMaxAttempts??policyCeiling()??ctx.maxAttempts;if(attempt+1>=ceiling)return{retry:false,reason:"attempts-exhausted"};let override=retryOverrideMs(error,ctx.now);return override!==null?override>RETRY_OVERRIDE_MAX_MS?{retry:false,reason:"server-reset-beyond-budget"}:{retry:true,reason:reason,delayMs:override}:{retry:true,reason:reason,delayMs:backoffDelayMs(attempt,ctx.rng)}}function throttleKind(error){let code=error.code==="unknown"?fromWire(rawWireCode(error.raw)):error.code;return code==="quotaExceeded"?"quota":code==="rateLimited"||error.httpStatus===429?"burst":null}function retryOverrideMs(error,now){let at=findResetsAt(error.raw);if(at!==null){let delta=at-now;return delta>0?delta:0}let wait=findRetryAfterSeconds(error.raw);return wait===null?null:Math.round(wait*1e3)}function findRetryAfterSeconds(raw){for(let scope of candidateScopes(raw)){let value=scope.retry_after_seconds;if(typeof value=="number"&&Number.isFinite(value)&&value>=0)return value}return null}function findResetsAt(raw){for(let scope of candidateScopes(raw)){let value=scope.resets_at,parsed=parseInstantMs(value);if(parsed!==null)return parsed}return null}function candidateScopes(raw){if(!isRecord(raw))return[];let out=[raw];for(let nested of["error","detail"]){let value=raw[nested];isRecord(value)&&out.push(value)}return out}function parseInstantMs(value){if(typeof value=="number"&&Number.isFinite(value))return value<1e11?Math.round(value*1e3):Math.round(value);if(typeof value=="string"&&value.trim().length>0){let parsed=Date.parse(value);return Number.isFinite(parsed)?parsed:null}return null}function rawWireCode(raw){for(let scope of candidateScopes(raw)){let code=scope.code;if(typeof code=="string"&&code.length>0)return code}return null}function isRecord(value){return typeof value=="object"&&value!==null}async function resolveDeviceAuth(auth){return auth.mode==="anonymous"?{mode:"anonymous",publishableKey:auth.publishableKey,userRef:auth.userRef,...auth.sessionId?{sessionId:auth.sessionId}:{}}:{mode:"personalized",token:await auth.identity.currentToken(),userRef:auth.userRef,...auth.sessionId?{sessionId:auth.sessionId}:{}}}function boundedSignal(ms,timers){let ctrl=new AbortController,handle=timers.setTimeout(()=>ctrl.abort(),ms);return{signal:ctrl.signal,cancel:()=>timers.clearTimeout(handle)}}function mergeSignals(deadline,caller){let noop=()=>{};if(!caller)return{signal:deadline,dispose:noop};let ctrl=new AbortController;if(deadline.aborted||caller.aborted)return ctrl.abort(),{signal:ctrl.signal,dispose:noop};let onAbort=()=>ctrl.abort();return deadline.addEventListener("abort",onAbort,{once:true}),caller.addEventListener("abort",onAbort,{once:true}),{signal:ctrl.signal,dispose:()=>{deadline.removeEventListener("abort",onAbort),caller.removeEventListener("abort",onAbort)}}}function delayAbortable(ms,timers,signal){return ms<=0||signal?.aborted===true?Promise.resolve():new Promise(resolve=>{let handle=timers.setTimeout(()=>{signal?.removeEventListener("abort",onAbort),resolve()},ms),onAbort=()=>{timers.clearTimeout(handle),resolve()};signal?.addEventListener("abort",onAbort,{once:true})})}function hasLoneSurrogate(value){for(let i=0;i<value.length;i+=1){let code=value.charCodeAt(i);if(code>=55296&&code<=56319){let low=value.charCodeAt(i+1);if(!(low>=56320&&low<=57343))return true;i+=1}else if(code>=56320&&code<=57343)return true}return false}function mapTier(wire){let tier={url:wire.url,kind:wire.kind,expiresAt:wire.expires_at};return typeof wire.loop_duration_ms=="number"&&(tier.loopDurationMs=wire.loop_duration_ms),typeof wire.cache_key=="string"&&wire.cache_key.length>0&&(tier.cacheKey=wire.cache_key),/* @__PURE__ */Object.freeze(tier)}function mapPetStateResponse(wire){let tiers={};wire.tiers.animation&&(tiers.animation=mapTier(wire.tiers.animation)),wire.tiers.image&&(tiers.image=mapTier(wire.tiers.image));let overlays={};wire.overlays.weather_alert&&(overlays.weatherAlert=mapTier(wire.overlays.weather_alert));let response={category:wire.category,tiers:/* @__PURE__ */Object.freeze(tiers),overlays:/* @__PURE__ */Object.freeze(overlays),idle:"bundled",ttlSeconds:wire.ttl_seconds,degraded:wire.degraded};return typeof wire.cache_epoch=="number"&&(response.cacheEpoch=wire.cache_epoch),/* @__PURE__ */Object.freeze(response)}var mediaKindWireSchema=/* @__PURE__ */z.enum(["webp","video"]),categoryWireSchema=/* @__PURE__ */z.enum(["health","attention","moment","activity","mood","idle"]),petStateTierWireSchema=/* @__PURE__ */z.object({url:/* @__PURE__ */z.string(),kind:/* @__PURE__ */mediaKindWireSchema.default("webp"),loop_duration_ms:/* @__PURE__ */z.number().nullish(),expires_at:/* @__PURE__ */z.string(),cache_key:/* @__PURE__ */z.string().nullish()}),petStateResponseWireSchema=/* @__PURE__ */z.object({category:categoryWireSchema,tiers:/* @__PURE__ */z.object({animation:/* @__PURE__ */petStateTierWireSchema.optional(),image:/* @__PURE__ */petStateTierWireSchema.optional()}).default({}),overlays:/* @__PURE__ */z.object({weather_alert:/* @__PURE__ */petStateTierWireSchema.optional()}).default({}),idle:/* @__PURE__ */z.literal("bundled").default("bundled"),ttl_seconds:/* @__PURE__ */z.number(),degraded:/* @__PURE__ */z.boolean().default(false),cache_epoch:/* @__PURE__ */z.number().default(0)});function parsePetStateWire(raw){let parsed=petStateResponseWireSchema.safeParse(raw);return parsed.success?parsed.data:null}function createPetStateRepository(auth){return createPetStateRepositoryOver(createRequestFunnel({auth:auth}))}function createPetStateRepositoryOver(funnel){return{async getState(petRef,opts){if(hasLoneSurrogate(petRef))return err(makeEverfurError("validationFailed",{retryable:false,wireMessage:"pet_ref contains an unpaired surrogate and cannot be encoded"}));let path=`/widget/v1/pets/${encodeURIComponent(petRef)}/state`,res=await funnel.send("animations.getState",opts?.signal?{method:"GET",path:path,signal:opts.signal}:{method:"GET",path:path});if(res.ok){let wire=parsePetStateWire(res.value);return wire===null?err(makeEverfurError("internalError",{retryable:true})):ok(mapPetStateResponse(wire))}return res.error.httpStatus===404?ok(null):err(res.error)}}}function stableMediaKey(source){if(source===void 0)return"bundled:none";if(typeof source=="number")return`bundled:${source}`;if("kind"in source)return`bundled:${source.id}`;let uri=source.uri,q=uri.indexOf("?");return q===-1?uri:uri.slice(0,q)}function selectTier(i){return i.hasPhoto&&!i.photoFailed?"photo":i.canAnimate&&!i.animationFailed?"animation":i.hasImage&&!i.imageFailed?"image":"idle"}function retireTier(current,failed){switch(current){case"photo":return{failed:freezeFailed({...failed,photo:true}),reason:"network_error"};case"animation":return{failed:freezeFailed({...failed,animation:true}),reason:"network_error"};case"image":return{failed:freezeFailed({...failed,image:true}),reason:"network_error"};case"idle":return{failed:freezeFailed(failed),reason:"idle_asset_failed"};default:return{failed:freezeFailed(failed),reason:"network_error"}}}var NO_FAILURES=/* @__PURE__ */Object.freeze({photo:false,animation:false,image:false});function freezeFailed(f){/* @__PURE__ */
|
|
103
|
+
return Object.freeze({send:send,authorize:authorize,stream:stream})}function assembleHeaders(req,idempotencyKey){let headers={};for(let[key,value]of Object.entries(req.headers??{}))key.toLowerCase()!==IDEMPOTENCY_HEADER&&(headers[key]=value);return idempotencyKey!==null&&(headers["Idempotency-Key"]=idempotencyKey),{...req,headers:headers}}function defaultIdempotencyKeyFactory(){let counter=0;return()=>`efk_${Date.now().toString(36)}_${(counter++).toString(36)}_${Math.random().toString(36).slice(2,12)}`}var POLICY_MAX_ATTEMPTS_CAP=10;function decideRetry(error,attempt,ctx){if(ctx.aborted)return{retry:false,reason:"aborted"};let throttle=throttleKind(error);if(throttle==="quota")return{retry:false,reason:"daily-quota-exhausted"};if(throttle!=="burst"&&!isAutoRetryable(error.code))return{retry:false,reason:"terminal-code"};let reason=throttle==="burst"?"burst-throttle":"retryable-code";if((()=>{if(ctx.policy===void 0)return false;try{return!ctx.policy.shouldRetry(error.code,attempt)}catch{return false}})())return{retry:false,reason:"terminal-code"};let policyCeiling=()=>{if(ctx.policy===void 0)return null;let raw;try{raw=ctx.policy.maxAttempts(error.code)}catch{return null}return typeof raw!="number"||!Number.isFinite(raw)?null:Math.max(1,Math.min(POLICY_MAX_ATTEMPTS_CAP,Math.floor(raw)))},ceiling=ctx.perCallMaxAttempts??policyCeiling()??ctx.maxAttempts;if(attempt+1>=ceiling)return{retry:false,reason:"attempts-exhausted"};let override=retryOverrideMs(error,ctx.now);return override!==null?override>RETRY_OVERRIDE_MAX_MS?{retry:false,reason:"server-reset-beyond-budget"}:{retry:true,reason:reason,delayMs:override}:{retry:true,reason:reason,delayMs:backoffDelayMs(attempt,ctx.rng)}}function throttleKind(error){let code=error.code==="unknown"?fromWire(rawWireCode(error.raw)):error.code;return code==="quotaExceeded"?"quota":code==="rateLimited"||error.httpStatus===429?"burst":null}function retryOverrideMs(error,now){let at=findResetsAt(error.raw);if(at!==null){let delta=at-now;return delta>0?delta:0}let wait=findRetryAfterSeconds(error.raw);return wait===null?null:Math.round(wait*1e3)}function findRetryAfterSeconds(raw){for(let scope of candidateScopes(raw)){let value=scope.retry_after_seconds;if(typeof value=="number"&&Number.isFinite(value)&&value>=0)return value}return null}function findResetsAt(raw){for(let scope of candidateScopes(raw)){let value=scope.resets_at,parsed=parseInstantMs(value);if(parsed!==null)return parsed}return null}function candidateScopes(raw){if(!isRecord(raw))return[];let out=[raw];for(let nested of["error","detail"]){let value=raw[nested];isRecord(value)&&out.push(value)}return out}function parseInstantMs(value){if(typeof value=="number"&&Number.isFinite(value))return value<1e11?Math.round(value*1e3):Math.round(value);if(typeof value=="string"&&value.trim().length>0){let parsed=Date.parse(value);return Number.isFinite(parsed)?parsed:null}return null}function rawWireCode(raw){for(let scope of candidateScopes(raw)){let code=scope.code;if(typeof code=="string"&&code.length>0)return code}return null}function isRecord(value){return typeof value=="object"&&value!==null}async function resolveDeviceAuth(auth){return auth.mode==="anonymous"?{mode:"anonymous",publishableKey:auth.publishableKey,userRef:auth.userRef,...auth.sessionId?{sessionId:auth.sessionId}:{}}:{mode:"personalized",token:await auth.identity.currentToken(),userRef:auth.userRef,...auth.sessionId?{sessionId:auth.sessionId}:{}}}function boundedSignal(ms,timers){let ctrl=new AbortController,handle=timers.setTimeout(()=>ctrl.abort(),ms);return{signal:ctrl.signal,cancel:()=>timers.clearTimeout(handle)}}function mergeSignals(deadline,caller){let noop=()=>{};if(!caller)return{signal:deadline,dispose:noop};let ctrl=new AbortController;if(deadline.aborted||caller.aborted)return ctrl.abort(),{signal:ctrl.signal,dispose:noop};let onAbort=()=>ctrl.abort();return deadline.addEventListener("abort",onAbort,{once:true}),caller.addEventListener("abort",onAbort,{once:true}),{signal:ctrl.signal,dispose:()=>{deadline.removeEventListener("abort",onAbort),caller.removeEventListener("abort",onAbort)}}}function delayAbortable(ms,timers,signal){return ms<=0||signal?.aborted===true?Promise.resolve():new Promise(resolve=>{let handle=timers.setTimeout(()=>{signal?.removeEventListener("abort",onAbort),resolve()},ms),onAbort=()=>{timers.clearTimeout(handle),resolve()};signal?.addEventListener("abort",onAbort,{once:true})})}function hasLoneSurrogate(value){for(let i=0;i<value.length;i+=1){let code=value.charCodeAt(i);if(code>=55296&&code<=56319){let low=value.charCodeAt(i+1);if(!(low>=56320&&low<=57343))return true;i+=1}else if(code>=56320&&code<=57343)return true}return false}function mapTier(wire){let tier={url:wire.url,kind:wire.kind,expiresAt:wire.expires_at};return typeof wire.loop_duration_ms=="number"&&(tier.loopDurationMs=wire.loop_duration_ms),typeof wire.cache_key=="string"&&wire.cache_key.length>0&&(tier.cacheKey=wire.cache_key),/* @__PURE__ */Object.freeze(tier)}function mapPetStateResponse(wire){let tiers={};wire.tiers.animation&&(tiers.animation=mapTier(wire.tiers.animation)),wire.tiers.image&&(tiers.image=mapTier(wire.tiers.image));let overlays={};wire.overlays.weather_alert&&(overlays.weatherAlert=mapTier(wire.overlays.weather_alert));let response={category:wire.category,tiers:/* @__PURE__ */Object.freeze(tiers),overlays:/* @__PURE__ */Object.freeze(overlays),idle:"bundled",ttlSeconds:wire.ttl_seconds,degraded:wire.degraded};return typeof wire.cache_epoch=="number"&&(response.cacheEpoch=wire.cache_epoch),/* @__PURE__ */Object.freeze(response)}var mediaKindWireSchema=/* @__PURE__ */z.enum(["webp","video"]),categoryWireSchema=/* @__PURE__ */z.enum(["health","attention","moment","activity","mood","idle"]),petStateTierWireSchema=/* @__PURE__ */z.object({url:/* @__PURE__ */z.string(),kind:/* @__PURE__ */mediaKindWireSchema.default("webp"),loop_duration_ms:/* @__PURE__ */z.number().nullish(),expires_at:/* @__PURE__ */z.string(),cache_key:/* @__PURE__ */z.string().nullish()}),petStateResponseWireSchema=/* @__PURE__ */z.object({category:categoryWireSchema,tiers:/* @__PURE__ */z.object({animation:/* @__PURE__ */petStateTierWireSchema.optional(),image:/* @__PURE__ */petStateTierWireSchema.optional()}).default({}),overlays:/* @__PURE__ */z.object({weather_alert:/* @__PURE__ */petStateTierWireSchema.optional()}).default({}),idle:/* @__PURE__ */z.literal("bundled").default("bundled"),ttl_seconds:/* @__PURE__ */z.number(),degraded:/* @__PURE__ */z.boolean().default(false),cache_epoch:/* @__PURE__ */z.number().default(0)});function parsePetStateWire(raw){let parsed=petStateResponseWireSchema.safeParse(raw);return parsed.success?parsed.data:null}function createPetStateRepository(auth){return createPetStateRepositoryOver(createRequestFunnel({auth:auth}))}function createPetStateRepositoryOver(funnel){return{async getState(petRef,opts){if(hasLoneSurrogate(petRef))return err(makeEverfurError("validationFailed",{retryable:false,wireMessage:"pet_ref contains an unpaired surrogate and cannot be encoded"}));let path=`/widget/v1/pets/${encodeURIComponent(petRef)}/state`,res=await funnel.send("animations.getState",opts?.signal?{method:"GET",path:path,signal:opts.signal}:{method:"GET",path:path},opts?.maxAttempts!==void 0?{maxAttempts:opts.maxAttempts}:void 0);if(res.ok){let wire=parsePetStateWire(res.value);return wire===null?err(makeEverfurError("internalError",{retryable:true})):ok(mapPetStateResponse(wire))}return res.error.httpStatus===404?ok(null):err(res.error)}}}function stableMediaKey(source){if(source===void 0)return"bundled:none";if(typeof source=="number")return`bundled:${source}`;if("kind"in source)return`bundled:${source.id}`;let uri=source.uri,q=uri.indexOf("?");return q===-1?uri:uri.slice(0,q)}function selectTier(i){return i.hasPhoto&&!i.photoFailed?"photo":i.canAnimate&&!i.animationFailed?"animation":i.hasImage&&!i.imageFailed?"image":"idle"}function retireTier(current,failed){switch(current){case"photo":return{failed:freezeFailed({...failed,photo:true}),reason:"network_error"};case"animation":return{failed:freezeFailed({...failed,animation:true}),reason:"network_error"};case"image":return{failed:freezeFailed({...failed,image:true}),reason:"network_error"};case"idle":return{failed:freezeFailed(failed),reason:"idle_asset_failed"};default:return{failed:freezeFailed(failed),reason:"network_error"}}}var NO_FAILURES=/* @__PURE__ */Object.freeze({photo:false,animation:false,image:false});function freezeFailed(f){/* @__PURE__ */
|
|
104
104
|
return Object.freeze({photo:f.photo,animation:f.animation,image:f.image})}function isLoaderSafeCategory(category){switch(category){case"activity":case"mood":case"moment":case"idle":return true;case"health":case"attention":return false;default:return false}}var CACHE_EPOCH_STORAGE_KEY="everfur.petState.cacheEpoch";function createCacheEpochGuard(deps){let lastActed=0,loaded=false,inFlight=null,run=async serverEpoch=>{if(loaded||(lastActed=await readStoredEpoch(deps.kv),loaded=true),serverEpoch<=lastActed)return false;try{await deps.kv.setItem(CACHE_EPOCH_STORAGE_KEY,String(serverEpoch))}catch{}lastActed=serverEpoch;try{await deps.cache.clearMemoryCache()}catch{}try{await deps.cache.clearDiskCache()}catch{}return true};return{async sync(serverEpoch){return typeof serverEpoch!="number"||!Number.isFinite(serverEpoch)||serverEpoch<=0||loaded&&serverEpoch<=lastActed?false:inFlight||(inFlight=run(serverEpoch).finally(()=>{inFlight=null}),inFlight)}}}async function readStoredEpoch(kv){let raw;try{raw=await kv.getItem(CACHE_EPOCH_STORAGE_KEY)}catch{return 0}if(raw===null)return 0;let parsed=Number(raw);return Number.isFinite(parsed)&&parsed>0?parsed:0}var SUPPORTED_SCHEMA_VERSION=1,MANIFEST_LKG_STORAGE_KEY="everfur.manifest.lastKnownGood",COMPILED_DEFAULT_IDLE=/* @__PURE__ */Object.freeze({kind:"bundled",id:"everfur-idle"}),COMPILED_DEFAULT_MANIFEST=/* @__PURE__ */Object.freeze({schemaVersion:SUPPORTED_SCHEMA_VERSION,revision:"compiled-default",surfaces:/* @__PURE__ */Object.freeze({animations:/* @__PURE__ */Object.freeze({enabled:true,idle:COMPILED_DEFAULT_IDLE})})}),bundledIdleSchema=/* @__PURE__ */z.object({kind:/* @__PURE__ */z.literal("bundled"),id:/* @__PURE__ */z.string().min(1)}),animationsSurfaceWireSchema=/* @__PURE__ */z.object({enabled:/* @__PURE__ */z.boolean().default(true),idle:/* @__PURE__ */bundledIdleSchema.optional()}),manifestWireSchema=/* @__PURE__ */z.object({schema_version:/* @__PURE__ */z.number().int(),revision:/* @__PURE__ */z.string().default(""),surfaces:/* @__PURE__ */z.object({animations:/* @__PURE__ */animationsSurfaceWireSchema.optional()}).default({})});function parseManifest(raw){let parsed=manifestWireSchema.safeParse(raw);if(!parsed.success)return{ok:false,reason:"unparseable"};if(parsed.data.schema_version>SUPPORTED_SCHEMA_VERSION)return{ok:false,reason:"newer_schema"};let animationsWire=parsed.data.surfaces.animations,surfaces={};return animationsWire&&(surfaces.animations=/* @__PURE__ */Object.freeze({enabled:animationsWire.enabled,idle:animationsWire.idle?/* @__PURE__ */Object.freeze({...animationsWire.idle}):COMPILED_DEFAULT_IDLE})),{ok:true,manifest:/* @__PURE__ */Object.freeze({schemaVersion:parsed.data.schema_version,revision:parsed.data.revision,surfaces:/* @__PURE__ */Object.freeze(surfaces)})}}async function resolveManifest(liveRaw,kv,tel){if(liveRaw!=null){let parsed=parseManifest(liveRaw);if(parsed.ok)return await writeLastKnownGood(kv,liveRaw),tel.track("manifest.fallback",{source:"live"}),/* @__PURE__ */Object.freeze({manifest:parsed.manifest,source:"live"});parsed.reason==="newer_schema"&&tel.track("manifest.refused_newer",{})}let lkg=await readLastKnownGood(kv);return lkg?(tel.track("manifest.fallback",{source:"last-known-good"}),/* @__PURE__ */Object.freeze({manifest:lkg,source:"last-known-good"})):(tel.track("manifest.fallback",{source:"compiled-default"}),/* @__PURE__ */Object.freeze({manifest:COMPILED_DEFAULT_MANIFEST,source:"compiled-default"}))}function animationsSurfaceOf(manifest){return manifest.surfaces.animations??COMPILED_DEFAULT_MANIFEST.surfaces.animations??{enabled:true,idle:COMPILED_DEFAULT_IDLE}}async function writeLastKnownGood(kv,raw){try{await kv.setItem(MANIFEST_LKG_STORAGE_KEY,JSON.stringify(raw))}catch{}}async function readLastKnownGood(kv){let stored;try{stored=await kv.getItem(MANIFEST_LKG_STORAGE_KEY)}catch{return null}if(stored===null)return null;let json;try{json=JSON.parse(stored)}catch{return null}let parsed=parseManifest(json);return parsed.ok?parsed.manifest:null}var EMPTY_SNAPSHOT=/* @__PURE__ */Object.freeze({data:null,isPending:false,isError:false,error:null,isDark:false});function createPetStateStore(deps){let{repo:repo,cacheEpoch:cacheEpoch,timers:timers}=deps,listeners=/* @__PURE__ */new Set,warm=/* @__PURE__ */new Map,snapshot=EMPTY_SNAPSHOT,currentPetRef=null,dataPetRef=null,isFocused=false,terminatedPetRef=null,remintHandle=null,inFlight=null,epoch=0,emit=()=>{for(let listener of listeners)listener()},patch=partial=>{snapshot=/* @__PURE__ */Object.freeze({...snapshot,...partial}),emit()},clearRemint=()=>{remintHandle!==null&&(timers.clearTimeout(remintHandle),remintHandle=null)},staleMs=data=>data?Math.max(1,data.ttlSeconds)*1e3:6e4,touchWarm=petRef=>{let entry=warm.get(petRef);entry!==void 0&&(warm.delete(petRef),warm.set(petRef,entry))},setWarm=(petRef,data)=>{for(warm.delete(petRef),warm.set(petRef,/* @__PURE__ */Object.freeze({data:data,fetchedAt:timers.now()}));warm.size>32;){let oldest=warm.keys().next().value;if(oldest===void 0||oldest===petRef)break;warm.delete(oldest)}},hasGoodTiers=petRef=>{let entry=warm.get(petRef);return entry?!!(entry.data.tiers.animation||entry.data.tiers.image):false},scheduleRemint=(petRef,ttlSeconds)=>{if(clearRemint(),!isFocused)return;let ms=Math.max(1,ttlSeconds)*1e3,scheduledEpoch=epoch;remintHandle=timers.setTimeout(()=>{remintHandle=null,!(scheduledEpoch!==epoch||currentPetRef!==petRef||!isFocused)&&fetchOnce(petRef,0)},ms)},fetchOnce=async(petRef,attempt)=>{if(currentPetRef!==petRef||terminatedPetRef===petRef||!isFocused)return;let myEpoch=epoch;inFlight?.abort();let ctrl=new AbortController;inFlight=ctrl;let res=await repo.getState(petRef,{signal:ctrl.signal});if(!(myEpoch!==epoch||currentPetRef!==petRef)){if(res.ok){let resp=res.value;if(resp===null){onTerminalDark(petRef);return}cacheEpoch.sync(resp.cacheEpoch);let respHasTiers=!!(resp.tiers.animation||resp.tiers.image);if(resp.degraded&&!respHasTiers&&hasGoodTiers(petRef)){patch({isError:false,error:null,isPending:false,isDark:false}),scheduleRemint(petRef,resp.ttlSeconds);return}setWarm(petRef,resp),dataPetRef=petRef,patch({data:resp,isPending:false,isError:false,error:null,isDark:false}),scheduleRemint(petRef,resp.ttlSeconds);return}if(isTerminalPetStateError(res.error)){onTerminalDisabled(petRef,res.error);return}if(patch({isError:true,error:res.error,isPending:snapshot.data===null&&dataPetRef!==petRef}),attempt<2){clearRemint();let backoff=500*(attempt+1),scheduledEpoch=epoch;remintHandle=timers.setTimeout(()=>{remintHandle=null,!(scheduledEpoch!==epoch||currentPetRef!==petRef||!isFocused)&&fetchOnce(petRef,attempt+1)},backoff)}else scheduleRemint(petRef,5)}},onTerminalDark=petRef=>{terminatedPetRef=petRef,warm.delete(petRef),clearRemint(),dataPetRef=petRef,patch({data:null,isPending:false,isError:false,error:null,isDark:true})},onTerminalDisabled=(petRef,error)=>{terminatedPetRef=petRef,warm.delete(petRef),clearRemint(),dataPetRef=petRef,patch({data:null,isPending:false,isError:false,error:error,isDark:true})};return{observe(petRef,opts){let focusChanged=opts.isFocused!==isFocused;if(isFocused=opts.isFocused,petRef!==currentPetRef){if(epoch+=1,inFlight?.abort(),inFlight=null,clearRemint(),terminatedPetRef=null,currentPetRef=petRef,petRef===null){dataPetRef=null,snapshot=EMPTY_SNAPSHOT,emit();return}let warmEntry=warm.get(petRef),fresh=warmEntry&&timers.now()-warmEntry.fetchedAt<staleMs(warmEntry.data)?warmEntry:null;fresh?(touchWarm(petRef),dataPetRef=petRef,patch({data:fresh.data,isPending:false,isError:false,error:null,isDark:false})):patch({isPending:true,isError:false,error:null,isDark:false}),isFocused&&fetchOnce(petRef,0);return}if(!focusChanged||petRef===null)return;if(!isFocused){clearRemint();return}let entry=warm.get(petRef);!entry||timers.now()-entry.fetchedAt>=staleMs(entry.data)?terminatedPetRef!==petRef&&fetchOnce(petRef,0):scheduleRemint(petRef,entry.data.ttlSeconds)},getSnapshot(){return snapshot},subscribe(listener){return listeners.add(listener),()=>{listeners.delete(listener)}},getCachedPetStateMedia(petRef){let entry=warm.get(petRef);return!entry||timers.now()-entry.fetchedAt>=staleMs(entry.data)?null:(touchWarm(petRef),entry.data)},dispose(){epoch+=1,inFlight?.abort(),inFlight=null,clearRemint(),listeners.clear(),warm.clear()}}}function isTerminalPetStateError(error){if(typeof error!="object"||error===null)return false;let record=error,status=typeof record.status=="number"?record.status:record.httpStatus;return status===403||status===404}var noopTelemetry=/* @__PURE__ */Object.freeze({track(){},trackExpectedFailure(){}});function createAnimationController(deps){let telemetry=deps.telemetry??noopTelemetry,timers=deps.timers??defaultTimers(deps.now),store=createPetStateStore({repo:deps.repo,cacheEpoch:createCacheEpochGuard({kv:deps.kv,cache:deps.cache}),timers:timers}),listeners=/* @__PURE__ */new Set,failed=NO_FAILURES,fallbackReason="none",paused=false,photoUrl=null,lastData=null,lastDark=false,dataToken=0,lastShownKey="",view=pendingView(surface()),disposed=false;function surface(){let manifest=deps.manifest?deps.manifest():COMPILED_DEFAULT_MANIFEST;return animationsSurfaceOf(manifest)}let emit=()=>{for(let listener of listeners)listener()},unsubscribeStore=store.subscribe(()=>{onStoreChange()});function onStoreChange(){let snap=store.getSnapshot();(snap.data!==lastData||snap.isDark!==lastDark)&&(lastData=snap.data,lastDark=snap.isDark,failed=NO_FAILURES,fallbackReason=snap.isDark?"dark_or_missing":"none",dataToken+=1),recompute(snap)}function recompute(snap=store.getSnapshot()){let surf=surface(),next=buildView(surf,snap,{failed:failed,fallbackReason:fallbackReason,paused:paused,photoUrl:photoUrl,reducedMotion:deps.reducedMotion()});view=next,maybeEmitShown(next),emit()}function maybeEmitShown(next){if(next.kind!=="ready")return;let key=`${next.category}|${next.tier}|${next.fallbackReason}|${next.reducedMotion?1:0}`;key!==lastShownKey&&(lastShownKey=key,telemetry.track("pet_state_shown",{category:next.category,tier:next.tier,fallback_reason:next.fallbackReason,reduced_motion:next.reducedMotion}),next.fallbackReason==="idle_asset_failed"&&telemetry.trackExpectedFailure("idle_asset_failed",{category:next.category}))}return{observe(petRef,opts){disposed||(photoUrl=opts.photoUrl??null,failed=NO_FAILURES,store.observe(petRef,{isFocused:opts.isFocused}),onStoreChange())},getState(){return view},subscribe(listener){return listeners.add(listener),()=>{listeners.delete(listener)}},onMediaError(){if(disposed||view.kind!=="ready")return;let retired=retireTier(view.tier,failed);failed=retired.failed,fallbackReason=retired.reason,recompute()},setPaused(next){disposed||paused===next||(paused=next,recompute())},dispose(){disposed||(disposed=true,unsubscribeStore(),store.dispose(),listeners.clear())}}}function buildView(surf,snap,inputs){let idleSource=surf.idle;if(!surf.enabled)/* @__PURE__ */
|
|
105
105
|
return Object.freeze({kind:"disabled",reason:userFacingError("accessDenied"),level:"partner_config",source:idleSource,idle:surf.idle});if(snap.isPending&&snap.data===null&&!snap.isDark)/* @__PURE__ */
|
|
106
106
|
return Object.freeze({kind:"pending",showSkeleton:true,source:idleSource});let data=snap.data,category=data?.category??"idle",animation=data?.tiers.animation,image=data?.tiers.image,canAnimate=!!animation&&animation?.kind==="webp"&&!inputs.reducedMotion&&!inputs.failed.animation,tier=selectTier({hasPhoto:inputs.photoUrl!==null&&inputs.photoUrl.length>0,photoFailed:inputs.failed.photo,canAnimate:canAnimate,animationFailed:inputs.failed.animation,hasImage:!!image,imageFailed:inputs.failed.image}),source=idleSource,loopDurationMs=null,cacheHit=false;tier==="photo"&&inputs.photoUrl?source=uriSource(inputs.photoUrl,void 0):tier==="animation"&&animation?(source=uriSource(animation.url,animation.cacheKey),loopDurationMs=animation.loopDurationMs??null,cacheHit=animation.cacheKey!==void 0):tier==="image"&&image&&(source=uriSource(image.url,image.cacheKey),cacheHit=image.cacheKey!==void 0);let recyclingKey=source.kind==="uri"?source.cacheKey:`bundled:${source.id}`;/* @__PURE__ */
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { E as EverfurError } from './EverfurError.d-8NHtlgzA.js';
|
|
2
2
|
import { E as EverfurResult } from './EverfurResult.d-D_-254ZY.js';
|
|
3
3
|
import { C as ConversationId, P as PetRef, b as ResponseId } from './ids.d-B2GAAifq.js';
|
|
4
|
-
import { f as ChatFeedbackType, l as ChatStatus, i as ChatMessage, c as ChatConversationListOptions, d as ChatConversationPage, g as ChatHistoryOptions, h as ChatMessagePage, a as ChatCheckinTarget, e as ChatFeedbackReceipt } from './ports.d-
|
|
5
|
-
import { C as CheckinAnswer, a as CheckinOutcome } from './casesRepository.d-
|
|
6
|
-
import { i as UrgencyLevel } from './config.d-
|
|
7
|
-
import { W as WidgetPet } from './petsRepository.d-
|
|
4
|
+
import { f as ChatFeedbackType, l as ChatStatus, i as ChatMessage, c as ChatConversationListOptions, d as ChatConversationPage, g as ChatHistoryOptions, h as ChatMessagePage, a as ChatCheckinTarget, e as ChatFeedbackReceipt } from './ports.d-BDtwHxmW.js';
|
|
5
|
+
import { C as CheckinAnswer, a as CheckinOutcome } from './casesRepository.d-DG83Ggbq.js';
|
|
6
|
+
import { i as UrgencyLevel } from './config.d-zd2eTb2L.js';
|
|
7
|
+
import { W as WidgetPet } from './petsRepository.d-Ba3xhJcj.js';
|
|
8
8
|
import { U as UploadTransport, F as FileHandle } from './ports.d-BX4f4UsB.js';
|
|
9
|
-
import { c as AttachmentQueue, d as AttachmentState, A as AttachmentError, b as AttachmentOutcome } from './attachments.d
|
|
9
|
+
import { c as AttachmentQueue, d as AttachmentState, A as AttachmentError, b as AttachmentOutcome } from './attachments.d-CoQhXrP9.js';
|
|
10
10
|
|
|
11
11
|
/** The three thumbs. `'neutral'` is the app's rotated thumbs-down glyph. */
|
|
12
12
|
type ChatSentiment = 'up' | 'neutral' | 'down';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { E as EverfurError } from './EverfurError.d-8NHtlgzA.js';
|
|
2
|
-
import { R as RequestFunnel } from './requestFunnel.d-
|
|
2
|
+
import { R as RequestFunnel } from './requestFunnel.d-DFf9C__p.js';
|
|
3
3
|
import { F as FileHandle, U as UploadTransport, a as UploadPolicyWire } from './ports.d-BX4f4UsB.js';
|
|
4
|
-
import { R as ReadableStore, T as Timers } from './ports.d-
|
|
4
|
+
import { R as ReadableStore, T as Timers } from './ports.d-BDtwHxmW.js';
|
|
5
5
|
|
|
6
6
|
/** The image MIME types the chat accepts (the server's `CHAT_ATTACHMENT` rule, plus the `image/jpg` alias). */
|
|
7
7
|
declare const ATTACHMENT_MIME_TYPES: readonly string[];
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { E as EverfurError } from './EverfurError.d-8NHtlgzA.cjs';
|
|
2
2
|
import { E as EverfurResult } from './EverfurResult.d-BFH-3s6E.cjs';
|
|
3
3
|
import { C as ConversationId, P as PetRef, b as ResponseId } from './ids.d-B2GAAifq.cjs';
|
|
4
|
-
import { f as ChatFeedbackType, l as ChatStatus, i as ChatMessage, c as ChatConversationListOptions, d as ChatConversationPage, g as ChatHistoryOptions, h as ChatMessagePage, a as ChatCheckinTarget, e as ChatFeedbackReceipt } from './ports.d-
|
|
5
|
-
import { C as CheckinAnswer, a as CheckinOutcome } from './casesRepository.d-
|
|
6
|
-
import { i as UrgencyLevel } from './config.d-
|
|
7
|
-
import { W as WidgetPet } from './petsRepository.d-
|
|
4
|
+
import { f as ChatFeedbackType, l as ChatStatus, i as ChatMessage, c as ChatConversationListOptions, d as ChatConversationPage, g as ChatHistoryOptions, h as ChatMessagePage, a as ChatCheckinTarget, e as ChatFeedbackReceipt } from './ports.d-gZNTn8Qf.cjs';
|
|
5
|
+
import { C as CheckinAnswer, a as CheckinOutcome } from './casesRepository.d-CsUJ2Oyb.cjs';
|
|
6
|
+
import { i as UrgencyLevel } from './config.d-C0WgjutL.cjs';
|
|
7
|
+
import { W as WidgetPet } from './petsRepository.d-B5DWzU7C.cjs';
|
|
8
8
|
import { U as UploadTransport, F as FileHandle } from './ports.d-BX4f4UsB.cjs';
|
|
9
|
-
import { c as AttachmentQueue, d as AttachmentState, A as AttachmentError, b as AttachmentOutcome } from './attachments.d-
|
|
9
|
+
import { c as AttachmentQueue, d as AttachmentState, A as AttachmentError, b as AttachmentOutcome } from './attachments.d-CqHMGoER.cjs';
|
|
10
10
|
|
|
11
11
|
/** The three thumbs. `'neutral'` is the app's rotated thumbs-down glyph. */
|
|
12
12
|
type ChatSentiment = 'up' | 'neutral' | 'down';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { E as EverfurError } from './EverfurError.d-8NHtlgzA.cjs';
|
|
2
|
-
import { R as RequestFunnel } from './requestFunnel.d-
|
|
2
|
+
import { R as RequestFunnel } from './requestFunnel.d-CR4akGCY.cjs';
|
|
3
3
|
import { F as FileHandle, U as UploadTransport, a as UploadPolicyWire } from './ports.d-BX4f4UsB.cjs';
|
|
4
|
-
import { R as ReadableStore, T as Timers } from './ports.d-
|
|
4
|
+
import { R as ReadableStore, T as Timers } from './ports.d-gZNTn8Qf.cjs';
|
|
5
5
|
|
|
6
6
|
/** The image MIME types the chat accepts (the server's `CHAT_ATTACHMENT` rule, plus the `image/jpg` alias). */
|
|
7
7
|
declare const ATTACHMENT_MIME_TYPES: readonly string[];
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { o as TelevetStatePolicy, k as TelevetBookingEntitlement, l as TelevetCancellationPolicy, m as TelevetClinician, c as TelevetSlot, n as TelevetSlotHold, j as TelevetBookingBody, T as TelevetConsult, b as TelevetCancelReceipt, p as TelevetTriageVerdict, h as ConsultStatus } from './televetGlobal.d-CKwDCbmN.cjs';
|
|
2
2
|
import { E as EverfurError } from './EverfurError.d-8NHtlgzA.cjs';
|
|
3
3
|
import { E as EverfurResult } from './EverfurResult.d-BFH-3s6E.cjs';
|
|
4
|
-
import { R as RequestFunnel } from './requestFunnel.d-
|
|
5
|
-
import { A as AuthContext } from './identity.d-
|
|
4
|
+
import { R as RequestFunnel } from './requestFunnel.d-CR4akGCY.cjs';
|
|
5
|
+
import { A as AuthContext } from './identity.d-CioQhZrq.cjs';
|
|
6
6
|
import { E as ErrorPolicyPort } from './ErrorPolicyPort.d-DirW9hgO.cjs';
|
|
7
7
|
import { T as TelemetryPort } from './TelemetryPort.d-BDNr00hu.cjs';
|
|
8
8
|
import { b as VetCallCredential, c as VetCallJoinRefusal } from './callRoom.d-B1DoYdJe.cjs';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { o as TelevetStatePolicy, k as TelevetBookingEntitlement, l as TelevetCancellationPolicy, m as TelevetClinician, c as TelevetSlot, n as TelevetSlotHold, j as TelevetBookingBody, T as TelevetConsult, b as TelevetCancelReceipt, p as TelevetTriageVerdict, h as ConsultStatus } from './televetGlobal.d-CC-DrqkQ.js';
|
|
2
2
|
import { E as EverfurError } from './EverfurError.d-8NHtlgzA.js';
|
|
3
3
|
import { E as EverfurResult } from './EverfurResult.d-D_-254ZY.js';
|
|
4
|
-
import { R as RequestFunnel } from './requestFunnel.d-
|
|
5
|
-
import { A as AuthContext } from './identity.d-
|
|
4
|
+
import { R as RequestFunnel } from './requestFunnel.d-DFf9C__p.js';
|
|
5
|
+
import { A as AuthContext } from './identity.d-BksOEa6m.js';
|
|
6
6
|
import { E as ErrorPolicyPort } from './ErrorPolicyPort.d-68yrE3BE.js';
|
|
7
7
|
import { T as TelemetryPort } from './TelemetryPort.d-BDNr00hu.js';
|
|
8
8
|
import { b as VetCallCredential, c as VetCallJoinRefusal } from './callRoom.d-Dqm1rUqT.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { d as EverfurFontWeight, q as EverfurThemeSlotName, a as EverfurFontFaceKey, r as EverfurThemeSlots, c as EverfurFontSource } from './tokens.d-
|
|
1
|
+
import { d as EverfurFontWeight, q as EverfurThemeSlotName, a as EverfurFontFaceKey, r as EverfurThemeSlots, c as EverfurFontSource } from './tokens.d-BUVqme2D.cjs';
|
|
2
2
|
import { P as PRESENTATION_LOCK, k as PRESENTATION_LOCK_PREFIX, i as EverfurPresentationInput } from './presentation.d-vy8kTGfR.cjs';
|
|
3
3
|
|
|
4
4
|
/** The presets an appearance may start from. `everfur` is the compiled default. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { d as EverfurFontWeight, q as EverfurThemeSlotName, a as EverfurFontFaceKey, r as EverfurThemeSlots, c as EverfurFontSource } from './tokens.d-
|
|
1
|
+
import { d as EverfurFontWeight, q as EverfurThemeSlotName, a as EverfurFontFaceKey, r as EverfurThemeSlots, c as EverfurFontSource } from './tokens.d-BUVqme2D.js';
|
|
2
2
|
import { P as PRESENTATION_LOCK, k as PRESENTATION_LOCK_PREFIX, i as EverfurPresentationInput } from './presentation.d-vy8kTGfR.js';
|
|
3
3
|
|
|
4
4
|
/** The presets an appearance may start from. `everfur` is the compiled default. */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { E as EverfurResult } from './EverfurResult.d-BFH-3s6E.cjs';
|
|
2
|
-
import { A as AuthContext } from './identity.d-
|
|
2
|
+
import { A as AuthContext } from './identity.d-CioQhZrq.cjs';
|
|
3
3
|
import { P as PetRef } from './ids.d-B2GAAifq.cjs';
|
|
4
4
|
|
|
5
5
|
/** The owner's answer to a check-in, the wire values of the consumer `CheckinResponse` enum. */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { E as EverfurResult } from './EverfurResult.d-D_-254ZY.js';
|
|
2
|
-
import { A as AuthContext } from './identity.d-
|
|
2
|
+
import { A as AuthContext } from './identity.d-BksOEa6m.js';
|
|
3
3
|
import { P as PetRef } from './ids.d-B2GAAifq.js';
|
|
4
4
|
|
|
5
5
|
/** The owner's answer to a check-in, the wire values of the consumer `CheckinResponse` enum. */
|