@everfur/sdk 0.1.1 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +703 -4
- package/README.md +63 -23
- package/consent/package.json +8 -0
- package/dist/Chat-BZZ-Py5l.d.ts +128 -0
- package/dist/Chat-Dq4fffIO.d.cts +128 -0
- package/dist/DepthViews-BG3E25MD.d.ts +16 -0
- package/dist/DepthViews-B_hIypI6.d.cts +19 -0
- package/dist/DepthViews-CL75jyRA.d.cts +16 -0
- package/dist/DepthViews-CkYri51q.d.ts +19 -0
- package/dist/ErrorPolicyPort-CNf4uQZP.d.cts +22 -0
- package/dist/ErrorPolicyPort-CwbfmxzJ.d.ts +22 -0
- package/dist/{EverfurResult-D92-uL82.d.cts → EverfurResult-DN9pL2Ab.d.cts} +11 -10
- package/dist/{EverfurResult-D92-uL82.d.ts → EverfurResult-DN9pL2Ab.d.ts} +11 -10
- package/dist/{PhotoController-BItt5M7u.d.cts → PhotoController-3l7MT9jA.d.cts} +1 -1
- package/dist/{PhotoController-D8zMTdcW.d.ts → PhotoController-vzY5bfY_.d.ts} +1 -1
- package/dist/animations/index.cjs +1 -1997
- package/dist/animations/index.d.cts +35 -35
- package/dist/animations/index.d.ts +35 -35
- package/dist/animations/index.js +1 -1972
- package/dist/attachments-BorG422I.d.cts +146 -0
- package/dist/attachments-BrUWQYNK.d.ts +257 -0
- package/dist/attachments-D_SECjr1.d.cts +257 -0
- package/dist/attachments-DpldrvIW.d.ts +146 -0
- package/dist/bookingCopy-CqtDYvCR.d.ts +732 -0
- package/dist/bookingCopy-SREvkG19.d.cts +732 -0
- package/dist/branding-CsRdeNwK.d.cts +566 -0
- package/dist/branding-CsRdeNwK.d.ts +566 -0
- package/dist/callCopy-DoQKG3-L.d.cts +40 -0
- package/dist/callCopy-DoQKG3-L.d.ts +40 -0
- package/dist/casesRepository-DwtZVsbj.d.cts +51 -0
- package/dist/casesRepository-v6QczS9N.d.ts +51 -0
- package/dist/chat/index.cjs +1 -1170
- package/dist/chat/index.d.cts +32 -53
- package/dist/chat/index.d.ts +32 -53
- package/dist/chat/index.js +1 -1167
- package/dist/client/index.cjs +9 -2315
- package/dist/client/index.d.cts +80 -16
- package/dist/client/index.d.ts +80 -16
- package/dist/client/index.js +9 -2215
- package/dist/{config-CiJ0PVBB.d.ts → config--Wu1Umhd.d.cts} +64 -26
- package/dist/{config-BSjBdxrZ.d.cts → config-C7eb_IMD.d.ts} +64 -26
- package/dist/consent/index.cjs +1 -0
- package/dist/consent/index.d.cts +33 -0
- package/dist/consent/index.d.ts +33 -0
- package/dist/consent/index.js +1 -0
- package/dist/context-CL3lyuy1.d.cts +159 -0
- package/dist/context-CahAEha8.d.ts +159 -0
- package/dist/copy-DdVFDL01.d.ts +198 -0
- package/dist/copy-UeUJVk8X.d.cts +198 -0
- package/dist/core/index.cjs +13 -3178
- package/dist/core/index.d.cts +164 -29
- package/dist/core/index.d.ts +164 -29
- package/dist/core/index.js +13 -3166
- package/dist/depth-D5HwcvKC.d.cts +533 -0
- package/dist/depth-DvPwPuT_.d.ts +533 -0
- package/dist/entitlementRepository-B7egEdW6.d.ts +43 -0
- package/dist/entitlementRepository-BpJ7tiwl.d.cts +43 -0
- package/dist/{identity-Brl-lDd6.d.cts → identity-C2-08BZW.d.cts} +20 -7
- package/dist/{identity-DK9zORrG.d.ts → identity-CEi9GRFZ.d.ts} +20 -7
- package/dist/{ids-CJ1S6adf.d.cts → ids-B2GAAifq.d.cts} +1 -1
- package/dist/{ids-CJ1S6adf.d.ts → ids-B2GAAifq.d.ts} +1 -1
- package/dist/index.cjs +12 -4494
- package/dist/index.d.cts +30 -121
- package/dist/index.d.ts +30 -121
- package/dist/index.js +12 -4470
- package/dist/models-B-Uh2LTf.d.ts +214 -0
- package/dist/models-D2EUxPZY.d.cts +214 -0
- package/dist/notifications/index.cjs +2 -0
- package/dist/notifications/index.d.cts +17 -0
- package/dist/notifications/index.d.ts +17 -0
- package/dist/notifications/index.js +2 -0
- package/dist/optionalModule-DbJmsq5f.d.cts +21 -0
- package/dist/optionalModule-DbJmsq5f.d.ts +21 -0
- package/dist/pets-DJv2sj2H.d.ts +92 -0
- package/dist/pets-JVCXgRgR.d.cts +92 -0
- package/dist/petsRepository-B_gKbAzJ.d.cts +142 -0
- package/dist/petsRepository-Bk6GDwLs.d.ts +142 -0
- package/dist/photo/index.cjs +1 -2189
- package/dist/photo/index.d.cts +6 -6
- package/dist/photo/index.d.ts +6 -6
- package/dist/photo/index.js +1 -2186
- package/dist/ports-BN6RHF9W.d.cts +48 -0
- package/dist/ports-BN6RHF9W.d.ts +48 -0
- package/dist/ports-BY2ph0_y.d.cts +376 -0
- package/dist/ports-D7YW8qz9.d.ts +376 -0
- package/dist/profile-CSs1wlXT.d.cts +93 -0
- package/dist/profile-CSs1wlXT.d.ts +93 -0
- package/dist/records/depth/index.cjs +2 -0
- package/dist/records/depth/index.d.cts +13 -0
- package/dist/records/depth/index.d.ts +13 -0
- package/dist/records/depth/index.js +2 -0
- package/dist/records/index.cjs +3 -2839
- package/dist/records/index.d.cts +137 -203
- package/dist/records/index.d.ts +137 -203
- package/dist/records/index.js +3 -2833
- package/dist/requestFunnel-BjDpqqvm.d.cts +110 -0
- package/dist/requestFunnel-DFMGcluw.d.ts +110 -0
- package/dist/{resolve-Dq_4_agU.d.ts → resolve-D4Ywz5OS.d.cts} +10 -4
- package/dist/{resolve-Dq_4_agU.d.cts → resolve-D4Ywz5OS.d.ts} +10 -4
- package/dist/{runtime-Bvr8yqXm.d.cts → runtimeTypes-gZEJu-da.d.cts} +104 -132
- package/dist/{runtime-BIYzf9cK.d.ts → runtimeTypes-w5KqBMcs.d.ts} +104 -132
- package/dist/server/events/index.cjs +2 -0
- package/dist/server/events/index.d.cts +550 -0
- package/dist/server/events/index.d.ts +550 -0
- package/dist/server/events/index.js +2 -0
- package/dist/server/index.cjs +2 -533
- package/dist/server/index.d.cts +73 -18
- package/dist/server/index.d.ts +73 -18
- package/dist/server/index.js +2 -530
- package/dist/species-BXAIMh7I.d.cts +9 -0
- package/dist/species-BXAIMh7I.d.ts +9 -0
- package/dist/televet/booking/index.cjs +1 -0
- package/dist/televet/booking/index.d.cts +294 -0
- package/dist/televet/booking/index.d.ts +294 -0
- package/dist/televet/booking/index.js +1 -0
- package/dist/televet/call/index.cjs +1 -0
- package/dist/televet/call/index.d.cts +141 -0
- package/dist/televet/call/index.d.ts +141 -0
- package/dist/televet/call/index.js +1 -0
- package/dist/televet/index.cjs +1 -0
- package/dist/televet/index.d.cts +142 -0
- package/dist/televet/index.d.ts +142 -0
- package/dist/televet/index.js +1 -0
- package/dist/testing/index.cjs +5 -823
- package/dist/testing/index.d.cts +18 -4
- package/dist/testing/index.d.ts +18 -4
- package/dist/testing/index.js +5 -820
- package/dist/testing/rn/index.cjs +1 -449
- package/dist/testing/rn/index.d.cts +18 -29
- package/dist/testing/rn/index.d.ts +18 -29
- package/dist/testing/rn/index.js +1 -444
- package/dist/testing/web/index.cjs +1 -0
- package/dist/testing/web/index.d.cts +132 -0
- package/dist/testing/web/index.d.ts +132 -0
- package/dist/testing/web/index.js +1 -0
- package/dist/timelineRows-C15jxFFH.d.ts +19 -0
- package/dist/timelineRows-odO8g9r2.d.cts +19 -0
- package/dist/typeStyle-CKqVYD6L.d.cts +111 -0
- package/dist/typeStyle-DmoyacDG.d.ts +111 -0
- package/dist/uploadTransport-D0M0T4hN.d.ts +38 -0
- package/dist/uploadTransport-DKJHs3Yj.d.cts +38 -0
- package/dist/useRecordsDepth-C6rjEaLn.d.cts +237 -0
- package/dist/useRecordsDepth-crhBllQK.d.ts +237 -0
- package/dist/useVetVisit-Bc84hWUU.d.cts +187 -0
- package/dist/useVetVisit-CjmMa896.d.ts +187 -0
- package/dist/video/index.cjs +1 -1941
- package/dist/video/index.d.cts +4 -4
- package/dist/video/index.d.ts +4 -4
- package/dist/video/index.js +1 -1938
- package/dist/view-Bxwxp4xD.d.ts +310 -0
- package/dist/view-DyitEO0m.d.cts +310 -0
- package/dist/visitIntent-D7_yVp1I.d.cts +8 -0
- package/dist/visitIntent-D7_yVp1I.d.ts +8 -0
- package/dist/web/consent/index.cjs +1 -0
- package/dist/web/consent/index.d.cts +34 -0
- package/dist/web/consent/index.d.ts +34 -0
- package/dist/web/consent/index.js +1 -0
- package/dist/web/index.cjs +14 -0
- package/dist/web/index.d.cts +218 -0
- package/dist/web/index.d.ts +218 -0
- package/dist/web/index.js +14 -0
- package/dist/web/notifications/index.cjs +2 -0
- package/dist/web/notifications/index.d.cts +213 -0
- package/dist/web/notifications/index.d.ts +213 -0
- package/dist/web/notifications/index.js +2 -0
- package/dist/web/records/depth/index.cjs +2 -0
- package/dist/web/records/depth/index.d.cts +12 -0
- package/dist/web/records/depth/index.d.ts +12 -0
- package/dist/web/records/depth/index.js +2 -0
- package/dist/web/records/index.cjs +4 -0
- package/dist/web/records/index.d.cts +285 -0
- package/dist/web/records/index.d.ts +285 -0
- package/dist/web/records/index.js +4 -0
- package/dist/web/televet/booking/index.cjs +1 -0
- package/dist/web/televet/booking/index.d.cts +349 -0
- package/dist/web/televet/booking/index.d.ts +349 -0
- package/dist/web/televet/booking/index.js +1 -0
- package/dist/web/televet/call/index.cjs +1 -0
- package/dist/web/televet/call/index.d.cts +142 -0
- package/dist/web/televet/call/index.d.ts +142 -0
- package/dist/web/televet/call/index.js +1 -0
- package/dist/web/televet/index.cjs +1 -0
- package/dist/web/televet/index.d.cts +136 -0
- package/dist/web/televet/index.d.ts +136 -0
- package/dist/web/televet/index.js +1 -0
- package/notifications/package.json +8 -0
- package/package.json +266 -10
- package/records/depth/package.json +8 -0
- package/server/events/device-blocked.cjs +15 -0
- package/server/events/package.json +9 -0
- package/televet/booking/package.json +8 -0
- package/televet/call/package.json +8 -0
- package/televet/package.json +8 -0
- package/testing/web/native-blocked.cjs +12 -0
- package/testing/web/package.json +8 -0
- package/web/consent/native-blocked.cjs +12 -0
- package/web/consent/package.json +8 -0
- package/web/native-blocked.cjs +12 -0
- package/web/notifications/native-blocked.cjs +12 -0
- package/web/notifications/package.json +8 -0
- package/web/package.json +8 -0
- package/web/records/depth/native-blocked.cjs +12 -0
- package/web/records/depth/package.json +8 -0
- package/web/records/native-blocked.cjs +12 -0
- package/web/records/package.json +8 -0
- package/web/televet/booking/native-blocked.cjs +12 -0
- package/web/televet/booking/package.json +8 -0
- package/web/televet/call/native-blocked.cjs +12 -0
- package/web/televet/call/package.json +8 -0
- package/web/televet/native-blocked.cjs +12 -0
- package/web/televet/package.json +8 -0
- package/dist/ChatController-CKdBvPj2.d.ts +0 -146
- package/dist/ChatController-CpUMvvZf.d.cts +0 -146
- package/dist/FilePort-BabWrv7I.d.cts +0 -22
- package/dist/FilePort-BabWrv7I.d.ts +0 -22
- package/dist/petsRepository-BEGb97M9.d.cts +0 -326
- package/dist/petsRepository-Bu18r2kK.d.ts +0 -326
- package/dist/requestFunnel-DuUH-kAe.d.cts +0 -28
- package/dist/requestFunnel-dio5OmR9.d.ts +0 -28
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var react=require('react'),zod=require('zod');var Ce=Object.defineProperty;var n=(e,t)=>Ce(e,"name",{value:t,configurable:true});function T(e,t){return Object.freeze(t===void 0?{ok:true,value:e}:{ok:true,value:e,warning:t})}n(T,"ok");function l(e){return Object.freeze({ok:false,error:e})}n(l,"err");var x=class x extends Error{constructor(t,r){super(r),this.name="EverfurConfigError",this.kind=t,Object.setPrototypeOf(this,x.prototype);}};n(x,"EverfurConfigError");var R=x;var H=Symbol.for("@everfur/sdk#EverfurContext@v1"),W=globalThis,K=W[H]??(W[H]=react.createContext(null));K.displayName??="EverfurContext";function h(){let e=react.useContext(K);if(e===null)throw new R("not-initialized","Everfur hooks must be called inside <EverfurProvider>. Wrap your tree once, high.");return e}n(h,"useEverfurContext");function ke(){let{runtime:e}=h();return react.useMemo(()=>({apply:n(t=>e.updateEntitlements(t),"apply")}),[e])}n(ke,"useEverfurTestEntitlements");var D=Object.freeze([Object.freeze({wireCode:"AccessDeniedException",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"AuthorizationException",envelope:"http_envelope",httpStatus:401,retryable:false}),Object.freeze({wireCode:"ConflictException",envelope:"http_envelope",httpStatus:409,retryable:true}),Object.freeze({wireCode:"DAILY_QUOTA_EXCEEDED",envelope:"http_envelope",httpStatus:429,retryable:true}),Object.freeze({wireCode:"FILE_TOO_LARGE",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"IDEMPOTENCY_KEY_IN_FLIGHT",envelope:"http_envelope",httpStatus:409,retryable:true}),Object.freeze({wireCode:"IDEMPOTENCY_KEY_REUSED_DIFFERENT_REQUEST",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"INVALID_CONTENT_TYPE",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"InternalFailureException",envelope:"http_envelope",httpStatus:500,retryable:true}),Object.freeze({wireCode:"MethodNotAllowedException",envelope:"http_envelope",httpStatus:405,retryable:false}),Object.freeze({wireCode:"NotImplementedException",envelope:"http_envelope",httpStatus:501,retryable:false}),Object.freeze({wireCode:"PaymentRequiredException",envelope:"http_envelope",httpStatus:402,retryable:false}),Object.freeze({wireCode:"ResourceNotFoundException",envelope:"http_envelope",httpStatus:404,retryable:false}),Object.freeze({wireCode:"ServiceUnavailableException",envelope:"http_envelope",httpStatus:503,retryable:true}),Object.freeze({wireCode:"TIER_UPGRADE_REQUIRED",envelope:"http_envelope",httpStatus:402,retryable:false}),Object.freeze({wireCode:"ThrottlingException",envelope:"http_envelope",httpStatus:429,retryable:true}),Object.freeze({wireCode:"ValidationException",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"accessDenied",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"access_denied",envelope:"oauth_error",httpStatus:302,retryable:false}),Object.freeze({wireCode:"attachment_unreadable",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"authExpired",envelope:"http_envelope",httpStatus:401,retryable:true}),Object.freeze({wireCode:"authRejected",envelope:"http_envelope",httpStatus:401,retryable:false}),Object.freeze({wireCode:"consent_invalid",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"consent_required",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"consent_scope_wrong_route",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"device_cipher_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true}),Object.freeze({wireCode:"email_invalid",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"event_cursor_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"event_filter_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"event_payload_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"event_type_not_available",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"event_type_unknown",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"idempotency_key_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"idempotency_key_required",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"idempotency_key_reused",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"insufficientCapability",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"insufficient_scope",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"internal_error",envelope:"sse_frame",httpStatus:200,retryable:false}),Object.freeze({wireCode:"invalidRequest",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"invalid_client",envelope:"oauth_error",httpStatus:401,retryable:false}),Object.freeze({wireCode:"invalid_client_metadata",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"invalid_grant",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"invalid_redirect_uri",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"invalid_request",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"invalid_scope",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"invalid_target",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"mcp_connection_not_found",envelope:"http_envelope",httpStatus:404,retryable:false}),Object.freeze({wireCode:"mcp_request_conflict",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"mcp_request_gone",envelope:"http_envelope",httpStatus:410,retryable:false}),Object.freeze({wireCode:"mcp_request_not_found",envelope:"http_envelope",httpStatus:404,retryable:false}),Object.freeze({wireCode:"not_found",envelope:"sse_frame",httpStatus:200,retryable:false}),Object.freeze({wireCode:"partner_visit_link_conflict",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"partner_visit_owner_only",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"partner_visit_pet_already_mapped",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"payload_too_large",envelope:"http_envelope",httpStatus:413,retryable:false}),Object.freeze({wireCode:"petRefInUse",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"pet_health_list_removals_unconfirmed",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"pet_health_species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"pet_not_registered",envelope:"http_envelope",httpStatus:404,retryable:false}),Object.freeze({wireCode:"provider_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"rateLimited",envelope:"http_envelope",httpStatus:429,retryable:true}),Object.freeze({wireCode:"record_species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"record_subject_not_found",envelope:"http_envelope",httpStatus:404,retryable:false}),Object.freeze({wireCode:"record_upload_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"records_consent_required",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"sandbox_only",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"session_required",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"share_limit_reached",envelope:"http_envelope",httpStatus:429,retryable:false}),Object.freeze({wireCode:"slow_down",envelope:"oauth_error",httpStatus:429,retryable:true}),Object.freeze({wireCode:"species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"tenant_filter_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"tenant_has_no_capabilities",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"tenant_resource_not_found",envelope:"http_envelope",httpStatus:404,retryable:false}),Object.freeze({wireCode:"tenant_surface_not_enabled",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"timeout",envelope:"sse_frame",httpStatus:200,retryable:true}),Object.freeze({wireCode:"token_invalid",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"unavailable",envelope:"sse_frame",httpStatus:200,retryable:true}),Object.freeze({wireCode:"unavailable",envelope:"http_envelope",httpStatus:503,retryable:true}),Object.freeze({wireCode:"unsupported_grant_type",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"unsupported_response_type",envelope:"oauth_error",httpStatus:302,retryable:false}),Object.freeze({wireCode:"verify_mint_rate_limited",envelope:"http_envelope",httpStatus:429,retryable:true}),Object.freeze({wireCode:"verify_mint_refused",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"verify_mint_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true}),Object.freeze({wireCode:"verify_user_ref_invalid",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"webhook_endpoint_update_empty",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"webhook_endpoint_update_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"webhook_url_rejected",envelope:"http_envelope",httpStatus:400,retryable:false})]);Object.freeze(D.map(e=>e.wireCode));var Fe=Object.freeze({ValidationException:"validationFailed",AuthorizationException:"authRejected",PaymentRequiredException:"paymentRequired",AccessDeniedException:"accessDenied",ResourceNotFoundException:"resourceNotFound",ConflictException:"conflict",ThrottlingException:"rateLimited",InternalFailureException:"internalError",NotImplementedException:"notImplemented",ServiceUnavailableException:"serviceUnavailable",MethodNotAllowedException:"validationFailed",authExpired:"authExpired",unavailable:"serviceUnavailable",session_required:"sessionRequired",accessDenied:"accessDenied",invalidRequest:"sdkUpdateRequired",authRejected:"authRejected",rateLimited:"rateLimited",insufficientCapability:"accessDenied",event_cursor_invalid:"validationFailed",event_filter_invalid:"validationFailed",event_payload_invalid:"validationFailed",event_type_unknown:"validationFailed",idempotency_key_invalid:"validationFailed",idempotency_key_required:"validationFailed",idempotency_key_reused:"idempotencyConflict",payload_too_large:"validationFailed",webhook_url_rejected:"validationFailed",webhook_endpoint_update_empty:"validationFailed",webhook_endpoint_update_invalid:"validationFailed",event_type_not_available:"conflict",record_subject_not_found:"resourceNotFound",records_consent_required:"conflict",record_species_unsupported:"validationFailed",record_upload_invalid:"validationFailed",FILE_TOO_LARGE:"validationFailed",INVALID_CONTENT_TYPE:"validationFailed",attachment_unreadable:"validationFailed",provider_unsupported:"validationFailed",token_invalid:"validationFailed",device_cipher_unavailable:"serviceUnavailable",email_invalid:"validationFailed",consent_required:"validationFailed",consent_invalid:"validationFailed",consent_scope_wrong_route:"validationFailed",IDEMPOTENCY_KEY_IN_FLIGHT:"idempotencyInFlight",IDEMPOTENCY_KEY_REUSED_DIFFERENT_REQUEST:"idempotencyConflict",DAILY_QUOTA_EXCEEDED:"quotaExceeded",TIER_UPGRADE_REQUIRED:"paymentRequired",not_found:"conversationNotFound",timeout:"streamTimeout",internal_error:"internalError",invalid_request:"validationFailed",invalid_client:"authRejected",invalid_grant:"authRejected",unsupported_grant_type:"validationFailed",invalid_scope:"validationFailed",invalid_target:"validationFailed",invalid_redirect_uri:"validationFailed",invalid_client_metadata:"validationFailed",unsupported_response_type:"validationFailed",access_denied:"accessDenied",slow_down:"rateLimited",mcp_request_not_found:"resourceNotFound",mcp_request_gone:"resourceNotFound",mcp_connection_not_found:"resourceNotFound",mcp_request_conflict:"conflict",sandbox_only:"accessDenied",tenant_has_no_capabilities:"conflict",verify_mint_refused:"accessDenied",verify_mint_rate_limited:"rateLimited",verify_mint_unavailable:"serviceUnavailable",verify_user_ref_invalid:"validationFailed",insufficient_scope:"accessDenied",tenant_filter_invalid:"validationFailed",tenant_resource_not_found:"resourceNotFound",tenant_surface_not_enabled:"conflict",pet_health_species_unsupported:"validationFailed",pet_health_list_removals_unconfirmed:"validationFailed",petRefInUse:"conflict",share_limit_reached:"conflict",pet_not_registered:"resourceNotFound",species_unsupported:"validationFailed",partner_visit_owner_only:"accessDenied",partner_visit_link_conflict:"conflict",partner_visit_pet_already_mapped:"conflict"}),G=Object.freeze(D.map(e=>Object.freeze({wireCode:e.wireCode,envelope:e.envelope,retryable:e.retryable,normalized:Fe[e.wireCode]}))),Ie=new Map(G.map(e=>[e.envelope+e.wireCode.toUpperCase(),e])),Ae=Object.freeze(["http_envelope",...[...new Set(G.map(e=>e.envelope))].filter(e=>e!=="http_envelope").sort()]);function O(e,t){if(typeof e!="string")return;let r=e.trim().toUpperCase();if(r.length!==0)for(let o of [t??"http_envelope",...Ae]){let a=Ie.get(o+r);if(a)return a}}n(O,"contractErrorFor");function Pe(e){return e.envelope==="sse_frame"?`/errors#sse-${e.wireCode}`:e.envelope==="oauth_error"?`/errors#oauth-${e.wireCode}`:`/errors#${e.wireCode}`}n(Pe,"contractDocUrl");function Q(e){return null}n(Q,"publishedDocUrl");var je=Object.freeze({authExpired:"authentication",authRejected:"authentication",sessionRequired:"authentication",accessDenied:"authorization",paymentRequired:"entitlement",quotaExceeded:"rateLimit",rateLimited:"rateLimit",validationFailed:"invalidRequest",sdkUpdateRequired:"invalidRequest",conversationNotFound:"notFound",petNotFound:"notFound",resourceNotFound:"notFound",conflict:"conflict",idempotencyConflict:"conflict",idempotencyInFlight:"conflict",streamTimeout:"connection",streamIncomplete:"connection",upstreamLlmTimeout:"connection",serviceUnavailable:"connection",internalError:"server",notImplemented:"server",mediaUploadFailed:"media",moderationBlocked:"policy",unknown:"unknown"});function X(e){return je[e]}n(X,"categoryFor");function J(e){let t=O(e);if(t)return t.normalized;let r=(e??"").trim().toUpperCase(),o=r.replace(/[^A-Z0-9]/g,"");if(o==="AUTHREJECTED")return "authRejected";if(r.startsWith("AUTH"))return "authExpired";switch(o){case "DAILYQUOTAEXCEEDED":case "QUOTAEXCEEDED":return "quotaExceeded";case "RATELIMITED":case "TOOMANYREQUESTS":return "rateLimited";case "IDEMPOTENCYKEYCONFLICT":case "IDEMPOTENCYCONFLICT":return "idempotencyConflict";case "ACCESSDENIED":case "FORBIDDEN":return "accessDenied";case "NOTFOUND":case "CONVERSATIONNOTFOUND":return "conversationNotFound";case "PETNOTFOUND":return "petNotFound";case "TIMEOUT":case "STREAMTIMEOUT":return "streamTimeout";case "MEDIAUPLOADFAILED":case "UNRECOGNIZEDVIDEOFORMAT":case "FILETOOSMALL":return "mediaUploadFailed";case "MODERATIONBLOCKED":return "moderationBlocked";case "UPSTREAMLLMTIMEOUT":return "upstreamLlmTimeout";case "INTERNALERROR":case "INTERNALSERVERERROR":return "internalError";case "STREAMINCOMPLETE":case "CHATSTREAMINCOMPLETE":return "streamIncomplete";case "INVALIDANALYSISTYPE":case "INVALIDUPLOADPURPOSE":return "unknown";default:return "unknown"}}n(J,"fromWire");var ze=new Set(["streamTimeout","rateLimited","internalError","upstreamLlmTimeout","streamIncomplete"]);function U(e){return ze.has(e)}n(U,"isAutoRetryable");var qe=new Set(["serviceUnavailable","conflict","idempotencyInFlight"]);function Z(e){return U(e)||qe.has(e)}n(Z,"isRetryableCode");var De=500,V=8e3,ee=4;function te(e,t=Math.random){let r=Math.max(0,e),o=Math.min(De*2**r,V);return Math.floor(t()*o)}n(te,"backoffDelayMs");var Ue=Object.freeze({authExpired:"Please sign in again to continue.",authRejected:"Please sign in again to continue.",sessionRequired:"This app needs to be updated to keep using Everfur.",accessDenied:"This feature isn't available on your account right now.",paymentRequired:"This is part of a paid plan.",quotaExceeded:"You have used today's messages. This resets tomorrow.",rateLimited:"You are sending messages quickly. Try again in a few seconds.",validationFailed:"Something in that request was not right. Check the details and try again.",sdkUpdateRequired:"This app needs to be updated to keep using Everfur.",conflict:"That is already running. Wait for it to finish, then try again.",idempotencyConflict:"That message was already delivered.",idempotencyInFlight:"That is still processing. Give it a moment.",conversationNotFound:"This conversation is no longer available.",petNotFound:"We could not find that pet. Please pick a pet and try again.",resourceNotFound:"We could not find that.",streamTimeout:"The response timed out. Tap retry to try again.",mediaUploadFailed:"We could not upload that photo. Please attach it again.",moderationBlocked:"This request cannot be answered here.",upstreamLlmTimeout:"The response timed out. Tap retry to try again.",internalError:"We hit a snag on our end. Please try again.",notImplemented:"That is not available yet.",serviceUnavailable:"That service is briefly unavailable. Try again shortly.",streamIncomplete:"The connection dropped mid-answer. Tap retry to continue.",unknown:"Something went wrong. Please try again."});function Ve(e){return Ue[e]}n(Ve,"userFacingError");function re(e,t,r){Object.defineProperty(e,t,{value:r,enumerable:false,writable:false,configurable:false});}n(re,"defineHidden");var Me=/^[a-z][a-z0-9_]{0,63}$/;function y(e,t){let r=O(t?.wireCode,t?.wireEnvelope),o={code:e,category:X(e),retryable:t?.retryable??Z(e),displayMessage:Ve(e)};if(t?.httpStatus!==void 0&&(o.httpStatus=t.httpStatus),t?.requestId&&(o.requestId=t.requestId),typeof t?.reasonCode=="string"&&Me.test(t.reasonCode)&&(o.reasonCode=t.reasonCode),r);return t?.wireMessage&&re(o,"wireMessage",t.wireMessage),t?.raw!==void 0&&t.raw!==null&&re(o,"raw",t.raw),Object.freeze(o)}n(y,"makeEverfurError");function ne(e){return Object.freeze({kind:"error",terminal:true,code:e.code,retryable:e.retryable,wireMessage:e.wireMessage,synthesized:e.synthesized,lastEventId:e.lastEventId,serverRequestId:e.serverRequestId??null})}n(ne,"errorFrame");function Be(e){let t={};return e.mode==="personalized"?t.authorization=`Bearer ${e.token}`:t["x-everfur-partner-key"]=e.publishableKey,e.userRef&&(t["x-everfur-user-ref"]=e.userRef),e.sessionId&&(t["x-everfur-session-id"]=e.sessionId),t}n(Be,"authHeaders");function S(e,t){return {...e,headers:{...Ye(e.headers),...Be(t)}}}n(S,"withAuthHeaders");function Ye(e){if(!e)return {};let t={};for(let[r,o]of Object.entries(e)){let a=r.toLowerCase();a==="authorization"||a==="x-everfur-partner-key"||(t[r]=o);}return t}n(Ye,"stripAuthHeaders");async function oe(e,t){if(t.mode==="anonymous")return t.transport.request(S(e,{mode:"anonymous",publishableKey:t.publishableKey,userRef:t.userRef,...t.sessionId?{sessionId:t.sessionId}:{}}));let r;try{r=await t.identity.currentToken();}catch{return l(M())}let o=await t.transport.request(S(e,{mode:"personalized",token:r,userRef:t.userRef,...t.sessionId?{sessionId:t.sessionId}:{}}));if(o.ok||o.error.httpStatus!==401)return o;let a;try{a=await t.identity.currentToken({forceRefresh:!0});}catch{return l(M())}let s=await t.transport.request(S(e,{mode:"personalized",token:a,userRef:t.userRef,...t.sessionId?{sessionId:t.sessionId}:{}}));return !s.ok&&s.error.httpStatus===401?l(M(s.error.httpStatus)):s}n(oe,"authedSend");function M(e){return y("authRejected",{retryable:false,...e!==void 0?{httpStatus:e}:{}})}n(M,"authRejectedError");function ie(e){return y("internalError",{retryable:true,wireMessage:He(e)})}n(ie,"networkError");function He(e){return e instanceof Error?e.message:typeof e=="string"?e:"network request failed"}n(He,"describeCause");var We=3e4,Ke=V*2,$e="idempotency-key",Ge=new Set(["POST","PUT","PATCH","DELETE"]),Qe=Object.freeze({onEvent(){}}),Xe=Object.freeze({setTimeout:n((e,t)=>setTimeout(e,t),"setTimeout"),clearTimeout:n(e=>clearTimeout(e),"clearTimeout"),now:n(()=>Date.now(),"now")});function Je(e){let t=e.trim().replace(/[^A-Za-z0-9_.:-]/g,"-");return t.length===0?null:`efs_${t}`.slice(0,128)}n(Je,"seededIdempotencyKey");function k(e){let t=e.observer??Qe,r=e.timers??Xe,o=e.rng??Math.random,a=e.sleep??((m,d)=>ct(m,r,d)),s=e.maxAttempts??ee,u=e.unaryTimeoutMs??We,p=e.newIdempotencyKey??et(),c=n(m=>{try{t.onEvent(m);}catch{}},"emit");async function f(m,d,b){let A=b?.maxAttempts,ge=Math.max(1,A??s),Re=b?.idempotent??Ge.has(d.method),Se=b?.idempotencyKey===void 0?null:Je(b.idempotencyKey),P=Re?Se??p():null,we=Ze(d,P),j=0;for(;;){let E=n(q=>Object.freeze({call:m,method:d.method,path:d.path,attempt:j,...P?{idempotencyKey:P}:{},...q}),"stamp");c(E({phase:"attempt"}));let B=ut(u,r),Y=dt(B.signal,d.signal),g;try{g=await oe({...we,signal:Y.signal},e.auth);}catch(q){g=l(ie(q));}finally{Y.dispose(),B.cancel();}if(g.ok)return c(E({phase:"settled",ok:true,reason:"ok"})),g;let v=g.error,C=rt(v,j,{maxAttempts:ge,rng:o,now:r.now(),aborted:d.signal?.aborted===true,...A!==void 0?{perCallMaxAttempts:A}:{},...e.errorPolicy!==void 0?{policy:e.errorPolicy}:{}}),z={ok:false,code:v.code,reason:C.reason,...v.httpStatus!==void 0?{httpStatus:v.httpStatus}:{},...v.requestId!==void 0?{requestId:v.requestId}:{}};if(!C.retry)return c(E({phase:"settled",...z})),l(v);if(c(E({phase:"retry",...z,delayMs:C.delayMs})),await a(C.delayMs,d.signal),d.signal?.aborted===true)return c(E({phase:"settled",...z,reason:"aborted"})),l(v);j+=1;}}n(f,"send");async function w(m){return S(m,await lt(e.auth))}n(w,"authorize");async function*Ee(m,d,b){c(Object.freeze({call:m,phase:"stream.open",method:d.method,path:d.path,attempt:0}));try{yield*e.auth.transport.stream(d,b);}catch{yield ne({code:"internal_error",retryable:true,wireMessage:null,synthesized:true,lastEventId:null,serverRequestId:null});}}return n(Ee,"stream"),Object.freeze({send:f,authorize:w,stream:Ee})}n(k,"createRequestFunnel");function Ze(e,t){let r={};for(let[o,a]of Object.entries(e.headers??{}))o.toLowerCase()!==$e&&(r[o]=a);return t!==null&&(r["Idempotency-Key"]=t),{...e,headers:r}}n(Ze,"assembleHeaders");function et(){let e=0;return ()=>`efk_${Date.now().toString(36)}_${(e++).toString(36)}_${Math.random().toString(36).slice(2,12)}`}n(et,"defaultIdempotencyKeyFactory");var tt=10;function rt(e,t,r){if(r.aborted)return {retry:false,reason:"aborted"};let o=nt(e);if(o==="quota")return {retry:false,reason:"daily-quota-exhausted"};if(o!=="burst"&&!U(e.code))return {retry:false,reason:"terminal-code"};let a=o==="burst"?"burst-throttle":"retryable-code";if(n(()=>{if(r.policy===void 0)return false;try{return !r.policy.shouldRetry(e.code,t)}catch{return false}},"policyVetoedRetry")())return {retry:false,reason:"terminal-code"};let u=n(()=>{if(r.policy===void 0)return null;let f;try{f=r.policy.maxAttempts(e.code);}catch{return null}return typeof f!="number"||!Number.isFinite(f)?null:Math.max(1,Math.min(tt,Math.floor(f)))},"policyCeiling"),p=r.perCallMaxAttempts??u()??r.maxAttempts;if(t+1>=p)return {retry:false,reason:"attempts-exhausted"};let c=ot(e,r.now);return c!==null?c>Ke?{retry:false,reason:"server-reset-beyond-budget"}:{retry:true,reason:a,delayMs:c}:{retry:true,reason:a,delayMs:te(t,r.rng)}}n(rt,"decideRetry");function nt(e){let t=e.code==="unknown"?J(st(e.raw)):e.code;return t==="quotaExceeded"?"quota":t==="rateLimited"||e.httpStatus===429?"burst":null}n(nt,"throttleKind");function ot(e,t){let r=it(e.raw);if(r===null)return null;let o=r-t;return o>0?o:0}n(ot,"retryOverrideMs");function it(e){for(let t of se(e)){let r=t.resets_at,o=at(r);if(o!==null)return o}return null}n(it,"findResetsAt");function se(e){if(!ae(e))return [];let t=[e];for(let r of ["error","detail"]){let o=e[r];ae(o)&&t.push(o);}return t}n(se,"candidateScopes");function at(e){if(typeof e=="number"&&Number.isFinite(e))return e<1e11?Math.round(e*1e3):Math.round(e);if(typeof e=="string"&&e.trim().length>0){let t=Date.parse(e);return Number.isFinite(t)?t:null}return null}n(at,"parseInstantMs");function st(e){for(let t of se(e)){let r=t.code;if(typeof r=="string"&&r.length>0)return r}return null}n(st,"rawWireCode");function ae(e){return typeof e=="object"&&e!==null}n(ae,"isRecord");async function lt(e){return e.mode==="anonymous"?{mode:"anonymous",publishableKey:e.publishableKey,userRef:e.userRef,...e.sessionId?{sessionId:e.sessionId}:{}}:{mode:"personalized",token:await e.identity.currentToken(),userRef:e.userRef,...e.sessionId?{sessionId:e.sessionId}:{}}}n(lt,"resolveDeviceAuth");function ut(e,t){let r=new AbortController,o=t.setTimeout(()=>r.abort(),e);return {signal:r.signal,cancel:n(()=>t.clearTimeout(o),"cancel")}}n(ut,"boundedSignal");function dt(e,t){let r=n(()=>{},"noop");if(!t)return {signal:e,dispose:r};let o=new AbortController;if(e.aborted||t.aborted)return o.abort(),{signal:o.signal,dispose:r};let a=n(()=>o.abort(),"onAbort");return e.addEventListener("abort",a,{once:true}),t.addEventListener("abort",a,{once:true}),{signal:o.signal,dispose:n(()=>{e.removeEventListener("abort",a),t.removeEventListener("abort",a);},"dispose")}}n(dt,"mergeSignals");function ct(e,t,r){return e<=0||r?.aborted===true?Promise.resolve():new Promise(o=>{let a=t.setTimeout(()=>{r?.removeEventListener("abort",s),o();},e),s=n(()=>{t.clearTimeout(a),o();},"onAbort");r?.addEventListener("abort",s,{once:true});})}n(ct,"delayAbortable");function F(e){for(let t=0;t<e.length;t+=1){let r=e.charCodeAt(t);if(r>=55296&&r<=56319){let o=e.charCodeAt(t+1);if(!(o>=56320&&o<=57343))return true;t+=1;}else if(r>=56320&&r<=57343)return true}return false}n(F,"hasLoneSurrogate");function le(e){return [...e].length}n(le,"serverLength");var ce=new Set(["requested","awaiting_clinic","awaiting_upload","received","parsing","in_review","published","failed","revoked"]),ue=Object.freeze({submitted:"requested",sent:"requested",dispatching:"requested",awaiting_response:"awaiting_clinic",clinic_responded_no_records:"awaiting_clinic",records_received:"received",parsing_failed:"in_review",review_email_failed:"in_review",clinic_declined:"failed"});function pt(e){let t=Object.prototype.hasOwnProperty.call(ue,e)?ue[e]:void 0;if(t!==void 0)return t;let r=e;return ce.has(r)?r:"parsing"}n(pt,"normalizeStatus");var ft=zod.z.object({request_id:zod.z.string().min(1),pet_ref:zod.z.string().min(1),status:zod.z.string(),simple_status:zod.z.string().nullish(),simple_status_detail:zod.z.string().nullish(),status_label:zod.z.string().optional(),dispatch_status:zod.z.string().nullish(),can_retry_send:zod.z.boolean().optional(),can_revoke:zod.z.boolean().optional(),can_convert_to_upload:zod.z.boolean().optional(),can_update_clinic_email:zod.z.boolean().optional(),reminder_count:zod.z.number().int().nonnegative().optional(),last_reminder_at:zod.z.string().nullish(),waiting_expectation:zod.z.string().nullish(),document_count:zod.z.number().optional(),held_item_count:zod.z.number().optional(),received_at:zod.z.string().nullish(),parsing_started_at:zod.z.string().nullish(),review_started_at:zod.z.string().nullish(),created_at:zod.z.string().optional(),updated_at:zod.z.string().optional(),source:zod.z.string().nullish().catch(null),action_needed_label:zod.z.string().nullish().catch(null),failure_reason:zod.z.string().nullish().catch(null),failure_code:zod.z.string().nullish().catch(null),recovery_stage:zod.z.string().nullish().catch(null),show_clinic_phone:zod.z.boolean().optional().catch(void 0),clinic_name:zod.z.string().nullish().catch(null),clinic_email:zod.z.string().nullish().catch(null),clinic_phone:zod.z.string().nullish().catch(null),converted_to_upload_at:zod.z.string().nullish().catch(null),request_group_id:zod.z.string().nullish().catch(null)}).passthrough();function pe(e){let t=ft.safeParse(e);if(!t.success)return null;let r=t.data,o=yt(r.simple_status),a=o==="requested"&&(r.status==="awaiting_upload"||r.simple_status_detail==="awaiting_owner_upload")?"awaiting_upload":o==="parsing"&&(r.simple_status_detail==="in_review"||r.simple_status_detail==="review_email_failed")?"in_review":o??pt(r.status);return Object.freeze({id:r.request_id,petRef:r.pet_ref,status:a,simpleStatus:o,simpleStatusDetail:r.simple_status_detail??null,statusLabel:r.status_label??"",dispatchStatus:r.dispatch_status??null,canRetrySend:r.can_retry_send===true,canRevoke:r.can_revoke===true,canConvertToUpload:r.can_convert_to_upload===true,canUpdateClinicEmail:r.can_update_clinic_email===true,reminderCount:r.reminder_count??0,lastReminderAt:r.last_reminder_at??null,waitingExpectation:r.waiting_expectation??null,documentCount:de(r.document_count,0),heldItemCount:de(r.held_item_count,0),receivedAt:r.received_at??null,parsingStartedAt:r.parsing_started_at??null,reviewStartedAt:r.review_started_at??null,createdAt:r.created_at??"",updatedAt:r.updated_at??"",wireStatus:r.status,source:r.source??null,actionNeededLabel:r.action_needed_label??null,failureReason:r.failure_reason??null,failureCode:r.failure_code??null,recoveryStage:r.recovery_stage??null,showClinicPhone:r.show_clinic_phone===true,clinicName:r.clinic_name??null,clinicEmail:r.clinic_email??null,clinicPhone:r.clinic_phone??null,convertedToUploadAt:r.converted_to_upload_at??null,requestGroupId:r.request_group_id??null})}n(pe,"mapRequestView");zod.z.object({request_group_id:zod.z.string().min(1),pet_ref:zod.z.string().min(1),total:zod.z.number().int().nonnegative(),responded:zod.z.number().int().nonnegative(),pending:zod.z.number().int().nonnegative(),members:zod.z.array(zod.z.unknown())});function yt(e){return !e||e==="awaiting_upload"||e==="in_review"?null:ce.has(e)?e:null}n(yt,"normalizeSimpleStatus");zod.z.object({source_doc_id:zod.z.string().min(1),request_id:zod.z.string().min(1)});var mt=zod.z.object({label:zod.z.string(),value:zod.z.string()}),vt=zod.z.object({key:zod.z.string(),category:zod.z.string().optional(),label:zod.z.string().optional(),value:zod.z.string().nullish(),unit:zod.z.string().nullish(),observed_at:zod.z.string().nullish(),status:zod.z.string().nullish(),origin:zod.z.string().nullish(),canonical_key:zod.z.string().nullish()}),_t=zod.z.object({at:zod.z.string(),value:zod.z.number().nullish(),display:zod.z.string().nullish(),origin:zod.z.string().nullish()}),bt=zod.z.object({key:zod.z.string(),label:zod.z.string().optional(),points:zod.z.array(_t).optional()}),ht=zod.z.object({title:zod.z.string(),detail:zod.z.string().nullish(),due_at:zod.z.string().nullish()}),Et=zod.z.object({doc_id:zod.z.string(),title:zod.z.string().nullish(),page_count:zod.z.number().nullish(),received_at:zod.z.string().nullish()});zod.z.object({identity:zod.z.array(mt).optional(),entities:zod.z.array(vt).optional(),entity_series:zod.z.array(bt).optional(),forward_looking:zod.z.array(ht).optional(),documents:zod.z.array(Et).optional()});zod.z.object({pet_ref:zod.z.string().optional(),granted:zod.z.boolean().optional(),version:zod.z.string().nullish(),granted_at:zod.z.string().nullish()});function de(e,t){return typeof e=="number"&&Number.isFinite(e)?e:t}n(de,"numberOr");var gt="/widget/v1/records/sandbox/requests",fe=64,Rt=new Set(["records","no_records","declined"]),St=new Set(["applied","already_applied","not_applicable"]);function I(e){return y("validationFailed",{retryable:false,wireMessage:e})}n(I,"invalid");function wt(e){return typeof e!="string"||e.length===0?I("request_id is required and must be a non-empty string"):F(e)?I("request_id contains an unpaired surrogate and cannot be encoded"):[...e].length>fe?I(`request_id is longer than ${fe} characters`):null}n(wt,"requestIdError");function Ct(e){if(typeof e!="object"||e===null)return null;let{result:t,request:r}=e;if(typeof t!="string"||!St.has(t))return null;let o=pe(r);return o===null?null:Object.freeze({result:t,request:o})}n(Ct,"mapActionResult");function ye(e){let t=e.funnel??k({auth:e.auth,...e.errorPolicy?{errorPolicy:e.errorPolicy}:{}}),r=n(async(o,a,s,u)=>{let p=wt(a);if(p!==null)return l(p);let c=`${gt}/${encodeURIComponent(a)}/${s}`,f=await t.send(o,u===void 0?{method:"POST",path:c}:{method:"POST",path:c,body:u});if(!f.ok)return l(f.error);let w=Ct(f.value);return w===null?l(y("internalError",{retryable:false})):T(w)},"run");return {simulateClinicReply(o,a){return typeof a!="string"||!Rt.has(a)?Promise.resolve(l(I("outcome must be records, no_records or declined"))):r("records.sandbox.clinicReply",o,"clinic-reply",{outcome:a})},publishSampleRecord(o){return r("records.sandbox.publishSample",o,"publish-sample")}}}n(ye,"createRecordsSandboxController");function Tt(){let{runtime:e,userRef:t,scopeEpoch:r}=h();return react.useMemo(()=>{let{services:o}=e.registry;return ye({auth:o.authFor(t),...o.errorPolicy?{errorPolicy:o.errorPolicy}:{}})},[e,t,r])}n(Tt,"useEverfurRecordsSandbox");var L="/widget/v1/televet/sandbox/visits",Ot=128,me=64,be=new Set(["booked","cancelled","completed","no_show"]),kt=new Set(["applied","already_applied","not_applicable"]),ve=new Set(["rescheduled","reminder","followup_sent","message_received","ended"]),_e=new Set(["24h","30m"]);function _(e){return y("validationFailed",{retryable:false,wireMessage:e})}n(_,"invalid");function N(e,t,r){return typeof t!="string"||t.length===0?_(`${e} is required and must be a non-empty string`):F(t)?_(`${e} contains an unpaired surrogate and cannot be encoded`):le(t)>r?_(`${e} is longer than ${r} characters`):null}n(N,"textError");function Ft(e){if(typeof e!="object"||e===null)return null;let{result:t,visit:r}=e;if(typeof t!="string"||!kt.has(t)||typeof r!="object"||r===null)return null;let{visit_ref:o,pet_ref:a,status:s,scheduled_at:u}=r;return typeof o!="string"||o.length===0||typeof a!="string"||a.length===0||typeof s!="string"||!be.has(s)||typeof u!="string"||u.length===0?null:Object.freeze({result:t,visit:Object.freeze({visitRef:o,petRef:a,status:s,scheduledAt:u})})}n(Ft,"mapActionResult");function he(e){let t=e.funnel??k({auth:e.auth,...e.errorPolicy?{errorPolicy:e.errorPolicy}:{}}),r=n(async(o,a,s)=>{let u=await t.send(o,{method:"POST",path:a,body:s},{idempotent:false,maxAttempts:1});if(!u.ok)return l(u.error);let p=Ft(u.value);return p===null?l(y("internalError",{retryable:false})):T(p)},"run");return {createVisit(o){let a=N("pet_ref",o,Ot);return a!==null?Promise.resolve(l(a)):r("televet.sandbox.createVisit",L,{pet_ref:o})},advanceVisit(o,a){let s=N("visit_ref",o,me);if(s!==null)return Promise.resolve(l(s));if(typeof a!="string"||!be.has(a))return Promise.resolve(l(_("to must be booked, cancelled, completed or no_show")));let u=`${L}/${encodeURIComponent(o)}/advance`;return r("televet.sandbox.advanceVisit",u,{to:a})},simulateVisitEvent(o,a,s){let u=N("visit_ref",o,me);if(u!==null)return Promise.resolve(l(u));if(typeof a!="string"||!ve.has(a))return Promise.resolve(l(_(`event must be one of ${[...ve].join(", ")}`)));if(a==="reminder"){if(typeof s!="string"||!_e.has(s))return Promise.resolve(l(_(`stage must be one of ${[..._e].join(", ")} for a reminder`)))}else if(s!==void 0)return Promise.resolve(l(_("stage is only for a reminder")));let p=`${L}/${encodeURIComponent(o)}/simulate`;return r("televet.sandbox.simulateVisitEvent",p,s===void 0?{event:a}:{event:a,stage:s})}}}n(he,"createVetVisitSandboxController");function At(){let{runtime:e,userRef:t,scopeEpoch:r}=h();return react.useMemo(()=>{let{services:o}=e.registry;return he({auth:o.authFor(t),...o.errorPolicy?{errorPolicy:o.errorPolicy}:{}})},[e,t,r])}n(At,"useEverfurVetVisitSandbox");exports.useEverfurRecordsSandbox=Tt;exports.useEverfurTestEntitlements=ke;exports.useEverfurVetVisitSandbox=At;
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { E as EntitlementSnapshot } from '../../runtimeTypes-gZEJu-da.cjs';
|
|
2
|
+
import { c as EverfurResult } from '../../EverfurResult-DN9pL2Ab.cjs';
|
|
3
|
+
export { E as EverfurError, a as EverfurErrorCategory, b as EverfurErrorCode } from '../../EverfurResult-DN9pL2Ab.cjs';
|
|
4
|
+
import { R as RecordsRequestId, P as PetRef } from '../../ids-B2GAAifq.cjs';
|
|
5
|
+
export { B as Brand, _ as __brand } from '../../ids-B2GAAifq.cjs';
|
|
6
|
+
import { d as RecordsRequestView } from '../../models-D2EUxPZY.cjs';
|
|
7
|
+
export { c as RecordsRequestStatus, e as RecordsSimpleStatus } from '../../models-D2EUxPZY.cjs';
|
|
8
|
+
export { C as ClientBranding, R as RadiusScale, S as SurfaceStyle } from '../../branding-CsRdeNwK.cjs';
|
|
9
|
+
export { b as CapabilityDisabled, D as DisabledLevel, E as EntitlementDecision } from '../../resolve-D4Ywz5OS.cjs';
|
|
10
|
+
import '../../petsRepository-B_gKbAzJ.cjs';
|
|
11
|
+
import '../../identity-C2-08BZW.cjs';
|
|
12
|
+
import '../../config--Wu1Umhd.cjs';
|
|
13
|
+
import '../../profile-CSs1wlXT.cjs';
|
|
14
|
+
import '../../cacheEpoch-DknKn3S0.cjs';
|
|
15
|
+
import '../../ErrorPolicyPort-CNf4uQZP.cjs';
|
|
16
|
+
import '../../ports-BY2ph0_y.cjs';
|
|
17
|
+
import '../../casesRepository-DwtZVsbj.cjs';
|
|
18
|
+
import '../../requestFunnel-BjDpqqvm.cjs';
|
|
19
|
+
import '../../TelemetryPort-BDNr00hu.cjs';
|
|
20
|
+
import '../../ports-BN6RHF9W.cjs';
|
|
21
|
+
import '../../CameraPort-Cv31Pz7g.cjs';
|
|
22
|
+
|
|
23
|
+
/** The testing seam handle: apply a resolved verdict to THIS provider's runtime. */
|
|
24
|
+
interface EverfurTestEntitlements {
|
|
25
|
+
/**
|
|
26
|
+
* Replace the entitlement verdict the current <EverfurProvider>'s runtime renders. Drives the SDK's own
|
|
27
|
+
* `useCapability` / `CapabilityGate` across every subpath (they read this one store), so a test/demo can
|
|
28
|
+
* flip a capability on or off and watch the real gates react. Render-only: the server stays authoritative.
|
|
29
|
+
*/
|
|
30
|
+
apply(snapshot: EntitlementSnapshot): void;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* TEST / DEMO ONLY. Obtain a handle to push a simulated server entitlement verdict into the enclosing
|
|
34
|
+
* <EverfurProvider>'s runtime. Must be called inside an <EverfurProvider>.
|
|
35
|
+
*
|
|
36
|
+
* @throws {EverfurConfigError} kind 'not-initialized' when called outside an <EverfurProvider>.
|
|
37
|
+
*/
|
|
38
|
+
declare function useEverfurTestEntitlements(): EverfurTestEntitlements;
|
|
39
|
+
|
|
40
|
+
/** The clinic reply to simulate: records arrive, the clinic has none, or the clinic declines. */
|
|
41
|
+
type RecordsSandboxClinicReply = 'records' | 'no_records' | 'declined';
|
|
42
|
+
/**
|
|
43
|
+
* What the server did: `applied` moved the request, `already_applied` found it already there (nothing written
|
|
44
|
+
* twice), `not_applicable` means the real transition rules refuse it from the request's current state.
|
|
45
|
+
*/
|
|
46
|
+
type RecordsSandboxResult = 'applied' | 'already_applied' | 'not_applicable';
|
|
47
|
+
/** The settled outcome of one test-mode action. */
|
|
48
|
+
interface RecordsSandboxActionResult {
|
|
49
|
+
/** What the server did with the action. */
|
|
50
|
+
readonly result: RecordsSandboxResult;
|
|
51
|
+
/** The request as it stands after the action. */
|
|
52
|
+
readonly request: RecordsRequestView;
|
|
53
|
+
}
|
|
54
|
+
/** Records test mode. Answers only for a sandbox tenant's signed user and that user's own request. */
|
|
55
|
+
interface RecordsSandboxController {
|
|
56
|
+
/** Simulate the clinic's reply to a clinic request. */
|
|
57
|
+
simulateClinicReply(requestId: RecordsRequestId, outcome: RecordsSandboxClinicReply): Promise<EverfurResult<RecordsSandboxActionResult>>;
|
|
58
|
+
/** Attach a synthetic sample document to the request and publish a sample record for its pet. */
|
|
59
|
+
publishSampleRecord(requestId: RecordsRequestId): Promise<EverfurResult<RecordsSandboxActionResult>>;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Drive a records request through test mode: `simulateClinicReply(requestId, outcome)` and
|
|
64
|
+
* `publishSampleRecord(requestId)`. Sandbox tenants only; anywhere else every call settles to the not-found error.
|
|
65
|
+
* Re-scoped with the provider's user, so a call is always made as the current user.
|
|
66
|
+
*/
|
|
67
|
+
declare function useEverfurRecordsSandbox(): RecordsSandboxController;
|
|
68
|
+
|
|
69
|
+
/** A partner-visible visit status: exactly what the `visit.*` webhook events carry. */
|
|
70
|
+
type VetVisitSandboxStatus = 'booked' | 'cancelled' | 'completed' | 'no_show';
|
|
71
|
+
/**
|
|
72
|
+
* What the server did: `applied` created or moved the visit, `already_applied` found it already there (nothing
|
|
73
|
+
* written, no event sent twice), `not_applicable` means the visit rules refuse the move from its current status.
|
|
74
|
+
*/
|
|
75
|
+
type VetVisitSandboxResult = 'applied' | 'already_applied' | 'not_applicable';
|
|
76
|
+
/** A simulated visit as the server reports it. */
|
|
77
|
+
interface VetVisitSandboxVisit {
|
|
78
|
+
/** The visit reference, the same value the `visit.*` webhook events carry as `visit_ref`. */
|
|
79
|
+
readonly visitRef: string;
|
|
80
|
+
/** Your pet reference the visit was created for. */
|
|
81
|
+
readonly petRef: PetRef;
|
|
82
|
+
/** The partner-visible status the visit is now in. */
|
|
83
|
+
readonly status: VetVisitSandboxStatus;
|
|
84
|
+
/** ISO-8601 timestamp the simulated visit is scheduled for. */
|
|
85
|
+
readonly scheduledAt: string;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* The visit NOTIFICATION events test mode can raise, exactly the `visit.*` types that are not a status change
|
|
89
|
+
* (`partner_televet_sandbox_types.SandboxVisitEvent`). Each sends the same webhook, push and email a real
|
|
90
|
+
* visit sends, with `livemode: false`, so the routing a tap does can be exercised end to end:
|
|
91
|
+
*
|
|
92
|
+
* - `rescheduled`: the owner moved the visit one slot (`visit.rescheduled`);
|
|
93
|
+
* - `reminder`: a lead-time reminder (`visit.reminder`), the one event that takes a `stage`;
|
|
94
|
+
* - `followup_sent`: the after-visit follow-up (`visit.followup_sent`);
|
|
95
|
+
* - `message_received`: the vet wrote in the thread (`visit.message_received`);
|
|
96
|
+
* - `ended`: the call ended before the note was signed (`visit.ended`).
|
|
97
|
+
*
|
|
98
|
+
* The simulated visit must be in a status the real producer acts from, or the server answers
|
|
99
|
+
* `not_applicable` and writes nothing: `followup_sent` needs a completed visit, the rest a scheduled one,
|
|
100
|
+
* and `message_received` works from either.
|
|
101
|
+
*/
|
|
102
|
+
type VetVisitSandboxEvent = 'rescheduled' | 'reminder' | 'followup_sent' | 'message_received' | 'ended';
|
|
103
|
+
/** A reminder's lead time (`partner_visit_events.VISIT_REMINDER_STAGES`), and only a reminder has one. */
|
|
104
|
+
type VetVisitSandboxReminderStage = '24h' | '30m';
|
|
105
|
+
/** The settled outcome of one test-mode action. */
|
|
106
|
+
interface VetVisitSandboxActionResult {
|
|
107
|
+
/** What the server did with the action. */
|
|
108
|
+
readonly result: VetVisitSandboxResult;
|
|
109
|
+
/** The visit as it stands after the action. */
|
|
110
|
+
readonly visit: VetVisitSandboxVisit;
|
|
111
|
+
}
|
|
112
|
+
/** Vet visit test mode. Answers only for a sandbox tenant's signed user and that user's own pets and visits. */
|
|
113
|
+
interface VetVisitSandboxController {
|
|
114
|
+
/** Create a simulated visit, status `booked`, for one of the signed user's registered pets. */
|
|
115
|
+
createVisit(petRef: PetRef): Promise<EverfurResult<VetVisitSandboxActionResult>>;
|
|
116
|
+
/** Move a simulated visit to `to`. */
|
|
117
|
+
advanceVisit(visitRef: string, to: VetVisitSandboxStatus): Promise<EverfurResult<VetVisitSandboxActionResult>>;
|
|
118
|
+
/**
|
|
119
|
+
* Raise one visit notification event for a simulated visit, so you can test what a tap on it opens without
|
|
120
|
+
* waiting for a real appointment. `stage` is REQUIRED for `reminder` and refused for every other event.
|
|
121
|
+
*/
|
|
122
|
+
simulateVisitEvent(visitRef: string, event: VetVisitSandboxEvent, stage?: VetVisitSandboxReminderStage): Promise<EverfurResult<VetVisitSandboxActionResult>>;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Drive a simulated vet visit through test mode: `createVisit(petRef)` and `advanceVisit(visitRef, to)`.
|
|
127
|
+
* Sandbox tenants only; anywhere else every call settles to the not-found error. Re-scoped with the provider's
|
|
128
|
+
* user, so a call is always made as the current user.
|
|
129
|
+
*/
|
|
130
|
+
declare function useEverfurVetVisitSandbox(): VetVisitSandboxController;
|
|
131
|
+
|
|
132
|
+
export { EntitlementSnapshot, EverfurResult, type EverfurTestEntitlements, PetRef, RecordsRequestId, RecordsRequestView, type RecordsSandboxActionResult, type RecordsSandboxClinicReply, type RecordsSandboxController, type RecordsSandboxResult, type VetVisitSandboxActionResult, type VetVisitSandboxController, type VetVisitSandboxEvent, type VetVisitSandboxReminderStage, type VetVisitSandboxResult, type VetVisitSandboxStatus, type VetVisitSandboxVisit, useEverfurRecordsSandbox, useEverfurTestEntitlements, useEverfurVetVisitSandbox };
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { E as EntitlementSnapshot } from '../../runtimeTypes-w5KqBMcs.js';
|
|
2
|
+
import { c as EverfurResult } from '../../EverfurResult-DN9pL2Ab.js';
|
|
3
|
+
export { E as EverfurError, a as EverfurErrorCategory, b as EverfurErrorCode } from '../../EverfurResult-DN9pL2Ab.js';
|
|
4
|
+
import { R as RecordsRequestId, P as PetRef } from '../../ids-B2GAAifq.js';
|
|
5
|
+
export { B as Brand, _ as __brand } from '../../ids-B2GAAifq.js';
|
|
6
|
+
import { d as RecordsRequestView } from '../../models-B-Uh2LTf.js';
|
|
7
|
+
export { c as RecordsRequestStatus, e as RecordsSimpleStatus } from '../../models-B-Uh2LTf.js';
|
|
8
|
+
export { C as ClientBranding, R as RadiusScale, S as SurfaceStyle } from '../../branding-CsRdeNwK.js';
|
|
9
|
+
export { b as CapabilityDisabled, D as DisabledLevel, E as EntitlementDecision } from '../../resolve-D4Ywz5OS.js';
|
|
10
|
+
import '../../petsRepository-Bk6GDwLs.js';
|
|
11
|
+
import '../../identity-CEi9GRFZ.js';
|
|
12
|
+
import '../../config-C7eb_IMD.js';
|
|
13
|
+
import '../../profile-CSs1wlXT.js';
|
|
14
|
+
import '../../cacheEpoch-DknKn3S0.js';
|
|
15
|
+
import '../../ErrorPolicyPort-CwbfmxzJ.js';
|
|
16
|
+
import '../../ports-D7YW8qz9.js';
|
|
17
|
+
import '../../casesRepository-v6QczS9N.js';
|
|
18
|
+
import '../../requestFunnel-DFMGcluw.js';
|
|
19
|
+
import '../../TelemetryPort-BDNr00hu.js';
|
|
20
|
+
import '../../ports-BN6RHF9W.js';
|
|
21
|
+
import '../../CameraPort-Cv31Pz7g.js';
|
|
22
|
+
|
|
23
|
+
/** The testing seam handle: apply a resolved verdict to THIS provider's runtime. */
|
|
24
|
+
interface EverfurTestEntitlements {
|
|
25
|
+
/**
|
|
26
|
+
* Replace the entitlement verdict the current <EverfurProvider>'s runtime renders. Drives the SDK's own
|
|
27
|
+
* `useCapability` / `CapabilityGate` across every subpath (they read this one store), so a test/demo can
|
|
28
|
+
* flip a capability on or off and watch the real gates react. Render-only: the server stays authoritative.
|
|
29
|
+
*/
|
|
30
|
+
apply(snapshot: EntitlementSnapshot): void;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* TEST / DEMO ONLY. Obtain a handle to push a simulated server entitlement verdict into the enclosing
|
|
34
|
+
* <EverfurProvider>'s runtime. Must be called inside an <EverfurProvider>.
|
|
35
|
+
*
|
|
36
|
+
* @throws {EverfurConfigError} kind 'not-initialized' when called outside an <EverfurProvider>.
|
|
37
|
+
*/
|
|
38
|
+
declare function useEverfurTestEntitlements(): EverfurTestEntitlements;
|
|
39
|
+
|
|
40
|
+
/** The clinic reply to simulate: records arrive, the clinic has none, or the clinic declines. */
|
|
41
|
+
type RecordsSandboxClinicReply = 'records' | 'no_records' | 'declined';
|
|
42
|
+
/**
|
|
43
|
+
* What the server did: `applied` moved the request, `already_applied` found it already there (nothing written
|
|
44
|
+
* twice), `not_applicable` means the real transition rules refuse it from the request's current state.
|
|
45
|
+
*/
|
|
46
|
+
type RecordsSandboxResult = 'applied' | 'already_applied' | 'not_applicable';
|
|
47
|
+
/** The settled outcome of one test-mode action. */
|
|
48
|
+
interface RecordsSandboxActionResult {
|
|
49
|
+
/** What the server did with the action. */
|
|
50
|
+
readonly result: RecordsSandboxResult;
|
|
51
|
+
/** The request as it stands after the action. */
|
|
52
|
+
readonly request: RecordsRequestView;
|
|
53
|
+
}
|
|
54
|
+
/** Records test mode. Answers only for a sandbox tenant's signed user and that user's own request. */
|
|
55
|
+
interface RecordsSandboxController {
|
|
56
|
+
/** Simulate the clinic's reply to a clinic request. */
|
|
57
|
+
simulateClinicReply(requestId: RecordsRequestId, outcome: RecordsSandboxClinicReply): Promise<EverfurResult<RecordsSandboxActionResult>>;
|
|
58
|
+
/** Attach a synthetic sample document to the request and publish a sample record for its pet. */
|
|
59
|
+
publishSampleRecord(requestId: RecordsRequestId): Promise<EverfurResult<RecordsSandboxActionResult>>;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Drive a records request through test mode: `simulateClinicReply(requestId, outcome)` and
|
|
64
|
+
* `publishSampleRecord(requestId)`. Sandbox tenants only; anywhere else every call settles to the not-found error.
|
|
65
|
+
* Re-scoped with the provider's user, so a call is always made as the current user.
|
|
66
|
+
*/
|
|
67
|
+
declare function useEverfurRecordsSandbox(): RecordsSandboxController;
|
|
68
|
+
|
|
69
|
+
/** A partner-visible visit status: exactly what the `visit.*` webhook events carry. */
|
|
70
|
+
type VetVisitSandboxStatus = 'booked' | 'cancelled' | 'completed' | 'no_show';
|
|
71
|
+
/**
|
|
72
|
+
* What the server did: `applied` created or moved the visit, `already_applied` found it already there (nothing
|
|
73
|
+
* written, no event sent twice), `not_applicable` means the visit rules refuse the move from its current status.
|
|
74
|
+
*/
|
|
75
|
+
type VetVisitSandboxResult = 'applied' | 'already_applied' | 'not_applicable';
|
|
76
|
+
/** A simulated visit as the server reports it. */
|
|
77
|
+
interface VetVisitSandboxVisit {
|
|
78
|
+
/** The visit reference, the same value the `visit.*` webhook events carry as `visit_ref`. */
|
|
79
|
+
readonly visitRef: string;
|
|
80
|
+
/** Your pet reference the visit was created for. */
|
|
81
|
+
readonly petRef: PetRef;
|
|
82
|
+
/** The partner-visible status the visit is now in. */
|
|
83
|
+
readonly status: VetVisitSandboxStatus;
|
|
84
|
+
/** ISO-8601 timestamp the simulated visit is scheduled for. */
|
|
85
|
+
readonly scheduledAt: string;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* The visit NOTIFICATION events test mode can raise, exactly the `visit.*` types that are not a status change
|
|
89
|
+
* (`partner_televet_sandbox_types.SandboxVisitEvent`). Each sends the same webhook, push and email a real
|
|
90
|
+
* visit sends, with `livemode: false`, so the routing a tap does can be exercised end to end:
|
|
91
|
+
*
|
|
92
|
+
* - `rescheduled`: the owner moved the visit one slot (`visit.rescheduled`);
|
|
93
|
+
* - `reminder`: a lead-time reminder (`visit.reminder`), the one event that takes a `stage`;
|
|
94
|
+
* - `followup_sent`: the after-visit follow-up (`visit.followup_sent`);
|
|
95
|
+
* - `message_received`: the vet wrote in the thread (`visit.message_received`);
|
|
96
|
+
* - `ended`: the call ended before the note was signed (`visit.ended`).
|
|
97
|
+
*
|
|
98
|
+
* The simulated visit must be in a status the real producer acts from, or the server answers
|
|
99
|
+
* `not_applicable` and writes nothing: `followup_sent` needs a completed visit, the rest a scheduled one,
|
|
100
|
+
* and `message_received` works from either.
|
|
101
|
+
*/
|
|
102
|
+
type VetVisitSandboxEvent = 'rescheduled' | 'reminder' | 'followup_sent' | 'message_received' | 'ended';
|
|
103
|
+
/** A reminder's lead time (`partner_visit_events.VISIT_REMINDER_STAGES`), and only a reminder has one. */
|
|
104
|
+
type VetVisitSandboxReminderStage = '24h' | '30m';
|
|
105
|
+
/** The settled outcome of one test-mode action. */
|
|
106
|
+
interface VetVisitSandboxActionResult {
|
|
107
|
+
/** What the server did with the action. */
|
|
108
|
+
readonly result: VetVisitSandboxResult;
|
|
109
|
+
/** The visit as it stands after the action. */
|
|
110
|
+
readonly visit: VetVisitSandboxVisit;
|
|
111
|
+
}
|
|
112
|
+
/** Vet visit test mode. Answers only for a sandbox tenant's signed user and that user's own pets and visits. */
|
|
113
|
+
interface VetVisitSandboxController {
|
|
114
|
+
/** Create a simulated visit, status `booked`, for one of the signed user's registered pets. */
|
|
115
|
+
createVisit(petRef: PetRef): Promise<EverfurResult<VetVisitSandboxActionResult>>;
|
|
116
|
+
/** Move a simulated visit to `to`. */
|
|
117
|
+
advanceVisit(visitRef: string, to: VetVisitSandboxStatus): Promise<EverfurResult<VetVisitSandboxActionResult>>;
|
|
118
|
+
/**
|
|
119
|
+
* Raise one visit notification event for a simulated visit, so you can test what a tap on it opens without
|
|
120
|
+
* waiting for a real appointment. `stage` is REQUIRED for `reminder` and refused for every other event.
|
|
121
|
+
*/
|
|
122
|
+
simulateVisitEvent(visitRef: string, event: VetVisitSandboxEvent, stage?: VetVisitSandboxReminderStage): Promise<EverfurResult<VetVisitSandboxActionResult>>;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Drive a simulated vet visit through test mode: `createVisit(petRef)` and `advanceVisit(visitRef, to)`.
|
|
127
|
+
* Sandbox tenants only; anywhere else every call settles to the not-found error. Re-scoped with the provider's
|
|
128
|
+
* user, so a call is always made as the current user.
|
|
129
|
+
*/
|
|
130
|
+
declare function useEverfurVetVisitSandbox(): VetVisitSandboxController;
|
|
131
|
+
|
|
132
|
+
export { EntitlementSnapshot, EverfurResult, type EverfurTestEntitlements, PetRef, RecordsRequestId, RecordsRequestView, type RecordsSandboxActionResult, type RecordsSandboxClinicReply, type RecordsSandboxController, type RecordsSandboxResult, type VetVisitSandboxActionResult, type VetVisitSandboxController, type VetVisitSandboxEvent, type VetVisitSandboxReminderStage, type VetVisitSandboxResult, type VetVisitSandboxStatus, type VetVisitSandboxVisit, useEverfurRecordsSandbox, useEverfurTestEntitlements, useEverfurVetVisitSandbox };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {createContext,useMemo,useContext}from'react';import {z}from'zod';var Ce=Object.defineProperty;var n=(e,t)=>Ce(e,"name",{value:t,configurable:true});function T(e,t){return Object.freeze(t===void 0?{ok:true,value:e}:{ok:true,value:e,warning:t})}n(T,"ok");function l(e){return Object.freeze({ok:false,error:e})}n(l,"err");var x=class x extends Error{constructor(t,r){super(r),this.name="EverfurConfigError",this.kind=t,Object.setPrototypeOf(this,x.prototype);}};n(x,"EverfurConfigError");var R=x;var H=Symbol.for("@everfur/sdk#EverfurContext@v1"),W=globalThis,K=W[H]??(W[H]=createContext(null));K.displayName??="EverfurContext";function h(){let e=useContext(K);if(e===null)throw new R("not-initialized","Everfur hooks must be called inside <EverfurProvider>. Wrap your tree once, high.");return e}n(h,"useEverfurContext");function ke(){let{runtime:e}=h();return useMemo(()=>({apply:n(t=>e.updateEntitlements(t),"apply")}),[e])}n(ke,"useEverfurTestEntitlements");var D=Object.freeze([Object.freeze({wireCode:"AccessDeniedException",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"AuthorizationException",envelope:"http_envelope",httpStatus:401,retryable:false}),Object.freeze({wireCode:"ConflictException",envelope:"http_envelope",httpStatus:409,retryable:true}),Object.freeze({wireCode:"DAILY_QUOTA_EXCEEDED",envelope:"http_envelope",httpStatus:429,retryable:true}),Object.freeze({wireCode:"FILE_TOO_LARGE",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"IDEMPOTENCY_KEY_IN_FLIGHT",envelope:"http_envelope",httpStatus:409,retryable:true}),Object.freeze({wireCode:"IDEMPOTENCY_KEY_REUSED_DIFFERENT_REQUEST",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"INVALID_CONTENT_TYPE",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"InternalFailureException",envelope:"http_envelope",httpStatus:500,retryable:true}),Object.freeze({wireCode:"MethodNotAllowedException",envelope:"http_envelope",httpStatus:405,retryable:false}),Object.freeze({wireCode:"NotImplementedException",envelope:"http_envelope",httpStatus:501,retryable:false}),Object.freeze({wireCode:"PaymentRequiredException",envelope:"http_envelope",httpStatus:402,retryable:false}),Object.freeze({wireCode:"ResourceNotFoundException",envelope:"http_envelope",httpStatus:404,retryable:false}),Object.freeze({wireCode:"ServiceUnavailableException",envelope:"http_envelope",httpStatus:503,retryable:true}),Object.freeze({wireCode:"TIER_UPGRADE_REQUIRED",envelope:"http_envelope",httpStatus:402,retryable:false}),Object.freeze({wireCode:"ThrottlingException",envelope:"http_envelope",httpStatus:429,retryable:true}),Object.freeze({wireCode:"ValidationException",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"accessDenied",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"access_denied",envelope:"oauth_error",httpStatus:302,retryable:false}),Object.freeze({wireCode:"attachment_unreadable",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"authExpired",envelope:"http_envelope",httpStatus:401,retryable:true}),Object.freeze({wireCode:"authRejected",envelope:"http_envelope",httpStatus:401,retryable:false}),Object.freeze({wireCode:"consent_invalid",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"consent_required",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"consent_scope_wrong_route",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"device_cipher_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true}),Object.freeze({wireCode:"email_invalid",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"event_cursor_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"event_filter_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"event_payload_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"event_type_not_available",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"event_type_unknown",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"idempotency_key_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"idempotency_key_required",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"idempotency_key_reused",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"insufficientCapability",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"insufficient_scope",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"internal_error",envelope:"sse_frame",httpStatus:200,retryable:false}),Object.freeze({wireCode:"invalidRequest",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"invalid_client",envelope:"oauth_error",httpStatus:401,retryable:false}),Object.freeze({wireCode:"invalid_client_metadata",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"invalid_grant",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"invalid_redirect_uri",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"invalid_request",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"invalid_scope",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"invalid_target",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"mcp_connection_not_found",envelope:"http_envelope",httpStatus:404,retryable:false}),Object.freeze({wireCode:"mcp_request_conflict",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"mcp_request_gone",envelope:"http_envelope",httpStatus:410,retryable:false}),Object.freeze({wireCode:"mcp_request_not_found",envelope:"http_envelope",httpStatus:404,retryable:false}),Object.freeze({wireCode:"not_found",envelope:"sse_frame",httpStatus:200,retryable:false}),Object.freeze({wireCode:"partner_visit_link_conflict",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"partner_visit_owner_only",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"partner_visit_pet_already_mapped",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"payload_too_large",envelope:"http_envelope",httpStatus:413,retryable:false}),Object.freeze({wireCode:"petRefInUse",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"pet_health_list_removals_unconfirmed",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"pet_health_species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"pet_not_registered",envelope:"http_envelope",httpStatus:404,retryable:false}),Object.freeze({wireCode:"provider_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"rateLimited",envelope:"http_envelope",httpStatus:429,retryable:true}),Object.freeze({wireCode:"record_species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"record_subject_not_found",envelope:"http_envelope",httpStatus:404,retryable:false}),Object.freeze({wireCode:"record_upload_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"records_consent_required",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"sandbox_only",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"session_required",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"share_limit_reached",envelope:"http_envelope",httpStatus:429,retryable:false}),Object.freeze({wireCode:"slow_down",envelope:"oauth_error",httpStatus:429,retryable:true}),Object.freeze({wireCode:"species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"tenant_filter_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"tenant_has_no_capabilities",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"tenant_resource_not_found",envelope:"http_envelope",httpStatus:404,retryable:false}),Object.freeze({wireCode:"tenant_surface_not_enabled",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"timeout",envelope:"sse_frame",httpStatus:200,retryable:true}),Object.freeze({wireCode:"token_invalid",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"unavailable",envelope:"sse_frame",httpStatus:200,retryable:true}),Object.freeze({wireCode:"unavailable",envelope:"http_envelope",httpStatus:503,retryable:true}),Object.freeze({wireCode:"unsupported_grant_type",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"unsupported_response_type",envelope:"oauth_error",httpStatus:302,retryable:false}),Object.freeze({wireCode:"verify_mint_rate_limited",envelope:"http_envelope",httpStatus:429,retryable:true}),Object.freeze({wireCode:"verify_mint_refused",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"verify_mint_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true}),Object.freeze({wireCode:"verify_user_ref_invalid",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"webhook_endpoint_update_empty",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"webhook_endpoint_update_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"webhook_url_rejected",envelope:"http_envelope",httpStatus:400,retryable:false})]);Object.freeze(D.map(e=>e.wireCode));var Fe=Object.freeze({ValidationException:"validationFailed",AuthorizationException:"authRejected",PaymentRequiredException:"paymentRequired",AccessDeniedException:"accessDenied",ResourceNotFoundException:"resourceNotFound",ConflictException:"conflict",ThrottlingException:"rateLimited",InternalFailureException:"internalError",NotImplementedException:"notImplemented",ServiceUnavailableException:"serviceUnavailable",MethodNotAllowedException:"validationFailed",authExpired:"authExpired",unavailable:"serviceUnavailable",session_required:"sessionRequired",accessDenied:"accessDenied",invalidRequest:"sdkUpdateRequired",authRejected:"authRejected",rateLimited:"rateLimited",insufficientCapability:"accessDenied",event_cursor_invalid:"validationFailed",event_filter_invalid:"validationFailed",event_payload_invalid:"validationFailed",event_type_unknown:"validationFailed",idempotency_key_invalid:"validationFailed",idempotency_key_required:"validationFailed",idempotency_key_reused:"idempotencyConflict",payload_too_large:"validationFailed",webhook_url_rejected:"validationFailed",webhook_endpoint_update_empty:"validationFailed",webhook_endpoint_update_invalid:"validationFailed",event_type_not_available:"conflict",record_subject_not_found:"resourceNotFound",records_consent_required:"conflict",record_species_unsupported:"validationFailed",record_upload_invalid:"validationFailed",FILE_TOO_LARGE:"validationFailed",INVALID_CONTENT_TYPE:"validationFailed",attachment_unreadable:"validationFailed",provider_unsupported:"validationFailed",token_invalid:"validationFailed",device_cipher_unavailable:"serviceUnavailable",email_invalid:"validationFailed",consent_required:"validationFailed",consent_invalid:"validationFailed",consent_scope_wrong_route:"validationFailed",IDEMPOTENCY_KEY_IN_FLIGHT:"idempotencyInFlight",IDEMPOTENCY_KEY_REUSED_DIFFERENT_REQUEST:"idempotencyConflict",DAILY_QUOTA_EXCEEDED:"quotaExceeded",TIER_UPGRADE_REQUIRED:"paymentRequired",not_found:"conversationNotFound",timeout:"streamTimeout",internal_error:"internalError",invalid_request:"validationFailed",invalid_client:"authRejected",invalid_grant:"authRejected",unsupported_grant_type:"validationFailed",invalid_scope:"validationFailed",invalid_target:"validationFailed",invalid_redirect_uri:"validationFailed",invalid_client_metadata:"validationFailed",unsupported_response_type:"validationFailed",access_denied:"accessDenied",slow_down:"rateLimited",mcp_request_not_found:"resourceNotFound",mcp_request_gone:"resourceNotFound",mcp_connection_not_found:"resourceNotFound",mcp_request_conflict:"conflict",sandbox_only:"accessDenied",tenant_has_no_capabilities:"conflict",verify_mint_refused:"accessDenied",verify_mint_rate_limited:"rateLimited",verify_mint_unavailable:"serviceUnavailable",verify_user_ref_invalid:"validationFailed",insufficient_scope:"accessDenied",tenant_filter_invalid:"validationFailed",tenant_resource_not_found:"resourceNotFound",tenant_surface_not_enabled:"conflict",pet_health_species_unsupported:"validationFailed",pet_health_list_removals_unconfirmed:"validationFailed",petRefInUse:"conflict",share_limit_reached:"conflict",pet_not_registered:"resourceNotFound",species_unsupported:"validationFailed",partner_visit_owner_only:"accessDenied",partner_visit_link_conflict:"conflict",partner_visit_pet_already_mapped:"conflict"}),G=Object.freeze(D.map(e=>Object.freeze({wireCode:e.wireCode,envelope:e.envelope,retryable:e.retryable,normalized:Fe[e.wireCode]}))),Ie=new Map(G.map(e=>[e.envelope+e.wireCode.toUpperCase(),e])),Ae=Object.freeze(["http_envelope",...[...new Set(G.map(e=>e.envelope))].filter(e=>e!=="http_envelope").sort()]);function O(e,t){if(typeof e!="string")return;let r=e.trim().toUpperCase();if(r.length!==0)for(let o of [t??"http_envelope",...Ae]){let a=Ie.get(o+r);if(a)return a}}n(O,"contractErrorFor");function Pe(e){return e.envelope==="sse_frame"?`/errors#sse-${e.wireCode}`:e.envelope==="oauth_error"?`/errors#oauth-${e.wireCode}`:`/errors#${e.wireCode}`}n(Pe,"contractDocUrl");function Q(e){return null}n(Q,"publishedDocUrl");var je=Object.freeze({authExpired:"authentication",authRejected:"authentication",sessionRequired:"authentication",accessDenied:"authorization",paymentRequired:"entitlement",quotaExceeded:"rateLimit",rateLimited:"rateLimit",validationFailed:"invalidRequest",sdkUpdateRequired:"invalidRequest",conversationNotFound:"notFound",petNotFound:"notFound",resourceNotFound:"notFound",conflict:"conflict",idempotencyConflict:"conflict",idempotencyInFlight:"conflict",streamTimeout:"connection",streamIncomplete:"connection",upstreamLlmTimeout:"connection",serviceUnavailable:"connection",internalError:"server",notImplemented:"server",mediaUploadFailed:"media",moderationBlocked:"policy",unknown:"unknown"});function X(e){return je[e]}n(X,"categoryFor");function J(e){let t=O(e);if(t)return t.normalized;let r=(e??"").trim().toUpperCase(),o=r.replace(/[^A-Z0-9]/g,"");if(o==="AUTHREJECTED")return "authRejected";if(r.startsWith("AUTH"))return "authExpired";switch(o){case "DAILYQUOTAEXCEEDED":case "QUOTAEXCEEDED":return "quotaExceeded";case "RATELIMITED":case "TOOMANYREQUESTS":return "rateLimited";case "IDEMPOTENCYKEYCONFLICT":case "IDEMPOTENCYCONFLICT":return "idempotencyConflict";case "ACCESSDENIED":case "FORBIDDEN":return "accessDenied";case "NOTFOUND":case "CONVERSATIONNOTFOUND":return "conversationNotFound";case "PETNOTFOUND":return "petNotFound";case "TIMEOUT":case "STREAMTIMEOUT":return "streamTimeout";case "MEDIAUPLOADFAILED":case "UNRECOGNIZEDVIDEOFORMAT":case "FILETOOSMALL":return "mediaUploadFailed";case "MODERATIONBLOCKED":return "moderationBlocked";case "UPSTREAMLLMTIMEOUT":return "upstreamLlmTimeout";case "INTERNALERROR":case "INTERNALSERVERERROR":return "internalError";case "STREAMINCOMPLETE":case "CHATSTREAMINCOMPLETE":return "streamIncomplete";case "INVALIDANALYSISTYPE":case "INVALIDUPLOADPURPOSE":return "unknown";default:return "unknown"}}n(J,"fromWire");var ze=new Set(["streamTimeout","rateLimited","internalError","upstreamLlmTimeout","streamIncomplete"]);function U(e){return ze.has(e)}n(U,"isAutoRetryable");var qe=new Set(["serviceUnavailable","conflict","idempotencyInFlight"]);function Z(e){return U(e)||qe.has(e)}n(Z,"isRetryableCode");var De=500,V=8e3,ee=4;function te(e,t=Math.random){let r=Math.max(0,e),o=Math.min(De*2**r,V);return Math.floor(t()*o)}n(te,"backoffDelayMs");var Ue=Object.freeze({authExpired:"Please sign in again to continue.",authRejected:"Please sign in again to continue.",sessionRequired:"This app needs to be updated to keep using Everfur.",accessDenied:"This feature isn't available on your account right now.",paymentRequired:"This is part of a paid plan.",quotaExceeded:"You have used today's messages. This resets tomorrow.",rateLimited:"You are sending messages quickly. Try again in a few seconds.",validationFailed:"Something in that request was not right. Check the details and try again.",sdkUpdateRequired:"This app needs to be updated to keep using Everfur.",conflict:"That is already running. Wait for it to finish, then try again.",idempotencyConflict:"That message was already delivered.",idempotencyInFlight:"That is still processing. Give it a moment.",conversationNotFound:"This conversation is no longer available.",petNotFound:"We could not find that pet. Please pick a pet and try again.",resourceNotFound:"We could not find that.",streamTimeout:"The response timed out. Tap retry to try again.",mediaUploadFailed:"We could not upload that photo. Please attach it again.",moderationBlocked:"This request cannot be answered here.",upstreamLlmTimeout:"The response timed out. Tap retry to try again.",internalError:"We hit a snag on our end. Please try again.",notImplemented:"That is not available yet.",serviceUnavailable:"That service is briefly unavailable. Try again shortly.",streamIncomplete:"The connection dropped mid-answer. Tap retry to continue.",unknown:"Something went wrong. Please try again."});function Ve(e){return Ue[e]}n(Ve,"userFacingError");function re(e,t,r){Object.defineProperty(e,t,{value:r,enumerable:false,writable:false,configurable:false});}n(re,"defineHidden");var Me=/^[a-z][a-z0-9_]{0,63}$/;function y(e,t){let r=O(t?.wireCode,t?.wireEnvelope),o={code:e,category:X(e),retryable:t?.retryable??Z(e),displayMessage:Ve(e)};if(t?.httpStatus!==void 0&&(o.httpStatus=t.httpStatus),t?.requestId&&(o.requestId=t.requestId),typeof t?.reasonCode=="string"&&Me.test(t.reasonCode)&&(o.reasonCode=t.reasonCode),r);return t?.wireMessage&&re(o,"wireMessage",t.wireMessage),t?.raw!==void 0&&t.raw!==null&&re(o,"raw",t.raw),Object.freeze(o)}n(y,"makeEverfurError");function ne(e){return Object.freeze({kind:"error",terminal:true,code:e.code,retryable:e.retryable,wireMessage:e.wireMessage,synthesized:e.synthesized,lastEventId:e.lastEventId,serverRequestId:e.serverRequestId??null})}n(ne,"errorFrame");function Be(e){let t={};return e.mode==="personalized"?t.authorization=`Bearer ${e.token}`:t["x-everfur-partner-key"]=e.publishableKey,e.userRef&&(t["x-everfur-user-ref"]=e.userRef),e.sessionId&&(t["x-everfur-session-id"]=e.sessionId),t}n(Be,"authHeaders");function S(e,t){return {...e,headers:{...Ye(e.headers),...Be(t)}}}n(S,"withAuthHeaders");function Ye(e){if(!e)return {};let t={};for(let[r,o]of Object.entries(e)){let a=r.toLowerCase();a==="authorization"||a==="x-everfur-partner-key"||(t[r]=o);}return t}n(Ye,"stripAuthHeaders");async function oe(e,t){if(t.mode==="anonymous")return t.transport.request(S(e,{mode:"anonymous",publishableKey:t.publishableKey,userRef:t.userRef,...t.sessionId?{sessionId:t.sessionId}:{}}));let r;try{r=await t.identity.currentToken();}catch{return l(M())}let o=await t.transport.request(S(e,{mode:"personalized",token:r,userRef:t.userRef,...t.sessionId?{sessionId:t.sessionId}:{}}));if(o.ok||o.error.httpStatus!==401)return o;let a;try{a=await t.identity.currentToken({forceRefresh:!0});}catch{return l(M())}let s=await t.transport.request(S(e,{mode:"personalized",token:a,userRef:t.userRef,...t.sessionId?{sessionId:t.sessionId}:{}}));return !s.ok&&s.error.httpStatus===401?l(M(s.error.httpStatus)):s}n(oe,"authedSend");function M(e){return y("authRejected",{retryable:false,...e!==void 0?{httpStatus:e}:{}})}n(M,"authRejectedError");function ie(e){return y("internalError",{retryable:true,wireMessage:He(e)})}n(ie,"networkError");function He(e){return e instanceof Error?e.message:typeof e=="string"?e:"network request failed"}n(He,"describeCause");var We=3e4,Ke=V*2,$e="idempotency-key",Ge=new Set(["POST","PUT","PATCH","DELETE"]),Qe=Object.freeze({onEvent(){}}),Xe=Object.freeze({setTimeout:n((e,t)=>setTimeout(e,t),"setTimeout"),clearTimeout:n(e=>clearTimeout(e),"clearTimeout"),now:n(()=>Date.now(),"now")});function Je(e){let t=e.trim().replace(/[^A-Za-z0-9_.:-]/g,"-");return t.length===0?null:`efs_${t}`.slice(0,128)}n(Je,"seededIdempotencyKey");function k(e){let t=e.observer??Qe,r=e.timers??Xe,o=e.rng??Math.random,a=e.sleep??((m,d)=>ct(m,r,d)),s=e.maxAttempts??ee,u=e.unaryTimeoutMs??We,p=e.newIdempotencyKey??et(),c=n(m=>{try{t.onEvent(m);}catch{}},"emit");async function f(m,d,b){let A=b?.maxAttempts,ge=Math.max(1,A??s),Re=b?.idempotent??Ge.has(d.method),Se=b?.idempotencyKey===void 0?null:Je(b.idempotencyKey),P=Re?Se??p():null,we=Ze(d,P),j=0;for(;;){let E=n(q=>Object.freeze({call:m,method:d.method,path:d.path,attempt:j,...P?{idempotencyKey:P}:{},...q}),"stamp");c(E({phase:"attempt"}));let B=ut(u,r),Y=dt(B.signal,d.signal),g;try{g=await oe({...we,signal:Y.signal},e.auth);}catch(q){g=l(ie(q));}finally{Y.dispose(),B.cancel();}if(g.ok)return c(E({phase:"settled",ok:true,reason:"ok"})),g;let v=g.error,C=rt(v,j,{maxAttempts:ge,rng:o,now:r.now(),aborted:d.signal?.aborted===true,...A!==void 0?{perCallMaxAttempts:A}:{},...e.errorPolicy!==void 0?{policy:e.errorPolicy}:{}}),z={ok:false,code:v.code,reason:C.reason,...v.httpStatus!==void 0?{httpStatus:v.httpStatus}:{},...v.requestId!==void 0?{requestId:v.requestId}:{}};if(!C.retry)return c(E({phase:"settled",...z})),l(v);if(c(E({phase:"retry",...z,delayMs:C.delayMs})),await a(C.delayMs,d.signal),d.signal?.aborted===true)return c(E({phase:"settled",...z,reason:"aborted"})),l(v);j+=1;}}n(f,"send");async function w(m){return S(m,await lt(e.auth))}n(w,"authorize");async function*Ee(m,d,b){c(Object.freeze({call:m,phase:"stream.open",method:d.method,path:d.path,attempt:0}));try{yield*e.auth.transport.stream(d,b);}catch{yield ne({code:"internal_error",retryable:true,wireMessage:null,synthesized:true,lastEventId:null,serverRequestId:null});}}return n(Ee,"stream"),Object.freeze({send:f,authorize:w,stream:Ee})}n(k,"createRequestFunnel");function Ze(e,t){let r={};for(let[o,a]of Object.entries(e.headers??{}))o.toLowerCase()!==$e&&(r[o]=a);return t!==null&&(r["Idempotency-Key"]=t),{...e,headers:r}}n(Ze,"assembleHeaders");function et(){let e=0;return ()=>`efk_${Date.now().toString(36)}_${(e++).toString(36)}_${Math.random().toString(36).slice(2,12)}`}n(et,"defaultIdempotencyKeyFactory");var tt=10;function rt(e,t,r){if(r.aborted)return {retry:false,reason:"aborted"};let o=nt(e);if(o==="quota")return {retry:false,reason:"daily-quota-exhausted"};if(o!=="burst"&&!U(e.code))return {retry:false,reason:"terminal-code"};let a=o==="burst"?"burst-throttle":"retryable-code";if(n(()=>{if(r.policy===void 0)return false;try{return !r.policy.shouldRetry(e.code,t)}catch{return false}},"policyVetoedRetry")())return {retry:false,reason:"terminal-code"};let u=n(()=>{if(r.policy===void 0)return null;let f;try{f=r.policy.maxAttempts(e.code);}catch{return null}return typeof f!="number"||!Number.isFinite(f)?null:Math.max(1,Math.min(tt,Math.floor(f)))},"policyCeiling"),p=r.perCallMaxAttempts??u()??r.maxAttempts;if(t+1>=p)return {retry:false,reason:"attempts-exhausted"};let c=ot(e,r.now);return c!==null?c>Ke?{retry:false,reason:"server-reset-beyond-budget"}:{retry:true,reason:a,delayMs:c}:{retry:true,reason:a,delayMs:te(t,r.rng)}}n(rt,"decideRetry");function nt(e){let t=e.code==="unknown"?J(st(e.raw)):e.code;return t==="quotaExceeded"?"quota":t==="rateLimited"||e.httpStatus===429?"burst":null}n(nt,"throttleKind");function ot(e,t){let r=it(e.raw);if(r===null)return null;let o=r-t;return o>0?o:0}n(ot,"retryOverrideMs");function it(e){for(let t of se(e)){let r=t.resets_at,o=at(r);if(o!==null)return o}return null}n(it,"findResetsAt");function se(e){if(!ae(e))return [];let t=[e];for(let r of ["error","detail"]){let o=e[r];ae(o)&&t.push(o);}return t}n(se,"candidateScopes");function at(e){if(typeof e=="number"&&Number.isFinite(e))return e<1e11?Math.round(e*1e3):Math.round(e);if(typeof e=="string"&&e.trim().length>0){let t=Date.parse(e);return Number.isFinite(t)?t:null}return null}n(at,"parseInstantMs");function st(e){for(let t of se(e)){let r=t.code;if(typeof r=="string"&&r.length>0)return r}return null}n(st,"rawWireCode");function ae(e){return typeof e=="object"&&e!==null}n(ae,"isRecord");async function lt(e){return e.mode==="anonymous"?{mode:"anonymous",publishableKey:e.publishableKey,userRef:e.userRef,...e.sessionId?{sessionId:e.sessionId}:{}}:{mode:"personalized",token:await e.identity.currentToken(),userRef:e.userRef,...e.sessionId?{sessionId:e.sessionId}:{}}}n(lt,"resolveDeviceAuth");function ut(e,t){let r=new AbortController,o=t.setTimeout(()=>r.abort(),e);return {signal:r.signal,cancel:n(()=>t.clearTimeout(o),"cancel")}}n(ut,"boundedSignal");function dt(e,t){let r=n(()=>{},"noop");if(!t)return {signal:e,dispose:r};let o=new AbortController;if(e.aborted||t.aborted)return o.abort(),{signal:o.signal,dispose:r};let a=n(()=>o.abort(),"onAbort");return e.addEventListener("abort",a,{once:true}),t.addEventListener("abort",a,{once:true}),{signal:o.signal,dispose:n(()=>{e.removeEventListener("abort",a),t.removeEventListener("abort",a);},"dispose")}}n(dt,"mergeSignals");function ct(e,t,r){return e<=0||r?.aborted===true?Promise.resolve():new Promise(o=>{let a=t.setTimeout(()=>{r?.removeEventListener("abort",s),o();},e),s=n(()=>{t.clearTimeout(a),o();},"onAbort");r?.addEventListener("abort",s,{once:true});})}n(ct,"delayAbortable");function F(e){for(let t=0;t<e.length;t+=1){let r=e.charCodeAt(t);if(r>=55296&&r<=56319){let o=e.charCodeAt(t+1);if(!(o>=56320&&o<=57343))return true;t+=1;}else if(r>=56320&&r<=57343)return true}return false}n(F,"hasLoneSurrogate");function le(e){return [...e].length}n(le,"serverLength");var ce=new Set(["requested","awaiting_clinic","awaiting_upload","received","parsing","in_review","published","failed","revoked"]),ue=Object.freeze({submitted:"requested",sent:"requested",dispatching:"requested",awaiting_response:"awaiting_clinic",clinic_responded_no_records:"awaiting_clinic",records_received:"received",parsing_failed:"in_review",review_email_failed:"in_review",clinic_declined:"failed"});function pt(e){let t=Object.prototype.hasOwnProperty.call(ue,e)?ue[e]:void 0;if(t!==void 0)return t;let r=e;return ce.has(r)?r:"parsing"}n(pt,"normalizeStatus");var ft=z.object({request_id:z.string().min(1),pet_ref:z.string().min(1),status:z.string(),simple_status:z.string().nullish(),simple_status_detail:z.string().nullish(),status_label:z.string().optional(),dispatch_status:z.string().nullish(),can_retry_send:z.boolean().optional(),can_revoke:z.boolean().optional(),can_convert_to_upload:z.boolean().optional(),can_update_clinic_email:z.boolean().optional(),reminder_count:z.number().int().nonnegative().optional(),last_reminder_at:z.string().nullish(),waiting_expectation:z.string().nullish(),document_count:z.number().optional(),held_item_count:z.number().optional(),received_at:z.string().nullish(),parsing_started_at:z.string().nullish(),review_started_at:z.string().nullish(),created_at:z.string().optional(),updated_at:z.string().optional(),source:z.string().nullish().catch(null),action_needed_label:z.string().nullish().catch(null),failure_reason:z.string().nullish().catch(null),failure_code:z.string().nullish().catch(null),recovery_stage:z.string().nullish().catch(null),show_clinic_phone:z.boolean().optional().catch(void 0),clinic_name:z.string().nullish().catch(null),clinic_email:z.string().nullish().catch(null),clinic_phone:z.string().nullish().catch(null),converted_to_upload_at:z.string().nullish().catch(null),request_group_id:z.string().nullish().catch(null)}).passthrough();function pe(e){let t=ft.safeParse(e);if(!t.success)return null;let r=t.data,o=yt(r.simple_status),a=o==="requested"&&(r.status==="awaiting_upload"||r.simple_status_detail==="awaiting_owner_upload")?"awaiting_upload":o==="parsing"&&(r.simple_status_detail==="in_review"||r.simple_status_detail==="review_email_failed")?"in_review":o??pt(r.status);return Object.freeze({id:r.request_id,petRef:r.pet_ref,status:a,simpleStatus:o,simpleStatusDetail:r.simple_status_detail??null,statusLabel:r.status_label??"",dispatchStatus:r.dispatch_status??null,canRetrySend:r.can_retry_send===true,canRevoke:r.can_revoke===true,canConvertToUpload:r.can_convert_to_upload===true,canUpdateClinicEmail:r.can_update_clinic_email===true,reminderCount:r.reminder_count??0,lastReminderAt:r.last_reminder_at??null,waitingExpectation:r.waiting_expectation??null,documentCount:de(r.document_count,0),heldItemCount:de(r.held_item_count,0),receivedAt:r.received_at??null,parsingStartedAt:r.parsing_started_at??null,reviewStartedAt:r.review_started_at??null,createdAt:r.created_at??"",updatedAt:r.updated_at??"",wireStatus:r.status,source:r.source??null,actionNeededLabel:r.action_needed_label??null,failureReason:r.failure_reason??null,failureCode:r.failure_code??null,recoveryStage:r.recovery_stage??null,showClinicPhone:r.show_clinic_phone===true,clinicName:r.clinic_name??null,clinicEmail:r.clinic_email??null,clinicPhone:r.clinic_phone??null,convertedToUploadAt:r.converted_to_upload_at??null,requestGroupId:r.request_group_id??null})}n(pe,"mapRequestView");z.object({request_group_id:z.string().min(1),pet_ref:z.string().min(1),total:z.number().int().nonnegative(),responded:z.number().int().nonnegative(),pending:z.number().int().nonnegative(),members:z.array(z.unknown())});function yt(e){return !e||e==="awaiting_upload"||e==="in_review"?null:ce.has(e)?e:null}n(yt,"normalizeSimpleStatus");z.object({source_doc_id:z.string().min(1),request_id:z.string().min(1)});var mt=z.object({label:z.string(),value:z.string()}),vt=z.object({key:z.string(),category:z.string().optional(),label:z.string().optional(),value:z.string().nullish(),unit:z.string().nullish(),observed_at:z.string().nullish(),status:z.string().nullish(),origin:z.string().nullish(),canonical_key:z.string().nullish()}),_t=z.object({at:z.string(),value:z.number().nullish(),display:z.string().nullish(),origin:z.string().nullish()}),bt=z.object({key:z.string(),label:z.string().optional(),points:z.array(_t).optional()}),ht=z.object({title:z.string(),detail:z.string().nullish(),due_at:z.string().nullish()}),Et=z.object({doc_id:z.string(),title:z.string().nullish(),page_count:z.number().nullish(),received_at:z.string().nullish()});z.object({identity:z.array(mt).optional(),entities:z.array(vt).optional(),entity_series:z.array(bt).optional(),forward_looking:z.array(ht).optional(),documents:z.array(Et).optional()});z.object({pet_ref:z.string().optional(),granted:z.boolean().optional(),version:z.string().nullish(),granted_at:z.string().nullish()});function de(e,t){return typeof e=="number"&&Number.isFinite(e)?e:t}n(de,"numberOr");var gt="/widget/v1/records/sandbox/requests",fe=64,Rt=new Set(["records","no_records","declined"]),St=new Set(["applied","already_applied","not_applicable"]);function I(e){return y("validationFailed",{retryable:false,wireMessage:e})}n(I,"invalid");function wt(e){return typeof e!="string"||e.length===0?I("request_id is required and must be a non-empty string"):F(e)?I("request_id contains an unpaired surrogate and cannot be encoded"):[...e].length>fe?I(`request_id is longer than ${fe} characters`):null}n(wt,"requestIdError");function Ct(e){if(typeof e!="object"||e===null)return null;let{result:t,request:r}=e;if(typeof t!="string"||!St.has(t))return null;let o=pe(r);return o===null?null:Object.freeze({result:t,request:o})}n(Ct,"mapActionResult");function ye(e){let t=e.funnel??k({auth:e.auth,...e.errorPolicy?{errorPolicy:e.errorPolicy}:{}}),r=n(async(o,a,s,u)=>{let p=wt(a);if(p!==null)return l(p);let c=`${gt}/${encodeURIComponent(a)}/${s}`,f=await t.send(o,u===void 0?{method:"POST",path:c}:{method:"POST",path:c,body:u});if(!f.ok)return l(f.error);let w=Ct(f.value);return w===null?l(y("internalError",{retryable:false})):T(w)},"run");return {simulateClinicReply(o,a){return typeof a!="string"||!Rt.has(a)?Promise.resolve(l(I("outcome must be records, no_records or declined"))):r("records.sandbox.clinicReply",o,"clinic-reply",{outcome:a})},publishSampleRecord(o){return r("records.sandbox.publishSample",o,"publish-sample")}}}n(ye,"createRecordsSandboxController");function Tt(){let{runtime:e,userRef:t,scopeEpoch:r}=h();return useMemo(()=>{let{services:o}=e.registry;return ye({auth:o.authFor(t),...o.errorPolicy?{errorPolicy:o.errorPolicy}:{}})},[e,t,r])}n(Tt,"useEverfurRecordsSandbox");var L="/widget/v1/televet/sandbox/visits",Ot=128,me=64,be=new Set(["booked","cancelled","completed","no_show"]),kt=new Set(["applied","already_applied","not_applicable"]),ve=new Set(["rescheduled","reminder","followup_sent","message_received","ended"]),_e=new Set(["24h","30m"]);function _(e){return y("validationFailed",{retryable:false,wireMessage:e})}n(_,"invalid");function N(e,t,r){return typeof t!="string"||t.length===0?_(`${e} is required and must be a non-empty string`):F(t)?_(`${e} contains an unpaired surrogate and cannot be encoded`):le(t)>r?_(`${e} is longer than ${r} characters`):null}n(N,"textError");function Ft(e){if(typeof e!="object"||e===null)return null;let{result:t,visit:r}=e;if(typeof t!="string"||!kt.has(t)||typeof r!="object"||r===null)return null;let{visit_ref:o,pet_ref:a,status:s,scheduled_at:u}=r;return typeof o!="string"||o.length===0||typeof a!="string"||a.length===0||typeof s!="string"||!be.has(s)||typeof u!="string"||u.length===0?null:Object.freeze({result:t,visit:Object.freeze({visitRef:o,petRef:a,status:s,scheduledAt:u})})}n(Ft,"mapActionResult");function he(e){let t=e.funnel??k({auth:e.auth,...e.errorPolicy?{errorPolicy:e.errorPolicy}:{}}),r=n(async(o,a,s)=>{let u=await t.send(o,{method:"POST",path:a,body:s},{idempotent:false,maxAttempts:1});if(!u.ok)return l(u.error);let p=Ft(u.value);return p===null?l(y("internalError",{retryable:false})):T(p)},"run");return {createVisit(o){let a=N("pet_ref",o,Ot);return a!==null?Promise.resolve(l(a)):r("televet.sandbox.createVisit",L,{pet_ref:o})},advanceVisit(o,a){let s=N("visit_ref",o,me);if(s!==null)return Promise.resolve(l(s));if(typeof a!="string"||!be.has(a))return Promise.resolve(l(_("to must be booked, cancelled, completed or no_show")));let u=`${L}/${encodeURIComponent(o)}/advance`;return r("televet.sandbox.advanceVisit",u,{to:a})},simulateVisitEvent(o,a,s){let u=N("visit_ref",o,me);if(u!==null)return Promise.resolve(l(u));if(typeof a!="string"||!ve.has(a))return Promise.resolve(l(_(`event must be one of ${[...ve].join(", ")}`)));if(a==="reminder"){if(typeof s!="string"||!_e.has(s))return Promise.resolve(l(_(`stage must be one of ${[..._e].join(", ")} for a reminder`)))}else if(s!==void 0)return Promise.resolve(l(_("stage is only for a reminder")));let p=`${L}/${encodeURIComponent(o)}/simulate`;return r("televet.sandbox.simulateVisitEvent",p,s===void 0?{event:a}:{event:a,stage:s})}}}n(he,"createVetVisitSandboxController");function At(){let{runtime:e,userRef:t,scopeEpoch:r}=h();return useMemo(()=>{let{services:o}=e.registry;return he({auth:o.authFor(t),...o.errorPolicy?{errorPolicy:o.errorPolicy}:{}})},[e,t,r])}n(At,"useEverfurVetVisitSandbox");export{Tt as useEverfurRecordsSandbox,ke as useEverfurTestEntitlements,At as useEverfurVetVisitSandbox};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { q as RecordsTimelineView } from './depth-DvPwPuT_.js';
|
|
2
|
+
|
|
3
|
+
type TimelineRowKind = 'visit' | 'vaccine' | 'weight' | 'medication';
|
|
4
|
+
interface TimelineRow {
|
|
5
|
+
/** Stable list key: the kind, the array index and the BE id (ids are not unique across rails). */
|
|
6
|
+
readonly key: string;
|
|
7
|
+
readonly kind: TimelineRowKind;
|
|
8
|
+
readonly kindLabel: string;
|
|
9
|
+
/** ISO, or null when the BE row carries no date (sinks to the bottom). */
|
|
10
|
+
readonly at: string | null;
|
|
11
|
+
readonly date: string;
|
|
12
|
+
readonly title: string;
|
|
13
|
+
readonly detail: string | null;
|
|
14
|
+
readonly docId: string | null;
|
|
15
|
+
}
|
|
16
|
+
/** Merge the four rails into one newest-first list; a dateless entry sinks rather than being dropped. */
|
|
17
|
+
declare function buildTimelineRows(timeline: RecordsTimelineView): readonly TimelineRow[];
|
|
18
|
+
|
|
19
|
+
export { type TimelineRow as T, type TimelineRowKind as a, buildTimelineRows as b };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { q as RecordsTimelineView } from './depth-D5HwcvKC.cjs';
|
|
2
|
+
|
|
3
|
+
type TimelineRowKind = 'visit' | 'vaccine' | 'weight' | 'medication';
|
|
4
|
+
interface TimelineRow {
|
|
5
|
+
/** Stable list key: the kind, the array index and the BE id (ids are not unique across rails). */
|
|
6
|
+
readonly key: string;
|
|
7
|
+
readonly kind: TimelineRowKind;
|
|
8
|
+
readonly kindLabel: string;
|
|
9
|
+
/** ISO, or null when the BE row carries no date (sinks to the bottom). */
|
|
10
|
+
readonly at: string | null;
|
|
11
|
+
readonly date: string;
|
|
12
|
+
readonly title: string;
|
|
13
|
+
readonly detail: string | null;
|
|
14
|
+
readonly docId: string | null;
|
|
15
|
+
}
|
|
16
|
+
/** Merge the four rails into one newest-first list; a dateless entry sinks rather than being dropped. */
|
|
17
|
+
declare function buildTimelineRows(timeline: RecordsTimelineView): readonly TimelineRow[];
|
|
18
|
+
|
|
19
|
+
export { type TimelineRow as T, type TimelineRowKind as a, buildTimelineRows as b };
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { C as ClientBranding, E as EverfurThemeInput, a as EverfurTheme, b as EverfurFontWeight, c as EverfurFontFaceKey } from './branding-CsRdeNwK.cjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Overlay `b` onto `base`, field by field: a non-null branding field WINS; a null field KEEPS the base. A
|
|
5
|
+
* valid brightness re-selects the matching compiled palette (light/dark); an invalid/absent brightness leaves
|
|
6
|
+
* the base palette untouched. Slots merge per slot, per key. Returns a NEW deeply-frozen theme; `base` and `b`
|
|
7
|
+
* are never mutated.
|
|
8
|
+
*
|
|
9
|
+
* The name is historical (the server was once the only overlay); `resolveTheme` applies it twice, server then
|
|
10
|
+
* client, which is how the client wins per field. NOTE: foreground legibility (onPrimary/onAccent, the slot
|
|
11
|
+
* guard) and URL hardening are applied by `resolveTheme`, the total entry point. Call this directly only when
|
|
12
|
+
* you will finalize the result yourself.
|
|
13
|
+
*/
|
|
14
|
+
declare function withServerBranding(base: EverfurTheme, b: ClientBranding | null): EverfurTheme;
|
|
15
|
+
/**
|
|
16
|
+
* Inputs to the total theme resolve. All optional; `resolveTheme(undefined)` yields the compiled Everfur
|
|
17
|
+
* default. Merge order: compiled default <- server branding (render_hints) <- client theme prop, per field, with
|
|
18
|
+
* the tenant's locked fields and the attribution kept from the server (see `resolveTheme`).
|
|
19
|
+
*/
|
|
20
|
+
interface ResolveThemeInput {
|
|
21
|
+
/** Server-driven branding from the live entitlements render_hints (the tenant's console branding). */
|
|
22
|
+
readonly branding?: ClientBranding | null;
|
|
23
|
+
/**
|
|
24
|
+
* The clamped client `theme` prop. It WINS per cosmetic field over the server branding, except the fields the
|
|
25
|
+
* server lists in `locked_fields`. Its hidePoweredBy is IGNORED: whether the Everfur attribution shows is
|
|
26
|
+
* decided by server branding alone.
|
|
27
|
+
*/
|
|
28
|
+
readonly clientOverride?: ClientBranding | null;
|
|
29
|
+
/**
|
|
30
|
+
* The device color scheme (useColorScheme / `prefers-color-scheme`). Read ONLY when the settled brightness is
|
|
31
|
+
* `auto` (an explicit opt-in); with no brightness set anywhere the theme is light, as Everfur's own apps are.
|
|
32
|
+
*/
|
|
33
|
+
readonly colorScheme?: 'light' | 'dark' | null;
|
|
34
|
+
/** AccessibilityInfo reduced-motion / `prefers-reduced-motion`: collapses the motion tokens. */
|
|
35
|
+
readonly reducedMotion?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* The user's text scale as the host reads it (React Native: `PixelRatio.getFontScale()`; the browser: the
|
|
38
|
+
* browser's default font size over 16px). Floored at `TEXT_SCALE_FLOOR`; absent or junk reads as 1. Flowing
|
|
39
|
+
* content follows it uncapped; each chrome tier follows it up to that tier's cap (`type.scaleCaps`).
|
|
40
|
+
*/
|
|
41
|
+
readonly textScale?: number;
|
|
42
|
+
/**
|
|
43
|
+
* Multiply the type sizes by the effective scale, per tier (`type.size` for content, `type.tierSizes` for every
|
|
44
|
+
* tier). A browser host passes true (CSS px do not follow the user's setting on their own); a React Native host
|
|
45
|
+
* leaves it false and lets the platform scale every Text natively, capped per tier by `maxFontSizeMultiplier`.
|
|
46
|
+
*/
|
|
47
|
+
readonly scaleTypeSizes?: boolean;
|
|
48
|
+
/** The user asked for more contrast (`prefers-contrast: more`): the palette is derived by `deriveHighContrast`. */
|
|
49
|
+
readonly highContrast?: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* The family the platform's generic mono keyword (`SYSTEM_MONO_FAMILY`) maps to on this host. React Native on iOS
|
|
52
|
+
* has no family named `monospace` (a Text asking for it renders proportional, and the legacy architecture
|
|
53
|
+
* red-boxes in development), so the React Native host passes `Menlo` there. Applied to the compiled default mono
|
|
54
|
+
* only: a partner's own mono face is never touched. Absent or blank, the keyword stands (the web maps it to its
|
|
55
|
+
* mono stack in CSS).
|
|
56
|
+
*/
|
|
57
|
+
readonly platformMonoFamily?: string;
|
|
58
|
+
/**
|
|
59
|
+
* Whether a family name is registered with the platform, when the host can tell: true or false, else null. A
|
|
60
|
+
* NAMED face (one per-weight name, rendered without a weight) that the host reports unregistered falls back to
|
|
61
|
+
* the platform font of its group WITH its numeric weight, so medium and bold survive instead of every weight
|
|
62
|
+
* collapsing to the platform's regular. Only named faces are asked about; a throw reads as null.
|
|
63
|
+
*/
|
|
64
|
+
readonly isFontRegistered?: (family: string) => boolean | null;
|
|
65
|
+
}
|
|
66
|
+
/** The smallest effective text scale the resolver will report (a device may ask for less; the surfaces stop here). */
|
|
67
|
+
declare const TEXT_SCALE_FLOOR = 0.5;
|
|
68
|
+
/**
|
|
69
|
+
* Resolve the final, legible, deeply-frozen theme. Never throws, never returns null/transparent.
|
|
70
|
+
*
|
|
71
|
+
* PRECEDENCE (per field, owner decision of 18 September 2026; the same rule EFBackend render_hint_fold states):
|
|
72
|
+
* a field in `locked_fields` (plus `hide_powered_by` always) is server-wins; every other cosmetic field is
|
|
73
|
+
* client-wins.
|
|
74
|
+
* - A server branding with an unknown `schema_version` is dropped whole (default plus client theme).
|
|
75
|
+
* - `hide_powered_by`, and every name the server lists in `locked_fields`, are SERVER-WINS: the client's value
|
|
76
|
+
* for such a field is discarded before the merge, so the server's value or the compiled default stands.
|
|
77
|
+
* `slots` in the list locks every slot; `slots.<name>` locks one.
|
|
78
|
+
* - Every other cosmetic field is CLIENT-WINS: the client `theme` prop overrides the console value, and the
|
|
79
|
+
* console fills the fields the prop leaves unset. Brightness is settled the same way; set nowhere, it is
|
|
80
|
+
* LIGHT (owner decision OD28: Everfur's own apps are light-only), and `auto` follows the device scheme.
|
|
81
|
+
* - Slots overlay slot by slot (a named slot replaces the one below it whole) in the same order, after the
|
|
82
|
+
* field precedence.
|
|
83
|
+
* Then the total-resolve guarantees: onPrimary/onAccent via WCAG, the slot contrast guard, https-only logo/font
|
|
84
|
+
* URLs, a non-empty displayName, the text scale (floored; tiered caps on the chrome), motion collapsed under reduced
|
|
85
|
+
* motion, and the high-contrast derivation when the user asked for it.
|
|
86
|
+
*/
|
|
87
|
+
declare function resolveTheme(input?: ResolveThemeInput): EverfurTheme;
|
|
88
|
+
/**
|
|
89
|
+
* The console's preview helper: resolve a draft branding exactly as the device would, from the raw shapes (the
|
|
90
|
+
* partner's `theme` prop and the server-shaped branding object the console is about to publish), with the device
|
|
91
|
+
* inputs of the preview. Pure and total: any shape is tolerated, nothing throws.
|
|
92
|
+
*/
|
|
93
|
+
declare function previewTheme(input: EverfurThemeInput | null, hints: unknown, options?: Omit<ResolveThemeInput, 'branding' | 'clientOverride'>): EverfurTheme;
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* The text style a surface spreads for one face. `fontWeight` is present ONLY for a base family (the platform
|
|
97
|
+
* font, the legacy `font_family`, or a `fonts` name repeated across weights); a named face carries its weight
|
|
98
|
+
* itself. The regular mono face carries no weight (code renders in the regular mono face); its medium and bold
|
|
99
|
+
* twins (`monoMedium`, `monoBold`) take theirs when the mono family is a base family.
|
|
100
|
+
*/
|
|
101
|
+
interface EverfurFaceStyle {
|
|
102
|
+
readonly fontFamily: string;
|
|
103
|
+
readonly fontWeight?: EverfurFontWeight;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* The family (and, for a base family, the numeric weight) of one face of the theme. Spread it into a style:
|
|
107
|
+
* `{ ...face(theme, 'bold'), fontSize: theme.type.size.body }`. Pure and total over any resolved theme.
|
|
108
|
+
*/
|
|
109
|
+
declare function face(theme: EverfurTheme, weight: EverfurFontFaceKey): EverfurFaceStyle;
|
|
110
|
+
|
|
111
|
+
export { type EverfurFaceStyle as E, type ResolveThemeInput as R, TEXT_SCALE_FLOOR as T, face as f, previewTheme as p, resolveTheme as r, withServerBranding as w };
|