@abi-software/map-utilities 1.7.0 → 1.7.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abi-software/map-utilities",
3
- "version": "1.7.0",
3
+ "version": "1.7.2",
4
4
  "files": [
5
5
  "dist/*",
6
6
  "src/*",
@@ -279,8 +279,10 @@ export default {
279
279
  this.showGraph(this.entry);
280
280
  } else if (res?.error) {
281
281
  this.loadingError = res.error;
282
+ this.hideSpinner();
282
283
  } else {
283
284
  this.loadingError = 'Loading error!';
285
+ this.hideSpinner();
284
286
  }
285
287
  })
286
288
  .catch((error) => {
@@ -304,7 +306,7 @@ export default {
304
306
  this.availableSources = await this.loadAvailableSources();
305
307
  }
306
308
 
307
- if (!this.isSCKANVersionAvailable()) {
309
+ if (!this.connectivityFromMap && !this.isSCKANVersionAvailable()) {
308
310
  return {
309
311
  error: `No data available for SCKAN version ${this.selectedSource}.`,
310
312
  };
@@ -94,8 +94,10 @@ export default {
94
94
 
95
95
  if (copiedSuccessfully) {
96
96
  this.textLabel = LABEL_AFTER;
97
+ this.$emit('copied', {status: 'success'});
97
98
  } else {
98
99
  this.textLabel = 'Error trying to copy to clipboard!';
100
+ this.$emit('copied', {status: 'error'});
99
101
  }
100
102
  },
101
103
  resetSettings: function () {
@@ -30,7 +30,7 @@
30
30
  <el-row class="info-field">
31
31
  <div class="title">Feature Annotations</div>
32
32
  <div class="title-buttons">
33
- <copy-to-clipboard :content="updatedCopyContent" />
33
+ <copy-to-clipboard @copied="onCopied" :content="updatedCopyContent" />
34
34
  </div>
35
35
  </el-row>
36
36
  <template v-if="entry">
@@ -271,12 +271,26 @@ export default {
271
271
  if (this.entryIndex !== 0) {
272
272
  this.entryIndex = this.entryIndex - 1;
273
273
  this.emitActiveItemChange();
274
+
275
+ const data = this.annotationEntry[this.entryIndex];
276
+ const taggingData = {
277
+ 'event_name': `portal_maps_annotation_previous`,
278
+ 'category': String(data?.featureId || ''),
279
+ };
280
+ this.trackEvent(taggingData);
274
281
  }
275
282
  },
276
283
  next: function () {
277
284
  if (this.entryIndex !== this.annotationEntry.length - 1) {
278
285
  this.entryIndex = this.entryIndex + 1;
279
286
  this.emitActiveItemChange();
287
+
288
+ const data = this.annotationEntry[this.entryIndex];
289
+ const taggingData = {
290
+ 'event_name': `portal_maps_annotation_next`,
291
+ 'category': String(data?.featureId || ''),
292
+ };
293
+ this.trackEvent(taggingData);
280
294
  }
281
295
  },
282
296
  emitActiveItemChange: function () {
@@ -491,6 +505,23 @@ export default {
491
505
 
492
506
  return contentArray.join('\n\n<br>');
493
507
  },
508
+ onCopied: function () {
509
+ const data = this.annotationEntry[this.entryIndex];
510
+ const taggingData = {
511
+ 'event_name': `portal_maps_annotation_copy_content`,
512
+ 'category': String(data?.featureId || ''),
513
+ };
514
+
515
+ this.trackEvent(taggingData);
516
+ },
517
+ trackEvent: function (data) {
518
+ const taggingData = {
519
+ 'event': 'interaction_event',
520
+ 'location': 'map_annotation',
521
+ ...data,
522
+ };
523
+ this.$emit('trackEvent', taggingData);
524
+ }
494
525
  },
495
526
  watch: {
496
527
  annotationEntry: {
@@ -3,7 +3,7 @@
3
3
  <div class="attribute-title-container">
4
4
  <div class="attribute-title">References</div>
5
5
  <div class="copy-button">
6
- <CopyToClipboard label="Copy list to clipboard" :content="referecesListContent" />
6
+ <CopyToClipboard @copied="onCopied($event, '')" label="Copy list to clipboard" :content="referecesListContent" />
7
7
  </div>
8
8
  </div>
9
9
  <div class="citation-tabs" v-if="referencesWithDOI">
@@ -55,7 +55,7 @@
55
55
  @show-related-connectivities="showRelatedConnectivities"
56
56
  />
57
57
 
58
- <CopyToClipboard :content="reference.citation[citationType]" />
58
+ <CopyToClipboard @copied="onCopied($event, reference)" :content="reference.citation[citationType]" />
59
59
  </template>
60
60
  </template>
61
61
  </li>
@@ -68,7 +68,7 @@
68
68
  @show-related-connectivities="showRelatedConnectivities"
69
69
  />
70
70
 
71
- <CopyToClipboard :content="formatCopyReference(reference)" />
71
+ <CopyToClipboard @copied="onCopied($event, reference)" :content="formatCopyReference(reference)" />
72
72
  </li>
73
73
 
74
74
  <li v-for="reference of isbnDBReferences" :key="reference.id">
@@ -79,7 +79,7 @@
79
79
  @show-related-connectivities="showRelatedConnectivities"
80
80
  />
81
81
 
82
- <CopyToClipboard :content="reference.url" />
82
+ <CopyToClipboard @copied="onCopied($event, reference)" :content="reference.url" />
83
83
  </li>
84
84
  </ul>
85
85
  </div>
@@ -154,6 +154,15 @@ export default {
154
154
  methods: {
155
155
  showRelatedConnectivities: function (resource) {
156
156
  this.$emit('show-reference-connectivities', resource);
157
+
158
+ const taggingData = {
159
+ 'event': 'interaction_event',
160
+ 'event_name': `portal_maps_show_related_connectivities`,
161
+ 'category': resource,
162
+ 'location': 'map_connectivity_references',
163
+ };
164
+
165
+ this.$emit('trackEvent', taggingData);
157
166
  },
158
167
  formatReferences: function (references) {
159
168
  const nonPubMedReferences = this.extractNonPubMedReferences(references);
@@ -546,6 +555,42 @@ export default {
546
555
  throw new Error(error);
547
556
  }
548
557
  },
558
+ onCopied: function (event, reference) {
559
+ let category = 'Reference List';
560
+ let doi = '';
561
+ let citationType = this.citationType;
562
+
563
+ if (reference) {
564
+ category = reference.resource;
565
+ doi = reference.type === 'doi' ? reference.id : '';
566
+ } else {
567
+ const combinedResources = [
568
+ ...this.pubMedReferences,
569
+ ...this.openLibReferences,
570
+ ...this.isbnDBReferences
571
+ ];
572
+ const formattedResources = combinedResources.map((resource) => {
573
+ if (resource.type === 'doi') {
574
+ return resource.id;
575
+ } else {
576
+ return resource.resource;
577
+ }
578
+ });
579
+
580
+ category = formattedResources.join(', ');
581
+ }
582
+
583
+ const taggingData = {
584
+ 'event': 'interaction_event',
585
+ 'event_name': `portal_maps_copy_citation`,
586
+ 'category': category,
587
+ 'doi': doi,
588
+ 'citation_type': citationType,
589
+ 'location': 'map_connectivity_references',
590
+ };
591
+
592
+ this.$emit('trackEvent', taggingData);
593
+ },
549
594
  },
550
595
  }
551
596
  </script>