From 49e8311e57ff4c9dc7d37416a6e1914ceb70ab81 Mon Sep 17 00:00:00 2001 From: Edgard Date: Sat, 17 Sep 2022 16:23:22 -0300 Subject: [PATCH] fix: Fixed buttons rendering on WhatsApp WEB >= 2.2234.6 --- src/chat/patch.ts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/chat/patch.ts b/src/chat/patch.ts index 4a97c6ce22..2249fc3e62 100644 --- a/src/chat/patch.ts +++ b/src/chat/patch.ts @@ -64,3 +64,23 @@ function applyPatch() { return func(...args); }); } + +declare global { + interface Window { + stylex: any; + } +} +/** + * Fix for buttons for @whatsapp >= 2.2234.6 + * This is an erro in whatsapp javascript files + */ +webpack.onInjected(() => { + if ('stylex' in window) { + return; + } + const stylexModule = webpack.search((m) => m.default.dedupe); + if (!stylexModule?.default) { + return; + } + window.stylex = stylexModule?.default; +});