@everfur/sdk 0.1.1 → 0.3.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 +634 -0
- package/README.md +58 -23
- package/consent/package.json +8 -0
- package/dist/Chat-DPUD6dnc.d.cts +128 -0
- package/dist/Chat-DwAC2vhB.d.ts +128 -0
- package/dist/DepthViews-DNEM96Se.d.ts +16 -0
- package/dist/DepthViews-DP0R-DhB.d.cts +19 -0
- package/dist/DepthViews-D_3hl4xk.d.ts +19 -0
- package/dist/DepthViews-DbFhR4Du.d.cts +16 -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-5NeobOCd.d.ts +256 -0
- package/dist/attachments-Bw3iMQgu.d.ts +146 -0
- package/dist/attachments-CQgFrEQ7.d.cts +146 -0
- package/dist/attachments-D8T5re7e.d.cts +256 -0
- package/dist/casesRepository-ClLv6qMl.d.ts +188 -0
- package/dist/casesRepository-DHwtGRYY.d.cts +188 -0
- package/dist/chat/index.cjs +1 -1170
- package/dist/chat/index.d.cts +31 -53
- package/dist/chat/index.d.ts +31 -53
- package/dist/chat/index.js +1 -1167
- package/dist/client/index.cjs +9 -2315
- package/dist/client/index.d.cts +77 -15
- package/dist/client/index.d.ts +77 -15
- package/dist/client/index.js +9 -2215
- package/dist/{config-CiJ0PVBB.d.ts → config-CzTZGlfF.d.cts} +63 -25
- package/dist/{config-BSjBdxrZ.d.cts → config-DW60uRb9.d.ts} +63 -25
- 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-DXhqHlPU.d.ts +159 -0
- package/dist/context-XvTzq1tE.d.cts +159 -0
- package/dist/copy-Mjoo91aS.d.ts +198 -0
- package/dist/copy-bKDNigLb.d.cts +198 -0
- package/dist/core/index.cjs +13 -3178
- package/dist/core/index.d.cts +58 -12
- package/dist/core/index.d.ts +58 -12
- package/dist/core/index.js +13 -3166
- package/dist/depth-CErXCU8J.d.cts +502 -0
- package/dist/depth-DjDcJ6kH.d.ts +502 -0
- package/dist/entitlementRepository-DKdXFgTo.d.cts +698 -0
- package/dist/entitlementRepository-DSbzuyAW.d.ts +698 -0
- package/dist/{identity-DK9zORrG.d.ts → identity-BMx2SUOM.d.ts} +19 -6
- package/dist/{identity-Brl-lDd6.d.cts → identity-DI4eVx9S.d.cts} +19 -6
- 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 +29 -121
- package/dist/index.d.ts +29 -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/pets-CtQdRpWo.d.ts +92 -0
- package/dist/pets-aB8q0JyX.d.cts +92 -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-DEBzEhbp.d.cts +386 -0
- package/dist/ports-DMolTRzU.d.ts +386 -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-CjW7uDuA.d.ts +87 -0
- package/dist/requestFunnel-L-BQfi0z.d.cts +87 -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 → runtime-B8s-_hv8.d.cts} +121 -59
- package/dist/{runtime-BIYzf9cK.d.ts → runtime-BR9ysG0J.d.ts} +121 -59
- 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/index.cjs +1 -0
- package/dist/televet/index.d.cts +60 -0
- package/dist/televet/index.d.ts +60 -0
- package/dist/televet/index.js +1 -0
- package/dist/testing/index.cjs +5 -823
- package/dist/testing/index.d.cts +17 -3
- package/dist/testing/index.d.ts +17 -3
- package/dist/testing/index.js +5 -820
- package/dist/testing/rn/index.cjs +1 -449
- package/dist/testing/rn/index.d.cts +17 -29
- package/dist/testing/rn/index.d.ts +17 -29
- package/dist/testing/rn/index.js +1 -444
- package/dist/testing/web/index.cjs +1 -0
- package/dist/testing/web/index.d.cts +131 -0
- package/dist/testing/web/index.d.ts +131 -0
- package/dist/testing/web/index.js +1 -0
- package/dist/timelineRows-CaohZzXS.d.cts +19 -0
- package/dist/timelineRows-DZed6dAM.d.ts +19 -0
- package/dist/typeStyle-0TydiZ1w.d.cts +19 -0
- package/dist/typeStyle-CWMsoe6b.d.ts +19 -0
- package/dist/uploadTransport-D0M0T4hN.d.ts +38 -0
- package/dist/uploadTransport-DKJHs3Yj.d.cts +38 -0
- package/dist/useRecordsDepth-BHBzJ76R.d.cts +237 -0
- package/dist/useRecordsDepth-BU-OhzH6.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-C3qPIXGX.d.cts +310 -0
- package/dist/view-DtSPYpKa.d.ts +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 +217 -0
- package/dist/web/index.d.ts +217 -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 +194 -0
- package/dist/web/records/index.d.ts +194 -0
- package/dist/web/records/index.js +4 -0
- package/dist/web/televet/index.cjs +1 -0
- package/dist/web/televet/index.d.cts +50 -0
- package/dist/web/televet/index.d.ts +50 -0
- package/dist/web/televet/index.js +1 -0
- package/notifications/package.json +8 -0
- package/package.json +197 -9
- package/records/depth/package.json +8 -0
- package/server/events/device-blocked.cjs +15 -0
- package/server/events/package.json +9 -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/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,2 @@
|
|
|
1
|
+
'use strict';var react=require('react');var Ye=Object.defineProperty;var n=(e,r)=>Ye(e,"name",{value:r,configurable:true});function T(e,r){return Object.freeze(r===void 0?{ok:true,value:e}:{ok:true,value:e,warning:r})}n(T,"ok");function u(e){return Object.freeze({ok:false,error:e})}n(u,"err");var A=class A extends Error{constructor(r,t){super(t),this.name="EverfurConfigError",this.kind=r,Object.setPrototypeOf(this,A.prototype);}};n(A,"EverfurConfigError");var F=A;var q=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(q.map(e=>e.wireCode));var Ke=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"}),ie=Object.freeze(q.map(e=>Object.freeze({wireCode:e.wireCode,envelope:e.envelope,retryable:e.retryable,normalized:Ke[e.wireCode]}))),He=new Map(ie.map(e=>[e.envelope+e.wireCode.toUpperCase(),e])),We=Object.freeze(["http_envelope",...[...new Set(ie.map(e=>e.envelope))].filter(e=>e!=="http_envelope").sort()]);function D(e,r){if(typeof e!="string")return;let t=e.trim().toUpperCase();if(t.length!==0)for(let o of [r??"http_envelope",...We]){let i=He.get(o+t);if(i)return i}}n(D,"contractErrorFor");function Ge(e){return e.envelope==="sse_frame"?`/errors#sse-${e.wireCode}`:e.envelope==="oauth_error"?`/errors#oauth-${e.wireCode}`:`/errors#${e.wireCode}`}n(Ge,"contractDocUrl");function ae(e){return null}n(ae,"publishedDocUrl");var $e=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 se(e){return $e[e]}n(se,"categoryFor");function le(e){let r=D(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(le,"fromWire");var Qe=new Set(["streamTimeout","rateLimited","internalError","upstreamLlmTimeout","streamIncomplete"]);function V(e){return Qe.has(e)}n(V,"isAutoRetryable");var Xe=new Set(["serviceUnavailable","conflict","idempotencyInFlight"]);function ue(e){return V(e)||Xe.has(e)}n(ue,"isRetryableCode");var Je=500,B=8e3,de=4;function ce(e,r=Math.random){let t=Math.max(0,e),o=Math.min(Je*2**t,B);return Math.floor(r()*o)}n(ce,"backoffDelayMs");var Ze=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 Ze[e]}n(er,"userFacingError");function fe(e,r,t){Object.defineProperty(e,r,{value:t,enumerable:false,writable:false,configurable:false});}n(fe,"defineHidden");var rr=/^[a-z][a-z0-9_]{0,63}$/;function _(e,r){let t=D(r?.wireCode,r?.wireEnvelope),o={code:e,category:se(e),retryable:r?.retryable??ue(e),displayMessage:er(e)};if(r?.httpStatus!==void 0&&(o.httpStatus=r.httpStatus),r?.requestId&&(o.requestId=r.requestId),typeof r?.reasonCode=="string"&&rr.test(r.reasonCode)&&(o.reasonCode=r.reasonCode),t);return r?.wireMessage&&fe(o,"wireMessage",r.wireMessage),r?.raw!==void 0&&r.raw!==null&&fe(o,"raw",r.raw),Object.freeze(o)}n(_,"makeEverfurError");function pe(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(pe,"errorFrame");function or(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(or,"authHeaders");function x(e,r){return {...e,headers:{...ir(e.headers),...or(r)}}}n(x,"withAuthHeaders");function ir(e){if(!e)return {};let r={};for(let[t,o]of Object.entries(e)){let i=t.toLowerCase();i==="authorization"||i==="x-everfur-partner-key"||(r[t]=o);}return r}n(ir,"stripAuthHeaders");async function ye(e,r){if(r.mode==="anonymous")return r.transport.request(x(e,{mode:"anonymous",publishableKey:r.publishableKey,userRef:r.userRef,...r.sessionId?{sessionId:r.sessionId}:{}}));let t;try{t=await r.identity.currentToken();}catch{return u(Y())}let o=await r.transport.request(x(e,{mode:"personalized",token:t,userRef:r.userRef,...r.sessionId?{sessionId:r.sessionId}:{}}));if(o.ok||o.error.httpStatus!==401)return o;let i;try{i=await r.identity.currentToken({forceRefresh:!0});}catch{return u(Y())}let a=await r.transport.request(x(e,{mode:"personalized",token:i,userRef:r.userRef,...r.sessionId?{sessionId:r.sessionId}:{}}));return !a.ok&&a.error.httpStatus===401?u(Y(a.error.httpStatus)):a}n(ye,"authedSend");function Y(e){return _("authRejected",{retryable:false,...e!==void 0?{httpStatus:e}:{}})}n(Y,"authRejectedError");function ve(e){return _("internalError",{retryable:true,wireMessage:ar(e)})}n(ve,"networkError");function ar(e){return e instanceof Error?e.message:typeof e=="string"?e:"network request failed"}n(ar,"describeCause");var sr=3e4,lr=B*2,ur="idempotency-key",dr=new Set(["POST","PUT","PATCH","DELETE"]),cr=Object.freeze({onEvent(){}}),fr=Object.freeze({setTimeout:n((e,r)=>setTimeout(e,r),"setTimeout"),clearTimeout:n(e=>clearTimeout(e),"clearTimeout"),now:n(()=>Date.now(),"now")});function j(e){let r=e.observer??cr,t=e.timers??fr,o=e.rng??Math.random,i=e.sleep??((y,c)=>Tr(y,t,c)),a=e.maxAttempts??de,s=e.unaryTimeoutMs??sr,l=e.newIdempotencyKey??yr(),d=n(y=>{try{r.onEvent(y);}catch{}},"emit");async function h(y,c,C){let S=C?.maxAttempts,P=Math.max(1,S??a),f=C?.idempotent??dr.has(c.method)?l():null,p=pr(c,f),v=0;for(;;){let E=n(L=>Object.freeze({call:y,method:c.method,path:c.path,attempt:v,...f?{idempotencyKey:f}:{},...L}),"stamp");d(E({phase:"attempt"}));let te=wr(s,t),ne=Cr(te.signal,c.signal),O;try{O=await ye({...p,signal:ne.signal},e.auth);}catch(L){O=u(ve(L));}finally{ne.dispose(),te.cancel();}if(O.ok)return d(E({phase:"settled",ok:true,reason:"ok"})),O;let R=O.error,N=mr(R,v,{maxAttempts:P,rng:o,now:t.now(),aborted:c.signal?.aborted===true,...S!==void 0?{perCallMaxAttempts:S}:{},...e.errorPolicy!==void 0?{policy:e.errorPolicy}:{}}),U={ok:false,code:R.code,reason:N.reason,...R.httpStatus!==void 0?{httpStatus:R.httpStatus}:{},...R.requestId!==void 0?{requestId:R.requestId}:{}};if(!N.retry)return d(E({phase:"settled",...U})),u(R);if(d(E({phase:"retry",...U,delayMs:N.delayMs})),await i(N.delayMs,c.signal),c.signal?.aborted===true)return d(E({phase:"settled",...U,reason:"aborted"})),u(R);v+=1;}}n(h,"send");async function w(y){return x(y,await Rr(e.auth))}n(w,"authorize");async function*g(y,c,C){d(Object.freeze({call:y,phase:"stream.open",method:c.method,path:c.path,attempt:0}));try{yield*e.auth.transport.stream(c,C);}catch{yield pe({code:"internal_error",retryable:true,wireMessage:null,synthesized:true,lastEventId:null,serverRequestId:null});}}return n(g,"stream"),Object.freeze({send:h,authorize:w,stream:g})}n(j,"createRequestFunnel");function pr(e,r){let t={};for(let[o,i]of Object.entries(e.headers??{}))o.toLowerCase()!==ur&&(t[o]=i);return r!==null&&(t["Idempotency-Key"]=r),{...e,headers:t}}n(pr,"assembleHeaders");function yr(){let e=0;return ()=>`efk_${Date.now().toString(36)}_${(e++).toString(36)}_${Math.random().toString(36).slice(2,12)}`}n(yr,"defaultIdempotencyKeyFactory");var vr=10;function mr(e,r,t){if(t.aborted)return {retry:false,reason:"aborted"};let o=Er(e);if(o==="quota")return {retry:false,reason:"daily-quota-exhausted"};if(o!=="burst"&&!V(e.code))return {retry:false,reason:"terminal-code"};let i=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 s=n(()=>{if(t.policy===void 0)return null;let h;try{h=t.policy.maxAttempts(e.code);}catch{return null}return typeof h!="number"||!Number.isFinite(h)?null:Math.max(1,Math.min(vr,Math.floor(h)))},"policyCeiling"),l=t.perCallMaxAttempts??s()??t.maxAttempts;if(r+1>=l)return {retry:false,reason:"attempts-exhausted"};let d=_r(e,t.now);return d!==null?d>lr?{retry:false,reason:"server-reset-beyond-budget"}:{retry:true,reason:i,delayMs:d}:{retry:true,reason:i,delayMs:ce(r,t.rng)}}n(mr,"decideRetry");function Er(e){let r=e.code==="unknown"?le(br(e.raw)):e.code;return r==="quotaExceeded"?"quota":r==="rateLimited"||e.httpStatus===429?"burst":null}n(Er,"throttleKind");function _r(e,r){let t=gr(e.raw);if(t===null)return null;let o=t-r;return o>0?o:0}n(_r,"retryOverrideMs");function gr(e){for(let r of Ee(e)){let t=r.resets_at,o=hr(t);if(o!==null)return o}return null}n(gr,"findResetsAt");function Ee(e){if(!me(e))return [];let r=[e];for(let t of ["error","detail"]){let o=e[t];me(o)&&r.push(o);}return r}n(Ee,"candidateScopes");function hr(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(hr,"parseInstantMs");function br(e){for(let r of Ee(e)){let t=r.code;if(typeof t=="string"&&t.length>0)return t}return null}n(br,"rawWireCode");function me(e){return typeof e=="object"&&e!==null}n(me,"isRecord");async function Rr(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(Rr,"resolveDeviceAuth");function wr(e,r){let t=new AbortController,o=r.setTimeout(()=>t.abort(),e);return {signal:t.signal,cancel:n(()=>r.clearTimeout(o),"cancel")}}n(wr,"boundedSignal");function Cr(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 i=n(()=>o.abort(),"onAbort");return e.addEventListener("abort",i,{once:true}),r.addEventListener("abort",i,{once:true}),{signal:o.signal,dispose:n(()=>{e.removeEventListener("abort",i),r.removeEventListener("abort",i);},"dispose")}}n(Cr,"mergeSignals");function Tr(e,r,t){return e<=0||t?.aborted===true?Promise.resolve():new Promise(o=>{let i=r.setTimeout(()=>{t?.removeEventListener("abort",a),o();},e),a=n(()=>{r.clearTimeout(i),o();},"onAbort");t?.addEventListener("abort",a,{once:true});})}n(Tr,"delayAbortable");function Sr(e){let r=e.raw;if(typeof r!="object"||r===null)return null;let t=r.code;return typeof t=="string"&&t.length>0?t:null}n(Sr,"wireCodeOf");function _e(e,r){let t=Sr(e);if(t===null)return e;let o=r[t];return o===void 0?e:_(o.code,{retryable:o.retryable,...e.httpStatus!==void 0?{httpStatus:e.httpStatus}:{},...e.requestId!==void 0?{requestId:e.requestId}:{},wireCode:t,reasonCode:t,...e.wireMessage!==void 0?{wireMessage:e.wireMessage}:{},raw:e.raw})}n(_e,"foldWireReason");var we=Object.freeze({provider_unsupported:"Everfur does not send through this push provider yet. Register an Expo push token (provider expo) or an FCM registration token (provider fcm); APNs direct is not available in this version.",token_invalid:"The token is not a push token of the given provider. Expo tokens look like ExponentPushToken[...]; FCM registration tokens are long opaque strings. Pass the token exactly as your notification library printed it.",device_cipher_unavailable:"Everfur could not seal the token at rest, so nothing was stored. Retry the registration later; the SDK retries it on the next launch and login.",credentials_missing:"Everfur holds no push credential for this provider on your tenant, so deliveries to it are skipped. Expo needs nothing unless you enabled push security (then your Expo access token). A bare app using FCM supplies its Firebase service-account JSON to Everfur; push credentials are set by Everfur on your tenant, never through the SDK."}),Ir=new Set(["provider_unsupported","token_invalid","device_cipher_unavailable","credentials_missing"]);function kr(e){let r=e.reasonCode;return r!==void 0&&Ir.has(r)?we[r]:null}n(kr,"explainNotificationsReason");var Ce=new Set(["expo","fcm","apns"]),Te=new Set(["ios","android"]),ge=4096,he=128,be=64,Se=/[- ]/;function b(e,r){return _("validationFailed",{retryable:false,wireMessage:e,...r?{reasonCode:r}:{}})}n(b,"invalid");function Or(e){if(typeof e!="object"||e===null)return b("registerDevice needs an input object");let{token:r,provider:t,platform:o,installationId:i}=e;return typeof t!="string"||!Ce.has(t)?b("provider must be expo, fcm or apns"):typeof o!="string"||!Te.has(o)?b("platform must be ios or android"):typeof r!="string"||r.trim().length===0||r.length>ge||Se.test(r)?b(`token must be a push token of 1..${ge} characters with no whitespace`,"token_invalid"):i!==void 0&&(typeof i!="string"||i.length===0||i.length>he)?b(`installationId must be 1..${he} characters`):null}n(Or,"validateRegister");function Fr(e){return typeof e!="string"||e.length===0||e.length>be?b(`deviceId must be 1..${be} characters`):Se.test(e)||e.includes("/")||e==="."||e===".."?b("deviceId is not a device id"):null}n(Fr,"validateDeviceId");function xr(e){if(typeof e!="object"||e===null)return b("setPreferences needs an input object");let{pushEnabled:r,emailEnabled:t}=e;return typeof r!="boolean"||typeof t!="boolean"?b("pushEnabled and emailEnabled must both be booleans: the route replaces both switches"):null}n(xr,"validatePreferences");function I(e){return typeof e=="string"&&e.length>0?e:null}n(I,"str");function Pr(e){if(typeof e!="object"||e===null)return null;let r=e,t=I(r.device_id),o=I(r.provider),i=I(r.platform),a=I(r.registered_at),s=I(r.last_seen_at);if(t===null||o===null||i===null||a===null||s===null||!Ce.has(o)||!Te.has(i))return null;let l=r.installation_id;return Object.freeze({deviceId:t,provider:o,platform:i,installationId:typeof l=="string"&&l.length>0?l:null,registeredAt:a,lastSeenAt:s})}n(Pr,"parseDevice");function Nr(e){if(typeof e!="object"||e===null)return null;let r=e,t=I(r.updated_at);return typeof r.push_enabled!="boolean"||typeof r.email_enabled!="boolean"||t===null?null:Object.freeze({pushEnabled:r.push_enabled,emailEnabled:r.email_enabled,updatedAt:t})}n(Nr,"parsePreferences");function Re(e){return _("internalError",{retryable:false,wireMessage:`${e}: the response was not the documented shape`})}n(Re,"malformed");var Ar=Object.freeze({provider_unsupported:{code:"validationFailed",retryable:false},token_invalid:{code:"validationFailed",retryable:false},device_cipher_unavailable:{code:"serviceUnavailable",retryable:true}});function K(e){return _e(e,Ar)}n(K,"refine");function H(e){return _("validationFailed",{retryable:false,wireMessage:`the Everfur runtime is disposed; ${e} was called after unmount`})}n(H,"disposed");function W(e){let r=n(()=>{let{services:t}=e.registry;return G({auth:t.authFor(null),...t.errorPolicy?{errorPolicy:t.errorPolicy}:{}})},"over");return {registerDevice:n((t,o)=>e.isDisposed?Promise.resolve(u(H("registerDevice"))):r().registerDevice(t,o),"registerDevice"),unregisterDevice:n((t,o)=>e.isDisposed?Promise.resolve(u(H("unregisterDevice"))):r().unregisterDevice(t,o),"unregisterDevice"),setPreferences:n((t,o)=>e.isDisposed?Promise.resolve(u(H("setPreferences"))):r().setPreferences(t,o),"setPreferences")}}n(W,"createNotificationsClient");function G(e){let r=e.funnel??j({auth:e.auth,...e.errorPolicy?{errorPolicy:e.errorPolicy}:{}}),t=n((o,i)=>i?{...o,signal:i}:o,"withSignal");return {async registerDevice(o,i){let a=Or(o);if(a!==null)return u(a);let s={token:o.token,provider:o.provider,platform:o.platform};o.installationId!==void 0&&(s.installation_id=o.installationId);let l=await r.send("notifications.registerDevice",t({method:"POST",path:"/widget/v1/me/devices",body:s},i?.signal));if(!l.ok)return u(K(l.error));let d=Pr(l.value);return d===null?u(Re("registerDevice")):T(d)},async unregisterDevice(o,i){let a=Fr(o);if(a!==null)return u(a);let s=await r.send("notifications.unregisterDevice",t({method:"DELETE",path:`/widget/v1/me/devices/${encodeURIComponent(o)}`},i?.signal));return s.ok?T(void 0):u(K(s.error))},async setPreferences(o,i){let a=xr(o);if(a!==null)return u(a);let s=await r.send("notifications.setPreferences",t({method:"PUT",path:"/widget/v1/me/notification-preferences",body:{push_enabled:o.pushEnabled,email_enabled:o.emailEnabled}},i?.signal));if(!s.ok)return u(K(s.error));let l=Nr(s.value);return l===null?u(Re("setPreferences")):T(l)}}}n(G,"createNotificationsClientOver");var z="everfur.notifications.device";var Ie=Symbol.for("@everfur/sdk#EverfurContext@v1"),ke=globalThis,Oe=ke[Ie]??(ke[Ie]=react.createContext(null));Oe.displayName??="EverfurContext";function $(){let e=react.useContext(Oe);if(e===null)throw new F("not-initialized","Everfur hooks must be called inside <EverfurProvider>. Wrap your tree once, high.");return e}n($,"useEverfurContext");var De=1;async function X(e){try{let r=await e.getItem(z);if(r===null)return null;let t=JSON.parse(r);if(typeof t!="object"||t===null)return null;let{v:o,userRef:i,deviceId:a}=t;return o!==De||typeof i!="string"||typeof a!="string"||a.length===0?null:{userRef:i,deviceId:a}}catch{return null}}n(X,"readStored");async function Mr(e,r){try{await e.setItem(z,JSON.stringify({v:De,...r}));}catch{}}n(Mr,"writeStored");async function xe(e){try{await e.removeItem(z);}catch{}}n(xe,"clearStored");var Pe=Object.freeze({status:"signed_out",device:null,error:null}),Ne=Object.freeze({status:"no_token",device:null,error:null});function J(){return _("sessionRequired",{retryable:false,wireMessage:"notifications need a signed-in user on the provider"})}n(J,"noUser");function je(){let{runtime:e}=$();return react.useMemo(()=>W(e),[e])}n(je,"useEverfurNotificationsClient");function Ur(e){let{runtime:r,userRef:t}=$(),{token:o,provider:i,platform:a,installationId:s}=e,l=r.registry.services.kv,d=je(),[h,w]=react.useState(t===null?Pe:Ne),g=react.useRef(null),y=react.useRef(0);react.useEffect(()=>{if(y.current+=1,g.current=null,w(t===null?Pe:Ne),t===null)return;let m=true;return X(l).then(f=>{if(!m||f===null||f.userRef!==t)return;let p=g.current;if(p===null){g.current=f;return}p.deviceId!==f.deviceId&&d.unregisterDevice(f.deviceId);}),()=>{m=false;}},[d,l,t]);let c=react.useCallback(async(m,f)=>{let p=y.current+=1;w({status:"registering",device:null,error:null});let v=await d.registerDevice({token:f,provider:i,platform:a,...s===void 0?{}:{installationId:s}});if(p!==y.current)return v;if(!v.ok)return w({status:v.error.httpStatus===404?"unavailable":"failed",device:null,error:v.error}),v;let E=g.current;return g.current={userRef:m,deviceId:v.value.deviceId},w({status:"registered",device:v.value,error:null}),await Mr(l,g.current),E!==null&&E.userRef===m&&E.deviceId!==v.value.deviceId&&d.unregisterDevice(E.deviceId),v},[d,l,i,a,s]);react.useEffect(()=>{t===null||o===null||c(t,o);},[c,t,o]),react.useEffect(()=>r.onBeforeLogout(async({userRef:m,auth:f})=>{let p=g.current??await X(l);if(p===null||p.userRef!==m)return;g.current=null;let v=j({auth:f,maxAttempts:1,unaryTimeoutMs:3e3,...r.registry.services.errorPolicy?{errorPolicy:r.registry.services.errorPolicy}:{}}),E=await G({auth:f,funnel:v}).unregisterDevice(p.deviceId);(E.ok||E.error.httpStatus===404)&&await xe(l);}),[r,l]);let C=react.useCallback(async()=>t===null?u(J()):o===null?u(_("validationFailed",{retryable:false,reasonCode:"token_invalid",wireMessage:"no push token was given"})):c(t,o),[c,t,o]),S=react.useCallback(async()=>{if(t===null)return u(J());let m=g.current??await X(l);if(m===null||m.userRef!==t)return T(void 0);let f=y.current+=1,p=await d.unregisterDevice(m.deviceId);return p.ok||p.error.httpStatus===404?(g.current=null,await xe(l),f===y.current&&w({status:"unregistered",device:null,error:null}),p.ok?p:T(void 0)):p},[d,l,t]),P=react.useCallback(m=>t===null?Promise.resolve(u(J())):d.setPreferences(m),[d,t]);return react.useMemo(()=>({status:h.status,device:h.device,error:h.error,register:C,unregister:S,setPreferences:P}),[h,C,S,P])}n(Ur,"useEverfurNotifications");var ze=Object.freeze({"visit.booked":"visit","visit.reminder":"join","visit.rescheduled":"visit","visit.followup_sent":"messages","visit.message_received":"messages","visit.completed":"summary","visit.ended":"visit","visit.cancelled":null,"visit.no_show":null});function Me(e){return Object.prototype.hasOwnProperty.call(ze,e)?ze[e]:"visit"}n(Me,"vetVisitIntentForEvent");var Le=1,qe=Object.freeze(["record_request","pet","visit","case"]),Ve=Object.freeze(["record_request.updated","record.ready","pet.vaccination.due","visit.booked","visit.cancelled","visit.completed","visit.no_show","visit.rescheduled","visit.reminder","visit.followup_sent","visit.message_received","visit.ended","chat.follow_up_due","chat.reminder_due","record.activation"]),ee=["v","event_id","event_type","target"],Lr=new Set(["kind","conversation_id","request_id","visit_ref","case_ref","pet_ref"]),qr=new Set(Ve),Vr=new Set(qe),Br=128,Yr=4096,Kr=/^evt_[A-Za-z0-9]{1,64}$/,Hr=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,Wr=/[-]/;function k(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}n(k,"isRecord");function Be(e){return Object.keys(e)}n(Be,"keysOf");function Gr(e){if(k(e))return e;if(typeof e!="string"||e.length===0||e.length>Yr)return null;let r=JSON.parse(e);return k(r)?r:null}n(Gr,"decodeBlock");function $r(e,r){let t=e;for(let o of r){if(!k(t))return;t=t[o];}return t}n($r,"at");var Qr=[[],["data"],["request","content","data"],["notification","request","content","data"]];function Xr(e){if(!k(e))return null;for(let r of Qr){let t=$r(e,r);if(k(t)&&"everfur"in t)return t.everfur}return ee.every(r=>r in e)?e:null}n(Xr,"locateBlock");function re(e){return typeof e!="string"||e.length===0||e.length>Br||Wr.test(e)||e.includes("://")||e.toLowerCase().startsWith("everfur")?null:e}n(re,"opaqueString");function Ue(e,r){if(!(r in e))return {ok:true,value:null};let t=re(e[r]);return t===null?{ok:false}:{ok:true,value:t}}n(Ue,"optional");function Z(e,r){return r in e?re(e[r]):null}n(Z,"required");function Jr(e,r){if(!k(e))return null;let t=Be(e);if(!t.includes("kind")||t.some(s=>!Lr.has(s)))return null;let o=e.kind;if(typeof o!="string"||!Vr.has(o))return null;for(let s of t)if(s!=="kind"&&re(e[s])===null)return null;let i=Ue(e,"pet_ref");if(!i.ok)return null;let a=i.value;switch(o){case "record_request":{let s=Z(e,"request_id");return s===null?null:Object.freeze({kind:"record_request",requestId:s,petRef:a})}case "pet":return a===null?null:Object.freeze({kind:"pet",petRef:a});case "visit":{let s=Z(e,"visit_ref");return s===null?null:Object.freeze({kind:"visit",visitRef:s,petRef:a,intent:Me(r)})}case "case":{let s=Z(e,"case_ref");if(s===null)return null;let l=Ue(e,"conversation_id");return !l.ok||l.value!==null&&!Hr.test(l.value)?null:Object.freeze({kind:"case",caseRef:s,conversationId:l.value,petRef:a})}default:return null}}n(Jr,"parseTarget");function Zr(e){let r=Be(e);if(r.length!==ee.length||ee.some(a=>!r.includes(a))||e.v!==Le)return null;let t=e.event_id;if(typeof t!="string"||!Kr.test(t))return null;let o=e.event_type;if(typeof o!="string"||!qr.has(o))return null;let i=Jr(e.target,o);return i===null?null:Object.freeze({eventId:t,eventType:o,target:i})}n(Zr,"parseBlock");function et(e){try{let r=Gr(Xr(e));return r===null?null:Zr(r)}catch{return null}}n(et,"parseEverfurNotification");
|
|
2
|
+
exports.EVERFUR_NOTIFICATION_EVENT_TYPES=Ve;exports.EVERFUR_NOTIFICATION_TARGET_KINDS=qe;exports.EVERFUR_NOTIFICATION_VERSION=Le;exports.NOTIFICATIONS_REASON_MESSAGES=we;exports.createNotificationsClient=W;exports.explainNotificationsReason=kr;exports.parseEverfurNotification=et;exports.useEverfurNotifications=Ur;exports.useEverfurNotificationsClient=je;
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
import { c as EverfurResult, E as EverfurError } from '../../EverfurResult-DN9pL2Ab.cjs';
|
|
2
|
+
export { a as EverfurErrorCategory, b as EverfurErrorCode } from '../../EverfurResult-DN9pL2Ab.cjs';
|
|
3
|
+
import { E as ErrorPolicyPort } from '../../ErrorPolicyPort-CNf4uQZP.cjs';
|
|
4
|
+
import { A as AuthContext } from '../../identity-DI4eVx9S.cjs';
|
|
5
|
+
export { I as IdentityProvider, M as MintedToken, T as TokenProvider } from '../../identity-DI4eVx9S.cjs';
|
|
6
|
+
import { U as UserRef, R as RecordsRequestId, P as PetRef, C as ConversationId } from '../../ids-B2GAAifq.cjs';
|
|
7
|
+
export { B as Brand, _ as __brand } from '../../ids-B2GAAifq.cjs';
|
|
8
|
+
import { V as VetVisitIntent } from '../../visitIntent-D7_yVp1I.cjs';
|
|
9
|
+
export { A as AcceptedFrame, a as AnalysisCompleteFrame, b as AnalysisStartedFrame, D as DeltaFrame, c as DoneFrame, E as ErrorFrame, d as EverfurRequest, e as EverfurRequestBase, F as Frame, f as FrameBase, g as FrameKind, H as HeartbeatFrame, h as HttpMethod, M as MultipartBody, T as TransportPort, U as UnknownFrame, i as UrgencyLevel } from '../../config-CzTZGlfF.cjs';
|
|
10
|
+
|
|
11
|
+
/** The push providers the registration route accepts. `apns` is refused with `provider_unsupported` until APNs direct lands. */
|
|
12
|
+
type PushProvider = 'expo' | 'fcm' | 'apns';
|
|
13
|
+
/** The device platforms the registration route accepts. There is no web push in this version. */
|
|
14
|
+
type DevicePlatform = 'ios' | 'android';
|
|
15
|
+
/** What to register: the token your notification library obtained, which provider minted it, and which OS it is for. */
|
|
16
|
+
interface RegisterDeviceInput {
|
|
17
|
+
/**
|
|
18
|
+
* The push token as your library printed it: `ExponentPushToken[...]` from expo-notifications, or the FCM
|
|
19
|
+
* registration token from Firebase Messaging. Never an APNs device token in this version.
|
|
20
|
+
*/
|
|
21
|
+
readonly token: string;
|
|
22
|
+
readonly provider: PushProvider;
|
|
23
|
+
readonly platform: DevicePlatform;
|
|
24
|
+
/** Your own stable id for this install, if you keep one (1 to 128 characters). Echoed back, never interpreted. */
|
|
25
|
+
readonly installationId?: string;
|
|
26
|
+
}
|
|
27
|
+
/** The device row as Everfur stored it. The token itself is never echoed. */
|
|
28
|
+
interface RegisteredDevice {
|
|
29
|
+
/** Everfur's id for this device: pass it to `unregisterDevice` on sign-out. */
|
|
30
|
+
readonly deviceId: string;
|
|
31
|
+
readonly provider: PushProvider;
|
|
32
|
+
readonly platform: DevicePlatform;
|
|
33
|
+
readonly installationId: string | null;
|
|
34
|
+
/** ISO 8601. */
|
|
35
|
+
readonly registeredAt: string;
|
|
36
|
+
/** ISO 8601; refreshed by every registration of the same token. */
|
|
37
|
+
readonly lastSeenAt: string;
|
|
38
|
+
}
|
|
39
|
+
/** Both switches, always: the route is a replacement, not a patch. */
|
|
40
|
+
interface NotificationPreferencesInput {
|
|
41
|
+
readonly pushEnabled: boolean;
|
|
42
|
+
readonly emailEnabled: boolean;
|
|
43
|
+
}
|
|
44
|
+
/** The member's switches as Everfur stored them. */
|
|
45
|
+
interface NotificationPreferences {
|
|
46
|
+
readonly pushEnabled: boolean;
|
|
47
|
+
readonly emailEnabled: boolean;
|
|
48
|
+
/** ISO 8601. */
|
|
49
|
+
readonly updatedAt: string;
|
|
50
|
+
}
|
|
51
|
+
interface NotificationsClient {
|
|
52
|
+
/**
|
|
53
|
+
* `POST /widget/v1/me/devices`. Idempotent: the same token is the same device (its `lastSeenAt` moves), and a token
|
|
54
|
+
* another member of your tenant registered rebinds to the calling member. Settles `ok(RegisteredDevice)`;
|
|
55
|
+
* `validationFailed` with `reasonCode` `provider_unsupported` or `token_invalid`; `serviceUnavailable` with
|
|
56
|
+
* `reasonCode` `device_cipher_unavailable` (retry later); `rateLimited` above ten registrations a minute; the
|
|
57
|
+
* not-found error while notifications are not enabled for your tenant; `sessionRequired` for a publishable-key caller.
|
|
58
|
+
*/
|
|
59
|
+
registerDevice(input: RegisterDeviceInput, opts?: {
|
|
60
|
+
readonly signal?: AbortSignal;
|
|
61
|
+
}): Promise<EverfurResult<RegisteredDevice>>;
|
|
62
|
+
/**
|
|
63
|
+
* `DELETE /widget/v1/me/devices/{device_id}`. Settles `ok(undefined)` on 204; an unknown id and another member's
|
|
64
|
+
* device are the same not-found error.
|
|
65
|
+
*/
|
|
66
|
+
unregisterDevice(deviceId: string, opts?: {
|
|
67
|
+
readonly signal?: AbortSignal;
|
|
68
|
+
}): Promise<EverfurResult<void>>;
|
|
69
|
+
/** `PUT /widget/v1/me/notification-preferences`. Settles `ok(NotificationPreferences)`. */
|
|
70
|
+
setPreferences(input: NotificationPreferencesInput, opts?: {
|
|
71
|
+
readonly signal?: AbortSignal;
|
|
72
|
+
}): Promise<EverfurResult<NotificationPreferences>>;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* The part of the runtime this client needs: the current auth at call time, the partner's error policy, and whether
|
|
76
|
+
* the runtime is gone. `useEverfurContext().runtime` (any `EverfurRuntime`) satisfies it; the narrow shape keeps this
|
|
77
|
+
* subpath's public types to what it reads.
|
|
78
|
+
*/
|
|
79
|
+
interface NotificationsRuntime {
|
|
80
|
+
readonly isDisposed: boolean;
|
|
81
|
+
readonly registry: {
|
|
82
|
+
readonly services: {
|
|
83
|
+
authFor(userRef: UserRef | null): AuthContext;
|
|
84
|
+
readonly errorPolicy: ErrorPolicyPort | undefined;
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
/** The sub-reasons a notifications call, or a delivery, can carry as `EverfurError.reasonCode`. */
|
|
89
|
+
type NotificationsReasonCode = 'provider_unsupported' | 'token_invalid' | 'device_cipher_unavailable' | 'credentials_missing';
|
|
90
|
+
/**
|
|
91
|
+
* DEVELOPER-FACING explanations, one per reason. Log them, show them on a developer screen, never render them to a
|
|
92
|
+
* member: `displayMessage` is the copy a person sees. `credentials_missing` is not a route answer but the reason a
|
|
93
|
+
* delivery is skipped on Everfur's side (visible on the events API and in the partner console); it is here so one
|
|
94
|
+
* table explains every reason this surface can name.
|
|
95
|
+
*/
|
|
96
|
+
declare const NOTIFICATIONS_REASON_MESSAGES: Readonly<Record<NotificationsReasonCode, string>>;
|
|
97
|
+
/** The developer-facing sentence for an error's `reasonCode`, or null when it carries none this surface knows. */
|
|
98
|
+
declare function explainNotificationsReason(error: EverfurError): string | null;
|
|
99
|
+
/**
|
|
100
|
+
* The client over the runtime under your provider (`useEverfurContext().runtime`). Auth is read at call time, so the
|
|
101
|
+
* client can be built once and reused across sign-ins; a disposed runtime settles every verb without a request.
|
|
102
|
+
*/
|
|
103
|
+
declare function createNotificationsClient(runtime: NotificationsRuntime): NotificationsClient;
|
|
104
|
+
|
|
105
|
+
/** What the hook needs from you: the token your notification library obtained, or null until you have one. */
|
|
106
|
+
interface EverfurNotificationsOptions {
|
|
107
|
+
/**
|
|
108
|
+
* The push token as your library printed it (`ExponentPushToken[...]`, or an FCM registration token), or null
|
|
109
|
+
* while you do not have one (permission not asked, not granted, or the token not yet fetched). Nothing is
|
|
110
|
+
* registered without it; pass it as soon as you have it and the hook registers.
|
|
111
|
+
*/
|
|
112
|
+
readonly token: string | null;
|
|
113
|
+
/** `expo` for a token from expo-notifications, `fcm` for a Firebase registration token. */
|
|
114
|
+
readonly provider: PushProvider;
|
|
115
|
+
readonly platform: DevicePlatform;
|
|
116
|
+
/** Your own stable id for this install, if you keep one. */
|
|
117
|
+
readonly installationId?: string;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* `signed_out`: no signed-in user on the provider (nothing to register). `no_token`: a user, no token yet.
|
|
121
|
+
* `registering` / `registered` / `failed` / `unavailable`: the registration of the current token.
|
|
122
|
+
* `unavailable` is the dark tenant: notifications are not enabled for your client (the routes answer 404).
|
|
123
|
+
* `unregistered`: `unregister()` was called; `register()` registers again.
|
|
124
|
+
*/
|
|
125
|
+
type EverfurNotificationsStatus = 'signed_out' | 'no_token' | 'registering' | 'registered' | 'unavailable' | 'failed' | 'unregistered';
|
|
126
|
+
interface EverfurNotificationsState {
|
|
127
|
+
readonly status: EverfurNotificationsStatus;
|
|
128
|
+
/** The device Everfur registered for this install and user, or null. */
|
|
129
|
+
readonly device: RegisteredDevice | null;
|
|
130
|
+
/** The settled failure of the last registration, or null. `error.displayMessage` is safe to show. */
|
|
131
|
+
readonly error: EverfurError | null;
|
|
132
|
+
/** Register the current token now (a retry after `failed`, or after `unregister()`). Settles, never throws. */
|
|
133
|
+
register(): Promise<EverfurResult<RegisteredDevice>>;
|
|
134
|
+
/** Unregister this install's device for the signed-in user. Settles, never throws. */
|
|
135
|
+
unregister(): Promise<EverfurResult<void>>;
|
|
136
|
+
/** The member's push and email switches, both at once (`PUT /widget/v1/me/notification-preferences`). */
|
|
137
|
+
setPreferences(input: NotificationPreferencesInput): Promise<EverfurResult<NotificationPreferences>>;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* The notifications client bound to the runtime under your provider, for the imperative calls (`setPreferences`
|
|
141
|
+
* from a settings screen, say). Auth is read at call time, so one client serves every sign-in.
|
|
142
|
+
*/
|
|
143
|
+
declare function useEverfurNotificationsClient(): NotificationsClient;
|
|
144
|
+
/**
|
|
145
|
+
* Register this install's push token for the signed-in member, keep it registered as the token and the user
|
|
146
|
+
* change, and unregister it before sign-out. Call it once, high in the tree under `EverfurProvider`.
|
|
147
|
+
*/
|
|
148
|
+
declare function useEverfurNotifications(options: EverfurNotificationsOptions): EverfurNotificationsState;
|
|
149
|
+
|
|
150
|
+
/** The version of the routing block this release reads. */
|
|
151
|
+
declare const EVERFUR_NOTIFICATION_VERSION = 1;
|
|
152
|
+
/** The closed target kinds, in the backend's order (`partner_target.py` TARGET_KINDS). */
|
|
153
|
+
declare const EVERFUR_NOTIFICATION_TARGET_KINDS: readonly ["record_request", "pet", "visit", "case"];
|
|
154
|
+
/** One target kind. */
|
|
155
|
+
type EverfurNotificationTargetKind = (typeof EVERFUR_NOTIFICATION_TARGET_KINDS)[number];
|
|
156
|
+
/**
|
|
157
|
+
* The event types Everfur builds a push target for (`partner_target.py` TARGET_BUILDERS), in its order. The member
|
|
158
|
+
* events, the urgency verdict and the endpoint test event reach the partner's webhook only and never a device, and
|
|
159
|
+
* `visit.completed`, `visit.rescheduled` and `visit.ended` carry no consumer copy, so they are never pushed either;
|
|
160
|
+
* they are listed because the platform builds their target.
|
|
161
|
+
*/
|
|
162
|
+
declare const EVERFUR_NOTIFICATION_EVENT_TYPES: readonly ["record_request.updated", "record.ready", "pet.vaccination.due", "visit.booked", "visit.cancelled", "visit.completed", "visit.no_show", "visit.rescheduled", "visit.reminder", "visit.followup_sent", "visit.message_received", "visit.ended", "chat.follow_up_due", "chat.reminder_due", "record.activation"];
|
|
163
|
+
/** One pushed event type. */
|
|
164
|
+
type EverfurNotificationEventType = (typeof EVERFUR_NOTIFICATION_EVENT_TYPES)[number];
|
|
165
|
+
/** What a tapped notification is about, keyed on `kind`. The optional references are null when the push carried none. */
|
|
166
|
+
type EverfurNotificationTarget = {
|
|
167
|
+
/**
|
|
168
|
+
* A records request (`record_request.updated`, `record.ready`, and `record.activation`, which says what the
|
|
169
|
+
* request's parse found): open that request.
|
|
170
|
+
*/
|
|
171
|
+
readonly kind: 'record_request';
|
|
172
|
+
readonly requestId: RecordsRequestId;
|
|
173
|
+
readonly petRef: PetRef | null;
|
|
174
|
+
} | {
|
|
175
|
+
/** A pet: `pet.vaccination.due` opens that pet's records, `chat.reminder_due` that pet's chat. */
|
|
176
|
+
readonly kind: 'pet';
|
|
177
|
+
readonly petRef: PetRef;
|
|
178
|
+
} | {
|
|
179
|
+
/**
|
|
180
|
+
* A vet visit (`visit.*`): open that visit. `visitRef` is the partner visit reference the visit events carry.
|
|
181
|
+
* `intent` is what to open for it, derived from the event type with the consumer app's routing (the push
|
|
182
|
+
* itself carries none): `visit` for a booking or a change to it, `join` for a reminder, `messages` for the
|
|
183
|
+
* vet's reply or the follow-up, `summary` for a completed visit. Pass both to `useVetVisit().openVisit`.
|
|
184
|
+
* `null` for a cancelled or missed visit: there is nothing left to open, so route to a new booking.
|
|
185
|
+
*/
|
|
186
|
+
readonly kind: 'visit';
|
|
187
|
+
readonly visitRef: string;
|
|
188
|
+
readonly petRef: PetRef | null;
|
|
189
|
+
readonly intent: VetVisitIntent | null;
|
|
190
|
+
} | {
|
|
191
|
+
/** A follow-up case (`chat.follow_up_due`): open the conversation the check-in landed in. */
|
|
192
|
+
readonly kind: 'case';
|
|
193
|
+
readonly caseRef: string;
|
|
194
|
+
readonly conversationId: ConversationId | null;
|
|
195
|
+
readonly petRef: PetRef | null;
|
|
196
|
+
};
|
|
197
|
+
/** A parsed push: the event it announces and the thing to open. Frozen. */
|
|
198
|
+
interface EverfurNotification {
|
|
199
|
+
/** `evt_` plus the public event id, the same id the webhook envelope for this event carries. */
|
|
200
|
+
readonly eventId: string;
|
|
201
|
+
readonly eventType: EverfurNotificationEventType;
|
|
202
|
+
readonly target: EverfurNotificationTarget;
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Read the Everfur routing block out of a received push, or null when there is none or it is not one Everfur would
|
|
206
|
+
* send. Pure and total: it never throws, whatever it is handed.
|
|
207
|
+
*
|
|
208
|
+
* Pass the object your notification library gave you: an expo-notifications `Notification` or `NotificationResponse`,
|
|
209
|
+
* an FCM `RemoteMessage`, or its `data` map. Route on `target.kind`; `eventType` says why the push was sent.
|
|
210
|
+
*/
|
|
211
|
+
declare function parseEverfurNotification(payload: unknown): EverfurNotification | null;
|
|
212
|
+
|
|
213
|
+
export { AuthContext, ConversationId, type DevicePlatform, EVERFUR_NOTIFICATION_EVENT_TYPES, EVERFUR_NOTIFICATION_TARGET_KINDS, EVERFUR_NOTIFICATION_VERSION, ErrorPolicyPort, EverfurError, type EverfurNotification, type EverfurNotificationEventType, type EverfurNotificationTarget, type EverfurNotificationTargetKind, type EverfurNotificationsOptions, type EverfurNotificationsState, type EverfurNotificationsStatus, EverfurResult, NOTIFICATIONS_REASON_MESSAGES, type NotificationPreferences, type NotificationPreferencesInput, type NotificationsClient, type NotificationsReasonCode, type NotificationsRuntime, PetRef, type PushProvider, RecordsRequestId, type RegisterDeviceInput, type RegisteredDevice, UserRef, VetVisitIntent, createNotificationsClient, explainNotificationsReason, parseEverfurNotification, useEverfurNotifications, useEverfurNotificationsClient };
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
import { c as EverfurResult, E as EverfurError } from '../../EverfurResult-DN9pL2Ab.js';
|
|
2
|
+
export { a as EverfurErrorCategory, b as EverfurErrorCode } from '../../EverfurResult-DN9pL2Ab.js';
|
|
3
|
+
import { E as ErrorPolicyPort } from '../../ErrorPolicyPort-CwbfmxzJ.js';
|
|
4
|
+
import { A as AuthContext } from '../../identity-BMx2SUOM.js';
|
|
5
|
+
export { I as IdentityProvider, M as MintedToken, T as TokenProvider } from '../../identity-BMx2SUOM.js';
|
|
6
|
+
import { U as UserRef, R as RecordsRequestId, P as PetRef, C as ConversationId } from '../../ids-B2GAAifq.js';
|
|
7
|
+
export { B as Brand, _ as __brand } from '../../ids-B2GAAifq.js';
|
|
8
|
+
import { V as VetVisitIntent } from '../../visitIntent-D7_yVp1I.js';
|
|
9
|
+
export { A as AcceptedFrame, a as AnalysisCompleteFrame, b as AnalysisStartedFrame, D as DeltaFrame, c as DoneFrame, E as ErrorFrame, d as EverfurRequest, e as EverfurRequestBase, F as Frame, f as FrameBase, g as FrameKind, H as HeartbeatFrame, h as HttpMethod, M as MultipartBody, T as TransportPort, U as UnknownFrame, i as UrgencyLevel } from '../../config-DW60uRb9.js';
|
|
10
|
+
|
|
11
|
+
/** The push providers the registration route accepts. `apns` is refused with `provider_unsupported` until APNs direct lands. */
|
|
12
|
+
type PushProvider = 'expo' | 'fcm' | 'apns';
|
|
13
|
+
/** The device platforms the registration route accepts. There is no web push in this version. */
|
|
14
|
+
type DevicePlatform = 'ios' | 'android';
|
|
15
|
+
/** What to register: the token your notification library obtained, which provider minted it, and which OS it is for. */
|
|
16
|
+
interface RegisterDeviceInput {
|
|
17
|
+
/**
|
|
18
|
+
* The push token as your library printed it: `ExponentPushToken[...]` from expo-notifications, or the FCM
|
|
19
|
+
* registration token from Firebase Messaging. Never an APNs device token in this version.
|
|
20
|
+
*/
|
|
21
|
+
readonly token: string;
|
|
22
|
+
readonly provider: PushProvider;
|
|
23
|
+
readonly platform: DevicePlatform;
|
|
24
|
+
/** Your own stable id for this install, if you keep one (1 to 128 characters). Echoed back, never interpreted. */
|
|
25
|
+
readonly installationId?: string;
|
|
26
|
+
}
|
|
27
|
+
/** The device row as Everfur stored it. The token itself is never echoed. */
|
|
28
|
+
interface RegisteredDevice {
|
|
29
|
+
/** Everfur's id for this device: pass it to `unregisterDevice` on sign-out. */
|
|
30
|
+
readonly deviceId: string;
|
|
31
|
+
readonly provider: PushProvider;
|
|
32
|
+
readonly platform: DevicePlatform;
|
|
33
|
+
readonly installationId: string | null;
|
|
34
|
+
/** ISO 8601. */
|
|
35
|
+
readonly registeredAt: string;
|
|
36
|
+
/** ISO 8601; refreshed by every registration of the same token. */
|
|
37
|
+
readonly lastSeenAt: string;
|
|
38
|
+
}
|
|
39
|
+
/** Both switches, always: the route is a replacement, not a patch. */
|
|
40
|
+
interface NotificationPreferencesInput {
|
|
41
|
+
readonly pushEnabled: boolean;
|
|
42
|
+
readonly emailEnabled: boolean;
|
|
43
|
+
}
|
|
44
|
+
/** The member's switches as Everfur stored them. */
|
|
45
|
+
interface NotificationPreferences {
|
|
46
|
+
readonly pushEnabled: boolean;
|
|
47
|
+
readonly emailEnabled: boolean;
|
|
48
|
+
/** ISO 8601. */
|
|
49
|
+
readonly updatedAt: string;
|
|
50
|
+
}
|
|
51
|
+
interface NotificationsClient {
|
|
52
|
+
/**
|
|
53
|
+
* `POST /widget/v1/me/devices`. Idempotent: the same token is the same device (its `lastSeenAt` moves), and a token
|
|
54
|
+
* another member of your tenant registered rebinds to the calling member. Settles `ok(RegisteredDevice)`;
|
|
55
|
+
* `validationFailed` with `reasonCode` `provider_unsupported` or `token_invalid`; `serviceUnavailable` with
|
|
56
|
+
* `reasonCode` `device_cipher_unavailable` (retry later); `rateLimited` above ten registrations a minute; the
|
|
57
|
+
* not-found error while notifications are not enabled for your tenant; `sessionRequired` for a publishable-key caller.
|
|
58
|
+
*/
|
|
59
|
+
registerDevice(input: RegisterDeviceInput, opts?: {
|
|
60
|
+
readonly signal?: AbortSignal;
|
|
61
|
+
}): Promise<EverfurResult<RegisteredDevice>>;
|
|
62
|
+
/**
|
|
63
|
+
* `DELETE /widget/v1/me/devices/{device_id}`. Settles `ok(undefined)` on 204; an unknown id and another member's
|
|
64
|
+
* device are the same not-found error.
|
|
65
|
+
*/
|
|
66
|
+
unregisterDevice(deviceId: string, opts?: {
|
|
67
|
+
readonly signal?: AbortSignal;
|
|
68
|
+
}): Promise<EverfurResult<void>>;
|
|
69
|
+
/** `PUT /widget/v1/me/notification-preferences`. Settles `ok(NotificationPreferences)`. */
|
|
70
|
+
setPreferences(input: NotificationPreferencesInput, opts?: {
|
|
71
|
+
readonly signal?: AbortSignal;
|
|
72
|
+
}): Promise<EverfurResult<NotificationPreferences>>;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* The part of the runtime this client needs: the current auth at call time, the partner's error policy, and whether
|
|
76
|
+
* the runtime is gone. `useEverfurContext().runtime` (any `EverfurRuntime`) satisfies it; the narrow shape keeps this
|
|
77
|
+
* subpath's public types to what it reads.
|
|
78
|
+
*/
|
|
79
|
+
interface NotificationsRuntime {
|
|
80
|
+
readonly isDisposed: boolean;
|
|
81
|
+
readonly registry: {
|
|
82
|
+
readonly services: {
|
|
83
|
+
authFor(userRef: UserRef | null): AuthContext;
|
|
84
|
+
readonly errorPolicy: ErrorPolicyPort | undefined;
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
/** The sub-reasons a notifications call, or a delivery, can carry as `EverfurError.reasonCode`. */
|
|
89
|
+
type NotificationsReasonCode = 'provider_unsupported' | 'token_invalid' | 'device_cipher_unavailable' | 'credentials_missing';
|
|
90
|
+
/**
|
|
91
|
+
* DEVELOPER-FACING explanations, one per reason. Log them, show them on a developer screen, never render them to a
|
|
92
|
+
* member: `displayMessage` is the copy a person sees. `credentials_missing` is not a route answer but the reason a
|
|
93
|
+
* delivery is skipped on Everfur's side (visible on the events API and in the partner console); it is here so one
|
|
94
|
+
* table explains every reason this surface can name.
|
|
95
|
+
*/
|
|
96
|
+
declare const NOTIFICATIONS_REASON_MESSAGES: Readonly<Record<NotificationsReasonCode, string>>;
|
|
97
|
+
/** The developer-facing sentence for an error's `reasonCode`, or null when it carries none this surface knows. */
|
|
98
|
+
declare function explainNotificationsReason(error: EverfurError): string | null;
|
|
99
|
+
/**
|
|
100
|
+
* The client over the runtime under your provider (`useEverfurContext().runtime`). Auth is read at call time, so the
|
|
101
|
+
* client can be built once and reused across sign-ins; a disposed runtime settles every verb without a request.
|
|
102
|
+
*/
|
|
103
|
+
declare function createNotificationsClient(runtime: NotificationsRuntime): NotificationsClient;
|
|
104
|
+
|
|
105
|
+
/** What the hook needs from you: the token your notification library obtained, or null until you have one. */
|
|
106
|
+
interface EverfurNotificationsOptions {
|
|
107
|
+
/**
|
|
108
|
+
* The push token as your library printed it (`ExponentPushToken[...]`, or an FCM registration token), or null
|
|
109
|
+
* while you do not have one (permission not asked, not granted, or the token not yet fetched). Nothing is
|
|
110
|
+
* registered without it; pass it as soon as you have it and the hook registers.
|
|
111
|
+
*/
|
|
112
|
+
readonly token: string | null;
|
|
113
|
+
/** `expo` for a token from expo-notifications, `fcm` for a Firebase registration token. */
|
|
114
|
+
readonly provider: PushProvider;
|
|
115
|
+
readonly platform: DevicePlatform;
|
|
116
|
+
/** Your own stable id for this install, if you keep one. */
|
|
117
|
+
readonly installationId?: string;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* `signed_out`: no signed-in user on the provider (nothing to register). `no_token`: a user, no token yet.
|
|
121
|
+
* `registering` / `registered` / `failed` / `unavailable`: the registration of the current token.
|
|
122
|
+
* `unavailable` is the dark tenant: notifications are not enabled for your client (the routes answer 404).
|
|
123
|
+
* `unregistered`: `unregister()` was called; `register()` registers again.
|
|
124
|
+
*/
|
|
125
|
+
type EverfurNotificationsStatus = 'signed_out' | 'no_token' | 'registering' | 'registered' | 'unavailable' | 'failed' | 'unregistered';
|
|
126
|
+
interface EverfurNotificationsState {
|
|
127
|
+
readonly status: EverfurNotificationsStatus;
|
|
128
|
+
/** The device Everfur registered for this install and user, or null. */
|
|
129
|
+
readonly device: RegisteredDevice | null;
|
|
130
|
+
/** The settled failure of the last registration, or null. `error.displayMessage` is safe to show. */
|
|
131
|
+
readonly error: EverfurError | null;
|
|
132
|
+
/** Register the current token now (a retry after `failed`, or after `unregister()`). Settles, never throws. */
|
|
133
|
+
register(): Promise<EverfurResult<RegisteredDevice>>;
|
|
134
|
+
/** Unregister this install's device for the signed-in user. Settles, never throws. */
|
|
135
|
+
unregister(): Promise<EverfurResult<void>>;
|
|
136
|
+
/** The member's push and email switches, both at once (`PUT /widget/v1/me/notification-preferences`). */
|
|
137
|
+
setPreferences(input: NotificationPreferencesInput): Promise<EverfurResult<NotificationPreferences>>;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* The notifications client bound to the runtime under your provider, for the imperative calls (`setPreferences`
|
|
141
|
+
* from a settings screen, say). Auth is read at call time, so one client serves every sign-in.
|
|
142
|
+
*/
|
|
143
|
+
declare function useEverfurNotificationsClient(): NotificationsClient;
|
|
144
|
+
/**
|
|
145
|
+
* Register this install's push token for the signed-in member, keep it registered as the token and the user
|
|
146
|
+
* change, and unregister it before sign-out. Call it once, high in the tree under `EverfurProvider`.
|
|
147
|
+
*/
|
|
148
|
+
declare function useEverfurNotifications(options: EverfurNotificationsOptions): EverfurNotificationsState;
|
|
149
|
+
|
|
150
|
+
/** The version of the routing block this release reads. */
|
|
151
|
+
declare const EVERFUR_NOTIFICATION_VERSION = 1;
|
|
152
|
+
/** The closed target kinds, in the backend's order (`partner_target.py` TARGET_KINDS). */
|
|
153
|
+
declare const EVERFUR_NOTIFICATION_TARGET_KINDS: readonly ["record_request", "pet", "visit", "case"];
|
|
154
|
+
/** One target kind. */
|
|
155
|
+
type EverfurNotificationTargetKind = (typeof EVERFUR_NOTIFICATION_TARGET_KINDS)[number];
|
|
156
|
+
/**
|
|
157
|
+
* The event types Everfur builds a push target for (`partner_target.py` TARGET_BUILDERS), in its order. The member
|
|
158
|
+
* events, the urgency verdict and the endpoint test event reach the partner's webhook only and never a device, and
|
|
159
|
+
* `visit.completed`, `visit.rescheduled` and `visit.ended` carry no consumer copy, so they are never pushed either;
|
|
160
|
+
* they are listed because the platform builds their target.
|
|
161
|
+
*/
|
|
162
|
+
declare const EVERFUR_NOTIFICATION_EVENT_TYPES: readonly ["record_request.updated", "record.ready", "pet.vaccination.due", "visit.booked", "visit.cancelled", "visit.completed", "visit.no_show", "visit.rescheduled", "visit.reminder", "visit.followup_sent", "visit.message_received", "visit.ended", "chat.follow_up_due", "chat.reminder_due", "record.activation"];
|
|
163
|
+
/** One pushed event type. */
|
|
164
|
+
type EverfurNotificationEventType = (typeof EVERFUR_NOTIFICATION_EVENT_TYPES)[number];
|
|
165
|
+
/** What a tapped notification is about, keyed on `kind`. The optional references are null when the push carried none. */
|
|
166
|
+
type EverfurNotificationTarget = {
|
|
167
|
+
/**
|
|
168
|
+
* A records request (`record_request.updated`, `record.ready`, and `record.activation`, which says what the
|
|
169
|
+
* request's parse found): open that request.
|
|
170
|
+
*/
|
|
171
|
+
readonly kind: 'record_request';
|
|
172
|
+
readonly requestId: RecordsRequestId;
|
|
173
|
+
readonly petRef: PetRef | null;
|
|
174
|
+
} | {
|
|
175
|
+
/** A pet: `pet.vaccination.due` opens that pet's records, `chat.reminder_due` that pet's chat. */
|
|
176
|
+
readonly kind: 'pet';
|
|
177
|
+
readonly petRef: PetRef;
|
|
178
|
+
} | {
|
|
179
|
+
/**
|
|
180
|
+
* A vet visit (`visit.*`): open that visit. `visitRef` is the partner visit reference the visit events carry.
|
|
181
|
+
* `intent` is what to open for it, derived from the event type with the consumer app's routing (the push
|
|
182
|
+
* itself carries none): `visit` for a booking or a change to it, `join` for a reminder, `messages` for the
|
|
183
|
+
* vet's reply or the follow-up, `summary` for a completed visit. Pass both to `useVetVisit().openVisit`.
|
|
184
|
+
* `null` for a cancelled or missed visit: there is nothing left to open, so route to a new booking.
|
|
185
|
+
*/
|
|
186
|
+
readonly kind: 'visit';
|
|
187
|
+
readonly visitRef: string;
|
|
188
|
+
readonly petRef: PetRef | null;
|
|
189
|
+
readonly intent: VetVisitIntent | null;
|
|
190
|
+
} | {
|
|
191
|
+
/** A follow-up case (`chat.follow_up_due`): open the conversation the check-in landed in. */
|
|
192
|
+
readonly kind: 'case';
|
|
193
|
+
readonly caseRef: string;
|
|
194
|
+
readonly conversationId: ConversationId | null;
|
|
195
|
+
readonly petRef: PetRef | null;
|
|
196
|
+
};
|
|
197
|
+
/** A parsed push: the event it announces and the thing to open. Frozen. */
|
|
198
|
+
interface EverfurNotification {
|
|
199
|
+
/** `evt_` plus the public event id, the same id the webhook envelope for this event carries. */
|
|
200
|
+
readonly eventId: string;
|
|
201
|
+
readonly eventType: EverfurNotificationEventType;
|
|
202
|
+
readonly target: EverfurNotificationTarget;
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Read the Everfur routing block out of a received push, or null when there is none or it is not one Everfur would
|
|
206
|
+
* send. Pure and total: it never throws, whatever it is handed.
|
|
207
|
+
*
|
|
208
|
+
* Pass the object your notification library gave you: an expo-notifications `Notification` or `NotificationResponse`,
|
|
209
|
+
* an FCM `RemoteMessage`, or its `data` map. Route on `target.kind`; `eventType` says why the push was sent.
|
|
210
|
+
*/
|
|
211
|
+
declare function parseEverfurNotification(payload: unknown): EverfurNotification | null;
|
|
212
|
+
|
|
213
|
+
export { AuthContext, ConversationId, type DevicePlatform, EVERFUR_NOTIFICATION_EVENT_TYPES, EVERFUR_NOTIFICATION_TARGET_KINDS, EVERFUR_NOTIFICATION_VERSION, ErrorPolicyPort, EverfurError, type EverfurNotification, type EverfurNotificationEventType, type EverfurNotificationTarget, type EverfurNotificationTargetKind, type EverfurNotificationsOptions, type EverfurNotificationsState, type EverfurNotificationsStatus, EverfurResult, NOTIFICATIONS_REASON_MESSAGES, type NotificationPreferences, type NotificationPreferencesInput, type NotificationsClient, type NotificationsReasonCode, type NotificationsRuntime, PetRef, type PushProvider, RecordsRequestId, type RegisterDeviceInput, type RegisteredDevice, UserRef, VetVisitIntent, createNotificationsClient, explainNotificationsReason, parseEverfurNotification, useEverfurNotifications, useEverfurNotificationsClient };
|