abmp-npm 1.1.90 → 1.1.92

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.
@@ -3,7 +3,33 @@ const { auth } = require('@wix/essentials');
3
3
 
4
4
  const elevatedGetContact = auth.elevate(contacts.getContact);
5
5
  const elevatedUpdateContact = auth.elevate(contacts.updateContact);
6
+ const elevatedCreateContact = auth.elevate(contacts.createContact);
6
7
 
8
+ /**
9
+ * Create a contact in Wix CRM
10
+ * @param {Object} contactData - Contact data
11
+ * @param {boolean} allowDuplicates - Allow duplicates if contact with same email already exists, will be true only when handling existing members, after that should be removed
12
+ * @returns {Promise<Object>} - Contact data
13
+ */
14
+ async function createSiteContact(contactData, allowDuplicates = false) {
15
+ if (!contactData || !(contactData.contactFormEmail || contactData.email)) {
16
+ throw new Error('Contact data is required');
17
+ }
18
+ const phones =
19
+ Array.isArray(contactData.phones) && contactData.phones.length > 0 ? contactData.phones : [];
20
+ const contactInfo = {
21
+ name: {
22
+ first: contactData.firstName,
23
+ last: contactData.lastName,
24
+ },
25
+ emails: [
26
+ { items: [{ email: contactData.contactFormEmail || contactData.email, primary: true }] },
27
+ ],
28
+ phones: [{ items: phones.map(phone => ({ phone })) }],
29
+ };
30
+ const createContactResponse = await elevatedCreateContact(contactInfo, { allowDuplicates });
31
+ return createContactResponse.contact._id;
32
+ }
7
33
  /**
8
34
  * Generic contact update helper function
9
35
  * @param {string} contactId - The contact ID in Wix CRM
@@ -14,18 +40,13 @@ async function updateContactInfo(contactId, updateInfoCallback, operationName) {
14
40
  if (!contactId) {
15
41
  throw new Error('Contact ID is required');
16
42
  }
17
- console.log('updateContactInfo contactId', contactId);
18
- console.log('updateContactInfo operationName', operationName);
43
+
19
44
  try {
20
45
  const contact = await elevatedGetContact(contactId);
21
- console.log('updateContactInfo contact', contact);
22
46
  const currentInfo = contact.info;
23
- console.log('updateContactInfo currentInfo', currentInfo);
24
47
  const updatedInfo = updateInfoCallback(currentInfo);
25
- console.log('updateContactInfo updatedInfo', updatedInfo);
26
- const updatedContact = await elevatedUpdateContact(contactId, updatedInfo, contact.revision);
27
- console.log('updateContactInfo updatedContact', updatedContact);
28
- return updatedContact;
48
+
49
+ await elevatedUpdateContact(contactId, updatedInfo, contact.revision);
29
50
  } catch (error) {
30
51
  console.error(`Error in ${operationName}:`, error);
31
52
  throw new Error(`Failed to ${operationName}: ${error.message}`);
@@ -38,8 +59,6 @@ async function updateContactInfo(contactId, updateInfoCallback, operationName) {
38
59
  * @param {string} newEmail - The new email address
39
60
  */
