@openeventkit/event-site 2.1.18 → 2.1.20

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.
Files changed (39) hide show
  1. package/.github/workflows/jest.yml +1 -1
  2. package/babel.config.json +9 -9
  3. package/gatsby-node.js +67 -125
  4. package/jest.setup.js +2 -0
  5. package/netlify.toml +1 -1
  6. package/package.json +24 -16
  7. package/src/__mocks__/@mdx-js/mdx.js +32 -0
  8. package/src/__mocks__/@mdx-js/react.js +15 -0
  9. package/src/__mocks__/rehype-external-links.js +3 -0
  10. package/src/__mocks__/remark-gfm.js +3 -0
  11. package/src/actions/fetch-entities-actions.js +45 -87
  12. package/src/actions/update-data-actions.js +2 -2
  13. package/src/actions/user-actions.js +578 -430
  14. package/src/cms/preview-templates/ContentPagePreview.js +27 -29
  15. package/src/components/AvatarEditorModal/index.js +10 -0
  16. package/src/components/FullSchedule.js +83 -66
  17. package/src/components/Mdx.js +39 -0
  18. package/src/components/__tests__/Mdx.test.jsx +70 -0
  19. package/src/content/site-settings/index.json +1 -1
  20. package/src/content/sponsors.json +1 -1
  21. package/src/i18n/locales/en.json +9 -1
  22. package/src/pages/a/[...].js +3 -0
  23. package/src/reducers/user-reducer.js +89 -27
  24. package/src/routes/authorization-callback-route.js +20 -2
  25. package/src/styles/rsvp-page.module.scss +63 -0
  26. package/src/templates/marketing-page-template/MainColumn.js +40 -42
  27. package/src/templates/rsvp-page.js +144 -0
  28. package/src/utils/alerts.js +1 -1
  29. package/src/utils/build-json/BaseAPIRequest.js +25 -0
  30. package/src/utils/build-json/EventsAPIRequest.js +171 -0
  31. package/src/utils/build-json/SpeakersAPIRequest.js +62 -0
  32. package/src/utils/build-json/SummitAPIRequest.js +115 -0
  33. package/src/utils/build-json/constants.js +5 -0
  34. package/src/utils/customErrorHandler.js +40 -1
  35. package/src/utils/rsvpConstants.js +7 -0
  36. package/src/workers/sync_strategies/activity_synch_strategy.js +147 -102
  37. package/src/workers/sync_strategies/speaker_synch_strategy.js +3 -3
  38. package/src/workers/sync_strategies/track_synch_strategy.js +149 -48
  39. package/src/workers/synch.worker.js +123 -88
@@ -10,6 +10,6 @@ jobs:
10
10
  fetch-depth: 0
11
11
  - uses: actions/setup-node@v3
12
12
  with:
13
- node-version: 18
13
+ node-version: 20
14
14
  - run: yarn install
15
15
  - run: yarn test
package/babel.config.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "presets": [
3
- [
4
- "babel-preset-gatsby",
5
- {
6
- "targets": {
7
- "esmodules": true
8
- }
9
- }
10
- ]
11
- ]
3
+ ["babel-preset-gatsby", { "targets": { "esmodules": true } }]
4
+ ],
5
+ "env": {
6
+ "test": {
7
+ "presets": [
8
+ ["babel-preset-gatsby", { "targets": { "node": "current" } }]
9
+ ]
10
+ }
11
+ }
12
12
  }
package/gatsby-node.js CHANGED
@@ -8,6 +8,9 @@ const {
8
8
  } = require("gatsby-source-filesystem");
9
9
  const SentryWebpackPlugin = require("@sentry/webpack-plugin");
10
10
  const { ClientCredentials } = require("simple-oauth2");
11
+ const URI = require("urijs")
12
+ const SummitAPIRequest = require("./src/utils/build-json/SummitAPIRequest");
13
+ const EventAPIRequest = require("./src/utils/build-json/EventsAPIRequest");
11
14
 
