Files
2026-07-28 01:06:53 +03:00

1477 lines
71 KiB
TypeScript

/* Metro module 4129; source: utils/GiftCodeUtils.tsx; dependencies: [5, 57, 4130, 1878, 661, 1880, 4100, 4140, 4141, 683, 3825, 4233, 1244, 4242, 1360, 566, 3802, 2] */
import Module00005 from '../by-id/module-00005.js'; /* Metro dependency 5 */
import Module00057 from '../by-id/module-00057.js'; /* Metro dependency 57 */
import AnalyticsUtils from './AnalyticsUtils.tsx'; /* Metro dependency 683 */
import UserStore from '../stores/UserStore.tsx'; /* Metro dependency 1878 */
import RegexUtils from './RegexUtils.tsx'; /* Metro dependency 4100 */
import PremiumPaymentModalStore from '../stores/PremiumPaymentModalStore.tsx'; /* Metro dependency 4130 */
import GetAnalyticsDataForSKU from '../modules/game_store/getAnalyticsDataForSKU.tsx'; /* Metro dependency 4233 */
import * as FileImportTrackerModule from '../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as FluxModule from '../external/discord_common/js/packages/flux/index.tsx'; /* Metro dependency 566 */
import * as ConstantsModule from '../Constants.tsx'; /* Metro dependency 661 */
import * as IndexNativeModule from '../intl/index.native.tsx'; /* Metro dependency 1244 */
import * as Module04242Module from '../by-id/module-04242.js'; /* Metro dependency 4242 */
function _fun34254(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#34254, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4300:6, offset: 0x01050324, size: 981 bytes, params: 8, frame: 35
let env0_0 = require;
const getGiftExperience2 = getGiftExperience;
const closure2 = function(a0) {
return a0.replace(RegExp('[^A-Za-z0-9]', 'g'), '');
};
const getSubscriptionGiftSuccessText2 = getSubscriptionGiftSuccessText;
const getErrorMessage2 = getErrorMessage;
const getGiftCodeRedeemError2 = getGiftCodeRedeemError;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
let value = ConstantsModule;
const env0_7 = value.Endpoints;
const env0_8 = value.AnalyticEvents;
const env0_9 = value.AbortCodes;
const env0_10 = value.GiftCodeModalStates;
const env0_11 = value.MessageEmbedTypes;
const env0_12 = value.MessageTypes;
value = require(1880) /* metro dependency 1880: PremiumConstants */;
const env0_13 = value.PremiumTypes;
const env0_14 = value.SubscriptionIntervalTypes;
const escape = (RegexUtils).escape;
const GLOBAL_ENV = global.window.GLOBAL_ENV;
const GIFT_CODE_HOST = GLOBAL_ENV.GIFT_CODE_HOST;
value = Reflect.apply(escape, value, [GIFT_CODE_HOST]);
object = [value];
const items2 = ['discordapp.com/gifts', 'discord.com/gifts'];
arraySpread(object, items2.map(_fun34268), 1, undefined);
value = object.join('|');
let RegExp = global.RegExp;
value = '(?: |^|https?://)(?:' + value + ')/([a-z0-9-]+)';
let regExp = new RegExp(value, 'gi');
regExp = ['discord.com/billing/promotions', 'promos.discord.gg'].map(_fun34269);
object = [];
arraySpread(object, regExp, 0, '(?: |^|https?://)(?:');
regExp = object.join('|');
RegExp = global.RegExp;
regExp = '(?: |^|https?://)(?:' + regExp + ')(/|(/)?\\?code=)([a-z0-9-]+)';
Object.create(RegExp.prototype, {constructor: {value: RegExp}});
new RegExp(regExp, 'gi');
const closure6 = function(a0, a1) {
var env0_0 = a0;
var value = (0, global.Array)(a1);
value = value.fill(undefined);
value = value.map(_fun34271);
return value.join('-?');
};
regExp = [closure6(4, 4), closure6(4, 6), closure6(5, 3), '[a-zA-Z]{4}-?[0-9a-zA-Z]{4}-?[a-zA-Z]{4}'].join('|');
RegExp = global.RegExp;
regExp = '^(WUMP-?)?(' + regExp + ')$';
regExp = new RegExp(regExp);
object = {DEFAULT: 0};
object[0] = 'DEFAULT';
object.CUSTOM_STYLE = 1;
object[1] = 'CUSTOM_STYLE';
object.CUSTOM_MESSAGE_EMOJI_SOUNDBOARD = 2;
object[2] = 'CUSTOM_MESSAGE_EMOJI_SOUNDBOARD';
(FileImportTrackerModule).fileFinishedImporting('utils/GiftCodeUtils.tsx');
exports.GiftExperience = object;
exports.getGiftExperience = getGiftExperience2;
exports.shouldShowCustomGiftExperience = shouldShowCustomGiftExperience;
exports.makeComboId = function(a0) {
var r2;
var value = a1;
var value2 = a2;
r2 = value !== undefined ? value : null;
value = '';
return value + a0 + ':' + (r2 ?? value) + ':' + (value2 ?? value);
};
exports.parseComboId = parseComboId;
exports.cleanCode = closure2;
exports.isGiftCodeEmbed = function(a0) {
var value = undefined;
return (a0 == null ? value : a0.type) === MessageTypes.CUSTOM_GIFT && (a0 == null || a0.embeds == null ? value : a0.embeds.length) === 1 && (a0 == null ? value : a0.embeds[0].type) === MessageEmbedTypes.GIFT;
};
exports.findGiftCodes = findGiftCodes;
exports.getGiftCodeURL = getGiftCodeURL;
exports.resolveGiftCode = function() {
return _resolveGiftCode.apply(this, arguments);
};
exports.trackGiftCodeCopy = trackGiftCodeCopy;
exports.getStep = getStep;
exports.getHeaderText = getHeaderText;
exports.getButtonText = getButtonText;
exports.getSubscriptionGiftSuccessText = getSubscriptionGiftSuccessText2;
exports.getSubscriptionGiftStartHeaderText = getSubscriptionGiftStartHeaderText;
exports.getBodyText = getBodyText;
exports.getErrorMessage = getErrorMessage2;
exports.firstLibraryApplicationForGiftCode = function(a0, a1, a2) {
var r0;
var value = a0;
var env0_0 = a2;
var property = a1.applicationId;
var env0_1 = property;
value = (value.length > 0 ? value : [property]).map(_fun34296);
value = value.filter(require(dependencyMap[14]).isNotNullish);
r0 = value.length !== r0.length ? null : value[0];
return r0;
};
exports.processGiftCodeInput = processGiftCodeInput;
exports.useGetGiftCode = function(a0, a1) {
var env0_0 = a0;
var env0_1 = a1;
return require(dependencyMap[15]).useStateFromStores([PremiumPaymentModalStore], _fun34299);
};
exports.trackStep = trackStep;
exports.getGiftCodeRedeemError = getGiftCodeRedeemError2;
function getGiftExperience(a0, a1) { // fn#34255, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4300:1081, offset: 0x010506f9, size: 111 bytes, params: 3, frame: 13
return (require(4140) /* metro dependency 4140: PlatformUtils */).isMobile || (require(4140) /* metro dependency 4140: PlatformUtils */).isTablet ? env0_17.DEFAULT : a0 != null || a1 ? env0_17.CUSTOM_MESSAGE_EMOJI_SOUNDBOARD : env0_17.CUSTOM_STYLE;
}
function _resolveGiftCode() { // fn#34257, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4300:1284, offset: 0x0105078a, size: 48 bytes, params: 1, frame: 14
return Module00005(_fun34259).apply(this, arguments);
async function _fun34259(a0) { // fn#34259, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4300:1339, offset: 0x010507cc, size: 435 bytes, params: 2, frame: 23
var binding;
var binding2;
var property;
var value6;
var httpGetWithCountryCodeQuery;
var object;
var GIFT_CODE_RESOLVE;
var value7;
var object2;
var value8;
var value9;
var value10;
var body;
var binding3;
var value11;
var track;
var GIFT_CODE_RESOLVED;
var code;
var max_uses;
var store_listing;
var sku;
var id;
var type;
var application_id;
var name;
var object3;
var error;
var binding4;
var value12;
var prototype;
var value13;
let value = a1;
const value2 = a2;
if (false) {
return undefined;
}
const r3 = value !== undefined ? value : false;
const r1 = value2 !== undefined ? value2 : false;
await undefined;
if (false) {
return undefined;
}
value = environment.__proto__.__proto__;
try {
binding = env2_0;
} catch (error) {
binding = env2_1;
binding4 = env2_2;
value12 = binding(binding4[9]);
track = value12.track;
GIFT_CODE_RESOLVED = env2_8.GIFT_CODE_RESOLVED;
Reflect.apply(track, value12, [GIFT_CODE_RESOLVED, {resolved: false, gift_code: a0}]);
value = binding(binding4[10]);
prototype = value.prototype;
value13 = Object.create(prototype, {constructor: {value: value}});
value = new value();
value = value instanceof Object ? value : value13;
throw value;
}
try {
binding2 = env2_2;
} catch (error) {
binding = env2_1;
binding4 = env2_2;
value12 = binding(binding4[9]);
track = value12.track;
GIFT_CODE_RESOLVED = env2_8.GIFT_CODE_RESOLVED;
Reflect.apply(track, value12, [GIFT_CODE_RESOLVED, {resolved: false, gift_code: a0}]);
value = binding(binding4[10]);
prototype = value.prototype;
value13 = Object.create(prototype, {constructor: {value: value}});
value = new value();
value = value instanceof Object ? value : value13;
throw value;
}
try {
property = binding2[8];
} catch (error) {
binding = env2_1;
binding4 = env2_2;
value12 = binding(binding4[9]);
track = value12.track;
GIFT_CODE_RESOLVED = env2_8.GIFT_CODE_RESOLVED;
Reflect.apply(track, value12, [GIFT_CODE_RESOLVED, {resolved: false, gift_code: a0}]);
value = binding(binding4[10]);
prototype = value.prototype;
value13 = Object.create(prototype, {constructor: {value: value}});
value = new value();
value = value instanceof Object ? value : value13;
throw value;
}
try {
value6 = binding(property);
} catch (error) {
binding = env2_1;
binding4 = env2_2;
value12 = binding(binding4[9]);
track = value12.track;
GIFT_CODE_RESOLVED = env2_8.GIFT_CODE_RESOLVED;
Reflect.apply(track, value12, [GIFT_CODE_RESOLVED, {resolved: false, gift_code: a0}]);
value = binding(binding4[10]);
prototype = value.prototype;
value13 = Object.create(prototype, {constructor: {value: value}});
value = new value();
value = value instanceof Object ? value : value13;
throw value;
}
try {
httpGetWithCountryCodeQuery = value6.httpGetWithCountryCodeQuery;
} catch (error) {
binding = env2_1;
binding4 = env2_2;
value12 = binding(binding4[9]);
track = value12.track;
GIFT_CODE_RESOLVED = env2_8.GIFT_CODE_RESOLVED;
Reflect.apply(track, value12, [GIFT_CODE_RESOLVED, {resolved: false, gift_code: a0}]);
value = binding(binding4[10]);
prototype = value.prototype;
value13 = Object.create(prototype, {constructor: {value: value}});
value = new value();
value = value instanceof Object ? value : value13;
throw value;
}
try {
object = {};
} catch (error) {
binding = env2_1;
binding4 = env2_2;
value12 = binding(binding4[9]);
track = value12.track;
GIFT_CODE_RESOLVED = env2_8.GIFT_CODE_RESOLVED;
Reflect.apply(track, value12, [GIFT_CODE_RESOLVED, {resolved: false, gift_code: a0}]);
value = binding(binding4[10]);
prototype = value.prototype;
value13 = Object.create(prototype, {constructor: {value: value}});
value = new value();
value = value instanceof Object ? value : value13;
throw value;
}
try {
binding = env2_7;
} catch (error) {
binding = env2_1;
binding4 = env2_2;
value12 = binding(binding4[9]);
track = value12.track;
GIFT_CODE_RESOLVED = env2_8.GIFT_CODE_RESOLVED;
Reflect.apply(track, value12, [GIFT_CODE_RESOLVED, {resolved: false, gift_code: a0}]);
value = binding(binding4[10]);
prototype = value.prototype;
value13 = Object.create(prototype, {constructor: {value: value}});
value = new value();
value = value instanceof Object ? value : value13;
throw value;
}
try {
GIFT_CODE_RESOLVE = binding.GIFT_CODE_RESOLVE;
} catch (error) {
binding = env2_1;
binding4 = env2_2;
value12 = binding(binding4[9]);
track = value12.track;
GIFT_CODE_RESOLVED = env2_8.GIFT_CODE_RESOLVED;
Reflect.apply(track, value12, [GIFT_CODE_RESOLVED, {resolved: false, gift_code: a0}]);
value = binding(binding4[10]);
prototype = value.prototype;
value13 = Object.create(prototype, {constructor: {value: value}});
value = new value();
value = value instanceof Object ? value : value13;
throw value;
}
try {
value7 = Reflect.apply(GIFT_CODE_RESOLVE, binding, [a0]);
} catch (error) {
binding = env2_1;
binding4 = env2_2;
value12 = binding(binding4[9]);
track = value12.track;
GIFT_CODE_RESOLVED = env2_8.GIFT_CODE_RESOLVED;
Reflect.apply(track, value12, [GIFT_CODE_RESOLVED, {resolved: false, gift_code: a0}]);
value = binding(binding4[10]);
prototype = value.prototype;
value13 = Object.create(prototype, {constructor: {value: value}});
value = new value();
value = value instanceof Object ? value : value13;
throw value;
}
try {
object.url = value7;
} catch (error) {
binding = env2_1;
binding4 = env2_2;
value12 = binding(binding4[9]);
track = value12.track;
GIFT_CODE_RESOLVED = env2_8.GIFT_CODE_RESOLVED;
Reflect.apply(track, value12, [GIFT_CODE_RESOLVED, {resolved: false, gift_code: a0}]);
value = binding(binding4[10]);
prototype = value.prototype;
value13 = Object.create(prototype, {constructor: {value: value}});
value = new value();
value = value instanceof Object ? value : value13;
throw value;
}
try {
object2 = {};
} catch (error) {
binding = env2_1;
binding4 = env2_2;
value12 = binding(binding4[9]);
track = value12.track;
GIFT_CODE_RESOLVED = env2_8.GIFT_CODE_RESOLVED;
Reflect.apply(track, value12, [GIFT_CODE_RESOLVED, {resolved: false, gift_code: a0}]);
value = binding(binding4[10]);
prototype = value.prototype;
value13 = Object.create(prototype, {constructor: {value: value}});
value = new value();
value = value instanceof Object ? value : value13;
throw value;
}
try {
object2.with_application = r3;
} catch (error) {
binding = env2_1;
binding4 = env2_2;
value12 = binding(binding4[9]);
track = value12.track;
GIFT_CODE_RESOLVED = env2_8.GIFT_CODE_RESOLVED;
Reflect.apply(track, value12, [GIFT_CODE_RESOLVED, {resolved: false, gift_code: a0}]);
value = binding(binding4[10]);
prototype = value.prototype;
value13 = Object.create(prototype, {constructor: {value: value}});
value = new value();
value = value instanceof Object ? value : value13;
throw value;
}
try {
object2.with_subscription_plan = r1;
} catch (error) {
binding = env2_1;
binding4 = env2_2;
value12 = binding(binding4[9]);
track = value12.track;
GIFT_CODE_RESOLVED = env2_8.GIFT_CODE_RESOLVED;
Reflect.apply(track, value12, [GIFT_CODE_RESOLVED, {resolved: false, gift_code: a0}]);
value = binding(binding4[10]);
prototype = value.prototype;
value13 = Object.create(prototype, {constructor: {value: value}});
value = new value();
value = value instanceof Object ? value : value13;
throw value;
}
try {
object.query = object2;
} catch (error) {
binding = env2_1;
binding4 = env2_2;
value12 = binding(binding4[9]);
track = value12.track;
GIFT_CODE_RESOLVED = env2_8.GIFT_CODE_RESOLVED;
Reflect.apply(track, value12, [GIFT_CODE_RESOLVED, {resolved: false, gift_code: a0}]);
value = binding(binding4[10]);
prototype = value.prototype;
value13 = Object.create(prototype, {constructor: {value: value}});
value = new value();
value = value instanceof Object ? value : value13;
throw value;
}
try {
object.oldFormErrors = true;
} catch (error) {
binding = env2_1;
binding4 = env2_2;
value12 = binding(binding4[9]);
track = value12.track;
GIFT_CODE_RESOLVED = env2_8.GIFT_CODE_RESOLVED;
Reflect.apply(track, value12, [GIFT_CODE_RESOLVED, {resolved: false, gift_code: a0}]);
value = binding(binding4[10]);
prototype = value.prototype;
value13 = Object.create(prototype, {constructor: {value: value}});
value = new value();
value = value instanceof Object ? value : value13;
throw value;
}
try {
object.rejectWithError = false;
} catch (error) {
binding = env2_1;
binding4 = env2_2;
value12 = binding(binding4[9]);
track = value12.track;
GIFT_CODE_RESOLVED = env2_8.GIFT_CODE_RESOLVED;
Reflect.apply(track, value12, [GIFT_CODE_RESOLVED, {resolved: false, gift_code: a0}]);
value = binding(binding4[10]);
prototype = value.prototype;
value13 = Object.create(prototype, {constructor: {value: value}});
value = new value();
value = value instanceof Object ? value : value13;
throw value;
}
try {
value8 = Reflect.apply(httpGetWithCountryCodeQuery, value6, [object]);
} catch (error) {
binding = env2_1;
binding4 = env2_2;
value12 = binding(binding4[9]);
track = value12.track;
GIFT_CODE_RESOLVED = env2_8.GIFT_CODE_RESOLVED;
Reflect.apply(track, value12, [GIFT_CODE_RESOLVED, {resolved: false, gift_code: a0}]);
value = binding(binding4[10]);
prototype = value.prototype;
value13 = Object.create(prototype, {constructor: {value: value}});
value = new value();
value = value instanceof Object ? value : value13;
throw value;
}
await value8;
try {
value9 = undefined;
value10 = false;
} catch (error) {
binding = env2_1;
binding4 = env2_2;
value12 = binding(binding4[9]);
track = value12.track;
GIFT_CODE_RESOLVED = env2_8.GIFT_CODE_RESOLVED;
Reflect.apply(track, value12, [GIFT_CODE_RESOLVED, {resolved: false, gift_code: a0}]);
value = binding(binding4[10]);
prototype = value.prototype;
value13 = Object.create(prototype, {constructor: {value: value}});
value = new value();
value = value instanceof Object ? value : value13;
throw value;
}
if (value10) {
return value9;
}
try {
body = value9.body;
} catch (error) {
binding = env2_1;
binding4 = env2_2;
value12 = binding(binding4[9]);
track = value12.track;
GIFT_CODE_RESOLVED = env2_8.GIFT_CODE_RESOLVED;
Reflect.apply(track, value12, [GIFT_CODE_RESOLVED, {resolved: false, gift_code: a0}]);
value = binding(binding4[10]);
prototype = value.prototype;
value13 = Object.create(prototype, {constructor: {value: value}});
value = new value();
value = value instanceof Object ? value : value13;
throw value;
}
try {
binding = env2_1;
} catch (error) {
binding = env2_1;
binding4 = env2_2;
value12 = binding(binding4[9]);
track = value12.track;
GIFT_CODE_RESOLVED = env2_8.GIFT_CODE_RESOLVED;
Reflect.apply(track, value12, [GIFT_CODE_RESOLVED, {resolved: false, gift_code: a0}]);
value = binding(binding4[10]);
prototype = value.prototype;
value13 = Object.create(prototype, {constructor: {value: value}});
value = new value();
value = value instanceof Object ? value : value13;
throw value;
}
try {
binding3 = env2_2;
} catch (error) {
binding = env2_1;
binding4 = env2_2;
value12 = binding(binding4[9]);
track = value12.track;
GIFT_CODE_RESOLVED = env2_8.GIFT_CODE_RESOLVED;
Reflect.apply(track, value12, [GIFT_CODE_RESOLVED, {resolved: false, gift_code: a0}]);
value = binding(binding4[10]);
prototype = value.prototype;
value13 = Object.create(prototype, {constructor: {value: value}});
value = new value();
value = value instanceof Object ? value : value13;
throw value;
}
try {
property = binding3[9];
} catch (error) {
binding = env2_1;
binding4 = env2_2;
value12 = binding(binding4[9]);
track = value12.track;
GIFT_CODE_RESOLVED = env2_8.GIFT_CODE_RESOLVED;
Reflect.apply(track, value12, [GIFT_CODE_RESOLVED, {resolved: false, gift_code: a0}]);
value = binding(binding4[10]);
prototype = value.prototype;
value13 = Object.create(prototype, {constructor: {value: value}});
value = new value();
value = value instanceof Object ? value : value13;
throw value;
}
try {
value11 = binding(property);
} catch (error) {
binding = env2_1;
binding4 = env2_2;
value12 = binding(binding4[9]);
track = value12.track;
GIFT_CODE_RESOLVED = env2_8.GIFT_CODE_RESOLVED;
Reflect.apply(track, value12, [GIFT_CODE_RESOLVED, {resolved: false, gift_code: a0}]);
value = binding(binding4[10]);
prototype = value.prototype;
value13 = Object.create(prototype, {constructor: {value: value}});
value = new value();
value = value instanceof Object ? value : value13;
throw value;
}
try {
track = value11.track;
} catch (error) {
binding = env2_1;
binding4 = env2_2;
value12 = binding(binding4[9]);
track = value12.track;
GIFT_CODE_RESOLVED = env2_8.GIFT_CODE_RESOLVED;
Reflect.apply(track, value12, [GIFT_CODE_RESOLVED, {resolved: false, gift_code: a0}]);
value = binding(binding4[10]);
prototype = value.prototype;
value13 = Object.create(prototype, {constructor: {value: value}});
value = new value();
value = value instanceof Object ? value : value13;
throw value;
}
try {
binding = env2_8;
} catch (error) {
binding = env2_1;
binding4 = env2_2;
value12 = binding(binding4[9]);
track = value12.track;
GIFT_CODE_RESOLVED = env2_8.GIFT_CODE_RESOLVED;
Reflect.apply(track, value12, [GIFT_CODE_RESOLVED, {resolved: false, gift_code: a0}]);
value = binding(binding4[10]);
prototype = value.prototype;
value13 = Object.create(prototype, {constructor: {value: value}});
value = new value();
value = value instanceof Object ? value : value13;
throw value;
}
try {
GIFT_CODE_RESOLVED = binding.GIFT_CODE_RESOLVED;
} catch (error) {
binding = env2_1;
binding4 = env2_2;
value12 = binding(binding4[9]);
track = value12.track;
GIFT_CODE_RESOLVED = env2_8.GIFT_CODE_RESOLVED;
Reflect.apply(track, value12, [GIFT_CODE_RESOLVED, {resolved: false, gift_code: a0}]);
value = binding(binding4[10]);
prototype = value.prototype;
value13 = Object.create(prototype, {constructor: {value: value}});
value = new value();
value = value instanceof Object ? value : value13;
throw value;
}
try {
object = {};
} catch (error) {
binding = env2_1;
binding4 = env2_2;
value12 = binding(binding4[9]);
track = value12.track;
GIFT_CODE_RESOLVED = env2_8.GIFT_CODE_RESOLVED;
Reflect.apply(track, value12, [GIFT_CODE_RESOLVED, {resolved: false, gift_code: a0}]);
value = binding(binding4[10]);
prototype = value.prototype;
value13 = Object.create(prototype, {constructor: {value: value}});
value = new value();
value = value instanceof Object ? value : value13;
throw value;
}
try {
object.resolved = true;
} catch (error) {
binding = env2_1;
binding4 = env2_2;
value12 = binding(binding4[9]);
track = value12.track;
GIFT_CODE_RESOLVED = env2_8.GIFT_CODE_RESOLVED;
Reflect.apply(track, value12, [GIFT_CODE_RESOLVED, {resolved: false, gift_code: a0}]);
value = binding(binding4[10]);
prototype = value.prototype;
value13 = Object.create(prototype, {constructor: {value: value}});
value = new value();
value = value instanceof Object ? value : value13;
throw value;
}
try {
code = body.code;
} catch (error) {
binding = env2_1;
binding4 = env2_2;
value12 = binding(binding4[9]);
track = value12.track;
GIFT_CODE_RESOLVED = env2_8.GIFT_CODE_RESOLVED;
Reflect.apply(track, value12, [GIFT_CODE_RESOLVED, {resolved: false, gift_code: a0}]);
value = binding(binding4[10]);
prototype = value.prototype;
value13 = Object.create(prototype, {constructor: {value: value}});
value = new value();
value = value instanceof Object ? value : value13;
throw value;
}
try {
object.gift_code = code;
} catch (error) {
binding = env2_1;
binding4 = env2_2;
value12 = binding(binding4[9]);
track = value12.track;
GIFT_CODE_RESOLVED = env2_8.GIFT_CODE_RESOLVED;
Reflect.apply(track, value12, [GIFT_CODE_RESOLVED, {resolved: false, gift_code: a0}]);
value = binding(binding4[10]);
prototype = value.prototype;
value13 = Object.create(prototype, {constructor: {value: value}});
value = new value();
value = value instanceof Object ? value : value13;
throw value;
}
try {
max_uses = body.max_uses;
} catch (error) {
binding = env2_1;
binding4 = env2_2;
value12 = binding(binding4[9]);
track = value12.track;
GIFT_CODE_RESOLVED = env2_8.GIFT_CODE_RESOLVED;
Reflect.apply(track, value12, [GIFT_CODE_RESOLVED, {resolved: false, gift_code: a0}]);
value = binding(binding4[10]);
prototype = value.prototype;
value13 = Object.create(prototype, {constructor: {value: value}});
value = new value();
value = value instanceof Object ? value : value13;
throw value;
}
try {
object.gift_code_max_uses = max_uses;
} catch (error) {
binding = env2_1;
binding4 = env2_2;
value12 = binding(binding4[9]);
track = value12.track;
GIFT_CODE_RESOLVED = env2_8.GIFT_CODE_RESOLVED;
Reflect.apply(track, value12, [GIFT_CODE_RESOLVED, {resolved: false, gift_code: a0}]);
value = binding(binding4[10]);
prototype = value.prototype;
value13 = Object.create(prototype, {constructor: {value: value}});
value = new value();
value = value instanceof Object ? value : value13;
throw value;
}
try {
store_listing = body.store_listing;
} catch (error) {
binding = env2_1;
binding4 = env2_2;
value12 = binding(binding4[9]);
track = value12.track;
GIFT_CODE_RESOLVED = env2_8.GIFT_CODE_RESOLVED;
Reflect.apply(track, value12, [GIFT_CODE_RESOLVED, {resolved: false, gift_code: a0}]);
value = binding(binding4[10]);
prototype = value.prototype;
value13 = Object.create(prototype, {constructor: {value: value}});
value = new value();
value = value instanceof Object ? value : value13;
throw value;
}
try {
sku = store_listing.sku;
} catch (error) {
binding = env2_1;
binding4 = env2_2;
value12 = binding(binding4[9]);
track = value12.track;
GIFT_CODE_RESOLVED = env2_8.GIFT_CODE_RESOLVED;
Reflect.apply(track, value12, [GIFT_CODE_RESOLVED, {resolved: false, gift_code: a0}]);
value = binding(binding4[10]);
prototype = value.prototype;
value13 = Object.create(prototype, {constructor: {value: value}});
value = new value();
value = value instanceof Object ? value : value13;
throw value;
}
try {
id = sku.id;
} catch (error) {
binding = env2_1;
binding4 = env2_2;
value12 = binding(binding4[9]);
track = value12.track;
GIFT_CODE_RESOLVED = env2_8.GIFT_CODE_RESOLVED;
Reflect.apply(track, value12, [GIFT_CODE_RESOLVED, {resolved: false, gift_code: a0}]);
value = binding(binding4[10]);
prototype = value.prototype;
value13 = Object.create(prototype, {constructor: {value: value}});
value = new value();
value = value instanceof Object ? value : value13;
throw value;
}
try {
object.sku_id = id;
} catch (error) {
binding = env2_1;
binding4 = env2_2;
value12 = binding(binding4[9]);
track = value12.track;
GIFT_CODE_RESOLVED = env2_8.GIFT_CODE_RESOLVED;
Reflect.apply(track, value12, [GIFT_CODE_RESOLVED, {resolved: false, gift_code: a0}]);
value = binding(binding4[10]);
prototype = value.prototype;
value13 = Object.create(prototype, {constructor: {value: value}});
value = new value();
value = value instanceof Object ? value : value13;
throw value;
}
try {
store_listing = body.store_listing;
} catch (error) {
binding = env2_1;
binding4 = env2_2;
value12 = binding(binding4[9]);
track = value12.track;
GIFT_CODE_RESOLVED = env2_8.GIFT_CODE_RESOLVED;
Reflect.apply(track, value12, [GIFT_CODE_RESOLVED, {resolved: false, gift_code: a0}]);
value = binding(binding4[10]);
prototype = value.prototype;
value13 = Object.create(prototype, {constructor: {value: value}});
value = new value();
value = value instanceof Object ? value : value13;
throw value;
}
try {
sku = store_listing.sku;
} catch (error) {
binding = env2_1;
binding4 = env2_2;
value12 = binding(binding4[9]);
track = value12.track;
GIFT_CODE_RESOLVED = env2_8.GIFT_CODE_RESOLVED;
Reflect.apply(track, value12, [GIFT_CODE_RESOLVED, {resolved: false, gift_code: a0}]);
value = binding(binding4[10]);
prototype = value.prototype;
value13 = Object.create(prototype, {constructor: {value: value}});
value = new value();
value = value instanceof Object ? value : value13;
throw value;
}
try {
type = sku.type;
} catch (error) {
binding = env2_1;
binding4 = env2_2;
value12 = binding(binding4[9]);
track = value12.track;
GIFT_CODE_RESOLVED = env2_8.GIFT_CODE_RESOLVED;
Reflect.apply(track, value12, [GIFT_CODE_RESOLVED, {resolved: false, gift_code: a0}]);
value = binding(binding4[10]);
prototype = value.prototype;
value13 = Object.create(prototype, {constructor: {value: value}});
value = new value();
value = value instanceof Object ? value : value13;
throw value;
}
try {
object.sku_type = type;
} catch (error) {
binding = env2_1;
binding4 = env2_2;
value12 = binding(binding4[9]);
track = value12.track;
GIFT_CODE_RESOLVED = env2_8.GIFT_CODE_RESOLVED;
Reflect.apply(track, value12, [GIFT_CODE_RESOLVED, {resolved: false, gift_code: a0}]);
value = binding(binding4[10]);
prototype = value.prototype;
value13 = Object.create(prototype, {constructor: {value: value}});
value = new value();
value = value instanceof Object ? value : value13;
throw value;
}
try {
store_listing = body.store_listing;
} catch (error) {
binding = env2_1;
binding4 = env2_2;
value12 = binding(binding4[9]);
track = value12.track;
GIFT_CODE_RESOLVED = env2_8.GIFT_CODE_RESOLVED;
Reflect.apply(track, value12, [GIFT_CODE_RESOLVED, {resolved: false, gift_code: a0}]);
value = binding(binding4[10]);
prototype = value.prototype;
value13 = Object.create(prototype, {constructor: {value: value}});
value = new value();
value = value instanceof Object ? value : value13;
throw value;
}
try {
sku = store_listing.sku;
} catch (error) {
binding = env2_1;
binding4 = env2_2;
value12 = binding(binding4[9]);
track = value12.track;
GIFT_CODE_RESOLVED = env2_8.GIFT_CODE_RESOLVED;
Reflect.apply(track, value12, [GIFT_CODE_RESOLVED, {resolved: false, gift_code: a0}]);
value = binding(binding4[10]);
prototype = value.prototype;
value13 = Object.create(prototype, {constructor: {value: value}});
value = new value();
value = value instanceof Object ? value : value13;
throw value;
}
try {
application_id = sku.application_id;
} catch (error) {
binding = env2_1;
binding4 = env2_2;
value12 = binding(binding4[9]);
track = value12.track;
GIFT_CODE_RESOLVED = env2_8.GIFT_CODE_RESOLVED;
Reflect.apply(track, value12, [GIFT_CODE_RESOLVED, {resolved: false, gift_code: a0}]);
value = binding(binding4[10]);
prototype = value.prototype;
value13 = Object.create(prototype, {constructor: {value: value}});
value = new value();
value = value instanceof Object ? value : value13;
throw value;
}
try {
object.application_id = application_id;
} catch (error) {
binding = env2_1;
binding4 = env2_2;
value12 = binding(binding4[9]);
track = value12.track;
GIFT_CODE_RESOLVED = env2_8.GIFT_CODE_RESOLVED;
Reflect.apply(track, value12, [GIFT_CODE_RESOLVED, {resolved: false, gift_code: a0}]);
value = binding(binding4[10]);
prototype = value.prototype;
value13 = Object.create(prototype, {constructor: {value: value}});
value = new value();
value = value instanceof Object ? value : value13;
throw value;
}
try {
store_listing = body.store_listing;
} catch (error) {
binding = env2_1;
binding4 = env2_2;
value12 = binding(binding4[9]);
track = value12.track;
GIFT_CODE_RESOLVED = env2_8.GIFT_CODE_RESOLVED;
Reflect.apply(track, value12, [GIFT_CODE_RESOLVED, {resolved: false, gift_code: a0}]);
value = binding(binding4[10]);
prototype = value.prototype;
value13 = Object.create(prototype, {constructor: {value: value}});
value = new value();
value = value instanceof Object ? value : value13;
throw value;
}
try {
sku = store_listing.sku;
} catch (error) {
binding = env2_1;
binding4 = env2_2;
value12 = binding(binding4[9]);
track = value12.track;
GIFT_CODE_RESOLVED = env2_8.GIFT_CODE_RESOLVED;
Reflect.apply(track, value12, [GIFT_CODE_RESOLVED, {resolved: false, gift_code: a0}]);
value = binding(binding4[10]);
prototype = value.prototype;
value13 = Object.create(prototype, {constructor: {value: value}});
value = new value();
value = value instanceof Object ? value : value13;
throw value;
}
try {
name = sku.name;
} catch (error) {
binding = env2_1;
binding4 = env2_2;
value12 = binding(binding4[9]);
track = value12.track;
GIFT_CODE_RESOLVED = env2_8.GIFT_CODE_RESOLVED;
Reflect.apply(track, value12, [GIFT_CODE_RESOLVED, {resolved: false, gift_code: a0}]);
value = binding(binding4[10]);
prototype = value.prototype;
value13 = Object.create(prototype, {constructor: {value: value}});
value = new value();
value = value instanceof Object ? value : value13;
throw value;
}
try {
object.store_title = name;
} catch (error) {
binding = env2_1;
binding4 = env2_2;
value12 = binding(binding4[9]);
track = value12.track;
GIFT_CODE_RESOLVED = env2_8.GIFT_CODE_RESOLVED;
Reflect.apply(track, value12, [GIFT_CODE_RESOLVED, {resolved: false, gift_code: a0}]);
value = binding(binding4[10]);
prototype = value.prototype;
value13 = Object.create(prototype, {constructor: {value: value}});
value = new value();
value = value instanceof Object ? value : value13;
throw value;
}
try {
object3 = {};
} catch (error) {
binding = env2_1;
binding4 = env2_2;
value12 = binding(binding4[9]);
track = value12.track;
GIFT_CODE_RESOLVED = env2_8.GIFT_CODE_RESOLVED;
Reflect.apply(track, value12, [GIFT_CODE_RESOLVED, {resolved: false, gift_code: a0}]);
value = binding(binding4[10]);
prototype = value.prototype;
value13 = Object.create(prototype, {constructor: {value: value}});
value = new value();
value = value instanceof Object ? value : value13;
throw value;
}
try {
object3.flush = true;
} catch (error) {
binding = env2_1;
binding4 = env2_2;
value12 = binding(binding4[9]);
track = value12.track;
GIFT_CODE_RESOLVED = env2_8.GIFT_CODE_RESOLVED;
Reflect.apply(track, value12, [GIFT_CODE_RESOLVED, {resolved: false, gift_code: a0}]);
value = binding(binding4[10]);
prototype = value.prototype;
value13 = Object.create(prototype, {constructor: {value: value}});
value = new value();
value = value instanceof Object ? value : value13;
throw value;
}
try {
Reflect.apply(track, value11, [GIFT_CODE_RESOLVED, object, object3]);
} catch (error) {
binding = env2_1;
binding4 = env2_2;
value12 = binding(binding4[9]);
track = value12.track;
GIFT_CODE_RESOLVED = env2_8.GIFT_CODE_RESOLVED;
Reflect.apply(track, value12, [GIFT_CODE_RESOLVED, {resolved: false, gift_code: a0}]);
value = binding(binding4[10]);
prototype = value.prototype;
value13 = Object.create(prototype, {constructor: {value: value}});
value = new value();
value = value instanceof Object ? value : value13;
throw value;
}
return body;
}
}
function getSubscriptionGiftSuccessText(a0) { // fn#34260, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4300:1928, offset: 0x0105097f, size: 259 bytes, params: 2, frame: 15
const env0_0 = a0;
const value2 = (Module04242Module).match(a0);
let MONTH = SubscriptionIntervalTypes.MONTH;
let TIER_2 = PremiumTypes.TIER_2;
const value3 = value2.with({interval: MONTH, premiumSubscriptionType: TIER_2}, function() {
var intl = require(dependencyMap[12]).intl;
var property = require(dependencyMap[12]).t['vFfV+J'];
var object = {};
object.timeInterval = require(dependencyMap[12]).intl.string(require(dependencyMap[12]).t.FPybU7);
return intl.formatToPlainString(property, object);
});
let YEAR = SubscriptionIntervalTypes.YEAR;
TIER_2 = PremiumTypes.TIER_2;
const value4 = value3.with({interval: YEAR, premiumSubscriptionType: TIER_2}, function() {
var intl = require(dependencyMap[12]).intl;
var property = require(dependencyMap[12]).t['vFfV+J'];
var object = {};
object.timeInterval = require(dependencyMap[12]).intl.string(require(dependencyMap[12]).t.tfqrhj);
return intl.formatToPlainString(property, object);
});
MONTH = SubscriptionIntervalTypes.MONTH;
let TIER_1 = PremiumTypes.TIER_1;
const value5 = value4.with({interval: MONTH, premiumSubscriptionType: TIER_1}, _fun34263);
YEAR = SubscriptionIntervalTypes.YEAR;
TIER_1 = PremiumTypes.TIER_1;
return value5.with({interval: YEAR, premiumSubscriptionType: TIER_1}, _fun34264).otherwise(function() {
return require(dependencyMap[12]).intl.string(require(dependencyMap[12]).t['5ayf7w']);
});
function _fun34263() { // fn#34263, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4300:2403, offset: 0x01050b66, size: 85 bytes, params: 1, frame: 15
const intl = (IndexNativeModule).intl;
return intl.formatToPlainString((IndexNativeModule).t.gjKbF4,
{intervalCount: env0_0.intervalCount});
}
function _fun34264() { // fn#34264, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4300:2551, offset: 0x01050bbb, size: 85 bytes, params: 1, frame: 15
const intl = (IndexNativeModule).intl;
const formatToPlainString = intl.formatToPlainString;
const GIe7Bw = (IndexNativeModule).t.GIe7Bw;
return Reflect.apply(formatToPlainString, intl, [GIe7Bw, {intervalCount: env0_0.intervalCount}]);
}
}
function getErrorMessage(a0, a1, a2, a3, a4) { // fn#34266, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4300:2702, offset: 0x01050c4e, size: 141 bytes, params: 6, frame: 18
const r3 = a2 || a3 ? undefined : a0;
const intl = (IndexNativeModule).intl;
const value3 = intl.format((IndexNativeModule).t['5zyz9y'],
{onGoToLibrary: a4});
const value4 = null;
return value4 != r3 ? value3 : value4 == a1 ? value4 : getGiftCodeRedeemError(a1, UserStore.getCurrentUser());
}
function getGiftCodeRedeemError({code}, a1) { // fn#34267, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4300:2896, offset: 0x01050cdb, size: 882 bytes, params: 3, frame: 21
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
var string;
const t = (require(1244) /* metro dependency 1244: indexNative */).t;
var formatToPlainString;
var property;
var moduleValue;
var isPremiumExactly2;
var intl2;
const INVALID_GIFT_SELF_REDEMPTION = AbortCodes.INVALID_GIFT_SELF_REDEMPTION;
if (INVALID_GIFT_SELF_REDEMPTION === code) {
return intl.string(t.wa9h7F);
}
const INVALID_GIFT_REDEMPTION_EXHAUSTED = AbortCodes.INVALID_GIFT_REDEMPTION_EXHAUSTED;
if (INVALID_GIFT_REDEMPTION_EXHAUSTED === code) {
return intl.string(t.Iw2TUW);
}
const INVALID_GIFT_REDEMPTION_OWNED = AbortCodes.INVALID_GIFT_REDEMPTION_OWNED;
if (INVALID_GIFT_REDEMPTION_OWNED === code) {
return intl.string(t.mdLtb5);
}
const UNKNOWN_GIFT_CODE = AbortCodes.UNKNOWN_GIFT_CODE;
if (UNKNOWN_GIFT_CODE === code) {
return intl.string(t.roztIr);
}
const INVALID_GIFT_REDEMPTION_SUBSCRIPTION_INCOMPATIBLE = AbortCodes.INVALID_GIFT_REDEMPTION_SUBSCRIPTION_INCOMPATIBLE;
if (INVALID_GIFT_REDEMPTION_SUBSCRIPTION_INCOMPATIBLE === code) {
formatToPlainString = intl.formatToPlainString;
property = t['4YTHKw'];
moduleValue = require(3802) /* metro dependency 3802: PremiumUtils */;
isPremiumExactly2 = moduleValue.isPremiumExactly(a1, PremiumTypes.TIER_2);
intl2 = (require(1244) /* metro dependency 1244: indexNative */).intl;
string = intl2.string;
return Reflect.apply(formatToPlainString, intl, [property, {planName: isPremiumExactly2 ? Reflect.apply(string,
intl2, [t.lG6a5x]) : Reflect.apply(string, intl2, [t.FSOz78])}]);
}
const INVALID_GIFT_REDEMPTION_SUBSCRIPTION_MANAGED = AbortCodes.INVALID_GIFT_REDEMPTION_SUBSCRIPTION_MANAGED;
if (INVALID_GIFT_REDEMPTION_SUBSCRIPTION_MANAGED === code) {
return intl.string(t['9i1J30']);
}
const INVALID_GIFT_REDEMPTION_INVOICE_OPEN = AbortCodes.INVALID_GIFT_REDEMPTION_INVOICE_OPEN;
if (INVALID_GIFT_REDEMPTION_INVOICE_OPEN === code) {
return intl.string(t['U26WX+']);
}
const INVALID_GIFT_REDEMPTION_FRAUD_REJECTED = AbortCodes.INVALID_GIFT_REDEMPTION_FRAUD_REJECTED;
if (INVALID_GIFT_REDEMPTION_FRAUD_REJECTED === code) {
return intl.string(t.ypuSd8);
}
const BILLING_NON_REFUNDABLE_PAYMENT_SOURCE = AbortCodes.BILLING_NON_REFUNDABLE_PAYMENT_SOURCE;
if (BILLING_NON_REFUNDABLE_PAYMENT_SOURCE === code) {
return intl.string(t.mXMmWE);
}
return intl.string(t['s9+XlB']);
}
function _fun34268(a0) { // fn#34268, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4300:421, offset: 0x0105104d, size: 41 bytes, params: 2, frame: 11
return (RegexUtils).escape(a0);
}
function _fun34269(a0) { // fn#34269, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4300:581, offset: 0x0105104d, size: 41 bytes, params: 2, frame: 11
return (RegexUtils).escape(a0);
}
function _fun34270(a0, a1) { // fn#34270, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4300:691, offset: 0x01051076, size: 71 bytes, params: 3, frame: 12
const env0_0 = a0;
const Array = global.Array;
let value = Array(a1);
value = value.fill(undefined);
value = value.map(_fun34271);
return value.join('-?');
function _fun34271() { // fn#34271, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4300:725, offset: 0x010510bd, size: 40 bytes, params: 1, frame: 13
return '[abcdefghjkmnpqrstuvwxyzABCDEFGHJKMNPQRSTUVWXYZ23456789]{' + env0_0 + '}';
}
}
function shouldShowCustomGiftExperience(a0) { // fn#34272, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4300:4115, offset: 0x010510e5, size: 33 bytes, params: 2, frame: 12
const giftExperience = getGiftExperience(a0);
const DEFAULT = env0_17.DEFAULT;
return giftExperience !== DEFAULT;
}
function parseComboId(a0) { // fn#34274, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4300:4309, offset: 0x0105115d, size: 122 bytes, params: 2, frame: 17
let value = a0.split(':');
const value3 = undefined;
value = Module00057(value, 3);
const property = value[0];
const property2 = value[1];
const property3 = value[2];
const object = {skuId: property};
value = null;
object.subscriptionPlanId = property2 === '' ? value : property2;
object.giftStyle = property3 === '' ? value3 : value != property3 ? global.Number.parseInt(property3) : value3;
return object;
}
function findGiftCodes(a0) { // fn#34276, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4300:4720, offset: 0x0105124f, size: 157 bytes, params: 2, frame: 20
var r3;
var size;
var value4;
if (a0 == null) {
return [];
}
const Set = global.Set;
const set = new Set();
let binding = env0_15;
const value3 = binding.exec(a0);
if (value3 != null) {
size = set.size;
if (size < 3) {
r3 = value3;
while (true) {
set.add(cleanCode(r3[1]));
binding = env0_15;
value4 = binding.exec(a0);
if (value4 == null) {
break;
}
size = set.size;
if (size < 3) {
r3 = value4;
continue;
}
break;
}
}
}
const Array = global.Array;
return Array.from(set);
}
function trackGiftCodeCopy({analyticsData}, a1) { // fn#34279, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4300:5136, offset: 0x0105137b, size: 97 bytes, params: 3, frame: 18
const defaultImport = AnalyticsUtils;
const track = defaultImport.track;
const GIFT_CODE_COPIED = AnalyticEvents.GIFT_CODE_COPIED;
const object = {};
copyDataProperties(object, (GetAnalyticsDataForSKU)(a1, false,
false), undefined);
copyDataProperties(object, analyticsData, undefined);
Reflect.apply(track, defaultImport, [GIFT_CODE_COPIED, object]);
}
function getStep(a0, a1, {error, accepted, accepting, opened, isCustomGift}) { // fn#34280, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4300:5256, offset: 0x010513dc, size: 145 bytes, params: 4, frame: 7
return error != null ? GiftCodeModalStates.ERROR : accepted || accepting ? isCustomGift ? opened || accepted || accepting ? accepted && (a1.isSubscription || a0 != null) ? GiftCodeModalStates.SUCCESS : GiftCodeModalStates.CONFIRM : GiftCodeModalStates.OPEN : accepted && (a1.isSubscription || a0 != null) ? GiftCodeModalStates.SUCCESS : GiftCodeModalStates.CONFIRM : a0 != null ? GiftCodeModalStates.ERROR : isCustomGift ? opened || accepted || accepting ? accepted && (a1.isSubscription || a0 != null) ? GiftCodeModalStates.SUCCESS : GiftCodeModalStates.CONFIRM : GiftCodeModalStates.OPEN : accepted && (a1.isSubscription || a0 != null) ? GiftCodeModalStates.SUCCESS : GiftCodeModalStates.CONFIRM;
}
function getHeaderText(a0, a1, a2) { // fn#34281, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4300:5477, offset: 0x0105146d, size: 349 bytes, params: 4, frame: 19
const intl = (IndexNativeModule).intl;
const t = (IndexNativeModule).t;
const ERROR = GiftCodeModalStates.ERROR;
if (ERROR === a0) {
return intl.formatToMarkdownString(t.JUvC0s, {});
}
const SUCCESS = GiftCodeModalStates.SUCCESS;
if (SUCCESS === a0) {
return a1.isSubscription ? intl.formatToPlainString(t['1C2BG/'], {skuName: a2.name}) : intl.string(t['+BNMcF']);
}
GiftCodeModalStates.CONFIRM;
return a1.isSubscription ? intl.formatToPlainString(t['2VN4N9'], {skuName: a2.name}) : intl.string(t.RmamAI);
}
function getButtonText(a0, a1, {isCustomGift}) { // fn#34282, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4300:5930, offset: 0x010515ca, size: 512 bytes, params: 4, frame: 17
const intl = (IndexNativeModule).intl;
const t = (IndexNativeModule).t;
const ERROR = GiftCodeModalStates.ERROR;
if (ERROR === a0) {
return intl.string(t.w19zb6);
}
const SUCCESS = GiftCodeModalStates.SUCCESS;
if (SUCCESS === a0) {
return intl.string(t.zW87EM);
}
const OPEN = GiftCodeModalStates.OPEN;
if (OPEN === a0) {
return intl.string(t.F8ktci);
}
GiftCodeModalStates.CONFIRM;
return isCustomGift == null ? a1.giftStyle != null ? a1.isClaimed ? intl.string(t.OgpR0c) : intl.string(t['2BWscv']) : a1.isSubscription ? intl.string(t.wQ1FHy) : intl.string(t.OgpR0c) : isCustomGift ? intl.string(t.n6I6k4) : a1.giftStyle != null ? a1.isClaimed ? intl.string(t.OgpR0c) : intl.string(t['2BWscv']) : a1.isSubscription ? intl.string(t.wQ1FHy) : intl.string(t.OgpR0c);
}
function getSubscriptionGiftStartHeaderText(a0, a1) { // fn#34283, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4300:6562, offset: 0x010517ca, size: 626 bytes, params: 3, frame: 20
var r0;
var value2;
var MONTH;
var TIER_2;
var value3;
var YEAR;
var value4;
var TIER_0;
var value5;
var value6;
var value7;
var value8;
var value9;
const env0_0 = a1;
var value;
const intl = (IndexNativeModule).intl;
const string = intl.string;
const t = (IndexNativeModule).t;
const FPybU7 = t.FPybU7;
const env0_1 = Reflect.apply(string, intl, [FPybU7]);
const env0_2 = intl.string(t.tfqrhj);
if (a1 != null) {
value6 = (require(4242) /* metro dependency 4242 */).match(a0);
MONTH = SubscriptionIntervalTypes.MONTH;
TIER_2 = PremiumTypes.TIER_2;
value7 = value6.with({interval: MONTH, premiumSubscriptionType: TIER_2}, _fun34284);
YEAR = SubscriptionIntervalTypes.YEAR;
TIER_2 = PremiumTypes.TIER_2;
value8 = value7.with({interval: YEAR, premiumSubscriptionType: TIER_2}, _fun34285);
MONTH = SubscriptionIntervalTypes.MONTH;
TIER_0 = PremiumTypes.TIER_0;
value9 = value8.with({interval: MONTH, premiumSubscriptionType: TIER_0}, _fun34286);
YEAR = SubscriptionIntervalTypes.YEAR;
TIER_0 = PremiumTypes.TIER_0;
value = value9.with({interval: YEAR, premiumSubscriptionType: TIER_0}, _fun34287);
value = value.otherwise(function() {
return require(dependencyMap[12]).intl.formatToPlainString(require(dependencyMap[12]).t.td2m3W,
{sender: require});
});
r0 = value;
} else {
value2 = (require(4242) /* metro dependency 4242 */).match(a0);
MONTH = SubscriptionIntervalTypes.MONTH;
TIER_2 = PremiumTypes.TIER_2;
value3 = value2.with({interval: MONTH, premiumSubscriptionType: TIER_2}, _fun34289);
YEAR = SubscriptionIntervalTypes.YEAR;
TIER_2 = PremiumTypes.TIER_2;
value4 = value3.with({interval: YEAR, premiumSubscriptionType: TIER_2}, _fun34290);
MONTH = SubscriptionIntervalTypes.MONTH;
TIER_0 = PremiumTypes.TIER_0;
value5 = value4.with({interval: MONTH, premiumSubscriptionType: TIER_0}, _fun34291);
YEAR = SubscriptionIntervalTypes.YEAR;
TIER_0 = PremiumTypes.TIER_0;
value = value5.with({interval: YEAR, premiumSubscriptionType: TIER_0}, _fun34292);
value = value.otherwise(_fun34293);
r0 = value;
}
return r0;
function _fun34284() { // fn#34284, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4300:6790, offset: 0x01051a3c, size: 86 bytes, params: 1, frame: 15
const intl = (IndexNativeModule).intl;
return intl.formatToPlainString((IndexNativeModule).t['0UR0u4'],
{sender: require, timeInterval: env0_1});
}
function _fun34285() { // fn#34285, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4300:6935, offset: 0x01051a92, size: 86 bytes, params: 1, frame: 15
const intl = (IndexNativeModule).intl;
return intl.formatToPlainString((IndexNativeModule).t['0UR0u4'],
{sender: require, timeInterval: env0_2});
}
function _fun34286() { // fn#34286, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4300:7081, offset: 0x01051ae8, size: 86 bytes, params: 1, frame: 15
const intl = (IndexNativeModule).intl;
return intl.formatToPlainString((IndexNativeModule).t.sXpBon, {sender: require,
timeInterval: env0_1});
}
function _fun34287() { // fn#34287, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4300:7223, offset: 0x01051b3e, size: 86 bytes, params: 1, frame: 15
const intl = (IndexNativeModule).intl;
return intl.formatToPlainString((IndexNativeModule).t.sXpBon, {sender: require,
timeInterval: env0_2});
}
function _fun34289() { // fn#34289, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4300:7465, offset: 0x01051be3, size: 77 bytes, params: 1, frame: 15
const intl = (IndexNativeModule).intl;
return intl.formatToPlainString((IndexNativeModule).t['408Xt7'],
{timeInterval: env0_1});
}
function _fun34290() { // fn#34290, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4300:7601, offset: 0x01051c30, size: 77 bytes, params: 1, frame: 15
const intl = (IndexNativeModule).intl;
return intl.formatToPlainString((IndexNativeModule).t['408Xt7'],
{timeInterval: env0_2});
}
function _fun34291() { // fn#34291, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4300:7738, offset: 0x01051c7d, size: 77 bytes, params: 1, frame: 15
const intl = (IndexNativeModule).intl;
return intl.formatToPlainString((IndexNativeModule).t.e9l3JU,
{timeInterval: env0_1});
}
function _fun34292() { // fn#34292, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4300:7871, offset: 0x01051cca, size: 77 bytes, params: 1, frame: 15
const intl = (IndexNativeModule).intl;
return intl.formatToPlainString((IndexNativeModule).t.e9l3JU,
{timeInterval: env0_2});
}
function _fun34293() { // fn#34293, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4300:7958, offset: 0x01051d17, size: 64 bytes, params: 1, frame: 14
const intl = (IndexNativeModule).intl;
return intl.string((IndexNativeModule).t.hrnGng);
}
}
function getBodyText({step, sku, libraryApplication, error, accepted, accepting, onGoToLibrary, subscriptionPlan}) { // fn#34294, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4300:8020, offset: 0x01051d57, size: 448 bytes, params: 2, frame: 26
const intl = (IndexNativeModule).intl;
const t = (IndexNativeModule).t;
subscriptionPlan = subscriptionPlan === undefined ? null : subscriptionPlan;
const ERROR = GiftCodeModalStates.ERROR;
if (ERROR === step) {
return getErrorMessage(libraryApplication, error, accepted, accepting, onGoToLibrary);
}
const SUCCESS = GiftCodeModalStates.SUCCESS;
if (SUCCESS === step) {
return subscriptionPlan != null ? getSubscriptionGiftSuccessText(subscriptionPlan) : intl.formatToPlainString(t['3CPsbo'],
{skuName: sku.name});
}
GiftCodeModalStates.CONFIRM;
if (subscriptionPlan != null) {
return intl.format(subscriptionPlan.interval === SubscriptionIntervalTypes.MONTH ? t.P9eTKt : t.d8rUdy,
{skuName: sku.name, intervalCount: subscriptionPlan.intervalCount});
}
return intl.formatToPlainString(t.l6Ea4Z, {skuName: sku.name});
}
function firstLibraryApplicationForGiftCode(a0, {applicationId}, a2) { // fn#34295, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4300:8671, offset: 0x01051f17, size: 124 bytes, params: 4, frame: 15
let value = a0;
const env0_0 = a2;
let r0 = value.length > 0 ? value : [applicationId];
value = Reflect.apply(r0.map(function(a0) {
return importDefault.getLibraryApplication(applicationId, a0, true);
}).filter, value, [(require(1360) /* metro dependency 1360: GlobalUtils */).isNotNullish]);
r0 = value.length !== r0.length ? null : value[0];
return r0;
function _fun34296(a0) { // fn#34296, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4300:8772, offset: 0x01051f93, size: 31 bytes, params: 2, frame: 15
return importDefault.getLibraryApplication(applicationId, a0, true);
}
}
function processGiftCodeInput(a0) { // fn#34297, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4300:8901, offset: 0x01051fb2, size: 160 bytes, params: 2, frame: 17
var r1;
var replace;
var regExp;
let value = a0.trim();
value = value.split('/');
value = value.pop();
value = value.match(env0_16);
const value3 = null;
if (value3 == value) {
return value3;
}
value = Module00057(value, 3);
value[0];
value[1];
const property = value[2];
if (value3 == property) {
r1 = value3;
} else {
replace = property.replace;
regExp = new global.RegExp('-', 'g');
regExp = Reflect.apply(replace, property, [regExp, '']);
r1 = regExp;
}
return r1;
}
function useGetGiftCode(a0, a1) { // fn#34298, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4300:9103, offset: 0x01052052, size: 71 bytes, params: 3, frame: 14
const env0_0 = a0;
const env0_1 = a1;
return (FluxModule).useStateFromStores([PremiumPaymentModalStore], _fun34299);
function _fun34299() { // fn#34299, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4300:9172, offset: 0x01052099, size: 70 bytes, params: 1, frame: 12
var value3;
var giftCode;
const value2 = null;
if (value2 != env0_0) {
if (require) {
value3 = environment.__proto__;
giftCode = PremiumPaymentModalStore.getGiftCode(env0_0);
return value2 == giftCode || giftCode === '' ? value2 : giftCode;
}
}
return value2;
}
}
function trackStep({step, giftCode, customMessage, emojiName, soundId, productLine}) { // fn#34300, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4300:9274, offset: 0x010520df, size: 228 bytes, params: 2, frame: 25
var r9;
var intl;
const defaultImport = AnalyticsUtils;
const track = defaultImport.track;
const GIFT_ACCEPT_STEP = AnalyticEvents.GIFT_ACCEPT_STEP;
const object = {to_step: step};
object.has_custom_message = giftCode.giftStyle != null;
const value2 = giftCode.giftStyle != null;
if (value2) {
intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
r9 = customMessage !== intl.string((require(1244) /* metro dependency 1244: indexNative */).t.ZkOo1U);
} else {
r9 = value2;
}
object.is_custom_message_edited = r9;
object.gift_style = giftCode.giftStyle;
object.gift_code = giftCode.code;
object.emoji_name = emojiName;
object.sound_id = soundId;
object.product_line = productLine;
Reflect.apply(track, defaultImport, [GIFT_ACCEPT_STEP, object]);
}
}
function getGiftCodeURL() { // fn#34277, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4300:4858, offset: 0x010512ec, size: 143 bytes, params: 1, frame: 18
var r4;
var r5;
var host;
const value = a0;
const r6 = value !== undefined ? value : '';
const GLOBAL_ENV = global.window.GLOBAL_ENV;
const GIFT_CODE_HOST = GLOBAL_ENV.GIFT_CODE_HOST;
if (GIFT_CODE_HOST != null) {
r4 = '/' + r6;
r5 = GIFT_CODE_HOST;
} else {
host = global.location.host;
r4 = '/gifts/' + r6;
r5 = host;
}
return '' + global.location.protocol + '//' + r5 + r4;
}
global.__d(_fun34254, 4129, [5, 57, 4130, 1878, 661, 1880, 4100, 4140, 4141, 683, 3825, 4233, 1244, 4242, 1360, 566,
3802,
2]) /* metro module 4129, dependencies: [5, 57, 4130, 1878, 661, 1880, 4100, 4140, 4141, 683, 3825, 4233, 1244, 4242, 1360, 566, 3802, 2] */;