@awes-io/ui 2.144.7 → 2.145.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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,28 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [2.145.1](https://github.com/awes-io/client/compare/@awes-io/ui@2.145.0...@awes-io/ui@2.145.1) (2026-08-21)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **ui:** destroy google maps instances on component teardown ([585a6e8](https://github.com/awes-io/client/commit/585a6e85a38b29e59d8ee518791e736e12b6522c))
12
+
13
+
14
+
15
+
16
+
17
+ # 2.145.0 (2026-08-10)
18
+
19
+
20
+ ### Features
21
+
22
+ * separate avatar profile url in user menu ([14d7ddf](https://github.com/awes-io/client/commit/14d7ddfa026ebc29105559b2900c7bda85ca58a5))
23
+
24
+
25
+
26
+
27
+
6
28
  ## [2.144.7](https://github.com/awes-io/client/compare/@awes-io/ui@2.144.6...@awes-io/ui@2.144.7) (2026-04-29)
7
29
 
8
30
 
@@ -76,6 +76,8 @@ export default {
76
76
  return
77
77
  }
78
78
 
79
+ if (!this.placesService) return
80
+
79
81
  this.placesService.getDetails(
80
82
  {
81
83
  placeId: place.place_id,
@@ -100,19 +102,22 @@ export default {
100
102
  this.$nextTick(this.init)
101
103
  },
102
104
 
105
+ beforeDestroy() {
106
+ this.destroyServices()
107
+ },
108
+
103
109
  methods: {
104
110
  async init() {
105
111
  if (!this.isGmInited()) {
106
112
  await this.gmInit()
107
113
  }
108
114
 
115
+ if (this.gmDestroyed || !this.$refs.place) {
116
+ return
117
+ }
118
+
109
119
  if (!window.google) {
110
- if (this.attempt < this.maxLoadScripAttempts) {
111
- setTimeout(this.init, 200)
112
- this.attempt++
113
- } else {
114
- console.error('Cannot load Google script')
115
- }
120
+ this.gmRetryInit(this.init)
116
121
  return
117
122
  }
118
123
 
@@ -122,6 +127,14 @@ export default {
122
127
  )
123
128
  },
124
129
 
130
+ destroyServices() {
131
+ this.gmClearInstance(this.autocomplete)
132
+ this.gmClearInstance(this.placesService)
133
+ this.autocomplete = null
134
+ this.placesService = null
135
+ this.sessionToken = null
136
+ },
137
+
125
138
  search(text) {
126
139
  if (!this.autocomplete) return
127
140
 
@@ -151,6 +164,8 @@ export default {
151
164
  },
152
165
 
153
166
  _setSuggestions(data) {
167
+ if (!this.$refs.select) return
168
+
154
169
  this.$refs.select.isLoading = false
155
170
  this.suggestions = data || []
156
171
  },
@@ -76,6 +76,10 @@ export default {
76
76
  this.$nextTick(this.init)
77
77
  },
78
78
 
79
+ beforeDestroy() {
80
+ this.destroyMap()
81
+ },
82
+
79
83
  watch: {
80
84
  options(val) {
81
85
  if (val && this.map) {
@@ -90,13 +94,12 @@ export default {
90
94
  await this.gmInit()
91
95
  }
92
96
 
97
+ if (this.gmDestroyed || !this.$refs.map) {
98
+ return
99
+ }
100
+
93
101
  if (!window.google) {
94
- if (this.attempt < this.maxLoadScripAttempts) {
95
- setTimeout(this.init, 200)
96
- this.attempt++
97
- } else {
98
- console.error('Cannot load Google script')
99
- }
102
+ this.gmRetryInit(this.init)
100
103
  return
101
104
  }
102
105
 
@@ -115,6 +118,12 @@ export default {
115
118
  this.$emit(eventName, event)
116
119
  })
117
120
  })
121
+ },
122
+
123
+ destroyMap() {
124
+ this.gmClearInstance(this.map)
125
+ this.gmClearInstance(this.$refs.map)
126
+ this.map = null
118
127
  }
119
128
  }
120
129
  }
@@ -3,6 +3,8 @@
3
3
  </template>
4
4
 
5
5
  <script>
6
+ import { pathOr } from 'rambdax'
7
+
6
8
  const events = [
7
9
  'click',
8
10
  'rightclick',
@@ -48,8 +50,16 @@ export default {
48
50
  this.$nextTick(this.init)
49
51
  },
50
52
 
53
+ beforeDestroy() {
54
+ this.destroyMarker()
55
+ },
56
+
51
57
  methods: {
52
58
  init() {
59
+ if (this._isDestroyed || !window.google || !this.google.map) {
60
+ return
61
+ }
62
+
53
63
  this.marker = new window.google.maps.Marker({
54
64
  map: this.google.map,
55
65
  ...this.options
@@ -63,6 +73,19 @@ export default {
63
73
  this.$emit(eventName, event)
64
74
  })
65
75
  })
76
+ },
77
+
78
+ destroyMarker() {
79
+ if (!this.marker) return
80
+
81
+ const event = pathOr(null, 'google.maps.event', window)
82
+
83
+ if (event) {
84
+ event.clearInstanceListeners(this.marker)
85
+ }
86
+
87
+ this.marker.setMap(null)
88
+ this.marker = null
66
89
  }
67
90
  }
68
91
  }
@@ -58,10 +58,12 @@
58
58
  }"
59
59
  >
60
60
  <Component
61
- :is="profileUrlAttr.is"
62
- v-bind="profileUrlAttr"
61
+ :is="avatarProfileUrlAttr.is"
62
+ v-bind="avatarProfileUrlAttr"
63
63
  class="aw-user-menu__header"
64
- :class="{ 'aw-user-menu__header--hoverable': profileUrl }"
64
+ :class="{
65
+ 'aw-user-menu__header--hoverable': avatarProfileUrl
66
+ }"
65
67
  >
66
68
  <AwUserpic v-bind="user" big-image />
67
69
  </Component>
@@ -230,41 +232,41 @@ export default {
230
232
  },
231
233
 
232
234
  profileUrl() {
233
- const profileUrl = pathOr(
234
- null,
235
- 'state.awesIo.profileUrl',
236
- this.$store
237
- )
238
-
239
- return isType('Function', profileUrl)
240
- ? profileUrl(this.$store.state, this.$store.getters)
241
- : profileUrl
235
+ return this._resolveUrl('profileUrl')
242
236
  },
243
237
 
244
- isExternalProfileUrl() {
245
- return (
246
- typeof this.profileUrl === 'string' &&
247
- this.profileUrl &&
248
- LINK_REGEX.test(this.profileUrl)
249
- )
238
+ avatarProfileUrl() {
239
+ return this._resolveUrl('avatarProfileUrl') || this.profileUrl
250
240
  },
251
241
 
252
- profileUrlAttr() {
253
- if (this.isExternalProfileUrl) {
242
+ avatarProfileUrlAttr() {
243
+ const url = this.avatarProfileUrl
244
+ const isExternal =
245
+ typeof url === 'string' && url && LINK_REGEX.test(url)
246
+
247
+ if (isExternal) {
254
248
  return {
255
- href: this.profileUrl,
249
+ href: url,
256
250
  is: 'a'
257
251
  }
258
252
  } else {
259
253
  return {
260
- to: this.profileUrl || null,
261
- is: this.profileUrl ? 'NLink' : 'div'
254
+ to: url || null,
255
+ is: url ? 'NLink' : 'div'
262
256
  }
263
257
  }
264
258
  }
265
259
  },
266
260
 
267
261
  methods: {
262
+ _resolveUrl(key) {
263
+ const url = pathOr(null, `state.awesIo.${key}`, this.$store)
264
+
265
+ return isType('Function', url)
266
+ ? url(this.$store.state, this.$store.getters)
267
+ : url
268
+ },
269
+
268
270
  _pickButtonProps(props) {
269
271
  return omit('icon,iconActive,children,listeners,description', props)
270
272
  },
@@ -1,5 +1,14 @@
1
1
  import loadjs from 'loadjs'
2
- import { filter, isEmpty, toPairs, join, map, not, compose } from 'rambdax'
2
+ import {
3
+ filter,
4
+ isEmpty,
5
+ toPairs,
6
+ join,
7
+ map,
8
+ not,
9
+ compose,
10
+ pathOr
11
+ } from 'rambdax'
3
12
 
4
13
  const GOOGLE_MAPS_ID = 'google-maps'
5
14
 
@@ -55,6 +64,16 @@ export default {
55
64
  }
56
65
  },
57
66
 
67
+ created() {
68
+ this.gmDestroyed = false
69
+ this.gmInitTimer = null
70
+ },
71
+
72
+ beforeDestroy() {
73
+ this.gmDestroyed = true
74
+ this.gmClearInitTimer()
75
+ },
76
+
58
77
  methods: {
59
78
  gmInit() {
60
79
  return loadjs([this.gmLibUrl], GOOGLE_MAPS_ID, {
@@ -64,6 +83,33 @@ export default {
64
83
 
65
84
  isGmInited() {
66
85
  return loadjs.isDefined(GOOGLE_MAPS_ID)
86
+ },
87
+
88
+ gmRetryInit(handler) {
89
+ this.gmClearInitTimer()
90
+
91
+ if (this.attempt >= this.maxLoadScripAttempts) {
92
+ console.error('Cannot load Google script')
93
+ return
94
+ }
95
+
96
+ this.attempt++
97
+ this.gmInitTimer = setTimeout(handler, 200)
98
+ },
99
+
100
+ gmClearInitTimer() {
101
+ if (this.gmInitTimer) {
102
+ clearTimeout(this.gmInitTimer)
103
+ this.gmInitTimer = null
104
+ }
105
+ },
106
+
107
+ gmClearInstance(instance) {
108
+ const event = pathOr(null, 'google.maps.event', window)
109
+
110
+ if (instance && event) {
111
+ event.clearInstanceListeners(instance)
112
+ }
67
113
  }
68
114
  }
69
115
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@awes-io/ui",
3
- "version": "2.144.7",
3
+ "version": "2.145.1",
4
4
  "description": "User Interface (UI) components",
5
5
  "keywords": [
6
6
  "ui",
@@ -116,5 +116,5 @@
116
116
  "peerDependencies": {
117
117
  "nuxt": "^2.18.1"
118
118
  },
119
- "gitHead": "c1b618630916542d32561ad147d5475d0fb5c913"
119
+ "gitHead": "b0e0122306c0ef4a6c716f6afc0d83f774b29b0e"
120
120
  }
package/store/awesIo.js CHANGED
@@ -19,6 +19,7 @@ export const state = () => ({
19
19
  screen: {},
20
20
 
21
21
  profileUrl: null,
22
+ avatarProfileUrl: null,
22
23
  afterProfileComponent: null,
23
24
  userName: '',
24
25