@purpleschool/multisite 0.0.5 → 0.0.7

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.
Files changed (73) hide show
  1. package/api/controller/http/image-editor.ts +0 -1
  2. package/api/controller/http/image-generation.ts +0 -1
  3. package/api/routes.ts +0 -2
  4. package/build/api/controller/http/image-editor.d.ts +0 -1
  5. package/build/api/controller/http/image-editor.d.ts.map +1 -1
  6. package/build/api/controller/http/image-editor.js +0 -1
  7. package/build/api/controller/http/image-generation.d.ts +0 -1
  8. package/build/api/controller/http/image-generation.d.ts.map +1 -1
  9. package/build/api/controller/http/image-generation.js +0 -1
  10. package/build/api/routes.d.ts +0 -2
  11. package/build/api/routes.d.ts.map +1 -1
  12. package/build/api/routes.js +0 -2
  13. package/build/commands/product/buy-product.command.d.ts +10 -10
  14. package/build/commands/subscription/buy-subscription.command.d.ts +10 -10
  15. package/build/helpers/image-editor/calculate-image-editor-price.helper.d.ts +7 -0
  16. package/build/helpers/image-editor/calculate-image-editor-price.helper.d.ts.map +1 -0
  17. package/build/helpers/image-editor/calculate-image-editor-price.helper.js +13 -0
  18. package/build/helpers/image-editor/index.d.ts +2 -0
  19. package/build/helpers/image-editor/index.d.ts.map +1 -0
  20. package/build/helpers/image-editor/index.js +17 -0
  21. package/build/helpers/image-generation/calculate-image-generation-price.helper.d.ts +8 -0
  22. package/build/helpers/image-generation/calculate-image-generation-price.helper.d.ts.map +1 -0
  23. package/build/helpers/image-generation/calculate-image-generation-price.helper.js +16 -0
  24. package/build/helpers/image-generation/index.d.ts +2 -0
  25. package/build/helpers/image-generation/index.d.ts.map +1 -0
  26. package/build/helpers/image-generation/index.js +17 -0
  27. package/build/helpers/index.d.ts +3 -0
  28. package/build/helpers/index.d.ts.map +1 -0
  29. package/build/helpers/index.js +18 -0
  30. package/build/index.d.ts +1 -0
  31. package/build/index.d.ts.map +1 -1
  32. package/build/index.js +1 -0
  33. package/build/models/cloud-payments-widget-data.schema.d.ts +8 -8
  34. package/build/models/cloud-payments-widget.schema.d.ts +8 -8
  35. package/build/models/product.schema.d.ts +18 -0
  36. package/build/models/product.schema.d.ts.map +1 -1
  37. package/build/models/product.schema.js +4 -0
  38. package/build/models/subscription.schema.d.ts +24 -0
  39. package/build/models/subscription.schema.d.ts.map +1 -1
  40. package/build/models/subscription.schema.js +6 -0
  41. package/build/queries/image-editor/index.d.ts +0 -1
  42. package/build/queries/image-editor/index.d.ts.map +1 -1
  43. package/build/queries/image-editor/index.js +0 -1
  44. package/build/queries/image-generation/index.d.ts +0 -1
  45. package/build/queries/image-generation/index.d.ts.map +1 -1
  46. package/build/queries/image-generation/index.js +0 -1
  47. package/build/queries/product/find-products.command.d.ts +26 -0
  48. package/build/queries/product/find-products.command.d.ts.map +1 -1
  49. package/build/queries/subscription/find-subscriptions.command.d.ts +36 -0
  50. package/build/queries/subscription/find-subscriptions.command.d.ts.map +1 -1
  51. package/build/queries/user/get-my-products.command.d.ts +34 -0
  52. package/build/queries/user/get-my-products.command.d.ts.map +1 -1
  53. package/build/queries/user/get-my-subscriptions.command.d.ts +48 -0
  54. package/build/queries/user/get-my-subscriptions.command.d.ts.map +1 -1
  55. package/helpers/image-editor/calculate-image-editor-price.helper.ts +23 -0
  56. package/helpers/image-editor/index.ts +1 -0
  57. package/helpers/image-generation/calculate-image-generation-price.helper.ts +29 -0
  58. package/helpers/image-generation/index.ts +1 -0
  59. package/helpers/index.ts +2 -0
  60. package/index.ts +1 -0
  61. package/models/product.schema.ts +6 -0
  62. package/models/subscription.schema.ts +8 -0
  63. package/package.json +1 -1
  64. package/queries/image-editor/index.ts +0 -1
  65. package/queries/image-generation/index.ts +0 -1
  66. package/build/queries/image-editor/get-image-editor-price.command.d.ts +0 -53
  67. package/build/queries/image-editor/get-image-editor-price.command.d.ts.map +0 -1
  68. package/build/queries/image-editor/get-image-editor-price.command.js +0 -17
  69. package/build/queries/image-generation/get-image-generation-price.command.d.ts +0 -44
  70. package/build/queries/image-generation/get-image-generation-price.command.d.ts.map +0 -1
  71. package/build/queries/image-generation/get-image-generation-price.command.js +0 -19
  72. package/queries/image-editor/get-image-editor-price.command.ts +0 -17
  73. package/queries/image-generation/get-image-generation-price.command.ts +0 -19
