@coveo/atomic 3.35.0-pre.df6792920f → 3.35.0-pre.e9982a2757
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/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-recs-interface.js +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 +2 -1
- 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/commerce/product-template-component-utils/context/interactive-product-context-controller.js +25 -0
- package/dist/atomic/components/components/commerce/product-template-component-utils/context/product-context-controller.js +29 -0
- package/dist/atomic/components/global/environment.js +1 -1
- package/dist/atomic/components/index.js.map +1 -1
- package/dist/atomic/components/{result-template-decorators.js → stencil-result-template-decorators.js} +6 -2
- package/dist/atomic/components/stencil-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-955092ed.entry.js → p-01096d1c.entry.js} +2 -2
- package/dist/atomic/p-01096d1c.entry.js.map +1 -0
- package/dist/atomic/{p-82cd6398.entry.js → p-154cbbfe.entry.js} +2 -2
- package/dist/atomic/{p-82cd6398.entry.js.map → p-154cbbfe.entry.js.map} +1 -1
- package/dist/atomic/{p-db3b11ca.entry.js → p-2033533c.entry.js} +2 -2
- package/dist/atomic/{p-db3b11ca.entry.js.map → p-2033533c.entry.js.map} +1 -1
- package/dist/atomic/{p-4069d801.entry.js → p-268ce7ca.entry.js} +2 -2
- package/dist/atomic/p-268ce7ca.entry.js.map +1 -0
- package/dist/atomic/{p-e9dc8e90.entry.js → p-3ec45f9c.entry.js} +2 -2
- package/dist/atomic/p-3ec45f9c.entry.js.map +1 -0
- package/dist/atomic/{p-18684d4c.js → p-4080f740.js} +1 -1
- package/dist/atomic/p-4080f740.js.map +1 -0
- package/dist/atomic/{p-8d5228da.entry.js → p-42fffab2.entry.js} +2 -2
- package/dist/atomic/p-42fffab2.entry.js.map +1 -0
- package/dist/atomic/{p-190ddaca.entry.js → p-4cf97b0a.entry.js} +2 -2
- package/dist/atomic/p-4cf97b0a.entry.js.map +1 -0
- package/dist/atomic/{p-78427c6a.entry.js → p-5a9460ab.entry.js} +2 -2
- package/dist/atomic/p-5a9460ab.entry.js.map +1 -0
- package/dist/atomic/{p-15547bd5.entry.js → p-61b3f5ce.entry.js} +2 -2
- package/dist/atomic/p-61b3f5ce.entry.js.map +1 -0
- package/dist/atomic/{p-1ff7a9da.entry.js → p-6a3b139f.entry.js} +2 -2
- package/dist/atomic/p-6a3b139f.entry.js.map +1 -0
- package/dist/atomic/{p-df8d38ca.entry.js → p-7015679e.entry.js} +2 -2
- package/dist/atomic/p-7015679e.entry.js.map +1 -0
- package/dist/atomic/{p-dea22a8d.entry.js → p-886b184f.entry.js} +2 -2
- package/dist/atomic/p-886b184f.entry.js.map +1 -0
- package/dist/atomic/{p-b3f6561d.entry.js → p-8e964890.entry.js} +2 -2
- package/dist/atomic/p-8e964890.entry.js.map +1 -0
- package/dist/atomic/{p-182f9112.entry.js → p-a413f820.entry.js} +2 -2
- package/dist/atomic/p-a413f820.entry.js.map +1 -0
- package/dist/atomic/{p-1a5ff6af.entry.js → p-a7c39901.entry.js} +2 -2
- package/dist/atomic/{p-5cab535b.entry.js → p-c5bd7f8d.entry.js} +2 -2
- package/dist/atomic/p-c5bd7f8d.entry.js.map +1 -0
- package/dist/atomic/{p-852cc16d.entry.js → p-cacb7fd8.entry.js} +2 -2
- package/dist/atomic/p-cacb7fd8.entry.js.map +1 -0
- package/dist/atomic/{p-c5164dbf.entry.js → p-cee86cff.entry.js} +2 -2
- package/dist/atomic/p-cee86cff.entry.js.map +1 -0
- package/dist/atomic/{p-4cb91ee7.entry.js → p-d5402772.entry.js} +2 -2
- package/dist/atomic/p-d5402772.entry.js.map +1 -0
- package/dist/atomic/{p-e6dc9de7.entry.js → p-da141605.entry.js} +2 -2
- package/dist/atomic/p-da141605.entry.js.map +1 -0
- package/dist/atomic/{p-a1798150.entry.js → p-dd258eaa.entry.js} +2 -2
- package/dist/atomic/p-dd258eaa.entry.js.map +1 -0
- package/dist/atomic/{p-945ddd53.entry.js → p-e1dbe31d.entry.js} +2 -2
- package/dist/atomic/p-e1dbe31d.entry.js.map +1 -0
- package/dist/atomic/{p-448091f7.entry.js → p-ecd3c0a9.entry.js} +2 -2
- package/dist/atomic/p-ecd3c0a9.entry.js.map +1 -0
- package/dist/atomic/{p-c2a5dac0.entry.js → p-f2c4209d.entry.js} +2 -2
- package/dist/atomic/{p-57049cd2.entry.js → p-f2c89d7c.entry.js} +2 -2
- package/dist/atomic/p-f2c89d7c.entry.js.map +1 -0
- package/dist/atomic/p-f800678c.entry.js.map +1 -1
- package/dist/cjs/_index.cjs.js +20 -20
- 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-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/{result-template-decorators-432d11a9.js → stencil-result-template-decorators-28b05aaf.js} +6 -2
- package/dist/cjs/stencil-result-template-decorators-28b05aaf.js.map +1 -0
- package/dist/cjs/version.cjs.js +1 -1
- package/dist/esm/_index.js +19 -19
- 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-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/{result-template-decorators-2ed76ea9.js → stencil-result-template-decorators-f989bc6b.js} +6 -2
- package/dist/esm/stencil-result-template-decorators-f989bc6b.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/fetch-product-context.d.ts +12 -0
- package/dist/types/components/commerce/product-template-component-utils/context/interactive-product-context-controller.d.ts +27 -0
- package/dist/types/components/commerce/product-template-component-utils/context/product-context-controller.d.ts +33 -0
- package/dist/types/components/commerce/product-template-component-utils/{stencil-product-template-decorators.d.ts → context/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/fetch-result-context.d.ts +8 -0
- package/dist/types/components/search/result-template-component-utils/context/interactive-result-context-controller.d.ts +12 -0
- package/dist/types/components/search/result-template-component-utils/context/result-context-controller.d.ts +18 -0
- package/dist/types/components/search/{result-template-components/result-template-decorators.d.ts → result-template-component-utils/context/stencil-result-template-decorators.d.ts} +6 -2
- 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/common/item-list/fetch-item-context.js +0 -15
- package/dist/atomic/components/decorators/commerce/product-template-decorators.js +0 -68
- package/dist/atomic/components/result-template-decorators.js.map +0 -1
- package/dist/atomic/p-15547bd5.entry.js.map +0 -1
- package/dist/atomic/p-182f9112.entry.js.map +0 -1
- package/dist/atomic/p-18684d4c.js.map +0 -1
- package/dist/atomic/p-190ddaca.entry.js.map +0 -1
- package/dist/atomic/p-1ff7a9da.entry.js.map +0 -1
- package/dist/atomic/p-4069d801.entry.js.map +0 -1
- package/dist/atomic/p-448091f7.entry.js.map +0 -1
- package/dist/atomic/p-4cb91ee7.entry.js.map +0 -1
- package/dist/atomic/p-57049cd2.entry.js.map +0 -1
- package/dist/atomic/p-5cab535b.entry.js.map +0 -1
- package/dist/atomic/p-78427c6a.entry.js.map +0 -1
- package/dist/atomic/p-852cc16d.entry.js.map +0 -1
- package/dist/atomic/p-8d5228da.entry.js.map +0 -1
- package/dist/atomic/p-945ddd53.entry.js.map +0 -1
- package/dist/atomic/p-955092ed.entry.js.map +0 -1
- package/dist/atomic/p-a1798150.entry.js.map +0 -1
- package/dist/atomic/p-b3f6561d.entry.js.map +0 -1
- package/dist/atomic/p-c5164dbf.entry.js.map +0 -1
- package/dist/atomic/p-dea22a8d.entry.js.map +0 -1
- package/dist/atomic/p-df8d38ca.entry.js.map +0 -1
- package/dist/atomic/p-e6dc9de7.entry.js.map +0 -1
- package/dist/atomic/p-e9dc8e90.entry.js.map +0 -1
- package/dist/cjs/result-template-decorators-432d11a9.js.map +0 -1
- package/dist/esm/result-template-decorators-2ed76ea9.js.map +0 -1
- package/dist/types/decorators/commerce/product-template-decorators.d.ts +0 -68
- /package/dist/atomic/{p-1a5ff6af.entry.js.map → p-a7c39901.entry.js.map} +0 -0
- /package/dist/atomic/{p-c2a5dac0.entry.js.map → p-f2c4209d.entry.js.map} +0 -0
@@ -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 '../../search/result-template-components/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":["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 '../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,EAAgC,iJACtC,MAAAC,EAAeD,E,iXCyBFE,EAA0B,M,yBAqBPC,KAAAC,mBAAqB,EAKrBD,KAAAE,UAA2B,KAEjDF,KAAAG,aAAgC,K,kEAPW,E,eAKM,I,CAIlD,UAAAC,GACLJ,KAAKK,kBAAoBC,EAAuBN,KAAKO,SAASC,O,CAGhE,gBAAYC,GACV,MAAMC,EAAQC,EAAuBC,kBACnCZ,KAAKa,OACLb,KAAKc,OAGP,GAAIJ,IAAU,KAAM,CAClB,OAAO,I,CAGT,GAAIK,MAAMC,QAAQN,GAAQ,CACxB,OAAOA,EAAMO,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GAAGI,KAAeC,IACvBC,MAAM,a,CAKJ,eAAAC,CAAgBhD,GACtB,OACEwC,EAAA,MAAIC,IAAI,oBAAoBC,KAAK,sCAC9BpD,KAAKO,SAASwC,KAAKY,EAAE,SAAU,CAACjD,U,CAK/B,eAAAkD,CAAgB/B,GACtB,MAAMgC,EAA0B7D,KAAKyC,2BAA2BZ,GAEhE,MAAMiC,EAAiB,GACvB,IAAK,IAAIC,EAAI,EAAGA,EAAIF,EAAyBE,IAAK,CAChD,GAAIA,EAAI,EAAG,CACTD,EAAME,KAAKhE,KAAKsD,gBAAgBzB,EAAOkC,EAAI,GAAIlC,EAAOkC,I,CAExDD,EAAME,KAAKhE,KAAK4C,YAAYf,EAAOkC,I,CAErC,GAAI/D,KAAKuC,sBAAsBV,GAAS,CACtCiC,EAAME,KACJhE,KAAKsD,gBACHzB,EAAOgC,EAA0B,GACjC,sBAGJC,EAAME,KAAKhE,KAAK0D,gBAAgB7B,EAAOW,OAASqB,G,CAElD,OAAOC,C,CAGF,mBAAAG,GACLjE,KAAK8B,oB,CAGA,MAAAoC,GACL,GAAIlE,KAAKG,eAAiB,KAAM,CAC9BH,KAAKmE,KAAKC,SACV,M,CAEF,OACElB,EAAA,MAAIE,KAAK,mCACHpD,KAAK4D,gBAAgB5D,KAAKG,c,6BA9JPkE,EAAA,CAA5BC,K,+BACwBD,EAAA,CAAxBE,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 '../../search/result-template-components/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":["atomicResultFieldsListCss","AtomicResultFieldsListStyle0","AtomicResultFieldsList","constructor","hostRef","this","updatingChildren","rows","connectedCallback","window","ResizeObserver","resizeObserver","update","observe","host","parentElement","disconnectedCallback","disconnect","componentDidRender","showDividers","showChildren","hideChildrenToFit","hideDividersAtEndOfRows","hostChildren","Array","from","children","isOverflowing","scrollWidth","clientWidth","scrollHeight","clientHeight","getSortedChildrenBySize","sort","a","b","offsetWidth","hide","element","style","display","show","isChildHidden","setHideDivider","hideDivider","classList","toggle","forEach","child","i","length","previousChild","filter","row","offsetTop","indexOf","push","render","h","Host","key","__decorate","ResultContext"],"sources":["src/components/search/result-template-components/atomic-result-fields-list/atomic-result-fields-list.pcss?tag=atomic-result-fields-list","src/components/search/result-template-components/atomic-result-fields-list/atomic-result-fields-list.tsx"],"sourcesContent":["@import '../../../../global/global.pcss';\n\natomic-result-fields-list {\n display: flex;\n flex-wrap: wrap;\n width: 100%;\n height: 100%;\n\n > * {\n &::after {\n display: block;\n content: ' ';\n width: 1px;\n height: 1rem;\n margin: 0 1rem;\n @apply bg-neutral;\n vertical-align: middle;\n }\n\n &.hide-divider::after {\n visibility: hidden;\n }\n }\n}\n","import {Result} from '@coveo/headless';\nimport {Component, h, Element, Host} from '@stencil/core';\nimport {ResultContext} from '../result-template-decorators';\n\n/**\n * The `atomic-result-fields-list` component selectively renders its children to ensure they fit the parent element and adds dividers between them.\n * @slot default - The children to render.\n */\n@Component({\n tag: 'atomic-result-fields-list',\n styleUrl: 'atomic-result-fields-list.pcss',\n shadow: false,\n})\nexport class AtomicResultFieldsList {\n @ResultContext()\n protected result!: Result;\n\n private resizeObserver?: ResizeObserver;\n\n private updatingChildren = false;\n private rows: number[] = [];\n @Element() private host!: HTMLElement;\n\n public connectedCallback() {\n if (window.ResizeObserver) {\n this.resizeObserver = new ResizeObserver(() => this.update());\n this.resizeObserver.observe(this.host.parentElement!);\n }\n }\n\n public disconnectedCallback() {\n this.resizeObserver?.disconnect();\n }\n\n public componentDidRender() {\n this.update();\n }\n\n public update() {\n if (this.updatingChildren) {\n return;\n }\n this.updatingChildren = true;\n this.showDividers();\n this.showChildren();\n this.hideChildrenToFit();\n this.hideDividersAtEndOfRows();\n this.updatingChildren = false;\n }\n\n private get hostChildren() {\n return Array.from(this.host.children) as HTMLElement[];\n }\n\n private get isOverflowing() {\n return (\n this.host.scrollWidth > this.host.clientWidth ||\n this.host.scrollHeight > this.host.clientHeight\n );\n }\n\n private getSortedChildrenBySize() {\n return this.hostChildren.sort((a, b) => a.offsetWidth - b.offsetWidth);\n }\n\n private hide(element: HTMLElement) {\n element.style.display = 'none';\n }\n\n private show(element: HTMLElement) {\n element.style.display = '';\n }\n\n private isChildHidden(element: HTMLElement) {\n return element.style.display === 'none';\n }\n\n private setHideDivider(element: HTMLElement, hideDivider: boolean) {\n element.classList.toggle('hide-divider', hideDivider);\n }\n\n private showChildren() {\n this.hostChildren.forEach((child) => this.show(child));\n }\n\n private showDividers() {\n this.hostChildren.forEach((child) => this.setHideDivider(child, false));\n }\n\n private hideChildrenToFit() {\n const children = this.getSortedChildrenBySize();\n for (let i = children.length - 1; this.isOverflowing && i >= 0; i--) {\n this.hide(children[i]);\n }\n }\n\n private hideDividersAtEndOfRows() {\n this.rows = [];\n let previousChild: HTMLElement | null = null;\n this.hostChildren\n .filter((child) => !this.isChildHidden(child))\n .forEach((child) => {\n const row = child.offsetTop;\n if (this.rows.indexOf(row) === -1) {\n this.rows.push(row);\n if (previousChild) {\n this.setHideDivider(previousChild, true);\n }\n }\n previousChild = child;\n });\n if (previousChild) {\n this.setHideDivider(previousChild, true);\n }\n }\n\n render() {\n return <Host></Host>;\n }\n}\n"],"mappings":"qKAAA,MAAMA,EAA4B,g1jEAClC,MAAAC,EAAeD,E,iXCYFE,EAAsB,MALnC,WAAAC,CAAAC,G,UAWUC,KAAAC,iBAAmB,MACnBD,KAAAE,KAAiB,E,CAGlB,iBAAAC,GACL,GAAI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,aACF6B,QAAQJ,IAAW3C,KAAKqC,cAAcM,KACtCD,SAASC,IACR,MAAMK,EAAML,EAAMM,UAClB,GAAIjD,KAAKE,KAAKgD,QAAQF,MAAU,EAAG,CACjChD,KAAKE,KAAKiD,KAAKH,GACf,GAAIF,EAAe,CACjB9C,KAAKsC,eAAeQ,EAAe,K,EAGvCA,EAAgBH,CAAK,IAEzB,GAAIG,EAAe,CACjB9C,KAAKsC,eAAeQ,EAAe,K,EAIvC,MAAAM,GACE,OAAOC,EAACC,EAAI,CAAAC,IAAA,4C,6BAtGJC,EAAA,CADTC,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 '../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":["atomicResultRatingCss","AtomicResultRatingStyle0","AtomicResultRating","this","maxValueInIndex","icon","Star","numberOfStars","updateNumberOfStars","value","ResultTemplatesHelpers","getResultProperty","result","field","computeNumberOfStars","error","Error","componentWillRender","render","host","remove","h","Rating","i18n","bindings","numberOfTotalIcons","numberOfActiveIcons","iconSize","__decorate","InitializeBindings","ResultContext"],"sources":["src/components/search/result-template-components/atomic-result-rating/atomic-result-rating.pcss?tag=atomic-result-rating&encapsulation=shadow","src/components/search/result-template-components/atomic-result-rating/atomic-result-rating.tsx"],"sourcesContent":["@import '../../../../global/global.pcss';\n@import '../../../common/atomic-rating/atomic-rating.pcss';\n","import {Result, ResultTemplatesHelpers} from '@coveo/headless';\nimport {Component, Element, Prop, h, State} from '@stencil/core';\nimport Star from '../../../../images/star.svg';\nimport {\n InitializableComponent,\n InitializeBindings,\n} from '../../../../utils/initialization-utils';\nimport {\n Rating,\n computeNumberOfStars,\n} from '../../../common/atomic-rating/stencil-rating';\nimport {Bindings} from '../../atomic-search-interface/atomic-search-interface';\nimport {ResultContext} from '../result-template-decorators';\n\n/**\n * The `atomic-result-rating` element renders a star rating.\n *\n * @part value-rating - The wrapper that contains the row of inactive stars and the row of active stars.\n * @part value-rating-icon - The individual star icons used in the rating display.\n */\n@Component({\n tag: 'atomic-result-rating',\n styleUrl: 'atomic-result-rating.pcss',\n shadow: true,\n})\nexport class AtomicResultRating implements InitializableComponent {\n @InitializeBindings() public bindings!: Bindings;\n @ResultContext() private result!: Result;\n @Element() host!: HTMLElement;\n\n /**\n * The field whose values you want to display as a rating.\n */\n @Prop({reflect: true}) public field!: string;\n\n /**\n * The maximum value of the field. This value is also used as the number of icons to be displayed.\n */\n @Prop({reflect: true}) public maxValueInIndex = 5;\n\n /**\n * The SVG icon to use to display the rating.\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 * When using a custom icon, at least part of your icon should have the color set to `fill=\"currentColor\"`.\n * This part of the SVG will take on the colors set in the following [variables](https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_custom_properties):\n *\n * - `--atomic-rating-icon-active-color`\n * - `--atomic-rating-icon-inactive-color`\n */\n @Prop({reflect: true}) public icon = Star;\n\n @State() public error!: Error;\n\n @State() numberOfStars: number | null = null;\n\n private updateNumberOfStars() {\n const value = ResultTemplatesHelpers.getResultProperty(\n this.result,\n this.field\n );\n try {\n this.numberOfStars = computeNumberOfStars(value, this.field);\n } catch (error) {\n this.error = error instanceof Error ? error : new Error(`${error}`);\n this.numberOfStars = null;\n }\n }\n\n componentWillRender() {\n this.updateNumberOfStars();\n }\n\n render() {\n if (this.numberOfStars === null) {\n this.host.remove();\n return;\n }\n return (\n <Rating\n i18n={this.bindings.i18n}\n icon={this.icon}\n numberOfTotalIcons={this.maxValueInIndex}\n numberOfActiveIcons={this.numberOfStars}\n iconSize={0.875}\n ></Rating>\n );\n }\n}\n"],"mappings":"6VAAA,MAAMA,EAAwB,+ujEAC9B,MAAAC,EAAeD,E,iXCwBFE,EAAkB,M,yBAaCC,KAAAC,gBAAkB,EAelBD,KAAAE,KAAOC,EAI5BH,KAAAI,cAA+B,K,0CAnBQ,E,UAeXD,E,wCAIG,I,CAEhC,mBAAAE,GACN,MAAMC,EAAQC,EAAuBC,kBACnCR,KAAKS,OACLT,KAAKU,OAEP,IACEV,KAAKI,cAAgBO,EAAqBL,EAAON,KAAKU,M,CACtD,MAAOE,GACPZ,KAAKY,MAAQA,aAAiBC,MAAQD,EAAQ,IAAIC,MAAM,GAAGD,KAC3DZ,KAAKI,cAAgB,I,EAIzB,mBAAAU,GACEd,KAAKK,qB,CAGP,MAAAU,GACE,GAAIf,KAAKI,gBAAkB,KAAM,CAC/BJ,KAAKgB,KAAKC,SACV,M,CAEF,OACEC,EAACC,EAAM,CACLC,KAAMpB,KAAKqB,SAASD,KACpBlB,KAAMF,KAAKE,KACXoB,mBAAoBtB,KAAKC,gBACzBsB,oBAAqBvB,KAAKI,cAC1BoB,SAAU,M,6BA7DaC,EAAA,CAA5BC,K,+BACwBD,EAAA,CAAxBE,K","ignoreList":[]}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["atomicInsightResultQuickviewActionCss","AtomicInsightResultQuickviewActionStyle0","AtomicInsightResultQuickviewAction","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 '../../search/result-template-components/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,GAAIvB,KAAKwB,kBAAmB,CAC1B,M,CAGF,MAAMC,EAAiBzB,KAAKc,SAASY,iBAAiBC,cACpD,0BAEF,GAAIF,EAAgB,CAClBzB,KAAKwB,kBAAoBC,EACzB,M,CAEFzB,KAAKwB,kBAAoBI,SAASC,cAAc,0BAChD7B,KAAKwB,kBAAkBM,aAAa,UAAW9B,KAAKC,SACpDD,KAAKc,SAASY,iBAAiBK,YAAY/B,KAAKwB,kB,CAG1C,kBAAAQ,GACN,GAAIhC,KAAKwB,mBAAqBxB,KAAKK,UAAU4B,MAAMC,QAAS,CAC1DlC,KAAKwB,kBAAkBU,QAAUlC,KAAKK,UAAU4B,MAAMC,QACtDlC,KAAKwB,kBAAkBP,OAASjB,KAAKiB,OACrCjB,KAAKwB,kBAAkBW,MAAQnC,KAAKoC,eAAeC,aACnDrC,KAAKwB,kBAAkBc,QAAUtC,KAAKoC,eAAeG,cACrDvC,KAAKwB,kBAAkBgB,mBAAqB,IAC1CxC,KAAKS,YAAYgC,QAEnBzC,KAAK0C,qBAAuB1C,KAAKoC,eAAeO,UAC5C3C,KAAKc,SAAS8B,KAAKC,EAAE,qBACrB7C,KAAKc,SAAS8B,KAAKC,EAAE,mBAAoB,CACvCC,MAAO9C,KAAKoC,eAAeG,cAC3BQ,KAAM/C,KAAKoC,eAAeC,aAC1BW,MAAOhD,KAAKiB,OAAO+B,O,EAKrB,OAAAC,CAAQC,GACdA,GAAOC,kBACPnD,KAAKK,UAAU+C,oB,CAGjB,yBAAYC,GACV,OAAOrD,KAAKoC,eAAekB,gB,CAGtB,MAAAC,GACLvD,KAAKuB,4BACLvB,KAAKgC,qBACL,GAAIhC,KAAKqD,sBAAuB,CAC9B,OACEG,EAACC,EAAU,CAAAC,IAAA,2CACTC,WAAW,gBACXC,MAAM,kBACNC,IAAK7D,KAAKS,YAAYqD,UACtBC,KAAMC,EACNhB,MAAOhD,KAAKc,SAAS8B,KAAKC,EAAE,aAC5BI,QAAS,IAAMjD,KAAKiD,W,8BAxHCgB,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":["t","s","module","exports","this","n","i","e","r","o","u","d","a","h","years","months","days","hours","minutes","seconds","milliseconds","weeks","c","g","f","$l","m","p","l","$","Math","ceil","floor","y","abs","v","negative","format","$d","$ms","parseFromMilliseconds","Object","keys","forEach","calMilliseconds","match","slice","map","Number","prototype","reduce","toISOString","round","toJSON","Y","YY","YYYY","M","MM","D","DD","H","HH","mm","ss","SSS","replace","String","as","get","add","subtract","locale","clone","humanize","fromNow","valueOf","asMilliseconds","asSeconds","asMinutes","asHours","asDays","asWeeks","asMonths","asYears","$utils","duration","isDuration","bind","dayjs","extend","AtomicResultTimespan","unit","initialize","Schema","field","StringValue","required","emptyAllowed","validate","value","error","Error","isNaN","render","bindings","i18n","count","ResultTemplatesHelpers","getResultProperty","result","__decorate","InitializeBindings","ResultContext"],"sources":["../../node_modules/dayjs/plugin/duration.js","src/components/search/result-template-components/atomic-result-timespan/atomic-result-timespan.tsx"],"sourcesContent":["!function(t,s){\"object\"==typeof exports&&\"undefined\"!=typeof module?module.exports=s():\"function\"==typeof define&&define.amd?define(s):(t=\"undefined\"!=typeof globalThis?globalThis:t||self).dayjs_plugin_duration=s()}(this,(function(){\"use strict\";var t,s,n=1e3,i=6e4,e=36e5,r=864e5,o=/\\[([^\\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,u=31536e6,d=2628e6,a=/^(-|\\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/,h={years:u,months:d,days:r,hours:e,minutes:i,seconds:n,milliseconds:1,weeks:6048e5},c=function(t){return t instanceof g},f=function(t,s,n){return new g(t,n,s.$l)},m=function(t){return s.p(t)+\"s\"},l=function(t){return t<0},$=function(t){return l(t)?Math.ceil(t):Math.floor(t)},y=function(t){return Math.abs(t)},v=function(t,s){return t?l(t)?{negative:!0,format:\"\"+y(t)+s}:{negative:!1,format:\"\"+t+s}:{negative:!1,format:\"\"}},g=function(){function l(t,s,n){var i=this;if(this.$d={},this.$l=n,void 0===t&&(this.$ms=0,this.parseFromMilliseconds()),s)return f(t*h[m(s)],this);if(\"number\"==typeof t)return this.$ms=t,this.parseFromMilliseconds(),this;if(\"object\"==typeof t)return Object.keys(t).forEach((function(s){i.$d[m(s)]=t[s]})),this.calMilliseconds(),this;if(\"string\"==typeof t){var e=t.match(a);if(e){var r=e.slice(2).map((function(t){return null!=t?Number(t):0}));return this.$d.years=r[0],this.$d.months=r[1],this.$d.weeks=r[2],this.$d.days=r[3],this.$d.hours=r[4],this.$d.minutes=r[5],this.$d.seconds=r[6],this.calMilliseconds(),this}}return this}var y=l.prototype;return y.calMilliseconds=function(){var t=this;this.$ms=Object.keys(this.$d).reduce((function(s,n){return s+(t.$d[n]||0)*h[n]}),0)},y.parseFromMilliseconds=function(){var t=this.$ms;this.$d.years=$(t/u),t%=u,this.$d.months=$(t/d),t%=d,this.$d.days=$(t/r),t%=r,this.$d.hours=$(t/e),t%=e,this.$d.minutes=$(t/i),t%=i,this.$d.seconds=$(t/n),t%=n,this.$d.milliseconds=t},y.toISOString=function(){var t=v(this.$d.years,\"Y\"),s=v(this.$d.months,\"M\"),n=+this.$d.days||0;this.$d.weeks&&(n+=7*this.$d.weeks);var i=v(n,\"D\"),e=v(this.$d.hours,\"H\"),r=v(this.$d.minutes,\"M\"),o=this.$d.seconds||0;this.$d.milliseconds&&(o+=this.$d.milliseconds/1e3,o=Math.round(1e3*o)/1e3);var u=v(o,\"S\"),d=t.negative||s.negative||i.negative||e.negative||r.negative||u.negative,a=e.format||r.format||u.format?\"T\":\"\",h=(d?\"-\":\"\")+\"P\"+t.format+s.format+i.format+a+e.format+r.format+u.format;return\"P\"===h||\"-P\"===h?\"P0D\":h},y.toJSON=function(){return this.toISOString()},y.format=function(t){var n=t||\"YYYY-MM-DDTHH:mm:ss\",i={Y:this.$d.years,YY:s.s(this.$d.years,2,\"0\"),YYYY:s.s(this.$d.years,4,\"0\"),M:this.$d.months,MM:s.s(this.$d.months,2,\"0\"),D:this.$d.days,DD:s.s(this.$d.days,2,\"0\"),H:this.$d.hours,HH:s.s(this.$d.hours,2,\"0\"),m:this.$d.minutes,mm:s.s(this.$d.minutes,2,\"0\"),s:this.$d.seconds,ss:s.s(this.$d.seconds,2,\"0\"),SSS:s.s(this.$d.milliseconds,3,\"0\")};return n.replace(o,(function(t,s){return s||String(i[t])}))},y.as=function(t){return this.$ms/h[m(t)]},y.get=function(t){var s=this.$ms,n=m(t);return\"milliseconds\"===n?s%=1e3:s=\"weeks\"===n?$(s/h[n]):this.$d[n],s||0},y.add=function(t,s,n){var i;return i=s?t*h[m(s)]:c(t)?t.$ms:f(t,this).$ms,f(this.$ms+i*(n?-1:1),this)},y.subtract=function(t,s){return this.add(t,s,!0)},y.locale=function(t){var s=this.clone();return s.$l=t,s},y.clone=function(){return f(this.$ms,this)},y.humanize=function(s){return t().add(this.$ms,\"ms\").locale(this.$l).fromNow(!s)},y.valueOf=function(){return this.asMilliseconds()},y.milliseconds=function(){return this.get(\"milliseconds\")},y.asMilliseconds=function(){return this.as(\"milliseconds\")},y.seconds=function(){return this.get(\"seconds\")},y.asSeconds=function(){return this.as(\"seconds\")},y.minutes=function(){return this.get(\"minutes\")},y.asMinutes=function(){return this.as(\"minutes\")},y.hours=function(){return this.get(\"hours\")},y.asHours=function(){return this.as(\"hours\")},y.days=function(){return this.get(\"days\")},y.asDays=function(){return this.as(\"days\")},y.weeks=function(){return this.get(\"weeks\")},y.asWeeks=function(){return this.as(\"weeks\")},y.months=function(){return this.get(\"months\")},y.asMonths=function(){return this.as(\"months\")},y.years=function(){return this.get(\"years\")},y.asYears=function(){return this.as(\"years\")},l}(),p=function(t,s,n){return t.add(s.years()*n,\"y\").add(s.months()*n,\"M\").add(s.days()*n,\"d\").add(s.hours()*n,\"h\").add(s.minutes()*n,\"m\").add(s.seconds()*n,\"s\").add(s.milliseconds()*n,\"ms\")};return function(n,i,e){t=e,s=e().$utils(),e.duration=function(t,s){var n=e.locale();return f(t,{$l:n},s)},e.isDuration=c;var r=i.prototype.add,o=i.prototype.subtract;i.prototype.add=function(t,s){return c(t)?p(this,t,1):r.bind(this)(t,s)},i.prototype.subtract=function(t,s){return c(t)?p(this,t,-1):o.bind(this)(t,s)}}}));","import {Schema, StringValue} from '@coveo/bueno';\nimport {Result, ResultTemplatesHelpers} from '@coveo/headless';\nimport {Component, Prop, State} from '@stencil/core';\nimport dayjs from 'dayjs';\nimport {DurationUnitType} from 'dayjs/plugin/duration';\nimport duration from 'dayjs/plugin/duration';\nimport {InitializeBindings} from '../../../../utils/initialization-utils';\nimport {Bindings} from '../../atomic-search-interface/atomic-search-interface';\nimport {ResultContext} from '../result-template-decorators';\n\ndayjs.extend(duration);\n\n/**\n * The `atomic-result-timespan` component renders a target result number field value as a duration.\n */\n@Component({\n tag: 'atomic-result-timespan',\n})\nexport class AtomicResultTimespan {\n @InitializeBindings()\n public bindings!: Bindings;\n\n @ResultContext() private result!: Result;\n\n @State() public error!: Error;\n\n /**\n * The target result field.\n * The component first looks for the field in the Result object, 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!: string;\n /**\n * The unit of measurement of the field value.\n * Available units: https://day.js.org/docs/en/durations/creating\n */\n @Prop({reflect: true}) unit = 'ms';\n /**\n * The format to apply to the result field value.\n *\n * By default, the format is HH:mm:ss when the duration is under a day, and it is an approximation when longer (days, months or years).\n *\n * The string displayed when there is an approximation can be modified with [localization](https://docs.coveo.com/en/atomic/latest/usage/atomic-localization/).\n *\n * Available formats: https://day.js.org/docs/en/durations/format\n */\n @Prop({reflect: true}) format?: string;\n\n public initialize() {\n new Schema({\n field: new StringValue({required: true, emptyAllowed: false}),\n }).validate({\n field: this.field,\n });\n if (!this.value) {\n this.error = new Error(`No value found for field ${this.field}`);\n return;\n }\n if (isNaN(this.value)) {\n this.error = new Error(\n `Value ${this.value} for field ${this.field} is not a number`\n );\n }\n }\n\n public render() {\n const duration = dayjs.duration(this.value, this.unit as DurationUnitType);\n if (this.format) {\n return duration.format(this.format);\n }\n\n if (duration.asYears() >= 1) {\n return this.bindings.i18n.t('approx_year', {\n count: Math.round(duration.asYears()),\n });\n }\n\n if (duration.asMonths() >= 1) {\n return this.bindings.i18n.t('approx_month', {\n count: Math.round(duration.asMonths()),\n });\n }\n\n if (duration.asDays() >= 1) {\n return this.bindings.i18n.t('approx_day', {\n count: Math.round(duration.asDays()),\n });\n }\n\n return duration.format('HH:mm:ss');\n }\n\n private get value() {\n return ResultTemplatesHelpers.getResultProperty(\n this.result,\n this.field\n ) as number;\n }\n}\n"],"mappings":"+bAAC,SAASA,EAAEC,GAAwDC,EAAAC,QAAeF,GAAmI,CAArN,CAAuNG,GAAI,WAA0B,IAAIJ,EAAEC,EAAEI,EAAE,IAAIC,EAAE,IAAIC,EAAE,KAAKC,EAAE,MAAMC,EAAE,sFAAsFC,EAAE,QAAQC,EAAE,OAAOC,EAAE,sKAAsKC,EAAE,CAACC,MAAMJ,EAAEK,OAAOJ,EAAEK,KAAKR,EAAES,MAAMV,EAAEW,QAAQZ,EAAEa,QAAQd,EAAEe,aAAa,EAAEC,MAAM,QAAQC,EAAE,SAAStB,GAAG,OAAOA,aAAauB,CAAC,EAAEC,EAAE,SAASxB,EAAEC,EAAEI,GAAG,OAAO,IAAIkB,EAAEvB,EAAEK,EAAEJ,EAAEwB,GAAG,EAAEC,EAAE,SAAS1B,GAAG,OAAOC,EAAE0B,EAAE3B,GAAG,GAAG,EAAE4B,EAAE,SAAS5B,GAAG,OAAOA,EAAE,CAAC,EAAE6B,EAAE,SAAS7B,GAAG,OAAO4B,EAAE5B,GAAG8B,KAAKC,KAAK/B,GAAG8B,KAAKE,MAAMhC,EAAE,EAAEiC,EAAE,SAASjC,GAAG,OAAO8B,KAAKI,IAAIlC,EAAE,EAAEmC,EAAE,SAASnC,EAAEC,GAAG,OAAOD,EAAE4B,EAAE5B,GAAG,CAACoC,UAAU,EAAEC,OAAO,GAAGJ,EAAEjC,GAAGC,GAAG,CAACmC,UAAU,EAAEC,OAAO,GAAGrC,EAAEC,GAAG,CAACmC,UAAU,EAAEC,OAAO,GAAG,EAAEd,EAAE,WAAW,SAASK,EAAE5B,EAAEC,EAAEI,GAAG,IAAIC,EAAEF,KAAK,GAAGA,KAAKkC,GAAG,GAAGlC,KAAKqB,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rintableUriStyle0","AtomicResultPrintableUri","this","listExpanded","maxNumberOfParts","focusTarget","expandedPartFocus","FocusTargetController","connectedCallback","Schema","NumberValue","min","validate","error","slotName","linkAttributes","getAttributesFromLinkSlot","host","initialize","interactiveResult","buildInteractiveResult","bindings","engine","options","result","getIndexOfEllipsis","parentsCount","valuesToHide","Math","max","valuesToShowBeforeEllipsis","renderEllipsis","h","i18n","t","onClick","e","stopPropagation","focusOnNextTarget","renderSeparator","allParents","parentsXml","parseXML","raw","parents","Array","from","getElementsByTagName","ellipsisIndex","length","map","parent","i","name","getAttribute","uri","renderLink","class","icon","Arrow","role","renderParents","slice","content","shouldSetTarget","LinkWithItemAnalytics","href","title","undefined","onSelect","select","onBeginDelayedSelect","beginDelayedSelect","onCancelPendingSelect","cancelPendingSelect","attributes","ref","el","setTarget","render","field","clickUri","__decorate","InitializeBindings","ResultContext"],"sources":["src/components/search/result-template-components/atomic-result-printable-uri/atomic-result-printable-uri.pcss?tag=atomic-result-printable-uri","src/components/search/result-template-components/atomic-result-printable-uri/atomic-result-printable-uri.tsx"],"sourcesContent":["@import '../../../../global/global.pcss';\n\natomic-result-printable-uri {\n max-width: 100%;\n word-break: break-word;\n\n a,\n button {\n @apply text-primary;\n\n &:hover,\n &:focus-visible {\n text-decoration: underline;\n @apply text-primary;\n }\n\n &:focus {\n outline: none;\n }\n\n &:visited {\n @apply text-visited;\n }\n }\n\n ul {\n display: flex;\n flex-wrap: wrap;\n }\n\n li {\n display: inline-flex;\n align-items: center;\n max-width: 100%;\n\n a {\n display: inline-block;\n vertical-align: middle;\n max-width: 100%;\n text-overflow: ellipsis;\n overflow: hidden;\n }\n\n white-space: nowrap;\n &:last-child {\n white-space: normal;\n\n &::after {\n content: none;\n }\n }\n\n .result-printable-uri-separator {\n display: inline-block;\n margin: 0 0.5rem;\n vertical-align: middle;\n width: 0.75rem;\n height: 0.75rem;\n @apply text-neutral-dark;\n }\n }\n}\n","import {Schema, NumberValue} from '@coveo/bueno';\nimport {\n buildInteractiveResult,\n InteractiveResult,\n Result,\n} from '@coveo/headless';\nimport {Component, Element, h, Prop, State, VNode} from '@stencil/core';\nimport Arrow from '../../../../images/arrow-right.svg';\nimport {InitializeBindings} from '../../../../utils/initialization-utils';\nimport {FocusTargetController} from '../../../../utils/stencil-accessibility-utils';\nimport {parseXML} from '../../../../utils/utils';\nimport {getAttributesFromLinkSlot} from '../../../common/item-link/attributes-slot';\nimport {LinkWithItemAnalytics} from '../../../common/item-link/stencil-item-link';\nimport {Bindings} from '../../atomic-search-interface/atomic-search-interface';\nimport {ResultContext} from '../result-template-decorators';\n\n/**\n * The `atomic-result-printable-uri` component displays the URI, or path, to access a result.\n *\n * @slot attributes - Lets you pass [attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#attributes) down to anchor elements, overriding other attributes.\n * To be used exclusively in anchor elements, such as: `<a slot=\"attributes\" target=\"_blank\" download></a>`.\n */\n@Component({\n tag: 'atomic-result-printable-uri',\n styleUrl: 'atomic-result-printable-uri.pcss',\n shadow: false,\n})\nexport class AtomicResultPrintableUri {\n @InitializeBindings() public bindings!: Bindings;\n @ResultContext() private result!: Result;\n @Element() public host!: HTMLElement;\n\n @State() listExpanded = false;\n @State() error!: Error;\n\n /**\n * The maximum number of Uri parts to display. This has to be over the minimum of `3` in order to be effective. Putting `Infinity` will disable the ellipsis.\n */\n @Prop({reflect: true}) maxNumberOfParts = 5;\n\n private expandedPartFocus?: FocusTargetController;\n\n private interactiveResult!: InteractiveResult;\n private linkAttributes?: Attr[];\n\n private get focusTarget() {\n if (!this.expandedPartFocus) {\n this.expandedPartFocus = new FocusTargetController(this);\n }\n return this.expandedPartFocus;\n }\n\n public connectedCallback() {\n try {\n new Schema({\n maxNumberOfParts: new NumberValue({min: 3}),\n }).validate({maxNumberOfParts: this.maxNumberOfParts});\n } catch (error) {\n this.error = error as Error;\n }\n const slotName = 'attributes';\n this.linkAttributes = getAttributesFromLinkSlot(this.host, slotName);\n }\n\n public initialize() {\n this.interactiveResult = buildInteractiveResult(this.bindings.engine, {\n options: {result: this.result},\n });\n }\n\n private getIndexOfEllipsis(parentsCount: number) {\n const valuesToHide = Math.max(2, parentsCount - this.maxNumberOfParts);\n const valuesToShowBeforeEllipsis = parentsCount - valuesToHide - 1;\n return valuesToShowBeforeEllipsis;\n }\n\n private renderEllipsis() {\n return (\n <li>\n <button\n aria-label={this.bindings.i18n.t('collapsed-uri-parts')}\n onClick={(e) => {\n e.stopPropagation();\n this.focusTarget.focusOnNextTarget();\n this.listExpanded = true;\n }}\n >\n ...\n </button>\n {this.renderSeparator()}\n </li>\n );\n }\n\n private get allParents() {\n const parentsXml = parseXML(`${this.result.raw.parents}`);\n const parents = Array.from(parentsXml.getElementsByTagName('parent'));\n const ellipsisIndex = this.getIndexOfEllipsis(parents.length);\n return parents.map((parent, i) => {\n const name = parent.getAttribute('name');\n const uri = parent.getAttribute('uri')!;\n return (\n <li>\n {this.renderLink(name, uri, i === ellipsisIndex)}\n {i === parents.length - 1 ? null : this.renderSeparator()}\n </li>\n );\n });\n }\n\n private renderSeparator() {\n return (\n <atomic-icon\n class=\"result-printable-uri-separator\"\n icon={Arrow}\n role=\"separator\"\n ></atomic-icon>\n );\n }\n\n private renderParents() {\n const parents = this.allParents;\n if (this.listExpanded || parents.length <= this.maxNumberOfParts) {\n return parents;\n }\n\n return [\n parents.slice(0, this.getIndexOfEllipsis(parents.length)),\n this.renderEllipsis(),\n parents.slice(-1),\n ];\n }\n\n private renderLink(\n content: VNode | string | null,\n uri: string,\n shouldSetTarget: boolean\n ) {\n return (\n <LinkWithItemAnalytics\n href={uri}\n title={typeof content === 'string' ? content : undefined}\n onSelect={() => this.interactiveResult.select()}\n onBeginDelayedSelect={() => this.interactiveResult.beginDelayedSelect()}\n onCancelPendingSelect={() =>\n this.interactiveResult.cancelPendingSelect()\n }\n attributes={this.linkAttributes}\n ref={\n shouldSetTarget\n ? (el?: HTMLAnchorElement) => this.focusTarget.setTarget(el)\n : undefined\n }\n >\n {content}\n </LinkWithItemAnalytics>\n );\n }\n\n public render() {\n const parents = this.renderParents();\n if (parents.length) {\n return (\n <ul aria-label={this.bindings.i18n.t('printable-uri')}>{parents}</ul>\n );\n }\n\n return this.renderLink(\n <atomic-result-text field=\"printableUri\"></atomic-result-text>,\n this.result.clickUri,\n false\n );\n }\n}\n"],"mappings":"snBAAA,MAAMA,EAA8B,62lEACpC,MAAAC,EAAeD,E,iXC0BFE,EAAwB,M,yBAK1BC,KAAAC,aAAe,MAMDD,KAAAE,iBAAmB,E,kBANlB,M,2CAMkB,C,CAO1C,eAAYC,GACV,IAAKH,KAAKI,kBAAmB,CAC3BJ,KAAKI,kBAAoB,IAAIC,EAAsBL,K,CAErD,OAAOA,KAAKI,iB,CAGP,iBAAAE,GACL,IACE,IAAIC,EAAO,CACTL,iBAAkB,IAAIM,EAAY,CAACC,IAAK,MACvCC,SAAS,CAACR,iBAAkBF,KAAKE,kB,CACpC,MAAOS,GACPX,KAAKW,MAAQA,C,CAEf,MAAMC,EAAW,aACjBZ,KAAKa,eAAiBC,EAA0Bd,KAAKe,KAAMH,E,CAGtD,UAAAI,GACLhB,KAAKiB,kBAAoBC,EAAuBlB,KAAKmB,SAASC,OAAQ,CACpEC,QAAS,CAACC,OAAQtB,KAAKsB,S,CAInB,kBAAAC,CAAmBC,GACzB,MAAMC,EAAeC,KAAKC,IAAI,EAAGH,EAAexB,KAAKE,kBACrD,MAAM0B,EAA6BJ,EAAeC,EAAe,EACjE,OAAOG,C,CAGD,cAAAC,GACN,OACEC,EAAA,UACEA,EAAA,uBACc9B,KAAKmB,SAASY,KAAKC,EAAE,uBACjCC,QAAUC,IACRA,EAAEC,kBACFnC,KAAKG,YAAYiC,oBACjBpC,KAAKC,aAAe,IAAI,GACzB,OAIFD,KAAKqC,kB,CAKZ,cAAYC,GACV,MAAMC,EAAaC,EAAS,GAAGxC,KAAKsB,OAAOmB,IAAIC,WAC/C,MAAMA,EAAUC,MAAMC,KAAKL,EAAWM,qBAAqB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,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 '../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":["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 '../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":["atomicInsightResultAttachToCaseIndicatorCss","AtomicInsightResultAttachToCaseIndicatorStyle0","AtomicInsightResultAttachToCaseIndicator","initialize","caseId","this","bindings","engine","state","insightCaseContext","attachToCase","buildAttachToCase","options","result","render","isAttached","h","key","part","class","icon","AttachIcon","title","i18n","t","__decorate","InitializeBindings","ResultContext","BindStateToController"],"sources":["src/components/insight/atomic-insight-result-attach-to-case-indicator/atomic-insight-result-attach-to-case-indicator.pcss?tag=atomic-insight-result-attach-to-case-indicator","src/components/insight/atomic-insight-result-attach-to-case-indicator/atomic-insight-result-attach-to-case-indicator.tsx"],"sourcesContent":["@import '../../../global/global.pcss';\n","import {AttachToCase, buildAttachToCase, Result} from '@coveo/headless/insight';\nimport {Component, State, h, Element} from '@stencil/core';\nimport AttachIcon from '../../../images/attach.svg';\nimport {\n BindStateToController,\n InitializableComponent,\n InitializeBindings,\n} from '../../../utils/initialization-utils';\nimport {ResultContext} from '../../search/result-template-components/result-template-decorators';\nimport {InsightBindings} from '../atomic-insight-interface/atomic-insight-interface';\n\n/**\n * @internal\n * The `atomic-insight-result-attach-to-case-indicator` component can be included inside a result template to indicate whether a result is attached to the current case.\n *\n * @part icon The icon that indicates whether the result is attached to the case.\n */\n@Component({\n tag: 'atomic-insight-result-attach-to-case-indicator',\n styleUrl: 'atomic-insight-result-attach-to-case-indicator.pcss',\n})\nexport class AtomicInsightResultAttachToCaseIndicator\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 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 public render() {\n if (this.attachToCase.isAttached()) {\n return (\n <atomic-icon\n part=\"icon\"\n class=\"flex w-5 justify-center\"\n icon={AttachIcon}\n title={this.bindings.i18n.t('result-is-attached')}\n ></atomic-icon>\n );\n }\n }\n}\n"],"mappings":"yVAAA,MAAMA,EAA8C,+8iEACpD,MAAAC,EAAeD,E,iXCoBFE,EAAwC,M,+EAe5C,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,CAKP,MAAAU,GACL,GAAIT,KAAKK,aAAaK,aAAc,CAClC,OACEC,EAAA,eAAAC,IAAA,2CACEC,KAAK,OACLC,MAAM,0BACNC,KAAMC,EACNC,MAAOjB,KAAKC,SAASiB,KAAKC,EAAE,uB,8BA9BPC,EAAA,CAA5BC,K,+BACwBD,EAAA,CAAxBE,K,6BASMF,EAAA,CAFNG,EAAsB,iB","ignoreList":[]}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["atomicInsightResultActionCss","AtomicInsightResultActionStyle0","Actions","AtomicInsightResultAction","this","icon","tooltip","tooltipOnClick","action","initialize","actions","loadInsightAnalyticsActions","bindings","engine","onClick","originalTooltip","setTimeout","CopyToClipboard","dispatch","logCopyToClipboard","result","navigator","clipboard","writeText","clickUri","PostToFeed","logFeedItemTextPost","SendAsEmail","logCaseSendEmail","actionClicked","emit","getIcon","CopyIcon","AttachToCase","AttachIcon","Quickview","QuickviewIcon","FeedIcon","EmailIcon","render","h","IconButton","key","partPrefix","style","title","__decorate","InitializeBindings","ResultContext"],"sources":["src/components/insight/atomic-insight-result-action/atomic-insight-result-action.pcss?tag=atomic-insight-result-action","src/components/insight/atomic-insight-result-action/atomic-insight-result-action.tsx"],"sourcesContent":["@import '../../../global/global.pcss';\n\n:host {\n &::part(result-action-button) {\n @apply flex items-center justify-center;\n @apply h-8 w-8;\n }\n}\n","import {Result} from '@coveo/headless';\nimport {\n InsightAnalyticsActionCreators,\n loadInsightAnalyticsActions,\n} from '@coveo/headless/insight';\nimport {Component, Event, EventEmitter, Prop, State, h} from '@stencil/core';\nimport AttachIcon from '../../../images/attach.svg';\nimport CopyIcon from '../../../images/copy-dark.svg';\nimport EmailIcon from '../../../images/email.svg';\nimport QuickviewIcon from '../../../images/preview.svg';\nimport FeedIcon from '../../../images/share-post.svg';\nimport {\n InitializableComponent,\n InitializeBindings,\n} from '../../../utils/initialization-utils';\nimport {IconButton} from '../../common/stencil-iconButton';\nimport {ResultContext} from '../../search/result-template-components/result-template-decorators';\nimport {InsightBindings} from '../atomic-insight-interface/atomic-insight-interface';\n\nexport interface InsightResultActionClickedEvent {\n action: string;\n result: Result;\n}\n\nexport enum Actions {\n CopyToClipboard = 'copyToClipboard',\n AttachToCase = 'attachToCase',\n Quickview = 'quickview',\n PostToFeed = 'postToFeed',\n SendAsEmail = 'sendAsEmail',\n}\n\n/**\n * @internal\n */\n@Component({\n tag: 'atomic-insight-result-action',\n styleUrl: 'atomic-insight-result-action.pcss',\n})\nexport class AtomicInsightResultAction\n implements InitializableComponent<InsightBindings>\n{\n @InitializeBindings() public bindings!: InsightBindings;\n @ResultContext() private result!: Result;\n @State() public error!: Error;\n\n @Event({\n eventName: 'atomicInsightResultActionClicked',\n composed: true,\n cancelable: true,\n bubbles: true,\n })\n private actionClicked!: EventEmitter<InsightResultActionClickedEvent>;\n\n /**\n * Specify the result action icon to display.\n */\n @Prop({mutable: true}) public icon = '';\n\n /**\n * The text tooltip to show on the result action icon.\n */\n @Prop({mutable: true}) public tooltip = '';\n\n /**\n * The text tooltip to show on the result action icon for some time after clicking the button.\n */\n @Prop({mutable: true}) public tooltipOnClick = '';\n\n /**\n * The type of action to perform when the result action is clicked. This will be sent along the event fired when the button is clicked.\n */\n @Prop({mutable: true}) public action: Actions | string = '';\n\n private actions!: InsightAnalyticsActionCreators;\n\n public initialize() {\n this.actions = loadInsightAnalyticsActions(this.bindings.engine);\n }\n\n private onClick() {\n if (this.tooltipOnClick) {\n const originalTooltip = this.tooltip;\n this.tooltip = this.tooltipOnClick;\n setTimeout(() => {\n this.tooltip = originalTooltip;\n }, 1000);\n }\n\n switch (this.action) {\n case Actions.CopyToClipboard:\n this.bindings.engine.dispatch(\n this.actions.logCopyToClipboard(this.result)\n );\n navigator.clipboard.writeText(this.result?.clickUri);\n break;\n case Actions.PostToFeed:\n this.bindings.engine.dispatch(\n this.actions.logFeedItemTextPost(this.result)\n );\n break;\n case Actions.SendAsEmail:\n this.bindings.engine.dispatch(\n this.actions.logCaseSendEmail(this.result)\n );\n break;\n }\n\n this.actionClicked.emit({action: this.action, result: this.result});\n }\n\n private getIcon() {\n if (this.icon) {\n return this.icon;\n }\n\n switch (this.action) {\n case Actions.CopyToClipboard:\n return CopyIcon;\n case Actions.AttachToCase:\n return AttachIcon;\n case Actions.Quickview:\n return QuickviewIcon;\n case Actions.PostToFeed:\n return FeedIcon;\n case Actions.SendAsEmail:\n return EmailIcon;\n default:\n return QuickviewIcon;\n }\n }\n\n public render() {\n return (\n <IconButton\n partPrefix=\"result-action\"\n style=\"outline-neutral\"\n icon={this.getIcon()}\n title={this.tooltip}\n onClick={() => this.onClick()}\n />\n );\n }\n}\n"],"mappings":"+qEAAA,MAAMA,EAA+B,wnjEACrC,MAAAC,EAA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AAAC,IAAA,2CACTC,WAAW,gBACXC,MAAM,kBACNvC,KAAMD,KAAK2B,UACXc,MAAOzC,KAAKE,QACZQ,QAAS,IAAMV,KAAKU,W,GAjGGgC,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 '../../result-template-components/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,CACnDC,uBAAwB,MACxBC,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C,OAAQ,Q,6BAGhBL,EAAA,CADPM,K,oCAUON,EAAA,CAFPO,K","ignoreList":[]}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["AtomicResultLocalizedText","this","field","render","bindings","i18n","t","localeKey","parseFieldValues","parseFieldCount","ret","Object","keys","length","entries","forEach","fieldName","i18nParameter","fieldValueRaw","ResultTemplatesHelpers","getResultProperty","result","isNullOrUndefined","fieldCount","count","__decorate","InitializeBindings","ResultContext","MapProp"],"sources":["src/components/search/result-template-components/atomic-result-localized-text/atomic-result-localized-text.ts"],"sourcesContent":["import {isNullOrUndefined} from '@coveo/bueno';\nimport {type Result, ResultTemplatesHelpers} from '@coveo/headless';\nimport {Component, Prop, State} from '@stencil/core';\nimport {\n type InitializableComponent,\n InitializeBindings,\n} from '../../../../utils/initialization-utils';\nimport {MapProp} from '../../../../utils/props-utils';\nimport type {Bindings} from '../../atomic-search-interface/atomic-search-interface';\nimport {ResultContext} from '../result-template-decorators';\n\n/**\n * The `atomic-result-localized-text` component renders a target i18n localized string using the values of a target field.\n *\n * Given this i18n configuration:\n * ```\n * searchInterface.i18n.addResourceBundle('en', 'translation', {\n * classic_book_advert: 'Classic book from {{name}}',\n * });\n * ```\n *\n * The component could be configured in such a way to replace `{{name}}` with the `author` field value from the result item:\n * ```\n * <atomic-result-localized-text locale-key=\"classic_book_advert\" field-author=\"name\"></atomic-result-localized-text>\n * ```\n *\n * @MapProp name: field;attr: field;docs: The field from which to extract the target string and the variable used to map it to the target i18n parameter. For example, the following configuration extracts the value of `author` from a result, and assign it to the i18n parameter `name`: `field-author=\"name\"`;type: Record<string, string> ;default: {}\n */\n@Component({\n tag: 'atomic-result-localized-text',\n})\nexport class AtomicResultLocalizedText implements InitializableComponent {\n @InitializeBindings() public bindings!: Bindings;\n @State() public error!: Error;\n\n @ResultContext() private result!: Result;\n /**\n * The i18n translation key.\n */\n @Prop() localeKey!: string;\n /**\n * The field value to dynamically evaluate.\n */\n @Prop() @MapProp() field: Record<string, string> = {};\n /**\n * The numerical field value used to determine whether to use the singular or plural value of a translation.\n * */\n @Prop() fieldCount?: string;\n\n render() {\n return this.bindings.i18n.t(this.localeKey, {\n ...this.parseFieldValues(),\n ...this.parseFieldCount(),\n });\n }\n\n private parseFieldValues() {\n const ret: Record<string, unknown> = {};\n if (Object.keys(this.field).length === 0) {\n return ret;\n }\n Object.entries(this.field).forEach(([fieldName, i18nParameter]) => {\n const fieldValueRaw = ResultTemplatesHelpers.getResultProperty(\n this.result,\n fieldName\n );\n if (!isNullOrUndefined(fieldValueRaw)) {\n ret[i18nParameter] = fieldValueRaw;\n }\n });\n\n return ret;\n }\n\n private parseFieldCount() {\n if (!this.fieldCount) {\n return {};\n }\n return {\n count:\n (ResultTemplatesHelpers.getResultProperty(\n this.result,\n this.fieldCount!\n ) as number) ?? 1,\n };\n }\n}\n"],"mappings":"2yBA+BaA,EAAyB,M,yBAYjBC,KAAAC,MAAgC,G,yDAAA,G,0BAMnD,MAAAC,GACE,OAAOF,KAAKG,SAASC,KAAKC,EAAEL,KAAKM,UAAW,IACvCN,KAAKO,sBACLP,KAAKQ,mB,CAIJ,gBAAAD,GACN,MAAME,EAA+B,GACrC,GAAIC,OAAOC,KAAKX,KAAKC,OAAOW,SAAW,EAAG,CACxC,OAAOH,C,CAETC,OAAOG,QAAQb,KAAKC,OAAOa,SAAQ,EAAEC,EAAWC,MAC9C,MAAMC,EAAgBC,EAAuBC,kBAC3CnB,KAAKoB,OACLL,GAEF,IAAKM,EAAkBJ,GAAgB,CACrCR,EAAIO,GAAiBC,C,KAIzB,OAAOR,C,CAGD,eAAAD,GACN,IAAKR,KAAKsB,WAAY,CACpB,MAAO,E,CAET,MAAO,CACLC,MACGL,EAAuBC,kBACtBnB,KAAKoB,OACLpB,KAAKsB,aACS,E,GAnDOE,EAAA,CAA5BC,K,+BAGwBD,EAAA,CAAxBE,K,6BAQkBF,EAAA,CAAVG,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 '../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.updateDateToRender();\n }\n\n public render() {\n if (this.dateToRender === null) {\n this.host.remove();\n return;\n }\n return this.dateToRender;\n }\n}\n"],"mappings":"mbAAC,SAASA,EAAEC,GAAwDC,EAAAC,QAAeF,GAAmI,CAArN,CAAuNG,GAAI,WAA0B,OAAO,SAASJ,EAAEC,EAAEI,GAAG,IAAIC,EAAE,SAASC,EAAE,CAACC,QAAQ,kBAAkBF,EAAEG,QAAQ,cAAcH,EAAEI,QAAQ,iBAAiBJ,EAAEK,SAAS,aAAaL,EAAEM,SAAS,oBAAoBN,EAAEO,SAAS,cAAcZ,EAAEa,UAAUC,SAAS,SAASf,EAAEC,GAAG,IAAIK,EAAEL,GAAGG,KAAKY,UAAUD,UAAUR,EAAEU,EAAEZ,EAAEL,QAAQ,GAAGkB,QAAQ,KAAKC,EAAEf,KAAKgB,KAAKH,EAAE,KAAK,GAAGI,EAAE,WAAWC,EAAEH,GAAG,EAAEE,EAAEF,GAAG,EAAE,WAAWA,EAAE,EAAE,UAAUA,EAAE,EAAE,UAAUA,EAAE,EAAE,UAAUA,EAAE,EAAE,WAAWE,EAAEE,EAAEjB,EAAEgB,IAAIf,EAAEe,GAAG,MAAM,mBAAmBC,EAAEA,EAAEC,KAAKpB,KAAKC,KAAKD,KAAKqB,OAAOF,EAAE,CAAC,CAAE,G,2DCA/tB,SAASvB,EAAEM,GAAwDJ,EAAAC,QAAeG,GAAuI,CAAzN,CAA2NF,GAAI,WAA0B,OAAO,SAASJ,EAAEM,EAAEL,GAAGA,EAAEyB,aAAa,SAAS1B,EAAEM,GAAG,IAAIW,EAAEhB,EAAE0B,GAAG3B,GAAG,GAAGiB,EAAE,OAAOX,EAAEsB,OAAOC,KAAKvB,GAAG,IA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ASA;;;;;;;;;SASgB,aAAa,CAAC,OAA0B,EAAC,MAAM,EAAE,KAAK,EAAC;IACrE,OAAOA,iCAAW,CAAC,EAAC,UAAU,EAAE,eAAe,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAC,CAAC,CAAC;AACzE,CAAC;SAEe,wBAAwB;IACtC,OAAOC,4CAAsB,EAAE,CAAC;AAClC,CAAC;AAKD;;;;;;;;;;SAUgB,aAAa,CAC3B,OAAgB;IAEhB,OAAOC,iCAAW,CAAI,OAAO,EAAE,eAAe,CAAC,CAAC;AAClD;;;;;;","names":["ItemContext","InteractiveItemContext","itemContext"],"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}
|
@@ -1 +0,0 @@
|
|
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}
|
@@ -1,68 +0,0 @@
|
|
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>;
|
File without changes
|
File without changes
|