// Module ID: 5644 // Function ID: 5645 // Name: StoreUtils // Dependencies: [5, 502, 4771, 4772, 4775, 1085, 5645, 5294, 5218, 1450, 5724, 1295, 1382, 1126, 2] // Exports: getAssetURL, getPrimarySKUForApplication, httpGetWithCountryCodeQuery, nativePlatformTypeToSKUOperatingSystem, skuOperatingSystemToText // Module 5644 (StoreUtils) import intl4 from "intl" /* 1126 */; import PlatformUtils from "PlatformUtils" /* 1382 */; import ImageLoaderUtils from "ImageLoaderUtils" /* 1450 */; import BrowserUtils from "BrowserUtils" /* 5218 */; import shared_PlatformUtils from "shared/PlatformUtils" /* 5294 */; import _asyncToGenerator from "_asyncToGenerator" /* 5 */; import AuthenticationStore from "AuthenticationStore" /* 502 */; import BillingInfoStore from "BillingInfoStore" /* 4771 */; import PaymentSourceStore from "PaymentSourceStore" /* 4772 */; import SubscriptionStore from "SubscriptionStore" /* 4775 */; import Constants from "Constants" /* 1085 */; import allSettled_mod from "allSettled" /* 5645 */; import size from "module_2" /* 2 */; const require = globalThis.__r; let _require, c6, c7; let metroImportAll; let metroImportDefault; function fetchCountryCodeQueryDependencies() { const items = []; if (!PaymentSourceStore.hasFetchedPaymentSources) { let paymentSourcesFetchRequest = BillingInfoStore.paymentSourcesFetchRequest; const tmp2 = null; const push = items.push; if (paymentSourcesFetchRequest == null) { let tmp3 = _require; let tmp4 = dependencyMap; obj = require("actions/BillingActionCreators"); paymentSourcesFetchRequest = obj.fetchPaymentSources(); } push(paymentSourcesFetchRequest); } if (!BillingInfoStore.ipCountryCodeLoaded) { const push2 = items.push; let obj2 = require("actions/BillingActionCreators"); push2(obj2.fetchIpCountryCode()); } const push3 = items.push; _require = _asyncToGenerator(async (arg0, value) => { let obj2; closure_0 = arg0; if (c3 === 2) { c3 = 3; throw new TypeError("Generator functions may not be called on executing generators"); } else if (tmp2 === 3) { if (arg0 === 1) { throw value; } else if (arg0 === 2) { const obj3 = { value, done: true }; return obj3; } else { return { value: "IconComponent", 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 { let c1 = 0; const tmp16 = closure_0; if (SubscriptionStore.hasFetchedSubscriptions()) { tmp16(); } else if (BillingInfoStore.isSubscriptionFetching) { function wait() { if (closure_2_4.isSubscriptionFetching) { const _setTimeout = setTimeout; const timerId = setTimeout(wait, 50); } else { closure_0(); } } wait(); } else { c2 = 1; c3 = 1; const obj5 = { value: obj2.fetchSubscriptions(), done: false }; obj2 = closure_0(c1[10]); return obj5; } } } else if (arg0 === 1) { c3 = 3; throw value; } else if (arg0 === 2) { c3 = 3; obj = { value, done: true }; return obj; } else { closure_0(); } c3 = 3; return { value: "IconComponent", done: null }; } catch (tmp12) { c3 = 3; throw tmp12; } } }); const promise = new Promise(function() { return closure_0(...arguments); }); push3(promise); return Promise.allSettled(items); } let obj = function _httpGetWithCountryCodeQuery() { obj = _asyncToGenerator(async function(arg0, value) { let closure_4; let closure_0 = arg0; let closure_1 = value; if (c7 === 2) { c7 = 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 obj2 = { value, done: true }; return obj2; } else { return { value: "IconComponent", done: null }; } } else { try { let closure_5; let obj6; let flag; let country_code; let paymentSourceId; let tmp; c7 = 2; if (0 === c6) { if (arg0 === 1) { c7 = 3; throw value; } else if (arg0 === 2) { c7 = 3; const obj3 = { value, done: true }; return obj3; } else { closure_5 = tmp4; obj6 = closure_0; flag = closure_1; if (closure_1 === undefined) { flag = true; } country_code = undefined; paymentSourceId = undefined; tmp = undefined; closure_5 = undefined; c6 = 1; c7 = 1; return { value: "Set", done: true }; } } else { if (1 === c6) { if (arg0 === 1) { c7 = 3; throw value; } else if (arg0 === 2) { c7 = 3; const obj4 = { value, done: true }; return obj4; } else { const isAuthenticatedResult = flag && closure_133_3.isAuthenticated(); if (isAuthenticatedResult) { const items = [closure_133_10(), ]; const self3 = this; const self4 = this; const promise = new Promise((arg0) => setTimeout(arg0, 10000)); items[1] = promise; c6 = 2; c7 = 1; const obj5 = { value: race(items), done: false }; return obj5; } } } else if (arg0 === 1) { c7 = 3; throw value; } else if (arg0 === 2) { c7 = 3; obj = { value, done: true }; return obj; } country_code = closure_133_5.getDefaultBillingCountryCode(); const defaultPaymentSource = closure_133_5.defaultPaymentSource; let id; if (defaultPaymentSource != null) { id = defaultPaymentSource.id; } let c2 = id; if (id == null) { c2 = null; } paymentSourceId = c2; tmp = closure_133_6.getPremiumTypeSubscription(); const tmp18 = null != tmp && null != tmp.paymentSourceId; if (tmp18) { paymentSourceId = tmp.paymentSourceId; } if (null === country_code) { const ipCountryCode = closure_133_4.ipCountryCode; let c3 = ipCountryCode; if (ipCountryCode == null) { c3 = null; } country_code = c3; } closure_5 = {}; if (null != country_code) { closure_5.country_code = country_code; } if (null != paymentSourceId) { closure_5.payment_source_id = paymentSourceId; } if (null != country_code) { if (typeof obj6 === "string") { obj6 = { url: obj6, oldFormErrors: true, rejectWithError: false }; } if (typeof obj6.query === "string") { const _Error = Error; const self = this; const self2 = this; const error = new Error("string query not supported"); throw error; } else { const obj7 = {}; const merged = Object.assign(closure_5); const merged1 = Object.assign(obj6.query); obj6.query = obj7; } } const HTTP = closure_133_0(closure_133_1[11]).HTTP; c7 = 3; const obj8 = { value: HTTP.get(obj6), done: true }; return obj8; } } catch (tmp60) { c7 = 3; throw tmp60; } } }); return obj(...arguments); }; ({ Endpoints: metroImportDefault, OperatingSystems: metroImportAll } = Constants); let allSettled = allSettled_mod; allSettled = allSettled.shim(); let tmp4 = !shared_PlatformUtils.isMobile && !shared_PlatformUtils.isTablet; if (tmp4) { const _module1 = BrowserUtils; let num = -1; tmp4 = -1 !== _module1.getChromeVersion(); } let closure_9 = tmp4; const result = size.fileFinishedImporting("utils/StoreUtils.tsx"); export const SUPPORTS_WEBP = tmp4; export const getAssetURL = function getAssetURL(arg0, mimeType, arg2, mp4) { let combined; let str = mp4; if (null == mp4) { str = "mp4"; if ("video/quicktime" !== (mimeType.mimeType || mimeType.mime_type)) { str = "mp4"; if ("video/mp4" !== (mimeType.mimeType || mimeType.mime_type)) { str = "image/gif" === tmp ? "gif" : "webp"; } } } const tmp2 = "webp" !== str || closure_9; if (!tmp2) { str = "png"; } let id = mimeType; if (typeof mimeType !== "string") { id = mimeType.id; } if (null != CDN_HOST) { const _HermesInternal2 = HermesInternal; combined = "" + "https:" + "//" + CDN_HOST + "/app-assets/" + arg0 + "/store/" + id + "." + str; } else { const _window = window; const _HermesInternal = HermesInternal; combined = "" + "https:" + window.GLOBAL_ENV.API_ENDPOINT + metroImportDefault.STORE_ASSET(arg0, id, str); } let sum = combined; if (null != arg2) { const getBestMediaProxySize = ImageLoaderUtils.getBestMediaProxySize; ImageLoaderUtils; const _HermesInternal3 = HermesInternal; obj = ImageLoaderUtils; sum = combined + "?size=" + getBestMediaProxySize(arg2 * obj.getDevicePixelRatio()); } return sum; }; export { fetchCountryCodeQueryDependencies }; export const httpGetWithCountryCodeQuery = function httpGetWithCountryCodeQuery() { return obj(...arguments); }; export const nativePlatformTypeToSKUOperatingSystem = function nativePlatformTypeToSKUOperatingSystem(platform) { if (PlatformUtils.PlatformTypes.WINDOWS === platform) { return metroImportAll.WINDOWS; } else if (PlatformUtils.PlatformTypes.OSX === platform) { return metroImportAll.MACOS; } else if (PlatformUtils.PlatformTypes.LINUX === platform) { return metroImportAll.LINUX; } else { return null; } }; export const skuOperatingSystemToText = function skuOperatingSystemToText(arg0) { if (metroImportAll.WINDOWS === arg0) { const intl3 = intl4.intl; return intl3.string(intl4.t["0/xHFO"]); } else if (metroImportAll.MACOS === arg0) { const intl2 = intl4.intl; return intl2.string(intl4.t.E4u4n5); } else if (metroImportAll.LINUX === arg0) { const intl = intl4.intl; return intl.string(intl4.t.tcawo3); } else { const _Error = Error; const _HermesInternal = HermesInternal; const self = this; const self2 = this; const error = new Error("Unknown operating system value: " + arg0); throw error; } }; export const getPrimarySKUForApplication = function getPrimarySKUForApplication(arg0, getApplication, get) { const application = getApplication.getApplication(arg0); let value = null; if (null != application) { value = null; if (null != application.primarySkuId) { value = get.get(application.primarySkuId); } } return value; };