40
61
  async function updateContactEmail(contactId, newEmail) {
41
- console.log('updateContactEmail contactId', contactId);
42
- console.log('updateContactEmail newEmail', newEmail);
43
62
  if (!newEmail) {
44
63
  throw new Error('New email is required');
45
64
  }
@@ -62,27 +81,33 @@ async function updateContactEmail(contactId, newEmail) {
62
81
  }
63
82
 
64
83
  /**
65
- * Updates contact names in Wix CRM
66
- * @param {string} contactId - The contact ID in Wix CRM
67
- * @param {string} firstName - The new first name
68
- * @param {string} lastName - The new last name
84
+ * Updates contact names in Wix CRM for both contact and member
85
+ * @param {Object} params - Parameters object
86
+ * @param {string} params.wixContactId - The contact ID in Wix CRM
87
+ * @param {string} params.wixMemberId - The member ID in Wix CRM
88
+ * @param {string} params.firstName - The new first name
89
+ * @param {string} params.lastName - The new last name
69
90
  */
70
- async function updateContactNames(contactId, firstName, lastName) {
91
+ async function updateMemberAndContactNames({ wixContactId, wixMemberId, firstName, lastName }) {
92
+ //TODO: rethink if we should keep all info just in contact, meaning no need to update the member
71
93
  if (!firstName && !lastName) {
72
94
  throw new Error('At least one name field is required');
73
95
  }
74
96
 
75
- return await updateContactInfo(
76
- contactId,
77
- currentInfo => ({
78
- ...currentInfo,
79
- name: {
80
- first: firstName || currentInfo?.name?.first || '',
81
- last: lastName || currentInfo?.name?.last || '',
82
- },
83
- }),
84
- 'update contact names'
85
- );
97
+ const createNameUpdate = currentInfo => ({
98
+ ...currentInfo,
99
+ name: {
100
+ first: firstName || currentInfo?.name?.first || '',
101
+ last: lastName || currentInfo?.name?.last || '',
102
+ },
103
+ });
104
+
105
+ const updatePromises = [
106
+ wixContactId && updateContactInfo(wixContactId, createNameUpdate, 'update contact names'),
107
+ wixMemberId && updateContactInfo(wixMemberId, createNameUpdate, 'update member names'),
108
+ ].filter(Boolean);
109
+
110
+ return await Promise.all(updatePromises);
86
111
  }
87
112
 
88
113
  /**
@@ -95,7 +120,6 @@ async function updateContactNames(contactId, firstName, lastName) {
95
120
  const updateIfChanged = (existingValues, newValues, updater, argsBuilder) => {
96
121
  const hasChanged = existingValues.some((val, idx) => val !== newValues[idx]);
97
122
  if (!hasChanged) return null;
98
- console.log('updateIfChanged hasChanged', hasChanged);
99
123
  return updater(...argsBuilder(newValues));
100
124
  };
101
125
 
@@ -105,18 +129,18 @@ const updateIfChanged = (existingValues, newValues, updater, argsBuilder) => {
105
129
  * @param {Object} existingMemberData - Existing member data
106
130
  */
107
131
  const updateMemberContactInfo = async (data, existingMemberData) => {
108
- const { contactId } = existingMemberData;
109
- console.log('updateMemberContactInfo contactId', contactId);
132
+ const { wixContactId, wixMemberId } = existingMemberData;
133
+
110
134
  const updateConfig = [
111
135
  {
112
136
  fields: ['contactFormEmail'],
113
137
  updater: updateContactEmail,
114
- args: ([email]) => [contactId, email],
138
+ args: ([email]) => [wixContactId, email],
115
139
  },
116
140
  {
117
141
  fields: ['firstName', 'lastName'],
118
- updater: updateContactNames,
119
- args: ([firstName, lastName]) => [contactId, firstName, lastName],
142
+ updater: updateMemberAndContactNames,
143
+ args: ([firstName, lastName]) => [{ firstName, lastName, wixContactId, wixMemberId }],
120
144
  },
121
145
  ];
122
146
 
@@ -128,11 +152,10 @@ const updateMemberContactInfo = async (data, existingMemberData) => {
128
152
  })
129
153
  .filter(Boolean);
130
154
 
131
- const resp = await Promise.all(updatePromises);
132
- console.log('updateMemberContactInfo updatePromises', resp);
133
- return resp;
155
+ await Promise.all(updatePromises);
134
156
  };
135
157
 
136
158
  module.exports = {
137
159
  updateMemberContactInfo,
160
+ createSiteContact,
138
161
  };
@@ -168,7 +168,7 @@ const bulkProcessAndSaveMemberData = async ({
168
168
  const toChangeWixMembersEmails = [];
169
169
  const toSaveMembersData = uniqueUrlsMembersData.map(member => {
170
170
  const { isLoginEmailChanged, isNewToDb: _isNewToDb, ...restMemberData } = member;
171
- if (member.contactId && isLoginEmailChanged) {
171
+ if (member.wixMemberId && isLoginEmailChanged) {
172
172
  toChangeWixMembersEmails.push(member);
173
173
  }
174
174
  return restMemberData; //we don't want to store the isLoginEmailChanged in the database, it's just a flag to know if we need to change the login email in Members area
@@ -35,7 +35,17 @@ const extractBaseUrl = url => {
35
35
  return url;
36
36
  };
37
37
  const incrementUrlCounter = (existingUrl, baseUrl) => {
38
- if (existingUrl && existingUrl === baseUrl) {
38
+ if (!existingUrl || !baseUrl) {
39
+ return baseUrl;
40
+ }
41
+ // Normalize for comparison (case-insensitive)
42
+ const normalizedExisting = existingUrl.toLowerCase();
43
+ const normalizedBase = baseUrl.toLowerCase();
44
+
45
+ if (
46
+ normalizedExisting === normalizedBase ||
47
+ normalizedExisting.startsWith(`${normalizedBase}-`)
48
+ ) {
39
49
  console.log(
40
50
  `Found member with same url ${existingUrl} for baseUrl ${baseUrl}, increasing counter by 1`
41
51
  );
@@ -44,6 +54,9 @@ const incrementUrlCounter = (existingUrl, baseUrl) => {
44
54
  const lastCounter = isNumeric ? parseInt(lastSegment, 10) : 0;
45
55
  return `${baseUrl}-${lastCounter + 1}`;
46
56
  }
57
+
58
+ // No conflict, return baseUrl with counter 1 to be safe
59
+ return `${baseUrl}-1`;
47
60
  };
48
61
  /**
49
62
  * Validates core member data requirements
@@ -16,7 +16,7 @@ const contactSubmission = async (data, memberDataId) => {
16
16
  console.log('Member contact form is not enabled for user, skipping contact submission!');
17
17
  return;
18
18
  }
19
- let memberContactId = memberData.contactId;
19
+ let memberContactId = memberData.wixContactId;
20
20
  if (!memberContactId) {
21
21
  /**
22
22
  * Create a member contact here since some members may have never logged in
@@ -27,7 +27,7 @@ const contactSubmission = async (data, memberDataId) => {
27
27
  */
28
28
  console.info('Member contact id not found for user, creating new contact!');
29
29
  const member = await createContactAndMemberIfNew(memberData);
30
- memberContactId = member.contactId;
30
+ memberContactId = member.wixContactId;
31
31
  }
32
32
  console.log('memberContactId', memberContactId);
33
33
  const emailTriggered = await triggerAutomation(automationEmailTriggerId, {
@@ -40,7 +40,7 @@ const contactSubmission = async (data, memberDataId) => {
40
40
  data = {
41
41
  ...data,
42
42
  phone: Number(data.phone),
43
- memberContactId: memberContactId,
43
+ memberContactId,
44
44
  memberEmail: memberData.contactFormEmail,
45
45
  };
46
46
  await wixData.insert(COLLECTIONS.CONTACT_US_SUBMISSIONS, data);
@@ -5,7 +5,7 @@ const { decode } = require('jwt-js-decode');
5
5
  const { CONFIG_KEYS, SSO_TOKEN_AUTH_API_URL } = require('../consts');
6
6
  const { MEMBER_ACTIONS } = require('../daily-pull/consts');
7
7
  const { getCurrentMember } = require('../members-area-methods');
8
- const { getMemberByContactId, prepareMemberForSSOLogin } = require('../members-data-methods');
8
+ const { getCMSMemberByWixMemberId, prepareMemberForSSOLogin } = require('../members-data-methods');
9
9
  const {
10
10
  formatDateToMonthYear,
11
11
  getAddressDisplayOptions,
@@ -37,12 +37,12 @@ async function validateMemberToken(memberIdInput) {
37
37
  }
38
38
 
39
39
  const [dbMember, siteConfigs] = await Promise.all([
40
- getMemberByContactId(member._id),
40
+ getCMSMemberByWixMemberId(member._id),
41
41
  getSiteConfigs(),
42
42
  ]);
43
43
  const siteAssociation = siteConfigs[CONFIG_KEYS.SITE_ASSOCIATION];
44
44
  const membersExternalPortalUrl = siteConfigs[CONFIG_KEYS.MEMBERS_EXTERNAL_PORTAL_URL];
45
- console.log('dbMember by contact id is:', dbMember);
45
+ console.log('dbMember by wix member id is:', dbMember);
46
46
  console.log('member._id', member._id);
47
47
 
48
48
  if (!dbMember?._id) {
@@ -2,10 +2,11 @@ const { auth } = require('@wix/essentials');
2
2
  const { members, authentication } = require('@wix/members');
3
3
  const elevatedCreateMember = auth.elevate(members.createMember);
4
4
 
5
- function prepareContactData(partner) {
5
+ function prepareMemberData(partner) {
6
6
  const phones = Array.isArray(partner.phones) ? partner.phones : []; //some users don't have phones
7
7
  const options = {
8
8
  member: {
9
+ //Keeping contact creation in member data for future purposes, in case we need to use it later
9
10
  contact: {
10
11
  ...partner,
11
12
  phones,
@@ -22,9 +23,8 @@ async function createMemberFunction(member) {
22
23
  }
23
24
  const createSiteMember = async memberDetails => {
24
25
  try {
25
- const options = prepareContactData(memberDetails);
26
- const contactId = await createMemberFunction(options);
27
- return contactId;
26
+ const options = prepareMemberData(memberDetails);
27
+ return await createMemberFunction(options);
28
28
  } catch (error) {
29
29
  console.error(`Error in createSiteMember ${error.message}`);
30
30
  throw error;
@@ -37,22 +37,25 @@ const getCurrentMember = async () => {
37
37
  };
38
38
 
39
39
  /**
40
- * Updates Wix member login email if the member has a contactId (registered Wix member)
41
- * @param {Object} member - Member object with contactId and email
40
+ * Updates Wix member login email if the member has a wixMemberId (registered Wix member)
41
+ * @param {Object} member - Member object with wixMemberId and email
42
42
  * @param {Object} result - Result object to track Wix member updates
43
43
  */
44
44
  async function updateWixMemberLoginEmail(member, result = {}) {
45
- if (!member.contactId) {
46
- console.log(`Member ${member.memberId} has no contactId - skipping Wix login email update`);
45
+ if (!member.wixMemberId) {
46
+ console.log(`Member ${member.memberId} has no wixMemberId - skipping Wix login email update`);
47
47
  return;
48
48
  }
49
49
 
50
50
  try {
51
51
  console.log(
52
- `Updating Wix login email for member ${member.memberId} (contactId: ${member.contactId})`
52
+ `Updating Wix login email for member ${member.memberId} (wixMemberId: ${member.wixMemberId})`
53
53
  );
54
54
 
55
- const updatedWixMember = await authentication.changeLoginEmail(member.contactId, member.email);
55
+ const updatedWixMember = await authentication.changeLoginEmail(
56
+ member.wixMemberId,
57
+ member.email
58
+ );
56
59
 
57
60
  console.log(
58
61
  `✅ Successfully updated Wix login email for member ${member.memberId}: ${updatedWixMember.loginEmail}`
@@ -75,7 +78,7 @@ async function updateWixMemberLoginEmail(member, result = {}) {
75
78
  }
76
79
  result.wixMemberErrors.push({
77
80
  memberId: member.memberId,
78
- contactId: member.contactId,
81
+ wixMemberId: member.wixMemberId,
79
82
  email: member.email,
80
83
  error: error.message,
81
84
  });
@@ -1,10 +1,10 @@
1
1
  const { COLLECTIONS } = require('../public/consts');
2
2
 
3
3
  const { MEMBERSHIPS_TYPES } = require('./consts');
4
- const { updateMemberContactInfo } = require('./contacts-methods');
4
+ const { updateMemberContactInfo, createSiteContact } = require('./contacts-methods');
5
5
  const { MEMBER_ACTIONS } = require('./daily-pull/consts');
6
6
  const { wixData } = require('./elevated-modules');
7
- const { createSiteMember } = require('./members-area-methods');
7
+ const { createSiteMember, getCurrentMember } = require('./members-area-methods');
8
8
  const {
9
9
  chunkArray,
10
10
  normalizeUrlForComparison,
@@ -42,10 +42,17 @@ async function createContactAndMemberIfNew(memberData) {
42
42
  phones: memberData.phones,
43
43
  contactFormEmail: memberData.contactFormEmail || memberData.email,
44
44
  };
45
- const contactId = await createSiteMember(toCreateMemberData);
45
+ const needsWixMember = !memberData.wixMemberId;
46
+ const needsWixContact = !memberData.wixContactId;
47
+ const createPromises = [
48
+ needsWixMember && createSiteMember(toCreateMemberData),
49
+ needsWixContact && createSiteContact(toCreateMemberData),
50
+ ].filter(Boolean);
51
+ const [newWixMemberId, newWixContactId] = await Promise.all(createPromises);
46
52
  let memberDataWithContactId = {
47
53
  ...memberData,
48
- contactId,
54
+ wixMemberId: newWixMemberId || memberData.wixMemberId,
55
+ wixContactId: newWixContactId || memberData.wixContactId,
49
56
  };
50
57
  const updatedResult = await updateMember(memberDataWithContactId);
51
58
  memberDataWithContactId = {
@@ -169,26 +176,26 @@ async function getMemberBySlug({
169
176
  }
170
177
  }
171
178
 
172
- async function getMemberByContactId(contactId) {
173
- if (!contactId) {
174
- throw new Error('Contact ID is required');
179
+ async function getCMSMemberByWixMemberId(wixMemberId) {
180
+ if (!wixMemberId) {
181
+ throw new Error('Wix Member ID is required');
175
182
  }
176
183
  try {
177
184
  const members = await wixData
178
185
  .query(COLLECTIONS.MEMBERS_DATA)
179
- .eq('contactId', contactId)
186
+ .eq('wixMemberId', wixMemberId)
180
187
  .limit(2)
181
188
  .find()
182
189
  .then(res => res.items);
183
190
  if (members.length > 1) {
184
191
  throw new Error(
185
- `[getMemberByContactId] Multiple members found with contactId ${contactId} membersIds are : [${members.map(member => member.memberId).join(', ')}]`
192
+ `[getCMSMemberByWixMemberId] Multiple members found with wixMemberId ${wixMemberId} membersIds are : [${members.map(member => member.memberId).join(', ')}]`
186
193
  );
187
194
  }
188
195
  return members[0] || null;
189
196
  } catch (error) {
190
197
  throw new Error(
191
- `[getMemberByContactId] Failed to retrieve member by contactId ${contactId} data: ${error.message}`
198
+ `[getCMSMemberByWixMemberId] Failed to retrieve member by wixMemberId ${wixMemberId} data: ${error.message}`
192
199
  );
193
200
  }
194
201
  }
@@ -452,11 +459,11 @@ const getQAUsers = async () => {
452
459
  * @param {Object} memberData - Member data from DB
453
460
  * @returns {Promise<Object>} - Member data with contactId
454
461
  */
455
- async function ensureMemberHasContact(memberData) {
462
+ async function ensureWixMemberAndContactExist(memberData) {
456
463
  if (!memberData) {
457
464
  throw new Error('Member data is required');
458
465
  }
459
- if (!memberData.contactId) {
466
+ if (!memberData.wixContactId || !memberData.wixMemberId) {
460
467
  const memberDataWithContactId = await createContactAndMemberIfNew(memberData);
461
468
  return memberDataWithContactId;
462
469
  }
@@ -474,7 +481,7 @@ async function prepareMemberForSSOLogin(data) {
474
481
  throw new Error(`Member data not found for memberId ${memberId}`);
475
482
  }
476
483
  console.log('memberData', memberData);
477
- return await ensureMemberHasContact(memberData);
484
+ return await ensureWixMemberAndContactExist(memberData);
478
485
  } catch (error) {
479
486
  console.error('Error in prepareMemberForSSOLogin', error.message);
480
487
  throw error;
@@ -491,13 +498,58 @@ async function prepareMemberForQALogin(email) {
491
498
  throw new Error(`Member data not found for email ${email}`);
492
499
  }
493
500
  console.log('memberData', memberData);
494
- return await ensureMemberHasContact(memberData);
501
+ return await ensureWixMemberAndContactExist(memberData);
495
502
  } catch (error) {
496
503
  console.error('Error in prepareMemberForQALogin', error.message);
497
504
  throw error;
498
505
  }
499
506
  }
500
507
 
508
+ /**
509
+ * Tracks a button click with member and location info.
510
+ * @param {Object} params - Parameters
511
+ * @param {string} params.pageName - Name of the page/popup where button was clicked
512
+ * @param {string} params.buttonName - Name/ID of the button that was clicked
513
+ * @returns {Promise<Object>} - Saved record or null if member not found
514
+ */
515
+ async function trackButtonClick({ pageName, buttonName }) {
516
+ const wixMember = await getCurrentMember();
517
+
518
+ if (!wixMember) {
519
+ console.warn('[trackButtonClick]: No logged in member found');
520
+ return null;
521
+ }
522
+
523
+ const dbMember = await getCMSMemberByWixMemberId(wixMember._id);
524
+
525
+ if (!dbMember) {
526
+ console.warn(
527
+ `[trackButtonClick]: Member not found in MembersDataLatest for contactId: ${wixMember._id}`
528
+ );
529
+ return null;
530
+ }
531
+
532
+ const memberName = dbMember.fullName || 'Unknown';
533
+ const memberId = dbMember.memberId;
534
+
535
+ const clickData = {
536
+ memberName,
537
+ memberId,
538
+ pageName,
539
+ buttonName,
540
+ clickedAt: new Date(),
541
+ };
542
+
543
+ try {
544
+ const result = await wixData.insert(COLLECTIONS.BUTTON_CLICKS, clickData);
545
+ console.log(`Tracked ${buttonName} click on ${pageName} for member ${memberId}`);
546
+ return result;
547
+ } catch (error) {
548
+ console.error(`Error tracking ${buttonName} click:`, error);
549
+ throw error;
550
+ }
551
+ }
552
+
501
553
  module.exports = {
502
554
  findMemberByWixDataId,
503
555
  createContactAndMemberIfNew,
@@ -505,7 +557,7 @@ module.exports = {
505
557
  bulkSaveMembers,
506
558
  findMemberById,
507
559
  getMemberBySlug,
508
- getMemberByContactId,
560
+ getCMSMemberByWixMemberId,
509
561
  getAllEmptyAboutYouMembers,
510
562
  updateMember,
511
563
  getAllMembersWithExternalImages,
@@ -518,4 +570,5 @@ module.exports = {
518
570
  prepareMemberForSSOLogin,
519
571
  prepareMemberForQALogin,
520
572
  checkUrlUniqueness,
573
+ trackButtonClick,
521
574
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "abmp-npm",
3
- "version": "1.1.90",
3
+ "version": "1.1.92",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "check-cycles": "madge --circular .",
package/pages/Home.js CHANGED
@@ -216,12 +216,19 @@ const homePageOnReady = async ({
216
216
  $item('#milesAwayText').text = '';
217
217
  }
218
218
 
219
- // 7) "Show maps" button enabled only if there's at least one visible address
219
+ // 7) "Show maps" button enabled only if there's a full address with valid coordinates
220
220
  const visible = checkAddressIsVisible(addresses);
221
- if (visible.length && visible[0].addressStatus === ADDRESS_STATUS_TYPES.FULL_ADDRESS) {
221
+ const fullAddressWithValidCoords = visible.find(
222
+ addr =>
223
+ addr.addressStatus === ADDRESS_STATUS_TYPES.FULL_ADDRESS &&
224
+ addr.latitude &&
225
+ addr.longitude
226
+ );
227
+
228
+ if (fullAddressWithValidCoords) {
222
229
  $item('#showMaps').enable();
223
230
  $item('#showMaps').show();
224
- const { latitude, longitude } = visible[0];
231
+ const { latitude, longitude } = fullAddressWithValidCoords;
225
232
  $item('#showMaps').link = `https://maps.google.com/?q=${latitude},${longitude}`;
226
233
  $item('#showMaps').target = '_blank';
227
234
  } else {
@@ -0,0 +1,27 @@
1
+ const PAGE_NAME = 'Learn More';
2
+ const BUTTON_NAME = 'Upgrade Now';
3
+
4
+ /**
5
+ * Creates the Learn More popup handler
6
+ * @param {Object} params - Parameters
7
+ * @param {Function} params.$w - Wix $w selector
8
+ * @param {Function} params.trackClick - Backend function to track the click (handles member lookup internally)
9
+ */
10
+ function learnMoreOnReady({ $w: _$w, trackClick }) {
11
+ _$w('#learnMoreBtn').onClick(async () => {
12
+ try {
13
+ await trackClick({
14
+ pageName: PAGE_NAME,
15
+ buttonName: BUTTON_NAME,
16
+ });
17
+
18
+ console.log(`Tracked ${BUTTON_NAME} click on ${PAGE_NAME}`);
19
+ } catch (error) {
20
+ console.error('Error tracking button click:', error);
21
+ }
22
+ });
23
+ }
24
+
25
+ module.exports = {
26
+ learnMoreOnReady,
27
+ };
package/pages/index.js CHANGED
@@ -8,4 +8,5 @@ module.exports = {
8
8
  ...require('./SelectBannerImages.js'),
9
9
  ...require('./deleteConfirm.js'),
10
10
  ...require('./SaveAlerts.js'),
11
+ ...require('./LearnMore.js'),
11
12
  };
package/public/consts.js CHANGED
@@ -13,6 +13,7 @@ const COLLECTIONS = {
13
13
  STATE_CITY_MAP: 'City',
14
14
  UPDATED_LOGIN_EMAILS: 'updatedLoginEmails',
15
15
  QA_USERS: 'QA_Users', //Make QA users configurable per site
16
+ BUTTON_CLICKS: 'ButtonClicks',
16
17
  };
17
18
 
18
19
  /**