12
15
  const myEnv = require("dotenv").config({
13
16
  path: `.env.${process.env.NODE_ENV}`,
@@ -38,6 +41,9 @@ const {
38
41
  generateColorsScssFile
39
42
  } = require("./src/utils/scssUtils");
40
43
 
44
+ const { FIFTY_PER_PAGE } = require("./src/utils/build-json/constants");
45
+ const SpeakersAPIRequest = require("./src/utils/build-json/SpeakersAPIRequest");
46
+
41
47
  const fileBuildTimes = [];
42
48
 
43
49
  const getAccessToken = async (config, scope) => {
@@ -58,15 +64,16 @@ const SSR_GetRemainingPages = async (endpoint, params, lastPage) => {
58
64
  }
59
65
 
60
66
  let remainingPages = await Promise.all(pages.map(pageIdx => {
61
- return axios.get(endpoint ,
62
- { params : {
63
- ...params,
64
- page: pageIdx
65
- }
66
- }).then(({ data }) => data);
67
+ return axios.get(endpoint,
68
+ {
69
+ params: {
70
+ ...params,
71
+ page: pageIdx
72
+ }
73
+ }).then(({ data }) => data);
67
74
  }));
68
75
 
69
- return remainingPages.sort((a, b,) => a.current_page - b.current_page ).map(p => p.data).flat();
76
+ return remainingPages.sort((a, b,) => a.current_page - b.current_page).map(p => p.data).flat();
70
77
  }
71
78
 
72
79
  const SSR_getMarketingSettings = async (baseUrl, summitId) => {
@@ -78,7 +85,7 @@ const SSR_getMarketingSettings = async (baseUrl, summitId) => {
78
85
  page: 1
79
86
  };
80
87
 
81
- return await axios.get(endpoint, { params }).then(async ({data}) => {
88
+ return await axios.get(endpoint, { params }).then(async ({ data }) => {
82
89
 
83
90
  console.log(`SSR_getMarketingSettings then data.current_page ${data.current_page} data.last_page ${data.last_page} total ${data.total}`)
84
91
 
@@ -91,52 +98,21 @@ const SSR_getMarketingSettings = async (baseUrl, summitId) => {
91
98
 
92
99
  const SSR_getEvents = async (baseUrl, summitId, accessToken) => {
93
100
 
94
- const endpoint = `${baseUrl}/api/v1/summits/${summitId}/events/published`;
95
-
96
- const speakers_fields = ['id', 'first_name', 'last_name', 'title', 'bio','member_id','pic', 'big_pic', 'company'];
97
- const current_attendance_fields = ['member_first_name', 'member_last_name', 'member_pic'];
98
- const first_level_fields = [
99
- "id",
100
- "created",
101
- "last_edited",
102
- "title",
103
- "description",
104
- "social_description",
105
- "start_date",
106
- "end_date",
107
- "location_id",
108
- "class_name",
109
- "allow_feedback",
110
- "avg_feedback_rate",
111
- "published_date",
112
- "head_count",
113
- "attendance_count",
114
- "current_attendance_count",
115
- "image",
116
- "level" ,
117
- "show_sponsors",
118
- "duration",
119
- "moderator_speaker_id",
120
- "problem_addressed",
121
- "attendees_expected_learnt",
122
- "to_record",
123
- "attending_media",
124
- ];
125
- const fields = `${first_level_fields.join(",")},speakers.${speakers_fields.join(",speakers.")},current_attendance.${current_attendance_fields.join(',current_attendance.')}`;
126
- const params = {
127
- access_token: accessToken,
128
- per_page: 50,
129
- page: 1,
130
- expand: 'slides,links,videos,media_uploads,type,track,track.subtracks,track.allowed_access_levels,location,location.venue,location.floor,speakers,moderator,sponsors,groups,rsvp_template,tags,current_attendance',
131
- relations: 'speakers.badge_features,speakers.affiliations,speakers.languages,speakers.other_presentation_links,speakers.areas_of_expertise,speakers.travel_preferences,speakers.organizational_roles,speakers.all_presentations,speakers.all_moderated_presentations',
132
- fields: fields,
133
- }
101
+ const apiUrl = URI(`${baseUrl}/api/v1/summits/${summitId}/events/published`);
102
+
103
+ apiUrl.addQuery('access_token', accessToken);
104
+ apiUrl.addQuery('per_page', FIFTY_PER_PAGE);
105
+ apiUrl.addQuery('page', 1);
134
106
 
135
- return await axios.get(endpoint, { params }).then(async ({data}) => {
107
+ const apiUrlWithParams = EventAPIRequest.build(apiUrl);
108
+
109
+ const params = EventAPIRequest.getParams(apiUrl);
110
+
111
+ return await axios.get(apiUrlWithParams).then(async ({ data }) => {
136
112
 
137
113
  console.log(`SSR_getEvents then data.current_page ${data.current_page} data.last_page ${data.last_page} total ${data.total}`)
138
114
 
139
- let remainingPages = await SSR_GetRemainingPages(endpoint, params, data.last_page);
115
+ let remainingPages = await SSR_GetRemainingPages(apiUrlWithParams, params, data.last_page);
140
116
 
141
117
  return [...data.data, ...remainingPages];
142
118
 
@@ -148,14 +124,14 @@ const SSR_getSponsors = async (baseUrl, summitId, accessToken) => {
148
124
  const endpoint = `${baseUrl}/api/v1/summits/${summitId}/sponsors`;
149
125
 
150
126
  const params = {
151
- access_token: accessToken,
152
- per_page: 50,
153
- page: 1,
154
- filter: "is_published==1",
155
- expand: 'company,sponsorship,sponsorship.type',
127
+ access_token: accessToken,
128
+ per_page: 50,
129
+ page: 1,
130
+ filter: "is_published==1",
131
+ expand: 'company,sponsorship,sponsorship.type',
156
132
  }
157
133
 
158
- return await axios.get(endpoint, { params }).then(async ({data}) => {
134
+ return await axios.get(endpoint, { params }).then(async ({ data }) => {
159
135
 
160
136
  console.log(`SSR_getSponsors then data.current_page ${data.current_page} data.last_page ${data.last_page} total ${data.total}`)
161
137
 
@@ -169,12 +145,12 @@ const SSR_getSponsors = async (baseUrl, summitId, accessToken) => {
169
145
  const SSR_getSponsorCollections = async (allSponsors, baseUrl, summitId, accessToken) => {
170
146
 
171
147
  const params = {
172
- access_token: accessToken,
173
- per_page: 50,
174
- page: 1,
148
+ access_token: accessToken,
149
+ per_page: 50,
150
+ page: 1,
175
151
  }
176
152
 
177
- const getSponsorCollection = async (endpoint, params) => await axios.get(endpoint, { params }).then(async ({data}) => {
153
+ const getSponsorCollection = async (endpoint, params) => await axios.get(endpoint, { params }).then(async ({ data }) => {
178
154
  console.log(`SSR_getSponsorCollection then data.current_page ${data.current_page} data.last_page ${data.last_page} total ${data.total}`)
179
155
  let remainingPages = await SSR_GetRemainingPages(endpoint, params, data.last_page);
180
156
  return [...data.data, ...remainingPages];
@@ -185,7 +161,7 @@ const SSR_getSponsorCollections = async (allSponsors, baseUrl, summitId, accessT
185
161
  const ads = await getSponsorCollection(`${baseUrl}/api/v1/summits/${summitId}/sponsors/${sponsor.id}/ads`, params);
186
162
  const materials = await getSponsorCollection(`${baseUrl}/api/v1/summits/${summitId}/sponsors/${sponsor.id}/materials`, params);
187
163
  const social_networks = await getSponsorCollection(`${baseUrl}/api/v1/summits/${summitId}/sponsors/${sponsor.id}/social-networks`, params);
188
- return ({...sponsor, ads, materials, social_networks})
164
+ return ({ ...sponsor, ads, materials, social_networks })
189
165
  }));
190
166
 
191
167
  return sponsorsWithCollections;
@@ -193,72 +169,38 @@ const SSR_getSponsorCollections = async (allSponsors, baseUrl, summitId, accessT
193
169
 
194
170
  const SSR_getSpeakers = async (baseUrl, summitId, accessToken, filter = null) => {
195
171
 
196
- const speakers_relations = [
197
- 'badge_features',
198
- 'affiliations',
199
- 'languages',
200
- 'other_presentation_links',
201
- 'areas_of_expertise',
202
- 'travel_preferences',
203
- 'organizational_roles',
204
- 'all_presentations',
205
- 'all_moderated_presentations',
206
- ];
207
-
208
- const speakers_fields =
209
- ['id', 'first_name', 'last_name', 'title', 'bio','member_id','pic', 'big_pic', 'company'];
172
+ const apiUrl = URI(`${baseUrl}/api/v1/summits/${summitId}/speakers/on-schedule`);
210
173
 
211
- const params = {
212
- access_token: accessToken,
213
- per_page: 30,
214
- page: 1,
215
- relations: speakers_relations.join(','),
216
- fields: speakers_fields.join(',')
217
- };
174
+ apiUrl.addQuery('access_token', accessToken);
175
+ apiUrl.addQuery('per_page', 30);
176
+ apiUrl.addQuery('page', 1);
218
177
 
219
- const endpoint = `${baseUrl}/api/v1/summits/${summitId}/speakers/on-schedule`;
178
+ const apiUrlWithParams = SpeakersAPIRequest.build(apiUrl);
220
179
 
221
- if (filter) {
222
- params["filter[]"] = filter;
223
- }
224
-
225
- return await axios.get(
226
- endpoint,
227
- { params }
228
- )
229
- .then(async ({data}) => {
180
+ const params = SpeakersAPIRequest.getParams(apiUrl);
181
+
182
+ return await axios.get(apiUrlWithParams)
183
+ .then(async ({ data }) => {
230
184
  console.log(`SSR_getSpeakers then data.current_page ${data.current_page} data.last_page ${data.last_page} total ${data.total}`)
231
185
 
232
- let remainingPages = await SSR_GetRemainingPages(endpoint, params, data.last_page);
186
+ let remainingPages = await SSR_GetRemainingPages(apiUrlWithParams, params, data.last_page);
233
187
 
234
- return [ ...data.data, ...remainingPages];
188
+ return [...data.data, ...remainingPages];
235
189
  })
236
190
  .catch(e => console.log("ERROR: ", e));
237
191
  };
238
192
 
239
- const SSR_getSummit = async (baseUrl, summitId) => {
193
+ const SSR_getSummit = async (baseUrl, summitId, accessToken) => {
240
194
 
241
- const params = {
242
- expand: "event_types," +
243
- "tracks," +
244
- "tracks.subtracks," +
245
- "track_groups," +
246
- "presentation_levels," +
247
- "locations," +
248
- "locations.rooms," +
249
- "locations.floors," +
250
- "order_extra_questions.values," +
251
- "schedule_settings," +
252
- "schedule_settings.filters," +
253
- "schedule_settings.pre_filters,"+
254
- "ticket_types," +
255
- "badge_features_types" ,
256
- t: Date.now()
257
- };
195
+ let apiUrl = URI(`${baseUrl}/api/v2/summits/${summitId}`);
196
+
197
+ apiUrl.addQuery('access_token', accessToken);
198
+ apiUrl.addQuery('t', Date.now());
199
+
200
+ const apiUrlWithParams = SummitAPIRequest.build(apiUrl);
258
201
 
259
202
  return await axios.get(
260
- `${baseUrl}/api/public/v1/summits/${summitId}`,
261
- { params }
203
+ apiUrlWithParams
262
204
  )
263
205
  .then(({ data }) => data)
264
206
  .catch(e => console.log("ERROR: ", e));
@@ -277,14 +219,14 @@ const SSR_getVoteablePresentations = async (baseUrl, summitId, accessToken) => {
277
219
  };
278
220
 
279
221
  return await axios.get(endpoint,
280
- { params }).then(async ({data}) => {
222
+ { params }).then(async ({ data }) => {
281
223
 
282
- console.log(`SSR_getVoteablePresentations then data.current_page ${data.current_page} data.last_page ${data.last_page} total ${data.total}`)
224
+ console.log(`SSR_getVoteablePresentations then data.current_page ${data.current_page} data.last_page ${data.last_page} total ${data.total}`)
283
225
 
284
- let remainingPages = await SSR_GetRemainingPages(endpoint, params, data.last_page);
226
+ let remainingPages = await SSR_GetRemainingPages(endpoint, params, data.last_page);
285
227
 
286
- return [...data.data, ...remainingPages];
287
- })
228
+ return [...data.data, ...remainingPages];
229
+ })
288
230
  .catch(e => console.log("ERROR: ", e));
289
231
  };
290
232
 
@@ -294,7 +236,7 @@ exports.onPreBootstrap = async () => {
294
236
 
295
237
  const summitId = process.env.GATSBY_SUMMIT_ID;
296
238
  const summitApiBaseUrl = process.env.GATSBY_SUMMIT_API_BASE_URL;
297
- let marketingSettings = await SSR_getMarketingSettings(process.env.GATSBY_MARKETING_API_BASE_URL, summitId);
239
+ let marketingSettings = await SSR_getMarketingSettings(process.env.GATSBY_MARKETING_API_BASE_URL, summitId);
298
240
  const siteSettings = fs.existsSync(SITE_SETTINGS_FILE_PATH) ? JSON.parse(fs.readFileSync(SITE_SETTINGS_FILE_PATH)) : {};
299
241
  const colors = fs.existsSync(COLORS_FILE_PATH) ? JSON.parse(fs.readFileSync(COLORS_FILE_PATH)) : require(`./${DEFAULT_COLORS_FILE_PATH}`);
300
242
 
@@ -343,7 +285,7 @@ exports.onPreBootstrap = async () => {
343
285
  }
344
286
 
345
287
  // summit
346
- const summit = await SSR_getSummit(summitApiBaseUrl, summitId);
288
+ const summit = await SSR_getSummit(summitApiBaseUrl, summitId, accessToken);
347
289
  fileBuildTimes.push({
348
290
  "file": SUMMIT_FILE_PATH,
349
291
  "build_time": Date.now()
@@ -390,7 +332,7 @@ exports.onPreBootstrap = async () => {
390
332
  // Show Sponsors
391
333
  const allSponsors = await SSR_getSponsors(summitApiBaseUrl, summitId, accessToken);
392
334
  console.log(`allSponsors ${allSponsors.length}`);
393
- const sponsorsWithCollections = await SSR_getSponsorCollections(allSponsors, summitApiBaseUrl, summitId, accessToken);
335
+ const sponsorsWithCollections = await SSR_getSponsorCollections(allSponsors, summitApiBaseUrl, summitId, accessToken);
394
336
  fileBuildTimes.push({
395
337
  "file": SPONSORS_FILE_PATH,
396
338
  "build_time": Date.now()
@@ -401,7 +343,7 @@ exports.onPreBootstrap = async () => {
401
343
  const allVoteablePresentations = await SSR_getVoteablePresentations(summitApiBaseUrl, summitId, accessToken);
402
344
  console.log(`allVoteablePresentations ${allVoteablePresentations.length}`);
403
345
  fileBuildTimes.push({
404
- "file":VOTEABLE_PRESENTATIONS_FILE_PATH,
346
+ "file": VOTEABLE_PRESENTATIONS_FILE_PATH,
405
347
  "build_time": Date.now()
406
348
  });
407
349
  fs.writeFileSync(VOTEABLE_PRESENTATIONS_FILE_PATH, JSON.stringify(allVoteablePresentations), "utf8");
@@ -550,7 +492,7 @@ exports.onCreatePage = async ({ page, actions }) => {
550
492
  const maintenancePath = `/${MAINTENANCE_PATH_NAME}/`;
551
493
 
552
494
  const shouldDeletePage = (maintenanceMode.enabled && page.path !== maintenancePath) ||
553
- (!maintenanceMode.enabled && page.path === maintenancePath);
495
+ (!maintenanceMode.enabled && page.path === maintenancePath);
554
496
 
555
497
  if (shouldDeletePage) {
556
498
  deletePage(page);
@@ -623,7 +565,7 @@ exports.onCreateWebpackConfig = ({
623
565
  // Specify the directory containing build artifacts
624
566
  include: [
625
567
  {
626
- paths: ["src","public",".cache"],
568
+ paths: ["src", "public", ".cache"],
627
569
  urlPrefix: "~/",
628
570
  },
629
571
  {
package/jest.setup.js ADDED
@@ -0,0 +1,2 @@
1
+ // jest.setup.js
2
+ import '@testing-library/jest-dom';
package/netlify.toml CHANGED
@@ -4,7 +4,7 @@
4
4
  [context.branch-deploy]
5
5
  ignore = "bash ./netlify-build-ignore.sh"
6
6
  [build.environment]
7
- NODE_VERSION = "18.15.0"
7
+ NODE_VERSION = "20.19.4"
8
8
  YARN_VERSION = "1.22.19"
9
9
  YARN_FLAGS = "--no-ignore-optional"
10
10
  NODE_OPTIONS = "--max-old-space-size=10240"
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@openeventkit/event-site",
3
3
  "description": "Event Site",
4
- "version": "2.1.18",
4
+ "version": "2.1.20",
5
5
  "author": "Tipit LLC",
6
6
  "dependencies": {
7
7
  "@emotion/server": "^11.11.0",
@@ -9,8 +9,8 @@
9
9
  "@fortawesome/free-brands-svg-icons": "^6.5.2",
10
10
  "@fortawesome/react-fontawesome": "^0.2.2",
11
11
  "@loadable/component": "^5.16.4",
12
- "@mdx-js/react": "^3.0.1",
13
- "@mdx-js/runtime": "^1.6.22",
12
+ "@mdx-js/mdx": "^3",
13
+ "@mdx-js/react": "^3",
14
14
  "@mui/base": "^5.0.0-beta.40",
15
15
  "@mui/icons-material": "^5.15.20",
16
16
  "@mui/material": "^5.15.20",
@@ -31,12 +31,12 @@
31
31
  "@types/markerclustererplus": "^2.1.33",
32
32
  "@types/react": "^16.9.42",
33
33
  "@vimeo/player": "^2.16.3",
34
- "ably": "^1.2.34",
34
+ "ably": "^2.11.0",
35
35
  "assert": "^2.1.0",
36
36
  "attendee-to-attendee-widget": "3.3.0",
37
37
  "autoprefixer": "10.4.14",
38
38
  "awesome-bootstrap-checkbox": "^1.0.1",
39
- "axios": "^0.19.2",
39
+ "axios": "^1.7",
40
40
  "babel-preset-gatsby": "^3.13.2",
41
41
  "browser-tabs-lock": "^1.2.15",
42
42
  "buffer": "^6.0.3",
@@ -55,7 +55,7 @@
55
55
  "font-awesome": "^4.7.0",
56
56
  "formik": "^2.4.6",
57
57
  "fs-extra": "^11.3.0",
58
- "full-schedule-widget": "3.0.11",
58
+ "full-schedule-widget": "3.1.0-beta.10",
59
59
  "gatsby": "^5.13.5",
60
60
  "gatsby-alias-imports": "^1.0.6",
61
61
  "gatsby-plugin-decap-cms": "^4.0.4",
@@ -78,11 +78,10 @@
78
78
  "immutability-helper": "2.9.1",
79
79
  "immutable": "^5.0.0-beta.5",
80
80
  "js-cookie": "^3.0.5",
81
- "jsdom": "^24.1.0",
82
81
  "klaro": "^0.7.21",
83
82
  "lite-schedule-widget": "3.0.3",
84
83
  "live-event-widget": "4.0.4",
85
- "lodash": "^4.17.19",
84
+ "lodash": "^4.17.21",
86
85
  "lz-string": "^1.4.4",
87
86
  "markdown-it": "^12.0.0",
88
87
  "moment": "^2.27.0",
@@ -123,9 +122,9 @@
123
122
  "redux-thunk": "^2.4.1",
124
123
  "rehype-external-links": "^3.0.0",
125
124
  "rehype-mdx-import-media": "^1.2.0",
126
- "remark-gfm": "^4.0.0",
125
+ "remark-gfm": "^4.0.1",
127
126
  "sass": "^1.49.9",
128
- "schedule-filter-widget": "3.0.4-beta.2",
127
+ "schedule-filter-widget": "3.0.5",
129
128
  "simple-chat-widget": "^1.0.31",
130
129
  "simple-oauth2": "^4.1.0",
131
130
  "slick-carousel": "^1.8.1",
@@ -142,7 +141,7 @@
142
141
  "urijs": "^1.19.2",
143
142
  "use-fit-text": "^2.4.0",
144
143
  "uuid": "^7.0.0",
145
- "validator": "^9.4.1",
144
+ "validator": "^13.11.0",
146
145
  "video.js": "^7.8.2",
147
146
  "videojs-mux": "^3.1.0",
148
147
  "videojs-youtube": "^2.6.1",
@@ -167,19 +166,21 @@
167
166
  "update-libs": "yarn upgrade live-event-widget openstack-uicore-foundation schedule-lite simple-chat-widget speakers-widget attendee-to-attendee-widget"
168
167
  },
169
168
  "devDependencies": {
169
+ "@babel/core": "^7",
170
170
  "@testing-library/dom": "^10.0.0",
171
171
  "@testing-library/jest-dom": "^6.4.2",
172
172
  "@testing-library/react": "^15.0.2",
173
173
  "@testing-library/user-event": "^14.5.2",
174
- "babel-jest": "^29.7.0",
174
+ "babel-jest": "^29",
175
175
  "devcert": "1.1.0",
176
176
  "gatsby-plugin-webpack-speed-measure": "^0.1.1",
177
177
  "identity-obj-proxy": "^3.0.0",
178
- "jest": "^28.1.0",
179
- "jest-environment-jsdom": "^28.1.0",
178
+ "jest": "^29",
179
+ "jest-environment-jsdom": "^29",
180
180
  "jest-transform-stub": "^2.0.0",
181
181
  "js-yaml": "^4.1.0",
182
182
  "js-yaml-loader": "^1.2.2",
183
+ "jsdom": "^24",
183
184
  "prettier": "^2.0.5"
184
185
  },
185
186
  "jest": {
@@ -188,7 +189,11 @@
188
189
  ],
189
190
  "moduleNameMapper": {
190
191
  "\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/__mocks__/fileMock.js",
191
- "\\.(css|scss)$": "identity-obj-proxy"
192
+ "\\.(css|scss)$": "identity-obj-proxy",
193
+ "^@mdx-js/mdx$": "<rootDir>/__mocks__/@mdx-js/mdx.js",
194
+ "^@mdx-js/react$": "<rootDir>/__mocks__/@mdx-js/react.js",
195
+ "^remark-gfm$": "<rootDir>/__mocks__/remark-gfm.js",
196
+ "^rehype-external-links$": "<rootDir>/__mocks__/rehype-external-links.js"
192
197
  },
193
198
  "testMatch": [
194
199
  "<rootDir>/src/**/__tests__/**/*.{js,jsx,mjs}",
@@ -215,6 +220,9 @@
215
220
  "window": {},
216
221
  "console": {}
217
222
  },
218
- "testEnvironment": "jsdom"
223
+ "testEnvironment": "jsdom",
224
+ "setupFilesAfterEnv": [
225
+ "<rootDir>/jest.setup.js"
226
+ ]
219
227
  }
220
228
  }
@@ -0,0 +1,32 @@
1
+ // __mocks__/@mdx-js/mdx.js
2
+ const React = require("react");
3
+ const { useMDXComponents } = require("@mdx-js/react");
4
+
5
+ // Minimal contract: evaluateSync returns a React component.
6
+ // We also support an error path when the source contains "BAD_MDX".
7
+ function evaluateSync(src /*, opts */) {
8
+ if (src && src.includes("BAD_MDX")) {
9
+ // Simulate a compile-time error so your try/catch logs + renders null
10
+ throw new Error("Mock MDX compile error");
11
+ }
12
+
13
+ function Comp() {
14
+ // Read provider-injected shortcodes/components (no need to render them)
15
+ const components = useMDXComponents();
16
+ const keys = components ? Object.keys(components) : [];
17
+
18
+ return React.createElement(
19
+ React.Fragment,
20
+ null,
21
+ React.createElement("div", { "data-testid": "mdx-source" }, src || ""),
22
+ React.createElement("div", {
23
+ "data-testid": "mdx-components",
24
+ "data-components": keys.join(","),
25
+ })
26
+ );
27
+ }
28
+
29
+ return { default: Comp };
30
+ }
31
+
32
+ module.exports = { evaluateSync };
@@ -0,0 +1,15 @@
1
+ // __mocks__/@mdx-js/react.js
2
+ const React = require("react");
3
+
4
+ const Ctx = React.createContext({});
5
+
6
+ function MDXProvider({ components = {}, children }) {
7
+ return React.createElement(Ctx.Provider, { value: components }, children);
8
+ }
9
+
10
+ function useMDXComponents(local) {
11
+ const ctx = React.useContext(Ctx);
12
+ return local || ctx || {};
13
+ }
14
+
15
+ module.exports = { MDXProvider, useMDXComponents };
@@ -0,0 +1,3 @@
1
+ // __mocks__/rehype-external-links.js
2
+ module.exports = function rehypeExternalLinks() { return () => {}; };
3
+ module.exports.default = module.exports;
@@ -0,0 +1,3 @@
1
+ // __mocks__/remark-gfm.js
2
+ module.exports = function remarkGfm() { return () => {}; };
3
+ module.exports.default = module.exports;