decord/alpha/source/modules/feedback/native/FeedbackActionSheetV2.tsx
github-actions c6aa9eb120 chore: update source for alpha 349.3
Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/05xxx/module_5030.js (118.4 MB)
2026-10-01 06:55:13 +00:00

317 lines
11 KiB
TypeScript

// Module ID: 16551
// Function ID: 16552
// Name: FeedbackActionSheetV2
// Dependencies: [32, 19, 17, 11334, 21, 4845, 576, 4809, 12, 7902, 5482, 5048, 11356, 1981, 1115, 4841, 11338, 6102, 6185, 6103, 5465, 1613, 6757, 6756, 6805, 6231, 2]
// Exports: default
// Module 16551 (FeedbackActionSheetV2)
import _modDef12 from "module_12" /* 12 */;
import nativeDefault from "native" /* 576 */;
import util from "util" /* 1115 */;
import asyncRequireImpl from "asyncRequireImpl" /* 1981 */;
import ActionSheetActionCreatorsDefault from "ActionSheetActionCreators" /* 4809 */;
import ModalActionCreatorsDefault from "ModalActionCreators" /* 5048 */;
import useMountEffectDefault from "useMountEffect" /* 5482 */;
import usePreviousDefault from "usePrevious" /* 7902 */;
import _slicedToArray from "module_32" /* 32 */;
import noop from "module_19" /* 19 */;
require = fn;
function closeActionSheet() {
ActionSheetActionCreatorsDefault.hideActionSheet();
}
const View = fn(17).View;
const FeedbackRating = fn(11334).FeedbackRating;
const jsxProd = fn(21);
({ jsx: closure_7, Fragment: closure_8, jsxs: closure_9 } = jsxProd);
const createStyles = fn(4845);
let obj2 = { container: { padding: nativeDefault.space.PX_16 }, ratingsBody: { textAlign: "center" }, problemsList: null };
let obj3 = { padding: nativeDefault.space.PX_16 };
obj2.problemsList = { marginBottom: nativeDefault.space.PX_16 };
let closure_10 = createStyles.createStyles(obj2);
const size = fn(2);
const result = size.fileFinishedImporting("modules/feedback/native/FeedbackActionSheetV2.tsx");
export default function FeedbackActionSheetV2(optionsTree) {
({ headerLabel, ratingBody, hideDontShowAgainCheckbox, initialRating } = optionsTree);
({ ratingOptions, showHeaderCloseButton, categoriesHeader } = optionsTree);
if (initialRating === undefined) {
initialRating = null;
}
optionsTree = optionsTree.optionsTree;
({ onMount: importDefault, trackOpen: dependencyMap, trackReport: _slicedToArray } = optionsTree);
let ref;
first = undefined;
closure_7 = undefined;
first1 = undefined;
closure_9 = undefined;
first2 = undefined;
onPress = undefined;
first4 = undefined;
closure_13 = undefined;
first5 = undefined;
closure_15 = undefined;
c16 = undefined;
c17 = undefined;
closure_18 = undefined;
closure_19 = undefined;
let tmp = first2();
ref = ref.useRef(null);
const tmp5 = usePreviousDefault(optionsTree);
closure_5 = tmp5;
[first, closure_7] = ref.useState(_modDef12.shuffle(optionsTree.map((problemOptions) => {
const obj = {};
const merged = Object.assign(problemOptions);
const obj2 = closure_1_1(dependencyMap[8]);
let freeformConfig = problemOptions.freeformConfig;
if (freeformConfig == null) {
freeformConfig = [];
}
obj.problemOptions = closure_1_1(dependencyMap[8]).shuffle(problemOptions.problemOptions).concat(freeformConfig);
return obj;
})));
const items = [optionsTree, tmp5];
const effect = ref.useEffect(() => {
if (!obj.isEqual(closure_5, optionsTree)) {
closure_7(_modDef12.shuffle(optionsTree.map((problemOptions) => {
const obj = {};
const merged = Object.assign(problemOptions);
const obj2 = closure_1_1(dependencyMap[8]);
let freeformConfig = problemOptions.freeformConfig;
if (freeformConfig == null) {
freeformConfig = [];
}
obj.problemOptions = closure_1_1(dependencyMap[8]).shuffle(problemOptions.problemOptions).concat(freeformConfig);
return obj;
})));
const tmpResult = _modDef12;
}
}, items);
[first1, closure_9] = ref.useState(false);
[first2, onPress] = ref.useState(initialRating);
let first3 = null;
if (1 === first.length) {
first3 = first[0];
}
[first4, closure_13] = ref.useState(first3);
[first5, closure_15] = ref.useState(null);
[c16, c17] = ref.useState(false);
useMountEffectDefault(() => {
if (importDefault != null) {
tmp();
}
dependencyMap();
});
const tmp6Result4 = _slicedToArray(ref.useState(false), 2);
const unmountEffect = optionsTree(5482).useUnmountEffect(() => {
if (c16) {
const obj3 = { rating: first2, category: null, reason: null, dontShowAgain: null };
value = undefined;
const obj2 = ModalActionCreatorsDefault;
if (first4 != null) {
value = iter.value;
}
const obj4 = { result: null, trackReport: null, titleLabel: null, descriptionLabel: null, hideHelpdeskLink: null };
obj3.category = value;
obj3.reason = first5;
obj3.dontShowAgain = first1;
obj4.result = obj3;
obj4.trackReport = function trackReport(rating) {
const obj = { rating: rating.rating, category: rating.category, reason: rating.reason, dontShowAgain: rating.dontShowAgain, feedback: null };
let str = rating.feedback;
if (str == null) {
str = "";
}
obj.feedback = str;
closure_1_3(obj);
};
let problemsHeader;
if (first4 != null) {
problemsHeader = iter.problemsHeader;
}
obj4.titleLabel = problemsHeader;
const intl = tmp10(1115).intl;
obj4.descriptionLabel = intl.string(util.t.h95hcn);
let hideHelpdeskLink;
if (first4 != null) {
const freeformConfig = iter.freeformConfig;
if (freeformConfig != null) {
hideHelpdeskLink = freeformConfig.hideHelpdeskLink;
}
}
obj4.hideHelpdeskLink = hideHelpdeskLink;
obj2.pushLazy(asyncRequireImpl(11356, dependencyMap.paths), obj4);
const tmp11 = asyncRequireImpl(11356, dependencyMap.paths);
} else {
let obj = { rating: first2, category: null, reason: null, dontShowAgain: null, feedback: "" };
value2 = undefined;
if (first4 != null) {
value2 = first4.value;
}
if (value2 == null) {
value2 = null;
}
obj.category = value2;
obj.reason = first5;
obj.dontShowAgain = first1;
_slicedToArray(obj);
}
});
const callback = obj.useCallback((arg0) => {
closure_11(arg0);
if (arg0 === FeedbackRating.GOOD) {
closure_13(null);
closure_15(null);
_undefined(false);
ActionSheetActionCreatorsDefault.hideActionSheet();
} else {
const current = ref.current;
if (current != null) {
current.expandActionSheet();
}
}
}, []);
closure_18 = obj.useCallback((arg0) => {
closure_13(arg0);
closure_15(null);
const current = ref.current;
if (current != null) {
current.expandActionSheet();
}
}, []);
const items1 = [first4];
closure_19 = obj.useCallback((value) => {
closure_15(value);
if (null != first4) {
if (null != value) {
value = undefined;
if (first4.freeformConfig != null) {
value = iter.value;
}
if (value === value.value) {
_undefined(true);
}
ActionSheetActionCreatorsDefault.hideActionSheet();
}
}
_undefined(false);
}, items1);
if (null == first2) {
let tmp35 = null;
if (null != ratingBody) {
let obj4 = { style: tmp.ratingsBody, variant: "text-md/medium", color: "text-default", children: ratingBody };
tmp35 = closure_7(tmp20(4841).Text, obj4);
}
const items2 = [tmp35, , ];
const obj5 = { ratingOptions, selectedRating: first2, onChangeRating: callback };
items2[1] = closure_7(tmp3(11338), obj5);
let tmp37Result = null;
if (!hideDontShowAgainCheckbox) {
const obj6 = { start: true, end: true, checked: first1, label: null, onPress: null };
const intl3 = tmp20(1115).intl;
obj6.label = intl3.string(tmp20(1115).t["5E9SB9"]);
obj6.onPress = function onPress() {
return closure_9(!first1);
};
tmp37Result = tmp37(tmp20(6102).TableCheckboxRow, obj6);
}
const obj7 = { children: null };
items2[2] = tmp37Result;
obj7.children = items2;
let tmp33Result = closure_9(first1, obj7);
let problemsHeader = headerLabel;
tmp37 = closure_7;
} else {
if (first2 !== first.GOOD) {
if (null == first4) {
const obj8 = { children: null };
const obj9 = { style: tmp.problemsList, children: null };
const obj10 = {
hasIcons: false,
children: first.map((label, index) => {
closure_0 = label;
return closure_7(optionsTree(6103).TableRow, {
label: label.label,
labelLineClamp: 2,
onPress() {
return closure_18(closure_0);
}
}, index);
})
};
obj9.children = closure_7(tmp20(6185).TableRowGroup, obj10);
const items3 = [closure_7(closure_5, obj9), ];
const obj11 = { variant: "secondary", size: "sm", text: null, onPress: null };
const intl2 = tmp20(1115).intl;
obj11.text = intl2.string(tmp20(1115).t["13/7kX"]);
obj11.onPress = function onPress() {
return closure_11(null);
};
items3[1] = closure_7(tmp20(5465).Button, obj11);
obj8.children = items3;
tmp33Result = closure_9(first1, obj8);
problemsHeader = categoriesHeader;
}
}
problemsHeader = headerLabel;
if (tmp23) {
problemsHeader = first4.problemsHeader;
const obj12 = { children: null };
const obj13 = { style: tmp.problemsList, children: null };
const obj14 = { hasIcons: false, children: null };
const problemOptions = first4.problemOptions;
obj14.children = problemOptions.map((label, index) => {
closure_0 = label;
return closure_7(optionsTree(6103).TableRow, {
label: label.label,
labelLineClamp: 2,
onPress() {
return closure_19(closure_0);
}
}, index);
});
obj13.children = closure_7(tmp20(6185).TableRowGroup, obj14);
const items4 = [closure_7(closure_5, obj13), ];
const obj15 = { variant: "secondary", size: "sm", text: null, onPress: null };
let intl = tmp20(1115).intl;
obj15.text = intl.string(tmp20(1115).t["13/7kX"]);
obj15.onPress = function onPress() {
if (1 === first.length) {
let tmp3 = closure_11(null);
} else {
tmp3 = closure_13(null);
}
return tmp3;
};
items4[1] = closure_7(tmp20(5465).Button, obj15);
obj12.children = items4;
tmp33Result = closure_9(first1, obj12);
}
tmp23 = null != first4 && null == first5;
}
const bottom = tmp3(1613)().bottom;
let num = 48;
if (hideDontShowAgainCheckbox) {
num = 0;
}
const sum = 232 + num + bottom;
const obj16 = { scrollable: true, ref, startHeight: sum, maxHeight: null, header: null, children: null };
let tmp41;
if (null == first2) {
tmp41 = sum;
}
obj16.maxHeight = tmp41;
const obj17 = { title: problemsHeader, trailing: null };
let tmp40Result = null;
if (showHeaderCloseButton) {
const obj18 = { onPress };
tmp40Result = tmp40(tmp20(6805).ActionSheetCloseButton, obj18);
}
obj17.trailing = tmp40Result;
obj16.header = closure_7(optionsTree(6756).BottomSheetTitleHeader, obj17);
const obj19 = { contentContainerStyle: null, children: tmp33Result };
const items5 = [tmp.container, { paddingBottom: tmp.container.padding + bottom }];
obj19.contentContainerStyle = items5;
obj16.children = closure_7(optionsTree(6231).BottomSheetScrollView, obj19);
return closure_7(optionsTree(6757).BottomSheet, obj16);
};