163 lines
11 KiB
TypeScript
163 lines
11 KiB
TypeScript
/* Metro module 13285; source: modules/unique_usernames/UniqueUsernamesStore.tsx; dependencies: [6, 7, 15, 17, 18, 1393, 672, 566, 694, 2] */
|
|
import ClassCallCheck from '../../by-id/module-00006-ClassCallCheck.js'; /* Metro dependency 6 */
|
|
import CreateClass from '../../by-id/module-00007-CreateClass.js'; /* Metro dependency 7 */
|
|
import PossibleConstructorReturn from '../../by-id/module-00015-PossibleConstructorReturn.js'; /* Metro dependency 15 */
|
|
import Module00017 from '../../by-id/module-00017.js'; /* Metro dependency 17 */
|
|
import Inherits from '../../by-id/module-00018-Inherits.js'; /* Metro dependency 18 */
|
|
import Flux from '../../external/discord_common/js/packages/flux/index.tsx'; /* Metro dependency 566 */
|
|
import Module01393 from '../../by-id/module-01393.js'; /* Metro dependency 1393 */
|
|
import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
|
|
|
|
function _fun101282(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#101282, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13475:6, offset: 0x0220f6ba, size: 494 bytes, params: 8, frame: 21
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
({'taken': null, 'error': null, 'rateLimited': true}).error = undefined;
|
|
object = {'validations': null, 'currentUsernameInvalid': false, 'retryAfterTime': null};
|
|
let value = Module01393;
|
|
value = new value({'max': 100, 'maxAge': 60000});
|
|
object.validations = value;
|
|
object.suggestions = {migration: {'suggestion': null, 'fetched': false, 'usernameSuggestionLoading': false,
|
|
suggestion: {username: undefined}}, registration: {suggestion: {username: undefined}, source: undefined,
|
|
fetched: false}};
|
|
const Store = (Flux).Store;
|
|
_fun101286(Store).displayName = 'UniqueUsernamesStore';
|
|
value = new value(importDefault(694) /* metro dependency 694: Dispatcher */,
|
|
{UNIQUE_USERNAME_ATTEMPT_SUCCESS: UNIQUE_USERNAME_ATTEMPT_SUCCESS,
|
|
UNIQUE_USERNAME_ATTEMPT_FAILURE: UNIQUE_USERNAME_ATTEMPT_FAILURE,
|
|
UNIQUE_USERNAME_SUGGESTIONS_RESET: UNIQUE_USERNAME_SUGGESTIONS_RESET,
|
|
UNIQUE_USERNAME_SUGGESTIONS_SUCCESS: UNIQUE_USERNAME_SUGGESTIONS_SUCCESS,
|
|
UNIQUE_USERNAME_REGISTRATION_SUGGESTIONS_SUCCESS: UNIQUE_USERNAME_REGISTRATION_SUGGESTIONS_SUCCESS});
|
|
(FileImportTrackerModule).fileFinishedImporting('modules/unique_usernames/UniqueUsernamesStore.tsx');
|
|
exports.default = value;
|
|
function _isNativeReflectConstruct_101283() { // fn#101283, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13475:148, offset: 0x0220f8a8, size: 98 bytes, params: 1, frame: 18
|
|
var Boolean;
|
|
var prototype;
|
|
var valueOf;
|
|
var call;
|
|
var Reflect;
|
|
var construct;
|
|
var closure;
|
|
var value;
|
|
var error;
|
|
try {
|
|
Boolean = global.Boolean;
|
|
prototype = Boolean.prototype;
|
|
valueOf = prototype.valueOf;
|
|
call = valueOf.call;
|
|
Reflect = global.Reflect;
|
|
construct = Reflect.construct;
|
|
Boolean = global.Boolean;
|
|
closure = function() {
|
|
};
|
|
value = Reflect.apply(construct, Reflect, [Boolean, [], closure]);
|
|
value = Reflect.apply(call, valueOf, [value]);
|
|
var result = !value;
|
|
} catch (error) {
|
|
}
|
|
return (_isNativeReflectConstruct_101283_isNativeReflectConstruct = function() {
|
|
return !!result;
|
|
})();
|
|
}
|
|
|
|
function _fun101286(a0) { // fn#101286, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13475:655, offset: 0x0220f90a, size: 255 bytes, params: 2, frame: 16
|
|
const UniqueUsernamesStore2 = UniqueUsernamesStore;
|
|
Inherits(UniqueUsernamesStore2, a0);
|
|
return CreateClass(UniqueUsernamesStore2, [{key: 'isRateLimited', value: value_101288}, {key: 'validate',
|
|
value: value_101289}, {key: 'registrationUsernameSuggestion', value: value_101290}, {key: 'usernameSuggestion',
|
|
value: value_101291}, {key: 'usernameSuggestionLoading', value: value_101292}, {key: 'isCurrentUsernameInvalid',
|
|
value: value_101293}, {key: 'wasRegistrationSuggestionFetched', value: value_101294},
|
|
{key: 'wasSuggestionsFetched', value: value_101295}]);
|
|
function UniqueUsernamesStore() { // fn#101287, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13475:667, offset: 0x01081bdc, size: 113 bytes, params: 1, frame: 20
|
|
const value = environment.__proto__;
|
|
env1_2(this, UniqueUsernamesStore);
|
|
const value3 = env1_5(UniqueUsernamesStore);
|
|
return env1_4(this, _isNativeReflectConstruct_101283() ? global.Reflect.construct(value3, arguments,
|
|
env1_5(this).constructor) : value3.apply(this, arguments));
|
|
}
|
|
|
|
function value_101288() { // fn#101288, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13475:988, offset: 0x0220fa09, size: 55 bytes, params: 1, frame: 11
|
|
const value = environment.__proto__;
|
|
return env1_8.retryAfterTime != null && global.Date.now() < env1_8.retryAfterTime;
|
|
}
|
|
|
|
function value_101289(a0) { // fn#101289, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13475:1082, offset: 0x0220fa40, size: 98 bytes, params: 2, frame: 13
|
|
const value = environment.__proto__;
|
|
const value2 = env1_8.validations.get(a0);
|
|
return this.isRateLimited() && (value2 == null || value2.rateLimited) ? env1_7 : this.isRateLimited() || value2 == null ? value2 : value2.rateLimited ? undefined : value2;
|
|
}
|
|
|
|
function value_101290() { // fn#101290, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13475:1278, offset: 0x0220faa2, size: 33 bytes, params: 1, frame: 1
|
|
return env1_8.suggestions.registration.suggestion.username;
|
|
}
|
|
|
|
function value_101291() { // fn#101291, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13475:1377, offset: 0x0220fac3, size: 33 bytes, params: 1, frame: 1
|
|
return env1_8.suggestions.migration.suggestion.username;
|
|
}
|
|
|
|
function value_101292() { // fn#101292, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13475:1480, offset: 0x0220fae4, size: 27 bytes, params: 1, frame: 1
|
|
return env1_8.suggestions.migration.usernameSuggestionLoading;
|
|
}
|
|
|
|
function value_101293() { // fn#101293, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13475:1588, offset: 0x0220faff, size: 15 bytes, params: 1, frame: 1
|
|
return env1_8.currentUsernameInvalid;
|
|
}
|
|
|
|
function value_101294(a0) { // fn#101294, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13475:1679, offset: 0x0220fb0e, size: 58 bytes, params: 2, frame: 3
|
|
return env1_8.suggestions.registration.source === a0 && env1_8.suggestions.registration.fetched;
|
|
}
|
|
|
|
function value_101295() { // fn#101295, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13475:1809, offset: 0x0220fb48, size: 27 bytes, params: 1, frame: 1
|
|
return env1_8.suggestions.migration.fetched;
|
|
}
|
|
|
|
}
|
|
|
|
function UNIQUE_USERNAME_ATTEMPT_SUCCESS({username, taken}) { // fn#101296, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13475:1969, offset: 0x0220fb63, size: 50 bytes, params: 2, frame: 14
|
|
const validations = env0_8.validations;
|
|
validations.set(username, {taken: taken});
|
|
}
|
|
|
|
function UNIQUE_USERNAME_ATTEMPT_FAILURE({username, error, statusCode, retryAfter}) { // fn#101297, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13475:2099, offset: 0x0220fb95, size: 255 bytes, params: 2, frame: 19
|
|
var validations;
|
|
if (statusCode === 429) {
|
|
env0_8.validations.set(username, {'taken': null, 'error': null, 'rateLimited': true, error: error},
|
|
(retryAfter ?? 7) * (importDefault(672) /* metro dependency 672: Durations */).Millis.SECOND);
|
|
} else {
|
|
validations = env0_8.validations;
|
|
validations.set(username, {taken: null, error: error});
|
|
}
|
|
if (retryAfter != null) {
|
|
env0_8.retryAfterTime = global.Date.now() + retryAfter * (importDefault(672) /* metro dependency 672: Durations */).Millis.SECOND;
|
|
}
|
|
}
|
|
|
|
function UNIQUE_USERNAME_SUGGESTIONS_RESET() { // fn#101298, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13475:2432, offset: 0x0220fc94, size: 87 bytes, params: 1, frame: 6
|
|
const binding = env0_8;
|
|
binding.suggestions.migration = {'suggestion': null, 'fetched': false, 'usernameSuggestionLoading': false,
|
|
suggestion: {username: undefined}};
|
|
binding.suggestions.registration = {suggestion: {username: undefined}, source: undefined, fetched: false};
|
|
}
|
|
|
|
function UNIQUE_USERNAME_SUGGESTIONS_SUCCESS({suggestion}) { // fn#101299, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13475:2695, offset: 0x0220fceb, size: 87 bytes, params: 2, frame: 6
|
|
env0_8.suggestions.migration = {'suggestion': null, 'fetched': true, 'usernameSuggestionLoading': false,
|
|
suggestion: suggestion};
|
|
if (suggestion?.invalid_current_username === true) {
|
|
env0_8.currentUsernameInvalid = true;
|
|
}
|
|
}
|
|
|
|
function UNIQUE_USERNAME_REGISTRATION_SUGGESTIONS_SUCCESS({suggestion, source}) { // fn#101300, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13475:2968, offset: 0x0220fd42, size: 112 bytes, params: 2, frame: 15
|
|
var validations;
|
|
env0_8.suggestions.registration = {suggestion: suggestion, source: source, fetched: true};
|
|
const username = suggestion?.username;
|
|
if (username != null) {
|
|
validations = env0_8.validations;
|
|
validations.set(suggestion.username, {taken: false});
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
global.__d(_fun101282, 13285, [6, 7, 15, 17, 18, 1393, 672, 566, 694,
|
|
2]) /* metro module 13285, dependencies: [6, 7, 15, 17, 18, 1393, 672, 566, 694, 2] */;
|