@searchcraft/javascript-sdk 0.6.0 → 0.7.1

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 (271) hide show
  1. package/README.md +59 -55
  2. package/dist/cjs/{index-b3b77ea2.js → index-a81df4f0.js} +258 -239
  3. package/dist/cjs/index-a81df4f0.js.map +1 -0
  4. package/dist/cjs/index.cjs.js +1 -1
  5. package/dist/cjs/loader.cjs.js +2 -2
  6. package/dist/cjs/searchcraft-base-search-result.cjs.entry.js +91 -48
  7. package/dist/cjs/searchcraft-base-search-result.cjs.entry.js.map +1 -1
  8. package/dist/cjs/searchcraft-base-search-results.cjs.entry.js +74 -37
  9. package/dist/cjs/searchcraft-base-search-results.cjs.entry.js.map +1 -1
  10. package/dist/cjs/searchcraft-button_3.cjs.entry.js +37 -27
  11. package/dist/cjs/searchcraft-button_3.cjs.entry.js.map +1 -1
  12. package/dist/cjs/searchcraft-facet-list_3.cjs.entry.js +141 -117
  13. package/dist/cjs/searchcraft-facet-list_3.cjs.entry.js.map +1 -1
  14. package/dist/cjs/searchcraft-filter-panel.cjs.entry.js +11 -13
  15. package/dist/cjs/searchcraft-filter-panel.cjs.entry.js.map +1 -1
  16. package/dist/cjs/searchcraft-input-form_2.cjs.entry.js +128 -82
  17. package/dist/cjs/searchcraft-input-form_2.cjs.entry.js.map +1 -1
  18. package/dist/cjs/searchcraft-javascript-sdk.cjs.js +3 -3
  19. package/dist/cjs/searchcraft-javascript-sdk.cjs.js.map +1 -1
  20. package/dist/cjs/searchcraft-popover-button.cjs.entry.js +3 -7
  21. package/dist/cjs/searchcraft-popover-button.cjs.entry.js.map +1 -1
  22. package/dist/cjs/searchcraft-popover-form.cjs.entry.js +81 -68
  23. package/dist/cjs/searchcraft-popover-form.cjs.entry.js.map +1 -1
  24. package/dist/cjs/searchcraft-popover-list-item.cjs.entry.js +29 -12
  25. package/dist/cjs/searchcraft-popover-list-item.cjs.entry.js.map +1 -1
  26. package/dist/cjs/searchcraft-results-info.cjs.entry.js +9 -13
  27. package/dist/cjs/searchcraft-results-info.cjs.entry.js.map +1 -1
  28. package/dist/cjs/searchcraft-theme.cjs.entry.js +38 -0
  29. package/dist/cjs/searchcraft-theme.cjs.entry.js.map +1 -0
  30. package/dist/cjs/{store-d7ebcf7a.js → store-f6ba3dfb.js} +633 -107
  31. package/dist/cjs/store-f6ba3dfb.js.map +1 -0
  32. package/dist/collection/collection-manifest.json +2 -1
  33. package/dist/collection/components/searchcraft-base-search-result/searchcraft-base-search-result.js +134 -66
  34. package/dist/collection/components/searchcraft-base-search-result/searchcraft-base-search-result.js.map +1 -1
  35. package/dist/collection/components/searchcraft-base-search-results/searchcraft-base-search-results.js +100 -49
  36. package/dist/collection/components/searchcraft-base-search-results/searchcraft-base-search-results.js.map +1 -1
  37. package/dist/collection/components/searchcraft-button/searchcraft-button.js +35 -23
  38. package/dist/collection/components/searchcraft-button/searchcraft-button.js.map +1 -1
  39. package/dist/collection/components/searchcraft-error-message/searchcraft-error-message.js +8 -15
  40. package/dist/collection/components/searchcraft-error-message/searchcraft-error-message.js.map +1 -1
  41. package/dist/collection/components/searchcraft-facet-list/searchcraft-facet-list.js +61 -59
  42. package/dist/collection/components/searchcraft-facet-list/searchcraft-facet-list.js.map +1 -1
  43. package/dist/collection/components/searchcraft-filter-panel/searchcraft-filter-panel.js +11 -19
  44. package/dist/collection/components/searchcraft-filter-panel/searchcraft-filter-panel.js.map +1 -1
  45. package/dist/collection/components/searchcraft-input-form/searchcraft-input-form.js +126 -76
  46. package/dist/collection/components/searchcraft-input-form/searchcraft-input-form.js.map +1 -1
  47. package/dist/collection/components/searchcraft-input-label/searchcraft-input-label.js +14 -18
  48. package/dist/collection/components/searchcraft-input-label/searchcraft-input-label.js.map +1 -1
  49. package/dist/collection/components/searchcraft-popover-button/searchcraft-popover-button.js +1 -11
  50. package/dist/collection/components/searchcraft-popover-button/searchcraft-popover-button.js.map +1 -1
  51. package/dist/collection/components/searchcraft-popover-form/searchcraft-popover-form.js +93 -77
  52. package/dist/collection/components/searchcraft-popover-form/searchcraft-popover-form.js.map +1 -1
  53. package/dist/collection/components/searchcraft-popover-list-item/searchcraft-popover-list-item.js +47 -25
  54. package/dist/collection/components/searchcraft-popover-list-item/searchcraft-popover-list-item.js.map +1 -1
  55. package/dist/collection/components/searchcraft-popover-list-view/searchcraft-popover-list-view.js +23 -25
  56. package/dist/collection/components/searchcraft-popover-list-view/searchcraft-popover-list-view.js.map +1 -1
  57. package/dist/collection/components/searchcraft-results-info/searchcraft-results-info.js +7 -19
  58. package/dist/collection/components/searchcraft-results-info/searchcraft-results-info.js.map +1 -1
  59. package/dist/collection/components/searchcraft-slider/searchcraft-slider.js +65 -55
  60. package/dist/collection/components/searchcraft-slider/searchcraft-slider.js.map +1 -1
  61. package/dist/collection/components/searchcraft-theme/searchcraft-theme.js +27 -0
  62. package/dist/collection/components/searchcraft-theme/searchcraft-theme.js.map +1 -0
  63. package/dist/collection/components/searchcraft-toggle-button/searchcraft-toggle-button.js +27 -26
  64. package/dist/collection/components/searchcraft-toggle-button/searchcraft-toggle-button.js.map +1 -1
  65. package/dist/collection/index.js.map +1 -1
  66. package/dist/collection/provider/store.js +25 -9
  67. package/dist/collection/provider/store.js.map +1 -1
  68. package/dist/collection/utils/facets.js +5 -3
  69. package/dist/collection/utils/facets.js.map +1 -1
  70. package/dist/components/index.js +4 -2
  71. package/dist/components/index.js.map +1 -1
  72. package/dist/components/p-0ef4ab33.js +66 -0
  73. package/dist/components/p-0ef4ab33.js.map +1 -0
  74. package/dist/components/p-1234974c.js +72 -0
  75. package/dist/components/p-1234974c.js.map +1 -0
  76. package/dist/components/p-4b92ae26.js +109 -0
  77. package/dist/components/p-4b92ae26.js.map +1 -0
  78. package/dist/components/{p-85765b81.js → p-506cdac1.js} +18 -16
  79. package/dist/components/p-506cdac1.js.map +1 -0
  80. package/dist/components/p-521fe971.js +60 -0
  81. package/dist/components/p-521fe971.js.map +1 -0
  82. package/dist/components/{p-e4846fa2.js → p-5365011f.js} +215 -231
  83. package/dist/components/p-5365011f.js.map +1 -0
  84. package/dist/components/p-54998882.js +285 -0
  85. package/dist/components/p-54998882.js.map +1 -0
  86. package/dist/components/{p-d6a88eed.js → p-936e2ed4.js} +633 -107
  87. package/dist/components/p-936e2ed4.js.map +1 -0
  88. package/dist/components/p-a75ef832.js +34 -0
  89. package/dist/components/p-a75ef832.js.map +1 -0
  90. package/dist/components/p-b4a8fcbe.js +144 -0
  91. package/dist/components/p-b4a8fcbe.js.map +1 -0
  92. package/dist/components/p-ca881e5c.js +37 -0
  93. package/dist/components/p-ca881e5c.js.map +1 -0
  94. package/dist/components/p-d95bc2a0.js +284 -0
  95. package/dist/components/p-d95bc2a0.js.map +1 -0
  96. package/dist/components/searchcraft-base-search-result.js +1 -1
  97. package/dist/components/searchcraft-base-search-results.js +76 -39
  98. package/dist/components/searchcraft-base-search-results.js.map +1 -1
  99. package/dist/components/searchcraft-button.js +1 -1
  100. package/dist/components/searchcraft-error-message.js +1 -1
  101. package/dist/components/searchcraft-facet-list.js +1 -1
  102. package/dist/components/searchcraft-filter-panel.js +14 -16
  103. package/dist/components/searchcraft-filter-panel.js.map +1 -1
  104. package/dist/components/searchcraft-input-form.js +1 -1
  105. package/dist/components/searchcraft-input-label.js +1 -1
  106. package/dist/components/searchcraft-popover-button.js +3 -7
  107. package/dist/components/searchcraft-popover-button.js.map +1 -1
  108. package/dist/components/searchcraft-popover-form.js +87 -74
  109. package/dist/components/searchcraft-popover-form.js.map +1 -1
  110. package/dist/components/searchcraft-popover-list-item.js +1 -1
  111. package/dist/components/searchcraft-popover-list-view.js +1 -1
  112. package/dist/components/searchcraft-results-info.js +9 -13
  113. package/dist/components/searchcraft-results-info.js.map +1 -1
  114. package/dist/components/searchcraft-slider.js +1 -1
  115. package/dist/components/searchcraft-theme.d.ts +11 -0
  116. package/dist/components/searchcraft-theme.js +51 -0
  117. package/dist/components/searchcraft-theme.js.map +1 -0
  118. package/dist/components/searchcraft-toggle-button.js +1 -1
  119. package/dist/esm/{index-11551663.js → index-3608c57d.js} +258 -239
  120. package/dist/esm/index-3608c57d.js.map +1 -0
  121. package/dist/esm/index.js +1 -1
  122. package/dist/esm/loader.js +3 -3
  123. package/dist/esm/searchcraft-base-search-result.entry.js +91 -48
  124. package/dist/esm/searchcraft-base-search-result.entry.js.map +1 -1
  125. package/dist/esm/searchcraft-base-search-results.entry.js +74 -37
  126. package/dist/esm/searchcraft-base-search-results.entry.js.map +1 -1
  127. package/dist/esm/searchcraft-button_3.entry.js +37 -27
  128. package/dist/esm/searchcraft-button_3.entry.js.map +1 -1
  129. package/dist/esm/searchcraft-facet-list_3.entry.js +141 -117
  130. package/dist/esm/searchcraft-facet-list_3.entry.js.map +1 -1
  131. package/dist/esm/searchcraft-filter-panel.entry.js +11 -13
  132. package/dist/esm/searchcraft-filter-panel.entry.js.map +1 -1
  133. package/dist/esm/searchcraft-input-form_2.entry.js +128 -82
  134. package/dist/esm/searchcraft-input-form_2.entry.js.map +1 -1
  135. package/dist/esm/searchcraft-javascript-sdk.js +4 -4
  136. package/dist/esm/searchcraft-javascript-sdk.js.map +1 -1
  137. package/dist/esm/searchcraft-popover-button.entry.js +3 -7
  138. package/dist/esm/searchcraft-popover-button.entry.js.map +1 -1
  139. package/dist/esm/searchcraft-popover-form.entry.js +81 -68
  140. package/dist/esm/searchcraft-popover-form.entry.js.map +1 -1
  141. package/dist/esm/searchcraft-popover-list-item.entry.js +29 -12
  142. package/dist/esm/searchcraft-popover-list-item.entry.js.map +1 -1
  143. package/dist/esm/searchcraft-results-info.entry.js +9 -13
  144. package/dist/esm/searchcraft-results-info.entry.js.map +1 -1
  145. package/dist/esm/searchcraft-theme.entry.js +34 -0
  146. package/dist/esm/searchcraft-theme.entry.js.map +1 -0
  147. package/dist/esm/{store-1058f7b0.js → store-aa071d9c.js} +633 -107
  148. package/dist/esm/store-aa071d9c.js.map +1 -0
  149. package/dist/searchcraft-javascript-sdk/index.esm.js +1 -1
  150. package/dist/searchcraft-javascript-sdk/p-26f5263d.entry.js +2 -0
  151. package/dist/searchcraft-javascript-sdk/p-26f5263d.entry.js.map +1 -0
  152. package/dist/searchcraft-javascript-sdk/p-2ff7eb35.entry.js +2 -0
  153. package/dist/searchcraft-javascript-sdk/p-2ff7eb35.entry.js.map +1 -0
  154. package/dist/searchcraft-javascript-sdk/p-36f0532e.entry.js +2 -0
  155. package/dist/searchcraft-javascript-sdk/p-36f0532e.entry.js.map +1 -0
  156. package/dist/searchcraft-javascript-sdk/p-41b6bc5d.entry.js +2 -0
  157. package/dist/searchcraft-javascript-sdk/p-41b6bc5d.entry.js.map +1 -0
  158. package/dist/searchcraft-javascript-sdk/p-57eddb07.entry.js +2 -0
  159. package/dist/searchcraft-javascript-sdk/p-57eddb07.entry.js.map +1 -0
  160. package/dist/searchcraft-javascript-sdk/p-5d6fbee0.entry.js +2 -0
  161. package/dist/searchcraft-javascript-sdk/p-5d6fbee0.entry.js.map +1 -0
  162. package/dist/searchcraft-javascript-sdk/p-64c5a1d2.entry.js +2 -0
  163. package/dist/searchcraft-javascript-sdk/p-64c5a1d2.entry.js.map +1 -0
  164. package/dist/searchcraft-javascript-sdk/p-7e13c128.js +3 -0
  165. package/dist/searchcraft-javascript-sdk/p-7e13c128.js.map +1 -0
  166. package/dist/searchcraft-javascript-sdk/p-8b0a60b3.entry.js +2 -0
  167. package/dist/searchcraft-javascript-sdk/p-8b0a60b3.entry.js.map +1 -0
  168. package/dist/searchcraft-javascript-sdk/p-936e2ed4.js +11 -0
  169. package/dist/searchcraft-javascript-sdk/p-936e2ed4.js.map +1 -0
  170. package/dist/searchcraft-javascript-sdk/p-c7df8be6.entry.js +2 -0
  171. package/dist/searchcraft-javascript-sdk/p-c7df8be6.entry.js.map +1 -0
  172. package/dist/searchcraft-javascript-sdk/p-eb6058e8.entry.js +2 -0
  173. package/dist/searchcraft-javascript-sdk/p-eb6058e8.entry.js.map +1 -0
  174. package/dist/searchcraft-javascript-sdk/p-faaa4394.entry.js +2 -0
  175. package/dist/searchcraft-javascript-sdk/p-faaa4394.entry.js.map +1 -0
  176. package/dist/searchcraft-javascript-sdk/searchcraft-javascript-sdk.esm.js +1 -1
  177. package/dist/searchcraft-javascript-sdk/searchcraft-javascript-sdk.esm.js.map +1 -1
  178. package/dist/types/components/searchcraft-base-search-result/searchcraft-base-search-result.d.ts +1 -0
  179. package/dist/types/components/searchcraft-base-search-results/searchcraft-base-search-results.d.ts +2 -1
  180. package/dist/types/components/searchcraft-button/searchcraft-button.d.ts +1 -0
  181. package/dist/types/components/searchcraft-error-message/searchcraft-error-message.d.ts +1 -0
  182. package/dist/types/components/searchcraft-facet-list/searchcraft-facet-list.d.ts +2 -1
  183. package/dist/types/components/searchcraft-filter-panel/searchcraft-filter-panel.d.ts +1 -0
  184. package/dist/types/components/searchcraft-input-form/searchcraft-input-form.d.ts +7 -10
  185. package/dist/types/components/searchcraft-input-label/searchcraft-input-label.d.ts +2 -1
  186. package/dist/types/components/searchcraft-popover-button/searchcraft-popover-button.d.ts +1 -0
  187. package/dist/types/components/searchcraft-popover-form/searchcraft-popover-form.d.ts +2 -1
  188. package/dist/types/components/searchcraft-popover-list-item/searchcraft-popover-list-item.d.ts +2 -0
  189. package/dist/types/components/searchcraft-popover-list-view/searchcraft-popover-list-view.d.ts +1 -0
  190. package/dist/types/components/searchcraft-results-info/searchcraft-results-info.d.ts +1 -0
  191. package/dist/types/components/searchcraft-slider/searchcraft-slider.d.ts +2 -1
  192. package/dist/types/components/searchcraft-theme/searchcraft-theme.d.ts +5 -0
  193. package/dist/types/components/searchcraft-toggle-button/searchcraft-toggle-button.d.ts +2 -1
  194. package/dist/types/components.d.ts +17 -4
  195. package/dist/types/index.d.ts +2 -1
  196. package/dist/types/provider/store.d.ts +1 -0
  197. package/dist/types/types/_shared.types.d.ts +1 -0
  198. package/dist/types/types/index.d.ts +1 -0
  199. package/dist/types/types/raw.d.ts +4 -0
  200. package/dist/types/types/searchcraft-base-search-results.types.d.ts +1 -0
  201. package/dist/types/types/searchcraft-filter-panel.types.d.ts +1 -0
  202. package/dist/types/types/searchcraft-popover-form.types.d.ts +1 -0
  203. package/dist/types/utils/facets.d.ts +1 -0
  204. package/dist/types/utils/index.d.ts +1 -0
  205. package/dist/types/utils/styles.d.ts +1 -0
  206. package/dist/types/utils/units.d.ts +1 -0
  207. package/package.json +6 -4
  208. package/dist/cjs/index-b3b77ea2.js.map +0 -1
  209. package/dist/cjs/store-d7ebcf7a.js.map +0 -1
  210. package/dist/collection/components/searchcraft-base-search-result/searchcraft-base-search-result.module.css +0 -227
  211. package/dist/collection/components/searchcraft-base-search-results/searchcraft-base-search-results.module.css +0 -179
  212. package/dist/collection/components/searchcraft-button/searchcraft-button.module.css +0 -174
  213. package/dist/collection/components/searchcraft-error-message/searchcraft-error-message.module.css +0 -158
  214. package/dist/collection/components/searchcraft-facet-list/searchcraft-facet-list.module.css +0 -266
  215. package/dist/collection/components/searchcraft-filter-panel/searchcraft-filter-panel.module.css +0 -168
  216. package/dist/collection/components/searchcraft-input-form/searchcraft-input-form.module.css +0 -293
  217. package/dist/collection/components/searchcraft-input-label/searchcraft-input-label.module.css +0 -159
  218. package/dist/collection/components/searchcraft-popover-button/searchcraft-popover-button.module.css +0 -0
  219. package/dist/collection/components/searchcraft-popover-form/searchcraft-popover-form.module.css +0 -322
  220. package/dist/collection/components/searchcraft-popover-list-item/searchcraft-popover-list-item.module.css +0 -209
  221. package/dist/collection/components/searchcraft-popover-list-view/searchcraft-popover-list-view.module.css +0 -0
  222. package/dist/collection/components/searchcraft-results-info/searchcraft-results-info.module.css +0 -169
  223. package/dist/collection/components/searchcraft-slider/searchcraft-slider.module.css +0 -231
  224. package/dist/collection/components/searchcraft-toggle-button/searchcraft-toggle-button.module.css +0 -207
  225. package/dist/components/p-02a16e53.js +0 -240
  226. package/dist/components/p-02a16e53.js.map +0 -1
  227. package/dist/components/p-04c46179.js +0 -101
  228. package/dist/components/p-04c46179.js.map +0 -1
  229. package/dist/components/p-0e38a723.js +0 -99
  230. package/dist/components/p-0e38a723.js.map +0 -1
  231. package/dist/components/p-4c45ef80.js +0 -67
  232. package/dist/components/p-4c45ef80.js.map +0 -1
  233. package/dist/components/p-85765b81.js.map +0 -1
  234. package/dist/components/p-953f4238.js +0 -35
  235. package/dist/components/p-953f4238.js.map +0 -1
  236. package/dist/components/p-a248ad69.js +0 -276
  237. package/dist/components/p-a248ad69.js.map +0 -1
  238. package/dist/components/p-a9bd1872.js +0 -38
  239. package/dist/components/p-a9bd1872.js.map +0 -1
  240. package/dist/components/p-cf4ced92.js +0 -49
  241. package/dist/components/p-cf4ced92.js.map +0 -1
  242. package/dist/components/p-d6a88eed.js.map +0 -1
  243. package/dist/components/p-e4846fa2.js.map +0 -1
  244. package/dist/components/p-f9d778b3.js +0 -48
  245. package/dist/components/p-f9d778b3.js.map +0 -1
  246. package/dist/esm/index-11551663.js.map +0 -1
  247. package/dist/esm/store-1058f7b0.js.map +0 -1
  248. package/dist/searchcraft-javascript-sdk/p-4580e8a4.entry.js +0 -2
  249. package/dist/searchcraft-javascript-sdk/p-4580e8a4.entry.js.map +0 -1
  250. package/dist/searchcraft-javascript-sdk/p-7049b93d.entry.js +0 -2
  251. package/dist/searchcraft-javascript-sdk/p-7049b93d.entry.js.map +0 -1
  252. package/dist/searchcraft-javascript-sdk/p-8e539d62.entry.js +0 -2
  253. package/dist/searchcraft-javascript-sdk/p-8e539d62.entry.js.map +0 -1
  254. package/dist/searchcraft-javascript-sdk/p-98640a6a.entry.js +0 -2
  255. package/dist/searchcraft-javascript-sdk/p-98640a6a.entry.js.map +0 -1
  256. package/dist/searchcraft-javascript-sdk/p-9d0f5c89.entry.js +0 -2
  257. package/dist/searchcraft-javascript-sdk/p-9d0f5c89.entry.js.map +0 -1
  258. package/dist/searchcraft-javascript-sdk/p-b8bd53ce.entry.js +0 -2
  259. package/dist/searchcraft-javascript-sdk/p-b8bd53ce.entry.js.map +0 -1
  260. package/dist/searchcraft-javascript-sdk/p-c27a3673.entry.js +0 -2
  261. package/dist/searchcraft-javascript-sdk/p-c27a3673.entry.js.map +0 -1
  262. package/dist/searchcraft-javascript-sdk/p-cd852b84.entry.js +0 -2
  263. package/dist/searchcraft-javascript-sdk/p-cd852b84.entry.js.map +0 -1
  264. package/dist/searchcraft-javascript-sdk/p-d6a88eed.js +0 -11
  265. package/dist/searchcraft-javascript-sdk/p-d6a88eed.js.map +0 -1
  266. package/dist/searchcraft-javascript-sdk/p-e042deb9.entry.js +0 -2
  267. package/dist/searchcraft-javascript-sdk/p-e042deb9.entry.js.map +0 -1
  268. package/dist/searchcraft-javascript-sdk/p-e0be53df.js +0 -3
  269. package/dist/searchcraft-javascript-sdk/p-e0be53df.js.map +0 -1
  270. package/dist/searchcraft-javascript-sdk/p-efab9f3c.entry.js +0 -2
  271. package/dist/searchcraft-javascript-sdk/p-efab9f3c.entry.js.map +0 -1
