@nanoporetech-digital/components 6.0.1 → 6.1.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/CHANGELOG.md +17 -0
- package/dist/cjs/index-browser.cjs-d4554470.js +39 -0
- package/dist/cjs/index-browser.cjs-d4554470.js.map +1 -0
- package/dist/cjs/nano-algolia.cjs.entry.js +6 -1
- package/dist/cjs/nano-algolia.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-global-nav.cjs.entry.js +24 -25
- package/dist/cjs/nano-global-nav.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-global-search-results.cjs.entry.js +51 -27
- package/dist/cjs/nano-global-search-results.cjs.entry.js.map +1 -1
- package/dist/cjs/{nano-table-400049cc.js → nano-table-6f48a747.js} +2 -2
- package/dist/cjs/{nano-table-400049cc.js.map → nano-table-6f48a747.js.map} +1 -1
- package/dist/cjs/nano-table.cjs.entry.js +1 -1
- package/dist/cjs/search-insights-b2bb12bd.js +50 -0
- package/dist/cjs/search-insights-b2bb12bd.js.map +1 -0
- package/dist/cjs/{table.worker-a37f8365.js → table.worker-f3e54773.js} +2 -2
- package/dist/cjs/table.worker-f3e54773.js.map +1 -0
- package/dist/collection/components/algolia/algolia-interface.js.map +1 -1
- package/dist/collection/components/algolia/algolia.js +8 -3
- package/dist/collection/components/algolia/algolia.js.map +1 -1
- package/dist/collection/components/global-nav/global-nav-interface.js.map +1 -1
- package/dist/collection/components/global-nav/global-nav.js +25 -25
- package/dist/collection/components/global-nav/global-nav.js.map +1 -1
- package/dist/collection/components/global-search-results/global-search-results.js +51 -27
- package/dist/collection/components/global-search-results/global-search-results.js.map +1 -1
- package/dist/collection/utils/search-insights.js +46 -0
- package/dist/collection/utils/search-insights.js.map +1 -0
- package/dist/components/algolia.js +6 -1
- package/dist/components/algolia.js.map +1 -1
- package/dist/components/index-browser.cjs.js +37 -0
- package/dist/components/index-browser.cjs.js.map +1 -0
- package/dist/components/nano-global-nav.js +24 -25
- package/dist/components/nano-global-nav.js.map +1 -1
- package/dist/components/nano-global-search-results.js +51 -27
- package/dist/components/nano-global-search-results.js.map +1 -1
- package/dist/components/search-insights.js +48 -0
- package/dist/components/search-insights.js.map +1 -0
- package/dist/esm/index-browser.cjs-bf702094.js +37 -0
- package/dist/esm/index-browser.cjs-bf702094.js.map +1 -0
- package/dist/esm/nano-algolia.entry.js +6 -1
- package/dist/esm/nano-algolia.entry.js.map +1 -1
- package/dist/esm/nano-global-nav.entry.js +24 -25
- package/dist/esm/nano-global-nav.entry.js.map +1 -1
- package/dist/esm/nano-global-search-results.entry.js +51 -27
- package/dist/esm/nano-global-search-results.entry.js.map +1 -1
- package/dist/esm/{nano-table-a6641aef.js → nano-table-fc01a927.js} +2 -2
- package/dist/esm/{nano-table-a6641aef.js.map → nano-table-fc01a927.js.map} +1 -1
- package/dist/esm/nano-table.entry.js +1 -1
- package/dist/esm/search-insights-f64a6b4c.js +48 -0
- package/dist/esm/search-insights-f64a6b4c.js.map +1 -0
- package/dist/esm/{table.worker-6b597e20.js → table.worker-c70f6379.js} +2 -2
- package/dist/esm/table.worker-c70f6379.js.map +1 -0
- package/dist/nano-components/index-browser.cjs-bf702094.js +5 -0
- package/dist/nano-components/index-browser.cjs-bf702094.js.map +1 -0
- package/dist/nano-components/nano-algolia.entry.js +1 -1
- package/dist/nano-components/nano-algolia.entry.js.map +1 -1
- package/dist/nano-components/nano-global-nav.entry.js +1 -1
- package/dist/nano-components/nano-global-nav.entry.js.map +1 -1
- package/dist/nano-components/nano-global-search-results.entry.js +1 -1
- package/dist/nano-components/nano-global-search-results.entry.js.map +1 -1
- package/dist/nano-components/{nano-table-a6641aef.js → nano-table-fc01a927.js} +2 -2
- package/dist/nano-components/nano-table.entry.js +1 -1
- package/dist/nano-components/search-insights-f64a6b4c.js +5 -0
- package/dist/nano-components/search-insights-f64a6b4c.js.map +1 -0
- package/dist/nano-components/table.worker-c70f6379.js +5 -0
- package/dist/types/components/algolia/algolia-interface.d.ts +2 -1
- package/dist/types/components/algolia/algolia.d.ts +7 -1
- package/dist/types/components/global-nav/global-nav-interface.d.ts +1 -0
- package/dist/types/components/global-nav/global-nav.d.ts +2 -6
- package/dist/types/components/global-search-results/global-search-results.d.ts +13 -7
- package/dist/types/components.d.ts +4 -1
- package/dist/types/interface.d.ts +1 -0
- package/dist/types/utils/search-insights.d.ts +22 -0
- package/docs-json.json +2 -2
- package/hydrate/index.js +151 -44
- package/package.json +3 -2
- package/dist/cjs/table.worker-a37f8365.js.map +0 -1
- package/dist/esm/table.worker-6b597e20.js.map +0 -1
- package/dist/nano-components/table.worker-6b597e20.js +0 -5
- /package/dist/nano-components/{nano-table-a6641aef.js.map → nano-table-fc01a927.js.map} +0 -0
- /package/dist/nano-components/{table.worker-6b597e20.js.map → table.worker-c70f6379.js.map} +0 -0
@@ -10,6 +10,7 @@ const algoliasearchLite_esm_browser = require('./algoliasearch-lite.esm.browser-
|
|
10
10
|
const componentStore = require('./component-store-7427cb36.js');
|
11
11
|
const throttle = require('./throttle-dfa64b9e.js');
|
12
12
|
const transitions = require('./transitions-20fce787.js');
|
13
|
+
const searchInsights = require('./search-insights-b2bb12bd.js');
|
13
14
|
|
14
15
|
async function clientFetch(url, { body, ...customConfig } = {}) {
|
15
16
|
const headers = {
|
@@ -160,7 +161,7 @@ const GlobalNav = class {
|
|
160
161
|
return false;
|
161
162
|
this.userMenuOpen = false;
|
162
163
|
};
|
163
|
-
// Search bar
|
164
|
+
// Search bar open / closed
|
164
165
|
this.onSearchBtnClick = (ev) => {
|
165
166
|
ev.preventDefault();
|
166
167
|
this.searchBarShown ? this.searchbarHide() : this.searchbarShow();
|
@@ -424,6 +425,7 @@ const GlobalNav = class {
|
|
424
425
|
this.cartUrl = null;
|
425
426
|
this.msgUrl = null;
|
426
427
|
this.assessSlottedContent = throttle.debounce(this.assessSlottedContent.bind(this), 10);
|
428
|
+
this.handleBarResize = throttle.debounce(this.handleBarResize.bind(this), 200);
|
427
429
|
}
|
428
430
|
handleMyAccountData() {
|
429
431
|
if (!this.myAccountData)
|
@@ -535,6 +537,11 @@ const GlobalNav = class {
|
|
535
537
|
return;
|
536
538
|
this.algoliaClient = algoliasearchLite_esm_browser.algoliasearch(this.searchAppId, this.searchApiKey);
|
537
539
|
this.addAlgoliaIndeces();
|
540
|
+
// setup algolia analytics
|
541
|
+
searchInsights.searchInsight.init(this.searchAppId, this.searchApiKey).then(() => {
|
542
|
+
if (this.myAccountUser)
|
543
|
+
searchInsights.searchInsight.setUser(this.myAccountUser.uuid);
|
544
|
+
});
|
538
545
|
}
|
539
546
|
/** Public facing set of Algolia indices. Add to any indices we may already have (e.g. from MyAccount) */
|
540
547
|
addIndeces() {
|
@@ -598,7 +605,8 @@ const GlobalNav = class {
|
|
598
605
|
// Global DOM Events
|
599
606
|
/**
|
600
607
|
* 1) Reset threshold (item fit breakpoint) when screen is bigger than before.
|
601
|
-
* 2)
|
608
|
+
* 2) Assess the all threshold / breakpoints to see if content fits
|
609
|
+
* 3) Hide search bar whenever we resize
|
602
610
|
*/
|
603
611
|
onWindowResize() {
|
604
612
|
if (this.threshold < THRESHOLDLIMIT && window.innerWidth > this.currSize) {
|
@@ -606,6 +614,7 @@ const GlobalNav = class {
|
|
606
614
|
}
|
607
615
|
this.currSize = window.innerWidth;
|
608
616
|
this.searchbarHide();
|
617
|
+
this.handleBarResize();
|
609
618
|
}
|
610
619
|
// Burger / Overflow Menu
|
611
620
|
/* listen to nav-item secondary open / close events primarily for resizing the menu */
|
@@ -670,7 +679,7 @@ const GlobalNav = class {
|
|
670
679
|
this.el.focus();
|
671
680
|
}
|
672
681
|
}
|
673
|
-
searchbarShow() {
|
682
|
+
async searchbarShow() {
|
674
683
|
this.searchBarShown = true;
|
675
684
|
this.searchBarEl.addEventListener('transitionend', this.onSearchBarShown);
|
676
685
|
this.searchBarEl.style.display = 'block';
|
@@ -708,6 +717,7 @@ const GlobalNav = class {
|
|
708
717
|
this.algoliaSearchResults = null;
|
709
718
|
const queries = this.internalSearchIndeces.map((index) => {
|
710
719
|
return {
|
720
|
+
clickAnalytics: true,
|
711
721
|
attributesToSnippet: ['body:5', 'title:8'],
|
712
722
|
indexName: index.index,
|
713
723
|
query: this.searchValInternal,
|
@@ -757,7 +767,7 @@ const GlobalNav = class {
|
|
757
767
|
this.threshold--;
|
758
768
|
setTimeout(() => {
|
759
769
|
resolve();
|
760
|
-
},
|
770
|
+
}, 200);
|
761
771
|
});
|
762
772
|
};
|
763
773
|
// Decrease the threshold until content fits
|
@@ -804,20 +814,6 @@ const GlobalNav = class {
|
|
804
814
|
});
|
805
815
|
});
|
806
816
|
}
|
807
|
-
/**
|
808
|
-
* Attach the ResizeObserver - from which all threshold / breakpoint logic hinges
|
809
|
-
*/
|
810
|
-
attachResizeObserver() {
|
811
|
-
if (this.resizeObserver || !this.mainBarDiv)
|
812
|
-
return;
|
813
|
-
const ro = (this.resizeObserver = new ResizeObserver(() => {
|
814
|
-
if (this.mainBarDiv.scrollWidth <= this.mainBarDiv.parentElement.clientWidth) {
|
815
|
-
return;
|
816
|
-
}
|
817
|
-
this.handleBarResize();
|
818
|
-
}));
|
819
|
-
ro.observe(this.mainBarDiv);
|
820
|
-
}
|
821
817
|
// Stencil Lifecycle / Rendering
|
822
818
|
componentWillLoad() {
|
823
819
|
componentStore.ComponentStore.init(this, ['searchIndex', 'searchValue'], 'url-hash', 'gns');
|
@@ -829,20 +825,15 @@ const GlobalNav = class {
|
|
829
825
|
}
|
830
826
|
componentDidLoad() {
|
831
827
|
{
|
832
|
-
this.debounceResize = throttle.debounce(this.onWindowResize.bind(this),
|
828
|
+
this.debounceResize = throttle.debounce(this.onWindowResize.bind(this), 200);
|
833
829
|
window.addEventListener('resize', this.debounceResize);
|
834
830
|
this.currSize = window.innerWidth;
|
835
831
|
}
|
836
832
|
this.initAlgoliaClient();
|
837
833
|
this.addAlgoliaIndeces();
|
838
|
-
this.attachResizeObserver();
|
839
834
|
requestAnimationFrame(() => this.handleBarResize());
|
840
835
|
}
|
841
836
|
disconnectedCallback() {
|
842
|
-
if (this.resizeObserver) {
|
843
|
-
this.resizeObserver.disconnect();
|
844
|
-
this.resizeObserver = undefined;
|
845
|
-
}
|
846
837
|
window.removeEventListener('resize', this.debounceResize);
|
847
838
|
}
|
848
839
|
// Render output
|
@@ -870,7 +861,15 @@ const GlobalNav = class {
|
|
870
861
|
let scopeSuggestions = 0;
|
871
862
|
content = (index.h("div", null, !currentScopeHits && (index.h("div", { class: "search-autocomplete-hit search-autocomplete-hit--no-result" }, "No results matching '", this.searchValInternal, "' were found in", ' ', index.h("strong", null, this.currentIndex.name), ". Try another phrase.")), this.autocompleteResults && [
|
872
863
|
this.autocompleteResults.hits.map((hit, i) => {
|
873
|
-
return (index.h("a", { role: "option", ref: (a) => this.autocompleteEles.push(a), tabindex: "-1", id: 'autocomplete-hit-' + i, href: hit.url, class: "search-autocomplete-hit", innerHTML: this.autocompleteSnippet(hit)
|
864
|
+
return (index.h("a", { role: "option", ref: (a) => this.autocompleteEles.push(a), tabindex: "-1", id: 'autocomplete-hit-' + i, href: hit.url, class: "search-autocomplete-hit", innerHTML: this.autocompleteSnippet(hit), onClick: () => {
|
865
|
+
searchInsights.searchInsight.sendClick({
|
866
|
+
index: this.currentIndex.index,
|
867
|
+
eventName: 'Global nav quick search - search result clicked',
|
868
|
+
queryID: this.autocompleteResults.queryID,
|
869
|
+
objectIDs: [hit.objectID],
|
870
|
+
positions: [i + 1],
|
871
|
+
});
|
872
|
+
} }));
|
874
873
|
}),
|
875
874
|
], (!currentScopeHits || this.currentIndex.allGroup) &&
|
876
875
|
this.scopeSearch &&
|