// Module ID: 8727 // Function ID: 8728 // Name: oauth2/actions // Dependencies: [5, 2051, 2103, 1085, 1282, 6082, 1094, 2] // Exports: acceptWhitelist, authorize, fetchAuthorization, fetchChannels, finishUserCode, finishUserCodeTwoWayLinkError, logoutWithRedirect, startSamsungAuthorization, verifyUserCode // Module 8727 (oauth2/actions) import utils_PathUtils from "utils/PathUtils" /* 1094 */; import HTTPUtils from "HTTPUtils" /* 1282 */; import AuthenticationActionCreatorsDefault from "AuthenticationActionCreators" /* 6082 */; import _asyncToGenerator from "_asyncToGenerator" /* 5 */; import ChannelStore from "ChannelStore" /* 2051 */; import SelectedChannelStore from "SelectedChannelStore" /* 2103 */; import Constants from "Constants" /* 1085 */; import size from "module_2" /* 2 */; let metroImportDefault; let metroRequire; function getLocationContextServer() { let str2; let type; const basicChannel = ChannelStore.getBasicChannel(SelectedChannelStore.getChannelId()); let str; if (basicChannel != null) { str = basicChannel.guild_id; } if (str == null) { str = "10000"; } obj = { guild_id: str, channel_id: str2, channel_type: type }; str2 = undefined; if (basicChannel != null) { str2 = basicChannel.id; } if (str2 == null) { str2 = "10000"; } type = undefined; if (basicChannel != null) { type = basicChannel.type; } if (type == null) { type = metroRequire.UNKNOWN; } return obj; } let obj = function _authorize() { obj = _asyncToGenerator(async (authorize) => { let client_id; let closure_2; let code_challenge; let code_challenge_method; let connected_account_provider; let guild_id; let integration_type; let nonce; let permissions; let redirect_uri; let response_type; let state; let c3 = 0; let c4 = 0; const iter = (async (arg0, value) => { let c0; let c1; let c10; let c11; let c12; let c13; let c2; let c3; let c4; let c5; let c6; let c7; let c8; let c9; let obj3; let obj6; let obj7; let tmp11; let tmp7; ({ authorize: c0, clientId: c1, scopes: c2, responseType: c3, redirectUri: c4, codeChallenge: c5, codeChallengeMethod: c6, state: c7, permissions: c8, guildId: c9, channelId: c10, integrationType: c11, connectedAccountProvider: c12, nonce: c13 } = closure_0); await "Reflect"; const HTTP = closure_130_0(closure_130_2[4]).HTTP; const request = { url: closure_130_7.OAUTH2_AUTHORIZE, query: obj6, body: obj7, oldFormErrors: true, rejectWithError: obj3.rejectWithMigratedError() }; const post = HTTP.post; obj6 = { client_id, response_type, redirect_uri, code_challenge, code_challenge_method, scope: c2.join(" "), state, nonce }; obj7 = { guild_id, webhook_channel_id: tmp7, channel_id: tmp11, permissions, authorize, integration_type, connected_account_provider, location_context: closure_130_8() }; if (null != guild_id) { if (null != c10) { tmp7 = c10; } } if (null == guild_id) { if (null != c10) { tmp11 = c10; } } obj3 = closure_130_0(closure_130_2[4]); await post(request); return value.body; })(); iter.next(); return iter; }); return obj(...arguments); }; obj = function _fetchAuthorization() { obj = _asyncToGenerator(async (client_id) => { let code_challenge; let code_challenge_method; let connected_account_provider; let integration_type; let nonce; let redirect_uri; let response_type; let signal; let state; let c3 = 0; let c4 = 0; const iter = (async (arg0, value) => { let c0; let c1; let c10; let c2; let c3; let c4; let c5; let c6; let c7; let c8; let c9; let obj5; let obj9; closure_1 = tmp; ({ clientId: c0, scopes: c1, responseType: c2, redirectUri: c3, codeChallenge: c4, codeChallengeMethod: c5, state: c6, integrationType: c7, connectedAccountProvider: c8, nonce: c9, signal: c10 } = closure_0); await "Reflect"; const HTTP = closure_130_0(closure_130_2[4]).HTTP; const request = { url: closure_130_7.OAUTH2_AUTHORIZE, query: obj5, signal, retries: 3, oldFormErrors: true, rejectWithError: obj9.rejectWithMigratedError() }; const get = HTTP.get; obj5 = { client_id, response_type, redirect_uri, code_challenge, code_challenge_method, scope: tmp.join(" "), state, integration_type, connected_account_provider, nonce }; obj9 = closure_130_0(closure_130_2[4]); await get(request); return value.body; })(); iter.next(); return iter; }); return obj(...arguments); }; obj = function _startSamsungAuthorization() { obj = _asyncToGenerator(async (client_id, arg1, response_type, redirect_uri, state) => { let closure_1 = arg1; let c6 = 0; let c5 = 0; return (async (arg0, value, arg2, arg3, arg4) => { let obj4; let obj7; if (c5 === 2) { c5 = 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) { return { value, done: true }; } else { return { value: "IconComponent", done: null }; } } else { try { c5 = 2; if (0 === c6) { if (arg0 === 1) { c5 = 3; throw value; } else if (arg0 === 2) { c5 = 3; return { value, done: true }; } else { const HTTP = HTTPUtils.HTTP; const request = { url: closure_2_7.OAUTH2_AUTHORIZE_SAMSUNG, query: obj4, rejectWithError: obj7.rejectWithMigratedError() }; const get = HTTP.get; obj4 = { client_id, state, response_type, redirect_uri, prompt: "consent", scope: closure_1.join(" ") }; c6 = 1; c5 = 1; obj7 = HTTPUtils; const obj5 = { value: get(request), done: false }; return obj5; } } else if (arg0 === 1) { c5 = 3; throw value; } else if (arg0 === 2) { c5 = 3; return { value, done: true }; } else { c5 = 3; return { value: "IconComponent", done: null }; } } catch (tmp4) { c5 = 3; throw tmp4; } } })(); }); return obj(...arguments); }; obj = function _fetchChannels() { obj = _asyncToGenerator(async (guild_id) => { let c2 = 0; let c1 = 0; return (async (arg0, value) => { let obj4; let obj8; const HTTP = HTTPUtils.HTTP; const request = { url: closure_2_7.OAUTH2_AUTHORIZE_WEBHOOK_CHANNELS, query: obj4, oldFormErrors: true, rejectWithError: obj8.rejectWithMigratedError() }; const get = HTTP.get; obj4 = { guild_id }; obj8 = HTTPUtils; await get(request); return value.body; })(); }); return obj(...arguments); }; obj = function _verifyUserCode() { let OAUTH2_DEVICE_VERIFY; obj = _asyncToGenerator(async (user_code) => { let c2 = 0; let c1 = 0; return (async (arg0, value) => { let obj4; let obj8; const HTTP = HTTPUtils.HTTP; const request = { url: OAUTH2_DEVICE_VERIFY.OAUTH2_DEVICE_VERIFY, body: obj4, rejectWithError: obj8.rejectWithMigratedError() }; const post = HTTP.post; obj4 = { user_code }; obj8 = HTTPUtils; await post(request); return value; })(); }); return obj(...arguments); }; obj = function _finishUserCode() { let OAUTH2_DEVICE_FINISH; obj = _asyncToGenerator(async (user_code, result) => { let c3 = 0; let c2 = 0; return (async (arg0, value) => { let obj4; let obj8; const HTTP = HTTPUtils.HTTP; const request = { url: OAUTH2_DEVICE_FINISH.OAUTH2_DEVICE_FINISH, body: obj4, rejectWithError: obj8.rejectWithMigratedError() }; const post = HTTP.post; obj4 = { user_code, result }; obj8 = HTTPUtils; await post(request); return value; })(); }); return obj(...arguments); }; obj = function _finishUserCodeTwoWayLinkError() { let OAUTH2_DEVICE_FINISH; obj = _asyncToGenerator(async (user_code, error_code, error_source) => { let c4 = 0; let c3 = 0; return (async (arg0, value, arg2) => { let obj4; let obj8; const HTTP = HTTPUtils.HTTP; const request = { url: OAUTH2_DEVICE_FINISH.OAUTH2_DEVICE_FINISH, body: obj4, rejectWithError: obj8.rejectWithMigratedError() }; const post = HTTP.post; obj4 = { user_code, result: "two_way_link_error", error_code, error_source }; obj8 = HTTPUtils; await post(request); return value; })(); }); return obj(...arguments); }; ({ ChannelTypes: metroRequire, Endpoints: metroImportDefault } = Constants); let result = size.fileFinishedImporting("modules/oauth2/actions.tsx"); export { getLocationContextServer }; export const acceptWhitelist = function acceptWhitelist(token) { let obj3; const HTTP = HTTPUtils.HTTP; const request = { url: metroImportDefault.OAUTH2_WHITELIST_ACCEPT, query: obj, oldFormErrors: true, rejectWithError: obj3.rejectWithMigratedError() }; const post = HTTP.post; obj = { token }; obj3 = HTTPUtils; return post(request); }; export const authorize = function authorize() { return obj(...arguments); }; export const fetchAuthorization = function fetchAuthorization() { return obj(...arguments); }; export const startSamsungAuthorization = function startSamsungAuthorization() { return obj(...arguments); }; export const fetchChannels = function fetchChannels() { return obj(...arguments); }; export const logoutWithRedirect = function logoutWithRedirect(pathname, TTI_test) { const logout = AuthenticationActionCreatorsDefault.logout; AuthenticationActionCreatorsDefault; obj = utils_PathUtils; logout(TTI_test, obj.getLoginPath(pathname.pathname + pathname.search, false)); }; export const verifyUserCode = function verifyUserCode() { return obj(...arguments); }; export const finishUserCode = function finishUserCode() { return obj(...arguments); }; export const finishUserCodeTwoWayLinkError = function finishUserCodeTwoWayLinkError() { return obj(...arguments); };