abmp-npm 2.0.88 → 2.0.91

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.
@@ -200,6 +200,9 @@ const updateSiteMapS3 = async () => {
200
200
  console.log('All sitemap files uploaded successfully');
201
201
  } catch (e) {
202
202
  console.error('Sitemap upload failed:', e?.message || e);
203
+ // Rethrow so the task manager marks the run failed and retries it, instead of recording a
204
+ // success while S3 still holds the previous sitemap (or nothing, if the bucket is missing).
205
+ throw e;
203
206
  }
204
207
  };
205
208
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "abmp-npm",
3
- "version": "2.0.88",
3
+ "version": "2.0.91",
4
4
  "main": "index.js",
5
5
  "files": [
6
6
  "index.js",
@@ -19,7 +19,8 @@
19
19
  "prepare": "husky",
20
20
  "find-duplicates": "node dev-only-scripts/find-duplicate-urls.js",
21
21
  "extract-duplicate-url-groups": "node dev-only-scripts/extract-duplicate-url-groups.js",
22
- "find-duplicate-ids": "node dev-only-scripts/find-duplicate-ids.js"
22
+ "find-duplicate-ids": "node dev-only-scripts/find-duplicate-ids.js",
23
+ "reconcile-memberships": "node dev-only-scripts/reconcile-memberships-with-pac.js"
23
24
  },
24
25
  "author": "",
25
26
  "license": "ISC",
package/pages/Profile.js CHANGED
@@ -2,6 +2,7 @@ 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 { hasCopyrightYear, withCurrentCopyrightYear } = require('../public/Utils/copyrightYear');
5
6
  const {
6
7
  generateId,
7
8
  formatPracticeAreasForDisplay,
@@ -20,6 +21,26 @@ const BREAKPOINTS = {
20
21
  TABLET: 750,
21
22
  };
22
23
 
24
+ // The footer reads "© <year> <name>. All rights reserved.": the name goes into #fullNameTextFoter,
25
+ // but the year was typed into each site's editor and has no nickname of its own, so ABMP stayed on
26
+ // 2025 while ASCP and AHP said 2026 (PAC ticket 12914830766). The three profile pages declare the
27
+ // same plain text elements; the copyright notice is found among them by content and its year kept
28
+ // current, so no editor needs touching now or next January.
29
+ const PLAIN_TEXT_ELEMENT_IDS = [
30
+ '#text389',
31
+ '#text178',
32
+ '#text150',
33
+ '#text155',
34
+ '#text157',
35
+ '#text158',
36
+ '#text164',
37
+ '#text169',
38
+ '#text171',
39
+ '#text175',
40
+ '#text177',
41
+ '#text179',
42
+ ];
43
+
23
44
  async function profileOnReady({ $w: _$w }) {
24
45
  const profileData = await wixWindow.getRouterData();
25
46
  console.log('profileData', profileData);
@@ -97,6 +118,23 @@ async function profileOnReady({ $w: _$w }) {
97
118
  bindStudentBadge();
98
119
  bindProfileImages();
99
120
  bindFullName();
121
+ bindCopyrightYear();
122
+ }
123
+
124
+ function bindCopyrightYear() {
125
+ PLAIN_TEXT_ELEMENT_IDS.forEach(id => {
126
+ try {
127
+ const element = _$w(id);
128
+ // .html keeps the element's formatting; fall back to .text for elements without markup.
129
+ if (hasCopyrightYear(element.html)) {
130
+ element.html = withCurrentCopyrightYear(element.html);
131
+ } else if (hasCopyrightYear(element.text)) {
132
+ element.text = withCurrentCopyrightYear(element.text);
133
+ }
134
+ } catch {
135
+ // The element does not exist on this site's page: nothing to update.
136
+ }
137
+ });
100
138
  }
101
139
 
102
140
  function bindMemberSince() {
@@ -0,0 +1,35 @@
1
+ // The member website footer reads "© <year> <member name>. All rights reserved." The year was typed
2
+ // into each site's editor, so ABMP stayed on 2025 while ASCP and AHP said 2026 (PAC ticket
3
+ // 12914830766). This keeps the year current without anyone touching the editors again.
4
+ // Deliberately free of Wix imports so it can be unit-tested.
5
+
6
+ const ASSOCIATION_TIME_ZONE = 'America/Denver';
7
+ // Matches the year in "© 2025", "&copy; 2025" (the .html of a text element), "(c) 2025" and
8
+ // "Copyright 2025", and nothing else — "Member since 2025" is left alone.
9
+ const COPYRIGHT_YEAR_PATTERN = /(©|&copy;|\(c\)|copyright)(\s*|&nbsp;)(\d{4})/i;
10
+
11
+ // PAC operates in Denver; the year should roll over at their midnight, not the visitor's.
12
+ const getCurrentYear = (now = new Date()) => {
13
+ try {
14
+ return Number(
15
+ new Intl.DateTimeFormat('en-US', { timeZone: ASSOCIATION_TIME_ZONE, year: 'numeric' }).format(
16
+ now
17
+ )
18
+ );
19
+ } catch {
20
+ return now.getUTCFullYear();
21
+ }
22
+ };
23
+
24
+ /** Returns the text with the year after the copyright mark set to the current year, or unchanged. */
25
+ const withCurrentCopyrightYear = (text, now = new Date()) => {
26
+ if (typeof text !== 'string') return text;
27
+ return text.replace(
28
+ COPYRIGHT_YEAR_PATTERN,
29
+ (_, mark, space) => `${mark}${space}${getCurrentYear(now)}`
30
+ );
31
+ };
32
+
33
+ const hasCopyrightYear = text => typeof text === 'string' && COPYRIGHT_YEAR_PATTERN.test(text);
34
+
35
+ module.exports = { getCurrentYear, withCurrentCopyrightYear, hasCopyrightYear };