@coveo/atomic 3.49.0 → 3.51.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 (231) hide show
  1. package/custom-elements.json +2257 -369
  2. package/dist/atomic/_atomic.esm.js +1 -1
  3. package/dist/atomic/atomic.esm.js.map +1 -1
  4. package/dist/atomic/components/_index.d.ts +0 -10
  5. package/dist/atomic/components/_index.js +2 -8
  6. package/dist/atomic/components/atomic-insight-result-action.js +123 -6
  7. package/dist/atomic/components/atomic-insight-result-action.js.map +1 -1
  8. package/dist/atomic/components/atomic-insight-result-children-template.js +1 -2
  9. package/dist/atomic/components/atomic-insight-result-children-template.js.map +1 -1
  10. package/dist/atomic/components/atomic-insight-timeframe-facet.js +97 -7
  11. package/dist/atomic/components/atomic-insight-timeframe-facet.js.map +1 -1
  12. package/dist/atomic/components/atomic-stencil-facet-date-input.js +3 -3
  13. package/dist/atomic/components/components/commerce/atomic-commerce-search-box/atomic-commerce-search-box.js +4 -4
  14. package/dist/atomic/components/components/common/generated-answer/render-feedback-and-copy-buttons.js +4 -3
  15. package/dist/atomic/components/components/insight/atomic-insight-generated-answer/atomic-insight-generated-answer.js +444 -0
  16. package/dist/atomic/components/components/insight/atomic-insight-generated-answer/atomic-insight-generated-answer.tw.css.js +2 -0
  17. package/dist/atomic/components/components/insight/atomic-insight-result-attach-to-case-action/atomic-insight-result-attach-to-case-action.js +122 -0
  18. package/dist/atomic/components/components/insight/atomic-insight-result-children/atomic-insight-result-children.js +4 -4
  19. package/dist/atomic/components/components/insight/index.js +2 -0
  20. package/dist/atomic/components/components/insight/lazy-index.js +2 -0
  21. package/dist/atomic/components/components/ipx/atomic-ipx-button/atomic-ipx-button.js +1 -1
  22. package/dist/atomic/components/components/ipx/atomic-ipx-recs-list/atomic-ipx-recs-list.js +483 -0
  23. package/dist/atomic/components/components/ipx/atomic-ipx-refine-modal/atomic-ipx-refine-modal.js +202 -0
  24. package/dist/atomic/components/components/ipx/atomic-ipx-refine-toggle/atomic-ipx-refine-toggle.js +123 -0
  25. package/dist/atomic/components/components/ipx/index.js +3 -0
  26. package/dist/atomic/components/components/ipx/lazy-index.js +3 -0
  27. package/dist/atomic/components/components/recommendations/atomic-recs-result/atomic-recs-result.js +1 -0
  28. package/dist/atomic/components/components/search/atomic-generated-answer/atomic-generated-answer.js +7 -1
  29. package/dist/atomic/components/components/search/atomic-refine-modal/atomic-refine-modal.js +2 -1
  30. package/dist/atomic/components/components/search/atomic-search-box/atomic-search-box.js +4 -4
  31. package/dist/atomic/components/global/environment.js +1 -1
  32. package/dist/atomic/components/index.js.map +1 -1
  33. package/dist/atomic/components/props-utils.js +1402 -2
  34. package/dist/atomic/components/props-utils.js.map +1 -1
  35. package/dist/atomic/components/utils/custom-element-tags.js +7 -0
  36. package/dist/atomic/components/utils/tailwind.global.tw.css.js +4 -4
  37. package/dist/atomic/index.esm.js +1 -1
  38. package/dist/atomic/p-1df0744f.entry.js +9 -0
  39. package/dist/atomic/p-1df0744f.entry.js.map +1 -0
  40. package/dist/atomic/{p-4a32511f.js → p-2045a1b1.js} +2 -2
  41. package/dist/atomic/p-500bf5c4.entry.js +2 -0
  42. package/dist/atomic/{p-4117289b.entry.js.map → p-500bf5c4.entry.js.map} +1 -1
  43. package/dist/atomic/p-5226a938.js +3 -0
  44. package/dist/atomic/p-5226a938.js.map +1 -0
  45. package/dist/atomic/{p-b4cfedf1.js → p-720863c3.js} +2 -2
  46. package/dist/atomic/p-81336626.entry.js +2 -0
  47. package/dist/atomic/p-81336626.entry.js.map +1 -0
  48. package/dist/atomic/p-aad3b4ec.js +3 -0
  49. package/dist/atomic/p-aad3b4ec.js.map +1 -0
  50. package/dist/atomic/{p-0698ccf1.entry.js → p-b5af331b.entry.js} +2 -2
  51. package/dist/atomic/{p-677f9c40.js → p-b7209471.js} +2 -2
  52. package/dist/cjs/_index.cjs.js +2 -2
  53. package/dist/cjs/_loader.cjs.js +2 -2
  54. package/dist/cjs/atomic-insight-result-action.cjs.entry.js +22 -9
  55. package/dist/cjs/atomic-insight-result-action.cjs.entry.js.map +1 -1
  56. package/dist/cjs/atomic-insight-result-children-template.cjs.entry.js +6 -7
  57. package/dist/cjs/atomic-insight-result-children-template.cjs.entry.js.map +1 -1
  58. package/dist/cjs/atomic-insight-timeframe-facet.cjs.entry.js +106 -16
  59. package/dist/cjs/atomic-insight-timeframe-facet.cjs.entry.js.map +1 -1
  60. package/dist/cjs/atomic-stencil-facet-date-input.cjs.entry.js +5 -5
  61. package/dist/cjs/atomic.cjs.js +2 -2
  62. package/dist/cjs/{index-3532822e.js → index-122375df.js} +4 -58
  63. package/dist/cjs/index-122375df.js.map +1 -0
  64. package/dist/cjs/{initialization-utils-51a423fe.js → initialization-utils-c2821271.js} +2 -2
  65. package/dist/cjs/{initialization-utils-51a423fe.js.map → initialization-utils-c2821271.js.map} +1 -1
  66. package/dist/cjs/{utils-e845f262.js → props-utils-e4f29f1e.js} +54 -21
  67. package/dist/cjs/props-utils-e4f29f1e.js.map +1 -0
  68. package/dist/cjs/{stencil-button-f39da03e.js → stencil-button-bf22eea4.js} +2 -2
  69. package/dist/cjs/{stencil-button-f39da03e.js.map → stencil-button-bf22eea4.js.map} +1 -1
  70. package/dist/cjs/{stencil-result-template-decorators-1f099c15.js → stencil-result-template-decorators-96954751.js} +2 -2
  71. package/dist/cjs/{stencil-result-template-decorators-1f099c15.js.map → stencil-result-template-decorators-96954751.js.map} +1 -1
  72. package/dist/cjs/version.cjs.js +2 -2
  73. package/dist/esm/_index.js +3 -3
  74. package/dist/esm/_loader.js +3 -3
  75. package/dist/esm/atomic-insight-result-action.entry.js +20 -7
  76. package/dist/esm/atomic-insight-result-action.entry.js.map +1 -1
  77. package/dist/esm/atomic-insight-result-children-template.entry.js +2 -3
  78. package/dist/esm/atomic-insight-result-children-template.entry.js.map +1 -1
  79. package/dist/esm/atomic-insight-timeframe-facet.entry.js +100 -10
  80. package/dist/esm/atomic-insight-timeframe-facet.entry.js.map +1 -1
  81. package/dist/esm/atomic-stencil-facet-date-input.entry.js +5 -5
  82. package/dist/esm/atomic.js +3 -3
  83. package/dist/esm/{index-3eb0b28e.js → index-4d679e44.js} +5 -58
  84. package/dist/{cjs/index-3532822e.js.map → esm/index-4d679e44.js.map} +1 -1
  85. package/dist/esm/{initialization-utils-82d28c63.js → initialization-utils-9ff399ff.js} +2 -2
  86. package/dist/esm/{initialization-utils-82d28c63.js.map → initialization-utils-9ff399ff.js.map} +1 -1
  87. package/dist/esm/{utils-b5bab369.js → props-utils-76043c82.js} +54 -18
  88. package/dist/esm/props-utils-76043c82.js.map +1 -0
  89. package/dist/esm/{stencil-button-c25899df.js → stencil-button-28de709c.js} +2 -2
  90. package/dist/esm/{stencil-button-c25899df.js.map → stencil-button-28de709c.js.map} +1 -1
  91. package/dist/esm/{stencil-result-template-decorators-9cbe1e1c.js → stencil-result-template-decorators-4c2e5132.js} +2 -2
  92. package/dist/esm/{stencil-result-template-decorators-9cbe1e1c.js.map → stencil-result-template-decorators-4c2e5132.js.map} +1 -1
  93. package/dist/esm/version.js +2 -2
  94. package/dist/types/components/common/generated-answer/answerContent/answer-content.d.ts +49 -0
  95. package/dist/types/components/common/generated-answer/generated-answer-thread-item/generated-answer-thread-item.d.ts +49 -0
  96. package/dist/types/components/common/generated-answer/render-feedback-and-copy-buttons.d.ts +8 -2
  97. package/dist/types/components/common/item-list/table-layout.d.ts +1 -1
  98. package/dist/types/components/insight/atomic-insight-generated-answer/atomic-insight-generated-answer.d.ts +54 -35
  99. package/dist/types/components/insight/atomic-insight-generated-answer/atomic-insight-generated-answer.tw.css.d.ts +2 -0
  100. package/dist/types/components/insight/atomic-insight-result-attach-to-case-action/atomic-insight-result-attach-to-case-action.d.ts +25 -20
  101. package/dist/types/components/insight/index.d.ts +2 -0
  102. package/dist/types/components/ipx/atomic-ipx-button/atomic-ipx-button.d.ts +1 -1
  103. package/dist/types/components/ipx/atomic-ipx-recs-list/{atomic-recs-list/atomic-ipx-recs-list.d.ts → atomic-ipx-recs-list.d.ts} +43 -21
  104. package/dist/types/components/ipx/atomic-ipx-refine-modal/atomic-ipx-refine-modal.d.ts +62 -15
  105. package/dist/types/components/ipx/atomic-ipx-refine-toggle/atomic-ipx-refine-toggle.d.ts +26 -11
  106. package/dist/types/components/ipx/index.d.ts +3 -0
  107. package/dist/types/components/recommendations/atomic-recs-result/atomic-recs-result.d.ts +1 -0
  108. package/dist/types/components/search/atomic-refine-modal/atomic-refine-modal.d.ts +4 -3
  109. package/dist/types/components.d.ts +0 -249
  110. package/docs/atomic-docs.json +1 -26
  111. package/package.json +4 -4
  112. package/dist/atomic/components/arrow-top-rounded.js +0 -7
  113. package/dist/atomic/components/arrow-top-rounded.js.map +0 -1
  114. package/dist/atomic/components/atomic-insight-generated-answer.d.ts +0 -11
  115. package/dist/atomic/components/atomic-insight-generated-answer.js +0 -3264
  116. package/dist/atomic/components/atomic-insight-generated-answer.js.map +0 -1
  117. package/dist/atomic/components/atomic-insight-result-attach-to-case-action.d.ts +0 -11
  118. package/dist/atomic/components/atomic-insight-result-attach-to-case-action.js +0 -102
  119. package/dist/atomic/components/atomic-insight-result-attach-to-case-action.js.map +0 -1
  120. package/dist/atomic/components/atomic-ipx-recs-list.d.ts +0 -11
  121. package/dist/atomic/components/atomic-ipx-recs-list.js +0 -631
  122. package/dist/atomic/components/atomic-ipx-recs-list.js.map +0 -1
  123. package/dist/atomic/components/atomic-ipx-refine-modal.d.ts +0 -11
  124. package/dist/atomic/components/atomic-ipx-refine-modal.js +0 -8
  125. package/dist/atomic/components/atomic-ipx-refine-modal.js.map +0 -1
  126. package/dist/atomic/components/atomic-ipx-refine-modal2.js +0 -162
  127. package/dist/atomic/components/atomic-ipx-refine-modal2.js.map +0 -1
  128. package/dist/atomic/components/atomic-ipx-refine-toggle.d.ts +0 -11
  129. package/dist/atomic/components/atomic-ipx-refine-toggle.js +0 -121
  130. package/dist/atomic/components/atomic-ipx-refine-toggle.js.map +0 -1
  131. package/dist/atomic/components/attach.js +0 -115
  132. package/dist/atomic/components/attach.js.map +0 -1
  133. package/dist/atomic/components/components/common/layout/display-options.js +0 -28
  134. package/dist/atomic/components/popover-type.js +0 -12
  135. package/dist/atomic/components/popover-type.js.map +0 -1
  136. package/dist/atomic/components/stencil-heading.js +0 -169
  137. package/dist/atomic/components/stencil-heading.js.map +0 -1
  138. package/dist/atomic/components/stencil-iconButton.js +0 -16
  139. package/dist/atomic/components/stencil-iconButton.js.map +0 -1
  140. package/dist/atomic/components/store.js +0 -13
  141. package/dist/atomic/components/store.js.map +0 -1
  142. package/dist/atomic/components/utils.js +0 -1421
  143. package/dist/atomic/components/utils.js.map +0 -1
  144. package/dist/atomic/p-2c08a419.entry.js +0 -2
  145. package/dist/atomic/p-2c08a419.entry.js.map +0 -1
  146. package/dist/atomic/p-4117289b.entry.js +0 -2
  147. package/dist/atomic/p-52d14165.entry.js +0 -2
  148. package/dist/atomic/p-52d14165.entry.js.map +0 -1
  149. package/dist/atomic/p-578d761c.js +0 -2
  150. package/dist/atomic/p-578d761c.js.map +0 -1
  151. package/dist/atomic/p-64f83898.entry.js +0 -2
  152. package/dist/atomic/p-64f83898.entry.js.map +0 -1
  153. package/dist/atomic/p-70cc18a1.js +0 -2
  154. package/dist/atomic/p-70cc18a1.js.map +0 -1
  155. package/dist/atomic/p-9c5ec170.js +0 -2
  156. package/dist/atomic/p-9c5ec170.js.map +0 -1
  157. package/dist/atomic/p-9dfe5ab1.js +0 -2
  158. package/dist/atomic/p-9dfe5ab1.js.map +0 -1
  159. package/dist/atomic/p-a33748a9.js +0 -2
  160. package/dist/atomic/p-a33748a9.js.map +0 -1
  161. package/dist/atomic/p-b09433bb.js +0 -3
  162. package/dist/atomic/p-b09433bb.js.map +0 -1
  163. package/dist/atomic/p-c8452548.entry.js +0 -2
  164. package/dist/atomic/p-c8452548.entry.js.map +0 -1
  165. package/dist/atomic/p-c95ac794.entry.js +0 -2
  166. package/dist/atomic/p-c95ac794.entry.js.map +0 -1
  167. package/dist/atomic/p-d75a4630.js +0 -2
  168. package/dist/atomic/p-d75a4630.js.map +0 -1
  169. package/dist/atomic/p-d8230482.entry.js +0 -9
  170. package/dist/atomic/p-d8230482.entry.js.map +0 -1
  171. package/dist/atomic/p-e94ba0e1.entry.js +0 -2
  172. package/dist/atomic/p-e94ba0e1.entry.js.map +0 -1
  173. package/dist/atomic/p-ec1c5f46.js +0 -3
  174. package/dist/atomic/p-ec1c5f46.js.map +0 -1
  175. package/dist/atomic/p-f321aab0.js +0 -2
  176. package/dist/atomic/p-f321aab0.js.map +0 -1
  177. package/dist/cjs/arrow-top-rounded-885250ea.js +0 -10
  178. package/dist/cjs/arrow-top-rounded-885250ea.js.map +0 -1
  179. package/dist/cjs/atomic-insight-generated-answer.cjs.entry.js +0 -3238
  180. package/dist/cjs/atomic-insight-generated-answer.cjs.entry.js.map +0 -1
  181. package/dist/cjs/atomic-insight-result-attach-to-case-action.cjs.entry.js +0 -90
  182. package/dist/cjs/atomic-insight-result-attach-to-case-action.cjs.entry.js.map +0 -1
  183. package/dist/cjs/atomic-ipx-recs-list.cjs.entry.js +0 -600
  184. package/dist/cjs/atomic-ipx-recs-list.cjs.entry.js.map +0 -1
  185. package/dist/cjs/atomic-ipx-refine-modal.cjs.entry.js +0 -143
  186. package/dist/cjs/atomic-ipx-refine-modal.cjs.entry.js.map +0 -1
  187. package/dist/cjs/atomic-ipx-refine-toggle.cjs.entry.js +0 -99
  188. package/dist/cjs/atomic-ipx-refine-toggle.cjs.entry.js.map +0 -1
  189. package/dist/cjs/attach-19283bec.js +0 -10
  190. package/dist/cjs/attach-19283bec.js.map +0 -1
  191. package/dist/cjs/popover-type-22f285e1.js +0 -16
  192. package/dist/cjs/popover-type-22f285e1.js.map +0 -1
  193. package/dist/cjs/props-utils-bc5feb04.js +0 -59
  194. package/dist/cjs/props-utils-bc5feb04.js.map +0 -1
  195. package/dist/cjs/stencil-heading-ecec9ab3.js +0 -174
  196. package/dist/cjs/stencil-heading-ecec9ab3.js.map +0 -1
  197. package/dist/cjs/stencil-iconButton-f8b9fda0.js +0 -18
  198. package/dist/cjs/stencil-iconButton-f8b9fda0.js.map +0 -1
  199. package/dist/cjs/store-70fff5e6.js +0 -16
  200. package/dist/cjs/store-70fff5e6.js.map +0 -1
  201. package/dist/cjs/utils-e845f262.js.map +0 -1
  202. package/dist/esm/arrow-top-rounded-745b84a6.js +0 -7
  203. package/dist/esm/arrow-top-rounded-745b84a6.js.map +0 -1
  204. package/dist/esm/atomic-insight-generated-answer.entry.js +0 -3234
  205. package/dist/esm/atomic-insight-generated-answer.entry.js.map +0 -1
  206. package/dist/esm/atomic-insight-result-attach-to-case-action.entry.js +0 -86
  207. package/dist/esm/atomic-insight-result-attach-to-case-action.entry.js.map +0 -1
  208. package/dist/esm/atomic-ipx-recs-list.entry.js +0 -596
  209. package/dist/esm/atomic-ipx-recs-list.entry.js.map +0 -1
  210. package/dist/esm/atomic-ipx-refine-modal.entry.js +0 -139
  211. package/dist/esm/atomic-ipx-refine-modal.entry.js.map +0 -1
  212. package/dist/esm/atomic-ipx-refine-toggle.entry.js +0 -95
  213. package/dist/esm/atomic-ipx-refine-toggle.entry.js.map +0 -1
  214. package/dist/esm/attach-81bb8872.js +0 -8
  215. package/dist/esm/attach-81bb8872.js.map +0 -1
  216. package/dist/esm/index-3eb0b28e.js.map +0 -1
  217. package/dist/esm/popover-type-c85677ef.js +0 -12
  218. package/dist/esm/popover-type-c85677ef.js.map +0 -1
  219. package/dist/esm/props-utils-d343133b.js +0 -57
  220. package/dist/esm/props-utils-d343133b.js.map +0 -1
  221. package/dist/esm/stencil-heading-98a5f23f.js +0 -169
  222. package/dist/esm/stencil-heading-98a5f23f.js.map +0 -1
  223. package/dist/esm/stencil-iconButton-ed5804d3.js +0 -16
  224. package/dist/esm/stencil-iconButton-ed5804d3.js.map +0 -1
  225. package/dist/esm/store-50d170c8.js +0 -13
  226. package/dist/esm/store-50d170c8.js.map +0 -1
  227. package/dist/esm/utils-b5bab369.js.map +0 -1
  228. /package/dist/atomic/{p-4a32511f.js.map → p-2045a1b1.js.map} +0 -0
  229. /package/dist/atomic/{p-b4cfedf1.js.map → p-720863c3.js.map} +0 -0
  230. /package/dist/atomic/{p-0698ccf1.entry.js.map → p-b5af331b.entry.js.map} +0 -0
  231. /package/dist/atomic/{p-677f9c40.js.map → p-b7209471.js.map} +0 -0
