@everfur/sdk 0.17.0 → 0.18.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/CHANGELOG.md +167 -26
- package/care/package.json +8 -0
- package/dist/{Chat.d-uETscjrL.d.ts → Chat.d-Bz4iJ7d2.d.ts} +1 -1
- package/dist/{Chat.d-BYY1U61e.d.cts → Chat.d-C2ddC2u7.d.cts} +1 -1
- package/dist/{DepthViews.d-BsZ73mzL.d.ts → DepthViews.d-C6-Kzs6H.d.ts} +1 -1
- package/dist/{DepthViews.d-D_Qp4glO.d.cts → DepthViews.d-Chjs8H9V.d.cts} +1 -1
- package/dist/{DepthViews.d-DL8MP_kA.d.cts → DepthViews.d-pFL_ZBZT.d.cts} +1 -1
- package/dist/{DepthViews.d-B4SE5GUD.d.ts → DepthViews.d-qXt9OMgz.d.ts} +1 -1
- package/dist/{RecordsPage.d-CYotk2R9.d.cts → RecordsPage.d-Cmny6Q7g.d.cts} +2 -2
- package/dist/{RecordsPage.d-D4gP4leq.d.ts → RecordsPage.d-sNRolVdy.d.ts} +2 -2
- package/dist/animations/index.d.cts +5 -5
- package/dist/animations/index.d.ts +5 -5
- package/dist/{appStateLifecycle.d-DJXdDOJY.d.cts → appStateLifecycle.d-Bt70TQog.d.cts} +7 -7
- package/dist/{appStateLifecycle.d-CXJzBS3c.d.ts → appStateLifecycle.d-Jdg9_PFt.d.ts} +7 -7
- package/dist/{attachments.d-B8kOCb6q.d.cts → attachments.d-BVp3r6Ms.d.cts} +5 -5
- package/dist/{attachments.d-C61URT8r.d.cts → attachments.d-CF4_n-DZ.d.cts} +2 -2
- package/dist/{attachments.d-BTIGzXWD.d.ts → attachments.d-DnSCMjH0.d.ts} +5 -5
- package/dist/{attachments.d-BgatKf7d.d.ts → attachments.d-DsUZpMad.d.ts} +2 -2
- package/dist/{bookingCopy.d-B-bSYgqS.d.cts → bookingCopy.d-BHqE9Ozq.d.cts} +16 -16
- package/dist/{bookingCopy.d-JQW2SLM-.d.ts → bookingCopy.d-Ca4AQGZ7.d.ts} +16 -16
- package/dist/{branding.d-Bbc6p1XY.d.cts → branding.d-BFauULV6.d.cts} +1 -1
- package/dist/{branding.d-y6c0UwhE.d.ts → branding.d-DpNGEdDL.d.ts} +1 -1
- package/dist/care/index.cjs +3 -0
- package/dist/care/index.d.cts +434 -0
- package/dist/care/index.d.ts +434 -0
- package/dist/care/index.js +3 -0
- package/dist/{casesRepository.d-CVG2EXcg.d.cts → casesRepository.d-DFwD2kiS.d.cts} +1 -1
- package/dist/{casesRepository.d-CHEjzT4h.d.ts → casesRepository.d-VzxEyq2N.d.ts} +1 -1
- package/dist/chat/index.cjs +14 -13
- package/dist/chat/index.d.cts +13 -13
- package/dist/chat/index.d.ts +13 -13
- package/dist/chat/index.js +14 -13
- package/dist/chat/lite/index.cjs +14 -13
- package/dist/chat/lite/index.d.cts +13 -13
- package/dist/chat/lite/index.d.ts +13 -13
- package/dist/chat/lite/index.js +14 -13
- package/dist/chunk-Y3Q4GW47.js +31 -0
- package/dist/client/index.cjs +1 -1
- package/dist/client/index.d.cts +10 -10
- package/dist/client/index.d.ts +10 -10
- package/dist/client/index.js +1 -1
- package/dist/{clinicBatch.d-DdlFy4pD.d.cts → clinicBatch.d-CLqaih2C.d.cts} +2 -2
- package/dist/{clinicBatch.d-oNwH_dbI.d.ts → clinicBatch.d-DXDIL1lC.d.ts} +2 -2
- package/dist/{config.d-Cy_hJBJG.d.cts → config.d-7bCXvOGn.d.cts} +1 -1
- package/dist/{config.d-DopRLD4f.d.ts → config.d-cqyvpzDb.d.ts} +1 -1
- package/dist/consent/index.d.cts +5 -5
- package/dist/consent/index.d.ts +5 -5
- package/dist/{context.d-C42juGn6.d.cts → context.d-BeRanUXQ.d.cts} +7 -7
- package/dist/{context.d-Ban-Hhqu.d.ts → context.d-DAnmDYGr.d.ts} +7 -7
- package/dist/{copy.d-BTS5l6Ri.d.cts → copy.d-BPqs8swm.d.cts} +2 -2
- package/dist/{copy.d-qdbygul9.d.ts → copy.d-CxFzeuvo.d.ts} +2 -2
- package/dist/core/index.cjs +1 -1
- package/dist/core/index.d.cts +17 -17
- package/dist/core/index.d.ts +17 -17
- package/dist/core/index.js +1 -1
- package/dist/{depth.d-BGkHm2Se.d.ts → depth.d-C6XbnFig.d.ts} +2 -2
- package/dist/{depth.d-BfVrhq9o.d.cts → depth.d-qHdXHDd-.d.cts} +2 -2
- package/dist/{entitlementRepository.d-npT7L_7_.d.cts → entitlementRepository.d-C6uTDswj.d.cts} +4 -4
- package/dist/{entitlementRepository.d-CjwqCyhS.d.ts → entitlementRepository.d-D_cc7g4l.d.ts} +4 -4
- package/dist/{focus.d-S0nq_k1A.d.ts → focus.d-DiWvQR2j.d.ts} +193 -21
- package/dist/{focus.d-DS7Ze1Pp.d.cts → focus.d-HSkMHd-i.d.cts} +193 -21
- package/dist/health-plan/index.cjs +261 -176
- package/dist/health-plan/index.d.cts +627 -19
- package/dist/health-plan/index.d.ts +627 -19
- package/dist/health-plan/index.js +261 -176
- package/dist/{idempotency.d-COIrwuCb.d.ts → idempotency.d-CF5AvlYp.d.ts} +18 -639
- package/dist/{idempotency.d-gfiN4Qnp.d.cts → idempotency.d-DrO2zEZO.d.cts} +18 -639
- package/dist/{identity.d-D76vXtkJ.d.cts → identity.d-84x0dV7-.d.cts} +1 -1
- package/dist/{identity.d-B3mFvvRq.d.ts → identity.d-BXztMVYM.d.ts} +1 -1
- package/dist/index.cjs +12 -11
- package/dist/index.d.cts +21 -21
- package/dist/index.d.ts +21 -21
- package/dist/index.js +12 -11
- package/dist/{introEvents.d-3FLEemX3.d.cts → introEvents.d-Cwv72ER-.d.cts} +11 -11
- package/dist/{introEvents.d-BYnr37bd.d.ts → introEvents.d-DYU3znJs.d.ts} +11 -11
- package/dist/notifications/index.d.cts +4 -4
- package/dist/notifications/index.d.ts +4 -4
- package/dist/omsErrors.d-VF5tnr20.d.cts +633 -0
- package/dist/omsErrors.d-VF5tnr20.d.ts +633 -0
- package/dist/omsFields.d-BHntKIAH.d.cts +153 -0
- package/dist/omsFields.d-Cvfw8wWU.d.ts +153 -0
- package/dist/{optInView.d-DXRUGDiD.d.cts → optInView.d-4Hl4HbQh.d.cts} +3 -3
- package/dist/{optInView.d-BqFMcum4.d.ts → optInView.d-pq8tUTf6.d.ts} +3 -3
- package/dist/{parse.d-CY22hFxb.d.ts → parse.d-BJhhYfkv.d.ts} +1 -1
- package/dist/{parse.d-rvA_aRSO.d.cts → parse.d-D0v06qxx.d.cts} +1 -1
- package/dist/{pets.d-Cicz-aIO.d.ts → pets.d-1_CHpfgB.d.ts} +1 -1
- package/dist/{pets.d-RoHTZsaV.d.cts → pets.d-C4n-MDC4.d.cts} +1 -1
- package/dist/{petsRepository.d-DtAZf_Ja.d.ts → petsRepository.d-BuomdFjZ.d.ts} +1 -1
- package/dist/{petsRepository.d-BxMyt6Aj.d.cts → petsRepository.d-Dd95xh-M.d.cts} +1 -1
- package/dist/{ports.d-D7cjFUoL.d.cts → ports.d-Bf3tp7Pn.d.cts} +4 -4
- package/dist/{ports.d-DrgKa73F.d.ts → ports.d-ChZHFd-q.d.ts} +4 -4
- package/dist/{presentation.d-vy8kTGfR.d.cts → presentation.d-Bs8xQ4gD.d.cts} +4 -4
- package/dist/{presentation.d-vy8kTGfR.d.ts → presentation.d-Bs8xQ4gD.d.ts} +4 -4
- package/dist/records/depth/index.d.cts +9 -9
- package/dist/records/depth/index.d.ts +9 -9
- package/dist/records/index.cjs +11 -10
- package/dist/records/index.d.cts +24 -23
- package/dist/records/index.d.ts +24 -23
- package/dist/records/index.js +11 -10
- package/dist/{requestFunnel.d-BdQf53zs.d.cts → requestFunnel.d-CWI2pD3V.d.cts} +2 -2
- package/dist/{requestFunnel.d-B5y7Py8Z.d.ts → requestFunnel.d-DcQIAs45.d.ts} +2 -2
- package/dist/{resolve.d-CoQWUy1Y.d.cts → resolve.d-BTC3b6FW.d.cts} +1 -1
- package/dist/{resolve.d-CoQWUy1Y.d.ts → resolve.d-BTC3b6FW.d.ts} +1 -1
- package/dist/{runtimeTypes.d-r4Q5vASZ.d.cts → runtimeTypes.d-CIOVzjEK.d.cts} +6 -6
- package/dist/{runtimeTypes.d-D5EDgS3Y.d.ts → runtimeTypes.d-rbuONrIv.d.ts} +6 -6
- package/dist/{screenProps.d-v4a4kzxA.d.cts → screenProps.d-CFZe27oI.d.cts} +1 -1
- package/dist/{screenProps.d-KLCrP43b.d.ts → screenProps.d-yUA4k6yK.d.ts} +1 -1
- package/dist/server/events/index.cjs +2 -2
- package/dist/server/events/index.d.cts +49 -6
- package/dist/server/events/index.d.ts +49 -6
- package/dist/server/events/index.js +2 -2
- package/dist/server/index.cjs +1 -1
- package/dist/server/index.d.cts +3 -3
- package/dist/server/index.d.ts +3 -3
- package/dist/server/index.js +1 -1
- package/dist/shop/index.cjs +6 -6
- package/dist/shop/index.d.cts +9 -8
- package/dist/shop/index.d.ts +9 -8
- package/dist/shop/index.js +6 -6
- package/dist/shop/orders-v2/index.d.cts +2 -2
- package/dist/shop/orders-v2/index.d.ts +2 -2
- package/dist/tabs/index.cjs +4 -4
- package/dist/tabs/index.d.cts +14 -14
- package/dist/tabs/index.d.ts +14 -14
- package/dist/tabs/index.js +4 -4
- package/dist/{tabsModel.d-B7QMug1u.d.ts → tabsModel.d-D9GWPFrL.d.cts} +1 -1
- package/dist/{tabsModel.d-B7QMug1u.d.cts → tabsModel.d-D9GWPFrL.d.ts} +1 -1
- package/dist/televet/booking/index.d.cts +6 -6
- package/dist/televet/booking/index.d.ts +6 -6
- package/dist/testing/index.cjs +1 -1
- package/dist/testing/index.d.cts +85 -2
- package/dist/testing/index.d.ts +85 -2
- package/dist/testing/index.js +1 -1
- package/dist/testing/rn/index.d.cts +10 -10
- package/dist/testing/rn/index.d.ts +10 -10
- package/dist/testing/web/index.d.cts +10 -10
- package/dist/testing/web/index.d.ts +10 -10
- package/dist/texting/index.d.cts +6 -6
- package/dist/texting/index.d.ts +6 -6
- package/dist/{threadOptions.d-EFJaNBP1.d.cts → threadOptions.d-CRbFXnlq.d.cts} +66 -11
- package/dist/{threadOptions.d-GPJPprkn.d.cts → threadOptions.d-CW51PyVd.d.cts} +28 -1
- package/dist/{threadOptions.d-GPJPprkn.d.ts → threadOptions.d-CW51PyVd.d.ts} +28 -1
- package/dist/{threadOptions.d-B0folrKm.d.cts → threadOptions.d-U5YBUKM-.d.ts} +2 -2
- package/dist/{threadOptions.d-Crh_LiDe.d.ts → threadOptions.d-aK8FkszA.d.ts} +66 -11
- package/dist/{threadOptions.d-DTsJFkL-.d.ts → threadOptions.d-bEAFkIsC.d.cts} +2 -2
- package/dist/{timelineRows.d-DpSis9HR.d.ts → timelineRows.d-BbCLvjy1.d.ts} +1 -1
- package/dist/{timelineRows.d-6-Cw8xGd.d.cts → timelineRows.d-BvA_BoOe.d.cts} +1 -1
- package/dist/{typeStyle.d-B3Kdtjie.d.ts → typeStyle.d-B9Jo5mDX.d.ts} +1 -1
- package/dist/{typeStyle.d-DmlwyJq-.d.cts → typeStyle.d-Ckdh_S-t.d.cts} +1 -1
- package/dist/types.d-d3RdaeAA.d.cts +317 -0
- package/dist/types.d-d3RdaeAA.d.ts +317 -0
- package/dist/ui/index.cjs +68 -0
- package/dist/ui/index.d.cts +73 -0
- package/dist/ui/index.d.ts +73 -0
- package/dist/ui/index.js +68 -0
- package/dist/useHealthPlanSubscription.d-BN40CVK6.d.cts +756 -0
- package/dist/useHealthPlanSubscription.d-BYehTI7R.d.ts +756 -0
- package/dist/{usePresentation.d-CRG3Gaaq.d.ts → usePresentation.d-BfcyAEFt.d.ts} +66 -7
- package/dist/{usePresentation.d-C8rqY56C.d.cts → usePresentation.d-C39kKhoO.d.cts} +66 -7
- package/dist/{useRecordsDepth.d-DlRda5jp.d.ts → useRecordsDepth.d-B2ewVbRm.d.ts} +1 -1
- package/dist/{useRecordsDepth.d-BYk7m7gF.d.cts → useRecordsDepth.d-CKXAAHXI.d.cts} +1 -1
- package/dist/{view.d-DuIXHr08.d.ts → view.d-BnUDSQXz.d.ts} +3 -3
- package/dist/{view.d-B31M8rCG.d.cts → view.d-CbcJKNJj.d.cts} +1 -1
- package/dist/{view.d-B31M8rCG.d.ts → view.d-CbcJKNJj.d.ts} +1 -1
- package/dist/{view.d-CLpEHKOp.d.cts → view.d-DTNPjiZ1.d.cts} +3 -3
- package/dist/web/consent/index.d.cts +5 -5
- package/dist/web/consent/index.d.ts +5 -5
- package/dist/web/health-plan/index.cjs +335 -180
- package/dist/web/health-plan/index.d.cts +576 -19
- package/dist/web/health-plan/index.d.ts +576 -19
- package/dist/web/health-plan/index.js +297 -162
- package/dist/web/health-plan/styles.css +233 -0
- package/dist/web/health-plan/today/index.cjs +7 -0
- package/dist/web/health-plan/today/index.d.cts +15 -0
- package/dist/web/health-plan/today/index.d.ts +15 -0
- package/dist/web/health-plan/today/index.js +7 -0
- package/dist/web/index.cjs +36 -33
- package/dist/web/index.d.cts +60 -37
- package/dist/web/index.d.ts +60 -37
- package/dist/web/index.js +36 -33
- package/dist/web/intro/index.cjs +2 -2
- package/dist/web/intro/index.d.cts +8 -8
- package/dist/web/intro/index.d.ts +8 -8
- package/dist/web/intro/index.js +2 -2
- package/dist/web/notifications/index.d.cts +3 -3
- package/dist/web/notifications/index.d.ts +3 -3
- package/dist/web/records/depth/index.d.cts +9 -9
- package/dist/web/records/depth/index.d.ts +9 -9
- package/dist/web/records/index.cjs +1 -1
- package/dist/web/records/index.d.cts +11 -11
- package/dist/web/records/index.d.ts +11 -11
- package/dist/web/records/index.js +1 -1
- package/dist/web/records-sheet/index.cjs +13 -12
- package/dist/web/records-sheet/index.d.cts +13 -10
- package/dist/web/records-sheet/index.d.ts +13 -10
- package/dist/web/records-sheet/index.js +13 -12
- package/dist/web/shop/index.cjs +6 -6
- package/dist/web/shop/index.d.cts +8 -7
- package/dist/web/shop/index.d.ts +8 -7
- package/dist/web/shop/index.js +6 -6
- package/dist/web/shop/orders-v2/index.d.cts +1 -1
- package/dist/web/shop/orders-v2/index.d.ts +1 -1
- package/dist/web/televet/booking/index.cjs +1 -1
- package/dist/web/televet/booking/index.d.cts +6 -6
- package/dist/web/televet/booking/index.d.ts +6 -6
- package/dist/web/televet/booking/index.js +1 -1
- package/dist/web/texting/index.cjs +1 -1
- package/dist/web/texting/index.d.cts +6 -6
- package/dist/web/texting/index.d.ts +6 -6
- package/dist/web/texting/index.js +1 -1
- package/dist/web/ui/index.cjs +70 -0
- package/dist/web/ui/index.d.cts +78 -0
- package/dist/web/ui/index.d.ts +78 -0
- package/dist/web/ui/index.js +48 -0
- package/dist/web/ui/styles.css +244 -0
- package/package.json +71 -5
- package/ui/package.json +8 -0
- package/web/health-plan/today/native-blocked.cjs +12 -0
- package/web/health-plan/today/package.json +8 -0
- package/web/ui/native-blocked.cjs +12 -0
- package/web/ui/package.json +8 -0
- package/dist/useHealthPlanSubscription.d-DD30EkUR.d.ts +0 -205
- package/dist/useHealthPlanSubscription.d-DWrzUXf4.d.cts +0 -205
|
@@ -0,0 +1,434 @@
|
|
|
1
|
+
/*! @everfur/sdk. Copyright (c) 2026 Strand Health Inc. dba Everfur. All rights reserved. Use is subject to the Everfur SDK License: https://docs.everfur.com/license */
|
|
2
|
+
import { q as OmsCents, p as OmsCartLine, n as OmsPrescription, y as OmsResult, h as OmsReceipt } from '../omsErrors.d-VF5tnr20.js';
|
|
3
|
+
export { o as OmsAddress, k as OmsAddressDetail, D as OmsAddressEntry, O as OmsAddressInput, a as OmsBuyAgainItem, E as OmsCancelOutcome, F as OmsCardActionLink, G as OmsCardSetupLink, H as OmsCase, I as OmsCheckout, J as OmsCheckoutState, K as OmsConfirmation, L as OmsCycleDraft, M as OmsCycleReview, N as OmsCycleReviewState, P as OmsDeliverySpeed, j as OmsError, r as OmsOffer, Q as OmsOfferPage, b as OmsOrder, R as OmsOrderFulfiller, d as OmsOrderItem, S as OmsOrderLine, T as OmsOrderListStep, e as OmsOrderPage, U as OmsOrderStatus, V as OmsOrderStatusLineKey, W as OmsOrderStep, X as OmsOrderStepKey, c as OmsOrderSummary, Y as OmsPackUnit, Z as OmsPayOutcome, l as OmsPaymentMethod, _ as OmsPaymentSetup, $ as OmsPaymentStatus, f as OmsPlan, s as OmsPlanChangeOption, a0 as OmsPlanInput, a1 as OmsPlanLine, t as OmsPlanOperation, a2 as OmsPlanPage, a3 as OmsPlanPatch, m as OmsPlanSkipWarning, u as OmsPlanSkipWarningKey, a4 as OmsPlanState, a5 as OmsPlanStopReason, a6 as OmsPrescriptionStatus, g as OmsQuote, v as OmsQuoteLine, w as OmsReceiptCard, x as OmsReceiptLine, a7 as OmsRefund, a8 as OmsResaleOutcome, a9 as OmsReturn, aa as OmsReturnLine, ab as OmsShipment, ac as OmsShipmentState, i as OmsShopConfig, z as OmsSupply, ad as OmsTrackingEvent } from '../omsErrors.d-VF5tnr20.js';
|
|
4
|
+
import { d as CareFirstAutoOrderPrice, c as CareOmsQuote, e as CareOmsAddressLocation } from '../omsFields.d-Cvfw8wWU.js';
|
|
5
|
+
export { f as CareOmsAddressInput, g as CareOmsBuyAgainItem, b as CareOmsOrder, h as CareOmsOrderItem, i as CareOmsOrderPage, C as CareOmsOrderSummary, j as CareOmsPlan, k as CareOmsReceipt, a as CareOmsShopConfig, l as CareOmsTooSoonRefusal, m as addressLocationOf, n as addressLocationToWire, o as againPetId, p as firstAutoOrderPriceOf, q as firstRxDiscountCodeOf, r as orderCardActionUrl, s as petQuery, t as planImageUrl, u as planResumeShipOn, v as planTitle, w as receiptRefund, x as rxShipsToStatesOf, y as summaryClinicName, z as summaryDiscountCode, A as summaryLineCount, B as summaryNeedsPayment, D as summaryPetId, E as tooSoonOnOf } from '../omsFields.d-Cvfw8wWU.js';
|
|
6
|
+
|
|
7
|
+
/** How often a line comes: on an auto-refill plan, or this once. */
|
|
8
|
+
type CarePlan = 'auto' | 'once';
|
|
9
|
+
/** The cart drawer's two How often buttons, in the product's own words ("Auto-refill" / "This refill"). */
|
|
10
|
+
interface CarePlanWords {
|
|
11
|
+
readonly auto: string;
|
|
12
|
+
readonly once: string;
|
|
13
|
+
}
|
|
14
|
+
/** One cart line: the SDK shop's stored line plus the Care fields. */
|
|
15
|
+
interface CareCartItem {
|
|
16
|
+
/** `offerId|petId|rxId` (the SDK shop's `cartKey`). */
|
|
17
|
+
readonly key: string;
|
|
18
|
+
readonly offerId: string;
|
|
19
|
+
readonly petId?: string;
|
|
20
|
+
readonly rxId?: string;
|
|
21
|
+
readonly title: string;
|
|
22
|
+
/** One unit in cents, the one-time price; null when the price was not known at the add. */
|
|
23
|
+
readonly unitPrice: OmsCents | null;
|
|
24
|
+
/**
|
|
25
|
+
* The auto plan's unit price in cents. What a first auto order is charged when shop-config says so
|
|
26
|
+
* (`firstAutoOrderPrice: "auto"`, see `unitCents`); absent, the line is priced at `unitPrice` either way.
|
|
27
|
+
*/
|
|
28
|
+
readonly autoUnitPrice?: OmsCents;
|
|
29
|
+
readonly requiresRx: boolean;
|
|
30
|
+
readonly quantity: number;
|
|
31
|
+
/** The product photo, https only (the SDK shop's rule). */
|
|
32
|
+
readonly imageUrl?: string;
|
|
33
|
+
readonly plan?: CarePlan;
|
|
34
|
+
/** Added as one per cart (a prescription the server marks so). */
|
|
35
|
+
readonly onePerCart?: boolean;
|
|
36
|
+
/** Display only: what it is ("32 fl oz"). */
|
|
37
|
+
readonly meta?: string;
|
|
38
|
+
/** Display only: the pack ("30 tablets"). */
|
|
39
|
+
readonly packLabel?: string;
|
|
40
|
+
/** Display only: the auto plan's words ("Every 4 months, 10% off"). */
|
|
41
|
+
readonly planLabel?: string;
|
|
42
|
+
/** Display only: the drawer's How often buttons; absent, the line has no plan choice. */
|
|
43
|
+
readonly planWords?: CarePlanWords;
|
|
44
|
+
/** The auto plan's cadence (7 to 365 days), for the plan made after the order. */
|
|
45
|
+
readonly cadenceDays?: number;
|
|
46
|
+
/** Display only: the staff icon name for the no-picture thumb. */
|
|
47
|
+
readonly icon?: string;
|
|
48
|
+
/** Display only: the thumb's tint. */
|
|
49
|
+
readonly tint?: string;
|
|
50
|
+
}
|
|
51
|
+
/** What an add takes: the product and the pet it is for. */
|
|
52
|
+
interface CareCartAdd {
|
|
53
|
+
readonly offerId: string;
|
|
54
|
+
readonly petId?: string;
|
|
55
|
+
readonly rxId?: string;
|
|
56
|
+
readonly title: string;
|
|
57
|
+
readonly unitPrice: OmsCents | null;
|
|
58
|
+
readonly autoUnitPrice?: OmsCents | null;
|
|
59
|
+
readonly requiresRx: boolean;
|
|
60
|
+
readonly imageUrl?: string | null;
|
|
61
|
+
/** The plan picked for this add. Absent or null: the line keeps its plan, a new line takes `defaultPlan`. */
|
|
62
|
+
readonly plan?: CarePlan | null;
|
|
63
|
+
/** The product's default plan for a new line (the phone's `defaultPlan`). */
|
|
64
|
+
readonly defaultPlan?: CarePlan | null;
|
|
65
|
+
readonly onePerCart?: boolean;
|
|
66
|
+
readonly meta?: string | null;
|
|
67
|
+
readonly packLabel?: string | null;
|
|
68
|
+
readonly planLabel?: string | null;
|
|
69
|
+
readonly planWords?: CarePlanWords | null;
|
|
70
|
+
readonly cadenceDays?: number | null;
|
|
71
|
+
readonly icon?: string | null;
|
|
72
|
+
readonly tint?: string | null;
|
|
73
|
+
}
|
|
74
|
+
/** What an add did. `already`: a one-per-cart line is in. `rx_limit`: the pet has another prescription in. */
|
|
75
|
+
type CareCartAddResult = 'added' | 'more' | 'already' | 'rx_limit';
|
|
76
|
+
/** The two places the phone and the web differ on the cart's rules. Every field is optional. */
|
|
77
|
+
interface CareCartOptions {
|
|
78
|
+
/**
|
|
79
|
+
* The most of one line. Default 99, the OMS's own cap (contract 3.5): the phone app had no cap of its own. The web
|
|
80
|
+
* app and the SDK shop pass 5 (`CARE_CART_MAX_QUANTITY`, the design's `MAXQ`).
|
|
81
|
+
*/
|
|
82
|
+
readonly maxQuantity?: number;
|
|
83
|
+
/**
|
|
84
|
+
* Every prescription line is in once at quantity 1, whatever the server says (the web app's rule). Default false
|
|
85
|
+
* (the phone app's rule): a prescription line is one per cart only when it has an `rxId` or was added as
|
|
86
|
+
* `onePerCart`, and otherwise steps like any line.
|
|
87
|
+
*/
|
|
88
|
+
readonly lockRxLines?: boolean;
|
|
89
|
+
}
|
|
90
|
+
/** The OMS's own cap on a line's quantity (contract 3.5), the default `maxQuantity`. */
|
|
91
|
+
declare const CARE_CART_OMS_MAX_QUANTITY = 99;
|
|
92
|
+
/** The design's most of one line (`MAXQ`): the one cart line cap (src/client/cartLimits.ts). */
|
|
93
|
+
declare const CARE_CART_MAX_QUANTITY = 5;
|
|
94
|
+
/** The SDK shop's line key: `offerId|petId|rxId`. */
|
|
95
|
+
declare function cartLineKey(line: {
|
|
96
|
+
readonly offerId: string;
|
|
97
|
+
readonly petId?: string;
|
|
98
|
+
readonly rxId?: string;
|
|
99
|
+
}): string;
|
|
100
|
+
/**
|
|
101
|
+
* A stored cart read back (the SDK shop's `parseItems`, keeping the Care fields): only well-formed lines survive, a
|
|
102
|
+
* repeated key keeps its first line, a quantity is clamped to 1..`maxQuantity` (a line with an `rxId` keeps its own,
|
|
103
|
+
* clamped to 1..`CARE_CART_OMS_MAX_QUANTITY`).
|
|
104
|
+
* Anything that does not read is an empty cart, never an error.
|
|
105
|
+
*/
|
|
106
|
+
declare function parseCartItems(raw: string | null, opts?: CareCartOptions): CareCartItem[];
|
|
107
|
+
/** The cart after an add, and what the add did. A refused add (`already`, `rx_limit`) returns the cart unchanged. */
|
|
108
|
+
declare function addLine(items: readonly CareCartItem[], input: CareCartAdd, opts?: CareCartOptions): {
|
|
109
|
+
readonly items: CareCartItem[];
|
|
110
|
+
readonly result: CareCartAddResult;
|
|
111
|
+
};
|
|
112
|
+
/** A quantity set: 0 or less removes the line; a locked line keeps its quantity; else clamped to 1..`maxQuantity`. */
|
|
113
|
+
declare function setLineQuantity(items: readonly CareCartItem[], key: string, quantity: number, opts?: CareCartOptions): CareCartItem[];
|
|
114
|
+
/** A line's plan set. */
|
|
115
|
+
declare function setLinePlan(items: readonly CareCartItem[], key: string, plan: CarePlan): CareCartItem[];
|
|
116
|
+
/** The cart without these lines (an order was placed for them). */
|
|
117
|
+
declare function removeLines(items: readonly CareCartItem[], keys: readonly string[]): CareCartItem[];
|
|
118
|
+
/**
|
|
119
|
+
* Lines put back (a bank's check that did not pass): each line not in the cart now, read through the same rules as a
|
|
120
|
+
* stored cart.
|
|
121
|
+
*/
|
|
122
|
+
declare function restoreLines(items: readonly CareCartItem[], lines: readonly CareCartItem[], opts?: CareCartOptions): CareCartItem[];
|
|
123
|
+
/**
|
|
124
|
+
* One pet's lines, in the order they were added. The design's cart is "For <pet>" and he drew no cart with two pets in it,
|
|
125
|
+
* so a screen shows and checks out one pet's lines; no pet, no lines.
|
|
126
|
+
*/
|
|
127
|
+
declare function linesForPet(items: readonly CareCartItem[], petId: string | null | undefined): CareCartItem[];
|
|
128
|
+
/** The last `n` lines (default 3), oldest first: the float bar's thumbs. */
|
|
129
|
+
declare function lastLines(items: readonly CareCartItem[], n?: number): CareCartItem[];
|
|
130
|
+
/** What `rxIdFor` reads of an OMS prescription (`GET /oms/prescriptions`). */
|
|
131
|
+
type CareRxRef = Pick<OmsPrescription, 'rxId' | 'petId' | 'offerId' | 'status'>;
|
|
132
|
+
/**
|
|
133
|
+
* The prescription a prescription line is filled on: the pet's own for that offer, a ready one first, else the first
|
|
134
|
+
* listed (the OMS refuses one it cannot fill, with its own reason). Null when the pet has none for it.
|
|
135
|
+
*/
|
|
136
|
+
declare function rxIdFor(prescriptions: readonly CareRxRef[] | null | undefined, offerId: string, petId: string | null | undefined): string | null;
|
|
137
|
+
/**
|
|
138
|
+
* The lines with every prescription line's `rxId`: kept when the line has one, else resolved from the pet's
|
|
139
|
+
* prescriptions (`rxIdFor`). The OMS refuses a prescription line without it (409 `rx_required`). The line's `key`
|
|
140
|
+
* stays as stored, so the cart still finds it.
|
|
141
|
+
*/
|
|
142
|
+
declare function withRxIds(items: readonly CareCartItem[], prescriptions: readonly CareRxRef[] | null | undefined): CareCartItem[];
|
|
143
|
+
/**
|
|
144
|
+
* The cart's line for this prescription add: its own key, else the pet's prescription line for the same offer (added
|
|
145
|
+
* with or without its `rxId`), so a page finds it whichever way it went in.
|
|
146
|
+
*/
|
|
147
|
+
declare function rxLineOf(items: readonly CareCartItem[], add: {
|
|
148
|
+
readonly offerId: string;
|
|
149
|
+
readonly petId?: string;
|
|
150
|
+
readonly rxId?: string;
|
|
151
|
+
}): CareCartItem | null;
|
|
152
|
+
/** True while a prescription line still lacks its `rxId`. */
|
|
153
|
+
declare function needsRxId(items: readonly CareCartItem[]): boolean;
|
|
154
|
+
/** An OMS quote or checkout line: exactly the OMS line (`OmsCartLine`). */
|
|
155
|
+
type CareOmsLine = OmsCartLine;
|
|
156
|
+
/** Options for {@link omsLines}. */
|
|
157
|
+
interface CareOmsLinesOptions {
|
|
158
|
+
/** Send each line's plan (`auto` / `once`) so the OMS prices a first auto-ship order. Default false. */
|
|
159
|
+
readonly withPlan?: boolean;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* The OMS quote and checkout lines (the SDK shop's `cartLines`): offer, quantity, and the pet and prescription when
|
|
163
|
+
* set; the line's plan too with `withPlan`. With the pet's prescriptions, a prescription line added without its
|
|
164
|
+
* `rxId` is sent with it (`withRxIds`).
|
|
165
|
+
*/
|
|
166
|
+
declare function omsLines(items: readonly CareCartItem[], prescriptions?: readonly CareRxRef[] | null, options?: CareOmsLinesOptions): CareOmsLine[];
|
|
167
|
+
/** Where a cart is kept between loads: a synchronous read and write (the web's sessionStorage; tests pass a map). */
|
|
168
|
+
interface CareCartStorage {
|
|
169
|
+
read(): string | null;
|
|
170
|
+
write(value: string): void;
|
|
171
|
+
}
|
|
172
|
+
/** A small cart store over the rules above: framework-free, one per member, with listeners. */
|
|
173
|
+
interface CareCartStore {
|
|
174
|
+
readonly items: () => readonly CareCartItem[];
|
|
175
|
+
readonly subscribe: (listener: () => void) => () => void;
|
|
176
|
+
readonly add: (input: CareCartAdd) => CareCartAddResult;
|
|
177
|
+
readonly setQuantity: (key: string, quantity: number) => void;
|
|
178
|
+
readonly setPlan: (key: string, plan: CarePlan) => void;
|
|
179
|
+
readonly remove: (key: string) => void;
|
|
180
|
+
/** Drops the lines an order was placed for. */
|
|
181
|
+
readonly removeKeys: (keys: readonly string[]) => void;
|
|
182
|
+
/** Puts lines back that are not in the cart now (`restoreLines`). */
|
|
183
|
+
readonly restore: (lines: readonly CareCartItem[]) => void;
|
|
184
|
+
readonly clear: () => void;
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* A cart store: reads `storage` once, writes every change through it (a write that throws keeps the cart in memory),
|
|
188
|
+
* and tells its listeners. A refused add changes nothing and tells no one. React hosts read it with
|
|
189
|
+
* `useSyncExternalStore(store.subscribe, store.items)`.
|
|
190
|
+
*/
|
|
191
|
+
declare function createCareCartStore(storage: CareCartStorage | null, opts?: CareCartOptions): CareCartStore;
|
|
192
|
+
|
|
193
|
+
/** The pet's pronoun as B1 sends it (`pet.pronoun`). */
|
|
194
|
+
type CarePronoun = 'her' | 'his' | 'their';
|
|
195
|
+
/** The plural verb after "they": has -> have, runs -> run, doesn't -> don't, won't stays. */
|
|
196
|
+
declare function theyVerb(verb: string): string;
|
|
197
|
+
/** `text`, written for a "her" pet, with the pet's own pronoun. */
|
|
198
|
+
declare function swapPronoun(text: string, pronoun: CarePronoun): string;
|
|
199
|
+
/** Every string (and string-returning function, and string tuple) in `copy` swapped, except the `keep` keys. */
|
|
200
|
+
declare function swapPronounCopy<T extends Record<string, unknown>>(copy: T, pronoun: CarePronoun, keep?: readonly (keyof T)[]): T;
|
|
201
|
+
/** The pronoun for a pet's sex, by the backend's rule (`care_home_facts.pronoun`). */
|
|
202
|
+
declare function pronounForSex(sex: string | null | undefined): CarePronoun;
|
|
203
|
+
|
|
204
|
+
/** The cart's sums. */
|
|
205
|
+
interface CareCartTotals {
|
|
206
|
+
/** Sum of quantities. */
|
|
207
|
+
readonly count: number;
|
|
208
|
+
/** Prescription lines: the pharmacy package, charged when filled. */
|
|
209
|
+
readonly rxCents: number;
|
|
210
|
+
/** Everything else: her Everfur box, charged today. */
|
|
211
|
+
readonly boxCents: number;
|
|
212
|
+
/** min(first prescription discount, rx) when a prescription is in; else 0. */
|
|
213
|
+
readonly offCents: number;
|
|
214
|
+
/** box + rx - off: the items as the lines show them (the phone's `netCents`, the web's `itemsCents`). */
|
|
215
|
+
readonly itemsCents: number;
|
|
216
|
+
/** The phone's float bar big number: the box when there is one, else rx - off. */
|
|
217
|
+
readonly bigCents: number;
|
|
218
|
+
/** What the box still needs for free shipping; 0 when free, when there is no box, or with no threshold. */
|
|
219
|
+
readonly toFreeCents: number;
|
|
220
|
+
/** True while a line's price is unknown: totals wait for the quote. */
|
|
221
|
+
readonly unpriced: boolean;
|
|
222
|
+
}
|
|
223
|
+
/** What `cartTotals` reads of shop-config. */
|
|
224
|
+
interface CareCartPricing {
|
|
225
|
+
/** Shop-config's `firstRxDiscountCents` (VET50); null or 0: no discount. */
|
|
226
|
+
readonly firstRxDiscountCents: number | null;
|
|
227
|
+
/** Shop-config's `freeShippingThresholdCents`; absent or null: no free-shipping line. */
|
|
228
|
+
readonly freeShippingThresholdCents?: number | null;
|
|
229
|
+
/** Shop-config's `first_auto_order_price`; absent or null: the one-time price (see `unitCents`). */
|
|
230
|
+
readonly firstAutoOrderPrice?: CareFirstAutoOrderPrice | null;
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* THE FIRST AUTO ORDER'S UNIT PRICE, IN ONE PLACE. `"auto"` charges a line on auto its auto price on this order;
|
|
234
|
+
* `"once"`, or no setting (the default, and an older server), the one-time price, and the plan's discount starts with
|
|
235
|
+
* the next shipment (owner decision 2026-10-30, "Order, then set up the plan"). What the lines show; the money a
|
|
236
|
+
* member pays is always the OMS quote's.
|
|
237
|
+
*/
|
|
238
|
+
declare function unitCents(item: Pick<CareCartItem, 'unitPrice' | 'autoUnitPrice' | 'plan'>, firstAutoOrderPrice?: CareFirstAutoOrderPrice | null): number | null;
|
|
239
|
+
/** A line's price: its unit price (`unitCents`, an unknown price counts 0) times quantity. */
|
|
240
|
+
declare function lineCents(item: CareCartItem, firstAutoOrderPrice?: CareFirstAutoOrderPrice | null): number;
|
|
241
|
+
/** The cart's sums, before the quote. */
|
|
242
|
+
declare function cartTotals(items: readonly CareCartItem[], pricing: CareCartPricing): CareCartTotals;
|
|
243
|
+
/** The key of the line the first prescription discount lands on (app-care.js `offId`); null when none does. */
|
|
244
|
+
declare function discountedLineKey(items: readonly CareCartItem[], totals: Pick<CareCartTotals, 'offCents'>): string | null;
|
|
245
|
+
/** "$64.99", "-$50.00". */
|
|
246
|
+
declare function careMoney(cents: number): string;
|
|
247
|
+
/** "$50", "$35": whole dollars drop the cents, as the designer writes them; else `careMoney`. */
|
|
248
|
+
declare function careMoneyShort(cents: number): string;
|
|
249
|
+
/**
|
|
250
|
+
* "1 item", "3 items".
|
|
251
|
+
*
|
|
252
|
+
* @beta
|
|
253
|
+
*/
|
|
254
|
+
declare function careItemCount(n: number): string;
|
|
255
|
+
/**
|
|
256
|
+
* The phone's lines the designer did not draw, written to his cart words (the phone app's `CART_UNDRAWN`).
|
|
257
|
+
*
|
|
258
|
+
* @beta
|
|
259
|
+
*/
|
|
260
|
+
declare const CARE_CART_UNDRAWN: {
|
|
261
|
+
/** No free-shipping threshold from shop-config: the cost shows with the total, so no free shipping is claimed. */
|
|
262
|
+
readonly shippingAtCheckout: "shipping at checkout";
|
|
263
|
+
/** A prescription alone with no first-prescription offer ("charged once filled"). */
|
|
264
|
+
readonly chargedWhenFilled: "charged when it’s filled";
|
|
265
|
+
/** A second, different prescription for the same pet (one per cart). */
|
|
266
|
+
readonly rxLimit: (name: string) => string;
|
|
267
|
+
};
|
|
268
|
+
/**
|
|
269
|
+
* The phone's kit traybar (care-shop, For <pet>, product pages, tracking): the button and its fine line.
|
|
270
|
+
*
|
|
271
|
+
* @beta
|
|
272
|
+
*/
|
|
273
|
+
declare function careTrayCopy(totals: CareCartTotals, pronoun?: CarePronoun): {
|
|
274
|
+
readonly button: string;
|
|
275
|
+
readonly fine: string;
|
|
276
|
+
};
|
|
277
|
+
/**
|
|
278
|
+
* The phone's float bar (Shop B, search, Orders): the big number and the sub line.
|
|
279
|
+
*
|
|
280
|
+
* @beta
|
|
281
|
+
*/
|
|
282
|
+
declare function careFloatCopy(totals: CareCartTotals, freeShippingThresholdCents: number | null): {
|
|
283
|
+
readonly big: string;
|
|
284
|
+
readonly sub: string;
|
|
285
|
+
readonly subIsOffer: boolean;
|
|
286
|
+
};
|
|
287
|
+
/**
|
|
288
|
+
* The phone's toast after an add (kit `say()`).
|
|
289
|
+
*
|
|
290
|
+
* @beta
|
|
291
|
+
*/
|
|
292
|
+
declare function careAddToast(result: 'added' | 'more' | 'already' | 'rx_limit', name: string, isRx: boolean): string;
|
|
293
|
+
/**
|
|
294
|
+
* The web's slim cart bar sub line (app-care.js `bars`): the count, then the first prescription offer, or what is
|
|
295
|
+
* left to free shipping, or that it ships free. "Ships free" only where the shop says so: a prescription's shipping is
|
|
296
|
+
* the pharmacy's, known only from the quote, so a cart with one says the count alone. Null when the shop sends no
|
|
297
|
+
* threshold and no offer applies: the packet draws no line for that.
|
|
298
|
+
*
|
|
299
|
+
* @beta
|
|
300
|
+
*/
|
|
301
|
+
declare function cartBarSub(totals: CareCartTotals, freeShippingThresholdCents: number | null, pronoun?: CarePronoun): string | null;
|
|
302
|
+
/**
|
|
303
|
+
* What a screen reader hears after a cart change (app-care.js `said`).
|
|
304
|
+
*
|
|
305
|
+
* @beta
|
|
306
|
+
*/
|
|
307
|
+
declare const cartSaid: {
|
|
308
|
+
readonly added: (name: string) => string;
|
|
309
|
+
readonly removed: (name: string) => string;
|
|
310
|
+
readonly count: (name: string, n: number) => string;
|
|
311
|
+
};
|
|
312
|
+
/** A line's price as drawn: `priceCents` struck when `offCents` is over 0, `priceCents - offCents` shown. */
|
|
313
|
+
interface CareShownLinePrice {
|
|
314
|
+
readonly priceCents: number;
|
|
315
|
+
readonly offCents: number;
|
|
316
|
+
}
|
|
317
|
+
/** What `shownLinePrices` reads of a quoted line (quote.ts `CareQuoteLineView` fits). */
|
|
318
|
+
interface CareQuotedLine {
|
|
319
|
+
readonly offerId: string;
|
|
320
|
+
readonly petId: string | null;
|
|
321
|
+
readonly discountCents: number;
|
|
322
|
+
readonly netCents: number;
|
|
323
|
+
}
|
|
324
|
+
/**
|
|
325
|
+
* EACH LINE'S PRICE AS THE QUOTE CHARGES IT. With a quote, a line shows what the OMS charges for it on this order (its
|
|
326
|
+
* net: unit price x quantity less the quote's discount), so the lines add up to Items and Items + shipping + tax is the
|
|
327
|
+
* total. The first prescription's cut (the line `discountedKey` names) is drawn the packet's way: the price before it
|
|
328
|
+
* struck, the cut under. Without a quote a line shows the cart's price. Lines match quote lines by offer and pet, in
|
|
329
|
+
* order.
|
|
330
|
+
*/
|
|
331
|
+
declare function shownLinePrices(items: readonly CareCartItem[], quoteLines: readonly CareQuotedLine[] | null, opts: {
|
|
332
|
+
readonly discountedKey: string | null;
|
|
333
|
+
readonly offCents: number;
|
|
334
|
+
readonly firstAutoOrderPrice: CareFirstAutoOrderPrice | null;
|
|
335
|
+
}): Map<string, CareShownLinePrice>;
|
|
336
|
+
/**
|
|
337
|
+
* A line's meta under its name, joined with " · ", without the words its name already says: "Rimadyl 75 mg, 30
|
|
338
|
+
* caplets" over "30 caplets", "Every 30 days" reads "Every 30 days". Empty and repeated parts go too.
|
|
339
|
+
*/
|
|
340
|
+
declare function lineMeta(title: string, parts: readonly (string | null | undefined)[]): string;
|
|
341
|
+
|
|
342
|
+
/** One quoted line as checkout draws it: its price before and after the quote's discount. */
|
|
343
|
+
interface CareQuoteLineView {
|
|
344
|
+
readonly offerId: string;
|
|
345
|
+
readonly petId: string | null;
|
|
346
|
+
readonly quantity: number;
|
|
347
|
+
/** unit price x quantity. */
|
|
348
|
+
readonly grossCents: number;
|
|
349
|
+
readonly discountCents: number;
|
|
350
|
+
/** What the line costs on this order: gross less its discount. */
|
|
351
|
+
readonly netCents: number;
|
|
352
|
+
}
|
|
353
|
+
/** The quote's money, with the due split filled in when the server sent none. */
|
|
354
|
+
interface CareQuoteView {
|
|
355
|
+
/** The lines as quoted, in the quote's order. */
|
|
356
|
+
readonly lines: readonly CareQuoteLineView[];
|
|
357
|
+
/** Items as the lines show them (their nets): Items + shipping + tax is the total. */
|
|
358
|
+
readonly itemsCents: number;
|
|
359
|
+
readonly totalCents: number;
|
|
360
|
+
readonly taxCents: number;
|
|
361
|
+
readonly shippingCents: number;
|
|
362
|
+
readonly dueTodayCents: number;
|
|
363
|
+
readonly dueWhenFilledCents: number;
|
|
364
|
+
readonly whenFilledDiscountCents: number;
|
|
365
|
+
/** True when the server sent the due split (not the fallback). */
|
|
366
|
+
readonly serverSplit: boolean;
|
|
367
|
+
readonly expiresAt: string;
|
|
368
|
+
/** The box's estimated ship and arrival days; null from an older server. */
|
|
369
|
+
readonly shipsOn: string | null;
|
|
370
|
+
readonly arrivesOn: string | null;
|
|
371
|
+
}
|
|
372
|
+
/** The quote as checkout draws it. `items` are the cart lines it was made for (to tell a prescription line). */
|
|
373
|
+
declare function adaptQuote(quote: CareOmsQuote, items: readonly Pick<CareCartItem, 'offerId' | 'requiresRx'>[]): CareQuoteView;
|
|
374
|
+
/** The one OMS client call `omsReceipt` uses; an SDK `OmsClient` fits it. */
|
|
375
|
+
interface CareReceiptReader {
|
|
376
|
+
readonly receipt?: (orderId: string) => Promise<OmsResult<OmsReceipt>>;
|
|
377
|
+
}
|
|
378
|
+
/**
|
|
379
|
+
* An order's receipt. `OmsClient.receipt` is optional on the interface (a host's own double may lack it), so a client
|
|
380
|
+
* without it settles as `unavailable` instead of throwing.
|
|
381
|
+
*/
|
|
382
|
+
declare function omsReceipt(client: CareReceiptReader, orderId: string): Promise<OmsResult<OmsReceipt>>;
|
|
383
|
+
|
|
384
|
+
/** The most suggestions the field shows. */
|
|
385
|
+
declare const CARE_ADDRESS_SUGGESTIONS_SHOWN = 5;
|
|
386
|
+
/** Fewer typed characters than this ask nothing. */
|
|
387
|
+
declare const CARE_ADDRESS_SEARCH_MIN_CHARS = 3;
|
|
388
|
+
interface CareAddressSuggestion {
|
|
389
|
+
readonly placeId: string;
|
|
390
|
+
readonly main: string;
|
|
391
|
+
readonly secondary: string;
|
|
392
|
+
}
|
|
393
|
+
interface CareAddressSuggestions {
|
|
394
|
+
readonly available: boolean;
|
|
395
|
+
readonly suggestions: readonly CareAddressSuggestion[];
|
|
396
|
+
}
|
|
397
|
+
/** A picked place, as the address form takes it. */
|
|
398
|
+
interface CareAddressPlace {
|
|
399
|
+
readonly line1: string;
|
|
400
|
+
readonly city: string;
|
|
401
|
+
/** Upper-cased state code. */
|
|
402
|
+
readonly region: string;
|
|
403
|
+
readonly postalCode: string;
|
|
404
|
+
readonly country: string;
|
|
405
|
+
readonly location: CareOmsAddressLocation;
|
|
406
|
+
}
|
|
407
|
+
/** A details read, settled. */
|
|
408
|
+
type CareAddressPlaceResult = {
|
|
409
|
+
readonly kind: 'ok';
|
|
410
|
+
readonly place: CareAddressPlace;
|
|
411
|
+
}
|
|
412
|
+
/** 404: the place is not a street address. Search stays on. */
|
|
413
|
+
| {
|
|
414
|
+
readonly kind: 'notAddress';
|
|
415
|
+
}
|
|
416
|
+
/** 503, or anything else that did not read: search goes off. */
|
|
417
|
+
| {
|
|
418
|
+
readonly kind: 'unavailable';
|
|
419
|
+
};
|
|
420
|
+
/** The two reads, live or a fixture's. Implementations settle; a suggestions read rejects only when its signal aborted. */
|
|
421
|
+
interface CareAddressSearchPort {
|
|
422
|
+
suggestions(q: string, session: string, signal?: AbortSignal): Promise<CareAddressSuggestions>;
|
|
423
|
+
place(placeId: string, session: string): Promise<CareAddressPlaceResult>;
|
|
424
|
+
}
|
|
425
|
+
/** Search off: no suggestions. */
|
|
426
|
+
declare const CARE_ADDRESS_SEARCH_OFF: CareAddressSuggestions;
|
|
427
|
+
/** The suggestions answer, at most `max` (default 5) rows; search off when it does not read or says it is off. */
|
|
428
|
+
declare function parseAddressSuggestions(body: unknown, max?: number): CareAddressSuggestions;
|
|
429
|
+
/** One place's details; null when a field the form needs is missing or a coordinate is out of range. */
|
|
430
|
+
declare function parseAddressPlace(body: unknown): CareAddressPlace | null;
|
|
431
|
+
/** A details answer settled by its HTTP status: 404 is `notAddress`, any other failure or bad body `unavailable`. */
|
|
432
|
+
declare function addressPlaceResult(status: number, body: unknown): CareAddressPlaceResult;
|
|
433
|
+
|
|
434
|
+
export { CARE_ADDRESS_SEARCH_MIN_CHARS, CARE_ADDRESS_SEARCH_OFF, CARE_ADDRESS_SUGGESTIONS_SHOWN, CARE_CART_MAX_QUANTITY, CARE_CART_OMS_MAX_QUANTITY, CARE_CART_UNDRAWN, type CareAddressPlace, type CareAddressPlaceResult, type CareAddressSearchPort, type CareAddressSuggestion, type CareAddressSuggestions, type CareCartAdd, type CareCartAddResult, type CareCartItem, type CareCartOptions, type CareCartPricing, type CareCartStorage, type CareCartStore, type CareCartTotals, CareFirstAutoOrderPrice, CareOmsAddressLocation, type CareOmsLine, type CareOmsLinesOptions, CareOmsQuote, type CarePlan, type CarePlanWords, type CarePronoun, type CareQuoteLineView, type CareQuoteView, type CareQuotedLine, type CareReceiptReader, type CareRxRef, type CareShownLinePrice, OmsCartLine, OmsCents, OmsPrescription, OmsReceipt, OmsResult, adaptQuote, addLine, addressPlaceResult, careAddToast, careFloatCopy, careItemCount, careMoney, careMoneyShort, careTrayCopy, cartBarSub, cartLineKey, cartSaid, cartTotals, createCareCartStore, discountedLineKey, lastLines, lineCents, lineMeta, linesForPet, needsRxId, omsLines, omsReceipt, parseAddressPlace, parseAddressSuggestions, parseCartItems, pronounForSex, removeLines, restoreLines, rxIdFor, rxLineOf, setLinePlan, setLineQuantity, shownLinePrices, swapPronoun, swapPronounCopy, theyVerb, unitCents, withRxIds };
|
|
@@ -0,0 +1,3 @@
|
|
|
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
|
+
var CARE_CART_OMS_MAX_QUANTITY=99,CARE_CART_MAX_QUANTITY=5,maxOf=opts=>{let max=opts?.maxQuantity;return typeof max=="number"&&Number.isFinite(max)&&max>=1?Math.floor(max):CARE_CART_OMS_MAX_QUANTITY},clampTo=(n,max)=>Math.max(1,Math.min(max,Math.round(n)));function cartLineKey(line){return`${line.offerId}|${line.petId??""}|${line.rxId??""}`}var isText=v=>typeof v=="string"&&v!=="",httpsOnly=v=>typeof v=="string"&&/^https:\/\/\S+$/i.test(v)?v:void 0,short=v=>typeof v=="string"&&v.trim()!==""&&v.length<=120;function extras(o){let words=o.planWords,w=words!==null&&typeof words=="object"?words:null,days=o.cadenceDays,auto=o.autoUnitPrice;return{...typeof auto=="number"&&Number.isInteger(auto)&&auto>=0?{autoUnitPrice:auto}:{},...typeof days=="number"&&Number.isInteger(days)&&days>=7&&days<=365?{cadenceDays:days}:{},...o.onePerCart===true?{onePerCart:true}:{},...short(o.meta)?{meta:o.meta}:{},...short(o.packLabel)?{packLabel:o.packLabel}:{},...short(o.planLabel)?{planLabel:o.planLabel}:{},...w&&short(w.auto)&&short(w.once)?{planWords:{auto:w.auto,once:w.once}}:{},...short(o.icon)?{icon:o.icon}:{},...short(o.tint)?{tint:o.tint}:{}}}var isLocked=(item,opts)=>!!item.rxId||opts?.lockRxLines===true&&item.requiresRx;function parseCartItems(raw,opts){if(!raw)return[];let data;try{data=JSON.parse(raw)}catch{return[]}return Array.isArray(data)?readItems(data,opts):[]}function readItems(data,opts){let max=maxOf(opts),out=[];for(let d of data){if(!d||typeof d!="object")continue;let o=d,offerId=o.offerId,title=o.title,quantity=o.quantity;if(!isText(offerId)||typeof title!="string"||typeof quantity!="number"||!Number.isFinite(quantity))continue;let petId=o.petId,rxId=o.rxId,line={offerId:offerId,...isText(petId)?{petId:petId}:{},...isText(rxId)?{rxId:rxId}:{}},key=cartLineKey(line);if(out.some(item=>item.key===key))continue;let unitPrice=o.unitPrice,imageUrl=httpsOnly(o.imageUrl),plan=o.plan;out.push({...line,key:key,title:title,unitPrice:typeof unitPrice=="number"&&Number.isFinite(unitPrice)?unitPrice:null,requiresRx:o.requiresRx===true,quantity:clampTo(quantity,line.rxId?CARE_CART_OMS_MAX_QUANTITY:max),...imageUrl?{imageUrl:imageUrl}:{},...plan==="auto"||plan==="once"?{plan:plan}:{},...extras(o)})}return out}function addLine(items,input,opts){let key=cartLineKey({offerId:input.offerId,...input.petId?{petId:input.petId}:{},...input.rxId?{rxId:input.rxId}:{}}),was=items.find(item=>item.key===key),oneOnly=isLocked({rxId:input.rxId,requiresRx:input.requiresRx},opts)||input.onePerCart===true;if(was&&oneOnly)return{items:[...items],result:"already"};let petOf=petId=>petId??"";if(!was&&input.requiresRx&&items.some(item=>item.requiresRx&&petOf(item.petId)===petOf(input.petId)))return{items:[...items],result:"rx_limit"};let imageUrl=httpsOnly(input.imageUrl),plan=input.plan??was?.plan??input.defaultPlan??void 0,next={offerId:input.offerId,...input.petId?{petId:input.petId}:{},...input.rxId?{rxId:input.rxId}:{},key:key,title:input.title,unitPrice:input.unitPrice,requiresRx:input.requiresRx,quantity:was?clampTo(was.quantity+1,maxOf(opts)):1,...imageUrl?{imageUrl:imageUrl}:{},...plan?{plan:plan}:{},...extras(input)};return{items:was?items.map(item=>item.key===key?next:item):[...items,next],result:was?"more":"added"}}function setLineQuantity(items,key,quantity,opts){if(quantity<=0)return items.filter(item=>item.key!==key);let max=maxOf(opts);return items.map(item=>item.key===key&&!isLocked(item,opts)?{...item,quantity:clampTo(quantity,max)}:item)}function setLinePlan(items,key,plan){return items.map(item=>item.key===key?{...item,plan:plan}:item)}function removeLines(items,keys){let gone=new Set(keys);return items.filter(item=>!gone.has(item.key))}function restoreLines(items,lines,opts){let have=new Set(items.map(item=>item.key)),back=readItems(lines,opts).filter(item=>!have.has(item.key));return back.length>0?[...items,...back]:[...items]}function linesForPet(items,petId){return petId?items.filter(item=>item.petId===petId):[]}function lastLines(items,n=3){return n>0?items.slice(-n):[]}function rxIdFor(prescriptions,offerId,petId){if(!petId)return null;let hers=(prescriptions??[]).filter(p=>p.offerId===offerId&&p.petId===petId);return(hers.find(p=>p.status==="ready")??hers[0])?.rxId??null}function withRxIds(items,prescriptions){return items.map(item=>{if(!item.requiresRx||item.rxId)return item;let rxId=rxIdFor(prescriptions,item.offerId,item.petId);return rxId?{...item,rxId:rxId}:item})}function rxLineOf(items,add){let key=cartLineKey(add);return items.find(item=>item.key===key)??items.find(item=>item.requiresRx&&item.offerId===add.offerId&&(item.petId??"")===(add.petId??""))??null}function needsRxId(items){return items.some(item=>item.requiresRx&&!item.rxId)}function omsLines(items,prescriptions,options){return withRxIds(items,prescriptions).map(item=>({offerId:item.offerId,quantity:item.quantity,...item.petId?{petId:item.petId}:{},...item.rxId?{rxId:item.rxId}:{},...options?.withPlan&&item.plan?{plan:item.plan}:{}}))}var EMPTY=/* @__PURE__ */Object.freeze([]);function createCareCartStore(storage,opts){let items=EMPTY;if(storage)try{items=parseCartItems(storage.read(),opts)}catch{items=EMPTY}let listeners=/* @__PURE__ */new Set,set=next=>{items=next;try{storage?.write(JSON.stringify(next))}catch{}for(let listener of[...listeners])listener()};return{items:()=>items,subscribe:listener=>(listeners.add(listener),()=>{listeners.delete(listener)}),add:input=>{let{items:next,result:result}=addLine(items,input,opts);return(result==="added"||result==="more")&&set(next),result},setQuantity:(key,quantity)=>set(setLineQuantity(items,key,quantity,opts)),setPlan:(key,plan)=>set(setLinePlan(items,key,plan)),remove:key=>set(removeLines(items,[key])),removeKeys:keys=>{let gone=new Set(keys);items.some(item=>gone.has(item.key))&&set(removeLines(items,keys))},restore:lines=>{let next=restoreLines(items,lines,opts);next.length!==items.length&&set(next)},clear:()=>{items.length>0&&set(EMPTY)}}}var OBJECT_NEXT=/* @__PURE__ */new Set(["a","about","again","an","and","as","at","back","before","but","by","down","for","from","here","if","in","into","now","off","on","or","out","over","so","than","that","the","there","through","to","too","up","when","with"]),ADVERBS=/* @__PURE__ */new Set(["already","also","always","just","never","often","only","really","still","sometimes","usually"]),PARTICIPLES=/* @__PURE__ */new Set(["been","done","gone","got","had","seen","eaten","taken","given"]),IRREGULAR={has:"have",is:"are",was:"were",does:"do"},WORD=/[A-Za-z]+(?:[’'][A-Za-z]+)?/g,cap=(word,like)=>like[0]===like[0]?.toUpperCase()?(word[0]??"").toUpperCase()+word.slice(1):word;function theyVerb(verb){let m=/^([A-Za-z]+)(n[’']t)?$/.exec(verb);if(!m)return verb;let stem=m[1]??"",neg=m[2]??"",low=stem.toLowerCase(),out,irregular=IRREGULAR[low];if(irregular!==void 0)out=irregular;else if(/[^aeiou]ies$/.test(low))out=low.slice(0,-3)+"y";else if(/(ss|sh|ch|x|z|o)es$/.test(low))out=low.slice(0,-2);else if(/[^su]s$/.test(low))out=low.slice(0,-1);else return verb;return cap(out,stem)+neg}function swapPronoun(text3,pronoun){if(pronoun==="her"||!/\b(?:her|hers|herself|she)\b/i.test(text3))return text3;let words=[...text3.matchAll(WORD)],out=[],at=0,agreeAt=-1,nextOf=k=>{let n=words[k],before=words[k-1];if(!n||!before)return null;let gap=text3.slice((before.index??0)+before[0].length,n.index);return/^\s+$/.test(gap)?n:null};return words.forEach((m,i)=>{let word=m[0],start=m.index??0,next=nextOf(i+1),nextLow=next?next[0].toLowerCase():null,low=word.toLowerCase().replace("’","'"),swap=null;if(i===agreeAt)swap=theyVerb(word);else if(low==="her"){let object=nextLow===null||OBJECT_NEXT.has(nextLow);swap=pronoun==="his"?object?"him":"his":object?"them":"their"}else if(low==="hers")swap=pronoun==="his"?"his":"theirs";else if(low==="herself")swap=pronoun==="his"?"himself":"themselves";else if(low==="she")swap=pronoun==="his"?"he":"they",pronoun==="their"&&nextLow!==null&&(agreeAt=ADVERBS.has(nextLow)&&nextOf(i+2)?i+2:i+1);else if(low==="she's"){let mark=word.includes("’")?"’":"'";swap=pronoun==="his"?`he${mark}s`:`they${mark}${nextLow!==null&&PARTICIPLES.has(nextLow)?"ve":"re"}`}swap!==null&&(out.push(text3.slice(at,start),cap(swap,word)),at=start+word.length)}),out.push(text3.slice(at)),out.join("")}function swapPronounCopy(copy,pronoun,keep=[]){if(pronoun==="her")return copy;let one=v=>typeof v=="string"?swapPronoun(v,pronoun):Array.isArray(v)?v.map(one):typeof v=="function"?(...a)=>one(v(...a)):v,out={};for(let[k,v]of Object.entries(copy))out[k]=keep.includes(k)?v:one(v);return out}function pronounForSex(sex){return sex==="female"?"her":sex==="male"?"his":"their"}function unitCents(item,firstAutoOrderPrice=null){return firstAutoOrderPrice==="auto"&&item.plan==="auto"&&typeof item.autoUnitPrice=="number"?item.autoUnitPrice:item.unitPrice}function lineCents(item,firstAutoOrderPrice=null){return(unitCents(item,firstAutoOrderPrice)??0)*item.quantity}function cartTotals(items,pricing){let first=pricing.firstAutoOrderPrice??null,rx=0,box=0,count2=0,unpriced=false;for(let item of items)item.unitPrice===null&&(unpriced=true),item.requiresRx?rx+=lineCents(item,first):box+=lineCents(item,first),count2+=item.quantity;let off=rx>0?Math.min(Math.max(0,pricing.firstRxDiscountCents??0),rx):0,threshold=pricing.freeShippingThresholdCents??null;return{count:count2,rxCents:rx,boxCents:box,offCents:off,itemsCents:box+rx-off,bigCents:box>0?box:rx-off,toFreeCents:box>0&&threshold!==null&&box<threshold?threshold-box:0,unpriced:unpriced}}function discountedLineKey(items,totals){return totals.offCents<=0?null:items.find(item=>item.requiresRx)?.key??null}function careMoney(cents){return`${cents<0?"-":""}$${(Math.abs(cents)/100).toFixed(2)}`}function careMoneyShort(cents){return cents%100===0?`${cents<0?"-":""}$${Math.abs(cents)/100}`:careMoney(cents)}function careItemCount(n){return`${n} ${n===1?"item":"items"}`}var CARE_CART_UNDRAWN={shippingAtCheckout:"shipping at checkout",chargedWhenFilled:"charged when it’s filled",rxLimit:name=>`One prescription per cart. Order the one in it, then add ${name}.`};function careTrayCopy(totals,pronoun="her"){let fine=totals.offCents>0?swapPronoun(`${careMoney(totals.itemsCents)} with ${careMoneyShort(totals.offCents)} off her first prescription`,pronoun):`${careMoney(totals.itemsCents)} before tax`;return{button:`View cart · ${careItemCount(totals.count)}`,fine:fine}}function careFloatCopy(totals,freeShippingThresholdCents){let big=careMoney(totals.bigCents);if(totals.rxCents>0&&totals.boxCents>0)return{big:big,sub:`today, + ${careMoney(totals.rxCents-totals.offCents)} Rx when filled`,subIsOffer:false};if(totals.rxCents>0)return totals.offCents<=0?{big:big,sub:CARE_CART_UNDRAWN.chargedWhenFilled,subIsOffer:false}:{big:big,sub:`when it’s filled, ${careMoneyShort(totals.offCents)} off`,subIsOffer:true};let count2=careItemCount(totals.count);if(freeShippingThresholdCents===null)return{big:big,sub:`${count2} · ${CARE_CART_UNDRAWN.shippingAtCheckout}`,subIsOffer:false};let free=totals.boxCents>=freeShippingThresholdCents;return{big:big,sub:free?`${count2} · ships free`:`${count2} · free shipping over ${careMoneyShort(freeShippingThresholdCents)}`,subIsOffer:false}}function careAddToast(result,name,isRx){return result==="already"?`${name} is already in the cart.`:result==="rx_limit"?CARE_CART_UNDRAWN.rxLimit(name):isRx?`${name} refill added. The pharmacist checks it once you order.`:`${name} added to the cart.`}function cartBarSub(totals,freeShippingThresholdCents,pronoun="her"){let head=`${careItemCount(totals.count)} · `;return totals.offCents>0?swapPronoun(`${head}${careMoneyShort(totals.offCents)} off her first prescription`,pronoun):totals.toFreeCents>0?`${head}${careMoney(totals.toFreeCents)} to free shipping`:totals.rxCents>0||totals.boxCents===0?careItemCount(totals.count):freeShippingThresholdCents===null?null:`${head}ships free`}var cartSaid={added:name=>`${name} added to the cart`,removed:name=>`${name} removed from the cart`,count:(name,n)=>`${name}: ${n} in the cart`};function shownLinePrices(items,quoteLines,opts){let out=/* @__PURE__ */new Map,used=/* @__PURE__ */new Set;for(let item of items){let at=quoteLines?quoteLines.findIndex((line2,i)=>!used.has(i)&&line2.offerId===item.offerId&&(!line2.petId||!item.petId||line2.petId===item.petId)):-1,discounted=item.key===opts.discountedKey,line=quoteLines&&at>=0?quoteLines[at]:void 0;if(line){used.add(at);let off=discounted?Math.max(0,Math.min(opts.offCents,line.discountCents)):0;out.set(item.key,{priceCents:line.netCents+off,offCents:off})}else{let price=lineCents(item,opts.firstAutoOrderPrice);out.set(item.key,{priceCents:price,offCents:discounted?Math.min(opts.offCents,price):0})}}return out}function lineMeta(title,parts){let name=title.toLowerCase(),kept=[];for(let part of parts){let text3=part?.trim();if(!text3)continue;let low=text3.toLowerCase();name.includes(low)||kept.some(k=>k.toLowerCase()===low)||kept.push(text3)}return kept.join(" · ")}function omsErr(error){/* @__PURE__ */
|
|
3
|
+
return Object.freeze({ok:false,error:/* @__PURE__ */Object.freeze(error)})}function adaptQuote(quote,items){let rxOffers=new Set(items.filter(item=>item.requiresRx).map(item=>item.offerId)),isRx=line=>line.isRx??line.chargedWhenFilled??rxOffers.has(line.offerId),gross=line=>line.unitPrice*line.quantity,charged=line=>gross(line)-line.discount+line.tax,lines=quote.lines.map(line=>({offerId:line.offerId,petId:line.petId,quantity:line.quantity,grossCents:gross(line),discountCents:line.discount,netCents:gross(line)-line.discount})),box=quote.lines.filter(line=>!isRx(line)),rx=quote.lines.filter(isRx),rxOff=quote.whenFilledDiscountCents??rx.reduce((sum,line)=>sum+(line.whenFilledDiscountCents??0),0),fallbackToday=box.reduce((sum,line)=>sum+charged(line),0)+quote.shipping,fallbackLater=rx.reduce((sum,line)=>sum+charged(line),0);return{lines:lines,itemsCents:lines.reduce((sum,line)=>sum+line.netCents,0),totalCents:quote.total,taxCents:quote.tax,shippingCents:quote.shipping,dueTodayCents:quote.dueTodayCents??fallbackToday,dueWhenFilledCents:quote.dueWhenFilledCents??fallbackLater,whenFilledDiscountCents:rxOff,serverSplit:quote.dueTodayCents!=null&"e.dueWhenFilledCents!=null,expiresAt:quote.expiresAt,shipsOn:quote.shipsOn??null,arrivesOn:quote.arrivesOn??null}}function omsReceipt(client,orderId){let fn=client.receipt;return typeof fn!="function"?Promise.resolve(omsErr({kind:"unavailable"})):fn.call(client,orderId)}var isObj=v=>v!==null&&typeof v=="object"&&!Array.isArray(v),text=v=>typeof v=="string"&&v.trim()!==""?v:null,count=v=>typeof v=="number"&&Number.isInteger(v)&&v>=0?v:null,https=v=>{let s=text(v);return s!==null&&/^https:\/\/\S+$/i.test(s)?s:null},DAY=/^\d{4}-\d{2}-\d{2}$/;function firstAutoOrderPriceOf(raw){let v=isObj(raw)?raw.first_auto_order_price:null;return v==="once"||v==="auto"?v:null}function firstRxDiscountCodeOf(raw){let v=isObj(raw)?raw.first_rx_discount_code:null;return typeof v=="string"&&v.trim().length>0&&v.length<=32?v.trim():null}function rxShipsToStatesOf(raw){let v=isObj(raw)?raw.rx_ships_to_states:null;if(!Array.isArray(v)||v.length===0)return null;let codes=v.filter(c=>typeof c=="string"&&/^[A-Za-z]{2}$/.test(c));return codes.length===v.length?codes.map(c=>c.toUpperCase()):null}function tooSoonOnOf(raw){if(!isObj(raw)||raw.reason_code!=="too_soon")return null;let day=raw.available_on;return typeof day=="string"&&DAY.test(day)?day:null}function addressLocationOf(raw){if(!isObj(raw))return null;let lat=raw.latitude,lng=raw.longitude,placeId=text(raw.place_id);return typeof lat!="number"||!Number.isFinite(lat)||Math.abs(lat)>90||typeof lng!="number"||!Number.isFinite(lng)||Math.abs(lng)>180||placeId===null?null:{latitude:lat,longitude:lng,placeId:placeId}}function addressLocationToWire(location){return{latitude:location.latitude,longitude:location.longitude,place_id:location.placeId}}function petQuery(input,method,petId){if(!petId||method.toUpperCase()!=="GET")return input;let base="https://oms.invalid",url;try{url=new URL(input,base)}catch{return input}let route=url.pathname.replace(/\/+$/,"");return!route.endsWith("/orders")&&!route.endsWith("/buy-again")?input:(url.searchParams.set("pet_id",petId),url.origin===base&&!input.startsWith(base)?`${url.pathname}${url.search}`:url.href)}function field(o,camel,snake){if(isObj(o))return o[camel]!==void 0?o[camel]:o[snake]}function summaryPetId(o){let v=field(o,"petId","pet_id");return v===void 0?void 0:text(v)}function summaryNeedsPayment(o){return field(o,"needsPayment","needs_payment")===true}function summaryLineCount(o){return count(field(o,"lineCount","line_count"))}function summaryClinicName(o){return text(field(o,"clinicName","clinic_name"))}function summaryDiscountCode(o){return text(field(o,"discountCode","discount_code"))}function againPetId(i){return text(field(i,"petId","pet_id"))}function planTitle(p){return text(field(p,"title","title"))}function planImageUrl(p){return https(field(p,"imageUrl","image_url"))}function planResumeShipOn(p){return text(field(p,"resumeShipOn","resume_ship_on"))}function orderCardActionUrl(d){let v=field(d,"cardActionLink","card_action_link");return https(typeof v=="string"?v:field(v,"url","url"))}function receiptRefund(r){let cents=count(field(r,"refundedCents","refunded_cents"));return cents===null||cents<=0?null:{cents:cents,on:text(field(r,"refundedOn","refunded_on"))}}var CARE_ADDRESS_SUGGESTIONS_SHOWN=5,CARE_ADDRESS_SEARCH_MIN_CHARS=3,CARE_ADDRESS_SEARCH_OFF=/* @__PURE__ */Object.freeze({available:false,suggestions:/* @__PURE__ */Object.freeze([])}),isObj2=v=>typeof v=="object"&&v!==null&&!Array.isArray(v),text2=v=>typeof v=="string"&&v.trim()!==""?v.trim():null,coord=(v,max)=>typeof v=="number"&&Number.isFinite(v)&&Math.abs(v)<=max?v:null;function parseAddressSuggestions(body,max=5){if(!isObj2(body)||body.available!==true||!Array.isArray(body.suggestions))return CARE_ADDRESS_SEARCH_OFF;let suggestions=[];for(let raw of body.suggestions){if(suggestions.length>=max)break;if(!isObj2(raw))continue;let placeId=text2(raw.place_id),main=text2(raw.main);!placeId||!main||suggestions.push({placeId:placeId,main:main,secondary:text2(raw.secondary)??""})}return{available:true,suggestions:suggestions}}function parseAddressPlace(body){if(!isObj2(body))return null;let line1=text2(body.line1),city=text2(body.city),region=text2(body.region),postalCode=text2(body.postal_code),placeId=text2(body.place_id),latitude=coord(body.latitude,90),longitude=coord(body.longitude,180);return!line1||!city||!region||!postalCode||!placeId||latitude===null||longitude===null?null:{line1:line1,city:city,region:region.toUpperCase(),postalCode:postalCode,country:text2(body.country)??"US",location:{latitude:latitude,longitude:longitude,placeId:placeId}}}function addressPlaceResult(status,body){if(status===404)return{kind:"notAddress"};if(status<200||status>=300)return{kind:"unavailable"};let place=parseAddressPlace(body);return place?{kind:"ok",place:place}:{kind:"unavailable"}}export{CARE_ADDRESS_SEARCH_MIN_CHARS,CARE_ADDRESS_SEARCH_OFF,CARE_ADDRESS_SUGGESTIONS_SHOWN,CARE_CART_MAX_QUANTITY,CARE_CART_OMS_MAX_QUANTITY,CARE_CART_UNDRAWN,adaptQuote,addLine,addressLocationOf,addressLocationToWire,addressPlaceResult,againPetId,careAddToast,careFloatCopy,careItemCount,careMoney,careMoneyShort,careTrayCopy,cartBarSub,cartLineKey,cartSaid,cartTotals,createCareCartStore,discountedLineKey,firstAutoOrderPriceOf,firstRxDiscountCodeOf,lastLines,lineCents,lineMeta,linesForPet,needsRxId,omsLines,omsReceipt,orderCardActionUrl,parseAddressPlace,parseAddressSuggestions,parseCartItems,petQuery,planImageUrl,planResumeShipOn,planTitle,pronounForSex,receiptRefund,removeLines,restoreLines,rxIdFor,rxLineOf,rxShipsToStatesOf,setLinePlan,setLineQuantity,shownLinePrices,summaryClinicName,summaryDiscountCode,summaryLineCount,summaryNeedsPayment,summaryPetId,swapPronoun,swapPronounCopy,theyVerb,tooSoonOnOf,unitCents,withRxIds};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*! @everfur/sdk. Copyright (c) 2026 Strand Health Inc. dba Everfur. All rights reserved. Use is subject to the Everfur SDK License: https://docs.everfur.com/license */
|
|
2
2
|
import { E as EverfurResult } from './EverfurResult.d-BFH-3s6E.cjs';
|
|
3
|
-
import { A as AuthContext } from './identity.d-
|
|
3
|
+
import { A as AuthContext } from './identity.d-84x0dV7-.cjs';
|
|
4
4
|
import { P as PetRef } from './ids.d-B2GAAifq.cjs';
|
|
5
5
|
|
|
6
6
|
/** The owner's answer to a check-in, the wire values of the consumer `CheckinResponse` enum. */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*! @everfur/sdk. Copyright (c) 2026 Strand Health Inc. dba Everfur. All rights reserved. Use is subject to the Everfur SDK License: https://docs.everfur.com/license */
|
|
2
2
|
import { E as EverfurResult } from './EverfurResult.d-D_-254ZY.js';
|
|
3
|
-
import { A as AuthContext } from './identity.d-
|
|
3
|
+
import { A as AuthContext } from './identity.d-BXztMVYM.js';
|
|
4
4
|
import { P as PetRef } from './ids.d-B2GAAifq.js';
|
|
5
5
|
|
|
6
6
|
/** The owner's answer to a check-in, the wire values of the consumer `CheckinResponse` enum. */
|