@coveo/atomic 3.28.0-pre.b11d8122b2 → 3.28.0-pre.bc804ccb47

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 (226) hide show
  1. package/dist/atomic/_atomic.esm.js +1 -1
  2. package/dist/atomic/atomic.esm.js.map +1 -1
  3. package/dist/atomic/components/_index.d.ts +6 -0
  4. package/dist/atomic/components/_index.js +3 -0
  5. package/dist/atomic/components/atomic-commerce-query-error.js +1 -1
  6. package/dist/atomic/components/atomic-commerce-query-error.js.map +1 -1
  7. package/dist/atomic/components/atomic-commerce-text.d.ts +11 -0
  8. package/dist/atomic/components/atomic-commerce-text.js +8 -0
  9. package/dist/atomic/components/atomic-commerce-text.js.map +1 -0
  10. package/dist/atomic/components/atomic-commerce-text2.js +60 -0
  11. package/dist/atomic/components/atomic-commerce-text2.js.map +1 -0
  12. package/dist/atomic/components/atomic-insight-query-error.js +1 -1
  13. package/dist/atomic/components/atomic-insight-query-error.js.map +1 -1
  14. package/dist/atomic/components/atomic-layout-section.d.ts +11 -0
  15. package/dist/atomic/components/atomic-layout-section.js +35 -0
  16. package/dist/atomic/components/atomic-layout-section.js.map +1 -0
  17. package/dist/atomic/components/atomic-product-children.js +7 -1
  18. package/dist/atomic/components/atomic-product-children.js.map +1 -1
  19. package/dist/atomic/components/atomic-product-description.js +14 -2
  20. package/dist/atomic/components/atomic-product-description.js.map +1 -1
  21. package/dist/atomic/components/atomic-product-excerpt.js +14 -2
  22. package/dist/atomic/components/atomic-product-excerpt.js.map +1 -1
  23. package/dist/atomic/components/atomic-product-link.js +13 -1
  24. package/dist/atomic/components/atomic-product-link.js.map +1 -1
  25. package/dist/atomic/components/atomic-product-text.d.ts +11 -0
  26. package/dist/atomic/components/atomic-product-text.js +8 -0
  27. package/dist/atomic/components/atomic-product-text.js.map +1 -0
  28. package/dist/atomic/components/atomic-product-text2.js +83 -0
  29. package/dist/atomic/components/atomic-product-text2.js.map +1 -0
  30. package/dist/atomic/components/atomic-query-error.js +1 -1
  31. package/dist/atomic/components/atomic-query-error.js.map +1 -1
  32. package/dist/atomic/components/atomic-recs-error.js +1 -1
  33. package/dist/atomic/components/atomic-recs-error.js.map +1 -1
  34. package/dist/atomic/components/atomic-result-text2.js +2 -45
  35. package/dist/atomic/components/atomic-result-text2.js.map +1 -1
  36. package/dist/atomic/components/components/commerce/atomic-product-template/atomic-product-template.js +0 -2
  37. package/dist/atomic/components/components/commerce/index.js +0 -2
  38. package/dist/atomic/components/components/commerce/lazy-index.js +0 -2
  39. package/dist/atomic/components/components/common/index.js +0 -1
  40. package/dist/atomic/components/components/common/lazy-index.js +0 -1
  41. package/dist/atomic/components/{stencil-expandable-text.js → expandable-text.js} +1 -1
  42. package/dist/atomic/components/expandable-text.js.map +1 -0
  43. package/dist/atomic/components/global/environment.js +1 -1
  44. package/dist/atomic/components/index.js.map +1 -1
  45. package/dist/atomic/components/interface-common-stencil.js +1 -1
  46. package/dist/atomic/components/product-utils.js +8 -1
  47. package/dist/atomic/components/product-utils.js.map +1 -1
  48. package/dist/atomic/components/sections.js.map +1 -1
  49. package/dist/atomic/components/stencil-item-text-highlighted.js +49 -0
  50. package/dist/atomic/components/stencil-item-text-highlighted.js.map +1 -0
  51. package/dist/atomic/components/stencil-link.js.map +1 -1
  52. package/dist/atomic/{p-9d2230db.entry.js → p-17fd5a28.entry.js} +2 -2
  53. package/dist/atomic/p-17fd5a28.entry.js.map +1 -0
  54. package/dist/atomic/{p-ba6a30a7.entry.js → p-1cb6a01c.entry.js} +2 -2
  55. package/dist/atomic/p-1cb6a01c.entry.js.map +1 -0
  56. package/dist/atomic/{p-ac7f763b.entry.js → p-1dd61eef.entry.js} +2 -2
  57. package/dist/atomic/{p-ea5d2736.entry.js → p-22a0d1b9.entry.js} +2 -2
  58. package/dist/atomic/{p-e4037c62.js → p-2f78a1b4.js} +2 -2
  59. package/dist/atomic/{p-545f7fb1.entry.js → p-3195fa42.entry.js} +2 -2
  60. package/dist/atomic/p-39223a2a.entry.js +2 -0
  61. package/dist/atomic/p-39223a2a.entry.js.map +1 -0
  62. package/dist/atomic/{p-d8c7f5f2.entry.js → p-525db1ee.entry.js} +2 -2
  63. package/dist/atomic/p-5cf5bb98.entry.js +2 -0
  64. package/dist/atomic/{p-ce4e939b.entry.js → p-5f45ec5d.entry.js} +2 -2
  65. package/dist/atomic/p-5f45ec5d.entry.js.map +1 -0
  66. package/dist/atomic/{p-669a8316.js → p-5ffe2124.js} +2 -2
  67. package/dist/atomic/{p-f45d8b3e.js → p-6083c281.js} +1 -1
  68. package/dist/atomic/p-6083c281.js.map +1 -0
  69. package/dist/atomic/p-67ef14ac.entry.js +2 -0
  70. package/dist/atomic/p-67ef14ac.entry.js.map +1 -0
  71. package/dist/atomic/{p-99604083.entry.js → p-6e41443c.entry.js} +2 -2
  72. package/dist/atomic/p-6e41443c.entry.js.map +1 -0
  73. package/dist/atomic/p-733252f1.entry.js +2 -0
  74. package/dist/atomic/p-733252f1.entry.js.map +1 -0
  75. package/dist/atomic/{p-6bb919c4.entry.js → p-745713b3.entry.js} +2 -2
  76. package/dist/atomic/p-9c7dbbdf.js.map +1 -1
  77. package/dist/atomic/{p-6f0bf995.entry.js → p-b074d52d.entry.js} +2 -2
  78. package/dist/atomic/p-b1a7d837.js +2 -0
  79. package/dist/atomic/p-b1a7d837.js.map +1 -0
  80. package/dist/atomic/{p-bd32ca3c.entry.js → p-b3604b54.entry.js} +2 -2
  81. package/dist/atomic/p-b3604b54.entry.js.map +1 -0
  82. package/dist/atomic/p-bb081d4e.js +2 -0
  83. package/dist/atomic/p-bb081d4e.js.map +1 -0
  84. package/dist/atomic/{p-d1efd50f.entry.js → p-da46d5cd.entry.js} +2 -2
  85. package/dist/atomic/p-da46d5cd.entry.js.map +1 -0
  86. package/dist/atomic/{p-1d02a670.js → p-de00bdd6.js} +1 -1
  87. package/dist/atomic/p-de00bdd6.js.map +1 -0
  88. package/dist/cjs/_loader.cjs.js +1 -1
  89. package/dist/cjs/{analytics-config-9b94aa92.js → analytics-config-45b2890c.js} +2 -2
  90. package/dist/cjs/{analytics-config-9b94aa92.js.map → analytics-config-45b2890c.js.map} +1 -1
  91. package/dist/cjs/atomic-commerce-query-error.cjs.entry.js +2 -2
  92. package/dist/cjs/atomic-commerce-query-error.cjs.entry.js.map +1 -1
  93. package/dist/cjs/atomic-commerce-recommendation-interface.cjs.entry.js +1 -1
  94. package/dist/cjs/atomic-commerce-text_2.cjs.entry.js +106 -0
  95. package/dist/cjs/atomic-commerce-text_2.cjs.entry.js.map +1 -0
  96. package/dist/cjs/atomic-insight-interface.cjs.entry.js +2 -2
  97. package/dist/cjs/atomic-insight-query-error.cjs.entry.js +2 -2
  98. package/dist/cjs/atomic-insight-query-error.cjs.entry.js.map +1 -1
  99. package/dist/cjs/atomic-layout-section.cjs.entry.js +18 -0
  100. package/dist/cjs/atomic-layout-section.cjs.entry.js.map +1 -0
  101. package/dist/cjs/atomic-product-description.cjs.entry.js +2 -2
  102. package/dist/cjs/atomic-product-description.cjs.entry.js.map +1 -1
  103. package/dist/cjs/atomic-product-excerpt.cjs.entry.js +2 -2
  104. package/dist/cjs/atomic-product-excerpt.cjs.entry.js.map +1 -1
  105. package/dist/cjs/atomic-product-link.cjs.entry.js +1 -1
  106. package/dist/cjs/atomic-product-numeric-field-value.cjs.entry.js +1 -1
  107. package/dist/cjs/atomic-product-price.cjs.entry.js +1 -1
  108. package/dist/cjs/atomic-query-error.cjs.entry.js +2 -2
  109. package/dist/cjs/atomic-query-error.cjs.entry.js.map +1 -1
  110. package/dist/cjs/atomic-recs-error.cjs.entry.js +2 -2
  111. package/dist/cjs/atomic-recs-error.cjs.entry.js.map +1 -1
  112. package/dist/cjs/atomic-recs-interface.cjs.entry.js +2 -2
  113. package/dist/cjs/atomic-result-text_2.cjs.entry.js +4 -46
  114. package/dist/cjs/atomic-result-text_2.cjs.entry.js.map +1 -1
  115. package/dist/cjs/atomic-search-interface.cjs.entry.js +2 -2
  116. package/dist/cjs/atomic.cjs.js +1 -1
  117. package/dist/cjs/{stencil-expandable-text-80915f74.js → expandable-text-36fe9f8d.js} +1 -1
  118. package/dist/cjs/expandable-text-36fe9f8d.js.map +1 -0
  119. package/dist/cjs/index-757bc886.js +8 -0
  120. package/dist/cjs/{interface-common-stencil-42424702.js → interface-common-stencil-5ba672e0.js} +2 -2
  121. package/dist/cjs/{interface-common-stencil-42424702.js.map → interface-common-stencil-5ba672e0.js.map} +1 -1
  122. package/dist/cjs/{product-utils-f6c780e3.js → product-utils-9507462c.js} +9 -1
  123. package/dist/cjs/product-utils-9507462c.js.map +1 -0
  124. package/dist/cjs/sections-4b4af2f8.js.map +1 -1
  125. package/dist/cjs/stencil-item-text-highlighted-91fd0fe8.js +52 -0
  126. package/dist/cjs/stencil-item-text-highlighted-91fd0fe8.js.map +1 -0
  127. package/dist/cjs/{stencil-link-fbb2ab5c.js → stencil-link-c6b12034.js} +1 -1
  128. package/dist/cjs/stencil-link-c6b12034.js.map +1 -0
  129. package/dist/cjs/version.cjs.js +2 -2
  130. package/dist/esm/_loader.js +1 -1
  131. package/dist/esm/{analytics-config-d95199e4.js → analytics-config-a48652fd.js} +2 -2
  132. package/dist/esm/{analytics-config-d95199e4.js.map → analytics-config-a48652fd.js.map} +1 -1
  133. package/dist/esm/atomic-commerce-query-error.entry.js +2 -2
  134. package/dist/esm/atomic-commerce-query-error.entry.js.map +1 -1
  135. package/dist/esm/atomic-commerce-recommendation-interface.entry.js +1 -1
  136. package/dist/esm/atomic-commerce-text_2.entry.js +101 -0
  137. package/dist/esm/atomic-commerce-text_2.entry.js.map +1 -0
  138. package/dist/esm/atomic-insight-interface.entry.js +2 -2
  139. package/dist/esm/atomic-insight-query-error.entry.js +2 -2
  140. package/dist/esm/atomic-insight-query-error.entry.js.map +1 -1
  141. package/dist/esm/atomic-layout-section.entry.js +14 -0
  142. package/dist/esm/atomic-layout-section.entry.js.map +1 -0
  143. package/dist/esm/atomic-product-description.entry.js +1 -1
  144. package/dist/esm/atomic-product-description.entry.js.map +1 -1
  145. package/dist/esm/atomic-product-excerpt.entry.js +1 -1
  146. package/dist/esm/atomic-product-excerpt.entry.js.map +1 -1
  147. package/dist/esm/atomic-product-link.entry.js +1 -1
  148. package/dist/esm/atomic-product-numeric-field-value.entry.js +1 -1
  149. package/dist/esm/atomic-product-price.entry.js +1 -1
  150. package/dist/esm/atomic-query-error.entry.js +2 -2
  151. package/dist/esm/atomic-query-error.entry.js.map +1 -1
  152. package/dist/esm/atomic-recs-error.entry.js +2 -2
  153. package/dist/esm/atomic-recs-error.entry.js.map +1 -1
  154. package/dist/esm/atomic-recs-interface.entry.js +2 -2
  155. package/dist/esm/atomic-result-text_2.entry.js +3 -45
  156. package/dist/esm/atomic-result-text_2.entry.js.map +1 -1
  157. package/dist/esm/atomic-search-interface.entry.js +2 -2
  158. package/dist/esm/atomic.js +1 -1
  159. package/dist/esm/{stencil-expandable-text-957d599c.js → expandable-text-4eebe177.js} +1 -1
  160. package/dist/esm/expandable-text-4eebe177.js.map +1 -0
  161. package/dist/esm/index-3f35faca.js +8 -0
  162. package/dist/esm/{interface-common-stencil-b6c754f6.js → interface-common-stencil-24135630.js} +2 -2
  163. package/dist/esm/{interface-common-stencil-b6c754f6.js.map → interface-common-stencil-24135630.js.map} +1 -1
  164. package/dist/esm/{product-utils-85109d2e.js → product-utils-8348689f.js} +9 -2
  165. package/dist/esm/product-utils-8348689f.js.map +1 -0
  166. package/dist/esm/sections-ae00b53a.js.map +1 -1
  167. package/dist/esm/stencil-item-text-highlighted-0e1c6c08.js +49 -0
  168. package/dist/esm/stencil-item-text-highlighted-0e1c6c08.js.map +1 -0
  169. package/dist/esm/{stencil-link-32a27dfb.js → stencil-link-637c1ac5.js} +1 -1
  170. package/dist/esm/stencil-link-637c1ac5.js.map +1 -0
  171. package/dist/esm/version.js +2 -2
  172. package/dist/types/components/commerce/atomic-commerce-text/atomic-commerce-text.d.ts +5 -13
  173. package/dist/types/components/commerce/atomic-product-description/atomic-product-description.d.ts +1 -1
  174. package/dist/types/components/commerce/atomic-product-excerpt/atomic-product-excerpt.d.ts +1 -1
  175. package/dist/types/components/commerce/atomic-product-template/atomic-product-template.d.ts +0 -2
  176. package/dist/types/components/commerce/atomic-product-text/atomic-product-text.d.ts +15 -29
  177. package/dist/types/components/commerce/index.d.ts +0 -2
  178. package/dist/types/components/common/atomic-layout-section/atomic-layout-section.d.ts +2 -11
  179. package/dist/types/components/common/atomic-layout-section/sections.d.ts +1 -2
  180. package/dist/types/components/common/expandable-text/expandable-text.d.ts +4 -4
  181. package/dist/types/components/common/index.d.ts +0 -1
  182. package/dist/types/components/common/query-error/show-more.d.ts +4 -4
  183. package/dist/types/components.d.ts +145 -2
  184. package/docs/atomic-docs.json +370 -15
  185. package/package.json +3 -3
  186. package/dist/atomic/components/components/commerce/atomic-commerce-text/atomic-commerce-text.js +0 -54
  187. package/dist/atomic/components/components/commerce/atomic-product-text/atomic-product-text.js +0 -135
  188. package/dist/atomic/components/components/commerce/product-template-component-utils/error.js +0 -6
  189. package/dist/atomic/components/components/commerce/product-template-component-utils/product-utils.js +0 -35
  190. package/dist/atomic/components/components/common/atomic-layout-section/atomic-layout-section.js +0 -31
  191. package/dist/atomic/components/components/common/item-text/field-warning.js +0 -6
  192. package/dist/atomic/components/components/common/item-text/item-text-fallback.js +0 -15
  193. package/dist/atomic/components/components/common/item-text/item-text-highlighted.js +0 -17
  194. package/dist/atomic/components/components/common/item-text/render-highlights.js +0 -13
  195. package/dist/atomic/components/stencil-expandable-text.js.map +0 -1
  196. package/dist/atomic/components/utils/object-utils.js +0 -13
  197. package/dist/atomic/p-1d02a670.js.map +0 -1
  198. package/dist/atomic/p-99604083.entry.js.map +0 -1
  199. package/dist/atomic/p-9d2230db.entry.js.map +0 -1
  200. package/dist/atomic/p-a1c4ac09.js +0 -2
  201. package/dist/atomic/p-a1c4ac09.js.map +0 -1
  202. package/dist/atomic/p-ba6a30a7.entry.js.map +0 -1
  203. package/dist/atomic/p-bd32ca3c.entry.js.map +0 -1
  204. package/dist/atomic/p-ce4e939b.entry.js.map +0 -1
  205. package/dist/atomic/p-d1efd50f.entry.js.map +0 -1
  206. package/dist/atomic/p-d76c5232.entry.js +0 -2
  207. package/dist/atomic/p-f1bbe060.entry.js +0 -2
  208. package/dist/atomic/p-f1bbe060.entry.js.map +0 -1
  209. package/dist/atomic/p-f45d8b3e.js.map +0 -1
  210. package/dist/cjs/product-utils-f6c780e3.js.map +0 -1
  211. package/dist/cjs/stencil-expandable-text-80915f74.js.map +0 -1
  212. package/dist/cjs/stencil-link-fbb2ab5c.js.map +0 -1
  213. package/dist/esm/product-utils-85109d2e.js.map +0 -1
  214. package/dist/esm/stencil-expandable-text-957d599c.js.map +0 -1
  215. package/dist/esm/stencil-link-32a27dfb.js.map +0 -1
  216. package/dist/types/components/common/expandable-text/stencil-expandable-text.d.ts +0 -13
  217. package/dist/types/components/common/query-error/stencil-show-more.d.ts +0 -10
  218. /package/dist/atomic/{p-ac7f763b.entry.js.map → p-1dd61eef.entry.js.map} +0 -0
  219. /package/dist/atomic/{p-ea5d2736.entry.js.map → p-22a0d1b9.entry.js.map} +0 -0
  220. /package/dist/atomic/{p-e4037c62.js.map → p-2f78a1b4.js.map} +0 -0
  221. /package/dist/atomic/{p-545f7fb1.entry.js.map → p-3195fa42.entry.js.map} +0 -0
  222. /package/dist/atomic/{p-d8c7f5f2.entry.js.map → p-525db1ee.entry.js.map} +0 -0
  223. /package/dist/atomic/{p-d76c5232.entry.js.map → p-5cf5bb98.entry.js.map} +0 -0
  224. /package/dist/atomic/{p-669a8316.js.map → p-5ffe2124.js.map} +0 -0
  225. /package/dist/atomic/{p-6bb919c4.entry.js.map → p-745713b3.entry.js.map} +0 -0
  226. /package/dist/atomic/{p-6f0bf995.entry.js.map → p-b074d52d.entry.js.map} +0 -0
