@museumwnf/viewer-core 2.23.0 → 2.23.1

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 (2) hide show
  1. package/package.json +1 -1
  2. package/src/legacySites.js +18 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@museumwnf/viewer-core",
3
- "version": "2.23.0",
3
+ "version": "2.23.1",
4
4
  "description": "Application engine for MWNF websites: turns a dataset.config.js into a mounted Vue application.",
5
5
  "type": "module",
6
6
  "license": "SEE LICENSE IN LICENSE.md",
@@ -122,6 +122,8 @@ const PAGES = {
122
122
  '/hcr_home.php': '/timeline', '/dynasties/': '/dynasties',
123
123
  '/isl_missionstatement.php': '/mission-statement', '/recommendedlinks.php': '/recommended-links',
124
124
  '/atrium_sponsor_detail.php': '/sponsors', '/glossarysearch.php': '/glossary-spelling',
125
+ // The list of the virtual exhibitions; each one is a mini-site row above.
126
+ '/exhibitions/isl': '/exhibitions', '/exhibitions/isl/': '/exhibitions', '/exhibitions/isl/index.php': '/exhibitions',
125
127
  },
126
128
  baroqueart: {
127
129
  '/': '/', '/index.php': '/',
@@ -206,6 +208,18 @@ function travelsRoute(path, url) {
206
208
  return null
207
209
  }
208
210
 
211
+ // Discover Islamic Art's partner page (`pm_partner.php?id=<partner>;<country>&type=museum|institution`),
212
+ // keyed as the importer keys a partner (`mwnf3:museums:…`, `mwnf3:institutions:…`). Travels' trails and the
213
+ // books link to it for their museums. Its other pages are PAGES above.
214
+ const PARTNER_KINDS = { museum: 'museums', institution: 'institutions' }
215
+ function islamicartRecordRoute(path, url) {
216
+ if (path.toLowerCase() !== '/pm_partner.php') return undefined
217
+ const [partner, country] = (url.searchParams.get('id') ?? '').split(';').map((part) => part.trim())
218
+ const kind = PARTNER_KINDS[(url.searchParams.get('type') ?? 'museum').toLowerCase()]
219
+ if (!partner || !country || !kind) return null
220
+ return `/partner/${legacyRecordId('partner', `mwnf3:${kind}:${partner}:${country}`)}`
221
+ }
222
+
209
223
  // The families whose pages name a record or a page in their address.
210
224
  const RECORD_PAGES = { publications: publicationsRoute, travels: travelsRoute }
211
225
 
@@ -241,6 +255,10 @@ function routeFor(row, url) {
241
255
  const lang = /^[a-z]{2}$/.test(rest[0] ?? '') ? rest.shift() : null
242
256
  return `/${rest.join('/')}${lang ? `?lang=${lang}` : ''}`
243
257
  }
258
+ if (row.family === 'islamicart') {
259
+ const record = islamicartRecordRoute(path, url)
260
+ if (record !== undefined) return record
261
+ }
244
262
  const route = PAGES[row.family]?.[pathname.toLowerCase()]
245
263
  if (!route) return null
246
264
  const keep = (KEPT_QUERY[route] ?? []).filter((key) => url.searchParams.has(key))