@everfur/sdk 0.12.1 → 0.14.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 +292 -0
- package/README.md +12 -10
- package/dist/{Chat-CgYQdfqi.d.ts → Chat.d-aycmX1CA.d.cts} +178 -8
- package/dist/{Chat-CbyZ1vAX.d.cts → Chat.d-puminpyi.d.ts} +178 -8
- package/dist/{DepthViews-CCz4ig0u.d.ts → DepthViews.d-BdvFZgPs.d.cts} +1 -1
- package/dist/{DepthViews-CaQUyCHK.d.ts → DepthViews.d-DIvxzLDf.d.ts} +1 -1
- package/dist/{DepthViews-iGZi4_WK.d.cts → DepthViews.d-Dy0Zl-s-.d.ts} +1 -1
- package/dist/{DepthViews-D3OiIK_x.d.cts → DepthViews.d-wLNkzk9f.d.cts} +1 -1
- package/dist/{ErrorPolicyPort-10s3HJCt.d.cts → ErrorPolicyPort.d-68yrE3BE.d.ts} +1 -1
- package/dist/{ErrorPolicyPort-C3nNSS_j.d.ts → ErrorPolicyPort.d-DirW9hgO.d.cts} +1 -1
- package/dist/{EverfurError-DeBqRpQV.d.cts → EverfurError.d-8NHtlgzA.d.cts} +11 -1
- package/dist/{EverfurError-DeBqRpQV.d.ts → EverfurError.d-8NHtlgzA.d.ts} +11 -1
- package/dist/{EverfurResult-ClPTS0P2.d.ts → EverfurResult.d-BFH-3s6E.d.cts} +1 -1
- package/dist/{EverfurResult-COlXj1wq.d.cts → EverfurResult.d-D_-254ZY.d.ts} +1 -1
- package/dist/{IntakeMedia-BH0fYDT2.d.cts → IntakeMedia.d-4a89XrP7.d.ts} +1 -1
- package/dist/{IntakeMedia-B-_vA9ZB.d.cts → IntakeMedia.d-DGxrhgIW.d.ts} +1 -1
- package/dist/{IntakeMedia-CIoTXAWs.d.ts → IntakeMedia.d-DUPR4lVM.d.cts} +1 -1
- package/dist/{IntakeMedia-Bavl7E4Z.d.ts → IntakeMedia.d-JJCUvQu7.d.cts} +1 -1
- package/dist/LifecyclePort.d-Cr1p33a7.d.cts +23 -0
- package/dist/LifecyclePort.d-Cr1p33a7.d.ts +23 -0
- package/dist/{PhotoController-vzY5bfY_.d.ts → PhotoController.d-BzCJOE7e.d.cts} +2 -2
- package/dist/{PhotoController-3l7MT9jA.d.cts → PhotoController.d-D0XiUUOl.d.ts} +2 -2
- package/dist/RecordsPage.d-9Ank15PT.d.ts +93 -0
- package/dist/RecordsPage.d-DMKU0IKc.d.cts +93 -0
- package/dist/animations/index.cjs +4 -1
- package/dist/animations/index.d.cts +24 -24
- package/dist/animations/index.d.ts +24 -24
- package/dist/animations/index.js +4 -1
- package/dist/{attachments-CTJK0jQ4.d.ts → attachments.d--sIsfk6e.d.ts} +4 -4
- package/dist/{attachments-DkMrKCIU.d.ts → attachments.d-DNUCiyy5.d.cts} +10 -32
- package/dist/{attachments-DXBETOrV.d.cts → attachments.d-ZEpTUeWN.d.cts} +4 -4
- package/dist/{attachments-BOk3hEAM.d.cts → attachments.d-rp3xs-Q3.d.ts} +10 -32
- package/dist/{bookingCopy-C_a45T4-.d.ts → bookingCopy.d-D0uIIFAJ.d.ts} +24 -9
- package/dist/{bookingCopy-CHYGYHe0.d.cts → bookingCopy.d-DUrmVcLs.d.cts} +24 -9
- package/dist/{branding-DJf4h12Q.d.ts → branding.d-CTXTUg_8.d.cts} +9 -2
- package/dist/{branding-BCfwLj0h.d.cts → branding.d-DxJSoFce.d.ts} +9 -2
- package/dist/{callRoom-BhIdadyV.d.cts → callRoom.d-B1DoYdJe.d.cts} +1 -1
- package/dist/{callRoom-B92eH_ij.d.ts → callRoom.d-Dqm1rUqT.d.ts} +1 -1
- package/dist/{casesRepository-C8KJmlxE.d.cts → casesRepository.d-DCnix2pT.d.cts} +3 -3
- package/dist/{casesRepository-iAi5qWnx.d.ts → casesRepository.d-DbirgbyH.d.ts} +3 -3
- package/dist/chat/index.cjs +139 -63
- package/dist/chat/index.d.cts +34 -19
- package/dist/chat/index.d.ts +34 -19
- package/dist/chat/index.js +139 -63
- package/dist/client/index.cjs +14 -10
- package/dist/client/index.d.cts +19 -18
- package/dist/client/index.d.ts +19 -18
- package/dist/client/index.js +14 -10
- package/dist/clinicBatch.d-Ccmrngcu.d.cts +71 -0
- package/dist/clinicBatch.d-D9Ci7IpP.d.ts +71 -0
- package/dist/clinicModels.d-BXgKZqDb.d.cts +68 -0
- package/dist/clinicModels.d-CaS64-P-.d.ts +68 -0
- package/dist/clinicRequestProps.d-1dCtouGA.d.cts +65 -0
- package/dist/clinicRequestProps.d-CjsMg_OD.d.ts +65 -0
- package/dist/{config-C9zhanL-.d.cts → config.d-DJ4mvf_w.d.cts} +3 -3
- package/dist/{config-C5iPNKDj.d.ts → config.d-MX7IKP2f.d.ts} +3 -3
- package/dist/consent/index.cjs +4 -1
- package/dist/consent/index.d.cts +10 -10
- package/dist/consent/index.d.ts +10 -10
- package/dist/consent/index.js +4 -1
- package/dist/{context-D_bcpHDA.d.cts → context.d-BdnBe8Oe.d.ts} +15 -15
- package/dist/{context-BUIrC20Z.d.ts → context.d-C6MJsMpN.d.cts} +15 -15
- package/dist/{copy-KbCU9fen.d.ts → copy.d-BIfQOoDB.d.ts} +6 -6
- package/dist/{copy-BE31T2jR.d.cts → copy.d-C_u7shha.d.cts} +6 -6
- package/dist/core/index.cjs +16 -13
- package/dist/core/index.d.cts +35 -29
- package/dist/core/index.d.ts +35 -29
- package/dist/core/index.js +16 -13
- package/dist/{depth-DDKGfFaB.d.ts → depth.d-COFxYWLU.d.ts} +9 -242
- package/dist/{depth-DNxDieoO.d.cts → depth.d-D2e5WZuE.d.cts} +9 -242
- package/dist/{entitlementRepository-C1_wXIE3.d.cts → entitlementRepository.d-BP15dFbe.d.cts} +10 -5
- package/dist/{entitlementRepository-CYtdIGfH.d.ts → entitlementRepository.d-DLuxnGi5.d.ts} +10 -5
- package/dist/features.d-DrQxTw3-.d.cts +108 -0
- package/dist/features.d-DrQxTw3-.d.ts +108 -0
- package/dist/focus.d-C0Tr0oVJ.d.ts +939 -0
- package/dist/focus.d-jQWp0hdK.d.cts +939 -0
- package/dist/health-plan/index.cjs +384 -0
- package/dist/health-plan/index.d.cts +293 -0
- package/dist/health-plan/index.d.ts +293 -0
- package/dist/health-plan/index.js +384 -0
- package/dist/idempotency.d-DXb1BN2A.d.ts +1055 -0
- package/dist/idempotency.d-HF6fyRt2.d.cts +1055 -0
- package/dist/{identity-gjurBi7m.d.cts → identity.d-BePPZ7Uv.d.ts} +3 -3
- package/dist/{identity-BqeaN8An.d.ts → identity.d-CJfnWOdH.d.cts} +3 -3
- package/dist/index.cjs +148 -72
- package/dist/index.d.cts +32 -29
- package/dist/index.d.ts +32 -29
- package/dist/index.js +148 -72
- package/dist/introEvents.d-BkGDT_kG.d.cts +175 -0
- package/dist/introEvents.d-DHlMvmC7.d.ts +175 -0
- package/dist/introEvents.d-dS3fJCH1.d.cts +5 -0
- package/dist/introEvents.d-dS3fJCH1.d.ts +5 -0
- package/dist/{models-CnXY5LuO.d.ts → models.d-BSqvbTE1.d.cts} +15 -3
- package/dist/{models-A4A5S7AG.d.cts → models.d-DOwnr8fi.d.ts} +15 -3
- package/dist/notifications/index.cjs +4 -1
- package/dist/notifications/index.d.cts +9 -9
- package/dist/notifications/index.d.ts +9 -9
- package/dist/notifications/index.js +4 -1
- package/dist/optInView.d-0iI5JoAf.d.cts +441 -0
- package/dist/optInView.d-s-w4aGN3.d.ts +441 -0
- package/dist/parse.d-COt1qVA6.d.ts +210 -0
- package/dist/parse.d-EmsgOUMQ.d.cts +210 -0
- package/dist/{pets-CfutxNs9.d.cts → pets.d-BFT_b53y.d.ts} +3 -3
- package/dist/{pets-LIGadUtr.d.ts → pets.d-nNAVnw7f.d.cts} +3 -3
- package/dist/{petsRepository-CoRa3C_U.d.ts → petsRepository.d-B2TpRE7r.d.cts} +4 -4
- package/dist/{petsRepository-Cqpd3hLU.d.cts → petsRepository.d-RGwSZcYl.d.ts} +4 -4
- package/dist/photo/index.cjs +5 -2
- package/dist/photo/index.d.cts +9 -9
- package/dist/photo/index.d.ts +9 -9
- package/dist/photo/index.js +5 -2
- package/dist/planSignals.d-BDbp2e-k.d.cts +126 -0
- package/dist/planSignals.d-DSnxKoWe.d.ts +126 -0
- package/dist/{ports-BN6RHF9W.d.cts → ports.d-BX4f4UsB.d.cts} +14 -1
- package/dist/{ports-BN6RHF9W.d.ts → ports.d-BX4f4UsB.d.ts} +14 -1
- package/dist/{ports-CVi3n0re.d.ts → ports.d-D2n4HRUy.d.ts} +16 -10
- package/dist/{ports-gJ3faaWz.d.cts → ports.d-DBA_gsq5.d.cts} +16 -10
- package/dist/presentation.d-vy8kTGfR.d.cts +96 -0
- package/dist/presentation.d-vy8kTGfR.d.ts +96 -0
- package/dist/quickPrompts.d-NM_81Jc1.d.cts +19 -0
- package/dist/quickPrompts.d-NM_81Jc1.d.ts +19 -0
- package/dist/records/depth/index.cjs +10 -7
- package/dist/records/depth/index.d.cts +18 -12
- package/dist/records/depth/index.d.ts +18 -12
- package/dist/records/depth/index.js +10 -7
- package/dist/records/index.cjs +350 -74
- package/dist/records/index.d.cts +225 -21
- package/dist/records/index.d.ts +225 -21
- package/dist/records/index.js +351 -75
- package/dist/recordsAsk.d-C5CGSi3j.d.cts +14 -0
- package/dist/recordsAsk.d-C5CGSi3j.d.ts +14 -0
- package/dist/{requestFunnel-BYzlyaC0.d.ts → requestFunnel.d-D9edIEjZ.d.ts} +5 -5
- package/dist/{requestFunnel-DLZpiFD3.d.cts → requestFunnel.d-RZex94XX.d.cts} +5 -5
- package/dist/{resolve-D4Ywz5OS.d.ts → resolve.d-CoQWUy1Y.d.cts} +2 -2
- package/dist/{resolve-D4Ywz5OS.d.cts → resolve.d-CoQWUy1Y.d.ts} +2 -2
- package/dist/{runtimeTypes-BxxCKMn8.d.cts → runtimeTypes.d-BYq38b17.d.ts} +20 -13
- package/dist/{runtimeTypes-Doa_xxSa.d.ts → runtimeTypes.d-LkwZaF7z.d.cts} +20 -13
- package/dist/screenProps.d-BVzRzowC.d.ts +159 -0
- package/dist/screenProps.d-CQ0qZJkr.d.cts +159 -0
- package/dist/server/events/index.cjs +6 -3
- package/dist/server/events/index.d.cts +51 -9
- package/dist/server/events/index.d.ts +51 -9
- package/dist/server/events/index.js +6 -3
- package/dist/server/index.cjs +11 -6
- package/dist/server/index.d.cts +152 -8
- package/dist/server/index.d.ts +152 -8
- package/dist/server/index.js +11 -6
- package/dist/sheetCopy.d-CAhLOxjc.d.cts +4 -0
- package/dist/sheetCopy.d-CAhLOxjc.d.ts +4 -0
- package/dist/sheetSeam.d-B09jf4YC.d.ts +49 -0
- package/dist/sheetSeam.d-BBuEIVsa.d.cts +49 -0
- package/dist/shop/index.cjs +428 -0
- package/dist/shop/index.d.cts +211 -0
- package/dist/shop/index.d.ts +211 -0
- package/dist/shop/index.js +428 -0
- package/dist/tabs/index.cjs +195 -0
- package/dist/tabs/index.d.cts +174 -0
- package/dist/tabs/index.d.ts +174 -0
- package/dist/tabs/index.js +195 -0
- package/dist/tabsModel.d-BfIQg6yS.d.cts +31 -0
- package/dist/tabsModel.d-BfIQg6yS.d.ts +31 -0
- package/dist/televet/booking/index.cjs +15 -12
- package/dist/televet/booking/index.d.cts +36 -22
- package/dist/televet/booking/index.d.ts +36 -22
- package/dist/televet/booking/index.js +15 -12
- package/dist/televet/call/index.d.cts +5 -5
- package/dist/televet/call/index.d.ts +5 -5
- package/dist/televet/index.cjs +6 -3
- package/dist/televet/index.d.cts +12 -12
- package/dist/televet/index.d.ts +12 -12
- package/dist/televet/index.js +6 -3
- package/dist/{televetGlobal-C5dTUACe.d.cts → televetGlobal.d-CC-DrqkQ.d.ts} +7 -2
- package/dist/{televetGlobal-CnjrfhT4.d.ts → televetGlobal.d-CKwDCbmN.d.cts} +7 -2
- package/dist/testing/index.cjs +6 -3
- package/dist/testing/index.d.cts +3 -3
- package/dist/testing/index.d.ts +3 -3
- package/dist/testing/index.js +6 -3
- package/dist/testing/rn/index.cjs +5 -2
- package/dist/testing/rn/index.d.cts +23 -22
- package/dist/testing/rn/index.d.ts +23 -22
- package/dist/testing/rn/index.js +5 -2
- package/dist/testing/web/index.cjs +4 -1
- package/dist/testing/web/index.d.cts +23 -22
- package/dist/testing/web/index.d.ts +23 -22
- package/dist/testing/web/index.js +4 -1
- package/dist/texting/index.cjs +193 -0
- package/dist/texting/index.d.cts +69 -0
- package/dist/texting/index.d.ts +69 -0
- package/dist/texting/index.js +193 -0
- package/dist/threadOptions.d-9r4Csa7k.d.cts +458 -0
- package/dist/threadOptions.d-B6GA09aM.d.ts +458 -0
- package/dist/{timelineRows-Beun96e2.d.cts → timelineRows.d-Bes8ip2v.d.ts} +1 -1
- package/dist/{timelineRows-CGOlC_Q9.d.ts → timelineRows.d-BvM2A7_G.d.cts} +1 -1
- package/dist/{tokens-DLj8OnLH.d.cts → tokens.d-DarDaV39.d.cts} +10 -2
- package/dist/{tokens-DLj8OnLH.d.ts → tokens.d-DarDaV39.d.ts} +10 -2
- package/dist/{typeStyle-DJedEu14.d.cts → typeStyle.d-Co5KF0up.d.ts} +2 -2
- package/dist/{typeStyle-BxVyF71R.d.ts → typeStyle.d-xIZj02Ru.d.cts} +2 -2
- package/dist/{uploadTransport-C6kGP1Kd.d.ts → uploadTransport.d-CWL7CdWP.d.cts} +1 -1
- package/dist/{uploadTransport-BM_pnEWj.d.cts → uploadTransport.d-EGoUl7gX.d.ts} +1 -1
- package/dist/useIntroSeen.d-CTWFUthO.d.cts +35 -0
- package/dist/useIntroSeen.d-CTWFUthO.d.ts +35 -0
- package/dist/usePresentation.d-BGz32Vlm.d.ts +285 -0
- package/dist/usePresentation.d-DYTF_ZGf.d.cts +285 -0
- package/dist/useRecords.d-BYNX01El.d.cts +121 -0
- package/dist/useRecords.d-DWk61a4c.d.ts +121 -0
- package/dist/useRecordsDepth.d--LLA_4ga.d.cts +32 -0
- package/dist/useRecordsDepth.d-BQRL0Hez.d.ts +32 -0
- package/dist/{useVetVisit-DmWa7lt1.d.ts → useVetVisit.d-BtdwhmgD.d.cts} +15 -4
- package/dist/{useVetVisit-PtBjNwZr.d.cts → useVetVisit.d-DoYQimyt.d.ts} +15 -4
- package/dist/video/index.cjs +5 -2
- package/dist/video/index.d.cts +7 -7
- package/dist/video/index.d.ts +7 -7
- package/dist/video/index.js +5 -2
- package/dist/{view-VvLEdXP4.d.cts → view.d-0yBjLTV3.d.cts} +12 -122
- package/dist/{view-C_B5U04g.d.ts → view.d-DqbCADFa.d.ts} +12 -122
- package/dist/web/consent/index.cjs +4 -1
- package/dist/web/consent/index.d.cts +10 -10
- package/dist/web/consent/index.d.ts +10 -10
- package/dist/web/consent/index.js +4 -1
- package/dist/web/health-plan/index.cjs +421 -0
- package/dist/web/health-plan/index.d.cts +189 -0
- package/dist/web/health-plan/index.d.ts +189 -0
- package/dist/web/health-plan/index.js +421 -0
- package/dist/web/index.cjs +170 -87
- package/dist/web/index.d.cts +292 -38
- package/dist/web/index.d.ts +292 -38
- package/dist/web/index.js +170 -87
- package/dist/web/intro/index.cjs +167 -0
- package/dist/web/intro/index.d.cts +79 -0
- package/dist/web/intro/index.d.ts +79 -0
- package/dist/web/intro/index.js +167 -0
- package/dist/web/notifications/index.cjs +15 -3
- package/dist/web/notifications/index.d.cts +39 -209
- package/dist/web/notifications/index.d.ts +39 -209
- package/dist/web/notifications/index.js +15 -3
- package/dist/web/records/depth/index.cjs +10 -7
- package/dist/web/records/depth/index.d.cts +18 -12
- package/dist/web/records/depth/index.d.ts +18 -12
- package/dist/web/records/depth/index.js +10 -7
- package/dist/web/records/index.cjs +94 -68
- package/dist/web/records/index.d.cts +39 -55
- package/dist/web/records/index.d.ts +39 -55
- package/dist/web/records/index.js +94 -68
- package/dist/web/records/upload/index.d.cts +2 -2
- package/dist/web/records/upload/index.d.ts +2 -2
- package/dist/web/records-sheet/index.cjs +332 -0
- package/dist/web/records-sheet/index.d.cts +104 -0
- package/dist/web/records-sheet/index.d.ts +104 -0
- package/dist/web/records-sheet/index.js +332 -0
- package/dist/web/shop/index.cjs +416 -0
- package/dist/web/shop/index.d.cts +59 -0
- package/dist/web/shop/index.d.ts +59 -0
- package/dist/web/shop/index.js +416 -0
- package/dist/web/televet/booking/index.cjs +15 -12
- package/dist/web/televet/booking/index.d.cts +37 -23
- package/dist/web/televet/booking/index.d.ts +37 -23
- package/dist/web/televet/booking/index.js +15 -12
- package/dist/web/televet/call/index.d.cts +4 -4
- package/dist/web/televet/call/index.d.ts +4 -4
- package/dist/web/televet/index.cjs +6 -3
- package/dist/web/televet/index.d.cts +12 -12
- package/dist/web/televet/index.d.ts +12 -12
- package/dist/web/televet/index.js +6 -3
- package/dist/web/texting/index.cjs +188 -0
- package/dist/web/texting/index.d.cts +69 -0
- package/dist/web/texting/index.d.ts +69 -0
- package/dist/web/texting/index.js +188 -0
- package/health-plan/package.json +8 -0
- package/package.json +138 -5
- package/shop/package.json +8 -0
- package/tabs/package.json +8 -0
- package/texting/package.json +8 -0
- package/web/health-plan/native-blocked.cjs +12 -0
- package/web/health-plan/package.json +8 -0
- package/web/intro/native-blocked.cjs +12 -0
- package/web/intro/package.json +8 -0
- package/web/records-sheet/native-blocked.cjs +12 -0
- package/web/records-sheet/package.json +8 -0
- package/web/shop/native-blocked.cjs +12 -0
- package/web/shop/package.json +8 -0
- package/web/texting/native-blocked.cjs +12 -0
- package/web/texting/package.json +8 -0
- package/dist/useRecordsDepth-DRrJntjt.d.cts +0 -257
- package/dist/useRecordsDepth-hR94debv.d.ts +0 -257
- /package/dist/{CameraPort-Cv31Pz7g.d.cts → CameraPort.d-Cv31Pz7g.d.cts} +0 -0
- /package/dist/{CameraPort-Cv31Pz7g.d.ts → CameraPort.d-Cv31Pz7g.d.ts} +0 -0
- /package/dist/{TelemetryPort-BDNr00hu.d.cts → TelemetryPort.d-BDNr00hu.d.cts} +0 -0
- /package/dist/{TelemetryPort-BDNr00hu.d.ts → TelemetryPort.d-BDNr00hu.d.ts} +0 -0
- /package/dist/{cacheEpoch-DknKn3S0.d.cts → cacheEpoch.d-DknKn3S0.d.cts} +0 -0
- /package/dist/{cacheEpoch-DknKn3S0.d.ts → cacheEpoch.d-DknKn3S0.d.ts} +0 -0
- /package/dist/{callCopy-Bw6oZT54.d.cts → callCopy.d-Bw6oZT54.d.cts} +0 -0
- /package/dist/{callCopy-Bw6oZT54.d.ts → callCopy.d-Bw6oZT54.d.ts} +0 -0
- /package/dist/{ids-B2GAAifq.d.cts → ids.d-B2GAAifq.d.cts} +0 -0
- /package/dist/{ids-B2GAAifq.d.ts → ids.d-B2GAAifq.d.ts} +0 -0
- /package/dist/{optionalModule-DbJmsq5f.d.cts → optionalModule.d-DbJmsq5f.d.cts} +0 -0
- /package/dist/{optionalModule-DbJmsq5f.d.ts → optionalModule.d-DbJmsq5f.d.ts} +0 -0
- /package/dist/{profile-CSs1wlXT.d.cts → profile.d-CSs1wlXT.d.cts} +0 -0
- /package/dist/{profile-CSs1wlXT.d.ts → profile.d-CSs1wlXT.d.ts} +0 -0
- /package/dist/{projection-CeIUsbSk.d.cts → projection.d-CeIUsbSk.d.cts} +0 -0
- /package/dist/{projection-CeIUsbSk.d.ts → projection.d-CeIUsbSk.d.ts} +0 -0
- /package/dist/{species-BXAIMh7I.d.cts → species.d-BXAIMh7I.d.cts} +0 -0
- /package/dist/{species-BXAIMh7I.d.ts → species.d-BXAIMh7I.d.ts} +0 -0
- /package/dist/{visitIntent-D7_yVp1I.d.cts → visitIntent.d-D7_yVp1I.d.cts} +0 -0
- /package/dist/{visitIntent-D7_yVp1I.d.ts → visitIntent.d-D7_yVp1I.d.ts} +0 -0
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
import { E as EverfurError } from './EverfurError.d-8NHtlgzA.cjs';
|
|
2
|
+
import { E as EverfurResult } from './EverfurResult.d-BFH-3s6E.cjs';
|
|
3
|
+
import { E as ErrorPolicyPort } from './ErrorPolicyPort.d-DirW9hgO.cjs';
|
|
4
|
+
import { A as AuthContext } from './identity.d-CJfnWOdH.cjs';
|
|
5
|
+
import { U as UserRef, R as RecordsRequestId, P as PetRef, C as ConversationId } from './ids.d-B2GAAifq.cjs';
|
|
6
|
+
import { V as VetVisitIntent } from './visitIntent.d-D7_yVp1I.cjs';
|
|
7
|
+
|
|
8
|
+
/** The push providers the registration route accepts. `apns` is refused with `provider_unsupported` until APNs direct lands. */
|
|
9
|
+
type PushProvider = 'expo' | 'fcm' | 'apns';
|
|
10
|
+
/** The device platforms the registration route accepts. There is no web push in this version. */
|
|
11
|
+
type DevicePlatform = 'ios' | 'android';
|
|
12
|
+
/** What to register: the token your notification library obtained, which provider minted it, and which OS it is for. */
|
|
13
|
+
interface RegisterDeviceInput {
|
|
14
|
+
/**
|
|
15
|
+
* The push token as your library printed it: `ExponentPushToken[...]` from expo-notifications, or the FCM
|
|
16
|
+
* registration token from Firebase Messaging. Never an APNs device token in this version.
|
|
17
|
+
*/
|
|
18
|
+
readonly token: string;
|
|
19
|
+
readonly provider: PushProvider;
|
|
20
|
+
readonly platform: DevicePlatform;
|
|
21
|
+
/** Your own stable id for this install, if you keep one (1 to 128 characters). Echoed back, never interpreted. */
|
|
22
|
+
readonly installationId?: string;
|
|
23
|
+
}
|
|
24
|
+
/** The device row as Everfur stored it. The token itself is never echoed. */
|
|
25
|
+
interface RegisteredDevice {
|
|
26
|
+
/** Everfur's id for this device: pass it to `unregisterDevice` on sign-out. */
|
|
27
|
+
readonly deviceId: string;
|
|
28
|
+
readonly provider: PushProvider;
|
|
29
|
+
readonly platform: DevicePlatform;
|
|
30
|
+
readonly installationId: string | null;
|
|
31
|
+
/** ISO 8601. */
|
|
32
|
+
readonly registeredAt: string;
|
|
33
|
+
/** ISO 8601; refreshed by every registration of the same token. */
|
|
34
|
+
readonly lastSeenAt: string;
|
|
35
|
+
}
|
|
36
|
+
/** Both switches, always: the route is a replacement, not a patch. */
|
|
37
|
+
interface NotificationPreferencesInput {
|
|
38
|
+
readonly pushEnabled: boolean;
|
|
39
|
+
readonly emailEnabled: boolean;
|
|
40
|
+
}
|
|
41
|
+
/** The member's switches as Everfur stored them. */
|
|
42
|
+
interface NotificationPreferences {
|
|
43
|
+
readonly pushEnabled: boolean;
|
|
44
|
+
readonly emailEnabled: boolean;
|
|
45
|
+
/** ISO 8601. */
|
|
46
|
+
readonly updatedAt: string;
|
|
47
|
+
}
|
|
48
|
+
interface NotificationsClient {
|
|
49
|
+
/**
|
|
50
|
+
* `POST /widget/v1/me/devices`. Idempotent: the same token is the same device (its `lastSeenAt` moves), and a token
|
|
51
|
+
* another member of your tenant registered rebinds to the calling member. Settles `ok(RegisteredDevice)`;
|
|
52
|
+
* `validationFailed` with `reasonCode` `provider_unsupported` or `token_invalid`; `serviceUnavailable` with
|
|
53
|
+
* `reasonCode` `device_cipher_unavailable` (retry later); `rateLimited` above ten registrations a minute; the
|
|
54
|
+
* not-found error while notifications are not enabled for your tenant; `sessionRequired` for a publishable-key caller.
|
|
55
|
+
*/
|
|
56
|
+
registerDevice(input: RegisterDeviceInput, opts?: {
|
|
57
|
+
readonly signal?: AbortSignal;
|
|
58
|
+
}): Promise<EverfurResult<RegisteredDevice>>;
|
|
59
|
+
/**
|
|
60
|
+
* `DELETE /widget/v1/me/devices/{device_id}`. Settles `ok(undefined)` on 204; an unknown id and another member's
|
|
61
|
+
* device are the same not-found error.
|
|
62
|
+
*/
|
|
63
|
+
unregisterDevice(deviceId: string, opts?: {
|
|
64
|
+
readonly signal?: AbortSignal;
|
|
65
|
+
}): Promise<EverfurResult<void>>;
|
|
66
|
+
/** `PUT /widget/v1/me/notification-preferences`. Settles `ok(NotificationPreferences)`. */
|
|
67
|
+
setPreferences(input: NotificationPreferencesInput, opts?: {
|
|
68
|
+
readonly signal?: AbortSignal;
|
|
69
|
+
}): Promise<EverfurResult<NotificationPreferences>>;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* The part of the runtime this client needs: the current auth at call time, the partner's error policy, and whether
|
|
73
|
+
* the runtime is gone. `useEverfurContext().runtime` (any `EverfurRuntime`) satisfies it; the narrow shape keeps this
|
|
74
|
+
* subpath's public types to what it reads.
|
|
75
|
+
*/
|
|
76
|
+
interface NotificationsRuntime {
|
|
77
|
+
readonly isDisposed: boolean;
|
|
78
|
+
readonly registry: {
|
|
79
|
+
readonly services: {
|
|
80
|
+
authFor(userRef: UserRef | null): AuthContext;
|
|
81
|
+
readonly errorPolicy: ErrorPolicyPort | undefined;
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
/** The sub-reasons a notifications call, or a delivery, can carry as `EverfurError.reasonCode`. */
|
|
86
|
+
type NotificationsReasonCode = 'provider_unsupported' | 'token_invalid' | 'device_cipher_unavailable' | 'credentials_missing';
|
|
87
|
+
/**
|
|
88
|
+
* DEVELOPER-FACING explanations, one per reason. Log them, show them on a developer screen, never render them to a
|
|
89
|
+
* member: `displayMessage` is the copy a person sees. `credentials_missing` is not a route answer but the reason a
|
|
90
|
+
* delivery is skipped on Everfur's side (visible on the events API and in the partner console); it is here so one
|
|
91
|
+
* table explains every reason this surface can name.
|
|
92
|
+
*/
|
|
93
|
+
declare const NOTIFICATIONS_REASON_MESSAGES: Readonly<Record<NotificationsReasonCode, string>>;
|
|
94
|
+
/** The developer-facing sentence for an error's `reasonCode`, or null when it carries none this surface knows. */
|
|
95
|
+
declare function explainNotificationsReason(error: EverfurError): string | null;
|
|
96
|
+
/**
|
|
97
|
+
* The client over the runtime under your provider (`useEverfurContext().runtime`). Auth is read at call time, so the
|
|
98
|
+
* client can be built once and reused across sign-ins; a disposed runtime settles every verb without a request.
|
|
99
|
+
*/
|
|
100
|
+
declare function createNotificationsClient(runtime: NotificationsRuntime): NotificationsClient;
|
|
101
|
+
|
|
102
|
+
/** What the hook needs from you: the token your notification library obtained, or null until you have one. */
|
|
103
|
+
interface EverfurNotificationsOptions {
|
|
104
|
+
/**
|
|
105
|
+
* The push token as your library printed it (`ExponentPushToken[...]`, or an FCM registration token), or null
|
|
106
|
+
* while you do not have one (permission not asked, not granted, or the token not yet fetched). Nothing is
|
|
107
|
+
* registered without it; pass it as soon as you have it and the hook registers.
|
|
108
|
+
*/
|
|
109
|
+
readonly token: string | null;
|
|
110
|
+
/** `expo` for a token from expo-notifications, `fcm` for a Firebase registration token. */
|
|
111
|
+
readonly provider: PushProvider;
|
|
112
|
+
readonly platform: DevicePlatform;
|
|
113
|
+
/** Your own stable id for this install, if you keep one. */
|
|
114
|
+
readonly installationId?: string;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* `signed_out`: no signed-in user on the provider (nothing to register). `no_token`: a user, no token yet.
|
|
118
|
+
* `registering` / `registered` / `failed` / `unavailable`: the registration of the current token.
|
|
119
|
+
* `unavailable` is the dark tenant: notifications are not enabled for your client (the routes answer 404).
|
|
120
|
+
* `unregistered`: `unregister()` was called; `register()` registers again.
|
|
121
|
+
*/
|
|
122
|
+
type EverfurNotificationsStatus = 'signed_out' | 'no_token' | 'registering' | 'registered' | 'unavailable' | 'failed' | 'unregistered';
|
|
123
|
+
interface EverfurNotificationsState {
|
|
124
|
+
readonly status: EverfurNotificationsStatus;
|
|
125
|
+
/** The device Everfur registered for this install and user, or null. */
|
|
126
|
+
readonly device: RegisteredDevice | null;
|
|
127
|
+
/** The settled failure of the last registration, or null. `error.displayMessage` is safe to show. */
|
|
128
|
+
readonly error: EverfurError | null;
|
|
129
|
+
/** Register the current token now (a retry after `failed`, or after `unregister()`). Settles, never throws. */
|
|
130
|
+
register(): Promise<EverfurResult<RegisteredDevice>>;
|
|
131
|
+
/** Unregister this install's device for the signed-in user. Settles, never throws. */
|
|
132
|
+
unregister(): Promise<EverfurResult<void>>;
|
|
133
|
+
/** The member's push and email switches, both at once (`PUT /widget/v1/me/notification-preferences`). */
|
|
134
|
+
setPreferences(input: NotificationPreferencesInput): Promise<EverfurResult<NotificationPreferences>>;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* The notifications client bound to the runtime under your provider, for the imperative calls (`setPreferences`
|
|
138
|
+
* from a settings screen, say). Auth is read at call time, so one client serves every sign-in.
|
|
139
|
+
*/
|
|
140
|
+
declare function useEverfurNotificationsClient(): NotificationsClient;
|
|
141
|
+
/**
|
|
142
|
+
* Register this install's push token for the signed-in member, keep it registered as the token and the user
|
|
143
|
+
* change, and unregister it before sign-out. Call it once, high in the tree under `EverfurProvider`.
|
|
144
|
+
*/
|
|
145
|
+
declare function useEverfurNotifications(options: EverfurNotificationsOptions): EverfurNotificationsState;
|
|
146
|
+
|
|
147
|
+
/** The version of the routing block this release reads. */
|
|
148
|
+
declare const EVERFUR_NOTIFICATION_VERSION = 1;
|
|
149
|
+
/** The closed target kinds, in the backend's order (`partner_target.py` TARGET_KINDS). */
|
|
150
|
+
declare const EVERFUR_NOTIFICATION_TARGET_KINDS: readonly ["record_request", "pet", "visit", "case"];
|
|
151
|
+
/** One target kind. */
|
|
152
|
+
type EverfurNotificationTargetKind = (typeof EVERFUR_NOTIFICATION_TARGET_KINDS)[number];
|
|
153
|
+
/**
|
|
154
|
+
* The event types Everfur builds a push target for (`partner_target.py` TARGET_BUILDERS), in its order. The member
|
|
155
|
+
* events, the urgency verdict and the endpoint test event reach the partner's webhook only and never a device, and
|
|
156
|
+
* `visit.completed`, `visit.rescheduled` and `visit.ended` carry no consumer copy, so they are never pushed either;
|
|
157
|
+
* they are listed because the platform builds their target.
|
|
158
|
+
*/
|
|
159
|
+
declare const EVERFUR_NOTIFICATION_EVENT_TYPES: readonly ["record_request.updated", "record.ready", "pet.vaccination.due", "visit.booked", "visit.cancelled", "visit.completed", "visit.no_show", "visit.rescheduled", "visit.reminder", "visit.followup_sent", "visit.message_received", "visit.ended", "chat.follow_up_due", "chat.reminder_due", "record.activation"];
|
|
160
|
+
/** One pushed event type. */
|
|
161
|
+
type EverfurNotificationEventType = (typeof EVERFUR_NOTIFICATION_EVENT_TYPES)[number];
|
|
162
|
+
/** What a tapped notification is about, keyed on `kind`. The optional references are null when the push carried none. */
|
|
163
|
+
type EverfurNotificationTarget = {
|
|
164
|
+
/**
|
|
165
|
+
* A records request (`record_request.updated`, `record.ready`, and `record.activation`, which says what the
|
|
166
|
+
* request's parse found): open that request.
|
|
167
|
+
*/
|
|
168
|
+
readonly kind: 'record_request';
|
|
169
|
+
readonly requestId: RecordsRequestId;
|
|
170
|
+
readonly petRef: PetRef | null;
|
|
171
|
+
} | {
|
|
172
|
+
/** A pet: `pet.vaccination.due` opens that pet's records, `chat.reminder_due` that pet's chat. */
|
|
173
|
+
readonly kind: 'pet';
|
|
174
|
+
readonly petRef: PetRef;
|
|
175
|
+
} | {
|
|
176
|
+
/**
|
|
177
|
+
* A vet visit (`visit.*`): open that visit. `visitRef` is the partner visit reference the visit events carry.
|
|
178
|
+
* `intent` is what to open for it, derived from the event type with the consumer app's routing (the push
|
|
179
|
+
* itself carries none): `visit` for a booking or a change to it, `join` for a reminder, `messages` for the
|
|
180
|
+
* vet's reply or the follow-up, `summary` for a completed visit. Pass both to `useVetVisit().openVisit`.
|
|
181
|
+
* `null` for a cancelled or missed visit: there is nothing left to open, so route to a new booking.
|
|
182
|
+
*/
|
|
183
|
+
readonly kind: 'visit';
|
|
184
|
+
readonly visitRef: string;
|
|
185
|
+
readonly petRef: PetRef | null;
|
|
186
|
+
readonly intent: VetVisitIntent | null;
|
|
187
|
+
} | {
|
|
188
|
+
/** A follow-up case (`chat.follow_up_due`): open the conversation the check-in landed in. */
|
|
189
|
+
readonly kind: 'case';
|
|
190
|
+
readonly caseRef: string;
|
|
191
|
+
readonly conversationId: ConversationId | null;
|
|
192
|
+
readonly petRef: PetRef | null;
|
|
193
|
+
};
|
|
194
|
+
/** A parsed push: the event it announces and the thing to open. Frozen. */
|
|
195
|
+
interface EverfurNotification {
|
|
196
|
+
/** `evt_` plus the public event id, the same id the webhook envelope for this event carries. */
|
|
197
|
+
readonly eventId: string;
|
|
198
|
+
readonly eventType: EverfurNotificationEventType;
|
|
199
|
+
readonly target: EverfurNotificationTarget;
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Read the Everfur routing block out of a received push, or null when there is none or it is not one Everfur would
|
|
203
|
+
* send. Pure and total: it never throws, whatever it is handed.
|
|
204
|
+
*
|
|
205
|
+
* Pass the object your notification library gave you: an expo-notifications `Notification` or `NotificationResponse`,
|
|
206
|
+
* an FCM `RemoteMessage`, or its `data` map. Route on `target.kind`; `eventType` says why the push was sent.
|
|
207
|
+
*/
|
|
208
|
+
declare function parseEverfurNotification(payload: unknown): EverfurNotification | null;
|
|
209
|
+
|
|
210
|
+
export { type DevicePlatform as D, type EverfurNotificationsOptions as E, NOTIFICATIONS_REASON_MESSAGES as N, type PushProvider as P, type RegisterDeviceInput as R, type EverfurNotificationsState as a, EVERFUR_NOTIFICATION_EVENT_TYPES as b, EVERFUR_NOTIFICATION_TARGET_KINDS as c, EVERFUR_NOTIFICATION_VERSION as d, type EverfurNotification as e, type EverfurNotificationEventType as f, type EverfurNotificationTarget as g, type EverfurNotificationTargetKind as h, type EverfurNotificationsStatus as i, type NotificationPreferences as j, type NotificationPreferencesInput as k, type NotificationsClient as l, type NotificationsReasonCode as m, type NotificationsRuntime as n, type RegisteredDevice as o, createNotificationsClient as p, explainNotificationsReason as q, parseEverfurNotification as r, useEverfurNotifications as s, useEverfurNotificationsClient as u };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { E as EverfurResult } from './EverfurResult-
|
|
2
|
-
import { j as FetchLike } from './config-
|
|
3
|
-
import { P as PetHealthProfileInput, a as PetHealthProfile } from './profile-CSs1wlXT.
|
|
1
|
+
import { E as EverfurResult } from './EverfurResult.d-D_-254ZY.js';
|
|
2
|
+
import { j as FetchLike } from './config.d-MX7IKP2f.js';
|
|
3
|
+
import { P as PetHealthProfileInput, a as PetHealthProfile } from './profile.d-CSs1wlXT.js';
|
|
4
4
|
|
|
5
5
|
/** How your backend reaches Everfur for pet writes. Build it once and reuse it. */
|
|
6
6
|
interface PartnerServerClient {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { E as EverfurResult } from './EverfurResult-
|
|
2
|
-
import { j as FetchLike } from './config-
|
|
3
|
-
import { P as PetHealthProfileInput, a as PetHealthProfile } from './profile-CSs1wlXT.
|
|
1
|
+
import { E as EverfurResult } from './EverfurResult.d-BFH-3s6E.cjs';
|
|
2
|
+
import { j as FetchLike } from './config.d-DJ4mvf_w.cjs';
|
|
3
|
+
import { P as PetHealthProfileInput, a as PetHealthProfile } from './profile.d-CSs1wlXT.cjs';
|
|
4
4
|
|
|
5
5
|
/** How your backend reaches Everfur for pet writes. Build it once and reuse it. */
|
|
6
6
|
interface PartnerServerClient {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { E as EverfurResult } from './EverfurResult-
|
|
2
|
-
import { A as AuthContext } from './identity-
|
|
3
|
-
import { P as PetRef } from './ids-B2GAAifq.
|
|
4
|
-
import { P as PetHealthProfileInput, a as PetHealthProfile } from './profile-CSs1wlXT.
|
|
1
|
+
import { E as EverfurResult } from './EverfurResult.d-BFH-3s6E.cjs';
|
|
2
|
+
import { A as AuthContext } from './identity.d-CJfnWOdH.cjs';
|
|
3
|
+
import { P as PetRef } from './ids.d-B2GAAifq.cjs';
|
|
4
|
+
import { P as PetHealthProfileInput, a as PetHealthProfile } from './profile.d-CSs1wlXT.cjs';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Server-declared bounds on `WidgetPetInput`, mirrored so a violation is refused before the wire rather
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { E as EverfurResult } from './EverfurResult-
|
|
2
|
-
import { A as AuthContext } from './identity-
|
|
3
|
-
import { P as PetRef } from './ids-B2GAAifq.
|
|
4
|
-
import { P as PetHealthProfileInput, a as PetHealthProfile } from './profile-CSs1wlXT.
|
|
1
|
+
import { E as EverfurResult } from './EverfurResult.d-D_-254ZY.js';
|
|
2
|
+
import { A as AuthContext } from './identity.d-BePPZ7Uv.js';
|
|
3
|
+
import { P as PetRef } from './ids.d-B2GAAifq.js';
|
|
4
|
+
import { P as PetHealthProfileInput, a as PetHealthProfile } from './profile.d-CSs1wlXT.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Server-declared bounds on `WidgetPetInput`, mirrored so a violation is refused before the wire rather
|
package/dist/photo/index.cjs
CHANGED
|
@@ -21,6 +21,8 @@
|
|
|
21
21
|
/* @__PURE__ */Object.freeze({wireCode:"attachment_unreadable",envelope:"http_envelope",httpStatus:400,retryable:false}),
|
|
22
22
|
/* @__PURE__ */Object.freeze({wireCode:"authExpired",envelope:"http_envelope",httpStatus:401,retryable:true}),
|
|
23
23
|
/* @__PURE__ */Object.freeze({wireCode:"authRejected",envelope:"http_envelope",httpStatus:401,retryable:false}),
|
|
24
|
+
/* @__PURE__ */Object.freeze({wireCode:"catalog_empty_refused",envelope:"http_envelope",httpStatus:409,retryable:false}),
|
|
25
|
+
/* @__PURE__ */Object.freeze({wireCode:"catalog_shrink_refused",envelope:"http_envelope",httpStatus:409,retryable:false}),
|
|
24
26
|
/* @__PURE__ */Object.freeze({wireCode:"consent_invalid",envelope:"http_envelope",httpStatus:422,retryable:false}),
|
|
25
27
|
/* @__PURE__ */Object.freeze({wireCode:"consent_required",envelope:"http_envelope",httpStatus:422,retryable:false}),
|
|
26
28
|
/* @__PURE__ */Object.freeze({wireCode:"consent_scope_wrong_route",envelope:"http_envelope",httpStatus:400,retryable:false}),
|
|
@@ -45,6 +47,7 @@
|
|
|
45
47
|
/* @__PURE__ */Object.freeze({wireCode:"invalid_request",envelope:"oauth_error",httpStatus:400,retryable:false}),
|
|
46
48
|
/* @__PURE__ */Object.freeze({wireCode:"invalid_scope",envelope:"oauth_error",httpStatus:400,retryable:false}),
|
|
47
49
|
/* @__PURE__ */Object.freeze({wireCode:"invalid_target",envelope:"oauth_error",httpStatus:400,retryable:false}),
|
|
50
|
+
/* @__PURE__ */Object.freeze({wireCode:"linked_account_read_only",envelope:"http_envelope",httpStatus:409,retryable:false}),
|
|
48
51
|
/* @__PURE__ */Object.freeze({wireCode:"mcp_connection_not_found",envelope:"http_envelope",httpStatus:404,retryable:false}),
|
|
49
52
|
/* @__PURE__ */Object.freeze({wireCode:"mcp_request_conflict",envelope:"http_envelope",httpStatus:409,retryable:false}),
|
|
50
53
|
/* @__PURE__ */Object.freeze({wireCode:"mcp_request_gone",envelope:"http_envelope",httpStatus:410,retryable:false}),
|
|
@@ -88,7 +91,7 @@
|
|
|
88
91
|
/* @__PURE__ */Object.freeze({wireCode:"verify_user_ref_invalid",envelope:"http_envelope",httpStatus:422,retryable:false}),
|
|
89
92
|
/* @__PURE__ */Object.freeze({wireCode:"webhook_endpoint_update_empty",envelope:"http_envelope",httpStatus:400,retryable:false}),
|
|
90
93
|
/* @__PURE__ */Object.freeze({wireCode:"webhook_endpoint_update_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),
|
|
91
|
-
/* @__PURE__ */Object.freeze({wireCode:"webhook_url_rejected",envelope:"http_envelope",httpStatus:400,retryable:false})]);/* @__PURE__ */Object.freeze(CONTRACT_RETRYABILITY.map(row=>row.wireCode));var NORMALIZED_FOLD=/* @__PURE__ */Object.freeze({ValidationException:"validationFailed",AuthorizationException:"authRejected",PaymentRequiredException:"paymentRequired",AccessDeniedException:"accessDenied",ResourceNotFoundException:"resourceNotFound",ConflictException:"conflict",ThrottlingException:"rateLimited",InternalFailureException:"internalError",NotImplementedException:"notImplemented",ServiceUnavailableException:"serviceUnavailable",MethodNotAllowedException:"validationFailed",authExpired:"authExpired",unavailable:"serviceUnavailable",session_required:"sessionRequired",session_revoked:"authExpired",accessDenied:"accessDenied",invalidRequest:"sdkUpdateRequired",authRejected:"authRejected",rateLimited:"rateLimited",insufficientCapability:"accessDenied",unrestrictedKeyRequired:"accessDenied",user_ref_invalid:"validationFailed",event_cursor_invalid:"validationFailed",event_filter_invalid:"validationFailed",event_payload_invalid:"validationFailed",event_type_unknown:"validationFailed",idempotency_key_invalid:"validationFailed",idempotency_key_required:"validationFailed",idempotency_key_reused:"idempotencyConflict",payload_too_large:"validationFailed",webhook_url_rejected:"validationFailed",webhook_endpoint_update_empty:"validationFailed",webhook_endpoint_update_invalid:"validationFailed",event_type_not_available:"conflict",record_subject_not_found:"resourceNotFound",records_consent_required:"conflict",record_species_unsupported:"validationFailed",record_upload_invalid:"validationFailed",FILE_TOO_LARGE:"validationFailed",INVALID_CONTENT_TYPE:"validationFailed",attachment_unreadable:"validationFailed",provider_unsupported:"validationFailed",token_invalid:"validationFailed",device_cipher_unavailable:"serviceUnavailable",email_invalid:"validationFailed",consent_required:"validationFailed",consent_invalid:"validationFailed",consent_scope_wrong_route:"validationFailed",IDEMPOTENCY_KEY_IN_FLIGHT:"idempotencyInFlight",IDEMPOTENCY_KEY_REUSED_DIFFERENT_REQUEST:"idempotencyConflict",DAILY_QUOTA_EXCEEDED:"quotaExceeded",TIER_UPGRADE_REQUIRED:"paymentRequired",not_found:"conversationNotFound",timeout:"streamTimeout",internal_error:"internalError",invalid_request:"validationFailed",invalid_client:"authRejected",invalid_grant:"authRejected",unsupported_grant_type:"validationFailed",invalid_scope:"validationFailed",invalid_target:"validationFailed",invalid_redirect_uri:"validationFailed",invalid_client_metadata:"validationFailed",unsupported_response_type:"validationFailed",access_denied:"accessDenied",slow_down:"rateLimited",mcp_request_not_found:"resourceNotFound",mcp_request_gone:"resourceNotFound",mcp_connection_not_found:"resourceNotFound",mcp_request_conflict:"conflict",sandbox_only:"accessDenied",tenant_has_no_capabilities:"conflict",verify_mint_refused:"accessDenied",verify_mint_rate_limited:"rateLimited",verify_mint_unavailable:"serviceUnavailable",verify_user_ref_invalid:"validationFailed",insufficient_scope:"accessDenied",tenant_filter_invalid:"validationFailed",tenant_resource_not_found:"resourceNotFound",tenant_surface_not_enabled:"conflict",pet_health_species_unsupported:"validationFailed",pet_health_list_removals_unconfirmed:"validationFailed",petRefInUse:"conflict",share_limit_reached:"conflict",pet_not_registered:"resourceNotFound",species_unsupported:"validationFailed",partner_visit_owner_only:"accessDenied",partner_visit_link_conflict:"conflict",partner_visit_pet_already_mapped:"conflict"}),CONTRACT_ERROR_ROWS=/* @__PURE__ */Object.freeze(CONTRACT_RETRYABILITY.map(generated=>/* @__PURE__ */Object.freeze({wireCode:generated.wireCode,envelope:generated.envelope,retryable:generated.retryable,normalized:NORMALIZED_FOLD[generated.wireCode]}))),BY_KEY=new Map(CONTRACT_ERROR_ROWS.map(r=>[r.envelope+r.wireCode.toUpperCase(),r])),ENVELOPE_LOOKUP_ORDER=/* @__PURE__ */Object.freeze(["http_envelope",...[...new Set(CONTRACT_ERROR_ROWS.map(r=>r.envelope))].filter(e=>e!=="http_envelope").sort()]);function contractErrorFor(wireCode,envelope){if(typeof wireCode!="string")return;let key=wireCode.trim().toUpperCase();if(key.length!==0)for(let candidate of[envelope??"http_envelope",...ENVELOPE_LOOKUP_ORDER]){let row=BY_KEY.get(candidate+key);if(row)return row}}var CATEGORY_OF=/* @__PURE__ */Object.freeze({authExpired:"authentication",authRejected:"authentication",sessionRequired:"authentication",identitySignatureRequired:"authentication",accessDenied:"authorization",paymentRequired:"entitlement",quotaExceeded:"rateLimit",rateLimited:"rateLimit",validationFailed:"invalidRequest",sdkUpdateRequired:"invalidRequest",runtimeDisposed:"invalidRequest",conversationNotFound:"notFound",petNotFound:"notFound",resourceNotFound:"notFound",conflict:"conflict",idempotencyConflict:"conflict",idempotencyInFlight:"conflict",streamTimeout:"connection",streamIncomplete:"connection",upstreamLlmTimeout:"connection",serviceUnavailable:"connection",internalError:"server",notImplemented:"server",mediaUploadFailed:"media",moderationBlocked:"policy",unknown:"unknown"});function categoryFor(code){return CATEGORY_OF[code]}function fromWire(wire){let contractRow=contractErrorFor(wire);if(contractRow)return contractRow.normalized;let upper=(wire??"").trim().toUpperCase(),canonical=upper.replace(/[^A-Z0-9]/g,"");if(canonical==="AUTHREJECTED")return"authRejected";if(upper.startsWith("AUTH"))return"authExpired";switch(canonical){case"DAILYQUOTAEXCEEDED":case"QUOTAEXCEEDED":return"quotaExceeded";case"RATELIMITED":case"TOOMANYREQUESTS":case"TELEVETRATELIMITED":return"rateLimited";case"IDEMPOTENCYKEYCONFLICT":case"IDEMPOTENCYCONFLICT":return"idempotencyConflict";case"ACCESSDENIED":case"FORBIDDEN":return"accessDenied";case"IDENTITYSIGNATUREREQUIRED":return"identitySignatureRequired";case"RUNTIMEDISPOSED":return"runtimeDisposed";case"NOTFOUND":case"CONVERSATIONNOTFOUND":return"conversationNotFound";case"PETNOTFOUND":return"petNotFound";case"TIMEOUT":case"STREAMTIMEOUT":return"streamTimeout";case"MEDIAUPLOADFAILED":case"UNRECOGNIZEDVIDEOFORMAT":case"FILETOOSMALL":return"mediaUploadFailed";case"MODERATIONBLOCKED":return"moderationBlocked";case"UPSTREAMLLMTIMEOUT":return"upstreamLlmTimeout";case"INTERNALERROR":case"INTERNALSERVERERROR":return"internalError";case"STREAMINCOMPLETE":case"CHATSTREAMINCOMPLETE":return"streamIncomplete";case"INVALIDANALYSISTYPE":case"INVALIDUPLOADPURPOSE":return"unknown";default:return"unknown"}}var AUTO_RETRYABLE_CODES=/* @__PURE__ */new Set(["streamTimeout","rateLimited","internalError","upstreamLlmTimeout","streamIncomplete"]);function isAutoRetryable(code){return AUTO_RETRYABLE_CODES.has(code)}var RETRYABLE_CONTRACT_CODES=/* @__PURE__ */new Set(["serviceUnavailable","conflict","idempotencyInFlight"]);function isRetryableCode(code){return isAutoRetryable(code)||RETRYABLE_CONTRACT_CODES.has(code)}var BACKOFF_BASE_MS=500,BACKOFF_CAP_MS=8e3,MAX_RETRY_ATTEMPTS=4;function backoffDelayMs(attempt,rng=Math.random){let bounded=Math.max(0,attempt),ceiling=Math.min(BACKOFF_BASE_MS*2**bounded,BACKOFF_CAP_MS);return Math.floor(rng()*ceiling)}var ACCESS_DENIED_COPY="This feature isn't available on your account right now.",VALIDATION_FAILED_COPY="Something in that request was not right. Check the details and try again.",USER_FACING_COPY=/* @__PURE__ */Object.freeze({authExpired:"Please sign in again to continue.",authRejected:"Please sign in again to continue.",sessionRequired:"This app needs to be updated to keep using Everfur.",accessDenied:ACCESS_DENIED_COPY,paymentRequired:"This is part of a paid plan.",quotaExceeded:"You have used today's messages. This resets tomorrow.",rateLimited:"You are sending messages quickly. Try again in a few seconds.",validationFailed:VALIDATION_FAILED_COPY,sdkUpdateRequired:"This app needs to be updated to keep using Everfur.",conflict:"That is already running. Wait for it to finish, then try again.",idempotencyConflict:"That message was already delivered.",idempotencyInFlight:"That is still processing. Give it a moment.",conversationNotFound:"This conversation is no longer available.",petNotFound:"We could not find that pet. Please pick a pet and try again.",resourceNotFound:"We could not find that.",streamTimeout:"The response timed out. Tap retry to try again.",mediaUploadFailed:"We could not upload that photo. Please attach it again.",moderationBlocked:"This request cannot be answered here.",upstreamLlmTimeout:"The response timed out. Tap retry to try again.",internalError:"We hit a snag on our end. Please try again.",notImplemented:"That is not available yet.",serviceUnavailable:"That service is briefly unavailable. Try again shortly.",streamIncomplete:"The connection dropped mid-answer. Tap retry to continue.",identitySignatureRequired:ACCESS_DENIED_COPY,runtimeDisposed:VALIDATION_FAILED_COPY,unknown:"Something went wrong. Please try again."}),SESSION_REVOKED_COPY="This session has ended. Please sign in again.";function displayFor(code,wireCode){return(code==="authRejected"||code==="authExpired")&&typeof wireCode=="string"&&wireCode.trim().toLowerCase()==="session_revoked"?SESSION_REVOKED_COPY:userFacingError(code)}function userFacingError(code){return USER_FACING_COPY[code]}function defineHidden(target,key,value){Object.defineProperty(target,key,{value:value,enumerable:false,writable:false,configurable:false})}var REASON_CODE_SHAPE=/^[a-z][a-z0-9_]{0,63}$/;function makeEverfurError(code,opts){let row=contractErrorFor(opts?.wireCode,opts?.wireEnvelope),error={code:code,category:categoryFor(code),retryable:opts?.retryable??isRetryableCode(code),displayMessage:displayFor(code,opts?.wireCode)};opts?.httpStatus!==void 0&&(error.httpStatus=opts.httpStatus),opts?.requestId&&(error.requestId=opts.requestId),typeof opts?.reasonCode=="string"&&REASON_CODE_SHAPE.test(opts.reasonCode)&&(error.reasonCode=opts.reasonCode);let wait=opts?.retryAfterSeconds;if(typeof wait=="number"&&Number.isFinite(wait)&&wait>=0&&(error.retryAfterSeconds=Math.round(wait)),row);return opts?.wireMessage&&defineHidden(error,"wireMessage",opts.wireMessage),opts?.raw!==void 0&&opts.raw!==null&&defineHidden(error,"raw",opts.raw),/* @__PURE__ */Object.freeze(error)}function ok(value,warning){/* @__PURE__ */
|
|
94
|
+
/* @__PURE__ */Object.freeze({wireCode:"webhook_url_rejected",envelope:"http_envelope",httpStatus:400,retryable:false})]);/* @__PURE__ */Object.freeze(CONTRACT_RETRYABILITY.map(row=>row.wireCode));var NORMALIZED_FOLD=/* @__PURE__ */Object.freeze({ValidationException:"validationFailed",AuthorizationException:"authRejected",PaymentRequiredException:"paymentRequired",AccessDeniedException:"accessDenied",ResourceNotFoundException:"resourceNotFound",ConflictException:"conflict",ThrottlingException:"rateLimited",InternalFailureException:"internalError",NotImplementedException:"notImplemented",ServiceUnavailableException:"serviceUnavailable",MethodNotAllowedException:"validationFailed",authExpired:"authExpired",unavailable:"serviceUnavailable",session_required:"sessionRequired",session_revoked:"authExpired",accessDenied:"accessDenied",invalidRequest:"sdkUpdateRequired",authRejected:"authRejected",rateLimited:"rateLimited",insufficientCapability:"accessDenied",unrestrictedKeyRequired:"accessDenied",user_ref_invalid:"validationFailed",event_cursor_invalid:"validationFailed",event_filter_invalid:"validationFailed",event_payload_invalid:"validationFailed",event_type_unknown:"validationFailed",idempotency_key_invalid:"validationFailed",idempotency_key_required:"validationFailed",idempotency_key_reused:"idempotencyConflict",payload_too_large:"validationFailed",webhook_url_rejected:"validationFailed",webhook_endpoint_update_empty:"validationFailed",webhook_endpoint_update_invalid:"validationFailed",event_type_not_available:"conflict",record_subject_not_found:"resourceNotFound",records_consent_required:"conflict",record_species_unsupported:"validationFailed",record_upload_invalid:"validationFailed",FILE_TOO_LARGE:"validationFailed",INVALID_CONTENT_TYPE:"validationFailed",attachment_unreadable:"validationFailed",provider_unsupported:"validationFailed",token_invalid:"validationFailed",device_cipher_unavailable:"serviceUnavailable",email_invalid:"validationFailed",consent_required:"validationFailed",consent_invalid:"validationFailed",consent_scope_wrong_route:"validationFailed",IDEMPOTENCY_KEY_IN_FLIGHT:"idempotencyInFlight",IDEMPOTENCY_KEY_REUSED_DIFFERENT_REQUEST:"idempotencyConflict",DAILY_QUOTA_EXCEEDED:"quotaExceeded",TIER_UPGRADE_REQUIRED:"paymentRequired",not_found:"conversationNotFound",timeout:"streamTimeout",internal_error:"internalError",invalid_request:"validationFailed",invalid_client:"authRejected",invalid_grant:"authRejected",unsupported_grant_type:"validationFailed",invalid_scope:"validationFailed",invalid_target:"validationFailed",invalid_redirect_uri:"validationFailed",invalid_client_metadata:"validationFailed",unsupported_response_type:"validationFailed",access_denied:"accessDenied",slow_down:"rateLimited",mcp_request_not_found:"resourceNotFound",mcp_request_gone:"resourceNotFound",mcp_connection_not_found:"resourceNotFound",mcp_request_conflict:"conflict",sandbox_only:"accessDenied",tenant_has_no_capabilities:"conflict",verify_mint_refused:"accessDenied",verify_mint_rate_limited:"rateLimited",verify_mint_unavailable:"serviceUnavailable",verify_user_ref_invalid:"validationFailed",insufficient_scope:"accessDenied",tenant_filter_invalid:"validationFailed",tenant_resource_not_found:"resourceNotFound",tenant_surface_not_enabled:"conflict",pet_health_species_unsupported:"validationFailed",pet_health_list_removals_unconfirmed:"validationFailed",petRefInUse:"conflict",share_limit_reached:"conflict",pet_not_registered:"resourceNotFound",species_unsupported:"validationFailed",partner_visit_owner_only:"accessDenied",partner_visit_link_conflict:"conflict",partner_visit_pet_already_mapped:"conflict",linked_account_read_only:"conflict",catalog_empty_refused:"conflict",catalog_shrink_refused:"conflict"}),CONTRACT_ERROR_ROWS=/* @__PURE__ */Object.freeze(CONTRACT_RETRYABILITY.map(generated=>/* @__PURE__ */Object.freeze({wireCode:generated.wireCode,envelope:generated.envelope,retryable:generated.retryable,normalized:NORMALIZED_FOLD[generated.wireCode]}))),BY_KEY=new Map(CONTRACT_ERROR_ROWS.map(r=>[r.envelope+r.wireCode.toUpperCase(),r])),ENVELOPE_LOOKUP_ORDER=/* @__PURE__ */Object.freeze(["http_envelope",...[...new Set(CONTRACT_ERROR_ROWS.map(r=>r.envelope))].filter(e=>e!=="http_envelope").sort()]);function contractErrorFor(wireCode,envelope){if(typeof wireCode!="string")return;let key=wireCode.trim().toUpperCase();if(key.length!==0)for(let candidate of[envelope??"http_envelope",...ENVELOPE_LOOKUP_ORDER]){let row=BY_KEY.get(candidate+key);if(row)return row}}var CATEGORY_OF=/* @__PURE__ */Object.freeze({authExpired:"authentication",authRejected:"authentication",sessionRequired:"authentication",identitySignatureRequired:"authentication",accessDenied:"authorization",paymentRequired:"entitlement",quotaExceeded:"rateLimit",rateLimited:"rateLimit",validationFailed:"invalidRequest",sdkUpdateRequired:"invalidRequest",runtimeDisposed:"invalidRequest",conversationNotFound:"notFound",petNotFound:"notFound",resourceNotFound:"notFound",conflict:"conflict",idempotencyConflict:"conflict",idempotencyInFlight:"conflict",streamTimeout:"connection",streamIncomplete:"connection",upstreamLlmTimeout:"connection",serviceUnavailable:"connection",internalError:"server",notImplemented:"server",mediaUploadFailed:"media",moderationBlocked:"policy",unknown:"unknown"});function categoryFor(code){return CATEGORY_OF[code]}function fromWire(wire){let contractRow=contractErrorFor(wire);if(contractRow)return contractRow.normalized;let upper=(wire??"").trim().toUpperCase(),canonical=upper.replace(/[^A-Z0-9]/g,"");if(canonical==="AUTHREJECTED")return"authRejected";if(upper.startsWith("AUTH"))return"authExpired";switch(canonical){case"DAILYQUOTAEXCEEDED":case"QUOTAEXCEEDED":return"quotaExceeded";case"RATELIMITED":case"TOOMANYREQUESTS":case"TELEVETRATELIMITED":return"rateLimited";case"IDEMPOTENCYKEYCONFLICT":case"IDEMPOTENCYCONFLICT":return"idempotencyConflict";case"ACCESSDENIED":case"FORBIDDEN":return"accessDenied";case"IDENTITYSIGNATUREREQUIRED":return"identitySignatureRequired";case"RUNTIMEDISPOSED":return"runtimeDisposed";case"NOTFOUND":case"CONVERSATIONNOTFOUND":return"conversationNotFound";case"PETNOTFOUND":return"petNotFound";case"TIMEOUT":case"STREAMTIMEOUT":return"streamTimeout";case"MEDIAUPLOADFAILED":case"UNRECOGNIZEDVIDEOFORMAT":case"FILETOOSMALL":return"mediaUploadFailed";case"MODERATIONBLOCKED":return"moderationBlocked";case"UPSTREAMLLMTIMEOUT":return"upstreamLlmTimeout";case"INTERNALERROR":case"INTERNALSERVERERROR":return"internalError";case"STREAMINCOMPLETE":case"CHATSTREAMINCOMPLETE":return"streamIncomplete";case"INVALIDANALYSISTYPE":case"INVALIDUPLOADPURPOSE":return"unknown";default:return"unknown"}}var AUTO_RETRYABLE_CODES=/* @__PURE__ */new Set(["streamTimeout","rateLimited","internalError","upstreamLlmTimeout","streamIncomplete"]);function isAutoRetryable(code){return AUTO_RETRYABLE_CODES.has(code)}var RETRYABLE_CONTRACT_CODES=/* @__PURE__ */new Set(["serviceUnavailable","conflict","idempotencyInFlight"]);function isRetryableCode(code){return isAutoRetryable(code)||RETRYABLE_CONTRACT_CODES.has(code)}var BACKOFF_BASE_MS=500,BACKOFF_CAP_MS=8e3,MAX_RETRY_ATTEMPTS=4;function backoffDelayMs(attempt,rng=Math.random){let bounded=Math.max(0,attempt),ceiling=Math.min(BACKOFF_BASE_MS*2**bounded,BACKOFF_CAP_MS);return Math.floor(rng()*ceiling)}var ACCESS_DENIED_COPY="This feature isn't available on your account right now.",VALIDATION_FAILED_COPY="Something in that request was not right. Check the details and try again.",USER_FACING_COPY=/* @__PURE__ */Object.freeze({authExpired:"Please sign in again to continue.",authRejected:"Please sign in again to continue.",sessionRequired:"This app needs to be updated to keep using Everfur.",accessDenied:ACCESS_DENIED_COPY,paymentRequired:"This is part of a paid plan.",quotaExceeded:"You have used today's messages. This resets tomorrow.",rateLimited:"You are sending messages quickly. Try again in a few seconds.",validationFailed:VALIDATION_FAILED_COPY,sdkUpdateRequired:"This app needs to be updated to keep using Everfur.",conflict:"That is already running. Wait for it to finish, then try again.",idempotencyConflict:"That message was already delivered.",idempotencyInFlight:"That is still processing. Give it a moment.",conversationNotFound:"This conversation is no longer available.",petNotFound:"We could not find that pet. Please pick a pet and try again.",resourceNotFound:"We could not find that.",streamTimeout:"The response timed out. Tap retry to try again.",mediaUploadFailed:"We could not upload that photo. Please attach it again.",moderationBlocked:"This request cannot be answered here.",upstreamLlmTimeout:"The response timed out. Tap retry to try again.",internalError:"We hit a snag on our end. Please try again.",notImplemented:"That is not available yet.",serviceUnavailable:"That service is briefly unavailable. Try again shortly.",streamIncomplete:"The connection dropped mid-answer. Tap retry to continue.",identitySignatureRequired:ACCESS_DENIED_COPY,runtimeDisposed:VALIDATION_FAILED_COPY,unknown:"Something went wrong. Please try again."}),SESSION_REVOKED_COPY="This session has ended. Please sign in again.",LINKED_ACCOUNT_READ_ONLY="linked_account_read_only";function displayFor(code,wireCode,reasonCode){return code==="conflict"&&reasonCode===LINKED_ACCOUNT_READ_ONLY?ACCESS_DENIED_COPY:(code==="authRejected"||code==="authExpired")&&typeof wireCode=="string"&&wireCode.trim().toLowerCase()==="session_revoked"?SESSION_REVOKED_COPY:userFacingError(code)}function userFacingError(code){return USER_FACING_COPY[code]}function defineHidden(target,key,value){Object.defineProperty(target,key,{value:value,enumerable:false,writable:false,configurable:false})}var REASON_CODE_SHAPE=/^[a-z][a-z0-9_]{0,63}$/;function makeEverfurError(code,opts){let row=contractErrorFor(opts?.wireCode,opts?.wireEnvelope),linkedReadOnly=code==="conflict"&&opts?.reasonCode===LINKED_ACCOUNT_READ_ONLY,error={code:code,category:categoryFor(code),retryable:opts?.retryable??(linkedReadOnly?false:isRetryableCode(code)),displayMessage:displayFor(code,opts?.wireCode,linkedReadOnly?LINKED_ACCOUNT_READ_ONLY:null)};opts?.httpStatus!==void 0&&(error.httpStatus=opts.httpStatus),opts?.requestId&&(error.requestId=opts.requestId),typeof opts?.reasonCode=="string"&&REASON_CODE_SHAPE.test(opts.reasonCode)&&(error.reasonCode=opts.reasonCode);let wait=opts?.retryAfterSeconds;if(typeof wait=="number"&&Number.isFinite(wait)&&wait>=0&&(error.retryAfterSeconds=Math.round(wait)),row);return opts?.wireMessage&&defineHidden(error,"wireMessage",opts.wireMessage),opts?.raw!==void 0&&opts.raw!==null&&defineHidden(error,"raw",opts.raw),/* @__PURE__ */Object.freeze(error)}function ok(value,warning){/* @__PURE__ */
|
|
92
95
|
return Object.freeze({ok:true,value:value})}function err(error){/* @__PURE__ */
|
|
93
96
|
return Object.freeze({ok:false,error:error})}var EverfurConfigError=class _EverfurConfigError extends Error{constructor(kind,message){super(message),this.name="EverfurConfigError",this.kind=kind,Object.setPrototypeOf(this,_EverfurConfigError.prototype)}};function assertNever(x){throw new Error(`assertNever: unhandled discriminated-union member ${JSON.stringify(x)}`)}function errorFrame(fields){/* @__PURE__ */
|
|
94
97
|
return Object.freeze({kind:"error",terminal:true,code:fields.code,retryable:fields.retryable,wireMessage:fields.wireMessage,synthesized:fields.synthesized,lastEventId:fields.lastEventId,serverRequestId:null})}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 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(
|
|
@@ -97,7 +100,7 @@ return Object.freeze({send:send,authorize:authorize,stream:stream})}function ass
|
|
|
97
100
|
return Object.freeze({mode:mode})}function isCaptureAvailable(camera){return camera!=null&&camera.isAvailable===true}var defaultTimers=/* @__PURE__ */Object.freeze({setTimeout:(handler,ms)=>setTimeout(handler,ms),clearTimeout:handle=>clearTimeout(handle),now:()=>Date.now()});function delayAbortable2(ms,signal,timers){return new Promise(resolve=>{if(signal.aborted){resolve();return}let holder={handle:void 0},done=()=>{timers.clearTimeout(holder.handle),signal.removeEventListener("abort",done),resolve()};holder.handle=timers.setTimeout(done,ms),signal.addEventListener("abort",done,{once:true})})}function mergeSignals2(a,b){if(!b)return a;let ctrl=new AbortController;if(a.aborted||b.aborted)return ctrl.abort(),ctrl.signal;let onAbort=()=>ctrl.abort();return a.addEventListener("abort",onAbort,{once:true}),b.addEventListener("abort",onAbort,{once:true}),ctrl.signal}var MediaStore=class{constructor(initial){this.listeners=/* @__PURE__ */new Set;this.epoch=0;this.inFlight=null;this.snapshot=/* @__PURE__ */Object.freeze({...initial})}subscribe(listener){return this.listeners.add(listener),()=>{this.listeners.delete(listener)}}getSnapshot(){return this.snapshot}patch(partial){this.snapshot=/* @__PURE__ */Object.freeze({...this.snapshot,...partial});for(let listener of this.listeners)listener()}beginOperation(external){this.inFlight?.abort();let ctrl=new AbortController;this.inFlight=ctrl;let epoch=this.epoch;return{signal:external?mergeSignals2(ctrl.signal,external):ctrl.signal,epoch:epoch,settle:()=>{this.inFlight===ctrl&&(this.inFlight=null)}}}alive(epoch){return epoch===this.epoch}rescope(){this.epoch+=1,this.inFlight?.abort(),this.inFlight=null}dispose(){this.epoch+=1,this.inFlight?.abort(),this.inFlight=null,this.listeners.clear()}};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}var CONSUMER_SAFE_DETECTION_KEYS=/* @__PURE__ */Object.freeze(["primary_label","primary_confidence","subtype_label","subtype_display","subtype_confidence","risk_tier","confidence_tier","copy_short","disease_name","disease_framing","model_version","skin_v2","eye_v2","llm_checkup"]),OPERATOR_INTERNAL_KEYS=/* @__PURE__ */Object.freeze(["decision_audit","decision_thresholds","per_class_auroc","ood_layers","gate1_score","possible_conditions","top_class"]),BOOLEAN_KEYS=/* @__PURE__ */new Set(["skin_v2","eye_v2","llm_checkup"]),CONFIDENCE_KEYS=/* @__PURE__ */new Set(["primary_confidence","subtype_confidence"]),RISK_TIER_VALUES=/* @__PURE__ */new Set(["low_risk","concern","uncertain"]),CONFIDENCE_TIER_VALUES=/* @__PURE__ */new Set(["possible","probable"]),STRING_LIMITS=/* @__PURE__ */Object.freeze({primary_label:64,subtype_label:64,subtype_display:128,copy_short:512,disease_name:128,disease_framing:512,model_version:64});function projectDetectionMetadata(raw){let source=isRecord2(raw)?raw:{},out={};for(let key of CONSUMER_SAFE_DETECTION_KEYS){if(!(key in source))continue;let value=source[key],accepted=acceptKey(key,value);accepted!==DROP&&(out[key]=accepted)}let dropped=0;for(let key of OPERATOR_INTERNAL_KEYS)key in source&&(dropped+=1);/* @__PURE__ */
|
|
98
101
|
return Object.freeze({metadata:/* @__PURE__ */Object.freeze(out),droppedOperatorKeys:dropped})}var DROP=/* @__PURE__ */Symbol("drop");function acceptKey(key,value){if(BOOLEAN_KEYS.has(key))return typeof value=="boolean"?value:DROP;if(CONFIDENCE_KEYS.has(key))return isUnitConfidence(value)?value:DROP;if(key==="risk_tier")return typeof value=="string"&&RISK_TIER_VALUES.has(value)?value:DROP;if(key==="confidence_tier")return typeof value=="string"&&CONFIDENCE_TIER_VALUES.has(value)?value:DROP;if(typeof value!="string")return DROP;let limit=STRING_LIMITS[key]??256;return value.length>limit?value.slice(0,limit):value}function isUnitConfidence(value){return typeof value=="number"&&Number.isFinite(value)&&value>=0&&value<=1}function parseInterpretation(raw){if(!isRecord2(raw))return null;let summary=asString(raw.summary),disclaimer=asString(raw.disclaimer),recommendations=asStringList(raw.recommendations??raw.recommendation);return summary===null&&disclaimer===null&&recommendations.length===0?null:/* @__PURE__ */Object.freeze({summary:summary??"",recommendations:/* @__PURE__ */Object.freeze(recommendations),disclaimer:disclaimer??""})}function locateDetectionMetadata(body){if(!isRecord2(body))return{};if(isRecord2(body.metadata))return body.metadata;let detections=body.detections;if(Array.isArray(detections)&&detections.length>0){let first=detections[0];if(isRecord2(first)&&isRecord2(first.metadata))return first.metadata;if(isRecord2(first))return first}return body}function locateInterpretation(body){return isRecord2(body)?isRecord2(body.interpretation)?body.interpretation:body:null}function isRecord2(value){return typeof value=="object"&&value!==null&&!Array.isArray(value)}function asString(value){return typeof value=="string"&&value.length>0?value:null}function asStringList(value){return typeof value=="string"?value.length>0?[value]:[]:Array.isArray(value)?value.filter(entry=>typeof entry=="string"&&entry.length>0):[]}function asUnitNumber(value){return isUnitConfidence(value)?value:null}function asFiniteNumber(value){return typeof value=="number"&&Number.isFinite(value)?value:null}var ENDPOINTS=/* @__PURE__ */Object.freeze({initiate:"/widget/v1/uploads/initiate",precheck:"/widget/v1/photo/precheck",photoAnalyze:"/widget/v1/photo/analyze",videoAnalyze:"/widget/v1/video/analyze",job:jobId=>hasLoneSurrogate(jobId)?null:`/widget/v1/analysis/jobs/${encodeURIComponent(jobId)}`});async function initiateUpload(funnel,params){let body={purpose:params.purpose,content_type:params.contentType};params.byteSize!==null&&(body.byte_size=params.byteSize);let req={method:"POST",path:ENDPOINTS.initiate,body:body,...params.signal?{signal:params.signal}:{}},res=await funnel.send("media.initiateUpload",req);if(!res.ok)return err(res.error);let policy=parsePresigned(res.value);return policy===null?err(makeEverfurError("mediaUploadFailed",{retryable:false})):ok(policy)}function parsePresigned(raw){if(!isRecord2(raw))return null;let url=asString(raw.url),s3Key=asString(raw.s3_key);if(url===null||s3Key===null)return null;let fieldsRaw=raw.fields,fields={};if(isRecord2(fieldsRaw))for(let[key,value]of Object.entries(fieldsRaw))typeof value=="string"&&(fields[key]=value);/* @__PURE__ */
|
|
99
102
|
return Object.freeze({url:url,fields:/* @__PURE__ */Object.freeze(fields),s3Key:s3Key,expiresAt:asFiniteNumber(raw.expires_at)})}async function stageUpload(upload,source,policy,idempotencyKey,signal){try{return await upload.presignedPut(fileHandleFromMedia(source),{target:policy,idempotencyKey:idempotencyKey,...signal?{signal:signal}:{}}),ok(void 0)}catch{return err(makeEverfurError("mediaUploadFailed",{retryable:false}))}}async function runPrecheck(funnel,params){let req={method:"POST",path:ENDPOINTS.precheck,body:{s3_key:params.s3Key,type:params.type},...params.signal?{signal:params.signal}:{}},res=await funnel.send("media.precheck",req);return res.ok?parsePrecheck(res.value):{verdict:"proceed",reasonCodes:[],precheckToken:null}}function parsePrecheck(raw){if(!isRecord2(raw))return{verdict:"proceed",reasonCodes:[],precheckToken:null};let verdictRaw=asString(raw.verdict),verdict=verdictRaw==="retake"||verdictRaw==="reject"?verdictRaw:"proceed",reasonCodes=Array.isArray(raw.reason_codes)?raw.reason_codes.filter(c=>typeof c=="string"):[];/* @__PURE__ */
|
|
100
|
-
return Object.freeze({verdict:verdict,reasonCodes:/* @__PURE__ */Object.freeze(reasonCodes),precheckToken:asString(raw.precheck_token)})}async function submitAnalyze(funnel,path,body,detectGate,signal){let req={method:"POST",path:path,body:body,...signal?{signal:signal}:{}},res=await funnel.send("media.analyze",req);if(res.ok){let job=parseAsyncJob(res.value);return job!==null?{kind:"async",job:job}:{kind:"sync",body:res.value}}let gate=detectGate(res.error.httpStatus,res.error);return gate!==null?{kind:"gate",gate:gate}:{kind:"error",error:res.error}}function parseAsyncJob(raw){if(!isRecord2(raw))return null;let jobId=asString(raw.job_id);if(jobId===null)return null;let status=asString(raw.status);return status!==null&&isTerminalStatus(status)?null:/* @__PURE__ */Object.freeze({jobId:jobId,estimatedSeconds:asFiniteNumber(raw.estimated_completion_seconds)})}var POLL_FIRST_DELAY_MS=2e3,POLL_MAX_DELAY_MS=5e3,POLL_BUDGET_MS=9e4;async function pollJob(funnel,jobId,deps){let{timers:timers,signal:signal,alive:alive}=deps,start=timers.now(),budget=Math.max(POLL_BUDGET_MS,(deps.estimatedSeconds??0)*1e3),delay=POLL_FIRST_DELAY_MS;for(;;){if(signal.aborted||!alive())return{kind:"aborted"};if(await delayAbortable2(delay,signal,timers),signal.aborted||!alive())return{kind:"aborted"};if(timers.now()-start>budget)return{kind:"timeout"};let path=ENDPOINTS.job(jobId);if(path===null)return{kind:"notFound"};let res=await funnel.send("media.pollJob",{method:"GET",path:path,...signal?{signal:signal}:{}},{maxAttempts:1});if(signal.aborted||!alive())return{kind:"aborted"};if(!res.ok){if(res.error.httpStatus===404)return{kind:"notFound"};delay=Math.min(POLL_MAX_DELAY_MS,delay+1e3);continue}let status=jobStatusOf(res.value);if(status==="COMPLETED")return{kind:"complete",body:res.value};if(status==="FAILED")return{kind:"failed",error:jobFailureError(res.value)};delay=Math.min(POLL_MAX_DELAY_MS,delay+1e3)}}function jobStatusOf(body){return isRecord2(body)?(asString(body.status)??"PROCESSING").toUpperCase():"PROCESSING"}function isTerminalStatus(status){let upper=status.toUpperCase();return upper==="COMPLETED"||upper==="FAILED"}function jobFailureError(body){let wire=isRecord2(body)?asString(body.error)??asString(body.error_code):null;return makeEverfurError("internalError",{retryable:false,...wire?{wireMessage:wire}:{}})}function detectPhotoGate(httpStatus,_error){return httpStatus===422?{kind:"species_unsupported",species:"cat"}:httpStatus===400?{kind:"pet_context_required"}:null}function analyzeBody(s3Key,extra){let body={s3_key:s3Key};return extra.type!==void 0&&(body.type=extra.type),extra.petRef!=null&&(body.pet_id=extra.petRef),extra.precheckToken!=null&&(body.precheck_token=extra.precheckToken),body}var ACCEPTED=/* @__PURE__ */Object.freeze({kind:"accepted"});function createPhotoController(deps){return new PhotoController(deps)}var PhotoController=class extends MediaStore{constructor(deps){super({status:"idle",region:deps.region??"skin",result:null,gate:ACCEPTED,error:null,isCaptureAvailable:isCaptureAvailable(deps.camera)}),this.funnel=deps.funnel??createRequestFunnel({auth:deps.auth,...deps.errorPolicy?{errorPolicy:deps.errorPolicy}:{}}),this.camera=deps.camera,this.upload=deps.upload,this.telemetry=deps.telemetry??noopTelemetry,this.timers=deps.timers??defaultTimers,this.makeIdempotencyKey=deps.makeIdempotencyKey??defaultIdempotencyFactory()}async capture(region,opts){if(!isCaptureAvailable(this.camera))return err(makeEverfurError("unknown",{retryable:false}));let source;try{source=await this.camera.capture(captureOptionsFor("photo"))}catch{return this.snapshot.status!=="idle"&&this.patch({status:"idle"}),err(makeEverfurError("unknown",{retryable:false}))}return this.analyze(source,region,opts)}async analyze(source,region,opts){let op=this.beginOperation(opts.signal),idempotencyKey=this.makeIdempotencyKey(),startedAt=this.timers.now();this.patch({status:"capturing",region:region,error:null,result:null,gate:ACCEPTED});try{let initiated=await initiateUpload(this.funnel,{purpose:"skin_scan",contentType:source.mimeType,byteSize:mediaByteSize(source),signal:op.signal});if(op.signal.aborted||!this.alive(op.epoch))return abortedResult();if(!initiated.ok)return this.fail(op,initiated.error);let staged=await stageUpload(this.upload,source,initiated.value,idempotencyKey,op.signal);if(op.signal.aborted||!this.alive(op.epoch))return abortedResult();if(!staged.ok)return this.fail(op,staged.error);let precheck=await runPrecheck(this.funnel,{s3Key:initiated.value.s3Key,type:region,signal:op.signal});if(op.signal.aborted||!this.alive(op.epoch))return abortedResult();if(precheck.verdict!=="proceed")return this.gateRetake(op,region,precheck.reasonCodes);this.patch({status:"analyzing"});let outcome=await submitAnalyze(this.funnel,ENDPOINTS.photoAnalyze,analyzeBody(initiated.value.s3Key,{type:region,petRef:opts.petRef,precheckToken:precheck.precheckToken}),detectPhotoGate,op.signal);if(op.signal.aborted||!this.alive(op.epoch))return abortedResult();switch(outcome.kind){case"error":return this.fail(op,outcome.error);case"gate":return this.gateDomain(op,region,outcome.gate);case"sync":return this.complete(op,outcome.body,region,null,startedAt);case"async":{let poll=await pollJob(this.funnel,outcome.job.jobId,{timers:this.timers,signal:op.signal,alive:()=>this.alive(op.epoch),estimatedSeconds:outcome.job.estimatedSeconds});if(op.signal.aborted||!this.alive(op.epoch))return abortedResult();switch(poll.kind){case"aborted":return abortedResult();case"complete":return this.complete(op,poll.body,region,outcome.job.jobId,startedAt);case"failed":return this.fail(op,poll.error);case"timeout":return this.fail(op,makeEverfurError("streamTimeout",{retryable:!0}));case"notFound":return this.fail(op,makeEverfurError("conversationNotFound",{retryable:!1,httpStatus:404}));default:return this.fail(op,makeEverfurError("internalError",{retryable:!1}))}}default:return this.fail(op,makeEverfurError("internalError",{retryable:!1}))}}finally{op.settle()}}reset(){this.inFlight?.abort(),this.inFlight=null,this.patch({status:"idle",result:null,gate:ACCEPTED,error:null})}complete(op,body,region,jobId,startedAt){if(!this.alive(op.epoch))return abortedResult();let mapped=mapPhotoResult(body,region,jobId);return mapped.droppedOperatorKeys>0&&this.telemetry.track("analysis.metadata_leak_guard",{droppedKeyCount:mapped.droppedOperatorKeys}),this.patch({status:"complete",result:mapped.result,gate:ACCEPTED,error:null}),this.telemetry.track("analysis.species_gate",{outcome:"accepted",region:region}),this.telemetry.track("analysis.result",{capability:"photo",region:region,riskTier:mapped.result.riskTier??"",confidenceTier:mapped.result.confidenceTier??"",modelVersion:mapped.result.modelVersion??"",timeToResultMs:this.timers.now()-startedAt}),ok(mapped.result)}gateDomain(op,region,gate){if(!this.alive(op.epoch))return abortedResult();let outcome=gate.kind==="species_unsupported"?/* @__PURE__ */Object.freeze({kind:"species_unsupported",species:"cat"}):/* @__PURE__ */Object.freeze({kind:"pet_context_required"});return this.patch({status:"idle",gate:outcome,error:null,result:null}),this.telemetry.track("analysis.species_gate",{outcome:gate.kind,region:region,...gate.kind==="species_unsupported"?{species:"cat"}:{}}),err(makeEverfurError("unknown",{retryable:false}))}gateRetake(op,region,reasons){if(!this.alive(op.epoch))return abortedResult();this.patch({status:"idle",gate:/* @__PURE__ */Object.freeze({kind:"retake",reasons:/* @__PURE__ */Object.freeze([...reasons])}),error:null,result:null}),this.telemetry.track("analysis.quality_gate",{usable:false,reasons:reasons});let outcome=reasons.includes("wrong_species")?"species_unsupported":"retake";return this.telemetry.track("analysis.species_gate",{outcome:outcome,region:region}),err(makeEverfurError("unknown",{retryable:false}))}fail(op,error){return this.alive(op.epoch)?(this.patch({status:"error",error:error,gate:ACCEPTED}),this.telemetry.trackExpectedFailure("analysis.error",{code:error.code,...error.httpStatus!==void 0?{httpStatus:error.httpStatus}:{}}),err(error)):abortedResult()}};function mapPhotoResult(body,region,jobId){let projection=projectDetectionMetadata(locateDetectionMetadata(body)),meta=projection.metadata,interpretation=parseInterpretation(locateInterpretation(body));return{result:/* @__PURE__ */Object.freeze({jobId:jobId,analysisType:region,primaryLabel:asString(meta.primary_label)??"Uncertain",riskTier:asRiskTier(meta.risk_tier),confidence:asUnitNumber(meta.primary_confidence),subtypeDisplay:asString(meta.subtype_display),confidenceTier:asConfidenceTier(meta.confidence_tier),diseaseName:asString(meta.disease_name),diseaseFraming:asString(meta.disease_framing),copyShort:asString(meta.copy_short),interpretation:interpretation,modelVersion:asString(meta.model_version)??(isRecord2(body)?asString(body.model_version):null)}),droppedOperatorKeys:projection.droppedOperatorKeys}}function asRiskTier(value){return value==="low_risk"||value==="concern"||value==="uncertain"?value:null}function asConfidenceTier(value){return value==="possible"||value==="probable"?value:null}function abortedResult(){return err(makeEverfurError("unknown",{retryable:false}))}function defaultIdempotencyFactory(){let counter=0;return()=>`photo-analyze-${Date.now().toString(36)}-${(counter++).toString(36)}-${Math.random().toString(36).slice(2,10)}`}var EVERFUR_CONTEXT_SYMBOL=/* @__PURE__ */Symbol.for("@everfur/sdk#EverfurContext@v1"),globalContextHost=globalThis,EverfurContext=globalContextHost[EVERFUR_CONTEXT_SYMBOL]??(globalContextHost[EVERFUR_CONTEXT_SYMBOL]=react.createContext(null));EverfurContext.displayName??="EverfurContext";function useEverfurContext(){let ctx=react.useContext(EverfurContext);if(ctx===null)throw new EverfurConfigError("not-initialized","Everfur hooks must be called inside <EverfurProvider>. Wrap your tree once, high.");return ctx}var BOOTSTRAP_SNAPSHOT=/* @__PURE__ */Object.freeze({status:"idle",region:"skin",result:null,gate:/* @__PURE__ */Object.freeze({kind:"accepted"}),error:null,isCaptureAvailable:false}),NOOP_UNSUBSCRIBE=()=>{};function usePhotoCheckup(opts){let{runtime:runtime,userRef:userRef,scopeEpoch:scopeEpoch}=useEverfurContext(),petRef=opts.petRef,[controller,setController]=react.useState(null);react.useEffect(()=>{let{services:services}=runtime.registry,acquired=runtime.registry.acquire("photo",`${userRef??""}|${petRef}`,()=>createPhotoController({...services.errorPolicy?{errorPolicy:services.errorPolicy}:{},auth:services.authFor(userRef),camera:services.camera,upload:services.upload,telemetry:services.telemetry}),controller2=>controller2.dispose());return setController(acquired),()=>{setController(current=>current===acquired?null:current),runtime.registry.release(acquired)}},[runtime,userRef,petRef,scopeEpoch]);let subscribe=react.useCallback(onChange=>controller?controller.subscribe(onChange):NOOP_UNSUBSCRIBE,[controller]),getSnapshot=react.useCallback(()=>controller?controller.getSnapshot():BOOTSTRAP_SNAPSHOT,[controller]),snapshot=react.useSyncExternalStore(subscribe,getSnapshot,getSnapshot),analyze=react.useCallback((source,region)=>controller?controller.analyze(source,region,{petRef:petRef}):Promise.resolve(notReadyError()),[controller,petRef]),capture=react.useCallback(region=>controller?controller.capture(region,{petRef:petRef}):Promise.resolve(notReadyError()),[controller,petRef]),reset=react.useCallback(()=>{controller?.reset()},[controller]);return react.useMemo(()=>({status:snapshot.status,region:snapshot.region,result:snapshot.result,gate:snapshot.gate,error:snapshot.error,isCaptureAvailable:snapshot.isCaptureAvailable,isBootstrapping:controller===null,analyze:analyze,capture:capture,reset:reset}),[snapshot,controller,analyze,capture,reset])}function notReadyError(){return err(makeEverfurError("internalError",{retryable:true}))}var freezeInPlace=Object.freeze;function deepFreeze(value){if(value!==null&&typeof value=="object"&&!Object.isFrozen(value)){freezeInPlace(value);for(let key of Object.keys(value))deepFreeze(value[key])}return value}var TEXT_SCALE_TIER_CAPS=/* @__PURE__ */Object.freeze({content:0,heading:2,control:1.8,compact:1.5,badge:1.3}),SPACE={xs:4,sm:8,md:12,lg:16,xl:24,xxl:32},RADIUS={tile:5,xs:6,sm:10,md:14,lg:20,xl:28,pill:500},TYPE_SIZE={nano:8,small:9,micro:10,tiny:11,caption:13,bodyTight:15,body:17,subtitle:20,heading:22,verdict:24},LINE_HEIGHT={tight:1.15,snug:1.3,normal:1.4,relaxed:1.55},WEIGHT={regular:"400",medium:"500",bold:"700"},LETTER_SPACING={eyebrow:1,monoWide:.9,headerBrand:-.42,tight:-.35},DEFAULT_MAX_FONT_SCALE=0,SYSTEM_FONT_FAMILY="System",SYSTEM_MONO_FAMILY="monospace",TIERS=["content","heading","control","compact","badge"];function authoredTierSizes(size){let out={};for(let tier of TIERS)out[tier]=size;return out}var NO_FONT_SOURCES=[];function baseType(){return{family:SYSTEM_FONT_FAMILY,mono:SYSTEM_MONO_FAMILY,fontUrl:null,families:{regular:SYSTEM_FONT_FAMILY,medium:SYSTEM_FONT_FAMILY,bold:SYSTEM_FONT_FAMILY,mono:SYSTEM_MONO_FAMILY,monoMedium:SYSTEM_MONO_FAMILY,monoBold:SYSTEM_MONO_FAMILY},namedFaces:{regular:false,medium:false,bold:false,mono:false,monoMedium:false,monoBold:false},fontUrls:{},size:TYPE_SIZE,tierSizes:authoredTierSizes(TYPE_SIZE),lineHeight:LINE_HEIGHT,weight:WEIGHT,letterSpacing:LETTER_SPACING,scale:1,maxScale:DEFAULT_MAX_FONT_SCALE,scaleCaps:TEXT_SCALE_TIER_CAPS,headingFamily:null,headingWeight:null,fontSources:NO_FONT_SOURCES}}var NO_SLOTS={},EASING_CURVES=/* @__PURE__ */Object.freeze({standard:/* @__PURE__ */Object.freeze([.2,0,0,1]),emphasized:/* @__PURE__ */Object.freeze([.2,.8,.2,1]),exit:/* @__PURE__ */Object.freeze([.4,0,1,1])});function cssCubicBezier(curve){return`cubic-bezier(${curve.join(", ")})`}var MOTION={duration:{instant:80,fast:140,normal:220,slow:320},spring:{gentle:{damping:18,stiffness:200}},easing:{standard:cssCubicBezier(EASING_CURVES.standard),emphasized:cssCubicBezier(EASING_CURVES.emphasized),exit:cssCubicBezier(EASING_CURVES.exit)},reducedMotion:false},LIGHT_COLOR={brand:"#10462E",brandSoft:"rgba(16,70,46,0.10)",brandSofter:"rgba(16,70,46,0.15)",brandBorder:"rgba(16,70,46,0.18)",borderHairlineGreen:"rgba(16,70,46,0.25)",brandBorderStrong:"rgba(16,70,46,0.55)",brandInk:"#10462E",linkInk:"#10462E",surface:"#FFFFFF",surfaceCream:"#FFFFFF",surfaceSubtle:"#F1F5F2",background:"#FFFFFF",borderRingCream:"#E4E4E4",chatGround:"#FFFFFF",composerFill:"#FFFFFF",composerBorder:"rgba(16,70,46,0.75)",shadow:"#0B3421",text:{primary:"#000000",secondary:"#0E462E",muted:"#6B6B6B",placeholder:"rgba(61,61,61,0.75)",onBrand:"#FFFFFF",metaCool:"#3D3D3D",timestamp:"rgba(61,61,61,0.75)"},primary:"#10462E",onPrimary:"#FFFFFF",accent:"#10462E",onAccent:"#FFFFFF",accentEdge:"#07C168",success:"#07C168",danger:"#C03410",onDanger:"#FFFFFF",errorRed:"#C03410",warningStrong:"#A45610",cautionAccent:"#D9821D",riskConcern:"#EFA700",sentiment:{up:"#07C168",neutral:"#FBC558",down:"#FF1B00"},badgeBgPositive:"rgba(7,193,104,0.12)",badgeBgCaution:"rgba(217,130,29,0.14)",badgeBgCritical:"rgba(192,52,16,0.06)",badgeBgNeutral:"rgba(107,107,107,0.12)",bubbleUser:"#10462E",bubbleAssistant:"#FFFFFF",bubbleVet:"#FFC3BC",onBubbleVet:"#000000",skeleton:"#E9F1E9",scanButtonPink:"#FFC3BC",highlight:"#FFC3BC",onHighlight:"#000000",mark:"#07C168",controlEdge:"rgba(16,70,46,0.18)",structureEdge:"rgba(16,70,46,0.25)",primaryEdge:"#10462E",checkupCardLowRiskBg:"rgba(7,193,104,0.10)",checkupCardConcernBg:"rgba(239,167,0,0.10)",info:"#10462E",badgeBgInfo:"rgba(16,70,46,0.10)",infoEdge:"rgba(16,70,46,0.25)"},EVERFUR_LIGHT=deepFreeze({brightness:"light",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false,assistantAvatarUrl:null},color:LIGHT_COLOR,space:SPACE,radius:RADIUS,type:baseType(),motion:MOTION,slots:NO_SLOTS}),DARK_COLOR={brand:"#6BD39A",brandSoft:"rgba(107,211,154,0.12)",brandSofter:"rgba(107,211,154,0.18)",brandBorder:"rgba(107,211,154,0.22)",borderHairlineGreen:"rgba(107,211,154,0.28)",brandBorderStrong:"rgba(107,211,154,0.55)",brandInk:"#6BD39A",linkInk:"#6BD39A",surface:"#1C1F23",surfaceCream:"#23272C",surfaceSubtle:"#23272C",background:"#15171A",borderRingCream:"#3A3F45",chatGround:"#1C1F23",composerFill:"#23272C",composerBorder:"rgba(107,211,154,0.75)",shadow:"#000000",text:{primary:"#F5F3F0",secondary:"#A9E4C4",muted:"#9A9A9A",placeholder:"rgba(255,255,255,0.55)",onBrand:"#0E1F17",metaCool:"#C9C9C9",timestamp:"rgba(245,243,240,0.7)"},primary:"#6BD39A",onPrimary:"#0E1F17",accent:"#6BD39A",onAccent:"#0E1F17",accentEdge:"#34D888",success:"#07C168",danger:"#F87171",onDanger:"#0E1F17",errorRed:"#FF6B5B",warningStrong:"#F0A35E",cautionAccent:"#D9821D",riskConcern:"#EFA700",sentiment:{up:"#07C168",neutral:"#FBC558",down:"#FF1B00"},badgeBgPositive:"rgba(7,193,104,0.18)",badgeBgCaution:"rgba(217,130,29,0.20)",badgeBgCritical:"rgba(185,28,28,0.22)",badgeBgNeutral:"rgba(255,255,255,0.10)",bubbleUser:"#6BD39A",bubbleAssistant:"#1C1F23",bubbleVet:"#FFC3BC",onBubbleVet:"#000000",skeleton:"#23272C",scanButtonPink:"#FFC3BC",highlight:"#605051",onHighlight:"#F5F3F0",mark:"#07C168",controlEdge:"rgba(107,211,154,0.22)",structureEdge:"rgba(107,211,154,0.28)",primaryEdge:"#6BD39A",checkupCardLowRiskBg:"rgba(7,193,104,0.16)",checkupCardConcernBg:"rgba(239,167,0,0.16)",info:"#6BD39A",badgeBgInfo:"rgba(107,211,154,0.12)",infoEdge:"rgba(107,211,154,0.28)"};deepFreeze({brightness:"dark",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false,assistantAvatarUrl:null},color:DARK_COLOR,space:SPACE,radius:RADIUS,type:baseType(),motion:MOTION,slots:NO_SLOTS});var EVERFUR_THEME_CONTEXT_SYMBOL=/* @__PURE__ */Symbol.for("@everfur/sdk#EverfurThemeContext@v1"),globalThemeHost=globalThis,EverfurThemeContext=globalThemeHost[EVERFUR_THEME_CONTEXT_SYMBOL]??(globalThemeHost[EVERFUR_THEME_CONTEXT_SYMBOL]=react.createContext(EVERFUR_LIGHT));EverfurThemeContext.displayName??="EverfurThemeContext";function useEverfurTheme(){return react.useContext(EverfurThemeContext)}function tierMultiplier(type,tier){let cap=type.scaleCaps[tier];return cap>0?cap:void 0}function Text({tier:tier="content",...props}){let{type:type}=useEverfurTheme(),cap=tierMultiplier(type,tier);return react.createElement(reactNative.Text,cap===void 0?props:{maxFontSizeMultiplier:cap,...props})}react.forwardRef(function(props,ref){return react.createElement(reactNative.TextInput,{...props,...ref===null?{}:{ref:ref}})});var FACE_WEIGHT=/* @__PURE__ */Object.freeze({regular:"regular",medium:"medium",bold:"bold",mono:"regular",monoMedium:"medium",monoBold:"bold"});function face(theme,weight){let type=theme.type,fontFamily=type.families[weight];return weight==="mono"||type.namedFaces[weight]?{fontFamily:fontFamily}:{fontFamily:fontFamily,fontWeight:type.weight[FACE_WEIGHT[weight]]}}var HostRenderBoundary=class extends react.Component{constructor(){super(...arguments);this.state={failed:false,key:this.props.resetKey}}static getDerivedStateFromError(){return{failed:true}}static getDerivedStateFromProps(props,state){return Object.is(props.resetKey,state.key)?null:{failed:false,key:props.resetKey}}render(){return this.state.failed?this.props.fallback:this.props.children}};function RenderHost({render:render}){return render()}function HostRender({render:render,fallback:fallback,resetKey:resetKey}){return react.createElement(HostRenderBoundary,{fallback:fallback,resetKey:resetKey,children:react.createElement(RenderHost,{render:render})})}var REQUIRES=/* @__PURE__ */Object.freeze({chat:/* @__PURE__ */Object.freeze(["chat.message.create"]),records:/* @__PURE__ */Object.freeze(["records.upload.create","records.record.read"]),recordsClinic:/* @__PURE__ */Object.freeze(["records.clinic.create"]),video:/* @__PURE__ */Object.freeze(["video.gait.execute"]),photo:/* @__PURE__ */Object.freeze(["photo.checkup.execute"]),animations:/* @__PURE__ */Object.freeze(["animations.state.read"]),televet:/* @__PURE__ */Object.freeze(["televet.visit.create"])});function requires(name){return REQUIRES[name]}function decideCapability(name,decisions,opts){let keys=requires(name),byResource=/* @__PURE__ */new Map;for(let decision of decisions)byResource.set(decision.resource,decision);if(opts?.isPending===true&&keys.some(key=>!byResource.has(key)))return freezeDecision({name:name,enabled:false,isPending:true,limits:{}});let limits=mergeLimits(keys,byResource);return keys.filter(key=>byResource.get(key)?.granted!==true).length===0?freezeDecision({name:name,enabled:true,isPending:false,limits:limits}):freezeDecision({name:name,enabled:false,isPending:false,limits:limits,disabled:disabledFor(keys,byResource)})}function mergeLimits(keys,byResource){let out={};for(let key of keys){let decisionLimits=byResource.get(key)?.limits;if(decisionLimits)for(let[limitKey,limitValue]of Object.entries(decisionLimits)){let existing=out[limitKey];out[limitKey]=existing===void 0?limitValue:Math.min(existing,limitValue)}}return out}function disabledFor(keys,byResource){for(let key of keys){let explicit=byResource.get(key)?.disabled;if(explicit)/* @__PURE__ */
|
|
103
|
+
return Object.freeze({verdict:verdict,reasonCodes:/* @__PURE__ */Object.freeze(reasonCodes),precheckToken:asString(raw.precheck_token)})}async function submitAnalyze(funnel,path,body,detectGate,signal){let req={method:"POST",path:path,body:body,...signal?{signal:signal}:{}},res=await funnel.send("media.analyze",req);if(res.ok){let job=parseAsyncJob(res.value);return job!==null?{kind:"async",job:job}:{kind:"sync",body:res.value}}let gate=detectGate(res.error.httpStatus,res.error);return gate!==null?{kind:"gate",gate:gate}:{kind:"error",error:res.error}}function parseAsyncJob(raw){if(!isRecord2(raw))return null;let jobId=asString(raw.job_id);if(jobId===null)return null;let status=asString(raw.status);return status!==null&&isTerminalStatus(status)?null:/* @__PURE__ */Object.freeze({jobId:jobId,estimatedSeconds:asFiniteNumber(raw.estimated_completion_seconds)})}var POLL_FIRST_DELAY_MS=2e3,POLL_MAX_DELAY_MS=5e3,POLL_BUDGET_MS=9e4;async function pollJob(funnel,jobId,deps){let{timers:timers,signal:signal,alive:alive}=deps,start=timers.now(),budget=Math.max(POLL_BUDGET_MS,(deps.estimatedSeconds??0)*1e3),delay=POLL_FIRST_DELAY_MS;for(;;){if(signal.aborted||!alive())return{kind:"aborted"};if(await delayAbortable2(delay,signal,timers),signal.aborted||!alive())return{kind:"aborted"};if(timers.now()-start>budget)return{kind:"timeout"};let path=ENDPOINTS.job(jobId);if(path===null)return{kind:"notFound"};let res=await funnel.send("media.pollJob",{method:"GET",path:path,...signal?{signal:signal}:{}},{maxAttempts:1});if(signal.aborted||!alive())return{kind:"aborted"};if(!res.ok){if(res.error.httpStatus===404)return{kind:"notFound"};delay=Math.min(POLL_MAX_DELAY_MS,delay+1e3);continue}let status=jobStatusOf(res.value);if(status==="COMPLETED")return{kind:"complete",body:res.value};if(status==="FAILED")return{kind:"failed",error:jobFailureError(res.value)};delay=Math.min(POLL_MAX_DELAY_MS,delay+1e3)}}function jobStatusOf(body){return isRecord2(body)?(asString(body.status)??"PROCESSING").toUpperCase():"PROCESSING"}function isTerminalStatus(status){let upper=status.toUpperCase();return upper==="COMPLETED"||upper==="FAILED"}function jobFailureError(body){let wire=isRecord2(body)?asString(body.error)??asString(body.error_code):null;return makeEverfurError("internalError",{retryable:false,...wire?{wireMessage:wire}:{}})}function detectPhotoGate(httpStatus,_error){return httpStatus===422?{kind:"species_unsupported",species:"cat"}:httpStatus===400?{kind:"pet_context_required"}:null}function analyzeBody(s3Key,extra){let body={s3_key:s3Key};return extra.type!==void 0&&(body.type=extra.type),extra.petRef!=null&&(body.pet_id=extra.petRef),extra.precheckToken!=null&&(body.precheck_token=extra.precheckToken),body}var ACCEPTED=/* @__PURE__ */Object.freeze({kind:"accepted"});function createPhotoController(deps){return new PhotoController(deps)}var PhotoController=class extends MediaStore{constructor(deps){super({status:"idle",region:deps.region??"skin",result:null,gate:ACCEPTED,error:null,isCaptureAvailable:isCaptureAvailable(deps.camera)}),this.funnel=deps.funnel??createRequestFunnel({auth:deps.auth,...deps.errorPolicy?{errorPolicy:deps.errorPolicy}:{}}),this.camera=deps.camera,this.upload=deps.upload,this.telemetry=deps.telemetry??noopTelemetry,this.timers=deps.timers??defaultTimers,this.makeIdempotencyKey=deps.makeIdempotencyKey??defaultIdempotencyFactory()}async capture(region,opts){if(!isCaptureAvailable(this.camera))return err(makeEverfurError("unknown",{retryable:false}));let source;try{source=await this.camera.capture(captureOptionsFor("photo"))}catch{return this.snapshot.status!=="idle"&&this.patch({status:"idle"}),err(makeEverfurError("unknown",{retryable:false}))}return this.analyze(source,region,opts)}async analyze(source,region,opts){let op=this.beginOperation(opts.signal),idempotencyKey=this.makeIdempotencyKey(),startedAt=this.timers.now();this.patch({status:"capturing",region:region,error:null,result:null,gate:ACCEPTED});try{let initiated=await initiateUpload(this.funnel,{purpose:"skin_scan",contentType:source.mimeType,byteSize:mediaByteSize(source),signal:op.signal});if(op.signal.aborted||!this.alive(op.epoch))return abortedResult();if(!initiated.ok)return this.fail(op,initiated.error);let staged=await stageUpload(this.upload,source,initiated.value,idempotencyKey,op.signal);if(op.signal.aborted||!this.alive(op.epoch))return abortedResult();if(!staged.ok)return this.fail(op,staged.error);let precheck=await runPrecheck(this.funnel,{s3Key:initiated.value.s3Key,type:region,signal:op.signal});if(op.signal.aborted||!this.alive(op.epoch))return abortedResult();if(precheck.verdict!=="proceed")return this.gateRetake(op,region,precheck.reasonCodes);this.patch({status:"analyzing"});let outcome=await submitAnalyze(this.funnel,ENDPOINTS.photoAnalyze,analyzeBody(initiated.value.s3Key,{type:region,petRef:opts.petRef,precheckToken:precheck.precheckToken}),detectPhotoGate,op.signal);if(op.signal.aborted||!this.alive(op.epoch))return abortedResult();switch(outcome.kind){case"error":return this.fail(op,outcome.error);case"gate":return this.gateDomain(op,region,outcome.gate);case"sync":return this.complete(op,outcome.body,region,null,startedAt);case"async":{let poll=await pollJob(this.funnel,outcome.job.jobId,{timers:this.timers,signal:op.signal,alive:()=>this.alive(op.epoch),estimatedSeconds:outcome.job.estimatedSeconds});if(op.signal.aborted||!this.alive(op.epoch))return abortedResult();switch(poll.kind){case"aborted":return abortedResult();case"complete":return this.complete(op,poll.body,region,outcome.job.jobId,startedAt);case"failed":return this.fail(op,poll.error);case"timeout":return this.fail(op,makeEverfurError("streamTimeout",{retryable:!0}));case"notFound":return this.fail(op,makeEverfurError("conversationNotFound",{retryable:!1,httpStatus:404}));default:return this.fail(op,makeEverfurError("internalError",{retryable:!1}))}}default:return this.fail(op,makeEverfurError("internalError",{retryable:!1}))}}finally{op.settle()}}reset(){this.inFlight?.abort(),this.inFlight=null,this.patch({status:"idle",result:null,gate:ACCEPTED,error:null})}complete(op,body,region,jobId,startedAt){if(!this.alive(op.epoch))return abortedResult();let mapped=mapPhotoResult(body,region,jobId);return mapped.droppedOperatorKeys>0&&this.telemetry.track("analysis.metadata_leak_guard",{droppedKeyCount:mapped.droppedOperatorKeys}),this.patch({status:"complete",result:mapped.result,gate:ACCEPTED,error:null}),this.telemetry.track("analysis.species_gate",{outcome:"accepted",region:region}),this.telemetry.track("analysis.result",{capability:"photo",region:region,riskTier:mapped.result.riskTier??"",confidenceTier:mapped.result.confidenceTier??"",modelVersion:mapped.result.modelVersion??"",timeToResultMs:this.timers.now()-startedAt}),ok(mapped.result)}gateDomain(op,region,gate){if(!this.alive(op.epoch))return abortedResult();let outcome=gate.kind==="species_unsupported"?/* @__PURE__ */Object.freeze({kind:"species_unsupported",species:"cat"}):/* @__PURE__ */Object.freeze({kind:"pet_context_required"});return this.patch({status:"idle",gate:outcome,error:null,result:null}),this.telemetry.track("analysis.species_gate",{outcome:gate.kind,region:region,...gate.kind==="species_unsupported"?{species:"cat"}:{}}),err(makeEverfurError("unknown",{retryable:false}))}gateRetake(op,region,reasons){if(!this.alive(op.epoch))return abortedResult();this.patch({status:"idle",gate:/* @__PURE__ */Object.freeze({kind:"retake",reasons:/* @__PURE__ */Object.freeze([...reasons])}),error:null,result:null}),this.telemetry.track("analysis.quality_gate",{usable:false,reasons:reasons});let outcome=reasons.includes("wrong_species")?"species_unsupported":"retake";return this.telemetry.track("analysis.species_gate",{outcome:outcome,region:region}),err(makeEverfurError("unknown",{retryable:false}))}fail(op,error){return this.alive(op.epoch)?(this.patch({status:"error",error:error,gate:ACCEPTED}),this.telemetry.trackExpectedFailure("analysis.error",{code:error.code,...error.httpStatus!==void 0?{httpStatus:error.httpStatus}:{}}),err(error)):abortedResult()}};function mapPhotoResult(body,region,jobId){let projection=projectDetectionMetadata(locateDetectionMetadata(body)),meta=projection.metadata,interpretation=parseInterpretation(locateInterpretation(body));return{result:/* @__PURE__ */Object.freeze({jobId:jobId,analysisType:region,primaryLabel:asString(meta.primary_label)??"Uncertain",riskTier:asRiskTier(meta.risk_tier),confidence:asUnitNumber(meta.primary_confidence),subtypeDisplay:asString(meta.subtype_display),confidenceTier:asConfidenceTier(meta.confidence_tier),diseaseName:asString(meta.disease_name),diseaseFraming:asString(meta.disease_framing),copyShort:asString(meta.copy_short),interpretation:interpretation,modelVersion:asString(meta.model_version)??(isRecord2(body)?asString(body.model_version):null)}),droppedOperatorKeys:projection.droppedOperatorKeys}}function asRiskTier(value){return value==="low_risk"||value==="concern"||value==="uncertain"?value:null}function asConfidenceTier(value){return value==="possible"||value==="probable"?value:null}function abortedResult(){return err(makeEverfurError("unknown",{retryable:false}))}function defaultIdempotencyFactory(){let counter=0;return()=>`photo-analyze-${Date.now().toString(36)}-${(counter++).toString(36)}-${Math.random().toString(36).slice(2,10)}`}var EVERFUR_CONTEXT_SYMBOL=/* @__PURE__ */Symbol.for("@everfur/sdk#EverfurContext@v1"),globalContextHost=globalThis,EverfurContext=globalContextHost[EVERFUR_CONTEXT_SYMBOL]??(globalContextHost[EVERFUR_CONTEXT_SYMBOL]=react.createContext(null));EverfurContext.displayName??="EverfurContext";function useEverfurContext(){let ctx=react.useContext(EverfurContext);if(ctx===null)throw new EverfurConfigError("not-initialized","Everfur hooks must be called inside <EverfurProvider>. Wrap your tree once, high.");return ctx}var BOOTSTRAP_SNAPSHOT=/* @__PURE__ */Object.freeze({status:"idle",region:"skin",result:null,gate:/* @__PURE__ */Object.freeze({kind:"accepted"}),error:null,isCaptureAvailable:false}),NOOP_UNSUBSCRIBE=()=>{};function usePhotoCheckup(opts){let{runtime:runtime,userRef:userRef,scopeEpoch:scopeEpoch}=useEverfurContext(),petRef=opts.petRef,[controller,setController]=react.useState(null);react.useEffect(()=>{let{services:services}=runtime.registry,acquired=runtime.registry.acquire("photo",`${userRef??""}|${petRef}`,()=>createPhotoController({...services.errorPolicy?{errorPolicy:services.errorPolicy}:{},auth:services.authFor(userRef),camera:services.camera,upload:services.upload,telemetry:services.telemetry}),controller2=>controller2.dispose());return setController(acquired),()=>{setController(current=>current===acquired?null:current),runtime.registry.release(acquired)}},[runtime,userRef,petRef,scopeEpoch]);let subscribe=react.useCallback(onChange=>controller?controller.subscribe(onChange):NOOP_UNSUBSCRIBE,[controller]),getSnapshot=react.useCallback(()=>controller?controller.getSnapshot():BOOTSTRAP_SNAPSHOT,[controller]),snapshot=react.useSyncExternalStore(subscribe,getSnapshot,getSnapshot),analyze=react.useCallback((source,region)=>controller?controller.analyze(source,region,{petRef:petRef}):Promise.resolve(notReadyError()),[controller,petRef]),capture=react.useCallback(region=>controller?controller.capture(region,{petRef:petRef}):Promise.resolve(notReadyError()),[controller,petRef]),reset=react.useCallback(()=>{controller?.reset()},[controller]);return react.useMemo(()=>({status:snapshot.status,region:snapshot.region,result:snapshot.result,gate:snapshot.gate,error:snapshot.error,isCaptureAvailable:snapshot.isCaptureAvailable,isBootstrapping:controller===null,analyze:analyze,capture:capture,reset:reset}),[snapshot,controller,analyze,capture,reset])}function notReadyError(){return err(makeEverfurError("internalError",{retryable:true}))}var freezeInPlace=Object.freeze;function deepFreeze(value){if(value!==null&&typeof value=="object"&&!Object.isFrozen(value)){freezeInPlace(value);for(let key of Object.keys(value))deepFreeze(value[key])}return value}var TEXT_SCALE_TIER_CAPS=/* @__PURE__ */Object.freeze({content:0,heading:2,control:1.8,compact:1.5,badge:1.3}),SPACE={xs:4,sm:8,md:12,lg:16,xl:24,xxl:32},RADIUS={tile:5,xs:6,sm:10,md:14,lg:20,xl:28,pill:500},TYPE_SIZE={nano:8,small:9,micro:10,tiny:11,caption:13,bodyTight:15,body:17,subtitle:20,heading:22,verdict:24},LINE_HEIGHT={tight:1.15,snug:1.3,normal:1.4,relaxed:1.55},WEIGHT={regular:"400",medium:"500",bold:"700"},LETTER_SPACING={eyebrow:1,monoWide:.9,headerBrand:-.42,tight:-.35},DEFAULT_MAX_FONT_SCALE=0,SYSTEM_FONT_FAMILY="System",SYSTEM_MONO_FAMILY="monospace",TIERS=["content","heading","control","compact","badge"];function authoredTierSizes(size){let out={};for(let tier of TIERS)out[tier]=size;return out}var NO_FONT_SOURCES=[];function baseType(){return{family:SYSTEM_FONT_FAMILY,mono:SYSTEM_MONO_FAMILY,fontUrl:null,families:{regular:SYSTEM_FONT_FAMILY,medium:SYSTEM_FONT_FAMILY,bold:SYSTEM_FONT_FAMILY,mono:SYSTEM_MONO_FAMILY,monoMedium:SYSTEM_MONO_FAMILY,monoBold:SYSTEM_MONO_FAMILY},namedFaces:{regular:false,medium:false,bold:false,mono:false,monoMedium:false,monoBold:false},fontUrls:{},size:TYPE_SIZE,tierSizes:authoredTierSizes(TYPE_SIZE),lineHeight:LINE_HEIGHT,weight:WEIGHT,letterSpacing:LETTER_SPACING,scale:1,maxScale:DEFAULT_MAX_FONT_SCALE,scaleCaps:TEXT_SCALE_TIER_CAPS,headingFamily:null,headingWeight:null,fontSources:NO_FONT_SOURCES}}var NO_SLOTS={},EASING_CURVES=/* @__PURE__ */Object.freeze({standard:/* @__PURE__ */Object.freeze([.2,0,0,1]),emphasized:/* @__PURE__ */Object.freeze([.2,.8,.2,1]),exit:/* @__PURE__ */Object.freeze([.4,0,1,1])});function cssCubicBezier(curve){return`cubic-bezier(${curve.join(", ")})`}var MOTION={duration:{instant:80,fast:140,normal:220,slow:320},spring:{gentle:{damping:18,stiffness:200}},easing:{standard:cssCubicBezier(EASING_CURVES.standard),emphasized:cssCubicBezier(EASING_CURVES.emphasized),exit:cssCubicBezier(EASING_CURVES.exit)},reducedMotion:false},LIGHT_COLOR={brand:"#10462E",brandSoft:"rgba(16,70,46,0.10)",brandSofter:"rgba(16,70,46,0.15)",brandBorder:"rgba(16,70,46,0.18)",borderHairlineGreen:"rgba(16,70,46,0.25)",brandBorderStrong:"rgba(16,70,46,0.55)",brandInk:"#10462E",linkInk:"#10462E",surface:"#FFFFFF",surfaceCream:"#FFFFFF",surfaceSubtle:"#F1F5F2",background:"#FFFFFF",borderRingCream:"#E4E4E4",chatGround:"#FFFFFF",composerFill:"#FFFFFF",composerBorder:"rgba(16,70,46,0.75)",shadow:"#0B3421",text:{primary:"#000000",secondary:"#0E462E",muted:"#6B6B6B",placeholder:"rgba(61,61,61,0.75)",onBrand:"#FFFFFF",metaCool:"#3D3D3D",timestamp:"rgba(61,61,61,0.75)"},primary:"#10462E",onPrimary:"#FFFFFF",accent:"#10462E",onAccent:"#FFFFFF",accentEdge:"#07C168",success:"#07C168",danger:"#C03410",onDanger:"#FFFFFF",errorRed:"#C03410",warningStrong:"#A45610",cautionAccent:"#D9821D",riskConcern:"#EFA700",sentiment:{up:"#07C168",neutral:"#FBC558",down:"#FF1B00"},badgeBgPositive:"rgba(7,193,104,0.12)",badgeBgCaution:"rgba(217,130,29,0.14)",badgeBgCritical:"rgba(192,52,16,0.06)",badgeBgNeutral:"rgba(107,107,107,0.12)",bubbleUser:"#10462E",bubbleAssistant:"#FFFFFF",bubbleVet:"#FFC3BC",onBubbleVet:"#000000",skeleton:"#E9F1E9",scanButtonPink:"#FFC3BC",highlight:"#FFC3BC",onHighlight:"#000000",mark:"#07C168",controlEdge:"rgba(16,70,46,0.18)",structureEdge:"rgba(16,70,46,0.25)",primaryEdge:"#10462E",checkupCardLowRiskBg:"rgba(7,193,104,0.10)",checkupCardConcernBg:"rgba(239,167,0,0.10)",info:"#10462E",badgeBgInfo:"rgba(16,70,46,0.10)",infoEdge:"rgba(16,70,46,0.25)"},EVERFUR_LIGHT=deepFreeze({brightness:"light",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false,assistantAvatarUrl:null},color:LIGHT_COLOR,space:SPACE,radius:RADIUS,type:baseType(),motion:MOTION,slots:NO_SLOTS}),DARK_COLOR={brand:"#6BD39A",brandSoft:"rgba(107,211,154,0.12)",brandSofter:"rgba(107,211,154,0.18)",brandBorder:"rgba(107,211,154,0.22)",borderHairlineGreen:"rgba(107,211,154,0.28)",brandBorderStrong:"rgba(107,211,154,0.55)",brandInk:"#6BD39A",linkInk:"#6BD39A",surface:"#1C1F23",surfaceCream:"#23272C",surfaceSubtle:"#23272C",background:"#15171A",borderRingCream:"#3A3F45",chatGround:"#1C1F23",composerFill:"#23272C",composerBorder:"rgba(107,211,154,0.75)",shadow:"#000000",text:{primary:"#F5F3F0",secondary:"#A9E4C4",muted:"#9A9A9A",placeholder:"rgba(255,255,255,0.55)",onBrand:"#0E1F17",metaCool:"#C9C9C9",timestamp:"rgba(245,243,240,0.7)"},primary:"#6BD39A",onPrimary:"#0E1F17",accent:"#6BD39A",onAccent:"#0E1F17",accentEdge:"#34D888",success:"#07C168",danger:"#F87171",onDanger:"#0E1F17",errorRed:"#FF6B5B",warningStrong:"#F0A35E",cautionAccent:"#D9821D",riskConcern:"#EFA700",sentiment:{up:"#07C168",neutral:"#FBC558",down:"#FF1B00"},badgeBgPositive:"rgba(7,193,104,0.18)",badgeBgCaution:"rgba(217,130,29,0.20)",badgeBgCritical:"rgba(185,28,28,0.22)",badgeBgNeutral:"rgba(255,255,255,0.10)",bubbleUser:"#6BD39A",bubbleAssistant:"#1C1F23",bubbleVet:"#FFC3BC",onBubbleVet:"#000000",skeleton:"#23272C",scanButtonPink:"#FFC3BC",highlight:"#605051",onHighlight:"#F5F3F0",mark:"#07C168",controlEdge:"rgba(107,211,154,0.22)",structureEdge:"rgba(107,211,154,0.28)",primaryEdge:"#6BD39A",checkupCardLowRiskBg:"rgba(7,193,104,0.16)",checkupCardConcernBg:"rgba(239,167,0,0.16)",info:"#6BD39A",badgeBgInfo:"rgba(107,211,154,0.12)",infoEdge:"rgba(107,211,154,0.28)"};deepFreeze({brightness:"dark",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false,assistantAvatarUrl:null},color:DARK_COLOR,space:SPACE,radius:RADIUS,type:baseType(),motion:MOTION,slots:NO_SLOTS});var EVERFUR_THEME_CONTEXT_SYMBOL=/* @__PURE__ */Symbol.for("@everfur/sdk#EverfurThemeContext@v1"),globalThemeHost=globalThis,EverfurThemeContext=globalThemeHost[EVERFUR_THEME_CONTEXT_SYMBOL]??(globalThemeHost[EVERFUR_THEME_CONTEXT_SYMBOL]=react.createContext(EVERFUR_LIGHT));EverfurThemeContext.displayName??="EverfurThemeContext";function useEverfurTheme(){return react.useContext(EverfurThemeContext)}function tierMultiplier(type,tier){let cap=type.scaleCaps[tier];return cap>0?cap:void 0}function Text({tier:tier="content",...props}){let{type:type}=useEverfurTheme(),cap=tierMultiplier(type,tier);return react.createElement(reactNative.Text,cap===void 0?props:{maxFontSizeMultiplier:cap,...props})}react.forwardRef(function(props,ref){return react.createElement(reactNative.TextInput,{...props,...ref===null?{}:{ref:ref}})});var FACE_WEIGHT=/* @__PURE__ */Object.freeze({regular:"regular",medium:"medium",bold:"bold",mono:"regular",monoMedium:"medium",monoBold:"bold"});function face(theme,weight){let type=theme.type,fontFamily=type.families[weight];return weight==="mono"||type.namedFaces[weight]?{fontFamily:fontFamily}:{fontFamily:fontFamily,fontWeight:type.weight[FACE_WEIGHT[weight]]}}var HostRenderBoundary=class extends react.Component{constructor(){super(...arguments);this.state={failed:false,key:this.props.resetKey}}static getDerivedStateFromError(){return{failed:true}}static getDerivedStateFromProps(props,state){return Object.is(props.resetKey,state.key)?null:{failed:false,key:props.resetKey}}render(){return this.state.failed?this.props.fallback:this.props.children}};function RenderHost({render:render}){return render()}function HostRender({render:render,fallback:fallback,resetKey:resetKey}){return react.createElement(HostRenderBoundary,{fallback:fallback,resetKey:resetKey,children:react.createElement(RenderHost,{render:render})})}var REQUIRES=/* @__PURE__ */Object.freeze({chat:/* @__PURE__ */Object.freeze(["chat.message.create"]),records:/* @__PURE__ */Object.freeze(["records.upload.create","records.record.read"]),recordsClinic:/* @__PURE__ */Object.freeze(["records.clinic.create"]),video:/* @__PURE__ */Object.freeze(["video.gait.execute"]),photo:/* @__PURE__ */Object.freeze(["photo.checkup.execute"]),animations:/* @__PURE__ */Object.freeze(["animations.state.read"]),televet:/* @__PURE__ */Object.freeze(["televet.visit.create"]),texting:/* @__PURE__ */Object.freeze(["sms.identity.read","sms.identity.update"]),healthPlan:/* @__PURE__ */Object.freeze(["shop.plan.read","shop.plan.update"])});function requires(name){return REQUIRES[name]}function decideCapability(name,decisions,opts){let keys=requires(name),byResource=/* @__PURE__ */new Map;for(let decision of decisions)byResource.set(decision.resource,decision);if(opts?.isPending===true&&keys.some(key=>!byResource.has(key)))return freezeDecision({name:name,enabled:false,isPending:true,limits:{}});let limits=mergeLimits(keys,byResource);return keys.filter(key=>byResource.get(key)?.granted!==true).length===0?freezeDecision({name:name,enabled:true,isPending:false,limits:limits}):freezeDecision({name:name,enabled:false,isPending:false,limits:limits,disabled:disabledFor(keys,byResource)})}function mergeLimits(keys,byResource){let out={};for(let key of keys){let decisionLimits=byResource.get(key)?.limits;if(decisionLimits)for(let[limitKey,limitValue]of Object.entries(decisionLimits)){let existing=out[limitKey];out[limitKey]=existing===void 0?limitValue:Math.min(existing,limitValue)}}return out}function disabledFor(keys,byResource){for(let key of keys){let explicit=byResource.get(key)?.disabled;if(explicit)/* @__PURE__ */
|
|
101
104
|
return Object.freeze({reason:explicit.reason,level:explicit.level,recoverable:explicit.recoverable})}/* @__PURE__ */
|
|
102
105
|
return Object.freeze({reason:userFacingError("accessDenied"),level:"user_entitlement",recoverable:false})}function freezeDecision(d){let base={name:d.name,enabled:d.enabled,isPending:d.isPending,limits:/* @__PURE__ */Object.freeze({...d.limits})};return d.disabled!==void 0&&(base.disabled=d.disabled),/* @__PURE__ */Object.freeze(base)}function useCapability(name){let{runtime:runtime}=useEverfurContext(),store=runtime.entitlements,snapshot=react.useSyncExternalStore(store.subscribe,store.getSnapshot,store.getSnapshot);return react.useMemo(()=>decideCapability(name,snapshot.decisions,{isPending:snapshot.isPending}),[name,snapshot])}var MIN_OFFSTATE_HEIGHT=48;function selectView(decision){return decision.isPending?"pending":decision.enabled?"enabled":"disabled"}function CapabilityGate(props){let{capability:capability,children:children,renderDisabled:renderDisabled,renderPending:renderPending,style:style}=props,decision=useCapability(capability),view=react.useMemo(()=>selectView(decision),[decision]);switch(view){case"enabled":return children;case"pending":return renderPending?/* @__PURE__ */jsxRuntime.jsx(HostRender,{render:renderPending,fallback:/* @__PURE__ */jsxRuntime.jsx(PendingSkeleton,{capability:capability,style:style})}):/* @__PURE__ */jsxRuntime.jsx(PendingSkeleton,{capability:capability,style:style});case"disabled":return renderDisabled?/* @__PURE__ */jsxRuntime.jsx(HostRender,{render:()=>renderDisabled(decision),fallback:/* @__PURE__ */jsxRuntime.jsx(OffState,{decision:decision,style:style}),resetKey:decision}):/* @__PURE__ */jsxRuntime.jsx(OffState,{decision:decision,style:style});default:return assertNever(view)}}function PendingSkeleton({capability:capability,style:style}){let theme=useEverfurTheme(),styles=react.useMemo(()=>makeStyles(theme),[theme]);/* @__PURE__ */
|
|
103
106
|
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__ */
|
package/dist/photo/index.d.cts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { E as EverfurError } from '../EverfurError-
|
|
2
|
-
export { a as EverfurErrorCategory, b as EverfurErrorCode } from '../EverfurError-
|
|
3
|
-
import { E as EverfurResult } from '../EverfurResult-
|
|
4
|
-
import { P as PetRef } from '../ids-B2GAAifq.cjs';
|
|
5
|
-
export { B as Brand, J as JobId, _ as __brand } from '../ids-B2GAAifq.cjs';
|
|
6
|
-
import { M as MediaSource } from '../CameraPort-Cv31Pz7g.cjs';
|
|
7
|
-
import { P as PhotoStatus, a as PhotoRegion, b as PhotoAnalysisResult, c as PhotoGateOutcome } from '../PhotoController-
|
|
8
|
-
export { C as ConfidenceTier, d as PrecheckReasonCode, R as RiskTier } from '../PhotoController-
|
|
1
|
+
import { E as EverfurError } from '../EverfurError.d-8NHtlgzA.cjs';
|
|
2
|
+
export { a as EverfurErrorCategory, b as EverfurErrorCode } from '../EverfurError.d-8NHtlgzA.cjs';
|
|
3
|
+
import { E as EverfurResult } from '../EverfurResult.d-BFH-3s6E.cjs';
|
|
4
|
+
import { P as PetRef } from '../ids.d-B2GAAifq.cjs';
|
|
5
|
+
export { B as Brand, J as JobId, _ as __brand } from '../ids.d-B2GAAifq.cjs';
|
|
6
|
+
import { M as MediaSource } from '../CameraPort.d-Cv31Pz7g.cjs';
|
|
7
|
+
import { P as PhotoStatus, a as PhotoRegion, b as PhotoAnalysisResult, c as PhotoGateOutcome } from '../PhotoController.d-BzCJOE7e.cjs';
|
|
8
|
+
export { C as ConfidenceTier, d as PrecheckReasonCode, R as RiskTier } from '../PhotoController.d-BzCJOE7e.cjs';
|
|
9
9
|
import { ReactNode } from 'react';
|
|
10
10
|
import { StyleProp, ViewStyle } from 'react-native';
|
|
11
|
-
export { I as Interpretation } from '../projection-CeIUsbSk.cjs';
|
|
11
|
+
export { I as Interpretation } from '../projection.d-CeIUsbSk.cjs';
|
|
12
12
|
|
|
13
13
|
interface UsePhotoCheckupState {
|
|
14
14
|
readonly status: PhotoStatus;
|
package/dist/photo/index.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { E as EverfurError } from '../EverfurError-
|
|
2
|
-
export { a as EverfurErrorCategory, b as EverfurErrorCode } from '../EverfurError-
|
|
3
|
-
import { E as EverfurResult } from '../EverfurResult-
|
|
4
|
-
import { P as PetRef } from '../ids-B2GAAifq.js';
|
|
5
|
-
export { B as Brand, J as JobId, _ as __brand } from '../ids-B2GAAifq.js';
|
|
6
|
-
import { M as MediaSource } from '../CameraPort-Cv31Pz7g.js';
|
|
7
|
-
import { P as PhotoStatus, a as PhotoRegion, b as PhotoAnalysisResult, c as PhotoGateOutcome } from '../PhotoController-
|
|
8
|
-
export { C as ConfidenceTier, d as PrecheckReasonCode, R as RiskTier } from '../PhotoController-
|
|
1
|
+
import { E as EverfurError } from '../EverfurError.d-8NHtlgzA.js';
|
|
2
|
+
export { a as EverfurErrorCategory, b as EverfurErrorCode } from '../EverfurError.d-8NHtlgzA.js';
|
|
3
|
+
import { E as EverfurResult } from '../EverfurResult.d-D_-254ZY.js';
|
|
4
|
+
import { P as PetRef } from '../ids.d-B2GAAifq.js';
|
|
5
|
+
export { B as Brand, J as JobId, _ as __brand } from '../ids.d-B2GAAifq.js';
|
|
6
|
+
import { M as MediaSource } from '../CameraPort.d-Cv31Pz7g.js';
|
|
7
|
+
import { P as PhotoStatus, a as PhotoRegion, b as PhotoAnalysisResult, c as PhotoGateOutcome } from '../PhotoController.d-D0XiUUOl.js';
|
|
8
|
+
export { C as ConfidenceTier, d as PrecheckReasonCode, R as RiskTier } from '../PhotoController.d-D0XiUUOl.js';
|
|
9
9
|
import { ReactNode } from 'react';
|
|
10
10
|
import { StyleProp, ViewStyle } from 'react-native';
|
|
11
|
-
export { I as Interpretation } from '../projection-CeIUsbSk.js';
|
|
11
|
+
export { I as Interpretation } from '../projection.d-CeIUsbSk.js';
|
|
12
12
|
|
|
13
13
|
interface UsePhotoCheckupState {
|
|
14
14
|
readonly status: PhotoStatus;
|