@burdenoff/microfe-billing 2026.917.4 → 2026.1005.1

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.
@@ -136,7 +136,7 @@ var et = () => {
136
136
  quotaMode: "dedicated"
137
137
  };
138
138
  });
139
- e.length > 0 && (xt(e), qt().then((e) => {
139
+ e.length > 0 && (xt(e), Jt().then((e) => {
140
140
  let t = e.data?.getActiveSubscriptions?.find((e) => e.planId === D);
141
141
  t && Ct(t.id);
142
142
  }), pt.length > 1 && yt(!0));
@@ -157,39 +157,39 @@ var et = () => {
157
157
  }), { data: R } = ie({
158
158
  variables: { id: g },
159
159
  skip: !T || !g
160
- }), zt = u(() => {
160
+ }), zt = E === "PLAN" ? I?.getPlan?.productID ?? D : E === "ADDON" && !w ? L?.getSelectedAddons?.[0]?.productID ?? D : void 0, Bt = u(() => {
161
161
  let e = R?.getStoreOrder?.lineItems;
162
162
  return Array.isArray(e) ? e : [];
163
- }, [R]), z = T && zt.some((e) => String(e.itemType).toUpperCase() === "PHYSICAL"), Bt = Me(R?.getStoreOrder?.currency), [B, Vt] = d({
163
+ }, [R]), z = T && Bt.some((e) => String(e.itemType).toUpperCase() === "PHYSICAL"), Vt = Me(R?.getStoreOrder?.currency), [B, Ht] = d({
164
164
  shippingAddressId: null,
165
165
  shippingMethodId: null,
166
166
  shippingCost: 0,
167
167
  destinationCountry: null
168
- }), [Ht] = ue(), { data: Ut, loading: Wt } = s({
168
+ }), [Ut] = ue(), { data: Wt, loading: Gt } = s({
169
169
  variables: { billingAccountId: F.billingAccount?.id },
170
170
  skip: !F.billingAccount?.id
171
- }), { data: Gt, loading: Kt, refetch: qt } = o({
171
+ }), { data: Kt, loading: qt, refetch: Jt } = o({
172
172
  variables: { billingAccountId: F.billingAccount?.id },
173
173
  skip: !F.billingAccount?.id || E !== "ADDON" && E !== "PLAN" || T
174
- }), V = u(() => Gt?.getActiveSubscriptions ?? [], [Gt]), H = u(() => !F.selectedSubscriptionId || V.length === 0 ? null : V.find((e) => e.id === F.selectedSubscriptionId) ?? null, [F.selectedSubscriptionId, V]), U = F.items[0]?.type === "CREDITS" ? F.items[0].quantity : 100, { data: Jt, loading: Yt } = te({
174
+ }), V = u(() => Kt?.getActiveSubscriptions ?? [], [Kt]), H = u(() => !F.selectedSubscriptionId || V.length === 0 ? null : V.find((e) => e.id === F.selectedSubscriptionId) ?? null, [F.selectedSubscriptionId, V]), U = F.items[0]?.type === "CREDITS" ? F.items[0].quantity : 100, { data: Yt, loading: Xt } = te({
175
175
  variables: {
176
176
  creditAmount: U,
177
177
  currency: F.selectedCurrency || "USD"
178
178
  },
179
179
  skip: E !== "CREDITS"
180
- }), W = u(() => Jt?.getCostOfCredits?.amount && U > 0 ? Jt.getCostOfCredits.amount / U : .01, [Jt, U]), G = u(() => Ut?.getPaymentMethods ?? [], [Ut]), K = u(() => Pt?.myBillingAccounts ?? [], [Pt]), q = u(() => {
180
+ }), W = u(() => Yt?.getCostOfCredits?.amount && U > 0 ? Yt.getCostOfCredits.amount / U : .01, [Yt, U]), G = u(() => Wt?.getPaymentMethods ?? [], [Wt]), K = u(() => Pt?.myBillingAccounts ?? [], [Pt]), q = u(() => {
181
181
  if (!F.billingAccount) return;
182
182
  let e = K.find((e) => e.id === F.billingAccount?.id)?.billingAddresses;
183
183
  if (e && e.length > 0) return e[0]?.country || void 0;
184
- }, [F.billingAccount, K]), [Xt, Zt] = d(null);
184
+ }, [F.billingAccount, K]), [Zt, Qt] = d(null);
185
185
  l(() => {
186
- if (q) if (q === "IN") F.selectedCurrency !== "INR" && F.setCurrency("INR"), jt && Xt !== q && F.selectedProvider !== "CREDITS" && (F.setPaymentProvider("RAZORPAY"), Zt(q));
186
+ if (q) if (q === "IN") F.selectedCurrency !== "INR" && F.setCurrency("INR"), jt && Zt !== q && F.selectedProvider !== "CREDITS" && (F.setPaymentProvider("RAZORPAY"), Qt(q));
187
187
  else {
188
188
  if (F.selectedCurrency === "INR") {
189
189
  let e = F.billingAccount?.currency, t = e && e !== "INR" ? e : "USD";
190
190
  F.setCurrency(t);
191
191
  }
192
- F.selectedProvider === "RAZORPAY" && (F.setPaymentProvider("STRIPE"), Zt(q));
192
+ F.selectedProvider === "RAZORPAY" && (F.setPaymentProvider("STRIPE"), Qt(q));
193
193
  }
194
194
  }, [
195
195
  q,
@@ -199,40 +199,40 @@ var et = () => {
199
199
  F.setPaymentProvider,
200
200
  F.billingAccount?.currency,
201
201
  jt,
202
- Xt
202
+ Zt
203
203
  ]);
204
- let { billingAccount: Qt, canPayWithCredits: $t, hasEnoughCredits: en, selectedCurrency: J, selectedPaymentMethodId: tn, selectedProvider: nn, setCurrency: Y, setPaymentProvider: X, setSelectedPaymentMethodId: rn } = F;
204
+ let { billingAccount: $t, canPayWithCredits: en, hasEnoughCredits: tn, selectedCurrency: J, selectedPaymentMethodId: nn, selectedProvider: rn, setCurrency: Y, setPaymentProvider: X, setSelectedPaymentMethodId: an } = F;
205
205
  l(() => {
206
- if (!Qt?.currency || q === "IN") return;
207
- let e = Qt.currency;
206
+ if (!$t?.currency || q === "IN") return;
207
+ let e = $t.currency;
208
208
  e !== "INR" && J !== e && Y(e);
209
209
  }, [
210
210
  q,
211
- Qt,
211
+ $t,
212
212
  J,
213
213
  Y
214
214
  ]), l(() => {
215
- if (!(nn !== "AUTO" && nn !== null)) {
216
- if ($t && en) {
217
- X("CREDITS"), rn(null);
215
+ if (!(rn !== "AUTO" && rn !== null)) {
216
+ if (en && tn) {
217
+ X("CREDITS"), an(null);
218
218
  return;
219
219
  }
220
- if (G.length > 0 && !tn) {
220
+ if (G.length > 0 && !nn) {
221
221
  let e = G.find((e) => e.isDefault && e.isVerified), t = G.find((e) => e.isVerified), n = e || t;
222
222
  if (n) {
223
- rn(n.id), n.razorpayPaymentMethodId ? X("RAZORPAY") : n.stripePaymentMethodId && X("STRIPE");
223
+ an(n.id), n.razorpayPaymentMethodId ? X("RAZORPAY") : n.stripePaymentMethodId && X("STRIPE");
224
224
  return;
225
225
  }
226
226
  }
227
227
  }
228
228
  }, [
229
- $t,
230
229
  en,
231
- G,
232
230
  tn,
231
+ G,
233
232
  nn,
233
+ rn,
234
234
  X,
235
- rn
235
+ an
236
236
  ]);
237
237
  let [Z, Q] = d(!1);
238
238
  l(() => {
@@ -395,7 +395,7 @@ var et = () => {
395
395
  let $ = Ne(null);
396
396
  l(() => {
397
397
  if (z) if (B.shippingCost > 0) {
398
- let e = F.selectedCurrency, t = Bt !== e && F.convertedAmount !== null ? B.shippingCost * F.conversionRate : B.shippingCost, n = $.current;
398
+ let e = F.selectedCurrency, t = Vt !== e && F.convertedAmount !== null ? B.shippingCost * F.conversionRate : B.shippingCost, n = $.current;
399
399
  if (n && n.price === t && n.currency === e) return;
400
400
  n === null ? F.addItem({
401
401
  id: le,
@@ -416,7 +416,7 @@ var et = () => {
416
416
  }, [
417
417
  z,
418
418
  B.shippingCost,
419
- Bt,
419
+ Vt,
420
420
  F.selectedCurrency,
421
421
  F.conversionRate,
422
422
  F.convertedAmount,
@@ -491,7 +491,7 @@ var et = () => {
491
491
  v?.billingAccountId,
492
492
  b
493
493
  ]);
494
- let an = !!(v?.upgradeFromSubscriptionId || v?.downgradeFromSubscriptionId);
494
+ let on = !!(v?.upgradeFromSubscriptionId || v?.downgradeFromSubscriptionId);
495
495
  l(() => {
496
496
  w && C && S.length === 0 && !Z && _("/addons", { replace: !0 });
497
497
  }, [
@@ -501,11 +501,11 @@ var et = () => {
501
501
  Z,
502
502
  _
503
503
  ]);
504
- let on = pe({
504
+ let sn = pe({
505
505
  billingAccountId: F.billingAccount?.id,
506
506
  purchaseType: E,
507
- productId: D
508
- }), sn = c(async () => {
507
+ productId: zt
508
+ }), cn = c(async () => {
509
509
  if (!F.billingAccount) return;
510
510
  let e = _t.current;
511
511
  if (_t.current = !1, !e && !De(F.billingAccount)) {
@@ -513,12 +513,12 @@ var et = () => {
513
513
  return;
514
514
  }
515
515
  if (j(null), z) try {
516
- let e = (await Ht({ variables: { input: {
516
+ let e = (await Ut({ variables: { input: {
517
517
  orderId: g,
518
518
  shippingMethodId: B.shippingMethodId,
519
519
  ...B.shippingAddressId ? { shippingAddressId: B.shippingAddressId } : {}
520
520
  } } })).data?.setStoreOrderShipping?.shippingCost;
521
- typeof e == "number" && e !== B.shippingCost && Vt((t) => ({
521
+ typeof e == "number" && e !== B.shippingCost && Ht((t) => ({
522
522
  ...t,
523
523
  shippingCost: e
524
524
  }));
@@ -588,9 +588,9 @@ var et = () => {
588
588
  z,
589
589
  B,
590
590
  g,
591
- Bt,
592
- Ht
593
- ]), cn = c((e) => {
591
+ Vt,
592
+ Ut
593
+ ]), ln = c((e) => {
594
594
  y("billing.payment.succeeded", {
595
595
  route: "/billing/checkout",
596
596
  entityId: A?.paymentId ?? A?.orderId,
@@ -600,7 +600,7 @@ var et = () => {
600
600
  y,
601
601
  A?.orderId,
602
602
  A?.paymentId
603
- ]), ln = c((e) => {
603
+ ]), un = c((e) => {
604
604
  y("billing.payment.failed", {
605
605
  route: "/billing/checkout",
606
606
  entityId: A?.paymentId ?? A?.orderId,
@@ -611,20 +611,20 @@ var et = () => {
611
611
  y,
612
612
  A?.orderId,
613
613
  A?.paymentId
614
- ]), un = c((e) => {
614
+ ]), dn = c((e) => {
615
615
  F.updateItemQuantity("credits-purchase", e);
616
616
  }, [F]);
617
617
  if (!it.canProcessPayment) return /* @__PURE__ */ p(t, { message: "You don't have permission to make purchases." });
618
- if (fe()) return /* @__PURE__ */ p(ge, {
618
+ if (fe() && (E === "PLAN" || E === "ADDON" && !w) && zt) return /* @__PURE__ */ p(ge, {
619
619
  purchaseType: E,
620
- productId: D,
620
+ productId: zt,
621
621
  billingAccountId: F.billingAccount?.id,
622
- nativeCheckout: on,
622
+ nativeCheckout: sn,
623
623
  onBack: () => _("dashboard")
624
624
  });
625
- let dn = Ft || Lt && E === "PLAN" || Rt && E === "ADDON" && !w || w && !C;
625
+ let fn = Ft || Lt && E === "PLAN" || Rt && E === "ADDON" && !w || w && !C;
626
626
  if (w && C && S.length === 0 && !Z) return null;
627
- let fn = () => {
627
+ let pn = () => {
628
628
  if (w) {
629
629
  let e = F.items.length;
630
630
  return `Purchase ${e} Add-on${e === 1 ? "" : "s"}`;
@@ -635,7 +635,7 @@ var et = () => {
635
635
  case "ADDON": return "Purchase Add-on";
636
636
  default: return "Checkout";
637
637
  }
638
- }, pn = () => {
638
+ }, mn = () => {
639
639
  switch (E) {
640
640
  case "CREDITS": return /* @__PURE__ */ p(Re, { className: "size-6" });
641
641
  case "PLAN": return /* @__PURE__ */ p(Ve, { className: "size-6" });
@@ -643,7 +643,7 @@ var et = () => {
643
643
  default: return /* @__PURE__ */ p(We, { className: "size-6" });
644
644
  }
645
645
  };
646
- if (dn) return /* @__PURE__ */ p("div", {
646
+ if (fn) return /* @__PURE__ */ p("div", {
647
647
  className: "flex items-center justify-center min-h-[400px]",
648
648
  children: /* @__PURE__ */ m("div", {
649
649
  className: "text-center space-y-4",
@@ -1039,8 +1039,8 @@ var et = () => {
1039
1039
  publishableKey: at || kt?.stripePublishableKey || "",
1040
1040
  amount: Math.round((A.total ?? F.total) * 100),
1041
1041
  currency: A.currency || F.selectedCurrency,
1042
- onSuccess: cn,
1043
- onError: ln,
1042
+ onSuccess: ln,
1043
+ onError: un,
1044
1044
  onCancel: () => k("select"),
1045
1045
  isCompletingExistingPayment: !!F.selectedPaymentMethodId
1046
1046
  })
@@ -1072,8 +1072,8 @@ var et = () => {
1072
1072
  email: A.prefillEmail,
1073
1073
  contact: A.prefillContact
1074
1074
  },
1075
- onSuccess: (e) => cn(e.razorpay_payment_id),
1076
- onError: ln,
1075
+ onSuccess: (e) => ln(e.razorpay_payment_id),
1076
+ onError: un,
1077
1077
  onCancel: () => k("select")
1078
1078
  })]
1079
1079
  })
@@ -1094,10 +1094,10 @@ var et = () => {
1094
1094
  className: "flex items-center gap-3 mb-6",
1095
1095
  children: [/* @__PURE__ */ p("div", {
1096
1096
  className: "p-2 rounded-lg bg-[var(--color-accent-soft)] text-text-link",
1097
- children: pn()
1097
+ children: mn()
1098
1098
  }), /* @__PURE__ */ m("div", { children: [/* @__PURE__ */ p("h1", {
1099
1099
  className: "text-2xl font-bold text-text-primary",
1100
- children: fn()
1100
+ children: pn()
1101
1101
  }), /* @__PURE__ */ p("p", {
1102
1102
  className: "text-sm text-text-secondary",
1103
1103
  children: "Complete your purchase securely"
@@ -1168,10 +1168,10 @@ var et = () => {
1168
1168
  className: "rounded-lg border border-border-subtle bg-bg-surface p-4 sm:p-6",
1169
1169
  children: /* @__PURE__ */ p(be, {
1170
1170
  value: F.items[0].quantity,
1171
- onChange: un,
1171
+ onChange: dn,
1172
1172
  costPerCredit: W,
1173
1173
  currency: F.selectedCurrency,
1174
- disabled: Yt
1174
+ disabled: Xt
1175
1175
  })
1176
1176
  }),
1177
1177
  /* @__PURE__ */ m("div", {
@@ -1181,19 +1181,19 @@ var et = () => {
1181
1181
  selectedAccountId: F.billingAccount?.id ?? null,
1182
1182
  onSelect: F.setBillingAccount,
1183
1183
  isLoading: Ft,
1184
- disabled: an,
1185
- disabledMessage: an ? "Billing account is locked for plan changes" : void 0
1184
+ disabled: on,
1185
+ disabledMessage: on ? "Billing account is locked for plan changes" : void 0
1186
1186
  }), E === "ADDON" && !T && F.billingAccount && /* @__PURE__ */ p(Ce, {
1187
1187
  subscriptions: V,
1188
1188
  selectedSubscriptionId: F.selectedSubscriptionId,
1189
1189
  onSelect: F.setSelectedSubscriptionId,
1190
- isLoading: Kt
1190
+ isLoading: qt
1191
1191
  })]
1192
1192
  }),
1193
1193
  z && /* @__PURE__ */ p(Oe, {
1194
1194
  storeOrderId: g,
1195
1195
  currency: F.selectedCurrency,
1196
- onChange: Vt
1196
+ onChange: Ht
1197
1197
  }),
1198
1198
  /* @__PURE__ */ m("div", {
1199
1199
  className: "rounded-lg border border-border-subtle bg-bg-surface p-4 sm:p-6 space-y-4",
@@ -1213,7 +1213,7 @@ var et = () => {
1213
1213
  saveCard: F.saveCard,
1214
1214
  onSaveCardChange: F.setSaveCard,
1215
1215
  autoRenewEnabled: E === "PLAN" && F.autoRenew,
1216
- isLoading: Wt
1216
+ isLoading: Gt
1217
1217
  }),
1218
1218
  F.selectedProvider !== "CREDITS" && F.selectedProvider !== "AUTO" && /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p("div", { className: "border-t border-border-subtle" }), /* @__PURE__ */ p("div", {
1219
1219
  className: "bg-bg-sunken p-4 rounded-button",
@@ -1385,8 +1385,8 @@ var et = () => {
1385
1385
  }),
1386
1386
  /* @__PURE__ */ p("button", {
1387
1387
  type: "button",
1388
- onClick: sn,
1389
- disabled: F.isProcessing || !F.billingAccount || F.items.length === 0 || F.selectedProvider === "CREDITS" && !en || E === "ADDON" && !T && Kt || E === "ADDON" && !T && V.length === 0 || E === "ADDON" && !T && !F.selectedSubscriptionId || z && (!B.shippingAddressId || !B.shippingMethodId),
1388
+ onClick: cn,
1389
+ disabled: F.isProcessing || !F.billingAccount || F.items.length === 0 || F.selectedProvider === "CREDITS" && !tn || E === "ADDON" && !T && qt || E === "ADDON" && !T && V.length === 0 || E === "ADDON" && !T && !F.selectedSubscriptionId || z && (!B.shippingAddressId || !B.shippingMethodId),
1390
1390
  className: "w-full px-6 py-4 rounded-lg bg-action-primary-bg text-action-primary-text font-semibold\n hover:bg-action-primary-bgHover disabled:opacity-50 disabled:cursor-not-allowed\n transition-colors flex items-center justify-center gap-2",
1391
1391
  children: F.isProcessing ? /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p(Be, { className: "size-5 animate-spin" }), "Processing…"] }) : F.selectedProvider === "CREDITS" ? "Pay with Credits" : "Proceed to Payment"
1392
1392
  }),
@@ -1403,7 +1403,7 @@ var et = () => {
1403
1403
  hasPhone: !!F.billingAccount.contactNumber?.trim(),
1404
1404
  hasAddress: !!(F.billingAccount.billingAddresses?.[0]?.line1?.trim() && F.billingAccount.billingAddresses?.[0]?.postalCode?.trim()),
1405
1405
  onCompleted: () => {
1406
- _t.current = !0, gt(!1), sn(), It().then((e) => {
1406
+ _t.current = !0, gt(!1), cn(), It().then((e) => {
1407
1407
  let t = (e.data?.myBillingAccounts ?? []).map($e).find((e) => e?.id === F.billingAccount?.id);
1408
1408
  t && F.setBillingAccount(t);
1409
1409
  });