@searchcraft/javascript-sdk 0.2.4 → 0.2.6

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 (77) hide show
  1. package/dist/cjs/index.cjs.js +2 -2
  2. package/dist/cjs/loader.cjs.js +1 -1
  3. package/dist/cjs/searchcraft-auto-search-form_17.cjs.entry.js +63 -43
  4. package/dist/cjs/searchcraft-auto-search-form_17.cjs.entry.js.map +1 -1
  5. package/dist/cjs/searchcraft-base-search-form.cjs.entry.js +1 -1
  6. package/dist/cjs/searchcraft-javascript-sdk.cjs.js +1 -1
  7. package/dist/cjs/{store-b0a26894.js → store-c44c58ab.js} +8 -7
  8. package/dist/cjs/{store-b0a26894.js.map → store-c44c58ab.js.map} +1 -1
  9. package/dist/cjs/{utils-15f85bca.js → utils-2dc6115c.js} +13 -1
  10. package/dist/cjs/utils-2dc6115c.js.map +1 -0
  11. package/dist/collection/components/searchcraft-base-search-result/searchcraft-base-search-result.js +24 -3
  12. package/dist/collection/components/searchcraft-base-search-result/searchcraft-base-search-result.js.map +1 -1
  13. package/dist/collection/components/searchcraft-base-search-result/searchcraft-base-search-result.module.css +0 -2
  14. package/dist/collection/components/searchcraft-base-search-results/searchcraft-base-search-results.js +20 -1
  15. package/dist/collection/components/searchcraft-base-search-results/searchcraft-base-search-results.js.map +1 -1
  16. package/dist/collection/components/searchcraft-filters-list/searchcraft-filters-list.js +54 -39
  17. package/dist/collection/components/searchcraft-filters-list/searchcraft-filters-list.js.map +1 -1
  18. package/dist/collection/provider/store.js +7 -6
  19. package/dist/collection/provider/store.js.map +1 -1
  20. package/dist/collection/utils/utils.js +11 -0
  21. package/dist/collection/utils/utils.js.map +1 -1
  22. package/dist/components/index.js +2 -2
  23. package/dist/components/{p-8c70054a.js → p-023371c8.js} +10 -6
  24. package/dist/components/p-023371c8.js.map +1 -0
  25. package/dist/components/{p-33bb5c45.js → p-157e5b1a.js} +8 -7
  26. package/dist/components/{p-33bb5c45.js.map → p-157e5b1a.js.map} +1 -1
  27. package/dist/components/{p-ff6c3650.js → p-2bda632c.js} +13 -2
  28. package/dist/components/p-2bda632c.js.map +1 -0
  29. package/dist/components/{p-1204b43a.js → p-b5f97e04.js} +2 -2
  30. package/dist/components/{p-1204b43a.js.map → p-b5f97e04.js.map} +1 -1
  31. package/dist/components/searchcraft-auto-search-form.js +3 -3
  32. package/dist/components/searchcraft-base-search-form.js +2 -2
  33. package/dist/components/searchcraft-base-search-result.js +1 -1
  34. package/dist/components/searchcraft-base-search-results.js +6 -4
  35. package/dist/components/searchcraft-base-search-results.js.map +1 -1
  36. package/dist/components/searchcraft-filters-list.js +55 -40
  37. package/dist/components/searchcraft-filters-list.js.map +1 -1
  38. package/dist/components/searchcraft-input.js +1 -1
  39. package/dist/components/searchcraft-results-info.js +1 -1
  40. package/dist/components/searchcraft-slider.js +1 -1
  41. package/dist/components/searchcraft-toggle-button.js +1 -1
  42. package/dist/esm/index.js +2 -2
  43. package/dist/esm/loader.js +1 -1
  44. package/dist/esm/searchcraft-auto-search-form_17.entry.js +63 -43
  45. package/dist/esm/searchcraft-auto-search-form_17.entry.js.map +1 -1
  46. package/dist/esm/searchcraft-base-search-form.entry.js +1 -1
  47. package/dist/esm/searchcraft-javascript-sdk.js +1 -1
  48. package/dist/esm/{store-97358312.js → store-9e0b0710.js} +8 -7
  49. package/dist/esm/{store-97358312.js.map → store-9e0b0710.js.map} +1 -1
  50. package/dist/esm/{utils-dbb6302b.js → utils-a3373179.js} +13 -2
  51. package/dist/esm/utils-a3373179.js.map +1 -0
  52. package/dist/searchcraft-javascript-sdk/index.esm.js +1 -1
  53. package/dist/searchcraft-javascript-sdk/p-2bda632c.js +2 -0
  54. package/dist/searchcraft-javascript-sdk/p-2bda632c.js.map +1 -0
  55. package/dist/searchcraft-javascript-sdk/{p-acca6173.entry.js → p-63b3b565.entry.js} +2 -2
  56. package/dist/searchcraft-javascript-sdk/{p-cd489e98.js → p-901fee50.js} +2 -2
  57. package/dist/searchcraft-javascript-sdk/p-901fee50.js.map +1 -0
  58. package/dist/searchcraft-javascript-sdk/p-c2c4f6b7.entry.js +2 -0
  59. package/dist/searchcraft-javascript-sdk/p-c2c4f6b7.entry.js.map +1 -0
  60. package/dist/searchcraft-javascript-sdk/searchcraft-javascript-sdk.esm.js +1 -1
  61. package/dist/searchcraft-javascript-sdk/searchcraft-javascript-sdk.esm.js.map +1 -1
  62. package/dist/types/components/searchcraft-base-search-result/searchcraft-base-search-result.d.ts +1 -0
  63. package/dist/types/components/searchcraft-base-search-results/searchcraft-base-search-results.d.ts +1 -0
  64. package/dist/types/components/searchcraft-filters-list/searchcraft-filters-list.d.ts +1 -5
  65. package/dist/types/components.d.ts +4 -0
  66. package/dist/types/utils/utils.d.ts +11 -0
  67. package/package.json +1 -1
  68. package/dist/cjs/utils-15f85bca.js.map +0 -1
  69. package/dist/components/p-8c70054a.js.map +0 -1
  70. package/dist/components/p-ff6c3650.js.map +0 -1
  71. package/dist/esm/utils-dbb6302b.js.map +0 -1
  72. package/dist/searchcraft-javascript-sdk/p-1a0e85ee.entry.js +0 -2
  73. package/dist/searchcraft-javascript-sdk/p-1a0e85ee.entry.js.map +0 -1
  74. package/dist/searchcraft-javascript-sdk/p-cd489e98.js.map +0 -1
  75. package/dist/searchcraft-javascript-sdk/p-ff6c3650.js +0 -2
  76. package/dist/searchcraft-javascript-sdk/p-ff6c3650.js.map +0 -1
  77. /package/dist/searchcraft-javascript-sdk/{p-acca6173.entry.js.map → p-63b3b565.entry.js.map} +0 -0
