// Module ID: 5885 // Function ID: 51729 // Dependencies: [5, 1850, 653, 686, 507, 1184, 2] // Module 5885 import isNonEmptyString from "isNonEmptyString"; import _isNativeReflectConstruct from "_isNativeReflectConstruct"; import { Endpoints } from "ME"; const require = arg1; const result = require("ME").fileFinishedImporting("modules/user_profile/WidgetActionCreators.tsx"); export default { setPendingWidgets(items) { let obj = importDefault(686); obj = { type: "WIDGET_PENDING_SET", widgets: items }; obj.dispatch(obj); }, savePendingWidgets(arg0) { let closure_0 = arg0; return callback(async () => { const currentUser = outer2_4.getCurrentUser(); let id; if (null != currentUser) { id = currentUser.id; } if (null != id) { let obj = outer2_1(outer2_2[3]); obj = { type: "WIDGET_PENDING_SAVE_START" }; obj.dispatch(obj); const mapped = outer1_0.map((toSubmission) => toSubmission.toSubmission()); const HTTP = callback(outer2_2[4]).HTTP; obj = { url: outer2_5.USER_PROFILE_WIDGETS }; const obj1 = { widgets: mapped }; obj.body = obj1; obj.oldFormErrors = true; obj.rejectWithError = true; const tmp11 = yield HTTP.put(obj); const obj2 = { type: "WIDGET_PENDING_SAVE_SUCCESS", userId: id, widgets: tmp11.body.widgets }; outer2_1(outer2_2[3]).dispatch(obj2); return tmp11.body; } })(); }, clearPendingWidgets() { importDefault(686).dispatch({ type: "WIDGET_PENDING_CLEAR" }); }, uploadWidgetAsset(arg0) { let closure_0 = arg0; return callback(async () => { let upload_filename; let upload_url; const HTTP = callback(outer2_2[4]).HTTP; obj = { url: outer2_5.USER_PROFILE_WIDGET_ASSET_UPLOAD, body: obj, rejectWithError: true }; obj = { filename: outer1_0.name, file_size: outer1_0.size }; obj = { method: "PUT", body: outer1_0 }; const obj1 = {}; let str = "application/octet-stream"; ({ upload_url, upload_filename } = yield HTTP.post(obj).body); if ("" !== outer1_0.type) { str = outer1_0.type; } obj1["Content-Type"] = str; obj.headers = obj1; const tmp2 = yield fetch(upload_url, obj); if (tmp2.ok) { return upload_filename; } else { const _Error = Error; const _HermesInternal = HermesInternal; const error = new Error("Failed to upload widget asset: " + tmp2.status); throw error; } })(); }, fetchSuggestedGames() { return callback(async () => { let obj = outer2_1(outer2_2[3]); obj.dispatch({ type: "WIDGET_SUGGESTED_FETCH_START" }); const HTTP = outer2_0(outer2_2[4]).HTTP; obj = { url: outer2_5.USER_PROFILE_SUGGESTED_GAMES, rejectWithError: true }; const tmp2 = yield HTTP.get(obj); const body = tmp2.body; let suggested_games; if (null != body) { suggested_games = body.suggested_games; } let tmp6 = tmp5; if (null != suggested_games) { const body2 = tmp3.body; let prop; if (null != body2) { prop = body2.suggested_wishlist_games; } tmp6 = null != prop; } if (!tmp6) { outer2_1(outer2_2[5]).captureMessage("Suggested games or wishlist games not found"); const obj3 = outer2_1(outer2_2[5]); } obj = { type: "WIDGET_SUGGESTED_FETCH_SUCCESS" }; const body3 = tmp3.body; let suggested_games1; if (null != body3) { suggested_games1 = body3.suggested_games; } obj.suggestedGamesIds = null != suggested_games1 ? suggested_games1 : []; const body4 = tmp2.body; let prop1; if (null != body4) { prop1 = body4.suggested_wishlist_games; } obj.suggestedWishlistGamesIds = null != prop1 ? prop1 : []; outer2_1(outer2_2[3]).dispatch(obj); })(); }, removeGameFromSuggestedGames(applicationId) { let obj = importDefault(686); obj = { type: "WIDGET_SUGGESTED_REMOVE_GAME", applicationId }; obj.dispatch(obj); } };