@searchcraft/javascript-sdk 0.10.7 → 0.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/defineCustomElements.js +4 -0
- package/dist/components/index.d.ts +530 -217
- package/dist/components/index.js +1661 -8
- package/dist/components/index.js.map +1 -1
- package/dist/components/{p-e99cd628.js → p-0c495408.js} +30 -20
- package/dist/components/p-0c495408.js.map +1 -0
- package/dist/components/{p-b4cac872.js → p-1d5c5536.js} +18 -8
- package/dist/components/p-1d5c5536.js.map +1 -0
- package/dist/components/{p-274c5cc8.js → p-3286bbb3.js} +22 -10
- package/dist/components/p-3286bbb3.js.map +1 -0
- package/dist/components/{p-ea48ccae.js → p-3e41546c.js} +17 -8
- package/dist/components/p-3e41546c.js.map +1 -0
- package/dist/components/{p-adc6236e.js → p-87435aac.js} +31 -20
- package/dist/components/p-87435aac.js.map +1 -0
- package/dist/components/p-919734fe.js +31 -0
- package/dist/components/p-919734fe.js.map +1 -0
- package/dist/components/{p-b01f8216.js → p-b13c7fbb.js} +48 -33
- package/dist/components/p-b13c7fbb.js.map +1 -0
- package/dist/components/{p-810a7850.js → p-b4b67072.js} +2 -2
- package/dist/components/p-b4b67072.js.map +1 -0
- package/dist/components/{p-acab4d41.js → p-b7e99386.js} +22 -22
- package/dist/components/p-b7e99386.js.map +1 -0
- package/dist/components/{p-4dd1995c.js → p-c9b65e8f.js} +4 -4
- package/dist/components/{p-4dd1995c.js.map → p-c9b65e8f.js.map} +1 -1
- package/dist/components/p-d54771ef.js.map +1 -1
- package/dist/components/{p-a64b4cba.js → p-e2a10337.js} +2 -2
- package/dist/components/{p-a64b4cba.js.map → p-e2a10337.js.map} +1 -1
- package/dist/components/p-e30203b1.js +62 -0
- package/dist/components/p-e30203b1.js.map +1 -0
- package/dist/components/{p-320e3895.js → p-fc8ccffa.js} +22 -11
- package/dist/components/p-fc8ccffa.js.map +1 -0
- package/dist/components/searchcraft-ad.js +1 -1
- package/dist/components/searchcraft-facet-list.js +1 -1
- package/dist/components/searchcraft-filter-panel.js +51 -23
- package/dist/components/searchcraft-filter-panel.js.map +1 -1
- package/dist/components/searchcraft-input-form.js +1 -1
- package/dist/components/searchcraft-loading.d.ts +11 -0
- package/dist/components/searchcraft-loading.js +8 -0
- package/dist/components/searchcraft-loading.js.map +1 -0
- package/dist/components/searchcraft-pagination.js +13 -3
- package/dist/components/searchcraft-pagination.js.map +1 -1
- package/dist/components/searchcraft-popover-button.js +21 -9
- package/dist/components/searchcraft-popover-button.js.map +1 -1
- package/dist/components/searchcraft-popover-footer.js +1 -1
- package/dist/components/searchcraft-popover-form.js +32 -20
- package/dist/components/searchcraft-popover-form.js.map +1 -1
- package/dist/components/searchcraft-popover-list-item.js +1 -1
- package/dist/components/searchcraft-popover-list-view.js +1 -1
- package/dist/components/searchcraft-results-info.js +15 -7
- package/dist/components/searchcraft-results-info.js.map +1 -1
- package/dist/components/searchcraft-search-result.js +1 -1
- package/dist/components/searchcraft-search-results-per-page.js +14 -4
- package/dist/components/searchcraft-search-results-per-page.js.map +1 -1
- package/dist/components/searchcraft-search-results.js +50 -69
- package/dist/components/searchcraft-search-results.js.map +1 -1
- package/dist/components/searchcraft-slider.js +1 -1
- package/dist/components/searchcraft-summary-box.d.ts +11 -0
- package/dist/components/searchcraft-summary-box.js +2287 -0
- package/dist/components/searchcraft-summary-box.js.map +1 -0
- package/dist/components/searchcraft-theme.js +2 -2
- package/dist/components/searchcraft-theme.js.map +1 -1
- package/dist/components/searchcraft-toggle-button.js +1 -1
- package/dist/hydrate/index.js +6072 -4862
- package/dist/hydrate/index.mjs +6072 -4862
- package/dist/themes/hologram.css +1 -1
- package/dist/themes/hologram.css.map +1 -1
- package/dist/types/classes/CoreInstanceRegistry.d.ts +38 -0
- package/dist/types/classes/Logger.d.ts +25 -0
- package/dist/types/classes/SearchcraftCore.d.ts +50 -0
- package/dist/types/classes/index.d.ts +3 -0
- package/dist/types/clients/MeasureClient.d.ts +27 -0
- package/dist/types/clients/SearchClient.d.ts +35 -0
- package/dist/types/clients/SummaryClient.d.ts +10 -0
- package/dist/types/clients/ad-clients/AdClient.d.ts +20 -0
- package/dist/types/clients/ad-clients/AdMarketplaceClient.d.ts +14 -0
- package/dist/types/clients/ad-clients/CustomAdClient.d.ts +6 -0
- package/dist/types/clients/ad-clients/NativoClient.d.ts +14 -0
- package/dist/types/clients/ad-clients/index.d.ts +5 -0
- package/dist/types/clients/index.d.ts +4 -0
- package/dist/types/components/searchcraft-ad/searchcraft-ad.d.ts +10 -3
- package/dist/types/components/searchcraft-facet-list/searchcraft-facet-list.d.ts +9 -2
- package/dist/types/components/searchcraft-filter-panel/searchcraft-filter-panel.d.ts +14 -3
- package/dist/types/components/searchcraft-input-form/searchcraft-input-form.d.ts +9 -6
- package/dist/types/components/searchcraft-loading/searchcraft-loading.d.ts +10 -0
- package/dist/types/components/searchcraft-pagination/searchcraft-pagination.d.ts +8 -1
- package/dist/types/components/searchcraft-popover-button/searchcraft-popover-button.d.ts +10 -2
- package/dist/types/components/searchcraft-popover-footer/searchcraft-popover-footer.d.ts +8 -1
- package/dist/types/components/searchcraft-popover-form/searchcraft-popover-form.d.ts +11 -3
- package/dist/types/components/searchcraft-popover-list-item/searchcraft-popover-list-item.d.ts +9 -1
- package/dist/types/components/searchcraft-popover-list-view/searchcraft-popover-list-view.d.ts +11 -3
- package/dist/types/components/searchcraft-results-info/searchcraft-results-info.d.ts +8 -1
- package/dist/types/components/searchcraft-search-result/searchcraft-search-result.d.ts +10 -1
- package/dist/types/components/searchcraft-search-results/searchcraft-search-results.d.ts +11 -5
- package/dist/types/components/searchcraft-search-results-per-page/searchcraft-search-results-per-page.d.ts +8 -1
- package/dist/types/components/searchcraft-summary-box/searchcraft-summary-box.d.ts +49 -0
- package/dist/types/components/searchcraft-toggle-button/searchcraft-toggle-button.d.ts +8 -1
- package/dist/types/components.d.ts +256 -6
- package/dist/types/index.d.ts +4 -5
- package/dist/types/store/SearchcraftStore.types.d.ts +14 -15
- package/dist/types/store/SearchcraftStoreFactory.d.ts +13 -0
- package/dist/types/store/index.d.ts +1 -1
- package/dist/types/types/core-types/AdClientResponses.types.d.ts +24 -0
- package/dist/types/types/core-types/Facets.types.d.ts +39 -0
- package/dist/types/types/core-types/Measure.types.d.ts +52 -0
- package/dist/types/types/core-types/SearchClient.types.d.ts +67 -0
- package/dist/types/types/core-types/SearchClientResponses.types.d.ts +7 -0
- package/dist/types/types/core-types/SearchcraftAdConfig.types.d.ts +76 -0
- package/dist/types/types/core-types/SearchcraftConfig.types.d.ts +65 -0
- package/dist/types/types/core-types/SearchcraftResponse.types.d.ts +46 -0
- package/dist/types/types/core-types/SubscriptionEvents.types.d.ts +51 -0
- package/dist/types/types/core-types/index.d.ts +10 -0
- package/dist/types/types/index.d.ts +3 -0
- package/dist/types/types/sdk-types/index.d.ts +4 -0
- package/dist/types/types/sdk-types/result-mappings.types.d.ts +58 -0
- package/dist/types/types/sdk-types/searchcraft-filter-panel.types.d.ts +44 -0
- package/dist/types/types/sdk-types/templates.types.d.ts +29 -0
- package/dist/types/utils/core-utils/index.d.ts +3 -0
- package/dist/types/utils/core-utils/sanitize.d.ts +2 -0
- package/dist/types/utils/core-utils/url.d.ts +2 -0
- package/dist/types/utils/facets.d.ts +1 -1
- package/dist/types/utils/html.d.ts +1 -1
- package/dist/types/utils/units.d.ts +1 -1
- package/package.json +5 -3
- package/dist/components/p-062d6b80.js +0 -1940
- package/dist/components/p-062d6b80.js.map +0 -1
- package/dist/components/p-274c5cc8.js.map +0 -1
- package/dist/components/p-320e3895.js.map +0 -1
- package/dist/components/p-810a7850.js.map +0 -1
- package/dist/components/p-acab4d41.js.map +0 -1
- package/dist/components/p-adc6236e.js.map +0 -1
- package/dist/components/p-b01f8216.js.map +0 -1
- package/dist/components/p-b4cac872.js.map +0 -1
- package/dist/components/p-e99cd628.js.map +0 -1
- package/dist/components/p-ea48ccae.js.map +0 -1
- package/dist/types/store/SearchcraftStore.d.ts +0 -4
|
@@ -1,30 +1,40 @@
|
|
|
1
1
|
import { p as proxyCustomElement, H, h } from './p-5365011f.js';
|
|
2
|
-
import {
|
|
2
|
+
import { r as registry } from './p-e30203b1.js';
|
|
3
3
|
import { f as formatNumberWithCommas } from './p-d54771ef.js';
|
|
4
|
-
import './p-
|
|
4
|
+
import './p-e2a10337.js';
|
|
5
5
|
|
|
6
6
|
const SearchcraftPopoverFooter = /*@__PURE__*/ proxyCustomElement(class SearchcraftPopoverFooter extends H {
|
|
7
7
|
constructor() {
|
|
8
8
|
super();
|
|
9
9
|
this.__registerHost();
|
|
10
10
|
}
|
|
11
|
+
/**
|
|
12
|
+
* The id of the Searchcraft instance that this component should use.
|
|
13
|
+
*/
|
|
14
|
+
searchcraftId;
|
|
11
15
|
searchResultsCount;
|
|
12
16
|
unsubscribe = () => { };
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
this.
|
|
17
|
+
cleanupCore;
|
|
18
|
+
onCoreAvailable(core) {
|
|
19
|
+
this.searchResultsCount = core.store.getState().searchResultsCount;
|
|
20
|
+
this.unsubscribe = core.store.subscribe((state) => {
|
|
16
21
|
this.searchResultsCount = state.searchResultsCount;
|
|
17
22
|
});
|
|
18
23
|
}
|
|
24
|
+
connectedCallback() {
|
|
25
|
+
this.cleanupCore = registry.useCoreInstance(this.searchcraftId, this.onCoreAvailable.bind(this));
|
|
26
|
+
}
|
|
19
27
|
disconnectedCallback() {
|
|
20
28
|
this.unsubscribe?.();
|
|
29
|
+
this.cleanupCore?.();
|
|
21
30
|
}
|
|
22
31
|
render() {
|
|
23
|
-
return (h("footer", { key: '
|
|
32
|
+
return (h("footer", { key: 'e12fa32df3c1137e643af22323feb3dc33f7718f', class: 'searchcraft-popover-footer' }, h("p", { key: '73a33859c1702d82625748f398d5402030cc71f4', class: 'searchcraft-popover-footer-results-info' }, this.searchResultsCount
|
|
24
33
|
? `${formatNumberWithCommas(this.searchResultsCount)} Results Found`
|
|
25
|
-
: ' '), h("a", { key: '
|
|
34
|
+
: ' '), h("a", { key: '9d32f6b21b166fef3e17e5b2eb81bfafe32f8d1a', class: 'searchcraft-popover-footer-link', href: 'https://searchcraft.io/', target: '_blank', rel: 'noreferrer' }, h("svg", { key: 'e47249460b6e2b5bb2a25d37c33d8a85b8c6013e', class: 'searchcraft-popover-footer-link-image', width: '169', height: '16', viewBox: '0 0 169 16', fill: 'none', xmlns: 'http://www.w3.org/2000/svg' }, h("title", { key: '438e675ff71edfc2176c08abe8efa34aaf7496ca' }, "Powered by Searchcraft"), h("path", { key: '484e8935fb1cb84a79b8402748bac1da8171e9de', d: 'M5.07288 0.608C7.60088 0.608 8.84888 2.064 8.84888 4.112C8.84888 6.16 7.60088 7.616 5.07288 7.616H1.68088V12H0.336875V0.608H5.07288ZM5.07288 6.4C6.67288 6.4 7.45688 5.552 7.45688 4.112C7.45688 2.672 6.67288 1.824 5.07288 1.824H1.68088V6.4H5.07288ZM13.31 12.192C10.99 12.192 9.31 10.512 9.31 7.872C9.31 5.232 10.99 3.552 13.31 3.552C15.63 3.552 17.31 5.232 17.31 7.872C17.31 10.512 15.63 12.192 13.31 12.192ZM13.31 11.04C14.91 11.04 15.966 9.872 15.966 7.872C15.966 5.872 14.91 4.704 13.31 4.704C11.71 4.704 10.654 5.872 10.654 7.872C10.654 9.872 11.71 11.04 13.31 11.04ZM28.3826 3.744H29.7586L27.0066 12H25.6626L24.4466 8.176C24.1586 7.264 23.8706 6.304 23.6146 5.376C23.3426 6.304 23.0546 7.264 22.7666 8.176L21.5666 12H20.2226L17.4706 3.744H18.8466L20.0146 7.472C20.3346 8.48 20.6226 9.472 20.9106 10.48C21.1826 9.472 21.4706 8.48 21.7906 7.472L22.9426 3.744H24.2866L25.4386 7.472C25.7426 8.464 26.0466 9.456 26.3346 10.448C26.6066 9.456 26.9106 8.464 27.2146 7.472L28.3826 3.744ZM37.5194 7.872V8.32H31.2474C31.3754 10.176 32.3514 11.024 33.7914 11.024C34.9594 11.024 35.6954 10.416 35.9834 9.488H37.3114C36.9114 11.04 35.7274 12.192 33.7594 12.192C31.5034 12.192 29.9194 10.544 29.9194 7.872C29.9194 5.28 31.4394 3.552 33.7274 3.552C36.1914 3.552 37.5194 5.504 37.5194 7.872ZM33.7274 4.72C32.4314 4.72 31.4874 5.536 31.2794 7.168H36.1434C36.0154 5.808 35.1994 4.72 33.7274 4.72ZM42.9101 3.616C43.0381 3.616 43.1661 3.616 43.3421 3.632V4.864H43.0221C41.3741 4.864 40.3181 5.696 40.3181 7.296V12H39.0381V3.744H40.2541V5.2C40.7181 4.336 41.5661 3.616 42.9101 3.616ZM51.2538 7.872V8.32H44.9818C45.1098 10.176 46.0858 11.024 47.5258 11.024C48.6938 11.024 49.4298 10.416 49.7178 9.488H51.0458C50.6458 11.04 49.4618 12.192 47.4938 12.192C45.2378 12.192 43.6538 10.544 43.6538 7.872C43.6538 5.28 45.1738 3.552 47.4618 3.552C49.9258 3.552 51.2538 5.504 51.2538 7.872ZM47.4618 4.72C46.1658 4.72 45.2218 5.536 45.0138 7.168H49.8778C49.7498 5.808 48.9338 4.72 47.4618 4.72ZM58.9805 0.608H60.2605V12H59.0445V10.72C58.4205 11.664 57.4445 12.192 56.2125 12.192C53.8925 12.192 52.3725 10.512 52.3725 7.872C52.3725 5.232 53.8925 3.552 56.2125 3.552C57.4125 3.552 58.3565 4.048 58.9805 4.928V0.608ZM56.3725 11.04C57.9725 11.04 59.0285 9.872 59.0285 7.872C59.0285 5.872 57.9725 4.704 56.3725 4.704C54.7725 4.704 53.7165 5.936 53.7165 7.936C53.7165 9.936 54.7725 11.04 56.3725 11.04ZM69.2736 3.552C71.5936 3.552 73.1136 5.232 73.1136 7.872C73.1136 10.512 71.5936 12.192 69.2736 12.192C68.0416 12.192 67.0656 11.664 66.4416 10.72V12H65.2256V0.608H66.5056V4.928C67.1296 4.048 68.0736 3.552 69.2736 3.552ZM69.1136 11.04C70.7136 11.04 71.7696 9.808 71.7696 7.808C71.7696 5.808 70.7136 4.704 69.1136 4.704C67.5136 4.704 66.4576 5.872 66.4576 7.872C66.4576 9.872 67.5136 11.04 69.1136 11.04ZM79.3795 3.744H80.7715L77.2835 13.296C76.7555 14.752 75.9075 15.184 74.5955 15.184C74.3395 15.184 74.0995 15.168 73.8275 15.136V14.064H74.5795C75.3955 14.064 75.8275 13.696 76.0835 13.04C76.1795 12.8 76.2755 12.528 76.3715 12.272L73.2675 3.744H74.6755L75.8435 7.184C76.2595 8.384 76.6435 9.568 77.0275 10.752C77.3955 9.568 77.7955 8.368 78.2115 7.168L79.3795 3.744ZM89.1546 12.256C86.1146 12.256 84.2906 10.864 84.2746 8.24H86.4026C86.4346 10.032 87.6346 10.512 89.2186 10.512C90.7066 10.512 91.5226 9.936 91.5226 8.864C91.5226 7.968 90.9306 7.568 89.1866 7.216L88.2266 7.024C86.0186 6.608 84.5626 5.632 84.5626 3.568C84.5626 1.68 86.0506 0.351999 88.7866 0.351999C91.9866 0.351999 93.3466 1.856 93.4266 4H91.3306C91.2506 2.784 90.6266 2.096 88.8186 2.096C87.4426 2.096 86.7706 2.64 86.7706 3.504C86.7706 4.416 87.2986 4.832 88.9946 5.184L89.9866 5.376C92.6746 5.904 93.7626 6.944 93.7626 8.752C93.7626 11.008 92.0026 12.256 89.1546 12.256ZM102.952 8.016V8.496H96.7758C96.9198 9.968 97.7518 10.624 98.9198 10.624C99.8798 10.624 100.504 10.176 100.808 9.44H102.744C102.328 11.12 100.888 12.192 98.9038 12.192C96.4718 12.192 94.7918 10.512 94.7918 7.872C94.7918 5.28 96.4238 3.552 98.8718 3.552C101.4 3.552 102.952 5.392 102.952 8.016ZM98.8558 5.12C97.7838 5.12 96.9838 5.728 96.7918 7.088H100.936C100.776 5.92 100.056 5.12 98.8558 5.12ZM111.599 12H109.583C109.455 11.776 109.391 11.392 109.359 10.992C108.815 11.76 107.919 12.192 106.703 12.192C104.943 12.192 103.727 11.312 103.727 9.712C103.727 8.336 104.559 7.36 106.895 7.136L108.143 7.024C108.911 6.928 109.311 6.688 109.311 6.08C109.311 5.44 108.975 5.056 107.807 5.056C106.655 5.056 106.175 5.36 106.095 6.368H104.111C104.223 4.624 105.247 3.552 107.823 3.552C110.287 3.552 111.263 4.544 111.263 6.032V10.432C111.263 11.024 111.375 11.68 111.599 12ZM107.183 10.752C108.255 10.752 109.311 10.176 109.311 8.736V7.984C109.103 8.176 108.799 8.272 108.367 8.32L107.279 8.448C106.159 8.576 105.791 8.976 105.791 9.632C105.791 10.32 106.255 10.752 107.183 10.752ZM117.216 3.616C117.392 3.616 117.536 3.616 117.712 3.648V5.504H117.2C115.712 5.504 114.816 6.24 114.816 7.808V12H112.8V3.744H114.752V5.216C115.152 4.288 115.936 3.616 117.216 3.616ZM122.137 12.192C119.689 12.192 118.057 10.512 118.057 7.872C118.057 5.232 119.673 3.552 122.137 3.552C124.297 3.552 125.737 4.784 125.977 6.72H123.961C123.769 5.696 123.033 5.232 122.137 5.232C120.937 5.232 120.121 6.064 120.121 7.872C120.121 9.68 120.969 10.512 122.137 10.512C123.049 10.512 123.833 10.016 123.993 8.928H126.009C125.785 10.944 124.249 12.192 122.137 12.192ZM131.641 3.552C133.369 3.552 134.537 4.56 134.537 6.528V12H132.521V6.864C132.521 5.808 131.993 5.296 130.969 5.296C130.089 5.296 129.129 5.904 129.129 7.376V12H127.113V0.608H129.129V4.848C129.673 4.096 130.521 3.552 131.641 3.552ZM139.887 12.192C137.439 12.192 135.807 10.512 135.807 7.872C135.807 5.232 137.423 3.552 139.887 3.552C142.047 3.552 143.487 4.784 143.727 6.72H141.711C141.519 5.696 140.783 5.232 139.887 5.232C138.687 5.232 137.871 6.064 137.871 7.872C137.871 9.68 138.719 10.512 139.887 10.512C140.799 10.512 141.583 10.016 141.743 8.928H143.759C143.535 10.944 141.999 12.192 139.887 12.192ZM149.279 3.616C149.455 3.616 149.599 3.616 149.775 3.648V5.504H149.263C147.775 5.504 146.879 6.24 146.879 7.808V12H144.863V3.744H146.815V5.216C147.215 4.288 147.999 3.616 149.279 3.616ZM157.803 12H155.787C155.659 11.776 155.595 11.392 155.563 10.992C155.019 11.76 154.123 12.192 152.907 12.192C151.147 12.192 149.931 11.312 149.931 9.712C149.931 8.336 150.763 7.36 153.099 7.136L154.347 7.024C155.115 6.928 155.515 6.688 155.515 6.08C155.515 5.44 155.179 5.056 154.011 5.056C152.859 5.056 152.379 5.36 152.299 6.368H150.315C150.427 4.624 151.451 3.552 154.027 3.552C156.491 3.552 157.467 4.544 157.467 6.032V10.432C157.467 11.024 157.579 11.68 157.803 12ZM153.387 10.752C154.459 10.752 155.515 10.176 155.515 8.736V7.984C155.307 8.176 155.003 8.272 154.571 8.32L153.483 8.448C152.363 8.576 151.995 8.976 151.995 9.632C151.995 10.32 152.459 10.752 153.387 10.752ZM162.466 2.16C161.746 2.16 161.426 2.512 161.426 3.152V3.744H163.122V5.28H161.426V12H159.426V5.28H158.146V3.744H159.426V3.12C159.426 1.664 160.146 0.559999 162.13 0.559999C162.45 0.559999 162.882 0.575999 163.17 0.608V2.16H162.466ZM168.636 5.28H167.004V9.744C167.004 10.288 167.276 10.464 167.948 10.464H168.636V12C168.268 12.032 167.9 12.064 167.58 12.064C165.836 12.064 165.004 11.472 165.004 9.952V5.28H163.724V3.744H165.004V1.344H167.004V3.744H168.636V5.28Z', fill: 'currentColor' })))));
|
|
26
35
|
}
|
|
27
36
|
}, [0, "searchcraft-popover-footer", {
|
|
37
|
+
"searchcraftId": [1, "searchcraft-id"],
|
|
28
38
|
"searchResultsCount": [32]
|
|
29
39
|
}]);
|
|
30
40
|
function defineCustomElement() {
|
|
@@ -43,4 +53,4 @@ function defineCustomElement() {
|
|
|
43
53
|
|
|
44
54
|
export { SearchcraftPopoverFooter as S, defineCustomElement as d };
|
|
45
55
|
|
|
46
|
-
//# sourceMappingURL=p-
|
|
56
|
+
//# sourceMappingURL=p-1d5c5536.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"file":"p-1d5c5536.js","mappings":";;;;;MAea,wBAAwB;;;;;;;;IAI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raft-popover-footer.tsx"],"sourcesContent":["import type { SearchcraftCore } from '@classes';\nimport { registry } from '@classes/CoreInstanceRegistry';\nimport { Component, h, Prop, State } from '@stencil/core';\n\nimport { formatNumberWithCommas } from '@utils';\n\n/**\n * Renders the footer for the searchcraft-popover-form.\n *\n * @internal\n */\n@Component({\n tag: 'searchcraft-popover-footer',\n shadow: false,\n})\nexport class SearchcraftPopoverFooter {\n /**\n * The id of the Searchcraft instance that this component should use.\n */\n @Prop() searchcraftId?: string;\n @State() searchResultsCount;\n\n private unsubscribe: () => void = () => {};\n private cleanupCore?: () => void;\n\n onCoreAvailable(core: SearchcraftCore) {\n this.searchResultsCount = core.store.getState().searchResultsCount;\n\n this.unsubscribe = core.store.subscribe((state) => {\n this.searchResultsCount = state.searchResultsCount;\n });\n }\n\n connectedCallback() {\n this.cleanupCore = registry.useCoreInstance(\n this.searchcraftId,\n this.onCoreAvailable.bind(this),\n );\n }\n\n disconnectedCallback() {\n this.unsubscribe?.();\n this.cleanupCore?.();\n }\n\n render() {\n return (\n <footer class='searchcraft-popover-footer'>\n <p class='searchcraft-popover-footer-results-info'>\n {this.searchResultsCount\n ? `${formatNumberWithCommas(this.searchResultsCount)} Results Found`\n : ' '}\n </p>\n <a\n class='searchcraft-popover-footer-link'\n href='https://searchcraft.io/'\n target='_blank'\n rel='noreferrer'\n >\n <svg\n class='searchcraft-popover-footer-link-image'\n width='169'\n height='16'\n viewBox='0 0 169 16'\n fill='none'\n xmlns='http://www.w3.org/2000/svg'\n >\n <title>Powered by Searchcraft</title>\n <path\n d='M5.07288 0.608C7.60088 0.608 8.84888 2.064 8.84888 4.112C8.84888 6.16 7.60088 7.616 5.07288 7.616H1.68088V12H0.336875V0.608H5.07288ZM5.07288 6.4C6.67288 6.4 7.45688 5.552 7.45688 4.112C7.45688 2.672 6.67288 1.824 5.07288 1.824H1.68088V6.4H5.07288ZM13.31 12.192C10.99 12.192 9.31 10.512 9.31 7.872C9.31 5.232 10.99 3.552 13.31 3.552C15.63 3.552 17.31 5.232 17.31 7.872C17.31 10.512 15.63 12.192 13.31 12.192ZM13.31 11.04C14.91 11.04 15.966 9.872 15.966 7.872C15.966 5.872 14.91 4.704 13.31 4.704C11.71 4.704 10.654 5.872 10.654 7.872C10.654 9.872 11.71 11.04 13.31 11.04ZM28.3826 3.744H29.7586L27.0066 12H25.6626L24.4466 8.176C24.1586 7.264 23.8706 6.304 23.6146 5.376C23.3426 6.304 23.0546 7.264 22.7666 8.176L21.5666 12H20.2226L17.4706 3.744H18.8466L20.0146 7.472C20.3346 8.48 20.6226 9.472 20.9106 10.48C21.1826 9.472 21.4706 8.48 21.7906 7.472L22.9426 3.744H24.2866L25.4386 7.472C25.7426 8.464 26.0466 9.456 26.3346 10.448C26.6066 9.456 26.9106 8.464 27.2146 7.472L28.3826 3.744ZM37.5194 7.872V8.32H31.2474C31.3754 10.176 32.3514 11.024 33.7914 11.024C34.9594 11.024 35.6954 10.416 35.9834 9.488H37.3114C36.9114 11.04 35.7274 12.192 33.7594 12.192C31.5034 12.192 29.9194 10.544 29.9194 7.872C29.9194 5.28 31.4394 3.552 33.7274 3.552C36.1914 3.552 37.5194 5.504 37.5194 7.872ZM33.7274 4.72C32.4314 4.72 31.4874 5.536 31.2794 7.168H36.1434C36.0154 5.808 35.1994 4.72 33.7274 4.72ZM42.9101 3.616C43.0381 3.616 43.1661 3.616 43.3421 3.632V4.864H43.0221C41.3741 4.864 40.3181 5.696 40.3181 7.296V12H39.0381V3.744H40.2541V5.2C40.7181 4.336 41.5661 3.616 42.9101 3.616ZM51.2538 7.872V8.32H44.9818C45.1098 10.176 46.0858 11.024 47.5258 11.024C48.6938 11.024 49.4298 10.416 49.7178 9.488H51.0458C50.6458 11.04 49.4618 12.192 47.4938 12.192C45.2378 12.192 43.6538 10.544 43.6538 7.872C43.6538 5.28 45.1738 3.552 47.4618 3.552C49.9258 3.552 51.2538 5.504 51.2538 7.872ZM47.4618 4.72C46.1658 4.72 45.2218 5.536 45.0138 7.168H49.8778C49.7498 5.808 48.9338 4.72 47.4618 4.72ZM58.9805 0.608H60.2605V12H59.0445V10.72C58.4205 11.664 57.4445 12.192 56.2125 12.192C53.8925 12.192 52.3725 10.512 52.3725 7.872C52.3725 5.232 53.8925 3.552 56.2125 3.552C57.4125 3.552 58.3565 4.048 58.9805 4.928V0.608ZM56.3725 11.04C57.9725 11.04 59.0285 9.872 59.0285 7.872C59.0285 5.872 57.9725 4.704 56.3725 4.704C54.7725 4.704 53.7165 5.936 53.7165 7.936C53.7165 9.936 54.7725 11.04 56.3725 11.04ZM69.2736 3.552C71.5936 3.552 73.1136 5.232 73.1136 7.872C73.1136 10.512 71.5936 12.192 69.2736 12.192C68.0416 12.192 67.0656 11.664 66.4416 10.72V12H65.2256V0.608H66.5056V4.928C67.1296 4.048 68.0736 3.552 69.2736 3.552ZM69.1136 11.04C70.7136 11.04 71.7696 9.808 71.7696 7.808C71.7696 5.808 70.7136 4.704 69.1136 4.704C67.5136 4.704 66.4576 5.872 66.4576 7.872C66.4576 9.872 67.5136 11.04 69.1136 11.04ZM79.3795 3.744H80.7715L77.2835 13.296C76.7555 14.752 75.9075 15.184 74.5955 15.184C74.3395 15.184 74.0995 15.168 73.8275 15.136V14.064H74.5795C75.3955 14.064 75.8275 13.696 76.0835 13.04C76.1795 12.8 76.2755 12.528 76.3715 12.272L73.2675 3.744H74.6755L75.8435 7.184C76.2595 8.384 76.6435 9.568 77.0275 10.752C77.3955 9.568 77.7955 8.368 78.2115 7.168L79.3795 3.744ZM89.1546 12.256C86.1146 12.256 84.2906 10.864 84.2746 8.24H86.4026C86.4346 10.032 87.6346 10.512 89.2186 10.512C90.7066 10.512 91.5226 9.936 91.5226 8.864C91.5226 7.968 90.9306 7.568 89.1866 7.216L88.2266 7.024C86.0186 6.608 84.5626 5.632 84.5626 3.568C84.5626 1.68 86.0506 0.351999 88.7866 0.351999C91.9866 0.351999 93.3466 1.856 93.4266 4H91.3306C91.2506 2.784 90.6266 2.096 88.8186 2.096C87.4426 2.096 86.7706 2.64 86.7706 3.504C86.7706 4.416 87.2986 4.832 88.9946 5.184L89.9866 5.376C92.6746 5.904 93.7626 6.944 93.7626 8.752C93.7626 11.008 92.0026 12.256 89.1546 12.256ZM102.952 8.016V8.496H96.7758C96.9198 9.968 97.7518 10.624 98.9198 10.624C99.8798 10.624 100.504 10.176 100.808 9.44H102.744C102.328 11.12 100.888 12.192 98.9038 12.192C96.4718 12.192 94.7918 10.512 94.7918 7.872C94.7918 5.28 96.4238 3.552 98.8718 3.552C101.4 3.552 102.952 5.392 102.952 8.016ZM98.8558 5.12C97.7838 5.12 96.9838 5.728 96.7918 7.088H100.936C100.776 5.92 100.056 5.12 98.8558 5.12ZM111.599 12H109.583C109.455 11.776 109.391 11.392 109.359 10.992C108.815 11.76 107.919 12.192 106.703 12.192C104.943 12.192 103.727 11.312 103.727 9.712C103.727 8.336 104.559 7.36 106.895 7.136L108.143 7.024C108.911 6.928 109.311 6.688 109.311 6.08C109.311 5.44 108.975 5.056 107.807 5.056C106.655 5.056 106.175 5.36 106.095 6.368H104.111C104.223 4.624 105.247 3.552 107.823 3.552C110.287 3.552 111.263 4.544 111.263 6.032V10.432C111.263 11.024 111.375 11.68 111.599 12ZM107.183 10.752C108.255 10.752 109.311 10.176 109.311 8.736V7.984C109.103 8.176 108.799 8.272 108.367 8.32L107.279 8.448C106.159 8.576 105.791 8.976 105.791 9.632C105.791 10.32 106.255 10.752 107.183 10.752ZM117.216 3.616C117.392 3.616 117.536 3.616 117.712 3.648V5.504H117.2C115.712 5.504 114.816 6.24 114.816 7.808V12H112.8V3.744H114.752V5.216C115.152 4.288 115.936 3.616 117.216 3.616ZM122.137 12.192C119.689 12.192 118.057 10.512 118.057 7.872C118.057 5.232 119.673 3.552 122.137 3.552C124.297 3.552 125.737 4.784 125.977 6.72H123.961C123.769 5.696 123.033 5.232 122.137 5.232C120.937 5.232 120.121 6.064 120.121 7.872C120.121 9.68 120.969 10.512 122.137 10.512C123.049 10.512 123.833 10.016 123.993 8.928H126.009C125.785 10.944 124.249 12.192 122.137 12.192ZM131.641 3.552C133.369 3.552 134.537 4.56 134.537 6.528V12H132.521V6.864C132.521 5.808 131.993 5.296 130.969 5.296C130.089 5.296 129.129 5.904 129.129 7.376V12H127.113V0.608H129.129V4.848C129.673 4.096 130.521 3.552 131.641 3.552ZM139.887 12.192C137.439 12.192 135.807 10.512 135.807 7.872C135.807 5.232 137.423 3.552 139.887 3.552C142.047 3.552 143.487 4.784 143.727 6.72H141.711C141.519 5.696 140.783 5.232 139.887 5.232C138.687 5.232 137.871 6.064 137.871 7.872C137.871 9.68 138.719 10.512 139.887 10.512C140.799 10.512 141.583 10.016 141.743 8.928H143.759C143.535 10.944 141.999 12.192 139.887 12.192ZM149.279 3.616C149.455 3.616 149.599 3.616 149.775 3.648V5.504H149.263C147.775 5.504 146.879 6.24 146.879 7.808V12H144.863V3.744H146.815V5.216C147.215 4.288 147.999 3.616 149.279 3.616ZM157.803 12H155.787C155.659 11.776 155.595 11.392 155.563 10.992C155.019 11.76 154.123 12.192 152.907 12.192C151.147 12.192 149.931 11.312 149.931 9.712C149.931 8.336 150.763 7.36 153.099 7.136L154.347 7.024C155.115 6.928 155.515 6.688 155.515 6.08C155.515 5.44 155.179 5.056 154.011 5.056C152.859 5.056 152.379 5.36 152.299 6.368H150.315C150.427 4.624 151.451 3.552 154.027 3.552C156.491 3.552 157.467 4.544 157.467 6.032V10.432C157.467 11.024 157.579 11.68 157.803 12ZM153.387 10.752C154.459 10.752 155.515 10.176 155.515 8.736V7.984C155.307 8.176 155.003 8.272 154.571 8.32L153.483 8.448C152.363 8.576 151.995 8.976 151.995 9.632C151.995 10.32 152.459 10.752 153.387 10.752ZM162.466 2.16C161.746 2.16 161.426 2.512 161.426 3.152V3.744H163.122V5.28H161.426V12H159.426V5.28H158.146V3.744H159.426V3.12C159.426 1.664 160.146 0.559999 162.13 0.559999C162.45 0.559999 162.882 0.575999 163.17 0.608V2.16H162.466ZM168.636 5.28H167.004V9.744C167.004 10.288 167.276 10.464 167.948 10.464H168.636V12C168.268 12.032 167.9 12.064 167.58 12.064C165.836 12.064 165.004 11.472 165.004 9.952V5.28H163.724V3.744H165.004V1.344H167.004V3.744H168.636V5.28Z'\n fill='currentColor'\n />\n </svg>\n </a>\n </footer>\n );\n }\n}\n"],"version":3}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { p as proxyCustomElement, H, h } from './p-5365011f.js';
|
|
2
|
-
import { h as html } from './p-
|
|
3
|
-
import {
|
|
2
|
+
import { h as html } from './p-b4b67072.js';
|
|
3
|
+
import { r as registry } from './p-e30203b1.js';
|
|
4
4
|
|
|
5
5
|
const SearchcraftSearchResult = /*@__PURE__*/ proxyCustomElement(class SearchcraftSearchResult extends H {
|
|
6
6
|
constructor() {
|
|
@@ -20,9 +20,19 @@ const SearchcraftSearchResult = /*@__PURE__*/ proxyCustomElement(class Searchcra
|
|
|
20
20
|
* A callback function responsible for rendering a result.
|
|
21
21
|
*/
|
|
22
22
|
template;
|
|
23
|
+
/**
|
|
24
|
+
* The id of the Searchcraft instance that this component should use.
|
|
25
|
+
*/
|
|
26
|
+
searchcraftId;
|
|
23
27
|
templateHtml;
|
|
24
28
|
get hostElement() { return this; }
|
|
29
|
+
core;
|
|
30
|
+
cleanupCore;
|
|
31
|
+
onCoreAvailable(core) {
|
|
32
|
+
this.core = core;
|
|
33
|
+
}
|
|
25
34
|
connectedCallback() {
|
|
35
|
+
this.cleanupCore = registry.useCoreInstance(this.searchcraftId, this.onCoreAvailable.bind(this));
|
|
26
36
|
if (this.item) {
|
|
27
37
|
try {
|
|
28
38
|
this.templateHtml = this.template?.(this.item.document, this.index, {
|
|
@@ -35,9 +45,10 @@ const SearchcraftSearchResult = /*@__PURE__*/ proxyCustomElement(class Searchcra
|
|
|
35
45
|
}
|
|
36
46
|
}
|
|
37
47
|
}
|
|
48
|
+
disconnectedCallback() {
|
|
49
|
+
this.cleanupCore?.();
|
|
50
|
+
}
|
|
38
51
|
handleResultContainerClick = (event) => {
|
|
39
|
-
const state = searchcraftStore.getState();
|
|
40
|
-
const core = state.getSearchcraftCore();
|
|
41
52
|
if (!event.target) {
|
|
42
53
|
return;
|
|
43
54
|
}
|
|
@@ -45,14 +56,14 @@ const SearchcraftSearchResult = /*@__PURE__*/ proxyCustomElement(class Searchcra
|
|
|
45
56
|
const link = target.closest('a');
|
|
46
57
|
if (!link ||
|
|
47
58
|
!this.hostElement?.contains(link) ||
|
|
48
|
-
!core ||
|
|
49
|
-
!core.measureClient) {
|
|
59
|
+
!this.core ||
|
|
60
|
+
!this.core.measureClient) {
|
|
50
61
|
return;
|
|
51
62
|
}
|
|
52
63
|
const document_position = this.documentPosition;
|
|
53
|
-
const search_term =
|
|
54
|
-
const number_of_documents =
|
|
55
|
-
core.measureClient.sendMeasureEvent('document_clicked', {
|
|
64
|
+
const search_term = this.core.store.getState().searchTerm;
|
|
65
|
+
const number_of_documents = this.core.store.getState().searchClientResponseItems.length || 0;
|
|
66
|
+
this.core.measureClient.sendMeasureEvent('document_clicked', {
|
|
56
67
|
document_position,
|
|
57
68
|
number_of_documents,
|
|
58
69
|
search_term,
|
|
@@ -73,6 +84,7 @@ const SearchcraftSearchResult = /*@__PURE__*/ proxyCustomElement(class Searchcra
|
|
|
73
84
|
"index": [2],
|
|
74
85
|
"documentPosition": [2, "document-position"],
|
|
75
86
|
"template": [16],
|
|
87
|
+
"searchcraftId": [1, "searchcraft-id"],
|
|
76
88
|
"templateHtml": [32]
|
|
77
89
|
}]);
|
|
78
90
|
function defineCustomElement() {
|
|
@@ -91,4 +103,4 @@ function defineCustomElement() {
|
|
|
91
103
|
|
|
92
104
|
export { SearchcraftSearchResult as S, defineCustomElement as d };
|
|
93
105
|
|
|
94
|
-
//# sourceMappingURL=p-
|
|
106
|
+
//# sourceMappingURL=p-3286bbb3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"file":"p-3286bbb3.js","mappings":";;;;MAoBa,uBAAuB;;;;;IAC1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,CAAC,gBAAgB,CAAC;QAChD,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,UAAU,CAAC;QAC1D,MAAM,mBAAmB,GACvB,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,yBAAyB,CAAC,MAAM,IAAI,CAAC,CAAC;QAEnE,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,gBAAgB,CAAC,kBAAkB,EAAE;YAC3D,iBAAiB;YACjB,mBAAmB;YACnB,WAAW;SACZ,CAAC,CAAC;KACJ,CAAC;IAEF,aAAa,GAAG,SAAQ,CAAC;IAEzB,MAAM;QACJ,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE;YACd,OAAO;SACR;QAED,IAAI,OAAO,IAAI,CAAC,QAAQ,KAAK,WAAW,EAAE;YACxC,QACE,WACE,KAAK,EAAC,iEAAiE,EACvE,OAAO,EAAE,IAAI,CAAC,0BAA0B,EACxC,SAAS,EAAE,IAAI,CAAC,aAAa,IAE5B,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,MACnD,SAAG,GAAG,EAAE,GAAG,IACT,kBAAS,GAAG,CAAU,QAAG,KAAK,CAC5B,CACL,CAAC,CACE,EACN;SACH;QAED,QACE,WACE,KAAK,EAAC,2BAA2B,EACjC,SAAS,EAAE,IAAI,CAAC,YAAY,EAC5B,OAAO,EAAE,IAAI,CAAC,0BAA0B,EACxC,SAAS,EAAE,IAAI,CAAC,aAAa,GAC7B,EACF;KACH;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/searchcraft-search-result/searchcraft-search-result.tsx"],"sourcesContent":["import type {\n SearchClientResponseItem,\n SearchResultTemplate,\n SearchResultTemplateData,\n} from '@types';\nimport { Component, Element, h, Prop, State } from '@stencil/core';\n\nimport { html } from '@utils';\nimport type { SearchcraftCore } from '@classes';\nimport { registry } from '@classes/CoreInstanceRegistry';\n\n/**\n * This web component is designed to display detailed information for a single search result. Once a query is submitted, the component formats and presents the result.\n *\n * @internal\n */\n@Component({\n tag: 'searchcraft-search-result',\n shadow: false,\n})\nexport class SearchcraftSearchResult {\n @Prop() item?: SearchClientResponseItem;\n /**\n * The index.\n */\n @Prop() index!: number;\n /**\n * The position in the document. Used with the \"document_clicked\" measure event.\n */\n @Prop() documentPosition = 0;\n /**\n * A callback function responsible for rendering a result.\n */\n @Prop() template?: SearchResultTemplate<SearchResultTemplateData>;\n /**\n * The id of the Searchcraft instance that this component should use.\n */\n @Prop() searchcraftId?: string;\n\n @State() templateHtml: string | undefined;\n @Element() hostElement?: HTMLElement;\n core?: SearchcraftCore;\n private cleanupCore?: () => void;\n\n onCoreAvailable(core: SearchcraftCore) {\n this.core = core;\n }\n\n connectedCallback() {\n this.cleanupCore = registry.useCoreInstance(\n this.searchcraftId,\n this.onCoreAvailable.bind(this),\n );\n\n if (this.item) {\n try {\n this.templateHtml = this.template?.(this.item.document, this.index, {\n html,\n source_index: this.item.source_index,\n });\n } catch (error) {\n console.error('Invalid search result template:', error);\n }\n }\n }\n\n disconnectedCallback() {\n this.cleanupCore?.();\n }\n\n handleResultContainerClick = (event: MouseEvent) => {\n if (!event.target) {\n return;\n }\n\n const target = event.target as HTMLElement;\n const link = target.closest('a');\n\n if (\n !link ||\n !this.hostElement?.contains(link) ||\n !this.core ||\n !this.core.measureClient\n ) {\n return;\n }\n\n const document_position = this.documentPosition;\n const search_term = this.core.store.getState().searchTerm;\n const number_of_documents =\n this.core.store.getState().searchClientResponseItems.length || 0;\n\n this.core.measureClient.sendMeasureEvent('document_clicked', {\n document_position,\n number_of_documents,\n search_term,\n });\n };\n\n handleKeyDown = () => {};\n\n render() {\n if (!this.item) {\n return;\n }\n\n if (typeof this.template === 'undefined') {\n return (\n <div\n class='searchcraft-search-result searchcraft-search-result-no-template'\n onClick={this.handleResultContainerClick}\n onKeyDown={this.handleKeyDown}\n >\n {Object.entries(this.item.document).map(([key, value]) => (\n <p key={key}>\n <strong>{key}</strong>: {value}\n </p>\n ))}\n </div>\n );\n }\n\n return (\n <div\n class='searchcraft-search-result'\n innerHTML={this.templateHtml}\n onClick={this.handleResultContainerClick}\n onKeyDown={this.handleKeyDown}\n />\n );\n }\n}\n"],"version":3}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { p as proxyCustomElement, H, c as createEvent, h } from './p-5365011f.js';
|
|
2
|
-
import {
|
|
2
|
+
import { r as registry } from './p-e30203b1.js';
|
|
3
3
|
import { c as classNames } from './p-5cdc6210.js';
|
|
4
4
|
|
|
5
5
|
const SearchcraftToggleButton = /*@__PURE__*/ proxyCustomElement(class SearchcraftToggleButton extends H {
|
|
@@ -16,20 +16,25 @@ const SearchcraftToggleButton = /*@__PURE__*/ proxyCustomElement(class Searchcra
|
|
|
16
16
|
* The secondary label displayed below the main label.
|
|
17
17
|
*/
|
|
18
18
|
subLabel;
|
|
19
|
+
/**
|
|
20
|
+
* The id of the Searchcraft instance that this component should use.
|
|
21
|
+
*/
|
|
22
|
+
searchcraftId;
|
|
19
23
|
/**
|
|
20
24
|
* When the toggle element is changed.
|
|
21
25
|
*/
|
|
22
26
|
toggleUpdated;
|
|
23
27
|
isActive = false;
|
|
24
|
-
unsubscribe;
|
|
25
28
|
lastSearchTerm;
|
|
29
|
+
unsubscribe;
|
|
30
|
+
cleanupCore;
|
|
26
31
|
handleToggle = async () => {
|
|
27
32
|
this.isActive = !this.isActive;
|
|
28
33
|
this.toggleUpdated?.emit(this.isActive);
|
|
29
34
|
};
|
|
30
|
-
|
|
35
|
+
onCoreAvailable(core) {
|
|
31
36
|
/** When the query changes, sets toggle button state back to inactive. */
|
|
32
|
-
this.unsubscribe =
|
|
37
|
+
this.unsubscribe = core.store.subscribe((state) => {
|
|
33
38
|
if (state.searchTerm !== this.lastSearchTerm &&
|
|
34
39
|
state.searchTerm.trim().length === 0) {
|
|
35
40
|
this.isActive = false;
|
|
@@ -37,19 +42,23 @@ const SearchcraftToggleButton = /*@__PURE__*/ proxyCustomElement(class Searchcra
|
|
|
37
42
|
this.lastSearchTerm = state.searchTerm;
|
|
38
43
|
});
|
|
39
44
|
}
|
|
45
|
+
connectedCallback() {
|
|
46
|
+
this.cleanupCore = registry.useCoreInstance(this.searchcraftId, this.onCoreAvailable.bind(this));
|
|
47
|
+
}
|
|
40
48
|
disconnectedCallback() {
|
|
41
49
|
this.unsubscribe?.();
|
|
50
|
+
this.cleanupCore?.();
|
|
42
51
|
}
|
|
43
52
|
render() {
|
|
44
|
-
return (h("div", { key: '
|
|
53
|
+
return (h("div", { key: '22a346c471a467b0b38b4cfde59ea70e0941cc93', class: classNames('searchcraft-toggle-button', {
|
|
45
54
|
'searchcraft-toggle-button-active': this.isActive,
|
|
46
|
-
}) }, h("div", { key: '
|
|
55
|
+
}) }, h("div", { key: '99a2ad545500218f85006a9a0f8bbf18b8f42ed7' }, h("p", { key: '5e4a9e3f27af75d0d480dc6b3668963bfcb0d1a2', class: 'searchcraft-toggle-button-label' }, this.label), this.subLabel && (h("p", { key: 'c9df9f08270b58a167831d59ae3f9178eb3f6175', class: 'searchcraft-toggle-button-sub-label' }, this.subLabel))), h("button", { key: '6eebeb90660122d2c12ec91091ed5987478bbec4', class: 'searchcraft-toggle-button-background', onClick: this.handleToggle, type: 'button' }, h("div", { key: '62f9b1397354322986a24e8fe9e8cee62bc96600', class: 'searchcraft-toggle-button-handle' }))));
|
|
47
56
|
}
|
|
48
57
|
}, [0, "searchcraft-toggle-button", {
|
|
49
58
|
"label": [1],
|
|
50
59
|
"subLabel": [1, "sub-label"],
|
|
60
|
+
"searchcraftId": [1, "searchcraft-id"],
|
|
51
61
|
"isActive": [32],
|
|
52
|
-
"unsubscribe": [32],
|
|
53
62
|
"lastSearchTerm": [32]
|
|
54
63
|
}]);
|
|
55
64
|
function defineCustomElement() {
|
|
@@ -68,4 +77,4 @@ function defineCustomElement() {
|
|
|
68
77
|
|
|
69
78
|
export { SearchcraftToggleButton as S, defineCustomElement as d };
|
|
70
79
|
|
|
71
|
-
//# sourceMappingURL=p-
|
|
80
|
+
//# sourceMappingURL=p-3e41546c.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"file":"p-3e41546c.js","mappings":";;;;MAqBa,uBAAuB;;;;;;;;;IAI1B,KAAK,GAAG,QAAQ,CAAC;;;;IAIjB,QAAQ,CAAqB;;;;IAI7B,aAAa,CAAU;;;;IAKtB,aAAa,CAAyB;IAEtC,QAAQ,GAAG,KAAK,CAAC;IACjB,cAAc,CAAqB;IACpC,WAAW,CAA2B;IACtC,WAAW,CAAc;IAEzB,YAAY,GAAG;QACrB,IAAI,CAAC,QAAQ,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC;QAC/B,IAAI,CAAC,aAAa,EAAE,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;KACzC,CAAC;IAEF,eAAe,CAAC,IAAqB;;QAEnC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,KAAK;YAC5C,IACE,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC,cAAc;gBACxC,KAAK,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,EACpC;gBACA,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;aACvB;YACD,IAAI,CAAC,cAAc,GAAG,KAAK,CAAC,UAAU,CAAC;SACxC,CAAC,CAAC;KACJ;IAED,iBAAiB;QACf,IAAI,CAAC,WAAW,GAAG,QAAQ,CAAC,eAAe,CACzC,IAAI,CAAC,aAAa,EAClB,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,CAChC,CAAC;KACH;IAED,oBAAoB;QAClB,IAAI,CAAC,WAAW,IAAI,CAAC;QACrB,IAAI,CAAC,WAAW,IAAI,CAAC;KACtB;IAED,MAAM;QACJ,QACE,4DACE,KAAK,EAAE,UAAU,CAAC,2BAA2B,EAAE;gBAC7C,kCAAkC,EAAE,IAAI,CAAC,QAAQ;aAClD,CAAC,IAEF,8DACE,0DAAG,KAAK,EAAC,iCAAiC,IAAE,IAAI,CAAC,KAAK,CAAK,EAC1D,IAAI,CAAC,QAAQ,KACZ,0DAAG,KAAK,EAAC,qCAAqC,IAAE,IAAI,CAAC,QAAQ,CAAK,CACnE,CACG,EACN,+DACE,KAAK,EAAC,sCAAsC,EAC5C,OAAO,EAAE,IAAI,CAAC,YAAY,EAC1B,IAAI,EAAC,QAAQ,IAEb,4DAAK,KAAK,EAAC,kCAAkC,GAAG,CACzC,CACL,EACN;KACH;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/searchcraft-toggle-button/searchcraft-toggle-button.tsx"],"sourcesContent":["import type { SearchcraftCore } from '@classes';\nimport { registry } from '@classes/CoreInstanceRegistry';\nimport {\n Component,\n Event,\n h,\n Prop,\n State,\n type EventEmitter,\n} from '@stencil/core';\nimport classNames from 'classnames';\n\n/**\n * This web component simulates a light switch functionality, providing a simple and intuitive toggle between two states—on and off.\n *\n * @internal\n */\n@Component({\n tag: 'searchcraft-toggle-button',\n shadow: false,\n})\nexport class SearchcraftToggleButton {\n /**\n * The label.\n */\n @Prop() label = 'Toggle';\n /**\n * The secondary label displayed below the main label.\n */\n @Prop() subLabel: string | undefined;\n /**\n * The id of the Searchcraft instance that this component should use.\n */\n @Prop() searchcraftId?: string;\n\n /**\n * When the toggle element is changed.\n */\n @Event() toggleUpdated?: EventEmitter<boolean>;\n\n @State() isActive = false;\n @State() lastSearchTerm: string | undefined;\n private unsubscribe: (() => void) | undefined;\n private cleanupCore?: () => void;\n\n private handleToggle = async () => {\n this.isActive = !this.isActive;\n this.toggleUpdated?.emit(this.isActive);\n };\n\n onCoreAvailable(core: SearchcraftCore) {\n /** When the query changes, sets toggle button state back to inactive. */\n this.unsubscribe = core.store.subscribe((state) => {\n if (\n state.searchTerm !== this.lastSearchTerm &&\n state.searchTerm.trim().length === 0\n ) {\n this.isActive = false;\n }\n this.lastSearchTerm = state.searchTerm;\n });\n }\n\n connectedCallback() {\n this.cleanupCore = registry.useCoreInstance(\n this.searchcraftId,\n this.onCoreAvailable.bind(this),\n );\n }\n\n disconnectedCallback() {\n this.unsubscribe?.();\n this.cleanupCore?.();\n }\n\n render() {\n return (\n <div\n class={classNames('searchcraft-toggle-button', {\n 'searchcraft-toggle-button-active': this.isActive,\n })}\n >\n <div>\n <p class='searchcraft-toggle-button-label'>{this.label}</p>\n {this.subLabel && (\n <p class='searchcraft-toggle-button-sub-label'>{this.subLabel}</p>\n )}\n </div>\n <button\n class='searchcraft-toggle-button-background'\n onClick={this.handleToggle}\n type='button'\n >\n <div class='searchcraft-toggle-button-handle' />\n </button>\n </div>\n );\n }\n}\n"],"version":3}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { p as proxyCustomElement, H, h } from './p-5365011f.js';
|
|
2
2
|
import { c as classNames } from './p-5cdc6210.js';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { h as html } from './p-b4b67072.js';
|
|
4
|
+
import { r as registry } from './p-e30203b1.js';
|
|
5
5
|
|
|
6
6
|
const urlAlphabet =
|
|
7
7
|
'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict';
|
|
@@ -20,6 +20,10 @@ const SearchcraftPopoverListItemAd = /*@__PURE__*/ proxyCustomElement(class Sear
|
|
|
20
20
|
super();
|
|
21
21
|
this.__registerHost();
|
|
22
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* The id of the Searchcraft instance that this component should use.
|
|
25
|
+
*/
|
|
26
|
+
searchcraftId;
|
|
23
27
|
adSource = 'Custom';
|
|
24
28
|
adClientResponseItem;
|
|
25
29
|
/**
|
|
@@ -35,6 +39,7 @@ const SearchcraftPopoverListItemAd = /*@__PURE__*/ proxyCustomElement(class Sear
|
|
|
35
39
|
core;
|
|
36
40
|
intersectionObserver;
|
|
37
41
|
storeUnsubscribe;
|
|
42
|
+
cleanupCore;
|
|
38
43
|
adContainerRenderedTimeout;
|
|
39
44
|
isComponentConnected = false;
|
|
40
45
|
timeTaken;
|
|
@@ -52,17 +57,16 @@ const SearchcraftPopoverListItemAd = /*@__PURE__*/ proxyCustomElement(class Sear
|
|
|
52
57
|
this.core?.handleAdContainerRendered({
|
|
53
58
|
adClientResponseItem: this.adClientResponseItem,
|
|
54
59
|
adContainerId: this.adContainerId,
|
|
55
|
-
adSource: this.adSource,
|
|
56
60
|
searchTerm: this.searchTerm || '',
|
|
57
61
|
});
|
|
58
|
-
}, this.core?.config?.adContainerRenderedDebounceDelay ||
|
|
62
|
+
}, this.core?.config?.customAdConfig?.adContainerRenderedDebounceDelay ||
|
|
63
|
+
300);
|
|
59
64
|
}
|
|
60
65
|
}
|
|
61
66
|
handleAdViewed() {
|
|
62
67
|
this.core?.handleAdContainerViewed({
|
|
63
68
|
adClientResponseItem: this.adClientResponseItem,
|
|
64
69
|
adContainerId: this.adContainerId,
|
|
65
|
-
adSource: this.adSource,
|
|
66
70
|
searchTerm: this.searchTerm || '',
|
|
67
71
|
});
|
|
68
72
|
}
|
|
@@ -70,24 +74,24 @@ const SearchcraftPopoverListItemAd = /*@__PURE__*/ proxyCustomElement(class Sear
|
|
|
70
74
|
* Things to do when there's a new incoming search request.
|
|
71
75
|
*/
|
|
72
76
|
handleNewIncomingSearchRequest(state) {
|
|
73
|
-
const
|
|
74
|
-
if (
|
|
75
|
-
this.searchTerm =
|
|
77
|
+
const requestProperties = state.searchClientRequestProperties;
|
|
78
|
+
if (requestProperties && typeof requestProperties === 'object') {
|
|
79
|
+
this.searchTerm = requestProperties.searchTerm;
|
|
76
80
|
}
|
|
77
81
|
this.searchResultCount = state.searchClientResponseItems.length;
|
|
78
82
|
this.handleAdRendered();
|
|
79
83
|
this.startIntersectionObserver();
|
|
80
84
|
}
|
|
81
|
-
|
|
82
|
-
const currentState =
|
|
85
|
+
onCoreAvailable(core) {
|
|
86
|
+
const currentState = core.store.getState();
|
|
83
87
|
this.isComponentConnected = true;
|
|
84
88
|
this.core = currentState.core;
|
|
85
89
|
this.isSearchInProgress = currentState.isSearchInProgress;
|
|
86
90
|
this.searchResultCount = currentState.searchClientResponseItems.length;
|
|
87
91
|
this.timeTaken = currentState.searchResponseTimeTaken;
|
|
88
|
-
const
|
|
89
|
-
if (
|
|
90
|
-
this.searchTerm =
|
|
92
|
+
const requestProperties = currentState.searchClientRequestProperties;
|
|
93
|
+
if (requestProperties && typeof requestProperties === 'object') {
|
|
94
|
+
this.searchTerm = requestProperties.searchTerm;
|
|
91
95
|
}
|
|
92
96
|
/**
|
|
93
97
|
* Interstial ads have a different lifecycle, where we need handle an incoming search
|
|
@@ -97,7 +101,7 @@ const SearchcraftPopoverListItemAd = /*@__PURE__*/ proxyCustomElement(class Sear
|
|
|
97
101
|
this.handleNewIncomingSearchRequest(currentState);
|
|
98
102
|
}
|
|
99
103
|
// Subscribes to store changes (for search term).
|
|
100
|
-
this.storeUnsubscribe =
|
|
104
|
+
this.storeUnsubscribe = core.store.subscribe((state) => {
|
|
101
105
|
if (this.timeTaken !== state.searchResponseTimeTaken) {
|
|
102
106
|
this.handleNewIncomingSearchRequest(state);
|
|
103
107
|
}
|
|
@@ -105,6 +109,9 @@ const SearchcraftPopoverListItemAd = /*@__PURE__*/ proxyCustomElement(class Sear
|
|
|
105
109
|
this.isSearchInProgress = state.isSearchInProgress;
|
|
106
110
|
});
|
|
107
111
|
}
|
|
112
|
+
connectedCallback() {
|
|
113
|
+
this.cleanupCore = registry.useCoreInstance(this.searchcraftId, this.onCoreAvailable.bind(this));
|
|
114
|
+
}
|
|
108
115
|
startIntersectionObserver() {
|
|
109
116
|
this.intersectionObserver?.disconnect();
|
|
110
117
|
/**
|
|
@@ -122,6 +129,7 @@ const SearchcraftPopoverListItemAd = /*@__PURE__*/ proxyCustomElement(class Sear
|
|
|
122
129
|
}
|
|
123
130
|
disconnectedCallback() {
|
|
124
131
|
this.storeUnsubscribe?.();
|
|
132
|
+
this.cleanupCore?.();
|
|
125
133
|
this.intersectionObserver?.disconnect();
|
|
126
134
|
this.isComponentConnected = false;
|
|
127
135
|
clearTimeout(this.adContainerRenderedTimeout);
|
|
@@ -132,13 +140,15 @@ const SearchcraftPopoverListItemAd = /*@__PURE__*/ proxyCustomElement(class Sear
|
|
|
132
140
|
return;
|
|
133
141
|
}
|
|
134
142
|
let templateHtml = '<p>Ad Marketplace Ad Placeholder</p>';
|
|
135
|
-
if (this.core?.config?.
|
|
136
|
-
templateHtml = this.core?.config?.
|
|
143
|
+
if (this.core?.config?.admAdConfig?.template) {
|
|
144
|
+
templateHtml = this.core?.config?.admAdConfig.template(item.admAd, {
|
|
145
|
+
html,
|
|
146
|
+
});
|
|
137
147
|
}
|
|
138
148
|
return (h("div", { class: 'searchcraft-ad searchcraft-adm-ad', "data-searchcraft-ad-container-id": this.adContainerId, id: `searchcraft-adm-ad-${this.adContainerId}`, innerHTML: templateHtml }));
|
|
139
149
|
}
|
|
140
150
|
renderCustomAd() {
|
|
141
|
-
const templateRenderFunction = this.core?.config?.
|
|
151
|
+
const templateRenderFunction = this.core?.config?.customAdConfig?.template;
|
|
142
152
|
const containerId = `searchcraft-custom-ad-${this.adContainerId}`;
|
|
143
153
|
let templateHtml = '<p>Custom Ad Placeholder</p>';
|
|
144
154
|
if (templateRenderFunction) {
|
|
@@ -150,7 +160,7 @@ const SearchcraftPopoverListItemAd = /*@__PURE__*/ proxyCustomElement(class Sear
|
|
|
150
160
|
return (h("div", { class: 'searchcraft-ad searchcraft-custom-ad', id: containerId, "data-searchcraft-ad-container-id": this.adContainerId, innerHTML: templateHtml }));
|
|
151
161
|
}
|
|
152
162
|
renderNativoAd() {
|
|
153
|
-
const nativoClassName = this.core?.config.
|
|
163
|
+
const nativoClassName = this.core?.config.nativoConfig?.adClassName || 'ntv-item';
|
|
154
164
|
return (h("div", { id: `searchcraft-native-ad-${this.adContainerId}`, class: classNames('searchcraft-ad', nativoClassName), "data-searchcraft-ad-container-id": this.adContainerId }));
|
|
155
165
|
}
|
|
156
166
|
render() {
|
|
@@ -170,6 +180,7 @@ const SearchcraftPopoverListItemAd = /*@__PURE__*/ proxyCustomElement(class Sear
|
|
|
170
180
|
}
|
|
171
181
|
}
|
|
172
182
|
}, [0, "searchcraft-ad", {
|
|
183
|
+
"searchcraftId": [1, "searchcraft-id"],
|
|
173
184
|
"adSource": [1, "ad-source"],
|
|
174
185
|
"adClientResponseItem": [16],
|
|
175
186
|
"renderPosition": [1, "render-position"],
|
|
@@ -192,6 +203,6 @@ function defineCustomElement() {
|
|
|
192
203
|
} });
|
|
193
204
|
}
|
|
194
205
|
|
|
195
|
-
export { SearchcraftPopoverListItemAd as S, defineCustomElement as d };
|
|
206
|
+
export { SearchcraftPopoverListItemAd as S, defineCustomElement as d, nanoid as n };
|
|
196
207
|
|
|
197
|
-
//# sourceMappingURL=p-
|
|
208
|
+
//# sourceMappingURL=p-87435aac.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"file":"p-87435aac.js","mappings":";;;;;AAAO,MAAM,WAAW;AACxB,EAAE;;ACmBQ,IAAC,MAAM,GAAG,CAAC,IAAI,GAAG,EAAE,KAAK;AACnC,EAAE,IAAI,EAAE,GAAG,GAAE;AACb,EAAE,IAAI,KAAK,GAAG,MAAM,CAAC,eAAe,CAAC,IAAI,UAAU,EAAE,IAAI,IAAI,CAAC,EAAE,EAAC;AACjE,EAAE,OAAO,IAAI,EAAE,EAAE;AACjB,IAAI,EAAE,IAAIA,WAAiB,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,EAAC;AAC7C,GAAG;AACH,EAAE,OAAO,EAAE;AACX;;MCPa,4BAA4B;;;;;;;;IAI/B,aAAa,CAAU;IACvB,QAAQ,GAA0C,QAAQ,CAAC;IAC3D,oBAAoB,CAAwB;;;;;;IAO5C,cAAc,GAAsC,cAAc,CAAC;IAElE,UAAU,CAAU;IACpB,kBAAkB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ules/nanoid/index.browser.js","src/components/searchcraft-ad/searchcraft-ad.tsx"],"sourcesContent":["export const urlAlphabet =\n 'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict'\n","import { urlAlphabet as scopedUrlAlphabet } from './url-alphabet/index.js'\nexport { urlAlphabet } from './url-alphabet/index.js'\nexport let random = bytes => crypto.getRandomValues(new Uint8Array(bytes))\nexport let customRandom = (alphabet, defaultSize, getRandom) => {\n let mask = (2 << Math.log2(alphabet.length - 1)) - 1\n let step = -~((1.6 * mask * defaultSize) / alphabet.length)\n return (size = defaultSize) => {\n let id = ''\n while (true) {\n let bytes = getRandom(step)\n let j = step | 0\n while (j--) {\n id += alphabet[bytes[j] & mask] || ''\n if (id.length >= size) return id\n }\n }\n }\n}\nexport let customAlphabet = (alphabet, size = 21) =>\n customRandom(alphabet, size | 0, random)\nexport let nanoid = (size = 21) => {\n let id = ''\n let bytes = crypto.getRandomValues(new Uint8Array((size |= 0)))\n while (size--) {\n id += scopedUrlAlphabet[bytes[size] & 63]\n }\n return id\n}\n","import type { AdClientResponseItem, ADMClientResponseItem } from '@types';\nimport { Component, Element, h, Prop, State } from '@stencil/core';\nimport { nanoid } from 'nanoid';\nimport classNames from 'classnames';\n\nimport type { SearchcraftState } from '@store';\n\nimport { html } from '@utils';\nimport type { SearchcraftCore } from '@classes';\nimport { registry } from '@classes/CoreInstanceRegistry';\n\n/**\n * An inline ad meant to be rendered in a list of search results.\n *\n * @internal\n */\n@Component({\n tag: 'searchcraft-ad',\n shadow: false,\n})\nexport class SearchcraftPopoverListItemAd {\n /**\n * The id of the Searchcraft instance that this component should use.\n */\n @Prop() searchcraftId?: string;\n @Prop() adSource: 'Custom' | 'Nativo' | 'adMarketplace' = 'Custom';\n @Prop() adClientResponseItem?: AdClientResponseItem;\n\n /**\n * Where the ad is being rendered within the search results div.\n * Lifecycle behavior differs for ads being rendered in different positions,\n * so we need to be able to handle all of those cases.\n */\n @Prop() renderPosition: 'interstitial' | 'top' | 'bottom' = 'interstitial';\n\n @State() searchTerm?: string;\n @State() isSearchInProgress = false;\n @State() searchResultCount = 0;\n @Element() hostElement?: HTMLElement;\n\n private core?: SearchcraftCore;\n\n private intersectionObserver?: IntersectionObserver;\n private storeUnsubscribe?: () => void;\n private cleanupCore?: () => void;\n private adContainerRenderedTimeout?: NodeJS.Timeout;\n private isComponentConnected = false;\n private timeTaken?: number;\n\n @State() adContainerId = '';\n\n /**\n * Handles when an ad container is first rendered.\n * Core emits an ad_container_rendered event and performs ad client side effects\n *\n */\n handleAdRendered() {\n this.adContainerId = nanoid();\n\n if (this.isComponentConnected && this.searchResultCount > 0) {\n clearTimeout(this.adContainerRenderedTimeout);\n this.adContainerRenderedTimeout = setTimeout(() => {\n this.core?.handleAdContainerRendered({\n adClientResponseItem: this.adClientResponseItem,\n adContainerId: this.adContainerId,\n searchTerm: this.searchTerm || '',\n });\n }, this.core?.config?.customAdConfig?.adContainerRenderedDebounceDelay ||\n 300);\n }\n }\n\n handleAdViewed() {\n this.core?.handleAdContainerViewed({\n adClientResponseItem: this.adClientResponseItem,\n adContainerId: this.adContainerId,\n searchTerm: this.searchTerm || '',\n });\n }\n\n /**\n * Things to do when there's a new incoming search request.\n */\n handleNewIncomingSearchRequest(state: SearchcraftState) {\n const requestProperties = state.searchClientRequestProperties;\n if (requestProperties && typeof requestProperties === 'object') {\n this.searchTerm = requestProperties.searchTerm;\n }\n\n this.searchResultCount = state.searchClientResponseItems.length;\n\n this.handleAdRendered();\n\n this.startIntersectionObserver();\n }\n\n onCoreAvailable(core: SearchcraftCore) {\n const currentState = core.store.getState();\n\n this.isComponentConnected = true;\n this.core = currentState.core;\n this.isSearchInProgress = currentState.isSearchInProgress;\n this.searchResultCount = currentState.searchClientResponseItems.length;\n this.timeTaken = currentState.searchResponseTimeTaken;\n\n const requestProperties = currentState.searchClientRequestProperties;\n if (requestProperties && typeof requestProperties === 'object') {\n this.searchTerm = requestProperties.searchTerm;\n }\n\n /**\n * Interstial ads have a different lifecycle, where we need handle an incoming search\n * request immediately, because they are rendered alongside the search results.\n */\n if (this.renderPosition === 'interstitial') {\n this.handleNewIncomingSearchRequest(currentState);\n }\n\n // Subscribes to store changes (for search term).\n this.storeUnsubscribe = core.store.subscribe((state) => {\n if (this.timeTaken !== state.searchResponseTimeTaken) {\n this.handleNewIncomingSearchRequest(state);\n }\n this.timeTaken = state.searchResponseTimeTaken;\n this.isSearchInProgress = state.isSearchInProgress;\n });\n }\n\n connectedCallback() {\n this.cleanupCore = registry.useCoreInstance(\n this.searchcraftId,\n this.onCoreAvailable.bind(this),\n );\n }\n\n startIntersectionObserver() {\n this.intersectionObserver?.disconnect();\n /**\n * Handles when an ad container is viewable within the document,\n * Core emits an ad_container_viewed event and performs ad client side effects\n */\n if (this.hostElement) {\n this.intersectionObserver = new IntersectionObserver(\n ([entry]) => {\n if (entry?.isIntersecting && this.searchResultCount > 0) {\n this.handleAdViewed();\n }\n },\n { threshold: 0 },\n );\n\n this.intersectionObserver.observe(this.hostElement);\n }\n }\n\n disconnectedCallback() {\n this.storeUnsubscribe?.();\n this.cleanupCore?.();\n this.intersectionObserver?.disconnect();\n this.isComponentConnected = false;\n clearTimeout(this.adContainerRenderedTimeout);\n }\n\n renderADMAd() {\n const item = this.adClientResponseItem as ADMClientResponseItem;\n\n if (!item.admAd) {\n return;\n }\n\n let templateHtml = '<p>Ad Marketplace Ad Placeholder</p>';\n\n if (this.core?.config?.admAdConfig?.template) {\n templateHtml = this.core?.config?.admAdConfig.template(item.admAd, {\n html,\n });\n }\n\n return (\n <div\n class='searchcraft-ad searchcraft-adm-ad'\n data-searchcraft-ad-container-id={this.adContainerId}\n id={`searchcraft-adm-ad-${this.adContainerId}`}\n innerHTML={templateHtml}\n />\n );\n }\n\n renderCustomAd() {\n const templateRenderFunction = this.core?.config?.customAdConfig?.template;\n const containerId = `searchcraft-custom-ad-${this.adContainerId}`;\n let templateHtml = '<p>Custom Ad Placeholder</p>';\n\n if (templateRenderFunction) {\n templateHtml = templateRenderFunction(\n {\n searchTerm: this.searchTerm || '',\n adContainerId: this.adContainerId,\n },\n { html },\n );\n }\n\n return (\n <div\n class='searchcraft-ad searchcraft-custom-ad'\n id={containerId}\n data-searchcraft-ad-container-id={this.adContainerId}\n innerHTML={templateHtml}\n />\n );\n }\n\n renderNativoAd() {\n const nativoClassName =\n this.core?.config.nativoConfig?.adClassName || 'ntv-item';\n return (\n <div\n id={`searchcraft-native-ad-${this.adContainerId}`}\n class={classNames('searchcraft-ad', nativoClassName)}\n data-searchcraft-ad-container-id={this.adContainerId}\n />\n );\n }\n\n render() {\n // Don't render ads if no search results\n if (this.searchResultCount === 0) {\n return;\n }\n\n switch (this.adSource) {\n case 'adMarketplace':\n return this.renderADMAd();\n case 'Custom':\n return this.renderCustomAd();\n case 'Nativo':\n return this.renderNativoAd();\n default:\n return;\n }\n }\n}\n"],"version":3}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { p as proxyCustomElement, H, h } from './p-5365011f.js';
|
|
2
|
+
|
|
3
|
+
const SearchcraftInputLabel = /*@__PURE__*/ proxyCustomElement(class SearchcraftInputLabel extends H {
|
|
4
|
+
constructor() {
|
|
5
|
+
super();
|
|
6
|
+
this.__registerHost();
|
|
7
|
+
}
|
|
8
|
+
label;
|
|
9
|
+
render() {
|
|
10
|
+
return (h("div", { key: '507cde7e8f74682d0535a65fbc787b18fa4c49f7', class: 'searchcraft-loading' }, h("div", { key: 'de8d4db44bd0d54baa276403063327b040a39ee4', class: 'searchcraft-loading-bars' }, h("div", { key: '3ef1ad066aef5582de0afe08c598747e48533f0a', class: 'searchcraft-loading-bar-1' }), h("div", { key: '0e9b5bfb8c031b1d788b0f39a63b1b325f123aad', class: 'searchcraft-loading-bar-2' }), h("div", { key: 'b342f47a3869301d17e66f0ae79cbea6b2a7ed41', class: 'searchcraft-loading-bar-3' }), h("div", { key: 'c11c58254a005b80c54b98f6713acb4c7f376a58', class: 'searchcraft-loading-bar-4' }), h("div", { key: 'c53ff4d003ed8e1d17fdc2ab8d61b2d3313dd5ac', class: 'searchcraft-loading-bar-5' }), h("div", { key: '3f517f20a24a844c04562cbb95b3a39502905405', class: 'searchcraft-loading-bar-6' })), h("p", { key: '11a63145472d8ded9d28bf7e9cfde9097e6a02e2', class: 'searchcraft-loading-label' }, this.label)));
|
|
11
|
+
}
|
|
12
|
+
}, [0, "searchcraft-loading", {
|
|
13
|
+
"label": [1]
|
|
14
|
+
}]);
|
|
15
|
+
function defineCustomElement() {
|
|
16
|
+
if (typeof customElements === "undefined") {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
const components = ["searchcraft-loading"];
|
|
20
|
+
components.forEach(tagName => { switch (tagName) {
|
|
21
|
+
case "searchcraft-loading":
|
|
22
|
+
if (!customElements.get(tagName)) {
|
|
23
|
+
customElements.define(tagName, SearchcraftInputLabel);
|
|
24
|
+
}
|
|
25
|
+
break;
|
|
26
|
+
} });
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export { SearchcraftInputLabel as S, defineCustomElement as d };
|
|
30
|
+
|
|
31
|
+
//# sourceMappingURL=p-919734fe.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"file":"p-919734fe.js","mappings":";;MAWa,qBAAqB;;;;;IACxB,KAAK,CAAU;IAEvB,MAAM;QACJ,QACE,4DAAK,KAAK,EAAC,qBAAqB,IAC9B,4DAAK,KAAK,EAAC,0BAA0B,IACnC,4DAAK,KAAK,EAAC,2BAA2B,GAAG,EACzC,4DAAK,KAAK,EAAC,2BAA2B,GAAG,EACzC,4DAAK,KAAK,EAAC,2BAA2B,GAAG,EACzC,4DAAK,KAAK,EAAC,2BAA2B,GAAG,EACzC,4DAAK,KAAK,EAAC,2BAA2B,GAAG,EACzC,4DAAK,KAAK,EAAC,2BAA2B,GAAG,CACrC,EACN,0DAAG,KAAK,EAAC,2BAA2B,IAAE,IAAI,CAAC,KAAK,CAAK,CACjD,EACN;KACH;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/searchcraft-loading/searchcraft-loading.tsx"],"sourcesContent":["import { Component, h, Prop } from '@stencil/core';\n\n/**\n * Renders a loading spinner/loading state for use in things like the summary box.\n *\n * @internal\n */\n@Component({\n tag: 'searchcraft-loading',\n shadow: false,\n})\nexport class SearchcraftInputLabel {\n @Prop() label?: string;\n\n render() {\n return (\n <div class='searchcraft-loading'>\n <div class='searchcraft-loading-bars'>\n <div class='searchcraft-loading-bar-1' />\n <div class='searchcraft-loading-bar-2' />\n <div class='searchcraft-loading-bar-3' />\n <div class='searchcraft-loading-bar-4' />\n <div class='searchcraft-loading-bar-5' />\n <div class='searchcraft-loading-bar-6' />\n </div>\n <p class='searchcraft-loading-label'>{this.label}</p>\n </div>\n );\n }\n}\n"],"version":3}
|