@apextelemed/partner-core 0.16.0-dev.44 → 0.16.0-dev.46

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 (43) hide show
  1. package/README.md +8 -4
  2. package/dist/api/index.d.ts +1 -1
  3. package/dist/api/index.js +3 -3
  4. package/dist/api/index.jsx +3 -3
  5. package/dist/chunk/{HYN2BVTH.jsx → 3XQSYLFD.jsx} +6 -6
  6. package/dist/chunk/{MMPKHKIU.jsx → 4YJF3J74.jsx} +2 -2
  7. package/dist/chunk/{2RWPQQ4A.jsx → A43EPOTF.jsx} +7 -6
  8. package/dist/chunk/{46MIDHRD.js → ATSYHZSR.js} +3 -3
  9. package/dist/chunk/{46MIDHRD.js.map → ATSYHZSR.js.map} +1 -1
  10. package/dist/chunk/{RGFD2T3K.js → B5722F4T.js} +3 -3
  11. package/dist/chunk/{RGFD2T3K.js.map → B5722F4T.js.map} +1 -1
  12. package/dist/chunk/{CXMAV5SC.js → GYEK4TSP.js} +3 -3
  13. package/dist/chunk/{CXMAV5SC.js.map → GYEK4TSP.js.map} +1 -1
  14. package/dist/chunk/{AM5HSKWG.js → IPDABIXO.js} +8 -7
  15. package/dist/chunk/IPDABIXO.js.map +1 -0
  16. package/dist/chunk/{RF6RWN3P.jsx → IXT445LX.jsx} +2 -2
  17. package/dist/chunk/{AO3N6VTS.jsx → MH43RC7G.jsx} +9 -1
  18. package/dist/chunk/{NEV5KNPS.js → U426ASG4.js} +10 -2
  19. package/dist/chunk/U426ASG4.js.map +1 -0
  20. package/dist/chunk/{ONYGQYUN.jsx → VLVSEATQ.jsx} +79 -11
  21. package/dist/chunk/{KK36ZETG.jsx → XEWZ4OIT.jsx} +2 -2
  22. package/dist/chunk/{MPW4IVPB.js → XNP3VLLY.js} +7 -7
  23. package/dist/chunk/XNP3VLLY.js.map +1 -0
  24. package/dist/chunk/{E6KLEFN3.js → YK2Y76A4.js} +80 -12
  25. package/dist/chunk/YK2Y76A4.js.map +1 -0
  26. package/dist/{client-oZcZn-HB.d.ts → client-DoCsuJj3.d.ts} +5 -0
  27. package/dist/flows/index.d.ts +1 -1
  28. package/dist/flows/index.js +6 -6
  29. package/dist/flows/index.jsx +6 -6
  30. package/dist/index/index.d.ts +1 -1
  31. package/dist/index/index.js +7 -7
  32. package/dist/index/index.jsx +7 -7
  33. package/dist/pages/index.d.ts +1 -1
  34. package/dist/pages/index.js +5 -5
  35. package/dist/pages/index.jsx +5 -5
  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/package.json +1 -1
  40. package/dist/chunk/AM5HSKWG.js.map +0 -1
  41. package/dist/chunk/E6KLEFN3.js.map +0 -1
  42. package/dist/chunk/MPW4IVPB.js.map +0 -1
  43. package/dist/chunk/NEV5KNPS.js.map +0 -1
@@ -1,6 +1,6 @@
1
- import { fetchFunnelConfig, postFunnelEvent, readResumeToken, fetchResumedDraft, stripResumeToken, adoptFunnelSessionId, saveFunnelDraft } from './CXMAV5SC.js';
2
- import { cart_default, medication_default, auth_default, affiliateAuth_default } from './46MIDHRD.js';
3
- import { newIdempotencyKey, apexApi, usersApi, addressesApi, catalogApi, paymentsApi, subscriptionsApi, membersApi, supportApi, productsApi, affiliatePortalApi, adminApi, adminCatalogApi, ApiError, ordersApi, adminCatalogConversionApi, messagesApi, authApi } from './NEV5KNPS.js';
1
+ import { fetchFunnelConfig, postFunnelEvent, readResumeToken, fetchResumedDraft, stripResumeToken, adoptFunnelSessionId, saveFunnelDraft } from './GYEK4TSP.js';
2
+ import { cart_default, medication_default, auth_default, affiliateAuth_default } from './ATSYHZSR.js';
3
+ import { newIdempotencyKey, apexApi, usersApi, addressesApi, catalogApi, paymentsApi, subscriptionsApi, membersApi, supportApi, productsApi, affiliatePortalApi, adminApi, adminCatalogApi, ApiError, ordersApi, adminCatalogConversionApi, messagesApi, authApi } from './U426ASG4.js';
4
4
  import { getConfig } from './2IFPDU4D.js';
