@everfur/sdk 1.5.1 → 1.5.3
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/dist/{bookingCopy.d-BL2-URcv.d.ts → bookingCopy.d-Bn8bdo89.d.ts} +4 -4
- package/dist/{bookingCopy.d-Dfew1pjY.d.cts → bookingCopy.d-Dg7bPM-U.d.cts} +4 -4
- package/dist/care/index.cjs +2 -2
- package/dist/care/index.js +2 -2
- package/dist/chat/index.cjs +235 -234
- package/dist/chat/index.js +311 -310
- package/dist/chat/lite/index.cjs +339 -338
- package/dist/chat/lite/index.js +314 -313
- package/dist/{chunk-ZYHPCQVM.js → chunk-CFEHTNKX.js} +1 -1
- package/dist/{chunk-NBAOR5TJ.js → chunk-OU5RMGKD.js} +21 -21
- package/dist/{chunk-RD6ZGYEJ.js → chunk-XGF2HYNN.js} +16 -16
- package/dist/{chunk-IO4CGYHT.js → chunk-ZGL2GEEI.js} +1 -1
- package/dist/client/index.cjs +1 -1
- package/dist/client/index.d.cts +1 -1
- package/dist/client/index.d.ts +1 -1
- package/dist/client/index.js +1 -1
- package/dist/core/index.cjs +31 -31
- package/dist/core/index.js +31 -31
- package/dist/health-plan/index.cjs +266 -266
- package/dist/health-plan/index.js +443 -443
- package/dist/{idempotency.d-dOFfV91-.d.ts → idempotency.d-CbB07p64.d.ts} +10 -8
- package/dist/{idempotency.d-CFVMhWcv.d.cts → idempotency.d-DrxKLPPe.d.cts} +10 -8
- package/dist/{inbox.d-DJ9xgU1Z.d.ts → inbox.d-B2JXK0uI.d.ts} +1 -1
- package/dist/{inbox.d-CPcMMz-Y.d.cts → inbox.d-CwA1ogzV.d.cts} +1 -1
- package/dist/index.cjs +257 -256
- package/dist/index.js +364 -363
- package/dist/notifications/inbox/index.cjs +28 -28
- package/dist/notifications/inbox/index.d.cts +5 -5
- package/dist/notifications/inbox/index.d.ts +5 -5
- package/dist/notifications/inbox/index.js +53 -53
- package/dist/notifications/index.cjs +1 -1
- package/dist/notifications/index.d.cts +3 -3
- package/dist/notifications/index.d.ts +3 -3
- package/dist/notifications/index.js +1 -1
- package/dist/{optInView.d-ByDJMrMv.d.cts → optInView.d-ChJyJMBA.d.cts} +4 -1
- package/dist/{optInView.d-DVshLxbD.d.ts → optInView.d-Cps7aLQN.d.ts} +4 -1
- package/dist/{parse.d-Cj3fURer.d.ts → parse.d-QjB2LJCd.d.ts} +19 -10
- package/dist/{parse.d-cH7ZmMeo.d.cts → parse.d-_Ttu2h5g.d.cts} +19 -10
- package/dist/records/depth/index.cjs +80 -80
- package/dist/records/depth/index.js +115 -115
- package/dist/records/index.cjs +653 -653
- package/dist/records/index.js +1074 -1074
- package/dist/{route.d-DSYEd2MR.d.ts → route.d-DtuKY5dM.d.ts} +1 -1
- package/dist/{route.d-DCzQh4ix.d.cts → route.d-Nt-r-7IO.d.cts} +1 -1
- package/dist/server/events/index.cjs +1 -1
- package/dist/server/events/index.js +1 -1
- package/dist/server/index.cjs +1 -1
- package/dist/server/index.js +1 -1
- package/dist/shop/index.cjs +188 -188
- package/dist/shop/index.d.cts +2 -2
- package/dist/shop/index.d.ts +2 -2
- package/dist/shop/index.js +386 -386
- package/dist/shop/orders-v2/index.cjs +72 -72
- package/dist/shop/orders-v2/index.js +126 -126
- package/dist/tabs/index.cjs +114 -111
- package/dist/tabs/index.d.cts +18 -5
- package/dist/tabs/index.d.ts +18 -5
- package/dist/tabs/index.js +191 -188
- package/dist/televet/booking/index.cjs +214 -211
- package/dist/televet/booking/index.d.cts +2 -2
- package/dist/televet/booking/index.d.ts +2 -2
- package/dist/televet/booking/index.js +344 -341
- package/dist/televet/call/index.cjs +53 -53
- package/dist/televet/call/index.js +67 -67
- package/dist/texting/index.cjs +8 -8
- package/dist/texting/index.d.cts +2 -2
- package/dist/texting/index.d.ts +2 -2
- package/dist/texting/index.js +8 -8
- package/dist/{useInboxUnread.d-CXiaR3BZ.d.ts → useInboxUnread.d-0DrQPn7J.d.ts} +1 -1
- package/dist/{useInboxUnread.d-DERpMelw.d.cts → useInboxUnread.d-CRcOTkmu.d.cts} +1 -1
- package/dist/web/health-plan/index.cjs +1 -1
- package/dist/web/health-plan/index.js +1 -1
- package/dist/web/inbox/index.cjs +1 -1
- package/dist/web/inbox/index.d.cts +6 -6
- package/dist/web/inbox/index.d.ts +6 -6
- package/dist/web/inbox/index.js +1 -1
- package/dist/web/index.cjs +184 -184
- package/dist/web/index.js +181 -181
- package/dist/web/notifications/index.cjs +1 -1
- package/dist/web/notifications/index.d.cts +2 -2
- package/dist/web/notifications/index.d.ts +2 -2
- package/dist/web/notifications/index.js +1 -1
- package/dist/web/records-sheet/index.cjs +1 -1
- package/dist/web/records-sheet/index.js +1 -1
- package/dist/web/shop/index.cjs +2 -2
- package/dist/web/shop/index.d.cts +2 -2
- package/dist/web/shop/index.d.ts +2 -2
- package/dist/web/shop/index.js +3 -3
- package/dist/web/televet/booking/index.cjs +185 -185
- package/dist/web/televet/booking/index.d.cts +2 -2
- package/dist/web/televet/booking/index.d.ts +2 -2
- package/dist/web/televet/booking/index.js +185 -185
- package/dist/web/televet/call/index.cjs +1 -1
- package/dist/web/televet/call/index.js +1 -1
- package/dist/web/texting/index.cjs +3 -4
- package/dist/web/texting/index.d.cts +2 -2
- package/dist/web/texting/index.d.ts +2 -2
- package/dist/web/texting/index.js +3 -4
- package/dist/web/ui/index.cjs +1 -1
- package/dist/web/ui/index.js +33 -33
- package/package.json +1 -1
|
@@ -1,70 +1,70 @@
|
|
|
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 as e,createElement as t,useMemo as r,useRef as o,useEffect as l,useState as n,useCallback as i,useContext as a}from"react";import{TextInput as c,StyleSheet as s,useWindowDimensions as d,View as u,Pressable as f,Text as b,Animated as g}from"react-native";import{useSafeAreaInsets as h}from"react-native-safe-area-context";import{jsxs as p,jsx as m,Fragment as y}from"react/jsx-runtime";var v=/* @__PURE__ */Object.freeze({regular:"regular",medium:"medium",bold:"bold",mono:"regular",monoMedium:"medium",monoBold:"bold"});function face(e,t){let r=e.type,o=r.families[t];return t==="mono"||r.namedFaces[t]?{fontFamily:o}:{fontFamily:o,fontWeight:r.weight[v[t]]}}function headingFace(e,t="bold"){let{headingFamily:r,headingWeight:o}=e.type;if(r===null&&o===null)return face(e,t);if(r!==null)return{fontFamily:r,fontWeight:o??e.type.weight[v[t]]};let l=face(e,t);return l.fontWeight===void 0||o===null?l:{fontFamily:l.fontFamily,fontWeight:o}}function C(e){return e<=450?"regular":e<=650?"medium":"bold"}var w={regular:"mono",medium:"monoMedium",bold:"monoBold"};function textRole(e,t){let r=F.get(e);r===void 0&&(r=/* @__PURE__ */new Map,F.set(e,r));let o=r.get(t);if(o!==void 0)return o;let l=x(e,t);return r.set(t,l),l}var F=/* @__PURE__ */new WeakMap;function x(e,t){let r=e.type.roles[t],o=r.weight==="400"&&r.face!=="mono"?e.type.weight.regular:r.weight,l=C(Number(o)),n=r.face==="mono"?face(e,w[l]):r.face==="heading"?headingFace(e,l):face(e,l),i=r.face==="heading"?e.type.headingWeight??o:o,a=n.fontWeight===void 0?n:{fontFamily:n.fontFamily,fontWeight:i},c=r.size,s={...a,fontSize:c,lineHeight:Math.round(c*r.lineHeight*100)/100};return r.letterSpacing!==0&&(s.letterSpacing=Math.round(c*r.letterSpacing*100)/100),r.uppercase&&(s.textTransform="uppercase"),/* @__PURE__ */Object.freeze(s)}var B=/* @__PURE__ */Object.freeze({track(){},trackExpectedFailure(){}});function k(e,t){let r=globalThis.URL;if(typeof r=="function"){let o;try{o=t===void 0?new r(e):new r(e,t)}catch{return null}try{if(o.protocol)return o}catch{}}return D(e)}var z=/^([a-z][a-z0-9+.-]*):\/\/(?:([^:@/?#]*)(?::([^@/?#]*))?@)?(\[[0-9a-f:.]+\]|[\w.~-]+)(?::(\d*))?(\/[^?#]*)?(\?[^#]*)?(#.*)?$/i,S=/[\s\u0000-\u001f\u007f\\]/,T={"http:":"80","https:":"443"};function D(e,t){let r=e.trim();let o=S.test(r)?null:z.exec(r);if(o===null)return null;let[,l="",n="",i="",a="",c="",s="",d="",u=""]=o,f=`${l.toLowerCase()}:`,b=Number(c);if(b>65535)return null;let g=c===""||String(b)===T[f]?"":String(b),h=T[f]!==void 0,p=a.toLowerCase()+(g&&`:${g}`),m=s||(h?"/":""),y=n||i?`${n}${i&&`:${i}`}@`:"";return{href:`${f}//${y}${p}${m}${d}${u}`,protocol:f,username:n,password:i,hostname:a.toLowerCase(),port:g,origin:h?`${f}//${p}`:"null",pathname:m,search:d==="?"?"":d,hash:u==="#"?"":u}}function isSafeRoomUrl(e){return k(e.trim())?.protocol==="https:"}function isUsableRoomCredential(e,t){return isSafeRoomUrl(e)&&t.trim().length>0}function O(e){let t=globalThis.console;try{t?.error?.("[everfur] A host callback threw; the SDK ignored it.",e)}catch{}}function j(e){return(typeof e=="object"||typeof e=="function")&&e!==null&&typeof e.then=="function"}function R(e,...t){if(typeof e=="function")try{let r=e(...t);return j(r)&&Promise.resolve(r).then(void 0,O),r}catch(e){O(e);return}}var I=/* @__PURE__ */new WeakMap;function L(e){if(typeof e!="function")return;let t=I.get(e);if(t!==void 0)return t;let r=(...t)=>{R(e,...t)};return I.set(e,r),r}function H(e,t){let r=null;for(let o of t){let t=e[o];typeof t=="function"&&(r??={...e},r[o]=L(t))}return r??e}var E=10,M=/* @__PURE__ */Object.freeze({muteCta:"Mute",unmuteCta:"Unmute",cameraOffCta:"Camera off",cameraOnCta:"Camera on",leaveCta:"Leave",switchCameraCta:"Switch camera",speakerOffCta:"Speaker off",speakerOnCta:"Speaker on",lobbyTitleNoName:"Your vet is joining",lobbySubtitle:"",lobbyPrepLabel:"While you wait",lobbyPrepNoPet:"Have your pet nearby and somewhere well lit.",lobbyTitle:e=>{let t=e?.trim()??"";return t.length>0?`${t} is joining`:M.lobbyTitleNoName},lobbyPrep:e=>{let t=e?.trim()??"";return t.length>0?`Have ${t} nearby and somewhere well lit.`:M.lobbyPrepNoPet},lobbyDuration:e=>`${e} minutes`,waitingRoomLabel:"Waiting room",leaveWaitingRoomLabel:"Leave the waiting room",lobbyTipsTitle:e=>{let t=e?.trim()??"";return t.length>0?`Before ${t} joins`:M.lobbyPrepLabel},lobbyTipSpot:"Find a bright, quiet spot.",joinFailedReason:"That did not open. Try again.",recordingNoticeTitle:"This consultation is recorded.",recordingNoticeCta:"Continue to the call",recordingNoticeDecline:"Not now",selfCameraOffLabel:"Your camera is off"});function A(e){let t=Math.max(0,Math.floor(e/1e3)),r=String(t%60).padStart(2,"0"),o=Math.floor(t%3600/60),l=Math.floor(t/3600);return l>0?`${l}:${String(o).padStart(2,"0")}:${r}`:`${o}:${r}`}var W=/* @__PURE__ */Object.freeze({position:"absolute",top:0,right:0,bottom:0,left:0});var P=/* @__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 N=Object.freeze;function deepFreeze(e){if(e!==null&&typeof e=="object"&&!Object.isFrozen(e)){N(e);for(let t of Object.keys(e))deepFreeze(e[t])}return e}var $=/* @__PURE__ */Object.freeze({content:0,heading:2,control:1.8,compact:1.5,badge:1.3});var V={xs:4,sm:8,md:12,lg:16,xl:24,xxl:32},G={tile:5,xs:6,sm:10,md:14,lg:20,xl:28,pill:500},U={nano:8,small:9,micro:10,tiny:11,caption:13,bodyTight:15,body:17,subtitle:20,heading:22,verdict:24},q={tight:1.15,snug:1.3,normal:1.4,relaxed:1.55},Y={regular:"400",medium:"500",bold:"700"},X={eyebrow:1,monoWide:.9,headerBrand:-.42,tight:-.35},J=0,K="System",_="monospace",Q=["content","heading","control","compact","badge"];function Z(e){let t={};for(let r of Q)t[r]=e;return t}var ee=[];function te(){return{family:K,mono:_,fontUrl:null,families:{regular:K,medium:K,bold:K,mono:_,monoMedium:_,monoBold:_},namedFaces:{regular:false,medium:false,bold:false,mono:false,monoMedium:false,monoBold:false},fontUrls:{},size:U,tierSizes:Z(U),lineHeight:q,weight:Y,letterSpacing:X,scale:1,maxScale:J,scaleCaps:$,headingFamily:null,headingWeight:null,fontSources:ee,roles:P,typeScale:1}}var re={},oe=/* @__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(e){return`cubic-bezier(${e.join(", ")})`}var le={duration:{instant:80,fast:140,normal:220,slow:320},spring:{gentle:{damping:18,stiffness:200}},easing:{standard:cssCubicBezier(oe.standard),emphasized:cssCubicBezier(oe.emphasized),exit:cssCubicBezier(oe.exit)},reducedMotion:false},ne={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)"},ie=deepFreeze({brightness:"light",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false,assistantAvatarUrl:null},color:ne,space:V,radius:G,type:te(),motion:le,slots:re}),ae={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:ae,space:V,radius:G,type:te(),motion:le,slots:re});var ce=/* @__PURE__ */Symbol.for("@everfur/sdk#EverfurThemeContext@v1"),se=globalThis,de=se[ce]??(se[ce]=createContext(ie));de.displayName??="EverfurThemeContext";function useEverfurTheme(){return a(de)}function ue(e,t){let r=e.scaleCaps[t];return r>0?r:void 0}function Text({tier:e,variant:r,...o}){let l=useEverfurTheme(),n=r===void 0?void 0:l.type.roles[r],i=ue(l.type,e??n?.tier??"content"),a=r===void 0?o:{...o,style:[{...textRole(l,r),color:l.color.text.primary,flexShrink:1},o.style]};return t(b,i===void 0?a:{maxFontSizeMultiplier:i,...a})}e(function(e,r){return t(c,{...e,...r===null?{}:{ref:r}})});function optionalModule(e,t,r){let o;try{o=t()}catch(t){return be(`optional peer '${e}' is not installed: ${ge(t)}`)}let l=fe(o);return l==null?be(`optional peer '${e}' resolved to no module`):r&&!r(l)?be(`optional peer '${e}' is present but failed its shape check`):/* @__PURE__ */Object.freeze({available:true,module:l})}function fe(e){return typeof e=="object"&&e!==null&&"default"in e&&Object.keys(e).length<=2?e.default:e}function be(e){/* @__PURE__ */
|
|
3
|
-
return Object.freeze({available:false,module:null,reason:e})}function
|
|
4
|
-
return Object.freeze({available:false,module:null,reason:e})}function registerEverfurDaily(e){
|
|
5
|
-
return m(
|
|
6
|
-
return m(
|
|
7
|
-
return m(
|
|
8
|
-
return
|
|
9
|
-
/* @__PURE__ */
|
|
10
|
-
/* @__PURE__ */m(
|
|
11
|
-
/* @__PURE__ */m(
|
|
12
|
-
/* @__PURE__ */m(
|
|
13
|
-
return
|
|
14
|
-
/* @__PURE__ */
|
|
15
|
-
/* @__PURE__ */m(
|
|
16
|
-
/* @__PURE__ */m(
|
|
17
|
-
return
|
|
18
|
-
/* @__PURE__ */
|
|
19
|
-
/* @__PURE__ */m(
|
|
20
|
-
/* @__PURE__ */m(
|
|
21
|
-
return m(GlyphBox,{testID:"glyph-switch-camera",children:/* @__PURE__ */
|
|
22
|
-
/* @__PURE__ */m(
|
|
23
|
-
/* @__PURE__ */m(
|
|
24
|
-
return m(GlyphBox,{testID:"glyph-leave",children:/* @__PURE__ */
|
|
25
|
-
/* @__PURE__ */m(
|
|
26
|
-
/* @__PURE__ */
|
|
27
|
-
/* @__PURE__ */m(
|
|
28
|
-
/* @__PURE__ */m(
|
|
29
|
-
return m(
|
|
30
|
-
return
|
|
31
|
-
/* @__PURE__ */
|
|
32
|
-
/* @__PURE__ */m(
|
|
33
|
-
/* @__PURE__ */m(Text,{tier:"badge",style:v.prepLabel,testID:"everfur-vet-lobby-label",children:
|
|
34
|
-
/* @__PURE__ */
|
|
35
|
-
/* @__PURE__ */
|
|
36
|
-
/* @__PURE__ */m(
|
|
37
|
-
/* @__PURE__ */m(
|
|
38
|
-
/* @__PURE__ */m(
|
|
39
|
-
/* @__PURE__ */m(WaitingDots,{reducedMotion:
|
|
40
|
-
/* @__PURE__ */
|
|
41
|
-
/* @__PURE__ */m(Text,{tier:"badge",style:v.prepLabel,children:
|
|
2
|
+
import{createContext,forwardRef as e,createElement as t,useMemo as r,useRef as o,useEffect as l,useState as n,useCallback as i,useContext as a}from"react";import*as c from"react-native";import{TextInput as s,StyleSheet as d,useWindowDimensions as u,View as f,Pressable as b,Text as g,Animated as h}from"react-native";import{useSafeAreaInsets as p}from"react-native-safe-area-context";import{jsx as m,jsxs as y,Fragment as v}from"react/jsx-runtime";var C=/* @__PURE__ */Object.freeze({regular:"regular",medium:"medium",bold:"bold",mono:"regular",monoMedium:"medium",monoBold:"bold"});function face(e,t){let r=e.type,o=r.families[t];return t==="mono"||r.namedFaces[t]?{fontFamily:o}:{fontFamily:o,fontWeight:r.weight[C[t]]}}function headingFace(e,t="bold"){let{headingFamily:r,headingWeight:o}=e.type;if(r===null&&o===null)return face(e,t);if(r!==null)return{fontFamily:r,fontWeight:o??e.type.weight[C[t]]};let l=face(e,t);return l.fontWeight===void 0||o===null?l:{fontFamily:l.fontFamily,fontWeight:o}}function w(e){return e<=450?"regular":e<=650?"medium":"bold"}var F={regular:"mono",medium:"monoMedium",bold:"monoBold"};function textRole(e,t){let r=x.get(e);r===void 0&&(r=/* @__PURE__ */new Map,x.set(e,r));let o=r.get(t);if(o!==void 0)return o;let l=B(e,t);return r.set(t,l),l}var x=/* @__PURE__ */new WeakMap;function B(e,t){let r=e.type.roles[t],o=r.weight==="400"&&r.face!=="mono"?e.type.weight.regular:r.weight,l=w(Number(o)),n=r.face==="mono"?face(e,F[l]):r.face==="heading"?headingFace(e,l):face(e,l),i=r.face==="heading"?e.type.headingWeight??o:o,a=n.fontWeight===void 0?n:{fontFamily:n.fontFamily,fontWeight:i},c=r.size,s={...a,fontSize:c,lineHeight:Math.round(c*r.lineHeight*100)/100};return r.letterSpacing!==0&&(s.letterSpacing=Math.round(c*r.letterSpacing*100)/100),r.uppercase&&(s.textTransform="uppercase"),/* @__PURE__ */Object.freeze(s)}var k=/* @__PURE__ */Object.freeze({track(){},trackExpectedFailure(){}});function S(e,t){let r=globalThis.URL;if(typeof r=="function"){let o;try{o=t===void 0?new r(e):new r(e,t)}catch{return null}try{if(o.protocol)return o}catch{}}return O(e)}var z=/^([a-z][a-z0-9+.-]*):\/\/(?:([^:@/?#]*)(?::([^@/?#]*))?@)?(\[[0-9a-f:.]+\]|[\w.~-]+)(?::(\d*))?(\/[^?#]*)?(\?[^#]*)?(#.*)?$/i,T=/[\s\u0000-\u001f\u007f\\]/,D={"http:":"80","https:":"443"};function O(e,t){let r=e.trim();let o=T.test(r)?null:z.exec(r);if(o===null)return null;let[,l="",n="",i="",a="",c="",s="",d="",u=""]=o,f=`${l.toLowerCase()}:`,b=Number(c);if(b>65535)return null;let g=c===""||String(b)===D[f]?"":String(b),h=D[f]!==void 0,p=a.toLowerCase()+(g&&`:${g}`),m=s||(h?"/":""),y=n||i?`${n}${i&&`:${i}`}@`:"";return{href:`${f}//${y}${p}${m}${d}${u}`,protocol:f,username:n,password:i,hostname:a.toLowerCase(),port:g,origin:h?`${f}//${p}`:"null",pathname:m,search:d==="?"?"":d,hash:u==="#"?"":u}}function isSafeRoomUrl(e){return S(e.trim())?.protocol==="https:"}function isUsableRoomCredential(e,t){return isSafeRoomUrl(e)&&t.trim().length>0}function j(e){let t=globalThis.console;try{t?.error?.("[everfur] A host callback threw; the SDK ignored it.",e)}catch{}}function I(e){return(typeof e=="object"||typeof e=="function")&&e!==null&&typeof e.then=="function"}function R(e,...t){if(typeof e=="function")try{let r=e(...t);return I(r)&&Promise.resolve(r).then(void 0,j),r}catch(e){j(e);return}}var L=/* @__PURE__ */new WeakMap;function H(e){if(typeof e!="function")return;let t=L.get(e);if(t!==void 0)return t;let r=(...t)=>{R(e,...t)};return L.set(e,r),r}function E(e,t){let r=null;for(let o of t){let t=e[o];typeof t=="function"&&(r??={...e},r[o]=H(t))}return r??e}var M=10,W=/* @__PURE__ */Object.freeze({muteCta:"Mute",unmuteCta:"Unmute",cameraOffCta:"Camera off",cameraOnCta:"Camera on",leaveCta:"Leave",switchCameraCta:"Switch camera",speakerOffCta:"Speaker off",speakerOnCta:"Speaker on",lobbyTitleNoName:"Your vet is joining",lobbySubtitle:"",lobbyPrepLabel:"While you wait",lobbyPrepNoPet:"Have your pet nearby and somewhere well lit.",lobbyTitle:e=>{let t=e?.trim()??"";return t.length>0?`${t} is joining`:W.lobbyTitleNoName},lobbyPrep:e=>{let t=e?.trim()??"";return t.length>0?`Have ${t} nearby and somewhere well lit.`:W.lobbyPrepNoPet},lobbyDuration:e=>`${e} minutes`,waitingRoomLabel:"Waiting room",leaveWaitingRoomLabel:"Leave the waiting room",lobbyTipsTitle:e=>{let t=e?.trim()??"";return t.length>0?`Before ${t} joins`:W.lobbyPrepLabel},lobbyTipSpot:"Find a bright, quiet spot.",joinFailedReason:"That did not open. Try again.",recordingNoticeTitle:"This consultation is recorded.",recordingNoticeCta:"Continue to the call",recordingNoticeDecline:"Not now",selfCameraOffLabel:"Your camera is off"});function A(e){let t=Math.max(0,Math.floor(e/1e3)),r=String(t%60).padStart(2,"0"),o=Math.floor(t%3600/60),l=Math.floor(t/3600);return l>0?`${l}:${String(o).padStart(2,"0")}:${r}`:`${o}:${r}`}var P=/* @__PURE__ */Object.freeze({position:"absolute",top:0,right:0,bottom:0,left:0});var N=/* @__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 $=Object.freeze;function deepFreeze(e){if(e!==null&&typeof e=="object"&&!Object.isFrozen(e)){$(e);for(let t of Object.keys(e))deepFreeze(e[t])}return e}var G=/* @__PURE__ */Object.freeze({content:0,heading:2,control:1.8,compact:1.5,badge:1.3});var V={xs:4,sm:8,md:12,lg:16,xl:24,xxl:32},U={tile:5,xs:6,sm:10,md:14,lg:20,xl:28,pill:500},q={nano:8,small:9,micro:10,tiny:11,caption:13,bodyTight:15,body:17,subtitle:20,heading:22,verdict:24},Y={tight:1.15,snug:1.3,normal:1.4,relaxed:1.55},X={regular:"400",medium:"500",bold:"700"},J={eyebrow:1,monoWide:.9,headerBrand:-.42,tight:-.35},K=0,_="System",Q="monospace",Z=["content","heading","control","compact","badge"];function ee(e){let t={};for(let r of Z)t[r]=e;return t}var te=[];function re(){return{family:_,mono:Q,fontUrl:null,families:{regular:_,medium:_,bold:_,mono:Q,monoMedium:Q,monoBold:Q},namedFaces:{regular:false,medium:false,bold:false,mono:false,monoMedium:false,monoBold:false},fontUrls:{},size:q,tierSizes:ee(q),lineHeight:Y,weight:X,letterSpacing:J,scale:1,maxScale:K,scaleCaps:G,headingFamily:null,headingWeight:null,fontSources:te,roles:N,typeScale:1}}var oe={},le=/* @__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(e){return`cubic-bezier(${e.join(", ")})`}var ne={duration:{instant:80,fast:140,normal:220,slow:320},spring:{gentle:{damping:18,stiffness:200}},easing:{standard:cssCubicBezier(le.standard),emphasized:cssCubicBezier(le.emphasized),exit:cssCubicBezier(le.exit)},reducedMotion:false},ie={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)"},ae=deepFreeze({brightness:"light",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false,assistantAvatarUrl:null},color:ie,space:V,radius:U,type:re(),motion:ne,slots:oe}),ce={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:ce,space:V,radius:U,type:re(),motion:ne,slots:oe});var se=/* @__PURE__ */Symbol.for("@everfur/sdk#EverfurThemeContext@v1"),de=globalThis,ue=de[se]??(de[se]=createContext(ae));ue.displayName??="EverfurThemeContext";function useEverfurTheme(){return a(ue)}function fe(e,t){let r=e.scaleCaps[t];return r>0?r:void 0}function Text({tier:e,variant:r,...o}){let l=useEverfurTheme(),n=r===void 0?void 0:l.type.roles[r],i=fe(l.type,e??n?.tier??"content"),a=r===void 0?o:{...o,style:[{...textRole(l,r),color:l.color.text.primary,flexShrink:1},o.style]};return t(g,i===void 0?a:{maxFontSizeMultiplier:i,...a})}e(function(e,r){return t(s,{...e,...r===null?{}:{ref:r}})});var be=640,ge=600,he=/* @__PURE__ */Object.freeze({width:0,height:0}),pe="useWindowDimensions"in c&&typeof c.useWindowDimensions=="function"?c.useWindowDimensions:()=>he,me=/* @__PURE__ */Object.freeze({width:"100%",maxWidth:be,alignSelf:"center"});/* @__PURE__ */Object.freeze({...me,flex:1});var ye=/* @__PURE__ */Object.freeze({...me,flexGrow:1,flexShrink:1});function ve(){return pe().width>=ge}var Ce=/* @__PURE__ */Symbol.for("@everfur/sdk#InSdkColumn@v1"),we=globalThis,Fe=we[Ce]??(we[Ce]=createContext(false));Fe.displayName??="EverfurInSdkColumn";function SdkTabletColumn({children:e,style:t,testID:r}){let o=ve(),l=a(Fe);return!o||l?e:/* @__PURE__ */m(f,{style:t===void 0?ye:[ye,t],testID:r??"everfur-tablet-column",children:/* @__PURE__ */m(Fe.Provider,{value:true,children:e})})}function optionalModule(e,t,r){let o;try{o=t()}catch(t){return Be(`optional peer '${e}' is not installed: ${ke(t)}`)}let l=xe(o);return l==null?Be(`optional peer '${e}' resolved to no module`):r&&!r(l)?Be(`optional peer '${e}' is present but failed its shape check`):/* @__PURE__ */Object.freeze({available:true,module:l})}function xe(e){return typeof e=="object"&&e!==null&&"default"in e&&Object.keys(e).length<=2?e.default:e}function Be(e){/* @__PURE__ */
|
|
3
|
+
return Object.freeze({available:false,module:null,reason:e})}function ke(e){return e instanceof Error?e.message:typeof e=="string"?e:"unknown load error"}var Se=/* @__PURE__ */Symbol.for("@everfur/sdk/televet");function ze(){let e=globalThis,t=e[Se];if(t!==void 0)return t;let r={presenter:null,snapshot:/* @__PURE__ */Object.freeze({request:null,serial:0,activeHost:null}),hosts:[],nextHost:1,listeners:/* @__PURE__ */new Set,dailyRegistered:false};return e[Se]=r,r}function Te(e){ze().dailyRegistered=e}var De=`[everfur] The in-app vet call needs the Daily native modules, which this app has not registered. Install @daily-co/react-native-daily-js, @daily-co/react-native-webrtc and (Expo) @daily-co/config-plugin-rn-daily-js, rebuild the native app (a JS-only OTA cannot add a native module), and call registerEverfurDaily(() => require('@daily-co/react-native-daily-js')) once in your app entry. ON EXPO GO THIS CANNOT BE FIXED BY INSTALLING: Expo Go runs a fixed set of native modules and cannot load Daily at any version, so you need a development build (expo prebuild, then run the native app) before the in-app call works at all. Until then the in-app visit tells the member the call cannot be joined; <VetVisitButton prefer="redirect" /> is the explicit way to the hosted visit in the browser, which needs no native module.`,Oe="@daily-co/react-native-daily-js",je=`optional peer '${Oe}' has no registered loader`,Ie=`optional peer '${Oe}' is present but failed its shape check`;function Re(e){return typeof e=="object"&&e!==null}function Le(e){return Re(e)&&"box"in e}function He(e){let t=e.default,r=Re(t)||typeof t=="function"?t:{},o=typeof e.createCallObject=="function"?e:r,l=o.createCallObject,n={createCallObject:typeof l=="function"?l.bind(o):l,DailyMediaView:e.DailyMediaView??r.DailyMediaView};return isEverfurDailyModule(n)?n:null}function isEverfurDailyModule(e){if(!Re(e)||typeof e.createCallObject!="function")return false;let t=e.DailyMediaView;return typeof t=="function"||typeof t=="object"&&t!==null}var Ee=null,Me=null;function We(e){/* @__PURE__ */
|
|
4
|
+
return Object.freeze({available:false,module:null,reason:e})}function registerEverfurDaily(e){Ee=e,Me=null,Te(e!==null)}function loadEverfurDaily(){if(Me!==null)return Me;let e=Ee;if(e===null)return Me=We(je),Me;let t=optionalModule(Oe,()=>({box:e()}),Le);if(!t.available)return Me=We(t.reason),Me;let r=t.module.box;if(!Re(r))return Me=We(Ie),Me;let o=He(r);return Me=o===null?We(Ie):/* @__PURE__ */Object.freeze({available:true,module:o}),Me}function CallControl({label:e,glyph:t,onPress:r,testID:o,muted:l=false,style:n}){/* @__PURE__ */
|
|
5
|
+
return m(b,{onPress:r,testID:o,accessibilityRole:"button",accessibilityLabel:e,accessibilityState:{selected:l},style:n,children:t})}function GlyphBox({children:e,testID:t}){/* @__PURE__ */
|
|
6
|
+
return m(f,{style:Ae.box,accessibilityElementsHidden:true,importantForAccessibility:"no-hide-descendants",testID:t,children:e})}function Slash({color:e}){/* @__PURE__ */
|
|
7
|
+
return m(f,{style:[Ae.slash,{backgroundColor:e}]})}function MicGlyph({color:e,off:t=false}){/* @__PURE__ */
|
|
8
|
+
return y(GlyphBox,{testID:t?"glyph-mic-off":"glyph-mic",children:[
|
|
9
|
+
/* @__PURE__ */y(f,{style:Ae.column,children:[
|
|
10
|
+
/* @__PURE__ */m(f,{style:[Ae.micCapsule,{borderColor:e}]}),
|
|
11
|
+
/* @__PURE__ */m(f,{style:[Ae.micCradle,{borderColor:e}]}),
|
|
12
|
+
/* @__PURE__ */m(f,{style:[Ae.micStem,{backgroundColor:e}]})]}),t?/* @__PURE__ */m(Slash,{color:e}):null]})}function CameraGlyph({color:e,off:t=false}){/* @__PURE__ */
|
|
13
|
+
return y(GlyphBox,{testID:t?"glyph-camera-off":"glyph-camera",children:[
|
|
14
|
+
/* @__PURE__ */y(f,{style:Ae.row,children:[
|
|
15
|
+
/* @__PURE__ */m(f,{style:[Ae.cameraBody,{borderColor:e}]}),
|
|
16
|
+
/* @__PURE__ */m(f,{style:[Ae.cameraLens,{borderRightColor:e}]})]}),t?/* @__PURE__ */m(Slash,{color:e}):null]})}function SpeakerGlyph({color:e,off:t=false}){/* @__PURE__ */
|
|
17
|
+
return y(GlyphBox,{testID:t?"glyph-speaker-off":"glyph-speaker",children:[
|
|
18
|
+
/* @__PURE__ */y(f,{style:Ae.row,children:[
|
|
19
|
+
/* @__PURE__ */m(f,{style:[Ae.speakerBox,{backgroundColor:e}]}),
|
|
20
|
+
/* @__PURE__ */m(f,{style:[Ae.speakerCone,{borderRightColor:e}]}),t?null:/* @__PURE__ */m(f,{style:[Ae.speakerWave,{borderColor:e}]})]}),t?/* @__PURE__ */m(Slash,{color:e}):null]})}function SwitchCameraGlyph({color:e}){/* @__PURE__ */
|
|
21
|
+
return m(GlyphBox,{testID:"glyph-switch-camera",children:/* @__PURE__ */y(f,{style:[Ae.switchBody,{borderColor:e}],children:[
|
|
22
|
+
/* @__PURE__ */m(f,{style:[Ae.switchTurn,{borderColor:e,borderTopColor:"transparent"}]}),
|
|
23
|
+
/* @__PURE__ */m(f,{style:[Ae.switchHead,{borderBottomColor:e}]})]})})}function LeaveGlyph({color:e}){/* @__PURE__ */
|
|
24
|
+
return m(GlyphBox,{testID:"glyph-leave",children:/* @__PURE__ */y(f,{style:Ae.column,children:[
|
|
25
|
+
/* @__PURE__ */m(f,{style:[Ae.receiver,{borderColor:e}]}),
|
|
26
|
+
/* @__PURE__ */y(f,{style:Ae.receiverPads,children:[
|
|
27
|
+
/* @__PURE__ */m(f,{style:[Ae.receiverPad,{backgroundColor:e}]}),
|
|
28
|
+
/* @__PURE__ */m(f,{style:[Ae.receiverPad,{backgroundColor:e}]})]})]})})}var Ae=d.create({box:{width:24,height:24,alignItems:"center",justifyContent:"center"},row:{flexDirection:"row",alignItems:"center"},column:{alignItems:"center"},slash:{position:"absolute",width:2,height:28,borderRadius:1,transform:[{rotate:"-45deg"}]},micCapsule:{width:10,height:14,borderRadius:5,borderWidth:2},micCradle:{width:16,height:8,marginTop:-5,borderWidth:2,borderTopWidth:0,borderBottomLeftRadius:8,borderBottomRightRadius:8},micStem:{width:2,height:3},cameraBody:{width:14,height:12,borderRadius:3,borderWidth:2},cameraLens:{width:0,height:0,marginLeft:1,borderTopWidth:5,borderBottomWidth:5,borderRightWidth:6,borderTopColor:"transparent",borderBottomColor:"transparent"},speakerBox:{width:4,height:8,borderRadius:1},speakerCone:{width:0,height:0,borderTopWidth:7,borderBottomWidth:7,borderRightWidth:7,borderTopColor:"transparent",borderBottomColor:"transparent",transform:[{rotate:"180deg"}]},speakerWave:{width:7,height:12,marginLeft:2,borderWidth:2,borderLeftWidth:0,borderTopRightRadius:6,borderBottomRightRadius:6},switchBody:{width:20,height:15,borderRadius:3,borderWidth:2,alignItems:"center",justifyContent:"center"},switchTurn:{width:9,height:9,borderRadius:4.5,borderWidth:2},switchHead:{position:"absolute",top:2,right:4,width:0,height:0,borderLeftWidth:3,borderRightWidth:3,borderBottomWidth:4,borderLeftColor:"transparent",borderRightColor:"transparent"},receiver:{width:22,height:10,borderWidth:3,borderBottomWidth:0,borderTopLeftRadius:11,borderTopRightRadius:11},receiverPads:{flexDirection:"row",width:22,justifyContent:"space-between",marginTop:-1},receiverPad:{width:5,height:4,borderRadius:1}});var Pe=/* @__PURE__ */Object.freeze({surface:"rgba(255,255,255,0.08)",surfaceRaised:"rgba(255,255,255,0.14)",surfaceActive:"rgba(255,255,255,0.24)",hairline:"rgba(255,255,255,0.18)",glyph:"rgba(255,255,255,0.72)",textSecondary:"rgba(255,255,255,0.78)",textTertiary:"rgba(255,255,255,0.56)"}),Ne=3,$e=180,Ge=420,Ve=.35,Ue=.6,qe=360,Ye=132,Xe=184,Je=44;function Ke(e){return typeof e=="number"&&Number.isInteger(e)&&e>=1?e:10}function WaitingDots({reducedMotion:e,styles:t}){let r=o(Array.from({length:Ne},()=>new h.Value(Ve))).current;return l(()=>{if(e)return;let t=r.map((e,t)=>h.loop(h.sequence([h.delay(t*$e),h.timing(e,{toValue:1,duration:Ge,useNativeDriver:true}),h.timing(e,{toValue:Ve,duration:Ge,useNativeDriver:true}),h.delay((Ne-t-1)*$e)])));for(let e of t)e.start();return()=>{for(let e of t)e.stop()}},[e,r]),/* @__PURE__ */m(f,{style:t.dotRow,testID:"everfur-vet-lobby-dots",accessibilityElementsHidden:true,importantForAccessibility:"no",children:r.map((r,o)=>/* @__PURE__ */m(h.View,{style:[t.dot,{opacity:e?Ue:r}]},o))})}function LobbyControl({label:e,glyph:t,active:r,onPress:o,testID:l,styles:n}){/* @__PURE__ */
|
|
29
|
+
return m(b,{onPress:o,testID:l,accessibilityRole:"button",accessibilityState:{selected:!r},accessibilityLabel:e,style:[n.control,r?null:n.controlOff],children:t})}function EverfurVetCallLobby(e){let{clinicianName:t,petName:o,consultMinutes:l,micOn:n,cameraOn:i,onToggleMic:a,onToggleCamera:c,onSwitchCamera:s,onLeave:d,style:g}=e,h=useEverfurTheme(),v=r(()=>_e(h),[h]),C=p(),{width:w}=u(),F=w<qe?Ye:Xe;/* @__PURE__ */
|
|
30
|
+
return m(f,{style:[v.root,{paddingTop:C.top+h.space.sm,paddingBottom:C.bottom+h.space.lg},g],testID:"everfur-vet-lobby",children:/* @__PURE__ */y(SdkTabletColumn,{children:[
|
|
31
|
+
/* @__PURE__ */y(f,{style:v.topRow,children:[
|
|
32
|
+
/* @__PURE__ */m(b,{onPress:d,accessibilityRole:"button",accessibilityLabel:W.leaveCta,testID:"everfur-vet-lobby-leave",hitSlop:12,style:v.leaveHit,children:/* @__PURE__ */m(Text,{tier:"control",style:v.leaveLabel,children:W.leaveCta})}),
|
|
33
|
+
/* @__PURE__ */m(Text,{tier:"badge",style:v.prepLabel,testID:"everfur-vet-lobby-label",children:W.waitingRoomLabel})]}),
|
|
34
|
+
/* @__PURE__ */y(f,{style:v.center,children:[
|
|
35
|
+
/* @__PURE__ */y(f,{style:[v.avatar,{width:F,height:F,borderRadius:F/2}],testID:"everfur-vet-lobby-avatar",accessibilityElementsHidden:true,importantForAccessibility:"no",children:[
|
|
36
|
+
/* @__PURE__ */m(f,{style:v.avatarGlyphHead}),
|
|
37
|
+
/* @__PURE__ */m(f,{style:v.avatarGlyphBody})]}),
|
|
38
|
+
/* @__PURE__ */m(f,{accessibilityLiveRegion:"polite",accessible:true,children:/* @__PURE__ */m(Text,{tier:"heading",style:v.title,testID:"everfur-vet-lobby-title",children:W.lobbyTitle(t)})}),
|
|
39
|
+
/* @__PURE__ */m(WaitingDots,{reducedMotion:h.motion.reducedMotion,styles:v})]}),
|
|
40
|
+
/* @__PURE__ */y(f,{style:v.prepCard,testID:"everfur-vet-lobby-prep",children:[
|
|
41
|
+
/* @__PURE__ */m(Text,{tier:"badge",style:v.prepLabel,children:W.lobbyTipsTitle(t)}),[W.lobbyTipSpot,W.lobbyPrep(o)].map((e,t)=>/* @__PURE__ */y(f,{style:v.tip,children:[
|
|
42
42
|
/* @__PURE__ */m(Text,{tier:"badge",style:v.tipNumber,accessibilityElementsHidden:true,importantForAccessibility:"no",children:String(t+1).padStart(2,"0")}),
|
|
43
43
|
/* @__PURE__ */m(Text,{style:v.prepBody,children:e})]},e))]}),
|
|
44
|
-
/* @__PURE__ */
|
|
45
|
-
/* @__PURE__ */m(LobbyControl,{label:n?
|
|
46
|
-
/* @__PURE__ */m(LobbyControl,{label:i?
|
|
47
|
-
/* @__PURE__ */m(Text,{tier:"badge",style:v.duration,testID:"everfur-vet-lobby-duration",children:
|
|
48
|
-
return
|
|
49
|
-
/* @__PURE__ */m(
|
|
50
|
-
/* @__PURE__ */m(
|
|
51
|
-
return m(VetCallRoom,{...e},e.roomUrl)}function VetCallRoom(e){let{roomUrl:t,token:a,onLeave:c,clinicianName:s,petName:d,consultMinutes:
|
|
52
|
-
return
|
|
53
|
-
/* @__PURE__ */m(Text,{style:
|
|
54
|
-
/* @__PURE__ */m(
|
|
55
|
-
/* @__PURE__ */m(
|
|
56
|
-
return
|
|
57
|
-
/* @__PURE__ */m(Text,{style:
|
|
58
|
-
/* @__PURE__ */m(
|
|
59
|
-
return m(EverfurVetCallLobby,{clinicianName:s,petName:d,consultMinutes:
|
|
60
|
-
return
|
|
61
|
-
/* @__PURE__ */
|
|
62
|
-
/* @__PURE__ */m(ge,{videoTrack:
|
|
63
|
-
/* @__PURE__ */m(PersonMark,{styles:
|
|
64
|
-
/* @__PURE__ */
|
|
65
|
-
/* @__PURE__ */
|
|
66
|
-
/* @__PURE__ */m(ge,{videoTrack:
|
|
67
|
-
/* @__PURE__ */
|
|
68
|
-
/* @__PURE__ */m(CallControl,{label:$?
|
|
69
|
-
/* @__PURE__ */m(CallControl,{label:
|
|
70
|
-
/* @__PURE__ */m(CallControl,{label:
|
|
44
|
+
/* @__PURE__ */y(f,{style:v.controls,children:[
|
|
45
|
+
/* @__PURE__ */m(LobbyControl,{label:n?W.muteCta:W.unmuteCta,glyph:/* @__PURE__ */m(MicGlyph,{color:h.color.text.onBrand,off:!n}),active:n,onPress:a,testID:"everfur-vet-lobby-mic",styles:v}),
|
|
46
|
+
/* @__PURE__ */m(LobbyControl,{label:i?W.cameraOffCta:W.cameraOnCta,glyph:/* @__PURE__ */m(CameraGlyph,{color:h.color.text.onBrand,off:!i}),active:i,onPress:c,testID:"everfur-vet-lobby-camera",styles:v}),i&&s?/* @__PURE__ */m(LobbyControl,{label:W.switchCameraCta,glyph:/* @__PURE__ */m(SwitchCameraGlyph,{color:h.color.text.onBrand}),active:true,onPress:s,testID:"everfur-vet-lobby-switch-camera",styles:v}):null]}),
|
|
47
|
+
/* @__PURE__ */m(Text,{tier:"badge",style:v.duration,testID:"everfur-vet-lobby-duration",children:W.lobbyDuration(Ke(l))})]})})}function _e(e){let{color:t,space:r,radius:o,type:l}=e;return d.create({root:{flex:1,backgroundColor:t.brand,paddingHorizontal:r.lg},topRow:{flexDirection:"row",alignItems:"center",gap:r.md},tip:{flexDirection:"row",gap:r.md,alignItems:"flex-start",paddingTop:r.sm},tipNumber:{...face(e,"monoBold"),color:Pe.textSecondary,fontSize:13,width:24,paddingTop:4},leaveHit:{minHeight:Je,justifyContent:"center",paddingVertical:r.xs,paddingRight:r.md},leaveLabel:{...face(e,"medium"),color:t.text.onBrand,fontSize:l.size.body},center:{flex:1,alignItems:"center",justifyContent:"center"},avatar:{alignItems:"center",justifyContent:"center",borderWidth:2,borderColor:t.success,backgroundColor:Pe.surface,marginBottom:r.lg,overflow:"hidden"},avatarGlyphHead:{width:34,height:34,borderRadius:17,borderWidth:2,borderColor:Pe.glyph,marginBottom:6},avatarGlyphBody:{width:66,height:33,borderTopLeftRadius:33,borderTopRightRadius:33,borderWidth:2,borderBottomWidth:0,borderColor:Pe.glyph},title:{...face(e,"bold"),color:t.text.onBrand,fontSize:l.size.heading,lineHeight:Math.round(l.size.heading*l.lineHeight.snug),textAlign:"center",paddingHorizontal:r.sm},dotRow:{flexDirection:"row",gap:r.xs,marginTop:r.lg},dot:{width:8,height:8,borderRadius:4,backgroundColor:t.success},prepCard:{borderRadius:o.lg,borderWidth:1,borderColor:Pe.hairline,backgroundColor:Pe.surface,padding:r.lg,marginBottom:r.lg},prepLabel:{...face(e,"monoBold"),color:t.accent,fontSize:l.size.micro,letterSpacing:1.2,textTransform:"uppercase"},prepBody:{...face(e,"regular"),color:t.text.onBrand,fontSize:l.size.subtitle,lineHeight:Math.round(l.size.subtitle*l.lineHeight.relaxed)},controls:{flexDirection:"row",justifyContent:"center",gap:r.lg,marginBottom:r.lg},control:{minWidth:64,minHeight:48,paddingHorizontal:r.md,alignItems:"center",justifyContent:"center",borderRadius:o.pill,backgroundColor:Pe.surfaceRaised},controlOff:{backgroundColor:Pe.surfaceActive},duration:{...face(e,"medium"),color:Pe.textTertiary,fontSize:l.size.micro,letterSpacing:1.6,textAlign:"center"}})}var Qe=5e3;function Ze(e,t){return new Promise(r=>{let o=setTimeout(r,t);e.catch(()=>{}).then(()=>{clearTimeout(o),r()})})}function et(e,t){let r=o(e);l(()=>{r.current=e});let n=o(false);l(()=>(n.current=true,()=>{n.current=false}),[]);let a=o(false),c=i(()=>{a.current||!n.current||(a.current=true,r.current())},[]),s=o(false),d=i(()=>{s.current||(s.current=true,Ze(t(),Qe).then(c))},[t,c]);return{reportLeft:c,leave:d,leaving:s}}var tt=/* @__PURE__ */Symbol.for("@everfur/sdk/televet/recording-notice-receipt");function rt(){let e=globalThis;return e[tt]??=/* @__PURE__ */new Map}function ot(e){return(rt().get(e)??0)>0}function lt(e){let[t,r]=n(true),l=o(true),a=i(()=>{let t=e.current;if(!t?.setNativeInCallAudioMode)return;let o=!l.current;l.current=o,r(o),t.setNativeInCallAudioMode(o?"video":"voice")},[e]);return{speakerOn:t,toggleSpeaker:a}}function nt(e){return e??null}function it(e){return!!e?.videoTrack}function PersonMark({styles:e}){/* @__PURE__ */
|
|
48
|
+
return y(f,{style:e.remoteOffAvatar,accessibilityElementsHidden:true,importantForAccessibility:"no",children:[
|
|
49
|
+
/* @__PURE__ */m(f,{style:e.remoteOffHead}),
|
|
50
|
+
/* @__PURE__ */m(f,{style:e.remoteOffBody})]})}function EverfurVetCall(e){/* @__PURE__ */
|
|
51
|
+
return m(VetCallRoom,{...e},e.roomUrl)}function VetCallRoom(e){let{roomUrl:t,token:a,onLeave:c,clinicianName:s,petName:d,consultMinutes:u,daily:g,telemetry:h,onUnavailable:C,renderUnavailable:w,style:F}=E(e,["onLeave"]),x=useEverfurTheme(),B=r(()=>bt(x),[x]),S=p(),z=h??k,T=o(z);l(()=>{T.current=z});let D=o(null),[O,j]=n(()=>ot(t)),[I,L]=n("joining"),[H,M]=n(null),[P,N]=n(null),[$,G]=n(true),[V,U]=n(true),{speakerOn:q,toggleSpeaker:Y}=lt(D),[X,J]=n(true),[K,_]=n({flip:false,speaker:false}),[Q,Z]=n(null),[ee,te]=n(0),re=isUsableRoomCredential(t,a),oe=r(()=>re?g?{available:true,module:g,reason:""}:loadEverfurDaily():null,[re,g]),le=oe?.available?oe.module:null,ne=r(()=>oe===null?{reason:"roomUnusable",detail:"[everfur] The vet call needs an https room URL and a non-empty join token."}:oe.available?null:{reason:"dailyMissing",detail:`${De} (${oe.reason})`},[oe]),ie=o(false);l(()=>{if(ne===null){ie.current=false;return}if(R(C,ne.reason,ne.detail),!ie.current){ie.current=true;try{globalThis.console?.warn?.(ne.detail)}catch{}}},[ne,C]);let ae=i(async()=>{let e=D.current;if(D.current=null,!!e){await Ze(new Promise(t=>t(e.leave())),Qe);try{e.setLocalAudio(!1),e.setLocalVideo(!1)}catch{}try{await e.destroy()}catch{}}},[]),{reportLeft:ce,leave:se,leaving:de}=et(c,ae);l(()=>{if(le===null||!O)return;let e=false,r=le.createCallObject();D.current=r,_({flip:typeof r.cycleCamera=="function",speaker:typeof r.setNativeInCallAudioMode=="function"});let o=()=>{let e=Object.values(r.participants());N(e.find(e=>e.local)??null),M(e.find(e=>!e.local)??null)},l=["participant-joined","participant-updated","participant-left"];for(let e of l)r.on(e,o);let n=()=>{e||de.current||(L("left"),ce())},i=()=>{e||L("error")};return r.on("left-meeting",n),r.on("error",i),r.join({url:t,token:a}).then(()=>{e||(L("joined"),Z(Date.now()),o(),T.current.track("televet.call.joined",{provider:"daily"}))}).catch(()=>{e||(L("error"),T.current.trackExpectedFailure("televet.call.join_failed",{provider:"daily"}))}),()=>{e=true;for(let e of l)r.off(e,o);r.off("left-meeting",n),r.off("error",i),ae()}},[le,O,t,a,ae,ce,de]),l(()=>{if(Q===null)return;te(Date.now()-Q);let e=setInterval(()=>{te(Date.now()-Q)},1e3);return()=>{clearInterval(e)}},[Q]);let ue=i(()=>{let e=D.current;e&&G(t=>(e.setLocalAudio(!t),!t))},[]),fe=i(()=>{let e=D.current;e&&U(t=>(e.setLocalVideo(!t),!t))},[]),be=i(()=>{let e=D.current;e?.cycleCamera&&e.cycleCamera().then(e=>{let t=e?.device?.facingMode;t&&J(t==="user")},()=>{})},[]);if(ne!==null)return w?/* @__PURE__ */m(v,{children:w(ne.reason,ne.detail)}):null;if(le===null)return null;if(!O)/* @__PURE__ */
|
|
52
|
+
return m(f,{style:[B.notice,{paddingTop:S.top+x.space.xl,paddingBottom:S.bottom+x.space.xl},F],testID:"everfur-vet-call-recording-notice",children:/* @__PURE__ */y(SdkTabletColumn,{style:B.noticeColumn,children:[
|
|
53
|
+
/* @__PURE__ */m(Text,{style:B.noticeTitle,accessibilityRole:"header",children:W.recordingNoticeTitle}),
|
|
54
|
+
/* @__PURE__ */m(b,{onPress:()=>j(true),accessibilityRole:"button",accessibilityLabel:W.recordingNoticeCta,testID:"everfur-vet-call-recording-continue",style:B.noticeContinue,children:/* @__PURE__ */m(Text,{tier:"control",style:B.noticeContinueLabel,children:W.recordingNoticeCta})}),
|
|
55
|
+
/* @__PURE__ */m(b,{onPress:ce,accessibilityRole:"button",accessibilityLabel:W.leaveCta,testID:"everfur-vet-call-recording-leave",style:B.errorLeaveHit,children:/* @__PURE__ */m(Text,{tier:"control",style:B.noticeLeave,children:W.leaveCta})})]})});if(I==="error")/* @__PURE__ */
|
|
56
|
+
return y(f,{style:[B.centered,F],testID:"everfur-vet-call-error",children:[
|
|
57
|
+
/* @__PURE__ */m(Text,{style:B.status,accessibilityLiveRegion:"polite",children:W.joinFailedReason}),
|
|
58
|
+
/* @__PURE__ */m(b,{onPress:se,accessibilityRole:"button",accessibilityLabel:W.leaveCta,testID:"everfur-vet-call-error-leave",style:B.errorLeaveHit,children:/* @__PURE__ */m(Text,{tier:"control",style:B.errorLeave,children:W.leaveCta})})]});if(H===null)/* @__PURE__ */
|
|
59
|
+
return m(EverfurVetCallLobby,{clinicianName:s,petName:d,consultMinutes:u,micOn:$,cameraOn:V,onToggleMic:ue,onToggleCamera:fe,...K.flip?{onSwitchCamera:be}:{},onLeave:se,style:F});let ge=le.DailyMediaView,he=s?.trim()??"",pe=ee>=Ke(u)*6e4;/* @__PURE__ */
|
|
60
|
+
return y(f,{style:[B.root,F],testID:"everfur-vet-call",children:[
|
|
61
|
+
/* @__PURE__ */y(f,{style:B.fill,testID:"everfur-vet-call-remote",children:[
|
|
62
|
+
/* @__PURE__ */m(ge,{videoTrack:nt(H.videoTrack),audioTrack:nt(H.audioTrack),mirror:false,objectFit:"cover",style:B.fill}),it(H)?null:/* @__PURE__ */y(f,{style:B.remoteOff,testID:"everfur-vet-call-remote-camera-off",children:[
|
|
63
|
+
/* @__PURE__ */m(PersonMark,{styles:B}),he.length>0?/* @__PURE__ */m(Text,{style:B.remoteOffName,numberOfLines:1,children:he}):null]})]}),
|
|
64
|
+
/* @__PURE__ */y(f,{style:[B.statusRow,{top:S.top+x.space.sm}],pointerEvents:"none",children:[he.length>0?/* @__PURE__ */m(Text,{tier:"compact",style:B.statusName,numberOfLines:1,testID:"everfur-vet-call-remote-name",children:he}):null,Q!==null?/* @__PURE__ */m(Text,{tier:"badge",style:[B.statusMeta,pe?B.statusMetaOver:null],testID:"everfur-vet-call-elapsed",children:A(ee)}):null]}),
|
|
65
|
+
/* @__PURE__ */y(f,{style:[B.selfView,{top:S.top+x.space.sm}],testID:"everfur-vet-call-self",children:[
|
|
66
|
+
/* @__PURE__ */m(ge,{videoTrack:V?nt(P?.videoTrack):null,audioTrack:null,mirror:X,objectFit:"cover",style:B.fill}),P?.videoTrack&&V?null:/* @__PURE__ */m(f,{style:[B.selfViewOff,B.fill],testID:"everfur-vet-call-self-off",children:/* @__PURE__ */m(Text,{tier:"badge",style:B.selfViewOffLabel,children:W.selfCameraOffLabel})})]}),
|
|
67
|
+
/* @__PURE__ */y(f,{style:[B.controlBar,{bottom:S.bottom+x.space.lg}],children:[K.speaker?/* @__PURE__ */m(CallControl,{label:q?W.speakerOffCta:W.speakerOnCta,glyph:/* @__PURE__ */m(SpeakerGlyph,{color:q?x.color.text.onBrand:dt,off:!q}),muted:!q,onPress:Y,testID:"everfur-vet-call-speaker",style:[B.control,q?null:B.controlMuted]}):null,
|
|
68
|
+
/* @__PURE__ */m(CallControl,{label:$?W.muteCta:W.unmuteCta,glyph:/* @__PURE__ */m(MicGlyph,{color:$?x.color.text.onBrand:dt,off:!$}),muted:!$,onPress:ue,testID:"everfur-vet-call-mic",style:[B.control,$?null:B.controlMuted]}),
|
|
69
|
+
/* @__PURE__ */m(CallControl,{label:V?W.cameraOffCta:W.cameraOnCta,glyph:/* @__PURE__ */m(CameraGlyph,{color:V?x.color.text.onBrand:dt,off:!V}),muted:!V,onPress:fe,testID:"everfur-vet-call-camera",style:[B.control,V?null:B.controlMuted]}),K.flip&&V?/* @__PURE__ */m(CallControl,{label:W.switchCameraCta,glyph:/* @__PURE__ */m(SwitchCameraGlyph,{color:x.color.text.onBrand}),onPress:be,testID:"everfur-vet-call-switch-camera",style:B.control}):null,
|
|
70
|
+
/* @__PURE__ */m(CallControl,{label:W.leaveCta,glyph:/* @__PURE__ */m(LeaveGlyph,{color:x.color.text.onBrand}),onPress:se,testID:"everfur-vet-call-leave",style:[B.control,B.controlDanger]})]})]})}var at="#141414",ct="#1B1B1B",st="rgba(20,20,20,0.62)",dt="#141414",ut=104,ft={textShadowColor:"rgba(0,0,0,0.55)",textShadowRadius:6};function bt(e){let{color:t,space:r,radius:o,type:l}=e;return d.create({root:{flex:1,backgroundColor:at},fill:{...P},centered:{flex:1,alignItems:"center",justifyContent:"center",gap:r.lg,padding:r.xl,backgroundColor:at},statusRow:{position:"absolute",left:r.md,right:ut+r.md*2,flexDirection:"column",alignItems:"flex-start",gap:2},statusName:{flexShrink:1,...face(e,"medium"),color:t.text.onBrand,fontSize:l.size.body,...ft},statusMeta:{...face(e,"mono"),color:t.text.onBrand,fontSize:l.size.caption,...ft},statusMetaOver:{color:t.danger},selfView:{position:"absolute",right:r.md,width:ut,height:148,borderRadius:o.lg,overflow:"hidden",backgroundColor:ct,borderWidth:1,borderColor:"rgba(255,255,255,0.24)",shadowColor:"#000",shadowOpacity:.35,shadowRadius:12,shadowOffset:{width:0,height:4},elevation:6},selfViewOff:{alignItems:"center",justifyContent:"center",paddingHorizontal:r.xs,backgroundColor:ct},remoteOff:{...P,alignItems:"center",justifyContent:"center",gap:r.md,backgroundColor:at},remoteOffAvatar:{width:96,height:96,borderRadius:o.pill,overflow:"hidden",alignItems:"center",justifyContent:"flex-end",backgroundColor:"rgba(255,255,255,0.14)"},remoteOffHead:{width:36,height:36,borderRadius:18,marginBottom:6,backgroundColor:"rgba(255,255,255,0.56)"},remoteOffBody:{width:64,height:28,borderTopLeftRadius:32,borderTopRightRadius:32,backgroundColor:"rgba(255,255,255,0.56)"},remoteOffName:{...face(e,"medium"),color:t.text.onBrand,fontSize:l.size.subtitle,paddingHorizontal:r.xl},notice:{flex:1,justifyContent:"center",gap:r.lg,paddingHorizontal:r.xl,backgroundColor:t.surface},noticeColumn:{justifyContent:"center",gap:r.lg},noticeTitle:{...face(e,"medium"),fontSize:l.size.subtitle,lineHeight:Math.round(l.size.subtitle*l.lineHeight.relaxed),color:t.text.primary},noticeContinue:{minHeight:44,alignItems:"center",justifyContent:"center",paddingHorizontal:r.xl,borderRadius:o.pill,backgroundColor:t.primary},noticeContinueLabel:{...face(e,"medium"),color:t.onPrimary,fontSize:l.size.body},noticeLeave:{...face(e,"medium"),color:t.brandInk,fontSize:l.size.body},selfViewOffLabel:{...face(e,"medium"),color:"rgba(255,255,255,0.78)",fontSize:l.size.micro,textAlign:"center"},controlBar:{position:"absolute",left:0,right:0,flexDirection:"row",justifyContent:"center",alignItems:"center",gap:r.sm},control:{minWidth:54,minHeight:56,paddingHorizontal:r.md,alignItems:"center",justifyContent:"center",borderRadius:o.pill,backgroundColor:st},controlMuted:{backgroundColor:t.text.onBrand},controlDanger:{backgroundColor:t.danger},status:{...face(e,"medium"),fontSize:l.size.subtitle,lineHeight:Math.round(l.size.subtitle*l.lineHeight.relaxed),color:t.surface,textAlign:"center"},errorLeaveHit:{minHeight:44,minWidth:44,alignItems:"center",justifyContent:"center",paddingHorizontal:r.lg},errorLeave:{...face(e,"medium"),color:t.surface,fontSize:l.size.body,textDecorationLine:"underline"}})}export{De as EVERFUR_DAILY_SETUP,EverfurVetCall,EverfurVetCallLobby,M as VET_CALL_CONSULT_MINUTES,W as VET_CALL_COPY,isEverfurDailyModule,isSafeRoomUrl,isUsableRoomCredential,loadEverfurDaily,registerEverfurDaily};
|
package/dist/texting/index.cjs
CHANGED
|
@@ -17,9 +17,9 @@ return r.jsx(t.View,{style:[l.offstate,i],accessible:true,accessibilityState:{bu
|
|
|
17
17
|
return r.jsx(t.View,{style:[l.offstate,i],accessible:true,accessibilityRole:"text",accessibilityLabel:a,children:a.length>0?/* @__PURE__ */r.jsx(Text,{style:l.offstateText,children:a}):null})}function Mr(e){let{color:r,space:n,radius:i,type:o}=e;return t.StyleSheet.create({offstate:{minHeight:zr,justifyContent:"center",paddingHorizontal:n.lg,paddingVertical:n.md,backgroundColor:r.surfaceCream,borderRadius:i.md,borderWidth:t.StyleSheet.hairlineWidth,borderColor:r.brandBorder},offstateText:{...face(e,"regular"),fontSize:o.size.body,lineHeight:Math.round(o.size.body*o.lineHeight.normal),color:r.text.muted},skeletonBar:{height:n.md,borderRadius:i.xs,backgroundColor:r.brandSofter}})}function Br(e){if(!(t.Platform.OS!=="ios"||e===""))try{let r=t.AccessibilityInfo?.announceForAccessibility;typeof r=="function"&&r.call(t.AccessibilityInfo,e)}catch{}}function AnnounceLine({line:t}){return e.useEffect(()=>{Br(t)},[t]),null}function EverfurTextingOptIn(n){let i=b(n,["onStatusChange"]),o=e.useMemo(()=>({copy:Ft(n.copy),brandCopy:It(n.brandCopy)}),[n.copy,n.brandCopy]),{copy:l,brandCopy:a}=o,s=useEverfurTheme(),d=e.useMemo(()=>qr(s),[s]),u=useEverfurTexting();return u.status==="signedOut"?/* @__PURE__ */r.jsxs(t.View,{style:[d.card,i.style],children:[
|
|
18
18
|
/* @__PURE__ */r.jsx(Text,{style:d.title,accessibilityRole:"header",children:a.introTitle(s.meta.displayName)}),
|
|
19
19
|
/* @__PURE__ */r.jsx(Text,{style:d.body,children:l.signedOut})]}):/* @__PURE__ */r.jsx(CapabilityGate,{capability:"texting",...i.renderDisabled?{renderDisabled:i.renderDisabled}:{},style:i.style,children:/* @__PURE__ */r.jsx(Rt.Provider,{value:o,children:/* @__PURE__ */r.jsx(OptInBody,{...i,texting:u,styles:d})})})}function Button({label:e,onPress:n,disabled:i=false,busy:o=false,styles:l,kind:a="primary",testID:s}){let d=a==="primary"?l.primary:a==="secondary"?l.secondary:l.link,u=a==="primary"?l.primaryLabel:a==="secondary"?l.secondaryLabel:l.linkLabel;/* @__PURE__ */
|
|
20
|
-
return r.jsx(t.Pressable,{onPress:n,disabled:i||o,accessibilityRole:"button",accessibilityLabel:e,accessibilityState:{disabled:i||o,busy:o},style:[d,i||o?l.dimmed:null],...s===void 0?{}:{testID:s},children:/* @__PURE__ */r.jsx(Text,{tier:"control",style:u,children:e})})}function OptInBody({texting:n,styles:i,onStatusChange:o,renderNotice:l,style:a}){let{copy:s,brandCopy:d}=Ot(),u=useEverfurTheme(),{status:c,profile:p,snapshot:f}=n,h=p?.brandName??u.meta.displayName,[b,y]=e.useState(""),[g,m]=e.useState(false),[v,_]=e.useState(""),[x,C]=e.useState(null),[w,S]=e.useState(false),[k,E]=e.useState(null),[T,j]=e.useState(false);e.useEffect(()=>{o?.(c)},[o,c]),e.useEffect(()=>{C(null),S(false)},[c]);let F=(e,n=false)=>/* @__PURE__ */r.jsx(t.View,{style:[i.card,a],accessibilityState:{busy:n},children:e}),I=(e,n)=>{let o=textingErrorText(e,f.failedAction,f.codeRefusal,s)
|
|
20
|
+
return r.jsx(t.Pressable,{onPress:n,disabled:i||o,accessibilityRole:"button",accessibilityLabel:e,accessibilityState:{disabled:i||o,busy:o},style:[d,i||o?l.dimmed:null],...s===void 0?{}:{testID:s},children:/* @__PURE__ */r.jsx(Text,{tier:"control",style:u,children:e})})}function OptInBody({texting:n,styles:i,onStatusChange:o,renderNotice:l,style:a}){let{copy:s,brandCopy:d}=Ot(),u=useEverfurTheme(),{status:c,profile:p,snapshot:f}=n,h=p?.brandName??u.meta.displayName,[b,y]=e.useState(""),[g,m]=e.useState(false),[v,_]=e.useState(""),[x,C]=e.useState(null),[w,S]=e.useState(false),[k,E]=e.useState(null),[T,j]=e.useState(false);e.useEffect(()=>{o?.(c)},[o,c]),e.useEffect(()=>{C(null),S(false)},[c]);let F=(e,n=false)=>/* @__PURE__ */r.jsx(t.View,{style:[i.card,a],accessibilityState:{busy:n},children:e}),I=(e,n)=>{let o=textingErrorText(e,f.failedAction,f.codeRefusal,s);/* @__PURE__ */
|
|
21
21
|
return r.jsxs(t.View,{style:i.notice,accessibilityLiveRegion:"polite",children:[
|
|
22
|
-
/* @__PURE__ */r.jsx(HostRender,{resetKey:e,render:()=>l?l(e):/* @__PURE__ */r.jsx(Text,{style:i.noticeText,children:o}),fallback:/* @__PURE__ */r.jsx(Text,{style:i.noticeText,children:o})}),
|
|
22
|
+
/* @__PURE__ */r.jsx(HostRender,{resetKey:e,render:()=>l?l(e):/* @__PURE__ */r.jsx(Text,{style:i.noticeText,children:o}),fallback:/* @__PURE__ */r.jsx(Text,{style:i.noticeText,children:o})}),n===void 0?null:/* @__PURE__ */r.jsx(Button,{label:s.retry,onPress:n,styles:i,kind:"link"}),l?null:/* @__PURE__ */r.jsx(AnnounceLine,{line:o})]})},R=x===null?null:/* @__PURE__ */r.jsxs(r.Fragment,{children:[
|
|
23
23
|
/* @__PURE__ */r.jsx(Text,{style:i.noticeText,accessibilityLiveRegion:"polite",children:textingInputProblemText(x,s)}),
|
|
24
24
|
/* @__PURE__ */r.jsx(AnnounceLine,{line:textingInputProblemText(x,s)})]});if(c==="unavailable")return F(
|
|
25
25
|
/* @__PURE__ */r.jsxs(r.Fragment,{children:[
|
|
@@ -68,19 +68,19 @@ return r.jsx(t.Pressable,{onPress:()=>a(n.petRef),disabled:o,accessibilityRole:"
|
|
|
68
68
|
/* @__PURE__ */r.jsx(Button,{label:o?d.savingPet:d.savePet,kind:"secondary",busy:o,disabled:!p,styles:e,onPress:()=>{c!==null&&s(c)},testID:"texting-pet-save"}),l&&!p?/* @__PURE__ */r.jsx(Text,{style:e.footnote,children:d.petSaved}):null]})]})}function qr(e){let{color:r,radius:o,space:l,type:a,slots:s}=e,d=(t,r,n)=>({...face(e,n),fontSize:t,lineHeight:Math.round(t*a.lineHeight.snug),color:r}),u=s.card?.textColor;return t.StyleSheet.create({card:{gap:l.md,padding:l.lg,borderRadius:o.lg,borderWidth:1,borderColor:r.brandBorder,backgroundColor:r.surface,...n(s.card,1)},title:d(a.size.subtitle,u??r.text.primary,"bold"),subtitle:d(a.size.body,u??r.text.primary,"bold"),body:d(a.size.body,u??r.text.secondary,"regular"),footnote:d(a.size.caption,r.text.muted,"regular"),phone:d(a.size.body,u??r.text.primary,"bold"),label:d(a.size.caption,u??r.text.primary,"bold"),input:{minHeight:44,paddingHorizontal:l.md,borderRadius:o.md,borderWidth:1,borderColor:r.controlEdge,backgroundColor:r.surface,...d(a.size.body,r.text.primary,"regular"),...n(s.input,1),...i(s.input)},consentRow:{flexDirection:"row",alignItems:"flex-start",gap:l.sm,minHeight:44},box:{width:24,height:24,borderRadius:o.xs,borderWidth:2,borderColor:r.controlEdge,alignItems:"center",justifyContent:"center",backgroundColor:r.surface},boxChecked:{backgroundColor:r.brand,borderColor:r.brandInk},tick:{...d(a.size.caption,r.text.onBrand,"bold")},consentText:{flex:1,...d(a.size.caption,u??r.text.secondary,"regular")},primary:{minHeight:44,paddingHorizontal:l.lg,borderRadius:o.pill,alignItems:"center",justifyContent:"center",backgroundColor:r.brand,...n(s.primaryButton)},primaryLabel:{...d(a.size.body,r.text.onBrand,"bold"),...i(s.primaryButton)},secondary:{minHeight:44,paddingHorizontal:l.lg,borderRadius:o.pill,borderWidth:1,borderColor:r.brandBorder,alignItems:"center",justifyContent:"center",backgroundColor:r.surface},secondaryLabel:d(a.size.caption,r.brandInk,"bold"),link:{minHeight:44,justifyContent:"center",alignSelf:"flex-start"},linkLabel:{...d(a.size.caption,r.linkInk,"bold"),...i(s.link)},dimmed:{opacity:.5},links:{flexDirection:"row",flexWrap:"wrap",alignItems:"center",gap:l.md},notice:{gap:l.xs},noticeText:d(a.size.caption,r.errorRed,"regular"),confirm:{gap:l.sm,padding:l.md,borderRadius:o.md,backgroundColor:r.surfaceSubtle},petRow:{gap:l.xs},chips:{flexDirection:"row",flexWrap:"wrap",gap:l.sm},chip:{minHeight:44,paddingHorizontal:l.md,borderRadius:o.pill,borderWidth:1,borderColor:r.brandBorder,backgroundColor:r.surface,justifyContent:"center",...n(s.chip,1)},chipPicked:{backgroundColor:r.brandSoft,borderColor:r.brandInk},chipLabel:{...d(a.size.caption,r.text.primary,"regular"),...i(s.chip)},chipLabelPicked:{...face(e,"bold"),color:r.brandInk}})}var Vr=/* @__PURE__ */Symbol.for("@everfur/sdk#IntroOpen@v1"),Hr=globalThis;function Ur(e){if(typeof e!="object"||e===null)return false;let t=e;return t.holds instanceof Set&&t.listeners instanceof Set}var $r=Hr[Vr],Wr=()=>({holds:/* @__PURE__ */new Set,listeners:/* @__PURE__ */new Set}),Yr=Ur($r)?$r:Hr[Vr]=Wr();function Kr(){return Yr.holds.size>0}function Gr(e){return Yr.listeners.add(e),()=>{Yr.listeners.delete(e)}}function Xr(){return e.useSyncExternalStore(Gr,Kr,Kr)}function resolveTextingAskDue(e){let t=e.enabled&&e.capabilityGranted&&e.hasProfile&&e.signedIn&&e.scheduleEligible&&!e.offeredThisSession,r=t&&e.identity==="none"&&e.surfaceReady;return{readEnabled:t,due:r}}var Qr=/* @__PURE__ */new Set(["emergency","schedule_soon"]);function textingAskThreadReady(e){if(e.isBootstrapping===true||e.isLoadingHistory===true||e.isStreaming===true||e.status==="error"||e.stopped===true)return false;let t=e.messages[e.messages.length-1];return t===void 0||t.role!=="assistant"||t.pending===true||t.checkin!==void 0||t.text.trim().length===0?false:!(typeof t.urgencyLevel=="string"&&Qr.has(t.urgencyLevel))}var Jr=/* @__PURE__ */new WeakSet;function Zr(e){return Jr.has(e)}var en="everfur.texting.askSchedule.v1",tn=2880*60*1e3,rn=3,nn=/* @__PURE__ */Object.freeze({askCount:0,nextAskAt:null,completed:false});function isTextingAskEligible(e,t){if(e.status!=="ok")return false;let{entry:r}=e;return r.completed||r.askCount>=rn?false:r.nextAskAt===null||t>=r.nextAskAt}function on(e,t){return{askCount:Math.min(e.askCount+1,rn),nextAskAt:t+tn,completed:e.completed}}function ln(e,t){return{...e,nextAskAt:t+tn}}function an(e){return{...e,completed:true}}function sn(e){return e.askCount<=0?1:e.askCount===1?2:3}function dn(e){if(e===null||typeof e!="object"||Array.isArray(e))return null;let t=e,{askCount:r,nextAskAt:n,completed:i}=t;return typeof r!="number"||!Number.isInteger(r)||r<0||n!==null&&(typeof n!="number"||!Number.isFinite(n))||typeof i!="boolean"?null:{askCount:Math.min(r,rn),nextAskAt:n,completed:i}}function un(e){let t;try{t=JSON.parse(e)}catch{return null}if(t===null||typeof t!="object"||Array.isArray(t))return null;let r={};for(let[e,n]of Object.entries(t)){let t=dn(n);if(t===null)return null;r[e]=t}return r}var cn=/* @__PURE__ */Symbol.for("@everfur/sdk/texting/ask-schedule@v1");function pn(){let e=globalThis,t=e[cn];return t===void 0&&(t={sessions:/* @__PURE__ */new Map,sessionListeners:/* @__PURE__ */new Set,listeners:/* @__PURE__ */new Set,writeChain:Promise.resolve()},e[cn]=t),t.sessionListeners===void 0&&(t.sessionListeners=/* @__PURE__ */new Set),t}async function fn(e){if(Zr(e))return{status:"unreadable"};let t;try{t=await e.getItem(en)}catch{return{status:"unreadable"}}if(t===null)try{return await e.setItem(en,"{}"),await e.getItem(en)===null?{status:"unreadable"}:{status:"ok",map:{}}}catch{return{status:"unreadable"}}let r=un(t);if(r!==null)return{status:"ok",map:r};try{await e.removeItem(en)}catch{}return{status:"unreadable"}}function hn(e){let{listeners:t}=pn();return t.add(e),()=>{t.delete(e)}}function bn(e,userRef,t){let r=pn(),n=async()=>{let n=await fn(e);if(n.status!=="ok")return;let i=n.map[userRef]??nn;try{await e.setItem(en,JSON.stringify({...n.map,[userRef]:t(i)}))}catch{return}for(let e of[...r.listeners])e()},i=r.writeChain.then(n,n);return r.writeChain=i.catch(()=>{}),i}async function yn(e,userRef){let t=await fn(e);return t.status!=="ok"?{status:"unreadable"}:{status:"ok",entry:t.map[userRef]??nn}}function gn(e,userRef,t=Date.now()){return bn(e,userRef,e=>on(e,t))}function mn(e,userRef,t=Date.now()){return bn(e,userRef,e=>ln(e,t))}function vn(e,userRef){return bn(e,userRef,an)}function _n(userRef){return pn().sessions.get(userRef)??null}function xn(userRef,e){let t=pn();t.sessions.set(userRef,e);for(let e of[...t.sessionListeners])e()}function Cn(e){let{sessionListeners:t}=pn();return t.add(e),()=>{t.delete(e)}}var NO_SNAPSHOT=()=>null;function wn(){let{runtime:t}=St(),r=t.entitlements??null,n=e.useCallback(e=>r===null?()=>{}:r.subscribe(e),[r]),i=r===null?NO_SNAPSHOT:r.getSnapshot,o=e.useSyncExternalStore(n,i,i);return e.useMemo(()=>o!==null&&decideCapability("texting",o.decisions,{isPending:o.isPending}).enabled,[o])}var Sn=/* @__PURE__ */Object.freeze({status:"idle"});function kn(userRef){let{runtime:t}=St(),r=t.registry.services.kv,[n,i]=e.useState({user:null,value:Sn});return e.useEffect(()=>{if(userRef===null)return;let e=true,t=()=>{yn(r,userRef).then(t=>{e&&i({user:userRef,value:{status:"ready",read:t}})})};t();let n=hn(t);return()=>{e=false,n()}},[r,userRef]),n.user===userRef?n.value:Sn}function En(e){switch(e.status){case"enroll":case"requesting":case"code":case"confirming":return"none";case"verified":case"optingOut":case"optedOut":return"exists";default:return"unknown"}}function useTextingAsk(t={}){let r=t.enabled!==false,n=t.ready!==false,i=t.surface??"prompt",o=t.entry===true,{runtime:l,userRef:userRef}=St(),a=l.registry.services.kv,s=wn(),d=kn(r&&userRef!==null?userRef:null),u=e.useCallback(()=>userRef===null?null:_n(userRef),[userRef]),c=e.useSyncExternalStore(Cn,u,u),p=e.useCallback(e=>{userRef!==null&&xn(userRef,e)},[userRef]),f=c!==null&&c.surface===i,h=c!==null&&c.fromPrompt===true,b=f?c.stage==="handoff"?"hidden":c.stage:i==="prompt"&&h?"dismissed":"hidden",y=Date.now(),g=d.status==="ready"&&isTextingAskEligible(d.read,y),[m,v]=e.useState(null),_=o&&userRef!==null&&s,x=or(userRef!==null&&m===userRef||b!=="hidden"||f||_),C=En(x),{readEnabled:w,due:S}=resolveTextingAskDue({enabled:r,capabilityGranted:s,hasProfile:x.profile!==null,signedIn:userRef!==null,scheduleEligible:g,offeredThisSession:c!==null,identity:C,surfaceReady:n});e.useEffect(()=>{w&&userRef!==null&&v(userRef)},[w,userRef]);let k=c?.askNumber??(d.status==="ready"&&d.read.status==="ok"?sn(d.read.entry):1);e.useEffect(()=>{!S||userRef===null||_n(userRef)!==null||p({surface:i,stage:"offered",answered:false,askNumber:k})},[S,userRef,p,k,i]),e.useEffect(()=>{!f||c.stage!=="handoff"||r&&n&&s&&x.profile!==null&&C==="none"&&p({...c,stage:"offered"})},[f,c,r,n,s,x.profile,C,p]);let E=d.status==="ready"&&d.read.status==="ok"&&d.read.entry.completed;e.useEffect(()=>{userRef===null||C!=="exists"||E||d.status!=="ready"||vn(a,userRef)},[C,E,d.status,a,userRef]),e.useEffect(()=>{f&&c.stage==="enrolling"&&x.status==="verified"&&p({...c,stage:"verified"})},[f,c,x.status,p]);let T=e.useCallback(e=>userRef===null||e.answered?e:(gn(a,userRef),{...e,answered:true}),[a,userRef]),j=e.useCallback(()=>{f&&c.stage==="offered"&&p({...c,stage:"enrolling"})},[f,c,p]),F=e.useCallback(()=>{if(!f||c.stage!=="enrolling")return;let{back:e,...t}=c;p({...t,stage:e??"offered"})},[f,c,p]),I=e.useCallback(()=>{if(!(!f||c.stage!=="offered"&&c.stage!=="enrolling")){if(i==="prompt"){p({...T(c),surface:"chat",stage:"handoff",fromPrompt:true});return}c.fromPrompt===true&&c.answered&&userRef!==null&&mn(a,userRef),p({...T(c),stage:"dismissed"})}},[f,c,i,p,T,a,userRef]),{start:R}=x,O=e.useCallback(async e=>!f||c.stage!=="enrolling"?false:(c.answered||p(T(c)),R(e)),[f,c,p,T,R]),A=_&&x.profile!==null&&C==="none"&&b!=="enrolling"&&b!=="verified",P=e.useCallback(()=>{if(!A||userRef===null)return;let e=f?c:null;p({surface:i,stage:"enrolling",answered:e?.answered??false,askNumber:c?.askNumber??k,...e?.fromPrompt===true?{fromPrompt:true}:{},back:e?.stage==="offered"?"offered":"dismissed"})},[A,userRef,f,c,p,i,k]),D=x.profile?.brandName??"";return e.useMemo(()=>({stage:userRef===null?"hidden":b,brand:D,askNumber:k,texting:x,accept:j,dismiss:I,close:F,start:O,canOpen:A,open:P}),[userRef,b,D,k,x,j,I,F,O,A,P])}var Tn=/* @__PURE__ */new Set(["signedOut","unavailable","failed","verified","optingOut","optedOut"]);function jn(t,r,n,i){let{userRef:userRef}=St(),o=e.useRef(null),{canOpen:l,open:a,stage:s,texting:d}=t;e.useEffect(()=>{if(!r){o.current=null;return}if(!(userRef===null||o.current===userRef)){if(l){o.current=userRef,a();return}if(s==="enrolling"||s==="verified"){o.current=userRef;return}(!n||Tn.has(d.status))&&(o.current=userRef,p(i,"skipped"))}},[r,userRef,l,a,s,d.status,n,i])}var Fn=/* @__PURE__ */Object.freeze({position:"absolute",top:0,right:0,bottom:0,left:0});function ChatTextingAskController({enabled:t,ready:r,onAsk:n,entry:i=false}){let o=useTextingAsk({enabled:t,ready:r,surface:"chat",entry:i});return e.useEffect(()=>{p(n,o)},[o,n]),null}function textingAskLines(e){return{line:Tt.chatAskLine(e.brand),accept:Et.promptAccept,dismiss:Et.promptDismiss,verified:Tt.chatAskVerified(e.brand)}}function ChatTextingAskComposer({ask:t}){let n=useEverfurTheme(),i=e.useMemo(()=>In(n),[n]);/* @__PURE__ */
|
|
69
69
|
return r.jsx(AskEntry,{ask:t,styles:i})}function AskEntry({ask:n,styles:i}){let{texting:o}=n,{status:l,profile:a,snapshot:s}=o,[d,u]=e.useState(""),[c,p]=e.useState(false),[f,h]=e.useState(""),[b,y]=e.useState(null),[g,m]=e.useState(false),v={onFocus:()=>m(true),onBlur:()=>m(false)},_=g?[i.pill,i.pillFocused]:i.pill,x=l==="enroll"||l==="requesting"&&!s.resending,C=l==="code"||l==="confirming"||l==="requesting",w=e.useRef(null),S=e.useRef(null),k=l==="enroll",E=l==="code";e.useEffect(()=>{y(null)},[l]),e.useEffect(()=>{k?w.current?.focus():E&&S.current?.focus()},[k,E]);let T=/* @__PURE__ */r.jsxs(t.Pressable,{onPress:n.close,accessibilityRole:"button",accessibilityLabel:Et.close,hitSlop:8,style:i.close,testID:"texting-ask-close",children:[
|
|
70
70
|
/* @__PURE__ */r.jsx(t.View,{style:[i.closeBar,i.closeBarA]}),
|
|
71
|
-
/* @__PURE__ */r.jsx(t.View,{style:[i.closeBar,i.closeBarB]})]}),j=s.error===null?null:textingErrorText(s.error,s.failedAction,s.codeRefusal),F=
|
|
72
|
-
/* @__PURE__ */r.jsx(Text,{style:i.noticeText,children:j}),
|
|
73
|
-
/* @__PURE__ */r.jsx(AnnounceLine,{line:
|
|
71
|
+
/* @__PURE__ */r.jsx(t.View,{style:[i.closeBar,i.closeBarB]})]}),j=s.error===null?null:textingErrorText(s.error,s.failedAction,s.codeRefusal),F=j===null?null:/* @__PURE__ */r.jsxs(t.View,{style:i.notice,accessibilityRole:"alert",accessibilityLiveRegion:"polite",children:[
|
|
72
|
+
/* @__PURE__ */r.jsx(Text,{style:i.noticeText,children:j}),
|
|
73
|
+
/* @__PURE__ */r.jsx(AnnounceLine,{line:j})]}),I=b===null?null:/* @__PURE__ */r.jsxs(r.Fragment,{children:[
|
|
74
74
|
/* @__PURE__ */r.jsx(Text,{style:i.noticeText,accessibilityRole:"alert",accessibilityLiveRegion:"polite",children:textingInputProblemText(b)}),
|
|
75
75
|
/* @__PURE__ */r.jsx(AnnounceLine,{line:textingInputProblemText(b)})]});if(a===null)return null;if(l==="loading"||l==="failed"||l==="signedOut"||l==="unavailable")/* @__PURE__ */
|
|
76
76
|
return r.jsx(t.View,{style:i.root,testID:"texting-ask-entry",accessibilityState:{busy:l==="loading"},children:/* @__PURE__ */r.jsxs(t.View,{style:i.head,children:[
|
|
77
|
-
/* @__PURE__ */r.jsx(t.View,{style:i.headBody,children:l==="failed"?
|
|
77
|
+
/* @__PURE__ */r.jsx(t.View,{style:i.headBody,children:l==="failed"?F:null}),T]})});if(x){let e=l==="requesting",o=()=>{let e=validateTextingEnroll(d,c);y(e),e===null&&n.start(d)};/* @__PURE__ */
|
|
78
78
|
return r.jsxs(t.View,{style:i.root,testID:"texting-ask-phone",children:[
|
|
79
79
|
/* @__PURE__ */r.jsxs(t.View,{style:i.head,children:[
|
|
80
80
|
/* @__PURE__ */r.jsxs(t.View,{style:i.headBody,children:[
|
|
81
81
|
/* @__PURE__ */r.jsxs(t.Pressable,{onPress:()=>p(!c),disabled:e,accessibilityRole:"checkbox",accessibilityState:{checked:c,disabled:e},accessibilityLabel:a.consentText,style:i.consentRow,testID:"texting-ask-consent",children:[
|
|
82
82
|
/* @__PURE__ */r.jsx(t.View,{style:[i.box,c?i.boxChecked:null],accessibilityElementsHidden:true,importantForAccessibility:"no",children:c?/* @__PURE__ */r.jsx(Text,{style:i.tick,children:"✓"}):null}),
|
|
83
|
-
/* @__PURE__ */r.jsx(Text,{style:i.consentText,children:a.consentText})]}),a.helpContact===null?null:/* @__PURE__ */r.jsxs(Text,{style:i.footnote,children:[Et.helpContactLabel," ",a.helpContact]})]}),T]}),
|
|
83
|
+
/* @__PURE__ */r.jsx(Text,{style:i.consentText,children:a.consentText})]}),a.helpContact===null?null:/* @__PURE__ */r.jsxs(Text,{style:i.footnote,children:[Et.helpContactLabel," ",a.helpContact]})]}),T]}),I,F,
|
|
84
84
|
/* @__PURE__ */r.jsxs(t.View,{style:_,children:[
|
|
85
85
|
/* @__PURE__ */r.jsx(Or,{value:d,onChangeText:u,editable:!e,keyboardType:"phone-pad",textContentType:"telephoneNumber",autoComplete:"tel",accessibilityLabel:Et.phoneLabel,placeholder:Et.phoneLabel,placeholderTextColor:i.placeholder.color,ref:w,onSubmitEditing:o,...v,style:i.field,testID:"texting-ask-phone-input"},"phone"),
|
|
86
86
|
/* @__PURE__ */r.jsx(t.Pressable,{onPress:o,disabled:e,accessibilityRole:"button",accessibilityLabel:e?Et.sendingCode:Et.sendCode,accessibilityState:{disabled:e,busy:e},style:[i.primary,e?i.dimmed:null],testID:"texting-ask-send",children:/* @__PURE__ */r.jsx(Text,{tier:"control",style:i.primaryLabel,children:e?Et.sendingCode:Et.sendCode})})]})]})}if(C){let e=l==="confirming",n=l==="requesting",a=e||n,d=()=>{let e=validateTextingCode(f);y(e),e===null&&o.confirm(f)};/* @__PURE__ */
|
|
@@ -90,7 +90,7 @@ return r.jsxs(t.View,{style:i.root,testID:"texting-ask-code",children:[
|
|
|
90
90
|
/* @__PURE__ */r.jsxs(Text,{style:i.body,children:[Et.codeSentTo," ",formatTextingPhone(s.phoneE164)]}),
|
|
91
91
|
/* @__PURE__ */r.jsxs(t.View,{style:i.links,children:[
|
|
92
92
|
/* @__PURE__ */r.jsx(t.Pressable,{onPress:()=>{h(""),o.resend()},disabled:a,accessibilityRole:"button",accessibilityState:{disabled:a,busy:n},style:[i.link,a?i.dimmed:null],children:/* @__PURE__ */r.jsx(Text,{style:i.linkLabel,children:Et.requestNewCode})}),
|
|
93
|
-
/* @__PURE__ */r.jsx(t.Pressable,{onPress:()=>{h(""),o.changeNumber()},disabled:a,accessibilityRole:"button",accessibilityState:{disabled:a},style:[i.link,a?i.dimmed:null],children:/* @__PURE__ */r.jsx(Text,{style:i.linkLabel,children:Et.changeNumber})})]})]}),T]}),
|
|
93
|
+
/* @__PURE__ */r.jsx(t.Pressable,{onPress:()=>{h(""),o.changeNumber()},disabled:a,accessibilityRole:"button",accessibilityState:{disabled:a},style:[i.link,a?i.dimmed:null],children:/* @__PURE__ */r.jsx(Text,{style:i.linkLabel,children:Et.changeNumber})})]})]}),T]}),I,F,
|
|
94
94
|
/* @__PURE__ */r.jsxs(t.View,{style:_,children:[
|
|
95
95
|
/* @__PURE__ */r.jsx(Or,{value:f,onChangeText:e=>h(e.replace(/\D/g,"")),editable:!a,keyboardType:"number-pad",textContentType:"oneTimeCode",autoComplete:"sms-otp",maxLength:6,accessibilityLabel:Et.codeLabel,placeholder:Et.codeLabel,placeholderTextColor:i.placeholder.color,ref:S,onSubmitEditing:d,...v,style:[i.field,i.digits],testID:"texting-ask-code-input"},"code"),
|
|
96
96
|
/* @__PURE__ */r.jsx(t.Pressable,{onPress:d,disabled:a,accessibilityRole:"button",accessibilityLabel:e?Et.confirmingCode:Et.confirmCode,accessibilityState:{disabled:a,busy:e},style:[i.primary,a?i.dimmed:null],testID:"texting-ask-confirm",children:/* @__PURE__ */r.jsx(Text,{tier:"control",style:i.primaryLabel,children:e?Et.confirmingCode:Et.confirmCode})})]})]})}return null}function In(e,r="auto"){let{color:o,radius:l,space:a,type:s,slots:d}=e,u=(t,r,n)=>({...face(e,n),fontSize:t,lineHeight:Math.round(t*s.lineHeight.snug),color:r}),c={textAlign:r};return t.StyleSheet.create({root:{gap:a.sm,width:"100%"},head:{flexDirection:"row",alignItems:"flex-start",gap:a.sm},headBody:{flex:1,minWidth:0,gap:a.xs},consentRow:{flexDirection:"row",alignItems:"flex-start",gap:a.sm,minHeight:44},box:{width:24,height:24,borderRadius:l.xs,borderWidth:2,borderColor:o.controlEdge,alignItems:"center",justifyContent:"center",backgroundColor:o.surface},boxChecked:{backgroundColor:o.brand,borderColor:o.brandInk},tick:u(s.size.caption,o.text.onBrand,"bold"),consentText:{...r==="center"?{flexShrink:1}:{flex:1},...u(s.size.caption,o.text.secondary,"regular"),...c},body:{...u(s.size.body,o.text.primary,"regular"),...c},footnote:{...u(s.size.caption,o.text.muted,"regular"),...c},placeholder:{color:o.text.placeholder},pill:{flexDirection:"row",alignItems:"center",gap:a.xs,minHeight:50,paddingVertical:a.xs,paddingLeft:a.md,paddingRight:a.xs,borderRadius:l.pill,borderWidth:1.5,borderColor:o.controlEdge,backgroundColor:o.surface,...n(d.input,1)},pillFocused:{borderWidth:1.5,borderColor:d.input?.borderColor??o.brandInk},field:{flex:1,minWidth:0,minHeight:44,padding:0,...u(s.size.body,o.text.primary,"regular"),...i(d.input)},digits:{fontVariant:["tabular-nums"]},primary:{minHeight:44,paddingHorizontal:a.lg,borderRadius:l.pill,alignItems:"center",justifyContent:"center",backgroundColor:o.brand,...n(d.primaryButton)},primaryLabel:{...u(s.size.caption,o.text.onBrand,"bold"),...i(d.primaryButton)},dimmed:{opacity:.5},close:{width:44,height:44,alignItems:"center",justifyContent:"center"},closeBar:{position:"absolute",width:18,height:2,borderRadius:1,backgroundColor:o.text.muted},closeBarA:{transform:[{rotate:"45deg"}]},closeBarB:{transform:[{rotate:"-45deg"}]},links:{flexDirection:"row",flexWrap:"wrap",alignItems:"center",gap:a.md},link:{minHeight:44,justifyContent:"center"},linkLabel:{...u(s.size.caption,o.linkInk,"bold"),...i(d.link)},notice:{gap:a.xs},noticeText:{...u(s.size.caption,o.errorRed,"regular"),...c}})}var Rn=["portrait","landscape"],On=/* @__PURE__ */new Set(["offered","enrolling"]);function EverfurTextingPrompt({onResolved:n,requested:i=false}){let o=Xr(),l=useTextingAsk({surface:"prompt",ready:!o,entry:i});jn(l,i,wn(),n);let a=useEverfurTheme(),s=e.useMemo(()=>An(a),[a]),d=e.useMemo(()=>In(a,"center"),[a]),u=e.useRef(false),[c,f]=e.useState(false);On.has(l.stage)&&(u.current=true);let h=u.current&&(On.has(l.stage)||l.stage==="verified")&&!c&&!o,b=()=>{c||(l.stage==="verified"?(f(true),p(n,"verified")):l.dismiss())};if(e.useEffect(()=>{u.current&&l.stage==="dismissed"&&!c&&(f(true),p(n,"dismissed"))},[l.stage,n,c]),!h)return null;let y=l.stage==="verified"?Et.verifiedTitle:Tt.promptTitle(l.brand);/* @__PURE__ */
|
package/dist/texting/index.d.cts
CHANGED
|
@@ -4,8 +4,8 @@ import { StyleProp, ViewStyle } from 'react-native';
|
|
|
4
4
|
import { a as CapabilityDecision } from '../resolve.d-BTC3b6FW.cjs';
|
|
5
5
|
import { E as EverfurError } from '../EverfurError.d-8NHtlgzA.cjs';
|
|
6
6
|
export { a as EverfurErrorCategory, b as EverfurErrorCode } from '../EverfurError.d-8NHtlgzA.cjs';
|
|
7
|
-
import { E as EverfurTextingViewStatus, T as TextingCopy, a as TextingBrandCopy, b as TextingAsk } from '../optInView.d-
|
|
8
|
-
export { C as COPY_PLACEHOLDER_PREFIX, c as EVERFUR_TEXTING_STATUSES, d as EverfurTextingChallenge, e as EverfurTextingIdentity, f as EverfurTextingInputProblem, g as EverfurTextingProfile, h as EverfurTextingReason, i as EverfurTextingState, j as EverfurTextingStatus, k as EverfurTextingVerificationInput, l as TEXTING_ASK_MAX_ASKS, m as TEXTING_ASK_SCHEDULE_KEY, n as TEXTING_ASK_SNOOZE_MS, o as TEXTING_BRAND_COPY, p as TEXTING_CODE_PATTERN, q as TEXTING_COPY, r as TEXTING_COPY_PLACEHOLDERS, s as TEXTING_UI_CODE_LENGTH, t as TextingAction, u as TextingAskDue, v as TextingAskDueInput, w as TextingAskEntry, x as TextingAskIdentity, y as TextingAskOptions, z as TextingAskScheduleRead, A as TextingAskStage, B as TextingAskThreadMessage, D as TextingAskThreadState, F as TextingCodeRefusal, G as TextingController, H as TextingPhase, I as TextingRepository, J as TextingRepositoryDeps, K as TextingRuntime, L as TextingSnapshot, M as createTextingRepository, N as createTextingRepositoryOver, O as formatTextingPhone, P as isE164, Q as isTextingAskEligible, R as parseTextingProfile, S as resolveTextingAskDue, U as textingAskThreadReady, V as textingErrorText, W as textingIdentityFromWire, X as textingInputProblemText, Y as textingOptedOutBody, Z as textingReasonOf, _ as textingSupportText, $ as toTextingE164, a0 as useEverfurTexting, a1 as useEverfurTextingProfile, a2 as useEverfurTextingRepository, a3 as useTextingAsk, a4 as validateTextingCode, a5 as validateTextingEnroll } from '../optInView.d-
|
|
7
|
+
import { E as EverfurTextingViewStatus, T as TextingCopy, a as TextingBrandCopy, b as TextingAsk } from '../optInView.d-ChJyJMBA.cjs';
|
|
8
|
+
export { C as COPY_PLACEHOLDER_PREFIX, c as EVERFUR_TEXTING_STATUSES, d as EverfurTextingChallenge, e as EverfurTextingIdentity, f as EverfurTextingInputProblem, g as EverfurTextingProfile, h as EverfurTextingReason, i as EverfurTextingState, j as EverfurTextingStatus, k as EverfurTextingVerificationInput, l as TEXTING_ASK_MAX_ASKS, m as TEXTING_ASK_SCHEDULE_KEY, n as TEXTING_ASK_SNOOZE_MS, o as TEXTING_BRAND_COPY, p as TEXTING_CODE_PATTERN, q as TEXTING_COPY, r as TEXTING_COPY_PLACEHOLDERS, s as TEXTING_UI_CODE_LENGTH, t as TextingAction, u as TextingAskDue, v as TextingAskDueInput, w as TextingAskEntry, x as TextingAskIdentity, y as TextingAskOptions, z as TextingAskScheduleRead, A as TextingAskStage, B as TextingAskThreadMessage, D as TextingAskThreadState, F as TextingCodeRefusal, G as TextingController, H as TextingPhase, I as TextingRepository, J as TextingRepositoryDeps, K as TextingRuntime, L as TextingSnapshot, M as createTextingRepository, N as createTextingRepositoryOver, O as formatTextingPhone, P as isE164, Q as isTextingAskEligible, R as parseTextingProfile, S as resolveTextingAskDue, U as textingAskThreadReady, V as textingErrorText, W as textingIdentityFromWire, X as textingInputProblemText, Y as textingOptedOutBody, Z as textingReasonOf, _ as textingSupportText, $ as toTextingE164, a0 as useEverfurTexting, a1 as useEverfurTextingProfile, a2 as useEverfurTextingRepository, a3 as useTextingAsk, a4 as validateTextingCode, a5 as validateTextingEnroll } from '../optInView.d-ChJyJMBA.cjs';
|
|
9
9
|
export { a as AnonIdentityProvider, A as AuthContext, I as IdentityProvider, M as MintedToken, T as TokenProvider } from '../identity.d-DDpXOtas.cjs';
|
|
10
10
|
export { A as AcceptedFrame, a as AnalysisCompleteFrame, b as AnalysisStartedFrame, D as DeltaFrame, c as DoneFrame, E as ErrorFrame, d as EverfurRequest, e as EverfurRequestBase, F as Frame, f as FrameBase, g as FrameKind, h as FreeCapRefusal, H as HeartbeatFrame, i as HttpMethod, M as MultipartBody, T as TransportPort, U as UnknownFrame, j as UrgencyLevel } from '../config.d-ClAI2RZ6.cjs';
|
|
11
11
|
export { B as Brand, C as ConversationId, P as PetRef, R as RecordsRequestId, U as UserRef, _ as __brand } from '../ids.d-B2GAAifq.cjs';
|
package/dist/texting/index.d.ts
CHANGED
|
@@ -4,8 +4,8 @@ import { StyleProp, ViewStyle } from 'react-native';
|
|
|
4
4
|
import { a as CapabilityDecision } from '../resolve.d-BTC3b6FW.js';
|
|
5
5
|
import { E as EverfurError } from '../EverfurError.d-8NHtlgzA.js';
|
|
6
6
|
export { a as EverfurErrorCategory, b as EverfurErrorCode } from '../EverfurError.d-8NHtlgzA.js';
|
|
7
|
-
import { E as EverfurTextingViewStatus, T as TextingCopy, a as TextingBrandCopy, b as TextingAsk } from '../optInView.d-
|
|
8
|
-
export { C as COPY_PLACEHOLDER_PREFIX, c as EVERFUR_TEXTING_STATUSES, d as EverfurTextingChallenge, e as EverfurTextingIdentity, f as EverfurTextingInputProblem, g as EverfurTextingProfile, h as EverfurTextingReason, i as EverfurTextingState, j as EverfurTextingStatus, k as EverfurTextingVerificationInput, l as TEXTING_ASK_MAX_ASKS, m as TEXTING_ASK_SCHEDULE_KEY, n as TEXTING_ASK_SNOOZE_MS, o as TEXTING_BRAND_COPY, p as TEXTING_CODE_PATTERN, q as TEXTING_COPY, r as TEXTING_COPY_PLACEHOLDERS, s as TEXTING_UI_CODE_LENGTH, t as TextingAction, u as TextingAskDue, v as TextingAskDueInput, w as TextingAskEntry, x as TextingAskIdentity, y as TextingAskOptions, z as TextingAskScheduleRead, A as TextingAskStage, B as TextingAskThreadMessage, D as TextingAskThreadState, F as TextingCodeRefusal, G as TextingController, H as TextingPhase, I as TextingRepository, J as TextingRepositoryDeps, K as TextingRuntime, L as TextingSnapshot, M as createTextingRepository, N as createTextingRepositoryOver, O as formatTextingPhone, P as isE164, Q as isTextingAskEligible, R as parseTextingProfile, S as resolveTextingAskDue, U as textingAskThreadReady, V as textingErrorText, W as textingIdentityFromWire, X as textingInputProblemText, Y as textingOptedOutBody, Z as textingReasonOf, _ as textingSupportText, $ as toTextingE164, a0 as useEverfurTexting, a1 as useEverfurTextingProfile, a2 as useEverfurTextingRepository, a3 as useTextingAsk, a4 as validateTextingCode, a5 as validateTextingEnroll } from '../optInView.d-
|
|
7
|
+
import { E as EverfurTextingViewStatus, T as TextingCopy, a as TextingBrandCopy, b as TextingAsk } from '../optInView.d-Cps7aLQN.js';
|
|
8
|
+
export { C as COPY_PLACEHOLDER_PREFIX, c as EVERFUR_TEXTING_STATUSES, d as EverfurTextingChallenge, e as EverfurTextingIdentity, f as EverfurTextingInputProblem, g as EverfurTextingProfile, h as EverfurTextingReason, i as EverfurTextingState, j as EverfurTextingStatus, k as EverfurTextingVerificationInput, l as TEXTING_ASK_MAX_ASKS, m as TEXTING_ASK_SCHEDULE_KEY, n as TEXTING_ASK_SNOOZE_MS, o as TEXTING_BRAND_COPY, p as TEXTING_CODE_PATTERN, q as TEXTING_COPY, r as TEXTING_COPY_PLACEHOLDERS, s as TEXTING_UI_CODE_LENGTH, t as TextingAction, u as TextingAskDue, v as TextingAskDueInput, w as TextingAskEntry, x as TextingAskIdentity, y as TextingAskOptions, z as TextingAskScheduleRead, A as TextingAskStage, B as TextingAskThreadMessage, D as TextingAskThreadState, F as TextingCodeRefusal, G as TextingController, H as TextingPhase, I as TextingRepository, J as TextingRepositoryDeps, K as TextingRuntime, L as TextingSnapshot, M as createTextingRepository, N as createTextingRepositoryOver, O as formatTextingPhone, P as isE164, Q as isTextingAskEligible, R as parseTextingProfile, S as resolveTextingAskDue, U as textingAskThreadReady, V as textingErrorText, W as textingIdentityFromWire, X as textingInputProblemText, Y as textingOptedOutBody, Z as textingReasonOf, _ as textingSupportText, $ as toTextingE164, a0 as useEverfurTexting, a1 as useEverfurTextingProfile, a2 as useEverfurTextingRepository, a3 as useTextingAsk, a4 as validateTextingCode, a5 as validateTextingEnroll } from '../optInView.d-Cps7aLQN.js';
|
|
9
9
|
export { a as AnonIdentityProvider, A as AuthContext, I as IdentityProvider, M as MintedToken, T as TokenProvider } from '../identity.d-D4VtpqRr.js';
|
|
10
10
|
export { A as AcceptedFrame, a as AnalysisCompleteFrame, b as AnalysisStartedFrame, D as DeltaFrame, c as DoneFrame, E as ErrorFrame, d as EverfurRequest, e as EverfurRequestBase, F as Frame, f as FrameBase, g as FrameKind, h as FreeCapRefusal, H as HeartbeatFrame, i as HttpMethod, M as MultipartBody, T as TransportPort, U as UnknownFrame, j as UrgencyLevel } from '../config.d-B7Z-KTGq.js';
|
|
11
11
|
export { B as Brand, C as ConversationId, P as PetRef, R as RecordsRequestId, U as UserRef, _ as __brand } from '../ids.d-B2GAAifq.js';
|
package/dist/texting/index.js
CHANGED
|
@@ -17,9 +17,9 @@ return w(c,{style:[i.offstate,t],accessible:true,accessibilityState:{busy:true},
|
|
|
17
17
|
return w(c,{style:[i.offstate,t],accessible:true,accessibilityRole:"text",accessibilityLabel:o,children:o.length>0?/* @__PURE__ */w(Text,{style:i.offstateText,children:o}):null})}function an(e){let{color:t,space:r,radius:n,type:i}=e;return h.create({offstate:{minHeight:on,justifyContent:"center",paddingHorizontal:r.lg,paddingVertical:r.md,backgroundColor:t.surfaceCream,borderRadius:n.md,borderWidth:h.hairlineWidth,borderColor:t.brandBorder},offstateText:{...face(e,"regular"),fontSize:i.size.body,lineHeight:Math.round(i.size.body*i.lineHeight.normal),color:t.text.muted},skeletonBar:{height:r.md,borderRadius:n.xs,backgroundColor:t.brandSofter}})}function sn(e){if(!(m.OS!=="ios"||e===""))try{let t=_?.announceForAccessibility;typeof t=="function"&&t.call(_,e)}catch{}}function AnnounceLine({line:e}){return i(()=>{sn(e)},[e]),null}function EverfurTextingOptIn(e){let t=L(e,["onStatusChange"]),n=r(()=>({copy:Qt(e.copy),brandCopy:Jt(e.brandCopy)}),[e.copy,e.brandCopy]),{copy:i,brandCopy:o}=n,l=useEverfurTheme(),a=r(()=>dn(l),[l]),s=useEverfurTexting();return s.status==="signedOut"?/* @__PURE__ */C(c,{style:[a.card,t.style],children:[
|
|
18
18
|
/* @__PURE__ */w(Text,{style:a.title,accessibilityRole:"header",children:o.introTitle(l.meta.displayName)}),
|
|
19
19
|
/* @__PURE__ */w(Text,{style:a.body,children:i.signedOut})]}):/* @__PURE__ */w(CapabilityGate,{capability:"texting",...t.renderDisabled?{renderDisabled:t.renderDisabled}:{},style:t.style,children:/* @__PURE__ */w(Xt.Provider,{value:n,children:/* @__PURE__ */w(OptInBody,{...t,texting:s,styles:a})})})}function Button({label:e,onPress:t,disabled:r=false,busy:n=false,styles:i,kind:o="primary",testID:l}){let a=o==="primary"?i.primary:o==="secondary"?i.secondary:i.link,s=o==="primary"?i.primaryLabel:o==="secondary"?i.secondaryLabel:i.linkLabel;/* @__PURE__ */
|
|
20
|
-
return w(f,{onPress:t,disabled:r||n,accessibilityRole:"button",accessibilityLabel:e,accessibilityState:{disabled:r||n,busy:n},style:[a,r||n?i.dimmed:null],...l===void 0?{}:{testID:l},children:/* @__PURE__ */w(Text,{tier:"control",style:s,children:e})})}function OptInBody({texting:e,styles:t,onStatusChange:r,renderNotice:n,style:o}){let{copy:l,brandCopy:s}=Zt(),d=useEverfurTheme(),{status:u,profile:h,snapshot:b}=e,y=h?.brandName??d.meta.displayName,[g,m]=a(""),[v,_]=a(false),[k,x]=a(""),[T,E]=a(null),[F,I]=a(false),[R,O]=a(null),[A,D]=a(false);i(()=>{r?.(u)},[r,u]),i(()=>{E(null),I(false)},[u]);let P=(e,r=false)=>/* @__PURE__ */w(c,{style:[t.card,o],accessibilityState:{busy:r},children:e}),z=(e,r)=>{let i=textingErrorText(e,b.failedAction,b.codeRefusal,l)
|
|
20
|
+
return w(f,{onPress:t,disabled:r||n,accessibilityRole:"button",accessibilityLabel:e,accessibilityState:{disabled:r||n,busy:n},style:[a,r||n?i.dimmed:null],...l===void 0?{}:{testID:l},children:/* @__PURE__ */w(Text,{tier:"control",style:s,children:e})})}function OptInBody({texting:e,styles:t,onStatusChange:r,renderNotice:n,style:o}){let{copy:l,brandCopy:s}=Zt(),d=useEverfurTheme(),{status:u,profile:h,snapshot:b}=e,y=h?.brandName??d.meta.displayName,[g,m]=a(""),[v,_]=a(false),[k,x]=a(""),[T,E]=a(null),[F,I]=a(false),[R,O]=a(null),[A,D]=a(false);i(()=>{r?.(u)},[r,u]),i(()=>{E(null),I(false)},[u]);let P=(e,r=false)=>/* @__PURE__ */w(c,{style:[t.card,o],accessibilityState:{busy:r},children:e}),z=(e,r)=>{let i=textingErrorText(e,b.failedAction,b.codeRefusal,l);/* @__PURE__ */
|
|
21
21
|
return C(c,{style:t.notice,accessibilityLiveRegion:"polite",children:[
|
|
22
|
-
/* @__PURE__ */w(HostRender,{resetKey:e,render:()=>n?n(e):/* @__PURE__ */w(Text,{style:t.noticeText,children:i}),fallback:/* @__PURE__ */w(Text,{style:t.noticeText,children:i})}),
|
|
22
|
+
/* @__PURE__ */w(HostRender,{resetKey:e,render:()=>n?n(e):/* @__PURE__ */w(Text,{style:t.noticeText,children:i}),fallback:/* @__PURE__ */w(Text,{style:t.noticeText,children:i})}),r===void 0?null:/* @__PURE__ */w(Button,{label:l.retry,onPress:r,styles:t,kind:"link"}),n?null:/* @__PURE__ */w(AnnounceLine,{line:i})]})},L=T===null?null:/* @__PURE__ */C(S,{children:[
|
|
23
23
|
/* @__PURE__ */w(Text,{style:t.noticeText,accessibilityLiveRegion:"polite",children:textingInputProblemText(T,l)}),
|
|
24
24
|
/* @__PURE__ */w(AnnounceLine,{line:textingInputProblemText(T,l)})]});if(u==="unavailable")return P(
|
|
25
25
|
/* @__PURE__ */C(S,{children:[
|
|
@@ -68,19 +68,19 @@ return w(f,{onPress:()=>o(t.petRef),disabled:n,accessibilityRole:"radio",accessi
|
|
|
68
68
|
/* @__PURE__ */w(Button,{label:n?a.savingPet:a.savePet,kind:"secondary",busy:n,disabled:!u,styles:e,onPress:()=>{d!==null&&l(d)},testID:"texting-pet-save"}),i&&!u?/* @__PURE__ */w(Text,{style:e.footnote,children:a.petSaved}):null]})]})}function dn(e){let{color:t,radius:r,space:n,type:i,slots:o}=e,l=(t,r,n)=>({...face(e,n),fontSize:t,lineHeight:Math.round(t*i.lineHeight.snug),color:r}),a=o.card?.textColor;return h.create({card:{gap:n.md,padding:n.lg,borderRadius:r.lg,borderWidth:1,borderColor:t.brandBorder,backgroundColor:t.surface,...k(o.card,1)},title:l(i.size.subtitle,a??t.text.primary,"bold"),subtitle:l(i.size.body,a??t.text.primary,"bold"),body:l(i.size.body,a??t.text.secondary,"regular"),footnote:l(i.size.caption,t.text.muted,"regular"),phone:l(i.size.body,a??t.text.primary,"bold"),label:l(i.size.caption,a??t.text.primary,"bold"),input:{minHeight:44,paddingHorizontal:n.md,borderRadius:r.md,borderWidth:1,borderColor:t.controlEdge,backgroundColor:t.surface,...l(i.size.body,t.text.primary,"regular"),...k(o.input,1),...x(o.input)},consentRow:{flexDirection:"row",alignItems:"flex-start",gap:n.sm,minHeight:44},box:{width:24,height:24,borderRadius:r.xs,borderWidth:2,borderColor:t.controlEdge,alignItems:"center",justifyContent:"center",backgroundColor:t.surface},boxChecked:{backgroundColor:t.brand,borderColor:t.brandInk},tick:{...l(i.size.caption,t.text.onBrand,"bold")},consentText:{flex:1,...l(i.size.caption,a??t.text.secondary,"regular")},primary:{minHeight:44,paddingHorizontal:n.lg,borderRadius:r.pill,alignItems:"center",justifyContent:"center",backgroundColor:t.brand,...k(o.primaryButton)},primaryLabel:{...l(i.size.body,t.text.onBrand,"bold"),...x(o.primaryButton)},secondary:{minHeight:44,paddingHorizontal:n.lg,borderRadius:r.pill,borderWidth:1,borderColor:t.brandBorder,alignItems:"center",justifyContent:"center",backgroundColor:t.surface},secondaryLabel:l(i.size.caption,t.brandInk,"bold"),link:{minHeight:44,justifyContent:"center",alignSelf:"flex-start"},linkLabel:{...l(i.size.caption,t.linkInk,"bold"),...x(o.link)},dimmed:{opacity:.5},links:{flexDirection:"row",flexWrap:"wrap",alignItems:"center",gap:n.md},notice:{gap:n.xs},noticeText:l(i.size.caption,t.errorRed,"regular"),confirm:{gap:n.sm,padding:n.md,borderRadius:r.md,backgroundColor:t.surfaceSubtle},petRow:{gap:n.xs},chips:{flexDirection:"row",flexWrap:"wrap",gap:n.sm},chip:{minHeight:44,paddingHorizontal:n.md,borderRadius:r.pill,borderWidth:1,borderColor:t.brandBorder,backgroundColor:t.surface,justifyContent:"center",...k(o.chip,1)},chipPicked:{backgroundColor:t.brandSoft,borderColor:t.brandInk},chipLabel:{...l(i.size.caption,t.text.primary,"regular"),...x(o.chip)},chipLabelPicked:{...face(e,"bold"),color:t.brandInk}})}var un=/* @__PURE__ */Symbol.for("@everfur/sdk#IntroOpen@v1"),cn=globalThis;function pn(e){if(typeof e!="object"||e===null)return false;let t=e;return t.holds instanceof Set&&t.listeners instanceof Set}var fn=cn[un],hn=()=>({holds:/* @__PURE__ */new Set,listeners:/* @__PURE__ */new Set}),bn=pn(fn)?fn:cn[un]=hn();function yn(){return bn.holds.size>0}function gn(e){return bn.listeners.add(e),()=>{bn.listeners.delete(e)}}function mn(){return o(gn,yn,yn)}function resolveTextingAskDue(e){let t=e.enabled&&e.capabilityGranted&&e.hasProfile&&e.signedIn&&e.scheduleEligible&&!e.offeredThisSession,r=t&&e.identity==="none"&&e.surfaceReady;return{readEnabled:t,due:r}}var vn=/* @__PURE__ */new Set(["emergency","schedule_soon"]);function textingAskThreadReady(e){if(e.isBootstrapping===true||e.isLoadingHistory===true||e.isStreaming===true||e.status==="error"||e.stopped===true)return false;let t=e.messages[e.messages.length-1];return t===void 0||t.role!=="assistant"||t.pending===true||t.checkin!==void 0||t.text.trim().length===0?false:!(typeof t.urgencyLevel=="string"&&vn.has(t.urgencyLevel))}var _n=/* @__PURE__ */new WeakSet;function Cn(e){return _n.has(e)}var wn="everfur.texting.askSchedule.v1",Sn=2880*60*1e3,kn=3,xn=/* @__PURE__ */Object.freeze({askCount:0,nextAskAt:null,completed:false});function isTextingAskEligible(e,t){if(e.status!=="ok")return false;let{entry:r}=e;return r.completed||r.askCount>=kn?false:r.nextAskAt===null||t>=r.nextAskAt}function Tn(e,t){return{askCount:Math.min(e.askCount+1,kn),nextAskAt:t+Sn,completed:e.completed}}function En(e,t){return{...e,nextAskAt:t+Sn}}function Fn(e){return{...e,completed:true}}function In(e){return e.askCount<=0?1:e.askCount===1?2:3}function Rn(e){if(e===null||typeof e!="object"||Array.isArray(e))return null;let t=e,{askCount:r,nextAskAt:n,completed:i}=t;return typeof r!="number"||!Number.isInteger(r)||r<0||n!==null&&(typeof n!="number"||!Number.isFinite(n))||typeof i!="boolean"?null:{askCount:Math.min(r,kn),nextAskAt:n,completed:i}}function On(e){let t;try{t=JSON.parse(e)}catch{return null}if(t===null||typeof t!="object"||Array.isArray(t))return null;let r={};for(let[e,n]of Object.entries(t)){let t=Rn(n);if(t===null)return null;r[e]=t}return r}var An=/* @__PURE__ */Symbol.for("@everfur/sdk/texting/ask-schedule@v1");function Dn(){let e=globalThis,t=e[An];return t===void 0&&(t={sessions:/* @__PURE__ */new Map,sessionListeners:/* @__PURE__ */new Set,listeners:/* @__PURE__ */new Set,writeChain:Promise.resolve()},e[An]=t),t.sessionListeners===void 0&&(t.sessionListeners=/* @__PURE__ */new Set),t}async function Pn(e){if(Cn(e))return{status:"unreadable"};let t;try{t=await e.getItem(wn)}catch{return{status:"unreadable"}}if(t===null)try{return await e.setItem(wn,"{}"),await e.getItem(wn)===null?{status:"unreadable"}:{status:"ok",map:{}}}catch{return{status:"unreadable"}}let r=On(t);if(r!==null)return{status:"ok",map:r};try{await e.removeItem(wn)}catch{}return{status:"unreadable"}}function zn(e){let{listeners:t}=Dn();return t.add(e),()=>{t.delete(e)}}function Ln(e,userRef,t){let r=Dn(),n=async()=>{let n=await Pn(e);if(n.status!=="ok")return;let i=n.map[userRef]??xn;try{await e.setItem(wn,JSON.stringify({...n.map,[userRef]:t(i)}))}catch{return}for(let e of[...r.listeners])e()},i=r.writeChain.then(n,n);return r.writeChain=i.catch(()=>{}),i}async function jn(e,userRef){let t=await Pn(e);return t.status!=="ok"?{status:"unreadable"}:{status:"ok",entry:t.map[userRef]??xn}}function Nn(e,userRef,t=Date.now()){return Ln(e,userRef,e=>Tn(e,t))}function Bn(e,userRef,t=Date.now()){return Ln(e,userRef,e=>En(e,t))}function Mn(e,userRef){return Ln(e,userRef,Fn)}function qn(userRef){return Dn().sessions.get(userRef)??null}function Hn(userRef,e){let t=Dn();t.sessions.set(userRef,e);for(let e of[...t.sessionListeners])e()}function Un(e){let{sessionListeners:t}=Dn();return t.add(e),()=>{t.delete(e)}}var NO_SNAPSHOT=()=>null;function $n(){let{runtime:e}=Vt(),t=e.entitlements??null,n=l(e=>t===null?()=>{}:t.subscribe(e),[t]),i=t===null?NO_SNAPSHOT:t.getSnapshot,a=o(n,i,i);return r(()=>a!==null&&decideCapability("texting",a.decisions,{isPending:a.isPending}).enabled,[a])}var Vn=/* @__PURE__ */Object.freeze({status:"idle"});function Wn(userRef){let{runtime:e}=Vt(),t=e.registry.services.kv,[r,n]=a({user:null,value:Vn});return i(()=>{if(userRef===null)return;let e=true,r=()=>{jn(t,userRef).then(t=>{e&&n({user:userRef,value:{status:"ready",read:t}})})};r();let i=zn(r);return()=>{e=false,i()}},[t,userRef]),r.user===userRef?r.value:Vn}function Yn(e){switch(e.status){case"enroll":case"requesting":case"code":case"confirming":return"none";case"verified":case"optingOut":case"optedOut":return"exists";default:return"unknown"}}function useTextingAsk(e={}){let t=e.enabled!==false,n=e.ready!==false,s=e.surface??"prompt",d=e.entry===true,{runtime:u,userRef:userRef}=Vt(),c=u.registry.services.kv,p=$n(),f=Wn(t&&userRef!==null?userRef:null),h=l(()=>userRef===null?null:qn(userRef),[userRef]),b=o(Un,h,h),y=l(e=>{userRef!==null&&Hn(userRef,e)},[userRef]),g=b!==null&&b.surface===s,m=b!==null&&b.fromPrompt===true,v=g?b.stage==="handoff"?"hidden":b.stage:s==="prompt"&&m?"dismissed":"hidden",_=Date.now(),C=f.status==="ready"&&isTextingAskEligible(f.read,_),[w,S]=a(null),k=d&&userRef!==null&&p,x=Tr(userRef!==null&&w===userRef||v!=="hidden"||g||k),T=Yn(x),{readEnabled:E,due:F}=resolveTextingAskDue({enabled:t,capabilityGranted:p,hasProfile:x.profile!==null,signedIn:userRef!==null,scheduleEligible:C,offeredThisSession:b!==null,identity:T,surfaceReady:n});i(()=>{E&&userRef!==null&&S(userRef)},[E,userRef]);let I=b?.askNumber??(f.status==="ready"&&f.read.status==="ok"?In(f.read.entry):1);i(()=>{!F||userRef===null||qn(userRef)!==null||y({surface:s,stage:"offered",answered:false,askNumber:I})},[F,userRef,y,I,s]),i(()=>{!g||b.stage!=="handoff"||t&&n&&p&&x.profile!==null&&T==="none"&&y({...b,stage:"offered"})},[g,b,t,n,p,x.profile,T,y]);let R=f.status==="ready"&&f.read.status==="ok"&&f.read.entry.completed;i(()=>{userRef===null||T!=="exists"||R||f.status!=="ready"||Mn(c,userRef)},[T,R,f.status,c,userRef]),i(()=>{g&&b.stage==="enrolling"&&x.status==="verified"&&y({...b,stage:"verified"})},[g,b,x.status,y]);let O=l(e=>userRef===null||e.answered?e:(Nn(c,userRef),{...e,answered:true}),[c,userRef]),A=l(()=>{g&&b.stage==="offered"&&y({...b,stage:"enrolling"})},[g,b,y]),D=l(()=>{if(!g||b.stage!=="enrolling")return;let{back:e,...t}=b;y({...t,stage:e??"offered"})},[g,b,y]),P=l(()=>{if(!(!g||b.stage!=="offered"&&b.stage!=="enrolling")){if(s==="prompt"){y({...O(b),surface:"chat",stage:"handoff",fromPrompt:true});return}b.fromPrompt===true&&b.answered&&userRef!==null&&Bn(c,userRef),y({...O(b),stage:"dismissed"})}},[g,b,s,y,O,c,userRef]),{start:z}=x,L=l(async e=>!g||b.stage!=="enrolling"?false:(b.answered||y(O(b)),z(e)),[g,b,y,O,z]),j=k&&x.profile!==null&&T==="none"&&v!=="enrolling"&&v!=="verified",N=l(()=>{if(!j||userRef===null)return;let e=g?b:null;y({surface:s,stage:"enrolling",answered:e?.answered??false,askNumber:b?.askNumber??I,...e?.fromPrompt===true?{fromPrompt:true}:{},back:e?.stage==="offered"?"offered":"dismissed"})},[j,userRef,g,b,y,s,I]),B=x.profile?.brandName??"";return r(()=>({stage:userRef===null?"hidden":v,brand:B,askNumber:I,texting:x,accept:A,dismiss:P,close:D,start:L,canOpen:j,open:N}),[userRef,v,B,I,x,A,P,D,L,j,N])}var Kn=/* @__PURE__ */new Set(["signedOut","unavailable","failed","verified","optingOut","optedOut"]);function Gn(e,t,r,o){let{userRef:userRef}=Vt(),l=n(null),{canOpen:a,open:s,stage:d,texting:u}=e;i(()=>{if(!t){l.current=null;return}if(!(userRef===null||l.current===userRef)){if(a){l.current=userRef,s();return}if(d==="enrolling"||d==="verified"){l.current=userRef;return}(!r||Kn.has(u.status))&&(l.current=userRef,D(o,"skipped"))}},[t,userRef,a,s,d,u.status,r,o])}var Qn=/* @__PURE__ */Object.freeze({position:"absolute",top:0,right:0,bottom:0,left:0});function ChatTextingAskController({enabled:e,ready:t,onAsk:r,entry:n=false}){let o=useTextingAsk({enabled:e,ready:t,surface:"chat",entry:n});return i(()=>{D(r,o)},[o,r]),null}function textingAskLines(e){return{line:Kt.chatAskLine(e.brand),accept:Yt.promptAccept,dismiss:Yt.promptDismiss,verified:Kt.chatAskVerified(e.brand)}}function ChatTextingAskComposer({ask:e}){let t=useEverfurTheme(),n=r(()=>Jn(t),[t]);/* @__PURE__ */
|
|
69
69
|
return w(AskEntry,{ask:e,styles:n})}function AskEntry({ask:e,styles:t}){let{texting:r}=e,{status:o,profile:l,snapshot:s}=r,[d,u]=a(""),[p,h]=a(false),[b,y]=a(""),[g,m]=a(null),[v,_]=a(false),k={onFocus:()=>_(true),onBlur:()=>_(false)},x=v?[t.pill,t.pillFocused]:t.pill,T=o==="enroll"||o==="requesting"&&!s.resending,E=o==="code"||o==="confirming"||o==="requesting",F=n(null),I=n(null),R=o==="enroll",O=o==="code";i(()=>{m(null)},[o]),i(()=>{R?F.current?.focus():O&&I.current?.focus()},[R,O]);let A=/* @__PURE__ */C(f,{onPress:e.close,accessibilityRole:"button",accessibilityLabel:Yt.close,hitSlop:8,style:t.close,testID:"texting-ask-close",children:[
|
|
70
70
|
/* @__PURE__ */w(c,{style:[t.closeBar,t.closeBarA]}),
|
|
71
|
-
/* @__PURE__ */w(c,{style:[t.closeBar,t.closeBarB]})]}),D=s.error===null?null:textingErrorText(s.error,s.failedAction,s.codeRefusal),P=
|
|
72
|
-
/* @__PURE__ */w(Text,{style:t.noticeText,children:D}),
|
|
73
|
-
/* @__PURE__ */w(AnnounceLine,{line:
|
|
71
|
+
/* @__PURE__ */w(c,{style:[t.closeBar,t.closeBarB]})]}),D=s.error===null?null:textingErrorText(s.error,s.failedAction,s.codeRefusal),P=D===null?null:/* @__PURE__ */C(c,{style:t.notice,accessibilityRole:"alert",accessibilityLiveRegion:"polite",children:[
|
|
72
|
+
/* @__PURE__ */w(Text,{style:t.noticeText,children:D}),
|
|
73
|
+
/* @__PURE__ */w(AnnounceLine,{line:D})]}),z=g===null?null:/* @__PURE__ */C(S,{children:[
|
|
74
74
|
/* @__PURE__ */w(Text,{style:t.noticeText,accessibilityRole:"alert",accessibilityLiveRegion:"polite",children:textingInputProblemText(g)}),
|
|
75
75
|
/* @__PURE__ */w(AnnounceLine,{line:textingInputProblemText(g)})]});if(l===null)return null;if(o==="loading"||o==="failed"||o==="signedOut"||o==="unavailable")/* @__PURE__ */
|
|
76
76
|
return w(c,{style:t.root,testID:"texting-ask-entry",accessibilityState:{busy:o==="loading"},children:/* @__PURE__ */C(c,{style:t.head,children:[
|
|
77
|
-
/* @__PURE__ */w(c,{style:t.headBody,children:o==="failed"?
|
|
77
|
+
/* @__PURE__ */w(c,{style:t.headBody,children:o==="failed"?P:null}),A]})});if(T){let r=o==="requesting",n=()=>{let t=validateTextingEnroll(d,p);m(t),t===null&&e.start(d)};/* @__PURE__ */
|
|
78
78
|
return C(c,{style:t.root,testID:"texting-ask-phone",children:[
|
|
79
79
|
/* @__PURE__ */C(c,{style:t.head,children:[
|
|
80
80
|
/* @__PURE__ */C(c,{style:t.headBody,children:[
|
|
81
81
|
/* @__PURE__ */C(f,{onPress:()=>h(!p),disabled:r,accessibilityRole:"checkbox",accessibilityState:{checked:p,disabled:r},accessibilityLabel:l.consentText,style:t.consentRow,testID:"texting-ask-consent",children:[
|
|
82
82
|
/* @__PURE__ */w(c,{style:[t.box,p?t.boxChecked:null],accessibilityElementsHidden:true,importantForAccessibility:"no",children:p?/* @__PURE__ */w(Text,{style:t.tick,children:"✓"}):null}),
|
|
83
|
-
/* @__PURE__ */w(Text,{style:t.consentText,children:l.consentText})]}),l.helpContact===null?null:/* @__PURE__ */C(Text,{style:t.footnote,children:[Yt.helpContactLabel," ",l.helpContact]})]}),A]}),
|
|
83
|
+
/* @__PURE__ */w(Text,{style:t.consentText,children:l.consentText})]}),l.helpContact===null?null:/* @__PURE__ */C(Text,{style:t.footnote,children:[Yt.helpContactLabel," ",l.helpContact]})]}),A]}),z,P,
|
|
84
84
|
/* @__PURE__ */C(c,{style:x,children:[
|
|
85
85
|
/* @__PURE__ */w(Zr,{value:d,onChangeText:u,editable:!r,keyboardType:"phone-pad",textContentType:"telephoneNumber",autoComplete:"tel",accessibilityLabel:Yt.phoneLabel,placeholder:Yt.phoneLabel,placeholderTextColor:t.placeholder.color,ref:F,onSubmitEditing:n,...k,style:t.field,testID:"texting-ask-phone-input"},"phone"),
|
|
86
86
|
/* @__PURE__ */w(f,{onPress:n,disabled:r,accessibilityRole:"button",accessibilityLabel:r?Yt.sendingCode:Yt.sendCode,accessibilityState:{disabled:r,busy:r},style:[t.primary,r?t.dimmed:null],testID:"texting-ask-send",children:/* @__PURE__ */w(Text,{tier:"control",style:t.primaryLabel,children:r?Yt.sendingCode:Yt.sendCode})})]})]})}if(E){let e=o==="confirming",n=o==="requesting",i=e||n,l=()=>{let e=validateTextingCode(b);m(e),e===null&&r.confirm(b)};/* @__PURE__ */
|
|
@@ -90,7 +90,7 @@ return C(c,{style:t.root,testID:"texting-ask-code",children:[
|
|
|
90
90
|
/* @__PURE__ */C(Text,{style:t.body,children:[Yt.codeSentTo," ",formatTextingPhone(s.phoneE164)]}),
|
|
91
91
|
/* @__PURE__ */C(c,{style:t.links,children:[
|
|
92
92
|
/* @__PURE__ */w(f,{onPress:()=>{y(""),r.resend()},disabled:i,accessibilityRole:"button",accessibilityState:{disabled:i,busy:n},style:[t.link,i?t.dimmed:null],children:/* @__PURE__ */w(Text,{style:t.linkLabel,children:Yt.requestNewCode})}),
|
|
93
|
-
/* @__PURE__ */w(f,{onPress:()=>{y(""),r.changeNumber()},disabled:i,accessibilityRole:"button",accessibilityState:{disabled:i},style:[t.link,i?t.dimmed:null],children:/* @__PURE__ */w(Text,{style:t.linkLabel,children:Yt.changeNumber})})]})]}),A]}),
|
|
93
|
+
/* @__PURE__ */w(f,{onPress:()=>{y(""),r.changeNumber()},disabled:i,accessibilityRole:"button",accessibilityState:{disabled:i},style:[t.link,i?t.dimmed:null],children:/* @__PURE__ */w(Text,{style:t.linkLabel,children:Yt.changeNumber})})]})]}),A]}),z,P,
|
|
94
94
|
/* @__PURE__ */C(c,{style:x,children:[
|
|
95
95
|
/* @__PURE__ */w(Zr,{value:b,onChangeText:e=>y(e.replace(/\D/g,"")),editable:!i,keyboardType:"number-pad",textContentType:"oneTimeCode",autoComplete:"sms-otp",maxLength:6,accessibilityLabel:Yt.codeLabel,placeholder:Yt.codeLabel,placeholderTextColor:t.placeholder.color,ref:I,onSubmitEditing:l,...k,style:[t.field,t.digits],testID:"texting-ask-code-input"},"code"),
|
|
96
96
|
/* @__PURE__ */w(f,{onPress:l,disabled:i,accessibilityRole:"button",accessibilityLabel:e?Yt.confirmingCode:Yt.confirmCode,accessibilityState:{disabled:i,busy:e},style:[t.primary,i?t.dimmed:null],testID:"texting-ask-confirm",children:/* @__PURE__ */w(Text,{tier:"control",style:t.primaryLabel,children:e?Yt.confirmingCode:Yt.confirmCode})})]})]})}return null}function Jn(e,t="auto"){let{color:r,radius:n,space:i,type:o,slots:l}=e,a=(t,r,n)=>({...face(e,n),fontSize:t,lineHeight:Math.round(t*o.lineHeight.snug),color:r}),s={textAlign:t};return h.create({root:{gap:i.sm,width:"100%"},head:{flexDirection:"row",alignItems:"flex-start",gap:i.sm},headBody:{flex:1,minWidth:0,gap:i.xs},consentRow:{flexDirection:"row",alignItems:"flex-start",gap:i.sm,minHeight:44},box:{width:24,height:24,borderRadius:n.xs,borderWidth:2,borderColor:r.controlEdge,alignItems:"center",justifyContent:"center",backgroundColor:r.surface},boxChecked:{backgroundColor:r.brand,borderColor:r.brandInk},tick:a(o.size.caption,r.text.onBrand,"bold"),consentText:{...t==="center"?{flexShrink:1}:{flex:1},...a(o.size.caption,r.text.secondary,"regular"),...s},body:{...a(o.size.body,r.text.primary,"regular"),...s},footnote:{...a(o.size.caption,r.text.muted,"regular"),...s},placeholder:{color:r.text.placeholder},pill:{flexDirection:"row",alignItems:"center",gap:i.xs,minHeight:50,paddingVertical:i.xs,paddingLeft:i.md,paddingRight:i.xs,borderRadius:n.pill,borderWidth:1.5,borderColor:r.controlEdge,backgroundColor:r.surface,...k(l.input,1)},pillFocused:{borderWidth:1.5,borderColor:l.input?.borderColor??r.brandInk},field:{flex:1,minWidth:0,minHeight:44,padding:0,...a(o.size.body,r.text.primary,"regular"),...x(l.input)},digits:{fontVariant:["tabular-nums"]},primary:{minHeight:44,paddingHorizontal:i.lg,borderRadius:n.pill,alignItems:"center",justifyContent:"center",backgroundColor:r.brand,...k(l.primaryButton)},primaryLabel:{...a(o.size.caption,r.text.onBrand,"bold"),...x(l.primaryButton)},dimmed:{opacity:.5},close:{width:44,height:44,alignItems:"center",justifyContent:"center"},closeBar:{position:"absolute",width:18,height:2,borderRadius:1,backgroundColor:r.text.muted},closeBarA:{transform:[{rotate:"45deg"}]},closeBarB:{transform:[{rotate:"-45deg"}]},links:{flexDirection:"row",flexWrap:"wrap",alignItems:"center",gap:i.md},link:{minHeight:44,justifyContent:"center"},linkLabel:{...a(o.size.caption,r.linkInk,"bold"),...x(l.link)},notice:{gap:i.xs},noticeText:{...a(o.size.caption,r.errorRed,"regular"),...s}})}var Xn=["portrait","landscape"],Zn=/* @__PURE__ */new Set(["offered","enrolling"]);function EverfurTextingPrompt({onResolved:e,requested:t=false}){let o=mn(),l=useTextingAsk({surface:"prompt",ready:!o,entry:t});Gn(l,t,$n(),e);let s=useEverfurTheme(),d=r(()=>ei(s),[s]),u=r(()=>Jn(s,"center"),[s]),p=n(false),[h,v]=a(false);Zn.has(l.stage)&&(p.current=true);let _=p.current&&(Zn.has(l.stage)||l.stage==="verified")&&!h&&!o,k=()=>{h||(l.stage==="verified"?(v(true),D(e,"verified")):l.dismiss())};if(i(()=>{p.current&&l.stage==="dismissed"&&!h&&(v(true),D(e,"dismissed"))},[l.stage,e,h]),!_)return null;let x=l.stage==="verified"?Yt.verifiedTitle:Kt.promptTitle(l.brand);/* @__PURE__ */
|
|
@@ -1,7 +1,7 @@
|
|
|
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
2
|
import { E as EverfurResult } from './EverfurResult.d-D_-254ZY.js';
|
|
3
3
|
import { P as PetRef } from './ids.d-B2GAAifq.js';
|
|
4
|
-
import { E as EverfurInboxItem, b as EverfurInboxOpen, a as EverfurInboxClient } from './inbox.d-
|
|
4
|
+
import { E as EverfurInboxItem, b as EverfurInboxOpen, a as EverfurInboxClient } from './inbox.d-B2JXK0uI.js';
|
|
5
5
|
import { E as EverfurError } from './EverfurError.d-8NHtlgzA.js';
|
|
6
6
|
import { L as LifecyclePort } from './LifecyclePort.d-Cb9NtmP-.js';
|
|
7
7
|
|