@@ -0,0 +1,83 @@
1
+ import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
2
+ import { ProductTemplatesHelpers, HighlightUtils } from '@coveo/headless/commerce';
3
+ import { g as getFieldValueCaption } from './field-utils.js';
4
+ import { I as InitializeBindings } from './initialization-utils.js';
5
+ import { I as ItemTextFallback, a as ItemTextHighlighted } from './stencil-item-text-highlighted.js';
6
+ import { g as getStringValueFromProductOrNull } from './product-utils.js';
7
+ import { P as ProductContext } from './stencil-product-template-decorators.js';
8
+ import { d as defineCustomElement$1 } from './atomic-commerce-text2.js';
9
+
10
+ var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
11
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
12
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
13
+ r = Reflect.decorate(decorators, target, key, desc);
14
+ else
15
+ for (var i = decorators.length - 1; i >= 0; i--)
16
+ if (d = decorators[i])
17
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
18
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
19
+ };
20
+ const AtomicProductText = /*@__PURE__*/ proxyCustomElement(class AtomicProductText extends HTMLElement {
21
+ constructor() {
22
+ super();
23
+ this.__registerHost();
24
+ /**
25
+ * When this is set to `true`, the component attempts to highlight text based on the highlighting properties provided by the search API response.
26
+ * This property only works for the product excerpt and the ec_name field.
27
+ */
28
+ this.shouldHighlight = true;
29
+ this.error = undefined;
30
+ this.field = undefined;
31
+ this.shouldHighlight = true;
32
+ this.default = undefined;
33
+ }
34
+ get shouldRenderHighlights() {
35
+ return this.shouldHighlight && this.isFieldSupportedForHighlighting();
36
+ }
37
+ isFieldSupportedForHighlighting() {
38
+ return ['ec_name', 'excerpt'].includes(this.field);
39
+ }
40
+ render() {
41
+ const productValueAsString = getStringValueFromProductOrNull(this.product, this.field);
42
+ if (productValueAsString === null) {
43
+ return (h(ItemTextFallback, { field: this.field, host: this.host, logger: this.bindings.engine.logger, defaultValue: this.default, item: this.product, getProperty: ProductTemplatesHelpers.getProductProperty }, h("atomic-commerce-text", { value: getFieldValueCaption(this.field, this.default, this.bindings.i18n) })));
44
+ }
45
+ const textValue = `${productValueAsString}`;
46
+ const highlightKeywords = ProductTemplatesHelpers.getProductProperty(this.product, this.field === 'ec_name' ? 'nameHighlights' : 'excerptHighlights');
47
+ return this.shouldRenderHighlights && highlightKeywords ? (h(ItemTextHighlighted, { textValue: textValue, highlightKeywords: highlightKeywords, highlightString: HighlightUtils.highlightString, onError: (error) => (this.error = error) })) : (h("atomic-commerce-text", { value: getFieldValueCaption(this.field, textValue, this.bindings.i18n) }));
48
+ }
49
+ get host() { return this; }
50
+ }, [0, "atomic-product-text", {
51
+ "field": [513],
52
+ "shouldHighlight": [516, "should-highlight"],
53
+ "default": [513],
54
+ "error": [32]
55
+ }]);
56
+ __decorate([
57
+ InitializeBindings()
58
+ ], AtomicProductText.prototype, "bindings", void 0);
59
+ __decorate([
60
+ ProductContext()
61
+ ], AtomicProductText.prototype, "product", void 0);
62
+ function defineCustomElement() {
63
+ if (typeof customElements === "undefined") {
64
+ return;
65
+ }
66
+ const components = ["atomic-product-text", "atomic-commerce-text"];
67
+ components.forEach(tagName => { switch (tagName) {
68
+ case "atomic-product-text":
69
+ if (!customElements.get(tagName)) {
70
+ customElements.define(tagName, AtomicProductText);
71
+ }
72
+ break;
73
+ case "atomic-commerce-text":
74
+ if (!customElements.get(tagName)) {
75
+ defineCustomElement$1();
76
+ }
77
+ break;
78
+ } });
79
+ }
80
+
81
+ export { AtomicProductText as A, defineCustomElement as d };
82
+
83
+ //# sourceMappingURL=atomic-product-text2.js.map
@@ -0,0 +1 @@
1
+ {"file":"atomic-product-text2.js","mappings":";;;;;;;;;;;;;;;;;;;MAyBa,iBAAiB;;;;;;;;QAmBE,oBAAe,GAAG,IAAI,CAAC;;;+BAAL,IAAI;;;IAMpD,IAAY,sBAAsB;QAChC,OAAO,IAAI,CAAC,eAAe,IAAI,IAAI,CAAC,+BAA+B,EAAE,CAAC;KACvE;IAEM,+BAA+B;QACpC,OAAO,CA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4B;IAA5B,kBAAkB,EAAE;mDAAoC;AAG/B;IAAzB,cAAc,EAAE;kDAA2B;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/commerce/atomic-product-text/atomic-product-text.tsx"],"sourcesContent":["import {\n Product,\n ProductTemplatesHelpers,\n HighlightUtils,\n} from '@coveo/headless/commerce';\nimport {Component, h, Prop, Element, State} from '@stencil/core';\nimport {getFieldValueCaption} from '../../../utils/field-utils';\nimport {\n InitializableComponent,\n InitializeBindings,\n} from '../../../utils/initialization-utils';\nimport {ItemTextFallback} from '../../common/item-text/stencil-item-text-fallback';\nimport {ItemTextHighlighted} from '../../common/item-text/stencil-item-text-highlighted';\nimport {CommerceBindings} from '../atomic-commerce-interface/atomic-commerce-interface';\nimport {getStringValueFromProductOrNull} from '../product-template-component-utils/product-utils';\nimport {ProductContext} from '../product-template-component-utils/stencil-product-template-decorators';\n\n/**\n * @alpha\n * The `atomic-product-text` component renders the value of a string product field.\n */\n@Component({\n tag: 'atomic-product-text',\n shadow: false,\n})\nexport class AtomicProductText\n implements InitializableComponent<CommerceBindings>\n{\n @InitializeBindings() public bindings!: CommerceBindings;\n @State() public error!: Error;\n\n @ProductContext() private product!: Product;\n\n @Element() private host!: HTMLElement;\n\n /**\n * The product field which the component should use.\n * This will look in the Product object first, and then in the product.additionalFields object for the fields.\n */\n @Prop({reflect: true}) public field!: string;\n /**\n * When this is set to `true`, the component attempts to highlight text based on the highlighting properties provided by the search API response.\n * This property only works for the product excerpt and the ec_name field.\n */\n @Prop({reflect: true}) public shouldHighlight = true;\n /**\n * The locale key for the text to display when the configured field has no value.\n */\n @Prop({reflect: true}) public default?: string;\n\n private get shouldRenderHighlights() {\n return this.shouldHighlight && this.isFieldSupportedForHighlighting();\n }\n\n public isFieldSupportedForHighlighting() {\n return ['ec_name', 'excerpt'].includes(this.field);\n }\n\n public render() {\n const productValueAsString = getStringValueFromProductOrNull(\n this.product,\n this.field\n );\n\n if (productValueAsString === null) {\n return (\n <ItemTextFallback\n field={this.field}\n host={this.host}\n logger={this.bindings.engine.logger}\n defaultValue={this.default}\n item={this.product}\n getProperty={ProductTemplatesHelpers.getProductProperty}\n >\n <atomic-commerce-text\n value={getFieldValueCaption(\n this.field,\n this.default!,\n this.bindings.i18n\n )}\n ></atomic-commerce-text>\n </ItemTextFallback>\n );\n }\n\n const textValue = `${productValueAsString}`;\n const highlightKeywords = ProductTemplatesHelpers.getProductProperty(\n this.product,\n this.field === 'ec_name' ? 'nameHighlights' : 'excerptHighlights'\n ) as HighlightUtils.HighlightKeyword[];\n\n return this.shouldRenderHighlights && highlightKeywords ? (\n <ItemTextHighlighted\n textValue={textValue}\n highlightKeywords={highlightKeywords}\n highlightString={HighlightUtils.highlightString}\n onError={(error) => (this.error = error)}\n ></ItemTextHighlighted>\n ) : (\n <atomic-commerce-text\n value={getFieldValueCaption(this.field, textValue, this.bindings.i18n)}\n ></atomic-commerce-text>\n );\n }\n}\n"],"version":3}
@@ -37,7 +37,7 @@ const AtomicQueryError$1 = /*@__PURE__*/ proxyCustomElement(class AtomicQueryErr
37
37
  if (hasError) {
38
38
  this.ariaMessage = getAriaMessageFromErrorType(i18n, organizationId, url, error?.type);
39
39
  }
40
- return (h(QueryErrorGuard, { key: '35a365a208b92b8fd42190d0914c55941836a0d5', hasError: hasError }, h(QueryErrorContainer, { key: '4a9df9c210520543e6dd28dde603d92ef51eb12d' }, h(QueryErrorIcon, { key: '5acc15d972298c51b9a35899c72b21ec9921071f', errorType: error?.type }), h(QueryErrorTitle, { key: '69c204454af76de98e2ae5af3c480e28d9bcfd3f', errorType: error?.type, i18n: i18n, organizationId: organizationId }), h(QueryErrorDescription, { key: '5bc6f621410459203d5577024abcd2e017a24f77', i18n: i18n, organizationId: organizationId, url: url, errorType: error?.type }), h(QueryErrorShowMore, { key: 'c560a6af5df7c51424b647eacae1f66f29d94295', link: h(QueryErrorLink, { i18n: i18n, errorType: error?.type }), onShowMore: () => (this.showMoreInfo = !this.showMoreInfo), i18n: i18n }), h(QueryErrorDetails, { key: '9d1e8c102af5b43904b5dafad4f6e0c043a916d9', error: error, show: this.showMoreInfo }))));
40
+ return (h(QueryErrorGuard, { key: '26dc4664374c08161bb775ca53a0045186fabdb1', hasError: hasError }, h(QueryErrorContainer, { key: '61b6f5d82ba333cad580407f4127951b21ad0ed5' }, h(QueryErrorIcon, { key: 'fd4d208a2570f79f9bcc171b4dfa0e6be5176281', errorType: error?.type }), h(QueryErrorTitle, { key: '4a2171c1e90f02dd1470fb439f922a757205f173', errorType: error?.type, i18n: i18n, organizationId: organizationId }), h(QueryErrorDescription, { key: 'e9ba6206b743f5afa88b8d3b4c8886af17879ee7', i18n: i18n, organizationId: organizationId, url: url, errorType: error?.type }), h(QueryErrorShowMore, { key: 'fddf903db803e0521195218b81495f20b1a2e8db', link: h(QueryErrorLink, { i18n: i18n, errorType: error?.type }), onShowMore: () => (this.showMoreInfo = !this.showMoreInfo), i18n: i18n }), h(QueryErrorDetails, { key: '7e016b1225e77a5b5996924451af73763fe27ef6', error: error, show: this.showMoreInfo }))));
41
41
  }
42
42
  static get style() { return AtomicQueryErrorStyle0; }
