fix(vcard): parse vcard module (#1995)

* fix(vcard): parse vcard module

* fix(vcard): eslint

* refactor: merge internal modules into VCardUtils

* fix: use proper modules for parsing vcards

* feat: add usage example

* chore: eslint fix

* fix: send vcard with email

Co-authored-by: KH Soh <2169449+khsoh@users.noreply.github.com>

* feat: add additional context to usage example

* refactor: revert module rename

---------

Co-authored-by: Codeboss <131376628+codebossdev@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>
Co-authored-by: KH Soh <2169449+khsoh@users.noreply.github.com>
This commit is contained in:
CyrilLacroix 2025-06-02 21:08:45 +02:00 • committed by GitHub
commit c142c3bf93
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 31 additions and 2 deletions

View file

@ -67,7 +67,6 @@ exports.ExposeStore = () => {
window.Store.ContactMethods = window.require('WAWebContactGetters');
window.Store.UserConstructor = window.require('WAWebWid');
window.Store.Validators = window.require('WALinkify');
window.Store.VCard = window.require('WAWebFrontendVcardUtils');
window.Store.WidFactory = window.require('WAWebWidFactory');
window.Store.ProfilePic = window.require('WAWebContactProfilePicThumbBridge');
window.Store.PresenceUtils = window.require('WAWebPresenceChatAction');
@ -112,6 +111,11 @@ exports.ExposeStore = () => {
window.Store.ForwardUtils = {
...window.require('WAWebForwardMessagesToChat')
};
window.Store.VCard = {
...window.require('WAWebFrontendVcardUtils'),
...window.require('WAWebVcardParsingUtils'),
...window.require('WAWebVcardGetNameFromParsed')
};
window.Store.StickerTools = {
...window.require('WAWebImageUtils'),
...window.require('WAWebAddWebpMetadata')

View file

@ -135,11 +135,12 @@ exports.LoadUtils = () => {
vcardOptions = {
type: 'multi_vcard',
vcardList: vcards,
body: undefined
body: null
};
delete options.contactCardList;
} else if (options.parseVCards && typeof (content) === 'string' && content.startsWith('BEGIN:VCARD')) {
delete options.parseVCards;
delete options.linkPreview;
try {
const parsed = window.Store.VCard.parseVcard(content);
if (parsed) {