@ikas/storefront-model-functions 4.0.0-alpha.43 → 4.0.0-alpha.45

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ikas/storefront-model-functions",
3
- "version": "4.0.0-alpha.43",
3
+ "version": "4.0.0-alpha.45",
4
4
  "description": "Functions for ikas storefront models.",
5
5
  "author": "Umut Ozan Yıldırım",
6
6
  "license": "ISC",
@@ -16,8 +16,8 @@
16
16
  "build": "rm -rf build && rollup -c"
17
17
  },
18
18
  "devDependencies": {
19
- "@ikas/storefront-config": "^4.0.0-alpha.43",
20
- "@ikas/storefront-models": "^4.0.0-alpha.43",
19
+ "@ikas/storefront-config": "^4.0.0-alpha.45",
20
+ "@ikas/storefront-models": "^4.0.0-alpha.45",
21
21
  "@rollup/plugin-node-resolve": "^13.3.0",
22
22
  "@rollup/plugin-commonjs": "^22.0.0",
23
23
  "@types/lodash": "^4.14.182",
@@ -32,8 +32,8 @@
32
32
  "lodash": "^4.17.21"
33
33
  },
34
34
  "peerDependencies": {
35
- "@ikas/storefront-config": "^4.0.0-alpha.43",
36
- "@ikas/storefront-models": "^4.0.0-alpha.43",
35
+ "@ikas/storefront-config": "^4.0.0-alpha.45",
36
+ "@ikas/storefront-models": "^4.0.0-alpha.45",
37
37
  "lodash": "^4.17.21"
38
38
  }
39
39
  }
@@ -5,21 +5,15 @@ export function getPriceWithQuantity(item: IkasOrderLineItem) {
5
5
  }
6
6
 
7
7
  export function getOverridenPriceWithQuantity(item: IkasOrderLineItem) {
8
- const price =
9
- item.discountPrice !== undefined && item.discountPrice !== null
10
- ? item.price * item.quantity
11
- : null;
12
-
13
- return price !== null && price < 0 ? 0 : price;
8
+ if (item.price !== item.finalPrice) {
9
+ return item.price * item.quantity;
10
+ } else {
11
+ return 0;
12
+ }
14
13
  }
15
14
 
16
15
  export function getFinalPriceWithQuantity(item: IkasOrderLineItem) {
17
- const price =
18
- (item.discountPrice !== undefined && item.discountPrice !== null
19
- ? item.discountPrice
20
- : item.price) * item.quantity;
21
-
22
- return price < 0 ? 0 : price;
16
+ return (item.finalPrice ?? item.price) * item.quantity;
23
17
  }
24
18
 
25
19
  export function getTax(item: IkasOrderLineItem) {