@everfur/sdk 0.15.0 → 0.16.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 +160 -0
- package/LICENSE.md +1 -0
- package/README.md +12 -5
- package/SDK-LICENSE.txt +130 -0
- package/THIRD_PARTY_NOTICES +9 -0
- package/dist/CameraPort.d-Cv31Pz7g.d.cts +1 -0
- package/dist/CameraPort.d-Cv31Pz7g.d.ts +1 -0
- package/dist/{DepthViews.d-dXWL6ToG.d.cts → DepthViews.d-A7S-XYiI.d.ts} +2 -1
- package/dist/{DepthViews.d-DbJejGm3.d.ts → DepthViews.d-C4TIZDfz.d.cts} +2 -1
- package/dist/{DepthViews.d-CuBElgEc.d.ts → DepthViews.d-CNjaHLAS.d.ts} +2 -1
- package/dist/{DepthViews.d-BqMnWSMu.d.cts → DepthViews.d-DapfRz1S.d.cts} +2 -1
- package/dist/ErrorPolicyPort.d-68yrE3BE.d.ts +1 -0
- package/dist/ErrorPolicyPort.d-DirW9hgO.d.cts +1 -0
- package/dist/EverfurError.d-8NHtlgzA.d.cts +1 -0
- package/dist/EverfurError.d-8NHtlgzA.d.ts +1 -0
- package/dist/EverfurResult.d-BFH-3s6E.d.cts +1 -0
- package/dist/EverfurResult.d-D_-254ZY.d.ts +1 -0
- package/dist/IntakeMedia.d-4a89XrP7.d.ts +1 -0
- package/dist/IntakeMedia.d-DGxrhgIW.d.ts +1 -0
- package/dist/IntakeMedia.d-DUPR4lVM.d.cts +1 -0
- package/dist/IntakeMedia.d-JJCUvQu7.d.cts +1 -0
- package/dist/LICENSE.md +1 -0
- package/dist/LifecyclePort.d-Cr1p33a7.d.cts +1 -0
- package/dist/LifecyclePort.d-Cr1p33a7.d.ts +1 -0
- package/dist/PhotoController.d-BzCJOE7e.d.cts +1 -0
- package/dist/PhotoController.d-D0XiUUOl.d.ts +1 -0
- package/dist/{RecordsPage.d-DKrZ9rHX.d.ts → RecordsPage.d-6WMbieaV.d.ts} +2 -1
- package/dist/{RecordsPage.d-DRPdUAo4.d.cts → RecordsPage.d-B2gLf8RH.d.cts} +2 -1
- package/dist/SDK-LICENSE.txt +130 -0
- package/dist/THIRD_PARTY_NOTICES +9 -0
- package/dist/TelemetryPort.d-BDNr00hu.d.cts +1 -0
- package/dist/TelemetryPort.d-BDNr00hu.d.ts +1 -0
- package/dist/animations/index.cjs +2 -1
- package/dist/animations/index.d.cts +24 -23
- package/dist/animations/index.d.ts +24 -23
- package/dist/animations/index.js +2 -1
- package/dist/{Chat.d-a7Ksz7NZ.d.ts → appStateLifecycle.d-B7L427MF.d.ts} +73 -141
- package/dist/{Chat.d-CtfANk3A.d.cts → appStateLifecycle.d-CWedOJq4.d.cts} +73 -141
- package/dist/{attachments.d-CpaOfi2g.d.cts → attachments.d-BARh-PrJ.d.cts} +26 -7
- package/dist/{attachments.d-BGn2_knv.d.ts → attachments.d-CB0R1_vK.d.ts} +26 -7
- package/dist/{attachments.d-CoQhXrP9.d.ts → attachments.d-CPgp4_W-.d.ts} +3 -2
- package/dist/{attachments.d-CqHMGoER.d.cts → attachments.d-DeoaCEMD.d.cts} +3 -2
- package/dist/{bookingCopy.d-BwCOCZUj.d.ts → bookingCopy.d-BakTjvWw.d.ts} +3 -2
- package/dist/{bookingCopy.d-Bnq2zk0F.d.cts → bookingCopy.d-CVmpuk9C.d.cts} +3 -2
- package/dist/branding.d-Bbc6p1XY.d.cts +1 -0
- package/dist/branding.d-y6c0UwhE.d.ts +1 -0
- package/dist/cacheEpoch.d-DknKn3S0.d.cts +1 -0
- package/dist/cacheEpoch.d-DknKn3S0.d.ts +1 -0
- package/dist/callCopy.d-Bw6oZT54.d.cts +1 -0
- package/dist/callCopy.d-Bw6oZT54.d.ts +1 -0
- package/dist/callRoom.d-B1DoYdJe.d.cts +1 -0
- package/dist/callRoom.d-Dqm1rUqT.d.ts +1 -0
- package/dist/{casesRepository.d-DG83Ggbq.d.ts → casesRepository.d-CuokarTU.d.ts} +2 -1
- package/dist/{casesRepository.d-CsUJ2Oyb.d.cts → casesRepository.d-DKRLtYb8.d.cts} +2 -1
- package/dist/chat/index.cjs +229 -214
- package/dist/chat/index.d.cts +12 -9
- package/dist/chat/index.d.ts +12 -9
- package/dist/chat/index.js +230 -215
- package/dist/client/index.cjs +2 -1
- package/dist/client/index.d.cts +7 -6
- package/dist/client/index.d.ts +7 -6
- package/dist/client/index.js +2 -1
- package/dist/{clinicBatch.d-Byjx4y_W.d.ts → clinicBatch.d-BP_Rpvcy.d.ts} +3 -2
- package/dist/{clinicBatch.d-BLpbpS51.d.cts → clinicBatch.d-BTDdhMQ2.d.cts} +3 -2
- package/dist/clinicModels.d-BXgKZqDb.d.cts +1 -0
- package/dist/clinicModels.d-CaS64-P-.d.ts +1 -0
- package/dist/clinicRequestProps.d-1dCtouGA.d.cts +1 -0
- package/dist/clinicRequestProps.d-CjsMg_OD.d.ts +1 -0
- package/dist/{config.d-C0WgjutL.d.cts → config.d-84fNJFv9.d.cts} +2 -1
- package/dist/{config.d-zd2eTb2L.d.ts → config.d-B4-Mrwq2.d.ts} +2 -1
- package/dist/consent/index.cjs +1 -0
- package/dist/consent/index.d.cts +6 -5
- package/dist/consent/index.d.ts +6 -5
- package/dist/consent/index.js +1 -0
- package/dist/{context.d-Du_UPxa1.d.cts → context.d-87MMrNm6.d.cts} +6 -5
- package/dist/{context.d-BBjmV0rz.d.ts → context.d-rNGMZH8T.d.ts} +6 -5
- package/dist/{copy.d-Da_PP2K3.d.cts → copy.d-CJOLhJac.d.cts} +3 -2
- package/dist/{copy.d-D_VVj01o.d.ts → copy.d-DbwWriBp.d.ts} +3 -2
- package/dist/core/index.cjs +2 -1
- package/dist/core/index.d.cts +14 -13
- package/dist/core/index.d.ts +14 -13
- package/dist/core/index.js +2 -1
- package/dist/{depth.d-RTV61QNf.d.cts → depth.d-CXpPxNSK.d.cts} +3 -2
- package/dist/{depth.d-BEedifOR.d.ts → depth.d-Dca1T_RH.d.ts} +3 -2
- package/dist/{entitlementRepository.d-BwThmh3V.d.ts → entitlementRepository.d-BBRYTUlp.d.ts} +3 -2
- package/dist/{entitlementRepository.d-C-stdRyA.d.cts → entitlementRepository.d-DBhzBQjZ.d.cts} +3 -2
- package/dist/features.d-DrQxTw3-.d.cts +1 -0
- package/dist/features.d-DrQxTw3-.d.ts +1 -0
- package/dist/{focus.d-Dsm39DjO.d.cts → focus.d-BQnOVAql.d.cts} +4 -3
- package/dist/{focus.d-CtotIyEt.d.ts → focus.d-BZ2sEpbU.d.ts} +4 -3
- package/dist/health-plan/index.cjs +135 -131
- package/dist/health-plan/index.d.cts +78 -24
- package/dist/health-plan/index.d.ts +78 -24
- package/dist/health-plan/index.js +135 -131
- package/dist/{idempotency.d-Cv-B7SfC.d.ts → idempotency.d-9wNNohIA.d.cts} +2 -1
- package/dist/{idempotency.d-Bfm7oIxS.d.cts → idempotency.d-BdB17veP.d.ts} +2 -1
- package/dist/{identity.d-BksOEa6m.d.ts → identity.d-DxNvhj3a.d.ts} +2 -1
- package/dist/{identity.d-CioQhZrq.d.cts → identity.d-nRZBzkG2.d.cts} +2 -1
- package/dist/ids.d-B2GAAifq.d.cts +1 -0
- package/dist/ids.d-B2GAAifq.d.ts +1 -0
- package/dist/index.cjs +234 -219
- package/dist/index.d.cts +15 -12
- package/dist/index.d.ts +15 -12
- package/dist/index.js +235 -220
- package/dist/{introEvents.d-fAZitxMA.d.cts → introEvents.d-CQeiUeLn.d.cts} +2 -1
- package/dist/{introEvents.d-tOi4o3F4.d.ts → introEvents.d-bkIxpIKr.d.ts} +2 -1
- package/dist/introEvents.d-dS3fJCH1.d.cts +1 -0
- package/dist/introEvents.d-dS3fJCH1.d.ts +1 -0
- package/dist/models.d-BSqvbTE1.d.cts +1 -0
- package/dist/models.d-DOwnr8fi.d.ts +1 -0
- package/dist/notifications/index.cjs +1 -0
- package/dist/notifications/index.d.cts +5 -4
- package/dist/notifications/index.d.ts +5 -4
- package/dist/notifications/index.js +1 -0
- package/dist/{optInView.d-BkNSv4Gk.d.cts → optInView.d-BbVUUeoG.d.cts} +15 -2
- package/dist/{optInView.d-B8zTORO2.d.ts → optInView.d-DVJcB4Gp.d.ts} +15 -2
- package/dist/optionalModule.d-DbJmsq5f.d.cts +1 -0
- package/dist/optionalModule.d-DbJmsq5f.d.ts +1 -0
- package/dist/{parse.d-B5JHS6Pr.d.ts → parse.d-CGeJrcAC.d.ts} +2 -1
- package/dist/{parse.d-BgjO82mY.d.cts → parse.d-Dk0BasyK.d.cts} +2 -1
- package/dist/{pets.d-OWxskXCP.d.ts → pets.d-DBopbeRe.d.ts} +2 -1
- package/dist/{pets.d-B_LoizOv.d.cts → pets.d-DVptPgi0.d.cts} +2 -1
- package/dist/{petsRepository.d-Ba3xhJcj.d.ts → petsRepository.d-BtuooSOW.d.ts} +2 -1
- package/dist/{petsRepository.d-B5DWzU7C.d.cts → petsRepository.d-Daef7u0o.d.cts} +2 -1
- package/dist/photo/index.cjs +1 -0
- package/dist/photo/index.d.cts +1 -0
- package/dist/photo/index.d.ts +1 -0
- package/dist/photo/index.js +1 -0
- package/dist/ports.d-BX4f4UsB.d.cts +1 -0
- package/dist/ports.d-BX4f4UsB.d.ts +1 -0
- package/dist/{ports.d-BDtwHxmW.d.ts → ports.d-BxCVSbSi.d.ts} +5 -4
- package/dist/{ports.d-gZNTn8Qf.d.cts → ports.d-CAT70bVD.d.cts} +5 -4
- package/dist/presentation.d-vy8kTGfR.d.cts +1 -0
- package/dist/presentation.d-vy8kTGfR.d.ts +1 -0
- package/dist/profile.d-CSs1wlXT.d.cts +1 -0
- package/dist/profile.d-CSs1wlXT.d.ts +1 -0
- package/dist/projection.d-CeIUsbSk.d.cts +1 -0
- package/dist/projection.d-CeIUsbSk.d.ts +1 -0
- package/dist/quickPrompts.d-NM_81Jc1.d.cts +1 -0
- package/dist/quickPrompts.d-NM_81Jc1.d.ts +1 -0
- package/dist/records/depth/index.cjs +2 -1
- package/dist/records/depth/index.d.cts +10 -9
- package/dist/records/depth/index.d.ts +10 -9
- package/dist/records/depth/index.js +2 -1
- package/dist/records/index.cjs +243 -200
- package/dist/records/index.d.cts +170 -73
- package/dist/records/index.d.ts +170 -73
- package/dist/records/index.js +244 -201
- package/dist/recordsAsk.d-C5CGSi3j.d.cts +1 -0
- package/dist/recordsAsk.d-C5CGSi3j.d.ts +1 -0
- package/dist/{requestFunnel.d-DFf9C__p.d.ts → requestFunnel.d-Cxt0JqYx.d.ts} +3 -2
- package/dist/{requestFunnel.d-CR4akGCY.d.cts → requestFunnel.d-mEu6B-n8.d.cts} +3 -2
- package/dist/resolve.d-CoQWUy1Y.d.cts +1 -0
- package/dist/resolve.d-CoQWUy1Y.d.ts +1 -0
- package/dist/{runtimeTypes.d-BqBOrZxa.d.ts → runtimeTypes.d-Bkcj_XQy.d.ts} +5 -4
- package/dist/{runtimeTypes.d-CHdH-y2c.d.cts → runtimeTypes.d-D_qHJROH.d.cts} +5 -4
- package/dist/{screenProps.d-B1dIANI0.d.cts → screenProps.d-CR1lrpzR.d.cts} +3 -2
- package/dist/{screenProps.d-CVqFJw-J.d.ts → screenProps.d-D9n-ancr.d.ts} +3 -2
- package/dist/server/events/index.cjs +2 -1
- package/dist/server/events/index.d.cts +3 -2
- package/dist/server/events/index.d.ts +3 -2
- package/dist/server/events/index.js +2 -1
- package/dist/server/index.cjs +2 -1
- package/dist/server/index.d.cts +4 -3
- package/dist/server/index.d.ts +4 -3
- package/dist/server/index.js +2 -1
- package/dist/sheetCopy.d-CAhLOxjc.d.cts +1 -0
- package/dist/sheetCopy.d-CAhLOxjc.d.ts +1 -0
- package/dist/sheetSeam.d-B09jf4YC.d.ts +1 -0
- package/dist/sheetSeam.d-BBuEIVsa.d.cts +1 -0
- package/dist/shop/index.cjs +17 -16
- package/dist/shop/index.d.cts +13 -3
- package/dist/shop/index.d.ts +13 -3
- package/dist/shop/index.js +17 -16
- package/dist/species.d-BXAIMh7I.d.cts +1 -0
- package/dist/species.d-BXAIMh7I.d.ts +1 -0
- package/dist/tabs/index.cjs +5 -4
- package/dist/tabs/index.d.cts +35 -15
- package/dist/tabs/index.d.ts +35 -15
- package/dist/tabs/index.js +6 -5
- package/dist/tabsModel.d-B7QMug1u.d.cts +16 -0
- package/dist/tabsModel.d-B7QMug1u.d.ts +16 -0
- package/dist/televet/booking/index.cjs +1 -0
- package/dist/televet/booking/index.d.cts +7 -6
- package/dist/televet/booking/index.d.ts +7 -6
- package/dist/televet/booking/index.js +1 -0
- package/dist/televet/call/index.cjs +1 -0
- package/dist/televet/call/index.d.cts +1 -0
- package/dist/televet/call/index.d.ts +1 -0
- package/dist/televet/call/index.js +1 -0
- package/dist/televet/index.cjs +1 -0
- package/dist/televet/index.d.cts +1 -0
- package/dist/televet/index.d.ts +1 -0
- package/dist/televet/index.js +1 -0
- package/dist/televetGlobal.d-CC-DrqkQ.d.ts +1 -0
- package/dist/televetGlobal.d-CKwDCbmN.d.cts +1 -0
- package/dist/testing/index.cjs +1 -0
- package/dist/testing/index.d.cts +2 -1
- package/dist/testing/index.d.ts +2 -1
- package/dist/testing/index.js +1 -0
- package/dist/testing/rn/index.cjs +2 -2
- package/dist/testing/rn/index.d.cts +11 -9
- package/dist/testing/rn/index.d.ts +11 -9
- package/dist/testing/rn/index.js +2 -2
- package/dist/testing/web/index.cjs +1 -0
- package/dist/testing/web/index.d.cts +8 -7
- package/dist/testing/web/index.d.ts +8 -7
- package/dist/testing/web/index.js +1 -0
- package/dist/texting/index.cjs +23 -17
- package/dist/texting/index.d.cts +9 -6
- package/dist/texting/index.d.ts +9 -6
- package/dist/texting/index.js +24 -18
- package/dist/threadOptions.d-6hfQS1x7.d.cts +55 -0
- package/dist/threadOptions.d-6hfQS1x7.d.ts +55 -0
- package/dist/threadOptions.d-BEG-LZrC.d.cts +147 -0
- package/dist/threadOptions.d-BerQM1Ql.d.ts +147 -0
- package/dist/{threadOptions.d-DZ0AoQGk.d.ts → threadOptions.d-BgBvSIw8.d.ts} +7 -40
- package/dist/{threadOptions.d-CnSfFVMr.d.cts → threadOptions.d-P9v7I7va.d.cts} +7 -40
- package/dist/{timelineRows.d-CF1KvLcQ.d.cts → timelineRows.d-C04lp_Vj.d.cts} +2 -1
- package/dist/{timelineRows.d-CtL0y7y1.d.ts → timelineRows.d-_7JemrY-.d.ts} +2 -1
- package/dist/tokens.d-BUVqme2D.d.cts +1 -0
- package/dist/tokens.d-BUVqme2D.d.ts +1 -0
- package/dist/typeStyle.d-B3Kdtjie.d.ts +1 -0
- package/dist/typeStyle.d-DmlwyJq-.d.cts +1 -0
- package/dist/uploadTransport.d-CWL7CdWP.d.cts +1 -0
- package/dist/uploadTransport.d-EGoUl7gX.d.ts +1 -0
- package/dist/{planSignals.d-DtxZoWGM.d.ts → useHealthPlanSubscription.d-CUbHE6eK.d.ts} +82 -3
- package/dist/{planSignals.d-Cl6n5QpS.d.cts → useHealthPlanSubscription.d-OhLZpn-n.d.cts} +82 -3
- package/dist/useIntroSeen.d-CTWFUthO.d.cts +1 -0
- package/dist/useIntroSeen.d-CTWFUthO.d.ts +1 -0
- package/dist/{usePresentation.d-BsR08Wxt.d.ts → usePresentation.d-CBtBx38t.d.ts} +41 -40
- package/dist/{usePresentation.d-CZS0qlLI.d.cts → usePresentation.d-YkJeq9mf.d.cts} +41 -40
- package/dist/useRecords.d-BYNX01El.d.cts +1 -0
- package/dist/useRecords.d-DWk61a4c.d.ts +1 -0
- package/dist/{useRecordsDepth.d-k-zYIHTe.d.cts → useRecordsDepth.d-FTImzp6T.d.cts} +2 -1
- package/dist/{useRecordsDepth.d-DTAxFf5s.d.ts → useRecordsDepth.d-_rqDIvoq.d.ts} +2 -1
- package/dist/useVetVisit.d-BtdwhmgD.d.cts +1 -0
- package/dist/useVetVisit.d-DoYQimyt.d.ts +1 -0
- package/dist/video/index.cjs +1 -0
- package/dist/video/index.d.cts +1 -0
- package/dist/video/index.d.ts +1 -0
- package/dist/video/index.js +1 -0
- package/dist/{view.d-CAWQjcY_.d.cts → view.d-Dd6AfMvG.d.cts} +4 -3
- package/dist/{view.d-BE7VOlsB.d.ts → view.d-gmYinlac.d.ts} +4 -3
- package/dist/visitIntent.d-D7_yVp1I.d.cts +1 -0
- package/dist/visitIntent.d-D7_yVp1I.d.ts +1 -0
- package/dist/web/consent/index.cjs +1 -0
- package/dist/web/consent/index.d.cts +6 -5
- package/dist/web/consent/index.d.ts +6 -5
- package/dist/web/consent/index.js +1 -0
- package/dist/web/health-plan/index.cjs +3 -2
- package/dist/web/health-plan/index.d.cts +16 -69
- package/dist/web/health-plan/index.d.ts +16 -69
- package/dist/web/health-plan/index.js +3 -2
- package/dist/web/index.cjs +20 -17
- package/dist/web/index.d.cts +35 -43
- package/dist/web/index.d.ts +35 -43
- package/dist/web/index.js +20 -17
- package/dist/web/intro/index.cjs +1 -0
- package/dist/web/intro/index.d.cts +7 -6
- package/dist/web/intro/index.d.ts +7 -6
- package/dist/web/intro/index.js +1 -0
- package/dist/web/notifications/index.cjs +1 -0
- package/dist/web/notifications/index.d.cts +4 -3
- package/dist/web/notifications/index.d.ts +4 -3
- package/dist/web/notifications/index.js +1 -0
- package/dist/web/records/depth/index.cjs +1 -0
- package/dist/web/records/depth/index.d.cts +10 -9
- package/dist/web/records/depth/index.d.ts +10 -9
- package/dist/web/records/depth/index.js +1 -0
- package/dist/web/records/index.cjs +1 -0
- package/dist/web/records/index.d.cts +12 -11
- package/dist/web/records/index.d.ts +12 -11
- package/dist/web/records/index.js +1 -0
- package/dist/web/records/upload/index.cjs +1 -0
- package/dist/web/records/upload/index.d.cts +1 -0
- package/dist/web/records/upload/index.d.ts +1 -0
- package/dist/web/records/upload/index.js +1 -0
- package/dist/web/records-sheet/index.cjs +12 -11
- package/dist/web/records-sheet/index.d.cts +1 -0
- package/dist/web/records-sheet/index.d.ts +1 -0
- package/dist/web/records-sheet/index.js +12 -11
- package/dist/web/shop/index.cjs +12 -11
- package/dist/web/shop/index.d.cts +4 -3
- package/dist/web/shop/index.d.ts +4 -3
- package/dist/web/shop/index.js +12 -11
- package/dist/web/televet/booking/index.cjs +1 -0
- package/dist/web/televet/booking/index.d.cts +7 -6
- package/dist/web/televet/booking/index.d.ts +7 -6
- package/dist/web/televet/booking/index.js +1 -0
- package/dist/web/televet/call/index.cjs +1 -0
- package/dist/web/televet/call/index.d.cts +1 -0
- package/dist/web/televet/call/index.d.ts +1 -0
- package/dist/web/televet/call/index.js +1 -0
- package/dist/web/televet/index.cjs +1 -0
- package/dist/web/televet/index.d.cts +1 -0
- package/dist/web/televet/index.d.ts +1 -0
- package/dist/web/televet/index.js +1 -0
- package/dist/web/texting/index.cjs +2 -1
- package/dist/web/texting/index.d.cts +9 -6
- package/dist/web/texting/index.d.ts +9 -6
- package/dist/web/texting/index.js +2 -1
- package/package.json +15 -6
- package/LICENSE +0 -21
- package/dist/tabsModel.d-BfIQg6yS.d.cts +0 -31
- package/dist/tabsModel.d-BfIQg6yS.d.ts +0 -31
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
/*! @everfur/sdk. Copyright (c) 2026 Strand Health Inc. dba Everfur. All rights reserved. Use is subject to the Everfur SDK License: https://docs.everfur.com/license */
|
|
1
2
|
import { ReactNode } from 'react';
|
|
2
3
|
import { StyleProp, ViewStyle } from 'react-native';
|
|
3
4
|
import { E as EverfurResult } from '../EverfurResult.d-D_-254ZY.js';
|
|
4
|
-
import { A as AuthContext } from '../identity.d-
|
|
5
|
-
export { I as IdentityProvider, n as newSessionId } from '../identity.d-
|
|
5
|
+
import { A as AuthContext } from '../identity.d-DxNvhj3a.js';
|
|
6
|
+
export { I as IdentityProvider, n as newSessionId } from '../identity.d-DxNvhj3a.js';
|
|
6
7
|
import { P as PetRef } from '../ids.d-B2GAAifq.js';
|
|
7
8
|
export { B as Brand, U as UserRef, _ as __brand } from '../ids.d-B2GAAifq.js';
|
|
8
9
|
import { z } from 'zod';
|
|
@@ -13,7 +14,7 @@ import { E as EverfurError } from '../EverfurError.d-8NHtlgzA.js';
|
|
|
13
14
|
export { a as EverfurErrorCategory, b as EverfurErrorCode } from '../EverfurError.d-8NHtlgzA.js';
|
|
14
15
|
import { D as DisabledLevel, a as CapabilityDecision } from '../resolve.d-CoQWUy1Y.js';
|
|
15
16
|
export { b as CapabilityDisabled, C as CapabilityName } from '../resolve.d-CoQWUy1Y.js';
|
|
16
|
-
export { A as AcceptedFrame, a as AnalysisCompleteFrame, b as AnalysisStartedFrame, D as DeltaFrame, c as DoneFrame, E as ErrorFrame, d as EverfurRequest, e as EverfurRequestBase, F as Frame, f as FrameBase, g as FrameKind, H as HeartbeatFrame, h as HttpMethod, M as MultipartBody, T as TransportPort, U as UnknownFrame, i as UrgencyLevel } from '../config.d-
|
|
17
|
+
export { A as AcceptedFrame, a as AnalysisCompleteFrame, b as AnalysisStartedFrame, D as DeltaFrame, c as DoneFrame, E as ErrorFrame, d as EverfurRequest, e as EverfurRequestBase, F as Frame, f as FrameBase, g as FrameKind, H as HeartbeatFrame, h as HttpMethod, M as MultipartBody, T as TransportPort, U as UnknownFrame, i as UrgencyLevel } from '../config.d-B4-Mrwq2.js';
|
|
17
18
|
|
|
18
19
|
/**
|
|
19
20
|
* The full /state payload. `degraded` + `cache_epoch` + `cache_key` are additive fields an older backend
|
|
@@ -22,7 +23,7 @@ export { A as AcceptedFrame, a as AnalysisCompleteFrame, b as AnalysisStartedFra
|
|
|
22
23
|
declare const petStateResponseWireSchema: z.ZodObject<{
|
|
23
24
|
category: z.ZodEnum<["health", "attention", "moment", "activity", "mood", "idle"]>;
|
|
24
25
|
tiers: z.ZodDefault<z.ZodObject<{
|
|
25
|
-
animation: z.ZodOptional<z.ZodObject<{
|
|
26
|
+
animation: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
26
27
|
url: z.ZodString;
|
|
27
28
|
kind: z.ZodDefault<z.ZodEnum<["webp", "video"]>>;
|
|
28
29
|
loop_duration_ms: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
@@ -40,8 +41,8 @@ declare const petStateResponseWireSchema: z.ZodObject<{
|
|
|
40
41
|
kind?: "video" | "webp" | undefined;
|
|
41
42
|
loop_duration_ms?: number | null | undefined;
|
|
42
43
|
cache_key?: string | null | undefined;
|
|
43
|
-
}
|
|
44
|
-
image: z.ZodOptional<z.ZodObject<{
|
|
44
|
+
}>>>;
|
|
45
|
+
image: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
45
46
|
url: z.ZodString;
|
|
46
47
|
kind: z.ZodDefault<z.ZodEnum<["webp", "video"]>>;
|
|
47
48
|
loop_duration_ms: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
@@ -59,7 +60,7 @@ declare const petStateResponseWireSchema: z.ZodObject<{
|
|
|
59
60
|
kind?: "video" | "webp" | undefined;
|
|
60
61
|
loop_duration_ms?: number | null | undefined;
|
|
61
62
|
cache_key?: string | null | undefined;
|
|
62
|
-
}
|
|
63
|
+
}>>>;
|
|
63
64
|
}, "strip", z.ZodTypeAny, {
|
|
64
65
|
image?: {
|
|
65
66
|
kind: "video" | "webp";
|
|
@@ -67,14 +68,14 @@ declare const petStateResponseWireSchema: z.ZodObject<{
|
|
|
67
68
|
expires_at: string;
|
|
68
69
|
loop_duration_ms?: number | null | undefined;
|
|
69
70
|
cache_key?: string | null | undefined;
|
|
70
|
-
} | undefined;
|
|
71
|
+
} | null | undefined;
|
|
71
72
|
animation?: {
|
|
72
73
|
kind: "video" | "webp";
|
|
73
74
|
url: string;
|
|
74
75
|
expires_at: string;
|
|
75
76
|
loop_duration_ms?: number | null | undefined;
|
|
76
77
|
cache_key?: string | null | undefined;
|
|
77
|
-
} | undefined;
|
|
78
|
+
} | null | undefined;
|
|
78
79
|
}, {
|
|
79
80
|
image?: {
|
|
80
81
|
url: string;
|
|
@@ -82,17 +83,17 @@ declare const petStateResponseWireSchema: z.ZodObject<{
|
|
|
82
83
|
kind?: "video" | "webp" | undefined;
|
|
83
84
|
loop_duration_ms?: number | null | undefined;
|
|
84
85
|
cache_key?: string | null | undefined;
|
|
85
|
-
} | undefined;
|
|
86
|
+
} | null | undefined;
|
|
86
87
|
animation?: {
|
|
87
88
|
url: string;
|
|
88
89
|
expires_at: string;
|
|
89
90
|
kind?: "video" | "webp" | undefined;
|
|
90
91
|
loop_duration_ms?: number | null | undefined;
|
|
91
92
|
cache_key?: string | null | undefined;
|
|
92
|
-
} | undefined;
|
|
93
|
+
} | null | undefined;
|
|
93
94
|
}>>;
|
|
94
95
|
overlays: z.ZodDefault<z.ZodObject<{
|
|
95
|
-
weather_alert: z.ZodOptional<z.ZodObject<{
|
|
96
|
+
weather_alert: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
96
97
|
url: z.ZodString;
|
|
97
98
|
kind: z.ZodDefault<z.ZodEnum<["webp", "video"]>>;
|
|
98
99
|
loop_duration_ms: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
@@ -110,7 +111,7 @@ declare const petStateResponseWireSchema: z.ZodObject<{
|
|
|
110
111
|
kind?: "video" | "webp" | undefined;
|
|
111
112
|
loop_duration_ms?: number | null | undefined;
|
|
112
113
|
cache_key?: string | null | undefined;
|
|
113
|
-
}
|
|
114
|
+
}>>>;
|
|
114
115
|
}, "strip", z.ZodTypeAny, {
|
|
115
116
|
weather_alert?: {
|
|
116
117
|
kind: "video" | "webp";
|
|
@@ -118,7 +119,7 @@ declare const petStateResponseWireSchema: z.ZodObject<{
|
|
|
118
119
|
expires_at: string;
|
|
119
120
|
loop_duration_ms?: number | null | undefined;
|
|
120
121
|
cache_key?: string | null | undefined;
|
|
121
|
-
} | undefined;
|
|
122
|
+
} | null | undefined;
|
|
122
123
|
}, {
|
|
123
124
|
weather_alert?: {
|
|
124
125
|
url: string;
|
|
@@ -126,14 +127,14 @@ declare const petStateResponseWireSchema: z.ZodObject<{
|
|
|
126
127
|
kind?: "video" | "webp" | undefined;
|
|
127
128
|
loop_duration_ms?: number | null | undefined;
|
|
128
129
|
cache_key?: string | null | undefined;
|
|
129
|
-
} | undefined;
|
|
130
|
+
} | null | undefined;
|
|
130
131
|
}>>;
|
|
131
132
|
idle: z.ZodDefault<z.ZodLiteral<"bundled">>;
|
|
132
133
|
ttl_seconds: z.ZodNumber;
|
|
133
134
|
degraded: z.ZodDefault<z.ZodBoolean>;
|
|
134
135
|
cache_epoch: z.ZodDefault<z.ZodNumber>;
|
|
135
136
|
}, "strip", z.ZodTypeAny, {
|
|
136
|
-
category: "idle" | "
|
|
137
|
+
category: "idle" | "mood" | "health" | "attention" | "moment" | "activity";
|
|
137
138
|
idle: "bundled";
|
|
138
139
|
tiers: {
|
|
139
140
|
image?: {
|
|
@@ -142,14 +143,14 @@ declare const petStateResponseWireSchema: z.ZodObject<{
|
|
|
142
143
|
expires_at: string;
|
|
143
144
|
loop_duration_ms?: number | null | undefined;
|
|
144
145
|
cache_key?: string | null | undefined;
|
|
145
|
-
} | undefined;
|
|
146
|
+
} | null | undefined;
|
|
146
147
|
animation?: {
|
|
147
148
|
kind: "video" | "webp";
|
|
148
149
|
url: string;
|
|
149
150
|
expires_at: string;
|
|
150
151
|
loop_duration_ms?: number | null | undefined;
|
|
151
152
|
cache_key?: string | null | undefined;
|
|
152
|
-
} | undefined;
|
|
153
|
+
} | null | undefined;
|
|
153
154
|
};
|
|
154
155
|
overlays: {
|
|
155
156
|
weather_alert?: {
|
|
@@ -158,13 +159,13 @@ declare const petStateResponseWireSchema: z.ZodObject<{
|
|
|
158
159
|
expires_at: string;
|
|
159
160
|
loop_duration_ms?: number | null | undefined;
|
|
160
161
|
cache_key?: string | null | undefined;
|
|
161
|
-
} | undefined;
|
|
162
|
+
} | null | undefined;
|
|
162
163
|
};
|
|
163
164
|
ttl_seconds: number;
|
|
164
165
|
degraded: boolean;
|
|
165
166
|
cache_epoch: number;
|
|
166
167
|
}, {
|
|
167
|
-
category: "idle" | "
|
|
168
|
+
category: "idle" | "mood" | "health" | "attention" | "moment" | "activity";
|
|
168
169
|
ttl_seconds: number;
|
|
169
170
|
idle?: "bundled" | undefined;
|
|
170
171
|
tiers?: {
|
|
@@ -174,14 +175,14 @@ declare const petStateResponseWireSchema: z.ZodObject<{
|
|
|
174
175
|
kind?: "video" | "webp" | undefined;
|
|
175
176
|
loop_duration_ms?: number | null | undefined;
|
|
176
177
|
cache_key?: string | null | undefined;
|
|
177
|
-
} | undefined;
|
|
178
|
+
} | null | undefined;
|
|
178
179
|
animation?: {
|
|
179
180
|
url: string;
|
|
180
181
|
expires_at: string;
|
|
181
182
|
kind?: "video" | "webp" | undefined;
|
|
182
183
|
loop_duration_ms?: number | null | undefined;
|
|
183
184
|
cache_key?: string | null | undefined;
|
|
184
|
-
} | undefined;
|
|
185
|
+
} | null | undefined;
|
|
185
186
|
} | undefined;
|
|
186
187
|
overlays?: {
|
|
187
188
|
weather_alert?: {
|
|
@@ -190,7 +191,7 @@ declare const petStateResponseWireSchema: z.ZodObject<{
|
|
|
190
191
|
kind?: "video" | "webp" | undefined;
|
|
191
192
|
loop_duration_ms?: number | null | undefined;
|
|
192
193
|
cache_key?: string | null | undefined;
|
|
193
|
-
} | undefined;
|
|
194
|
+
} | null | undefined;
|
|
194
195
|
} | undefined;
|
|
195
196
|
degraded?: boolean | undefined;
|
|
196
197
|
cache_epoch?: number | undefined;
|
package/dist/animations/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/*! @everfur/sdk. Copyright (c) 2026 Strand Health Inc. dba Everfur. All rights reserved. Use is subject to the Everfur SDK License: https://docs.everfur.com/license */
|
|
1
2
|
import{createContext,forwardRef,createElement,useState,useEffect,useCallback,useSyncExternalStore,useMemo,useRef,useContext,Component}from"react";import{TextInput,AccessibilityInfo,View,Image,ActivityIndicator,StyleSheet,Text as Text$1}from"react-native";import{jsx,jsxs}from"react/jsx-runtime";import{z}from"zod";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]=createContext(EVERFUR_LIGHT));EverfurThemeContext.displayName??="EverfurThemeContext";function useEverfurTheme(){return 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 createElement(Text$1,cap===void 0?props:{maxFontSizeMultiplier:cap,...props})}forwardRef(function(props,ref){return createElement(TextInput,{...props,...ref===null?{}:{ref:ref}})});function assertNever(x){throw new Error(`assertNever: unhandled discriminated-union member ${JSON.stringify(x)}`)}function errorFrame(fields){/* @__PURE__ */
|
|
2
3
|
return Object.freeze({kind:"error",terminal:true,code:fields.code,retryable:fields.retryable,wireMessage:fields.wireMessage,synthesized:fields.synthesized,lastEventId:fields.lastEventId,serverRequestId:null})}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 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 createElement(HostRenderBoundary,{fallback:fallback,resetKey:resetKey,children:createElement(RenderHost,{render:render})})}var CONTRACT_RETRYABILITY=/* @__PURE__ */Object.freeze([
|
|
3
4
|
/* @__PURE__ */Object.freeze({wireCode:"AccessDeniedException",envelope:"http_envelope",httpStatus:403,retryable:false}),
|
|
@@ -100,7 +101,7 @@ return Object.freeze({ok:false,error:error})}var EverfurConfigError=class _Everf
|
|
|
100
101
|
return jsx(View,{style:[styles.offstate,style],accessible:true,accessibilityState:{busy:true},accessibilityLabel:`Loading ${capability}`,children:/* @__PURE__ */jsx(View,{style:styles.skeletonBar})})}function OffState({decision:decision,style:style}){let theme=useEverfurTheme(),styles=useMemo(()=>makeStyles(theme),[theme]),message=decision.disabled?.reason??"";/* @__PURE__ */
|
|
101
102
|
return jsx(View,{style:[styles.offstate,style],accessible:true,accessibilityRole:"text",accessibilityLabel:message,children:message.length>0?/* @__PURE__ */jsx(Text,{style:styles.offstateText,children:message}):null})}function makeStyles(theme){let{color:color,space:space,radius:radius,type:type}=theme;return StyleSheet.create({offstate:{minHeight:MIN_OFFSTATE_HEIGHT,justifyContent:"center",paddingHorizontal:space.lg,paddingVertical:space.md,backgroundColor:color.surfaceCream,borderRadius:radius.md,borderWidth:StyleSheet.hairlineWidth,borderColor:color.brandBorder},offstateText:{...face(theme,"regular"),fontSize:type.size.body,lineHeight:Math.round(type.size.body*type.lineHeight.normal),color:color.text.muted},skeletonBar:{height:space.md,borderRadius:radius.xs,backgroundColor:color.brandSofter}})}function mintFailedError(cause,refusal){let message=cause instanceof Error?cause.message:typeof cause=="string"?cause:null;return makeEverfurError("authRejected",{retryable:false,...refusal?.wireCode?{wireCode:refusal.wireCode}:{},...refusal?.requestId?{requestId:refusal.requestId}:{},...message?{wireMessage:message}:{},...cause!=null?{raw:cause}:{}})}function newSessionId(){let bytes=new Uint8Array(16),cryptoObj=globalThis.crypto;if(typeof cryptoObj?.getRandomValues=="function")cryptoObj.getRandomValues(bytes);else for(let i=0;i<bytes.length;i+=1)bytes[i]=Math.floor(Math.random()*256);bytes[6]=bytes[6]&15|64,bytes[8]=bytes[8]&63|128;let hex=[];for(let i=0;i<bytes.length;i+=1)hex.push(bytes[i].toString(16).padStart(2,"0"));return hex.slice(0,4).join("")+"-"+hex.slice(4,6).join("")+"-"+hex.slice(6,8).join("")+"-"+hex.slice(8,10).join("")+"-"+hex.slice(10,16).join("")}function authHeaders(auth){let headers={};return auth.mode==="personalized"?headers.authorization=`Bearer ${auth.token}`:headers["x-everfur-partner-key"]=auth.publishableKey,auth.userRef&&(headers["x-everfur-user-ref"]=auth.userRef),auth.sessionId&&(headers["x-everfur-session-id"]=auth.sessionId),headers}function withAuthHeaders(req,auth){return{...req,headers:{...stripAuthHeaders(req.headers),...authHeaders(auth)}}}function stripAuthHeaders(headers){if(!headers)return{};let out={};for(let[key,value]of Object.entries(headers)){let lower=key.toLowerCase();lower==="authorization"||lower==="x-everfur-partner-key"||(out[key]=value)}return out}async function authedSend(req,ctx){if(ctx.mode==="anonymous")return ctx.transport.request(withAuthHeaders(req,{mode:"anonymous",publishableKey:ctx.publishableKey,userRef:ctx.userRef,...ctx.sessionId?{sessionId:ctx.sessionId}:{}}));let token;try{token=await ctx.identity.currentToken()}catch(cause){return ctx.identity.reportRejected?.(),err(mintFailedError(cause))}let first=await ctx.transport.request(withAuthHeaders(req,{mode:"personalized",token:token,userRef:ctx.userRef,...ctx.sessionId?{sessionId:ctx.sessionId}:{}}));if(first.ok||first.error.httpStatus!==401)return first;let refreshed;try{refreshed=await ctx.identity.currentToken({forceRefresh:!0})}catch(cause){return ctx.identity.reportRejected?.(),err(mintFailedError(cause,{wireCode:wireCodeOf(first.error.raw),requestId:first.error.requestId}))}let retry=await ctx.transport.request(withAuthHeaders(req,{mode:"personalized",token:refreshed,userRef:ctx.userRef,...ctx.sessionId?{sessionId:ctx.sessionId}:{}}));return!retry.ok&&retry.error.httpStatus===401?(ctx.identity.reportRejected?.(),err(refusedAfterRemintError(retry.error))):retry}function refusedAfterRemintError(refusal){let raw=refusal.raw,wireCode=wireCodeOf(raw);return makeEverfurError("authRejected",{retryable:false,...refusal.httpStatus!==void 0?{httpStatus:refusal.httpStatus}:{},...refusal.requestId?{requestId:refusal.requestId}:{},...wireCode?{wireCode:wireCode}:{},...refusal.reasonCode?{reasonCode:refusal.reasonCode}:{},...refusal.wireMessage?{wireMessage:refusal.wireMessage}:{},...raw!=null?{raw:raw}:{}})}function wireCodeOf(body){if(typeof body!="object"||body===null)return null;let b=body,code=(typeof b.error=="object"&&b.error!==null?b.error.code:void 0)??b.code;return typeof code=="string"&&code.length>0?code:null}function networkError(cause){return makeEverfurError("internalError",{retryable:true,wireMessage:describeCause(cause)})}function describeCause(cause){return cause instanceof Error?cause.message:typeof cause=="string"?cause:"network request failed"}var FUNNEL_UNARY_TIMEOUT_MS=3e4,RETRY_OVERRIDE_MAX_MS=BACKOFF_CAP_MS*2,IDEMPOTENCY_HEADER="idempotency-key",MUTATING_METHODS=/* @__PURE__ */new Set(["POST","PUT","PATCH","DELETE"]),NOOP_OBSERVER=/* @__PURE__ */Object.freeze({onEvent(){}}),defaultFunnelTimers=/* @__PURE__ */Object.freeze({setTimeout:(handler,ms)=>setTimeout(handler,ms),clearTimeout:handle=>clearTimeout(handle),now:()=>Date.now()});function seededIdempotencyKey(seed){let safe=seed.trim().replace(/[^A-Za-z0-9_.:-]/g,"-");return safe.length===0?null:`efs_${safe}`.slice(0,128)}function createRequestFunnel(deps){let observer=deps.observer??NOOP_OBSERVER,timers=deps.timers??defaultFunnelTimers,rng=deps.rng??Math.random,sleep=deps.sleep??((ms,signal)=>delayAbortable(ms,timers,signal)),ceiling=deps.maxAttempts??MAX_RETRY_ATTEMPTS,timeoutMs=deps.unaryTimeoutMs??FUNNEL_UNARY_TIMEOUT_MS,mintKey=deps.newIdempotencyKey??defaultIdempotencyKeyFactory(),emit=event=>{try{observer.onEvent(event)}catch{}};async function send(call,req,opts){let perCallMaxAttempts=opts?.maxAttempts,maxAttempts=Math.max(1,perCallMaxAttempts??ceiling),idempotent=opts?.idempotent??MUTATING_METHODS.has(req.method),seeded=opts?.idempotencyKey===void 0?null:seededIdempotencyKey(opts.idempotencyKey),idempotencyKey=idempotent?seeded??mintKey():null,base=assembleHeaders(req,idempotencyKey),attempt=0;for(;;){let stamp=extra=>/* @__PURE__ */Object.freeze({call:call,method:req.method,path:req.path,attempt:attempt,...idempotencyKey?{idempotencyKey:idempotencyKey}:{},...extra});emit(stamp({phase:"attempt"}));let deadline=boundedSignal(timeoutMs,timers),merged=mergeSignals(deadline.signal,req.signal),settled;try{settled=await authedSend({...base,signal:merged.signal},deps.auth)}catch(cause){settled=err(networkError(cause))}finally{merged.dispose(),deadline.cancel()}if(settled.ok)return emit(stamp({phase:"settled",ok:true,reason:"ok"})),settled;let error=settled.error,decision=decideRetry(error,attempt,{maxAttempts:maxAttempts,rng:rng,now:timers.now(),aborted:req.signal?.aborted===true,...perCallMaxAttempts!==void 0?{perCallMaxAttempts:perCallMaxAttempts}:{},...deps.errorPolicy!==void 0?{policy:deps.errorPolicy}:{}}),settledEvent={ok:false,code:error.code,reason:decision.reason,...error.httpStatus!==void 0?{httpStatus:error.httpStatus}:{},...error.requestId!==void 0?{requestId:error.requestId}:{}};if(!decision.retry)return emit(stamp({phase:"settled",...settledEvent})),err(error);if(emit(stamp({phase:"retry",...settledEvent,delayMs:decision.delayMs})),await sleep(decision.delayMs,req.signal),req.signal?.aborted===true)return emit(stamp({phase:"settled",...settledEvent,reason:"aborted"})),err(error);attempt+=1}}async function authorize(req){return withAuthHeaders(req,await resolveDeviceAuth(deps.auth))}async function*stream(call,req,signal){emit(
|
|
102
103
|
/* @__PURE__ */Object.freeze({call:call,phase:"stream.open",method:req.method,path:req.path,attempt:0}));try{yield*deps.auth.transport.stream(req,signal)}catch{yield errorFrame({code:"internal_error",retryable:true,wireMessage:null,synthesized:true,lastEventId:null})}}/* @__PURE__ */
|
|
103
|
-
return Object.freeze({send:send,authorize:authorize,stream:stream})}function assembleHeaders(req,idempotencyKey){let headers={};for(let[key,value]of Object.entries(req.headers??{}))key.toLowerCase()!==IDEMPOTENCY_HEADER&&(headers[key]=value);return idempotencyKey!==null&&(headers["Idempotency-Key"]=idempotencyKey),{...req,headers:headers}}function defaultIdempotencyKeyFactory(){let counter=0;return()=>`efk_${Date.now().toString(36)}_${(counter++).toString(36)}_${Math.random().toString(36).slice(2,12)}`}var POLICY_MAX_ATTEMPTS_CAP=10;function decideRetry(error,attempt,ctx){if(ctx.aborted)return{retry:false,reason:"aborted"};let throttle=throttleKind(error);if(throttle==="quota")return{retry:false,reason:"daily-quota-exhausted"};if(throttle!=="burst"&&!isAutoRetryable(error.code))return{retry:false,reason:"terminal-code"};let reason=throttle==="burst"?"burst-throttle":"retryable-code";if((()=>{if(ctx.policy===void 0)return false;try{return!ctx.policy.shouldRetry(error.code,attempt)}catch{return false}})())return{retry:false,reason:"terminal-code"};let policyCeiling=()=>{if(ctx.policy===void 0)return null;let raw;try{raw=ctx.policy.maxAttempts(error.code)}catch{return null}return typeof raw!="number"||!Number.isFinite(raw)?null:Math.max(1,Math.min(POLICY_MAX_ATTEMPTS_CAP,Math.floor(raw)))},ceiling=ctx.perCallMaxAttempts??policyCeiling()??ctx.maxAttempts;if(attempt+1>=ceiling)return{retry:false,reason:"attempts-exhausted"};let override=retryOverrideMs(error,ctx.now);return override!==null?override>RETRY_OVERRIDE_MAX_MS?{retry:false,reason:"server-reset-beyond-budget"}:{retry:true,reason:reason,delayMs:override}:{retry:true,reason:reason,delayMs:backoffDelayMs(attempt,ctx.rng)}}function throttleKind(error){let code=error.code==="unknown"?fromWire(rawWireCode(error.raw)):error.code;return code==="quotaExceeded"?"quota":code==="rateLimited"||error.httpStatus===429?"burst":null}function retryOverrideMs(error,now){let at=findResetsAt(error.raw);if(at!==null){let delta=at-now;return delta>0?delta:0}let wait=findRetryAfterSeconds(error.raw);return wait===null?null:Math.round(wait*1e3)}function findRetryAfterSeconds(raw){for(let scope of candidateScopes(raw)){let value=scope.retry_after_seconds;if(typeof value=="number"&&Number.isFinite(value)&&value>=0)return value}return null}function findResetsAt(raw){for(let scope of candidateScopes(raw)){let value=scope.resets_at,parsed=parseInstantMs(value);if(parsed!==null)return parsed}return null}function candidateScopes(raw){if(!isRecord(raw))return[];let out=[raw];for(let nested of["error","detail"]){let value=raw[nested];isRecord(value)&&out.push(value)}return out}function parseInstantMs(value){if(typeof value=="number"&&Number.isFinite(value))return value<1e11?Math.round(value*1e3):Math.round(value);if(typeof value=="string"&&value.trim().length>0){let parsed=Date.parse(value);return Number.isFinite(parsed)?parsed:null}return null}function rawWireCode(raw){for(let scope of candidateScopes(raw)){let code=scope.code;if(typeof code=="string"&&code.length>0)return code}return null}function isRecord(value){return typeof value=="object"&&value!==null}async function resolveDeviceAuth(auth){return auth.mode==="anonymous"?{mode:"anonymous",publishableKey:auth.publishableKey,userRef:auth.userRef,...auth.sessionId?{sessionId:auth.sessionId}:{}}:{mode:"personalized",token:await auth.identity.currentToken(),userRef:auth.userRef,...auth.sessionId?{sessionId:auth.sessionId}:{}}}function boundedSignal(ms,timers){let ctrl=new AbortController,handle=timers.setTimeout(()=>ctrl.abort(),ms);return{signal:ctrl.signal,cancel:()=>timers.clearTimeout(handle)}}function mergeSignals(deadline,caller){let noop=()=>{};if(!caller)return{signal:deadline,dispose:noop};let ctrl=new AbortController;if(deadline.aborted||caller.aborted)return ctrl.abort(),{signal:ctrl.signal,dispose:noop};let onAbort=()=>ctrl.abort();return deadline.addEventListener("abort",onAbort,{once:true}),caller.addEventListener("abort",onAbort,{once:true}),{signal:ctrl.signal,dispose:()=>{deadline.removeEventListener("abort",onAbort),caller.removeEventListener("abort",onAbort)}}}function delayAbortable(ms,timers,signal){return ms<=0||signal?.aborted===true?Promise.resolve():new Promise(resolve=>{let handle=timers.setTimeout(()=>{signal?.removeEventListener("abort",onAbort),resolve()},ms),onAbort=()=>{timers.clearTimeout(handle),resolve()};signal?.addEventListener("abort",onAbort,{once:true})})}function hasLoneSurrogate(value){for(let i=0;i<value.length;i+=1){let code=value.charCodeAt(i);if(code>=55296&&code<=56319){let low=value.charCodeAt(i+1);if(!(low>=56320&&low<=57343))return true;i+=1}else if(code>=56320&&code<=57343)return true}return false}function mapTier(wire){let tier={url:wire.url,kind:wire.kind,expiresAt:wire.expires_at};return typeof wire.loop_duration_ms=="number"&&(tier.loopDurationMs=wire.loop_duration_ms),typeof wire.cache_key=="string"&&wire.cache_key.length>0&&(tier.cacheKey=wire.cache_key),/* @__PURE__ */Object.freeze(tier)}function mapPetStateResponse(wire){let tiers={};wire.tiers.animation&&(tiers.animation=mapTier(wire.tiers.animation)),wire.tiers.image&&(tiers.image=mapTier(wire.tiers.image));let overlays={};wire.overlays.weather_alert&&(overlays.weatherAlert=mapTier(wire.overlays.weather_alert));let response={category:wire.category,tiers:/* @__PURE__ */Object.freeze(tiers),overlays:/* @__PURE__ */Object.freeze(overlays),idle:"bundled",ttlSeconds:wire.ttl_seconds,degraded:wire.degraded};return typeof wire.cache_epoch=="number"&&(response.cacheEpoch=wire.cache_epoch),/* @__PURE__ */Object.freeze(response)}var mediaKindWireSchema=/* @__PURE__ */z.enum(["webp","video"]),categoryWireSchema=/* @__PURE__ */z.enum(["health","attention","moment","activity","mood","idle"]),petStateTierWireSchema=/* @__PURE__ */z.object({url:/* @__PURE__ */z.string(),kind:/* @__PURE__ */mediaKindWireSchema.default("webp"),loop_duration_ms:/* @__PURE__ */z.number().nullish(),expires_at:/* @__PURE__ */z.string(),cache_key:/* @__PURE__ */z.string().nullish()}),petStateResponseWireSchema=/* @__PURE__ */z.object({category:categoryWireSchema,tiers:/* @__PURE__ */z.object({animation:/* @__PURE__ */petStateTierWireSchema.
|
|
104
|
+
return Object.freeze({send:send,authorize:authorize,stream:stream})}function assembleHeaders(req,idempotencyKey){let headers={};for(let[key,value]of Object.entries(req.headers??{}))key.toLowerCase()!==IDEMPOTENCY_HEADER&&(headers[key]=value);return idempotencyKey!==null&&(headers["Idempotency-Key"]=idempotencyKey),{...req,headers:headers}}function defaultIdempotencyKeyFactory(){let counter=0;return()=>`efk_${Date.now().toString(36)}_${(counter++).toString(36)}_${Math.random().toString(36).slice(2,12)}`}var POLICY_MAX_ATTEMPTS_CAP=10;function decideRetry(error,attempt,ctx){if(ctx.aborted)return{retry:false,reason:"aborted"};let throttle=throttleKind(error);if(throttle==="quota")return{retry:false,reason:"daily-quota-exhausted"};if(throttle!=="burst"&&!isAutoRetryable(error.code))return{retry:false,reason:"terminal-code"};let reason=throttle==="burst"?"burst-throttle":"retryable-code";if((()=>{if(ctx.policy===void 0)return false;try{return!ctx.policy.shouldRetry(error.code,attempt)}catch{return false}})())return{retry:false,reason:"terminal-code"};let policyCeiling=()=>{if(ctx.policy===void 0)return null;let raw;try{raw=ctx.policy.maxAttempts(error.code)}catch{return null}return typeof raw!="number"||!Number.isFinite(raw)?null:Math.max(1,Math.min(POLICY_MAX_ATTEMPTS_CAP,Math.floor(raw)))},ceiling=ctx.perCallMaxAttempts??policyCeiling()??ctx.maxAttempts;if(attempt+1>=ceiling)return{retry:false,reason:"attempts-exhausted"};let override=retryOverrideMs(error,ctx.now);return override!==null?override>RETRY_OVERRIDE_MAX_MS?{retry:false,reason:"server-reset-beyond-budget"}:{retry:true,reason:reason,delayMs:override}:{retry:true,reason:reason,delayMs:backoffDelayMs(attempt,ctx.rng)}}function throttleKind(error){let code=error.code==="unknown"?fromWire(rawWireCode(error.raw)):error.code;return code==="quotaExceeded"?"quota":code==="rateLimited"||error.httpStatus===429?"burst":null}function retryOverrideMs(error,now){let at=findResetsAt(error.raw);if(at!==null){let delta=at-now;return delta>0?delta:0}let wait=findRetryAfterSeconds(error.raw);return wait===null?null:Math.round(wait*1e3)}function findRetryAfterSeconds(raw){for(let scope of candidateScopes(raw)){let value=scope.retry_after_seconds;if(typeof value=="number"&&Number.isFinite(value)&&value>=0)return value}return null}function findResetsAt(raw){for(let scope of candidateScopes(raw)){let value=scope.resets_at,parsed=parseInstantMs(value);if(parsed!==null)return parsed}return null}function candidateScopes(raw){if(!isRecord(raw))return[];let out=[raw];for(let nested of["error","detail"]){let value=raw[nested];isRecord(value)&&out.push(value)}return out}function parseInstantMs(value){if(typeof value=="number"&&Number.isFinite(value))return value<1e11?Math.round(value*1e3):Math.round(value);if(typeof value=="string"&&value.trim().length>0){let parsed=Date.parse(value);return Number.isFinite(parsed)?parsed:null}return null}function rawWireCode(raw){for(let scope of candidateScopes(raw)){let code=scope.code;if(typeof code=="string"&&code.length>0)return code}return null}function isRecord(value){return typeof value=="object"&&value!==null}async function resolveDeviceAuth(auth){return auth.mode==="anonymous"?{mode:"anonymous",publishableKey:auth.publishableKey,userRef:auth.userRef,...auth.sessionId?{sessionId:auth.sessionId}:{}}:{mode:"personalized",token:await auth.identity.currentToken(),userRef:auth.userRef,...auth.sessionId?{sessionId:auth.sessionId}:{}}}function boundedSignal(ms,timers){let ctrl=new AbortController,handle=timers.setTimeout(()=>ctrl.abort(),ms);return{signal:ctrl.signal,cancel:()=>timers.clearTimeout(handle)}}function mergeSignals(deadline,caller){let noop=()=>{};if(!caller)return{signal:deadline,dispose:noop};let ctrl=new AbortController;if(deadline.aborted||caller.aborted)return ctrl.abort(),{signal:ctrl.signal,dispose:noop};let onAbort=()=>ctrl.abort();return deadline.addEventListener("abort",onAbort,{once:true}),caller.addEventListener("abort",onAbort,{once:true}),{signal:ctrl.signal,dispose:()=>{deadline.removeEventListener("abort",onAbort),caller.removeEventListener("abort",onAbort)}}}function delayAbortable(ms,timers,signal){return ms<=0||signal?.aborted===true?Promise.resolve():new Promise(resolve=>{let handle=timers.setTimeout(()=>{signal?.removeEventListener("abort",onAbort),resolve()},ms),onAbort=()=>{timers.clearTimeout(handle),resolve()};signal?.addEventListener("abort",onAbort,{once:true})})}function hasLoneSurrogate(value){for(let i=0;i<value.length;i+=1){let code=value.charCodeAt(i);if(code>=55296&&code<=56319){let low=value.charCodeAt(i+1);if(!(low>=56320&&low<=57343))return true;i+=1}else if(code>=56320&&code<=57343)return true}return false}function mapTier(wire){let tier={url:wire.url,kind:wire.kind,expiresAt:wire.expires_at};return typeof wire.loop_duration_ms=="number"&&(tier.loopDurationMs=wire.loop_duration_ms),typeof wire.cache_key=="string"&&wire.cache_key.length>0&&(tier.cacheKey=wire.cache_key),/* @__PURE__ */Object.freeze(tier)}function mapPetStateResponse(wire){let tiers={};wire.tiers.animation&&(tiers.animation=mapTier(wire.tiers.animation)),wire.tiers.image&&(tiers.image=mapTier(wire.tiers.image));let overlays={};wire.overlays.weather_alert&&(overlays.weatherAlert=mapTier(wire.overlays.weather_alert));let response={category:wire.category,tiers:/* @__PURE__ */Object.freeze(tiers),overlays:/* @__PURE__ */Object.freeze(overlays),idle:"bundled",ttlSeconds:wire.ttl_seconds,degraded:wire.degraded};return typeof wire.cache_epoch=="number"&&(response.cacheEpoch=wire.cache_epoch),/* @__PURE__ */Object.freeze(response)}var mediaKindWireSchema=/* @__PURE__ */z.enum(["webp","video"]),categoryWireSchema=/* @__PURE__ */z.enum(["health","attention","moment","activity","mood","idle"]),petStateTierWireSchema=/* @__PURE__ */z.object({url:/* @__PURE__ */z.string(),kind:/* @__PURE__ */mediaKindWireSchema.default("webp"),loop_duration_ms:/* @__PURE__ */z.number().nullish(),expires_at:/* @__PURE__ */z.string(),cache_key:/* @__PURE__ */z.string().nullish()}),petStateResponseWireSchema=/* @__PURE__ */z.object({category:categoryWireSchema,tiers:/* @__PURE__ */z.object({animation:/* @__PURE__ */petStateTierWireSchema.nullish(),image:/* @__PURE__ */petStateTierWireSchema.nullish()}).default({}),overlays:/* @__PURE__ */z.object({weather_alert:/* @__PURE__ */petStateTierWireSchema.nullish()}).default({}),idle:/* @__PURE__ */z.literal("bundled").default("bundled"),ttl_seconds:/* @__PURE__ */z.number(),degraded:/* @__PURE__ */z.boolean().default(false),cache_epoch:/* @__PURE__ */z.number().default(0)});function parsePetStateWire(raw){let parsed=petStateResponseWireSchema.safeParse(raw);return parsed.success?parsed.data:null}function createPetStateRepository(auth){return createPetStateRepositoryOver(createRequestFunnel({auth:auth}))}function createPetStateRepositoryOver(funnel){return{async getState(petRef,opts){if(hasLoneSurrogate(petRef))return err(makeEverfurError("validationFailed",{retryable:false,wireMessage:"pet_ref contains an unpaired surrogate and cannot be encoded"}));let path=`/widget/v1/pets/${encodeURIComponent(petRef)}/state`,res=await funnel.send("animations.getState",opts?.signal?{method:"GET",path:path,signal:opts.signal}:{method:"GET",path:path},opts?.maxAttempts!==void 0?{maxAttempts:opts.maxAttempts}:void 0);if(res.ok){let wire=parsePetStateWire(res.value);return wire===null?err(makeEverfurError("internalError",{retryable:true})):ok(mapPetStateResponse(wire))}return res.error.httpStatus===404?ok(null):err(res.error)}}}function stableMediaKey(source){if(source===void 0)return"bundled:none";if(typeof source=="number")return`bundled:${source}`;if("kind"in source)return`bundled:${source.id}`;let uri=source.uri,q=uri.indexOf("?");return q===-1?uri:uri.slice(0,q)}function selectTier(i){return i.hasPhoto&&!i.photoFailed?"photo":i.canAnimate&&!i.animationFailed?"animation":i.hasImage&&!i.imageFailed?"image":"idle"}function retireTier(current,failed){switch(current){case"photo":return{failed:freezeFailed({...failed,photo:true}),reason:"network_error"};case"animation":return{failed:freezeFailed({...failed,animation:true}),reason:"network_error"};case"image":return{failed:freezeFailed({...failed,image:true}),reason:"network_error"};case"idle":return{failed:freezeFailed(failed),reason:"idle_asset_failed"};default:return{failed:freezeFailed(failed),reason:"network_error"}}}var NO_FAILURES=/* @__PURE__ */Object.freeze({photo:false,animation:false,image:false});function freezeFailed(f){/* @__PURE__ */
|
|
104
105
|
return Object.freeze({photo:f.photo,animation:f.animation,image:f.image})}function isLoaderSafeCategory(category){switch(category){case"activity":case"mood":case"moment":case"idle":return true;case"health":case"attention":return false;default:return false}}var CACHE_EPOCH_STORAGE_KEY="everfur.petState.cacheEpoch";function createCacheEpochGuard(deps){let lastActed=0,loaded=false,inFlight=null,run=async serverEpoch=>{if(loaded||(lastActed=await readStoredEpoch(deps.kv),loaded=true),serverEpoch<=lastActed)return false;try{await deps.kv.setItem(CACHE_EPOCH_STORAGE_KEY,String(serverEpoch))}catch{}lastActed=serverEpoch;try{await deps.cache.clearMemoryCache()}catch{}try{await deps.cache.clearDiskCache()}catch{}return true};return{async sync(serverEpoch){return typeof serverEpoch!="number"||!Number.isFinite(serverEpoch)||serverEpoch<=0||loaded&&serverEpoch<=lastActed?false:inFlight||(inFlight=run(serverEpoch).finally(()=>{inFlight=null}),inFlight)}}}async function readStoredEpoch(kv){let raw;try{raw=await kv.getItem(CACHE_EPOCH_STORAGE_KEY)}catch{return 0}if(raw===null)return 0;let parsed=Number(raw);return Number.isFinite(parsed)&&parsed>0?parsed:0}var SUPPORTED_SCHEMA_VERSION=1,MANIFEST_LKG_STORAGE_KEY="everfur.manifest.lastKnownGood",COMPILED_DEFAULT_IDLE=/* @__PURE__ */Object.freeze({kind:"bundled",id:"everfur-idle"}),COMPILED_DEFAULT_MANIFEST=/* @__PURE__ */Object.freeze({schemaVersion:SUPPORTED_SCHEMA_VERSION,revision:"compiled-default",surfaces:/* @__PURE__ */Object.freeze({animations:/* @__PURE__ */Object.freeze({enabled:true,idle:COMPILED_DEFAULT_IDLE})})}),bundledIdleSchema=/* @__PURE__ */z.object({kind:/* @__PURE__ */z.literal("bundled"),id:/* @__PURE__ */z.string().min(1)}),animationsSurfaceWireSchema=/* @__PURE__ */z.object({enabled:/* @__PURE__ */z.boolean().default(true),idle:/* @__PURE__ */bundledIdleSchema.optional()}),manifestWireSchema=/* @__PURE__ */z.object({schema_version:/* @__PURE__ */z.number().int(),revision:/* @__PURE__ */z.string().default(""),surfaces:/* @__PURE__ */z.object({animations:/* @__PURE__ */animationsSurfaceWireSchema.optional()}).default({})});function parseManifest(raw){let parsed=manifestWireSchema.safeParse(raw);if(!parsed.success)return{ok:false,reason:"unparseable"};if(parsed.data.schema_version>SUPPORTED_SCHEMA_VERSION)return{ok:false,reason:"newer_schema"};let animationsWire=parsed.data.surfaces.animations,surfaces={};return animationsWire&&(surfaces.animations=/* @__PURE__ */Object.freeze({enabled:animationsWire.enabled,idle:animationsWire.idle?/* @__PURE__ */Object.freeze({...animationsWire.idle}):COMPILED_DEFAULT_IDLE})),{ok:true,manifest:/* @__PURE__ */Object.freeze({schemaVersion:parsed.data.schema_version,revision:parsed.data.revision,surfaces:/* @__PURE__ */Object.freeze(surfaces)})}}async function resolveManifest(liveRaw,kv,tel){if(liveRaw!=null){let parsed=parseManifest(liveRaw);if(parsed.ok)return await writeLastKnownGood(kv,liveRaw),tel.track("manifest.fallback",{source:"live"}),/* @__PURE__ */Object.freeze({manifest:parsed.manifest,source:"live"});parsed.reason==="newer_schema"&&tel.track("manifest.refused_newer",{})}let lkg=await readLastKnownGood(kv);return lkg?(tel.track("manifest.fallback",{source:"last-known-good"}),/* @__PURE__ */Object.freeze({manifest:lkg,source:"last-known-good"})):(tel.track("manifest.fallback",{source:"compiled-default"}),/* @__PURE__ */Object.freeze({manifest:COMPILED_DEFAULT_MANIFEST,source:"compiled-default"}))}function animationsSurfaceOf(manifest){return manifest.surfaces.animations??COMPILED_DEFAULT_MANIFEST.surfaces.animations??{enabled:true,idle:COMPILED_DEFAULT_IDLE}}async function writeLastKnownGood(kv,raw){try{await kv.setItem(MANIFEST_LKG_STORAGE_KEY,JSON.stringify(raw))}catch{}}async function readLastKnownGood(kv){let stored;try{stored=await kv.getItem(MANIFEST_LKG_STORAGE_KEY)}catch{return null}if(stored===null)return null;let json;try{json=JSON.parse(stored)}catch{return null}let parsed=parseManifest(json);return parsed.ok?parsed.manifest:null}var EMPTY_SNAPSHOT=/* @__PURE__ */Object.freeze({data:null,isPending:false,isError:false,error:null,isDark:false});function createPetStateStore(deps){let{repo:repo,cacheEpoch:cacheEpoch,timers:timers}=deps,listeners=/* @__PURE__ */new Set,warm=/* @__PURE__ */new Map,snapshot=EMPTY_SNAPSHOT,currentPetRef=null,dataPetRef=null,isFocused=false,terminatedPetRef=null,remintHandle=null,inFlight=null,epoch=0,emit=()=>{for(let listener of listeners)listener()},patch=partial=>{snapshot=/* @__PURE__ */Object.freeze({...snapshot,...partial}),emit()},clearRemint=()=>{remintHandle!==null&&(timers.clearTimeout(remintHandle),remintHandle=null)},staleMs=data=>data?Math.max(1,data.ttlSeconds)*1e3:6e4,touchWarm=petRef=>{let entry=warm.get(petRef);entry!==void 0&&(warm.delete(petRef),warm.set(petRef,entry))},setWarm=(petRef,data)=>{for(warm.delete(petRef),warm.set(petRef,/* @__PURE__ */Object.freeze({data:data,fetchedAt:timers.now()}));warm.size>32;){let oldest=warm.keys().next().value;if(oldest===void 0||oldest===petRef)break;warm.delete(oldest)}},hasGoodTiers=petRef=>{let entry=warm.get(petRef);return entry?!!(entry.data.tiers.animation||entry.data.tiers.image):false},scheduleRemint=(petRef,ttlSeconds)=>{if(clearRemint(),!isFocused)return;let ms=Math.max(1,ttlSeconds)*1e3,scheduledEpoch=epoch;remintHandle=timers.setTimeout(()=>{remintHandle=null,!(scheduledEpoch!==epoch||currentPetRef!==petRef||!isFocused)&&fetchOnce(petRef,0)},ms)},fetchOnce=async(petRef,attempt)=>{if(currentPetRef!==petRef||terminatedPetRef===petRef||!isFocused)return;let myEpoch=epoch;inFlight?.abort();let ctrl=new AbortController;inFlight=ctrl;let res=await repo.getState(petRef,{signal:ctrl.signal});if(!(myEpoch!==epoch||currentPetRef!==petRef)){if(res.ok){let resp=res.value;if(resp===null){onTerminalDark(petRef);return}cacheEpoch.sync(resp.cacheEpoch);let respHasTiers=!!(resp.tiers.animation||resp.tiers.image);if(resp.degraded&&!respHasTiers&&hasGoodTiers(petRef)){patch({isError:false,error:null,isPending:false,isDark:false}),scheduleRemint(petRef,resp.ttlSeconds);return}setWarm(petRef,resp),dataPetRef=petRef,patch({data:resp,isPending:false,isError:false,error:null,isDark:false}),scheduleRemint(petRef,resp.ttlSeconds);return}if(isTerminalPetStateError(res.error)){onTerminalDisabled(petRef,res.error);return}if(patch({isError:true,error:res.error,isPending:snapshot.data===null&&dataPetRef!==petRef}),attempt<2){clearRemint();let backoff=500*(attempt+1),scheduledEpoch=epoch;remintHandle=timers.setTimeout(()=>{remintHandle=null,!(scheduledEpoch!==epoch||currentPetRef!==petRef||!isFocused)&&fetchOnce(petRef,attempt+1)},backoff)}else scheduleRemint(petRef,5)}},onTerminalDark=petRef=>{terminatedPetRef=petRef,warm.delete(petRef),clearRemint(),dataPetRef=petRef,patch({data:null,isPending:false,isError:false,error:null,isDark:true})},onTerminalDisabled=(petRef,error)=>{terminatedPetRef=petRef,warm.delete(petRef),clearRemint(),dataPetRef=petRef,patch({data:null,isPending:false,isError:false,error:error,isDark:true})};return{observe(petRef,opts){let focusChanged=opts.isFocused!==isFocused;if(isFocused=opts.isFocused,petRef!==currentPetRef){if(epoch+=1,inFlight?.abort(),inFlight=null,clearRemint(),terminatedPetRef=null,currentPetRef=petRef,petRef===null){dataPetRef=null,snapshot=EMPTY_SNAPSHOT,emit();return}let warmEntry=warm.get(petRef),fresh=warmEntry&&timers.now()-warmEntry.fetchedAt<staleMs(warmEntry.data)?warmEntry:null;fresh?(touchWarm(petRef),dataPetRef=petRef,patch({data:fresh.data,isPending:false,isError:false,error:null,isDark:false})):patch({isPending:true,isError:false,error:null,isDark:false}),isFocused&&fetchOnce(petRef,0);return}if(!focusChanged||petRef===null)return;if(!isFocused){clearRemint();return}let entry=warm.get(petRef);!entry||timers.now()-entry.fetchedAt>=staleMs(entry.data)?terminatedPetRef!==petRef&&fetchOnce(petRef,0):scheduleRemint(petRef,entry.data.ttlSeconds)},getSnapshot(){return snapshot},subscribe(listener){return listeners.add(listener),()=>{listeners.delete(listener)}},getCachedPetStateMedia(petRef){let entry=warm.get(petRef);return!entry||timers.now()-entry.fetchedAt>=staleMs(entry.data)?null:(touchWarm(petRef),entry.data)},dispose(){epoch+=1,inFlight?.abort(),inFlight=null,clearRemint(),listeners.clear(),warm.clear()}}}function isTerminalPetStateError(error){if(typeof error!="object"||error===null)return false;let record=error,status=typeof record.status=="number"?record.status:record.httpStatus;return status===403||status===404}var noopTelemetry=/* @__PURE__ */Object.freeze({track(){},trackExpectedFailure(){}});function createAnimationController(deps){let telemetry=deps.telemetry??noopTelemetry,timers=deps.timers??defaultTimers(deps.now),store=createPetStateStore({repo:deps.repo,cacheEpoch:createCacheEpochGuard({kv:deps.kv,cache:deps.cache}),timers:timers}),listeners=/* @__PURE__ */new Set,failed=NO_FAILURES,fallbackReason="none",paused=false,photoUrl=null,lastData=null,lastDark=false,dataToken=0,lastShownKey="",view=pendingView(surface()),disposed=false;function surface(){let manifest=deps.manifest?deps.manifest():COMPILED_DEFAULT_MANIFEST;return animationsSurfaceOf(manifest)}let emit=()=>{for(let listener of listeners)listener()},unsubscribeStore=store.subscribe(()=>{onStoreChange()});function onStoreChange(){let snap=store.getSnapshot();(snap.data!==lastData||snap.isDark!==lastDark)&&(lastData=snap.data,lastDark=snap.isDark,failed=NO_FAILURES,fallbackReason=snap.isDark?"dark_or_missing":"none",dataToken+=1),recompute(snap)}function recompute(snap=store.getSnapshot()){let surf=surface(),next=buildView(surf,snap,{failed:failed,fallbackReason:fallbackReason,paused:paused,photoUrl:photoUrl,reducedMotion:deps.reducedMotion()});view=next,maybeEmitShown(next),emit()}function maybeEmitShown(next){if(next.kind!=="ready")return;let key=`${next.category}|${next.tier}|${next.fallbackReason}|${next.reducedMotion?1:0}`;key!==lastShownKey&&(lastShownKey=key,telemetry.track("pet_state_shown",{category:next.category,tier:next.tier,fallback_reason:next.fallbackReason,reduced_motion:next.reducedMotion}),next.fallbackReason==="idle_asset_failed"&&telemetry.trackExpectedFailure("idle_asset_failed",{category:next.category}))}return{observe(petRef,opts){disposed||(photoUrl=opts.photoUrl??null,failed=NO_FAILURES,store.observe(petRef,{isFocused:opts.isFocused}),onStoreChange())},getState(){return view},subscribe(listener){return listeners.add(listener),()=>{listeners.delete(listener)}},onMediaError(){if(disposed||view.kind!=="ready")return;let retired=retireTier(view.tier,failed);failed=retired.failed,fallbackReason=retired.reason,recompute()},setPaused(next){disposed||paused===next||(paused=next,recompute())},dispose(){disposed||(disposed=true,unsubscribeStore(),store.dispose(),listeners.clear())}}}function buildView(surf,snap,inputs){let idleSource=surf.idle;if(!surf.enabled)/* @__PURE__ */
|
|
105
106
|
return Object.freeze({kind:"disabled",reason:userFacingError("accessDenied"),level:"partner_config",source:idleSource,idle:surf.idle});if(snap.isPending&&snap.data===null&&!snap.isDark)/* @__PURE__ */
|
|
106
107
|
return Object.freeze({kind:"pending",showSkeleton:true,source:idleSource});let data=snap.data,category=data?.category??"idle",animation=data?.tiers.animation,image=data?.tiers.image,canAnimate=!!animation&&animation?.kind==="webp"&&!inputs.reducedMotion&&!inputs.failed.animation,tier=selectTier({hasPhoto:inputs.photoUrl!==null&&inputs.photoUrl.length>0,photoFailed:inputs.failed.photo,canAnimate:canAnimate,animationFailed:inputs.failed.animation,hasImage:!!image,imageFailed:inputs.failed.image}),source=idleSource,loopDurationMs=null,cacheHit=false;tier==="photo"&&inputs.photoUrl?source=uriSource(inputs.photoUrl,void 0):tier==="animation"&&animation?(source=uriSource(animation.url,animation.cacheKey),loopDurationMs=animation.loopDurationMs??null,cacheHit=animation.cacheKey!==void 0):tier==="image"&&image&&(source=uriSource(image.url,image.cacheKey),cacheHit=image.cacheKey!==void 0);let recyclingKey=source.kind==="uri"?source.cacheKey:`bundled:${source.id}`;/* @__PURE__ */
|
|
@@ -1,144 +1,20 @@
|
|
|
1
|
+
/*! @everfur/sdk. Copyright (c) 2026 Strand Health Inc. dba Everfur. All rights reserved. Use is subject to the Everfur SDK License: https://docs.everfur.com/license */
|
|
1
2
|
import { ReactNode } from 'react';
|
|
2
3
|
import { StyleProp, ViewStyle } from 'react-native';
|
|
3
4
|
import { P as PetRef, C as ConversationId } from './ids.d-B2GAAifq.js';
|
|
4
5
|
import { i as EverfurPresentationInput } from './presentation.d-vy8kTGfR.js';
|
|
5
|
-
import { a as ChatCheckinTarget } from './ports.d-
|
|
6
|
-
import { W as WidgetPet, P as PetProfileInput } from './petsRepository.d-
|
|
6
|
+
import { a as ChatCheckinTarget } from './ports.d-BxCVSbSi.js';
|
|
7
|
+
import { W as WidgetPet, P as PetProfileInput } from './petsRepository.d-BtuooSOW.js';
|
|
7
8
|
import { E as EverfurStarterPrompt } from './quickPrompts.d-NM_81Jc1.js';
|
|
8
9
|
import { L as LifecyclePort } from './LifecyclePort.d-Cr1p33a7.js';
|
|
9
|
-
import { U as UrgencyDisplayLevel, E as EverfurChatDraftStore } from './attachments.d-
|
|
10
|
+
import { U as UrgencyDisplayLevel, E as EverfurChatDraftStore, b as ChatFollowUpPolicy } from './attachments.d-CB0R1_vK.js';
|
|
10
11
|
import { F as FileHandle } from './ports.d-BX4f4UsB.js';
|
|
12
|
+
import { g as EverfurChatOpeningCard, a as EverfurChatAnswerCards, f as EverfurChatHistorySheet, e as EverfurChatHistoryBar, c as EverfurChatEmptyState } from './threadOptions.d-BerQM1Ql.js';
|
|
13
|
+
import { a as EverfurChatEmptyHeaderContext, b as EverfurChatTopCard } from './threadOptions.d-6hfQS1x7.js';
|
|
11
14
|
|
|
12
15
|
/** Where a picked image comes from: the host's photo library, or its camera. */
|
|
13
16
|
type AttachmentSource = 'photo' | 'camera';
|
|
14
17
|
|
|
15
|
-
/**
|
|
16
|
-
* The history bar: a "Chats" control with the member's thread count that opens the history, and a "New chat"
|
|
17
|
-
* control. For a surface that hides the SDK header and still wants the member's past chats.
|
|
18
|
-
*/
|
|
19
|
-
interface EverfurChatHistoryBar {
|
|
20
|
-
/** The history control's words ("Chats"). */
|
|
21
|
-
readonly chats: string;
|
|
22
|
-
/** The new-chat control's words ("New chat"). */
|
|
23
|
-
readonly newChat: string;
|
|
24
|
-
/** Draw the two icons your way. */
|
|
25
|
-
readonly renderIcon?: (icon: 'history' | 'edit') => ReactNode;
|
|
26
|
-
/** Your own control after "Chats". Absent, nothing is drawn. */
|
|
27
|
-
readonly extra?: ReactNode;
|
|
28
|
-
}
|
|
29
|
-
/** The empty thread's own title and chip fills. Absent, the empty state is Everfur's own. */
|
|
30
|
-
interface EverfurChatEmptyState {
|
|
31
|
-
/** The title over the starter chips, in place of "What can we help {pet} with today?". */
|
|
32
|
-
readonly title?: string;
|
|
33
|
-
/**
|
|
34
|
-
* Fills for the chips that bring none of their own, taken in turn (the first chip the first fill, and round
|
|
35
|
-
* again). Each is a fill and its ink. Absent, Raph's v3 cycle on a light theme; empty, the theme's paint.
|
|
36
|
-
*/
|
|
37
|
-
readonly chipTints?: readonly {
|
|
38
|
-
readonly tint: string;
|
|
39
|
-
readonly ink?: string;
|
|
40
|
-
}[];
|
|
41
|
-
}
|
|
42
|
-
/** One card under an answer in the cards answer style: a record, a stat, or a link to one of your screens. */
|
|
43
|
-
interface EverfurChatAnswerCard {
|
|
44
|
-
/** Stable key within the answer. */
|
|
45
|
-
readonly key: string;
|
|
46
|
-
readonly title: string;
|
|
47
|
-
/** The small line under the title. */
|
|
48
|
-
readonly meta?: string;
|
|
49
|
-
/** A status pill. */
|
|
50
|
-
readonly pill?: {
|
|
51
|
-
readonly label: string;
|
|
52
|
-
readonly tone?: string;
|
|
53
|
-
};
|
|
54
|
-
/** A stat card's value: drawn in place of the pill and the chevron. */
|
|
55
|
-
readonly value?: {
|
|
56
|
-
readonly amount: string;
|
|
57
|
-
readonly unit?: string;
|
|
58
|
-
};
|
|
59
|
-
/** The tile at the start: an icon of yours, or an https image. */
|
|
60
|
-
readonly tile?: {
|
|
61
|
-
readonly icon?: ReactNode;
|
|
62
|
-
readonly imageUrl?: string;
|
|
63
|
-
readonly tone?: string;
|
|
64
|
-
};
|
|
65
|
-
readonly variant?: string;
|
|
66
|
-
/** Given, the card is a button that calls this. Absent, a static card. */
|
|
67
|
-
readonly onPress?: () => void;
|
|
68
|
-
/** A card of your own, drawn in the card's place. If it throws, the slot draws nothing. */
|
|
69
|
-
readonly render?: () => ReactNode;
|
|
70
|
-
}
|
|
71
|
-
/** What `answerCards.cards` receives: the settled answer's text and the question it answered. */
|
|
72
|
-
interface EverfurChatAnswerContext {
|
|
73
|
-
readonly answer: string;
|
|
74
|
-
readonly question: string | null;
|
|
75
|
-
/** The answer's message id, stable for the life of the thread. */
|
|
76
|
-
readonly messageId: string;
|
|
77
|
-
}
|
|
78
|
-
/** The cards answer style's content (used while presentation `chatAnswerStyle` is `cards`). The words are yours. */
|
|
79
|
-
interface EverfurChatAnswerCards {
|
|
80
|
-
/** The line over each answer (an icon and your words). Absent, the assistant's name line. */
|
|
81
|
-
readonly byline?: {
|
|
82
|
-
readonly label: string;
|
|
83
|
-
readonly icon?: ReactNode;
|
|
84
|
-
};
|
|
85
|
-
/** Your cards under a settled answer. A throw draws none. */
|
|
86
|
-
readonly cards?: (context: EverfurChatAnswerContext) => readonly EverfurChatAnswerCard[];
|
|
87
|
-
/** Two feedback chips in place of the footer's thumbs, mapped to thumbs up and thumbs down. */
|
|
88
|
-
readonly feedback?: {
|
|
89
|
-
readonly helpful: string;
|
|
90
|
-
readonly notHelpful: string;
|
|
91
|
-
};
|
|
92
|
-
/** Your own rows at the top of the follow-ups, for the answer it receives. */
|
|
93
|
-
readonly followUpActions?: (context: EverfurChatAnswerContext) => readonly EverfurChatFollowUpAction[];
|
|
94
|
-
/** Draw the chevron your way. Absent, Everfur's glyph. */
|
|
95
|
-
readonly renderIcon?: (icon: 'chevron') => ReactNode;
|
|
96
|
-
}
|
|
97
|
-
/** A row of yours at the top of the follow-ups under an answer. */
|
|
98
|
-
interface EverfurChatFollowUpAction {
|
|
99
|
-
readonly key: string;
|
|
100
|
-
readonly label: string;
|
|
101
|
-
readonly icon?: ReactNode;
|
|
102
|
-
readonly onPress: () => void;
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* The card at the top of the empty thread (presentation `chatTopCard: "focus"`): one finding, in your words, with
|
|
106
|
-
* an action of yours and a question it can ask in the thread. Its close control folds it into a pill.
|
|
107
|
-
*/
|
|
108
|
-
interface EverfurChatTopCard {
|
|
109
|
-
/** The small heading ("Her focus"). */
|
|
110
|
-
readonly kicker: string;
|
|
111
|
-
/** A source badge ("<your brand> results"). */
|
|
112
|
-
readonly badge?: string;
|
|
113
|
-
readonly title: string;
|
|
114
|
-
/** The finding: a bold lead and the rest of the sentence. */
|
|
115
|
-
readonly lead?: string;
|
|
116
|
-
readonly body?: string;
|
|
117
|
-
/** Your action ("See her Health Plan"). */
|
|
118
|
-
readonly action?: {
|
|
119
|
-
readonly label: string;
|
|
120
|
-
readonly onPress: () => void;
|
|
121
|
-
};
|
|
122
|
-
/** A question the card asks in this thread. */
|
|
123
|
-
readonly ask?: {
|
|
124
|
-
readonly label: string;
|
|
125
|
-
readonly prompt: string;
|
|
126
|
-
};
|
|
127
|
-
/** The close control's accessible name. Absent, the shared `Close`. */
|
|
128
|
-
readonly closeLabel?: string;
|
|
129
|
-
/** The pill's words while the card is closed (defaults to `kicker`). */
|
|
130
|
-
readonly pill?: string;
|
|
131
|
-
/** Draw the close glyph your way. */
|
|
132
|
-
readonly renderIcon?: (icon: 'close') => ReactNode;
|
|
133
|
-
}
|
|
134
|
-
/** The history bottom sheet (presentation `chatHistoryStyle: "sheet"`). */
|
|
135
|
-
interface EverfurChatHistorySheet {
|
|
136
|
-
/** The sheet's small title ("Chats with Ask <your brand>"). Absent, Everfur's history heading. */
|
|
137
|
-
readonly title?: string;
|
|
138
|
-
/** Draw the icons your way. */
|
|
139
|
-
readonly renderIcon?: (icon: 'close' | 'chat' | 'edit') => ReactNode;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
18
|
/**
|
|
143
19
|
* The host's image picker for chat attachments. The SDK depends on no picker or camera module: open your own
|
|
144
20
|
* (for example `expo-image-picker`'s `launchImageLibraryAsync({ mediaTypes: ['images'] })`, or your camera
|
|
@@ -154,7 +30,7 @@ interface EverfurChatAttachments {
|
|
|
154
30
|
readonly pick: (source: AttachmentSource) => Promise<FileHandle | readonly FileHandle[] | null>;
|
|
155
31
|
/** The sources to offer, one popover tile each; default `['photo']`. */
|
|
156
32
|
readonly sources?: readonly AttachmentSource[];
|
|
157
|
-
/** Images per message; default
|
|
33
|
+
/** Images per message; default 5, the web composer's and the server's cap. */
|
|
158
34
|
readonly maxPerMessage?: number;
|
|
159
35
|
}
|
|
160
36
|
|
|
@@ -234,10 +110,12 @@ interface EverfurChatProps {
|
|
|
234
110
|
* Your app's lifecycle signals. Everfur has no socket and no polling here, so a message the platform
|
|
235
111
|
* writes into the thread (a follow-up check-in, a reminder) is not visible until something re-reads it.
|
|
236
112
|
* Tell Everfur when your app comes back to the foreground, when connectivity returns and when a push
|
|
237
|
-
* announced a change, and the thread and the unread dot catch up on that signal alone.
|
|
238
|
-
*
|
|
113
|
+
* announced a change, and the thread and the unread dot catch up on that signal alone. Absent, Everfur uses
|
|
114
|
+
* React Native's own signal (AppState returning to `active` from the background; see `createAppStateLifecycle`).
|
|
115
|
+
* Pass your own port to add connectivity or a push announcement, or `null` to turn the re-read off, in which
|
|
116
|
+
* case chat refreshes only when the user does something.
|
|
239
117
|
*/
|
|
240
|
-
readonly lifecycle?: LifecyclePort;
|
|
118
|
+
readonly lifecycle?: LifecyclePort | null;
|
|
241
119
|
/**
|
|
242
120
|
* Your own storage for an unsent draft. Given, what the user typed and did not send survives leaving this
|
|
243
121
|
* screen; absent, the draft lives in memory for as long as the surface is mounted and nowhere else.
|
|
@@ -289,19 +167,47 @@ interface EverfurChatProps {
|
|
|
289
167
|
/**
|
|
290
168
|
* The layout settings (Raph v3): the answer style, the history style, the top card, the composer style and
|
|
291
169
|
* placeholder, the history bar's place, the general banner, the send button, the follow-up count and the upload
|
|
292
|
-
* control. Each also comes from your console
|
|
293
|
-
* unless the console locks it. `attachments` counts
|
|
294
|
-
*
|
|
295
|
-
* content only and never switch a layout on by
|
|
170
|
+
* control, and the microphone (`chatComposerMic`). Each also comes from your console
|
|
171
|
+
* (render_hints.branding.presentation); a field you set here wins unless the console locks it. `attachments` counts
|
|
172
|
+
* as your explicit `chatComposerUpload: true`, `dictation` as your `chatComposerMic` and `followUpPolicy` as your
|
|
173
|
+
* follow-up count. `topCard`, `answerCards` and `historySheet` are content only and never switch a layout on by
|
|
174
|
+
* themselves.
|
|
296
175
|
*/
|
|
297
176
|
readonly presentation?: EverfurPresentationInput;
|
|
177
|
+
/**
|
|
178
|
+
* Voice dictation on the composer (the device's own speech recognizer, no Everfur service). On by default; the
|
|
179
|
+
* control appears only when your app has the optional `expo-speech-recognition` module installed and the device
|
|
180
|
+
* has a recognizer. `false` is the kill switch.
|
|
181
|
+
*/
|
|
182
|
+
readonly dictation?: boolean;
|
|
183
|
+
/**
|
|
184
|
+
* Your own content for the top of the empty thread, above its title and starter chips (for example a card of the
|
|
185
|
+
* pet's top findings). Rendered only while the thread is empty; if it throws, the empty state draws as usual.
|
|
186
|
+
* Absent, the empty state is Everfur's own. It receives `{ ask }`: a row of your card can ask its question in
|
|
187
|
+
* this thread directly, with no screen in between.
|
|
188
|
+
*/
|
|
189
|
+
readonly renderEmptyHeader?: (context: EverfurChatEmptyHeaderContext) => ReactNode;
|
|
190
|
+
/**
|
|
191
|
+
* Your rule for the follow-ups under a reply: how many (exactly, with `fill`), which backend prompts to drop
|
|
192
|
+
* (`exclude`, for example visit or booking prompts you do not offer), your own prompts to top up with, and a
|
|
193
|
+
* visible `label` over them. Absent, at most three of the backend's, as before.
|
|
194
|
+
*/
|
|
195
|
+
readonly followUpPolicy?: ChatFollowUpPolicy;
|
|
196
|
+
/**
|
|
197
|
+
* The card a notification-opened thread starts with: drawn in place of the first bubble while that bubble is
|
|
198
|
+
* `initialAsk`. Pair it with `initialAsk` (the notification's question). Absent, the bubble draws as usual.
|
|
199
|
+
*/
|
|
200
|
+
readonly initialAskCard?: EverfurChatOpeningCard;
|
|
298
201
|
/**
|
|
299
202
|
* The focus card's content (drawn while `chatTopCard` resolves to `focus`). Absent, the card is built from the
|
|
300
203
|
* pet's Health Plan page focus; no page, no focus, a refused read or a page still loading draws no card.
|
|
301
204
|
*/
|
|
302
205
|
readonly topCard?: EverfurChatTopCard;
|
|
303
|
-
/**
|
|
304
|
-
|
|
206
|
+
/**
|
|
207
|
+
* Opens the pet's Health Plan (your tab or screen), called with the pet (the chat's `petRef`, else the provider's
|
|
208
|
+
* active pet): the plan-built focus card's `See her Health Plan` button.
|
|
209
|
+
*/
|
|
210
|
+
readonly onOpenHealthPlan?: (petRef: PetRef | null) => void;
|
|
305
211
|
/** The cards answer style's content (used while `chatAnswerStyle` resolves to `cards`). */
|
|
306
212
|
readonly answerCards?: EverfurChatAnswerCards;
|
|
307
213
|
/** The history sheet's title and icons (used while `chatHistoryStyle` resolves to `sheet`). */
|
|
@@ -319,6 +225,14 @@ interface EverfurChatProps {
|
|
|
319
225
|
* (`historyBar`) is the way into past chats.
|
|
320
226
|
*/
|
|
321
227
|
readonly header?: boolean;
|
|
228
|
+
/**
|
|
229
|
+
* Whether the chat draws its `Turn on SMS Chat` chip for a signed-in member who has not linked a phone number
|
|
230
|
+
* (your tenant grants texting and its `chat_texting_ask` setting is on). The chip opens the number entry in the
|
|
231
|
+
* composer's place whatever the in-chat ask's schedule says, and goes once a number is linked. It sits under the
|
|
232
|
+
* header bar, or, with `header={false}`, on its own row at the top of the thread. Default `true`. Pass `false` to
|
|
233
|
+
* keep only the scheduled line in the thread.
|
|
234
|
+
*/
|
|
235
|
+
readonly textingEntry?: boolean;
|
|
322
236
|
}
|
|
323
237
|
/**
|
|
324
238
|
* Entitlement-gated, four-state chat surface. Entitlement-OFF renders the CapabilityGate OffState;
|
|
@@ -326,4 +240,22 @@ interface EverfurChatProps {
|
|
|
326
240
|
*/
|
|
327
241
|
declare function EverfurChat(props: EverfurChatProps): ReactNode;
|
|
328
242
|
|
|
329
|
-
|
|
243
|
+
/** The host's loader: a thunk that requires the expo-speech-recognition module and returns it. */
|
|
244
|
+
type EverfurDictationLoader = () => unknown;
|
|
245
|
+
/**
|
|
246
|
+
* Turns on the chat composer's microphone on React Native: register the optional `expo-speech-recognition` module's
|
|
247
|
+
* loader once, in your app entry.
|
|
248
|
+
*
|
|
249
|
+
* Pass a thunk that requires the expo-speech-recognition module and returns it; the chat docs ("Dictation") show the
|
|
250
|
+
* exact line.
|
|
251
|
+
*
|
|
252
|
+
* Without it, or where the module has no native side (Expo Go, an older binary), the composer draws no microphone.
|
|
253
|
+
* Passing `null` unregisters it. Registering clears the memo, so a later registration always wins, and a composer
|
|
254
|
+
* already on screen re-reads it (best practice is still to register before the first chat renders).
|
|
255
|
+
*/
|
|
256
|
+
declare function registerEverfurDictation(next: EverfurDictationLoader | null): void;
|
|
257
|
+
|
|
258
|
+
/** The app's foreground edge for EverfurChat: AppState going from `background` back to `active`. */
|
|
259
|
+
declare function createAppStateLifecycle(): LifecyclePort;
|
|
260
|
+
|
|
261
|
+
export { type AttachmentSource as A, EverfurChat as E, type RenderVetAction as R, type EverfurChatAttachments as a, type EverfurChatProps as b, type EverfurDictationLoader as c, createAppStateLifecycle as d, registerEverfurDictation as r };
|