@asd20/ui-next 2.10.1 → 2.10.3

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 CHANGED
@@ -1,5 +1,14 @@
1
1
  # Changelog
2
2
 
3
+ ## [2.10.3](https://github.com/academydistrict20/asd20-ui-next/compare/ui-next-v2.10.2...ui-next-v2.10.3) (2026-05-13)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * fix 404 recommending related pages from other orgs ([4893091](https://github.com/academydistrict20/asd20-ui-next/commit/4893091a2859cca4555f05d956b25eb251722903))
9
+
10
+ ## [2.10.2](https://github.com/academydistrict20/asd20-ui-next/compare/ui-next-v2.10.1...ui-next-v2.10.2) (2026-05-13)
11
+
3
12
  ## [2.10.1](https://github.com/academydistrict20/asd20-ui-next/compare/ui-next-v2.10.0...ui-next-v2.10.1) (2026-05-12)
4
13
 
5
14
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@asd20/ui-next",
3
- "version": "2.10.1",
3
+ "version": "2.10.3",
4
4
  "private": false,
5
5
  "description": "ASD20 UI component library for Vue 3.",
6
6
  "license": "MIT",
@@ -393,6 +393,7 @@ export default {
393
393
  color: var(--website-footer__title-color);
394
394
  font-size: 0.75rem !important;
395
395
  flex-grow: 0;
396
+ padding: 0.85rem;
396
397
  }
397
398
  }
398
399
  .copyright {
@@ -87,6 +87,7 @@ import pageTemplateMixin from '../../../mixins/pageTemplateMixin'
87
87
  // import Asd20PageContent from '../../../components/organisms/Asd20PageContent'
88
88
 
89
89
  const MAX_SUGGESTED_PAGES = 10
90
+
90
91
  export default {
91
92
  components: {
92
93
  Asd20List,
@@ -95,6 +96,9 @@ export default {
95
96
  // Asd20PageContent,
96
97
  },
97
98
  mixins: [pageTemplateMixin],
99
+ props: {
100
+ queryPagesHandler: { type: Function, default: null },
101
+ },
98
102
 
99
103
  data: () => ({
100
104
  suggestedPagesListItems: [],
@@ -130,6 +134,56 @@ export default {
130
134
  )
131
135
  )
132
136
  },
137
+ getCurrentOrganizationId() {
138
+ return this.organization && this.organization.id
139
+ ? String(this.organization.id).trim()
140
+ : ''
141
+ },
142
+ getSuggestedPageOrganizationId(page = {}) {
143
+ if (typeof page.ownerOrganizationId === 'string') {
144
+ return page.ownerOrganizationId.trim()
145
+ }
146
+
147
+ if (
148
+ page.ownerOrganization &&
149
+ typeof page.ownerOrganization.id === 'string'
150
+ ) {
151
+ return page.ownerOrganization.id.trim()
152
+ }
153
+
154
+ return ''
155
+ },
156
+ isSuggestedPageForCurrentOrganization(page = {}) {
157
+ if (page.isNoResultsFallback) return true
158
+
159
+ const currentOrganizationId = this.getCurrentOrganizationId()
160
+ if (!currentOrganizationId) return true
161
+
162
+ return this.getSuggestedPageOrganizationId(page) === currentOrganizationId
163
+ },
164
+ getSuggestedPageSearchPayload(keywords = '') {
165
+ const organizationId = this.getCurrentOrganizationId()
166
+
167
+ return {
168
+ keywords,
169
+ top: MAX_SUGGESTED_PAGES,
170
+ organizations: organizationId ? [organizationId] : [],
171
+ includeDistrictResults: false,
172
+ }
173
+ },
174
+ async querySuggestedPages(keywords = '') {
175
+ const payload = this.getSuggestedPageSearchPayload(keywords)
176
+
177
+ if (typeof this.queryPagesHandler === 'function') {
178
+ const result = await this.queryPagesHandler(payload)
179
+
180
+ return Array.isArray(result) ? result : result?.pages || []
181
+ }
182
+
183
+ const { pages } = await queryPages(payload)
184
+
185
+ return pages
186
+ },
133
187
  getSuggestedPageDedupKey(page = {}) {
134
188
  const normalizedUrl = this.normalizeSearchText(page.url || '')
135
189
 
@@ -174,10 +228,12 @@ export default {
174
228
  return keywordTokens.some(token => haystack.includes(token))
175
229
  },
176
230
  sanitizeSuggestedPages(pages = [], keywords = '') {
177
- const dedupedPages = this.dedupeSuggestedPages(
231
+ const organizationPages = this.dedupeSuggestedPages(
178
232
  Array.isArray(pages) ? pages : []
233
+ ).filter(page =>
234
+ this.isSuggestedPageForCurrentOrganization(page)
179
235
  )
180
- const relevantPages = dedupedPages.filter(page =>
236
+ const relevantPages = organizationPages.filter(page =>
181
237
  this.isRelevantSuggestedPage(page, keywords)
182
238
  )
183
239
  const resolvedPages = relevantPages.length
@@ -193,7 +249,7 @@ export default {
193
249
  .trim()
194
250
  .toLowerCase()
195
251
  try {
196
- const { pages } = await queryPages({ keywords, top: MAX_SUGGESTED_PAGES })
252
+ const pages = await this.querySuggestedPages(keywords)
197
253
 
198
254
  this.suggestedPagesListItems = mapPagesToListItems(
199
255
  this.sanitizeSuggestedPages(pages, keywords)
@@ -75,13 +75,11 @@ function searchPayload(state) {
75
75
  // )
76
76
  // }
77
77
 
78
- // if (state.organizations.length > 0) {
79
- // filters.push(
80
- // `organizations/any(t: search.in(t, '${state.organizations.join(
81
- // ','
82
- // )}', ',')) `
83
- // )
84
- // }
78
+ if (state.organizations.length > 0) {
79
+ filters.push(
80
+ `search.in(ownerOrganizationId, '${state.organizations.join(',')}', ',')`
81
+ )
82
+ }
85
83
 
86
84
  let payload = {
87
85
  count: true,