decord/alpha/source/actions/EntitlementActionCreators.tsx

124 lines
4.3 KiB
TypeScript
Raw Normal View History

// Module ID: 7007
// Function ID: 7008
// Name: EntitlementActionCreators
// Dependencies: [5, 1074, 573, 1271, 5276, 2]
2026-07-20 16:05:17 +00:00
// Exports: fetchGiftableEntitlements, fetchUserEntitlements, fetchUserEntitlementsForApplication
// Module 7007 (EntitlementActionCreators)
import DispatcherDefault from "Dispatcher" /* 573 */;
import asyncGeneratorStep from "asyncGeneratorStep" /* 5 */;
2026-07-23 10:11:24 +00:00
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]);
2026-07-29 08:29:29 +00:00
}
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) {
2026-08-04 21:03:28 +00:00
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]);
2026-07-29 08:29:29 +00:00
}
return arg1;
};
const Endpoints = fn(1074).Endpoints;
const size = fn(2);
const result = size.fileFinishedImporting("actions/EntitlementActionCreators.tsx");
2026-07-20 16:05:17 +00:00
export const fetchUserEntitlementsForApplication = function fetchUserEntitlementsForApplication(id, arg1) {
_require = id;
2026-07-20 16:05:17 +00:00
let flag = arg1;
if (arg1 === undefined) {
flag = true;
}
DispatcherDefault.wait(() => {
DispatcherDefault.dispatch({ type: "ENTITLEMENT_FETCH_APPLICATION_START", applicationId });
2026-07-20 16:05:17 +00:00
});
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);
2026-07-20 16:05:17 +00:00
return value.then((body) => {
DispatcherDefault.dispatch({ type: "ENTITLEMENT_FETCH_APPLICATION_SUCCESS", applicationId, entitlements: body.body });
2026-07-20 16:05:17 +00:00
return body.body;
}).catch(() => {
DispatcherDefault.dispatch({ type: "ENTITLEMENT_FETCH_APPLICATION_FAIL", applicationId });
2026-07-20 16:05:17 +00:00
});
};
export const fetchUserEntitlements = function fetchUserEntitlements() {
2026-07-29 08:29:29 +00:00
const self = this;
const apply = closure_5.apply;
2026-07-29 08:29:29 +00:00
if (typeof apply === "unknown") {
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
} else {
applyArgumentsResult = apply(self, arguments);
}
return applyArgumentsResult;
2026-07-20 16:05:17 +00:00
};
export const fetchGiftableEntitlements = function fetchGiftableEntitlements() {
2026-07-29 08:29:29 +00:00
const self = this;
const apply = closure_6.apply;
2026-07-29 08:29:29 +00:00
if (typeof apply === "unknown") {
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
} else {
applyArgumentsResult = apply(self, arguments);
}
return applyArgumentsResult;
2026-07-20 16:05:17 +00:00
};