@apextelemed/partner-core 0.17.0-dev.47 → 0.17.0-dev.50

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 (41) hide show
  1. package/dist/api/index.d.ts +1 -1
  2. package/dist/api/index.js +3 -3
  3. package/dist/api/index.jsx +5 -3
  4. package/dist/chunk/{GYEK4TSP.js → 2CHHHNFT.js} +3 -3
  5. package/dist/chunk/{GYEK4TSP.js.map → 2CHHHNFT.js.map} +1 -1
  6. package/dist/chunk/{MH43RC7G.jsx → 3CWWN7H2.jsx} +25 -2
  7. package/dist/chunk/{4YJF3J74.jsx → 6QI7MVTN.jsx} +2 -2
  8. package/dist/chunk/{XNP3VLLY.js → BVJPX54P.js} +2093 -1462
  9. package/dist/chunk/BVJPX54P.js.map +1 -0
  10. package/dist/chunk/{IPDABIXO.js → EGP7AQDM.js} +6 -6
  11. package/dist/chunk/{IPDABIXO.js.map → EGP7AQDM.js.map} +1 -1
  12. package/dist/chunk/{VLVSEATQ.jsx → GVXPPYZZ.jsx} +355 -5
  13. package/dist/chunk/{ATSYHZSR.js → H7RY2N5U.js} +3 -3
  14. package/dist/chunk/{ATSYHZSR.js.map → H7RY2N5U.js.map} +1 -1
  15. package/dist/chunk/{A43EPOTF.jsx → HADRZNID.jsx} +5 -5
  16. package/dist/chunk/{U426ASG4.js → ISC5GVA2.js} +26 -4
  17. package/dist/chunk/ISC5GVA2.js.map +1 -0
  18. package/dist/chunk/{B5722F4T.js → KADMJCZL.js} +3 -3
  19. package/dist/chunk/{B5722F4T.js.map → KADMJCZL.js.map} +1 -1
  20. package/dist/chunk/{XEWZ4OIT.jsx → OVRA6JBK.jsx} +2 -2
  21. package/dist/chunk/{YK2Y76A4.js → R5WTYT2O.js} +341 -6
  22. package/dist/chunk/R5WTYT2O.js.map +1 -0
  23. package/dist/chunk/{3XQSYLFD.jsx → XV5WXVPT.jsx} +1992 -1632
  24. package/dist/chunk/{IXT445LX.jsx → YQK6OTY6.jsx} +2 -2
  25. package/dist/{client-DoCsuJj3.d.ts → client-Da9ye3z4.d.ts} +97 -2
  26. package/dist/flows/index.d.ts +190 -2
  27. package/dist/flows/index.js +6 -6
  28. package/dist/flows/index.jsx +30 -8
  29. package/dist/index/index.d.ts +2 -2
  30. package/dist/index/index.js +7 -7
  31. package/dist/index/index.jsx +33 -9
  32. package/dist/pages/index.d.ts +1 -1
  33. package/dist/pages/index.js +5 -5
  34. package/dist/pages/index.jsx +5 -5
  35. package/dist/stores/index.d.ts +1 -1
  36. package/dist/stores/index.js +2 -2
  37. package/dist/stores/index.jsx +2 -2
  38. package/package.json +1 -1
  39. package/dist/chunk/U426ASG4.js.map +0 -1
  40. package/dist/chunk/XNP3VLLY.js.map +0 -1
  41. package/dist/chunk/YK2Y76A4.js.map +0 -1
