@empathyco/x-components 3.0.0-alpha.87 → 3.0.0-alpha.88
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/CHANGELOG.md +2 -10
- package/core/index.js.map +1 -1
- package/design-system/full-theme.css +17 -18
- package/docs/API-reference/api/x-adapter.searchresponse.banners.md +1 -1
- package/docs/API-reference/api/x-adapter.searchresponse.md +5 -5
- package/docs/API-reference/api/x-adapter.searchresponse.partialresults.md +1 -1
- package/docs/API-reference/api/x-adapter.searchresponse.promoteds.md +1 -1
- package/docs/API-reference/api/x-adapter.searchresponse.redirections.md +1 -1
- package/docs/API-reference/api/x-adapter.searchresponse.spellcheck.md +1 -1
- package/docs/API-reference/api/x-components.increasepageappendingresults.md +2 -2
- package/docs/API-reference/api/x-components.increasepageappendingresultswire.md +13 -0
- package/docs/API-reference/api/x-components.md +7 -3
- package/docs/API-reference/api/x-components.resetstate.md +13 -0
- package/docs/API-reference/api/{x-components.saveorigin.md → x-components.saveidentifierresultsorigin.md} +2 -2
- package/docs/API-reference/api/x-components.savesearchorigin.md +13 -0
- package/docs/API-reference/api/x-components.savesearchresponse.md +13 -0
- package/docs/API-reference/api/x-components.searchactions.md +1 -0
- package/docs/API-reference/api/x-components.searchactions.savesearchresponse.md +24 -0
- package/docs/API-reference/api/x-components.setsearchurlparams.md +13 -0
- package/identifier-results/index.js +1 -1
- package/js/index.js +7 -2
- package/js/index.js.map +1 -1
- package/js/store/utils/fetch-and-save-action.utils.js +4 -2
- package/js/store/utils/fetch-and-save-action.utils.js.map +1 -1
- package/js/x-modules/search/store/actions/fetch-and-save-search-response.action.js +2 -19
- package/js/x-modules/search/store/actions/fetch-and-save-search-response.action.js.map +1 -1
- package/js/x-modules/search/store/actions/save-search-response.action.js +32 -0
- package/js/x-modules/search/store/actions/save-search-response.action.js.map +1 -0
- package/js/x-modules/search/store/module.js +2 -0
- package/js/x-modules/search/store/module.js.map +1 -1
- package/js/x-modules/search/wiring.js +3 -9
- package/js/x-modules/search/wiring.js.map +1 -1
- package/js/x-modules/url/components/url-handler.vue.js.map +1 -1
- package/js/x-modules/url/components/url-handler.vue_rollup-plugin-vue_script.vue.js +2 -1
- package/js/x-modules/url/components/url-handler.vue_rollup-plugin-vue_script.vue.js.map +1 -1
- package/package.json +3 -3
- package/report/x-adapter.api.json +10 -10
- package/report/x-components.api.json +196 -50
- package/report/x-components.api.md +20 -7
- package/search/index.js +6 -1
- package/types/store/utils/fetch-and-save-action.utils.d.ts.map +1 -1
- package/types/x-modules/identifier-results/store/actions/index.d.ts +5 -0
- package/types/x-modules/identifier-results/store/actions/index.d.ts.map +1 -0
- package/types/x-modules/identifier-results/store/index.d.ts +1 -4
- package/types/x-modules/identifier-results/store/index.d.ts.map +1 -1
- package/types/x-modules/search/store/actions/fetch-and-save-search-response.action.d.ts.map +1 -1
- package/types/x-modules/search/store/actions/index.d.ts +8 -0
- package/types/x-modules/search/store/actions/index.d.ts.map +1 -0
- package/types/x-modules/search/store/actions/save-search-response.action.d.ts +12 -0
- package/types/x-modules/search/store/actions/save-search-response.action.d.ts.map +1 -0
- package/types/x-modules/search/store/getters/index.d.ts +3 -0
- package/types/x-modules/search/store/getters/index.d.ts.map +1 -0
- package/types/x-modules/search/store/index.d.ts +2 -4
- package/types/x-modules/search/store/index.d.ts.map +1 -1
- package/types/x-modules/search/store/module.d.ts.map +1 -1
- package/types/x-modules/search/store/types.d.ts +6 -0
- package/types/x-modules/search/store/types.d.ts.map +1 -1
- package/types/x-modules/search/wiring.d.ts +2 -8
- package/types/x-modules/search/wiring.d.ts.map +1 -1
- package/types/x-modules/url/components/url-handler.vue.d.ts.map +1 -1
- package/docs/API-reference/api/x-components.setpagesize.md +0 -13
package/CHANGELOG.md
CHANGED
|
@@ -3,17 +3,9 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See
|
|
4
4
|
[Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
## [3.0.0-alpha.
|
|
6
|
+
## [3.0.0-alpha.88](https://github.com/empathyco/x/compare/@empathyco/x-components@3.0.0-alpha.87...@empathyco/x-components@3.0.0-alpha.88) (2022-04-29)
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
- **extra-params:** makes `excludedExtraParams` configurable
|
|
11
|
-
([ca2bed1](https://github.com/empathyco/x/commit/ca2bed17c7ef8ed893a65e7d1a055901491ea8fa))
|
|
12
|
-
|
|
13
|
-
### Documentation
|
|
14
|
-
|
|
15
|
-
- review build search UI docs
|
|
16
|
-
([fc72ad7](https://github.com/empathyco/x/commit/fc72ad78fbff0deaa2f1a417c8e7f005ea2c8470))
|
|
8
|
+
**Note:** Version bump only for package @empathyco/x-components
|
|
17
9
|
|
|
18
10
|
# Change Log
|
|
19
11
|
|
package/core/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -3277,6 +3277,23 @@
|
|
|
3277
3277
|
opacity: 1;
|
|
3278
3278
|
}
|
|
3279
3279
|
}
|
|
3280
|
+
:root {
|
|
3281
|
+
--x-color-border-result-default: var(--x-color-base-lead);
|
|
3282
|
+
--x-color-border-result-picture-default: var(--x-color-border-result-default);
|
|
3283
|
+
--x-color-border-result-overlay-default: var(--x-color-border-result-default);
|
|
3284
|
+
--x-color-border-result-description-default: var(--x-color-border-result-default);
|
|
3285
|
+
--x-color-background-result-default: transparent;
|
|
3286
|
+
--x-size-padding-result-default: 0;
|
|
3287
|
+
--x-size-padding-result-picture-default: 0;
|
|
3288
|
+
--x-size-padding-result-overlay-default: 0;
|
|
3289
|
+
--x-size-padding-result-description-default: 0;
|
|
3290
|
+
--x-size-gap-result-default: var(--x-size-base-03);
|
|
3291
|
+
--x-size-border-radius-result-default: var(--x-size-border-radius-base-none);
|
|
3292
|
+
--x-size-border-width-result-default: 0;
|
|
3293
|
+
--x-size-border-width-result-picture-default: 0;
|
|
3294
|
+
--x-size-border-width-result-overlay-default: 0;
|
|
3295
|
+
--x-size-border-width-result-description-default: 0;
|
|
3296
|
+
}
|
|
3280
3297
|
.x-row {
|
|
3281
3298
|
display: grid;
|
|
3282
3299
|
grid-template-columns: repeat(12, 1fr);
|
|
@@ -7549,21 +7566,3 @@
|
|
|
7549
7566
|
.x-normal-case {
|
|
7550
7567
|
text-transform: none;
|
|
7551
7568
|
}
|
|
7552
|
-
|
|
7553
|
-
:root {
|
|
7554
|
-
--x-color-border-result-default: var(--x-color-base-lead);
|
|
7555
|
-
--x-color-border-result-picture-default: var(--x-color-border-result-default);
|
|
7556
|
-
--x-color-border-result-overlay-default: var(--x-color-border-result-default);
|
|
7557
|
-
--x-color-border-result-description-default: var(--x-color-border-result-default);
|
|
7558
|
-
--x-color-background-result-default: transparent;
|
|
7559
|
-
--x-size-padding-result-default: 0;
|
|
7560
|
-
--x-size-padding-result-picture-default: 0;
|
|
7561
|
-
--x-size-padding-result-overlay-default: 0;
|
|
7562
|
-
--x-size-padding-result-description-default: 0;
|
|
7563
|
-
--x-size-gap-result-default: var(--x-size-base-03);
|
|
7564
|
-
--x-size-border-radius-result-default: var(--x-size-border-radius-base-none);
|
|
7565
|
-
--x-size-border-width-result-default: 0;
|
|
7566
|
-
--x-size-border-width-result-picture-default: 0;
|
|
7567
|
-
--x-size-border-width-result-overlay-default: 0;
|
|
7568
|
-
--x-size-border-width-result-description-default: 0;
|
|
7569
|
-
}
|
|
@@ -16,13 +16,13 @@ export interface SearchResponse
|
|
|
16
16
|
|
|
17
17
|
| Property | Type | Description |
|
|
18
18
|
| --- | --- | --- |
|
|
19
|
-
| [banners](./x-adapter.searchresponse.banners.md) | Banner\[\] |
|
|
19
|
+
| [banners?](./x-adapter.searchresponse.banners.md) | Banner\[\] | <i>(Optional)</i> |
|
|
20
20
|
| [facets?](./x-adapter.searchresponse.facets.md) | Facet\[\] | <i>(Optional)</i> |
|
|
21
|
-
| [partialResults](./x-adapter.searchresponse.partialresults.md) | PartialResult\[\] |
|
|
22
|
-
| [promoteds](./x-adapter.searchresponse.promoteds.md) | Promoted\[\] |
|
|
21
|
+
| [partialResults?](./x-adapter.searchresponse.partialresults.md) | PartialResult\[\] | <i>(Optional)</i> |
|
|
22
|
+
| [promoteds?](./x-adapter.searchresponse.promoteds.md) | Promoted\[\] | <i>(Optional)</i> |
|
|
23
23
|
| [queryTagging](./x-adapter.searchresponse.querytagging.md) | TaggingInfo | |
|
|
24
|
-
| [redirections](./x-adapter.searchresponse.redirections.md) | Redirection\[\] |
|
|
24
|
+
| [redirections?](./x-adapter.searchresponse.redirections.md) | Redirection\[\] | <i>(Optional)</i> |
|
|
25
25
|
| [results](./x-adapter.searchresponse.results.md) | Result\[\] | |
|
|
26
|
-
| [spellcheck](./x-adapter.searchresponse.spellcheck.md) | string |
|
|
26
|
+
| [spellcheck?](./x-adapter.searchresponse.spellcheck.md) | string | <i>(Optional)</i> |
|
|
27
27
|
| [totalResults](./x-adapter.searchresponse.totalresults.md) | number | |
|
|
28
28
|
|
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
|
|
5
5
|
## increasePageAppendingResults variable
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Default implementation for the [SearchActions.increasePageAppendingResults()](./x-components.searchactions.increasepageappendingresults.md)<!-- -->.
|
|
8
8
|
|
|
9
9
|
<b>Signature:</b>
|
|
10
10
|
|
|
11
11
|
```typescript
|
|
12
|
-
increasePageAppendingResults:
|
|
12
|
+
increasePageAppendingResults: SearchXStoreModule['actions']['increasePageAppendingResults']
|
|
13
13
|
```
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@empathyco/x-components](./x-components.md) > [increasePageAppendingResultsWire](./x-components.increasepageappendingresultswire.md)
|
|
4
|
+
|
|
5
|
+
## increasePageAppendingResultsWire variable
|
|
6
|
+
|
|
7
|
+
Increases the current search state `page` by one.
|
|
8
|
+
|
|
9
|
+
<b>Signature:</b>
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
increasePageAppendingResultsWire: import("../../wiring/wiring.types").AnyWire
|
|
13
|
+
```
|
|
@@ -435,7 +435,8 @@ X-Components is a library usable everywhere not only for search experiences.
|
|
|
435
435
|
| [identifierHighlightRegexp](./x-components.identifierhighlightregexp.md) | Default implementation for the [IdentifierResultsGetters.identifierHighlightRegexp](./x-components.identifierresultsgetters.identifierhighlightregexp.md) getter. |
|
|
436
436
|
| [identifierResultsRequest](./x-components.identifierresultsrequest.md) | Default implementation for the [IdentifierResultsGetters.identifierResultsRequest](./x-components.identifierresultsgetters.identifierresultsrequest.md) getter. |
|
|
437
437
|
| [identifierResultsXModule](./x-components.identifierresultsxmodule.md) | IdentifierResults [XModule](./x-components.xmodule.md) implementation. This module is auto-registered as soon as you import any component from the <code>identifier-results</code> entry point. |
|
|
438
|
-
| [increasePageAppendingResults](./x-components.increasepageappendingresults.md) |
|
|
438
|
+
| [increasePageAppendingResults](./x-components.increasepageappendingresults.md) | Default implementation for the [SearchActions.increasePageAppendingResults()](./x-components.searchactions.increasepageappendingresults.md)<!-- -->. |
|
|
439
|
+
| [increasePageAppendingResultsWire](./x-components.increasepageappendingresultswire.md) | Increases the current search state <code>page</code> by one. |
|
|
439
440
|
| [infiniteScroll](./x-components.infinitescroll.md) | Custom Vue directive for infinite scroll.<!-- -->This directive uses the IntersectionObserver API to handle the intersection between the children and the scrollable container. The content of the children moves up on scroll and when it reaches the end the IntersectionObserver triggers that both elements are intersecting.<!-- -->How it works.<!-- -->As a summary, if the scroll reaches the end, the <code>vNode.context.onInfiniteScrollEnd</code> function implemented by the component which imports the directive, is executed. If you provide a margin in the directive options, this function is triggered when the scroll reaches the end minus that amount of pixels. A default margin of 200px is set.<!-- -->Usage.<!-- -->The directive has to be set in the target element. It can receive an argument which will be used to determine the scrollable container. Possible values: \* html: will set the <html> as the scrollable container. \* body: will set the <body> as the scrollable container. \* id: will set the DOM element with the provided id as the scrollable container.<!-- -->If no argument is provided the scrollable container fallbacks to the viewport. |
|
|
440
441
|
| [LightBulbOff](./x-components.lightbulboff.md) | |
|
|
441
442
|
| [LightBulbOn](./x-components.lightbulbon.md) | |
|
|
@@ -472,12 +473,15 @@ X-Components is a library usable everywhere not only for search experiences.
|
|
|
472
473
|
| [removeHistoryQuery](./x-components.removehistoryquery.md) | Removes a single history query from the history queries. |
|
|
473
474
|
| [resetAppending](./x-components.resetappending.md) | Resets the search state <code>isAppendingResults</code>. |
|
|
474
475
|
| [resetSpellcheckQuery](./x-components.resetspellcheckquery.md) | Resets the search state <code>spellcheckedQuery</code> to its initial value, an empty string. |
|
|
476
|
+
| [resetState](./x-components.resetstate.md) | Default implementation for the [SearchActions.resetState()](./x-components.searchactions.resetstate.md)<!-- -->. |
|
|
475
477
|
| [resetStateWire](./x-components.resetstatewire.md) | Batches state resets after [SearchGetters.request](./x-components.searchgetters.request.md) parameters update. |
|
|
476
478
|
| [sanitize](./x-components.sanitize.md) | Sanitize characters from a given string. |
|
|
479
|
+
| [saveIdentifierResultsOrigin](./x-components.saveidentifierresultsorigin.md) | Default implementation for the [IdentifierResultsActions.saveOrigin()](./x-components.identifierresultsactions.saveorigin.md)<!-- -->. |
|
|
477
480
|
| [saveIdentifierResultsOriginWire](./x-components.saveidentifierresultsoriginwire.md) | Sets the identifier results state <code>origin</code>. |
|
|
478
|
-
| [saveOrigin](./x-components.saveorigin.md) | Default implementation for the [IdentifierResultsActions.saveOrigin()](./x-components.identifierresultsactions.saveorigin.md)<!-- -->. |
|
|
479
481
|
| [saveOriginWire](./x-components.saveoriginwire.md) | Sets the search state <code>origin</code>. |
|
|
480
482
|
| [saveQuery](./x-components.savequery.md) | Default implementation for the [IdentifierResultsActions.saveQuery()](./x-components.identifierresultsactions.savequery.md)<!-- -->. |
|
|
483
|
+
| [saveSearchOrigin](./x-components.savesearchorigin.md) | Default implementation for the [SearchActions.saveOrigin()](./x-components.searchactions.saveorigin.md)<!-- -->. |
|
|
484
|
+
| [saveSearchResponse](./x-components.savesearchresponse.md) | Default implementation for the [SearchActions.saveSearchResponse()](./x-components.searchactions.savesearchresponse.md)<!-- -->. |
|
|
481
485
|
| [scrollXModule](./x-components.scrollxmodule.md) | Scroll [XModule](./x-components.xmodule.md) implementation. This module is auto-registered as soon as you import any component from the <code>empathize</code> entry point. |
|
|
482
486
|
| [searchBoxXModule](./x-components.searchboxxmodule.md) | SearchBox [XModule](./x-components.xmodule.md) implementation. This module is auto-registered as soon as you import any component from the <code>search-box</code> entry point. |
|
|
483
487
|
| [SearchIcon](./x-components.searchicon.md) | |
|
|
@@ -498,7 +502,6 @@ X-Components is a library usable everywhere not only for search experiences.
|
|
|
498
502
|
| [setName](./x-components.setname.md) | Sets the device of the [DeviceXModule](./x-components.devicexmodule.md)<!-- -->. |
|
|
499
503
|
| [setNextQueriesExtraParams](./x-components.setnextqueriesextraparams.md) | Sets the next queries state <code>params</code>. |
|
|
500
504
|
| [setNextQueriesQuery](./x-components.setnextqueriesquery.md) | Sets the next queries state <code>query</code>. |
|
|
501
|
-
| [setPageSize](./x-components.setpagesize.md) | Sets the search state <code>pageSize</code>. |
|
|
502
505
|
| [setParams](./x-components.setparams.md) | Sets the extra params of the url module. |
|
|
503
506
|
| [setPendingScrollToWire](./x-components.setpendingscrolltowire.md) | Saves the selector of the item that should be scrolled into the view. |
|
|
504
507
|
| [setPopularSearchesExtraParams](./x-components.setpopularsearchesextraparams.md) | Sets the popular searches state <code>params</code>. |
|
|
@@ -521,6 +524,7 @@ X-Components is a library usable everywhere not only for search experiences.
|
|
|
521
524
|
| [setSearchExtraParams](./x-components.setsearchextraparams.md) | Sets the search state <code>params</code>. |
|
|
522
525
|
| [setSearchPage](./x-components.setsearchpage.md) | Sets the search state <code>page</code>. |
|
|
523
526
|
| [setSearchQuery](./x-components.setsearchquery.md) | Sets the search state <code>query</code>. |
|
|
527
|
+
| [setSearchUrlParams](./x-components.setsearchurlparams.md) | Default implementation for the [SearchActions.setUrlParams()](./x-components.searchactions.seturlparams.md)<!-- -->. |
|
|
524
528
|
| [setSelectedFilters](./x-components.setselectedfilters.md) | Sets the search state <code>selectedFilters</code>. |
|
|
525
529
|
| [setSort](./x-components.setsort.md) | Sets the search state <code>sort</code>. |
|
|
526
530
|
| [setTaggingConfig](./x-components.settaggingconfig.md) | Sets the tagging config state. |
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@empathyco/x-components](./x-components.md) > [resetState](./x-components.resetstate.md)
|
|
4
|
+
|
|
5
|
+
## resetState variable
|
|
6
|
+
|
|
7
|
+
Default implementation for the [SearchActions.resetState()](./x-components.searchactions.resetstate.md)<!-- -->.
|
|
8
|
+
|
|
9
|
+
<b>Signature:</b>
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
resetState: SearchXStoreModule['actions']['resetState']
|
|
13
|
+
```
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
2
|
|
|
3
|
-
[Home](./index.md) > [@empathyco/x-components](./x-components.md) > [
|
|
3
|
+
[Home](./index.md) > [@empathyco/x-components](./x-components.md) > [saveIdentifierResultsOrigin](./x-components.saveidentifierresultsorigin.md)
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## saveIdentifierResultsOrigin variable
|
|
6
6
|
|
|
7
7
|
Default implementation for the [IdentifierResultsActions.saveOrigin()](./x-components.identifierresultsactions.saveorigin.md)<!-- -->.
|
|
8
8
|
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@empathyco/x-components](./x-components.md) > [saveSearchOrigin](./x-components.savesearchorigin.md)
|
|
4
|
+
|
|
5
|
+
## saveSearchOrigin variable
|
|
6
|
+
|
|
7
|
+
Default implementation for the [SearchActions.saveOrigin()](./x-components.searchactions.saveorigin.md)<!-- -->.
|
|
8
|
+
|
|
9
|
+
<b>Signature:</b>
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
saveOrigin: SearchXStoreModule['actions']['saveOrigin']
|
|
13
|
+
```
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@empathyco/x-components](./x-components.md) > [saveSearchResponse](./x-components.savesearchresponse.md)
|
|
4
|
+
|
|
5
|
+
## saveSearchResponse variable
|
|
6
|
+
|
|
7
|
+
Default implementation for the [SearchActions.saveSearchResponse()](./x-components.searchactions.savesearchresponse.md)<!-- -->.
|
|
8
|
+
|
|
9
|
+
<b>Signature:</b>
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
saveSearchResponse: SearchXStoreModule['actions']['saveSearchResponse']
|
|
13
|
+
```
|
|
@@ -22,5 +22,6 @@ export interface SearchActions
|
|
|
22
22
|
| [increasePageAppendingResults()](./x-components.searchactions.increasepageappendingresults.md) | Checks if there are more pages of results to load. If there are, then increases the page number in state and set to <code>true</code> the [SearchState.isAppendResults](./x-components.searchstate.isappendresults.md) flag. |
|
|
23
23
|
| [resetState(watchedRequest)](./x-components.searchactions.resetstate.md) | Batches state resets in a single action after [SearchGetters.request](./x-components.searchgetters.request.md) parameters update. |
|
|
24
24
|
| [saveOrigin(originInit)](./x-components.searchactions.saveorigin.md) | Creates a [QueryOrigin](./x-components.queryorigin.md) and saves it. |
|
|
25
|
+
| [saveSearchResponse(response)](./x-components.searchactions.savesearchresponse.md) | Saves the [SearchResponse](./x-adapter.searchresponse.md)<!-- -->. |
|
|
25
26
|
| [setUrlParams(urlParams)](./x-components.searchactions.seturlparams.md) | Checks if the url has params on it and then updates the state with these values. |
|
|
26
27
|
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@empathyco/x-components](./x-components.md) > [SearchActions](./x-components.searchactions.md) > [saveSearchResponse](./x-components.searchactions.savesearchresponse.md)
|
|
4
|
+
|
|
5
|
+
## SearchActions.saveSearchResponse() method
|
|
6
|
+
|
|
7
|
+
Saves the [SearchResponse](./x-adapter.searchresponse.md)<!-- -->.
|
|
8
|
+
|
|
9
|
+
<b>Signature:</b>
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
saveSearchResponse(response: SearchResponse): void;
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Parameters
|
|
16
|
+
|
|
17
|
+
| Parameter | Type | Description |
|
|
18
|
+
| --- | --- | --- |
|
|
19
|
+
| response | SearchResponse | The [SearchResponse](./x-adapter.searchresponse.md) to save. |
|
|
20
|
+
|
|
21
|
+
<b>Returns:</b>
|
|
22
|
+
|
|
23
|
+
void
|
|
24
|
+
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@empathyco/x-components](./x-components.md) > [setSearchUrlParams](./x-components.setsearchurlparams.md)
|
|
4
|
+
|
|
5
|
+
## setSearchUrlParams variable
|
|
6
|
+
|
|
7
|
+
Default implementation for the [SearchActions.setUrlParams()](./x-components.searchactions.seturlparams.md)<!-- -->.
|
|
8
|
+
|
|
9
|
+
<b>Signature:</b>
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
setUrlParams: SearchXStoreModule['actions']['setUrlParams']
|
|
13
|
+
```
|
|
@@ -2,7 +2,7 @@ export { default as IdentifierResult } from '../js/x-modules/identifier-results/
|
|
|
2
2
|
export { default as IdentifierResults } from '../js/x-modules/identifier-results/components/identifier-results.vue.js';
|
|
3
3
|
export { cancelFetchAndSaveIdentifierResults, fetchAndSaveIdentifierResults } from '../js/x-modules/identifier-results/store/actions/fetch-and-save-identifier-results.action.js';
|
|
4
4
|
export { fetchIdentifierResults } from '../js/x-modules/identifier-results/store/actions/fetch-identifier-results.action.js';
|
|
5
|
-
export { saveOrigin } from '../js/x-modules/identifier-results/store/actions/save-origin.action.js';
|
|
5
|
+
export { saveOrigin as saveIdentifierResultsOrigin } from '../js/x-modules/identifier-results/store/actions/save-origin.action.js';
|
|
6
6
|
export { saveQuery } from '../js/x-modules/identifier-results/store/actions/save-query.action.js';
|
|
7
7
|
export { identifierResultsEmitters } from '../js/x-modules/identifier-results/store/emitters.js';
|
|
8
8
|
export { identifierDetectionRegexp } from '../js/x-modules/identifier-results/store/getters/identifier-detection-regexp.getter.js';
|
package/js/index.js
CHANGED
|
@@ -221,7 +221,7 @@ export { default as IdentifierResult } from './x-modules/identifier-results/comp
|
|
|
221
221
|
export { default as IdentifierResults } from './x-modules/identifier-results/components/identifier-results.vue.js';
|
|
222
222
|
export { cancelFetchAndSaveIdentifierResults, fetchAndSaveIdentifierResults } from './x-modules/identifier-results/store/actions/fetch-and-save-identifier-results.action.js';
|
|
223
223
|
export { fetchIdentifierResults } from './x-modules/identifier-results/store/actions/fetch-identifier-results.action.js';
|
|
224
|
-
export { saveOrigin } from './x-modules/identifier-results/store/actions/save-origin.action.js';
|
|
224
|
+
export { saveOrigin as saveIdentifierResultsOrigin } from './x-modules/identifier-results/store/actions/save-origin.action.js';
|
|
225
225
|
export { saveQuery } from './x-modules/identifier-results/store/actions/save-query.action.js';
|
|
226
226
|
export { identifierResultsEmitters } from './x-modules/identifier-results/store/emitters.js';
|
|
227
227
|
export { identifierDetectionRegexp } from './x-modules/identifier-results/store/getters/identifier-detection-regexp.getter.js';
|
|
@@ -309,11 +309,16 @@ export { default as Spellcheck } from './x-modules/search/components/spellcheck.
|
|
|
309
309
|
export { default as SpellcheckButton } from './x-modules/search/components/spellcheck-button.vue.js';
|
|
310
310
|
export { cancelFetchAndSaveSearchResponse, fetchAndSaveSearchResponse } from './x-modules/search/store/actions/fetch-and-save-search-response.action.js';
|
|
311
311
|
export { fetchSearchResponse } from './x-modules/search/store/actions/fetch-search-response.action.js';
|
|
312
|
+
export { increasePageAppendingResults } from './x-modules/search/store/actions/increase-page-apending-results.action.js';
|
|
313
|
+
export { resetState } from './x-modules/search/store/actions/reset-state.action.js';
|
|
314
|
+
export { saveOrigin as saveSearchOrigin } from './x-modules/search/store/actions/save-origin.action.js';
|
|
315
|
+
export { saveSearchResponse } from './x-modules/search/store/actions/save-search-response.action.js';
|
|
316
|
+
export { setUrlParams as setSearchUrlParams } from './x-modules/search/store/actions/set-url-params.action.js';
|
|
312
317
|
export { searchEmitters } from './x-modules/search/store/emitters.js';
|
|
313
318
|
export { request as searchRequest } from './x-modules/search/store/getters/request.getter.js';
|
|
314
319
|
export { query as searchQuery } from './x-modules/search/store/getters/query.getter.js';
|
|
315
320
|
export { searchXStoreModule } from './x-modules/search/store/module.js';
|
|
316
|
-
export { cancelFetchAndSaveSearchResponseWire, fetchAndSaveSearchResponseWire,
|
|
321
|
+
export { cancelFetchAndSaveSearchResponseWire, fetchAndSaveSearchResponseWire, increasePageAppendingResultsWire, resetAppending, resetSpellcheckQuery, resetStateWire, saveOriginWire, searchWiring, setRelatedTags, setSearchExtraParams, setSearchPage, setSearchQuery, setSelectedFilters, setSort, setUrlParams } from './x-modules/search/wiring.js';
|
|
317
322
|
export { searchXModule } from './x-modules/search/x-module.js';
|
|
318
323
|
export { default as ClearSearchInput } from './x-modules/search-box/components/clear-search-input.vue.js';
|
|
319
324
|
export { default as SearchButton } from './x-modules/search-box/components/search-button.vue.js';
|
package/js/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -8,7 +8,9 @@ import { cancellablePromise, CancelSymbol } from '../../utils/cancellable-promis
|
|
|
8
8
|
* @public
|
|
9
9
|
* @returns An action to fetch and save some data, and an action to cancel the last request.
|
|
10
10
|
*/
|
|
11
|
-
function createFetchAndSaveActions({ fetch, onSuccess,
|
|
11
|
+
function createFetchAndSaveActions({ fetch, onSuccess,
|
|
12
|
+
// eslint-disable-next-line no-console
|
|
13
|
+
onError = console.error, onCancel }) {
|
|
12
14
|
let cancelPreviousRequest;
|
|
13
15
|
/**
|
|
14
16
|
* Called asynchronously after a response has been received.
|
|
@@ -44,7 +46,7 @@ function createFetchAndSaveActions({ fetch, onSuccess, onError, onCancel }) {
|
|
|
44
46
|
function handleError(context, error) {
|
|
45
47
|
if (error !== CancelSymbol) {
|
|
46
48
|
context.commit('setStatus', 'error');
|
|
47
|
-
onError
|
|
49
|
+
onError(error);
|
|
48
50
|
}
|
|
49
51
|
}
|
|
50
52
|
// eslint-disable-next-line
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch-and-save-action.utils.js","sources":["../../../../src/store/utils/fetch-and-save-action.utils.ts"],"sourcesContent":["import { cancellablePromise, CancelSymbol } from '../../utils/cancellable-promise';\nimport { XActionContext } from '../actions.types';\nimport { StatusMutations, StatusState } from './status-store.utils';\n\n/**\n * Utility to create an action that requests and save some data asynchronously, with the\n * option to cancel the request at any moment. This factory provides with the standard flow\n * for requesting, cancelling, handling errors for a module, while also taking care of its status.\n *\n * @public\n * @returns An action to fetch and save some data, and an action to cancel the last request.\n */\nexport function createFetchAndSaveActions<\n // Using `object` type to ensure no actions/getters can be used.\n // eslint-disable-next-line @typescript-eslint/ban-types\n Context extends XActionContext<StatusState, object, StatusMutations, object>,\n Request,\n Response\n>({\n fetch,\n onSuccess,\n onError,\n onCancel\n}: FetchAndSaveHooks<Context, Request, Response>): FetchAndSaveActions<Context, Request> {\n let cancelPreviousRequest: undefined | (() => void);\n\n /**\n * Called asynchronously after a response has been received.\n *\n * @param context - The {@link https://vuex.vuejs.org/guide/actions.html | context} of the\n * actions, provided by Vuex.\n * @param response - The fetch response.\n * @returns A Promise that resolves after handling the response.\n */\n function handleResponse(context: Context, response: Response): Promise<void> {\n return Promise.resolve(onSuccess(context, response)).then(() => {\n context.commit('setStatus', 'success');\n });\n }\n\n /**\n * Called immediately after a request has been cancelled.\n *\n * @param context - The {@link https://vuex.vuejs.org/guide/actions.html | context} of the\n * actions, provided by Vuex.\n */\n function handleCancel(context: Context): void {\n cancelPreviousRequest = undefined;\n context.commit('setStatus', 'success');\n onCancel?.();\n }\n\n /**\n * Called asynchronously whenever an error happens in the fetch and save flow.\n *\n * @param context - The {@link https://vuex.vuejs.org/guide/actions.html | context} of the\n * actions, provided by Vuex.\n * @param error - The error information.\n */\n function handleError(context: Context, error: unknown): void {\n if (error !== CancelSymbol) {\n context.commit('setStatus', 'error');\n onError
|
|
1
|
+
{"version":3,"file":"fetch-and-save-action.utils.js","sources":["../../../../src/store/utils/fetch-and-save-action.utils.ts"],"sourcesContent":["import { cancellablePromise, CancelSymbol } from '../../utils/cancellable-promise';\nimport { XActionContext } from '../actions.types';\nimport { StatusMutations, StatusState } from './status-store.utils';\n\n/**\n * Utility to create an action that requests and save some data asynchronously, with the\n * option to cancel the request at any moment. This factory provides with the standard flow\n * for requesting, cancelling, handling errors for a module, while also taking care of its status.\n *\n * @public\n * @returns An action to fetch and save some data, and an action to cancel the last request.\n */\nexport function createFetchAndSaveActions<\n // Using `object` type to ensure no actions/getters can be used.\n // eslint-disable-next-line @typescript-eslint/ban-types\n Context extends XActionContext<StatusState, object, StatusMutations, object>,\n Request,\n Response\n>({\n fetch,\n onSuccess,\n // eslint-disable-next-line no-console\n onError = console.error,\n onCancel\n}: FetchAndSaveHooks<Context, Request, Response>): FetchAndSaveActions<Context, Request> {\n let cancelPreviousRequest: undefined | (() => void);\n\n /**\n * Called asynchronously after a response has been received.\n *\n * @param context - The {@link https://vuex.vuejs.org/guide/actions.html | context} of the\n * actions, provided by Vuex.\n * @param response - The fetch response.\n * @returns A Promise that resolves after handling the response.\n */\n function handleResponse(context: Context, response: Response): Promise<void> {\n return Promise.resolve(onSuccess(context, response)).then(() => {\n context.commit('setStatus', 'success');\n });\n }\n\n /**\n * Called immediately after a request has been cancelled.\n *\n * @param context - The {@link https://vuex.vuejs.org/guide/actions.html | context} of the\n * actions, provided by Vuex.\n */\n function handleCancel(context: Context): void {\n cancelPreviousRequest = undefined;\n context.commit('setStatus', 'success');\n onCancel?.();\n }\n\n /**\n * Called asynchronously whenever an error happens in the fetch and save flow.\n *\n * @param context - The {@link https://vuex.vuejs.org/guide/actions.html | context} of the\n * actions, provided by Vuex.\n * @param error - The error information.\n */\n function handleError(context: Context, error: unknown): void {\n if (error !== CancelSymbol) {\n context.commit('setStatus', 'error');\n onError(error);\n }\n }\n\n // eslint-disable-next-line\n /** @see FetchAndSaveActions.fetchAndSave */\n function fetchAndSave(context: Context, request: Request): Promise<void> {\n cancelPrevious();\n context.commit('setStatus', 'loading');\n const { promise, cancel } = cancellablePromise(fetch(context, request), () => {\n handleCancel(context);\n });\n\n cancelPreviousRequest = cancel;\n return promise\n .then(response => handleResponse(context, response))\n .catch(error => handleError(context, error));\n }\n\n // eslint-disable-next-line\n /** @see FetchAndSaveActions.cancelPrevious */\n function cancelPrevious(): void {\n cancelPreviousRequest?.();\n }\n\n return {\n fetchAndSave,\n cancelPrevious\n };\n}\n\n/**\n * Options to use with the {@link createFetchAndSaveActions} factory.\n *\n * @public\n */\nexport interface FetchAndSaveHooks<\n // Using `object` type to ensure no actions/getters can be used.\n // eslint-disable-next-line @typescript-eslint/ban-types\n Context extends XActionContext<StatusState, object, StatusMutations, object>,\n Request,\n Response\n> {\n /**\n * Retrieves and returns asynchronously some data.\n *\n * @param context - The {@link https://vuex.vuejs.org/guide/actions.html | context} of the\n * actions, provided by Vuex.\n * @param request - The request object used for fetching.\n * @returns A Promise resolved with the response of the fetch request.\n */\n fetch(context: Context, request: Request): Promise<Response>;\n /**\n * Asynchronous callback executed when the {@link FetchAndSaveHooks.fetch} is\n * performed successfully.\n *\n * @param context - The {@link https://vuex.vuejs.org/guide/actions.html | context} of the\n * actions, provided by Vuex.\n * @param response - The data returned by {@link FetchAndSaveHooks.fetch}.\n */\n onSuccess(context: Context, response: Response): void;\n /**\n * Asynchronous callback executed when either the {@link FetchAndSaveHooks.fetch}\n * or {@link FetchAndSaveHooks.onSuccess} methods fail.\n *\n * @param error - The error that triggered this callback.\n */\n onError?(error: unknown): void;\n /**\n * Synchronous callback executed when the request is cancelled. This can happen mainly for two\n * reasons:\n * - The {@link FetchAndSaveActions.cancelPrevious} action is dispatched.\n * - A new {@link FetchAndSaveActions.fetchAndSave} is dispatched before the previous one was\n * resolved.\n */\n onCancel?(): void;\n}\n\n/**\n * Actions returned from the {@link createFetchAndSaveActions}.\n *\n * @public\n */\nexport interface FetchAndSaveActions<\n // Using `object` type to ensure no actions/getters can be used.\n // eslint-disable-next-line @typescript-eslint/ban-types\n Context extends XActionContext<StatusState, object, StatusMutations, object>,\n Request\n> {\n /**\n * Action that requests and saves the response.\n *\n * @param context - The {@link https://vuex.vuejs.org/guide/actions.html | context} of the\n * actions, provided by Vuex.\n * @returns A promise that resolves after saving the response.\n */\n fetchAndSave: (context: Context, request: Request) => void | Promise<void>;\n /**\n * Action that cancels the previous request call if it stills in progress.\n */\n cancelPrevious: () => void;\n}\n"],"names":[],"mappings":";;AAIA;;;;;;;;SAQgB,yBAAyB,CAMvC,EACA,KAAK,EACL,SAAS;AACT;AACA,OAAO,GAAG,OAAO,CAAC,KAAK,EACvB,QAAQ,EACsC;IAC9C,IAAI,qBAA+C,CAAC;;;;;;;;;IAUpD,SAAS,cAAc,CAAC,OAAgB,EAAE,QAAkB;QAC1D,OAAO,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC;YACxD,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;SACxC,CAAC,CAAC;KACJ;;;;;;;IAQD,SAAS,YAAY,CAAC,OAAgB;QACpC,qBAAqB,GAAG,SAAS,CAAC;QAClC,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;QACvC,QAAQ,IAAI,CAAC;KACd;;;;;;;;IASD,SAAS,WAAW,CAAC,OAAgB,EAAE,KAAc;QACnD,IAAI,KAAK,KAAK,YAAY,EAAE;YAC1B,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;YACrC,OAAO,CAAC,KAAK,CAAC,CAAC;SAChB;KACF;;;IAID,SAAS,YAAY,CAAC,OAAgB,EAAE,OAAgB;QACtD,cAAc,EAAE,CAAC;QACjB,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;QACvC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,kBAAkB,CAAC,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,EAAE;YACtE,YAAY,CAAC,OAAO,CAAC,CAAC;SACvB,CAAC,CAAC;QAEH,qBAAqB,GAAG,MAAM,CAAC;QAC/B,OAAO,OAAO;aACX,IAAI,CAAC,QAAQ,IAAI,cAAc,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;aACnD,KAAK,CAAC,KAAK,IAAI,WAAW,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC;KAChD;;;IAID,SAAS,cAAc;QACrB,qBAAqB,IAAI,CAAC;KAC3B;IAED,OAAO;QACL,YAAY;QACZ,cAAc;KACf,CAAC;AACJ;;;;"}
|
|
@@ -4,25 +4,8 @@ const { fetchAndSave, cancelPrevious } = createFetchAndSaveActions({
|
|
|
4
4
|
fetch({ dispatch, state }, request) {
|
|
5
5
|
return dispatch('fetchSearchResponse', request ? enrichRequest(request, state) : null);
|
|
6
6
|
},
|
|
7
|
-
onSuccess({
|
|
8
|
-
|
|
9
|
-
commit('appendResults', results);
|
|
10
|
-
}
|
|
11
|
-
else {
|
|
12
|
-
commit('setResults', results);
|
|
13
|
-
commit('setBanners', banners);
|
|
14
|
-
commit('setPromoteds', promoteds);
|
|
15
|
-
commit('setRedirections', redirections);
|
|
16
|
-
}
|
|
17
|
-
commit('setPartialResults', partialResults ?? []);
|
|
18
|
-
if (facets) {
|
|
19
|
-
commit('setFacets', facets);
|
|
20
|
-
}
|
|
21
|
-
if (queryTagging) {
|
|
22
|
-
commit('setQueryTagging', queryTagging);
|
|
23
|
-
}
|
|
24
|
-
commit('setTotalResults', totalResults);
|
|
25
|
-
commit('setSpellcheck', spellcheck ?? '');
|
|
7
|
+
onSuccess({ dispatch }, response) {
|
|
8
|
+
dispatch('saveSearchResponse', response);
|
|
26
9
|
}
|
|
27
10
|
});
|
|
28
11
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch-and-save-search-response.action.js","sources":["../../../../../../src/x-modules/search/store/actions/fetch-and-save-search-response.action.ts"],"sourcesContent":["import { SearchResponse, SearchRequest } from '@empathyco/x-adapter';\nimport { createFetchAndSaveActions } from '../../../../store/utils/fetch-and-save-action.utils';\nimport { InternalSearchRequest } from '../../types';\nimport { SearchActionContext, SearchState } from '../types';\n\nconst { fetchAndSave, cancelPrevious } = createFetchAndSaveActions<\n SearchActionContext,\n InternalSearchRequest | null,\n SearchResponse\n>({\n fetch({ dispatch, state }, request) {\n return dispatch('fetchSearchResponse', request ? enrichRequest(request, state) : null);\n },\n onSuccess(
|
|
1
|
+
{"version":3,"file":"fetch-and-save-search-response.action.js","sources":["../../../../../../src/x-modules/search/store/actions/fetch-and-save-search-response.action.ts"],"sourcesContent":["import { SearchResponse, SearchRequest } from '@empathyco/x-adapter';\nimport { createFetchAndSaveActions } from '../../../../store/utils/fetch-and-save-action.utils';\nimport { InternalSearchRequest } from '../../types';\nimport { SearchActionContext, SearchState } from '../types';\n\nconst { fetchAndSave, cancelPrevious } = createFetchAndSaveActions<\n SearchActionContext,\n InternalSearchRequest | null,\n SearchResponse\n>({\n fetch({ dispatch, state }, request) {\n return dispatch('fetchSearchResponse', request ? enrichRequest(request, state) : null);\n },\n onSuccess({ dispatch }, response) {\n dispatch('saveSearchResponse', response);\n }\n});\n\n/**\n * Enriches the {@link SearchRequest} object with the origin and page properties taken from the\n * {@link SearchState | search state}.\n *\n * @param request - The {@link InternalSearchRequest}.\n * @param state - {@link SearchState}.\n *\n * @returns The search request.\n * @internal\n */\nfunction enrichRequest(request: InternalSearchRequest, state: SearchState): SearchRequest {\n const { page, ...restRequest } = request;\n const {\n config: { pageSize },\n origin,\n results\n } = state;\n const start = page === 1 ? 0 : results.length;\n\n return {\n ...restRequest,\n // eslint-disable-next-line @typescript-eslint/no-extra-parens\n ...(origin && { origin }),\n start,\n rows: pageSize * page - start\n };\n}\n\n/**\n * Default implementation for {@link SearchActions.fetchAndSaveSearchResponse} action.\n *\n * @public\n */\nexport const fetchAndSaveSearchResponse = fetchAndSave;\n\n/**\n * Default implementation for {@link SearchActions.cancelFetchAndSaveSearchResponse} action.\n *\n * @public\n */\nexport const cancelFetchAndSaveSearchResponse = cancelPrevious;\n"],"names":[],"mappings":";;AAKA,MAAM,EAAE,YAAY,EAAE,cAAc,EAAE,GAAG,yBAAyB,CAIhE;IACA,KAAK,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,OAAO;QAChC,OAAO,QAAQ,CAAC,qBAAqB,EAAE,OAAO,GAAG,aAAa,CAAC,OAAO,EAAE,KAAK,CAAC,GAAG,IAAI,CAAC,CAAC;KACxF;IACD,SAAS,CAAC,EAAE,QAAQ,EAAE,EAAE,QAAQ;QAC9B,QAAQ,CAAC,oBAAoB,EAAE,QAAQ,CAAC,CAAC;KAC1C;CACF,CAAC,CAAC;AAEH;;;;;;;;;;AAUA,SAAS,aAAa,CAAC,OAA8B,EAAE,KAAkB;IACvE,MAAM,EAAE,IAAI,EAAE,GAAG,WAAW,EAAE,GAAG,OAAO,CAAC;IACzC,MAAM,EACJ,MAAM,EAAE,EAAE,QAAQ,EAAE,EACpB,MAAM,EACN,OAAO,EACR,GAAG,KAAK,CAAC;IACV,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC;IAE9C,OAAO;QACL,GAAG,WAAW;;QAEd,IAAI,MAAM,IAAI,EAAE,MAAM,EAAE,CAAC;QACzB,KAAK;QACL,IAAI,EAAE,QAAQ,GAAG,IAAI,GAAG,KAAK;KAC9B,CAAC;AACJ,CAAC;AAED;;;;;MAKa,0BAA0B,GAAG,aAAa;AAEvD;;;;;MAKa,gCAAgC,GAAG;;;;"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Default implementation for the {@link SearchActions.saveSearchResponse}.
|
|
3
|
+
*
|
|
4
|
+
* @param context - The {@link https://vuex.vuejs.org/guide/actions.html | context} of the actions,
|
|
5
|
+
* provided by Vuex.
|
|
6
|
+
* @param response - The {@link @empathyco/x-adapter#SearchResponse} to save.
|
|
7
|
+
*
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
const saveSearchResponse = ({ commit, state }, { results, partialResults, facets, banners, promoteds, totalResults, spellcheck, redirections, queryTagging }) => {
|
|
11
|
+
if (state.isAppendResults) {
|
|
12
|
+
commit('appendResults', results);
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
commit('setResults', results);
|
|
16
|
+
commit('setBanners', banners ?? []);
|
|
17
|
+
commit('setPromoteds', promoteds ?? []);
|
|
18
|
+
commit('setRedirections', redirections ?? []);
|
|
19
|
+
}
|
|
20
|
+
commit('setPartialResults', partialResults ?? []);
|
|
21
|
+
if (facets) {
|
|
22
|
+
commit('setFacets', facets);
|
|
23
|
+
}
|
|
24
|
+
if (queryTagging) {
|
|
25
|
+
commit('setQueryTagging', queryTagging);
|
|
26
|
+
}
|
|
27
|
+
commit('setTotalResults', totalResults);
|
|
28
|
+
commit('setSpellcheck', spellcheck ?? '');
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export { saveSearchResponse };
|
|
32
|
+
//# sourceMappingURL=save-search-response.action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"save-search-response.action.js","sources":["../../../../../../src/x-modules/search/store/actions/save-search-response.action.ts"],"sourcesContent":["import { SearchXStoreModule } from '../types';\n\n/**\n * Default implementation for the {@link SearchActions.saveSearchResponse}.\n *\n * @param context - The {@link https://vuex.vuejs.org/guide/actions.html | context} of the actions,\n * provided by Vuex.\n * @param response - The {@link @empathyco/x-adapter#SearchResponse} to save.\n *\n * @public\n */\nexport const saveSearchResponse: SearchXStoreModule['actions']['saveSearchResponse'] = (\n { commit, state },\n {\n results,\n partialResults,\n facets,\n banners,\n promoteds,\n totalResults,\n spellcheck,\n redirections,\n queryTagging\n }\n) => {\n if (state.isAppendResults) {\n commit('appendResults', results);\n } else {\n commit('setResults', results);\n commit('setBanners', banners ?? []);\n commit('setPromoteds', promoteds ?? []);\n commit('setRedirections', redirections ?? []);\n }\n\n commit('setPartialResults', partialResults ?? []);\n\n if (facets) {\n commit('setFacets', facets);\n }\n\n if (queryTagging) {\n commit('setQueryTagging', queryTagging);\n }\n commit('setTotalResults', totalResults);\n commit('setSpellcheck', spellcheck ?? '');\n};\n"],"names":[],"mappings":"AAEA;;;;;;;;;MASa,kBAAkB,GAAwD,CACrF,EAAE,MAAM,EAAE,KAAK,EAAE,EACjB,EACE,OAAO,EACP,cAAc,EACd,MAAM,EACN,OAAO,EACP,SAAS,EACT,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,YAAY,EACb;IAED,IAAI,KAAK,CAAC,eAAe,EAAE;QACzB,MAAM,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC;KAClC;SAAM;QACL,MAAM,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;QAC9B,MAAM,CAAC,YAAY,EAAE,OAAO,IAAI,EAAE,CAAC,CAAC;QACpC,MAAM,CAAC,cAAc,EAAE,SAAS,IAAI,EAAE,CAAC,CAAC;QACxC,MAAM,CAAC,iBAAiB,EAAE,YAAY,IAAI,EAAE,CAAC,CAAC;KAC/C;IAED,MAAM,CAAC,mBAAmB,EAAE,cAAc,IAAI,EAAE,CAAC,CAAC;IAElD,IAAI,MAAM,EAAE;QACV,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;KAC7B;IAED,IAAI,YAAY,EAAE;QAChB,MAAM,CAAC,iBAAiB,EAAE,YAAY,CAAC,CAAC;KACzC;IACD,MAAM,CAAC,iBAAiB,EAAE,YAAY,CAAC,CAAC;IACxC,MAAM,CAAC,eAAe,EAAE,UAAU,IAAI,EAAE,CAAC,CAAC;AAC5C;;;;"}
|
|
@@ -7,6 +7,7 @@ import { fetchSearchResponse } from './actions/fetch-search-response.action.js';
|
|
|
7
7
|
import { increasePageAppendingResults } from './actions/increase-page-apending-results.action.js';
|
|
8
8
|
import { resetState } from './actions/reset-state.action.js';
|
|
9
9
|
import { saveOrigin } from './actions/save-origin.action.js';
|
|
10
|
+
import { saveSearchResponse } from './actions/save-search-response.action.js';
|
|
10
11
|
import { setUrlParams } from './actions/set-url-params.action.js';
|
|
11
12
|
import { query } from './getters/query.getter.js';
|
|
12
13
|
import { request } from './getters/request.getter.js';
|
|
@@ -111,6 +112,7 @@ const searchXStoreModule = {
|
|
|
111
112
|
fetchAndSaveSearchResponse,
|
|
112
113
|
increasePageAppendingResults,
|
|
113
114
|
resetState,
|
|
115
|
+
saveSearchResponse,
|
|
114
116
|
setUrlParams,
|
|
115
117
|
saveOrigin
|
|
116
118
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.js","sources":["../../../../../src/x-modules/search/store/module.ts"],"sourcesContent":["import { isFacetFilter } from '@empathyco/x-types';\nimport { setQuery } from '../../../store/utils/query.utils';\nimport { setStatus } from '../../../store/utils/status-store.utils';\nimport { groupItemsBy } from '../../../utils/array';\n// eslint-disable-next-line max-len\nimport {\n cancelFetchAndSaveSearchResponse,\n fetchAndSaveSearchResponse\n} from './actions/fetch-and-save-search-response.action';\nimport { fetchSearchResponse } from './actions/fetch-search-response.action';\nimport { increasePageAppendingResults } from './actions/increase-page-apending-results.action';\nimport { resetState } from './actions/reset-state.action';\nimport { saveOrigin } from './actions/save-origin.action';\nimport { setUrlParams } from './actions/set-url-params.action';\nimport { query } from './getters/query.getter';\nimport { request } from './getters/request.getter';\nimport { SearchXStoreModule } from './types';\n\n/**\n * {@link XStoreModule} For the search module.\n *\n * @internal\n */\nexport const searchXStoreModule: SearchXStoreModule = {\n state: () => ({\n query: '',\n params: {},\n results: [],\n partialResults: [],\n facets: [],\n relatedTags: [],\n banners: [],\n promoteds: [],\n selectedFilters: {},\n config: {\n pageSize: 24\n },\n totalResults: 0,\n spellcheckedQuery: '',\n status: 'initial',\n sort: '',\n page: 1,\n origin: null,\n isAppendResults: false,\n redirections: [],\n queryTagging: {\n url: '',\n params: {}\n }\n }),\n getters: {\n request,\n query\n },\n mutations: {\n setQuery,\n setResults(state, results) {\n state.results = results;\n },\n appendResults(state, results) {\n state.results.push(...results);\n },\n setPartialResults(state, partialResults) {\n state.partialResults = partialResults;\n },\n setFacets(state, facets) {\n state.facets = facets;\n },\n setRelatedTags(state, relatedTags) {\n state.relatedTags = relatedTags;\n },\n setSelectedFilters(state, selectedFilters) {\n state.selectedFilters = groupItemsBy(selectedFilters, filter =>\n isFacetFilter(filter) ? filter.facetId : '__unknown__'\n );\n },\n setBanners(state, banners) {\n state.banners = banners;\n },\n setPromoteds(state, promoteds) {\n state.promoteds = promoteds;\n },\n setSpellcheck(state, spellcheckedQuery) {\n state.spellcheckedQuery = spellcheckedQuery;\n },\n setTotalResults(state, totalResults) {\n state.totalResults = totalResults;\n },\n setSort(state, sort) {\n state.sort = sort;\n },\n setPage(state, page) {\n state.page = page;\n },\n setPageSize(state, pageSize) {\n state.config.pageSize = pageSize;\n },\n setIsAppendResults(state, isAppendResults) {\n state.isAppendResults = isAppendResults;\n },\n setStatus,\n setParams(state, params) {\n state.params = params;\n },\n setOrigin(state, origin = null) {\n state.origin = origin;\n },\n setRedirections(state, redirections) {\n state.redirections = redirections;\n },\n setQueryTagging(state, queryTagging) {\n state.queryTagging = queryTagging;\n }\n },\n actions: {\n cancelFetchAndSaveSearchResponse,\n fetchSearchResponse,\n fetchAndSaveSearchResponse,\n increasePageAppendingResults,\n resetState,\n setUrlParams,\n saveOrigin\n }\n};\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"module.js","sources":["../../../../../src/x-modules/search/store/module.ts"],"sourcesContent":["import { isFacetFilter } from '@empathyco/x-types';\nimport { setQuery } from '../../../store/utils/query.utils';\nimport { setStatus } from '../../../store/utils/status-store.utils';\nimport { groupItemsBy } from '../../../utils/array';\n// eslint-disable-next-line max-len\nimport {\n cancelFetchAndSaveSearchResponse,\n fetchAndSaveSearchResponse\n} from './actions/fetch-and-save-search-response.action';\nimport { fetchSearchResponse } from './actions/fetch-search-response.action';\nimport { increasePageAppendingResults } from './actions/increase-page-apending-results.action';\nimport { resetState } from './actions/reset-state.action';\nimport { saveOrigin } from './actions/save-origin.action';\nimport { saveSearchResponse } from './actions/save-search-response.action';\nimport { setUrlParams } from './actions/set-url-params.action';\nimport { query } from './getters/query.getter';\nimport { request } from './getters/request.getter';\nimport { SearchXStoreModule } from './types';\n\n/**\n * {@link XStoreModule} For the search module.\n *\n * @internal\n */\nexport const searchXStoreModule: SearchXStoreModule = {\n state: () => ({\n query: '',\n params: {},\n results: [],\n partialResults: [],\n facets: [],\n relatedTags: [],\n banners: [],\n promoteds: [],\n selectedFilters: {},\n config: {\n pageSize: 24\n },\n totalResults: 0,\n spellcheckedQuery: '',\n status: 'initial',\n sort: '',\n page: 1,\n origin: null,\n isAppendResults: false,\n redirections: [],\n queryTagging: {\n url: '',\n params: {}\n }\n }),\n getters: {\n request,\n query\n },\n mutations: {\n setQuery,\n setResults(state, results) {\n state.results = results;\n },\n appendResults(state, results) {\n state.results.push(...results);\n },\n setPartialResults(state, partialResults) {\n state.partialResults = partialResults;\n },\n setFacets(state, facets) {\n state.facets = facets;\n },\n setRelatedTags(state, relatedTags) {\n state.relatedTags = relatedTags;\n },\n setSelectedFilters(state, selectedFilters) {\n state.selectedFilters = groupItemsBy(selectedFilters, filter =>\n isFacetFilter(filter) ? filter.facetId : '__unknown__'\n );\n },\n setBanners(state, banners) {\n state.banners = banners;\n },\n setPromoteds(state, promoteds) {\n state.promoteds = promoteds;\n },\n setSpellcheck(state, spellcheckedQuery) {\n state.spellcheckedQuery = spellcheckedQuery;\n },\n setTotalResults(state, totalResults) {\n state.totalResults = totalResults;\n },\n setSort(state, sort) {\n state.sort = sort;\n },\n setPage(state, page) {\n state.page = page;\n },\n setPageSize(state, pageSize) {\n state.config.pageSize = pageSize;\n },\n setIsAppendResults(state, isAppendResults) {\n state.isAppendResults = isAppendResults;\n },\n setStatus,\n setParams(state, params) {\n state.params = params;\n },\n setOrigin(state, origin = null) {\n state.origin = origin;\n },\n setRedirections(state, redirections) {\n state.redirections = redirections;\n },\n setQueryTagging(state, queryTagging) {\n state.queryTagging = queryTagging;\n }\n },\n actions: {\n cancelFetchAndSaveSearchResponse,\n fetchSearchResponse,\n fetchAndSaveSearchResponse,\n increasePageAppendingResults,\n resetState,\n saveSearchResponse,\n setUrlParams,\n saveOrigin\n }\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAmBA;;;;;MAKa,kBAAkB,GAAuB;IACpD,KAAK,EAAE,OAAO;QACZ,KAAK,EAAE,EAAE;QACT,MAAM,EAAE,EAAE;QACV,OAAO,EAAE,EAAE;QACX,cAAc,EAAE,EAAE;QAClB,MAAM,EAAE,EAAE;QACV,WAAW,EAAE,EAAE;QACf,OAAO,EAAE,EAAE;QACX,SAAS,EAAE,EAAE;QACb,eAAe,EAAE,EAAE;QACnB,MAAM,EAAE;YACN,QAAQ,EAAE,EAAE;SACb;QACD,YAAY,EAAE,CAAC;QACf,iBAAiB,EAAE,EAAE;QACrB,MAAM,EAAE,SAAS;QACjB,IAAI,EAAE,EAAE;QACR,IAAI,EAAE,CAAC;QACP,MAAM,EAAE,IAAI;QACZ,eAAe,EAAE,KAAK;QACtB,YAAY,EAAE,EAAE;QAChB,YAAY,EAAE;YACZ,GAAG,EAAE,EAAE;YACP,MAAM,EAAE,EAAE;SACX;KACF,CAAC;IACF,OAAO,EAAE;QACP,OAAO;QACP,KAAK;KACN;IACD,SAAS,EAAE;QACT,QAAQ;QACR,UAAU,CAAC,KAAK,EAAE,OAAO;YACvB,KAAK,CAAC,OAAO,GAAG,OAAO,CAAC;SACzB;QACD,aAAa,CAAC,KAAK,EAAE,OAAO;YAC1B,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,CAAC;SAChC;QACD,iBAAiB,CAAC,KAAK,EAAE,cAAc;YACrC,KAAK,CAAC,cAAc,GAAG,cAAc,CAAC;SACvC;QACD,SAAS,CAAC,KAAK,EAAE,MAAM;YACrB,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC;SACvB;QACD,cAAc,CAAC,KAAK,EAAE,WAAW;YAC/B,KAAK,CAAC,WAAW,GAAG,WAAW,CAAC;SACjC;QACD,kBAAkB,CAAC,KAAK,EAAE,eAAe;YACvC,KAAK,CAAC,eAAe,GAAG,YAAY,CAAC,eAAe,EAAE,MAAM,IAC1D,aAAa,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC,OAAO,GAAG,aAAa,CACvD,CAAC;SACH;QACD,UAAU,CAAC,KAAK,EAAE,OAAO;YACvB,KAAK,CAAC,OAAO,GAAG,OAAO,CAAC;SACzB;QACD,YAAY,CAAC,KAAK,EAAE,SAAS;YAC3B,KAAK,CAAC,SAAS,GAAG,SAAS,CAAC;SAC7B;QACD,aAAa,CAAC,KAAK,EAAE,iBAAiB;YACpC,KAAK,CAAC,iBAAiB,GAAG,iBAAiB,CAAC;SAC7C;QACD,eAAe,CAAC,KAAK,EAAE,YAAY;YACjC,KAAK,CAAC,YAAY,GAAG,YAAY,CAAC;SACnC;QACD,OAAO,CAAC,KAAK,EAAE,IAAI;YACjB,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC;SACnB;QACD,OAAO,CAAC,KAAK,EAAE,IAAI;YACjB,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC;SACnB;QACD,WAAW,CAAC,KAAK,EAAE,QAAQ;YACzB,KAAK,CAAC,MAAM,CAAC,QAAQ,GAAG,QAAQ,CAAC;SAClC;QACD,kBAAkB,CAAC,KAAK,EAAE,eAAe;YACvC,KAAK,CAAC,eAAe,GAAG,eAAe,CAAC;SACzC;QACD,SAAS;QACT,SAAS,CAAC,KAAK,EAAE,MAAM;YACrB,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC;SACvB;QACD,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;YAC5B,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC;SACvB;QACD,eAAe,CAAC,KAAK,EAAE,YAAY;YACjC,KAAK,CAAC,YAAY,GAAG,YAAY,CAAC;SACnC;QACD,eAAe,CAAC,KAAK,EAAE,YAAY;YACjC,KAAK,CAAC,YAAY,GAAG,YAAY,CAAC;SACnC;KACF;IACD,OAAO,EAAE;QACP,gCAAgC;QAChC,mBAAmB;QACnB,0BAA0B;QAC1B,4BAA4B;QAC5B,UAAU;QACV,kBAAkB;QAClB,YAAY;QACZ,UAAU;KACX;;;;;"}
|
|
@@ -96,13 +96,7 @@ const setSearchExtraParams = wireCommit('setParams');
|
|
|
96
96
|
*
|
|
97
97
|
* @public
|
|
98
98
|
*/
|
|
99
|
-
const
|
|
100
|
-
/**
|
|
101
|
-
* Sets the search state `pageSize`.
|
|
102
|
-
*
|
|
103
|
-
* @public
|
|
104
|
-
*/
|
|
105
|
-
const setPageSize = wireCommit('setPageSize');
|
|
99
|
+
const increasePageAppendingResultsWire = wireDispatchWithoutPayload('increasePageAppendingResults');
|
|
106
100
|
/**
|
|
107
101
|
* Resets the search state `isAppendingResults`.
|
|
108
102
|
*
|
|
@@ -146,7 +140,7 @@ const searchWiring = createWiring({
|
|
|
146
140
|
saveOriginWire
|
|
147
141
|
},
|
|
148
142
|
UserReachedResultsListEnd: {
|
|
149
|
-
|
|
143
|
+
increasePageAppendingResultsWire
|
|
150
144
|
},
|
|
151
145
|
SearchRequestChanged: {
|
|
152
146
|
fetchAndSaveSearchResponseWire
|
|
@@ -171,5 +165,5 @@ const searchWiring = createWiring({
|
|
|
171
165
|
}
|
|
172
166
|
});
|
|
173
167
|
|
|
174
|
-
export { cancelFetchAndSaveSearchResponseWire, fetchAndSaveSearchResponseWire,
|
|
168
|
+
export { cancelFetchAndSaveSearchResponseWire, fetchAndSaveSearchResponseWire, increasePageAppendingResultsWire, resetAppending, resetSpellcheckQuery, resetStateWire, saveOriginWire, searchWiring, setRelatedTags, setSearchExtraParams, setSearchPage, setSearchQuery, setSelectedFilters, setSort, setUrlParams };
|
|
175
169
|
//# sourceMappingURL=wiring.js.map
|