@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
package/dist/texting/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
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 */
|
|
2
|
+
import{createContext,forwardRef,createElement,useMemo,useRef,useEffect,useSyncExternalStore,useCallback,useState,useContext,Component}from"react";import{TextInput as TextInput$1,View,ActivityIndicator,Pressable,StyleSheet,Modal,KeyboardAvoidingView,ScrollView,Platform,Text as Text$1,AccessibilityInfo}from"react-native";import{jsxs,jsx,Fragment}from"react/jsx-runtime";function slotBox(slot,borderWidth){if(slot===void 0)return{};let out={};return slot.backgroundColor!==void 0&&(out.backgroundColor=slot.backgroundColor),slot.borderColor!==void 0&&(out.borderColor=slot.borderColor,out.borderWidth=borderWidth??1),slot.borderRadius!==void 0&&(out.borderRadius=slot.borderRadius),out}function slotText(slot){return slot?.textColor===void 0?{}:{color:slot.textColor}}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]]}}function headingFace(theme,fallback="bold"){let{headingFamily:headingFamily,headingWeight:headingWeight}=theme.type;if(headingFamily===null&&headingWeight===null)return face(theme,fallback);if(headingFamily!==null)return{fontFamily:headingFamily,fontWeight:headingWeight??theme.type.weight[FACE_WEIGHT[fallback]]};let base=face(theme,fallback);return base.fontWeight===void 0||headingWeight===null?base:{fontFamily:base.fontFamily,fontWeight:headingWeight}}function reportHostFailure(error){let globalConsole=globalThis.console;try{globalConsole?.error?.("[everfur] A host callback threw; the SDK ignored it.",error)}catch{}}function isThenable(value){return(typeof value=="object"||typeof value=="function")&&value!==null&&typeof value.then=="function"}function callHost(fn,...args){if(typeof fn=="function")try{let result=fn(...args);return isThenable(result)&&Promise.resolve(result).then(void 0,reportHostFailure),result}catch(error){reportHostFailure(error);return}}var GUARDED=/* @__PURE__ */new WeakMap;function guardHost(fn){if(typeof fn!="function")return;let cached=GUARDED.get(fn);if(cached!==void 0)return cached;let guarded=(...args)=>{callHost(fn,...args)};return GUARDED.set(fn,guarded),guarded}function guardHostProps(props,names){let guarded=null;for(let name of names){let fn=props[name];typeof fn=="function"&&(guarded??={...props},guarded[name]=guardHost(fn))}return guarded??props}var HostRenderBoundary=class extends Component{constructor(){super(...arguments);this.state={failed:false,key:this.props.resetKey}}static getDerivedStateFromError(){return{failed:true}}static getDerivedStateFromProps(props,state2){return Object.is(props.resetKey,state2.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([
|
|
2
3
|
/* @__PURE__ */Object.freeze({wireCode:"AccessDeniedException",envelope:"http_envelope",httpStatus:403,retryable:false}),
|
|
3
4
|
/* @__PURE__ */Object.freeze({wireCode:"AuthorizationException",envelope:"http_envelope",httpStatus:401,retryable:false}),
|
|
4
5
|
/* @__PURE__ */Object.freeze({wireCode:"ConflictException",envelope:"http_envelope",httpStatus:409,retryable:true}),
|
|
@@ -106,12 +107,14 @@ return Object.freeze({challengeId:challengeId,expiresAt:str3(o.expires_at),attem
|
|
|
106
107
|
return Object.freeze({reason:explicit.reason,level:explicit.level,recoverable:explicit.recoverable})}/* @__PURE__ */
|
|
107
108
|
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=useSyncExternalStore(store.subscribe,store.getSnapshot,store.getSnapshot);return 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=useMemo(()=>selectView(decision),[decision]);switch(view){case"enabled":return children;case"pending":return renderPending?/* @__PURE__ */jsx(HostRender,{render:renderPending,fallback:/* @__PURE__ */jsx(PendingSkeleton,{capability:capability,style:style})}):/* @__PURE__ */jsx(PendingSkeleton,{capability:capability,style:style});case"disabled":return renderDisabled?/* @__PURE__ */jsx(HostRender,{render:()=>renderDisabled(decision),fallback:/* @__PURE__ */jsx(OffState,{decision:decision,style:style}),resetKey:decision}):/* @__PURE__ */jsx(OffState,{decision:decision,style:style});default:return assertNever(view)}}function PendingSkeleton({capability:capability,style:style}){let theme=useEverfurTheme(),styles=useMemo(()=>makeStyles(theme),[theme]);/* @__PURE__ */
|
|
108
109
|
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__ */
|
|
109
|
-
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 EverfurTextingOptIn(props){let guarded=guardHostProps(props,["onStatusChange"]),resolved=useMemo(()=>({copy:resolveTextingCopy(props.copy),brandCopy:resolveTextingBrandCopy(props.brandCopy)}),[props.copy,props.brandCopy]),{copy:copy,brandCopy:brandCopy}=resolved,theme=useEverfurTheme(),styles=useMemo(()=>makeStyles2(theme),[theme]),texting=useEverfurTexting();return texting.status==="signedOut"?/* @__PURE__ */jsxs(View,{style:[styles.card,guarded.style],children:[
|
|
110
|
+
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 announceLine(line){if(!(Platform.OS!=="ios"||line===""))try{let announce=AccessibilityInfo?.announceForAccessibility;typeof announce=="function"&&announce.call(AccessibilityInfo,line)}catch{}}function AnnounceLine({line:line}){return useEffect(()=>{announceLine(line)},[line]),null}function EverfurTextingOptIn(props){let guarded=guardHostProps(props,["onStatusChange"]),resolved=useMemo(()=>({copy:resolveTextingCopy(props.copy),brandCopy:resolveTextingBrandCopy(props.brandCopy)}),[props.copy,props.brandCopy]),{copy:copy,brandCopy:brandCopy}=resolved,theme=useEverfurTheme(),styles=useMemo(()=>makeStyles2(theme),[theme]),texting=useEverfurTexting();return texting.status==="signedOut"?/* @__PURE__ */jsxs(View,{style:[styles.card,guarded.style],children:[
|
|
110
111
|
/* @__PURE__ */jsx(Text,{style:styles.title,accessibilityRole:"header",children:brandCopy.introTitle(theme.meta.displayName)}),
|
|
111
112
|
/* @__PURE__ */jsx(Text,{style:styles.body,children:copy.signedOut})]}):/* @__PURE__ */jsx(CapabilityGate,{capability:"texting",...guarded.renderDisabled?{renderDisabled:guarded.renderDisabled}:{},style:guarded.style,children:/* @__PURE__ */jsx(TextingCopyContext.Provider,{value:resolved,children:/* @__PURE__ */jsx(OptInBody,{...guarded,texting:texting,styles:styles})})})}function Button({label:label,onPress:onPress,disabled:disabled=false,busy:busy=false,styles:styles,kind:kind="primary",testID:testID}){let box=kind==="primary"?styles.primary:kind==="secondary"?styles.secondary:styles.link,ink=kind==="primary"?styles.primaryLabel:kind==="secondary"?styles.secondaryLabel:styles.linkLabel;/* @__PURE__ */
|
|
112
|
-
return jsx(Pressable,{onPress:onPress,disabled:disabled||busy,accessibilityRole:"button",accessibilityLabel:label,accessibilityState:{disabled:disabled||busy,busy:busy},style:[box,disabled||busy?styles.dimmed:null],...testID===void 0?{}:{testID:testID},children:/* @__PURE__ */jsx(Text,{tier:"control",style:ink,children:label})})}function OptInBody({texting:texting,styles:styles,onStatusChange:onStatusChange,renderNotice:renderNotice,style:style}){let{copy:copy,brandCopy:brandCopy}=useTextingCopy(),theme=useEverfurTheme(),{status:status,profile:profile,snapshot:snapshot}=texting,brand=profile?.brandName??theme.meta.displayName,[phone,setPhone]=useState(""),[consented,setConsented]=useState(false),[code,setCode]=useState(""),[problem,setProblem]=useState(null),[confirmingOff,setConfirmingOff]=useState(false),[petChoice,setPetChoice]=useState(null),[petSaved,setPetSaved]=useState(false);useEffect(()=>{onStatusChange?.(status)},[onStatusChange,status]),useEffect(()=>{setProblem(null),setConfirmingOff(false)},[status]);let frame=children=>/* @__PURE__ */jsx(View,{style:[styles.card,style],children:children}),notice=(error,onRetry)=>{let line=textingErrorText(error,snapshot.failedAction,snapshot.codeRefusal,copy),support=textingSupportText(error,copy);/* @__PURE__ */
|
|
113
|
+
return jsx(Pressable,{onPress:onPress,disabled:disabled||busy,accessibilityRole:"button",accessibilityLabel:label,accessibilityState:{disabled:disabled||busy,busy:busy},style:[box,disabled||busy?styles.dimmed:null],...testID===void 0?{}:{testID:testID},children:/* @__PURE__ */jsx(Text,{tier:"control",style:ink,children:label})})}function OptInBody({texting:texting,styles:styles,onStatusChange:onStatusChange,renderNotice:renderNotice,style:style}){let{copy:copy,brandCopy:brandCopy}=useTextingCopy(),theme=useEverfurTheme(),{status:status,profile:profile,snapshot:snapshot}=texting,brand=profile?.brandName??theme.meta.displayName,[phone,setPhone]=useState(""),[consented,setConsented]=useState(false),[code,setCode]=useState(""),[problem,setProblem]=useState(null),[confirmingOff,setConfirmingOff]=useState(false),[petChoice,setPetChoice]=useState(null),[petSaved,setPetSaved]=useState(false);useEffect(()=>{onStatusChange?.(status)},[onStatusChange,status]),useEffect(()=>{setProblem(null),setConfirmingOff(false)},[status]);let frame=(children,busy2=false)=>/* @__PURE__ */jsx(View,{style:[styles.card,style],accessibilityState:{busy:busy2},children:children}),notice=(error,onRetry)=>{let line=textingErrorText(error,snapshot.failedAction,snapshot.codeRefusal,copy),support=textingSupportText(error,copy);/* @__PURE__ */
|
|
113
114
|
return jsxs(View,{style:styles.notice,accessibilityLiveRegion:"polite",children:[
|
|
114
|
-
/* @__PURE__ */jsx(HostRender,{resetKey:error,render:()=>renderNotice?renderNotice(error):/* @__PURE__ */jsx(Text,{style:styles.noticeText,children:line}),fallback:/* @__PURE__ */jsx(Text,{style:styles.noticeText,children:line})}),support===null?null:/* @__PURE__ */jsx(Text,{style:styles.footnote,children:support}),onRetry===void 0?null:/* @__PURE__ */jsx(Button,{label:copy.retry,onPress:onRetry,styles:styles,kind:"link"})]})},problemLine=problem===null?null:/* @__PURE__ */
|
|
115
|
+
/* @__PURE__ */jsx(HostRender,{resetKey:error,render:()=>renderNotice?renderNotice(error):/* @__PURE__ */jsx(Text,{style:styles.noticeText,children:line}),fallback:/* @__PURE__ */jsx(Text,{style:styles.noticeText,children:line})}),support===null?null:/* @__PURE__ */jsx(Text,{style:styles.footnote,children:support}),onRetry===void 0?null:/* @__PURE__ */jsx(Button,{label:copy.retry,onPress:onRetry,styles:styles,kind:"link"}),renderNotice?null:/* @__PURE__ */jsx(AnnounceLine,{line:support===null?line:`${line} ${support}`})]})},problemLine=problem===null?null:/* @__PURE__ */jsxs(Fragment,{children:[
|
|
116
|
+
/* @__PURE__ */jsx(Text,{style:styles.noticeText,accessibilityLiveRegion:"polite",children:textingInputProblemText(problem,copy)}),
|
|
117
|
+
/* @__PURE__ */jsx(AnnounceLine,{line:textingInputProblemText(problem,copy)})]});if(status==="unavailable")return frame(
|
|
115
118
|
/* @__PURE__ */jsxs(Fragment,{children:[
|
|
116
119
|
/* @__PURE__ */jsx(Text,{style:styles.title,accessibilityRole:"header",children:copy.unavailableTitle}),
|
|
117
120
|
/* @__PURE__ */jsx(Text,{style:styles.body,children:copy.unavailableBody})]}));if(profile===null)return null;if(status==="loading")/* @__PURE__ */
|
|
@@ -127,7 +130,7 @@ return jsx(View,{style:[styles.card,style],accessible:true,accessibilityRole:"pr
|
|
|
127
130
|
/* @__PURE__ */jsxs(Pressable,{onPress:()=>setConsented(!consented),disabled:busy2,accessibilityRole:"checkbox",accessibilityState:{checked:consented,disabled:busy2},accessibilityLabel:profile.consentText,style:styles.consentRow,testID:"texting-consent",children:[
|
|
128
131
|
/* @__PURE__ */jsx(View,{style:[styles.box,consented?styles.boxChecked:null],accessibilityElementsHidden:true,importantForAccessibility:"no",children:consented?/* @__PURE__ */jsx(Text,{style:styles.tick,children:"✓"}):null}),
|
|
129
132
|
/* @__PURE__ */jsx(Text,{style:styles.consentText,children:profile.consentText})]}),help,problemLine,snapshot.error===null?null:notice(snapshot.error),
|
|
130
|
-
/* @__PURE__ */jsx(Button,{label:busy2?copy.sendingCode:copy.sendCode,busy:busy2,styles:styles,testID:"texting-send",onPress:()=>{let found=validateTextingEnroll(phone,consented);setProblem(found),found===null&&texting.start(phone)}})]}))}if(status==="code"||status==="confirming"||status==="requesting"){let confirming=status==="confirming",resending=status==="requesting",busy2=confirming||resending;return frame(
|
|
133
|
+
/* @__PURE__ */jsx(Button,{label:busy2?copy.sendingCode:copy.sendCode,busy:busy2,styles:styles,testID:"texting-send",onPress:()=>{let found=validateTextingEnroll(phone,consented);setProblem(found),found===null&&texting.start(phone)}})]}),busy2)}if(status==="code"||status==="confirming"||status==="requesting"){let confirming=status==="confirming",resending=status==="requesting",busy2=confirming||resending;return frame(
|
|
131
134
|
/* @__PURE__ */jsxs(Fragment,{children:[
|
|
132
135
|
/* @__PURE__ */jsx(Text,{style:styles.title,accessibilityRole:"header",children:copy.codeTitle}),
|
|
133
136
|
/* @__PURE__ */jsxs(Text,{style:styles.body,children:[copy.codeSentTo," ",formatTextingPhone(snapshot.phoneE164)]}),
|
|
@@ -136,7 +139,7 @@ return jsx(View,{style:[styles.card,style],accessible:true,accessibilityRole:"pr
|
|
|
136
139
|
/* @__PURE__ */jsx(Button,{label:confirming?copy.confirmingCode:copy.confirmCode,busy:confirming,disabled:resending,styles:styles,testID:"texting-confirm",onPress:()=>{let found=validateTextingCode(code);setProblem(found),found===null&&texting.confirm(code)}}),
|
|
137
140
|
/* @__PURE__ */jsxs(View,{style:styles.links,children:[
|
|
138
141
|
/* @__PURE__ */jsx(Button,{label:copy.requestNewCode,kind:"link",disabled:confirming,busy:resending,styles:styles,onPress:()=>{setCode(""),texting.resend()}}),
|
|
139
|
-
/* @__PURE__ */jsx(Button,{label:copy.changeNumber,kind:"link",styles:styles,onPress:()=>{setCode(""),texting.changeNumber()}})]})]}))}if(status==="optedOut")return frame(
|
|
142
|
+
/* @__PURE__ */jsx(Button,{label:copy.changeNumber,kind:"link",styles:styles,onPress:()=>{setCode(""),texting.changeNumber()}})]})]}),busy2)}if(status==="optedOut")return frame(
|
|
140
143
|
/* @__PURE__ */jsxs(Fragment,{children:[
|
|
141
144
|
/* @__PURE__ */jsx(Text,{style:styles.title,accessibilityRole:"header",children:copy.optedOutTitle}),
|
|
142
145
|
/* @__PURE__ */jsx(Text,{style:styles.body,children:textingOptedOutBody(snapshot.identity,brand,copy,brandCopy)}),help,
|
|
@@ -155,11 +158,14 @@ return jsxs(View,{style:styles.petRow,children:[
|
|
|
155
158
|
/* @__PURE__ */jsx(View,{style:styles.chips,accessibilityRole:"radiogroup",accessibilityLabel:copy.defaultPetLabel,children:pets.map(pet=>{let picked=pet.petRef===value;/* @__PURE__ */
|
|
156
159
|
return jsx(Pressable,{onPress:()=>onChoose(pet.petRef),disabled:saving,accessibilityRole:"radio",accessibilityState:{checked:picked,disabled:saving},accessibilityLabel:pet.name??pet.petRef,style:[styles.chip,picked?styles.chipPicked:null],children:/* @__PURE__ */jsx(Text,{tier:"compact",style:[styles.chipLabel,picked?styles.chipLabelPicked:null],children:pet.name??pet.petRef})},pet.petRef)})}),
|
|
157
160
|
/* @__PURE__ */jsxs(View,{style:styles.links,children:[
|
|
158
|
-
/* @__PURE__ */jsx(Button,{label:saving?copy.savingPet:copy.savePet,kind:"secondary",busy:saving,disabled:!changed,styles:styles,onPress:()=>{value!==null&&onSave(value)},testID:"texting-pet-save"}),saved&&!changed?/* @__PURE__ */jsx(Text,{style:styles.footnote,children:copy.petSaved}):null]})]})}function makeStyles2(theme){let{color:color,radius:radius,space:space,type:type,slots:slots}=theme,text3=(size,ink,weight)=>({...face(theme,weight),fontSize:size,lineHeight:Math.round(size*type.lineHeight.snug),color:ink}),cardInk=slots.card?.textColor;return StyleSheet.create({card:{gap:space.md,padding:space.lg,borderRadius:radius.lg,borderWidth:1,borderColor:color.brandBorder,backgroundColor:color.surface,...slotBox(slots.card,1)},title:text3(type.size.subtitle,cardInk??color.text.primary,"bold"),subtitle:text3(type.size.body,cardInk??color.text.primary,"bold"),body:text3(type.size.body,cardInk??color.text.secondary,"regular"),footnote:text3(type.size.caption,color.text.muted,"regular"),phone:text3(type.size.body,cardInk??color.text.primary,"bold"),label:text3(type.size.caption,cardInk??color.text.primary,"bold"),input:{minHeight:44,paddingHorizontal:space.md,borderRadius:radius.md,borderWidth:1,borderColor:color.controlEdge,backgroundColor:color.surface,...text3(type.size.body,color.text.primary,"regular"),...slotBox(slots.input,1),...slotText(slots.input)},consentRow:{flexDirection:"row",alignItems:"flex-start",gap:space.sm,minHeight:44},box:{width:24,height:24,borderRadius:radius.xs,borderWidth:2,borderColor:color.controlEdge,alignItems:"center",justifyContent:"center",backgroundColor:color.surface},boxChecked:{backgroundColor:color.brand,borderColor:color.brandInk},tick:{...text3(type.size.caption,color.text.onBrand,"bold")},consentText:{flex:1,...text3(type.size.caption,cardInk??color.text.secondary,"regular")},primary:{minHeight:44,paddingHorizontal:space.lg,borderRadius:radius.pill,alignItems:"center",justifyContent:"center",backgroundColor:color.brand,...slotBox(slots.primaryButton)},primaryLabel:{...text3(type.size.body,color.text.onBrand,"bold"),...slotText(slots.primaryButton)},secondary:{minHeight:44,paddingHorizontal:space.lg,borderRadius:radius.pill,borderWidth:1,borderColor:color.brandBorder,alignItems:"center",justifyContent:"center",backgroundColor:color.surface},secondaryLabel:text3(type.size.caption,color.brandInk,"bold"),link:{minHeight:44,justifyContent:"center",alignSelf:"flex-start"},linkLabel:{...text3(type.size.caption,color.linkInk,"bold"),...slotText(slots.link)},dimmed:{opacity:.5},links:{flexDirection:"row",flexWrap:"wrap",alignItems:"center",gap:space.md},notice:{gap:space.xs},noticeText:text3(type.size.caption,color.errorRed,"regular"),confirm:{gap:space.sm,padding:space.md,borderRadius:radius.md,backgroundColor:color.surfaceSubtle},petRow:{gap:space.xs},chips:{flexDirection:"row",flexWrap:"wrap",gap:space.sm},chip:{minHeight:44,paddingHorizontal:space.md,borderRadius:radius.pill,borderWidth:1,borderColor:color.brandBorder,backgroundColor:color.surface,justifyContent:"center",...slotBox(slots.chip,1)},chipPicked:{backgroundColor:color.brandSoft,borderColor:color.brandInk},chipLabel:{...text3(type.size.caption,color.text.primary,"regular"),...slotText(slots.chip)},chipLabelPicked:{...face(theme,"bold"),color:color.brandInk}})}var INTRO_OPEN_SYMBOL=/* @__PURE__ */Symbol.for("@everfur/sdk#IntroOpen@v1"),host=globalThis;function isIntroOpenState(value){if(typeof value!="object"||value===null)return false;let v=value;return v.holds instanceof Set&&v.listeners instanceof Set}var stored=host[INTRO_OPEN_SYMBOL],fresh=()=>({holds:/* @__PURE__ */new Set,listeners:/* @__PURE__ */new Set}),state=isIntroOpenState(stored)?stored:host[INTRO_OPEN_SYMBOL]=fresh();function isIntroOpen(){return state.holds.size>0}function subscribe(listener){return state.listeners.add(listener),()=>{state.listeners.delete(listener)}}function useIntroOpen(){return useSyncExternalStore(subscribe,isIntroOpen,isIntroOpen)}function resolveTextingAskDue(input){let readEnabled=input.enabled&&input.capabilityGranted&&input.hasProfile&&input.signedIn&&input.scheduleEligible&&!input.offeredThisSession,due=readEnabled&&input.identity==="none"&&input.surfaceReady;return{readEnabled:readEnabled,due:due}}var URGENT_LEVELS=/* @__PURE__ */new Set(["emergency","schedule_soon"]);function textingAskThreadReady(chat){if(chat.isBootstrapping===true||chat.isLoadingHistory===true||chat.isStreaming===true||chat.status==="error"||chat.stopped===true)return false;let last=chat.messages[chat.messages.length-1];return last===void 0||last.role!=="assistant"||last.pending===true||last.checkin!==void 0||last.text.trim().length===0?false:!(typeof last.urgencyLevel=="string"&&URGENT_LEVELS.has(last.urgencyLevel))}var IN_MEMORY_KVS=/* @__PURE__ */new WeakSet;function isInMemoryKv(kv){return IN_MEMORY_KVS.has(kv)}var TEXTING_ASK_SCHEDULE_KEY="everfur.texting.askSchedule.v1",TEXTING_ASK_SNOOZE_MS=2880*60*1e3,TEXTING_ASK_MAX_ASKS=3,EMPTY_TEXTING_ASK_ENTRY=/* @__PURE__ */Object.freeze({askCount:0,nextAskAt:null,completed:false});function isTextingAskEligible(read,now){if(read.status!=="ok")return false;let{entry:entry}=read;return entry.completed||entry.askCount>=TEXTING_ASK_MAX_ASKS?false:entry.nextAskAt===null||now>=entry.nextAskAt}function applyTextingAsk(entry,now){return{askCount:Math.min(entry.askCount+1,TEXTING_ASK_MAX_ASKS),nextAskAt:now+TEXTING_ASK_SNOOZE_MS,completed:entry.completed}}function applyTextingAskSnooze(entry,now){return{...entry,nextAskAt:now+TEXTING_ASK_SNOOZE_MS}}function applyTextingAskCompleted(entry){return{...entry,completed:true}}function nextTextingAskNumber(entry){return entry.askCount<=0?1:entry.askCount===1?2:3}function entryOf(raw){if(raw===null||typeof raw!="object"||Array.isArray(raw))return null;let o=raw,{askCount:askCount,nextAskAt:nextAskAt,completed:completed}=o;return typeof askCount!="number"||!Number.isInteger(askCount)||askCount<0||nextAskAt!==null&&(typeof nextAskAt!="number"||!Number.isFinite(nextAskAt))||typeof completed!="boolean"?null:{askCount:Math.min(askCount,TEXTING_ASK_MAX_ASKS),nextAskAt:nextAskAt,completed:completed}}function parseTextingAskMap(raw){let value;try{value=JSON.parse(raw)}catch{return null}if(value===null||typeof value!="object"||Array.isArray(value))return null;let out={};for(let[key,item]of Object.entries(value)){let entry=entryOf(item);if(entry===null)return null;out[key]=entry}return out}var SLOT=/* @__PURE__ */Symbol.for("@everfur/sdk/texting/ask-schedule@v1");function shared(){let host2=globalThis,state2=host2[SLOT];return state2===void 0&&(state2={sessions:/* @__PURE__ */new Map,sessionListeners:/* @__PURE__ */new Set,listeners:/* @__PURE__ */new Set,writeChain:Promise.resolve()},host2[SLOT]=state2),state2.sessionListeners===void 0&&(state2.sessionListeners=/* @__PURE__ */new Set),state2}async function load(kv){if(isInMemoryKv(kv))return{status:"unreadable"};let raw;try{raw=await kv.getItem(TEXTING_ASK_SCHEDULE_KEY)}catch{return{status:"unreadable"}}if(raw===null)try{return await kv.setItem(TEXTING_ASK_SCHEDULE_KEY,"{}"),await kv.getItem(TEXTING_ASK_SCHEDULE_KEY)===null?{status:"unreadable"}:{status:"ok",map:{}}}catch{return{status:"unreadable"}}let map=parseTextingAskMap(raw);if(map!==null)return{status:"ok",map:map};try{await kv.removeItem(TEXTING_ASK_SCHEDULE_KEY)}catch{}return{status:"unreadable"}}function subscribeTextingAskSchedule(listener){let{listeners:listeners2}=shared();return listeners2.add(listener),()=>{listeners2.delete(listener)}}function update(kv,userRef,change){let state2=shared(),run=async()=>{let loaded=await load(kv);if(loaded.status!=="ok")return;let current=loaded.map[userRef]??EMPTY_TEXTING_ASK_ENTRY;try{await kv.setItem(TEXTING_ASK_SCHEDULE_KEY,JSON.stringify({...loaded.map,[userRef]:change(current)}))}catch{return}for(let listener of[...state2.listeners])listener()},next=state2.writeChain.then(run,run);return state2.writeChain=next.catch(()=>{}),next}async function readTextingAskSchedule(kv,userRef){let loaded=await load(kv);return loaded.status!=="ok"?{status:"unreadable"}:{status:"ok",entry:loaded.map[userRef]??EMPTY_TEXTING_ASK_ENTRY}}function recordTextingAsk(kv,userRef,now=Date.now()){return update(kv,userRef,entry=>applyTextingAsk(entry,now))}function snoozeTextingAsk(kv,userRef,now=Date.now()){return update(kv,userRef,entry=>applyTextingAskSnooze(entry,now))}function markTextingAskCompleted(kv,userRef){return update(kv,userRef,applyTextingAskCompleted)}function textingAskSession(userRef){return shared().sessions.get(userRef)??null}function setTextingAskSession(userRef,entry){let state2=shared();state2.sessions.set(userRef,entry);for(let listener of[...state2.sessionListeners])listener()}function subscribeTextingAskSessions(listener){let{sessionListeners:sessionListeners}=shared();return sessionListeners.add(listener),()=>{sessionListeners.delete(listener)}}var NO_SNAPSHOT=()=>null;function useTextingGranted(){let{runtime:runtime}=useEverfurContext(),source=runtime.entitlements??null,subscribe2=useCallback(listener=>source===null?()=>{}:source.subscribe(listener),[source]),read=source===null?NO_SNAPSHOT:source.getSnapshot,snapshot=useSyncExternalStore(subscribe2,read,read);return useMemo(()=>snapshot!==null&&decideCapability("texting",snapshot.decisions,{isPending:snapshot.isPending}).enabled,[snapshot])}var IDLE=/* @__PURE__ */Object.freeze({status:"idle"});function useAskSchedule(userRef){let{runtime:runtime}=useEverfurContext(),kv=runtime.registry.services.kv,[state2,setState]=useState({user:null,value:IDLE});return useEffect(()=>{if(userRef===null)return;let live=true,read=()=>{readTextingAskSchedule(kv,userRef).then(value=>{live&&setState({user:userRef,value:{status:"ready",read:value}})})};read();let unsubscribe=subscribeTextingAskSchedule(read);return()=>{live=false,unsubscribe()}},[kv,userRef]),state2.user===userRef?state2.value:IDLE}function identityOf(texting){switch(texting.status){case"enroll":case"requesting":case"code":case"confirming":return"none";case"verified":case"optingOut":case"optedOut":return"exists";default:return"unknown"}}function useTextingAsk(options={}){let enabled=options.enabled!==false,ready=options.ready!==false,surface=options.surface??"prompt",{runtime:runtime,userRef:userRef}=useEverfurContext(),kv=runtime.registry.services.kv,granted=useTextingGranted(),schedule=useAskSchedule(enabled&&userRef!==null?userRef:null),readSession=useCallback(()=>userRef===null?null:textingAskSession(userRef),[userRef]),current=useSyncExternalStore(subscribeTextingAskSessions,readSession,readSession),update2=useCallback(entry=>{userRef!==null&&setTextingAskSession(userRef,entry)},[userRef]),mine=current!==null&¤t.surface===surface,handedOff=current!==null&¤t.fromPrompt===true,stage=mine?current.stage==="handoff"?"hidden":current.stage:surface==="prompt"&&handedOff?"dismissed":"hidden",now=Date.now(),scheduleEligible=schedule.status==="ready"&&isTextingAskEligible(schedule.read,now),[readFor,setReadFor]=useState(null),texting=useTextingState(userRef!==null&&readFor===userRef||stage!=="hidden"||mine),identity=identityOf(texting),{readEnabled:readEnabled,due:due}=resolveTextingAskDue({enabled:enabled,capabilityGranted:granted,hasProfile:texting.profile!==null,signedIn:userRef!==null,scheduleEligible:scheduleEligible,offeredThisSession:current!==null,identity:identity,surfaceReady:ready});useEffect(()=>{readEnabled&&userRef!==null&&setReadFor(userRef)},[readEnabled,userRef]);let askNumber=current?.askNumber??(schedule.status==="ready"&&schedule.read.status==="ok"?nextTextingAskNumber(schedule.read.entry):1);useEffect(()=>{!due||userRef===null||textingAskSession(userRef)!==null||update2({surface:surface,stage:"offered",answered:false,askNumber:askNumber})},[due,userRef,update2,askNumber,surface]),useEffect(()=>{!mine||current.stage!=="handoff"||enabled&&ready&&granted&&texting.profile!==null&&identity==="none"&&update2({...current,stage:"offered"})},[mine,current,enabled,ready,granted,texting.profile,identity,update2]);let completed=schedule.status==="ready"&&schedule.read.status==="ok"&&schedule.read.entry.completed;useEffect(()=>{userRef===null||identity!=="exists"||completed||schedule.status!=="ready"||markTextingAskCompleted(kv,userRef)},[identity,completed,schedule.status,kv,userRef]),useEffect(()=>{mine&¤t.stage==="enrolling"&&texting.status==="verified"&&update2({...current,stage:"verified"})},[mine,current,texting.status,update2]);let answer=useCallback(entry=>userRef===null||entry.answered?entry:(recordTextingAsk(kv,userRef),{...entry,answered:true}),[kv,userRef]),accept=useCallback(()=>{mine&¤t.stage==="offered"&&update2({...current,stage:"enrolling"})},[mine,current,update2]),close=useCallback(()=>{mine&¤t.stage==="enrolling"&&update2({...current,stage:"offered"})},[mine,current,update2]),dismiss=useCallback(()=>{if(!(!mine||current.stage!=="offered"&¤t.stage!=="enrolling")){if(surface==="prompt"){update2({...answer(current),surface:"chat",stage:"handoff",fromPrompt:true});return}current.fromPrompt===true&¤t.answered&&userRef!==null&&snoozeTextingAsk(kv,userRef),update2({...answer(current),stage:"dismissed"})}},[mine,current,surface,update2,answer,kv,userRef]),{start:startCode}=texting,start=useCallback(async phone=>!mine||current.stage!=="enrolling"?false:(current.answered||update2(answer(current)),startCode(phone)),[mine,current,update2,answer,startCode]),brand=texting.profile?.brandName??"";return useMemo(()=>({stage:userRef===null?"hidden":stage,brand:brand,askNumber:askNumber,texting:texting,accept:accept,dismiss:dismiss,close:close,start:start}),[userRef,stage,brand,askNumber,texting,accept,dismiss,close,start])}var ABSOLUTE_FILL=/* @__PURE__ */Object.freeze({position:"absolute",top:0,right:0,bottom:0,left:0});function ChatTextingAskController({enabled:enabled,ready:ready,onAsk:onAsk}){let ask=useTextingAsk({enabled:enabled,ready:ready,surface:"chat"});return useEffect(()=>{callHost(onAsk,ask)},[ask,onAsk]),null}function textingAskLines(ask){return{line:TEXTING_BRAND_COPY.chatAskLine(ask.brand),accept:TEXTING_COPY.promptAccept,dismiss:TEXTING_COPY.promptDismiss,verified:TEXTING_BRAND_COPY.chatAskVerified(ask.brand)}}function ChatTextingAskComposer({ask:ask}){let theme=useEverfurTheme(),styles=useMemo(()=>makeAskStyles(theme),[theme]);/* @__PURE__ */
|
|
159
|
-
return jsx(AskEntry,{ask:ask,styles:styles})}function AskEntry({ask:ask,styles:styles}){let{texting:texting}=ask,{status:status,profile:profile,snapshot:snapshot}=texting,[phone,setPhone]=useState(""),[consented,setConsented]=useState(false),[code,setCode]=useState(""),[problem,setProblem]=useState(null),onNumber=status==="enroll"||status==="requesting"&&!snapshot.resending,onCode=status==="code"||status==="confirming"||status==="requesting";useEffect(()=>{setProblem(null)},[status]);let close=/* @__PURE__ */jsxs(Pressable,{onPress:ask.close,accessibilityRole:"button",accessibilityLabel:TEXTING_COPY.close,hitSlop:8,style:styles.close,testID:"texting-ask-close",children:[
|
|
161
|
+
/* @__PURE__ */jsx(Button,{label:saving?copy.savingPet:copy.savePet,kind:"secondary",busy:saving,disabled:!changed,styles:styles,onPress:()=>{value!==null&&onSave(value)},testID:"texting-pet-save"}),saved&&!changed?/* @__PURE__ */jsx(Text,{style:styles.footnote,children:copy.petSaved}):null]})]})}function makeStyles2(theme){let{color:color,radius:radius,space:space,type:type,slots:slots}=theme,text3=(size,ink,weight)=>({...face(theme,weight),fontSize:size,lineHeight:Math.round(size*type.lineHeight.snug),color:ink}),cardInk=slots.card?.textColor;return StyleSheet.create({card:{gap:space.md,padding:space.lg,borderRadius:radius.lg,borderWidth:1,borderColor:color.brandBorder,backgroundColor:color.surface,...slotBox(slots.card,1)},title:text3(type.size.subtitle,cardInk??color.text.primary,"bold"),subtitle:text3(type.size.body,cardInk??color.text.primary,"bold"),body:text3(type.size.body,cardInk??color.text.secondary,"regular"),footnote:text3(type.size.caption,color.text.muted,"regular"),phone:text3(type.size.body,cardInk??color.text.primary,"bold"),label:text3(type.size.caption,cardInk??color.text.primary,"bold"),input:{minHeight:44,paddingHorizontal:space.md,borderRadius:radius.md,borderWidth:1,borderColor:color.controlEdge,backgroundColor:color.surface,...text3(type.size.body,color.text.primary,"regular"),...slotBox(slots.input,1),...slotText(slots.input)},consentRow:{flexDirection:"row",alignItems:"flex-start",gap:space.sm,minHeight:44},box:{width:24,height:24,borderRadius:radius.xs,borderWidth:2,borderColor:color.controlEdge,alignItems:"center",justifyContent:"center",backgroundColor:color.surface},boxChecked:{backgroundColor:color.brand,borderColor:color.brandInk},tick:{...text3(type.size.caption,color.text.onBrand,"bold")},consentText:{flex:1,...text3(type.size.caption,cardInk??color.text.secondary,"regular")},primary:{minHeight:44,paddingHorizontal:space.lg,borderRadius:radius.pill,alignItems:"center",justifyContent:"center",backgroundColor:color.brand,...slotBox(slots.primaryButton)},primaryLabel:{...text3(type.size.body,color.text.onBrand,"bold"),...slotText(slots.primaryButton)},secondary:{minHeight:44,paddingHorizontal:space.lg,borderRadius:radius.pill,borderWidth:1,borderColor:color.brandBorder,alignItems:"center",justifyContent:"center",backgroundColor:color.surface},secondaryLabel:text3(type.size.caption,color.brandInk,"bold"),link:{minHeight:44,justifyContent:"center",alignSelf:"flex-start"},linkLabel:{...text3(type.size.caption,color.linkInk,"bold"),...slotText(slots.link)},dimmed:{opacity:.5},links:{flexDirection:"row",flexWrap:"wrap",alignItems:"center",gap:space.md},notice:{gap:space.xs},noticeText:text3(type.size.caption,color.errorRed,"regular"),confirm:{gap:space.sm,padding:space.md,borderRadius:radius.md,backgroundColor:color.surfaceSubtle},petRow:{gap:space.xs},chips:{flexDirection:"row",flexWrap:"wrap",gap:space.sm},chip:{minHeight:44,paddingHorizontal:space.md,borderRadius:radius.pill,borderWidth:1,borderColor:color.brandBorder,backgroundColor:color.surface,justifyContent:"center",...slotBox(slots.chip,1)},chipPicked:{backgroundColor:color.brandSoft,borderColor:color.brandInk},chipLabel:{...text3(type.size.caption,color.text.primary,"regular"),...slotText(slots.chip)},chipLabelPicked:{...face(theme,"bold"),color:color.brandInk}})}var INTRO_OPEN_SYMBOL=/* @__PURE__ */Symbol.for("@everfur/sdk#IntroOpen@v1"),host=globalThis;function isIntroOpenState(value){if(typeof value!="object"||value===null)return false;let v=value;return v.holds instanceof Set&&v.listeners instanceof Set}var stored=host[INTRO_OPEN_SYMBOL],fresh=()=>({holds:/* @__PURE__ */new Set,listeners:/* @__PURE__ */new Set}),state=isIntroOpenState(stored)?stored:host[INTRO_OPEN_SYMBOL]=fresh();function isIntroOpen(){return state.holds.size>0}function subscribe(listener){return state.listeners.add(listener),()=>{state.listeners.delete(listener)}}function useIntroOpen(){return useSyncExternalStore(subscribe,isIntroOpen,isIntroOpen)}function resolveTextingAskDue(input){let readEnabled=input.enabled&&input.capabilityGranted&&input.hasProfile&&input.signedIn&&input.scheduleEligible&&!input.offeredThisSession,due=readEnabled&&input.identity==="none"&&input.surfaceReady;return{readEnabled:readEnabled,due:due}}var URGENT_LEVELS=/* @__PURE__ */new Set(["emergency","schedule_soon"]);function textingAskThreadReady(chat){if(chat.isBootstrapping===true||chat.isLoadingHistory===true||chat.isStreaming===true||chat.status==="error"||chat.stopped===true)return false;let last=chat.messages[chat.messages.length-1];return last===void 0||last.role!=="assistant"||last.pending===true||last.checkin!==void 0||last.text.trim().length===0?false:!(typeof last.urgencyLevel=="string"&&URGENT_LEVELS.has(last.urgencyLevel))}var IN_MEMORY_KVS=/* @__PURE__ */new WeakSet;function isInMemoryKv(kv){return IN_MEMORY_KVS.has(kv)}var TEXTING_ASK_SCHEDULE_KEY="everfur.texting.askSchedule.v1",TEXTING_ASK_SNOOZE_MS=2880*60*1e3,TEXTING_ASK_MAX_ASKS=3,EMPTY_TEXTING_ASK_ENTRY=/* @__PURE__ */Object.freeze({askCount:0,nextAskAt:null,completed:false});function isTextingAskEligible(read,now){if(read.status!=="ok")return false;let{entry:entry}=read;return entry.completed||entry.askCount>=TEXTING_ASK_MAX_ASKS?false:entry.nextAskAt===null||now>=entry.nextAskAt}function applyTextingAsk(entry,now){return{askCount:Math.min(entry.askCount+1,TEXTING_ASK_MAX_ASKS),nextAskAt:now+TEXTING_ASK_SNOOZE_MS,completed:entry.completed}}function applyTextingAskSnooze(entry,now){return{...entry,nextAskAt:now+TEXTING_ASK_SNOOZE_MS}}function applyTextingAskCompleted(entry){return{...entry,completed:true}}function nextTextingAskNumber(entry){return entry.askCount<=0?1:entry.askCount===1?2:3}function entryOf(raw){if(raw===null||typeof raw!="object"||Array.isArray(raw))return null;let o=raw,{askCount:askCount,nextAskAt:nextAskAt,completed:completed}=o;return typeof askCount!="number"||!Number.isInteger(askCount)||askCount<0||nextAskAt!==null&&(typeof nextAskAt!="number"||!Number.isFinite(nextAskAt))||typeof completed!="boolean"?null:{askCount:Math.min(askCount,TEXTING_ASK_MAX_ASKS),nextAskAt:nextAskAt,completed:completed}}function parseTextingAskMap(raw){let value;try{value=JSON.parse(raw)}catch{return null}if(value===null||typeof value!="object"||Array.isArray(value))return null;let out={};for(let[key,item]of Object.entries(value)){let entry=entryOf(item);if(entry===null)return null;out[key]=entry}return out}var SLOT=/* @__PURE__ */Symbol.for("@everfur/sdk/texting/ask-schedule@v1");function shared(){let host2=globalThis,state2=host2[SLOT];return state2===void 0&&(state2={sessions:/* @__PURE__ */new Map,sessionListeners:/* @__PURE__ */new Set,listeners:/* @__PURE__ */new Set,writeChain:Promise.resolve()},host2[SLOT]=state2),state2.sessionListeners===void 0&&(state2.sessionListeners=/* @__PURE__ */new Set),state2}async function load(kv){if(isInMemoryKv(kv))return{status:"unreadable"};let raw;try{raw=await kv.getItem(TEXTING_ASK_SCHEDULE_KEY)}catch{return{status:"unreadable"}}if(raw===null)try{return await kv.setItem(TEXTING_ASK_SCHEDULE_KEY,"{}"),await kv.getItem(TEXTING_ASK_SCHEDULE_KEY)===null?{status:"unreadable"}:{status:"ok",map:{}}}catch{return{status:"unreadable"}}let map=parseTextingAskMap(raw);if(map!==null)return{status:"ok",map:map};try{await kv.removeItem(TEXTING_ASK_SCHEDULE_KEY)}catch{}return{status:"unreadable"}}function subscribeTextingAskSchedule(listener){let{listeners:listeners2}=shared();return listeners2.add(listener),()=>{listeners2.delete(listener)}}function update(kv,userRef,change){let state2=shared(),run=async()=>{let loaded=await load(kv);if(loaded.status!=="ok")return;let current=loaded.map[userRef]??EMPTY_TEXTING_ASK_ENTRY;try{await kv.setItem(TEXTING_ASK_SCHEDULE_KEY,JSON.stringify({...loaded.map,[userRef]:change(current)}))}catch{return}for(let listener of[...state2.listeners])listener()},next=state2.writeChain.then(run,run);return state2.writeChain=next.catch(()=>{}),next}async function readTextingAskSchedule(kv,userRef){let loaded=await load(kv);return loaded.status!=="ok"?{status:"unreadable"}:{status:"ok",entry:loaded.map[userRef]??EMPTY_TEXTING_ASK_ENTRY}}function recordTextingAsk(kv,userRef,now=Date.now()){return update(kv,userRef,entry=>applyTextingAsk(entry,now))}function snoozeTextingAsk(kv,userRef,now=Date.now()){return update(kv,userRef,entry=>applyTextingAskSnooze(entry,now))}function markTextingAskCompleted(kv,userRef){return update(kv,userRef,applyTextingAskCompleted)}function textingAskSession(userRef){return shared().sessions.get(userRef)??null}function setTextingAskSession(userRef,entry){let state2=shared();state2.sessions.set(userRef,entry);for(let listener of[...state2.sessionListeners])listener()}function subscribeTextingAskSessions(listener){let{sessionListeners:sessionListeners}=shared();return sessionListeners.add(listener),()=>{sessionListeners.delete(listener)}}var NO_SNAPSHOT=()=>null;function useTextingGranted(){let{runtime:runtime}=useEverfurContext(),source=runtime.entitlements??null,subscribe2=useCallback(listener=>source===null?()=>{}:source.subscribe(listener),[source]),read=source===null?NO_SNAPSHOT:source.getSnapshot,snapshot=useSyncExternalStore(subscribe2,read,read);return useMemo(()=>snapshot!==null&&decideCapability("texting",snapshot.decisions,{isPending:snapshot.isPending}).enabled,[snapshot])}var IDLE=/* @__PURE__ */Object.freeze({status:"idle"});function useAskSchedule(userRef){let{runtime:runtime}=useEverfurContext(),kv=runtime.registry.services.kv,[state2,setState]=useState({user:null,value:IDLE});return useEffect(()=>{if(userRef===null)return;let live=true,read=()=>{readTextingAskSchedule(kv,userRef).then(value=>{live&&setState({user:userRef,value:{status:"ready",read:value}})})};read();let unsubscribe=subscribeTextingAskSchedule(read);return()=>{live=false,unsubscribe()}},[kv,userRef]),state2.user===userRef?state2.value:IDLE}function identityOf(texting){switch(texting.status){case"enroll":case"requesting":case"code":case"confirming":return"none";case"verified":case"optingOut":case"optedOut":return"exists";default:return"unknown"}}function useTextingAsk(options={}){let enabled=options.enabled!==false,ready=options.ready!==false,surface=options.surface??"prompt",entryWanted=options.entry===true,{runtime:runtime,userRef:userRef}=useEverfurContext(),kv=runtime.registry.services.kv,granted=useTextingGranted(),schedule=useAskSchedule(enabled&&userRef!==null?userRef:null),readSession=useCallback(()=>userRef===null?null:textingAskSession(userRef),[userRef]),current=useSyncExternalStore(subscribeTextingAskSessions,readSession,readSession),update2=useCallback(entry=>{userRef!==null&&setTextingAskSession(userRef,entry)},[userRef]),mine=current!==null&¤t.surface===surface,handedOff=current!==null&¤t.fromPrompt===true,stage=mine?current.stage==="handoff"?"hidden":current.stage:surface==="prompt"&&handedOff?"dismissed":"hidden",now=Date.now(),scheduleEligible=schedule.status==="ready"&&isTextingAskEligible(schedule.read,now),[readFor,setReadFor]=useState(null),entryRead=entryWanted&&userRef!==null&&granted,texting=useTextingState(userRef!==null&&readFor===userRef||stage!=="hidden"||mine||entryRead),identity=identityOf(texting),{readEnabled:readEnabled,due:due}=resolveTextingAskDue({enabled:enabled,capabilityGranted:granted,hasProfile:texting.profile!==null,signedIn:userRef!==null,scheduleEligible:scheduleEligible,offeredThisSession:current!==null,identity:identity,surfaceReady:ready});useEffect(()=>{readEnabled&&userRef!==null&&setReadFor(userRef)},[readEnabled,userRef]);let askNumber=current?.askNumber??(schedule.status==="ready"&&schedule.read.status==="ok"?nextTextingAskNumber(schedule.read.entry):1);useEffect(()=>{!due||userRef===null||textingAskSession(userRef)!==null||update2({surface:surface,stage:"offered",answered:false,askNumber:askNumber})},[due,userRef,update2,askNumber,surface]),useEffect(()=>{!mine||current.stage!=="handoff"||enabled&&ready&&granted&&texting.profile!==null&&identity==="none"&&update2({...current,stage:"offered"})},[mine,current,enabled,ready,granted,texting.profile,identity,update2]);let completed=schedule.status==="ready"&&schedule.read.status==="ok"&&schedule.read.entry.completed;useEffect(()=>{userRef===null||identity!=="exists"||completed||schedule.status!=="ready"||markTextingAskCompleted(kv,userRef)},[identity,completed,schedule.status,kv,userRef]),useEffect(()=>{mine&¤t.stage==="enrolling"&&texting.status==="verified"&&update2({...current,stage:"verified"})},[mine,current,texting.status,update2]);let answer=useCallback(entry=>userRef===null||entry.answered?entry:(recordTextingAsk(kv,userRef),{...entry,answered:true}),[kv,userRef]),accept=useCallback(()=>{mine&¤t.stage==="offered"&&update2({...current,stage:"enrolling"})},[mine,current,update2]),close=useCallback(()=>{if(!mine||current.stage!=="enrolling")return;let{back:back,...rest}=current;update2({...rest,stage:back??"offered"})},[mine,current,update2]),dismiss=useCallback(()=>{if(!(!mine||current.stage!=="offered"&¤t.stage!=="enrolling")){if(surface==="prompt"){update2({...answer(current),surface:"chat",stage:"handoff",fromPrompt:true});return}current.fromPrompt===true&¤t.answered&&userRef!==null&&snoozeTextingAsk(kv,userRef),update2({...answer(current),stage:"dismissed"})}},[mine,current,surface,update2,answer,kv,userRef]),{start:startCode}=texting,start=useCallback(async phone=>!mine||current.stage!=="enrolling"?false:(current.answered||update2(answer(current)),startCode(phone)),[mine,current,update2,answer,startCode]),canOpen=entryRead&&texting.profile!==null&&identity==="none"&&stage!=="enrolling"&&stage!=="verified",open=useCallback(()=>{if(!canOpen||userRef===null)return;let was=mine?current:null;update2({surface:surface,stage:"enrolling",answered:was?.answered??false,askNumber:current?.askNumber??askNumber,...was?.fromPrompt===true?{fromPrompt:true}:{},back:was?.stage==="offered"?"offered":"dismissed"})},[canOpen,userRef,mine,current,update2,surface,askNumber]),brand=texting.profile?.brandName??"";return useMemo(()=>({stage:userRef===null?"hidden":stage,brand:brand,askNumber:askNumber,texting:texting,accept:accept,dismiss:dismiss,close:close,start:start,canOpen:canOpen,open:open}),[userRef,stage,brand,askNumber,texting,accept,dismiss,close,start,canOpen,open])}var ABSOLUTE_FILL=/* @__PURE__ */Object.freeze({position:"absolute",top:0,right:0,bottom:0,left:0});function ChatTextingAskController({enabled:enabled,ready:ready,onAsk:onAsk,entry:entry=false}){let ask=useTextingAsk({enabled:enabled,ready:ready,surface:"chat",entry:entry});return useEffect(()=>{callHost(onAsk,ask)},[ask,onAsk]),null}function textingAskLines(ask){return{line:TEXTING_BRAND_COPY.chatAskLine(ask.brand),accept:TEXTING_COPY.promptAccept,dismiss:TEXTING_COPY.promptDismiss,verified:TEXTING_BRAND_COPY.chatAskVerified(ask.brand)}}function ChatTextingAskComposer({ask:ask}){let theme=useEverfurTheme(),styles=useMemo(()=>makeAskStyles(theme),[theme]);/* @__PURE__ */
|
|
162
|
+
return jsx(AskEntry,{ask:ask,styles:styles})}function AskEntry({ask:ask,styles:styles}){let{texting:texting}=ask,{status:status,profile:profile,snapshot:snapshot}=texting,[phone,setPhone]=useState(""),[consented,setConsented]=useState(false),[code,setCode]=useState(""),[problem,setProblem]=useState(null),[fieldFocused,setFieldFocused]=useState(false),fieldFocus={onFocus:()=>setFieldFocused(true),onBlur:()=>setFieldFocused(false)},pill=fieldFocused?[styles.pill,styles.pillFocused]:styles.pill,onNumber=status==="enroll"||status==="requesting"&&!snapshot.resending,onCode=status==="code"||status==="confirming"||status==="requesting",phoneRef=useRef(null),codeRef=useRef(null),numberReady=status==="enroll",codeReady=status==="code";useEffect(()=>{setProblem(null)},[status]),useEffect(()=>{numberReady?phoneRef.current?.focus():codeReady&&codeRef.current?.focus()},[numberReady,codeReady]);let close=/* @__PURE__ */jsxs(Pressable,{onPress:ask.close,accessibilityRole:"button",accessibilityLabel:TEXTING_COPY.close,hitSlop:8,style:styles.close,testID:"texting-ask-close",children:[
|
|
160
163
|
/* @__PURE__ */jsx(View,{style:[styles.closeBar,styles.closeBarA]}),
|
|
161
|
-
/* @__PURE__ */jsx(View,{style:[styles.closeBar,styles.closeBarB]})]}),
|
|
162
|
-
/* @__PURE__ */jsx(Text,{style:styles.noticeText,children:
|
|
164
|
+
/* @__PURE__ */jsx(View,{style:[styles.closeBar,styles.closeBarB]})]}),refusalLine=snapshot.error===null?null:textingErrorText(snapshot.error,snapshot.failedAction,snapshot.codeRefusal),supportLine=snapshot.error===null?null:textingSupportText(snapshot.error),refusal=refusalLine===null?null:/* @__PURE__ */jsxs(View,{style:styles.notice,accessibilityRole:"alert",accessibilityLiveRegion:"polite",children:[
|
|
165
|
+
/* @__PURE__ */jsx(Text,{style:styles.noticeText,children:refusalLine}),supportLine===null?null:/* @__PURE__ */jsx(Text,{style:styles.footnote,children:supportLine}),
|
|
166
|
+
/* @__PURE__ */jsx(AnnounceLine,{line:supportLine===null?refusalLine:`${refusalLine} ${supportLine}`})]}),inputProblem=problem===null?null:/* @__PURE__ */jsxs(Fragment,{children:[
|
|
167
|
+
/* @__PURE__ */jsx(Text,{style:styles.noticeText,accessibilityRole:"alert",accessibilityLiveRegion:"polite",children:textingInputProblemText(problem)}),
|
|
168
|
+
/* @__PURE__ */jsx(AnnounceLine,{line:textingInputProblemText(problem)})]});if(profile===null)return null;if(status==="loading"||status==="failed"||status==="signedOut"||status==="unavailable")/* @__PURE__ */
|
|
163
169
|
return jsx(View,{style:styles.root,testID:"texting-ask-entry",accessibilityState:{busy:status==="loading"},children:/* @__PURE__ */jsxs(View,{style:styles.head,children:[
|
|
164
170
|
/* @__PURE__ */jsx(View,{style:styles.headBody,children:status==="failed"?refusal:null}),close]})});if(onNumber){let busy=status==="requesting",submit=()=>{let found=validateTextingEnroll(phone,consented);setProblem(found),found===null&&ask.start(phone)};/* @__PURE__ */
|
|
165
171
|
return jsxs(View,{style:styles.root,testID:"texting-ask-phone",children:[
|
|
@@ -168,8 +174,8 @@ return jsxs(View,{style:styles.root,testID:"texting-ask-phone",children:[
|
|
|
168
174
|
/* @__PURE__ */jsxs(Pressable,{onPress:()=>setConsented(!consented),disabled:busy,accessibilityRole:"checkbox",accessibilityState:{checked:consented,disabled:busy},accessibilityLabel:profile.consentText,style:styles.consentRow,testID:"texting-ask-consent",children:[
|
|
169
175
|
/* @__PURE__ */jsx(View,{style:[styles.box,consented?styles.boxChecked:null],accessibilityElementsHidden:true,importantForAccessibility:"no",children:consented?/* @__PURE__ */jsx(Text,{style:styles.tick,children:"✓"}):null}),
|
|
170
176
|
/* @__PURE__ */jsx(Text,{style:styles.consentText,children:profile.consentText})]}),profile.helpContact===null?null:/* @__PURE__ */jsxs(Text,{style:styles.footnote,children:[TEXTING_COPY.helpContactLabel," ",profile.helpContact]})]}),close]}),inputProblem,refusal,
|
|
171
|
-
/* @__PURE__ */jsxs(View,{style:
|
|
172
|
-
/* @__PURE__ */jsx(TextInput,{value:phone,onChangeText:setPhone,editable:!busy,
|
|
177
|
+
/* @__PURE__ */jsxs(View,{style:pill,children:[
|
|
178
|
+
/* @__PURE__ */jsx(TextInput,{value:phone,onChangeText:setPhone,editable:!busy,keyboardType:"phone-pad",textContentType:"telephoneNumber",autoComplete:"tel",accessibilityLabel:TEXTING_COPY.phoneLabel,placeholder:TEXTING_COPY.phoneLabel,placeholderTextColor:styles.placeholder.color,ref:phoneRef,onSubmitEditing:submit,...fieldFocus,style:styles.field,testID:"texting-ask-phone-input"},"phone"),
|
|
173
179
|
/* @__PURE__ */jsx(Pressable,{onPress:submit,disabled:busy,accessibilityRole:"button",accessibilityLabel:busy?TEXTING_COPY.sendingCode:TEXTING_COPY.sendCode,accessibilityState:{disabled:busy,busy:busy},style:[styles.primary,busy?styles.dimmed:null],testID:"texting-ask-send",children:/* @__PURE__ */jsx(Text,{tier:"control",style:styles.primaryLabel,children:busy?TEXTING_COPY.sendingCode:TEXTING_COPY.sendCode})})]})]})}if(onCode){let confirming=status==="confirming",resending=status==="requesting",busy=confirming||resending,submit=()=>{let found=validateTextingCode(code);setProblem(found),found===null&&texting.confirm(code)};/* @__PURE__ */
|
|
174
180
|
return jsxs(View,{style:styles.root,testID:"texting-ask-code",children:[
|
|
175
181
|
/* @__PURE__ */jsxs(View,{style:styles.head,children:[
|
|
@@ -178,16 +184,16 @@ return jsxs(View,{style:styles.root,testID:"texting-ask-code",children:[
|
|
|
178
184
|
/* @__PURE__ */jsxs(View,{style:styles.links,children:[
|
|
179
185
|
/* @__PURE__ */jsx(Pressable,{onPress:()=>{setCode(""),texting.resend()},disabled:busy,accessibilityRole:"button",accessibilityState:{disabled:busy,busy:resending},style:[styles.link,busy?styles.dimmed:null],children:/* @__PURE__ */jsx(Text,{style:styles.linkLabel,children:TEXTING_COPY.requestNewCode})}),
|
|
180
186
|
/* @__PURE__ */jsx(Pressable,{onPress:()=>{setCode(""),texting.changeNumber()},disabled:busy,accessibilityRole:"button",accessibilityState:{disabled:busy},style:[styles.link,busy?styles.dimmed:null],children:/* @__PURE__ */jsx(Text,{style:styles.linkLabel,children:TEXTING_COPY.changeNumber})})]})]}),close]}),inputProblem,refusal,
|
|
181
|
-
/* @__PURE__ */jsxs(View,{style:
|
|
182
|
-
/* @__PURE__ */jsx(TextInput,{value:code,onChangeText:value=>setCode(value.replace(/\D/g,"")),editable:!busy,
|
|
183
|
-
/* @__PURE__ */jsx(Pressable,{onPress:submit,disabled:busy,accessibilityRole:"button",accessibilityLabel:confirming?TEXTING_COPY.confirmingCode:TEXTING_COPY.confirmCode,accessibilityState:{disabled:busy,busy:confirming},style:[styles.primary,busy?styles.dimmed:null],testID:"texting-ask-confirm",children:/* @__PURE__ */jsx(Text,{tier:"control",style:styles.primaryLabel,children:confirming?TEXTING_COPY.confirmingCode:TEXTING_COPY.confirmCode})})]})]})}return null}function makeAskStyles(theme){let{color:color,radius:radius,space:space,type:type,slots:slots}=theme,text3=(size,ink,weight)=>({...face(theme,weight),fontSize:size,lineHeight:Math.round(size*type.lineHeight.snug),color:ink});return StyleSheet.create({root:{gap:space.sm,width:"100%"},head:{flexDirection:"row",alignItems:"flex-start",gap:space.sm},headBody:{flex:1,minWidth:0,gap:space.xs},consentRow:{flexDirection:"row",alignItems:"flex-start",gap:space.sm,minHeight:44},box:{width:24,height:24,borderRadius:radius.xs,borderWidth:2,borderColor:color.controlEdge,alignItems:"center",justifyContent:"center",backgroundColor:color.surface},boxChecked:{backgroundColor:color.brand,borderColor:color.brandInk},tick:text3(type.size.caption,color.text.onBrand,"bold"),consentText:{flex:1,...text3(type.size.caption,color.text.secondary,"regular")},body:text3(type.size.body,color.text.primary,"regular"),footnote:text3(type.size.caption,color.text.muted,"regular"),pill:{flexDirection:"row",alignItems:"center",gap:space.xs,minHeight:50,paddingVertical:space.xs,paddingLeft:space.md,paddingRight:space.xs,borderRadius:radius.pill,borderWidth:1.5,borderColor:color.controlEdge,backgroundColor:color.surface,...slotBox(slots.input,1)},field:{flex:1,minWidth:0,minHeight:44,padding:0,...text3(type.size.body,color.text.primary,"regular"),...slotText(slots.input)},digits:{fontVariant:["tabular-nums"]},primary:{minHeight:
|
|
184
|
-
return jsx(Modal,{transparent:true,visible:true,animationType:theme.motion.reducedMotion?"none":"fade",onRequestClose:finish,children:/* @__PURE__ */jsxs(
|
|
187
|
+
/* @__PURE__ */jsxs(View,{style:pill,children:[
|
|
188
|
+
/* @__PURE__ */jsx(TextInput,{value:code,onChangeText:value=>setCode(value.replace(/\D/g,"")),editable:!busy,keyboardType:"number-pad",textContentType:"oneTimeCode",autoComplete:"sms-otp",maxLength:6,accessibilityLabel:TEXTING_COPY.codeLabel,placeholder:TEXTING_COPY.codeLabel,placeholderTextColor:styles.placeholder.color,ref:codeRef,onSubmitEditing:submit,...fieldFocus,style:[styles.field,styles.digits],testID:"texting-ask-code-input"},"code"),
|
|
189
|
+
/* @__PURE__ */jsx(Pressable,{onPress:submit,disabled:busy,accessibilityRole:"button",accessibilityLabel:confirming?TEXTING_COPY.confirmingCode:TEXTING_COPY.confirmCode,accessibilityState:{disabled:busy,busy:confirming},style:[styles.primary,busy?styles.dimmed:null],testID:"texting-ask-confirm",children:/* @__PURE__ */jsx(Text,{tier:"control",style:styles.primaryLabel,children:confirming?TEXTING_COPY.confirmingCode:TEXTING_COPY.confirmCode})})]})]})}return null}function makeAskStyles(theme,align="auto"){let{color:color,radius:radius,space:space,type:type,slots:slots}=theme,text3=(size,ink,weight)=>({...face(theme,weight),fontSize:size,lineHeight:Math.round(size*type.lineHeight.snug),color:ink}),words={textAlign:align};return StyleSheet.create({root:{gap:space.sm,width:"100%"},head:{flexDirection:"row",alignItems:"flex-start",gap:space.sm},headBody:{flex:1,minWidth:0,gap:space.xs},consentRow:{flexDirection:"row",alignItems:"flex-start",gap:space.sm,minHeight:44},box:{width:24,height:24,borderRadius:radius.xs,borderWidth:2,borderColor:color.controlEdge,alignItems:"center",justifyContent:"center",backgroundColor:color.surface},boxChecked:{backgroundColor:color.brand,borderColor:color.brandInk},tick:text3(type.size.caption,color.text.onBrand,"bold"),consentText:{...align==="center"?{flexShrink:1}:{flex:1},...text3(type.size.caption,color.text.secondary,"regular"),...words},body:{...text3(type.size.body,color.text.primary,"regular"),...words},footnote:{...text3(type.size.caption,color.text.muted,"regular"),...words},placeholder:{color:color.text.placeholder},pill:{flexDirection:"row",alignItems:"center",gap:space.xs,minHeight:50,paddingVertical:space.xs,paddingLeft:space.md,paddingRight:space.xs,borderRadius:radius.pill,borderWidth:1.5,borderColor:color.controlEdge,backgroundColor:color.surface,...slotBox(slots.input,1)},pillFocused:{borderWidth:1.5,borderColor:slots.input?.borderColor??color.brandInk},field:{flex:1,minWidth:0,minHeight:44,padding:0,...text3(type.size.body,color.text.primary,"regular"),...slotText(slots.input)},digits:{fontVariant:["tabular-nums"]},primary:{minHeight:44,paddingHorizontal:space.lg,borderRadius:radius.pill,alignItems:"center",justifyContent:"center",backgroundColor:color.brand,...slotBox(slots.primaryButton)},primaryLabel:{...text3(type.size.caption,color.text.onBrand,"bold"),...slotText(slots.primaryButton)},dimmed:{opacity:.5},close:{width:44,height:44,alignItems:"center",justifyContent:"center"},closeBar:{position:"absolute",width:18,height:2,borderRadius:1,backgroundColor:color.text.muted},closeBarA:{transform:[{rotate:"45deg"}]},closeBarB:{transform:[{rotate:"-45deg"}]},links:{flexDirection:"row",flexWrap:"wrap",alignItems:"center",gap:space.md},link:{minHeight:44,justifyContent:"center"},linkLabel:{...text3(type.size.caption,color.linkInk,"bold"),...slotText(slots.link)},notice:{gap:space.xs},noticeText:{...text3(type.size.caption,color.errorRed,"regular"),...words}})}var ORIENTATIONS=["portrait","landscape"],OPEN=/* @__PURE__ */new Set(["offered","enrolling"]);function EverfurTextingPrompt({onResolved:onResolved}){let introOpen=useIntroOpen(),ask=useTextingAsk({surface:"prompt",ready:!introOpen}),theme=useEverfurTheme(),styles=useMemo(()=>makePromptStyles(theme),[theme]),entryStyles=useMemo(()=>makeAskStyles(theme,"center"),[theme]),shown=useRef(false),[resolved,setResolved]=useState(false);OPEN.has(ask.stage)&&(shown.current=true);let open=shown.current&&(OPEN.has(ask.stage)||ask.stage==="verified")&&!resolved&&!introOpen,finish=()=>{resolved||(ask.stage==="verified"?(setResolved(true),callHost(onResolved,"verified")):ask.dismiss())};if(useEffect(()=>{shown.current&&ask.stage==="dismissed"&&!resolved&&(setResolved(true),callHost(onResolved,"dismissed"))},[ask.stage,onResolved,resolved]),!open)return null;let title=ask.stage==="verified"?TEXTING_COPY.verifiedTitle:TEXTING_BRAND_COPY.promptTitle(ask.brand);/* @__PURE__ */
|
|
190
|
+
return jsx(Modal,{transparent:true,visible:true,animationType:theme.motion.reducedMotion?"none":"fade",statusBarTranslucent:true,supportedOrientations:ORIENTATIONS,onRequestClose:finish,children:/* @__PURE__ */jsxs(KeyboardAvoidingView,{behavior:Platform.OS==="ios"?"padding":"height",style:styles.backdrop,children:[
|
|
185
191
|
/* @__PURE__ */jsx(Pressable,{style:ABSOLUTE_FILL,accessibilityRole:"button",accessibilityLabel:TEXTING_COPY.close,onPress:finish}),
|
|
186
|
-
/* @__PURE__ */
|
|
192
|
+
/* @__PURE__ */jsx(View,{style:styles.sheet,accessibilityViewIsModal:true,testID:"everfur-texting-prompt",children:/* @__PURE__ */jsxs(ScrollView,{style:styles.scroller,contentContainerStyle:styles.sheetBody,keyboardShouldPersistTaps:"handled",bounces:false,testID:"everfur-texting-prompt-scroll",children:[
|
|
187
193
|
/* @__PURE__ */jsx(Text,{style:styles.title,accessibilityRole:"header",children:title}),ask.stage==="offered"?/* @__PURE__ */jsxs(Fragment,{children:[
|
|
188
194
|
/* @__PURE__ */jsx(Text,{style:styles.body,children:TEXTING_COPY.promptBody}),
|
|
189
195
|
/* @__PURE__ */jsxs(View,{style:styles.actions,children:[
|
|
190
196
|
/* @__PURE__ */jsx(Pressable,{onPress:ask.accept,accessibilityRole:"button",accessibilityLabel:TEXTING_COPY.promptAccept,style:styles.primary,testID:"texting-prompt-accept",children:/* @__PURE__ */jsx(Text,{tier:"control",style:styles.primaryLabel,children:TEXTING_COPY.promptAccept})}),
|
|
191
197
|
/* @__PURE__ */jsx(Pressable,{onPress:ask.dismiss,accessibilityRole:"button",accessibilityLabel:TEXTING_COPY.promptDismiss,style:styles.secondary,testID:"texting-prompt-dismiss",children:/* @__PURE__ */jsx(Text,{tier:"control",style:styles.secondaryLabel,children:TEXTING_COPY.promptDismiss})})]})]}):null,ask.stage==="enrolling"?/* @__PURE__ */jsx(AskEntry,{ask:ask,styles:entryStyles}):null,ask.stage==="verified"?/* @__PURE__ */jsxs(Fragment,{children:[
|
|
192
198
|
/* @__PURE__ */jsx(Text,{style:styles.body,children:TEXTING_BRAND_COPY.chatAskVerified(ask.brand)}),
|
|
193
|
-
/* @__PURE__ */jsx(View,{style:styles.actions,children:/* @__PURE__ */jsx(Pressable,{onPress:finish,accessibilityRole:"button",accessibilityLabel:TEXTING_COPY.close,style:styles.secondary,testID:"texting-prompt-close",children:/* @__PURE__ */jsx(Text,{tier:"control",style:styles.secondaryLabel,children:TEXTING_COPY.close})})})]}):null]})]})})}function makePromptStyles(theme){let{color:color,radius:radius,space:space,type:type,slots:slots}=theme,dialogText=slotText(slots.dialog),text3=(size,ink,weight)=>({...face(theme,weight),fontSize:size,lineHeight:Math.round(size*type.lineHeight.normal),color:ink}),button={minHeight:48,paddingHorizontal:space.lg,borderRadius:radius.pill,alignItems:"center",justifyContent:"center"};return StyleSheet.create({backdrop:{flex:1,justifyContent:"center",paddingHorizontal:space.lg,backgroundColor:"rgba(0,0,0,0.4)"},sheet:{width:"100%",maxWidth:480,alignSelf:"center",backgroundColor:color.surface,borderRadius:radius.xl,paddingHorizontal:space.lg,paddingTop:space.xl,paddingBottom:space.lg,
|
|
199
|
+
/* @__PURE__ */jsx(View,{style:styles.actions,children:/* @__PURE__ */jsx(Pressable,{onPress:finish,accessibilityRole:"button",accessibilityLabel:TEXTING_COPY.close,style:styles.secondary,testID:"texting-prompt-close",children:/* @__PURE__ */jsx(Text,{tier:"control",style:styles.secondaryLabel,children:TEXTING_COPY.close})})})]}):null]})})]})})}function makePromptStyles(theme){let{color:color,radius:radius,space:space,type:type,slots:slots}=theme,dialogText=slotText(slots.dialog),text3=(size,ink,weight)=>({...face(theme,weight),fontSize:size,lineHeight:Math.round(size*type.lineHeight.normal),color:ink}),button={minHeight:48,paddingHorizontal:space.lg,borderRadius:radius.pill,alignItems:"center",justifyContent:"center"};return StyleSheet.create({backdrop:{flex:1,justifyContent:"center",paddingHorizontal:space.lg,backgroundColor:"rgba(0,0,0,0.4)"},sheet:{width:"100%",maxWidth:480,alignSelf:"center",backgroundColor:color.surface,borderRadius:radius.xl,maxHeight:"88%",overflow:"hidden",...slotBox(slots.dialog)},scroller:{flexGrow:0,flexShrink:1},sheetBody:{paddingHorizontal:space.lg,paddingTop:space.xl,paddingBottom:space.lg,gap:space.md},title:{...text3(type.size.heading,color.text.primary,"bold"),...headingFace(theme,"bold"),textAlign:"center",...dialogText},body:{...text3(type.size.body,color.text.secondary,"regular"),textAlign:"center",...dialogText},actions:{gap:space.xs},primary:{...button,backgroundColor:color.brand,...slotBox(slots.primaryButton)},primaryLabel:{...text3(type.size.body,color.text.onBrand,"bold"),...slotText(slots.primaryButton)},secondary:button,secondaryLabel:text3(type.size.body,color.text.muted,"bold")})}export{COPY_PLACEHOLDER_PREFIX,ChatTextingAskComposer,ChatTextingAskController,EVERFUR_TEXTING_STATUSES,EverfurTextingOptIn,EverfurTextingPrompt,TEXTING_ASK_MAX_ASKS,TEXTING_ASK_SCHEDULE_KEY,TEXTING_ASK_SNOOZE_MS,TEXTING_BRAND_COPY,TEXTING_CODE_PATTERN,TEXTING_COPY,TEXTING_COPY_PLACEHOLDERS,TEXTING_UI_CODE_LENGTH,TextingController,createTextingRepository,createTextingRepositoryOver,formatTextingPhone,isE164,isTextingAskEligible,parseTextingProfile,resolveTextingAskDue,textingAskLines,textingAskThreadReady,textingErrorText,textingIdentityFromWire,textingInputProblemText,textingOptedOutBody,textingReasonOf,textingSupportText,toTextingE164,useEverfurTexting,useEverfurTextingProfile,useEverfurTextingRepository,useTextingAsk,validateTextingCode,validateTextingEnroll};
|
|
@@ -0,0 +1,55 @@
|
|
|
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 */
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
/** What `renderEmptyHeader` receives: ask a question in this thread, with no screen in between. */
|
|
5
|
+
interface EverfurChatEmptyHeaderContext {
|
|
6
|
+
/** Send `prompt` as the member's next message in the open thread (the same path as a starter chip). */
|
|
7
|
+
ask(prompt: string): void;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* The card a thread opened from a notification starts with, in place of the member's first bubble: drawn while
|
|
11
|
+
* the first message of the open thread is the surface's `initialAsk`.
|
|
12
|
+
*/
|
|
13
|
+
interface EverfurChatOpeningCard {
|
|
14
|
+
/** The line over the title ("Notification · 9:41 AM"). */
|
|
15
|
+
readonly kicker: string;
|
|
16
|
+
readonly title: string;
|
|
17
|
+
readonly body?: string;
|
|
18
|
+
/** The brand mark in the card's corner. */
|
|
19
|
+
readonly icon?: ReactNode;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* The card at the top of the empty thread (presentation `chatTopCard: "focus"`): one finding, in your words, with
|
|
23
|
+
* an action of yours and a question it can ask in the thread. Its close control folds it into a pill.
|
|
24
|
+
*/
|
|
25
|
+
interface EverfurChatTopCard {
|
|
26
|
+
/** The small heading ("Her focus"). */
|
|
27
|
+
readonly kicker: string;
|
|
28
|
+
/** A source badge ("<your brand> results"). */
|
|
29
|
+
readonly badge?: string;
|
|
30
|
+
readonly title: string;
|
|
31
|
+
/** The finding: a bold lead and the rest of the sentence. */
|
|
32
|
+
readonly lead?: string;
|
|
33
|
+
readonly body?: string;
|
|
34
|
+
/** Your action ("See her Health Plan"). */
|
|
35
|
+
readonly action?: {
|
|
36
|
+
readonly label: string;
|
|
37
|
+
readonly onPress: () => void;
|
|
38
|
+
};
|
|
39
|
+
/** A question the card asks in this thread ("What does it mean?" sends `prompt`). */
|
|
40
|
+
readonly ask?: {
|
|
41
|
+
readonly label: string;
|
|
42
|
+
readonly prompt: string;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* The close control's accessible name; given, the card can close to the pill. Absent, no close and no pill (the
|
|
46
|
+
* card stays open). On React Native a blank name falls back to the shared `Close`.
|
|
47
|
+
*/
|
|
48
|
+
readonly closeLabel?: string;
|
|
49
|
+
/** The pill's words while the card is closed (defaults to `kicker`). */
|
|
50
|
+
readonly pill?: string;
|
|
51
|
+
/** Draw the close glyph your way. */
|
|
52
|
+
readonly renderIcon?: (icon: 'close') => ReactNode;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export type { EverfurChatOpeningCard as E, EverfurChatEmptyHeaderContext as a, EverfurChatTopCard as b };
|
|
@@ -0,0 +1,55 @@
|
|
|
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 */
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
/** What `renderEmptyHeader` receives: ask a question in this thread, with no screen in between. */
|
|
5
|
+
interface EverfurChatEmptyHeaderContext {
|
|
6
|
+
/** Send `prompt` as the member's next message in the open thread (the same path as a starter chip). */
|
|
7
|
+
ask(prompt: string): void;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* The card a thread opened from a notification starts with, in place of the member's first bubble: drawn while
|
|
11
|
+
* the first message of the open thread is the surface's `initialAsk`.
|
|
12
|
+
*/
|
|
13
|
+
interface EverfurChatOpeningCard {
|
|
14
|
+
/** The line over the title ("Notification · 9:41 AM"). */
|
|
15
|
+
readonly kicker: string;
|
|
16
|
+
readonly title: string;
|
|
17
|
+
readonly body?: string;
|
|
18
|
+
/** The brand mark in the card's corner. */
|
|
19
|
+
readonly icon?: ReactNode;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* The card at the top of the empty thread (presentation `chatTopCard: "focus"`): one finding, in your words, with
|
|
23
|
+
* an action of yours and a question it can ask in the thread. Its close control folds it into a pill.
|
|
24
|
+
*/
|
|
25
|
+
interface EverfurChatTopCard {
|
|
26
|
+
/** The small heading ("Her focus"). */
|
|
27
|
+
readonly kicker: string;
|
|
28
|
+
/** A source badge ("<your brand> results"). */
|
|
29
|
+
readonly badge?: string;
|
|
30
|
+
readonly title: string;
|
|
31
|
+
/** The finding: a bold lead and the rest of the sentence. */
|
|
32
|
+
readonly lead?: string;
|
|
33
|
+
readonly body?: string;
|
|
34
|
+
/** Your action ("See her Health Plan"). */
|
|
35
|
+
readonly action?: {
|
|
36
|
+
readonly label: string;
|
|
37
|
+
readonly onPress: () => void;
|
|
38
|
+
};
|
|
39
|
+
/** A question the card asks in this thread ("What does it mean?" sends `prompt`). */
|
|
40
|
+
readonly ask?: {
|
|
41
|
+
readonly label: string;
|
|
42
|
+
readonly prompt: string;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* The close control's accessible name; given, the card can close to the pill. Absent, no close and no pill (the
|
|
46
|
+
* card stays open). On React Native a blank name falls back to the shared `Close`.
|
|
47
|
+
*/
|
|
48
|
+
readonly closeLabel?: string;
|
|
49
|
+
/** The pill's words while the card is closed (defaults to `kicker`). */
|
|
50
|
+
readonly pill?: string;
|
|
51
|
+
/** Draw the close glyph your way. */
|
|
52
|
+
readonly renderIcon?: (icon: 'close') => ReactNode;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export type { EverfurChatOpeningCard as E, EverfurChatEmptyHeaderContext as a, EverfurChatTopCard as b };
|
|
@@ -0,0 +1,147 @@
|
|
|
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 */
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
import { StyleProp, ViewStyle, TextStyle } from 'react-native';
|
|
4
|
+
import { E as EverfurChatOpeningCard$1 } from './threadOptions.d-6hfQS1x7.cjs';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The card a thread opened from a notification starts with, in place of the member's first bubble: drawn while
|
|
8
|
+
* the first message of the open thread is the surface's `initialAsk`.
|
|
9
|
+
*/
|
|
10
|
+
interface EverfurChatOpeningCard extends EverfurChatOpeningCard$1 {
|
|
11
|
+
/**
|
|
12
|
+
* Your styles per element: the web surface's `classNames` (card, icon, body) as React Native styles, plus the
|
|
13
|
+
* kicker and the title, which a web host reaches through its card class. Each is laid over Everfur's own style for
|
|
14
|
+
* that element. Absent, the card keeps the web's default look (the subtle fill, a sentence-case kicker).
|
|
15
|
+
*/
|
|
16
|
+
readonly styles?: {
|
|
17
|
+
readonly card?: StyleProp<ViewStyle>;
|
|
18
|
+
readonly icon?: StyleProp<ViewStyle>;
|
|
19
|
+
readonly kicker?: StyleProp<TextStyle>;
|
|
20
|
+
readonly title?: StyleProp<TextStyle>;
|
|
21
|
+
readonly body?: StyleProp<TextStyle>;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* The history bar: a "Chats" control with the member's thread count that opens the history, and a "New chat"
|
|
26
|
+
* control. For a surface that hides the SDK header and still wants the member's past chats.
|
|
27
|
+
*/
|
|
28
|
+
interface EverfurChatHistoryBar {
|
|
29
|
+
/** The history control's words ("Chats"). */
|
|
30
|
+
readonly chats: string;
|
|
31
|
+
/** The new-chat control's words ("New chat"). */
|
|
32
|
+
readonly newChat: string;
|
|
33
|
+
/** Draw the two icons your way. */
|
|
34
|
+
readonly renderIcon?: (icon: 'history' | 'edit') => ReactNode;
|
|
35
|
+
/** Your own control after "Chats". Absent, nothing is drawn. */
|
|
36
|
+
readonly extra?: ReactNode;
|
|
37
|
+
}
|
|
38
|
+
/** The empty thread's own title and chip fills. Absent, the empty state is Everfur's own. */
|
|
39
|
+
interface EverfurChatEmptyState {
|
|
40
|
+
/** The title over the starter chips, in place of "What can we help {pet} with today?". */
|
|
41
|
+
readonly title?: string;
|
|
42
|
+
/**
|
|
43
|
+
* Fills for the chips that bring none of their own, taken in turn (the first chip the first fill, and round
|
|
44
|
+
* again). Each is a fill and its ink. Absent, Raph's v3 cycle on a light theme; empty, the theme's paint.
|
|
45
|
+
*/
|
|
46
|
+
readonly chipTints?: readonly {
|
|
47
|
+
readonly tint: string;
|
|
48
|
+
readonly ink?: string;
|
|
49
|
+
}[];
|
|
50
|
+
}
|
|
51
|
+
/** One card under an answer in the cards answer style: a record, a stat, or a link to one of your screens. */
|
|
52
|
+
interface EverfurChatAnswerCard {
|
|
53
|
+
/** Stable key within the answer. */
|
|
54
|
+
readonly key: string;
|
|
55
|
+
readonly title: string;
|
|
56
|
+
/** The small line under the title. */
|
|
57
|
+
readonly meta?: string;
|
|
58
|
+
/** A status pill; `tone` picks `styles.pillTone[tone]` (and `styles.pillToneText[tone]` for its words). */
|
|
59
|
+
readonly pill?: {
|
|
60
|
+
readonly label: string;
|
|
61
|
+
readonly tone?: string;
|
|
62
|
+
};
|
|
63
|
+
/** A stat card's value: drawn in place of the pill and the chevron. */
|
|
64
|
+
readonly value?: {
|
|
65
|
+
readonly amount: string;
|
|
66
|
+
readonly unit?: string;
|
|
67
|
+
};
|
|
68
|
+
/** The tile at the start: an icon of yours, or an https image; `tone` picks `styles.tileTone[tone]`. */
|
|
69
|
+
readonly tile?: {
|
|
70
|
+
readonly icon?: ReactNode;
|
|
71
|
+
readonly imageUrl?: string;
|
|
72
|
+
readonly tone?: string;
|
|
73
|
+
};
|
|
74
|
+
/** Picks `styles.cardVariant[variant]` (for example a highlighted plan card). */
|
|
75
|
+
readonly variant?: string;
|
|
76
|
+
/** Given, the card is a button that calls this. Absent, a static card. */
|
|
77
|
+
readonly onPress?: () => void;
|
|
78
|
+
/** A card of your own, drawn in the card's place. If it throws, the slot draws nothing. */
|
|
79
|
+
readonly render?: () => ReactNode;
|
|
80
|
+
}
|
|
81
|
+
/** What `answerCards.cards` receives: the settled answer's text and the question it answered. */
|
|
82
|
+
interface EverfurChatAnswerContext {
|
|
83
|
+
readonly answer: string;
|
|
84
|
+
readonly question: string | null;
|
|
85
|
+
/** The answer's message id, stable for the life of the thread. */
|
|
86
|
+
readonly messageId: string;
|
|
87
|
+
}
|
|
88
|
+
/** The cards answer style's content (used while presentation `chatAnswerStyle` is `cards`). The words are yours. */
|
|
89
|
+
interface EverfurChatAnswerCards {
|
|
90
|
+
/** The line over each answer (an icon and your words). Absent, the assistant's name line. */
|
|
91
|
+
readonly byline?: {
|
|
92
|
+
readonly label: string;
|
|
93
|
+
readonly icon?: ReactNode;
|
|
94
|
+
};
|
|
95
|
+
/** Your cards under a settled answer. A throw draws none. */
|
|
96
|
+
readonly cards?: (context: EverfurChatAnswerContext) => readonly EverfurChatAnswerCard[];
|
|
97
|
+
/** Two feedback chips in place of the footer's thumbs, mapped to thumbs up and thumbs down. */
|
|
98
|
+
readonly feedback?: {
|
|
99
|
+
readonly helpful: string;
|
|
100
|
+
readonly notHelpful: string;
|
|
101
|
+
};
|
|
102
|
+
/** Your own rows at the top of the follow-ups, for the answer it receives. */
|
|
103
|
+
readonly followUpActions?: (context: EverfurChatAnswerContext) => readonly EverfurChatFollowUpAction[];
|
|
104
|
+
/** Draw the chevron your way. Absent, Everfur's glyph. */
|
|
105
|
+
readonly renderIcon?: (icon: 'chevron') => ReactNode;
|
|
106
|
+
/**
|
|
107
|
+
* Your styles for the tones and variants the cards name, the feedback chips and the follow-ups: the web surface's
|
|
108
|
+
* `classNames` of the same names, as React Native styles. Each is laid over Everfur's own style for that element.
|
|
109
|
+
* Absent, every card, tile, pill, chip and row keeps the web's default paint.
|
|
110
|
+
*/
|
|
111
|
+
readonly styles?: {
|
|
112
|
+
/** A stat card (one with a `value`). */
|
|
113
|
+
readonly cardStat?: StyleProp<ViewStyle>;
|
|
114
|
+
readonly cardVariant?: Readonly<Record<string, StyleProp<ViewStyle>>>;
|
|
115
|
+
readonly tileTone?: Readonly<Record<string, StyleProp<ViewStyle>>>;
|
|
116
|
+
readonly pillTone?: Readonly<Record<string, StyleProp<ViewStyle>>>;
|
|
117
|
+
readonly pillToneText?: Readonly<Record<string, StyleProp<TextStyle>>>;
|
|
118
|
+
/** The feedback chips' row, each chip and its words (the web's `feedback`). */
|
|
119
|
+
readonly feedback?: StyleProp<ViewStyle>;
|
|
120
|
+
readonly feedbackChip?: StyleProp<ViewStyle>;
|
|
121
|
+
readonly feedbackChipText?: StyleProp<TextStyle>;
|
|
122
|
+
/** The block of follow-ups under the answer, its label, each row and its words (the web's `followUps`, `followUpsLabel`, `followUp`). */
|
|
123
|
+
readonly followUps?: StyleProp<ViewStyle>;
|
|
124
|
+
readonly followUpsLabel?: StyleProp<TextStyle>;
|
|
125
|
+
readonly followUp?: StyleProp<ViewStyle>;
|
|
126
|
+
readonly followUpText?: StyleProp<TextStyle>;
|
|
127
|
+
/** One of your own rows and its words (the web's `followUpAction`), laid over `followUp` and `followUpText`. */
|
|
128
|
+
readonly followUpAction?: StyleProp<ViewStyle>;
|
|
129
|
+
readonly followUpActionText?: StyleProp<TextStyle>;
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
/** A row of yours at the top of the follow-ups under an answer. */
|
|
133
|
+
interface EverfurChatFollowUpAction {
|
|
134
|
+
readonly key: string;
|
|
135
|
+
readonly label: string;
|
|
136
|
+
readonly icon?: ReactNode;
|
|
137
|
+
readonly onPress: () => void;
|
|
138
|
+
}
|
|
139
|
+
/** The history bottom sheet (presentation `chatHistoryStyle: "sheet"`). */
|
|
140
|
+
interface EverfurChatHistorySheet {
|
|
141
|
+
/** The sheet's small title ("Chats with Ask <your brand>"). Absent, Everfur's history heading. */
|
|
142
|
+
readonly title?: string;
|
|
143
|
+
/** Draw the icons your way. */
|
|
144
|
+
readonly renderIcon?: (icon: 'close' | 'chat' | 'edit') => ReactNode;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
export type { EverfurChatAnswerCard as E, EverfurChatAnswerCards as a, EverfurChatAnswerContext as b, EverfurChatEmptyState as c, EverfurChatFollowUpAction as d, EverfurChatHistoryBar as e, EverfurChatHistorySheet as f, EverfurChatOpeningCard as g };
|