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

178 lines
5.4 KiB
TypeScript

// Metro module 3837 (f3838).
import { FallbackCurrencyCountry } from "../../Constants";
import Module589 from "../../_bundle/Module589";
import Dispatcher from "../../Dispatcher";
let request, countryCode, request2, location2, request3, c2171_6, c2171_7, c2171_8, c2171_9, c2171_10, error, error2, c2171_13, c2171_14;
const handlePaymentSourceCreateEnd = function handlePaymentSourceCreateEnd() {
c2171_6 = false;
};
const handlePaymentSourcesFetchEnd = function handlePaymentSourcesFetchEnd() {
request = void 0;
};
const handleSubscriptionFetchEnd = function handleSubscriptionFetchEnd() {
c2171_9 = false;
};
const handleSubscriptionUpdateStart = function handleSubscriptionUpdateStart() {
c2171_10 = true;
};
const handleSubscriptionUpdateEnd = function handleSubscriptionUpdateEnd() {
c2171_10 = false;
};
c2171_6 = false;
c2171_7 = false;
c2171_8 = false;
c2171_9 = false;
c2171_10 = false;
error = null;
error2 = null;
c2171_13 = false;
c2171_14 = false;
class BillingInfoStore extends Module589.Store {
static displayName = "BillingInfoStore";
get isBusy() {
return c2171_6 || c2171_7 || c2171_10 || c2171_8;
}
get isUpdatingPaymentSource() {
return c2171_7;
}
get isRemovingPaymentSource() {
return c2171_8;
}
get isSyncing() {
return this.isPaymentSourceFetching || this.isSubscriptionFetching;
}
get isSubscriptionFetching() {
return c2171_9;
}
get isPaymentSourceFetching() {
return request != null;
}
get editSourceError() {
return error;
}
get removeSourceError() {
return error2;
}
get ipCountryCodeLoaded() {
return countryCode !== void 0;
}
get ipCountryCode() {
return countryCode;
}
get ipCountryCodeRequest() {
return request2;
}
get ipLocationLoaded() {
return location2 !== void 0;
}
get ipLocation() {
return location2;
}
get ipLocationRequest() {
return request3;
}
get ipLocationHasError() {
return c2171_14;
}
get ipCountryCodeWithFallback() {
let r1 = countryCode;
if (r1 == null) {
r1 = FallbackCurrencyCountry;
}
return r1;
}
get ipCountryCodeHasError() {
return c2171_13;
}
get paymentSourcesFetchRequest() {
return request;
}
}
const billingInfoStore = new BillingInfoStore(Dispatcher, {
BILLING_PAYMENT_SOURCE_CREATE_START: function handlePaymentSourceCreateStart() {
c2171_6 = true;
},
BILLING_PAYMENT_SOURCE_CREATE_SUCCESS: handlePaymentSourceCreateEnd,
BILLING_PAYMENT_SOURCE_CREATE_FAIL: handlePaymentSourceCreateEnd,
STRIPE_TOKEN_FAILURE: handlePaymentSourceCreateEnd,
BILLING_PAYMENT_SOURCE_REMOVE_START: function handlePaymentSourceRemoveStart() {
c2171_8 = true;
},
BILLING_PAYMENT_SOURCE_REMOVE_SUCCESS: function handlePaymentSourceRemoveSuccess() {
c2171_8 = false;
},
BILLING_PAYMENT_SOURCE_REMOVE_FAIL: function handlePaymentSourceRemoveFail({ error: error3 }) {
c2171_8 = false;
error2 = error3;
},
BILLING_PAYMENT_SOURCE_REMOVE_CLEAR_ERROR: function handleClearRemoveError() {
error2 = null;
},
BILLING_PAYMENT_SOURCE_UPDATE_START: function handlePaymentSourceUpdateStart() {
c2171_7 = true;
},
BILLING_PAYMENT_SOURCE_UPDATE_SUCCESS: function handlePaymentSourceUpdateSuccess() {
c2171_7 = false;
},
BILLING_PAYMENT_SOURCE_UPDATE_FAIL: function handlePaymentSourceUpdateFail({ error: error3 }) {
c2171_7 = false;
error = error3;
},
BILLING_PAYMENT_SOURCE_UPDATE_CLEAR_ERROR: function handleClearUpdateError() {
error = null;
},
BILLING_PAYMENT_SOURCES_FETCH_START: function handlePaymentSourcesFetchStart(a0) {
request = a0.request;
},
BILLING_PAYMENT_SOURCES_FETCH_SUCCESS: handlePaymentSourcesFetchEnd,
BILLING_PAYMENT_SOURCES_FETCH_FAIL: handlePaymentSourcesFetchEnd,
BILLING_SUBSCRIPTION_FETCH_START: function handleSubscriptionFetchStart() {
c2171_9 = true;
},
BILLING_SUBSCRIPTION_FETCH_SUCCESS: handleSubscriptionFetchEnd,
BILLING_SUBSCRIPTION_FETCH_FAIL: handleSubscriptionFetchEnd,
BILLING_SUBSCRIPTION_UPDATE_START: handleSubscriptionUpdateStart,
BILLING_SUBSCRIPTION_CANCEL_START: handleSubscriptionUpdateStart,
BILLING_SUBSCRIPTION_UPDATE_SUCCESS: handleSubscriptionUpdateEnd,
BILLING_SUBSCRIPTION_UPDATE_FAIL: handleSubscriptionUpdateEnd,
BILLING_SUBSCRIPTION_CANCEL_FAIL: handleSubscriptionUpdateEnd,
BILLING_SUBSCRIPTION_CANCEL_SUCCESS: handleSubscriptionUpdateEnd,
BILLING_IP_COUNTRY_CODE_FETCH_START: function handleIpCountryCodeFetchStart(a0) {
request2 = a0.request;
},
BILLING_SET_IP_COUNTRY_CODE: function handleSetIpCountryCode(a0) {
countryCode = a0.countryCode;
},
BILLING_IP_COUNTRY_CODE_FAILURE: function handleIpCountryCodeFailure() {
countryCode = null;
c2171_13 = true;
},
BILLING_IP_LOCATION_FETCH_START: function handleIpLocationFetchStart(a0) {
request3 = a0.request;
},
BILLING_SET_IP_LOCATION: function handleSetIpLocation(a0) {
location2 = a0.location;
},
BILLING_IP_LOCATION_FAILURE: function handleIpLocationFailure() {
location2 = null;
c2171_14 = true;
},
LOGOUT: function handleLogout() {
request = void 0;
request2 = void 0;
countryCode = void 0;
c2171_13 = false;
location2 = void 0;
c2171_14 = false;
request3 = void 0;
error2 = null;
error = null;
},
CONNECTION_OPEN: function handleConnectionOpen({ countryCode: countryCode2 }) {
if (countryCode2 != null) {
countryCode = countryCode2;
}
}
});
export default billingInfoStore;