@searchcraft/javascript-sdk 0.8.2 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -37
- package/dist/components/defineCustomElements.d.ts +1 -0
- package/dist/components/defineCustomElements.js +46 -0
- package/dist/components/index.d.ts +44 -11
- package/dist/components/index.js +104 -53
- package/dist/components/index.js.map +1 -1
- package/dist/components/p-05872320.js +1462 -0
- package/dist/components/p-05872320.js.map +1 -0
- package/dist/components/{p-433f974c.js → p-11b05b94.js} +5 -5
- package/dist/components/p-11b05b94.js.map +1 -0
- package/dist/components/{p-6e2eef88.js → p-3026f7d3.js} +17 -126
- package/dist/components/p-3026f7d3.js.map +1 -0
- package/dist/components/{p-ec0d230e.js → p-3568414f.js} +4 -4
- package/dist/components/p-3568414f.js.map +1 -0
- package/dist/{cjs/SearchcraftStore-75fac5e0.js → components/p-6d8b0ead.js} +1408 -1350
- package/dist/components/p-6d8b0ead.js.map +1 -0
- package/dist/components/{p-fc7cda96.js → p-7777d986.js} +4 -4
- package/dist/components/{p-fc7cda96.js.map → p-7777d986.js.map} +1 -1
- package/dist/components/p-b0bc5cee.js +102 -0
- package/dist/components/p-b0bc5cee.js.map +1 -0
- package/dist/components/{p-4e9cd62e.js → p-bb12ab5a.js} +3 -3
- package/dist/components/{p-4e9cd62e.js.map → p-bb12ab5a.js.map} +1 -1
- package/dist/components/{p-97332d3e.js → p-cd9ba361.js} +3 -3
- package/dist/components/p-cd9ba361.js.map +1 -0
- package/dist/components/searchcraft-ad.d.ts +11 -0
- package/dist/components/searchcraft-ad.js +8 -0
- package/dist/components/searchcraft-ad.js.map +1 -0
- package/dist/components/searchcraft-base-search-result.js +1 -1
- package/dist/components/searchcraft-base-search-results.js +79 -29
- package/dist/components/searchcraft-base-search-results.js.map +1 -1
- package/dist/components/searchcraft-facet-list.js +1 -1
- package/dist/components/searchcraft-filter-panel.js +7 -7
- package/dist/components/searchcraft-filter-panel.js.map +1 -1
- package/dist/components/searchcraft-input-form.js +1 -1
- package/dist/components/searchcraft-pagination.js +2 -2
- package/dist/components/searchcraft-pagination.js.map +1 -1
- package/dist/components/searchcraft-popover-button.js +3 -3
- package/dist/components/searchcraft-popover-button.js.map +1 -1
- package/dist/components/searchcraft-popover-form.js +28 -35
- 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 +2 -2
- package/dist/components/searchcraft-results-info.js.map +1 -1
- package/dist/components/searchcraft-search-results-per-page.js +3 -3
- package/dist/components/searchcraft-search-results-per-page.js.map +1 -1
- package/dist/components/searchcraft-slider.js +1 -1
- package/dist/components/searchcraft-theme.js +1 -1
- package/dist/components/searchcraft-theme.js.map +1 -1
- package/dist/components/searchcraft-toggle-button.js +1 -1
- package/dist/types/components/searchcraft-ad/searchcraft-ad.d.ts +19 -0
- package/dist/types/components/searchcraft-base-search-results/searchcraft-base-search-results.d.ts +10 -7
- package/dist/types/components/searchcraft-facet-list/searchcraft-facet-list.d.ts +1 -1
- package/dist/types/components/searchcraft-input-form/searchcraft-input-form.d.ts +4 -29
- package/dist/types/components/searchcraft-popover-form/searchcraft-popover-form.d.ts +1 -11
- package/dist/types/components/searchcraft-popover-list-view/searchcraft-popover-list-view.d.ts +4 -0
- package/dist/types/components.d.ts +33 -158
- package/dist/types/index.d.ts +10 -1
- package/dist/types/store/SearchcraftStore.d.ts +4 -0
- package/dist/types/{provider → store}/SearchcraftStore.types.d.ts +2 -1
- package/dist/{collection/provider/store.js → types/store/index.d.ts} +2 -2
- package/package.json +8 -17
- package/dist/cjs/SearchcraftStore-75fac5e0.js.map +0 -1
- package/dist/cjs/app-globals-3a1e7e63.js +0 -7
- package/dist/cjs/app-globals-3a1e7e63.js.map +0 -1
- package/dist/cjs/index-5b0b9d4c.js +0 -84
- package/dist/cjs/index-5b0b9d4c.js.map +0 -1
- package/dist/cjs/index-a81df4f0.js +0 -1577
- package/dist/cjs/index-a81df4f0.js.map +0 -1
- package/dist/cjs/index.cjs.js +0 -14
- package/dist/cjs/index.cjs.js.map +0 -1
- package/dist/cjs/loader.cjs.js +0 -17
- package/dist/cjs/loader.cjs.js.map +0 -1
- package/dist/cjs/searchcraft-base-search-result_2.cjs.entry.js +0 -152
- package/dist/cjs/searchcraft-base-search-result_2.cjs.entry.js.map +0 -1
- package/dist/cjs/searchcraft-base-search-results.cjs.entry.js +0 -97
- package/dist/cjs/searchcraft-base-search-results.cjs.entry.js.map +0 -1
- package/dist/cjs/searchcraft-button_3.cjs.entry.js +0 -88
- package/dist/cjs/searchcraft-button_3.cjs.entry.js.map +0 -1
- package/dist/cjs/searchcraft-facet-list_3.cjs.entry.js +0 -393
- package/dist/cjs/searchcraft-facet-list_3.cjs.entry.js.map +0 -1
- package/dist/cjs/searchcraft-filter-panel.cjs.entry.js +0 -113
- package/dist/cjs/searchcraft-filter-panel.cjs.entry.js.map +0 -1
- package/dist/cjs/searchcraft-input-form_2.cjs.entry.js +0 -260
- package/dist/cjs/searchcraft-input-form_2.cjs.entry.js.map +0 -1
- package/dist/cjs/searchcraft-javascript-sdk.cjs.js +0 -27
- package/dist/cjs/searchcraft-javascript-sdk.cjs.js.map +0 -1
- package/dist/cjs/searchcraft-pagination.cjs.entry.js +0 -106
- package/dist/cjs/searchcraft-pagination.cjs.entry.js.map +0 -1
- package/dist/cjs/searchcraft-popover-button.cjs.entry.js +0 -22
- package/dist/cjs/searchcraft-popover-button.cjs.entry.js.map +0 -1
- package/dist/cjs/searchcraft-popover-form.cjs.entry.js +0 -234
- package/dist/cjs/searchcraft-popover-form.cjs.entry.js.map +0 -1
- package/dist/cjs/searchcraft-popover-list-item_2.cjs.entry.js +0 -101
- package/dist/cjs/searchcraft-popover-list-item_2.cjs.entry.js.map +0 -1
- package/dist/cjs/searchcraft-results-info.cjs.entry.js +0 -80
- package/dist/cjs/searchcraft-results-info.cjs.entry.js.map +0 -1
- package/dist/cjs/searchcraft-search-results-per-page.cjs.entry.js +0 -75
- package/dist/cjs/searchcraft-search-results-per-page.cjs.entry.js.map +0 -1
- package/dist/cjs/searchcraft-select.cjs.entry.js +0 -70
- package/dist/cjs/searchcraft-select.cjs.entry.js.map +0 -1
- package/dist/cjs/searchcraft-theme.cjs.entry.js +0 -56
- package/dist/cjs/searchcraft-theme.cjs.entry.js.map +0 -1
- package/dist/cjs/styles-7b2d06f2.js +0 -28
- package/dist/cjs/styles-7b2d06f2.js.map +0 -1
- package/dist/cjs/units-fe4d8083.js +0 -88
- package/dist/cjs/units-fe4d8083.js.map +0 -1
- package/dist/collection/collection-manifest.json +0 -32
- package/dist/collection/components/searchcraft-base-search-result/searchcraft-base-search-result.js +0 -302
- package/dist/collection/components/searchcraft-base-search-result/searchcraft-base-search-result.js.map +0 -1
- package/dist/collection/components/searchcraft-base-search-result-ad/searchcraft-base-search-result-ad.js +0 -73
- package/dist/collection/components/searchcraft-base-search-result-ad/searchcraft-base-search-result-ad.js.map +0 -1
- package/dist/collection/components/searchcraft-base-search-results/searchcraft-base-search-results.js +0 -313
- package/dist/collection/components/searchcraft-base-search-results/searchcraft-base-search-results.js.map +0 -1
- package/dist/collection/components/searchcraft-button/searchcraft-button.js +0 -217
- package/dist/collection/components/searchcraft-button/searchcraft-button.js.map +0 -1
- package/dist/collection/components/searchcraft-error-message/searchcraft-error-message.js +0 -44
- package/dist/collection/components/searchcraft-error-message/searchcraft-error-message.js.map +0 -1
- package/dist/collection/components/searchcraft-facet-list/searchcraft-facet-list.js +0 -200
- package/dist/collection/components/searchcraft-facet-list/searchcraft-facet-list.js.map +0 -1
- package/dist/collection/components/searchcraft-filter-panel/searchcraft-filter-panel.js +0 -149
- package/dist/collection/components/searchcraft-filter-panel/searchcraft-filter-panel.js.map +0 -1
- package/dist/collection/components/searchcraft-input-form/searchcraft-input-form.js +0 -443
- package/dist/collection/components/searchcraft-input-form/searchcraft-input-form.js.map +0 -1
- package/dist/collection/components/searchcraft-input-label/searchcraft-input-label.js +0 -67
- package/dist/collection/components/searchcraft-input-label/searchcraft-input-label.js.map +0 -1
- package/dist/collection/components/searchcraft-pagination/searchcraft-pagination.js +0 -141
- package/dist/collection/components/searchcraft-pagination/searchcraft-pagination.js.map +0 -1
- package/dist/collection/components/searchcraft-popover-button/searchcraft-popover-button.js +0 -15
- package/dist/collection/components/searchcraft-popover-button/searchcraft-popover-button.js.map +0 -1
- package/dist/collection/components/searchcraft-popover-form/searchcraft-popover-form.js +0 -381
- package/dist/collection/components/searchcraft-popover-form/searchcraft-popover-form.js.map +0 -1
- package/dist/collection/components/searchcraft-popover-list-item/searchcraft-popover-list-item.js +0 -128
- package/dist/collection/components/searchcraft-popover-list-item/searchcraft-popover-list-item.js.map +0 -1
- package/dist/collection/components/searchcraft-popover-list-item-ad/searchcraft-popover-list-item-ad.js +0 -73
- package/dist/collection/components/searchcraft-popover-list-item-ad/searchcraft-popover-list-item-ad.js.map +0 -1
- package/dist/collection/components/searchcraft-popover-list-view/searchcraft-popover-list-view.js +0 -141
- package/dist/collection/components/searchcraft-popover-list-view/searchcraft-popover-list-view.js.map +0 -1
- package/dist/collection/components/searchcraft-results-info/searchcraft-results-info.js +0 -138
- package/dist/collection/components/searchcraft-results-info/searchcraft-results-info.js.map +0 -1
- package/dist/collection/components/searchcraft-search-results-per-page/searchcraft-search-results-per-page.js +0 -129
- package/dist/collection/components/searchcraft-search-results-per-page/searchcraft-search-results-per-page.js.map +0 -1
- package/dist/collection/components/searchcraft-select/searchcraft-select.js +0 -261
- package/dist/collection/components/searchcraft-select/searchcraft-select.js.map +0 -1
- package/dist/collection/components/searchcraft-slider/searchcraft-slider.js +0 -194
- package/dist/collection/components/searchcraft-slider/searchcraft-slider.js.map +0 -1
- package/dist/collection/components/searchcraft-theme/searchcraft-theme.js +0 -97
- package/dist/collection/components/searchcraft-theme/searchcraft-theme.js.map +0 -1
- package/dist/collection/components/searchcraft-toggle-button/searchcraft-toggle-button.js +0 -118
- package/dist/collection/components/searchcraft-toggle-button/searchcraft-toggle-button.js.map +0 -1
- package/dist/collection/index.js +0 -3
- package/dist/collection/index.js.map +0 -1
- package/dist/collection/provider/SearchcraftStore.js +0 -160
- package/dist/collection/provider/SearchcraftStore.js.map +0 -1
- package/dist/collection/provider/SearchcraftStore.types.js +0 -2
- package/dist/collection/provider/SearchcraftStore.types.js.map +0 -1
- package/dist/collection/provider/store.js.map +0 -1
- package/dist/collection/utils/facets.js +0 -128
- package/dist/collection/utils/facets.js.map +0 -1
- package/dist/collection/utils/index.js +0 -4
- package/dist/collection/utils/index.js.map +0 -1
- package/dist/collection/utils/styles.js +0 -22
- package/dist/collection/utils/styles.js.map +0 -1
- package/dist/collection/utils/units.js +0 -83
- package/dist/collection/utils/units.js.map +0 -1
- package/dist/components/p-25ee7496.js +0 -58
- package/dist/components/p-25ee7496.js.map +0 -1
- package/dist/components/p-38419178.js +0 -1625
- package/dist/components/p-38419178.js.map +0 -1
- package/dist/components/p-433f974c.js.map +0 -1
- package/dist/components/p-6e2eef88.js.map +0 -1
- package/dist/components/p-97332d3e.js.map +0 -1
- package/dist/components/p-bff4d3fc.js +0 -65
- package/dist/components/p-bff4d3fc.js.map +0 -1
- package/dist/components/p-de4a48b1.js +0 -65
- package/dist/components/p-de4a48b1.js.map +0 -1
- package/dist/components/p-ec0d230e.js.map +0 -1
- package/dist/components/searchcraft-base-search-result-ad.d.ts +0 -11
- package/dist/components/searchcraft-base-search-result-ad.js +0 -8
- package/dist/components/searchcraft-base-search-result-ad.js.map +0 -1
- package/dist/components/searchcraft-popover-list-item-ad.d.ts +0 -11
- package/dist/components/searchcraft-popover-list-item-ad.js +0 -8
- package/dist/components/searchcraft-popover-list-item-ad.js.map +0 -1
- package/dist/esm/SearchcraftStore-3cfd565a.js +0 -1625
- package/dist/esm/SearchcraftStore-3cfd565a.js.map +0 -1
- package/dist/esm/app-globals-0f993ce5.js +0 -5
- package/dist/esm/app-globals-0f993ce5.js.map +0 -1
- package/dist/esm/index-3608c57d.js +0 -1548
- package/dist/esm/index-3608c57d.js.map +0 -1
- package/dist/esm/index-72ac5051.js +0 -82
- package/dist/esm/index-72ac5051.js.map +0 -1
- package/dist/esm/index.js +0 -4
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/loader.js +0 -13
- package/dist/esm/loader.js.map +0 -1
- package/dist/esm/searchcraft-base-search-result_2.entry.js +0 -147
- package/dist/esm/searchcraft-base-search-result_2.entry.js.map +0 -1
- package/dist/esm/searchcraft-base-search-results.entry.js +0 -93
- package/dist/esm/searchcraft-base-search-results.entry.js.map +0 -1
- package/dist/esm/searchcraft-button_3.entry.js +0 -82
- package/dist/esm/searchcraft-button_3.entry.js.map +0 -1
- package/dist/esm/searchcraft-facet-list_3.entry.js +0 -387
- package/dist/esm/searchcraft-facet-list_3.entry.js.map +0 -1
- package/dist/esm/searchcraft-filter-panel.entry.js +0 -109
- package/dist/esm/searchcraft-filter-panel.entry.js.map +0 -1
- package/dist/esm/searchcraft-input-form_2.entry.js +0 -255
- package/dist/esm/searchcraft-input-form_2.entry.js.map +0 -1
- package/dist/esm/searchcraft-javascript-sdk.js +0 -22
- package/dist/esm/searchcraft-javascript-sdk.js.map +0 -1
- package/dist/esm/searchcraft-pagination.entry.js +0 -102
- package/dist/esm/searchcraft-pagination.entry.js.map +0 -1
- package/dist/esm/searchcraft-popover-button.entry.js +0 -18
- package/dist/esm/searchcraft-popover-button.entry.js.map +0 -1
- package/dist/esm/searchcraft-popover-form.entry.js +0 -230
- package/dist/esm/searchcraft-popover-form.entry.js.map +0 -1
- package/dist/esm/searchcraft-popover-list-item_2.entry.js +0 -96
- package/dist/esm/searchcraft-popover-list-item_2.entry.js.map +0 -1
- package/dist/esm/searchcraft-results-info.entry.js +0 -76
- package/dist/esm/searchcraft-results-info.entry.js.map +0 -1
- package/dist/esm/searchcraft-search-results-per-page.entry.js +0 -71
- package/dist/esm/searchcraft-search-results-per-page.entry.js.map +0 -1
- package/dist/esm/searchcraft-select.entry.js +0 -66
- package/dist/esm/searchcraft-select.entry.js.map +0 -1
- package/dist/esm/searchcraft-theme.entry.js +0 -52
- package/dist/esm/searchcraft-theme.entry.js.map +0 -1
- package/dist/esm/styles-961644ef.js +0 -25
- package/dist/esm/styles-961644ef.js.map +0 -1
- package/dist/esm/units-daaf96f5.js +0 -84
- package/dist/esm/units-daaf96f5.js.map +0 -1
- package/dist/index.cjs.js +0 -1
- package/dist/index.js +0 -1
- package/dist/loader/cdn.js +0 -1
- package/dist/loader/index.cjs.js +0 -1
- package/dist/loader/index.d.ts +0 -24
- package/dist/loader/index.es2017.js +0 -1
- package/dist/loader/index.js +0 -2
- package/dist/loader/package.json +0 -11
- package/dist/searchcraft-javascript-sdk/index.esm.js +0 -2
- package/dist/searchcraft-javascript-sdk/index.esm.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-279f3e15.entry.js +0 -2
- package/dist/searchcraft-javascript-sdk/p-279f3e15.entry.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-2bc82b48.entry.js +0 -2
- package/dist/searchcraft-javascript-sdk/p-2bc82b48.entry.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-2dc07b47.entry.js +0 -2
- package/dist/searchcraft-javascript-sdk/p-2dc07b47.entry.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-37842dee.entry.js +0 -2
- package/dist/searchcraft-javascript-sdk/p-37842dee.entry.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-38419178.js +0 -11
- package/dist/searchcraft-javascript-sdk/p-38419178.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-3be70f20.entry.js +0 -2
- package/dist/searchcraft-javascript-sdk/p-3be70f20.entry.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-5cdc6210.js +0 -7
- package/dist/searchcraft-javascript-sdk/p-5cdc6210.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-5e064c07.entry.js +0 -2
- package/dist/searchcraft-javascript-sdk/p-5e064c07.entry.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-6104fe5d.js +0 -2
- package/dist/searchcraft-javascript-sdk/p-6104fe5d.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-6bffd3f5.entry.js +0 -2
- package/dist/searchcraft-javascript-sdk/p-6bffd3f5.entry.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-7813f3cc.entry.js +0 -2
- package/dist/searchcraft-javascript-sdk/p-7813f3cc.entry.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-7e13c128.js +0 -3
- package/dist/searchcraft-javascript-sdk/p-7e13c128.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-7f4dd50c.entry.js +0 -2
- package/dist/searchcraft-javascript-sdk/p-7f4dd50c.entry.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-9340f4e4.entry.js +0 -2
- package/dist/searchcraft-javascript-sdk/p-9340f4e4.entry.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-a84b1548.entry.js +0 -2
- package/dist/searchcraft-javascript-sdk/p-a84b1548.entry.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-b8ea0454.entry.js +0 -2
- package/dist/searchcraft-javascript-sdk/p-b8ea0454.entry.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-c4a9d8ab.entry.js +0 -2
- package/dist/searchcraft-javascript-sdk/p-c4a9d8ab.entry.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-d9551738.js +0 -2
- package/dist/searchcraft-javascript-sdk/p-d9551738.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-e11de2d6.entry.js +0 -2
- package/dist/searchcraft-javascript-sdk/p-e11de2d6.entry.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-e1255160.js +0 -2
- package/dist/searchcraft-javascript-sdk/p-e1255160.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/searchcraft-javascript-sdk.esm.js +0 -2
- package/dist/searchcraft-javascript-sdk/searchcraft-javascript-sdk.esm.js.map +0 -1
- package/dist/types/components/searchcraft-base-search-result-ad/searchcraft-base-search-result-ad.d.ts +0 -14
- package/dist/types/components/searchcraft-popover-list-item-ad/searchcraft-popover-list-item-ad.d.ts +0 -14
- package/dist/types/provider/SearchcraftStore.d.ts +0 -4
- package/dist/types/provider/store.d.ts +0 -3
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
const index = require('./index-a81df4f0.js');
|
|
6
|
-
const SearchcraftStore = require('./SearchcraftStore-75fac5e0.js');
|
|
7
|
-
const units = require('./units-fe4d8083.js');
|
|
8
|
-
|
|
9
|
-
const SearchcraftBaseSearchResult = class {
|
|
10
|
-
constructor(hostRef) {
|
|
11
|
-
index.registerInstance(this, hostRef);
|
|
12
|
-
}
|
|
13
|
-
item;
|
|
14
|
-
searchResultMappings;
|
|
15
|
-
/**
|
|
16
|
-
* Where to open the link for the containing element.
|
|
17
|
-
*/
|
|
18
|
-
containerTarget = '_blank';
|
|
19
|
-
/**
|
|
20
|
-
* The relationship between the current document and the link for the containing element.
|
|
21
|
-
*/
|
|
22
|
-
containerRel;
|
|
23
|
-
/**
|
|
24
|
-
* Where to open the link for the button rendered when containerHref is not present.
|
|
25
|
-
*/
|
|
26
|
-
buttonTarget = '_blank';
|
|
27
|
-
/**
|
|
28
|
-
* The relationship between the current document and the link for the button rendered when containerHref is not present.
|
|
29
|
-
*/
|
|
30
|
-
buttonRel;
|
|
31
|
-
/**
|
|
32
|
-
* The placement of the image.
|
|
33
|
-
*/
|
|
34
|
-
imagePlacement = 'right';
|
|
35
|
-
/**
|
|
36
|
-
* A custom styles object.
|
|
37
|
-
*/
|
|
38
|
-
customStyles;
|
|
39
|
-
/**
|
|
40
|
-
* The position in the document. Used with the "document_clicked" measure event.
|
|
41
|
-
*/
|
|
42
|
-
documentPosition = 0;
|
|
43
|
-
titleContent;
|
|
44
|
-
subtitleContent;
|
|
45
|
-
bodyContent;
|
|
46
|
-
footerContent;
|
|
47
|
-
buttonLabel;
|
|
48
|
-
buttonHref;
|
|
49
|
-
containerHref;
|
|
50
|
-
imageSrc;
|
|
51
|
-
imageAlt;
|
|
52
|
-
searchcraftStore = SearchcraftStore.useSearchcraftStore.getState();
|
|
53
|
-
connectedCallback() {
|
|
54
|
-
if (this.item) {
|
|
55
|
-
this.mapValuesFromDocument(this.item.document);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
mapValuesFromDocument(document) {
|
|
59
|
-
this.titleContent = units.getDocumentValueFromSearchResultMapping(document, this.searchResultMappings?.title);
|
|
60
|
-
this.subtitleContent = units.getDocumentValueFromSearchResultMapping(document, this.searchResultMappings?.subtitle);
|
|
61
|
-
this.bodyContent = units.getDocumentValueFromSearchResultMapping(document, this.searchResultMappings?.body);
|
|
62
|
-
this.containerHref = units.getDocumentValueFromSearchResultMapping(document, this.searchResultMappings?.containerHref);
|
|
63
|
-
this.buttonHref = units.getDocumentValueFromSearchResultMapping(document, this.searchResultMappings?.buttonHref);
|
|
64
|
-
this.imageSrc = units.getDocumentValueFromSearchResultMapping(document, this.searchResultMappings?.imageSource);
|
|
65
|
-
this.footerContent = units.getDocumentValueFromSearchResultMapping(document, this.searchResultMappings?.footer);
|
|
66
|
-
}
|
|
67
|
-
handleLinkClick = () => {
|
|
68
|
-
const searchcraft = this.searchcraftStore.getSearchcraftInstance();
|
|
69
|
-
if (searchcraft) {
|
|
70
|
-
const document_position = this.documentPosition;
|
|
71
|
-
const search_term = this.searchcraftStore.searchTerm;
|
|
72
|
-
const number_of_documents = this.searchcraftStore.searchClientResponseItems.length;
|
|
73
|
-
searchcraft.measureClient?.sendMeasureEvent('document_clicked', {
|
|
74
|
-
document_position,
|
|
75
|
-
number_of_documents,
|
|
76
|
-
search_term,
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
};
|
|
80
|
-
parseStyles = () => {
|
|
81
|
-
if (this.customStyles) {
|
|
82
|
-
try {
|
|
83
|
-
return JSON.parse(this.customStyles);
|
|
84
|
-
}
|
|
85
|
-
catch (error) {
|
|
86
|
-
console.error('Error parsing custom styles:', error);
|
|
87
|
-
return {};
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
return {};
|
|
91
|
-
};
|
|
92
|
-
render() {
|
|
93
|
-
const styles = this.parseStyles();
|
|
94
|
-
const imageContainer = this.imageSrc && (index.h("img", { alt: this.imageAlt, class: 'searchcraft-search-result-image', src: this.imageSrc, style: styles.image || {} }));
|
|
95
|
-
const contentContainer = (index.h(index.Fragment, null, this.imageSrc && this.imagePlacement === 'left' && imageContainer, index.h("div", { class: 'searchcraft-base-search-result-content-container' }, this.titleContent && (index.h("h2", { class: 'searchcraft-base-search-result-title', style: styles.title || {} }, this.titleContent)), this.subtitleContent && (index.h("h3", { class: 'searchcraft-base-search-result-subtitle', style: styles.subtitle || {} }, this.subtitleContent)), this.bodyContent && (index.h("p", { class: 'searchcraft-base-search-result-body-content', style: styles.primaryContent || {} }, this.bodyContent)), this.footerContent && (index.h("p", { class: 'searchcraft-base-search-result-footer-content', style: styles.secondaryContent || {} }, this.footerContent)), this.buttonHref && !this.containerHref && this.buttonLabel && (index.h("a", { class: 'searchcraft-search-result-button', href: this.buttonHref, style: styles.button || {}, target: this.buttonTarget, rel: this.buttonRel }, this.buttonLabel))), this.imageSrc && this.imagePlacement === 'right' && imageContainer));
|
|
96
|
-
/** Render as an anchor tag if the containerHref prop is present. */
|
|
97
|
-
if (this.containerHref) {
|
|
98
|
-
return (index.h("a", { class: 'searchcraft-search-result-container', onClick: this.handleLinkClick, href: this.containerHref, rel: this.containerRel, style: styles.container || {}, tabindex: '0', target: this.containerTarget }, contentContainer));
|
|
99
|
-
}
|
|
100
|
-
/** Render as a div if no href prop. */
|
|
101
|
-
return (index.h("div", { class: 'searchcraft-search-result-container', style: styles.container || {} }, contentContainer));
|
|
102
|
-
}
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
const SearchcraftBaseSearchResultAd = class {
|
|
106
|
-
constructor(hostRef) {
|
|
107
|
-
index.registerInstance(this, hostRef);
|
|
108
|
-
}
|
|
109
|
-
adClientResponseItem;
|
|
110
|
-
connectedCallback() {
|
|
111
|
-
if (this.adClientResponseItem?.admAd?.impression_url) {
|
|
112
|
-
fetch(this.adClientResponseItem?.admAd?.impression_url);
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
renderADMProductAd() {
|
|
116
|
-
const ad = this.adClientResponseItem?.admAd;
|
|
117
|
-
if (!ad) {
|
|
118
|
-
return;
|
|
119
|
-
}
|
|
120
|
-
return (index.h("a", { class: 'searchcraft-base-ad', href: ad.click_url }, ad.image_url && (index.h("div", { class: 'searchcraft-base-ad-image-wrapper' }, index.h("img", { alt: ad.term, src: ad.image_url, class: 'searchcraft-base-ad-image' }))), index.h("div", { class: 'searchcraft-base-ad-info-wrapper' }, index.h("p", { class: 'searchcraft-base-ad-title' }, ad.term), index.h("p", { class: 'searchcraft-base-ad-subtitle' }, ad.price))));
|
|
121
|
-
}
|
|
122
|
-
renderADMTextAd() {
|
|
123
|
-
const ad = this.adClientResponseItem?.admAd;
|
|
124
|
-
if (!ad) {
|
|
125
|
-
return;
|
|
126
|
-
}
|
|
127
|
-
return (index.h("a", { class: 'searchcraft-base-ad', href: ad.click_url }, ad.image_url && (index.h("div", { class: 'searchcraft-base-ad-image-wrapper' }, index.h("img", { alt: ad.term, src: ad.image_url, class: 'searchcraft-base-ad-image' }))), index.h("div", { class: 'searchcraft-base-ad-info-wrapper' }, index.h("p", { class: 'searchcraft-base-ad-title' }, ad.term))));
|
|
128
|
-
}
|
|
129
|
-
renderNativoAd() { }
|
|
130
|
-
renderAdPlaceholder() {
|
|
131
|
-
return index.h("p", null, "Ad placeholder");
|
|
132
|
-
// return;
|
|
133
|
-
}
|
|
134
|
-
render() {
|
|
135
|
-
if (!this.adClientResponseItem) {
|
|
136
|
-
return this.renderAdPlaceholder();
|
|
137
|
-
}
|
|
138
|
-
switch (this.adClientResponseItem.type) {
|
|
139
|
-
case 'adm-product-ad':
|
|
140
|
-
return this.renderADMProductAd();
|
|
141
|
-
case 'adm-text-ad':
|
|
142
|
-
return this.renderADMTextAd();
|
|
143
|
-
case 'nativo-ad':
|
|
144
|
-
return this.renderNativoAd();
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
};
|
|
148
|
-
|
|
149
|
-
exports.searchcraft_base_search_result = SearchcraftBaseSearchResult;
|
|
150
|
-
exports.searchcraft_base_search_result_ad = SearchcraftBaseSearchResultAd;
|
|
151
|
-
|
|
152
|
-
//# sourceMappingURL=searchcraft-base-search-result_2.cjs.entry.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"file":"searchcraft-base-search-result.searchcraft-base-search-result-ad.entry.cjs.js","mappings":";;;;;;;;MAkBa,2BAA2B;;;;IAC9B,IAAI,CAAuC;IAC3C,oBAAoB,CAAmC;;;;IAIvD,eAAe,GAA4C,QAAQ,CAAC;;;;IAIpE,YAAY,CAAqD;;;;IAIjE,YAAY,GAA4C,QAAQ,CAAC;;;;IAIjE,SAAS,CAAqD;;;;IAI9D,cAAc,GAAqB,OAAO,CAAC;;;;IAI3C,YAAY,CAAqB;;;;IAIjC,gBAAgB,GAAG,CAAC,CAAC;IAEpB,YAAY,CAAqB;IACjC,eAAe,CAAqB;IACpC,WAAW,CAAqB;IAChC,aAAa,CAAqB;IAClC,WAAW,CAAqB;IAChC,UAAU,CAAqB;IAC/B,aAAa,CAAqB;IAClC,QAAQ,CAAqB;IAC7B,QAAQ,CAAqB;IAE9B,gBAAgB,GAAGA,oCAAmB,CAAC,QAAQ,EAAE,CAAC;IAE1D,iBAAiB;QACf,IAAI,IAAI,CAAC,IAAI,EAAE;YACb,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;SAChD;KACF;IAED,qBAAqB,CAAC,QAAwB;QAC5C,IAAI,CAAC,YAAY,GAAGC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AAc,EAAE,CAAC;SAChC;KACF;;;;;;","names":["useSearchcraftStore","getDocumentValueFromSearchResultMapping","h","Fragment"],"sources":["src/components/searchcraft-base-search-result/searchcraft-base-search-result.tsx","src/components/searchcraft-base-search-result-ad/searchcraft-base-search-result-ad.tsx"],"sourcesContent":["import { useSearchcraftStore } from '@provider/store';\nimport type {\n SearchClientResponseItem,\n SearchDocument,\n} from '@searchcraft/core';\nimport { Component, Fragment, h, Prop, State } from '@stencil/core';\nimport { getDocumentValueFromSearchResultMapping } from '@utils';\nimport type { SearchResultMappings } from '@searchcraft/core';\n\n/**\n * This web component is designed to display detailed information for a single search result.\n * Once a query is submitted, the component formats and presents the result.\n * It is consumed within the `searchcraft-base-search-results` component.\n */\n@Component({\n tag: 'searchcraft-base-search-result',\n shadow: false,\n})\nexport class SearchcraftBaseSearchResult {\n @Prop() item: SearchClientResponseItem | undefined;\n @Prop() searchResultMappings: SearchResultMappings | undefined;\n /**\n * Where to open the link for the containing element.\n */\n @Prop() containerTarget: '_blank' | '_self' | '_top' | '_parent' = '_blank';\n /**\n * The relationship between the current document and the link for the containing element.\n */\n @Prop() containerRel: 'noreferrer' | 'noopener' | 'nofollow' | undefined;\n /**\n * Where to open the link for the button rendered when containerHref is not present.\n */\n @Prop() buttonTarget: '_blank' | '_self' | '_top' | '_parent' = '_blank';\n /**\n * The relationship between the current document and the link for the button rendered when containerHref is not present.\n */\n @Prop() buttonRel: 'noreferrer' | 'noopener' | 'nofollow' | undefined;\n /**\n * The placement of the image.\n */\n @Prop() imagePlacement: 'left' | 'right' = 'right';\n /**\n * A custom styles object.\n */\n @Prop() customStyles: string | undefined;\n /**\n * The position in the document. Used with the \"document_clicked\" measure event.\n */\n @Prop() documentPosition = 0;\n\n @State() titleContent: string | undefined;\n @State() subtitleContent: string | undefined;\n @State() bodyContent: string | undefined;\n @State() footerContent: string | undefined;\n @State() buttonLabel: string | undefined;\n @State() buttonHref: string | undefined;\n @State() containerHref: string | undefined;\n @State() imageSrc: string | undefined;\n @State() imageAlt: string | undefined;\n\n private searchcraftStore = useSearchcraftStore.getState();\n\n connectedCallback() {\n if (this.item) {\n this.mapValuesFromDocument(this.item.document);\n }\n }\n\n mapValuesFromDocument(document: SearchDocument) {\n this.titleContent = getDocumentValueFromSearchResultMapping(\n document,\n this.searchResultMappings?.title,\n );\n this.subtitleContent = getDocumentValueFromSearchResultMapping(\n document,\n this.searchResultMappings?.subtitle,\n );\n this.bodyContent = getDocumentValueFromSearchResultMapping(\n document,\n this.searchResultMappings?.body,\n );\n this.containerHref = getDocumentValueFromSearchResultMapping(\n document,\n this.searchResultMappings?.containerHref,\n );\n this.buttonHref = getDocumentValueFromSearchResultMapping(\n document,\n this.searchResultMappings?.buttonHref,\n );\n this.imageSrc = getDocumentValueFromSearchResultMapping(\n document,\n this.searchResultMappings?.imageSource,\n );\n this.footerContent = getDocumentValueFromSearchResultMapping(\n document,\n this.searchResultMappings?.footer,\n );\n }\n\n private handleLinkClick = () => {\n const searchcraft = this.searchcraftStore.getSearchcraftInstance();\n\n if (searchcraft) {\n const document_position = this.documentPosition;\n const search_term = this.searchcraftStore.searchTerm;\n const number_of_documents =\n this.searchcraftStore.searchClientResponseItems.length;\n\n searchcraft.measureClient?.sendMeasureEvent('document_clicked', {\n document_position,\n number_of_documents,\n search_term,\n });\n }\n };\n\n private parseStyles = (): Record<string, { [key: string]: string }> => {\n if (this.customStyles) {\n try {\n return JSON.parse(this.customStyles);\n } catch (error) {\n console.error('Error parsing custom styles:', error);\n return {};\n }\n }\n return {};\n };\n\n render() {\n const styles = this.parseStyles();\n const imageContainer = this.imageSrc && (\n <img\n alt={this.imageAlt}\n class='searchcraft-search-result-image'\n src={this.imageSrc}\n style={styles.image || {}}\n />\n );\n\n const contentContainer = (\n <Fragment>\n {this.imageSrc && this.imagePlacement === 'left' && imageContainer}\n <div class='searchcraft-base-search-result-content-container'>\n {this.titleContent && (\n <h2\n class='searchcraft-base-search-result-title'\n style={styles.title || {}}\n >\n {this.titleContent}\n </h2>\n )}\n {this.subtitleContent && (\n <h3\n class='searchcraft-base-search-result-subtitle'\n style={styles.subtitle || {}}\n >\n {this.subtitleContent}\n </h3>\n )}\n {this.bodyContent && (\n <p\n class='searchcraft-base-search-result-body-content'\n style={styles.primaryContent || {}}\n >\n {this.bodyContent}\n </p>\n )}\n\n {this.footerContent && (\n <p\n class='searchcraft-base-search-result-footer-content'\n style={styles.secondaryContent || {}}\n >\n {this.footerContent}\n </p>\n )}\n {this.buttonHref && !this.containerHref && this.buttonLabel && (\n <a\n class='searchcraft-search-result-button'\n href={this.buttonHref}\n style={styles.button || {}}\n target={this.buttonTarget}\n rel={this.buttonRel}\n >\n {this.buttonLabel}\n </a>\n )}\n </div>\n {this.imageSrc && this.imagePlacement === 'right' && imageContainer}\n </Fragment>\n );\n\n /** Render as an anchor tag if the containerHref prop is present. */\n if (this.containerHref) {\n return (\n <a\n class='searchcraft-search-result-container'\n onClick={this.handleLinkClick}\n href={this.containerHref}\n rel={this.containerRel}\n style={styles.container || {}}\n tabindex='0'\n target={this.containerTarget}\n >\n {contentContainer}\n </a>\n );\n }\n\n /** Render as a div if no href prop. */\n return (\n <div\n class='searchcraft-search-result-container'\n style={styles.container || {}}\n >\n {contentContainer}\n </div>\n );\n }\n}\n","import type {\n AdClientResponseItem,\n ADMProductAd,\n ADMTextAd,\n} from '@searchcraft/core';\nimport { Component, h, Prop } from '@stencil/core';\n\n/**\n * A single list item rendered in a searchcraft-popover-list-view.\n */\n@Component({\n tag: 'searchcraft-base-search-result-ad',\n shadow: false,\n})\nexport class SearchcraftBaseSearchResultAd {\n @Prop() adClientResponseItem?: AdClientResponseItem;\n\n connectedCallback() {\n if (this.adClientResponseItem?.admAd?.impression_url) {\n fetch(this.adClientResponseItem?.admAd?.impression_url);\n }\n }\n\n renderADMProductAd() {\n const ad = this.adClientResponseItem?.admAd as ADMProductAd;\n if (!ad) {\n return;\n }\n\n return (\n <a class='searchcraft-base-ad' href={ad.click_url}>\n {ad.image_url && (\n <div class='searchcraft-base-ad-image-wrapper'>\n <img\n alt={ad.term}\n src={ad.image_url}\n class='searchcraft-base-ad-image'\n />\n </div>\n )}\n <div class='searchcraft-base-ad-info-wrapper'>\n <p class='searchcraft-base-ad-title'>{ad.term}</p>\n <p class='searchcraft-base-ad-subtitle'>{ad.price}</p>\n </div>\n </a>\n );\n }\n\n renderADMTextAd() {\n const ad = this.adClientResponseItem?.admAd as ADMTextAd;\n if (!ad) {\n return;\n }\n\n return (\n <a class='searchcraft-base-ad' href={ad.click_url}>\n {ad.image_url && (\n <div class='searchcraft-base-ad-image-wrapper'>\n <img\n alt={ad.term}\n src={ad.image_url}\n class='searchcraft-base-ad-image'\n />\n </div>\n )}\n <div class='searchcraft-base-ad-info-wrapper'>\n <p class='searchcraft-base-ad-title'>{ad.term}</p>\n </div>\n </a>\n );\n }\n\n renderNativoAd() {}\n\n renderAdPlaceholder() {\n return <p>Ad placeholder</p>;\n // return;\n }\n\n render() {\n if (!this.adClientResponseItem) {\n return this.renderAdPlaceholder();\n }\n\n switch (this.adClientResponseItem.type) {\n case 'adm-product-ad':\n return this.renderADMProductAd();\n case 'adm-text-ad':\n return this.renderADMTextAd();\n case 'nativo-ad':\n return this.renderNativoAd();\n }\n }\n}\n"],"version":3}
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
const index = require('./index-a81df4f0.js');
|
|
6
|
-
const SearchcraftStore = require('./SearchcraftStore-75fac5e0.js');
|
|
7
|
-
const styles = require('./styles-7b2d06f2.js');
|
|
8
|
-
|
|
9
|
-
const SearchcraftBaseSearchResults = class {
|
|
10
|
-
constructor(hostRef) {
|
|
11
|
-
index.registerInstance(this, hostRef);
|
|
12
|
-
this.noResults = index.createEvent(this, "noResults", 7);
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* A custom styles object.
|
|
16
|
-
*/
|
|
17
|
-
customStylesForResults;
|
|
18
|
-
/**
|
|
19
|
-
* Formats the content rendered for each result.
|
|
20
|
-
*/
|
|
21
|
-
searchResultMappings;
|
|
22
|
-
/**
|
|
23
|
-
* The placement of the image for each result.
|
|
24
|
-
*/
|
|
25
|
-
resultImagePlacement = 'right';
|
|
26
|
-
/**
|
|
27
|
-
* The label for the button rendered when containerHref is not present for each result.
|
|
28
|
-
*/
|
|
29
|
-
buttonLabel;
|
|
30
|
-
/**
|
|
31
|
-
* Where to open the link for the button rendered when containerHref is not present for each result.
|
|
32
|
-
*/
|
|
33
|
-
buttonTarget = '_blank';
|
|
34
|
-
/**
|
|
35
|
-
* The relationship between the current document and the link for the button rendered when containerHref is not present for each result.
|
|
36
|
-
*/
|
|
37
|
-
buttonRel;
|
|
38
|
-
/**
|
|
39
|
-
* Where to open the link for the containing element for each result.
|
|
40
|
-
*/
|
|
41
|
-
containerTarget = '_blank';
|
|
42
|
-
/**
|
|
43
|
-
* The relationship between the current document and the link for the containing element for each result.
|
|
44
|
-
*/
|
|
45
|
-
containerRel;
|
|
46
|
-
/**
|
|
47
|
-
* When no results are returned.
|
|
48
|
-
*/
|
|
49
|
-
noResults;
|
|
50
|
-
searchTerm = '';
|
|
51
|
-
searchClientResponseItems = [];
|
|
52
|
-
adClientResponseItems = [];
|
|
53
|
-
searchResultsPerPage;
|
|
54
|
-
searchResultsPage;
|
|
55
|
-
unsubscribe = () => { };
|
|
56
|
-
componentDidLoad() {
|
|
57
|
-
this.unsubscribe = SearchcraftStore.useSearchcraftStore.subscribe((state) => this.handleStateChange(state));
|
|
58
|
-
const currentState = SearchcraftStore.useSearchcraftStore.getState();
|
|
59
|
-
this.searchClientResponseItems = currentState.searchClientResponseItems;
|
|
60
|
-
this.searchTerm = currentState.searchTerm;
|
|
61
|
-
}
|
|
62
|
-
disconnectedCallback() {
|
|
63
|
-
this.unsubscribe?.();
|
|
64
|
-
}
|
|
65
|
-
handleStateChange(state) {
|
|
66
|
-
this.searchClientResponseItems = [...state.searchClientResponseItems];
|
|
67
|
-
this.adClientResponseItems = [...state.adClientResponseItems];
|
|
68
|
-
this.searchTerm = state.searchTerm;
|
|
69
|
-
this.searchResultsPage = state.searchResultsPage;
|
|
70
|
-
this.searchResultsPerPage = state.searchResultsPerPage;
|
|
71
|
-
}
|
|
72
|
-
render() {
|
|
73
|
-
if (this.searchTerm.trim() === '') {
|
|
74
|
-
return (index.h("div", { class: 'searchcraft-search-results-empty-state-container' }, index.h("slot", { name: 'empty-search' })));
|
|
75
|
-
}
|
|
76
|
-
if (this.searchClientResponseItems.length === 0) {
|
|
77
|
-
return;
|
|
78
|
-
}
|
|
79
|
-
if (this.searchTerm.length > 0 &&
|
|
80
|
-
this.searchClientResponseItems.length === 0) {
|
|
81
|
-
this.noResults?.emit();
|
|
82
|
-
}
|
|
83
|
-
let serializedStyles = '';
|
|
84
|
-
if (this.customStylesForResults) {
|
|
85
|
-
serializedStyles =
|
|
86
|
-
typeof this.customStylesForResults === 'string'
|
|
87
|
-
? this.customStylesForResults
|
|
88
|
-
: styles.serializeStyles(this.customStylesForResults);
|
|
89
|
-
}
|
|
90
|
-
return (index.h("div", { class: 'searchcraft-search-results-container' }, this.adClientResponseItems?.map((item) => (index.h("searchcraft-base-search-result-ad", { adClientResponseItem: item, key: item.adId }))), this.searchClientResponseItems?.map((item, index$1) => (index.h("searchcraft-base-search-result", { key: item.id, "custom-styles": serializedStyles, "image-placement": this.resultImagePlacement, "container-rel": this.containerRel, "container-target": this.containerTarget, "button-label": this.buttonLabel || 'View more', "button-rel": this.buttonRel, "button-target": this.buttonTarget, "document-position": this.searchResultsPerPage * this.searchResultsPage + index$1, searchResultMappings: this.searchResultMappings, item: item }))), this.searchTerm.length > 0 &&
|
|
91
|
-
this.searchClientResponseItems.length === 0 && (index.h("div", { class: 'searchcraft-search-results-error-message-container' }, index.h("searchcraft-error-message", { "error-message": `No search results found for "${this.searchTerm}" query` })))));
|
|
92
|
-
}
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
exports.searchcraft_base_search_results = SearchcraftBaseSearchResults;
|
|
96
|
-
|
|
97
|
-
//# sourceMappingURL=searchcraft-base-search-results.cjs.entry.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"file":"searchcraft-base-search-results.entry.cjs.js","mappings":";;;;;;;;MAuDa,4BAA4B;;;;;;;;IAI/B,sBAAsB,CAGhB;;;;IAIN,oBAAoB,CAAmC;;;;IAIvD,oBAAoB,GAAqB,OAAO,CAAC;;;;IAIjD,WAAW,CAAqB;;;;IAIhC,YAAY,GAA4C,QAAQ,CAAC;;;;IAIjE,SAAS,CAAqD;;;;IAI9D,eAAe,GAA4C,QAAQ,CAAC;;;;IAIpE,YAAY,CAAqD;;;;IAKhE,SAAS,CAAsB;IAE/B,UAAU,GAAG,EAAE,CAAC;IAChB,yBAAyB,GAA+B,EAAE,CAAC;IAC3D,qBAAqB,GAA2B,EAAE,CAAC;IACnD,oBAAoB,CAAC;IACrB,iBAAiB,CAAC;IAEnB,WAAW,GAAe,SAAQ,CAAC;IAE3C,gBAAgB;QACd,IAAI,CAAC,WAAW,GAAGA,oCAAmB,CAAC,SAAS,CAAC,CAAC,KAAK,KACrD,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAC9B,CAAC;QACF,MAAM,YAAY,GAAGA,oCAAmB,CAAC,QAAQ,EAAE,CAAC;QACpD,IAAI,CAAC,yBAAyB,GAAG,YAAY,CAAC,yBAAyB,CAAC;QACxE,IAAI,CAAC,UAAU,GAAG,YAAY,CAAC,UAAU,CAAC;KAC3C;IAED,oBAAoB;QAClB,IAAI,CAAC,WAAW,IAAI,CAAC;KACtB;IAED,iBAAiB,CAAC,KAAuB;QACvC,IAAI,CAAC,yBAAyB,GAAG,CAAC,GAAG,KAAK,CAAC,yBAAyB,CAAC,CAAC;QACtE,IAAI,CAAC,qBAAqB,GAAG,CAAC,GAAG,KAAK,CAAC,qBAAqB,CAAC,CAAC;QAC9D,IAAI,CAAC,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C,IAAI,CAAC,SAAS,mBACX,IAAI,CAAC,YAAY,uBAE9B,IAAI,CAAC,oBAAoB,GAAG,IAAI,CAAC,iBAAiB,GAAGE,OAAK,EAE5D,oBAAoB,EAAE,IAAI,CAAC,oBAAoB,EAC/C,IAAI,EAAE,IAAI,GACV,CACH,CAAC,EACD,IAAI,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC;YACzB,IAAI,CAAC,yBAAyB,CAAC,MAAM,KAAK,CAAC,KACzCF,iBAAK,KAAK,EAAC,oDAAoD,IAC7DA,wDACiB,gCAAgC,IAAI,CAAC,UAAU,SAAS,GACvE,CACE,CACP,CACC,EACN;KACH;;;;;","names":["useSearchcraftStore","h","serializeStyles","index"],"sources":["src/components/searchcraft-base-search-results/searchcraft-base-search-results.tsx"],"sourcesContent":["import {\n Component,\n h,\n Event,\n Prop,\n State,\n type EventEmitter,\n} from '@stencil/core';\n\nimport type {\n AdClientResponseItem,\n SearchClientResponseItem,\n} from '@searchcraft/core';\n\nimport { type SearchcraftState, useSearchcraftStore } from '@provider/store';\n\nimport { serializeStyles } from '@utils';\nimport type { SearchResultMappings } from '@searchcraft/core';\n\n/**\n * This web component is responsible for displaying the results of a search query.\n * Once a query is submitted, the component formats and presents an ordered list of the results.\n *\n * ## Usage\n * ```html\n * <!-- index.html -->\n * <searchcraft-base-search-results\n * ad-interval=\"4\"\n * place-ad-at-start=\"false\"\n * result-image-placement=\"right\"\n * />\n * ```\n *\n * ```js\n * // index.js\n * const baseSearchResults = document.querySelector('searchcraft-base-search-results');\n *\n * baseSearchResults.searchResultMappings = containerHref: {\n * fieldNames: [\n * {\n * fieldName: 'canonical_link',\n * dataType: 'text',\n * },\n * ],\n * };\n *\n * baseSearchResults.addEventListener('noResults', () => {\n * console.log('No search results found');\n * });\n * ```\n */\n@Component({\n tag: 'searchcraft-base-search-results',\n shadow: false,\n})\nexport class SearchcraftBaseSearchResults {\n /**\n * A custom styles object.\n */\n @Prop() customStylesForResults:\n | string\n | Record<string, Record<string, string>>\n | undefined;\n /**\n * Formats the content rendered for each result.\n */\n @Prop() searchResultMappings: SearchResultMappings | undefined;\n /**\n * The placement of the image for each result.\n */\n @Prop() resultImagePlacement: 'left' | 'right' = 'right';\n /**\n * The label for the button rendered when containerHref is not present for each result.\n */\n @Prop() buttonLabel: string | undefined;\n /**\n * Where to open the link for the button rendered when containerHref is not present for each result.\n */\n @Prop() buttonTarget: '_blank' | '_self' | '_top' | '_parent' = '_blank';\n /**\n * The relationship between the current document and the link for the button rendered when containerHref is not present for each result.\n */\n @Prop() buttonRel: 'noreferrer' | 'noopener' | 'nofollow' | undefined;\n /**\n * Where to open the link for the containing element for each result.\n */\n @Prop() containerTarget: '_blank' | '_self' | '_top' | '_parent' = '_blank';\n /**\n * The relationship between the current document and the link for the containing element for each result.\n */\n @Prop() containerRel: 'noreferrer' | 'noopener' | 'nofollow' | undefined;\n\n /**\n * When no results are returned.\n */\n @Event() noResults?: EventEmitter<void>;\n\n @State() searchTerm = '';\n @State() searchClientResponseItems: SearchClientResponseItem[] = [];\n @State() adClientResponseItems: AdClientResponseItem[] = [];\n @State() searchResultsPerPage;\n @State() searchResultsPage;\n\n private unsubscribe: () => void = () => {};\n\n componentDidLoad() {\n this.unsubscribe = useSearchcraftStore.subscribe((state) =>\n this.handleStateChange(state),\n );\n const currentState = useSearchcraftStore.getState();\n this.searchClientResponseItems = currentState.searchClientResponseItems;\n this.searchTerm = currentState.searchTerm;\n }\n\n disconnectedCallback() {\n this.unsubscribe?.();\n }\n\n handleStateChange(state: SearchcraftState) {\n this.searchClientResponseItems = [...state.searchClientResponseItems];\n this.adClientResponseItems = [...state.adClientResponseItems];\n this.searchTerm = state.searchTerm;\n this.searchResultsPage = state.searchResultsPage;\n this.searchResultsPerPage = state.searchResultsPerPage;\n }\n\n render() {\n if (this.searchTerm.trim() === '') {\n return (\n <div class='searchcraft-search-results-empty-state-container'>\n <slot name='empty-search' />\n </div>\n );\n }\n\n if (this.searchClientResponseItems.length === 0) {\n return;\n }\n\n if (\n this.searchTerm.length > 0 &&\n this.searchClientResponseItems.length === 0\n ) {\n this.noResults?.emit();\n }\n\n let serializedStyles = '';\n if (this.customStylesForResults) {\n serializedStyles =\n typeof this.customStylesForResults === 'string'\n ? this.customStylesForResults\n : serializeStyles(this.customStylesForResults);\n }\n\n return (\n <div class='searchcraft-search-results-container'>\n {this.adClientResponseItems?.map((item) => (\n <searchcraft-base-search-result-ad\n adClientResponseItem={item}\n key={item.adId}\n />\n ))}\n {this.searchClientResponseItems?.map((item, index) => (\n <searchcraft-base-search-result\n key={item.id}\n custom-styles={serializedStyles}\n image-placement={this.resultImagePlacement}\n container-rel={this.containerRel}\n container-target={this.containerTarget}\n button-label={this.buttonLabel || 'View more'}\n button-rel={this.buttonRel}\n button-target={this.buttonTarget}\n document-position={\n this.searchResultsPerPage * this.searchResultsPage + index\n }\n searchResultMappings={this.searchResultMappings}\n item={item}\n />\n ))}\n {this.searchTerm.length > 0 &&\n this.searchClientResponseItems.length === 0 && (\n <div class='searchcraft-search-results-error-message-container'>\n <searchcraft-error-message\n error-message={`No search results found for \"${this.searchTerm}\" query`}\n />\n </div>\n )}\n </div>\n );\n }\n}\n"],"version":3}
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
const index = require('./index-a81df4f0.js');
|
|
6
|
-
const index$1 = require('./index-5b0b9d4c.js');
|
|
7
|
-
|
|
8
|
-
const SearchcraftButton = class {
|
|
9
|
-
constructor(hostRef) {
|
|
10
|
-
index.registerInstance(this, hostRef);
|
|
11
|
-
this.buttonClick = index.createEvent(this, "buttonClick", 7);
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Controls the visual representation of the button.
|
|
15
|
-
*/
|
|
16
|
-
hierarchy = 'primary';
|
|
17
|
-
/**
|
|
18
|
-
* Whether the button is disabled.
|
|
19
|
-
*/
|
|
20
|
-
disabled = false;
|
|
21
|
-
/**
|
|
22
|
-
* The icon element.
|
|
23
|
-
*/
|
|
24
|
-
icon;
|
|
25
|
-
/**
|
|
26
|
-
* Should the button only display an icon.
|
|
27
|
-
*/
|
|
28
|
-
iconOnly = false;
|
|
29
|
-
/**
|
|
30
|
-
* The position of the icon.
|
|
31
|
-
*/
|
|
32
|
-
iconPosition = 'left';
|
|
33
|
-
/**
|
|
34
|
-
* The label for the button.
|
|
35
|
-
*/
|
|
36
|
-
label = 'Search';
|
|
37
|
-
/**
|
|
38
|
-
* The type of the button.
|
|
39
|
-
*/
|
|
40
|
-
type = 'button';
|
|
41
|
-
/**
|
|
42
|
-
* The event fired when the button is clicked.
|
|
43
|
-
*/
|
|
44
|
-
buttonClick;
|
|
45
|
-
handleButtonClick = () => {
|
|
46
|
-
this.buttonClick.emit();
|
|
47
|
-
};
|
|
48
|
-
render() {
|
|
49
|
-
return (index.h("button", { key: 'ff883b930d03da6cbfb40badd3be1de0a873f853', "aria-label": this.label, class: index$1.classNames('searchcraft-button', {
|
|
50
|
-
'searchcraft-button-primary': this.hierarchy === 'primary',
|
|
51
|
-
'searchcraft-button-tertiary': this.hierarchy === 'tertiary',
|
|
52
|
-
'searchcraft-button-disabled': this.disabled,
|
|
53
|
-
}), disabled: this.disabled, onClick: this.handleButtonClick, type: this.type }, this.iconOnly ? (this.icon) : (index.h(index.Fragment, null, this.iconPosition === 'left' && this.icon, index.h("span", null, this.label), this.iconPosition === 'right' && this.icon))));
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
const SearchcraftErrorMessage = class {
|
|
58
|
-
constructor(hostRef) {
|
|
59
|
-
index.registerInstance(this, hostRef);
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* The error message.
|
|
63
|
-
*/
|
|
64
|
-
errorMessage;
|
|
65
|
-
render() {
|
|
66
|
-
return (index.h("p", { key: 'dc97bb66da10a98fca027f928deaaf80d945417b', class: 'searchcraft-error-message' }, this.errorMessage || 'Search term is required.'));
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
const SearchcraftInputLabel = class {
|
|
71
|
-
constructor(hostRef) {
|
|
72
|
-
index.registerInstance(this, hostRef);
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* The classname applied to the label element.
|
|
76
|
-
*/
|
|
77
|
-
inputLabelClassName = '';
|
|
78
|
-
label = '';
|
|
79
|
-
render() {
|
|
80
|
-
return (index.h("label", { key: '528396d4be9f22ff0c02d95d8bcea056576aed41', class: index$1.classNames('searchcraft-input-label', this.inputLabelClassName), htmlFor: 'searchcraft-input-id' }, this.label));
|
|
81
|
-
}
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
exports.searchcraft_button = SearchcraftButton;
|
|
85
|
-
exports.searchcraft_error_message = SearchcraftErrorMessage;
|
|
86
|
-
exports.searchcraft_input_label = SearchcraftInputLabel;
|
|
87
|
-
|
|
88
|
-
//# sourceMappingURL=searchcraft-button_3.cjs.entry.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"file":"searchcraft-button.searchcraft-error-message.searchcraft-input-label.entry.cjs.js","mappings":";;;;;;;MAmBa,iBAAiB;;;;;;;;IAIpB,SAAS,GAA4B,SAAS,CAAC;;;;IAI/C,QAAQ,GAAa,KAAK,CAAC;;;;IAI3B,IAAI,CAAW;;;;IAIf,QAAQ,GAAa,KAAK,CAAC;;;;IAI3B,YAAY,GAAsB,MAAM,CAAC;;;;IAIzC,KAAK,GAAG,QAAQ,CAAC;;;;IAIjB,IAAI,GAAmC,QAAQ,CAAC;;;;IAI/C,WAAW,CAAsB;IAElC,iBAAiB,GAAG;QAC1B,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;KACzB,CAAC;IAEF,MAAM;QACJ,QACEA,mFACc,IAAI,CAAC,KAAK,EACtB,KAAK,EAAEC,kBAAU,CAAC,oBAAoB,EAAE;gBACtC,4BAA4B,EAAE,IAAI,CAAC,SAAS,KAAK,SAAS;gBAC1D,6BAA6B,EAAE,IAAI,CAAC,SAAS,KAAK,UAAU;gBAC5D,6BAA6B,EAAE,IAAI,CAAC,QAAQ;aAC7C,CAAC,EACF,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,OAAO,EAAE,IAAI,CAAC,iBAAiB,EAC/B,IAAI,EAAE,IAAI,CAAC,IAAI,IAEd,IAAI,CAAC,QAAQ,IACZ,IAAI,CAAC,IAAI,KAETD,QAACE,cAAQ,QACN,IAAI,CAAC,YAAY,KAAK,MAAM,IAAI,IAAI,CAAC,IAAI,EAC1CF,sBAAO,IAAI,CAAC,KAAK,CAAQ,EACxB,IAAI,CAAC,YAAY,KAAK,OAAO,IAAI,IAAI,CAAC,IAAI,CAClC,CACZ,CACM,EACT;KACH;;;MClEU,uBAAuB;;;;;;;IAI1B,YAAY,CAAU;IAE9B,MAAM;QACJ,QACEA,gEAAG,KAAK,EAAC,2BAA2B,IACjC,IAAI,CAAC,YAAY,IAAI,0BAA0B,CAC9C,EACJ;KACH;;;MCXU,qBAAqB;;;;;;;IAIxB,mBAAmB,GAAI,EAAE,CAAC;IAC1B,KAAK,GAAG,EAAE,CAAC;IAEnB,MAAM;QACJ,QACEA,oEACE,KAAK,EAAEC,kBAAU,CAAC,yBAAyB,EAAE,IAAI,CAAC,mBAAmB,CAAC,EACtE,OAAO,EAAC,sBAAsB,IAE7B,IAAI,CAAC,KAAK,CACL,EACR;KACH;;;;;;;","names":["h","classNames","Fragment"],"sources":["src/components/searchcraft-button/searchcraft-button.tsx","src/components/searchcraft-error-message/searchcraft-error-message.tsx","src/components/searchcraft-input-label/searchcraft-input-label.tsx"],"sourcesContent":["import {\n Component,\n Event,\n type EventEmitter,\n Prop,\n h,\n Fragment,\n} from '@stencil/core';\nimport classNames from 'classnames';\n\n/**\n * This web component represents a button to be consumed within the `search-input-form` component.\n * It provides a clear, interactive way for users to submit search queries or trigger actions in a search interface.\n * It is consumed within the `searchcraft-input-form` component.\n */\n@Component({\n tag: 'searchcraft-button',\n shadow: false,\n})\nexport class SearchcraftButton {\n /**\n * Controls the visual representation of the button.\n */\n @Prop() hierarchy?: 'primary' | 'tertiary' = 'primary';\n /**\n * Whether the button is disabled.\n */\n @Prop() disabled?: boolean = false;\n /**\n * The icon element.\n */\n @Prop() icon?: Element;\n /**\n * Should the button only display an icon.\n */\n @Prop() iconOnly?: boolean = false;\n /**\n * The position of the icon.\n */\n @Prop() iconPosition?: 'left' | 'right' = 'left';\n /**\n * The label for the button.\n */\n @Prop() label = 'Search';\n /**\n * The type of the button.\n */\n @Prop() type?: 'submit' | 'reset' | 'button' = 'button';\n /**\n * The event fired when the button is clicked.\n */\n @Event() buttonClick!: EventEmitter<void>;\n\n private handleButtonClick = () => {\n this.buttonClick.emit();\n };\n\n render() {\n return (\n <button\n aria-label={this.label}\n class={classNames('searchcraft-button', {\n 'searchcraft-button-primary': this.hierarchy === 'primary',\n 'searchcraft-button-tertiary': this.hierarchy === 'tertiary',\n 'searchcraft-button-disabled': this.disabled,\n })}\n disabled={this.disabled}\n onClick={this.handleButtonClick}\n type={this.type}\n >\n {this.iconOnly ? (\n this.icon\n ) : (\n <Fragment>\n {this.iconPosition === 'left' && this.icon}\n <span>{this.label}</span>\n {this.iconPosition === 'right' && this.icon}\n </Fragment>\n )}\n </button>\n );\n }\n}\n","import { Component, Prop, h } from '@stencil/core';\n\n/**\n * This web component is designed to display a user-friendly error message when a search query fails, providing clear feedback to users and enhancing their experience when an issue arises during the search process.\n *\n * ## Usage\n * ```html\n * <!-- index.html -->\n * <searchcraft-error-message error-message=\"No search results found for query\" />\n * ```\n */\n@Component({\n tag: 'searchcraft-error-message',\n shadow: false,\n})\nexport class SearchcraftErrorMessage {\n /**\n * The error message.\n */\n @Prop() errorMessage?: string;\n\n render() {\n return (\n <p class='searchcraft-error-message'>\n {this.errorMessage || 'Search term is required.'}\n </p>\n );\n }\n}\n","import { Component, Prop, h } from '@stencil/core';\nimport classNames from 'classnames';\n\n/**\n * This web component serves as the input label for the searchcraft-input-form component.\n *\n * ## Usage\n * ```html\n * <!-- index.html -->\n * <searchcraft-input-label label=\"Search\" />\n * ```\n */\n@Component({\n tag: 'searchcraft-input-label',\n shadow: false,\n})\nexport class SearchcraftInputLabel {\n /**\n * The classname applied to the label element.\n */\n @Prop() inputLabelClassName? = '';\n @Prop() label = '';\n\n render() {\n return (\n <label\n class={classNames('searchcraft-input-label', this.inputLabelClassName)}\n htmlFor='searchcraft-input-id'\n >\n {this.label}\n </label>\n );\n }\n}\n"],"version":3}
|