@apextelemed/partner-core 0.1.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/README.md +10 -6
  2. package/dist/api/index.d.ts +15 -2
  3. package/dist/api/index.js +3 -3
  4. package/dist/api/index.jsx +9 -3
  5. package/dist/chunk/{L46OKCKG.jsx → 6HLXYY4F.jsx} +28 -6
  6. package/dist/chunk/{3VEOP7TZ.jsx → AAWNUGML.jsx} +330 -6
  7. package/dist/chunk/ACE7M2YA.jsx +1 -0
  8. package/dist/chunk/{KNTZTYXE.jsx → B63K5R7M.jsx} +61 -10
  9. package/dist/chunk/{V42CGY2S.jsx → DUVW24DM.jsx} +1 -1
  10. package/dist/chunk/{DHII7L5Y.js → FBVNUFJM.js} +27 -7
  11. package/dist/chunk/FBVNUFJM.js.map +1 -0
  12. package/dist/chunk/{E7722UPF.js → FWUBNK42.js} +3 -3
  13. package/dist/chunk/{E7722UPF.js.map → FWUBNK42.js.map} +1 -1
  14. package/dist/chunk/JSHO46VZ.js +3 -0
  15. package/dist/chunk/JSHO46VZ.js.map +1 -0
  16. package/dist/chunk/{KZZSQ7LP.jsx → KMHMT6YP.jsx} +2 -2
  17. package/dist/chunk/{6TFBQECC.jsx → NP4CMOLW.jsx} +41 -1
  18. package/dist/chunk/{HLXKWRRW.js → QSSVQ5PR.js} +756 -404
  19. package/dist/chunk/QSSVQ5PR.js.map +1 -0
  20. package/dist/chunk/{ZMOG2IIC.js → SE6JHCPZ.js} +61 -11
  21. package/dist/chunk/SE6JHCPZ.js.map +1 -0
  22. package/dist/chunk/{DY5BJ6UG.js → UNAI6NBV.js} +2 -2
  23. package/dist/chunk/UNAI6NBV.js.map +1 -0
  24. package/dist/chunk/{J6KNY37T.js → XMYPS7PT.js} +40 -3
  25. package/dist/chunk/XMYPS7PT.js.map +1 -0
  26. package/dist/{client-BzSg2DEK.d.ts → client-CWYoMmla.d.ts} +11 -0
  27. package/dist/flows/index.d.ts +55 -7
  28. package/dist/flows/index.js +5 -5
  29. package/dist/flows/index.jsx +5 -5
  30. package/dist/index/index.d.ts +2 -2
  31. package/dist/index/index.js +7 -7
  32. package/dist/index/index.jsx +13 -7
  33. package/dist/pages/index.d.ts +1 -1
  34. package/dist/pages/index.js +4 -4
  35. package/dist/pages/index.jsx +4 -4
  36. package/dist/stores/index.d.ts +1 -1
  37. package/dist/stores/index.js +2 -2
  38. package/dist/stores/index.jsx +2 -2
  39. package/dist/testing/storage.d.ts +1 -1
  40. package/dist/testing/storage.d.ts.map +1 -1
  41. package/dist/testing/storage.js +1 -0
  42. package/dist/testing/storage.js.map +1 -1
  43. package/package.json +1 -1
  44. package/dist/chunk/AN3WPMEP.js +0 -3
  45. package/dist/chunk/AN3WPMEP.js.map +0 -1
  46. package/dist/chunk/DHII7L5Y.js.map +0 -1
  47. package/dist/chunk/DY5BJ6UG.js.map +0 -1
  48. package/dist/chunk/HLXKWRRW.js.map +0 -1
  49. package/dist/chunk/J6KNY37T.js.map +0 -1
  50. package/dist/chunk/O3QK7YZR.jsx +0 -1
  51. package/dist/chunk/ZMOG2IIC.js.map +0 -1
