@coveo/atomic 3.33.9-pre.99566f9dae → 3.33.9-pre.a3f403762b
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.
- package/dist/atomic/_atomic.esm.js +1 -1
- package/dist/atomic/components/_index.js +19 -19
- package/dist/atomic/components/analytics-config.js +1 -1
- package/dist/atomic/components/atomic-field-condition.js +1 -1
- package/dist/atomic/components/atomic-field-condition.js.map +1 -1
- package/dist/atomic/components/atomic-insight-result-action.js +2 -2
- package/dist/atomic/components/atomic-insight-result-action.js.map +1 -1
- package/dist/atomic/components/atomic-insight-result-attach-to-case-action.js +2 -2
- package/dist/atomic/components/atomic-insight-result-attach-to-case-action.js.map +1 -1
- package/dist/atomic/components/atomic-insight-result-attach-to-case-indicator.js +2 -2
- package/dist/atomic/components/atomic-insight-result-attach-to-case-indicator.js.map +1 -1
- package/dist/atomic/components/atomic-insight-result-quickview-action.js +2 -2
- package/dist/atomic/components/atomic-insight-result-quickview-action.js.map +1 -1
- package/dist/atomic/components/atomic-ipx-result-link.js +2 -2
- package/dist/atomic/components/atomic-ipx-result-link.js.map +1 -1
- package/dist/atomic/components/atomic-quickview-modal2.js +1 -1
- package/dist/atomic/components/atomic-quickview.js +2 -2
- package/dist/atomic/components/atomic-quickview.js.map +1 -1
- package/dist/atomic/components/atomic-result-badge.js +1 -1
- package/dist/atomic/components/atomic-result-badge.js.map +1 -1
- package/dist/atomic/components/atomic-result-children.js +2 -2
- package/dist/atomic/components/atomic-result-children.js.map +1 -1
- package/dist/atomic/components/atomic-result-date.js +1 -1
- package/dist/atomic/components/atomic-result-date.js.map +1 -1
- package/dist/atomic/components/atomic-result-fields-list.js +2 -2
- package/dist/atomic/components/atomic-result-fields-list.js.map +1 -1
- package/dist/atomic/components/atomic-result-html.js +1 -1
- package/dist/atomic/components/atomic-result-html.js.map +1 -1
- package/dist/atomic/components/atomic-result-icon.js +1 -1
- package/dist/atomic/components/atomic-result-icon.js.map +1 -1
- package/dist/atomic/components/atomic-result-image.js +1 -1
- package/dist/atomic/components/atomic-result-image.js.map +1 -1
- package/dist/atomic/components/atomic-result-link.js +2 -2
- package/dist/atomic/components/atomic-result-link.js.map +1 -1
- package/dist/atomic/components/atomic-result-localized-text.js +1 -1
- package/dist/atomic/components/atomic-result-localized-text.js.map +1 -1
- package/dist/atomic/components/atomic-result-multi-value-text.js +1 -1
- package/dist/atomic/components/atomic-result-multi-value-text.js.map +1 -1
- package/dist/atomic/components/atomic-result-number.js +1 -1
- package/dist/atomic/components/atomic-result-number.js.map +1 -1
- package/dist/atomic/components/atomic-result-printable-uri.js +1 -1
- package/dist/atomic/components/atomic-result-printable-uri.js.map +1 -1
- package/dist/atomic/components/atomic-result-rating.js +1 -1
- package/dist/atomic/components/atomic-result-rating.js.map +1 -1
- package/dist/atomic/components/atomic-result-text2.js +1 -1
- package/dist/atomic/components/atomic-result-text2.js.map +1 -1
- package/dist/atomic/components/atomic-result-timespan.js +1 -1
- package/dist/atomic/components/atomic-result-timespan.js.map +1 -1
- package/dist/atomic/components/atomic-result2.js.map +1 -1
- package/dist/atomic/components/atomic-smart-snippet-source2.js +1 -1
- package/dist/atomic/components/atomic-smart-snippet-source2.js.map +1 -1
- package/dist/atomic/components/components/commerce/atomic-product-children/atomic-product-children.js +1 -1
- package/dist/atomic/components/components/commerce/atomic-product-description/atomic-product-description.js +1 -1
- package/dist/atomic/components/components/commerce/atomic-product-excerpt/atomic-product-excerpt.js +1 -1
- package/dist/atomic/components/components/commerce/atomic-product-field-condition/atomic-product-field-condition.js +1 -1
- package/dist/atomic/components/components/commerce/atomic-product-image/atomic-product-image.js +1 -1
- package/dist/atomic/components/components/commerce/atomic-product-link/atomic-product-link.js +1 -2
- package/dist/atomic/components/components/commerce/atomic-product-multi-value-text/atomic-product-multi-value-text.js +1 -1
- package/dist/atomic/components/components/commerce/atomic-product-numeric-field-value/atomic-product-numeric-field-value.js +1 -1
- package/dist/atomic/components/components/commerce/atomic-product-price/atomic-product-price.js +1 -1
- package/dist/atomic/components/components/commerce/atomic-product-rating/atomic-product-rating.js +1 -1
- package/dist/atomic/components/components/commerce/atomic-product-text/atomic-product-text.js +1 -1
- package/dist/atomic/components/components/common/item-list/fetch-item-context.js +15 -0
- package/dist/atomic/components/decorators/commerce/product-template-decorators.js +68 -0
- package/dist/atomic/components/global/environment.js +1 -1
- package/dist/atomic/components/index.js.map +1 -1
- package/dist/atomic/components/{stencil-result-template-decorators.js → result-template-decorators.js} +2 -6
- package/dist/atomic/components/result-template-decorators.js.map +1 -0
- package/dist/atomic/index.esm.js +1 -1
- package/dist/atomic/index.esm.js.map +1 -1
- package/dist/atomic/{p-0112f957.entry.js → p-0c8e7d5f.entry.js} +2 -2
- package/dist/atomic/p-0c8e7d5f.entry.js.map +1 -0
- package/dist/atomic/{p-c34f8190.entry.js → p-0f39889d.entry.js} +2 -2
- package/dist/atomic/p-0f39889d.entry.js.map +1 -0
- package/dist/atomic/{p-4080f740.js → p-18684d4c.js} +1 -1
- package/dist/atomic/p-18684d4c.js.map +1 -0
- package/dist/atomic/{p-4cf97b0a.entry.js → p-190ddaca.entry.js} +2 -2
- package/dist/atomic/p-190ddaca.entry.js.map +1 -0
- package/dist/atomic/{p-6a3b139f.entry.js → p-1ff7a9da.entry.js} +2 -2
- package/dist/atomic/p-1ff7a9da.entry.js.map +1 -0
- package/dist/atomic/{p-9c3cabca.entry.js → p-20019654.entry.js} +2 -2
- package/dist/atomic/p-20019654.entry.js.map +1 -0
- package/dist/atomic/{p-5894d6f6.entry.js → p-2e4628bb.entry.js} +2 -2
- package/dist/atomic/p-2e4628bb.entry.js.map +1 -0
- package/dist/atomic/{p-a5355f5d.entry.js → p-3ba27d6a.entry.js} +2 -2
- package/dist/atomic/{p-48d78fc6.entry.js → p-3e38aea6.entry.js} +2 -2
- package/dist/atomic/{p-268ce7ca.entry.js → p-4069d801.entry.js} +2 -2
- package/dist/atomic/p-4069d801.entry.js.map +1 -0
- package/dist/atomic/{p-bc94258c.entry.js → p-44ef70b6.entry.js} +2 -2
- package/dist/atomic/p-44ef70b6.entry.js.map +1 -0
- package/dist/atomic/{p-42617c90.entry.js → p-62afcf79.entry.js} +2 -2
- package/dist/atomic/p-62afcf79.entry.js.map +1 -0
- package/dist/atomic/{p-68896e7d.js → p-63dd5e46.js} +2 -2
- package/dist/atomic/{p-ca8c87ce.entry.js → p-723f76a1.entry.js} +2 -2
- package/dist/atomic/{p-ca8c87ce.entry.js.map → p-723f76a1.entry.js.map} +1 -1
- package/dist/atomic/{p-5a9460ab.entry.js → p-78427c6a.entry.js} +2 -2
- package/dist/atomic/p-78427c6a.entry.js.map +1 -0
- package/dist/atomic/{p-e1ab844f.entry.js → p-7b1cd0b5.entry.js} +2 -2
- package/dist/atomic/{p-cacb7fd8.entry.js → p-852cc16d.entry.js} +2 -2
- package/dist/atomic/p-852cc16d.entry.js.map +1 -0
- package/dist/atomic/p-93da1f4e.entry.js.map +1 -1
- package/dist/atomic/{p-c6e2939f.entry.js → p-93f1d551.entry.js} +2 -2
- package/dist/atomic/p-93f1d551.entry.js.map +1 -0
- package/dist/atomic/{p-e1dbe31d.entry.js → p-945ddd53.entry.js} +2 -2
- package/dist/atomic/p-945ddd53.entry.js.map +1 -0
- package/dist/atomic/{p-037de646.entry.js → p-a4d277c7.entry.js} +2 -2
- package/dist/atomic/p-a4d277c7.entry.js.map +1 -0
- package/dist/atomic/{p-8e964890.entry.js → p-b3f6561d.entry.js} +2 -2
- package/dist/atomic/p-b3f6561d.entry.js.map +1 -0
- package/dist/atomic/{p-c41ab197.entry.js → p-c25f1437.entry.js} +2 -2
- package/dist/atomic/p-c25f1437.entry.js.map +1 -0
- package/dist/atomic/{p-acb1704c.entry.js → p-c9f1790d.entry.js} +2 -2
- package/dist/atomic/p-c9f1790d.entry.js.map +1 -0
- package/dist/atomic/{p-9564d67d.entry.js → p-dbf0c5a3.entry.js} +2 -2
- package/dist/atomic/{p-9564d67d.entry.js.map → p-dbf0c5a3.entry.js.map} +1 -1
- package/dist/atomic/{p-beee63e4.entry.js → p-df1d50c8.entry.js} +2 -2
- package/dist/atomic/p-df1d50c8.entry.js.map +1 -0
- package/dist/atomic/{p-3ec45f9c.entry.js → p-e9dc8e90.entry.js} +2 -2
- package/dist/atomic/p-e9dc8e90.entry.js.map +1 -0
- package/dist/atomic/{p-8ce6badd.entry.js → p-ee957926.entry.js} +2 -2
- package/dist/atomic/p-ee957926.entry.js.map +1 -0
- package/dist/atomic/{p-5f2abcb4.entry.js → p-fafd5042.entry.js} +2 -2
- package/dist/atomic/p-fafd5042.entry.js.map +1 -0
- package/dist/cjs/_index.cjs.js +20 -20
- package/dist/cjs/{analytics-config-0af59f0d.js → analytics-config-9c9d5e75.js} +2 -2
- package/dist/cjs/{analytics-config-0af59f0d.js.map → analytics-config-9c9d5e75.js.map} +1 -1
- package/dist/cjs/atomic-field-condition.cjs.entry.js +2 -2
- package/dist/cjs/atomic-field-condition.cjs.entry.js.map +1 -1
- package/dist/cjs/atomic-insight-interface.cjs.entry.js +1 -1
- package/dist/cjs/atomic-insight-result-action.cjs.entry.js +3 -3
- package/dist/cjs/atomic-insight-result-action.cjs.entry.js.map +1 -1
- package/dist/cjs/atomic-insight-result-attach-to-case-action.cjs.entry.js +3 -3
- package/dist/cjs/atomic-insight-result-attach-to-case-action.cjs.entry.js.map +1 -1
- package/dist/cjs/atomic-insight-result-attach-to-case-indicator.cjs.entry.js +3 -3
- package/dist/cjs/atomic-insight-result-attach-to-case-indicator.cjs.entry.js.map +1 -1
- package/dist/cjs/atomic-insight-result-quickview-action.cjs.entry.js +3 -3
- package/dist/cjs/atomic-insight-result-quickview-action.cjs.entry.js.map +1 -1
- package/dist/cjs/atomic-ipx-result-link.cjs.entry.js +4 -4
- package/dist/cjs/atomic-ipx-result-link.cjs.entry.js.map +1 -1
- package/dist/cjs/atomic-quickview-modal.cjs.entry.js +1 -1
- package/dist/cjs/atomic-quickview.cjs.entry.js +3 -3
- package/dist/cjs/atomic-quickview.cjs.entry.js.map +1 -1
- package/dist/cjs/atomic-recs-interface.cjs.entry.js +1 -1
- package/dist/cjs/atomic-result-badge.cjs.entry.js +2 -2
- package/dist/cjs/atomic-result-badge.cjs.entry.js.map +1 -1
- package/dist/cjs/atomic-result-children.cjs.entry.js +3 -3
- package/dist/cjs/atomic-result-children.cjs.entry.js.map +1 -1
- package/dist/cjs/atomic-result-date.cjs.entry.js +2 -2
- package/dist/cjs/atomic-result-date.cjs.entry.js.map +1 -1
- package/dist/cjs/atomic-result-fields-list.cjs.entry.js +3 -3
- package/dist/cjs/atomic-result-fields-list.cjs.entry.js.map +1 -1
- package/dist/cjs/atomic-result-html.cjs.entry.js +2 -2
- package/dist/cjs/atomic-result-html.cjs.entry.js.map +1 -1
- package/dist/cjs/atomic-result-icon.cjs.entry.js +2 -2
- package/dist/cjs/atomic-result-icon.cjs.entry.js.map +1 -1
- package/dist/cjs/atomic-result-image.cjs.entry.js +2 -2
- package/dist/cjs/atomic-result-image.cjs.entry.js.map +1 -1
- package/dist/cjs/atomic-result-link.cjs.entry.js +4 -4
- package/dist/cjs/atomic-result-link.cjs.entry.js.map +1 -1
- package/dist/cjs/atomic-result-localized-text.cjs.entry.js +3 -3
- package/dist/cjs/atomic-result-localized-text.cjs.entry.js.map +1 -1
- package/dist/cjs/atomic-result-multi-value-text.cjs.entry.js +2 -2
- package/dist/cjs/atomic-result-multi-value-text.cjs.entry.js.map +1 -1
- package/dist/cjs/atomic-result-number.cjs.entry.js +2 -2
- package/dist/cjs/atomic-result-number.cjs.entry.js.map +1 -1
- package/dist/cjs/atomic-result-printable-uri.cjs.entry.js +2 -2
- package/dist/cjs/atomic-result-printable-uri.cjs.entry.js.map +1 -1
- package/dist/cjs/atomic-result-rating.cjs.entry.js +2 -2
- package/dist/cjs/atomic-result-rating.cjs.entry.js.map +1 -1
- package/dist/cjs/atomic-result-text_2.cjs.entry.js +2 -2
- package/dist/cjs/atomic-result-text_2.cjs.entry.js.map +1 -1
- package/dist/cjs/atomic-result-timespan.cjs.entry.js +2 -2
- package/dist/cjs/atomic-result-timespan.cjs.entry.js.map +1 -1
- package/dist/cjs/atomic-result.cjs.entry.js.map +1 -1
- package/dist/cjs/atomic-smart-snippet-answer_2.cjs.entry.js +1 -1
- package/dist/cjs/atomic-smart-snippet-answer_2.cjs.entry.js.map +1 -1
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/cjs/{stencil-result-template-decorators-28b05aaf.js → result-template-decorators-432d11a9.js} +2 -6
- package/dist/cjs/result-template-decorators-432d11a9.js.map +1 -0
- package/dist/cjs/version.cjs.js +1 -1
- package/dist/esm/_index.js +19 -19
- package/dist/esm/{analytics-config-67197f4c.js → analytics-config-a3308fef.js} +2 -2
- package/dist/esm/{analytics-config-67197f4c.js.map → analytics-config-a3308fef.js.map} +1 -1
- package/dist/esm/atomic-field-condition.entry.js +1 -1
- package/dist/esm/atomic-field-condition.entry.js.map +1 -1
- package/dist/esm/atomic-insight-interface.entry.js +1 -1
- package/dist/esm/atomic-insight-result-action.entry.js +2 -2
- package/dist/esm/atomic-insight-result-action.entry.js.map +1 -1
- package/dist/esm/atomic-insight-result-attach-to-case-action.entry.js +2 -2
- package/dist/esm/atomic-insight-result-attach-to-case-action.entry.js.map +1 -1
- package/dist/esm/atomic-insight-result-attach-to-case-indicator.entry.js +2 -2
- package/dist/esm/atomic-insight-result-attach-to-case-indicator.entry.js.map +1 -1
- package/dist/esm/atomic-insight-result-quickview-action.entry.js +2 -2
- package/dist/esm/atomic-insight-result-quickview-action.entry.js.map +1 -1
- package/dist/esm/atomic-ipx-result-link.entry.js +2 -2
- package/dist/esm/atomic-ipx-result-link.entry.js.map +1 -1
- package/dist/esm/atomic-quickview-modal.entry.js +1 -1
- package/dist/esm/atomic-quickview.entry.js +2 -2
- package/dist/esm/atomic-quickview.entry.js.map +1 -1
- package/dist/esm/atomic-recs-interface.entry.js +1 -1
- package/dist/esm/atomic-result-badge.entry.js +1 -1
- package/dist/esm/atomic-result-badge.entry.js.map +1 -1
- package/dist/esm/atomic-result-children.entry.js +2 -2
- package/dist/esm/atomic-result-children.entry.js.map +1 -1
- package/dist/esm/atomic-result-date.entry.js +1 -1
- package/dist/esm/atomic-result-date.entry.js.map +1 -1
- package/dist/esm/atomic-result-fields-list.entry.js +2 -2
- package/dist/esm/atomic-result-fields-list.entry.js.map +1 -1
- package/dist/esm/atomic-result-html.entry.js +1 -1
- package/dist/esm/atomic-result-html.entry.js.map +1 -1
- package/dist/esm/atomic-result-icon.entry.js +1 -1
- package/dist/esm/atomic-result-icon.entry.js.map +1 -1
- package/dist/esm/atomic-result-image.entry.js +1 -1
- package/dist/esm/atomic-result-image.entry.js.map +1 -1
- package/dist/esm/atomic-result-link.entry.js +2 -2
- package/dist/esm/atomic-result-link.entry.js.map +1 -1
- package/dist/esm/atomic-result-localized-text.entry.js +2 -2
- package/dist/esm/atomic-result-localized-text.entry.js.map +1 -1
- package/dist/esm/atomic-result-multi-value-text.entry.js +1 -1
- package/dist/esm/atomic-result-multi-value-text.entry.js.map +1 -1
- package/dist/esm/atomic-result-number.entry.js +1 -1
- package/dist/esm/atomic-result-number.entry.js.map +1 -1
- package/dist/esm/atomic-result-printable-uri.entry.js +1 -1
- package/dist/esm/atomic-result-printable-uri.entry.js.map +1 -1
- package/dist/esm/atomic-result-rating.entry.js +1 -1
- package/dist/esm/atomic-result-rating.entry.js.map +1 -1
- package/dist/esm/atomic-result-text_2.entry.js +1 -1
- package/dist/esm/atomic-result-text_2.entry.js.map +1 -1
- package/dist/esm/atomic-result-timespan.entry.js +1 -1
- package/dist/esm/atomic-result-timespan.entry.js.map +1 -1
- package/dist/esm/atomic-result.entry.js.map +1 -1
- package/dist/esm/atomic-smart-snippet-answer_2.entry.js +1 -1
- package/dist/esm/atomic-smart-snippet-answer_2.entry.js.map +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/{stencil-result-template-decorators-f989bc6b.js → result-template-decorators-2ed76ea9.js} +2 -6
- package/dist/esm/result-template-decorators-2ed76ea9.js.map +1 -0
- package/dist/esm/version.js +1 -1
- package/dist/types/components/commerce/atomic-product/atomic-product.d.ts +1 -1
- package/dist/types/components/commerce/product-template-component-utils/{context/stencil-product-template-decorators.d.ts → stencil-product-template-decorators.d.ts} +1 -1
- package/dist/types/components/common/smart-snippets/atomic-smart-snippet-source.d.ts +1 -1
- package/dist/types/components/search/atomic-result/atomic-result.d.ts +1 -1
- package/dist/types/components/search/{result-template-component-utils/context/stencil-result-template-decorators.d.ts → result-template-components/result-template-decorators.d.ts} +2 -6
- package/dist/types/decorators/commerce/product-template-decorators.d.ts +68 -0
- package/dist/types/index.d.ts +3 -3
- package/docs/atomic-docs.json +1 -1
- package/package.json +1 -1
- package/dist/atomic/components/components/commerce/product-template-component-utils/context/interactive-product-context-controller.js +0 -25
- package/dist/atomic/components/components/commerce/product-template-component-utils/context/product-context-controller.js +0 -29
- package/dist/atomic/components/stencil-result-template-decorators.js.map +0 -1
- package/dist/atomic/p-0112f957.entry.js.map +0 -1
- package/dist/atomic/p-037de646.entry.js.map +0 -1
- package/dist/atomic/p-268ce7ca.entry.js.map +0 -1
- package/dist/atomic/p-3ec45f9c.entry.js.map +0 -1
- package/dist/atomic/p-4080f740.js.map +0 -1
- package/dist/atomic/p-42617c90.entry.js.map +0 -1
- package/dist/atomic/p-4cf97b0a.entry.js.map +0 -1
- package/dist/atomic/p-5894d6f6.entry.js.map +0 -1
- package/dist/atomic/p-5a9460ab.entry.js.map +0 -1
- package/dist/atomic/p-5f2abcb4.entry.js.map +0 -1
- package/dist/atomic/p-6a3b139f.entry.js.map +0 -1
- package/dist/atomic/p-8ce6badd.entry.js.map +0 -1
- package/dist/atomic/p-8e964890.entry.js.map +0 -1
- package/dist/atomic/p-9c3cabca.entry.js.map +0 -1
- package/dist/atomic/p-acb1704c.entry.js.map +0 -1
- package/dist/atomic/p-bc94258c.entry.js.map +0 -1
- package/dist/atomic/p-beee63e4.entry.js.map +0 -1
- package/dist/atomic/p-c34f8190.entry.js.map +0 -1
- package/dist/atomic/p-c41ab197.entry.js.map +0 -1
- package/dist/atomic/p-c6e2939f.entry.js.map +0 -1
- package/dist/atomic/p-cacb7fd8.entry.js.map +0 -1
- package/dist/atomic/p-e1dbe31d.entry.js.map +0 -1
- package/dist/cjs/stencil-result-template-decorators-28b05aaf.js.map +0 -1
- package/dist/esm/stencil-result-template-decorators-f989bc6b.js.map +0 -1
- package/dist/types/components/commerce/product-template-component-utils/context/fetch-product-context.d.ts +0 -12
- package/dist/types/components/commerce/product-template-component-utils/context/interactive-product-context-controller.d.ts +0 -27
- package/dist/types/components/commerce/product-template-component-utils/context/product-context-controller.d.ts +0 -33
- package/dist/types/components/search/result-template-component-utils/context/fetch-result-context.d.ts +0 -8
- package/dist/types/components/search/result-template-component-utils/context/interactive-result-context-controller.d.ts +0 -12
- package/dist/types/components/search/result-template-component-utils/context/result-context-controller.d.ts +0 -18
- /package/dist/atomic/{p-a5355f5d.entry.js.map → p-3ba27d6a.entry.js.map} +0 -0
- /package/dist/atomic/{p-48d78fc6.entry.js.map → p-3e38aea6.entry.js.map} +0 -0
- /package/dist/atomic/{p-68896e7d.js.map → p-63dd5e46.js.map} +0 -0
- /package/dist/atomic/{p-e1ab844f.entry.js.map → p-7b1cd0b5.entry.js.map} +0 -0
@@ -8,8 +8,6 @@ import { I as ItemContext, a as InteractiveItemContext, i as itemContext } from
|
|
8
8
|
* @ResultContext() private result!: Result;
|
9
9
|
*
|
10
10
|
* For more information and examples, view the "Utilities" section of the readme.
|
11
|
-
*
|
12
|
-
* @deprecated should only be used for Stencil components. For Lit components, use `createResultContextController` from \@/src/components/search/result-template-component-utils/context/result-context-controller.ts
|
13
11
|
*/
|
14
12
|
function ResultContext(opts = { folded: false }) {
|
15
13
|
return ItemContext({ parentName: 'atomic-result', folded: opts.folded });
|
@@ -24,10 +22,8 @@ function InteractiveResultContext() {
|
|
24
22
|
*
|
25
23
|
* You should use the method in the [connectedCallback lifecycle method](https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_custom_elements#using_the_lifecycle_callbacks).
|
26
24
|
*
|
27
|
-
* @param element The element that the event is dispatched to, which must be the child of a rendered "atomic-result"
|
25
|
+
* @param element The element that the event is dispatched to, which must be the child of a rendered "atomic-result".
|
28
26
|
* @returns A promise that resolves on initialization of the parent "atomic-result" element, or rejects when there is no parent "atomic-result" element.
|
29
|
-
*
|
30
|
-
* @deprecated should only be used for Stencil components. For Lit components, use `fetchResultContext` from \@/src/components/search/result-template-component-utils/context/fetch-result-context.ts
|
31
27
|
*/
|
32
28
|
function resultContext(element) {
|
33
29
|
return itemContext(element, 'atomic-result');
|
@@ -35,4 +31,4 @@ function resultContext(element) {
|
|
35
31
|
|
36
32
|
export { InteractiveResultContext as I, ResultContext as R, resultContext as r };
|
37
33
|
|
38
|
-
//# sourceMappingURL=
|
34
|
+
//# sourceMappingURL=result-template-decorators-2ed76ea9.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"file":"result-template-decorators-2ed76ea9.js","mappings":";;AASA;;;;;;;;;SASgB,aAAa,CAAC,OAA0B,EAAC,MAAM,EAAE,KAAK,EAAC;IACrE,OAAO,WAAW,CAAC,EAAC,UAAU,EAAE,eAAe,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAC,CAAC,CAAC;AACzE,CAAC;SAEe,wBAAwB;IACtC,OAAO,sBAAsB,EAAE,CAAC;AAClC,CAAC;AAKD;;;;;;;;;;SAUgB,aAAa,CAC3B,OAAgB;IAEhB,OAAO,WAAW,CAAI,OAAO,EAAE,eAAe,CAAC,CAAC;AAClD;;;;","names":[],"sources":["src/components/search/result-template-components/result-template-decorators.tsx"],"sourcesContent":["import {FoldedResult, Result} from '@coveo/headless';\nimport {\n InteractiveItemContext,\n InteractiveItemContextEvent,\n ItemContext,\n ItemContextEvent,\n itemContext,\n} from '../../common/item-list/stencil-item-decorators';\n\n/**\n * A [StencilJS property decorator](https://stenciljs.com/) to be used for result template components.\n * This allows the Stencil component to fetch the current result from its rendered parent, the `atomic-result` component.\n *\n * Example:\n * @ResultContext() private result!: Result;\n *\n * For more information and examples, view the \"Utilities\" section of the readme.\n */\nexport function ResultContext(opts: {folded: boolean} = {folded: false}) {\n return ItemContext({parentName: 'atomic-result', folded: opts.folded});\n}\n\nexport function InteractiveResultContext() {\n return InteractiveItemContext();\n}\n\nexport type ResultContextEvent<T = Result> = ItemContextEvent<T>;\nexport type InteractiveResultContextEvent = InteractiveItemContextEvent;\n\n/**\n * Retrieves `Result` on a rendered `atomic-result`.\n *\n * This method is useful for building custom result template elements, see [Create a Result List](https://docs.coveo.com/en/atomic/latest/cc-search/create-custom-components/native-components/#custom-result-template-component-example) for more information.\n *\n * You should use the method in the [connectedCallback lifecycle method](https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_custom_elements#using_the_lifecycle_callbacks).\n *\n * @param element The element that the event is dispatched to, which must be the child of a rendered \"atomic-result\".\n * @returns A promise that resolves on initialization of the parent \"atomic-result\" element, or rejects when there is no parent \"atomic-result\" element.\n */\nexport function resultContext<T extends Result | FoldedResult = Result>(\n element: Element\n) {\n return itemContext<T>(element, 'atomic-result');\n}\n"],"version":3}
|
package/dist/esm/version.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
export const headlessVersion = '3.31.1';
|
2
|
-
export const atomicVersion = '3.33.9-pre.
|
2
|
+
export const atomicVersion = '3.33.9-pre.a3f403762b';
|
@@ -3,9 +3,9 @@ import { type CSSResultGroup, LitElement } from 'lit';
|
|
3
3
|
import type { DisplayConfig } from "../../common/item-list/context/item-display-config-context-controller";
|
4
4
|
import { type ItemRenderingFunction } from "../../common/item-list/item-list-common";
|
5
5
|
import { type ItemDisplayDensity, type ItemDisplayImageSize, type ItemDisplayLayout } from "../../common/layout/display-options";
|
6
|
+
import type { InteractiveProductContextEvent, ProductContextEvent } from "../../../decorators/commerce/product-template-decorators";
|
6
7
|
import type { CommerceStore } from '../atomic-commerce-interface/store';
|
7
8
|
import type { CommerceRecommendationStore } from '../atomic-commerce-recommendation-interface/store';
|
8
|
-
import type { InteractiveProductContextEvent, ProductContextEvent } from '../product-template-component-utils/context/product-context-controller';
|
9
9
|
declare const AtomicProduct_base: typeof LitElement;
|
10
10
|
/**
|
11
11
|
* The `atomic-product` component is used internally by the `atomic-commerce-product-list` and `atomic-commerce-recommendation-list` components.
|
@@ -9,6 +9,6 @@ import { Product } from '@coveo/headless/commerce';
|
|
9
9
|
* @param element - The element that the event is dispatched to, which must be the child of a rendered "atomic-product".
|
10
10
|
* @returns A promise that resolves on initialization of the parent "atomic-product" element, or rejects when there is no parent "atomic-product" element.
|
11
11
|
*
|
12
|
-
* @deprecated should only be used for Stencil components. For Lit components, use `fetchProductContext` from \@/src/
|
12
|
+
* @deprecated should only be used for Stencil components. For Lit components, use `fetchProductContext` from \@/src/decorators/commerce/product-template-decorators.ts
|
13
13
|
*/
|
14
14
|
export declare function productContext<T extends Product>(element: Element): Promise<T>;
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import { Result } from '@coveo/headless';
|
2
2
|
import { EventEmitter } from '../../../stencil-public-runtime';
|
3
3
|
import { InitializableComponent } from '../../../utils/initialization-utils';
|
4
|
+
import { ResultContextEvent } from '../../search/result-template-components/result-template-decorators';
|
4
5
|
import { AnyBindings } from '../interface/bindings';
|
5
|
-
import { ResultContextEvent } from "../../search/result-template-component-utils/context/stencil-result-template-decorators";
|
6
6
|
/**
|
7
7
|
* @part source-url
|
8
8
|
* @part source-title
|
@@ -3,7 +3,7 @@ import { DisplayConfig } from '../../common/item-list/stencil-item-decorators';
|
|
3
3
|
import { ItemRenderingFunction } from '../../common/item-list/stencil-item-list-common';
|
4
4
|
import { ItemDisplayDensity, ItemDisplayImageSize, ItemDisplayLayout } from '../../common/layout/display-options';
|
5
5
|
import { SearchStore } from '../atomic-search-interface/store';
|
6
|
-
import { InteractiveResultContextEvent, ResultContextEvent } from
|
6
|
+
import { InteractiveResultContextEvent, ResultContextEvent } from '../result-template-components/result-template-decorators';
|
7
7
|
/**
|
8
8
|
* The `atomic-result` component is used internally by the `atomic-result-list` component.
|
9
9
|
*/
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { FoldedResult, Result } from '@coveo/headless';
|
2
|
-
import { InteractiveItemContextEvent, ItemContextEvent } from
|
2
|
+
import { InteractiveItemContextEvent, ItemContextEvent } from '../../common/item-list/stencil-item-decorators';
|
3
3
|
/**
|
4
4
|
* A [StencilJS property decorator](https://stenciljs.com/) to be used for result template components.
|
5
5
|
* This allows the Stencil component to fetch the current result from its rendered parent, the `atomic-result` component.
|
@@ -8,8 +8,6 @@ import { InteractiveItemContextEvent, ItemContextEvent } from "../../../common/i
|
|
8
8
|
* @ResultContext() private result!: Result;
|
9
9
|
*
|
10
10
|
* For more information and examples, view the "Utilities" section of the readme.
|
11
|
-
*
|
12
|
-
* @deprecated should only be used for Stencil components. For Lit components, use `createResultContextController` from \@/src/components/search/result-template-component-utils/context/result-context-controller.ts
|
13
11
|
*/
|
14
12
|
export declare function ResultContext(opts?: {
|
15
13
|
folded: boolean;
|
@@ -24,9 +22,7 @@ export type InteractiveResultContextEvent = InteractiveItemContextEvent;
|
|
24
22
|
*
|
25
23
|
* You should use the method in the [connectedCallback lifecycle method](https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_custom_elements#using_the_lifecycle_callbacks).
|
26
24
|
*
|
27
|
-
* @param element The element that the event is dispatched to, which must be the child of a rendered "atomic-result"
|
25
|
+
* @param element The element that the event is dispatched to, which must be the child of a rendered "atomic-result".
|
28
26
|
* @returns A promise that resolves on initialization of the parent "atomic-result" element, or rejects when there is no parent "atomic-result" element.
|
29
|
-
*
|
30
|
-
* @deprecated should only be used for Stencil components. For Lit components, use `fetchResultContext` from \@/src/components/search/result-template-component-utils/context/fetch-result-context.ts
|
31
27
|
*/
|
32
28
|
export declare function resultContext<T extends Result | FoldedResult = Result>(element: Element): Promise<T>;
|
@@ -0,0 +1,68 @@
|
|
1
|
+
import type { InteractiveProduct, Product } from '@coveo/headless/commerce';
|
2
|
+
import type { LitElement } from 'lit';
|
3
|
+
import { InteractiveItemContextController, type InteractiveItemContextEvent } from "../../components/common/item-list/context/interactive-item-context-controller";
|
4
|
+
import { ItemContextController, type ItemContextEvent } from "../../components/common/item-list/context/item-context-controller";
|
5
|
+
/**
|
6
|
+
* Creates a [Lit reactive controller](https://lit.dev/docs/composition/controllers/) for managing product context in product template components.
|
7
|
+
*
|
8
|
+
* @param host - The Lit component instance
|
9
|
+
* @param options - Configuration options
|
10
|
+
* @returns ItemContextController instance configured for atomic-product
|
11
|
+
*
|
12
|
+
* @example
|
13
|
+
* ```typescript
|
14
|
+
* @customElement('my-product-component')
|
15
|
+
* export class MyProductComponent extends LitElement {
|
16
|
+
* private productController = createProductContextController(this);
|
17
|
+
*
|
18
|
+
* @state() product!: Product;
|
19
|
+
*
|
20
|
+
* render() {
|
21
|
+
* this.product = this.productController.item;
|
22
|
+
* return html`<div>${this.product?.ec_name}</div>`;
|
23
|
+
* }
|
24
|
+
* }
|
25
|
+
* ```
|
26
|
+
*/
|
27
|
+
export declare function createProductContextController(host: LitElement & {
|
28
|
+
error: Error | null;
|
29
|
+
}, options?: {
|
30
|
+
folded?: boolean;
|
31
|
+
}): ItemContextController<Product>;
|
32
|
+
/**
|
33
|
+
* Creates a [Lit reactive controller](https://lit.dev/docs/composition/controllers/) for managing interactive product context in product template components.
|
34
|
+
*
|
35
|
+
* @param host - The Lit component instance
|
36
|
+
* @returns InteractiveItemContextController instance
|
37
|
+
*
|
38
|
+
* @example
|
39
|
+
* ```typescript
|
40
|
+
* @customElement('my-interactive-product-component')
|
41
|
+
* export class MyInteractiveProductComponent extends LitElement {
|
42
|
+
* private interactiveProductController = createInteractiveProductContextController(this);
|
43
|
+
*
|
44
|
+
* @state() product!: Product;
|
45
|
+
*
|
46
|
+
* render() {
|
47
|
+
* this.product = this.interactiveProductController.interactiveItem;
|
48
|
+
* return html`<div>${this.product?.ec_name}</div>`;
|
49
|
+
* }
|
50
|
+
* }
|
51
|
+
* ```
|
52
|
+
*/
|
53
|
+
export declare function createInteractiveProductContextController(host: LitElement & {
|
54
|
+
error: Error;
|
55
|
+
}): InteractiveItemContextController<InteractiveProduct>;
|
56
|
+
export type ProductContextEvent<T = Product> = ItemContextEvent<T>;
|
57
|
+
export type InteractiveProductContextEvent<T extends InteractiveProduct = InteractiveProduct> = InteractiveItemContextEvent<T>;
|
58
|
+
/**
|
59
|
+
* Retrieves `Product` on a rendered `atomic-product`.
|
60
|
+
*
|
61
|
+
* 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.
|
62
|
+
*
|
63
|
+
* 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).
|
64
|
+
*
|
65
|
+
* @param element - The element that the event is dispatched to, which must be the child of a rendered `atomic-product`.
|
66
|
+
* @returns A promise that resolves on initialization of the parent `atomic-product` element, or rejects when there is no parent `atomic-product` element.
|
67
|
+
*/
|
68
|
+
export declare function fetchProductContext<T extends Product>(element: Element): Promise<T>;
|
package/dist/types/index.d.ts
CHANGED
@@ -2,8 +2,7 @@ export type { i18n } from 'i18next';
|
|
2
2
|
export { Components, JSX } from './components';
|
3
3
|
export { CommerceBindings } from './components/commerce/atomic-commerce-interface/atomic-commerce-interface';
|
4
4
|
export { SelectChildProductEventArgs } from './components/commerce/atomic-product-children/select-child-product-event';
|
5
|
-
export {
|
6
|
-
export { productContext } from './components/commerce/product-template-component-utils/context/stencil-product-template-decorators';
|
5
|
+
export { productContext } from './components/commerce/product-template-component-utils/stencil-product-template-decorators';
|
7
6
|
export { PopoverChildFacet } from './components/common/facets/popover/popover-type';
|
8
7
|
export { RedirectionPayload } from './components/common/search-box/redirection-payload';
|
9
8
|
export { dispatchSearchBoxSuggestionsEvent } from './components/common/suggestions/suggestions-events';
|
@@ -11,6 +10,7 @@ export type { SearchBoxSuggestionElement, SearchBoxSuggestions, SearchBoxSuggest
|
|
11
10
|
export { elementHasNoQuery, elementHasQuery, } from './components/common/suggestions/suggestions-utils';
|
12
11
|
export { RecsBindings } from './components/recommendations/atomic-recs-interface/atomic-recs-interface';
|
13
12
|
export { Bindings } from './components/search/atomic-search-interface/atomic-search-interface';
|
14
|
-
export { resultContext } from './components/search/result-template-
|
13
|
+
export { resultContext } from './components/search/result-template-components/result-template-decorators';
|
14
|
+
export { fetchProductContext } from './decorators/commerce/product-template-decorators';
|
15
15
|
export { initializeBindings, MissingInterfaceParentError, } from './utils/initialization-utils';
|
16
16
|
export { bindLogDocumentOpenOnResult } from './utils/result-utils';
|
package/docs/atomic-docs.json
CHANGED
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@coveo/atomic",
|
3
3
|
"type": "module",
|
4
|
-
"version": "3.33.9-pre.
|
4
|
+
"version": "3.33.9-pre.a3f403762b",
|
5
5
|
"description": "A web-component library for building modern UIs interfacing with the Coveo platform",
|
6
6
|
"homepage": "https://docs.coveo.com/en/atomic/latest/",
|
7
7
|
"repository": {
|
@@ -1,25 +0,0 @@
|
|
1
|
-
import { InteractiveItemContextController } from "../../../common/item-list/context/interactive-item-context-controller";
|
2
|
-
/**
|
3
|
-
* Creates a [Lit reactive controller](https://lit.dev/docs/composition/controllers/) for managing interactive product context in product template components.
|
4
|
-
*
|
5
|
-
* @param host - The Lit component instance
|
6
|
-
* @returns InteractiveItemContextController instance
|
7
|
-
*
|
8
|
-
* @example
|
9
|
-
* ```typescript
|
10
|
-
* @customElement('my-interactive-product-component')
|
11
|
-
* export class MyInteractiveProductComponent extends LitElement {
|
12
|
-
* private interactiveProductController = createInteractiveProductContextController(this);
|
13
|
-
*
|
14
|
-
* @state() product!: Product;
|
15
|
-
*
|
16
|
-
* render() {
|
17
|
-
* this.product = this.interactiveProductController.interactiveItem;
|
18
|
-
* return html`<div>${this.product?.ec_name}</div>`;
|
19
|
-
* }
|
20
|
-
* }
|
21
|
-
* ```
|
22
|
-
*/
|
23
|
-
export function createInteractiveProductContextController(host) {
|
24
|
-
return new InteractiveItemContextController(host);
|
25
|
-
}
|
@@ -1,29 +0,0 @@
|
|
1
|
-
import { ItemContextController, } from "../../../common/item-list/context/item-context-controller";
|
2
|
-
/**
|
3
|
-
* Creates a [Lit reactive controller](https://lit.dev/docs/composition/controllers/) for managing product context in product template components.
|
4
|
-
*
|
5
|
-
* @param host - The Lit component instance
|
6
|
-
* @param options - Configuration options
|
7
|
-
* @returns ItemContextController instance configured for atomic-product
|
8
|
-
*
|
9
|
-
* @example
|
10
|
-
* ```typescript
|
11
|
-
* @customElement('my-product-component')
|
12
|
-
* export class MyProductComponent extends LitElement {
|
13
|
-
* private productController = createProductContextController(this);
|
14
|
-
*
|
15
|
-
* @state() product!: Product;
|
16
|
-
*
|
17
|
-
* render() {
|
18
|
-
* this.product = this.productController.item;
|
19
|
-
* return html`<div>${this.product?.ec_name}</div>`;
|
20
|
-
* }
|
21
|
-
* }
|
22
|
-
* ```
|
23
|
-
*/
|
24
|
-
export function createProductContextController(host, options = {}) {
|
25
|
-
return new ItemContextController(host, {
|
26
|
-
parentName: 'atomic-product',
|
27
|
-
folded: options.folded ?? false,
|
28
|
-
});
|
29
|
-
}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"file":"stencil-result-template-decorators.js","mappings":";;AASA;;;;;;;;;;;SAWgB,aAAa,CAAC,OAA0B,EAAC,MAAM,EAAE,KAAK,EAAC;IACrE,OAAO,WAAW,CAAC,EAAC,UAAU,EAAE,eAAe,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAC,CAAC,CAAC;AACzE,CAAC;SAEe,wBAAwB;IACtC,OAAO,sBAAsB,EAAE,CAAC;AAClC,CAAC;AAKD;;;;;;;;;;;;SAYgB,aAAa,CAC3B,OAAgB;IAEhB,OAAO,WAAW,CAAI,OAAO,EAAE,eAAe,CAAC,CAAC;AAClD;;;;","names":[],"sources":["src/components/search/result-template-component-utils/context/stencil-result-template-decorators.tsx"],"sourcesContent":["import {FoldedResult, Result} from '@coveo/headless';\nimport {\n InteractiveItemContext,\n InteractiveItemContextEvent,\n ItemContext,\n ItemContextEvent,\n itemContext,\n} from '@/src/components/common/item-list/stencil-item-decorators';\n\n/**\n * A [StencilJS property decorator](https://stenciljs.com/) to be used for result template components.\n * This allows the Stencil component to fetch the current result from its rendered parent, the `atomic-result` component.\n *\n * Example:\n * @ResultContext() private result!: Result;\n *\n * For more information and examples, view the \"Utilities\" section of the readme.\n * \n * @deprecated should only be used for Stencil components. For Lit components, use `createResultContextController` from \\@/src/components/search/result-template-component-utils/context/result-context-controller.ts\n */\nexport function ResultContext(opts: {folded: boolean} = {folded: false}) {\n return ItemContext({parentName: 'atomic-result', folded: opts.folded});\n}\n\nexport function InteractiveResultContext() {\n return InteractiveItemContext();\n}\n\nexport type ResultContextEvent<T = Result> = ItemContextEvent<T>;\nexport type InteractiveResultContextEvent = InteractiveItemContextEvent;\n\n/**\n * Retrieves `Result` on a rendered `atomic-result`.\n *\n * This method is useful for building custom result template elements, see [Create a Result List](https://docs.coveo.com/en/atomic/latest/cc-search/create-custom-components/native-components/#custom-result-template-component-example) for more information.\n *\n * You should use the method in the [connectedCallback lifecycle method](https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_custom_elements#using_the_lifecycle_callbacks).\n *\n * @param element The element that the event is dispatched to, which must be the child of a rendered \"atomic-result\" element.\n * @returns A promise that resolves on initialization of the parent \"atomic-result\" element, or rejects when there is no parent \"atomic-result\" element.\n * \n * @deprecated should only be used for Stencil components. For Lit components, use `fetchResultContext` from \\@/src/components/search/result-template-component-utils/context/fetch-result-context.ts\n */\nexport function resultContext<T extends Result | FoldedResult = Result>(\n element: Element\n) {\n return itemContext<T>(element, 'atomic-result');\n}\n"],"version":3}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["atomicResultMultiValueTextCss","AtomicResultMultiValueTextStyle0","AtomicResultMultiValueText","this","maxValuesToDisplay","delimiter","sortedValues","initialize","breadcrumbManager","buildBreadcrumbManager","bindings","engine","resultValues","value","ResultTemplatesHelpers","getResultProperty","result","field","Array","isArray","map","v","trim","error","Error","split","facetSelectedValues","state","facetBreadcrumbs","filter","facet","reduce","values","updateSortedValues","allValues","allValuesSet","Set","firstValues","has","from","set","add","getShouldDisplayLabel","length","getNumberOfValuesToDisplay","Math","min","renderValue","label","getFieldValueCaption","i18n","kebabValue","titleToKebab","h","key","part","name","renderSeparator","beforeValue","afterValue","class","renderMoreLabel","t","renderListItems","numberOfValuesToDisplay","nodes","i","push","componentWillRender","render","host","remove","__decorate","InitializeBindings","ResultContext"],"sources":["src/components/search/result-template-components/atomic-result-multi-value-text/atomic-result-multi-value-text.pcss?tag=atomic-result-multi-value-text&encapsulation=shadow","src/components/search/result-template-components/atomic-result-multi-value-text/atomic-result-multi-value-text.tsx"],"sourcesContent":[":host {\n > ul {\n display: flex;\n list-style: none;\n margin: 0;\n padding: 0;\n\n li {\n display: inline-block;\n }\n }\n}\n\n.separator {\n &::before {\n display: inline;\n content: ',\\00a0';\n }\n}\n","import {\n BreadcrumbManager,\n buildBreadcrumbManager,\n Result,\n ResultTemplatesHelpers,\n} from '@coveo/headless';\nimport {Component, Element, Prop, h, State, VNode} from '@stencil/core';\nimport {getFieldValueCaption} from '../../../../utils/field-utils';\nimport {InitializeBindings} from '../../../../utils/initialization-utils';\nimport {titleToKebab} from '../../../../utils/utils';\nimport {Bindings} from '../../atomic-search-interface/atomic-search-interface';\nimport {ResultContext} from '@/src/components/search/result-template-component-utils/context/stencil-result-template-decorators';\n\n/**\n * The `atomic-result-multi-value-text` component renders the values of a multi-value string field.\n * @part result-multi-value-text-list - The list of field values.\n * @part result-multi-value-text-separator - The separator to display between each of the field values.\n * @part result-multi-value-text-value - A field value.\n * @part result-multi-value-text-value-more - A label indicating some values were omitted.\n * @slot result-multi-value-text-value-* - A custom caption value that's specified for a given part of a multi-text field value. For example, if you want to use `Off-Campus Resident` as a caption value for `Off-campus apartment` in `Off-campus apartment;On-campus apartment`, you'd use `<span slot=\"result-multi-value-text-value-off-campus-apartment\">Off-Campus Resident</span>`). The suffix of this slot corresponds with the field value, written in kebab case.\n */\n@Component({\n tag: 'atomic-result-multi-value-text',\n styleUrl: 'atomic-result-multi-value-text.pcss',\n shadow: true,\n})\nexport class AtomicResultMultiValueText {\n public breadcrumbManager!: BreadcrumbManager;\n\n @InitializeBindings() public bindings!: Bindings;\n @ResultContext() private result!: Result;\n\n @Element() host!: HTMLElement;\n\n @State() public error!: Error;\n\n /**\n * The field that the component should use.\n * The component will try to find this field in the `Result.raw` object unless it finds it in the `Result` object first.\n * Make sure this field is present in the `fieldsToInclude` property of the `atomic-search-interface` component.\n */\n @Prop({reflect: true}) public field!: string;\n\n /**\n * The maximum number of field values to display.\n * If there are _n_ more values than the specified maximum, the last displayed value will be \"_n_ more...\".\n */\n @Prop({reflect: true}) public maxValuesToDisplay = 3;\n\n /**\n * The delimiter used to separate values when the field isn't indexed as a multi value field.\n */\n @Prop({reflect: true}) public delimiter: string | null = null;\n\n private sortedValues: string[] | null = null;\n\n public initialize() {\n this.breadcrumbManager = buildBreadcrumbManager(this.bindings.engine);\n }\n\n private get resultValues() {\n const value = ResultTemplatesHelpers.getResultProperty(\n this.result,\n this.field\n );\n\n if (value === null) {\n return null;\n }\n\n if (Array.isArray(value)) {\n return value.map((v) => `${v}`.trim());\n }\n\n if (typeof value !== 'string' || value.trim() === '') {\n this.error = new Error(\n `Could not parse \"${value}\" from field \"${this.field}\" as a string array.`\n );\n return null;\n }\n\n return this.delimiter\n ? value.split(this.delimiter).map((value) => value.trim())\n : [value];\n }\n\n private get facetSelectedValues() {\n return this.breadcrumbManager.state.facetBreadcrumbs\n .filter((facet) => facet.field === this.field)\n .reduce(\n (values, facet) => [\n ...values,\n ...facet.values.map(({value}) => value.value),\n ],\n [] as string[]\n );\n }\n\n private updateSortedValues() {\n const allValues = this.resultValues;\n if (allValues === null) {\n this.sortedValues = null;\n return;\n }\n const allValuesSet = new Set(allValues);\n const firstValues = this.facetSelectedValues.filter((value) =>\n allValuesSet.has(value)\n );\n this.sortedValues = Array.from(\n allValues.reduce((set, value) => set.add(value), new Set(firstValues))\n );\n }\n\n private getShouldDisplayLabel(values: string[]) {\n return (\n this.maxValuesToDisplay > 0 && values.length > this.maxValuesToDisplay\n );\n }\n\n private getNumberOfValuesToDisplay(values: string[]) {\n return Math.min(values.length, this.maxValuesToDisplay);\n }\n\n private renderValue(value: string) {\n const label = getFieldValueCaption(this.field, value, this.bindings.i18n);\n const kebabValue = titleToKebab(value);\n return (\n <li key={value} part=\"result-multi-value-text-value\">\n <slot name={`result-multi-value-text-value-${kebabValue}`}>\n {label}\n </slot>\n </li>\n );\n }\n\n private renderSeparator(beforeValue: string, afterValue: string) {\n return (\n <li\n aria-hidden=\"true\"\n part=\"result-multi-value-text-separator\"\n key={`${beforeValue}~${afterValue}`}\n class=\"separator\"\n ></li>\n );\n }\n\n private renderMoreLabel(value: number) {\n return (\n <li key=\"more-field-values\" part=\"result-multi-value-text-value-more\">\n {this.bindings.i18n.t('n-more', {value})}\n </li>\n );\n }\n\n private renderListItems(values: string[]) {\n const numberOfValuesToDisplay = this.getNumberOfValuesToDisplay(values);\n\n const nodes: VNode[] = [];\n for (let i = 0; i < numberOfValuesToDisplay; i++) {\n if (i > 0) {\n nodes.push(this.renderSeparator(values[i - 1], values[i]));\n }\n nodes.push(this.renderValue(values[i]));\n }\n if (this.getShouldDisplayLabel(values)) {\n nodes.push(\n this.renderSeparator(\n values[numberOfValuesToDisplay - 1],\n 'more-field-values'\n )\n );\n nodes.push(this.renderMoreLabel(values.length - numberOfValuesToDisplay));\n }\n return nodes;\n }\n\n public componentWillRender() {\n this.updateSortedValues();\n }\n\n public render() {\n if (this.sortedValues === null) {\n this.host.remove();\n return;\n }\n return (\n <ul part=\"result-multi-value-text-list\">\n {...this.renderListItems(this.sortedValues)}\n </ul>\n );\n }\n}\n"],"mappings":"+bAAA,MAAMA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ignoreList":[]}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["atomicFieldConditionCss","AtomicFieldConditionStyle0","AtomicFieldCondition","this","mustMatch","mustNotMatch","conditions","shouldBeRemoved","componentWillLoad","ifDefined","fieldNames","split","push","ResultTemplatesHelpers","fieldsMustBeDefined","ifNotDefined","fieldsMustNotBeDefined","makeMatchConditions","render","every","condition","result","h","componentDidLoad","host","remove","__decorate","MapProp","splitValues","ResultContext"],"sources":["src/components/search/result-template-components/atomic-field-condition/atomic-field-condition.pcss?tag=atomic-field-condition","src/components/search/result-template-components/atomic-field-condition/atomic-field-condition.tsx"],"sourcesContent":["atomic-field-condition {\n max-width: 100%;\n}\n","import {\n Result,\n ResultTemplateCondition,\n ResultTemplatesHelpers,\n} from '@coveo/headless';\nimport {Component, Prop, h, Element} from '@stencil/core';\nimport {MapProp} from '../../../../utils/props-utils';\nimport {makeMatchConditions} from '../../../common/result-templates/result-template-common';\nimport {ResultContext} from '@/src/components/search/result-template-component-utils/context/stencil-result-template-decorators';\n\n/**\n * The `atomic-field-condition` component takes a list of conditions that, if fulfilled, apply the template in which it's defined.\n * The condition properties can be based on any top-level result property of the `result` object, not restricted to fields (e.g., `isRecommendation`).\n *\n * @slot default - The content to display if the conditions are met.\n *\n * @MapProp name: mustMatch;attr: must-match;docs: The field and values that define which result items the condition must be applied to. For example, a template with the following attribute only applies to result items whose `filetype` is `lithiummessage` or `YouTubePlaylist`: `must-match-filetype=\"lithiummessage,YouTubePlaylist\"`;type: Record<string, string[]> ;default: {}\n * @MapProp name: mustNotMatch;attr: must-not-match;docs: The field and values that define which result items the condition must not be applied to. For example, a template with the following attribute only applies to result items whose `filetype` is not `lithiummessage`: `must-not-match-filetype=\"lithiummessage\";type: Record<string, string[]> ;default: {}\n */\n@Component({\n tag: 'atomic-field-condition',\n styleUrl: 'atomic-field-condition.pcss',\n shadow: false,\n})\nexport class AtomicFieldCondition {\n @Element() host!: HTMLElement;\n\n /**\n * Verifies whether the specified fields are defined.\n */\n @Prop({reflect: true}) ifDefined?: string;\n /**\n * Verifies whether the specified fields are not defined.\n */\n @Prop({reflect: true}) ifNotDefined?: string;\n\n /**\n * Verifies whether the specified fields match the specified values.\n * @type {Record<string, string[]>}\n */\n @Prop() @MapProp({splitValues: true}) mustMatch: Record<string, string[]> =\n {};\n\n /**\n * Verifies whether the specified fields do not match the specified values.\n * @type {Record<string, string[]>}\n */\n @Prop() @MapProp({splitValues: true}) mustNotMatch: Record<string, string[]> =\n {};\n\n private conditions: ResultTemplateCondition[] = [];\n private shouldBeRemoved = false;\n\n @ResultContext() private result!: Result;\n\n public componentWillLoad() {\n if (this.ifDefined) {\n const fieldNames = this.ifDefined.split(',');\n this.conditions.push(\n ResultTemplatesHelpers.fieldsMustBeDefined(fieldNames)\n );\n }\n\n if (this.ifNotDefined) {\n const fieldNames = this.ifNotDefined.split(',');\n this.conditions.push(\n ResultTemplatesHelpers.fieldsMustNotBeDefined(fieldNames)\n );\n }\n\n this.conditions.push(\n ...makeMatchConditions(this.mustMatch, this.mustNotMatch)\n );\n }\n\n public render() {\n if (!this.conditions.every((condition) => condition(this.result))) {\n this.shouldBeRemoved = true;\n return '';\n }\n\n return <slot />;\n }\n\n public componentDidLoad() {\n this.shouldBeRemoved && this.host.remove();\n }\n}\n"],"mappings":"4aAAA,MAAMA,EAA0B,yCAChC,MAAAC,EAAeD,E,iXCuBFE,EAAoB,M,yBAgBOC,KAAAC,UACpC,GAMoCD,KAAAE,aACpC,GAEMF,KAAAG,WAAwC,GACxCH,KAAAI,gBAAkB,M,oEAVxB,G,kBAOA,E,CAOK,iBAAAC,GACL,GAAIL,KAAKM,UAAW,CAClB,MAAMC,EAAaP,KAAKM,UAAUE,MAAM,KACxCR,KAAKG,WAAWM,KACdC,EAAuBC,oBAAoBJ,G,CAI/C,GAAIP,KAAKY,aAAc,CACrB,MAAML,EAAaP,KAAKY,aAAaJ,MAAM,KAC3CR,KAAKG,WAAWM,KACdC,EAAuBG,uBAAuBN,G,CAIlDP,KAAKG,WAAWM,QACXK,EAAoBd,KAAKC,UAAWD,KAAKE,c,CAIzC,MAAAa,GACL,IAAKf,KAAKG,WAAWa,OAAOC,GAAcA,EAAUjB,KAAKkB,UAAU,CACjElB,KAAKI,gBAAkB,KACvB,MAAO,E,CAGT,OAAOe,EAAA,Y,CAGF,gBAAAC,GACLpB,KAAKI,iBAAmBJ,KAAKqB,KAAKC,Q,6BA7CEC,EAAA,CAA7BC,EAAQ,CAACC,YAAa,Q,gCAOOF,EAAA,CAA7BC,EAAQ,CAACC,YAAa,Q,mCAMNF,EAAA,CAAxBG,K","ignoreList":[]}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["atomicResultBadgeCss","AtomicResultBadgeStyle0","AtomicResultBadge","renderIcon","h","part","icon","this","class","getTextContent","field","undefined","label","value","renderText","renderBadge","componentWillRender","hasValue","ResultTemplatesHelpers","getResultProperty","result","host","remove","render","__decorate","ResultContext"],"sources":["src/components/search/result-template-components/atomic-result-badge/atomic-result-badge.pcss?tag=atomic-result-badge&encapsulation=shadow","src/components/search/result-template-components/atomic-result-badge/atomic-result-badge.tsx"],"sourcesContent":["@import '../../../../global/global.pcss';\n\n:host {\n display: inline-flex;\n place-items: center;\n height: var(--row-height, auto);\n word-break: break-word;\n}\n","import {Result, ResultTemplatesHelpers} from '@coveo/headless';\nimport {Component, Element, Prop, h} from '@stencil/core';\nimport {ResultContext} from '@/src/components/search/result-template-component-utils/context/stencil-result-template-decorators';\n\n/**\n * The `atomic-result-badge` element renders a badge to highlight special features of a result.\n *\n * A badge can either display:\n * * Text:\n * ```html\n * <atomic-result-badge label=\"trending\"></atomic-result-badge>\n * ```\n * * The contents of a single-value field:\n * ```html\n * <atomic-result-badge field=\"objecttype\"></atomic-result-badge>\n * ```\n * * An icon:\n * ```html\n * <atomic-result-badge icon=\"https://my-website.fake/star.svg\"></atomic-result-badge>\n * ```\n * * Slotted elements:\n * ```html\n * <atomic-result-badge icon=\"https://my-website.fake/stopwatch.svg\">\n * Deal ends in <my-dynamic-countdown></my-dynamic-countdown>\n * </atomic-result-badge>\n * ```\n *\n * The contents of a multi-value field can be displayed as in the following example:\n * ```html\n * <atomic-result-badge icon=\"https://my-website.fake/language.svg\">\n * <atomic-result-multi-value-text field=\"language\"></atomic-result-multi-value-text>\n * </atomic-result-badge>\n * ```\n *\n * @part result-badge-element - The decorative outer-most element with the background color and text color.\n * @part result-badge-icon - The icon displayed at the left-end of the badge, if present.\n * @part result-badge-label - The wrapper around the contents at the right-end of the badge. This may be text, a field or slotted elements depending on which was configured.\n * @slot default - The element(s) to display inside the badge, instead of a field or label.\n */\n@Component({\n tag: 'atomic-result-badge',\n styleUrl: 'atomic-result-badge.pcss',\n shadow: true,\n})\nexport class AtomicResultBadge {\n @ResultContext() private result!: Result;\n @Element() host!: HTMLElement;\n /**\n * The field to display in the badge.\n *\n * Not compatible with `label`, slotted elements nor multi-value fields.\n */\n @Prop({reflect: true}) public field?: string;\n\n /**\n * The text to display in the badge.\n *\n * Not compatible with `field` nor slotted elements.\n */\n @Prop({reflect: true}) public label?: string;\n\n /**\n * Specifies an icon to display at the left-end of the badge.\n * This can be used in conjunction with `field`, `label` or slotted elements.\n *\n * - Use a value that starts with `http://`, `https://`, `./`, or `../`, to fetch and display an icon from a given location.\n * - Use a value that starts with `assets://`, to display an icon from the Atomic package.\n * - Use a stringified SVG to display it directly\n */\n @Prop({reflect: true}) public icon?: string;\n\n private renderIcon() {\n return (\n <atomic-icon\n part=\"result-badge-icon\"\n icon={this.icon!}\n class=\"h-3 w-3 fill-current\"\n ></atomic-icon>\n );\n }\n\n private getTextContent() {\n if (this.field !== undefined) {\n return <atomic-result-text field={this.field}></atomic-result-text>;\n }\n if (this.label !== undefined) {\n return <atomic-text value={this.label}></atomic-text>;\n }\n return <slot></slot>;\n }\n\n private renderText() {\n return <span part=\"result-badge-label\">{this.getTextContent()}</span>;\n }\n\n private renderBadge() {\n return (\n <div\n part=\"result-badge-element\"\n class=\"bg-neutral-light text-neutral-dark inline-flex h-full place-items-center space-x-1.5 rounded-full px-3\"\n >\n {this.icon && this.renderIcon()}\n {this.renderText()}\n </div>\n );\n }\n\n componentWillRender() {\n if (this.field) {\n const hasValue =\n ResultTemplatesHelpers.getResultProperty(this.result, this.field) !==\n null;\n if (!hasValue) {\n this.host.remove();\n }\n }\n }\n\n render() {\n return this.renderBadge();\n }\n}\n"],"mappings":"uNAAA,MAAMA,EAAuB,2kjEAC7B,MAAAC,EAAeD,E,iXC2CFE,EAAiB,M,uFA2BpB,UAAAC,GACN,OACEC,EAAA,eACEC,KAAK,oBACLC,KAAMC,KAAKD,KACXE,MAAM,wB,CAKJ,cAAAC,GACN,GAAIF,KAAKG,QAAUC,UAAW,CAC5B,OAAOP,EAAA,sBAAoBM,MAAOH,KAAKG,O,CAEzC,GAAIH,KAAKK,QAAUD,UAAW,CAC5B,OAAOP,EAAA,eAAaS,MAAON,KAAKK,O,CAElC,OAAOR,EAAA,Y,CAGD,UAAAU,GACN,OAAOV,EAAA,QAAMC,KAAK,sBAAsBE,KAAKE,iB,CAGvC,WAAAM,GACN,OACEX,EAAA,OACEC,KAAK,uBACLG,MAAM,0GAELD,KAAKD,MAAQC,KAAKJ,aAClBI,KAAKO,a,CAKZ,mBAAAE,GACE,GAAIT,KAAKG,MAAO,CACd,MAAMO,EACJC,EAAuBC,kBAAkBZ,KAAKa,OAAQb,KAAKG,SAC3D,KACF,IAAKO,EAAU,CACbV,KAAKc,KAAKC,Q,GAKhB,MAAAC,GACE,OAAOhB,KAAKQ,a,6BA1EWS,EAAA,CAAxBC,K","ignoreList":[]}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["e","t","module","exports","this","a","n","d","lastDay","sameDay","nextDay","nextWeek","lastWeek","sameElse","prototype","calendar","$locale","o","startOf","s","diff","i","f","l","call","format","updateLocale","Ls","Object","keys","forEach","dayjs","extend","AtomicResultDate","field","dateToRender","updateDateToRender","value","ResultTemplatesHelpers","getResultProperty","result","parsedValue","parseDate","isValid","error","Error","relativeTime","bindings","interfaceElement","language","i18n","componentWillRender","render","host","remove","__decorate","InitializeBindings","ResultContext"],"sources":["../../node_modules/dayjs/plugin/calendar.js","../../node_modules/dayjs/plugin/updateLocale.js","src/components/search/result-template-components/atomic-result-date/atomic-result-date.tsx"],"sourcesContent":["!function(e,t){\"object\"==typeof exports&&\"undefined\"!=typeof module?module.exports=t():\"function\"==typeof define&&define.amd?define(t):(e=\"undefined\"!=typeof globalThis?globalThis:e||self).dayjs_plugin_calendar=t()}(this,(function(){\"use strict\";return function(e,t,a){var n=\"h:mm A\",d={lastDay:\"[Yesterday at] \"+n,sameDay:\"[Today at] \"+n,nextDay:\"[Tomorrow at] \"+n,nextWeek:\"dddd [at] \"+n,lastWeek:\"[Last] dddd [at] \"+n,sameElse:\"MM/DD/YYYY\"};t.prototype.calendar=function(e,t){var n=t||this.$locale().calendar||d,o=a(e||void 0).startOf(\"d\"),s=this.diff(o,\"d\",!0),i=\"sameElse\",f=s<-6?i:s<-1?\"lastWeek\":s<0?\"lastDay\":s<1?\"sameDay\":s<2?\"nextDay\":s<7?\"nextWeek\":i,l=n[f]||d[f];return\"function\"==typeof l?l.call(this,a()):this.format(l)}}}));","!function(e,n){\"object\"==typeof exports&&\"undefined\"!=typeof module?module.exports=n():\"function\"==typeof define&&define.amd?define(n):(e=\"undefined\"!=typeof globalThis?globalThis:e||self).dayjs_plugin_updateLocale=n()}(this,(function(){\"use strict\";return function(e,n,t){t.updateLocale=function(e,n){var o=t.Ls[e];if(o)return(n?Object.keys(n):[]).forEach((function(e){o[e]=n[e]})),o}}}));","import {Result, ResultTemplatesHelpers} from '@coveo/headless';\nimport {Component, Prop, Element, State} from '@stencil/core';\nimport dayjs from 'dayjs';\nimport calendar from 'dayjs/plugin/calendar';\nimport updateLocale from 'dayjs/plugin/updateLocale';\nimport {parseDate} from '../../../../utils/date-utils';\nimport {\n InitializableComponent,\n InitializeBindings,\n} from '../../../../utils/initialization-utils';\nimport {Bindings} from '../../atomic-search-interface/atomic-search-interface';\nimport {ResultContext} from '@/src/components/search/result-template-component-utils/context/stencil-result-template-decorators';\n\ndayjs.extend(calendar);\ndayjs.extend(updateLocale);\n\n/**\n * The `atomic-result-date` component renders the value of a date result field.\n */\n@Component({\n tag: 'atomic-result-date',\n shadow: false,\n})\nexport class AtomicResultDate implements InitializableComponent {\n @InitializeBindings()\n public bindings!: Bindings;\n\n @ResultContext() private result!: Result;\n\n @Element() host!: HTMLElement;\n\n @State() public error!: Error;\n\n /**\n * The result field which the component should use.\n * This will look for the field in the Result object first, and then in the Result.raw object.\n * It is important to include the necessary field in the `atomic-search-interface` component.\n */\n @Prop({reflect: true}) field = 'date';\n /**\n * Available formats: https://day.js.org/docs/en/display/format\n */\n @Prop({reflect: true}) format = 'D/M/YYYY';\n\n /**\n * Whether the date should display in the [relative time format](https://day.js.org/docs/en/plugin/calendar).\n *\n * To modify the relative time string, use the [localization feature](https://docs.coveo.com/en/atomic/latest/usage/atomic-localization/).\n */\n @Prop({reflect: true}) relativeTime?: boolean;\n\n private dateToRender: string | null = null;\n\n private updateDateToRender() {\n const value = ResultTemplatesHelpers.getResultProperty(\n this.result,\n this.field\n );\n\n if (value === null) {\n this.dateToRender = null;\n return;\n }\n\n const parsedValue = parseDate(value as never);\n if (!parsedValue.isValid()) {\n this.error = new Error(\n `Field \"${this.field}\" does not contain a valid date.`\n );\n this.dateToRender = null;\n return;\n }\n\n if (this.relativeTime) {\n dayjs.updateLocale(this.bindings.interfaceElement.language, {\n calendar: {\n sameDay: this.bindings.i18n.t('calendar-same-day'),\n nextDay: this.bindings.i18n.t('calendar-next-day'),\n nextWeek: this.bindings.i18n.t('calendar-next-week'),\n lastDay: this.bindings.i18n.t('calendar-last-day'),\n lastWeek: this.bindings.i18n.t('calendar-last-week'),\n sameElse: this.format,\n },\n });\n this.dateToRender = parsedValue.calendar();\n } else {\n this.dateToRender = parsedValue.format(this.format);\n }\n }\n\n public componentWillRender() {\n this.upd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Q,OAIR9B,KAAAqB,OAAS,WASxBrB,KAAA+B,aAA8B,K,gCAbP,O,YAIC,W,4BAWxB,kBAAAC,GACN,MAAMC,EAAQC,EAAuBC,kBACnCnC,KAAKoC,OACLpC,KAAK8B,OAGP,GAAIG,IAAU,KAAM,CAClBjC,KAAK+B,aAAe,KACpB,M,CAGF,MAAMM,EAAcC,EAAUL,GAC9B,IAAKI,EAAYE,UAAW,CAC1BvC,KAAKwC,MAAQ,IAAIC,MACf,UAAUzC,KAAK8B,yCAEjB9B,KAAK+B,aAAe,KACpB,M,CAGF,GAAI/B,KAAK0C,aAAc,CACrBf,EAAML,aAAatB,KAAK2C,SAASC,iBAAiBC,SAAU,CAC1DlC,SAAU,CACRN,QAASL,KAAK2C,SAASG,KAAKjD,EAAE,qBAC9BS,QAASN,KAAK2C,SAASG,KAAKjD,EAAE,qBAC9BU,SAAUP,KAAK2C,SAASG,KAAKjD,EAAE,sBAC/BO,QAASJ,KAAK2C,SAASG,KAAKjD,EAAE,qBAC9BW,SAAUR,KAAK2C,SAASG,KAAKjD,EAAE,sBAC/BY,SAAUT,KAAKqB,UAGnBrB,KAAK+B,aAAeM,EAAY1B,U,KAC3B,CACLX,KAAK+B,aAAeM,EAAYhB,OAAOrB,KAAKqB,O,EAIzC,mBAAA0B,GACL/C,KAAKgC,oB,CAGA,MAAAgB,GACL,GAAIhD,KAAK+B,eAAiB,KAAM,CAC9B/B,KAAKiD,KAAKC,SACV,M,CAEF,OAAOlD,KAAK+B,Y,6BA1EPoB,EAAA,CADNC,K,+BAGwBD,EAAA,CAAxBE,K","ignoreList":[]}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["ResultContext","opts","folded","ItemContext","parentName","InteractiveResultContext","InteractiveItemContext","resultContext","element","itemContext"],"sources":["src/components/search/result-template-component-utils/context/stencil-result-template-decorators.tsx"],"sourcesContent":["import {FoldedResult, Result} from '@coveo/headless';\nimport {\n InteractiveItemContext,\n InteractiveItemContextEvent,\n ItemContext,\n ItemContextEvent,\n itemContext,\n} from '@/src/components/common/item-list/stencil-item-decorators';\n\n/**\n * A [StencilJS property decorator](https://stenciljs.com/) to be used for result template components.\n * This allows the Stencil component to fetch the current result from its rendered parent, the `atomic-result` component.\n *\n * Example:\n * @ResultContext() private result!: Result;\n *\n * For more information and examples, view the \"Utilities\" section of the readme.\n * \n * @deprecated should only be used for Stencil components. For Lit components, use `createResultContextController` from \\@/src/components/search/result-template-component-utils/context/result-context-controller.ts\n */\nexport function ResultContext(opts: {folded: boolean} = {folded: false}) {\n return ItemContext({parentName: 'atomic-result', folded: opts.folded});\n}\n\nexport function InteractiveResultContext() {\n return InteractiveItemContext();\n}\n\nexport type ResultContextEvent<T = Result> = ItemContextEvent<T>;\nexport type InteractiveResultContextEvent = InteractiveItemContextEvent;\n\n/**\n * Retrieves `Result` on a rendered `atomic-result`.\n *\n * This method is useful for building custom result template elements, see [Create a Result List](https://docs.coveo.com/en/atomic/latest/cc-search/create-custom-components/native-components/#custom-result-template-component-example) for more information.\n *\n * You should use the method in the [connectedCallback lifecycle method](https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_custom_elements#using_the_lifecycle_callbacks).\n *\n * @param element The element that the event is dispatched to, which must be the child of a rendered \"atomic-result\" element.\n * @returns A promise that resolves on initialization of the parent \"atomic-result\" element, or rejects when there is no parent \"atomic-result\" element.\n * \n * @deprecated should only be used for Stencil components. For Lit components, use `fetchResultContext` from \\@/src/components/search/result-template-component-utils/context/fetch-result-context.ts\n */\nexport function resultContext<T extends Result | FoldedResult = Result>(\n element: Element\n) {\n return itemContext<T>(element, 'atomic-result');\n}\n"],"mappings":"2DAoBgBA,EAAcC,EAA0B,CAACC,OAAQ,QAC/D,OAAOC,EAAY,CAACC,WAAY,gBAAiBF,OAAQD,EAAKC,QAChE,C,SAEgBG,IACd,OAAOC,GACT,C,SAiBgBC,EACdC,GAEA,OAAOC,EAAeD,EAAS,gBACjC,Q","ignoreList":[]}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["atomicQuickviewCss","AtomicQuickviewStyle0","AtomicQuickview","this","sandbox","onNextQuickview","evt","stopImmediatePropagation","quickview","next","onPreviousQuickview","previous","focusTarget","buttonFocusTarget","FocusTargetController","initialize","buildQuickview","bindings","engine","options","result","Schema","StringValue","required","regex","validate","addQuickviewModalIfNeeded","quickviewModalRef","quickviewModal","interfaceElement","querySelector","document","createElement","setAttribute","appendChild","updateModalContent","state","content","total","quickviewState","totalResults","current","currentResult","modalCloseCallback","focus","quickviewAriaMessage","isLoading","i18n","t","first","last","title","onClick","event","stopPropagation","fetchResultContent","componentWillUpdate","render","resultHasPreview","h","Button","key","part","style","class","ref","setTarget","icon","QuickviewIcon","__decorate","InitializeBindings","ResultContext","BindStateToController","AriaLiveRegion"],"sources":["src/components/search/result-template-components/atomic-quickview/atomic-quickview.pcss?tag=atomic-quickview&encapsulation=shadow","src/components/search/result-template-components/atomic-quickview/atomic-quickview.tsx"],"sourcesContent":["@import '../../../../global/global.pcss';\n","import {Schema, StringValue} from '@coveo/bueno';\nimport {\n Result,\n buildQuickview,\n Quickview,\n QuickviewState,\n} from '@coveo/headless';\nimport {Component, h, Listen, Prop, State} from '@stencil/core';\nimport QuickviewIcon from '../../../../images/quickview.svg';\nimport {\n BindStateToController,\n InitializableComponent,\n InitializeBindings,\n} from '../../../../utils/initialization-utils';\nimport {\n AriaLiveRegion,\n FocusTargetController,\n} from '../../../../utils/stencil-accessibility-utils';\nimport {Button} from '../../../common/stencil-button';\nimport {Bindings} from '../../atomic-search-interface/atomic-search-interface';\nimport {ResultContext} from '@/src/components/search/result-template-component-utils/context/stencil-result-template-decorators';\n\n/**\n * The `atomic-quickview` component renders a button which the end user can click to open a modal box containing a preview\n * about a result.\n *\n * The `atomic-quickview` is not meant to replace the `atomic-result-link` to access an item in a result template; it has certain limitations (e.g., custom styles and embedded\n * images/links may not work as expected in an `atomic-quickview`).\n *\n * @part button - The button that opens the quickview modal on click.\n * @part icon - The icon for the quickview button.\n */\n@Component({\n tag: 'atomic-quickview',\n styleUrl: 'atomic-quickview.pcss',\n shadow: true,\n})\nexport class AtomicQuickview implements InitializableComponent {\n @InitializeBindings() public bindings!: Bindings;\n @ResultContext() private result!: Result;\n private buttonFocusTarget?: FocusTargetController;\n\n @State() public error!: Error;\n\n public quickview!: Quickview;\n\n @BindStateToController('quickview')\n @State()\n public quickviewState!: QuickviewState;\n\n /**\n * The `sandbox` attribute to apply to the quickview iframe.\n *\n * The quickview is loaded inside an iframe with a [`sandbox`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe#attr-sandbox) attribute for security reasons.\n *\n * This attribute exists primarily to protect against potential XSS attacks that could originate from the document being displayed.\n *\n * By default, the sandbox attributes are: `allow-popups allow-top-navigation allow-same-origin`.\n *\n * `allow-same-origin` is not optional, and must always be included in the list of allowed capabilities for the component to function properly.\n */\n @Prop() public sandbox =\n 'allow-popups allow-top-navigation allow-same-origin';\n\n @AriaLiveRegion('quickview')\n protected quickviewAriaMessage!: string;\n\n @Listen('atomic/quickview/next', {target: 'body'})\n public onNextQuickview(evt: Event) {\n evt.stopImmediatePropagation();\n this.quickview.next();\n }\n\n @Listen('atomic/quickview/previous', {target: 'body'})\n public onPreviousQuickview(evt: Event) {\n evt.stopImmediatePropagation();\n this.quickview.previous();\n }\n\n private quickviewModalRef?: HTMLAtomicQuickviewModalElement;\n\n public get focusTarget() {\n if (!this.buttonFocusTarget) {\n this.buttonFocusTarget = new FocusTargetController(this);\n }\n return this.buttonFocusTarget;\n }\n\n public initialize() {\n this.quickview = buildQuickview(this.bindings.engine, {\n options: {result: this.result},\n });\n new Schema({\n sandbox: new StringValue({\n required: true,\n regex: /allow-same-origin/,\n }),\n }).validate({sandbox: this.sandbox});\n }\n\n private addQuickviewModalIfNeeded() {\n if (this.quickviewModalRef) {\n return;\n }\n\n const quickviewModal = this.bindings.interfaceElement.querySelector(\n 'atomic-quickview-modal'\n );\n if (quickviewModal) {\n this.quickviewModalRef = quickviewModal;\n return;\n }\n this.quickviewModalRef = document.createElement('atomic-quickview-modal');\n this.quickviewModalRef.setAttribute('sandbox', this.sandbox);\n this.bindings.interfaceElement.appendChild(this.quickviewModalRef);\n }\n\n private updateModalContent() {\n if (this.quickviewModalRef && this.quickview.state.content) {\n this.quickviewModalRef.content = this.quickview.state.content;\n this.quickviewModalRef.result = this.result;\n this.quickviewModalRef.total = this.quickviewState.totalResults;\n this.quickviewModalRef.current = this.quickviewState.currentResult;\n this.quickviewModalRef.modalCloseCallback = () =>\n this.focusTarget.focus();\n\n this.quickviewAriaMessage = this.quickviewState.isLoading\n ? this.bindings.i18n.t('quickview-loading')\n : this.bindings.i18n.t('quickview-loaded', {\n first: this.quickviewState.currentResult,\n last: this.quickviewState.totalResults,\n title: this.result.title,\n });\n }\n }\n\n private onClick(event?: MouseEvent) {\n event?.stopPropagation();\n this.quickview.fetchResultContent();\n }\n\n componentWillUpdate(): void {\n this.addQuickviewModalIfNeeded();\n this.updateModalContent();\n }\n\n public render() {\n if (this.quickviewState.resultHasPreview) {\n return (\n <Button\n part=\"button\"\n title={this.bindings.i18n.t('quickview')}\n style=\"outline-primary\"\n class=\"p-2\"\n onClick={(event) => this.onClick(event)}\n ref={this.focusTarget.setTarget}\n >\n <atomic-icon\n part=\"icon\"\n class=\"flex w-5 justify-center\"\n icon={QuickviewIcon}\n ></atomic-icon>\n </Button>\n );\n }\n }\n}\n"],"mappings":"6iBAAA,MAAMA,EAAqB,+8iEAC3B,MAAAC,EAAeD,E,iXCoCFE,EAAe,M,yBAwBXC,KAAAC,QACb,sD,gEAAA,qD,CAMK,eAAAC,CAAgBC,GACrBA,EAAIC,2BACJJ,KAAKK,UAAUC,M,CAIV,mBAAAC,CAAoBJ,GACzBA,EAAIC,2BACJJ,KAAKK,UAAUG,U,CAKjB,eAAWC,GACT,IAAKT,KAAKU,kBAAmB,CAC3BV,KAAKU,kBAAoB,IAAIC,EAAsBX,K,CAErD,OAAOA,KAAKU,iB,CAGP,UAAAE,GAC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,CACxC,OACEC,EAACC,EAAM,CAAAC,IAAA,2CACLC,KAAK,SACLX,MAAOhD,KAAKc,SAAS8B,KAAKC,EAAE,aAC5Be,MAAM,kBACNC,MAAM,MACNZ,QAAUC,GAAUlD,KAAKiD,QAAQC,GACjCY,IAAK9D,KAAKS,YAAYsD,WAEtBP,EAAA,eAAAE,IAAA,2CACEC,KAAK,OACLE,MAAM,0BACNG,KAAMC,I,IA1HaC,EAAA,CAA5BC,K,+BACwBD,EAAA,CAAxBE,K,6BASMF,EAAA,CAFNG,EAAsB,c,qCAmBbH,EAAA,CADTI,EAAe,c","ignoreList":[]}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["possiblyWarnOnBadFieldType","field","itemValueRaw","host","logger","isArray","error","nodeName","toLowerCase","ItemTextFallback","defaultValue","item","getProperty","children","raw","isUndefined","remove","h","Fragment","renderWithHighlights","value","highlights","highlightString","openingDelimiter","closingDelimiter","highlightedValue","content","replace","RegExp","ItemTextHighlighted","highlightKeywords","onError","textValue","Host","innerHTML","AtomicResultText","this","shouldHighlight","render","resultValueAsString","getStringValueFromResultOrNull","result","bindings","engine","default","ResultTemplatesHelpers","getResultProperty","getFieldValueCaption","i18n","HighlightUtils","__decorate","InitializeBindings","ResultContext","AtomicText","strings","t","count","connectedCallback","Error"],"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","src/components/search/atomic-text/atomic-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 '@/src/components/search/result-template-component-utils/context/stencil-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","import {Component, Prop, State} from '@stencil/core';\nimport {\n InitializableComponent,\n InitializeBindings,\n} from '../../../utils/initialization-utils';\nimport {Bindings} from '../atomic-search-interface/atomic-search-interface';\n\n/**\n * The `atomic-text` component leverages the I18n translation module through the atomic-search-interface.\n */\n@Component({\n tag: 'atomic-text',\n shadow: true,\n})\nexport class AtomicText implements InitializableComponent {\n @InitializeBindings() public bindings!: Bindings;\n\n private strings = {\n value: () =>\n this.bindings.i18n.t(this.value, {\n count: this.count,\n }),\n };\n @State() public error!: Error;\n\n /**\n * The string key value.\n */\n @Prop({reflect: true}) public value!: string;\n /**\n * The count value used for plurals.\n */\n @Prop({reflect: true}) public count?: number;\n\n public connectedCallback() {\n if (!this.value) {\n this.error = new Error('The \"value\" attribute must be defined.');\n }\n }\n\n public render() {\n return this.strings.value();\n }\n}\n"],"mappings":"sdAEgBA,EACdC,EACAC,EACAC,EACAC,GAEA,GAAIC,EAAQH,GAAe,CACzBE,EAAOE,MACL,GAAGH,EAAKI,SAASC,wDAAwDP,mBAAuBC,MAChGC,E,CAGN,CCDO,MAAMM,EAAmB,EAC7BR,QAAOE,OAAMC,SAAQM,eAAcC,OAAMC,eAC1CC,KAEA,MAAMC,EAAMF,EAAYD,EAAMV,GAC9BD,EAA2BC,EAAOa,EAAKX,EAAMC,GAE7C,GAAIW,EAAYL,GAAe,CAC7BP,EAAKa,SACL,OAAO,I,KACF,CACL,OAAOC,EAACC,EAAQ,KAAEL,E,YCZNM,EACdC,EACAC,EACAC,GAEA,MAAMC,EAAmB,qBACzB,MAAMC,EAAmB,qBACzB,MAAMC,EAAmBH,EAAgB,CAC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KrB,KAAKhB,MAAO,CACfgB,KAAK9B,MAAQ,IAAIoD,MAAM,yC,EAIpB,MAAApB,GACL,OAAOF,KAAKkB,QAAQlC,O,GA1BO8B,EAAA,CAA5BC,K","ignoreList":[]}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["atomicIpxResultLinkCss","AtomicIpxResultLinkStyle0","AtomicIPXResultLink","initialize","this","host","dispatchEvent","buildCustomEvent","stopPropagation","actionsHistoryActions","loadIPXActionsHistoryActions","bindings","engine","connectedCallback","slotName","hasDefaultSlot","getDefaultSlotFromHost","linkAttributes","getAttributesFromLinkSlot","onSelect","resultPermanentId","result","raw","permanentid","action","addPageViewEntryInActionsHistory","dispatch","interactiveResult","select","render","href","isUndefined","hrefTemplate","clickUri","buildStringTemplateFromResult","h","LinkWithItemAnalytics","key","onBeginDelayedSelect","beginDelayedSelect","onCancelPendingSelect","cancelPendingSelect","attributes","field","default","__decorate","InitializeBindings","ResultContext","InteractiveResultContext"],"sources":["src/components/ipx/atomic-ipx-result-link/atomic-ipx-result-link.pcss?tag=atomic-ipx-result-link","src/components/ipx/atomic-ipx-result-link/atomic-ipx-result-link.tsx"],"sourcesContent":["@import '../../../global/global.pcss';\n@reference '../../../utils/tailwind-utilities/link-style.css';\n\natomic-ipx-result-link {\n a {\n @apply link-style;\n }\n}\n","import {isUndefined} from '@coveo/bueno';\nimport {\n IPXActionsHistoryActionCreators,\n InteractiveResult,\n loadIPXActionsHistoryActions,\n} from '@coveo/headless';\nimport {Component, h, Prop, Element} from '@stencil/core';\nimport {buildCustomEvent} from '../../../utils/event-utils';\nimport {\n InitializableComponent,\n InitializeBindings,\n} from '../../../utils/initialization-utils';\nimport {buildStringTemplateFromResult} from '../../../utils/result-utils';\nimport {getDefaultSlotFromHost} from '../../../utils/slot-utils';\nimport {AnyUnfoldedItem} from '../../common/item-list/unfolded-item';\nimport {getAttributesFromLinkSlot} from '../../common/item-link/attributes-slot';\nimport {LinkWithItemAnalytics} from '../../common/item-link/stencil-item-link';\nimport {RecsBindings} from '../../recommendations/atomic-recs-interface/atomic-recs-interface';\nimport {\n ResultContext,\n InteractiveResultContext,\n} from '@/src/components/search/result-template-component-utils/context/stencil-result-template-decorators';\n\n/**\n * The `atomic-ipx-result-link` component automatically transforms a search result title into a clickable link that points to the original item. It is an experimental internal component not intended for general use.\n * @slot default - Lets you display alternative content inside the link\n * @slot attributes - Lets you pass [attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#attributes) down to the link element, overriding other attributes, to be used exclusively with an \"a\" tag such as `<a slot=\"attributes\" target=\"_blank\" download></a>`.\n * @internal\n */\n@Component({\n tag: 'atomic-ipx-result-link',\n styleUrl: 'atomic-ipx-result-link.pcss',\n shadow: false,\n})\nexport class AtomicIPXResultLink\n implements InitializableComponent<RecsBindings>\n{\n @InitializeBindings() public bindings!: RecsBindings;\n public error!: Error;\n\n @ResultContext() private result!: AnyUnfoldedItem;\n @InteractiveResultContext() private interactiveResult!: InteractiveResult;\n\n @Element() private host!: HTMLElement;\n\n /**\n * Specifies a template literal from which to generate the `href` attribute value (see\n * [Template literals](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Template_literals)).\n *\n * The template literal can reference any number of result properties from the parent result. It can also reference the window object.\n *\n * For example, the following markup generates an `href` value such as `http://uri.com?id=itemTitle`, using the result's `clickUri` and `itemtitle` fields.\n * ```html\n * <atomic-ipx-result-link href-template='${clickUri}?id=${raw.itemtitle}'></atomic-ipx-result-link>\n * ```\n */\n @Prop({reflect: true}) hrefTemplate?: string;\n\n private hasDefaultSlot!: boolean;\n private linkAttributes?: Attr[];\n private stopPropagation?: boolean;\n private actionsHistoryActions?: IPXActionsHistoryActionCreators;\n\n public initialize() {\n this.host.dispatchEvent(\n buildCustomEvent(\n 'atomic/resolveStopPropagation',\n (stopPropagation: boolean) => {\n this.stopPropagation = stopPropagation;\n }\n )\n );\n this.actionsHistoryActions = loadIPXActionsHistoryActions(\n this.bindings.engine\n );\n }\n\n public connectedCallback() {\n const slotName = 'attributes';\n this.hasDefaultSlot = !!getDefaultSlotFromHost(this.host);\n this.linkAttributes = getAttributesFromLinkSlot(this.host, slotName);\n }\n\n public async onSelect() {\n const resultPermanentId = this.result.raw.permanentid;\n if (resultPermanentId && this.actionsHistoryActions) {\n const action =\n this.actionsHistoryActions.addPageViewEntryInActionsHistory(\n resultPermanentId\n );\n this.bindings.engine.dispatch(action);\n }\n this.interactiveResult.select();\n }\n\n public render() {\n const href = isUndefined(this.hrefTemplate)\n ? this.result.clickUri\n : buildStringTemplateFromResult(\n this.hrefTemplate,\n this.result,\n this.bindings\n );\n\n return (\n <LinkWithItemAnalytics\n href={href}\n onSelect={() => this.onSelect()}\n onBeginDelayedSelect={() => this.interactiveResult.beginDelayedSelect()}\n onCancelPendingSelect={() =>\n this.interactiveResult.cancelPendingSelect()\n }\n attributes={this.linkAttributes}\n stopPropagation={this.stopPropagation}\n >\n {this.hasDefaultSlot ? (\n <slot />\n ) : (\n <atomic-result-text\n field=\"title\"\n default=\"no-title\"\n ></atomic-result-text>\n )}\n </LinkWithItemAnalytics>\n );\n }\n}\n"],"mappings":"uhBAAA,MAAMA,EAAyB,yzkEAC/B,MAAAC,EAAeD,E,iXCiCFE,EAAmB,M,qDA6BvB,UAAAC,GACLC,KAAKC,KAAKC,cACRC,EACE,iCACCC,IACCJ,KAAKI,gBAAkBA,CAAe,KAI5CJ,KAAKK,sBAAwBC,EAC3BN,KAAKO,SAASC,O,CAIX,iBAAAC,GACL,MAAMC,EAAW,aACjBV,KAAKW,iBAAmBC,EAAuBZ,KAAKC,MACpDD,KAAKa,eAAiBC,EAA0Bd,KAAKC,KAAMS,E,CAGtD,cAAMK,GACX,MAAMC,EAAoBhB,KAAKiB,OAAOC,IAAIC,YAC1C,GAAIH,GAAqBhB,KAAKK,sBAAuB,CACnD,MAAMe,EACJpB,KAAKK,sBAAsBgB,iCACzBL,GAEJhB,KAAKO,SAASC,OAAOc,SAASF,E,CAEhCpB,KAAKuB,kBAAkBC,Q,CAGlB,MAAAC,GACL,MAAMC,EAAOC,EAAY3B,KAAK4B,cAC1B5B,KAAKiB,OAAOY,SACZC,EACE9B,KAAK4B,aACL5B,KAAKiB,OACLjB,KAAKO,UAGX,OACEwB,EAACC,EAAqB,CAAAC,IAAA,2CACpBP,KAAMA,EACNX,SAAU,IAAMf,KAAKe,WACrBmB,qBAAsB,IAAMlC,KAAKuB,kBAAkBY,qBACnDC,sBAAuB,IACrBpC,KAAKuB,kBAAkBc,sBAEzBC,WAAYtC,KAAKa,eACjBT,gBAAiBJ,KAAKI,iBAErBJ,KAAKW,eACJoB,EAAA,aAEAA,EAAA,sBACEQ,MAAM,QACNC,QAAQ,a,6BAnFWC,EAAA,CAA5BC,K,+BAGwBD,EAAA,CAAxBE,K,6BACmCF,EAAA,CAAnCG,K","ignoreList":[]}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["AtomicResultHtml","this","sanitize","render","resultValue","getStringValueFromResultOrNull","result","field","host","remove","h","value","__decorate","InitializeBindings","ResultContext"],"sources":["src/components/search/result-template-components/atomic-result-html/atomic-result-html.tsx"],"sourcesContent":["import {Result} from '@coveo/headless';\nimport {Component, Prop, h, Element, State} from '@stencil/core';\nimport {\n InitializableComponent,\n InitializeBindings,\n} from '../../../../utils/initialization-utils';\nimport {getStringValueFromResultOrNull} from '../../../../utils/result-utils';\nimport {Bindings} from '../../atomic-search-interface/atomic-search-interface';\nimport {ResultContext} from '@/src/components/search/result-template-component-utils/context/stencil-result-template-decorators';\n\n/**\n * The `atomic-result-html` component renders the HTML value of a string result field.\n *\n * There is an inherent XSS security concern associated with the usage of this component.\n *\n * Use only with fields for which you are certain the data is harmless.\n */\n@Component({\n tag: 'atomic-result-html',\n shadow: false,\n})\nexport class AtomicResultHtml 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 * If set, Atomic searches for the specified field in the `Result` object first.\n * If there's no such a field, Atomic searches through the `Result.raw` object.\n * It's important to include the necessary field in the `ResultList` component.\n */\n @Prop({reflect: true}) public field!: string;\n /**\n * Specify if the content should be sanitized, using [`DOMPurify`](https://www.npmjs.com/package/dompurify).\n */\n @Prop({reflect: true}) public sanitize = true;\n\n public render() {\n const resultValue = getStringValueFromResultOrNull(this.result, this.field);\n if (!resultValue) {\n this.host.remove();\n return;\n }\n\n return (\n <atomic-html value={resultValue} sanitize={this.sanitize}></atomic-html>\n );\n }\n}\n"],"mappings":"+pBAqBaA,EAAgB,M,yBAkBGC,KAAAC,SAAW,K,wDAAA,I,CAElC,MAAAC,GACL,MAAMC,EAAcC,EAA+BJ,KAAKK,OAAQL,KAAKM,OACrE,IAAKH,EAAa,CAChBH,KAAKO,KAAKC,SACV,M,CAGF,OACEC,EAAA,eAAaC,MAAOP,EAAaF,SAAUD,KAAKC,U,6BA3BvBU,EAAA,CAA5BC,K,+BACwBD,EAAA,CAAxBE,K","ignoreList":[]}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["atomicInsightResultAttachToCaseActionCss","AtomicInsightResultAttachToCaseActionStyle0","AtomicInsightResultAttachToCaseAction","initialize","caseId","this","bindings","engine","state","insightCaseContext","attachToCase","buildAttachToCase","options","result","onClick","isAttached","detach","emit","callback","attach","getIcon","DetachIcon","AttachIcon","getTooltip","i18n","t","render","h","IconButton","key","partPrefix","style","icon","title","__decorate","InitializeBindings","ResultContext","BindStateToController"],"sources":["src/components/insight/atomic-insight-result-attach-to-case-action/atomic-insight-result-attach-to-case-action.pcss?tag=atomic-insight-result-attach-to-case-action","src/components/insight/atomic-insight-result-attach-to-case-action/atomic-insight-result-attach-to-case-action.tsx"],"sourcesContent":["@import '../../../global/global.pcss';\n","import {AttachToCase, buildAttachToCase, Result} from '@coveo/headless/insight';\nimport {Component, Event, State, h, Element, EventEmitter} from '@stencil/core';\nimport AttachIcon from '../../../images/attach.svg';\nimport DetachIcon from '../../../images/detach.svg';\nimport {\n BindStateToController,\n InitializableComponent,\n InitializeBindings,\n} from '../../../utils/initialization-utils';\nimport {IconButton} from '../../common/stencil-iconButton';\nimport {ResultContext} from '@/src/components/search/result-template-component-utils/context/stencil-result-template-decorators';\nimport {InsightBindings} from '../atomic-insight-interface/atomic-insight-interface';\n\nexport interface InsightResultAttachToCaseEvent {\n callback: () => void;\n result: Result;\n}\n/**\n * @internal\n * The `atomic-insight-result-attach-to-case-action` component can be nested inside a `atomic-insight-result-actions` to render an interactive button that will emit an `atomic/insight/attachToCase/attach` or `atomic/insight/attachToCase/detach` JavaScript event, based on its current state, when clicked.\n *\n * @part result-action-container - The result action container\n * @part result-action-button - The result action button\n * @part result-action-icon - The result action icon\n */\n@Component({\n tag: 'atomic-insight-result-attach-to-case-action',\n styleUrl: 'atomic-insight-result-attach-to-case-action.pcss',\n})\nexport class AtomicInsightResultAttachToCaseAction\n implements InitializableComponent<InsightBindings>\n{\n @InitializeBindings() public bindings!: InsightBindings;\n @ResultContext() private result!: Result;\n\n @Element() host!: HTMLElement;\n @State() public error!: Error;\n\n public attachToCase!: AttachToCase;\n\n @BindStateToController('attachToCase')\n @State()\n public attachToCaseState!: {};\n\n @Event({\n eventName: 'atomic/insight/attachToCase/attach',\n composed: true,\n cancelable: true,\n bubbles: true,\n })\n private attach!: EventEmitter<InsightResultAttachToCaseEvent>;\n\n @Event({\n eventName: 'atomic/insight/attachToCase/detach',\n composed: true,\n cancelable: true,\n bubbles: true,\n })\n private detach!: EventEmitter<InsightResultAttachToCaseEvent>;\n\n public initialize() {\n const caseId: string =\n this.bindings.engine.state.insightCaseContext?.caseId || '';\n this.attachToCase = buildAttachToCase(this.bindings.engine, {\n options: {\n result: this.result,\n caseId: caseId,\n },\n });\n }\n\n private onClick() {\n if (this.attachToCase.isAttached()) {\n this.detach.emit({\n callback: this.attachToCase.detach,\n result: this.result,\n });\n } else {\n this.attach.emit({\n callback: this.attachToCase.attach,\n result: this.result,\n });\n }\n }\n\n private getIcon() {\n return this.attachToCase.isAttached() ? DetachIcon : AttachIcon;\n }\n\n private getTooltip() {\n return this.attachToCase.isAttached()\n ? this.bindings.i18n.t('detach-from-case')\n : this.bindings.i18n.t('attach-to-case');\n }\n\n public render() {\n return (\n <IconButton\n partPrefix=\"result-action\"\n style=\"outline-neutral\"\n icon={this.getIcon()}\n title={this.getTooltip()}\n onClick={() => this.onClick()}\n />\n );\n }\n}\n"],"mappings":"62GAAA,MAAMA,EAA2C,+8iEACjD,MAAAC,EAAeD,E,iXC4BFE,EAAqC,M,qMA+BzC,UAAAC,GACL,MAAMC,EACJC,KAAKC,SAASC,OAAOC,MAAMC,oBAAoBL,QAAU,GAC3DC,KAAKK,aAAeC,EAAkBN,KAAKC,SAASC,OAAQ,CAC1DK,QAAS,CACPC,OAAQR,KAAKQ,OACbT,OAAQA,I,CAKN,OAAAU,GACN,GAAIT,KAAKK,aAAaK,aAAc,CAClCV,KAAKW,OAAOC,KAAK,CACfC,SAAUb,KAAKK,aAAaM,OAC5BH,OAAQR,KAAKQ,Q,KAEV,CACLR,KAAKc,OAAOF,KAAK,CACfC,SAAUb,KAAKK,aAAaS,OAC5BN,OAAQR,KAAKQ,Q,EAKX,OAAAO,GACN,OAAOf,KAAKK,aAAaK,aAAeM,EAAaC,C,CAG/C,UAAAC,GACN,OAAOlB,KAAKK,aAAaK,aACrBV,KAAKC,SAASkB,KAAKC,EAAE,oBACrBpB,KAAKC,SAASkB,KAAKC,EAAE,iB,CAGpB,MAAAC,GACL,OACEC,EAACC,EAAU,CAAAC,IAAA,2CACTC,WAAW,gBACXC,MAAM,kBACNC,KAAM3B,KAAKe,UACXa,MAAO5B,KAAKkB,aACZT,QAAS,IAAMT,KAAKS,W,6BAtEGoB,EAAA,CAA5BC,K,+BACwBD,EAAA,CAAxBE,K,6BASMF,EAAA,CAFNG,EAAsB,iB","ignoreList":[]}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["atomicResultImageCss","AtomicResultImageStyle0","AtomicResultImage","this","useFallback","url","value","ResultTemplatesHelpers","getResultProperty","result","field","Array","isArray","altText","imageAltField","bindings","i18n","t","itemName","title","logWarning","message","engine","logger","warn","host","handleImageError","fallback","handleMissingFallback","remove","validateUrl","render","h","alt","src","filterProtocol","onError","loading","__decorate","InitializeBindings","ResultContext"],"sources":["src/components/search/result-template-components/atomic-result-image/atomic-result-image.pcss?tag=atomic-result-image","src/components/search/result-template-components/atomic-result-image/atomic-result-image.tsx"],"sourcesContent":["atomic-result-image {\n display: grid;\n place-items: center;\n grid-template-rows: 100%;\n width: 100%;\n height: 100%;\n\n img {\n width: 100%;\n height: 100%;\n object-fit: contain;\n }\n}\n","import {Result, ResultTemplatesHelpers} from '@coveo/headless';\nimport {Component, h, Prop, Element, State} from '@stencil/core';\nimport {\n InitializeBindings,\n InitializableComponent,\n} from '../../../../utils/initialization-utils';\nimport {filterProtocol} from '../../../../utils/xss-utils';\nimport {Bindings} from '../../atomic-search-interface/atomic-search-interface';\nimport {ResultContext} from '@/src/components/search/result-template-component-utils/context/stencil-result-template-decorators';\n\n/**\n * The `atomic-result-image` component renders an image from a result field.\n */\n@Component({\n tag: 'atomic-result-image',\n styleUrl: 'atomic-result-image.pcss',\n shadow: false,\n})\nexport class AtomicResultImage implements InitializableComponent {\n @InitializeBindings() public bindings!: Bindings;\n @ResultContext() private result!: Result;\n @Element() private host!: HTMLElement;\n @State() private useFallback = false;\n\n /**\n * The result field which the component should use. This will look for the field in the Result object first, then in the Result.raw object. It is important to include the necessary field in the `atomic-search-interface` component.\n */\n @Prop({reflect: true}) field!: string;\n\n /**\n * The result field that contains the alt text for the image. This will look for the field in the Result object first, then in the Result.raw object\n *\n * If the field is not specified, or does not contain a valid value, the alt text will be set to \"Image for {productName}\".\n */\n @Prop({reflect: true}) imageAltField?: string;\n\n /**\n * An optional fallback image URL that will be used in case the specified image field is not available or encounters an error.\n */\n @Prop({reflect: true}) fallback?: string;\n\n public error!: Error;\n\n public get url() {\n const value = ResultTemplatesHelpers.getResultProperty(\n this.result,\n this.field\n );\n return Array.isArray(value) ? value[0] : value;\n }\n\n private get altText(): string {\n if (this.imageAltField) {\n const value = ResultTemplatesHelpers.getResultProperty(\n this.result,\n this.imageAltField\n );\n\n if (Array.isArray(value) && typeof value[0] === 'string') {\n return value[0];\n }\n\n if (typeof value === 'string') {\n return value;\n }\n }\n\n return this.bindings.i18n.t('image-alt-fallback', {\n itemName: this.result.title,\n });\n }\n\n private logWarning(message: string) {\n this.bindings.engine.logger.warn(message, this.host);\n }\n\n private handleImageError() {\n const message = `The image url \"${this.url}\" is not valid or could not be loaded. You might want to add a \"fallback\" property.`;\n\n this.fallback ? (this.useFallback = true) : this.logWarning(message);\n }\n\n private handleMissingFallback(message: string) {\n if (!this.fallback) {\n this.logWarning(message);\n this.host.remove();\n return null;\n }\n return this.fallback;\n }\n\n private validateUrl(url: string) {\n if (!url) {\n const message = `\"${this.field}\" is missing. Please review your indexation. You might want to add a \"fallback\" property.`;\n return this.handleMissingFallback(message);\n }\n\n if (typeof url !== 'string') {\n const message = `Expected \"${this.field}\" to be a text field. Please review your indexation. You might want to add a \"fallback\" property.`;\n return this.handleMissingFallback(message);\n }\n\n return url;\n }\n\n public render() {\n let url = this.useFallback ? this.fallback : this.url;\n\n if (!this.useFallback) {\n url = this.validateUrl(url);\n if (!url) {\n return;\n }\n }\n\n return (\n <img\n alt={this.altText}\n src={filterProtocol(url)}\n onError={() => this.handleImageError()}\n loading=\"lazy\"\n />\n );\n }\n}\n"],"mappings":"+UAAA,MAAMA,EAAuB,wKAC7B,MAAAC,EAAeD,E,iXCiBFE,EAAiB,M,yBAIXC,KAAAC,YAAc,M,iBAAA,M,0EAqB/B,OAAWC,GACT,MAAMC,EAAQC,EAAuBC,kBACnCL,KAAKM,OACLN,KAAKO,OAEP,OAAOC,MAAMC,QAAQN,GAASA,EAAM,GAAKA,C,CAG3C,WAAYO,GACV,GAAIV,KAAKW,cAAe,CACtB,MAAMR,EAAQC,EA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sightResultQuickviewAction","this","sandbox","onNextQuickview","evt","stopImmediatePropagation","quickview","next","onPreviousQuickview","previous","focusTarget","buttonFocusTarget","FocusTargetController","initialize","buildQuickview","bindings","engine","options","result","Schema","StringValue","required","regex","validate","addQuickviewModalIfNeeded","quickviewModalRef","quickviewModal","interfaceElement","querySelector","document","createElement","setAttribute","appendChild","updateModalContent","state","content","total","quickviewState","totalResults","current","currentResult","modalCloseCallback","focus","quickviewAriaMessage","isLoading","i18n","t","first","last","title","onClick","event","stopPropagation","fetchResultContent","shouldRenderQuickview","resultHasPreview","render","h","IconButton","key","partPrefix","style","ref","setTarget","icon","QuickviewIcon","__decorate","InitializeBindings","ResultContext","BindStateToController","AriaLiveRegion"],"sources":["src/components/insight/atomic-insight-result-quickview-action/atomic-insight-result-quickview-action.pcss?tag=atomic-insight-result-quickview-action","src/components/insight/atomic-insight-result-quickview-action/atomic-insight-result-quickview-action.tsx"],"sourcesContent":["@import '../../../global/global.pcss';\n","import {Schema, StringValue} from '@coveo/bueno';\nimport {\n buildQuickview,\n QuickviewState,\n Quickview,\n Result,\n} from '@coveo/headless';\nimport {Component, Listen, Prop, State, h, Element} from '@stencil/core';\nimport QuickviewIcon from '../../../images/preview.svg';\nimport {\n BindStateToController,\n InitializableComponent,\n InitializeBindings,\n} from '../../../utils/initialization-utils';\nimport {\n AriaLiveRegion,\n FocusTargetController,\n} from '../../../utils/stencil-accessibility-utils';\nimport {IconButton} from '../../common/stencil-iconButton';\nimport {Bindings} from '../../search/atomic-search-interface/atomic-search-interface';\nimport {ResultContext} from '@/src/components/search/result-template-component-utils/context/stencil-result-template-decorators';\n\n/**\n * @internal\n */\n@Component({\n tag: 'atomic-insight-result-quickview-action',\n styleUrl: 'atomic-insight-result-quickview-action.pcss',\n})\nexport class AtomicInsightResultQuickviewAction\n implements InitializableComponent\n{\n @InitializeBindings() public bindings!: Bindings;\n @ResultContext() private result!: Result;\n\n private buttonFocusTarget?: FocusTargetController;\n\n @Element() host!: HTMLElement;\n @State() public error!: Error;\n\n public quickview!: Quickview;\n\n @BindStateToController('quickview')\n @State()\n public quickviewState!: QuickviewState;\n\n /**\n * The `sandbox` attribute to apply to the quickview iframe.\n *\n * The quickview is loaded inside an iframe with a [`sandbox`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe#attr-sandbox) attribute for security reasons.\n *\n * This attribute exists primarily to protect against potential XSS attacks that could originate from the document being displayed.\n *\n * By default, the sandbox attributes are: `allow-popups allow-top-navigation allow-same-origin`.\n *\n * `allow-same-origin` is not optional, and must always be included in the list of allowed capabilities for the component to function properly.\n */\n @Prop()\n public sandbox = 'allow-popups allow-top-navigation allow-same-origin';\n\n @AriaLiveRegion('quickview')\n protected quickviewAriaMessage!: string;\n\n @Listen('atomic/quickview/next', {target: 'body'})\n public onNextQuickview(evt: Event) {\n evt.stopImmediatePropagation();\n this.quickview.next();\n }\n\n @Listen('atomic/quickview/previous', {target: 'body'})\n public onPreviousQuickview(evt: Event) {\n evt.stopImmediatePropagation();\n this.quickview.previous();\n }\n\n private quickviewModalRef?: HTMLAtomicQuickviewModalElement;\n\n public get focusTarget() {\n if (!this.buttonFocusTarget) {\n this.buttonFocusTarget = new FocusTargetController(this);\n }\n return this.buttonFocusTarget;\n }\n\n public initialize() {\n this.quickview = buildQuickview(this.bindings.engine, {\n options: {result: this.result},\n });\n new Schema({\n sandbox: new StringValue({\n required: true,\n regex: /allow-same-origin/,\n }),\n }).validate({sandbox: this.sandbox});\n }\n\n private addQuickviewModalIfNeeded() {\n if (this.quickviewModalRef) {\n return;\n }\n\n const quickviewModal = this.bindings.interfaceElement.querySelector(\n 'atomic-quickview-modal'\n );\n if (quickviewModal) {\n this.quickviewModalRef = quickviewModal;\n return;\n }\n this.quickviewModalRef = document.createElement('atomic-quickview-modal');\n this.quickviewModalRef.setAttribute('sandbox', this.sandbox);\n this.bindings.interfaceElement.appendChild(this.quickviewModalRef);\n }\n\n private updateModalContent() {\n if (this.quickviewModalRef && this.quickview.state.content) {\n this.quickviewModalRef.content = this.quickview.state.content;\n this.quickviewModalRef.result = this.result;\n this.quickviewModalRef.total = this.quickviewState.totalResults;\n this.quickviewModalRef.current = this.quickviewState.currentResult;\n this.quickviewModalRef.modalCloseCallback = () =>\n this.focusTarget.focus();\n\n this.quickviewAriaMessage = this.quickviewState.isLoading\n ? this.bindings.i18n.t('quickview-loading')\n : this.bindings.i18n.t('quickview-loaded', {\n first: this.quickviewState.currentResult,\n last: this.quickviewState.totalResults,\n title: this.result.title,\n });\n }\n }\n\n private onClick(event?: MouseEvent) {\n event?.stopPropagation();\n this.quickview.fetchResultContent();\n }\n\n private get shouldRenderQuickview() {\n return this.quickviewState.resultHasPreview;\n }\n\n public render() {\n this.addQuickviewModalIfNeeded();\n this.updateModalContent();\n if (this.shouldRenderQuickview) {\n return (\n <IconButton\n partPrefix=\"result-action\"\n style=\"outline-neutral\"\n ref={this.focusTarget.setTarget}\n icon={QuickviewIcon}\n title={this.bindings.i18n.t('quickview')}\n onClick={() => this.onClick()}\n />\n );\n }\n }\n}\n"],"mappings":"4kBAAA,MAAMA,EAAwC,+8iEAC9C,MAAAC,EAAeD,E,iXC4BFE,EAAkC,M,yBA6BtCC,KAAAC,QAAU,sD,gEAAA,qD,CAMV,eAAAC,CAAgBC,GACrBA,EAAIC,2BACJJ,KAAKK,UAAUC,M,CAIV,mBAAAC,CAAoBJ,GACzBA,EAAIC,2BACJJ,KAAKK,UAAUG,U,CAKjB,eAAWC,GACT,IAAKT,KAAKU,kBAAmB,CAC3BV,KAAKU,kBAAoB,IAAIC,EAAsBX,K,CAErD,OAAOA,KAAKU,iB,CAGP,UAAAE,GACLZ,KAAKK,UAAYQ,EAAeb,KAAKc,SAASC,OAAQ,CACpDC,QAAS,CAACC,OAAQjB,KAAKiB,UAEzB,IAAIC,EAAO,CACTjB,QAAS,IAAIkB,EAAY,CACvBC,SAAU,KACVC,MAAO,wBAERC,SAAS,CAACrB,QAASD,KAAKC,S,CAGrB,yBAAAsB,GACN,GAA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xHCgB,EAAA,CAA5BC,K,+BACwBD,EAAA,CAAxBE,K,6BAWMF,EAAA,CAFNG,EAAsB,c,qCAmBbH,EAAA,CADTI,EAAe,c","ignoreList":[]}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["AtomicResultNumber","this","formatter","defaultNumberFormatter","valueToDisplay","setFormat","event","preventDefault","stopPropagation","detail","parseValue","value","ResultTemplatesHelpers","getResultProperty","result","field","valueAsNumber","parseFloat","Number","isNaN","error","Error","formatValue","bindings","i18n","languages","toString","updateValueToDisplay","componentWillRender","render","host","remove","__decorate","InitializeBindings","ResultContext"],"sources":["src/components/search/result-template-components/atomic-result-number/atomic-result-number.tsx"],"sourcesContent":["import {Result, ResultTemplatesHelpers} from '@coveo/headless';\nimport {Component, Prop, Element, State, Listen} from '@stencil/core';\nimport {InitializeBindings} from '../../../../utils/initialization-utils';\nimport {\n defaultNumberFormatter,\n NumberFormatter,\n} from '../../../common/formats/format-common';\nimport {Bindings} from '../../atomic-search-interface/atomic-search-interface';\nimport {ResultContext} from '@/src/components/search/result-template-component-utils/context/stencil-result-template-decorators';\n\n/**\n * The `atomic-result-number` component renders the value of a number result field.\n *\n * @slot default - The number can be formatted by adding a `atomic-format-number`, `atomic-format-currency` or `atomic-format-unit` component into this component.\n */\n@Component({\n tag: 'atomic-result-number',\n shadow: false,\n})\nexport class AtomicResultNumber {\n @InitializeBindings() public bindings!: Bindings;\n @ResultContext() private result!: Result;\n\n @Element() host!: HTMLElement;\n\n @State() public error!: Error;\n\n /**\n * The field that the component should use.\n * The component will try to find this field in the `Result.raw` object unless it finds it in the `Result` object first.\n * Make sure this field is present in the `fieldsToInclude` property of the `atomic-search-interface` component.\n */\n @Prop({reflect: true}) field!: string;\n\n @State() formatter: NumberFormatter = defaultNumberFormatter;\n\n @State() valueToDisplay: string | null = null;\n\n @Listen('atomic/numberFormat')\n public setFormat(event: CustomEvent<NumberFormatter>) {\n event.preventDefault();\n event.stopPropagation();\n this.formatter = event.detail;\n }\n\n private parseValue() {\n const value = ResultTemplatesHelpers.getResultProperty(\n this.result,\n this.field\n );\n if (value === null) {\n return null;\n }\n const valueAsNumber = parseFloat(`${value}`);\n if (Number.isNaN(valueAsNumber)) {\n this.error = new Error(\n `Could not parse \"${value}\" from field \"${this.field}\" as a number.`\n );\n return null;\n }\n return valueAsNumber;\n }\n\n private formatValue(value: number) {\n try {\n return this.formatter(value, this.bindings.i18n.languages as string[]);\n } catch (error) {\n this.error = error as Error;\n return value.toString();\n }\n }\n\n private updateValueToDisplay() {\n const value = this.parseValue();\n if (value !== null) {\n this.valueToDisplay = this.formatValue(value);\n }\n }\n\n componentWillRender() {\n this.updateValueToDisplay();\n }\n\n public render() {\n if (this.valueToDisplay === null) {\n this.host.remove();\n return;\n }\n return this.valueToDisplay;\n }\n}\n"],"mappings":"yrBAmBaA,EAAkB,M,yBAepBC,KAAAC,UAA6BC,EAE7BF,KAAAG,eAAgC,K,yDAFHD,E,oBAEG,I,CAGlC,SAAAE,CAAUC,GACfA,EAAMC,iBACND,EAAME,kBACNP,KAAKC,UAAYI,EAAMG,M,CAGjB,UAAAC,GACN,MAAMC,EAAQC,EAAuBC,kBACnCZ,KAAKa,OACLb,KAAKc,OAEP,GAAIJ,IAAU,KAAM,CAClB,OAAO,I,CAET,MAAMK,EAAgBC,WAAW,GAAGN,KACpC,GAAIO,OAAOC,MAAMH,GAAgB,CAC/Bf,KAAKmB,MAAQ,IAAIC,MACf,oBAAoBV,kBAAsBV,KAAKc,uBAEjD,OAAO,I,CAET,OAAOC,C,CAGD,WAAAM,CAAYX,GAClB,IACE,OAAOV,KAAKC,UAAUS,EAAOV,KAAKsB,SAASC,KAAKC,U,CAChD,MAAOL,GACPnB,KAAKmB,MAAQA,EACb,OAAOT,EAAMe,U,EAIT,oBAAAC,GACN,MAAMhB,EAAQV,KAAKS,aACnB,GAAIC,IAAU,KAAM,CAClBV,KAAKG,eAAiBH,KAAKqB,YAAYX,E,EAI3C,mBAAAiB,GACE3B,KAAK0B,sB,CAGA,MAAAE,GACL,GAAI5B,KAAKG,iBAAmB,KAAM,CAChCH,KAAK6B,KAAKC,SACV,M,CAEF,OAAO9B,KAAKG,c,6BApEe4B,EAAA,CAA5BC,K,+BACwBD,EAAA,CAAxBE,K","ignoreList":[]}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["atomicResultChildrenCss","AtomicResultChildrenStyle0","childTemplateComponent","componentTag","AtomicResultChildren","this","resultTemplateRegistered","templateHasError","showInitialChildren","inheritTemplates","noResultText","toggleShowInitialChildren","foldedResultList","logShowMoreFoldedResults","result","logShowLessFoldedResults","loadedFullCollection","resolveChildTemplates","event","preventDefault","detail","itemTemplateProvider","initialize","childrenTemplates","Array","from","host","querySelectorAll","filter","template","elementHasAncestorTag","length","error","Error","ItemTemplateProvider","includeDefaultTemplate","templateElements","getResultTemplateRegistered","getTemplateHasError","setResultTemplateRegistered","value","setTemplateHasError","bindings","renderChild","child","isLast","content","getTemplateContent","key","uniqueId","children","map","h","interactiveResult","buildInteractiveResult","engine","options","extractUnfoldedItem","store","density","displayConfig","imageSize","classes","trim","componentWillRender","initialChildren","collection","foldedResultListState","results","find","r","loadFullCollection","dispatchEvent","buildCustomEvent","renderCollection","showShouldButtons","moreResultsAvailable","Fragment","ShowHideButton","loadAllResults","i18n","t","collapseResults","CollectionGuard","isLoadingMoreResults","hasChildren","numberOfChildren","ChildrenWrapper","i","renderFoldedResult","render","ResultChildrenGuard","__decorate","InitializeBindings","ChildTemplatesContext","FoldedItemListContext","ResultContext","folded","ItemDisplayConfigContext","FoldedItemListStateContext"],"sources":["src/components/search/result-lists/atomic-result-children/atomic-result-children.pcss?tag=atomic-result-children&encapsulation=shadow","src/components/search/result-lists/atomic-result-children/atomic-result-children.tsx"],"sourcesContent":["@import '../../../../components/common/result-children/result-children.pcss';\n","import {\n buildInteractiveResult,\n FoldedResult,\n FoldedResultList,\n FoldedResultListState,\n} from '@coveo/headless';\nimport {\n Component,\n Element,\n State,\n h,\n Listen,\n Prop,\n Fragment,\n} from '@stencil/core';\nimport {buildCustomEvent} from '../../../../utils/event-utils';\nimport {\n InitializableComponent,\n InitializeBindings,\n} from '../../../../utils/initialization-utils';\nimport {elementHasAncestorTag} from '../../../../utils/utils';\nimport {extractUnfoldedItem} from '../../../common/item-list/unfolded-item';\nimport {\n FoldedItemListContext,\n FoldedItemListStateContext,\n} from '../../../common/item-list/item-list-decorators';\nimport {ItemTemplateProvider} from '../../../common/item-list/item-template-provider';\nimport {\n ChildTemplatesContext,\n ChildTemplatesContextEvent,\n DisplayConfig,\n ItemDisplayConfigContext,\n} from '../../../common/item-list/stencil-item-decorators';\nimport {ItemDisplayImageSize} from '../../../common/layout/display-options';\nimport {ChildrenWrapper} from '../../../common/result-children/children-wrapper';\nimport {CollectionGuard} from '../../../common/result-children/collection-guard';\nimport {ResultChildrenGuard} from '../../../common/result-children/guard';\nimport {ShowHideButton} from '../../../common/result-children/show-hide-button';\nimport {Bindings} from '../../atomic-search-interface/atomic-search-interface';\nimport {ResultContext} from '@/src/components/search/result-template-component-utils/context/stencil-result-template-decorators';\n\nconst childTemplateComponent = 'atomic-result-children-template';\nconst componentTag = 'atomic-result-children';\n\n/**\n * The `atomic-result-children` component is responsible for displaying child results by applying one or more child result templates.\n * Includes two slots, \"before-children\" and \"after-children\", which allow for rendering content before and after the list of children,\n * only when children exist.\n * @part children-root - The wrapper for the message when there are child results\n * @part no-result-root - The wrapper for the message when there are no results.\n * @part show-hide-button - The button that allows to collapse or show all child results.\n * @slot before-children - Slot that allows rendering content before the list of children, only when children exist.\n * @slot after-children - Slot that allows rendering content after the list of children, only when children exist.\n */\n@Component({\n tag: 'atomic-result-children',\n styleUrl: 'atomic-result-children.pcss',\n shadow: true,\n})\nexport class AtomicResultChildren implements InitializableComponent {\n @InitializeBindings() public bindings!: Bindings;\n @ChildTemplatesContext()\n public itemTemplateProvider?: ItemTemplateProvider;\n @FoldedItemListContext()\n private foldedResultList!: FoldedResultList;\n @ResultContext({folded: true})\n private result!: FoldedResult;\n @ItemDisplayConfigContext()\n private displayConfig!: DisplayConfig;\n private initialChildren!: FoldedResult[];\n\n @Element() public host!: HTMLDivElement;\n @State() public error!: Error;\n @State() private resultTemplateRegistered = false;\n @State() private templateHasError = false;\n @FoldedItemListStateContext()\n @State()\n private foldedResultListState!: FoldedResultListState;\n @State()\n private showInitialChildren = false;\n\n /**\n * Whether to inherit templates defined in a parent atomic-result-children. Only works for the second level of child nesting.\n */\n @Prop() inheritTemplates = false;\n /**\n * The expected size of the image displayed in the children results.\n */\n @Prop({reflect: true}) imageSize?: ItemDisplayImageSize;\n /**\n * The non-localized copy for an empty result state. An empty string will result in the component being hidden.\n */\n @Prop() public noResultText = 'no-documents-related';\n\n @Listen('atomic/resolveChildTemplates')\n public resolveChildTemplates(event: ChildTemplatesContextEvent) {\n event.preventDefault();\n event.detail(this.itemTemplateProvider);\n }\n\n public initialize() {\n if (this.inheritTemplates) {\n return;\n }\n\n const childrenTemplates = Array.from(\n this.host.querySelectorAll(childTemplateComponent)\n ).filter(\n (template) => !elementHasAncestorTag(template, childTemplateComponent)\n );\n\n if (!childrenTemplates.length) {\n this.error = new Error(\n `The \"${componentTag}\" component requires at least one \"${childTemplateComponent}\" component.`\n );\n return;\n }\n\n this.itemTemplateProvider = new ItemTemplateProvider({\n includeDefaultTemplate: false,\n templateElements: childrenTemplates,\n getResultTemplateRegistered: () => this.resultTemplateRegistered,\n getTemplateHasError: () => this.templateHasError,\n setResultTemplateRegistered: (value: boolean) => {\n this.resultTemplateRegistered = value;\n },\n setTemplateHasError: (value: boolean) => {\n this.templateHasError = value;\n },\n bindings: this.bindings,\n });\n }\n\n private renderChild(child: FoldedResult, isLast: boolean) {\n const content = this.itemTemplateProvider?.getTemplateContent(child.result);\n\n if (!content) {\n return;\n }\n\n const key =\n child.result.uniqueId +\n child.children.map((child) => child.result.uniqueId);\n return (\n <atomic-result\n key={key}\n content={content}\n result={child}\n interactiveResult={buildInteractiveResult(this.bindings.engine, {\n options: {result: extractUnfoldedItem(child)},\n })}\n store={this.bindings.store}\n density={this.displayConfig.density}\n imageSize={this.imageSize || this.displayConfig.imageSize}\n classes={`child-result ${isLast ? 'last-child' : ''}`.trim()}\n ></atomic-result>\n );\n }\n\n public componentWillRender() {\n if (this.initialChildren || !this.collection) {\n return;\n }\n\n this.initialChildren = this.collection.children;\n }\n\n private get collection() {\n return this.foldedResultListState.results.find((r) => {\n return r.result.uniqueId === this.result.result.uniqueId;\n });\n }\n private loadFullCollection() {\n this.loadedFullCollection = true;\n this.host.dispatchEvent(\n buildCustomEvent('atomic/loadCollection', this.collection)\n );\n }\n private toggleShowInitialChildren = () => {\n if (this.showInitialChildren) {\n this.foldedResultList.logShowMoreFoldedResults(this.result.result);\n } else {\n this.foldedResultList.logShowLessFoldedResults();\n }\n\n this.showInitialChildren = !this.showInitialChildren;\n };\n\n @State() private loadedFullCollection = false;\n\n private renderCollection() {\n const collection = this.collection!;\n\n const children = this.showInitialChildren\n ? this.initialChildren\n : collection.children;\n\n const showShouldButtons =\n this.loadedFullCollection || collection.moreResultsAvailable;\n\n return (\n <Fragment>\n {showShouldButtons && (\n <ShowHideButton\n moreResultsAvailable={collection.moreResultsAvailable}\n loadFullCollection={() => this.loadFullCollection()}\n showInitialChildren={this.showInitialChildren}\n toggleShowInitialChildren={this.toggleShowInitialChildren}\n loadAllResults={this.bindings.i18n.t('load-all-results')}\n collapseResults={this.bindings.i18n.t('collapse-results')}\n />\n )}\n\n <CollectionGuard\n isLoadingMoreResults={collection.isLoadingMoreResults}\n moreResultsAvailable={collection.moreResultsAvailable}\n hasChildren={collection.children.length > 0}\n numberOfChildren={collection.children.length}\n density={this.displayConfig.density}\n imageSize={this.imageSize || this.displayConfig.imageSize}\n noResultText={this.bindings.i18n.t(this.noResultText)}\n >\n <ChildrenWrapper hasChildren={collection.children.length > 0}>\n {children.map((child, i) =>\n this.renderChild(child, i === children.length - 1)\n )}\n </ChildrenWrapper>\n </CollectionGuard>\n </Fragment>\n );\n }\n\n private renderFoldedResult() {\n if (this.result.children.length === 0) {\n return;\n }\n\n const children = this.result.children;\n\n return (\n <ChildrenWrapper hasChildren={children.length > 0}>\n {children.map((child, i) =>\n this.renderChild(child, i === children.length - 1)\n )}\n </ChildrenWrapper>\n );\n }\n\n public render() {\n return (\n <ResultChildrenGuard\n inheritTemplates={this.inheritTemplates}\n resultTemplateRegistered={this.resultTemplateRegistered}\n templateHasError={this.templateHasError}\n >\n {this.collection ? this.renderCollection() : this.renderFoldedResult()}\n </ResultChildrenGuard>\n );\n }\n}\n"],"mappings":"unBAAA,MAAMA,EAA0B,q7jEAChC,MAAAC,EAAeD,E,2WCwCf,MAAME,EAAyB,kCAC/B,MAAMC,EAAe,yB,MAiBRC,EAAoB,M,yBAcdC,KAAAC,yBAA2B,MAC3BD,KAAAE,iBAAmB,MAK5BF,KAAAG,oBAAsB,MAKtBH,KAAAI,iBAAmB,MAQZJ,KAAAK,aAAe,uBAsFtBL,KAAAM,0BAA4B,KAClC,GAAIN,KAAKG,oBAAqB,CAC5BH,KAAKO,iBAAiBC,yBAAyBR,KAAKS,OAAOA,O,KACtD,CACLT,KAAKO,iBAAiBG,0B,CAGxBV,KAAKG,qBAAuBH,KAAKG,mBAAmB,EAGrCH,KAAAW,qBAAuB,M,mDAnHI,M,sBACR,M,8DAKN,M,sBAKH,M,2CAQG,uB,0BAgGU,K,CA7FjC,qBAAAC,CAAsBC,GAC3BA,EAAMC,iBACND,EAAME,OAAOf,KAAKgB,qB,CAGb,UAAAC,GACL,GAAIjB,KAAKI,iBAAkB,CACzB,M,CAGF,MAAMc,EAAoBC,MAAMC,KAC9BpB,KAAKqB,KAAKC,iBAAiBzB,IAC3B0B,QACCC,IAAcC,EAAsBD,EAAU3B,KAGjD,IAAKqB,EAAkBQ,OAAQ,CAC7B1B,KAAK2B,MAAQ,IAAIC,MACf,QAAQ9B,uCAAkDD,iBAE5D,M,CAGFG,KAAKgB,qBAAuB,IAAIa,EAAqB,CACnD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