@@ -1 +1 @@
1
- {"file":"atomic-insight-result-action.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAM,4BAA4B,GAAG,0wnEAA0wnE,CAAC;AAChznE,wCAAe,4BAA4B;;;;;;;;;;;;ACuB3C,IAAY,OAMX;AAND,WAAY,OAAO;IACjB,8CAAmC,CAAA;IACnC,wCAA6B,CAAA;IAC7B,kCAAuB,CAAA;IACvB,oCAAyB,CAAA;IACzB,sCAA2B,CAAA;AAC7B,CAAC,EANW,OAAO,KAAP,OAAO,QAMlB;MASYA,2BAAyB;;;;;;;;QAwBN,SAAI,GAAG,EAAE,CAAC;;;;QAKV,YAAO,GAAG,EAAE,CAAC;;;;QAKb,mBAAc,GAAG,EAAE,CAAC;;;;QAKpB,WAAM,GAAqB,EAAE,CAAC;;oBAfvB,EAAE;uBAKC,EAAE;8BAKK,EAAE;sBAKQ,EAAE;;IAIpD,UAAU;QACf,IAAI,CAAC,OAAO,GAAG,2BAA2B,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;KAClE;IAEO,OAAO;QACb,IAAI,IAAI,CAAC,cAAc,EAAE;YACvB,MAAM,eAAe,GAAG,IAAI,CAAC,OAAO,CAAC;YACrC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,cAAc,CAAC;YACnC,UAAU,CAAC;gBACT,IAAI,CAAC,OAAO,GAAG,eAAe,CAAC;aAChC,EAAE,IAAI,CAAC,CAAC;SACV;QAED,QAAQ,IAAI,CAAC,MAAM;YACjB,KAAK,OAAO,CAAC,eAAe;gBAC1B,IAAI,CAAC,QAAQ,CAAC,MAA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,IAAI,CAAC,OAAO,EAAE,EACpB,KAAK,EAAE,IAAI,CAAC,OAAO,EACnB,OAAO,EAAE,MAAM,IAAI,CAAC,OAAO,EAAE,GAC7B,EACF;KACH;;;;;;;;;AA1G4B;IAA5B,kBAAkB,EAAE;6DAAmC;AAC/B;IAAxB,aAAa,EAAE;2DAAyB;;;;;;;;;;;;;;;;;;;;","names":["AtomicInsightResultAction"],"sources":["src/components/insight/atomic-insight-result-action/atomic-insight-result-action.pcss?tag=atomic-insight-result-action","src/components/insight/atomic-insight-result-action/atomic-insight-result-action.tsx"],"sourcesContent":["@import '../../../global/global.pcss';\n\n:host {\n &::part(result-action-button) {\n @apply flex items-center justify-center;\n @apply h-8 w-8;\n }\n}\n","import {Result} from '@coveo/headless';\nimport {\n InsightAnalyticsActionCreators,\n loadInsightAnalyticsActions,\n} from '@coveo/headless/insight';\nimport {Component, Event, EventEmitter, Prop, State, h} from '@stencil/core';\nimport AttachIcon from '../../../images/attach.svg';\nimport CopyIcon from '../../../images/copy-dark.svg';\nimport EmailIcon from '../../../images/email.svg';\nimport QuickviewIcon from '../../../images/preview.svg';\nimport FeedIcon from '../../../images/share-post.svg';\nimport {\n InitializableComponent,\n InitializeBindings,\n} from '../../../utils/initialization-utils';\nimport {IconButton} from '../../common/stencil-iconButton';\nimport {ResultContext} from '@/src/components/search/result-template-component-utils/context/stencil-result-template-decorators';\nimport {InsightBindings} from '../atomic-insight-interface/atomic-insight-interface';\n\nexport interface InsightResultActionClickedEvent {\n action: string;\n result: Result;\n}\n\nexport enum Actions {\n CopyToClipboard = 'copyToClipboard',\n AttachToCase = 'attachToCase',\n Quickview = 'quickview',\n PostToFeed = 'postToFeed',\n SendAsEmail = 'sendAsEmail',\n}\n\n/**\n * @internal\n */\n@Component({\n tag: 'atomic-insight-result-action',\n styleUrl: 'atomic-insight-result-action.pcss',\n})\nexport class AtomicInsightResultAction\n implements InitializableComponent<InsightBindings>\n{\n @InitializeBindings() public bindings!: InsightBindings;\n @ResultContext() private result!: Result;\n @State() public error!: Error;\n\n /**\n * @migration Stencil's @Event() decorator defaults to: bubbles=true, composed=true, cancelable=true.\n * Native CustomEvent defaults to: bubbles=false, composed=false, cancelable=false.\n * When migrating to Lit, explicitly set all three options to preserve behavior:\n * `new CustomEvent('atomicInsightResultActionClicked', { bubbles: true, composed: true, cancelable: true, detail: ... })`\n */\n @Event({\n eventName: 'atomicInsightResultActionClicked',\n composed: true,\n cancelable: true,\n bubbles: true,\n })\n private actionClicked!: EventEmitter<InsightResultActionClickedEvent>;\n\n /**\n * Specify the result action icon to display.\n */\n @Prop({mutable: true}) public icon = '';\n\n /**\n * The text tooltip to show on the result action icon.\n */\n @Prop({mutable: true}) public tooltip = '';\n\n /**\n * The text tooltip to show on the result action icon for some time after clicking the button.\n */\n @Prop({mutable: true}) public tooltipOnClick = '';\n\n /**\n * The type of action to perform when the result action is clicked. This will be sent along the event fired when the button is clicked.\n */\n @Prop({mutable: true}) public action: Actions | string = '';\n\n private actions!: InsightAnalyticsActionCreators;\n\n public initialize() {\n this.actions = loadInsightAnalyticsActions(this.bindings.engine);\n }\n\n private onClick() {\n if (this.tooltipOnClick) {\n const originalTooltip = this.tooltip;\n this.tooltip = this.tooltipOnClick;\n setTimeout(() => {\n this.tooltip = originalTooltip;\n }, 1000);\n }\n\n switch (this.action) {\n case Actions.CopyToClipboard:\n this.bindings.engine.dispatch(\n this.actions.logCopyToClipboard(this.result)\n );\n navigator.clipboard.writeText(this.result?.clickUri);\n break;\n case Actions.PostToFeed:\n this.bindings.engine.dispatch(\n this.actions.logFeedItemTextPost(this.result)\n );\n break;\n case Actions.SendAsEmail:\n this.bindings.engine.dispatch(\n this.actions.logCaseSendEmail(this.result)\n );\n break;\n }\n\n this.actionClicked.emit({action: this.action, result: this.result});\n }\n\n private getIcon() {\n if (this.icon) {\n return this.icon;\n }\n\n switch (this.action) {\n case Actions.CopyToClipboard:\n return CopyIcon;\n case Actions.AttachToCase:\n return AttachIcon;\n case Actions.Quickview:\n return QuickviewIcon;\n case Actions.PostToFeed:\n return FeedIcon;\n case Actions.SendAsEmail:\n return EmailIcon;\n default:\n return QuickviewIcon;\n }\n }\n\n public render() {\n return (\n <IconButton\n partPrefix=\"result-action\"\n style=\"outline-neutral\"\n icon={this.getIcon()}\n title={this.tooltip}\n onClick={() => this.onClick()}\n />\n );\n }\n}\n"],"version":3}
1
+ {"file":"atomic-insight-result-action.js","mappings":";;;;;MAUa,kBAAmB,SAAQ,KAAK;IAC3C,YAAY,WAAmB,EAAE,UAAkB;QACjD,KAAK,CACH,QAAQ,WAAW,sCAAsC,UAAU,YAAY,CAChF,CAAC;KACH;CACF;AACD;;;SAGgB,WAAW,CACzB,OAA8C;IAC5C,UAAU,EAAE,eAAe;IAC3B,MAAM,EAAE,KAAK;CACd;IAED,OAAO,CAAC,SAA6B,EAAE,YAAoB;QACzD,MAAM,EAAC,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,EAAC,GAAG,SAAS,CAAC;QACnE,SAAS,CAAC,iBAAiB,GAAG;YAC5B,MAAM,OAAO,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC;YACjC,MAAM,KAAK,GAAG,gBAAgB,CAC5B,oBAAoB,EACpB,CAAC,IAA6B;gBAC5B,IAAI,CAAC,YAAY,CAAC,GAAG,aAAa,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;aACvD,CACF,CAAC;YAEF,MAAM,QAAQ,GAAG,OAAO,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;YAC9C,IAAI,QAAQ,EAAE;gBACZ,IAAI,CAAC,KAAK,GAAG,IAAI,kBAAkB,CACjC,OAAO,CAAC,QAAQ,CAAC,WAAW,EAAE,EAC9B,IAAI,CAAC,UAAU,CAChB,CAAC;gBACF,OAAO;aACR;YACD,OAAO,iBAAiB,IAAI,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;SAC1D,CAAC;QAEF,SAAS,CAAC,mBAAmB,GAAG;YAC9B,IAA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,CAAC,CAC3C,CAAC;gBACF,MAAM;SACT;QAED,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,EAAC,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAC,CAAC,CAAC;KACrE;IAEO,OAAO;QACb,IAAI,IAAI,CAAC,IAAI,EAAE;YACb,OAAO,IAAI,CAAC,IAAI,CAAC;SAClB;QAED,QAAQ,IAAI,CAAC,MAAM;YACjB,KAAK,OAAO,CAAC,eAAe;gBAC1B,OAAO,QAAQ,CAAC;YAClB,KAAK,OAAO,CAAC,YAAY;gBACvB,OAAO,UAAU,CAAC;YACpB,KAAK,OAAO,CAAC,SAAS;gBACpB,OAAO,aAAa,CAAC;YACvB,KAAK,OAAO,CAAC,UAAU;gBACrB,OAAO,QAAQ,CAAC;YAClB,KAAK,OAAO,CAAC,WAAW;gBACtB,OAAO,SAAS,CAAC;YACnB;gBACE,OAAO,aAAa,CAAC;SACxB;KACF;IAEM,MAAM;QACX,QACE,EAAC,UAAU,qDACT,UAAU,EAAC,eAAe,EAC1B,KAAK,EAAC,iBAAiB,EACvB,IAAI,EAAE,IAAI,CAAC,OAAO,EAAE,EACpB,KAAK,EAAE,IAAI,CAAC,OAAO,EACnB,OAAO,EAAE,MAAM,IAAI,CAAC,OAAO,EAAE,GAC7B,EACF;KACH;;;;;;;;;AA1G4B;IAA5B,kBAAkB,EAAE;6DAAmC;AAC/B;IAAxB,aAAa,EAAE;2DAAyB;;;;;;;;;;;;;;;;;;;;","names":["AtomicInsightResultAction"],"sources":["src/components/common/item-list/stencil-item-decorators.tsx","src/components/search/result-template-component-utils/context/stencil-result-template-decorators.tsx","src/components/common/stencil-iconButton.tsx","src/components/insight/atomic-insight-result-action/atomic-insight-result-action.pcss?tag=atomic-insight-result-action","src/components/insight/atomic-insight-result-action/atomic-insight-result-action.tsx"],"sourcesContent":["import {closest} from '@/src/utils/dom-utils';\nimport {ComponentInterface, getElement} from '@stencil/core';\nimport {buildCustomEvent} from '../../../utils/event-utils';\nimport {AnyItem} from './unfolded-item';\nimport {\n ItemDisplayDensity,\n ItemDisplayImageSize,\n} from '../layout/display-options';\nimport {ResultTemplateProvider} from './result-template-provider';\n\nexport class MissingParentError extends Error {\n constructor(elementName: string, parentName: string) {\n super(\n `The \"${elementName}\" element must be the child of an \"${parentName}\" element.`\n );\n }\n}\n/**\n * @deprecated should only be used for Stencil components. For Lit components, use `ItemContext` from \\@/src/decorators/item-list/item-context.js.\n */\nexport function ItemContext(\n opts: {parentName: string; folded: boolean} = {\n parentName: 'atomic-result',\n folded: false,\n }\n) {\n return (component: ComponentInterface, itemVariable: string) => {\n const {connectedCallback, componentWillRender, render} = component;\n component.connectedCallback = function () {\n const element = getElement(this);\n const event = buildCustomEvent(\n itemContextEventName,\n (item: Record<string, unknown>) => {\n this[itemVariable] = extractFolded(item, opts.folded);\n }\n );\n\n const canceled = element.dispatchEvent(event);\n if (canceled) {\n this.error = new MissingParentError(\n element.nodeName.toLowerCase(),\n opts.parentName\n );\n return;\n }\n return connectedCallback && connectedCallback.call(this);\n };\n\n component.componentWillRender = function () {\n if (this.error) {\n return;\n }\n\n return componentWillRender && componentWillRender.call(this);\n };\n\n component.render = function () {\n if (this.error) {\n const element = getElement(this);\n element.remove();\n console.error(\n 'Result component is in error and has been removed from the DOM',\n this.error,\n this,\n element\n );\n return;\n }\n return render && render.call(this);\n };\n };\n}\n\n/**\n * @deprecated should only be used for Stencil components. For Lit components, use `InteractiveItemContext` from \\@/src/decorators/item-list/interactive-item-context.js.\n */\nexport function InteractiveItemContext() {\n return (component: ComponentInterface, interactiveItemVariable: string) => {\n const {connectedCallback} = component;\n component.connectedCallback = function () {\n const element = getElement(this);\n const event = buildCustomEvent(\n interactiveItemContextEventName,\n (item: AnyItem) => {\n this[interactiveItemVariable] = item;\n }\n );\n element.dispatchEvent(event);\n return connectedCallback && connectedCallback.call(this);\n };\n };\n}\n\ntype ItemContextEventHandler<T> = (item: T) => void;\nexport type ItemContextEvent<T> = CustomEvent<ItemContextEventHandler<T>>;\nconst itemContextEventName = 'atomic/resolveResult';\nexport type InteractiveItemContextEvent = CustomEvent<\n (interactiveItem: unknown) => void\n>;\nconst interactiveItemContextEventName = 'atomic/resolveInteractiveResult';\n\n/**\n * @deprecated should only be used for Stencil components. For Lit components, use `itemContext` from \\@/src/components/common/item-list/item-context.js.\n */\nexport function itemContext<T>(element: Element, parentName: string) {\n return new Promise<T>((resolve, reject) => {\n const event = buildCustomEvent<ItemContextEventHandler<T>>(\n itemContextEventName,\n (item: T) => {\n return resolve(item);\n }\n );\n element.dispatchEvent(event);\n\n if (!closest(element, parentName)) {\n reject(\n new MissingParentError(element.nodeName.toLowerCase(), parentName)\n );\n }\n });\n}\n\nfunction extractFolded(item: Record<string, unknown>, returnFolded: boolean) {\n if (returnFolded) {\n if ('children' in item) {\n return item;\n } else {\n return {children: [], result: item};\n }\n }\n\n if ('children' in item && 'result' in item) {\n return item.result;\n }\n return item;\n}\n\ntype ChildTemplatesContextEventHandler = (\n itemTemplateProvider?: ResultTemplateProvider\n) => void;\nexport type ChildTemplatesContextEvent =\n CustomEvent<ChildTemplatesContextEventHandler>;\nconst childTemplatesContextEventName = 'atomic/resolveChildTemplates';\n\ninterface AtomicItemChildren {\n itemTemplateProvider?: ResultTemplateProvider;\n}\n\n/**\n * @deprecated should only be used for Stencil components. For Lit components, use `ChildTemplatesContext` from \\@/src/decorators/item-list/child-templates-context.js.\n */\nexport function ChildTemplatesContext() {\n return (component: ComponentInterface, itemTemplateProviderProp: string) => {\n const {componentWillRender} = component;\n component.componentWillRender = function () {\n const element = getElement(this);\n const event = buildCustomEvent(\n childTemplatesContextEventName,\n (itemTemplateProvider?: ResultTemplateProvider) => {\n const component = this as AtomicItemChildren;\n if (component.itemTemplateProvider) {\n return;\n }\n\n this[itemTemplateProviderProp] = itemTemplateProvider;\n }\n );\n\n const canceled = element.dispatchEvent(event);\n if (canceled) {\n this[itemTemplateProviderProp] = null;\n return;\n }\n return componentWillRender && componentWillRender.call(this);\n };\n };\n}\n\nexport type DisplayConfig = {\n density: ItemDisplayDensity;\n imageSize: ItemDisplayImageSize;\n};\n\ntype ItemDisplayConfigContextEventHandler = (config: DisplayConfig) => void;\nexport type ItemDisplayConfigContextEvent =\n CustomEvent<ItemDisplayConfigContextEventHandler>;\nconst itemDisplayConfigContextEventName = 'atomic/resolveResultDisplayConfig';\n\n/**\n * @deprecated should only be used for Stencil components. For Lit components, use `ItemDisplayConfigContext` from \\@/src/decorators/item-list/item-display-config-context.js.\n */\nexport function ItemDisplayConfigContext() {\n return (component: ComponentInterface, itemVariable: string) => {\n const {componentWillRender} = component;\n component.componentWillRender = function () {\n const element = getElement(this);\n const event = buildCustomEvent(\n itemDisplayConfigContextEventName,\n (config: DisplayConfig) => {\n this[itemVariable] = config;\n }\n );\n\n const canceled = element.dispatchEvent(event);\n if (canceled) {\n return;\n }\n return componentWillRender && componentWillRender.call(this);\n };\n };\n}\n","import {FoldedResult, Result} from '@coveo/headless';\nimport {\n InteractiveItemContext,\n InteractiveItemContextEvent,\n ItemContext,\n ItemContextEvent,\n itemContext,\n} from '@/src/components/common/item-list/stencil-item-decorators';\n\n/**\n * A [StencilJS property decorator](https://stenciljs.com/) to be used for result template components.\n * This allows the Stencil component to fetch the current result from its rendered parent, the `atomic-result` component.\n *\n * Example:\n * @ResultContext() private result!: Result;\n *\n * For more information and examples, view the \"Utilities\" section of the readme.\n * \n * @deprecated should only be used for Stencil components. For Lit components, use `createResultContextController` from \\@/src/components/search/result-template-component-utils/context/result-context-controller.ts\n */\nexport function ResultContext(opts: {folded: boolean} = {folded: false}) {\n return ItemContext({parentName: 'atomic-result', folded: opts.folded});\n}\n\nexport function InteractiveResultContext() {\n return InteractiveItemContext();\n}\n\nexport type ResultContextEvent<T = Result> = ItemContextEvent<T>;\nexport type InteractiveResultContextEvent = InteractiveItemContextEvent;\n\n/**\n * Retrieves `Result` on a rendered `atomic-result`.\n *\n * This method is useful for building custom result template elements, see [Create a Result List](https://docs.coveo.com/en/atomic/latest/cc-search/create-custom-components/native-components/#custom-result-template-component-example) for more information.\n *\n * You should use the method in the [connectedCallback lifecycle method](https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_custom_elements#using_the_lifecycle_callbacks).\n *\n * @param element The element that the event is dispatched to, which must be the child of a rendered \"atomic-result\" element.\n * @returns A promise that resolves on initialization of the parent \"atomic-result\" element, or rejects when there is no parent \"atomic-result\" element.\n * \n * @deprecated should only be used for Stencil components. For Lit components, use `fetchResultContext` from \\@/src/components/search/result-template-component-utils/context/fetch-result-context.ts\n */\nexport function resultContext<T extends Result | FoldedResult = Result>(\n element: Element\n) {\n return itemContext<T>(element, 'atomic-result');\n}\n","import {FunctionalComponent, h, VNode} from '@stencil/core';\nimport {Button, StencilButtonProps} from './stencil-button';\n\ninterface IconButtonProps extends StencilButtonProps {\n badge?: VNode;\n buttonRef?: (el?: HTMLButtonElement) => void;\n icon: string;\n partPrefix: string;\n}\n\n/**\n * @deprecated should only be used for Stencil components.\n */\nexport const IconButton: FunctionalComponent<IconButtonProps> = (props) => {\n return (\n <div class=\"relative\" part={`${props.partPrefix}-container`}>\n <Button\n {...props}\n class=\"relative h-[2.6rem] w-[2.6rem] p-3\"\n part={`${props.partPrefix}-button`}\n ref={props.buttonRef}\n >\n <atomic-icon\n icon={props.icon}\n class=\"h-4 w-4 shrink-0\"\n part={`${props.partPrefix}-icon`}\n ></atomic-icon>\n </Button>\n {props.badge && (\n <span\n part={`${props.partPrefix}-badge`}\n class=\"bg-primary text-on-primary absolute -top-2 -right-2 block h-4 w-4 rounded-full text-center text-xs leading-4\"\n >\n {props.badge}\n </span>\n )}\n </div>\n );\n};\n","@import '../../../global/global.pcss';\n\n:host {\n &::part(result-action-button) {\n @apply flex items-center justify-center;\n @apply h-8 w-8;\n }\n}\n","import {Result} from '@coveo/headless';\nimport {\n InsightAnalyticsActionCreators,\n loadInsightAnalyticsActions,\n} from '@coveo/headless/insight';\nimport {Component, Event, EventEmitter, Prop, State, h} from '@stencil/core';\nimport AttachIcon from '../../../images/attach.svg';\nimport CopyIcon from '../../../images/copy-dark.svg';\nimport EmailIcon from '../../../images/email.svg';\nimport QuickviewIcon from '../../../images/preview.svg';\nimport FeedIcon from '../../../images/share-post.svg';\nimport {\n InitializableComponent,\n InitializeBindings,\n} from '../../../utils/initialization-utils';\nimport {IconButton} from '../../common/stencil-iconButton';\nimport {ResultContext} from '@/src/components/search/result-template-component-utils/context/stencil-result-template-decorators';\nimport {InsightBindings} from '../atomic-insight-interface/atomic-insight-interface';\n\nexport interface InsightResultActionClickedEvent {\n action: string;\n result: Result;\n}\n\nexport enum Actions {\n CopyToClipboard = 'copyToClipboard',\n AttachToCase = 'attachToCase',\n Quickview = 'quickview',\n PostToFeed = 'postToFeed',\n SendAsEmail = 'sendAsEmail',\n}\n\n/**\n * @internal\n */\n@Component({\n tag: 'atomic-insight-result-action',\n styleUrl: 'atomic-insight-result-action.pcss',\n})\nexport class AtomicInsightResultAction\n implements InitializableComponent<InsightBindings>\n{\n @InitializeBindings() public bindings!: InsightBindings;\n @ResultContext() private result!: Result;\n @State() public error!: Error;\n\n /**\n * @migration Stencil's @Event() decorator defaults to: bubbles=true, composed=true, cancelable=true.\n * Native CustomEvent defaults to: bubbles=false, composed=false, cancelable=false.\n * When migrating to Lit, explicitly set all three options to preserve behavior:\n * `new CustomEvent('atomicInsightResultActionClicked', { bubbles: true, composed: true, cancelable: true, detail: ... })`\n */\n @Event({\n eventName: 'atomicInsightResultActionClicked',\n composed: true,\n cancelable: true,\n bubbles: true,\n })\n private actionClicked!: EventEmitter<InsightResultActionClickedEvent>;\n\n /**\n * Specify the result action icon to display.\n */\n @Prop({mutable: true}) public icon = '';\n\n /**\n * The text tooltip to show on the result action icon.\n */\n @Prop({mutable: true}) public tooltip = '';\n\n /**\n * The text tooltip to show on the result action icon for some time after clicking the button.\n */\n @Prop({mutable: true}) public tooltipOnClick = '';\n\n /**\n * The type of action to perform when the result action is clicked. This will be sent along the event fired when the button is clicked.\n */\n @Prop({mutable: true}) public action: Actions | string = '';\n\n private actions!: InsightAnalyticsActionCreators;\n\n public initialize() {\n this.actions = loadInsightAnalyticsActions(this.bindings.engine);\n }\n\n private onClick() {\n if (this.tooltipOnClick) {\n const originalTooltip = this.tooltip;\n this.tooltip = this.tooltipOnClick;\n setTimeout(() => {\n this.tooltip = originalTooltip;\n }, 1000);\n }\n\n switch (this.action) {\n case Actions.CopyToClipboard:\n this.bindings.engine.dispatch(\n this.actions.logCopyToClipboard(this.result)\n );\n navigator.clipboard.writeText(this.result?.clickUri);\n break;\n case Actions.PostToFeed:\n this.bindings.engine.dispatch(\n this.actions.logFeedItemTextPost(this.result)\n );\n break;\n case Actions.SendAsEmail:\n this.bindings.engine.dispatch(\n this.actions.logCaseSendEmail(this.result)\n );\n break;\n }\n\n this.actionClicked.emit({action: this.action, result: this.result});\n }\n\n private getIcon() {\n if (this.icon) {\n return this.icon;\n }\n\n switch (this.action) {\n case Actions.CopyToClipboard:\n return CopyIcon;\n case Actions.AttachToCase:\n return AttachIcon;\n case Actions.Quickview:\n return QuickviewIcon;\n case Actions.PostToFeed:\n return FeedIcon;\n case Actions.SendAsEmail:\n return EmailIcon;\n default:\n return QuickviewIcon;\n }\n }\n\n public render() {\n return (\n <IconButton\n partPrefix=\"result-action\"\n style=\"outline-neutral\"\n icon={this.getIcon()}\n title={this.tooltip}\n onClick={() => this.onClick()}\n />\n );\n }\n}\n"],"version":3}
@@ -1,7 +1,6 @@
1
1
  import { h, proxyCustomElement, HTMLElement } from '@stencil/core/internal/client';
