@asd20/ui-next 2.10.9 → 2.10.10
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/CHANGELOG.md +7 -0
- package/package.json +1 -1
- package/src/helpers/mapMessageToCard.js +25 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [2.10.10](https://github.com/academydistrict20/asd20-ui-next/compare/ui-next-v2.10.9...ui-next-v2.10.10) (2026-05-20)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* normalize card slugs ([d5a7119](https://github.com/academydistrict20/asd20-ui-next/commit/d5a7119690c453a3b19a879aac311dcf43f945b5))
|
|
9
|
+
|
|
3
10
|
## [2.10.9](https://github.com/academydistrict20/asd20-ui-next/compare/ui-next-v2.10.8...ui-next-v2.10.9) (2026-05-19)
|
|
4
11
|
|
|
5
12
|
|
package/package.json
CHANGED
|
@@ -68,6 +68,22 @@ function formatApDate(iso) {
|
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
+
function normalizeMessageSlug(slug) {
|
|
72
|
+
return typeof slug === 'string'
|
|
73
|
+
? slug.trim().replace(/^\/+/, '').replace(/\/+$/, '')
|
|
74
|
+
: ''
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function buildMessageLink({ prefix, slug, website = '' }) {
|
|
78
|
+
const normalizedSlug = normalizeMessageSlug(slug)
|
|
79
|
+
const normalizedWebsite = website.replace(/\/+$/, '')
|
|
80
|
+
|
|
81
|
+
if (!prefix || !normalizedSlug) return normalizedWebsite || prefix || '/'
|
|
82
|
+
|
|
83
|
+
const normalizedPrefix = prefix.endsWith('/') ? prefix : `${prefix}/`
|
|
84
|
+
return `${normalizedWebsite}${normalizedPrefix}${normalizedSlug}/`
|
|
85
|
+
}
|
|
86
|
+
|
|
71
87
|
export default function mapMessageToCard(
|
|
72
88
|
message,
|
|
73
89
|
options = {},
|
|
@@ -97,7 +113,10 @@ export default function mapMessageToCard(
|
|
|
97
113
|
}
|
|
98
114
|
|
|
99
115
|
// Check for organization ID match
|
|
100
|
-
let baseLink =
|
|
116
|
+
let baseLink = buildMessageLink({
|
|
117
|
+
prefix: channelPrefixMap[channelTitle],
|
|
118
|
+
slug: message.slug,
|
|
119
|
+
})
|
|
101
120
|
let sourceOrg = null
|
|
102
121
|
let websiteLogo = null
|
|
103
122
|
|
|
@@ -119,7 +138,11 @@ export default function mapMessageToCard(
|
|
|
119
138
|
|
|
120
139
|
// Keep destination-targeted content on the current site URL.
|
|
121
140
|
if (!hasDestinations && matchedOrg.website) {
|
|
122
|
-
baseLink =
|
|
141
|
+
baseLink = buildMessageLink({
|
|
142
|
+
prefix: channelPrefixMap[channelTitle],
|
|
143
|
+
slug: message.slug,
|
|
144
|
+
website: matchedOrg.website,
|
|
145
|
+
})
|
|
123
146
|
}
|
|
124
147
|
} else {
|
|
125
148
|
websiteLogo = organization.logoImageUrl
|