@internetarchive/collection-browser 3.1.1-alpha-webdev6778.6 → 3.1.1-alpha-webdev6778.8
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/app-root.js +606 -606
- package/dist/src/app-root.js.map +1 -1
- package/dist/src/collection-browser.js.map +1 -1
- package/dist/src/collection-facets/facet-row.js +140 -140
- package/dist/src/collection-facets/facet-row.js.map +1 -1
- package/dist/src/collection-facets/models.js.map +1 -1
- package/dist/src/collection-facets/smart-facets/smart-facet-bar.js +75 -75
- package/dist/src/collection-facets/smart-facets/smart-facet-bar.js.map +1 -1
- package/dist/src/collection-facets/smart-facets/smart-facet-dropdown.js +54 -54
- package/dist/src/collection-facets/smart-facets/smart-facet-dropdown.js.map +1 -1
- package/dist/src/data-source/collection-browser-data-source-interface.js.map +1 -1
- package/dist/src/data-source/collection-browser-data-source.js +1 -3
- package/dist/src/data-source/collection-browser-data-source.js.map +1 -1
- package/dist/src/data-source/models.js.map +1 -1
- package/dist/src/expanded-date-picker.js +52 -52
- package/dist/src/expanded-date-picker.js.map +1 -1
- package/dist/src/manage/manage-bar.js +77 -77
- package/dist/src/manage/manage-bar.js.map +1 -1
- package/dist/src/models.js.map +1 -1
- package/dist/src/sort-filter-bar/sort-filter-bar.js +376 -376
- package/dist/src/sort-filter-bar/sort-filter-bar.js.map +1 -1
- package/dist/src/tiles/base-tile-component.js.map +1 -1
- package/dist/src/tiles/grid/account-tile.js +36 -36
- package/dist/src/tiles/grid/account-tile.js.map +1 -1
- package/dist/src/tiles/grid/search-tile.js +42 -42
- package/dist/src/tiles/grid/search-tile.js.map +1 -1
- package/dist/src/tiles/grid/styles/tile-grid-shared-styles.js +119 -119
- package/dist/src/tiles/grid/styles/tile-grid-shared-styles.js.map +1 -1
- package/dist/src/tiles/list/tile-list-compact.js +97 -97
- package/dist/src/tiles/list/tile-list-compact.js.map +1 -1
- package/dist/src/utils/analytics-events.js.map +1 -1
- package/dist/src/utils/format-date.js.map +1 -1
- package/dist/test/collection-browser.test.js +187 -187
- package/dist/test/collection-browser.test.js.map +1 -1
- package/dist/test/collection-facets/facet-row.test.js +23 -23
- package/dist/test/collection-facets/facet-row.test.js.map +1 -1
- package/dist/test/collection-facets.test.js +20 -20
- package/dist/test/collection-facets.test.js.map +1 -1
- package/dist/test/sort-filter-bar/sort-filter-bar.test.js +37 -37
- package/dist/test/sort-filter-bar/sort-filter-bar.test.js.map +1 -1
- package/dist/test/tiles/grid/item-tile.test.js +64 -64
- package/dist/test/tiles/grid/item-tile.test.js.map +1 -1
- package/dist/test/tiles/list/tile-list-compact.test.js +57 -57
- package/dist/test/tiles/list/tile-list-compact.test.js.map +1 -1
- package/dist/test/utils/format-date.test.js.map +1 -1
- package/package.json +2 -2
- package/src/app-root.ts +1140 -1140
- package/src/collection-browser.ts +1 -1
- package/src/collection-facets/facet-row.ts +296 -296
- package/src/collection-facets/models.ts +10 -10
- package/src/collection-facets/smart-facets/smart-facet-bar.ts +437 -437
- package/src/collection-facets/smart-facets/smart-facet-dropdown.ts +185 -185
- package/src/data-source/collection-browser-data-source-interface.ts +333 -333
- package/src/data-source/collection-browser-data-source.ts +2 -4
- package/src/data-source/models.ts +43 -43
- package/src/expanded-date-picker.ts +191 -191
- package/src/manage/manage-bar.ts +247 -247
- package/src/models.ts +870 -870
- package/src/sort-filter-bar/sort-filter-bar.ts +1283 -1283
- package/src/tiles/base-tile-component.ts +53 -53
- package/src/tiles/grid/account-tile.ts +112 -112
- package/src/tiles/grid/search-tile.ts +90 -90
- package/src/tiles/grid/styles/tile-grid-shared-styles.ts +130 -130
- package/src/tiles/list/tile-list-compact.ts +236 -236
- package/src/utils/analytics-events.ts +29 -29
- package/src/utils/format-date.ts +42 -42
- package/test/collection-browser.test.ts +2359 -2359
- package/test/collection-facets/facet-row.test.ts +375 -375
- package/test/collection-facets.test.ts +928 -928
- package/test/sort-filter-bar/sort-filter-bar.test.ts +885 -885
- package/test/tiles/grid/item-tile.test.ts +464 -464
- package/test/tiles/list/tile-list-compact.test.ts +228 -228
- package/test/utils/format-date.test.ts +39 -39
|
@@ -35,43 +35,43 @@ let ManageBar = class ManageBar extends LitElement {
|
|
|
35
35
|
this.removeAllowed = false;
|
|
36
36
|
}
|
|
37
37
|
render() {
|
|
38
|
-
return html `
|
|
39
|
-
<div class="manage-container">
|
|
40
|
-
<span class="manage-label">${this.label}</span>
|
|
41
|
-
<div class="manage-buttons">
|
|
42
|
-
<button class="ia-button dark" @click=${this.cancelClicked}>
|
|
43
|
-
${msg('Cancel')}
|
|
44
|
-
</button>
|
|
45
|
-
<button
|
|
46
|
-
class="ia-button danger"
|
|
47
|
-
?disabled=${!this.removeAllowed}
|
|
48
|
-
@click=${this.showRemoveItemsModal}
|
|
49
|
-
>
|
|
50
|
-
${msg('Remove selected items')} (${this.selectedItems.length})...
|
|
51
|
-
</button>
|
|
52
|
-
${when(this.showItemManageButton, () => html ` <button
|
|
53
|
-
class="ia-button warning"
|
|
54
|
-
?disabled=${!this.removeAllowed}
|
|
55
|
-
@click=${this.manageItemsClicked}
|
|
56
|
-
>
|
|
57
|
-
${msg('Item Manager the items')} (${this.selectedItems.length})
|
|
58
|
-
</button>`)}
|
|
59
|
-
<div class="selection-buttons">
|
|
60
|
-
${when(this.showSelectAll, () => html ` <button
|
|
61
|
-
class="ia-button link select-all-btn"
|
|
62
|
-
@click=${this.selectAllClicked}
|
|
63
|
-
>
|
|
64
|
-
${msg('Select all')}
|
|
65
|
-
</button>`)}
|
|
66
|
-
${when(this.showUnselectAll, () => html ` <button
|
|
67
|
-
class="ia-button link unselect-all-btn"
|
|
68
|
-
@click=${this.unselectAllClicked}
|
|
69
|
-
>
|
|
70
|
-
${msg('Unselect all')}
|
|
71
|
-
</button>`)}
|
|
72
|
-
</div>
|
|
73
|
-
</div>
|
|
74
|
-
</div>
|
|
38
|
+
return html `
|
|
39
|
+
<div class="manage-container">
|
|
40
|
+
<span class="manage-label">${this.label}</span>
|
|
41
|
+
<div class="manage-buttons">
|
|
42
|
+
<button class="ia-button dark" @click=${this.cancelClicked}>
|
|
43
|
+
${msg('Cancel')}
|
|
44
|
+
</button>
|
|
45
|
+
<button
|
|
46
|
+
class="ia-button danger"
|
|
47
|
+
?disabled=${!this.removeAllowed}
|
|
48
|
+
@click=${this.showRemoveItemsModal}
|
|
49
|
+
>
|
|
50
|
+
${msg('Remove selected items')} (${this.selectedItems.length})...
|
|
51
|
+
</button>
|
|
52
|
+
${when(this.showItemManageButton, () => html ` <button
|
|
53
|
+
class="ia-button warning"
|
|
54
|
+
?disabled=${!this.removeAllowed}
|
|
55
|
+
@click=${this.manageItemsClicked}
|
|
56
|
+
>
|
|
57
|
+
${msg('Item Manager the items')} (${this.selectedItems.length})
|
|
58
|
+
</button>`)}
|
|
59
|
+
<div class="selection-buttons">
|
|
60
|
+
${when(this.showSelectAll, () => html ` <button
|
|
61
|
+
class="ia-button link select-all-btn"
|
|
62
|
+
@click=${this.selectAllClicked}
|
|
63
|
+
>
|
|
64
|
+
${msg('Select all')}
|
|
65
|
+
</button>`)}
|
|
66
|
+
${when(this.showUnselectAll, () => html ` <button
|
|
67
|
+
class="ia-button link unselect-all-btn"
|
|
68
|
+
@click=${this.unselectAllClicked}
|
|
69
|
+
>
|
|
70
|
+
${msg('Unselect all')}
|
|
71
|
+
</button>`)}
|
|
72
|
+
</div>
|
|
73
|
+
</div>
|
|
74
|
+
</div>
|
|
75
75
|
`;
|
|
76
76
|
}
|
|
77
77
|
cancelClicked() {
|
|
@@ -95,12 +95,12 @@ let ManageBar = class ManageBar extends LitElement {
|
|
|
95
95
|
*/
|
|
96
96
|
showRemoveItemsModal() {
|
|
97
97
|
var _a, _b;
|
|
98
|
-
const customModalContent = html `
|
|
99
|
-
<remove-items-modal-content
|
|
100
|
-
.items=${this.selectedItems}
|
|
101
|
-
.message=${this.manageViewModalMsg}
|
|
102
|
-
@confirm=${() => this.removeItemsClicked()}
|
|
103
|
-
></remove-items-modal-content>
|
|
98
|
+
const customModalContent = html `
|
|
99
|
+
<remove-items-modal-content
|
|
100
|
+
.items=${this.selectedItems}
|
|
101
|
+
.message=${this.manageViewModalMsg}
|
|
102
|
+
@confirm=${() => this.removeItemsClicked()}
|
|
103
|
+
></remove-items-modal-content>
|
|
104
104
|
`;
|
|
105
105
|
const config = new ModalConfig({
|
|
106
106
|
showProcessingIndicator: false,
|
|
@@ -169,40 +169,40 @@ let ManageBar = class ManageBar extends LitElement {
|
|
|
169
169
|
});
|
|
170
170
|
}
|
|
171
171
|
static get styles() {
|
|
172
|
-
return css `
|
|
173
|
-
${iaButtonStyle}
|
|
174
|
-
.manage-container {
|
|
175
|
-
display: flex;
|
|
176
|
-
align-items: center;
|
|
177
|
-
column-gap: 5px;
|
|
178
|
-
padding: 20px 0 20px;
|
|
179
|
-
flex-wrap: wrap;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
.manage-label {
|
|
183
|
-
display: inline-block;
|
|
184
|
-
font-weight: bold;
|
|
185
|
-
font-size: 1.8rem;
|
|
186
|
-
padding-right: 10px;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
.manage-buttons {
|
|
190
|
-
display: flex;
|
|
191
|
-
flex-wrap: wrap;
|
|
192
|
-
align-items: center;
|
|
193
|
-
column-gap: 5px;
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
.selection-buttons {
|
|
197
|
-
display: inherit;
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
.ia-button,
|
|
201
|
-
button {
|
|
202
|
-
padding: 6px 12px;
|
|
203
|
-
font-size: 1.4rem;
|
|
204
|
-
margin: 3px 0;
|
|
205
|
-
}
|
|
172
|
+
return css `
|
|
173
|
+
${iaButtonStyle}
|
|
174
|
+
.manage-container {
|
|
175
|
+
display: flex;
|
|
176
|
+
align-items: center;
|
|
177
|
+
column-gap: 5px;
|
|
178
|
+
padding: 20px 0 20px;
|
|
179
|
+
flex-wrap: wrap;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.manage-label {
|
|
183
|
+
display: inline-block;
|
|
184
|
+
font-weight: bold;
|
|
185
|
+
font-size: 1.8rem;
|
|
186
|
+
padding-right: 10px;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
.manage-buttons {
|
|
190
|
+
display: flex;
|
|
191
|
+
flex-wrap: wrap;
|
|
192
|
+
align-items: center;
|
|
193
|
+
column-gap: 5px;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
.selection-buttons {
|
|
197
|
+
display: inherit;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
.ia-button,
|
|
201
|
+
button {
|
|
202
|
+
padding: 6px 12px;
|
|
203
|
+
font-size: 1.4rem;
|
|
204
|
+
margin: 3px 0;
|
|
205
|
+
}
|
|
206
206
|
`;
|
|
207
207
|
}
|
|
208
208
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manage-bar.js","sourceRoot":"","sources":["../../../src/manage/manage-bar.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAkC,MAAM,KAAK,CAAC;AAC5E,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAC9C,OAAO,EACL,WAAW,GAEZ,MAAM,gCAAgC,CAAC;AAExC,OAAO,aAAa,MAAM,qBAAqB,CAAC;AAChD,OAAO,8BAA8B,CAAC;AAG/B,IAAM,SAAS,GAAf,MAAM,SAAU,SAAQ,UAAU;IAAlC;;QACL;;WAEG;QACyB,UAAK,GAAG,GAAG,CAAC,wBAAwB,CAAC,CAAC;QAOlE;;WAEG;QACyB,kBAAa,GAA0B,EAAE,CAAC;QAOtE;;WAEG;QAC0B,kBAAa,GAAG,KAAK,CAAC;QAEnD;;WAEG;QAC0B,oBAAe,GAAG,KA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AC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;+CAAsC;AAKrC;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;gDAA2C;AAK1C;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;qDAA6B;AAK3B;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;gDAAuB;AAKtB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;kDAAyB;AAKxB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;uDAA8B;AAK7B;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;gDAAuB;AAvCxC,SAAS;IADrB,aAAa,CAAC,YAAY,CAAC;GACf,SAAS,CAyOrB","sourcesContent":["import { msg } from '@lit/localize';\r\nimport { LitElement, html, css, TemplateResult, CSSResultGroup } from 'lit';\r\nimport { customElement, property } from 'lit/decorators.js';\r\nimport { when } from 'lit/directives/when.js';\r\nimport {\r\n ModalConfig,\r\n type ModalManagerInterface,\r\n} from '@internetarchive/modal-manager';\r\nimport type { ManageableItem } from '../models';\r\nimport iaButtonStyle from '../styles/ia-button';\r\nimport './remove-items-modal-content';\r\n\r\n@customElement('manage-bar')\r\nexport class ManageBar extends LitElement {\r\n /**\r\n * The label displayed in front of the management buttons\r\n */\r\n @property({ type: String }) label = msg('Select items to remove');\r\n\r\n /**\r\n * The shared modal manager component for displaying modal dialogs on this page\r\n */\r\n @property({ type: Object }) modalManager?: ModalManagerInterface;\r\n\r\n /**\r\n * Array of items that have been selected for management\r\n */\r\n @property({ type: Object }) selectedItems: Array<ManageableItem> = [];\r\n\r\n /**\r\n * Message shows as note in the modal when removing items\r\n */\r\n @property({ type: String }) manageViewModalMsg?: string;\r\n\r\n /**\r\n * Whether to show the \"Select All\" button (default false)\r\n */\r\n @property({ type: Boolean }) showSelectAll = false;\r\n\r\n /**\r\n * Whether to show the \"Unselect All\" button (default false)\r\n */\r\n @property({ type: Boolean }) showUnselectAll = false;\r\n\r\n /**\r\n * Whether to show \"Item Manager the items\" button (default false)\r\n */\r\n @property({ type: Boolean }) showItemManageButton = false;\r\n\r\n /**\r\n * Whether to active delete button for selectable items\r\n */\r\n @property({ type: Boolean }) removeAllowed = false;\r\n\r\n render(): TemplateResult {\r\n return html`\r\n <div class=\"manage-container\">\r\n <span class=\"manage-label\">${this.label}</span>\r\n <div class=\"manage-buttons\">\r\n <button class=\"ia-button dark\" @click=${this.cancelClicked}>\r\n ${msg('Cancel')}\r\n </button>\r\n <button\r\n class=\"ia-button danger\"\r\n ?disabled=${!this.removeAllowed}\r\n @click=${this.showRemoveItemsModal}\r\n >\r\n ${msg('Remove selected items')} (${this.selectedItems.length})...\r\n </button>\r\n ${when(\r\n this.showItemManageButton,\r\n () =>\r\n html` <button\r\n class=\"ia-button warning\"\r\n ?disabled=${!this.removeAllowed}\r\n @click=${this.manageItemsClicked}\r\n >\r\n ${msg('Item Manager the items')} (${this.selectedItems.length})\r\n </button>`,\r\n )}\r\n <div class=\"selection-buttons\">\r\n ${when(\r\n this.showSelectAll,\r\n () =>\r\n html` <button\r\n class=\"ia-button link select-all-btn\"\r\n @click=${this.selectAllClicked}\r\n >\r\n ${msg('Select all')}\r\n </button>`,\r\n )}\r\n ${when(\r\n this.showUnselectAll,\r\n () =>\r\n html` <button\r\n class=\"ia-button link unselect-all-btn\"\r\n @click=${this.unselectAllClicked}\r\n >\r\n ${msg('Unselect all')}\r\n </button>`,\r\n )}\r\n </div>\r\n </div>\r\n </div>\r\n `;\r\n }\r\n\r\n private cancelClicked(): void {\r\n this.dispatchEvent(new CustomEvent('cancel'));\r\n }\r\n\r\n private removeItemsClicked(): void {\r\n this.dispatchEvent(new CustomEvent('removeItems'));\r\n }\r\n\r\n private manageItemsClicked(): void {\r\n this.dispatchEvent(new CustomEvent('manageItems'));\r\n }\r\n\r\n private selectAllClicked(): void {\r\n this.dispatchEvent(new CustomEvent('selectAll'));\r\n }\r\n\r\n private unselectAllClicked(): void {\r\n this.dispatchEvent(new CustomEvent('unselectAll'));\r\n }\r\n\r\n /**\r\n * Shows a modal dialog confirming the list of items to be removed\r\n * @param items Which items to list in the modal\r\n */\r\n private showRemoveItemsModal(): void {\r\n const customModalContent = html`\r\n <remove-items-modal-content\r\n .items=${this.selectedItems}\r\n .message=${this.manageViewModalMsg}\r\n @confirm=${() => this.removeItemsClicked()}\r\n ></remove-items-modal-content>\r\n `;\r\n\r\n const config = new ModalConfig({\r\n showProcessingIndicator: false,\r\n processingImageMode: 'processing',\r\n bodyColor: '#fff',\r\n headerColor: '#194880',\r\n showHeaderLogo: false,\r\n closeOnBackdropClick: true,\r\n title: html`${msg('Are you sure you want to remove these items?')}`,\r\n });\r\n\r\n this.modalManager?.classList.add('remove-items');\r\n this.modalManager?.showModal({\r\n config,\r\n customModalContent,\r\n userClosedModalCallback: () => {\r\n this.modalManager?.classList.remove('remove-items');\r\n },\r\n });\r\n }\r\n\r\n /**\r\n * Shows a modal dialog indicating that item removal is being processed\r\n */\r\n showRemoveItemsProcessingModal(): void {\r\n const config = new ModalConfig({\r\n showProcessingIndicator: true,\r\n processingImageMode: 'processing',\r\n bodyColor: '#fff',\r\n headerColor: '#194880',\r\n showHeaderLogo: false,\r\n closeOnBackdropClick: true,\r\n title: html`${msg('Removing selected items...')}`,\r\n });\r\n\r\n this.modalManager?.classList.add('remove-items');\r\n this.modalManager?.showModal({\r\n config,\r\n userClosedModalCallback: () => {\r\n this.modalManager?.classList.remove('remove-items');\r\n },\r\n });\r\n }\r\n\r\n /**\r\n * Shows a modal dialog indicating that an error occurred while removing items\r\n */\r\n showRemoveItemsErrorModal(): void {\r\n const config = new ModalConfig({\r\n showProcessingIndicator: false,\r\n processingImageMode: 'processing',\r\n bodyColor: '#fff',\r\n headerColor: '#691916',\r\n showHeaderLogo: false,\r\n closeOnBackdropClick: true,\r\n title: html`${msg('Error: unable to remove items')}`,\r\n message: html`${msg(\r\n 'An error occurred while removing items. Please try again in a few minutes.',\r\n )}`,\r\n });\r\n\r\n this.modalManager?.classList.add('remove-items');\r\n this.modalManager?.showModal({\r\n config,\r\n userClosedModalCallback: () => {\r\n this.modalManager?.classList.remove('remove-items');\r\n },\r\n });\r\n }\r\n\r\n static get styles(): CSSResultGroup {\r\n return css`\r\n ${iaButtonStyle}\r\n .manage-container {\r\n display: flex;\r\n align-items: center;\r\n column-gap: 5px;\r\n padding: 20px 0 20px;\r\n flex-wrap: wrap;\r\n }\r\n\r\n .manage-label {\r\n display: inline-block;\r\n font-weight: bold;\r\n font-size: 1.8rem;\r\n padding-right: 10px;\r\n }\r\n\r\n .manage-buttons {\r\n display: flex;\r\n flex-wrap: wrap;\r\n align-items: center;\r\n column-gap: 5px;\r\n }\r\n\r\n .selection-buttons {\r\n display: inherit;\r\n }\r\n\r\n .ia-button,\r\n button {\r\n padding: 6px 12px;\r\n font-size: 1.4rem;\r\n margin: 3px 0;\r\n }\r\n `;\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"manage-bar.js","sourceRoot":"","sources":["../../../src/manage/manage-bar.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAkC,MAAM,KAAK,CAAC;AAC5E,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAC9C,OAAO,EACL,WAAW,GAEZ,MAAM,gCAAgC,CAAC;AAExC,OAAO,aAAa,MAAM,qBAAqB,CAAC;AAChD,OAAO,8BAA8B,CAAC;AAG/B,IAAM,SAAS,GAAf,MAAM,SAAU,SAAQ,UAAU;IAAlC;;QACL;;WAEG;QACyB,UAAK,GAAG,GAAG,CAAC,wBAAwB,CAAC,CAAC;QAOlE;;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AC;IACJ,CAAC;CACF,CAAA;AArO6B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;wCAAuC;AAKtC;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;+CAAsC;AAKrC;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;gDAA2C;AAK1C;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;qDAA6B;AAK3B;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;gDAAuB;AAKtB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;kDAAyB;AAKxB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;uDAA8B;AAK7B;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;gDAAuB;AAvCxC,SAAS;IADrB,aAAa,CAAC,YAAY,CAAC;GACf,SAAS,CAyOrB","sourcesContent":["import { msg } from '@lit/localize';\nimport { LitElement, html, css, TemplateResult, CSSResultGroup } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport { when } from 'lit/directives/when.js';\nimport {\n ModalConfig,\n type ModalManagerInterface,\n} from '@internetarchive/modal-manager';\nimport type { ManageableItem } from '../models';\nimport iaButtonStyle from '../styles/ia-button';\nimport './remove-items-modal-content';\n\n@customElement('manage-bar')\nexport class ManageBar extends LitElement {\n /**\n * The label displayed in front of the management buttons\n */\n @property({ type: String }) label = msg('Select items to remove');\n\n /**\n * The shared modal manager component for displaying modal dialogs on this page\n */\n @property({ type: Object }) modalManager?: ModalManagerInterface;\n\n /**\n * Array of items that have been selected for management\n */\n @property({ type: Object }) selectedItems: Array<ManageableItem> = [];\n\n /**\n * Message shows as note in the modal when removing items\n */\n @property({ type: String }) manageViewModalMsg?: string;\n\n /**\n * Whether to show the \"Select All\" button (default false)\n */\n @property({ type: Boolean }) showSelectAll = false;\n\n /**\n * Whether to show the \"Unselect All\" button (default false)\n */\n @property({ type: Boolean }) showUnselectAll = false;\n\n /**\n * Whether to show \"Item Manager the items\" button (default false)\n */\n @property({ type: Boolean }) showItemManageButton = false;\n\n /**\n * Whether to active delete button for selectable items\n */\n @property({ type: Boolean }) removeAllowed = false;\n\n render(): TemplateResult {\n return html`\n <div class=\"manage-container\">\n <span class=\"manage-label\">${this.label}</span>\n <div class=\"manage-buttons\">\n <button class=\"ia-button dark\" @click=${this.cancelClicked}>\n ${msg('Cancel')}\n </button>\n <button\n class=\"ia-button danger\"\n ?disabled=${!this.removeAllowed}\n @click=${this.showRemoveItemsModal}\n >\n ${msg('Remove selected items')} (${this.selectedItems.length})...\n </button>\n ${when(\n this.showItemManageButton,\n () =>\n html` <button\n class=\"ia-button warning\"\n ?disabled=${!this.removeAllowed}\n @click=${this.manageItemsClicked}\n >\n ${msg('Item Manager the items')} (${this.selectedItems.length})\n </button>`,\n )}\n <div class=\"selection-buttons\">\n ${when(\n this.showSelectAll,\n () =>\n html` <button\n class=\"ia-button link select-all-btn\"\n @click=${this.selectAllClicked}\n >\n ${msg('Select all')}\n </button>`,\n )}\n ${when(\n this.showUnselectAll,\n () =>\n html` <button\n class=\"ia-button link unselect-all-btn\"\n @click=${this.unselectAllClicked}\n >\n ${msg('Unselect all')}\n </button>`,\n )}\n </div>\n </div>\n </div>\n `;\n }\n\n private cancelClicked(): void {\n this.dispatchEvent(new CustomEvent('cancel'));\n }\n\n private removeItemsClicked(): void {\n this.dispatchEvent(new CustomEvent('removeItems'));\n }\n\n private manageItemsClicked(): void {\n this.dispatchEvent(new CustomEvent('manageItems'));\n }\n\n private selectAllClicked(): void {\n this.dispatchEvent(new CustomEvent('selectAll'));\n }\n\n private unselectAllClicked(): void {\n this.dispatchEvent(new CustomEvent('unselectAll'));\n }\n\n /**\n * Shows a modal dialog confirming the list of items to be removed\n * @param items Which items to list in the modal\n */\n private showRemoveItemsModal(): void {\n const customModalContent = html`\n <remove-items-modal-content\n .items=${this.selectedItems}\n .message=${this.manageViewModalMsg}\n @confirm=${() => this.removeItemsClicked()}\n ></remove-items-modal-content>\n `;\n\n const config = new ModalConfig({\n showProcessingIndicator: false,\n processingImageMode: 'processing',\n bodyColor: '#fff',\n headerColor: '#194880',\n showHeaderLogo: false,\n closeOnBackdropClick: true,\n title: html`${msg('Are you sure you want to remove these items?')}`,\n });\n\n this.modalManager?.classList.add('remove-items');\n this.modalManager?.showModal({\n config,\n customModalContent,\n userClosedModalCallback: () => {\n this.modalManager?.classList.remove('remove-items');\n },\n });\n }\n\n /**\n * Shows a modal dialog indicating that item removal is being processed\n */\n showRemoveItemsProcessingModal(): void {\n const config = new ModalConfig({\n showProcessingIndicator: true,\n processingImageMode: 'processing',\n bodyColor: '#fff',\n headerColor: '#194880',\n showHeaderLogo: false,\n closeOnBackdropClick: true,\n title: html`${msg('Removing selected items...')}`,\n });\n\n this.modalManager?.classList.add('remove-items');\n this.modalManager?.showModal({\n config,\n userClosedModalCallback: () => {\n this.modalManager?.classList.remove('remove-items');\n },\n });\n }\n\n /**\n * Shows a modal dialog indicating that an error occurred while removing items\n */\n showRemoveItemsErrorModal(): void {\n const config = new ModalConfig({\n showProcessingIndicator: false,\n processingImageMode: 'processing',\n bodyColor: '#fff',\n headerColor: '#691916',\n showHeaderLogo: false,\n closeOnBackdropClick: true,\n title: html`${msg('Error: unable to remove items')}`,\n message: html`${msg(\n 'An error occurred while removing items. Please try again in a few minutes.',\n )}`,\n });\n\n this.modalManager?.classList.add('remove-items');\n this.modalManager?.showModal({\n config,\n userClosedModalCallback: () => {\n this.modalManager?.classList.remove('remove-items');\n },\n });\n }\n\n static get styles(): CSSResultGroup {\n return css`\n ${iaButtonStyle}\n .manage-container {\n display: flex;\n align-items: center;\n column-gap: 5px;\n padding: 20px 0 20px;\n flex-wrap: wrap;\n }\n\n .manage-label {\n display: inline-block;\n font-weight: bold;\n font-size: 1.8rem;\n padding-right: 10px;\n }\n\n .manage-buttons {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n column-gap: 5px;\n }\n\n .selection-buttons {\n display: inherit;\n }\n\n .ia-button,\n button {\n padding: 6px 12px;\n font-size: 1.4rem;\n margin: 3px 0;\n }\n `;\n }\n}\n"]}
|
package/dist/src/models.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"models.js","sourceRoot":"","sources":["../../src/models.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAEpC,OAAO,EACL,mBAAmB,GAKpB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAE7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAe/D,MAAM,CAAC,MAAM,iBAAiB,GAAoC;IAChE,gBAAgB,EAAE,GAAG,CAAC,0BAA0B,CAAC;IACjD,iBAAiB,EAAE,GAAG,CAAC,8BAA8B,CAAC;CACvD,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAA4C;IACzE,gBAAgB,EAAE,iBAAiB;IACnC,iBAAiB,EAAE,cAAc;CAClC,CAAC;AAeF;;GAEG;AACH,MAAM,OAAO,SAAS;IA2FpB,YACE,MAAoB,EACpB,mBAAqC,SAAS;;QAE9C,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QAEpC,IAAI,CAAC,KAAK,GAAG,MAAA,MAAM,CAAC,KAAK,0CAAE,MAAM,CAAC;QAClC,IAAI,CAAC,aAAa,GAAG,MAAA,MAAM,CAAC,UAAU,0CAAE,KAAK,CAAC;QAC9C,IAAI,CAAC,YAAY,GAAG,MAAA,MAAM,CAAC,aAAa,0CAAE,MA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AAiB;IAC9B,mBAAmB,EAAE,gBAAgB;IACrC,WAAW,EAAE,kBAAkB;CAChC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAA4B;IAC5D,WAAW,EAAE,IAAI;IACjB,SAAS,EAAE,IAAI;IACf,WAAW,EAAE,IAAI;IACjB,YAAY,EAAE,IAAI;IAClB,eAAe,EAAE,IAAI;IACrB,aAAa,EAAE,IAAI;IACnB,gBAAgB,EAAE,IAAI;IACtB,wBAAwB,EAAE,IAAI;IAC9B,KAAK,EAAE,IAAI;IACX,SAAS,EAAE,IAAI;IACf,OAAO,EAAE,IAAI;CACd,CAAC","sourcesContent":["import type { TemplateResult } from 'lit';\r\nimport { msg } from '@lit/localize';\r\nimport type { MediaType } from '@internetarchive/field-parsers';\r\nimport {\r\n AggregationSortType,\r\n HitType,\r\n SearchReview,\r\n SearchResult,\r\n SortDirection,\r\n} from '@internetarchive/search-service';\r\nimport { collapseRepeatedQuotes } from './utils/collapse-repeated-quotes';\r\nimport { resolveMediatype } from './utils/resolve-mediatype';\r\n\r\nimport { loginRequiredIcon } from './assets/img/icons/login-required';\r\nimport { restrictedIcon } from './assets/img/icons/restricted';\r\n\r\n/**\r\n * Flags that can affect the visibility of content on a tile\r\n */\r\ninterface TileFlags {\r\n loginRequired: boolean;\r\n contentWarning: boolean;\r\n}\r\n\r\n/**\r\n * Different types of tile overlays, corresponding to the above flags.\r\n */\r\nexport type TileOverlayType = 'login-required' | 'content-warning';\r\n\r\nexport const TILE_OVERLAY_TEXT: Record<TileOverlayType, string> = {\r\n 'login-required': msg('Log in to view this item'),\r\n 'content-warning': msg('Content may be inappropriate'),\r\n};\r\n\r\nexport const TILE_OVERLAY_ICONS: Record<TileOverlayType, TemplateResult> = {\r\n 'login-required': loginRequiredIcon,\r\n 'content-warning': restrictedIcon,\r\n};\r\n\r\n/**\r\n * What type of request produced a given set of hits:\r\n * - `search_query`: Hits produced by an explicit user query and/or applied filters on any page\r\n * - `collection_members`: Hits produced for a collection page without any query or filters\r\n * - `profile_tab`: Hits produced for a tab of the profile page without any query or filters\r\n * - `unknown`: Hits produced via any other means\r\n */\r\nexport type HitRequestSource =\r\n | 'search_query'\r\n | 'collection_members'\r\n | 'profile_tab'\r\n | 'unknown';\r\n\r\n/**\r\n * Class for converting & storing raw search results in the correct format for UI tiles.\r\n */\r\nexport class TileModel {\r\n /** For TV hits. List of identifiers for any commercials contained. */\r\n adIds?: string[];\r\n\r\n averageRating?: number;\r\n\r\n /** For Web Archive hits on profile pages. List of capture dates for the current URL. */\r\n captureDates?: Date[];\r\n\r\n /** Whether this tile is currently checked for item management functions */\r\n checked: boolean;\r\n\r\n collectionIdentifier?: string;\r\n\r\n collectionName?: string;\r\n\r\n collectionFilesCount: number;\r\n\r\n collections: string[];\r\n\r\n collectionSize: number;\r\n\r\n commentCount: number;\r\n\r\n creator?: string;\r\n\r\n creators: string[];\r\n\r\n /** A string representation of the publication date, used strictly for passing preformatted dates to the parent */\r\n dateStr?: string;\r\n\r\n /** Date added to public search (software-defined) [from MD field: addeddate] */\r\n dateAdded?: Date;\r\n\r\n /** Date archived (software-defined) item created on archive.org [from MD field: publicdate] */\r\n dateArchived?: Date;\r\n\r\n /** Date work published in the world (user-defined) [from MD field: date] */\r\n datePublished?: Date;\r\n\r\n /** Date reviewed (user-created) most recent review [from MD field: reviewdate] */\r\n dateReviewed?: Date;\r\n\r\n description?: string;\r\n\r\n /** For TV hits. List of URLs for any fact-checks of the contained clips. */\r\n factChecks?: string[];\r\n\r\n favCount: number;\r\n\r\n hitRequestSource: HitRequestSource;\r\n\r\n hitType?: HitType;\r\n\r\n href?: string;\r\n\r\n identifier?: string;\r\n\r\n /** Whether this model represents a TV clip */\r\n isClip?: boolean;\r\n\r\n issue?: string;\r\n\r\n itemCount: number;\r\n\r\n mediatype: MediaType;\r\n\r\n review?: SearchReview;\r\n\r\n source?: string;\r\n\r\n snippets?: string[];\r\n\r\n subjects: string[];\r\n\r\n thumbnailUrl?: string;\r\n\r\n title: string;\r\n\r\n tvClipCount?: number;\r\n\r\n viewCount?: number;\r\n\r\n volume?: string;\r\n\r\n weeklyViewCount?: number;\r\n\r\n loginRequired: boolean;\r\n\r\n contentWarning: boolean;\r\n\r\n constructor(\r\n result: SearchResult,\r\n hitRequestSource: HitRequestSource = 'unknown',\r\n ) {\r\n const flags = this.getFlags(result);\r\n\r\n this.adIds = result.ad_id?.values;\r\n this.averageRating = result.avg_rating?.value;\r\n this.captureDates = result.capture_dates?.values;\r\n this.checked = false;\r\n this.collections = result.collection?.values ?? [];\r\n this.collectionFilesCount = result.collection_files_count?.value ?? 0;\r\n this.collectionSize = result.collection_size?.value ?? 0;\r\n this.commentCount = result.num_reviews?.value ?? 0;\r\n this.creator = result.creator?.value;\r\n this.creators = result.creator?.values ?? [];\r\n this.dateAdded = result.addeddate?.value;\r\n this.dateArchived = result.publicdate?.value;\r\n this.datePublished = result.date?.value;\r\n this.dateReviewed = result.reviewdate?.value;\r\n this.description = result.description?.values.join('\\n');\r\n this.factChecks = result.factcheck?.values;\r\n this.favCount = result.num_favorites?.value ?? 0;\r\n this.hitRequestSource = hitRequestSource;\r\n this.hitType = result.rawMetadata?.hit_type;\r\n this.href = collapseRepeatedQuotes(\r\n result.review?.__href__ ?? result.__href__?.value,\r\n );\r\n this.identifier = TileModel.cleanIdentifier(result.identifier);\r\n this.isClip = result.is_clip?.value;\r\n this.issue = result.issue?.value;\r\n this.itemCount = result.item_count?.value ?? 0;\r\n this.mediatype = resolveMediatype(result);\r\n this.review = result.review;\r\n this.snippets = result.highlight?.values ?? [];\r\n this.source = result.source?.value;\r\n this.subjects = result.subject?.values ?? [];\r\n this.thumbnailUrl = result.__img__?.value;\r\n this.title = result.title?.value ?? '';\r\n this.tvClipCount = result.num_clips?.value ?? 0;\r\n this.volume = result.volume?.value;\r\n this.viewCount = result.downloads?.value;\r\n this.weeklyViewCount = result.week?.value;\r\n this.loginRequired = flags.loginRequired;\r\n this.contentWarning = flags.contentWarning;\r\n }\r\n\r\n /**\r\n * Copies the contents of this TileModel onto a new instance\r\n */\r\n clone(): TileModel {\r\n const cloned = new TileModel({});\r\n cloned.adIds = this.adIds;\r\n cloned.averageRating = this.averageRating;\r\n cloned.captureDates = this.captureDates;\r\n cloned.checked = this.checked;\r\n cloned.collections = this.collections;\r\n cloned.collectionFilesCount = this.collectionFilesCount;\r\n cloned.collectionSize = this.collectionSize;\r\n cloned.commentCount = this.commentCount;\r\n cloned.creator = this.creator;\r\n cloned.creators = this.creators;\r\n cloned.dateStr = this.dateStr;\r\n cloned.dateAdded = this.dateAdded;\r\n cloned.dateArchived = this.dateArchived;\r\n cloned.datePublished = this.datePublished;\r\n cloned.dateReviewed = this.dateReviewed;\r\n cloned.description = this.description;\r\n cloned.factChecks = this.factChecks;\r\n cloned.favCount = this.favCount;\r\n cloned.hitRequestSource = this.hitRequestSource;\r\n cloned.hitType = this.hitType;\r\n cloned.href = this.href;\r\n cloned.identifier = this.identifier;\r\n cloned.isClip = this.isClip;\r\n cloned.issue = this.issue;\r\n cloned.itemCount = this.itemCount;\r\n cloned.mediatype = this.mediatype;\r\n cloned.snippets = this.snippets;\r\n cloned.source = this.source;\r\n cloned.subjects = this.subjects;\r\n cloned.thumbnailUrl = this.thumbnailUrl;\r\n cloned.title = this.title;\r\n cloned.tvClipCount = this.tvClipCount;\r\n cloned.volume = this.volume;\r\n cloned.viewCount = this.viewCount;\r\n cloned.weeklyViewCount = this.weeklyViewCount;\r\n cloned.loginRequired = this.loginRequired;\r\n cloned.contentWarning = this.contentWarning;\r\n return cloned;\r\n }\r\n\r\n /**\r\n * Whether this model represents the result of a TV search query.\r\n */\r\n get isTvSearchResult(): boolean {\r\n return (\r\n this.hitType === 'tv_clip' && this.hitRequestSource === 'search_query'\r\n );\r\n }\r\n\r\n /**\r\n * Determines the appropriate tile flags for the given search result\r\n * (login required and/or content warning)\r\n */\r\n private getFlags(result: SearchResult): TileFlags {\r\n const flags: TileFlags = {\r\n loginRequired: false,\r\n contentWarning: false,\r\n };\r\n\r\n // Check if item and item in \"modifying\" collection, setting above flags\r\n if (\r\n result.collection?.values.length &&\r\n result.mediatype?.value !== 'collection'\r\n ) {\r\n for (const collection of result.collection?.values ?? []) {\r\n if (collection === 'loggedin') {\r\n flags.loginRequired = true;\r\n if (flags.contentWarning) break;\r\n }\r\n if (collection === 'no-preview') {\r\n flags.contentWarning = true;\r\n if (flags.loginRequired) break;\r\n }\r\n }\r\n }\r\n\r\n return flags;\r\n }\r\n\r\n private static cleanIdentifier(\r\n identifier: string | undefined,\r\n ): string | undefined {\r\n // Some identifiers (e.g., from Whisper) represent documents rather than items, and\r\n // are suffixed with values that need to be stripped. Those values are separated\r\n // from the item identifier itself with '|'.\r\n const barIndex = identifier?.indexOf('|') ?? -1;\r\n const cleaned = barIndex > 0 ? identifier?.slice(0, barIndex) : identifier;\r\n return cleaned;\r\n }\r\n}\r\n\r\nexport type RequestKind = 'full' | 'hits' | 'aggregations';\r\n\r\nexport type CollectionDisplayMode = 'grid' | 'list-compact' | 'list-detail';\r\n\r\nexport type TileDisplayMode =\r\n | 'grid'\r\n | 'list-compact'\r\n | 'list-detail'\r\n | 'list-header';\r\n\r\n/**\r\n * This is mainly used to set the cookies for the collection display mode.\r\n *\r\n * It allows the user to set different modes for different contexts (collection page, search page, profile page etc).\r\n */\r\nexport type CollectionBrowserContext = 'collection' | 'search' | 'profile';\r\n\r\n/**\r\n * The sort fields shown in the sort filter bar\r\n */\r\nexport enum SortField {\r\n 'default' = 'default',\r\n 'unrecognized' = 'unrecognized',\r\n 'relevance' = 'relevance',\r\n 'alltimeview' = 'alltimeview',\r\n 'weeklyview' = 'weeklyview',\r\n 'title' = 'title',\r\n 'date' = 'date',\r\n 'datearchived' = 'datearchived',\r\n 'datereviewed' = 'datereviewed',\r\n 'dateadded' = 'dateadded',\r\n 'datefavorited' = 'datefavorited',\r\n 'creator' = 'creator',\r\n}\r\n\r\n/**\r\n * Views-related sort fields\r\n */\r\nexport const ALL_VIEWS_SORT_FIELDS = [\r\n SortField.weeklyview,\r\n SortField.alltimeview,\r\n] as const;\r\nexport type ViewsSortField = (typeof ALL_VIEWS_SORT_FIELDS)[number];\r\n\r\n/**\r\n * Date-related sort fields\r\n */\r\nexport const ALL_DATE_SORT_FIELDS = [\r\n SortField.datefavorited,\r\n SortField.date,\r\n SortField.datearchived,\r\n SortField.datereviewed,\r\n SortField.dateadded,\r\n] as const;\r\nexport type DateSortField = (typeof ALL_DATE_SORT_FIELDS)[number];\r\n\r\nexport interface SortOption {\r\n /**\r\n * The SortField enum member corresponding to this option.\r\n */\r\n field: SortField;\r\n\r\n /**\r\n * The default sort direction to apply when this sort option is first selected.\r\n */\r\n defaultSortDirection: SortDirection | null;\r\n\r\n /**\r\n * Whether this sort option allows its sort direction to be changed from the default.\r\n */\r\n canSetDirection: boolean;\r\n\r\n /**\r\n * Whether this sort option may appear in the sort bar.\r\n */\r\n shownInSortBar: boolean;\r\n\r\n /**\r\n * Whether this sort option should be saved to the URL.\r\n * If false, then no `sort` param will be added to the URL when this sort option\r\n * is selected.\r\n */\r\n shownInURL: boolean;\r\n\r\n /**\r\n * Whether this sort option is passed to the search service.\r\n * If false, then no sort param will be passed to the search service at all when\r\n * this sort option is selected.\r\n */\r\n handledBySearchService: boolean;\r\n\r\n /**\r\n * The string identifying this sort field to the search service & backend API.\r\n */\r\n searchServiceKey?: string;\r\n\r\n /**\r\n * The human-readable name to use for this option in the sort bar (if applicable).\r\n */\r\n displayName: string;\r\n\r\n /**\r\n * A list of URL param keys that should be mapped to this sort option.\r\n * E.g., both `title` and `titleSorter` in the URL map to the `SortField.title` option.\r\n */\r\n urlNames: (string | null | undefined)[];\r\n}\r\n\r\nexport const SORT_OPTIONS: Record<SortField, SortOption> = {\r\n // Default sort is the case where the user has not specified a sort option via the sort bar or URL.\r\n // In these cases, we defer to whatever sort the backend chooses.\r\n // For the search page, the default is always relevance sort.\r\n // For collection pages _without a query_, the default is usually weekly views, but this can be\r\n // overridden by the collection's `sort-by` metadata entry. If a query _is_ specified, then the\r\n // default is again relevance sort.\r\n // For fav-* collections only, the default is instead sorting by date favorited.\r\n [SortField.default]: {\r\n field: SortField.default,\r\n defaultSortDirection: null,\r\n canSetDirection: false,\r\n shownInSortBar: false,\r\n shownInURL: false,\r\n handledBySearchService: false, // We rely on the PPS default sort handling in these cases\r\n displayName: '',\r\n urlNames: ['', null, undefined], // Empty or nullish sort params result in default sorting\r\n },\r\n // Unrecognized sort is the case where the user has specified a sort in the URL, but it is not\r\n // one of the options listed in this map. We still want these unrecognized sorts to be applied\r\n // when searching, but they are not displayed in the sort bar and we do not actively manage\r\n // their URL param beyond flipping the direction as needed.\r\n [SortField.unrecognized]: {\r\n field: SortField.unrecognized,\r\n defaultSortDirection: null,\r\n canSetDirection: true,\r\n shownInSortBar: false,\r\n shownInURL: false,\r\n handledBySearchService: true, // The unrecognized sort param is passed along as-is\r\n displayName: '',\r\n urlNames: [],\r\n },\r\n // Relevance sort is unique in that it does not produce a URL param when it is set.\r\n // It is only available when there is a user-specified query that relevancy can be scored against.\r\n // Therefore, it does not appear as a sort bar option when browsing a collection with no query set.\r\n [SortField.relevance]: {\r\n field: SortField.relevance,\r\n defaultSortDirection: null,\r\n canSetDirection: false,\r\n shownInSortBar: true,\r\n shownInURL: false,\r\n handledBySearchService: false,\r\n displayName: 'Relevance',\r\n urlNames: ['_score'],\r\n },\r\n [SortField.alltimeview]: {\r\n field: SortField.alltimeview,\r\n defaultSortDirection: 'desc',\r\n canSetDirection: true,\r\n shownInSortBar: true,\r\n shownInURL: true,\r\n handledBySearchService: true,\r\n searchServiceKey: 'downloads',\r\n displayName: 'All-time views',\r\n urlNames: ['downloads'],\r\n },\r\n [SortField.weeklyview]: {\r\n field: SortField.weeklyview,\r\n defaultSortDirection: 'desc',\r\n canSetDirection: true,\r\n shownInSortBar: true,\r\n shownInURL: true,\r\n handledBySearchService: true,\r\n searchServiceKey: 'week',\r\n displayName: 'Weekly views',\r\n urlNames: ['week'],\r\n },\r\n [SortField.title]: {\r\n field: SortField.title,\r\n defaultSortDirection: 'asc',\r\n canSetDirection: true,\r\n shownInSortBar: true,\r\n shownInURL: true,\r\n handledBySearchService: true,\r\n searchServiceKey: 'titleSorter',\r\n displayName: 'Title',\r\n urlNames: ['title', 'titleSorter'],\r\n },\r\n [SortField.date]: {\r\n field: SortField.date,\r\n defaultSortDirection: 'desc',\r\n canSetDirection: true,\r\n shownInSortBar: true,\r\n shownInURL: true,\r\n handledBySearchService: true,\r\n searchServiceKey: 'date',\r\n displayName: 'Date published',\r\n urlNames: ['date'],\r\n },\r\n [SortField.datearchived]: {\r\n field: SortField.datearchived,\r\n defaultSortDirection: 'desc',\r\n canSetDirection: true,\r\n shownInSortBar: true,\r\n shownInURL: true,\r\n handledBySearchService: true,\r\n searchServiceKey: 'publicdate',\r\n displayName: 'Date archived',\r\n urlNames: ['publicdate'],\r\n },\r\n [SortField.datereviewed]: {\r\n field: SortField.datereviewed,\r\n defaultSortDirection: 'desc',\r\n canSetDirection: true,\r\n shownInSortBar: true,\r\n shownInURL: true,\r\n handledBySearchService: true,\r\n searchServiceKey: 'reviewdate',\r\n displayName: 'Date reviewed',\r\n urlNames: ['reviewdate'],\r\n },\r\n [SortField.dateadded]: {\r\n field: SortField.dateadded,\r\n defaultSortDirection: 'desc',\r\n canSetDirection: true,\r\n shownInSortBar: true,\r\n shownInURL: true,\r\n handledBySearchService: true,\r\n searchServiceKey: 'addeddate',\r\n displayName: 'Date added',\r\n urlNames: ['addeddate'],\r\n },\r\n [SortField.datefavorited]: {\r\n field: SortField.datefavorited,\r\n defaultSortDirection: 'desc',\r\n canSetDirection: false,\r\n shownInSortBar: true, // But only when viewing fav-* collections\r\n shownInURL: false,\r\n handledBySearchService: false,\r\n searchServiceKey: 'favoritedate',\r\n displayName: 'Date favorited',\r\n urlNames: ['favoritedate'],\r\n },\r\n [SortField.creator]: {\r\n field: SortField.creator,\r\n defaultSortDirection: 'asc',\r\n canSetDirection: true,\r\n shownInSortBar: true,\r\n shownInURL: true,\r\n handledBySearchService: true,\r\n searchServiceKey: 'creatorSorter',\r\n displayName: 'Creator',\r\n urlNames: ['creator', 'creatorSorter'],\r\n },\r\n};\r\n\r\n/**\r\n * Returns the SortOption corresponding to the given API sort name, or\r\n * the \"unrecognized\" SortOption if none matches.\r\n */\r\nexport function sortOptionFromAPIString(sortName?: string | null): SortOption {\r\n return (\r\n Object.values(SORT_OPTIONS).find(opt =>\r\n opt.urlNames.some(name => sortName === name),\r\n ) ?? SORT_OPTIONS[SortField.unrecognized]\r\n );\r\n}\r\n\r\nexport const defaultSortAvailability: Record<SortField, boolean> = {\r\n [SortField.relevance]: true,\r\n [SortField.weeklyview]: true,\r\n [SortField.alltimeview]: true,\r\n [SortField.title]: true,\r\n [SortField.datefavorited]: false,\r\n [SortField.date]: true,\r\n [SortField.datearchived]: true,\r\n [SortField.datereviewed]: true,\r\n [SortField.dateadded]: true,\r\n [SortField.creator]: true,\r\n [SortField.default]: false,\r\n [SortField.unrecognized]: false,\r\n};\r\n\r\nexport const favoritesSortAvailability: Record<SortField, boolean> = {\r\n ...defaultSortAvailability,\r\n [SortField.datefavorited]: true,\r\n};\r\n\r\nexport const tvSortAvailability: Record<SortField, boolean> = {\r\n ...defaultSortAvailability,\r\n [SortField.date]: false,\r\n [SortField.datereviewed]: false,\r\n [SortField.dateadded]: false,\r\n};\r\n\r\nexport const defaultProfileElementSorts: Record<\r\n string,\r\n Exclude<SortField, SortField.default>\r\n> = {\r\n uploads: SortField.datearchived,\r\n reviews: SortField.datereviewed,\r\n collections: SortField.datearchived,\r\n web_archives: SortField.datearchived,\r\n};\r\n\r\n/** A union of the fields that permit prefix filtering (e.g., alphabetical filtering) */\r\nexport type PrefixFilterType = 'title' | 'creator';\r\n\r\n/** A map from prefixes (e.g., initial letters) to the number of items matching that prefix */\r\nexport type PrefixFilterCounts = Record<string, number>;\r\n\r\n/**\r\n * A map from prefix filter types to the corresponding aggregation keys\r\n * that are needed to fetch the filter counts from the backend.\r\n */\r\nexport const prefixFilterAggregationKeys: Record<PrefixFilterType, string> = {\r\n title: 'firstTitle',\r\n creator: 'firstCreator',\r\n};\r\n\r\n/**\r\n * Different facet loading strategies that can be used with collection browser.\r\n * - `eager`: Facet data is always loaded as soon as a search is performed\r\n * - `lazy-mobile`: In the desktop layout, functions exactly as `eager`.\r\n * In the mobile layout, facet data will only be loaded once the \"Filters\" accordion is opened.\r\n * - `opt-in-or-login`: Same as `opt-in` for guest users not logged into an account, but same as `eager` for\r\n * any logged in user.\r\n * - `opt-in`: In the desktop layout, facet data will only be loaded after the user presses a \"Load Facets\" button.\r\n * In the mobile layout, functions exactly as `lazy-mobile`.\r\n * - `off`: Facet data will never be loaded, and a message will be displayed in place of facets\r\n * indicating that they are unavailable.\r\n */\r\nexport type FacetLoadStrategy =\r\n | 'eager'\r\n | 'lazy-mobile'\r\n | 'opt-in-or-login'\r\n | 'opt-in'\r\n | 'off';\r\n\r\n/**\r\n * Union of the facet types that are available in the sidebar.\r\n */\r\nexport type FacetOption =\r\n | 'subject'\r\n | 'lending'\r\n | 'mediatype'\r\n | 'language'\r\n | 'creator'\r\n | 'collection'\r\n | 'year'\r\n // TV-specific facet options:\r\n | 'program'\r\n | 'person'\r\n | 'sponsor';\r\n\r\nexport type SelectedFacetState = 'selected' | 'hidden';\r\n\r\nexport type FacetState = SelectedFacetState | 'none';\r\n\r\nexport interface FacetBucket {\r\n key: string;\r\n count: number;\r\n state: FacetState;\r\n // for some facets, we augment the key with a display value\r\n displayText?: string;\r\n // for TV channel facets, we add a parenthesized secondary name\r\n extraNote?: string;\r\n}\r\n\r\nexport interface FacetGroup {\r\n title: string;\r\n key: FacetOption;\r\n buckets: FacetBucket[];\r\n}\r\n\r\n/**\r\n * Information about a user interaction event on a facet.\r\n */\r\nexport type FacetEventDetails = {\r\n /**\r\n * The type of facet that was interacted with (e.g., 'mediatype', 'language', ...).\r\n */\r\n facetType: FacetOption;\r\n /**\r\n * The bucket corresponding to the facet that was interacted with, including the\r\n * updated state of the facet after the interaction.\r\n */\r\n bucket: FacetBucket;\r\n /**\r\n * Whether the interaction occurred on a negative facet.\r\n */\r\n negative: boolean;\r\n};\r\n\r\nexport type FacetValue = string;\r\n\r\nexport type SelectedFacets = Partial<\r\n Record<FacetOption, Record<FacetValue, FacetBucket>>\r\n>;\r\n\r\nexport const getDefaultSelectedFacets = (): Required<SelectedFacets> => ({\r\n subject: {},\r\n lending: {},\r\n mediatype: {},\r\n language: {},\r\n creator: {},\r\n collection: {},\r\n year: {},\r\n program: {},\r\n person: {},\r\n sponsor: {},\r\n});\r\n\r\n/**\r\n * For TV search results, what types of TV clips to restrict the results to.\r\n */\r\nexport type TvClipFilterType = 'all' | 'commercials' | 'factchecks' | 'quotes';\r\n\r\n/**\r\n * Map from TV clip filter types to their corresponding URL params\r\n */\r\nexport const tvClipFiltersToURLParams: Record<TvClipFilterType, string> = {\r\n all: '',\r\n commercials: 'only_commercials',\r\n factchecks: 'only_factchecks',\r\n quotes: 'only_quotes',\r\n};\r\n\r\n/**\r\n * Map from allowed TV filtering parameters in the URL to their corresponding filter type\r\n */\r\nexport const tvClipURLParamsToFilters: Record<string, TvClipFilterType> = {\r\n only_commercials: 'commercials',\r\n only_factchecks: 'factchecks',\r\n only_quotes: 'quotes',\r\n};\r\n\r\n/**\r\n * Facet display order when presenting results for all search types *except* TV (see below).\r\n */\r\nexport const defaultFacetDisplayOrder: FacetOption[] = [\r\n 'mediatype',\r\n // 'lending', Commenting this out removes the lending facet from the sidebar for now\r\n 'year',\r\n 'subject',\r\n 'collection',\r\n 'creator',\r\n 'language',\r\n];\r\n\r\n/**\r\n * Specialized facet ordering when displaying TV search results\r\n */\r\nexport const tvFacetDisplayOrder: FacetOption[] = [\r\n 'program',\r\n 'creator',\r\n 'year',\r\n 'subject',\r\n 'collection',\r\n 'person',\r\n 'sponsor',\r\n 'language',\r\n];\r\n\r\n/**\r\n * Human-readable titles for each facet group.\r\n */\r\nexport const facetTitles: Record<FacetOption, string> = {\r\n subject: 'Subject',\r\n lending: 'Availability',\r\n mediatype: 'Media Type',\r\n language: 'Language',\r\n creator: 'Creator',\r\n collection: 'Collection',\r\n year: 'Year',\r\n program: 'Program',\r\n person: 'Person',\r\n sponsor: 'Sponsor',\r\n};\r\n\r\n/**\r\n * The default sort type to use for each facet type\r\n */\r\nexport const defaultFacetSort: Record<FacetOption, AggregationSortType> = {\r\n subject: AggregationSortType.COUNT,\r\n lending: AggregationSortType.COUNT,\r\n mediatype: AggregationSortType.COUNT,\r\n language: AggregationSortType.COUNT,\r\n creator: AggregationSortType.COUNT,\r\n collection: AggregationSortType.COUNT,\r\n year: AggregationSortType.NUMERIC, // Year facets are ordered by their numeric value by default\r\n program: AggregationSortType.COUNT,\r\n person: AggregationSortType.COUNT,\r\n sponsor: AggregationSortType.COUNT,\r\n};\r\n\r\n/**\r\n * The sort type corresponding to facet bucket values, for each facet type\r\n * (i.e., the opposite of \"sort by count\" for that type).\r\n */\r\nexport const valueFacetSort: Record<FacetOption, AggregationSortType> = {\r\n subject: AggregationSortType.ALPHABETICAL,\r\n lending: AggregationSortType.ALPHABETICAL,\r\n mediatype: AggregationSortType.ALPHABETICAL,\r\n language: AggregationSortType.ALPHABETICAL,\r\n creator: AggregationSortType.ALPHABETICAL,\r\n collection: AggregationSortType.ALPHABETICAL,\r\n year: AggregationSortType.NUMERIC, // Year facets' values should be compared numerically, not lexicographically (year 2001 > year 3)\r\n program: AggregationSortType.ALPHABETICAL,\r\n person: AggregationSortType.ALPHABETICAL,\r\n sponsor: AggregationSortType.ALPHABETICAL,\r\n};\r\n\r\nexport type LendingFacetKey =\r\n | 'is_lendable'\r\n | 'is_borrowable'\r\n | 'available_to_borrow'\r\n | 'is_browsable'\r\n | 'available_to_browse'\r\n | 'is_readable'\r\n | 'available_to_waitlist';\r\n\r\n/**\r\n * Maps valid lending keys to whether they should be visible in the facet sidebar\r\n */\r\nexport const lendingFacetKeysVisibility: Record<LendingFacetKey, boolean> = {\r\n is_lendable: true,\r\n is_borrowable: false,\r\n available_to_borrow: true,\r\n is_browsable: false,\r\n available_to_browse: false,\r\n is_readable: true,\r\n available_to_waitlist: false,\r\n};\r\n\r\n/**\r\n * Maps valid, visible lending keys to their facet sidebar display text\r\n */\r\nexport const lendingFacetDisplayNames: Partial<\r\n Record<LendingFacetKey, string>\r\n> = {\r\n is_lendable: 'Lending Library',\r\n available_to_borrow: 'Borrow 14 Days',\r\n is_readable: 'Always Available',\r\n};\r\n\r\n/**\r\n * A record of which admin-only collections should be suppressed from being displayed\r\n * as facets or in an item's list of collections.\r\n */\r\nexport const suppressedCollections: Record<string, boolean> = {\r\n deemphasize: true,\r\n community: true,\r\n stream_only: true,\r\n samples_only: true,\r\n test_collection: true,\r\n printdisabled: true,\r\n 'openlibrary-ol': true,\r\n nationalemergencylibrary: true,\r\n china: true,\r\n americana: true,\r\n toronto: true,\r\n};\r\n\r\n/**\r\n * A record of manageable item\r\n */\r\nexport interface ManageableItem {\r\n identifier: string;\r\n title?: string;\r\n dateStr?: string;\r\n date?: string;\r\n}\r\n\r\n/**\r\n * Possible states for whether & how the user has overridden their user preference\r\n * for blurring behavior on tiles with sensitive content.\r\n * - `no-override`: The user has not overridden their user preference, so simply\r\n * respect the preference as given.\r\n * - `on`: The user has overridden their preference and wants tile blurring enabled.\r\n * - `off`: The user has overridden their preference and wants tile blurring disabled.\r\n */\r\nexport type TileBlurOverrideState = 'no-override' | 'on' | 'off';\r\n"]}
|
|
1
|
+
{"version":3,"file":"models.js","sourceRoot":"","sources":["../../src/models.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAEpC,OAAO,EACL,mBAAmB,GAKpB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAE7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,C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B,CAAC,YAAY;IACzC,SAAS,EAAE,mBAAmB,CAAC,YAAY;IAC3C,QAAQ,EAAE,mBAAmB,CAAC,YAAY;IAC1C,OAAO,EAAE,mBAAmB,CAAC,YAAY;IACzC,UAAU,EAAE,mBAAmB,CAAC,YAAY;IAC5C,IAAI,EAAE,mBAAmB,CAAC,OAAO,EAAE,iGAAiG;IACpI,OAAO,EAAE,mBAAmB,CAAC,YAAY;IACzC,MAAM,EAAE,mBAAmB,CAAC,YAAY;IACxC,OAAO,EAAE,mBAAmB,CAAC,YAAY;CAC1C,CAAC;AAWF;;GAEG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAqC;IAC1E,WAAW,EAAE,IAAI;IACjB,aAAa,EAAE,KAAK;IACpB,mBAAmB,EAAE,IAAI;IACzB,YAAY,EAAE,KAAK;IACnB,mBAAmB,EAAE,KAAK;IAC1B,WAAW,EAAE,IAAI;IACjB,qBAAqB,EAAE,KAAK;CAC7B,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAEjC;IACF,WAAW,EAAE,iBAAiB;IAC9B,mBAAmB,EAAE,gBAAgB;IACrC,WAAW,EAAE,kBAAkB;CAChC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAA4B;IAC5D,WAAW,EAAE,IAAI;IACjB,SAAS,EAAE,IAAI;IACf,WAAW,EAAE,IAAI;IACjB,YAAY,EAAE,IAAI;IAClB,eAAe,EAAE,IAAI;IACrB,aAAa,EAAE,IAAI;IACnB,gBAAgB,EAAE,IAAI;IACtB,wBAAwB,EAAE,IAAI;IAC9B,KAAK,EAAE,IAAI;IACX,SAAS,EAAE,IAAI;IACf,OAAO,EAAE,IAAI;CACd,CAAC","sourcesContent":["import type { TemplateResult } from 'lit';\nimport { msg } from '@lit/localize';\nimport type { MediaType } from '@internetarchive/field-parsers';\nimport {\n AggregationSortType,\n HitType,\n SearchReview,\n SearchResult,\n SortDirection,\n} from '@internetarchive/search-service';\nimport { collapseRepeatedQuotes } from './utils/collapse-repeated-quotes';\nimport { resolveMediatype } from './utils/resolve-mediatype';\n\nimport { loginRequiredIcon } from './assets/img/icons/login-required';\nimport { restrictedIcon } from './assets/img/icons/restricted';\n\n/**\n * Flags that can affect the visibility of content on a tile\n */\ninterface TileFlags {\n loginRequired: boolean;\n contentWarning: boolean;\n}\n\n/**\n * Different types of tile overlays, corresponding to the above flags.\n */\nexport type TileOverlayType = 'login-required' | 'content-warning';\n\nexport const TILE_OVERLAY_TEXT: Record<TileOverlayType, string> = {\n 'login-required': msg('Log in to view this item'),\n 'content-warning': msg('Content may be inappropriate'),\n};\n\nexport const TILE_OVERLAY_ICONS: Record<TileOverlayType, TemplateResult> = {\n 'login-required': loginRequiredIcon,\n 'content-warning': restrictedIcon,\n};\n\n/**\n * What type of request produced a given set of hits:\n * - `search_query`: Hits produced by an explicit user query and/or applied filters on any page\n * - `collection_members`: Hits produced for a collection page without any query or filters\n * - `profile_tab`: Hits produced for a tab of the profile page without any query or filters\n * - `unknown`: Hits produced via any other means\n */\nexport type HitRequestSource =\n | 'search_query'\n | 'collection_members'\n | 'profile_tab'\n | 'unknown';\n\n/**\n * Class for converting & storing raw search results in the correct format for UI tiles.\n */\nexport class TileModel {\n /** For TV hits. List of identifiers for any commercials contained. */\n adIds?: string[];\n\n averageRating?: number;\n\n /** For Web Archive hits on profile pages. List of capture dates for the current URL. */\n captureDates?: Date[];\n\n /** Whether this tile is currently checked for item management functions */\n checked: boolean;\n\n collectionIdentifier?: string;\n\n collectionName?: string;\n\n collectionFilesCount: number;\n\n collections: string[];\n\n collectionSize: number;\n\n commentCount: number;\n\n creator?: string;\n\n creators: string[];\n\n /** A string representation of the publication date, used strictly for passing preformatted dates to the parent */\n dateStr?: string;\n\n /** Date added to public search (software-defined) [from MD field: addeddate] */\n dateAdded?: Date;\n\n /** Date archived (software-defined) item created on archive.org [from MD field: publicdate] */\n dateArchived?: Date;\n\n /** Date work published in the world (user-defined) [from MD field: date] */\n datePublished?: Date;\n\n /** Date reviewed (user-created) most recent review [from MD field: reviewdate] */\n dateReviewed?: Date;\n\n description?: string;\n\n /** For TV hits. List of URLs for any fact-checks of the contained clips. */\n factChecks?: string[];\n\n favCount: number;\n\n hitRequestSource: HitRequestSource;\n\n hitType?: HitType;\n\n href?: string;\n\n identifier?: string;\n\n /** Whether this model represents a TV clip */\n isClip?: boolean;\n\n issue?: string;\n\n itemCount: number;\n\n mediatype: MediaType;\n\n review?: SearchReview;\n\n source?: string;\n\n snippets?: string[];\n\n subjects: string[];\n\n thumbnailUrl?: string;\n\n title: string;\n\n tvClipCount?: number;\n\n viewCount?: number;\n\n volume?: string;\n\n weeklyViewCount?: number;\n\n loginRequired: boolean;\n\n contentWarning: boolean;\n\n constructor(\n result: SearchResult,\n hitRequestSource: HitRequestSource = 'unknown',\n ) {\n const flags = this.getFlags(result);\n\n this.adIds = result.ad_id?.values;\n this.averageRating = result.avg_rating?.value;\n this.captureDates = result.capture_dates?.values;\n this.checked = false;\n this.collections = result.collection?.values ?? [];\n this.collectionFilesCount = result.collection_files_count?.value ?? 0;\n this.collectionSize = result.collection_size?.value ?? 0;\n this.commentCount = result.num_reviews?.value ?? 0;\n this.creator = result.creator?.value;\n this.creators = result.creator?.values ?? [];\n this.dateAdded = result.addeddate?.value;\n this.dateArchived = result.publicdate?.value;\n this.datePublished = result.date?.value;\n this.dateReviewed = result.reviewdate?.value;\n this.description = result.description?.values.join('\\n');\n this.factChecks = result.factcheck?.values;\n this.favCount = result.num_favorites?.value ?? 0;\n this.hitRequestSource = hitRequestSource;\n this.hitType = result.rawMetadata?.hit_type;\n this.href = collapseRepeatedQuotes(\n result.review?.__href__ ?? result.__href__?.value,\n );\n this.identifier = TileModel.cleanIdentifier(result.identifier);\n this.isClip = result.is_clip?.value;\n this.issue = result.issue?.value;\n this.itemCount = result.item_count?.value ?? 0;\n this.mediatype = resolveMediatype(result);\n this.review = result.review;\n this.snippets = result.highlight?.values ?? [];\n this.source = result.source?.value;\n this.subjects = result.subject?.values ?? [];\n this.thumbnailUrl = result.__img__?.value;\n this.title = result.title?.value ?? '';\n this.tvClipCount = result.num_clips?.value ?? 0;\n this.volume = result.volume?.value;\n this.viewCount = result.downloads?.value;\n this.weeklyViewCount = result.week?.value;\n this.loginRequired = flags.loginRequired;\n this.contentWarning = flags.contentWarning;\n }\n\n /**\n * Copies the contents of this TileModel onto a new instance\n */\n clone(): TileModel {\n const cloned = new TileModel({});\n cloned.adIds = this.adIds;\n cloned.averageRating = this.averageRating;\n cloned.captureDates = this.captureDates;\n cloned.checked = this.checked;\n cloned.collections = this.collections;\n cloned.collectionFilesCount = this.collectionFilesCount;\n cloned.collectionSize = this.collectionSize;\n cloned.commentCount = this.commentCount;\n cloned.creator = this.creator;\n cloned.creators = this.creators;\n cloned.dateStr = this.dateStr;\n cloned.dateAdded = this.dateAdded;\n cloned.dateArchived = this.dateArchived;\n cloned.datePublished = this.datePublished;\n cloned.dateReviewed = this.dateReviewed;\n cloned.description = this.description;\n cloned.factChecks = this.factChecks;\n cloned.favCount = this.favCount;\n cloned.hitRequestSource = this.hitRequestSource;\n cloned.hitType = this.hitType;\n cloned.href = this.href;\n cloned.identifier = this.identifier;\n cloned.isClip = this.isClip;\n cloned.issue = this.issue;\n cloned.itemCount = this.itemCount;\n cloned.mediatype = this.mediatype;\n cloned.snippets = this.snippets;\n cloned.source = this.source;\n cloned.subjects = this.subjects;\n cloned.thumbnailUrl = this.thumbnailUrl;\n cloned.title = this.title;\n cloned.tvClipCount = this.tvClipCount;\n cloned.volume = this.volume;\n cloned.viewCount = this.viewCount;\n cloned.weeklyViewCount = this.weeklyViewCount;\n cloned.loginRequired = this.loginRequired;\n cloned.contentWarning = this.contentWarning;\n return cloned;\n }\n\n /**\n * Whether this model represents the result of a TV search query.\n */\n get isTvSearchResult(): boolean {\n return (\n this.hitType === 'tv_clip' && this.hitRequestSource === 'search_query'\n );\n }\n\n /**\n * Determines the appropriate tile flags for the given search result\n * (login required and/or content warning)\n */\n private getFlags(result: SearchResult): TileFlags {\n const flags: TileFlags = {\n loginRequired: false,\n contentWarning: false,\n };\n\n // Check if item and item in \"modifying\" collection, setting above flags\n if (\n result.collection?.values.length &&\n result.mediatype?.value !== 'collection'\n ) {\n for (const collection of result.collection?.values ?? []) {\n if (collection === 'loggedin') {\n flags.loginRequired = true;\n if (flags.contentWarning) break;\n }\n if (collection === 'no-preview') {\n flags.contentWarning = true;\n if (flags.loginRequired) break;\n }\n }\n }\n\n return flags;\n }\n\n private static cleanIdentifier(\n identifier: string | undefined,\n ): string | undefined {\n // Some identifiers (e.g., from Whisper) represent documents rather than items, and\n // are suffixed with values that need to be stripped. Those values are separated\n // from the item identifier itself with '|'.\n const barIndex = identifier?.indexOf('|') ?? -1;\n const cleaned = barIndex > 0 ? identifier?.slice(0, barIndex) : identifier;\n return cleaned;\n }\n}\n\nexport type RequestKind = 'full' | 'hits' | 'aggregations';\n\nexport type CollectionDisplayMode = 'grid' | 'list-compact' | 'list-detail';\n\nexport type TileDisplayMode =\n | 'grid'\n | 'list-compact'\n | 'list-detail'\n | 'list-header';\n\n/**\n * This is mainly used to set the cookies for the collection display mode.\n *\n * It allows the user to set different modes for different contexts (collection page, search page, profile page etc).\n */\nexport type CollectionBrowserContext = 'collection' | 'search' | 'profile';\n\n/**\n * The sort fields shown in the sort filter bar\n */\nexport enum SortField {\n 'default' = 'default',\n 'unrecognized' = 'unrecognized',\n 'relevance' = 'relevance',\n 'alltimeview' = 'alltimeview',\n 'weeklyview' = 'weeklyview',\n 'title' = 'title',\n 'date' = 'date',\n 'datearchived' = 'datearchived',\n 'datereviewed' = 'datereviewed',\n 'dateadded' = 'dateadded',\n 'datefavorited' = 'datefavorited',\n 'creator' = 'creator',\n}\n\n/**\n * Views-related sort fields\n */\nexport const ALL_VIEWS_SORT_FIELDS = [\n SortField.weeklyview,\n SortField.alltimeview,\n] as const;\nexport type ViewsSortField = (typeof ALL_VIEWS_SORT_FIELDS)[number];\n\n/**\n * Date-related sort fields\n */\nexport const ALL_DATE_SORT_FIELDS = [\n SortField.datefavorited,\n SortField.date,\n SortField.datearchived,\n SortField.datereviewed,\n SortField.dateadded,\n] as const;\nexport type DateSortField = (typeof ALL_DATE_SORT_FIELDS)[number];\n\nexport interface SortOption {\n /**\n * The SortField enum member corresponding to this option.\n */\n field: SortField;\n\n /**\n * The default sort direction to apply when this sort option is first selected.\n */\n defaultSortDirection: SortDirection | null;\n\n /**\n * Whether this sort option allows its sort direction to be changed from the default.\n */\n canSetDirection: boolean;\n\n /**\n * Whether this sort option may appear in the sort bar.\n */\n shownInSortBar: boolean;\n\n /**\n * Whether this sort option should be saved to the URL.\n * If false, then no `sort` param will be added to the URL when this sort option\n * is selected.\n */\n shownInURL: boolean;\n\n /**\n * Whether this sort option is passed to the search service.\n * If false, then no sort param will be passed to the search service at all when\n * this sort option is selected.\n */\n handledBySearchService: boolean;\n\n /**\n * The string identifying this sort field to the search service & backend API.\n */\n searchServiceKey?: string;\n\n /**\n * The human-readable name to use for this option in the sort bar (if applicable).\n */\n displayName: string;\n\n /**\n * A list of URL param keys that should be mapped to this sort option.\n * E.g., both `title` and `titleSorter` in the URL map to the `SortField.title` option.\n */\n urlNames: (string | null | undefined)[];\n}\n\nexport const SORT_OPTIONS: Record<SortField, SortOption> = {\n // Default sort is the case where the user has not specified a sort option via the sort bar or URL.\n // In these cases, we defer to whatever sort the backend chooses.\n // For the search page, the default is always relevance sort.\n // For collection pages _without a query_, the default is usually weekly views, but this can be\n // overridden by the collection's `sort-by` metadata entry. If a query _is_ specified, then the\n // default is again relevance sort.\n // For fav-* collections only, the default is instead sorting by date favorited.\n [SortField.default]: {\n field: SortField.default,\n defaultSortDirection: null,\n canSetDirection: false,\n shownInSortBar: false,\n shownInURL: false,\n handledBySearchService: false, // We rely on the PPS default sort handling in these cases\n displayName: '',\n urlNames: ['', null, undefined], // Empty or nullish sort params result in default sorting\n },\n // Unrecognized sort is the case where the user has specified a sort in the URL, but it is not\n // one of the options listed in this map. We still want these unrecognized sorts to be applied\n // when searching, but they are not displayed in the sort bar and we do not actively manage\n // their URL param beyond flipping the direction as needed.\n [SortField.unrecognized]: {\n field: SortField.unrecognized,\n defaultSortDirection: null,\n canSetDirection: true,\n shownInSortBar: false,\n shownInURL: false,\n handledBySearchService: true, // The unrecognized sort param is passed along as-is\n displayName: '',\n urlNames: [],\n },\n // Relevance sort is unique in that it does not produce a URL param when it is set.\n // It is only available when there is a user-specified query that relevancy can be scored against.\n // Therefore, it does not appear as a sort bar option when browsing a collection with no query set.\n [SortField.relevance]: {\n field: SortField.relevance,\n defaultSortDirection: null,\n canSetDirection: false,\n shownInSortBar: true,\n shownInURL: false,\n handledBySearchService: false,\n displayName: 'Relevance',\n urlNames: ['_score'],\n },\n [SortField.alltimeview]: {\n field: SortField.alltimeview,\n defaultSortDirection: 'desc',\n canSetDirection: true,\n shownInSortBar: true,\n shownInURL: true,\n handledBySearchService: true,\n searchServiceKey: 'downloads',\n displayName: 'All-time views',\n urlNames: ['downloads'],\n },\n [SortField.weeklyview]: {\n field: SortField.weeklyview,\n defaultSortDirection: 'desc',\n canSetDirection: true,\n shownInSortBar: true,\n shownInURL: true,\n handledBySearchService: true,\n searchServiceKey: 'week',\n displayName: 'Weekly views',\n urlNames: ['week'],\n },\n [SortField.title]: {\n field: SortField.title,\n defaultSortDirection: 'asc',\n canSetDirection: true,\n shownInSortBar: true,\n shownInURL: true,\n handledBySearchService: true,\n searchServiceKey: 'titleSorter',\n displayName: 'Title',\n urlNames: ['title', 'titleSorter'],\n },\n [SortField.date]: {\n field: SortField.date,\n defaultSortDirection: 'desc',\n canSetDirection: true,\n shownInSortBar: true,\n shownInURL: true,\n handledBySearchService: true,\n searchServiceKey: 'date',\n displayName: 'Date published',\n urlNames: ['date'],\n },\n [SortField.datearchived]: {\n field: SortField.datearchived,\n defaultSortDirection: 'desc',\n canSetDirection: true,\n shownInSortBar: true,\n shownInURL: true,\n handledBySearchService: true,\n searchServiceKey: 'publicdate',\n displayName: 'Date archived',\n urlNames: ['publicdate'],\n },\n [SortField.datereviewed]: {\n field: SortField.datereviewed,\n defaultSortDirection: 'desc',\n canSetDirection: true,\n shownInSortBar: true,\n shownInURL: true,\n handledBySearchService: true,\n searchServiceKey: 'reviewdate',\n displayName: 'Date reviewed',\n urlNames: ['reviewdate'],\n },\n [SortField.dateadded]: {\n field: SortField.dateadded,\n defaultSortDirection: 'desc',\n canSetDirection: true,\n shownInSortBar: true,\n shownInURL: true,\n handledBySearchService: true,\n searchServiceKey: 'addeddate',\n displayName: 'Date added',\n urlNames: ['addeddate'],\n },\n [SortField.datefavorited]: {\n field: SortField.datefavorited,\n defaultSortDirection: 'desc',\n canSetDirection: false,\n shownInSortBar: true, // But only when viewing fav-* collections\n shownInURL: false,\n handledBySearchService: false,\n searchServiceKey: 'favoritedate',\n displayName: 'Date favorited',\n urlNames: ['favoritedate'],\n },\n [SortField.creator]: {\n field: SortField.creator,\n defaultSortDirection: 'asc',\n canSetDirection: true,\n shownInSortBar: true,\n shownInURL: true,\n handledBySearchService: true,\n searchServiceKey: 'creatorSorter',\n displayName: 'Creator',\n urlNames: ['creator', 'creatorSorter'],\n },\n};\n\n/**\n * Returns the SortOption corresponding to the given API sort name, or\n * the \"unrecognized\" SortOption if none matches.\n */\nexport function sortOptionFromAPIString(sortName?: string | null): SortOption {\n return (\n Object.values(SORT_OPTIONS).find(opt =>\n opt.urlNames.some(name => sortName === name),\n ) ?? SORT_OPTIONS[SortField.unrecognized]\n );\n}\n\nexport const defaultSortAvailability: Record<SortField, boolean> = {\n [SortField.relevance]: true,\n [SortField.weeklyview]: true,\n [SortField.alltimeview]: true,\n [SortField.title]: true,\n [SortField.datefavorited]: false,\n [SortField.date]: true,\n [SortField.datearchived]: true,\n [SortField.datereviewed]: true,\n [SortField.dateadded]: true,\n [SortField.creator]: true,\n [SortField.default]: false,\n [SortField.unrecognized]: false,\n};\n\nexport const favoritesSortAvailability: Record<SortField, boolean> = {\n ...defaultSortAvailability,\n [SortField.datefavorited]: true,\n};\n\nexport const tvSortAvailability: Record<SortField, boolean> = {\n ...defaultSortAvailability,\n [SortField.date]: false,\n [SortField.datereviewed]: false,\n [SortField.dateadded]: false,\n};\n\nexport const defaultProfileElementSorts: Record<\n string,\n Exclude<SortField, SortField.default>\n> = {\n uploads: SortField.datearchived,\n reviews: SortField.datereviewed,\n collections: SortField.datearchived,\n web_archives: SortField.datearchived,\n};\n\n/** A union of the fields that permit prefix filtering (e.g., alphabetical filtering) */\nexport type PrefixFilterType = 'title' | 'creator';\n\n/** A map from prefixes (e.g., initial letters) to the number of items matching that prefix */\nexport type PrefixFilterCounts = Record<string, number>;\n\n/**\n * A map from prefix filter types to the corresponding aggregation keys\n * that are needed to fetch the filter counts from the backend.\n */\nexport const prefixFilterAggregationKeys: Record<PrefixFilterType, string> = {\n title: 'firstTitle',\n creator: 'firstCreator',\n};\n\n/**\n * Different facet loading strategies that can be used with collection browser.\n * - `eager`: Facet data is always loaded as soon as a search is performed\n * - `lazy-mobile`: In the desktop layout, functions exactly as `eager`.\n * In the mobile layout, facet data will only be loaded once the \"Filters\" accordion is opened.\n * - `opt-in-or-login`: Same as `opt-in` for guest users not logged into an account, but same as `eager` for\n * any logged in user.\n * - `opt-in`: In the desktop layout, facet data will only be loaded after the user presses a \"Load Facets\" button.\n * In the mobile layout, functions exactly as `lazy-mobile`.\n * - `off`: Facet data will never be loaded, and a message will be displayed in place of facets\n * indicating that they are unavailable.\n */\nexport type FacetLoadStrategy =\n | 'eager'\n | 'lazy-mobile'\n | 'opt-in-or-login'\n | 'opt-in'\n | 'off';\n\n/**\n * Union of the facet types that are available in the sidebar.\n */\nexport type FacetOption =\n | 'subject'\n | 'lending'\n | 'mediatype'\n | 'language'\n | 'creator'\n | 'collection'\n | 'year'\n // TV-specific facet options:\n | 'program'\n | 'person'\n | 'sponsor';\n\nexport type SelectedFacetState = 'selected' | 'hidden';\n\nexport type FacetState = SelectedFacetState | 'none';\n\nexport interface FacetBucket {\n key: string;\n count: number;\n state: FacetState;\n // for some facets, we augment the key with a display value\n displayText?: string;\n // for TV channel facets, we add a parenthesized secondary name\n extraNote?: string;\n}\n\nexport interface FacetGroup {\n title: string;\n key: FacetOption;\n buckets: FacetBucket[];\n}\n\n/**\n * Information about a user interaction event on a facet.\n */\nexport type FacetEventDetails = {\n /**\n * The type of facet that was interacted with (e.g., 'mediatype', 'language', ...).\n */\n facetType: FacetOption;\n /**\n * The bucket corresponding to the facet that was interacted with, including the\n * updated state of the facet after the interaction.\n */\n bucket: FacetBucket;\n /**\n * Whether the interaction occurred on a negative facet.\n */\n negative: boolean;\n};\n\nexport type FacetValue = string;\n\nexport type SelectedFacets = Partial<\n Record<FacetOption, Record<FacetValue, FacetBucket>>\n>;\n\nexport const getDefaultSelectedFacets = (): Required<SelectedFacets> => ({\n subject: {},\n lending: {},\n mediatype: {},\n language: {},\n creator: {},\n collection: {},\n year: {},\n program: {},\n person: {},\n sponsor: {},\n});\n\n/**\n * For TV search results, what types of TV clips to restrict the results to.\n */\nexport type TvClipFilterType = 'all' | 'commercials' | 'factchecks' | 'quotes';\n\n/**\n * Map from TV clip filter types to their corresponding URL params\n */\nexport const tvClipFiltersToURLParams: Record<TvClipFilterType, string> = {\n all: '',\n commercials: 'only_commercials',\n factchecks: 'only_factchecks',\n quotes: 'only_quotes',\n};\n\n/**\n * Map from allowed TV filtering parameters in the URL to their corresponding filter type\n */\nexport const tvClipURLParamsToFilters: Record<string, TvClipFilterType> = {\n only_commercials: 'commercials',\n only_factchecks: 'factchecks',\n only_quotes: 'quotes',\n};\n\n/**\n * Facet display order when presenting results for all search types *except* TV (see below).\n */\nexport const defaultFacetDisplayOrder: FacetOption[] = [\n 'mediatype',\n // 'lending', Commenting this out removes the lending facet from the sidebar for now\n 'year',\n 'subject',\n 'collection',\n 'creator',\n 'language',\n];\n\n/**\n * Specialized facet ordering when displaying TV search results\n */\nexport const tvFacetDisplayOrder: FacetOption[] = [\n 'program',\n 'creator',\n 'year',\n 'subject',\n 'collection',\n 'person',\n 'sponsor',\n 'language',\n];\n\n/**\n * Human-readable titles for each facet group.\n */\nexport const facetTitles: Record<FacetOption, string> = {\n subject: 'Subject',\n lending: 'Availability',\n mediatype: 'Media Type',\n language: 'Language',\n creator: 'Creator',\n collection: 'Collection',\n year: 'Year',\n program: 'Program',\n person: 'Person',\n sponsor: 'Sponsor',\n};\n\n/**\n * The default sort type to use for each facet type\n */\nexport const defaultFacetSort: Record<FacetOption, AggregationSortType> = {\n subject: AggregationSortType.COUNT,\n lending: AggregationSortType.COUNT,\n mediatype: AggregationSortType.COUNT,\n language: AggregationSortType.COUNT,\n creator: AggregationSortType.COUNT,\n collection: AggregationSortType.COUNT,\n year: AggregationSortType.NUMERIC, // Year facets are ordered by their numeric value by default\n program: AggregationSortType.COUNT,\n person: AggregationSortType.COUNT,\n sponsor: AggregationSortType.COUNT,\n};\n\n/**\n * The sort type corresponding to facet bucket values, for each facet type\n * (i.e., the opposite of \"sort by count\" for that type).\n */\nexport const valueFacetSort: Record<FacetOption, AggregationSortType> = {\n subject: AggregationSortType.ALPHABETICAL,\n lending: AggregationSortType.ALPHABETICAL,\n mediatype: AggregationSortType.ALPHABETICAL,\n language: AggregationSortType.ALPHABETICAL,\n creator: AggregationSortType.ALPHABETICAL,\n collection: AggregationSortType.ALPHABETICAL,\n year: AggregationSortType.NUMERIC, // Year facets' values should be compared numerically, not lexicographically (year 2001 > year 3)\n program: AggregationSortType.ALPHABETICAL,\n person: AggregationSortType.ALPHABETICAL,\n sponsor: AggregationSortType.ALPHABETICAL,\n};\n\nexport type LendingFacetKey =\n | 'is_lendable'\n | 'is_borrowable'\n | 'available_to_borrow'\n | 'is_browsable'\n | 'available_to_browse'\n | 'is_readable'\n | 'available_to_waitlist';\n\n/**\n * Maps valid lending keys to whether they should be visible in the facet sidebar\n */\nexport const lendingFacetKeysVisibility: Record<LendingFacetKey, boolean> = {\n is_lendable: true,\n is_borrowable: false,\n available_to_borrow: true,\n is_browsable: false,\n available_to_browse: false,\n is_readable: true,\n available_to_waitlist: false,\n};\n\n/**\n * Maps valid, visible lending keys to their facet sidebar display text\n */\nexport const lendingFacetDisplayNames: Partial<\n Record<LendingFacetKey, string>\n> = {\n is_lendable: 'Lending Library',\n available_to_borrow: 'Borrow 14 Days',\n is_readable: 'Always Available',\n};\n\n/**\n * A record of which admin-only collections should be suppressed from being displayed\n * as facets or in an item's list of collections.\n */\nexport const suppressedCollections: Record<string, boolean> = {\n deemphasize: true,\n community: true,\n stream_only: true,\n samples_only: true,\n test_collection: true,\n printdisabled: true,\n 'openlibrary-ol': true,\n nationalemergencylibrary: true,\n china: true,\n americana: true,\n toronto: true,\n};\n\n/**\n * A record of manageable item\n */\nexport interface ManageableItem {\n identifier: string;\n title?: string;\n dateStr?: string;\n date?: string;\n}\n\n/**\n * Possible states for whether & how the user has overridden their user preference\n * for blurring behavior on tiles with sensitive content.\n * - `no-override`: The user has not overridden their user preference, so simply\n * respect the preference as given.\n * - `on`: The user has overridden their preference and wants tile blurring enabled.\n * - `off`: The user has overridden their preference and wants tile blurring disabled.\n */\nexport type TileBlurOverrideState = 'no-override' | 'on' | 'off';\n"]}
|