@apextelemed/partner-core 0.20.0-dev.65 → 0.20.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.
@@ -4457,11 +4457,59 @@ var FORWARDED = /* @__PURE__ */ new Set([
4457
4457
  "step:shown",
4458
4458
  "step:completed",
4459
4459
  "abandoned",
4460
- "submit:succeeded"
4460
+ "submit:succeeded",
4461
+ "disqualified"
4461
4462
  ]);
4463
+ var PATIENT_INFO_STEP_ID = "patient_info";
4464
+ function describeStep(steps, stepIndex) {
4465
+ if (stepIndex === steps.length && steps.length > 0) {
4466
+ return { stepId: PATIENT_INFO_STEP_ID, stepTitle: "Contact information", questions: [] };
4467
+ }
4468
+ const step2 = steps[stepIndex];
4469
+ if (!step2) return null;
4470
+ return {
4471
+ stepId: step2.stepId,
4472
+ stepTitle: step2.stepTitle || void 0,
4473
+ sectionTitle: step2.sectionTitle || void 0,
4474
+ questions: step2.questions.map((q) => q.text).filter((t) => typeof t === "string" && t.trim().length > 0)
4475
+ };
4476
+ }
4477
+ function rejectionReasons(drugResults) {
4478
+ const out = /* @__PURE__ */ new Set();
4479
+ for (const d of drugResults ?? []) {
4480
+ if (d.qualified) continue;
4481
+ const reasons = [...d.disqualificationReasons ?? [], d.disqualificationReason];
4482
+ for (const r of reasons) if (typeof r === "string" && r.trim()) out.add(r.trim());
4483
+ }
4484
+ return [...out];
4485
+ }
4462
4486
  function createFunnelTelemetry() {
4463
4487
  let enabled = null;
4464
4488
  let buffer = [];
4489
+ let source = null;
4490
+ function enrich(e) {
4491
+ if (!source) return e;
4492
+ const data = e.data ?? {};
4493
+ if (e.type === "step:shown" || e.type === "step:completed") {
4494
+ const index = typeof data.stepIndex === "number" ? data.stepIndex : null;
4495
+ const page = index === null ? null : describeStep(source.flatSteps(), index);
4496
+ if (!page) return e;
4497
+ return {
4498
+ ...e,
4499
+ data: e.type === "step:shown" ? { ...data, ...page } : { ...data, stepId: page.stepId }
4500
+ };
4501
+ }
4502
+ if (e.type === "disqualified") {
4503
+ const index = source.stepIndex();
4504
+ const page = describeStep(source.flatSteps(), index);
4505
+ const drugResults = data.drugResults;
4506
+ return {
4507
+ type: e.type,
4508
+ data: { stepIndex: index, stepId: page?.stepId, reasons: rejectionReasons(drugResults) }
4509
+ };
4510
+ }
4511
+ return e;
4512
+ }
4465
4513
  void fetchFunnelConfig().then((cfg) => {
4466
4514
  enabled = cfg.telemetry;
4467
4515
  const pending = buffer;
@@ -4472,8 +4520,12 @@ function createFunnelTelemetry() {
4472
4520
  postFunnelEvent(e.type, e.data ?? void 0);
4473
4521
  }
4474
4522
  return {
4475
- onEvent(e) {
4476
- if (!FORWARDED.has(e.type)) return;
4523
+ attach(s) {
4524
+ source = s;
4525
+ },
4526
+ onEvent(raw) {
4527
+ if (!FORWARDED.has(raw.type)) return;
4528
+ const e = enrich(raw);
4477
4529
  if (enabled === null) {
4478
4530
  if (buffer.length < 50) buffer.push(e);
4479
4531
  return;
@@ -4608,7 +4660,7 @@ function useSurveyV2Flow(opts) {
4608
4660
  templateId: opts.templateId,
4609
4661
  mode: opts.mode
4610
4662
  });
4611
- return useSurveyV2Flow$1({
4663
+ const flow = useSurveyV2Flow$1({
4612
4664
  apiBaseUrl: cfg.apexEmbedApiBase,
4613
4665
  publishableKey: cfg.apexPublishableKey,
4614
4666
  tenantKey: cfg.tenantKey,
@@ -4627,6 +4679,8 @@ function useSurveyV2Flow(opts) {
4627
4679
  },
4628
4680
  onError: opts.onError
4629
4681
  });
4682
+ telemetry.attach({ flatSteps: flow.flatSteps, stepIndex: flow.stepIndex });
4683
+ return flow;
4630
4684
  }
4631
4685
  var PRESCRIPTION_PHOTO_MAX_BYTES = 10 * 1024 * 1024;
4632
4686
  async function uploadPrescriptionPhoto(file) {
@@ -6503,5 +6557,5 @@ function useSmsPreferences() {
6503
6557
  }
6504
6558
 
6505
6559
  export { ACCOUNT_SOURCE_LABEL, DEFAULT_COLOR_PALETTE, LIFECYCLE_BUCKETS, LIFECYCLE_LABEL, LIFECYCLE_TONE, LIVE_SUBSCRIPTION_STATUSES, MATCH_DEPENDENT_WARNINGS, MATCH_HOW_LABEL, ORPHAN_REASON, PHONE_ERROR, READINESS_LABEL, SOURCE_FIELD_NOTE, SUPPORT_CATEGORIES, TERMINAL_SUBSCRIPTION_STATUSES, US_STATES, US_STATE_OPTIONS, accountSource, addCatalogItemAsProduct, applyPriceDrafts, availableStateOptions, availableStates, bestOfferDiscount, buildFulfillmentRows, buildMatrixView, buildRefillView, buildSaveBody, buildStrengthRows, buildTimeline, buildTrackerView, buildTrackingUrl, canLeaveUnmatched, canOfferConversion, captureFunnelEmail, catalogUnavailableMessage, categoryColor, categoryLabel, classifyAddPharmacyError, classifyCatalogError, classifyConversionError, compareStrengths, createCatalogProduct, createFunnelTelemetry, deriveAttention, deriveCatalogAvailabilityDecision, deriveJourney, describeConversion, emailGateAnswered, explainFinding, findStoredDosePrice, firstAddressError, flaggedSubscribers, fmtDay, formatCalendarDate, formatCardNumber, formatConversationTime, formatCvv, formatEventDate, formatExpiry, formatMessageTime, formatRelativeTime, formatStageDate, formatUsPhone, groupDrugsByPharmacy, hasBlockers, hasConversion, hasErrors, hasStateRestrictions, initialMatches, intakeEvidence, invalidDraftKeys, isCatalogItemId, isCssColorValue, isImageAttachment, isLive, isQuestionVisible, isReconcilable, isValidUsPhone, lifecycleReason, liveDoses, lowestPrice, lowestSalePrice, markEmailGateAnswered, matchKey, matchProblem, matchesComplete, missingPrices, moveInOrder, needsReview, normalizeState, normalizeStates, offerBeatsPromo, offerDurationText, offerSummaryText, orphanKey, parseMoney, pharmacyIsOnProduct, pharmacyLabel, primarySubscription, readinessStatus, reconcileCartAgainstCatalog, reconcileCartLines, redeemResumeLink, removeStoredDosePrice, resetResumeRedemption, resolveCategoryColor, resolveStrengthPrices, resolveSurveyV2DrugIntent, salePriceForBase, skuBindingModeFor, sourceKey, sourceLabel, stateAvailabilityNote, strengthsChanged, subscribeToSupportTopic, toChoices, toTrackerRequest, uploadPrescriptionPhoto, upsertDosePrice, useAddPharmacy, useAddressPair, useAffiliateConversions, useAffiliateDownline, useAffiliateLinks, useAffiliateStats, useCardTokenizer, useCartCheckoutFlow, useCartReconcile, useCatalog, useCatalogAvailability, useCatalogConversion, useCheckoutFlow, useDashboardData, useMedicationSelect, useMemberPortalData, useMessagesThread, useProductCatalogEditor, useProductDetail, useRegisterFlow, useSignupFlow, useSmsConsent, useSmsPreferences, useSubscribeFlow, useSurveyFlow, useSurveyV2Flow, useUpdatePaymentMethodFlow, validateAddress, visibleWarnings };
6506
- //# sourceMappingURL=WM5KNUNX.js.map
6507
- //# sourceMappingURL=WM5KNUNX.js.map
6560
+ //# sourceMappingURL=ALIVUPFC.js.map
6561
+ //# sourceMappingURL=ALIVUPFC.js.map