addio-admin-sdk 1.7.208 → 1.7.210
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 +10 -0
- package/dist/Interfaces/Indexed/Product/index.js +4 -5
- package/dist/Interfaces/Indexed/Product/index.js.map +1 -1
- package/dist/lib/Inventory/index.js +6 -1
- package/dist/lib/Inventory/index.js.map +1 -1
- package/dist/lib/Space/index.js +4 -5
- package/dist/lib/Space/index.js.map +1 -1
- package/dist/utils/pricing.d.ts +13 -0
- package/dist/utils/pricing.js +23 -0
- package/dist/utils/pricing.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { IPriceOptions } from '../Interfaces/Declination';
|
|
2
|
+
/**
|
|
3
|
+
* Check whether a declination's `price.discountPrice` actually defines an applicable discount.
|
|
4
|
+
*
|
|
5
|
+
* `IPriceOptions.discountPrice` is optional, but every declination built through `getDefaultPrice`
|
|
6
|
+
* sets it and uses `amount === 0` as for "no discount set". `amount: 0` therefore does
|
|
7
|
+
* NOT mean the item is worth zero (free) and must never be treated as a real price. A discount price
|
|
8
|
+
* equal to the regular price is also considered "no discount", since it removes nothing.
|
|
9
|
+
*
|
|
10
|
+
* @param price - The declination price options
|
|
11
|
+
* @returns {boolean} true when an applicable (non-zero) discount price is set
|
|
12
|
+
*/
|
|
13
|
+
export declare const hasApplicableDiscountPrice: (price: IPriceOptions) => boolean;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.hasApplicableDiscountPrice = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Check whether a declination's `price.discountPrice` actually defines an applicable discount.
|
|
6
|
+
*
|
|
7
|
+
* `IPriceOptions.discountPrice` is optional, but every declination built through `getDefaultPrice`
|
|
8
|
+
* sets it and uses `amount === 0` as for "no discount set". `amount: 0` therefore does
|
|
9
|
+
* NOT mean the item is worth zero (free) and must never be treated as a real price. A discount price
|
|
10
|
+
* equal to the regular price is also considered "no discount", since it removes nothing.
|
|
11
|
+
*
|
|
12
|
+
* @param price - The declination price options
|
|
13
|
+
* @returns {boolean} true when an applicable (non-zero) discount price is set
|
|
14
|
+
*/
|
|
15
|
+
const hasApplicableDiscountPrice = (price) => {
|
|
16
|
+
const { discountPrice, regular } = price;
|
|
17
|
+
if (discountPrice && discountPrice.amount !== 0 && discountPrice.amount !== regular.amount) {
|
|
18
|
+
return true;
|
|
19
|
+
}
|
|
20
|
+
return false;
|
|
21
|
+
};
|
|
22
|
+
exports.hasApplicableDiscountPrice = hasApplicableDiscountPrice;
|
|
23
|
+
//# sourceMappingURL=pricing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pricing.js","sourceRoot":"","sources":["../../src/utils/pricing.ts"],"names":[],"mappings":";;;AAEA;;;;;;;;;;GAUG;AACI,MAAM,0BAA0B,GAAG,CAAC,KAAoB,EAAW,EAAE;IAC3E,MAAM,EAAE,aAAa,EAAE,OAAO,EAAE,GAAG,KAAK,CAAA;IACvC,IAAI,aAAa,IAAI,aAAa,CAAC,MAAM,KAAK,CAAC,IAAI,aAAa,CAAC,MAAM,KAAK,OAAO,CAAC,MAAM,EAAE;QAC1F,OAAO,IAAI,CAAA;KACZ;IAED,OAAO,KAAK,CAAA;AACd,CAAC,CAAA;AAPY,QAAA,0BAA0B,8BAOtC"}
|