@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.
@@ -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
  }
@@ -24,3 +24,4 @@ __exportStar(require("./video-editor"), exports);
24
24
  __exportStar(require("./writer"), exports);
25
25
  __exportStar(require("./image-editor"), exports);
26
26
  __exportStar(require("./image-generation"), exports);
27
+ __exportStar(require("./music"), exports);
@@ -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 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
  }
package/helpers/index.ts CHANGED
@@ -8,3 +8,4 @@ export * from './video-editor';
8
8
  export * from './writer';
9
9
  export * from './image-editor';
10
10
  export * from './image-generation';
11
+ export * from './music';
@@ -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';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@purpleschool/gptbot",
3
- "version": "0.8.88",
3
+ "version": "0.8.90",
4
4
  "description": "",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",