abmp-npm 1.1.82 → 1.1.84
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/backend/consts.js +2 -0
- package/backend/daily-pull/bulk-process-methods.js +21 -12
- package/backend/daily-pull/process-member-methods.js +1 -1
- package/backend/daily-pull/utils.js +14 -1
- package/backend/dev-only-methods.js +18 -0
- package/backend/index.js +1 -0
- package/backend/members-data-methods.js +13 -22
- package/backend/tasks/tasks-configs.js +1 -1
- package/backend/utils.js +5 -3
- package/dev-only-scripts/find-duplicate-urls.js +202 -0
- package/package.json +5 -3
- package/pages/Profile.js +19 -19
- package/pages/personalDetails.js +8 -0
package/backend/consts.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const PAC_API_URL = 'https://members.abmp.com/eweb/api/Wix';
|
|
2
|
+
const BACKUP_API_URL = 'https://psdevteamenterpris.wixstudio.com/abmp-backup/_functions';
|
|
2
3
|
const SSO_TOKEN_AUTH_API_URL = 'https://members.professionalassistcorp.com/';
|
|
3
4
|
|
|
4
5
|
/**
|
|
@@ -40,4 +41,5 @@ module.exports = {
|
|
|
40
41
|
COMPILED_FILTERS_FIELDS,
|
|
41
42
|
MEMBERSHIPS_TYPES,
|
|
42
43
|
SSO_TOKEN_AUTH_API_URL,
|
|
44
|
+
BACKUP_API_URL,
|
|
43
45
|
};
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
const { bulkSaveMembers, getMemberBySlug } = require('../members-data-methods');
|
|
2
2
|
|
|
3
3
|
const { generateUpdatedMemberData } = require('./process-member-methods');
|
|
4
|
-
const {
|
|
4
|
+
const {
|
|
5
|
+
changeWixMembersEmails,
|
|
6
|
+
extractUrlCounter,
|
|
7
|
+
incrementUrlCounter,
|
|
8
|
+
extractBaseUrl,
|
|
9
|
+
} = require('./utils');
|
|
5
10
|
|
|
6
11
|
/**
|
|
7
12
|
* Ensures unique URLs within a batch of members by deduplicating URLs
|
|
@@ -23,7 +28,8 @@ async function ensureUniqueUrlsInBatch(memberDataList) {
|
|
|
23
28
|
return;
|
|
24
29
|
}
|
|
25
30
|
|
|
26
|
-
|
|
31
|
+
// Extract the base URL (without any counter) for grouping
|
|
32
|
+
const baseUrl = extractBaseUrl(member.url);
|
|
27
33
|
if (!urlGroups.has(baseUrl)) {
|
|
28
34
|
urlGroups.set(baseUrl, []);
|
|
29
35
|
}
|
|
@@ -53,10 +59,10 @@ async function ensureUniqueUrlsInBatch(memberDataList) {
|
|
|
53
59
|
continue;
|
|
54
60
|
}
|
|
55
61
|
|
|
56
|
-
// Sort members to ensure consistent ordering
|
|
62
|
+
// Sort members to ensure consistent ordering
|
|
57
63
|
members.sort((a, b) => {
|
|
58
|
-
if (a.
|
|
59
|
-
return String(a.
|
|
64
|
+
if (a.url && b.url) {
|
|
65
|
+
return String(a.url).localeCompare(String(b.url));
|
|
60
66
|
}
|
|
61
67
|
return 0;
|
|
62
68
|
});
|
|
@@ -102,7 +108,9 @@ async function ensureUniqueUrlsInBatch(memberDataList) {
|
|
|
102
108
|
});
|
|
103
109
|
|
|
104
110
|
console.log(
|
|
105
|
-
`Deduplicated ${
|
|
111
|
+
`Deduplicated ${
|
|
112
|
+
members.length
|
|
113
|
+
} members with base URL "${baseUrl}" (DB max: ${dbMaxCounter}, batch max: ${batchMaxCounter}, start: ${startIndex}): ${members
|
|
106
114
|
.map(m => m.url)
|
|
107
115
|
.join(', ')}`
|
|
108
116
|
);
|
|
@@ -144,10 +152,6 @@ const bulkProcessAndSaveMemberData = async ({
|
|
|
144
152
|
const validMemberData = processedMemberDataList.filter(
|
|
145
153
|
data => data !== null && data !== undefined
|
|
146
154
|
);
|
|
147
|
-
|
|
148
|
-
// Ensure unique URLs within the batch to prevent duplicates (also checks DB for cross-page conflicts)
|
|
149
|
-
await ensureUniqueUrlsInBatch(validMemberData);
|
|
150
|
-
|
|
151
155
|
if (validMemberData.length === 0) {
|
|
152
156
|
return {
|
|
153
157
|
totalProcessed: memberDataList.length,
|
|
@@ -156,9 +160,14 @@ const bulkProcessAndSaveMemberData = async ({
|
|
|
156
160
|
processingTime: Date.now() - startTime,
|
|
157
161
|
};
|
|
158
162
|
}
|
|
163
|
+
const newMembers = validMemberData.filter(data => data.isNewToDb);
|
|
164
|
+
const existingMembers = validMemberData.filter(data => !data.isNewToDb);
|
|
165
|
+
// Ensure unique URLs within the batch to prevent duplicates (also checks DB for cross-page conflicts)
|
|
166
|
+
const uniqueUrlsNewToDBMembersList = await ensureUniqueUrlsInBatch(newMembers);
|
|
167
|
+
const uniqueUrlsMembersData = [...uniqueUrlsNewToDBMembersList, ...existingMembers];
|
|
159
168
|
const toChangeWixMembersEmails = [];
|
|
160
|
-
const toSaveMembersData =
|
|
161
|
-
const { isLoginEmailChanged, ...restMemberData } = member;
|
|
169
|
+
const toSaveMembersData = uniqueUrlsMembersData.map(member => {
|
|
170
|
+
const { isLoginEmailChanged, isNewToDb: _isNewToDb, ...restMemberData } = member;
|
|
162
171
|
if (member.contactId && isLoginEmailChanged) {
|
|
163
172
|
toChangeWixMembersEmails.push(member);
|
|
164
173
|
}
|
|
@@ -22,6 +22,18 @@ const extractUrlCounter = url => {
|
|
|
22
22
|
return isNumeric ? parseInt(lastSegment, 10) : -1;
|
|
23
23
|
};
|
|
24
24
|
|
|
25
|
+
const extractBaseUrl = url => {
|
|
26
|
+
if (!url) return url;
|
|
27
|
+
const urlParts = url.split('-');
|
|
28
|
+
const lastSegment = urlParts[urlParts.length - 1];
|
|
29
|
+
const isNumeric = /^\d+$/.test(lastSegment);
|
|
30
|
+
if (isNumeric && urlParts.length > 1) {
|
|
31
|
+
// Remove the numeric counter to get the base URL
|
|
32
|
+
return urlParts.slice(0, -1).join('-');
|
|
33
|
+
}
|
|
34
|
+
// No counter found, return the URL as-is
|
|
35
|
+
return url;
|
|
36
|
+
};
|
|
25
37
|
const incrementUrlCounter = (existingUrl, baseUrl) => {
|
|
26
38
|
if (existingUrl && existingUrl === baseUrl) {
|
|
27
39
|
console.log(
|
|
@@ -72,7 +84,7 @@ const validateCoreMemberData = inputMemberData => {
|
|
|
72
84
|
return true;
|
|
73
85
|
};
|
|
74
86
|
|
|
75
|
-
const containsNonEnglish = str => /[^a-zA-Z0-9]/.test(str); // if it contains any non-english characters, test1 is allowed,
|
|
87
|
+
const containsNonEnglish = str => /[^a-zA-Z0-9-]/.test(str); // if it contains any non-english characters or invalid URL chars, test1 is allowed, hyphens are allowed
|
|
76
88
|
|
|
77
89
|
/**
|
|
78
90
|
* Creates a full name from first and last name components
|
|
@@ -95,4 +107,5 @@ module.exports = {
|
|
|
95
107
|
createFullName,
|
|
96
108
|
extractUrlCounter,
|
|
97
109
|
incrementUrlCounter,
|
|
110
|
+
extractBaseUrl,
|
|
98
111
|
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
const { ensureUniqueUrlsInBatch } = require('./daily-pull/bulk-process-methods');
|
|
2
|
+
const { wixData } = require('./elevated-modules');
|
|
3
|
+
const { bulkSaveMembers } = require('./members-data-methods');
|
|
4
|
+
const { queryAllItems } = require('./utils');
|
|
5
|
+
|
|
6
|
+
async function deduplicateURls(collectionName, duplicateUrlsList) {
|
|
7
|
+
const query = await wixData.query(collectionName).hasSome('url', duplicateUrlsList).limit(1000);
|
|
8
|
+
const membersWithSameUrl = await queryAllItems(query);
|
|
9
|
+
|
|
10
|
+
console.log({ membersWithSameUrl });
|
|
11
|
+
const membersWithUniqueUrls = await ensureUniqueUrlsInBatch(membersWithSameUrl);
|
|
12
|
+
console.log({ membersWithUniqueUrls });
|
|
13
|
+
const deduplicatedUrls = membersWithUniqueUrls.map(m => m.url);
|
|
14
|
+
console.log({ deduplicatedUrls });
|
|
15
|
+
return await bulkSaveMembers(membersWithUniqueUrls, collectionName);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
module.exports = { deduplicateURls };
|
package/backend/index.js
CHANGED
|
@@ -61,9 +61,10 @@ async function createContactAndMemberIfNew(memberData) {
|
|
|
61
61
|
|
|
62
62
|
/** Performs bulk save operation for member data
|
|
63
63
|
* @param { Array } memberDataList - Array of member data objects to save
|
|
64
|
+
* @param { string } [collectionName] - The collection name to save the members to (default: COLLECTIONS.MEMBERS_DATA)
|
|
64
65
|
* @returns { Promise < Object >} - Bulk save operation result
|
|
65
66
|
*/
|
|
66
|
-
async function bulkSaveMembers(memberDataList) {
|
|
67
|
+
async function bulkSaveMembers(memberDataList, collectionName = COLLECTIONS.MEMBERS_DATA) {
|
|
67
68
|
if (!Array.isArray(memberDataList) || memberDataList.length === 0) {
|
|
68
69
|
throw new Error('Invalid member data list provided for bulk save');
|
|
69
70
|
}
|
|
@@ -71,9 +72,7 @@ async function bulkSaveMembers(memberDataList) {
|
|
|
71
72
|
try {
|
|
72
73
|
// bulkSave all with batches of 1000 items as this is the Velo limit for bulkSave
|
|
73
74
|
const batches = chunkArray(memberDataList, 1000);
|
|
74
|
-
return await Promise.all(
|
|
75
|
-
batches.map(batch => wixData.bulkSave(COLLECTIONS.MEMBERS_DATA, batch))
|
|
76
|
-
);
|
|
75
|
+
return await Promise.all(batches.map(batch => wixData.bulkSave(collectionName, batch)));
|
|
77
76
|
} catch (error) {
|
|
78
77
|
console.error('Error bulk saving members:', error);
|
|
79
78
|
throw new Error(`Bulk save failed: ${error.message}`);
|
|
@@ -133,7 +132,9 @@ async function getMemberBySlug({
|
|
|
133
132
|
}
|
|
134
133
|
query = query.limit(1000);
|
|
135
134
|
const searchResult = await searchAllItems(query);
|
|
136
|
-
const membersList = searchResult.filter(
|
|
135
|
+
const membersList = searchResult.filter(
|
|
136
|
+
item => item.url && item.url.toLowerCase().includes(slug.toLowerCase())
|
|
137
|
+
); //replacement for contains - case insensitive
|
|
137
138
|
let matchingMembers = membersList.filter(
|
|
138
139
|
item => item.url && item.url.toLowerCase() === slug.toLowerCase()
|
|
139
140
|
);
|
|
@@ -270,23 +271,13 @@ async function urlExists(url, excludeMemberId) {
|
|
|
270
271
|
if (!url) return false;
|
|
271
272
|
|
|
272
273
|
try {
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
const { items } = await query.find();
|
|
283
|
-
|
|
284
|
-
// Case-insensitive comparison
|
|
285
|
-
const matchingMembers = items.filter(
|
|
286
|
-
item => item.url && item.url.toLowerCase() === url.toLowerCase()
|
|
287
|
-
);
|
|
288
|
-
|
|
289
|
-
return matchingMembers.length > 0;
|
|
274
|
+
const member = await getMemberBySlug({
|
|
275
|
+
slug: url,
|
|
276
|
+
excludeDropped: false,
|
|
277
|
+
excludeSearchedMember: true,
|
|
278
|
+
memberId: excludeMemberId,
|
|
279
|
+
});
|
|
280
|
+
return member !== null;
|
|
290
281
|
} catch (error) {
|
|
291
282
|
console.error('Error checking URL existence:', error);
|
|
292
283
|
return false;
|
|
@@ -89,7 +89,7 @@ const TASKS = {
|
|
|
89
89
|
getIdentifier: () => 'SHOULD_NEVER_SKIP',
|
|
90
90
|
process: updateSiteMapS3,
|
|
91
91
|
shouldSkipCheck: () => false,
|
|
92
|
-
estimatedDurationSec:
|
|
92
|
+
estimatedDurationSec: 90,
|
|
93
93
|
},
|
|
94
94
|
[TASKS_NAMES.scheduleContactFormEmailMigration]: {
|
|
95
95
|
name: TASKS_NAMES.scheduleContactFormEmailMigration,
|
package/backend/utils.js
CHANGED
|
@@ -98,9 +98,11 @@ function getAddressesByStatus(addresses = [], addressDisplayOption = []) {
|
|
|
98
98
|
}
|
|
99
99
|
const opts = Array.isArray(addressDisplayOption) ? addressDisplayOption : [];
|
|
100
100
|
const mainOpt = opts.find(o => o.isMain);
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
101
|
+
|
|
102
|
+
// Only filter out main address if explicitly set in addressDisplayOption
|
|
103
|
+
const addressesToFormat = mainOpt ? visible.filter(addr => addr?.key !== mainOpt.key) : visible;
|
|
104
|
+
|
|
105
|
+
return addressesToFormat
|
|
104
106
|
.map(addr => {
|
|
105
107
|
const addressString = formatAddress(addr);
|
|
106
108
|
return addressString ? { _id: generateId(), address: addressString } : null;
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
|
|
4
|
+
// eslint-disable-next-line import/no-unresolved
|
|
5
|
+
const csv = require('csv-parser');
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Finds duplicate URLs in a CSV file and generates a JSON report
|
|
9
|
+
* Usage: node scripts/find-duplicate-urls.js <path-to-csv-file>
|
|
10
|
+
*/
|
|
11
|
+
function findDuplicateUrls(csvFilePath) {
|
|
12
|
+
// Validate command-line argument
|
|
13
|
+
if (!csvFilePath) {
|
|
14
|
+
console.error('Error: CSV file path is required');
|
|
15
|
+
console.error('Usage: node scripts/find-duplicate-urls.js <path-to-csv-file>');
|
|
16
|
+
process.exit(1);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// Validate file exists and is readable
|
|
20
|
+
if (!fs.existsSync(csvFilePath)) {
|
|
21
|
+
console.error(`Error: File not found: ${csvFilePath}`);
|
|
22
|
+
process.exit(1);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const urlMap = new Map(); // url -> [memberId1, memberId2, ...]
|
|
26
|
+
let totalMembers = 0;
|
|
27
|
+
let rowNumber = 0;
|
|
28
|
+
let headersValidated = false;
|
|
29
|
+
let headers = null;
|
|
30
|
+
let urlColumnName = null;
|
|
31
|
+
let memberIdColumnName = null;
|
|
32
|
+
|
|
33
|
+
return new Promise((resolve, reject) => {
|
|
34
|
+
fs.createReadStream(csvFilePath)
|
|
35
|
+
.pipe(csv())
|
|
36
|
+
.on('headers', receivedHeaders => {
|
|
37
|
+
headers = receivedHeaders;
|
|
38
|
+
// Validate required columns exist - normalize by removing quotes, trimming, and lowercasing
|
|
39
|
+
const normalizedHeaders = headers.map(h => {
|
|
40
|
+
let normalized = String(h).trim();
|
|
41
|
+
// Remove all quotes (single and double) from the string
|
|
42
|
+
normalized = normalized.replace(/["']/g, '');
|
|
43
|
+
return normalized.toLowerCase().trim();
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
// Find the actual column names for url and memberId
|
|
47
|
+
const urlIndex = normalizedHeaders.indexOf('url');
|
|
48
|
+
const memberIdIndex = normalizedHeaders.indexOf('memberid');
|
|
49
|
+
|
|
50
|
+
if (urlIndex === -1 || memberIdIndex === -1) {
|
|
51
|
+
console.error('Error: CSV must contain "url" and "memberId" columns (case-insensitive)');
|
|
52
|
+
console.error(`Found columns: ${headers.join(', ')}`);
|
|
53
|
+
console.error(`Normalized columns: ${normalizedHeaders.join(', ')}`);
|
|
54
|
+
process.exit(1);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// Store the actual column names (with original casing/quotes)
|
|
58
|
+
urlColumnName = headers[urlIndex];
|
|
59
|
+
memberIdColumnName = headers[memberIdIndex];
|
|
60
|
+
headersValidated = true;
|
|
61
|
+
})
|
|
62
|
+
.on('data', row => {
|
|
63
|
+
// Validate headers on first data row if headers event didn't fire
|
|
64
|
+
if (!headersValidated) {
|
|
65
|
+
headers = Object.keys(row);
|
|
66
|
+
// Normalize by removing quotes, trimming, and lowercasing
|
|
67
|
+
const normalizedHeaders = headers.map(h => {
|
|
68
|
+
let normalized = String(h).trim();
|
|
69
|
+
// Remove all quotes (single and double) from the string
|
|
70
|
+
normalized = normalized.replace(/["']/g, '');
|
|
71
|
+
return normalized.toLowerCase().trim();
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
const urlIndex = normalizedHeaders.indexOf('url');
|
|
75
|
+
const memberIdIndex = normalizedHeaders.indexOf('memberid');
|
|
76
|
+
|
|
77
|
+
if (urlIndex === -1 || memberIdIndex === -1) {
|
|
78
|
+
console.error(
|
|
79
|
+
'Error: CSV must contain "url" and "memberId" columns (case-insensitive)'
|
|
80
|
+
);
|
|
81
|
+
console.error(`Found columns: ${headers.join(', ')}`);
|
|
82
|
+
console.error(`Normalized columns: ${normalizedHeaders.join(', ')}`);
|
|
83
|
+
process.exit(1);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// Store the actual column names
|
|
87
|
+
urlColumnName = headers[urlIndex];
|
|
88
|
+
memberIdColumnName = headers[memberIdIndex];
|
|
89
|
+
headersValidated = true;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
rowNumber++;
|
|
93
|
+
totalMembers++;
|
|
94
|
+
|
|
95
|
+
// Get URL and memberId using the actual column names from headers
|
|
96
|
+
const url = row[urlColumnName];
|
|
97
|
+
const memberId = row[memberIdColumnName];
|
|
98
|
+
|
|
99
|
+
// Skip rows with missing URL or memberId
|
|
100
|
+
if (!url || !memberId) {
|
|
101
|
+
console.warn(
|
|
102
|
+
`Warning: Row ${rowNumber} skipped - missing url or memberId (url: ${url}, memberId: ${memberId})`
|
|
103
|
+
);
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
const trimmedUrl = url.trim();
|
|
108
|
+
const trimmedMemberId = memberId.trim();
|
|
109
|
+
|
|
110
|
+
// Track URL occurrences
|
|
111
|
+
if (!urlMap.has(trimmedUrl)) {
|
|
112
|
+
urlMap.set(trimmedUrl, []);
|
|
113
|
+
}
|
|
114
|
+
urlMap.get(trimmedUrl).push(trimmedMemberId);
|
|
115
|
+
})
|
|
116
|
+
.on('error', error => {
|
|
117
|
+
console.error('Error reading CSV file:', error.message);
|
|
118
|
+
reject(error);
|
|
119
|
+
})
|
|
120
|
+
.on('end', () => {
|
|
121
|
+
if (!headersValidated) {
|
|
122
|
+
console.error('Error: Could not read CSV headers');
|
|
123
|
+
process.exit(1);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// Find duplicates (URLs with count > 1)
|
|
127
|
+
const duplicateUrls = [];
|
|
128
|
+
let totalDuplicates = 0;
|
|
129
|
+
|
|
130
|
+
for (const [url, memberIds] of urlMap.entries()) {
|
|
131
|
+
if (memberIds.length > 1) {
|
|
132
|
+
duplicateUrls.push({
|
|
133
|
+
url: url,
|
|
134
|
+
count: memberIds.length,
|
|
135
|
+
memberIds: memberIds,
|
|
136
|
+
});
|
|
137
|
+
totalDuplicates += memberIds.length;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
// Sort by count (descending) then by URL (ascending)
|
|
142
|
+
duplicateUrls.sort((a, b) => {
|
|
143
|
+
if (b.count !== a.count) {
|
|
144
|
+
return b.count - a.count;
|
|
145
|
+
}
|
|
146
|
+
return a.url.localeCompare(b.url);
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
const totalUniqueUrls = urlMap.size;
|
|
150
|
+
const uniqueDuplicateUrls = duplicateUrls.length;
|
|
151
|
+
|
|
152
|
+
// Create a simple list of duplicated URLs (just the URL strings)
|
|
153
|
+
const duplicatedUrlsList = duplicateUrls.map(item => item.url);
|
|
154
|
+
|
|
155
|
+
// Generate report
|
|
156
|
+
const report = {
|
|
157
|
+
totalMembers: totalMembers,
|
|
158
|
+
totalUniqueUrls: totalUniqueUrls,
|
|
159
|
+
duplicateUrls: duplicateUrls,
|
|
160
|
+
duplicatedUrlsList: duplicatedUrlsList,
|
|
161
|
+
summary: {
|
|
162
|
+
totalDuplicates: totalDuplicates,
|
|
163
|
+
uniqueDuplicateUrls: uniqueDuplicateUrls,
|
|
164
|
+
},
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
// Generate output filename
|
|
168
|
+
const csvDir = path.dirname(csvFilePath);
|
|
169
|
+
const csvBasename = path.basename(csvFilePath, path.extname(csvFilePath));
|
|
170
|
+
const outputPath = path.join(csvDir, `${csvBasename}-duplicate-urls-report.json`);
|
|
171
|
+
|
|
172
|
+
// Write JSON report
|
|
173
|
+
fs.writeFileSync(outputPath, JSON.stringify(report, null, 2), 'utf8');
|
|
174
|
+
|
|
175
|
+
console.log('\n=== Duplicate URL Report ===');
|
|
176
|
+
console.log(`Total members processed: ${totalMembers}`);
|
|
177
|
+
console.log(`Total unique URLs: ${totalUniqueUrls}`);
|
|
178
|
+
console.log(`Unique URLs with duplicates: ${uniqueDuplicateUrls}`);
|
|
179
|
+
console.log(`Total duplicate entries: ${totalDuplicates}`);
|
|
180
|
+
console.log(`\nReport saved to: ${outputPath}`);
|
|
181
|
+
console.log(`\nTop 10 most duplicated URLs:`);
|
|
182
|
+
duplicateUrls.slice(0, 10).forEach((item, index) => {
|
|
183
|
+
console.log(
|
|
184
|
+
` ${index + 1}. "${item.url}" - appears ${item.count} times (memberIds: ${item.memberIds.join(', ')})`
|
|
185
|
+
);
|
|
186
|
+
});
|
|
187
|
+
|
|
188
|
+
resolve(report);
|
|
189
|
+
});
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
// Run if executed directly
|
|
194
|
+
if (require.main === module) {
|
|
195
|
+
const csvFilePath = process.argv[2];
|
|
196
|
+
findDuplicateUrls(csvFilePath).catch(error => {
|
|
197
|
+
console.error('Fatal error:', error.message);
|
|
198
|
+
process.exit(1);
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
module.exports = { findDuplicateUrls };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "abmp-npm",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.84",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"check-cycles": "madge --circular .",
|
|
@@ -9,7 +9,8 @@
|
|
|
9
9
|
"lint:fix": "eslint . --fix",
|
|
10
10
|
"format": "prettier --write \"**/*.{js,json,md}\"",
|
|
11
11
|
"format:check": "prettier --check \"**/*.{js,json,md}\"",
|
|
12
|
-
"prepare": "husky"
|
|
12
|
+
"prepare": "husky",
|
|
13
|
+
"find-duplicates": "node dev-only-scripts/find-duplicate-urls.js"
|
|
13
14
|
},
|
|
14
15
|
"author": "",
|
|
15
16
|
"license": "ISC",
|
|
@@ -30,7 +31,7 @@
|
|
|
30
31
|
"dependencies": {
|
|
31
32
|
"@wix/automations": "^1.0.261",
|
|
32
33
|
"@wix/crm": "^1.0.1061",
|
|
33
|
-
"@wix/data": "^1.0.
|
|
34
|
+
"@wix/data": "^1.0.349",
|
|
34
35
|
"@wix/essentials": "^0.1.28",
|
|
35
36
|
"@wix/identity": "^1.0.178",
|
|
36
37
|
"@wix/media": "^1.0.213",
|
|
@@ -46,6 +47,7 @@
|
|
|
46
47
|
"crypto": "^1.0.1",
|
|
47
48
|
"jwt-js-decode": "^1.9.0",
|
|
48
49
|
"lodash": "^4.17.21",
|
|
50
|
+
"csv-parser": "^3.0.0",
|
|
49
51
|
"ngeohash": "^0.6.3",
|
|
50
52
|
"phone": "^3.1.67",
|
|
51
53
|
"psdev-task-manager": "1.1.7",
|
package/pages/Profile.js
CHANGED
|
@@ -52,7 +52,7 @@ async function profileOnReady({ $w: _$w }) {
|
|
|
52
52
|
profileData.mainAddress
|
|
53
53
|
);
|
|
54
54
|
} else {
|
|
55
|
-
|
|
55
|
+
deleteElements(['#locationContainer', '#location1Container', '#locationContainer2']);
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
setupAdditionalAddresses();
|
|
@@ -98,7 +98,7 @@ async function profileOnReady({ $w: _$w }) {
|
|
|
98
98
|
if (profileData.memberSince) {
|
|
99
99
|
_$w('#sinceYearText').text = profileData.memberSince;
|
|
100
100
|
} else {
|
|
101
|
-
_$w('#memberSinceBox').
|
|
101
|
+
_$w('#memberSinceBox').delete();
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
104
|
|
|
@@ -106,7 +106,7 @@ async function profileOnReady({ $w: _$w }) {
|
|
|
106
106
|
if (profileData.shouldHaveStudentBadge) {
|
|
107
107
|
_$w('#studentContainer, #studentContainerMobile').expand();
|
|
108
108
|
} else {
|
|
109
|
-
_$w('#studentContainer, #studentContainerMobile').
|
|
109
|
+
_$w('#studentContainer, #studentContainerMobile').delete();
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
112
|
|
|
@@ -114,7 +114,7 @@ async function profileOnReady({ $w: _$w }) {
|
|
|
114
114
|
if (profileData.logoImage) {
|
|
115
115
|
_$w('#logoImage').src = profileData.logoImage;
|
|
116
116
|
} else {
|
|
117
|
-
_$w('#logoImage').
|
|
117
|
+
_$w('#logoImage').delete();
|
|
118
118
|
}
|
|
119
119
|
|
|
120
120
|
if (profileData.profileImage) {
|
|
@@ -131,7 +131,7 @@ async function profileOnReady({ $w: _$w }) {
|
|
|
131
131
|
profileData.fullName
|
|
132
132
|
);
|
|
133
133
|
} else {
|
|
134
|
-
|
|
134
|
+
deleteElements(['#fullNameText', '#fullNameText2', '#fullNameTextFoter']);
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
137
|
|
|
@@ -149,7 +149,7 @@ async function profileOnReady({ $w: _$w }) {
|
|
|
149
149
|
wixWindow.openLightbox(LIGHTBOX_NAMES.CONTACT_US, profileData)
|
|
150
150
|
);
|
|
151
151
|
} else {
|
|
152
|
-
_$w('#contactButton').
|
|
152
|
+
_$w('#contactButton').delete();
|
|
153
153
|
}
|
|
154
154
|
}
|
|
155
155
|
|
|
@@ -157,7 +157,7 @@ async function profileOnReady({ $w: _$w }) {
|
|
|
157
157
|
if (profileData.bookingUrl) {
|
|
158
158
|
_$w('#bookNowButton').link = profileData.bookingUrl;
|
|
159
159
|
} else {
|
|
160
|
-
_$w('#bookNowButton').
|
|
160
|
+
_$w('#bookNowButton').delete();
|
|
161
161
|
}
|
|
162
162
|
}
|
|
163
163
|
|
|
@@ -172,7 +172,7 @@ async function profileOnReady({ $w: _$w }) {
|
|
|
172
172
|
_$w('#phoneText').html = getPhoneHTML(_$w('#phoneText'));
|
|
173
173
|
_$w('#phoneText2').html = getPhoneHTML(_$w('#phoneText2'));
|
|
174
174
|
} else {
|
|
175
|
-
|
|
175
|
+
deleteElements(['#phoneContainer', '#phoneContainer2']);
|
|
176
176
|
}
|
|
177
177
|
}
|
|
178
178
|
|
|
@@ -180,7 +180,7 @@ async function profileOnReady({ $w: _$w }) {
|
|
|
180
180
|
if (profileData.licenceNo) {
|
|
181
181
|
_$w('#licenceNoText').text = profileData.licenceNo;
|
|
182
182
|
} else {
|
|
183
|
-
_$w('#licensesContainer').
|
|
183
|
+
_$w('#licensesContainer').delete();
|
|
184
184
|
}
|
|
185
185
|
}
|
|
186
186
|
|
|
@@ -194,7 +194,7 @@ async function profileOnReady({ $w: _$w }) {
|
|
|
194
194
|
if (profileData.aboutService) {
|
|
195
195
|
_$w('#aboutYouText').html = profileData.aboutService;
|
|
196
196
|
} else {
|
|
197
|
-
_$w('#aboutSection').
|
|
197
|
+
_$w('#aboutSection').delete();
|
|
198
198
|
}
|
|
199
199
|
}
|
|
200
200
|
|
|
@@ -203,7 +203,7 @@ async function profileOnReady({ $w: _$w }) {
|
|
|
203
203
|
_$w('#businessName').text = profileData.businessName;
|
|
204
204
|
_$w('#businessName').expand();
|
|
205
205
|
} else {
|
|
206
|
-
_$w('#businessName').
|
|
206
|
+
_$w('#businessName').delete();
|
|
207
207
|
}
|
|
208
208
|
}
|
|
209
209
|
|
|
@@ -213,13 +213,13 @@ async function profileOnReady({ $w: _$w }) {
|
|
|
213
213
|
if (areasText) {
|
|
214
214
|
_$w('#areaOfPracticesText').text = areasText;
|
|
215
215
|
} else {
|
|
216
|
-
_$w('#areaOfPracticesText').
|
|
216
|
+
_$w('#areaOfPracticesText').delete();
|
|
217
217
|
}
|
|
218
218
|
|
|
219
219
|
if (Array.isArray(profileData.areasOfPractices) && profileData.areasOfPractices.length > 0) {
|
|
220
220
|
populateRepeater(profileData.areasOfPractices, '#areaOfPracticesRepeater', '#practiceText');
|
|
221
221
|
} else {
|
|
222
|
-
_$w('#servicesSection').
|
|
222
|
+
_$w('#servicesSection').delete();
|
|
223
223
|
}
|
|
224
224
|
}
|
|
225
225
|
|
|
@@ -229,16 +229,16 @@ async function profileOnReady({ $w: _$w }) {
|
|
|
229
229
|
}
|
|
230
230
|
|
|
231
231
|
if (!profileData.gallery?.length) {
|
|
232
|
-
_$w('#gallerySection').
|
|
232
|
+
_$w('#gallerySection').delete();
|
|
233
233
|
} else {
|
|
234
234
|
_$w('#gallery').items = profileData.gallery;
|
|
235
|
-
_$w('#gallerySection').
|
|
235
|
+
_$w('#gallerySection').restore();
|
|
236
236
|
}
|
|
237
237
|
}
|
|
238
238
|
|
|
239
239
|
function bindTestimonialsData() {
|
|
240
240
|
if (!profileData.testimonials?.length) {
|
|
241
|
-
_$w('#testimonialsSection').
|
|
241
|
+
_$w('#testimonialsSection').delete();
|
|
242
242
|
}
|
|
243
243
|
}
|
|
244
244
|
|
|
@@ -267,7 +267,7 @@ async function profileOnReady({ $w: _$w }) {
|
|
|
267
267
|
setupTestimonialsPagination(profileData.testimonials);
|
|
268
268
|
_$w('#testimonialsSection').expand();
|
|
269
269
|
} else {
|
|
270
|
-
_$w('#testimonialsSection').
|
|
270
|
+
_$w('#testimonialsSection').delete();
|
|
271
271
|
}
|
|
272
272
|
}
|
|
273
273
|
|
|
@@ -283,9 +283,9 @@ async function profileOnReady({ $w: _$w }) {
|
|
|
283
283
|
});
|
|
284
284
|
}
|
|
285
285
|
|
|
286
|
-
function
|
|
286
|
+
function deleteElements(elementIds) {
|
|
287
287
|
elementIds.forEach(id => {
|
|
288
|
-
_$w(id).
|
|
288
|
+
_$w(id).delete();
|
|
289
289
|
});
|
|
290
290
|
}
|
|
291
291
|
|
package/pages/personalDetails.js
CHANGED
|
@@ -1106,6 +1106,7 @@ async function personalDetailsOnReady({
|
|
|
1106
1106
|
});
|
|
1107
1107
|
_$w('#profileLink').text = newProfileLink;
|
|
1108
1108
|
_$w('#profileLink').link = newProfileLink;
|
|
1109
|
+
_$w('#urlWebsiteText').text = newProfileLink;
|
|
1109
1110
|
|
|
1110
1111
|
_$w(SLUG_FLAGS.VALID).collapse();
|
|
1111
1112
|
_$w(SLUG_FLAGS.INVALID).collapse();
|
|
@@ -1858,8 +1859,15 @@ async function personalDetailsOnReady({
|
|
|
1858
1859
|
itemMemberObj.toShowPhone = null;
|
|
1859
1860
|
}
|
|
1860
1861
|
|
|
1862
|
+
if (itemMemberObj.phones) {
|
|
1863
|
+
itemMemberObj.phones = itemMemberObj.phones.filter(
|
|
1864
|
+
phone => phone !== phoneToRemove.phoneNumber
|
|
1865
|
+
);
|
|
1866
|
+
}
|
|
1867
|
+
|
|
1861
1868
|
const updatedData = currentData.filter(item => item._id !== phoneId);
|
|
1862
1869
|
renderPhonesList(updatedData);
|
|
1870
|
+
checkFormChanges(FORM_SECTION_HANDLER_MAP.CONTACT_BOOKING);
|
|
1863
1871
|
}
|
|
1864
1872
|
}
|
|
1865
1873
|
|