@asd20/ui-next 2.2.1 → 2.2.2

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,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [2.2.2](https://github.com/academydistrict20/asd20-ui-next/compare/ui-next-v2.2.1...ui-next-v2.2.2) (2026-04-13)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * fix log search analytics not executing ([5c94742](https://github.com/academydistrict20/asd20-ui-next/commit/5c94742ed63517c5f5ba918583b052606951a842))
9
+
3
10
  ## [2.2.1](https://github.com/academydistrict20/asd20-ui-next/compare/ui-next-v2.2.0...ui-next-v2.2.1) (2026-04-07)
4
11
 
5
12
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@asd20/ui-next",
3
- "version": "2.2.1",
3
+ "version": "2.2.2",
4
4
  "private": false,
5
5
  "description": "ASD20 UI component library for Vue 3.",
6
6
  "license": "MIT",
@@ -979,8 +979,9 @@ export default {
979
979
  },
980
980
  feedbackFormUrlRaw() {
981
981
  if (this.aiSearchFeedbackFormUrl) return this.aiSearchFeedbackFormUrl
982
- if (this.$config && this.$config.aiSearchFeedbackFormUrl)
983
- return this.$config.aiSearchFeedbackFormUrl
982
+ const runtimeConfig = this.resolveRuntimeConfig()
983
+ if (runtimeConfig.aiSearchFeedbackFormUrl)
984
+ return runtimeConfig.aiSearchFeedbackFormUrl
984
985
  return ''
985
986
  },
986
987
 
@@ -2213,6 +2214,28 @@ export default {
2213
2214
  this.$emit('update:active', false)
2214
2215
  },
2215
2216
 
2217
+ resolveRuntimeConfig() {
2218
+ const runtimeConfig =
2219
+ this.$config ||
2220
+ this.$store?.$config ||
2221
+ this.$?.appContext?.config?.globalProperties?.$config ||
2222
+ {}
2223
+
2224
+ if (
2225
+ runtimeConfig.public &&
2226
+ typeof runtimeConfig.public === 'object' &&
2227
+ !Array.isArray(runtimeConfig.public)
2228
+ ) {
2229
+ return runtimeConfig.public
2230
+ }
2231
+
2232
+ return runtimeConfig
2233
+ },
2234
+
2235
+ resolveFunctionsEndpoint() {
2236
+ return this.resolveRuntimeConfig().functionsEndpoint || ''
2237
+ },
2238
+
2216
2239
  toggleKeywords(turnId) {
2217
2240
  this.expandedKeywordsTurnId =
2218
2241
  this.expandedKeywordsTurnId === turnId ? null : turnId
@@ -2253,10 +2276,7 @@ export default {
2253
2276
  const response = await logSearchFeedback({
2254
2277
  searchLogId: turn.searchLogId,
2255
2278
  feedbackValue,
2256
- functionsEndpoint:
2257
- this.$config && this.$config.functionsEndpoint
2258
- ? this.$config.functionsEndpoint
2259
- : null,
2279
+ functionsEndpoint: this.resolveFunctionsEndpoint() || null,
2260
2280
  })
2261
2281
 
2262
2282
  if (response && response.ok) {
@@ -2330,10 +2350,7 @@ export default {
2330
2350
  const response = await logSearchFeedback({
2331
2351
  searchLogId: targetTurn.searchLogId,
2332
2352
  improvementFeedback,
2333
- functionsEndpoint:
2334
- this.$config && this.$config.functionsEndpoint
2335
- ? this.$config.functionsEndpoint
2336
- : null,
2353
+ functionsEndpoint: this.resolveFunctionsEndpoint() || null,
2337
2354
  })
2338
2355
 
2339
2356
  if (response && response.ok) {
@@ -2543,10 +2560,7 @@ export default {
2543
2560
  : null,
2544
2561
  languageCode: this.getSearchLanguageCode(),
2545
2562
  isFollowup: false,
2546
- functionsEndpoint:
2547
- this.$config && this.$config.functionsEndpoint
2548
- ? this.$config.functionsEndpoint
2549
- : null,
2563
+ functionsEndpoint: this.resolveFunctionsEndpoint() || null,
2550
2564
  })
2551
2565
  }
2552
2566
  },
@@ -2797,10 +2811,7 @@ export default {
2797
2811
  : null,
2798
2812
  languageCode: this.getSearchLanguageCode(),
2799
2813
  isFollowup: isFollowUpQuestion,
2800
- functionsEndpoint:
2801
- this.$config && this.$config.functionsEndpoint
2802
- ? this.$config.functionsEndpoint
2803
- : null,
2814
+ functionsEndpoint: this.resolveFunctionsEndpoint() || null,
2804
2815
  aiResponse: assistantResponseForAnalytics || null,
2805
2816
  })
2806
2817
  if (assistantTurnId) {
@@ -1,5 +1,12 @@
1
1
  import axios from 'axios'
2
2
 
3
+ function resolveNuxtWindowConfig() {
4
+ if (typeof window === 'undefined' || !window.__NUXT__) return {}
5
+
6
+ const runtimeConfig = window.__NUXT__.config
7
+ return runtimeConfig && typeof runtimeConfig === 'object' ? runtimeConfig : {}
8
+ }
9
+
3
10
  export function resolveFunctionsEndpoint(payload) {
4
11
  const explicitEndpoint =
5
12
  payload && typeof payload.functionsEndpoint === 'string'
@@ -13,10 +20,15 @@ export function resolveFunctionsEndpoint(payload) {
13
20
  if (processEndpoint) return processEndpoint
14
21
  }
15
22
 
16
- if (typeof window !== 'undefined' && window.__NUXT__ && window.__NUXT__.config) {
17
- const nuxtEndpoint = window.__NUXT__.config.functionsEndpoint
18
- if (typeof nuxtEndpoint === 'string' && nuxtEndpoint.trim()) {
19
- return nuxtEndpoint.trim()
23
+ const nuxtConfig = resolveNuxtWindowConfig()
24
+ const nuxtEndpoints = [
25
+ nuxtConfig.functionsEndpoint,
26
+ nuxtConfig.public && nuxtConfig.public.functionsEndpoint,
27
+ ]
28
+
29
+ for (const candidate of nuxtEndpoints) {
30
+ if (typeof candidate === 'string' && candidate.trim()) {
31
+ return candidate.trim()
20
32
  }
21
33
  }
22
34
 
@@ -1,6 +1,8 @@
1
1
  // helpers/search/queryAiSite.js
2
2
  import axios from 'axios'
3
3
 
4
+ import { resolveFunctionsEndpoint } from './logSearchAnalytics'
5
+
4
6
  /**
5
7
  * Calls Azure Function / API for AI site search.
6
8
  * Expected response shape:
@@ -14,14 +16,20 @@ export default async function queryAiSite({
14
16
  organizationId = null,
15
17
  organizationWebsite = null,
16
18
  includeDistrictResults = true,
19
+ functionsEndpoint = null,
17
20
  }) {
18
21
  const q = (question || '').trim()
19
22
  if (!q) {
20
23
  return { answer: null, sources: [] }
21
24
  }
22
25
 
26
+ const endpoint = resolveFunctionsEndpoint({ functionsEndpoint })
27
+ if (!endpoint) {
28
+ throw new Error('functionsEndpoint is required for AI site search.')
29
+ }
30
+
23
31
  const { data } = await axios.post(
24
- process.env.FUNCTIONS_ENDPOINT + '/ai-site-search',
32
+ endpoint.replace(/\/$/, '') + '/ai-site-search',
25
33
  {
26
34
  question: q,
27
35
  organizationId,