@skyservice-developers/vue-dev-kit 1.2.5 → 1.2.7
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/package.json
CHANGED
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
class="title-dropdown-item"
|
|
56
56
|
@click="selectItem(item)"
|
|
57
57
|
>
|
|
58
|
-
<p class="pageName">{{
|
|
58
|
+
<p class="pageName">{{ translateName(item.name) }}</p>
|
|
59
59
|
<small class="pageVisit">
|
|
60
60
|
({{ visitLabel }} {{ getTimeAgo(item.lastVisit) }})
|
|
61
61
|
</small>
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
<script setup>
|
|
81
81
|
import { ref, computed, onMounted, onUnmounted } from 'vue'
|
|
82
82
|
import { isInIframe } from '../../shared/utils/webviewCheck'
|
|
83
|
-
import { getParentLocalStorage } from '../../shared/utils/parentBridge'
|
|
83
|
+
import { getParentLocalStorage, getParentWindowValue } from '../../shared/utils/parentBridge'
|
|
84
84
|
|
|
85
85
|
const props = defineProps({
|
|
86
86
|
title: {
|
|
@@ -115,6 +115,14 @@ const props = defineProps({
|
|
|
115
115
|
type: String,
|
|
116
116
|
default: "Останнє відвідування",
|
|
117
117
|
},
|
|
118
|
+
trackPageName: {
|
|
119
|
+
type: String,
|
|
120
|
+
default: "",
|
|
121
|
+
},
|
|
122
|
+
trackPagePath: {
|
|
123
|
+
type: String,
|
|
124
|
+
default: "",
|
|
125
|
+
},
|
|
118
126
|
});
|
|
119
127
|
|
|
120
128
|
const emit = defineEmits(['back', 'navigate'])
|
|
@@ -123,6 +131,25 @@ const dropdownRef = ref(null)
|
|
|
123
131
|
const isDropdownOpen = ref(false)
|
|
124
132
|
|
|
125
133
|
const localStorageItems = ref([])
|
|
134
|
+
const parentLang = ref({})
|
|
135
|
+
|
|
136
|
+
// Track page visit in parent's componentStats
|
|
137
|
+
if (isInIframe() && props.trackPageName) {
|
|
138
|
+
window.parent.postMessage({
|
|
139
|
+
type: 'trackVisit',
|
|
140
|
+
name: props.trackPageName,
|
|
141
|
+
path: props.trackPagePath || `/${props.trackPageName}`,
|
|
142
|
+
}, '*')
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// Load translations from parent
|
|
146
|
+
if (isInIframe()) {
|
|
147
|
+
getParentWindowValue('lang').then((data) => {
|
|
148
|
+
if (data != null) {
|
|
149
|
+
parentLang.value = data
|
|
150
|
+
}
|
|
151
|
+
})
|
|
152
|
+
}
|
|
126
153
|
|
|
127
154
|
function loadComponentStats(raw) {
|
|
128
155
|
try {
|
|
@@ -163,21 +190,17 @@ const closeDropdown = () => {
|
|
|
163
190
|
}
|
|
164
191
|
|
|
165
192
|
const selectItem = (item) => {
|
|
166
|
-
console.log('[Header] selectItem clicked, item:', item)
|
|
167
|
-
console.log('[Header] item.path:', item.path)
|
|
168
|
-
console.log('[Header] isInIframe:', isInIframe())
|
|
169
193
|
emit('navigate', item.path)
|
|
170
194
|
if (isInIframe()) {
|
|
171
|
-
console.log('[Header] sending postMessage navigate to parent, path:', item.path)
|
|
172
195
|
window.parent.postMessage({ type: 'navigate', path: item.path }, '*')
|
|
173
|
-
console.log('[Header] postMessage sent')
|
|
174
196
|
}
|
|
175
197
|
closeDropdown()
|
|
176
198
|
}
|
|
177
199
|
|
|
178
|
-
const
|
|
179
|
-
if (!
|
|
180
|
-
|
|
200
|
+
const translateName = (name) => {
|
|
201
|
+
if (!name) return ''
|
|
202
|
+
const translated = parentLang.value[name] || name
|
|
203
|
+
return translated.charAt(0).toUpperCase() + translated.slice(1)
|
|
181
204
|
}
|
|
182
205
|
|
|
183
206
|
const getTimeAgo = (lastVisit) => {
|