43
43
  }, [1, "atomic-query-error", {
@@ -1 +1 @@
1
- {"file":"atomic-query-error.js","mappings":";;;;;;AAAA,MAAM,mBAAmB,GAAG,0u1DAA0u1D,CAAC;AACvw1D,+BAAe,mBAAmB;;;;;;;;;;;;MCsCrBA,kBAAgB;;;;;QAQlB,iBAAY,GAAG,KAAK,CAAC;;;4BAAN,KAAK;;IAKtB,UAAU;QACf,IAAI,CAAC,UAAU,GAAG,eAAe,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;KACzD;IAEM,MAAM;QACX,MAAM,EAAC,QAAQ,EAAE,KAAK,EAAC,GAAG,IAAI,CAAC,eAAe,CAAC;QAC/C,MAAM,EACJ,QAAQ,EAAE,EACR,IAAI,EACJ,MAAM,EAAE,EACN,KAAK,EAAE,EACL,aAAa,EAAE,EAAC,cAAc,EAAE,WAAW,EAAC,GAC7C,GACF,GACF,GACF,GAAG,IAAI,CAAC;QACT,MAAM,GAAG,GAAG,uBAAuB,CAAC,cAAc,EAAE,WAAW,CAAC,CAAC;QACjE,IAAI,QAAQ,EAAE;YACZ,IAAI,CAAC,WAAW,GAAG,2BAA2B,CAC5C,IAAI,EACJ,cAAc,EACd,GAAG,EACH,KAAK,EAAE,IAAI,CACZ,CAAC;SACH;QACD,QACE,EAAC,eAAe,qDAAC,QAAQ,EAAE,QAAQ,IACjC,EAAC,mBAAmB,uDAClB,EAAC,cAAc,qDAAC,SAAS,EAAE,KAAK,EAAE,IAAI,GAAI,EAC1C,EAAC,eAAe,qDACd,SAAS,EAAE,KAAK,EAAE,IAAI,EACtB,IAAI,EAAE,IAAI,EACV,cAAc,EAAE,cAAc,GAC9B,EACF,EAAC,qBAAqB,qDACpB,IAAI,EAAE,IAAI,EACV,cAAc,EAAE,cAAc,EAC9B,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,KAAK,EAAE,IAAI,GACtB,EACF,EAAC,kBAAkB,qDACjB,IAAI,EAAE,EAAC,cAAc,IAAC,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,GAAI,EAC5D,UAAU,EAAE,OAAO,IAAI,CAAC,YAAY,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC,EAC1D,IAAI,EAAE,IAAI,GACV,EACF,EAAC,iBAAiB,qDAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,YAAY,GAAI,CACxC,CACN,EAClB;KACH;;;;;;;AA7D4B;IAA5B,kBAAkB,EAAE;oDAA4B;AAKzC;IAFP,qBAAqB,CAAC,YAAY,CAAC;2DAEM;AAKhC;IADT,cAAc,CAAC,aAAa,CAAC;uDACC;;;;;;;;;;;;;;;;;;;;","names":["AtomicQueryError"],"sources":["src/components/search/atomic-query-error/atomic-query-error.pcss?tag=atomic-query-error&encapsulation=shadow","src/components/search/atomic-query-error/atomic-query-error.tsx"],"sourcesContent":["@import '../../../global/global.pcss';\n","import {\n QueryError,\n QueryErrorState,\n buildQueryError,\n getOrganizationEndpoint,\n} from '@coveo/headless';\nimport {Component, h, State} from '@stencil/core';\nimport {\n BindStateToController,\n InitializableComponent,\n InitializeBindings,\n} from '../../../utils/initialization-utils';\nimport {AriaLiveRegion} from '../../../utils/stencil-accessibility-utils';\nimport {QueryErrorDetails} from '../../common/query-error/stencil-details';\nimport {QueryErrorIcon} from '../../common/query-error/stencil-icon';\nimport {QueryErrorShowMore} from '../../common/query-error/stencil-show-more';\nimport {QueryErrorContainer} from '../../common/query-error/stencil-container';\nimport {QueryErrorDescription} from '../../common/query-error/stencil-description';\nimport {QueryErrorGuard} from '../../common/query-error/stencil-guard';\nimport {QueryErrorTitle} from '../../common/query-error/stencil-title';\nimport {getAriaMessageFromErrorType} from '../../common/query-error/utils';\nimport {Bindings} from '../atomic-search-interface/atomic-search-interface';\nimport {QueryErrorLink} from '../../common/query-error/stencil-link';\n\n/**\n * The `atomic-query-error` component handles fatal errors when performing a query on the index or Search API. When the error is known, it displays a link to relevant documentation link for debugging purposes. When the error is unknown, it displays a small text area with the JSON content of the error.\n *\n * @part icon - The svg related to the error.\n * @part title - The title of the error.\n * @part description - A description of the error.\n * @part doc-link - A link to the relevant documentation.\n * @part more-info-btn - A button to request additional error information.\n * @part error-info - Additional error information.\n */\n@Component({\n tag: 'atomic-query-error',\n styleUrl: 'atomic-query-error.pcss',\n shadow: true,\n})\nexport class AtomicQueryError implements InitializableComponent {\n @InitializeBindings() public bindings!: Bindings;\n public queryError!: QueryError;\n\n @BindStateToController('queryError')\n @State()\n private queryErrorState!: QueryErrorState;\n @State() public error!: Error;\n @State() showMoreInfo = false;\n\n @AriaLiveRegion('query-error')\n protected ariaMessage!: string;\n\n public initialize() {\n this.queryError = buildQueryError(this.bindings.engine);\n }\n\n public render() {\n const {hasError, error} = this.queryErrorState;\n const {\n bindings: {\n i18n,\n engine: {\n state: {\n configuration: {organizationId, environment},\n },\n },\n },\n } = this;\n const url = getOrganizationEndpoint(organizationId, environment);\n if (hasError) {\n this.ariaMessage = getAriaMessageFromErrorType(\n i18n,\n organizationId,\n url,\n error?.type\n );\n }\n return (\n <QueryErrorGuard hasError={hasError}>\n <QueryErrorContainer>\n <QueryErrorIcon errorType={error?.type} />\n <QueryErrorTitle\n errorType={error?.type}\n i18n={i18n}\n organizationId={organizationId}\n />\n <QueryErrorDescription\n i18n={i18n}\n organizationId={organizationId}\n url={url}\n errorType={error?.type}\n />\n <QueryErrorShowMore\n link={<QueryErrorLink i18n={i18n} errorType={error?.type} />}\n onShowMore={() => (this.showMoreInfo = !this.showMoreInfo)}\n i18n={i18n}\n />\n <QueryErrorDetails error={error} show={this.showMoreInfo} />\n </QueryErrorContainer>\n </QueryErrorGuard>\n );\n }\n}\n"],"version":3}
1
+ {"file":"atomic-query-error.js","mappings":";;;;;;AAAA,MAAM,mBAAmB,GAAG,0u1DAA0u1D,CAAC;AACvw1D,+BAAe,mBAAmB;;;;;;;;;;;;MCsCrBA,kBAAgB;;;;;QAQlB,iBAAY,GAAG,KAAK,CAAC;;;4BAAN,KAAK;;IAKtB,UAAU;QACf,IAAI,CAAC,UAAU,GAAG,eAAe,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;KACzD;IAEM,MAAM;QACX,MAAM,EAAC,QAAQ,EAAE,KAAK,EAAC,GAAG,IAAI,CAAC,eAAe,CAAC;QAC/C,MAAM,EACJ,QAAQ,EAAE,EACR,IAAI,EACJ,MAAM,EAAE,EACN,KAAK,EAAE,EACL,aAAa,EAAE,EAAC,cAAc,EAAE,WAAW,EAAC,GAC7C,GACF,GACF,GACF,GAAG,IAAI,CAAC;QACT,MAAM,GAAG,GAAG,uBAAuB,CAAC,cAAc,EAAE,WAAW,CAAC,CAAC;QACjE,IAAI,QAAQ,EAAE;YACZ,IAAI,CAAC,WAAW,GAAG,2BAA2B,CAC5C,IAAI,EACJ,cAAc,EACd,GAAG,EACH,KAAK,EAAE,IAAI,CACZ,CAAC;SACH;QACD,QACE,EAAC,eAAe,qDAAC,QAAQ,EAAE,QAAQ,IACjC,EAAC,mBAAmB,uDAClB,EAAC,cAAc,qDAAC,SAAS,EAAE,KAAK,EAAE,IAAI,GAAI,EAC1C,EAAC,eAAe,qDACd,SAAS,EAAE,KAAK,EAAE,IAAI,EACtB,IAAI,EAAE,IAAI,EACV,cAAc,EAAE,cAAc,GAC9B,EACF,EAAC,qBAAqB,qDACpB,IAAI,EAAE,IAAI,EACV,cAAc,EAAE,cAAc,EAC9B,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,KAAK,EAAE,IAAI,GACtB,EACF,EAAC,kBAAkB,qDACjB,IAAI,EAAE,EAAC,cAAc,IAAC,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,GAAI,EAC5D,UAAU,EAAE,OAAO,IAAI,CAAC,YAAY,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC,EAC1D,IAAI,EAAE,IAAI,GACV,EACF,EAAC,iBAAiB,qDAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,YAAY,GAAI,CACxC,CACN,EAClB;KACH;;;;;;;AA7D4B;IAA5B,kBAAkB,EAAE;oDAA4B;AAKzC;IAFP,qBAAqB,CAAC,YAAY,CAAC;2DAEM;AAKhC;IADT,cAAc,CAAC,aAAa,CAAC;uDACC;;;;;;;;;;;;;;;;;;;;","names":["AtomicQueryError"],"sources":["src/components/search/atomic-query-error/atomic-query-error.pcss?tag=atomic-query-error&encapsulation=shadow","src/components/search/atomic-query-error/atomic-query-error.tsx"],"sourcesContent":["@import '../../../global/global.pcss';\n","import {\n QueryError,\n QueryErrorState,\n buildQueryError,\n getOrganizationEndpoint,\n} from '@coveo/headless';\nimport {Component, h, State} from '@stencil/core';\nimport {\n BindStateToController,\n InitializableComponent,\n InitializeBindings,\n} from '../../../utils/initialization-utils';\nimport {AriaLiveRegion} from '../../../utils/stencil-accessibility-utils';\nimport {QueryErrorDetails} from '../../common/query-error/stencil-details';\nimport {QueryErrorIcon} from '../../common/query-error/stencil-icon';\nimport {QueryErrorShowMore} from '../../common/query-error/show-more';\nimport {QueryErrorContainer} from '../../common/query-error/stencil-container';\nimport {QueryErrorDescription} from '../../common/query-error/stencil-description';\nimport {QueryErrorGuard} from '../../common/query-error/stencil-guard';\nimport {QueryErrorTitle} from '../../common/query-error/stencil-title';\nimport {getAriaMessageFromErrorType} from '../../common/query-error/utils';\nimport {Bindings} from '../atomic-search-interface/atomic-search-interface';\nimport {QueryErrorLink} from '../../common/query-error/stencil-link';\n\n/**\n * The `atomic-query-error` component handles fatal errors when performing a query on the index or Search API. When the error is known, it displays a link to relevant documentation link for debugging purposes. When the error is unknown, it displays a small text area with the JSON content of the error.\n *\n * @part icon - The svg related to the error.\n * @part title - The title of the error.\n * @part description - A description of the error.\n * @part doc-link - A link to the relevant documentation.\n * @part more-info-btn - A button to request additional error information.\n * @part error-info - Additional error information.\n */\n@Component({\n tag: 'atomic-query-error',\n styleUrl: 'atomic-query-error.pcss',\n shadow: true,\n})\nexport class AtomicQueryError implements InitializableComponent {\n @InitializeBindings() public bindings!: Bindings;\n public queryError!: QueryError;\n\n @BindStateToController('queryError')\n @State()\n private queryErrorState!: QueryErrorState;\n @State() public error!: Error;\n @State() showMoreInfo = false;\n\n @AriaLiveRegion('query-error')\n protected ariaMessage!: string;\n\n public initialize() {\n this.queryError = buildQueryError(this.bindings.engine);\n }\n\n public render() {\n const {hasError, error} = this.queryErrorState;\n const {\n bindings: {\n i18n,\n engine: {\n state: {\n configuration: {organizationId, environment},\n },\n },\n },\n } = this;\n const url = getOrganizationEndpoint(organizationId, environment);\n if (hasError) {\n this.ariaMessage = getAriaMessageFromErrorType(\n i18n,\n organizationId,\n url,\n error?.type\n );\n }\n return (\n <QueryErrorGuard hasError={hasError}>\n <QueryErrorContainer>\n <QueryErrorIcon errorType={error?.type} />\n <QueryErrorTitle\n errorType={error?.type}\n i18n={i18n}\n organizationId={organizationId}\n />\n <QueryErrorDescription\n i18n={i18n}\n organizationId={organizationId}\n url={url}\n errorType={error?.type}\n />\n <QueryErrorShowMore\n link={<QueryErrorLink i18n={i18n} errorType={error?.type} />}\n onShowMore={() => (this.showMoreInfo = !this.showMoreInfo)}\n i18n={i18n}\n />\n <QueryErrorDetails error={error} show={this.showMoreInfo} />\n </QueryErrorContainer>\n </QueryErrorGuard>\n );\n }\n}\n"],"version":3}
@@ -39,7 +39,7 @@ const AtomicRecsError$1 = /*@__PURE__*/ proxyCustomElement(class AtomicRecsError
39
39
  if (hasError) {
40
40
  this.ariaMessage = getAriaMessageFromErrorType(i18n, organizationId, url, error?.type);
41
41
  }
42
- return (h(QueryErrorGuard, { key: '1dca8ab41bdb8a71f1936cf1751fb6017c7c9fad', hasError: hasError }, h(QueryErrorContainer, { key: '711d860dbc6085ed9d3f03fd254865826c9fb897' }, h(QueryErrorIcon, { key: '35a3e19666aa1e38cd41ad11503c56ba0b926ce8', errorType: error?.type }), h(QueryErrorTitle, { key: '6987ab69f7a8a87a5615ccc8cde9c2a34db48e91', i18n: i18n, organizationId: organizationId }), h(QueryErrorDescription, { key: '368140552841c3094bb81c469f58dc59bc1341b7', i18n: i18n, organizationId: organizationId, url: url }), h(QueryErrorShowMore, { key: '9f13261f6873e200f96c2a39fa4da506e7f762f8', link: h(QueryErrorLink, { i18n: i18n, errorType: error?.type }), onShowMore: () => (this.showMoreInfo = !this.showMoreInfo), i18n: i18n }), h(QueryErrorDetails, { key: 'da03ee81b4af216551f847592b4c49d478f35d50', error: error, show: this.showMoreInfo }))));
42
+ return (h(QueryErrorGuard, { key: 'd8bf88c0765b006ace1c7bb2001e50a4fd68e60b', hasError: hasError }, h(QueryErrorContainer, { key: '9d090c7bdb6121cf5f3874f83311c26cdde33161' }, h(QueryErrorIcon, { key: 'b698891b5953206a24f1524a33f34a983c32d964', errorType: error?.type }), h(QueryErrorTitle, { key: '7b207a23844cbef05b0c14d54236f7982657bf51', i18n: i18n, organizationId: organizationId }), h(QueryErrorDescription, { key: '99354b724cc375b7a85e2bdfb888ef2c42f3e047', i18n: i18n, organizationId: organizationId, url: url }), h(QueryErrorShowMore, { key: '91e986ef09c90ba077655b02c9fc488d3d6de663', link: h(QueryErrorLink, { i18n: i18n, errorType: error?.type }), onShowMore: () => (this.showMoreInfo = !this.showMoreInfo), i18n: i18n }), h(QueryErrorDetails, { key: '91987a97ae0547beb729d40f8f98c781bf5e06c0', error: error, show: this.showMoreInfo }))));
43
43
  }
44
44
  static get style() { return AtomicRecsErrorStyle0; }
45
45
  }, [1, "atomic-recs-error", {
@@ -1 +1 @@
1
- {"file":"atomic-recs-error.js","mappings":";;;;;;;AAAA,MAAM,kBAAkB,GAAG,0u1DAA0u1D,CAAC;AACtw1D,8BAAe,kBAAkB;;;;;;;;;;;;MCuCpBA,iBAAe;;;;;QAQjB,iBAAY,GAAG,KAAK,CAAC;;;4BAAN,KAAK;;IAKtB,UAAU;QACf,IAAI,CAAC,kBAAkB,GAAG,uBAAuB,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;KACzE;IAEM,MAAM;QACX,MAAM,EAAC,KAAK,EAAC,GAAG,IAAI,CAAC,uBAAuB,CAAC;QAE7C,MAAM,EACJ,QAAQ,EAAE,EACR,IAAI,EACJ,MAAM,EAAE,EACN,KAAK,EAAE,EACL,aAAa,EAAE,EAAC,cAAc,EAAE,WAAW,EAAC,GAC7C,GACF,GACF,GACF,GAAG,IAAI,CAAC;QACT,MAAM,GAAG,GAAG,uBAAuB,CAAC,cAAc,EAAE,WAAW,CAAC,CAAC;QACjE,MAAM,QAAQ,GAAG,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;QAE3C,IAAI,QAAQ,EAAE;YACZ,IAAI,CAAC,WAAW,GAAG,2BAA2B,CAC5C,IAAI,EACJ,cAAc,EACd,GAAG,EACH,KAAK,EAAE,IAAI,CACZ,CAAC;SACH;QAED,QACE,EAAC,eAAe,qDAAC,QAAQ,EAAE,QAAQ,IACjC,EAAC,mBAAmB,uDAClB,EAAC,cAAc,qDAAC,SAAS,EAAE,KAAK,EAAE,IAAI,GAAI,EAC1C,EAAC,eAAe,qDAAC,IAAI,EAAE,IAAI,EAAE,cAAc,EAAE,cAAc,GAAI,EAC/D,EAAC,qBAAqB,qDACpB,IAAI,EAAE,IAAI,EACV,cAAc,EAAE,cAAc,EAC9B,GAAG,EAAE,GAAG,GACR,EACF,EAAC,kBAAkB,qDACjB,IAAI,EAAE,EAAC,cAAc,IAAC,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,GAAI,EAC5D,UAAU,EAAE,OAAO,IAAI,CAAC,YAAY,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC,EAC1D,IAAI,EAAE,IAAI,GACV,EACF,EAAC,iBAAiB,qDAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,YAAY,GAAI,CACxC,CACN,EAClB;KACH;;;;;;;AA5D4B;IAA5B,kBAAkB,EAAE;mDAAgC;AAK9C;IAFN,qBAAqB,CAAC,oBAAoB,CAAC;kEAEa;AAK/C;IADT,cAAc,CAAC,YAAY,CAAC;sDACE;;;;;;;;;;;;;;;;;;;;","names":["AtomicRecsError"],"sources":["src/components/recommendations/atomic-recs-error/atomic-recs-error.pcss?tag=atomic-recs-error&encapsulation=shadow","src/components/recommendations/atomic-recs-error/atomic-recs-error.tsx"],"sourcesContent":["@import '../../../global/global.pcss';\n","import {isNullOrUndefined} from '@coveo/bueno';\nimport {\n buildRecommendationList,\n getOrganizationEndpoint,\n RecommendationList,\n RecommendationListState,\n} from '@coveo/headless/recommendation';\nimport {Component, h, State} from '@stencil/core';\nimport {\n BindStateToController,\n InitializableComponent,\n InitializeBindings,\n} from '../../../utils/initialization-utils';\nimport {AriaLiveRegion} from '../../../utils/stencil-accessibility-utils';\nimport {QueryErrorDetails} from '../../common/query-error/stencil-details';\nimport {QueryErrorIcon} from '../../common/query-error/stencil-icon';\nimport {QueryErrorShowMore} from '../../common/query-error/stencil-show-more';\nimport {QueryErrorContainer} from '../../common/query-error/stencil-container';\nimport {QueryErrorDescription} from '../../common/query-error/stencil-description';\nimport {QueryErrorGuard} from '../../common/query-error/stencil-guard';\nimport {QueryErrorTitle} from '../../common/query-error/stencil-title';\nimport {getAriaMessageFromErrorType} from '../../common/query-error/utils';\nimport {RecsBindings} from '../atomic-recs-interface/atomic-recs-interface';\nimport {QueryErrorLink} from '../../common/query-error/stencil-link';\n\n/**\n * The `atomic-recs-error` component handles fatal errors when performing a recommendations request on the index or Search API. When the error is known, it displays a link to relevant documentation link for debugging purposes. When the error is unknown, it displays a small text area with the JSON content of the error.\n *\n * @part icon - The svg related to the error.\n * @part title - The title of the error.\n * @part description - A description of the error.\n * @part doc-link - A link to the relevant documentation.\n * @part more-info-btn - A button to request additional error information.\n * @part error-info - Additional error information.\n */\n@Component({\n tag: 'atomic-recs-error',\n styleUrl: 'atomic-recs-error.pcss',\n shadow: true,\n})\nexport class AtomicRecsError implements InitializableComponent<RecsBindings> {\n @InitializeBindings() public bindings!: RecsBindings;\n public recommendationList!: RecommendationList;\n\n @BindStateToController('recommendationList')\n @State()\n public recommendationListState!: RecommendationListState;\n @State() public error!: Error;\n @State() showMoreInfo = false;\n\n @AriaLiveRegion('recs-error')\n protected ariaMessage!: string;\n\n public initialize() {\n this.recommendationList = buildRecommendationList(this.bindings.engine);\n }\n\n public render() {\n const {error} = this.recommendationListState;\n\n const {\n bindings: {\n i18n,\n engine: {\n state: {\n configuration: {organizationId, environment},\n },\n },\n },\n } = this;\n const url = getOrganizationEndpoint(organizationId, environment);\n const hasError = !isNullOrUndefined(error);\n\n if (hasError) {\n this.ariaMessage = getAriaMessageFromErrorType(\n i18n,\n organizationId,\n url,\n error?.type\n );\n }\n\n return (\n <QueryErrorGuard hasError={hasError}>\n <QueryErrorContainer>\n <QueryErrorIcon errorType={error?.type} />\n <QueryErrorTitle i18n={i18n} organizationId={organizationId} />\n <QueryErrorDescription\n i18n={i18n}\n organizationId={organizationId}\n url={url}\n />\n <QueryErrorShowMore\n link={<QueryErrorLink i18n={i18n} errorType={error?.type} />}\n onShowMore={() => (this.showMoreInfo = !this.showMoreInfo)}\n i18n={i18n}\n />\n <QueryErrorDetails error={error} show={this.showMoreInfo} />\n </QueryErrorContainer>\n </QueryErrorGuard>\n );\n }\n}\n"],"version":3}
1
+ {"file":"atomic-recs-error.js","mappings":";;;;;;;AAAA,MAAM,kBAAkB,GAAG,0u1DAA0u1D,CAAC;AACtw1D,8BAAe,kBAAkB;;;;;;;;;;;;MCuCpBA,iBAAe;;;;;QAQjB,iBAAY,GAAG,KAAK,CAAC;;;4BAAN,KAAK;;IAKtB,UAAU;QACf,IAAI,CAAC,kBAAkB,GAAG,uBAAuB,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;KACzE;IAEM,MAAM;QACX,MAAM,EAAC,KAAK,EAAC,GAAG,IAAI,CAAC,uBAAuB,CAAC;QAE7C,MAAM,EACJ,QAAQ,EAAE,EACR,IAAI,EACJ,MAAM,EAAE,EACN,KAAK,EAAE,EACL,aAAa,EAAE,EAAC,cAAc,EAAE,WAAW,EAAC,GAC7C,GACF,GACF,GACF,GAAG,IAAI,CAAC;QACT,MAAM,GAAG,GAAG,uBAAuB,CAAC,cAAc,EAAE,WAAW,CAAC,CAAC;QACjE,MAAM,QAAQ,GAAG,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;QAE3C,IAAI,QAAQ,EAAE;YACZ,IAAI,CAAC,WAAW,GAAG,2BAA2B,CAC5C,IAAI,EACJ,cAAc,EACd,GAAG,EACH,KAAK,EAAE,IAAI,CACZ,CAAC;SACH;QAED,QACE,EAAC,eAAe,qDAAC,QAAQ,EAAE,QAAQ,IACjC,EAAC,mBAAmB,uDAClB,EAAC,cAAc,qDAAC,SAAS,EAAE,KAAK,EAAE,IAAI,GAAI,EAC1C,EAAC,eAAe,qDAAC,IAAI,EAAE,IAAI,EAAE,cAAc,EAAE,cAAc,GAAI,EAC/D,EAAC,qBAAqB,qDACpB,IAAI,EAAE,IAAI,EACV,cAAc,EAAE,cAAc,EAC9B,GAAG,EAAE,GAAG,GACR,EACF,EAAC,kBAAkB,qDACjB,IAAI,EAAE,EAAC,cAAc,IAAC,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,GAAI,EAC5D,UAAU,EAAE,OAAO,IAAI,CAAC,YAAY,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC,EAC1D,IAAI,EAAE,IAAI,GACV,EACF,EAAC,iBAAiB,qDAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,YAAY,GAAI,CACxC,CACN,EAClB;KACH;;;;;;;AA5D4B;IAA5B,kBAAkB,EAAE;mDAAgC;AAK9C;IAFN,qBAAqB,CAAC,oBAAoB,CAAC;kEAEa;AAK/C;IADT,cAAc,CAAC,YAAY,CAAC;sDACE;;;;;;;;;;;;;;;;;;;;","names":["AtomicRecsError"],"sources":["src/components/recommendations/atomic-recs-error/atomic-recs-error.pcss?tag=atomic-recs-error&encapsulation=shadow","src/components/recommendations/atomic-recs-error/atomic-recs-error.tsx"],"sourcesContent":["@import '../../../global/global.pcss';\n","import {isNullOrUndefined} from '@coveo/bueno';\nimport {\n buildRecommendationList,\n getOrganizationEndpoint,\n RecommendationList,\n RecommendationListState,\n} from '@coveo/headless/recommendation';\nimport {Component, h, State} from '@stencil/core';\nimport {\n BindStateToController,\n InitializableComponent,\n InitializeBindings,\n} from '../../../utils/initialization-utils';\nimport {AriaLiveRegion} from '../../../utils/stencil-accessibility-utils';\nimport {QueryErrorDetails} from '../../common/query-error/stencil-details';\nimport {QueryErrorIcon} from '../../common/query-error/stencil-icon';\nimport {QueryErrorShowMore} from '../../common/query-error/show-more';\nimport {QueryErrorContainer} from '../../common/query-error/stencil-container';\nimport {QueryErrorDescription} from '../../common/query-error/stencil-description';\nimport {QueryErrorGuard} from '../../common/query-error/stencil-guard';\nimport {QueryErrorTitle} from '../../common/query-error/stencil-title';\nimport {getAriaMessageFromErrorType} from '../../common/query-error/utils';\nimport {RecsBindings} from '../atomic-recs-interface/atomic-recs-interface';\nimport {QueryErrorLink} from '../../common/query-error/stencil-link';\n\n/**\n * The `atomic-recs-error` component handles fatal errors when performing a recommendations request on the index or Search API. When the error is known, it displays a link to relevant documentation link for debugging purposes. When the error is unknown, it displays a small text area with the JSON content of the error.\n *\n * @part icon - The svg related to the error.\n * @part title - The title of the error.\n * @part description - A description of the error.\n * @part doc-link - A link to the relevant documentation.\n * @part more-info-btn - A button to request additional error information.\n * @part error-info - Additional error information.\n */\n@Component({\n tag: 'atomic-recs-error',\n styleUrl: 'atomic-recs-error.pcss',\n shadow: true,\n})\nexport class AtomicRecsError implements InitializableComponent<RecsBindings> {\n @InitializeBindings() public bindings!: RecsBindings;\n public recommendationList!: RecommendationList;\n\n @BindStateToController('recommendationList')\n @State()\n public recommendationListState!: RecommendationListState;\n @State() public error!: Error;\n @State() showMoreInfo = false;\n\n @AriaLiveRegion('recs-error')\n protected ariaMessage!: string;\n\n public initialize() {\n this.recommendationList = buildRecommendationList(this.bindings.engine);\n }\n\n public render() {\n const {error} = this.recommendationListState;\n\n const {\n bindings: {\n i18n,\n engine: {\n state: {\n configuration: {organizationId, environment},\n },\n },\n },\n } = this;\n const url = getOrganizationEndpoint(organizationId, environment);\n const hasError = !isNullOrUndefined(error);\n\n if (hasError) {\n this.ariaMessage = getAriaMessageFromErrorType(\n i18n,\n organizationId,\n url,\n error?.type\n );\n }\n\n return (\n <QueryErrorGuard hasError={hasError}>\n <QueryErrorContainer>\n <QueryErrorIcon errorType={error?.type} />\n <QueryErrorTitle i18n={i18n} organizationId={organizationId} />\n <QueryErrorDescription\n i18n={i18n}\n organizationId={organizationId}\n url={url}\n />\n <QueryErrorShowMore\n link={<QueryErrorLink i18n={i18n} errorType={error?.type} />}\n onShowMore={() => (this.showMoreInfo = !this.showMoreInfo)}\n i18n={i18n}\n />\n <QueryErrorDetails error={error} show={this.showMoreInfo} />\n </QueryErrorContainer>\n </QueryErrorGuard>\n );\n }\n}\n"],"version":3}
@@ -1,55 +1,12 @@
1
- import { h, Fragment, Host, proxyCustomElement, HTMLElement } from '@stencil/core/internal/client';
1
+ import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
2
2
  import { ResultTemplatesHelpers, HighlightUtils } from '@coveo/headless';
3
3
  import { g as getFieldValueCaption } from './field-utils.js';
4
4
  import { I as InitializeBindings } from './initialization-utils.js';
5
5
  import { g as getStringValueFromResultOrNull } from './result-utils.js';
6
- import { isArray, isUndefined } from '@coveo/bueno';
6
+ import { I as ItemTextFallback, a as ItemTextHighlighted } from './stencil-item-text-highlighted.js';
7
7
  import { R as ResultContext } from './result-template-decorators.js';
8
8
  import { d as defineCustomElement$1 } from './atomic-text2.js';
9
9
 
10
- function possiblyWarnOnBadFieldType(field, itemValueRaw, host, logger) {
11
- if (isArray(itemValueRaw)) {
12
- logger.error(`${host.nodeName.toLowerCase()} cannot be used with multi value field "${field}" with values "${itemValueRaw}".`, host);
13
- }
14
- }
15
-
16
- const ItemTextFallback = ({ field, host, logger, defaultValue, item, getProperty }, children) => {
17
- const raw = getProperty(item, field);
18
- possiblyWarnOnBadFieldType(field, raw, host, logger);
19
- if (isUndefined(defaultValue)) {
20
- host.remove();
21
- return null;
22
- }
23
- else {
24
- return h(Fragment, null, children);
25
- }
26
- };
27
-
28
- function renderWithHighlights(value, highlights, highlightString) {
29
- const openingDelimiter = '_openingDelimiter_';
30
- const closingDelimiter = '_closingDelimiter_';
31
- const highlightedValue = highlightString({
32
- content: value,
33
- openingDelimiter,
34
- closingDelimiter,
35
- highlights,
36
- });
37
- return highlightedValue
38
- .replace(new RegExp(openingDelimiter, 'g'), '<b>')
39
- .replace(new RegExp(closingDelimiter, 'g'), '</b>');
40
- }
41
-
42
- const ItemTextHighlighted = ({ highlightKeywords, highlightString, onError, textValue }) => {
43
- try {
44
- const highlightedValue = renderWithHighlights(textValue, highlightKeywords, highlightString);
45
- // deepcode ignore ReactSetInnerHtml: This is not React code
46
- return h(Host, { innerHTML: highlightedValue });
47
- }
48
- catch (error) {
49
- onError(error);
50
- }
51
- };
52
-
53
10
  var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
54
11
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
55
12
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
@@ -1 +1 @@
1
- {"file":"atomic-result-text2.js","mappings":";;;;;;;;;SAEgB,0BAA0B,CACxC,KAAa,EACb,YAAqB,EACrB,IAAiB,EACjB,MAA8B;IAE9B,IAAI,OAAO,CAAC,YAAY,CAAC,EAAE;QACzB,MAAM,CAAC,KAAK,CACV,GAAG,IAAI,CAAC,QAAQ,CAAC,WAAW,EAAE,2CAA2C,KAAK,kBAAkB,YAAY,IAAI,EAChH,IAAI,CACL,CAAC;KACH;AACH;;ACDO,MAAM,gBAAgB,GAAG,CAC9B,EAAC,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,IAAI,EAAE,WAAW,EAAmB,EACxE,QAAiB;IAEjB,MAAM,GAAG,GAAG,WAAW,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IACrC,0BAA0B,CAAC,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;IAErD,IAAI,WAAW,CAAC,YAAY,CAAC,EAAE;QAC7B,IAAI,CAAC,MAAM,EAAE,CAAC;QACd,OAAO,IAAI,CAAC;KACb;SAAM;QACL,OAAO,EAAC,QAAQ,QAAE,QAAQ,CAAY,CAAC;KACxC;AACH,CAAC;;SCde,oBAAoB,CAClC,KAAa,EACb,UAA+B,EAC/B,eAAgC;IAEhC,MAAM,gBAAgB,GAAG,oBAAoB,CAAC;IAC9C,MAAM,gBAAgB,GAAG,oBAAoB,CAAC;IAC9C,MAAM,gBAAg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CAAC,IAAI,CACnB,GACY,CACE,EACnB;SACH;QAED,MAAM,SAAS,GAAG,GAAG,mBAAmB,EAAE,CAAC;QAC3C,MAAM,iBAAiB,GAAG,sBAAsB,CAAC,iBAAiB,CAChE,IAAI,CAAC,MAAM,EACX,GAAG,IAAI,CAAC,KAAK,YAAY,CACW,CAAC;QAEvC,OAAO,IAAI,CAAC,eAAe,IAAI,iBAAiB,IAC9C,EAAC,mBAAmB,IAClB,SAAS,EAAE,SAAS,EACpB,iBAAiB,EAAE,iBAAiB,EACpC,eAAe,EAAE,cAAc,CAAC,eAAe,EAC/C,OAAO,EAAE,CAAC,KAAK,MAAM,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,GACnB,KAEvB,oBAAoB,CAAC,IAAI,CAAC,KAAK,EAAE,SAAS,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAChE,CAAC;KACH;;;;;;;;AAlE4B;IAA5B,kBAAkB,EAAE;kDAA4B;AACxB;IAAxB,aAAa,EAAE;gDAAyB;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/common/item-text/field-warning.ts","src/components/common/item-text/stencil-item-text-fallback.tsx","src/components/common/item-text/render-highlights.ts","src/components/common/item-text/stencil-item-text-highlighted.tsx","src/components/search/result-template-components/atomic-result-text/atomic-result-text.tsx"],"sourcesContent":["import {isArray} from '@coveo/bueno';\n\nexport function possiblyWarnOnBadFieldType(\n field: string,\n itemValueRaw: unknown,\n host: HTMLElement,\n logger: Pick<Console, 'error'>\n) {\n if (isArray(itemValueRaw)) {\n logger.error(\n `${host.nodeName.toLowerCase()} cannot be used with multi value field \"${field}\" with values \"${itemValueRaw}\".`,\n host\n );\n }\n}\n","import {isUndefined} from '@coveo/bueno';\nimport {Fragment, FunctionalComponent, VNode, h} from '@stencil/core';\nimport {possiblyWarnOnBadFieldType} from './field-warning';\n\nexport interface ItemTextProps<T> {\n logger: Pick<Console, 'error'>;\n host: HTMLElement;\n defaultValue: string | undefined;\n field: string;\n item: T;\n getProperty: (result: T, property: string) => unknown;\n}\n\nexport const ItemTextFallback = <T,>(\n {field, host, logger, defaultValue, item, getProperty}: ItemTextProps<T>,\n children: VNode[]\n): FunctionalComponent<ItemTextProps<T>> | null => {\n const raw = getProperty(item, field);\n possiblyWarnOnBadFieldType(field, raw, host, logger);\n\n if (isUndefined(defaultValue)) {\n host.remove();\n return null;\n } else {\n return <Fragment>{children}</Fragment>;\n }\n};\n","export type HighlightKeywords = {\n offset: number;\n length: number;\n};\n\nexport type HighlightString = (params: {\n content: string;\n openingDelimiter: string;\n closingDelimiter: string;\n highlights: HighlightKeywords[];\n}) => string;\n\nexport function renderWithHighlights(\n value: string,\n highlights: HighlightKeywords[],\n highlightString: HighlightString\n) {\n const openingDelimiter = '_openingDelimiter_';\n const closingDelimiter = '_closingDelimiter_';\n const highlightedValue = highlightString({\n content: value,\n openingDelimiter,\n closingDelimiter,\n highlights,\n });\n return highlightedValue\n .replace(new RegExp(openingDelimiter, 'g'), '<b>')\n .replace(new RegExp(closingDelimiter, 'g'), '</b>');\n}\n","import {FunctionalComponent, h, Host} from '@stencil/core';\nimport {\n HighlightKeywords,\n HighlightString,\n renderWithHighlights,\n} from './render-highlights';\n\nexport interface ItemTextHighlightedProps {\n textValue: string;\n highlightKeywords: HighlightKeywords[];\n onError: (error: Error) => void;\n highlightString: HighlightString;\n}\n\nexport const ItemTextHighlighted: FunctionalComponent<\n ItemTextHighlightedProps\n> = ({highlightKeywords, highlightString, onError, textValue}) => {\n try {\n const highlightedValue = renderWithHighlights(\n textValue,\n highlightKeywords,\n highlightString\n );\n\n // deepcode ignore ReactSetInnerHtml: This is not React code\n return <Host innerHTML={highlightedValue}></Host>;\n } catch (error) {\n onError(error as Error);\n }\n};\n","import {HighlightUtils, Result, ResultTemplatesHelpers} from '@coveo/headless';\nimport {Component, Prop, h, Element, State} from '@stencil/core';\nimport {getFieldValueCaption} from '../../../../utils/field-utils';\nimport {\n InitializableComponent,\n InitializeBindings,\n} from '../../../../utils/initialization-utils';\nimport {getStringValueFromResultOrNull} from '../../../../utils/result-utils';\nimport {ItemTextFallback} from '../../../common/item-text/stencil-item-text-fallback';\nimport {ItemTextHighlighted} from '../../../common/item-text/stencil-item-text-highlighted';\nimport {Bindings} from '../../atomic-search-interface/atomic-search-interface';\nimport {ResultContext} from '../result-template-decorators';\n\n/**\n * The `atomic-result-text` component renders the value of a string result field.\n */\n@Component({\n tag: 'atomic-result-text',\n shadow: false,\n})\nexport class AtomicResultText implements InitializableComponent {\n @InitializeBindings() public bindings!: Bindings;\n @ResultContext() private result!: Result;\n\n @Element() private host!: HTMLElement;\n\n @State() public error!: Error;\n\n /**\n * The result field which the component should use.\n * This will look in the Result object first, and then in the Result.raw object for the fields.\n * It is important to include the necessary field in the `atomic-search-interface` component.\n */\n @Prop({reflect: true}) public field!: string;\n /**\n * When this is set to `true`, the component attempts to highlight text based on the highlighting properties provided by the search API response.\n */\n @Prop({reflect: true}) public shouldHighlight = true;\n\n /**\n * The locale key for the text to display when the configured field has no value.\n */\n @Prop({reflect: true}) public default?: string;\n\n public render() {\n const resultValueAsString = getStringValueFromResultOrNull(\n this.result,\n this.field\n );\n\n if (resultValueAsString === null) {\n return (\n <ItemTextFallback\n field={this.field}\n host={this.host}\n logger={this.bindings.engine.logger}\n defaultValue={this.default}\n item={this.result}\n getProperty={ResultTemplatesHelpers.getResultProperty}\n >\n <atomic-text\n value={getFieldValueCaption(\n this.field,\n this.default!,\n this.bindings.i18n\n )}\n ></atomic-text>\n </ItemTextFallback>\n );\n }\n\n const textValue = `${resultValueAsString}`;\n const highlightKeywords = ResultTemplatesHelpers.getResultProperty(\n this.result,\n `${this.field}Highlights`\n ) as HighlightUtils.HighlightKeyword[];\n\n return this.shouldHighlight && highlightKeywords ? (\n <ItemTextHighlighted\n textValue={textValue}\n highlightKeywords={highlightKeywords}\n highlightString={HighlightUtils.highlightString}\n onError={(error) => (this.error = error)}\n ></ItemTextHighlighted>\n ) : (\n getFieldValueCaption(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,CAAC;KACH;;;;;;;;AAlE4B;IAA5B,kBAAkB,EAAE;kDAA4B;AACxB;IAAxB,aAAa,EAAE;gDAAyB;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/search/result-template-components/atomic-result-text/atomic-result-text.tsx"],"sourcesContent":["import {HighlightUtils, Result, ResultTemplatesHelpers} from '@coveo/headless';\nimport {Component, Prop, h, Element, State} from '@stencil/core';\nimport {getFieldValueCaption} from '../../../../utils/field-utils';\nimport {\n InitializableComponent,\n InitializeBindings,\n} from '../../../../utils/initialization-utils';\nimport {getStringValueFromResultOrNull} from '../../../../utils/result-utils';\nimport {ItemTextFallback} from '../../../common/item-text/stencil-item-text-fallback';\nimport {ItemTextHighlighted} from '../../../common/item-text/stencil-item-text-highlighted';\nimport {Bindings} from '../../atomic-search-interface/atomic-search-interface';\nimport {ResultContext} from '../result-template-decorators';\n\n/**\n * The `atomic-result-text` component renders the value of a string result field.\n */\n@Component({\n tag: 'atomic-result-text',\n shadow: false,\n})\nexport class AtomicResultText implements InitializableComponent {\n @InitializeBindings() public bindings!: Bindings;\n @ResultContext() private result!: Result;\n\n @Element() private host!: HTMLElement;\n\n @State() public error!: Error;\n\n /**\n * The result field which the component should use.\n * This will look in the Result object first, and then in the Result.raw object for the fields.\n * It is important to include the necessary field in the `atomic-search-interface` component.\n */\n @Prop({reflect: true}) public field!: string;\n /**\n * When this is set to `true`, the component attempts to highlight text based on the highlighting properties provided by the search API response.\n */\n @Prop({reflect: true}) public shouldHighlight = true;\n\n /**\n * The locale key for the text to display when the configured field has no value.\n */\n @Prop({reflect: true}) public default?: string;\n\n public render() {\n const resultValueAsString = getStringValueFromResultOrNull(\n this.result,\n this.field\n );\n\n if (resultValueAsString === null) {\n return (\n <ItemTextFallback\n field={this.field}\n host={this.host}\n logger={this.bindings.engine.logger}\n defaultValue={this.default}\n item={this.result}\n getProperty={ResultTemplatesHelpers.getResultProperty}\n >\n <atomic-text\n value={getFieldValueCaption(\n this.field,\n this.default!,\n this.bindings.i18n\n )}\n ></atomic-text>\n </ItemTextFallback>\n );\n }\n\n const textValue = `${resultValueAsString}`;\n const highlightKeywords = ResultTemplatesHelpers.getResultProperty(\n this.result,\n `${this.field}Highlights`\n ) as HighlightUtils.HighlightKeyword[];\n\n return this.shouldHighlight && highlightKeywords ? (\n <ItemTextHighlighted\n textValue={textValue}\n highlightKeywords={highlightKeywords}\n highlightString={HighlightUtils.highlightString}\n onError={(error) => (this.error = error)}\n ></ItemTextHighlighted>\n ) : (\n getFieldValueCaption(this.field, textValue, this.bindings.i18n)\n );\n }\n}\n"],"version":3}
@@ -10,8 +10,6 @@ import { html, LitElement, nothing } from 'lit';
10
10
  import { property, customElement, state } from 'lit/decorators.js';
11
11
  import { makeMatchConditions } from '../../common/product-template/product-template-common';
12
12
  import { ProductTemplateController } from '../../common/product-template/product-template-controller';
13
- import '../atomic-commerce-text/atomic-commerce-text';
14
- import '../atomic-product-text/atomic-product-text';
15
13
  import '../atomic-product/atomic-product';
16
14
  /**
17
15
  * @alpha
@@ -13,7 +13,5 @@ export { AtomicCommerceSearchBoxInstantProducts } from './atomic-commerce-search
13
13
  export { AtomicCommerceSearchBoxQuerySuggestions } from './atomic-commerce-search-box-query-suggestions/atomic-commerce-search-box-query-suggestions.js';
14
14
  export { AtomicCommerceSearchBoxRecentQueries } from './atomic-commerce-search-box-recent-queries/atomic-commerce-search-box-recent-queries.js';
15
15
  export { AtomicCommerceSortDropdown } from './atomic-commerce-sort-dropdown/atomic-commerce-sort-dropdown.js';
16
- export { AtomicCommerceText } from './atomic-commerce-text/atomic-commerce-text.js';
17
16
  export { AtomicProduct } from './atomic-product/atomic-product.js';
18
17
  export { AtomicProductTemplate } from './atomic-product-template/atomic-product-template.js';
19
- export { AtomicProductText } from './atomic-product-text/atomic-product-text.js';
@@ -14,8 +14,6 @@ export default {
14
14
  'atomic-commerce-search-box-query-suggestions': async () => await import('./atomic-commerce-search-box-query-suggestions/atomic-commerce-search-box-query-suggestions.js'),
15
15
  'atomic-commerce-search-box-recent-queries': async () => await import('./atomic-commerce-search-box-recent-queries/atomic-commerce-search-box-recent-queries.js'),
16
16
  'atomic-commerce-sort-dropdown': async () => await import('./atomic-commerce-sort-dropdown/atomic-commerce-sort-dropdown.js'),
17
- 'atomic-commerce-text': async () => await import('./atomic-commerce-text/atomic-commerce-text.js'),
18
17
  'atomic-product': async () => await import('./atomic-product/atomic-product.js'),
19
18
  'atomic-product-template': async () => await import('./atomic-product-template/atomic-product-template.js'),
20
- 'atomic-product-text': async () => await import('./atomic-product-text/atomic-product-text.js'),
21
19
  };
@@ -1,4 +1,3 @@
1
1
  // Auto-generated file
2
2
  export { AtomicComponentError } from './atomic-component-error/atomic-component-error.js';
3
3
  export { AtomicIcon } from './atomic-icon/atomic-icon.js';
4
- export { AtomicLayoutSection } from './atomic-layout-section/atomic-layout-section.js';
@@ -2,5 +2,4 @@
2
2
  export default {
3
3
  'atomic-component-error': async () => await import('./atomic-component-error/atomic-component-error.js'),
4
4
  'atomic-icon': async () => await import('./atomic-icon/atomic-icon.js'),
5
- 'atomic-layout-section': async () => await import('./atomic-layout-section/atomic-layout-section.js'),
6
5
  };
@@ -33,4 +33,4 @@ const ExpandableText = ({ isExpanded, isTruncated, truncateAfter, onToggleExpand
33
33
 
34
34
  export { ExpandableText as E };
35
35
 
36
- //# sourceMappingURL=stencil-expandable-text.js.map
36
+ //# sourceMappingURL=expandable-text.js.map
@@ -0,0 +1 @@
1
+ {"file":"expandable-text.js","mappings":";;;;AAiBA,MAAM,iBAAiB,GAAG,CAAC,aAA4B;IACrD,MAAM,YAAY,GAAkC;QAClD,IAAI,EAAE,iBAAiB;QACvB,CAAC,EAAE,cAAc;QACjB,CAAC,EAAE,cAAc;QACjB,CAAC,EAAE,cAAc;QACjB,CAAC,EAAE,cAAc;KAClB,CAAC;IACF,OAAO,YAAY,CAAC,aAAa,CAAC,IAAI,cAAc,CAAC;AACvD,CAAC,CAAC;AAEF,MAAM,oBAAoB,GAAG,CAC3B,UAAmB,EACnB,WAAoB,EACpB,aAAsB,EACtB,cAAwC,EACxC,aAAqB,EACrB,aAAqB;IAErB,IAAI,WAAW,GAAG,0DAA0D,CAAC;IAC7E,IAAI,CAAC,WAAW,IAAI,CAAC,UAAU,EAAE;QAC/B,WAAW,IAAI,YAAY,CAAC;KAC7B;SAAM,IAAI,CAAC,aAAa,IAAI,CAAC,WAAW,IAAI,UAAU,EAAE;QACvD,WAAW,IAAI,SAAS,CAAC;KAC1B;IAED,MAAM,KAAK,GAAG,UAAU,GAAG,aAAa,GAAG,aAAa,CAAC;IAEzD,QACE,EAAC,MAAM,IACL,KAAK,EAAC,cAAc,EACpB,KAAK,EAAE,WAAW,EAClB,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,cAAc;QAEvB,mBACE,IAAI,EAAE,UAAU,GAAG,SAAS,GAAG,QAAQ,EACvC,KAAK,EAAC,yBAAyB,GAClB;QACd,KAAK,CACC,EACT;AACJ,CAAC,CAAC;MAEW,cAAc,GAA6C,CACtE,EACE,UAAU,EACV,WAAW,EACX,aAAa,EACb,cAAc,EACd,aAAa,EACb,aAAa,EACb,aAAa,GAAG,KAAK,GACtB,EACD,QAAQ;IAER,QACE,WAAK,KAAK,EAAC,2BAA2B;QACpC,WACE,IAAI,EAAC,iBAAiB,EACtB,KAAK,EAAE,mBAAmB,CAAC,UAAU,GAAG,iBAAiB,CAAC,aAAa,CAAC,GAAG,EAAE,cAAc,aAAa,EAAE,IAEzG,QAAQ,CACL;QACL,oBAAoB,CACnB,UAAU,EACV,WAAW,EACX,aAAa,EACb,cAAc,EACd,aAAa,EACb,aAAa,CACd,CACG,EACN;AACJ;;;;","names":[],"sources":["src/components/common/expandable-text/expandable-text.tsx"],"sourcesContent":["import {FunctionalComponent, h} from '@stencil/core';\nimport MinusIcon from '../../../images/minus.svg';\nimport PlusIcon from '../../../images/plus.svg';\nimport {Button} from '../stencil-button';\n\nexport type TruncateAfter = 'none' | '1' | '2' | '3' | '4';\n\ninterface ExpandableTextProps {\n isExpanded: boolean;\n isTruncated: boolean;\n isCollapsible?: boolean;\n truncateAfter: TruncateAfter;\n onToggleExpand: (e: MouseEvent | undefined) => void;\n showMoreLabel: string;\n showLessLabel: string;\n}\n\nconst getLineClampClass = (truncateAfter: TruncateAfter) => {\n const lineClampMap: Record<TruncateAfter, string> = {\n none: 'line-clamp-none',\n 1: 'line-clamp-1',\n 2: 'line-clamp-2',\n 3: 'line-clamp-3',\n 4: 'line-clamp-4',\n };\n return lineClampMap[truncateAfter] || 'line-clamp-2';\n};\n\nconst renderShowHideButton = (\n isExpanded: boolean,\n isTruncated: boolean,\n isCollapsible: boolean,\n onToggleExpand: (e?: MouseEvent) => void,\n showMoreLabel: string,\n showLessLabel: string\n) => {\n let buttonClass = 'expandable-text-button p-1 text-xs leading-[calc(1/.75)]';\n if (!isTruncated && !isExpanded) {\n buttonClass += ' invisible';\n } else if (!isCollapsible && !isTruncated && isExpanded) {\n buttonClass += ' hidden';\n }\n\n const label = isExpanded ? showLessLabel : showMoreLabel;\n\n return (\n <Button\n style=\"text-primary\"\n class={buttonClass}\n title={label}\n onClick={onToggleExpand}\n >\n <atomic-icon\n icon={isExpanded ? MinusIcon : PlusIcon}\n class=\"mx-1 w-2 align-baseline\"\n ></atomic-icon>\n {label}\n </Button>\n );\n};\n\nexport const ExpandableText: FunctionalComponent<ExpandableTextProps> = (\n {\n isExpanded,\n isTruncated,\n truncateAfter,\n onToggleExpand,\n showMoreLabel,\n showLessLabel,\n isCollapsible = false,\n },\n children\n) => {\n return (\n <div class=\"flex flex-col items-start\">\n <div\n part=\"expandable-text\"\n class={`expandable-text ${!isExpanded ? getLineClampClass(truncateAfter) : ''} min-lines-${truncateAfter}`}\n >\n {children}\n </div>\n {renderShowHideButton(\n isExpanded,\n isTruncated,\n isCollapsible,\n onToggleExpand,\n showMoreLabel,\n showLessLabel\n )}\n </div>\n );\n};\n"],"version":3}
@@ -4,7 +4,7 @@ function getWindow() {
4
4
  }
5
5
  export function getAtomicEnvironment() {
6
6
  return {
7
- version: "3.28.0-pre.b11d8122b2".VERSION,
7
+ version: "3.28.0-pre.bc804ccb47".VERSION,
8
8
  headlessVersion: VERSION,
9
9
  };
10
10
  }
@@ -1 +1 @@
1
- {"file":"index.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAca,kBAAmB,SAAQ,KAAK;IAC3C,YAAY,WAAmB,EAAE,UAAkB;QACjD,KAAK,CACH,QAAQ,WAAW,sCAAsC,UAAU,YAAY,CAChF,CAAC;KACH;;;ACfH,MAAM,oBAAoB,GAAG,sBAAsB,CAAC;SAIpC,gBAAgB,CAAI,OAAgB,EAAE,UAAkB;IACtE,OAAO,IAAI,OAAO,CAAI,CAAC,OAAO,EAAE,MAAM;QACpC,MAAM,KAAK,GAAG,gBAAgB,CAC5B,oBAAoB,EACpB,CAAC,IAAO;YACN,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC;SACtB,CACF,CAAC;QACF,OAAO,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QAE7B,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,UAAU,CAAC,EAAE;YACjC,MAAM,CACJ,IAAI,kBAAkB,CAAC,OAAO,CAAC,QAAQ,CAAC,WAAW,EAAE,EAAE,UAAU,CAAC,CACnE,CAAC;SACH;KACF,CAAC,CAAC;AACL;;ACkDA;;;;;;;;;;SAUgB,mBAAmB,CAAoB,OAAgB;IACrE,OAAO,gBAAgB,CAAI,OAAO,EAAE,gBAAgB,CAAC,CAAC;AACxD;;;;","names":[],"sources":["src/components/common/item-list/context/item-context-controller.ts","src/components/common/item-list/fetch-item-context.ts","src/decorators/commerce/product-template-decorators.ts"],"sourcesContent":["import {InitializableComponent} from '@/src/decorators/types.js';\nimport {buildCustomEvent} from '@/src/utils/event-utils';\nimport {LitElement, ReactiveController, ReactiveControllerHost} from 'lit';\n\ntype LitElementWithError = Omit<\n Pick<InitializableComponent, 'error'>,\n 'error'\n> &\n LitElement & {\n error: Error | null;\n };\n\nconst itemContextEventName = 'atomic/resolveResult';\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\nfunction extractFolded<T = Record<string, unknown>>(\n item: Record<string, unknown>,\n returnFolded: boolean\n): T {\n if (returnFolded) {\n if ('children' in item) {\n return item as T;\n } else {\n return {children: [], result: item} as T;\n }\n }\n\n if ('children' in item && 'result' in item) {\n return item.result as T;\n }\n return item as T;\n}\n\n/**\n * A reactive controller that manages item context data from parent components.\n * Handles fetching item data via custom events and manages error states.\n */\nexport class ItemContextController<T = Record<string, unknown>>\n implements ReactiveController\n{\n private host: ReactiveControllerHost & LitElementWithError;\n private parentName: string;\n private folded: boolean;\n private _item: T | null = null;\n private _error: MissingParentError | null = null;\n\n constructor(\n host: ReactiveControllerHost & LitElementWithError,\n options: {parentName?: string; folded?: boolean} = {}\n ) {\n this.host = host;\n this.parentName = options.parentName ?? 'atomic-result';\n this.folded = options.folded ?? false;\n host.addController(this);\n }\n\n get item(): T | null {\n return this._error ? null : this._item;\n }\n\n get error(): MissingParentError | null {\n return this._error;\n }\n\n get hasError(): boolean {\n return this._error !== null;\n }\n\n hostConnected(): void {\n this._resolveItemContext();\n }\n\n private _resolveItemContext(): void {\n const event = buildCustomEvent(\n itemContextEventName,\n (item: Record<string, unknown>) => {\n this._item = extractFolded<T>(item, this.folded);\n this._error = null;\n this.host.error = null;\n this.host.requestUpdate();\n }\n );\n\n const canceled = this.host.dispatchEvent(event);\n if (canceled) {\n const elementName = (this.host as Element).nodeName.toLowerCase();\n this._error = new MissingParentError(elementName, this.parentName);\n this._item = null;\n this.host.error = this._error;\n this.host.requestUpdate();\n }\n }\n}\n\ntype ItemContextEventHandler<T> = (item: T) => void;\nexport type ItemContextEvent<T> = CustomEvent<ItemContextEventHandler<T>>;\n","import {closest} from '../../../utils/dom-utils.js';\nimport {buildCustomEvent} from '../../../utils/event-utils.js';\nimport {MissingParentError} from './context/item-context-controller.js';\n\nconst itemContextEventName = 'atomic/resolveResult';\n\ntype ItemContextEventHandler<T> = (item: T) => void;\n\nexport function fetchItemContext<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","import {InteractiveItemContextController} from '@/src/components/common/item-list/context/interactive-item-context-controller';\nimport {InteractiveItemContextEvent} from '@/src/components/common/item-list/context/interactive-item-context-controller';\nimport {\n ItemContextController,\n ItemContextEvent,\n} from '@/src/components/common/item-list/context/item-context-controller';\nimport {fetchItemContext} from '@/src/components/common/item-list/fetch-item-context';\nimport {InteractiveProduct, Product} from '@coveo/headless/commerce';\nimport {LitElement} from 'lit';\n\n/**\n * Creates a [Lit reactive controller](https://lit.dev/docs/composition/controllers/) for managing product context in product template components.\n *\n * @param host - The Lit component instance\n * @param options - Configuration options\n * @returns ItemContextController instance configured for atomic-product\n *\n * @example\n * ```typescript\n * @customElement('my-product-component')\n * export class MyProductComponent extends LitElement {\n * private productController = createProductContextController(this);\n *\n * @state() product!: Product;\n *\n * render() {\n * this.product = this.productController.item;\n * return html`<div>${this.product?.ec_name}</div>`;\n * }\n * }\n * ```\n */\nexport function createProductContextController(\n host: LitElement & {error: Error | null},\n options: {folded?: boolean} = {}\n): ItemContextController<Product> {\n return new ItemContextController<Product>(host, {\n parentName: 'atomic-product',\n folded: options.folded ?? false,\n });\n}\n\n/**\n * Creates a [Lit reactive controller](https://lit.dev/docs/composition/controllers/) for managing interactive product context in product template components.\n *\n * @param host - The Lit component instance\n * @returns InteractiveItemContextController instance\n *\n * @example\n * ```typescript\n * @customElement('my-interactive-product-component')\n * export class MyInteractiveProductComponent extends LitElement {\n * private interactiveProductController = createInteractiveProductContextController(this);\n *\n * @state() product!: Product;\n *\n * render() {\n * this.product = this.interactiveProductController.interactiveItem;\n * return html`<div>${this.product?.ec_name}</div>`;\n * }\n * }\n * ```\n */\nexport function createInteractiveProductContextController(\n host: LitElement & {error: Error}\n): InteractiveItemContextController<InteractiveProduct> {\n return new InteractiveItemContextController<InteractiveProduct>(host);\n}\n\nexport type ProductContextEvent<T = Product> = ItemContextEvent<T>;\nexport type InteractiveProductContextEvent<\n T extends InteractiveProduct = InteractiveProduct,\n> = InteractiveItemContextEvent<T>;\n\n/**\n * Retrieves `Product` on a rendered `atomic-product`.\n *\n * This utility function is useful for building custom product template elements, see [Create a Product List](https://docs.coveo.com/en/atomic/latest/cc-search/create-custom-components/native-components/#custom-product-template-component-example) for more information.\n *\n * You should use the utility function 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-product`.\n * @returns A promise that resolves on initialization of the parent `atomic-product` element, or rejects when there is no parent `atomic-product` element.\n */\nexport function fetchProductContext<T extends Product>(element: Element) {\n return fetchItemContext<T>(element, 'atomic-product');\n}\n"],"version":3}
1
+ {"file":"index.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAca,kBAAmB,SAAQ,KAAK;IAC3C,YAAY,WAAmB,EAAE,UAAkB;QACjD,KAAK,CACH,QAAQ,WAAW,sCAAsC,UAAU,YAAY,CAChF,CAAC;KACH;;;ACfH,MAAM,oBAAoB,GAAG,sBAAsB,CAAC;SAIpC,gBAAgB,CAAI,OAAgB,EAAE,UAAkB;IACtE,OAAO,IAAI,OAAO,CAAI,CAAC,OAAO,EAAE,MAAM;QACpC,MAAM,KAAK,GAAG,gBAAgB,CAC5B,oBAAoB,EACpB,CAAC,IAAO;YACN,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC;SACtB,CACF,CAAC;QACF,OAAO,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QAE7B,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,UAAU,CAAC,EAAE;YACjC,MAAM,CACJ,IAAI,kBAAkB,CAAC,OAAO,CAAC,QAAQ,CAAC,WAAW,EAAE,EAAE,UAAU,CAAC,CACnE,CAAC;SACH;KACF,CAAC,CAAC;AACL;;ACkDA;;;;;;;;;;SAUgB,mBAAmB,CAAoB,OAAgB;IACrE,OAAO,gBAAgB,CAAI,OAAO,EAAE,gBAAgB,CAAC,CAAC;AACxD;;;;","names":[],"sources":["src/components/common/item-list/context/item-context-controller.ts","src/components/common/item-list/fetch-item-context.ts","src/decorators/commerce/product-template-decorators.ts"],"sourcesContent":["import {InitializableComponent} from '@/src/decorators/types.js';\nimport {buildCustomEvent} from '@/src/utils/event-utils';\nimport {LitElement, ReactiveController, ReactiveControllerHost} from 'lit';\n\ntype LitElementWithError = Omit<\n Pick<InitializableComponent, 'error'>,\n 'error'\n> &\n LitElement & {\n error: Error | null;\n };\n\nconst itemContextEventName = 'atomic/resolveResult';\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\nfunction extractFolded<T = Record<string, unknown>>(\n item: Record<string, unknown>,\n returnFolded: boolean\n): T {\n if (returnFolded) {\n if ('children' in item) {\n return item as T;\n } else {\n return {children: [], result: item} as T;\n }\n }\n\n if ('children' in item && 'result' in item) {\n return item.result as T;\n }\n return item as T;\n}\n\n/**\n * A reactive controller that manages item context data from parent components.\n * Handles fetching item data via custom events and manages error states.\n */\nexport class ItemContextController<T = Record<string, unknown>>\n implements ReactiveController\n{\n private host: ReactiveControllerHost & LitElementWithError;\n private parentName: string;\n private folded: boolean;\n private _item: T | null = null;\n private _error: MissingParentError | null = null;\n\n constructor(\n host: ReactiveControllerHost & LitElementWithError,\n options: {parentName?: string; folded?: boolean} = {}\n ) {\n this.host = host;\n this.parentName = options.parentName ?? 'atomic-result';\n this.folded = options.folded ?? false;\n host.addController(this);\n }\n\n get item(): T | null {\n return this._error ? null : this._item;\n }\n\n get error(): MissingParentError | null {\n return this._error;\n }\n\n get hasError(): boolean {\n return this._error !== null;\n }\n\n hostConnected(): void {\n this._resolveItemContext();\n }\n\n private _resolveItemContext(): void {\n const event = buildCustomEvent(\n itemContextEventName,\n (item: Record<string, unknown>) => {\n this._item = extractFolded<T>(item, this.folded);\n this._error = null;\n this.host.error = null;\n this.host.requestUpdate();\n }\n );\n\n const canceled = this.host.dispatchEvent(event);\n if (canceled) {\n const elementName = (this.host as Element).nodeName.toLowerCase();\n this._error = new MissingParentError(elementName, this.parentName);\n this._item = null;\n this.host.error = this._error;\n this.host.requestUpdate();\n }\n }\n}\n\ntype ItemContextEventHandler<T> = (item: T) => void;\nexport type ItemContextEvent<T> = CustomEvent<ItemContextEventHandler<T>>;\n","import {closest} from '../../../utils/dom-utils.js';\nimport {buildCustomEvent} from '../../../utils/event-utils.js';\nimport {MissingParentError} from './context/item-context-controller.js';\n\nconst itemContextEventName = 'atomic/resolveResult';\n\ntype ItemContextEventHandler<T> = (item: T) => void;\n\nexport function fetchItemContext<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","import {InteractiveItemContextController} from '@/src/components/common/item-list/context/interactive-item-context-controller';\nimport {InteractiveItemContextEvent} from '@/src/components/common/item-list/context/interactive-item-context-controller';\nimport {\n ItemContextController,\n ItemContextEvent,\n} from '@/src/components/common/item-list/context/item-context-controller';\nimport {fetchItemContext} from '@/src/components/common/item-list/fetch-item-context';\nimport {InteractiveProduct, Product} from '@coveo/headless/commerce';\nimport {LitElement} from 'lit';\n\n/**\n * Creates a [Lit reactive controller](https://lit.dev/docs/composition/controllers/) for managing product context in product template components.\n *\n * @param host - The Lit component instance\n * @param options - Configuration options\n * @returns ItemContextController instance configured for atomic-product\n *\n * @example\n * ```typescript\n * @customElement('my-product-component')\n * export class MyProductComponent extends LitElement {\n * private productController = createProductContextController(this);\n *\n * @state() product!: Product;\n *\n * render() {\n * this.product = this.productController.item;\n * return html`<div>${this.product?.ec_name}</div>`;\n * }\n * }\n * ```\n */\nexport function createProductContextController(\n host: LitElement & {error: Error | null},\n options: {folded?: boolean} = {}\n): ItemContextController<Product> {\n return new ItemContextController<Product>(host, {\n parentName: 'atomic-product',\n folded: options.folded ?? false,\n });\n}\n\n/**\n * Creates a [Lit reactive controller](https://lit.dev/docs/composition/controllers/) for managing interactive product context in product template components.\n *\n * @param host - The Lit component instance\n * @returns InteractiveItemContextController instance\n *\n * @example\n * ```typescript\n * @customElement('my-interactive-product-component')\n * export class MyInteractiveProductComponent extends LitElement {\n * private interactiveProductController = createInteractiveProductContextController(this);\n *\n * @state() product!: Product;\n *\n * render() {\n * this.product = this.interactiveProductController.interactiveItem;\n * return html`<div>${this.product?.ec_name}</div>`;\n * }\n * }\n * ```\n */\nexport function createInteractiveProductContextController(\n host: LitElement & {error: Error}\n): InteractiveItemContextController<InteractiveProduct> {\n return new InteractiveItemContextController<InteractiveProduct>(host);\n}\n\nexport type ProductContextEvent<T = Product> = ItemContextEvent<T>;\nexport type InteractiveProductContextEvent<\n T extends InteractiveProduct = InteractiveProduct,\n> = InteractiveItemContextEvent<T>;\n\n/**\n * Retrieves `Product` on a rendered `atomic-product`.\n *\n * This utility function is useful for building custom product template elements, see [Create a Product List](https://docs.coveo.com/en/atomic/latest/cc-search/create-custom-components/native-components/#custom-product-template-component-example) for more information.\n *\n * You should use the utility function 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-product`.\n * @returns A promise that resolves on initialization of the parent `atomic-product` element, or rejects when there is no parent `atomic-product` element.\n */\nexport function fetchProductContext<T extends Product>(element: Element) {\n return fetchItemContext<T>(element, 'atomic-product');\n}\n"],"version":3}
@@ -2220,7 +2220,7 @@ function getWindow() {
2220
2220
  }
2221
2221
  function getAtomicEnvironment() {
2222
2222
  return {
2223
- version: "3.28.0-pre.b11d8122b2",
2223
+ version: "3.28.0-pre.bc804ccb47",
2224
2224
  headlessVersion: VERSION,
2225
2225
  };
2226
2226
  }
@@ -13,6 +13,13 @@ function parseValue(product, field) {
13
13
  }
14
14
  return valueAsNumber;
15
15
  }
16
+ function getStringValueFromProductOrNull(product, field) {
17
+ const value = ProductTemplatesHelpers.getProductProperty(product, field);
18
+ if (typeof value !== 'string' || value.trim() === '') {
19
+ return null;
20
+ }
21
+ return value;
22
+ }
16
23
  function buildStringTemplateFromProduct(template, product, bindings) {
17
24
  return template.replace(/\${(.*?)}/g, (value) => {
18
25
  const key = value.substring(2, value.length - 1);
@@ -28,6 +35,6 @@ function buildStringTemplateFromProduct(template, product, bindings) {
28
35
  });
29
36
  }
30
37
 
31
- export { buildStringTemplateFromProduct as b, parseValue as p };
38
+ export { buildStringTemplateFromProduct as b, getStringValueFromProductOrNull as g, parseValue as p };
32
39
 
33
40
  //# sourceMappingURL=product-utils.js.map
@@ -1 +1 @@
1
- {"file":"product-utils.js","mappings":";;;;SAKgB,UAAU,CAAC,OAAgB,EAAE,KAAa;IACxD,MAAM,KAAK,GAAG,uBAAuB,CAAC,kBAAkB,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IACzE,IAAI,KAAK,KAAK,IAAI,EAAE;QAClB,OAAO,IAAI,CAAC;KACb;IACD,MAAM,aAAa,GAAG,UAAU,CAAC,GAAG,KAAK,EAAE,CAAC,CAAC;IAC7C,IAAI,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC,EAAE;QAC/B,MAAM,IAAI,oBAAoB,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;KAC9C;IACD,OAAO,aAAa,CAAC;AACvB,CAAC;SAee,8BAA8B,CAC5C,QAAgB,EAChB,OAAgB,EAChB,QAA0B;IAE1B,OAAO,QAAQ,CAAC,OAAO,CAAC,YAAY,EAAE,CAAC,KAAa;QAClD,MAAM,GAAG,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QACjD,IAAI,QAAQ,GAAG,cAAc,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;QAC5C,IAAI,CAAC,QAAQ,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;YAC9C,QAAQ,GAAG,cAAc,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;SACxC;QAED,IAAI,CAAC,QAAQ,EAAE;YACb,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CACzB,GAAG,GAAG,6DAA6D,OAAO,CAAC,WAAW,+CAA+C,CACtI,CAAC;YACF,OAAO,EAAE,CAAC;SACX;QAED,OAAO,QAAQ,CAAC;KACjB,CAAC,CAAC;AACL;;;;","names":[],"sources":["src/components/commerce/product-template-component-utils/product-utils.ts"],"sourcesContent":["import {readFromObject} from '@/src/utils/object-utils';\nimport {Product, ProductTemplatesHelpers} from '@coveo/headless/commerce';\nimport {CommerceBindings} from '../atomic-commerce-interface/atomic-commerce-interface';\nimport {FieldValueIsNaNError} from './error';\n\nexport function parseValue(product: Product, field: string) {\n const value = ProductTemplatesHelpers.getProductProperty(product, field);\n if (value === null) {\n return null;\n }\n const valueAsNumber = parseFloat(`${value}`);\n if (Number.isNaN(valueAsNumber)) {\n throw new FieldValueIsNaNError(field, value);\n }\n return valueAsNumber;\n}\n\nexport function getStringValueFromProductOrNull(\n product: Product,\n field: string\n) {\n const value = ProductTemplatesHelpers.getProductProperty(product, field);\n\n if (typeof value !== 'string' || value.trim() === '') {\n return null;\n }\n\n return value;\n}\n\nexport function buildStringTemplateFromProduct(\n template: string,\n product: Product,\n bindings: CommerceBindings\n) {\n return template.replace(/\\${(.*?)}/g, (value: string) => {\n const key = value.substring(2, value.length - 1);\n let newValue = readFromObject(product, key);\n if (!newValue && typeof window !== 'undefined') {\n newValue = readFromObject(window, key);\n }\n\n if (!newValue) {\n bindings.engine.logger.warn(\n `${key} used in the href template is undefined for this product: ${product.permanentid} and could not be found in the window object.`\n );\n return '';\n }\n\n return newValue;\n });\n}\n"],"version":3}
1
+ {"file":"product-utils.js","mappings":";;;;SAKgB,UAAU,CAAC,OAAgB,EAAE,KAAa;IACxD,MAAM,KAAK,GAAG,uBAAuB,CAAC,kBAAkB,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IACzE,IAAI,KAAK,KAAK,IAAI,EAAE;QAClB,OAAO,IAAI,CAAC;KACb;IACD,MAAM,aAAa,GAAG,UAAU,CAAC,GAAG,KAAK,EAAE,CAAC,CAAC;IAC7C,IAAI,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC,EAAE;QAC/B,MAAM,IAAI,oBAAoB,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;KAC9C;IACD,OAAO,aAAa,CAAC;AACvB,CAAC;SAEe,+BAA+B,CAC7C,OAAgB,EAChB,KAAa;IAEb,MAAM,KAAK,GAAG,uBAAuB,CAAC,kBAAkB,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IAEzE,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;QACpD,OAAO,IAAI,CAAC;KACb;IAED,OAAO,KAAK,CAAC;AACf,CAAC;SAEe,8BAA8B,CAC5C,QAAgB,EAChB,OAAgB,EAChB,QAA0B;IAE1B,OAAO,QAAQ,CAAC,OAAO,CAAC,YAAY,EAAE,CAAC,KAAa;QAClD,MAAM,GAAG,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QACjD,IAAI,QAAQ,GAAG,cAAc,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;QAC5C,IAAI,CAAC,QAAQ,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;YAC9C,QAAQ,GAAG,cAAc,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;SACxC;QAED,IAAI,CAAC,QAAQ,EAAE;YACb,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CACzB,GAAG,GAAG,6DAA6D,OAAO,CAAC,WAAW,+CAA+C,CACtI,CAAC;YACF,OAAO,EAAE,CAAC;SACX;QAED,OAAO,QAAQ,CAAC;KACjB,CAAC,CAAC;AACL;;;;","names":[],"sources":["src/components/commerce/product-template-component-utils/product-utils.ts"],"sourcesContent":["import {readFromObject} from '@/src/utils/object-utils';\nimport {Product, ProductTemplatesHelpers} from '@coveo/headless/commerce';\nimport {CommerceBindings} from '../atomic-commerce-interface/atomic-commerce-interface';\nimport {FieldValueIsNaNError} from './error';\n\nexport function parseValue(product: Product, field: string) {\n const value = ProductTemplatesHelpers.getProductProperty(product, field);\n if (value === null) {\n return null;\n }\n const valueAsNumber = parseFloat(`${value}`);\n if (Number.isNaN(valueAsNumber)) {\n throw new FieldValueIsNaNError(field, value);\n }\n return valueAsNumber;\n}\n\nexport function getStringValueFromProductOrNull(\n product: Product,\n field: string\n) {\n const value = ProductTemplatesHelpers.getProductProperty(product, field);\n\n if (typeof value !== 'string' || value.trim() === '') {\n return null;\n }\n\n return value;\n}\n\nexport function buildStringTemplateFromProduct(\n template: string,\n product: Product,\n bindings: CommerceBindings\n) {\n return template.replace(/\\${(.*?)}/g, (value: string) => {\n const key = value.substring(2, value.length - 1);\n let newValue = readFromObject(product, key);\n if (!newValue && typeof window !== 'undefined') {\n newValue = readFromObject(window, key);\n }\n\n if (!newValue) {\n bindings.engine.logger.warn(\n `${key} used in the href template is undefined for this product: ${product.permanentid} and could not be found in the window object.`\n );\n return '';\n }\n\n return newValue;\n });\n}\n"],"version":3}
@@ -1 +1 @@
1
- {"file":"sections.js","mappings":"SAYgB,WAAW,CAAC,OAAoB,EAAE,OAAgB;IAChE,OAAO,OAAO,CAAC,aAAa,CAC1B,eAAe,CAAC,OAAO,CAAC,CACK,CAAC;AAClC,CAAC;SAEe,eAAe,CAAC,OAAgB;IAC9C,OAAO,kCAAkC,OAAO,IAAI,CAAC;AACvD;;;;","names":[],"sources":["src/components/common/atomic-layout-section/sections.ts"],"sourcesContent":["import {AtomicLayoutSection} from './atomic-layout-section';\n\nexport type Section =\n | 'search'\n | 'facets'\n | 'main'\n | 'status'\n | 'results'\n | 'horizontal-facets'\n | 'products'\n | 'pagination';\n\nexport function findSection(element: HTMLElement, section: Section) {\n return element.querySelector(\n sectionSelector(section)\n ) as AtomicLayoutSection | null;\n}\n\nexport function sectionSelector(section: Section) {\n return `atomic-layout-section[section=\"${section}\"]`;\n}\n"],"version":3}
1
+ {"file":"sections.js","mappings":"SAUgB,WAAW,CAAC,OAAoB,EAAE,OAAgB;IAChE,OAAO,OAAO,CAAC,aAAa,CAC1B,eAAe,CAAC,OAAO,CAAC,CACgB,CAAC;AAC7C,CAAC;SAEe,eAAe,CAAC,OAAgB;IAC9C,OAAO,kCAAkC,OAAO,IAAI,CAAC;AACvD;;;;","names":[],"sources":["src/components/common/atomic-layout-section/sections.ts"],"sourcesContent":["export type Section =\n | 'search'\n | 'facets'\n | 'main'\n | 'status'\n | 'results'\n | 'horizontal-facets'\n | 'products'\n | 'pagination';\n\nexport function findSection(element: HTMLElement, section: Section) {\n return element.querySelector(\n sectionSelector(section)\n ) as HTMLAtomicLayoutSectionElement | null;\n}\n\nexport function sectionSelector(section: Section) {\n return `atomic-layout-section[section=\"${section}\"]`;\n}\n"],"version":3}
@@ -0,0 +1,49 @@
1
+ import { isArray, isUndefined } from '@coveo/bueno';
2
+ import { h, Fragment, Host } from '@stencil/core/internal/client';
3
+
4
+ function possiblyWarnOnBadFieldType(field, itemValueRaw, host, logger) {
5
+ if (isArray(itemValueRaw)) {
6
+ logger.error(`${host.nodeName.toLowerCase()} cannot be used with multi value field "${field}" with values "${itemValueRaw}".`, host);
7
+ }
8
+ }
9
+
10
+ const ItemTextFallback = ({ field, host, logger, defaultValue, item, getProperty }, children) => {
11
+ const raw = getProperty(item, field);
12
+ possiblyWarnOnBadFieldType(field, raw, host, logger);
13
+ if (isUndefined(defaultValue)) {
14
+ host.remove();
15
+ return null;
16
+ }
17
+ else {
18
+ return h(Fragment, null, children);
19
+ }
20
+ };
21
+
22
+ function renderWithHighlights(value, highlights, highlightString) {
23
+ const openingDelimiter = '_openingDelimiter_';
24
+ const closingDelimiter = '_closingDelimiter_';
25
+ const highlightedValue = highlightString({
26
+ content: value,
27
+ openingDelimiter,
28
+ closingDelimiter,
29
+ highlights,
30
+ });
31
+ return highlightedValue
32
+ .replace(new RegExp(openingDelimiter, 'g'), '<b>')
33
+ .replace(new RegExp(closingDelimiter, 'g'), '</b>');
34
+ }
35
+
36
+ const ItemTextHighlighted = ({ highlightKeywords, highlightString, onError, textValue }) => {
37
+ try {
38
+ const highlightedValue = renderWithHighlights(textValue, highlightKeywords, highlightString);
39
+ // deepcode ignore ReactSetInnerHtml: This is not React code
40
+ return h(Host, { innerHTML: highlightedValue });
41
+ }
42
+ catch (error) {
43
+ onError(error);
44
+ }
45
+ };
46
+
47
+ export { ItemTextFallback as I, ItemTextHighlighted as a };
48
+
49
+ //# sourceMappingURL=stencil-item-text-highlighted.js.map
@@ -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AE,eAAe,EAAE,OAAO,EAAE,SAAS,EAAC;IAC3D,IAAI;QACF,MAAM,gBAAgB,GAAG,oBAAoB,CAC3C,SAAS,EACT,iBAAiB,EACjB,eAAe,CAChB,CAAC;;QAGF,OAAO,EAAC,IAAI,IAAC,SAAS,EAAE,gBAAgB,GAAS,CAAC;KACnD;IAAC,OAAO,KAAK,EAAE;QACd,OAAO,CAAC,KAAc,CAAC,CAAC;KACzB;AACH;;;;","names":[],"sources":["src/components/common/item-text/field-warning.ts","src/components/common/item-text/stencil-item-text-fallback.tsx","src/components/common/item-text/render-highlights.ts","src/components/common/item-text/stencil-item-text-highlighted.tsx"],"sourcesContent":["import {isArray} from '@coveo/bueno';\n\nexport function possiblyWarnOnBadFieldType(\n field: string,\n itemValueRaw: unknown,\n host: HTMLElement,\n logger: Pick<Console, 'error'>\n) {\n if (isArray(itemValueRaw)) {\n logger.error(\n `${host.nodeName.toLowerCase()} cannot be used with multi value field \"${field}\" with values \"${itemValueRaw}\".`,\n host\n );\n }\n}\n","import {isUndefined} from '@coveo/bueno';\nimport {Fragment, FunctionalComponent, VNode, h} from '@stencil/core';\nimport {possiblyWarnOnBadFieldType} from './field-warning';\n\nexport interface ItemTextProps<T> {\n logger: Pick<Console, 'error'>;\n host: HTMLElement;\n defaultValue: string | undefined;\n field: string;\n item: T;\n getProperty: (result: T, property: string) => unknown;\n}\n\nexport const ItemTextFallback = <T,>(\n {field, host, logger, defaultValue, item, getProperty}: ItemTextProps<T>,\n children: VNode[]\n): FunctionalComponent<ItemTextProps<T>> | null => {\n const raw = getProperty(item, field);\n possiblyWarnOnBadFieldType(field, raw, host, logger);\n\n if (isUndefined(defaultValue)) {\n host.remove();\n return null;\n } else {\n return <Fragment>{children}</Fragment>;\n }\n};\n","export type HighlightKeywords = {\n offset: number;\n length: number;\n};\n\nexport type HighlightString = (params: {\n content: string;\n openingDelimiter: string;\n closingDelimiter: string;\n highlights: HighlightKeywords[];\n}) => string;\n\nexport function renderWithHighlights(\n value: string,\n highlights: HighlightKeywords[],\n highlightString: HighlightString\n) {\n const openingDelimiter = '_openingDelimiter_';\n const closingDelimiter = '_closingDelimiter_';\n const highlightedValue = highlightString({\n content: value,\n openingDelimiter,\n closingDelimiter,\n highlights,\n });\n return highlightedValue\n .replace(new RegExp(openingDelimiter, 'g'), '<b>')\n .replace(new RegExp(closingDelimiter, 'g'), '</b>');\n}\n","import {FunctionalComponent, h, Host} from '@stencil/core';\nimport {\n HighlightKeywords,\n HighlightString,\n renderWithHighlights,\n} from './render-highlights';\n\nexport interface ItemTextHighlightedProps {\n textValue: string;\n highlightKeywords: HighlightKeywords[];\n onError: (error: Error) => void;\n highlightString: HighlightString;\n}\n\nexport const ItemTextHighlighted: FunctionalComponent<\n ItemTextHighlightedProps\n> = ({highlightKeywords, highlightString, onError, textValue}) => {\n try {\n const highlightedValue = renderWithHighlights(\n textValue,\n highlightKeywords,\n highlightString\n );\n\n // deepcode ignore ReactSetInnerHtml: This is not React code\n return <Host innerHTML={highlightedValue}></Host>;\n } catch (error) {\n onError(error as Error);\n }\n};\n"],"version":3}
@@ -1 +1 @@
1
- {"file":"stencil-link.js","mappings":";;;MAMa,iBAAiB,GAAgD,CAAC,EAC7E,KAAK,EACL,IAAI,GACL;IACC,IAAI,CAAC,IAAI,EAAE;QACT,OAAO;KACR;IACD,QACE,WACE,IAAI,EAAC,YAAY,EACjB,KAAK,EAAC,uFAAuF;QAE7F,gBAAO,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAQ,CACzC,EACN;AACJ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,+BAA+B,CAAC;YACzC,KAAK,+BAA+B;gBAClC,OAAO,iCAAiC,CAAC;YAC3C;gBACE,OAAO,IAAI,CAAC;SACf;KACF,CAAC;IAEF,MAAM,IAAI,GAAG,YAAY,EAAE,CAAC;IAE5B,OAAO,IAAI,IACT,SAAG,IAAI,EAAE,IAAI,EAAE,IAAI,EAAC,UAAU,EAAC,KAAK,EAAC,oCAAoC,IACtE,IAAI,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAC1B,IACF,IAAI,CAAC;AACX;;;;","names":[],"sources":["src/components/common/query-error/stencil-details.tsx","src/components/common/query-error/stencil-icon.tsx","src/components/common/query-error/stencil-show-more.tsx","src/components/common/query-error/stencil-container.tsx","src/components/common/query-error/utils.ts","src/components/common/query-error/stencil-description.tsx","src/components/common/query-error/stencil-guard.tsx","src/components/common/query-error/stencil-title.tsx","src/components/common/query-error/stencil-link.tsx"],"sourcesContent":["import {FunctionalComponent, h} from '@stencil/core';\n\ninterface QueryErrorDetailsProps {\n error: unknown;\n show: boolean;\n}\nexport const QueryErrorDetails: FunctionalComponent<QueryErrorDetailsProps> = ({\n error,\n show,\n}) => {\n if (!show) {\n return;\n }\n return (\n <pre\n part=\"error-info\"\n class=\"border-neutral bg-neutral-light mt-8 rounded border p-3 text-left whitespace-pre-wrap\"\n >\n <code>{JSON.stringify(error, null, 2)}</code>\n </pre>\n );\n};\n","import {FunctionalComponent, h} from '@stencil/core';\nimport CannotAccess from '../../../images/cannot-access.svg';\nimport Indexing from '../../../images/indexing.svg';\nimport NoConnection from '../../../images/no-connection.svg';\nimport SearchInactive from '../../../images/search-inactive.svg';\nimport SomethingWrong from '../../../images/something-wrong.svg';\nimport {KnownErrorType} from './known-error-types';\n\ninterface QueryErrorIconProps {\n errorType?: string;\n}\n\nexport const QueryErrorIcon: FunctionalComponent<QueryErrorIconProps> = ({\n errorType,\n}) => {\n const getIconFromErrorType = () => {\n switch (errorType as KnownErrorType) {\n case 'Disconnected':\n return NoConnection;\n\n case 'NoEndpointsException':\n return Indexing;\n\n case 'InvalidTokenException':\n return CannotAccess;\n case 'OrganizationIsPausedException':\n return SearchInactive;\n default:\n return SomethingWrong;\n }\n };\n\n return (\n <atomic-icon\n part=\"icon\"\n icon={getIconFromErrorType()}\n class=\"w-1/2 max-w-lg\"\n ></atomic-icon>\n );\n};\n","import {FunctionalComponent, h} from '@stencil/core';\nimport {i18n} from 'i18next';\nimport {Button} from '../stencil-button';\nimport {QueryErrorLink} from './stencil-link';\n\ninterface QueryErrorShowMoreProps {\n onShowMore: () => void;\n i18n: i18n;\n link?: typeof QueryErrorLink;\n}\n\nexport const QueryErrorShowMore: FunctionalComponent<\n QueryErrorShowMoreProps\n> = ({i18n, onShowMore, link}) => {\n if (link) {\n return link;\n }\n return (\n <Button\n part=\"more-info-btn\"\n style=\"primary\"\n class=\"mt-8 p-3\"\n onClick={() => {\n onShowMore();\n }}\n text={i18n.t('more-info')}\n ></Button>\n );\n};\n","import {FunctionalComponent, h} from '@stencil/core';\n\nexport const QueryErrorContainer: FunctionalComponent = (_, children) => {\n return <div class=\"p-8 text-center\">{children}</div>;\n};\n","import {i18n} from 'i18next';\nimport {KnownErrorType} from './known-error-types';\n\nexport const getErrorTitleFromErrorType = (\n i18n: i18n,\n organizationId: string,\n errorType?: string\n) => {\n switch (errorType as KnownErrorType) {\n case 'Disconnected':\n return i18n.t('disconnected');\n case 'NoEndpointsException':\n return i18n.t('no-endpoints', {org: organizationId});\n case 'InvalidTokenException':\n return i18n.t('cannot-access', {org: organizationId});\n case 'OrganizationIsPausedException':\n return i18n.t('organization-is-paused', {org: organizationId});\n default:\n return i18n.t('something-went-wrong');\n }\n};\n\nexport const getErrorDescriptionFromErrorType = (\n i18n: i18n,\n organizationId: string,\n url: string,\n errorType?: string\n) => {\n switch (errorType as KnownErrorType) {\n case 'Disconnected':\n return i18n.t('check-your-connection', {url});\n case 'NoEndpointsException':\n return i18n.t('add-sources');\n case 'InvalidTokenException':\n return i18n.t('invalid-token');\n case 'OrganizationIsPausedException':\n return i18n.t('organization-will-resume', {\n org: organizationId,\n });\n default:\n return i18n.t('if-problem-persists');\n }\n};\n\nexport const getAriaMessageFromErrorType = (\n i18n: i18n,\n organizationId: string,\n platformUrl: string,\n errorType?: string\n) => {\n return `${getErrorTitleFromErrorType(i18n, organizationId, errorType)} ${getErrorDescriptionFromErrorType(i18n, organizationId, platformUrl, errorType)}`;\n};\n","import {FunctionalComponent, h} from '@stencil/core';\nimport {i18n} from 'i18next';\nimport {getErrorDescriptionFromErrorType} from './utils';\n\ninterface QueryErrorDescriptionProps {\n errorType?: string;\n i18n: i18n;\n url: string;\n organizationId: string;\n}\n\nexport const QueryErrorDescription: FunctionalComponent<\n QueryErrorDescriptionProps\n> = ({errorType, i18n, url, organizationId}) => {\n return (\n <p part=\"description\" class=\"text-neutral-dark mt-2.5 text-lg\">\n {getErrorDescriptionFromErrorType(i18n, organizationId, url, errorType)}\n </p>\n );\n};\n","import {Fragment, FunctionalComponent, h} from '@stencil/core';\n\ninterface QueryErrorGuardProps {\n hasError: boolean;\n}\n\n// Replace with the when directive\nexport const QueryErrorGuard: FunctionalComponent<QueryErrorGuardProps> = (\n {hasError},\n children\n) => {\n if (!hasError) {\n return;\n }\n\n return <Fragment>{children}</Fragment>;\n};\n","import {FunctionalComponent, h} from '@stencil/core';\nimport {i18n} from 'i18next';\nimport {getErrorTitleFromErrorType} from './utils';\n\ninterface QueryErrorTitleProps {\n errorType?: string;\n i18n: i18n;\n organizationId: string;\n}\n\nexport const QueryErrorTitle: FunctionalComponent<QueryErrorTitleProps> = ({\n errorType,\n i18n,\n organizationId,\n}) => {\n return (\n <p part=\"title\" class=\"text-on-background mt-8 text-2xl\">\n {getErrorTitleFromErrorType(i18n, organizationId, errorType)}\n </p>\n );\n};\n","import {FunctionalComponent, h} from '@stencil/core';\nimport {i18n} from 'i18next';\nimport {KnownErrorType} from './known-error-types';\n\ninterface QueryErrorLinkProps {\n errorType?: string;\n i18n: i18n;\n}\n\nexport const QueryErrorLink: FunctionalComponent<QueryErrorLinkProps> = ({\n errorType,\n i18n,\n}) => {\n const getErrorLink = () => {\n switch (errorType as KnownErrorType) {\n case 'NoEndpointsException':\n return 'https://docs.coveo.com/en/mcc80216';\n case 'InvalidTokenException':\n return 'https://docs.coveo.com/en/102';\n case 'OrganizationIsPausedException':\n return 'https://docs.coveo.com/l6af0467';\n default:\n return null;\n }\n };\n\n const link = getErrorLink();\n\n return link ? (\n <a href={link} part=\"doc-link\" class=\"btn-primary mt-10 inline-block p-3\">\n {i18n.t('coveo-online-help')}\n </a>\n ) : null;\n};\n"],"version":3}
1
+ {"file":"stencil-link.js","mappings":";;;MAMa,iBAAiB,GAAgD,CAAC,EAC7E,KAAK,EACL,IAAI,GACL;IACC,IAAI,CAAC,IAAI,EAAE;QACT,OAAO;KACR;IACD,QACE,WACE,IAAI,EAAC,YAAY,EACjB,KAAK,EAAC,uFAAuF;QAE7F,gBAAO,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAQ,CACzC,EACN;AACJ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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IAAI,CAAC;AACX;;;;","names":[],"sources":["src/components/common/query-error/stencil-details.tsx","src/components/common/query-error/stencil-icon.tsx","src/components/common/query-error/show-more.tsx","src/components/common/query-error/stencil-container.tsx","src/components/common/query-error/utils.ts","src/components/common/query-error/stencil-description.tsx","src/components/common/query-error/stencil-guard.tsx","src/components/common/query-error/stencil-title.tsx","src/components/common/query-error/stencil-link.tsx"],"sourcesContent":["import {FunctionalComponent, h} from '@stencil/core';\n\ninterface QueryErrorDetailsProps {\n error: unknown;\n show: boolean;\n}\nexport const QueryErrorDetails: FunctionalComponent<QueryErrorDetailsProps> = ({\n error,\n show,\n}) => {\n if (!show) {\n return;\n }\n return (\n <pre\n part=\"error-info\"\n class=\"border-neutral bg-neutral-light mt-8 rounded border p-3 text-left whitespace-pre-wrap\"\n >\n <code>{JSON.stringify(error, null, 2)}</code>\n </pre>\n );\n};\n","import {FunctionalComponent, h} from '@stencil/core';\nimport CannotAccess from '../../../images/cannot-access.svg';\nimport Indexing from '../../../images/indexing.svg';\nimport NoConnection from '../../../images/no-connection.svg';\nimport SearchInactive from '../../../images/search-inactive.svg';\nimport SomethingWrong from '../../../images/something-wrong.svg';\nimport {KnownErrorType} from './known-error-types';\n\ninterface QueryErrorIconProps {\n errorType?: string;\n}\n\nexport const QueryErrorIcon: FunctionalComponent<QueryErrorIconProps> = ({\n errorType,\n}) => {\n const getIconFromErrorType = () => {\n switch (errorType as KnownErrorType) {\n case 'Disconnected':\n return NoConnection;\n\n case 'NoEndpointsException':\n return Indexing;\n\n case 'InvalidTokenException':\n return CannotAccess;\n case 'OrganizationIsPausedException':\n return SearchInactive;\n default:\n return SomethingWrong;\n }\n };\n\n return (\n <atomic-icon\n part=\"icon\"\n icon={getIconFromErrorType()}\n class=\"w-1/2 max-w-lg\"\n ></atomic-icon>\n );\n};\n","import {FunctionalComponent, h} from '@stencil/core';\nimport {i18n} from 'i18next';\nimport {Button} from '../stencil-button';\nimport {QueryErrorLink} from './stencil-link';\n\ninterface QueryErrorShowMoreProps {\n onShowMore: () => void;\n i18n: i18n;\n link?: typeof QueryErrorLink;\n}\n\nexport const QueryErrorShowMore: FunctionalComponent<\n QueryErrorShowMoreProps\n> = ({i18n, onShowMore, link}) => {\n if (link) {\n return link;\n }\n return (\n <Button\n part=\"more-info-btn\"\n style=\"primary\"\n class=\"mt-8 p-3\"\n onClick={() => {\n onShowMore();\n }}\n text={i18n.t('more-info')}\n ></Button>\n );\n};\n","import {FunctionalComponent, h} from '@stencil/core';\n\nexport const QueryErrorContainer: FunctionalComponent = (_, children) => {\n return <div class=\"p-8 text-center\">{children}</div>;\n};\n","import {i18n} from 'i18next';\nimport {KnownErrorType} from './known-error-types';\n\nexport const getErrorTitleFromErrorType = (\n i18n: i18n,\n organizationId: string,\n errorType?: string\n) => {\n switch (errorType as KnownErrorType) {\n case 'Disconnected':\n return i18n.t('disconnected');\n case 'NoEndpointsException':\n return i18n.t('no-endpoints', {org: organizationId});\n case 'InvalidTokenException':\n return i18n.t('cannot-access', {org: organizationId});\n case 'OrganizationIsPausedException':\n return i18n.t('organization-is-paused', {org: organizationId});\n default:\n return i18n.t('something-went-wrong');\n }\n};\n\nexport const getErrorDescriptionFromErrorType = (\n i18n: i18n,\n organizationId: string,\n url: string,\n errorType?: string\n) => {\n switch (errorType as KnownErrorType) {\n case 'Disconnected':\n return i18n.t('check-your-connection', {url});\n case 'NoEndpointsException':\n return i18n.t('add-sources');\n case 'InvalidTokenException':\n return i18n.t('invalid-token');\n case 'OrganizationIsPausedException':\n return i18n.t('organization-will-resume', {\n org: organizationId,\n });\n default:\n return i18n.t('if-problem-persists');\n }\n};\n\nexport const getAriaMessageFromErrorType = (\n i18n: i18n,\n organizationId: string,\n platformUrl: string,\n errorType?: string\n) => {\n return `${getErrorTitleFromErrorType(i18n, organizationId, errorType)} ${getErrorDescriptionFromErrorType(i18n, organizationId, platformUrl, errorType)}`;\n};\n","import {FunctionalComponent, h} from '@stencil/core';\nimport {i18n} from 'i18next';\nimport {getErrorDescriptionFromErrorType} from './utils';\n\ninterface QueryErrorDescriptionProps {\n errorType?: string;\n i18n: i18n;\n url: string;\n organizationId: string;\n}\n\nexport const QueryErrorDescription: FunctionalComponent<\n QueryErrorDescriptionProps\n> = ({errorType, i18n, url, organizationId}) => {\n return (\n <p part=\"description\" class=\"text-neutral-dark mt-2.5 text-lg\">\n {getErrorDescriptionFromErrorType(i18n, organizationId, url, errorType)}\n </p>\n );\n};\n","import {Fragment, FunctionalComponent, h} from '@stencil/core';\n\ninterface QueryErrorGuardProps {\n hasError: boolean;\n}\n\n// Replace with the when directive\nexport const QueryErrorGuard: FunctionalComponent<QueryErrorGuardProps> = (\n {hasError},\n children\n) => {\n if (!hasError) {\n return;\n }\n\n return <Fragment>{children}</Fragment>;\n};\n","import {FunctionalComponent, h} from '@stencil/core';\nimport {i18n} from 'i18next';\nimport {getErrorTitleFromErrorType} from './utils';\n\ninterface QueryErrorTitleProps {\n errorType?: string;\n i18n: i18n;\n organizationId: string;\n}\n\nexport const QueryErrorTitle: FunctionalComponent<QueryErrorTitleProps> = ({\n errorType,\n i18n,\n organizationId,\n}) => {\n return (\n <p part=\"title\" class=\"text-on-background mt-8 text-2xl\">\n {getErrorTitleFromErrorType(i18n, organizationId, errorType)}\n </p>\n );\n};\n","import {FunctionalComponent, h} from '@stencil/core';\nimport {i18n} from 'i18next';\nimport {KnownErrorType} from './known-error-types';\n\ninterface QueryErrorLinkProps {\n errorType?: string;\n i18n: i18n;\n}\n\nexport const QueryErrorLink: FunctionalComponent<QueryErrorLinkProps> = ({\n errorType,\n i18n,\n}) => {\n const getErrorLink = () => {\n switch (errorType as KnownErrorType) {\n case 'NoEndpointsException':\n return 'https://docs.coveo.com/en/mcc80216';\n case 'InvalidTokenException':\n return 'https://docs.coveo.com/en/102';\n case 'OrganizationIsPausedException':\n return 'https://docs.coveo.com/l6af0467';\n default:\n return null;\n }\n };\n\n const link = getErrorLink();\n\n return link ? (\n <a href={link} part=\"doc-link\" class=\"btn-primary mt-10 inline-block p-3\">\n {i18n.t('coveo-online-help')}\n </a>\n ) : null;\n};\n"],"version":3}