@burdenoff/microfe-healthybowl 2026.1126.2 → 2026.1128.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.
@@ -66,6 +66,11 @@ interface WalletState {
66
66
  billingAccountId: string | null;
67
67
  currency: string;
68
68
  balances: CreditBalances | null;
69
+ /**
70
+ * Price of one credit in `currency`, from billing. Null until billing answers
71
+ * (or when the quote fails); amounts then show as unknown and top-ups wait.
72
+ */
73
+ creditPrice: number | null;
69
74
  transactions: WalletTransaction[];
70
75
  payoutAccounts: WalletPayoutAccount[];
71
76
  loading: boolean;
@@ -78,16 +83,16 @@ export interface UseCreditsWallet extends WalletState {
78
83
  /** Re-read balance + transactions (call after a top-up widget closes or a payout is requested). */
79
84
  refetch: () => Promise<void>;
80
85
  /**
81
- * Create a real Razorpay order for an `amountInr` credit top-up via billing's `initiatePayment`.
86
+ * Create a real Razorpay order for a top-up of `credits` credits via billing's `initiatePayment`.
82
87
  * Returns the session the PAGE uses to open the Razorpay widget — the client never marks anything
83
88
  * paid; billing's webhook settles it and the balance moves on the next {@link refetch}.
84
89
  */
85
- buyCredits: (amountInr: number) => Promise<TopUpSession>;
90
+ buyCredits: (credits: number) => Promise<TopUpSession>;
86
91
  /**
87
- * Request a payout of `amountInr` withdrawable credits to the resolved payout account via
92
+ * Request a payout of `credits` withdrawable credits to the resolved payout account via
88
93
  * `requestCreditWithdrawal`. Refetches on success so the reserving debit shows as Processing.
89
94
  */
90
- requestPayout: (amountInr: number, notes?: string) => Promise<PayoutResult>;
95
+ requestPayout: (credits: number, notes?: string) => Promise<PayoutResult>;
91
96
  }
92
97
  export declare function useCreditsWallet(): UseCreditsWallet;
93
98
  export {};
@@ -2,65 +2,83 @@ import { useHealthyBowl as e } from "../context/HealthyBowlContext.js";
2
2
  import { useCallback as t, useEffect as n, useState as r } from "react";
3
3
  import { graphqlFetch as i } from "@burdenoff/fe-libs/shared/graphql";
4
4
  // src/healthybowl/hooks/useCreditsWallet.ts
5
- var a = "\n query HbWalletBillingAccounts {\n getBillingAccountsByOrg {\n id\n isDefault\n isActive\n currency\n }\n }\n", o = "\n query HbWalletCreditBalance($billingAccountId: ID!) {\n getCreditBalanceByType(billingAccountId: $billingAccountId) {\n purchased\n earned\n granted\n withdrawable\n total\n }\n }\n", s = "\n query HbWalletCreditTransactions($billingAccountID: ID!, $days: Int!, $page: Int, $pageSize: Int) {\n getBillingAccountCreditTransactions(\n billingAccountID: $billingAccountID\n days: $days\n page: $page\n pageSize: $pageSize\n ) {\n creditTransactions {\n id\n amount\n type\n status\n createdAt\n entityType\n fromType\n payoutRequestId\n }\n totalCount\n hasMore\n }\n }\n", c = "\n query HbWalletPayoutAccounts($billingAccountId: ID!) {\n myPayoutAccounts(billingAccountId: $billingAccountId) {\n id\n label\n displayName\n isDefault\n isActive\n currency\n accountLast4\n status\n }\n }\n", l = "\n mutation HbWalletInitiateTopUp($input: InitiatePaymentInput!) {\n initiatePayment(input: $input) {\n success\n provider\n orderId\n razorpayKeyId\n clientSecret\n subtotal\n taxAmount\n total\n currency\n paymentId\n error\n }\n }\n", u = "\n mutation HbWalletRequestPayout($input: RequestCreditWithdrawalInput!) {\n requestCreditWithdrawal(input: $input) {\n id\n status\n requestedAmount\n currency\n createdAt\n }\n }\n", d = 1, f = 365, p = "INR", m = {
5
+ var a = "\n query HbWalletBillingAccounts {\n getBillingAccountsByOrg {\n id\n isDefault\n isActive\n currency\n }\n }\n", o = "\n query HbWalletCreditBalance($billingAccountId: ID!) {\n getCreditBalanceByType(billingAccountId: $billingAccountId) {\n purchased\n earned\n granted\n withdrawable\n total\n }\n }\n", s = "\n query HbWalletCreditTransactions($billingAccountID: ID!, $days: Int!, $page: Int, $pageSize: Int) {\n getBillingAccountCreditTransactions(\n billingAccountID: $billingAccountID\n days: $days\n page: $page\n pageSize: $pageSize\n ) {\n creditTransactions {\n id\n amount\n type\n status\n createdAt\n entityType\n fromType\n payoutRequestId\n }\n totalCount\n hasMore\n }\n }\n", c = "\n query HbWalletPayoutAccounts($billingAccountId: ID!) {\n myPayoutAccounts(billingAccountId: $billingAccountId) {\n id\n label\n displayName\n isDefault\n isActive\n currency\n accountLast4\n status\n }\n }\n", l = "\n query HbWalletCreditPrice($creditAmount: Float!, $currency: String!) {\n getCostOfCredits(creditAmount: $creditAmount, currency: $currency) {\n amount\n }\n }\n", u = 100, d = "\n mutation HbWalletInitiateTopUp($input: InitiatePaymentInput!) {\n initiatePayment(input: $input) {\n success\n provider\n orderId\n razorpayKeyId\n clientSecret\n subtotal\n taxAmount\n total\n currency\n paymentId\n error\n }\n }\n", f = "\n mutation HbWalletRequestPayout($input: RequestCreditWithdrawalInput!) {\n requestCreditWithdrawal(input: $input) {\n id\n status\n requestedAmount\n currency\n createdAt\n }\n }\n", p = 365, m = "INR", h = {
6
6
  billingAccountId: null,
7
- currency: p,
7
+ currency: m,
8
8
  balances: null,
9
+ creditPrice: null,
9
10
  transactions: [],
10
11
  payoutAccounts: [],
11
12
  loading: !1,
12
13
  error: null
13
14
  };
14
- function h(e, t) {
15
+ function g(e, t) {
15
16
  if (e?.length) throw Error(e[0]?.message ?? t);
16
17
  }
17
- function g() {
18
- let { globalGatewayUrl: g, authToken: _ } = e(), [v, y] = r({
19
- ...m,
18
+ function _() {
19
+ let { globalGatewayUrl: _, authToken: v } = e(), [y, b] = r({
20
+ ...h,
20
21
  loading: !0
21
- }), b = t(() => ({
22
+ }), x = t(() => ({
22
23
  gateway: "global",
23
- ...g ? { baseUrl: g } : {},
24
- ..._ ? { authToken: _ } : {}
25
- }), [g, _]), x = t(async () => {
24
+ ..._ ? { baseUrl: _ } : {},
25
+ ...v ? { authToken: v } : {}
26
+ }), [_, v]), S = t(async () => {
26
27
  let e = await i({
27
- ...b(),
28
+ ...x(),
28
29
  query: a,
29
30
  operationName: "HbWalletBillingAccounts",
30
31
  organizationId: !0
31
32
  });
32
- h(e.errors, "Could not read billing accounts");
33
+ g(e.errors, "Could not read billing accounts");
33
34
  let t = (e.data?.getBillingAccountsByOrg ?? []).filter((e) => !!e?.id), n = t.find((e) => e.isDefault) ?? t.find((e) => e.isActive) ?? t[0] ?? null;
34
35
  return {
35
36
  id: n?.id ?? null,
36
- currency: n?.currency ?? p
37
+ currency: n?.currency ?? m
37
38
  };
38
- }, [b]), S = t(async (e) => {
39
+ }, [x]), C = t(async (e) => {
39
40
  let t = await i({
40
- ...b(),
41
+ ...x(),
41
42
  query: o,
42
43
  variables: { billingAccountId: e },
43
44
  operationName: "HbWalletCreditBalance",
44
45
  organizationId: !0
45
46
  });
46
- return h(t.errors, "Could not read credit balance"), t.data?.getCreditBalanceByType ?? null;
47
- }, [b]), C = t(async (e) => {
47
+ return g(t.errors, "Could not read credit balance"), t.data?.getCreditBalanceByType ?? null;
48
+ }, [x]), w = t(async (e) => {
49
+ try {
50
+ let t = await i({
51
+ ...x(),
52
+ query: l,
53
+ variables: {
54
+ creditAmount: u,
55
+ currency: e
56
+ },
57
+ operationName: "HbWalletCreditPrice",
58
+ organizationId: !0,
59
+ suppressGlobalErrorEvent: !0
60
+ }), n = t.data?.getCostOfCredits?.amount;
61
+ return t.errors?.length || typeof n != "number" || !(n > 0) ? null : n / u;
62
+ } catch {
63
+ return null;
64
+ }
65
+ }, [x]), T = t(async (e) => {
48
66
  let t = await i({
49
- ...b(),
67
+ ...x(),
50
68
  query: s,
51
69
  variables: {
52
70
  billingAccountID: e,
53
- days: f,
71
+ days: p,
54
72
  page: 0,
55
73
  pageSize: 50
56
74
  },
57
75
  operationName: "HbWalletCreditTransactions",
58
76
  organizationId: !0
59
77
  });
60
- return h(t.errors, "Could not read transactions"), t.data?.getBillingAccountCreditTransactions?.creditTransactions ?? [];
61
- }, [b]), w = t(async (e) => {
78
+ return g(t.errors, "Could not read transactions"), t.data?.getBillingAccountCreditTransactions?.creditTransactions ?? [];
79
+ }, [x]), E = t(async (e) => {
62
80
  let t = await i({
63
- ...b(),
81
+ ...x(),
64
82
  query: c,
65
83
  variables: { billingAccountId: e },
66
84
  operationName: "HbWalletPayoutAccounts",
@@ -68,129 +86,135 @@ function g() {
68
86
  suppressGlobalErrorEvent: !0
69
87
  });
70
88
  return t.errors?.length ? [] : t.data?.myPayoutAccounts ?? [];
71
- }, [b]), T = t(async () => {
72
- y((e) => ({
89
+ }, [x]), D = t(async () => {
90
+ b((e) => ({
73
91
  ...e,
74
92
  loading: !0,
75
93
  error: null
76
94
  }));
77
95
  try {
78
- let { id: e, currency: t } = await x();
96
+ let { id: e, currency: t } = await S();
79
97
  if (!e) {
80
- y({
81
- ...m,
98
+ b({
99
+ ...h,
82
100
  loading: !1
83
101
  });
84
102
  return;
85
103
  }
86
- let [n, r, i] = await Promise.all([
87
- S(e),
104
+ let n = t || m, [r, i, a, o] = await Promise.all([
88
105
  C(e),
89
- w(e)
106
+ T(e),
107
+ E(e),
108
+ w(n)
90
109
  ]);
91
- y({
110
+ b({
92
111
  billingAccountId: e,
93
- currency: t || p,
94
- balances: n,
95
- transactions: r,
96
- payoutAccounts: i,
112
+ currency: n,
113
+ balances: r,
114
+ creditPrice: o,
115
+ transactions: i,
116
+ payoutAccounts: a,
97
117
  loading: !1,
98
118
  error: null
99
119
  });
100
120
  } catch (e) {
101
- y((t) => ({
121
+ b((t) => ({
102
122
  ...t,
103
123
  loading: !1,
104
124
  error: e instanceof Error ? e.message : "Could not load your wallet"
105
125
  }));
106
126
  }
107
127
  }, [
108
- x,
109
128
  S,
110
129
  C,
130
+ T,
131
+ E,
111
132
  w
112
133
  ]);
113
134
  n(() => {
114
- T();
115
- }, [T]);
116
- let E = t(async () => {
117
- let e = v.billingAccountId;
118
- if (!e) await T();
135
+ D();
136
+ }, [D]);
137
+ let O = t(async () => {
138
+ let e = y.billingAccountId;
139
+ if (!e) await D();
119
140
  else try {
120
- let [t, n] = await Promise.all([S(e), C(e)]);
121
- y((e) => ({
141
+ let [t, n] = await Promise.all([C(e), T(e)]);
142
+ b((e) => ({
122
143
  ...e,
123
144
  balances: t,
124
145
  transactions: n
125
146
  }));
126
147
  } catch {}
127
148
  }, [
128
- v.billingAccountId,
129
- S,
149
+ y.billingAccountId,
130
150
  C,
131
- T
132
- ]), D = t(async (e) => {
133
- let t = v.billingAccountId;
151
+ T,
152
+ D
153
+ ]), k = t(async (e) => {
154
+ let t = y.billingAccountId;
134
155
  if (!t) throw Error("No billing account is set up for this farm yet");
135
- let n = await i({
136
- ...b(),
137
- query: l,
156
+ let n = y.creditPrice;
157
+ if (n == null) throw Error("The credit price is not loaded yet. Try again in a moment.");
158
+ let r = await i({
159
+ ...x(),
160
+ query: d,
138
161
  variables: { input: {
139
162
  billingAccountId: t,
140
163
  purchaseType: "CREDITS",
141
- creditAmount: Math.round(e * d),
142
- amount: e,
143
- currency: v.currency || p,
164
+ creditAmount: e,
165
+ amount: Math.round(e * n * 100) / 100,
166
+ currency: y.currency || m,
144
167
  provider: "RAZORPAY"
145
168
  } },
146
169
  operationName: "HbWalletInitiateTopUp",
147
170
  organizationId: !0
148
171
  });
149
- h(n.errors, "Could not start the top-up");
150
- let r = n.data?.initiatePayment;
151
- if (!r) throw Error("Billing did not return a payment session");
152
- if (!r.success && r.error) throw Error(r.error);
153
- return r;
172
+ g(r.errors, "Could not start the top-up");
173
+ let a = r.data?.initiatePayment;
174
+ if (!a) throw Error("Billing did not return a payment session");
175
+ if (!a.success && a.error) throw Error(a.error);
176
+ return a;
154
177
  }, [
155
- v.billingAccountId,
156
- v.currency,
157
- b
158
- ]), O = t(async (e, t) => {
159
- let n = v.billingAccountId;
178
+ y.billingAccountId,
179
+ y.currency,
180
+ y.creditPrice,
181
+ x
182
+ ]), A = t(async (e, t) => {
183
+ let n = y.billingAccountId;
160
184
  if (!n) throw Error("No billing account is set up for this farm yet");
161
- let r = v.payoutAccounts.find((e) => e.isDefault && e.isActive) ?? v.payoutAccounts.find((e) => e.isActive) ?? v.payoutAccounts[0];
185
+ let r = y.payoutAccounts.find((e) => e.isDefault && e.isActive) ?? y.payoutAccounts.find((e) => e.isActive) ?? y.payoutAccounts[0];
162
186
  if (!r) throw Error("Add a payout (bank) account in billing settings before requesting a payout");
163
187
  let a = await i({
164
- ...b(),
165
- query: u,
188
+ ...x(),
189
+ query: f,
166
190
  variables: { input: {
167
191
  billingAccountId: n,
168
192
  payoutAccountId: r.id,
169
193
  creditAmount: e,
170
- currency: v.currency || p,
194
+ currency: y.currency || m,
171
195
  ...t ? { notes: t } : {}
172
196
  } },
173
197
  operationName: "HbWalletRequestPayout",
174
198
  organizationId: !0
175
199
  });
176
- h(a.errors, "Could not request the payout");
200
+ g(a.errors, "Could not request the payout");
177
201
  let o = a.data?.requestCreditWithdrawal;
178
202
  if (!o) throw Error("Billing did not return the payout request");
179
- return await E(), o;
203
+ return await O(), o;
180
204
  }, [
181
- v.billingAccountId,
182
- v.currency,
183
- v.payoutAccounts,
184
- b,
185
- E
186
- ]), k = v.payoutAccounts.find((e) => e.isDefault && e.isActive) ?? v.payoutAccounts.find((e) => e.isActive) ?? v.payoutAccounts[0] ?? null;
205
+ y.billingAccountId,
206
+ y.currency,
207
+ y.payoutAccounts,
208
+ x,
209
+ O
210
+ ]), j = y.payoutAccounts.find((e) => e.isDefault && e.isActive) ?? y.payoutAccounts.find((e) => e.isActive) ?? y.payoutAccounts[0] ?? null;
187
211
  return {
188
- ...v,
189
- payoutAccount: k,
190
- hasPayoutAccount: !!k,
191
- refetch: E,
192
- buyCredits: D,
193
- requestPayout: O
212
+ ...y,
213
+ payoutAccount: j,
214
+ hasPayoutAccount: !!j,
215
+ refetch: O,
216
+ buyCredits: k,
217
+ requestPayout: A
194
218
  };
195
219
  }
196
- export { g as useCreditsWallet };
220
+ export { _ as useCreditsWallet };
@@ -24,11 +24,11 @@ var D = (e) => !!(e.stockQuantity && e.stockQuantity > 0), O = ({ products: O, l
24
24
  pageSize: 12
25
25
  }), F = o((e) => {
26
26
  switch (e) {
27
- case "agri-seeds": return N("healthybowl.agriInputs.tab.agri-seeds", "Seeds");
28
- case "agri-fertilizer": return N("healthybowl.agriInputs.tab.agri-fertilizer", "Organic Fertilizer");
29
- case "agri-biopesticide": return N("healthybowl.agriInputs.tab.agri-biopesticide", "Bio-Pesticides");
30
- case "agri-tools": return N("healthybowl.agriInputs.tab.agri-tools", "Tools");
31
- case "agri-irrigation": return N("healthybowl.agriInputs.tab.agri-irrigation", "Irrigation");
27
+ case "agri-seeds": return N("healthybowl.agriInputs.v2.category.seeds", "Seeds");
28
+ case "agri-fertilizer": return N("healthybowl.agriInputs.v2.category.fertilizer", "Organic Fertilizer");
29
+ case "agri-biopesticide": return N("healthybowl.agriInputs.v2.category.biopesticide", "Bio-Pesticides");
30
+ case "agri-tools": return N("healthybowl.agriInputs.v2.category.tools", "Tools");
31
+ case "agri-irrigation": return N("healthybowl.agriInputs.v2.category.irrigation", "Irrigation");
32
32
  }
33
33
  }, [N]), I = s(() => ({
34
34
  id: "category",
@@ -7,17 +7,17 @@ import { StatCard as i } from "../../components/StatCard.js";
7
7
  import { DataTable as ee } from "../../components/DataTable.js";
8
8
  import { StatusBadge as a } from "../../components/StatusBadge.js";
9
9
  import { ErrorState as o } from "../../components/ErrorState.js";
10
- import { useToast as s } from "../../hooks/useToast.js";
11
- import { useConfirm as te } from "../../components/ConfirmDialog.js";
10
+ import { useToast as te } from "../../hooks/useToast.js";
11
+ import { useConfirm as s } from "../../components/ConfirmDialog.js";
12
12
  import { useCreditsWallet as c } from "../../hooks/useCreditsWallet.js";
13
13
  import { loadRazorpayCheckout as ne } from "../../hooks/useOrderPayments.js";
14
14
  import { cn as l, formatCurrency as re, formatDate as u } from "../../utils/helpers.js";
15
15
  import { useTr as d } from "../../../shared/hooks/useTr.js";
16
16
  import { WalletV2 as f } from "./v2/WalletV2.js";
17
17
  import { useState as p } from "react";
18
- import { useI18n as ie } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
19
- import { ArrowDownToLine as m, CreditCard as h, Landmark as g, Receipt as ae, ShieldCheck as oe, Sparkles as _, Wallet as se } from "lucide-react";
20
- import { Fragment as v, jsx as y, jsxs as b } from "react/jsx-runtime";
18
+ import { useI18n as m } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
19
+ import { ArrowDownToLine as h, CreditCard as g, Landmark as _, Receipt as ie, ShieldCheck as ae, Sparkles as v, Wallet as oe } from "lucide-react";
20
+ import { Fragment as se, jsx as y, jsxs as b } from "react/jsx-runtime";
21
21
  import { Button as x, useWorkspacePagesV2 as S } from "@burdenoff/fe-libs/ui";
22
22
  // src/healthybowl/pages/wallet/CreditsWalletPage.tsx
23
23
  var C = [
@@ -26,7 +26,7 @@ var C = [
26
26
  2500,
27
27
  5e3
28
28
  ];
29
- function ce(e) {
29
+ function w(e) {
30
30
  switch (e.status) {
31
31
  case "success": return e.type === "purchase" ? {
32
32
  label: "Paid",
@@ -53,7 +53,7 @@ function ce(e) {
53
53
  };
54
54
  }
55
55
  }
56
- function w(e, t) {
56
+ function T(e, t) {
57
57
  if (e.payoutRequestId) return t("healthybowl.wallet.txn.payout", "Payout to bank");
58
58
  switch (e.type) {
59
59
  case "purchase": return t("healthybowl.wallet.txn.purchase", "Credit top-up");
@@ -63,40 +63,40 @@ function w(e, t) {
63
63
  default: return e.type;
64
64
  }
65
65
  }
66
- function T(e, t) {
66
+ function E(e, t) {
67
67
  return e.payoutRequestId ? t("healthybowl.wallet.method.bank", "Bank payout") : e.type === "purchase" ? t("healthybowl.wallet.method.razorpay", "Razorpay") : t("healthybowl.wallet.method.credits", "Credits");
68
68
  }
69
- function E(e) {
69
+ function D(e) {
70
70
  let t = Math.abs(e.amount);
71
71
  return e.type === "usage" ? -t : t;
72
72
  }
73
- var D = () => {
74
- let { t: D } = ie(), O = d(), k = S(), { toasts: le, toast: A, dismiss: ue } = s(), de = te(), { balances: j, currency: M, transactions: N, loading: P, error: F, billingAccountId: I, payoutAccount: L, hasPayoutAccount: R, refetch: z, buyCredits: B, requestPayout: V } = c(), [H, U] = p(C[0]), [W, G] = p(!1), [K, q] = p(!1), [fe, J] = p(!1), Y = (e) => re(e, M || "INR"), X = j?.total ?? 0, Z = j?.withdrawable ?? 0, pe = !P && !F && X <= 0 && N.length === 0, Q = async () => {
73
+ var O = () => {
74
+ let { t: O } = m(), k = d(), A = S(), { toasts: ce, toast: j, dismiss: le } = te(), ue = s(), { balances: M, currency: de, creditPrice: N, transactions: P, loading: F, error: I, billingAccountId: L, payoutAccount: R, hasPayoutAccount: z, refetch: B, buyCredits: V, requestPayout: fe } = c(), [H, U] = p(C[0]), [W, G] = p(!1), [K, q] = p(!1), [pe, J] = p(!1), Y = (e) => N == null ? "…" : re(e * N, de || "INR"), X = M?.total ?? 0, Z = M?.withdrawable ?? 0, me = !F && !I && X <= 0 && P.length === 0, Q = async () => {
75
75
  G(!0);
76
76
  let e = !1;
77
77
  try {
78
- let t = await B(H);
78
+ let t = await V(H);
79
79
  if (t.provider !== "RAZORPAY") {
80
- A({
81
- title: D("healthybowl.wallet.toast.unsupported.title", "Unsupported payment provider"),
82
- description: D("healthybowl.wallet.toast.unsupported.description", "Billing routed this top-up to {{provider}}, which this wallet cannot open yet.", { provider: t.provider }),
80
+ j({
81
+ title: O("healthybowl.wallet.toast.unsupported.title", "Unsupported payment provider"),
82
+ description: O("healthybowl.wallet.toast.unsupported.description", "Billing routed this top-up to {{provider}}, which this wallet cannot open yet.", { provider: t.provider }),
83
83
  variant: "warning"
84
84
  });
85
85
  return;
86
86
  }
87
87
  if (!t.orderId || !t.razorpayKeyId) {
88
- A({
89
- title: D("healthybowl.wallet.toast.incomplete.title", "Payment session incomplete"),
90
- description: D("healthybowl.wallet.toast.incomplete.description", "Billing did not return the handles needed to open Razorpay. Please try again."),
88
+ j({
89
+ title: O("healthybowl.wallet.toast.incomplete.title", "Payment session incomplete"),
90
+ description: O("healthybowl.wallet.toast.incomplete.description", "Billing did not return the handles needed to open Razorpay. Please try again."),
91
91
  variant: "error"
92
92
  });
93
93
  return;
94
94
  }
95
95
  let n = await ne(), r = !1, i = () => {
96
- r || (r = !0, G(!1), z().then(() => {
97
- A({
98
- title: D("healthybowl.wallet.toast.topupDone.title", "Top-up submitted"),
99
- description: D("healthybowl.wallet.toast.topupDone.description", "Your payment is being confirmed by billing. Your balance updates here once it settles."),
96
+ r || (r = !0, G(!1), B().then(() => {
97
+ j({
98
+ title: O("healthybowl.wallet.toast.topupDone.title", "Top-up submitted"),
99
+ description: O("healthybowl.wallet.toast.topupDone.description", "Your payment is being confirmed by billing. Your balance updates here once it settles."),
100
100
  variant: "success"
101
101
  });
102
102
  }));
@@ -107,50 +107,50 @@ var D = () => {
107
107
  amount: Math.round(t.total * 100),
108
108
  currency: t.currency,
109
109
  name: "HealthyBowl",
110
- description: D("healthybowl.wallet.topup.description", "Credit top-up — {{amount}}", { amount: Y(H) }),
110
+ description: O("healthybowl.wallet.topup.description", "Credit top-up — {{amount}}", { amount: Y(H) }),
111
111
  handler: i,
112
112
  modal: { ondismiss: i }
113
113
  }).open(), e = !0, J(!1);
114
114
  } catch (e) {
115
- A({
116
- title: D("healthybowl.wallet.toast.topupFailed.title", "Could not start the top-up"),
117
- description: e instanceof Error ? e.message : D("healthybowl.common.error", "Unknown error"),
115
+ j({
116
+ title: O("healthybowl.wallet.toast.topupFailed.title", "Could not start the top-up"),
117
+ description: e instanceof Error ? e.message : O("healthybowl.common.error", "Unknown error"),
118
118
  variant: "error"
119
119
  });
120
120
  } finally {
121
121
  e || G(!1);
122
122
  }
123
123
  }, $ = async () => {
124
- if (!(Z <= 0) && await de({
125
- title: D("healthybowl.wallet.payout.confirm.title", "Request a payout?"),
126
- message: D("healthybowl.wallet.payout.confirm.message", "Request a payout of {{amount}} from your withdrawable credits to {{account}}. It will show as Processing until billing pays it out.", {
124
+ if (!(Z <= 0) && await ue({
125
+ title: O("healthybowl.wallet.payout.confirm.title", "Request a payout?"),
126
+ message: O("healthybowl.wallet.payout.confirm.message", "Request a payout of {{amount}} from your withdrawable credits to {{account}}. It will show as Processing until billing pays it out.", {
127
127
  amount: Y(Z),
128
- account: L?.displayName || L?.label || D("healthybowl.wallet.payout.yourBank", "your bank")
128
+ account: R?.displayName || R?.label || O("healthybowl.wallet.payout.yourBank", "your bank")
129
129
  }),
130
- okButtonTitle: D("healthybowl.wallet.payout.confirm.ok", "Request Payout"),
130
+ okButtonTitle: O("healthybowl.wallet.payout.confirm.ok", "Request Payout"),
131
131
  destructive: !1
132
132
  })) {
133
133
  q(!0);
134
134
  try {
135
- await V(Z), A({
136
- title: D("healthybowl.wallet.toast.payoutDone.title", "Payout requested"),
137
- description: D("healthybowl.wallet.toast.payoutDone.description", "Your payout of {{amount}} is now Processing.", { amount: Y(Z) }),
135
+ await fe(Z), j({
136
+ title: O("healthybowl.wallet.toast.payoutDone.title", "Payout requested"),
137
+ description: O("healthybowl.wallet.toast.payoutDone.description", "Your payout of {{amount}} is now Processing.", { amount: Y(Z) }),
138
138
  variant: "success"
139
139
  });
140
140
  } catch (e) {
141
- A({
142
- title: D("healthybowl.wallet.toast.payoutFailed.title", "Could not request the payout"),
143
- description: e instanceof Error ? e.message : D("healthybowl.common.error", "Unknown error"),
141
+ j({
142
+ title: O("healthybowl.wallet.toast.payoutFailed.title", "Could not request the payout"),
143
+ description: e instanceof Error ? e.message : O("healthybowl.common.error", "Unknown error"),
144
144
  variant: "error"
145
145
  });
146
146
  } finally {
147
147
  q(!1);
148
148
  }
149
149
  }
150
- }, me = [
150
+ }, he = [
151
151
  {
152
152
  key: "createdAt",
153
- header: D("healthybowl.wallet.col.date", "Date"),
153
+ header: O("healthybowl.wallet.col.date", "Date"),
154
154
  render: (e) => /* @__PURE__ */ y("span", {
155
155
  className: "whitespace-nowrap text-text-secondary",
156
156
  children: u(e.createdAt)
@@ -158,25 +158,25 @@ var D = () => {
158
158
  },
159
159
  {
160
160
  key: "description",
161
- header: D("healthybowl.wallet.col.description", "Description"),
161
+ header: O("healthybowl.wallet.col.description", "Description"),
162
162
  render: (e) => /* @__PURE__ */ y("span", {
163
163
  className: "font-medium text-text-primary",
164
- children: w(e, D)
164
+ children: T(e, O)
165
165
  })
166
166
  },
167
167
  {
168
168
  key: "method",
169
- header: D("healthybowl.wallet.col.method", "Method"),
169
+ header: O("healthybowl.wallet.col.method", "Method"),
170
170
  render: (e) => /* @__PURE__ */ y("span", {
171
171
  className: "text-text-secondary",
172
- children: T(e, D)
172
+ children: E(e, O)
173
173
  })
174
174
  },
175
175
  {
176
176
  key: "amount",
177
- header: D("healthybowl.wallet.col.amount", "Amount"),
177
+ header: O("healthybowl.wallet.col.amount", "Amount"),
178
178
  render: (e) => {
179
- let t = E(e);
179
+ let t = D(e);
180
180
  return /* @__PURE__ */ b("span", {
181
181
  className: l("font-semibold tabular-nums", t < 0 ? "text-status-error-text" : "text-success"),
182
182
  children: [t > 0 ? "+" : t < 0 ? "-" : "", Y(Math.abs(t))]
@@ -185,9 +185,9 @@ var D = () => {
185
185
  },
186
186
  {
187
187
  key: "status",
188
- header: D("healthybowl.wallet.col.status", "Status"),
188
+ header: O("healthybowl.wallet.col.status", "Status"),
189
189
  render: (e) => {
190
- let t = ce(e);
190
+ let t = w(e);
191
191
  return /* @__PURE__ */ y(a, {
192
192
  label: t.label,
193
193
  variant: t.variant
@@ -196,64 +196,64 @@ var D = () => {
196
196
  }
197
197
  ];
198
198
  return /* @__PURE__ */ b(t, {
199
- title: D("healthybowl.wallet.title", "Credits & Payments"),
200
- description: k ? O("healthybowl.wallet.v2.purpose", "Your credit balance: buy credits, spend them, or take earnings to your bank.") : D("healthybowl.wallet.description", "Top up your platform credit balance with Razorpay and request a payout of your withdrawable balance to your bank."),
201
- actions: k && I && (!P || j) && (!F || j) ? /* @__PURE__ */ b("div", {
199
+ title: O("healthybowl.wallet.title", "Credits & Payments"),
200
+ description: A ? k("healthybowl.wallet.v2.purpose", "Your credit balance: buy credits, spend them, or take earnings to your bank.") : O("healthybowl.wallet.description", "Top up your platform credit balance with Razorpay and request a payout of your withdrawable balance to your bank."),
201
+ actions: A && L && (!F || M) && (!I || M) ? /* @__PURE__ */ b("div", {
202
202
  className: "flex flex-wrap items-center gap-2",
203
203
  children: [/* @__PURE__ */ b(x, {
204
204
  variant: "outline",
205
205
  onClick: () => void $(),
206
- disabled: K || Z <= 0 || !R,
207
- children: [/* @__PURE__ */ y(g, { className: "h-4 w-4" }), K ? D("healthybowl.wallet.payout.processing", "Processing…") : D("healthybowl.wallet.payout.cta", "Request Payout")]
206
+ disabled: K || Z <= 0 || !z,
207
+ children: [/* @__PURE__ */ y(_, { className: "h-4 w-4" }), K ? O("healthybowl.wallet.payout.processing", "Processing…") : O("healthybowl.wallet.payout.cta", "Request Payout")]
208
208
  }), /* @__PURE__ */ b(x, {
209
209
  onClick: () => J(!0),
210
- children: [/* @__PURE__ */ y(h, { className: "h-4 w-4" }), O("healthybowl.wallet.v2.buy", "Buy credits")]
210
+ children: [/* @__PURE__ */ y(g, { className: "h-4 w-4" }), k("healthybowl.wallet.v2.buy", "Buy credits")]
211
211
  })]
212
212
  }) : void 0,
213
213
  purpose: "Your farm-org's platform credit balance. Buy credits (UPI / card / netbanking via Razorpay) on the platform billing rail, and request a payout of your withdrawable balance to a bank account added in billing settings. Produce orders are paid at checkout by card / UPI — not from this balance. All payments run through the platform billing rail — HealthyBowl keeps no card data.",
214
- children: [P && !j ? /* @__PURE__ */ y(n, {}) : F && !j ? /* @__PURE__ */ y(o, {
215
- onRetry: () => void z(),
216
- title: D("healthybowl.wallet.error", "Couldn't load your wallet")
217
- }) : I ? k ? /* @__PURE__ */ y(f, {
218
- transactions: N,
219
- balances: j,
214
+ children: [F && !M ? /* @__PURE__ */ y(n, {}) : I && !M ? /* @__PURE__ */ y(o, {
215
+ onRetry: () => void B(),
216
+ title: O("healthybowl.wallet.error", "Couldn't load your wallet")
217
+ }) : L ? A ? /* @__PURE__ */ y(f, {
218
+ transactions: P,
219
+ balances: M,
220
220
  inr: Y,
221
- describe: (e) => w(e, D),
222
- method: (e) => T(e, D),
223
- signed: E,
221
+ describe: (e) => T(e, O),
222
+ method: (e) => E(e, O),
223
+ signed: D,
224
224
  packs: C,
225
225
  selectedPack: H,
226
226
  onSelectPack: U,
227
- buyOpen: fe,
227
+ buyOpen: pe,
228
228
  onOpenBuy: () => J(!0),
229
229
  onCloseBuy: () => J(!1),
230
230
  onBuy: () => void Q(),
231
231
  buying: W,
232
- needsPayoutAccount: !R && Z > 0
233
- }) : /* @__PURE__ */ b(v, { children: [
232
+ needsPayoutAccount: !z && Z > 0
233
+ }) : /* @__PURE__ */ b(se, { children: [
234
234
  /* @__PURE__ */ b("div", {
235
235
  className: "grid grid-cols-2 gap-4 lg:grid-cols-4",
236
236
  children: [
237
237
  /* @__PURE__ */ y(i, {
238
238
  hero: !0,
239
- label: D("healthybowl.wallet.balance.total", "Credit Balance"),
239
+ label: O("healthybowl.wallet.balance.total", "Credit Balance"),
240
240
  value: Y(X),
241
- icon: /* @__PURE__ */ y(se, { className: "h-5 w-5" })
241
+ icon: /* @__PURE__ */ y(oe, { className: "h-5 w-5" })
242
242
  }),
243
243
  /* @__PURE__ */ y(i, {
244
- label: D("healthybowl.wallet.balance.purchased", "Purchased"),
245
- value: Y(j?.purchased ?? 0),
246
- icon: /* @__PURE__ */ y(h, { className: "h-5 w-5" })
244
+ label: O("healthybowl.wallet.balance.purchased", "Purchased"),
245
+ value: Y(M?.purchased ?? 0),
246
+ icon: /* @__PURE__ */ y(g, { className: "h-5 w-5" })
247
247
  }),
248
248
  /* @__PURE__ */ y(i, {
249
- label: D("healthybowl.wallet.balance.earned", "Earned"),
250
- value: Y(j?.earned ?? 0),
251
- icon: /* @__PURE__ */ y(_, { className: "h-5 w-5" })
249
+ label: O("healthybowl.wallet.balance.earned", "Earned"),
250
+ value: Y(M?.earned ?? 0),
251
+ icon: /* @__PURE__ */ y(v, { className: "h-5 w-5" })
252
252
  }),
253
253
  /* @__PURE__ */ y(i, {
254
- label: D("healthybowl.wallet.balance.withdrawable", "Withdrawable"),
254
+ label: O("healthybowl.wallet.balance.withdrawable", "Withdrawable"),
255
255
  value: Y(Z),
256
- icon: /* @__PURE__ */ y(m, { className: "h-5 w-5" })
256
+ icon: /* @__PURE__ */ y(h, { className: "h-5 w-5" })
257
257
  })
258
258
  ]
259
259
  }),
@@ -264,19 +264,19 @@ var D = () => {
264
264
  children: [
265
265
  /* @__PURE__ */ b("div", {
266
266
  className: "flex items-center gap-2",
267
- children: [/* @__PURE__ */ y(h, { className: "h-4 w-4 text-text-secondary" }), /* @__PURE__ */ y("h2", {
267
+ children: [/* @__PURE__ */ y(g, { className: "h-4 w-4 text-text-secondary" }), /* @__PURE__ */ y("h2", {
268
268
  className: "text-sm font-semibold text-text-primary",
269
- children: D("healthybowl.wallet.buy.title", "Buy Credits")
269
+ children: O("healthybowl.wallet.buy.title", "Buy Credits")
270
270
  })]
271
271
  }),
272
- pe && /* @__PURE__ */ b("div", {
272
+ me && /* @__PURE__ */ b("div", {
273
273
  className: "flex items-start gap-3 rounded-lg border border-action-primary-bg/40 bg-action-primary-bg/10 p-3",
274
- children: [/* @__PURE__ */ y(_, { className: "mt-0.5 h-4 w-4 shrink-0 text-action-primary-bg" }), /* @__PURE__ */ b("div", { children: [/* @__PURE__ */ y("p", {
274
+ children: [/* @__PURE__ */ y(v, { className: "mt-0.5 h-4 w-4 shrink-0 text-action-primary-bg" }), /* @__PURE__ */ b("div", { children: [/* @__PURE__ */ y("p", {
275
275
  className: "text-sm font-semibold text-text-primary",
276
- children: D("healthybowl.wallet.empty.title", "Buy your first credits")
276
+ children: O("healthybowl.wallet.empty.title", "Buy your first credits")
277
277
  }), /* @__PURE__ */ y("p", {
278
278
  className: "text-xs text-text-secondary",
279
- children: D("healthybowl.wallet.empty.description", "Your wallet is empty. Top up your credit balance with UPI, card or netbanking via Razorpay.")
279
+ children: O("healthybowl.wallet.empty.description", "Your wallet is empty. Top up your credit balance with UPI, card or netbanking via Razorpay.")
280
280
  })] })]
281
281
  }),
282
282
  /* @__PURE__ */ y("div", {
@@ -291,19 +291,19 @@ var D = () => {
291
291
  children: Y(e)
292
292
  }), /* @__PURE__ */ y("span", {
293
293
  className: "text-[10px] text-text-secondary",
294
- children: D("healthybowl.wallet.buy.credits", "{{count}} credits", { count: String(e) })
294
+ children: O("healthybowl.wallet.buy.credits", "{{count}} credits", { count: String(e) })
295
295
  })]
296
296
  }, e))
297
297
  }),
298
298
  /* @__PURE__ */ b(x, {
299
299
  onClick: () => void Q(),
300
- disabled: W,
300
+ disabled: W || N == null,
301
301
  className: "w-full sm:w-auto",
302
- children: [/* @__PURE__ */ y(h, { className: "h-4 w-4" }), W ? D("healthybowl.wallet.buy.processing", "Opening Razorpay…") : D("healthybowl.wallet.buy.cta", "Buy Credits — {{amount}}", { amount: Y(H) })]
302
+ children: [/* @__PURE__ */ y(g, { className: "h-4 w-4" }), W ? O("healthybowl.wallet.buy.processing", "Opening Razorpay…") : O("healthybowl.wallet.buy.cta", "Buy Credits — {{amount}}", { amount: Y(H) })]
303
303
  }),
304
304
  /* @__PURE__ */ b("p", {
305
305
  className: "flex items-center gap-1.5 text-[11px] text-text-secondary",
306
- children: [/* @__PURE__ */ y(oe, { className: "h-3.5 w-3.5" }), D("healthybowl.wallet.buy.poweredBy", "Powered by platform billing + Razorpay (UPI / card / netbanking). HealthyBowl stores no card data.")]
306
+ children: [/* @__PURE__ */ y(ae, { className: "h-3.5 w-3.5" }), O("healthybowl.wallet.buy.poweredBy", "Powered by platform billing + Razorpay (UPI / card / netbanking). HealthyBowl stores no card data.")]
307
307
  })
308
308
  ]
309
309
  }), /* @__PURE__ */ b("div", {
@@ -311,20 +311,20 @@ var D = () => {
311
311
  children: [
312
312
  /* @__PURE__ */ b("div", {
313
313
  className: "flex items-center gap-2",
314
- children: [/* @__PURE__ */ y(g, { className: "h-4 w-4 text-text-secondary" }), /* @__PURE__ */ y("h2", {
314
+ children: [/* @__PURE__ */ y(_, { className: "h-4 w-4 text-text-secondary" }), /* @__PURE__ */ y("h2", {
315
315
  className: "text-sm font-semibold text-text-primary",
316
- children: D("healthybowl.wallet.payout.title", "Request Payout")
316
+ children: O("healthybowl.wallet.payout.title", "Request Payout")
317
317
  })]
318
318
  }),
319
319
  /* @__PURE__ */ y("p", {
320
320
  className: "text-xs text-text-secondary",
321
- children: D("healthybowl.wallet.payout.blurb", "Request a payout of your withdrawable credit balance to your linked bank account.")
321
+ children: O("healthybowl.wallet.payout.blurb", "Request a payout of your withdrawable credit balance to your linked bank account.")
322
322
  }),
323
323
  /* @__PURE__ */ b("div", {
324
324
  className: "rounded-lg bg-bg-sunken/40 p-3",
325
325
  children: [/* @__PURE__ */ y("p", {
326
326
  className: "text-[11px] uppercase tracking-wide text-text-secondary",
327
- children: D("healthybowl.wallet.payout.available", "Withdrawable")
327
+ children: O("healthybowl.wallet.payout.available", "Withdrawable")
328
328
  }), /* @__PURE__ */ y("p", {
329
329
  className: "text-2xl font-semibold tabular-nums text-text-primary",
330
330
  children: Y(Z)
@@ -333,17 +333,17 @@ var D = () => {
333
333
  /* @__PURE__ */ b(x, {
334
334
  variant: "outline",
335
335
  onClick: () => void $(),
336
- disabled: K || Z <= 0 || !R,
336
+ disabled: K || Z <= 0 || !z,
337
337
  className: "w-full",
338
- children: [/* @__PURE__ */ y(m, { className: "h-4 w-4" }), K ? D("healthybowl.wallet.payout.processing", "Processing…") : D("healthybowl.wallet.payout.cta", "Request Payout")]
338
+ children: [/* @__PURE__ */ y(h, { className: "h-4 w-4" }), K ? O("healthybowl.wallet.payout.processing", "Processing…") : O("healthybowl.wallet.payout.cta", "Request Payout")]
339
339
  }),
340
- !R && Z > 0 && /* @__PURE__ */ y("p", {
340
+ !z && Z > 0 && /* @__PURE__ */ y("p", {
341
341
  className: "text-[11px] text-status-warning-text",
342
- children: D("healthybowl.wallet.payout.noAccount", "Add a payout (bank) account in billing settings to request a payout.")
342
+ children: O("healthybowl.wallet.payout.noAccount", "Add a payout (bank) account in billing settings to request a payout.")
343
343
  }),
344
344
  Z <= 0 && /* @__PURE__ */ y("p", {
345
345
  className: "text-[11px] text-text-secondary",
346
- children: D("healthybowl.wallet.payout.nothing", "You have no withdrawable credits yet.")
346
+ children: O("healthybowl.wallet.payout.nothing", "You have no withdrawable credits yet.")
347
347
  })
348
348
  ]
349
349
  })]
@@ -352,33 +352,33 @@ var D = () => {
352
352
  className: "flex flex-col gap-3",
353
353
  children: [/* @__PURE__ */ b("div", {
354
354
  className: "flex items-center gap-2",
355
- children: [/* @__PURE__ */ y(ae, { className: "h-4 w-4 text-text-secondary" }), /* @__PURE__ */ y("h2", {
355
+ children: [/* @__PURE__ */ y(ie, { className: "h-4 w-4 text-text-secondary" }), /* @__PURE__ */ y("h2", {
356
356
  className: "text-sm font-semibold text-text-primary",
357
- children: D("healthybowl.wallet.txns.title", "Recent Transactions")
357
+ children: O("healthybowl.wallet.txns.title", "Recent Transactions")
358
358
  })]
359
- }), N.length === 0 ? /* @__PURE__ */ y(r, {
359
+ }), P.length === 0 ? /* @__PURE__ */ y(r, {
360
360
  illustration: "empty-files",
361
- title: D("healthybowl.wallet.txns.empty.title", "No transactions yet"),
362
- description: D("healthybowl.wallet.txns.empty.description", "Your top-ups and payouts will appear here."),
361
+ title: O("healthybowl.wallet.txns.empty.title", "No transactions yet"),
362
+ description: O("healthybowl.wallet.txns.empty.description", "Your top-ups and payouts will appear here."),
363
363
  glassIllustration: "money",
364
364
  size: "panel"
365
365
  }) : /* @__PURE__ */ y(ee, {
366
- columns: me,
367
- data: N,
366
+ columns: he,
367
+ data: P,
368
368
  keyField: "id",
369
369
  pageSize: 10,
370
- emptyMessage: D("healthybowl.wallet.txns.empty.title", "No transactions yet")
370
+ emptyMessage: O("healthybowl.wallet.txns.empty.title", "No transactions yet")
371
371
  })]
372
372
  })
373
373
  ] }) : /* @__PURE__ */ y(r, {
374
374
  illustration: "empty-data",
375
- title: D("healthybowl.wallet.noAccount.title", "No billing account yet"),
376
- description: D("healthybowl.wallet.noAccount.description", "This farm's organization doesn't have a billing account set up yet. Once it does, your credit balance and payments will appear here."),
375
+ title: O("healthybowl.wallet.noAccount.title", "No billing account yet"),
376
+ description: O("healthybowl.wallet.noAccount.description", "This farm's organization doesn't have a billing account set up yet. Once it does, your credit balance and payments will appear here."),
377
377
  glassIllustration: "money"
378
378
  }), /* @__PURE__ */ y(e, {
379
- toasts: le,
380
- onDismiss: ue
379
+ toasts: ce,
380
+ onDismiss: le
381
381
  })]
382
382
  });
383
383
  };
384
- export { D as CreditsWalletPage };
384
+ export { O as CreditsWalletPage };
@@ -19,7 +19,7 @@ export declare function normalizeBasePath(base: string): string;
19
19
  * nothing in the platform says what they are denominated in: neither `Workspace`
20
20
  * nor any organisation-settings type carries a currency, and the HealthyBowl
21
21
  * dashboard payload has no currency field either. The product itself states
22
- * rupees throughout — the wallet prices credits at "₹1 = 1 credit", order entry
22
+ * rupees throughout — the wallet shows credit values in ₹, order entry
23
23
  * is labelled "Amount (₹)", the accounting tables head their columns "(₹)" — so
24
24
  * ₹ is the only defensible label for an unlabelled HealthyBowl amount.
25
25
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@burdenoff/microfe-healthybowl",
3
- "version": "2026.1126.2",
3
+ "version": "2026.1128.1",
4
4
  "description": "Burdenoff HealthyBowl Microfrontend - Comprehensive organic farming and agro-foods management platform",
5
5
  "type": "module",
6
6
  "files": [