@purpleschool/gptbot 0.12.27 → 0.12.29
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/commands/ui-notification/find-active-ui-notifications-by-page-and-user.command.js +1 -1
- package/build/commands/ui-notification/find-ui-notifications.command.js +1 -1
- package/build/constants/team-account/enums/team-subscription-feature-key.enum.js +1 -0
- package/build/models/subscription.schema.js +0 -1
- package/build/models/ui-notification.schema.js +48 -4
- package/commands/ui-notification/find-active-ui-notifications-by-page-and-user.command.ts +2 -2
- package/commands/ui-notification/find-ui-notifications.command.ts +2 -2
- package/constants/team-account/enums/team-subscription-feature-key.enum.ts +1 -0
- package/models/subscription.schema.ts +0 -1
- package/models/ui-notification.schema.ts +61 -3
- package/package.json +1 -1
package/build/commands/ui-notification/find-active-ui-notifications-by-page-and-user.command.js
CHANGED
|
@@ -9,6 +9,6 @@ var FindActiveUiNotificationsByPageAndUserCommand;
|
|
|
9
9
|
page: zod_1.z.string(),
|
|
10
10
|
});
|
|
11
11
|
FindActiveUiNotificationsByPageAndUserCommand.ResponseSchema = zod_1.z.object({
|
|
12
|
-
data: zod_1.z.array(models_1.
|
|
12
|
+
data: zod_1.z.array(models_1.UiNotificationSchema),
|
|
13
13
|
});
|
|
14
14
|
})(FindActiveUiNotificationsByPageAndUserCommand || (exports.FindActiveUiNotificationsByPageAndUserCommand = FindActiveUiNotificationsByPageAndUserCommand = {}));
|
|
@@ -10,6 +10,6 @@ var FindUiNotificationsCommand;
|
|
|
10
10
|
offset: zod_1.z.coerce.number().int().min(0).optional(),
|
|
11
11
|
});
|
|
12
12
|
FindUiNotificationsCommand.ResponseSchema = zod_1.z.object({
|
|
13
|
-
data: zod_1.z.array(models_1.
|
|
13
|
+
data: zod_1.z.array(models_1.UiNotificationSchema),
|
|
14
14
|
});
|
|
15
15
|
})(FindUiNotificationsCommand || (exports.FindUiNotificationsCommand = FindUiNotificationsCommand = {}));
|
|
@@ -6,5 +6,6 @@ var TEAM_SUBSCRIPTION_FEATURE_KEY;
|
|
|
6
6
|
TEAM_SUBSCRIPTION_FEATURE_KEY["TOKENS"] = "tokens";
|
|
7
7
|
TEAM_SUBSCRIPTION_FEATURE_KEY["MAX_TEAM_MEMBERS"] = "max_team_members";
|
|
8
8
|
TEAM_SUBSCRIPTION_FEATURE_KEY["CARRYOVER_PERCENT"] = "carryover_percent";
|
|
9
|
+
TEAM_SUBSCRIPTION_FEATURE_KEY["PRODUCT_DISCOUNT_PERCENT"] = "product_discount_percent";
|
|
9
10
|
TEAM_SUBSCRIPTION_FEATURE_KEY["ALL_MODELS_ACCESS"] = "all_models_access";
|
|
10
11
|
})(TEAM_SUBSCRIPTION_FEATURE_KEY || (exports.TEAM_SUBSCRIPTION_FEATURE_KEY = TEAM_SUBSCRIPTION_FEATURE_KEY = {}));
|
|
@@ -11,7 +11,6 @@ exports.SubscriptionSchema = zod_1.z.object({
|
|
|
11
11
|
name: zod_1.z.string().min(3).max(16384),
|
|
12
12
|
requests: zod_1.z.number(),
|
|
13
13
|
price: zod_1.z.number(),
|
|
14
|
-
productDiscountPercent: zod_1.z.number().optional(),
|
|
15
14
|
billingScope: zod_1.z.nativeEnum(constants_1.BILLING_SCOPE),
|
|
16
15
|
plan: zod_1.z.nativeEnum(constants_1.SUBSCRIPTION_PLAN),
|
|
17
16
|
type: zod_1.z.nativeEnum(constants_1.SUBSCRIPTION_TYPE),
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.UiNotificationSchema = exports.GenericUiContentSchema = exports.PromocodeOfferUiContentSchema = exports.FraudDetectedUiContentSchema = exports.SubscriptionPastDueUiContentSchema = exports.ConnectTelegramBonusUiContentSchema = exports.UiNotificationBaseSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const constants_1 = require("../constants");
|
|
6
|
-
exports.
|
|
6
|
+
exports.UiNotificationBaseSchema = zod_1.z.object({
|
|
7
7
|
uuid: zod_1.z.string().uuid(),
|
|
8
|
-
type: zod_1.z.nativeEnum(constants_1.UI_NOTIFICATION_TYPE),
|
|
9
|
-
dynamicUiContent: zod_1.z.record(zod_1.z.unknown()),
|
|
10
8
|
userId: zod_1.z.string().nullable(),
|
|
11
9
|
priority: zod_1.z.number().int(),
|
|
12
10
|
isRead: zod_1.z.boolean(),
|
|
@@ -16,3 +14,49 @@ exports.uiNotificationSchema = zod_1.z.object({
|
|
|
16
14
|
endDate: zod_1.z.date().nullable(),
|
|
17
15
|
serverTime: zod_1.z.date().optional(),
|
|
18
16
|
});
|
|
17
|
+
exports.ConnectTelegramBonusUiContentSchema = zod_1.z.object({
|
|
18
|
+
promocode: zod_1.z.string(),
|
|
19
|
+
bonusPercent: zod_1.z.number(),
|
|
20
|
+
endDate: zod_1.z.string().datetime(),
|
|
21
|
+
});
|
|
22
|
+
exports.SubscriptionPastDueUiContentSchema = zod_1.z.object({
|
|
23
|
+
userToSubscriptionId: zod_1.z.string(),
|
|
24
|
+
endDate: zod_1.z.string().datetime(),
|
|
25
|
+
});
|
|
26
|
+
exports.FraudDetectedUiContentSchema = zod_1.z.object({
|
|
27
|
+
message: zod_1.z.string(),
|
|
28
|
+
endDate: zod_1.z.string().datetime(),
|
|
29
|
+
});
|
|
30
|
+
exports.PromocodeOfferUiContentSchema = zod_1.z.object({
|
|
31
|
+
title: zod_1.z.string(),
|
|
32
|
+
message: zod_1.z.string(),
|
|
33
|
+
promocode: zod_1.z.string(),
|
|
34
|
+
bonusPercent: zod_1.z.number(),
|
|
35
|
+
validTill: zod_1.z.string().datetime().nullable(),
|
|
36
|
+
});
|
|
37
|
+
exports.GenericUiContentSchema = zod_1.z.object({
|
|
38
|
+
title: zod_1.z.string(),
|
|
39
|
+
message: zod_1.z.string(),
|
|
40
|
+
});
|
|
41
|
+
exports.UiNotificationSchema = zod_1.z.discriminatedUnion('type', [
|
|
42
|
+
exports.UiNotificationBaseSchema.extend({
|
|
43
|
+
type: zod_1.z.literal(constants_1.UI_NOTIFICATION_TYPE.CONNECT_TELEGRAM_BONUS),
|
|
44
|
+
dynamicUiContent: exports.ConnectTelegramBonusUiContentSchema,
|
|
45
|
+
}),
|
|
46
|
+
exports.UiNotificationBaseSchema.extend({
|
|
47
|
+
type: zod_1.z.literal(constants_1.UI_NOTIFICATION_TYPE.SUBSCRIPTION_PAST_DUE),
|
|
48
|
+
dynamicUiContent: exports.SubscriptionPastDueUiContentSchema,
|
|
49
|
+
}),
|
|
50
|
+
exports.UiNotificationBaseSchema.extend({
|
|
51
|
+
type: zod_1.z.literal(constants_1.UI_NOTIFICATION_TYPE.FRAUD_DETECTED),
|
|
52
|
+
dynamicUiContent: exports.FraudDetectedUiContentSchema,
|
|
53
|
+
}),
|
|
54
|
+
exports.UiNotificationBaseSchema.extend({
|
|
55
|
+
type: zod_1.z.literal(constants_1.UI_NOTIFICATION_TYPE.PROMOCODE_OFFER),
|
|
56
|
+
dynamicUiContent: exports.PromocodeOfferUiContentSchema,
|
|
57
|
+
}),
|
|
58
|
+
exports.UiNotificationBaseSchema.extend({
|
|
59
|
+
type: zod_1.z.literal(constants_1.UI_NOTIFICATION_TYPE.GENERIC),
|
|
60
|
+
dynamicUiContent: exports.GenericUiContentSchema,
|
|
61
|
+
}),
|
|
62
|
+
]);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import {
|
|
2
|
+
import { UiNotificationSchema } from '../../models';
|
|
3
3
|
|
|
4
4
|
export namespace FindActiveUiNotificationsByPageAndUserCommand {
|
|
5
5
|
export const RequestQuerySchema = z.object({
|
|
@@ -9,7 +9,7 @@ export namespace FindActiveUiNotificationsByPageAndUserCommand {
|
|
|
9
9
|
export type Request = z.infer<typeof RequestQuerySchema>;
|
|
10
10
|
|
|
11
11
|
export const ResponseSchema = z.object({
|
|
12
|
-
data: z.array(
|
|
12
|
+
data: z.array(UiNotificationSchema),
|
|
13
13
|
});
|
|
14
14
|
export type Response = z.infer<typeof ResponseSchema>;
|
|
15
15
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import {
|
|
2
|
+
import { UiNotificationSchema } from '../../models';
|
|
3
3
|
|
|
4
4
|
export namespace FindUiNotificationsCommand {
|
|
5
5
|
export const RequestQuerySchema = z.object({
|
|
@@ -10,7 +10,7 @@ export namespace FindUiNotificationsCommand {
|
|
|
10
10
|
export type RequestQuery = z.infer<typeof RequestQuerySchema>;
|
|
11
11
|
|
|
12
12
|
export const ResponseSchema = z.object({
|
|
13
|
-
data: z.array(
|
|
13
|
+
data: z.array(UiNotificationSchema),
|
|
14
14
|
});
|
|
15
15
|
|
|
16
16
|
export type Response = z.infer<typeof ResponseSchema>;
|
|
@@ -14,7 +14,6 @@ export const SubscriptionSchema = z.object({
|
|
|
14
14
|
name: z.string().min(3).max(16384),
|
|
15
15
|
requests: z.number(),
|
|
16
16
|
price: z.number(),
|
|
17
|
-
productDiscountPercent: z.number().optional(),
|
|
18
17
|
billingScope: z.nativeEnum(BILLING_SCOPE),
|
|
19
18
|
plan: z.nativeEnum(SUBSCRIPTION_PLAN),
|
|
20
19
|
type: z.nativeEnum(SUBSCRIPTION_TYPE),
|
|
@@ -4,10 +4,9 @@ import {
|
|
|
4
4
|
UI_NOTIFICATION_STATUS,
|
|
5
5
|
UI_NOTIFICATION_TYPE,
|
|
6
6
|
} from '../constants';
|
|
7
|
-
|
|
7
|
+
|
|
8
|
+
export const UiNotificationBaseSchema = z.object({
|
|
8
9
|
uuid: z.string().uuid(),
|
|
9
|
-
type: z.nativeEnum(UI_NOTIFICATION_TYPE),
|
|
10
|
-
dynamicUiContent: z.record(z.unknown()),
|
|
11
10
|
userId: z.string().nullable(),
|
|
12
11
|
priority: z.number().int(),
|
|
13
12
|
isRead: z.boolean(),
|
|
@@ -17,3 +16,62 @@ export const uiNotificationSchema = z.object({
|
|
|
17
16
|
endDate: z.date().nullable(),
|
|
18
17
|
serverTime: z.date().optional(),
|
|
19
18
|
});
|
|
19
|
+
export type UiNotificationBase = z.infer<typeof UiNotificationBaseSchema>;
|
|
20
|
+
|
|
21
|
+
export const ConnectTelegramBonusUiContentSchema = z.object({
|
|
22
|
+
promocode: z.string(),
|
|
23
|
+
bonusPercent: z.number(),
|
|
24
|
+
endDate: z.string().datetime(),
|
|
25
|
+
});
|
|
26
|
+
export type ConnectTelegramBonusUiContent = z.infer<typeof ConnectTelegramBonusUiContentSchema>;
|
|
27
|
+
|
|
28
|
+
export const SubscriptionPastDueUiContentSchema = z.object({
|
|
29
|
+
userToSubscriptionId: z.string(),
|
|
30
|
+
endDate: z.string().datetime(),
|
|
31
|
+
});
|
|
32
|
+
export type SubscriptionPastDueUiContent = z.infer<typeof SubscriptionPastDueUiContentSchema>;
|
|
33
|
+
|
|
34
|
+
export const FraudDetectedUiContentSchema = z.object({
|
|
35
|
+
message: z.string(),
|
|
36
|
+
endDate: z.string().datetime(),
|
|
37
|
+
});
|
|
38
|
+
export type FraudDetectedUiContent = z.infer<typeof FraudDetectedUiContentSchema>;
|
|
39
|
+
|
|
40
|
+
export const PromocodeOfferUiContentSchema = z.object({
|
|
41
|
+
title: z.string(),
|
|
42
|
+
message: z.string(),
|
|
43
|
+
promocode: z.string(),
|
|
44
|
+
bonusPercent: z.number(),
|
|
45
|
+
validTill: z.string().datetime().nullable(),
|
|
46
|
+
});
|
|
47
|
+
export type PromocodeOfferUiContent = z.infer<typeof PromocodeOfferUiContentSchema>;
|
|
48
|
+
|
|
49
|
+
export const GenericUiContentSchema = z.object({
|
|
50
|
+
title: z.string(),
|
|
51
|
+
message: z.string(),
|
|
52
|
+
});
|
|
53
|
+
export type GenericUiContentType = z.infer<typeof GenericUiContentSchema>;
|
|
54
|
+
|
|
55
|
+
export const UiNotificationSchema = z.discriminatedUnion('type', [
|
|
56
|
+
UiNotificationBaseSchema.extend({
|
|
57
|
+
type: z.literal(UI_NOTIFICATION_TYPE.CONNECT_TELEGRAM_BONUS),
|
|
58
|
+
dynamicUiContent: ConnectTelegramBonusUiContentSchema,
|
|
59
|
+
}),
|
|
60
|
+
UiNotificationBaseSchema.extend({
|
|
61
|
+
type: z.literal(UI_NOTIFICATION_TYPE.SUBSCRIPTION_PAST_DUE),
|
|
62
|
+
dynamicUiContent: SubscriptionPastDueUiContentSchema,
|
|
63
|
+
}),
|
|
64
|
+
UiNotificationBaseSchema.extend({
|
|
65
|
+
type: z.literal(UI_NOTIFICATION_TYPE.FRAUD_DETECTED),
|
|
66
|
+
dynamicUiContent: FraudDetectedUiContentSchema,
|
|
67
|
+
}),
|
|
68
|
+
UiNotificationBaseSchema.extend({
|
|
69
|
+
type: z.literal(UI_NOTIFICATION_TYPE.PROMOCODE_OFFER),
|
|
70
|
+
dynamicUiContent: PromocodeOfferUiContentSchema,
|
|
71
|
+
}),
|
|
72
|
+
UiNotificationBaseSchema.extend({
|
|
73
|
+
type: z.literal(UI_NOTIFICATION_TYPE.GENERIC),
|
|
74
|
+
dynamicUiContent: GenericUiContentSchema,
|
|
75
|
+
}),
|
|
76
|
+
]);
|
|
77
|
+
export type UiNotification = z.infer<typeof UiNotificationSchema>;
|