@purpleschool/gptbot 0.8.89 → 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.
@@ -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 extra = 0;
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
- extra += rule.value;
9
+ price += rule.value;
10
10
  }
11
11
  }
12
- return basePrice + extra;
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 extra = 0;
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
- extra += rule.value;
9
+ price += rule.value;
10
10
  }
11
11
  if (condition.withoutSub && userHasActiveSubscriptionOrProduct === false) {
12
- extra += rule.value;
12
+ price += rule.value;
13
13
  }
14
14
  }
15
- return basePrice + extra;
15
+ return price;
16
16
  }
@@ -6,7 +6,7 @@ function calculateMusicPrice({ basePrice, userHasActiveSubscriptionOrProduct, ru
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
- price = rule.value;
9
+ price += rule.value;
10
10
  }
11
11
  }
12
12
  return price;
@@ -9,15 +9,15 @@ export function calculateImageEditorPrice({
9
9
  userHasActiveSubscriptionOrProduct: boolean;
10
10
  rules: ImageEditorModelPricingRules;
11
11
  }): number {
12
- let extra = 0;
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
- extra += rule.value;
18
+ price += rule.value;
19
19
  }
20
20
  }
21
21
 
22
- return basePrice + extra;
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 extra = 0;
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
- extra += rule.value;
20
+ price += rule.value;
21
21
  }
22
22
 
23
23
  if (condition.withoutSub && userHasActiveSubscriptionOrProduct === false) {
24
- extra += rule.value;
24
+ price += rule.value;
25
25
  }
26
26
  }
27
27
 
28
- return basePrice + extra;
28
+ return price;
29
29
  }
@@ -15,7 +15,7 @@ export function calculateMusicPrice({
15
15
  const condition = rule.condition;
16
16
 
17
17
  if (condition.withoutSub && userHasActiveSubscriptionOrProduct === false) {
18
- price = rule.value;
18
+ price += rule.value;
19
19
  }
20
20
  }
21
21
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@purpleschool/gptbot",
3
- "version": "0.8.89",
3
+ "version": "0.8.90",
4
4
  "description": "",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",