Commit graph whatsapp-web.js/src/util/Injected.js
Author SHA1 Message Date
alechkos
bd7cf9b463
fix: link retrieval from message (#2716)
* fix: fix links retrieving from message

* docs: fix Message.links property type

* refactor: revert bracking changes
2024-01-14 08:45:33 +02:00
alechkos
e0d955f130
feat: group mentions + improved user mentions (#2602)
* added logic to mention groups + fixed user mentions

* usage example updated

* docs fixed

* window.injectToFunction clarifications

* usage example clarifications

* fix: typo

* docs: added missed docs
2024-01-11 10:33:10 +02:00
alechkos
8d683a668b
feat: pin/unpin messages (#2692)
* feat: add Message.pin and Message.unpin methods

* feat: added usage example

* docs: clarifications
2024-01-11 10:24:02 +02:00
alechkos
981fa822a0
fix: send docs without caption (#2660)
* fix: allow to send docs without a caption

* fix: typo

* fix: async function proper handling
2023-12-12 18:36:44 -03:00
Shir Serlui
ac0a50082f
Fix link preview (#2681)
* Fix link preview

* Fix typo

* Fix preview options

* Add example for preview
2023-12-12 20:56:44 +02:00
Shir Serlui
d81b74324d
fix: window.Store.getMsgInfo is not a function (#2651)
* Fix window.Store.getMsgInfo is not a function

* Unneccery code removed
2023-12-01 07:43:16 +02:00
alechkos
7ff9c9807b
fix: Message.getInfo (#2574)
* module fixed + improved modules retrieving

* wait for msg data to be updated

* added random sleep value between 1100-1200 ms

* added check for msg is sent by current user

* node 13 compatible

* docs fixed

* msg.fromMe fixed

* timestamp calculation fixed

* window.injectToFunction clarifications
2023-11-24 12:18:18 +02:00
tofers
04175063ce
feat: control auto-loading of files + fixed method setDisplayName (#2295)
* fixing the setPushname function

* Adding functions that change the media autoloading

* Checking against raw data

* fixed

* fixed merge

* ESLint

* Update src/util/Injected.js

Co-authored-by: alechkos <93551621+alechkos@users.noreply.github.com>

---------

Co-authored-by: Shir Serlui <70711723+shirser121@users.noreply.github.com>
Co-authored-by: alechkos <93551621+alechkos@users.noreply.github.com>
2023-10-22 14:07:55 +03:00
alechkos
67d305be78
feat: send polls (#2377)
* feat: added Poll class

* feat: logic for sending polls added

* updated poll properties on returned message instance

* docs updated

* usage example updated

* module fixed

* 'pollSendOptions' changed to 'options'

* window.compareWwebVersions fixed

* small update to improve the performance of findImpl fix

* added option for custom message secret

* usage example updated
2023-10-19 19:37:30 +03:00
alechkos
670335f3f4
hotfix-findImpl (#2578) 2023-10-11 11:54:28 -03:00
alechkos
c0705a2216
fix+feat: addParticipants + createGroup (#2344)
* added required modules

* added sendGroupV4Invite implementation

* docs updated accordingly

* bug fixed

* added usage example

* ESLint fix

* extended resulting object

* docs updated accordingly

* added required modules

* updated comments

* bug fixed

* added usage example

* fixed to catch unexpected errors

* removed unnecessary module

* updated usage example

* minor fixes

* changed to return a string if an error is occupied

* fixed usage example

* removed unneccessary module

* added getAddParticipantsRpcResult

* updated addParticipants

- added AddParticipnatsOptions to provide values for sleep, autoSendInviteV4, comment
- combined addParticipants with sendGroupInviteMessage

* removed unneccessary sendGroupV4Invite

* docs updated

* fixed statement fot autoSendInviteV4

* minor fixes

- the returned value of addParticipants is no longer wrapped in an array
- docs updated
- fixed bug with the returned code value when the code is '200'

* added logic of retrieving the group profile picture

this allows to send an invitation with a profile picture thumbnail of the group

* minor fixes

* added fix for the inviteV4 to be sent

* updated usage example

* minor fix

* ESLint fix

* fix for code 419

* function name getProfilePictureThumb changed to be more clear

* refactor: modules moved to window.Store.GroupParticipants

* refactor: edited link of usage examples

* refactor: LidManipulations changed to LidUtils

* refactor: modules regrouping

To keep the modules in order were made some changes:
- JoinInviteV4 renamed to GroupInviteV4 and grouped with module sendGroupInviteMessage
- GroupParticipants grouped with module sendAddParticipantsRPC

* fix: injectToFunction fixed to work properly

* revert docs changes for Chat

* Merge branch 'main' into fix-add-participants

* docs fixed

* minor fix in injectToFunction

* removed data stringifying/parsing

* added random sleep time logic

* code refactoring

* docs updated

* addParticipants method refactored

* createGroup method extended

- added functionality to send private invitations automatically to missing participants
- added ability to provide value for message timer
- added ability to link a group to the community parent group at the stage of creating a group
- extended the returned data after the method call

* docs updated + typo fixed

* added ability to create group with myself only

* example updated

* docs clarified

* small code refactoring

* window.Store.Invite and window.Store.InviteInfo grouped

* window.compareWwebVersions fixed

* small update to improve the performance of findImpl fix

* gid as wid structure

* docs + example updated

* parenthesis

* avoid sleep after the last iteration

* fixed compatibility issue for sendGroupInviteMessage

* fixed issue with stale groupmetadata

in some cases after the participant has left the group, that participant is still stored in groupmetadata

* fixed compatibility issue for sendAddParticipantsRPC

* minor fix

* jsdocs fixed

* fixed issue with group creation

* fixed createGroup method

- added check for unregistered phone number
- extended returning data from method call: added title
- code refactored
- jsdocs fixed

* fixed addParticipants method

- added check for unregistered number
- code refactored

* docs fixed

* usage example fixed

* removed unnecessary method call

* jsdocs fixed

* check for group admin fixed
2023-10-11 16:10:26 +03:00
alechkos
56320c88f8
feat: group membership requests (#2516)
* added event for group membership request

* small update to improve the performance of findImpl fix

* window.compareWwebVersions fixed

* added getGroupMembershipRequests method

* added approveGroupMembershipRequest method

* correct module for getGroupMembershipRequests

* membershipRequestAction separated to Injected.js

* docs clarification for approveGroupMembershipRequest

* added rejectGroupMembershipRequest method

* module fixed

* methods extension

* docs clarification

* force to update group membership requests

* docs fixed

* added usage example

* avoid sleep after the last iteration

* fix: added missing modules

* improve forcing to update group membership requests

* usage example clarification

* module refactored

* optional parameters

* usage example modified

* remove default values for membershipRequestAction

* added error description for memb req action

* usage example fixed

* return result even if ServerStatusCodeError

* default error message was missing

* removed line break
2023-10-09 18:17:02 +03:00
alechkos
ecf19eb9a5
fix: sending locations (#2339)
* added function to to modify module functions

* fix for locations to be sent

* changes for class Location

- description property was splited into name and address
- added url property
- added ability to pass name, address and url as options while creating an instance

* docs updated

* usage example updated

* added url checking

* fixed url

* updated location property in Message class

* fixed url when http prefix is provided

* injectToFunction updated to be more flexible

* docs clarification

* ESLint fix

* fix: injectToFunction fixed to work properly

* minor fix in injectToFunction

* refactor: added usage of url validator

* small change to improve performance for findImpl fix

* window.compareWwebVersions fixed
2023-09-20 23:11:52 +03:00
alechkos
df1b070d54
feat: send audio with waveform (#2309)
* added generateWaveform

* docs updated

* added usage example

* ESLint fix

* fixed: undefined returned on waveform generation failure

* fix: ESLint
2023-08-10 13:37:45 +02:00
alechkos
9b827541e6
fix for findImpl (#2390) 2023-08-10 07:24:06 +03:00
alechkos
3be7566483
fix: CallCollection (#2385)
* fix: changed module for CallCollection

* code refactored

* compareWwebVersions fixed and moved to window.compareWwebVersions

* code refactoring
2023-08-09 19:27:24 +03:00
Guilherme Mascarenhas
41e59efa72
fix: Client.getChatById(): Cannot read properties of undefined (reading '_serialized') (#2225)
* fix: Cannot read properties of undefined (reading '_serialized')

* Update supported WhatsApp Web version to v2.2321.6

* Revert "Update WhatsApp Web Version (2.2321.6)"

---------

Co-authored-by: guicuton <guicuton@users.noreply.github.com>
Co-authored-by: Rajeh Taher <rajeh@reforward.dev>
Co-authored-by: Shir Serlui <70711723+shirser121@users.noreply.github.com>
2023-08-07 18:57:23 +03:00
RendyCraft047
d959645bc3
fix: group invite v4 (#2321)
* Update Injected.js

* Update Client.js

* fix changes

* make it simple

* fix if undefined

---------

Co-authored-by: Shir Serlui <70711723+shirser121@users.noreply.github.com>
2023-08-07 06:37:56 +02:00
alechkos
8ff5bceca0
feat: send photo/video as a view once message (#2317)
* added isViewOnce property

* docs updated

* added usage example

* fix: ESLint
2023-07-31 12:53:35 +03:00
alechkos
c8c2f09f20
fix: Contact (#2325)
* fixed: contact info retrieving

* fixed: block method

* fixed: isBlocked property is now changeble

* added inner function to compare between WWeb versions

The function compares the currently used WWeb version with the version that requires the code changes. Its purpose is to ensure the stable operation of the library across different WWeb versions.

* added: todo remove useOldImplementation

* improved inner function to compare WWeb versions

* inner function: added support for beta versions

* added support for business accounts

* module queries changed to strings

* fixed check for wweb beta versions

* updated to throw a custom error message

* minor changes in inner function
2023-07-31 09:41:17 +03:00
tofers
8e8d0c9b3e
feat: Edit message (#2254)
* function edit message
2023-06-15 12:49:38 -03:00
Humberto Zambrano
3dd4463478
Fix caption in attached document sending messages (#2226)
* Caption for attached document

* Update Injected.js

---------

Co-authored-by: tuyuribr <45042245+tuyuribr@users.noreply.github.com>
Co-authored-by: Pedro S. Lopez <pedroslopez@me.com>
2023-05-29 02:38:59 -04:00
tofers
081b455fa5
hotfix: newId and deviceType (#2196)
* update method generate Msg id, newId to newIdV2

* replace newId and await in version WA 2.2321.6

* fix deviceType
2023-05-19 16:25:54 +00:00
tofers
37724f6959
fix: msg.chat (#2139)
* fix function openChatWindowAt

* fix star \ unstar

* fix function delete

* fix closeRightDrawer
2023-04-19 02:50:08 +03:00
Rajeh Taher
ac7df25075
Fix media renders (#1981)
* Fixed

* Update src/util/Injected.js

---------

Co-authored-by: tuyuribr <45042245+tuyuribr@users.noreply.github.com>
2023-04-01 17:09:28 +03:00
tofers
812ff0ddfc
lastMessage in chat (#1606)
* lastMessage in chat

* lastMessage info

* Update src/util/Injected.js

Co-authored-by: Rajeh Taher <rajeh@reforward.dev>

* fix  serialize msg

* markup

---------

Co-authored-by: tofers <tofers90>
Co-authored-by: Rajeh Taher <rajeh@reforward.dev>
2023-04-01 17:07:39 +03:00
Wictor Nogueira
dc16bbbdac
Feat: change profile/group picture (#1916)
* feat: pfp

* Make eslint happy

* Fix typo

* Fix missing comma

* Update src/util/Injected.js

* ESLint

* Update src/util/Injected.js

* mfw purp breaks indentation

---------

Co-authored-by: Rajeh Taher <rajeh@reforward.dev>
2023-04-01 04:21:09 +03:00
Mohammed Khan
4846625119
fixed version id number (#2087) 2023-03-29 03:50:23 +00:00
Macley Sousa
1854656648
fix: send media (#2074) 2023-03-18 18:12:39 -04:00
tofers
842a342f72
Fixing the queryWidExists function (#1989)
* Update Injected.js

fix function queryWidExists

* Update Injected.js

support WA old version 2.2305.7

---------

Co-authored-by: Pedro S. Lopez <pedroslopez@me.com>
2023-02-11 15:20:21 -08:00
Pedro Lopez
e8d4874b26 fix getNumberId 2023-02-11 15:18:06 -08:00
Michal Serlui
f1607752dd
try to fix queryWidExists (#1987) 2023-02-10 11:06:20 -03:00
Pedro S. Lopez
70f2391d51
fix group methods (#1934)
* fix: create group

* fix set group subject, description, properties; exit group

* fix participant methods

* fix return type

* fix invite methods
2023-01-15 17:59:20 -04:00
Pedro S. Lopez
e1917494bf
Revert "fix: Fix client-side message rendering issue when sending attachements through the library (#1905)" (#1932)
This reverts commit 7dd8688f04.
2023-01-15 14:54:50 -04:00
Rajeh Taher
7dd8688f04
fix: Fix client-side message rendering issue when sending attachements through the library (#1905) 2023-01-15 14:32:28 -04:00
Pedro S. Lopez
23d5147a14
fix: compatibility with LegacyPhoneFeatures in latest WhatsApp Web version (#1930)
* fix removed features on latest wweb version

* errors
2023-01-15 14:30:20 -04:00
Rajeh Taher
288a572af6
feat: Implement Call Rejection + Introduction of Socket API (#1882)
* Initial stage

* ESLint

* eslint is annoying

* fix: distinguish Wap from Socket's Wap
2022-12-22 16:02:49 -03:00
Pedro S. Lopez
db55d869f8
fix: delete messages for everyone (#1842) 2022-11-26 04:44:35 -04:00
Pedro S. Lopez
d9f9c28276
fix: get quoted msg (#1841) 2022-11-26 04:38:29 -04:00
Felipe Martins
82120f0446
Fix GroupMetadata module (#1789)
* Fix GroupMetadata module

* Update src/util/Injected.js

Co-authored-by: Felipe Martins <felipe.dev@virtuamax.com.br>
Co-authored-by: Rajeh Taher <rajeh@reforward.dev>
2022-11-13 12:36:06 +01:00
Pedro S. Lopez
9981723505
fix: message replies compatible with WhatsApp Web v2.2241.6 (#1765)
* fix message replies

* fix up some tests
2022-10-26 23:32:06 -04:00
Pedro S. Lopez
088ec32b7b
Support for WhatsApp Web 2.2241.6 (#1762)
* proposed fix

* Fixes

* Add condition for older versions of WA

* fix for old node version support

* fix: default to mdbackend = true

Co-authored-by: purpshell <rajeh@reforward.dev>
2022-10-26 22:43:19 -04:00
Pedro S. Lopez
36aa37f1ac
fix: set ephemeral fields and get links from messages (#1752)
* fix setting ephemeral fields

* fix missing links method
2022-10-21 00:12:02 -04:00
jurajmatus
537e843a49
Async buffer->BASE64 conversion (#1481)
* Async buffer->BASE64 conversion

* ESLint fixes
2022-08-10 16:31:04 +00:00
Wictor Nogueira
f2ec77f969
Feat: add message_reaction event (#1619)
* Add 'message_reaction' event
2022-08-09 16:09:16 -03:00
Alon Schwartzblat
61c0a6be56
Reaction feature added. (#1400)
* Fix get order.

* Fix types.

* Add set picture for profile and for groups.

* Fix bug.

* Fix

* Fix types

* Fix eslint

* Add send reaction feature.

* Add send reaction feature.

* Add set picture for profile and for groups.

* Add send reaction feature.

* Add send reaction feature.

* Add send reaction feature.

* Add send reaction feature.

* Add send reaction feature.

* Add send reaction feature.

* Update src/structures/Reaction.js

Co-authored-by: Noah van der Aa <ndvdaa@gmail.com>

* Bug fixes.

* Bug fixes.

* Bug fixes.

* Fix

* Fix

* Fix example

* Fix conflict

* Fix conflict

* Fix conflict

* Fix conflict

* Fix conflict

* Fix conflict

* move implementation to message model

Co-authored-by: Noah van der Aa <ndvdaa@gmail.com>
Co-authored-by: Pedro Lopez <pedroslopez@me.com>
2022-06-21 00:46:07 -04:00
Shir Serlui
ebc56bc280
fix: correctly get models and fetchMessages in WhatsApp Web v2.2220.8
* Fix models is undefined

* Feat models is undefined

* Feat models is undefined

* Fix loadEarlierMsgs

* use `getModelsArray()` to get models

* fix: correctly loadEarlierMsgs with ConversationMsgs module

Co-authored-by: Pedro Lopez <pedroslopez@me.com>
2022-06-09 23:41:25 -04:00
Pedro Lopez
374983b9a6 fix: find old features module 2022-04-21 17:18:47 -04:00
Rajeh Taher
5e2e9dd139
Fix: Cannot read properties of undefined (reading 'features') // original: (#1407) (#1410)
* Fix: Cannot read properties of undefined (reading 'features') (#1407)

* Fix: Cannot read properties of undefined (reading 'features')

Find MD backend without features

* Fix for tests

* Update Client.js

* Update LegacySessionAuth.js

Co-authored-by: Shir Serlui <70711723+shirser121@users.noreply.github.com>
2022-04-21 17:15:00 -04:00
༺ LᴇG̸ᴇɴD ༻
e9104b390d
Fix: Cannot read properties of undefined (reading 'getProfilePicFull') (#1362)
* Fix for issue#1356 - Cannot read properties of undefined reading getProfilePicFull

* use cross-compatible profilePicFind function

Co-authored-by: Joaquin Touris <joaquin@192.168.1.6>
Co-authored-by: Pedro Lopez <pedroslopez@me.com>
2022-03-28 23:17:55 -04:00