2
- import { M as MapProp } from './props-utils.js';
2
+ import { i as isElementNode, a as aggregate, b as isVisualNode, M as MapProp } from './props-utils.js';
3
3
  import { ResultTemplatesHelpers } from '@coveo/headless';
4
- import { i as isElementNode, a as aggregate, b as isVisualNode } from './utils.js';
5
4
 
6
5
  const tableElementTagName = 'atomic-table-element';
7
6
 
@@ -1 +1 @@
1
- {"file":"atomic-insight-result-children-template.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AAC,UAAU,CAAC,CAAC,CAAC;KAC5E;IACD,OAAO,UAAU,CAAC;AACpB;;;;;;;;;;;;MChMaA,qCAAmC;IAkD9C;;;;;;;;;;;QAtCe,eAAU,GAA8B,EAAE,CAAC;;;;;;QAqBb,cAAS,GAGlD,EAAE,CAAC;;;;;;QAOsC,iBAAY,GAGrD,EAAE,CAAC;;0BAlCgD,EAAE;;;yBAwBrD,EAAE;4BAUF,EAAE;KAIU;IAEhB,iBAAiB;QACf,IAAI,CAAC,oBAAoB,GAAG,IAAI,oBAAoB,CAAC;YACnD,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,QAAQ,EAAE,CAAC,GAAG;gBACZ,IAAI,CAAC,KAAK,GAAG,GAAG,CAAC;aAClB;YACD,YAAY,EAAE,CAAC,gCAAgC,CAAC;SACjD,CAAC,CAAC;KACJ;IAEM,iBAAiB;QACtB,IAAI,CAAC,UAAU,GAAG,qBAAqB,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;QAC3E,IAAI,CAAC,oBAAoB,CAAC,eAAe,GAAG,mBAAmB,CAC7D,IAAI,CAAC,SAAS,EACd,IAAI,CAAC,YAAY,CAClB,CAAC;KACH;;;;IAMM,MAAM,WAAW;QACtB,OAAO,IAAI,CAAC,oBAAoB,CAAC,WAAW,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;KAC3E;IAEM,MAAM;QACX,OAAO,IAAI,CAAC,oBAAoB,CAAC,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;KAC5D;;;;;;;;;;;AA/C4C;IAApC,OAAO,CAAC,EAAC,WAAW,EAAE,IAAI,EAAC,CAAC;wEAG9B;AAOsC;IAApC,OAAO,CAAC,EAAC,WAAW,EAAE,IAAI,EAAC,CAAC;2EAG9B;;;;;;;;;;;;;;;;;;;;","names":["AtomicInsightResultChildrenTemplate"],"sources":["src/components/common/table-element-utils.ts","src/components/common/layout/item-layout-sections.ts","src/components/common/result-templates/stencil-result-template-common.tsx","src/components/insight/result-templates/atomic-insight-result-children-template/atomic-insight-result-children-template.tsx"],"sourcesContent":["export const tableElementTagName = 'atomic-table-element';\n","import {isElementNode} from '@/src/utils/utils';\n\nconst resultSectionTags = new Set([\n 'atomic-result-section-visual',\n 'atomic-result-section-badges',\n 'atomic-result-section-actions',\n 'atomic-result-section-title',\n 'atomic-result-section-title-metadata',\n 'atomic-result-section-emphasized',\n 'atomic-result-section-excerpt',\n 'atomic-result-section-bottom-metadata',\n 'atomic-result-section-children',\n] as const);\n\nconst productSectionTags = new Set([\n 'atomic-product-section-visual',\n 'atomic-product-section-badges',\n 'atomic-product-section-actions',\n 'atomic-product-section-name',\n 'atomic-product-section-metadata',\n 'atomic-product-section-emphasized',\n 'atomic-product-section-description',\n 'atomic-product-section-bottom-metadata',\n 'atomic-product-section-children',\n] as const);\n\nconst allTags = new Set([...resultSectionTags, ...productSectionTags]);\n\ntype SetValueType<T> = T extends Set<infer U> ? U : never;\n\nexport type ItemSectionTagName = SetValueType<typeof allTags>;\n\nexport function isResultSectionNode(element: Node) {\n if (!isElementNode(element)) {\n return false;\n }\n return allTags.has(element.tagName.toLowerCase() as ItemSectionTagName);\n}\n\nexport function containsSections(content: string | NodeList | HTMLCollection) {\n if (typeof content === 'string') {\n return Array.from(allTags.values()).some((tag) => content.includes(tag));\n }\n return Array.from(content).some((child) => isResultSectionNode(child));\n}\n","import {\n ResultTemplate,\n ResultTemplateCondition,\n ResultTemplatesHelpers,\n} from '@coveo/headless';\nimport {h} from '@stencil/core';\nimport {aggregate, isElementNode, isVisualNode} from '@/src/utils/utils';\nimport {tableElementTagName} from '../table-element-utils';\nimport {ItemTarget} from '../layout/display-options';\nimport {isResultSectionNode} from '../layout/item-layout-sections';\n\nexport type TemplateContent = DocumentFragment;\n\ninterface ResultTemplateCommonProps {\n allowEmpty?: boolean;\n host: HTMLDivElement;\n validParents: string[];\n setError: (error: Error) => void;\n}\n\ntype TemplateNodeType =\n | 'section'\n | 'metadata'\n | 'table-column-definition'\n | 'other';\n\nexport function getTemplateNodeType(node: Node): TemplateNodeType {\n if (isResultSectionNode(node)) {\n return 'section';\n }\n if (!isVisualNode(node)) {\n return 'metadata';\n }\n if (\n isElementNode(node) &&\n node.tagName.toLowerCase() === tableElementTagName\n ) {\n return 'table-column-definition';\n }\n return 'other';\n}\n\nfunction groupNodesByType(nodes: NodeList) {\n return aggregate(Array.from(nodes), (node) => getTemplateNodeType(node));\n}\n\nexport class ResultTemplateCommon {\n private host: HTMLDivElement;\n public matchConditions: ResultTemplateCondition[] = [];\n private gridCellLinkTarget: ItemTarget = '_self';\n\n constructor({\n host,\n setError,\n validParents,\n allowEmpty = false,\n }: ResultTemplateCommonProps) {\n this.host = host;\n this.validateTemplate(host, setError, validParents, allowEmpty);\n }\n\n validateTemplate(\n host: HTMLDivElement,\n setError: (error: Error) => void,\n validParents: string[],\n allowEmpty = true\n ) {\n const hasValidParent = validParents\n .map((p) => p.toUpperCase())\n .includes(host.parentElement?.nodeName || '');\n const tagName = host.nodeName.toLowerCase();\n\n if (!hasValidParent) {\n setError(\n new Error(\n `The \"${tagName}\" component has to be the child of one of the following: ${validParents\n .map((p) => `\"${p.toLowerCase()}\"`)\n .join(', ')}.`\n )\n );\n return;\n }\n\n if (\n host.parentElement?.attributes.getNamedItem('display')?.value === 'grid'\n ) {\n this.gridCellLinkTarget = host.parentElement?.attributes.getNamedItem(\n 'grid-cell-link-target'\n )?.value as ItemTarget;\n }\n\n const template = host.querySelector<HTMLTemplateElement>(\n 'template:not([slot])'\n );\n if (!template) {\n setError(\n new Error(\n `The \"${tagName}\" component has to contain a \"template\" element as a child.`\n )\n );\n return;\n }\n\n if (!allowEmpty && !template.innerHTML.trim()) {\n setError(\n new Error(`The \"template\" tag inside \"${tagName}\" cannot be empty.`)\n );\n return;\n }\n\n if (template.content.querySelector('script')) {\n console.warn(\n 'Any \"script\" tags defined inside of \"template\" elements are not supported and will not be executed when the results are rendered.',\n host\n );\n }\n\n const {section: sectionNodes, other: otherNodes} = groupNodesByType(\n template.content.childNodes\n );\n if (sectionNodes?.length && otherNodes?.length) {\n console.warn(\n 'Result templates should only contain section elements or non-section elements. Future updates could unpredictably affect this result template.',\n host,\n {sectionNodes, otherNodes}\n );\n }\n }\n\n getTemplate(\n conditions: ResultTemplateCondition[],\n error: Error\n ): ResultTemplate<TemplateContent> | null {\n if (error) {\n return null;\n }\n\n return {\n conditions: conditions.concat(this.matchConditions),\n content: getTemplateElement(this.host).content!,\n linkContent: this.getLinkTemplateElement(this.host).content!,\n priority: 1,\n };\n }\n\n renderIfError(error: Error) {\n if (error) {\n return (\n <atomic-component-error\n element={this.host}\n error={error}\n ></atomic-component-error>\n );\n }\n }\n\n getDefaultLinkTemplateElement() {\n const linkTemplate = document.createElement('template');\n linkTemplate.innerHTML = `<atomic-result-link>${this.gridCellLinkTarget ? `<a slot=\"attributes\" target=\"${this.gridCellLinkTarget}\"></a>` : ''}</atomic-result-link>`;\n return linkTemplate;\n }\n\n getLinkTemplateElement(host: HTMLElement) {\n return (\n host.querySelector<HTMLTemplateElement>('template[slot=\"link\"]') ??\n this.getDefaultLinkTemplateElement()\n );\n }\n}\n\nfunction getTemplateElement(host: HTMLElement) {\n return host.querySelector<HTMLTemplateElement>('template:not([slot])')!;\n}\n\nexport function makeMatchConditions(\n mustMatch: Record<string, string[]>,\n mustNotMatch: Record<string, string[]>\n): ResultTemplateCondition[] {\n const conditions: ResultTemplateCondition[] = [];\n for (const field in mustMatch) {\n conditions.push(\n ResultTemplatesHelpers.fieldMustMatch(field, mustMatch[field])\n );\n }\n\n for (const field in mustNotMatch) {\n conditions.push(\n ResultTemplatesHelpers.fieldMustNotMatch(field, mustNotMatch[field])\n );\n }\n return conditions;\n}\n\nexport function makeDefinedConditions(\n ifDefined?: string,\n ifNotDefined?: string\n): ResultTemplateCondition[] {\n const conditions: ResultTemplateCondition[] = [];\n if (ifDefined) {\n const fieldNames = ifDefined.split(',');\n conditions.push(ResultTemplatesHelpers.fieldsMustBeDefined(fieldNames));\n }\n\n if (ifNotDefined) {\n const fieldNames = ifNotDefined.split(',');\n conditions.push(ResultTemplatesHelpers.fieldsMustNotBeDefined(fieldNames));\n }\n return conditions;\n}\n","import {ResultTemplate, ResultTemplateCondition} from '@coveo/headless';\nimport {Component, Element, Prop, State, Method} from '@stencil/core';\nimport {MapProp} from '../../../../utils/props-utils';\nimport {\n makeDefinedConditions,\n makeMatchConditions,\n ResultTemplateCommon,\n} from '../../../common/result-templates/stencil-result-template-common';\n\n/**\n * @internal\n */\n@Component({\n tag: 'atomic-insight-result-children-template',\n shadow: true,\n})\nexport class AtomicInsightResultChildrenTemplate {\n @Element() public host!: HTMLDivElement;\n\n @State() public error!: Error;\n\n /**\n * A function that must return true on results for the result template to apply.\n * Set programmatically before initialization, not via attribute.\n *\n * For example, the following targets a template and sets a condition to make it apply only to results whose `title` contains `singapore`:\n * `document.querySelector('#target-template').conditions = [(result) => /singapore/i.test(result.title)];`\n */\n @Prop() public conditions: ResultTemplateCondition[] = [];\n\n /**\n * The field that, when defined on a result item, would allow the template to be applied.\n *\n * For example, a template with the following attribute only applies to result items whose `filetype` and `sourcetype` fields are defined: `if-defined=\"filetype,sourcetype\"`\n */\n @Prop({reflect: true}) ifDefined?: string;\n\n /**\n * The field that, when defined on a result item, would prevent the template from being applied.\n *\n * For example, a template with the following attribute only applies to result items whose `filetype` and `sourcetype` fields are NOT defined: `if-not-defined=\"filetype,sourcetype\"`\n */\n @Prop({reflect: true}) ifNotDefined?: string;\n\n /**\n * The field and values that define which result items the condition must be applied to.\n *\n * For example, a template with the following attribute only applies to result items whose `filetype` is `lithiummessage` or `YouTubePlaylist`: `must-match-filetype=\"lithiummessage,YouTubePlaylist\"`\n */\n @Prop() @MapProp({splitValues: true}) public mustMatch: Record<\n string,\n string[]\n > = {};\n\n /**\n * The field and values that define which result items the condition must not be applied to.\n *\n * For example, a template with the following attribute only applies to result items whose `filetype` is not `lithiummessage`: `must-not-match-filetype=\"lithiummessage\"`\n */\n @Prop() @MapProp({splitValues: true}) public mustNotMatch: Record<\n string,\n string[]\n > = {};\n\n public resultTemplateCommon!: ResultTemplateCommon;\n\n constructor() {}\n\n connectedCallback() {\n this.resultTemplateCommon = new ResultTemplateCommon({\n host: this.host,\n setError: (err) => {\n this.error = err;\n },\n validParents: ['atomic-insight-result-children'],\n });\n }\n\n public componentWillLoad() {\n this.conditions = makeDefinedConditions(this.ifDefined, this.ifNotDefined);\n this.resultTemplateCommon.matchConditions = makeMatchConditions(\n this.mustMatch,\n this.mustNotMatch\n );\n }\n\n /**\n * Gets the appropriate result template based on conditions applied.\n */\n @Method()\n public async getTemplate(): Promise<ResultTemplate<DocumentFragment> | null> {\n return this.resultTemplateCommon.getTemplate(this.conditions, this.error);\n }\n\n public render() {\n return this.resultTemplateCommon.renderIfError(this.error);\n }\n}\n"],"version":3}
1
+ {"file":"atomic-insight-result-children-template.js","mappings":";;;;AAAO,MAAM,mBAAmB,GAAG,sBAAsB;;ACEzD,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAC;IAChC,8BAA8B;IAC9B,8BAA8B;IAC9B,+BAA+B;IAC/B,6BAA6B;IAC7B,sCAAsC;IACtC,kCAAkC;IAClC,+BAA+B;IAC/B,uCAAuC;IACvC,gCAAgC;CACxB,CAAC,CAAC;AAEZ,MAAM,kBAAkB,GAAG,IAAI,GAAG,CAAC;IACjC,+BAA+B;IAC/B,+BAA+B;IAC/B,gCAAgC;IAChC,6BAA6B;IAC7B,iCAAiC;IACjC,mCAAmC;IACnC,oCAAoC;IACpC,wCAAwC;IACxC,iCAAiC;CACzB,CAAC,CAAC;AAEZ,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,iBAAiB,EAAE,GAAG,kBAAkB,CAAC,CAAC,CAAC;SAMvD,mBAAmB,CAAC,OAAa;IAC/C,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,EAAE;QAC3B,OAAO,KAAK,CAA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,CAAC,oBAAoB,CAAC,eAAe,GAAG,mBAAmB,CAC7D,IAAI,CAAC,SAAS,EACd,IAAI,CAAC,YAAY,CAClB,CAAC;KACH;;;;IAMM,MAAM,WAAW;QACtB,OAAO,IAAI,CAAC,oBAAoB,CAAC,WAAW,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;KAC3E;IAEM,MAAM;QACX,OAAO,IAAI,CAAC,oBAAoB,CAAC,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;KAC5D;;;;;;;;;;;AA/C4C;IAApC,OAAO,CAAC,EAAC,WAAW,EAAE,IAAI,EAAC,CAAC;wEAG9B;AAOsC;IAApC,OAAO,CAAC,EAAC,WAAW,EAAE,IAAI,EAAC,CAAC;2EAG9B;;;;;;;;;;;;;;;;;;;;","names":["AtomicInsightResultChildrenTemplate"],"sources":["src/components/common/table-element-utils.ts","src/components/common/layout/item-layout-sections.ts","src/components/common/result-templates/stencil-result-template-common.tsx","src/components/insight/result-templates/atomic-insight-result-children-template/atomic-insight-result-children-template.tsx"],"sourcesContent":["export const tableElementTagName = 'atomic-table-element';\n","import {isElementNode} from '@/src/utils/utils';\n\nconst resultSectionTags = new Set([\n 'atomic-result-section-visual',\n 'atomic-result-section-badges',\n 'atomic-result-section-actions',\n 'atomic-result-section-title',\n 'atomic-result-section-title-metadata',\n 'atomic-result-section-emphasized',\n 'atomic-result-section-excerpt',\n 'atomic-result-section-bottom-metadata',\n 'atomic-result-section-children',\n] as const);\n\nconst productSectionTags = new Set([\n 'atomic-product-section-visual',\n 'atomic-product-section-badges',\n 'atomic-product-section-actions',\n 'atomic-product-section-name',\n 'atomic-product-section-metadata',\n 'atomic-product-section-emphasized',\n 'atomic-product-section-description',\n 'atomic-product-section-bottom-metadata',\n 'atomic-product-section-children',\n] as const);\n\nconst allTags = new Set([...resultSectionTags, ...productSectionTags]);\n\ntype SetValueType<T> = T extends Set<infer U> ? U : never;\n\nexport type ItemSectionTagName = SetValueType<typeof allTags>;\n\nexport function isResultSectionNode(element: Node) {\n if (!isElementNode(element)) {\n return false;\n }\n return allTags.has(element.tagName.toLowerCase() as ItemSectionTagName);\n}\n\nexport function containsSections(content: string | NodeList | HTMLCollection) {\n if (typeof content === 'string') {\n return Array.from(allTags.values()).some((tag) => content.includes(tag));\n }\n return Array.from(content).some((child) => isResultSectionNode(child));\n}\n","import {\n ResultTemplate,\n ResultTemplateCondition,\n ResultTemplatesHelpers,\n} from '@coveo/headless';\nimport {h} from '@stencil/core';\nimport {aggregate, isElementNode, isVisualNode} from '@/src/utils/utils';\nimport {tableElementTagName} from '../table-element-utils';\nimport {ItemTarget} from '../layout/display-options';\nimport {isResultSectionNode} from '../layout/item-layout-sections';\n\nexport type TemplateContent = DocumentFragment;\n\ninterface ResultTemplateCommonProps {\n allowEmpty?: boolean;\n host: HTMLDivElement;\n validParents: string[];\n setError: (error: Error) => void;\n}\n\ntype TemplateNodeType =\n | 'section'\n | 'metadata'\n | 'table-column-definition'\n | 'other';\n\nexport function getTemplateNodeType(node: Node): TemplateNodeType {\n if (isResultSectionNode(node)) {\n return 'section';\n }\n if (!isVisualNode(node)) {\n return 'metadata';\n }\n if (\n isElementNode(node) &&\n node.tagName.toLowerCase() === tableElementTagName\n ) {\n return 'table-column-definition';\n }\n return 'other';\n}\n\nfunction groupNodesByType(nodes: NodeList) {\n return aggregate(Array.from(nodes), (node) => getTemplateNodeType(node));\n}\n\nexport class ResultTemplateCommon {\n private host: HTMLDivElement;\n public matchConditions: ResultTemplateCondition[] = [];\n private gridCellLinkTarget: ItemTarget = '_self';\n\n constructor({\n host,\n setError,\n validParents,\n allowEmpty = false,\n }: ResultTemplateCommonProps) {\n this.host = host;\n this.validateTemplate(host, setError, validParents, allowEmpty);\n }\n\n validateTemplate(\n host: HTMLDivElement,\n setError: (error: Error) => void,\n validParents: string[],\n allowEmpty = true\n ) {\n const hasValidParent = validParents\n .map((p) => p.toUpperCase())\n .includes(host.parentElement?.nodeName || '');\n const tagName = host.nodeName.toLowerCase();\n\n if (!hasValidParent) {\n setError(\n new Error(\n `The \"${tagName}\" component has to be the child of one of the following: ${validParents\n .map((p) => `\"${p.toLowerCase()}\"`)\n .join(', ')}.`\n )\n );\n return;\n }\n\n if (\n host.parentElement?.attributes.getNamedItem('display')?.value === 'grid'\n ) {\n this.gridCellLinkTarget = host.parentElement?.attributes.getNamedItem(\n 'grid-cell-link-target'\n )?.value as ItemTarget;\n }\n\n const template = host.querySelector<HTMLTemplateElement>(\n 'template:not([slot])'\n );\n if (!template) {\n setError(\n new Error(\n `The \"${tagName}\" component has to contain a \"template\" element as a child.`\n )\n );\n return;\n }\n\n if (!allowEmpty && !template.innerHTML.trim()) {\n setError(\n new Error(`The \"template\" tag inside \"${tagName}\" cannot be empty.`)\n );\n return;\n }\n\n if (template.content.querySelector('script')) {\n console.warn(\n 'Any \"script\" tags defined inside of \"template\" elements are not supported and will not be executed when the results are rendered.',\n host\n );\n }\n\n const {section: sectionNodes, other: otherNodes} = groupNodesByType(\n template.content.childNodes\n );\n if (sectionNodes?.length && otherNodes?.length) {\n console.warn(\n 'Result templates should only contain section elements or non-section elements. Future updates could unpredictably affect this result template.',\n host,\n {sectionNodes, otherNodes}\n );\n }\n }\n\n getTemplate(\n conditions: ResultTemplateCondition[],\n error: Error\n ): ResultTemplate<TemplateContent> | null {\n if (error) {\n return null;\n }\n\n return {\n conditions: conditions.concat(this.matchConditions),\n content: getTemplateElement(this.host).content!,\n linkContent: this.getLinkTemplateElement(this.host).content!,\n priority: 1,\n };\n }\n\n renderIfError(error: Error) {\n if (error) {\n return (\n <atomic-component-error\n element={this.host}\n error={error}\n ></atomic-component-error>\n );\n }\n }\n\n getDefaultLinkTemplateElement() {\n const linkTemplate = document.createElement('template');\n linkTemplate.innerHTML = `<atomic-result-link>${this.gridCellLinkTarget ? `<a slot=\"attributes\" target=\"${this.gridCellLinkTarget}\"></a>` : ''}</atomic-result-link>`;\n return linkTemplate;\n }\n\n getLinkTemplateElement(host: HTMLElement) {\n return (\n host.querySelector<HTMLTemplateElement>('template[slot=\"link\"]') ??\n this.getDefaultLinkTemplateElement()\n );\n }\n}\n\nfunction getTemplateElement(host: HTMLElement) {\n return host.querySelector<HTMLTemplateElement>('template:not([slot])')!;\n}\n\nexport function makeMatchConditions(\n mustMatch: Record<string, string[]>,\n mustNotMatch: Record<string, string[]>\n): ResultTemplateCondition[] {\n const conditions: ResultTemplateCondition[] = [];\n for (const field in mustMatch) {\n conditions.push(\n ResultTemplatesHelpers.fieldMustMatch(field, mustMatch[field])\n );\n }\n\n for (const field in mustNotMatch) {\n conditions.push(\n ResultTemplatesHelpers.fieldMustNotMatch(field, mustNotMatch[field])\n );\n }\n return conditions;\n}\n\nexport function makeDefinedConditions(\n ifDefined?: string,\n ifNotDefined?: string\n): ResultTemplateCondition[] {\n const conditions: ResultTemplateCondition[] = [];\n if (ifDefined) {\n const fieldNames = ifDefined.split(',');\n conditions.push(ResultTemplatesHelpers.fieldsMustBeDefined(fieldNames));\n }\n\n if (ifNotDefined) {\n const fieldNames = ifNotDefined.split(',');\n conditions.push(ResultTemplatesHelpers.fieldsMustNotBeDefined(fieldNames));\n }\n return conditions;\n}\n","import {ResultTemplate, ResultTemplateCondition} from '@coveo/headless';\nimport {Component, Element, Prop, State, Method} from '@stencil/core';\nimport {MapProp} from '../../../../utils/props-utils';\nimport {\n makeDefinedConditions,\n makeMatchConditions,\n ResultTemplateCommon,\n} from '../../../common/result-templates/stencil-result-template-common';\n\n/**\n * @internal\n */\n@Component({\n tag: 'atomic-insight-result-children-template',\n shadow: true,\n})\nexport class AtomicInsightResultChildrenTemplate {\n @Element() public host!: HTMLDivElement;\n\n @State() public error!: Error;\n\n /**\n * A function that must return true on results for the result template to apply.\n * Set programmatically before initialization, not via attribute.\n *\n * For example, the following targets a template and sets a condition to make it apply only to results whose `title` contains `singapore`:\n * `document.querySelector('#target-template').conditions = [(result) => /singapore/i.test(result.title)];`\n */\n @Prop() public conditions: ResultTemplateCondition[] = [];\n\n /**\n * The field that, when defined on a result item, would allow the template to be applied.\n *\n * For example, a template with the following attribute only applies to result items whose `filetype` and `sourcetype` fields are defined: `if-defined=\"filetype,sourcetype\"`\n */\n @Prop({reflect: true}) ifDefined?: string;\n\n /**\n * The field that, when defined on a result item, would prevent the template from being applied.\n *\n * For example, a template with the following attribute only applies to result items whose `filetype` and `sourcetype` fields are NOT defined: `if-not-defined=\"filetype,sourcetype\"`\n */\n @Prop({reflect: true}) ifNotDefined?: string;\n\n /**\n * The field and values that define which result items the condition must be applied to.\n *\n * For example, a template with the following attribute only applies to result items whose `filetype` is `lithiummessage` or `YouTubePlaylist`: `must-match-filetype=\"lithiummessage,YouTubePlaylist\"`\n */\n @Prop() @MapProp({splitValues: true}) public mustMatch: Record<\n string,\n string[]\n > = {};\n\n /**\n * The field and values that define which result items the condition must not be applied to.\n *\n * For example, a template with the following attribute only applies to result items whose `filetype` is not `lithiummessage`: `must-not-match-filetype=\"lithiummessage\"`\n */\n @Prop() @MapProp({splitValues: true}) public mustNotMatch: Record<\n string,\n string[]\n > = {};\n\n public resultTemplateCommon!: ResultTemplateCommon;\n\n constructor() {}\n\n connectedCallback() {\n this.resultTemplateCommon = new ResultTemplateCommon({\n host: this.host,\n setError: (err) => {\n this.error = err;\n },\n validParents: ['atomic-insight-result-children'],\n });\n }\n\n public componentWillLoad() {\n this.conditions = makeDefinedConditions(this.ifDefined, this.ifNotDefined);\n this.resultTemplateCommon.matchConditions = makeMatchConditions(\n this.mustMatch,\n this.mustNotMatch\n );\n }\n\n /**\n * Gets the appropriate result template based on conditions applied.\n */\n @Method()\n public async getTemplate(): Promise<ResultTemplate<DocumentFragment> | null> {\n return this.resultTemplateCommon.getTemplate(this.conditions, this.error);\n }\n\n public render() {\n return this.resultTemplateCommon.renderIfError(this.error);\n }\n}\n"],"version":3}