decord/source/modules/premium_apps/ApplicationSubscriptionsActionCreators.tsx
github-actions ecf26fc058 chore: update source for alpha 347.2
Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4823.js (118.4 MB)
2026-09-16 07:03:15 +00:00

268 lines
10 KiB
TypeScript

// Module ID: 14612
// Function ID: 14613
// Name: ApplicationSubscriptionsActionCreators
// Dependencies: [5, 1074, 573, 9681, 7367, 2]
// Exports: dismissApplicationSubscriptionExpirationNotice, fetchAllSubscriptionListingsDataForApplication, fetchEntitlementsForGuild
// Module 14612 (ApplicationSubscriptionsActionCreators)
import DispatcherDefault from "Dispatcher" /* 573 */;
import ApplicationSubscriptionsHttpApiAll from "ApplicationSubscriptionsHttpApi" /* 9681 */;
import asyncGeneratorStep from "asyncGeneratorStep" /* 5 */;
function transformSubscriptionListingToSku(id) {
return { id: id.id, type: constants2.SUBSCRIPTION, application_id: id.application_id, product_line: constants.APPLICATION, name: id.name, summary: "", description: id.description, flags: id.sku_flags, manifests: [], available_regions: [], legal_notice: "", deleted: id.soft_deleted, price_tier: 0, show_age_gate: false, restricted: false };
}
function transformSubscriptionListingToStoreListing(id) {
const obj = { id: id.id, sku: { id: id.id, type: constants2.SUBSCRIPTION, application_id: id.application_id, product_line: constants.APPLICATION, name: id.name, summary: "", description: id.description, flags: id.sku_flags, manifests: [], available_regions: [], legal_notice: "", deleted: id.soft_deleted, price_tier: 0, show_age_gate: false, restricted: false }, summary: id.description, description: id.description, benefits: null, thumbnail: null, published: null };
let prop = id.store_listing_benefits;
if (prop == null) {
prop = [];
}
obj.benefits = prop;
({ image_asset: obj.thumbnail, published: obj.published } = id);
return obj;
}
function dispatchCompat(arr) {
const obj = DispatcherDefault;
obj.dispatch({ type: "SKUS_FETCH_SUCCESS", skus: arr.map(transformSubscriptionListingToSku) });
const obj2 = { type: "SKUS_FETCH_SUCCESS", skus: arr.map(transformSubscriptionListingToSku) };
const obj3 = DispatcherDefault;
obj3.dispatch({ type: "STORE_LISTINGS_FETCH_SUCCESS", storeListings: arr.map(transformSubscriptionListingToStoreListing) });
const iter = arr[Symbol.iterator]();
const obj4 = { type: "STORE_LISTINGS_FETCH_SUCCESS", storeListings: arr.map(transformSubscriptionListingToStoreListing) };
while (iter !== undefined) {
let obj5 = DispatcherDefault;
let obj9 = { type: "SUBSCRIPTION_PLANS_FETCH_SUCCESS", skuId: null, subscriptionPlans: null };
({ id: obj6.skuId, subscription_plans: obj6.subscriptionPlans } = nextResult);
let dispatchResult2 = obj5.dispatch(obj9);
continue;
}
}
let closure_9 = async function _fetchAllSubscriptionListingsDataForApplication(applicationId, groupListingId) {
c7 = 0;
c8 = 0;
c6 = 0;
return (async (arg0, value) => {
closure_4 = tmp3;
closure_131_0 = applicationId;
DispatcherDefault.dispatch({ type: "APPLICATION_SUBSCRIPTIONS_FETCH_LISTINGS", applicationId, groupListingId });
await ApplicationSubscriptionsHttpApiAll.getApplicationSubscriptionGroupListingsForApplication(applicationId, groupListingId);
closure_132_0(closure_132_2[2]).dispatch({ type: "APPLICATION_SUBSCRIPTIONS_FETCH_LISTINGS_FAILURE", applicationId: closure_131_0 });
closure_131_1 = await "HermesInternal";
closure_132_0(closure_132_2[2]).dispatch({ type: "APPLICATION_SUBSCRIPTIONS_FETCH_LISTINGS_SUCCESS", applicationId: closure_131_0, groupListing: closure_131_1 });
const subscription_listings = closure_131_1.subscription_listings;
closure_2 = subscription_listings;
if (subscription_listings == null) {
closure_2 = [];
}
closure_132_8(closure_2);
return closure_131_1;
})();
};
let closure_10 = async function _fetchEntitlementsForGuild(guildId) {
c5 = 0;
c6 = 0;
c4 = 0;
return (async (arg0, value) => {
closure_2 = tmp3;
closure_129_0 = guildId;
DispatcherDefault.dispatch({ type: "APPLICATION_SUBSCRIPTIONS_FETCH_ENTITLEMENTS", guildId });
await ApplicationSubscriptionsHttpApiAll.getEntitlementsForGuild(guildId);
if (1 === tmp7) {
c4 = 0;
closure_130_0(closure_130_2[2]).dispatch({ type: "APPLICATION_SUBSCRIPTIONS_FETCH_ENTITLEMENTS_FAILURE", guildId: closure_129_0 });
c6 = 3;
closure_130_0(closure_130_2[2]);
} else if (arg0 === 1) {
c6 = 3;
throw value;
} else if (arg0 !== 2) {
closure_129_1 = value;
closure_130_0(closure_130_2[2]).dispatch({ type: "APPLICATION_SUBSCRIPTIONS_FETCH_ENTITLEMENTS_SUCCESS", guildId: closure_129_0, entitlements: closure_129_1 });
c4 = 0;
closure_130_0(closure_130_2[2]);
}
return value;
})();
};
function fetchSubscriptionListingForPlan() {
const self = this;
const apply = closure_12.apply;
if (typeof apply === "unknown") {
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
} else {
applyArgumentsResult = apply(self, arguments);
}
return applyArgumentsResult;
}
let closure_12 = async function _fetchSubscriptionListingForPlan(arg0, value) {
if (c8 === 2) {
c8 = 3;
throw new TypeError("Generator functions may not be called on executing generators");
} else if (tmp6 === 3) {
if (arg0 === 1) {
throw value;
} else if (arg0 === 2) {
const obj2 = { value, done: true };
return obj2;
} else {
return { value: "HermesInternal", done: null };
}
} else {
try {
c8 = 2;
if (0 === c7) {
if (arg0 === 1) {
c8 = 3;
throw value;
} else if (arg0 === 2) {
c8 = 3;
const obj3 = { value, done: true };
return obj3;
} else {
closure_4 = tmp3;
closure_3 = tmp7;
closure_131_1 = undefined;
closure_131_0 = closure_0;
let num13 = closure_1;
if (closure_1 === undefined) {
num13 = 0;
}
closure_131_1 = num13;
closure_131_2 = undefined;
closure_131_3 = undefined;
c7 = 1;
c8 = 1;
return { value: "PX_16", done: true };
}
} else if (1 === tmp7) {
if (arg0 === 1) {
c8 = 3;
throw value;
} else if (arg0 === 2) {
c8 = 3;
const obj4 = { value, done: true };
return obj4;
} else {
const obj5 = { type: "APPLICATION_SUBSCRIPTIONS_FETCH_LISTING_FOR_PLAN", planId: closure_131_0 };
closure_132_0(closure_132_2[2]).dispatch(obj5);
c6 = 1;
const obj12 = closure_132_0(closure_132_2[2]);
c7 = 3;
c8 = 1;
const obj6 = { value: closure_132_1(closure_132_2[3]).getSubscriptionGroupForSubscriptionPlan(closure_131_0), done: false };
return obj6;
}
} else if (2 === tmp7) {
c6 = 0;
closure_131_4 = closure_5;
if ("status" in closure_131_4) {
if (429 === closure_131_4.status) {
if (closure_131_1 < 10) {
const sum = closure_131_1 + 1;
closure_131_1 = sum;
c7 = 5;
c8 = 1;
const obj7 = { value: closure_132_11(closure_131_0, sum), done: false };
return obj7;
}
}
}
throw closure_131_4;
} else if (3 === tmp7) {
if (arg0 === 1) {
c8 = 3;
throw value;
} else if (arg0 === 2) {
c6 = 0;
c8 = 3;
const obj8 = { value, done: true };
return obj8;
} else {
closure_131_2 = value;
const obj9 = { type: "APPLICATION_SUBSCRIPTIONS_FETCH_LISTING_FOR_PLAN_SUCCESS", groupListing: closure_131_2 };
closure_132_0(closure_132_2[2]).dispatch(obj9);
const subscription_listings = closure_131_2.subscription_listings;
closure_2 = subscription_listings;
if (subscription_listings == null) {
closure_2 = [];
}
closure_131_3 = closure_2;
c7 = 4;
c8 = 1;
const obj11 = {
value: Promise.all(closure_131_3.map((id) => {
if (id.subscription_plans[0].id === closure_1_0) {
const obj = closure_1(closure_2[4]);
return obj.fetchSubscriptionPlansForSKU(id.id, undefined, undefined, true);
}
})),
done: false
};
return obj11;
}
} else {
if (4 === tmp7) {
if (arg0 === 1) {
c8 = 3;
throw value;
} else if (arg0 === 2) {
c6 = 0;
c8 = 3;
const obj13 = { value, done: true };
return obj13;
} else {
closure_132_8(closure_131_3);
c6 = 0;
}
} else if (arg0 === 1) {
c8 = 3;
throw value;
} else if (arg0 === 2) {
c8 = 3;
let obj = { value, done: true };
return obj;
}
c8 = 3;
return { value: "HermesInternal", done: null };
}
} catch (tmp33) {
closure_5 = tmp33;
if (tmp4 === c6) {
c8 = tmp2;
throw tmp33;
} else {
c7 = tmp;
}
}
}
};
const Constants = fn(1074);
({ SKUProductLines: closure_4, SKUTypes: hasOwnProperty } = Constants);
const size = fn(2);
const result = size.fileFinishedImporting("modules/premium_apps/ApplicationSubscriptionsActionCreators.tsx");
export const fetchAllSubscriptionListingsDataForApplication = function fetchAllSubscriptionListingsDataForApplication() {
const self = this;
const apply = closure_9.apply;
if (typeof apply === "unknown") {
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
} else {
applyArgumentsResult = apply(self, arguments);
}
return applyArgumentsResult;
};
export const fetchEntitlementsForGuild = function fetchEntitlementsForGuild() {
const self = this;
const apply = closure_10.apply;
if (typeof apply === "unknown") {
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
} else {
applyArgumentsResult = apply(self, arguments);
}
return applyArgumentsResult;
};
export const dismissApplicationSubscriptionExpirationNotice = function dismissApplicationSubscriptionExpirationNotice(guildId) {
DispatcherDefault.dispatch({ type: "APPLICATION_SUBSCRIPTIONS_CHANNEL_NOTICE_DISMISSED", guildId });
};
export { fetchSubscriptionListingForPlan };