@searchcraft/javascript-sdk 0.10.1 → 0.10.2
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/index.d.ts +123 -80
- package/dist/components/index.js +7 -33
- package/dist/components/index.js.map +1 -1
- package/dist/components/{p-84e2cbd6.js → p-01589c0b.js} +3 -3
- package/dist/components/{p-84e2cbd6.js.map → p-01589c0b.js.map} +1 -1
- package/dist/components/{p-5d17ace0.js → p-0f5b47be.js} +7 -7
- package/dist/components/{p-5d17ace0.js.map → p-0f5b47be.js.map} +1 -1
- package/dist/components/{p-0077f677.js → p-2999498a.js} +34 -22
- package/dist/components/p-2999498a.js.map +1 -0
- package/dist/components/{p-17c646e2.js → p-3465cbc7.js} +548 -474
- package/dist/components/p-3465cbc7.js.map +1 -0
- package/dist/components/{p-13e81b5d.js → p-435bec83.js} +2 -2
- package/dist/components/{p-13e81b5d.js.map → p-435bec83.js.map} +1 -1
- package/dist/components/{p-172a848d.js → p-48fa555e.js} +7 -7
- package/dist/components/{p-172a848d.js.map → p-48fa555e.js.map} +1 -1
- package/dist/components/p-4d37616e.js +105 -0
- package/dist/components/p-4d37616e.js.map +1 -0
- package/dist/components/{p-3e65aa91.js → p-66109c31.js} +3 -8
- package/dist/components/p-66109c31.js.map +1 -0
- package/dist/components/{p-2be1a382.js → p-760c6845.js} +2 -2
- package/dist/components/{p-2be1a382.js.map → p-760c6845.js.map} +1 -1
- package/dist/components/{p-868803f9.js → p-7c650118.js} +2 -2
- package/dist/components/{p-868803f9.js.map → p-7c650118.js.map} +1 -1
- package/dist/components/{p-a62a2e74.js → p-c1f43fe1.js} +4 -4
- package/dist/components/{p-a62a2e74.js.map → p-c1f43fe1.js.map} +1 -1
- package/dist/components/searchcraft-ad.js +1 -1
- package/dist/components/searchcraft-facet-list.js +1 -1
- package/dist/components/searchcraft-filter-panel.js +5 -5
- package/dist/components/searchcraft-input-form.js +1 -1
- package/dist/components/searchcraft-pagination.js +1 -1
- package/dist/components/searchcraft-popover-button.js +5 -3
- 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 +8 -8
- 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-search-result.js +1 -1
- package/dist/components/searchcraft-search-results-per-page.js +1 -1
- package/dist/components/searchcraft-search-results.js +69 -32
- package/dist/components/searchcraft-search-results.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/hydrate/index.js +484 -388
- package/dist/hydrate/index.mjs +484 -388
- package/dist/themes/hologram.css +1 -1
- package/dist/themes/hologram.css.map +1 -1
- package/dist/types/components/searchcraft-input-form/searchcraft-input-form.d.ts +7 -3
- package/dist/types/components/searchcraft-popover-button/searchcraft-popover-button.d.ts +3 -3
- package/dist/types/components/searchcraft-search-results/searchcraft-search-results.d.ts +10 -5
- package/dist/types/components.d.ts +20 -12
- package/dist/types/index.d.ts +0 -1
- package/dist/types/store/SearchcraftStore.types.d.ts +15 -6
- package/dist/types/utils/index.d.ts +0 -1
- package/dist/types/utils/units.d.ts +19 -6
- package/package.json +4 -7
- package/dist/components/p-0077f677.js.map +0 -1
- package/dist/components/p-17c646e2.js.map +0 -1
- package/dist/components/p-3e65aa91.js.map +0 -1
- package/dist/components/p-6104fe5d.js +0 -84
- package/dist/components/p-6104fe5d.js.map +0 -1
- package/dist/types/utils/styles.d.ts +0 -3
|
@@ -42,7 +42,7 @@ export type SearchResultFieldName = {
|
|
|
42
42
|
numberFormatLocale?: string;
|
|
43
43
|
/**
|
|
44
44
|
* If it's a number, the number format to apply.
|
|
45
|
-
*
|
|
45
|
+
* Reference: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat
|
|
46
46
|
*/
|
|
47
47
|
numberFormatOptions?: Intl.NumberFormatOptions;
|
|
48
48
|
/**
|
|
@@ -50,9 +50,14 @@ export type SearchResultFieldName = {
|
|
|
50
50
|
*/
|
|
51
51
|
numberScale?: number;
|
|
52
52
|
/**
|
|
53
|
-
*
|
|
53
|
+
* The locale to use when formatting dataType: `date`.
|
|
54
54
|
*/
|
|
55
|
-
|
|
55
|
+
dateFormatLocale?: string;
|
|
56
|
+
/**
|
|
57
|
+
* If it's a date, the date format to apply.
|
|
58
|
+
* Reference: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat
|
|
59
|
+
*/
|
|
60
|
+
dateFormatOptions?: Intl.DateTimeFormatOptions;
|
|
56
61
|
};
|
|
57
62
|
/**
|
|
58
63
|
* A data type representing the mapping of index fields, for the purpose of rendering them
|
|
@@ -138,7 +143,9 @@ export type CustomAdTemplate = (data: {
|
|
|
138
143
|
}, utils: {
|
|
139
144
|
html: TemplateHtml;
|
|
140
145
|
}) => string;
|
|
141
|
-
export type PopoverButtonTemplate = (data:
|
|
146
|
+
export type PopoverButtonTemplate = (data: {
|
|
147
|
+
isPopoverVisible: boolean;
|
|
148
|
+
}, utils: {
|
|
142
149
|
html: TemplateHtml;
|
|
143
150
|
}) => string;
|
|
144
151
|
/**
|
|
@@ -146,11 +153,11 @@ export type PopoverButtonTemplate = (data: boolean, utils: {
|
|
|
146
153
|
*/
|
|
147
154
|
export interface SearchcraftConfig {
|
|
148
155
|
/**
|
|
149
|
-
* Host IP Address and port number configured and created using Vektron
|
|
156
|
+
* Host IP Address and port number configured and created using Vektron.
|
|
150
157
|
*/
|
|
151
158
|
endpointURL: string;
|
|
152
159
|
/**
|
|
153
|
-
* Name or names of search indices configured using Vektron. Given as an array of strings
|
|
160
|
+
* Name or names of search indices configured using Vektron. Given as an array of strings.
|
|
154
161
|
*/
|
|
155
162
|
index: string[];
|
|
156
163
|
/**
|
|
@@ -169,6 +176,10 @@ export interface SearchcraftConfig {
|
|
|
169
176
|
* The maximum number of results to return per page.
|
|
170
177
|
*/
|
|
171
178
|
searchResultsPerPage?: number;
|
|
179
|
+
/**
|
|
180
|
+
* The name of the field to use for `order_by` when sorting.
|
|
181
|
+
*/
|
|
182
|
+
indexFieldName?: string;
|
|
172
183
|
/**
|
|
173
184
|
* Name of the ad source to use.
|
|
174
185
|
*/
|
|
@@ -301,6 +312,56 @@ export interface MeasureRequestUser {
|
|
|
301
312
|
latitude?: number;
|
|
302
313
|
longitude?: number;
|
|
303
314
|
}
|
|
315
|
+
export interface FacetPathsForIndexField {
|
|
316
|
+
fieldName: string;
|
|
317
|
+
value: string;
|
|
318
|
+
}
|
|
319
|
+
export interface RangeValueForIndexField {
|
|
320
|
+
fieldName: string;
|
|
321
|
+
value: string;
|
|
322
|
+
}
|
|
323
|
+
export interface SearchClientRequestProperties {
|
|
324
|
+
/**
|
|
325
|
+
* The search mode, which can be either 'fuzzy' or 'exact'.
|
|
326
|
+
*/
|
|
327
|
+
mode: "fuzzy" | "exact";
|
|
328
|
+
/**
|
|
329
|
+
* The starting point for the results, used for pagination.
|
|
330
|
+
* Optional parameter.
|
|
331
|
+
*/
|
|
332
|
+
offset?: number;
|
|
333
|
+
/**
|
|
334
|
+
* The number of results returned.
|
|
335
|
+
* Optional parameter.
|
|
336
|
+
*/
|
|
337
|
+
limit?: number;
|
|
338
|
+
/**
|
|
339
|
+
* The field to order the results by (e.g., 'date_published', 'title', etc.).
|
|
340
|
+
* Optional parameter.
|
|
341
|
+
*/
|
|
342
|
+
order_by?: string;
|
|
343
|
+
/**
|
|
344
|
+
* The search term provided by the user.
|
|
345
|
+
*/
|
|
346
|
+
searchTerm: string;
|
|
347
|
+
/**
|
|
348
|
+
* The sort order, which can be either 'asc' or 'desc'.
|
|
349
|
+
* Optional parameter.
|
|
350
|
+
*/
|
|
351
|
+
sort?: "asc" | "desc";
|
|
352
|
+
/**
|
|
353
|
+
* The facet path value(s) specified by the `facets` filter items that the `searchcraft-filter-panel` renders.
|
|
354
|
+
* There may be multiple rendered within a single filter panel.
|
|
355
|
+
* Optional parameter.
|
|
356
|
+
*/
|
|
357
|
+
facetPathsForIndexFields?: Record<string, FacetPathsForIndexField>;
|
|
358
|
+
/**
|
|
359
|
+
* The date range slider value(s) specified by the `dateRange` filter items that the `searchcraft-filter-panel` renders.
|
|
360
|
+
* There may be multiple rendered within a single filter panel.
|
|
361
|
+
* Optional parameter.
|
|
362
|
+
*/
|
|
363
|
+
rangeValueForIndexFields?: Record<string, RangeValueForIndexField>;
|
|
364
|
+
}
|
|
304
365
|
/**
|
|
305
366
|
* The structure of a response returned from a Searchcraft operation.
|
|
306
367
|
*/
|
|
@@ -327,13 +388,13 @@ export type SearchcraftResponseError = {
|
|
|
327
388
|
export interface SearchcraftResponseData {
|
|
328
389
|
count?: number;
|
|
329
390
|
facets?: FacetPrime;
|
|
330
|
-
hits?:
|
|
391
|
+
hits?: SearchIndexHit[];
|
|
331
392
|
time_taken?: number;
|
|
332
393
|
}
|
|
333
394
|
/**
|
|
334
395
|
* Represents an entry in the search index returned as part of a search result.
|
|
335
396
|
*/
|
|
336
|
-
export interface
|
|
397
|
+
export interface SearchIndexHit {
|
|
337
398
|
doc?: SearchDocument;
|
|
338
399
|
document_id?: string;
|
|
339
400
|
score?: number;
|
|
@@ -349,54 +410,12 @@ export interface SearchClientResponseItem {
|
|
|
349
410
|
id: string;
|
|
350
411
|
document: SearchDocument;
|
|
351
412
|
}
|
|
352
|
-
export type FacetPathsForIndexField = {
|
|
353
|
-
fieldName: string;
|
|
354
|
-
value: string;
|
|
355
|
-
};
|
|
356
|
-
export type RangeValueForIndexField = {
|
|
357
|
-
fieldName: string;
|
|
358
|
-
value: string;
|
|
359
|
-
};
|
|
360
|
-
/**
|
|
361
|
-
* Parameters required to make a successful Search request.
|
|
362
|
-
*/
|
|
363
|
-
export type SearchParams = {
|
|
364
|
-
/**
|
|
365
|
-
* The search mode, which can be either 'fuzzy' or 'exact'.
|
|
366
|
-
*/
|
|
367
|
-
mode: "fuzzy" | "exact";
|
|
368
|
-
/**
|
|
369
|
-
* The starting point for the results, used for pagination.
|
|
370
|
-
* Optional parameter.
|
|
371
|
-
*/
|
|
372
|
-
offset?: number;
|
|
373
|
-
/**
|
|
374
|
-
* The number of results returned.
|
|
375
|
-
* Optional parameter.
|
|
376
|
-
*/
|
|
377
|
-
limit?: number;
|
|
378
|
-
/**
|
|
379
|
-
* The field to order the results by (e.g., 'date_published', 'title', etc.).
|
|
380
|
-
* Optional parameter.
|
|
381
|
-
*/
|
|
382
|
-
order_by?: string;
|
|
383
|
-
/**
|
|
384
|
-
* The search term provided by the user.
|
|
385
|
-
*/
|
|
386
|
-
searchTerm: string;
|
|
387
|
-
/**
|
|
388
|
-
* The sort order, which can be either 'asc' or 'desc'.
|
|
389
|
-
* Optional parameter.
|
|
390
|
-
*/
|
|
391
|
-
sort?: "asc" | "desc";
|
|
392
|
-
facetPathsForIndexFields?: Record<string, FacetPathsForIndexField>;
|
|
393
|
-
rangeValueForIndexFields?: Record<string, RangeValueForIndexField>;
|
|
394
|
-
};
|
|
395
413
|
export interface SubscriptionEventMap {
|
|
396
414
|
ad_container_rendered: AdContainerRenderedSubscriptionEvent;
|
|
397
415
|
ad_container_viewed: AdContainerViewedSubscriptionEvent;
|
|
398
416
|
query_fetched: QueryFetchedEvent;
|
|
399
417
|
query_submitted: QuerySubmittedEvent;
|
|
418
|
+
initialized: InitializedEvent;
|
|
400
419
|
input_cleared: InputClearedEvent;
|
|
401
420
|
no_results_returned: NoResultsReturnedEvent;
|
|
402
421
|
}
|
|
@@ -434,6 +453,9 @@ export interface InputClearedEvent extends SubscriptionEvent {
|
|
|
434
453
|
export interface NoResultsReturnedEvent extends SubscriptionEvent {
|
|
435
454
|
name: "no_results_returned";
|
|
436
455
|
}
|
|
456
|
+
export interface InitializedEvent extends SubscriptionEvent {
|
|
457
|
+
name: "initialized";
|
|
458
|
+
}
|
|
437
459
|
export type SubscriptionEventName = keyof SubscriptionEventMap;
|
|
438
460
|
export type SubscriptionEventCallback<T extends SubscriptionEventName> = (event: SubscriptionEventMap[T]) => void;
|
|
439
461
|
export type UnsubscribeFunction = () => void;
|
|
@@ -443,9 +465,9 @@ export interface SubscriptionEvent {
|
|
|
443
465
|
declare class AdClient {
|
|
444
466
|
config: SearchcraftConfig;
|
|
445
467
|
constructor(config: SearchcraftConfig);
|
|
446
|
-
|
|
447
|
-
onQuerySubmitted(
|
|
448
|
-
onQueryFetched(
|
|
468
|
+
getAds(_properties: SearchClientRequestProperties): Promise<AdClientResponseItem[]>;
|
|
469
|
+
onQuerySubmitted(_properties: SearchClientRequestProperties): Promise<void>;
|
|
470
|
+
onQueryFetched(_properties: SearchClientRequestProperties, _response: SearchcraftResponse): Promise<void>;
|
|
449
471
|
onInputCleared(): Promise<void>;
|
|
450
472
|
onAdContainerRendered(_data: {
|
|
451
473
|
adClientResponseItem?: AdClientResponseItem;
|
|
@@ -496,10 +518,19 @@ declare class SearchClient {
|
|
|
496
518
|
*/
|
|
497
519
|
private get baseSearchUrl();
|
|
498
520
|
/**
|
|
499
|
-
*
|
|
500
|
-
* @param {
|
|
521
|
+
* Make the request to get the search results.
|
|
522
|
+
* @param {properties} properties - The properties for the search.
|
|
523
|
+
* @returns
|
|
524
|
+
*/
|
|
525
|
+
getSearchResponseItems: (properties: SearchClientRequestProperties | string) => Promise<SearchcraftResponse>;
|
|
526
|
+
private handleGetSearchResponseItemsWithString;
|
|
527
|
+
private handleGetSearchResponseItemsWithObject;
|
|
528
|
+
/**
|
|
529
|
+
* Builds a query object for the SearchClient request.
|
|
530
|
+
* @param {properties} properties - The properties for the search.
|
|
531
|
+
* @returns {SearchClientQuery} - A properly formatted SearchClient query object.
|
|
501
532
|
*/
|
|
502
|
-
|
|
533
|
+
private formatParamsForRequest;
|
|
503
534
|
}
|
|
504
535
|
/**
|
|
505
536
|
* Javascript Class providing the functionality to interact with the Searchcraft BE
|
|
@@ -543,25 +574,28 @@ export declare class SearchcraftCore {
|
|
|
543
574
|
* Perform various actions when the input is cleared
|
|
544
575
|
*/
|
|
545
576
|
handleInputCleared(): void;
|
|
546
|
-
|
|
547
|
-
* Gets items from the SearchClient and the AdClient.
|
|
548
|
-
*/
|
|
549
|
-
getItems: (searchParams: SearchParams, itemsCallback: (response: SearchcraftResponse, items: SearchClientResponseItem[]) => void, adCallback: (adClientResponseItems: AdClientResponseItem[]) => void) => void;
|
|
577
|
+
getResponseItems: (properties: SearchClientRequestProperties | string, searchCallback: (response: SearchcraftResponse, items: SearchClientResponseItem[]) => void, adCallback: (items: AdClientResponseItem[]) => void) => void;
|
|
550
578
|
}
|
|
551
579
|
/**
|
|
552
580
|
* Callable functions made available by the SearchcraftStore.
|
|
553
581
|
*/
|
|
554
582
|
export interface SearchcraftStateFunctions {
|
|
555
|
-
addFacetPathsForIndexField: (
|
|
556
|
-
addRangeValueForIndexField: (
|
|
557
|
-
|
|
558
|
-
|
|
583
|
+
addFacetPathsForIndexField: (field: FacetPathsForIndexField) => void;
|
|
584
|
+
addRangeValueForIndexField: (field: RangeValueForIndexField) => void;
|
|
585
|
+
getSearchcraftCore: () => SearchcraftCore | undefined;
|
|
586
|
+
init: (searchcraft: SearchcraftCore | undefined, debug?: boolean) => void;
|
|
559
587
|
removeFacetPathsForIndexField: (fieldName: string) => void;
|
|
560
588
|
removeRangeValueForIndexField: (fieldName: string) => void;
|
|
561
589
|
resetFacetPaths: () => void;
|
|
562
590
|
search: () => Promise<void>;
|
|
591
|
+
set: (state: Partial<SearchcraftState> | ((state: SearchcraftState) => Partial<SearchcraftState>)) => SearchcraftState;
|
|
592
|
+
setAdClientResponseItems: (items: AdClientResponseItem[]) => void;
|
|
593
|
+
setSearchClientResponseItemsFromResponse: (response: SearchcraftResponse, items: SearchClientResponseItem[]) => void;
|
|
594
|
+
setInitialSearchClientResponseItemsFromResponse: (response: SearchcraftResponse, items: SearchClientResponseItem[]) => void;
|
|
595
|
+
setInitialQuery: (query: string) => void;
|
|
563
596
|
setPopoverVisibility: (isVisible: boolean) => void;
|
|
564
|
-
|
|
597
|
+
setSearchResultsCount: (count: number) => void;
|
|
598
|
+
setSearchClientResponseItems: (items: SearchClientResponseItem[]) => void;
|
|
565
599
|
setSearchResultsPage: (page: number) => void;
|
|
566
600
|
setSearchResultsPerPage: (perPage: number) => void;
|
|
567
601
|
setSearchTerm: (searchTerm: string) => void;
|
|
@@ -579,6 +613,8 @@ export interface SearchcraftStateValues {
|
|
|
579
613
|
hotkeyModifier: "ctrl" | "meta" | "alt" | "option";
|
|
580
614
|
logger: Logger | undefined;
|
|
581
615
|
facetPathsForIndexFields: Record<string, FacetPathsForIndexField>;
|
|
616
|
+
initialQuery: string;
|
|
617
|
+
initialSearchClientResponseItems: SearchClientResponseItem[];
|
|
582
618
|
isPopoverVisible: boolean;
|
|
583
619
|
isSearchInProgress: boolean;
|
|
584
620
|
rangeValueForIndexFields: Record<string, RangeValueForIndexField>;
|
|
@@ -591,12 +627,11 @@ export interface SearchcraftStateValues {
|
|
|
591
627
|
searchResultsPerPage: number;
|
|
592
628
|
searchTerm: string;
|
|
593
629
|
sortType: "asc" | "desc";
|
|
630
|
+
afterInit: (state: SearchcraftState) => void;
|
|
594
631
|
}
|
|
595
632
|
export interface SearchcraftState extends SearchcraftStateFunctions, SearchcraftStateValues {
|
|
596
633
|
}
|
|
597
634
|
export declare const searchcraftStore: import("zustand").StoreApi<SearchcraftState>;
|
|
598
|
-
export declare function parseCustomStyles(styles: string | Record<string, string>): Record<string, string>;
|
|
599
|
-
export declare function serializeStyles(styles: Record<string, Record<string, string>>): string;
|
|
600
635
|
export type SearchcraftSelectOption = {
|
|
601
636
|
label: string;
|
|
602
637
|
value: string | number;
|
|
@@ -800,13 +835,13 @@ export namespace Components {
|
|
|
800
835
|
* ```js
|
|
801
836
|
* // index.js
|
|
802
837
|
* const popoverButton = document.querySelector('searchcraft-popover-button');
|
|
803
|
-
* popoverButton.template = (isPopoverVisible, { html }) => html`
|
|
838
|
+
* popoverButton.template = ({ isPopoverVisible }, { html }) => html`
|
|
804
839
|
* <span>Click me</span>
|
|
805
840
|
* `;
|
|
806
841
|
* ```
|
|
807
842
|
* @react-example ```jsx
|
|
808
843
|
* <SearchcraftPopoverButton
|
|
809
|
-
* template={(isPopoverVisible, { html }) => html`
|
|
844
|
+
* template={({ isPopoverVisible }, { html }) => html`
|
|
810
845
|
* <span>Click me</span>
|
|
811
846
|
* `}
|
|
812
847
|
* >
|
|
@@ -815,7 +850,7 @@ export namespace Components {
|
|
|
815
850
|
* ```
|
|
816
851
|
* @vue-example ```jsx
|
|
817
852
|
* <SearchcraftPopoverButton
|
|
818
|
-
* :template={(isPopoverVisible, { html }) => html`
|
|
853
|
+
* :template={({ isPopoverVisible }, { html }) => html`
|
|
819
854
|
* <span>Click me</span>
|
|
820
855
|
* `}
|
|
821
856
|
* >
|
|
@@ -1011,6 +1046,10 @@ export namespace Components {
|
|
|
1011
1046
|
* ```
|
|
1012
1047
|
*/
|
|
1013
1048
|
interface SearchcraftSearchResults {
|
|
1049
|
+
/**
|
|
1050
|
+
* A query that will appears when the component initializes or the search term is ''..
|
|
1051
|
+
*/
|
|
1052
|
+
"initialQuery"?: string;
|
|
1014
1053
|
/**
|
|
1015
1054
|
* A callback function responsible for rendering a result. Passed to `searchcraft-search-result`.
|
|
1016
1055
|
*/
|
|
@@ -1363,13 +1402,13 @@ declare global {
|
|
|
1363
1402
|
* ```js
|
|
1364
1403
|
* // index.js
|
|
1365
1404
|
* const popoverButton = document.querySelector('searchcraft-popover-button');
|
|
1366
|
-
* popoverButton.template = (isPopoverVisible, { html }) => html`
|
|
1405
|
+
* popoverButton.template = ({ isPopoverVisible }, { html }) => html`
|
|
1367
1406
|
* <span>Click me</span>
|
|
1368
1407
|
* `;
|
|
1369
1408
|
* ```
|
|
1370
1409
|
* @react-example ```jsx
|
|
1371
1410
|
* <SearchcraftPopoverButton
|
|
1372
|
-
* template={(isPopoverVisible, { html }) => html`
|
|
1411
|
+
* template={({ isPopoverVisible }, { html }) => html`
|
|
1373
1412
|
* <span>Click me</span>
|
|
1374
1413
|
* `}
|
|
1375
1414
|
* >
|
|
@@ -1378,7 +1417,7 @@ declare global {
|
|
|
1378
1417
|
* ```
|
|
1379
1418
|
* @vue-example ```jsx
|
|
1380
1419
|
* <SearchcraftPopoverButton
|
|
1381
|
-
* :template={(isPopoverVisible, { html }) => html`
|
|
1420
|
+
* :template={({ isPopoverVisible }, { html }) => html`
|
|
1382
1421
|
* <span>Click me</span>
|
|
1383
1422
|
* `}
|
|
1384
1423
|
* >
|
|
@@ -1910,13 +1949,13 @@ declare namespace LocalJSX {
|
|
|
1910
1949
|
* ```js
|
|
1911
1950
|
* // index.js
|
|
1912
1951
|
* const popoverButton = document.querySelector('searchcraft-popover-button');
|
|
1913
|
-
* popoverButton.template = (isPopoverVisible, { html }) => html`
|
|
1952
|
+
* popoverButton.template = ({ isPopoverVisible }, { html }) => html`
|
|
1914
1953
|
* <span>Click me</span>
|
|
1915
1954
|
* `;
|
|
1916
1955
|
* ```
|
|
1917
1956
|
* @react-example ```jsx
|
|
1918
1957
|
* <SearchcraftPopoverButton
|
|
1919
|
-
* template={(isPopoverVisible, { html }) => html`
|
|
1958
|
+
* template={({ isPopoverVisible }, { html }) => html`
|
|
1920
1959
|
* <span>Click me</span>
|
|
1921
1960
|
* `}
|
|
1922
1961
|
* >
|
|
@@ -1925,7 +1964,7 @@ declare namespace LocalJSX {
|
|
|
1925
1964
|
* ```
|
|
1926
1965
|
* @vue-example ```jsx
|
|
1927
1966
|
* <SearchcraftPopoverButton
|
|
1928
|
-
* :template={(isPopoverVisible, { html }) => html`
|
|
1967
|
+
* :template={({ isPopoverVisible }, { html }) => html`
|
|
1929
1968
|
* <span>Click me</span>
|
|
1930
1969
|
* `}
|
|
1931
1970
|
* >
|
|
@@ -2121,6 +2160,10 @@ declare namespace LocalJSX {
|
|
|
2121
2160
|
* ```
|
|
2122
2161
|
*/
|
|
2123
2162
|
interface SearchcraftSearchResults {
|
|
2163
|
+
/**
|
|
2164
|
+
* A query that will appears when the component initializes or the search term is ''..
|
|
2165
|
+
*/
|
|
2166
|
+
"initialQuery"?: string;
|
|
2124
2167
|
/**
|
|
2125
2168
|
* A callback function responsible for rendering a result. Passed to `searchcraft-search-result`.
|
|
2126
2169
|
*/
|
|
@@ -2409,13 +2452,13 @@ declare module "@stencil/core" {
|
|
|
2409
2452
|
* ```js
|
|
2410
2453
|
* // index.js
|
|
2411
2454
|
* const popoverButton = document.querySelector('searchcraft-popover-button');
|
|
2412
|
-
* popoverButton.template = (isPopoverVisible, { html }) => html`
|
|
2455
|
+
* popoverButton.template = ({ isPopoverVisible }, { html }) => html`
|
|
2413
2456
|
* <span>Click me</span>
|
|
2414
2457
|
* `;
|
|
2415
2458
|
* ```
|
|
2416
2459
|
* @react-example ```jsx
|
|
2417
2460
|
* <SearchcraftPopoverButton
|
|
2418
|
-
* template={(isPopoverVisible, { html }) => html`
|
|
2461
|
+
* template={({ isPopoverVisible }, { html }) => html`
|
|
2419
2462
|
* <span>Click me</span>
|
|
2420
2463
|
* `}
|
|
2421
2464
|
* >
|
|
@@ -2424,7 +2467,7 @@ declare module "@stencil/core" {
|
|
|
2424
2467
|
* ```
|
|
2425
2468
|
* @vue-example ```jsx
|
|
2426
2469
|
* <SearchcraftPopoverButton
|
|
2427
|
-
* :template={(isPopoverVisible, { html }) => html`
|
|
2470
|
+
* :template={({ isPopoverVisible }, { html }) => html`
|
|
2428
2471
|
* <span>Click me</span>
|
|
2429
2472
|
* `}
|
|
2430
2473
|
* >
|
package/dist/components/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
export { g as getAssetPath, s as setAssetPath, a as setNonce, b as setPlatformOptions } from './p-5365011f.js';
|
|
2
|
-
import {
|
|
3
|
-
export {
|
|
4
|
-
import './p-a64b4cba.js';
|
|
2
|
+
import { v as ve } from './p-3465cbc7.js';
|
|
3
|
+
export { v as SearchcraftCore, s as searchcraftStore } from './p-3465cbc7.js';
|
|
5
4
|
export { SearchcraftAd, defineCustomElement as defineCustomElementSearchcraftAd } from './searchcraft-ad.js';
|
|
6
5
|
export { SearchcraftButton, defineCustomElement as defineCustomElementSearchcraftButton } from './searchcraft-button.js';
|
|
7
6
|
export { SearchcraftErrorMessage, defineCustomElement as defineCustomElementSearchcraftErrorMessage } from './searchcraft-error-message.js';
|
|
@@ -25,7 +24,7 @@ export { SearchcraftTheme, defineCustomElement as defineCustomElementSearchcraft
|
|
|
25
24
|
export { SearchcraftToggleButton, defineCustomElement as defineCustomElementSearchcraftToggleButton } from './searchcraft-toggle-button.js';
|
|
26
25
|
|
|
27
26
|
const name = "@searchcraft/javascript-sdk";
|
|
28
|
-
const version = "0.10.
|
|
27
|
+
const version = "0.10.2";
|
|
29
28
|
const description = "Searchcraft Javascript SDK";
|
|
30
29
|
const author = "Searchcraft Inc.";
|
|
31
30
|
const license = "Apache-2.0";
|
|
@@ -45,10 +44,7 @@ const exports = {
|
|
|
45
44
|
"import": "./dist/hydrate/index.mjs",
|
|
46
45
|
types: "./dist/hydrate/index.d.ts"
|
|
47
46
|
},
|
|
48
|
-
"./themes/*.css":
|
|
49
|
-
"import": "./dist/themes/*.css",
|
|
50
|
-
require: "./dist/themes/*.css"
|
|
51
|
-
}
|
|
47
|
+
"./themes/*.css": "./dist/themes/*.css"
|
|
52
48
|
};
|
|
53
49
|
const repository = {
|
|
54
50
|
type: "git",
|
|
@@ -71,7 +67,7 @@ const dependencies = {
|
|
|
71
67
|
nanoid: "^5.0.9"
|
|
72
68
|
};
|
|
73
69
|
const devDependencies = {
|
|
74
|
-
"@searchcraft/core": "^0.10.
|
|
70
|
+
"@searchcraft/core": "^0.10.2",
|
|
75
71
|
"@stencil/core": "^4.7.0",
|
|
76
72
|
"@stencil/react-output-target": "^0.8.2",
|
|
77
73
|
"@stencil/sass": "^3.0.12",
|
|
@@ -96,28 +92,6 @@ const packageJson = {
|
|
|
96
92
|
devDependencies: devDependencies
|
|
97
93
|
};
|
|
98
94
|
|
|
99
|
-
function parseCustomStyles(styles) {
|
|
100
|
-
if (typeof styles === 'string') {
|
|
101
|
-
try {
|
|
102
|
-
return JSON.parse(styles);
|
|
103
|
-
}
|
|
104
|
-
catch (error) {
|
|
105
|
-
console.error('Invalid customStyles format:', styles);
|
|
106
|
-
return {};
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
return styles || {};
|
|
110
|
-
}
|
|
111
|
-
function serializeStyles(styles) {
|
|
112
|
-
try {
|
|
113
|
-
return JSON.stringify(styles);
|
|
114
|
-
}
|
|
115
|
-
catch (error) {
|
|
116
|
-
console.error('Error serializing styles:', error);
|
|
117
|
-
return '{}';
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
|
|
121
95
|
/**
|
|
122
96
|
* @fileoverview entry point for your component library
|
|
123
97
|
*
|
|
@@ -130,7 +104,7 @@ function serializeStyles(styles) {
|
|
|
130
104
|
/**
|
|
131
105
|
* The consumer-facing `Searchcraft` class.
|
|
132
106
|
*/
|
|
133
|
-
class Searchcraft extends
|
|
107
|
+
class Searchcraft extends ve {
|
|
134
108
|
constructor(config) {
|
|
135
109
|
super(config, {
|
|
136
110
|
sdkName: packageJson.name,
|
|
@@ -139,7 +113,7 @@ class Searchcraft extends we {
|
|
|
139
113
|
}
|
|
140
114
|
}
|
|
141
115
|
|
|
142
|
-
export { Searchcraft
|
|
116
|
+
export { Searchcraft };
|
|
143
117
|
|
|
144
118
|
//# sourceMappingURL=index.js.map
|
|
145
119
|
export { defineCustomElements } from './defineCustomElements.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"index.js","mappings":"
|
|
1
|
+
{"file":"index.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA;;;;;;;;;AAUA;;;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 */\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 { SearchcraftConfig };\nexport { searchcraftStore };\nexport type { Components, JSX } from './components';\nexport { SearchcraftCore };\nexport type * from '@searchcraft/core/dist/types/sdk-types';\n"],"version":3}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { p as proxyCustomElement, H, h } from './p-5365011f.js';
|
|
2
|
-
import { s as searchcraftStore } from './p-
|
|
3
|
-
import { f as formatNumberWithCommas } from './p-
|
|
2
|
+
import { s as searchcraftStore } from './p-3465cbc7.js';
|
|
3
|
+
import { f as formatNumberWithCommas } from './p-4d37616e.js';
|
|
4
4
|
import './p-a64b4cba.js';
|
|
5
5
|
|
|
6
6
|
const SearchcraftPopoverFooter = /*@__PURE__*/ proxyCustomElement(class SearchcraftPopoverFooter extends H {
|
|
@@ -43,4 +43,4 @@ function defineCustomElement() {
|
|
|
43
43
|
|
|
44
44
|
export { SearchcraftPopoverFooter as S, defineCustomElement as d };
|
|
45
45
|
|
|
46
|
-
//# sourceMappingURL=p-
|
|
46
|
+
//# sourceMappingURL=p-01589c0b.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"p-
|
|
1
|
+
{"file":"p-01589c0b.js","mappings":";;;;;MAca,wBAAwB;;;;;IAC1B,kBAAkB,CAAC;IAEpB,WAAW,GAAe,SAAQ,CAAC;IAE3C,gBAAgB;QACd,IAAI,CAAC,kBAAkB,GAAG,gBAAgB,CAAC,QAAQ,EAAE,CAAC,kBAAkB,CAAC;QAEzE,IAAI,CAAC,WAAW,GAAG,gBAAgB,CAAC,SAAS,CAAC,CAAC,KAAK;YAClD,IAAI,CAAC,kBAAkB,GAAG,KAAK,CAAC,kBAAkB,CAAC;SACpD,CAAC,CAAC;KACJ;IAED,oBAAoB;QAClB,IAAI,CAAC,WAAW,IAAI,CAAC;KACtB;IAED,MAAM;QACJ,QACE,+DAAQ,KAAK,EAAC,4BAA4B,IACxC,0DAAG,KAAK,EAAC,yCAAyC,IAC/C,IAAI,CAAC,kBAAkB;cACpB,GAAG,sBAAsB,CAAC,IAAI,CAAC,kBAAkB,CAAC,gBAAgB;cAClE,GAAG,CACL,EACJ,0DACE,KAAK,EAAC,iCAAiC,EACvC,IAAI,EAAC,yBAAyB,EAC9B,MAAM,EAAC,QAAQ,EACf,GAAG,EAAC,YAAY,IAEhB,4DACE,KAAK,EAAC,uCAAuC,EAC7C,KAAK,EAAC,KAAK,EACX,MAAM,EAAC,IAAI,EACX,OAAO,EAAC,YAAY,EACpB,IAAI,EAAC,MAAM,EACX,KAAK,EAAC,4BAA4B,IAElC,yFAAqC,EACrC,6DACE,CAAC,EAAC,kmOAAkmO,EACpmO,IAAI,EAAC,cAAc,GACnB,CACE,CACJ,CACG,EACT;KACH;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/searchcraft-popover-footer/searchcraft-popover-footer.tsx"],"sourcesContent":["import { searchcraftStore } from '@store';\nimport { Component, h, 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 @State() searchResultsCount;\n\n private unsubscribe: () => void = () => {};\n\n componentDidLoad() {\n this.searchResultsCount = searchcraftStore.getState().searchResultsCount;\n\n this.unsubscribe = searchcraftStore.subscribe((state) => {\n this.searchResultsCount = state.searchResultsCount;\n });\n }\n\n disconnectedCallback() {\n this.unsubscribe?.();\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 { s as searchcraftStore } from './p-
|
|
3
|
-
import { a as getDocumentValueFromSearchResultMapping } from './p-
|
|
2
|
+
import { s as searchcraftStore } from './p-3465cbc7.js';
|
|
3
|
+
import { a as getDocumentValueFromSearchResultMapping } from './p-4d37616e.js';
|
|
4
4
|
import './p-a64b4cba.js';
|
|
5
5
|
|
|
6
6
|
const SearchcraftPopoverListItem = /*@__PURE__*/ proxyCustomElement(class SearchcraftPopoverListItem extends H {
|
|
@@ -32,12 +32,12 @@ const SearchcraftPopoverListItem = /*@__PURE__*/ proxyCustomElement(class Search
|
|
|
32
32
|
disconnectedCallback() { }
|
|
33
33
|
handleLinkClick = () => {
|
|
34
34
|
const state = searchcraftStore.getState();
|
|
35
|
-
const
|
|
36
|
-
if (
|
|
35
|
+
const core = state.getSearchcraftCore();
|
|
36
|
+
if (core) {
|
|
37
37
|
const document_position = this.documentPosition;
|
|
38
38
|
const search_term = state.searchTerm;
|
|
39
39
|
const number_of_documents = state.searchClientResponseItems.length || 0;
|
|
40
|
-
|
|
40
|
+
core.measureClient?.sendMeasureEvent('document_clicked', {
|
|
41
41
|
document_position,
|
|
42
42
|
number_of_documents,
|
|
43
43
|
search_term,
|
|
@@ -45,7 +45,7 @@ const SearchcraftPopoverListItem = /*@__PURE__*/ proxyCustomElement(class Search
|
|
|
45
45
|
}
|
|
46
46
|
};
|
|
47
47
|
render() {
|
|
48
|
-
return (h("div", { key: '
|
|
48
|
+
return (h("div", { key: '63a2f070ce71cd1330105c03985e32cd1f228b29', class: 'searchcraft-popover-list-item' }, h("a", { key: 'd9bb09248be9be235147acdfeed1a9f29cd123a2', class: 'searchcraft-popover-list-item-link', href: this.href, onClick: this.handleLinkClick.bind(this) }, this.imageSource && (h("div", { key: '6af7c3e754885730d8651a593f13b7b5b704a26d', class: 'searchcraft-popover-list-item-image-wrapper' }, h("img", { key: '74c7e53467efd83ae95439a7065c1de2748113f5', alt: this.imageAlt, src: this.imageSource, class: 'searchcraft-popover-list-item-image' }))), h("div", { key: '25a12e5cf582b248773005f5fb58f7a15304d2d1', class: 'searchcraft-popover-list-item-content' }, this.title && (h("p", { key: '8169f7730feb832178adbc9bdb14a089e955a2ad', class: 'searchcraft-popover-list-item-content-title' }, this.title)), this.subtitle && (h("p", { key: '96812df1bab635e3865bdfdb31f133ca629d800e', class: 'searchcraft-popover-list-item-content-subtitle' }, this.subtitle))))));
|
|
49
49
|
}
|
|
50
50
|
}, [0, "searchcraft-popover-list-item", {
|
|
51
51
|
"item": [16],
|
|
@@ -73,4 +73,4 @@ function defineCustomElement() {
|
|
|
73
73
|
|
|
74
74
|
export { SearchcraftPopoverListItem as S, defineCustomElement as d };
|
|
75
75
|
|
|
76
|
-
//# sourceMappingURL=p-
|
|
76
|
+
//# sourceMappingURL=p-0f5b47be.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"p-
|
|
1
|
+
{"file":"p-0f5b47be.js","mappings":";;;;;MAkBa,0BAA0B;;;;;IAC7B,IAAI,CAAuC;IAC3C,qBAAqB,CAAoC;;IAEzD,gBAAgB,GAAG,CAAC,CAAC;IAEpB,KAAK,CAAU;IACf,QAAQ,CAAU;IAClB,IAAI,CAAU;IACd,WAAW,CAAU;IACrB,QAAQ,CAAU;IAE3B,qBAAqB,CAAC,QAAwB;QAC5C,IAAI,CAAC,KAAK,GAAG,uCAAuC,CAClD,QAAQ,EACR,IAAI,CAAC,qBAAqB,EAAE,KAAK,CAClC,CAAC;QACF,IAAI,CAAC,QAAQ,GAAG,uCAAuC,CACrD,QAAQ,EACR,IAAI,CAAC,qBAAqB,EAAE,QAAQ,CACrC,CAAC;QACF,IAAI,CAAC,IAAI,GAAG,uCAAuC,CACjD,QAAQ,EACR,IAAI,CAAC,qBAAqB,EAAE,IAAI,CACjC,CAAC;QACF,IAAI,CAAC,WAAW,GAAG,uCAAuC,CACxD,QAAQ,EACR,IAAI,CAAC,qBAAqB,EAAE,WAAW,CACxC,CAAC;QACF,IAAI,CAAC,QAAQ,GAAG,uCAAuC,CACrD,QAAQ,EACR,IAAI,CAAC,qBAAqB,EAAE,QAAQ,CACrC,CAAC;KACH;IAED,iBAAiB;QACf,IAAI,IAAI,CAAC,IAAI,EAAE;YACb,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;SAChD;KACF;IAED,oBAAoB,MAAK;IAEzB,eAAe,GAAG;QAChB,MAAM,KAAK,GAAG,gBAAgB,CAAC,QAAQ,EAAE,CAAC;QAC1C,MAAM,IAAI,GAAG,KAAK,CAAC,kBAAkB,EAAE,CAAC;QAExC,IAAI,IAAI,EAAE;YACR,MAAM,iBAAiB,GAAG,IAAI,CAAC,gBAAgB,CAAC;YAChD,MAAM,WAAW,GAAG,KAAK,CAAC,UAAU,CAAC;YACrC,MAAM,mBAAmB,GAAG,KAAK,CAAC,yBAAyB,CAAC,MAAM,IAAI,CAAC,CAAC;YAExE,IAAI,CAAC,aAAa,EAAE,gBAAgB,CAAC,kBAAkB,EAAE;gBACvD,iBAAiB;gBACjB,mBAAmB;gBACnB,WAAW;aACZ,CAAC,CAAC;SACJ;KACF,CAAC;IAEF,MAAM;QACJ,QACE,4DAAK,KAAK,EAAC,+BAA+B,IACxC,0DACE,KAAK,EAAC,oCAAoC,EAC1C,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,OAAO,EAAE,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,IAEvC,IAAI,CAAC,WAAW,KACf,4DAAK,KAAK,EAAC,6CAA6C,IACtD,4DACE,GAAG,EAAE,IAAI,CAAC,QAAQ,EAClB,GAAG,EAAE,IAAI,CAAC,WAAW,EACrB,KAAK,EAAC,qCAAqC,GAC3C,CACE,CACP,EACD,4DAAK,KAAK,EAAC,uCAAuC,IAC/C,IAAI,CAAC,KAAK,KACT,0DAAG,KAAK,EAAC,6CAA6C,IACnD,IAAI,CAAC,KAAK,CACT,CACL,EACA,IAAI,CAAC,QAAQ,KACZ,0DAAG,KAAK,EAAC,gDAAgD,IACtD,IAAI,CAAC,QAAQ,CACZ,CACL,CACG,CACJ,CACA,EACN;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/searchcraft-popover-list-item/searchcraft-popover-list-item.tsx"],"sourcesContent":["import { searchcraftStore } from '@store';\nimport type {\n SearchDocument,\n SearchClientResponseItem,\n PopoverResultMappings,\n} from '@searchcraft/core';\nimport { Component, h, Prop, State } from '@stencil/core';\nimport { getDocumentValueFromSearchResultMapping } from '@utils';\n\n/**\n * A single list item rendered in a searchcraft-popover-list-view.\n *\n * @internal\n */\n@Component({\n tag: 'searchcraft-popover-list-item',\n shadow: false,\n})\nexport class SearchcraftPopoverListItem {\n @Prop() item: SearchClientResponseItem | undefined;\n @Prop() popoverResultMappings: PopoverResultMappings | undefined;\n /** The document position relative to the search results (For Measure) */\n @Prop() documentPosition = 0;\n\n @State() title?: string;\n @State() subtitle?: string;\n @State() href?: string;\n @State() imageSource?: string;\n @State() imageAlt?: string;\n\n mapValuesFromDocument(document: SearchDocument) {\n this.title = getDocumentValueFromSearchResultMapping(\n document,\n this.popoverResultMappings?.title,\n );\n this.subtitle = getDocumentValueFromSearchResultMapping(\n document,\n this.popoverResultMappings?.subtitle,\n );\n this.href = getDocumentValueFromSearchResultMapping(\n document,\n this.popoverResultMappings?.href,\n );\n this.imageSource = getDocumentValueFromSearchResultMapping(\n document,\n this.popoverResultMappings?.imageSource,\n );\n this.imageAlt = getDocumentValueFromSearchResultMapping(\n document,\n this.popoverResultMappings?.imageAlt,\n );\n }\n\n connectedCallback() {\n if (this.item) {\n this.mapValuesFromDocument(this.item.document);\n }\n }\n\n disconnectedCallback() {}\n\n handleLinkClick = () => {\n const state = searchcraftStore.getState();\n const core = state.getSearchcraftCore();\n\n if (core) {\n const document_position = this.documentPosition;\n const search_term = state.searchTerm;\n const number_of_documents = state.searchClientResponseItems.length || 0;\n\n core.measureClient?.sendMeasureEvent('document_clicked', {\n document_position,\n number_of_documents,\n search_term,\n });\n }\n };\n\n render() {\n return (\n <div class='searchcraft-popover-list-item'>\n <a\n class='searchcraft-popover-list-item-link'\n href={this.href}\n onClick={this.handleLinkClick.bind(this)}\n >\n {this.imageSource && (\n <div class='searchcraft-popover-list-item-image-wrapper'>\n <img\n alt={this.imageAlt}\n src={this.imageSource}\n class='searchcraft-popover-list-item-image'\n />\n </div>\n )}\n <div class='searchcraft-popover-list-item-content'>\n {this.title && (\n <p class='searchcraft-popover-list-item-content-title'>\n {this.title}\n </p>\n )}\n {this.subtitle && (\n <p class='searchcraft-popover-list-item-content-subtitle'>\n {this.subtitle}\n </p>\n )}\n </div>\n </a>\n </div>\n );\n }\n}\n"],"version":3}
|