@@ -2,8 +2,8 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const utils = require('./utils-15f85bca.js');
6
- const store = require('./store-b0a26894.js');
5
+ const utils = require('./utils-2dc6115c.js');
6
+ const store = require('./store-c44c58ab.js');
7
7
 
8
8
 
9
9
 
@@ -8,7 +8,7 @@ const appGlobals = require('./app-globals-3a1e7e63.js');
8
8
  const defineCustomElements = async (win, options) => {
9
9
  if (typeof window === 'undefined') return undefined;
10
10
  await appGlobals.globalScripts();
11
- return index.bootstrapLazy([["searchcraft-auto-search-form_17.cjs",[[1,"searchcraft-auto-search-form",{"autoSearchFormClass":[1,"auto-search-form-class"],"clearInput":[16],"config":[16],"customStylesForInput":[1,"custom-styles-for-input"],"inputCaptionValue":[1,"input-caption-value"],"inputIconHeight":[2,"input-icon-height"],"inputIconWidth":[2,"input-icon-width"],"labelForInput":[1,"label-for-input"],"placeholderValue":[1,"placeholder-value"],"rightToLeftOrientation":[4,"right-to-left-orientation"],"searchContainerClass":[1,"search-container-class"],"error":[32],"isRequesting":[32],"query":[32],"searchResults":[32]}],[1,"searchcraft-base-search-results",{"adInterval":[2,"ad-interval"],"customStylesForResults":[1,"custom-styles-for-results"],"documentAttributesForDisplay":[1,"document-attributes-for-display"],"fallbackElement":[16],"formatTime":[4,"format-time"],"placeAdAtEnd":[4,"place-ad-at-end"],"placeAdAtStart":[4,"place-ad-at-start"],"hasSearched":[32],"query":[32],"searchResults":[32]}],[1,"searchcraft-filters-list",{"filters":[16],"dynamicFilters":[32],"initialFilters":[32],"isRequesting":[32],"originalFilterCounts":[32],"query":[32],"resultsCount":[32],"selectedFilters":[32]}],[1,"searchcraft-results-info",{"isRequesting":[32],"resultsCount":[32],"responseTime":[32],"query":[32]}],[1,"searchcraft-slider",{"maxYear":[2,"max-year"],"minYear":[2,"min-year"],"endYear":[32],"hasSearched":[32],"query":[32],"resultsCount":[32],"startYear":[32]}],[1,"searchcraft-toggle-button",{"type":[1],"isActive":[32],"query":[32],"resultsCount":[32]}],[1,"searchcraft-base-search-result",{"buttonText":[1,"button-text"],"customStyles":[1,"custom-styles"],"headingText":[1,"heading-text"],"imageDescription":[1,"image-description"],"imageSource":[1,"image-source"],"isInteractive":[4,"is-interactive"],"primaryContent":[1,"primary-content"],"secondaryContent":[1,"secondary-content"],"subheadingText":[1,"subheading-text"],"tertiaryContent":[1,"tertiary-content"],"themeMode":[1,"theme-mode"]}],[1,"searchcraft-input",{"customStyles":[1,"custom-styles"],"error":[4],"formClassName":[1,"form-class-name"],"inputCaptionClassName":[1,"input-caption-class-name"],"inputCaptionValue":[1,"input-caption-value"],"inputClassName":[1,"input-class-name"],"inputIconHeight":[2,"input-icon-height"],"inputIconWidth":[2,"input-icon-width"],"isRequesting":[4,"is-requesting"],"placeholderValue":[1,"placeholder-value"],"rightToLeftOrientation":[4,"right-to-left-orientation"],"query":[1],"theme":[32]}],[1,"searchcraft-input-label",{"inputLabelClassName":[1,"input-label-class-name"],"label":[1],"theme":[32]}],[1,"searchcraft-clear-input-button",{"isRequesting":[4,"is-requesting"],"rightToLeftOrientation":[4,"right-to-left-orientation"],"theme":[32]}],[1,"searchcraft-input-icon",{"error":[4],"height":[2],"rightToLeftOrientation":[4,"right-to-left-orientation"],"width":[2],"theme":[32]}],[1,"searchcraft-error-message",{"errorMessage":[1,"error-message"],"theme":[1]}],[1,"searchcraft-input-caption",{"error":[4],"inputCaptionClassName":[1,"input-caption-class-name"],"inputCaptionValue":[1,"input-caption-value"],"rightToLeftOrientation":[4,"right-to-left-orientation"],"theme":[32]}],[1,"searchcraft-clear-icon-set",{"type":[1]}],[1,"searchcraft-search-icon-set",{"type":[1],"width":[2],"height":[2]}],[1,"searchcraft-spinner-light"],[1,"searchcraft-spinner-dark"]]],["searchcraft-base-search-form.cjs",[[1,"searchcraft-base-search-form",{"config":[16],"errorMessage":[1,"error-message"],"labelForInput":[1,"label-for-input"],"rightToLeftOrientation":[4,"right-to-left-orientation"],"error":[32],"query":[32],"searchResults":[32]}]]],["searchcraft-button-icon.cjs",[[1,"searchcraft-button-icon"]]],["searchcraft-button.cjs",[[1,"searchcraft-button",{"iconElement":[16],"iconOnly":[4,"icon-only"],"iconPosition":[1,"icon-position"],"label":[1],"isRequesting":[32],"theme":[32]}]]]], options);
11
+ return index.bootstrapLazy([["searchcraft-auto-search-form_17.cjs",[[1,"searchcraft-auto-search-form",{"autoSearchFormClass":[1,"auto-search-form-class"],"clearInput":[16],"config":[16],"customStylesForInput":[1,"custom-styles-for-input"],"inputCaptionValue":[1,"input-caption-value"],"inputIconHeight":[2,"input-icon-height"],"inputIconWidth":[2,"input-icon-width"],"labelForInput":[1,"label-for-input"],"placeholderValue":[1,"placeholder-value"],"rightToLeftOrientation":[4,"right-to-left-orientation"],"searchContainerClass":[1,"search-container-class"],"error":[32],"isRequesting":[32],"query":[32],"searchResults":[32]}],[1,"searchcraft-base-search-results",{"adInterval":[2,"ad-interval"],"customStylesForResults":[1,"custom-styles-for-results"],"documentAttributesForDisplay":[1,"document-attributes-for-display"],"fallbackElement":[16],"formatTime":[4,"format-time"],"placeAdAtEnd":[4,"place-ad-at-end"],"placeAdAtStart":[4,"place-ad-at-start"],"placeResultImageRight":[4,"place-result-image-right"],"hasSearched":[32],"query":[32],"searchResults":[32]}],[1,"searchcraft-filters-list",{"filters":[16],"dynamicFilters":[32],"isRequesting":[32],"query":[32],"resultsCount":[32],"selectedFilters":[32]}],[1,"searchcraft-results-info",{"isRequesting":[32],"resultsCount":[32],"responseTime":[32],"query":[32]}],[1,"searchcraft-slider",{"maxYear":[2,"max-year"],"minYear":[2,"min-year"],"endYear":[32],"hasSearched":[32],"query":[32],"resultsCount":[32],"startYear":[32]}],[1,"searchcraft-toggle-button",{"type":[1],"isActive":[32],"query":[32],"resultsCount":[32]}],[1,"searchcraft-base-search-result",{"buttonText":[1,"button-text"],"customStyles":[1,"custom-styles"],"headingText":[1,"heading-text"],"imageDescription":[1,"image-description"],"imageSource":[1,"image-source"],"isInteractive":[4,"is-interactive"],"primaryContent":[1,"primary-content"],"secondaryContent":[1,"secondary-content"],"subheadingText":[1,"subheading-text"],"tertiaryContent":[1,"tertiary-content"],"themeMode":[1,"theme-mode"],"placeImageRight":[4,"place-image-right"]}],[1,"searchcraft-input",{"customStyles":[1,"custom-styles"],"error":[4],"formClassName":[1,"form-class-name"],"inputCaptionClassName":[1,"input-caption-class-name"],"inputCaptionValue":[1,"input-caption-value"],"inputClassName":[1,"input-class-name"],"inputIconHeight":[2,"input-icon-height"],"inputIconWidth":[2,"input-icon-width"],"isRequesting":[4,"is-requesting"],"placeholderValue":[1,"placeholder-value"],"rightToLeftOrientation":[4,"right-to-left-orientation"],"query":[1],"theme":[32]}],[1,"searchcraft-input-label",{"inputLabelClassName":[1,"input-label-class-name"],"label":[1],"theme":[32]}],[1,"searchcraft-clear-input-button",{"isRequesting":[4,"is-requesting"],"rightToLeftOrientation":[4,"right-to-left-orientation"],"theme":[32]}],[1,"searchcraft-input-icon",{"error":[4],"height":[2],"rightToLeftOrientation":[4,"right-to-left-orientation"],"width":[2],"theme":[32]}],[1,"searchcraft-error-message",{"errorMessage":[1,"error-message"],"theme":[1]}],[1,"searchcraft-input-caption",{"error":[4],"inputCaptionClassName":[1,"input-caption-class-name"],"inputCaptionValue":[1,"input-caption-value"],"rightToLeftOrientation":[4,"right-to-left-orientation"],"theme":[32]}],[1,"searchcraft-clear-icon-set",{"type":[1]}],[1,"searchcraft-search-icon-set",{"type":[1],"width":[2],"height":[2]}],[1,"searchcraft-spinner-light"],[1,"searchcraft-spinner-dark"]]],["searchcraft-base-search-form.cjs",[[1,"searchcraft-base-search-form",{"config":[16],"errorMessage":[1,"error-message"],"labelForInput":[1,"label-for-input"],"rightToLeftOrientation":[4,"right-to-left-orientation"],"error":[32],"query":[32],"searchResults":[32]}]]],["searchcraft-button-icon.cjs",[[1,"searchcraft-button-icon"]]],["searchcraft-button.cjs",[[1,"searchcraft-button",{"iconElement":[16],"iconOnly":[4,"icon-only"],"iconPosition":[1,"icon-position"],"label":[1],"isRequesting":[32],"theme":[32]}]]]], options);
12
12
  };