5
5
  import { createSignal, onMount, createEffect, on, onCleanup, createResource, createMemo } from 'solid-js';
6
6
  import { useSurveyV2Flow as useSurveyV2Flow$1 } from '@apextelemed/survey-solid';
@@ -811,7 +811,7 @@ function useCardTokenizer() {
811
811
  const ready = () => {
812
812
  const cfg = config();
813
813
  if (!cfg) return false;
814
- return cfg.provider === "quickbooks" ? true : scriptLoaded();
814
+ return cfg.provider === "authorizenet" ? scriptLoaded() : true;
815
815
  };
816
816
  const status = () => error() ? "failed" : ready() ? "ready" : "loading";
817
817
  function fail(userMessage, logDetail) {
@@ -829,6 +829,10 @@ function useCardTokenizer() {
829
829
  setConfig({ provider: "quickbooks", tokenizeUrl: raw.tokenizeUrl });
830
830
  return;
831
831
  }
832
+ if (raw.provider === "mxmerchant") {
833
+ setConfig({ provider: "mxmerchant" });
834
+ return;
835
+ }
832
836
  if (!raw.apiLoginId || !raw.clientKey) {
833
837
  fail("Payments are not fully configured for this site yet. Please contact support.");
834
838
  return;
@@ -892,13 +896,34 @@ function useCardTokenizer() {
892
896
  );
893
897
  });
894
898
  }
