@purpleschool/gptbot 0.8.88 → 0.8.90
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/build/helpers/image-editor/calculate-image-editor-price.helper.js +3 -3
- package/build/helpers/image-generation/calculate-image-generation-price.helper.js +4 -4
- package/build/helpers/index.js +1 -0
- package/build/helpers/music/calculate-music-price.helper.js +13 -0
- package/build/helpers/music/index.js +17 -0
- package/helpers/image-editor/calculate-image-editor-price.helper.ts +3 -3
- package/helpers/image-generation/calculate-image-generation-price.helper.ts +4 -4
- package/helpers/index.ts +1 -0
- package/helpers/music/calculate-music-price.helper.ts +23 -0
- package/helpers/music/index.ts +1 -0
- package/package.json +1 -1
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.calculateImageEditorPrice = calculateImageEditorPrice;
|
|
4
4
|
function calculateImageEditorPrice({ basePrice, userHasActiveSubscriptionOrProduct, rules, }) {
|
|
5
|
-
let
|
|
5
|
+
let price = basePrice;
|
|
6
6
|
for (const rule of rules !== null && rules !== void 0 ? rules : []) {
|
|
7
7
|
const condition = rule.condition;
|
|
8
8
|
if (condition.withoutSub && userHasActiveSubscriptionOrProduct === false) {
|
|
9
|
-
|
|
9
|
+
price += rule.value;
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
|
-
return
|
|
12
|
+
return price;
|
|
13
13
|
}
|
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.calculateImageGenerationPrice = calculateImageGenerationPrice;
|
|
4
4
|
function calculateImageGenerationPrice({ basePrice, params, userHasActiveSubscriptionOrProduct, rules, }) {
|
|
5
|
-
let
|
|
5
|
+
let price = basePrice;
|
|
6
6
|
for (const rule of rules !== null && rules !== void 0 ? rules : []) {
|
|
7
7
|
const condition = rule.condition;
|
|
8
8
|
if (condition.resolution && condition.resolution === params.resolution) {
|
|
9
|
-
|
|
9
|
+
price += rule.value;
|
|
10
10
|
}
|
|
11
11
|
if (condition.withoutSub && userHasActiveSubscriptionOrProduct === false) {
|
|
12
|
-
|
|
12
|
+
price += rule.value;
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
|
-
return
|
|
15
|
+
return price;
|
|
16
16
|
}
|
package/build/helpers/index.js
CHANGED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.calculateMusicPrice = calculateMusicPrice;
|
|
4
|
+
function calculateMusicPrice({ basePrice, userHasActiveSubscriptionOrProduct, rules, }) {
|
|
5
|
+
let price = basePrice;
|
|
6
|
+
for (const rule of rules !== null && rules !== void 0 ? rules : []) {
|
|
7
|
+
const condition = rule.condition;
|
|
8
|
+
if (condition.withoutSub && userHasActiveSubscriptionOrProduct === false) {
|
|
9
|
+
price += rule.value;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
return price;
|
|
13
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
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("./calculate-music-price.helper"), exports);
|
|
@@ -9,15 +9,15 @@ export function calculateImageEditorPrice({
|
|
|
9
9
|
userHasActiveSubscriptionOrProduct: boolean;
|
|
10
10
|
rules: ImageEditorModelPricingRules;
|
|
11
11
|
}): number {
|
|
12
|
-
let
|
|
12
|
+
let price = basePrice;
|
|
13
13
|
|
|
14
14
|
for (const rule of rules ?? []) {
|
|
15
15
|
const condition = rule.condition;
|
|
16
16
|
|
|
17
17
|
if (condition.withoutSub && userHasActiveSubscriptionOrProduct === false) {
|
|
18
|
-
|
|
18
|
+
price += rule.value;
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
return
|
|
22
|
+
return price;
|
|
23
23
|
}
|
|
@@ -11,19 +11,19 @@ export function calculateImageGenerationPrice({
|
|
|
11
11
|
userHasActiveSubscriptionOrProduct: boolean;
|
|
12
12
|
rules: ImageModelPricingRules;
|
|
13
13
|
}): number {
|
|
14
|
-
let
|
|
14
|
+
let price = basePrice;
|
|
15
15
|
|
|
16
16
|
for (const rule of rules ?? []) {
|
|
17
17
|
const condition = rule.condition;
|
|
18
18
|
|
|
19
19
|
if (condition.resolution && condition.resolution === params.resolution) {
|
|
20
|
-
|
|
20
|
+
price += rule.value;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
if (condition.withoutSub && userHasActiveSubscriptionOrProduct === false) {
|
|
24
|
-
|
|
24
|
+
price += rule.value;
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
return
|
|
28
|
+
return price;
|
|
29
29
|
}
|
package/helpers/index.ts
CHANGED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { MusicModelPricingRules } from '../../models';
|
|
2
|
+
|
|
3
|
+
export function calculateMusicPrice({
|
|
4
|
+
basePrice,
|
|
5
|
+
userHasActiveSubscriptionOrProduct,
|
|
6
|
+
rules,
|
|
7
|
+
}: {
|
|
8
|
+
basePrice: number;
|
|
9
|
+
userHasActiveSubscriptionOrProduct: boolean;
|
|
10
|
+
rules: MusicModelPricingRules;
|
|
11
|
+
}): number {
|
|
12
|
+
let price = basePrice;
|
|
13
|
+
|
|
14
|
+
for (const rule of rules ?? []) {
|
|
15
|
+
const condition = rule.condition;
|
|
16
|
+
|
|
17
|
+
if (condition.withoutSub && userHasActiveSubscriptionOrProduct === false) {
|
|
18
|
+
price += rule.value;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return price;
|
|
23
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './calculate-music-price.helper';
|