@abi-software/map-utilities 1.6.1-beta.8 → 1.7.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abi-software/map-utilities",
3
- "version": "1.6.1-beta.8",
3
+ "version": "1.7.1",
4
4
  "files": [
5
5
  "dist/*",
6
6
  "src/*",
@@ -104,7 +104,10 @@ async function queryAllConnectedPaths(flatmapAPI, knowledgeSource, featureId) {
104
104
  const combined = [...new Set([...originalPaths, ...paths])];
105
105
 
106
106
  // Continue to forward and backward connections
107
- const additionalPaths = await queryForwardBackwardConnections(flatmapAPI, knowledgeSource, combined);
107
+ let additionalPaths = [];
108
+ if (combined.length) {
109
+ additionalPaths = await queryForwardBackwardConnections(flatmapAPI, knowledgeSource, combined);
110
+ }
108
111
  const total = [...new Set([...combined, ...additionalPaths])];
109
112
 
110
113
  return total;
@@ -338,7 +341,10 @@ async function queryPathsByRoute({ flatmapAPI, knowledgeSource, origins, destina
338
341
  const combined = [...new Set([...pathsF, ...paths])];
339
342
 
340
343
  // Continue to forward and backward connections
341
- const additionalPaths = await queryForwardBackwardConnections(flatmapAPI, knowledgeSource, combined);
344
+ let additionalPaths = [];
345
+ if (combined.length) {
346
+ additionalPaths = await queryForwardBackwardConnections(flatmapAPI, knowledgeSource, combined);
347
+ }
342
348
  const total = [...new Set([...combined, ...additionalPaths])];
343
349
 
344
350
  return total;
@@ -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>