@@ -6,51 +6,96 @@ import { Fragment, h } from "@stencil/core";
6
6
  * It is consumed within the `searchcraft-base-search-results` component.
7
7
  */
8
8
  export class SearchcraftBaseSearchResult {
9
- constructor() {
10
- this.searchcraftStore = useSearchcraftStore.getState();
11
- this.recordMeasureEvent = () => {
12
- var _a, _b, _c;
13
- const searchcraft = this.searchcraftStore.getSearchcraftInstance();
14
- if (searchcraft) {
15
- const document_position = this.documentPosition;
16
- const search_term = this.searchcraftStore.query;
17
- const number_of_documents = ((_c = (_b = (_a = this.searchcraftStore.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;
18
- searchcraft.sendMeasureEvent('document_clicked', {
19
- document_position,
20
- number_of_documents,
21
- search_term,
22
- });
9
+ /**
10
+ * The title content.
11
+ */
12
+ titleContent;
13
+ /**
14
+ * The subtitle content.
15
+ */
16
+ subtitleContent;
17
+ /**
18
+ * The body content.
19
+ */
20
+ bodyContent;
21
+ /**
22
+ * The footer content.
23
+ */
24
+ footerContent;
25
+ /**
26
+ * The label for the button rendered when containerHref is not present.
27
+ */
28
+ buttonLabel;
29
+ /**
30
+ * The link for the button rendered when containerHref is not present.
31
+ */
32
+ buttonHref;
33
+ /**
34
+ * Where to open the link for the button rendered when containerHref is not present.
35
+ */
36
+ buttonTarget = '_blank';
37
+ /**
38
+ * The relationship between the current document and the link for the button rendered when containerHref is not present.
39
+ */
40
+ buttonRel;
41
+ /**
42
+ * The link for the containing element.
43
+ */
44
+ containerHref;
45
+ /**
46
+ * Where to open the link for the containing element.
47
+ */
48
+ containerTarget = '_blank';
49
+ /**
50
+ * The relationship between the current document and the link for the containing element.
51
+ */
52
+ containerRel;
53
+ /**
54
+ * The image source.
55
+ */
56
+ imageSrc;
57
+ /**
58
+ * The image alternative text.
59
+ */
60
+ imageAlt;
61
+ /**
62
+ * The placement of the image.
63
+ */
64
+ imagePlacement = 'right';
65
+ /**
66
+ * A custom styles object.
67
+ */
68
+ customStyles;
69
+ /**
70
+ * The position in the document. Used with the "document_clicked" measure event.
71
+ */
72
+ documentPosition = 0;
73
+ searchcraftStore = useSearchcraftStore.getState();
74
+ recordMeasureEvent = () => {
75
+ const searchcraft = this.searchcraftStore.getSearchcraftInstance();
76
+ if (searchcraft) {
77
+ const document_position = this.documentPosition;
78
+ const search_term = this.searchcraftStore.query;
79
+ const number_of_documents = this.searchcraftStore.searchResults?.data?.hits?.length || 0;
80
+ searchcraft.sendMeasureEvent('document_clicked', {
81
+ document_position,
82
+ number_of_documents,
83
+ search_term,
84
+ });
85
+ }
86
+ };
87
+ parseStyles = () => {
88
+ if (this.customStyles) {
89
+ try {
90
+ return JSON.parse(this.customStyles);
23
91
  }
24
- };
25
- this.parseStyles = () => {
26
- if (this.customStyles) {
27
- try {
28
- return JSON.parse(this.customStyles);
29
- }
30
- catch (error) {
31
- console.error('Error parsing custom styles:', error);
32
- return {};
33
- }
92
+ catch (error) {
93
+ console.error('Error parsing custom styles:', error);
94
+ return {};
34
95
  }
35
- return {};
36
- };
37
- this.titleContent = undefined;
38
- this.subtitleContent = undefined;
39
- this.bodyContent = undefined;
40
- this.footerContent = undefined;
41
- this.buttonLabel = undefined;
42
- this.buttonHref = undefined;
43
- this.buttonTarget = '_blank';
44
- this.buttonRel = undefined;
45
- this.containerHref = undefined;
46
- this.containerTarget = '_blank';
47
- this.containerRel = undefined;
48
- this.imageSrc = undefined;
49
- this.imageAlt = undefined;
50
- this.imagePlacement = undefined;
51
- this.customStyles = undefined;
52
- this.documentPosition = 0;
53
- }
96
+ }
97
+ return {};
98
+ };
54
99
  render() {
55
100
  const styles = this.parseStyles();
56
101
  const imageContainer = this.imageSrc && (h("img", { alt: this.imageAlt, class: 'searchcraft-search-result-image', src: this.imageSrc, style: styles.image || {} }));
@@ -63,16 +108,6 @@ export class SearchcraftBaseSearchResult {
63
108
  return (h("div", { class: 'searchcraft-search-result-container', style: styles.container || {} }, contentContainer));
64
109
  }
65
110
  static get is() { return "searchcraft-base-search-result"; }
66
- static get originalStyleUrls() {
67
- return {
68
- "$": ["searchcraft-base-search-result.module.scss"]
69
- };
70
- }
71
- static get styleUrls() {
72
- return {
73
- "$": ["searchcraft-base-search-result.module.css"]
74
- };
75
- }
76
111
  static get properties() {
77
112
  return {
78
113
  "titleContent": {
@@ -80,7 +115,7 @@ export class SearchcraftBaseSearchResult {
80
115
  "mutable": false,
81
116
  "complexType": {
82
117
  "original": "string | undefined",
83
- "resolved": "string",
118
+ "resolved": "string | undefined",
84
119
  "references": {}
85
120
  },
86
121
  "required": false,
@@ -89,6 +124,8 @@ export class SearchcraftBaseSearchResult {
89
124
  "tags": [],
90
125
  "text": "The title content."
91
126
  },
127
+ "getter": false,
128
+ "setter": false,
92
129
  "attribute": "title-content",
93
130
  "reflect": false
94
131
  },
@@ -97,7 +134,7 @@ export class SearchcraftBaseSearchResult {
97
134
  "mutable": false,
98
135
  "complexType": {
99
136
  "original": "string | undefined",
100
- "resolved": "string",
137
+ "resolved": "string | undefined",
101
138
  "references": {}
102
139
  },
103
140
  "required": false,
@@ -106,6 +143,8 @@ export class SearchcraftBaseSearchResult {
106
143
  "tags": [],
107
144
  "text": "The subtitle content."
108
145
  },
146
+ "getter": false,
147
+ "setter": false,
109
148
  "attribute": "subtitle-content",
110
149
  "reflect": false
111
150
  },
@@ -114,7 +153,7 @@ export class SearchcraftBaseSearchResult {
114
153
  "mutable": false,
115
154
  "complexType": {
116
155
  "original": "string | undefined",
117
- "resolved": "string",
156
+ "resolved": "string | undefined",
118
157
  "references": {}
119
158
  },
120
159
  "required": false,
@@ -123,6 +162,8 @@ export class SearchcraftBaseSearchResult {
123
162
  "tags": [],
124
163
  "text": "The body content."
125
164
  },
165
+ "getter": false,
166
+ "setter": false,
126
167
  "attribute": "body-content",
127
168
  "reflect": false
128
169
  },
@@ -131,7 +172,7 @@ export class SearchcraftBaseSearchResult {
131
172
  "mutable": false,
132
173
  "complexType": {
133
174
  "original": "string | undefined",
134
- "resolved": "string",
175
+ "resolved": "string | undefined",
135
176
  "references": {}
136
177
  },
137
178
  "required": false,
@@ -140,6 +181,8 @@ export class SearchcraftBaseSearchResult {
140
181
  "tags": [],
141
182
  "text": "The footer content."
142
183
  },
184
+ "getter": false,
185
+ "setter": false,
143
186
  "attribute": "footer-content",
144
187
  "reflect": false
145
188
  },
@@ -148,7 +191,7 @@ export class SearchcraftBaseSearchResult {
148
191
  "mutable": false,
149
192
  "complexType": {
150
193
  "original": "string | undefined",
151
- "resolved": "string",
194
+ "resolved": "string | undefined",
152
195
  "references": {}
153
196
  },
154
197
  "required": false,
@@ -157,6 +200,8 @@ export class SearchcraftBaseSearchResult {
157
200
  "tags": [],
158
201
  "text": "The label for the button rendered when containerHref is not present."
159
202
  },
203
+ "getter": false,
204
+ "setter": false,
160
205
  "attribute": "button-label",
161
206
  "reflect": false
162
207
  },
@@ -165,7 +210,7 @@ export class SearchcraftBaseSearchResult {
165
210
  "mutable": false,
166
211
  "complexType": {
167
212
  "original": "string | undefined",
168
- "resolved": "string",
213
+ "resolved": "string | undefined",
169
214
  "references": {}
170
215
  },
171
216
  "required": false,
@@ -174,6 +219,8 @@ export class SearchcraftBaseSearchResult {
174
219
  "tags": [],
175
220
  "text": "The link for the button rendered when containerHref is not present."
176
221
  },
222
+ "getter": false,
223
+ "setter": false,
177
224
  "attribute": "button-href",
178
225
  "reflect": false
179
226
  },
@@ -191,6 +238,8 @@ export class SearchcraftBaseSearchResult {
191
238
  "tags": [],
192
239
  "text": "Where to open the link for the button rendered when containerHref is not present."
193
240
  },
241
+ "getter": false,
242
+ "setter": false,
194
243
  "attribute": "button-target",
195
244
  "reflect": false,
196
245
  "defaultValue": "'_blank'"
@@ -200,7 +249,7 @@ export class SearchcraftBaseSearchResult {
200
249
  "mutable": false,
201
250
  "complexType": {
202
251
  "original": "'noreferrer' | 'noopener' | 'nofollow' | undefined",
203
- "resolved": "\"nofollow\" | \"noopener\" | \"noreferrer\"",
252
+ "resolved": "\"nofollow\" | \"noopener\" | \"noreferrer\" | undefined",
204
253
  "references": {}
205
254
  },
206
255
  "required": false,
@@ -209,6 +258,8 @@ export class SearchcraftBaseSearchResult {
209
258
  "tags": [],
210
259
  "text": "The relationship between the current document and the link for the button rendered when containerHref is not present."
211
260
  },
261
+ "getter": false,
262
+ "setter": false,
212
263
  "attribute": "button-rel",
213
264
  "reflect": false
214
265
  },
@@ -217,7 +268,7 @@ export class SearchcraftBaseSearchResult {
217
268
  "mutable": false,
218
269
  "complexType": {
219
270
  "original": "string | undefined",
220
- "resolved": "string",
271
+ "resolved": "string | undefined",
221
272
  "references": {}
222
273
  },
223
274
  "required": false,
@@ -226,6 +277,8 @@ export class SearchcraftBaseSearchResult {
226
277
  "tags": [],
227
278
  "text": "The link for the containing element."
228
279
  },
280
+ "getter": false,
281
+ "setter": false,
229
282
  "attribute": "container-href",
230
283
  "reflect": false
231
284
  },
@@ -243,6 +296,8 @@ export class SearchcraftBaseSearchResult {
243
296
  "tags": [],
244
297
  "text": "Where to open the link for the containing element."
245
298
  },
299
+ "getter": false,
300
+ "setter": false,
246
301
  "attribute": "container-target",
247
302
  "reflect": false,
248
303
  "defaultValue": "'_blank'"
@@ -252,7 +307,7 @@ export class SearchcraftBaseSearchResult {
252
307
  "mutable": false,
253
308
  "complexType": {
254
309
  "original": "'noreferrer' | 'noopener' | 'nofollow' | undefined",
255
- "resolved": "\"nofollow\" | \"noopener\" | \"noreferrer\"",
310
+ "resolved": "\"nofollow\" | \"noopener\" | \"noreferrer\" | undefined",
256
311
  "references": {}
257
312
  },
258
313
  "required": false,
@@ -261,6 +316,8 @@ export class SearchcraftBaseSearchResult {
261
316
  "tags": [],
262
317
  "text": "The relationship between the current document and the link for the containing element."
263
318
  },
319
+ "getter": false,
320
+ "setter": false,
264
321
  "attribute": "container-rel",
265
322
  "reflect": false
266
323
  },
@@ -269,7 +326,7 @@ export class SearchcraftBaseSearchResult {
269
326
  "mutable": false,
270
327
  "complexType": {
271
328
  "original": "string | undefined",
272
- "resolved": "string",
329
+ "resolved": "string | undefined",
273
330
  "references": {}
274
331
  },
275
332
  "required": false,
@@ -278,6 +335,8 @@ export class SearchcraftBaseSearchResult {
278
335
  "tags": [],
279
336
  "text": "The image source."
280
337
  },
338
+ "getter": false,
339
+ "setter": false,
281
340
  "attribute": "image-src",
282
341
  "reflect": false
283
342
  },
@@ -286,7 +345,7 @@ export class SearchcraftBaseSearchResult {
286
345
  "mutable": false,
287
346
  "complexType": {
288
347
  "original": "string | undefined",
289
- "resolved": "string",
348
+ "resolved": "string | undefined",
290
349
  "references": {}
291
350
  },
292
351
  "required": false,
@@ -295,6 +354,8 @@ export class SearchcraftBaseSearchResult {
295
354
  "tags": [],
296
355
  "text": "The image alternative text."
297
356
  },
357
+ "getter": false,
358
+ "setter": false,
298
359
  "attribute": "image-alt",
299
360
  "reflect": false
300
361
  },
@@ -312,15 +373,18 @@ export class SearchcraftBaseSearchResult {
312
373
  "tags": [],
313
374
  "text": "The placement of the image."
314
375
  },
376
+ "getter": false,
377
+ "setter": false,
315
378
  "attribute": "image-placement",
316
- "reflect": false
379
+ "reflect": false,
380
+ "defaultValue": "'right'"
317
381
  },
318
382
  "customStyles": {
319
383
  "type": "string",
320
384
  "mutable": false,
321
385
  "complexType": {
322
386
  "original": "string | undefined",
323
- "resolved": "string",
387
+ "resolved": "string | undefined",
324
388
  "references": {}
325
389
  },
326
390
  "required": false,
@@ -329,6 +393,8 @@ export class SearchcraftBaseSearchResult {
329
393
  "tags": [],
330
394
  "text": "A custom styles object."
331
395
  },
396
+ "getter": false,
397
+ "setter": false,
332
398
  "attribute": "custom-styles",
333
399
  "reflect": false
334
400
  },
@@ -346,6 +412,8 @@ export class SearchcraftBaseSearchResult {
346
412
  "tags": [],
347
413
  "text": "The position in the document. Used with the \"document_clicked\" measure event."
348
414
  },
415
+ "getter": false,
416
+ "setter": false,
349
417
  "attribute": "document-position",
350
418
  "reflect": false,
351
419
  "defaultValue": "0"
@@ -1 +1 @@
1
- {"version":3,"file":"searchcraft-base-search-result.js","sourceRoot":"","sources":["../../../../src/components/searchcraft-base-search-result/searchcraft-base-search-result.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAE7D;;;;GAIG;AAMH,MAAM,OAAO,2BAA2B;;QAkE9B,qBAAgB,GAAG,mBAAmB,CAAC,QAAQ,EAAE,CAAC;QAElD,uBAAkB,GAAG,GAAG,EAAE;;YAChC,MAAM,WAAW,GAAG,IAAI,CAAC,gBAAgB,CAAC,sBAAsB,EAAE,CAAC;YAEnE,IAAI,WAAW,EAAE,CAAC;gBAChB,MAAM,iBAAiB,GAAG,IAAI,CAAC,gBAAgB,CAAC;gBAChD,MAAM,WAAW,GAAG,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC;gBAChD,MAAM,mBAAmB,GACvB,CAAA,MAAA,MAAA,MAAA,IAAI,CAAC,gBAAgB,CAAC,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EAAC,qCAAqC,EAC3C,KAAK,EAAE,MAAM,CAAC,SAAS,IAAI,EAAE,IAE5B,gBAAgB,CACb,CACP,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { useSearchcraftStore } from '@provider/store';\nimport { Component, Fragment, h, Prop } from '@stencil/core';\n\n/**\n * This web component is designed to display detailed information for a single search result.\n * Once a query is submitted, the component formats and presents the result.\n * It is consumed within the `searchcraft-base-search-results` component.\n */\n@Component({\n tag: 'searchcraft-base-search-result',\n styleUrl: 'searchcraft-base-search-result.module.scss',\n shadow: false,\n})\nexport class SearchcraftBaseSearchResult {\n /**\n * The title content.\n */\n @Prop() titleContent: string | undefined;\n /**\n * The subtitle content.\n */\n @Prop() subtitleContent: string | undefined;\n /**\n * The body content.\n */\n @Prop() bodyContent: string | undefined;\n /**\n * The footer content.\n */\n @Prop() footerContent: string | undefined;\n /**\n * The label for the button rendered when containerHref is not present.\n */\n @Prop() buttonLabel: string | undefined;\n /**\n * The link for the button rendered when containerHref is not present.\n */\n @Prop() buttonHref: string | undefined;\n /**\n * Where to open the link for the button rendered when containerHref is not present.\n */\n @Prop() buttonTarget: '_blank' | '_self' | '_top' | '_parent' = '_blank';\n /**\n * The relationship between the current document and the link for the button rendered when containerHref is not present.\n */\n @Prop() buttonRel: 'noreferrer' | 'noopener' | 'nofollow' | undefined;\n /**\n * The link for the containing element.\n */\n @Prop() containerHref: string | undefined;\n /**\n * Where to open the link for the containing element.\n */\n @Prop() containerTarget: '_blank' | '_self' | '_top' | '_parent' = '_blank';\n /**\n * The relationship between the current document and the link for the containing element.\n */\n @Prop() containerRel: 'noreferrer' | 'noopener' | 'nofollow' | undefined;\n /**\n * The image source.\n */\n @Prop() imageSrc: string | undefined;\n /**\n * The image alternative text.\n */\n @Prop() imageAlt: string | undefined;\n /**\n * The placement of the image.\n */\n @Prop() imagePlacement: 'left' | 'right';\n /**\n * A custom styles object.\n */\n @Prop() customStyles: string | undefined;\n /**\n * The position in the document. Used with the \"document_clicked\" measure event.\n */\n @Prop() documentPosition = 0;\n\n private searchcraftStore = useSearchcraftStore.getState();\n\n private recordMeasureEvent = () => {\n const searchcraft = this.searchcraftStore.getSearchcraftInstance();\n\n if (searchcraft) {\n const document_position = this.documentPosition;\n const search_term = this.searchcraftStore.query;\n const number_of_documents =\n this.searchcraftStore.searchResults?.data?.hits?.length || 0;\n\n searchcraft.sendMeasureEvent('document_clicked', {\n document_position,\n number_of_documents,\n search_term,\n });\n }\n };\n\n private parseStyles = (): Record<string, { [key: string]: string }> => {\n if (this.customStyles) {\n try {\n return JSON.parse(this.customStyles);\n } catch (error) {\n console.error('Error parsing custom styles:', error);\n return {};\n }\n }\n return {};\n };\n\n render() {\n const styles = this.parseStyles();\n const imageContainer = this.imageSrc && (\n <img\n alt={this.imageAlt}\n class='searchcraft-search-result-image'\n src={this.imageSrc}\n style={styles.image || {}}\n />\n );\n\n const contentContainer = (\n <Fragment>\n {this.imageSrc && this.imagePlacement === 'left' && imageContainer}\n <div class='searchcraft-base-search-result-content-container'>\n {this.titleContent && (\n <h2\n class='searchcraft-base-search-result-title'\n style={styles.title || {}}\n >\n {this.titleContent}\n </h2>\n )}\n {this.subtitleContent && (\n <h3\n class='searchcraft-base-search-result-subtitle'\n style={styles.subtitle || {}}\n >\n {this.subtitleContent}\n </h3>\n )}\n {this.bodyContent && (\n <p\n class='searchcraft-base-search-result-body-content'\n style={styles.primaryContent || {}}\n >\n {this.bodyContent}\n </p>\n )}\n\n {this.footerContent && (\n <p\n class='searchcraft-base-search-result-footer-content'\n style={styles.secondaryContent || {}}\n >\n {this.footerContent}\n </p>\n )}\n {this.buttonHref && !this.containerHref && this.buttonLabel && (\n <a\n class='searchcraft-search-result-button'\n href={this.buttonHref}\n style={styles.button || {}}\n target={this.buttonTarget}\n rel={this.buttonRel}\n >\n {this.buttonLabel}\n </a>\n )}\n </div>\n {this.imageSrc && this.imagePlacement === 'right' && imageContainer}\n </Fragment>\n );\n\n /** Render as an anchor tag if the containerHref prop is present. */\n if (this.containerHref) {\n return (\n <a\n class='searchcraft-search-result-container'\n onClick={this.recordMeasureEvent}\n href={this.containerHref}\n rel={this.containerRel}\n style={styles.container || {}}\n tabindex='0'\n target={this.containerTarget}\n >\n {contentContainer}\n </a>\n );\n }\n\n /** Render as a div if no href prop. */\n return (\n <div\n class='searchcraft-search-result-container'\n style={styles.container || {}}\n >\n {contentContainer}\n </div>\n );\n }\n}\n"]}
1
+ {"version":3,"file":"searchcraft-base-search-result.js","sourceRoot":"","sources":["../../../../src/components/searchcraft-base-search-result/searchcraft-base-search-result.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAE7D;;;;GAIG;AAKH,MAAM,OAAO,2BAA2B;IACtC;;OAEG;IACK,YAAY,CAAqB;IACzC;;OAEG;IACK,eAAe,CAAqB;IAC5C;;OAEG;IACK,WAAW,CAAqB;IACxC;;OAEG;IACK,aAAa,CAAqB;IAC1C;;OAEG;IACK,WAAW,CAAqB;IACxC;;OAEG;IACK,UAAU,CAAqB;IACvC;;OAEG;IACK,YAAY,GAA4C,QAAQ,CAAC;IACzE;;OAEG;IACK,SAAS,CAAqD;IACtE;;OAEG;IACK,aAAa,CAAqB;IAC1C;;OAEG;IACK,eAAe,GAA4C,QAAQ,CAAC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YACL,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,cAAc,KAAK,OAAO,IAAI,cAAc,CAC1D,CACZ,CAAC;QAEF,oEAAoE;QACpE,IAAI,IAAI,CAAC,aAAa,EAAE,CAAC;YACvB,OAAO,CACL,SACE,KAAK,EAAC,qCAAqC,EAC3C,OAAO,EAAE,IAAI,CAAC,kBAAkB,EAChC,IAAI,EAAE,IAAI,CAAC,aAAa,EACxB,GAAG,EAAE,IAAI,CAAC,YAAY,EACtB,KAAK,EAAE,MAAM,CAAC,SAAS,IAAI,EAAE,EAC7B,QAAQ,EAAC,GAAG,EACZ,MAAM,EAAE,IAAI,CAAC,eAAe,IAE3B,gBAAgB,CACf,CACL,CAAC;QACJ,CAAC;QAED,uCAAuC;QACvC,OAAO,CACL,WACE,KAAK,EAAC,qCAAqC,EAC3C,KAAK,EAAE,MAAM,CAAC,SAAS,IAAI,EAAE,IAE5B,gBAAgB,CACb,CACP,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { useSearchcraftStore } from '@provider/store';\nimport { Component, Fragment, h, Prop } from '@stencil/core';\n\n/**\n * This web component is designed to display detailed information for a single search result.\n * Once a query is submitted, the component formats and presents the result.\n * It is consumed within the `searchcraft-base-search-results` component.\n */\n@Component({\n tag: 'searchcraft-base-search-result',\n shadow: false,\n})\nexport class SearchcraftBaseSearchResult {\n /**\n * The title content.\n */\n @Prop() titleContent: string | undefined;\n /**\n * The subtitle content.\n */\n @Prop() subtitleContent: string | undefined;\n /**\n * The body content.\n */\n @Prop() bodyContent: string | undefined;\n /**\n * The footer content.\n */\n @Prop() footerContent: string | undefined;\n /**\n * The label for the button rendered when containerHref is not present.\n */\n @Prop() buttonLabel: string | undefined;\n /**\n * The link for the button rendered when containerHref is not present.\n */\n @Prop() buttonHref: string | undefined;\n /**\n * Where to open the link for the button rendered when containerHref is not present.\n */\n @Prop() buttonTarget: '_blank' | '_self' | '_top' | '_parent' = '_blank';\n /**\n * The relationship between the current document and the link for the button rendered when containerHref is not present.\n */\n @Prop() buttonRel: 'noreferrer' | 'noopener' | 'nofollow' | undefined;\n /**\n * The link for the containing element.\n */\n @Prop() containerHref: string | undefined;\n /**\n * Where to open the link for the containing element.\n */\n @Prop() containerTarget: '_blank' | '_self' | '_top' | '_parent' = '_blank';\n /**\n * The relationship between the current document and the link for the containing element.\n */\n @Prop() containerRel: 'noreferrer' | 'noopener' | 'nofollow' | undefined;\n /**\n * The image source.\n */\n @Prop() imageSrc: string | undefined;\n /**\n * The image alternative text.\n */\n @Prop() imageAlt: string | undefined;\n /**\n * The placement of the image.\n */\n @Prop() imagePlacement: 'left' | 'right' = 'right';\n /**\n * A custom styles object.\n */\n @Prop() customStyles: string | undefined;\n /**\n * The position in the document. Used with the \"document_clicked\" measure event.\n */\n @Prop() documentPosition = 0;\n\n private searchcraftStore = useSearchcraftStore.getState();\n\n private recordMeasureEvent = () => {\n const searchcraft = this.searchcraftStore.getSearchcraftInstance();\n\n if (searchcraft) {\n const document_position = this.documentPosition;\n const search_term = this.searchcraftStore.query;\n const number_of_documents =\n this.searchcraftStore.searchResults?.data?.hits?.length || 0;\n\n searchcraft.sendMeasureEvent('document_clicked', {\n document_position,\n number_of_documents,\n search_term,\n });\n }\n };\n\n private parseStyles = (): Record<string, { [key: string]: string }> => {\n if (this.customStyles) {\n try {\n return JSON.parse(this.customStyles);\n } catch (error) {\n console.error('Error parsing custom styles:', error);\n return {};\n }\n }\n return {};\n };\n\n render() {\n const styles = this.parseStyles();\n const imageContainer = this.imageSrc && (\n <img\n alt={this.imageAlt}\n class='searchcraft-search-result-image'\n src={this.imageSrc}\n style={styles.image || {}}\n />\n );\n\n const contentContainer = (\n <Fragment>\n {this.imageSrc && this.imagePlacement === 'left' && imageContainer}\n <div class='searchcraft-base-search-result-content-container'>\n {this.titleContent && (\n <h2\n class='searchcraft-base-search-result-title'\n style={styles.title || {}}\n >\n {this.titleContent}\n </h2>\n )}\n {this.subtitleContent && (\n <h3\n class='searchcraft-base-search-result-subtitle'\n style={styles.subtitle || {}}\n >\n {this.subtitleContent}\n </h3>\n )}\n {this.bodyContent && (\n <p\n class='searchcraft-base-search-result-body-content'\n style={styles.primaryContent || {}}\n >\n {this.bodyContent}\n </p>\n )}\n\n {this.footerContent && (\n <p\n class='searchcraft-base-search-result-footer-content'\n style={styles.secondaryContent || {}}\n >\n {this.footerContent}\n </p>\n )}\n {this.buttonHref && !this.containerHref && this.buttonLabel && (\n <a\n class='searchcraft-search-result-button'\n href={this.buttonHref}\n style={styles.button || {}}\n target={this.buttonTarget}\n rel={this.buttonRel}\n >\n {this.buttonLabel}\n </a>\n )}\n </div>\n {this.imageSrc && this.imagePlacement === 'right' && imageContainer}\n </Fragment>\n );\n\n /** Render as an anchor tag if the containerHref prop is present. */\n if (this.containerHref) {\n return (\n <a\n class='searchcraft-search-result-container'\n onClick={this.recordMeasureEvent}\n href={this.containerHref}\n rel={this.containerRel}\n style={styles.container || {}}\n tabindex='0'\n target={this.containerTarget}\n >\n {contentContainer}\n </a>\n );\n }\n\n /** Render as a div if no href prop. */\n return (\n <div\n class='searchcraft-search-result-container'\n style={styles.container || {}}\n >\n {contentContainer}\n </div>\n );\n }\n}\n"]}