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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -8,8 +8,14 @@ This project adheres to [Semantic Versioning][semantic versioning].
8
8
 
9
9
  ### Major Changes
10
10
  ### Minor Changes
11
+
12
+ - Add "clear" event to "modules/advancedSearch".
13
+ - Extend "invoiceFormat" to support storage fees (internal thing).
14
+
11
15
  ### Patch Changes
12
16
 
17
+ - Fix a bug in "modules/advancedSearch". Locale changes were incorrectly ignored in effect body.
18
+
13
19
  ## [Released]
14
20
 
15
21
  ## 13.0.0 (2024-08-12)
@@ -10,11 +10,13 @@ function invoiceLineItemDescription(li, plan, opts) {
10
10
  ? "order_fee"
11
11
  : planID.indexOf("sms_fee") !== -1
12
12
  ? "sms_fee"
13
- : planID.indexOf("transaction_fee") !== -1
14
- ? "transaction_fee"
15
- : planID.indexOf("address_verify_fee") !== -1
16
- ? "address_verify_fee"
17
- : "subscription";
13
+ : planID.indexOf("storage_fee") !== -1
14
+ ? "storage_fee"
15
+ : planID.indexOf("transaction_fee") !== -1
16
+ ? "transaction_fee"
17
+ : planID.indexOf("address_verify_fee") !== -1
18
+ ? "address_verify_fee"
19
+ : "subscription";
18
20
  let quantity = li.quantity;
19
21
  if (kind === "transaction_fee" || kind === "sms_fee" || kind === "subscription") {
20
22
  // force 1 quantity on these
@@ -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* () {
@@ -56,7 +58,7 @@ function createAdvancedSearch(config) {
56
58
  sortBy: p.sortBy,
57
59
  sortDesc: p.sortDesc,
58
60
  aggregations: agg,
59
- }, config.opts), (d) => {
61
+ }, params.config.opts), (d) => {
60
62
  var _a, _b;
61
63
  const options = d.options.sort((a, b) => {
62
64
  return a.name.localeCompare(b.name);
@@ -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,
@@ -7,11 +7,13 @@ export function invoiceLineItemDescription(li, plan, opts) {
7
7
  ? "order_fee"
8
8
  : planID.indexOf("sms_fee") !== -1
9
9
  ? "sms_fee"
10
- : planID.indexOf("transaction_fee") !== -1
11
- ? "transaction_fee"
12
- : planID.indexOf("address_verify_fee") !== -1
13
- ? "address_verify_fee"
14
- : "subscription";
10
+ : planID.indexOf("storage_fee") !== -1
11
+ ? "storage_fee"
12
+ : planID.indexOf("transaction_fee") !== -1
13
+ ? "transaction_fee"
14
+ : planID.indexOf("address_verify_fee") !== -1
15
+ ? "address_verify_fee"
16
+ : "subscription";
15
17
  let quantity = li.quantity;
16
18
  if (kind === "transaction_fee" || kind === "sms_fee" || kind === "subscription") {
17
19
  // force 1 quantity on these
@@ -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) => {
@@ -57,7 +59,7 @@ export function createAdvancedSearch(config) {
57
59
  sortBy: p.sortBy,
58
60
  sortDesc: p.sortDesc,
59
61
  aggregations: agg,
60
- }, config.opts), (d) => {
62
+ }, params.config.opts), (d) => {
61
63
  const options = d.options.sort((a, b) => {
62
64
  return a.name.localeCompare(b.name);
63
65
  });
@@ -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",
3
+ "version": "13.1.0-alpha.2",
4
4
  "description": "Lana JS Core",
5
5
  "scripts": {
6
6
  "test": "jest",
@@ -11,7 +11,7 @@ interface PlanLike {
11
11
  transaction_fee: number;
12
12
  }
13
13
  export interface InvoiceLineItemDescription {
14
- kind: "return_fee" | "order_fee" | "sms_fee" | "transaction_fee" | "address_verify_fee" | "subscription";
14
+ kind: "return_fee" | "order_fee" | "sms_fee" | "transaction_fee" | "address_verify_fee" | "storage_fee" | "subscription";
15
15
  planName: string;
16
16
  description: string;
17
17
  quantity: number;
@@ -7810,6 +7810,25 @@ export interface SurveyQuestionModify {
7810
7810
  /** The survey question itself */
7811
7811
  name?: string | null;
7812
7812
  }
7813
+ export interface SynonymEntry {
7814
+ keys: Array<string>;
7815
+ /** A kind of synonym entry */
7816
+ kind: SynonymEntryKind;
7817
+ values: Array<string>;
7818
+ }
7819
+ export interface SynonymEntryCreate {
7820
+ keys?: Array<string> | null;
7821
+ /** A kind of synonym entry */
7822
+ kind: SynonymEntryKind;
7823
+ values?: Array<string> | null;
7824
+ }
7825
+ export type SynonymEntryKind = "list" | "map";
7826
+ export interface SynonymSettings {
7827
+ entries: Array<SynonymEntry>;
7828
+ }
7829
+ export interface SynonymSettingsCreate {
7830
+ entries?: Array<SynonymEntryCreate> | null;
7831
+ }
7813
7832
  export interface Task {
7814
7833
  /** The date and time when the task was created, RFC 3339 format */
7815
7834
  created_at: string;
@@ -13828,6 +13847,32 @@ export interface EndpointShopsSettingsCreate extends Endpoint<EndpointShopsSetti
13828
13847
  expand(v: ShopSettingsExpansionMap): EndpointShopsSettingsCreate;
13829
13848
  extract(v: Extractor<ShopSettings>): EndpointShopsSettingsCreate;
13830
13849
  }
13850
+ export interface EndpointShopsSynonymSettings extends Endpoint<EndpointShopsSynonymSettings, SynonymSettings> {
13851
+ /** Output filtering */
13852
+ fields(v: Array<string>): EndpointShopsSynonymSettings;
13853
+ /** Return text in normalized form */
13854
+ normalized(v: boolean): EndpointShopsSynonymSettings;
13855
+ /** Unique shop identifier. See also: [Unique Identifiers](/overview/concepts/unique-identifiers) */
13856
+ shop_id(v: string): EndpointShopsSynonymSettings;
13857
+ extract(v: Extractor<SynonymSettings>): EndpointShopsSynonymSettings;
13858
+ }
13859
+ export interface EndpointShopsSynonymSettingsCreate extends Endpoint<EndpointShopsSynonymSettingsCreate, SynonymSettings> {
13860
+ /** Output filtering */
13861
+ fields(v: Array<string>): EndpointShopsSynonymSettingsCreate;
13862
+ /** Unique shop identifier. See also: [Unique Identifiers](/overview/concepts/unique-identifiers) */
13863
+ shop_id(v: string): EndpointShopsSynonymSettingsCreate;
13864
+ data(v: SynonymSettingsCreate): EndpointShopsSynonymSettingsCreate;
13865
+ extract(v: Extractor<SynonymSettings>): EndpointShopsSynonymSettingsCreate;
13866
+ }
13867
+ export interface EndpointShopsSynonymSettingsTest extends Endpoint<EndpointShopsSynonymSettingsTest, string> {
13868
+ /** Output filtering */
13869
+ fields(v: Array<string>): EndpointShopsSynonymSettingsTest;
13870
+ /** Unique shop identifier. See also: [Unique Identifiers](/overview/concepts/unique-identifiers) */
13871
+ shop_id(v: string): EndpointShopsSynonymSettingsTest;
13872
+ /** Text to test synonym settings against */
13873
+ text(v: string): EndpointShopsSynonymSettingsTest;
13874
+ extract(v: Extractor<string>): EndpointShopsSynonymSettingsTest;
13875
+ }
13831
13876
  export interface EndpointSlugify extends Endpoint<EndpointSlugify, string> {
13832
13877
  /** Text to slugify */
13833
13878
  text(v: string): EndpointSlugify;
@@ -15234,6 +15279,9 @@ export interface ReqFunction {
15234
15279
  (ctx: Context, v: "POST:shops/preferences.json"): EndpointShopsPreferencesCreate;
15235
15280
  (ctx: Context, v: "GET:shops/settings.json"): EndpointShopsSettings;
15236
15281
  (ctx: Context, v: "POST:shops/settings.json"): EndpointShopsSettingsCreate;
15282
+ (ctx: Context, v: "GET:shops/synonym_settings.json"): EndpointShopsSynonymSettings;
15283
+ (ctx: Context, v: "POST:shops/synonym_settings.json"): EndpointShopsSynonymSettingsCreate;
15284
+ (ctx: Context, v: "GET:shops/synonym_settings/test.json"): EndpointShopsSynonymSettingsTest;
15237
15285
  (ctx: Context, v: "GET:slugify.json"): EndpointSlugify;
15238
15286
  (ctx: Context, v: "DELETE:sms/messages.json"): EndpointSmsMessagesDelete;
15239
15287
  (ctx: Context, v: "GET:sms/messages/page.json"): EndpointSmsMessagesPage;
@@ -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>;