@empathyco/x-components 3.1.0-alpha.2 → 4.0.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/design-system/deprecated-full-theme.css +112 -112
  3. package/docs/API-reference/api/x-components.resultfeature.md +1 -1
  4. package/docs/API-reference/api/x-components.selectedfiltersbyfacet.md +1 -1
  5. package/js/x-modules/facets/entities/filter-entity.factory.js +2 -1
  6. package/js/x-modules/facets/entities/filter-entity.factory.js.map +1 -1
  7. package/js/x-modules/facets/store/constants.js +4 -0
  8. package/js/x-modules/facets/store/constants.js.map +1 -0
  9. package/js/x-modules/facets/store/getters/facets.getter.js +2 -1
  10. package/js/x-modules/facets/store/getters/facets.getter.js.map +1 -1
  11. package/js/x-modules/facets/store/getters/selected-filters-by-facet.getter.js +4 -3
  12. package/js/x-modules/facets/store/getters/selected-filters-by-facet.getter.js.map +1 -1
  13. package/js/x-modules/history-queries/store/actions/update-history-queries-with-search-response.action.js +3 -1
  14. package/js/x-modules/history-queries/store/actions/update-history-queries-with-search-response.action.js.map +1 -1
  15. package/js/x-modules/search/store/module.js +2 -1
  16. package/js/x-modules/search/store/module.js.map +1 -1
  17. package/package.json +14 -13
  18. package/report/x-components.api.json +3 -8
  19. package/report/x-components.api.md +3 -4
  20. package/types/types/origin.d.ts +1 -6
  21. package/types/types/origin.d.ts.map +1 -1
  22. package/types/x-modules/facets/entities/filter-entity.factory.d.ts +2 -1
  23. package/types/x-modules/facets/entities/filter-entity.factory.d.ts.map +1 -1
  24. package/types/x-modules/facets/store/constants.d.ts +2 -0
  25. package/types/x-modules/facets/store/constants.d.ts.map +1 -0
  26. package/types/x-modules/facets/store/getters/facets.getter.d.ts.map +1 -1
  27. package/types/x-modules/facets/store/getters/selected-filters-by-facet.getter.d.ts +2 -2
  28. package/types/x-modules/facets/store/getters/selected-filters-by-facet.getter.d.ts.map +1 -1
  29. package/types/x-modules/history-queries/store/actions/update-history-queries-with-search-response.action.d.ts.map +1 -1
