@searchcraft/javascript-sdk 0.9.2 → 0.9.4
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/bundled.types.d.ts +2196 -0
- package/dist/components/index.js +3 -5
- package/dist/components/index.js.map +1 -1
- package/dist/components/searchcraft-base-search-results.js +3 -3
- package/dist/components/searchcraft-base-search-results.js.map +1 -1
- package/dist/types/index.d.ts +1 -2
- package/package.json +4 -5
package/dist/components/index.js
CHANGED
|
@@ -24,11 +24,10 @@ export { SearchcraftToggleButton, defineCustomElement as defineCustomElementSear
|
|
|
24
24
|
export { p as parseCustomStyles, s as serializeStyles } from './p-d9551738.js';
|
|
25
25
|
|
|
26
26
|
const name = "@searchcraft/javascript-sdk";
|
|
27
|
-
const version = "0.9.
|
|
27
|
+
const version = "0.9.4";
|
|
28
28
|
const description = "Searchcraft Javascript SDK";
|
|
29
29
|
const author = "Searchcraft";
|
|
30
30
|
const license = "Apache-2.0";
|
|
31
|
-
const main = "dist/index.cjs.js";
|
|
32
31
|
const module = "dist/components/index.js";
|
|
33
32
|
const types = "dist/components/index.d.ts";
|
|
34
33
|
const collection = "dist/collection/collection-manifest.json";
|
|
@@ -51,7 +50,7 @@ const files = [
|
|
|
51
50
|
"dist/"
|
|
52
51
|
];
|
|
53
52
|
const scripts = {
|
|
54
|
-
build: "stencil build
|
|
53
|
+
build: "stencil build",
|
|
55
54
|
docs: "typedoc --options typedoc.json",
|
|
56
55
|
dev: "stencil build --dev --watch",
|
|
57
56
|
test: "stencil test --spec --e2e",
|
|
@@ -65,7 +64,7 @@ const dependencies = {
|
|
|
65
64
|
nanoid: "^5.0.9"
|
|
66
65
|
};
|
|
67
66
|
const devDependencies = {
|
|
68
|
-
"@searchcraft/core": "^0.9.
|
|
67
|
+
"@searchcraft/core": "^0.9.4",
|
|
69
68
|
"@stencil/core": "^4.7.0",
|
|
70
69
|
"@stencil/react-output-target": "^0.8.2",
|
|
71
70
|
"@stencil/sass": "^3.0.12",
|
|
@@ -79,7 +78,6 @@ const packageJson = {
|
|
|
79
78
|
description: description,
|
|
80
79
|
author: author,
|
|
81
80
|
license: license,
|
|
82
|
-
main: main,
|
|
83
81
|
module: module,
|
|
84
82
|
types: types,
|
|
85
83
|
collection: collection,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"index.js","mappings":"
|
|
1
|
+
{"file":"index.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuBA;;;MAGa,WAAY,SAAQA,EAAe;IAC9C,YAAY,MAAyB;QACnC,KAAK,CAAC,MAAM,EAAE;YACZ,OAAO,EAAE,WAAW,CAAC,IAAI;YACzB,UAAU,EAAE,WAAW,CAAC,OAAO;SAChC,CAAC,CAAC;KACJ;;;;;","names":["SearchcraftCore"],"sources":["src/index.ts"],"sourcesContent":["import { type SearchcraftConfig, SearchcraftCore } from '@searchcraft/core';\nimport { searchcraftStore } from '@store';\nimport packageJson from '../package.json';\n\n/**\n * @fileoverview entry point for your component library\n *\n * This is the entry point for your component library. Use this file to export utilities,\n * constants or data structure that accompany your components.\n *\n * DO NOT use this file to export your components. Instead, use the recommended approaches\n * to consume components of this package as outlined in the `README.md`.\n */\nexport type { SearchcraftConfig };\nexport { searchcraftStore };\n\nexport {\n parseCustomStyles,\n serializeStyles,\n} from './utils';\n\nexport type { Components, JSX } from './components';\n\n/**\n * The consumer-facing `Searchcraft` class.\n */\nexport class Searchcraft extends SearchcraftCore {\n constructor(config: SearchcraftConfig) {\n super(config, {\n sdkName: packageJson.name,\n sdkVersion: packageJson.version,\n });\n }\n}\n\n/**\n * Exports the shared types that all SDKs need\n */\nexport type * from '@searchcraft/core/dist/types/sdk-types';\n"],"version":3}
|
|
@@ -86,7 +86,7 @@ const SearchcraftBaseSearchResults$1 = /*@__PURE__*/ proxyCustomElement(class Se
|
|
|
86
86
|
return (h("div", { class: 'searchcraft-search-results-container' }, h("div", { class: 'searchcraft-search-results-error-message-container' }, h("searchcraft-error-message", { "error-message": `No search results found for "${this.searchTerm}" query` }))));
|
|
87
87
|
}
|
|
88
88
|
renderWithADMAds() {
|
|
89
|
-
return (h("div", { class: 'searchcraft-search-results-container' }, this.adClientResponseItems?.map((item) => (h("searchcraft-ad", { adSource: 'adMarketplace', adClientResponseItem: item, key: item.id }))), this.searchClientResponseItems?.map((item, index) => (h("searchcraft-base-search-result", { key: item.id, "custom-styles": this.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, searchResultMappings: this.searchResultMappings, item: item })))));
|
|
89
|
+
return (h("div", { class: 'searchcraft-search-results-container' }, this.adClientResponseItems?.map((item) => (h("searchcraft-ad", { adSource: 'adMarketplace', adClientResponseItem: item, key: item.id }))), this.searchClientResponseItems?.map((item, index) => (h("searchcraft-base-search-result", { key: item.id, "custom-styles": this.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 - 1) + index, searchResultMappings: this.searchResultMappings, item: item })))));
|
|
90
90
|
}
|
|
91
91
|
renderWithCustomAds() {
|
|
92
92
|
const itemsToRender = [];
|
|
@@ -109,7 +109,7 @@ const SearchcraftBaseSearchResults$1 = /*@__PURE__*/ proxyCustomElement(class Se
|
|
|
109
109
|
itemsToRender.push(h("searchcraft-ad", { adSource: 'Custom', key: `${item.id}-ad-${n}` }));
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
|
-
itemsToRender.push(h("searchcraft-base-search-result", { key: item.id, "custom-styles": this.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, searchResultMappings: this.searchResultMappings, item: item }));
|
|
112
|
+
itemsToRender.push(h("searchcraft-base-search-result", { key: item.id, "custom-styles": this.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 - 1) + index, searchResultMappings: this.searchResultMappings, item: item }));
|
|
113
113
|
});
|
|
114
114
|
// Renders ads at end
|
|
115
115
|
for (let n = 0; n < adEndQuantity; n++) {
|
|
@@ -118,7 +118,7 @@ const SearchcraftBaseSearchResults$1 = /*@__PURE__*/ proxyCustomElement(class Se
|
|
|
118
118
|
return (h("div", { class: 'searchcraft-search-results-container' }, itemsToRender));
|
|
119
119
|
}
|
|
120
120
|
renderWithNoAds() {
|
|
121
|
-
return (h("div", { class: 'searchcraft-search-results-container' }, this.searchClientResponseItems?.map((item, index) => (h("searchcraft-base-search-result", { key: item.id, "custom-styles": this.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, searchResultMappings: this.searchResultMappings, item: item })))));
|
|
121
|
+
return (h("div", { class: 'searchcraft-search-results-container' }, this.searchClientResponseItems?.map((item, index) => (h("searchcraft-base-search-result", { key: item.id, "custom-styles": this.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 - 1) + index, searchResultMappings: this.searchResultMappings, item: item })))));
|
|
122
122
|
}
|
|
123
123
|
render() {
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E,IAAI,CAAC,oBAAoB,EAC/C,IAAI,EAAE,IAAI,GACV,CACH,CAAC,CACE,EACN;KACH;IAED,MAAM;QACJ,IAAI,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;YACjC,OAAO,IAAI,CAAC,gBAAgB,EAAE,CAAC;SAChC;QAED,IACE,IAAI,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC;YAC1B,IAAI,CAAC,yBAAyB,CAAC,MAAM,KAAK,CAAC;YAC3C,CAAC,IAAI,CAAC,kBAAkB,EACxB;YACA,OAAO,IAAI,CAAC,yBAAyB,EAAE,CAAC;SACzC;QAED,QAAQ,IAAI,CAAC,MAAM,EAAE,QAAQ,IAAI,MAAM;YACrC,KAAK,eAAe;gBAClB,OAAO,IAAI,CAAC,gBAAgB,EAAE,CAAC;YACjC,KAAK,QAAQ;gBACX,OAAO,IAAI,CAAC,mBAAmB,EAAE,CAAC;YACpC;gBACE,OAAO,IAAI,CAAC,eAAe,EAAE,CAAC;SACjC;KACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["SearchcraftBaseSearchResults"],"sources":["src/components/searchcraft-base-search-results/searchcraft-base-search-results.tsx"],"sourcesContent":["import { Component, h, Prop, State, type JSX } from '@stencil/core';\n\nimport type {\n AdClientResponseItem,\n SearchClientResponseItem,\n SearchcraftConfig,\n} from '@searchcraft/core';\n\nimport { type SearchcraftState, searchcraftStore } from '@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 /**\n * Formats the content rendered for each result.\n */\n @Prop() searchResultMappings?: SearchResultMappings;\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;\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';\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';\n\n @State() searchTerm = '';\n @State() searchClientResponseItems: SearchClientResponseItem[] = [];\n @State() adClientResponseItems: AdClientResponseItem[] = [];\n @State() searchResultsPerPage;\n @State() searchResultsPage;\n @State() isSearchInProgress = false;\n @State() config?: SearchcraftConfig;\n\n private unsubscribe: () => void = () => {};\n\n get serializedStyles(): string {\n let serializedStyles = '';\n if (this.customStylesForResults) {\n serializedStyles =\n typeof this.customStylesForResults === 'string'\n ? this.customStylesForResults\n : serializeStyles(this.customStylesForResults);\n }\n return serializedStyles;\n }\n\n componentDidLoad() {\n this.unsubscribe = searchcraftStore.subscribe((state) =>\n this.handleStateChange(state),\n );\n const currentState = searchcraftStore.getState();\n this.searchClientResponseItems = currentState.searchClientResponseItems;\n this.searchTerm = currentState.searchTerm;\n this.config = currentState.core?.config;\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 this.config = state.core?.config;\n this.isSearchInProgress = state.isSearchInProgress;\n }\n\n renderEmptyState() {\n return (\n <div class='searchcraft-search-results-empty-state-container'>\n <slot name='empty-search' />\n </div>\n );\n }\n\n renderNoResultsFoundState() {\n return (\n <div class='searchcraft-search-results-container'>\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 </div>\n );\n }\n\n renderWithADMAds() {\n return (\n <div class='searchcraft-search-results-container'>\n {this.adClientResponseItems?.map((item) => (\n <searchcraft-ad\n adSource='adMarketplace'\n adClientResponseItem={item}\n key={item.id}\n />\n ))}\n {this.searchClientResponseItems?.map((item, index) => (\n <searchcraft-base-search-result\n key={item.id}\n custom-styles={this.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 </div>\n );\n }\n\n renderWithCustomAds() {\n const itemsToRender: JSX.Element[] = [];\n const interstitialInterval = this.config?.customAdInterstitialInterval || 0;\n const interstitialQuantity = this.config?.customAdInterstitialQuantity || 1;\n const adStartQuantity = this.config?.customAdStartQuantity || 0;\n const adEndQuantity = this.config?.customAdEndQuantity || 0;\n const searchItems = this.searchClientResponseItems || [];\n\n // Renders ads at beginning\n for (let n = 0; n < adStartQuantity; n++) {\n itemsToRender.push(<searchcraft-ad adSource='Custom' key={`${n}-ad`} />);\n }\n\n // Renders search results + interstitial ads\n searchItems.forEach((item, index) => {\n if (\n interstitialInterval &&\n index % interstitialInterval === 0 &&\n index + interstitialInterval < searchItems.length &&\n index >= interstitialInterval\n ) {\n for (let n = 0; n < interstitialQuantity; n++) {\n itemsToRender.push(\n <searchcraft-ad adSource='Custom' key={`${item.id}-ad-${n}`} />,\n );\n }\n }\n itemsToRender.push(\n <searchcraft-base-search-result\n key={item.id}\n custom-styles={this.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 });\n\n // Renders ads at end\n for (let n = 0; n < adEndQuantity; n++) {\n itemsToRender.push(<searchcraft-ad adSource='Custom' key={`${n}-ad`} />);\n }\n\n return (\n <div class='searchcraft-search-results-container'>{itemsToRender}</div>\n );\n }\n\n renderWithNoAds() {\n return (\n <div class='searchcraft-search-results-container'>\n {this.searchClientResponseItems?.map((item, index) => (\n <searchcraft-base-search-result\n key={item.id}\n custom-styles={this.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 </div>\n );\n }\n\n render() {\n if (this.searchTerm.trim() === '') {\n return this.renderEmptyState();\n }\n\n if (\n this.searchTerm.length > 0 &&\n this.searchClientResponseItems.length === 0 &&\n !this.isSearchInProgress\n ) {\n return this.renderNoResultsFoundState();\n }\n\n switch (this.config?.adSource || 'None') {\n case 'adMarketplace':\n return this.renderWithADMAds();\n case 'Custom':\n return this.renderW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GAAG,CAAC,CAAC,GAAG,KAAK,EAElE,oBAAoB,EAAE,IAAI,CAAC,oBAAoB,EAC/C,IAAI,EAAE,IAAI,GACV,CACH,CAAC,CACE,EACN;KACH;IAED,MAAM;QACJ,IAAI,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;YACjC,OAAO,IAAI,CAAC,gBAAgB,EAAE,CAAC;SAChC;QAED,IACE,IAAI,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC;YAC1B,IAAI,CAAC,yBAAyB,CAAC,MAAM,KAAK,CAAC;YAC3C,CAAC,IAAI,CAAC,kBAAkB,EACxB;YACA,OAAO,IAAI,CAAC,yBAAyB,EAAE,CAAC;SACzC;QAED,QAAQ,IAAI,CAAC,MAAM,EAAE,QAAQ,IAAI,MAAM;YACrC,KAAK,eAAe;gBAClB,OAAO,IAAI,CAAC,gBAAgB,EAAE,CAAC;YACjC,KAAK,QAAQ;gBACX,OAAO,IAAI,CAAC,mBAAmB,EAAE,CAAC;YACpC;gBACE,OAAO,IAAI,CAAC,eAAe,EAAE,CAAC;SACjC;KACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["SearchcraftBaseSearchResults"],"sources":["src/components/searchcraft-base-search-results/searchcraft-base-search-results.tsx"],"sourcesContent":["import { Component, h, Prop, State, type JSX } from '@stencil/core';\n\nimport type {\n AdClientResponseItem,\n SearchClientResponseItem,\n SearchcraftConfig,\n} from '@searchcraft/core';\n\nimport { type SearchcraftState, searchcraftStore } from '@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 /**\n * Formats the content rendered for each result.\n */\n @Prop() searchResultMappings?: SearchResultMappings;\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;\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';\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';\n\n @State() searchTerm = '';\n @State() searchClientResponseItems: SearchClientResponseItem[] = [];\n @State() adClientResponseItems: AdClientResponseItem[] = [];\n @State() searchResultsPerPage;\n @State() searchResultsPage;\n @State() isSearchInProgress = false;\n @State() config?: SearchcraftConfig;\n\n private unsubscribe: () => void = () => {};\n\n get serializedStyles(): string {\n let serializedStyles = '';\n if (this.customStylesForResults) {\n serializedStyles =\n typeof this.customStylesForResults === 'string'\n ? this.customStylesForResults\n : serializeStyles(this.customStylesForResults);\n }\n return serializedStyles;\n }\n\n componentDidLoad() {\n this.unsubscribe = searchcraftStore.subscribe((state) =>\n this.handleStateChange(state),\n );\n const currentState = searchcraftStore.getState();\n this.searchClientResponseItems = currentState.searchClientResponseItems;\n this.searchTerm = currentState.searchTerm;\n this.config = currentState.core?.config;\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 this.config = state.core?.config;\n this.isSearchInProgress = state.isSearchInProgress;\n }\n\n renderEmptyState() {\n return (\n <div class='searchcraft-search-results-empty-state-container'>\n <slot name='empty-search' />\n </div>\n );\n }\n\n renderNoResultsFoundState() {\n return (\n <div class='searchcraft-search-results-container'>\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 </div>\n );\n }\n\n renderWithADMAds() {\n return (\n <div class='searchcraft-search-results-container'>\n {this.adClientResponseItems?.map((item) => (\n <searchcraft-ad\n adSource='adMarketplace'\n adClientResponseItem={item}\n key={item.id}\n />\n ))}\n {this.searchClientResponseItems?.map((item, index) => (\n <searchcraft-base-search-result\n key={item.id}\n custom-styles={this.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 - 1) + index\n }\n searchResultMappings={this.searchResultMappings}\n item={item}\n />\n ))}\n </div>\n );\n }\n\n renderWithCustomAds() {\n const itemsToRender: JSX.Element[] = [];\n const interstitialInterval = this.config?.customAdInterstitialInterval || 0;\n const interstitialQuantity = this.config?.customAdInterstitialQuantity || 1;\n const adStartQuantity = this.config?.customAdStartQuantity || 0;\n const adEndQuantity = this.config?.customAdEndQuantity || 0;\n const searchItems = this.searchClientResponseItems || [];\n\n // Renders ads at beginning\n for (let n = 0; n < adStartQuantity; n++) {\n itemsToRender.push(<searchcraft-ad adSource='Custom' key={`${n}-ad`} />);\n }\n\n // Renders search results + interstitial ads\n searchItems.forEach((item, index) => {\n if (\n interstitialInterval &&\n index % interstitialInterval === 0 &&\n index + interstitialInterval < searchItems.length &&\n index >= interstitialInterval\n ) {\n for (let n = 0; n < interstitialQuantity; n++) {\n itemsToRender.push(\n <searchcraft-ad adSource='Custom' key={`${item.id}-ad-${n}`} />,\n );\n }\n }\n itemsToRender.push(\n <searchcraft-base-search-result\n key={item.id}\n custom-styles={this.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 - 1) + index\n }\n searchResultMappings={this.searchResultMappings}\n item={item}\n />,\n );\n });\n\n // Renders ads at end\n for (let n = 0; n < adEndQuantity; n++) {\n itemsToRender.push(<searchcraft-ad adSource='Custom' key={`${n}-ad`} />);\n }\n\n return (\n <div class='searchcraft-search-results-container'>{itemsToRender}</div>\n );\n }\n\n renderWithNoAds() {\n return (\n <div class='searchcraft-search-results-container'>\n {this.searchClientResponseItems?.map((item, index) => (\n <searchcraft-base-search-result\n key={item.id}\n custom-styles={this.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 - 1) + index\n }\n searchResultMappings={this.searchResultMappings}\n item={item}\n />\n ))}\n </div>\n );\n }\n\n render() {\n if (this.searchTerm.trim() === '') {\n return this.renderEmptyState();\n }\n\n if (\n this.searchTerm.length > 0 &&\n this.searchClientResponseItems.length === 0 &&\n !this.isSearchInProgress\n ) {\n return this.renderNoResultsFoundState();\n }\n\n switch (this.config?.adSource || 'None') {\n case 'adMarketplace':\n return this.renderWithADMAds();\n case 'Custom':\n return this.renderWithCustomAds();\n default:\n return this.renderWithNoAds();\n }\n }\n}\n"],"version":3}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -9,11 +9,10 @@ import { searchcraftStore } from "./store/index";
|
|
|
9
9
|
* DO NOT use this file to export your components. Instead, use the recommended approaches
|
|
10
10
|
* to consume components of this package as outlined in the `README.md`.
|
|
11
11
|
*/
|
|
12
|
-
export type * from './components';
|
|
13
12
|
export type { SearchcraftConfig };
|
|
14
13
|
export { searchcraftStore };
|
|
15
14
|
export { parseCustomStyles, serializeStyles, } from './utils';
|
|
16
|
-
export type { Components } from './components';
|
|
15
|
+
export type { Components, JSX } from './components';
|
|
17
16
|
/**
|
|
18
17
|
* The consumer-facing `Searchcraft` class.
|
|
19
18
|
*/
|
package/package.json
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@searchcraft/javascript-sdk",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.9.
|
|
4
|
+
"version": "0.9.4",
|
|
5
5
|
"description": "Searchcraft Javascript SDK",
|
|
6
6
|
"author": "Searchcraft",
|
|
7
7
|
"license": "Apache-2.0",
|
|
8
|
-
"main": "dist/index.cjs.js",
|
|
9
8
|
"module": "dist/components/index.js",
|
|
10
9
|
"types": "dist/components/index.d.ts",
|
|
11
10
|
"collection": "dist/collection/collection-manifest.json",
|
|
@@ -29,7 +28,7 @@
|
|
|
29
28
|
"dist/"
|
|
30
29
|
],
|
|
31
30
|
"scripts": {
|
|
32
|
-
"build": "stencil build
|
|
31
|
+
"build": "stencil build",
|
|
33
32
|
"docs": "typedoc --options typedoc.json",
|
|
34
33
|
"dev": "stencil build --dev --watch",
|
|
35
34
|
"test": "stencil test --spec --e2e",
|
|
@@ -43,12 +42,12 @@
|
|
|
43
42
|
"nanoid": "^5.0.9"
|
|
44
43
|
},
|
|
45
44
|
"devDependencies": {
|
|
46
|
-
"@searchcraft/core": "^0.9.
|
|
45
|
+
"@searchcraft/core": "^0.9.4",
|
|
47
46
|
"@stencil/core": "^4.7.0",
|
|
48
47
|
"@stencil/react-output-target": "^0.8.2",
|
|
49
48
|
"@stencil/sass": "^3.0.12",
|
|
50
49
|
"@types/node": "^16.18.11",
|
|
51
50
|
"zustand": "^5.0.1"
|
|
52
51
|
},
|
|
53
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "ee12703db82cefe9dd98acb2b95b2dff277ccdd3"
|
|
54
53
|
}
|