174 lines
4.5 KiB
TypeScript
174 lines
4.5 KiB
TypeScript
// Metro module 5850 (f5851).
|
|
import { Endpoints } from "../Constants";
|
|
import Dispatcher from "../Dispatcher";
|
|
import { HTTP } from "../_bundle/sendRequest";
|
|
import { httpGetWithCountryCodeQuery } from "../utils/StoreUtils";
|
|
export function fetchUserEntitlementsForApplication(a0) {
|
|
const applicationId = a0;
|
|
let exclude_consumed = arguments[1];
|
|
if (exclude_consumed === void 0) {
|
|
exclude_consumed = true;
|
|
}
|
|
Dispatcher.wait(() => {
|
|
Dispatcher.dispatch({
|
|
type: "ENTITLEMENT_FETCH_APPLICATION_START",
|
|
applicationId
|
|
});
|
|
});
|
|
return HTTP.get({
|
|
url: Endpoints.ENTITLEMENTS_FOR_APPLICATION(a0),
|
|
oldFormErrors: true,
|
|
query: {
|
|
exclude_consumed
|
|
},
|
|
rejectWithError: true
|
|
}).then((result) => {
|
|
Dispatcher.dispatch({
|
|
type: "ENTITLEMENT_FETCH_APPLICATION_SUCCESS",
|
|
applicationId,
|
|
entitlements: result.body
|
|
});
|
|
return result.body;
|
|
}).catch(() => {
|
|
Dispatcher.dispatch({
|
|
type: "ENTITLEMENT_FETCH_APPLICATION_FAIL",
|
|
applicationId
|
|
});
|
|
});
|
|
}
|
|
export async function fetchUserEntitlements(c25631_0) {
|
|
let r16, excludeEnded, withApplication;
|
|
let c25631_4 = 0;
|
|
let c29629_0, c29629_1, c29629_2, c29629_3, c29629_4;
|
|
L21: {
|
|
try {
|
|
L16: {
|
|
L13: {
|
|
L14: {
|
|
L10: {
|
|
c29629_0 = void 0;
|
|
c29629_1 = void 0;
|
|
c29629_2 = void 0;
|
|
c29629_3 = void 0;
|
|
r16 = c25631_0;
|
|
const withSku = r16.withSku;
|
|
if (withSku !== void 0) {
|
|
c29629_0 = withSku;
|
|
withApplication = r16.withApplication;
|
|
if (withApplication !== void 0) {
|
|
break L10;
|
|
}
|
|
} else {
|
|
c29629_0 = false;
|
|
withApplication = r16.withApplication;
|
|
if (withApplication !== void 0) {
|
|
break L10;
|
|
}
|
|
}
|
|
c29629_1 = false;
|
|
excludeEnded = r16.excludeEnded;
|
|
if (excludeEnded !== void 0) {
|
|
break L13;
|
|
}
|
|
break L14;
|
|
}
|
|
c29629_1 = withApplication;
|
|
excludeEnded = r16.excludeEnded;
|
|
if (excludeEnded !== void 0) {
|
|
break L13;
|
|
}
|
|
}
|
|
c29629_2 = true;
|
|
c29629_3 = r16.entitlementType;
|
|
c29629_4 = void 0;
|
|
break L16;
|
|
}
|
|
c29629_2 = excludeEnded;
|
|
c29629_3 = r16.entitlementType;
|
|
c29629_4 = void 0;
|
|
}
|
|
await void 0;
|
|
Dispatcher.dispatch({
|
|
type: "ENTITLEMENTS_FETCH_FOR_USER_START"
|
|
});
|
|
c25631_4 = 1;
|
|
c29629_4 = await HTTP.get({
|
|
url: Endpoints.ENTITLEMENTS_FOR_USER,
|
|
query: {
|
|
with_sku: c29629_0,
|
|
with_application: c29629_1,
|
|
entitlement_type: c29629_3,
|
|
exclude_ended: c29629_2
|
|
},
|
|
rejectWithError: true
|
|
});
|
|
Dispatcher.dispatch({
|
|
type: "ENTITLEMENTS_FETCH_FOR_USER_SUCCESS",
|
|
entitlements: c29629_4.body,
|
|
excludeEnded: c29629_2
|
|
});
|
|
c25631_4 = 0;
|
|
} catch ($e) {
|
|
let r8 = $e;
|
|
if (c25631_4 !== 0) {
|
|
while (true) {
|
|
try {
|
|
c25631_4 = 0;
|
|
Dispatcher.dispatch({
|
|
type: "ENTITLEMENTS_FETCH_FOR_USER_FAIL"
|
|
});
|
|
break L21;
|
|
} catch ($e) {
|
|
r8 = $e;
|
|
if (c25631_4 === 0) {
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
throw r8;
|
|
}
|
|
}
|
|
}
|
|
export async function fetchGiftableEntitlements() {
|
|
let c25632_3 = 0;
|
|
let c29630_0;
|
|
L10: {
|
|
try {
|
|
c29630_0 = void 0;
|
|
Dispatcher.dispatch({
|
|
type: "ENTITLEMENTS_GIFTABLE_FETCH"
|
|
});
|
|
c25632_3 = 1;
|
|
c29630_0 = await httpGetWithCountryCodeQuery({
|
|
url: Endpoints.ENTITLEMENTS_GIFTABLE,
|
|
rejectWithError: true
|
|
});
|
|
Dispatcher.dispatch({
|
|
type: "ENTITLEMENTS_GIFTABLE_FETCH_SUCCESS",
|
|
entitlements: c29630_0.body
|
|
});
|
|
c25632_3 = 0;
|
|
} catch ($e) {
|
|
let r8 = $e;
|
|
if (c25632_3 !== 0) {
|
|
while (true) {
|
|
try {
|
|
c25632_3 = 0;
|
|
Dispatcher.dispatch({
|
|
type: "ENTITLEMENTS_GIFTABLE_FETCH_FAIL"
|
|
});
|
|
break L10;
|
|
} catch ($e) {
|
|
r8 = $e;
|
|
if (c25632_3 === 0) {
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
throw r8;
|
|
}
|
|
}
|
|
}
|