decord/alpha/source/actions/EntitlementActionCreators.tsx
github-actions c6aa9eb120 chore: update source for alpha 349.3
Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/05xxx/module_5030.js (118.4 MB)
2026-10-01 06:55:13 +00:00

123 lines
4.3 KiB
TypeScript

// Module ID: 7007
// Function ID: 7008
// Name: EntitlementActionCreators
// Dependencies: [5, 1074, 573, 1271, 5276, 2]
// Exports: fetchGiftableEntitlements, fetchUserEntitlements, fetchUserEntitlementsForApplication
// Module 7007 (EntitlementActionCreators)
import DispatcherDefault from "Dispatcher" /* 573 */;
import asyncGeneratorStep from "asyncGeneratorStep" /* 5 */;
const require = globalThis.__r;
const require = fn;
let closure_5 = async function _fetchUserEntitlements(arg0) {
let withSku = arg0;
c5 = 0;
c6 = 0;
c4 = 0;
let iter = (async (arg0, value) => {
closure_2 = tmp3;
let flag = withSku.withSku;
if (flag === undefined) {
flag = false;
}
closure_129_0 = flag;
let flag2 = tmp40.withApplication;
if (flag2 === undefined) {
flag2 = false;
}
closure_129_1 = flag2;
let flag3 = tmp40.excludeEnded;
if (flag3 === undefined) {
flag3 = true;
}
closure_129_2 = flag3;
const entitlementType = tmp40.entitlementType;
await "flex";
closure_130_1(closure_130_2[2]).dispatch({ type: "ENTITLEMENTS_FETCH_FOR_USER_START" });
const HTTP = closure_130_0(closure_130_2[3]).HTTP;
const request = { url: closure_130_4.ENTITLEMENTS_FOR_USER, query: { with_sku: closure_129_0, with_application: closure_129_1, entitlement_type: entitlementType, exclude_ended: closure_129_2 }, rejectWithError: true };
await HTTP.get(request);
if (2 === tmp7) {
c4 = 0;
closure_130_1(closure_130_2[2]).dispatch({ type: "ENTITLEMENTS_FETCH_FOR_USER_FAIL" });
c6 = 3;
closure_130_1(closure_130_2[2]);
} else if (arg0 === 1) {
c6 = 3;
throw value;
} else if (arg0 !== 2) {
closure_129_4 = value;
closure_130_1(closure_130_2[2]).dispatch({ type: "ENTITLEMENTS_FETCH_FOR_USER_SUCCESS", entitlements: closure_129_4.body, excludeEnded: closure_129_2 });
c4 = 0;
closure_130_1(closure_130_2[2]);
}
return value;
})();
iter.next();
return iter;
};
let closure_6 = async function _fetchGiftableEntitlements() {
closure_1 = tmp3;
DispatcherDefault.dispatch({ type: "ENTITLEMENTS_GIFTABLE_FETCH" });
await require("StoreUtils").httpGetWithCountryCodeQuery({ url: constants.ENTITLEMENTS_GIFTABLE, rejectWithError: true });
if (1 === tmp7) {
c3 = 0;
closure_129_1(closure_129_2[2]).dispatch({ type: "ENTITLEMENTS_GIFTABLE_FETCH_FAIL" });
c5 = 3;
closure_129_1(closure_129_2[2]);
} else if (arg0 === 1) {
c5 = 3;
throw arg1;
} else if (arg0 !== 2) {
closure_128_0 = arg1;
closure_129_1(closure_129_2[2]).dispatch({ type: "ENTITLEMENTS_GIFTABLE_FETCH_SUCCESS", entitlements: closure_128_0.body });
c3 = 0;
closure_129_1(closure_129_2[2]);
}
return arg1;
};
const Endpoints = fn(1074).Endpoints;
const size = fn(2);
const result = size.fileFinishedImporting("actions/EntitlementActionCreators.tsx");
export const fetchUserEntitlementsForApplication = function fetchUserEntitlementsForApplication(id, arg1) {
_require = id;
let flag = arg1;
if (arg1 === undefined) {
flag = true;
}
DispatcherDefault.wait(() => {
DispatcherDefault.dispatch({ type: "ENTITLEMENT_FETCH_APPLICATION_START", applicationId });
});
const HTTP = require("HTTPUtils").HTTP;
const request = { url: Endpoints.ENTITLEMENTS_FOR_APPLICATION(id), oldFormErrors: true, query: { exclude_consumed: flag }, rejectWithError: true };
value = HTTP.get(request);
return value.then((body) => {
DispatcherDefault.dispatch({ type: "ENTITLEMENT_FETCH_APPLICATION_SUCCESS", applicationId, entitlements: body.body });
return body.body;
}).catch(() => {
DispatcherDefault.dispatch({ type: "ENTITLEMENT_FETCH_APPLICATION_FAIL", applicationId });
});
};
export const fetchUserEntitlements = function fetchUserEntitlements() {
const self = this;
const apply = closure_5.apply;
if (typeof apply === "unknown") {
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
} else {
applyArgumentsResult = apply(self, arguments);
}
return applyArgumentsResult;
};
export const fetchGiftableEntitlements = function fetchGiftableEntitlements() {
const self = this;
const apply = closure_6.apply;
if (typeof apply === "unknown") {
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
} else {
applyArgumentsResult = apply(self, arguments);
}
return applyArgumentsResult;
};