@unchainedshop/core-products 4.8.0 → 4.8.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.
@@ -12,13 +12,7 @@ export const getDecimals = (originDecimals) => {
12
12
  return originDecimals;
13
13
  };
14
14
  export const normalizeRate = (baseCurrency, quoteCurrency, rateRecord) => {
15
- let rate = null;
16
- if (rateRecord.quoteCurrency === quoteCurrency.isoCode) {
17
- rate = rateRecord.rate;
18
- }
19
- else {
20
- rate = 1 / rateRecord.rate;
21
- }
15
+ let rate = rateRecord.quoteCurrency === quoteCurrency.isoCode ? rateRecord.rate : 1 / rateRecord.rate;
22
16
  const fromDecimals = getDecimals(baseCurrency.decimals);
23
17
  const targetDecimals = getDecimals(quoteCurrency.decimals);
24
18
  rate = fromDecimals !== targetDecimals ? rate / 10 ** (fromDecimals - targetDecimals) : rate;
@@ -107,7 +107,7 @@ export declare const configureProductsModule: (moduleInput: ModuleInput<Products
107
107
  updateRates: (rates: import("../products-index.ts").ProductPriceRate[]) => Promise<boolean>;
108
108
  };
109
109
  };
110
- create: ({ type, sequence, ...productData }: Omit<Product, "_id" | "created" | "updated" | "deleted" | "slugs"> & Pick<Partial<Product>, "_id" | "created" | "updated" | "deleted">) => Promise<Product>;
110
+ create: ({ type, sequence, ...productData }: Omit<Product, "_id" | "created" | "updated" | "deleted" | "slugs" | "sequence"> & Pick<Partial<Product>, "_id" | "created" | "updated" | "deleted" | "sequence">) => Promise<Product>;
111
111
  update: (productId: string, doc: mongodb.UpdateFilter<Product>) => Promise<string>;
112
112
  firstActiveProductProxy: (productId: string) => Promise<mongodb.WithId<Product> | null>;
113
113
  firstActiveProductBundle: (productId: string) => Promise<mongodb.WithId<Product> | null>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@unchainedshop/core-products",
3
3
  "description": "Product catalog management module for the Unchained Engine",
4
- "version": "4.8.0",
4
+ "version": "4.8.2",
5
5
  "main": "lib/products-index.js",
6
6
  "types": "lib/products-index.d.ts",
7
7
  "type": "module",