UNPKG

superchats

Version:

SuperChats is a premium library with unique features that control Whatsapp functions. With Superchats you can build service bots, multiservice chats or any system that uses whatsapp

1 lines 9.66 kB
'use strict';const a92_0x2fcefa=a92_0x41ef;function a92_0x19c7(){const _0x54aef3=['../../Internal','93SMuMZZ','image','media','__esModule','images','retailerId','uploadingNecessaryImagesOfProduct','from','collections','after','COUNTRY_ORIGIN_EXEMPT','sha256','toProductNode','getBinaryNodeChildren','product_catalog','includes','toReadable','4305738upNYmi','692015UCbtEd','original_image_url','getBinaryNodeChildString','uploadingNecessaryImages','compliance_info','undefined','push','.whatsapp.net','isHidden','status_info','country_code_origin','base64','3152196buaZkY','is_hidden','currency','status','parseProductNode','description','defineProperty','2597168euwiXC','name','originCountryCode','digest','all','4550830RYqwGs','order','retailer_id','paging','product','parseCollectionsNode','parseCatalogNode','27662vNxYTJ','true','7rNmYvr','concat','product-catalog-image','price','attrs','url','toString','getBinaryNodeChild','215725torKKS','update','map','getUrlFromDirectPath','9WFhixP'];a92_0x19c7=function(){return _0x54aef3;};return a92_0x19c7();}(function(_0x20d9da,_0x4b35d6){const _0x4de040=a92_0x41ef,_0xa68f36=_0x20d9da();while(!![]){try{const _0x214a1d=parseInt(_0x4de040(0xf8))/0x1+parseInt(_0x4de040(0x117))/0x2*(-parseInt(_0x4de040(0x127))/0x3)+parseInt(_0x4de040(0x104))/0x4+parseInt(_0x4de040(0x121))/0x5+-parseInt(_0x4de040(0xf7))/0x6+-parseInt(_0x4de040(0x119))/0x7*(parseInt(_0x4de040(0x10b))/0x8)+-parseInt(_0x4de040(0x125))/0x9*(-parseInt(_0x4de040(0x110))/0xa);if(_0x214a1d===_0x4b35d6)break;else _0xa68f36['push'](_0xa68f36['shift']());}catch(_0x2f853b){_0xa68f36['push'](_0xa68f36['shift']());}}}(a92_0x19c7,0x7bd7e));Object[a92_0x2fcefa(0x10a)](exports,a92_0x2fcefa(0x12a),{'value':!![]}),exports[a92_0x2fcefa(0xfb)]=exports[a92_0x2fcefa(0x12d)]=exports[a92_0x2fcefa(0x108)]=exports[a92_0x2fcefa(0xf2)]=exports['parseOrderDetailsNode']=exports['parseCollectionsNode']=exports[a92_0x2fcefa(0x116)]=void 0x0;const crypto_1=require('crypto'),Internal_1=require(a92_0x2fcefa(0x126)),mms_1=require('./mms'),parseCatalogNode=_0x2a9984=>{const _0x5ea01c=a92_0x2fcefa,_0x31b238=(0x0,Internal_1[_0x5ea01c(0x120)])(_0x2a9984,_0x5ea01c(0xf4)),_0x25094b=(0x0,Internal_1['getBinaryNodeChildren'])(_0x31b238,_0x5ea01c(0x114))[_0x5ea01c(0x123)](exports[_0x5ea01c(0x108)]),_0x4bcc31=(0x0,Internal_1[_0x5ea01c(0x120)])(_0x31b238,_0x5ea01c(0x113));return{'products':_0x25094b,'nextPageCursor':_0x4bcc31?(0x0,Internal_1['getBinaryNodeChildString'])(_0x4bcc31,_0x5ea01c(0xef)):undefined};};exports[a92_0x2fcefa(0x116)]=parseCatalogNode;function a92_0x41ef(_0x1e285b,_0x22d50b){const _0x19c733=a92_0x19c7();return a92_0x41ef=function(_0x41efd2,_0x3b3fd6){_0x41efd2=_0x41efd2-0xee;let _0x21b4a9=_0x19c733[_0x41efd2];return _0x21b4a9;},a92_0x41ef(_0x1e285b,_0x22d50b);}const parseCollectionsNode=_0x19887f=>{const _0x23ad94=a92_0x2fcefa,_0x108244=(0x0,Internal_1['getBinaryNodeChild'])(_0x19887f,_0x23ad94(0xee)),_0x5c8f88=(0x0,Internal_1[_0x23ad94(0xf3)])(_0x108244,'collection')[_0x23ad94(0x123)](_0x26686b=>{const _0x4b1441=_0x23ad94,_0x370f2c=(0x0,Internal_1[_0x4b1441(0xfa)])(_0x26686b,'id'),_0x35ad5c=(0x0,Internal_1[_0x4b1441(0xfa)])(_0x26686b,'name'),_0x572f5d=(0x0,Internal_1['getBinaryNodeChildren'])(_0x26686b,_0x4b1441(0x114))['map'](exports['parseProductNode']);return{'id':_0x370f2c,'name':_0x35ad5c,'products':_0x572f5d,'status':parseStatusInfo(_0x26686b)};});return{'collections':_0x5c8f88};};exports[a92_0x2fcefa(0x115)]=parseCollectionsNode;const parseOrderDetailsNode=_0x112e05=>{const _0x1bb9be=a92_0x2fcefa,_0x1ca89b=(0x0,Internal_1[_0x1bb9be(0x120)])(_0x112e05,_0x1bb9be(0x111)),_0x16181c=(0x0,Internal_1[_0x1bb9be(0xf3)])(_0x1ca89b,_0x1bb9be(0x114))[_0x1bb9be(0x123)](_0x281671=>{const _0x33d8e6=_0x1bb9be,_0x28736d=(0x0,Internal_1['getBinaryNodeChild'])(_0x281671,_0x33d8e6(0x128));return{'id':(0x0,Internal_1[_0x33d8e6(0xfa)])(_0x281671,'id'),'name':(0x0,Internal_1[_0x33d8e6(0xfa)])(_0x281671,_0x33d8e6(0x10c)),'imageUrl':(0x0,Internal_1[_0x33d8e6(0xfa)])(_0x28736d,_0x33d8e6(0x11e)),'price':+(0x0,Internal_1[_0x33d8e6(0xfa)])(_0x281671,_0x33d8e6(0x11c)),'currency':(0x0,Internal_1[_0x33d8e6(0xfa)])(_0x281671,_0x33d8e6(0x106)),'quantity':+(0x0,Internal_1['getBinaryNodeChildString'])(_0x281671,'quantity')};}),_0x4f848f=(0x0,Internal_1[_0x1bb9be(0x120)])(_0x1ca89b,_0x1bb9be(0x11c)),_0xe95b4a={'price':{'total':+(0x0,Internal_1[_0x1bb9be(0xfa)])(_0x4f848f,'total'),'currency':(0x0,Internal_1[_0x1bb9be(0xfa)])(_0x4f848f,_0x1bb9be(0x106))},'products':_0x16181c};return _0xe95b4a;};exports['parseOrderDetailsNode']=parseOrderDetailsNode;const toProductNode=(_0x2a2fe2,_0x29312a)=>{const _0x47bbbc=a92_0x2fcefa,_0x257b3b={},_0x400141=[];typeof _0x2a2fe2!=='undefined'&&_0x400141[_0x47bbbc(0xfe)]({'tag':'id','attrs':{},'content':Buffer['from'](_0x2a2fe2)});typeof _0x29312a[_0x47bbbc(0x10c)]!=='undefined'&&_0x400141[_0x47bbbc(0xfe)]({'tag':_0x47bbbc(0x10c),'attrs':{},'content':Buffer[_0x47bbbc(0x12e)](_0x29312a[_0x47bbbc(0x10c)])});typeof _0x29312a[_0x47bbbc(0x109)]!==_0x47bbbc(0xfd)&&_0x400141[_0x47bbbc(0xfe)]({'tag':'description','attrs':{},'content':Buffer[_0x47bbbc(0x12e)](_0x29312a['description'])});typeof _0x29312a[_0x47bbbc(0x12c)]!=='undefined'&&_0x400141[_0x47bbbc(0xfe)]({'tag':'retailer_id','attrs':{},'content':Buffer[_0x47bbbc(0x12e)](_0x29312a[_0x47bbbc(0x12c)])});_0x29312a[_0x47bbbc(0x12b)]['length']&&_0x400141[_0x47bbbc(0xfe)]({'tag':_0x47bbbc(0x129),'attrs':{},'content':_0x29312a['images'][_0x47bbbc(0x123)](_0x6f73e7=>{const _0x1e9362=_0x47bbbc;if(!('url'in _0x6f73e7))throw null;return{'tag':_0x1e9362(0x128),'attrs':{},'content':[{'tag':_0x1e9362(0x11e),'attrs':{},'content':Buffer[_0x1e9362(0x12e)](_0x6f73e7['url'][_0x1e9362(0x11f)]())}]};})});typeof _0x29312a['price']!==_0x47bbbc(0xfd)&&_0x400141[_0x47bbbc(0xfe)]({'tag':_0x47bbbc(0x11c),'attrs':{},'content':Buffer[_0x47bbbc(0x12e)](_0x29312a[_0x47bbbc(0x11c)][_0x47bbbc(0x11f)]())});typeof _0x29312a[_0x47bbbc(0x106)]!==_0x47bbbc(0xfd)&&_0x400141[_0x47bbbc(0xfe)]({'tag':_0x47bbbc(0x106),'attrs':{},'content':Buffer[_0x47bbbc(0x12e)](_0x29312a['currency'])});'originCountryCode'in _0x29312a&&(typeof _0x29312a[_0x47bbbc(0x10d)]===_0x47bbbc(0xfd)?_0x257b3b['compliance_category']=_0x47bbbc(0xf0):_0x400141[_0x47bbbc(0xfe)]({'tag':_0x47bbbc(0xfc),'attrs':{},'content':[{'tag':_0x47bbbc(0x102),'attrs':{},'content':Buffer[_0x47bbbc(0x12e)](_0x29312a[_0x47bbbc(0x10d)])}]}));typeof _0x29312a[_0x47bbbc(0x100)]!==_0x47bbbc(0xfd)&&(_0x257b3b[_0x47bbbc(0x105)]=_0x29312a[_0x47bbbc(0x100)]['toString']());const _0x33ac0e={'tag':_0x47bbbc(0x114),'attrs':_0x257b3b,'content':_0x400141};return _0x33ac0e;};exports[a92_0x2fcefa(0xf2)]=toProductNode;const parseProductNode=_0x32fc39=>{const _0x41a970=a92_0x2fcefa,_0x51924b=_0x32fc39[_0x41a970(0x11d)]['is_hidden']===_0x41a970(0x118),_0x5561d0=(0x0,Internal_1[_0x41a970(0xfa)])(_0x32fc39,'id'),_0x56f211=(0x0,Internal_1[_0x41a970(0x120)])(_0x32fc39,_0x41a970(0x129)),_0x1f0282=(0x0,Internal_1[_0x41a970(0x120)])(_0x32fc39,_0x41a970(0x101)),_0x4f43e8={'id':_0x5561d0,'imageUrls':parseImageUrls(_0x56f211),'reviewStatus':{'whatsapp':(0x0,Internal_1[_0x41a970(0xfa)])(_0x1f0282,_0x41a970(0x107))},'availability':'in\x20stock','name':(0x0,Internal_1['getBinaryNodeChildString'])(_0x32fc39,_0x41a970(0x10c)),'retailerId':(0x0,Internal_1[_0x41a970(0xfa)])(_0x32fc39,_0x41a970(0x112)),'url':(0x0,Internal_1[_0x41a970(0xfa)])(_0x32fc39,_0x41a970(0x11e)),'description':(0x0,Internal_1[_0x41a970(0xfa)])(_0x32fc39,'description'),'price':+(0x0,Internal_1['getBinaryNodeChildString'])(_0x32fc39,'price'),'currency':(0x0,Internal_1[_0x41a970(0xfa)])(_0x32fc39,_0x41a970(0x106)),'isHidden':_0x51924b};return _0x4f43e8;};exports[a92_0x2fcefa(0x108)]=parseProductNode;async function uploadingNecessaryImagesOfProduct(_0x371f1e,_0x196b1f,_0x44db66=0x7530){const _0x6f800=a92_0x2fcefa;return _0x371f1e={..._0x371f1e,'images':_0x371f1e['images']?await(0x0,exports[_0x6f800(0xfb)])(_0x371f1e[_0x6f800(0x12b)],_0x196b1f,_0x44db66):_0x371f1e[_0x6f800(0x12b)]},_0x371f1e;}exports[a92_0x2fcefa(0x12d)]=uploadingNecessaryImagesOfProduct;const uploadingNecessaryImages=async(_0x345750,_0xab69ad,_0xe65336=0x7530)=>{const _0x589475=a92_0x2fcefa,_0x234202=await Promise[_0x589475(0x10f)](_0x345750[_0x589475(0x123)](async _0x3d0994=>{const _0x376cb9=_0x589475;if('url'in _0x3d0994){const _0x1090bb=_0x3d0994['url'][_0x376cb9(0x11f)]();if(_0x1090bb[_0x376cb9(0xf5)](_0x376cb9(0xff)))return{'url':_0x1090bb};}const {stream:_0x19d109}=await(0x0,mms_1['getStream'])(_0x3d0994),_0x29159e=(0x0,crypto_1['createHash'])(_0x376cb9(0xf1)),_0x1a97e6=[];for await(const _0x78d467 of _0x19d109){_0x29159e[_0x376cb9(0x122)](_0x78d467),_0x1a97e6[_0x376cb9(0xfe)](_0x78d467);}const _0x4d12d6=_0x29159e[_0x376cb9(0x10e)](_0x376cb9(0x103)),{directPath:_0x1f5e4b}=await _0xab69ad((0x0,mms_1[_0x376cb9(0xf6)])(Buffer[_0x376cb9(0x11a)](_0x1a97e6)),{'mediaType':_0x376cb9(0x11b),'fileEncSha256B64':_0x4d12d6,'timeoutMs':_0xe65336});return{'url':(0x0,mms_1[_0x376cb9(0x124)])(_0x1f5e4b)};}));return _0x234202;};exports[a92_0x2fcefa(0xfb)]=uploadingNecessaryImages;const parseImageUrls=_0x336e95=>{const _0x4f8dbc=a92_0x2fcefa,_0x39ed0c=(0x0,Internal_1['getBinaryNodeChild'])(_0x336e95,_0x4f8dbc(0x128));return{'requested':(0x0,Internal_1[_0x4f8dbc(0xfa)])(_0x39ed0c,'request_image_url'),'original':(0x0,Internal_1[_0x4f8dbc(0xfa)])(_0x39ed0c,_0x4f8dbc(0xf9))};},parseStatusInfo=_0x4364e7=>{const _0x56733a=a92_0x2fcefa,_0x367fd3=(0x0,Internal_1[_0x56733a(0x120)])(_0x4364e7,_0x56733a(0x101));return{'status':(0x0,Internal_1[_0x56733a(0xfa)])(_0x367fd3,_0x56733a(0x107)),'canAppeal':(0x0,Internal_1[_0x56733a(0xfa)])(_0x367fd3,'can_appeal')===_0x56733a(0x118)};};