decord/source/modules/messages/native/DMMessageStickerGreeting.tsx

323 lines
12 KiB
TypeScript
Raw Normal View History

2026-08-24 06:08:38 +00:00
// Module ID: 11479
// Function ID: 11480
2026-07-20 16:05:17 +00:00
// Name: DMMessageStickerGreeting
2026-08-24 06:08:38 +00:00
// Dependencies: [5, 32, 19, 17, 6806, 4999, 1922, 21, 4668, 712, 4198, 4100, 4227, 4097, 11480, 11481, 7465, 1236, 589, 686, 4223, 11482, 10257, 4119, 4671, 1297, 10256, 4761, 5438, 10158, 4739, 4750, 2]
2026-07-20 16:05:17 +00:00
// Exports: default
2026-08-24 06:08:38 +00:00
// Module 11479 (DMMessageStickerGreeting)
import ThemesDefault from "Themes" /* 712 */;
import closure_3 from "asyncGeneratorStep" /* 5 */;
import closure_4 from "_slicedToArray" /* 32 */;
import closure_5 from "noop" /* 19 */;
import { View } from "get ActivityIndicator" /* 17 */;
import closure_7 from "loadSavedGuildStickers" /* 6806 */;
import closure_8 from "reinjectEphemerals" /* 4999 */;
import closure_9 from "mergeGuildAvatar" /* 1922 */;
import jsxProd from "jsxProd" /* 21 */;
import createCacheKey from "createCacheKey" /* 4668 */;
2026-07-23 10:11:24 +00:00
const require = arg1;
2026-07-29 08:29:29 +00:00
({ jsx: c10, jsxs: unpackModuleId, Fragment: closure_12 } = jsxProd);
let closure_13 = createCacheKey.createStyles((arg0) => {
2026-07-20 16:05:17 +00:00
let BACKGROUND_BASE_LOWER = arg0;
2026-07-29 08:29:29 +00:00
if (arg0 == null) {
2026-08-24 06:08:38 +00:00
BACKGROUND_BASE_LOWER = ThemesDefault.colors.BACKGROUND_BASE_LOWER;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
let obj = { container: { backgroundColor: BACKGROUND_BASE_LOWER, alignItems: "center", paddingHorizontal: 16, paddingBottom: 16, paddingTop: 8 }, stickerContainer: { paddingBottom: 16 }, toastContainer: null, toastContent: null, gradient: null };
2026-08-24 06:08:38 +00:00
obj = { flexDirection: "row", backgroundColor: ThemesDefault.colors.BACKGROUND_BASE_LOWEST, justifyContent: "center", alignItems: "center", gap: 8, height: 48, paddingHorizontal: 16, borderRadius: ThemesDefault.radii.xxl };
2026-07-29 08:29:29 +00:00
obj[2] = obj;
obj[3] = { lineHeight: 20 };
obj[4] = { position: "absolute", right: 0, left: 0, top: 0, height: 30 };
2026-07-20 16:05:17 +00:00
return obj;
});
2026-07-29 08:29:29 +00:00
let c14 = "749054660769218631";
const END = require("getGradientColorByPercentage").GradientPercentage.END;
let closure_16 = { code: "function DMMessageStickerGreetingTsx1(){const{styles,isRendered,hasInputText,hasMessages,HEIGHT_COMPACT,HEIGHT_FULL,withDelay,withTiming,STANDARD_EASING}=this.__closure;const gradientOverlayOffset=styles.gradient.height;const hasHeight=isRendered&&!hasInputText;const heightExpanded=(hasMessages?HEIGHT_COMPACT:HEIGHT_FULL)-1;const targetHeight=hasHeight?heightExpanded+gradientOverlayOffset:0;const targetMargin=hasHeight?-gradientOverlayOffset:0;function generateAnimationConfig(value){return withDelay(300,withTiming(value,{easing:STANDARD_EASING,duration:250}));}return{justifyContent:'flex-end',overflow:'hidden',marginTop:generateAnimationConfig(targetMargin),height:generateAnimationConfig(targetHeight)};}" };
2026-08-24 06:08:38 +00:00
const result = require("set").fileFinishedImporting("modules/messages/native/DMMessageStickerGreeting.tsx");
2026-07-20 16:05:17 +00:00
export default function DMMessageStickerGreeting(channel) {
channel = channel.channel;
2026-07-29 08:29:29 +00:00
let _require = channel;
2026-07-20 16:05:17 +00:00
const hasInputText = channel.hasInputText;
2026-07-29 08:29:29 +00:00
let first = hasInputText;
2026-08-24 06:08:38 +00:00
dependencyMap = undefined;
2026-07-29 08:29:29 +00:00
let first1;
let callback;
let React;
let Text = _require;
let tmp = dependencyMap;
2026-08-24 06:08:38 +00:00
let obj = _require(4198);
2026-07-29 08:29:29 +00:00
let toastContent = callback3(obj.useGradientValue(END));
dependencyMap = toastContent;
2026-08-24 06:08:38 +00:00
obj1 = _require(589);
2026-07-29 08:29:29 +00:00
const items = [closure_8];
2026-07-20 16:05:17 +00:00
const stateFromStores = obj1.useStateFromStores(items, () => {
2026-08-24 06:08:38 +00:00
const messages = closure_1_8.getMessages(_undefined.id);
2026-07-29 08:29:29 +00:00
return messages.filter((type) => type.type !== callback(table[19]).MessageTypes.FRIEND_REQUEST_ACCEPTED).length > 0;
2026-07-20 16:05:17 +00:00
});
2026-07-29 08:29:29 +00:00
first1 = stateFromStores;
let obj2 = _require(589);
2026-08-24 06:08:38 +00:00
const items1 = [closure_9];
2026-07-29 08:29:29 +00:00
let tmp5 = first;
2026-08-24 06:08:38 +00:00
const stateFromStores1 = obj2.useStateFromStores(items1, () => closure_1_9.getUser(_undefined.getRecipientId()));
let obj3 = first(4223);
2026-07-20 16:05:17 +00:00
let name = obj3.useName(stateFromStores1);
2026-07-29 08:29:29 +00:00
if (name == null) {
let intl = Text(1236).intl;
name = intl.string(Text(1236).t.y1Wu2f);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
const intl2 = Text(1236).intl;
const formatToPlainStringResult = intl2.formatToPlainString(Text(1236).t.m0zYbV, { username: name });
2026-08-24 06:08:38 +00:00
const showConvoStarterInDM = Text(11482).useShowConvoStarterInDM(channel);
2026-07-29 08:29:29 +00:00
callback = showConvoStarterInDM;
2026-08-24 06:08:38 +00:00
const TextResult = Text(11482);
2026-07-29 08:29:29 +00:00
const tmp2 = END;
2026-08-24 06:08:38 +00:00
const items2 = [closure_7];
2026-07-20 16:05:17 +00:00
const items3 = [showConvoStarterInDM];
2026-07-29 08:29:29 +00:00
const stateFromStores2 = Text(589).useStateFromStores(items2, () => {
2026-07-20 16:05:17 +00:00
let stickerById = null;
2026-08-24 06:08:38 +00:00
if (closure_4) {
stickerById = closure_1_7.getStickerById(closure_1_14);
2026-07-20 16:05:17 +00:00
}
return stickerById;
}, items3);
const items4 = [showConvoStarterInDM];
2026-07-29 08:29:29 +00:00
const effect = React.useEffect(() => {
2026-08-24 06:08:38 +00:00
if (closure_4) {
2026-07-29 08:29:29 +00:00
const stickerPack = _undefined(lib[22]).fetchStickerPack("847199849233514549", true);
const obj = _undefined(lib[22]);
2026-07-20 16:05:17 +00:00
}
}, items4);
2026-07-29 08:29:29 +00:00
_require = channel;
first = undefined;
dependencyMap = undefined;
first1 = undefined;
callback = undefined;
const tmp11 = callback(React.useState(null), 2);
first = tmp11[0];
dependencyMap = tmp11[1];
const tmp13 = callback(React.useState(false), 2);
first1 = tmp13[0];
callback = tmp13[1];
const items5 = [channel.id];
const effect1 = React.useEffect(() => {
lib(null);
}, items5);
const items6 = [first1, first, channel.id];
callback = React.useCallback(first1(function*() {
if (c5 === 2) {
c5 = 3;
HermesBuiltin.throwTypeError();
} else if (tmp6 === 3) {
if (arg0 === 1) {
throw arg1;
} else if (arg0 === 2) {
let obj = { value: null, done: true };
obj[0] = arg1;
return obj;
} else {
2026-08-24 06:08:38 +00:00
return { value: "HermesInternal", done: null };
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
} else {
try {
c5 = 2;
let tmp7 = v0;
if (0 === v0) {
if (arg0 === 1) {
c5 = 3;
throw arg1;
} else if (arg0 === 2) {
c5 = 3;
obj = { value: null, done: true };
obj[0] = arg1;
return obj;
} else {
2026-08-24 06:08:38 +00:00
closure_1 = tmp3;
2026-07-29 08:29:29 +00:00
let showErrorToast = tmp7;
showErrorToast = function showErrorToast(intl) {
if (callback !== intl) {
tmp30(intl);
}
let obj = callback(tmp30[13]);
obj = { key: "HANDLE_WAVE_PRESS_TOAST", content: intl, icon: callback(tmp30[14]) };
obj.open(obj);
};
tmp7 = c3;
if (!c3) {
v0(true);
2026-08-24 06:08:38 +00:00
if (null !== closure_1_1) {
2026-07-29 08:29:29 +00:00
v0(false);
showErrorToast(tmp26);
c5 = 3;
2026-08-24 06:08:38 +00:00
return { value: "HermesInternal", done: null };
2026-07-29 08:29:29 +00:00
} else {
c3 = 1;
2026-08-24 06:08:38 +00:00
obj1 = { channelId: null, source: "In-channel greet" };
obj1[0] = closure_1_0.id;
closure_1_0(closure_1_2[15]).trackWaveCtaClicked(obj1);
const obj5 = closure_1_0(closure_1_2[15]);
2026-07-29 08:29:29 +00:00
v0 = 2;
c5 = 1;
const obj2 = { value: null, done: false };
2026-08-24 06:08:38 +00:00
obj2[0] = closure_1_1(closure_1_2[16]).sendGreetMessage(closure_1_0.id, closure_1_14);
2026-07-29 08:29:29 +00:00
return obj2;
}
}
}
} else {
if (1 === tmp7) {
c3 = 0;
closure_1 = closure_2;
let ok = closure_1.ok;
if (!ok) {
ok = 429 !== closure_1.status;
}
if (!ok) {
2026-08-24 06:08:38 +00:00
const intl = closure_1_0(closure_1_2[17]).intl;
showErrorToast(intl.string(closure_1_0(closure_1_2[17]).t.Whhv4w));
2026-07-29 08:29:29 +00:00
}
} else if (arg0 === 1) {
c5 = 3;
throw arg1;
} else if (arg0 === 2) {
c3 = 0;
c5 = 3;
obj = { value: null, done: true };
obj[0] = arg1;
return obj;
} else {
c3 = 0;
}
tmp7 = v0(false);
}
c5 = 3;
} catch (tmp30) {
closure_2 = tmp30;
if (tmp4 === c3) {
c5 = tmp2;
throw tmp30;
} else {
v0 = tmp;
2026-07-20 16:05:17 +00:00
}
}
2026-07-29 08:29:29 +00:00
}
}), items6);
_require = undefined;
const TextResult1 = Text(589);
[tmp17, tmp18] = callback(React.useState(false), 2);
_require = tmp18;
const items7 = [tmp18];
React = tmp17;
const callback1 = React.useCallback(() => {
_undefined(true);
}, items7);
const tmp16 = callback(React.useState(false), 2);
const fn = function w() {
const height = lib.gradient.height;
let tmp = c5;
if (c5) {
tmp = !first;
}
let num = 0;
if (tmp) {
let num2 = 180;
if (first1) {
num2 = 72;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
num = num2 - 1 + height;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
let num4 = 0;
if (tmp) {
num4 = -height;
}
let obj = { justifyContent: "flex-end", overflow: "hidden", marginTop: null, height: null };
const obj2 = _undefined(lib[23]);
obj = { easing: _undefined(lib[25]).STANDARD_EASING, duration: 250 };
obj[2] = obj2.withDelay(300, _undefined(lib[24]).withTiming(num4, obj));
const obj3 = _undefined(lib[24]);
const obj5 = _undefined(lib[23]);
obj = { easing: _undefined(lib[25]).STANDARD_EASING, duration: 250 };
obj[3] = obj5.withDelay(300, _undefined(lib[24]).withTiming(num, obj));
return obj;
};
2026-08-24 06:08:38 +00:00
obj = { styles: toastContent, isRendered: tmp17, hasInputText, hasMessages: stateFromStores, HEIGHT_COMPACT: 72, HEIGHT_FULL: 180, withDelay: Text(4119).withDelay, withTiming: Text(4671).withTiming, STANDARD_EASING: Text(1297).STANDARD_EASING };
2026-07-29 08:29:29 +00:00
fn.__closure = obj;
fn.__workletHash = 6327401707106;
fn.__initData = closure_16;
2026-08-24 06:08:38 +00:00
const animatedStyle = Text(4119).useAnimatedStyle(fn);
const TextResult2 = Text(4119);
let BACKGROUND_BASE_LOWER = Text(4198).useGradientValue(tmp2);
const TextResult3 = Text(4198);
2026-07-29 08:29:29 +00:00
if (BACKGROUND_BASE_LOWER == null) {
BACKGROUND_BASE_LOWER = tmp5(712).colors.BACKGROUND_BASE_LOWER;
2026-07-20 16:05:17 +00:00
}
2026-08-24 06:08:38 +00:00
const token = Text(4100).useToken(BACKGROUND_BASE_LOWER);
const TextResult4 = Text(4100);
const items8 = [Text(4227).hexWithOpacity(token, 0), token];
const TextResult5 = Text(4227);
const shouldAnimateSticker = Text(10256).useShouldAnimateSticker(false);
2026-07-20 16:05:17 +00:00
if (!showConvoStarterInDM) {
return null;
} else {
2026-07-29 08:29:29 +00:00
obj = { style: null, onLayout: null, children: null };
obj[0] = animatedStyle;
obj[1] = callback1;
obj1 = { style: null, colors: null };
obj1[0] = toastContent.gradient;
obj1[1] = items8;
2026-08-24 06:08:38 +00:00
const items9 = [callback2(tmp5(4761), obj1), ];
2026-07-29 08:29:29 +00:00
obj2 = { style: null, children: null };
obj2[0] = toastContent.container;
2026-07-20 16:05:17 +00:00
if (stateFromStores) {
2026-07-29 08:29:29 +00:00
obj3 = { style: null, accessibilityRole: "button", accessibilityLabel: null, onPress: null, children: null };
obj3[0] = toastContent.toastContainer;
const intl3 = Text(1236).intl;
obj3[2] = intl3.string(Text(1236).t.pJObYI);
obj3[3] = callback;
let tmp24Result = null;
if (null != stateFromStores2) {
2026-08-24 06:08:38 +00:00
tmp5 = tmp5(10158);
2026-07-29 08:29:29 +00:00
const obj4 = { sticker: null, size: 24, animated: null };
obj4[0] = stateFromStores2;
obj4[2] = shouldAnimateSticker;
tmp24Result = tmp24(tmp5, obj4);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
callback = [tmp24Result, ];
2026-08-24 06:08:38 +00:00
Text = Text(4739).Text;
2026-07-29 08:29:29 +00:00
let obj5 = { style: null, variant: "text-md/bold", children: null };
toastContent = toastContent.toastContent;
obj5[0] = toastContent;
obj5[2] = formatToPlainStringResult;
tmp = tmp24(Text, obj5);
callback[1] = tmp;
obj3[4] = callback;
2026-08-24 06:08:38 +00:00
let tmp23Result = tmp23(Text(5438).PressableOpacity, obj3);
2026-07-20 16:05:17 +00:00
} else {
2026-07-29 08:29:29 +00:00
tmp24Result = null;
if (null != stateFromStores2) {
const obj6 = { style: null, children: null };
obj6[0] = toastContent.stickerContainer;
const obj7 = { sticker: null, size: 100, animated: null };
obj7[0] = stateFromStores2;
obj7[2] = shouldAnimateSticker;
2026-08-24 06:08:38 +00:00
obj6[1] = tmp24(tmp5(10158), obj7);
2026-07-29 08:29:29 +00:00
tmp24Result = tmp24(tmp25, obj6);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
const obj8 = { children: null };
const items10 = [tmp24Result, ];
const obj9 = { text: null, onPress: null, shrink: true };
obj9[0] = formatToPlainStringResult;
obj9[1] = callback;
2026-08-24 06:08:38 +00:00
items10[1] = tmp24(Text(4750).Button, obj9);
2026-07-29 08:29:29 +00:00
obj8[0] = items10;
tmp23Result = tmp23(closure_12, obj8);
const tmp26 = closure_12;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
obj2[1] = tmp23Result;
obj2 = tmp24(tmp25, obj2);
items9[1] = obj2;
obj[2] = items9;
2026-08-24 06:08:38 +00:00
tmp23Result = tmp23(tmp5(4119).View, obj);
2026-07-20 16:05:17 +00:00
}
};