899
+ function requireBillingAddress(card) {
900
+ const street = card.billing?.street?.trim() ?? "";
901
+ const zip = card.billing?.zip?.trim() ?? "";
902
+ if (!street || !zip) throw new Error("Enter your billing street address and ZIP code.");
903
+ return { street, zip };
904
+ }
895
905
  async function tokenizeQuickBooks(card, cfg) {
896
906
  const { month, year } = splitExpiry(card.expiry);
907
+ const { street, zip } = requireBillingAddress(card);
908
+ const name = [card.billing?.firstName?.trim(), card.billing?.lastName?.trim()].filter(Boolean).join(" ");
897
909
  const res = await fetch(cfg.tokenizeUrl, {
898
910
  method: "POST",
899
911
  headers: { "Content-Type": "application/json" },
900
912
  body: JSON.stringify({
901
- card: { number: card.cardNumber.replace(/\s/g, ""), expMonth: month, expYear: year, cvc: card.cvv }
913
+ card: {
914
+ number: card.cardNumber.replace(/\s/g, ""),
915
+ expMonth: month,
916
+ expYear: year,
917
+ cvc: card.cvv,
918
+ ...name ? { name } : {},
919
+ address: {
920
+ streetAddress: street,
921
+ ...card.billing?.city?.trim() ? { city: card.billing.city.trim() } : {},
922
+ ...card.billing?.state?.trim() ? { region: card.billing.state.trim() } : {},
923
+ country: "US",
924
+ postalCode: zip
925
+ }
926
+ }
902
927
  })
903
928
  });
904
929
  if (!res.ok) {
@@ -910,9 +935,47 @@ function useCardTokenizer() {
910
935
  if (!token) throw new Error("Card tokenization returned no token.");
911
936
  return { token };
912
937
  }
938
+ let lastMxCard = null;
939
+ async function mxCardKey(number, month, year, cvv, street, zip) {
940
+ const bytes = new TextEncoder().encode(`${number}|${month}|${year}|${cvv}|${street}|${zip}`);
941
+ const digest = await crypto.subtle.digest("SHA-256", bytes);
942
+ return Array.from(new Uint8Array(digest), (b) => b.toString(16).padStart(2, "0")).join("");
943
+ }
944
+ async function tokenizeMxMerchant(card) {
945
+ const { month, year } = splitExpiry(card.expiry);
946
+ const expiryYear = year.slice(-2);
947
+ const number = card.cardNumber.replace(/\s/g, "");
948
+ const { street, zip } = requireBillingAddress(card);
949
+ const key = await mxCardKey(number, month, year, card.cvv, street, zip);
950
+ if (lastMxCard?.key === key) return lastMxCard.token;
951
+ let session;
952
+ try {
953
+ session = await paymentsApi.createTokenizationSession();
954
+ } catch (err) {
955
+ throw new Error(err instanceof Error && err.message ? err.message : "Payment setup is unavailable right now. Please try again.");
956
+ }
957
+ if (typeof session?.vaultUrl !== "string") throw new Error("Payment setup is unavailable right now. Please try again.");
958
+ const res = await fetch(session.vaultUrl, {
959
+ method: "POST",
960
+ headers: { "Content-Type": "application/json" },
961
+ body: JSON.stringify({
962
+ firstName: card.billing?.firstName?.trim() || "Card",
963
+ lastName: card.billing?.lastName?.trim() || "Holder",
964
+ cardAccount: { number, expiryMonth: month, expiryYear, cvv: card.cvv, avsStreet: street, avsZip: zip }
965
+ })
966
+ });
967
+ const body = await res.json().catch(() => ({}));
968
+ if (!res.ok) throw new Error(body.details?.[0] || body.message || "Card processing failed.");
969
+ const cardToken = body.cardAccount?.token;
970
+ if (body.id == null || !cardToken) throw new Error("Card tokenization returned no token.");
971
+ const token = { customerId: String(body.id), cardToken };
972
+ lastMxCard = { key, token };
973
+ return token;
974
+ }
913
975
  function tokenize(card) {
914
976
  const cfg = config();
915
977
  if (!cfg) return Promise.reject(new Error("Payment configuration not loaded. Please refresh."));
978
+ if (cfg.provider === "mxmerchant") return tokenizeMxMerchant(card);
916
979
  return cfg.provider === "quickbooks" ? tokenizeQuickBooks(card, cfg) : tokenizeAcceptJs(card, cfg);
917
980
  }
918
981
  return { ready, status, error, tokenize };
@@ -1124,7 +1187,8 @@ function useCheckoutFlow(options = {}) {
1124
1187
  opaqueData = await accept.tokenize({
1125
1188
  cardNumber: cardNumberRaw(),
1126
1189
  expiry: expiryRaw(),
1127
- cvv: cvvRaw()
1190
+ cvv: cvvRaw(),
1191
+ billing: address.effectiveBilling()
1128
1192
  });
1129
1193
  }
1130
1194
  const attemptScope = `${rx.requestId ?? "rx"}:${rx.drugId}`;
@@ -1360,7 +1424,8 @@ function useCartCheckoutFlow() {
1360
1424
  const opaqueData = await accept.tokenize({
1361
1425
  cardNumber: cardNumberRaw(),
1362
1426
  expiry: expiryRaw(),
1363
- cvv: cvvRaw()
1427
+ cvv: cvvRaw(),
1428
+ billing: address.effectiveBilling()
1364
1429
  });
1365
1430
  let idempotencyKey = readAttemptKey(ATTEMPT_SCOPE);
1366
1431
  if (!idempotencyKey) {
@@ -1587,7 +1652,8 @@ function useSignupFlow(options) {
1587
1652
  const opaque = await accept.tokenize({
1588
1653
  cardNumber: cardNumberRaw(),
1589
1654
  expiry: expiryRaw(),
1590
- cvv: cvvRaw()
1655
+ cvv: cvvRaw(),
1656
+ billing: { firstName: firstName().trim(), lastName: lastName().trim(), street: street().trim(), city: city().trim(), state: state(), zip: zip().trim() }
1591
1657
  });
1592
1658
  setTokenizedData(opaque);
1593
1659
  } catch (e) {
@@ -2169,7 +2235,8 @@ function useSubscribeFlow(options) {
2169
2235
  const opaque = await accept.tokenize({
2170
2236
  cardNumber: cardNumberRaw(),
2171
2237
  expiry: expiryRaw(),
2172
- cvv: cvvRaw()
2238
+ cvv: cvvRaw(),
2239
+ billing: { street: street().trim(), city: city().trim(), state: state(), zip: zip().trim() }
2173
2240
  });
2174
2241
  const products = cart_default.items().map((i) => ({
2175
2242
  productId: i.productId,
@@ -3418,7 +3485,8 @@ function useUpdatePaymentMethodFlow(subscriptionId) {
3418
3485
  const opaqueData = await accept.tokenize({
3419
3486
  cardNumber: cardNumber(),
3420
3487
  expiry: expiry(),
3421
- cvv: cvv()
3488
+ cvv: cvv(),
3489
+ billing: billing.shipping()
3422
3490
  });
3423
3491
  await subscriptionsApi.updatePaymentMethod(id, { opaqueData, billingAddress: billing.shipping() });
3424
3492
  return true;
@@ -5800,5 +5868,5 @@ function useCatalogConversion(opts) {
5800
5868
  }
5801
5869
 
5802
5870
  export { ACCOUNT_SOURCE_LABEL, DEFAULT_COLOR_PALETTE, LIFECYCLE_BUCKETS, LIFECYCLE_LABEL, LIFECYCLE_TONE, LIVE_SUBSCRIPTION_STATUSES, MATCH_DEPENDENT_WARNINGS, MATCH_HOW_LABEL, ORPHAN_REASON, READINESS_LABEL, SOURCE_FIELD_NOTE, SUPPORT_CATEGORIES, TERMINAL_SUBSCRIPTION_STATUSES, US_STATES, US_STATE_OPTIONS, accountSource, addCatalogItemAsProduct, applyPriceDrafts, availableStateOptions, availableStates, bestOfferDiscount, buildFulfillmentRows, buildMatrixView, buildRefillView, buildStrengthRows, buildTimeline, buildTrackerView, buildTrackingUrl, canLeaveUnmatched, canOfferConversion, captureFunnelEmail, catalogUnavailableMessage, categoryColor, categoryLabel, classifyCatalogError, classifyConversionError, createCatalogProduct, createFunnelTelemetry, deriveAttention, deriveCatalogAvailabilityDecision, deriveJourney, describeConversion, emailGateAnswered, explainFinding, findStoredDosePrice, firstAddressError, flaggedSubscribers, fmtDay, formatCalendarDate, formatCardNumber, formatConversationTime, formatCvv, formatEventDate, formatExpiry, formatMessageTime, formatRelativeTime, formatStageDate, groupDrugsByPharmacy, hasBlockers, hasConversion, hasErrors, hasStateRestrictions, initialMatches, intakeEvidence, invalidDraftKeys, isCatalogItemId, isCssColorValue, isImageAttachment, isLive, isQuestionVisible, isReconcilable, lifecycleReason, liveDoses, lowestPrice, lowestSalePrice, markEmailGateAnswered, matchProblem, matchesComplete, moveInOrder, normalizeState, normalizeStates, offerBeatsPromo, offerDurationText, offerSummaryText, orphanKey, primarySubscription, readinessStatus, reconcileCartAgainstCatalog, reconcileCartLines, redeemResumeLink, removeStoredDosePrice, resetResumeRedemption, resolveCategoryColor, resolveStrengthPrices, resolveSurveyV2DrugIntent, salePriceForBase, skuBindingModeFor, sourceKey, sourceLabel, stateAvailabilityNote, subscribeToSupportTopic, toChoices, toTrackerRequest, uploadPrescriptionPhoto, upsertDosePrice, useAddressPair, useAffiliateConversions, useAffiliateDownline, useAffiliateLinks, useAffiliateStats, useCardTokenizer, useCartCheckoutFlow, useCartReconcile, useCatalog, useCatalogAvailability, useCatalogConversion, useCheckoutFlow, useDashboardData, useMedicationSelect, useMemberPortalData, useMessagesThread, useProductCatalogEditor, useProductDetail, useRegisterFlow, useSignupFlow, useSubscribeFlow, useSurveyFlow, useSurveyV2Flow, useUpdatePaymentMethodFlow, validateAddress };
5803
- //# sourceMappingURL=E6KLEFN3.js.map
5804
- //# sourceMappingURL=E6KLEFN3.js.map
5871
+ //# sourceMappingURL=YK2Y76A4.js.map
5872
+ //# sourceMappingURL=YK2Y76A4.js.map