@everfur/sdk 0.12.0 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +174 -0
- package/README.md +2 -1
- package/dist/{Chat-BOG0SXKV.d.cts → Chat.d-DUNTfzqC.d.ts} +170 -8
- package/dist/{Chat-CIolBgjJ.d.ts → Chat.d-Dts8u_1a.d.cts} +170 -8
- package/dist/{DepthViews-BR6VQ3Ta.d.cts → DepthViews.d-BIp599lz.d.cts} +1 -1
- package/dist/{DepthViews-280t3BcQ.d.ts → DepthViews.d-BMU2jFPw.d.cts} +1 -1
- package/dist/{DepthViews-DlBuFsgN.d.ts → DepthViews.d-Ce2Zhnrb.d.ts} +1 -1
- package/dist/{DepthViews-BTbF_DJY.d.cts → DepthViews.d-CubkMPbU.d.ts} +1 -1
- package/dist/{ErrorPolicyPort-10s3HJCt.d.cts → ErrorPolicyPort.d-68yrE3BE.d.ts} +1 -1
- package/dist/{ErrorPolicyPort-C3nNSS_j.d.ts → ErrorPolicyPort.d-DirW9hgO.d.cts} +1 -1
- package/dist/{EverfurError-DeBqRpQV.d.cts → EverfurError.d-8NHtlgzA.d.cts} +11 -1
- package/dist/{EverfurError-DeBqRpQV.d.ts → EverfurError.d-8NHtlgzA.d.ts} +11 -1
- package/dist/{EverfurResult-ClPTS0P2.d.ts → EverfurResult.d-BFH-3s6E.d.cts} +1 -1
- package/dist/{EverfurResult-COlXj1wq.d.cts → EverfurResult.d-D_-254ZY.d.ts} +1 -1
- package/dist/{IntakeMedia-BH0fYDT2.d.cts → IntakeMedia.d-4a89XrP7.d.ts} +1 -1
- package/dist/{IntakeMedia-B-_vA9ZB.d.cts → IntakeMedia.d-DGxrhgIW.d.ts} +1 -1
- package/dist/{IntakeMedia-CIoTXAWs.d.ts → IntakeMedia.d-DUPR4lVM.d.cts} +1 -1
- package/dist/{IntakeMedia-Bavl7E4Z.d.ts → IntakeMedia.d-JJCUvQu7.d.cts} +1 -1
- package/dist/LifecyclePort.d-Cr1p33a7.d.cts +23 -0
- package/dist/LifecyclePort.d-Cr1p33a7.d.ts +23 -0
- package/dist/{PhotoController-vzY5bfY_.d.ts → PhotoController.d-BzCJOE7e.d.cts} +2 -2
- package/dist/{PhotoController-3l7MT9jA.d.cts → PhotoController.d-D0XiUUOl.d.ts} +2 -2
- package/dist/animations/index.cjs +5 -1
- package/dist/animations/index.d.cts +24 -24
- package/dist/animations/index.d.ts +24 -24
- package/dist/animations/index.js +5 -1
- package/dist/{attachments-CGxvnYu4.d.ts → attachments.d-Bp2qbHxn.d.cts} +22 -26
- package/dist/{attachments-CWNj1ZkM.d.ts → attachments.d-D1yhJjcZ.d.ts} +4 -4
- package/dist/{attachments-waXcJWCp.d.cts → attachments.d-DisnvB9R.d.cts} +4 -4
- package/dist/{attachments-B6h4cJU-.d.cts → attachments.d-Djy9z_0Z.d.ts} +22 -26
- package/dist/{bookingCopy-CjPKeg75.d.ts → bookingCopy.d-BJF6gd1A.d.ts} +24 -9
- package/dist/{bookingCopy-8aEU6ZmR.d.cts → bookingCopy.d-BlBmhAJc.d.cts} +24 -9
- package/dist/{branding-DJf4h12Q.d.ts → branding.d-DI8S400y.d.cts} +9 -2
- package/dist/{branding-BCfwLj0h.d.cts → branding.d-OIGLbQeM.d.ts} +9 -2
- package/dist/{callRoom-BhIdadyV.d.cts → callRoom.d-B1DoYdJe.d.cts} +1 -1
- package/dist/{callRoom-B92eH_ij.d.ts → callRoom.d-Dqm1rUqT.d.ts} +1 -1
- package/dist/{casesRepository-CGdhvzTu.d.cts → casesRepository.d-CT2LTicS.d.cts} +3 -3
- package/dist/{casesRepository-ZG9Sg0e4.d.ts → casesRepository.d-UsWOz9bv.d.ts} +3 -3
- package/dist/chat/index.cjs +132 -57
- package/dist/chat/index.d.cts +18 -16
- package/dist/chat/index.d.ts +18 -16
- package/dist/chat/index.js +133 -58
- package/dist/client/index.cjs +15 -10
- package/dist/client/index.d.cts +19 -18
- package/dist/client/index.d.ts +19 -18
- package/dist/client/index.js +15 -10
- package/dist/{config-B0p6Lygh.d.cts → config.d-BR3DT9ho.d.cts} +3 -3
- package/dist/{config-DmFAZJOx.d.ts → config.d-Dy6igYlH.d.ts} +3 -3
- package/dist/consent/index.cjs +5 -1
- package/dist/consent/index.d.cts +10 -10
- package/dist/consent/index.d.ts +10 -10
- package/dist/consent/index.js +5 -1
- package/dist/{context-BNreNLtL.d.ts → context.d-Cwks0p3C.d.cts} +15 -15
- package/dist/{context-BgS2a57J.d.cts → context.d-QcCgguzA.d.ts} +15 -15
- package/dist/{copy-DLJriGQS.d.ts → copy.d-CiMn2IIt.d.ts} +6 -6
- package/dist/{copy-lWp-Lkv5.d.cts → copy.d-DLJTyRfT.d.cts} +6 -6
- package/dist/core/index.cjs +17 -13
- package/dist/core/index.d.cts +33 -29
- package/dist/core/index.d.ts +33 -29
- package/dist/core/index.js +17 -13
- package/dist/{depth-BYb3RXoA.d.cts → depth.d-CjPGVPDL.d.cts} +9 -115
- package/dist/{depth-COz-sSG5.d.ts → depth.d-OSALbYM7.d.ts} +9 -115
- package/dist/{entitlementRepository-D-Lse67w.d.cts → entitlementRepository.d-CVQa1DA1.d.cts} +10 -5
- package/dist/{entitlementRepository-CrTOP_-o.d.ts → entitlementRepository.d-Cf3LbTwD.d.ts} +10 -5
- package/dist/features.d-fNsGcg0R.d.cts +108 -0
- package/dist/features.d-fNsGcg0R.d.ts +108 -0
- package/dist/focus.d-DMg2ngHI.d.ts +1178 -0
- package/dist/focus.d-az9cqUz3.d.cts +1178 -0
- package/dist/health-plan/index.cjs +370 -0
- package/dist/health-plan/index.d.cts +251 -0
- package/dist/health-plan/index.d.ts +251 -0
- package/dist/health-plan/index.js +370 -0
- package/dist/idempotency.d-D461_DPD.d.cts +910 -0
- package/dist/idempotency.d-WpXx9zQo.d.ts +910 -0
- package/dist/{identity-Cw07BKZp.d.ts → identity.d-60LeJt_s.d.cts} +3 -3
- package/dist/{identity-DFVGYn1o.d.cts → identity.d-DzTijonw.d.ts} +3 -3
- package/dist/index.cjs +141 -66
- package/dist/index.d.cts +31 -29
- package/dist/index.d.ts +31 -29
- package/dist/index.js +142 -67
- package/dist/{models-A4A5S7AG.d.cts → models.d-BagXhafD.d.ts} +8 -3
- package/dist/{models-CnXY5LuO.d.ts → models.d-BnLm3VAA.d.cts} +8 -3
- package/dist/notifications/index.cjs +5 -1
- package/dist/notifications/index.d.cts +9 -9
- package/dist/notifications/index.d.ts +9 -9
- package/dist/notifications/index.js +5 -1
- package/dist/optInView.d-CEyHR6PK.d.cts +325 -0
- package/dist/optInView.d-acKpV8V2.d.ts +325 -0
- package/dist/parse.d-C8CXyS58.d.ts +210 -0
- package/dist/parse.d-tEzufgJX.d.cts +210 -0
- package/dist/{pets-BYALZTSu.d.ts → pets.d-C_53_fzo.d.ts} +3 -3
- package/dist/{pets-CcyPQS-H.d.cts → pets.d-NbJvP_kh.d.cts} +3 -3
- package/dist/{petsRepository-B_Q1gFkE.d.cts → petsRepository.d-BuGHymNx.d.ts} +4 -4
- package/dist/{petsRepository-518QkPxH.d.ts → petsRepository.d-lp1BHRqM.d.cts} +4 -4
- package/dist/photo/index.cjs +6 -2
- package/dist/photo/index.d.cts +9 -9
- package/dist/photo/index.d.ts +9 -9
- package/dist/photo/index.js +6 -2
- package/dist/{ports-BN6RHF9W.d.ts → ports.d-BX4f4UsB.d.cts} +14 -1
- package/dist/{ports-BN6RHF9W.d.cts → ports.d-BX4f4UsB.d.ts} +14 -1
- package/dist/{ports-RuNJmBA-.d.cts → ports.d-CEROoqnA.d.cts} +16 -10
- package/dist/{ports-DmQeMArX.d.ts → ports.d-COIyN624.d.ts} +16 -10
- package/dist/presentation.d-DMbdad7G.d.cts +90 -0
- package/dist/presentation.d-DMbdad7G.d.ts +90 -0
- package/dist/records/depth/index.cjs +11 -7
- package/dist/records/depth/index.d.cts +14 -12
- package/dist/records/depth/index.d.ts +14 -12
- package/dist/records/depth/index.js +11 -7
- package/dist/records/index.cjs +225 -62
- package/dist/records/index.d.cts +159 -20
- package/dist/records/index.d.ts +159 -20
- package/dist/records/index.js +225 -62
- package/dist/recordsAsk.d-C5CGSi3j.d.cts +14 -0
- package/dist/recordsAsk.d-C5CGSi3j.d.ts +14 -0
- package/dist/{requestFunnel-B9fdXMi5.d.ts → requestFunnel.d-CXUMPw1K.d.ts} +5 -5
- package/dist/{requestFunnel-BBjNNwc9.d.cts → requestFunnel.d-DWQQpjFR.d.cts} +5 -5
- package/dist/{resolve-D4Ywz5OS.d.ts → resolve.d-jI8FmBj3.d.cts} +3 -3
- package/dist/{resolve-D4Ywz5OS.d.cts → resolve.d-jI8FmBj3.d.ts} +3 -3
- package/dist/{runtimeTypes-CstDBX8w.d.cts → runtimeTypes.d-4yFNNuYR.d.ts} +20 -13
- package/dist/{runtimeTypes-N_K4BVZB.d.ts → runtimeTypes.d-D6N_fhxx.d.cts} +20 -13
- package/dist/server/events/index.cjs +7 -3
- package/dist/server/events/index.d.cts +51 -9
- package/dist/server/events/index.d.ts +51 -9
- package/dist/server/events/index.js +7 -3
- package/dist/server/index.cjs +12 -6
- package/dist/server/index.d.cts +152 -8
- package/dist/server/index.d.ts +152 -8
- package/dist/server/index.js +12 -6
- package/dist/sheetCopy.d-CAhLOxjc.d.cts +4 -0
- package/dist/sheetCopy.d-CAhLOxjc.d.ts +4 -0
- package/dist/sheetSeam.d-Cviqk89n.d.ts +45 -0
- package/dist/sheetSeam.d-DCS3LW8g.d.cts +45 -0
- package/dist/shop/index.cjs +262 -0
- package/dist/shop/index.d.cts +193 -0
- package/dist/shop/index.d.ts +193 -0
- package/dist/shop/index.js +262 -0
- package/dist/televet/booking/index.cjs +16 -12
- package/dist/televet/booking/index.d.cts +36 -22
- package/dist/televet/booking/index.d.ts +36 -22
- package/dist/televet/booking/index.js +16 -12
- package/dist/televet/call/index.d.cts +5 -5
- package/dist/televet/call/index.d.ts +5 -5
- package/dist/televet/index.cjs +7 -3
- package/dist/televet/index.d.cts +12 -12
- package/dist/televet/index.d.ts +12 -12
- package/dist/televet/index.js +7 -3
- package/dist/{televetGlobal-C5dTUACe.d.cts → televetGlobal.d-CC-DrqkQ.d.ts} +7 -2
- package/dist/{televetGlobal-CnjrfhT4.d.ts → televetGlobal.d-CKwDCbmN.d.cts} +7 -2
- package/dist/testing/index.cjs +7 -3
- package/dist/testing/index.d.cts +3 -3
- package/dist/testing/index.d.ts +3 -3
- package/dist/testing/index.js +7 -3
- package/dist/testing/rn/index.cjs +5 -1
- package/dist/testing/rn/index.d.cts +23 -22
- package/dist/testing/rn/index.d.ts +23 -22
- package/dist/testing/rn/index.js +5 -1
- package/dist/testing/web/index.cjs +5 -1
- package/dist/testing/web/index.d.cts +23 -22
- package/dist/testing/web/index.d.ts +23 -22
- package/dist/testing/web/index.js +5 -1
- package/dist/texting/index.cjs +158 -0
- package/dist/texting/index.d.cts +36 -0
- package/dist/texting/index.d.ts +36 -0
- package/dist/texting/index.js +158 -0
- package/dist/threadOptions.d-B1pTMmDF.d.cts +260 -0
- package/dist/threadOptions.d-B1pTMmDF.d.ts +260 -0
- package/dist/{timelineRows-7yjHyh8i.d.ts → timelineRows.d-BNxgzYRW.d.cts} +1 -1
- package/dist/{timelineRows-WvnL-Lds.d.cts → timelineRows.d-CU5GvvLk.d.ts} +1 -1
- package/dist/{tokens-DLj8OnLH.d.cts → tokens.d-DarDaV39.d.cts} +10 -2
- package/dist/{tokens-DLj8OnLH.d.ts → tokens.d-DarDaV39.d.ts} +10 -2
- package/dist/{typeStyle-BxVyF71R.d.ts → typeStyle.d-Bl8pzbBy.d.cts} +2 -2
- package/dist/{typeStyle-DJedEu14.d.cts → typeStyle.d-C1HBRAI3.d.ts} +2 -2
- package/dist/{uploadTransport-BM_pnEWj.d.cts → uploadTransport.d-CWL7CdWP.d.cts} +1 -1
- package/dist/{uploadTransport-C6kGP1Kd.d.ts → uploadTransport.d-EGoUl7gX.d.ts} +1 -1
- package/dist/usePresentation.d-D6qsFzBz.d.cts +9 -0
- package/dist/usePresentation.d-DuGQe_Do.d.ts +9 -0
- package/dist/useRecords.d-Cb-36SF5.d.cts +121 -0
- package/dist/useRecords.d-aQTzQZoV.d.ts +121 -0
- package/dist/{useRecordsDepth-Bp6L4M5P.d.ts → useRecordsDepth.d-DFcCfiXm.d.ts} +8 -20
- package/dist/{useRecordsDepth-DPdAK_81.d.cts → useRecordsDepth.d-sAq2Qkhr.d.cts} +8 -20
- package/dist/{useVetVisit-DmWa7lt1.d.ts → useVetVisit.d-BtdwhmgD.d.cts} +15 -4
- package/dist/{useVetVisit-PtBjNwZr.d.cts → useVetVisit.d-DoYQimyt.d.ts} +15 -4
- package/dist/video/index.cjs +6 -2
- package/dist/video/index.d.cts +7 -7
- package/dist/video/index.d.ts +7 -7
- package/dist/video/index.js +6 -2
- package/dist/{view-C6go2uUt.d.ts → view.d-C-SNpDJX.d.ts} +10 -122
- package/dist/{view-CiF_HVFQ.d.cts → view.d-Dps5C8-s.d.cts} +10 -122
- package/dist/web/consent/index.cjs +5 -1
- package/dist/web/consent/index.d.cts +10 -10
- package/dist/web/consent/index.d.ts +10 -10
- package/dist/web/consent/index.js +5 -1
- package/dist/web/health-plan/index.cjs +414 -0
- package/dist/web/health-plan/index.d.cts +335 -0
- package/dist/web/health-plan/index.d.ts +335 -0
- package/dist/web/health-plan/index.js +414 -0
- package/dist/web/index.cjs +150 -82
- package/dist/web/index.d.cts +152 -38
- package/dist/web/index.d.ts +152 -38
- package/dist/web/index.js +150 -82
- package/dist/web/notifications/index.cjs +16 -3
- package/dist/web/notifications/index.d.cts +39 -209
- package/dist/web/notifications/index.d.ts +39 -209
- package/dist/web/notifications/index.js +16 -3
- package/dist/web/records/depth/index.cjs +11 -7
- package/dist/web/records/depth/index.d.cts +14 -12
- package/dist/web/records/depth/index.d.ts +14 -12
- package/dist/web/records/depth/index.js +11 -7
- package/dist/web/records/index.cjs +95 -68
- package/dist/web/records/index.d.cts +66 -21
- package/dist/web/records/index.d.ts +66 -21
- package/dist/web/records/index.js +95 -68
- package/dist/web/records/upload/index.d.cts +2 -2
- package/dist/web/records/upload/index.d.ts +2 -2
- package/dist/web/records-sheet/index.cjs +278 -0
- package/dist/web/records-sheet/index.d.cts +102 -0
- package/dist/web/records-sheet/index.d.ts +102 -0
- package/dist/web/records-sheet/index.js +278 -0
- package/dist/web/shop/index.cjs +301 -0
- package/dist/web/shop/index.d.cts +42 -0
- package/dist/web/shop/index.d.ts +42 -0
- package/dist/web/shop/index.js +301 -0
- package/dist/web/televet/booking/index.cjs +16 -12
- package/dist/web/televet/booking/index.d.cts +37 -23
- package/dist/web/televet/booking/index.d.ts +37 -23
- package/dist/web/televet/booking/index.js +16 -12
- package/dist/web/televet/call/index.d.cts +4 -4
- package/dist/web/televet/call/index.d.ts +4 -4
- package/dist/web/televet/index.cjs +7 -3
- package/dist/web/televet/index.d.cts +12 -12
- package/dist/web/televet/index.d.ts +12 -12
- package/dist/web/televet/index.js +7 -3
- package/dist/web/texting/index.cjs +157 -0
- package/dist/web/texting/index.d.cts +36 -0
- package/dist/web/texting/index.d.ts +36 -0
- package/dist/web/texting/index.js +157 -0
- package/health-plan/package.json +8 -0
- package/package.json +106 -4
- package/shop/package.json +8 -0
- package/texting/package.json +8 -0
- package/web/health-plan/native-blocked.cjs +12 -0
- package/web/health-plan/package.json +8 -0
- package/web/records-sheet/native-blocked.cjs +12 -0
- package/web/records-sheet/package.json +8 -0
- package/web/shop/native-blocked.cjs +12 -0
- package/web/shop/package.json +8 -0
- package/web/texting/native-blocked.cjs +12 -0
- package/web/texting/package.json +8 -0
- /package/dist/{CameraPort-Cv31Pz7g.d.cts → CameraPort.d-Cv31Pz7g.d.cts} +0 -0
- /package/dist/{CameraPort-Cv31Pz7g.d.ts → CameraPort.d-Cv31Pz7g.d.ts} +0 -0
- /package/dist/{TelemetryPort-BDNr00hu.d.cts → TelemetryPort.d-BDNr00hu.d.cts} +0 -0
- /package/dist/{TelemetryPort-BDNr00hu.d.ts → TelemetryPort.d-BDNr00hu.d.ts} +0 -0
- /package/dist/{cacheEpoch-DknKn3S0.d.cts → cacheEpoch.d-DknKn3S0.d.cts} +0 -0
- /package/dist/{cacheEpoch-DknKn3S0.d.ts → cacheEpoch.d-DknKn3S0.d.ts} +0 -0
- /package/dist/{callCopy-Bw6oZT54.d.cts → callCopy.d-Bw6oZT54.d.cts} +0 -0
- /package/dist/{callCopy-Bw6oZT54.d.ts → callCopy.d-Bw6oZT54.d.ts} +0 -0
- /package/dist/{ids-B2GAAifq.d.cts → ids.d-B2GAAifq.d.cts} +0 -0
- /package/dist/{ids-B2GAAifq.d.ts → ids.d-B2GAAifq.d.ts} +0 -0
- /package/dist/{optionalModule-DbJmsq5f.d.cts → optionalModule.d-DbJmsq5f.d.cts} +0 -0
- /package/dist/{optionalModule-DbJmsq5f.d.ts → optionalModule.d-DbJmsq5f.d.ts} +0 -0
- /package/dist/{profile-CSs1wlXT.d.cts → profile.d-CSs1wlXT.d.cts} +0 -0
- /package/dist/{profile-CSs1wlXT.d.ts → profile.d-CSs1wlXT.d.ts} +0 -0
- /package/dist/{projection-CeIUsbSk.d.cts → projection.d-CeIUsbSk.d.cts} +0 -0
- /package/dist/{projection-CeIUsbSk.d.ts → projection.d-CeIUsbSk.d.ts} +0 -0
- /package/dist/{species-BXAIMh7I.d.cts → species.d-BXAIMh7I.d.cts} +0 -0
- /package/dist/{species-BXAIMh7I.d.ts → species.d-BXAIMh7I.d.ts} +0 -0
- /package/dist/{visitIntent-D7_yVp1I.d.cts → visitIntent.d-D7_yVp1I.d.cts} +0 -0
- /package/dist/{visitIntent-D7_yVp1I.d.ts → visitIntent.d-D7_yVp1I.d.ts} +0 -0
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";var react=require("react"),jsxRuntime=require("react/jsx-runtime"),reactDom=require("react-dom");var EverfurConfigError=class _EverfurConfigError extends Error{constructor(kind,message){super(message),this.name="EverfurConfigError",this.kind=kind,Object.setPrototypeOf(this,_EverfurConfigError.prototype)}};function omsOk(value){/* @__PURE__ */
|
|
3
|
+
return Object.freeze({ok:true,value:value})}function omsErr(error){/* @__PURE__ */
|
|
4
|
+
return Object.freeze({ok:false,error:/* @__PURE__ */Object.freeze(error)})}function isOmsRefusal(error,reasonCode){return error.kind==="refused"&&(reasonCode===void 0||error.reasonCode===reasonCode)}function isOmsUnavailable(error){return error.kind==="unavailable"}function isOmsRetryable(error){return error.kind==="network"||error.kind==="timeout"||error.kind==="serviceUnavailable"||error.kind==="refused"&&error.reasonCode==="order_state_conflict"}var REASON=/^[a-z][a-z0-9_]{0,63}$/,MAX_MESSAGE=300;function cleanMessage(raw){if(typeof raw!="string")return null;let text=raw.replace(/[\u0000-\u001f\u007f]+/g," ").trim();return text.length===0||text.length>MAX_MESSAGE?null:text}function retryAfter(header){if(!header)return null;let seconds=Number(header);return Number.isFinite(seconds)&&seconds>=0?Math.min(Math.round(seconds),3600):null}function omsErrorFromStatus(status,body,headers){let requestId=headers.requestId,rid=requestId?{requestId:requestId}:{};if(status===404)return{kind:"unavailable",...rid};if(status===401)return{kind:"signedOut"};if(status===402||status===409||status===422){let envelope=body&&typeof body=="object"?body:{},reason=typeof envelope.reason_code=="string"&&REASON.test(envelope.reason_code)?envelope.reason_code:null;return{kind:"refused",status:status,reasonCode:reason,message:cleanMessage(envelope.message),...rid}}return status===400?{kind:"invalidRequest",...rid}:status===429?{kind:"rateLimited",retryAfterSeconds:retryAfter(headers.retryAfter??null),...rid}:status===503?{kind:"serviceUnavailable",...rid}:status===403?{kind:"unavailable",...rid}:{kind:"serverError",status:status,...rid}}function newIdempotencyKey(){let c=globalThis.crypto;if(c&&typeof c.randomUUID=="function")return c.randomUUID();if(c&&typeof c.getRandomValues=="function"){let b=c.getRandomValues(new Uint8Array(16));b[6]=b[6]&15|64,b[8]=b[8]&63|128;let h=Array.from(b,x=>x.toString(16).padStart(2,"0")).join("");return`${h.slice(0,8)}-${h.slice(8,12)}-${h.slice(12,16)}-${h.slice(16,20)}-${h.slice(20)}`}throw new EverfurConfigError("missing-peer-dependency","No secure random source: cannot make an idempotency key")}var MAX_ROUNDS=3,ShopActionKeys=class{constructor(make=newIdempotencyKey){this.make=make;this.keys=/* @__PURE__ */new Map}key(step2){let k=this.keys.get(step2);return k||(k=this.make(),this.keys.set(step2,k)),k}next(step2){let k=this.make();return this.keys.set(step2,k),k}};async function confirmWithPayerActions(confirm,keys,payments,options={reconfirm:true}){let key=keys.key("confirm"),orderIds=[];for(let round=0;round<MAX_ROUNDS;round+=1){let res=await confirm(key);if(!res.ok)return{kind:"failed",error:res.error};orderIds=res.value.resale.map(r=>r.orderId);let pending=res.value.resale.filter(r=>r.outcome==="action_required"&&r.payerAction);if(pending.length===0)return{kind:"confirmed",orderIds:orderIds};if(!payments)return{kind:"needsPayerAction",orderIds:orderIds};for(let entry of pending){let stepResult=await payments.handleNextAction(entry.payerAction,{orderId:entry.orderId});if(!stepResult.ok)return stepResult.closed?{kind:"payerActionClosed",orderIds:orderIds}:{kind:"payerActionFailed",orderIds:orderIds,message:stepResult.message}}if(!options.reconfirm)return{kind:"confirmed",orderIds:orderIds};key=keys.next("confirm")}return{kind:"needsPayerAction",orderIds:orderIds}}function placeholder(key){return`[copy:shop.${key}]`}var MONTHS=["January","February","March","April","May","June","July","August","September","October","November","December"];function possessive(name){return`${name}’s`}function listNames(names){return names.length<=1?names[0]??"":`${names.slice(0,-1).join(", ")} and ${names[names.length-1]}`}function asDate(iso){if(!iso)return null;let d=new Date(/^\d{4}-\d{2}-\d{2}$/.test(iso)?`${iso}T00:00:00Z`:iso);return Number.isNaN(d.getTime())?null:d}function formatDay(iso,opts={}){let d=asDate(iso);return d?d.toLocaleDateString("en-US",{timeZone:"UTC",...opts.weekday?{weekday:"short"}:{},month:"short",day:"numeric"}):null}function formatWhen(iso){let d=asDate(iso);if(!d)return null;let day=d.toLocaleDateString("en-US",{weekday:"short",month:"short",day:"numeric"}),time=d.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit"});return`${day} · ${time}`}function monthOf(iso){let d=asDate(iso);return d?MONTHS[d.getUTCMonth()]:null}function formatCents(cents){let sign=cents<0?"-":"",abs=Math.abs(Math.round(cents));return`${sign}$${Math.floor(abs/100).toLocaleString("en-US")}.${String(abs%100).padStart(2,"0")}`}function cardLabel(brand,last4){return`${brand?brand.charAt(0).toUpperCase()+brand.slice(1):""} ending ${last4}`}var SHOP_COPY={tabsLabel:"Care",tabPackage:"Package",tabShop:"Shop",tabOrders:"Orders",tabPlan:"Plan",legal:"Prescription items need a valid prescription from a licensed vet, and are filled by a licensed partner pharmacy.",legalTracking:"Prescription items are filled by a licensed partner pharmacy.",loadFailed:thing=>`We couldn’t load ${thing}. Check your connection and try again.`,tryAgain:"Try again",actionFailed:"That didn’t go through. Try again.",saving:"Saving…",keepIt:"Keep it",close:"Close",thingPackage:placeholder("thing.package"),thingShop:placeholder("thing.shop"),thingProduct:placeholder("thing.product"),thingPlan:placeholder("thing.plan"),thingOrders:"your orders",thingOrder:"this order",packageTitle:month=>`${month} package`,packageSub:(names,reviewBy,arrives)=>{let s=[];return names.length>0&&s.push(`For ${listNames(names)}.`),reviewBy&&arrives&&s.push(`Approve by ${reviewBy} and it arrives ${arrives}.`),s.length?s.join(" "):null},inThisPackage:"In this package",reviewBy:day=>`Review by ${day}`,forPet:name=>`For ${name}`,details:"Details",remove:"Remove",removed:"Removed.",total:"Total",items:"Items",shipping:"Shipping",tax:"Tax",free:"Free",approveAndShip:"Approve and ship",itemCount:n=>n===1?placeholder("package.item_count_one"):`${n} items`,withTotal:(label,total)=>`${label} · ${total}`,approveRegion:"Approve",packageDetailsRegion:"Package details",deliveryPaymentRegion:"Delivery and payment",questionsRegion:"Questions",approving:"Approving…",skipThisMonth:"Skip this month",chargedWhenShips:card=>`Charged to ${card} when it ships.`,rxCheckedFirst:"Prescriptions are checked with the vet who wrote them first.",delivery:"Delivery",arrives:day=>`Arrives ${day}`,change:"Change",outOfStock:"Out of stock",packageOutOfStock:"Out of stock right now, so it won’t ship this month.",packageEmpty:month=>`Nothing in ${possessive(month)} package yet. Add something from the shop, or skip this month.`,itemNoLongerSold:placeholder("package.item_no_longer_sold"),reviewClosed:placeholder("package.review_closed"),approvalInProgress:placeholder("package.approval_in_progress"),priceChanged:placeholder("package.price_changed"),cardStepFailed:placeholder("package.card_step_failed"),cardStepClosed:placeholder("package.card_step_closed"),noCardOnFile:placeholder("package.no_card_on_file"),shopTitle:"Shop",searchLabel:"Search the shop",searchPlaceholder:"Search the shop…",filtersLabel:"Filter",filterAll:"All",refillSoon:"Refill soon",inMonthsPackage:month=>`In ${possessive(month)} package →`,forPets:names=>`For ${listNames(names)}`,allProducts:placeholder("shop.all_products_title"),rx:"Rx",hasPrescription:name=>`${name} has a prescription`,needsPrescription:"Needs a prescription",noMatches:q=>`Nothing in the shop matches ‘${q}’.`,nothingHereYet:"Nothing here yet.",photoToCome:"Photo to come",backToShop:"Shop",howOften:"How often",everyMonthIn:name=>`Every month, in ${possessive(name)} package`,skipOrStop:"Skip or stop any month",justOnce:"Just once",shipsWith:month=>`Ships with ${possessive(month)} package`,justOnceShipsNow:placeholder("product.just_once_meta"),oneFewer:"One fewer",oneMore:"One more",quantity:"Quantity",addToPackage:month=>`Add to ${possessive(month)} package`,refillInPackage:month=>`Refill in ${possessive(month)} package`,buyNow:placeholder("product.buy_now"),startPlan:placeholder("product.start_plan"),adding:"Adding…",outOfStockNow:"Out of stock right now.",prescription:"Prescription",noPrescriptionFor:name=>`No prescription for ${name} on file.`,bookVideoVisit:"Book a video visit",refillsLeft:n=>`${n} ${n===1?"refill":"refills"} left`,rxBeingPrepared:"This prescription is being prepared. You can order it soon.",rxTooSoon:placeholder("rx.too_soon"),rxRenew:placeholder("rx.needs_renewal"),rxPick:placeholder("rx.pick_pet"),educational:"Educational, not a diagnosis.",planTitle:"Your plan",whatRepeats:"What repeats",repeatsLabel:title=>`${title} repeats`,cadenceMonths:months=>months===1?"Every month":`Every ${months} months`,cadenceDays:placeholder("plan.cadence_days"),repeatsEmpty:"Nothing repeats yet. Pick Every month when you add something, and it shows up here.",nextPackage:"Next package",reviewByLabel:"Review by",ships:"Ships",reviewMonthsPackage:month=>`Review ${possessive(month)} package →`,deliveryAndPayment:"Delivery and payment",shipTo:"Ship to",payWith:"Pay with",needABreak:"Need a break?",skipMonth:month=>`Skip ${month}`,skipMonthAsk:month=>`Skip ${month}?`,skipMonthBody:"Nothing ships this month.",pausePlan:"Pause the plan",pausePlanAsk:"Pause the plan?",pausePlanBody:"Nothing ships until you turn it back on.",declined:month=>month?`Declined. Update your card so ${possessive(month)} package can ship.`:"Declined.",resumePlan:placeholder("plan.resume"),stopReason:reason=>placeholder(`plan.stop_reason.${reason}`),consentTitle:placeholder("plan.consent_title"),consentBody:placeholder("plan.consent_body"),consentTermsLink:placeholder("plan.consent_terms_link"),consentAgree:placeholder("plan.consent_agree"),ordersTitle:"Orders",ordersSub:names=>`Packages and one-off orders for ${listNames(names)}.`,allOrders:"All orders",placed:day=>`Placed ${day}`,ordersEmpty:"No orders yet. Your first package shows up here once you approve it.",paymentFailed:"Payment failed",backToCare:"Care",onItsWay:title=>`${title}, on its way`,shouldArrive:day=>`It should arrive ${day}.`,whereItStands:"Where it stands",stepApproved:"Approved",stepChecking:"Checking prescriptions…",stepFilled:"Filled by the pharmacy",stepShipped:"Shipped",stepDelivered:"Delivered",now:"Now",expected:day=>`Expected ${day}.`,inTheBox:"In the box",payment:"Payment",cancelOrder:placeholder("order.cancel"),payOrder:placeholder("order.pay"),trackPackage:placeholder("order.track"),orderStatus:{pending_placement:"Confirmed, sending to the pharmacy",placement_unknown:"Confirmed",placed:"With the pharmacy, in review",accepted:"Approved by the pharmacist",release_sent:"Approved, being prepared",release_unknown:"Approved, being prepared",released:"Being prepared",shipped:"Shipped",delivered:"Delivered",needs_support:"We’re looking into this order",rejected:placeholder("order.status.rejected"),cancelled:"Cancelled",pending_handoff:placeholder("order.status.pending_handoff")},addressTitle:placeholder("address.title"),addressLabel:placeholder("address.label"),addressRecipient:placeholder("address.recipient_name"),addressLine1:placeholder("address.line1"),addressLine2:placeholder("address.line2"),addressCity:placeholder("address.city"),addressRegion:placeholder("address.region"),addressPostal:placeholder("address.postal_code"),addressSave:placeholder("address.save"),addressNeeded:placeholder("address.needed"),cardTitle:placeholder("card.title"),cardBody:placeholder("card.body"),cardStart:placeholder("card.start"),cardUnavailable:placeholder("card.unavailable"),confirmTitle:placeholder("buy.confirm_title"),confirmPay:placeholder("buy.confirm_pay"),refusal:{operation_not_supported:"This action isn’t available for this order.",order_not_sellable:"We can’t ship this order as it is. Add items or contact us.",rx_being_prepared:"This prescription is being prepared. You can order it soon.",rx_not_dispensable:"We can’t send this prescription to the pharmacy yet. Contact us.",order_state_conflict:"This order changed. Refresh and try again.",payment_method_in_use:"A subscription or an order uses this card."},rateLimited:placeholder("error.rate_limited")},SHOP_COPY_PLACEHOLDERS=(()=>{let keys=/* @__PURE__ */new Set,visit=v=>{if(typeof v=="string"){let m=/^\[copy:(shop\.[a-z0-9_.]+)\]$/.exec(v);m&&keys.add(m[1])}else if(typeof v=="function")try{visit(v("x","x","x"))}catch{}else if(v&&typeof v=="object")for(let inner of Object.values(v))visit(inner)};return visit(SHOP_COPY),[...keys].sort()})();function shopCopy(overrides){return overrides?{...SHOP_COPY,...overrides}:SHOP_COPY}function refusalLine(copy,error){if(error.kind==="rateLimited")return copy.rateLimited;if(error.kind==="refused"){let own=error.reasonCode?copy.refusal[error.reasonCode]:void 0;if(own)return own;if(error.message)return error.message}return copy.actionFailed}var UNAVAILABLE_PACKAGE_SOURCE=/* @__PURE__ */Object.freeze({load:()=>Promise.resolve(omsErr({kind:"unavailable"})),removeLine:()=>Promise.resolve(omsErr({kind:"unavailable"})),skip:()=>Promise.resolve(omsErr({kind:"unavailable"})),approve:()=>Promise.resolve({kind:"failed",error:{kind:"unavailable"}})});async function offersFor(client,ids){let unique=[...new Set(ids)],read=await Promise.all(unique.map(id=>client.offer(id)));return new Map(unique.map((id,i)=>[id,read[i].ok?read[i].value:null]))}function createOmsPackageSource(client){async function build(plan,review){let offers=await offersFor(client,review.lines.map(l=>l.offerId)),lines=review.lines.map(l=>({...l,offer:offers.get(l.offerId)??null})),draft=null;if(review.state==="open"&&lines.length>0){let d=await client.draftCycle(plan.planId,review.cycle);if(d.ok)draft=d.value;else if(d.error.kind!=="refused")return omsErr(d.error)}return omsOk({plan:plan,review:review,lines:lines,draft:draft})}return{async load(){let plans=await client.plans();if(!plans.ok)return omsErr(plans.error);let plan=plans.value.plans.find(p=>p.state==="active")??plans.value.plans.find(p=>p.state!=="cancelled");if(!plan)return omsOk(null);let review=await client.cycleReview(plan.planId);return review.ok?build(plan,review.value):omsErr(review.error)},async removeLine(pkg,index,keys){let rest=pkg.lines.filter((_,i)=>i!==index).map(l=>({offerId:l.offerId,quantity:l.quantity,...l.petId?{petId:l.petId}:{}})),edited=await client.editCycle(pkg.plan.planId,pkg.review.cycle,{idempotencyKey:keys.key(`remove:${index}`),lines:rest});return edited.ok?build(pkg.plan,edited.value):omsErr(edited.error)},async skip(pkg,keys){let res=await client.skipCycle(pkg.plan.planId,pkg.review.cycle,{idempotencyKey:keys.key("skip")});return res.ok?omsOk(void 0):omsErr(res.error)},approve(pkg,keys,payments){let draft=pkg.draft;return draft?confirmWithPayerActions(idempotencyKey=>client.approveCycle(pkg.plan.planId,pkg.review.cycle,{idempotencyKey:idempotencyKey,checkoutId:draft.checkoutId,expectedTotal:draft.total}),keys,payments,{reconfirm:false}):Promise.resolve({kind:"failed",error:{kind:"invalidRequest"}})}}}var ShopContext=react.createContext(null);function ShopProvider(props){let{client:client,pets:pets,payments:payments,packageSource:packageSource,copy:copy,children:children}=props,value=react.useMemo(()=>{let list=pets??[],names=new Map(list.map(p=>[p.petId,p.name]));return{client:client,pets:list,petName:id=>id?names.get(id)??null:null,payments:payments??null,packageSource:packageSource??createOmsPackageSource(client),copy:shopCopy(copy)}},[client,pets,payments,packageSource,copy]);return react.createElement(ShopContext.Provider,{value:value},children)}function useShop(){let ctx=react.useContext(ShopContext);if(!ctx)throw new EverfurConfigError("not-initialized","useShop: wrap the shop in <ShopProvider>");return ctx}function useShopRead(key,read){let[state,setState]=react.useState({key:null,phase:"loading",value:null,error:null}),epoch=react.useRef(0),readRef=react.useRef(read);readRef.current=read;let load=react.useCallback(quiet=>{let mine=++epoch.current;key!==null&&(quiet||setState({key:key,phase:"loading",value:null,error:null}),readRef.current().then(res=>{mine===epoch.current&&(res.ok?setState({key:key,phase:"ready",value:res.value,error:null}):setState({key:key,phase:res.error.kind==="unavailable"?"unavailable":"failed",value:null,error:res.error}))}))},[key]);react.useEffect(()=>(load(false),()=>{epoch.current+=1}),[load]);let refresh=react.useCallback(()=>load(false),[load]);return state.key!==key?{phase:"loading",value:null,error:null,refresh:refresh}:{phase:state.phase,value:state.value,error:state.error,refresh:refresh}}function useShopConfig(){let{client:client}=useShop();return useShopRead("shop-config",()=>client.shopConfig())}function useOffers(query={}){let{client:client}=useShop(),text=query.text?.trim()??"",key=`offers:${text}:${query.requiresRx??""}`;return useShopRead(key,()=>client.offers({...text?{text:text}:{},...query.requiresRx!==void 0?{requiresRx:query.requiresRx}:{},limit:100}))}function useOffer(offerId){let{client:client}=useShop();return useShopRead(offerId?`offer:${offerId}`:null,()=>client.offer(offerId))}function usePrescriptions(){let{client:client}=useShop();return useShopRead("prescriptions",()=>client.prescriptions())}function useAddresses(){let{client:client}=useShop();return useShopRead("addresses",()=>client.addresses())}function useAddress(ref){let{client:client}=useShop();return useShopRead(ref?`address:${ref}`:null,()=>client.address(ref))}function usePaymentMethods(){let{client:client}=useShop();return useShopRead("payment-methods",()=>client.paymentMethods())}function useOrders(){let{client:client}=useShop();return useShopRead("orders",()=>client.orders({limit:50}))}function useOrder(orderId){let{client:client}=useShop();return useShopRead(orderId?`order:${orderId}`:null,()=>client.order(orderId))}function usePlans(){let{client:client}=useShop();return useShopRead("plans",()=>client.plans({limit:100}))}function usePackage(){let{packageSource:packageSource}=useShop();return useShopRead("package",()=>packageSource.load())}function useShopAction(act){let[busy,setBusy]=react.useState(false),[error,setError]=react.useState(null),keys=react.useRef(null),running=react.useRef(false),actRef=react.useRef(act);actRef.current=act;let mounted=react.useRef(true);react.useEffect(()=>(mounted.current=true,()=>{mounted.current=false}),[]);let run=react.useCallback(async(...args)=>{if(running.current)return null;running.current=true,keys.current??=new ShopActionKeys,setBusy(true),setError(null);try{let res=await actRef.current(keys.current,...args);return res.ok?keys.current=null:isRetryWithSameKey(res.error)||(keys.current=null),mounted.current&&setError(res.ok?null:res.error),res}finally{running.current=false,mounted.current&&setBusy(false)}},[]),reset=react.useCallback(()=>{keys.current=null,setError(null)},[]);return{busy:busy,error:error,run:run,reset:reset}}function isRetryWithSameKey(error){return error.kind==="network"||error.kind==="timeout"||error.kind==="serviceUnavailable"||error.kind==="serverError"}function distinct(xs){let out=[];for(let x of xs)x!==null&&!out.includes(x)&&out.push(x);return out}function tileFor(rx){return rx?{tone:"pink",icon:"pill"}:{tone:"yellow",icon:"leaf"}}function addressLine(a){return`${a.line2?`${a.line1}, ${a.line2}`:a.line1}, ${a.city}, ${a.region} ${a.postalCode}`}function rxPill(copy){return{label:copy.rx,tone:"rx"}}function refillsLeft(rx){return rx.fillsTotal!==null&&rx.fillsUsed!==null?Math.max(0,rx.fillsTotal-rx.fillsUsed):null}function toPackageView(i){let{pkg:pkg,copy:copy,petName:petName}=i,review=pkg.review,month=monthOf(review.shipsOn),names=distinct(pkg.lines.map(l=>petName(l.petId))),open=review.state==="open",priced=new Map(review.quoteLines.map(q=>[`${q.offerId}:${q.petId??""}`,q])),items=pkg.lines.map((line,index)=>{let offer=line.offer,q=priced.get(`${line.offerId}:${line.petId??""}`),rx=offer?.requiresRx??false,pills=[];return offer||pills.push({label:copy.outOfStock,tone:"later"}),{petId:line.petId,view:{key:`${line.offerId}:${line.petId??""}:${index}`,name:offer?.title??copy.itemNoLongerSold,rx:rx,meta:null,alert:offer?null:copy.packageOutOfStock,pills:pills,price:q&&offer?formatCents(q.unitPrice*q.quantity-q.discount):null,...tileFor(rx),details:offer?{label:copy.details,to:{name:"product",offerId:offer.offerId,...line.petId?{petId:line.petId}:{}}}:null,remove:open?{label:copy.remove,busy:i.removing===index,disabled:i.removing!==null,onPress:()=>i.onRemove(index)}:null}}}),groups=[];for(let it of items){let name=petName(it.petId),label=name?copy.forPet(name):null,existing=groups.find(g=>g.label===label);existing?existing.items.push(it.view):groups.push({label:label,items:[it.view]})}let sum=[],d=pkg.draft;d?(sum.push({k:copy.items,v:formatCents(d.total-d.shipping-d.tax)}),sum.push({k:copy.shipping,v:d.shipping===0?copy.free:formatCents(d.shipping)}),sum.push({k:copy.tax,v:formatCents(d.tax)}),sum.push({k:copy.total,v:formatCents(d.total)})):review.quoteLines.length>0&&sum.push({k:copy.items,v:formatCents(review.quoteLines.reduce((n,q)=>n+q.unitPrice*q.quantity-q.discount,0))});let card=i.card?cardLabel(i.card.brand,i.card.last4):null,anyRx=pkg.lines.some(l=>l.offer?.requiresRx),note=card?[copy.chargedWhenShips(card),anyRx?copy.rxCheckedFirst:null].filter(Boolean).join(" "):null,error=i.error;!error&&review.state==="approving"?error=copy.approvalInProgress:!error&&review.state!=="open"&&review.state!==null?error=copy.reviewClosed:!error&&open&&!i.card&&(error=copy.noCardOnFile);let approve=open&&d&&i.card?{label:copy.approveAndShip,busyLabel:copy.approving,busy:i.approving,disabled:i.approving||i.placed===true||i.removing!==null,onPress:i.onApprove}:null;return{title:month?copy.packageTitle(month):copy.tabPackage,sub:copy.packageSub(names,formatDay(review.approveBy,{weekday:true}),null),reviewPill:review.approveBy&&open?copy.reviewBy(formatDay(review.approveBy)):null,countPill:pkg.lines.length>0?copy.itemCount(pkg.lines.length):null,fine:null,groups:pkg.lines.length>0?groups:[],empty:pkg.lines.length===0?{line:month?copy.packageEmpty(month):copy.nothingHereYet,shop:{label:copy.tabShop,to:{name:"shop"}},skip:null}:null,add:null,sum:sum,approve:approve,skip:open?{label:copy.skipThisMonth,to:{name:"plan"}}:null,note:note,error:error,delivery:i.address?[{k:copy.shipTo,v:addressLine(i.address),change:{label:copy.change,to:{name:"address",then:{name:"package"}}}}]:[],legal:copy.legal}}function readyRxFor(offerId,prescriptions){return prescriptions.filter(p=>p.status==="ready"&&p.offerId===offerId)}function toTile(offer,prescriptions,copy,petName){let pills=[],meta=null,petId=null;if(offer.requiresRx){pills.push(rxPill(copy));let holder=readyRxFor(offer.offerId,prescriptions).find(p=>petName(p.petId));petId=holder?.petId??null,meta=holder?copy.hasPrescription(petName(holder.petId)):copy.needsPrescription}return{key:offer.offerId,to:{name:"product",offerId:offer.offerId,...petId?{petId:petId}:{}},name:offer.title,meta:meta,price:offer.price!==null?formatCents(offer.price):null,pills:pills,...tileFor(offer.requiresRx)}}function toShelves(i){let{copy:copy}=i,shelves=[],refill=i.searching?[]:i.offers.filter(o=>o.requiresRx&&readyRxFor(o.offerId,i.prescriptions).some(p=>i.petName(p.petId)));return refill.length>0&&shelves.push({key:"refill",title:copy.refillSoon,link:i.packageMonth?{label:copy.inMonthsPackage(i.packageMonth),to:{name:"package"}}:null,tiles:refill.map(o=>toTile(o,i.prescriptions,copy,i.petName))}),shelves.push({key:"all",title:i.petNames.length>0?copy.forPets(i.petNames):copy.allProducts,link:null,tiles:i.offers.map(o=>toTile(o,i.prescriptions,copy,i.petName))}),shelves}function toProductView(i){let{copy:copy,offer:offer}=i,monthly=i.plansOn&&i.petName!==null,choice=monthly?i.choice:"once",submitLabel=choice==="monthly"?i.packageMonth?copy.addToPackage(i.packageMonth):copy.startPlan:copy.buyNow,sellable=offer.price!==null;return{back:{label:copy.backToShop,to:{name:"shop"}},title:offer.title,sub:null,price:sellable?formatCents(offer.price):null,priceUnit:null,...tileFor(false),source:null,stockLine:sellable?null:copy.outOfStockNow,choices:monthly?[{value:"monthly",title:copy.everyMonthIn(i.petName),meta:copy.skipOrStop},{value:"once",title:copy.justOnce,meta:copy.justOnceShipsNow}]:null,choice:monthly?choice:null,onChoice:v=>i.onChoice(v==="once"?"once":"monthly"),quantity:i.quantity,onQuantity:n=>i.onQuantity(Math.min(99,Math.max(1,n))),submit:sellable?{label:submitLabel,busyLabel:copy.adding,busy:i.busy,disabled:i.busy,onPress:i.onSubmit}:{label:copy.outOfStock,disabled:true,onPress:()=>{}},error:i.error,facts:null,cards:[],aside:null,legal:copy.legal}}function toRxProductView(i){let{copy:copy,offer:offer}=i,ready=readyRxFor(offer.offerId,i.prescriptions).filter(p=>i.petName(p.petId)),rx=(i.petId?ready.find(p=>p.petId===i.petId):void 0)??ready[0]??null,sellable=offer.price!==null,script=null,submit=null;if(rx){let left=refillsLeft(rx);script={name:copy.hasPrescription(i.petName(rx.petId)),meta:left!==null&&left>0?copy.refillsLeft(left):null,directions:null},submit=sellable?{label:i.packageMonth?copy.refillInPackage(i.packageMonth):copy.buyNow,busyLabel:copy.adding,busy:i.busy,disabled:i.busy,onPress:()=>i.onSubmit(rx)}:{label:copy.outOfStock,disabled:true,onPress:()=>{}}}else{let who=(i.petId?i.petName(i.petId):null)??i.firstPetName;script=who?{name:copy.noPrescriptionFor(who),meta:null,directions:null}:null,submit=i.bookVisitHref?{label:copy.bookVideoVisit,href:i.bookVisitHref}:null}return{back:{label:copy.backToShop,to:{name:"shop"}},stepLabel:copy.prescription,title:offer.title,sub:null,price:sellable?formatCents(offer.price):null,priceUnit:null,...tileFor(true),script:script,stockLine:sellable?null:copy.outOfStockNow,submit:submit,note:null,error:i.error,cards:[],aside:null,legal:copy.legal}}function cadenceLine(days,copy){let months=Math.round(days/30.4);return months>=1&&Math.abs(days-months*30.4)<=2?copy.cadenceMonths(months):copy.cadenceDays}function toPlanView(i){let{copy:copy}=i,live=i.plans.filter(p=>p.state!=="cancelled"),rows=[];for(let plan of live)plan.lines.forEach((line,n)=>{let offer=i.offers.get(line.offerId)??null,pet=i.petName(line.petId),title=[offer?.title??copy.itemNoLongerSold,pet].filter(Boolean).join(" · "),stop=plan.stopReason,meta=stop==="payment_declined"?copy.declined(i.packageMonth):stop&&stop!=="customer"?copy.stopReason(stop):cadenceLine(plan.cadenceDays,copy);rows.push({key:`${plan.planId}:${n}`,title:title,meta:meta,alert:!!(stop&&stop!=="customer"),on:plan.state==="active",busy:i.busyPlan===plan.planId,onToggle:on=>i.onToggle(plan,on),error:i.rowError&&i.rowError.planId===plan.planId&&n===0?i.rowError.line:null})});let active=live.find(p=>p.state==="active")??null,sum=[],reviewBy=formatDay(i.reviewBy,{weekday:true});reviewBy&&sum.push({k:copy.reviewByLabel,v:reviewBy});let ships=formatDay(active?.nextRun??null,{weekday:true});ships&&sum.push({k:copy.ships,v:ships});let declined=live.some(p=>p.stopReason==="payment_declined"),delivery=[];i.address&&delivery.push({k:copy.shipTo,v:addressLine(i.address),change:{label:copy.change,to:{name:"address",then:{name:"plan"}}}}),i.card&&delivery.push({k:copy.payWith,v:cardLabel(i.card.brand,i.card.last4),alert:declined?copy.declined(i.packageMonth):null,change:{label:copy.change,to:{name:"card",then:{name:"plan"}}}});let month=i.packageMonth??monthOf(active?.nextRun??null);return{sub:null,rows:rows,emptyLine:rows.length===0?copy.repeatsEmpty:null,next:active&&sum.length>0?{sum:sum,link:i.packageMonth?{label:copy.reviewMonthsPackage(i.packageMonth),to:{name:"package"}}:null}:null,delivery:delivery,breakCard:active?{skip:month?{label:copy.skipMonth(month),ask:copy.skipMonthAsk(month),body:copy.skipMonthBody}:null,pause:{label:copy.pausePlan,ask:copy.pausePlanAsk,body:copy.pausePlanBody},busy:i.breakBusy,error:i.breakError,onConfirm:i.onBreak}:null,legal:copy.legal}}var IN_PROGRESS=/* @__PURE__ */new Set(["pending_placement","placement_unknown","placed","accepted","release_sent","release_unknown","released","shipped"]);function statusPill(status,copy){let label=copy.orderStatus[status];if(!label)return null;let tone="plain";return IN_PROGRESS.has(status)?tone="soon":status==="delivered"?tone="clear":(status==="rejected"||status==="needs_support")&&(tone="overdue"),{label:label,tone:tone}}function toOrderRow(o,copy){let placed=formatDay(o.placedAt);return{key:o.orderId,to:{name:"order",orderId:o.orderId},icon:"box",title:o.referenceNumber??copy.tabOrders,meta:[placed?copy.placed(placed):null,formatCents(o.total)].filter(Boolean).join(" · "),pill:statusPill(o.status,copy)}}var STEP_OF={pending_placement:1,placement_unknown:1,placed:1,accepted:2,release_sent:2,release_unknown:2,released:2,shipped:3,delivered:5};function toTrackingView(i){let{order:order,copy:copy}=i,s=order.summary,events=order.shipments.flatMap(sh=>sh.tracking),last=events[events.length-1]??null,deliveryBy=events.map(e=>e.deliveryBy).filter(Boolean).pop()??null,at=STEP_OF[s.status],tracker;if(at===void 0)tracker={kind:"ended",line:copy.orderStatus[s.status]??copy.actionFailed};else{let shippedText=last&&last.carrier&&last.trackingNumber?`${last.carrier} ${last.trackingNumber}`:null,delivered=formatDay(deliveryBy,{weekday:true});tracker={kind:"steps",steps:[{key:"approved",title:copy.stepApproved,when:formatWhen(s.placedAt),text:null},{key:"checking",title:copy.stepChecking,when:null,text:null},{key:"filled",title:copy.stepFilled,when:null,text:null},{key:"shipped",title:copy.stepShipped,when:null,text:shippedText},{key:"delivered",title:copy.stepDelivered,when:null,text:delivered&&s.status!=="delivered"?copy.expected(delivered):null}].map((d,n)=>({...d,state:n<at||at===5?"done":n===at?"now":"next"}))}}let arrive=formatDay(deliveryBy,{weekday:true});return{back:{label:copy.backToCare,to:{name:"orders"}},title:s.referenceNumber??copy.tabOrders,sub:arrive&&s.status!=="delivered"&&at!==void 0?copy.shouldArrive(arrive):null,tracker:tracker,items:order.lines.map(l=>({key:l.lineId,name:l.title,rx:l.requiresRx,meta:i.petName(l.petId),pill:null,...tileFor(l.requiresRx)})),sum:[{k:copy.total,v:formatCents(s.total)}],note:null,track:last?.trackingUrl?{label:last.carrier&&last.trackingNumber?`${last.carrier} ${last.trackingNumber}`:copy.trackPackage,href:last.trackingUrl}:null,actions:i.actions,error:i.error,allOrders:{label:copy.allOrders,to:{name:"orders"}},legal:copy.legalTracking}}var SharedContext=react.createContext(null),ShopSharedProvider=SharedContext.Provider;function useShopShared(){let s=react.useContext(SharedContext);if(!s)throw new EverfurConfigError("not-initialized","shop screens render inside EverfurShop");return s}function packageMonth(pkg){return pkg.phase==="ready"&&pkg.value?monthOf(pkg.value.review.shipsOn):null}function loadable(read,map){return read.phase==="ready"&&read.value!==null?{phase:"ready",value:map(read.value)}:read.phase==="loading"?{phase:"loading"}:{phase:"failed",retry:read.refresh}}function pickCard(cards,id){return!cards||cards.length===0?null:(id?cards.find(c=>c.paymentMethodId===id):void 0)??cards[0]??null}function useOffersById(ids){let{client:client}=useShop(),unique=[...new Set(ids)].sort();return useShopRead(`offers-by-id:${unique.join(",")}`,async()=>{let read=await Promise.all(unique.map(id=>client.offer(id)));return omsOk(new Map(unique.map((id,i)=>[id,read[i].ok?read[i].value:null])))})}function outcomeLine(copy,outcome){return outcome.kind==="confirmed"?null:outcome.kind==="needsPayerAction"?copy.cardStepFailed:outcome.kind==="payerActionFailed"?outcome.message??copy.cardStepFailed:outcome.kind==="payerActionClosed"?copy.cardStepClosed:outcome.error.kind==="refused"&&outcome.error.reasonCode==="price_changed"?copy.priceChanged:refusalLine(copy,outcome.error)}var orderNotices=/* @__PURE__ */new WeakMap;function leaveOrderNotice(client,orderId,line){let notices=orderNotices.get(client);notices||(notices=/* @__PURE__ */new Map,orderNotices.set(client,notices)),line?notices.set(orderId,line):notices.delete(orderId)}function peekOrderNotice(client,orderId){return orderNotices.get(client)?.get(orderId)??null}function dropOrderNotice(client,orderId){orderNotices.get(client)?.delete(orderId)}var CARD_PAGE_NOTICE="\0card",takenReturns=/* @__PURE__ */new WeakSet;function takeCardReturn(client,ret,route,copy){if(!ret||takenReturns.has(ret))return false;let key=ret.step==="card"?route.name==="card"?CARD_PAGE_NOTICE:null:route.name==="order"?route.orderId:null;return key===null?false:(takenReturns.add(ret),leaveOrderNotice(client,key,ret.outcome==="closed"?copy.cardStepClosed:ret.outcome==="failed"?copy.cardStepFailed:null),true)}function usePackageScreen(go){let{copy:copy,petName:petName,packageSource:packageSource,payments:payments,client:client}=useShop(),{tabs:tabs,pkg:pkg}=useShopShared(),plan=pkg.phase==="ready"?pkg.value?.plan??null:null,cards=usePaymentMethods(),address=useAddress(plan?.destination??null),[removing,setRemoving]=react.useState(null),[error,setError]=react.useState(null),[approving,setApproving]=react.useState(false),[placed,setPlaced]=react.useState(false),remove=useShopAction((keys,p,index)=>packageSource.removeLine(p,index,keys));if(pkg.phase==="ready"&&pkg.value===null)return{tabs:tabs,view:{phase:"failed",retry:pkg.refresh}};let view=loadable(pkg,p=>toPackageView({pkg:p,card:pickCard(cards.value,p.plan.paymentMethodId),address:address.value?.address??null,copy:copy,petName:petName,removing:removing,approving:approving,placed:placed,error:error,onRemove:index=>{setRemoving(index),setError(null),remove.run(p,index).then(res=>{setRemoving(null),res&&res.ok?pkg.refresh():res&&setError(refusalLine(copy,res.error))})},onApprove:()=>{approving||placed||(setApproving(true),setError(null),(async()=>{let outcome=await approveOnce(packageSource,p,payments);setApproving(false);let line=outcomeLine(copy,outcome),orderId=outcome.kind!=="failed"?outcome.orderIds[0]:void 0;orderId?(setPlaced(true),leaveOrderNotice(client,orderId,line),go({name:"order",orderId:orderId})):(setError(line),outcome.kind==="failed"&&outcome.error.kind==="refused"&&pkg.refresh())})())}}));return{tabs:tabs,view:view}}var approvalKeys=/* @__PURE__ */new WeakMap;async function approveOnce(source,p,payments){let keys=approvalKeys.get(p);keys||(keys=new ShopActionKeys,approvalKeys.set(p,keys));let out=await source.approve(p,keys,payments);return(out.kind!=="failed"||out.error.kind==="refused")&&approvalKeys.delete(p),out}function useDebounced(value,ms){let[v,setV]=react.useState(value);return react.useEffect(()=>{let t=setTimeout(()=>setV(value),ms);return()=>clearTimeout(t)},[value,ms]),v}function useShopScreen(initialQuery){let{copy:copy,petName:petName,pets:pets}=useShop(),{tabs:tabs,pkg:pkg}=useShopShared(),[query,setQuery]=react.useState(initialQuery??""),text=useDebounced(query,250),offers=useOffers({text:text}),rx=usePrescriptions(),prescriptions=rx.value??[],names=pets.map(p=>p.name),month=packageMonth(pkg),shelves;offers.phase==="ready"&&offers.value?shelves={phase:"ready",value:toShelves({offers:offers.value.offers,prescriptions:prescriptions,copy:copy,petName:petName,petNames:names,packageMonth:month,searching:text.trim()!==""})}:offers.phase==="loading"||rx.phase==="loading"?shelves={phase:"loading"}:offers.phase==="unavailable"?shelves={phase:"ready",value:[]}:shelves={phase:"failed",retry:offers.refresh};let count=shelves.phase==="ready"?shelves.value.reduce((n,s)=>n+s.tiles.length,0):1,empty=shelves.phase==="ready"&&count===0?text.trim()?copy.noMatches(text.trim()):copy.nothingHereYet:null;return{tabs:tabs,view:{sub:null,query:query,onQuery:setQuery,filters:[],shelves:shelves,empty:empty,legal:copy.legal}}}function lineFor(offer,quantity,petId,rx){return{offerId:offer.offerId,quantity:rx?.packCount??quantity,...rx?.petId??petId?{petId:rx?.petId??petId}:{},...rx?{rxId:rx.rxId}:{}}}function routeFor(name,line){return{name:name,offerId:line.offerId,quantity:line.quantity,...line.petId?{petId:line.petId}:{},...line.rxId?{rxId:line.rxId}:{}}}function useProductScreen(offerId,petId,go){let{copy:copy,petName:petName,pets:pets,client:client}=useShop(),{config:config,pkg:pkg,bookVisitHref:bookVisitHref}=useShopShared(),offer=useOffer(offerId),rx=usePrescriptions(),[choice,setChoice]=react.useState("monthly"),[quantity,setQuantity]=react.useState(1),[error,setError]=react.useState(null),month=packageMonth(pkg),plans=usePlans(),plan=(pkg.phase==="ready"?pkg.value?.plan??null:null)??plans.value?.plans.find(p=>p.state==="active")??null,addToPlan=useShopAction((keys,p,line)=>client.updatePlan(p.planId,{idempotencyKey:keys.key("add"),lines:[...p.lines.map(l=>({offerId:l.offerId,quantity:l.quantity,...l.petId?{petId:l.petId}:{}})),line]})),submit=(line,monthly)=>{if(setError(null),!monthly)return go(routeFor("buy",line));if(!plan)return go(routeFor("consent",line));addToPlan.run(plan,line).then(res=>{res&&res.ok?(pkg.refresh(),go({name:"package"})):res&&setError(refusalLine(copy,res.error))})};if(offer.phase==="ready"&&offer.value?.requiresRx){let o=offer.value,base={offer:o,copy:copy,petId:petId??null,petName:petName,firstPetName:pets[0]?.name??null,packageMonth:month,error:error,bookVisitHref:bookVisitHref};return rx.phase==="unavailable"?{kind:"rx",view:{phase:"ready",value:toRxProductView({...base,prescriptions:[],busy:false,onSubmit:()=>{}})}}:{kind:"rx",view:loadable(rx,list=>toRxProductView({...base,prescriptions:list,busy:addToPlan.busy,onSubmit:p=>submit(lineFor(o,1,null,p),plan!==null)}))}}let petForChoice=(petId?petName(petId):null)??pets[0]?.name??null;return{kind:"product",view:loadable(offer,o=>toProductView({offer:o,copy:copy,petName:petForChoice,packageMonth:month,plansOn:config.recurringTermsVersion!==null,choice:choice,onChoice:setChoice,quantity:quantity,onQuantity:setQuantity,busy:addToPlan.busy,error:error,onSubmit:()=>submit(lineFor(o,quantity,petId??pets[0]?.petId??null,null),choice==="monthly"&&config.recurringTermsVersion!==null&&petForChoice!==null)}))}}function usePlanScreen(){let{copy:copy,petName:petName,client:client}=useShop(),{tabs:tabs,pkg:pkg}=useShopShared(),plans=usePlans(),cards=usePaymentMethods(),live=(plans.value?.plans??[]).filter(p=>p.state!=="cancelled"),active=live.find(p=>p.state==="active")??live[0]??null,address=useAddress(active?.destination??null),offers=useOffersById(live.flatMap(p=>p.lines.map(l=>l.offerId))),[busyPlan,setBusyPlan]=react.useState(null),[rowError,setRowError]=react.useState(null),[breakError,setBreakError]=react.useState(null),toggle=useShopAction((keys,p,on)=>client.planAction(p.planId,{idempotencyKey:keys.key(on?"resume":"pause"),operation:on?"resume":"pause"})),brk=useShopAction((keys,p,which)=>client.planAction(p.planId,{idempotencyKey:keys.key(which),operation:which})),month=packageMonth(pkg);if(plans.phase==="unavailable")return{tabs:tabs,view:{phase:"failed",retry:plans.refresh}};let view=loadable(plans,()=>toPlanView({plans:live,offers:offers.value??/* @__PURE__ */new Map,copy:copy,petName:petName,card:pickCard(cards.value,active?.paymentMethodId??null),address:address.value?.address??null,reviewBy:pkg.phase==="ready"?pkg.value?.review.approveBy??null:null,packageMonth:month,busyPlan:busyPlan,rowError:rowError,onToggle:(p,on)=>{setBusyPlan(p.planId),setRowError(null),toggle.run(p,on).then(res=>{setBusyPlan(null),toggle.reset(),res&&res.ok?plans.refresh():res&&setRowError({planId:p.planId,line:refusalLine(copy,res.error)})})},breakBusy:brk.busy,breakError:breakError,onBreak:async which=>{if(!active)return false;setBreakError(null);let res=await brk.run(active,which);return res&&res.ok?(brk.reset(),plans.refresh(),pkg.refresh(),true):(res&&setBreakError(refusalLine(copy,res.error)),false)}}));return{tabs:tabs,view:view}}function useOrdersScreen(){let{copy:copy,pets:pets}=useShop(),{tabs:tabs}=useShopShared(),orders=useOrders(),names=pets.map(p=>p.name),rows=loadable(orders,page2=>page2.orders.map(o=>toOrderRow(o,copy)));return{tabs:tabs,view:{sub:names.length>0?copy.ordersSub(names):null,rows:orders.phase==="unavailable"?{phase:"ready",value:[]}:rows,emptyLine:copy.ordersEmpty,more:null,legal:copy.legal}}}function useTrackingScreen(orderId){let{copy:copy,petName:petName,client:client,payments:payments}=useShop(),order=useOrder(orderId),[error,setError]=react.useState(()=>peekOrderNotice(client,orderId));react.useEffect(()=>dropOrderNotice(client,orderId),[client,orderId]);let cancel=useShopAction(keys=>client.cancelOrder(orderId,{idempotencyKey:keys.key("cancel"),reasonCode:"customer_request"})),pay=useShopAction(async keys=>{let key=keys.key("pay");for(let round=0;round<3;round+=1){let res=await client.payOrder(orderId,{idempotencyKey:key});if(!res.ok)return omsErr(res.error);if(res.value.outcome==="authorized")return omsOk({kind:"confirmed",orderIds:[orderId]});if(!payments||!res.value.payerAction)return omsOk({kind:"needsPayerAction",orderIds:[orderId]});let step2=await payments.handleNextAction(res.value.payerAction,{orderId:orderId});if(!step2.ok)return omsOk(step2.closed?{kind:"payerActionClosed",orderIds:[orderId]}:{kind:"payerActionFailed",orderIds:[orderId],message:step2.message});key=keys.next("pay")}return omsOk({kind:"needsPayerAction",orderIds:[orderId]})}),actions=[];return order.value?.canPay&&actions.push({label:copy.payOrder,busyLabel:copy.saving,busy:pay.busy,disabled:pay.busy||cancel.busy,onPress:()=>{setError(null),pay.run().then(res=>{res&&(res.ok?setError(outcomeLine(copy,res.value)):setError(refusalLine(copy,res.error)),order.refresh())})}}),order.value?.canCancel&&actions.push({label:copy.cancelOrder,busyLabel:copy.saving,busy:cancel.busy,disabled:pay.busy||cancel.busy,onPress:()=>{setError(null),cancel.run().then(res=>{res&&!res.ok&&setError(refusalLine(copy,res.error)),order.refresh()})}}),{view:loadable(order,o=>toTrackingView({order:o,copy:copy,petName:petName,actions:actions,error:error}))}}function useAddressStep(then,go){let{copy:copy,client:client}=useShop(),back=then??{name:"package"},save=useShopAction((_keys,input)=>client.addAddress(input));return{back:{label:copy.backToCare,to:back},busy:save.busy,error:save.error?refusalLine(copy,save.error):null,onSave:input=>{save.run(input).then(res=>{res&&res.ok&&go(back)})}}}function useCardStep(then,go,handoff){let{copy:copy,client:client,payments:payments}=useShop(),{config:config}=useShopShared(),back=then??{name:"plan"},[error,setError]=react.useState(()=>peekOrderNotice(client,CARD_PAGE_NOTICE));react.useEffect(()=>dropOrderNotice(client,CARD_PAGE_NOTICE),[client]);let setup=useShopAction(async()=>{if(handoff){let step3=await handoff();return step3.ok?omsOk(true):(setError(step3.closed?copy.cardStepClosed:step3.message??copy.cardStepFailed),omsOk(false))}let s=await client.setupPaymentMethod();if(!s.ok||!payments)return s.ok?omsErr({kind:"invalidRequest"}):omsErr(s.error);let step2=await payments.confirmCardSetup(s.value.payerAction);return step2.ok?omsOk(true):(setError(step2.closed?copy.cardStepClosed:step2.message??copy.cardStepFailed),omsOk(false))}),on=handoff?true:payments!==null&&config.stripePublishableKey!==null;return{back:{label:copy.backToCare,to:back},error:error??(setup.error?refusalLine(copy,setup.error):null),start:on?{label:copy.cardStart,busyLabel:copy.saving,busy:setup.busy,disabled:setup.busy,onPress:()=>{setError(null),setup.run().then(res=>{res&&res.ok&&res.value&&go(back)})}}:null}}function useCheckoutBasics(){let addresses=useAddresses(),cards=usePaymentMethods(),address=addresses.value?.find(a=>a.isDefault&&a.isComplete)??addresses.value?.find(a=>a.isComplete)??null,card=pickCard(cards.value,null);return{addresses:addresses,cards:cards,address:address,card:card}}function useBuyStep(route,go){let{copy:copy,client:client,payments:payments,petName:petName}=useShop(),offer=useOffer(route.offerId),{address:address,card:card}=useCheckoutBasics(),line=react.useMemo(()=>({offerId:route.offerId,quantity:route.quantity,...route.petId?{petId:route.petId}:{},...route.rxId?{rxId:route.rxId}:{}}),[route.offerId,route.quantity,route.petId,route.rxId]),quote=useShopRead(address?`quote:${address.ref}:${JSON.stringify(line)}`:null,()=>client.quote({lines:[line],shipTo:address.ref})),[shown,setShown]=react.useState(null),[error,setError]=react.useState(null),[placed,setPlaced]=react.useState(false),buy=useShopAction(async keys=>{let draft=await client.createCheckout({idempotencyKey:keys.key("draft"),lines:[line],shipTo:address.ref});if(!draft.ok)return omsErr(draft.error);if((shown??quote.value?.total??null)!==draft.value.total)return setShown(draft.value.total),omsErr({kind:"refused",status:409,reasonCode:"price_changed",message:null});let out=await confirmWithPayerActions(idempotencyKey=>client.confirmCheckout(draft.value.checkoutId,{idempotencyKey:idempotencyKey,expectedTotal:draft.value.total,paymentMethodId:card.paymentMethodId}),keys,payments);return out.kind==="failed"?omsErr(out.error):omsOk(out)}),needs=[...address?[]:[{label:copy.addressNeeded,to:{name:"address",then:route}}],...card?[]:[{label:copy.cardTitle,to:{name:"card",then:route}}]],q=quote.value,total=shown??q?.total??null;return{back:{label:copy.backToShop,to:{name:"product",offerId:route.offerId}},title:copy.confirmTitle,lines:offer.value?[{key:line.offerId,name:offer.value.title,meta:petName(line.petId),price:offer.value.price!==null?formatCents(offer.value.price*line.quantity):null}]:[],sum:q&&total!==null?[{k:copy.shipping,v:q.shipping===0?copy.free:formatCents(q.shipping)},{k:copy.tax,v:formatCents(q.tax)},{k:copy.total,v:formatCents(total)}]:null,needs:needs,pay:address&&card&&q?{label:copy.confirmPay,busyLabel:copy.saving,busy:buy.busy,disabled:buy.busy||placed,onPress:()=>{placed||(setError(null),buy.run().then(res=>{if(!res)return;let out=res.ok?res.value:{kind:"failed",error:res.error},orderId=out.kind!=="failed"?out.orderIds[0]:void 0;orderId?(setPlaced(true),leaveOrderNotice(client,orderId,outcomeLine(copy,out)),go({name:"order",orderId:orderId})):setError(outcomeLine(copy,out))}))}}:null,note:card?copy.chargedWhenShips(cardLabel(card.brand,card.last4)):null,error:error??(quote.phase==="failed"&"e.error?refusalLine(copy,quote.error):null)}}function useConsentStep(route,go){let{copy:copy,client:client}=useShop(),{config:config,pkg:pkg}=useShopShared(),{address:address,card:card}=useCheckoutBasics(),create=useShopAction(keys=>client.createPlan({idempotencyKey:keys.key("create"),cadenceDays:30,destination:address.ref,paymentMethodId:card.paymentMethodId,consentTermsVersion:config.recurringTermsVersion,lines:[{offerId:route.offerId,quantity:route.quantity,...route.petId?{petId:route.petId}:{},...route.rxId?{rxId:route.rxId}:{}}]})),needs=[...address?[]:[{label:copy.addressNeeded,to:{name:"address",then:route}}],...card?[]:[{label:copy.cardTitle,to:{name:"card",then:route}}]];return{back:{label:copy.backToShop,to:{name:"product",offerId:route.offerId}},terms:config.recurringTermsUrl?{label:copy.consentTermsLink,href:config.recurringTermsUrl}:null,needs:needs,error:create.error?refusalLine(copy,create.error):null,agree:address&&card&&config.recurringTermsVersion?{label:copy.consentAgree,busyLabel:copy.saving,busy:create.busy,disabled:create.busy,onPress:()=>{create.run().then(res=>{res&&res.ok&&(pkg.refresh(),go({name:"plan"}))})}}:null}}var NavContext=react.createContext({href:()=>"#",go:()=>{}}),ShopNavProvider=NavContext.Provider;function useShopNav(){return react.useContext(NavContext)}function ShopLink({to:to,className:className,children:children,ariaCurrent:ariaCurrent}){let nav=useShopNav(),onClick=e=>{e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||(e.preventDefault(),nav.go(to))};/* @__PURE__ */
|
|
5
|
+
return jsxRuntime.jsx("a",{className:className,href:nav.href(to),onClick:onClick,"aria-current":ariaCurrent,children:children})}var SHOP_KIT_CSS=':host{--ef-dark-green:#10462E;--ef-white:#FFFFFF;--ef-black:#000000;--ef-dusty-pink:#FFC3BC;--ef-bright-green:#07C168;--ef-yellow:#F2C763;--ef-dusty-blue:#A8B9DA;--ef-sky-blue:#4E98C9;--ef-charcoal:#3D3D3D;--ef-red-deep:#6D1D14;--ef-red-bright:#C03410;--bg:var(--ef-white);--bg-brand:var(--ef-dark-green);--bg-accent:var(--ef-dusty-pink);--bg-accent-b2b:var(--ef-dusty-blue);--bg-warm:var(--ef-yellow);--text:var(--ef-black);--text-brand:var(--ef-dark-green);--text-on-brand:var(--ef-white);--text-cta:var(--ef-bright-green);--text-muted:#6B6B6B;--bg-mist:#F1F5F2;--border:#E4E4E4;--border-strong:var(--ef-charcoal);--alert:var(--ef-red-bright);--alert-deep:var(--ef-red-deep);--btn-primary-bg:var(--ef-dark-green);--btn-primary-text:var(--ef-white);--btn-secondary-bg:transparent;--btn-secondary-text:var(--ef-dark-green);--btn-secondary-border:var(--ef-dark-green);--font:"Azeret", "Helvetica Neue", Arial, sans-serif;--font-mono:"Azeret Mono", ui-monospace, "SF Mono", Menlo, monospace;--fs-xs:13px;--fs-sm:15px;--fs-md:17px;--fs-lg:20px;--fs-xl:24px;--fs-2xl:32px;--fs-3xl:40px;--fs-4xl:56px;--lh-body:1.55;--lh-display:1.15;--fw-regular:400;--fw-medium:500;--fw-bold:700;--sp-1:4px;--sp-2:8px;--sp-3:12px;--sp-4:16px;--sp-5:24px;--sp-6:32px;--sp-7:48px;--sp-8:64px;--sp-9:96px;--radius-sm:6px;--radius-md:10px;--radius-lg:20px;--radius-xl:28px;--radius-pill:999px;--shadow-sm:0 1px 2px rgba(16, 70, 46, 0.06);--shadow-md:0 4px 16px rgba(16, 70, 46, 0.08);--container:1200px;--container-narrow:720px}:host{font-family:var(--font);color:var(--text);background:var(--bg)}:host{font-size:var(--fs-md);line-height:var(--lh-body);margin:0}h1,h2,h3,h4{color:var(--text-brand);line-height:var(--lh-display);font-weight:var(--fw-bold)}h1{font-size:var(--fs-3xl)}h2{font-size:var(--fs-2xl)}h3{font-size:var(--fs-xl)}small{font-size:var(--fs-xs);color:var(--text-muted)}:host{--ink:var(--ef-dark-green);--go:var(--ef-bright-green);--muted:var(--text-muted);--line:var(--border);--pink-50:color-mix(in srgb, var(--ef-dusty-pink) 50%, var(--ef-white));--ease-out:cubic-bezier(0.23, 1, 0.32, 1);--max:1440px;--gutter:clamp(20px, 5vw, 72px);--edge:max(var(--gutter), calc((100% - var(--max)) / 2 + var(--gutter)));--pad-75:clamp(48px, 5.2vw, 75px);--pad-90:clamp(56px, 6.25vw, 90px);color-scheme:light}*,*::before,*::after{box-sizing:border-box}:host{scroll-padding-top:86px;scroll-behavior:smooth;-webkit-text-size-adjust:100%}:host{margin:0;font-family:var(--font);font-size:var(--fs-md);line-height:var(--lh-body);color:var(--text);background:var(--bg);-webkit-font-smoothing:antialiased}img{display:block;max-width:100%}a{color:inherit}a,button,summary{-webkit-tap-highlight-color:color-mix(in srgb, var(--ink) 12%, transparent)}p,h1,h2,h3,ul,ol,figure{margin:0}h1,h2,h3{color:var(--ink);font-weight:var(--fw-medium)}:focus-visible{outline:3px solid var(--ink);outline-offset:3px}.visually-hidden{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}.skip{position:absolute;left:var(--sp-4);top:-100px;z-index:60;padding:var(--sp-3) var(--sp-4);background:var(--ink);color:var(--ef-white);border-radius:var(--radius-pill);text-decoration:none}.skip:focus{top:var(--sp-4)}.copy{display:grid;gap:var(--sp-4);font-size:clamp(17px, 1.25vw, 18px);line-height:1.55}.label{font-family:var(--font-mono);font-weight:var(--fw-bold);font-size:13px;line-height:1.4;letter-spacing:0.08em;text-transform:uppercase}.btn{display:inline-flex;align-items:center;justify-content:center;gap:var(--sp-2);border-radius:var(--radius-pill);border:0 solid var(--ink);font:inherit;text-decoration:none;white-space:nowrap;cursor:pointer;touch-action:manipulation;transition:background-color 180ms ease, color 180ms ease, transform 160ms var(--ease-out)}.btn:active{transform:scale(0.97)}.btn--ink{min-height:52px;padding:0 var(--sp-5);background:var(--ink);color:var(--ef-white);border:1.5px solid var(--ef-white);font-size:var(--fs-md);font-weight:var(--fw-bold);line-height:1}.btn--outline{min-height:52px;padding:0 var(--sp-5);background:transparent;color:var(--ink);border-width:1.5px;font-size:var(--fs-md);line-height:1}@media (hover: hover) and (pointer: fine){.btn--ink:hover{background:color-mix(in srgb, var(--ink) 86%, var(--ef-black))}.btn--outline:hover{background:color-mix(in srgb, var(--ink) 6%, var(--ef-white))}}@media (max-width: 479px){.btn{white-space:normal;text-align:center}}@media (prefers-reduced-motion: reduce){:host{scroll-behavior:auto}.btn{transition:none}.btn:active{transform:none}}:host{--side-w:248px;--top-h:72px;--gap:32px;--card-pad:24px;--tint-sage:color-mix(in srgb, var(--ef-dark-green) 5%, var(--bg-mist));--tint-pink:color-mix(in srgb, var(--ef-dusty-pink) 35%, var(--ef-white));--tint-pink-soft:color-mix(in srgb, var(--ef-dusty-pink) 15%, var(--ef-white));--tint-blue:color-mix(in srgb, var(--ef-dusty-blue) 24%, var(--ef-white));--tint-yellow:color-mix(in srgb, var(--ef-yellow) 26%, var(--ef-white));--tint-yellow-edge:color-mix(in srgb, var(--ef-yellow) 70%, var(--ef-white));--tint-red:color-mix(in srgb, var(--ef-red-bright) 7%, var(--ef-white));--tint-go:color-mix(in srgb, var(--ef-bright-green) 14%, var(--ef-white));--ico-grey:var(--text-muted);--ico-sage:color-mix(in srgb, var(--ef-dark-green) 50%, var(--bg-mist));--ico-blue:var(--ef-sky-blue)}.ico{display:block;flex:none;width:24px;height:24px}.pets{display:flex;gap:var(--sp-1);margin:0 0 var(--sp-3);padding:var(--sp-1) 0 var(--sp-3);list-style:none;overflow-x:auto;scrollbar-width:none}.pets::-webkit-scrollbar{display:none}.pets a{display:grid;justify-items:center;gap:6px;width:60px;padding:6px 0;border-radius:var(--radius-md);color:var(--ink);font-size:13px;line-height:1.2;text-decoration:none}.pets img{width:48px;height:48px;border-radius:50%;outline:2px solid transparent;outline-offset:2px;transition:outline-color 150ms ease}.pets img{object-fit:cover;background:var(--ef-white);box-shadow:inset 0 0 0 1px var(--line)}.pets a[aria-current] img{outline-color:var(--go)}.pets a[aria-current] span{font-weight:var(--fw-bold)}@media (hover: hover) and (pointer: fine){.pets a:not([aria-current]):hover img{outline-color:var(--ico-sage)}}.pets a:focus-visible{outline-offset:0}.page{min-width:0;padding-top:var(--sp-2)}.page-head{display:flex;align-items:center;min-height:44px}.page-title{font-size:clamp(28px, 2.5vw, 36px);line-height:1.15;letter-spacing:-0.02em;text-wrap:balance}.card{padding:var(--card-pad);background:var(--ef-white);border:1px solid var(--line);border-radius:var(--radius-lg)}.card__head{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:var(--sp-2) var(--sp-4);margin-bottom:var(--sp-4)}.card__title{font-weight:var(--fw-bold);font-size:var(--fs-lg);line-height:1.25;letter-spacing:-0.02em}.card__link{font-weight:var(--fw-bold);font-size:var(--fs-sm);line-height:1.4;color:var(--ink);text-decoration:none;white-space:nowrap}.card__link:hover{text-decoration:underline;text-underline-offset:3px}button.card__link{padding:0;border:0;background:none;font-family:inherit;cursor:pointer}.pill{display:inline-flex;align-items:center;min-height:24px;padding:0 10px;border-radius:var(--radius-pill);font-family:var(--font-mono);font-weight:var(--fw-bold);font-size:12px;line-height:1;letter-spacing:0.06em;text-transform:uppercase;white-space:nowrap}.pill--stable{background:var(--tint-go);color:var(--ink)}.pill--overdue{background:var(--ef-white);color:var(--alert);box-shadow:inset 0 0 0 1.25px var(--alert)}.pill--soon{background:var(--ef-white);color:var(--ink);box-shadow:inset 0 0 0 1.25px var(--tint-yellow-edge)}.pill--later{background:var(--ef-white);color:var(--muted);box-shadow:inset 0 0 0 1.25px var(--line)}.pill--clear{background:var(--ef-white);color:var(--go);box-shadow:inset 0 0 0 1.5px var(--go)}.pill--plain{background:var(--ef-white);color:var(--ink);box-shadow:inset 0 0 0 1.5px color-mix(in srgb, var(--ink) 20%, transparent)}.btn--sm{min-height:46px;padding:0 var(--sp-4);font-size:var(--fs-sm)}.btn--sm .ico{width:20px;height:20px}.btn--ink{border-color:var(--ink)}.btn--row{min-height:36px;padding:0 14px;font-size:14px}.btn--row .ico{width:17px;height:17px}.add{flex:1;display:flex;flex-direction:column;gap:var(--sp-3)}.add p{font-size:var(--fs-sm);line-height:1.5}.add .btn{width:100%}.legal{margin-top:var(--sp-7);font-size:13px;line-height:1.6;color:var(--muted);text-align:center}@media (max-width: 1279px){:host{--side-w:220px;--gap:24px}}@media (max-width: 899px){.page-head{flex-direction:column;align-items:flex-start}}@media (max-width: 559px){:host{--card-pad:18px}}[hidden]{display:none !important}.page-head--sub{flex-direction:column;align-items:flex-start}.back{display:inline-flex;align-items:center;gap:6px;margin-bottom:var(--sp-2);font-weight:var(--fw-bold);font-size:var(--fs-sm);line-height:1.4;color:var(--ink);text-decoration:none}.back .ico{width:18px;height:18px}@media (hover: hover) and (pointer: fine){.back:hover{text-decoration:underline;text-underline-offset:3px}}.page-sub{max-width:760px;margin-top:var(--sp-2);font-size:var(--fs-md);line-height:1.5;color:var(--text);text-wrap:pretty}.step-label{margin-bottom:var(--sp-1);font-family:var(--font-mono);font-weight:var(--fw-bold);font-size:12px;line-height:1.4;letter-spacing:0.06em;text-transform:uppercase;color:var(--muted)}.sub{display:grid;grid-template-columns:minmax(0, 1.35fr) minmax(0, 1fr);align-items:start;gap:var(--sp-5);margin-top:var(--sp-6)}.sub__main,.sub__aside{display:grid;gap:var(--sp-5);min-width:0}.sub__main > *,.sub__aside > *{min-width:0}.card > .card__title{margin-bottom:var(--sp-4)}.card__lead{margin-bottom:var(--sp-4);font-size:var(--fs-sm);line-height:1.5}.note{font-size:13px;line-height:1.5;color:var(--muted)}.rec + .note{margin-top:var(--sp-3)}.rec{display:grid;gap:var(--sp-1);margin:0 calc(var(--sp-3) * -1);padding:0;list-style:none}.rec > li > :is(a, div){display:grid;grid-template-columns:22px minmax(0, 1fr) auto;align-items:center;gap:var(--sp-3);padding:var(--sp-3);border-radius:var(--radius-md);color:inherit;text-decoration:none}.rec .ico{width:20px;height:20px;color:var(--ico-grey)}.rec__text{display:grid;gap:2px;min-width:0}.rec__title{font-weight:var(--fw-bold);font-size:var(--fs-md);line-height:1.3;color:var(--ink)}.rec__meta{font-size:13px;line-height:1.4;color:var(--muted)}.rec__end{display:flex;align-items:center;gap:var(--sp-2);justify-self:end;font-size:var(--fs-sm);color:var(--muted);white-space:nowrap}.rec__end .ico--chev{width:20px;height:20px;color:var(--ico-sage)}@media (hover: hover) and (pointer: fine){.rec > li > a:hover{background:color-mix(in srgb, var(--tint-sage) 60%, var(--ef-white))}}.facts{display:grid;grid-template-columns:repeat(4, minmax(0, 1fr));gap:var(--sp-3);margin:0;padding:0;list-style:none}.facts li{display:grid;align-content:start;gap:4px;padding:var(--sp-4);border-radius:var(--radius-md);background:var(--tint-sage)}.facts__k{font-size:13px;line-height:1.4;color:var(--muted)}.facts b{white-space:nowrap;font-variant-numeric:tabular-nums;font-size:var(--fs-xl);line-height:1.1;letter-spacing:-0.02em;color:var(--ink)}.facts small{font-weight:var(--fw-medium);font-size:13px;color:var(--muted)}.tracker{display:grid;margin:0;padding:0;list-style:none}.tracker li{position:relative;display:grid;grid-template-columns:28px minmax(0, 1fr);gap:var(--sp-4);padding-bottom:var(--sp-5)}.tracker li::before{content:"";position:absolute;left:13px;top:30px;bottom:2px;width:2px;border-radius:1px;background:var(--line)}.tracker li:last-child{padding-bottom:0}.tracker li:last-child::before{display:none}.tracker__dot{display:grid;place-items:center;width:28px;height:28px;border:2px solid var(--line);border-radius:50%;background:var(--ef-white)}.tracker__dot .ico{width:16px;height:16px}.tracker li.is-done .tracker__dot{border-color:var(--ink);background:var(--ink);color:var(--ef-white)}.tracker li.is-done::before{background:var(--ink)}.tracker li.is-now .tracker__dot{border-color:var(--ink)}.tracker li.is-now .tracker__dot::after{content:"";width:10px;height:10px;border-radius:50%;background:var(--go)}.tracker__title{display:flex;flex-wrap:wrap;align-items:center;gap:4px var(--sp-2);padding-top:3px;font-weight:var(--fw-bold);font-size:var(--fs-md);line-height:1.3;color:var(--ink)}.tracker li:not(.is-done):not(.is-now) .tracker__title{color:var(--muted)}.tracker__text{overflow-wrap:anywhere;margin-top:2px;font-size:var(--fs-sm);line-height:1.5}.tracker__when{margin-top:2px;font-size:13px;line-height:1.4;color:var(--muted)}.field{display:grid;gap:6px}.field__label{font-weight:var(--fw-bold);font-size:var(--fs-sm);line-height:1.4;color:var(--ink)}.input{display:flex;align-items:center;gap:10px;min-height:52px;padding:0 var(--sp-4);border:1.5px solid var(--line);border-radius:var(--radius-md);background:var(--ef-white)}.input:focus-within{border-color:var(--ink)}.input .ico{width:20px;height:20px;color:var(--muted)}.input input{flex:1;width:0;min-width:0;border:0;outline:0;background:transparent;font:inherit;font-size:var(--fs-md);color:var(--text)}.choices{display:grid;gap:var(--sp-2);min-width:0;margin:0;padding:0;border:0;list-style:none}.choice{position:relative;display:grid;grid-template-columns:22px minmax(0, 1fr) auto;align-items:center;gap:var(--sp-3);padding:14px var(--sp-4);border:1.5px solid var(--line);border-radius:var(--radius-md);background:var(--ef-white);cursor:pointer}.choice,.check,.sheet__close{touch-action:manipulation;-webkit-tap-highlight-color:color-mix(in srgb, var(--ink) 12%, transparent)}@media (hover: hover) and (pointer: fine){.choice:not(:has(input:checked)):hover{border-color:color-mix(in srgb, var(--ink) 45%, var(--line))}.sheet__close:hover{background:color-mix(in srgb, var(--tint-sage) 70%, var(--ico-sage) 30%)}}.choice:has(input:checked){border-color:var(--ink);background:var(--tint-pink)}.choice input{appearance:none;width:20px;height:20px;margin:0;border:1.5px solid var(--ico-sage);border-radius:50%;background:var(--ef-white);cursor:pointer}.choice input:checked{border:6px solid var(--ink)}.choice input:focus-visible,.check input:focus-visible{outline:3px solid var(--ink);outline-offset:2px}.choice__title{font-weight:var(--fw-bold);font-size:var(--fs-md);line-height:1.3;color:var(--ink)}.choice__meta{display:block;margin-top:2px;font-size:13px;line-height:1.4;color:var(--muted)}.check{display:grid;grid-template-columns:22px minmax(0, 1fr);align-items:start;gap:var(--sp-3);font-size:var(--fs-sm);line-height:1.5;cursor:pointer}.check input{appearance:none;display:grid;place-content:center;width:20px;height:20px;margin:1px 0 0;border:1.5px solid var(--ico-sage);border-radius:var(--radius-sm);background:var(--ef-white);cursor:pointer}.check input::after{content:"";width:5px;height:10px;border:solid var(--ef-white);border-width:0 2px 2px 0;rotate:45deg;translate:0 -1px;opacity:0}.check input:checked{border-color:var(--ink);background:var(--ink)}.check input:checked::after{opacity:1}.actions{display:flex;flex-wrap:wrap;align-items:center;gap:var(--sp-3) var(--sp-5)}.source{display:flex;align-items:flex-start;gap:var(--sp-2);font-size:13px;line-height:1.5;color:var(--muted)}.source .ico{flex:none;width:16px;height:16px;margin-top:2px;color:var(--ico-sage)}.source :is(a, button){padding:0;border:0;background:none;font:inherit;font-weight:var(--fw-bold);color:var(--ink);text-decoration:underline;text-underline-offset:3px;cursor:pointer}.btn--ask .ico{width:24px;height:24px}.sub__aside .btn{width:100%}.ghost{display:grid;gap:10px;margin-top:var(--sp-4)}.ghost span{height:12px;border-radius:var(--radius-pill);background:var(--tint-sage)}.ghost span:nth-child(2){width:82%}.ghost span:nth-child(3){width:64%}.sheet{overscroll-behavior:contain;width:min(560px, calc(100vw - 32px));max-height:calc(100svh - 48px);padding:0;border:1px solid var(--line);border-radius:var(--radius-lg);color:var(--text)}.sheet::backdrop{background:color-mix(in srgb, var(--ef-black) 35%, transparent)}.sheet__head{display:flex;align-items:center;justify-content:space-between;gap:var(--sp-3);padding:var(--sp-5) var(--sp-5) var(--sp-3)}.sheet__close{display:grid;place-items:center;width:40px;height:40px;border:0;border-radius:50%;background:var(--tint-sage);color:var(--ink);cursor:pointer}.sheet__close .ico{width:20px;height:20px}.sheet__body{display:grid;gap:var(--sp-4);padding:0 var(--sp-5) var(--sp-5)}.note .card__link{white-space:normal}@media (max-width: 1279px){.sub{grid-template-columns:minmax(0, 1fr)}}@media (max-width: 559px){.facts{grid-template-columns:repeat(2, minmax(0, 1fr))}}.input select{flex:1;width:0;min-width:0;min-height:48px;border:0;outline:0;background:transparent;font:inherit;font-size:var(--fs-md);color:var(--text);cursor:pointer}.icon-btn{display:grid;place-items:center;width:44px;height:44px;padding:0;border:0;border-radius:50%;background:transparent;color:var(--ink);cursor:pointer;touch-action:manipulation;transition:background-color 150ms ease, transform 160ms var(--ease-out)}.icon-btn .ico{width:22px;height:22px}.icon-btn:active{transform:scale(0.94)}.icon-btn:disabled{color:var(--line);cursor:default}@media (hover: hover) and (pointer: fine){.icon-btn:not(:disabled):hover{background:var(--tint-sage)}}.sum{margin:0;padding:0 var(--sp-5);border:1px solid var(--line);border-radius:var(--radius-lg);background:var(--ef-white)}.sum > div{display:flex;flex-wrap:wrap;align-items:baseline;justify-content:space-between;gap:2px var(--sp-4);padding:14px 0;border-bottom:1px solid var(--line)}.sum > div:last-child{border-bottom:0}.sum dt{font-size:var(--fs-sm);color:var(--muted)}.sum dd{margin:0 0 0 auto;font-weight:var(--fw-bold);font-size:var(--fs-sm);line-height:1.4;color:var(--ink);text-align:right}.sum--total > div:last-child dd{font-size:var(--fs-lg)}.av{flex:none;width:48px;height:48px;border-radius:50%;object-fit:cover;background:var(--ef-white);box-shadow:inset 0 0 0 1px var(--line)}.av--sm{width:36px;height:36px}.person{display:grid;grid-template-columns:auto minmax(0, 1fr) auto;align-items:center;gap:var(--sp-3) var(--sp-4)}.person__name{font-weight:var(--fw-bold);font-size:var(--fs-md);line-height:1.3;color:var(--ink)}.person__meta{font-size:13px;line-height:1.45;color:var(--muted)}.row-link{display:flex;align-items:center;gap:var(--sp-3);padding:var(--sp-4) var(--sp-5);border:1px solid var(--line);border-radius:var(--radius-lg);background:var(--ef-white);color:var(--ink);font-weight:var(--fw-bold);font-size:var(--fs-sm);line-height:1.35;text-decoration:none;transition:border-color 150ms ease}.row-link > span{flex:1;min-width:0}.row-link .ico{width:22px;height:22px}.row-link .ico--chev{width:20px;height:20px;color:var(--ico-sage)}@media (hover: hover) and (pointer: fine){.row-link:hover{border-color:color-mix(in srgb, var(--ink) 45%, var(--line))}}.ask{display:grid;grid-template-columns:minmax(0, 1fr) 300px;align-items:start;gap:var(--sp-6)}.thumb{display:grid;place-items:center;flex:none;width:64px;height:64px;border-radius:var(--radius-md);background:var(--tint-blue);color:var(--ink)}.thumb .ico{width:26px;height:26px}.thumb--sage{background:var(--tint-sage)}.thumb--pink{background:var(--tint-pink)}.thumb--yellow{background:var(--tint-yellow)}.items{display:grid;margin:0;padding:0;list-style:none}.items > li{display:grid;grid-template-columns:64px minmax(0, 1fr) auto;align-items:center;gap:var(--sp-3) var(--sp-4);padding:var(--sp-4) 0;border-top:1px solid var(--line)}.items > li:first-child{padding-top:0;border-top:0}.items > li:last-child{padding-bottom:0}.items__name{display:flex;flex-wrap:wrap;align-items:center;gap:4px var(--sp-2);font-weight:var(--fw-bold);font-size:var(--fs-md);line-height:1.3;color:var(--ink)}.items__meta{margin-top:2px;font-size:13px;line-height:1.45;color:var(--muted)}.items__end{display:grid;justify-items:end;gap:4px;text-align:right;font-variant-numeric:tabular-nums}.items__price{font-weight:var(--fw-bold);font-size:var(--fs-md);color:var(--ink)}.pill--rx{background:var(--tint-blue);color:var(--ink)}.prods{display:grid;grid-template-columns:repeat(auto-fill, minmax(232px, 1fr));gap:var(--sp-4);margin:0;padding:0;list-style:none}.prod{position:relative;display:grid;grid-template-rows:auto 1fr;gap:var(--sp-3);height:100%;color:inherit;text-decoration:none}.prod__img{display:grid;place-items:center;aspect-ratio:1;border-radius:var(--radius-lg);background:var(--tint-blue);color:var(--ink);transition:box-shadow 150ms ease}.prod__img .ico{width:44px;height:44px}.prod__img--sage{background:var(--tint-sage)}.prod__img--pink{background:var(--tint-pink)}.prod__img--yellow{background:var(--tint-yellow)}@media (hover: hover) and (pointer: fine){.prod:hover .prod__img{box-shadow:inset 0 0 0 1.5px var(--ink)}}.prod__body{display:grid;align-content:start;gap:4px}.prod__name{font-weight:var(--fw-bold);font-size:var(--fs-md);line-height:1.3;color:var(--ink)}.prod__meta{font-size:13px;line-height:1.45;color:var(--muted)}.prod__price{display:flex;flex-wrap:wrap;align-items:center;gap:var(--sp-2);margin-top:4px;font-weight:var(--fw-bold);font-size:var(--fs-md);color:var(--ink);font-variant-numeric:tabular-nums}.prod__tags{position:absolute;top:var(--sp-3);left:var(--sp-3);display:flex;flex-wrap:wrap;gap:6px}.tabs{display:flex;gap:var(--sp-2);max-width:100%;min-width:0;margin:0;padding:0 0 2px;list-style:none;overflow-x:auto;scrollbar-width:none}.tabs::-webkit-scrollbar{display:none}.tabs a{display:inline-flex;align-items:center;min-height:40px;padding:0 var(--sp-4);border:1px solid var(--line);border-radius:var(--radius-pill);color:var(--ink);font-size:var(--fs-sm);line-height:1.2;text-decoration:none;white-space:nowrap}.tabs a[aria-current]{border-color:var(--ink);background:var(--tint-pink);font-weight:var(--fw-bold)}@media (hover: hover) and (pointer: fine){.tabs a:not([aria-current]):hover{border-color:color-mix(in srgb, var(--ink) 45%, var(--line))}}.qty{display:inline-flex;align-items:center;border:1px solid var(--line);border-radius:var(--radius-pill)}.qty .icon-btn{width:40px;height:40px}.qty .icon-btn .ico{width:18px;height:18px}.qty output{min-width:28px;text-align:center;font-weight:var(--fw-bold);font-variant-numeric:tabular-nums}.rows{display:grid;margin:0;padding:0;list-style:none}.rows > li{display:grid;grid-template-columns:minmax(0, 1fr) auto;align-items:center;gap:var(--sp-2) var(--sp-4);padding:var(--sp-4) 0;border-top:1px solid var(--line)}.rows > li:first-child{padding-top:0;border-top:0}.rows > li:last-child{padding-bottom:0}.rows__k{font-weight:var(--fw-bold);font-size:var(--fs-md);line-height:1.3;color:var(--ink)}.rows__v{margin-top:2px;font-size:var(--fs-sm);line-height:1.45;overflow-wrap:anywhere}.rows__meta{margin-top:2px;font-size:13px;line-height:1.45;color:var(--muted)}.switch{position:relative;display:inline-flex;flex:none;cursor:pointer}.switch input{appearance:none;width:48px;height:28px;margin:0;border-radius:var(--radius-pill);background:color-mix(in srgb, var(--line) 80%, var(--ico-sage));cursor:pointer;transition:background-color 150ms ease}.switch::after{content:"";position:absolute;top:3px;left:3px;width:22px;height:22px;border-radius:50%;background:var(--ef-white);box-shadow:var(--shadow-sm);pointer-events:none;transition:translate 200ms var(--ease-out)}.switch:has(input:checked) input{background:var(--ink)}.switch:has(input:checked)::after{translate:20px 0}.switch input:focus-visible{outline:3px solid var(--ink);outline-offset:2px}.btn--danger{min-height:46px;padding:0 var(--sp-4);border:1.5px solid var(--alert);background:var(--ef-white);color:var(--alert);font-size:var(--fs-sm);font-weight:var(--fw-bold)}@media (hover: hover) and (pointer: fine){.btn--danger:hover{background:var(--tint-red)}}.link-danger{padding:0;border:0;background:none;color:var(--alert);font:inherit;font-weight:var(--fw-bold);font-size:var(--fs-sm);text-decoration:underline;text-underline-offset:3px;cursor:pointer}@media (hover: hover) and (pointer: fine){.link-danger:hover{color:var(--alert-deep);text-decoration-thickness:2px}}.card[id]{scroll-margin-top:calc(var(--top-h) + var(--sp-4))}@media (max-width: 1279px){.ask{grid-template-columns:minmax(0, 1fr)}}@media (max-width: 559px){.items > li{grid-template-columns:56px minmax(0, 1fr)}.items .thumb{width:56px;height:56px}.items__end{grid-column:2;justify-items:start;text-align:left}.prods{grid-template-columns:repeat(2, minmax(0, 1fr));gap:var(--sp-3)}.prod__img .ico{width:34px;height:34px}}@media (prefers-reduced-motion: reduce){.switch::after,.icon-btn{transition:none}}:host{--ico-warm:color-mix(in srgb, color-mix(in srgb, var(--ef-yellow) 18%, var(--ef-white)) 80%, var(--ef-charcoal));--ico-amber:color-mix(in srgb, var(--ef-yellow) 55%, var(--ef-red-deep));--amber-text:color-mix(in srgb, var(--ef-yellow) 38%, var(--ef-red-deep))}.scroller{position:relative;min-width:0;max-width:100%}.scroller__track{position:relative;overflow-x:auto;overscroll-behavior-x:contain;scrollbar-width:none}.scroller__track::-webkit-scrollbar{display:none}.scroller__btn{position:absolute;top:50%;z-index:1;display:none;place-items:center;width:32px;height:32px;margin-top:-16px;padding:0;border:1px solid var(--line);border-radius:50%;background:var(--ef-white);box-shadow:0 0 0 6px var(--ef-white);color:var(--ink);cursor:pointer;opacity:0;visibility:hidden;transform:scale(0.95);transition:opacity 100ms var(--ease-out), transform 100ms var(--ease-out), visibility 0s linear 100ms}.scroller__btn .ico{width:18px;height:18px}.scroller__btn--prev{left:calc(-1 * var(--scroller-out, 12px))}.scroller__btn--prev .ico{rotate:180deg}.scroller__btn--next{right:calc(-1 * var(--scroller-out, 12px))}.scroller[data-more~="start"] > .scroller__btn--prev,.scroller[data-more~="end"] > .scroller__btn--next{opacity:1;visibility:visible;transform:none;transition:opacity 150ms var(--ease-out), transform 150ms var(--ease-out), visibility 0s}.scroller[data-more] > .scroller__btn:active{transform:scale(0.97)}@media (hover: hover) and (pointer: fine){.scroller__btn{display:grid}.scroller__btn:hover{border-color:var(--ink)}.scroller__track.is-draggable{cursor:grab}}@media (max-width: 899px){.scroller--bleed{align-self:stretch;max-width:none;margin-inline:calc(-1 * var(--gutter));--scroller-out:calc(16px - var(--gutter))}.scroller--bleed > .scroller__track{padding-inline:var(--gutter);scroll-padding-inline:var(--gutter)}}@media (prefers-reduced-motion: reduce){.scroller__btn,.scroller[data-more] > .scroller__btn:active{transform:none}}.page--care .tabs{margin-top:var(--sp-4)}.page--care .deadline{display:inline-flex;align-items:center;gap:var(--sp-2)}.page--care .items__acts{display:flex;flex-wrap:wrap;gap:var(--sp-1) var(--sp-3);margin-top:6px}.page--care .items__acts :is(a, button){padding:0;border:0;background:none;font:inherit;font-weight:var(--fw-bold);font-size:13px;color:var(--ink);text-decoration:underline;text-underline-offset:3px;cursor:pointer}.page--care .for{margin:var(--sp-5) 0 var(--sp-3)}.page--care .for:first-of-type{margin-top:0}.page--care .approve{display:grid;gap:var(--sp-4)}.page--care .approve .btn{width:100%}.page--care .approve .card__link{justify-self:center}.page--care .sum{padding:0;border:0}.page--care-shop .tabs{margin-top:var(--sp-4)}.page--care-shop .shop-bar{display:flex;flex-wrap:wrap;align-items:center;gap:var(--sp-3);margin:var(--sp-6) 0 var(--sp-5)}.page--care-shop .shop-bar .input{flex:1 1 280px;min-height:48px;border-radius:var(--radius-pill)}.page--care-shop .shop-bar > .scroller{flex:1 1 100%}.page--care-shop .shelf + .shelf{margin-top:var(--sp-7)}.page--care-shop .shelf .card__head{margin-bottom:var(--sp-4)}.page--care-product .prod-page{display:grid;grid-template-columns:minmax(0, 1fr) minmax(0, 1fr);align-items:start;gap:var(--sp-6);margin-top:var(--sp-5)}.page--care-product .prod__img{border-radius:var(--radius-lg)}.page--care-product .prod__img .ico{width:88px;height:88px}.page--care-product .buy{display:grid;gap:var(--sp-4)}.page--care-product .buy__price{font-family:var(--font-mono);font-size:var(--fs-2xl);line-height:1;color:var(--ink)}.page--care-product .buy .btn{width:100%}.page--care-product .buy .actions{flex-wrap:wrap}.page--care-product .buy .actions .btn{flex:1 1 auto}.page--care-product .more{display:grid;gap:var(--sp-5);margin-top:var(--sp-6)}.page--care-product .lasts{margin-top:var(--sp-3)}@media (max-width: 899px){.page--care-product .prod-page{grid-template-columns:minmax(0, 1fr)}.page--care-product .prod__img{max-width:420px}}.page--care-product-rx .prod-page{display:grid;grid-template-columns:minmax(0, 1fr) minmax(0, 1fr);align-items:start;gap:var(--sp-6);margin-top:var(--sp-5)}.page--care-product-rx .prod__img .ico{width:88px;height:88px}.page--care-product-rx .buy{display:grid;gap:var(--sp-4)}.page--care-product-rx .buy__price{font-family:var(--font-mono);font-size:var(--fs-2xl);line-height:1;color:var(--ink)}.page--care-product-rx .buy__price small{font-family:var(--font);font-size:var(--fs-sm);color:var(--muted)}.page--care-product-rx .buy .btn{width:100%}.page--care-product-rx .script{display:grid;gap:var(--sp-2);padding:var(--sp-4);border-radius:var(--radius-md);background:var(--tint-blue)}.page--care-product-rx .script .person{grid-template-columns:auto minmax(0, 1fr)}.page--care-product-rx .more{margin-top:var(--sp-6)}@media (max-width: 899px){.page--care-product-rx .prod-page{grid-template-columns:minmax(0, 1fr)}.page--care-product-rx .prod__img{max-width:420px}}.page--care-tracking .rx{margin-top:var(--sp-2)}.page--care-tracking .rx li{padding:2px 0;font-size:var(--fs-sm)}.page--care-tracking .sum{padding:0;border:0}.page--care-plan .tabs{margin-top:var(--sp-4)}.page--care-plan .sum{padding:0;border:0}.page--care-plan .pause{display:grid;gap:var(--sp-3)}.page--care-plan .pause .btn{width:100%}.page--care-orders .tabs{margin-top:var(--sp-4)}.page--care-orders .orders{margin-top:var(--sp-6)}',SHOP_ICONS={shield:{viewBox:"0 0 22.5814 22.5814",children:[["g",{fill:"none"},[["g",{},[["path",{d:"M18.8178 12.2313C18.8178 16.9358 15.5247 19.2881 11.6106 20.6523C11.4056 20.7218 11.183 20.7185 10.9802 20.6429C7.05663 19.288 3.76351 16.9358 3.76351 12.2313V5.6451C3.76351 5.39556 3.86264 5.15624 4.03909 4.97979C4.21554 4.80333 4.45486 4.7042 4.7044 4.7042C6.58619 4.7042 8.93842 3.57513 10.5756 2.14498C10.7749 1.97467 11.0285 1.8811 11.2907 1.8811C11.5528 1.8811 11.8064 1.97467 12.0057 2.14498C13.6523 3.58454 15.9951 4.7042 17.8769 4.7042C18.1264 4.7042 18.3658 4.80333 18.5422 4.97979C18.7187 5.15624 18.8178 5.39556 18.8178 5.6451V12.2313Z",stroke:"currentColor",strokeWidth:"1.88179",strokeLinecap:"round",strokeLinejoin:"round"},[]],["path",{d:"M8.468 11.2906L10.3498 13.1724L14.1134 9.40885",stroke:"currentColor",strokeWidth:"1.88179",strokeLinecap:"round",strokeLinejoin:"round"},[]]]]]]]},pill:{viewBox:"0 0 24 24",children:[["g",{fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},[["path",{d:"m10.5 20.5 10-10a4.95 4.95 0 1 0-7-7l-10 10a4.95 4.95 0 1 0 7 7Z"},[]],["path",{d:"m8.5 8.5 7 7"},[]]]]]},leaf:{viewBox:"0 0 24 24",children:[["g",{fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},[["path",{d:"M11 20A7 7 0 0 1 9.8 6.1C15.5 5 17 4.48 19 2c1 2 2 4.18 2 8 0 5.5-4.78 10-10 10Z"},[]],["path",{d:"M2 21c0-3 1.85-5.36 5.08-6C9.5 14.52 12 13 13 12"},[]]]]]},paw:{viewBox:"0 0 24 24",children:[["g",{fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},[["circle",{cx:"11",cy:"4",r:"2"},[]],["circle",{cx:"18",cy:"8",r:"2"},[]],["circle",{cx:"20",cy:"16",r:"2"},[]],["path",{d:"M9 10a5 5 0 0 1 5 5v3.5a3.5 3.5 0 0 1-6.84 1.045Q6.52 17.48 4.46 16.84A3.5 3.5 0 0 1 5.5 10Z"},[]]]]]},plus:{viewBox:"0 0 16 16",children:[["g",{fill:"none"},[["g",{},[["path",{d:"M3.33333 8H12.6667",stroke:"currentColor",strokeWidth:"1.33333",strokeLinecap:"round",strokeLinejoin:"round"},[]],["path",{d:"M8 3.33333V12.6667",stroke:"currentColor",strokeWidth:"1.33333",strokeLinecap:"round",strokeLinejoin:"round"},[]]]]]]]},minus:{viewBox:"0 0 24 24",children:[["path",{d:"M5 12h14",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"},[]]]},check:{viewBox:"0 0 24 24",children:[["path",{d:"M20 6 9 17l-5-5",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},[]]]},search:{viewBox:"0 0 24 24",children:[["g",{fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},[["circle",{cx:"11",cy:"11",r:"8"},[]],["path",{d:"m21 21-4.3-4.3"},[]]]]]},"arrow-left":{viewBox:"0 0 24 24",children:[["g",{fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},[["path",{d:"m12 19-7-7 7-7"},[]],["path",{d:"M19 12H5"},[]]]]]},ask:{viewBox:"0 0 48.9298 48.9298",children:[["g",{fill:"none"},[["g",{},[["path",{d:"M6.09993 33.3171C6.39971 34.0733 6.46645 34.9019 6.29158 35.6963L4.12031 42.4037C4.05035 42.7439 4.06844 43.0963 4.17286 43.4275C4.27729 43.7587 4.46458 44.0577 4.71699 44.2963C4.96939 44.5348 5.27854 44.7049 5.61512 44.7904C5.9517 44.8759 6.30454 44.8741 6.6402 44.785L13.5984 42.7503C14.3481 42.6016 15.1245 42.6666 15.839 42.9379C20.1925 44.971 25.1242 45.4011 29.7639 44.1524C34.4037 42.9037 38.4533 40.0564 41.1983 36.1129C43.9434 32.1694 45.2074 27.3831 44.7674 22.5985C44.3273 17.8138 42.2116 13.3383 38.7934 9.96162C35.3751 6.5849 30.8741 4.52397 26.0845 4.14244C21.2948 3.7609 16.5243 5.08329 12.6146 7.87628C8.70494 10.6693 5.90734 14.7534 4.71541 19.408C3.52348 24.0627 4.01383 28.9887 6.09993 33.3171Z",style:{fill:"var(--ef-dark-green)",stroke:"var(--ef-bright-green)"},strokeWidth:"1.39745",strokeLinecap:"round",strokeLinejoin:"round"},[]],["path",{fillRule:"evenodd",clipRule:"evenodd",d:"M34.8999 27.8255V27.6035H32.2725L32.2491 27.7993C31.9569 30.3439 29.7458 33.2428 25.5732 33.2428C23.4945 33.2428 21.7645 32.3813 20.5529 30.9367C19.3619 29.5155 18.6644 27.5126 18.6368 25.1857H35.1149V24.0099C35.1149 20.3584 33.8936 17.6221 32.0175 15.7957C30.1497 13.9734 27.6395 13.0774 25.0963 13.0774C18.7733 13.0787 13.815 17.6428 13.815 24.5737C13.815 31.5046 19.1344 35.8522 25.3113 35.8522C31.4882 35.8522 34.8999 31.2923 34.8999 27.8255ZM29.4619 18.0632C30.3537 19.4569 30.7107 21.2695 30.7287 22.9664H18.6796C18.6947 21.1661 19.1965 19.3452 20.1986 17.9723C21.2118 16.5842 22.7419 15.644 24.833 15.644C27.0978 15.644 28.5562 16.6448 29.4619 18.0646V18.0632Z",style:{fill:"var(--ef-white)"}},[]]]]]]]},file:{viewBox:"0 0 24 24",children:[["g",{fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"},[]],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4"},[]],["path",{d:"M10 9H8"},[]],["path",{d:"M16 13H8"},[]],["path",{d:"M16 17H8"},[]]]]]},message:{viewBox:"0 0 24 24",children:[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},[]]]},box:{viewBox:"0 0 24 24",children:[["g",{fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z"},[]],["path",{d:"M12 22V12"},[]],["path",{d:"M3.29 7 12 12l8.71-5"},[]],["path",{d:"m7.5 4.27 9 5.15"},[]]]]]},bag:{viewBox:"0 0 24 24",children:[["g",{fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},[["path",{d:"M6 2 3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6l-3-4Z"},[]],["path",{d:"M3 6h18"},[]],["path",{d:"M16 10a4 4 0 0 1-8 0"},[]]]]]},chevron:{viewBox:"0 0 19.358 19.358",children:[["g",{fill:"none"},[["g",{},[["path",{d:"M7.25918 14.5191L12.0987 9.67957L7.25918 4.84007",stroke:"currentColor",strokeWidth:"1.61317",strokeLinecap:"round",strokeLinejoin:"round"},[]]]]]]]},x:{viewBox:"0 0 24 24",children:[["g",{fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},[["path",{d:"M18 6 6 18"},[]],["path",{d:"m6 6 12 12"},[]]]]]}};function draw(node,key){let[tag,attrs,children]=node;return react.createElement(tag,{key:key,...attrs},...children.map(draw))}function Icon({name:name,className:className="ico"}){let icon=SHOP_ICONS[name];return icon?/* @__PURE__ */jsxRuntime.jsx("svg",{className:className,"aria-hidden":"true",focusable:"false",viewBox:icon.viewBox,children:icon.children.map(draw)}):null}function prefersStill(){try{return typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches}catch{return false}}function Scroller({className:className,trackClassName:trackClassName,label:label,children:children}){let track=react.useRef(null),[more,setMore]=react.useState(""),[draggable,setDraggable]=react.useState(false),update=react.useCallback(()=>{let t=track.current;if(!t)return;let max=t.scrollWidth-t.clientWidth,edges=[];max>1&&t.scrollLeft>1&&edges.push("start"),max>1&&t.scrollLeft<max-1&&edges.push("end"),setMore(edges.join(" ")),setDraggable(max>1)},[]);react.useEffect(()=>{let t=track.current;if(!t)return;update();let ticking=false,onScroll=()=>{ticking||(ticking=true,requestAnimationFrame(()=>{ticking=false,update()}))};t.addEventListener("scroll",onScroll,{passive:true});let ro=typeof ResizeObserver=="function"?new ResizeObserver(update):null;ro?.observe(t);for(let child of Array.from(t.children))ro?.observe(child);let live=true;return(typeof document<"u"?document.fonts?.ready:void 0)?.then(()=>{live&&update()}),()=>{live=false,t.removeEventListener("scroll",onScroll),ro?.disconnect()}},[update,children]);let move=dir=>{let t=track.current;t&&t.scrollBy({left:dir*.8*t.clientWidth,behavior:prefersStill()?"auto":"smooth"})};/* @__PURE__ */
|
|
6
|
+
return jsxRuntime.jsxs("div",{className:["scroller",className].filter(Boolean).join(" "),"data-more":more,children:[
|
|
7
|
+
/* @__PURE__ */jsxRuntime.jsx("ul",{className:["scroller__track",trackClassName,draggable?"is-draggable":""].filter(Boolean).join(" "),"aria-label":label,ref:track,children:children}),["prev","next"].map(dir=>/* @__PURE__ */jsxRuntime.jsx("button",{type:"button",className:dir==="next"?"scroller__btn scroller__btn--next":"scroller__btn scroller__btn--prev",tabIndex:-1,"aria-hidden":"true",onMouseDown:e=>e.preventDefault(),onClick:()=>move(dir==="next"?1:-1),children:/* @__PURE__ */jsxRuntime.jsx(Icon,{name:"chevron"})},dir))]})}var ALERT_STYLE={color:"var(--alert-deep)"};function CareTabs({copy:copy,current:current,tabs:tabs}){if(tabs.length<2)return null;let label={package:copy.tabPackage,shop:copy.tabShop,orders:copy.tabOrders,plan:copy.tabPlan};/* @__PURE__ */
|
|
8
|
+
return jsxRuntime.jsx(Scroller,{className:"scroller--bleed",trackClassName:"tabs",label:copy.tabsLabel,children:tabs.map(t=>/* @__PURE__ */jsxRuntime.jsx("li",{children:/* @__PURE__ */jsxRuntime.jsx(ShopLink,{to:{name:t},...t===current?{ariaCurrent:"page"}:{},children:label[t]})},t))})}var PILL_CLASS={rx:"pill pill--rx",soon:"pill pill--soon",clear:"pill pill--clear",plain:"pill pill--plain",overdue:"pill pill--overdue",later:"pill pill--later",stable:"pill pill--stable"},THUMB_CLASS={base:"thumb",pink:"thumb thumb--pink",yellow:"thumb thumb--yellow",sage:"thumb thumb--sage"},TILE_IMG_CLASS={base:"prod__img",pink:"prod__img prod__img--pink",yellow:"prod__img prod__img--yellow",sage:"prod__img prod__img--sage"};function Pill({pill:pill,className:className}){/* @__PURE__ */
|
|
9
|
+
return jsxRuntime.jsx("span",{className:className?`${PILL_CLASS[pill.tone]} ${className}`:PILL_CLASS[pill.tone],children:pill.label})}function RxPill({copy:copy}){/* @__PURE__ */
|
|
10
|
+
return jsxRuntime.jsx("span",{className:"pill pill--rx",children:copy.rx})}function Thumb({tone:tone,icon:icon}){/* @__PURE__ */
|
|
11
|
+
return jsxRuntime.jsx("span",{className:THUMB_CLASS[tone],"aria-hidden":"true",children:/* @__PURE__ */jsxRuntime.jsx(Icon,{name:icon})})}function tileImgClass(tone){return TILE_IMG_CLASS[tone]}function Ghost({rows:rows=3}){/* @__PURE__ */
|
|
12
|
+
return jsxRuntime.jsx("div",{className:"ghost","aria-hidden":"true",children:Array.from({length:rows},(_,i)=>/* @__PURE__ */jsxRuntime.jsx("span",{},i))})}function LoadFailed({copy:copy,thing:thing,retry:retry}){/* @__PURE__ */
|
|
13
|
+
return jsxRuntime.jsxs("section",{className:"card",role:"alert",children:[
|
|
14
|
+
/* @__PURE__ */jsxRuntime.jsx("p",{children:copy.loadFailed(thing)}),
|
|
15
|
+
/* @__PURE__ */jsxRuntime.jsx("div",{className:"actions",children:/* @__PURE__ */jsxRuntime.jsx("button",{className:"btn btn--outline btn--sm",type:"button",onClick:retry,children:copy.tryAgain})})]})}function InlineError({line:line}){return line?/* @__PURE__ */jsxRuntime.jsx("p",{className:"note",role:"alert",style:ALERT_STYLE,children:line}):null}function Legal({line:line}){/* @__PURE__ */
|
|
16
|
+
return jsxRuntime.jsx("footer",{className:"legal",children:/* @__PURE__ */jsxRuntime.jsx("p",{children:line})})}function ActionButton({action:action,className:className,type:type="button"}){/* @__PURE__ */
|
|
17
|
+
return jsxRuntime.jsx("button",{className:className,type:type,disabled:action.disabled,"aria-busy":action.busy||void 0,onClick:type==="button"?action.onPress:void 0,children:action.busy&&action.busyLabel?action.busyLabel:action.label})}function ConfirmSheet({open:open,title:title,body:body,confirm:confirm,keep:keep,closeLabel:closeLabel,busyLabel:busyLabel,busy:busy,error:error,onConfirm:onConfirm,onClose:onClose}){let ref=react.useRef(null);return react.useEffect(()=>{let d=ref.current;d&&(open&&!d.open?typeof d.showModal=="function"?d.showModal():d.setAttribute("open",""):!open&&d.open&&(typeof d.close=="function"?d.close():d.removeAttribute("open")))},[open]),/* @__PURE__ */jsxRuntime.jsxs("dialog",{className:"sheet",ref:ref,"aria-label":title,onClose:onClose,onCancel:e=>{e.preventDefault(),busy||onClose()},onClick:e=>{e.target===ref.current&&!busy&&onClose()},children:[
|
|
18
|
+
/* @__PURE__ */jsxRuntime.jsxs("div",{className:"sheet__head",children:[
|
|
19
|
+
/* @__PURE__ */jsxRuntime.jsx("h2",{className:"card__title",children:title}),
|
|
20
|
+
/* @__PURE__ */jsxRuntime.jsx("button",{className:"sheet__close",type:"button","aria-label":closeLabel,disabled:busy,onClick:onClose,children:/* @__PURE__ */jsxRuntime.jsx(Icon,{name:"x"})})]}),
|
|
21
|
+
/* @__PURE__ */jsxRuntime.jsxs("div",{className:"sheet__body",children:[
|
|
22
|
+
/* @__PURE__ */jsxRuntime.jsx("p",{children:body}),
|
|
23
|
+
/* @__PURE__ */jsxRuntime.jsx(InlineError,{line:error}),
|
|
24
|
+
/* @__PURE__ */jsxRuntime.jsxs("div",{className:"actions",children:[
|
|
25
|
+
/* @__PURE__ */jsxRuntime.jsx("button",{className:"btn btn--danger",type:"button",disabled:busy,onClick:onConfirm,children:busy?busyLabel:confirm}),
|
|
26
|
+
/* @__PURE__ */jsxRuntime.jsx("button",{className:"btn btn--outline",type:"button",disabled:busy,onClick:onClose,children:keep})]})]})]})}function Aside({id:id,aside:aside,label:label}){/* @__PURE__ */
|
|
27
|
+
return jsxRuntime.jsx("aside",{className:"sub__aside","aria-label":label,children:/* @__PURE__ */jsxRuntime.jsxs("section",{className:"card","aria-labelledby":id,children:[
|
|
28
|
+
/* @__PURE__ */jsxRuntime.jsx("h2",{className:"card__title",id:id,children:aside.title}),
|
|
29
|
+
/* @__PURE__ */jsxRuntime.jsx("p",{className:"card__lead",children:aside.lead}),
|
|
30
|
+
/* @__PURE__ */jsxRuntime.jsxs("a",{className:aside.icon==="ask"?"btn btn--outline btn--sm btn--ask":"btn btn--outline btn--sm",href:aside.link.href,children:[
|
|
31
|
+
/* @__PURE__ */jsxRuntime.jsx(Icon,{name:aside.icon,className:(aside.icon==="ask","ico")}),aside.link.label]})]})})}function Back({link:link}){/* @__PURE__ */
|
|
32
|
+
return jsxRuntime.jsx("div",{className:"page-head page-head--sub",children:/* @__PURE__ */jsxRuntime.jsxs(ShopLink,{className:"back",to:link.to,children:[
|
|
33
|
+
/* @__PURE__ */jsxRuntime.jsx(Icon,{name:"arrow-left"}),link.label]})})}var FIELD_LIMITS={label:60,recipientName:100,line1:100,line2:100,city:60,region:60,postalCode:16};function AddressFormScreen({copy:copy,back:back,busy:busy,error:error,onSave:onSave}){let id=react.useId(),[f,setF]=react.useState({label:"",recipientName:"",line1:"",line2:"",city:"",region:"",postalCode:""}),set=k=>v=>setF(prev=>({...prev,[k]:v.slice(0,FIELD_LIMITS[k])})),ready=f.label.trim()&&f.recipientName.trim()&&f.line1.trim()&&f.city.trim()&&f.region.trim()&&f.postalCode.trim(),submit=e=>{e.preventDefault(),!(!ready||busy)&&onSave({label:f.label.trim(),makeDefault:true,address:{recipientName:f.recipientName.trim(),line1:f.line1.trim(),line2:f.line2.trim()||null,city:f.city.trim(),region:f.region.trim().toUpperCase(),postalCode:f.postalCode.trim(),country:"US"}})},field=(k,label,autoComplete)=>/* @__PURE__ */jsxRuntime.jsxs("label",{className:"field",children:[
|
|
34
|
+
/* @__PURE__ */jsxRuntime.jsx("span",{className:"field__label",children:label}),
|
|
35
|
+
/* @__PURE__ */jsxRuntime.jsx("span",{className:"input",children:/* @__PURE__ */jsxRuntime.jsx("input",{type:"text",name:`${id}${k}`,value:f[k],autoComplete:autoComplete,onChange:e=>set(k)(e.target.value)})})]},k);/* @__PURE__ */
|
|
36
|
+
return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[
|
|
37
|
+
/* @__PURE__ */jsxRuntime.jsx(Back,{link:back}),
|
|
38
|
+
/* @__PURE__ */jsxRuntime.jsxs("section",{className:"card",children:[
|
|
39
|
+
/* @__PURE__ */jsxRuntime.jsx("h1",{className:"card__title",children:copy.addressTitle}),
|
|
40
|
+
/* @__PURE__ */jsxRuntime.jsxs("form",{onSubmit:submit,style:{display:"grid",gap:"var(--sp-4)",marginTop:"var(--sp-4)"},children:[field("label",copy.addressLabel,"off"),field("recipientName",copy.addressRecipient,"name"),field("line1",copy.addressLine1,"address-line1"),field("line2",copy.addressLine2,"address-line2"),field("city",copy.addressCity,"address-level2"),field("region",copy.addressRegion,"address-level1"),field("postalCode",copy.addressPostal,"postal-code"),
|
|
41
|
+
/* @__PURE__ */jsxRuntime.jsx(InlineError,{line:error}),
|
|
42
|
+
/* @__PURE__ */jsxRuntime.jsx("div",{className:"actions",children:/* @__PURE__ */jsxRuntime.jsx("button",{className:"btn btn--ink",type:"submit",disabled:!ready||busy,children:busy?copy.saving:copy.addressSave})})]})]}),
|
|
43
|
+
/* @__PURE__ */jsxRuntime.jsx(Legal,{line:copy.legal})]})}function CardSetupScreen({copy:copy,back:back,start:start,error:error}){/* @__PURE__ */
|
|
44
|
+
return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[
|
|
45
|
+
/* @__PURE__ */jsxRuntime.jsx(Back,{link:back}),
|
|
46
|
+
/* @__PURE__ */jsxRuntime.jsxs("section",{className:"card",children:[
|
|
47
|
+
/* @__PURE__ */jsxRuntime.jsx("h1",{className:"card__title",children:copy.cardTitle}),
|
|
48
|
+
/* @__PURE__ */jsxRuntime.jsx("p",{className:"card__lead",children:start?copy.cardBody:copy.cardUnavailable}),
|
|
49
|
+
/* @__PURE__ */jsxRuntime.jsx(InlineError,{line:error}),start?/* @__PURE__ */jsxRuntime.jsx("div",{className:"actions",children:/* @__PURE__ */jsxRuntime.jsx(ActionButton,{action:start,className:"btn btn--ink"})}):null]}),
|
|
50
|
+
/* @__PURE__ */jsxRuntime.jsx(Legal,{line:copy.legal})]})}function BuyConfirmScreen({copy:copy,back:back,title:title,lines:lines,sum:sum,needs:needs,pay:pay,note:note,error:error}){/* @__PURE__ */
|
|
51
|
+
return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[
|
|
52
|
+
/* @__PURE__ */jsxRuntime.jsx(Back,{link:back}),
|
|
53
|
+
/* @__PURE__ */jsxRuntime.jsxs("div",{className:"sub",children:[
|
|
54
|
+
/* @__PURE__ */jsxRuntime.jsx("div",{className:"sub__main",children:/* @__PURE__ */jsxRuntime.jsxs("section",{className:"card",children:[
|
|
55
|
+
/* @__PURE__ */jsxRuntime.jsx("h1",{className:"card__title",children:title}),
|
|
56
|
+
/* @__PURE__ */jsxRuntime.jsx("ul",{className:"items",children:lines.map(l=>/* @__PURE__ */jsxRuntime.jsxs("li",{children:[
|
|
57
|
+
/* @__PURE__ */jsxRuntime.jsx("span",{className:"thumb thumb--pink","aria-hidden":"true",children:/* @__PURE__ */jsxRuntime.jsx(Icon,{name:"pill"})}),
|
|
58
|
+
/* @__PURE__ */jsxRuntime.jsxs("div",{children:[
|
|
59
|
+
/* @__PURE__ */jsxRuntime.jsx("p",{className:"items__name",children:l.name}),l.meta?/* @__PURE__ */jsxRuntime.jsx("p",{className:"items__meta",children:l.meta}):null]}),
|
|
60
|
+
/* @__PURE__ */jsxRuntime.jsx("div",{className:"items__end",children:l.price?/* @__PURE__ */jsxRuntime.jsx("span",{className:"items__price",children:l.price}):null})]},l.key))})]})}),
|
|
61
|
+
/* @__PURE__ */jsxRuntime.jsx("aside",{className:"sub__aside",children:/* @__PURE__ */jsxRuntime.jsxs("section",{className:"card approve",children:[
|
|
62
|
+
/* @__PURE__ */jsxRuntime.jsx("h2",{className:"card__title",children:copy.total}),sum?/* @__PURE__ */jsxRuntime.jsx("dl",{className:"sum sum--total",children:sum.map(r=>/* @__PURE__ */jsxRuntime.jsxs("div",{children:[
|
|
63
|
+
/* @__PURE__ */jsxRuntime.jsx("dt",{children:r.k}),
|
|
64
|
+
/* @__PURE__ */jsxRuntime.jsx("dd",{children:r.v})]},r.k))}):null,needs.map(n=>/* @__PURE__ */jsxRuntime.jsx(ShopLink,{className:"card__link",to:n.to,children:n.label},n.label)),pay?/* @__PURE__ */jsxRuntime.jsx(ActionButton,{action:pay,className:"btn btn--ink"}):null,
|
|
65
|
+
/* @__PURE__ */jsxRuntime.jsx(InlineError,{line:error}),note?/* @__PURE__ */jsxRuntime.jsx("p",{className:"note",children:note}):null]})})]}),
|
|
66
|
+
/* @__PURE__ */jsxRuntime.jsx(Legal,{line:copy.legal})]})}function PlanConsentScreen({copy:copy,back:back,terms:terms,needs:needs,agree:agree,error:error}){/* @__PURE__ */
|
|
67
|
+
return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[
|
|
68
|
+
/* @__PURE__ */jsxRuntime.jsx(Back,{link:back}),
|
|
69
|
+
/* @__PURE__ */jsxRuntime.jsxs("section",{className:"card",children:[
|
|
70
|
+
/* @__PURE__ */jsxRuntime.jsx("h1",{className:"card__title",children:copy.consentTitle}),
|
|
71
|
+
/* @__PURE__ */jsxRuntime.jsx("p",{className:"card__lead",children:copy.consentBody}),terms?/* @__PURE__ */jsxRuntime.jsx("p",{className:"note",children:/* @__PURE__ */jsxRuntime.jsx("a",{className:"card__link",href:terms.href,target:"_blank",rel:"noopener noreferrer",children:terms.label})}):null,needs.map(n=>/* @__PURE__ */jsxRuntime.jsx(ShopLink,{className:"card__link",to:n.to,children:n.label},n.label)),
|
|
72
|
+
/* @__PURE__ */jsxRuntime.jsx(InlineError,{line:error}),agree?/* @__PURE__ */jsxRuntime.jsx("div",{className:"actions",children:/* @__PURE__ */jsxRuntime.jsx(ActionButton,{action:agree,className:"btn btn--ink"})}):null]}),
|
|
73
|
+
/* @__PURE__ */jsxRuntime.jsx(Legal,{line:copy.legal})]})}function OrdersScreen({copy:copy,tabs:tabs,view:view}){let id=react.useId(),rows=view.rows;/* @__PURE__ */
|
|
74
|
+
return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[
|
|
75
|
+
/* @__PURE__ */jsxRuntime.jsxs("div",{className:"page-head page-head--sub",children:[
|
|
76
|
+
/* @__PURE__ */jsxRuntime.jsx("h1",{className:"page-title",children:copy.ordersTitle}),view.sub?/* @__PURE__ */jsxRuntime.jsx("p",{className:"page-sub",children:view.sub}):null,
|
|
77
|
+
/* @__PURE__ */jsxRuntime.jsx(CareTabs,{copy:copy,current:"orders",tabs:tabs})]}),rows.phase==="failed"?/* @__PURE__ */jsxRuntime.jsx(LoadFailed,{copy:copy,thing:copy.thingOrders,retry:rows.retry}):/* @__PURE__ */jsxRuntime.jsxs("section",{className:"card orders","aria-labelledby":`${id}t`,"aria-busy":rows.phase==="loading"||void 0,children:[
|
|
78
|
+
/* @__PURE__ */jsxRuntime.jsx("h2",{className:"visually-hidden",id:`${id}t`,children:copy.allOrders}),rows.phase==="loading"?/* @__PURE__ */jsxRuntime.jsx("ul",{className:"rec","aria-hidden":"true",children:[0,1,2].map(n=>/* @__PURE__ */jsxRuntime.jsx("li",{children:/* @__PURE__ */jsxRuntime.jsx("div",{children:/* @__PURE__ */jsxRuntime.jsx("span",{className:"rec__text",children:/* @__PURE__ */jsxRuntime.jsxs("span",{className:"ghost",children:[
|
|
79
|
+
/* @__PURE__ */jsxRuntime.jsx("span",{}),
|
|
80
|
+
/* @__PURE__ */jsxRuntime.jsx("span",{})]})})})},n))}):null,rows.phase==="ready"&&rows.value.length===0?/* @__PURE__ */jsxRuntime.jsx("p",{className:"card__lead",children:view.emptyLine}):null,rows.phase==="ready"&&rows.value.length>0?/* @__PURE__ */jsxRuntime.jsx("ul",{className:"rec",children:rows.value.map(r=>/* @__PURE__ */jsxRuntime.jsx("li",{children:/* @__PURE__ */jsxRuntime.jsxs(ShopLink,{to:r.to,children:[
|
|
81
|
+
/* @__PURE__ */jsxRuntime.jsx(Icon,{name:r.icon}),
|
|
82
|
+
/* @__PURE__ */jsxRuntime.jsxs("span",{className:"rec__text",children:[
|
|
83
|
+
/* @__PURE__ */jsxRuntime.jsx("span",{className:"rec__title",children:r.title}),
|
|
84
|
+
/* @__PURE__ */jsxRuntime.jsx("span",{className:"rec__meta",children:r.meta})]}),
|
|
85
|
+
/* @__PURE__ */jsxRuntime.jsxs("span",{className:"rec__end",children:[r.pill?/* @__PURE__ */jsxRuntime.jsx(Pill,{pill:r.pill}):null,
|
|
86
|
+
/* @__PURE__ */jsxRuntime.jsx(Icon,{name:"chevron",className:"ico ico--chev"})]})]})},r.key))}):null,view.more?/* @__PURE__ */jsxRuntime.jsx("div",{className:"actions",children:/* @__PURE__ */jsxRuntime.jsx(ActionButton,{action:view.more,className:"btn btn--outline btn--sm"})}):null]}),
|
|
87
|
+
/* @__PURE__ */jsxRuntime.jsx(Legal,{line:view.legal})]})}function PackageScreen({copy:copy,tabs:tabs,view:view}){let id=react.useId(),head=(title,sub)=>/* @__PURE__ */jsxRuntime.jsxs("div",{className:"page-head page-head--sub",children:[
|
|
88
|
+
/* @__PURE__ */jsxRuntime.jsx("h1",{className:"page-title",children:title}),sub,
|
|
89
|
+
/* @__PURE__ */jsxRuntime.jsx(CareTabs,{copy:copy,current:"package",tabs:tabs})]});if(view.phase!=="ready")/* @__PURE__ */
|
|
90
|
+
return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[head(copy.tabPackage,view.phase==="loading"?/* @__PURE__ */jsxRuntime.jsx(Ghost,{rows:1}):null),view.phase==="failed"?/* @__PURE__ */jsxRuntime.jsx(LoadFailed,{copy:copy,thing:copy.thingPackage,retry:view.retry}):/* @__PURE__ */jsxRuntime.jsxs("div",{className:"sub",children:[
|
|
91
|
+
/* @__PURE__ */jsxRuntime.jsx("div",{className:"sub__main",children:/* @__PURE__ */jsxRuntime.jsxs("section",{className:"card","aria-busy":"true",children:[
|
|
92
|
+
/* @__PURE__ */jsxRuntime.jsx("div",{className:"card__head",children:/* @__PURE__ */jsxRuntime.jsx("h2",{className:"card__title",children:copy.inThisPackage})}),
|
|
93
|
+
/* @__PURE__ */jsxRuntime.jsx(Ghost,{})]})}),
|
|
94
|
+
/* @__PURE__ */jsxRuntime.jsx("aside",{className:"sub__aside",children:/* @__PURE__ */jsxRuntime.jsxs("section",{className:"card approve","aria-busy":"true",children:[
|
|
95
|
+
/* @__PURE__ */jsxRuntime.jsx("h2",{className:"card__title",children:copy.total}),
|
|
96
|
+
/* @__PURE__ */jsxRuntime.jsx(Ghost,{})]})})]}),
|
|
97
|
+
/* @__PURE__ */jsxRuntime.jsx(Legal,{line:copy.legal})]});let v=view.value;/* @__PURE__ */
|
|
98
|
+
return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[head(v.title,v.sub?/* @__PURE__ */jsxRuntime.jsx("p",{className:"page-sub",children:v.sub}):null),
|
|
99
|
+
/* @__PURE__ */jsxRuntime.jsxs("div",{className:"sub",children:[
|
|
100
|
+
/* @__PURE__ */jsxRuntime.jsxs("div",{className:"sub__main",children:[
|
|
101
|
+
/* @__PURE__ */jsxRuntime.jsxs("section",{className:"card","aria-labelledby":`${id}in`,children:[
|
|
102
|
+
/* @__PURE__ */jsxRuntime.jsxs("div",{className:"card__head",children:[
|
|
103
|
+
/* @__PURE__ */jsxRuntime.jsx("h2",{className:"card__title",id:`${id}in`,children:copy.inThisPackage}),v.reviewPill?/* @__PURE__ */jsxRuntime.jsx("span",{className:"pill pill--soon deadline",children:v.reviewPill}):null]}),v.empty?/* @__PURE__ */jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[
|
|
104
|
+
/* @__PURE__ */jsxRuntime.jsx("p",{className:"card__lead",children:v.empty.line}),
|
|
105
|
+
/* @__PURE__ */jsxRuntime.jsx("div",{className:"actions",children:/* @__PURE__ */jsxRuntime.jsx(ShopLink,{className:"btn btn--outline btn--sm",to:v.empty.shop.to,children:v.empty.shop.label})})]}):null,v.groups.map((g,gi)=>/* @__PURE__ */jsxRuntime.jsxs(react.Fragment,{children:[g.label?/* @__PURE__ */jsxRuntime.jsx("p",{className:"step-label for",children:g.label}):null,
|
|
106
|
+
/* @__PURE__ */jsxRuntime.jsx("ul",{className:"items",children:g.items.map(it=>/* @__PURE__ */jsxRuntime.jsxs("li",{children:[
|
|
107
|
+
/* @__PURE__ */jsxRuntime.jsx(Thumb,{tone:it.tone,icon:it.icon}),
|
|
108
|
+
/* @__PURE__ */jsxRuntime.jsxs("div",{children:[
|
|
109
|
+
/* @__PURE__ */jsxRuntime.jsxs("p",{className:"items__name",children:[it.name,it.rx?/* @__PURE__ */jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" ",
|
|
110
|
+
/* @__PURE__ */jsxRuntime.jsx(RxPill,{copy:copy})]}):null,it.pills.map(p=>/* @__PURE__ */jsxRuntime.jsxs("span",{children:[" ",
|
|
111
|
+
/* @__PURE__ */jsxRuntime.jsx(Pill,{pill:p})]},p.label))]}),it.meta?/* @__PURE__ */jsxRuntime.jsx("p",{className:"items__meta",children:it.meta}):null,it.alert?/* @__PURE__ */jsxRuntime.jsx("p",{className:"items__meta",role:"status",children:it.alert}):null,it.details||it.remove?/* @__PURE__ */jsxRuntime.jsxs("p",{className:"items__acts",children:[it.details?/* @__PURE__ */jsxRuntime.jsx(ShopLink,{to:it.details.to,children:it.details.label}):null,it.remove?/* @__PURE__ */jsxRuntime.jsx(ActionButton,{action:it.remove,className:""}):null]}):null]}),
|
|
112
|
+
/* @__PURE__ */jsxRuntime.jsx("div",{className:"items__end",children:it.price?/* @__PURE__ */jsxRuntime.jsx("span",{className:"items__price",children:it.price}):null})]},it.key))})]},g.label??gi))]}),v.add?/* @__PURE__ */jsxRuntime.jsxs("section",{className:"card","aria-labelledby":`${id}add`,children:[
|
|
113
|
+
/* @__PURE__ */jsxRuntime.jsxs("div",{className:"card__head",children:[
|
|
114
|
+
/* @__PURE__ */jsxRuntime.jsx("h2",{className:"card__title",id:`${id}add`,children:v.add.title}),v.add.link?/* @__PURE__ */jsxRuntime.jsx(ShopLink,{className:"card__link",to:v.add.link.to,children:v.add.link.label}):null]}),
|
|
115
|
+
/* @__PURE__ */jsxRuntime.jsx("ul",{className:"items",children:v.add.items.map(it=>/* @__PURE__ */jsxRuntime.jsxs("li",{children:[
|
|
116
|
+
/* @__PURE__ */jsxRuntime.jsx(Thumb,{tone:it.tone,icon:it.icon}),
|
|
117
|
+
/* @__PURE__ */jsxRuntime.jsxs("div",{children:[
|
|
118
|
+
/* @__PURE__ */jsxRuntime.jsx("p",{className:"items__name",children:it.name}),it.meta?/* @__PURE__ */jsxRuntime.jsx("p",{className:"items__meta",children:it.meta}):null]}),
|
|
119
|
+
/* @__PURE__ */jsxRuntime.jsxs("div",{className:"items__end",children:[it.price?/* @__PURE__ */jsxRuntime.jsx("span",{className:"items__price",children:it.price}):null,
|
|
120
|
+
/* @__PURE__ */jsxRuntime.jsxs("button",{className:"btn btn--outline btn--row",type:"button",disabled:it.add.disabled,onClick:it.add.onPress,children:[
|
|
121
|
+
/* @__PURE__ */jsxRuntime.jsx(Icon,{name:"plus"}),
|
|
122
|
+
/* @__PURE__ */jsxRuntime.jsx("span",{children:it.add.busy&&it.add.busyLabel?it.add.busyLabel:it.add.label})]})]})]},it.key))})]}):null]}),
|
|
123
|
+
/* @__PURE__ */jsxRuntime.jsxs("aside",{className:"sub__aside","aria-label":copy.approveRegion,children:[
|
|
124
|
+
/* @__PURE__ */jsxRuntime.jsxs("section",{className:"card approve","aria-labelledby":`${id}total`,children:[
|
|
125
|
+
/* @__PURE__ */jsxRuntime.jsx("h2",{className:"card__title",id:`${id}total`,children:copy.total}),v.sum.length>0?/* @__PURE__ */jsxRuntime.jsx("dl",{className:"sum sum--total",children:v.sum.map(r=>/* @__PURE__ */jsxRuntime.jsxs("div",{children:[
|
|
126
|
+
/* @__PURE__ */jsxRuntime.jsx("dt",{children:r.k}),
|
|
127
|
+
/* @__PURE__ */jsxRuntime.jsx("dd",{children:r.v})]},r.k))}):null,v.approve?/* @__PURE__ */jsxRuntime.jsx(ActionButton,{action:v.approve,className:"btn btn--ink"}):null,v.skip?"to"in v.skip?/* @__PURE__ */jsxRuntime.jsx(ShopLink,{className:"card__link",to:v.skip.to,children:v.skip.label}):/* @__PURE__ */jsxRuntime.jsx(ActionButton,{action:v.skip,className:"card__link"}):null,
|
|
128
|
+
/* @__PURE__ */jsxRuntime.jsx(InlineError,{line:v.error}),v.note?/* @__PURE__ */jsxRuntime.jsx("p",{className:"note",children:v.note}):null]}),v.delivery.length>0?/* @__PURE__ */jsxRuntime.jsxs("section",{className:"card","aria-labelledby":`${id}ship`,children:[
|
|
129
|
+
/* @__PURE__ */jsxRuntime.jsx("h2",{className:"card__title",id:`${id}ship`,children:copy.delivery}),
|
|
130
|
+
/* @__PURE__ */jsxRuntime.jsx("ul",{className:"rows",children:v.delivery.map(r=>/* @__PURE__ */jsxRuntime.jsxs("li",{children:[
|
|
131
|
+
/* @__PURE__ */jsxRuntime.jsxs("div",{children:[
|
|
132
|
+
/* @__PURE__ */jsxRuntime.jsx("p",{className:"rows__k",children:r.k}),r.v?/* @__PURE__ */jsxRuntime.jsx("p",{className:"rows__v",children:r.v}):null,r.meta?/* @__PURE__ */jsxRuntime.jsx("p",{className:"rows__meta",children:r.meta}):null]}),r.change?/* @__PURE__ */jsxRuntime.jsx(ShopLink,{className:"card__link",to:r.change.to,children:r.change.label}):null]},r.k))})]}):null]})]}),
|
|
133
|
+
/* @__PURE__ */jsxRuntime.jsx(Legal,{line:v.legal})]})}function BreakCard({copy:copy,card:card}){let id=react.useId(),[open,setOpen]=react.useState(null),sheet2=open?card[open]:null;/* @__PURE__ */
|
|
134
|
+
return jsxRuntime.jsxs("section",{className:"card pause","aria-labelledby":`${id}t`,children:[
|
|
135
|
+
/* @__PURE__ */jsxRuntime.jsx("h2",{className:"card__title",id:`${id}t`,children:copy.needABreak}),card.skip?/* @__PURE__ */jsxRuntime.jsx("button",{className:"btn btn--outline btn--sm",type:"button",onClick:()=>setOpen("skip"),children:card.skip.label}):null,card.pause?/* @__PURE__ */jsxRuntime.jsx("button",{className:"link-danger",type:"button",onClick:()=>setOpen("pause"),children:card.pause.label}):null,
|
|
136
|
+
/* @__PURE__ */jsxRuntime.jsx(ConfirmSheet,{open:sheet2!==null,title:sheet2?.ask??"",body:sheet2?.body??"",confirm:sheet2?.label??"",keep:copy.keepIt,closeLabel:copy.close,busyLabel:copy.saving,busy:card.busy,error:sheet2?card.error:null,onConfirm:()=>{open&&card.onConfirm(open).then(done=>{done&&setOpen(null)})},onClose:()=>setOpen(null)})]})}function PlanScreen({copy:copy,tabs:tabs,view:view,reminders:reminders}){let id=react.useId();/* @__PURE__ */
|
|
137
|
+
return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[
|
|
138
|
+
/* @__PURE__ */jsxRuntime.jsxs("div",{className:"page-head page-head--sub",children:[
|
|
139
|
+
/* @__PURE__ */jsxRuntime.jsx("h1",{className:"page-title",children:copy.planTitle}),view.phase==="ready"&&view.value.sub?/* @__PURE__ */jsxRuntime.jsx("p",{className:"page-sub",children:view.value.sub}):null,
|
|
140
|
+
/* @__PURE__ */jsxRuntime.jsx(CareTabs,{copy:copy,current:"plan",tabs:tabs})]}),view.phase==="failed"?/* @__PURE__ */jsxRuntime.jsx(LoadFailed,{copy:copy,thing:copy.thingPlan,retry:view.retry}):null,view.phase!=="failed"?/* @__PURE__ */jsxRuntime.jsxs("div",{className:"sub",children:[
|
|
141
|
+
/* @__PURE__ */jsxRuntime.jsxs("div",{className:"sub__main",children:[
|
|
142
|
+
/* @__PURE__ */jsxRuntime.jsxs("section",{className:"card","aria-labelledby":`${id}rep`,"aria-busy":view.phase==="loading"||void 0,children:[
|
|
143
|
+
/* @__PURE__ */jsxRuntime.jsx("h2",{className:"card__title",id:`${id}rep`,children:copy.whatRepeats}),view.phase==="loading"?/* @__PURE__ */jsxRuntime.jsx(Ghost,{}):null,view.phase==="ready"&&view.value.emptyLine?/* @__PURE__ */jsxRuntime.jsx("p",{className:"card__lead",children:view.value.emptyLine}):null,view.phase==="ready"&&view.value.rows.length>0?/* @__PURE__ */jsxRuntime.jsx("ul",{className:"rows",children:view.value.rows.map(r=>/* @__PURE__ */jsxRuntime.jsxs("li",{children:[
|
|
144
|
+
/* @__PURE__ */jsxRuntime.jsxs("div",{children:[
|
|
145
|
+
/* @__PURE__ */jsxRuntime.jsx("p",{className:"rows__k",children:r.title}),
|
|
146
|
+
/* @__PURE__ */jsxRuntime.jsx("p",{className:"rows__meta",style:r.alert?ALERT_STYLE:void 0,children:r.meta}),r.error?/* @__PURE__ */jsxRuntime.jsx("p",{className:"rows__meta",role:"alert",style:ALERT_STYLE,children:r.error}):null]}),
|
|
147
|
+
/* @__PURE__ */jsxRuntime.jsx("label",{className:"switch",children:/* @__PURE__ */jsxRuntime.jsx("input",{type:"checkbox",checked:r.on,disabled:r.busy,"aria-label":copy.repeatsLabel(r.title),onChange:e=>r.onToggle(e.target.checked)})})]},r.key))}):null]}),reminders??null]}),
|
|
148
|
+
/* @__PURE__ */jsxRuntime.jsxs("aside",{className:"sub__aside","aria-label":copy.deliveryPaymentRegion,children:[view.phase==="loading"?/* @__PURE__ */jsxRuntime.jsxs("section",{className:"card","aria-busy":"true",children:[
|
|
149
|
+
/* @__PURE__ */jsxRuntime.jsx("h2",{className:"card__title",children:copy.nextPackage}),
|
|
150
|
+
/* @__PURE__ */jsxRuntime.jsx(Ghost,{})]}):null,view.phase==="ready"&&view.value.next?/* @__PURE__ */jsxRuntime.jsxs("section",{className:"card","aria-labelledby":`${id}next`,children:[
|
|
151
|
+
/* @__PURE__ */jsxRuntime.jsx("h2",{className:"card__title",id:`${id}next`,children:copy.nextPackage}),
|
|
152
|
+
/* @__PURE__ */jsxRuntime.jsx("dl",{className:"sum",children:view.value.next.sum.map(r=>/* @__PURE__ */jsxRuntime.jsxs("div",{children:[
|
|
153
|
+
/* @__PURE__ */jsxRuntime.jsx("dt",{children:r.k}),
|
|
154
|
+
/* @__PURE__ */jsxRuntime.jsx("dd",{children:r.v})]},r.k))}),view.value.next.link?/* @__PURE__ */jsxRuntime.jsx(ShopLink,{className:"card__link",to:view.value.next.link.to,children:view.value.next.link.label}):null]}):null,view.phase==="ready"&&view.value.delivery.length>0?/* @__PURE__ */jsxRuntime.jsxs("section",{className:"card","aria-labelledby":`${id}ship`,children:[
|
|
155
|
+
/* @__PURE__ */jsxRuntime.jsx("h2",{className:"card__title",id:`${id}ship`,children:copy.deliveryAndPayment}),
|
|
156
|
+
/* @__PURE__ */jsxRuntime.jsx("ul",{className:"rows",children:view.value.delivery.map(r=>/* @__PURE__ */jsxRuntime.jsxs("li",{children:[
|
|
157
|
+
/* @__PURE__ */jsxRuntime.jsxs("div",{children:[
|
|
158
|
+
/* @__PURE__ */jsxRuntime.jsx("p",{className:"rows__k",children:r.k}),
|
|
159
|
+
/* @__PURE__ */jsxRuntime.jsx("p",{className:"rows__v",children:r.v}),r.alert?/* @__PURE__ */jsxRuntime.jsx("p",{className:"rows__meta",role:"alert",style:ALERT_STYLE,children:r.alert}):null]}),r.change?/* @__PURE__ */jsxRuntime.jsx(ShopLink,{className:"card__link",to:r.change.to,children:r.change.label}):null]},r.k))})]}):null,view.phase==="ready"&&view.value.breakCard?/* @__PURE__ */jsxRuntime.jsx(BreakCard,{copy:copy,card:view.value.breakCard}):null]})]}):null,
|
|
160
|
+
/* @__PURE__ */jsxRuntime.jsx(Legal,{line:view.phase==="ready"?view.value.legal:copy.legal})]})}function ProductScreen({copy:copy,view:view}){let id=react.useId(),back=/* @__PURE__ */jsxRuntime.jsx("div",{className:"page-head page-head--sub",children:/* @__PURE__ */jsxRuntime.jsxs(ShopLink,{className:"back",to:{name:"shop"},children:[
|
|
161
|
+
/* @__PURE__ */jsxRuntime.jsx(Icon,{name:"arrow-left"}),copy.backToShop]})});if(view.phase!=="ready")/* @__PURE__ */
|
|
162
|
+
return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[back,view.phase==="failed"?/* @__PURE__ */jsxRuntime.jsx(LoadFailed,{copy:copy,thing:copy.thingProduct,retry:view.retry}):/* @__PURE__ */jsxRuntime.jsxs("div",{className:"prod-page","aria-busy":"true",children:[
|
|
163
|
+
/* @__PURE__ */jsxRuntime.jsx("span",{className:"prod__img","aria-hidden":"true"}),
|
|
164
|
+
/* @__PURE__ */jsxRuntime.jsx("div",{className:"buy",children:/* @__PURE__ */jsxRuntime.jsx(Ghost,{})})]}),
|
|
165
|
+
/* @__PURE__ */jsxRuntime.jsx(Legal,{line:copy.legal})]});let v=view.value,submit=e=>{e.preventDefault(),v.submit.disabled||v.submit.onPress()};/* @__PURE__ */
|
|
166
|
+
return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[
|
|
167
|
+
/* @__PURE__ */jsxRuntime.jsx("div",{className:"page-head page-head--sub",children:/* @__PURE__ */jsxRuntime.jsxs(ShopLink,{className:"back",to:v.back.to,children:[
|
|
168
|
+
/* @__PURE__ */jsxRuntime.jsx(Icon,{name:"arrow-left"}),v.back.label]})}),
|
|
169
|
+
/* @__PURE__ */jsxRuntime.jsxs("div",{className:"prod-page",children:[
|
|
170
|
+
/* @__PURE__ */jsxRuntime.jsx("span",{className:tileImgClass(v.tone),role:"img","aria-label":copy.photoToCome,children:/* @__PURE__ */jsxRuntime.jsx(Icon,{name:v.icon})}),
|
|
171
|
+
/* @__PURE__ */jsxRuntime.jsxs("form",{className:"buy",onSubmit:submit,children:[
|
|
172
|
+
/* @__PURE__ */jsxRuntime.jsxs("div",{children:[
|
|
173
|
+
/* @__PURE__ */jsxRuntime.jsx("h1",{className:"page-title",children:v.title}),v.sub?/* @__PURE__ */jsxRuntime.jsx("p",{className:"page-sub",children:v.sub}):null]}),v.price?/* @__PURE__ */jsxRuntime.jsxs("p",{className:"buy__price",children:[v.priceUnit?`${v.price} `:v.price,v.priceUnit?/* @__PURE__ */jsxRuntime.jsx("small",{children:v.priceUnit}):null]}):null,v.stockLine?/* @__PURE__ */jsxRuntime.jsx("p",{className:"note",children:v.stockLine}):null,v.source?/* @__PURE__ */jsxRuntime.jsxs("p",{className:"source",children:[
|
|
174
|
+
/* @__PURE__ */jsxRuntime.jsx(Icon,{name:"check"}),
|
|
175
|
+
/* @__PURE__ */jsxRuntime.jsxs("span",{children:[
|
|
176
|
+
/* @__PURE__ */jsxRuntime.jsx("b",{children:v.source.bold}),v.source.link?` ${v.source.rest} `:` ${v.source.rest}`,v.source.link?/* @__PURE__ */jsxRuntime.jsx("a",{href:v.source.link.href,children:v.source.link.label}):null]})]}):null,v.choices?/* @__PURE__ */jsxRuntime.jsxs("fieldset",{className:"choices",children:[
|
|
177
|
+
/* @__PURE__ */jsxRuntime.jsx("legend",{className:"visually-hidden",children:copy.howOften}),v.choices.map(c=>/* @__PURE__ */jsxRuntime.jsxs("label",{className:"choice",children:[
|
|
178
|
+
/* @__PURE__ */jsxRuntime.jsx("input",{type:"radio",name:`${id}often`,value:c.value,checked:v.choice===c.value,onChange:()=>v.onChoice(c.value)}),
|
|
179
|
+
/* @__PURE__ */jsxRuntime.jsxs("span",{children:[
|
|
180
|
+
/* @__PURE__ */jsxRuntime.jsx("span",{className:"choice__title",children:c.title}),c.meta?/* @__PURE__ */jsxRuntime.jsx("span",{className:"choice__meta",children:c.meta}):null]})]},c.value))]}):null,
|
|
181
|
+
/* @__PURE__ */jsxRuntime.jsxs("div",{className:"actions",children:[v.quantity!==null?/* @__PURE__ */jsxRuntime.jsxs("span",{className:"qty",children:[
|
|
182
|
+
/* @__PURE__ */jsxRuntime.jsx("button",{className:"icon-btn",type:"button","aria-label":copy.oneFewer,onClick:()=>v.onQuantity(Math.max(1,v.quantity-1)),children:/* @__PURE__ */jsxRuntime.jsx(Icon,{name:"minus"})}),
|
|
183
|
+
/* @__PURE__ */jsxRuntime.jsx("output",{"aria-label":copy.quantity,children:v.quantity}),
|
|
184
|
+
/* @__PURE__ */jsxRuntime.jsx("button",{className:"icon-btn",type:"button","aria-label":copy.oneMore,onClick:()=>v.onQuantity(Math.min(99,v.quantity+1)),children:/* @__PURE__ */jsxRuntime.jsx(Icon,{name:"plus"})})]}):null,
|
|
185
|
+
/* @__PURE__ */jsxRuntime.jsx(ActionButton,{action:v.submit,className:"btn btn--ink",type:"submit"})]}),
|
|
186
|
+
/* @__PURE__ */jsxRuntime.jsx(InlineError,{line:v.error})]})]}),v.facts||v.cards.length>0||v.aside?/* @__PURE__ */jsxRuntime.jsxs("div",{className:"sub more",children:[
|
|
187
|
+
/* @__PURE__ */jsxRuntime.jsxs("div",{className:"sub__main",children:[v.facts?/* @__PURE__ */jsxRuntime.jsxs("section",{className:"card","aria-labelledby":`${id}how`,children:[
|
|
188
|
+
/* @__PURE__ */jsxRuntime.jsx("h2",{className:"card__title",id:`${id}how`,children:v.facts.title}),
|
|
189
|
+
/* @__PURE__ */jsxRuntime.jsx("ul",{className:"facts",children:v.facts.rows.map(r=>/* @__PURE__ */jsxRuntime.jsxs("li",{children:[
|
|
190
|
+
/* @__PURE__ */jsxRuntime.jsx("span",{className:"facts__k",children:r.k}),
|
|
191
|
+
/* @__PURE__ */jsxRuntime.jsxs("b",{children:[r.n," ",
|
|
192
|
+
/* @__PURE__ */jsxRuntime.jsx("small",{children:r.unit})]})]},r.k))}),v.facts.note?/* @__PURE__ */jsxRuntime.jsx("p",{className:"note lasts",children:v.facts.note}):null]}):null,v.cards.map(c=>/* @__PURE__ */jsxRuntime.jsxs("section",{className:"card","aria-labelledby":`${id}${c.key}`,children:[
|
|
193
|
+
/* @__PURE__ */jsxRuntime.jsx("h2",{className:"card__title",id:`${id}${c.key}`,children:c.title}),
|
|
194
|
+
/* @__PURE__ */jsxRuntime.jsx("p",{className:"card__lead",children:c.lead})]},c.key))]}),v.aside?/* @__PURE__ */jsxRuntime.jsx(Aside,{id:`${id}ask`,aside:v.aside,label:copy.questionsRegion}):null]}):null,
|
|
195
|
+
/* @__PURE__ */jsxRuntime.jsx(Legal,{line:v.legal})]})}function RxProductScreen({copy:copy,view:view,avatarSrc:avatarSrc}){let id=react.useId();if(view.phase!=="ready")/* @__PURE__ */
|
|
196
|
+
return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[
|
|
197
|
+
/* @__PURE__ */jsxRuntime.jsx("div",{className:"page-head page-head--sub",children:/* @__PURE__ */jsxRuntime.jsxs(ShopLink,{className:"back",to:{name:"shop"},children:[
|
|
198
|
+
/* @__PURE__ */jsxRuntime.jsx(Icon,{name:"arrow-left"}),copy.backToShop]})}),view.phase==="failed"?/* @__PURE__ */jsxRuntime.jsx(LoadFailed,{copy:copy,thing:copy.thingProduct,retry:view.retry}):/* @__PURE__ */jsxRuntime.jsxs("div",{className:"prod-page","aria-busy":"true",children:[
|
|
199
|
+
/* @__PURE__ */jsxRuntime.jsx("span",{className:"prod__img prod__img--pink","aria-hidden":"true"}),
|
|
200
|
+
/* @__PURE__ */jsxRuntime.jsx("div",{className:"buy",children:/* @__PURE__ */jsxRuntime.jsx(Ghost,{})})]}),
|
|
201
|
+
/* @__PURE__ */jsxRuntime.jsx(Legal,{line:copy.legal})]});let v=view.value,submit=v.submit,onSubmit=e=>{e.preventDefault(),submit&&"onPress"in submit&&!submit.disabled&&submit.onPress()};/* @__PURE__ */
|
|
202
|
+
return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[
|
|
203
|
+
/* @__PURE__ */jsxRuntime.jsx("div",{className:"page-head page-head--sub",children:/* @__PURE__ */jsxRuntime.jsxs(ShopLink,{className:"back",to:v.back.to,children:[
|
|
204
|
+
/* @__PURE__ */jsxRuntime.jsx(Icon,{name:"arrow-left"}),v.back.label]})}),
|
|
205
|
+
/* @__PURE__ */jsxRuntime.jsxs("div",{className:"prod-page",children:[
|
|
206
|
+
/* @__PURE__ */jsxRuntime.jsx("span",{className:tileImgClass(v.tone),role:"img","aria-label":copy.photoToCome,children:/* @__PURE__ */jsxRuntime.jsx(Icon,{name:v.icon})}),
|
|
207
|
+
/* @__PURE__ */jsxRuntime.jsxs("form",{className:"buy",onSubmit:onSubmit,children:[
|
|
208
|
+
/* @__PURE__ */jsxRuntime.jsxs("div",{children:[
|
|
209
|
+
/* @__PURE__ */jsxRuntime.jsx("p",{className:"step-label",children:v.stepLabel}),
|
|
210
|
+
/* @__PURE__ */jsxRuntime.jsx("h1",{className:"page-title",children:v.title}),v.sub?/* @__PURE__ */jsxRuntime.jsx("p",{className:"page-sub",children:v.sub}):null]}),v.price?/* @__PURE__ */jsxRuntime.jsxs("p",{className:"buy__price",children:[v.priceUnit?`${v.price} `:v.price,v.priceUnit?/* @__PURE__ */jsxRuntime.jsx("small",{children:v.priceUnit}):null]}):null,v.stockLine?/* @__PURE__ */jsxRuntime.jsx("p",{className:"note",children:v.stockLine}):null,v.script?/* @__PURE__ */jsxRuntime.jsxs("div",{className:"script",children:[
|
|
211
|
+
/* @__PURE__ */jsxRuntime.jsxs("div",{className:"person",children:[avatarSrc?/* @__PURE__ */jsxRuntime.jsx("img",{className:"av av--sm",src:avatarSrc,alt:"",width:36,height:36}):null,
|
|
212
|
+
/* @__PURE__ */jsxRuntime.jsxs("div",{children:[
|
|
213
|
+
/* @__PURE__ */jsxRuntime.jsx("p",{className:"person__name",children:v.script.name}),v.script.meta?/* @__PURE__ */jsxRuntime.jsx("p",{className:"person__meta",children:v.script.meta}):null]})]}),v.script.directions?/* @__PURE__ */jsxRuntime.jsxs("p",{className:"source",children:[
|
|
214
|
+
/* @__PURE__ */jsxRuntime.jsx(Icon,{name:"file"}),
|
|
215
|
+
/* @__PURE__ */jsxRuntime.jsx("span",{children:v.script.directions})]}):null]}):null,submit?"href"in submit?/* @__PURE__ */jsxRuntime.jsx("a",{className:"btn btn--ink",href:submit.href,children:submit.label}):/* @__PURE__ */jsxRuntime.jsx(ActionButton,{action:submit,className:"btn btn--ink",type:"submit"}):null,
|
|
216
|
+
/* @__PURE__ */jsxRuntime.jsx(InlineError,{line:v.error}),typeof v.note=="string"?/* @__PURE__ */jsxRuntime.jsx("p",{className:"note",children:v.note}):null,v.note&&typeof v.note!="string"?/* @__PURE__ */jsxRuntime.jsxs("p",{className:"note",children:[`${v.note.before} `
|
|
217
|
+
/* @__PURE__ */,jsxRuntime.jsx("a",{className:"card__link",href:v.note.link.href,children:v.note.link.label}),v.note.after]}):null]})]}),v.cards.length>0||v.aside?/* @__PURE__ */jsxRuntime.jsxs("div",{className:"sub more",children:[
|
|
218
|
+
/* @__PURE__ */jsxRuntime.jsx("div",{className:"sub__main",children:v.cards.map(c=>/* @__PURE__ */jsxRuntime.jsxs("section",{className:"card","aria-labelledby":`${id}${c.key}`,children:[
|
|
219
|
+
/* @__PURE__ */jsxRuntime.jsx("h2",{className:"card__title",id:`${id}${c.key}`,children:c.title}),
|
|
220
|
+
/* @__PURE__ */jsxRuntime.jsx("p",{className:"card__lead",children:c.lead}),c.note?/* @__PURE__ */jsxRuntime.jsx("p",{className:"note",children:c.note}):null]},c.key))}),v.aside?/* @__PURE__ */jsxRuntime.jsx(Aside,{id:`${id}ask`,aside:v.aside,label:copy.questionsRegion}):null]}):null,
|
|
221
|
+
/* @__PURE__ */jsxRuntime.jsx(Legal,{line:v.legal})]})}function Tile({tile:tile}){/* @__PURE__ */
|
|
222
|
+
return jsxRuntime.jsx("li",{children:/* @__PURE__ */jsxRuntime.jsxs(ShopLink,{className:"prod",to:tile.to,children:[
|
|
223
|
+
/* @__PURE__ */jsxRuntime.jsx("span",{className:tileImgClass(tile.tone),"aria-hidden":"true",children:/* @__PURE__ */jsxRuntime.jsx(Icon,{name:tile.icon})}),tile.pills.length>0?/* @__PURE__ */jsxRuntime.jsx("span",{className:"prod__tags",children:tile.pills.map(p=>/* @__PURE__ */jsxRuntime.jsx(Pill,{pill:p},p.label))}):null,
|
|
224
|
+
/* @__PURE__ */jsxRuntime.jsxs("span",{className:"prod__body",children:[
|
|
225
|
+
/* @__PURE__ */jsxRuntime.jsx("span",{className:"prod__name",children:tile.name}),tile.meta?/* @__PURE__ */jsxRuntime.jsx("span",{className:"prod__meta",children:tile.meta}):null,tile.price?/* @__PURE__ */jsxRuntime.jsx("span",{className:"prod__price",children:tile.price}):null]})]})})}function GhostTiles({n:n}){/* @__PURE__ */
|
|
226
|
+
return jsxRuntime.jsx("ul",{className:"prods","aria-hidden":"true",children:Array.from({length:n},(_,i)=>/* @__PURE__ */jsxRuntime.jsx("li",{children:/* @__PURE__ */jsxRuntime.jsxs("span",{className:"prod",children:[
|
|
227
|
+
/* @__PURE__ */jsxRuntime.jsx("span",{className:"prod__img"}),
|
|
228
|
+
/* @__PURE__ */jsxRuntime.jsx("span",{className:"prod__body",children:/* @__PURE__ */jsxRuntime.jsxs("span",{className:"ghost",children:[
|
|
229
|
+
/* @__PURE__ */jsxRuntime.jsx("span",{}),
|
|
230
|
+
/* @__PURE__ */jsxRuntime.jsx("span",{})]})})]})},i))})}function ShopScreen({copy:copy,tabs:tabs,view:view}){let id=react.useId(),shelves=view.shelves;/* @__PURE__ */
|
|
231
|
+
return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[
|
|
232
|
+
/* @__PURE__ */jsxRuntime.jsxs("div",{className:"page-head page-head--sub",children:[
|
|
233
|
+
/* @__PURE__ */jsxRuntime.jsx("h1",{className:"page-title",children:copy.shopTitle}),view.sub?/* @__PURE__ */jsxRuntime.jsx("p",{className:"page-sub",children:view.sub}):null,
|
|
234
|
+
/* @__PURE__ */jsxRuntime.jsx(CareTabs,{copy:copy,current:"shop",tabs:tabs})]}),
|
|
235
|
+
/* @__PURE__ */jsxRuntime.jsxs("div",{className:"shop-bar",children:[
|
|
236
|
+
/* @__PURE__ */jsxRuntime.jsxs("label",{className:"input",children:[
|
|
237
|
+
/* @__PURE__ */jsxRuntime.jsx(Icon,{name:"search"}),
|
|
238
|
+
/* @__PURE__ */jsxRuntime.jsx("input",{type:"search",name:"q","aria-label":copy.searchLabel,placeholder:copy.searchPlaceholder,autoComplete:"off",value:view.query,onChange:e=>view.onQuery(e.target.value)})]}),view.filters.length>0?/* @__PURE__ */jsxRuntime.jsx(Scroller,{className:"scroller--bleed",trackClassName:"tabs filters",label:copy.filtersLabel,children:view.filters.map(f=>/* @__PURE__ */jsxRuntime.jsx("li",{children:f.to?/* @__PURE__ */jsxRuntime.jsx(ShopLink,{to:f.to,...f.current?{ariaCurrent:"page"}:{},children:f.label}):/* @__PURE__ */jsxRuntime.jsx("a",{href:"#","aria-current":f.current?"page":void 0,onClick:e=>e.preventDefault(),children:f.label})},f.label))}):null]}),shelves.phase==="failed"?/* @__PURE__ */jsxRuntime.jsx(LoadFailed,{copy:copy,thing:copy.thingShop,retry:shelves.retry}):null,shelves.phase==="loading"?/* @__PURE__ */jsxRuntime.jsx("section",{className:"shelf","aria-busy":"true",children:/* @__PURE__ */jsxRuntime.jsx(GhostTiles,{n:6})}):null,shelves.phase==="ready"?shelves.value.filter(s=>s.tiles.length>0).map(s=>/* @__PURE__ */jsxRuntime.jsxs("section",{className:"shelf","aria-labelledby":`${id}${s.key}`,children:[
|
|
239
|
+
/* @__PURE__ */jsxRuntime.jsxs("div",{className:"card__head",children:[
|
|
240
|
+
/* @__PURE__ */jsxRuntime.jsx("h2",{className:"card__title",id:`${id}${s.key}`,children:s.title}),s.link?/* @__PURE__ */jsxRuntime.jsx(ShopLink,{className:"card__link",to:s.link.to,children:s.link.label}):null]}),
|
|
241
|
+
/* @__PURE__ */jsxRuntime.jsx("ul",{className:"prods",children:s.tiles.map(t=>/* @__PURE__ */jsxRuntime.jsx(Tile,{tile:t},t.key))})]},s.key)):null,shelves.phase==="ready"&&view.empty?/* @__PURE__ */jsxRuntime.jsx("section",{className:"shelf",role:"status",children:/* @__PURE__ */jsxRuntime.jsx("p",{className:"card__lead",children:view.empty})}):null,
|
|
242
|
+
/* @__PURE__ */jsxRuntime.jsx(Legal,{line:view.legal})]})}function TrackingScreen({copy:copy,view:view}){let id=react.useId();if(view.phase!=="ready")/* @__PURE__ */
|
|
243
|
+
return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[
|
|
244
|
+
/* @__PURE__ */jsxRuntime.jsxs("div",{className:"page-head page-head--sub",children:[
|
|
245
|
+
/* @__PURE__ */jsxRuntime.jsxs(ShopLink,{className:"back",to:{name:"orders"},children:[
|
|
246
|
+
/* @__PURE__ */jsxRuntime.jsx(Icon,{name:"arrow-left"}),copy.backToCare]}),view.phase==="loading"?/* @__PURE__ */jsxRuntime.jsx(Ghost,{rows:2}):null]}),view.phase==="failed"?/* @__PURE__ */jsxRuntime.jsx(LoadFailed,{copy:copy,thing:copy.thingOrder,retry:view.retry}):/* @__PURE__ */jsxRuntime.jsx("div",{className:"sub",children:/* @__PURE__ */jsxRuntime.jsx("div",{className:"sub__main",children:/* @__PURE__ */jsxRuntime.jsxs("section",{className:"card","aria-busy":"true",children:[
|
|
247
|
+
/* @__PURE__ */jsxRuntime.jsx("h2",{className:"card__title",children:copy.whereItStands}),
|
|
248
|
+
/* @__PURE__ */jsxRuntime.jsx(Ghost,{})]})})}),
|
|
249
|
+
/* @__PURE__ */jsxRuntime.jsx(Legal,{line:copy.legalTracking})]});let v=view.value;/* @__PURE__ */
|
|
250
|
+
return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[
|
|
251
|
+
/* @__PURE__ */jsxRuntime.jsxs("div",{className:"page-head page-head--sub",children:[
|
|
252
|
+
/* @__PURE__ */jsxRuntime.jsxs(ShopLink,{className:"back",to:v.back.to,children:[
|
|
253
|
+
/* @__PURE__ */jsxRuntime.jsx(Icon,{name:"arrow-left"}),v.back.label]}),
|
|
254
|
+
/* @__PURE__ */jsxRuntime.jsx("h1",{className:"page-title",children:v.title}),v.sub?/* @__PURE__ */jsxRuntime.jsx("p",{className:"page-sub",children:v.sub}):null]}),
|
|
255
|
+
/* @__PURE__ */jsxRuntime.jsxs("div",{className:"sub",children:[
|
|
256
|
+
/* @__PURE__ */jsxRuntime.jsx("div",{className:"sub__main",children:/* @__PURE__ */jsxRuntime.jsxs("section",{className:"card","aria-labelledby":`${id}st`,children:[
|
|
257
|
+
/* @__PURE__ */jsxRuntime.jsx("h2",{className:"card__title",id:`${id}st`,children:copy.whereItStands}),v.tracker.kind==="ended"?/* @__PURE__ */jsxRuntime.jsx("p",{className:"card__lead",children:v.tracker.line}):/* @__PURE__ */jsxRuntime.jsx("ol",{className:"tracker",children:v.tracker.steps.map(s=>/* @__PURE__ */jsxRuntime.jsxs("li",{className:s.state==="done"?"is-done":s.state==="now"?"is-now":void 0,children:[
|
|
258
|
+
/* @__PURE__ */jsxRuntime.jsx("span",{className:"tracker__dot","aria-hidden":"true",children:s.state==="done"?/* @__PURE__ */jsxRuntime.jsx(Icon,{name:"check"}):null}),
|
|
259
|
+
/* @__PURE__ */jsxRuntime.jsxs("div",{children:[
|
|
260
|
+
/* @__PURE__ */jsxRuntime.jsxs("p",{className:"tracker__title",children:[s.title,s.state==="now"?/* @__PURE__ */jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" ",
|
|
261
|
+
/* @__PURE__ */jsxRuntime.jsx("span",{className:"pill pill--stable",children:copy.now})]}):null]}),s.when?/* @__PURE__ */jsxRuntime.jsx("p",{className:"tracker__when",children:s.when}):null,s.text?/* @__PURE__ */jsxRuntime.jsx("p",{className:"tracker__text",children:s.text}):null]})]},s.key))}),v.track?/* @__PURE__ */jsxRuntime.jsx("p",{className:"note",children:/* @__PURE__ */jsxRuntime.jsx("a",{className:"card__link",href:v.track.href,target:"_blank",rel:"noopener noreferrer",children:v.track.label})}):null]})}),
|
|
262
|
+
/* @__PURE__ */jsxRuntime.jsxs("aside",{className:"sub__aside","aria-label":copy.packageDetailsRegion,children:[
|
|
263
|
+
/* @__PURE__ */jsxRuntime.jsxs("section",{className:"card","aria-labelledby":`${id}box`,children:[
|
|
264
|
+
/* @__PURE__ */jsxRuntime.jsx("h2",{className:"card__title",id:`${id}box`,children:copy.inTheBox}),
|
|
265
|
+
/* @__PURE__ */jsxRuntime.jsx("ul",{className:"items",children:v.items.map(it=>/* @__PURE__ */jsxRuntime.jsxs("li",{children:[
|
|
266
|
+
/* @__PURE__ */jsxRuntime.jsx(Thumb,{tone:it.tone,icon:it.icon}),
|
|
267
|
+
/* @__PURE__ */jsxRuntime.jsxs("div",{children:[
|
|
268
|
+
/* @__PURE__ */jsxRuntime.jsxs("p",{className:"items__name",children:[it.name,it.rx?/* @__PURE__ */jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" ",
|
|
269
|
+
/* @__PURE__ */jsxRuntime.jsx(RxPill,{copy:copy})]}):null]}),it.meta?/* @__PURE__ */jsxRuntime.jsx("p",{className:"items__meta",children:it.meta}):null]}),it.pill?/* @__PURE__ */jsxRuntime.jsx("div",{className:"items__end",children:/* @__PURE__ */jsxRuntime.jsx(Pill,{pill:it.pill})}):null]},it.key))})]}),
|
|
270
|
+
/* @__PURE__ */jsxRuntime.jsxs("section",{className:"card","aria-labelledby":`${id}pay`,children:[
|
|
271
|
+
/* @__PURE__ */jsxRuntime.jsx("h2",{className:"card__title",id:`${id}pay`,children:copy.payment}),
|
|
272
|
+
/* @__PURE__ */jsxRuntime.jsx("dl",{className:"sum sum--total",children:v.sum.map(r=>/* @__PURE__ */jsxRuntime.jsxs("div",{children:[
|
|
273
|
+
/* @__PURE__ */jsxRuntime.jsx("dt",{children:r.k}),
|
|
274
|
+
/* @__PURE__ */jsxRuntime.jsx("dd",{children:r.v})]},r.k))}),v.note?/* @__PURE__ */jsxRuntime.jsx("p",{className:"note",children:v.note}):null,v.actions.length>0?/* @__PURE__ */jsxRuntime.jsx("div",{className:"actions",children:v.actions.map(a=>/* @__PURE__ */jsxRuntime.jsx(ActionButton,{action:a,className:"btn btn--outline btn--sm"},a.label))}):null,
|
|
275
|
+
/* @__PURE__ */jsxRuntime.jsx(InlineError,{line:v.error})]}),
|
|
276
|
+
/* @__PURE__ */jsxRuntime.jsxs(ShopLink,{className:"row-link",to:v.allOrders.to,children:[
|
|
277
|
+
/* @__PURE__ */jsxRuntime.jsx(Icon,{name:"box"}),
|
|
278
|
+
/* @__PURE__ */jsxRuntime.jsx("span",{children:v.allOrders.label}),
|
|
279
|
+
/* @__PURE__ */jsxRuntime.jsx(Icon,{name:"chevron",className:"ico ico--chev"})]})]})]}),
|
|
280
|
+
/* @__PURE__ */jsxRuntime.jsx(Legal,{line:v.legal})]})}function LivePackage(){let{copy:copy}=useShop(),nav=useShopNav(),{tabs:tabs,view:view}=usePackageScreen(nav.go);/* @__PURE__ */
|
|
281
|
+
return jsxRuntime.jsx(PackageScreen,{copy:copy,tabs:tabs,view:view})}function LiveShop({initialQuery:initialQuery}){let{copy:copy}=useShop(),{tabs:tabs,view:view}=useShopScreen(initialQuery);/* @__PURE__ */
|
|
282
|
+
return jsxRuntime.jsx(ShopScreen,{copy:copy,tabs:tabs,view:view})}function LiveProduct({offerId:offerId,petId:petId,onRx:onRx}){let{copy:copy}=useShop(),nav=useShopNav(),state=useProductScreen(offerId,petId,nav.go),isRx=state.kind==="rx";return react.useEffect(()=>onRx?.(isRx),[isRx,onRx]),state.kind==="rx"?/* @__PURE__ */jsxRuntime.jsx(RxProductScreen,{copy:copy,view:state.view}):/* @__PURE__ */jsxRuntime.jsx(ProductScreen,{copy:copy,view:state.view})}function LivePlan(){let{copy:copy}=useShop(),{tabs:tabs,view:view}=usePlanScreen();/* @__PURE__ */
|
|
283
|
+
return jsxRuntime.jsx(PlanScreen,{copy:copy,tabs:tabs,view:view})}function LiveOrders(){let{copy:copy}=useShop(),{tabs:tabs,view:view}=useOrdersScreen();/* @__PURE__ */
|
|
284
|
+
return jsxRuntime.jsx(OrdersScreen,{copy:copy,tabs:tabs,view:view})}function LiveTracking({orderId:orderId}){let{copy:copy}=useShop(),{view:view}=useTrackingScreen(orderId);/* @__PURE__ */
|
|
285
|
+
return jsxRuntime.jsx(TrackingScreen,{copy:copy,view:view})}function LiveAddress({then:then}){let{copy:copy}=useShop(),nav=useShopNav();/* @__PURE__ */
|
|
286
|
+
return jsxRuntime.jsx(AddressFormScreen,{copy:copy,...useAddressStep(then,nav.go)})}function LiveCard({then:then,handoff:handoff}){let{copy:copy}=useShop(),nav=useShopNav();/* @__PURE__ */
|
|
287
|
+
return jsxRuntime.jsx(CardSetupScreen,{copy:copy,...useCardStep(then,nav.go,handoff)})}function LiveBuy({route:route}){let{copy:copy}=useShop(),nav=useShopNav();/* @__PURE__ */
|
|
288
|
+
return jsxRuntime.jsx(BuyConfirmScreen,{copy:copy,...useBuyStep(route,nav.go)})}function LiveConsent({route:route}){let{copy:copy}=useShop(),nav=useShopNav();/* @__PURE__ */
|
|
289
|
+
return jsxRuntime.jsx(PlanConsentScreen,{copy:copy,...useConsentStep(route,nav.go)})}var sheet=null;function kitSheet(){if(sheet)return sheet;try{if(typeof CSSStyleSheet!="function"||typeof CSSStyleSheet.prototype.replaceSync!="function")return null;let s=new CSSStyleSheet;return s.replaceSync(SHOP_KIT_CSS),sheet=s,s}catch{return null}}function ShopRoot({pageClass:pageClass,children:children,hostClassName:hostClassName}){let host=react.useRef(null),[mount,setMount]=react.useState(null);return react.useLayoutEffect(()=>{let el=host.current;if(!el)return;let root=el.shadowRoot??el.attachShadow({mode:"open"}),adopted=kitSheet();if(adopted&&"adoptedStyleSheets"in root)root.adoptedStyleSheets=[adopted];else if(!root.querySelector("style[data-everfur-shop]")){let style=document.createElement("style");style.setAttribute("data-everfur-shop",""),style.textContent=SHOP_KIT_CSS,root.appendChild(style)}let div=root.querySelector("div[data-everfur-shop-root]");div||(div=document.createElement("div"),div.setAttribute("data-everfur-shop-root",""),root.appendChild(div)),setMount(div)},[]),/* @__PURE__ */jsxRuntime.jsx("div",{ref:host,className:hostClassName,"data-everfur-shop":"",children:mount?reactDom.createPortal(/* @__PURE__ */jsxRuntime.jsx("div",{className:pageClass,children:children}),mount):null})}var PAGE_CLASS={package:"page page--care",shop:"page page--care-shop",product:"page page--care-product",plan:"page page--care-plan",orders:"page page--care-orders",order:"page page--care-tracking",address:"page page--care-product",card:"page page--care-product",buy:"page page--care-product",consent:"page page--care-product"};function EverfurShop(props){let{client:client,pets:pets,payments:payments,packageSource:packageSource,copy:copy,...rest}=props;/* @__PURE__ */
|
|
290
|
+
return jsxRuntime.jsx(ShopProvider,{client:client,...pets?{pets:pets}:{},...payments!==void 0?{payments:payments}:{},...packageSource?{packageSource:packageSource}:{},...copy?{copy:copy}:{},children:/* @__PURE__ */jsxRuntime.jsx(ShopGate,{...rest})})}function ShopGate({route:route,onRouteChange:onRouteChange,hrefFor:hrefFor,bookVisitHref:bookVisitHref,cardHandoff:cardHandoff,cardReturn:cardReturn,onUnavailable:onUnavailable,hostClassName:hostClassName}){let{copy:copy}=useShop(),config=useShopConfig(),nav=react.useMemo(()=>({href:hrefFor,go:onRouteChange}),[hrefFor,onRouteChange]),unavailable=config.phase==="unavailable"||config.error?.kind==="signedOut";if(react.useEffect(()=>{unavailable&&onUnavailable?.()},[unavailable,onUnavailable]),config.phase==="loading"||unavailable)return null;let host=hostClassName?{hostClassName:hostClassName}:{};return config.phase==="failed"||!config.value?/* @__PURE__ */jsxRuntime.jsx(ShopNavProvider,{value:nav,children:/* @__PURE__ */jsxRuntime.jsx(ShopRoot,{pageClass:PAGE_CLASS[route.name],...host,children:/* @__PURE__ */jsxRuntime.jsx(LoadFailed,{copy:copy,thing:copy.thingShop,retry:config.refresh})})}):/* @__PURE__ */jsxRuntime.jsx(ShopNavProvider,{value:nav,children:/* @__PURE__ */jsxRuntime.jsx(ShopPages,{route:route,config:config.value,bookVisitHref:bookVisitHref??null,cardHandoff:cardHandoff??null,cardReturn:cardReturn??null,host:host})})}function ShopPages({route:route,config:config,bookVisitHref:bookVisitHref,cardHandoff:cardHandoff,cardReturn:cardReturn,host:host}){let{client:client,copy:copy}=useShop(),pkg=usePackage(),packageShown=pkg.phase==="loading"||pkg.phase==="failed"||pkg.phase==="ready"&&pkg.value!==null,tabs=packageShown?["package","shop","orders","plan"]:["shop","orders","plan"],shown=route.name==="package"&&!packageShown?{name:"shop"}:route,[rxPage,setRxPage]=react.useState(false);react.useEffect(()=>setRxPage(false),[shown.name]);let shared=react.useMemo(()=>({config:config,tabs:tabs,pkg:pkg,bookVisitHref:bookVisitHref}),[config,tabs,pkg,bookVisitHref]),returns=react.useRef(0);takeCardReturn(client,cardReturn,shown,copy)&&(returns.current+=1);let pageClass=shown.name==="product"&&rxPage?"page page--care-product-rx":PAGE_CLASS[shown.name];/* @__PURE__ */
|
|
291
|
+
return jsxRuntime.jsx(ShopSharedProvider,{value:shared,children:/* @__PURE__ */jsxRuntime.jsx(ShopRoot,{pageClass:pageClass,...host,children:page(shown,setRxPage,cardHandoff,returns.current)})})}function page(route,onRx,cardHandoff,returned){switch(route.name){case"package":/* @__PURE__ */
|
|
292
|
+
return jsxRuntime.jsx(LivePackage,{});case"shop":/* @__PURE__ */
|
|
293
|
+
return jsxRuntime.jsx(LiveShop,{...route.query?{initialQuery:route.query}:{}});case"product":/* @__PURE__ */
|
|
294
|
+
return jsxRuntime.jsx(LiveProduct,{offerId:route.offerId,...route.petId?{petId:route.petId}:{},onRx:onRx},route.offerId);case"plan":/* @__PURE__ */
|
|
295
|
+
return jsxRuntime.jsx(LivePlan,{});case"orders":/* @__PURE__ */
|
|
296
|
+
return jsxRuntime.jsx(LiveOrders,{});case"order":/* @__PURE__ */
|
|
297
|
+
return jsxRuntime.jsx(LiveTracking,{orderId:route.orderId},`${route.orderId}:${returned}`);case"address":/* @__PURE__ */
|
|
298
|
+
return jsxRuntime.jsx(LiveAddress,{...route.then?{then:route.then}:{}});case"card":/* @__PURE__ */
|
|
299
|
+
return jsxRuntime.jsx(LiveCard,{handoff:cardHandoff,...route.then?{then:route.then}:{}},returned);case"buy":/* @__PURE__ */
|
|
300
|
+
return jsxRuntime.jsx(LiveBuy,{route:route});case"consent":/* @__PURE__ */
|
|
301
|
+
return jsxRuntime.jsx(LiveConsent,{route:route})}}var OmsWireError=class _OmsWireError extends Error{constructor(field){super(`OMS answer could not be read: ${field}`);this.field=field;this.name="OmsWireError",Object.setPrototypeOf(this,_OmsWireError.prototype)}};function obj(value,field){if(value===null||typeof value!="object"||Array.isArray(value))throw new OmsWireError(field);return value}function arr(value,field){if(value==null)return[];if(!Array.isArray(value))throw new OmsWireError(field);return value}function str(o,key,field=key){let v=o[key];if(typeof v!="string"||v.length===0)throw new OmsWireError(field);return v}function optStr(o,key){let v=o[key];return typeof v=="string"&&v.length>0?v:null}function int(o,key,field=key){let v=o[key];if(typeof v!="number"||!Number.isFinite(v))throw new OmsWireError(field);return Math.trunc(v)}function optInt(o,key){let v=o[key];return typeof v=="number"&&Number.isFinite(v)?Math.trunc(v):null}function bool(o,key){return o[key]===true}function petIdOf(value){if(!value||typeof value!="object")return null;let id=value.pet_id;return typeof id=="string"&&id.length>0?id:null}var PACK_UNITS=["each","gram","milliliter"],SPEEDS=["ground","two_day","next_day"];function packUnit(o){let v=o.pack_unit;return typeof v=="string"&&PACK_UNITS.includes(v)?v:null}function speed(v){return typeof v=="string"&&SPEEDS.includes(v)?v:null}function httpsUrl(o,key){let v=optStr(o,key);if(!v)return null;try{return new URL(v).protocol==="https:"?v:null}catch{return null}}function shopConfigFromWire(raw){let o=obj(raw,"shop-config"),delivery=o.delivery&&typeof o.delivery=="object"?o.delivery:null,key=optStr(o,"stripe_publishable_key");return{recurringTermsVersion:optStr(o,"recurring_terms_version"),recurringTermsUrl:httpsUrl(o,"recurring_terms_url"),stripePublishableKey:key&&/^pk_(test|live)_[A-Za-z0-9]+$/.test(key)?key:null,delivery:delivery?{firstFill:speed(delivery.first_fill),refill:speed(delivery.refill)}:null}}function offerFromWire(raw){let o=obj(raw,"offer"),qty=o.pack_quantity;return{offerId:str(o,"offer_id"),sku:optStr(o,"sku")??"",title:str(o,"title"),fulfillmentType:optStr(o,"fulfillment_type")??"physical",requiresRx:bool(o,"requires_rx"),compounded:bool(o,"compounded"),packQuantity:typeof qty=="string"&&/^\d+(\.\d+)?$/.test(qty)?qty:null,packUnit:packUnit(o),price:optInt(o,"price")}}function offerPageFromWire(raw){let o=obj(raw,"offers");return{offers:arr(o.offers,"offers").map(offerFromWire),nextCursor:optStr(o,"next_cursor")}}function quoteFromWire(raw){let o=obj(raw,"quote");return{lines:arr(o.lines,"lines").map(l=>{let line=obj(l,"line");return{offerId:str(line,"offer_id"),quantity:int(line,"quantity"),petId:petIdOf(line.pet),unitPrice:int(line,"unit_price"),discount:optInt(line,"discount")??0,tax:optInt(line,"tax")??0}}),shipping:int(o,"shipping"),tax:optInt(o,"tax")??0,total:int(o,"total"),expiresAt:str(o,"expires_at")}}function checkoutFromWire(raw){let o=obj(raw,"checkout");return{checkoutId:str(o,"checkout_id"),state:optStr(o,"state")??"draft",orderIds:arr(o.order_ids,"order_ids").filter(id=>typeof id=="string"),createdAt:optStr(o,"created_at")??"",total:int(o,"total"),shipping:optInt(o,"shipping")??0,tax:optInt(o,"tax")??0}}function confirmationFromWire(raw){let o=obj(raw,"confirmation");return{checkoutId:str(o,"checkout_id"),resale:arr(o.resale,"resale").map(r=>{let entry=obj(r,"resale"),outcome=str(entry,"outcome");if(outcome!=="confirmed"&&outcome!=="action_required")throw new OmsWireError("resale.outcome");let payerAction=optStr(entry,"payer_action");if(outcome==="action_required"&&!payerAction)throw new OmsWireError("resale.payer_action");return{outcome:outcome,orderId:str(entry,"order_id"),payerAction:outcome==="confirmed"?null:payerAction}})}}function orderSummaryFromWire(raw){let o=obj(raw,"order"),ref=o.reference&&typeof o.reference=="object"?o.reference:null;return{orderId:str(o,"order_id"),referenceNumber:ref?optStr(ref,"number"):null,status:str(o,"status"),total:int(o,"total"),placedAt:optStr(o,"placed_at")}}function orderPageFromWire(raw){let o=obj(raw,"orders");return{orders:arr(o.orders,"orders").map(orderSummaryFromWire),nextCursor:optStr(o,"next_cursor")}}function orderLineFromWire(raw){let o=obj(raw,"line"),qty=o.pack_quantity;return{lineId:str(o,"line_id"),offerId:str(o,"offer_id"),sku:optStr(o,"sku")??"",title:str(o,"title"),requiresRx:bool(o,"requires_rx"),compounded:bool(o,"compounded"),packQuantity:typeof qty=="string"&&/^\d+(\.\d+)?$/.test(qty)?qty:null,packUnit:packUnit(o),quantity:int(o,"quantity"),unitPrice:int(o,"unit_price"),discount:optInt(o,"discount")??0,tax:optInt(o,"tax")??0,fulfillmentType:optStr(o,"fulfillment_type")??"physical",petId:petIdOf(o.pet)}}function trackingFromWire(raw){let o=obj(raw,"tracking");return{carrier:optStr(o,"carrier"),trackingNumber:optStr(o,"tracking_number"),status:str(o,"status"),occurredAt:optStr(o,"occurred_at"),trackingUrl:httpsUrl(o,"tracking_url"),deliveryBy:optStr(o,"delivery_by")}}function shipmentFromWire(raw){let o=obj(raw,"shipment");return{shipmentId:str(o,"shipment_id"),state:str(o,"state"),lines:arr(o.lines,"shipment.lines").map(l=>{let line=obj(l,"shipment.line");return{lineId:str(line,"line_id"),quantity:int(line,"quantity")}}),tracking:arr(o.tracking,"tracking").map(trackingFromWire)}}function orderFromWire(raw){let o=obj(raw,"order");return{summary:orderSummaryFromWire(o.summary),lines:arr(o.lines,"lines").map(orderLineFromWire),shipping:optInt(o,"shipping")??0,shippingTax:optInt(o,"shipping_tax")??0,shipments:arr(o.shipments,"shipments").map(shipmentFromWire),canCancel:bool(o,"can_cancel"),canReturn:bool(o,"can_return"),canPay:bool(o,"can_pay"),paymentStatus:optStr(o,"payment_status"),refunds:arr(o.refunds,"refunds").map(r=>{let refund=obj(r,"refund");return{refundId:str(refund,"refund_id"),amount:int(refund,"amount"),state:str(refund,"state")}}),returnIds:arr(o.return_ids,"return_ids").filter(id=>typeof id=="string")}}function cancelOutcomeFromWire(raw){let o=obj(raw,"cancel");return{outcome:str(o,"outcome"),refunded:optInt(o,"refunded"),reasonCode:optStr(o,"reason_code")}}function payOutcomeFromWire(raw){let o=obj(raw,"pay"),outcome=str(o,"outcome");if(outcome!=="authorized"&&outcome!=="action_required")throw new OmsWireError("pay.outcome");let payerAction=optStr(o,"payer_action");if(outcome==="action_required"&&!payerAction)throw new OmsWireError("pay.payer_action");return{outcome:outcome,orderId:str(o,"order_id"),payerAction:outcome==="authorized"?null:payerAction}}function returnFromWire(raw){let o=obj(raw,"return");return{returnId:str(o,"return_id"),orderId:str(o,"order_id"),lines:arr(o.lines,"return.lines").map(l=>{let line=obj(l,"return.line");return{lineId:str(line,"line_id"),quantity:int(line,"quantity"),reasonCode:str(line,"reason_code")}}),state:str(o,"state"),rma:optStr(o,"rma"),labelUrl:httpsUrl(o,"label_url")}}function caseFromWire(raw){let o=obj(raw,"case");return{caseId:str(o,"case_id"),orderId:str(o,"order_id"),reasonCode:str(o,"reason_code"),message:typeof o.message=="string"?o.message:"",openedAt:str(o,"opened_at"),closedAt:optStr(o,"closed_at")}}function casesFromWire(raw){return arr(obj(raw,"cases").cases,"cases").map(caseFromWire)}function prescriptionsFromWire(raw){return arr(obj(raw,"prescriptions").prescriptions,"prescriptions").map(r=>{let o=obj(r,"prescription");return{rxId:str(o,"rx_id"),petId:str(o,"pet_id"),drug:str(o,"drug"),strength:optStr(o,"strength"),form:optStr(o,"form"),status:str(o,"status"),offerId:optStr(o,"offer_id"),packCount:optInt(o,"pack_count"),fillsUsed:optInt(o,"fills_used"),fillsTotal:optInt(o,"fills_total"),expiresOn:optStr(o,"expires_on"),nextFillOn:optStr(o,"next_fill_on")}})}function addressEntryFromWire(raw){let o=obj(raw,"address");return{ref:str(o,"ref"),label:optStr(o,"label")??"",isDefault:bool(o,"is_default"),isComplete:bool(o,"is_complete")}}function addressesFromWire(raw){return arr(obj(raw,"addresses").addresses,"addresses").map(addressEntryFromWire)}function addressDetailFromWire(raw){let o=obj(raw,"address"),a=obj(o.address,"address.address"),address={recipientName:optStr(a,"recipient_name"),line1:str(a,"line1","address.line1"),line2:optStr(a,"line2"),city:str(a,"city","address.city"),region:str(a,"region","address.region"),postalCode:str(a,"postal_code","address.postal_code"),country:str(a,"country","address.country")};return{...addressEntryFromWire(o),address:address}}function paymentMethodsFromWire(raw){return arr(obj(raw,"payment_methods").payment_methods,"payment_methods").map(r=>{let o=obj(r,"payment_method");return{paymentMethodId:str(o,"payment_method_id"),brand:optStr(o,"brand")??"",last4:optStr(o,"last4")??"",wallet:optStr(o,"wallet")}})}function paymentSetupFromWire(raw){let o=obj(raw,"setup");return{setupId:str(o,"setup_id"),payerAction:str(o,"payer_action")}}function cardSetupLinkFromWire(raw){let o=obj(raw,"card_setup");return{url:str(o,"url")}}function cardActionLinkFromWire(raw){let o=obj(raw,"card_action");return{url:str(o,"url"),expiresAt:str(o,"expires_at")}}function planFromWire(raw){let o=obj(raw,"plan");return{planId:str(o,"plan_id"),lines:arr(o.lines,"plan.lines").map(l=>{let line=obj(l,"plan.line");return{offerId:str(line,"offer_id"),quantity:int(line,"quantity"),petId:petIdOf(line.pet)}}),cadenceDays:int(o,"cadence_days"),destination:optStr(o,"destination"),paymentMethodId:optStr(o,"payment_method_id"),discountBps:optInt(o,"discount_bps")??0,nextRun:optStr(o,"next_run"),state:str(o,"state"),stopReason:optStr(o,"stop_reason")}}function planPageFromWire(raw){let o=obj(raw,"plans");return{plans:arr(o.plans,"plans").map(planFromWire),nextCursor:optStr(o,"next_cursor")}}function cartLineToWire(line){let wire={offer_id:line.offerId,quantity:line.quantity};return line.petId&&(wire.pet={namespace:"consumer",pet_id:line.petId}),line.rxId&&(wire.rx_id=line.rxId),wire}function addressInputToWire(input){let a=input.address;return{label:input.label,make_default:input.makeDefault===true,address:{recipient_name:a.recipientName,line1:a.line1,line2:a.line2,city:a.city,region:a.region,postal_code:a.postalCode,country:a.country}}}function cycleReviewFromWire(raw){let o=obj(raw,"cycle");return{planId:str(o,"plan_id"),reviewId:optStr(o,"review_id"),cycle:int(o,"cycle"),state:optStr(o,"state"),lines:arr(o.lines,"cycle.lines").map(l=>{let line=obj(l,"cycle.line");return{offerId:str(line,"offer_id"),quantity:int(line,"quantity"),petId:petIdOf(line.pet)}}),shipsOn:optStr(o,"ships_on"),approveBy:optStr(o,"approve_by"),quoteLines:arr(o.quote&&typeof o.quote=="object"?o.quote.lines:null,"cycle.quote.lines").map(l=>{let line=obj(l,"cycle.quote.line");return{offerId:str(line,"offer_id"),quantity:int(line,"quantity"),petId:petIdOf(line.pet),unitPrice:int(line,"unit_price"),discount:optInt(line,"discount")??0,tax:optInt(line,"tax")??0}})}}function cycleDraftFromWire(raw){let o=obj(raw,"cycle-draft");return{checkoutId:str(o,"checkout_id"),shipping:optInt(o,"shipping")??0,tax:optInt(o,"tax")??0,total:int(o,"total"),expiresAt:optStr(o,"expires_at")}}var DEFAULT_PATH="/api/v1/oms",DEFAULT_TIMEOUT_MS=3e4,PAYMENT_METHOD_ID=/^[A-Za-z0-9_]+$/,REASON_CODE=/^[a-z][a-z0-9_]{0,63}$/;function checkBaseUrl(raw){let url;try{url=new URL(raw)}catch{throw new EverfurConfigError("invalid-argument","createOmsClient: baseUrl is not a URL")}let local=url.hostname==="localhost"||url.hostname==="127.0.0.1"||url.hostname==="[::1]";if(url.protocol!=="https:"&&!(local&&url.protocol==="http:"))throw new EverfurConfigError("invalid-argument","createOmsClient: baseUrl must be https");if(url.username||url.password||url.search||url.hash)throw new EverfurConfigError("invalid-argument","createOmsClient: baseUrl must be a bare origin or path");return url.origin+url.pathname.replace(/\/+$/,"")}function seg(id){return encodeURIComponent(id)}function isValidId(id){return typeof id=="string"&&id.length>0&&id.length<=256}function createOmsClient(config){let base=checkBaseUrl(config.baseUrl)+(config.path??DEFAULT_PATH).replace(/\/+$/,""),fetchImpl=config.fetch??(typeof globalThis.fetch=="function"?globalThis.fetch.bind(globalThis):void 0);if(!fetchImpl)throw new EverfurConfigError("missing-peer-dependency","createOmsClient: no fetch available; pass config.fetch");if(!config.auth||config.auth.kind!=="everfur_consumer"||typeof config.auth.getToken!="function")throw new EverfurConfigError("invalid-argument",'createOmsClient: auth must be { kind: "everfur_consumer", getToken }');let getToken=config.auth.getToken,channel=config.channel??"web",timeoutMs=config.timeoutMs??DEFAULT_TIMEOUT_MS;async function token(){try{let t=await getToken();return typeof t=="string"&&t.length>0?t:null}catch{return null}}async function send(call){let bearer=await token();if(!bearer)return omsErr({kind:"signedOut"});let url=base+call.path;if(call.query){let params=new URLSearchParams;for(let[k,v]of Object.entries(call.query))v!==void 0&¶ms.set(k,String(v));let qs=params.toString();qs&&(url+=`?${qs}`)}let headers={accept:"application/json",authorization:`Bearer ${bearer}`},init={method:call.method,headers:headers};call.body!==void 0&&(headers["content-type"]="application/json",init.body=JSON.stringify(call.body));let controller=typeof AbortController=="function"?new AbortController:null;controller&&(init.signal=controller.signal);let timedOut=false,timer=setTimeout(()=>{timedOut=true,controller?.abort()},timeoutMs),res;try{res=await fetchImpl(url,init)}catch{return clearTimeout(timer),omsErr({kind:timedOut?"timeout":"network"})}try{let requestId=res.headers.get("x-request-id")??void 0,rid=requestId?{requestId:requestId}:{};if(res.status<200||res.status>=300){let body=res.status===402||res.status===409||res.status===422?await res.json().catch(()=>null):null;return omsErr(omsErrorFromStatus(res.status,body,{...rid,retryAfter:res.headers.get("retry-after")}))}if(call.read===null||res.status===204)return omsOk(void 0);let raw;try{raw=await res.json()}catch{return omsErr({kind:"badResponse",...rid})}try{return omsOk(call.read(raw))}catch{return omsErr({kind:"badResponse",...rid})}}catch{return omsErr({kind:timedOut?"timeout":"network"})}finally{clearTimeout(timer)}}let invalid=()=>Promise.resolve(omsErr({kind:"invalidRequest"}));function withId(id,run){return isValidId(id)?run(seg(id)):invalid()}let lines=ls=>ls.map(cartLineToWire);return{shopConfig:()=>send({method:"GET",path:"/shop-config",read:shopConfigFromWire}),offers:(q={})=>send({method:"GET",path:"/catalog/offers",query:{text:q.text,requires_rx:q.requiresRx,cursor:q.cursor,limit:q.limit},read:offerPageFromWire}),offer:offerId=>withId(offerId,id=>send({method:"GET",path:`/catalog/offers/${id}`,read:offerFromWire})),prescriptions:()=>send({method:"GET",path:"/prescriptions",read:prescriptionsFromWire}),addresses:()=>send({method:"GET",path:"/addresses",read:addressesFromWire}),address:ref=>withId(ref,id=>send({method:"GET",path:`/addresses/${id}`,read:addressDetailFromWire})),addAddress:input=>send({method:"POST",path:"/addresses",body:addressInputToWire(input),read:addressEntryFromWire}),updateAddress:(ref,input)=>withId(ref,id=>send({method:"PUT",path:`/addresses/${id}`,body:addressInputToWire(input),read:addressEntryFromWire})),removeAddress:ref=>withId(ref,id=>send({method:"DELETE",path:`/addresses/${id}`,read:null})),makeDefaultAddress:ref=>withId(ref,id=>send({method:"POST",path:`/addresses/${id}/default`,read:addressEntryFromWire})),paymentMethods:()=>send({method:"GET",path:"/payment-methods",read:paymentMethodsFromWire}),setupPaymentMethod:()=>send({method:"POST",path:"/payment-methods/setup",read:paymentSetupFromWire}),startCardSetupSession:r=>send({method:"POST",path:"/payment-methods/setup-session",body:{idempotency_key:r.idempotencyKey,return_url:r.returnUrl},read:cardSetupLinkFromWire}),removePaymentMethod:pm=>PAYMENT_METHOD_ID.test(pm)?send({method:"DELETE",path:`/payment-methods/${pm}`,read:null}):invalid(),quote:r=>send({method:"POST",path:"/cart/quote",body:{lines:lines(r.lines),ship_to:r.shipTo,promo_code:r.promoCode??null},read:quoteFromWire}),createCheckout:r=>send({method:"POST",path:"/checkouts",body:{idempotency_key:r.idempotencyKey,channel:channel,lines:lines(r.lines),ship_to:r.shipTo,receipt_email:r.receiptEmail??null,promo_code:r.promoCode??null},read:checkoutFromWire}),confirmCheckout:(checkoutId,r)=>PAYMENT_METHOD_ID.test(r.paymentMethodId)&&Number.isInteger(r.expectedTotal)?withId(checkoutId,id=>send({method:"POST",path:`/checkouts/${id}/confirm`,body:{idempotency_key:r.idempotencyKey,expected_total:r.expectedTotal,payment_method_id:r.paymentMethodId},read:confirmationFromWire})):invalid(),orders:(q={})=>send({method:"GET",path:"/orders",query:{cursor:q.cursor,limit:q.limit,reference:q.reference},read:orderPageFromWire}),order:orderId=>withId(orderId,id=>send({method:"GET",path:`/orders/${id}`,read:orderFromWire})),cancelOrder:(orderId,r)=>REASON_CODE.test(r.reasonCode)?withId(orderId,id=>send({method:"POST",path:`/orders/${id}/cancel`,body:{idempotency_key:r.idempotencyKey,reason_code:r.reasonCode},read:cancelOutcomeFromWire})):invalid(),payOrder:(orderId,r)=>{if(r.paymentMethodId!==void 0&&!PAYMENT_METHOD_ID.test(r.paymentMethodId))return invalid();let body={idempotency_key:r.idempotencyKey};return r.paymentMethodId&&(body.payment_method_id=r.paymentMethodId),withId(orderId,id=>send({method:"POST",path:`/orders/${id}/pay`,body:body,read:payOutcomeFromWire}))},cardActionLink:(orderId,r)=>withId(orderId,id=>send({method:"POST",path:`/orders/${id}/card-action-link`,body:{return_url:r.returnUrl},read:cardActionLinkFromWire})),requestReturn:(orderId,r)=>r.lines.every(l=>REASON_CODE.test(l.reasonCode))?withId(orderId,id=>send({method:"POST",path:`/orders/${id}/returns`,body:{idempotency_key:r.idempotencyKey,lines:r.lines.map(l=>({line_id:l.lineId,quantity:l.quantity,reason_code:l.reasonCode}))},read:returnFromWire})):invalid(),getReturn:returnId=>withId(returnId,id=>send({method:"GET",path:`/returns/${id}`,read:returnFromWire})),cancelReturn:returnId=>withId(returnId,id=>send({method:"POST",path:`/returns/${id}/cancel`,read:returnFromWire})),openCase:(orderId,r)=>REASON_CODE.test(r.reasonCode)&&r.message.length<=4e3?withId(orderId,id=>send({method:"POST",path:`/orders/${id}/cases`,body:{idempotency_key:r.idempotencyKey,reason_code:r.reasonCode,message:r.message},read:caseFromWire})):invalid(),orderCases:orderId=>withId(orderId,id=>send({method:"GET",path:`/orders/${id}/cases`,read:casesFromWire})),plans:(q={})=>send({method:"GET",path:"/subscriptions",query:{cursor:q.cursor,limit:q.limit},read:planPageFromWire}),createPlan:input=>PAYMENT_METHOD_ID.test(input.paymentMethodId)?send({method:"POST",path:"/subscriptions",body:{idempotency_key:input.idempotencyKey,cadence_days:input.cadenceDays,destination:input.destination,payment_method_id:input.paymentMethodId,consent_terms_version:input.consentTermsVersion,lines:lines(input.lines)},read:planFromWire}):invalid(),updatePlan:(planId,patch)=>{if(patch.paymentMethodId!==void 0&&!PAYMENT_METHOD_ID.test(patch.paymentMethodId))return invalid();let body={idempotency_key:patch.idempotencyKey};return patch.lines&&(body.lines=lines(patch.lines)),patch.cadenceDays!==void 0&&(body.cadence_days=patch.cadenceDays),patch.destination!==void 0&&(body.destination=patch.destination),patch.paymentMethodId!==void 0&&(body.payment_method_id=patch.paymentMethodId),withId(planId,id=>send({method:"PATCH",path:`/subscriptions/${id}`,body:body,read:planFromWire}))},planAction:(planId,r)=>withId(planId,id=>send({method:"POST",path:`/subscriptions/${id}/actions`,body:{idempotency_key:r.idempotencyKey,operation:r.operation},read:planFromWire})),cancelPlan:planId=>withId(planId,id=>send({method:"POST",path:`/subscriptions/${id}/cancel`,read:planFromWire})),cycleReview:planId=>withId(planId,id=>send({method:"GET",path:`/subscriptions/${id}/cycle`,read:cycleReviewFromWire})),editCycle:(planId,cycle,r)=>Number.isInteger(cycle)&&cycle>0?withId(planId,id=>send({method:"PUT",path:`/subscriptions/${id}/cycles/${cycle}/lines`,body:{idempotency_key:r.idempotencyKey,lines:lines(r.lines)},read:cycleReviewFromWire})):invalid(),draftCycle:(planId,cycle)=>Number.isInteger(cycle)&&cycle>0?withId(planId,id=>send({method:"POST",path:`/subscriptions/${id}/cycles/${cycle}/draft`,read:cycleDraftFromWire})):invalid(),approveCycle:(planId,cycle,r)=>Number.isInteger(cycle)&&cycle>0&&Number.isInteger(r.expectedTotal)?withId(planId,id=>send({method:"POST",path:`/subscriptions/${id}/cycles/${cycle}/approve`,body:{idempotency_key:r.idempotencyKey,checkout_id:r.checkoutId,expected_total:r.expectedTotal},read:confirmationFromWire})):invalid(),skipCycle:(planId,cycle,r)=>Number.isInteger(cycle)&&cycle>0?withId(planId,id=>send({method:"POST",path:`/subscriptions/${id}/cycles/${cycle}/skip`,body:{idempotency_key:r.idempotencyKey},read:planFromWire})):invalid()}}function step(result){return result.error?{ok:false,message:typeof result.error.message=="string"&&result.error.message.length<=300?result.error.message:null}:{ok:true}}function createStripeJsPayments(stripe,options={}){return{async confirmCardSetup(clientSecret){try{let confirmParams=options.returnUrl?{return_url:options.returnUrl}:void 0;return step(await stripe.confirmSetup({clientSecret:clientSecret,...options.elementsFor?{elements:options.elementsFor(clientSecret)}:{},...confirmParams?{confirmParams:confirmParams}:{},redirect:"if_required"}))}catch{return{ok:false,message:null}}},async handleNextAction(clientSecret){try{return step(await stripe.handleNextAction({clientSecret:clientSecret}))}catch{return{ok:false,message:null}}}}}exports.EverfurShop=EverfurShop;exports.SHOP_COPY=SHOP_COPY;exports.SHOP_COPY_PLACEHOLDERS=SHOP_COPY_PLACEHOLDERS;exports.UNAVAILABLE_PACKAGE_SOURCE=UNAVAILABLE_PACKAGE_SOURCE;exports.createOmsClient=createOmsClient;exports.createOmsPackageSource=createOmsPackageSource;exports.createStripeJsPayments=createStripeJsPayments;exports.isOmsRefusal=isOmsRefusal;exports.isOmsRetryable=isOmsRetryable;exports.isOmsUnavailable=isOmsUnavailable;exports.newIdempotencyKey=newIdempotencyKey;exports.shopCopy=shopCopy;
|