package/CHANGELOG.md CHANGED
@@ -3,6 +3,32 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [4.0.0-alpha.0](https://github.com/empathyco/x/compare/@empathyco/x-components@3.1.0-alpha.3...@empathyco/x-components@4.0.0-alpha.0) (2023-11-16)
7
+
8
+
9
+ ### ⚠ BREAKING CHANGES
10
+
11
+ * **components:** remove deprecated origins from (#1344)
12
+ * **facets:** The '__unknown-facet__' value for a facetId is deprecated: it has been replaced by the UNKNOWN_FACET_KEY constant, whose value is '__unknown__'.
13
+
14
+ Co-authored-by: Guillermo Cacheda <cachedacodes@gmail.com>
15
+
16
+ ### Features
17
+
18
+ * **components:** remove deprecated origins (#1355) ([3d7c981](https://github.com/empathyco/x/commit/3d7c981380bd8af30724780f7810808d563db471))
19
+ * **facets:** Unify __unknown__ and __unknown-facet__ in a constant (#1351) ([30585f2](https://github.com/empathyco/x/commit/30585f2d57653aa33c68f748ff10f93202f1887e))
20
+
21
+
22
+
23
+ ## [3.1.0-alpha.3](https://github.com/empathyco/x/compare/@empathyco/x-components@3.1.0-alpha.2...@empathyco/x-components@3.1.0-alpha.3) (2023-11-13)
24
+
25
+
26
+ ### Features
27
+
28
+ * migrate from `vue-cli` to `vite` (#1350) ([52a3b6e](https://github.com/empathyco/x/commit/52a3b6e7d94587f6934e838a2e68c99af97f7999))
29
+
30
+
31
+
6
32
  ## [3.1.0-alpha.2](https://github.com/empathyco/x/compare/@empathyco/x-components@3.1.0-alpha.1...@empathyco/x-components@3.1.0-alpha.2) (2023-11-13)
7
33
 
8
34
 
@@ -14,7 +14,6 @@
14
14
  .x-normal-case {
15
15
  text-transform: none;
16
16
  }
17
-
18
17
  .x-underline {
19
18
  -webkit-text-decoration-line: underline;
20
19
  text-decoration-line: underline;
@@ -979,6 +978,7 @@
979
978
  .x-line-height--loose {
980
979
  line-height: 2 !important;
981
980
  }
981
+
982
982
  .x-line-clamp--2 {
983
983
  overflow: hidden !important;
984
984
  display: -webkit-box !important;
@@ -1145,49 +1145,6 @@
1145
1145
  .x-font-color--transparent {
1146
1146
  color: var(--x-color-base-transparent) !important;
1147
1147
  }
1148
- .x-flex-1 {
1149
- flex: 1 1 0% !important;
1150
- }
1151
-
1152
- .x-flex-auto {
1153
- flex: 1 1 auto !important;
1154
- }
1155
-
1156
- .x-flex-initial {
1157
- flex: 0 1 auto !important;
1158
- }
1159
-
1160
- .x-flex-no-shrink {
1161
- flex: 1 0 auto !important;
1162
- }
1163
-
1164
- .x-flex-none {
1165
- flex: none !important;
1166
- }
1167
-
1168
- .x-self-auto {
1169
- align-self: auto !important;
1170
- }
1171
-
1172
- .x-self-start {
1173
- align-self: flex-start !important;
1174
- }
1175
-
1176
- .x-self-end {
1177
- align-self: flex-end !important;
1178
- }
1179
-
1180
- .x-self-center {
1181
- align-self: center !important;
1182
- }
1183
-
1184
- .x-self-stretch {
1185
- align-self: stretch !important;
1186
- }
1187
-
1188
- .x-self-baseline {
1189
- align-self: baseline !important;
1190
- }
1191
1148
  .x-fill--lead {
1192
1149
  fill: var(--x-color-base-lead) !important;
1193
1150
  }
@@ -1231,6 +1188,49 @@
1231
1188
  .x-fill--transparent {
1232
1189
  fill: var(--x-color-base-transparent) !important;
1233
1190
  }
1191
+ .x-flex-1 {
1192
+ flex: 1 1 0% !important;
1193
+ }
1194
+
1195
+ .x-flex-auto {
1196
+ flex: 1 1 auto !important;
1197
+ }
1198
+
1199
+ .x-flex-initial {
1200
+ flex: 0 1 auto !important;
1201
+ }
1202
+
1203
+ .x-flex-no-shrink {
1204
+ flex: 1 0 auto !important;
1205
+ }
1206
+
1207
+ .x-flex-none {
1208
+ flex: none !important;
1209
+ }
1210
+
1211
+ .x-self-auto {
1212
+ align-self: auto !important;
1213
+ }
1214
+
1215
+ .x-self-start {
1216
+ align-self: flex-start !important;
1217
+ }
1218
+
1219
+ .x-self-end {
1220
+ align-self: flex-end !important;
1221
+ }
1222
+
1223
+ .x-self-center {
1224
+ align-self: center !important;
1225
+ }
1226
+
1227
+ .x-self-stretch {
1228
+ align-self: stretch !important;
1229
+ }
1230
+
1231
+ .x-self-baseline {
1232
+ align-self: baseline !important;
1233
+ }
1234
1234
  .dev-mode .slot-helper {
1235
1235
  font-family: inherit;
1236
1236
  color: grey;
@@ -3448,46 +3448,6 @@
3448
3448
  --x-size-line-height-small: var(--x-size-line-height-base-s);
3449
3449
  --x-string-text-decoration-small: none;
3450
3450
  }
3451
- :root {
3452
- --x-font-family-base: "Montserrat", sans-serif;
3453
- --x-size-font-base-xs: 12px;
3454
- --x-size-font-base-s: 14px;
3455
- --x-size-font-base-m: 16px;
3456
- --x-size-font-base-l: 18px;
3457
- --x-size-font-base-xl: 32px;
3458
- --x-number-font-weight-base-light: 300;
3459
- --x-number-font-weight-base-regular: 400;
3460
- --x-number-font-weight-base-bold: 600;
3461
- --x-size-line-height-base-s: 16px;
3462
- --x-size-line-height-base-m: 24px;
3463
- --x-size-line-height-base-l: 32px;
3464
- --x-color-text-default: var(--x-color-base-neutral-10);
3465
- --x-font-family-text: var(--x-font-family-base);
3466
- --x-size-font-text: var(--x-size-font-base-s);
3467
- --x-number-font-weight-text: var(--x-number-font-weight-base-regular);
3468
- --x-size-line-height-text: var(--x-size-line-height-base-s);
3469
- --x-string-text-decoration-text: none;
3470
- --x-font-family-title1: var(--x-font-family-base);
3471
- --x-size-font-title1: var(--x-size-font-base-xl);
3472
- --x-number-font-weight-title1: var(--x-number-font-weight-base-regular);
3473
- --x-size-line-height-title1: var(--x-size-line-height-base-l);
3474
- --x-string-text-decoration-title1: none;
3475
- --x-font-family-title2: var(--x-font-family-base);
3476
- --x-size-font-title2: var(--x-size-font-base-l);
3477
- --x-number-font-weight-title2: var(--x-number-font-weight-base-regular);
3478
- --x-size-line-height-title2: var(--x-size-line-height-base-m);
3479
- --x-string-text-decoration-title2: none;
3480
- --x-font-family-title3: var(--x-font-family-base);
3481
- --x-size-font-title3: var(--x-size-font-base-m);
3482
- --x-number-font-weight-title3: var(--x-number-font-weight-base-regular);
3483
- --x-size-line-height-title3: var(--x-size-line-height-base-m);
3484
- --x-string-text-decoration-title3: none;
3485
- --x-font-family-small: var(--x-font-family-base);
3486
- --x-size-font-small: var(--x-size-font-base-xs);
3487
- --x-number-font-weight-small: var(--x-number-font-weight-base-regular);
3488
- --x-size-line-height-small: var(--x-size-line-height-base-s);
3489
- --x-string-text-decoration-small: none;
3490
- }
3491
3451
 
3492
3452
  .x,
3493
3453
  .x-text {
@@ -3550,6 +3510,46 @@
3550
3510
  overflow: hidden;
3551
3511
  white-space: nowrap;
3552
3512
  }
3513
+ :root {
3514
+ --x-font-family-base: "Montserrat", sans-serif;
3515
+ --x-size-font-base-xs: 12px;
3516
+ --x-size-font-base-s: 14px;
3517
+ --x-size-font-base-m: 16px;
3518
+ --x-size-font-base-l: 18px;
3519
+ --x-size-font-base-xl: 32px;
3520
+ --x-number-font-weight-base-light: 300;
3521
+ --x-number-font-weight-base-regular: 400;
3522
+ --x-number-font-weight-base-bold: 600;
3523
+ --x-size-line-height-base-s: 16px;
3524
+ --x-size-line-height-base-m: 24px;
3525
+ --x-size-line-height-base-l: 32px;
3526
+ --x-color-text-default: var(--x-color-base-neutral-10);
3527
+ --x-font-family-text: var(--x-font-family-base);
3528
+ --x-size-font-text: var(--x-size-font-base-s);
3529
+ --x-number-font-weight-text: var(--x-number-font-weight-base-regular);
3530
+ --x-size-line-height-text: var(--x-size-line-height-base-s);
3531
+ --x-string-text-decoration-text: none;
3532
+ --x-font-family-title1: var(--x-font-family-base);
3533
+ --x-size-font-title1: var(--x-size-font-base-xl);
3534
+ --x-number-font-weight-title1: var(--x-number-font-weight-base-regular);
3535
+ --x-size-line-height-title1: var(--x-size-line-height-base-l);
3536
+ --x-string-text-decoration-title1: none;
3537
+ --x-font-family-title2: var(--x-font-family-base);
3538
+ --x-size-font-title2: var(--x-size-font-base-l);
3539
+ --x-number-font-weight-title2: var(--x-number-font-weight-base-regular);
3540
+ --x-size-line-height-title2: var(--x-size-line-height-base-m);
3541
+ --x-string-text-decoration-title2: none;
3542
+ --x-font-family-title3: var(--x-font-family-base);
3543
+ --x-size-font-title3: var(--x-size-font-base-m);
3544
+ --x-number-font-weight-title3: var(--x-number-font-weight-base-regular);
3545
+ --x-size-line-height-title3: var(--x-size-line-height-base-m);
3546
+ --x-string-text-decoration-title3: none;
3547
+ --x-font-family-small: var(--x-font-family-base);
3548
+ --x-size-font-small: var(--x-size-font-base-xs);
3549
+ --x-number-font-weight-small: var(--x-number-font-weight-base-regular);
3550
+ --x-size-line-height-small: var(--x-size-line-height-base-s);
3551
+ --x-string-text-decoration-small: none;
3552
+ }
3553
3553
  .x-text--bold.x-text {
3554
3554
  --x-number-font-weight-text: var(--x-number-font-weight-base-bold);
3555
3555
  }
@@ -4895,6 +4895,9 @@
4895
4895
  :root {
4896
4896
  --x-size-border-radius-result-card: var(--x-size-border-radius-base-s);
4897
4897
  }
4898
+ :root {
4899
+ --x-size-border-radius-result-card: var(--x-size-border-radius-base-s);
4900
+ }
4898
4901
 
4899
4902
  .x-result.x-result--card {
4900
4903
  overflow: hidden;
@@ -7414,12 +7417,6 @@
7414
7417
  .x-grid-list--cols-auto .x-grid-list__item {
7415
7418
  min-width: var(--x-size-min-width-grid-item);
7416
7419
  }
7417
- .x-filter--justified.x-filter > *:last-child:not(.x-filter__label),
7418
- .x-filter--justified.x-facet-filter > *:last-child:not(.x-filter__label),
7419
- .x-filter--justified .x-filter > *:last-child:not(.x-filter__label),
7420
- .x-filter--justified .x-facet-filter > *:last-child:not(.x-filter__label) {
7421
- margin-left: auto;
7422
- }
7423
7420
  :root {
7424
7421
  --x-size-margin-filter-children: 0;
7425
7422
  --x-size-padding-top-filter-children: 0;
@@ -8556,6 +8553,11 @@
8556
8553
  --x-size-border-radius-bottom-right-button-pill: var(--x-size-border-radius-button-pill);
8557
8554
  --x-size-border-radius-bottom-left-button-pill: var(--x-size-border-radius-button-pill);
8558
8555
  }
8556
+ :root {
8557
+ --x-color-background-button-ghost: transparent;
8558
+ --x-color-border-button-ghost: transparent;
8559
+ --x-color-text-button-ghost: var(--x-color-base-lead);
8560
+ }
8559
8561
  :root {
8560
8562
  --x-size-border-radius-button-pill: var(--x-size-border-radius-base-pill);
8561
8563
  --x-size-border-radius-top-left-button-pill: var(--x-size-border-radius-button-pill);
@@ -8583,11 +8585,6 @@
8583
8585
  --x-color-border-button-ghost: transparent;
8584
8586
  --x-color-text-button-ghost: var(--x-color-base-lead);
8585
8587
  }
8586
- :root {
8587
- --x-color-background-button-ghost: transparent;
8588
- --x-color-border-button-ghost: transparent;
8589
- --x-color-text-button-ghost: var(--x-color-base-lead);
8590
- }
8591
8588
 
8592
8589
  .x-button--ghost.x-button,
8593
8590
  .x-button--ghost .x-button {
@@ -8628,6 +8625,13 @@
8628
8625
  --x-number-font-weight-button-default: var(--x-number-font-weight-base-bold);
8629
8626
  --x-size-line-height-button-default: var(--x-size-line-height-text);
8630
8627
  }
8628
+ :root {
8629
+ --x-size-border-radius-button-card: var(--x-size-border-radius-base-s);
8630
+ --x-size-border-radius-top-left-button-card: var(--x-size-border-radius-button-card);
8631
+ --x-size-border-radius-top-right-button-card: var(--x-size-border-radius-button-card);
8632
+ --x-size-border-radius-bottom-right-button-card: var(--x-size-border-radius-button-card);
8633
+ --x-size-border-radius-bottom-left-button-card: var(--x-size-border-radius-button-card);
8634
+ }
8631
8635
  :root {
8632
8636
  --x-color-background-button-default: var(--x-color-base-lead);
8633
8637
  --x-color-border-button-default: var(--x-color-background-button-default);
@@ -8714,11 +8718,14 @@
8714
8718
  }
8715
8719
  }
8716
8720
  :root {
8717
- --x-size-border-radius-button-card: var(--x-size-border-radius-base-s);
8718
- --x-size-border-radius-top-left-button-card: var(--x-size-border-radius-button-card);
8719
- --x-size-border-radius-top-right-button-card: var(--x-size-border-radius-button-card);
8720
- --x-size-border-radius-bottom-right-button-card: var(--x-size-border-radius-button-card);
8721
- --x-size-border-radius-bottom-left-button-card: var(--x-size-border-radius-button-card);
8721
+ --x-color-background-badge-default: var(--x-color-base-neutral-10);
8722
+ --x-color-text-badge-default: var(--x-color-base-neutral-100);
8723
+ --x-color-border-badge-default: var(--x-color-base-neutral-10);
8724
+ --x-size-border-radius-badge-default: var(--x-size-border-radius-base-pill);
8725
+ --x-size-border-width-badge-default: 0;
8726
+ --x-size-width-badge-default: 1.5em;
8727
+ --x-number-font-weight-badge-default: var(--x-number-font-weight-base-regular);
8728
+ --x-size-font-badge-default: var(--x-size-font-base-xs);
8722
8729
  }
8723
8730
  :root {
8724
8731
  --x-size-border-radius-button-card: var(--x-size-border-radius-base-s);
@@ -8752,16 +8759,6 @@
8752
8759
  --x-number-font-weight-badge-default: var(--x-number-font-weight-base-regular);
8753
8760
  --x-size-font-badge-default: var(--x-size-font-base-xs);
8754
8761
  }
8755
- :root {
8756
- --x-color-background-badge-default: var(--x-color-base-neutral-10);
8757
- --x-color-text-badge-default: var(--x-color-base-neutral-100);
8758
- --x-color-border-badge-default: var(--x-color-base-neutral-10);
8759
- --x-size-border-radius-badge-default: var(--x-size-border-radius-base-pill);
8760
- --x-size-border-width-badge-default: 0;
8761
- --x-size-width-badge-default: 1.5em;
8762
- --x-number-font-weight-badge-default: var(--x-number-font-weight-base-regular);
8763
- --x-size-font-badge-default: var(--x-size-font-base-xs);
8764
- }
8765
8762
 
8766
8763
  [dir="ltr"] .x-badge {
8767
8764
  right: calc(var(--x-size-width-badge-default) / 4);
@@ -8843,6 +8840,9 @@
8843
8840
  --x-size-border-radius-base-pill: 99999px;
8844
8841
  --x-size-border-width-base: 1px;
8845
8842
  }
8846
- :root {
8847
- --x-size-border-radius-result-card: var(--x-size-border-radius-base-s);
8843
+ .x-filter--justified.x-filter > *:last-child:not(.x-filter__label),
8844
+ .x-filter--justified.x-facet-filter > *:last-child:not(.x-filter__label),
8845
+ .x-filter--justified .x-filter > *:last-child:not(.x-filter__label),
8846
+ .x-filter--justified .x-facet-filter > *:last-child:not(.x-filter__label) {
8847
+ margin-left: auto;
8848
8848
  }
@@ -9,5 +9,5 @@ The name of the tool that generated the results.
9
9
  **Signature:**
10
10
 
11
11
  ```typescript
12
- export type ResultFeature = 'search' | 'topclicked_recommendations' | 'brand_recommendations' | 'next_query_recommendations' | 'semantic_recommendations' | 'partial_results' | 'identifier_result' | deprecatedFeatureNames;
12
+ export type ResultFeature = 'search' | 'topclicked_recommendations' | 'brand_recommendations' | 'next_query_recommendations' | 'semantic_recommendations' | 'partial_results' | 'identifier_result';
13
13
  ```
@@ -14,5 +14,5 @@ selectedFiltersByFacet: FacetsXStoreModule['getters']['selectedFiltersByFacet']
14
14
 
15
15
  ## Remarks
16
16
 
17
- If there are filters without facet Id (RawFilter), they will be grouped under `__unknown-facet__` key.
17
+ If there are filters without facetId (RawFilter), they will be grouped under the UNKNOWN\_FACET\_KEY constant.
18
18
 
@@ -1,4 +1,5 @@
1
1
  import { isFacetFilter } from '@empathyco/x-types';
2
+ import { UNKNOWN_FACET_KEY } from '../store/constants.js';
2
3
  import { EditableNumberRangeFilterEntity } from './editable-number-range-filter.entity.js';
3
4
  import { HierarchicalFilterEntity } from './hierarchical-filter.entity.js';
4
5
  import { NumberRangeFilterEntity } from './number-range-filter.entity.js';
@@ -47,7 +48,7 @@ class FilterEntityFactory {
47
48
  * @returns The {@link FilterEntity} created by the factory.
48
49
  */
49
50
  getFilterEntity(store, filter) {
50
- const cacheKey = isFacetFilter(filter) ? filter.facetId : '__unknown-facet__';
51
+ const cacheKey = isFacetFilter(filter) ? filter.facetId : UNKNOWN_FACET_KEY;
51
52
  return this.cache[cacheKey] ?? (this.cache[cacheKey] = this.createFilterEntity(store, filter));
52
53
  }
53
54
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"filter-entity.factory.js","sources":["../../../../../src/x-modules/facets/entities/filter-entity.factory.ts"],"sourcesContent":["import { Facet, FilterModelName, Filter, isFacetFilter } from '@empathyco/x-types';\nimport { Store } from 'vuex';\nimport { RootXStoreState } from '../../../store/store.types';\nimport { EditableNumberRangeFilterEntity } from './editable-number-range-filter.entity';\nimport { HierarchicalFilterEntity } from './hierarchical-filter.entity';\nimport { NumberRangeFilterEntity } from './number-range-filter.entity';\nimport { RawFilterEntity } from './raw-filter.entity';\nimport { SimpleFilterEntity } from './simple-filter.entity';\nimport { FilterEntity, FilterEntityConstructor, FilterEntityModifier } from './types';\n\n/**\n * Creates {@link FilterEntity | FilterEntities} based on the provided configs.\n *\n * @internal\n */\nexport class FilterEntityFactory {\n /**\n * The public global instance of the Singleton.\n *\n * @remarks The constructor is not private, so it's possible to create more instances,\n * to simplify the testing.\n */\n public static instance = new FilterEntityFactory();\n\n /**\n * The registered entities by default to be used by the Factory.\n */\n protected entities: FilterEntityConstructor[] = [\n SimpleFilterEntity,\n HierarchicalFilterEntity,\n NumberRangeFilterEntity,\n EditableNumberRangeFilterEntity,\n RawFilterEntity\n ];\n\n /**\n * The registered modifiers grouped by the facetId to be applied.\n */\n protected modifiersByFacetId: Record<Facet['id'], FilterEntityModifier[]> = {};\n\n /**\n * The registered modifiers grouped by the filter `ModelName` to be applied.\n */\n protected modifiersByFilterModelName: Partial<Record<FilterModelName, FilterEntityModifier[]>> =\n {};\n\n /**\n * Contains the instantiated entities for each facet.\n *\n * @internal\n */\n protected cache: Record<Facet['id'] | '__unknown-facet__', FilterEntity> = {};\n\n /**\n * Creates a new FilterEntity from a filter.\n *\n * @param store - The {@link https://vuex.vuejs.org/guide/ | Vuex Store} that the entity will\n * use.\n * @param filter - The {@link @empathyco/x-types#Filter | Filter} necessary to know what\n * {@link FilterEntity} to create.\n * @returns The {@link FilterEntity} created by the factory.\n */\n getFilterEntity(store: Store<RootXStoreState>, filter: Filter): FilterEntity {\n const cacheKey = isFacetFilter(filter) ? filter.facetId : '__unknown-facet__';\n return this.cache[cacheKey] ?? (this.cache[cacheKey] = this.createFilterEntity(store, filter));\n }\n\n /**\n * Creates a brand new {@link FilterEntity} for the given\n * {@link @empathyco/x-types#Filter | Filter}.\n *\n * @param store - The store which should be mutated through the entity.\n * @param filter - The filter to create the entity for.\n * @returns A new {@link FilterEntity} for the given {@link @empathyco/x-types#Filter | Filter}.\n * @internal\n */\n protected createFilterEntity(store: Store<RootXStoreState>, filter: Filter): FilterEntity {\n const filterEntityConstructor = this.entities.find(entity => entity.accepts(filter));\n if (!filterEntityConstructor) {\n throw new Error(`Entity configuration for ${filter.modelName} not registered.`);\n }\n const entity = new filterEntityConstructor(store);\n const modifiers = isFacetFilter(filter)\n ? this.modifiersByFacetId[filter.facetId] ??\n this.modifiersByFilterModelName[filter.modelName] ??\n []\n : [];\n return modifiers.reduce(\n (modifiedEntity, modifier) => new modifier(store, modifiedEntity),\n entity\n );\n }\n\n /**\n * Registers a new {@link FilterEntity} to be used by the factory.\n *\n * @param entity - The new {@link FilterEntity} to be registered in the factory.\n */\n registerFilterEntity(entity: FilterEntityConstructor): void {\n if (!this.entities.includes(entity)) {\n this.entities.push(entity);\n }\n }\n\n /**\n * Registers a list of modifiers to be used with the {@link FilterEntity | FilterEntities} of a\n * particular facet.\n *\n * @param facetId - The facet id whose Entities will be modified.\n * @param modifiers - The list of modifiers to be registered.\n */\n registerModifierByFacetId(facetId: Facet['id'], ...modifiers: FilterEntityModifier[]): void {\n this.updateModifiers(this.modifiersByFacetId, facetId, modifiers);\n }\n\n /**\n * Registers a list of modifiers to be used with the {@link FilterEntity | FilterEntities} of a\n * particular facet.\n *\n * @param filterModelName - The facet ModelName whose Entities will be modified.\n * @param modifiers - The list of modifiers to be registered.\n */\n registerModifierByFilterModelName(\n filterModelName: FilterModelName,\n ...modifiers: FilterEntityModifier[]\n ): void {\n this.updateModifiers(this.modifiersByFilterModelName, filterModelName, modifiers);\n }\n\n /**\n * Updates the modifiers for a particular facet.\n *\n * @param modifiersRecord - The map of modifiers to be updated.\n * @param modifierKey - The id whose modifiers will be updated.\n * @param modifiers - The list of new modifiers to be registered.\n */\n protected updateModifiers(\n modifiersRecord: Record<string, FilterEntityModifier[]>,\n modifierKey: string | number,\n modifiers: FilterEntityModifier[]\n ): void {\n if (!modifiersRecord[modifierKey]) {\n modifiersRecord[modifierKey] = [];\n }\n const facetModifiers = modifiersRecord[modifierKey];\n const newModifiers = modifiers.filter(modifier => !facetModifiers.includes(modifier));\n facetModifiers.push(...newModifiers);\n }\n}\n"],"names":[],"mappings":";;;;;;;AAUA;;;;AAIG;MACU,mBAAmB,CAAA;AAAhC,IAAA,WAAA,GAAA;AASE;;AAEG;AACO,QAAA,IAAA,CAAA,QAAQ,GAA8B;YAC9C,kBAAkB;YAClB,wBAAwB;YACxB,uBAAuB;YACvB,+BAA+B;YAC/B,eAAe;SAChB,CAAC;AAEF;;AAEG;QACO,IAAkB,CAAA,kBAAA,GAAgD,EAAE,CAAC;AAE/E;;AAEG;QACO,IAA0B,CAAA,0BAAA,GAClC,EAAE,CAAC;AAEL;;;;AAIG;QACO,IAAK,CAAA,KAAA,GAA4D,EAAE,CAAC;KAiG/E;AA/FC;;;;;;;;AAQG;IACH,eAAe,CAAC,KAA6B,EAAE,MAAc,EAAA;AAC3D,QAAA,MAAM,QAAQ,GAAG,aAAa,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC,OAAO,GAAG,mBAAmB,CAAC;QAC9E,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC,kBAAkB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC;KAChG;AAED;;;;;;;;AAQG;IACO,kBAAkB,CAAC,KAA6B,EAAE,MAAc,EAAA;AACxE,QAAA,MAAM,uBAAuB,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;QACrF,IAAI,CAAC,uBAAuB,EAAE;YAC5B,MAAM,IAAI,KAAK,CAAC,CAAA,yBAAA,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ACD,QAAA,MAAM,cAAc,GAAG,eAAe,CAAC,WAAW,CAAC,CAAC;AACpD,QAAA,MAAM,YAAY,GAAG,SAAS,CAAC,MAAM,CAAC,QAAQ,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC;AACtF,QAAA,cAAc,CAAC,IAAI,CAAC,GAAG,YAAY,CAAC,CAAC;KACtC;;AAnID;;;;;AAKG;AACW,mBAAA,CAAA,QAAQ,GAAG,IAAI,mBAAmB,EAAE;;;;"}
1
+ {"version":3,"file":"filter-entity.factory.js","sources":["../../../../../src/x-modules/facets/entities/filter-entity.factory.ts"],"sourcesContent":["import { Facet, FilterModelName, Filter, isFacetFilter } from '@empathyco/x-types';\nimport { Store } from 'vuex';\nimport { RootXStoreState } from '../../../store/store.types';\nimport { UNKNOWN_FACET_KEY } from '../store/constants';\nimport { EditableNumberRangeFilterEntity } from './editable-number-range-filter.entity';\nimport { HierarchicalFilterEntity } from './hierarchical-filter.entity';\nimport { NumberRangeFilterEntity } from './number-range-filter.entity';\nimport { RawFilterEntity } from './raw-filter.entity';\nimport { SimpleFilterEntity } from './simple-filter.entity';\nimport { FilterEntity, FilterEntityConstructor, FilterEntityModifier } from './types';\n\n/**\n * Creates {@link FilterEntity | FilterEntities} based on the provided configs.\n *\n * @internal\n */\nexport class FilterEntityFactory {\n /**\n * The public global instance of the Singleton.\n *\n * @remarks The constructor is not private, so it's possible to create more instances,\n * to simplify the testing.\n */\n public static instance = new FilterEntityFactory();\n\n /**\n * The registered entities by default to be used by the Factory.\n */\n protected entities: FilterEntityConstructor[] = [\n SimpleFilterEntity,\n HierarchicalFilterEntity,\n NumberRangeFilterEntity,\n EditableNumberRangeFilterEntity,\n RawFilterEntity\n ];\n\n /**\n * The registered modifiers grouped by the facetId to be applied.\n */\n protected modifiersByFacetId: Record<Facet['id'], FilterEntityModifier[]> = {};\n\n /**\n * The registered modifiers grouped by the filter `ModelName` to be applied.\n */\n protected modifiersByFilterModelName: Partial<Record<FilterModelName, FilterEntityModifier[]>> =\n {};\n\n /**\n * Contains the instantiated entities for each facet.\n *\n * @internal\n */\n protected cache: Record<Facet['id'] | typeof UNKNOWN_FACET_KEY, FilterEntity> = {};\n\n /**\n * Creates a new FilterEntity from a filter.\n *\n * @param store - The {@link https://vuex.vuejs.org/guide/ | Vuex Store} that the entity will\n * use.\n * @param filter - The {@link @empathyco/x-types#Filter | Filter} necessary to know what\n * {@link FilterEntity} to create.\n * @returns The {@link FilterEntity} created by the factory.\n */\n getFilterEntity(store: Store<RootXStoreState>, filter: Filter): FilterEntity {\n const cacheKey = isFacetFilter(filter) ? filter.facetId : UNKNOWN_FACET_KEY;\n return this.cache[cacheKey] ?? (this.cache[cacheKey] = this.createFilterEntity(store, filter));\n }\n\n /**\n * Creates a brand new {@link FilterEntity} for the given\n * {@link @empathyco/x-types#Filter | Filter}.\n *\n * @param store - The store which should be mutated through the entity.\n * @param filter - The filter to create the entity for.\n * @returns A new {@link FilterEntity} for the given {@link @empathyco/x-types#Filter | Filter}.\n * @internal\n */\n protected createFilterEntity(store: Store<RootXStoreState>, filter: Filter): FilterEntity {\n const filterEntityConstructor = this.entities.find(entity => entity.accepts(filter));\n if (!filterEntityConstructor) {\n throw new Error(`Entity configuration for ${filter.modelName} not registered.`);\n }\n const entity = new filterEntityConstructor(store);\n const modifiers = isFacetFilter(filter)\n ? this.modifiersByFacetId[filter.facetId] ??\n this.modifiersByFilterModelName[filter.modelName] ??\n []\n : [];\n return modifiers.reduce(\n (modifiedEntity, modifier) => new modifier(store, modifiedEntity),\n entity\n );\n }\n\n /**\n * Registers a new {@link FilterEntity} to be used by the factory.\n *\n * @param entity - The new {@link FilterEntity} to be registered in the factory.\n */\n registerFilterEntity(entity: FilterEntityConstructor): void {\n if (!this.entities.includes(entity)) {\n this.entities.push(entity);\n }\n }\n\n /**\n * Registers a list of modifiers to be used with the {@link FilterEntity | FilterEntities} of a\n * particular facet.\n *\n * @param facetId - The facet id whose Entities will be modified.\n * @param modifiers - The list of modifiers to be registered.\n */\n registerModifierByFacetId(facetId: Facet['id'], ...modifiers: FilterEntityModifier[]): void {\n this.updateModifiers(this.modifiersByFacetId, facetId, modifiers);\n }\n\n /**\n * Registers a list of modifiers to be used with the {@link FilterEntity | FilterEntities} of a\n * particular facet.\n *\n * @param filterModelName - The facet ModelName whose Entities will be modified.\n * @param modifiers - The list of modifiers to be registered.\n */\n registerModifierByFilterModelName(\n filterModelName: FilterModelName,\n ...modifiers: FilterEntityModifier[]\n ): void {\n this.updateModifiers(this.modifiersByFilterModelName, filterModelName, modifiers);\n }\n\n /**\n * Updates the modifiers for a particular facet.\n *\n * @param modifiersRecord - The map of modifiers to be updated.\n * @param modifierKey - The id whose modifiers will be updated.\n * @param modifiers - The list of new modifiers to be registered.\n */\n protected updateModifiers(\n modifiersRecord: Record<string, FilterEntityModifier[]>,\n modifierKey: string | number,\n modifiers: FilterEntityModifier[]\n ): void {\n if (!modifiersRecord[modifierKey]) {\n modifiersRecord[modifierKey] = [];\n }\n const facetModifiers = modifiersRecord[modifierKey];\n const newModifiers = modifiers.filter(modifier => !facetModifiers.includes(modifier));\n facetModifiers.push(...newModifiers);\n }\n}\n"],"names":[],"mappings":";;;;;;;;AAWA;;;;AAIG;MACU,mBAAmB,CAAA;AAAhC,IAAA,WAAA,GAAA;AASE;;AAEG;AACO,QAAA,IAAA,CAAA,QAAQ,GAA8B;YAC9C,kBAAkB;YAClB,wBAAwB;YACxB,uBAAuB;YACvB,+BAA+B;YAC/B,eAAe;SAChB,CAAC;AAEF;;AAEG;QACO,IAAkB,CAAA,kBAAA,GAAgD,EAAE,CAAC;AAE/E;;AAEG;QACO,IAA0B,CAAA,0BAAA,GAClC,EAAE,CAAC;AAEL;;;;AAIG;QACO,IAAK,CAAA,KAAA,GAAiE,EAAE,CAAC;KAiGpF;AA/FC;;;;;;;;AAQG;IACH,eAAe,CAAC,KAA6B,EAAE,MAAc,EAAA;AAC3D,QAAA,MAAM,QAAQ,GAAG,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yB,CAAC,OAAoB,EAAE,GAAG,SAAiC,EAAA;QAClF,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,kBAAkB,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC;KACnE;AAED;;;;;;AAMG;AACH,IAAA,iCAAiC,CAC/B,eAAgC,EAChC,GAAG,SAAiC,EAAA;QAEpC,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,0BAA0B,EAAE,eAAe,EAAE,SAAS,CAAC,CAAC;KACnF;AAED;;;;;;AAMG;AACO,IAAA,eAAe,CACvB,eAAuD,EACvD,WAA4B,EAC5B,SAAiC,EAAA;AAEjC,QAAA,IAAI,CAAC,eAAe,CAAC,WAAW,CAAC,EAAE;AACjC,YAAA,eAAe,CAAC,WAAW,CAAC,GAAG,EAAE,CAAC;AACnC,SAAA;AACD,QAAA,MAAM,cAAc,GAAG,eAAe,CAAC,WAAW,CAAC,CAAC;AACpD,QAAA,MAAM,YAAY,GAAG,SAAS,CAAC,MAAM,CAAC,QAAQ,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC;AACtF,QAAA,cAAc,CAAC,IAAI,CAAC,GAAG,YAAY,CAAC,CAAC;KACtC;;AAnID;;;;;AAKG;AACW,mBAAA,CAAA,QAAQ,GAAG,IAAI,mBAAmB,EAAE;;;;"}
@@ -0,0 +1,4 @@
1
+ const UNKNOWN_FACET_KEY = '__unknown__';
2
+
3
+ export { UNKNOWN_FACET_KEY };
4
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sources":["../../../../../src/x-modules/facets/store/constants.ts"],"sourcesContent":["export const UNKNOWN_FACET_KEY = '__unknown__';\n"],"names":[],"mappings":"AAAO,MAAM,iBAAiB,GAAG;;;;"}
@@ -1,6 +1,7 @@
1
1
  import { isFacetFilter } from '@empathyco/x-types';
2
2
  import { map } from '@empathyco/x-utils';
3
3
  import { groupItemsBy } from '../../../../utils/array.js';
4
+ import { UNKNOWN_FACET_KEY } from '../constants.js';
4
5
 
5
6
  /**
6
7
  * Default implementation for the {@link FacetsGetters.facets} getter.
@@ -12,7 +13,7 @@ import { groupItemsBy } from '../../../../utils/array.js';
12
13
  * @public
13
14
  */
14
15
  const facets = state => {
15
- const filtersByFacet = groupItemsBy(Object.values(state.filters), filter => isFacetFilter(filter) ? filter.facetId : '__unknown-facet__');
16
+ const filtersByFacet = groupItemsBy(Object.values(state.filters), filter => isFacetFilter(filter) ? filter.facetId : UNKNOWN_FACET_KEY);
16
17
  return map(state.facets, (_id, facet) => ({
17
18
  ...facet,
18
19
  filters: filtersByFacet[facet.id] ?? []
@@ -1 +1 @@
1
- {"version":3,"file":"facets.getter.js","sources":["../../../../../../src/x-modules/facets/store/getters/facets.getter.ts"],"sourcesContent":["import { isFacetFilter } from '@empathyco/x-types';\nimport { map } from '@empathyco/x-utils';\nimport { groupItemsBy } from '../../../../utils/array';\nimport { FacetsXStoreModule } from '../types';\n\n/**\n * Default implementation for the {@link FacetsGetters.facets} getter.\n *\n * @param state - Current {@link https://vuex.vuejs.org/guide/state.html | state} of the facets'\n * module.\n * @returns An array containing the facets with the filters.\n *\n * @public\n */\nexport const facets: FacetsXStoreModule['getters']['facets'] = state => {\n const filtersByFacet = groupItemsBy(Object.values(state.filters), filter =>\n isFacetFilter(filter) ? filter.facetId : '__unknown-facet__'\n );\n return map(state.facets, (_id, facet) => ({\n ...facet,\n filters: filtersByFacet[facet.id] ?? []\n }));\n};\n"],"names":[],"mappings":";;;;AAKA;;;;;;;;AAQG;AACU,MAAA,MAAM,GAA4C,KAAK,IAAG;AACrE,IAAA,MAAM,cAAc,GAAG,YAAY,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,MAAM,IACtE,aAAa,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC,OAAO,GAAG,mBAAmB,CAC7D,CAAC;AACF,IAAA,OAAO,GAAG,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,KAAK,MAAM;AACxC,QAAA,GAAG,KAAK;QACR,OAAO,EAAE,cAAc,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,EAAE;AACxC,KAAA,CAAC,CAAC,CAAC;AACN;;;;"}
1
+ {"version":3,"file":"facets.getter.js","sources":["../../../../../../src/x-modules/facets/store/getters/facets.getter.ts"],"sourcesContent":["import { isFacetFilter } from '@empathyco/x-types';\nimport { map } from '@empathyco/x-utils';\nimport { groupItemsBy } from '../../../../utils/array';\nimport { FacetsXStoreModule } from '../types';\nimport { UNKNOWN_FACET_KEY } from '../constants';\n\n/**\n * Default implementation for the {@link FacetsGetters.facets} getter.\n *\n * @param state - Current {@link https://vuex.vuejs.org/guide/state.html | state} of the facets'\n * module.\n * @returns An array containing the facets with the filters.\n *\n * @public\n */\nexport const facets: FacetsXStoreModule['getters']['facets'] = state => {\n const filtersByFacet = groupItemsBy(Object.values(state.filters), filter =>\n isFacetFilter(filter) ? filter.facetId : UNKNOWN_FACET_KEY\n );\n return map(state.facets, (_id, facet) => ({\n ...facet,\n filters: filtersByFacet[facet.id] ?? []\n }));\n};\n"],"names":[],"mappings":";;;;;AAMA;;;;;;;;AAQG;AACU,MAAA,MAAM,GAA4C,KAAK,IAAG;AACrE,IAAA,MAAM,cAAc,GAAG,YAAY,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,MAAM,IACtE,aAAa,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC,OAAO,GAAG,iBAAiB,CAC3D,CAAC;AACF,IAAA,OAAO,GAAG,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,KAAK,MAAM;AACxC,QAAA,GAAG,KAAK;QACR,OAAO,EAAE,cAAc,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,EAAE;AACxC,KAAA,CAAC,CAAC,CAAC;AACN;;;;"}
@@ -1,6 +1,7 @@
1
1
  import { isFacetFilter } from '@empathyco/x-types';
2
2
  import { map } from '@empathyco/x-utils';
3
3
  import { groupItemsBy } from '../../../../utils/array.js';
4
+ import { UNKNOWN_FACET_KEY } from '../constants.js';
4
5
 
5
6
  /**
6
7
  * Default implementation for the {@link FacetsGetters.selectedFiltersByFacet} getter.
@@ -11,15 +12,15 @@ import { groupItemsBy } from '../../../../utils/array.js';
11
12
  * facets' module.
12
13
  *
13
14
  * @returns A record containing the selected filters indexed by its facet id.
14
- * @remarks If there are filters without facet Id (RawFilter), they will be grouped under
15
- * `__unknown-facet__` key.
15
+ * @remarks If there are filters without facetId (RawFilter), they will be grouped under
16
+ * the UNKNOWN_FACET_KEY constant.
16
17
  *
17
18
  * @public
18
19
  */
19
20
  const selectedFiltersByFacet = (state, getters) => {
20
21
  // The `emptyRecord` is to return an empty array for those facets that haven't selected filters.
21
22
  const emptyRecord = map(state.facets, () => []);
22
- const filtersByFacet = groupItemsBy(getters.selectedFilters, filter => isFacetFilter(filter) ? filter.facetId : '__unknown-facet__');
23
+ const filtersByFacet = groupItemsBy(getters.selectedFilters, filter => isFacetFilter(filter) ? filter.facetId : UNKNOWN_FACET_KEY);
23
24
  return Object.assign(emptyRecord, filtersByFacet);
24
25
  };
25
26
 
@@ -1 +1 @@
1
- {"version":3,"file":"selected-filters-by-facet.getter.js","sources":["../../../../../../src/x-modules/facets/store/getters/selected-filters-by-facet.getter.ts"],"sourcesContent":["import { isFacetFilter } from '@empathyco/x-types';\nimport { map } from '@empathyco/x-utils';\nimport { groupItemsBy } from '../../../../utils/array';\nimport { FacetsXStoreModule, FiltersByFacet } from '../types';\n\n/**\n * Default implementation for the {@link FacetsGetters.selectedFiltersByFacet} getter.\n *\n * @param state - Current {@link https://vuex.vuejs.org/guide/state.html | state} of the facets\n * module.\n * @param getters - Current {@link https://vuex.vuejs.org/guide/getters.html | getters} of the\n * facets' module.\n *\n * @returns A record containing the selected filters indexed by its facet id.\n * @remarks If there are filters without facet Id (RawFilter), they will be grouped under\n * `__unknown-facet__` key.\n *\n * @public\n */\nexport const selectedFiltersByFacet: FacetsXStoreModule['getters']['selectedFiltersByFacet'] = (\n state,\n getters\n): FiltersByFacet => {\n // The `emptyRecord` is to return an empty array for those facets that haven't selected filters.\n const emptyRecord: FiltersByFacet = map(state.facets, () => []);\n const filtersByFacet = groupItemsBy(getters.selectedFilters, filter =>\n isFacetFilter(filter) ? filter.facetId : '__unknown-facet__'\n );\n return Object.assign(emptyRecord, filtersByFacet);\n};\n"],"names":[],"mappings":";;;;AAKA;;;;;;;;;;;;;AAaG;MACU,sBAAsB,GAA4D,CAC7F,KAAK,EACL,OAAO,KACW;;AAElB,IAAA,MAAM,WAAW,GAAmB,GAAG,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IAChE,MAAM,cAAc,GAAG,YAAY,CAAC,OAAO,CAAC,eAAe,EAAE,MAAM,IACjE,aAAa,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC,OAAO,GAAG,mBAAmB,CAC7D,CAAC;IACF,OAAO,MAAM,CAAC,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC;AACpD;;;;"}
1
+ {"version":3,"file":"selected-filters-by-facet.getter.js","sources":["../../../../../../src/x-modules/facets/store/getters/selected-filters-by-facet.getter.ts"],"sourcesContent":["import { isFacetFilter } from '@empathyco/x-types';\nimport { map } from '@empathyco/x-utils';\nimport { groupItemsBy } from '../../../../utils/array';\nimport { FacetsXStoreModule, FiltersByFacet } from '../types';\nimport { UNKNOWN_FACET_KEY } from '../constants';\n\n/**\n * Default implementation for the {@link FacetsGetters.selectedFiltersByFacet} getter.\n *\n * @param state - Current {@link https://vuex.vuejs.org/guide/state.html | state} of the facets\n * module.\n * @param getters - Current {@link https://vuex.vuejs.org/guide/getters.html | getters} of the\n * facets' module.\n *\n * @returns A record containing the selected filters indexed by its facet id.\n * @remarks If there are filters without facetId (RawFilter), they will be grouped under\n * the UNKNOWN_FACET_KEY constant.\n *\n * @public\n */\nexport const selectedFiltersByFacet: FacetsXStoreModule['getters']['selectedFiltersByFacet'] = (\n state,\n getters\n): FiltersByFacet => {\n // The `emptyRecord` is to return an empty array for those facets that haven't selected filters.\n const emptyRecord: FiltersByFacet = map(state.facets, () => []);\n const filtersByFacet = groupItemsBy(getters.selectedFilters, filter =>\n isFacetFilter(filter) ? filter.facetId : UNKNOWN_FACET_KEY\n );\n return Object.assign(emptyRecord, filtersByFacet);\n};\n"],"names":[],"mappings":";;;;;AAMA;;;;;;;;;;;;;AAaG;MACU,sBAAsB,GAA4D,CAC7F,KAAK,EACL,OAAO,KACW;;AAElB,IAAA,MAAM,WAAW,GAAmB,GAAG,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IAChE,MAAM,cAAc,GAAG,YAAY,CAAC,OAAO,CAAC,eAAe,EAAE,MAAM,IACjE,aAAa,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC,OAAO,GAAG,iBAAiB,CAC3D,CAAC;IACF,OAAO,MAAM,CAAC,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC;AACpD;;;;"}
@@ -1,3 +1,5 @@
1
+ import { UNKNOWN_FACET_KEY } from '../../../facets/store/constants.js';
2
+
1
3
  /**
2
4
  * Default implementation for the
3
5
  * {@link HistoryQueriesActions.updateHistoryQueriesWithSearchResponse} action.
@@ -52,7 +54,7 @@ function getHistoryQueriesFiltersList(responseFacets, requestFilters) {
52
54
  }
53
55
  else {
54
56
  return Object.entries(requestFilters).flatMap(([facetId, facetFilters]) => {
55
- const matchingFacet = facetId !== '__unknown__' ? responseFacets.find(facet => facet.id === facetId) : null;
57
+ const matchingFacet = facetId !== UNKNOWN_FACET_KEY ? responseFacets.find(facet => facet.id === facetId) : null;
56
58
  return facetFilters.reduce((accFilters, requestFilter) => {
57
59
  const matchingFilter = matchingFacet
58
60
  ? matchingFacet.filters.find(filter => filter.id === requestFilter.id)
@@ -1 +1 @@
1
- {"version":3,"file":"update-history-queries-with-search-response.action.js","sources":["../../../../../../src/x-modules/history-queries/store/actions/update-history-queries-with-search-response.action.ts"],"sourcesContent":["import { Filter } from '@empathyco/x-types';\nimport { HistoryQueriesXStoreModule } from '../types';\nimport { InternalSearchResponse } from '../../../search/index';\n\n/**\n * Default implementation for the\n * {@link HistoryQueriesActions.updateHistoryQueriesWithSearchResponse} action.\n *\n * The matching history query will only be updated on the following scenarios:\n * 1. If it is part of a previous session, not the current one.\n * 2. If its total results count has not been registered yet.\n * 3. If there is a new search response.\n *\n * @param context - The {@link https://vuex.vuejs.org/guide/actions.html | context} of the actions,\n * provided by Vuex.\n *\n * @param searchResponse - The search response to update history queries with.\n *\n * @returns A `void` promise that resolves when the history query finishes updating.\n *\n * @public\n */\n// eslint-disable-next-line max-len\nexport const updateHistoryQueriesWithSearchResponse: HistoryQueriesXStoreModule['actions']['updateHistoryQueriesWithSearchResponse'] =\n ({ state, dispatch }, searchResponse) => {\n if (searchResponse.status === 'success') {\n const indexOfHistoryQuery = state.historyQueries.findIndex(\n ({ query }) => query === searchResponse.request.query\n );\n if (indexOfHistoryQuery >= 0) {\n const historyQuery = state.historyQueries[indexOfHistoryQuery];\n const isCurrentSessionHistoryQuery = historyQuery.timestamp > state.sessionTimeStampInMs;\n if (!isCurrentSessionHistoryQuery || historyQuery.totalResults == null || searchResponse) {\n const filters = getHistoryQueriesFiltersList(\n searchResponse.facets,\n searchResponse.request.filters\n );\n\n const newHistoryQueries = state.historyQueries.slice();\n newHistoryQueries[indexOfHistoryQuery] = {\n ...historyQuery,\n totalResults: searchResponse.totalResults,\n selectedFilters: filters\n };\n return dispatch('setHistoryQueries', newHistoryQueries);\n }\n }\n }\n };\n\n/**\n * Creates a selected filters list by comparing request filters and response facets.\n * Uses the 'filter.id' to match and merge the objects in a single one with all the keys.\n *\n * @param responseFacets - Facets from the response.\n * @param requestFilters - Filters from the request.\n *\n * @returns A list of selected filters in the history query.\n *\n */\nfunction getHistoryQueriesFiltersList(\n responseFacets: InternalSearchResponse['facets'],\n requestFilters: InternalSearchResponse['request']['filters']\n): Filter[] {\n if (!requestFilters || !responseFacets) {\n return [];\n } else {\n return Object.entries(requestFilters).flatMap(([facetId, facetFilters]) => {\n const matchingFacet =\n facetId !== '__unknown__' ? responseFacets.find(facet => facet.id === facetId) : null;\n\n return facetFilters.reduce<Filter[]>((accFilters, requestFilter) => {\n const matchingFilter = matchingFacet\n ? matchingFacet.filters.find(filter => filter.id === requestFilter.id)\n : responseFacets\n .flatMap(facet => facet.filters)\n .find(filter => filter.id === requestFilter.id);\n\n if (matchingFilter) {\n accFilters.push({ ...matchingFilter, selected: requestFilter.selected });\n }\n\n return accFilters;\n }, []);\n });\n }\n}\n"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;AAiBG;AACH;AACO,MAAM,sCAAsC,GACjD,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,cAAc,KAAI;AACtC,IAAA,IAAI,cAAc,CAAC,MAAM,KAAK,SAAS,EAAE;QACvC,MAAM,mBAAmB,GAAG,KAAK,CAAC,cAAc,CAAC,SAAS,CACxD,CAAC,EAAE,KAAK,EAAE,KAAK,KAAK,KAAK,cAAc,CAAC,OAAO,CAAC,KAAK,CACtD,CAAC;QACF,IAAI,mBAAmB,IAAI,CAAC,EAAE;YAC5B,MAAM,YAAY,GAAG,KAAK,CAAC,cAAc,CAAC,mBAAmB,CAAC,CAAC;YAC/D,MAAM,4BAA4B,GAAG,YAAY,CAAC,SAAS,GAAG,KAAK,CAAC,oBAAoB,CAAC;YACzF,IAAI,CAAC,4BAA4B,IAAI,YAAY,CAAC,YAAY,IAAI,IAAI,IAAI,cAAc,EAAE;AACxF,gBAAA,MAAM,OAAO,GAAG,4BAA4B,CAC1C,cAAc,CAAC,MAAM,EACrB,cAAc,CAAC,OAAO,CAAC,OAAO,CAC/B,CAAC;gBAEF,MAAM,iBAAiB,GAAG,KAAK,CAAC,cAAc,CAAC,KAAK,EAAE,CAAC;gBACvD,iBAAiB,CAAC,mBAAmB,CAAC,GAA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CAAC,CAAC;AACT,SAAC,CAAC,CAAC;AACJ,KAAA;AACH;;;;"}
1
+ {"version":3,"file":"update-history-queries-with-search-response.action.js","sources":["../../../../../../src/x-modules/history-queries/store/actions/update-history-queries-with-search-response.action.ts"],"sourcesContent":["import { Filter } from '@empathyco/x-types';\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport { HistoryQueriesActions, HistoryQueriesXStoreModule } from '../types';\nimport { InternalSearchResponse } from '../../../search/index';\nimport { UNKNOWN_FACET_KEY } from '../../../facets/store/constants';\n\n/**\n * Default implementation for the\n * {@link HistoryQueriesActions.updateHistoryQueriesWithSearchResponse} action.\n *\n * The matching history query will only be updated on the following scenarios:\n * 1. If it is part of a previous session, not the current one.\n * 2. If its total results count has not been registered yet.\n * 3. If there is a new search response.\n *\n * @param context - The {@link https://vuex.vuejs.org/guide/actions.html | context} of the actions,\n * provided by Vuex.\n *\n * @param searchResponse - The search response to update history queries with.\n *\n * @returns A `void` promise that resolves when the history query finishes updating.\n *\n * @public\n */\n// eslint-disable-next-line max-len\nexport const updateHistoryQueriesWithSearchResponse: HistoryQueriesXStoreModule['actions']['updateHistoryQueriesWithSearchResponse'] =\n ({ state, dispatch }, searchResponse) => {\n if (searchResponse.status === 'success') {\n const indexOfHistoryQuery = state.historyQueries.findIndex(\n ({ query }) => query === searchResponse.request.query\n );\n if (indexOfHistoryQuery >= 0) {\n const historyQuery = state.historyQueries[indexOfHistoryQuery];\n const isCurrentSessionHistoryQuery = historyQuery.timestamp > state.sessionTimeStampInMs;\n if (!isCurrentSessionHistoryQuery || historyQuery.totalResults == null || searchResponse) {\n const filters = getHistoryQueriesFiltersList(\n searchResponse.facets,\n searchResponse.request.filters\n );\n\n const newHistoryQueries = state.historyQueries.slice();\n newHistoryQueries[indexOfHistoryQuery] = {\n ...historyQuery,\n totalResults: searchResponse.totalResults,\n selectedFilters: filters\n };\n return dispatch('setHistoryQueries', newHistoryQueries);\n }\n }\n }\n };\n\n/**\n * Creates a selected filters list by comparing request filters and response facets.\n * Uses the 'filter.id' to match and merge the objects in a single one with all the keys.\n *\n * @param responseFacets - Facets from the response.\n * @param requestFilters - Filters from the request.\n *\n * @returns A list of selected filters in the history query.\n *\n */\nfunction getHistoryQueriesFiltersList(\n responseFacets: InternalSearchResponse['facets'],\n requestFilters: InternalSearchResponse['request']['filters']\n): Filter[] {\n if (!requestFilters || !responseFacets) {\n return [];\n } else {\n return Object.entries(requestFilters).flatMap(([facetId, facetFilters]) => {\n const matchingFacet =\n facetId !== UNKNOWN_FACET_KEY ? responseFacets.find(facet => facet.id === facetId) : null;\n\n return facetFilters.reduce<Filter[]>((accFilters, requestFilter) => {\n const matchingFilter = matchingFacet\n ? matchingFacet.filters.find(filter => filter.id === requestFilter.id)\n : responseFacets\n .flatMap(facet => facet.filters)\n .find(filter => filter.id === requestFilter.id);\n\n if (matchingFilter) {\n accFilters.push({ ...matchingFilter, selected: requestFilter.selected });\n }\n\n return accFilters;\n }, []);\n });\n }\n}\n"],"names":[],"mappings":";;AAMA;;;;;;;;;;;;;;;;;AAiBG;AACH;AACO,MAAM,sCAAsC,GACjD,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,cAAc,KAAI;AACtC,IAAA,IAAI,cAAc,CAAC,MAAM,KAAK,SAAS,EAAE;QACvC,MAAM,mBAAmB,GAAG,KAAK,CAAC,cAAc,CAAC,SAAS,CACxD,CAAC,EAAE,KAAK,EAAE,KAAK,KAAK,KAAK,cAAc,CAAC,OAAO,CAAC,KAAK,CACtD,CAAC;QACF,IAAI,mBAAmB,IAAI,CAAC,EAAE;YAC5B,MAAM,YAAY,GAAG,KAAK,CAAC,cAAc,CAAC,mBAAmB,CAAC,CAAC;YAC/D,MAAM,4BAA4B,GAAG,YAAY,CAAC,SAAS,GAAG,KAAK,CAAC,oBAAoB,CAAC;YACzF,IAAI,CAAC,4BAA4B,IAAI,YAAY,CAAC,YAAY,IAAI,IAAI,IAAI,cAAc,EAAE;AACxF,gBAAA,MAAM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C;AAEtD,gBAAA,IAAI,cAAc,EAAE;AAClB,oBAAA,UAAU,CAAC,IAAI,CAAC,EAAE,GAAG,cAAc,EAAE,QAAQ,EAAE,aAAa,CAAC,QAAQ,EAAE,CAAC,CAAC;AAC1E,iBAAA;AAED,gBAAA,OAAO,UAAU,CAAC;aACnB,EAAE,EAAE,CAAC,CAAC;AACT,SAAC,CAAC,CAAC;AACJ,KAAA;AACH;;;;"}
@@ -3,6 +3,7 @@ import { setQuery } from '../../../store/utils/query.utils.js';
3
3
  import { setStatus } from '../../../store/utils/status-store.utils.js';
4
4
  import { groupItemsBy } from '../../../utils/array.js';
5
5
  import { setConfig, mergeConfig } from '../../../store/utils/config-store.utils.js';
6
+ import { UNKNOWN_FACET_KEY } from '../../facets/store/constants.js';
6
7
  import { cancelFetchAndSaveSearchResponse, fetchAndSaveSearchResponse } from './actions/fetch-and-save-search-response.action.js';
7
8
  import { fetchSearchResponse } from './actions/fetch-search-response.action.js';
8
9
  import { increasePageAppendingResults } from './actions/increase-page-apending-results.action.js';
@@ -55,7 +56,7 @@ const searchXStoreModule = {
55
56
  state.relatedTags = relatedTags;
56
57
  },
57
58
  setSelectedFilters(state, selectedFilters) {
58
- state.selectedFilters = groupItemsBy(selectedFilters, filter => isFacetFilter(filter) ? filter.facetId : '__unknown__');
59
+ state.selectedFilters = groupItemsBy(selectedFilters, filter => isFacetFilter(filter) ? filter.facetId : UNKNOWN_FACET_KEY);
59
60
  },
60
61
  setBanners(state, banners) {
61
62
  state.banners = banners;
@@ -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';\nimport { mergeConfig, setConfig } from '../../../store/utils/config-store.utils';\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 { resetRequestOnRefinement } from './actions/reset-request-on-refinement.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 ...resettableState(),\n selectedFilters: {},\n params: {},\n config: {\n pageSize: 24\n },\n status: 'initial',\n isNoResults: false,\n fromNoResultsWithFilters: false\n }),\n getters: {\n request,\n query\n },\n mutations: {\n appendResults(state, results) {\n state.results.push(...results);\n },\n resetState(state) {\n Object.assign(state, resettableState());\n },\n setQuery,\n setResults(state, results) {\n state.results = 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 setConfig,\n mergeConfig,\n setIsAppendResults(state, isAppendResults) {\n state.isAppendResults = isAppendResults;\n },\n setIsNoResults(state, isNoResults) {\n state.isNoResults = isNoResults;\n },\n setFromNoResultsWithFilters(state, fromNoResultsWithFilters) {\n state.fromNoResultsWithFilters = fromNoResultsWithFilters;\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 updateResult(state, result) {\n const stateResult = state.results.find(stateResult => result.id === stateResult.id);\n if (stateResult) {\n Object.assign(stateResult, result);\n }\n }\n },\n actions: {\n cancelFetchAndSaveSearchResponse,\n fetchSearchResponse,\n fetchAndSaveSearchResponse,\n increasePageAppendingResults,\n resetRequestOnRefinement,\n saveSearchResponse,\n setUrlParams,\n saveOrigin\n }\n};\n\n/**\n * Function to return the \"resettable\" part of the state. This will be used in the `resetState`\n * mutation to reset to the initial state.\n *\n * @returns The \"resettable\" part of the {@link SearchState}.\n *\n * @internal\n */\n// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\nexport function resettableState() {\n return {\n query: '',\n results: [],\n partialResults: [],\n facets: [],\n relatedTags: [],\n banners: [],\n promoteds: [],\n totalResults: 0,\n spellcheckedQuery: '',\n sort: '',\n page: 1,\n origin: null,\n isAppendResults: false,\n redirections: [],\n queryTagging: {\n url: '',\n params: {}\n }\n };\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;AAoBA;;;;AAIG;AACU,MAAA,kBAAkB,GAAuB;AACpD,IAAA,KAAK,EAAE,OAAO;AACZ,QAAA,GAAG,eAAe,EAAE;AACpB,QAAA,eAAe,EAAE,EAAE;AACnB,QAAA,MAAM,EAAE,EAAE;AACV,QAAA,MAAM,EAAE;AACN,YAAA,QAAQ,EAAE,EAAE;AACb,SAAA;AACD,QAAA,MAAM,EAAE,SAAS;AACjB,QAAA,WAAW,EAAE,KAAK;AAClB,QAAA,wBAAwB,EAAE,KAAK;KAChC,CAAC;AACF,IAAA,OAAO,EAAE;QACP,OAAO;QACP,KAAK;AACN,KAAA;AACD,IAAA,SAAS,EAAE;QACT,aAAa,CAAC,KAAK,EAAE,O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,wBAAwB;QACxB,kBAAkB;QAClB,YAAY;QACZ,UAAU;AACX,KAAA;EACD;AAEF;;;;;;;AAOG;AACH;SACgB,eAAe,GAAA;IAC7B,OAAO;AACL,QAAA,KAAK,EAAE,EAAE;AACT,QAAA,OAAO,EAAE,EAAE;AACX,QAAA,cAAc,EAAE,EAAE;AAClB,QAAA,MAAM,EAAE,EAAE;AACV,QAAA,WAAW,EAAE,EAAE;AACf,QAAA,OAAO,EAAE,EAAE;AACX,QAAA,SAAS,EAAE,EAAE;AACb,QAAA,YAAY,EAAE,CAAC;AACf,QAAA,iBAAiB,EAAE,EAAE;AACrB,QAAA,IAAI,EAAE,EAAE;AACR,QAAA,IAAI,EAAE,CAAC;AACP,QAAA,MAAM,EAAE,IAAI;AACZ,QAAA,eAAe,EAAE,KAAK;AACtB,QAAA,YAAY,EAAE,EAAE;AAChB,QAAA,YAAY,EAAE;AACZ,YAAA,GAAG,EAAE,EAAE;AACP,YAAA,MAAM,EAAE,EAAE;AACX,SAAA;KACF,CAAC;AACJ;;;;"}
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';\nimport { mergeConfig, setConfig } from '../../../store/utils/config-store.utils';\nimport { UNKNOWN_FACET_KEY } from '../../facets/store/constants';\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 { resetRequestOnRefinement } from './actions/reset-request-on-refinement.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 ...resettableState(),\n selectedFilters: {},\n params: {},\n config: {\n pageSize: 24\n },\n status: 'initial',\n isNoResults: false,\n fromNoResultsWithFilters: false\n }),\n getters: {\n request,\n query\n },\n mutations: {\n appendResults(state, results) {\n state.results.push(...results);\n },\n resetState(state) {\n Object.assign(state, resettableState());\n },\n setQuery,\n setResults(state, results) {\n state.results = 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_FACET_KEY\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 setConfig,\n mergeConfig,\n setIsAppendResults(state, isAppendResults) {\n state.isAppendResults = isAppendResults;\n },\n setIsNoResults(state, isNoResults) {\n state.isNoResults = isNoResults;\n },\n setFromNoResultsWithFilters(state, fromNoResultsWithFilters) {\n state.fromNoResultsWithFilters = fromNoResultsWithFilters;\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 updateResult(state, result) {\n const stateResult = state.results.find(stateResult => result.id === stateResult.id);\n if (stateResult) {\n Object.assign(stateResult, result);\n }\n }\n },\n actions: {\n cancelFetchAndSaveSearchResponse,\n fetchSearchResponse,\n fetchAndSaveSearchResponse,\n increasePageAppendingResults,\n resetRequestOnRefinement,\n saveSearchResponse,\n setUrlParams,\n saveOrigin\n }\n};\n\n/**\n * Function to return the \"resettable\" part of the state. This will be used in the `resetState`\n * mutation to reset to the initial state.\n *\n * @returns The \"resettable\" part of the {@link SearchState}.\n *\n * @internal\n */\n// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\nexport function resettableState() {\n return {\n query: '',\n results: [],\n partialResults: [],\n facets: [],\n relatedTags: [],\n banners: [],\n promoteds: [],\n totalResults: 0,\n spellcheckedQuery: '',\n sort: '',\n page: 1,\n origin: null,\n isAppendResults: false,\n redirections: [],\n queryTagging: {\n url: '',\n params: {}\n }\n };\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAoBA;;;;AAIG;AACU,MAAA,kBAAkB,GAAuB;AACpD,IAAA,KAAK,EAAE,OAAO;AACZ,QAAA,GAAG,eAAe,EAAE;AACpB,QAAA,eAAe,EAAE,EAAE;AACnB,QAAA,MAAM,EAAE,EAAE;AACV,QAAA,MAAM,EAAE;AACN,YAAA,QAAQ,EAAE,EAAE;AACb,SAAA;AACD,QAAA,MAAM,EAAE,SAAS;AACjB,QAAA,WAAW,EAAE,KAAK;AAClB,QAAA,wBAAwB,EAAE,KAAK;KAChC,CAAC;AACF,IAAA,OAAO,EAAE;QACP,OAAO;QACP,KAAK;AACN,KAAA;AACD,IAAA,SAAS,EAAE;QACT,aAAa,CAAC,KAAK,EAAE,OAAO,EAAA;YAC1B,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,CAAC;SAChC;AACD,QAAA,UAAU,CAAC,KAAK,EAAA;YACd,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,eAAe,EAAE,CAAC,CAAC;SACzC;QACD,QAAQ;QACR,UAAU,CAAC,KAAK,EAAE,OAAO,EAAA;AACvB,YAAA,KAAK,CAAC,OAA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f,QAAA,OAAO,EAAE,EAAE;AACX,QAAA,SAAS,EAAE,EAAE;AACb,QAAA,YAAY,EAAE,CAAC;AACf,QAAA,iBAAiB,EAAE,EAAE;AACrB,QAAA,IAAI,EAAE,EAAE;AACR,QAAA,IAAI,EAAE,CAAC;AACP,QAAA,MAAM,EAAE,IAAI;AACZ,QAAA,eAAe,EAAE,KAAK;AACtB,QAAA,YAAY,EAAE,EAAE;AAChB,QAAA,YAAY,EAAE;AACZ,YAAA,GAAG,EAAE,EAAE;AACP,YAAA,MAAM,EAAE,EAAE;AACX,SAAA;KACF,CAAC;AACJ;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@empathyco/x-components",
3
- "version": "3.1.0-alpha.2",
3
+ "version": "4.0.0-alpha.0",
4
4
  "description": "Empathy X Components",
5
5
  "author": "Empathy Systems Corporation S.L.",
6
6
  "license": "Apache-2.0",
@@ -43,9 +43,10 @@
43
43
  "node": ">=18"
44
44
  },
45
45
  "scripts": {
46
- "serve": "vue-cli-service serve",
46
+ "serve": "vite",
47
+ "preview": "vite build && vite preview",
47
48
  "build": "ts-node --project ./build/tsconfig.json ./build/build.ts",
48
- "build:website": "vue-cli-service build",
49
+ "build:website": "vite build",
49
50
  "postbuild": "pnpm pack --pack-destination ..",
50
51
  "gen:docs": "rimraf ./docs && pnpm run gen:typescript-docs && pnpm run gen:component-docs",
51
52
  "gen:typescript-docs": "api-documenter markdown --input-folder dist/report --output-folder docs/API-reference/api",
@@ -56,10 +57,11 @@
56
57
  "test:unit-cypress": "cypress run --component --browser chrome",
57
58
  "test:unit-coverage": "jest --coverage",
58
59
  "test:unit-watch": "jest --watch",
59
- "test:e2e": "vue-cli-service test:e2e --e2e --browser chrome",
60
- "test:e2e:firefox": "vue-cli-service test:e2e --e2e --browser firefox",
61
- "test:e2e:ci": "vue-cli-service test:e2e --headless --browser chrome",
60
+ "test:e2e": "start-server-and-test preview http://localhost:8080 cypress:open",
61
+ "test:e2e:firefox": "start-server-and-test serve http://localhost:8080 cypress:open:firefox",
62
+ "test:e2e:ci": "start-server-and-test serve http://localhost:8080 cypress:open:ci",
62
63
  "test": "pnpm run test:unit && pnpm run test:e2e:ci",
64
+ "cypress:open:ci": "cypress open --e2e --headless --browser chrome",
63
65
  "cypress:open": "cypress open --e2e --browser chrome",
64
66
  "cypress:open:firefox": "cypress open --e2e --browser firefox",
65
67
  "cypress:open:component": "cypress open --component --browser chrome",
@@ -92,7 +94,7 @@
92
94
  "@badeball/cypress-cucumber-preprocessor": "~17.2.0",
93
95
  "@bahmutov/cypress-esbuild-preprocessor": "~2.2.0",
94
96
  "@cypress/vue2": "~2.0.1",
95
- "@empathyco/x-tailwindcss": "^1.0.1-alpha.0",
97
+ "@empathyco/x-tailwindcss": "^1.1.0-alpha.0",
96
98
  "@microsoft/api-documenter": "~7.22.0",
97
99
  "@microsoft/api-extractor": "~7.35.0",
98
100
  "@rollup/plugin-commonjs": "~25.0.0",
@@ -102,10 +104,7 @@
102
104
  "@types/jest": "~27.5.0",
103
105
  "@types/node": "~18.16.0",
104
106
  "@types/testing-library__jest-dom": "~5.14.5",
105
- "@vue/cli-plugin-e2e-cypress": "~5.0.8",
106
- "@vue/cli-plugin-typescript": "~5.0.8",
107
- "@vue/cli-plugin-vuex": "~5.0.8",
108
- "@vue/cli-service": "~5.0.8",
107
+ "@vitejs/plugin-vue2": "^2.2.0",
109
108
  "@vue/test-utils": "~1.0.3",
110
109
  "@vue/vue2-jest": "~27.0.0-alpha.3",
111
110
  "autoprefixer": "~10.4.4",
@@ -128,11 +127,13 @@
128
127
  "rollup-plugin-typescript2": "~0.34.1",
129
128
  "rollup-plugin-vue": "~5.1.9",
130
129
  "sass": "~1.62.0",
131
- "sass-loader": "~13.3.0",
130
+ "start-server-and-test": "~2.0.0",
132
131
  "tailwindcss": "~3.3.0",
133
132
  "ts-jest": "~27.1.0",
134
133
  "ts-node": "~10.9.1",
135
134
  "typescript": "~4.9.4",
135
+ "vite": "^4.5.0",
136
+ "vite-plugin-vue-inspector": "^4.0.0",
136
137
  "vue": "~2.7.14",
137
138
  "vue-docgen-cli": "~4.67.0",
138
139
  "vue-router": "~3.6.5",
@@ -143,5 +144,5 @@
143
144
  "access": "public",
144
145
  "directory": "dist"
145
146
  },
146
- "gitHead": "1096966c93eab5719555bb24779d94bf15a70570"
147
+ "gitHead": "dddefe3f775ffe06de6fc8c56e3076991e429829"
147
148
  }
@@ -44934,12 +44934,7 @@
44934
44934
  },
44935
44935
  {
44936
44936
  "kind": "Content",
44937
- "text": "'search' | 'topclicked_recommendations' | 'brand_recommendations' | 'next_query_recommendations' | 'semantic_recommendations' | 'partial_results' | 'identifier_result' | "
44938
- },
44939
- {
44940
- "kind": "Reference",
44941
- "text": "deprecatedFeatureNames",
44942
- "canonicalReference": "@empathyco/x-components!~deprecatedFeatureNames:type"
44937
+ "text": "'search' | 'topclicked_recommendations' | 'brand_recommendations' | 'next_query_recommendations' | 'semantic_recommendations' | 'partial_results' | 'identifier_result'"
44943
44938
  },
44944
44939
  {
44945
44940
  "kind": "Content",
@@ -44951,7 +44946,7 @@
44951
44946
  "name": "ResultFeature",
44952
44947
  "typeTokenRange": {
44953
44948
  "startIndex": 1,
44954
- "endIndex": 3
44949
+ "endIndex": 2
44955
44950
  }
44956
44951
  },
44957
44952
  {
@@ -52295,7 +52290,7 @@
52295
52290
  {
52296
52291
  "kind": "Variable",
52297
52292
  "canonicalReference": "@empathyco/x-components!selectedFiltersByFacet:var",
52298
- "docComment": "/**\n * Default implementation for the {@link FacetsGetters.selectedFiltersByFacet} getter.\n *\n * @remarks\n *\n * If there are filters without facet Id (RawFilter), they will be grouped under `__unknown-facet__` key.\n *\n * @param state - Current {@link https://vuex.vuejs.org/guide/state.html | state} of the facets module.\n *\n * @param getters - Current {@link https://vuex.vuejs.org/guide/getters.html | getters} of the facets' module.\n *\n * @returns A record containing the selected filters indexed by its facet id.\n *\n * @public\n */\n",
52293
+ "docComment": "/**\n * Default implementation for the {@link FacetsGetters.selectedFiltersByFacet} getter.\n *\n * @remarks\n *\n * If there are filters without facetId (RawFilter), they will be grouped under the UNKNOWN_FACET_KEY constant.\n *\n * @param state - Current {@link https://vuex.vuejs.org/guide/state.html | state} of the facets module.\n *\n * @param getters - Current {@link https://vuex.vuejs.org/guide/getters.html | getters} of the facets' module.\n *\n * @returns A record containing the selected filters indexed by its facet id.\n *\n * @public\n */\n",
52299
52294
  "excerptTokens": [
52300
52295
  {
52301
52296
  "kind": "Content",
@@ -2216,7 +2216,8 @@ export interface FilterEntityConstructor {
2216
2216
 
2217
2217
  // @internal
2218
2218
  export class FilterEntityFactory {
2219
- protected cache: Record<Facet['id'] | '__unknown-facet__', FilterEntity>;
2219
+ // Warning: (ae-forgotten-export) The symbol "UNKNOWN_FACET_KEY" needs to be exported by the entry point index.d.ts
2220
+ protected cache: Record<Facet['id'] | typeof UNKNOWN_FACET_KEY, FilterEntity>;
2220
2221
  protected createFilterEntity(store: Store<RootXStoreState>, filter: Filter): FilterEntity;
2221
2222
  protected entities: FilterEntityConstructor[];
2222
2223
  getFilterEntity(store: Store<RootXStoreState>, filter: Filter): FilterEntity;
@@ -4226,10 +4227,8 @@ export function resettableState(): {
4226
4227
  // @internal
4227
4228
  export const RESULT_WITH_VARIANTS_KEY: XInjectKey<Result>;
4228
4229
 
4229
- // Warning: (ae-forgotten-export) The symbol "deprecatedFeatureNames" needs to be exported by the entry point index.d.ts
4230
- //
4231
4230
  // @public
4232
- export type ResultFeature = 'search' | 'topclicked_recommendations' | 'brand_recommendations' | 'next_query_recommendations' | 'semantic_recommendations' | 'partial_results' | 'identifier_result' | deprecatedFeatureNames;
4231
+ export type ResultFeature = 'search' | 'topclicked_recommendations' | 'brand_recommendations' | 'next_query_recommendations' | 'semantic_recommendations' | 'partial_results' | 'identifier_result';
4233
4232
 
4234
4233
  // @public
4235
4234
  export type ResultOrigin = `${ResultFeature}:${FeatureLocation}`;
@@ -19,16 +19,12 @@ export type ResultOrigin = `${ResultFeature}:${FeatureLocation}`;
19
19
  * @public
20
20
  */
21
21
  export type QueryFeature = 'search_box' | 'url' | 'query_suggestion' | 'next_query' | 'popular_search' | 'history_query' | 'partial_result' | 'related_tag' | 'spellcheck' | 'customer' | 'semantics';
22
- /**
23
- * @deprecated Use other features instead.
24
- */
25
- type deprecatedFeatureNames = 'recommendations' | 'next_query_results' | 'semantics';
26
22
  /**
27
23
  * The name of the tool that generated the results.
28
24
  *
29
25
  * @public
30
26
  */
31
- export type ResultFeature = 'search' | 'topclicked_recommendations' | 'brand_recommendations' | 'next_query_recommendations' | 'semantic_recommendations' | 'partial_results' | 'identifier_result' | deprecatedFeatureNames;
27
+ export type ResultFeature = 'search' | 'topclicked_recommendations' | 'brand_recommendations' | 'next_query_recommendations' | 'semantic_recommendations' | 'partial_results' | 'identifier_result';
32
28
  /**
33
29
  * Indicates where the feature is placed.
34
30
  *
@@ -47,5 +43,4 @@ export type FeatureLocation = 'external' | 'my_history' | 'no_query' | 'results'
47
43
  * @public
48
44
  */
49
45
  export type QueryOriginInit = Partial<Pick<WireMetadata, 'feature' | 'location'>>;
50
- export {};
51
46
  //# sourceMappingURL=origin.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"origin.d.ts","sourceRoot":"","sources":["../../../src/types/origin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAEtD;;;;;GAKG;AACH,MAAM,MAAM,WAAW,GAAG,GAAG,YAAY,IAAI,eAAe,EAAE,CAAC;AAC/D;;;;;GAKG;AACH,MAAM,MAAM,YAAY,GAAG,GAAG,aAAa,IAAI,eAAe,EAAE,CAAC;AAEjE;;;;GAIG;AACH,MAAM,MAAM,YAAY,GACpB,YAAY,GACZ,KAAK,GACL,kBAAkB,GAClB,YAAY,GACZ,gBAAgB,GAChB,eAAe,GACf,gBAAgB,GAChB,aAAa,GACb,YAAY,GACZ,UAAU,GACV,WAAW,CAAC;AAGhB;;GAEG;AACH,KAAK,sB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AY,GACZ,aAAa,GACb,MAAM,GACN,kBAAkB,GAClB,KAAK,GACL,aAAa,GACb,iBAAiB,CAAC;AAEtB;;;;GAIG;AACH,MAAM,MAAM,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,YAAY,EAAE,SAAS,GAAG,UAAU,CAAC,CAAC,CAAC"}
@@ -1,6 +1,7 @@
1
1
  import { Facet, FilterModelName, Filter } from '@empathyco/x-types';
2
2
  import { Store } from 'vuex';
3
3
  import { RootXStoreState } from '../../../store/store.types';
4
+ import { UNKNOWN_FACET_KEY } from '../store/constants';
4
5
  import { FilterEntity, FilterEntityConstructor, FilterEntityModifier } from './types';
5
6
  /**
6
7
  * Creates {@link FilterEntity | FilterEntities} based on the provided configs.
@@ -32,7 +33,7 @@ export declare class FilterEntityFactory {
32
33
  *
33
34
  * @internal
34
35
  */
35
- protected cache: Record<Facet['id'] | '__unknown-facet__', FilterEntity>;
36
+ protected cache: Record<Facet['id'] | typeof UNKNOWN_FACET_KEY, FilterEntity>;
36
37
  /**
37
38
  * Creates a new FilterEntity from a filter.
38
39
  *
@@ -1 +1 @@
1
- {"version":3,"file":"filter-entity.factory.d.ts","sourceRoot":"","sources":["../../../../../src/x-modules/facets/entities/filter-entity.factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,eAAe,EAAE,MAAM,EAAiB,MAAM,oBAAoB,CAAC;AACnF,OAAO,EAAE,KAAK,EAAE,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAM7D,OAAO,EAAE,YAAY,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAEtF;;;;GAIG;AACH,qBAAa,mBAAmB;IAC9B;;;;;OAKG;IACH,OAAc,QAAQ,sBAA6B;IAEnD;;OAEG;IACH,SAAS,CAAC,QAAQ,EAAE,uBAAuB,EAAE,CAM3C;IAEF;;OAEG;IACH,SAAS,CAAC,kBAAkB,EAAE,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,oBAAoB,EAAE,CAAC,CAAM;IAE/E;;OAEG;IACH,SAAS,CAAC,0BAA0B,EAAE,OAAO,CAAC,MAAM,CAAC,eAAe,EAAE,oBAAoB,EAAE,CAAC,CAAC,CACzF;IAEL;;;;OAIG;IACH,SAAS,CAAC,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,mBAAmB,EAAE,YAAY,CAAC,CAAM;IAE9E;;;;;;;;OAQG;IACH,eAAe,CAAC,KAAK,EAAE,KAAK,CAAC,eAAe,CAAC,EAAE,MAAM,EAAE,MAAM,GAAG,YAAY;IAK5E;;;;;;;;OAQG;IACH,SAAS,CAAC,kBAAkB,CAAC,KAAK,EAAE,KAAK,CAAC,eAAe,CAAC,EAAE,MAAM,EAAE,MAAM,GAAG,YAAY;IAiBzF;;;;OAIG;IACH,oBAAoB,CAAC,MAAM,EAAE,uBAAuB,GAAG,IAAI;IAM3D;;;;;;OAMG;IACH,yBAAyB,CAAC,OAAO,EAAE,KAAK,CAAC,IAAI,CAAC,EAAE,GAAG,SAAS,EAAE,oBAAoB,EAAE,GAAG,IAAI;IAI3F;;;;;;OAMG;IACH,iCAAiC,CAC/B,eAAe,EAAE,eAAe,EAChC,GAAG,SAAS,EAAE,oBAAoB,EAAE,GACnC,IAAI;IAIP;;;;;;OAMG;IACH,SAAS,CAAC,eAAe,CACvB,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,oBAAoB,EAAE,CAAC,EACvD,WAAW,EAAE,MAAM,GAAG,MAAM,EAC5B,SAAS,EAAE,oBAAoB,EAAE,GAChC,IAAI;CAQR"}
1
+ {"version":3,"file":"filter-entity.factory.d.ts","sourceRoot":"","sources":["../../../../../src/x-modules/facets/entities/filter-entity.factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,eAAe,EAAE,MAAM,EAAiB,MAAM,oBAAoB,CAAC;AACnF,OAAO,EAAE,KAAK,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AE,GACnC,IAAI;IAIP;;;;;;OAMG;IACH,SAAS,CAAC,eAAe,CACvB,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,oBAAoB,EAAE,CAAC,EACvD,WAAW,EAAE,MAAM,GAAG,MAAM,EAC5B,SAAS,EAAE,oBAAoB,EAAE,GAChC,IAAI;CAQR"}
@@ -0,0 +1,2 @@
1
+ export declare const UNKNOWN_FACET_KEY = "__unknown__";
2
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../src/x-modules/facets/store/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iBAAiB,gBAAgB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"facets.getter.d.ts","sourceRoot":"","sources":["../../../../../../src/x-modules/facets/store/getters/facets.getter.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAE9C;;;;;;;;GAQG;AACH,eAAO,MAAM,MAAM,EAAE,kBAAkB,CAAC,SAAS,CAAC,CAAC,QAAQ,CAQ1D,CAAC"}
1
+ {"version":3,"file":"facets.getter.d.ts","sourceRoot":"","sources":["../../../../../../src/x-modules/facets/store/getters/facets.getter.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAG9C;;;;;;;;GAQG;AACH,eAAO,MAAM,MAAM,EAAE,kBAAkB,CAAC,SAAS,CAAC,CAAC,QAAQ,CAQ1D,CAAC"}
@@ -8,8 +8,8 @@ import { FacetsXStoreModule } from '../types';
8
8
  * facets' module.
9
9
  *
10
10
  * @returns A record containing the selected filters indexed by its facet id.
11
- * @remarks If there are filters without facet Id (RawFilter), they will be grouped under
12
- * `__unknown-facet__` key.
11
+ * @remarks If there are filters without facetId (RawFilter), they will be grouped under
12
+ * the UNKNOWN_FACET_KEY constant.
13
13
  *
14
14
  * @public
15
15
  */
@@ -1 +1 @@
1
- {"version":3,"file":"selected-filters-by-facet.getter.d.ts","sourceRoot":"","sources":["../../../../../../src/x-modules/facets/store/getters/selected-filters-by-facet.getter.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kBAAkB,EAAkB,MAAM,UAAU,CAAC;AAE9D;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,sBAAsB,EAAE,kBAAkB,CAAC,SAAS,CAAC,CAAC,wBAAwB,CAU1F,CAAC"}
1
+ {"version":3,"file":"selected-filters-by-facet.getter.d.ts","sourceRoot":"","sources":["../../../../../../src/x-modules/facets/store/getters/selected-filters-by-facet.getter.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kBAAkB,EAAkB,MAAM,UAAU,CAAC;AAG9D;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,sBAAsB,EAAE,kBAAkB,CAAC,SAAS,CAAC,CAAC,wBAAwB,CAU1F,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"update-history-queries-with-search-response.action.d.ts","sourceRoot":"","sources":["../../../../../../src/x-modules/history-queries/store/actions/update-history-queries-with-search-response.action.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,0BAA0B,EAAE,MAAM,UAAU,CAAC;AAGtD;;;;;;;;;;;;;;;;;GAiBG;AAEH,eAAO,MAAM,sCAAsC,EAAE,0BAA0B,CAAC,SAAS,CAAC,CAAC,wCAAwC,CAyBhI,CAAC"}
1
+ {"version":3,"file":"update-history-queries-with-search-response.action.d.ts","sourceRoot":"","sources":["../../../../../../src/x-modules/history-queries/store/actions/update-history-queries-with-search-response.action.ts"],"names":[],"mappings":"AAEA,OAAO,EAAyB,0BAA0B,EAAE,MAAM,UAAU,CAAC;AAI7E;;;;;;;;;;;;;;;;;GAiBG;AAEH,eAAO,MAAM,sCAAsC,EAAE,0BAA0B,CAAC,SAAS,CAAC,CAAC,wCAAwC,CAyBhI,CAAC"}