decord/source/stores/billing/PaymentSourceStore.tsx

128 lines
3.6 KiB
TypeScript
Raw Normal View History

2026-08-24 06:08:38 +00:00
// Module ID: 4045
// Function ID: 4046
2026-07-29 08:29:29 +00:00
// Name: handlePaymentSourceUpdate
2026-08-24 06:08:38 +00:00
// Dependencies: [4046, 589, 709, 2]
2026-07-23 10:11:24 +00:00
2026-08-24 06:08:38 +00:00
// Module 4045 (handlePaymentSourceUpdate)
import initializeDefault from "initialize" /* 589 */;
import dispatcherDefault from "dispatcher" /* 709 */;
import closure_0 from "createFromServer" /* 4046 */;
2026-07-20 16:05:17 +00:00
function handlePaymentSourceUpdate(paymentSource) {
paymentSource = paymentSource.paymentSource;
const obj = {};
2026-07-23 10:11:24 +00:00
const merged = Object.assign(obj);
2026-07-20 16:05:17 +00:00
obj[paymentSource.id] = paymentSource;
let isDefault = paymentSource.isDefault;
if (!isDefault) {
const _Object = Object;
2026-07-23 10:11:24 +00:00
isDefault = 1 === Object.keys(obj).length;
2026-07-20 16:05:17 +00:00
}
if (isDefault) {
const id = paymentSource.id;
}
}
2026-07-29 08:29:29 +00:00
let closure_1 = {};
let c2 = null;
let c3 = false;
2026-08-24 06:08:38 +00:00
const Store = initializeDefault.Store;
2026-07-29 08:29:29 +00:00
class PaymentSourceStore extends Store {
}
const prototype = PaymentSourceStore.prototype;
Object.defineProperty(prototype, "paymentSources", {
get: function paymentSources() {
return closure_1;
},
set: undefined
});
Object.defineProperty(prototype, "paymentSourceIds", {
get: function paymentSourceIds() {
return Object.keys(closure_1);
},
set: undefined
});
Object.defineProperty(prototype, "defaultPaymentSourceId", {
get: function defaultPaymentSourceId() {
return c2;
},
set: undefined
});
Object.defineProperty(prototype, "defaultPaymentSource", {
get: function defaultPaymentSource() {
let tmp = null;
if (null != c2) {
tmp = dependencyMap[c2];
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return tmp;
},
set: undefined
});
Object.defineProperty(prototype, "hasFetchedPaymentSources", {
get: function hasFetchedPaymentSources() {
return c3;
},
set: undefined
});
prototype["getDefaultBillingCountryCode"] = function getDefaultBillingCountryCode() {
const defaultPaymentSource = this.defaultPaymentSource;
let paymentMethodCountry = null;
if (null != defaultPaymentSource) {
paymentMethodCountry = defaultPaymentSource.paymentMethodCountry;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return paymentMethodCountry;
};
prototype["getPaymentSource"] = function getPaymentSource(paymentSourceId) {
return dependencyMap[paymentSourceId];
};
PaymentSourceStore.displayName = "PaymentSourceStore";
2026-08-24 06:08:38 +00:00
const paymentSourceStore = new PaymentSourceStore(dispatcherDefault, {
2026-07-20 16:05:17 +00:00
BILLING_PAYMENT_SOURCE_CREATE_SUCCESS: handlePaymentSourceUpdate,
BILLING_PAYMENT_SOURCE_UPDATE_SUCCESS: handlePaymentSourceUpdate,
BILLING_PAYMENT_SOURCE_FETCH_SUCCESS: handlePaymentSourceUpdate,
BILLING_PAYMENT_SOURCES_FETCH_SUCCESS: function handlePaymentSourceFetch(paymentSources) {
paymentSources = paymentSources.paymentSources;
2026-08-24 06:08:38 +00:00
closure_1 = {};
2026-07-20 16:05:17 +00:00
let id = null;
2026-07-29 08:29:29 +00:00
for (const item10009 of paymentSources) {
let tmp2 = closure_1;
2026-08-24 06:08:38 +00:00
let tmp3 = closure_0;
2026-07-29 08:29:29 +00:00
let tmp = item10009;
2026-08-24 06:08:38 +00:00
closure_1[item10009.id] = closure_0.createFromServer(item10009);
2026-07-29 08:29:29 +00:00
if (item10009.default) {
let tmp4 = item10009;
id = tmp.id;
}
continue;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
let tmp5 = null == id;
if (tmp5) {
tmp5 = paymentSources.length > 0;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (tmp5) {
2026-07-20 16:05:17 +00:00
id = paymentSources[0].id;
}
2026-08-24 06:08:38 +00:00
c3 = true;
2026-07-20 16:05:17 +00:00
},
BILLING_PAYMENT_SOURCE_REMOVE_SUCCESS: function handlePaymentSourceRemove(id) {
2026-07-23 10:11:24 +00:00
const obj = {};
const merged = Object.assign(obj);
delete tmp[tmp2];
if (first === id.id) {
2026-07-20 16:05:17 +00:00
const _Object = Object;
2026-07-23 10:11:24 +00:00
const keys = Object.keys(obj);
first = null;
2026-07-20 16:05:17 +00:00
if (0 !== keys.length) {
first = keys[0];
}
}
},
LOGOUT: function handleLogout() {
2026-08-24 06:08:38 +00:00
closure_1 = {};
c2 = null;
c3 = false;
2026-07-20 16:05:17 +00:00
}
});
2026-08-24 06:08:38 +00:00
const result = require("set").fileFinishedImporting("stores/billing/PaymentSourceStore.tsx");
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
export default paymentSourceStore;