Files
discord-decomp/sources/modules/premium/native/gifting/PremiumGiftingPromotionSuccessActions.tsx
T
2026-07-28 01:06:53 +03:00

151 lines
9.1 KiB
TypeScript

/* Metro module 10467; source: modules/premium/native/gifting/PremiumGiftingPromotionSuccessActions.tsx; dependencies: [31, 27, 5126, 1902, 1878, 33, 4501, 697, 566, 7669, 1484, 7633, 8461, 10382, 7589, 8483, 1901, 1305, 10462, 4578, 1244, 2] */
import UserStore from '../../../../stores/UserStore.tsx'; /* Metro dependency 1878 */
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 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 NameplateRecordModule from '../../../collectibles/records/NameplateRecord.tsx'; /* Metro dependency 1902 */
import * as ButtonNativeModule from '../../../../design/components/Button/native/Button.native.tsx'; /* Metro dependency 4578 */
import * as AvatarDecorationRecordModule from '../../../collectibles/records/AvatarDecorationRecord.tsx'; /* Metro dependency 5126 */
import * as GiftingBadgeExperimentModule from '../../gifting/experiments/GiftingBadgeExperiment.tsx'; /* Metro dependency 7633 */
import * as NativeGiftContextModule from '../../../payments/native/NativeGiftContext.tsx'; /* Metro dependency 7669 */
import * as UseFetchCollectiblesProductModule from '../../../collectibles/hooks/useFetchCollectiblesProduct.tsx'; /* Metro dependency 8461 */
function _fun80998(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#80998, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10653:6, offset: 0x01e943ac, size: 413 bytes, params: 8, frame: 22
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.jsxs;
value = require(4501) /* metro dependency 4501: createStyles */;
const createStyles = value.createStyles;
object = {};
const PX_16 = (importDefault(697) /* metro dependency 697: native */).space.PX_16;
object.container = {'flexDirection': 'column', 'alignItems': 'center', gap: PX_16};
const object3 = {'width': 234, 'height': 40, 'flexDirection': 'row', 'alignItems': 'center', 'position': 'relative',
'borderRadius': null, 'overflow': 'hidden'};
object3.borderRadius = (importDefault(697) /* metro dependency 697: native */).radii.sm;
object.nameplateContainer = object3;
const object4 = {'position': 'absolute', 'left': 0, 'right': 0, 'top': 0, 'bottom': 0, 'borderRadius': null,
'overflow': 'hidden'};
object4.borderRadius = (importDefault(697) /* metro dependency 697: native */).radii.sm;
object.nameplateWrapper = object4;
object.singleAvatarContainer = {'flexDirection': 'row', 'paddingRight': 15, 'justifyContent': 'center',
'alignItems': 'center', 'marginLeft': 5};
const env0_10 = Reflect.apply(createStyles, value, [object]);
(FileImportTrackerModule).fileFinishedImporting('modules/premium/native/gifting/PremiumGiftingPromotionSuccessActions.tsx');
exports.default = PremiumGiftingPromotionSuccessActions;
function PremiumGiftingPromotionSuccessActions({purchase}) { // fn#80999, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10653:826, offset: 0x01e94549, size: 820 bytes, params: 2, frame: 31
var r6;
var items2;
var Avatar;
const styles = useStyles();
const currentUser = (require(566) /* metro dependency 566: flux */).useStateFromStores([UserStore], function() {
return UserStore.getCurrentUser();
});
const {onClose,
prePurchaseGiftingBadgeProgress} = (NativeGiftContextModule).useNativeGiftContext();
const value4 = (UseNavigationNativeModule).useNavigation();
const GiftingBadgeExperiment = (GiftingBadgeExperimentModule).GiftingBadgeExperiment;
const useConfig = GiftingBadgeExperiment.useConfig;
const enabled = Reflect.apply(useConfig, GiftingBadgeExperiment,
[{location: 'PremiumGiftingPromotionSuccessActions'}]).enabled;
const enabled2 = enabled;
const {product,
isFetching} = (UseFetchCollectiblesProductModule).useFetchCollectiblesProduct(purchase.skuId);
const binding = enabled2;
const value7 = binding.useCallback(_fun81002, [product, onClose, binding.useCallback(_fun81001, [enabled,
prePurchaseGiftingBadgeProgress, value4]), enabled, prePurchaseGiftingBadgeProgress, value4]);
const property = purchase.items[0];
if (isNameplateRecord(property)) {
var viewBinding2Props = {style: styles.nameplateContainer};
items2 = [
<View style={styles.nameplateWrapper}>
{((Component) => <Component nameplate={(require(1901) /* metro dependency 1901: utils */).getNameplateData(property)} fullOpacity animate />)(importDefault(8483) /* metro dependency 8483: Nameplate */)}
</View>,
];
var viewBinding2Props3 = {style: styles.singleAvatarContainer};
Avatar = (require(1305) /* metro dependency 1305: native */).Avatar;
var avatarProps = {user: currentUser, guildId: undefined,
size: (require(1305) /* metro dependency 1305: native */).AvatarSizes.SMALL};
avatarProps['aria-hidden'] = true;
items2[1] = (
<View {...viewBinding2Props3}>
<Avatar {...avatarProps} />
</View>
);
r6 = (
<View {...viewBinding2Props}>
{items2}
</View>
);
} else {
r6 = (
isAvatarDecorationRecord(property)
? ((Component) => <Component size={(require(1305) /* metro dependency 1305: native */).AvatarSizes.LARGE} asset={property.asset} />)(importDefault(10462) /* metro dependency 10462: GiftingRewardPreviewAvatar */)
: undefined
);
}
const Button = (ButtonNativeModule).Button;
const intl = (IndexNativeModule).intl;
return (
<View style={styles.container}>
{r6}
<Button
grow
text={intl.string((IndexNativeModule).t.kMYVwv)}
loading={isFetching}
onPress={value7}
/>
</View>
);
function _fun81001() { // fn#81001, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10653:1260, offset: 0x01e9487d, size: 91 bytes, params: 1, frame: 15
var binding;
var navigate;
var value3;
if (enabled && prePurchaseGiftingBadgeProgress != null) {
binding = env0_2;
navigate = binding.navigate;
value3 = environment.__proto__;
Reflect.apply(navigate, binding,
[(require(10382) /* metro dependency 10382: PremiumGiftModal */).PremiumGiftScreens.GIFTING_BADGE,
{currentProgress: prePurchaseGiftingBadgeProgress}]);
}
}
function _fun81002() { // fn#81002, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10653:1379, offset: 0x01e948d8, size: 166 bytes, params: 1, frame: 15
var binding;
var navigate;
var value2;
var value3;
if (product != null) {
value3 = environment.__proto__;
(importDefault(7589) /* metro dependency 7589: ProductPurchaseSuccessActionCreators */).open({product: product,
onCancel: AvatarDecorationRecordModule.isAvatarDecorationRecord});
} else 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();
}
}
}
}
global.__d(_fun80998, 10467, [31, 27, 5126, 1902, 1878, 33, 4501, 697, 566, 7669, 1484, 7633, 8461, 10382, 7589,
8483, 1901, 1305, 10462, 4578, 1244,
2]) /* metro module 10467, dependencies: [31, 27, 5126, 1902, 1878, 33, 4501, 697, 566, 7669, 1484, 7633, 8461, 10382, 7589, 8483, 1901, 1305, 10462, 4578, 1244, 2] */;