13
13
 
14
14
  exports.setNonce = index.setNonce;
@@ -3,8 +3,8 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-6c5282a0.js');
6
- const store = require('./store-b0a26894.js');
7
- const utils = require('./utils-15f85bca.js');
6
+ const store = require('./store-c44c58ab.js');
7
+ const utils = require('./utils-2dc6115c.js');
8
8
  const index$1 = require('./index-5b0b9d4c.js');
9
9
 
10
10
  const searchcraftAutoSearchFormModuleCss = ":root{--font-stack:Helvetica, Arial, sans-serif}.formLTR{font-family:var(--font-stack);text-align:left;width:100%}.formRTL{font-family:var(--font-stack);text-align:right;width:100%}";
@@ -113,7 +113,7 @@ const SearchcraftAutoSearchForm = class {
113
113
  };
114
114
  SearchcraftAutoSearchForm.style = SearchcraftAutoSearchFormStyle0;
115
115
 
116
- const searchcraftBaseSearchResultModuleCss = "@charset \"UTF-8\";:root{--font-stack:Helvetica, Arial, sans-serif}.interactiveResultContainerLight{align-items:flex-start;border-radius:16px;display:flex;flex-direction:column;gap:16px;padding:8px;position:relative;background-color:#FAFAFA}@media (min-width: 600px){.interactiveResultContainerLight{flex-direction:row}}.interactiveResultContainerDark{align-items:flex-start;border-radius:16px;display:flex;flex-direction:column;gap:16px;padding:8px;position:relative;background-color:#2E2E2E}@media (min-width: 600px){.interactiveResultContainerDark{flex-direction:row}}.resultContainer{align-items:flex-start;display:flex;flex-direction:column;gap:16px}@media (min-width: 600px){.resultContainer{flex-direction:row}}.interactiveIconLarge{display:inline-block;position:absolute;right:5px;top:8px}@media (max-width: 600px){.interactiveIconLarge{display:none}}.interactiveIconSmall{display:inline-block;position:absolute;right:5px;top:-2px}@media (min-width: 600px){.interactiveIconSmall{display:none}}.imageContainer{max-width:100%}.contentContainer{max-height:100%;max-width:100%}@media (min-width: 600px){.contentContainer{max-width:50%}}.secondaryContentContainer{display:flex}.imageLight{aspect-ratio:2/1;border-radius:8px;max-height:100%;max-width:100%;border:1px solid #D9D9D9}.imageDark{aspect-ratio:2/1;border-radius:8px;max-height:100%;max-width:100%;border:1px solid #333}.headingLight{font-family:var(--font-stack);font-size:16px;font-weight:700;line-height:20px;margin-bottom:4px;margin-top:0;position:relative;color:#292929}.headingDark{font-family:var(--font-stack);font-size:16px;font-weight:700;line-height:20px;margin-bottom:4px;margin-top:0;position:relative;color:#FFF}.subheadingLight{font-family:var(--font-stack);font-size:12px;font-weight:400;line-height:16px;margin-bottom:4px;margin-top:0px;color:#737373}.subheadingDark{font-family:var(--font-stack);font-size:12px;font-weight:400;line-height:16px;margin-bottom:4px;margin-top:0px;color:#BFBFBF}.primaryContentLight{font-family:var(--font-stack);font-size:16px;font-weight:400;line-height:20px;margin-bottom:4px;margin-top:0px;color:#404040}.primaryContentDark{font-family:var(--font-stack);font-size:16px;font-weight:400;line-height:20px;margin-bottom:4px;margin-top:0px;color:#E6E6E6}.secondaryContentLight{font-family:var(--font-stack);font-size:16px;font-weight:400;line-height:20px;margin-bottom:4px;margin-top:0px;color:#404040}.secondaryContentLight::after{content:\"•\";color:#404040;font-size:1em;margin-left:5px;margin-right:5px}.secondaryContentDark{font-family:var(--font-stack);font-size:16px;font-weight:400;line-height:20px;margin-bottom:4px;margin-top:0px;color:#E6E6E6}.tertiaryContentLight{font-family:var(--font-stack);font-size:16px;font-weight:400;line-height:20px;margin-bottom:4px;margin-top:0px;color:#404040}.tertiaryContentDark{font-family:var(--font-stack);font-size:16px;font-weight:400;line-height:20px;margin-bottom:4px;margin-top:0px;color:#E6E6E6}";
116
+ const searchcraftBaseSearchResultModuleCss = "@charset \"UTF-8\";:root{--font-stack:Helvetica, Arial, sans-serif}.interactiveResultContainerLight{align-items:flex-start;border-radius:16px;display:flex;flex-direction:column;gap:16px;padding:8px;position:relative;background-color:#FAFAFA}@media (min-width: 600px){.interactiveResultContainerLight{flex-direction:row}}.interactiveResultContainerDark{align-items:flex-start;border-radius:16px;display:flex;flex-direction:column;gap:16px;padding:8px;position:relative;background-color:#2E2E2E}@media (min-width: 600px){.interactiveResultContainerDark{flex-direction:row}}.resultContainer{align-items:flex-start;display:flex;flex-direction:column;gap:16px}@media (min-width: 600px){.resultContainer{flex-direction:row}}.interactiveIconLarge{display:inline-block;position:absolute;right:5px;top:8px}@media (max-width: 600px){.interactiveIconLarge{display:none}}.interactiveIconSmall{display:inline-block;position:absolute;right:5px;top:-2px}@media (min-width: 600px){.interactiveIconSmall{display:none}}.imageContainer{max-width:100%}.contentContainer{max-height:100%;max-width:100%}@media (min-width: 600px){.contentContainer{max-width:50%}}.secondaryContentContainer{display:flex}.imageLight{border-radius:8px;max-height:100%;max-width:100%;border:1px solid #D9D9D9}.imageDark{border-radius:8px;max-height:100%;max-width:100%;border:1px solid #333}.headingLight{font-family:var(--font-stack);font-size:16px;font-weight:700;line-height:20px;margin-bottom:4px;margin-top:0;position:relative;color:#292929}.headingDark{font-family:var(--font-stack);font-size:16px;font-weight:700;line-height:20px;margin-bottom:4px;margin-top:0;position:relative;color:#FFF}.subheadingLight{font-family:var(--font-stack);font-size:12px;font-weight:400;line-height:16px;margin-bottom:4px;margin-top:0px;color:#737373}.subheadingDark{font-family:var(--font-stack);font-size:12px;font-weight:400;line-height:16px;margin-bottom:4px;margin-top:0px;color:#BFBFBF}.primaryContentLight{font-family:var(--font-stack);font-size:16px;font-weight:400;line-height:20px;margin-bottom:4px;margin-top:0px;color:#404040}.primaryContentDark{font-family:var(--font-stack);font-size:16px;font-weight:400;line-height:20px;margin-bottom:4px;margin-top:0px;color:#E6E6E6}.secondaryContentLight{font-family:var(--font-stack);font-size:16px;font-weight:400;line-height:20px;margin-bottom:4px;margin-top:0px;color:#404040}.secondaryContentLight::after{content:\"•\";color:#404040;font-size:1em;margin-left:5px;margin-right:5px}.secondaryContentDark{font-family:var(--font-stack);font-size:16px;font-weight:400;line-height:20px;margin-bottom:4px;margin-top:0px;color:#E6E6E6}.tertiaryContentLight{font-family:var(--font-stack);font-size:16px;font-weight:400;line-height:20px;margin-bottom:4px;margin-top:0px;color:#404040}.tertiaryContentDark{font-family:var(--font-stack);font-size:16px;font-weight:400;line-height:20px;margin-bottom:4px;margin-top:0px;color:#E6E6E6}";
117
117
  const SearchcraftBaseSearchResultStyle0 = searchcraftBaseSearchResultModuleCss;
