@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
|
+
import {createContext,forwardRef,useMemo,useState,useRef,useCallback,useEffect,createElement,useContext,Component}from'react';import {TextInput,View,Pressable,ActivityIndicator,StyleSheet,Text}from'react-native';import {jsxs,jsx}from'react/jsx-runtime';var ir=Object.defineProperty;var n=(e,r)=>ir(e,"name",{value:r,configurable:true});var sr=Object.freeze({regular:"regular",medium:"medium",bold:"bold",mono:"regular",monoMedium:"medium",monoBold:"bold"});function O(e,r){let t=e.type,o=t.families[r];return r==="mono"||t.namedFaces[r]?{fontFamily:o}:{fontFamily:o,fontWeight:t.weight[sr[r]]}}n(O,"face");var S=Object.freeze({loading:"Loading",retry:"Try again",signedOut:"Sign in required",changeable:"You can change this at any time.",saving:"Saving"}),$=Object.freeze({transcript_exposure:Object.freeze({title:"Conversation sharing",body:n(e=>`Let ${e} read the conversations you have with Everfur.`,"body")}),partner_context:Object.freeze({title:"Pet details",body:n(e=>`Let Everfur use the pet details ${e} already holds as background in your conversations.`,"body")})});function Q(e,r){if(e.status==="signed_out")return {kind:"signedOut"};let t=e.scopes.find(o=>o.scope===r);return t===void 0?e.error!==null?{kind:"failed",error:e.error}:{kind:"loading"}:t.loaded?{kind:"row",scope:t.scope,granted:t.granted,hasDecision:t.hasDecision,saving:t.saving,error:t.error}:t.error!==null?{kind:"failed",error:t.error}:{kind:"loading"}}n(Q,"consentRowView");var X=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(X.map(e=>e.wireCode));var lr=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"}),Ee=Object.freeze(X.map(e=>Object.freeze({wireCode:e.wireCode,envelope:e.envelope,retryable:e.retryable,normalized:lr[e.wireCode]}))),ur=new Map(Ee.map(e=>[e.envelope+e.wireCode.toUpperCase(),e])),dr=Object.freeze(["http_envelope",...[...new Set(Ee.map(e=>e.envelope))].filter(e=>e!=="http_envelope").sort()]);function q(e,r){if(typeof e!="string")return;let t=e.trim().toUpperCase();if(t.length!==0)for(let o of [r??"http_envelope",...dr]){let a=ur.get(o+t);if(a)return a}}n(q,"contractErrorFor");function cr(e){return e.envelope==="sse_frame"?`/errors#sse-${e.wireCode}`:e.envelope==="oauth_error"?`/errors#oauth-${e.wireCode}`:`/errors#${e.wireCode}`}n(cr,"contractDocUrl");function be(e){return null}n(be,"publishedDocUrl");var pr=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 ge(e){return pr[e]}n(ge,"categoryFor");function he(e){let r=q(e);if(r)return r.normalized;let t=(e??"").trim().toUpperCase(),o=t.replace(/[^A-Z0-9]/g,"");if(o==="AUTHREJECTED")return "authRejected";if(t.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(he,"fromWire");var fr=new Set(["streamTimeout","rateLimited","internalError","upstreamLlmTimeout","streamIncomplete"]);function J(e){return fr.has(e)}n(J,"isAutoRetryable");var yr=new Set(["serviceUnavailable","conflict","idempotencyInFlight"]);function _e(e){return J(e)||yr.has(e)}n(_e,"isRetryableCode");var mr=500,Z=8e3,Ce=4;function Re(e,r=Math.random){let t=Math.max(0,e),o=Math.min(mr*2**t,Z);return Math.floor(r()*o)}n(Re,"backoffDelayMs");var vr=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 Er(e){return vr[e]}n(Er,"userFacingError");function Te(e,r,t){Object.defineProperty(e,r,{value:t,enumerable:false,writable:false,configurable:false});}n(Te,"defineHidden");var br=/^[a-z][a-z0-9_]{0,63}$/;function w(e,r){let t=q(r?.wireCode,r?.wireEnvelope),o={code:e,category:ge(e),retryable:r?.retryable??_e(e),displayMessage:Er(e)};if(r?.httpStatus!==void 0&&(o.httpStatus=r.httpStatus),r?.requestId&&(o.requestId=r.requestId),typeof r?.reasonCode=="string"&&br.test(r.reasonCode)&&(o.reasonCode=r.reasonCode),t);return r?.wireMessage&&Te(o,"wireMessage",r.wireMessage),r?.raw!==void 0&&r.raw!==null&&Te(o,"raw",r.raw),Object.freeze(o)}n(w,"makeEverfurError");function ee(e,r){return Object.freeze(r===void 0?{ok:true,value:e}:{ok:true,value:e,warning:r})}n(ee,"ok");function p(e){return Object.freeze({ok:false,error:e})}n(p,"err");var V=class V extends Error{constructor(r,t){super(t),this.name="EverfurConfigError",this.kind=r,Object.setPrototypeOf(this,V.prototype);}};n(V,"EverfurConfigError");var D=V;function Se(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(Se,"errorFrame");function _r(e){let r={};return e.mode==="personalized"?r.authorization=`Bearer ${e.token}`:r["x-everfur-partner-key"]=e.publishableKey,e.userRef&&(r["x-everfur-user-ref"]=e.userRef),e.sessionId&&(r["x-everfur-session-id"]=e.sessionId),r}n(_r,"authHeaders");function N(e,r){return {...e,headers:{...Cr(e.headers),..._r(r)}}}n(N,"withAuthHeaders");function Cr(e){if(!e)return {};let r={};for(let[t,o]of Object.entries(e)){let a=t.toLowerCase();a==="authorization"||a==="x-everfur-partner-key"||(r[t]=o);}return r}n(Cr,"stripAuthHeaders");async function we(e,r){if(r.mode==="anonymous")return r.transport.request(N(e,{mode:"anonymous",publishableKey:r.publishableKey,userRef:r.userRef,...r.sessionId?{sessionId:r.sessionId}:{}}));let t;try{t=await r.identity.currentToken();}catch{return p(re())}let o=await r.transport.request(N(e,{mode:"personalized",token:t,userRef:r.userRef,...r.sessionId?{sessionId:r.sessionId}:{}}));if(o.ok||o.error.httpStatus!==401)return o;let a;try{a=await r.identity.currentToken({forceRefresh:!0});}catch{return p(re())}let l=await r.transport.request(N(e,{mode:"personalized",token:a,userRef:r.userRef,...r.sessionId?{sessionId:r.sessionId}:{}}));return !l.ok&&l.error.httpStatus===401?p(re(l.error.httpStatus)):l}n(we,"authedSend");function re(e){return w("authRejected",{retryable:false,...e!==void 0?{httpStatus:e}:{}})}n(re,"authRejectedError");function xe(e){return w("internalError",{retryable:true,wireMessage:Rr(e)})}n(xe,"networkError");function Rr(e){return e instanceof Error?e.message:typeof e=="string"?e:"network request failed"}n(Rr,"describeCause");var Tr=3e4,Sr=Z*2,wr="idempotency-key",xr=new Set(["POST","PUT","PATCH","DELETE"]),Fr=Object.freeze({onEvent(){}}),kr=Object.freeze({setTimeout:n((e,r)=>setTimeout(e,r),"setTimeout"),clearTimeout:n(e=>clearTimeout(e),"clearTimeout"),now:n(()=>Date.now(),"now")});function Or(e){let r=e.trim().replace(/[^A-Za-z0-9_.:-]/g,"-");return r.length===0?null:`efs_${r}`.slice(0,128)}n(Or,"seededIdempotencyKey");function ke(e){let r=e.observer??Fr,t=e.timers??kr,o=e.rng??Math.random,a=e.sleep??((v,d)=>Vr(v,t,d)),l=e.maxAttempts??Ce,i=e.unaryTimeoutMs??Tr,f=e.newIdempotencyKey??Ir(),s=n(v=>{try{r.onEvent(v);}catch{}},"emit");async function m(v,d,c){let y=c?.maxAttempts,C=Math.max(1,y??l),x=c?.idempotent??xr.has(d.method),R=c?.idempotencyKey===void 0?null:Or(c.idempotencyKey),u=x?R??f():null,g=Ar(d,u),h=0;for(;;){let T=n(G=>Object.freeze({call:v,method:d.method,path:d.path,attempt:h,...u?{idempotencyKey:u}:{},...G}),"stamp");s(T({phase:"attempt"}));let z=Br(i,t),U=qr(z.signal,d.signal),j;try{j=await we({...g,signal:U.signal},e.auth);}catch(G){j=p(xe(G));}finally{U.dispose(),z.cancel();}if(j.ok)return s(T({phase:"settled",ok:true,reason:"ok"})),j;let F=j.error,B=zr(F,h,{maxAttempts:C,rng:o,now:t.now(),aborted:d.signal?.aborted===true,...y!==void 0?{perCallMaxAttempts:y}:{},...e.errorPolicy!==void 0?{policy:e.errorPolicy}:{}}),W={ok:false,code:F.code,reason:B.reason,...F.httpStatus!==void 0?{httpStatus:F.httpStatus}:{},...F.requestId!==void 0?{requestId:F.requestId}:{}};if(!B.retry)return s(T({phase:"settled",...W})),p(F);if(s(T({phase:"retry",...W,delayMs:B.delayMs})),await a(B.delayMs,d.signal),d.signal?.aborted===true)return s(T({phase:"settled",...W,reason:"aborted"})),p(F);h+=1;}}n(m,"send");async function k(v){return N(v,await Ur(e.auth))}n(k,"authorize");async function*_(v,d,c){s(Object.freeze({call:v,phase:"stream.open",method:d.method,path:d.path,attempt:0}));try{yield*e.auth.transport.stream(d,c);}catch{yield Se({code:"internal_error",retryable:true,wireMessage:null,synthesized:true,lastEventId:null,serverRequestId:null});}}return n(_,"stream"),Object.freeze({send:m,authorize:k,stream:_})}n(ke,"createRequestFunnel");function Ar(e,r){let t={};for(let[o,a]of Object.entries(e.headers??{}))o.toLowerCase()!==wr&&(t[o]=a);return r!==null&&(t["Idempotency-Key"]=r),{...e,headers:t}}n(Ar,"assembleHeaders");function Ir(){let e=0;return ()=>`efk_${Date.now().toString(36)}_${(e++).toString(36)}_${Math.random().toString(36).slice(2,12)}`}n(Ir,"defaultIdempotencyKeyFactory");var Pr=10;function zr(e,r,t){if(t.aborted)return {retry:false,reason:"aborted"};let o=jr(e);if(o==="quota")return {retry:false,reason:"daily-quota-exhausted"};if(o!=="burst"&&!J(e.code))return {retry:false,reason:"terminal-code"};let a=o==="burst"?"burst-throttle":"retryable-code";if(n(()=>{if(t.policy===void 0)return false;try{return !t.policy.shouldRetry(e.code,r)}catch{return false}},"policyVetoedRetry")())return {retry:false,reason:"terminal-code"};let i=n(()=>{if(t.policy===void 0)return null;let m;try{m=t.policy.maxAttempts(e.code);}catch{return null}return typeof m!="number"||!Number.isFinite(m)?null:Math.max(1,Math.min(Pr,Math.floor(m)))},"policyCeiling"),f=t.perCallMaxAttempts??i()??t.maxAttempts;if(r+1>=f)return {retry:false,reason:"attempts-exhausted"};let s=Dr(e,t.now);return s!==null?s>Sr?{retry:false,reason:"server-reset-beyond-budget"}:{retry:true,reason:a,delayMs:s}:{retry:true,reason:a,delayMs:Re(r,t.rng)}}n(zr,"decideRetry");function jr(e){let r=e.code==="unknown"?he(Lr(e.raw)):e.code;return r==="quotaExceeded"?"quota":r==="rateLimited"||e.httpStatus===429?"burst":null}n(jr,"throttleKind");function Dr(e,r){let t=Nr(e.raw);if(t===null)return null;let o=t-r;return o>0?o:0}n(Dr,"retryOverrideMs");function Nr(e){for(let r of Oe(e)){let t=r.resets_at,o=Mr(t);if(o!==null)return o}return null}n(Nr,"findResetsAt");function Oe(e){if(!Fe(e))return [];let r=[e];for(let t of ["error","detail"]){let o=e[t];Fe(o)&&r.push(o);}return r}n(Oe,"candidateScopes");function Mr(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 r=Date.parse(e);return Number.isFinite(r)?r:null}return null}n(Mr,"parseInstantMs");function Lr(e){for(let r of Oe(e)){let t=r.code;if(typeof t=="string"&&t.length>0)return t}return null}n(Lr,"rawWireCode");function Fe(e){return typeof e=="object"&&e!==null}n(Fe,"isRecord");async function Ur(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(Ur,"resolveDeviceAuth");function Br(e,r){let t=new AbortController,o=r.setTimeout(()=>t.abort(),e);return {signal:t.signal,cancel:n(()=>r.clearTimeout(o),"cancel")}}n(Br,"boundedSignal");function qr(e,r){let t=n(()=>{},"noop");if(!r)return {signal:e,dispose:t};let o=new AbortController;if(e.aborted||r.aborted)return o.abort(),{signal:o.signal,dispose:t};let a=n(()=>o.abort(),"onAbort");return e.addEventListener("abort",a,{once:true}),r.addEventListener("abort",a,{once:true}),{signal:o.signal,dispose:n(()=>{e.removeEventListener("abort",a),r.removeEventListener("abort",a);},"dispose")}}n(qr,"mergeSignals");function Vr(e,r,t){return e<=0||t?.aborted===true?Promise.resolve():new Promise(o=>{let a=r.setTimeout(()=>{t?.removeEventListener("abort",l),o();},e),l=n(()=>{r.clearTimeout(a),o();},"onAbort");t?.addEventListener("abort",l,{once:true});})}n(Vr,"delayAbortable");var Ae="/widget/v1/consent",M=Object.freeze(["transcript_exposure","partner_context"]),Ie="records_content",ne=64,Hr=new Set(M);function H(e){return typeof e=="string"&&Hr.has(e)}n(H,"isEverfurConsentScope");function P(e){return w("validationFailed",{retryable:false,wireMessage:e})}n(P,"invalid");function De(e){return H(e)?null:P(e===Ie?`'${Ie}' is not recorded here: the records release a member grants and revokes is PUT and DELETE /widget/v1/records/pets/{pet_ref}/consent, which the records surface wires and which also kills the pet's live share links on a revoke. A row on the scoped ledger would not gate any read.`:`scope must be one of ${M.join(", ")}`)}n(De,"validateScope");function Yr(e){if(typeof e!="object"||e===null)return P("write needs a decision object");let{scope:r,granted:t,consentVersion:o}=e,a=De(r);return a!==null?a:typeof t!="boolean"?P("granted must be true to grant or false to withdraw"):o!==void 0&&(typeof o!="string"||o.length===0||o.length>ne)?P(`consentVersion must be 1..${ne} characters`):null}n(Yr,"validateDecision");var te=n(e=>typeof e=="string"&&e.length>0?e:null,"str");function Pe(e,r){if(typeof e!="object"||e===null)return null;let t=e;return typeof t.granted!="boolean"||typeof t.has_decision!="boolean"?null:Object.freeze({scope:r,granted:t.granted,hasDecision:t.has_decision,consentVersion:te(t.consent_version),actor:te(t.actor),recordedAt:te(t.recorded_at)})}n(Pe,"verdictFromWire");function ze(e){return w("internalError",{retryable:false,httpStatus:502,wireMessage:`${e}: the response carried no granted/has_decision pair`})}n(ze,"malformed");function je(e){return P(`the Everfur runtime is disposed; ${e} was called after unmount`)}n(je,"disposed");function oe(e){let r=n(()=>{let{services:t}=e.registry;return Ne({auth:t.authFor(null),...t.errorPolicy?{errorPolicy:t.errorPolicy}:{}})},"over");return {read:n((t,o)=>e.isDisposed?Promise.resolve(p(je("read"))):r().read(t,o),"read"),write:n((t,o)=>e.isDisposed?Promise.resolve(p(je("write"))):r().write(t,o),"write")}}n(oe,"createConsentRepository");function Ne(e){let r=e.funnel??ke({auth:e.auth,...e.errorPolicy?{errorPolicy:e.errorPolicy}:{}}),t=n((o,a)=>a?{...o,signal:a}:o,"withSignal");return {async read(o,a){let l=De(o);if(l!==null)return p(l);let i=await r.send("consent.read",t({method:"GET",path:Ae,query:{scope:o}},a?.signal));if(!i.ok)return p(i.error);let f=Pe(i.value,o);return f===null?p(ze("consent.read")):ee(f)},async write(o,a){let l=Yr(o);if(l!==null)return p(l);let i={scope:o.scope,granted:o.granted};o.consentVersion!==void 0&&(i.consent_version=o.consentVersion);let f=await r.send("consent.write",t({method:"PUT",path:Ae,body:i},a?.signal));if(!f.ok)return p(f.error);let s=Pe(f.value,o.scope);return s===null?p(ze("consent.write")):ee(s)}}}n(Ne,"createConsentRepositoryOver");var Me=Symbol.for("@everfur/sdk#EverfurContext@v1"),Le=globalThis,Ue=Le[Me]??(Le[Me]=createContext(null));Ue.displayName??="EverfurContext";function ae(){let e=useContext(Ue);if(e===null)throw new D("not-initialized","Everfur hooks must be called inside <EverfurProvider>. Wrap your tree once, high.");return e}n(ae,"useEverfurContext");function se(e,r){return Object.freeze({scope:e,granted:false,hasDecision:false,consentVersion:null,recordedAt:null,loaded:false,saving:false,error:r})}n(se,"blank");function qe(e){return Object.freeze({scope:e.scope,granted:e.granted,hasDecision:e.hasDecision,consentVersion:e.consentVersion,recordedAt:e.recordedAt,loaded:true,saving:false,error:null})}n(qe,"settled");function Qr(){return w("sessionRequired",{retryable:false,wireMessage:"a consent decision is authored by the member; sign a user in on the provider first"})}n(Qr,"noMember");function Ve(){let{runtime:e}=ae();return useMemo(()=>oe(e),[e])}n(Ve,"useEverfurConsentRepository");function ue(e){let{userRef:r}=ae(),t=Ve(),o=(e?.scopes??[]).filter(H).join(","),a=useMemo(()=>{let c=o.length===0?[]:o.split(",");return c.length===0?M:Object.freeze(c)},[o]),[l,i]=useState(r===null?"signed_out":"loading"),[f,s]=useState([]),[m,k]=useState(null),_=useRef(0),v=useCallback(async()=>{if(r===null){_.current+=1,i("signed_out"),s([]),k(null);return}let c=_.current+=1;i("loading"),k(null);let y=await Promise.all(a.map(u=>t.read(u)));if(c!==_.current)return;let C=y.map((u,g)=>{let h=a[g];return u.ok?qe(u.value):se(h,u.error)}),x=y.find(u=>!u.ok),R=y.every(u=>!u.ok);s(Object.freeze(C)),i(R?"failed":"ready"),k(R&&x!==void 0&&!x.ok?x.error:null);},[t,a,r]);useEffect(()=>{v();},[v]);let d=useCallback(async(c,y)=>{if(r===null)return p(Qr());let C=_.current,x=null;s(u=>{let g=u.findIndex(U=>U.scope===c),h=g===-1?se(c,null):u[g];x=h;let T=Object.freeze({...h,granted:y,hasDecision:true,saving:true,error:null});if(g===-1)return Object.freeze([...u,T]);let z=[...u];return z[g]=T,Object.freeze(z)});let R=await t.write({scope:c,granted:y});return C!==_.current||s(u=>{let g=u.findIndex(T=>T.scope===c);if(g===-1)return u;let h=[...u];return h[g]=R.ok?qe(R.value):Object.freeze({...x??se(c,null),saving:false,error:R.error}),Object.freeze(h)}),R},[t,r]);return useMemo(()=>({status:l,scopes:f,error:m,setConsent:d,refresh:v}),[l,f,m,d,v])}n(ue,"useEverfurConsent");function He(e){let r=globalThis.console;try{r?.error?.("[everfur] A host callback threw; the SDK ignored it.",e);}catch{}}n(He,"reportHostFailure");function Xr(e){return (typeof e=="object"||typeof e=="function")&&e!==null&&typeof e.then=="function"}n(Xr,"isThenable");function Jr(e,...r){if(typeof e=="function")try{let t=e(...r);return Xr(t)&&Promise.resolve(t).then(void 0,He),t}catch(t){He(t);return}}n(Jr,"callHost");var Ye=new WeakMap;function Zr(e){if(typeof e!="function")return;let r=Ye.get(e);if(r!==void 0)return r;let t=n((...o)=>{Jr(e,...o);},"guarded");return Ye.set(e,t),t}n(Zr,"guardHost");function Ke(e,r){let t=null;for(let o of r){let a=e[o];typeof a=="function"&&(t??={...e},t[o]=Zr(a));}return t??e}n(Ke,"guardHostProps");var ce=class ce extends Component{constructor(){super(...arguments);this.state={failed:false,key:this.props.resetKey};}static getDerivedStateFromError(){return {failed:true}}static getDerivedStateFromProps(t,o){return Object.is(t.resetKey,o.key)?null:{failed:false,key:t.resetKey}}render(){return this.state.failed?this.props.fallback:this.props.children}};n(ce,"HostRenderBoundary");var de=ce;function rt({render:e}){return e()}n(rt,"RenderHost");function Ge({render:e,fallback:r,resetKey:t}){return createElement(de,{fallback:r,resetKey:t,children:createElement(rt,{render:e})})}n(Ge,"HostRender");function ye(e){if(e!==null&&typeof e=="object"&&!Object.isFrozen(e)){Object.freeze(e);for(let r of Object.keys(e))ye(e[r]);}return e}n(ye,"deepFreeze");var tt=Object.freeze({content:0,heading:2,control:1.8,compact:1.5,badge:1.3}),Qe={xs:4,sm:8,md:12,lg:16,xl:24,xxl:32},Xe={tile:5,xs:6,sm:10,md:14,lg:20,xl:28,pill:500},$e={nano:8,small:9,micro:10,tiny:11,caption:12,bodyTight:13,body:14,subtitle:16,heading:18,verdict:24},nt={tight:1.15,snug:1.3,normal:1.4,relaxed:1.55},ot={regular:"400",medium:"500",bold:"700"},at={eyebrow:1,monoWide:.9,headerBrand:-0.42,tight:-0.35},it=0,Y="System",K="monospace",st=["content","heading","control","compact","badge"];function lt(e){let r={};for(let t of st)r[t]=e;return r}n(lt,"authoredTierSizes");function Je(){return {family:Y,mono:K,fontUrl:null,families:{regular:Y,medium:Y,bold:Y,mono:K,monoMedium:K,monoBold:K},namedFaces:{regular:false,medium:false,bold:false,mono:false,monoMedium:false,monoBold:false},fontUrls:{},size:$e,tierSizes:lt($e),lineHeight:nt,weight:ot,letterSpacing:at,scale:1,maxScale:it,scaleCaps:tt}}n(Je,"baseType");var Ze={},pe=Object.freeze({standard:Object.freeze([.2,0,0,1]),emphasized:Object.freeze([.2,.8,.2,1]),exit:Object.freeze([.4,0,1,1])});function fe(e){return `cubic-bezier(${e.join(", ")})`}n(fe,"cssCubicBezier");var er={duration:{instant:80,fast:140,normal:220,slow:320},spring:{gentle:{damping:18,stiffness:200}},easing:{standard:fe(pe.standard),emphasized:fe(pe.emphasized),exit:fe(pe.exit)},reducedMotion:false},ut={brand:"#10462E",brandSoft:"rgba(16,70,46,0.10)",brandSofter:"rgba(16,70,46,0.15)",brandBorder:"rgba(16,70,46,0.18)",borderHairlineGreen:"rgba(16,70,46,0.25)",brandBorderStrong:"rgba(16,70,46,0.55)",brandInk:"#10462E",linkInk:"#10462E",surface:"#FFFFFF",surfaceCream:"#FDFBF8",surfaceSubtle:"#EFE9E3",background:"#FFFFFF",borderRingCream:"#D8D2C8",chatGround:"#FFFFFF",composerFill:"#FDFBF8",composerBorder:"rgba(16,70,46,0.75)",shadow:"#0B3421",text:{primary:"#111111",secondary:"#0E462E",muted:"#6E6660",placeholder:"rgba(61,61,61,0.75)",onBrand:"#FFFFFF",metaCool:"#3D3D3D",timestamp:"rgba(61,61,61,0.75)"},primary:"#10462E",onPrimary:"#FFFFFF",accent:"#10462E",onAccent:"#FFFFFF",accentEdge:"#07C168",success:"#07C168",danger:"#B91C1C",errorRed:"#FF1B00",warningStrong:"#A45610",cautionAccent:"#D9821D",riskConcern:"#EFA700",sentiment:{up:"#07C168",neutral:"#FBC558",down:"#FF1B00"},badgeBgPositive:"rgba(7,193,104,0.12)",badgeBgCaution:"rgba(217,130,29,0.14)",badgeBgCritical:"rgba(185,28,28,0.12)",badgeBgNeutral:"rgba(110,102,96,0.12)",bubbleUser:"#10462E",bubbleAssistant:"#FFFFFF",skeleton:"#EFE9E3",scanButtonPink:"#FFC3BC",checkupCardLowRiskBg:"rgba(7,193,104,0.10)",checkupCardConcernBg:"rgba(239,167,0,0.10)"},rr=ye({brightness:"light",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false},color:ut,space:Qe,radius:Xe,type:Je(),motion:er,slots:Ze}),dt={brand:"#6BD39A",brandSoft:"rgba(107,211,154,0.12)",brandSofter:"rgba(107,211,154,0.18)",brandBorder:"rgba(107,211,154,0.22)",borderHairlineGreen:"rgba(107,211,154,0.28)",brandBorderStrong:"rgba(107,211,154,0.55)",brandInk:"#6BD39A",linkInk:"#6BD39A",surface:"#1C1F23",surfaceCream:"#23272C",surfaceSubtle:"#23272C",background:"#15171A",borderRingCream:"#3A3F45",chatGround:"#1C1F23",composerFill:"#23272C",composerBorder:"rgba(107,211,154,0.75)",shadow:"#000000",text:{primary:"#F5F3F0",secondary:"#A9E4C4",muted:"#9A938C",placeholder:"rgba(255,255,255,0.55)",onBrand:"#0E1F17",metaCool:"#C9C9C9",timestamp:"rgba(245,243,240,0.7)"},primary:"#6BD39A",onPrimary:"#0E1F17",accent:"#6BD39A",onAccent:"#0E1F17",accentEdge:"#34D888",success:"#07C168",danger:"#F87171",errorRed:"#FF6B5B",warningStrong:"#F0A35E",cautionAccent:"#D9821D",riskConcern:"#EFA700",sentiment:{up:"#07C168",neutral:"#FBC558",down:"#FF1B00"},badgeBgPositive:"rgba(7,193,104,0.18)",badgeBgCaution:"rgba(217,130,29,0.20)",badgeBgCritical:"rgba(185,28,28,0.22)",badgeBgNeutral:"rgba(255,255,255,0.10)",bubbleUser:"#6BD39A",bubbleAssistant:"#1C1F23",skeleton:"#23272C",scanButtonPink:"#FFC3BC",checkupCardLowRiskBg:"rgba(7,193,104,0.16)",checkupCardConcernBg:"rgba(239,167,0,0.16)"};ye({brightness:"dark",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false},color:dt,space:Qe,radius:Xe,type:Je(),motion:er,slots:Ze});var tr=Symbol.for("@everfur/sdk#EverfurThemeContext@v1"),nr=globalThis,me=nr[tr]??(nr[tr]=createContext(rr));me.displayName??="EverfurThemeContext";function L(){return useContext(me)}n(L,"useEverfurTheme");function vt(e,r){let t=e.scaleCaps[r];return t>0?t:void 0}n(vt,"tierMultiplier");function b({tier:e="content",...r}){let{type:t}=L(),o=vt(t,e);return createElement(Text,o===void 0?r:{maxFontSizeMultiplier:o,...r})}n(b,"Text");forwardRef(n(function(r,t){return createElement(TextInput,{...r,...t===null?{}:{ref:t}})},"TextInput"));function Ct(e){let{scope:r,onChange:t,renderNotice:o,style:a}=Ke(e,["onChange"]),l=L(),i=useMemo(()=>Rt(l),[l]),f=ue({scopes:[r]}),s=Q(f,r),m=$[r],[k,_]=useState(null),v=useCallback(async y=>{_(y);let C=await f.setConsent(r,y);C.ok&&(_(null),t?.(C.value.granted));},[f,t,r]),d=n((y,C)=>jsxs(View,{style:i.notice,children:[jsx(Ge,{resetKey:y,render:()=>o?o(y):jsx(b,{style:i.noticeText,children:y.displayMessage}),fallback:jsx(b,{style:i.noticeText,children:y.displayMessage})}),jsx(Pressable,{onPress:C,accessibilityRole:"button",accessibilityLabel:S.retry,style:i.retry,children:jsx(b,{tier:"control",style:i.retryLabel,children:S.retry})})]}),"notice");if(s.kind==="signedOut")return jsxs(View,{style:[i.container,a],accessible:true,accessibilityRole:"text",accessibilityLabel:S.signedOut,children:[jsx(b,{style:i.title,children:m.title}),jsx(b,{style:i.body,children:S.signedOut})]});if(s.kind==="loading")return jsxs(View,{style:[i.container,a],accessible:true,accessibilityRole:"progressbar",accessibilityLabel:S.loading,children:[jsx(b,{style:i.title,children:m.title}),jsx(ActivityIndicator,{color:l.color.brandInk})]});if(s.kind==="failed")return jsxs(View,{style:[i.container,a],children:[jsx(b,{style:i.title,children:m.title}),d(s.error,()=>{f.refresh();})]});let c=`${m.title}. ${m.body(l.meta.displayName)}`;return jsxs(View,{style:[i.container,a],children:[jsxs(Pressable,{onPress:()=>{s.saving||v(!s.granted);},disabled:s.saving,accessibilityRole:"checkbox",accessibilityState:{checked:s.granted,disabled:s.saving},accessibilityLabel:c,accessibilityHint:s.saving?S.saving:void 0,hitSlop:{top:6,bottom:6,left:6,right:6},style:[i.row,s.granted?i.rowChecked:null],children:[jsx(View,{style:[i.box,s.granted?i.boxChecked:null],accessibilityElementsHidden:true,importantForAccessibility:"no",children:s.granted?jsx(b,{style:i.tick,children:"\u2713"}):null}),jsxs(View,{style:i.copy,children:[jsx(b,{style:i.title,children:m.title}),jsx(b,{style:i.body,children:m.body(l.meta.displayName)}),jsx(b,{style:i.footnote,children:S.changeable})]})]}),s.error===null?null:d(s.error,()=>{v(k??!s.granted);})]})}n(Ct,"EverfurConsentToggle");function Rt(e){let{color:r,radius:t,space:o,type:a}=e;return StyleSheet.create({container:{gap:o.sm,paddingHorizontal:o.lg,paddingVertical:o.md},row:{flexDirection:"row",alignItems:"flex-start",gap:o.md,borderRadius:t.md,borderWidth:1,borderColor:r.brandBorder,backgroundColor:r.surface,paddingHorizontal:o.lg,paddingVertical:o.lg},rowChecked:{borderColor:r.brand,backgroundColor:r.brandSoft},box:{width:24,height:24,borderRadius:t.xs,borderWidth:1,borderColor:r.brandBorder,backgroundColor:r.surface,alignItems:"center",justifyContent:"center"},boxChecked:{borderColor:r.brand,backgroundColor:r.brand},tick:{...O(e,"bold"),fontSize:a.size.caption,color:r.text.onBrand},copy:{flex:1,gap:o.xs},title:{...O(e,"bold"),fontSize:a.size.body,lineHeight:Math.round(a.size.body*a.lineHeight.snug),color:r.text.primary},body:{...O(e,"regular"),fontSize:a.size.caption,lineHeight:Math.round(a.size.caption*a.lineHeight.snug),color:r.text.secondary},footnote:{...O(e,"regular"),fontSize:a.size.caption,lineHeight:Math.round(a.size.caption*a.lineHeight.snug),color:r.text.muted},notice:{gap:o.xs,paddingTop:o.xs},noticeText:{...O(e,"regular"),fontSize:a.size.caption,lineHeight:Math.round(a.size.caption*a.lineHeight.snug),color:r.errorRed},retry:{alignSelf:"flex-start",minHeight:44,justifyContent:"center"},retryLabel:{...O(e,"bold"),fontSize:a.size.caption,color:r.linkInk}})}n(Rt,"makeStyles");export{S as CONSENT_COPY,$ as CONSENT_SCOPE_COPY,ne as CONSENT_VERSION_MAX,M as EVERFUR_CONSENT_SCOPES,Ct as EverfurConsentToggle,Q as consentRowView,oe as createConsentRepository,Ne as createConsentRepositoryOver,H as isEverfurConsentScope,ue as useEverfurConsent,Ve as useEverfurConsentRepository};
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { U as UserRef, P as PetRef } from './ids-B2GAAifq.cjs';
|
|
3
|
+
import { C as CapabilityName, a as CapabilityDecision } from './resolve-D4Ywz5OS.cjs';
|
|
4
|
+
import { T as TokenProvider } from './identity-C2-08BZW.cjs';
|
|
5
|
+
import { T as TransportPort } from './config--Wu1Umhd.cjs';
|
|
6
|
+
import { K as KvPort, I as ImageCachePort } from './cacheEpoch-DknKn3S0.cjs';
|
|
7
|
+
import { S as SecureStorePort, b as LogSink, e as EverfurRuntime } from './runtimeTypes-gZEJu-da.cjs';
|
|
8
|
+
import { T as TelemetryPort } from './TelemetryPort-BDNr00hu.cjs';
|
|
9
|
+
import { E as ErrorPolicyPort } from './ErrorPolicyPort-CNf4uQZP.cjs';
|
|
10
|
+
import { C as CameraPort } from './CameraPort-Cv31Pz7g.cjs';
|
|
11
|
+
import { U as UploadTransport } from './ports-BN6RHF9W.cjs';
|
|
12
|
+
import { U as UploadPort } from './ports-BY2ph0_y.cjs';
|
|
13
|
+
import { E as EverfurThemeInput, a as EverfurTheme } from './branding-CsRdeNwK.cjs';
|
|
14
|
+
import { E as EverfurError } from './EverfurResult-DN9pL2Ab.cjs';
|
|
15
|
+
import { b as WidgetPetProfile } from './petsRepository-B_gKbAzJ.cjs';
|
|
16
|
+
|
|
17
|
+
interface EverfurConfig {
|
|
18
|
+
/** pk_live_... ; tenant-resolved server-side (the keyless-fallback / anonymous-mode credential). */
|
|
19
|
+
readonly publishableKey: string;
|
|
20
|
+
/** REQUIRED via config or the EVERFUR_API_BASE_URL env var; the SDK ships no hardcoded host (INV-ORG-AGNOSTIC). */
|
|
21
|
+
readonly apiBaseUrl?: string;
|
|
22
|
+
/** Sent as X-Everfur-Contract; server additive-only. */
|
|
23
|
+
readonly contractVersion?: string;
|
|
24
|
+
/** Non-secret durable KV; a token is NEVER written through it. In-memory fallback when absent. */
|
|
25
|
+
readonly storage?: KvPort;
|
|
26
|
+
/** Opt-in encrypted storage, the ONLY port a token may cross to disk. Omit for memory-only tokens. */
|
|
27
|
+
readonly secureStore?: SecureStorePort;
|
|
28
|
+
/** Analytics sink; the SDK never imports PostHog/Sentry. No-op default. */
|
|
29
|
+
readonly telemetry?: TelemetryPort;
|
|
30
|
+
/** Receives ALREADY-redacted structured log records. */
|
|
31
|
+
readonly logSink?: LogSink;
|
|
32
|
+
/** Recovery decisions the host can override; a default policy is applied when absent. */
|
|
33
|
+
readonly errorPolicy?: ErrorPolicyPort;
|
|
34
|
+
/** Test seam; production builds the real transport from apiBaseUrl. */
|
|
35
|
+
readonly transport?: TransportPort;
|
|
36
|
+
/**
|
|
37
|
+
* Capture seam for video / photo (an rn adapter over the camera peer, a file input on the web). Absent =>
|
|
38
|
+
* capture-unavailable state, never a crash.
|
|
39
|
+
*/
|
|
40
|
+
readonly camera?: CameraPort;
|
|
41
|
+
/** Presigned-PUT seam for video / photo uploads. Absent => submits settle to a handled failure. */
|
|
42
|
+
readonly upload?: UploadPort;
|
|
43
|
+
/** S3-multipart seam for records document upload. Absent => records reads work, upload settles to a handled failure. */
|
|
44
|
+
readonly uploadTransport?: UploadTransport;
|
|
45
|
+
/** Platform image-cache seam for the animations fleet-wide epoch purge. Absent => the cosmetic purge no-ops. */
|
|
46
|
+
readonly imageCache?: ImageCachePort;
|
|
47
|
+
/** Structured, redacted LogPort events when true. */
|
|
48
|
+
readonly debug?: boolean;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Identity handed to the provider: the partner's opaque user id + a lazy token minter (SPEC-00 §4.3). The
|
|
52
|
+
* minter returns the token string, or `{ token, expiresAt }` so the SDK can re-mint before expiry.
|
|
53
|
+
*/
|
|
54
|
+
interface EverfurUser {
|
|
55
|
+
readonly userRef: UserRef;
|
|
56
|
+
readonly getToken: TokenProvider;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Imperative handle for non-hook callers (parity with the Flutter facade). Obtained via `useEverfur()`.
|
|
61
|
+
* Each verb re-scopes every open capability in ONE commit through the core runtime (SPEC-10 §3).
|
|
62
|
+
*/
|
|
63
|
+
interface EverfurHandle {
|
|
64
|
+
/** null => logout: drops the cached bearer and re-scopes every open capability. */
|
|
65
|
+
setUser(user: EverfurUser | null): void;
|
|
66
|
+
/** Re-scopes pet-bound controllers in the same commit. */
|
|
67
|
+
setActivePet(pet: PetRef | null): void;
|
|
68
|
+
/**
|
|
69
|
+
* Register (or update) the widget pet profile that records and consent assume exists. Without it, consent
|
|
70
|
+
* 404s for any pet the partner has not upserted out of band, so records is unreachable. Idempotent.
|
|
71
|
+
*/
|
|
72
|
+
registerPet: EverfurRuntime['registerPet'];
|
|
73
|
+
/** Change part of a registered pet's profile; `null` clears a field, an omitted field is unchanged. */
|
|
74
|
+
updatePet: EverfurRuntime['updatePet'];
|
|
75
|
+
/** Delete a pet profile; the server also retires the pet's Records data. */
|
|
76
|
+
deletePet: EverfurRuntime['deletePet'];
|
|
77
|
+
/**
|
|
78
|
+
* Permanently erase everything Everfur holds for the current user. Retryable on failure (a repeat resumes it).
|
|
79
|
+
* It does not sign out: call `logout()` afterwards.
|
|
80
|
+
*/
|
|
81
|
+
eraseUserData: EverfurRuntime['eraseUserData'];
|
|
82
|
+
/** Navigate / mount a prebuilt capability screen (host-routed via the runtime). */
|
|
83
|
+
open(capability: CapabilityName): void;
|
|
84
|
+
/**
|
|
85
|
+
* Warm up during your OWN login flow so the first Everfur surface mounts with nothing left to load: mints
|
|
86
|
+
* the session token, resolves the entitlement verdict and, with `petRef`, primes that pet's chat. Idempotent,
|
|
87
|
+
* coalescing, never throws; settles to a `PrepareResult` (`ready | partial | failed`, `durationMs`).
|
|
88
|
+
*/
|
|
89
|
+
prepare: EverfurRuntime['prepare'];
|
|
90
|
+
/**
|
|
91
|
+
* == setUser(null); additionally sweeps the SDK's genuinely per-user durable KV keys (the explicit
|
|
92
|
+
* PER_USER_KV_KEYS allowlist, EMPTY today; device-global keys are NOT swept). Returns a promise so a host
|
|
93
|
+
* can `await handle.logout()` before `setUser(nextUser)`.
|
|
94
|
+
*/
|
|
95
|
+
logout(): Promise<void>;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* The imperative facade handle for non-hook callers.
|
|
99
|
+
* @throws {EverfurConfigError} kind 'not-initialized' if called outside an EverfurProvider.
|
|
100
|
+
*/
|
|
101
|
+
declare function useEverfur(): EverfurHandle;
|
|
102
|
+
|
|
103
|
+
interface EverfurProviderProps {
|
|
104
|
+
readonly config: EverfurConfig;
|
|
105
|
+
/** Omit => general (anonymous) mode: pk alone on the wire. */
|
|
106
|
+
readonly user?: EverfurUser;
|
|
107
|
+
/** Optional default pet scope for capability hooks. */
|
|
108
|
+
readonly activePet?: PetRef;
|
|
109
|
+
readonly theme?: EverfurThemeInput;
|
|
110
|
+
/**
|
|
111
|
+
* `'onMount'`: the provider runs `handle.prepare({ petRef: activePet })` itself when it mounts and again
|
|
112
|
+
* whenever the user or active pet changes. `'manual'` (the default) issues nothing; call `prepare()` from
|
|
113
|
+
* your own login flow instead.
|
|
114
|
+
*/
|
|
115
|
+
readonly warmUp?: 'onMount' | 'manual';
|
|
116
|
+
readonly children: ReactNode;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Read the resolved verdict for a coarse capability.
|
|
121
|
+
*
|
|
122
|
+
* While the scope's FIRST verdict is being fetched the store reports `isPending`, and a capability the
|
|
123
|
+
* compiled floor leaves undecided (records: no key on the floor) reads `{ enabled:false, isPending:true }`,
|
|
124
|
+
* so its gate shows a skeleton rather than the fail-closed off-state it would have to retract when the
|
|
125
|
+
* verdict lands. A capability the floor already decides (chat, granted) renders at once: the fetch never
|
|
126
|
+
* adds a loading step to it. Once the fetch settles, whatever it settled to, nothing pends: a failure keeps
|
|
127
|
+
* the floor (fail-closed) and a verdict `prepare()` resolved before mount is read on the first render. A
|
|
128
|
+
* kill-switch flip propagates through the store's revision poller and re-renders every subscriber in <2s.
|
|
129
|
+
* Never throws for a resolution failure (an absent key reads as denied).
|
|
130
|
+
*/
|
|
131
|
+
declare function useCapability(name: CapabilityName): CapabilityDecision;
|
|
132
|
+
|
|
133
|
+
/** The profile state a partner screen renders from. */
|
|
134
|
+
interface UseEverfurPetProfileState {
|
|
135
|
+
/** The pet and its health profile, or null before the read lands, on a failure, or with no pet. */
|
|
136
|
+
readonly profile: WidgetPetProfile | null;
|
|
137
|
+
/** True while a read is in flight. */
|
|
138
|
+
readonly loading: boolean;
|
|
139
|
+
/** The last read's settled error (`error.displayMessage` is safe to show), or null. */
|
|
140
|
+
readonly error: EverfurError | null;
|
|
141
|
+
/** Read the profile again (after a write, or a retry). Settles; never throws. */
|
|
142
|
+
refresh(): Promise<void>;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Read one pet with its health profile: the health scalars, the lists your integration wrote (with your refs) and
|
|
146
|
+
* `profileVersion`. Pass null to read nothing.
|
|
147
|
+
*
|
|
148
|
+
* @throws {EverfurConfigError} kind 'not-initialized' if called outside an EverfurProvider.
|
|
149
|
+
*/
|
|
150
|
+
declare function useEverfurPetProfile(petRef: PetRef | null): UseEverfurPetProfileState;
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Read the resolved Everfur theme. Returns a COMPLETE, legible, deeply-frozen theme in every case - inside a
|
|
154
|
+
* provider it is the server-resolved theme; outside one it is the compiled Everfur default (never null, never
|
|
155
|
+
* blank). Read a token as `theme.color.brand`, `theme.space.md`, `theme.type.size.body`, `theme.radius.lg`.
|
|
156
|
+
*/
|
|
157
|
+
declare function useEverfurTheme(): EverfurTheme;
|
|
158
|
+
|
|
159
|
+
export { type EverfurProviderProps as E, type UseEverfurPetProfileState as U, type EverfurConfig as a, type EverfurHandle as b, type EverfurUser as c, useEverfur as d, useEverfurPetProfile as e, useEverfurTheme as f, useCapability as u };
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { U as UserRef, P as PetRef } from './ids-B2GAAifq.js';
|
|
3
|
+
import { C as CapabilityName, a as CapabilityDecision } from './resolve-D4Ywz5OS.js';
|
|
4
|
+
import { T as TokenProvider } from './identity-CEi9GRFZ.js';
|
|
5
|
+
import { T as TransportPort } from './config-C7eb_IMD.js';
|
|
6
|
+
import { K as KvPort, I as ImageCachePort } from './cacheEpoch-DknKn3S0.js';
|
|
7
|
+
import { S as SecureStorePort, b as LogSink, e as EverfurRuntime } from './runtimeTypes-w5KqBMcs.js';
|
|
8
|
+
import { T as TelemetryPort } from './TelemetryPort-BDNr00hu.js';
|
|
9
|
+
import { E as ErrorPolicyPort } from './ErrorPolicyPort-CwbfmxzJ.js';
|
|
10
|
+
import { C as CameraPort } from './CameraPort-Cv31Pz7g.js';
|
|
11
|
+
import { U as UploadTransport } from './ports-BN6RHF9W.js';
|
|
12
|
+
import { U as UploadPort } from './ports-D7YW8qz9.js';
|
|
13
|
+
import { E as EverfurThemeInput, a as EverfurTheme } from './branding-CsRdeNwK.js';
|
|
14
|
+
import { E as EverfurError } from './EverfurResult-DN9pL2Ab.js';
|
|
15
|
+
import { b as WidgetPetProfile } from './petsRepository-Bk6GDwLs.js';
|
|
16
|
+
|
|
17
|
+
interface EverfurConfig {
|
|
18
|
+
/** pk_live_... ; tenant-resolved server-side (the keyless-fallback / anonymous-mode credential). */
|
|
19
|
+
readonly publishableKey: string;
|
|
20
|
+
/** REQUIRED via config or the EVERFUR_API_BASE_URL env var; the SDK ships no hardcoded host (INV-ORG-AGNOSTIC). */
|
|
21
|
+
readonly apiBaseUrl?: string;
|
|
22
|
+
/** Sent as X-Everfur-Contract; server additive-only. */
|
|
23
|
+
readonly contractVersion?: string;
|
|
24
|
+
/** Non-secret durable KV; a token is NEVER written through it. In-memory fallback when absent. */
|
|
25
|
+
readonly storage?: KvPort;
|
|
26
|
+
/** Opt-in encrypted storage, the ONLY port a token may cross to disk. Omit for memory-only tokens. */
|
|
27
|
+
readonly secureStore?: SecureStorePort;
|
|
28
|
+
/** Analytics sink; the SDK never imports PostHog/Sentry. No-op default. */
|
|
29
|
+
readonly telemetry?: TelemetryPort;
|
|
30
|
+
/** Receives ALREADY-redacted structured log records. */
|
|
31
|
+
readonly logSink?: LogSink;
|
|
32
|
+
/** Recovery decisions the host can override; a default policy is applied when absent. */
|
|
33
|
+
readonly errorPolicy?: ErrorPolicyPort;
|
|
34
|
+
/** Test seam; production builds the real transport from apiBaseUrl. */
|
|
35
|
+
readonly transport?: TransportPort;
|
|
36
|
+
/**
|
|
37
|
+
* Capture seam for video / photo (an rn adapter over the camera peer, a file input on the web). Absent =>
|
|
38
|
+
* capture-unavailable state, never a crash.
|
|
39
|
+
*/
|
|
40
|
+
readonly camera?: CameraPort;
|
|
41
|
+
/** Presigned-PUT seam for video / photo uploads. Absent => submits settle to a handled failure. */
|
|
42
|
+
readonly upload?: UploadPort;
|
|
43
|
+
/** S3-multipart seam for records document upload. Absent => records reads work, upload settles to a handled failure. */
|
|
44
|
+
readonly uploadTransport?: UploadTransport;
|
|
45
|
+
/** Platform image-cache seam for the animations fleet-wide epoch purge. Absent => the cosmetic purge no-ops. */
|
|
46
|
+
readonly imageCache?: ImageCachePort;
|
|
47
|
+
/** Structured, redacted LogPort events when true. */
|
|
48
|
+
readonly debug?: boolean;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Identity handed to the provider: the partner's opaque user id + a lazy token minter (SPEC-00 §4.3). The
|
|
52
|
+
* minter returns the token string, or `{ token, expiresAt }` so the SDK can re-mint before expiry.
|
|
53
|
+
*/
|
|
54
|
+
interface EverfurUser {
|
|
55
|
+
readonly userRef: UserRef;
|
|
56
|
+
readonly getToken: TokenProvider;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Imperative handle for non-hook callers (parity with the Flutter facade). Obtained via `useEverfur()`.
|
|
61
|
+
* Each verb re-scopes every open capability in ONE commit through the core runtime (SPEC-10 §3).
|
|
62
|
+
*/
|
|
63
|
+
interface EverfurHandle {
|
|
64
|
+
/** null => logout: drops the cached bearer and re-scopes every open capability. */
|
|
65
|
+
setUser(user: EverfurUser | null): void;
|
|
66
|
+
/** Re-scopes pet-bound controllers in the same commit. */
|
|
67
|
+
setActivePet(pet: PetRef | null): void;
|
|
68
|
+
/**
|
|
69
|
+
* Register (or update) the widget pet profile that records and consent assume exists. Without it, consent
|
|
70
|
+
* 404s for any pet the partner has not upserted out of band, so records is unreachable. Idempotent.
|
|
71
|
+
*/
|
|
72
|
+
registerPet: EverfurRuntime['registerPet'];
|
|
73
|
+
/** Change part of a registered pet's profile; `null` clears a field, an omitted field is unchanged. */
|
|
74
|
+
updatePet: EverfurRuntime['updatePet'];
|
|
75
|
+
/** Delete a pet profile; the server also retires the pet's Records data. */
|
|
76
|
+
deletePet: EverfurRuntime['deletePet'];
|
|
77
|
+
/**
|
|
78
|
+
* Permanently erase everything Everfur holds for the current user. Retryable on failure (a repeat resumes it).
|
|
79
|
+
* It does not sign out: call `logout()` afterwards.
|
|
80
|
+
*/
|
|
81
|
+
eraseUserData: EverfurRuntime['eraseUserData'];
|
|
82
|
+
/** Navigate / mount a prebuilt capability screen (host-routed via the runtime). */
|
|
83
|
+
open(capability: CapabilityName): void;
|
|
84
|
+
/**
|
|
85
|
+
* Warm up during your OWN login flow so the first Everfur surface mounts with nothing left to load: mints
|
|
86
|
+
* the session token, resolves the entitlement verdict and, with `petRef`, primes that pet's chat. Idempotent,
|
|
87
|
+
* coalescing, never throws; settles to a `PrepareResult` (`ready | partial | failed`, `durationMs`).
|
|
88
|
+
*/
|
|
89
|
+
prepare: EverfurRuntime['prepare'];
|
|
90
|
+
/**
|
|
91
|
+
* == setUser(null); additionally sweeps the SDK's genuinely per-user durable KV keys (the explicit
|
|
92
|
+
* PER_USER_KV_KEYS allowlist, EMPTY today; device-global keys are NOT swept). Returns a promise so a host
|
|
93
|
+
* can `await handle.logout()` before `setUser(nextUser)`.
|
|
94
|
+
*/
|
|
95
|
+
logout(): Promise<void>;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* The imperative facade handle for non-hook callers.
|
|
99
|
+
* @throws {EverfurConfigError} kind 'not-initialized' if called outside an EverfurProvider.
|
|
100
|
+
*/
|
|
101
|
+
declare function useEverfur(): EverfurHandle;
|
|
102
|
+
|
|
103
|
+
interface EverfurProviderProps {
|
|
104
|
+
readonly config: EverfurConfig;
|
|
105
|
+
/** Omit => general (anonymous) mode: pk alone on the wire. */
|
|
106
|
+
readonly user?: EverfurUser;
|
|
107
|
+
/** Optional default pet scope for capability hooks. */
|
|
108
|
+
readonly activePet?: PetRef;
|
|
109
|
+
readonly theme?: EverfurThemeInput;
|
|
110
|
+
/**
|
|
111
|
+
* `'onMount'`: the provider runs `handle.prepare({ petRef: activePet })` itself when it mounts and again
|
|
112
|
+
* whenever the user or active pet changes. `'manual'` (the default) issues nothing; call `prepare()` from
|
|
113
|
+
* your own login flow instead.
|
|
114
|
+
*/
|
|
115
|
+
readonly warmUp?: 'onMount' | 'manual';
|
|
116
|
+
readonly children: ReactNode;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Read the resolved verdict for a coarse capability.
|
|
121
|
+
*
|
|
122
|
+
* While the scope's FIRST verdict is being fetched the store reports `isPending`, and a capability the
|
|
123
|
+
* compiled floor leaves undecided (records: no key on the floor) reads `{ enabled:false, isPending:true }`,
|
|
124
|
+
* so its gate shows a skeleton rather than the fail-closed off-state it would have to retract when the
|
|
125
|
+
* verdict lands. A capability the floor already decides (chat, granted) renders at once: the fetch never
|
|
126
|
+
* adds a loading step to it. Once the fetch settles, whatever it settled to, nothing pends: a failure keeps
|
|
127
|
+
* the floor (fail-closed) and a verdict `prepare()` resolved before mount is read on the first render. A
|
|
128
|
+
* kill-switch flip propagates through the store's revision poller and re-renders every subscriber in <2s.
|
|
129
|
+
* Never throws for a resolution failure (an absent key reads as denied).
|
|
130
|
+
*/
|
|
131
|
+
declare function useCapability(name: CapabilityName): CapabilityDecision;
|
|
132
|
+
|
|
133
|
+
/** The profile state a partner screen renders from. */
|
|
134
|
+
interface UseEverfurPetProfileState {
|
|
135
|
+
/** The pet and its health profile, or null before the read lands, on a failure, or with no pet. */
|
|
136
|
+
readonly profile: WidgetPetProfile | null;
|
|
137
|
+
/** True while a read is in flight. */
|
|
138
|
+
readonly loading: boolean;
|
|
139
|
+
/** The last read's settled error (`error.displayMessage` is safe to show), or null. */
|
|
140
|
+
readonly error: EverfurError | null;
|
|
141
|
+
/** Read the profile again (after a write, or a retry). Settles; never throws. */
|
|
142
|
+
refresh(): Promise<void>;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Read one pet with its health profile: the health scalars, the lists your integration wrote (with your refs) and
|
|
146
|
+
* `profileVersion`. Pass null to read nothing.
|
|
147
|
+
*
|
|
148
|
+
* @throws {EverfurConfigError} kind 'not-initialized' if called outside an EverfurProvider.
|
|
149
|
+
*/
|
|
150
|
+
declare function useEverfurPetProfile(petRef: PetRef | null): UseEverfurPetProfileState;
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Read the resolved Everfur theme. Returns a COMPLETE, legible, deeply-frozen theme in every case - inside a
|
|
154
|
+
* provider it is the server-resolved theme; outside one it is the compiled Everfur default (never null, never
|
|
155
|
+
* blank). Read a token as `theme.color.brand`, `theme.space.md`, `theme.type.size.body`, `theme.radius.lg`.
|
|
156
|
+
*/
|
|
157
|
+
declare function useEverfurTheme(): EverfurTheme;
|
|
158
|
+
|
|
159
|
+
export { type EverfurProviderProps as E, type UseEverfurPetProfileState as U, type EverfurConfig as a, type EverfurHandle as b, type EverfurUser as c, useEverfur as d, useEverfurPetProfile as e, useEverfurTheme as f, useCapability as u };
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import { c as EverfurResult, E as EverfurError } from './EverfurResult-DN9pL2Ab.js';
|
|
2
|
+
import { R as RequestFunnel } from './requestFunnel-DFMGcluw.js';
|
|
3
|
+
import { A as AuthContext } from './identity-CEi9GRFZ.js';
|
|
4
|
+
import { U as UserRef } from './ids-B2GAAifq.js';
|
|
5
|
+
import { E as ErrorPolicyPort } from './ErrorPolicyPort-CwbfmxzJ.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* The consent scopes a member controls from an embedded surface: exactly the scopes a backend gate reads off
|
|
9
|
+
* this ledger. Declaration order is the order a surface lists them in.
|
|
10
|
+
*/
|
|
11
|
+
declare const EVERFUR_CONSENT_SCOPES: readonly ["transcript_exposure", "partner_context"];
|
|
12
|
+
/** One scope of the consent ledger. */
|
|
13
|
+
type EverfurConsentScope = (typeof EVERFUR_CONSENT_SCOPES)[number];
|
|
14
|
+
/** `consent_version: Field(None, max_length=64)` on the PUT body. */
|
|
15
|
+
declare const CONSENT_VERSION_MAX = 64;
|
|
16
|
+
/** True for a scope this SDK surfaces. `records_content` is deliberately NOT one; see the module header. */
|
|
17
|
+
declare function isEverfurConsentScope(value: unknown): value is EverfurConsentScope;
|
|
18
|
+
/**
|
|
19
|
+
* The resolved consent state for one scope, fail-closed.
|
|
20
|
+
*
|
|
21
|
+
* `granted` and `hasDecision` are not the same question, and a surface that conflates them is a dark
|
|
22
|
+
* pattern. `hasDecision: false` means nobody has asked yet, which is the state that should raise the
|
|
23
|
+
* prompt. `granted: false` with `hasDecision: true` means the member said no, and asking again is nagging.
|
|
24
|
+
*/
|
|
25
|
+
interface EverfurConsentVerdict {
|
|
26
|
+
readonly scope: EverfurConsentScope;
|
|
27
|
+
readonly granted: boolean;
|
|
28
|
+
readonly hasDecision: boolean;
|
|
29
|
+
/** The policy version in force when the decision was recorded, or null when there is none. */
|
|
30
|
+
readonly consentVersion: string | null;
|
|
31
|
+
/** Who authored the decision, as the server recorded it (`end_user` or `system`), or null. */
|
|
32
|
+
readonly actor: string | null;
|
|
33
|
+
/** ISO 8601, or null when there is no decision on record. */
|
|
34
|
+
readonly recordedAt: string | null;
|
|
35
|
+
}
|
|
36
|
+
/** One decision to append: the scope, whether it is a grant or a withdrawal, and the version shown. */
|
|
37
|
+
interface EverfurConsentDecision {
|
|
38
|
+
readonly scope: EverfurConsentScope;
|
|
39
|
+
/** `true` to grant, `false` to withdraw. A withdrawal is the same route, never a harder path. */
|
|
40
|
+
readonly granted: boolean;
|
|
41
|
+
/** The version of the consent text the member was shown; the server defaults it when omitted. */
|
|
42
|
+
readonly consentVersion?: string;
|
|
43
|
+
}
|
|
44
|
+
interface ConsentRepository {
|
|
45
|
+
/**
|
|
46
|
+
* `GET /widget/v1/consent?scope=...` - the current verdict for the signed-in member. Settles
|
|
47
|
+
* `ok(EverfurConsentVerdict)` on 200 and `err(EverfurError)` otherwise. Never throws.
|
|
48
|
+
*/
|
|
49
|
+
read(scope: EverfurConsentScope, opts?: {
|
|
50
|
+
readonly signal?: AbortSignal;
|
|
51
|
+
}): Promise<EverfurResult<EverfurConsentVerdict>>;
|
|
52
|
+
/**
|
|
53
|
+
* `PUT /widget/v1/consent` - append a grant or a withdrawal. The actor is fixed server-side to the
|
|
54
|
+
* authenticated member, so nothing here sends one. Settles `ok(EverfurConsentVerdict)`; never throws.
|
|
55
|
+
*/
|
|
56
|
+
write(decision: EverfurConsentDecision, opts?: {
|
|
57
|
+
readonly signal?: AbortSignal;
|
|
58
|
+
}): Promise<EverfurResult<EverfurConsentVerdict>>;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* The part of the runtime this repository needs: the current auth at call time, the partner's error policy,
|
|
62
|
+
* and whether the runtime is gone. `useEverfurContext().runtime` satisfies it; the narrow shape keeps this
|
|
63
|
+
* subpath's public types down to what it reads.
|
|
64
|
+
*/
|
|
65
|
+
interface ConsentRuntime {
|
|
66
|
+
readonly isDisposed: boolean;
|
|
67
|
+
readonly registry: {
|
|
68
|
+
readonly services: {
|
|
69
|
+
authFor(userRef: UserRef | null): AuthContext;
|
|
70
|
+
readonly errorPolicy: ErrorPolicyPort | undefined;
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
/** The lower seam: the repository over one already-built auth context, or an already-built funnel (tests). */
|
|
75
|
+
interface ConsentRepositoryDeps {
|
|
76
|
+
readonly auth: AuthContext;
|
|
77
|
+
readonly errorPolicy?: ErrorPolicyPort;
|
|
78
|
+
/** Internal test seam: an already-built funnel. */
|
|
79
|
+
readonly funnel?: RequestFunnel;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* The repository over the runtime under your provider (`useEverfurContext().runtime`). Auth is read at CALL
|
|
83
|
+
* time, so one repository serves every sign-in, and a disposed runtime settles every verb without a request.
|
|
84
|
+
*/
|
|
85
|
+
declare function createConsentRepository(runtime: ConsentRuntime): ConsentRepository;
|
|
86
|
+
/** The same repository over one auth context (or an injected funnel). Internal seam, for deterministic tests. */
|
|
87
|
+
declare function createConsentRepositoryOver(deps: ConsentRepositoryDeps): ConsentRepository;
|
|
88
|
+
|
|
89
|
+
/** `signed_out`: no member on the provider. `failed`: every scope's read was refused; `refresh()` retries. */
|
|
90
|
+
type EverfurConsentStatus = 'signed_out' | 'loading' | 'ready' | 'failed';
|
|
91
|
+
/** One scope's state, as a surface renders it. */
|
|
92
|
+
interface EverfurConsentScopeState {
|
|
93
|
+
readonly scope: EverfurConsentScope;
|
|
94
|
+
/** The member's current answer. Fail-closed: false until the server says otherwise. */
|
|
95
|
+
readonly granted: boolean;
|
|
96
|
+
/**
|
|
97
|
+
* Whether anyone has asked yet. `false` is the PROMPT state; `granted: false` with `hasDecision: true` is a
|
|
98
|
+
* refusal on record, and asking again is nagging.
|
|
99
|
+
*/
|
|
100
|
+
readonly hasDecision: boolean;
|
|
101
|
+
/** The policy version in force when the decision was recorded, or null. */
|
|
102
|
+
readonly consentVersion: string | null;
|
|
103
|
+
/** ISO 8601, or null when there is no decision on record. */
|
|
104
|
+
readonly recordedAt: string | null;
|
|
105
|
+
/**
|
|
106
|
+
* Whether the verdict above came back from the server. False means this scope has NO answer on record
|
|
107
|
+
* here: either its read has not settled or its read was refused (`error` says which). It is not the same
|
|
108
|
+
* question as `hasDecision`, which is about the member; this one is about us.
|
|
109
|
+
*/
|
|
110
|
+
readonly loaded: boolean;
|
|
111
|
+
/** True while THIS scope's write is in flight. The other scopes stay usable. */
|
|
112
|
+
readonly saving: boolean;
|
|
113
|
+
/** This scope's last read or write failure, or null. `error.displayMessage` is safe to show. */
|
|
114
|
+
readonly error: EverfurError | null;
|
|
115
|
+
}
|
|
116
|
+
/** What the hook reads. Omit it and every scope this SDK surfaces is read. */
|
|
117
|
+
interface EverfurConsentOptions {
|
|
118
|
+
/**
|
|
119
|
+
* Read only these scopes. A toggle that renders ONE act passes its own scope, so mounting two toggles is two
|
|
120
|
+
* reads rather than four. An unknown value is dropped; an empty result falls back to every scope.
|
|
121
|
+
*/
|
|
122
|
+
readonly scopes?: readonly EverfurConsentScope[];
|
|
123
|
+
}
|
|
124
|
+
interface EverfurConsentState {
|
|
125
|
+
readonly status: EverfurConsentStatus;
|
|
126
|
+
/** One entry per scope, in `EVERFUR_CONSENT_SCOPES` order. Empty only before the first read settles. */
|
|
127
|
+
readonly scopes: readonly EverfurConsentScopeState[];
|
|
128
|
+
/** The failure that made the whole read fail, or null. Per-scope failures hang off the scope. */
|
|
129
|
+
readonly error: EverfurError | null;
|
|
130
|
+
/**
|
|
131
|
+
* Grant or withdraw one scope. Optimistic: the switch flips now and rolls back if the wire refuses.
|
|
132
|
+
* Settles an `EverfurResult`; never throws.
|
|
133
|
+
*/
|
|
134
|
+
setConsent(scope: EverfurConsentScope, granted: boolean): Promise<EverfurResult<EverfurConsentVerdict>>;
|
|
135
|
+
/** Read every scope again (the way out of `failed`, and the way to pick up a decision made elsewhere). */
|
|
136
|
+
refresh(): Promise<void>;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* The consent repository bound to the runtime under your provider, for imperative callers (a settings screen
|
|
140
|
+
* that reads one scope without mounting the hook). Auth is read at call time, so one repository serves every
|
|
141
|
+
* sign-in.
|
|
142
|
+
*/
|
|
143
|
+
declare function useEverfurConsentRepository(): ConsentRepository;
|
|
144
|
+
/**
|
|
145
|
+
* Read the member's consent state for every scope this SDK surfaces, and let them change it. Mount it on the
|
|
146
|
+
* screen where a member manages their data; `EverfurConsentToggle` renders one scope of it on either host.
|
|
147
|
+
*/
|
|
148
|
+
declare function useEverfurConsent(options?: EverfurConsentOptions): EverfurConsentState;
|
|
149
|
+
|
|
150
|
+
/** What a band paints. `row` is the only state carrying a switch; every other state carries none. */
|
|
151
|
+
type ConsentRowView =
|
|
152
|
+
/** No member on the provider: a switch here could not write, so none is offered. */
|
|
153
|
+
{
|
|
154
|
+
readonly kind: 'signedOut';
|
|
155
|
+
}
|
|
156
|
+
/** The read has not settled yet. */
|
|
157
|
+
| {
|
|
158
|
+
readonly kind: 'loading';
|
|
159
|
+
}
|
|
160
|
+
/** This scope could not be READ, so there is no answer to show. `error.displayMessage` is the safe copy. */
|
|
161
|
+
| {
|
|
162
|
+
readonly kind: 'failed';
|
|
163
|
+
readonly error: EverfurError;
|
|
164
|
+
} | {
|
|
165
|
+
readonly kind: 'row';
|
|
166
|
+
readonly scope: EverfurConsentScope;
|
|
167
|
+
readonly granted: boolean;
|
|
168
|
+
/** false is the never-asked state: the switch is off and nothing claims the member answered. */
|
|
169
|
+
readonly hasDecision: boolean;
|
|
170
|
+
/** This scope's write is in flight: the switch shows the optimistic answer and takes no new tap. */
|
|
171
|
+
readonly saving: boolean;
|
|
172
|
+
/** The last WRITE's refusal, after the switch was rolled back, or null. The switch stays usable. */
|
|
173
|
+
readonly error: EverfurError | null;
|
|
174
|
+
};
|
|
175
|
+
/**
|
|
176
|
+
* The view for one scope of a consent state.
|
|
177
|
+
*
|
|
178
|
+
* A scope the state does not carry yet is `loading`, never an empty row: inventing an ungranted row for it
|
|
179
|
+
* would paint a consent answer nobody gave.
|
|
180
|
+
*/
|
|
181
|
+
declare function consentRowView(state: EverfurConsentState, scope: EverfurConsentScope): ConsentRowView;
|
|
182
|
+
|
|
183
|
+
/** One scope's row copy. `body` takes the partner's display name, the referent the member recognises. */
|
|
184
|
+
interface ConsentScopeCopy {
|
|
185
|
+
readonly title: string;
|
|
186
|
+
readonly body: (partner: string) => string;
|
|
187
|
+
}
|
|
188
|
+
declare const CONSENT_COPY: Readonly<{
|
|
189
|
+
loading: "Loading";
|
|
190
|
+
retry: "Try again";
|
|
191
|
+
signedOut: "Sign in required";
|
|
192
|
+
changeable: "You can change this at any time.";
|
|
193
|
+
saving: "Saving";
|
|
194
|
+
}>;
|
|
195
|
+
/** AUTHORED (2026-09-20), pending copy review. One entry per scope this SDK surfaces. */
|
|
196
|
+
declare const CONSENT_SCOPE_COPY: Readonly<Record<EverfurConsentScope, ConsentScopeCopy>>;
|
|
197
|
+
|
|
198
|
+
export { CONSENT_COPY as C, type EverfurConsentScope as E, CONSENT_SCOPE_COPY as a, CONSENT_VERSION_MAX as b, type ConsentRepository as c, type ConsentRepositoryDeps as d, type ConsentRowView as e, type ConsentRuntime as f, type ConsentScopeCopy as g, EVERFUR_CONSENT_SCOPES as h, type EverfurConsentDecision as i, type EverfurConsentOptions as j, type EverfurConsentScopeState as k, type EverfurConsentState as l, type EverfurConsentStatus as m, type EverfurConsentVerdict as n, consentRowView as o, createConsentRepository as p, createConsentRepositoryOver as q, isEverfurConsentScope as r, useEverfurConsentRepository as s, useEverfurConsent as u };
|