@everfur/sdk 0.21.0 → 0.22.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 +150 -0
- package/dist/{Chat.d-JDtlG_EW.d.cts → Chat.d-DDmNIlJn.d.cts} +1 -1
- package/dist/{Chat.d-CoGJrK3t.d.ts → Chat.d-DySDBc6L.d.ts} +1 -1
- package/dist/{DepthViews.d-XTv4s3ru.d.cts → DepthViews.d-BHb0Xb-C.d.cts} +1 -1
- package/dist/{DepthViews.d-CNQn-eEr.d.ts → DepthViews.d-BIfqdrvX.d.ts} +1 -1
- package/dist/{DepthViews.d-D31VlFKU.d.ts → DepthViews.d-BW3HrhnC.d.ts} +1 -1
- package/dist/{DepthViews.d-zxM_xbP9.d.cts → DepthViews.d-Dq8eWBvw.d.cts} +1 -1
- package/dist/{RecordsPage.d-D_y-ZB3S.d.ts → RecordsPage.d-Bs-dghTH.d.ts} +1 -1
- package/dist/{RecordsPage.d-CSZHrtWJ.d.cts → RecordsPage.d-CLrw-AvZ.d.cts} +1 -1
- package/dist/animations/index.cjs +2 -2
- package/dist/animations/index.d.cts +3 -3
- package/dist/animations/index.d.ts +3 -3
- package/dist/animations/index.js +2 -2
- package/dist/{attachments.d-D74wbmQU.d.cts → attachments.d-DTGYmW8Y.d.cts} +1 -1
- package/dist/{attachments.d-Dm6NUJTR.d.ts → attachments.d-DjxmIsNp.d.ts} +1 -1
- package/dist/{bookingCopy.d-DMmLKY5Q.d.ts → bookingCopy.d-CX-DMiwi.d.ts} +148 -148
- package/dist/{bookingCopy.d-iaYDPvPd.d.cts → bookingCopy.d-D952V8Tq.d.cts} +148 -148
- package/dist/{branding.d-DpNGEdDL.d.ts → branding.d-DC4imCYd.d.ts} +72 -4
- package/dist/{branding.d-BFauULV6.d.cts → branding.d-G7rpxDhI.d.cts} +72 -4
- package/dist/{casesRepository.d-CCJJQXnl.d.ts → casesRepository.d-CnJZlUZ4.d.ts} +1 -1
- package/dist/{casesRepository.d-G2dahIKO.d.cts → casesRepository.d-bWJHZD-_.d.cts} +1 -1
- package/dist/chat/index.cjs +59 -47
- package/dist/chat/index.d.cts +11 -11
- package/dist/chat/index.d.ts +11 -11
- package/dist/chat/index.js +59 -47
- package/dist/chat/lite/index.cjs +59 -47
- package/dist/chat/lite/index.d.cts +11 -11
- package/dist/chat/lite/index.d.ts +11 -11
- package/dist/chat/lite/index.js +59 -47
- package/dist/{chatHandoffToken.d-DVv9tl8h.d.ts → chatHandoffToken.d-BCEdhZpd.d.ts} +5 -5
- package/dist/{chatHandoffToken.d-xmnHrTA5.d.cts → chatHandoffToken.d-uKnSnIzN.d.cts} +5 -5
- package/dist/{chatTypes.d-CQC7GTdE.d.cts → chatTypes.d-CFyYBzps.d.cts} +4 -4
- package/dist/{chatTypes.d-hS1AilYl.d.ts → chatTypes.d-DbdF3ij5.d.ts} +4 -4
- package/dist/chunk-AT7SU763.js +14 -0
- package/dist/{chunk-2NA7TPUA.js → chunk-FFMIX6HG.js} +1 -1
- package/dist/chunk-K5NVMNI5.js +47 -0
- package/dist/chunk-ZASVU7CH.js +34 -0
- package/dist/client/index.cjs +9 -8
- package/dist/client/index.d.cts +18 -12
- package/dist/client/index.d.ts +18 -12
- package/dist/client/index.js +9 -8
- package/dist/{clinicBatch.d-BpP2NBb3.d.ts → clinicBatch.d-C_kZtYt-.d.ts} +2 -2
- package/dist/{clinicBatch.d-4PFwKJfw.d.cts → clinicBatch.d-e3Cn5HhA.d.cts} +2 -2
- package/dist/{config.d-D9igq-vT.d.ts → config.d--6siaeNg.d.ts} +14 -6
- package/dist/{config.d-cX5E6DAw.d.cts → config.d-Ba21AaZg.d.cts} +14 -6
- package/dist/consent/index.cjs +2 -2
- package/dist/consent/index.d.cts +5 -5
- package/dist/consent/index.d.ts +5 -5
- package/dist/consent/index.js +2 -2
- package/dist/{context.d-BrRRNw9I.d.cts → context.d-DLHTf-fV.d.cts} +7 -7
- package/dist/{context.d-hPfsEsNf.d.ts → context.d-TArU_9lj.d.ts} +7 -7
- package/dist/{copy.d-CDlirTR4.d.ts → copy.d-GokMma80.d.ts} +2 -2
- package/dist/{copy.d-DWjSkbrZ.d.cts → copy.d-zWWCn3wB.d.cts} +2 -2
- package/dist/core/index.cjs +4 -4
- package/dist/core/index.d.cts +17 -17
- package/dist/core/index.d.ts +17 -17
- package/dist/core/index.js +4 -4
- package/dist/{depth.d-CfBorxcQ.d.ts → depth.d-C_HL8yAz.d.ts} +2 -2
- package/dist/{depth.d-KkrGx98U.d.cts → depth.d-De5pT7vA.d.cts} +2 -2
- package/dist/{entitlementRepository.d-DpQrIgW6.d.ts → entitlementRepository.d-CoKN-Ksa.d.ts} +3 -3
- package/dist/{entitlementRepository.d-BvnWpcQH.d.cts → entitlementRepository.d-Tj7lvs4e.d.cts} +3 -3
- package/dist/{focus.d-CYwVLDvR.d.ts → focus.d-7G0BBmA9.d.ts} +3 -128
- package/dist/{focus.d-9loikWy8.d.cts → focus.d-B0qweva0.d.cts} +3 -128
- package/dist/health-plan/index.cjs +133 -92
- package/dist/health-plan/index.d.cts +33 -18
- package/dist/health-plan/index.d.ts +33 -18
- package/dist/health-plan/index.js +141 -100
- package/dist/healthPlanRepository.d-CdCyUWph.d.ts +131 -0
- package/dist/healthPlanRepository.d-fPbLceBr.d.cts +131 -0
- package/dist/{idempotency.d-DGQ_xML5.d.ts → idempotency.d-CoUlC-Yd.d.ts} +1 -1
- package/dist/{idempotency.d-CVKkUhY4.d.cts → idempotency.d-IDta7Jjj.d.cts} +1 -1
- package/dist/{identity.d-DR5YwO6E.d.ts → identity.d-B7dPRGqm.d.ts} +1 -1
- package/dist/{identity.d-Bnl5Z0MM.d.cts → identity.d-_MK9Y7a4.d.cts} +1 -1
- package/dist/inbox.d-ChNXTovj.d.cts +103 -0
- package/dist/inbox.d-CuuPTWyW.d.ts +103 -0
- package/dist/index.cjs +69 -56
- package/dist/index.d.cts +18 -18
- package/dist/index.d.ts +18 -18
- package/dist/index.js +69 -56
- package/dist/{introEvents.d-D_yL7lnE.d.ts → introEvents.d-D6Ay0ORN.d.ts} +1 -1
- package/dist/{introEvents.d-JmPqEqMQ.d.cts → introEvents.d-JvAWRKYu.d.cts} +1 -1
- package/dist/{usePresentation.d-CrobH0d_.d.cts → layout.d-ByfOEhpG.d.cts} +2 -136
- package/dist/{usePresentation.d-CDNK4MDY.d.ts → layout.d-D3d4QMeO.d.ts} +2 -136
- package/dist/notifications/inbox/index.cjs +24 -12
- package/dist/notifications/inbox/index.d.cts +87 -6
- package/dist/notifications/inbox/index.d.ts +87 -6
- package/dist/notifications/inbox/index.js +24 -12
- package/dist/notifications/index.d.cts +7 -7
- package/dist/notifications/index.d.ts +7 -7
- package/dist/{optInView.d-CZvKlq-o.d.ts → optInView.d-BpFTJaaX.d.ts} +2 -2
- package/dist/{optInView.d-BizcW_QG.d.cts → optInView.d-Bxvg0WLJ.d.cts} +2 -2
- package/dist/{pets.d-uCzgFbGi.d.ts → pets.d-Br960ekh.d.ts} +1 -1
- package/dist/{pets.d-C4CWxQPh.d.cts → pets.d-BtbJcf8T.d.cts} +1 -1
- package/dist/{petsRepository.d-DOcVv9bd.d.cts → petsRepository.d-Bj9rPnCr.d.cts} +1 -1
- package/dist/{petsRepository.d-DRW7NkKm.d.ts → petsRepository.d-CSOth5XE.d.ts} +1 -1
- package/dist/photo/index.cjs +1 -1
- package/dist/photo/index.js +1 -1
- package/dist/{presentation.d-Bs8xQ4gD.d.cts → presentation.d-BvZs_jN-.d.cts} +6 -0
- package/dist/{presentation.d-Bs8xQ4gD.d.ts → presentation.d-BvZs_jN-.d.ts} +6 -0
- package/dist/records/depth/index.cjs +10 -6
- package/dist/records/depth/index.d.cts +9 -9
- package/dist/records/depth/index.d.ts +9 -9
- package/dist/records/depth/index.js +10 -6
- package/dist/records/index.cjs +302 -207
- package/dist/records/index.d.cts +144 -17
- package/dist/records/index.d.ts +144 -17
- package/dist/records/index.js +302 -207
- package/dist/{requestFunnel.d-CQ0O8fMG.d.cts → requestFunnel.d-BwO-jFLX.d.cts} +2 -2
- package/dist/{requestFunnel.d-BYLycQMI.d.ts → requestFunnel.d-LSnmCusf.d.ts} +2 -2
- package/dist/{route.d-DFJ0gXj8.d.ts → route.d-Bzyamuxa.d.ts} +2 -2
- package/dist/{route.d-q9yndhFy.d.cts → route.d-D70-OHBc.d.cts} +2 -2
- package/dist/{runtimeTypes.d-3LRuzxr7.d.cts → runtimeTypes.d-BHdN-9aB.d.cts} +7 -7
- package/dist/{runtimeTypes.d-BJHYj2MI.d.ts → runtimeTypes.d-L_CbeCKS.d.ts} +7 -7
- package/dist/{screenProps.d-DfAmuKkr.d.cts → screenProps.d-DB5IMaGZ.d.cts} +1 -1
- package/dist/{screenProps.d-tVzlXGaN.d.ts → screenProps.d-HGSPNGHt.d.ts} +1 -1
- package/dist/server/events/index.cjs +1 -1
- package/dist/server/events/index.d.cts +2 -2
- package/dist/server/events/index.d.ts +2 -2
- package/dist/server/events/index.js +1 -1
- package/dist/server/index.cjs +1 -1
- package/dist/server/index.d.cts +3 -3
- package/dist/server/index.d.ts +3 -3
- package/dist/server/index.js +1 -1
- package/dist/shop/index.cjs +26 -13
- package/dist/shop/index.d.cts +3 -3
- package/dist/shop/index.d.ts +3 -3
- package/dist/shop/index.js +26 -13
- package/dist/slots/index.cjs +299 -0
- package/dist/slots/index.d.cts +155 -0
- package/dist/slots/index.d.ts +155 -0
- package/dist/slots/index.js +299 -0
- package/dist/slots/weather-glyphs/index.cjs +2 -0
- package/dist/slots/weather-glyphs/index.d.cts +11 -0
- package/dist/slots/weather-glyphs/index.d.ts +11 -0
- package/dist/slots/weather-glyphs/index.js +2 -0
- package/dist/tabs/index.cjs +43 -12
- package/dist/tabs/index.d.cts +79 -8
- package/dist/tabs/index.d.ts +79 -8
- package/dist/tabs/index.js +43 -12
- package/dist/televet/booking/index.cjs +54 -10
- package/dist/televet/booking/index.d.cts +51 -10
- package/dist/televet/booking/index.d.ts +51 -10
- package/dist/televet/booking/index.js +55 -11
- package/dist/televet/call/index.cjs +1 -1
- package/dist/televet/call/index.js +1 -1
- package/dist/televet/index.cjs +1 -1
- package/dist/televet/index.d.cts +2 -2
- package/dist/televet/index.d.ts +2 -2
- package/dist/televet/index.js +1 -1
- package/dist/testing/index.d.cts +1 -1
- package/dist/testing/index.d.ts +1 -1
- package/dist/testing/rn/index.cjs +1 -1
- package/dist/testing/rn/index.d.cts +13 -11
- package/dist/testing/rn/index.d.ts +13 -11
- package/dist/testing/rn/index.js +1 -1
- package/dist/testing/web/index.d.cts +10 -10
- package/dist/testing/web/index.d.ts +10 -10
- package/dist/texting/index.cjs +2 -2
- package/dist/texting/index.d.cts +5 -5
- package/dist/texting/index.d.ts +5 -5
- package/dist/texting/index.js +2 -2
- package/dist/{threadOptions.d-I6G3BdlP.d.cts → threadOptions.d-CS-Qu_rR.d.cts} +6 -6
- package/dist/{threadOptions.d-DfH26dy7.d.ts → threadOptions.d-FzFN0zsK.d.ts} +6 -6
- package/dist/{timelineRows.d-uSfr2IP3.d.cts → timelineRows.d-BJRCgmdv.d.cts} +1 -1
- package/dist/{timelineRows.d-CugnCOfZ.d.ts → timelineRows.d-CPS4admm.d.ts} +1 -1
- package/dist/{tokens.d-BUVqme2D.d.cts → tokens.d-DH1mYjZl.d.cts} +43 -1
- package/dist/{tokens.d-BUVqme2D.d.ts → tokens.d-DH1mYjZl.d.ts} +43 -1
- package/dist/{typeStyle.d-Ckdh_S-t.d.cts → typeStyle.d-BIDpuYpg.d.cts} +29 -3
- package/dist/{typeStyle.d-B9Jo5mDX.d.ts → typeStyle.d-aRhFhBpG.d.ts} +29 -3
- package/dist/ui/index.cjs +26 -13
- package/dist/ui/index.js +26 -13
- package/dist/{useHealthPlanSubscription.d-CVVQIFpG.d.ts → useHealthPlanSubscription.d-SQfx-45x.d.ts} +3 -2
- package/dist/{useHealthPlanSubscription.d-DylPMm_m.d.cts → useHealthPlanSubscription.d-zjsvvlhz.d.cts} +3 -2
- package/dist/useInboxUnread.d-7p3IWs_A.d.cts +109 -0
- package/dist/useInboxUnread.d-BxFKFU4o.d.ts +109 -0
- package/dist/usePresentation.d-BHO_uZ31.d.cts +140 -0
- package/dist/usePresentation.d-Dr7iD-4Y.d.ts +140 -0
- package/dist/{useRecordsDepth.d-BvBYIPii.d.ts → useRecordsDepth.d-BinUa8W9.d.ts} +1 -1
- package/dist/{useRecordsDepth.d-Cd5Vyb7D.d.cts → useRecordsDepth.d-Bk8BSerZ.d.cts} +1 -1
- package/dist/{useUnread.d-ElAEfgl1.d.ts → useUnread.d-CAeYh82_.d.ts} +10 -7
- package/dist/{useUnread.d-B4Yqcteg.d.cts → useUnread.d-DXcRBQw8.d.cts} +10 -7
- package/dist/video/index.cjs +1 -1
- package/dist/video/index.js +1 -1
- package/dist/{view.d-2RWoY9kd.d.ts → view.d-CaH6dZPJ.d.ts} +3 -3
- package/dist/{view.d-utmOR2ee.d.cts → view.d-DV4b1cov.d.cts} +3 -3
- package/dist/web/consent/index.cjs +1 -1
- package/dist/web/consent/index.d.cts +5 -5
- package/dist/web/consent/index.d.ts +5 -5
- package/dist/web/consent/index.js +1 -1
- package/dist/web/health-plan/index.cjs +15 -13
- package/dist/web/health-plan/index.d.cts +20 -13
- package/dist/web/health-plan/index.d.ts +20 -13
- package/dist/web/health-plan/index.js +7 -7
- package/dist/web/health-plan/styles.css +6 -2
- package/dist/web/inbox/index.cjs +1 -1
- package/dist/web/inbox/index.d.cts +7 -5
- package/dist/web/inbox/index.d.ts +7 -5
- package/dist/web/inbox/index.js +1 -1
- package/dist/web/index.cjs +71 -70
- package/dist/web/index.d.cts +53 -31
- package/dist/web/index.d.ts +53 -31
- package/dist/web/index.js +28 -27
- package/dist/web/intro/index.cjs +1 -1
- 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 -1
- package/dist/web/notifications/index.cjs +1 -1
- package/dist/web/notifications/index.d.cts +6 -6
- package/dist/web/notifications/index.d.ts +6 -6
- package/dist/web/notifications/index.js +1 -1
- package/dist/web/records/depth/index.cjs +1 -1
- package/dist/web/records/depth/index.d.cts +9 -9
- package/dist/web/records/depth/index.d.ts +9 -9
- package/dist/web/records/depth/index.js +1 -1
- package/dist/web/records/index.cjs +1 -1
- package/dist/web/records/index.d.cts +11 -11
- package/dist/web/records/index.d.ts +11 -11
- package/dist/web/records/index.js +1 -1
- package/dist/web/records-sheet/index.cjs +3 -3
- package/dist/web/records-sheet/index.js +3 -3
- package/dist/web/shop/index.cjs +27 -8
- package/dist/web/shop/index.d.cts +4 -3
- package/dist/web/shop/index.d.ts +4 -3
- package/dist/web/shop/index.js +3 -3
- package/dist/web/televet/booking/index.cjs +53 -53
- package/dist/web/televet/booking/index.d.cts +44 -44
- package/dist/web/televet/booking/index.d.ts +44 -44
- package/dist/web/televet/booking/index.js +53 -53
- package/dist/web/televet/call/index.cjs +3 -3
- package/dist/web/televet/call/index.d.cts +7 -6
- package/dist/web/televet/call/index.d.ts +7 -6
- package/dist/web/televet/call/index.js +3 -3
- package/dist/web/televet/index.cjs +1 -1
- package/dist/web/televet/index.js +1 -1
- package/dist/web/texting/index.cjs +1 -1
- package/dist/web/texting/index.d.cts +5 -5
- package/dist/web/texting/index.d.ts +5 -5
- package/dist/web/texting/index.js +1 -1
- package/dist/web/ui/index.cjs +29 -10
- package/dist/web/ui/index.d.cts +32 -32
- package/dist/web/ui/index.d.ts +32 -32
- package/dist/web/ui/index.js +2 -2
- package/dist/web/ui/styles.css +46 -3
- package/package.json +36 -5
- package/slots/package.json +8 -0
- package/slots/weather-glyphs/package.json +8 -0
- package/dist/chunk-IJU5TV5N.js +0 -12
- package/dist/chunk-TFX6WMDN.js +0 -30
- package/dist/chunk-WZNPR5TY.js +0 -34
- package/dist/useInboxUnread.d-DDoSII8D.d.ts +0 -206
- package/dist/useInboxUnread.d-Dq3CCAa3.d.cts +0 -206
- package/dist/{IntakeMedia.d-Dqc5V_YH.d.cts → IntakeMedia.d-CO8weVGO.d.cts} +35 -35
- package/dist/{IntakeMedia.d-DNUAks9E.d.ts → IntakeMedia.d-DnUZJsbj.d.ts} +35 -35
package/dist/texting/index.js
CHANGED
|
@@ -1,5 +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 RETRYABILITY_ROWS=[{wireCode:"AccessDeniedException",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"AuthorizationException",envelope:"http_envelope",httpStatus:401,retryable:false},{wireCode:"ConflictException",envelope:"http_envelope",httpStatus:409,retryable:true},{wireCode:"DAILY_QUOTA_EXCEEDED",envelope:"http_envelope",httpStatus:429,retryable:true},{wireCode:"FILE_TOO_LARGE",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"IDEMPOTENCY_KEY_IN_FLIGHT",envelope:"http_envelope",httpStatus:409,retryable:true},{wireCode:"IDEMPOTENCY_KEY_REUSED_DIFFERENT_REQUEST",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"INVALID_CONTENT_TYPE",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"InternalFailureException",envelope:"http_envelope",httpStatus:500,retryable:true},{wireCode:"MethodNotAllowedException",envelope:"http_envelope",httpStatus:405,retryable:false},{wireCode:"NotImplementedException",envelope:"http_envelope",httpStatus:501,retryable:false},{wireCode:"PaymentRequiredException",envelope:"http_envelope",httpStatus:402,retryable:false},{wireCode:"ResourceNotFoundException",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"ServiceUnavailableException",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"TIER_UPGRADE_REQUIRED",envelope:"http_envelope",httpStatus:402,retryable:false},{wireCode:"ThrottlingException",envelope:"http_envelope",httpStatus:429,retryable:true},{wireCode:"ValidationException",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"accessDenied",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"access_denied",envelope:"oauth_error",httpStatus:302,retryable:false},{wireCode:"attachment_unreadable",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"authExpired",envelope:"http_envelope",httpStatus:401,retryable:true},{wireCode:"authRejected",envelope:"http_envelope",httpStatus:401,retryable:false},{wireCode:"catalog_empty_refused",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"catalog_shrink_refused",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"consent_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"consent_required",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"consent_scope_wrong_route",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"device_cipher_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"email_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"endpoint_not_allowed",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"event_cursor_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"event_filter_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"event_id_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"event_payload_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"event_type_not_available",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"event_type_unknown",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"idempotency_key_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"idempotency_key_required",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"idempotency_key_reused",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"inbox_cursor_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"insufficientCapability",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"insufficient_scope",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"internal_error",envelope:"sse_frame",httpStatus:200,retryable:false},{wireCode:"invalidRequest",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"invalid_client",envelope:"oauth_error",httpStatus:401,retryable:false},{wireCode:"invalid_client_metadata",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_grant",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_redirect_uri",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_request",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_scope",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_target",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"item_id_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"linked_account_read_only",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"mcp_connection_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"mcp_request_conflict",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"mcp_request_gone",envelope:"http_envelope",httpStatus:410,retryable:false},{wireCode:"mcp_request_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"not_found",envelope:"sse_frame",httpStatus:200,retryable:false},{wireCode:"open_url_not_allowed",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"partner_visit_link_conflict",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"partner_visit_owner_only",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"partner_visit_pet_already_mapped",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"payload_too_large",envelope:"http_envelope",httpStatus:413,retryable:false},{wireCode:"petRefInUse",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"pet_health_list_removals_unconfirmed",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"pet_health_species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"pet_not_registered",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"provider_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"rateLimited",envelope:"http_envelope",httpStatus:429,retryable:true},{wireCode:"read_target_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"record_species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"record_subject_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"record_upload_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"records_consent_required",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"sandbox_only",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"session_required",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"session_revoked",envelope:"http_envelope",httpStatus:401,retryable:false},{wireCode:"share_limit_reached",envelope:"http_envelope",httpStatus:429,retryable:false},{wireCode:"slow_down",envelope:"oauth_error",httpStatus:429,retryable:true},{wireCode:"species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"subscription_keys_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"tenant_filter_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"tenant_has_no_capabilities",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"tenant_resource_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"tenant_surface_not_enabled",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"timeout",envelope:"sse_frame",httpStatus:200,retryable:true},{wireCode:"token_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"unavailable",envelope:"sse_frame",httpStatus:200,retryable:true},{wireCode:"unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"unrestrictedKeyRequired",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"unsupported_grant_type",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"unsupported_response_type",envelope:"oauth_error",httpStatus:302,retryable:false},{wireCode:"user_ref_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"verify_mint_rate_limited",envelope:"http_envelope",httpStatus:429,retryable:true},{wireCode:"verify_mint_refused",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"verify_mint_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"verify_user_ref_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"web_push_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"webhook_endpoint_update_empty",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"webhook_endpoint_update_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"webhook_url_rejected",envelope:"http_envelope",httpStatus:400,retryable:false}],CONTRACT_RETRYABILITY=/* @__PURE__ */Object.freeze(RETRYABILITY_ROWS.map(row=>/* @__PURE__ */Object.freeze(row)));/* @__PURE__ */Object.freeze(CONTRACT_RETRYABILITY.map(row=>row.wireCode));var NORMALIZED_FOLD=/* @__PURE__ */Object.freeze({ValidationException:"validationFailed",AuthorizationException:"authRejected",PaymentRequiredException:"paymentRequired",AccessDeniedException:"accessDenied",ResourceNotFoundException:"resourceNotFound",ConflictException:"conflict",ThrottlingException:"rateLimited",InternalFailureException:"internalError",NotImplementedException:"notImplemented",ServiceUnavailableException:"serviceUnavailable",MethodNotAllowedException:"validationFailed",authExpired:"authExpired",unavailable:"serviceUnavailable",session_required:"sessionRequired",session_revoked:"authExpired",accessDenied:"accessDenied",invalidRequest:"sdkUpdateRequired",authRejected:"authRejected",rateLimited:"rateLimited",insufficientCapability:"accessDenied",unrestrictedKeyRequired:"accessDenied",user_ref_invalid:"validationFailed",event_cursor_invalid:"validationFailed",event_filter_invalid:"validationFailed",event_payload_invalid:"validationFailed",event_type_unknown:"validationFailed",idempotency_key_invalid:"validationFailed",idempotency_key_required:"validationFailed",idempotency_key_reused:"idempotencyConflict",payload_too_large:"validationFailed",webhook_url_rejected:"validationFailed",webhook_endpoint_update_empty:"validationFailed",webhook_endpoint_update_invalid:"validationFailed",event_type_not_available:"conflict",record_subject_not_found:"resourceNotFound",records_consent_required:"conflict",record_species_unsupported:"validationFailed",record_upload_invalid:"validationFailed",FILE_TOO_LARGE:"validationFailed",INVALID_CONTENT_TYPE:"validationFailed",attachment_unreadable:"validationFailed",provider_unsupported:"validationFailed",token_invalid:"validationFailed",device_cipher_unavailable:"serviceUnavailable",email_invalid:"validationFailed",consent_required:"validationFailed",consent_invalid:"validationFailed",consent_scope_wrong_route:"validationFailed",IDEMPOTENCY_KEY_IN_FLIGHT:"idempotencyInFlight",IDEMPOTENCY_KEY_REUSED_DIFFERENT_REQUEST:"idempotencyConflict",DAILY_QUOTA_EXCEEDED:"quotaExceeded",TIER_UPGRADE_REQUIRED:"paymentRequired",not_found:"conversationNotFound",timeout:"streamTimeout",internal_error:"internalError",invalid_request:"validationFailed",invalid_client:"authRejected",invalid_grant:"authRejected",unsupported_grant_type:"validationFailed",invalid_scope:"validationFailed",invalid_target:"validationFailed",invalid_redirect_uri:"validationFailed",invalid_client_metadata:"validationFailed",unsupported_response_type:"validationFailed",access_denied:"accessDenied",slow_down:"rateLimited",mcp_request_not_found:"resourceNotFound",mcp_request_gone:"resourceNotFound",mcp_connection_not_found:"resourceNotFound",mcp_request_conflict:"conflict",sandbox_only:"accessDenied",tenant_has_no_capabilities:"conflict",verify_mint_refused:"accessDenied",verify_mint_rate_limited:"rateLimited",verify_mint_unavailable:"serviceUnavailable",verify_user_ref_invalid:"validationFailed",insufficient_scope:"accessDenied",tenant_filter_invalid:"validationFailed",tenant_resource_not_found:"resourceNotFound",tenant_surface_not_enabled:"conflict",pet_health_species_unsupported:"validationFailed",pet_health_list_removals_unconfirmed:"validationFailed",petRefInUse:"conflict",share_limit_reached:"conflict",pet_not_registered:"resourceNotFound",species_unsupported:"validationFailed",partner_visit_owner_only:"accessDenied",partner_visit_link_conflict:"conflict",partner_visit_pet_already_mapped:"conflict",linked_account_read_only:"conflict",catalog_empty_refused:"conflict",catalog_shrink_refused:"conflict",endpoint_not_allowed:"validationFailed",event_id_invalid:"validationFailed",inbox_cursor_invalid:"validationFailed",item_id_invalid:"validationFailed",open_url_not_allowed:"validationFailed",read_target_invalid:"validationFailed",subscription_keys_invalid:"validationFailed",web_push_unavailable:"serviceUnavailable"}),CONTRACT_ERROR_ROWS=/* @__PURE__ */Object.freeze(CONTRACT_RETRYABILITY.map(generated=>/* @__PURE__ */Object.freeze({wireCode:generated.wireCode,envelope:generated.envelope,retryable:generated.retryable,normalized:NORMALIZED_FOLD[generated.wireCode]}))),BY_KEY=new Map(CONTRACT_ERROR_ROWS.map(r=>[r.envelope+r.wireCode.toUpperCase(),r])),ENVELOPE_LOOKUP_ORDER=/* @__PURE__ */Object.freeze(["http_envelope",...[...new Set(CONTRACT_ERROR_ROWS.map(r=>r.envelope))].filter(e=>e!=="http_envelope").sort()]);function contractErrorFor(wireCode,envelope){if(typeof wireCode!="string")return;let key=wireCode.trim().toUpperCase();if(key.length!==0)for(let candidate of[envelope??"http_envelope",...ENVELOPE_LOOKUP_ORDER]){let row=BY_KEY.get(candidate+key);if(row)return row}}var CATEGORY_OF=/* @__PURE__ */Object.freeze({authExpired:"authentication",authRejected:"authentication",sessionRequired:"authentication",identitySignatureRequired:"authentication",accessDenied:"authorization",paymentRequired:"entitlement",quotaExceeded:"rateLimit",rateLimited:"rateLimit",validationFailed:"invalidRequest",sdkUpdateRequired:"invalidRequest",runtimeDisposed:"invalidRequest",conversationNotFound:"notFound",petNotFound:"notFound",resourceNotFound:"notFound",conflict:"conflict",idempotencyConflict:"conflict",idempotencyInFlight:"conflict",streamTimeout:"connection",streamIncomplete:"connection",upstreamLlmTimeout:"connection",serviceUnavailable:"connection",internalError:"server",notImplemented:"server",mediaUploadFailed:"media",moderationBlocked:"policy",unknown:"unknown"});function categoryFor(code){return CATEGORY_OF[code]}function fromWire(wire){let contractRow=contractErrorFor(wire);if(contractRow)return contractRow.normalized;let upper=(wire??"").trim().toUpperCase(),canonical=upper.replace(/[^A-Z0-9]/g,"");if(canonical==="AUTHREJECTED")return"authRejected";if(upper.startsWith("AUTH"))return"authExpired";switch(canonical){case"DAILYQUOTAEXCEEDED":case"QUOTAEXCEEDED":return"quotaExceeded";case"RATELIMITED":case"TOOMANYREQUESTS":case"TELEVETRATELIMITED":return"rateLimited";case"IDEMPOTENCYKEYCONFLICT":case"IDEMPOTENCYCONFLICT":return"idempotencyConflict";case"ACCESSDENIED":case"FORBIDDEN":return"accessDenied";case"IDENTITYSIGNATUREREQUIRED":return"identitySignatureRequired";case"RUNTIMEDISPOSED":return"runtimeDisposed";case"NOTFOUND":case"CONVERSATIONNOTFOUND":return"conversationNotFound";case"PETNOTFOUND":return"petNotFound";case"TIMEOUT":case"STREAMTIMEOUT":return"streamTimeout";case"MEDIAUPLOADFAILED":case"UNRECOGNIZEDVIDEOFORMAT":case"FILETOOSMALL":return"mediaUploadFailed";case"MODERATIONBLOCKED":return"moderationBlocked";case"UPSTREAMLLMTIMEOUT":return"upstreamLlmTimeout";case"INTERNALERROR":case"INTERNALSERVERERROR":return"internalError";case"STREAMINCOMPLETE":case"CHATSTREAMINCOMPLETE":return"streamIncomplete";case"INVALIDANALYSISTYPE":case"INVALIDUPLOADPURPOSE":return"unknown";default:return"unknown"}}var AUTO_RETRYABLE_CODES=/* @__PURE__ */new Set(["streamTimeout","rateLimited","internalError","upstreamLlmTimeout","streamIncomplete"]);function isAutoRetryable(code){return AUTO_RETRYABLE_CODES.has(code)}var RETRYABLE_CONTRACT_CODES=/* @__PURE__ */new Set(["serviceUnavailable","conflict","idempotencyInFlight"]);function isRetryableCode(code){return isAutoRetryable(code)||RETRYABLE_CONTRACT_CODES.has(code)}var BACKOFF_BASE_MS=500,BACKOFF_CAP_MS=8e3,MAX_RETRY_ATTEMPTS=4;function backoffDelayMs(attempt,rng=Math.random){let bounded=Math.max(0,attempt),ceiling=Math.min(BACKOFF_BASE_MS*2**bounded,BACKOFF_CAP_MS);return Math.floor(rng()*ceiling)}var ACCESS_DENIED_COPY="This feature isn't available on your account right now.",VALIDATION_FAILED_COPY="Something in that request was not right. Check the details and try again.",USER_FACING_COPY=/* @__PURE__ */Object.freeze({authExpired:"Please sign in again to continue.",authRejected:"Please sign in again to continue.",sessionRequired:"This app needs to be updated to keep using Everfur.",accessDenied:ACCESS_DENIED_COPY,paymentRequired:"This is part of a paid plan.",quotaExceeded:"You have used today's messages. This resets tomorrow.",rateLimited:"You are sending messages quickly. Try again in a few seconds.",validationFailed:VALIDATION_FAILED_COPY,sdkUpdateRequired:"This app needs to be updated to keep using Everfur.",conflict:"That is already running. Wait for it to finish, then try again.",idempotencyConflict:"That message was already delivered.",idempotencyInFlight:"That is still processing. Give it a moment.",conversationNotFound:"This conversation is no longer available.",petNotFound:"We could not find that pet. Please pick a pet and try again.",resourceNotFound:"We could not find that.",streamTimeout:"The response timed out. Tap retry to try again.",mediaUploadFailed:"We could not upload that photo. Please attach it again.",moderationBlocked:"This request cannot be answered here.",upstreamLlmTimeout:"The response timed out. Tap retry to try again.",internalError:"We hit a snag on our end. Please try again.",notImplemented:"That is not available yet.",serviceUnavailable:"That service is briefly unavailable. Try again shortly.",streamIncomplete:"The connection dropped mid-answer. Tap retry to continue.",identitySignatureRequired:ACCESS_DENIED_COPY,runtimeDisposed:VALIDATION_FAILED_COPY,unknown:"Something went wrong. Please try again."}),SESSION_REVOKED_COPY="This session has ended. Please sign in again.",LINKED_ACCOUNT_READ_ONLY="linked_account_read_only";function displayFor(code,wireCode,reasonCode){return code==="conflict"&&reasonCode===LINKED_ACCOUNT_READ_ONLY?ACCESS_DENIED_COPY:(code==="authRejected"||code==="authExpired")&&typeof wireCode=="string"&&wireCode.trim().toLowerCase()==="session_revoked"?SESSION_REVOKED_COPY:userFacingError(code)}function userFacingError(code){return USER_FACING_COPY[code]}function defineHidden(target,key,value){Object.defineProperty(target,key,{value:value,enumerable:false,writable:false,configurable:false})}var REASON_CODE_SHAPE=/^[a-z][a-z0-9_]{0,63}$/;function makeEverfurError(code,opts){let row=contractErrorFor(opts?.wireCode,opts?.wireEnvelope),linkedReadOnly=code==="conflict"&&opts?.reasonCode===LINKED_ACCOUNT_READ_ONLY,error={code:code,category:categoryFor(code),retryable:opts?.retryable??(linkedReadOnly?false:isRetryableCode(code)),displayMessage:displayFor(code,opts?.wireCode,linkedReadOnly?LINKED_ACCOUNT_READ_ONLY:null)};opts?.httpStatus!==void 0&&(error.httpStatus=opts.httpStatus),opts?.requestId&&(error.requestId=opts.requestId),typeof opts?.reasonCode=="string"&&REASON_CODE_SHAPE.test(opts.reasonCode)&&(error.reasonCode=opts.reasonCode);let wait=opts?.retryAfterSeconds;if(typeof wait=="number"&&Number.isFinite(wait)&&wait>=0&&(error.retryAfterSeconds=Math.round(wait)),row);return opts?.wireMessage&&defineHidden(error,"wireMessage",opts.wireMessage),opts?.raw!==void 0&&opts.raw!==null&&defineHidden(error,"raw",opts.raw),/* @__PURE__ */Object.freeze(error)}function ok(value,warning){/* @__PURE__ */
|
|
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 weightBucket(weight){return weight<=450?"regular":weight<=650?"medium":"bold"}var MONO_OF={regular:"mono",medium:"monoMedium",bold:"monoBold"};function textRole(theme,role){let byRole=roleCache.get(theme);byRole===void 0&&(byRole=/* @__PURE__ */new Map,roleCache.set(theme,byRole));let hit=byRole.get(role);if(hit!==void 0)return hit;let style=buildRole(theme,role);return byRole.set(role,style),style}var roleCache=/* @__PURE__ */new WeakMap;function buildRole(theme,role){let r=theme.type.roles[role],weight=r.weight==="400"&&r.face!=="mono"?theme.type.weight.regular:r.weight,bucket=weightBucket(Number(weight)),f=r.face==="mono"?face(theme,MONO_OF[bucket]):r.face==="heading"?headingFace(theme,bucket):face(theme,bucket),faceWeight=r.face==="heading"?theme.type.headingWeight??weight:weight,faceStyle=f.fontWeight===void 0?f:{fontFamily:f.fontFamily,fontWeight:faceWeight},fontSize=r.size,out={...faceStyle,fontSize:fontSize,lineHeight:Math.round(fontSize*r.lineHeight*100)/100};return r.letterSpacing!==0&&(out.letterSpacing=Math.round(fontSize*r.letterSpacing*100)/100),r.uppercase&&(out.textTransform="uppercase"),/* @__PURE__ */Object.freeze(out)}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 RETRYABILITY_ROWS=[{wireCode:"AccessDeniedException",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"AuthorizationException",envelope:"http_envelope",httpStatus:401,retryable:false},{wireCode:"ConflictException",envelope:"http_envelope",httpStatus:409,retryable:true},{wireCode:"DAILY_QUOTA_EXCEEDED",envelope:"http_envelope",httpStatus:429,retryable:true},{wireCode:"FILE_TOO_LARGE",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"IDEMPOTENCY_KEY_IN_FLIGHT",envelope:"http_envelope",httpStatus:409,retryable:true},{wireCode:"IDEMPOTENCY_KEY_REUSED_DIFFERENT_REQUEST",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"INVALID_CONTENT_TYPE",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"InternalFailureException",envelope:"http_envelope",httpStatus:500,retryable:true},{wireCode:"MethodNotAllowedException",envelope:"http_envelope",httpStatus:405,retryable:false},{wireCode:"NotImplementedException",envelope:"http_envelope",httpStatus:501,retryable:false},{wireCode:"PaymentRequiredException",envelope:"http_envelope",httpStatus:402,retryable:false},{wireCode:"ResourceNotFoundException",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"ServiceUnavailableException",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"TIER_UPGRADE_REQUIRED",envelope:"http_envelope",httpStatus:402,retryable:false},{wireCode:"ThrottlingException",envelope:"http_envelope",httpStatus:429,retryable:true},{wireCode:"ValidationException",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"accessDenied",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"access_denied",envelope:"oauth_error",httpStatus:302,retryable:false},{wireCode:"attachment_unreadable",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"authExpired",envelope:"http_envelope",httpStatus:401,retryable:true},{wireCode:"authRejected",envelope:"http_envelope",httpStatus:401,retryable:false},{wireCode:"catalog_empty_refused",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"catalog_shrink_refused",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"consent_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"consent_required",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"consent_scope_wrong_route",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"device_cipher_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"email_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"endpoint_not_allowed",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"event_cursor_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"event_filter_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"event_id_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"event_payload_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"event_type_not_available",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"event_type_unknown",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"idempotency_key_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"idempotency_key_required",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"idempotency_key_reused",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"inbox_cursor_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"insufficientCapability",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"insufficient_scope",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"internal_error",envelope:"sse_frame",httpStatus:200,retryable:false},{wireCode:"invalidRequest",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"invalid_client",envelope:"oauth_error",httpStatus:401,retryable:false},{wireCode:"invalid_client_metadata",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_grant",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_redirect_uri",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_request",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_scope",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_target",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"item_id_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"linked_account_read_only",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"mcp_connection_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"mcp_request_conflict",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"mcp_request_gone",envelope:"http_envelope",httpStatus:410,retryable:false},{wireCode:"mcp_request_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"not_found",envelope:"sse_frame",httpStatus:200,retryable:false},{wireCode:"open_url_not_allowed",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"partner_visit_link_conflict",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"partner_visit_owner_only",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"partner_visit_pet_already_mapped",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"payload_too_large",envelope:"http_envelope",httpStatus:413,retryable:false},{wireCode:"petRefInUse",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"pet_health_list_removals_unconfirmed",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"pet_health_species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"pet_not_registered",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"provider_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"rateLimited",envelope:"http_envelope",httpStatus:429,retryable:true},{wireCode:"read_target_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"record_species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"record_subject_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"record_upload_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"records_consent_required",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"sandbox_only",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"session_required",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"session_revoked",envelope:"http_envelope",httpStatus:401,retryable:false},{wireCode:"share_limit_reached",envelope:"http_envelope",httpStatus:429,retryable:false},{wireCode:"slow_down",envelope:"oauth_error",httpStatus:429,retryable:true},{wireCode:"species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"subscription_keys_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"tenant_filter_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"tenant_has_no_capabilities",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"tenant_resource_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"tenant_surface_not_enabled",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"timeout",envelope:"sse_frame",httpStatus:200,retryable:true},{wireCode:"token_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"unavailable",envelope:"sse_frame",httpStatus:200,retryable:true},{wireCode:"unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"unrestrictedKeyRequired",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"unsupported_grant_type",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"unsupported_response_type",envelope:"oauth_error",httpStatus:302,retryable:false},{wireCode:"user_ref_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"verify_mint_rate_limited",envelope:"http_envelope",httpStatus:429,retryable:true},{wireCode:"verify_mint_refused",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"verify_mint_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"verify_user_ref_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"web_push_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"webhook_endpoint_update_empty",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"webhook_endpoint_update_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"webhook_url_rejected",envelope:"http_envelope",httpStatus:400,retryable:false}],CONTRACT_RETRYABILITY=/* @__PURE__ */Object.freeze(RETRYABILITY_ROWS.map(row=>/* @__PURE__ */Object.freeze(row)));/* @__PURE__ */Object.freeze(CONTRACT_RETRYABILITY.map(row=>row.wireCode));var NORMALIZED_FOLD=/* @__PURE__ */Object.freeze({ValidationException:"validationFailed",AuthorizationException:"authRejected",PaymentRequiredException:"paymentRequired",AccessDeniedException:"accessDenied",ResourceNotFoundException:"resourceNotFound",ConflictException:"conflict",ThrottlingException:"rateLimited",InternalFailureException:"internalError",NotImplementedException:"notImplemented",ServiceUnavailableException:"serviceUnavailable",MethodNotAllowedException:"validationFailed",authExpired:"authExpired",unavailable:"serviceUnavailable",session_required:"sessionRequired",session_revoked:"authExpired",accessDenied:"accessDenied",invalidRequest:"sdkUpdateRequired",authRejected:"authRejected",rateLimited:"rateLimited",insufficientCapability:"accessDenied",unrestrictedKeyRequired:"accessDenied",user_ref_invalid:"validationFailed",event_cursor_invalid:"validationFailed",event_filter_invalid:"validationFailed",event_payload_invalid:"validationFailed",event_type_unknown:"validationFailed",idempotency_key_invalid:"validationFailed",idempotency_key_required:"validationFailed",idempotency_key_reused:"idempotencyConflict",payload_too_large:"validationFailed",webhook_url_rejected:"validationFailed",webhook_endpoint_update_empty:"validationFailed",webhook_endpoint_update_invalid:"validationFailed",event_type_not_available:"conflict",record_subject_not_found:"resourceNotFound",records_consent_required:"conflict",record_species_unsupported:"validationFailed",record_upload_invalid:"validationFailed",FILE_TOO_LARGE:"validationFailed",INVALID_CONTENT_TYPE:"validationFailed",attachment_unreadable:"validationFailed",provider_unsupported:"validationFailed",token_invalid:"validationFailed",device_cipher_unavailable:"serviceUnavailable",email_invalid:"validationFailed",consent_required:"validationFailed",consent_invalid:"validationFailed",consent_scope_wrong_route:"validationFailed",IDEMPOTENCY_KEY_IN_FLIGHT:"idempotencyInFlight",IDEMPOTENCY_KEY_REUSED_DIFFERENT_REQUEST:"idempotencyConflict",DAILY_QUOTA_EXCEEDED:"quotaExceeded",TIER_UPGRADE_REQUIRED:"paymentRequired",not_found:"conversationNotFound",timeout:"streamTimeout",internal_error:"internalError",invalid_request:"validationFailed",invalid_client:"authRejected",invalid_grant:"authRejected",unsupported_grant_type:"validationFailed",invalid_scope:"validationFailed",invalid_target:"validationFailed",invalid_redirect_uri:"validationFailed",invalid_client_metadata:"validationFailed",unsupported_response_type:"validationFailed",access_denied:"accessDenied",slow_down:"rateLimited",mcp_request_not_found:"resourceNotFound",mcp_request_gone:"resourceNotFound",mcp_connection_not_found:"resourceNotFound",mcp_request_conflict:"conflict",sandbox_only:"accessDenied",tenant_has_no_capabilities:"conflict",verify_mint_refused:"accessDenied",verify_mint_rate_limited:"rateLimited",verify_mint_unavailable:"serviceUnavailable",verify_user_ref_invalid:"validationFailed",insufficient_scope:"accessDenied",tenant_filter_invalid:"validationFailed",tenant_resource_not_found:"resourceNotFound",tenant_surface_not_enabled:"conflict",pet_health_species_unsupported:"validationFailed",pet_health_list_removals_unconfirmed:"validationFailed",petRefInUse:"conflict",share_limit_reached:"conflict",pet_not_registered:"resourceNotFound",species_unsupported:"validationFailed",partner_visit_owner_only:"accessDenied",partner_visit_link_conflict:"conflict",partner_visit_pet_already_mapped:"conflict",linked_account_read_only:"conflict",catalog_empty_refused:"conflict",catalog_shrink_refused:"conflict",endpoint_not_allowed:"validationFailed",event_id_invalid:"validationFailed",inbox_cursor_invalid:"validationFailed",item_id_invalid:"validationFailed",open_url_not_allowed:"validationFailed",read_target_invalid:"validationFailed",subscription_keys_invalid:"validationFailed",web_push_unavailable:"serviceUnavailable"}),CONTRACT_ERROR_ROWS=/* @__PURE__ */Object.freeze(CONTRACT_RETRYABILITY.map(generated=>/* @__PURE__ */Object.freeze({wireCode:generated.wireCode,envelope:generated.envelope,retryable:generated.retryable,normalized:NORMALIZED_FOLD[generated.wireCode]}))),BY_KEY=new Map(CONTRACT_ERROR_ROWS.map(r=>[r.envelope+r.wireCode.toUpperCase(),r])),ENVELOPE_LOOKUP_ORDER=/* @__PURE__ */Object.freeze(["http_envelope",...[...new Set(CONTRACT_ERROR_ROWS.map(r=>r.envelope))].filter(e=>e!=="http_envelope").sort()]);function contractErrorFor(wireCode,envelope){if(typeof wireCode!="string")return;let key=wireCode.trim().toUpperCase();if(key.length!==0)for(let candidate of[envelope??"http_envelope",...ENVELOPE_LOOKUP_ORDER]){let row=BY_KEY.get(candidate+key);if(row)return row}}var CATEGORY_OF=/* @__PURE__ */Object.freeze({authExpired:"authentication",authRejected:"authentication",sessionRequired:"authentication",identitySignatureRequired:"authentication",accessDenied:"authorization",paymentRequired:"entitlement",quotaExceeded:"rateLimit",rateLimited:"rateLimit",validationFailed:"invalidRequest",sdkUpdateRequired:"invalidRequest",runtimeDisposed:"invalidRequest",conversationNotFound:"notFound",petNotFound:"notFound",resourceNotFound:"notFound",conflict:"conflict",idempotencyConflict:"conflict",idempotencyInFlight:"conflict",streamTimeout:"connection",streamIncomplete:"connection",upstreamLlmTimeout:"connection",serviceUnavailable:"connection",internalError:"server",notImplemented:"server",mediaUploadFailed:"media",moderationBlocked:"policy",unknown:"unknown"});function categoryFor(code){return CATEGORY_OF[code]}function fromWire(wire){let contractRow=contractErrorFor(wire);if(contractRow)return contractRow.normalized;let upper=(wire??"").trim().toUpperCase(),canonical=upper.replace(/[^A-Z0-9]/g,"");if(canonical==="AUTHREJECTED")return"authRejected";if(upper.startsWith("AUTH"))return"authExpired";switch(canonical){case"DAILYQUOTAEXCEEDED":case"QUOTAEXCEEDED":return"quotaExceeded";case"RATELIMITED":case"TOOMANYREQUESTS":case"TELEVETRATELIMITED":return"rateLimited";case"IDEMPOTENCYKEYCONFLICT":case"IDEMPOTENCYCONFLICT":return"idempotencyConflict";case"ACCESSDENIED":case"FORBIDDEN":return"accessDenied";case"IDENTITYSIGNATUREREQUIRED":return"identitySignatureRequired";case"RUNTIMEDISPOSED":return"runtimeDisposed";case"NOTFOUND":case"CONVERSATIONNOTFOUND":return"conversationNotFound";case"PETNOTFOUND":return"petNotFound";case"TIMEOUT":case"STREAMTIMEOUT":return"streamTimeout";case"MEDIAUPLOADFAILED":case"UNRECOGNIZEDVIDEOFORMAT":case"FILETOOSMALL":return"mediaUploadFailed";case"MODERATIONBLOCKED":return"moderationBlocked";case"UPSTREAMLLMTIMEOUT":return"upstreamLlmTimeout";case"INTERNALERROR":case"INTERNALSERVERERROR":return"internalError";case"STREAMINCOMPLETE":case"CHATSTREAMINCOMPLETE":return"streamIncomplete";case"INVALIDANALYSISTYPE":case"INVALIDUPLOADPURPOSE":return"unknown";default:return"unknown"}}var AUTO_RETRYABLE_CODES=/* @__PURE__ */new Set(["streamTimeout","rateLimited","internalError","upstreamLlmTimeout","streamIncomplete"]);function isAutoRetryable(code){return AUTO_RETRYABLE_CODES.has(code)}var RETRYABLE_CONTRACT_CODES=/* @__PURE__ */new Set(["serviceUnavailable","conflict","idempotencyInFlight"]);function isRetryableCode(code){return isAutoRetryable(code)||RETRYABLE_CONTRACT_CODES.has(code)}var BACKOFF_BASE_MS=500,BACKOFF_CAP_MS=8e3,MAX_RETRY_ATTEMPTS=4;function backoffDelayMs(attempt,rng=Math.random){let bounded=Math.max(0,attempt),ceiling=Math.min(BACKOFF_BASE_MS*2**bounded,BACKOFF_CAP_MS);return Math.floor(rng()*ceiling)}var ACCESS_DENIED_COPY="This feature isn't available on your account right now.",VALIDATION_FAILED_COPY="Something in that request was not right. Check the details and try again.",USER_FACING_COPY=/* @__PURE__ */Object.freeze({authExpired:"Please sign in again to continue.",authRejected:"Please sign in again to continue.",sessionRequired:"This app needs to be updated to keep using Everfur.",accessDenied:ACCESS_DENIED_COPY,paymentRequired:"This is part of a paid plan.",quotaExceeded:"You have used today's messages. This resets tomorrow.",rateLimited:"You are sending messages quickly. Try again in a few seconds.",validationFailed:VALIDATION_FAILED_COPY,sdkUpdateRequired:"This app needs to be updated to keep using Everfur.",conflict:"That is already running. Wait for it to finish, then try again.",idempotencyConflict:"That message was already delivered.",idempotencyInFlight:"That is still processing. Give it a moment.",conversationNotFound:"This conversation is no longer available.",petNotFound:"We could not find that pet. Please pick a pet and try again.",resourceNotFound:"We could not find that.",streamTimeout:"The response timed out. Tap retry to try again.",mediaUploadFailed:"We could not upload that photo. Please attach it again.",moderationBlocked:"This request cannot be answered here.",upstreamLlmTimeout:"The response timed out. Tap retry to try again.",internalError:"We hit a snag on our end. Please try again.",notImplemented:"That is not available yet.",serviceUnavailable:"That service is briefly unavailable. Try again shortly.",streamIncomplete:"The connection dropped mid-answer. Tap retry to continue.",identitySignatureRequired:ACCESS_DENIED_COPY,runtimeDisposed:VALIDATION_FAILED_COPY,unknown:"Something went wrong. Please try again."}),SESSION_REVOKED_COPY="This session has ended. Please sign in again.",LINKED_ACCOUNT_READ_ONLY="linked_account_read_only";function displayFor(code,wireCode,reasonCode){return code==="conflict"&&reasonCode===LINKED_ACCOUNT_READ_ONLY?ACCESS_DENIED_COPY:(code==="authRejected"||code==="authExpired")&&typeof wireCode=="string"&&wireCode.trim().toLowerCase()==="session_revoked"?SESSION_REVOKED_COPY:userFacingError(code)}function userFacingError(code){return USER_FACING_COPY[code]}function defineHidden(target,key,value){Object.defineProperty(target,key,{value:value,enumerable:false,writable:false,configurable:false})}var REASON_CODE_SHAPE=/^[a-z][a-z0-9_]{0,63}$/;function makeEverfurError(code,opts){let row=contractErrorFor(opts?.wireCode,opts?.wireEnvelope),linkedReadOnly=code==="conflict"&&opts?.reasonCode===LINKED_ACCOUNT_READ_ONLY,error={code:code,category:categoryFor(code),retryable:opts?.retryable??(linkedReadOnly?false:isRetryableCode(code)),displayMessage:displayFor(code,opts?.wireCode,linkedReadOnly?LINKED_ACCOUNT_READ_ONLY:null)};opts?.httpStatus!==void 0&&(error.httpStatus=opts.httpStatus),opts?.requestId&&(error.requestId=opts.requestId),typeof opts?.reasonCode=="string"&&REASON_CODE_SHAPE.test(opts.reasonCode)&&(error.reasonCode=opts.reasonCode);let wait=opts?.retryAfterSeconds;if(typeof wait=="number"&&Number.isFinite(wait)&&wait>=0&&(error.retryAfterSeconds=Math.round(wait)),row);return opts?.wireMessage&&defineHidden(error,"wireMessage",opts.wireMessage),opts?.raw!==void 0&&opts.raw!==null&&defineHidden(error,"raw",opts.raw),/* @__PURE__ */Object.freeze(error)}function ok(value,warning){/* @__PURE__ */
|
|
3
3
|
return Object.freeze({ok:true,value:value})}function err(error){/* @__PURE__ */
|
|
4
4
|
return Object.freeze({ok:false,error:error})}var EverfurConfigError=class _EverfurConfigError extends Error{constructor(kind,message){super(message),this.name="EverfurConfigError",this.kind=kind,Object.setPrototypeOf(this,_EverfurConfigError.prototype)}};function assertNever(x){throw new Error(`assertNever: unhandled discriminated-union member ${JSON.stringify(x)}`)}function errorFrame(fields){/* @__PURE__ */
|
|
5
5
|
return Object.freeze({kind:"error",terminal:true,code:fields.code,retryable:fields.retryable,wireMessage:fields.wireMessage,synthesized:fields.synthesized,lastEventId:fields.lastEventId,serverRequestId:null})}function mintFailedError(cause,refusal){let message=cause instanceof Error?cause.message:typeof cause=="string"?cause:null;return makeEverfurError("authRejected",{retryable:false,...refusal?.wireCode?{wireCode:refusal.wireCode}:{},...refusal?.requestId?{requestId:refusal.requestId}:{},...message?{wireMessage:message}:{},...cause!=null?{raw:cause}:{}})}function authHeaders(auth){let headers={};return auth.mode==="personalized"?headers.authorization=`Bearer ${auth.token}`:headers["x-everfur-partner-key"]=auth.publishableKey,auth.userRef&&(headers["x-everfur-user-ref"]=auth.userRef),auth.sessionId&&(headers["x-everfur-session-id"]=auth.sessionId),headers}function withAuthHeaders(req,auth){return{...req,headers:{...stripAuthHeaders(req.headers),...authHeaders(auth)}}}function stripAuthHeaders(headers){if(!headers)return{};let out={};for(let[key,value]of Object.entries(headers)){let lower=key.toLowerCase();lower==="authorization"||lower==="x-everfur-partner-key"||(out[key]=value)}return out}async function authedSend(req,ctx){if(ctx.mode==="anonymous")return ctx.transport.request(withAuthHeaders(req,{mode:"anonymous",publishableKey:ctx.publishableKey,userRef:ctx.userRef,...ctx.sessionId?{sessionId:ctx.sessionId}:{}}));let token;try{token=await ctx.identity.currentToken()}catch(cause){return ctx.identity.reportRejected?.(),err(mintFailedError(cause))}let first=await ctx.transport.request(withAuthHeaders(req,{mode:"personalized",token:token,userRef:ctx.userRef,...ctx.sessionId?{sessionId:ctx.sessionId}:{}}));if(first.ok||first.error.httpStatus!==401)return first;let refreshed;try{refreshed=await ctx.identity.currentToken({forceRefresh:!0})}catch(cause){return ctx.identity.reportRejected?.(),err(mintFailedError(cause,{wireCode:wireCodeOf(first.error.raw),requestId:first.error.requestId}))}let retry=await ctx.transport.request(withAuthHeaders(req,{mode:"personalized",token:refreshed,userRef:ctx.userRef,...ctx.sessionId?{sessionId:ctx.sessionId}:{}}));return!retry.ok&&retry.error.httpStatus===401?(ctx.identity.reportRejected?.(),err(refusedAfterRemintError(retry.error))):retry}function refusedAfterRemintError(refusal){let raw=refusal.raw,wireCode=wireCodeOf(raw);return makeEverfurError("authRejected",{retryable:false,...refusal.httpStatus!==void 0?{httpStatus:refusal.httpStatus}:{},...refusal.requestId?{requestId:refusal.requestId}:{},...wireCode?{wireCode:wireCode}:{},...refusal.reasonCode?{reasonCode:refusal.reasonCode}:{},...refusal.wireMessage?{wireMessage:refusal.wireMessage}:{},...raw!=null?{raw:raw}:{}})}function wireCodeOf(body){if(typeof body!="object"||body===null)return null;let b=body,code=(typeof b.error=="object"&&b.error!==null?b.error.code:void 0)??b.code;return typeof code=="string"&&code.length>0?code:null}function networkError(cause){return makeEverfurError("internalError",{retryable:true,wireMessage:describeCause(cause)})}function describeCause(cause){return cause instanceof Error?cause.message:typeof cause=="string"?cause:"network request failed"}var FUNNEL_UNARY_TIMEOUT_MS=3e4,RETRY_OVERRIDE_MAX_MS=BACKOFF_CAP_MS*2,IDEMPOTENCY_HEADER="idempotency-key",MUTATING_METHODS=/* @__PURE__ */new Set(["POST","PUT","PATCH","DELETE"]),NOOP_OBSERVER=/* @__PURE__ */Object.freeze({onEvent(){}}),defaultFunnelTimers=/* @__PURE__ */Object.freeze({setTimeout:(handler,ms)=>setTimeout(handler,ms),clearTimeout:handle=>clearTimeout(handle),now:()=>Date.now()});function seededIdempotencyKey(seed){let safe=seed.trim().replace(/[^A-Za-z0-9_.:-]/g,"-");return safe.length===0?null:`efs_${safe}`.slice(0,128)}function createRequestFunnel(deps){let observer=deps.observer??NOOP_OBSERVER,timers=deps.timers??defaultFunnelTimers,rng=deps.rng??Math.random,sleep=deps.sleep??((ms,signal)=>delayAbortable(ms,timers,signal)),ceiling=deps.maxAttempts??MAX_RETRY_ATTEMPTS,timeoutMs=deps.unaryTimeoutMs??FUNNEL_UNARY_TIMEOUT_MS,mintKey=deps.newIdempotencyKey??defaultIdempotencyKeyFactory(),emit=event=>{try{observer.onEvent(event)}catch{}};async function send(call,req,opts){let perCallMaxAttempts=opts?.maxAttempts,maxAttempts=Math.max(1,perCallMaxAttempts??ceiling),idempotent=opts?.idempotent??MUTATING_METHODS.has(req.method),seeded=opts?.idempotencyKey===void 0?null:seededIdempotencyKey(opts.idempotencyKey),idempotencyKey=idempotent?seeded??mintKey():null,base=assembleHeaders(req,idempotencyKey),attempt=0;for(;;){let stamp=extra=>/* @__PURE__ */Object.freeze({call:call,method:req.method,path:req.path,attempt:attempt,...idempotencyKey?{idempotencyKey:idempotencyKey}:{},...extra});emit(stamp({phase:"attempt"}));let deadline=boundedSignal(timeoutMs,timers),merged=mergeSignals(deadline.signal,req.signal),settled;try{settled=await authedSend({...base,signal:merged.signal},deps.auth)}catch(cause){settled=err(networkError(cause))}finally{merged.dispose(),deadline.cancel()}if(settled.ok)return emit(stamp({phase:"settled",ok:true,reason:"ok"})),settled;let error=settled.error,decision=decideRetry(error,attempt,{maxAttempts:maxAttempts,rng:rng,now:timers.now(),aborted:req.signal?.aborted===true,...perCallMaxAttempts!==void 0?{perCallMaxAttempts:perCallMaxAttempts}:{},...deps.errorPolicy!==void 0?{policy:deps.errorPolicy}:{}}),settledEvent={ok:false,code:error.code,reason:decision.reason,...error.httpStatus!==void 0?{httpStatus:error.httpStatus}:{},...error.requestId!==void 0?{requestId:error.requestId}:{}};if(!decision.retry)return emit(stamp({phase:"settled",...settledEvent})),err(error);if(emit(stamp({phase:"retry",...settledEvent,delayMs:decision.delayMs})),await sleep(decision.delayMs,req.signal),req.signal?.aborted===true)return emit(stamp({phase:"settled",...settledEvent,reason:"aborted"})),err(error);attempt+=1}}async function authorize(req){return withAuthHeaders(req,await resolveDeviceAuth(deps.auth))}async function*stream(call,req,signal){emit(
|
|
@@ -10,7 +10,7 @@ return Object.freeze({petRef:str2(o.pet_ref)??petRef,name:str2(o.name),species:s
|
|
|
10
10
|
return Object.freeze(rows.flatMap(row=>{let pet=widgetPetFromWire(row);return pet===null?[]:[pet]}))}function createPetsRepository(auth){return createPetsRepositoryOver(createRequestFunnel({auth:auth}),createRequestFunnel({auth:auth,unaryTimeoutMs:ERASE_USER_DATA_TIMEOUT_MS}))}function createPetsRepositoryOver(funnel,eraseFunnel=funnel){let withSignal=(req,signal)=>signal?{...req,signal:signal}:req,petPath=petRef=>validate(petRef,void 0)??`/widget/v1/pets/${encodeURIComponent(petRef)}`;return{async list(opts){let res=await funnel.send("pets.list",withSignal({method:"GET",path:"/widget/v1/pets"},opts?.signal));return res.ok?ok(petListFromWire(res.value)):err(res.error)},async registerPet(petRef,profile,opts){let invalid3=validate(petRef,profile);if(invalid3!==null)return err(invalid3);let wire=toWire(profile);if("error"in wire)return err(wire.error);let base={method:"POST",path:`/widget/v1/pets/${encodeURIComponent(petRef)}`,body:wire.body},res=await funnel.send("pets.registerPet",opts?.signal?{...base,signal:opts.signal}:base);return res.ok?ok(fromWire2(res.value,petRef)):err(res.error)},async updatePet(petRef,patch,opts){let path=petPath(petRef);if(typeof path!="string")return err(path);let wire=patchToWire(patch);if("error"in wire)return err(wire.error);let res=await funnel.send("pets.updatePet",withSignal({method:"PATCH",path:path,body:wire.body},opts?.signal));return res.ok?ok(fromWire2(res.value,petRef)):err(res.error)},async getPetProfile(petRef,opts){let path=petPath(petRef);if(typeof path!="string")return err(path);let res=await funnel.send("pets.getPetProfile",withSignal({method:"GET",path:`${path}/profile`},opts?.signal));if(!res.ok)return err(res.error);let profile=widgetPetProfileFromWire(res.value);return profile===null?err(makeEverfurError("internalError",{retryable:false,httpStatus:502,wireMessage:"the pet profile response carried no pet_ref"})):ok(profile)},async deletePet(petRef,opts){let path=petPath(petRef);if(typeof path!="string")return err(path);let res=await funnel.send("pets.deletePet",withSignal({method:"DELETE",path:path},opts?.signal));return res.ok?ok(void 0):err(res.error)},async eraseUserData(opts){let res=await eraseFunnel.send("pets.eraseUserData",withSignal({method:"DELETE",path:"/widget/v1/me"},opts?.signal),{maxAttempts:1});return res.ok?ok(void 0):err(res.error)}}}var listeners=/* @__PURE__ */new WeakMap;function subscribePetsChanged(runtime,listener){let set=listeners.get(runtime);return set===void 0&&(set=/* @__PURE__ */new Set,listeners.set(runtime,set)),set.add(listener),()=>{set?.delete(listener)}}var EVERFUR_CONTEXT_SYMBOL=/* @__PURE__ */Symbol.for("@everfur/sdk#EverfurContext@v1"),globalContextHost=globalThis,EverfurContext=globalContextHost[EVERFUR_CONTEXT_SYMBOL]??(globalContextHost[EVERFUR_CONTEXT_SYMBOL]=createContext(null));EverfurContext.displayName??="EverfurContext";function useEverfurContext(){let ctx=useContext(EverfurContext);if(ctx===null)throw new EverfurConfigError("not-initialized","Everfur hooks must be called inside <EverfurProvider>. Wrap your tree once, high.");return ctx}function useEverfurPets(){let{runtime:runtime,userRef:userRef,activePet:activePetRef,scopeEpoch:scopeEpoch}=useEverfurContext(),repository=useMemo(()=>createPetsRepository(runtime.registry.services.authFor(userRef)),[runtime,userRef,scopeEpoch]),[state2,setState]=useState({repository:repository,pets:[],loading:true,error:null}),current=state2.repository===repository?state2:{pets:[],loading:true,error:null},generation=useRef(0),load2=useCallback(async()=>{let request=++generation.current;setState(previous=>({...previous,repository:repository,loading:true,error:null,pets:previous.repository===repository?previous.pets:[]}));let result=await repository.list();request===generation.current&&setState(result.ok?{repository:repository,pets:result.value,loading:false,error:null}:previous=>({repository:repository,pets:previous.repository===repository?previous.pets:[],loading:false,error:result.error}))},[repository]);useEffect(()=>(load2(),()=>{generation.current+=1}),[load2]),useEffect(()=>subscribePetsChanged(runtime,()=>{load2()}),[runtime,load2]);let activePet=useMemo(()=>activePetRef===null?null:current.pets.find(pet=>pet.petRef===activePetRef)??null,[activePetRef,current.pets]);return useMemo(()=>({pets:current.pets,activePet:activePet,loading:current.loading,error:current.error,refresh:load2}),[current.pets,current.loading,current.error,activePet,load2])}var COPY_PLACEHOLDER_PREFIX="[copy needed: ",TEXTING_COPY=/* @__PURE__ */Object.freeze({loading:"Loading",retry:"Try again",signedOut:"Sign in required",close:"Close",phoneLabel:"Mobile number",phoneHint:"We'll text a 6-digit code to confirm it's you.",phoneInvalid:"That doesn't look like a valid number. Check it and the country, then try again.",consentRequired:"Please agree to receive SMS messages to continue.",sendCode:"Send code",sendingCode:"Sending code",codeTitle:"Enter your code",codeSentTo:"We texted a 6-digit code to",codeLabel:"6-digit code",codeInvalidFormat:"Enter all 6 digits of the code.",confirmCode:"Verify",confirmingCode:"Verifying",verificationInvalid:"That code is no longer valid. Request a new one.",codeExpired:"This code has expired. Request a new one.",requestNewCode:"Request a new code",noResendsLeft:"You've requested the maximum number of codes. Please try again later or contact support.",changeNumber:"Use a different number",defaultPetLabel:"Default pet for SMS",noPetSelected:"Choose a pet",savePet:"Save",savingPet:"Saving",petSaved:"Saved",petIneligible:"That pet can't be selected anymore. Please choose another.",optedOutTitle:"SMS paused",verifiedTitle:"SMS Chat is on",disable:"Turn off SMS Chat",disabling:"Turning off",disableConfirmTitle:"Turn off SMS Chat?",disableConfirmBody:"We'll stop texting this number. You can turn it back on anytime.",disableConfirm:"Turn off",disableCancel:"Keep it on",unavailableTitle:"SMS Chat isn't available yet",unavailableBody:"We're still setting it up. Check back soon.",phoneAlreadyLinked:"This number is already linked to another Everfur account. Contact support and we'll move it for you.",providerFailed:"We couldn't send the text. Please try again.",genericFailure:"That didn't go through. Please try again.",supportReference:"Support reference:",promptBody:"Ask questions about your pet by text message, anytime. No app needed.",promptAccept:"Turn on SMS Chat",promptDismiss:"Not now",phoneCountryNotAllowed:"That doesn't look like a valid number. Check it and the country, then try again.",verificationBusy:"SMS Chat is temporarily unavailable. Please try again in a few minutes.",helpContactLabel:"Help:",reenroll:"Turn on SMS Chat",optedOutByMemberBody:"We'll stop texting this number. You can turn it back on anytime.",codeWrong:"That code didn't work. Check it and try again."}),TEXTING_BRAND_COPY=/* @__PURE__ */Object.freeze({introTitle:brand=>`Chat with ${brand} by text`,introBody:brand=>`Ask ${brand} about your pet by text, the same way you'd message a friend. We'll text you back.`,statusActive:brand=>`You can text ${brand} anytime from this number.`,optedOutBody:brand=>`You texted STOP, so we won't message you. Text START to ${brand} to turn SMS Chat back on.`,promptTitle:brand=>`Ask ${brand} by text, for every pet`,chatAskLine:brand=>`Want answers by text too? Add your mobile number and you can text ${brand} about your pet anytime.`,chatAskVerified:brand=>`Verified. You're all set to text ${brand}.`}),TEXTING_COPY_PLACEHOLDERS=/* @__PURE__ */Object.freeze(Object.keys(TEXTING_COPY).filter(key=>TEXTING_COPY[key].startsWith(COPY_PLACEHOLDER_PREFIX)));function resolveTextingCopy(overrides){if(overrides==null||typeof overrides!="object")return TEXTING_COPY;let out={...TEXTING_COPY};for(let key of Object.keys(TEXTING_COPY)){let value=overrides[key];typeof value=="string"&&value.trim().length>0&&(out[key]=value)}/* @__PURE__ */
|
|
11
11
|
return Object.freeze(out)}function resolveTextingBrandCopy(overrides){if(overrides==null||typeof overrides!="object")return TEXTING_BRAND_COPY;let out={...TEXTING_BRAND_COPY};for(let key of Object.keys(TEXTING_BRAND_COPY)){let host2=overrides[key];if(typeof host2!="function")continue;let fallback=TEXTING_BRAND_COPY[key];out[key]=brand=>{try{let text3=host2(brand);return typeof text3=="string"&&text3.trim().length>0?text3:fallback(brand)}catch{return fallback(brand)}}}/* @__PURE__ */
|
|
12
12
|
return Object.freeze(out)}var TextingCopyContext=createContext({copy:TEXTING_COPY,brandCopy:TEXTING_BRAND_COPY});function useTextingCopy(){return useContext(TextingCopyContext)}function wireCodeOf2(error){let raw=error.raw;if(typeof raw!="object"||raw===null)return null;let code=raw.code;return typeof code=="string"&&code.length>0?code:null}function foldWireReason(error,table){let wire=wireCodeOf2(error);if(wire===null)return error;let fold=table[wire];return fold===void 0?error:makeEverfurError(fold.code,{retryable:fold.retryable,...error.httpStatus!==void 0?{httpStatus:error.httpStatus}:{},...error.requestId!==void 0?{requestId:error.requestId}:{},wireCode:wire,reasonCode:wire,...error.wireMessage!==void 0?{wireMessage:error.wireMessage}:{},raw:error.raw})}function foldWireOrReason(error,table){let folded=foldWireReason(error,table);if(folded!==error||wireCodeOf2(error)!==null)return folded;let reason=error.reasonCode;if(typeof reason!="string")return error;let fold=table[reason];return fold===void 0?error:makeEverfurError(fold.code,{retryable:fold.retryable,...error.httpStatus!==void 0?{httpStatus:error.httpStatus}:{},...error.requestId!==void 0?{requestId:error.requestId}:{},wireCode:reason,reasonCode:reason,...error.wireMessage!==void 0?{wireMessage:error.wireMessage}:{},raw:error.raw})}function text2(value,max=4e3){if(typeof value!="string")return null;let trimmed=value.trim();return trimmed.length>0&&trimmed.length<=max?trimmed:null}function parseTextingProfile(raw){if(raw===null||typeof raw!="object"||Array.isArray(raw))return null;let o=raw,brandName=text2(o.brand_name,120),consentText=text2(o.consent_text),consentVersion=text2(o.consent_version,64);return brandName===null||consentText===null||consentVersion===null?null:/* @__PURE__ */Object.freeze({brandName:brandName,consentText:consentText,consentVersion:consentVersion,helpContact:text2(o.help_contact,320),isLive:o.status_is_live===true})}function toTextingE164(input){if(typeof input!="string"||input.length>40)return null;let trimmed=input.trim();if(!/^\+?[\d\s().-]+$/.test(trimmed))return null;let digits=trimmed.replace(/\D/g,"");if(trimmed.startsWith("+")&&!digits.startsWith("1"))return null;let national=digits.length===11&&digits.startsWith("1")?digits.slice(1):digits;return national.length!==10||!/^[2-9]\d{2}[2-9]\d{6}$/.test(national)?null:`+1${national}`}function isE164(value){return typeof value=="string"&&/^\+[1-9]\d{7,14}$/.test(value)}var IDENTITY_PATH="/widget/v1/me/sms-identity",VERIFY_PATH=`${IDENTITY_PATH}/verification`,CONFIRM_PATH=`${VERIFY_PATH}/confirm`,PET_PATH=`${IDENTITY_PATH}/selected-pet`,EVERFUR_TEXTING_STATUSES=/* @__PURE__ */Object.freeze(["none","pending","verified","opted_out"]),TEXTING_CODE_PATTERN=/^\d{4,8}$/,TEXTING_REASONS=/* @__PURE__ */Object.freeze({sms_not_live:{code:"accessDenied",retryable:false},consent_version_mismatch:{code:"conflict",retryable:false},pet_not_found:{code:"resourceNotFound",retryable:false},pet_species_unsupported:{code:"validationFailed",retryable:false},phone_country_not_allowed:{code:"accessDenied",retryable:false},verification_tenant_limit:{code:"rateLimited",retryable:false},verification_phone_limit:{code:"rateLimited",retryable:false},SMS_NOT_LIVE:{code:"accessDenied",retryable:false},SMS_CHAT_VERIFICATION_INVALID:{code:"validationFailed",retryable:false},SMS_CHAT_PHONE_ALREADY_LINKED:{code:"conflict",retryable:false},SMS_CHAT_PET_INELIGIBLE:{code:"validationFailed",retryable:false},SMS_CHAT_IDENTITY_NOT_FOUND:{code:"resourceNotFound",retryable:false}}),REASON_BY_WIRE=/* @__PURE__ */Object.freeze({sms_not_live:"not_live",SMS_NOT_LIVE:"not_live",session_required:"session_required",consent_version_mismatch:"consent_changed",pet_not_found:"pet_ineligible",pet_species_unsupported:"pet_ineligible",phone_country_not_allowed:"country_not_allowed",verification_phone_limit:"phone_code_limit",verification_tenant_limit:"tenant_code_limit",SMS_CHAT_VERIFICATION_INVALID:"code_invalid",SMS_CHAT_PHONE_ALREADY_LINKED:"phone_linked",SMS_CHAT_PET_INELIGIBLE:"pet_ineligible",SMS_CHAT_IDENTITY_NOT_FOUND:"no_identity"});function textingReasonOf(error){if(error==null)return null;let code=error.reasonCode??wireCodeOf2(error);return typeof code=="string"?REASON_BY_WIRE[code]??null:null}function invalid2(wireMessage){return makeEverfurError("validationFailed",{retryable:false,wireMessage:wireMessage})}function disposed(verb){return makeEverfurError("runtimeDisposed",{retryable:false,wireMessage:`the Everfur runtime is disposed; ${verb} was called after unmount`})}function malformed(call){return makeEverfurError("internalError",{retryable:false,httpStatus:502,wireMessage:`${call}: the response was not the documented shape`})}var str3=value=>typeof value=="string"&&value.length>0?value:null;function statusOf(value){return typeof value=="string"&&EVERFUR_TEXTING_STATUSES.includes(value)?value:"none"}function textingIdentityFromWire(raw){if(raw===null||typeof raw!="object")return null;let o=raw;return typeof o.status!="string"?null:/* @__PURE__ */Object.freeze({status:statusOf(o.status),phoneMasked:str3(o.phone_masked),consentVersion:str3(o.consent_version),selectedPetRef:str3(o.selected_pet_ref)})}function challengeFromWire(raw){if(raw===null||typeof raw!="object")return null;let o=raw,challengeId=str3(o.challenge_id);if(challengeId===null)return null;let attempts=o.attempts_remaining,attemptsRemaining=typeof attempts=="number"&&Number.isInteger(attempts)&&attempts>=0?attempts:null;/* @__PURE__ */
|
|
13
|
-
return Object.freeze({challengeId:challengeId,expiresAt:str3(o.expires_at),attemptsRemaining:attemptsRemaining})}function isEmptyBody(value){return value==null||value===""?true:typeof value=="object"&&!Array.isArray(value)&&Object.keys(value).length===0}var OPTED_OUT=/* @__PURE__ */Object.freeze({status:"opted_out",phoneMasked:null,consentVersion:null,selectedPetRef:null});function createTextingRepository(runtime){let over=()=>{let{services:services}=runtime.registry;return createTextingRepositoryOver({auth:services.authFor(null),...services.errorPolicy?{errorPolicy:services.errorPolicy}:{}})},gone=verb=>Promise.resolve(err(disposed(verb)));return{read:opts=>runtime.isDisposed?gone("read"):over().read(opts),startVerification:input=>runtime.isDisposed?gone("startVerification"):over().startVerification(input),confirmVerification:(id,code)=>runtime.isDisposed?gone("confirmVerification"):over().confirmVerification(id,code),selectPet:petRef=>runtime.isDisposed?gone("selectPet"):over().selectPet(petRef),optOut:()=>runtime.isDisposed?gone("optOut"):over().optOut()}}function createTextingRepositoryOver(deps){let funnel=deps.funnel??createRequestFunnel({auth:deps.auth,...deps.errorPolicy?{errorPolicy:deps.errorPolicy}:{}}),fold=error=>foldWireOrReason(error,TEXTING_REASONS),identityCall=async(call,req,opts,emptyIs)=>{let res=await funnel.send(call,req,opts);if(!res.ok)return err(fold(res.error));let identity=textingIdentityFromWire(res.value);return identity!==null?ok(identity):emptyIs!==void 0&&isEmptyBody(res.value)?ok(emptyIs):err(malformed(call))};return{read(opts){let req=opts?.signal?{method:"GET",path:IDENTITY_PATH,signal:opts.signal}:{method:"GET",path:IDENTITY_PATH};return identityCall("texting.read",req)},async startVerification(input){if(typeof input!="object"||input===null||!isE164(input.phoneE164))return err(invalid2("phoneE164 must be an E.164 number"));if(typeof input.consentVersion!="string"||input.consentVersion.length===0||input.consentVersion.length>64)return err(invalid2("consentVersion must be the tenant profile consent version (1..64 characters)"));let res=await funnel.send("texting.verification.start",{method:"POST",path:VERIFY_PATH,body:{phone_e164:input.phoneE164,consent_version:input.consentVersion}},{maxAttempts:1});if(!res.ok)return err(fold(res.error));let challenge=challengeFromWire(res.value);return challenge===null?err(malformed("texting.verification.start")):ok(challenge)},async confirmVerification(challengeId,code){return typeof challengeId!="string"||challengeId.length===0?err(invalid2("challengeId is required")):typeof code!="string"||!TEXTING_CODE_PATTERN.test(code)?err(invalid2("code must be the digits that were texted")):identityCall("texting.verification.confirm",{method:"POST",path:CONFIRM_PATH,body:{challenge_id:challengeId,code:code}},{maxAttempts:1})},async selectPet(petRef){return typeof petRef!="string"||petRef.length===0||petRef.length>128?err(invalid2("petRef must be 1..128 characters")):identityCall("texting.pet.select",{method:"PUT",path:PET_PATH,body:{pet_ref:petRef}})},optOut(){return identityCall("texting.optOut",{method:"DELETE",path:IDENTITY_PATH},void 0,OPTED_OUT)}}}function textingErrorText(error,action,codeRefusal=null,copy=TEXTING_COPY){switch(textingReasonOf(error)){case"code_invalid":return codeRefusal==="wrong"?copy.codeWrong:codeRefusal==="expired"?copy.codeExpired:copy.verificationInvalid;case"phone_linked":return copy.phoneAlreadyLinked;case"pet_ineligible":return copy.petIneligible;case"not_live":return copy.unavailableBody;case"session_required":return copy.signedOut;case"country_not_allowed":return copy.phoneCountryNotAllowed;case"phone_code_limit":return copy.noResendsLeft;case"tenant_code_limit":return copy.verificationBusy;default:return action==="start"?copy.providerFailed:copy.genericFailure}}function textingSupportText(error,copy=TEXTING_COPY){return typeof error.requestId=="string"&&error.requestId.length>0?`${copy.supportReference} ${error.requestId}`:null}function textingInputProblemText(problem,copy=TEXTING_COPY){return copy[problem]}function textingOptedOutBody(identity,brand,copy=TEXTING_COPY,brandCopy=TEXTING_BRAND_COPY){return identity!==null&&identity.phoneMasked!==null?brandCopy.optedOutBody(brand):copy.optedOutByMemberBody}function formatTextingPhone(e164){if(e164===null)return"";let match=/^\+1(\d{3})(\d{3})(\d{4})$/.exec(e164);return match===null?e164:`(${match[1]}) ${match[2]}-${match[3]}`}var INITIAL=/* @__PURE__ */Object.freeze({phase:"loading",identity:null,challenge:null,phoneE164:null,error:null,failedAction:null,codeRefusal:null,savingPet:false,resending:false});function phaseFor(identity){return identity.status==="verified"?"verified":identity.status==="opted_out"?"optedOut":"enroll"}var TextingController=class{constructor(repository,now=Date.now){this.repository=repository;this.now=now;this.snapshot=INITIAL;this.listeners=/* @__PURE__ */new Set;this.generation=0;this.consentVersion=null;this.disposed=false;this.subscribe=listener=>(this.listeners.add(listener),()=>{this.listeners.delete(listener)});this.getSnapshot=()=>this.snapshot}set(next){if(!this.disposed){this.snapshot=/* @__PURE__ */Object.freeze({...this.snapshot,codeRefusal:null,resending:false,...next});for(let listener of this.listeners)listener()}}async load(){let gen=++this.generation;this.set({phase:"loading",error:null,failedAction:null});let result=await this.repository.read();if(gen===this.generation){if(!result.ok){this.set({phase:"failed",error:result.error,failedAction:"read"});return}this.set({phase:phaseFor(result.value),identity:result.value,challenge:null,error:null,failedAction:null})}}async start(phoneE164,consentVersion){let from=this.snapshot.phase;if(from!=="enroll"&&from!=="code"&&from!=="optedOut")return false;let gen=++this.generation;this.consentVersion=consentVersion,this.set({phase:"requesting",phoneE164:phoneE164,error:null,failedAction:null,resending:from==="code"});let result=await this.repository.startVerification({phoneE164:phoneE164,consentVersion:consentVersion});return gen!==this.generation?false:result.ok?(this.set({phase:"code",challenge:result.value,error:null,failedAction:null}),true):(this.set({phase:from==="code"?"code":"enroll",error:result.error,failedAction:"start"}),false)}resend(){let{phoneE164:phoneE164}=this.snapshot;return phoneE164===null||this.consentVersion===null?Promise.resolve(false):this.start(phoneE164,this.consentVersion)}async confirm(code){let{challenge:challenge}=this.snapshot;if(this.snapshot.phase!=="code"||challenge===null)return false;let gen=++this.generation;this.set({phase:"confirming",error:null,failedAction:null});let result=await this.repository.confirmVerification(challenge.challengeId,code);if(gen!==this.generation)return false;if(!result.ok){if(textingReasonOf(result.error)!=="code_invalid")return this.set({phase:"code",error:result.error,failedAction:"confirm"}),false;let left=challenge.attemptsRemaining===null?null:Math.max(0,challenge.attemptsRemaining-1),expiresAt=challenge.expiresAt===null?Number.NaN:Date.parse(challenge.expiresAt),codeRefusal=null;return Number.isFinite(expiresAt)&&this.now()>=expiresAt?codeRefusal="expired":left===0?codeRefusal="spent":left!==null&&Number.isFinite(expiresAt)&&(codeRefusal="wrong"),this.set({phase:"code",challenge:/* @__PURE__ */Object.freeze({...challenge,attemptsRemaining:left}),error:result.error,failedAction:"confirm",codeRefusal:codeRefusal}),false}return this.set({phase:phaseFor(result.value),identity:result.value,challenge:null,error:null,failedAction:null}),true}changeNumber(){this.generation+=1,this.set({phase:"enroll",challenge:null,error:null,failedAction:null})}reenroll(){this.snapshot.phase==="optedOut"&&(this.generation+=1,this.set({phase:"enroll",challenge:null,error:null,failedAction:null}))}async selectPet(petRef){if(this.snapshot.phase!=="verified"||this.snapshot.savingPet)return false;let gen=this.generation;this.set({savingPet:true,error:null,failedAction:null});let result=await this.repository.selectPet(petRef);return gen!==this.generation?false:result.ok?(this.set({savingPet:false,identity:result.value,phase:phaseFor(result.value)}),true):(this.set({savingPet:false,error:result.error,failedAction:"selectPet"}),false)}async optOut(){if(this.snapshot.phase!=="verified")return false;let gen=++this.generation;this.set({phase:"optingOut",error:null,failedAction:null});let result=await this.repository.optOut();return gen!==this.generation?false:result.ok?(this.set({phase:"optedOut",identity:result.value,error:null,failedAction:null}),true):(this.set({phase:"verified",error:result.error,failedAction:"optOut"}),false)}dispose(){this.generation+=1,this.disposed=true,this.listeners.clear()}};function useScopedController(create,deps){let[controller,setController]=useState(create),adopted=useRef(false);return useEffect(()=>{let current=controller;return adopted.current&&(current=create(),setController(current)),adopted.current=true,()=>current.dispose()},deps),controller}function validateTextingEnroll(phone,consented){return toTextingE164(phone)===null?"phoneInvalid":consented?null:"consentRequired"}var TEXTING_UI_CODE_LENGTH=6;function validateTextingCode(code){return new RegExp(`^\\d{${TEXTING_UI_CODE_LENGTH}}$`).test(code.trim())?null:"codeInvalidFormat"}var NO_SUBSCRIPTION=()=>()=>{};function useRawTextingProfile(){let{runtime:runtime}=useEverfurContext(),source=runtime.entitlements??null,subscribe2=useCallback(listener=>source===null?NO_SUBSCRIPTION():source.subscribe(listener),[source]),read=useCallback(()=>source===null?void 0:source.getSnapshot().smsProfilePublic,[source]);return useSyncExternalStore(subscribe2,read,read)}function useEverfurTextingProfile(){let raw=useRawTextingProfile();return useMemo(()=>parseTextingProfile(raw),[raw])}function useEverfurTextingRepository(){let{runtime:runtime}=useEverfurContext();return useMemo(()=>createTextingRepository(runtime),[runtime])}function useEverfurTexting(){return useTextingState(true)}function useTextingState(read){let{userRef:userRef,scopeEpoch:scopeEpoch}=useEverfurContext(),repository=useEverfurTextingRepository(),profile=useEverfurTextingProfile(),controller=useScopedController(()=>new TextingController(repository),[repository,userRef,scopeEpoch]),loadedFor=useRef(null);useEffect(()=>{userRef===null||!read||loadedFor.current===controller||(loadedFor.current=controller,controller.load())},[controller,userRef,read]);let snapshot=useSyncExternalStore(controller.subscribe,controller.getSnapshot,controller.getSnapshot),start=useCallback(async phone=>{let e164=toTextingE164(phone);return e164===null||profile===null||userRef===null?false:controller.start(e164,profile.consentVersion)},[controller,profile,userRef]),confirm=useCallback(code=>validateTextingCode(code)===null?controller.confirm(code.trim()):Promise.resolve(false),[controller]),status;return userRef===null?status="signedOut":profile===null?status="unavailable":status=snapshot.phase,useMemo(()=>({status:status,profile:profile,snapshot:snapshot,start:start,resend:()=>controller.resend(),confirm:confirm,changeNumber:()=>controller.changeNumber(),reenroll:()=>controller.reenroll(),selectPet:petRef=>controller.selectPet(petRef),optOut:()=>controller.optOut(),refresh:()=>controller.load()}),[status,profile,snapshot,start,confirm,controller])}var freezeInPlace=Object.freeze;function deepFreeze(value){if(value!==null&&typeof value=="object"&&!Object.isFrozen(value)){freezeInPlace(value);for(let key of Object.keys(value))deepFreeze(value[key])}return value}var TEXT_SCALE_TIER_CAPS=/* @__PURE__ */Object.freeze({content:0,heading:2,control:1.8,compact:1.5,badge:1.3}),SPACE={xs:4,sm:8,md:12,lg:16,xl:24,xxl:32},RADIUS={tile:5,xs:6,sm:10,md:14,lg:20,xl:28,pill:500},TYPE_SIZE={nano:8,small:9,micro:10,tiny:11,caption:13,bodyTight:15,body:17,subtitle:20,heading:22,verdict:24},LINE_HEIGHT={tight:1.15,snug:1.3,normal:1.4,relaxed:1.55},WEIGHT={regular:"400",medium:"500",bold:"700"},LETTER_SPACING={eyebrow:1,monoWide:.9,headerBrand:-.42,tight:-.35},DEFAULT_MAX_FONT_SCALE=0,SYSTEM_FONT_FAMILY="System",SYSTEM_MONO_FAMILY="monospace",TIERS=["content","heading","control","compact","badge"];function authoredTierSizes(size){let out={};for(let tier of TIERS)out[tier]=size;return out}var NO_FONT_SOURCES=[];function baseType(){return{family:SYSTEM_FONT_FAMILY,mono:SYSTEM_MONO_FAMILY,fontUrl:null,families:{regular:SYSTEM_FONT_FAMILY,medium:SYSTEM_FONT_FAMILY,bold:SYSTEM_FONT_FAMILY,mono:SYSTEM_MONO_FAMILY,monoMedium:SYSTEM_MONO_FAMILY,monoBold:SYSTEM_MONO_FAMILY},namedFaces:{regular:false,medium:false,bold:false,mono:false,monoMedium:false,monoBold:false},fontUrls:{},size:TYPE_SIZE,tierSizes:authoredTierSizes(TYPE_SIZE),lineHeight:LINE_HEIGHT,weight:WEIGHT,letterSpacing:LETTER_SPACING,scale:1,maxScale:DEFAULT_MAX_FONT_SCALE,scaleCaps:TEXT_SCALE_TIER_CAPS,headingFamily:null,headingWeight:null,fontSources:NO_FONT_SOURCES}}var NO_SLOTS={},EASING_CURVES=/* @__PURE__ */Object.freeze({standard:/* @__PURE__ */Object.freeze([.2,0,0,1]),emphasized:/* @__PURE__ */Object.freeze([.2,.8,.2,1]),exit:/* @__PURE__ */Object.freeze([.4,0,1,1])});function cssCubicBezier(curve){return`cubic-bezier(${curve.join(", ")})`}var MOTION={duration:{instant:80,fast:140,normal:220,slow:320},spring:{gentle:{damping:18,stiffness:200}},easing:{standard:cssCubicBezier(EASING_CURVES.standard),emphasized:cssCubicBezier(EASING_CURVES.emphasized),exit:cssCubicBezier(EASING_CURVES.exit)},reducedMotion:false},LIGHT_COLOR={brand:"#10462E",brandSoft:"rgba(16,70,46,0.10)",brandSofter:"rgba(16,70,46,0.15)",brandBorder:"rgba(16,70,46,0.18)",borderHairlineGreen:"rgba(16,70,46,0.25)",brandBorderStrong:"rgba(16,70,46,0.55)",brandInk:"#10462E",linkInk:"#10462E",surface:"#FFFFFF",surfaceCream:"#FFFFFF",surfaceSubtle:"#F1F5F2",background:"#FFFFFF",borderRingCream:"#E4E4E4",chatGround:"#FFFFFF",composerFill:"#FFFFFF",composerBorder:"rgba(16,70,46,0.75)",shadow:"#0B3421",text:{primary:"#000000",secondary:"#0E462E",muted:"#6B6B6B",placeholder:"rgba(61,61,61,0.75)",onBrand:"#FFFFFF",metaCool:"#3D3D3D",timestamp:"rgba(61,61,61,0.75)"},primary:"#10462E",onPrimary:"#FFFFFF",accent:"#10462E",onAccent:"#FFFFFF",accentEdge:"#07C168",success:"#07C168",danger:"#C03410",onDanger:"#FFFFFF",errorRed:"#C03410",warningStrong:"#A45610",cautionAccent:"#D9821D",riskConcern:"#EFA700",sentiment:{up:"#07C168",neutral:"#FBC558",down:"#FF1B00"},badgeBgPositive:"rgba(7,193,104,0.12)",badgeBgCaution:"rgba(217,130,29,0.14)",badgeBgCritical:"rgba(192,52,16,0.06)",badgeBgNeutral:"rgba(107,107,107,0.12)",bubbleUser:"#10462E",bubbleAssistant:"#FFFFFF",bubbleVet:"#FFC3BC",onBubbleVet:"#000000",skeleton:"#E9F1E9",scanButtonPink:"#FFC3BC",highlight:"#FFC3BC",onHighlight:"#000000",mark:"#07C168",controlEdge:"rgba(16,70,46,0.18)",structureEdge:"rgba(16,70,46,0.25)",primaryEdge:"#10462E",checkupCardLowRiskBg:"rgba(7,193,104,0.10)",checkupCardConcernBg:"rgba(239,167,0,0.10)",info:"#10462E",badgeBgInfo:"rgba(16,70,46,0.10)",infoEdge:"rgba(16,70,46,0.25)"},EVERFUR_LIGHT=deepFreeze({brightness:"light",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false,assistantAvatarUrl:null},color:LIGHT_COLOR,space:SPACE,radius:RADIUS,type:baseType(),motion:MOTION,slots:NO_SLOTS}),DARK_COLOR={brand:"#6BD39A",brandSoft:"rgba(107,211,154,0.12)",brandSofter:"rgba(107,211,154,0.18)",brandBorder:"rgba(107,211,154,0.22)",borderHairlineGreen:"rgba(107,211,154,0.28)",brandBorderStrong:"rgba(107,211,154,0.55)",brandInk:"#6BD39A",linkInk:"#6BD39A",surface:"#1C1F23",surfaceCream:"#23272C",surfaceSubtle:"#23272C",background:"#15171A",borderRingCream:"#3A3F45",chatGround:"#1C1F23",composerFill:"#23272C",composerBorder:"rgba(107,211,154,0.75)",shadow:"#000000",text:{primary:"#F5F3F0",secondary:"#A9E4C4",muted:"#9A9A9A",placeholder:"rgba(255,255,255,0.55)",onBrand:"#0E1F17",metaCool:"#C9C9C9",timestamp:"rgba(245,243,240,0.7)"},primary:"#6BD39A",onPrimary:"#0E1F17",accent:"#6BD39A",onAccent:"#0E1F17",accentEdge:"#34D888",success:"#07C168",danger:"#F87171",onDanger:"#0E1F17",errorRed:"#FF6B5B",warningStrong:"#F0A35E",cautionAccent:"#D9821D",riskConcern:"#EFA700",sentiment:{up:"#07C168",neutral:"#FBC558",down:"#FF1B00"},badgeBgPositive:"rgba(7,193,104,0.18)",badgeBgCaution:"rgba(217,130,29,0.20)",badgeBgCritical:"rgba(185,28,28,0.22)",badgeBgNeutral:"rgba(255,255,255,0.10)",bubbleUser:"#6BD39A",bubbleAssistant:"#1C1F23",bubbleVet:"#FFC3BC",onBubbleVet:"#000000",skeleton:"#23272C",scanButtonPink:"#FFC3BC",highlight:"#605051",onHighlight:"#F5F3F0",mark:"#07C168",controlEdge:"rgba(107,211,154,0.22)",structureEdge:"rgba(107,211,154,0.28)",primaryEdge:"#6BD39A",checkupCardLowRiskBg:"rgba(7,193,104,0.16)",checkupCardConcernBg:"rgba(239,167,0,0.16)",info:"#6BD39A",badgeBgInfo:"rgba(107,211,154,0.12)",infoEdge:"rgba(107,211,154,0.28)"};deepFreeze({brightness:"dark",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false,assistantAvatarUrl:null},color:DARK_COLOR,space:SPACE,radius:RADIUS,type:baseType(),motion:MOTION,slots:NO_SLOTS});var EVERFUR_THEME_CONTEXT_SYMBOL=/* @__PURE__ */Symbol.for("@everfur/sdk#EverfurThemeContext@v1"),globalThemeHost=globalThis,EverfurThemeContext=globalThemeHost[EVERFUR_THEME_CONTEXT_SYMBOL]??(globalThemeHost[EVERFUR_THEME_CONTEXT_SYMBOL]=createContext(EVERFUR_LIGHT));EverfurThemeContext.displayName??="EverfurThemeContext";function useEverfurTheme(){return useContext(EverfurThemeContext)}function tierMultiplier(type,tier){let cap=type.scaleCaps[tier];return cap>0?cap:void 0}function Text({tier:tier="content",...props}){let{type:type}=useEverfurTheme(),cap=tierMultiplier(type,tier);return createElement(Text$1,cap===void 0?props:{maxFontSizeMultiplier:cap,...props})}var TextInput=forwardRef(function(props,ref){return createElement(TextInput$1,{...props,...ref===null?{}:{ref:ref}})});var REQUIRES=/* @__PURE__ */Object.freeze({chat:/* @__PURE__ */Object.freeze(["chat.message.create"]),records:/* @__PURE__ */Object.freeze(["records.upload.create","records.record.read"]),recordsClinic:/* @__PURE__ */Object.freeze(["records.clinic.create"]),video:/* @__PURE__ */Object.freeze(["video.gait.execute"]),photo:/* @__PURE__ */Object.freeze(["photo.checkup.execute"]),animations:/* @__PURE__ */Object.freeze(["animations.state.read"]),televet:/* @__PURE__ */Object.freeze(["televet.visit.create"]),texting:/* @__PURE__ */Object.freeze(["sms.identity.read","sms.identity.update"]),healthPlan:/* @__PURE__ */Object.freeze(["shop.plan.read","shop.plan.update"])});function requires(name){return REQUIRES[name]}function decideCapability(name,decisions,opts){let keys=requires(name),byResource=/* @__PURE__ */new Map;for(let decision of decisions)byResource.set(decision.resource,decision);if(opts?.isPending===true&&keys.some(key=>!byResource.has(key)))return freezeDecision({name:name,enabled:false,isPending:true,limits:{}});let limits=mergeLimits(keys,byResource);return keys.filter(key=>byResource.get(key)?.granted!==true).length===0?freezeDecision({name:name,enabled:true,isPending:false,limits:limits}):freezeDecision({name:name,enabled:false,isPending:false,limits:limits,disabled:disabledFor(keys,byResource)})}function mergeLimits(keys,byResource){let out={};for(let key of keys){let decisionLimits=byResource.get(key)?.limits;if(decisionLimits)for(let[limitKey,limitValue]of Object.entries(decisionLimits)){let existing=out[limitKey];out[limitKey]=existing===void 0?limitValue:Math.min(existing,limitValue)}}return out}function disabledFor(keys,byResource){for(let key of keys){let explicit=byResource.get(key)?.disabled;if(explicit)/* @__PURE__ */
|
|
13
|
+
return Object.freeze({challengeId:challengeId,expiresAt:str3(o.expires_at),attemptsRemaining:attemptsRemaining})}function isEmptyBody(value){return value==null||value===""?true:typeof value=="object"&&!Array.isArray(value)&&Object.keys(value).length===0}var OPTED_OUT=/* @__PURE__ */Object.freeze({status:"opted_out",phoneMasked:null,consentVersion:null,selectedPetRef:null});function createTextingRepository(runtime){let over=()=>{let{services:services}=runtime.registry;return createTextingRepositoryOver({auth:services.authFor(null),...services.errorPolicy?{errorPolicy:services.errorPolicy}:{}})},gone=verb=>Promise.resolve(err(disposed(verb)));return{read:opts=>runtime.isDisposed?gone("read"):over().read(opts),startVerification:input=>runtime.isDisposed?gone("startVerification"):over().startVerification(input),confirmVerification:(id,code)=>runtime.isDisposed?gone("confirmVerification"):over().confirmVerification(id,code),selectPet:petRef=>runtime.isDisposed?gone("selectPet"):over().selectPet(petRef),optOut:()=>runtime.isDisposed?gone("optOut"):over().optOut()}}function createTextingRepositoryOver(deps){let funnel=deps.funnel??createRequestFunnel({auth:deps.auth,...deps.errorPolicy?{errorPolicy:deps.errorPolicy}:{}}),fold=error=>foldWireOrReason(error,TEXTING_REASONS),identityCall=async(call,req,opts,emptyIs)=>{let res=await funnel.send(call,req,opts);if(!res.ok)return err(fold(res.error));let identity=textingIdentityFromWire(res.value);return identity!==null?ok(identity):emptyIs!==void 0&&isEmptyBody(res.value)?ok(emptyIs):err(malformed(call))};return{read(opts){let req=opts?.signal?{method:"GET",path:IDENTITY_PATH,signal:opts.signal}:{method:"GET",path:IDENTITY_PATH};return identityCall("texting.read",req)},async startVerification(input){if(typeof input!="object"||input===null||!isE164(input.phoneE164))return err(invalid2("phoneE164 must be an E.164 number"));if(typeof input.consentVersion!="string"||input.consentVersion.length===0||input.consentVersion.length>64)return err(invalid2("consentVersion must be the tenant profile consent version (1..64 characters)"));let res=await funnel.send("texting.verification.start",{method:"POST",path:VERIFY_PATH,body:{phone_e164:input.phoneE164,consent_version:input.consentVersion}},{maxAttempts:1});if(!res.ok)return err(fold(res.error));let challenge=challengeFromWire(res.value);return challenge===null?err(malformed("texting.verification.start")):ok(challenge)},async confirmVerification(challengeId,code){return typeof challengeId!="string"||challengeId.length===0?err(invalid2("challengeId is required")):typeof code!="string"||!TEXTING_CODE_PATTERN.test(code)?err(invalid2("code must be the digits that were texted")):identityCall("texting.verification.confirm",{method:"POST",path:CONFIRM_PATH,body:{challenge_id:challengeId,code:code}},{maxAttempts:1})},async selectPet(petRef){return typeof petRef!="string"||petRef.length===0||petRef.length>128?err(invalid2("petRef must be 1..128 characters")):identityCall("texting.pet.select",{method:"PUT",path:PET_PATH,body:{pet_ref:petRef}})},optOut(){return identityCall("texting.optOut",{method:"DELETE",path:IDENTITY_PATH},void 0,OPTED_OUT)}}}function textingErrorText(error,action,codeRefusal=null,copy=TEXTING_COPY){switch(textingReasonOf(error)){case"code_invalid":return codeRefusal==="wrong"?copy.codeWrong:codeRefusal==="expired"?copy.codeExpired:copy.verificationInvalid;case"phone_linked":return copy.phoneAlreadyLinked;case"pet_ineligible":return copy.petIneligible;case"not_live":return copy.unavailableBody;case"session_required":return copy.signedOut;case"country_not_allowed":return copy.phoneCountryNotAllowed;case"phone_code_limit":return copy.noResendsLeft;case"tenant_code_limit":return copy.verificationBusy;default:return action==="start"?copy.providerFailed:copy.genericFailure}}function textingSupportText(error,copy=TEXTING_COPY){return typeof error.requestId=="string"&&error.requestId.length>0?`${copy.supportReference} ${error.requestId}`:null}function textingInputProblemText(problem,copy=TEXTING_COPY){return copy[problem]}function textingOptedOutBody(identity,brand,copy=TEXTING_COPY,brandCopy=TEXTING_BRAND_COPY){return identity!==null&&identity.phoneMasked!==null?brandCopy.optedOutBody(brand):copy.optedOutByMemberBody}function formatTextingPhone(e164){if(e164===null)return"";let match=/^\+1(\d{3})(\d{3})(\d{4})$/.exec(e164);return match===null?e164:`(${match[1]}) ${match[2]}-${match[3]}`}var INITIAL=/* @__PURE__ */Object.freeze({phase:"loading",identity:null,challenge:null,phoneE164:null,error:null,failedAction:null,codeRefusal:null,savingPet:false,resending:false});function phaseFor(identity){return identity.status==="verified"?"verified":identity.status==="opted_out"?"optedOut":"enroll"}var TextingController=class{constructor(repository,now=Date.now){this.repository=repository;this.now=now;this.snapshot=INITIAL;this.listeners=/* @__PURE__ */new Set;this.generation=0;this.consentVersion=null;this.disposed=false;this.subscribe=listener=>(this.listeners.add(listener),()=>{this.listeners.delete(listener)});this.getSnapshot=()=>this.snapshot}set(next){if(!this.disposed){this.snapshot=/* @__PURE__ */Object.freeze({...this.snapshot,codeRefusal:null,resending:false,...next});for(let listener of this.listeners)listener()}}async load(){let gen=++this.generation;this.set({phase:"loading",error:null,failedAction:null});let result=await this.repository.read();if(gen===this.generation){if(!result.ok){this.set({phase:"failed",error:result.error,failedAction:"read"});return}this.set({phase:phaseFor(result.value),identity:result.value,challenge:null,error:null,failedAction:null})}}async start(phoneE164,consentVersion){let from=this.snapshot.phase;if(from!=="enroll"&&from!=="code"&&from!=="optedOut")return false;let gen=++this.generation;this.consentVersion=consentVersion,this.set({phase:"requesting",phoneE164:phoneE164,error:null,failedAction:null,resending:from==="code"});let result=await this.repository.startVerification({phoneE164:phoneE164,consentVersion:consentVersion});return gen!==this.generation?false:result.ok?(this.set({phase:"code",challenge:result.value,error:null,failedAction:null}),true):(this.set({phase:from==="code"?"code":"enroll",error:result.error,failedAction:"start"}),false)}resend(){let{phoneE164:phoneE164}=this.snapshot;return phoneE164===null||this.consentVersion===null?Promise.resolve(false):this.start(phoneE164,this.consentVersion)}async confirm(code){let{challenge:challenge}=this.snapshot;if(this.snapshot.phase!=="code"||challenge===null)return false;let gen=++this.generation;this.set({phase:"confirming",error:null,failedAction:null});let result=await this.repository.confirmVerification(challenge.challengeId,code);if(gen!==this.generation)return false;if(!result.ok){if(textingReasonOf(result.error)!=="code_invalid")return this.set({phase:"code",error:result.error,failedAction:"confirm"}),false;let left=challenge.attemptsRemaining===null?null:Math.max(0,challenge.attemptsRemaining-1),expiresAt=challenge.expiresAt===null?Number.NaN:Date.parse(challenge.expiresAt),codeRefusal=null;return Number.isFinite(expiresAt)&&this.now()>=expiresAt?codeRefusal="expired":left===0?codeRefusal="spent":left!==null&&Number.isFinite(expiresAt)&&(codeRefusal="wrong"),this.set({phase:"code",challenge:/* @__PURE__ */Object.freeze({...challenge,attemptsRemaining:left}),error:result.error,failedAction:"confirm",codeRefusal:codeRefusal}),false}return this.set({phase:phaseFor(result.value),identity:result.value,challenge:null,error:null,failedAction:null}),true}changeNumber(){this.generation+=1,this.set({phase:"enroll",challenge:null,error:null,failedAction:null})}reenroll(){this.snapshot.phase==="optedOut"&&(this.generation+=1,this.set({phase:"enroll",challenge:null,error:null,failedAction:null}))}async selectPet(petRef){if(this.snapshot.phase!=="verified"||this.snapshot.savingPet)return false;let gen=this.generation;this.set({savingPet:true,error:null,failedAction:null});let result=await this.repository.selectPet(petRef);return gen!==this.generation?false:result.ok?(this.set({savingPet:false,identity:result.value,phase:phaseFor(result.value)}),true):(this.set({savingPet:false,error:result.error,failedAction:"selectPet"}),false)}async optOut(){if(this.snapshot.phase!=="verified")return false;let gen=++this.generation;this.set({phase:"optingOut",error:null,failedAction:null});let result=await this.repository.optOut();return gen!==this.generation?false:result.ok?(this.set({phase:"optedOut",identity:result.value,error:null,failedAction:null}),true):(this.set({phase:"verified",error:result.error,failedAction:"optOut"}),false)}dispose(){this.generation+=1,this.disposed=true,this.listeners.clear()}};function useScopedController(create,deps){let[controller,setController]=useState(create),adopted=useRef(false);return useEffect(()=>{let current=controller;return adopted.current&&(current=create(),setController(current)),adopted.current=true,()=>current.dispose()},deps),controller}function validateTextingEnroll(phone,consented){return toTextingE164(phone)===null?"phoneInvalid":consented?null:"consentRequired"}var TEXTING_UI_CODE_LENGTH=6;function validateTextingCode(code){return new RegExp(`^\\d{${TEXTING_UI_CODE_LENGTH}}$`).test(code.trim())?null:"codeInvalidFormat"}var NO_SUBSCRIPTION=()=>()=>{};function useRawTextingProfile(){let{runtime:runtime}=useEverfurContext(),source=runtime.entitlements??null,subscribe2=useCallback(listener=>source===null?NO_SUBSCRIPTION():source.subscribe(listener),[source]),read=useCallback(()=>source===null?void 0:source.getSnapshot().smsProfilePublic,[source]);return useSyncExternalStore(subscribe2,read,read)}function useEverfurTextingProfile(){let raw=useRawTextingProfile();return useMemo(()=>parseTextingProfile(raw),[raw])}function useEverfurTextingRepository(){let{runtime:runtime}=useEverfurContext();return useMemo(()=>createTextingRepository(runtime),[runtime])}function useEverfurTexting(){return useTextingState(true)}function useTextingState(read){let{userRef:userRef,scopeEpoch:scopeEpoch}=useEverfurContext(),repository=useEverfurTextingRepository(),profile=useEverfurTextingProfile(),controller=useScopedController(()=>new TextingController(repository),[repository,userRef,scopeEpoch]),loadedFor=useRef(null);useEffect(()=>{userRef===null||!read||loadedFor.current===controller||(loadedFor.current=controller,controller.load())},[controller,userRef,read]);let snapshot=useSyncExternalStore(controller.subscribe,controller.getSnapshot,controller.getSnapshot),start=useCallback(async phone=>{let e164=toTextingE164(phone);return e164===null||profile===null||userRef===null?false:controller.start(e164,profile.consentVersion)},[controller,profile,userRef]),confirm=useCallback(code=>validateTextingCode(code)===null?controller.confirm(code.trim()):Promise.resolve(false),[controller]),status;return userRef===null?status="signedOut":profile===null?status="unavailable":status=snapshot.phase,useMemo(()=>({status:status,profile:profile,snapshot:snapshot,start:start,resend:()=>controller.resend(),confirm:confirm,changeNumber:()=>controller.changeNumber(),reenroll:()=>controller.reenroll(),selectPet:petRef=>controller.selectPet(petRef),optOut:()=>controller.optOut(),refresh:()=>controller.load()}),[status,profile,snapshot,start,confirm,controller])}var TYPE_ROLE_DEFAULTS=/* @__PURE__ */Object.freeze({display:/* @__PURE__ */Object.freeze({size:29,lineHeight:1.06,weight:"800",face:"heading",letterSpacing:-.01,uppercase:false,tier:"heading"}),title:/* @__PURE__ */Object.freeze({size:23,lineHeight:1.12,weight:"800",face:"heading",letterSpacing:-.01,uppercase:false,tier:"heading"}),cardTitle:/* @__PURE__ */Object.freeze({size:19,lineHeight:1.22,weight:"800",face:"sans",letterSpacing:0,uppercase:false,tier:"heading"}),rowTitle:/* @__PURE__ */Object.freeze({size:15.5,lineHeight:1.4,weight:"700",face:"sans",letterSpacing:0,uppercase:false,tier:"content"}),body:/* @__PURE__ */Object.freeze({size:15,lineHeight:1.5,weight:"400",face:"sans",letterSpacing:0,uppercase:false,tier:"content"}),message:/* @__PURE__ */Object.freeze({size:15.5,lineHeight:1.5,weight:"400",face:"sans",letterSpacing:0,uppercase:false,tier:"content"}),bodySmall:/* @__PURE__ */Object.freeze({size:14.5,lineHeight:1.4,weight:"400",face:"sans",letterSpacing:0,uppercase:false,tier:"content"}),caption:/* @__PURE__ */Object.freeze({size:13,lineHeight:1.4,weight:"400",face:"sans",letterSpacing:0,uppercase:false,tier:"content"}),label:/* @__PURE__ */Object.freeze({size:10.5,lineHeight:1.4,weight:"400",face:"mono",letterSpacing:.05,uppercase:true,tier:"compact"}),eyebrow:/* @__PURE__ */Object.freeze({size:15,lineHeight:1.5,weight:"400",face:"mono",letterSpacing:.07,uppercase:true,tier:"compact"}),chip:/* @__PURE__ */Object.freeze({size:15,lineHeight:1.3,weight:"600",face:"sans",letterSpacing:0,uppercase:false,tier:"compact"}),tab:/* @__PURE__ */Object.freeze({size:16,lineHeight:1.5,weight:"600",face:"sans",letterSpacing:0,uppercase:false,tier:"compact"}),button:/* @__PURE__ */Object.freeze({size:15,lineHeight:1.5,weight:"700",face:"sans",letterSpacing:0,uppercase:false,tier:"control"}),badge:/* @__PURE__ */Object.freeze({size:12,lineHeight:1.5,weight:"700",face:"sans",letterSpacing:0,uppercase:false,tier:"badge"})});var freezeInPlace=Object.freeze;function deepFreeze(value){if(value!==null&&typeof value=="object"&&!Object.isFrozen(value)){freezeInPlace(value);for(let key of Object.keys(value))deepFreeze(value[key])}return value}var TEXT_SCALE_TIER_CAPS=/* @__PURE__ */Object.freeze({content:0,heading:2,control:1.8,compact:1.5,badge:1.3});var SPACE={xs:4,sm:8,md:12,lg:16,xl:24,xxl:32},RADIUS={tile:5,xs:6,sm:10,md:14,lg:20,xl:28,pill:500},TYPE_SIZE={nano:8,small:9,micro:10,tiny:11,caption:13,bodyTight:15,body:17,subtitle:20,heading:22,verdict:24},LINE_HEIGHT={tight:1.15,snug:1.3,normal:1.4,relaxed:1.55},WEIGHT={regular:"400",medium:"500",bold:"700"},LETTER_SPACING={eyebrow:1,monoWide:.9,headerBrand:-.42,tight:-.35},DEFAULT_MAX_FONT_SCALE=0,SYSTEM_FONT_FAMILY="System",SYSTEM_MONO_FAMILY="monospace",TIERS=["content","heading","control","compact","badge"];function authoredTierSizes(size){let out={};for(let tier of TIERS)out[tier]=size;return out}var NO_FONT_SOURCES=[];function baseType(){return{family:SYSTEM_FONT_FAMILY,mono:SYSTEM_MONO_FAMILY,fontUrl:null,families:{regular:SYSTEM_FONT_FAMILY,medium:SYSTEM_FONT_FAMILY,bold:SYSTEM_FONT_FAMILY,mono:SYSTEM_MONO_FAMILY,monoMedium:SYSTEM_MONO_FAMILY,monoBold:SYSTEM_MONO_FAMILY},namedFaces:{regular:false,medium:false,bold:false,mono:false,monoMedium:false,monoBold:false},fontUrls:{},size:TYPE_SIZE,tierSizes:authoredTierSizes(TYPE_SIZE),lineHeight:LINE_HEIGHT,weight:WEIGHT,letterSpacing:LETTER_SPACING,scale:1,maxScale:DEFAULT_MAX_FONT_SCALE,scaleCaps:TEXT_SCALE_TIER_CAPS,headingFamily:null,headingWeight:null,fontSources:NO_FONT_SOURCES,roles:TYPE_ROLE_DEFAULTS,typeScale:1}}var NO_SLOTS={},EASING_CURVES=/* @__PURE__ */Object.freeze({standard:/* @__PURE__ */Object.freeze([.2,0,0,1]),emphasized:/* @__PURE__ */Object.freeze([.2,.8,.2,1]),exit:/* @__PURE__ */Object.freeze([.4,0,1,1])});function cssCubicBezier(curve){return`cubic-bezier(${curve.join(", ")})`}var MOTION={duration:{instant:80,fast:140,normal:220,slow:320},spring:{gentle:{damping:18,stiffness:200}},easing:{standard:cssCubicBezier(EASING_CURVES.standard),emphasized:cssCubicBezier(EASING_CURVES.emphasized),exit:cssCubicBezier(EASING_CURVES.exit)},reducedMotion:false},LIGHT_COLOR={brand:"#10462E",brandSoft:"rgba(16,70,46,0.10)",brandSofter:"rgba(16,70,46,0.15)",brandBorder:"rgba(16,70,46,0.18)",borderHairlineGreen:"rgba(16,70,46,0.25)",brandBorderStrong:"rgba(16,70,46,0.55)",brandInk:"#10462E",linkInk:"#10462E",surface:"#FFFFFF",surfaceCream:"#FFFFFF",surfaceSubtle:"#F1F5F2",background:"#FFFFFF",borderRingCream:"#E4E4E4",chatGround:"#FFFFFF",composerFill:"#FFFFFF",composerBorder:"rgba(16,70,46,0.75)",shadow:"#0B3421",text:{primary:"#000000",secondary:"#0E462E",muted:"#6B6B6B",placeholder:"rgba(61,61,61,0.75)",onBrand:"#FFFFFF",metaCool:"#3D3D3D",timestamp:"rgba(61,61,61,0.75)"},primary:"#10462E",onPrimary:"#FFFFFF",accent:"#10462E",onAccent:"#FFFFFF",accentEdge:"#07C168",success:"#07C168",danger:"#C03410",onDanger:"#FFFFFF",errorRed:"#C03410",warningStrong:"#A45610",cautionAccent:"#D9821D",riskConcern:"#EFA700",sentiment:{up:"#07C168",neutral:"#FBC558",down:"#FF1B00"},badgeBgPositive:"rgba(7,193,104,0.12)",badgeBgCaution:"rgba(217,130,29,0.14)",badgeBgCritical:"rgba(192,52,16,0.06)",badgeBgNeutral:"rgba(107,107,107,0.12)",bubbleUser:"#10462E",bubbleAssistant:"#FFFFFF",bubbleVet:"#FFC3BC",onBubbleVet:"#000000",skeleton:"#E9F1E9",scanButtonPink:"#FFC3BC",highlight:"#FFC3BC",onHighlight:"#000000",mark:"#07C168",controlEdge:"rgba(16,70,46,0.18)",structureEdge:"rgba(16,70,46,0.25)",primaryEdge:"#10462E",checkupCardLowRiskBg:"rgba(7,193,104,0.10)",checkupCardConcernBg:"rgba(239,167,0,0.10)",info:"#10462E",badgeBgInfo:"rgba(16,70,46,0.10)",infoEdge:"rgba(16,70,46,0.25)"},EVERFUR_LIGHT=deepFreeze({brightness:"light",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false,assistantAvatarUrl:null},color:LIGHT_COLOR,space:SPACE,radius:RADIUS,type:baseType(),motion:MOTION,slots:NO_SLOTS}),DARK_COLOR={brand:"#6BD39A",brandSoft:"rgba(107,211,154,0.12)",brandSofter:"rgba(107,211,154,0.18)",brandBorder:"rgba(107,211,154,0.22)",borderHairlineGreen:"rgba(107,211,154,0.28)",brandBorderStrong:"rgba(107,211,154,0.55)",brandInk:"#6BD39A",linkInk:"#6BD39A",surface:"#1C1F23",surfaceCream:"#23272C",surfaceSubtle:"#23272C",background:"#15171A",borderRingCream:"#3A3F45",chatGround:"#1C1F23",composerFill:"#23272C",composerBorder:"rgba(107,211,154,0.75)",shadow:"#000000",text:{primary:"#F5F3F0",secondary:"#A9E4C4",muted:"#9A9A9A",placeholder:"rgba(255,255,255,0.55)",onBrand:"#0E1F17",metaCool:"#C9C9C9",timestamp:"rgba(245,243,240,0.7)"},primary:"#6BD39A",onPrimary:"#0E1F17",accent:"#6BD39A",onAccent:"#0E1F17",accentEdge:"#34D888",success:"#07C168",danger:"#F87171",onDanger:"#0E1F17",errorRed:"#FF6B5B",warningStrong:"#F0A35E",cautionAccent:"#D9821D",riskConcern:"#EFA700",sentiment:{up:"#07C168",neutral:"#FBC558",down:"#FF1B00"},badgeBgPositive:"rgba(7,193,104,0.18)",badgeBgCaution:"rgba(217,130,29,0.20)",badgeBgCritical:"rgba(185,28,28,0.22)",badgeBgNeutral:"rgba(255,255,255,0.10)",bubbleUser:"#6BD39A",bubbleAssistant:"#1C1F23",bubbleVet:"#FFC3BC",onBubbleVet:"#000000",skeleton:"#23272C",scanButtonPink:"#FFC3BC",highlight:"#605051",onHighlight:"#F5F3F0",mark:"#07C168",controlEdge:"rgba(107,211,154,0.22)",structureEdge:"rgba(107,211,154,0.28)",primaryEdge:"#6BD39A",checkupCardLowRiskBg:"rgba(7,193,104,0.16)",checkupCardConcernBg:"rgba(239,167,0,0.16)",info:"#6BD39A",badgeBgInfo:"rgba(107,211,154,0.12)",infoEdge:"rgba(107,211,154,0.28)"};deepFreeze({brightness:"dark",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false,assistantAvatarUrl:null},color:DARK_COLOR,space:SPACE,radius:RADIUS,type:baseType(),motion:MOTION,slots:NO_SLOTS});var EVERFUR_THEME_CONTEXT_SYMBOL=/* @__PURE__ */Symbol.for("@everfur/sdk#EverfurThemeContext@v1"),globalThemeHost=globalThis,EverfurThemeContext=globalThemeHost[EVERFUR_THEME_CONTEXT_SYMBOL]??(globalThemeHost[EVERFUR_THEME_CONTEXT_SYMBOL]=createContext(EVERFUR_LIGHT));EverfurThemeContext.displayName??="EverfurThemeContext";function useEverfurTheme(){return useContext(EverfurThemeContext)}function tierMultiplier(type,tier){let cap=type.scaleCaps[tier];return cap>0?cap:void 0}function Text({tier:tier,variant:variant,...props}){let theme=useEverfurTheme(),role=variant===void 0?void 0:theme.type.roles[variant],cap=tierMultiplier(theme.type,tier??role?.tier??"content"),styled=variant===void 0?props:{...props,style:[{...textRole(theme,variant),color:theme.color.text.primary,flexShrink:1},props.style]};return createElement(Text$1,cap===void 0?styled:{maxFontSizeMultiplier:cap,...styled})}var TextInput=forwardRef(function(props,ref){return createElement(TextInput$1,{...props,...ref===null?{}:{ref:ref}})});var REQUIRES=/* @__PURE__ */Object.freeze({chat:/* @__PURE__ */Object.freeze(["chat.message.create"]),records:/* @__PURE__ */Object.freeze(["records.upload.create","records.record.read"]),recordsClinic:/* @__PURE__ */Object.freeze(["records.clinic.create"]),video:/* @__PURE__ */Object.freeze(["video.gait.execute"]),photo:/* @__PURE__ */Object.freeze(["photo.checkup.execute"]),animations:/* @__PURE__ */Object.freeze(["animations.state.read"]),televet:/* @__PURE__ */Object.freeze(["televet.visit.create"]),texting:/* @__PURE__ */Object.freeze(["sms.identity.read","sms.identity.update"]),healthPlan:/* @__PURE__ */Object.freeze(["shop.plan.read","shop.plan.update"])});function requires(name){return REQUIRES[name]}function decideCapability(name,decisions,opts){let keys=requires(name),byResource=/* @__PURE__ */new Map;for(let decision of decisions)byResource.set(decision.resource,decision);if(opts?.isPending===true&&keys.some(key=>!byResource.has(key)))return freezeDecision({name:name,enabled:false,isPending:true,limits:{}});let limits=mergeLimits(keys,byResource);return keys.filter(key=>byResource.get(key)?.granted!==true).length===0?freezeDecision({name:name,enabled:true,isPending:false,limits:limits}):freezeDecision({name:name,enabled:false,isPending:false,limits:limits,disabled:disabledFor(keys,byResource)})}function mergeLimits(keys,byResource){let out={};for(let key of keys){let decisionLimits=byResource.get(key)?.limits;if(decisionLimits)for(let[limitKey,limitValue]of Object.entries(decisionLimits)){let existing=out[limitKey];out[limitKey]=existing===void 0?limitValue:Math.min(existing,limitValue)}}return out}function disabledFor(keys,byResource){for(let key of keys){let explicit=byResource.get(key)?.disabled;if(explicit)/* @__PURE__ */
|
|
14
14
|
return Object.freeze({reason:explicit.reason,level:explicit.level,recoverable:explicit.recoverable})}/* @__PURE__ */
|
|
15
15
|
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__ */
|
|
16
16
|
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__ */
|
|
@@ -3,11 +3,13 @@ import { ReactNode, CSSProperties } from 'react';
|
|
|
3
3
|
import { a as CapabilityDecision } from './resolve.d-BTC3b6FW.cjs';
|
|
4
4
|
import { E as EverfurError } from './EverfurError.d-8NHtlgzA.cjs';
|
|
5
5
|
import { P as PetRef } from './ids.d-B2GAAifq.cjs';
|
|
6
|
-
import {
|
|
7
|
-
import { H as HealthPlanBlanksFacts, a as
|
|
6
|
+
import { H as HealthPlanItem } from './healthPlanRepository.d-fPbLceBr.cjs';
|
|
7
|
+
import { H as HealthPlanBlanksFacts, a as HealthPlanEmptyCopy } from './usePresentation.d-BHO_uZ31.cjs';
|
|
8
|
+
import { H as HealthPlanPriceFormat, a as HealthPlanLayoutProps } from './layout.d-ByfOEhpG.cjs';
|
|
8
9
|
import { L as LifecyclePort } from './LifecyclePort.d-Cr1p33a7.cjs';
|
|
9
10
|
import { E as EverfurResult } from './EverfurResult.d-BFH-3s6E.cjs';
|
|
10
|
-
import { i as
|
|
11
|
+
import { c as HealthPlanFocusDesign, d as HealthPlanFocusCopy, e as HealthPlanFocusClassNames, f as HealthPlanFocusIcon, g as HealthPlanSubscription, h as HealthPlanOneBoxOrder, i as HealthPlanSubscriptionRepository, j as HealthPlanPageRepository, k as HealthPlanShopOrder, l as HealthPlanCheckoutProvider } from './focus.d-B0qweva0.cjs';
|
|
12
|
+
import { i as EverfurPresentationInput } from './presentation.d-BvZs_jN-.cjs';
|
|
11
13
|
import { a as EverfurChatTopCard$1, b as EverfurChatOpeningCard$1 } from './threadOptions.d-CW51PyVd.cjs';
|
|
12
14
|
|
|
13
15
|
/** One line of a cart handed to your own checkout (`onCheckoutLines`): the product and its box count. */
|
|
@@ -252,8 +254,6 @@ interface EverfurHealthPlanProps extends HealthPlanLayoutProps {
|
|
|
252
254
|
/** Your words for the empty state, over the SDK's (empty until the designer writes them: then nothing is drawn). */
|
|
253
255
|
readonly emptyCopy?: Partial<HealthPlanEmptyCopy>;
|
|
254
256
|
}
|
|
255
|
-
/** One pet's Health Plan on a web page. Mount it under the `EverfurProvider` from "@everfur/sdk/web". */
|
|
256
|
-
declare function EverfurHealthPlan(props: EverfurHealthPlanProps): ReactNode;
|
|
257
257
|
|
|
258
258
|
/**
|
|
259
259
|
* The history bar: a "Chats" control with the member's thread count that opens the history drawer, and a "New
|
|
@@ -477,4 +477,4 @@ interface EverfurChatHistorySheet {
|
|
|
477
477
|
};
|
|
478
478
|
}
|
|
479
479
|
|
|
480
|
-
export {
|
|
480
|
+
export type { EverfurChatEmptyState as E, HealthPlanFocusProps as H, EverfurChatHistoryBar as a, EverfurChatOpeningCard as b, EverfurChatAnswerCards as c, EverfurChatTopCard as d, EverfurChatHistorySheet as e, EverfurHealthPlanProps as f, EverfurChatAnswerCard as g, EverfurChatAnswerContext as h, EverfurChatFollowUpAction as i, HealthPlanCheckoutLine as j, HealthPlanFocusLayer as k, HealthPlanFocusOptions as l, HealthPlanFocusOverlay as m, HealthPlanFocusOverlayControls as n, HealthPlanProductPageOptions as o, HealthPlanTodayOptions as p };
|
|
@@ -3,11 +3,13 @@ import { ReactNode, CSSProperties } from 'react';
|
|
|
3
3
|
import { a as CapabilityDecision } from './resolve.d-BTC3b6FW.js';
|
|
4
4
|
import { E as EverfurError } from './EverfurError.d-8NHtlgzA.js';
|
|
5
5
|
import { P as PetRef } from './ids.d-B2GAAifq.js';
|
|
6
|
-
import {
|
|
7
|
-
import { H as HealthPlanBlanksFacts, a as
|
|
6
|
+
import { H as HealthPlanItem } from './healthPlanRepository.d-CdCyUWph.js';
|
|
7
|
+
import { H as HealthPlanBlanksFacts, a as HealthPlanEmptyCopy } from './usePresentation.d-Dr7iD-4Y.js';
|
|
8
|
+
import { H as HealthPlanPriceFormat, a as HealthPlanLayoutProps } from './layout.d-D3d4QMeO.js';
|
|
8
9
|
import { L as LifecyclePort } from './LifecyclePort.d-Cr1p33a7.js';
|
|
9
10
|
import { E as EverfurResult } from './EverfurResult.d-D_-254ZY.js';
|
|
10
|
-
import { i as
|
|
11
|
+
import { c as HealthPlanFocusDesign, d as HealthPlanFocusCopy, e as HealthPlanFocusClassNames, f as HealthPlanFocusIcon, g as HealthPlanSubscription, h as HealthPlanOneBoxOrder, i as HealthPlanSubscriptionRepository, j as HealthPlanPageRepository, k as HealthPlanShopOrder, l as HealthPlanCheckoutProvider } from './focus.d-7G0BBmA9.js';
|
|
12
|
+
import { i as EverfurPresentationInput } from './presentation.d-BvZs_jN-.js';
|
|
11
13
|
import { a as EverfurChatTopCard$1, b as EverfurChatOpeningCard$1 } from './threadOptions.d-CW51PyVd.js';
|
|
12
14
|
|
|
13
15
|
/** One line of a cart handed to your own checkout (`onCheckoutLines`): the product and its box count. */
|
|
@@ -252,8 +254,6 @@ interface EverfurHealthPlanProps extends HealthPlanLayoutProps {
|
|
|
252
254
|
/** Your words for the empty state, over the SDK's (empty until the designer writes them: then nothing is drawn). */
|
|
253
255
|
readonly emptyCopy?: Partial<HealthPlanEmptyCopy>;
|
|
254
256
|
}
|
|
255
|
-
/** One pet's Health Plan on a web page. Mount it under the `EverfurProvider` from "@everfur/sdk/web". */
|
|
256
|
-
declare function EverfurHealthPlan(props: EverfurHealthPlanProps): ReactNode;
|
|
257
257
|
|
|
258
258
|
/**
|
|
259
259
|
* The history bar: a "Chats" control with the member's thread count that opens the history drawer, and a "New
|
|
@@ -477,4 +477,4 @@ interface EverfurChatHistorySheet {
|
|
|
477
477
|
};
|
|
478
478
|
}
|
|
479
479
|
|
|
480
|
-
export {
|
|
480
|
+
export type { EverfurChatEmptyState as E, HealthPlanFocusProps as H, EverfurChatHistoryBar as a, EverfurChatOpeningCard as b, EverfurChatAnswerCards as c, EverfurChatTopCard as d, EverfurChatHistorySheet as e, EverfurHealthPlanProps as f, EverfurChatAnswerCard as g, EverfurChatAnswerContext as h, EverfurChatFollowUpAction as i, HealthPlanCheckoutLine as j, HealthPlanFocusLayer as k, HealthPlanFocusOptions as l, HealthPlanFocusOverlay as m, HealthPlanFocusOverlayControls as n, HealthPlanProductPageOptions as o, HealthPlanTodayOptions as p };
|
|
@@ -1,5 +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 { p as RecordsTimelineView } from './depth.d-
|
|
2
|
+
import { p as RecordsTimelineView } from './depth.d-De5pT7vA.cjs';
|
|
3
3
|
|
|
4
4
|
type TimelineRowKind = 'visit' | 'vaccine' | 'weight' | 'medication';
|
|
5
5
|
interface TimelineRow {
|
|
@@ -1,5 +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 { p as RecordsTimelineView } from './depth.d-
|
|
2
|
+
import { p as RecordsTimelineView } from './depth.d-C_HL8yAz.js';
|
|
3
3
|
|
|
4
4
|
type TimelineRowKind = 'visit' | 'vaccine' | 'weight' | 'medication';
|
|
5
5
|
interface TimelineRow {
|
|
@@ -76,6 +76,29 @@ type SlotSurrounds = Readonly<Partial<Record<EverfurThemeSlotName, readonly stri
|
|
|
76
76
|
*/
|
|
77
77
|
declare function guardSlotContrast(slots: EverfurThemeSlots, grounds?: SlotGrounds, surrounds?: SlotSurrounds): EverfurThemeSlots;
|
|
78
78
|
|
|
79
|
+
/** The named text roles every SDK surface draws with (`theme.type.roles`). */
|
|
80
|
+
type EverfurTypeRole = 'display' | 'title' | 'cardTitle' | 'rowTitle' | 'body' | 'message' | 'bodySmall' | 'caption' | 'label' | 'eyebrow' | 'chip' | 'tab' | 'button' | 'badge';
|
|
81
|
+
/** The face a role is drawn in: the body sans, the heading face (`heading_font_family`, else the sans), or the mono. */
|
|
82
|
+
type EverfurTypeRoleFace = 'sans' | 'heading' | 'mono';
|
|
83
|
+
/** One role of the type scale. */
|
|
84
|
+
interface EverfurTypeRoleStyle {
|
|
85
|
+
/** The size in px (dp on React Native) at a text scale of 1. */
|
|
86
|
+
readonly size: number;
|
|
87
|
+
/** The line height as a multiple of `size`. */
|
|
88
|
+
readonly lineHeight: number;
|
|
89
|
+
readonly weight: EverfurFontWeight;
|
|
90
|
+
readonly face: EverfurTypeRoleFace;
|
|
91
|
+
/** The tracking in em (a fraction of `size`). */
|
|
92
|
+
readonly letterSpacing: number;
|
|
93
|
+
readonly uppercase: boolean;
|
|
94
|
+
/** How far the role follows the user's text size (`type.scaleCaps`). */
|
|
95
|
+
readonly tier: EverfurTextScaleTier;
|
|
96
|
+
}
|
|
97
|
+
/** The roles in their order of the scale. */
|
|
98
|
+
declare const TYPE_ROLE_NAMES: readonly EverfurTypeRole[];
|
|
99
|
+
/** The measured defaults, one per role. */
|
|
100
|
+
declare const TYPE_ROLE_DEFAULTS: Readonly<Record<EverfurTypeRole, EverfurTypeRoleStyle>>;
|
|
101
|
+
|
|
79
102
|
/** Recursively freeze a plain object/array tree in place and return it (typed as the input). */
|
|
80
103
|
declare function deepFreeze<T>(value: T): T;
|
|
81
104
|
/** Foreground text tokens; the semantic text ramp over surfaces. */
|
|
@@ -307,6 +330,15 @@ type EverfurTextScaleTier = 'content' | 'heading' | 'control' | 'compact' | 'bad
|
|
|
307
330
|
* values, verbatim. A tenant's `accessibility_max_font_scale` may lower the chrome tiers further, never content.
|
|
308
331
|
*/
|
|
309
332
|
declare const TEXT_SCALE_TIER_CAPS: Readonly<Record<EverfurTextScaleTier, number>>;
|
|
333
|
+
/**
|
|
334
|
+
* The caps of the PHONE type profile (`ResolveThemeInput.typeProfile: 'phone'`, what the React Native host resolves
|
|
335
|
+
* with): the SDK draws inside a partner's app, beside the partner's own header and tab bar, so unlike the Everfur app
|
|
336
|
+
* (`TEXT_SCALE_TIER_CAPS`) it bounds the chrome. Content (body and message text) stays uncapped, as in the Everfur
|
|
337
|
+
* app, so a member on an accessibility text size gets the size they chose (WCAG 1.4.4); the layouts wrap it. Controls stop at
|
|
338
|
+
* 1.35 (iOS's largest standard size, xxxLarge), headings at 1.4, chips and labels at 1.3, badges at 1.2. A partner
|
|
339
|
+
* changes any tier with `text_scale_caps` (0 lifts a cap) and lowers the chrome with `accessibility_max_font_scale`.
|
|
340
|
+
*/
|
|
341
|
+
declare const PHONE_TEXT_SCALE_CAPS: Readonly<Record<EverfurTextScaleTier, number>>;
|
|
310
342
|
/** The family rendered at each face. Every entry is populated (the compiled default is the platform font). */
|
|
311
343
|
type EverfurFontFamilies = Readonly<Record<EverfurFontFaceKey, string>>;
|
|
312
344
|
/**
|
|
@@ -371,6 +403,16 @@ interface EverfurTypeTokens {
|
|
|
371
403
|
* passes the family). Empty by default.
|
|
372
404
|
*/
|
|
373
405
|
readonly fontSources: readonly EverfurFontSource[];
|
|
406
|
+
/**
|
|
407
|
+
* The type scale by role (`display`, `title`, `cardTitle`, `rowTitle`, `body`, `message`, `bodySmall`, `caption`,
|
|
408
|
+
* `label`, `eyebrow`, `chip`, `tab`, `button`, `badge`): the designer's partner phone, measured
|
|
409
|
+
* (`TYPE_ROLE_DEFAULTS`), with the partner's `type_roles`, `font_size_base`, `line_height` and `type_scale` applied.
|
|
410
|
+
* Draw with `textRole(theme, role)` (typeStyle.ts), which maps the role's face onto the theme's families. On the web
|
|
411
|
+
* each size already carries the user's text scale up to its tier's cap, as `tierSizes` does.
|
|
412
|
+
*/
|
|
413
|
+
readonly roles: Readonly<Record<EverfurTypeRole, EverfurTypeRoleStyle>>;
|
|
414
|
+
/** The partner's factor over every size (`type_scale`, 0.8 to 1.3); 1 by default. */
|
|
415
|
+
readonly typeScale: number;
|
|
374
416
|
}
|
|
375
417
|
/**
|
|
376
418
|
* One font the theme asks the web host to load (`appearance.fonts`). Exactly one of `src` (an https font file, loaded
|
|
@@ -469,4 +511,4 @@ declare const EVERFUR_LIGHT: EverfurTheme;
|
|
|
469
511
|
/** The compiled DARK default (deeply frozen). */
|
|
470
512
|
declare const EVERFUR_DARK: EverfurTheme;
|
|
471
513
|
|
|
472
|
-
export {
|
|
514
|
+
export { THEME_SLOT_NAMES as A, TYPE_ROLE_DEFAULTS as B, TYPE_ROLE_NAMES as C, themeSlotKeysFor as D, type EverfurColorTokens as E, DEFAULT_MAX_FONT_SCALE as F, EASING_CURVES as G, EVERFUR_DARK as H, EVERFUR_LIGHT as I, type EverfurEasingCurve as J, SLOT_MIN_CONTRAST as K, SYSTEM_FONT_FAMILY as L, SYSTEM_MONO_FAMILY as M, type SlotGrounds as N, type SlotSurrounds as O, PHONE_TEXT_SCALE_CAPS as P, TEXT_SCALE_TIER_CAPS as Q, cssCubicBezier as R, SLOT_MIN_BORDER_CONTRAST as S, THEME_SLOT_KEYS as T, deepFreeze as U, guardSlotContrast as V, mergeThemeSlots as W, parseThemeSlots as X, type EverfurFontFaceKey as a, type EverfurFontFamilies as b, type EverfurFontSource as c, type EverfurFontWeight as d, type EverfurLetterSpacingTokens as e, type EverfurLineHeightTokens as f, type EverfurMotionDurationTokens as g, type EverfurMotionTokens as h, type EverfurRadiusTokens as i, type EverfurSpaceTokens as j, type EverfurSpringToken as k, type EverfurTextColorTokens as l, type EverfurTextScaleTier as m, type EverfurTheme as n, type EverfurThemeMeta as o, type EverfurThemeSlot as p, type EverfurThemeSlotKey as q, type EverfurThemeSlotName as r, type EverfurThemeSlots as s, type EverfurTypeRole as t, type EverfurTypeRoleFace as u, type EverfurTypeRoleStyle as v, type EverfurTypeSizeTokens as w, type EverfurTypeTokens as x, type EverfurWeightTokens as y, THEME_SLOT_KEYS_BY_SLOT as z };
|
|
@@ -76,6 +76,29 @@ type SlotSurrounds = Readonly<Partial<Record<EverfurThemeSlotName, readonly stri
|
|
|
76
76
|
*/
|
|
77
77
|
declare function guardSlotContrast(slots: EverfurThemeSlots, grounds?: SlotGrounds, surrounds?: SlotSurrounds): EverfurThemeSlots;
|
|
78
78
|
|
|
79
|
+
/** The named text roles every SDK surface draws with (`theme.type.roles`). */
|
|
80
|
+
type EverfurTypeRole = 'display' | 'title' | 'cardTitle' | 'rowTitle' | 'body' | 'message' | 'bodySmall' | 'caption' | 'label' | 'eyebrow' | 'chip' | 'tab' | 'button' | 'badge';
|
|
81
|
+
/** The face a role is drawn in: the body sans, the heading face (`heading_font_family`, else the sans), or the mono. */
|
|
82
|
+
type EverfurTypeRoleFace = 'sans' | 'heading' | 'mono';
|
|
83
|
+
/** One role of the type scale. */
|
|
84
|
+
interface EverfurTypeRoleStyle {
|
|
85
|
+
/** The size in px (dp on React Native) at a text scale of 1. */
|
|
86
|
+
readonly size: number;
|
|
87
|
+
/** The line height as a multiple of `size`. */
|
|
88
|
+
readonly lineHeight: number;
|
|
89
|
+
readonly weight: EverfurFontWeight;
|
|
90
|
+
readonly face: EverfurTypeRoleFace;
|
|
91
|
+
/** The tracking in em (a fraction of `size`). */
|
|
92
|
+
readonly letterSpacing: number;
|
|
93
|
+
readonly uppercase: boolean;
|
|
94
|
+
/** How far the role follows the user's text size (`type.scaleCaps`). */
|
|
95
|
+
readonly tier: EverfurTextScaleTier;
|
|
96
|
+
}
|
|
97
|
+
/** The roles in their order of the scale. */
|
|
98
|
+
declare const TYPE_ROLE_NAMES: readonly EverfurTypeRole[];
|
|
99
|
+
/** The measured defaults, one per role. */
|
|
100
|
+
declare const TYPE_ROLE_DEFAULTS: Readonly<Record<EverfurTypeRole, EverfurTypeRoleStyle>>;
|
|
101
|
+
|
|
79
102
|
/** Recursively freeze a plain object/array tree in place and return it (typed as the input). */
|
|
80
103
|
declare function deepFreeze<T>(value: T): T;
|
|
81
104
|
/** Foreground text tokens; the semantic text ramp over surfaces. */
|
|
@@ -307,6 +330,15 @@ type EverfurTextScaleTier = 'content' | 'heading' | 'control' | 'compact' | 'bad
|
|
|
307
330
|
* values, verbatim. A tenant's `accessibility_max_font_scale` may lower the chrome tiers further, never content.
|
|
308
331
|
*/
|
|
309
332
|
declare const TEXT_SCALE_TIER_CAPS: Readonly<Record<EverfurTextScaleTier, number>>;
|
|
333
|
+
/**
|
|
334
|
+
* The caps of the PHONE type profile (`ResolveThemeInput.typeProfile: 'phone'`, what the React Native host resolves
|
|
335
|
+
* with): the SDK draws inside a partner's app, beside the partner's own header and tab bar, so unlike the Everfur app
|
|
336
|
+
* (`TEXT_SCALE_TIER_CAPS`) it bounds the chrome. Content (body and message text) stays uncapped, as in the Everfur
|
|
337
|
+
* app, so a member on an accessibility text size gets the size they chose (WCAG 1.4.4); the layouts wrap it. Controls stop at
|
|
338
|
+
* 1.35 (iOS's largest standard size, xxxLarge), headings at 1.4, chips and labels at 1.3, badges at 1.2. A partner
|
|
339
|
+
* changes any tier with `text_scale_caps` (0 lifts a cap) and lowers the chrome with `accessibility_max_font_scale`.
|
|
340
|
+
*/
|
|
341
|
+
declare const PHONE_TEXT_SCALE_CAPS: Readonly<Record<EverfurTextScaleTier, number>>;
|
|
310
342
|
/** The family rendered at each face. Every entry is populated (the compiled default is the platform font). */
|
|
311
343
|
type EverfurFontFamilies = Readonly<Record<EverfurFontFaceKey, string>>;
|
|
312
344
|
/**
|
|
@@ -371,6 +403,16 @@ interface EverfurTypeTokens {
|
|
|
371
403
|
* passes the family). Empty by default.
|
|
372
404
|
*/
|
|
373
405
|
readonly fontSources: readonly EverfurFontSource[];
|
|
406
|
+
/**
|
|
407
|
+
* The type scale by role (`display`, `title`, `cardTitle`, `rowTitle`, `body`, `message`, `bodySmall`, `caption`,
|
|
408
|
+
* `label`, `eyebrow`, `chip`, `tab`, `button`, `badge`): the designer's partner phone, measured
|
|
409
|
+
* (`TYPE_ROLE_DEFAULTS`), with the partner's `type_roles`, `font_size_base`, `line_height` and `type_scale` applied.
|
|
410
|
+
* Draw with `textRole(theme, role)` (typeStyle.ts), which maps the role's face onto the theme's families. On the web
|
|
411
|
+
* each size already carries the user's text scale up to its tier's cap, as `tierSizes` does.
|
|
412
|
+
*/
|
|
413
|
+
readonly roles: Readonly<Record<EverfurTypeRole, EverfurTypeRoleStyle>>;
|
|
414
|
+
/** The partner's factor over every size (`type_scale`, 0.8 to 1.3); 1 by default. */
|
|
415
|
+
readonly typeScale: number;
|
|
374
416
|
}
|
|
375
417
|
/**
|
|
376
418
|
* One font the theme asks the web host to load (`appearance.fonts`). Exactly one of `src` (an https font file, loaded
|
|
@@ -469,4 +511,4 @@ declare const EVERFUR_LIGHT: EverfurTheme;
|
|
|
469
511
|
/** The compiled DARK default (deeply frozen). */
|
|
470
512
|
declare const EVERFUR_DARK: EverfurTheme;
|
|
471
513
|
|
|
472
|
-
export {
|
|
514
|
+
export { THEME_SLOT_NAMES as A, TYPE_ROLE_DEFAULTS as B, TYPE_ROLE_NAMES as C, themeSlotKeysFor as D, type EverfurColorTokens as E, DEFAULT_MAX_FONT_SCALE as F, EASING_CURVES as G, EVERFUR_DARK as H, EVERFUR_LIGHT as I, type EverfurEasingCurve as J, SLOT_MIN_CONTRAST as K, SYSTEM_FONT_FAMILY as L, SYSTEM_MONO_FAMILY as M, type SlotGrounds as N, type SlotSurrounds as O, PHONE_TEXT_SCALE_CAPS as P, TEXT_SCALE_TIER_CAPS as Q, cssCubicBezier as R, SLOT_MIN_BORDER_CONTRAST as S, THEME_SLOT_KEYS as T, deepFreeze as U, guardSlotContrast as V, mergeThemeSlots as W, parseThemeSlots as X, type EverfurFontFaceKey as a, type EverfurFontFamilies as b, type EverfurFontSource as c, type EverfurFontWeight as d, type EverfurLetterSpacingTokens as e, type EverfurLineHeightTokens as f, type EverfurMotionDurationTokens as g, type EverfurMotionTokens as h, type EverfurRadiusTokens as i, type EverfurSpaceTokens as j, type EverfurSpringToken as k, type EverfurTextColorTokens as l, type EverfurTextScaleTier as m, type EverfurTheme as n, type EverfurThemeMeta as o, type EverfurThemeSlot as p, type EverfurThemeSlotKey as q, type EverfurThemeSlotName as r, type EverfurThemeSlots as s, type EverfurTypeRole as t, type EverfurTypeRoleFace as u, type EverfurTypeRoleStyle as v, type EverfurTypeSizeTokens as w, type EverfurTypeTokens as x, type EverfurWeightTokens as y, THEME_SLOT_KEYS_BY_SLOT as z };
|
|
@@ -1,6 +1,6 @@
|
|
|
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 { C as ClientBranding, E as EverfurThemeInput } from './branding.d-
|
|
3
|
-
import {
|
|
2
|
+
import { C as ClientBranding, E as EverfurThemeInput } from './branding.d-G7rpxDhI.cjs';
|
|
3
|
+
import { n as EverfurTheme, d as EverfurFontWeight, a as EverfurFontFaceKey, t as EverfurTypeRole } from './tokens.d-DH1mYjZl.cjs';
|
|
4
4
|
|
|
5
5
|
/** One partner input the contrast guard adjusted. */
|
|
6
6
|
interface EverfurThemeAdjustment {
|
|
@@ -76,6 +76,14 @@ interface ResolveThemeInput {
|
|
|
76
76
|
* collapsing to the platform's regular. Only named faces are asked about; a throw reads as null.
|
|
77
77
|
*/
|
|
78
78
|
readonly isFontRegistered?: (family: string) => boolean | null;
|
|
79
|
+
/**
|
|
80
|
+
* The type profile of the host. `phone` (the React Native host): the size table (`type.size`) is drawn from the
|
|
81
|
+
* type roles, the designer's partner phone, so `size.body` is the phone's body (15, not 17), and every text tier is
|
|
82
|
+
* capped (`PHONE_TEXT_SCALE_CAPS`, content included). Absent (the web): the design tokens' table and the Everfur
|
|
83
|
+
* app's caps (`TEXT_SCALE_TIER_CAPS`, content uncapped), unchanged. A partner's `text_scale_caps` and
|
|
84
|
+
* `accessibility_max_font_scale` apply over either.
|
|
85
|
+
*/
|
|
86
|
+
readonly typeProfile?: 'phone';
|
|
79
87
|
}
|
|
80
88
|
/** The smallest effective text scale the resolver will report (a device may ask for less; the surfaces stop here). */
|
|
81
89
|
declare const TEXT_SCALE_FLOOR = 0.5;
|
|
@@ -136,5 +144,23 @@ declare function face(theme: EverfurTheme, weight: EverfurFontFaceKey): EverfurF
|
|
|
136
144
|
* exists to avoid). With neither set this is exactly `face(theme, fallback)`, so Everfur's look is unchanged.
|
|
137
145
|
*/
|
|
138
146
|
declare function headingFace(theme: EverfurTheme, fallback?: EverfurFontFaceKey): EverfurFaceStyle;
|
|
147
|
+
/**
|
|
148
|
+
* The text style of one type role (`theme.type.roles`): the family and weight, the size, the line height and the
|
|
149
|
+
* tracking in px, and the case. Spread it into a style and add the colour:
|
|
150
|
+
* `{ ...textRole(theme, 'body'), color: theme.color.text.primary }`.
|
|
151
|
+
*/
|
|
152
|
+
interface EverfurRoleTextStyle extends EverfurFaceStyle {
|
|
153
|
+
readonly fontSize: number;
|
|
154
|
+
readonly lineHeight: number;
|
|
155
|
+
readonly letterSpacing?: number;
|
|
156
|
+
readonly textTransform?: 'uppercase';
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* The style of `role` in `theme`, faces mapped as `face()` maps them: a NAMED face alone (its weight is baked in), a
|
|
160
|
+
* base family with the role's numeric weight. The partner's body weight (`font_weight_body`) replaces a regular role's
|
|
161
|
+
* 400; the heading face (`heading_font_family`, `font_weight_heading`) draws a `heading` role. Pure and total; cached
|
|
162
|
+
* per theme, so a surface may call it in render.
|
|
163
|
+
*/
|
|
164
|
+
declare function textRole(theme: EverfurTheme, role: EverfurTypeRole): EverfurRoleTextStyle;
|
|
139
165
|
|
|
140
|
-
export { type EverfurFaceStyle as E, type ResolveThemeInput as R, TEXT_SCALE_FLOOR as T, type
|
|
166
|
+
export { type EverfurFaceStyle as E, type ResolveThemeInput as R, TEXT_SCALE_FLOOR as T, type EverfurRoleTextStyle as a, type EverfurThemeAdjustment as b, themeAdjustments as c, face as f, headingFace as h, previewTheme as p, resolveTheme as r, textRole as t, withServerBranding as w };
|