decord/alpha/source/utils/StoreUtils.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

297 lines
9.4 KiB
TypeScript

// Module ID: 5276
// Function ID: 5277
// Name: StoreUtils
// Dependencies: [5, 502, 4519, 4520, 4523, 1074, 5277, 5275, 5356, 1432, 5358, 1271, 1364, 1115, 2]
// Exports: getAssetURL, getPrimarySKUForApplication, httpGetWithCountryCodeQuery, nativePlatformTypeToSKUOperatingSystem, skuOperatingSystemToText
// Module 5276 (StoreUtils)
import util from "util" /* 1115 */;
import PlatformUtils from "PlatformUtils" /* 1364 */;
import ImageLoaderUtils from "ImageLoaderUtils" /* 1432 */;
import asyncGeneratorStep from "asyncGeneratorStep" /* 5 */;
import AuthenticationStore from "AuthenticationStore" /* 502 */;
import BillingInfoStore from "BillingInfoStore" /* 4519 */;
import PaymentSourceStore from "PaymentSourceStore" /* 4520 */;
import SubscriptionStore from "SubscriptionStore" /* 4523 */;
import allSettled_mod from "allSettled" /* 5277 */;
require = fn;
function fetchCountryCodeQueryDependencies() {
const items = [];
if (!PaymentSourceStore.hasFetchedPaymentSources) {
let paymentSourcesFetchRequest = BillingInfoStore.paymentSourcesFetchRequest;
if (paymentSourcesFetchRequest == null) {
paymentSourcesFetchRequest = require("actions/BillingActionCreators").fetchPaymentSources();
let obj = require("actions/BillingActionCreators");
}
items.push(paymentSourcesFetchRequest);
}
if (!BillingInfoStore.ipCountryCodeLoaded) {
items.push(require("actions/BillingActionCreators").fetchIpCountryCode());
const obj2 = require("actions/BillingActionCreators");
}
_require = asyncGeneratorStep(async (arg0, value) => {
if (c3 === 2) {
c3 = 3;
throw new TypeError("Generator functions may not be called on executing generators");
} else if (tmp3 === 3) {
if (arg0 === 1) {
throw value;
} else if (arg0 === 2) {
const obj3 = { value, done: true };
return obj3;
} else {
return { value: "HermesInternal", done: null };
}
} else {
try {
c3 = 2;
if (0 === c2) {
if (arg0 === 1) {
c3 = 3;
throw value;
} else if (arg0 === 2) {
c3 = 3;
const obj4 = { value, done: true };
return obj4;
} else {
c1 = 0;
closure_129_0 = closure_0;
if (SubscriptionStore.hasFetchedSubscriptions()) {
tmp18();
} else if (BillingInfoStore.isSubscriptionFetching) {
function wait() {
if (closure_2_4.isSubscriptionFetching) {
const _setTimeout = setTimeout;
const timerId = setTimeout(closure_1_1, 50);
} else {
closure_1_0();
}
}
closure_129_1 = wait;
wait();
} else {
c2 = 1;
c3 = 1;
const obj5 = { value: closure_0(c1[10]).fetchSubscriptions(), done: false };
return obj5;
}
c3 = 3;
tmp18 = closure_0;
}
} else if (arg0 === 1) {
c3 = 3;
throw value;
} else if (arg0 !== 2) {
closure_129_0();
}
c3 = 3;
const obj = { value, done: true };
return obj;
} catch (tmp13) {
c3 = tmp;
throw tmp13;
}
}
});
items.push(new Promise(function() {
const self = this;
const apply = closure_0.apply;
if (typeof apply === "unknown") {
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
} else {
applyArgumentsResult = apply(self, arguments);
}
return applyArgumentsResult;
}));
return Promise.allSettled(items);
}
let closure_11 = async function _httpGetWithCountryCodeQuery(arg0, value) {
closure_4 = tmp2;
closure_132_0 = closure_0;
let flag = closure_1;
if (closure_1 === undefined) {
flag = true;
}
closure_132_1 = flag;
await "flex";
if (1 === tmp5) {
if (arg0 === 1) {
c7 = 3;
throw value;
} else if (arg0 === 2) {
c7 = 3;
return { value, done: true };
} else {
let isAuthenticatedResult = closure_132_1;
if (closure_132_1) {
isAuthenticatedResult = closure_133_3.isAuthenticated();
}
if (isAuthenticatedResult) {
const items = [closure_133_10(), ];
items[1] = new Promise((arg0) => setTimeout(arg0, 10000));
c6 = 2;
c7 = 1;
new Promise((arg0) => setTimeout(arg0, 10000));
return { value: Promise.race(items), done: false };
}
}
} else if (arg0 === 1) {
c7 = 3;
throw value;
} else if (arg0 === 2) {
c7 = 3;
return { value, done: true };
}
let defaultBillingCountryCode = closure_133_5.getDefaultBillingCountryCode();
const defaultPaymentSource = closure_133_5.defaultPaymentSource;
if (defaultPaymentSource != null) {
const id = defaultPaymentSource.id;
}
c2 = id;
if (id == null) {
c2 = null;
}
let paymentSourceId = c2;
const premiumTypeSubscription = closure_133_6.getPremiumTypeSubscription();
let tmp19 = null != premiumTypeSubscription;
if (tmp19) {
tmp19 = null != premiumTypeSubscription.paymentSourceId;
}
if (tmp19) {
paymentSourceId = premiumTypeSubscription.paymentSourceId;
}
if (null === defaultBillingCountryCode) {
const ipCountryCode = closure_133_4.ipCountryCode;
c3 = ipCountryCode;
if (ipCountryCode == null) {
c3 = null;
}
defaultBillingCountryCode = c3;
}
closure_132_5 = {};
if (null != defaultBillingCountryCode) {
closure_132_5.country_code = defaultBillingCountryCode;
}
if (null != paymentSourceId) {
closure_132_5.payment_source_id = paymentSourceId;
}
if (null != defaultBillingCountryCode) {
if (typeof closure_132_0 === "string") {
closure_132_0 = { url: closure_132_0, oldFormErrors: true, rejectWithError: false };
}
if (typeof closure_132_0.query === "string") {
const _Error = Error;
const error = new Error("string query not supported");
throw error;
} else {
const merged = Object.assign(closure_132_5);
const merged1 = Object.assign(closure_132_0.query);
closure_132_0.query = {};
}
}
const HTTP = closure_133_0(closure_133_1[11]).HTTP;
return HTTP.get(closure_132_0);
};
const Constants = fn(1074);
({ Endpoints: closure_7, OperatingSystems: closure_8 } = Constants);
let allSettled = allSettled_mod;
allSettled = allSettled.shim();
const isMobile = fn(5275).isMobile;
let tmp4 = !isMobile;
if (!isMobile) {
tmp4 = !fn(5275).isTablet;
}
if (tmp4) {
tmp4 = -1 !== fn(5356).getChromeVersion();
let obj2 = fn(5356);
}
let closure_9 = tmp4;
const size = fn(2);
const result = size.fileFinishedImporting("utils/StoreUtils.tsx");
export const SUPPORTS_WEBP = tmp4;
export const getAssetURL = function getAssetURL(arg0, mimeType, arg2, mp4) {
let str = mp4;
if (null == mp4) {
str = "mp4";
if ("video/quicktime" !== (mimeType.mimeType || mimeType.mime_type)) {
str = "mp4";
if ("video/mp4" !== tmp) {
str = "image/gif" === tmp ? "gif" : "webp";
}
}
}
if (!tmp2) {
str = "png";
}
let id = mimeType;
if (typeof mimeType !== "string") {
id = mimeType.id;
}
if (null != CDN_HOST) {
const _HermesInternal2 = HermesInternal;
let combined = "" + "https:" + "//" + CDN_HOST + "/app-assets/" + arg0 + "/store/" + id + "." + str;
} else {
const _window = window;
const _HermesInternal = HermesInternal;
combined = "" + "https:" + window.GLOBAL_ENV.API_ENDPOINT + React5.STORE_ASSET(arg0, id, str);
}
let sum = combined;
if (null != arg2) {
const obj = ImageLoaderUtils;
const _HermesInternal3 = HermesInternal;
sum = combined + "?size=" + obj.getBestMediaProxySize(arg2 * ImageLoaderUtils.getDevicePixelRatio());
}
return sum;
};
export { fetchCountryCodeQueryDependencies };
export const httpGetWithCountryCodeQuery = function httpGetWithCountryCodeQuery() {
const self = this;
const apply = closure_11.apply;
if (typeof apply === "unknown") {
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
} else {
applyArgumentsResult = apply(self, arguments);
}
return applyArgumentsResult;
};
export const nativePlatformTypeToSKUOperatingSystem = function nativePlatformTypeToSKUOperatingSystem(platform) {
if (PlatformUtils.PlatformTypes.WINDOWS === platform) {
return constants.WINDOWS;
} else if (tmp(1364).PlatformTypes.OSX === platform) {
return constants.MACOS;
} else if (tmp(1364).PlatformTypes.LINUX === platform) {
return constants.LINUX;
} else {
return null;
}
};
export const skuOperatingSystemToText = function skuOperatingSystemToText(arg0) {
if (constants.WINDOWS === arg0) {
const intl3 = util.intl;
return intl3.string(util.t["0/xHFO"]);
} else if (tmp.MACOS === arg0) {
const intl2 = util.intl;
return intl2.string(util.t.E4u4n5);
} else if (tmp.LINUX === arg0) {
const intl = util.intl;
return intl.string(util.t.tcawo3);
} else {
const _Error = Error;
const _HermesInternal = HermesInternal;
const error = new Error("Unknown operating system value: " + arg0);
throw error;
}
};
export const getPrimarySKUForApplication = function getPrimarySKUForApplication(arg0, getApplication, get) {
const application = getApplication.getApplication(arg0);
value = null;
if (null != application) {
value = null;
if (null != application.primarySkuId) {
value = get.get(application.primarySkuId);
}
}
return value;
};