@internetarchive/collection-browser 2.5.2-alpha.0 → 2.6.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/src/collection-browser.js +18 -9
- package/dist/src/collection-browser.js.map +1 -1
- package/dist/src/data-source/collection-browser-data-source.js +1 -2
- package/dist/src/data-source/collection-browser-data-source.js.map +1 -1
- package/dist/src/models.d.ts +3 -1
- package/dist/src/models.js.map +1 -1
- package/package.json +1 -1
- package/src/collection-browser.ts +24 -9
- package/src/data-source/collection-browser-data-source.ts +1 -5
- package/src/models.ts +8 -1
|
@@ -801,9 +801,12 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
|
|
|
801
801
|
>
|
|
802
802
|
</collection-facets>
|
|
803
803
|
`;
|
|
804
|
-
//
|
|
805
|
-
// that can
|
|
806
|
-
|
|
804
|
+
// If we are using one of the opt-in facet load strategies, we may need to wrap the
|
|
805
|
+
// desktop view facets in a <details> widget so that patrons can opt into loading them.
|
|
806
|
+
// In the `opt-in-or-login` case, we only do this if they are not logged in.
|
|
807
|
+
const showDesktopOptInWidget = this.facetLoadStrategy === 'opt-in' ||
|
|
808
|
+
(this.facetLoadStrategy === 'opt-in-or-login' && !this.loggedIn);
|
|
809
|
+
if (showDesktopOptInWidget && !this.mobileView) {
|
|
807
810
|
return html `
|
|
808
811
|
<details
|
|
809
812
|
class="desktop-facets-dropdown"
|
|
@@ -1126,12 +1129,18 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
|
|
|
1126
1129
|
* current facet loading strategy.
|
|
1127
1130
|
*/
|
|
1128
1131
|
updateFacetReadiness() {
|
|
1129
|
-
//
|
|
1130
|
-
//
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1132
|
+
// There are two ways to opt into facet production:
|
|
1133
|
+
// (1) have the facets dropdown open, or
|
|
1134
|
+
// (2) if using the `opt-in-or-login` strategy, be logged into an account
|
|
1135
|
+
const optedIn = this.collapsibleFacetsVisible ||
|
|
1136
|
+
(this.facetLoadStrategy === 'opt-in-or-login' && this.loggedIn);
|
|
1137
|
+
// In desktop view, we are always ready to load facets *unless* we are using one of the
|
|
1138
|
+
// `opt-in` strategies and have not opted in (whether by login or UI interaction).
|
|
1139
|
+
const usingOptInStrategy = ['opt-in', 'opt-in-or-login'].includes(this.facetLoadStrategy);
|
|
1140
|
+
const desktopFacetsReady = !this.mobileView && (!usingOptInStrategy || optedIn);
|
|
1141
|
+
// In the mobile view, facets are considered ready provided we have opted in (whether by
|
|
1142
|
+
// login or UI interaction).
|
|
1143
|
+
const mobileFacetsReady = this.mobileView && optedIn;
|
|
1135
1144
|
this.dataSource.handleFacetReadinessChange(desktopFacetsReady || mobileFacetsReady);
|
|
1136
1145
|
}
|
|
1137
1146
|
/**
|