118
118
 
119
119
  const SearchcraftBaseSearchResult = class {
@@ -144,6 +144,7 @@ const SearchcraftBaseSearchResult = class {
144
144
  this.subheadingText = '';
145
145
  this.tertiaryContent = '';
146
146
  this.themeMode = 'light';
147
+ this.placeImageRight = false;
147
148
  }
148
149
  parseStyles() {
149
150
  try {
@@ -157,11 +158,13 @@ const SearchcraftBaseSearchResult = class {
157
158
  render() {
158
159
  const isLightTheme = this.themeMode === 'light';
159
160
  const styles = this.parseStyles();
160
- return (index.h("div", { key: '91cfc671b0b99082915df3eaafa053a9a7f77929', class: this.isInteractive
161
+ const imageContainer = this.imageSource && (index.h("div", { key: '1dee969549e02c262a9fdf050438630961d1954e', class: 'imageContainer' }, index.h("img", { key: '2a08fd81d563ad2f18e91d22449afefb772244c8', alt: this.imageDescription, class: isLightTheme ? 'imageLight' : 'imageDark', src: this.imageSource, style: styles.image || {} })));
162
+ const contentContainer = (index.h("div", { key: '93f350bba36c296377dc09824d86631e4f731e78', class: 'contentContainer' }, index.h("h2", { key: 'd630e930eba15b86c84f7e62f73d1d3539c3650d', class: isLightTheme ? 'headingLight' : 'headingDark', style: styles.heading || {} }, this.headingText), index.h("h3", { key: '0f8639094f2f64695d887b2de6fc1d777564cbb2', class: isLightTheme ? 'subheadingLight' : 'subheadingDark', style: styles.subheading || {} }, this.subheadingText), index.h("p", { key: 'e8562ca0a438f9ff0848920a5bae1e208eb3ae72', class: isLightTheme ? 'primaryContentLight' : 'primaryContentDark', style: styles.primaryContent || {} }, this.primaryContent), index.h("div", { key: 'dd97fb5946a1a50ccba31ae97c8b5b6e0cac91d9', class: 'secondaryContentContainer' }, index.h("p", { key: '9c6d705bfbd4eccb24f5afcbaad9ec92ca6fda9f', class: isLightTheme ? 'secondaryContentLight' : 'secondaryContentDark', style: styles.secondaryContent || {} }, this.secondaryContent), index.h("p", { key: '7147e47a9ed408066439431329cda75495567227', class: isLightTheme ? 'tertiaryContentLight' : 'tertiaryContentDark', style: styles.tertiaryContent || {} }, this.tertiaryContent)), this.buttonText && (index.h("button", { key: 'e620382ea1fe2f0e60645330ec087f767ff535a0', onClick: this.handleButtonClick, style: styles.button || {}, type: 'button' }, this.buttonText))));
163
+ return (index.h("div", { key: 'a104499c8adaa7d57743aaea20ee4af7caf6bdb9', class: this.isInteractive
161
164
  ? isLightTheme
162
165
  ? 'interactiveResultContainerLight'
163
166
  : 'interactiveResultContainerDark'
164
- : 'resultContainer', onKeyDown: this.keyDownCallback, onClick: this.handleContainerClick, style: styles.container || {}, tabindex: '0' }, index.h("div", { key: 'ccda236ef60aee285472155889c5490c69a86415', class: 'imageContainer' }, index.h("img", { key: 'e55d743952e2997d91f6486436e3a7955ffc1dcc', alt: this.imageDescription, class: isLightTheme ? 'imageLight' : 'imageDark', src: this.imageSource, style: styles.image || {} })), index.h("div", { key: 'b0e831c0c7bfef46b8b6da4e84536adf3ebd7158', class: 'contentContainer' }, index.h("h2", { key: '54137612623a39d711f4e3c888bf2015b6fb9500', class: isLightTheme ? 'headingLight' : 'headingDark', style: styles.heading || {} }, this.headingText), index.h("h3", { key: 'de46df990be3d0b5d2134d272e1766e911ab094a', class: isLightTheme ? 'subheadingLight' : 'subheadingDark', style: styles.subheading || {} }, this.subheadingText), index.h("p", { key: 'd9e7656bc739b0dd2267f86ac51b17d9ca16da6a', class: isLightTheme ? 'primaryContentLight' : 'primaryContentDark', style: styles.primaryContent || {} }, this.primaryContent), index.h("div", { key: 'd05813b3da29b8b21c2e370db9c0cbc7b48b9556', class: 'secondaryContentContainer' }, index.h("p", { key: 'e8d2ede937705a5bd88927779ee24e35ba2efbd8', class: isLightTheme ? 'secondaryContentLight' : 'secondaryContentDark', style: styles.secondaryContent || {} }, this.secondaryContent), index.h("p", { key: '2f9b9f603d55bcefe8347675cb31f705b1f7a0e8', class: isLightTheme ? 'tertiaryContentLight' : 'tertiaryContentDark', style: styles.tertiaryContent || {} }, this.tertiaryContent)), this.buttonText && (index.h("button", { key: '58724046c9704974cb3ae1c34335ebb7131b91ab', onClick: this.handleButtonClick, style: styles.button || {}, type: 'button' }, this.buttonText)))));
167
+ : 'resultContainer', onKeyDown: this.keyDownCallback, onClick: this.handleContainerClick, style: styles.container || {}, tabindex: '0' }, this.placeImageRight ? (index.h(index.Fragment, null, contentContainer, imageContainer)) : (index.h(index.Fragment, null, imageContainer, contentContainer))));
165
168
  }
166
169
  };
167
170
  SearchcraftBaseSearchResult.style = SearchcraftBaseSearchResultStyle0;
@@ -179,6 +182,7 @@ const SearchcraftBaseSearchResults = class {
179
182
  this.formatTime = true;
180
183
  this.placeAdAtEnd = false;
181
184
  this.placeAdAtStart = true;
185
+ this.placeResultImageRight = false;
182
186
  this.hasSearched = false;
183
187
  this.query = '';
184
188
  this.searchResults = null;
@@ -236,7 +240,7 @@ const SearchcraftBaseSearchResults = class {
236
240
  }
237
241
  }
238
242
  }
239
- return (index.h("searchcraft-base-search-result", { "button-callback": () => console.log('button callback'), "custom-styles": serializedStyles, "image-source": dynamicProperties[parsedSearchKeys[parsedSearchKeys.length - 1]], "is-interactive": true, key: `${document.document_id}-${index$1}`, "keydown-callback": () => console.log('keydown'), "heading-text": dynamicProperties[parsedSearchKeys[0]], "primary-content": dynamicProperties[parsedSearchKeys[2]], "result-callback": () => console.log('interactive element'), "secondary-content": dynamicProperties[parsedSearchKeys[3]], "subheading-text": dynamicProperties[parsedSearchKeys[1]], "tertiary-content": dynamicProperties[parsedSearchKeys[4]] }));
243
+ return (index.h("searchcraft-base-search-result", { "button-callback": () => console.log('button callback'), "custom-styles": serializedStyles, "image-source": dynamicProperties[parsedSearchKeys[parsedSearchKeys.length - 1]], "is-interactive": true, key: `${document.document_id}-${index$1}`, "keydown-callback": () => console.log('keydown'), "heading-text": dynamicProperties[parsedSearchKeys[0]], "place-image-right": this.placeResultImageRight, "primary-content": dynamicProperties[parsedSearchKeys[2]], "result-callback": () => console.log('interactive element'), "secondary-content": dynamicProperties[parsedSearchKeys[3]], "subheading-text": dynamicProperties[parsedSearchKeys[1]], "tertiary-content": dynamicProperties[parsedSearchKeys[4]] }));
240
244
  });
