abmp-npm 1.8.27 → 1.8.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const { contacts } = require('@wix/crm');
|
|
2
|
+
const { auth } = require('@wix/essentials');
|
|
2
3
|
|
|
3
4
|
const { COLLECTIONS } = require('../public/consts');
|
|
4
5
|
|
|
@@ -13,6 +14,9 @@ const {
|
|
|
13
14
|
urlExists,
|
|
14
15
|
} = require('./utils');
|
|
15
16
|
|
|
17
|
+
const elevatedGetContact = auth.elevate(contacts.getContact);
|
|
18
|
+
const elevatedUpdateContact = auth.elevate(contacts.updateContact);
|
|
19
|
+
|
|
16
20
|
/**
|
|
17
21
|
* Retrieves member data by member ID
|
|
18
22
|
* @param {string} memberId - The member ID to search for
|
|
@@ -144,11 +148,12 @@ async function updateContactInfo(contactId, updateInfoCallback, operationName) {
|
|
|
144
148
|
}
|
|
145
149
|
|
|
146
150
|
try {
|
|
147
|
-
const contact = await
|
|
151
|
+
const contact = await elevatedGetContact(contactId);
|
|
152
|
+
console.log('contact from updateContactInfo', contact);
|
|
148
153
|
const currentInfo = contact.info;
|
|
149
154
|
const updatedInfo = updateInfoCallback(currentInfo);
|
|
150
155
|
|
|
151
|
-
await
|
|
156
|
+
await elevatedUpdateContact(contactId, { info: updatedInfo });
|
|
152
157
|
} catch (error) {
|
|
153
158
|
console.error(`Error in ${operationName}:`, error);
|
|
154
159
|
throw new Error(`Failed to ${operationName}: ${error.message}`);
|