mukulhase / WebWhatsapp-Wrapper

An API for sending and receiving messages over web.whatsapp [Working as of 18th May 2018]
https://webwhatsapi.readthedocs.io/en/latest/
MIT License
2.02k stars 797 forks source link

webpackJsonp is not defined #1006

Open derodevil opened 3 years ago

derodevil commented 3 years ago

https://github.com/mukulhase/WebWhatsapp-Wrapper/blob/d05279ee6e214eeccb02d5cfe2037707d4fa6153/webwhatsapi/js/wapi.js#L73

efjcz commented 3 years ago

same issue here

mdedirudianto commented 3 years ago

same issue, looking for solution

efjcz commented 3 years ago

solution working here:

https://github.com/mukulhase/WebWhatsapp-Wrapper/pull/1003

derodevil commented 3 years ago

@efjcz thanks men. it's working

wholesomegarden commented 3 years ago

Confirm Working :) for convenience the lines to copy are from lines 30 to 86 of wapi.js

       for (let idx in modules) {
            if ((typeof modules[idx] === "object") && (modules[idx] !== null)) {
                neededObjects.forEach((needObj) => {
                    if (!needObj.conditions || needObj.foundedModule)
                        return;
                    let neededModule = needObj.conditions(modules[idx]);
                    if (neededModule !== null) {
                        foundCount++;
                        needObj.foundedModule = neededModule;
                    }
                });

                if (foundCount == neededObjects.length) {
                    break;
                }
            }
        }

        let neededStore = neededObjects.find((needObj) => needObj.id === "Store");
        window.Store = neededStore.foundedModule ? neededStore.foundedModule : {};
        neededObjects.splice(neededObjects.indexOf(neededStore), 1);
        neededObjects.forEach((needObj) => {
            if (needObj.foundedModule) {
                window.Store[needObj.id] = needObj.foundedModule;
            }
        });

        window.Store.Chat.modelClass.prototype.sendMessage = function (e) {
            window.Store.SendTextMsgToChat(this, ...arguments);
        }       

        return window.Store;
    }

        if (typeof webpackJsonp === 'function') {
            webpackJsonp([], {'parasite': (x, y, z) => getStore(z)}, ['parasite']);
        } else {
            let tag = new Date().getTime();
            webpackChunkbuild.push([
                ["parasite" + tag],
                {

                },
                function (o, e, t) {
                    let modules = [];
                    for (let idx in o.m) {
                        let module = o(idx);
                        modules.push(module);
                    }
                    getStore(modules);
                }
            ]);
        }

    })();
}

from 1003 https://github.com/mukulhase/WebWhatsapp-Wrapper/blob/6eae48b8f6e69c6564ce2ab2eec0b12c5876dd94/webwhatsapi/js/wapi.js

tetradox commented 3 years ago

'modelClass' of undefined

thiagovmu commented 3 years ago

'modelClass' of undefined

There is another pullrequest that replaces the code block:

window.Store.Chat.modelClass.prototype.sendMessage = function (e) {
    window.Store.SendTextMsgToChat(this, ...arguments);
}

for

window.Store.ChatClass.default.prototype.sendMessage = function (e) {
    window.Store.SendTextMsgToChat(this, ...arguments);
}

Even so, I didn't manage to put the whole thing back to work.... =/