@omni-graph/omni-model 0.2.32 → 0.2.33-4-g8fdb666
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/dist/functions/billing/billingFunctions.d.ts +2 -3
- package/dist/functions/billing/billingFunctions.d.ts.map +1 -1
- package/dist/functions/billing/billingFunctions.js +5 -10
- package/dist/functions/billing/billingFunctions.js.map +1 -1
- package/dist/functions/index.js +1 -17
- package/dist/functions/index.js.map +1 -1
- package/dist/index.js +2 -18
- package/dist/index.js.map +1 -1
- package/dist/types/billing/bilingTypes.js +1 -2
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +1 -2
- package/dist/types/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { Discount } from
|
|
2
|
-
import { TierSelectionItem } from "../../types/billing/bilingTypes";
|
|
1
|
+
import { Discount, TierSelectionItem } from "../../types";
|
|
3
2
|
export declare function applyDiscount(discount: Discount, originalPrice: number): number;
|
|
4
|
-
export declare function applyDiscounts(
|
|
3
|
+
export declare function applyDiscounts(discounts: Discount[], originalPrice: number): number;
|
|
5
4
|
export declare function computeTierPricing(tier: TierSelectionItem, currencyCode?: "USD"): {
|
|
6
5
|
priceMonthly: number;
|
|
7
6
|
priceAnnual: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"billingFunctions.d.ts","sourceRoot":"","sources":["../../../src/functions/billing/billingFunctions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,
|
|
1
|
+
{"version":3,"file":"billingFunctions.d.ts","sourceRoot":"","sources":["../../../src/functions/billing/billingFunctions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAE,iBAAiB,EAAC,MAAM,aAAa,CAAC;AAExD,wBAAgB,aAAa,CAAC,QAAQ,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,GAAG,MAAM,CAM/E;AAED,wBAAgB,cAAc,CAAC,SAAS,EAAE,QAAQ,EAAE,EAAE,aAAa,EAAE,MAAM,GAAG,MAAM,CAKnF;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,iBAAiB,EAAE,YAAY,GAAE,KAAa,GAAG;IACtF,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB,EAAE,MAAM,CAAC;IACzB,eAAe,EAAE,MAAM,CAAC;IACxB,SAAS,EAAE,MAAM,CAAA;CACpB,CAeA"}
|
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.applyDiscount = applyDiscount;
|
|
4
|
-
exports.applyDiscounts = applyDiscounts;
|
|
5
|
-
exports.computeTierPricing = computeTierPricing;
|
|
6
|
-
function applyDiscount(discount, originalPrice) {
|
|
1
|
+
export function applyDiscount(discount, originalPrice) {
|
|
7
2
|
var _a, _b;
|
|
8
3
|
if (discount.type === 'PERCENTAGE') {
|
|
9
4
|
return originalPrice * (1.0 - ((_a = discount.amount) !== null && _a !== void 0 ? _a : 0.0) / 100.0);
|
|
@@ -12,13 +7,13 @@ function applyDiscount(discount, originalPrice) {
|
|
|
12
7
|
return Math.max(0.0, originalPrice - ((_b = discount.amount) !== null && _b !== void 0 ? _b : 0.0));
|
|
13
8
|
}
|
|
14
9
|
}
|
|
15
|
-
function applyDiscounts(
|
|
16
|
-
const fixedDiscounts =
|
|
17
|
-
const percentageDiscounts =
|
|
10
|
+
export function applyDiscounts(discounts, originalPrice) {
|
|
11
|
+
const fixedDiscounts = discounts.filter(discount => discount.type === 'FIXED');
|
|
12
|
+
const percentageDiscounts = discounts.filter(discount => discount.type === 'PERCENTAGE');
|
|
18
13
|
const afterFixedDiscounts = fixedDiscounts.reduce((price, discount) => applyDiscount(discount, price), originalPrice);
|
|
19
14
|
return percentageDiscounts.reduce((price, discount) => applyDiscount(discount, price), afterFixedDiscounts);
|
|
20
15
|
}
|
|
21
|
-
function computeTierPricing(tier, currencyCode = "USD") {
|
|
16
|
+
export function computeTierPricing(tier, currencyCode = "USD") {
|
|
22
17
|
var _a, _b;
|
|
23
18
|
const monthlyListPrice = tier.listPrice["USD"];
|
|
24
19
|
const monthlyDiscountedPrice = applyDiscounts(tier.discounts, monthlyListPrice);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"billingFunctions.js","sourceRoot":"","sources":["../../../src/functions/billing/billingFunctions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"billingFunctions.js","sourceRoot":"","sources":["../../../src/functions/billing/billingFunctions.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,aAAa,CAAC,QAAkB,EAAE,aAAqB;;IACnE,IAAI,QAAQ,CAAC,IAAI,KAAK,YAAY,EAAE,CAAC;QACjC,OAAO,aAAa,GAAG,CAAC,GAAG,GAAG,CAAC,MAAA,QAAQ,CAAC,MAAM,mCAAI,GAAG,CAAC,GAAG,KAAK,CAAC,CAAC;IACpE,CAAC;SAAM,CAAC;QACJ,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,aAAa,GAAG,CAAC,MAAA,QAAQ,CAAC,MAAM,mCAAI,GAAG,CAAC,CAAC,CAAC;IACnE,CAAC;AACL,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,SAAqB,EAAE,aAAqB;IACvE,MAAM,cAAc,GAAG,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC;IAC/E,MAAM,mBAAmB,GAAG,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,IAAI,KAAK,YAAY,CAAC,CAAC;IACzF,MAAM,mBAAmB,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE,CAAC,aAAa,CAAC,QAAQ,EAAE,KAAK,CAAC,EAAE,aAAa,CAAC,CAAC;IACtH,OAAO,mBAAmB,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE,CAAC,aAAa,CAAC,QAAQ,EAAE,KAAK,CAAC,EAAE,mBAAmB,CAAC,CAAC;AAChH,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,IAAuB,EAAE,eAAsB,KAAK;;IAQnF,MAAM,gBAAgB,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAA;IAC9C,MAAM,sBAAsB,GAAG,cAAc,CAAC,IAAI,CAAC,SAAS,EAAE,gBAAgB,CAAC,CAAA;IAC/E,MAAM,eAAe,GAAG,gBAAgB,GAAG,EAAE,CAAA;IAC7C,MAAM,qBAAqB,GAAG,MAAA,MAAA,IAAI,CAAC,qBAAqB,0CAAE,IAAI,mCAAI,EAAC,IAAI,EAAE,YAAY,EAAE,MAAM,EAAE,CAAC,EAAC,CAAA;IACjG,MAAM,qBAAqB,GAAG,aAAa,CAAC,qBAAqB,EAAE,sBAAsB,GAAG,EAAE,CAAC,CAAA;IAC/F,OAAO;QACH,YAAY,EAAE,sBAAsB;QACpC,WAAW,EAAE,qBAAqB;QAClC,YAAY;QACZ,gBAAgB;QAChB,eAAe;QACf,SAAS,EAAE,IAAI,CAAC,SAAS;KAC5B,CAAA;AAEL,CAAC"}
|
package/dist/functions/index.js
CHANGED
|
@@ -1,18 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./billing/billingFunctions"), exports);
|
|
1
|
+
export * from './billing/billingFunctions';
|
|
18
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/functions/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/functions/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,19 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./types"), exports);
|
|
18
|
-
__exportStar(require("./functions"), exports);
|
|
1
|
+
export * from './types';
|
|
2
|
+
export * from './functions';
|
|
19
3
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export * from './billing/bilingTypes';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC"}
|
package/dist/types/index.js
CHANGED
package/dist/types/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC"}
|