package/README.md CHANGED
@@ -56,12 +56,16 @@ matching tag: `git tag v0.1.0 && git push --tags`. `.github/workflows/release.ym
56
56
  builds, runs the guards, and publishes. A tag that is not on `main` is refused
57
57
  before any build runs.
58
58
 
59
- Two things are temporary, both for the first release only. Auth is an
60
- `NPM_TOKEN`, because a trusted publisher cannot be configured for a package
61
- that does not exist yet; it is marked for removal in the workflow, and is not
62
- a fallback to leave in place — npm prefers a token whenever one is set and
63
- never attempts the OIDC exchange. And `provenance` is off, because this repo
64
- is still private; turn it back on in `publishConfig` once it is public.
59
+ Auth is npm trusted publishing (OIDC) — no token. The publisher is configured
60
+ for this package on npmjs.com and matched on the workflow's filename, so
61
+ renaming `release.yml` breaks publishing until that config is updated. There is
62
+ deliberately no token fallback: npm prefers a token whenever one is set and
63
+ never attempts the OIDC exchange, so a fallback would mean trusted publishing
64
+ was never actually exercised.
65
+
66
+ `provenance` is off while this repo is private; turn it back on in
67
+ `publishConfig` once it is public. `0.1.0` has no attestation and cannot be
68
+ given one retroactively.
65
69
 
66
70
  ### License
67
71
 
@@ -1,4 +1,4 @@
1
- export { A as AddressVerifyResult, a as AdminApexDrug, b as AdminCategory, c as AdminCategoryInput, d as AdminCustomer, e as AdminDashboardStats, f as AdminListParams, g as AdminPayment, h as AdminProduct, i as AdminPromoCode, j as AdminPromoCodeInput, k as AdminSale, l as AdminSaleInput, m as AdminSubscription, n as AdminSupportCustomer, o as AdminSupportStats, p as AdminSupportThread, q as AdminWebhookEvent, r as Affiliate, s as AffiliateAuthTokens, t as AffiliateClickRecord, u as AffiliateConversion, v as AffiliateDashboardLinks, w as AffiliateDashboardProfile, x as AffiliateDashboardStats, y as AffiliateDownlineMember, z as AffiliateEarningsBreakdown, B as AffiliatePaymentMethod, C as AffiliateProgram, D as AffiliateRegisterInput, E as AffiliateRegisterResponse, F as AffiliateSession, G as AffiliateStatsResponse, H as AffiliateStatus, I as AffiliateTrackResponse, J as ApiError, K as ApiResponse, L as AttributionMethod, M as AuthTokens, N as CatalogProduct, O as CheckoutAddress, P as CheckoutPayload, Q as CheckoutResult, R as CommissionConfig, S as CommissionStatus, T as CompleteSurveyPayload, U as CreateAffiliatePayload, V as CreateAffiliateProgramPayload, W as CreateOrderPayload, X as CreateRequestPayload, Y as CreateSubscriptionPayload, Z as CustomerDiscountConfig, _ as DeliveryInfo, $ as DiscountType, a0 as EmailTemplatesMap, a1 as LoginPayload, a2 as MemberPrescriptionRequest, a3 as MemberSurveyMode, a4 as MemberSurveyResponseSummary, a5 as MemberSurveyTranscript, a6 as MemberSurveyTranscriptItem, a7 as MemberSurveyTranscriptSection, a8 as MembersMeResponse, a9 as Order, aa as OrderItemInput, ab as PaginationParams, ac as PaymentCallbackPayload, ad as PaymentInitiatePayload, ae as PaymentType, af as PendingRenewalSurvey, ag as Placeholder, ah as ProductSaleSummary, ai as PromoValidationResponse, aj as PublicCategory, ak as RegisterAndSubscribePayload, al as RegisterPayload, am as RenewalStatus, an as SUPPORT_ATTACHMENT_MAX_BYTES, ao as SUPPORT_ATTACHMENT_MIME_TYPES, ap as SelectDrugPayload, aq as SendMessagePayload, ar as SendToPharmacyPayload, as as SupportAttachment, at as SupportMessage, au as SupportRealtimeToken, av as SupportThread, aw as SupportThreadStatus, ax as SurveySubmitPayload, ay as TemplatePlaceholdersMap, az as TemplateText, aA as TokenTrackName, aB as UpdateAffiliatePayload, aC as UpdateAffiliateProgramPayload, aD as UpdatePaymentMethodPayload, aE as UpdateProfilePayload, aF as User, aG as addressesApi, aH as adminAffiliatesApi, aI as adminApi, aJ as affiliateAuthStorageKey, aK as affiliatePortalApi, aL as apexApi, aM as apiFetch, aN as authApi, aO as authStorageKey, aP as clearAffiliateTokens, aQ as clearTokens, aR as getAffiliateTokens, aS as getTokens, aT as membersApi, aU as messagesApi, aV as newIdempotencyKey, aW as onTokensCleared, aX as ordersApi, aY as paymentsApi, aZ as productsApi, a_ as promoCodesApi, a$ as setAffiliateTokens, b0 as setTokens, b1 as subscriptionsApi, b2 as supportApi, b3 as usersApi } from '../client-BzSg2DEK.js';
1
+ export { A as AddressVerifyResult, a as AdminApexDrug, b as AdminCategory, c as AdminCategoryInput, d as AdminCustomer, e as AdminDashboardStats, f as AdminListParams, g as AdminPayment, h as AdminProduct, i as AdminPromoCode, j as AdminPromoCodeInput, k as AdminSale, l as AdminSaleInput, m as AdminSubscription, n as AdminSupportCustomer, o as AdminSupportStats, p as AdminSupportThread, q as AdminWebhookEvent, r as Affiliate, s as AffiliateAuthTokens, t as AffiliateClickRecord, u as AffiliateConversion, v as AffiliateDashboardLinks, w as AffiliateDashboardProfile, x as AffiliateDashboardStats, y as AffiliateDownlineMember, z as AffiliateEarningsBreakdown, B as AffiliatePaymentMethod, C as AffiliateProgram, D as AffiliateRegisterInput, E as AffiliateRegisterResponse, F as AffiliateSession, G as AffiliateStatsResponse, H as AffiliateStatus, I as AffiliateTrackResponse, J as ApiError, K as ApiResponse, L as AttributionMethod, M as AuthTokens, N as CatalogProduct, O as CheckoutAddress, P as CheckoutPayload, Q as CheckoutResult, R as CommissionConfig, S as CommissionStatus, T as CompleteSurveyPayload, U as CreateAffiliatePayload, V as CreateAffiliateProgramPayload, W as CreateOrderPayload, X as CreateRequestPayload, Y as CreateSubscriptionPayload, Z as CustomerDiscountConfig, _ as DeliveryInfo, $ as DiscountType, a0 as EmailTemplatesMap, a1 as LoginPayload, a2 as MemberPrescriptionRequest, a3 as MemberSurveyMode, a4 as MemberSurveyResponseSummary, a5 as MemberSurveyTranscript, a6 as MemberSurveyTranscriptItem, a7 as MemberSurveyTranscriptSection, a8 as MembersMeResponse, a9 as Order, aa as OrderItemInput, ab as PaginationParams, ac as PaymentCallbackPayload, ad as PaymentInitiatePayload, ae as PaymentType, af as PendingRenewalSurvey, ag as Placeholder, ah as ProductSaleSummary, ai as PromoValidationResponse, aj as PublicCategory, ak as RegisterAndSubscribePayload, al as RegisterPayload, am as RenewalStatus, an as SUPPORT_ATTACHMENT_MAX_BYTES, ao as SUPPORT_ATTACHMENT_MIME_TYPES, ap as SelectDrugPayload, aq as SendMessagePayload, ar as SendToPharmacyPayload, as as SupportAttachment, at as SupportMessage, au as SupportRealtimeToken, av as SupportThread, aw as SupportThreadStatus, ax as SurveySubmitPayload, ay as TemplatePlaceholdersMap, az as TemplateText, aA as TokenTrackName, aB as UpdateAffiliatePayload, aC as UpdateAffiliateProgramPayload, aD as UpdatePaymentMethodPayload, aE as UpdateProfilePayload, aF as User, aG as addressesApi, aH as adminAffiliatesApi, aI as adminApi, aJ as affiliateAuthStorageKey, aK as affiliatePortalApi, aL as apexApi, aM as apiFetch, aN as authApi, aO as authStorageKey, aP as clearAffiliateTokens, aQ as clearTokens, aR as getAffiliateTokens, aS as getTokens, aT as membersApi, aU as messagesApi, aV as newIdempotencyKey, aW as onTokensCleared, aX as ordersApi, aY as paymentsApi, aZ as productsApi, a_ as promoCodesApi, a$ as setAffiliateTokens, b0 as setTokens, b1 as subscriptionsApi, b2 as supportApi, b3 as usersApi } from '../client-CWYoMmla.js';
2
2
  export { EmbedApiError as ApexV2ApiError, EmbedApiClient, EmbedApiClientOptions, EmbedApiError, EmbedEvent, EmbedEventType, FetchLike, PatientInfo, V2Answer, V2ComposedSurvey, V2DrugResult, V2QualificationResult, V2Question, V2QuestionOption, V2Section, V2Step, V2SubmitResult, V2VisibilityCondition, createEmbedApiClient, disqualificationReasonText, disqualifiedDrugIds, qualifiedDrugIds } from '@apextelemed/survey-core';
3
3
  export { C as CartCaptureConfig, a as CartSnapshotLine, F as FunnelConfig, b as FunnelDraftPayload, R as ResumedCart, c as ResumedCartLine, d as ResumedDraft, e as adoptCartId, f as adoptFunnelSessionId, g as cartId, h as fetchCartConfig, i as fetchFunnelConfig, j as fetchResumedCart, k as fetchResumedDraft, l as funnelSessionId, p as peekFunnelSessionId, m as postCartSnapshot, n as postFunnelEvent, r as readCartToken, o as readResumeToken, q as resetCartConfigCache, s as resetCartId, t as resetFunnelConfigCache, u as saveFunnelDraft, v as stripCartToken, w as stripResumeToken } from '../cart-CBH8Em8f.js';
4
4
 
@@ -9,4 +9,17 @@ declare function readAffiliateRef(): string | null;
9
9
  /** Drop the stored referral code. */
10
10
  declare function clearAffiliateRef(): void;
11
11
 
12
- export { captureAffiliateRef, clearAffiliateRef, readAffiliateRef };
12
+ /** Persist a promo code from a `?promo=` landing. No-op for empty input. */
13
+ declare function capturePromoCode(code: string): void;
14
+ /**
15
+ * Read the stored promo code, or null if absent or past the storage window.
16
+ *
17
+ * Being within the window says nothing about whether the CODE is still valid —
18
+ * a campaign can end while the stash is fresh. The caller re-validates against
19
+ * the server before showing it to anyone.
20
+ */
21
+ declare function readPromoCode(): string | null;
22
+ /** Drop the stored promo code. */
23
+ declare function clearPromoCode(): void;
24
+
25
+ export { captureAffiliateRef, capturePromoCode, clearAffiliateRef, clearPromoCode, readAffiliateRef, readPromoCode };
package/dist/api/index.js CHANGED
@@ -1,8 +1,8 @@
1
- import '../chunk/AN3WPMEP.js';
2
- export { adoptCartId, cartId, fetchCartConfig, fetchResumedCart, postCartSnapshot, readCartToken, resetCartConfigCache, resetCartId, stripCartToken } from '../chunk/J6KNY37T.js';
1
+ import '../chunk/JSHO46VZ.js';
2
+ export { adoptCartId, capturePromoCode, cartId, clearPromoCode, fetchCartConfig, fetchResumedCart, postCartSnapshot, readCartToken, readPromoCode, resetCartConfigCache, resetCartId, stripCartToken } from '../chunk/XMYPS7PT.js';
3
3
  export { EmbedApiError2 as ApexV2ApiError, EmbedApiError, createEmbedApiClient, disqualificationReasonText, disqualifiedDrugIds, qualifiedDrugIds } from '../chunk/LZWA44KD.js';
4
4
  export { adoptFunnelSessionId, fetchFunnelConfig, fetchResumedDraft, funnelSessionId, peekFunnelSessionId, postFunnelEvent, readResumeToken, resetFunnelConfigCache, saveFunnelDraft, stripResumeToken } from '../chunk/DS4E7FAI.js';
5
- export { ApiError, SUPPORT_ATTACHMENT_MAX_BYTES, SUPPORT_ATTACHMENT_MIME_TYPES, addressesApi, adminAffiliatesApi, adminApi, affiliateAuthStorageKey, affiliatePortalApi, apexApi, apiFetch, authApi, authStorageKey, captureAffiliateRef, clearAffiliateRef, clearAffiliateTokens, clearTokens, getAffiliateTokens, getTokens, membersApi, messagesApi, newIdempotencyKey, onTokensCleared, ordersApi, paymentsApi, productsApi, promoCodesApi, readAffiliateRef, setAffiliateTokens, setTokens, subscriptionsApi, supportApi, usersApi } from '../chunk/DY5BJ6UG.js';
5
+ export { ApiError, SUPPORT_ATTACHMENT_MAX_BYTES, SUPPORT_ATTACHMENT_MIME_TYPES, addressesApi, adminAffiliatesApi, adminApi, affiliateAuthStorageKey, affiliatePortalApi, apexApi, apiFetch, authApi, authStorageKey, captureAffiliateRef, clearAffiliateRef, clearAffiliateTokens, clearTokens, getAffiliateTokens, getTokens, membersApi, messagesApi, newIdempotencyKey, onTokensCleared, ordersApi, paymentsApi, productsApi, promoCodesApi, readAffiliateRef, setAffiliateTokens, setTokens, subscriptionsApi, supportApi, usersApi } from '../chunk/UNAI6NBV.js';
6
6
  import '../chunk/5XGPFYIJ.js';
7
7
  //# sourceMappingURL=index.js.map
8
8
  //# sourceMappingURL=index.js.map
@@ -1,15 +1,18 @@
1
- import "../chunk/O3QK7YZR.jsx";
1
+ import "../chunk/ACE7M2YA.jsx";
2
2
  import {
3
3
  adoptCartId,
4
+ capturePromoCode,
4
5
  cartId,
6
+ clearPromoCode,
5
7
  fetchCartConfig,
6
8
  fetchResumedCart,
7
9
  postCartSnapshot,
8
10
  readCartToken,
11
+ readPromoCode,
9
12
  resetCartConfigCache,
10
13
  resetCartId,
11
14
  stripCartToken
12
- } from "../chunk/6TFBQECC.jsx";
15
+ } from "../chunk/NP4CMOLW.jsx";
13
16
  import {
14
17
  EmbedApiError,
15
18
  EmbedApiError2,
@@ -63,7 +66,7 @@ import {
63
66
  subscriptionsApi,
64
67
  supportApi,
65
68
  usersApi
66
- } from "../chunk/V42CGY2S.jsx";
69
+ } from "../chunk/DUVW24DM.jsx";
67
70
  import "../chunk/LDZIUFDM.jsx";
68
71
  export {
69
72
  EmbedApiError2 as ApexV2ApiError,
@@ -83,9 +86,11 @@ export {
83
86
  authApi,
84
87
  authStorageKey,
85
88
  captureAffiliateRef,
89
+ capturePromoCode,
86
90
  cartId,
87
91
  clearAffiliateRef,
88
92
  clearAffiliateTokens,
93
+ clearPromoCode,
89
94
  clearTokens,
90
95
  createEmbedApiClient,
91
96
  disqualificationReasonText,
@@ -111,6 +116,7 @@ export {
111
116
  qualifiedDrugIds,
112
117
  readAffiliateRef,
113
118
  readCartToken,
119
+ readPromoCode,
114
120
  readResumeToken,
115
121
  resetCartConfigCache,
116
122
  resetCartId,
@@ -1,12 +1,14 @@
1
1
  import {
2
2
  adoptCartId,
3
+ clearPromoCode,
3
4
  fetchCartConfig,
4
5
  fetchResumedCart,
5
6
  postCartSnapshot,
6
7
  readCartToken,
8
+ readPromoCode,
7
9
  resetCartId,
8
10
  stripCartToken
9
- } from "./6TFBQECC.jsx";
11
+ } from "./NP4CMOLW.jsx";
10
12
  import {
11
13
  firstAddressError,
12
14
  formatCardNumber,
@@ -16,12 +18,12 @@ import {
16
18
  useAddressPair,
17
19
  useCardTokenizer,
18
20
  validateAddress
19
- } from "./KNTZTYXE.jsx";
21
+ } from "./B63K5R7M.jsx";
20
22
  import {
21
23
  auth_default,
22
24
  cart_default,
23
25
  medication_default
24
- } from "./KZZSQ7LP.jsx";
26
+ } from "./KMHMT6YP.jsx";
25
27
  import {
26
28
  ApiError,
27
29
  newIdempotencyKey,
@@ -29,7 +31,7 @@ import {
29
31
  promoCodesApi,
30
32
  subscriptionsApi,
31
33
  usersApi
32
- } from "./V42CGY2S.jsx";
34
+ } from "./DUVW24DM.jsx";
33
35
  import {
34
36
  getConfig
35
37
  } from "./LDZIUFDM.jsx";
@@ -289,6 +291,20 @@ function useSubscriptionIntakeFlow(options) {
289
291
  const [promoValidating, setPromoValidating] = createSignal2(false);
290
292
  const [promoError, setPromoError] = createSignal2(null);
291
293
  const [promoApplied, setPromoApplied] = createSignal2(null);
294
+ onMount(async () => {
295
+ if (promoCode().trim()) return;
296
+ const stashed = readPromoCode();
297
+ if (!stashed) return;
298
+ try {
299
+ const res = await promoCodesApi.validate(stashed, {
300
+ productIds: [options.pricing.productId],
301
+ subtotalCents: savingsBaseCents()
302
+ });
303
+ if (res.valid) setPromoCode(stashed);
304
+ else clearPromoCode();
305
+ } catch {
306
+ }
307
+ });
292
308
  const [idemKey, setIdemKey] = createSignal2(restored.idempotencyKey ?? "");
293
309
  onMount(() => {
294
310
  createEffect(() => {
@@ -353,7 +369,13 @@ function useSubscriptionIntakeFlow(options) {
353
369
  try {
354
370
  const res = await promoCodesApi.validate(code, {
355
371
  productIds: [options.pricing.productId],
356
- subtotalCents: options.pricing.priceCents
372
+ // The base the promo will actually be applied to. For a savings member
373
+ // that is the savings price, not list: the server discounts the
374
+ // savings-substituted subtotal at checkout, so quoting off list would
375
+ // show a percentage promo as a bigger saving than it is (10% of $399
376
+ // displayed, 10% of $280 charged). Same rule as savingsBaseCents — keep
377
+ // the two in step.
378
+ subtotalCents: savingsBaseCents()
357
379
  });
358
380
  if (!res.valid) {
359
381
  setPromoError(res.error ?? "Invalid promo code.");
@@ -730,4 +752,4 @@ export {
730
752
  restoreCartFromLink,
731
753
  startCartCapture
732
754
  };
733
- //# sourceMappingURL=L46OKCKG.jsx.map
755
+ //# sourceMappingURL=6HLXYY4F.jsx.map
@@ -19,6 +19,7 @@ import {
19
19
  redeemResumeLink,
20
20
  resolveSurveyV2DrugIntent,
21
21
  stateAvailabilityNote,
22
+ uploadPrescriptionPhoto,
22
23
  useAffiliateConversions,
23
24
  useAffiliateDownline,
24
25
  useAffiliateLinks,
@@ -34,7 +35,7 @@ import {
34
35
  useSurveyFlow,
35
36
  useSurveyV2Flow,
36
37
  useUpdatePaymentMethodFlow
37
- } from "./KNTZTYXE.jsx";
38
+ } from "./B63K5R7M.jsx";
38
39
  import {
39
40
  fetchFunnelConfig
40
41
  } from "./I46Y2J5W.jsx";
@@ -45,7 +46,7 @@ import {
45
46
  affiliateAuth_default,
46
47
  auth_default,
47
48
  cart_default
48
- } from "./KZZSQ7LP.jsx";
49
+ } from "./KMHMT6YP.jsx";
49
50
  import {
50
51
  ApiError,
51
52
  SUPPORT_ATTACHMENT_MAX_BYTES,
@@ -59,7 +60,7 @@ import {
59
60
  membersApi,
60
61
  subscriptionsApi,
61
62
  usersApi
62
- } from "./V42CGY2S.jsx";
63
+ } from "./DUVW24DM.jsx";
63
64
 
64
65
  // src/pages/Survey.tsx
65
66
  import { Show, For, createEffect, on } from "solid-js";
@@ -1633,6 +1634,305 @@ function MultiSelectQuestion(props) {
1633
1634
  </div>
1634
1635
  </Show3>;
1635
1636
  }
1637
+ var PHOTO_CHECKLIST_ITEMS = [
1638
+ { key: "drugName", label: "Drug name" },
1639
+ { key: "dosageSchedule", label: "Dosage & schedule" },
1640
+ { key: "expiration", label: "Expiration date" },
1641
+ { key: "prescriber", label: "Prescriber" },
1642
+ { key: "refillsLeft", label: "Refills left" },
1643
+ { key: "rxNumber", label: "Prescription number" },
1644
+ { key: "pharmacy", label: "Pharmacy" },
1645
+ { key: "phone", label: "Pharmacy phone" }
1646
+ ];
1647
+ function emptyChecklist() {
1648
+ return {
1649
+ drugName: false,
1650
+ dosageSchedule: false,
1651
+ expiration: false,
1652
+ prescriber: false,
1653
+ refillsLeft: false,
1654
+ rxNumber: false,
1655
+ pharmacy: false,
1656
+ phone: false
1657
+ };
1658
+ }
1659
+ function PrescriptionPhotosQuestion(props) {
1660
+ const { Button, Banner, Spinner, Textarea } = usePrimitives();
1661
+ const initial = props.value;
1662
+ const restoredPhotos = initial && "photos" in initial && Array.isArray(initial.photos) ? initial.photos.map((p) => ({
1663
+ photoId: p.photoId,
1664
+ checklist: { ...emptyChecklist(), ...p.checklist }
1665
+ })) : [];
1666
+ const [entries, setEntries] = createSignal(restoredPhotos);
1667
+ const [done, setDone] = createSignal(restoredPhotos.length > 0);
1668
+ const [none, setNone] = createSignal(!!initial && "none" in initial && initial.none === true);
1669
+ const [manual, setManual] = createSignal(
1670
+ !!initial && "manual" in initial && typeof initial.manual === "string"
1671
+ );
1672
+ const [manualText, setManualText] = createSignal(
1673
+ initial && "manual" in initial && typeof initial.manual === "string" ? initial.manual : ""
1674
+ );
1675
+ const [uploading, setUploading] = createSignal(false);
1676
+ const [error, setError] = createSignal(null);
1677
+ let fileInput;
1678
+ const allChecked = (e) => PHOTO_CHECKLIST_ITEMS.every((i) => e.checklist[i.key]);
1679
+ function emit() {
1680
+ if (none()) return props.onChange({ version: 1, none: true });
1681
+ if (manual()) {
1682
+ const text = manualText().trim();
1683
+ return props.onChange(text ? { version: 1, manual: manualText() } : void 0);
1684
+ }
1685
+ const list = entries();
1686
+ if (list.length > 0 && done() && list.every(allChecked)) {
1687
+ return props.onChange({
1688
+ version: 1,
1689
+ photos: list.map((e) => ({ photoId: e.photoId, checklist: e.checklist }))
1690
+ });
1691
+ }
1692
+ props.onChange(void 0);
1693
+ }
1694
+ async function handleFile(file) {
1695
+ if (!file) return;
1696
+ setError(null);
1697
+ setUploading(true);
1698
+ try {
1699
+ const { photoId } = await uploadPrescriptionPhoto(file);
1700
+ setEntries((prev) => [
1701
+ ...prev,
1702
+ { photoId, checklist: emptyChecklist(), objectUrl: URL.createObjectURL(file) }
1703
+ ]);
1704
+ setDone(false);
1705
+ emit();
1706
+ } catch (err) {
1707
+ setError(err instanceof Error ? err.message : "Photo upload failed. Please try again.");
1708
+ } finally {
1709
+ setUploading(false);
1710
+ if (fileInput) fileInput.value = "";
1711
+ }
1712
+ }
1713
+ function removeEntry(photoId) {
1714
+ const entry = entries().find((e) => e.photoId === photoId);
1715
+ if (entry?.objectUrl) URL.revokeObjectURL(entry.objectUrl);
1716
+ setEntries((prev) => prev.filter((e) => e.photoId !== photoId));
1717
+ emit();
1718
+ }
1719
+ function toggleCheck(photoId, key, checked) {
1720
+ setEntries(
1721
+ (prev) => prev.map(
1722
+ (e) => e.photoId === photoId ? { ...e, checklist: { ...e.checklist, [key]: checked } } : e
1723
+ )
1724
+ );
1725
+ emit();
1726
+ }
1727
+ const blockedHint = () => {
1728
+ if (none() || manual() && manualText().trim()) return null;
1729
+ const list = entries();
1730
+ if (list.length === 0 && !manual()) {
1731
+ return "Add at least one prescription photo \u2014 or choose an option below if you have none or can\u2019t upload.";
1732
+ }
1733
+ if (manual()) return "Enter your prescription information to continue.";
1734
+ if (!list.every(allChecked)) {
1735
+ return "Confirm each item is visible in every photo (retake the photo if something isn\u2019t).";
1736
+ }
1737
+ if (!done()) return 'Check "I\u2019ve added all my prescriptions" when you\u2019re finished.';
1738
+ return null;
1739
+ };
1740
+ return <div style={{ display: "flex", "flex-direction": "column", gap: "0.75rem" }}>
1741
+ <div>
1742
+ <div style={{ "font-size": "0.875rem", "font-weight": 500 }}>{props.label}</div>
1743
+ <Show3 when={props.helpText}>
1744
+ <div style={{ "font-size": "0.8125rem", opacity: 0.65, "margin-top": "0.25rem" }}>
1745
+ {props.helpText}
1746
+ </div>
1747
+ </Show3>
1748
+ </div>
1749
+
1750
+ <Show3 when={error()}>
1751
+ <Banner variant="error">{error()}</Banner>
1752
+ </Show3>
1753
+
1754
+ {
1755
+ /* Uploaded photos, each with its visibility checklist. */
1756
+ }
1757
+ <For2 each={entries()}>
1758
+ {(entry, i) => <div
1759
+ style={{
1760
+ border: "1px solid rgba(128,128,128,0.25)",
1761
+ "border-radius": "0.5rem",
1762
+ padding: "0.75rem",
1763
+ display: "flex",
1764
+ "flex-direction": "column",
1765
+ gap: "0.5rem"
1766
+ }}
1767
+ >
1768
+ <div style={{ display: "flex", gap: "0.75rem", "align-items": "flex-start" }}>
1769
+ <Show3
1770
+ when={entry.objectUrl}
1771
+ fallback={<div
1772
+ style={{
1773
+ width: "72px",
1774
+ height: "72px",
1775
+ "border-radius": "0.375rem",
1776
+ background: "rgba(128,128,128,0.12)",
1777
+ display: "flex",
1778
+ "align-items": "center",
1779
+ "justify-content": "center",
1780
+ "font-size": "0.6875rem",
1781
+ opacity: 0.7,
1782
+ "text-align": "center",
1783
+ "flex-shrink": 0
1784
+ }}
1785
+ >
1786
+ Photo uploaded
1787
+ </div>}
1788
+ >
1789
+ <img
1790
+ src={entry.objectUrl}
1791
+ alt={`Prescription photo ${i() + 1}`}
1792
+ style={{
1793
+ width: "72px",
1794
+ height: "72px",
1795
+ "object-fit": "cover",
1796
+ "border-radius": "0.375rem",
1797
+ "flex-shrink": 0
1798
+ }}
1799
+ />
1800
+ </Show3>
1801
+ <div style={{ flex: 1 }}>
1802
+ <div style={{ "font-size": "0.8125rem", "font-weight": 500, "margin-bottom": "0.25rem" }}>
1803
+ Prescription {i() + 1} — confirm these are visible:
1804
+ </div>
1805
+ <div
1806
+ style={{
1807
+ display: "grid",
1808
+ "grid-template-columns": "repeat(auto-fill, minmax(10rem, 1fr))",
1809
+ gap: "0.25rem 0.75rem"
1810
+ }}
1811
+ >
1812
+ <For2 each={PHOTO_CHECKLIST_ITEMS}>
1813
+ {(item) => <label
1814
+ style={{
1815
+ display: "flex",
1816
+ gap: "0.375rem",
1817
+ "align-items": "center",
1818
+ "font-size": "0.8125rem",
1819
+ cursor: "pointer"
1820
+ }}
1821
+ >
1822
+ <input
1823
+ type="checkbox"
1824
+ checked={entry.checklist[item.key]}
1825
+ onChange={(e) => toggleCheck(entry.photoId, item.key, e.currentTarget.checked)}
1826
+ />
1827
+ {item.label}
1828
+ </label>}
1829
+ </For2>
1830
+ </div>
1831
+ </div>
1832
+ </div>
1833
+ <div>
1834
+ <Button variant="ghost" size="sm" onClick={() => removeEntry(entry.photoId)}>
1835
+ Remove photo
1836
+ </Button>
1837
+ </div>
1838
+ </div>}
1839
+ </For2>
1840
+
1841
+ {
1842
+ /* Camera on mobile (capture), file picker on desktop. */
1843
+ }
1844
+ <input
1845
+ ref={fileInput}
1846
+ type="file"
1847
+ accept="image/*"
1848
+ capture="environment"
1849
+ hidden
1850
+ onChange={(e) => void handleFile(e.currentTarget.files?.[0] ?? void 0)}
1851
+ />
1852
+ <Show3 when={!none() && !manual()}>
1853
+ <div style={{ display: "flex", gap: "0.5rem", "align-items": "center" }}>
1854
+ <Button
1855
+ variant="secondary"
1856
+ disabled={uploading()}
1857
+ onClick={() => fileInput?.click()}
1858
+ >
1859
+ {entries().length === 0 ? "Take or upload a photo" : "Add another prescription"}
1860
+ </Button>
1861
+ <Show3 when={uploading()}>
1862
+ <Spinner size="sm" />
1863
+ </Show3>
1864
+ </div>
1865
+ </Show3>
1866
+
1867
+ <Show3 when={entries().length > 0}>
1868
+ <label
1869
+ style={{ display: "flex", gap: "0.5rem", "align-items": "center", "font-size": "0.875rem", cursor: "pointer" }}
1870
+ >
1871
+ <input
1872
+ type="checkbox"
1873
+ checked={done()}
1874
+ onChange={(e) => {
1875
+ setDone(e.currentTarget.checked);
1876
+ emit();
1877
+ }}
1878
+ />
1879
+ I&rsquo;ve added all my prescriptions
1880
+ </label>
1881
+ </Show3>
1882
+
1883
+ {
1884
+ /* The no-photo paths, mutually exclusive with photos and each other. */
1885
+ }
1886
+ <Show3 when={entries().length === 0}>
1887
+ <div style={{ display: "flex", "flex-direction": "column", gap: "0.375rem" }}>
1888
+ <label
1889
+ style={{ display: "flex", gap: "0.5rem", "align-items": "center", "font-size": "0.875rem", cursor: "pointer" }}
1890
+ >
1891
+ <input
1892
+ type="checkbox"
1893
+ checked={none()}
1894
+ onChange={(e) => {
1895
+ setNone(e.currentTarget.checked);
1896
+ if (e.currentTarget.checked) setManual(false);
1897
+ emit();
1898
+ }}
1899
+ />
1900
+ I have no current prescriptions
1901
+ </label>
1902
+ <label
1903
+ style={{ display: "flex", gap: "0.5rem", "align-items": "center", "font-size": "0.875rem", cursor: "pointer" }}
1904
+ >
1905
+ <input
1906
+ type="checkbox"
1907
+ checked={manual()}
1908
+ onChange={(e) => {
1909
+ setManual(e.currentTarget.checked);
1910
+ if (e.currentTarget.checked) setNone(false);
1911
+ emit();
1912
+ }}
1913
+ />
1914
+ I can&rsquo;t upload a photo. I will enter my prescription information manually.
1915
+ </label>
1916
+ </div>
1917
+ </Show3>
1918
+
1919
+ <Show3 when={manual() && entries().length === 0}>
1920
+ <Textarea
1921
+ value={manualText()}
1922
+ onInput={(v) => {
1923
+ setManualText(v);
1924
+ emit();
1925
+ }}
1926
+ rows={4}
1927
+ placeholder="For each prescription: drug name, dosage & schedule, prescriber, refills left, prescription number, pharmacy and phone"
1928
+ />
1929
+ </Show3>
1930
+
1931
+ <Show3 when={blockedHint()}>
1932
+ <div style={{ "font-size": "0.8125rem", opacity: 0.7 }}>{blockedHint()}</div>
1933
+ </Show3>
1934
+ </div>;
1935
+ }
1636
1936
  function QuestionField2(props) {
1637
1937
  const { TextField, Textarea, Select, RadioGroup, CheckboxGroup } = usePrimitives();
1638
1938
  const q = () => props.question;
@@ -1742,6 +2042,14 @@ function QuestionField2(props) {
1742
2042
  </div>
1743
2043
  </div>;
1744
2044
  })()}
2045
+ </Show3>
2046
+ <Show3 when={q().type === "prescription_photos"}>
2047
+ <PrescriptionPhotosQuestion
2048
+ label={lbl()}
2049
+ helpText={q().helpText}
2050
+ value={val()}
2051
+ onChange={(v) => props.onChange(v)}
2052
+ />
1745
2053
  </Show3>
1746
2054
  <Show3 when={q().type === "address"}>
1747
2055
  {(() => {
@@ -13399,7 +13707,17 @@ function OrderTracker(props) {
13399
13707
  {(r) => <div class="refill" data-testid="refill-strip">
13400
13708
  <div class="refill__head">
13401
13709
  <span class="lab-label">Your plan</span>
13402
- <span class="refill__cycle">Day {r().cycleDay} of {r().cycleLength}</span>
13710
+ {
13711
+ /* The cycle counter needs an anchored fill date. While a cycle is
13712
+ awaiting the pharmacy there isn't one, so say what we're waiting
13713
+ on instead of counting days against a date we don't have. */
13714
+ }
13715
+ <Show37
13716
+ when={!r().pendingFill}
13717
+ fallback={<span class="refill__cycle">Preparing your next fill</span>}
13718
+ >
13719
+ <span class="refill__cycle">Day {r().cycleDay} of {r().cycleLength}</span>
13720
+ </Show37>
13403
13721
  </div>
13404
13722
  <div class="refill__rail" style={{ "--p": String(r().progress) }}>
13405
13723
  <For28 each={r().events}>
@@ -13407,7 +13725,13 @@ function OrderTracker(props) {
13407
13725
  <span class="refill__dot" aria-hidden="true" />
13408
13726
  <span class="lab-label refill__label">{e.label}</span>
13409
13727
  <span class="refill__date">{formatEventDate(e.date)}</span>
13410
- <span class="refill__rel">{e.relative}</span>
13728
+ {
13729
+ /* Estimated dates stay hedged ("around"); the backend's real
13730
+ schedule is stated plainly. */
13731
+ }
13732
+ <span class="refill__rel">
13733
+ {!r().precise && e.date ? `around ${e.relative}` : e.relative}
13734
+ </span>
13411
13735
  <Show37 when={e.key === "survey" ? props.pendingRenewalId : null} keyed>
13412
13736
  {(rid) => <a href={props.renewHref(rid)} class="refill__action">
13413
13737
  Complete check-in →
@@ -16676,4 +17000,4 @@ export {
16676
17000
  AffiliateForgotPassword,
16677
17001
  AffiliateResetPassword
16678
17002
  };
16679
- //# sourceMappingURL=3VEOP7TZ.jsx.map
17003
+ //# sourceMappingURL=AAWNUGML.jsx.map
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=ACE7M2YA.jsx.map