@@ -1,4 +1,4 @@
1
- export { A as AddressVerifyResult, a as AdminApexDrug, b as AdminApexItemStatus, c as AdminBillingAttempt, d as AdminCategory, e as AdminCategoryInput, f as AdminCategoryUpdate, g as AdminCustomer, h as AdminCustomerFacts, i as AdminCustomerFunnel, j as AdminCustomerListParams, k as AdminCustomerOverview, l as AdminCustomerProfile, m as AdminCustomerRequest, n as AdminCustomerRow, o as AdminCustomerSupport, p as AdminCustomerSupportThread, q as AdminDashboardStats, r as AdminLifecycle, s as AdminLifecycleBucket, t as AdminListParams, u as AdminOffer, v as AdminOfferBase, w as AdminOfferGrant, x as AdminOfferGrantBase, y as AdminOfferInput, z as AdminOrderSummary, B as AdminOrphanReason, C as AdminOrphanedDosePrice, D as AdminPayment, E as AdminPaymentDetail, F as AdminProduct, G as AdminProductOverlayField, H as AdminProductStrength, I as AdminPromoCode, J as AdminPromoCodeInput, K as AdminRecurringPricePoint, L as AdminRecurringRevenue, M as AdminRefundResult, N as AdminSale, O as AdminSaleInput, P as AdminScheduledRefund, Q as AdminScheduledRefundProblem, R as AdminSubscription, S as AdminSubscriptionDetail, T as AdminSubscriptionPatch, U as AdminSubscriptionWriteResult, V as AdminSupportCustomer, W as AdminSupportStats, X as AdminSupportThread, Y as AdminWebhookEvent, Z as Affiliate, _ as AffiliateAuthTokens, $ as AffiliateClickRecord, a0 as AffiliateConversion, a1 as AffiliateDashboardLinks, a2 as AffiliateDashboardProfile, a3 as AffiliateDashboardStats, a4 as AffiliateDownlineMember, a5 as AffiliateEarningsBreakdown, a6 as AffiliatePaymentMethod, a7 as AffiliateProgram, a8 as AffiliateRegisterInput, a9 as AffiliateRegisterResponse, aa as AffiliateSession, ab as AffiliateStatsResponse, ac as AffiliateStatus, ad as AffiliateTrackResponse, ae as ApiError, af as ApiResponse, ag as AttributionMethod, ah as AuthTokens, ai as BillingReminderSettings, aj as CatalogAvailabilityItem, ak as CatalogAvailabilityReason, al as CatalogAvailabilityResult, am as CatalogClassification, an as CatalogConversionChoice, ao as CatalogConversionCommitResult, ap as CatalogConversionDose, aq as CatalogConversionDoseMatch, ar as CatalogConversionFinding, as as CatalogConversionPointers, at as CatalogConversionPrepareResult, au as CatalogConversionPreview, av as CatalogConversionRun, aw as CatalogConversionSource, ax as CatalogConversionStage, ay as CatalogConversionTarget, az as CatalogConversionUndoOptions, aA as CatalogConversionUndoResult, aB as CatalogDose, aC as CatalogDoseInput, aD as CatalogDoseModel, aE as CatalogDoseSuggestion, aF as CatalogDoseSuggestions, aG as CatalogEquivalentSuggestions, aH as CatalogFulfillment, aI as CatalogFulfillmentInput, aJ as CatalogItem, aK as CatalogItemInput, aL as CatalogMappableDrug, aM as CatalogMatrixCell, aN as CatalogProduct, aO as CatalogReadiness, aP as CategoryMetadata, aQ as CheckoutAddress, aR as CheckoutPayload, aS as CheckoutResult, aT as CommissionConfig, aU as CommissionStatus, aV as CompleteSurveyPayload, aW as CreateAffiliatePayload, aX as CreateAffiliateProgramPayload, aY as CreateOrderPayload, aZ as CreateRequestPayload, a_ as CreateSubscriptionPayload, a$ as CustomTemplate, b0 as CustomTemplateInput, b1 as CustomerDiscountConfig, b2 as DeliveryInfo, b3 as DiscountType, b4 as EmailNotificationSettings, b5 as EmailTemplatesMap, b6 as LoginPayload, b7 as MemberOffer, b8 as MemberPrescriptionRequest, b9 as MemberSurveyMode, ba as MemberSurveyResponseSummary, bb as MemberSurveyTranscript, bc as MemberSurveyTranscriptItem, bd as MemberSurveyTranscriptSection, be as MembersMeResponse, bf as OfferGrantState, bg as Order, bh as OrderItemInput, bi as PaginationParams, bj as PaymentCallbackPayload, bk as PaymentInitiatePayload, bl as PaymentType, bm as PendingRenewalSurvey, bn as Placeholder, bo as PlaceholderKind, bp as ProductSaleSummary, bq as PromoValidationResponse, br as PublicCategory, bs as RegisterAndSubscribePayload, bt as RegisterPayload, bu as RenewalStatus, bv as SUPPORT_ATTACHMENT_MAX_BYTES, bw as SUPPORT_ATTACHMENT_MIME_TYPES, bx as SelectDrugPayload, by as SendMessagePayload, bz as SendToPharmacyPayload, bA as SubscriptionPreview, bB as SubscriptionPreviewLine, bC as SubscriptionPreviewPayload, bD as SupportAttachment, bE as SupportChannel, bF as SupportChannelSettings, bG as SupportMessage, bH as SupportRealtimeToken, bI as SupportThread, bJ as SupportThreadCategory, bK as SupportThreadStatus, bL as SurveySubmitPayload, bM as TemplatePlaceholdersMap, bN as TemplateText, bO as TenantFeature, bP as TenantFeatureAccess, bQ as TokenTrackName, bR as UpdateAffiliatePayload, bS as UpdateAffiliateProgramPayload, bT as UpdatePaymentMethodPayload, bU as UpdateProfilePayload, bV as User, bW as addressesApi, bX as adminAffiliatesApi, bY as adminApi, bZ as adminCatalogApi, b_ as adminCatalogConversionApi, b$ as affiliateAuthStorageKey, c0 as affiliatePortalApi, c1 as apexApi, c2 as apiFetch, c3 as authApi, c4 as authStorageKey, c5 as catalogApi, c6 as clearAffiliateTokens, c7 as clearTokens, c8 as getAffiliateTokens, c9 as getTokens, ca as membersApi, cb as messagesApi, cc as newIdempotencyKey, cd as offersApi, ce as onTokensCleared, cf as ordersApi, cg as paymentsApi, ch as productsApi, ci as promoCodesApi, cj as setAffiliateTokens, ck as setTokens, cl as subscriptionsApi, cm as supportApi, cn as usersApi } from '../client-DoCsuJj3.js';
1
+ export { A as AddPharmacyBody, a as AddPharmacyFinding, b as AddPharmacyPlan, c as AddPharmacyPrice, d as AddPharmacyResult, e as AddPharmacyStrengthAfter, f as AddPharmacyStrengthBefore, g as AddressVerifyResult, h as AdminApexDrug, i as AdminApexItemStatus, j as AdminBillingAttempt, k as AdminCategory, l as AdminCategoryInput, m as AdminCategoryUpdate, n as AdminCustomer, o as AdminCustomerFacts, p as AdminCustomerFunnel, q as AdminCustomerListParams, r as AdminCustomerOverview, s as AdminCustomerProfile, t as AdminCustomerRequest, u as AdminCustomerRow, v as AdminCustomerSupport, w as AdminCustomerSupportThread, x as AdminDashboardStats, y as AdminLifecycle, z as AdminLifecycleBucket, B as AdminListParams, C as AdminOffer, D as AdminOfferBase, E as AdminOfferGrant, F as AdminOfferGrantBase, G as AdminOfferInput, H as AdminOrderSummary, I as AdminOrphanReason, J as AdminOrphanedDosePrice, K as AdminPayment, L as AdminPaymentDetail, M as AdminProduct, N as AdminProductOverlayField, O as AdminProductPharmacy, P as AdminProductStrength, Q as AdminPromoCode, R as AdminPromoCodeInput, S as AdminRecurringPricePoint, T as AdminRecurringRevenue, U as AdminRefundResult, V as AdminSale, W as AdminSaleInput, X as AdminScheduledRefund, Y as AdminScheduledRefundProblem, Z as AdminSubscription, _ as AdminSubscriptionDetail, $ as AdminSubscriptionPatch, a0 as AdminSubscriptionWriteResult, a1 as AdminSupportCustomer, a2 as AdminSupportStats, a3 as AdminSupportThread, a4 as AdminWebhookEvent, a5 as Affiliate, a6 as AffiliateAuthTokens, a7 as AffiliateClickRecord, a8 as AffiliateConversion, a9 as AffiliateDashboardLinks, aa as AffiliateDashboardProfile, ab as AffiliateDashboardStats, ac as AffiliateDownlineMember, ad as AffiliateEarningsBreakdown, ae as AffiliatePaymentMethod, af as AffiliateProgram, ag as AffiliateRegisterInput, ah as AffiliateRegisterResponse, ai as AffiliateSession, aj as AffiliateStatsResponse, ak as AffiliateStatus, al as AffiliateTrackResponse, am as ApiError, an as ApiResponse, ao as AttributionMethod, ap as AuthTokens, aq as BillingReminderSettings, ar as CatalogAvailabilityItem, as as CatalogAvailabilityReason, at as CatalogAvailabilityResult, au as CatalogClassification, av as CatalogConversionChoice, aw as CatalogConversionCommitResult, ax as CatalogConversionDose, ay as CatalogConversionDoseMatch, az as CatalogConversionFinding, aA as CatalogConversionPointers, aB as CatalogConversionPrepareResult, aC as CatalogConversionPreview, aD as CatalogConversionRun, aE as CatalogConversionSource, aF as CatalogConversionStage, aG as CatalogConversionTarget, aH as CatalogConversionUndoOptions, aI as CatalogConversionUndoResult, aJ as CatalogDose, aK as CatalogDoseInput, aL as CatalogDoseModel, aM as CatalogDoseSuggestion, aN as CatalogDoseSuggestions, aO as CatalogEquivalentSuggestions, aP as CatalogFulfillment, aQ as CatalogFulfillmentInput, aR as CatalogItem, aS as CatalogItemInput, aT as CatalogMappableDrug, aU as CatalogMatrixCell, aV as CatalogProduct, aW as CatalogReadiness, aX as CategoryMetadata, aY as CheckoutAddress, aZ as CheckoutPayload, a_ as CheckoutResult, a$ as CommissionConfig, b0 as CommissionStatus, b1 as CompleteSurveyPayload, b2 as CreateAffiliatePayload, b3 as CreateAffiliateProgramPayload, b4 as CreateOrderPayload, b5 as CreateRequestPayload, b6 as CreateSubscriptionPayload, b7 as CustomTemplate, b8 as CustomTemplateInput, b9 as CustomerDiscountConfig, ba as DeliveryInfo, bb as DiscountType, bc as EmailNotificationSettings, bd as EmailTemplatesMap, be as LoginPayload, bf as MemberOffer, bg as MemberPrescriptionRequest, bh as MemberSurveyMode, bi as MemberSurveyResponseSummary, bj as MemberSurveyTranscript, bk as MemberSurveyTranscriptItem, bl as MemberSurveyTranscriptSection, bm as MembersMeResponse, bn as OfferGrantState, bo as Order, bp as OrderItemInput, bq as PaginationParams, br as PaymentCallbackPayload, bs as PaymentInitiatePayload, bt as PaymentType, bu as PendingRenewalSurvey, bv as Placeholder, bw as PlaceholderKind, bx as ProductSaleSummary, by as PromoValidationResponse, bz as PublicCategory, bA as RegisterAndSubscribePayload, bB as RegisterPayload, bC as RenewalStatus, bD as SUPPORT_ATTACHMENT_MAX_BYTES, bE as SUPPORT_ATTACHMENT_MIME_TYPES, bF as SelectDrugPayload, bG as SendMessagePayload, bH as SendToPharmacyPayload, bI as SubscriptionPreview, bJ as SubscriptionPreviewLine, bK as SubscriptionPreviewPayload, bL as SupportAttachment, bM as SupportChannel, bN as SupportChannelSettings, bO as SupportMessage, bP as SupportRealtimeToken, bQ as SupportThread, bR as SupportThreadCategory, bS as SupportThreadStatus, bT as SurveySubmitPayload, bU as TemplatePlaceholdersMap, bV as TemplateText, bW as TenantFeature, bX as TenantFeatureAccess, bY as TokenTrackName, bZ as UpdateAffiliatePayload, b_ as UpdateAffiliateProgramPayload, b$ as UpdatePaymentMethodPayload, c0 as UpdateProfilePayload, c1 as User, c2 as addressesApi, c3 as adminAffiliatesApi, c4 as adminApi, c5 as adminCatalogApi, c6 as adminCatalogConversionApi, c7 as adminProductPharmaciesApi, c8 as affiliateAuthStorageKey, c9 as affiliatePortalApi, ca as apexApi, cb as apiFetch, cc as authApi, cd as authStorageKey, ce as catalogApi, cf as clearAffiliateTokens, cg as clearTokens, ch as getAffiliateTokens, ci as getTokens, cj as membersApi, ck as messagesApi, cl as newIdempotencyKey, cm as offersApi, cn as onTokensCleared, co as ordersApi, cp as paymentsApi, cq as productsApi, cr as promoCodesApi, cs as setAffiliateTokens, ct as setTokens, cu as subscriptionsApi, cv as supportApi, cw as usersApi } from '../client-Da9ye3z4.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 captureAuthHeader, h as cartId, i as fetchCartConfig, j as fetchFunnelConfig, k as fetchResumedCart, l as fetchResumedDraft, m as funnelSessionId, p as peekFunnelSessionId, n as postCartSnapshot, o as postFunnelEvent, r as readCartToken, q as readResumeToken, s as resetCartConfigCache, t as resetCartId, u as resetFunnelConfigCache, v as saveFunnelDraft, w as stripCartToken, x as stripResumeToken } from '../cart-BwUwSzWh.js';
4
4
 
