Files
discord-decomp/sources/modules/user_profile/native/EditCollectiblesCTAButton.tsx
T
2026-07-27 16:20:00 +03:00

184 lines
11 KiB
TypeScript

/* Metro module 8404; source: modules/user_profile/native/EditCollectiblesCTAButton.tsx; dependencies: [31, 4502, 663, 1580, 33, 4501, 1585, 566, 8405, 4017, 4577, 3802, 5134, 1244, 4081, 8406, 5120, 4080, 4578, 2] */
function _fun66794(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#66794, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8589:6, offset: 0x01c09e08, size: 326 bytes, params: 8, frame: 20
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
let value = importAll(31) /* metro dependency 31 */;
const accessibilityStore = importDefault(4502) /* metro dependency 4502: AccessibilityStore */;
const env0_5 = (require(663) /* metro dependency 663: CollectiblesShopConstants */).CollectiblesMobileShopScreen;
const env0_6 = (require(1580) /* metro dependency 1580: MediaKeyboardConstants */).MEDIA_PICKER_SEND_BUTTON_SPRING;
const env0_7 = (require(33) /* metro dependency 33 */).jsx;
const env0_8 = (require(4501) /* metro dependency 4501: createStyles */).createStyles({buttonRowContainer: {'flexGrow': 0,
'flexDirection': 'row', 'justifyContent': 'flex-end', 'paddingHorizontal': 12, 'height': 48},
buttonContainer: {'position': 'absolute', 'bottom': 0, 'left': 0, 'right': 0, 'marginLeft': 24,
'marginRight': 24, 'flexDirection': 'column', 'justifyContent': 'flex-end'}});
object = {code: 'function EditCollectiblesCTAButtonTsx1(){const{shouldShowButton,APPLY_BUTTON_BOUNCE_DISTANCE,APPLY_BUTTON_SCALE_TRANSITION,reducedMotion,withSpring,MEDIA_PICKER_SEND_BUTTON_SPRING}=this.__closure;const targetTranslateY=shouldShowButton.get()?0:APPLY_BUTTON_BOUNCE_DISTANCE;const targetScale=shouldShowButton.get()?1:APPLY_BUTTON_SCALE_TRANSITION;return{transform:[{translateY:reducedMotion?targetTranslateY:withSpring(targetTranslateY,MEDIA_PICKER_SEND_BUTTON_SPRING)},{scale:reducedMotion?targetScale:withSpring(targetScale,MEDIA_PICKER_SEND_BUTTON_SPRING)}]};}'};
object = {code: "function EditCollectiblesCTAButtonTsx2(){const{shouldShowButton}=this.__closure;return{pointerEvents:shouldShowButton.get()?'box-none':'none'};}"};
object = {code: 'function EditCollectiblesCTAButtonTsx3(){const{shouldShowButton,reducedMotion,withSpring,MEDIA_PICKER_SEND_BUTTON_SPRING}=this.__closure;const targetOpacity=shouldShowButton.get()?1:0;return{opacity:reducedMotion?targetOpacity:withSpring(targetOpacity,{...MEDIA_PICKER_SEND_BUTTON_SPRING,overshootClamping:true})};}'};
value = value.memo(_fun66795);
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/user_profile/native/EditCollectiblesCTAButton.tsx');
exports.default = value;
}
function _fun66795({user, currentSkuId, selectedSkuId, isTryItOut, onApply, analyticsLocations, analyticsSource}) { // fn#66795, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8589:1553, offset: 0x01c09f4e, size: 995 bytes, params: 2, frame: 36
var object2;
const env0_3 = onApply;
const styles = useStyles();
const bottom = (importDefault(1585) /* metro dependency 1585: useSafeAreaInsetsNative */)().bottom;
const useReducedMotion = (require(566) /* metro dependency 566: flux */).useStateFromStores([AccessibilityStore],
function() {
return AccessibilityStore.useReducedMotion;
});
const {product, purchase} = (importDefault(8405) /* metro dependency 8405: useCollectiblesData */)(selectedSkuId);
const value3 = (require(4017) /* metro dependency 4017: ReanimatedRexport */).useSharedValue(false);
let binding = env0_3;
binding.useEffect(_fun66797, [selectedSkuId, currentSkuId, value3]);
const reanimatedRexportModule = require(4017) /* metro dependency 4017: ReanimatedRexport */;
let useAnimatedStyle = reanimatedRexportModule.useAnimatedStyle;
let closure = O_66798;
object2 = {'shouldShowButton': null, 'APPLY_BUTTON_BOUNCE_DISTANCE': 60, 'APPLY_BUTTON_SCALE_TRANSITION': 0.9};
object2.shouldShowButton = value3;
object2.reducedMotion = useReducedMotion;
object2.withSpring = (require(4577) /* metro dependency 4577: spring */).withSpring;
object2.MEDIA_PICKER_SEND_BUTTON_SPRING = MEDIA_PICKER_SEND_BUTTON_SPRING;
closure.__closure = object2;
closure.__workletHash = 15594859424201;
closure.__initData = undefined;
const value4 = Reflect.apply(useAnimatedStyle, reanimatedRexportModule, [closure]);
const moduleValue4 = reanimatedRexportModule;
const useAnimatedProps = moduleValue4.useAnimatedProps;
closure = M_66799;
closure.__closure = {shouldShowButton: value3};
closure.__workletHash = 16151141699021;
closure.__initData = env0_10;
const value5 = Reflect.apply(useAnimatedProps, moduleValue4, [closure]);
const moduleValue5 = reanimatedRexportModule;
useAnimatedStyle = moduleValue5.useAnimatedStyle;
closure = R_66800;
object2 = {shouldShowButton: value3, reducedMotion: useReducedMotion};
object2.withSpring = (require(4577) /* metro dependency 4577: spring */).withSpring;
object2.MEDIA_PICKER_SEND_BUTTON_SPRING = MEDIA_PICKER_SEND_BUTTON_SPRING;
closure.__closure = object2;
closure.__workletHash = 13351061137085;
closure.__initData = env0_11;
const value6 = Reflect.apply(useAnimatedStyle, moduleValue5, [closure]);
const canUseCollectibles2 = (importDefault(3802) /* metro dependency 3802: PremiumUtils */).canUseCollectibles(user);
let r11 = (require(5134) /* metro dependency 5134: CollectiblesUtils */).isPremiumCollectiblesProduct(product) || (require(5134) /* metro dependency 5134: CollectiblesUtils */).isPremiumCollectiblesPurchase(purchase);
const value7 = !canUseCollectibles2;
let r18 = selectedSkuId == null || purchase != null && !(canUseCollectibles2 ? value7 : (require(5134) /* metro dependency 5134: CollectiblesUtils */).isPremiumCollectiblesPurchase(purchase));
r18 = !r18 ? r11 && isTryItOut : r18;
r11 = r11 && value7 && !isTryItOut;
binding = env0_3;
const value12 = binding.useMemo(_fun66801, [r18, r11, user]);
const value13 = binding.useCallback(_fun66802, [r18, onApply, r11, analyticsLocations, analyticsSource,
selectedSkuId]);
const View = (importDefault(4017) /* metro dependency 4017: ReanimatedRexport */).View;
const items3 = [styles.buttonContainer, value6];
const View2 = (importDefault(4017) /* metro dependency 4017: ReanimatedRexport */).View;
const items2 = [styles.buttonRowContainer, value4];
items2[2] = {marginBottom: bottom};
const Button = (require(4578) /* metro dependency 4578: ButtonNative */).Button;
return (
<View style={items3} animatedProps={value5}>
<View2 style={items2} pointerEvents="box-none">
<Button
variant={r11 ? 'active' : 'primary'}
onPress={value13}
size="md"
text={value12}
grow
/>
</View2>
</View>
);
}
function _fun66797() { // fn#66797, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8589:1833, offset: 0x01c0a331, size: 33 bytes, params: 1, frame: 12
const binding = env0_7;
binding.set(selectedSkuId !== currentSkuId);
}
function O_66798() { // fn#66798, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8589:1903, offset: 0x01c0a352, size: 187 bytes, params: 1, frame: 19
var r3;
var value;
const r8 = env0_7.get() ? 0 : 60;
const r7 = env0_7.get() ? 1 : 0.9;
const items2 = [{translateY: useReducedMotion ? r8 : (require(4577) /* metro dependency 4577: spring */).withSpring(r8,
MEDIA_PICKER_SEND_BUTTON_SPRING)}];
if (useReducedMotion) {
r3 = r7;
} else {
value = environment.__proto__;
value = (require(4577) /* metro dependency 4577: spring */).withSpring(r7, MEDIA_PICKER_SEND_BUTTON_SPRING);
r3 = value;
}
items2[1] = {scale: r3};
return {transform: items2};
}
function M_66799() { // fn#66799, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8589:2306, offset: 0x01c0a40d, size: 38 bytes, params: 1, frame: 10
const object2 = {};
object2.pointerEvents = env0_7.get() ? 'box-none' : 'none';
return object2;
}
function R_66800() { // fn#66800, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8589:2478, offset: 0x01c0a433, size: 102 bytes, params: 1, frame: 17
var r1;
var moduleValue;
var withSpring;
var object;
var value;
const r5 = env0_7.get() ? 1 : 0;
if (useReducedMotion) {
r1 = r5;
} else {
value = environment.__proto__;
moduleValue = require(4577) /* metro dependency 4577: spring */;
withSpring = moduleValue.withSpring;
object = {};
copyDataProperties(object, MEDIA_PICKER_SEND_BUTTON_SPRING, undefined);
object['overshootClamping'] = true;
value = Reflect.apply(withSpring, moduleValue, [r5, object]);
r1 = value;
}
return {opacity: r1};
}
function _fun66801() { // fn#66801, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8589:2962, offset: 0x01c0a499, size: 258 bytes, params: 1, frame: 17
var r0;
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
var string;
const t = (require(1244) /* metro dependency 1244: indexNative */).t;
var defaultImport;
var value;
if (env0_8) {
r0 = intl.string(t.Jh8fJz);
} else if (env0_9) {
defaultImport = importDefault(3802) /* metro dependency 3802: PremiumUtils */;
value = defaultImport.isPremium(user);
string = intl.string;
r0 = value ? Reflect.apply(string, intl, [t.KXLX7l]) : Reflect.apply(string, intl, [t.mr4K7D]);
} else {
r0 = intl.string(t.fYfGgK);
}
return r0;
}
function _fun66802() { // fn#66802, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8589:3179, offset: 0x01c0a59b, size: 221 bytes, params: 1, frame: 16
var moduleValue2;
if (env0_8) {
moduleValue2 = require(4081) /* metro dependency 4081: HapticUtilsNative */;
moduleValue2.triggerHapticFeedback((require(4081) /* metro dependency 4081: HapticUtilsNative */).HapticFeedbackTypes.IMPACT_MEDIUM);
onApply();
} else if (env0_9) {
(require(8406) /* metro dependency 8406: EditCollectiblesActionCreators */).navigateToNitroManagement();
} else {
(require(5120) /* metro dependency 5120: CollectiblesActionCreators */).openCollectiblesShopMobile({analyticsLocations: analyticsLocations,
analyticsSource: analyticsSource, initialProductSkuId: selectedSkuId,
screen: CollectiblesMobileShopScreen.SHOP_ALL});
}
(importDefault(4080) /* metro dependency 4080: ActionSheetActionCreators */).hideActionSheet();
}