@@ -134,9 +134,9 @@ export declare const CloudPaymentsWidgetSchema: z.ZodObject<{
134
134
  }>;
135
135
  amount: z.ZodNumber;
136
136
  }, "strip", z.ZodTypeAny, {
137
+ interval: "Month";
137
138
  period: number;
138
139
  amount: number;
139
- interval: "Month";
140
140
  customerReceipt: {
141
141
  email: string;
142
142
  items: {
@@ -153,9 +153,9 @@ export declare const CloudPaymentsWidgetSchema: z.ZodObject<{
153
153
  };
154
154
  };
155
155
  }, {
156
+ interval: "Month";
156
157
  period: number;
157
158
  amount: number;
158
- interval: "Month";
159
159
  customerReceipt: {
160
160
  email: string;
161
161
  items: {
@@ -189,9 +189,9 @@ export declare const CloudPaymentsWidgetSchema: z.ZodObject<{
189
189
  };
190
190
  };
191
191
  recurrent?: {
192
+ interval: "Month";
192
193
  period: number;
193
194
  amount: number;
194
- interval: "Month";
195
195
  customerReceipt: {
196
196
  email: string;
197
197
  items: {
@@ -225,9 +225,9 @@ export declare const CloudPaymentsWidgetSchema: z.ZodObject<{
225
225
  };
226
226
  };
227
227
  recurrent?: {
228
+ interval: "Month";
228
229
  period: number;
229
230
  amount: number;
230
- interval: "Month";
231
231
  customerReceipt: {
232
232
  email: string;
233
233
  items: {
@@ -263,9 +263,9 @@ export declare const CloudPaymentsWidgetSchema: z.ZodObject<{
263
263
  };
264
264
  };
265
265
  recurrent?: {
266
+ interval: "Month";
266
267
  period: number;
267
268
  amount: number;
268
- interval: "Month";
269
269
  customerReceipt: {
270
270
  email: string;
271
271
  items: {
@@ -301,9 +301,9 @@ export declare const CloudPaymentsWidgetSchema: z.ZodObject<{
301
301
  };
302
302
  };
303
303
  recurrent?: {
304
+ interval: "Month";
304
305
  period: number;
305
306
  amount: number;
306
- interval: "Month";
307
307
  customerReceipt: {
308
308
  email: string;
309
309
  items: {
@@ -350,9 +350,9 @@ export declare const CloudPaymentsWidgetSchema: z.ZodObject<{
350
350
  };
351
351
  };
352
352
  recurrent?: {
353
+ interval: "Month";
353
354
  period: number;
354
355
  amount: number;
355
- interval: "Month";
356
356
  customerReceipt: {
357
357
  email: string;
358
358
  items: {
@@ -399,9 +399,9 @@ export declare const CloudPaymentsWidgetSchema: z.ZodObject<{
399
399
  };
400
400
  };
401
401
  recurrent?: {
402
+ interval: "Month";
402
403
  period: number;
403
404
  amount: number;
404
- interval: "Month";
405
405
  customerReceipt: {
406
406
  email: string;
407
407
  items: {
@@ -6,6 +6,16 @@ export declare const ProductSchema: z.ZodObject<{
6
6
  description: z.ZodString;
7
7
  tokens: z.ZodNumber;
8
8
  price: z.ZodNumber;
9
+ features: z.ZodArray<z.ZodObject<{
10
+ type: z.ZodString;
11
+ name: z.ZodString;
12
+ }, "strip", z.ZodTypeAny, {
13
+ type: string;
14
+ name: string;
15
+ }, {
16
+ type: string;
17
+ name: string;
18
+ }>, "many">;
9
19
  }, "strip", z.ZodTypeAny, {
10
20
  price: number;
11
21
  uuid: string;
@@ -13,6 +23,10 @@ export declare const ProductSchema: z.ZodObject<{
13
23
  name: string;
14
24
  description: string;
15
25
  tokens: number;
26
+ features: {
27
+ type: string;
28
+ name: string;
29
+ }[];
16
30
  }, {
17
31
  price: number;
18
32
  uuid: string;
@@ -20,5 +34,9 @@ export declare const ProductSchema: z.ZodObject<{
20
34
  name: string;
21
35
  description: string;
22
36
  tokens: number;
37
+ features: {
38
+ type: string;
39
+ name: string;
40
+ }[];
23
41
  }>;
24
42
  //# sourceMappingURL=product.schema.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"product.schema.d.ts","sourceRoot":"","sources":["../../models/product.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;EAOxB,CAAC"}
1
+ {"version":3,"file":"product.schema.d.ts","sourceRoot":"","sources":["../../models/product.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAaxB,CAAC"}
@@ -9,4 +9,8 @@ exports.ProductSchema = zod_1.z.object({
9
9
  description: zod_1.z.string().min(1).max(2000),
10
10
  tokens: zod_1.z.number().int().min(0),
11
11
  price: zod_1.z.number().int().min(0),
12
+ features: zod_1.z.array(zod_1.z.object({
13
+ type: zod_1.z.string(),
14
+ name: zod_1.z.string(),
15
+ })),
12
16
  });
@@ -5,8 +5,20 @@ export declare const SubscriptionSchema: z.ZodObject<{
5
5
  name: z.ZodString;
6
6
  description: z.ZodString;
7
7
  price: z.ZodNumber;
8
+ interval: z.ZodString;
8
9
  period: z.ZodNumber;
9
10
  tokens: z.ZodNumber;
11
+ discount: z.ZodNumber;
12
+ features: z.ZodArray<z.ZodObject<{
13
+ type: z.ZodString;
14
+ name: z.ZodString;
15
+ }, "strip", z.ZodTypeAny, {
16
+ type: string;
17
+ name: string;
18
+ }, {
19
+ type: string;
20
+ name: string;
21
+ }>, "many">;
10
22
  carryoverPercent: z.ZodNumber;
11
23
  }, "strip", z.ZodTypeAny, {
12
24
  price: number;
@@ -15,7 +27,13 @@ export declare const SubscriptionSchema: z.ZodObject<{
15
27
  name: string;
16
28
  description: string;
17
29
  tokens: number;
30
+ features: {
31
+ type: string;
32
+ name: string;
33
+ }[];
34
+ interval: string;
18
35
  period: number;
36
+ discount: number;
19
37
  carryoverPercent: number;
20
38
  }, {
21
39
  price: number;
@@ -24,7 +42,13 @@ export declare const SubscriptionSchema: z.ZodObject<{
24
42
  name: string;
25
43
  description: string;
26
44
  tokens: number;
45
+ features: {
46
+ type: string;
47
+ name: string;
48
+ }[];
49
+ interval: string;
27
50
  period: number;
51
+ discount: number;
28
52
  carryoverPercent: number;
29
53
  }>;
30
54
  //# sourceMappingURL=subscription.schema.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"subscription.schema.d.ts","sourceRoot":"","sources":["../../models/subscription.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;EAS7B,CAAC"}
1
+ {"version":3,"file":"subscription.schema.d.ts","sourceRoot":"","sources":["../../models/subscription.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiB7B,CAAC"}
@@ -8,7 +8,13 @@ exports.SubscriptionSchema = zod_1.z.object({
8
8
  name: zod_1.z.string().min(1).max(200),
9
9
  description: zod_1.z.string().min(1).max(2000),
10
10
  price: zod_1.z.number().int().min(0),
11
+ interval: zod_1.z.string().max(20),
11
12
  period: zod_1.z.number().int().min(1).max(36),
12
13
  tokens: zod_1.z.number().int().min(0),
14
+ discount: zod_1.z.number().int().min(0),
15
+ features: zod_1.z.array(zod_1.z.object({
16
+ type: zod_1.z.string(),
17
+ name: zod_1.z.string(),
18
+ })),
13
19
  carryoverPercent: zod_1.z.number().int().min(0).max(100),
14
20
  });
@@ -1,5 +1,4 @@
1
1
  export * from './get-image-editor-config.command';
2
2
  export * from './get-image-editor-job.command';
3
3
  export * from './find-image-editor-jobs.command';
4
- export * from './get-image-editor-price.command';
5
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../queries/image-editor/index.ts"],"names":[],"mappings":"AAAA,cAAc,mCAAmC,CAAC;AAClD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,kCAAkC,CAAC;AACjD,cAAc,kCAAkC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../queries/image-editor/index.ts"],"names":[],"mappings":"AAAA,cAAc,mCAAmC,CAAC;AAClD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,kCAAkC,CAAC"}
@@ -17,4 +17,3 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./get-image-editor-config.command"), exports);
18
18
  __exportStar(require("./get-image-editor-job.command"), exports);
19
19
  __exportStar(require("./find-image-editor-jobs.command"), exports);
20
- __exportStar(require("./get-image-editor-price.command"), exports);
@@ -1,5 +1,4 @@
1
1
  export * from './get-image-generation-config.command';
2
2
  export * from './get-image-generation-job.command';
3
3
  export * from './find-image-generation-jobs.command';
4
- export * from './get-image-generation-price.command';
5
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../queries/image-generation/index.ts"],"names":[],"mappings":"AAAA,cAAc,uCAAuC,CAAC;AACtD,cAAc,oCAAoC,CAAC;AACnD,cAAc,sCAAsC,CAAC;AACrD,cAAc,sCAAsC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../queries/image-generation/index.ts"],"names":[],"mappings":"AAAA,cAAc,uCAAuC,CAAC;AACtD,cAAc,oCAAoC,CAAC;AACnD,cAAc,sCAAsC,CAAC"}
@@ -17,4 +17,3 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./get-image-generation-config.command"), exports);
18
18
  __exportStar(require("./get-image-generation-job.command"), exports);
19
19
  __exportStar(require("./find-image-generation-jobs.command"), exports);
20
- __exportStar(require("./get-image-generation-price.command"), exports);
@@ -8,6 +8,16 @@ export declare namespace FindProductsCommand {
8
8
  description: z.ZodString;
9
9
  tokens: z.ZodNumber;
10
10
  price: z.ZodNumber;
11
+ features: z.ZodArray<z.ZodObject<{
12
+ type: z.ZodString;
13
+ name: z.ZodString;
14
+ }, "strip", z.ZodTypeAny, {
15
+ type: string;
16
+ name: string;
17
+ }, {
18
+ type: string;
19
+ name: string;
20
+ }>, "many">;
11
21
  }, "strip", z.ZodTypeAny, {
12
22
  price: number;
13
23
  uuid: string;
@@ -15,6 +25,10 @@ export declare namespace FindProductsCommand {
15
25
  name: string;
16
26
  description: string;
17
27
  tokens: number;
28
+ features: {
29
+ type: string;
30
+ name: string;
31
+ }[];
18
32
  }, {
19
33
  price: number;
20
34
  uuid: string;
@@ -22,6 +36,10 @@ export declare namespace FindProductsCommand {
22
36
  name: string;
23
37
  description: string;
24
38
  tokens: number;
39
+ features: {
40
+ type: string;
41
+ name: string;
42
+ }[];
25
43
  }>, "many">;
26
44
  }, "strip", z.ZodTypeAny, {
27
45
  data: {
@@ -31,6 +49,10 @@ export declare namespace FindProductsCommand {
31
49
  name: string;
32
50
  description: string;
33
51
  tokens: number;
52
+ features: {
53
+ type: string;
54
+ name: string;
55
+ }[];
34
56
  }[];
35
57
  }, {
36
58
  data: {
@@ -40,6 +62,10 @@ export declare namespace FindProductsCommand {
40
62
  name: string;
41
63
  description: string;
42
64
  tokens: number;
65
+ features: {
66
+ type: string;
67
+ name: string;
68
+ }[];
43
69
  }[];
44
70
  }>;
45
71
  type Response = z.infer<typeof ResponseSchema>;
@@ -1 +1 @@
1
- {"version":3,"file":"find-products.command.d.ts","sourceRoot":"","sources":["../../../queries/product/find-products.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,yBAAiB,mBAAmB,CAAC;IAC1B,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAEzB,CAAC;IACH,KAAY,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;CACzD"}
1
+ {"version":3,"file":"find-products.command.d.ts","sourceRoot":"","sources":["../../../queries/product/find-products.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,yBAAiB,mBAAmB,CAAC;IAC1B,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAEzB,CAAC;IACH,KAAY,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;CACzD"}
@@ -7,8 +7,20 @@ export declare namespace FindSubscriptionsCommand {
7
7
  name: z.ZodString;
8
8
  description: z.ZodString;
9
9
  price: z.ZodNumber;
10
+ interval: z.ZodString;
10
11
  period: z.ZodNumber;
11
12
  tokens: z.ZodNumber;
13
+ discount: z.ZodNumber;
14
+ features: z.ZodArray<z.ZodObject<{
15
+ type: z.ZodString;
16
+ name: z.ZodString;
17
+ }, "strip", z.ZodTypeAny, {
18
+ type: string;
19
+ name: string;
20
+ }, {
21
+ type: string;
22
+ name: string;
23
+ }>, "many">;
12
24
  carryoverPercent: z.ZodNumber;
13
25
  }, "strip", z.ZodTypeAny, {
14
26
  price: number;
@@ -17,7 +29,13 @@ export declare namespace FindSubscriptionsCommand {
17
29
  name: string;
18
30
  description: string;
19
31
  tokens: number;
32
+ features: {
33
+ type: string;
34
+ name: string;
35
+ }[];
36
+ interval: string;
20
37
  period: number;
38
+ discount: number;
21
39
  carryoverPercent: number;
22
40
  }, {
23
41
  price: number;
@@ -26,7 +44,13 @@ export declare namespace FindSubscriptionsCommand {
26
44
  name: string;
27
45
  description: string;
28
46
  tokens: number;
47
+ features: {
48
+ type: string;
49
+ name: string;
50
+ }[];
51
+ interval: string;
29
52
  period: number;
53
+ discount: number;
30
54
  carryoverPercent: number;
31
55
  }>, "many">;
32
56
  }, "strip", z.ZodTypeAny, {
@@ -37,7 +61,13 @@ export declare namespace FindSubscriptionsCommand {
37
61
  name: string;
38
62
  description: string;
39
63
  tokens: number;
64
+ features: {
65
+ type: string;
66
+ name: string;
67
+ }[];
68
+ interval: string;
40
69
  period: number;
70
+ discount: number;
41
71
  carryoverPercent: number;
42
72
  }[];
43
73
  }, {
@@ -48,7 +78,13 @@ export declare namespace FindSubscriptionsCommand {
48
78
  name: string;
49
79
  description: string;
50
80
  tokens: number;
81
+ features: {
82
+ type: string;
83
+ name: string;
84
+ }[];
85
+ interval: string;
51
86
  period: number;
87
+ discount: number;
52
88
  carryoverPercent: number;
53
89
  }[];
54
90
  }>;
@@ -1 +1 @@
1
- {"version":3,"file":"find-subscriptions.command.d.ts","sourceRoot":"","sources":["../../../queries/subscription/find-subscriptions.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,yBAAiB,wBAAwB,CAAC;IAC/B,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAEzB,CAAC;IACH,KAAY,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;CACzD"}
1
+ {"version":3,"file":"find-subscriptions.command.d.ts","sourceRoot":"","sources":["../../../queries/subscription/find-subscriptions.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,yBAAiB,wBAAwB,CAAC;IAC/B,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAEzB,CAAC;IACH,KAAY,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;CACzD"}
@@ -15,6 +15,16 @@ export declare namespace GetMyProductsCommand {
15
15
  description: z.ZodString;
16
16
  tokens: z.ZodNumber;
17
17
  price: z.ZodNumber;
18
+ features: z.ZodArray<z.ZodObject<{
19
+ type: z.ZodString;
20
+ name: z.ZodString;
21
+ }, "strip", z.ZodTypeAny, {
22
+ type: string;
23
+ name: string;
24
+ }, {
25
+ type: string;
26
+ name: string;
27
+ }>, "many">;
18
28
  }, "strip", z.ZodTypeAny, {
19
29
  price: number;
20
30
  uuid: string;
@@ -22,6 +32,10 @@ export declare namespace GetMyProductsCommand {
22
32
  name: string;
23
33
  description: string;
24
34
  tokens: number;
35
+ features: {
36
+ type: string;
37
+ name: string;
38
+ }[];
25
39
  }, {
26
40
  price: number;
27
41
  uuid: string;
@@ -29,6 +43,10 @@ export declare namespace GetMyProductsCommand {
29
43
  name: string;
30
44
  description: string;
31
45
  tokens: number;
46
+ features: {
47
+ type: string;
48
+ name: string;
49
+ }[];
32
50
  }>;
33
51
  }, "strip", z.ZodTypeAny, {
34
52
  uuid: string;
@@ -43,6 +61,10 @@ export declare namespace GetMyProductsCommand {
43
61
  name: string;
44
62
  description: string;
45
63
  tokens: number;
64
+ features: {
65
+ type: string;
66
+ name: string;
67
+ }[];
46
68
  };
47
69
  }, {
48
70
  uuid: string;
@@ -57,6 +79,10 @@ export declare namespace GetMyProductsCommand {
57
79
  name: string;
58
80
  description: string;
59
81
  tokens: number;
82
+ features: {
83
+ type: string;
84
+ name: string;
85
+ }[];
60
86
  };
61
87
  }>, "many">;
62
88
  }, "strip", z.ZodTypeAny, {
@@ -73,6 +99,10 @@ export declare namespace GetMyProductsCommand {
73
99
  name: string;
74
100
  description: string;
75
101
  tokens: number;
102
+ features: {
103
+ type: string;
104
+ name: string;
105
+ }[];
76
106
  };
77
107
  }[];
78
108
  }, {
@@ -89,6 +119,10 @@ export declare namespace GetMyProductsCommand {
89
119
  name: string;
90
120
  description: string;
91
121
  tokens: number;
122
+ features: {
123
+ type: string;
124
+ name: string;
125
+ }[];
92
126
  };
93
127
  }[];
94
128
  }>;
@@ -1 +1 @@
1
- {"version":3,"file":"get-my-products.command.d.ts","sourceRoot":"","sources":["../../../queries/user/get-my-products.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAEzD,yBAAiB,oBAAoB,CAAC;IAC3B,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAWzB,CAAC;IACH,KAAY,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;CACzD"}
1
+ {"version":3,"file":"get-my-products.command.d.ts","sourceRoot":"","sources":["../../../queries/user/get-my-products.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAEzD,yBAAiB,oBAAoB,CAAC;IAC3B,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAWzB,CAAC;IACH,KAAY,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;CACzD"}
@@ -16,8 +16,20 @@ export declare namespace GetMySubscriptionsCommand {
16
16
  name: z.ZodString;
17
17
  description: z.ZodString;
18
18
  price: z.ZodNumber;
19
+ interval: z.ZodString;
19
20
  period: z.ZodNumber;
20
21
  tokens: z.ZodNumber;
22
+ discount: z.ZodNumber;
23
+ features: z.ZodArray<z.ZodObject<{
24
+ type: z.ZodString;
25
+ name: z.ZodString;
26
+ }, "strip", z.ZodTypeAny, {
27
+ type: string;
28
+ name: string;
29
+ }, {
30
+ type: string;
31
+ name: string;
32
+ }>, "many">;
21
33
  carryoverPercent: z.ZodNumber;
22
34
  }, "strip", z.ZodTypeAny, {
23
35
  price: number;
@@ -26,7 +38,13 @@ export declare namespace GetMySubscriptionsCommand {
26
38
  name: string;
27
39
  description: string;
28
40
  tokens: number;
41
+ features: {
42
+ type: string;
43
+ name: string;
44
+ }[];
45
+ interval: string;
29
46
  period: number;
47
+ discount: number;
30
48
  carryoverPercent: number;
31
49
  }, {
32
50
  price: number;
@@ -35,7 +53,13 @@ export declare namespace GetMySubscriptionsCommand {
35
53
  name: string;
36
54
  description: string;
37
55
  tokens: number;
56
+ features: {
57
+ type: string;
58
+ name: string;
59
+ }[];
60
+ interval: string;
38
61
  period: number;
62
+ discount: number;
39
63
  carryoverPercent: number;
40
64
  }>;
41
65
  }, "strip", z.ZodTypeAny, {
@@ -53,7 +77,13 @@ export declare namespace GetMySubscriptionsCommand {
53
77
  name: string;
54
78
  description: string;
55
79
  tokens: number;
80
+ features: {
81
+ type: string;
82
+ name: string;
83
+ }[];
84
+ interval: string;
56
85
  period: number;
86
+ discount: number;
57
87
  carryoverPercent: number;
58
88
  };
59
89
  }, {
@@ -71,7 +101,13 @@ export declare namespace GetMySubscriptionsCommand {
71
101
  name: string;
72
102
  description: string;
73
103
  tokens: number;
104
+ features: {
105
+ type: string;
106
+ name: string;
107
+ }[];
108
+ interval: string;
74
109
  period: number;
110
+ discount: number;
75
111
  carryoverPercent: number;
76
112
  };
77
113
  }>, "many">;
@@ -91,7 +127,13 @@ export declare namespace GetMySubscriptionsCommand {
91
127
  name: string;
92
128
  description: string;
93
129
  tokens: number;
130
+ features: {
131
+ type: string;
132
+ name: string;
133
+ }[];
134
+ interval: string;
94
135
  period: number;
136
+ discount: number;
95
137
  carryoverPercent: number;
96
138
  };
97
139
  }[];
@@ -111,7 +153,13 @@ export declare namespace GetMySubscriptionsCommand {
111
153
  name: string;
112
154
  description: string;
113
155
  tokens: number;
156
+ features: {
157
+ type: string;
158
+ name: string;
159
+ }[];
160
+ interval: string;
114
161
  period: number;
162
+ discount: number;
115
163
  carryoverPercent: number;
116
164
  };
117
165
  }[];
@@ -1 +1 @@
1
- {"version":3,"file":"get-my-subscriptions.command.d.ts","sourceRoot":"","sources":["../../../queries/user/get-my-subscriptions.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,2BAA2B,EAAE,MAAM,iBAAiB,CAAC;AAE9D,yBAAiB,yBAAyB,CAAC;IAChC,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAazB,CAAC;IACH,KAAY,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;CACzD"}
1
+ {"version":3,"file":"get-my-subscriptions.command.d.ts","sourceRoot":"","sources":["../../../queries/user/get-my-subscriptions.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,2BAA2B,EAAE,MAAM,iBAAiB,CAAC;AAE9D,yBAAiB,yBAAyB,CAAC;IAChC,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAazB,CAAC;IACH,KAAY,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;CACzD"}
@@ -0,0 +1,23 @@
1
+ import { ImageEditorPricingRules } from '../../models';
2
+
3
+ export function calculateImageEditorPrice({
4
+ basePrice,
5
+ userHasActiveSubscriptionOrProduct,
6
+ rules,
7
+ }: {
8
+ basePrice: number;
9
+ userHasActiveSubscriptionOrProduct: boolean;
10
+ rules: ImageEditorPricingRules;
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-image-editor-price.helper';
@@ -0,0 +1,29 @@
1
+ import { ImageGenerationJobParams, ImageGenerationPricingRules } from '../../models';
2
+
3
+ export function calculateImageGenerationPrice({
4
+ basePrice,
5
+ params,
6
+ userHasActiveSubscriptionOrProduct,
7
+ rules,
8
+ }: {
9
+ basePrice: number;
10
+ params: Pick<ImageGenerationJobParams, 'resolution'>;
11
+ userHasActiveSubscriptionOrProduct: boolean;
12
+ rules: ImageGenerationPricingRules;
13
+ }): number {
14
+ let price = basePrice;
15
+
16
+ for (const rule of rules ?? []) {
17
+ const condition = rule.condition;
18
+
19
+ if (condition.resolution && condition.resolution === params.resolution) {
20
+ price += rule.value;
21
+ }
22
+
23
+ if (condition.withoutSub && userHasActiveSubscriptionOrProduct === false) {
24
+ price += rule.value;
25
+ }
26
+ }
27
+
28
+ return price;
29
+ }
@@ -0,0 +1 @@
1
+ export * from './calculate-image-generation-price.helper';
@@ -0,0 +1,2 @@
1
+ export * from './image-generation';
2
+ export * from './image-editor';
package/index.ts CHANGED
@@ -3,3 +3,4 @@ export * from './commands';
3
3
  export * from './queries';
4
4
  export * from './models';
5
5
  export * from './constants';
6
+ export * from './helpers';
@@ -7,4 +7,10 @@ export const ProductSchema = z.object({
7
7
  description: z.string().min(1).max(2000),
8
8
  tokens: z.number().int().min(0),
9
9
  price: z.number().int().min(0),
10
+ features: z.array(
11
+ z.object({
12
+ type: z.string(),
13
+ name: z.string(),
14
+ }),
15
+ ),
10
16
  });