Files
discord-decomp/modules/billing/stores/WalletBalanceStore.tsx
T
2026-11-01 12:12:55 +02:00

59 lines
1.4 KiB
TypeScript

// Metro module 12487 (f12488).
import Module589 from "../../../_bundle/Module589";
import Dispatcher from "../../../Dispatcher";
let c8629_0 = {};
let c8629_1 = new Set();
class WalletBalanceStore extends Module589.Store {
static displayName = "WalletBalanceStore";
getBalance(a0) {
let r4 = c8629_0[a0];
if (r4 == null) {
r4 = null;
}
return r4;
}
getIsFetching(a0) {
return c8629_1.has(a0);
}
}
const walletBalanceStore = new WalletBalanceStore(Dispatcher, {
BILLING_WALLET_BALANCE_FETCH_START: function handleFetchStart(a0) {
const set = new Set(c8629_1);
c8629_1 = set;
set.add(a0.paymentSourceId);
},
BILLING_WALLET_BALANCE_FETCH_SUCCESS: function handleFetchSuccess(a0) {
const set = new Set(c8629_1);
c8629_1 = set;
set.delete(a0.paymentSourceId);
const r15 = {
...c8629_0
};
r15[a0.paymentSourceId] = {
currency: a0.currency,
amount: a0.amount
};
c8629_0 = r15;
},
BILLING_WALLET_BALANCE_FETCH_FAIL: function handleFetchFail(a0) {
const set = new Set(c8629_1);
c8629_1 = set;
set.delete(a0.paymentSourceId);
},
WALLET_BALANCE_UPDATE: function handleBalanceUpdate(a0) {
const r1 = {
...c8629_0
};
r1[a0.paymentSourceId] = {
currency: a0.currency,
amount: a0.balance
};
c8629_0 = r1;
},
LOGOUT: function reset() {
c8629_0 = {};
c8629_1 = new Set();
}
});
export default walletBalanceStore;