abmp-npm 1.9.6 → 1.9.7
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.
- package/CONTACT_EMAIL_UPDATE_DEBUG.md +313 -0
- package/DEBUG_QUICKSTART.md +133 -0
- package/backend/consts.js +0 -2
- package/backend/contacts-methods-DEBUG.js +237 -0
- package/backend/contacts-methods-TEST.js +271 -0
- package/backend/contacts-methods.js +6 -1
- package/backend/daily-pull/process-member-methods.js +1 -1
- package/backend/data-hooks.js +1 -1
- package/backend/elevated-modules.js +1 -0
- package/backend/http-functions/httpFunctions.js +15 -1
- package/backend/index.js +2 -1
- package/backend/jobs.js +2 -1
- package/backend/login/index.js +7 -0
- package/backend/login/login-methods-factory.js +24 -0
- package/backend/{qa-login-methods.js → login/qa-login-methods.js} +15 -10
- package/backend/{sso-methods.js → login/sso-methods.js} +16 -19
- package/backend/members-data-methods.js +6 -11
- package/backend/tasks/tasks-configs.js +2 -2
- package/backend/test-methods.js +118 -0
- package/backend/utils.js +1 -1
- package/package.json +1 -1
- package/pages/LoadingPage.js +1 -1
- package/pages/QAPage.js +1 -1
- package/pages/SaveAlerts.js +13 -0
- package/pages/{selecBannerImages.js → SelectBannerImages.js} +2 -2
- package/pages/deleteConfirm.js +19 -0
- package/pages/index.js +3 -1
- package/public/consts.js +1 -1
- package/public/sso-auth-methods.js +1 -1
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DEBUG WEB METHOD
|
|
3
|
+
*
|
|
4
|
+
* Instructions for use:
|
|
5
|
+
*
|
|
6
|
+
* 1. Import this in your host site's web-methods.web.js:
|
|
7
|
+
* import { runContactUpdateTests, testContactElevation } from 'abmp-npm/backend/test-methods';
|
|
8
|
+
* import { Permissions, webMethod } from 'wix-web-module';
|
|
9
|
+
*
|
|
10
|
+
* export const runContactUpdateTests = webMethod(Permissions.SiteMember, _runContactUpdateTests);
|
|
11
|
+
* export const testContactElevation = webMethod(Permissions.SiteMember, _testContactElevation);
|
|
12
|
+
*
|
|
13
|
+
* 2. Call from frontend console or page code:
|
|
14
|
+
* import { runContactUpdateTests } from 'backend/web-methods.web';
|
|
15
|
+
*
|
|
16
|
+
* // Get your contactId from your member data
|
|
17
|
+
* const results = await runContactUpdateTests('YOUR_CONTACT_ID', 'newemail@test.com');
|
|
18
|
+
* console.log('Test results:', results);
|
|
19
|
+
*
|
|
20
|
+
* 3. Check the Wix logs (Site Monitoring) for detailed output
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
const { updateMemberContactInfo } = require('./contacts-methods-DEBUG');
|
|
24
|
+
const { runAllTests, testElevation } = require('./contacts-methods-TEST');
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Run all contact update test variations
|
|
28
|
+
*/
|
|
29
|
+
async function runContactUpdateTests(contactId, newEmail) {
|
|
30
|
+
console.log(`[TEST RUNNER] Starting tests for contactId: ${contactId}, email: ${newEmail}`);
|
|
31
|
+
|
|
32
|
+
if (!contactId) {
|
|
33
|
+
throw new Error('contactId is required');
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if (!newEmail) {
|
|
37
|
+
throw new Error('newEmail is required');
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
try {
|
|
41
|
+
const results = await runAllTests(contactId, newEmail);
|
|
42
|
+
return {
|
|
43
|
+
success: true,
|
|
44
|
+
message: 'Tests completed - check logs for details',
|
|
45
|
+
results,
|
|
46
|
+
};
|
|
47
|
+
} catch (error) {
|
|
48
|
+
console.error(`[TEST RUNNER] Error:`, error);
|
|
49
|
+
return {
|
|
50
|
+
success: false,
|
|
51
|
+
error: error.message,
|
|
52
|
+
stack: error.stack,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Test if elevation is working correctly
|
|
59
|
+
*/
|
|
60
|
+
async function testContactElevation(contactId) {
|
|
61
|
+
console.log(`[TEST RUNNER] Testing elevation for contactId: ${contactId}`);
|
|
62
|
+
|
|
63
|
+
if (!contactId) {
|
|
64
|
+
throw new Error('contactId is required');
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
try {
|
|
68
|
+
const results = await testElevation(contactId);
|
|
69
|
+
return {
|
|
70
|
+
success: true,
|
|
71
|
+
message: 'Elevation test completed - check logs for details',
|
|
72
|
+
results,
|
|
73
|
+
};
|
|
74
|
+
} catch (error) {
|
|
75
|
+
console.error(`[TEST RUNNER] Error:`, error);
|
|
76
|
+
return {
|
|
77
|
+
success: false,
|
|
78
|
+
error: error.message,
|
|
79
|
+
stack: error.stack,
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Test the debug version of updateMemberContactInfo
|
|
86
|
+
*/
|
|
87
|
+
async function testUpdateMemberContactInfo(data, existingMemberData) {
|
|
88
|
+
console.log(`[TEST RUNNER] Testing updateMemberContactInfo with DEBUG logging`);
|
|
89
|
+
|
|
90
|
+
if (!data) {
|
|
91
|
+
throw new Error('data is required');
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
if (!existingMemberData) {
|
|
95
|
+
throw new Error('existingMemberData is required');
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
try {
|
|
99
|
+
await updateMemberContactInfo(data, existingMemberData);
|
|
100
|
+
return {
|
|
101
|
+
success: true,
|
|
102
|
+
message: 'updateMemberContactInfo completed - check logs for details',
|
|
103
|
+
};
|
|
104
|
+
} catch (error) {
|
|
105
|
+
console.error(`[TEST RUNNER] Error:`, error);
|
|
106
|
+
return {
|
|
107
|
+
success: false,
|
|
108
|
+
error: error.message,
|
|
109
|
+
stack: error.stack,
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
module.exports = {
|
|
115
|
+
runContactUpdateTests,
|
|
116
|
+
testContactElevation,
|
|
117
|
+
testUpdateMemberContactInfo,
|
|
118
|
+
};
|
package/backend/utils.js
CHANGED
|
@@ -154,7 +154,7 @@ const normalizeUrlForComparison = url => {
|
|
|
154
154
|
};
|
|
155
155
|
|
|
156
156
|
async function getSecret(secretKey) {
|
|
157
|
-
return await elevatedGetSecretValue(secretKey).value;
|
|
157
|
+
return (await elevatedGetSecretValue(secretKey)).value;
|
|
158
158
|
}
|
|
159
159
|
|
|
160
160
|
async function getSiteBaseUrl() {
|
package/package.json
CHANGED
package/pages/LoadingPage.js
CHANGED
|
@@ -7,7 +7,7 @@ async function loadingPageOnReady(authenticateSSOToken) {
|
|
|
7
7
|
const renderingEnv = await rendering.env();
|
|
8
8
|
//This calls needs to triggered on client side, otherwise PAC API will return 401 error
|
|
9
9
|
if (renderingEnv === 'browser') {
|
|
10
|
-
//Need to pass
|
|
10
|
+
//Need to pass authenticateSSOToken to checkAndLogin so it will run as a web method not a public one.
|
|
11
11
|
await checkAndLogin(authenticateSSOToken).catch(error => {
|
|
12
12
|
wixWindow.openLightbox(LIGHTBOX_NAMES.LOGIN_ERROR_ALERT);
|
|
13
13
|
console.error(`Something went wrong while logging in: ${error}`);
|
package/pages/QAPage.js
CHANGED
|
@@ -10,7 +10,7 @@ async function qaPageOnReady({ $w: _$w, loginQAMember }) {
|
|
|
10
10
|
throw new Error('Missing required parameters: userEmail and/or secret');
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
const result = await loginQAMember(userEmail, secret);
|
|
13
|
+
const result = await loginQAMember({ userEmail, secret });
|
|
14
14
|
|
|
15
15
|
if (!result.success || !result.token) {
|
|
16
16
|
throw new Error(result.error || 'Login failed');
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const { lightbox } = require('@wix/site-window');
|
|
2
|
+
|
|
3
|
+
async function saveAlertsOnReady({ $w: _$w }) {
|
|
4
|
+
const receivedData = await lightbox.getContext();
|
|
5
|
+
_$w('#closeButton').onClick(() => lightbox.close());
|
|
6
|
+
_$w('#cancelButton').onClick(() => lightbox.close());
|
|
7
|
+
_$w('#leaveButton').link = receivedData?.membersExternalPortalUrl;
|
|
8
|
+
_$w('#leaveButton').target = '_blank';
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
module.exports = {
|
|
12
|
+
saveAlertsOnReady,
|
|
13
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const {
|
|
1
|
+
const { lightbox } = require('@wix/site-window');
|
|
2
2
|
|
|
3
3
|
function selectBannerImagesOnReady({ $w: _$w }) {
|
|
4
4
|
_$w('#imageDataset').onReady(async () => {
|
|
@@ -37,7 +37,7 @@ function selectBannerImagesOnReady({ $w: _$w }) {
|
|
|
37
37
|
};
|
|
38
38
|
}
|
|
39
39
|
});
|
|
40
|
-
|
|
40
|
+
lightbox.close(selectedImage);
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
43
|
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const { lightbox } = require('@wix/site-window');
|
|
2
|
+
|
|
3
|
+
function deleteConfirmOnReady({ $w: _$w }) {
|
|
4
|
+
_$w('#delete').onClick(() => {
|
|
5
|
+
lightbox.close({
|
|
6
|
+
toDelete: true,
|
|
7
|
+
});
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
_$w('#cancel').onClick(() => {
|
|
11
|
+
lightbox.close({
|
|
12
|
+
toDelete: false,
|
|
13
|
+
});
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
module.exports = {
|
|
18
|
+
deleteConfirmOnReady,
|
|
19
|
+
};
|
package/pages/index.js
CHANGED
|
@@ -5,5 +5,7 @@ module.exports = {
|
|
|
5
5
|
...require('./personalDetails.js'),
|
|
6
6
|
...require('./QAPage.js'),
|
|
7
7
|
...require('./LoadingPage.js'),
|
|
8
|
-
...require('./
|
|
8
|
+
...require('./SelectBannerImages.js'),
|
|
9
|
+
...require('./deleteConfirm.js'),
|
|
10
|
+
...require('./SaveAlerts.js'),
|
|
9
11
|
};
|
package/public/consts.js
CHANGED
|
@@ -12,7 +12,7 @@ const COLLECTIONS = {
|
|
|
12
12
|
INTERESTS: 'interests',
|
|
13
13
|
STATE_CITY_MAP: 'City',
|
|
14
14
|
UPDATED_LOGIN_EMAILS: 'updatedLoginEmails',
|
|
15
|
-
|
|
15
|
+
QA_USERS: 'QA_Users', //Make QA users configurable per site
|
|
16
16
|
};
|
|
17
17
|
|
|
18
18
|
/**
|
|
@@ -9,7 +9,7 @@ const checkAndLogin = async authenticateSSOToken => {
|
|
|
9
9
|
const token = query['token']?.trim();
|
|
10
10
|
try {
|
|
11
11
|
if (token) {
|
|
12
|
-
const authObj = await authenticateSSOToken(token);
|
|
12
|
+
const authObj = await authenticateSSOToken({ token });
|
|
13
13
|
console.log('authObj', authObj);
|
|
14
14
|
if (authObj.type == 'success') {
|
|
15
15
|
console.log('success');
|