@asd20/ui-next 2.10.2 → 2.10.4
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,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [2.10.4](https://github.com/academydistrict20/asd20-ui-next/compare/ui-next-v2.10.3...ui-next-v2.10.4) (2026-05-14)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* fix semantic markup for search component ([d63ce71](https://github.com/academydistrict20/asd20-ui-next/commit/d63ce71b149db115813fda8ff14e905612c526ba))
|
|
9
|
+
|
|
10
|
+
## [2.10.3](https://github.com/academydistrict20/asd20-ui-next/compare/ui-next-v2.10.2...ui-next-v2.10.3) (2026-05-13)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* fix 404 recommending related pages from other orgs ([4893091](https://github.com/academydistrict20/asd20-ui-next/commit/4893091a2859cca4555f05d956b25eb251722903))
|
|
16
|
+
|
|
3
17
|
## [2.10.2](https://github.com/academydistrict20/asd20-ui-next/compare/ui-next-v2.10.1...ui-next-v2.10.2) (2026-05-13)
|
|
4
18
|
|
|
5
19
|
## [2.10.1](https://github.com/academydistrict20/asd20-ui-next/compare/ui-next-v2.10.0...ui-next-v2.10.1) (2026-05-12)
|
package/package.json
CHANGED
|
@@ -32,8 +32,7 @@
|
|
|
32
32
|
!searchingAi
|
|
33
33
|
"
|
|
34
34
|
title="Ask a Question or Search by Keyword"
|
|
35
|
-
description="
|
|
36
|
-
<hr/>AI can make mistakes. Verify important information."
|
|
35
|
+
:description="idleSearchDescription"
|
|
37
36
|
/>
|
|
38
37
|
<div
|
|
39
38
|
v-if="showSearchInputBeforeResults"
|
|
@@ -268,8 +267,7 @@
|
|
|
268
267
|
!searchingAi
|
|
269
268
|
"
|
|
270
269
|
title="Ask a Question or Search by Keyword"
|
|
271
|
-
description="
|
|
272
|
-
<hr/>AI can make mistakes. Verify important information."
|
|
270
|
+
:description="idleSearchDescription"
|
|
273
271
|
/>
|
|
274
272
|
<asd20-notification
|
|
275
273
|
v-if="aiErrorMessage"
|
|
@@ -320,8 +318,7 @@
|
|
|
320
318
|
!searchingAi
|
|
321
319
|
"
|
|
322
320
|
title="Ask a Question or Search by Keyword"
|
|
323
|
-
description="
|
|
324
|
-
<hr/>AI can make mistakes. Verify important information."
|
|
321
|
+
:description="idleSearchDescription"
|
|
325
322
|
/>
|
|
326
323
|
<asd20-notification
|
|
327
324
|
v-if="
|
|
@@ -377,8 +374,7 @@
|
|
|
377
374
|
!searchingAi
|
|
378
375
|
"
|
|
379
376
|
title="Ask a Question or Search by Keyword"
|
|
380
|
-
description="
|
|
381
|
-
<hr/>AI can make mistakes. Verify important information."
|
|
377
|
+
:description="idleSearchDescription"
|
|
382
378
|
/>
|
|
383
379
|
<asd20-notification
|
|
384
380
|
v-if="keywords && currentFiles.length === 0 && !searchingFiles"
|
|
@@ -581,6 +577,11 @@ const SEARCH_NO_PAGE_RESULTS_FALLBACKS = NO_PAGE_RESULTS_FALLBACKS.map(
|
|
|
581
577
|
ownerOrganizationId: DISTRICT_ORG_ID,
|
|
582
578
|
})
|
|
583
579
|
)
|
|
580
|
+
const IDLE_SEARCH_DESCRIPTION = [
|
|
581
|
+
'Asking a <strong>question</strong> will generate an AI answer with related pages and files. ',
|
|
582
|
+
'Or just search for pages and files by entering <strong>keyword(s)</strong>.',
|
|
583
|
+
'<hr/>AI can make mistakes. Verify important information.',
|
|
584
|
+
].join('')
|
|
584
585
|
|
|
585
586
|
// const SUBDOMAIN_LABELS = {
|
|
586
587
|
// rampart: 'Rampart High School',
|
|
@@ -704,6 +705,10 @@ export default {
|
|
|
704
705
|
}),
|
|
705
706
|
|
|
706
707
|
computed: {
|
|
708
|
+
idleSearchDescription() {
|
|
709
|
+
return IDLE_SEARCH_DESCRIPTION
|
|
710
|
+
},
|
|
711
|
+
|
|
707
712
|
currentPages() {
|
|
708
713
|
if (Array.isArray(this.localSearchPages)) return this.localSearchPages
|
|
709
714
|
return Array.isArray(this.resolvedPages) ? this.resolvedPages : []
|
|
@@ -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
|
|
231
|
+
const organizationPages = this.dedupeSuggestedPages(
|
|
178
232
|
Array.isArray(pages) ? pages : []
|
|
233
|
+
).filter(page =>
|
|
234
|
+
this.isSuggestedPageForCurrentOrganization(page)
|
|
179
235
|
)
|
|
180
|
-
const relevantPages =
|
|
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
|
|
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
|
-
|
|
79
|
-
|
|
80
|
-
|
|
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,
|