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

310 lines
16 KiB
TypeScript

/* Metro module 15699; source: modules/feedback/native/FeedbackActionSheetV2.tsx; dependencies: [57, 31, 27, 9906, 33, 4501, 697, 4080, 22, 6266, 4594, 5080, 9928, 1962, 1244, 4573, 9910, 8950, 6231, 6238, 4578, 1585, 6275, 6758, 6806, 6277, 2] */
function _fun120503(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#120503, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15907:6, offset: 0x0252cf71, size: 347 bytes, params: 8, frame: 22
var object2;
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_3 = importDefault(57) /* metro dependency 57 */;
const env0_4 = importAll(31) /* metro dependency 31 */;
const env0_5 = (require(27) /* metro dependency 27 */).View;
const env0_6 = (require(9906) /* metro dependency 9906: Constants */).FeedbackRating;
let value = require(33) /* metro dependency 33 */;
const env0_7 = value.jsx;
const env0_8 = value.Fragment;
const env0_9 = value.jsxs;
value = require(4501) /* metro dependency 4501: createStyles */;
const createStyles = value.createStyles;
object2 = {};
let PX_16 = (importDefault(697) /* metro dependency 697: native */).space.PX_16;
object2.container = {padding: PX_16};
object2.ratingsBody = {textAlign: 'center'};
PX_16 = (importDefault(697) /* metro dependency 697: native */).space.PX_16;
object2.problemsList = {marginBottom: PX_16};
const env0_10 = Reflect.apply(createStyles, value, [object2]);
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/feedback/native/FeedbackActionSheetV2.tsx');
exports.default = FeedbackActionSheetV2;
}
function shuffleOptionsTree(a0) { // fn#120505, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15907:425, offset: 0x0252d0cc, size: 60 bytes, params: 2, frame: 13
const value = importDefault(22) /* metro dependency 22 */;
return value.shuffle(a0.map(_fun120506));
}
function FeedbackActionSheetV2({headerLabel, ratingBody, ratingOptions, showHeaderCloseButton, hideDontShowAgainCheckbox, categoriesHeader, initialRating, optionsTree, onMount, trackOpen, trackReport}) { // fn#120507, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15907:663, offset: 0x0252d166, size: 1737 bytes, params: 2, frame: 43
var r7;
var r16;
var r13;
var problemsHeader;
var jsxRuntimeEnv0_8Binding;
var items4;
const Button = (require(4578) /* metro dependency 4578: ButtonNative */).Button;
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
var items2;
var items3;
var TableCheckboxRow;
initialRating = initialRating === undefined ? null : initialRating;
let env0_4 = undefined;
const styles = useStyles();
let binding = env0_4;
const value5 = binding.useRef(null);
env0_4 = value5;
const value6 = (importDefault(6266) /* metro dependency 6266: usePrevious */)(optionsTree);
let useState = binding.useState;
const value7 = Reflect.apply(useState, binding, [shuffleOptionsTree(optionsTree)]);
const binding2 = trackReport;
const value8 = binding2(value7, 2);
const property = value8[0];
const env0_7 = value8[1];
binding.useEffect(_fun120508, [optionsTree, value6]);
useState = binding.useState;
const value10 = binding2(Reflect.apply(useState, binding, [false]), 2);
const property2 = value10[0];
const env0_9 = value10[1];
useState = binding.useState;
const value11 = binding2(Reflect.apply(useState, binding, [initialRating]), 2);
const property3 = value11[0];
const env0_11 = value11[1];
const value12 = binding.useState(property.length !== 1 ? null : property[0]);
binding = trackReport;
const value13 = binding(value12, 2);
const property5 = value13[0];
const env0_13 = value13[1];
const binding3 = env0_4;
useState = binding3.useState;
const value14 = binding(Reflect.apply(useState, binding3, [null]), 2);
const property6 = value14[0];
const env0_15 = value14[1];
useState = binding3.useState;
const value15 = binding(Reflect.apply(useState, binding3, [false]), 2);
const env0_16 = value15[0];
const env0_17 = value15[1];
(importDefault(4594) /* metro dependency 4594: useMountEffect */)(function() {
if (onMount != null) {
onMount();
}
trackOpen();
});
(require(4594) /* metro dependency 4594: useMountEffect */).useUnmountEffect(_fun120510);
const value16 = binding3.useCallback(_fun120512, []);
const env0_18 = binding3.useCallback(_fun120513, []);
const env0_19 = binding3.useCallback(_fun120514, [property5]);
if (property3 == null) {
jsxRuntimeEnv0_8Binding = jsxRuntimeEnv0_8;
if (ratingBody != null) {
const Text = (require(4573) /* metro dependency 4573: Text */).Text;
r16 = <Text style={styles.ratingsBody} variant="text-md/medium" color="text-default">{ratingBody}</Text>;
} else {
r16 = null;
}
items3 = [r16];
items3[1] = ((Component) => <Component ratingOptions={ratingOptions} selectedRating={property3} onChangeRating={value16} />)(importDefault(9910) /* metro dependency 9910: RatingSelector */);
if (hideDontShowAgainCheckbox) {
r16 = null;
} else {
TableCheckboxRow = (require(8950) /* metro dependency 8950: TableCheckboxRowNative */).TableCheckboxRow;
r16 = <TableCheckboxRow start end checked={property2} label={intl.string((require(1244) /* metro dependency 1244: indexNative */).t['5E9SB9'])} onPress={onPress_120515} />;
}
items3[2] = r16;
r7 = <>{items3}</>;
r13 = headerLabel;
} else if (property3 === FeedbackRating.GOOD) {
if (property5 != null && property6 == null) {
problemsHeader = property5.problemsHeader;
jsxRuntimeEnv0_8Binding = jsxRuntimeEnv0_8;
items4 = [<View style={styles.problemsList}>{((TableRowGroup) => <TableRowGroup hasIcons={false}>{property5.problemOptions.map(_fun120519)}</TableRowGroup>)((require(6231) /* metro dependency 6231: TableRowGroupNative */).TableRowGroup)}</View>];
items4[1] = <Button variant="secondary" size="sm" text={intl.string((require(1244) /* metro dependency 1244: indexNative */).t['13/7kX'])} onPress={onPress_120521} />;
r7 = <>{items4}</>;
r13 = problemsHeader;
} else {
r7 = undefined;
r13 = headerLabel;
}
} else if (property5 == null) {
jsxRuntimeEnv0_8Binding = jsxRuntimeEnv0_8;
items2 = [<View style={styles.problemsList}>{((TableRowGroup) => <TableRowGroup hasIcons={false}>{property.map(_fun120516)}</TableRowGroup>)((require(6231) /* metro dependency 6231: TableRowGroupNative */).TableRowGroup)}</View>];
items2[1] = <Button variant="secondary" size="sm" text={intl.string((require(1244) /* metro dependency 1244: indexNative */).t['13/7kX'])} onPress={onPress_120518} />;
r7 = <>{items2}</>;
r13 = categoriesHeader;
} else if (property5 != null && property6 == null) {
problemsHeader = property5.problemsHeader;
jsxRuntimeEnv0_8Binding = jsxRuntimeEnv0_8;
items4 = [<View style={styles.problemsList}>{((TableRowGroup) => <TableRowGroup hasIcons={false}>{property5.problemOptions.map(_fun120519)}</TableRowGroup>)((require(6231) /* metro dependency 6231: TableRowGroupNative */).TableRowGroup)}</View>];
items4[1] = <Button variant="secondary" size="sm" text={intl.string((require(1244) /* metro dependency 1244: indexNative */).t['13/7kX'])} onPress={onPress_120521} />;
r7 = <>{items4}</>;
r13 = problemsHeader;
} else {
r7 = undefined;
r13 = headerLabel;
}
const bottom = (importDefault(1585) /* metro dependency 1585: useSafeAreaInsetsNative */)().bottom;
const value27 = 232 + (hideDontShowAgainCheckbox ? 0 : 48) + bottom;
const BottomSheet = (require(6275) /* metro dependency 6275: BottomSheetNative */).BottomSheet;
const bottomSheetProps = {scrollable: true, ref: value5, startHeight: value27,
maxHeight: property3 == null ? value27 : undefined};
const BottomSheetTitleHeader = (require(6758) /* metro dependency 6758: BottomSheetTitleHeaderNative */).BottomSheetTitleHeader;
bottomSheetProps.header = <BottomSheetTitleHeader title={r13} trailing={showHeaderCloseButton ? ((ActionSheetCloseButton) => <ActionSheetCloseButton onPress={closeActionSheet_120504} />)((require(6806) /* metro dependency 6806: ActionSheetCloseButtonNative */).ActionSheetCloseButton) : null} />;
const BottomSheetScrollView = (require(6277) /* metro dependency 6277 */).BottomSheetScrollView;
return (
<BottomSheet {...bottomSheetProps}>
<BottomSheetScrollView
contentContainerStyle={[styles.container, {paddingBottom: styles.container.padding + bottom}]}
>
{r7}
</BottomSheetScrollView>
</BottomSheet>
);
}
function _fun120506(a0) { // fn#120506, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15907:452, offset: 0x0252d108, size: 94 bytes, params: 2, frame: 14
const object2 = {};
copyDataProperties(object2, a0, undefined);
let value = environment.__proto__;
value = Reflect.apply((importDefault(22) /* metro dependency 22 */).shuffle, value, [a0.problemOptions]);
value = value.concat(a0.freeformConfig ?? []);
object2['problemOptions'] = value;
return object2;
}
function _fun120508() { // fn#120508, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15907:995, offset: 0x0252d82f, size: 75 bytes, params: 1, frame: 16
const defaultImport = importDefault(22) /* metro dependency 22 */;
if (!defaultImport.isEqual(env0_5, optionsTree)) {
env0_7(shuffleOptionsTree(optionsTree));
}
}
function _fun120510() { // fn#120510, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15907:1345, offset: 0x0252d89d, size: 388 bytes, params: 1, frame: 21
var environment;
var r4;
var trackReportBinding;
var object2;
var value2;
var value5;
var value6;
var defaultImport;
var pushLazy;
var value7;
var intl;
if (env0_16) {
value5 = environment.__proto__;
value6 = undefined;
defaultImport = importDefault(dependencyMap[11]);
pushLazy = defaultImport.pushLazy;
value7 = require(dependencyMap[13])(dependencyMap[12], dependencyMap.paths);
object2 = {};
object2.result = {rating: env0_10, category: env0_12 == null ? value6 : env0_12.value, reason: env0_14,
dontShowAgain: env0_8};
object2.trackReport = trackReport;
object2.titleLabel = env0_12 == null ? value6 : env0_12.problemsHeader;
intl = require(dependencyMap[14]).intl;
object2.descriptionLabel = intl.string(require(dependencyMap[14]).t.h95hcn);
object2.hideHelpdeskLink = env0_12 == null || env0_12.freeformConfig == null ? value6 : env0_12.freeformConfig.hideHelpdeskLink;
Reflect.apply(pushLazy, defaultImport, [value7, object2]);
} else {
trackReportBinding = trackReport;
value2 = null;
r4 = value2 == env0_12 ? undefined : env0_12.value;
trackReportBinding({rating: env0_10, category: value2 != r4 ? r4 : value2, reason: env0_14,
dontShowAgain: env0_8,
feedback: ''});
}
}
function _fun120512(a0) { // fn#120512, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15907:1931, offset: 0x0252da7b, size: 102 bytes, params: 2, frame: 13
var current;
env0_11(a0);
const GOOD = FeedbackRating.GOOD;
if (a0 === GOOD) {
env0_13(null);
env0_15(null);
env0_17(false);
closeActionSheet_120504();
} else {
current = env0_4.current;
if (current != null) {
current.expandActionSheet();
}
}
}
function _fun120513(a0) { // fn#120513, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15907:2069, offset: 0x0252dae1, size: 53 bytes, params: 2, frame: 12
env0_13(a0);
env0_15(null);
const current = env0_4.current;
if (current != null) {
current.expandActionSheet();
}
}
function _fun120514(a0) { // fn#120514, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15907:2159, offset: 0x0252db16, size: 101 bytes, params: 2, frame: 14
var freeformConfig;
const value2 = undefined;
env0_15(a0);
if (env0_12 == null) {
env0_17(false);
} else if (a0 == null) {
env0_17(false);
} else {
freeformConfig = env0_12.freeformConfig;
if ((freeformConfig == null ? value2 : freeformConfig.value) === a0.value) {
env0_17(true);
} else {
env0_17(false);
}
}
closeActionSheet_120504();
return value2;
}
function FeedbackActionSheetV2OnPress() { // fn#120515, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15907:2607, owner: FeedbackActionSheetV2.onPress, offset: 0x0252db7b, size: 23 bytes, params: 1, frame: 11
return env0_9(!env0_8);
}
function _fun120516(a0, a1) { // fn#120516, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15907:2754, offset: 0x0252db92, size: 86 bytes, params: 3, frame: 16
const env0_0 = a0;
const TableRow = (require(6238) /* metro dependency 6238: TableRowNative */).TableRow;
return (
<TableRow
label={a0.label}
labelLineClamp={2}
onPress={onPress_120517}
key={a1}
/>
);
}
function FeedbackActionSheetV2OnPress_120518() { // fn#120518, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15907:2946, owner: FeedbackActionSheetV2.onPress, offset: 0x0252dbff, size: 18 bytes, params: 1, frame: 11
return env0_11(null);
}
function _fun120519(a0, a1) { // fn#120519, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15907:3124, offset: 0x0252dc11, size: 86 bytes, params: 3, frame: 16
const env0_0 = a0;
const TableRow = (require(6238) /* metro dependency 6238: TableRowNative */).TableRow;
return (
<TableRow
label={a0.label}
labelLineClamp={2}
onPress={onPress_120520}
key={a1}
/>
);
}
function FeedbackActionSheetV2OnPress_120521() { // fn#120521, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15907:3316, owner: FeedbackActionSheetV2.onPress, offset: 0x0252dc7e, size: 49 bytes, params: 1, frame: 12
return env0_6.length === 1 ? env0_11(null) : env0_13(null);
}
function trackReport({rating, category, reason, dontShowAgain, feedback}) { // fn#120511, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15907:1491, offset: 0x0252da21, size: 90 bytes, params: 2, frame: 13
const value = environment.__proto__;
trackReport({rating: rating, category: category, reason: reason, dontShowAgain: dontShowAgain,
feedback: feedback ?? ''});
}
function onPress_120517() { // fn#120517, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15907:2821, offset: 0x0252dbe8, size: 23 bytes, params: 1, frame: 11
return env1_18(env0_0);
}
function onPress_120520() { // fn#120520, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15907:3191, offset: 0x0252dc67, size: 23 bytes, params: 1, frame: 11
return env1_19(env0_0);
}