@abi-software/flatmapvuer 1.13.2 → 1.13.3-demo.0
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/dist/flatmapvuer.js +1705 -1651
- package/dist/flatmapvuer.umd.cjs +11 -11
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/components/FlatmapVuer.vue +33 -5
- package/src/components/MultiFlatmapVuer.vue +14 -0
- package/src/components/utilities.js +35 -0
package/package.json
CHANGED
|
@@ -630,7 +630,7 @@ import {
|
|
|
630
630
|
getKnowledgeSource,
|
|
631
631
|
getReferenceConnectivitiesByAPI,
|
|
632
632
|
} from '../services/flatmapKnowledge.js'
|
|
633
|
-
import { capitalise } from './utilities.js'
|
|
633
|
+
import { capitalise, normaliseAlertToStringArray } from './utilities.js'
|
|
634
634
|
import yellowstar from '../icons/yellowstar'
|
|
635
635
|
import ResizeSensor from 'css-element-queries/src/ResizeSensor'
|
|
636
636
|
import flatmap from '../services/flatmapLoader.js'
|
|
@@ -1283,6 +1283,11 @@ export default {
|
|
|
1283
1283
|
if (this.$refs.pathwaysSelection) {
|
|
1284
1284
|
this.$refs.pathwaysSelection.reset()
|
|
1285
1285
|
}
|
|
1286
|
+
|
|
1287
|
+
this.trackEvent({
|
|
1288
|
+
'event_name': `portal_maps_zoom`,
|
|
1289
|
+
'category': 'reset',
|
|
1290
|
+
});
|
|
1286
1291
|
}
|
|
1287
1292
|
},
|
|
1288
1293
|
/**
|
|
@@ -1293,6 +1298,11 @@ export default {
|
|
|
1293
1298
|
zoomIn: function () {
|
|
1294
1299
|
if (this.mapImp) {
|
|
1295
1300
|
this.mapImp.zoomIn()
|
|
1301
|
+
|
|
1302
|
+
this.trackEvent({
|
|
1303
|
+
'event_name': `portal_maps_zoom`,
|
|
1304
|
+
'category': 'zoom_in',
|
|
1305
|
+
});
|
|
1296
1306
|
}
|
|
1297
1307
|
},
|
|
1298
1308
|
/**
|
|
@@ -1303,6 +1313,11 @@ export default {
|
|
|
1303
1313
|
zoomOut: function () {
|
|
1304
1314
|
if (this.mapImp) {
|
|
1305
1315
|
this.mapImp.zoomOut()
|
|
1316
|
+
|
|
1317
|
+
this.trackEvent({
|
|
1318
|
+
'event_name': `portal_maps_zoom`,
|
|
1319
|
+
'category': 'zoom_out',
|
|
1320
|
+
});
|
|
1306
1321
|
}
|
|
1307
1322
|
},
|
|
1308
1323
|
onSelectionsDataChanged: function (data) {
|
|
@@ -1723,7 +1738,7 @@ export default {
|
|
|
1723
1738
|
const resource = [data.models]
|
|
1724
1739
|
const taxonomy = this.entry
|
|
1725
1740
|
const biologicalSex = this.biologicalSex
|
|
1726
|
-
const featuresAlert = data.alert
|
|
1741
|
+
const featuresAlert = normaliseAlertToStringArray(data.alert)
|
|
1727
1742
|
const taxons = this.getTaxons(data)
|
|
1728
1743
|
let payload = [{
|
|
1729
1744
|
dataset: data.dataset,
|
|
@@ -1765,7 +1780,7 @@ export default {
|
|
|
1765
1780
|
userData: args,
|
|
1766
1781
|
eventType: eventType,
|
|
1767
1782
|
provenanceTaxonomy: taxons,
|
|
1768
|
-
alert: value.alert,
|
|
1783
|
+
alert: normaliseAlertToStringArray(value.alert),
|
|
1769
1784
|
mapUUID: mapuuid
|
|
1770
1785
|
})
|
|
1771
1786
|
}
|
|
@@ -2224,7 +2239,7 @@ export default {
|
|
|
2224
2239
|
// The line below only creates the tooltip if some data was found on the path
|
|
2225
2240
|
// the pubmed URLs are in knowledge response.references
|
|
2226
2241
|
if ((results && results[0]) || (data.feature.hyperlinks && data.feature.hyperlinks.length > 0)) {
|
|
2227
|
-
tooltip['featuresAlert'] = data.alert;
|
|
2242
|
+
tooltip['featuresAlert'] = normaliseAlertToStringArray(data.alert);
|
|
2228
2243
|
tooltip['knowledgeSource'] = getKnowledgeSource(this.mapImp);
|
|
2229
2244
|
// Map id and uuid to load connectivity information from the map
|
|
2230
2245
|
tooltip['mapId'] = this.mapImp.mapMetadata.id;
|
|
@@ -3104,7 +3119,7 @@ export default {
|
|
|
3104
3119
|
feature: feature,
|
|
3105
3120
|
label: feature.label,
|
|
3106
3121
|
provenanceTaxonomy: feature.taxons,
|
|
3107
|
-
alert: feature.alert,
|
|
3122
|
+
alert: normaliseAlertToStringArray(feature.alert),
|
|
3108
3123
|
}
|
|
3109
3124
|
// Show popup for all modes
|
|
3110
3125
|
this.checkAndCreatePopups([data], mapclick)
|
|
@@ -3153,6 +3168,19 @@ export default {
|
|
|
3153
3168
|
setConnectionType: function (type) {
|
|
3154
3169
|
this.connectionType = type;
|
|
3155
3170
|
},
|
|
3171
|
+
/**
|
|
3172
|
+
* @public
|
|
3173
|
+
* Function to track events.
|
|
3174
|
+
* @arg {Object} `data`
|
|
3175
|
+
*/
|
|
3176
|
+
trackEvent: function (data) {
|
|
3177
|
+
const taggingData = {
|
|
3178
|
+
'event': 'interaction_event',
|
|
3179
|
+
'location': 'flatmap',
|
|
3180
|
+
...data,
|
|
3181
|
+
};
|
|
3182
|
+
this.$emit('trackEvent', taggingData);
|
|
3183
|
+
},
|
|
3156
3184
|
},
|
|
3157
3185
|
props: {
|
|
3158
3186
|
/**
|
|
@@ -93,6 +93,7 @@
|
|
|
93
93
|
:showLocalSettings="showLocalSettings"
|
|
94
94
|
:showOpenMapButton="showOpenMapButton"
|
|
95
95
|
:showPathwayFilter="showPathwayFilter"
|
|
96
|
+
@trackEvent="trackEvent"
|
|
96
97
|
:externalLegends="externalLegends"
|
|
97
98
|
/>
|
|
98
99
|
|
|
@@ -643,6 +644,19 @@ export default {
|
|
|
643
644
|
let map = this.getCurrentFlatmap();
|
|
644
645
|
map.setConnectionType(type);
|
|
645
646
|
},
|
|
647
|
+
/**
|
|
648
|
+
* @public
|
|
649
|
+
* Function to track events.
|
|
650
|
+
* @arg {Object} `data`
|
|
651
|
+
*/
|
|
652
|
+
trackEvent: function (data) {
|
|
653
|
+
const taggingData = {
|
|
654
|
+
'event': 'interaction_event',
|
|
655
|
+
'location': 'flatmap',
|
|
656
|
+
...data,
|
|
657
|
+
};
|
|
658
|
+
this.$emit('trackEvent', taggingData);
|
|
659
|
+
},
|
|
646
660
|
},
|
|
647
661
|
props: {
|
|
648
662
|
/**
|
|
@@ -4,6 +4,41 @@ const capitalise = term => {
|
|
|
4
4
|
return term;
|
|
5
5
|
};
|
|
6
6
|
|
|
7
|
+
const normaliseAlertToStringArray = (value) => {
|
|
8
|
+
if (value === undefined || value === null) {
|
|
9
|
+
return [];
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
if (Array.isArray(value)) {
|
|
13
|
+
return value.flatMap((item) => normaliseAlertToStringArray(item));
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
if (typeof value === 'string') {
|
|
17
|
+
const trimmed = value.trim();
|
|
18
|
+
if (!trimmed) {
|
|
19
|
+
return [];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
try {
|
|
23
|
+
const parsed = JSON.parse(trimmed);
|
|
24
|
+
if (parsed !== value) {
|
|
25
|
+
return normaliseAlertToStringArray(parsed);
|
|
26
|
+
}
|
|
27
|
+
} catch (_) {
|
|
28
|
+
// Not a JSON string; use the trimmed value as-is.
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return [trimmed];
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (typeof value === 'number' || typeof value === 'boolean') {
|
|
35
|
+
return [String(value)];
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return [];
|
|
39
|
+
};
|
|
40
|
+
|
|
7
41
|
export {
|
|
8
42
|
capitalise,
|
|
43
|
+
normaliseAlertToStringArray,
|
|
9
44
|
};
|