abmp-npm 2.0.78 → 2.0.79
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
CHANGED
package/pages/Profile.js
CHANGED
|
@@ -6,6 +6,7 @@ const {
|
|
|
6
6
|
generateId,
|
|
7
7
|
formatPracticeAreasForDisplay,
|
|
8
8
|
isWixHostedImage,
|
|
9
|
+
normalizeExternalUrl,
|
|
9
10
|
} = require('../public/Utils/sharedUtils');
|
|
10
11
|
|
|
11
12
|
const TESTIMONIALS_PER_PAGE_CONFIG = {
|
|
@@ -159,7 +160,11 @@ async function profileOnReady({ $w: _$w }) {
|
|
|
159
160
|
|
|
160
161
|
function bindBookingUrl() {
|
|
161
162
|
if (profileData.bookingUrl) {
|
|
162
|
-
|
|
163
|
+
// Normalised for the same reason the directory does it (see Home.js): some
|
|
164
|
+
// stored booking URLs have no protocol, and a bare hostname would be treated
|
|
165
|
+
// as a path on this site rather than an external link, so the button would
|
|
166
|
+
// point at abmpmembers.com/<their-domain> and go nowhere.
|
|
167
|
+
_$w('#bookNowButton').link = normalizeExternalUrl(profileData.bookingUrl);
|
|
163
168
|
} else {
|
|
164
169
|
_$w('#bookNowButton').delete();
|
|
165
170
|
}
|
|
@@ -12,13 +12,24 @@ function isNotValidUrl(url) {
|
|
|
12
12
|
// Empty URLs are considered valid (optional field)
|
|
13
13
|
if (!url) return false;
|
|
14
14
|
|
|
15
|
-
//
|
|
16
|
-
//
|
|
17
|
-
//
|
|
18
|
-
//
|
|
19
|
-
//
|
|
15
|
+
// Handles all TLDs including multi-level, plus paths, query strings and anchors.
|
|
16
|
+
//
|
|
17
|
+
// The protocol is OPTIONAL. Members routinely type a bare hostname such as
|
|
18
|
+
// "patty-10439.square.site", which is what they see in their browser. Requiring
|
|
19
|
+
// http:// or www. rejected that and blocked the whole Business & Services save.
|
|
20
|
+
// getContactAndBookingData already runs the value through normalizeExternalUrl on
|
|
21
|
+
// save, so a bare hostname is stored with https:// prepended - accepting it here
|
|
22
|
+
// is what lets that happen.
|
|
23
|
+
//
|
|
24
|
+
// Dropping the explicit `www.` branch loses nothing: "www.example.com" still
|
|
25
|
+
// matches as host "www.example" plus TLD ".com".
|
|
26
|
+
//
|
|
27
|
+
// The host class is `[\da-z.-]` (digit, letter, dot, hyphen). It once read
|
|
28
|
+
// `[da-z.-]`, which - missing the backslash - matched only a literal "d" plus a-z,
|
|
29
|
+
// so any domain containing a digit was rejected. The `i` flag keeps mixed-case
|
|
30
|
+
// hosts valid; domains are case-insensitive.
|
|
20
31
|
const urlRegex =
|
|
21
|
-
/^(https
|
|
32
|
+
/^(https?:\/\/)?([\da-z.-]+)\.([a-z.]{2,})([/\w .-]*)*(\?[&\w=.-]*)?(#[&\w=.-]*)?\/?$/i;
|
|
22
33
|
|
|
23
34
|
return !urlRegex.test(url);
|
|
24
35
|
}
|