@internetarchive/collection-browser 2.22.1-alpha-webdev7818.5 → 2.22.1-alpha-webdev7761.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.
Files changed (44) hide show
  1. package/dist/src/collection-browser.d.ts +12 -5
  2. package/dist/src/collection-browser.js +785 -691
  3. package/dist/src/collection-browser.js.map +1 -1
  4. package/dist/src/collection-facets.js +12 -0
  5. package/dist/src/collection-facets.js.map +1 -1
  6. package/dist/src/data-source/collection-browser-data-source-interface.d.ts +10 -1
  7. package/dist/src/data-source/collection-browser-data-source-interface.js.map +1 -1
  8. package/dist/src/data-source/collection-browser-data-source.d.ts +19 -1
  9. package/dist/src/data-source/collection-browser-data-source.js +36 -18
  10. package/dist/src/data-source/collection-browser-data-source.js.map +1 -1
  11. package/dist/src/data-source/collection-browser-query-state.d.ts +1 -2
  12. package/dist/src/data-source/collection-browser-query-state.js.map +1 -1
  13. package/dist/src/data-source/models.d.ts +11 -0
  14. package/dist/src/data-source/models.js.map +1 -1
  15. package/dist/src/models.d.ts +2 -6
  16. package/dist/src/models.js +8 -12
  17. package/dist/src/models.js.map +1 -1
  18. package/dist/src/restoration-state-handler.d.ts +1 -2
  19. package/dist/src/restoration-state-handler.js +3 -9
  20. package/dist/src/restoration-state-handler.js.map +1 -1
  21. package/dist/src/tiles/list/tile-list-compact-header.js +45 -45
  22. package/dist/src/tiles/list/tile-list-compact-header.js.map +1 -1
  23. package/dist/src/tiles/list/tile-list-compact.js +97 -97
  24. package/dist/src/tiles/list/tile-list-compact.js.map +1 -1
  25. package/dist/src/tiles/list/tile-list.js +289 -289
  26. package/dist/src/tiles/list/tile-list.js.map +1 -1
  27. package/dist/test/collection-browser.test.js +206 -196
  28. package/dist/test/collection-browser.test.js.map +1 -1
  29. package/dist/test/restoration-state-handler.test.js +5 -37
  30. package/dist/test/restoration-state-handler.test.js.map +1 -1
  31. package/package.json +1 -1
  32. package/src/collection-browser.ts +2848 -2755
  33. package/src/collection-facets.ts +11 -0
  34. package/src/data-source/collection-browser-data-source-interface.ts +345 -333
  35. package/src/data-source/collection-browser-data-source.ts +1432 -1390
  36. package/src/data-source/collection-browser-query-state.ts +1 -7
  37. package/src/data-source/models.ts +13 -0
  38. package/src/models.ts +10 -14
  39. package/src/restoration-state-handler.ts +9 -11
  40. package/src/tiles/list/tile-list-compact-header.ts +86 -86
  41. package/src/tiles/list/tile-list-compact.ts +236 -236
  42. package/src/tiles/list/tile-list.ts +688 -688
  43. package/test/collection-browser.test.ts +2369 -2359
  44. package/test/restoration-state-handler.test.ts +12 -42
@@ -250,25 +250,33 @@ describe('Restoration state handler', () => {
250
250
  url.search = '?only_commercials=1';
251
251
  window.history.replaceState({ path: url.href }, '', url.href);
252
252
  const commercialsRestorationState = handler.getRestorationState();
253
- expect(commercialsRestorationState.tvClipFilter).to.equal('commercials');
253
+ expect(
254
+ commercialsRestorationState.selectedFacets.clip_type?.commercial.state,
255
+ ).to.equal('selected');
254
256
 
255
257
  // Fact checks
256
258
  url.search = '?only_factchecks=1';
257
259
  window.history.replaceState({ path: url.href }, '', url.href);
258
260
  const factchecksRestorationState = handler.getRestorationState();
259
- expect(factchecksRestorationState.tvClipFilter).to.equal('factchecks');
261
+ expect(
262
+ factchecksRestorationState.selectedFacets.clip_type?.['fact check'].state,
263
+ ).to.equal('selected');
260
264
 
261
265
  // Quotes
262
266
  url.search = '?only_quotes=1';
263
267
  window.history.replaceState({ path: url.href }, '', url.href);
264
268
  const quotesRestorationState = handler.getRestorationState();
265
- expect(quotesRestorationState.tvClipFilter).to.equal('quotes');
269
+ expect(
270
+ quotesRestorationState.selectedFacets.clip_type?.quote.state,
271
+ ).to.equal('selected');
266
272
 
267
273
  // No filter param
268
274
  url.search = '';
269
275
  window.history.replaceState({ path: url.href }, '', url.href);
270
276
  const unfilteredRestorationState = handler.getRestorationState();
271
- expect(unfilteredRestorationState.tvClipFilter).not.to.exist;
277
+ expect(unfilteredRestorationState.selectedFacets.clip_type).to.deep.equal(
278
+ {},
279
+ );
272
280
  });
273
281
 
274
282
  it('should restore sort from URL (space format)', async () => {
@@ -402,44 +410,6 @@ describe('Restoration state handler', () => {
402
410
  expect(window.location.search).to.equal('?page=2');
403
411
  });
404
412
 
405
- it('should persist TV clip filter types to the URL', async () => {
406
- const url = new URL(window.location.href);
407
- url.search = '';
408
- window.history.replaceState({ path: url.href }, '', url.href);
409
-
410
- // Commercials
411
- const handler = new RestorationStateHandler({ context: 'search' });
412
- handler.persistState({
413
- tvClipFilter: 'commercials',
414
- selectedFacets: getDefaultSelectedFacets(),
415
- });
416
- expect(window.location.search).to.equal('?only_commercials=1');
417
-
418
- // Fact checks
419
- window.history.replaceState({ path: url.href }, '', url.href);
420
- handler.persistState({
421
- tvClipFilter: 'factchecks',
422
- selectedFacets: getDefaultSelectedFacets(),
423
- });
424
- expect(window.location.search).to.equal('?only_factchecks=1');
425
-
426
- // Quotes
427
- window.history.replaceState({ path: url.href }, '', url.href);
428
- handler.persistState({
429
- tvClipFilter: 'quotes',
430
- selectedFacets: getDefaultSelectedFacets(),
431
- });
432
- expect(window.location.search).to.equal('?only_quotes=1');
433
-
434
- // Unfiltered
435
- window.history.replaceState({ path: url.href }, '', url.href);
436
- handler.persistState({
437
- tvClipFilter: 'all',
438
- selectedFacets: getDefaultSelectedFacets(),
439
- });
440
- expect(window.location.search).to.equal('');
441
- });
442
-
443
413
  it('should upgrade legacy search params to new ones', async () => {
444
414
  const url = new URL(window.location.href);
445
415
  url.search = '?q=foo';