package/dist/api/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import '../chunk/JSHO46VZ.js';
2
- export { adoptCartId, capturePromoCode, cartId, clearPromoCode, fetchCartConfig, fetchResumedCart, postCartSnapshot, readCartToken, readPromoCode, resetCartConfigCache, resetCartId, stripCartToken } from '../chunk/B5722F4T.js';
2
+ export { adoptCartId, capturePromoCode, cartId, clearPromoCode, fetchCartConfig, fetchResumedCart, postCartSnapshot, readCartToken, readPromoCode, resetCartConfigCache, resetCartId, stripCartToken } from '../chunk/KADMJCZL.js';
3
3
  export { EmbedApiError2 as ApexV2ApiError, EmbedApiError, createEmbedApiClient, disqualificationReasonText, disqualifiedDrugIds, qualifiedDrugIds } from '../chunk/LZWA44KD.js';
4
- export { adoptFunnelSessionId, captureAuthHeader, fetchFunnelConfig, fetchResumedDraft, funnelSessionId, peekFunnelSessionId, postFunnelEvent, readResumeToken, resetFunnelConfigCache, saveFunnelDraft, stripResumeToken } from '../chunk/GYEK4TSP.js';
5
- export { ApiError, SUPPORT_ATTACHMENT_MAX_BYTES, SUPPORT_ATTACHMENT_MIME_TYPES, addressesApi, adminAffiliatesApi, adminApi, adminCatalogApi, adminCatalogConversionApi, affiliateAuthStorageKey, affiliatePortalApi, apexApi, apiFetch, authApi, authStorageKey, captureAffiliateRef, catalogApi, clearAffiliateRef, clearAffiliateTokens, clearTokens, getAffiliateTokens, getTokens, membersApi, messagesApi, newIdempotencyKey, offersApi, onTokensCleared, ordersApi, paymentsApi, productsApi, promoCodesApi, readAffiliateRef, setAffiliateTokens, setTokens, subscriptionsApi, supportApi, usersApi } from '../chunk/U426ASG4.js';
4
+ export { adoptFunnelSessionId, captureAuthHeader, fetchFunnelConfig, fetchResumedDraft, funnelSessionId, peekFunnelSessionId, postFunnelEvent, readResumeToken, resetFunnelConfigCache, saveFunnelDraft, stripResumeToken } from '../chunk/2CHHHNFT.js';
5
+ export { ApiError, SUPPORT_ATTACHMENT_MAX_BYTES, SUPPORT_ATTACHMENT_MIME_TYPES, addressesApi, adminAffiliatesApi, adminApi, adminCatalogApi, adminCatalogConversionApi, adminProductPharmaciesApi, affiliateAuthStorageKey, affiliatePortalApi, apexApi, apiFetch, authApi, authStorageKey, captureAffiliateRef, catalogApi, clearAffiliateRef, clearAffiliateTokens, clearTokens, getAffiliateTokens, getTokens, membersApi, messagesApi, newIdempotencyKey, offersApi, onTokensCleared, ordersApi, paymentsApi, productsApi, promoCodesApi, readAffiliateRef, setAffiliateTokens, setTokens, subscriptionsApi, supportApi, usersApi } from '../chunk/ISC5GVA2.js';
6
6
  import '../chunk/2IFPDU4D.js';
