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

200 lines
12 KiB
TypeScript

/* Metro module 10465; source: modules/premium/native/gifting/PremiumGiftPurchaseSuccess.tsx; dependencies: [31, 27, 4279, 1880, 661, 33, 4501, 697, 7669, 1484, 7633, 4129, 10382, 9212, 4578, 1244, 3802, 6797, 3856, 7642, 4573, 8554, 4061, 2] */
import PremiumUtils from '../../../../utils/PremiumUtils.tsx'; /* Metro dependency 3802 */
import SKUStore from '../../../../stores/game_store/SKUStore.tsx'; /* Metro dependency 4279 */
import PremiumGiftBackgroundAnimationAndroid from './PremiumGiftBackgroundAnimation.android.tsx'; /* Metro dependency 7642 */
import * as FileImportTrackerModule from '../../../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as ReactNativeModule from '../../../../by-id/module-00027-ReactNative.js'; /* Metro dependency 27 */
import * as ReactModule from '../../../../by-id/module-00031-React.js'; /* Metro dependency 31 */
import * as JsxRuntimeModule from '../../../../by-id/module-00033-JsxRuntime.js'; /* Metro dependency 33 */
import * as ConstantsModule from '../../../../Constants.tsx'; /* Metro dependency 661 */
import * as IndexNativeModule from '../../../../intl/index.native.tsx'; /* Metro dependency 1244 */
import * as UseNavigationNativeModule from '../../../../design/components/Navigator/native/useNavigation.native.tsx'; /* Metro dependency 1484 */
import * as PremiumConstantsModule from '../../PremiumConstants.tsx'; /* Metro dependency 1880 */
import * as ToastUtilsModule from '../../../toast/native/ToastUtils.tsx'; /* Metro dependency 3856 */
import * as GiftCodeUtilsModule from '../../../../utils/GiftCodeUtils.tsx'; /* Metro dependency 4129 */
import * as TextModule from '../../../../design/components/Text/native/Text.tsx'; /* Metro dependency 4573 */
import * as ButtonNativeModule from '../../../../design/components/Button/native/Button.native.tsx'; /* Metro dependency 4578 */
import * as ClipboardUtilsNativeModule from '../../../../utils/ClipboardUtils.native.tsx'; /* Metro dependency 6797 */
import * as GiftingBadgeExperimentModule from '../../gifting/experiments/GiftingBadgeExperiment.tsx'; /* Metro dependency 7633 */
import * as NativeGiftContextModule from '../../../payments/native/NativeGiftContext.tsx'; /* Metro dependency 7669 */
import * as NativeModule from '../../../../design/components/experimental/native.tsx'; /* Metro dependency 8554 */
import * as ShowShareActionSheetAndroidModule from '../../../action_sheet/native/showShareActionSheet.android.tsx'; /* Metro dependency 9212 */
function _fun80988(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#80988, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10651:6, offset: 0x01e93720, size: 473 bytes, params: 8, frame: 23
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
let value = JsxRuntimeModule;
const env0_8 = value.jsx;
const env0_9 = value.Fragment;
const env0_10 = value.jsxs;
value = require(4501) /* metro dependency 4501: createStyles */;
const createStyles = value.createStyles;
object = {};
const object2 = {};
let PX_4 = (importDefault(697) /* metro dependency 697: native */).space.PX_4;
object2.marginTop = PX_4;
const PX_16 = (importDefault(697) /* metro dependency 697: native */).space.PX_16;
object2.marginBottom = PX_16;
object.disclaimer = object2;
let PX_24 = (importDefault(697) /* metro dependency 697: native */).space.PX_24;
object.title = {marginTop: PX_24, textAlign: 'center'};
const PX_8 = (importDefault(697) /* metro dependency 697: native */).space.PX_8;
object.description = {marginTop: PX_8, textAlign: 'center'};
PX_24 = (importDefault(697) /* metro dependency 697: native */).space.PX_24;
object.input = {marginTop: PX_24};
PX_4 = (importDefault(697) /* metro dependency 697: native */).space.PX_4;
object.inputLabel = {marginBottom: PX_4};
const env0_11 = Reflect.apply(createStyles, value, [object]);
(FileImportTrackerModule).fileFinishedImporting('modules/premium/native/gifting/PremiumGiftPurchaseSuccess.tsx');
exports.default = PremiumGiftSuccessBody;
exports.PremiumGiftSuccessActions = PremiumGiftSuccessActions;
function PremiumGiftSuccessBody({giftCodeRecord}) { // fn#80989, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10651:644, offset: 0x01e938f9, size: 916 bytes, params: 2, frame: 31
const styles = useStyles();
let {premiumType, planInterval,
giftStyle} = (NativeGiftContextModule).useNativeGiftContext();
const giftCodeURL = (GiftCodeUtilsModule).getGiftCodeURL(giftCodeRecord.code);
giftStyle = giftCodeRecord.giftStyle ?? giftStyle;
const r4 = giftCodeRecord.subscriptionPlanId ?? (require(3802) /* metro dependency 3802: PremiumUtils */).getPlanIdForPremiumType(premiumType,
planInterval);
const tierDisplayNameByPlanId = (PremiumUtils).getTierDisplayNameByPlanId(r4);
const defaultImport2 = PremiumUtils;
const getInterval = defaultImport2.getInterval;
const intervalType = Reflect.apply(getInterval, defaultImport2, [r4]).intervalType;
const YEAR = SubscriptionIntervalTypes.YEAR;
const value6 = ReactModule.useCallback(_fun80990, [giftCodeRecord, giftCodeURL]);
const jsxRuntimeEnv0_9Binding = jsxRuntimeEnv0_9;
const items2 = [
<View>
{((Component) => <Component giftStyle={giftStyle} />)(PremiumGiftBackgroundAnimationAndroid)}
</View>,
];
const Text = (TextModule).Text;
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
let string = intl.string;
items2[1] = (
<Text style={styles.title} variant="heading-lg/bold">
{Reflect.apply(string, intl, [(require(1244) /* metro dependency 1244: indexNative */).t['/s1xR7']])}
</Text>
);
items2[2] = (
<Text style={styles.description} variant="text-md/medium">
{intl.format(intervalType === YEAR ? (require(1244) /* metro dependency 1244: indexNative */).t.rli5ey : (require(1244) /* metro dependency 1244: indexNative */).t.bUdTqI,
{intervalCount: 1, name: tierDisplayNameByPlanId})}
</Text>
);
const text = (
<Text style={styles.inputLabel} variant="heading-md/bold">
{intl.string((require(1244) /* metro dependency 1244: indexNative */).t['qS+yMo'])}
</Text>
);
const InputButton = (NativeModule).InputButton;
items2[3] = (
<View style={styles.input}>
{text}
<InputButton
text={giftCodeURL}
icon={importDefault(4061) /* metro dependency 4061 */}
iconPosition="end"
onPress={value6}
/>
</View>
);
string = intl.string;
const As9eLl = (require(1244) /* metro dependency 1244: indexNative */).t.As9eLl;
items2[4] = (
<Text style={styles.disclaimer} variant="text-xs/normal">
{Reflect.apply(string, intl, [As9eLl])}
</Text>
);
return (
<>
{items2}
</>
);
function _fun80990() { // fn#80990, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10651:1048, offset: 0x01e93c8d, size: 134 bytes, params: 1, frame: 15
var moduleValue;
const value = environment.__proto__;
const value3 = SKUStore.get(giftCodeRecord.skuId);
if (value3 != null) {
moduleValue = require(4129) /* metro dependency 4129: GiftCodeUtils */;
moduleValue.trackGiftCodeCopy(giftCodeRecord, value3);
}
(ClipboardUtilsNativeModule).copy(env0_1);
(ToastUtilsModule).presentCopiedToClipboard();
}
}
function PremiumGiftSuccessActions({giftCodeRecord}) { // fn#80991, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10651:1878, offset: 0x01e93d13, size: 460 bytes, params: 2, frame: 25
const {onClose,
prePurchaseGiftingBadgeProgress} = (NativeGiftContextModule).useNativeGiftContext();
const value3 = (UseNavigationNativeModule).useNavigation();
const GiftingBadgeExperiment = (GiftingBadgeExperimentModule).GiftingBadgeExperiment;
const useConfig = GiftingBadgeExperiment.useConfig;
const enabled = Reflect.apply(useConfig, GiftingBadgeExperiment, [{location: 'PremiumGiftSuccessActions'}]).enabled;
const enabled2 = enabled;
const giftCodeURL = (GiftCodeUtilsModule).getGiftCodeURL(giftCodeRecord.code);
const binding = enabled2;
const value5 = binding.useCallback(_fun80992, [enabled, prePurchaseGiftingBadgeProgress, value3, onClose]);
const value6 = binding.useCallback(_fun80993, [giftCodeURL, enabled, prePurchaseGiftingBadgeProgress, value3]);
const jsxRuntimeEnv0_9Binding = jsxRuntimeEnv0_9;
const Button = (ButtonNativeModule).Button;
const intl = (IndexNativeModule).intl;
const string = intl.string;
const RDE0Sc = (IndexNativeModule).t.RDE0Sc;
return (
<>
<Button
variant="primary"
text={Reflect.apply(string, intl, [RDE0Sc])}
onPress={value6}
/>
<Button
variant="secondary"
text={intl.string((IndexNativeModule).t.cpT0Cq)}
onPress={value5}
/>
</>
);
function _fun80992() { // fn#80992, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10651:2187, offset: 0x01e93edf, size: 100 bytes, params: 1, frame: 15
var binding;
var navigate;
var value2;
if (enabled) {
if (prePurchaseGiftingBadgeProgress != null) {
binding = env0_2;
navigate = binding.navigate;
value2 = environment.__proto__;
Reflect.apply(navigate, binding,
[(require(10382) /* metro dependency 10382: PremiumGiftModal */).PremiumGiftScreens.GIFTING_BADGE,
{currentProgress: prePurchaseGiftingBadgeProgress}]);
} else {
onClose();
}
} else {
onClose();
}
}
function _fun80993() { // fn#80993, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10651:2311, offset: 0x01e93f43, size: 141 bytes, params: 1, frame: 16
var binding;
const showShareActionSheet = ShowShareActionSheetAndroidModule.showShareActionSheet;
const PREMIUM_GIFT_SUCCESS_MODAL = AnalyticsSections.PREMIUM_GIFT_SUCCESS_MODAL;
Reflect.apply(showShareActionSheet, ShowShareActionSheetAndroidModule, [{url: ReactNativeModule.View}, PREMIUM_GIFT_SUCCESS_MODAL]);
if (enabled && prePurchaseGiftingBadgeProgress != null) {
binding = env0_2;
binding.navigate((require(10382) /* metro dependency 10382: PremiumGiftModal */).PremiumGiftScreens.GIFTING_BADGE,
{currentProgress: prePurchaseGiftingBadgeProgress});
}
}
}
}
global.__d(_fun80988, 10465, [31, 27, 4279, 1880, 661, 33, 4501, 697, 7669, 1484, 7633, 4129, 10382, 9212, 4578,
1244, 3802, 6797, 3856, 7642, 4573, 8554, 4061,
2]) /* metro module 10465, dependencies: [31, 27, 4279, 1880, 661, 33, 4501, 697, 7669, 1484, 7633, 4129, 10382, 9212, 4578, 1244, 3802, 6797, 3856, 7642, 4573, 8554, 4061, 2] */;