abmp-npm 2.0.76 → 2.0.78
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/package.json +8 -1
- package/pages/Home.js +27 -55
- package/pages/index.js +0 -1
- package/public/Utils/personalDetailsUtils.js +5 -1
- package/public/Utils/sharedUtils.js +32 -0
- package/public/consts.js +0 -1
- package/.claude/worktrees/fix-save-button-disable/.husky/pre-commit +0 -19
- package/.claude/worktrees/fix-save-button-disable/.prettierignore +0 -7
- package/.claude/worktrees/fix-save-button-disable/.prettierrc.json +0 -16
- package/.claude/worktrees/fix-save-button-disable/README.md +0 -1
- package/.claude/worktrees/fix-save-button-disable/backend/README-member-contact-flows.md +0 -136
- package/.claude/worktrees/fix-save-button-disable/backend/__tests__/daily-pull-execution-check.test.js +0 -124
- package/.claude/worktrees/fix-save-button-disable/backend/__tests__/ensure-unique-urls-in-batch.test.js +0 -129
- package/.claude/worktrees/fix-save-button-disable/backend/__tests__/login-email-sync.test.js +0 -49
- package/.claude/worktrees/fix-save-button-disable/backend/__tests__/transient-retry-and-bulk-lookup.test.js +0 -129
- package/.claude/worktrees/fix-save-button-disable/backend/__tests__/url-uniqueness.test.js +0 -194
- package/.claude/worktrees/fix-save-button-disable/backend/automations-methods.js +0 -13
- package/.claude/worktrees/fix-save-button-disable/backend/cms-data-methods.js +0 -251
- package/.claude/worktrees/fix-save-button-disable/backend/consts.js +0 -58
- package/.claude/worktrees/fix-save-button-disable/backend/contacts-methods.js +0 -67
- package/.claude/worktrees/fix-save-button-disable/backend/daily-pull/bulk-process-methods.js +0 -222
- package/.claude/worktrees/fix-save-button-disable/backend/daily-pull/consts.js +0 -39
- package/.claude/worktrees/fix-save-button-disable/backend/daily-pull/index.js +0 -5
- package/.claude/worktrees/fix-save-button-disable/backend/daily-pull/process-member-methods.js +0 -213
- package/.claude/worktrees/fix-save-button-disable/backend/daily-pull/schedule-methods.js +0 -41
- package/.claude/worktrees/fix-save-button-disable/backend/daily-pull/sync-to-cms-methods.js +0 -161
- package/.claude/worktrees/fix-save-button-disable/backend/daily-pull/utils.js +0 -151
- package/.claude/worktrees/fix-save-button-disable/backend/data-hooks.js +0 -29
- package/.claude/worktrees/fix-save-button-disable/backend/dev-only-methods.js +0 -58
- package/.claude/worktrees/fix-save-button-disable/backend/elevated-modules.js +0 -18
- package/.claude/worktrees/fix-save-button-disable/backend/forms-methods.js +0 -52
- package/.claude/worktrees/fix-save-button-disable/backend/http-functions/httpFunctions.js +0 -86
- package/.claude/worktrees/fix-save-button-disable/backend/http-functions/index.js +0 -3
- package/.claude/worktrees/fix-save-button-disable/backend/http-functions/interests.js +0 -35
- package/.claude/worktrees/fix-save-button-disable/backend/index.js +0 -19
- package/.claude/worktrees/fix-save-button-disable/backend/jobs.js +0 -158
- package/.claude/worktrees/fix-save-button-disable/backend/login/generate-member-session-token.js +0 -27
- package/.claude/worktrees/fix-save-button-disable/backend/login/index.js +0 -8
- package/.claude/worktrees/fix-save-button-disable/backend/login/qa-login-methods.js +0 -54
- package/.claude/worktrees/fix-save-button-disable/backend/login/sso-methods.js +0 -159
- package/.claude/worktrees/fix-save-button-disable/backend/member-contact-orchestration.js +0 -111
- package/.claude/worktrees/fix-save-button-disable/backend/members-area-methods.js +0 -88
- package/.claude/worktrees/fix-save-button-disable/backend/members-data-methods.js +0 -789
- package/.claude/worktrees/fix-save-button-disable/backend/pac-api-methods.js +0 -54
- package/.claude/worktrees/fix-save-button-disable/backend/routers/index.js +0 -3
- package/.claude/worktrees/fix-save-button-disable/backend/routers/methods.js +0 -191
- package/.claude/worktrees/fix-save-button-disable/backend/routers/utils.js +0 -128
- package/.claude/worktrees/fix-save-button-disable/backend/search-filters-methods.js +0 -124
- package/.claude/worktrees/fix-save-button-disable/backend/tasks/address-primary-methods.js +0 -256
- package/.claude/worktrees/fix-save-button-disable/backend/tasks/address-visibility-methods.js +0 -160
- package/.claude/worktrees/fix-save-button-disable/backend/tasks/consts.js +0 -34
- package/.claude/worktrees/fix-save-button-disable/backend/tasks/daily-pull-check-methods.js +0 -78
- package/.claude/worktrees/fix-save-button-disable/backend/tasks/email-normalize-methods.js +0 -134
- package/.claude/worktrees/fix-save-button-disable/backend/tasks/index.js +0 -10
- package/.claude/worktrees/fix-save-button-disable/backend/tasks/migration-methods.js +0 -46
- package/.claude/worktrees/fix-save-button-disable/backend/tasks/tasks-configs.js +0 -251
- package/.claude/worktrees/fix-save-button-disable/backend/tasks/tasks-helpers-methods.js +0 -433
- package/.claude/worktrees/fix-save-button-disable/backend/tasks/tasks-process-methods.js +0 -606
- package/.claude/worktrees/fix-save-button-disable/backend/tasks/url-migration-methods.js +0 -378
- package/.claude/worktrees/fix-save-button-disable/backend/tasks/url-space-fix-methods.js +0 -174
- package/.claude/worktrees/fix-save-button-disable/backend/utils.js +0 -277
- package/.claude/worktrees/fix-save-button-disable/dev-only-scripts/extract-duplicate-url-groups.js +0 -201
- package/.claude/worktrees/fix-save-button-disable/dev-only-scripts/find-duplicate-ids.js +0 -159
- package/.claude/worktrees/fix-save-button-disable/dev-only-scripts/find-duplicate-urls.js +0 -201
- package/.claude/worktrees/fix-save-button-disable/eslint.config.js +0 -120
- package/.claude/worktrees/fix-save-button-disable/index.js +0 -5
- package/.claude/worktrees/fix-save-button-disable/package-lock.json +0 -12160
- package/.claude/worktrees/fix-save-button-disable/package.json +0 -60
- package/.claude/worktrees/fix-save-button-disable/pages/ContactUs.js +0 -129
- package/.claude/worktrees/fix-save-button-disable/pages/Home.js +0 -779
- package/.claude/worktrees/fix-save-button-disable/pages/LearnMore.js +0 -27
- package/.claude/worktrees/fix-save-button-disable/pages/LoadingPage.js +0 -29
- package/.claude/worktrees/fix-save-button-disable/pages/Profile.js +0 -354
- package/.claude/worktrees/fix-save-button-disable/pages/QAPage.js +0 -39
- package/.claude/worktrees/fix-save-button-disable/pages/SaveAlerts.js +0 -13
- package/.claude/worktrees/fix-save-button-disable/pages/SelectBannerImages.js +0 -46
- package/.claude/worktrees/fix-save-button-disable/pages/deleteConfirm.js +0 -19
- package/.claude/worktrees/fix-save-button-disable/pages/index.js +0 -12
- package/.claude/worktrees/fix-save-button-disable/pages/personalDetails.js +0 -2486
- package/.claude/worktrees/fix-save-button-disable/public/Utils/homePage.js +0 -798
- package/.claude/worktrees/fix-save-button-disable/public/Utils/personalDetailsUtils.js +0 -25
- package/.claude/worktrees/fix-save-button-disable/public/Utils/sharedUtils.js +0 -235
- package/.claude/worktrees/fix-save-button-disable/public/consts.js +0 -113
- package/.claude/worktrees/fix-save-button-disable/public/index.js +0 -5
- package/.claude/worktrees/fix-save-button-disable/public/messages.js +0 -16
- package/.claude/worktrees/fix-save-button-disable/public/sso-auth-methods.js +0 -43
- package/.husky/pre-commit +0 -19
- package/.prettierignore +0 -7
- package/.prettierrc.json +0 -16
- package/backend/__tests__/daily-pull-execution-check.test.js +0 -124
- package/backend/__tests__/ensure-unique-urls-in-batch.test.js +0 -129
- package/backend/__tests__/login-email-sync.test.js +0 -49
- package/backend/__tests__/transient-retry-and-bulk-lookup.test.js +0 -129
- package/backend/__tests__/url-uniqueness.test.js +0 -194
- package/dev-only-scripts/extract-duplicate-url-groups.js +0 -201
- package/dev-only-scripts/find-duplicate-ids.js +0 -159
- package/dev-only-scripts/find-duplicate-urls.js +0 -201
- package/eslint.config.js +0 -120
- package/pages/contactForLocation.js +0 -28
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
// handle custom validation for url inputs
|
|
2
|
-
function handleOnCustomValidation(element) {
|
|
3
|
-
element.onCustomValidation((value, reject) => {
|
|
4
|
-
if (isNotValidUrl(value)) {
|
|
5
|
-
reject('Please enter a valid URL');
|
|
6
|
-
}
|
|
7
|
-
});
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
// check if url is not valid using regex
|
|
11
|
-
function isNotValidUrl(url) {
|
|
12
|
-
// Empty URLs are considered valid (optional field)
|
|
13
|
-
if (!url) return false;
|
|
14
|
-
|
|
15
|
-
// URL must start with protocol OR www - handles all TLDs including multi-level and query params
|
|
16
|
-
const urlRegex =
|
|
17
|
-
/^(https?:\/\/|www\.)([da-z.-]+)\.([a-z.]{2,})([/\w .-]*)*(\?[&\w=.-]*)?(#[&\w=.-]*)?\/?$/;
|
|
18
|
-
|
|
19
|
-
return !urlRegex.test(url);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
module.exports = {
|
|
23
|
-
handleOnCustomValidation,
|
|
24
|
-
isNotValidUrl,
|
|
25
|
-
};
|
|
@@ -1,235 +0,0 @@
|
|
|
1
|
-
const { ADDRESS_STATUS_TYPES, DEBOUNCE_DELAY } = require('../consts.js');
|
|
2
|
-
|
|
3
|
-
const checkAddressIsVisible = (addresses = []) => {
|
|
4
|
-
// ensure we always get an array
|
|
5
|
-
if (!Array.isArray(addresses)) return [];
|
|
6
|
-
|
|
7
|
-
return addresses.filter(
|
|
8
|
-
val => val.addressStatus === undefined || val.addressStatus !== ADDRESS_STATUS_TYPES.DONT_SHOW
|
|
9
|
-
);
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
//Formats an array of practice areas, showing as many as fit within 70 characters
|
|
13
|
-
function formatPracticeAreasForDisplay(areaOfPractices = []) {
|
|
14
|
-
// always return a string
|
|
15
|
-
if (!Array.isArray(areaOfPractices) || areaOfPractices.length === 0) {
|
|
16
|
-
return '';
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
// Filter out null/undefined/empty
|
|
20
|
-
const validAreas = areaOfPractices.filter(
|
|
21
|
-
area => area !== null && area !== undefined && area !== ''
|
|
22
|
-
);
|
|
23
|
-
|
|
24
|
-
if (validAreas.length === 0) {
|
|
25
|
-
return '';
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
if (validAreas.length === 1) {
|
|
29
|
-
return validAreas[0].length > 70 ? validAreas[0].substring(0, 67) + '...' : validAreas[0];
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
// build up to 70-char string
|
|
33
|
-
let current = '';
|
|
34
|
-
const visible = [];
|
|
35
|
-
for (const item of validAreas) {
|
|
36
|
-
const sep = visible.length ? ', ' : '';
|
|
37
|
-
const next = current + sep + item;
|
|
38
|
-
if (next.length > 70) break;
|
|
39
|
-
visible.push(item);
|
|
40
|
-
current = next;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
// if nothing fit, at least show the first (truncated)
|
|
44
|
-
if (visible.length === 0) {
|
|
45
|
-
const first = validAreas[0];
|
|
46
|
-
return first.length > 67 ? first.substring(0, 67) + '...' : first;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
const remaining = validAreas.length - visible.length;
|
|
50
|
-
return remaining > 0 ? `${visible.join(', ')}, +${remaining} Techniques` : visible.join(', ');
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
function debouncedFunction({ func, debounceTimeout, timeoutType, args }) {
|
|
54
|
-
return new Promise(resolve => {
|
|
55
|
-
debounceTimeout[timeoutType] = setTimeout(async () => {
|
|
56
|
-
try {
|
|
57
|
-
const response = await func(args);
|
|
58
|
-
resolve({ success: true, response });
|
|
59
|
-
} catch (error) {
|
|
60
|
-
console.error('Error updating results:', error);
|
|
61
|
-
resolve({ success: false, error });
|
|
62
|
-
}
|
|
63
|
-
}, DEBOUNCE_DELAY[timeoutType]);
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
const isValidLocation = location => location.latitude && location.longitude;
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* @param {Array} addressDisplayOption
|
|
71
|
-
* @param {Array} addresses
|
|
72
|
-
* @param {Object|boolean} [options] - Optional. Pass { requireValidCoordinates: true } for home search/distance; omit or false for profile display.
|
|
73
|
-
*/
|
|
74
|
-
function findMainAddress(addressDisplayOption = [], addresses = [], options = {}) {
|
|
75
|
-
const requireValidCoordinates =
|
|
76
|
-
typeof options === 'boolean' ? options : Boolean(options?.requireValidCoordinates);
|
|
77
|
-
const optionsArr = Array.isArray(addressDisplayOption) ? addressDisplayOption : [];
|
|
78
|
-
const mainOpt = optionsArr.find(opt => opt.isMain);
|
|
79
|
-
if (mainOpt) {
|
|
80
|
-
const mainAddr = addresses.find(
|
|
81
|
-
addr =>
|
|
82
|
-
addr.key === mainOpt.key &&
|
|
83
|
-
addr.addressStatus !== ADDRESS_STATUS_TYPES.DONT_SHOW &&
|
|
84
|
-
(!requireValidCoordinates || isValidLocation(addr))
|
|
85
|
-
);
|
|
86
|
-
if (mainAddr) {
|
|
87
|
-
return mainAddr;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
const visibleAddresses = addresses.filter(
|
|
91
|
-
addr =>
|
|
92
|
-
addr.addressStatus !== ADDRESS_STATUS_TYPES.DONT_SHOW &&
|
|
93
|
-
(!requireValidCoordinates || isValidLocation(addr))
|
|
94
|
-
);
|
|
95
|
-
if (visibleAddresses.length) {
|
|
96
|
-
return visibleAddresses[0];
|
|
97
|
-
}
|
|
98
|
-
return '';
|
|
99
|
-
}
|
|
100
|
-
function formatAddress(item) {
|
|
101
|
-
if (!item) return '';
|
|
102
|
-
let addressParts = [];
|
|
103
|
-
const limitedPostalCode = (item.postalcode && String(item.postalcode).slice(0, 5)) || ''; //show only 5 digits to not show full user address
|
|
104
|
-
const status = item.addressStatus;
|
|
105
|
-
switch (status) {
|
|
106
|
-
case ADDRESS_STATUS_TYPES.FULL_ADDRESS:
|
|
107
|
-
addressParts = [item.line1, item.line2, item.city, item.state, limitedPostalCode];
|
|
108
|
-
break;
|
|
109
|
-
case ADDRESS_STATUS_TYPES.STATE_CITY_ZIP:
|
|
110
|
-
addressParts = [item.city, item.state, limitedPostalCode];
|
|
111
|
-
break;
|
|
112
|
-
default:
|
|
113
|
-
if (status === ADDRESS_STATUS_TYPES.DONT_SHOW) return '';
|
|
114
|
-
// Legacy addresses may have no addressStatus; show city/state/zip by default
|
|
115
|
-
addressParts = [item.city, item.state, limitedPostalCode];
|
|
116
|
-
break;
|
|
117
|
-
}
|
|
118
|
-
return addressParts.filter(Boolean).join(', ');
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
* @param {Array} addressDisplayOption
|
|
123
|
-
* @param {Array} addresses
|
|
124
|
-
* @param {Object|boolean} [options] - Optional. Pass { requireValidCoordinates: true } for home search/distance; omit or false for profile display.
|
|
125
|
-
*/
|
|
126
|
-
function getMainAddress(addressDisplayOption = [], addresses = [], options = {}) {
|
|
127
|
-
const mainAddr = findMainAddress(addressDisplayOption, addresses, options);
|
|
128
|
-
if (mainAddr) {
|
|
129
|
-
return formatAddress(mainAddr);
|
|
130
|
-
}
|
|
131
|
-
return '';
|
|
132
|
-
}
|
|
133
|
-
function shuffleArray(array) {
|
|
134
|
-
const shuffled = [...array];
|
|
135
|
-
for (let i = shuffled.length - 1; i > 0; i--) {
|
|
136
|
-
const j = Math.floor(Math.random() * (i + 1));
|
|
137
|
-
[shuffled[i], shuffled[j]] = [shuffled[j], shuffled[i]];
|
|
138
|
-
}
|
|
139
|
-
return shuffled;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
function toRadians(degrees) {
|
|
143
|
-
return degrees * (Math.PI / 180);
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
function calculateDistance(location1, location2) {
|
|
147
|
-
if (!isValidLocation(location1) || !isValidLocation(location2)) {
|
|
148
|
-
return null;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
// Earth's radius in miles
|
|
152
|
-
const earthRadius = 3958.8;
|
|
153
|
-
|
|
154
|
-
// Convert latitude and longitude from degrees to radians
|
|
155
|
-
const latRad1 = toRadians(location1.latitude);
|
|
156
|
-
const lonRad1 = toRadians(location1.longitude);
|
|
157
|
-
const latRad2 = toRadians(location2.latitude);
|
|
158
|
-
const lonRad2 = toRadians(location2.longitude);
|
|
159
|
-
|
|
160
|
-
// Differences in coordinates
|
|
161
|
-
const latDiff = latRad2 - latRad1;
|
|
162
|
-
const lonDiff = lonRad2 - lonRad1;
|
|
163
|
-
|
|
164
|
-
// Haversine formula
|
|
165
|
-
const a =
|
|
166
|
-
Math.sin(latDiff / 2) * Math.sin(latDiff / 2) +
|
|
167
|
-
Math.cos(latRad1) * Math.cos(latRad2) * Math.sin(lonDiff / 2) * Math.sin(lonDiff / 2);
|
|
168
|
-
const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
|
|
169
|
-
const distance = earthRadius * c;
|
|
170
|
-
|
|
171
|
-
return distance;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
/**
|
|
175
|
-
* Generate a unique ID
|
|
176
|
-
* @returns {string} Unique identifier
|
|
177
|
-
*/
|
|
178
|
-
function generateId() {
|
|
179
|
-
return `${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
function isWixHostedImage(imageUrl) {
|
|
183
|
-
return (
|
|
184
|
-
imageUrl?.trim() &&
|
|
185
|
-
(imageUrl?.startsWith('wix:') || imageUrl?.startsWith('https://static.wixstatic.com'))
|
|
186
|
-
);
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
/** Web URLs only: bare hostnames get https:// so they are not treated as site-relative paths. */
|
|
190
|
-
function normalizeExternalUrl(url) {
|
|
191
|
-
if (!url || typeof url !== 'string') return url;
|
|
192
|
-
const trimmed = url.trim();
|
|
193
|
-
if (!trimmed) return trimmed;
|
|
194
|
-
if (/^https?:\/\//i.test(trimmed)) return trimmed;
|
|
195
|
-
return `https://${trimmed}`;
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
/**
|
|
199
|
-
* Normalizes an email for comparison (lowercased + trimmed).
|
|
200
|
-
* Wix CRM treats emails as case-insensitive, so comparisons must too.
|
|
201
|
-
* @param {string} email
|
|
202
|
-
* @returns {string}
|
|
203
|
-
*/
|
|
204
|
-
function normalizeEmail(email) {
|
|
205
|
-
return typeof email === 'string' ? email.trim().toLowerCase() : '';
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
/**
|
|
209
|
-
* Case-insensitive email equality. Two empty/missing emails are not considered a match.
|
|
210
|
-
* @param {string} a
|
|
211
|
-
* @param {string} b
|
|
212
|
-
* @returns {boolean}
|
|
213
|
-
*/
|
|
214
|
-
function emailsMatch(a, b) {
|
|
215
|
-
const normalizedA = normalizeEmail(a);
|
|
216
|
-
const normalizedB = normalizeEmail(b);
|
|
217
|
-
return Boolean(normalizedA) && normalizedA === normalizedB;
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
module.exports = {
|
|
221
|
-
checkAddressIsVisible,
|
|
222
|
-
formatPracticeAreasForDisplay,
|
|
223
|
-
debouncedFunction,
|
|
224
|
-
findMainAddress,
|
|
225
|
-
getMainAddress,
|
|
226
|
-
shuffleArray,
|
|
227
|
-
calculateDistance,
|
|
228
|
-
toRadians,
|
|
229
|
-
generateId,
|
|
230
|
-
formatAddress,
|
|
231
|
-
isWixHostedImage,
|
|
232
|
-
normalizeExternalUrl,
|
|
233
|
-
normalizeEmail,
|
|
234
|
-
emailsMatch,
|
|
235
|
-
};
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
const REGEX = {
|
|
2
|
-
NAME: /^[a-zA-Z\s'-]{2,}$/,
|
|
3
|
-
MESSAGE: /^[A-Za-z0-9\s.,!?'"-]{2,}$/,
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
const COLLECTIONS = {
|
|
7
|
-
MEMBERS_DATA: 'MembersDataLatest',
|
|
8
|
-
CONTACT_US_SUBMISSIONS: 'contactUsSubmissions',
|
|
9
|
-
SITE_CONFIGS: 'SiteConfigs',
|
|
10
|
-
COMPILED_STATE_CITY_MAP: 'CompiledStateCityMap',
|
|
11
|
-
STATE: 'State',
|
|
12
|
-
INTERESTS: 'interests',
|
|
13
|
-
STATE_CITY_MAP: 'City',
|
|
14
|
-
UPDATED_LOGIN_EMAILS: 'updatedLoginEmails',
|
|
15
|
-
QA_USERS: 'QA_Users', //Make QA users configurable per site
|
|
16
|
-
BUTTON_CLICKS: 'ButtonClicks',
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Address display status types
|
|
21
|
-
*/
|
|
22
|
-
const ADDRESS_STATUS_TYPES = {
|
|
23
|
-
FULL_ADDRESS: 'full_address',
|
|
24
|
-
STATE_CITY_ZIP: 'state_city_zip',
|
|
25
|
-
DONT_SHOW: 'dont_show',
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
const DEFAULT_FILTER = {
|
|
29
|
-
skip: 0,
|
|
30
|
-
limit: 12,
|
|
31
|
-
practiceAreas: [],
|
|
32
|
-
practiceAreasSearch: '',
|
|
33
|
-
latitude: 0,
|
|
34
|
-
longitude: 0,
|
|
35
|
-
postalcode: null,
|
|
36
|
-
state: [],
|
|
37
|
-
stateSearch: '',
|
|
38
|
-
citySearch: '',
|
|
39
|
-
city: [],
|
|
40
|
-
searchText: null,
|
|
41
|
-
};
|
|
42
|
-
const DROPDOWN_OPTIONS = {
|
|
43
|
-
state: {
|
|
44
|
-
selectedOptions: [],
|
|
45
|
-
displayText: '',
|
|
46
|
-
},
|
|
47
|
-
city: {
|
|
48
|
-
selectedOptions: [],
|
|
49
|
-
displayText: '',
|
|
50
|
-
},
|
|
51
|
-
practiceAreas: {
|
|
52
|
-
selectedOptions: [],
|
|
53
|
-
displayText: '',
|
|
54
|
-
},
|
|
55
|
-
};
|
|
56
|
-
const DEBOUNCE_DELAY = {
|
|
57
|
-
searchTimeout: 1000,
|
|
58
|
-
filterTimeout: 300,
|
|
59
|
-
zeroTimeout: 0,
|
|
60
|
-
};
|
|
61
|
-
const MEMBERS_FIELDS = {
|
|
62
|
-
_id: '_id',
|
|
63
|
-
profileImage: 'profileImage',
|
|
64
|
-
fullName: 'fullName',
|
|
65
|
-
addresses: 'addresses',
|
|
66
|
-
aboutService: 'aboutService',
|
|
67
|
-
showBookingUrl: 'showBookingUrl',
|
|
68
|
-
bookingUrl: 'bookingUrl',
|
|
69
|
-
areasOfPractices: 'areasOfPractices',
|
|
70
|
-
url: 'url',
|
|
71
|
-
phones: 'phones',
|
|
72
|
-
toShowPhone: 'toShowPhone',
|
|
73
|
-
showContactForm: 'showContactForm',
|
|
74
|
-
website: 'website',
|
|
75
|
-
showWixUrl: 'showWixUrl',
|
|
76
|
-
memberships: 'memberships',
|
|
77
|
-
showWebsite: 'showWebsite',
|
|
78
|
-
addressDisplayOption: 'addressDisplayOption',
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
const LIGHTBOX_NAMES = {
|
|
82
|
-
SAVE_ALERT: 'Save Alert',
|
|
83
|
-
LOGIN_ERROR_ALERT: 'loginError',
|
|
84
|
-
DELETE_CONFIRM: 'deleteConfirm',
|
|
85
|
-
SELECT_BANNER_IMAGES: 'Select Banner Images',
|
|
86
|
-
CONTACT_US: 'Contact Us',
|
|
87
|
-
MAIN_ADDRESS_ERROR: 'mainAddressError',
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
const FREE_WEBSITE_TEXT_STATES = {
|
|
91
|
-
ENABLED: 'This is the default and will auto-populate with the information entered on this page.',
|
|
92
|
-
DISABLED: 'To deactivate, please opt in via Personal Details.',
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
const DEFAULT_BUSINESS_NAME_TEXT = 'Business name not provided';
|
|
96
|
-
const PAGES_PATHS = {
|
|
97
|
-
PROFILE: 'profile',
|
|
98
|
-
MEMBERS_FORM: 'directory-website-update',
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
module.exports = {
|
|
102
|
-
REGEX,
|
|
103
|
-
COLLECTIONS,
|
|
104
|
-
ADDRESS_STATUS_TYPES,
|
|
105
|
-
DEFAULT_FILTER,
|
|
106
|
-
DROPDOWN_OPTIONS,
|
|
107
|
-
DEBOUNCE_DELAY,
|
|
108
|
-
MEMBERS_FIELDS,
|
|
109
|
-
LIGHTBOX_NAMES,
|
|
110
|
-
FREE_WEBSITE_TEXT_STATES,
|
|
111
|
-
DEFAULT_BUSINESS_NAME_TEXT,
|
|
112
|
-
PAGES_PATHS,
|
|
113
|
-
};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
const VALIDATION_MESSAGES = {
|
|
2
|
-
CONTACT_US: {
|
|
3
|
-
FIRST_NAME: 'Please enter a valid first name.',
|
|
4
|
-
LAST_NAME: 'Please enter a valid last name.',
|
|
5
|
-
MESSAGE: 'Please enter a valid message.',
|
|
6
|
-
PHONE: 'Please enter a valid US phone number.',
|
|
7
|
-
CAPTCHA: 'Please fix the highlighted fields before captcha verification.',
|
|
8
|
-
INVALID_FIELDS: 'Please fix the highlighted fields before submitting.',
|
|
9
|
-
SUBMISSION_FAILED: 'An error occurred. Please try again.',
|
|
10
|
-
SUBMISSION_SUCCESS: 'Contact submitted successfully',
|
|
11
|
-
},
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
module.exports = {
|
|
15
|
-
VALIDATION_MESSAGES,
|
|
16
|
-
};
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
const { location: wixLocationFrontend } = require('@wix/site-location');
|
|
2
|
-
const { authentication } = require('@wix/site-members');
|
|
3
|
-
const { local } = require('@wix/site-storage');
|
|
4
|
-
|
|
5
|
-
const { PAGES_PATHS } = require('./consts');
|
|
6
|
-
|
|
7
|
-
const checkAndLogin = async authenticateSSOToken => {
|
|
8
|
-
const query = await wixLocationFrontend.query();
|
|
9
|
-
const token = query['token']?.trim();
|
|
10
|
-
try {
|
|
11
|
-
if (token) {
|
|
12
|
-
const authObj = await authenticateSSOToken({ token });
|
|
13
|
-
console.log('authObj', authObj);
|
|
14
|
-
if (authObj.type == 'success') {
|
|
15
|
-
console.log('success');
|
|
16
|
-
await Promise.all([
|
|
17
|
-
authentication.applySessionToken(authObj?.sessionToken),
|
|
18
|
-
local.setItem('memberId', authObj.memberId),
|
|
19
|
-
]);
|
|
20
|
-
console.log('memberId', authObj.memberId);
|
|
21
|
-
const queryParams = {
|
|
22
|
-
...query,
|
|
23
|
-
token: authObj?.memberId,
|
|
24
|
-
};
|
|
25
|
-
const redirectTo = `${PAGES_PATHS.MEMBERS_FORM}?${new URLSearchParams(queryParams).toString()}`;
|
|
26
|
-
await wixLocationFrontend.to(`/${redirectTo}`);
|
|
27
|
-
} else {
|
|
28
|
-
console.error('Something went wrong while logging in');
|
|
29
|
-
throw new Error('Authentication failed - invalid response from server');
|
|
30
|
-
}
|
|
31
|
-
} else {
|
|
32
|
-
console.log('checkAndLogin: No token found');
|
|
33
|
-
throw new Error('No authentication token found in URL');
|
|
34
|
-
}
|
|
35
|
-
} catch (error) {
|
|
36
|
-
console.error('Error in checkAndLogin', error);
|
|
37
|
-
throw error;
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
module.exports = {
|
|
42
|
-
checkAndLogin,
|
|
43
|
-
};
|
package/.husky/pre-commit
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
echo "Running ESLint check..."
|
|
2
|
-
npm run lint
|
|
3
|
-
|
|
4
|
-
if [ $? -ne 0 ]; then
|
|
5
|
-
echo "❌ ESLint check failed. Please fix the linting errors before committing."
|
|
6
|
-
exit 1
|
|
7
|
-
fi
|
|
8
|
-
|
|
9
|
-
echo "Running Prettier check..."
|
|
10
|
-
npm run format:check
|
|
11
|
-
|
|
12
|
-
if [ $? -ne 0 ]; then
|
|
13
|
-
echo "❌ Prettier check failed. Please format your code before committing."
|
|
14
|
-
echo "Run 'npm run format' to automatically format your files."
|
|
15
|
-
exit 1
|
|
16
|
-
fi
|
|
17
|
-
|
|
18
|
-
echo "✅ All checks passed!"
|
|
19
|
-
|
package/.prettierignore
DELETED
package/.prettierrc.json
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"singleQuote": true,
|
|
3
|
-
"trailingComma": "es5",
|
|
4
|
-
"printWidth": 100,
|
|
5
|
-
"tabWidth": 2,
|
|
6
|
-
"semi": true,
|
|
7
|
-
"bracketSpacing": true,
|
|
8
|
-
"bracketSameLine": false,
|
|
9
|
-
"arrowParens": "avoid",
|
|
10
|
-
"endOfLine": "lf",
|
|
11
|
-
"quoteProps": "as-needed",
|
|
12
|
-
"jsxSingleQuote": false,
|
|
13
|
-
"requirePragma": false,
|
|
14
|
-
"insertPragma": false,
|
|
15
|
-
"proseWrap": "preserve"
|
|
16
|
-
}
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
jest.mock('../elevated-modules', () => ({
|
|
2
|
-
wixData: { query: jest.fn() },
|
|
3
|
-
}));
|
|
4
|
-
jest.mock('psdev-task-manager', () => ({ taskManager: jest.fn() }));
|
|
5
|
-
|
|
6
|
-
const { taskManager } = require('psdev-task-manager');
|
|
7
|
-
|
|
8
|
-
const { buildDailyPullTasks } = require('../daily-pull/schedule-methods');
|
|
9
|
-
const { wixData } = require('../elevated-modules');
|
|
10
|
-
const { TASKS_NAMES } = require('../tasks/consts');
|
|
11
|
-
const { dailyPullExecutionCheck } = require('../tasks/daily-pull-check-methods');
|
|
12
|
-
|
|
13
|
-
const makeQueryResult = items => ({ items, hasNext: () => false });
|
|
14
|
-
|
|
15
|
-
const mockTasksQuery = items => {
|
|
16
|
-
const query = {
|
|
17
|
-
hasSome: jest.fn().mockReturnThis(),
|
|
18
|
-
ge: jest.fn().mockReturnThis(),
|
|
19
|
-
find: jest.fn().mockResolvedValue(makeQueryResult(items)),
|
|
20
|
-
};
|
|
21
|
-
wixData.query.mockReturnValue(query);
|
|
22
|
-
return query;
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
describe('buildDailyPullTasks', () => {
|
|
26
|
-
test('schedules one ScheduleMembersDataPerAction task per action, excluding none by default', () => {
|
|
27
|
-
const tasks = buildDailyPullTasks();
|
|
28
|
-
|
|
29
|
-
expect(tasks.map(task => task.data.action).sort()).toEqual(['drop', 'new', 'update']);
|
|
30
|
-
tasks.forEach(task => {
|
|
31
|
-
expect(task.name).toBe(TASKS_NAMES.ScheduleMembersDataPerAction);
|
|
32
|
-
expect(task.type).toBe('scheduled');
|
|
33
|
-
expect(task.data).toEqual({ action: task.data.action });
|
|
34
|
-
});
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
test('includes the none action and flag when includeNone is set', () => {
|
|
38
|
-
const tasks = buildDailyPullTasks({ includeNone: true });
|
|
39
|
-
|
|
40
|
-
expect(tasks.map(task => task.data.action).sort()).toEqual(['drop', 'new', 'none', 'update']);
|
|
41
|
-
tasks.forEach(task => expect(task.data.includeNone).toBe(true));
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
test('propagates isTestEnvironment and backupDate to every task', () => {
|
|
45
|
-
const tasks = buildDailyPullTasks({ isTestEnvironment: true, backupDate: '2026-06-01' });
|
|
46
|
-
|
|
47
|
-
tasks.forEach(task => {
|
|
48
|
-
expect(task.data.isTestEnvironment).toBe(true);
|
|
49
|
-
expect(task.data.backupDate).toBe('2026-06-01');
|
|
50
|
-
});
|
|
51
|
-
});
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
describe('dailyPullExecutionCheck', () => {
|
|
55
|
-
let scheduleInBulk;
|
|
56
|
-
|
|
57
|
-
beforeEach(() => {
|
|
58
|
-
wixData.query.mockReset();
|
|
59
|
-
scheduleInBulk = jest.fn().mockResolvedValue(undefined);
|
|
60
|
-
taskManager.mockReturnValue({ scheduleInBulk });
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
test('counts the per-action tasks the cron creates as evidence the pull ran', async () => {
|
|
64
|
-
const query = mockTasksQuery([{ name: TASKS_NAMES.ScheduleMembersDataPerAction }]);
|
|
65
|
-
|
|
66
|
-
const result = await dailyPullExecutionCheck({});
|
|
67
|
-
|
|
68
|
-
expect(query.hasSome).toHaveBeenCalledWith('name', [
|
|
69
|
-
TASKS_NAMES.ScheduleMembersDataPerAction,
|
|
70
|
-
TASKS_NAMES.ScheduleDailyMembersDataSync,
|
|
71
|
-
]);
|
|
72
|
-
expect(result.success).toBe(true);
|
|
73
|
-
expect(result.fallbackScheduled).toBeUndefined();
|
|
74
|
-
expect(scheduleInBulk).not.toHaveBeenCalled();
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
test('schedules the per-action fallback with environment flags when no pull is found', async () => {
|
|
78
|
-
mockTasksQuery([]);
|
|
79
|
-
|
|
80
|
-
const result = await dailyPullExecutionCheck({ isTestEnvironment: true, includeNone: true });
|
|
81
|
-
|
|
82
|
-
expect(result.success).toBe(false);
|
|
83
|
-
expect(result.fallbackScheduled).toBe(true);
|
|
84
|
-
expect(scheduleInBulk).toHaveBeenCalledTimes(1);
|
|
85
|
-
const scheduledTasks = scheduleInBulk.mock.calls[0][0];
|
|
86
|
-
expect(scheduledTasks.map(task => task.data.action).sort()).toEqual([
|
|
87
|
-
'drop',
|
|
88
|
-
'new',
|
|
89
|
-
'none',
|
|
90
|
-
'update',
|
|
91
|
-
]);
|
|
92
|
-
scheduledTasks.forEach(task => {
|
|
93
|
-
expect(task.name).toBe(TASKS_NAMES.ScheduleMembersDataPerAction);
|
|
94
|
-
expect(task.data.isTestEnvironment).toBe(true);
|
|
95
|
-
expect(task.data.includeNone).toBe(true);
|
|
96
|
-
});
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
test('fallback defaults to production flags when no task data is provided', async () => {
|
|
100
|
-
mockTasksQuery([]);
|
|
101
|
-
|
|
102
|
-
await dailyPullExecutionCheck(undefined);
|
|
103
|
-
|
|
104
|
-
const scheduledTasks = scheduleInBulk.mock.calls[0][0];
|
|
105
|
-
expect(scheduledTasks.map(task => task.data.action).sort()).toEqual(['drop', 'new', 'update']);
|
|
106
|
-
scheduledTasks.forEach(task => {
|
|
107
|
-
expect(task.data.isTestEnvironment).toBeUndefined();
|
|
108
|
-
expect(task.data.includeNone).toBeUndefined();
|
|
109
|
-
});
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
test('uses the provided lookback window', async () => {
|
|
113
|
-
const query = mockTasksQuery([{ name: TASKS_NAMES.ScheduleDailyMembersDataSync }]);
|
|
114
|
-
const before = Date.now();
|
|
115
|
-
|
|
116
|
-
const result = await dailyPullExecutionCheck({ hoursBack: 12 });
|
|
117
|
-
|
|
118
|
-
const sinceDate = query.ge.mock.calls[0][1];
|
|
119
|
-
expect(query.ge).toHaveBeenCalledWith('_createdDate', expect.any(Date));
|
|
120
|
-
const expectedSince = before - 12 * 60 * 60 * 1000;
|
|
121
|
-
expect(Math.abs(sinceDate.getTime() - expectedSince)).toBeLessThan(5000);
|
|
122
|
-
expect(result.success).toBe(true);
|
|
123
|
-
});
|
|
124
|
-
});
|