abmp-npm 1.8.2 → 1.8.4

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "abmp-npm",
3
- "version": "1.8.2",
3
+ "version": "1.8.4",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",
package/pages/Profile.js CHANGED
@@ -1,7 +1,7 @@
1
1
  const { location: wixLocation } = require('@wix/site-location');
2
2
  const { window: wixWindow } = require('@wix/site-window');
3
3
 
4
- const { generateId, prepareText } = require('../public/utils');
4
+ const { generateId, formatPracticeAreasForDisplay } = require('../public/Utils/sharedUtils');
5
5
 
6
6
  const TESTIMONIALS_PER_PAGE_CONFIG = {
7
7
  DESKTOP: 4,
@@ -14,8 +14,8 @@ const BREAKPOINTS = {
14
14
  TABLET: 750,
15
15
  };
16
16
 
17
- function profileOnReady({ $w: _$w }) {
18
- const profileData = wixWindow.getRouterData();
17
+ async function profileOnReady({ $w: _$w }) {
18
+ const profileData = await wixWindow.getRouterData();
19
19
  console.log('profileData', profileData);
20
20
 
21
21
  let testimonialsPerPage = TESTIMONIALS_PER_PAGE_CONFIG.TABLET;
@@ -206,7 +206,7 @@ function profileOnReady({ $w: _$w }) {
206
206
  }
207
207
 
208
208
  function bindAreasOfPractice() {
209
- const areasText = prepareText(profileData.areasOfPractices);
209
+ const areasText = formatPracticeAreasForDisplay(profileData.areasOfPractices);
210
210
 
211
211
  if (areasText) {
212
212
  _$w('#areaOfPracticesText').text = areasText;
@@ -150,6 +150,14 @@ function calculateDistance(location1, location2) {
150
150
  return distance;
151
151
  }
152
152
 
153
+ /**
154
+ * Generate a unique ID
155
+ * @returns {string} Unique identifier
156
+ */
157
+ function generateId() {
158
+ return `${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
159
+ }
160
+
153
161
  module.exports = {
154
162
  checkAddressIsVisible,
155
163
  formatPracticeAreasForDisplay,
@@ -159,4 +167,5 @@ module.exports = {
159
167
  shuffleArray,
160
168
  calculateDistance,
161
169
  toRadians,
170
+ generateId,
162
171
  };
package/public/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  module.exports = {
2
2
  ...require('./consts'),
3
3
  ...require('./messages'),
4
- ...require('./utils'),
4
+ ...require('./Utils/sharedUtils'),
5
5
  };
package/public/utils.js DELETED
@@ -1,57 +0,0 @@
1
- /**
2
- * Generate a unique ID
3
- * @returns {string} Unique identifier
4
- */
5
- function generateId() {
6
- return `${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
7
- }
8
-
9
- /**
10
- * Formats an array of practice areas, showing as many as fit within 70 characters
11
- * @param {Array} areaOfPractices - Array of practice area strings
12
- * @returns {string} Formatted string of practice areas
13
- */
14
- function prepareText(areaOfPractices = []) {
15
- // always return a string
16
- if (!Array.isArray(areaOfPractices) || areaOfPractices.length === 0) {
17
- return '';
18
- }
19
-
20
- // Filter out null/undefined/empty
21
- const validAreas = areaOfPractices.filter(
22
- area => area !== null && area !== undefined && area !== ''
23
- );
24
-
25
- if (validAreas.length === 0) {
26
- return '';
27
- }
28
-
29
- if (validAreas.length === 1) {
30
- return validAreas[0].length > 70 ? validAreas[0].substring(0, 67) + '...' : validAreas[0];
31
- }
32
-
33
- // build up to 70-char string
34
- let current = '';
35
- const visible = [];
36
- for (const item of validAreas) {
37
- const sep = visible.length ? ', ' : '';
38
- const next = current + sep + item;
39
- if (next.length > 70) break;
40
- visible.push(item);
41
- current = next;
42
- }
43
-
44
- // if nothing fit, at least show the first (truncated)
45
- if (visible.length === 0) {
46
- const first = validAreas[0];
47
- return first.length > 67 ? first.substring(0, 67) + '...' : first;
48
- }
49
-
50
- const remaining = validAreas.length - visible.length;
51
- return remaining > 0 ? `${visible.join(', ')}, +${remaining} Techniques` : visible.join(', ');
52
- }
53
-
54
- module.exports = {
55
- generateId,
56
- prepareText,
57
- };