@lana-commerce/core 13.0.0-alpha.2 → 13.1.0-alpha.1

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 CHANGED
@@ -6,17 +6,27 @@ This project adheres to [Semantic Versioning][semantic versioning].
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ### Major Changes
10
+ ### Minor Changes
11
+
12
+ - Add "clear" event to "modules/advancedSearch".
13
+
14
+ ### Patch Changes
15
+
16
+ ## [Released]
17
+
18
+ ## 13.0.0 (2024-08-12)
19
+
9
20
  ### Major Changes
10
21
 
11
22
  - Autocomplete APIs are removed in favor of "suggest" APIs.
12
23
  - Search API pagination no longer supports keyset pagination, offset-based pagination becomes the only option.
13
24
 
14
- ### Minor Changes
15
25
  ### Patch Changes
16
26
 
17
27
  - Update how "productFiltering" converts variant options to API search requests.
18
28
 
19
- ## [Released]
29
+ ------------------------------------------------------------------------------------------------------------------
20
30
 
21
31
  ## 12.0.0 (2024-07-18)
22
32
 
@@ -40,6 +40,8 @@ function createAdvancedSearch(config) {
40
40
  const queuedFor = (0, effector_1.createStore)("");
41
41
  const data = (0, effector_1.createStore)(exports.defaultSearchData);
42
42
  const nonNullParams = data.map((d) => !!d.params);
43
+ const clear = (0, effector_1.createEvent)();
44
+ data.reset(clear);
43
45
  const unexpectedError = (0, effector_1.createEvent)();
44
46
  const loadProducts = (0, effector_1.createEvent)();
45
47
  const loadProductsFx = (0, effector_1.createEffect)((params) => tslib_1.__awaiter(this, void 0, void 0, function* () {
@@ -118,6 +120,7 @@ function createAdvancedSearch(config) {
118
120
  target: loadProductsFx,
119
121
  });
120
122
  return {
123
+ clear,
121
124
  loadProducts,
122
125
  queuedFor,
123
126
  data,
@@ -41,6 +41,8 @@ export function createAdvancedSearch(config) {
41
41
  const queuedFor = createStore("");
42
42
  const data = createStore(defaultSearchData);
43
43
  const nonNullParams = data.map((d) => !!d.params);
44
+ const clear = createEvent();
45
+ data.reset(clear);
44
46
  const unexpectedError = createEvent();
45
47
  const loadProducts = createEvent();
46
48
  const loadProductsFx = createEffect(async (params) => {
@@ -123,6 +125,7 @@ export function createAdvancedSearch(config) {
123
125
  target: loadProductsFx,
124
126
  });
125
127
  return {
128
+ clear,
126
129
  loadProducts,
127
130
  queuedFor,
128
131
  data,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lana-commerce/core",
3
- "version": "13.0.0-alpha.2",
3
+ "version": "13.1.0-alpha.1",
4
4
  "description": "Lana JS Core",
5
5
  "scripts": {
6
6
  "test": "jest",
@@ -1,9 +1,17 @@
1
- import { Store } from "effector";
1
+ import { Event, Store } from "effector";
2
2
  import { AbstractOp, GraphQLOpts, RequestResponseError } from "../request.js";
3
3
  import type { AggregatedOptions } from "../aggregateOptions.js";
4
4
  import type { Dict } from "../commonTypes.js";
5
5
  import { HierarchicalSearchOption } from "../hierarchicalSearchOption.js";
6
6
  import type { SearchOption, SearchProductsSortBy } from "../graphql/types.js";
7
+ export interface AdvancedSearch<Product> {
8
+ clear: Event<void>;
9
+ loadProducts: Event<LoadProductsEvent>;
10
+ queuedFor: Store<string>;
11
+ data: Store<SearchData<Product>>;
12
+ somethingIsPending: Store<boolean>;
13
+ unexpectedError: Event<RequestResponseError>;
14
+ }
7
15
  export interface OptionAgg {
8
16
  count: number;
9
17
  name: string;
@@ -68,10 +76,4 @@ export interface AdvancedSearchConfig<Product> {
68
76
  /** Current locale. Module will react to its changes. */
69
77
  readonly locale: Store<string>;
70
78
  }
71
- export declare function createAdvancedSearch<Product>(config: AdvancedSearchConfig<Product>): {
72
- loadProducts: import("effector").Event<LoadProductsEvent>;
73
- queuedFor: Store<string>;
74
- data: Store<SearchData<Product>>;
75
- somethingIsPending: Store<boolean>;
76
- unexpectedError: import("effector").Event<RequestResponseError>;
77
- };
79
+ export declare function createAdvancedSearch<Product>(config: AdvancedSearchConfig<Product>): AdvancedSearch<Product>;