241
245
  const finalComponents = [];
242
246
  if (this.placeAdAtStart) {
@@ -338,29 +342,42 @@ const SearchcraftFiltersList = class {
338
342
  else {
339
343
  this.selectedFilters.delete(value);
340
344
  }
341
- const selectedFiltersArray = Array.from(this.selectedFilters);
342
- this.filtersUpdated.emit(selectedFiltersArray);
343
- this.searchStore.setSelectedFilters(selectedFiltersArray);
345
+ const deduplicatedFilters = this.deduplicatePaths(Array.from(this.selectedFilters));
346
+ this.filtersUpdated.emit(deduplicatedFilters);
347
+ this.searchStore.setSelectedFilters(deduplicatedFilters);
344
348
  this.searchStore.search();
345
349
  };
346
350
  this.filters = [];
347
351
  this.dynamicFilters = [];
348
- this.initialFilters = [];
349
352
  this.isRequesting = false;
350
- this.originalFilterCounts = {};
351
353
  this.query = '';
352
354
  this.resultsCount = 0;
353
355
  this.selectedFilters = new Set();
354
356
  }
355
357
  connectedCallback() {
358
+ var _a;
359
+ const state = this.searchStore; // Fetch the initial state
360
+ // Initial population of facets if available
361
+ if ((_a = state.searchResults) === null || _a === void 0 ? void 0 : _a.data.facets) {
362
+ this.populateFiltersFromFacets(state.searchResults.data.facets);
363
+ }
356
364
  this.unsubscribe = store.useSearchcraftStore.subscribe((state) => {
357
365
  var _a, _b, _c, _d;
358
- this.isRequesting = state.isRequesting;
366
+ if (!state.query || state.query.trim().length === 0) {
367
+ if (this.selectedFilters.size > 0) {
368
+ this.selectedFilters.clear();
369
+ this.filtersUpdated.emit([]);
370
+ if (this.searchStore.selectedFilters.length > 0) {
371
+ this.searchStore.setSelectedFilters([]);
372
+ }
373
+ }
374
+ }
359
375
  this.query = state.query || '';
376
+ this.isRequesting = state.isRequesting;
360
377
  this.resultsCount = ((_c = (_b = (_a = state.searchResults) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.hits) === null || _c === void 0 ? void 0 : _c.length) || 0;
361
- const facets = (_d = state.searchResults) === null || _d === void 0 ? void 0 : _d.data.facets;
362
- if (facets) {
363
- this.populateFiltersFromFacets(facets);
378
+ // Populate filters when facets are updated
379
+ if ((_d = state.searchResults) === null || _d === void 0 ? void 0 : _d.data.facets) {
380
+ this.populateFiltersFromFacets(state.searchResults.data.facets);
364
381
  }
365
382
  });
366
383
  }
@@ -371,24 +388,28 @@ const SearchcraftFiltersList = class {
371
388
  }
372
389
  populateFiltersFromFacets(facets) {
373
390
  var _a;
374
- const newFilters = Object.entries(((_a = facets.section) === null || _a === void 0 ? void 0 : _a.counts) || {}).map(([key, count]) => {
375
- const filterValue = key;
376
- this.originalFilterCounts[filterValue] = `${count}`;
377
- return {
378
- label: `${key.replace(/^\//, '')} (${count})`,
379
- value: filterValue,
380
- };
391
+ const newFilters = utils.flattenFacets(((_a = facets[0]) === null || _a === void 0 ? void 0 : _a.section) || []);
392
+ const filtersMap = new Map();
393
+ newFilters.forEach((filter) => {
394
+ const key = filter.value.split('/').pop() || '';
395
+ const existingFilter = filtersMap.get(key);
396
+ if (!existingFilter ||
397
+ filter.value.length < existingFilter.value.length) {
398
+ filtersMap.set(key, filter);
399
+ }
381
400
  });
382
- // Update dynamic filters while preserving the initial filters
383
- const updatedFilters = [
384
- ...this.initialFilters,
385
- ...newFilters.filter((filter) => !this.initialFilters.some((initial) => initial.value === filter.value)),
386
- ];
387
- this.dynamicFilters = updatedFilters;
388
- // Store the initial filters only once
389
- if (this.initialFilters.length === 0) {
390
- this.initialFilters = [...updatedFilters];
391
- }
401
+ this.dynamicFilters = Array.from(filtersMap.values());
402
+ }
403
+ deduplicatePaths(filters) {
404
+ const pathMap = new Map();
405
+ filters.forEach((path) => {
406
+ const key = path.split('/').pop() || '';
407
+ const existingPath = pathMap.get(key);
408
+ if (!existingPath || path.length < existingPath.length) {
409
+ pathMap.set(key, path);
410
+ }
411
+ });
412
+ return Array.from(pathMap.values());
392
413
  }
393
414
  formatLabel(label) {
394
415
  return label
@@ -401,17 +422,16 @@ const SearchcraftFiltersList = class {
401
422
  if (!this.query || this.resultsCount === 0) {
402
423
  return null;
403
424
  }
404
- const filtersToRender = this.initialFilters.map((initialFilter) => {
405
- const isChecked = this.selectedFilters.has(initialFilter.value);
406
- const dynamicChildren = this.dynamicFilters.filter((dynamicFilter) => dynamicFilter.value.startsWith(initialFilter.value) &&
407
- dynamicFilter.value !== initialFilter.value);
408
- return Object.assign(Object.assign({}, initialFilter), { isChecked, children: dynamicChildren });
409
- });
410
- return (index.h("div", { class: 'filtersList' }, filtersToRender.map((filter) => (index.h("div", { key: filter.value }, index.h("label", { class: 'checkboxLabel' }, index.h("input", { class: 'filterCheckbox', checked: filter.isChecked, onChange: (event) => this.handleFilterChange(filter.value, event.target.checked), type: 'checkbox', value: filter.value }), this.formatLabel(filter.label)), filter.isChecked &&
411
- filter.children.map((childFilter) => {
412
- const childLabel = childFilter.label.split('/').pop();
413
- return (index.h("label", { class: 'childCheckboxLabel', key: childFilter.value, style: { marginLeft: '20px' } }, index.h("input", { class: 'childFilterCheckbox', checked: this.selectedFilters.has(childFilter.value), onChange: (event) => this.handleFilterChange(childFilter.value, event.target.checked), type: 'checkbox', value: childFilter.value }), this.formatLabel(childLabel || '')));
414
- }))))));
425
+ const filtersToRender = this.dynamicFilters.filter((filter) => !filter.value.includes('/', filter.value.indexOf('/') + 1));
426
+ return (index.h("div", { class: 'filtersList' }, filtersToRender.map((filter) => {
427
+ const isChecked = this.selectedFilters.has(filter.value);
428
+ const children = this.dynamicFilters.filter((child) => child.value.startsWith(`${filter.value}/`) &&
429
+ child.value !== filter.value);
430
+ return (index.h("div", { key: filter.value }, index.h("label", { class: 'checkboxLabel' }, index.h("input", { class: 'filterCheckbox', checked: isChecked, onChange: (event) => this.handleFilterChange(filter.value, event.target.checked), type: 'checkbox' }), this.formatLabel(filter.label)), children.map((child) => {
431
+ const isChildChecked = this.selectedFilters.has(child.value);
432
+ return (index.h("label", { class: 'childCheckboxLabel', key: child.value, style: { marginLeft: '20px' } }, index.h("input", { class: 'childFilterCheckbox', checked: isChildChecked, onChange: (event) => this.handleFilterChange(child.value, event.target.checked), type: 'checkbox' }), this.formatLabel(child.label.split('/').pop() || '')));
433
+ })));
434
+ })));
415
435
  }
416
436
  };
417
437
  SearchcraftFiltersList.style = SearchcraftFiltersListStyle0;