7
7
  //# sourceMappingURL=index.js.map
8
8
  //# sourceMappingURL=index.js.map
@@ -12,7 +12,7 @@ import {
12
12
  resetCartConfigCache,
13
13
  resetCartId,
14
14
  stripCartToken
15
- } from "../chunk/IXT445LX.jsx";
15
+ } from "../chunk/YQK6OTY6.jsx";
16
16
  import {
17
17
  EmbedApiError,
18
18
  EmbedApiError2,
@@ -33,7 +33,7 @@ import {
33
33
  resetFunnelConfigCache,
34
34
  saveFunnelDraft,
35
35
  stripResumeToken
36
- } from "../chunk/4YJF3J74.jsx";
36
+ } from "../chunk/6QI7MVTN.jsx";
37
37
  import {
38
38
  ApiError,
39
39
  SUPPORT_ATTACHMENT_MAX_BYTES,
@@ -43,6 +43,7 @@ import {
43
43
  adminApi,
44
44
  adminCatalogApi,
45
45
  adminCatalogConversionApi,
46
+ adminProductPharmaciesApi,
46
47
  affiliateAuthStorageKey,
47
48
  affiliatePortalApi,
48
49
  apexApi,
@@ -71,7 +72,7 @@ import {
71
72
  subscriptionsApi,
72
73
  supportApi,
73
74
  usersApi
74
- } from "../chunk/MH43RC7G.jsx";
75
+ } from "../chunk/3CWWN7H2.jsx";
75
76
  import "../chunk/QVZ7BRNO.jsx";
76
77
  export {
77
78
  EmbedApiError2 as ApexV2ApiError,
@@ -84,6 +85,7 @@ export {
84
85
  adminApi,
85
86
  adminCatalogApi,
86
87
  adminCatalogConversionApi,
88
+ adminProductPharmaciesApi,
87
89
  adoptCartId,
88
90
  adoptFunnelSessionId,
89
91
  affiliateAuthStorageKey,
@@ -1,4 +1,4 @@
1
- import { getTokens } from './U426ASG4.js';
1
+ import { getTokens } from './ISC5GVA2.js';
2
2
  import { getConfig } from './2IFPDU4D.js';
3
3
 
4
4
  // src/api/funnel.ts
@@ -138,5 +138,5 @@ function stripResumeToken() {
138
138
  }
139
139
 
140
140
  export { adoptFunnelSessionId, captureAuthHeader, fetchFunnelConfig, fetchResumedDraft, funnelSessionId, peekFunnelSessionId, postFunnelEvent, readResumeToken, resetFunnelConfigCache, saveFunnelDraft, stripResumeToken };
141
- //# sourceMappingURL=GYEK4TSP.js.map
142
- //# sourceMappingURL=GYEK4TSP.js.map
141
+ //# sourceMappingURL=2CHHHNFT.js.map
142
+ //# sourceMappingURL=2CHHHNFT.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/api/funnel.ts"],"names":[],"mappings":";;;;AAmBA,IAAM,WAAyB,EAAE,SAAA,EAAW,OAAO,SAAA,EAAW,KAAA,EAAO,mBAAmB,KAAA,EAAM;AAE9F,IAAI,aAAA,GAA8C,IAAA;AAM3C,SAAS,iBAAA,GAA2C;AACzD,EAAA,IAAI,CAAC,aAAA,EAAe;AAClB,IAAA,aAAA,GAAA,CAAiB,YAAY;AAC3B,MA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I,IAAA,EAAK;AAC7B,IAAA,IAAI,CAAC,KAAK,OAAA,IAAW,CAAC,MAAM,OAAA,CAAQ,IAAA,CAAK,OAAO,CAAA,EAAG,OAAO,IAAA;AAC1D,IAAA,OAAO;AAAA,MACL,SAAA,EAAW,MAAA,CAAO,IAAA,CAAK,SAAA,IAAa,EAAE,CAAA;AAAA,MACtC,SAAS,IAAA,CAAK,OAAA;AAAA,MACd,SAAS,IAAA,CAAK,OAAA;AAAA,MACd,WAAW,OAAO,IAAA,CAAK,SAAA,KAAc,QAAA,GAAW,KAAK,SAAA,GAAY;AAAA,KACnE;AAAA,EACF,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,IAAA;AAAA,EACT;AACF;AAGO,SAAS,eAAA,GAAiC;AAC/C,EAAA,IAAI;AACF,IAAA,MAAM,KAAA,GAAQ,IAAI,eAAA,CAAgB,MAAA,CAAO,SAAS,MAAM,CAAA,CAAE,IAAI,QAAQ,CAAA;AACtE,IAAA,OAAO,KAAA,IAAS,KAAA,CAAM,MAAA,GAAS,CAAA,GAAI,KAAA,GAAQ,IAAA;AAAA,EAC7C,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,IAAA;AAAA,EACT;AACF;AAYO,SAAS,gBAAA,GAAyB;AACvC,EAAA,IAAI;AACF,IAAA,MAAM,GAAA,GAAM,IAAI,GAAA,CAAI,MAAA,CAAO,SAAS,IAAI,CAAA;AACxC,IAAA,IAAI,CAAC,GAAA,CAAI,YAAA,CAAa,GAAA,CAAI,QAAQ,CAAA,EAAG;AACrC,IAAA,GAAA,CAAI,YAAA,CAAa,OAAO,QAAQ,CAAA;AAChC,IAAA,MAAA,CAAO,QAAQ,YAAA,CAAa,IAAI,EAAA,EAAI,GAAA,CAAI,UAAU,CAAA;AAAA,EACpD,CAAA,CAAA,MAAQ;AAAA,EAER;AACF","file":"GYEK4TSP.js","sourcesContent":["import { getConfig } from '../config';\nimport { getTokens } from './client';\n\n// ── Funnel telemetry transport ──────────────────────────────────────────────\n//\n// Thin client for the-backend's abandoned-funnel capture endpoints:\n// GET /config/funnel → which capture features this tenant enabled\n// POST /funnel/events → survey-session telemetry sink\n//\n// Everything here is fire-and-forget and fail-silent: funnel capture is\n// marketing instrumentation, and it must never break or slow the survey.\n\nexport interface FunnelConfig {\n telemetry: boolean;\n emailGate: boolean;\n /** When true (tenant features.funnelEmailGateRequired), the gate offers no skip. */\n emailGateRequired: boolean;\n}\n\nconst DISABLED: FunnelConfig = { telemetry: false, emailGate: false, emailGateRequired: false };\n\nlet configPromise: Promise<FunnelConfig> | null = null;\n\n/**\n * The tenant's funnel-capture posture, fetched once per page load and cached.\n * Fails closed: any error reads as \"both off\".\n */\nexport function fetchFunnelConfig(): Promise<FunnelConfig> {\n if (!configPromise) {\n configPromise = (async () => {\n try {\n const cfg = getConfig();\n const res = await fetch(`${cfg.apiBase}/config/funnel`, {\n headers: { 'X-Tenant-Key': cfg.tenantKey },\n });\n if (!res.ok) return DISABLED;\n const body = (await res.json()) as Partial<FunnelConfig>;\n return {\n telemetry: body.telemetry === true,\n emailGate: body.emailGate === true,\n emailGateRequired: body.emailGateRequired === true,\n };\n } catch {\n return DISABLED;\n }\n })();\n }\n return configPromise;\n}\n\n/**\n * Continue an existing funnel session (resume-from-email): the emailed link\n * identifies the session that already holds this person's email and reminder\n * history, so adopting its id keeps everything on one row instead of forking a\n * new one that looks like a brand-new visitor.\n */\nexport function adoptFunnelSessionId(id: string): void {\n if (!id) return;\n try {\n sessionStorage.setItem(sessionIdKey(), id);\n } catch {\n /* storage unavailable — the session stays ephemeral */\n }\n}\n\n/** Test seam: forget the cached config so the next fetch re-resolves. */\nexport function resetFunnelConfigCache(): void {\n configPromise = null;\n}\n\nconst sessionIdKey = () => `${getConfig().storagePrefix}-funnel-session`;\n\n/**\n * Stable id for this survey session, minted on first use and kept in\n * sessionStorage — a refresh continues the same session (matching the survey\n * draft's resume behavior); a new tab or browser session starts a new one.\n */\nexport function funnelSessionId(): string {\n let id: string | null = null;\n try {\n id = sessionStorage.getItem(sessionIdKey());\n } catch {\n /* storage unavailable (private mode) — fall through to ephemeral id */\n }\n if (!id) {\n id =\n typeof crypto !== 'undefined' && 'randomUUID' in crypto\n ? crypto.randomUUID()\n : `${Date.now()}-${Math.random().toString(36).slice(2)}`;\n try {\n sessionStorage.setItem(sessionIdKey(), id);\n } catch {\n /* ephemeral it is */\n }\n }\n return id;\n}\n\n/**\n * The current survey session id, or null — WITHOUT minting one.\n *\n * `funnelSessionId()` creates an id on first read, which is right for the\n * survey (asking means a survey is starting) and wrong for anything else. Cart\n * capture uses this to say \"if this shopper also has a survey session, here it\n * is\" — letting the backend borrow the email the gate already collected —\n * without conjuring survey sessions on a storefront that never runs one.\n */\nexport function peekFunnelSessionId(): string | null {\n try {\n return sessionStorage.getItem(sessionIdKey());\n } catch {\n return null;\n }\n}\n\n/**\n * The member's access token, when this browser has one.\n *\n * Read raw and never refreshed: these are fire-and-forget telemetry posts, and\n * a token refresh is a real network round-trip on the unload path. An expired\n * token is not a failure either — the sinks take it with `optionalAuth`, so a\n * stale one simply reads as an anonymous visitor, which is what we had before.\n */\nexport function captureAuthHeader(): Record<string, string> {\n try {\n const token = getTokens()?.accessToken;\n return token ? { Authorization: `Bearer ${token}` } : {};\n } catch {\n return {};\n }\n}\n\n/**\n * Fire-and-forget event post. `keepalive` lets the request survive a page\n * unload — which is exactly when the `abandoned` event is sent. (This is why\n * it's `fetch` and not `navigator.sendBeacon`: beacons can't carry the\n * X-Tenant-Key header the tenant-scoped mount requires — nor the bearer token\n * below.)\n *\n * The token identifies a signed-in member to the sink. Without it a member's\n * session is stored anonymously, and the pre-survey email gate — the only\n * other writer of a session's identity — is deliberately never shown to\n * someone already signed in, so their drop-off could never be attributed to\n * them. That is the whole population of a site where the account is created\n * before the questionnaire (savings-program signups, returning members\n * starting a second intake).\n */\nexport function postFunnelEvent(type: string, data?: Record<string, unknown>): void {\n try {\n const cfg = getConfig();\n void fetch(`${cfg.apiBase}/funnel/events`, {\n method: 'POST',\n keepalive: true,\n headers: {\n 'Content-Type': 'application/json',\n 'X-Tenant-Key': cfg.tenantKey,\n ...captureAuthHeader(),\n },\n body: JSON.stringify({ sessionId: funnelSessionId(), type, data }),\n }).catch(() => {});\n } catch {\n /* not configured yet — drop */\n }\n}\n\n// ── Survey drafts (cross-device resume) ─────────────────────────────────────\n\nexport interface FunnelDraftPayload {\n answers: Array<{ questionId: string; value: unknown }>;\n stepIndex: number;\n}\n\n/**\n * Save in-progress answers to Apex (through the-backend's embed proxy) and\n * return the draft id, so the next save updates the same row.\n *\n * Answers travel to the CLINICAL system — the partner backend stores only the\n * returned pointer. Returns null on any failure: a draft is best-effort, and\n * losing one costs a retype, never correctness.\n */\nexport async function saveFunnelDraft(\n draft: FunnelDraftPayload & { draftId?: string; drugIds?: string[]; templateId?: string; mode?: string },\n): Promise<string | null> {\n try {\n const cfg = getConfig();\n if (!cfg.apexEmbedApiBase) return null;\n const res = await fetch(`${cfg.apexEmbedApiBase}/v2/embed/surveys/drafts`, {\n method: 'PUT',\n headers: { 'Content-Type': 'application/json', 'X-Tenant-Key': cfg.tenantKey },\n body: JSON.stringify(draft),\n });\n if (!res.ok) return null;\n const body = (await res.json()) as { draftId?: string };\n return body.draftId ?? null;\n } catch {\n return null;\n }\n}\n\nexport interface ResumedDraft extends FunnelDraftPayload {\n sessionId: string;\n draftId: string;\n}\n\n/**\n * Exchange an emailed resume token for the saved answers.\n *\n * The token is the ONLY thing authorizing this read — the-backend verifies its\n * HMAC before fetching from Apex with credentials the browser never sees. A\n * 404 (expired, already submitted, tampered) resolves to null so the caller\n * simply starts a fresh survey.\n */\nexport async function fetchResumedDraft(token: string): Promise<ResumedDraft | null> {\n try {\n const cfg = getConfig();\n const res = await fetch(`${cfg.apiBase}/funnel/resume?token=${encodeURIComponent(token)}`, {\n headers: { 'X-Tenant-Key': cfg.tenantKey },\n });\n if (!res.ok) return null;\n const body = (await res.json()) as Partial<ResumedDraft>;\n if (!body.draftId || !Array.isArray(body.answers)) return null;\n return {\n sessionId: String(body.sessionId ?? ''),\n draftId: body.draftId,\n answers: body.answers,\n stepIndex: typeof body.stepIndex === 'number' ? body.stepIndex : 0,\n };\n } catch {\n return null;\n }\n}\n\n/** Read the `?resume=` token from the current URL. */\nexport function readResumeToken(): string | null {\n try {\n const token = new URLSearchParams(window.location.search).get('resume');\n return token && token.length > 0 ? token : null;\n } catch {\n return null;\n }\n}\n\n/**\n * Drop `?resume=` from the address bar once it has been redeemed.\n *\n * This token authorizes a read of someone's clinical answers, so leaving it in\n * the address bar is worse than leaving the cart's there: it gets bookmarked,\n * pasted into a support chat, or captured by whatever the patient's browser\n * syncs. The answers are mirrored into local storage on redemption, so a\n * refresh resumes from this device without it. History is replaced, not\n * pushed — the token was never a page.\n */\nexport function stripResumeToken(): void {\n try {\n const url = new URL(window.location.href);\n if (!url.searchParams.has('resume')) return;\n url.searchParams.delete('resume');\n window.history.replaceState({}, '', url.toString());\n } catch {\n /* no history API — leaving the param is harmless */\n }\n}\n"]}
1
+ {"version":3,"sources":["../../src/api/funnel.ts"],"names":[],"mappings":";;;;AAmBA,IAAM,WAAyB,EAAE,SAAA,EAAW,OAAO,SAAA,EAAW,KAAA,EAAO,mBAAmB,KAAA,EAAM;AAE9F,IAAI,aAAA,GAA8C,IAAA;AAM3C,SAAS,iBAAA,GAA2C;AACzD,EAAA,IAAI,CAAC,aAAA,EAAe;AAClB,IAAA,aAAA,GAAA,CAAiB,YAAY;AAC3B,MAAA,IAAI;AACF,QAAA,MAAM,MAAM,SAAA,EAAU;AACtB,QAAA,MAAM,MAAM,MAAM,KAAA,CAAM,CAAA,EAAG,GAAA,CAAI,OAAO,CAAA,cAAA,CAAA,EAAkB;AAAA,UACtD,OAAA,EAAS,EAAE,cAAA,EAAgB,GAAA,CAAI,SAAA;AAAU,SAC1C,CAAA;AACD,QAAA,IAAI,CAAC,GAAA,CAAI,EAAA,EAAI,OAAO,QAAA;AACpB,QAAA,MAAM,IAAA,GAAQ,MAAM,GA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SAAA,KAAc,QAAA,GAAW,KAAK,SAAA,GAAY;AAAA,KACnE;AAAA,EACF,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,IAAA;AAAA,EACT;AACF;AAGO,SAAS,eAAA,GAAiC;AAC/C,EAAA,IAAI;AACF,IAAA,MAAM,KAAA,GAAQ,IAAI,eAAA,CAAgB,MAAA,CAAO,SAAS,MAAM,CAAA,CAAE,IAAI,QAAQ,CAAA;AACtE,IAAA,OAAO,KAAA,IAAS,KAAA,CAAM,MAAA,GAAS,CAAA,GAAI,KAAA,GAAQ,IAAA;AAAA,EAC7C,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,IAAA;AAAA,EACT;AACF;AAYO,SAAS,gBAAA,GAAyB;AACvC,EAAA,IAAI;AACF,IAAA,MAAM,GAAA,GAAM,IAAI,GAAA,CAAI,MAAA,CAAO,SAAS,IAAI,CAAA;AACxC,IAAA,IAAI,CAAC,GAAA,CAAI,YAAA,CAAa,GAAA,CAAI,QAAQ,CAAA,EAAG;AACrC,IAAA,GAAA,CAAI,YAAA,CAAa,OAAO,QAAQ,CAAA;AAChC,IAAA,MAAA,CAAO,QAAQ,YAAA,CAAa,IAAI,EAAA,EAAI,GAAA,CAAI,UAAU,CAAA;AAAA,EACpD,CAAA,CAAA,MAAQ;AAAA,EAER;AACF","file":"2CHHHNFT.js","sourcesContent":["import { getConfig } from '../config';\nimport { getTokens } from './client';\n\n// ── Funnel telemetry transport ──────────────────────────────────────────────\n//\n// Thin client for the-backend's abandoned-funnel capture endpoints:\n// GET /config/funnel → which capture features this tenant enabled\n// POST /funnel/events → survey-session telemetry sink\n//\n// Everything here is fire-and-forget and fail-silent: funnel capture is\n// marketing instrumentation, and it must never break or slow the survey.\n\nexport interface FunnelConfig {\n telemetry: boolean;\n emailGate: boolean;\n /** When true (tenant features.funnelEmailGateRequired), the gate offers no skip. */\n emailGateRequired: boolean;\n}\n\nconst DISABLED: FunnelConfig = { telemetry: false, emailGate: false, emailGateRequired: false };\n\nlet configPromise: Promise<FunnelConfig> | null = null;\n\n/**\n * The tenant's funnel-capture posture, fetched once per page load and cached.\n * Fails closed: any error reads as \"both off\".\n */\nexport function fetchFunnelConfig(): Promise<FunnelConfig> {\n if (!configPromise) {\n configPromise = (async () => {\n try {\n const cfg = getConfig();\n const res = await fetch(`${cfg.apiBase}/config/funnel`, {\n headers: { 'X-Tenant-Key': cfg.tenantKey },\n });\n if (!res.ok) return DISABLED;\n const body = (await res.json()) as Partial<FunnelConfig>;\n return {\n telemetry: body.telemetry === true,\n emailGate: body.emailGate === true,\n emailGateRequired: body.emailGateRequired === true,\n };\n } catch {\n return DISABLED;\n }\n })();\n }\n return configPromise;\n}\n\n/**\n * Continue an existing funnel session (resume-from-email): the emailed link\n * identifies the session that already holds this person's email and reminder\n * history, so adopting its id keeps everything on one row instead of forking a\n * new one that looks like a brand-new visitor.\n */\nexport function adoptFunnelSessionId(id: string): void {\n if (!id) return;\n try {\n sessionStorage.setItem(sessionIdKey(), id);\n } catch {\n /* storage unavailable — the session stays ephemeral */\n }\n}\n\n/** Test seam: forget the cached config so the next fetch re-resolves. */\nexport function resetFunnelConfigCache(): void {\n configPromise = null;\n}\n\nconst sessionIdKey = () => `${getConfig().storagePrefix}-funnel-session`;\n\n/**\n * Stable id for this survey session, minted on first use and kept in\n * sessionStorage — a refresh continues the same session (matching the survey\n * draft's resume behavior); a new tab or browser session starts a new one.\n */\nexport function funnelSessionId(): string {\n let id: string | null = null;\n try {\n id = sessionStorage.getItem(sessionIdKey());\n } catch {\n /* storage unavailable (private mode) — fall through to ephemeral id */\n }\n if (!id) {\n id =\n typeof crypto !== 'undefined' && 'randomUUID' in crypto\n ? crypto.randomUUID()\n : `${Date.now()}-${Math.random().toString(36).slice(2)}`;\n try {\n sessionStorage.setItem(sessionIdKey(), id);\n } catch {\n /* ephemeral it is */\n }\n }\n return id;\n}\n\n/**\n * The current survey session id, or null — WITHOUT minting one.\n *\n * `funnelSessionId()` creates an id on first read, which is right for the\n * survey (asking means a survey is starting) and wrong for anything else. Cart\n * capture uses this to say \"if this shopper also has a survey session, here it\n * is\" — letting the backend borrow the email the gate already collected —\n * without conjuring survey sessions on a storefront that never runs one.\n */\nexport function peekFunnelSessionId(): string | null {\n try {\n return sessionStorage.getItem(sessionIdKey());\n } catch {\n return null;\n }\n}\n\n/**\n * The member's access token, when this browser has one.\n *\n * Read raw and never refreshed: these are fire-and-forget telemetry posts, and\n * a token refresh is a real network round-trip on the unload path. An expired\n * token is not a failure either — the sinks take it with `optionalAuth`, so a\n * stale one simply reads as an anonymous visitor, which is what we had before.\n */\nexport function captureAuthHeader(): Record<string, string> {\n try {\n const token = getTokens()?.accessToken;\n return token ? { Authorization: `Bearer ${token}` } : {};\n } catch {\n return {};\n }\n}\n\n/**\n * Fire-and-forget event post. `keepalive` lets the request survive a page\n * unload — which is exactly when the `abandoned` event is sent. (This is why\n * it's `fetch` and not `navigator.sendBeacon`: beacons can't carry the\n * X-Tenant-Key header the tenant-scoped mount requires — nor the bearer token\n * below.)\n *\n * The token identifies a signed-in member to the sink. Without it a member's\n * session is stored anonymously, and the pre-survey email gate — the only\n * other writer of a session's identity — is deliberately never shown to\n * someone already signed in, so their drop-off could never be attributed to\n * them. That is the whole population of a site where the account is created\n * before the questionnaire (savings-program signups, returning members\n * starting a second intake).\n */\nexport function postFunnelEvent(type: string, data?: Record<string, unknown>): void {\n try {\n const cfg = getConfig();\n void fetch(`${cfg.apiBase}/funnel/events`, {\n method: 'POST',\n keepalive: true,\n headers: {\n 'Content-Type': 'application/json',\n 'X-Tenant-Key': cfg.tenantKey,\n ...captureAuthHeader(),\n },\n body: JSON.stringify({ sessionId: funnelSessionId(), type, data }),\n }).catch(() => {});\n } catch {\n /* not configured yet — drop */\n }\n}\n\n// ── Survey drafts (cross-device resume) ─────────────────────────────────────\n\nexport interface FunnelDraftPayload {\n answers: Array<{ questionId: string; value: unknown }>;\n stepIndex: number;\n}\n\n/**\n * Save in-progress answers to Apex (through the-backend's embed proxy) and\n * return the draft id, so the next save updates the same row.\n *\n * Answers travel to the CLINICAL system — the partner backend stores only the\n * returned pointer. Returns null on any failure: a draft is best-effort, and\n * losing one costs a retype, never correctness.\n */\nexport async function saveFunnelDraft(\n draft: FunnelDraftPayload & { draftId?: string; drugIds?: string[]; templateId?: string; mode?: string },\n): Promise<string | null> {\n try {\n const cfg = getConfig();\n if (!cfg.apexEmbedApiBase) return null;\n const res = await fetch(`${cfg.apexEmbedApiBase}/v2/embed/surveys/drafts`, {\n method: 'PUT',\n headers: { 'Content-Type': 'application/json', 'X-Tenant-Key': cfg.tenantKey },\n body: JSON.stringify(draft),\n });\n if (!res.ok) return null;\n const body = (await res.json()) as { draftId?: string };\n return body.draftId ?? null;\n } catch {\n return null;\n }\n}\n\nexport interface ResumedDraft extends FunnelDraftPayload {\n sessionId: string;\n draftId: string;\n}\n\n/**\n * Exchange an emailed resume token for the saved answers.\n *\n * The token is the ONLY thing authorizing this read — the-backend verifies its\n * HMAC before fetching from Apex with credentials the browser never sees. A\n * 404 (expired, already submitted, tampered) resolves to null so the caller\n * simply starts a fresh survey.\n */\nexport async function fetchResumedDraft(token: string): Promise<ResumedDraft | null> {\n try {\n const cfg = getConfig();\n const res = await fetch(`${cfg.apiBase}/funnel/resume?token=${encodeURIComponent(token)}`, {\n headers: { 'X-Tenant-Key': cfg.tenantKey },\n });\n if (!res.ok) return null;\n const body = (await res.json()) as Partial<ResumedDraft>;\n if (!body.draftId || !Array.isArray(body.answers)) return null;\n return {\n sessionId: String(body.sessionId ?? ''),\n draftId: body.draftId,\n answers: body.answers,\n stepIndex: typeof body.stepIndex === 'number' ? body.stepIndex : 0,\n };\n } catch {\n return null;\n }\n}\n\n/** Read the `?resume=` token from the current URL. */\nexport function readResumeToken(): string | null {\n try {\n const token = new URLSearchParams(window.location.search).get('resume');\n return token && token.length > 0 ? token : null;\n } catch {\n return null;\n }\n}\n\n/**\n * Drop `?resume=` from the address bar once it has been redeemed.\n *\n * This token authorizes a read of someone's clinical answers, so leaving it in\n * the address bar is worse than leaving the cart's there: it gets bookmarked,\n * pasted into a support chat, or captured by whatever the patient's browser\n * syncs. The answers are mirrored into local storage on redemption, so a\n * refresh resumes from this device without it. History is replaced, not\n * pushed — the token was never a page.\n */\nexport function stripResumeToken(): void {\n try {\n const url = new URL(window.location.href);\n if (!url.searchParams.has('resume')) return;\n url.searchParams.delete('resume');\n window.history.replaceState({}, '', url.toString());\n } catch {\n /* no history API — leaving the param is harmless */\n }\n}\n"]}
@@ -289,12 +289,16 @@ var ApiError = class extends Error {
289
289
  /** Machine-readable error code from the response body, when the endpoint
290
290
  * sends one (e.g. `SUBSCRIPTION_EXISTS`). Branch on this, never on message. */
291
291
  code;
292
+ /** The response body's `details`, untouched, for the few refusals whose
293
+ * specifics a caller acts on (e.g. which prices are missing). Never shown as prose. */
294
+ details;
292
295
  constructor(message, opts = {}) {
293
296
  super(message);
294
297
  this.name = "ApiError";
295
298
  this.status = opts.status;
296
299
  this.ambiguous = opts.ambiguous ?? false;
297
300
  this.code = opts.code;
301
+ this.details = opts.details;
298
302
  if (opts.cause !== void 0) this.cause = opts.cause;
299
303
  }
300
304
  };
@@ -371,10 +375,12 @@ async function coreFetch(endpoint, fetchOpts, track, call = {}) {
371
375
  if (!res.ok) {
372
376
  let errorMsg = `Request failed: ${res.status}`;
373
377
  let errorCode;
378
+ let errorDetails;
374
379
  try {
375
380
  const body = await res.json();
376
381
  errorMsg = body.error || body.message || errorMsg;
377
382
  errorCode = typeof body.code === "string" ? body.code : void 0;
383
+ errorDetails = body.details;
378
384
  if (track.enrichErrorDetails && Array.isArray(body.details) && body.details.length > 0) {
379
385
  const lines = body.details.map(
380
386
  (d) => typeof d === "string" ? d : d?.message
@@ -386,7 +392,12 @@ async function coreFetch(endpoint, fetchOpts, track, call = {}) {
386
392
  if (res.status === 403 && /recaptcha/i.test(errorMsg)) {
387
393
  errorMsg = "We couldn\u2019t verify you\u2019re human. Please refresh the page and try again.";
388
394
  }
389
- throw new ApiError(errorMsg, { status: res.status, ambiguous: res.status >= 500, code: errorCode });
395
+ throw new ApiError(errorMsg, {
396
+ status: res.status,
397
+ ambiguous: res.status >= 500,
398
+ code: errorCode,
399
+ ...errorDetails !== void 0 ? { details: errorDetails } : {}
400
+ });
390
401
  }
391
402
  if (res.status === 204) return void 0;
392
403
  return await res.json();
@@ -946,6 +957,17 @@ var adminCatalogConversionApi = {
946
957
  return post(`${conversionPath(productId)}/undo`, options);
947
958
  }
948
959
  };
960
+ var productPharmaciesPath = (productId) => `/admin/products/${encodeURIComponent(productId)}/pharmacies`;
961
+ var adminProductPharmaciesApi = {
962
+ /** What adding this pharmacy drug would do. Read-only for the admin; safe to repeat. */
963
+ plan(productId, drugId) {
964
+ return post(`${productPharmaciesPath(productId)}/plan`, { drugId });
965
+ },
966
+ /** Adds it. Up to ~40 seconds on a single-pharmacy product; never retry blindly — re-read the product first. */
967
+ add(productId, body) {
968
+ return post(productPharmaciesPath(productId), body);
969
+ }
970
+ };
949
971
  var adminApi = {
950
972
  getDashboard() {
951
973
  return apiFetch("/admin/dashboard/stats");
@@ -1534,6 +1556,7 @@ export {
1534
1556
  membersApi,
1535
1557
  adminCatalogApi,
1536
1558
  adminCatalogConversionApi,
1559
+ adminProductPharmaciesApi,
1537
1560
  adminApi,
1538
1561
  adminAffiliatesApi,
1539
1562
  affiliateAuthStorageKey,
@@ -1542,4 +1565,4 @@ export {
1542
1565
  clearAffiliateTokens,
1543
1566
  affiliatePortalApi
1544
1567
  };
1545
- //# sourceMappingURL=MH43RC7G.jsx.map
1568
+ //# sourceMappingURL=3CWWN7H2.jsx.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getTokens
3
- } from "./MH43RC7G.jsx";
3
+ } from "./3CWWN7H2.jsx";
4
4
  import {
5
5
  getConfig
6
6
  } from "./QVZ7BRNO.jsx";
@@ -154,4 +154,4 @@ export {
154
154
  readResumeToken,
155
155
  stripResumeToken
156
156
  };
157
- //# sourceMappingURL=4YJF3J74.jsx.map
157
+ //# sourceMappingURL=6QI7MVTN.jsx.map