@everfur/sdk 1.7.0 → 1.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-LPHBCDJP.js → chunk-25LX7XTO.js} +11 -11
- package/dist/{chunk-J5ZUBY3S.js → chunk-7DLCYODF.js} +1 -1
- package/dist/{chunk-6E3J6IVM.js → chunk-BFCVAT43.js} +3 -3
- package/dist/{chunk-ULQDOC75.js → chunk-KR75CVE4.js} +1 -1
- package/dist/client/index.cjs +1 -1
- package/dist/client/index.d.cts +1 -1
- package/dist/client/index.d.ts +1 -1
- package/dist/client/index.js +1 -1
- package/dist/core/index.cjs +1 -1
- package/dist/core/index.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/records/index.cjs +1 -1
- package/dist/records/index.js +1 -1
- package/dist/server/events/index.cjs +1 -1
- package/dist/server/events/index.js +1 -1
- package/dist/server/index.cjs +1 -1
- package/dist/server/index.js +1 -1
- package/dist/tabs/index.cjs +14 -14
- package/dist/tabs/index.js +14 -14
- package/dist/web/health-plan/index.cjs +1 -1
- package/dist/web/health-plan/index.js +1 -1
- package/dist/web/index.cjs +2 -2
- package/dist/web/index.js +2 -2
- package/dist/web/records-sheet/index.cjs +1 -1
- package/dist/web/records-sheet/index.js +1 -1
- package/dist/web/shop/index.cjs +1 -1
- package/dist/web/shop/index.js +1 -1
- package/dist/web/televet/booking/index.cjs +1 -1
- package/dist/web/televet/booking/index.js +1 -1
- package/dist/web/televet/call/index.cjs +1 -1
- package/dist/web/televet/call/index.js +1 -1
- package/dist/web/ui/index.cjs +1 -1
- package/dist/web/ui/index.js +33 -33
- package/package.json +1 -1
package/dist/server/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*! @everfur/sdk. Copyright (c) 2026 Strand Health Inc. dba Everfur. All rights reserved. Use is subject to the Everfur SDK License: https://docs.everfur.com/license */
|
|
2
2
|
"use strict";function ok(e,t){/* @__PURE__ */
|
|
3
3
|
return Object.freeze({ok:true,value:e})}function err(e){/* @__PURE__ */
|
|
4
|
-
return Object.freeze({ok:false,error:e})}var e=class _EverfurConfigError extends Error{constructor(e,t){super(t),this.name="EverfurConfigError",this.kind=e,Object.setPrototypeOf(this,_EverfurConfigError.prototype)}};var t=/^([A-Za-z][A-Za-z0-9+.-]*):\/\/([^/?#]*)/;var r="1.7.
|
|
4
|
+
return Object.freeze({ok:false,error:e})}var e=class _EverfurConfigError extends Error{constructor(e,t){super(t),this.name="EverfurConfigError",this.kind=e,Object.setPrototypeOf(this,_EverfurConfigError.prototype)}};var t=/^([A-Za-z][A-Za-z0-9+.-]*):\/\/([^/?#]*)/;var r="1.7.1";var n="2026-09-19",a="EVERFUR_API_BASE_URL";function i(e,t){/* @__PURE__ */
|
|
5
5
|
return Object.freeze({ok:false,failure:/* @__PURE__ */Object.freeze({reason:e,message:t})})}function tryResolveApiBaseUrl(e){let t=e?.trim(),r=t&&t.length>0?t:c(a);return r?d(r):i("missing-api-base-url",`apiBaseUrl is required: pass config.apiBaseUrl or set ${a}. The SDK never ships a hardcoded host.`)}function resolveApiBaseUrl(t){let r=tryResolveApiBaseUrl(t);if(!r.ok)throw new e("invalid-argument",r.failure.message);return r.value}function o(e){return e.slice(e.lastIndexOf("@")+1).replace(/:\d+$/,"").toLowerCase()}function l(e){return e.length===0||e.includes("@")?false:e.startsWith("[")&&e.endsWith("]")?true:!e.includes(":")}function s(e,t){let r=e.indexOf("://");return r<0||e.slice(r+3).includes("@")?false:l(t)}function u(e,t){return`${e}://${t}`}function d(e){let r=e.trim(),n=t.exec(r);if(n===null||n[2]===void 0||n[2].length===0)return i("malformed-api-base-url","apiBaseUrl is not a valid absolute URL");let a=(n[1]??"").toLowerCase(),l=o(n[2]);if(l.length===0)return i("malformed-api-base-url","apiBaseUrl is not a valid absolute URL");let d=s(r,l)?`: ${u(a,l)}`:"";if(a!=="https"){if(!(a==="http"&&p(l)))return a==="http"?i("insecure-api-base-url",`apiBaseUrl must use https (cleartext http is only allowed for localhost)${d}`):i("unsupported-api-base-url-scheme",`apiBaseUrl must be http(s)${d}`)}let c=r.endsWith("/")?r.slice(0,-1):r;/* @__PURE__ */
|
|
6
6
|
return Object.freeze({ok:true,value:c})}function p(e){let t=e.toLowerCase();return t==="localhost"||t==="127.0.0.1"||t==="[::1]"||t==="::1"}function c(e){let t=globalThis.process?.env?.[e];return typeof t=="string"&&t.trim().length>0?t.trim():void 0}var f="server";function v(e){return{"X-Everfur-SDK-Version":r,"X-Everfur-SDK-Platform":f,"X-Everfur-Contract":e}}var _="DAILY_QUOTA_EXCEEDED",h=/* @__PURE__ */new Set(["THROTTLINGEXCEPTION","RATELIMITED","TOOMANYREQUESTS"]);function m(e,t){if(!h.has(e.toUpperCase().replace(/[^A-Z0-9]/g,"")))return e;let r=t,n=r?.daily_limit??r?.error?.daily_limit;return typeof n=="number"&&Number.isFinite(n)?_:e}var y=[{wireCode:"AccessDeniedException",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"AuthorizationException",envelope:"http_envelope",httpStatus:401,retryable:false},{wireCode:"ConflictException",envelope:"http_envelope",httpStatus:409,retryable:true},{wireCode:"DAILY_QUOTA_EXCEEDED",envelope:"http_envelope",httpStatus:429,retryable:true},{wireCode:"FILE_TOO_LARGE",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"IDEMPOTENCY_KEY_IN_FLIGHT",envelope:"http_envelope",httpStatus:409,retryable:true},{wireCode:"IDEMPOTENCY_KEY_REUSED_DIFFERENT_REQUEST",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"INVALID_CONTENT_TYPE",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"InternalFailureException",envelope:"http_envelope",httpStatus:500,retryable:true},{wireCode:"MethodNotAllowedException",envelope:"http_envelope",httpStatus:405,retryable:false},{wireCode:"NotImplementedException",envelope:"http_envelope",httpStatus:501,retryable:false},{wireCode:"PaymentRequiredException",envelope:"http_envelope",httpStatus:402,retryable:false},{wireCode:"ResourceNotFoundException",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"ServiceUnavailableException",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"TIER_UPGRADE_REQUIRED",envelope:"http_envelope",httpStatus:402,retryable:false},{wireCode:"ThrottlingException",envelope:"http_envelope",httpStatus:429,retryable:true},{wireCode:"ValidationException",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"accessDenied",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"access_denied",envelope:"oauth_error",httpStatus:302,retryable:false},{wireCode:"anchor_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"anchor_ref_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"anonTokenInvalid",envelope:"http_envelope",httpStatus:401,retryable:false},{wireCode:"attachment_unreadable",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"authExpired",envelope:"http_envelope",httpStatus:401,retryable:true},{wireCode:"authRejected",envelope:"http_envelope",httpStatus:401,retryable:false},{wireCode:"before_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"bundle_mismatch",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"bundle_not_uploaded",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"bundles_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"catalog_empty_refused",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"catalog_shrink_refused",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"consent_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"consent_required",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"consent_scope_wrong_route",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"device_cipher_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"email_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"endpoint_not_allowed",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"environment_mismatch",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"event_cursor_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"event_filter_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"event_id_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"event_payload_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"event_type_not_available",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"event_type_unknown",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"idempotency_key_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"idempotency_key_required",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"idempotency_key_reused",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"inbox_cursor_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"insufficientCapability",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"insufficient_scope",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"internal_error",envelope:"sse_frame",httpStatus:200,retryable:false},{wireCode:"invalidRequest",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"invalid_client",envelope:"oauth_error",httpStatus:401,retryable:false},{wireCode:"invalid_client_metadata",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_grant",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_redirect_uri",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_request",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_scope",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_target",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"item_id_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"linked_account_read_only",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"mcp_connection_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"mcp_request_conflict",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"mcp_request_gone",envelope:"http_envelope",httpStatus:410,retryable:false},{wireCode:"mcp_request_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"not_found",envelope:"sse_frame",httpStatus:200,retryable:false},{wireCode:"not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"open_url_not_allowed",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"partner_visit_link_conflict",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"partner_visit_owner_only",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"partner_visit_pet_already_mapped",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"payload_too_large",envelope:"http_envelope",httpStatus:413,retryable:false},{wireCode:"petRefInUse",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"pet_health_list_removals_unconfirmed",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"pet_health_species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"pet_not_registered",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"provider_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"rateLimited",envelope:"http_envelope",httpStatus:429,retryable:true},{wireCode:"read_target_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"record_species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"record_subject_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"record_upload_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"records_consent_required",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"restricted_key",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"sandbox_only",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"session_required",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"session_revoked",envelope:"http_envelope",httpStatus:401,retryable:false},{wireCode:"share_limit_reached",envelope:"http_envelope",httpStatus:429,retryable:false},{wireCode:"slow_down",envelope:"oauth_error",httpStatus:429,retryable:true},{wireCode:"species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"subscription_keys_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"tenant_filter_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"tenant_has_no_capabilities",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"tenant_resource_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"tenant_surface_not_enabled",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"ticket_not_resolved",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"tickets_disabled",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"timeout",envelope:"sse_frame",httpStatus:200,retryable:true},{wireCode:"timezone_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"token_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"unavailable",envelope:"sse_frame",httpStatus:200,retryable:true},{wireCode:"unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"unrestrictedKeyRequired",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"unsupported_grant_type",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"unsupported_response_type",envelope:"oauth_error",httpStatus:302,retryable:false},{wireCode:"user_ref_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"verify_mint_rate_limited",envelope:"http_envelope",httpStatus:429,retryable:true},{wireCode:"verify_mint_refused",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"verify_mint_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"verify_user_ref_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"web_push_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"webhook_endpoint_update_empty",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"webhook_endpoint_update_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"webhook_url_rejected",envelope:"http_envelope",httpStatus:400,retryable:false}],b=/* @__PURE__ */Object.freeze(y.map(e=>/* @__PURE__ */Object.freeze(e)));/* @__PURE__ */Object.freeze(b.map(e=>e.wireCode));var g=/* @__PURE__ */Object.freeze({ValidationException:"validationFailed",AuthorizationException:"authRejected",PaymentRequiredException:"paymentRequired",AccessDeniedException:"accessDenied",ResourceNotFoundException:"resourceNotFound",ConflictException:"conflict",ThrottlingException:"rateLimited",InternalFailureException:"internalError",NotImplementedException:"notImplemented",ServiceUnavailableException:"serviceUnavailable",MethodNotAllowedException:"validationFailed",authExpired:"authExpired",unavailable:"serviceUnavailable",session_required:"sessionRequired",session_revoked:"authExpired",anonTokenInvalid:"authRejected",accessDenied:"accessDenied",invalidRequest:"sdkUpdateRequired",authRejected:"authRejected",rateLimited:"rateLimited",insufficientCapability:"accessDenied",unrestrictedKeyRequired:"accessDenied",user_ref_invalid:"validationFailed",event_cursor_invalid:"validationFailed",event_filter_invalid:"validationFailed",event_payload_invalid:"validationFailed",event_type_unknown:"validationFailed",idempotency_key_invalid:"validationFailed",idempotency_key_required:"validationFailed",idempotency_key_reused:"idempotencyConflict",payload_too_large:"validationFailed",webhook_url_rejected:"validationFailed",webhook_endpoint_update_empty:"validationFailed",webhook_endpoint_update_invalid:"validationFailed",event_type_not_available:"conflict",record_subject_not_found:"resourceNotFound",records_consent_required:"conflict",record_species_unsupported:"validationFailed",record_upload_invalid:"validationFailed",FILE_TOO_LARGE:"validationFailed",INVALID_CONTENT_TYPE:"validationFailed",attachment_unreadable:"validationFailed",provider_unsupported:"validationFailed",token_invalid:"validationFailed",device_cipher_unavailable:"serviceUnavailable",email_invalid:"validationFailed",consent_required:"validationFailed",consent_invalid:"validationFailed",consent_scope_wrong_route:"validationFailed",IDEMPOTENCY_KEY_IN_FLIGHT:"idempotencyInFlight",IDEMPOTENCY_KEY_REUSED_DIFFERENT_REQUEST:"idempotencyConflict",DAILY_QUOTA_EXCEEDED:"quotaExceeded",TIER_UPGRADE_REQUIRED:"paymentRequired",not_found:"conversationNotFound",timeout:"streamTimeout",internal_error:"internalError",invalid_request:"validationFailed",invalid_client:"authRejected",invalid_grant:"authRejected",unsupported_grant_type:"validationFailed",invalid_scope:"validationFailed",invalid_target:"validationFailed",invalid_redirect_uri:"validationFailed",invalid_client_metadata:"validationFailed",unsupported_response_type:"validationFailed",access_denied:"accessDenied",slow_down:"rateLimited",mcp_request_not_found:"resourceNotFound",mcp_request_gone:"resourceNotFound",mcp_connection_not_found:"resourceNotFound",mcp_request_conflict:"conflict",sandbox_only:"accessDenied",tenant_has_no_capabilities:"conflict",verify_mint_refused:"accessDenied",verify_mint_rate_limited:"rateLimited",verify_mint_unavailable:"serviceUnavailable",verify_user_ref_invalid:"validationFailed",insufficient_scope:"accessDenied",tenant_filter_invalid:"validationFailed",tenant_resource_not_found:"resourceNotFound",tenant_surface_not_enabled:"conflict",pet_health_species_unsupported:"validationFailed",pet_health_list_removals_unconfirmed:"validationFailed",petRefInUse:"conflict",share_limit_reached:"conflict",pet_not_registered:"resourceNotFound",species_unsupported:"validationFailed",partner_visit_owner_only:"accessDenied",partner_visit_link_conflict:"conflict",partner_visit_pet_already_mapped:"conflict",linked_account_read_only:"conflict",catalog_empty_refused:"conflict",catalog_shrink_refused:"conflict",endpoint_not_allowed:"validationFailed",event_id_invalid:"validationFailed",inbox_cursor_invalid:"validationFailed",item_id_invalid:"validationFailed",open_url_not_allowed:"validationFailed",read_target_invalid:"validationFailed",subscription_keys_invalid:"validationFailed",web_push_unavailable:"serviceUnavailable",anchor_not_found:"resourceNotFound",anchor_ref_invalid:"validationFailed",before_invalid:"validationFailed",bundle_mismatch:"validationFailed",bundle_not_uploaded:"validationFailed",bundles_unavailable:"serviceUnavailable",environment_mismatch:"validationFailed",restricted_key:"accessDenied",ticket_not_resolved:"conflict",tickets_disabled:"resourceNotFound",timezone_invalid:"validationFailed"}),w=/* @__PURE__ */Object.freeze(b.map(e=>/* @__PURE__ */Object.freeze({wireCode:e.wireCode,envelope:e.envelope,retryable:e.retryable,normalized:g[e.wireCode]}))),S=new Map(w.map(e=>[e.envelope+e.wireCode.toUpperCase(),e])),C=/* @__PURE__ */Object.freeze(["http_envelope",...[...new Set(w.map(e=>e.envelope))].filter(e=>e!=="http_envelope").sort()]);function contractErrorFor(e,t){if(typeof e!="string")return;let r=e.trim().toUpperCase();if(r.length!==0)for(let e of[t??"http_envelope",...C]){let t=S.get(e+r);if(t)return t}}var E=/* @__PURE__ */Object.freeze({authExpired:"authentication",authRejected:"authentication",sessionRequired:"authentication",identitySignatureRequired:"authentication",accessDenied:"authorization",paymentRequired:"entitlement",quotaExceeded:"rateLimit",rateLimited:"rateLimit",validationFailed:"invalidRequest",sdkUpdateRequired:"invalidRequest",runtimeDisposed:"invalidRequest",conversationNotFound:"notFound",petNotFound:"notFound",resourceNotFound:"notFound",conflict:"conflict",idempotencyConflict:"conflict",idempotencyInFlight:"conflict",streamTimeout:"connection",streamIncomplete:"connection",upstreamLlmTimeout:"connection",serviceUnavailable:"connection",internalError:"server",notImplemented:"server",mediaUploadFailed:"media",moderationBlocked:"policy",unknown:"unknown"});function categoryFor(e){return E[e]}function fromWire(e){let t=contractErrorFor(e);if(t)return t.normalized;let r=(e??"").trim().toUpperCase(),n=r.replace(/[^A-Z0-9]/g,"");if(n==="AUTHREJECTED")return"authRejected";if(r.startsWith("AUTH"))return"authExpired";switch(n){case"DAILYQUOTAEXCEEDED":case"QUOTAEXCEEDED":return"quotaExceeded";case"RATELIMITED":case"TOOMANYREQUESTS":case"TELEVETRATELIMITED":return"rateLimited";case"IDEMPOTENCYKEYCONFLICT":case"IDEMPOTENCYCONFLICT":return"idempotencyConflict";case"ACCESSDENIED":case"FORBIDDEN":return"accessDenied";case"IDENTITYSIGNATUREREQUIRED":return"identitySignatureRequired";case"FREECAPREACHED":return"paymentRequired";case"RUNTIMEDISPOSED":return"runtimeDisposed";case"NOTFOUND":case"CONVERSATIONNOTFOUND":return"conversationNotFound";case"PETNOTFOUND":return"petNotFound";case"TIMEOUT":case"STREAMTIMEOUT":return"streamTimeout";case"MEDIAUPLOADFAILED":case"UNRECOGNIZEDVIDEOFORMAT":case"FILETOOSMALL":return"mediaUploadFailed";case"MODERATIONBLOCKED":return"moderationBlocked";case"UPSTREAMLLMTIMEOUT":return"upstreamLlmTimeout";case"INTERNALERROR":case"INTERNALSERVERERROR":return"internalError";case"STREAMINCOMPLETE":case"CHATSTREAMINCOMPLETE":return"streamIncomplete";case"INVALIDANALYSISTYPE":case"INVALIDUPLOADPURPOSE":return"unknown";default:return"unknown"}}function fromHttpStatus(e){return e===401?"authExpired":e===403?"accessDenied":e===404?"conversationNotFound":e===409?"idempotencyConflict":e===421?"unknown":e===429?"rateLimited":e===400||e===422?"unknown":e>=500?"internalError":"unknown"}var T=/* @__PURE__ */new Set(["streamTimeout","rateLimited","internalError","upstreamLlmTimeout","streamIncomplete"]);function isAutoRetryable(e){return T.has(e)}var $=/* @__PURE__ */new Set(["serviceUnavailable","conflict","idempotencyInFlight"]);function isRetryableCode(e){return isAutoRetryable(e)||$.has(e)}var R="This feature isn't available on your account right now.",A="Something in that request was not right. Check the details and try again.",k=/* @__PURE__ */Object.freeze({authExpired:"Please sign in again to continue.",authRejected:"Please sign in again to continue.",sessionRequired:"This app needs to be updated to keep using Everfur.",accessDenied:R,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:A,sdkUpdateRequired:"This app needs to be updated to keep using Everfur.",conflict:"That is already running. Wait for it to finish, then try again.",idempotencyConflict:"That message was already delivered.",idempotencyInFlight:"That is still processing. Give it a moment.",conversationNotFound:"This conversation is no longer available.",petNotFound:"We could not find that pet. Please pick a pet and try again.",resourceNotFound:"We could not find that.",streamTimeout:"The response timed out. Tap retry to try again.",mediaUploadFailed:"We could not upload that photo. Please attach it again.",moderationBlocked:"This request cannot be answered here.",upstreamLlmTimeout:"The response timed out. Tap retry to try again.",internalError:"We hit a snag on our end. Please try again.",notImplemented:"That is not available yet.",serviceUnavailable:"That service is briefly unavailable. Try again shortly.",streamIncomplete:"The connection dropped mid-answer. Tap retry to continue.",identitySignatureRequired:R,runtimeDisposed:A,unknown:"Something went wrong. Please try again."}),I="This session has ended. Please sign in again.",D="linked_account_read_only";function F(e,t,r){return e==="conflict"&&r===D?R:(e==="authRejected"||e==="authExpired")&&typeof t=="string"&&t.trim().toLowerCase()==="session_revoked"?I:userFacingError(e)}function userFacingError(e){return k[e]}function O(e,t,r){Object.defineProperty(e,t,{value:r,enumerable:false,writable:false,configurable:false})}var j=/^[a-z][a-z0-9_]{0,63}$/;function makeEverfurError(e,t){let r=contractErrorFor(t?.wireCode,t?.wireEnvelope),n=e==="conflict"&&t?.reasonCode===D,a={code:e,category:categoryFor(e),retryable:t?.retryable??(n?false:isRetryableCode(e)),displayMessage:F(e,t?.wireCode,n?D:null)};t?.httpStatus!==void 0&&(a.httpStatus=t.httpStatus),t?.requestId&&(a.requestId=t.requestId),typeof t?.reasonCode=="string"&&j.test(t.reasonCode)&&(a.reasonCode=t.reasonCode);let i=t?.retryAfterSeconds;if(typeof i=="number"&&Number.isFinite(i)&&i>=0&&(a.retryAfterSeconds=Math.round(i)),r);return t?.wireMessage&&O(a,"wireMessage",t.wireMessage),t?.raw!==void 0&&t.raw!==null&&O(a,"raw",t.raw),/* @__PURE__ */Object.freeze(a)}var N="free_cap_reached";function x(e){return typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}function U(e){if(typeof e!="object"||e===null)return null;let t=e,r=t.detail,n=typeof r=="object"&&r!==null?r:t;if(n.error!==N&&n.code!==N)return null;let a=x(n.limit),i=x(n.used);if(a===null||i===null)return null;let o=n.resets_at,l=n.emergency_guidance;/* @__PURE__ */
|
|
7
7
|
return Object.freeze({limit:a,used:i,resetsAt:typeof o=="string"&&o.length>0?o:null,...typeof l=="string"&&l.trim().length>0?{emergencyGuidance:l}:{}})}function q(e,t){if(e.status!==429&&e.status!==503)return t;let r=z(e.headers.get(L),Date.now());if(r===null)return t;let n=t!==null&&typeof t=="object"&&!Array.isArray(t)?t:null;return n!==null&&P(n)?t:{...n??{},retry_after_seconds:r}}var L="retry-after";function z(e,t){if(e===null)return null;let r=e.trim();if(/^\d+$/.test(r))return Number(r);let n=Date.parse(r);return Number.isFinite(n)?Math.max(0,Math.ceil((n-t)/1e3)):null}function P(e){return[e,e.error,e.detail].some(e=>e!==null&&typeof e=="object"&&("retry_after_seconds"in e||"resets_at"in e))}var M="x-request-id";function errorFromResponse(e,t,r){let n=Y(t),a=n?fromWire(n):fromHttpStatus(e),i=V(t);return makeEverfurError(a,{httpStatus:e,...W(t)?{retryable:true}:{},...r?{requestId:r}:{},...n?{wireCode:n}:{},...B(t)?{reasonCode:B(t)}:{},...K(t)!==null?{retryAfterSeconds:K(t)}:{},...i?{wireMessage:i}:{},...t!=null?{raw:t}:{}})}function K(e){let t=e,r=t?.retry_after_seconds??t?.error?.retry_after_seconds;return typeof r=="number"&&Number.isFinite(r)&&r>=0?r:null}function networkError(e){return makeEverfurError("internalError",{retryable:true,wireMessage:Z(e)})}function requestIdOf(e){let t=e.headers.get(M);return typeof t=="string"&&t.length>0?t:null}function getGlobalFetch(){let t=globalThis.fetch;if(typeof t!="function")throw new e("missing-peer-dependency","global fetch is unavailable; provide config.transport or an injected fetch implementation");return t}function B(e){let t=e,r=t?.error?.reason_code??t?.reason_code;return typeof r=="string"&&r.length>0?r:null}function Y(e){let t=e,r=t?.error?.code??t?.code;return typeof r=="string"&&r.length>0?m(r,e):U(e)!==null?N:null}function V(e){let t=e,r=t?.error?.message??t?.message;return typeof r=="string"&&r.length>0?r:null}function W(e){let t=e;return t?.error?.retryable===true||t?.retryable===true}function Z(e){return e instanceof Error?e.message:typeof e=="string"?e:"network request failed"}var G=["sk_partner_","rk_partner_"];function Q(t,r){if(typeof t!="string"||t.length===0)throw new e("invalid-argument","partnerSecretKey is required");if(t.startsWith("pk_"))throw new e("invalid-argument",`partnerSecretKey is a publishable key (pk_...): ${r} needs your secret key, server side only`);if(!G.some(e=>t.startsWith(e)))throw new e("invalid-argument","partnerSecretKey must be an sk_partner_ secret key or an rk_partner_ restricted key")}var X=128;function assertValidUserRef(t){let r=typeof t=="string"?[...t].length:0;if(typeof t!="string"||r<1||r>X)throw new e("invalid-argument",`user_ref must be 1..${X} characters`);if(t.trim().length===0)throw new e("invalid-argument","user_ref must not be blank: the server strips surrounding whitespace before validating, so a whitespace-only value arrives empty and is rejected as required.");if(t!==t.trim())throw new e("invalid-argument","user_ref must not have leading or trailing whitespace: the server strips it, so padded and unpadded forms of the same id resolve to ONE user. Pass the exact id you want to key on.");if(t.includes("@"))throw new e("invalid-argument","user_ref must not contain '@'");if(!H(t))throw new e("invalid-argument","user_ref must be printable (no control characters)");return t}function H(e){return!J.test(e)}var J=/[\p{Cc}\p{Cf}\p{Cs}\p{Co}\p{Cn}\p{Zl}\p{Zp}]|(?!\u0020)[\p{Zs}]/u,ee="user_ref_invalid";function te(e){let t=e.raw,r=typeof t=="object"&&t!==null?t:null,n=(r!==null&&typeof r.error=="object"&&r.error!==null?r.error.code:void 0)??r?.code;return n!==ee&&e.reasonCode!==ee?e:makeEverfurError("validationFailed",{retryable:false,...e.httpStatus!==void 0?{httpStatus:e.httpStatus}:{},...e.requestId!==void 0?{requestId:e.requestId}:{},...typeof n=="string"?{wireCode:n}:{},reasonCode:ee,...e.wireMessage!==void 0?{wireMessage:e.wireMessage}:{},...t!==void 0?{raw:t}:{}})}function re(e){let t=e.raw;if(typeof t!="object"||t===null)return null;let r=t.code;return typeof r=="string"&&r.length>0?r:null}function ne(e,t){let r=re(e);if(r===null)return e;let n=t[r];return n===void 0?e:makeEverfurError(n.code,{retryable:n.retryable,...e.httpStatus!==void 0?{httpStatus:e.httpStatus}:{},...e.requestId!==void 0?{requestId:e.requestId}:{},wireCode:r,reasonCode:r,...e.wireMessage!==void 0?{wireMessage:e.wireMessage}:{},raw:e.raw})}function ae(e,t){let r=ne(e,t);if(r!==e||re(e)!==null)return r;let n=e.reasonCode;if(typeof n!="string")return e;let a=t[n];return a===void 0?e:makeEverfurError(a.code,{retryable:a.retryable,...e.httpStatus!==void 0?{httpStatus:e.httpStatus}:{},...e.requestId!==void 0?{requestId:e.requestId}:{},wireCode:n,reasonCode:n,...e.wireMessage!==void 0?{wireMessage:e.wireMessage}:{},raw:e.raw})}var ie=64;function oe(t){if(t!=null){if(typeof t!="string"||t.length===0||t.length>ie||/\s/.test(t))throw new e("invalid-argument",`timezone must be an IANA zone name such as 'America/Chicago' (at most ${ie} characters)`);return t}}function le(e){for(let t=0;t<e.length;t+=1){let r=e.charCodeAt(t);if(r>=55296&&r<=56319){let r=e.charCodeAt(t+1);if(!(r>=56320&&r<=57343))return true;t+=1}else if(r>=56320&&r<=57343)return true}return false}function se(e){return[...e].length}var ue=/* @__PURE__ */Object.freeze({dog:"dog",canine:"dog",k9:"dog",puppy:"dog",cat:"cat",feline:"cat",kitten:"cat"});function canonicalPetSpecies(e){if(typeof e!="string")return null;let t=e.trim().toLowerCase();return Object.prototype.hasOwnProperty.call(ue,t)?ue[t]:null}var de=50,pe=128,ce=120,fe=120,ve=2e3,_e=120,he=80,me=/* @__PURE__ */new Set(["male","female","unknown"]),ye=/* @__PURE__ */new Set(["day","month","year"]),be=/* @__PURE__ */new Set(["low","medium","high","athletic"]),ge=/* @__PURE__ */new Set(["indoor","outdoor","both"]),we=/* @__PURE__ */new Set(["mild","moderate","severe"]),Se=/^(\d{4})-(\d{2})-(\d{2})$/,Ce=[["sex","sex"],["spayedNeutered","spayed_neutered"],["birthDate","birth_date"],["birthDatePrecision","birth_date_precision"],["activityLevel","activity_level"],["indoorOutdoor","indoor_outdoor"],["foodBrand","food_brand"],["foodType","food_type"],["microchipId","microchip_id"]],Ee=[["allergies","allergies"],["medications","medications"],["supplements","supplements"],["conditions","conditions"]];/* @__PURE__ */Object.freeze([...Ce,...Ee].map(([e])=>e));function Te(e){let t=Se.exec(e);if(t===null)return false;let[r,n,a]=[Number(t[1]),Number(t[2]),Number(t[3])],i=new Date(Date.UTC(r,n-1,a));return i.getUTCFullYear()===r&&i.getUTCMonth()===n-1&&i.getUTCDate()===a}var $e=e=>(t,r)=>typeof r=="string"&&e.has(r)?null:`${t} must be one of ${[...e].join(", ")}`,Re=(e,t)=>typeof t=="boolean"?null:`${e} must be true or false`,Ae=(e,t)=>typeof t=="string"&&Te(t)?null:`${e} must be a real date written YYYY-MM-DD`,ke=(e,t={})=>(r,n)=>{if(typeof n!="string")return`${r} must be a string`;if(le(n))return`${r} contains an unpaired surrogate and cannot be encoded`;let a=t.trimmed?n.trim():n;if(t.required&&a.length===0)return`${r} is required and must not be blank`;let i=se(a);return i<=e?null:`${r} is ${i} characters; the server accepts at most ${e}`},Ie={sex:$e(me),spayedNeutered:Re,birthDate:Ae,birthDatePrecision:$e(ye),activityLevel:$e(be),indoorOutdoor:$e(ge),foodBrand:ke(_e),foodType:ke(_e),microchipId:ke(he)},De=["ref","ref",false,ke(pe,{required:true,trimmed:true})],Fe=["notes","notes",false,ke(ve,{trimmed:true})],Oe=[De,["name","name",true,ke(ce,{required:true,trimmed:true})],["dose","dose",false,ke(fe,{trimmed:true})],["frequency","frequency",false,ke(fe,{trimmed:true})],["startDate","start_date",false,Ae],["endDate","end_date",false,Ae],Fe],je={allergies:[De,["allergen","allergen",true,ke(ce,{required:true,trimmed:true})],["severity","severity",false,$e(we)],Fe],medications:Oe,supplements:Oe,conditions:[De,["conditionName","condition_name",true,ke(ce,{required:true,trimmed:true})],["diagnosedDate","diagnosed_date",false,Ae],Fe]};function Ne(e,t,r){let n=`${e}[${t}]`;if(typeof r!="object"||r===null||Array.isArray(r))return{error:`${n} must be an object`};let a=r,i={};for(let[t,r,o,l]of je[e]){let e=a[t];if(e==null){if(o)return{error:`${n}.${t} is required`};e===null&&(i[r]=null);continue}let s=l(`${n}.${t}`,e);if(s!==null)return{error:s};i[r]=e}let o=i.start_date,l=i.end_date;return typeof o=="string"&&typeof l=="string"&&l<o?{error:`${n}.endDate must not be before startDate`}:{item:i}}function xe(e,t){if(!Array.isArray(t))return{error:`${e} must be an array (send [] to clear it)`};if(t.length>de)return{error:`${e} has ${t.length} items; the server accepts at most ${de}`};let r=[],n=/* @__PURE__ */new Set;for(let a=0;a<t.length;a+=1){let i=Ne(e,a,t[a]);if("error"in i)return i;let o=i.item.ref;if(typeof o=="string"){let t=o.trim();if(n.has(t))return{error:`${e}: ref ${JSON.stringify(t)} is used twice; a ref names one item`};n.add(t)}r.push(i.item)}return{items:r}}function Ue(e,t){let r=e,n={};for(let[e,t]of Ce){let a=r[e];if(a!==void 0){if(a!==null){let t=Ie[e](e,a);if(t!==null)return{error:t}}n[t]=a}}let a=r.birthDate!==void 0,i=r.birthDatePrecision!==void 0;if(a!==i||a&&r.birthDate===null!=(r.birthDatePrecision===null))return{error:"birthDate and birthDatePrecision must be sent together, both set or both null"};for(let[e,t]of Ee){let a=r[e];if(a===void 0)continue;let i=xe(e,a);if("error"in i)return i;n[t]=i.items}return Object.keys(n).length>0&&t!==void 0&&canonicalPetSpecies(t)===null?{error:"health fields need a pet Everfur reads as a dog or a cat (dog, canine, k9, puppy, cat, feline, kitten)"}:{body:n}}var qe=e=>typeof e=="string"?e:null,Le=(e,t)=>typeof t=="string"&&e.has(t)?t:null,ze=e=>typeof e=="boolean"?e:null;function Pe(e,t){return Array.isArray(e)?/* @__PURE__ */Object.freeze(e.flatMap(e=>{if(typeof e!="object"||e===null||Array.isArray(e))return[];let r=t(e);return r===null?[]:[r]})):/* @__PURE__ */Object.freeze([])}function Me(e){let t=qe(e.name);return t===null||t.length===0?null:/* @__PURE__ */Object.freeze({ref:qe(e.ref),name:t,dose:qe(e.dose),frequency:qe(e.frequency),startDate:qe(e.start_date),endDate:qe(e.end_date),notes:qe(e.notes)})}function Ke(e){let t=e.profile_version;/* @__PURE__ */
|
package/dist/server/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*! @everfur/sdk. Copyright (c) 2026 Strand Health Inc. dba Everfur. All rights reserved. Use is subject to the Everfur SDK License: https://docs.everfur.com/license */
|
|
2
2
|
function ok(e,t){/* @__PURE__ */
|
|
3
3
|
return Object.freeze({ok:true,value:e})}function err(e){/* @__PURE__ */
|
|
4
|
-
return Object.freeze({ok:false,error:e})}var e=class _EverfurConfigError extends Error{constructor(e,t){super(t),this.name="EverfurConfigError",this.kind=e,Object.setPrototypeOf(this,_EverfurConfigError.prototype)}};var t=/^([A-Za-z][A-Za-z0-9+.-]*):\/\/([^/?#]*)/;var r="1.7.
|
|
4
|
+
return Object.freeze({ok:false,error:e})}var e=class _EverfurConfigError extends Error{constructor(e,t){super(t),this.name="EverfurConfigError",this.kind=e,Object.setPrototypeOf(this,_EverfurConfigError.prototype)}};var t=/^([A-Za-z][A-Za-z0-9+.-]*):\/\/([^/?#]*)/;var r="1.7.1";var n="2026-09-19",a="EVERFUR_API_BASE_URL";function i(e,t){/* @__PURE__ */
|
|
5
5
|
return Object.freeze({ok:false,failure:/* @__PURE__ */Object.freeze({reason:e,message:t})})}function tryResolveApiBaseUrl(e){let t=e?.trim(),r=t&&t.length>0?t:c(a);return r?d(r):i("missing-api-base-url",`apiBaseUrl is required: pass config.apiBaseUrl or set ${a}. The SDK never ships a hardcoded host.`)}function resolveApiBaseUrl(t){let r=tryResolveApiBaseUrl(t);if(!r.ok)throw new e("invalid-argument",r.failure.message);return r.value}function o(e){return e.slice(e.lastIndexOf("@")+1).replace(/:\d+$/,"").toLowerCase()}function l(e){return e.length===0||e.includes("@")?false:e.startsWith("[")&&e.endsWith("]")?true:!e.includes(":")}function s(e,t){let r=e.indexOf("://");return r<0||e.slice(r+3).includes("@")?false:l(t)}function u(e,t){return`${e}://${t}`}function d(e){let r=e.trim(),n=t.exec(r);if(n===null||n[2]===void 0||n[2].length===0)return i("malformed-api-base-url","apiBaseUrl is not a valid absolute URL");let a=(n[1]??"").toLowerCase(),l=o(n[2]);if(l.length===0)return i("malformed-api-base-url","apiBaseUrl is not a valid absolute URL");let d=s(r,l)?`: ${u(a,l)}`:"";if(a!=="https"){if(!(a==="http"&&p(l)))return a==="http"?i("insecure-api-base-url",`apiBaseUrl must use https (cleartext http is only allowed for localhost)${d}`):i("unsupported-api-base-url-scheme",`apiBaseUrl must be http(s)${d}`)}let c=r.endsWith("/")?r.slice(0,-1):r;/* @__PURE__ */
|
|
6
6
|
return Object.freeze({ok:true,value:c})}function p(e){let t=e.toLowerCase();return t==="localhost"||t==="127.0.0.1"||t==="[::1]"||t==="::1"}function c(e){let t=globalThis.process?.env?.[e];return typeof t=="string"&&t.trim().length>0?t.trim():void 0}var f="server";function v(e){return{"X-Everfur-SDK-Version":r,"X-Everfur-SDK-Platform":f,"X-Everfur-Contract":e}}var _="DAILY_QUOTA_EXCEEDED",h=/* @__PURE__ */new Set(["THROTTLINGEXCEPTION","RATELIMITED","TOOMANYREQUESTS"]);function m(e,t){if(!h.has(e.toUpperCase().replace(/[^A-Z0-9]/g,"")))return e;let r=t,n=r?.daily_limit??r?.error?.daily_limit;return typeof n=="number"&&Number.isFinite(n)?_:e}var y=[{wireCode:"AccessDeniedException",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"AuthorizationException",envelope:"http_envelope",httpStatus:401,retryable:false},{wireCode:"ConflictException",envelope:"http_envelope",httpStatus:409,retryable:true},{wireCode:"DAILY_QUOTA_EXCEEDED",envelope:"http_envelope",httpStatus:429,retryable:true},{wireCode:"FILE_TOO_LARGE",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"IDEMPOTENCY_KEY_IN_FLIGHT",envelope:"http_envelope",httpStatus:409,retryable:true},{wireCode:"IDEMPOTENCY_KEY_REUSED_DIFFERENT_REQUEST",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"INVALID_CONTENT_TYPE",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"InternalFailureException",envelope:"http_envelope",httpStatus:500,retryable:true},{wireCode:"MethodNotAllowedException",envelope:"http_envelope",httpStatus:405,retryable:false},{wireCode:"NotImplementedException",envelope:"http_envelope",httpStatus:501,retryable:false},{wireCode:"PaymentRequiredException",envelope:"http_envelope",httpStatus:402,retryable:false},{wireCode:"ResourceNotFoundException",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"ServiceUnavailableException",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"TIER_UPGRADE_REQUIRED",envelope:"http_envelope",httpStatus:402,retryable:false},{wireCode:"ThrottlingException",envelope:"http_envelope",httpStatus:429,retryable:true},{wireCode:"ValidationException",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"accessDenied",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"access_denied",envelope:"oauth_error",httpStatus:302,retryable:false},{wireCode:"anchor_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"anchor_ref_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"anonTokenInvalid",envelope:"http_envelope",httpStatus:401,retryable:false},{wireCode:"attachment_unreadable",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"authExpired",envelope:"http_envelope",httpStatus:401,retryable:true},{wireCode:"authRejected",envelope:"http_envelope",httpStatus:401,retryable:false},{wireCode:"before_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"bundle_mismatch",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"bundle_not_uploaded",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"bundles_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"catalog_empty_refused",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"catalog_shrink_refused",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"consent_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"consent_required",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"consent_scope_wrong_route",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"device_cipher_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"email_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"endpoint_not_allowed",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"environment_mismatch",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"event_cursor_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"event_filter_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"event_id_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"event_payload_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"event_type_not_available",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"event_type_unknown",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"idempotency_key_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"idempotency_key_required",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"idempotency_key_reused",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"inbox_cursor_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"insufficientCapability",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"insufficient_scope",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"internal_error",envelope:"sse_frame",httpStatus:200,retryable:false},{wireCode:"invalidRequest",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"invalid_client",envelope:"oauth_error",httpStatus:401,retryable:false},{wireCode:"invalid_client_metadata",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_grant",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_redirect_uri",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_request",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_scope",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_target",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"item_id_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"linked_account_read_only",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"mcp_connection_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"mcp_request_conflict",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"mcp_request_gone",envelope:"http_envelope",httpStatus:410,retryable:false},{wireCode:"mcp_request_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"not_found",envelope:"sse_frame",httpStatus:200,retryable:false},{wireCode:"not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"open_url_not_allowed",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"partner_visit_link_conflict",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"partner_visit_owner_only",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"partner_visit_pet_already_mapped",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"payload_too_large",envelope:"http_envelope",httpStatus:413,retryable:false},{wireCode:"petRefInUse",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"pet_health_list_removals_unconfirmed",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"pet_health_species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"pet_not_registered",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"provider_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"rateLimited",envelope:"http_envelope",httpStatus:429,retryable:true},{wireCode:"read_target_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"record_species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"record_subject_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"record_upload_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"records_consent_required",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"restricted_key",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"sandbox_only",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"session_required",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"session_revoked",envelope:"http_envelope",httpStatus:401,retryable:false},{wireCode:"share_limit_reached",envelope:"http_envelope",httpStatus:429,retryable:false},{wireCode:"slow_down",envelope:"oauth_error",httpStatus:429,retryable:true},{wireCode:"species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"subscription_keys_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"tenant_filter_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"tenant_has_no_capabilities",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"tenant_resource_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"tenant_surface_not_enabled",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"ticket_not_resolved",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"tickets_disabled",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"timeout",envelope:"sse_frame",httpStatus:200,retryable:true},{wireCode:"timezone_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"token_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"unavailable",envelope:"sse_frame",httpStatus:200,retryable:true},{wireCode:"unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"unrestrictedKeyRequired",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"unsupported_grant_type",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"unsupported_response_type",envelope:"oauth_error",httpStatus:302,retryable:false},{wireCode:"user_ref_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"verify_mint_rate_limited",envelope:"http_envelope",httpStatus:429,retryable:true},{wireCode:"verify_mint_refused",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"verify_mint_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"verify_user_ref_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"web_push_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"webhook_endpoint_update_empty",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"webhook_endpoint_update_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"webhook_url_rejected",envelope:"http_envelope",httpStatus:400,retryable:false}],b=/* @__PURE__ */Object.freeze(y.map(e=>/* @__PURE__ */Object.freeze(e)));/* @__PURE__ */Object.freeze(b.map(e=>e.wireCode));var g=/* @__PURE__ */Object.freeze({ValidationException:"validationFailed",AuthorizationException:"authRejected",PaymentRequiredException:"paymentRequired",AccessDeniedException:"accessDenied",ResourceNotFoundException:"resourceNotFound",ConflictException:"conflict",ThrottlingException:"rateLimited",InternalFailureException:"internalError",NotImplementedException:"notImplemented",ServiceUnavailableException:"serviceUnavailable",MethodNotAllowedException:"validationFailed",authExpired:"authExpired",unavailable:"serviceUnavailable",session_required:"sessionRequired",session_revoked:"authExpired",anonTokenInvalid:"authRejected",accessDenied:"accessDenied",invalidRequest:"sdkUpdateRequired",authRejected:"authRejected",rateLimited:"rateLimited",insufficientCapability:"accessDenied",unrestrictedKeyRequired:"accessDenied",user_ref_invalid:"validationFailed",event_cursor_invalid:"validationFailed",event_filter_invalid:"validationFailed",event_payload_invalid:"validationFailed",event_type_unknown:"validationFailed",idempotency_key_invalid:"validationFailed",idempotency_key_required:"validationFailed",idempotency_key_reused:"idempotencyConflict",payload_too_large:"validationFailed",webhook_url_rejected:"validationFailed",webhook_endpoint_update_empty:"validationFailed",webhook_endpoint_update_invalid:"validationFailed",event_type_not_available:"conflict",record_subject_not_found:"resourceNotFound",records_consent_required:"conflict",record_species_unsupported:"validationFailed",record_upload_invalid:"validationFailed",FILE_TOO_LARGE:"validationFailed",INVALID_CONTENT_TYPE:"validationFailed",attachment_unreadable:"validationFailed",provider_unsupported:"validationFailed",token_invalid:"validationFailed",device_cipher_unavailable:"serviceUnavailable",email_invalid:"validationFailed",consent_required:"validationFailed",consent_invalid:"validationFailed",consent_scope_wrong_route:"validationFailed",IDEMPOTENCY_KEY_IN_FLIGHT:"idempotencyInFlight",IDEMPOTENCY_KEY_REUSED_DIFFERENT_REQUEST:"idempotencyConflict",DAILY_QUOTA_EXCEEDED:"quotaExceeded",TIER_UPGRADE_REQUIRED:"paymentRequired",not_found:"conversationNotFound",timeout:"streamTimeout",internal_error:"internalError",invalid_request:"validationFailed",invalid_client:"authRejected",invalid_grant:"authRejected",unsupported_grant_type:"validationFailed",invalid_scope:"validationFailed",invalid_target:"validationFailed",invalid_redirect_uri:"validationFailed",invalid_client_metadata:"validationFailed",unsupported_response_type:"validationFailed",access_denied:"accessDenied",slow_down:"rateLimited",mcp_request_not_found:"resourceNotFound",mcp_request_gone:"resourceNotFound",mcp_connection_not_found:"resourceNotFound",mcp_request_conflict:"conflict",sandbox_only:"accessDenied",tenant_has_no_capabilities:"conflict",verify_mint_refused:"accessDenied",verify_mint_rate_limited:"rateLimited",verify_mint_unavailable:"serviceUnavailable",verify_user_ref_invalid:"validationFailed",insufficient_scope:"accessDenied",tenant_filter_invalid:"validationFailed",tenant_resource_not_found:"resourceNotFound",tenant_surface_not_enabled:"conflict",pet_health_species_unsupported:"validationFailed",pet_health_list_removals_unconfirmed:"validationFailed",petRefInUse:"conflict",share_limit_reached:"conflict",pet_not_registered:"resourceNotFound",species_unsupported:"validationFailed",partner_visit_owner_only:"accessDenied",partner_visit_link_conflict:"conflict",partner_visit_pet_already_mapped:"conflict",linked_account_read_only:"conflict",catalog_empty_refused:"conflict",catalog_shrink_refused:"conflict",endpoint_not_allowed:"validationFailed",event_id_invalid:"validationFailed",inbox_cursor_invalid:"validationFailed",item_id_invalid:"validationFailed",open_url_not_allowed:"validationFailed",read_target_invalid:"validationFailed",subscription_keys_invalid:"validationFailed",web_push_unavailable:"serviceUnavailable",anchor_not_found:"resourceNotFound",anchor_ref_invalid:"validationFailed",before_invalid:"validationFailed",bundle_mismatch:"validationFailed",bundle_not_uploaded:"validationFailed",bundles_unavailable:"serviceUnavailable",environment_mismatch:"validationFailed",restricted_key:"accessDenied",ticket_not_resolved:"conflict",tickets_disabled:"resourceNotFound",timezone_invalid:"validationFailed"}),w=/* @__PURE__ */Object.freeze(b.map(e=>/* @__PURE__ */Object.freeze({wireCode:e.wireCode,envelope:e.envelope,retryable:e.retryable,normalized:g[e.wireCode]}))),S=new Map(w.map(e=>[e.envelope+e.wireCode.toUpperCase(),e])),C=/* @__PURE__ */Object.freeze(["http_envelope",...[...new Set(w.map(e=>e.envelope))].filter(e=>e!=="http_envelope").sort()]);function contractErrorFor(e,t){if(typeof e!="string")return;let r=e.trim().toUpperCase();if(r.length!==0)for(let e of[t??"http_envelope",...C]){let t=S.get(e+r);if(t)return t}}var E=/* @__PURE__ */Object.freeze({authExpired:"authentication",authRejected:"authentication",sessionRequired:"authentication",identitySignatureRequired:"authentication",accessDenied:"authorization",paymentRequired:"entitlement",quotaExceeded:"rateLimit",rateLimited:"rateLimit",validationFailed:"invalidRequest",sdkUpdateRequired:"invalidRequest",runtimeDisposed:"invalidRequest",conversationNotFound:"notFound",petNotFound:"notFound",resourceNotFound:"notFound",conflict:"conflict",idempotencyConflict:"conflict",idempotencyInFlight:"conflict",streamTimeout:"connection",streamIncomplete:"connection",upstreamLlmTimeout:"connection",serviceUnavailable:"connection",internalError:"server",notImplemented:"server",mediaUploadFailed:"media",moderationBlocked:"policy",unknown:"unknown"});function categoryFor(e){return E[e]}function fromWire(e){let t=contractErrorFor(e);if(t)return t.normalized;let r=(e??"").trim().toUpperCase(),n=r.replace(/[^A-Z0-9]/g,"");if(n==="AUTHREJECTED")return"authRejected";if(r.startsWith("AUTH"))return"authExpired";switch(n){case"DAILYQUOTAEXCEEDED":case"QUOTAEXCEEDED":return"quotaExceeded";case"RATELIMITED":case"TOOMANYREQUESTS":case"TELEVETRATELIMITED":return"rateLimited";case"IDEMPOTENCYKEYCONFLICT":case"IDEMPOTENCYCONFLICT":return"idempotencyConflict";case"ACCESSDENIED":case"FORBIDDEN":return"accessDenied";case"IDENTITYSIGNATUREREQUIRED":return"identitySignatureRequired";case"FREECAPREACHED":return"paymentRequired";case"RUNTIMEDISPOSED":return"runtimeDisposed";case"NOTFOUND":case"CONVERSATIONNOTFOUND":return"conversationNotFound";case"PETNOTFOUND":return"petNotFound";case"TIMEOUT":case"STREAMTIMEOUT":return"streamTimeout";case"MEDIAUPLOADFAILED":case"UNRECOGNIZEDVIDEOFORMAT":case"FILETOOSMALL":return"mediaUploadFailed";case"MODERATIONBLOCKED":return"moderationBlocked";case"UPSTREAMLLMTIMEOUT":return"upstreamLlmTimeout";case"INTERNALERROR":case"INTERNALSERVERERROR":return"internalError";case"STREAMINCOMPLETE":case"CHATSTREAMINCOMPLETE":return"streamIncomplete";case"INVALIDANALYSISTYPE":case"INVALIDUPLOADPURPOSE":return"unknown";default:return"unknown"}}function fromHttpStatus(e){return e===401?"authExpired":e===403?"accessDenied":e===404?"conversationNotFound":e===409?"idempotencyConflict":e===421?"unknown":e===429?"rateLimited":e===400||e===422?"unknown":e>=500?"internalError":"unknown"}var $=/* @__PURE__ */new Set(["streamTimeout","rateLimited","internalError","upstreamLlmTimeout","streamIncomplete"]);function isAutoRetryable(e){return $.has(e)}var T=/* @__PURE__ */new Set(["serviceUnavailable","conflict","idempotencyInFlight"]);function isRetryableCode(e){return isAutoRetryable(e)||T.has(e)}var R="This feature isn't available on your account right now.",A="Something in that request was not right. Check the details and try again.",I=/* @__PURE__ */Object.freeze({authExpired:"Please sign in again to continue.",authRejected:"Please sign in again to continue.",sessionRequired:"This app needs to be updated to keep using Everfur.",accessDenied:R,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:A,sdkUpdateRequired:"This app needs to be updated to keep using Everfur.",conflict:"That is already running. Wait for it to finish, then try again.",idempotencyConflict:"That message was already delivered.",idempotencyInFlight:"That is still processing. Give it a moment.",conversationNotFound:"This conversation is no longer available.",petNotFound:"We could not find that pet. Please pick a pet and try again.",resourceNotFound:"We could not find that.",streamTimeout:"The response timed out. Tap retry to try again.",mediaUploadFailed:"We could not upload that photo. Please attach it again.",moderationBlocked:"This request cannot be answered here.",upstreamLlmTimeout:"The response timed out. Tap retry to try again.",internalError:"We hit a snag on our end. Please try again.",notImplemented:"That is not available yet.",serviceUnavailable:"That service is briefly unavailable. Try again shortly.",streamIncomplete:"The connection dropped mid-answer. Tap retry to continue.",identitySignatureRequired:R,runtimeDisposed:A,unknown:"Something went wrong. Please try again."}),k="This session has ended. Please sign in again.",D="linked_account_read_only";function F(e,t,r){return e==="conflict"&&r===D?R:(e==="authRejected"||e==="authExpired")&&typeof t=="string"&&t.trim().toLowerCase()==="session_revoked"?k:userFacingError(e)}function userFacingError(e){return I[e]}function O(e,t,r){Object.defineProperty(e,t,{value:r,enumerable:false,writable:false,configurable:false})}var j=/^[a-z][a-z0-9_]{0,63}$/;function makeEverfurError(e,t){let r=contractErrorFor(t?.wireCode,t?.wireEnvelope),n=e==="conflict"&&t?.reasonCode===D,a={code:e,category:categoryFor(e),retryable:t?.retryable??(n?false:isRetryableCode(e)),displayMessage:F(e,t?.wireCode,n?D:null)};t?.httpStatus!==void 0&&(a.httpStatus=t.httpStatus),t?.requestId&&(a.requestId=t.requestId),typeof t?.reasonCode=="string"&&j.test(t.reasonCode)&&(a.reasonCode=t.reasonCode);let i=t?.retryAfterSeconds;if(typeof i=="number"&&Number.isFinite(i)&&i>=0&&(a.retryAfterSeconds=Math.round(i)),r);return t?.wireMessage&&O(a,"wireMessage",t.wireMessage),t?.raw!==void 0&&t.raw!==null&&O(a,"raw",t.raw),/* @__PURE__ */Object.freeze(a)}var N="free_cap_reached";function x(e){return typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}function U(e){if(typeof e!="object"||e===null)return null;let t=e,r=t.detail,n=typeof r=="object"&&r!==null?r:t;if(n.error!==N&&n.code!==N)return null;let a=x(n.limit),i=x(n.used);if(a===null||i===null)return null;let o=n.resets_at,l=n.emergency_guidance;/* @__PURE__ */
|
|
7
7
|
return Object.freeze({limit:a,used:i,resetsAt:typeof o=="string"&&o.length>0?o:null,...typeof l=="string"&&l.trim().length>0?{emergencyGuidance:l}:{}})}function q(e,t){if(e.status!==429&&e.status!==503)return t;let r=z(e.headers.get(L),Date.now());if(r===null)return t;let n=t!==null&&typeof t=="object"&&!Array.isArray(t)?t:null;return n!==null&&P(n)?t:{...n??{},retry_after_seconds:r}}var L="retry-after";function z(e,t){if(e===null)return null;let r=e.trim();if(/^\d+$/.test(r))return Number(r);let n=Date.parse(r);return Number.isFinite(n)?Math.max(0,Math.ceil((n-t)/1e3)):null}function P(e){return[e,e.error,e.detail].some(e=>e!==null&&typeof e=="object"&&("retry_after_seconds"in e||"resets_at"in e))}var M="x-request-id";function errorFromResponse(e,t,r){let n=Y(t),a=n?fromWire(n):fromHttpStatus(e),i=V(t);return makeEverfurError(a,{httpStatus:e,...W(t)?{retryable:true}:{},...r?{requestId:r}:{},...n?{wireCode:n}:{},...B(t)?{reasonCode:B(t)}:{},...K(t)!==null?{retryAfterSeconds:K(t)}:{},...i?{wireMessage:i}:{},...t!=null?{raw:t}:{}})}function K(e){let t=e,r=t?.retry_after_seconds??t?.error?.retry_after_seconds;return typeof r=="number"&&Number.isFinite(r)&&r>=0?r:null}function networkError(e){return makeEverfurError("internalError",{retryable:true,wireMessage:Z(e)})}function requestIdOf(e){let t=e.headers.get(M);return typeof t=="string"&&t.length>0?t:null}function getGlobalFetch(){let t=globalThis.fetch;if(typeof t!="function")throw new e("missing-peer-dependency","global fetch is unavailable; provide config.transport or an injected fetch implementation");return t}function B(e){let t=e,r=t?.error?.reason_code??t?.reason_code;return typeof r=="string"&&r.length>0?r:null}function Y(e){let t=e,r=t?.error?.code??t?.code;return typeof r=="string"&&r.length>0?m(r,e):U(e)!==null?N:null}function V(e){let t=e,r=t?.error?.message??t?.message;return typeof r=="string"&&r.length>0?r:null}function W(e){let t=e;return t?.error?.retryable===true||t?.retryable===true}function Z(e){return e instanceof Error?e.message:typeof e=="string"?e:"network request failed"}var G=["sk_partner_","rk_partner_"];function Q(t,r){if(typeof t!="string"||t.length===0)throw new e("invalid-argument","partnerSecretKey is required");if(t.startsWith("pk_"))throw new e("invalid-argument",`partnerSecretKey is a publishable key (pk_...): ${r} needs your secret key, server side only`);if(!G.some(e=>t.startsWith(e)))throw new e("invalid-argument","partnerSecretKey must be an sk_partner_ secret key or an rk_partner_ restricted key")}var X=128;function assertValidUserRef(t){let r=typeof t=="string"?[...t].length:0;if(typeof t!="string"||r<1||r>X)throw new e("invalid-argument",`user_ref must be 1..${X} characters`);if(t.trim().length===0)throw new e("invalid-argument","user_ref must not be blank: the server strips surrounding whitespace before validating, so a whitespace-only value arrives empty and is rejected as required.");if(t!==t.trim())throw new e("invalid-argument","user_ref must not have leading or trailing whitespace: the server strips it, so padded and unpadded forms of the same id resolve to ONE user. Pass the exact id you want to key on.");if(t.includes("@"))throw new e("invalid-argument","user_ref must not contain '@'");if(!H(t))throw new e("invalid-argument","user_ref must be printable (no control characters)");return t}function H(e){return!J.test(e)}var J=/[\p{Cc}\p{Cf}\p{Cs}\p{Co}\p{Cn}\p{Zl}\p{Zp}]|(?!\u0020)[\p{Zs}]/u,ee="user_ref_invalid";function te(e){let t=e.raw,r=typeof t=="object"&&t!==null?t:null,n=(r!==null&&typeof r.error=="object"&&r.error!==null?r.error.code:void 0)??r?.code;return n!==ee&&e.reasonCode!==ee?e:makeEverfurError("validationFailed",{retryable:false,...e.httpStatus!==void 0?{httpStatus:e.httpStatus}:{},...e.requestId!==void 0?{requestId:e.requestId}:{},...typeof n=="string"?{wireCode:n}:{},reasonCode:ee,...e.wireMessage!==void 0?{wireMessage:e.wireMessage}:{},...t!==void 0?{raw:t}:{}})}function re(e){let t=e.raw;if(typeof t!="object"||t===null)return null;let r=t.code;return typeof r=="string"&&r.length>0?r:null}function ne(e,t){let r=re(e);if(r===null)return e;let n=t[r];return n===void 0?e:makeEverfurError(n.code,{retryable:n.retryable,...e.httpStatus!==void 0?{httpStatus:e.httpStatus}:{},...e.requestId!==void 0?{requestId:e.requestId}:{},wireCode:r,reasonCode:r,...e.wireMessage!==void 0?{wireMessage:e.wireMessage}:{},raw:e.raw})}function ae(e,t){let r=ne(e,t);if(r!==e||re(e)!==null)return r;let n=e.reasonCode;if(typeof n!="string")return e;let a=t[n];return a===void 0?e:makeEverfurError(a.code,{retryable:a.retryable,...e.httpStatus!==void 0?{httpStatus:e.httpStatus}:{},...e.requestId!==void 0?{requestId:e.requestId}:{},wireCode:n,reasonCode:n,...e.wireMessage!==void 0?{wireMessage:e.wireMessage}:{},raw:e.raw})}var ie=64;function oe(t){if(t!=null){if(typeof t!="string"||t.length===0||t.length>ie||/\s/.test(t))throw new e("invalid-argument",`timezone must be an IANA zone name such as 'America/Chicago' (at most ${ie} characters)`);return t}}function le(e){for(let t=0;t<e.length;t+=1){let r=e.charCodeAt(t);if(r>=55296&&r<=56319){let r=e.charCodeAt(t+1);if(!(r>=56320&&r<=57343))return true;t+=1}else if(r>=56320&&r<=57343)return true}return false}function se(e){return[...e].length}var ue=/* @__PURE__ */Object.freeze({dog:"dog",canine:"dog",k9:"dog",puppy:"dog",cat:"cat",feline:"cat",kitten:"cat"});function canonicalPetSpecies(e){if(typeof e!="string")return null;let t=e.trim().toLowerCase();return Object.prototype.hasOwnProperty.call(ue,t)?ue[t]:null}var de=50,pe=128,ce=120,fe=120,ve=2e3,_e=120,he=80,me=/* @__PURE__ */new Set(["male","female","unknown"]),ye=/* @__PURE__ */new Set(["day","month","year"]),be=/* @__PURE__ */new Set(["low","medium","high","athletic"]),ge=/* @__PURE__ */new Set(["indoor","outdoor","both"]),we=/* @__PURE__ */new Set(["mild","moderate","severe"]),Se=/^(\d{4})-(\d{2})-(\d{2})$/,Ce=[["sex","sex"],["spayedNeutered","spayed_neutered"],["birthDate","birth_date"],["birthDatePrecision","birth_date_precision"],["activityLevel","activity_level"],["indoorOutdoor","indoor_outdoor"],["foodBrand","food_brand"],["foodType","food_type"],["microchipId","microchip_id"]],Ee=[["allergies","allergies"],["medications","medications"],["supplements","supplements"],["conditions","conditions"]];/* @__PURE__ */Object.freeze([...Ce,...Ee].map(([e])=>e));function $e(e){let t=Se.exec(e);if(t===null)return false;let[r,n,a]=[Number(t[1]),Number(t[2]),Number(t[3])],i=new Date(Date.UTC(r,n-1,a));return i.getUTCFullYear()===r&&i.getUTCMonth()===n-1&&i.getUTCDate()===a}var Te=e=>(t,r)=>typeof r=="string"&&e.has(r)?null:`${t} must be one of ${[...e].join(", ")}`,Re=(e,t)=>typeof t=="boolean"?null:`${e} must be true or false`,Ae=(e,t)=>typeof t=="string"&&$e(t)?null:`${e} must be a real date written YYYY-MM-DD`,Ie=(e,t={})=>(r,n)=>{if(typeof n!="string")return`${r} must be a string`;if(le(n))return`${r} contains an unpaired surrogate and cannot be encoded`;let a=t.trimmed?n.trim():n;if(t.required&&a.length===0)return`${r} is required and must not be blank`;let i=se(a);return i<=e?null:`${r} is ${i} characters; the server accepts at most ${e}`},ke={sex:Te(me),spayedNeutered:Re,birthDate:Ae,birthDatePrecision:Te(ye),activityLevel:Te(be),indoorOutdoor:Te(ge),foodBrand:Ie(_e),foodType:Ie(_e),microchipId:Ie(he)},De=["ref","ref",false,Ie(pe,{required:true,trimmed:true})],Fe=["notes","notes",false,Ie(ve,{trimmed:true})],Oe=[De,["name","name",true,Ie(ce,{required:true,trimmed:true})],["dose","dose",false,Ie(fe,{trimmed:true})],["frequency","frequency",false,Ie(fe,{trimmed:true})],["startDate","start_date",false,Ae],["endDate","end_date",false,Ae],Fe],je={allergies:[De,["allergen","allergen",true,Ie(ce,{required:true,trimmed:true})],["severity","severity",false,Te(we)],Fe],medications:Oe,supplements:Oe,conditions:[De,["conditionName","condition_name",true,Ie(ce,{required:true,trimmed:true})],["diagnosedDate","diagnosed_date",false,Ae],Fe]};function Ne(e,t,r){let n=`${e}[${t}]`;if(typeof r!="object"||r===null||Array.isArray(r))return{error:`${n} must be an object`};let a=r,i={};for(let[t,r,o,l]of je[e]){let e=a[t];if(e==null){if(o)return{error:`${n}.${t} is required`};e===null&&(i[r]=null);continue}let s=l(`${n}.${t}`,e);if(s!==null)return{error:s};i[r]=e}let o=i.start_date,l=i.end_date;return typeof o=="string"&&typeof l=="string"&&l<o?{error:`${n}.endDate must not be before startDate`}:{item:i}}function xe(e,t){if(!Array.isArray(t))return{error:`${e} must be an array (send [] to clear it)`};if(t.length>de)return{error:`${e} has ${t.length} items; the server accepts at most ${de}`};let r=[],n=/* @__PURE__ */new Set;for(let a=0;a<t.length;a+=1){let i=Ne(e,a,t[a]);if("error"in i)return i;let o=i.item.ref;if(typeof o=="string"){let t=o.trim();if(n.has(t))return{error:`${e}: ref ${JSON.stringify(t)} is used twice; a ref names one item`};n.add(t)}r.push(i.item)}return{items:r}}function Ue(e,t){let r=e,n={};for(let[e,t]of Ce){let a=r[e];if(a!==void 0){if(a!==null){let t=ke[e](e,a);if(t!==null)return{error:t}}n[t]=a}}let a=r.birthDate!==void 0,i=r.birthDatePrecision!==void 0;if(a!==i||a&&r.birthDate===null!=(r.birthDatePrecision===null))return{error:"birthDate and birthDatePrecision must be sent together, both set or both null"};for(let[e,t]of Ee){let a=r[e];if(a===void 0)continue;let i=xe(e,a);if("error"in i)return i;n[t]=i.items}return Object.keys(n).length>0&&t!==void 0&&canonicalPetSpecies(t)===null?{error:"health fields need a pet Everfur reads as a dog or a cat (dog, canine, k9, puppy, cat, feline, kitten)"}:{body:n}}var qe=e=>typeof e=="string"?e:null,Le=(e,t)=>typeof t=="string"&&e.has(t)?t:null,ze=e=>typeof e=="boolean"?e:null;function Pe(e,t){return Array.isArray(e)?/* @__PURE__ */Object.freeze(e.flatMap(e=>{if(typeof e!="object"||e===null||Array.isArray(e))return[];let r=t(e);return r===null?[]:[r]})):/* @__PURE__ */Object.freeze([])}function Me(e){let t=qe(e.name);return t===null||t.length===0?null:/* @__PURE__ */Object.freeze({ref:qe(e.ref),name:t,dose:qe(e.dose),frequency:qe(e.frequency),startDate:qe(e.start_date),endDate:qe(e.end_date),notes:qe(e.notes)})}function Ke(e){let t=e.profile_version;/* @__PURE__ */
|
package/dist/tabs/index.cjs
CHANGED
|
@@ -178,35 +178,35 @@ return a.jsxs(i.ScrollView,{style:r,contentContainerStyle:{gap:14,paddingHorizon
|
|
|
178
178
|
/* @__PURE__ */a.jsx(i.View,{style:{gap:4},children:t.legal.map(e=>/* @__PURE__ */a.jsx(Text,{style:{fontFamily:l,fontSize:12,color:d},children:e},e))}),t.privacy!==null?/* @__PURE__ */a.jsx(Text,{style:{fontFamily:l,fontSize:12,color:d},testID:"everfur-sdk-vet-privacy",children:t.privacy}):null]})}function dl(e){return sdkText(e,"text.tabs.ask")}function SdkLauncherView({config:e,onPress:t,replyWaiting:n,tipSeen:r,onTipSeen:l,style:s}){let d=e.settings,c=d["layout.presentation"]==="full_screen",u=d["look.ask_icon"]===_a?"":d["look.ask_icon"],[p,f]=o.useState(c&&!r);o.useEffect(()=>{(!c||r)&&f(false)},[c,r]);let h=()=>{f(false),l()};/* @__PURE__ */
|
|
179
179
|
return a.jsxs(i.View,{style:[{alignItems:"flex-end",gap:8},s],pointerEvents:"box-none",testID:"everfur-sdk-launcher",children:[p?/* @__PURE__ */a.jsx(i.Pressable,{accessibilityRole:"button",onPress:h,style:{maxWidth:240,backgroundColor:al,borderRadius:14,borderWidth:1,borderColor:d["look.color.line"],paddingHorizontal:14,paddingVertical:10},testID:"everfur-sdk-launcher-tip",children:/* @__PURE__ */a.jsx(Text,{style:{fontFamily:d["look.font.body"],fontSize:14,color:d["look.color.ink"]},children:sdkText(e,"text.launcher.tip")})}):null,
|
|
180
180
|
/* @__PURE__ */a.jsxs(i.Pressable,{accessibilityRole:"button",accessibilityLabel:dl(e),onPress:()=>{p&&h(),t()},style:{width:60,height:60,borderRadius:30,backgroundColor:d["look.color.launcher"],alignItems:"center",justifyContent:"center"},testID:"everfur-sdk-launcher-button",children:[
|
|
181
|
-
/* @__PURE__ */a.jsx(SdkBrandArt,{url:u,style:{width:c?24:30,height:c?24:30},fallback:/* @__PURE__ */a.jsx(ShellIcon,{name:"wordmark",style:{width:36,height:13,tintColor:d["look.color.on_launcher"]}})}),c?/* @__PURE__ */a.jsx(Text,{tier:"badge",style:{fontFamily:d["look.font.body"],fontSize:10,color:d["look.color.on_launcher"]},children:dl(e)}):null,c&&n?/* @__PURE__ */a.jsx(i.View,{style:{position:"absolute",top:2,right:2,width:12,height:12,borderRadius:6,backgroundColor:"#C03410",borderWidth:2,borderColor:al},testID:"everfur-sdk-launcher-dot"}):null]})]})}var cl=true;function ul(e,t,n,r){if(n===null)return e;let o=r&&e.vetOnAsk!=="none",i=mt(cl,n).filter(e=>e==="vet"?o:e==="ask"?t["features.chat"]:e==="records"?t["features.records"]:false);e.nav==="chat_first"&&!i.includes("ask")&&i.unshift("ask"),i.length===0&&i.push(t["features.records"]&&!t["features.chat"]?"records":"ask");let a=i.includes("vet"),l=o?a?"own_tab":e.vetOnAsk==="own_tab"?"in_answers":e.vetOnAsk:"none",s=e.vetBadge==="header_pill"&&e.presentation==="full_screen"&&l==="own_tab"?"tab_dot":e.vetBadge;/* @__PURE__ */
|
|
182
|
-
return Object.freeze({...e,sections:/* @__PURE__ */Object.freeze(i),vetOnAsk:l,vetBadge:s})}function
|
|
183
|
-
return a.jsx(EverfurTabs,{petRef:l?.petRef??null,petName:l?.name??null,opened:
|
|
181
|
+
/* @__PURE__ */a.jsx(SdkBrandArt,{url:u,style:{width:c?24:30,height:c?24:30},fallback:/* @__PURE__ */a.jsx(ShellIcon,{name:"wordmark",style:{width:36,height:13,tintColor:d["look.color.on_launcher"]}})}),c?/* @__PURE__ */a.jsx(Text,{tier:"badge",style:{fontFamily:d["look.font.body"],fontSize:10,color:d["look.color.on_launcher"]},children:dl(e)}):null,c&&n?/* @__PURE__ */a.jsx(i.View,{style:{position:"absolute",top:2,right:2,width:12,height:12,borderRadius:6,backgroundColor:"#C03410",borderWidth:2,borderColor:al},testID:"everfur-sdk-launcher-dot"}):null]})]})}var cl=true;function ul(e,t,n){return n&&t==null?"visits":e}function pl(e,t,n,r){if(n===null)return e;let o=r&&e.vetOnAsk!=="none",i=mt(cl,n).filter(e=>e==="vet"?o:e==="ask"?t["features.chat"]:e==="records"?t["features.records"]:false);e.nav==="chat_first"&&!i.includes("ask")&&i.unshift("ask"),i.length===0&&i.push(t["features.records"]&&!t["features.chat"]?"records":"ask");let a=i.includes("vet"),l=o?a?"own_tab":e.vetOnAsk==="own_tab"?"in_answers":e.vetOnAsk:"none",s=e.vetBadge==="header_pill"&&e.presentation==="full_screen"&&l==="own_tab"?"tab_dot":e.vetBadge;/* @__PURE__ */
|
|
182
|
+
return Object.freeze({...e,sections:/* @__PURE__ */Object.freeze(i),vetOnAsk:l,vetBadge:s})}function fl(e,t,n){let r=t.vetOnAsk!=="none";return n?t.sections.includes(e)?e:e==="vet"&&r?"vet":gl(yt(e,cl,t.sections)):e==="vet"&&!r?"ask":e}function hl(e,t,n){if(!n)return e??t.sections[0]??"ask";let r=wt(e===void 0?{via:"plain"}:{via:"link",tab:e},cl,t.sections);return e==="vet"&&r!=="vet"?fl("vet",t,true):gl(r)}function gl(e){return e==="plan"?"ask":e}function bl(e){return e===void 0?{section:void 0,key:null}:typeof e=="string"?{section:e,key:null}:{section:e.section,key:e.key}}function ml(e){let t=e.activePetRef;return e.pets.find(e=>e.petRef===t)??e.pets[0]??null}function EverfurSdkApp(e){let t=Ua(),n=useEverfurSdkConfig();o.useEffect(()=>{if(t===null)return;t.adoptLatest(),t.load();let e=i.AppState.addEventListener("change",e=>{e==="active"&&t.retry()});return()=>e.remove()},[t]);let r=o.useCallback(()=>{t?.retry()},[t]);return n.active!==null?/* @__PURE__ */a.jsx(SdkShell,{...e,config:n.active}):n.status==="legacy"?/* @__PURE__ */a.jsx(LegacyPath,{...e}):/* @__PURE__ */a.jsx(SdkNeutralScreen,{failed:n.status==="failed",onRetry:r})}var yl=/* @__PURE__ */Object.freeze({branding:null}),vl=/* @__PURE__ */Object.freeze({subscribe:()=>()=>{},getSnapshot:()=>yl});function kl(e,t){let n=o.useContext(Pe)?.runtime?.entitlements??vl,r=o.useCallback(()=>n.getSnapshot()?.branding??null,[n]),i=o.useSyncExternalStore(n.subscribe,r,r),a=e===void 0?"":e.join(",");return o.useMemo(()=>{let n=resolvePresentation({server:i?.presentation??null,locked:i?.lockedFields??null,client:{...e===void 0?{}:{shellTabs:e},...t===void 0?{}:{shellHeader:t}}});return{shellTabs:n.shellTabs??null,shellHeader:Bi(n.shellHeader)?"tabs_bar":"classic"}},[i,a,t])}function wl(e,t){let n=()=>{if(t===null)return;let n=e.pets.findIndex(e=>e.petRef===t.petRef),r=e.pets[(n+1)%e.pets.length];r!==void 0&&r.petRef!==t.petRef&&e.onPetChange?.(r.petRef)},r=e.onPickPet??(e.pets.length>1&&e.onPetChange!==void 0?n:void 0);return{...t?.photoUrl===void 0?{}:{petPhotoUrl:t.photoUrl},...r===void 0?{}:{onPet:r}}}function LegacyPath({host:e,renderLegacy:t,section:n,tabs:r,headerStyle:o}){let i=kl(r,o);if(t!==void 0)return t();let l=ml(e),s=i.shellHeader==="tabs_bar";/* @__PURE__ */
|
|
183
|
+
return a.jsx(EverfurTabs,{petRef:l?.petRef??null,petName:l?.name??null,opened:xl(n,i.shellTabs?.includes("vet")===true),...r===void 0?{}:{tabs:r},...o===void 0?{}:{headerStyle:o},...s?{header:wl(e,l)}:{},...s&&e.onClose!==void 0?{onClose:e.onClose}:{},...e.vetMessageWaiting===true?{badges:{vet:true}}:{}})}function xl(e,t){let{section:n,key:r}=bl(e);return n===void 0||n==="vet"&&!t?{via:"plain"}:r===null?{via:"link",tab:n}:{via:"link",tab:n,key:r}}function _l(e,t,n){let r=Ua(),i=e.settings["access.mode"]==="free_cap",a=capMonth(/* @__PURE__ */new Date),[l,s]=o.useState(()=>r?.peekFreeUsed(t,a)??0),d=o.useRef(true),c=o.useRef(n);c.current=n,o.useEffect(()=>{if(d.current=true,!(r===null||!i))return r.readFreeUsed(t,a).then(e=>{d.current&&s(e)}),()=>{d.current=false}},[r,i,t,a]);let u=o.useMemo(()=>!i||r===null?null:{onMessageSent:()=>{r.addFreeUsed(t,a).then(e=>{d.current&&s(e)})},onFreeCapReached:e=>{r.setFreeUsed(t,a,e.used).then(e=>{d.current&&s(e)}),c.current(e)}},[i,r,t,a]);return{used:l,hooks:u}}var Sl=Ge.heading;function SdkShell({host:e,section:t,onSectionChange:n,chat:r,records:l,style:s,config:d,tabs:c,headerStyle:u}){let p=d.settings,f=o.useContext(Pe),h=ml(e),g=kl(c,u),b=g.shellTabs!==null,m=ul(vetLevelFor(d.stateGate,h?.location??null),h?.location,b),y=g.shellHeader==="tabs_bar";un(y);let v=Ut("televet"),k=o.useMemo(()=>pl(resolveLayout(p,m),p,g.shellTabs,v),[p,m,g.shellTabs,v]),w=e.membership??"unknown",x=e.userId??f?.userRef??"anonymous",_=o.useRef(()=>{}),{used:S,hooks:C}=_l(d,x,e=>_.current(e)),R=askAccess(d,w,S),{tablet:j,column:A}=Zn(),F=bl(t),[T,I]=o.useState(()=>hl(F.section,k,b));o.useEffect(()=>{F.section!==void 0&&I(F.section)},[F.section,F.key]);let E=o.useCallback(e=>{I(e),n?.(e)},[n]),P=k.vetOnAsk!=="none",D=fl(T,k,b),O=k.closeControl!=="none",[z,B]=o.useState(null),[V,N]=o.useState(null),$=o.useCallback(e=>(N(e),()=>N(t=>t===e?null:t)),[]),L=o.useCallback((e,t=null)=>{let n={sheet:e.kind==="members"?membersSheet(d):planSheet(d,h?.name),reason:e,notice:t};B(r=>t===null&&e.kind==="cap"&&r?.reason.kind==="cap"?{...n,notice:r.notice}:n)},[d,h?.name]);_.current=e=>L({kind:"cap"},e.emergencyGuidance??null);let M=()=>{z!==null&&(e.onOpenPlan?.(z.reason,z.sheet.soldBy),B(null))};o.useEffect(()=>{R.kind==="members_only"?L({kind:"members"}):R.kind==="cap_reached"&&L({kind:"cap"})},[R.kind,L]);let U=e=>isLocked(d,w,e),W={flex:1,backgroundColor:p["look.color.surface"]},q=D==="vet"?/* @__PURE__ */a.jsx(VetPane2,{config:d,pet:h,level:m,tabsBar:y,locked:U("video_visits"),onLocked:()=>L({kind:"locked",part:"video_visits"}),onAsk:()=>E("ask")}):D==="records"?/* @__PURE__ */a.jsx(RecordsPane,{config:d,host:e,pet:h,tabsBar:y,shellPush:$,vetShown:P,records:l,onPlan:e=>L({kind:"locked",part:e}),onVet:()=>P?E("vet"):void 0,locked:U,onAsk:()=>E("ask")}):/* @__PURE__ */a.jsx(AskPane,{config:d,layout:k,pet:h,level:m,access:R,hooks:C,chat:r,locked:U,tabsBar:y,onRecords:()=>E("records"),onVet:()=>E("vet"),onPlan:()=>L({kind:R.kind==="members_only"?"members":"cap"})}),H=/* @__PURE__ */a.jsx(SdkColumnScope,{children:q});/* @__PURE__ */
|
|
184
184
|
return a.jsx(ShellSafeArea,{framed:O,children:t=>/* @__PURE__ */a.jsxs(i.View,{style:[W,s],testID:`everfur-sdk-app-${k.nav}`,children:[
|
|
185
|
-
/* @__PURE__ */a.jsx(Framed,{framed:O,insets:t,children:/* @__PURE__ */a.jsxs(i.View,{style:A,testID:j?"everfur-sdk-column-tablet":"everfur-sdk-column-phone",children:[y?/* @__PURE__ */a.jsx(TabsBar,{config:d,layout:k,host:e,pet:h,section:D,level:
|
|
186
|
-
/* @__PURE__ */a.jsx(i.View,{style:{flex:1},children:H}),!y&&k.nav==="bottom_tabs"?/* @__PURE__ */a.jsx(SectionNav,{config:d,layout:k,level:
|
|
187
|
-
/* @__PURE__ */a.jsx(s.SafeAreaProvider,{initialMetrics:n===null?s.initialWindowMetrics:null,children:/* @__PURE__ */a.jsx(MeasuredInsets,{children:t})}):t(
|
|
185
|
+
/* @__PURE__ */a.jsx(Framed,{framed:O,insets:t,children:/* @__PURE__ */a.jsxs(i.View,{style:A,testID:j?"everfur-sdk-column-tablet":"everfur-sdk-column-phone",children:[y?/* @__PURE__ */a.jsx(TabsBar,{config:d,layout:k,host:e,pet:h,section:D,level:m,onSection:E,deep:D==="records"?V:null}):/* @__PURE__ */a.jsx(Header,{config:d,layout:k,host:e,pet:h,section:D,level:m,onSection:E}),y||k.nav==="bottom_tabs"||k.nav==="chat_first"?null:/* @__PURE__ */a.jsx(SectionNav,{config:d,layout:k,level:m,section:D,onSection:E,vetDot:e.vetMessageWaiting===true}),
|
|
186
|
+
/* @__PURE__ */a.jsx(i.View,{style:{flex:1},children:H}),!y&&k.nav==="bottom_tabs"?/* @__PURE__ */a.jsx(SectionNav,{config:d,layout:k,level:m,section:D,onSection:E,vetDot:e.vetMessageWaiting===true,bottom:true}):null]})}),z!==null?/* @__PURE__ */a.jsx(SdkSheet,{sheet:z.sheet,settings:p,onPrimary:M,onDismiss:()=>B(null),notice:z.notice,bottomInset:t.bottom}):null]})})}var Cl=/* @__PURE__ */Object.freeze({top:0,bottom:0,left:0,right:0});function ShellSafeArea({framed:e,children:t}){let n=o.useContext(s.SafeAreaInsetsContext);return e?
|
|
187
|
+
/* @__PURE__ */a.jsx(s.SafeAreaProvider,{initialMetrics:n===null?s.initialWindowMetrics:null,children:/* @__PURE__ */a.jsx(MeasuredInsets,{children:t})}):t(Cl)}function MeasuredInsets({children:e}){return e(s.useSafeAreaInsets())}function Framed({framed:e,insets:t,children:n}){return e?/* @__PURE__ */a.jsx(i.View,{style:{flex:1,paddingTop:t.top,paddingBottom:t.bottom,paddingLeft:t.left,paddingRight:t.right},testID:"everfur-sdk-safe-area",children:n}):n}function Rl(e,t,n){return t==="vet"?vetTabLabel(e,n):sdkText(e,t==="ask"?"text.tabs.ask":"text.tabs.records")}function SectionNav({config:e,layout:t,level:n,section:r,onSection:o,vetDot:l,bottom:s=false}){let d=e.settings;return t.sections.length<2?null:/* @__PURE__ */a.jsx(i.View,{accessibilityRole:"tablist",style:[{flexDirection:"row",borderColor:d["look.color.line"],backgroundColor:d["look.color.surface"]},s?{borderTopWidth:1,paddingBottom:6}:{borderBottomWidth:1,paddingHorizontal:8}],testID:s?"everfur-sdk-tabs-bottom":"everfur-sdk-tabs-top",children:t.sections.map(c=>{let u=c===r;/* @__PURE__ */
|
|
188
188
|
return a.jsxs(i.Pressable,{accessibilityRole:"tab",accessibilityState:{selected:u},onPress:()=>o(c),style:{flex:s?1:0,minHeight:44,paddingHorizontal:12,alignItems:"center",justifyContent:"center",flexDirection:"row",gap:6,borderBottomWidth:s?0:2,borderBottomColor:u?d["look.color.primary"]:"transparent"},testID:`everfur-sdk-tab-${c}`,children:[
|
|
189
|
-
/* @__PURE__ */a.jsx(Text,{tier:"control",style:{fontFamily:d["look.font.body"],fontSize:15,fontWeight:u?"600":"400",color:u?d["look.color.heading"]:d["look.color.muted"]},children:
|
|
189
|
+
/* @__PURE__ */a.jsx(Text,{tier:"control",style:{fontFamily:d["look.font.body"],fontSize:15,fontWeight:u?"600":"400",color:u?d["look.color.heading"]:d["look.color.muted"]},children:Rl(e,c,n)}),c==="vet"&&l&&t.vetBadge==="tab_dot"?/* @__PURE__ */a.jsx(i.View,{style:{width:7,height:7,borderRadius:4,backgroundColor:d["look.color.dot"]},testID:"everfur-sdk-vet-dot"}):null]},c)})})}function Header({config:e,layout:t,host:n,pet:r,section:o,level:l,onSection:s}){let d=e.settings,c=d["look.color.heading"],u=(e,t,n)=>/* @__PURE__ */a.jsx(i.Pressable,{accessibilityRole:"button",onPress:t,style:{minWidth:44,minHeight:44,alignItems:"center",justifyContent:"center"},testID:n,children:/* @__PURE__ */a.jsx(Text,{tier:"control",style:{fontSize:20,color:c},children:e})});if(t.nav==="sections_page"){let t=sdkText(e,"text.nav.page_title"),n=/* @__PURE__ */a.jsxs(i.View,{style:{flexDirection:"row",alignItems:"center",gap:12,paddingHorizontal:16,paddingTop:12,paddingBottom:8},testID:"everfur-sdk-header-sections",children:[t!==""?/* @__PURE__ */a.jsx(Text,{tier:"heading",accessibilityRole:"header",style:{fontFamily:d["look.font.heading"],fontWeight:String(d["look.font.heading_weight"]),fontSize:24,color:c},children:t}):null,
|
|
190
190
|
/* @__PURE__ */a.jsx(SdkLockup,{settings:d})]});return o==="ask"?/* @__PURE__ */a.jsxs(i.View,{children:[n,
|
|
191
191
|
/* @__PURE__ */a.jsx(MemoryRow,{config:e,pet:r})]}):n}if(t.nav==="chat_first"){let p=t.vetOnAsk==="header_button"&&o==="ask";/* @__PURE__ */
|
|
192
192
|
return a.jsxs(i.View,{testID:"everfur-sdk-header-chat-first",children:[
|
|
193
193
|
/* @__PURE__ */a.jsxs(i.View,{style:{flexDirection:"row",alignItems:"center",paddingHorizontal:8,minHeight:52},children:[u("↓",n.onClose,"everfur-sdk-down"),
|
|
194
|
-
/* @__PURE__ */a.jsx(Text,{tier:"heading",numberOfLines:1,style:{flex:1,textAlign:"center",fontFamily:d["look.font.heading"],fontWeight:String(d["look.font.heading_weight"]),fontSize:17,color:c},children:o==="ask"?sdkText(e,"text.ask.name"):
|
|
194
|
+
/* @__PURE__ */a.jsx(Text,{tier:"heading",numberOfLines:1,style:{flex:1,textAlign:"center",fontFamily:d["look.font.heading"],fontWeight:String(d["look.font.heading_weight"]),fontSize:17,color:c},children:o==="ask"?sdkText(e,"text.ask.name"):Rl(e,o,l)}),p?/* @__PURE__ */a.jsx(VetPill,{config:e,layout:t,level:l,waiting:n.vetMessageWaiting===true,onPress:()=>s("vet")}):o!=="ask"?u("×",()=>s("ask"),"everfur-sdk-back-to-ask"):/* @__PURE__ */a.jsx(i.View,{style:{minWidth:44}})]}),o==="ask"?/* @__PURE__ */a.jsx(MemoryRow,{config:e,pet:r,withLockup:true}):null]})}let p=t.presentation==="full_screen",f=t.vetOnAsk==="header_button"&&o==="ask";/* @__PURE__ */
|
|
195
195
|
return a.jsxs(i.View,{testID:`everfur-sdk-header-${t.nav}`,children:[
|
|
196
196
|
/* @__PURE__ */a.jsxs(i.View,{style:{flexDirection:"row",alignItems:"center",paddingHorizontal:8,minHeight:52,gap:8},children:[
|
|
197
197
|
/* @__PURE__ */a.jsx(i.View,{style:{flex:1,alignItems:"flex-start"},children:p?/* @__PURE__ */a.jsx(PetSwitcher,{config:e,host:n,pet:r}):null}),
|
|
198
198
|
/* @__PURE__ */a.jsx(SdkLockup,{settings:d}),
|
|
199
|
-
/* @__PURE__ */a.jsxs(i.View,{style:{flex:1,alignItems:"flex-end"},children:[f?/* @__PURE__ */a.jsx(VetPill,{config:e,layout:t,level:l,waiting:n.vetMessageWaiting===true,onPress:()=>s("vet")}):null,p?u("×",n.onClose,"everfur-sdk-close"):null]})]}),t.nav==="bottom_tabs"&&t.vetOnAsk==="top"&&(o==="ask"||o==="vet")?/* @__PURE__ */a.jsx(AskVetSwitch,{config:e,level:l,section:o,onSection:s}):null,o==="ask"?/* @__PURE__ */a.jsx(MemoryRow,{config:e,pet:r}):null]})}function
|
|
200
|
-
/* @__PURE__ */a.jsx(m.TabsBarHeader,{options:
|
|
201
|
-
return a.jsx(i.View,{accessibilityRole:"tablist",style:{flexDirection:"row",borderBottomWidth:1,borderColor:o["look.color.line"],paddingHorizontal:8},testID:"everfur-sdk-ask-vet-switch",children:["ask","vet"].map(l=>/* @__PURE__ */a.jsx(i.Pressable,{accessibilityRole:"tab",accessibilityState:{selected:n===l},onPress:()=>r(l),style:{minHeight:44,paddingHorizontal:12,justifyContent:"center",borderBottomWidth:2,borderBottomColor:n===l?o["look.color.primary"]:"transparent"},testID:`everfur-sdk-switch-${l}`,children:/* @__PURE__ */a.jsx(Text,{tier:"control",style:{fontFamily:o["look.font.body"],fontSize:15,color:n===l?o["look.color.heading"]:o["look.color.muted"]},children:
|
|
199
|
+
/* @__PURE__ */a.jsxs(i.View,{style:{flex:1,alignItems:"flex-end"},children:[f?/* @__PURE__ */a.jsx(VetPill,{config:e,layout:t,level:l,waiting:n.vetMessageWaiting===true,onPress:()=>s("vet")}):null,p?u("×",n.onClose,"everfur-sdk-close"):null]})]}),t.nav==="bottom_tabs"&&t.vetOnAsk==="top"&&(o==="ask"||o==="vet")?/* @__PURE__ */a.jsx(AskVetSwitch,{config:e,level:l,section:o,onSection:s}):null,o==="ask"?/* @__PURE__ */a.jsx(MemoryRow,{config:e,pet:r}):null]})}function jl(e,t){let n=Rl(e,"ask",t),r=Rl(e,"records",t),o=ft.plan;return{ask:n,vet:Rl(e,"vet",t),plan:o,records:r,listAll:`${n}, ${o} and ${r}`,listNoPlan:`${n} and ${r}`}}function TabsBar({config:e,layout:t,host:n,pet:r,section:l,level:s,onSection:d,deep:c}){let u=o.useMemo(()=>jl(e,s),[e,s]),p=o.useCallback(e=>d(e==="plan"?"ask":e),[d]),f=!t.sections.includes(l),h=c??(f?{title:Rl(e,l,s),onBack:()=>d("ask")}:null),g=t.closeControl==="none"?void 0:n.onClose,b=n.vetMessageWaiting===true&&t.vetBadge!=="none"?{vet:true}:void 0,m=zi()?.header;return m===void 0?null:/* @__PURE__ */a.jsxs(i.View,{testID:"everfur-sdk-header-tabs-bar",children:[
|
|
200
|
+
/* @__PURE__ */a.jsx(m.TabsBarHeader,{options:wl(n,r),pushed:h,petRef:r?.petRef??null,petName:r?.name??"",copy:Ii,onClose:g}),c!==null||t.sections.length<2?null:/* @__PURE__ */a.jsx(m.SubTabs,{tabs:t.sections,sub:l,copy:u,badges:b,onOpen:p}),l==="ask"?/* @__PURE__ */a.jsx(MemoryRow,{config:e,pet:r}):null]})}function AskVetSwitch({config:e,level:t,section:n,onSection:r}){let o=e.settings;/* @__PURE__ */
|
|
201
|
+
return a.jsx(i.View,{accessibilityRole:"tablist",style:{flexDirection:"row",borderBottomWidth:1,borderColor:o["look.color.line"],paddingHorizontal:8},testID:"everfur-sdk-ask-vet-switch",children:["ask","vet"].map(l=>/* @__PURE__ */a.jsx(i.Pressable,{accessibilityRole:"tab",accessibilityState:{selected:n===l},onPress:()=>r(l),style:{minHeight:44,paddingHorizontal:12,justifyContent:"center",borderBottomWidth:2,borderBottomColor:n===l?o["look.color.primary"]:"transparent"},testID:`everfur-sdk-switch-${l}`,children:/* @__PURE__ */a.jsx(Text,{tier:"control",style:{fontFamily:o["look.font.body"],fontSize:15,color:n===l?o["look.color.heading"]:o["look.color.muted"]},children:Rl(e,l,t)})},l))})}function VetPill({config:e,layout:t,level:n,waiting:r,onPress:o}){let l=e.settings,s=t.vetBadge==="header_pill"&&r;/* @__PURE__ */
|
|
202
202
|
return a.jsxs(i.Pressable,{accessibilityRole:"button",onPress:o,style:{flexDirection:"row",alignItems:"center",gap:6,height:32,paddingLeft:10,paddingRight:12,borderRadius:16,backgroundColor:"#FFFFFF",borderWidth:1,borderColor:l["look.color.line"]},testID:"everfur-sdk-vet-pill",children:[s?/* @__PURE__ */a.jsx(i.View,{style:{width:8,height:8,borderRadius:4,backgroundColor:l["look.color.dot"]},testID:"everfur-sdk-vet-pill-dot"}):null,
|
|
203
203
|
/* @__PURE__ */a.jsx(Text,{tier:"control",style:{fontFamily:l["look.font.body"],fontSize:14,color:l["look.color.heading"]},children:vetTabLabel(e,n)})]})}function PetSwitcher({config:e,host:t,pet:n}){let r=e.settings;return n===null?null:/* @__PURE__ */a.jsxs(i.Pressable,{accessibilityRole:"button",onPress:()=>{if(t.pets.length<2)return;let e=t.pets.findIndex(e=>e.petRef===n.petRef),r=t.pets[(e+1)%t.pets.length];r!==void 0&&t.onPetChange?.(r.petRef)},style:{minHeight:44,flexDirection:"row",alignItems:"center",gap:4,paddingHorizontal:8},testID:"everfur-sdk-pet-switcher",children:[
|
|
204
|
-
/* @__PURE__ */a.jsx(Text,{tier:"control",numberOfLines:1,style:{fontFamily:r["look.font.body"],fontSize:15,fontWeight:"600",color:r["look.color.heading"]},children:n.name}),t.pets.length>1?/* @__PURE__ */a.jsx(Text,{tier:"control",style:{fontSize:12,color:r["look.color.heading"]},children:"▾"}):null]})}function MemoryRow({config:e,pet:t,withLockup:n=false}){let r=memoryChip(e,t?.name);return r===null&&!n?null:/* @__PURE__ */a.jsxs(i.View,{style:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:8,paddingHorizontal:16,paddingTop:10},testID:"everfur-sdk-memory-row",children:[r!==null?/* @__PURE__ */a.jsx(SdkMemoryChip,{settings:e.settings,label:r}):/* @__PURE__ */a.jsx(i.View,{}),n?/* @__PURE__ */a.jsx(SdkLockup,{settings:e.settings}):null]})}function AskPane({config:t,layout:n,pet:r,level:l,access:s,hooks:d,chat:c,locked:u,tabsBar:p,onRecords:f,onVet:h,onPlan:g}){let b=t.settings,m=b["look.color.heading"],y=o.useMemo(()=>({title:sdkText(t,"text.ask.greeting",r===null?{}:{pet:r.name}),chipTints:b["look.color.chips"].map(e=>({tint:e,ink:chipInk(e,m)}))}),[t,b,m,r]),v=o.useMemo(()=>({chats:
|
|
205
|
-
return a.jsxs(i.View,{style:{flex:1},testID:"everfur-sdk-ask",children:[k?/* @__PURE__ */a.jsx(i.View,{style:{flex:1,alignItems:"center",justifyContent:"center",padding:24},testID:"everfur-sdk-ask-blocked",children:/* @__PURE__ */a.jsx(i.Pressable,{accessibilityRole:"button",onPress:g,style:{minHeight:44,justifyContent:"center"},children:/* @__PURE__ */a.jsx(Text,{tier:"control",style:{fontFamily:b["look.font.body"],fontSize:15,color:b["look.color.accent"]},children:s.kind==="members_only"?sdkText(t,"text.members.button"):sdkText(t,"text.cap.button")})})}):/* @__PURE__ */a.jsx(Ha.Provider,{value:d,children:/* @__PURE__ */a.jsx(ut.Provider,{value:p,children:/* @__PURE__ */a.jsx(e.EverfurChat,{header:false,...c,...r===null?{}:{petRef:r.petRef},...w===void 0?{}:{vetUsState:w},...u("texting")||!b["features.texting"]?{textingEntry:false}:{},...n.vetOnAsk==="none"?{}:{onFindVet:h},emptyState:y,historyBar:v,style:{flex:1,paddingTop:0},...p?{onOpenRecord:c?.onOpenRecord??f}:{}})})}),s.kind==="counter"?/* @__PURE__ */a.jsx(Text,{style:{textAlign:"center",fontFamily:b["look.font.label"]==="body"?b["look.font.body"]:b["look.font.label"],fontSize:12,color:b["look.color.muted"],paddingVertical:4},testID:"everfur-sdk-counter",children:s.line}):null]})}function VetPane2({config:e,pet:t,level:n,tabsBar:o,locked:l,onLocked:s,onAsk:d}){let c=o?zi()?.vet.VetHome:void 0;if(c!==void 0&&
|
|
204
|
+
/* @__PURE__ */a.jsx(Text,{tier:"control",numberOfLines:1,style:{fontFamily:r["look.font.body"],fontSize:15,fontWeight:"600",color:r["look.color.heading"]},children:n.name}),t.pets.length>1?/* @__PURE__ */a.jsx(Text,{tier:"control",style:{fontSize:12,color:r["look.color.heading"]},children:"▾"}):null]})}function MemoryRow({config:e,pet:t,withLockup:n=false}){let r=memoryChip(e,t?.name);return r===null&&!n?null:/* @__PURE__ */a.jsxs(i.View,{style:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:8,paddingHorizontal:16,paddingTop:10},testID:"everfur-sdk-memory-row",children:[r!==null?/* @__PURE__ */a.jsx(SdkMemoryChip,{settings:e.settings,label:r}):/* @__PURE__ */a.jsx(i.View,{}),n?/* @__PURE__ */a.jsx(SdkLockup,{settings:e.settings}):null]})}function AskPane({config:t,layout:n,pet:r,level:l,access:s,hooks:d,chat:c,locked:u,tabsBar:p,onRecords:f,onVet:h,onPlan:g}){let b=t.settings,m=b["look.color.heading"],y=o.useMemo(()=>({title:sdkText(t,"text.ask.greeting",r===null?{}:{pet:r.name}),chipTints:b["look.color.chips"].map(e=>({tint:e,ink:chipInk(e,m)}))}),[t,b,m,r]),v=o.useMemo(()=>({chats:Sl,newChat:sdkText(t,"text.ask.new_chat")}),[t]),k=s.kind==="members_only"||s.kind==="cap_reached",w=n.vetOnAsk!=="none"&&l!=="none"?r?.location?.state:void 0;/* @__PURE__ */
|
|
205
|
+
return a.jsxs(i.View,{style:{flex:1},testID:"everfur-sdk-ask",children:[k?/* @__PURE__ */a.jsx(i.View,{style:{flex:1,alignItems:"center",justifyContent:"center",padding:24},testID:"everfur-sdk-ask-blocked",children:/* @__PURE__ */a.jsx(i.Pressable,{accessibilityRole:"button",onPress:g,style:{minHeight:44,justifyContent:"center"},children:/* @__PURE__ */a.jsx(Text,{tier:"control",style:{fontFamily:b["look.font.body"],fontSize:15,color:b["look.color.accent"]},children:s.kind==="members_only"?sdkText(t,"text.members.button"):sdkText(t,"text.cap.button")})})}):/* @__PURE__ */a.jsx(Ha.Provider,{value:d,children:/* @__PURE__ */a.jsx(ut.Provider,{value:p,children:/* @__PURE__ */a.jsx(e.EverfurChat,{header:false,...c,...r===null?{}:{petRef:r.petRef},...w===void 0?{}:{vetUsState:w},...u("texting")||!b["features.texting"]?{textingEntry:false}:{},...n.vetOnAsk==="none"?{}:{onFindVet:h},emptyState:y,historyBar:v,style:{flex:1,paddingTop:0},...p?{onOpenRecord:c?.onOpenRecord??f}:{}})})}),s.kind==="counter"?/* @__PURE__ */a.jsx(Text,{style:{textAlign:"center",fontFamily:b["look.font.label"]==="body"?b["look.font.body"]:b["look.font.label"],fontSize:12,color:b["look.color.muted"],paddingVertical:4},testID:"everfur-sdk-counter",children:s.line}):null]})}function VetPane2({config:e,pet:t,level:n,tabsBar:o,locked:l,onLocked:s,onAsk:d}){let c=o?zi()?.vet.VetHome:void 0;if(c!==void 0&&Al(e,n,t)){let e=t?.location?.state;/* @__PURE__ */
|
|
206
206
|
return a.jsxs(i.View,{style:{flex:1},testID:"everfur-sdk-vet-tabs-bar",children:[
|
|
207
207
|
/* @__PURE__ */a.jsx(c,{petRef:t?.petRef??null,...e===void 0?{}:{usState:e},...l?{onStartInApp:()=>s()}:{},style:{flex:1}}),
|
|
208
208
|
/* @__PURE__ */a.jsx(r.EverfurTelevetHost,{})]})}/* @__PURE__ */
|
|
209
|
-
return a.jsx(ConfigVetPane,{config:e,pet:t,level:n,locked:l,onLocked:s,onAsk:d})}function
|
|
209
|
+
return a.jsx(ConfigVetPane,{config:e,pet:t,level:n,locked:l,onLocked:s,onAsk:d})}function Al(e,t,n){if(t!=="visits")return false;let r=e.settings["vet.visits_per_year"],o=n?.visitsUsed;return r===null||o===null||o===void 0||o<r}function ConfigVetPane({config:e,pet:t,level:n,locked:o,onLocked:l,onAsk:s}){let d=r.useVetVisit({petRef:t?.petRef??null,usState:t?.location?.state??null}),c=vetHome(e,{level:n,...t===null?{}:{pet:t.name,petSex:t.sex??null,visitsUsed:t.visitsUsed??null},...t?.stateName!==void 0?{stateName:t.stateName}:t?.location?.state!==void 0?{stateName:t.location.state}:{}});/* @__PURE__ */
|
|
210
210
|
return a.jsxs(i.View,{style:{flex:1},children:[
|
|
211
211
|
/* @__PURE__ */a.jsx(SdkVetHomeView,{config:e,home:c,onBook:()=>{o?l():d.open(t?.petRef??null)},style:{flex:1}}),
|
|
212
212
|
/* @__PURE__ */a.jsx(SdkDockBar,{config:e,pet:t?.name,onPress:s})]})}function RecordsPane({config:e,host:t,pet:r,tabsBar:o,shellPush:l,vetShown:s,records:d,onPlan:c,onVet:u,locked:p,onAsk:f}){let h=e.settings,g=new Set(h["features.partner_data"]),b=(t.partnerData??[]).filter(e=>g.has(e.source)),m=partnerDataSources(e),y=t=>sdkFixed(e,t==="park_checkins"?"pdata.tag.park_checkins":t==="camera_events"?"pdata.tag.camera_events":"pdata.tag.dna_results"),v=d?.sheet,k=!o||v===false?v:{layout:"tabs_bar",shellPush:l,...r?.photoUrl===void 0?{}:{petPhotoUrl:r.photoUrl},...typeof v=="object"?v:{}};/* @__PURE__ */
|
package/dist/tabs/index.js
CHANGED
|
@@ -178,35 +178,35 @@ return $(E,{style:r,contentContainerStyle:{gap:14,paddingHorizontal:16,paddingTo
|
|
|
178
178
|
/* @__PURE__ */N(w,{style:{gap:4},children:t.legal.map(e=>/* @__PURE__ */N(Text,{style:{fontFamily:i,fontSize:12,color:l},children:e},e))}),t.privacy!==null?/* @__PURE__ */N(Text,{style:{fontFamily:i,fontSize:12,color:l},testID:"everfur-sdk-vet-privacy",children:t.privacy}):null]})}function Ml(e){return sdkText(e,"text.tabs.ask")}function SdkLauncherView({config:e,onPress:t,replyWaiting:n,tipSeen:r,onTipSeen:o,style:i}){let a=e.settings,l=a["layout.presentation"]==="full_screen",s=a["look.ask_icon"]===ol?"":a["look.ask_icon"],[d,c]=u(l&&!r);f(()=>{(!l||r)&&c(false)},[l,r]);let p=()=>{c(false),o()};/* @__PURE__ */
|
|
179
179
|
return $(w,{style:[{alignItems:"flex-end",gap:8},i],pointerEvents:"box-none",testID:"everfur-sdk-launcher",children:[d?/* @__PURE__ */N(_,{accessibilityRole:"button",onPress:p,style:{maxWidth:240,backgroundColor:Ul,borderRadius:14,borderWidth:1,borderColor:a["look.color.line"],paddingHorizontal:14,paddingVertical:10},testID:"everfur-sdk-launcher-tip",children:/* @__PURE__ */N(Text,{style:{fontFamily:a["look.font.body"],fontSize:14,color:a["look.color.ink"]},children:sdkText(e,"text.launcher.tip")})}):null,
|
|
180
180
|
/* @__PURE__ */$(_,{accessibilityRole:"button",accessibilityLabel:Ml(e),onPress:()=>{d&&p(),t()},style:{width:60,height:60,borderRadius:30,backgroundColor:a["look.color.launcher"],alignItems:"center",justifyContent:"center"},testID:"everfur-sdk-launcher-button",children:[
|
|
181
|
-
/* @__PURE__ */N(SdkBrandArt,{url:s,style:{width:l?24:30,height:l?24:30},fallback:/* @__PURE__ */N(ShellIcon,{name:"wordmark",style:{width:36,height:13,tintColor:a["look.color.on_launcher"]}})}),l?/* @__PURE__ */N(Text,{tier:"badge",style:{fontFamily:a["look.font.body"],fontSize:10,color:a["look.color.on_launcher"]},children:Ml(e)}):null,l&&n?/* @__PURE__ */N(w,{style:{position:"absolute",top:2,right:2,width:12,height:12,borderRadius:6,backgroundColor:"#C03410",borderWidth:2,borderColor:Ul},testID:"everfur-sdk-launcher-dot"}):null]})]})}var ql=true;function Hl(e,t,n,r){if(n===null)return e;let o=r&&e.vetOnAsk!=="none",i=Zt(ql,n).filter(e=>e==="vet"?o:e==="ask"?t["features.chat"]:e==="records"?t["features.records"]:false);e.nav==="chat_first"&&!i.includes("ask")&&i.unshift("ask"),i.length===0&&i.push(t["features.records"]&&!t["features.chat"]?"records":"ask");let a=i.includes("vet"),l=o?a?"own_tab":e.vetOnAsk==="own_tab"?"in_answers":e.vetOnAsk:"none",s=e.vetBadge==="header_pill"&&e.presentation==="full_screen"&&l==="own_tab"?"tab_dot":e.vetBadge;/* @__PURE__ */
|
|
182
|
-
return Object.freeze({...e,sections:/* @__PURE__ */Object.freeze(i),vetOnAsk:l,vetBadge:s})}function
|
|
183
|
-
return N(EverfurTabs,{petRef:a?.petRef??null,petName:a?.name??null,opened:
|
|
181
|
+
/* @__PURE__ */N(SdkBrandArt,{url:s,style:{width:l?24:30,height:l?24:30},fallback:/* @__PURE__ */N(ShellIcon,{name:"wordmark",style:{width:36,height:13,tintColor:a["look.color.on_launcher"]}})}),l?/* @__PURE__ */N(Text,{tier:"badge",style:{fontFamily:a["look.font.body"],fontSize:10,color:a["look.color.on_launcher"]},children:Ml(e)}):null,l&&n?/* @__PURE__ */N(w,{style:{position:"absolute",top:2,right:2,width:12,height:12,borderRadius:6,backgroundColor:"#C03410",borderWidth:2,borderColor:Ul},testID:"everfur-sdk-launcher-dot"}):null]})]})}var ql=true;function Hl(e,t,n){return n&&t==null?"visits":e}function Kl(e,t,n,r){if(n===null)return e;let o=r&&e.vetOnAsk!=="none",i=Zt(ql,n).filter(e=>e==="vet"?o:e==="ask"?t["features.chat"]:e==="records"?t["features.records"]:false);e.nav==="chat_first"&&!i.includes("ask")&&i.unshift("ask"),i.length===0&&i.push(t["features.records"]&&!t["features.chat"]?"records":"ask");let a=i.includes("vet"),l=o?a?"own_tab":e.vetOnAsk==="own_tab"?"in_answers":e.vetOnAsk:"none",s=e.vetBadge==="header_pill"&&e.presentation==="full_screen"&&l==="own_tab"?"tab_dot":e.vetBadge;/* @__PURE__ */
|
|
182
|
+
return Object.freeze({...e,sections:/* @__PURE__ */Object.freeze(i),vetOnAsk:l,vetBadge:s})}function Yl(e,t,n){let r=t.vetOnAsk!=="none";return n?t.sections.includes(e)?e:e==="vet"&&r?"vet":Jl(Xt(e,ql,t.sections)):e==="vet"&&!r?"ask":e}function Gl(e,t,n){if(!n)return e??t.sections[0]??"ask";let r=nn(e===void 0?{via:"plain"}:{via:"link",tab:e},ql,t.sections);return e==="vet"&&r!=="vet"?Yl("vet",t,true):Jl(r)}function Jl(e){return e==="plan"?"ask":e}function Ql(e){return e===void 0?{section:void 0,key:null}:typeof e=="string"?{section:e,key:null}:{section:e.section,key:e.key}}function Zl(e){let t=e.activePetRef;return e.pets.find(e=>e.petRef===t)??e.pets[0]??null}function EverfurSdkApp(e){let t=xl(),n=useEverfurSdkConfig();f(()=>{if(t===null)return;t.adoptLatest(),t.load();let e=P.addEventListener("change",e=>{e==="active"&&t.retry()});return()=>e.remove()},[t]);let r=h(()=>{t?.retry()},[t]);return n.active!==null?/* @__PURE__ */N(SdkShell,{...e,config:n.active}):n.status==="legacy"?/* @__PURE__ */N(LegacyPath,{...e}):/* @__PURE__ */N(SdkNeutralScreen,{failed:n.status==="failed",onRetry:r})}var Xl=/* @__PURE__ */Object.freeze({branding:null}),es=/* @__PURE__ */Object.freeze({subscribe:()=>()=>{},getSnapshot:()=>Xl});function ts(e,t){let n=g(ht)?.runtime?.entitlements??es,r=h(()=>n.getSnapshot()?.branding??null,[n]),o=m(n.subscribe,r,r),i=e===void 0?"":e.join(",");return p(()=>{let n=resolvePresentation({server:o?.presentation??null,locked:o?.lockedFields??null,client:{...e===void 0?{}:{shellTabs:e},...t===void 0?{}:{shellHeader:t}}});return{shellTabs:n.shellTabs??null,shellHeader:ya(n.shellHeader)?"tabs_bar":"classic"}},[o,i,t])}function ns(e,t){let n=()=>{if(t===null)return;let n=e.pets.findIndex(e=>e.petRef===t.petRef),r=e.pets[(n+1)%e.pets.length];r!==void 0&&r.petRef!==t.petRef&&e.onPetChange?.(r.petRef)},r=e.onPickPet??(e.pets.length>1&&e.onPetChange!==void 0?n:void 0);return{...t?.photoUrl===void 0?{}:{petPhotoUrl:t.photoUrl},...r===void 0?{}:{onPet:r}}}function LegacyPath({host:e,renderLegacy:t,section:n,tabs:r,headerStyle:o}){let i=ts(r,o);if(t!==void 0)return t();let a=Zl(e),l=i.shellHeader==="tabs_bar";/* @__PURE__ */
|
|
183
|
+
return N(EverfurTabs,{petRef:a?.petRef??null,petName:a?.name??null,opened:rs(n,i.shellTabs?.includes("vet")===true),...r===void 0?{}:{tabs:r},...o===void 0?{}:{headerStyle:o},...l?{header:ns(e,a)}:{},...l&&e.onClose!==void 0?{onClose:e.onClose}:{},...e.vetMessageWaiting===true?{badges:{vet:true}}:{}})}function rs(e,t){let{section:n,key:r}=Ql(e);return n===void 0||n==="vet"&&!t?{via:"plain"}:r===null?{via:"link",tab:n}:{via:"link",tab:n,key:r}}function os(e,t,n){let r=xl(),o=e.settings["access.mode"]==="free_cap",i=capMonth(/* @__PURE__ */new Date),[a,l]=u(()=>r?.peekFreeUsed(t,i)??0),s=c(true),d=c(n);d.current=n,f(()=>{if(s.current=true,!(r===null||!o))return r.readFreeUsed(t,i).then(e=>{s.current&&l(e)}),()=>{s.current=false}},[r,o,t,i]);let h=p(()=>!o||r===null?null:{onMessageSent:()=>{r.addFreeUsed(t,i).then(e=>{s.current&&l(e)})},onFreeCapReached:e=>{r.setFreeUsed(t,i,e.used).then(e=>{s.current&&l(e)}),d.current(e)}},[o,r,t,i]);return{used:a,hooks:h}}var is=It.heading;function SdkShell({host:e,section:t,onSectionChange:n,chat:r,records:o,style:i,config:a,tabs:l,headerStyle:s}){let d=a.settings,b=g(ht),m=Zl(e),y=ts(l,s),v=y.shellTabs!==null,k=Hl(vetLevelFor(a.stateGate,m?.location??null),m?.location,v),_=y.shellHeader==="tabs_bar";Hn(_);let S=Cn("televet"),x=p(()=>Kl(resolveLayout(d,k),d,y.shellTabs,S),[d,k,y.shellTabs,S]),C=e.membership??"unknown",R=e.userId??b?.userRef??"anonymous",F=c(()=>{}),{used:A,hooks:T}=os(a,R,e=>F.current(e)),I=askAccess(a,C,A),{tablet:E,column:D}=Or(),O=Ql(t),[P,z]=u(()=>Gl(O.section,x,v));f(()=>{O.section!==void 0&&z(O.section)},[O.section,O.key]);let B=h(e=>{z(e),n?.(e)},[n]),L=x.vetOnAsk!=="none",j=Yl(P,x,v),U=x.closeControl!=="none",[W,V]=u(null),[M,q]=u(null),H=h(e=>(q(e),()=>q(t=>t===e?null:t)),[]),K=h((e,t=null)=>{let n={sheet:e.kind==="members"?membersSheet(a):planSheet(a,m?.name),reason:e,notice:t};V(r=>t===null&&e.kind==="cap"&&r?.reason.kind==="cap"?{...n,notice:r.notice}:n)},[a,m?.name]);F.current=e=>K({kind:"cap"},e.emergencyGuidance??null);let Y=()=>{W!==null&&(e.onOpenPlan?.(W.reason,W.sheet.soldBy),V(null))};f(()=>{I.kind==="members_only"?K({kind:"members"}):I.kind==="cap_reached"&&K({kind:"cap"})},[I.kind,K]);let G=e=>isLocked(a,C,e),J={flex:1,backgroundColor:d["look.color.surface"]},Q=j==="vet"?/* @__PURE__ */N(VetPane2,{config:a,pet:m,level:k,tabsBar:_,locked:G("video_visits"),onLocked:()=>K({kind:"locked",part:"video_visits"}),onAsk:()=>B("ask")}):j==="records"?/* @__PURE__ */N(RecordsPane,{config:a,host:e,pet:m,tabsBar:_,shellPush:H,vetShown:L,records:o,onPlan:e=>K({kind:"locked",part:e}),onVet:()=>L?B("vet"):void 0,locked:G,onAsk:()=>B("ask")}):/* @__PURE__ */N(AskPane,{config:a,layout:x,pet:m,level:k,access:I,hooks:T,chat:r,locked:G,tabsBar:_,onRecords:()=>B("records"),onVet:()=>B("vet"),onPlan:()=>K({kind:I.kind==="members_only"?"members":"cap"})}),Z=/* @__PURE__ */N(SdkColumnScope,{children:Q});/* @__PURE__ */
|
|
184
184
|
return N(ShellSafeArea,{framed:U,children:t=>/* @__PURE__ */$(w,{style:[J,i],testID:`everfur-sdk-app-${x.nav}`,children:[
|
|
185
|
-
/* @__PURE__ */N(Framed,{framed:U,insets:t,children:/* @__PURE__ */$(w,{style:D,testID:E?"everfur-sdk-column-tablet":"everfur-sdk-column-phone",children:[_?/* @__PURE__ */N(TabsBar,{config:a,layout:x,host:e,pet:m,section:j,level:
|
|
186
|
-
/* @__PURE__ */N(w,{style:{flex:1},children:Z}),!_&&x.nav==="bottom_tabs"?/* @__PURE__ */N(SectionNav,{config:a,layout:x,level:
|
|
187
|
-
/* @__PURE__ */N(V,{initialMetrics:n===null?M:null,children:/* @__PURE__ */N(MeasuredInsets,{children:t})}):t(
|
|
185
|
+
/* @__PURE__ */N(Framed,{framed:U,insets:t,children:/* @__PURE__ */$(w,{style:D,testID:E?"everfur-sdk-column-tablet":"everfur-sdk-column-phone",children:[_?/* @__PURE__ */N(TabsBar,{config:a,layout:x,host:e,pet:m,section:j,level:k,onSection:B,deep:j==="records"?M:null}):/* @__PURE__ */N(Header,{config:a,layout:x,host:e,pet:m,section:j,level:k,onSection:B}),_||x.nav==="bottom_tabs"||x.nav==="chat_first"?null:/* @__PURE__ */N(SectionNav,{config:a,layout:x,level:k,section:j,onSection:B,vetDot:e.vetMessageWaiting===true}),
|
|
186
|
+
/* @__PURE__ */N(w,{style:{flex:1},children:Z}),!_&&x.nav==="bottom_tabs"?/* @__PURE__ */N(SectionNav,{config:a,layout:x,level:k,section:j,onSection:B,vetDot:e.vetMessageWaiting===true,bottom:true}):null]})}),W!==null?/* @__PURE__ */N(SdkSheet,{sheet:W.sheet,settings:d,onPrimary:Y,onDismiss:()=>V(null),notice:W.notice,bottomInset:t.bottom}):null]})})}var as=/* @__PURE__ */Object.freeze({top:0,bottom:0,left:0,right:0});function ShellSafeArea({framed:e,children:t}){let n=g(W);return e?
|
|
187
|
+
/* @__PURE__ */N(V,{initialMetrics:n===null?M:null,children:/* @__PURE__ */N(MeasuredInsets,{children:t})}):t(as)}function MeasuredInsets({children:e}){return e(q())}function Framed({framed:e,insets:t,children:n}){return e?/* @__PURE__ */N(w,{style:{flex:1,paddingTop:t.top,paddingBottom:t.bottom,paddingLeft:t.left,paddingRight:t.right},testID:"everfur-sdk-safe-area",children:n}):n}function ls(e,t,n){return t==="vet"?vetTabLabel(e,n):sdkText(e,t==="ask"?"text.tabs.ask":"text.tabs.records")}function SectionNav({config:e,layout:t,level:n,section:r,onSection:o,vetDot:i,bottom:a=false}){let l=e.settings;return t.sections.length<2?null:/* @__PURE__ */N(w,{accessibilityRole:"tablist",style:[{flexDirection:"row",borderColor:l["look.color.line"],backgroundColor:l["look.color.surface"]},a?{borderTopWidth:1,paddingBottom:6}:{borderBottomWidth:1,paddingHorizontal:8}],testID:a?"everfur-sdk-tabs-bottom":"everfur-sdk-tabs-top",children:t.sections.map(s=>{let d=s===r;/* @__PURE__ */
|
|
188
188
|
return $(_,{accessibilityRole:"tab",accessibilityState:{selected:d},onPress:()=>o(s),style:{flex:a?1:0,minHeight:44,paddingHorizontal:12,alignItems:"center",justifyContent:"center",flexDirection:"row",gap:6,borderBottomWidth:a?0:2,borderBottomColor:d?l["look.color.primary"]:"transparent"},testID:`everfur-sdk-tab-${s}`,children:[
|
|
189
|
-
/* @__PURE__ */N(Text,{tier:"control",style:{fontFamily:l["look.font.body"],fontSize:15,fontWeight:d?"600":"400",color:d?l["look.color.heading"]:l["look.color.muted"]},children:
|
|
189
|
+
/* @__PURE__ */N(Text,{tier:"control",style:{fontFamily:l["look.font.body"],fontSize:15,fontWeight:d?"600":"400",color:d?l["look.color.heading"]:l["look.color.muted"]},children:ls(e,s,n)}),s==="vet"&&i&&t.vetBadge==="tab_dot"?/* @__PURE__ */N(w,{style:{width:7,height:7,borderRadius:4,backgroundColor:l["look.color.dot"]},testID:"everfur-sdk-vet-dot"}):null]},s)})})}function Header({config:e,layout:t,host:n,pet:r,section:o,level:i,onSection:a}){let l=e.settings,s=l["look.color.heading"],d=(e,t,n)=>/* @__PURE__ */N(_,{accessibilityRole:"button",onPress:t,style:{minWidth:44,minHeight:44,alignItems:"center",justifyContent:"center"},testID:n,children:/* @__PURE__ */N(Text,{tier:"control",style:{fontSize:20,color:s},children:e})});if(t.nav==="sections_page"){let t=sdkText(e,"text.nav.page_title"),n=/* @__PURE__ */$(w,{style:{flexDirection:"row",alignItems:"center",gap:12,paddingHorizontal:16,paddingTop:12,paddingBottom:8},testID:"everfur-sdk-header-sections",children:[t!==""?/* @__PURE__ */N(Text,{tier:"heading",accessibilityRole:"header",style:{fontFamily:l["look.font.heading"],fontWeight:String(l["look.font.heading_weight"]),fontSize:24,color:s},children:t}):null,
|
|
190
190
|
/* @__PURE__ */N(SdkLockup,{settings:l})]});return o==="ask"?/* @__PURE__ */$(w,{children:[n,
|
|
191
191
|
/* @__PURE__ */N(MemoryRow,{config:e,pet:r})]}):n}if(t.nav==="chat_first"){let c=t.vetOnAsk==="header_button"&&o==="ask";/* @__PURE__ */
|
|
192
192
|
return $(w,{testID:"everfur-sdk-header-chat-first",children:[
|
|
193
193
|
/* @__PURE__ */$(w,{style:{flexDirection:"row",alignItems:"center",paddingHorizontal:8,minHeight:52},children:[d("↓",n.onClose,"everfur-sdk-down"),
|
|
194
|
-
/* @__PURE__ */N(Text,{tier:"heading",numberOfLines:1,style:{flex:1,textAlign:"center",fontFamily:l["look.font.heading"],fontWeight:String(l["look.font.heading_weight"]),fontSize:17,color:s},children:o==="ask"?sdkText(e,"text.ask.name"):
|
|
194
|
+
/* @__PURE__ */N(Text,{tier:"heading",numberOfLines:1,style:{flex:1,textAlign:"center",fontFamily:l["look.font.heading"],fontWeight:String(l["look.font.heading_weight"]),fontSize:17,color:s},children:o==="ask"?sdkText(e,"text.ask.name"):ls(e,o,i)}),c?/* @__PURE__ */N(VetPill,{config:e,layout:t,level:i,waiting:n.vetMessageWaiting===true,onPress:()=>a("vet")}):o!=="ask"?d("×",()=>a("ask"),"everfur-sdk-back-to-ask"):/* @__PURE__ */N(w,{style:{minWidth:44}})]}),o==="ask"?/* @__PURE__ */N(MemoryRow,{config:e,pet:r,withLockup:true}):null]})}let c=t.presentation==="full_screen",u=t.vetOnAsk==="header_button"&&o==="ask";/* @__PURE__ */
|
|
195
195
|
return $(w,{testID:`everfur-sdk-header-${t.nav}`,children:[
|
|
196
196
|
/* @__PURE__ */$(w,{style:{flexDirection:"row",alignItems:"center",paddingHorizontal:8,minHeight:52,gap:8},children:[
|
|
197
197
|
/* @__PURE__ */N(w,{style:{flex:1,alignItems:"flex-start"},children:c?/* @__PURE__ */N(PetSwitcher,{config:e,host:n,pet:r}):null}),
|
|
198
198
|
/* @__PURE__ */N(SdkLockup,{settings:l}),
|
|
199
|
-
/* @__PURE__ */$(w,{style:{flex:1,alignItems:"flex-end"},children:[u?/* @__PURE__ */N(VetPill,{config:e,layout:t,level:i,waiting:n.vetMessageWaiting===true,onPress:()=>a("vet")}):null,c?d("×",n.onClose,"everfur-sdk-close"):null]})]}),t.nav==="bottom_tabs"&&t.vetOnAsk==="top"&&(o==="ask"||o==="vet")?/* @__PURE__ */N(AskVetSwitch,{config:e,level:i,section:o,onSection:a}):null,o==="ask"?/* @__PURE__ */N(MemoryRow,{config:e,pet:r}):null]})}function
|
|
200
|
-
/* @__PURE__ */N(b.TabsBarHeader,{options:
|
|
201
|
-
return N(w,{accessibilityRole:"tablist",style:{flexDirection:"row",borderBottomWidth:1,borderColor:o["look.color.line"],paddingHorizontal:8},testID:"everfur-sdk-ask-vet-switch",children:["ask","vet"].map(i=>/* @__PURE__ */N(_,{accessibilityRole:"tab",accessibilityState:{selected:n===i},onPress:()=>r(i),style:{minHeight:44,paddingHorizontal:12,justifyContent:"center",borderBottomWidth:2,borderBottomColor:n===i?o["look.color.primary"]:"transparent"},testID:`everfur-sdk-switch-${i}`,children:/* @__PURE__ */N(Text,{tier:"control",style:{fontFamily:o["look.font.body"],fontSize:15,color:n===i?o["look.color.heading"]:o["look.color.muted"]},children:
|
|
199
|
+
/* @__PURE__ */$(w,{style:{flex:1,alignItems:"flex-end"},children:[u?/* @__PURE__ */N(VetPill,{config:e,layout:t,level:i,waiting:n.vetMessageWaiting===true,onPress:()=>a("vet")}):null,c?d("×",n.onClose,"everfur-sdk-close"):null]})]}),t.nav==="bottom_tabs"&&t.vetOnAsk==="top"&&(o==="ask"||o==="vet")?/* @__PURE__ */N(AskVetSwitch,{config:e,level:i,section:o,onSection:a}):null,o==="ask"?/* @__PURE__ */N(MemoryRow,{config:e,pet:r}):null]})}function ss(e,t){let n=ls(e,"ask",t),r=ls(e,"records",t),o=Yt.plan;return{ask:n,vet:ls(e,"vet",t),plan:o,records:r,listAll:`${n}, ${o} and ${r}`,listNoPlan:`${n} and ${r}`}}function TabsBar({config:e,layout:t,host:n,pet:r,section:o,level:i,onSection:a,deep:l}){let s=p(()=>ss(e,i),[e,i]),d=h(e=>a(e==="plan"?"ask":e),[a]),c=!t.sections.includes(o),u=l??(c?{title:ls(e,o,i),onBack:()=>a("ask")}:null),f=t.closeControl==="none"?void 0:n.onClose,g=n.vetMessageWaiting===true&&t.vetBadge!=="none"?{vet:true}:void 0,b=ma()?.header;return b===void 0?null:/* @__PURE__ */$(w,{testID:"everfur-sdk-header-tabs-bar",children:[
|
|
200
|
+
/* @__PURE__ */N(b.TabsBarHeader,{options:ns(n,r),pushed:u,petRef:r?.petRef??null,petName:r?.name??"",copy:pa,onClose:f}),l!==null||t.sections.length<2?null:/* @__PURE__ */N(b.SubTabs,{tabs:t.sections,sub:o,copy:s,badges:g,onOpen:d}),o==="ask"?/* @__PURE__ */N(MemoryRow,{config:e,pet:r}):null]})}function AskVetSwitch({config:e,level:t,section:n,onSection:r}){let o=e.settings;/* @__PURE__ */
|
|
201
|
+
return N(w,{accessibilityRole:"tablist",style:{flexDirection:"row",borderBottomWidth:1,borderColor:o["look.color.line"],paddingHorizontal:8},testID:"everfur-sdk-ask-vet-switch",children:["ask","vet"].map(i=>/* @__PURE__ */N(_,{accessibilityRole:"tab",accessibilityState:{selected:n===i},onPress:()=>r(i),style:{minHeight:44,paddingHorizontal:12,justifyContent:"center",borderBottomWidth:2,borderBottomColor:n===i?o["look.color.primary"]:"transparent"},testID:`everfur-sdk-switch-${i}`,children:/* @__PURE__ */N(Text,{tier:"control",style:{fontFamily:o["look.font.body"],fontSize:15,color:n===i?o["look.color.heading"]:o["look.color.muted"]},children:ls(e,i,t)})},i))})}function VetPill({config:e,layout:t,level:n,waiting:r,onPress:o}){let i=e.settings,a=t.vetBadge==="header_pill"&&r;/* @__PURE__ */
|
|
202
202
|
return $(_,{accessibilityRole:"button",onPress:o,style:{flexDirection:"row",alignItems:"center",gap:6,height:32,paddingLeft:10,paddingRight:12,borderRadius:16,backgroundColor:"#FFFFFF",borderWidth:1,borderColor:i["look.color.line"]},testID:"everfur-sdk-vet-pill",children:[a?/* @__PURE__ */N(w,{style:{width:8,height:8,borderRadius:4,backgroundColor:i["look.color.dot"]},testID:"everfur-sdk-vet-pill-dot"}):null,
|
|
203
203
|
/* @__PURE__ */N(Text,{tier:"control",style:{fontFamily:i["look.font.body"],fontSize:14,color:i["look.color.heading"]},children:vetTabLabel(e,n)})]})}function PetSwitcher({config:e,host:t,pet:n}){let r=e.settings;return n===null?null:/* @__PURE__ */$(_,{accessibilityRole:"button",onPress:()=>{if(t.pets.length<2)return;let e=t.pets.findIndex(e=>e.petRef===n.petRef),r=t.pets[(e+1)%t.pets.length];r!==void 0&&t.onPetChange?.(r.petRef)},style:{minHeight:44,flexDirection:"row",alignItems:"center",gap:4,paddingHorizontal:8},testID:"everfur-sdk-pet-switcher",children:[
|
|
204
|
-
/* @__PURE__ */N(Text,{tier:"control",numberOfLines:1,style:{fontFamily:r["look.font.body"],fontSize:15,fontWeight:"600",color:r["look.color.heading"]},children:n.name}),t.pets.length>1?/* @__PURE__ */N(Text,{tier:"control",style:{fontSize:12,color:r["look.color.heading"]},children:"▾"}):null]})}function MemoryRow({config:e,pet:t,withLockup:n=false}){let r=memoryChip(e,t?.name);return r===null&&!n?null:/* @__PURE__ */$(w,{style:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:8,paddingHorizontal:16,paddingTop:10},testID:"everfur-sdk-memory-row",children:[r!==null?/* @__PURE__ */N(SdkMemoryChip,{settings:e.settings,label:r}):/* @__PURE__ */N(w,{}),n?/* @__PURE__ */N(SdkLockup,{settings:e.settings}):null]})}function AskPane({config:t,layout:n,pet:r,level:o,access:i,hooks:a,chat:l,locked:s,tabsBar:d,onRecords:c,onVet:u,onPlan:f}){let h=t.settings,g=h["look.color.heading"],b=p(()=>({title:sdkText(t,"text.ask.greeting",r===null?{}:{pet:r.name}),chipTints:h["look.color.chips"].map(e=>({tint:e,ink:chipInk(e,g)}))}),[t,h,g,r]),m=p(()=>({chats:
|
|
205
|
-
return $(w,{style:{flex:1},testID:"everfur-sdk-ask",children:[y?/* @__PURE__ */N(w,{style:{flex:1,alignItems:"center",justifyContent:"center",padding:24},testID:"everfur-sdk-ask-blocked",children:/* @__PURE__ */N(_,{accessibilityRole:"button",onPress:f,style:{minHeight:44,justifyContent:"center"},children:/* @__PURE__ */N(Text,{tier:"control",style:{fontFamily:h["look.font.body"],fontSize:15,color:h["look.color.accent"]},children:i.kind==="members_only"?sdkText(t,"text.members.button"):sdkText(t,"text.cap.button")})})}):/* @__PURE__ */N(Fl.Provider,{value:a,children:/* @__PURE__ */N(Ht.Provider,{value:d,children:/* @__PURE__ */N(e,{header:false,...l,...r===null?{}:{petRef:r.petRef},...v===void 0?{}:{vetUsState:v},...s("texting")||!h["features.texting"]?{textingEntry:false}:{},...n.vetOnAsk==="none"?{}:{onFindVet:u},emptyState:b,historyBar:m,style:{flex:1,paddingTop:0},...d?{onOpenRecord:l?.onOpenRecord??c}:{}})})}),i.kind==="counter"?/* @__PURE__ */N(Text,{style:{textAlign:"center",fontFamily:h["look.font.label"]==="body"?h["look.font.body"]:h["look.font.label"],fontSize:12,color:h["look.color.muted"],paddingVertical:4},testID:"everfur-sdk-counter",children:i.line}):null]})}function VetPane2({config:e,pet:t,level:n,tabsBar:r,locked:o,onLocked:i,onAsk:l}){let s=r?ma()?.vet.VetHome:void 0;if(s!==void 0&&
|
|
204
|
+
/* @__PURE__ */N(Text,{tier:"control",numberOfLines:1,style:{fontFamily:r["look.font.body"],fontSize:15,fontWeight:"600",color:r["look.color.heading"]},children:n.name}),t.pets.length>1?/* @__PURE__ */N(Text,{tier:"control",style:{fontSize:12,color:r["look.color.heading"]},children:"▾"}):null]})}function MemoryRow({config:e,pet:t,withLockup:n=false}){let r=memoryChip(e,t?.name);return r===null&&!n?null:/* @__PURE__ */$(w,{style:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:8,paddingHorizontal:16,paddingTop:10},testID:"everfur-sdk-memory-row",children:[r!==null?/* @__PURE__ */N(SdkMemoryChip,{settings:e.settings,label:r}):/* @__PURE__ */N(w,{}),n?/* @__PURE__ */N(SdkLockup,{settings:e.settings}):null]})}function AskPane({config:t,layout:n,pet:r,level:o,access:i,hooks:a,chat:l,locked:s,tabsBar:d,onRecords:c,onVet:u,onPlan:f}){let h=t.settings,g=h["look.color.heading"],b=p(()=>({title:sdkText(t,"text.ask.greeting",r===null?{}:{pet:r.name}),chipTints:h["look.color.chips"].map(e=>({tint:e,ink:chipInk(e,g)}))}),[t,h,g,r]),m=p(()=>({chats:is,newChat:sdkText(t,"text.ask.new_chat")}),[t]),y=i.kind==="members_only"||i.kind==="cap_reached",v=n.vetOnAsk!=="none"&&o!=="none"?r?.location?.state:void 0;/* @__PURE__ */
|
|
205
|
+
return $(w,{style:{flex:1},testID:"everfur-sdk-ask",children:[y?/* @__PURE__ */N(w,{style:{flex:1,alignItems:"center",justifyContent:"center",padding:24},testID:"everfur-sdk-ask-blocked",children:/* @__PURE__ */N(_,{accessibilityRole:"button",onPress:f,style:{minHeight:44,justifyContent:"center"},children:/* @__PURE__ */N(Text,{tier:"control",style:{fontFamily:h["look.font.body"],fontSize:15,color:h["look.color.accent"]},children:i.kind==="members_only"?sdkText(t,"text.members.button"):sdkText(t,"text.cap.button")})})}):/* @__PURE__ */N(Fl.Provider,{value:a,children:/* @__PURE__ */N(Ht.Provider,{value:d,children:/* @__PURE__ */N(e,{header:false,...l,...r===null?{}:{petRef:r.petRef},...v===void 0?{}:{vetUsState:v},...s("texting")||!h["features.texting"]?{textingEntry:false}:{},...n.vetOnAsk==="none"?{}:{onFindVet:u},emptyState:b,historyBar:m,style:{flex:1,paddingTop:0},...d?{onOpenRecord:l?.onOpenRecord??c}:{}})})}),i.kind==="counter"?/* @__PURE__ */N(Text,{style:{textAlign:"center",fontFamily:h["look.font.label"]==="body"?h["look.font.body"]:h["look.font.label"],fontSize:12,color:h["look.color.muted"],paddingVertical:4},testID:"everfur-sdk-counter",children:i.line}):null]})}function VetPane2({config:e,pet:t,level:n,tabsBar:r,locked:o,onLocked:i,onAsk:l}){let s=r?ma()?.vet.VetHome:void 0;if(s!==void 0&&ds(e,n,t)){let e=t?.location?.state;/* @__PURE__ */
|
|
206
206
|
return $(w,{style:{flex:1},testID:"everfur-sdk-vet-tabs-bar",children:[
|
|
207
207
|
/* @__PURE__ */N(s,{petRef:t?.petRef??null,...e===void 0?{}:{usState:e},...o?{onStartInApp:()=>i()}:{},style:{flex:1}}),
|
|
208
208
|
/* @__PURE__ */N(a,{})]})}/* @__PURE__ */
|
|
209
|
-
return N(ConfigVetPane,{config:e,pet:t,level:n,locked:o,onLocked:i,onAsk:l})}function
|
|
209
|
+
return N(ConfigVetPane,{config:e,pet:t,level:n,locked:o,onLocked:i,onAsk:l})}function ds(e,t,n){if(t!=="visits")return false;let r=e.settings["vet.visits_per_year"],o=n?.visitsUsed;return r===null||o===null||o===void 0||o<r}function ConfigVetPane({config:e,pet:t,level:n,locked:r,onLocked:o,onAsk:i}){let a=useVetVisit({petRef:t?.petRef??null,usState:t?.location?.state??null}),l=vetHome(e,{level:n,...t===null?{}:{pet:t.name,petSex:t.sex??null,visitsUsed:t.visitsUsed??null},...t?.stateName!==void 0?{stateName:t.stateName}:t?.location?.state!==void 0?{stateName:t.location.state}:{}});/* @__PURE__ */
|
|
210
210
|
return $(w,{style:{flex:1},children:[
|
|
211
211
|
/* @__PURE__ */N(SdkVetHomeView,{config:e,home:l,onBook:()=>{r?o():a.open(t?.petRef??null)},style:{flex:1}}),
|
|
212
212
|
/* @__PURE__ */N(SdkDockBar,{config:e,pet:t?.name,onPress:i})]})}function RecordsPane({config:e,host:t,pet:n,tabsBar:r,shellPush:i,vetShown:a,records:l,onPlan:s,onVet:d,locked:c,onAsk:u}){let p=e.settings,f=new Set(p["features.partner_data"]),h=(t.partnerData??[]).filter(e=>f.has(e.source)),g=partnerDataSources(e),b=t=>sdkFixed(e,t==="park_checkins"?"pdata.tag.park_checkins":t==="camera_events"?"pdata.tag.camera_events":"pdata.tag.dna_results"),m=l?.sheet,y=!r||m===false?m:{layout:"tabs_bar",shellPush:i,...n?.photoUrl===void 0?{}:{petPhotoUrl:n.photoUrl},...typeof m=="object"?m:{}};/* @__PURE__ */
|