abmp-npm 1.1.97 → 1.1.98
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/members-data-methods.js +3 -2
- package/backend/routers/methods.js +6 -1
- package/backend/tasks/tasks-helpers-methods.js +2 -5
- package/package.json +1 -1
- package/pages/Home.js +2 -1
- package/pages/Profile.js +6 -2
- package/pages/personalDetails.js +9 -3
- package/public/Utils/sharedUtils.js +8 -0
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const { COLLECTIONS } = require('../public/consts');
|
|
2
|
+
const { isWixHostedImage } = require('../public/Utils/sharedUtils');
|
|
2
3
|
|
|
3
4
|
const { MEMBERSHIPS_TYPES } = require('./consts');
|
|
4
5
|
const { updateMemberContactInfo, createContact } = require('./contacts-methods');
|
|
@@ -328,9 +329,9 @@ async function getAllMembersWithExternalImages() {
|
|
|
328
329
|
|
|
329
330
|
const allItems = await queryAllItems(membersQuery);
|
|
330
331
|
|
|
331
|
-
// Filter for external images (not
|
|
332
|
+
// Filter for external images (not 'wix hosted images')
|
|
332
333
|
const membersWithExternalImages = allItems.filter(
|
|
333
|
-
member => member.profileImage && !member.profileImage
|
|
334
|
+
member => member.profileImage && !isWixHostedImage(member.profileImage)
|
|
334
335
|
);
|
|
335
336
|
|
|
336
337
|
return membersWithExternalImages;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const { PAGES_PATHS } = require('../../public/consts');
|
|
2
|
+
const { isWixHostedImage } = require('../../public/Utils/sharedUtils');
|
|
2
3
|
//const { fetchAllItemsInParallel } = require('../cms-data-methods'); unused at host site
|
|
3
4
|
const { CONFIG_KEYS } = require('../consts');
|
|
4
5
|
const { getSiteConfigs } = require('../utils');
|
|
@@ -27,7 +28,11 @@ const createRoutersHandlers = wixRouterMethods => {
|
|
|
27
28
|
const defaultProfileImage = siteConfigs[CONFIG_KEYS.DEFAULT_PROFILE_IMAGE];
|
|
28
29
|
const profileData = await getMemberProfileData(slug, siteAssociation);
|
|
29
30
|
if (profileData && profileData.showWixUrl) {
|
|
30
|
-
const
|
|
31
|
+
const profileImage =
|
|
32
|
+
profileData.profileImage?.trim() && isWixHostedImage(profileData.profileImage)
|
|
33
|
+
? profileData.profileImage
|
|
34
|
+
: defaultProfileImage;
|
|
35
|
+
const ogImage = profileImage || profileData.logoImage || siteLogoUrl;
|
|
31
36
|
const seoTitle = generateSEOTitle({
|
|
32
37
|
fullName: profileData.fullName,
|
|
33
38
|
areasOfPractices: profileData.areasOfPractices,
|
|
@@ -5,6 +5,7 @@ const aws4 = require('aws4');
|
|
|
5
5
|
const axios = require('axios');
|
|
6
6
|
|
|
7
7
|
const { PAGES_PATHS } = require('../../public/consts');
|
|
8
|
+
const { isWixHostedImage } = require('../../public/Utils/sharedUtils');
|
|
8
9
|
const { findMemberByWixDataId, updateMember } = require('../members-data-methods');
|
|
9
10
|
const { getSecret, getSiteBaseUrl, encodeXml, formatDateOnly } = require('../utils');
|
|
10
11
|
|
|
@@ -140,11 +141,7 @@ async function updateMemberProfileImage(memberId) {
|
|
|
140
141
|
const member = await findMemberByWixDataId(memberId);
|
|
141
142
|
const trimmedProfileImage = member.profileImage.trim();
|
|
142
143
|
// Check if member has an external profile image URL
|
|
143
|
-
if (
|
|
144
|
-
!trimmedProfileImage ||
|
|
145
|
-
trimmedProfileImage.startsWith('wix:') ||
|
|
146
|
-
trimmedProfileImage.startsWith('https://static.wixstatic.com')
|
|
147
|
-
) {
|
|
144
|
+
if (!trimmedProfileImage || isWixHostedImage(trimmedProfileImage)) {
|
|
148
145
|
console.log(`Member ${memberId} already has Wix-hosted image or no image`);
|
|
149
146
|
return { success: true, message: 'No update needed' };
|
|
150
147
|
}
|
package/package.json
CHANGED
package/pages/Home.js
CHANGED
|
@@ -9,6 +9,7 @@ const {
|
|
|
9
9
|
getMainAddress,
|
|
10
10
|
formatPracticeAreasForDisplay,
|
|
11
11
|
checkAddressIsVisible,
|
|
12
|
+
isWixHostedImage,
|
|
12
13
|
} = require('../public/Utils/sharedUtils.js');
|
|
13
14
|
|
|
14
15
|
let filter = JSON.parse(JSON.stringify(DEFAULT_FILTER));
|
|
@@ -187,7 +188,7 @@ const homePageOnReady = async ({
|
|
|
187
188
|
: [];
|
|
188
189
|
|
|
189
190
|
// 2) Profile image
|
|
190
|
-
if (itemData.profileImage) {
|
|
191
|
+
if (itemData.profileImage?.trim() && isWixHostedImage(itemData.profileImage)) {
|
|
191
192
|
$item('#profileImage').src = itemData.profileImage;
|
|
192
193
|
}
|
|
193
194
|
|
package/pages/Profile.js
CHANGED
|
@@ -2,7 +2,11 @@ const { location: wixLocation } = require('@wix/site-location');
|
|
|
2
2
|
const { window: wixWindow } = require('@wix/site-window');
|
|
3
3
|
|
|
4
4
|
const { LIGHTBOX_NAMES } = require('../public/consts');
|
|
5
|
-
const {
|
|
5
|
+
const {
|
|
6
|
+
generateId,
|
|
7
|
+
formatPracticeAreasForDisplay,
|
|
8
|
+
isWixHostedImage,
|
|
9
|
+
} = require('../public/Utils/sharedUtils');
|
|
6
10
|
|
|
7
11
|
const TESTIMONIALS_PER_PAGE_CONFIG = {
|
|
8
12
|
DESKTOP: 4,
|
|
@@ -117,7 +121,7 @@ async function profileOnReady({ $w: _$w }) {
|
|
|
117
121
|
_$w('#logoImage').delete();
|
|
118
122
|
}
|
|
119
123
|
|
|
120
|
-
if (profileData.profileImage) {
|
|
124
|
+
if (profileData.profileImage && isWixHostedImage(profileData.profileImage)) {
|
|
121
125
|
_$w('#profileImage').src = profileData.profileImage;
|
|
122
126
|
} else {
|
|
123
127
|
_$w('#profileImage').src = profileData.defaultProfileImage;
|
package/pages/personalDetails.js
CHANGED
|
@@ -9,7 +9,7 @@ const {
|
|
|
9
9
|
LIGHTBOX_NAMES,
|
|
10
10
|
} = require('../public/consts');
|
|
11
11
|
const { handleOnCustomValidation, isNotValidUrl } = require('../public/Utils/personalDetailsUtils');
|
|
12
|
-
const { generateId } = require('../public/Utils/sharedUtils');
|
|
12
|
+
const { generateId, isWixHostedImage } = require('../public/Utils/sharedUtils');
|
|
13
13
|
|
|
14
14
|
const MAX_PHONES_COUNT = 10;
|
|
15
15
|
const MAX_ADDRESSES_COUNT = 10;
|
|
@@ -793,8 +793,14 @@ async function personalDetailsOnReady({
|
|
|
793
793
|
: null
|
|
794
794
|
: itemMemberObj[key];
|
|
795
795
|
|
|
796
|
-
if (imageValue) {
|
|
797
|
-
|
|
796
|
+
if (imageValue && imageValue?.trim()) {
|
|
797
|
+
// Only set profile image if it's Wix-hosted; other images will always be wix url
|
|
798
|
+
const isProfileImage = imageSelector === '#profileImage';
|
|
799
|
+
const shouldSetImage = !isProfileImage || isWixHostedImage(imageValue);
|
|
800
|
+
|
|
801
|
+
if (shouldSetImage) {
|
|
802
|
+
_$w(imageSelector).src = imageValue;
|
|
803
|
+
}
|
|
798
804
|
_$w(nameSelector).text = formatFileName(extractFileName(imageValue));
|
|
799
805
|
_$w(containerSelector).expand();
|
|
800
806
|
uploadedImages[key === 'bannerImages' ? 'bannerImage' : key] = imageValue;
|
|
@@ -158,6 +158,13 @@ function generateId() {
|
|
|
158
158
|
return `${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
|
|
159
159
|
}
|
|
160
160
|
|
|
161
|
+
function isWixHostedImage(imageUrl) {
|
|
162
|
+
return (
|
|
163
|
+
imageUrl?.trim() &&
|
|
164
|
+
(imageUrl?.startsWith('wix:') || imageUrl?.startsWith('https://static.wixstatic.com'))
|
|
165
|
+
);
|
|
166
|
+
}
|
|
167
|
+
|
|
161
168
|
module.exports = {
|
|
162
169
|
checkAddressIsVisible,
|
|
163
170
|
formatPracticeAreasForDisplay,
|
|
@@ -169,4 +176,5 @@ module.exports = {
|
|
|
169
176
|
toRadians,
|
|
170
177
|
generateId,
|
|
171
178
|
formatAddress,
|
|
179
|
+
isWixHostedImage,
|
|
172
180
|
};
|