@purpleschool/gptbot 0.11.3 → 0.11.5

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.
@@ -22,6 +22,7 @@ var BuySubscriptionCommand;
22
22
  promocode: zod_1.z.string().optional(),
23
23
  webmasterAlias: zod_1.z.string().optional(),
24
24
  teamAccountPurchase: zod_1.z.boolean().optional().default(false),
25
+ teamAccountName: zod_1.z.string().optional(),
25
26
  webmasterReferralProvidedAt: zod_1.z
26
27
  .preprocess((val) => (typeof val === 'string' ? new Date(val) : val), zod_1.z.date())
27
28
  .optional(),
@@ -52,6 +53,15 @@ var BuySubscriptionCommand;
52
53
  }, {
53
54
  message: 'admitadClickDate cannot be in the future',
54
55
  path: ['admitadClickDate'],
56
+ })
57
+ .refine((data) => {
58
+ var _a;
59
+ if (!data.teamAccountPurchase)
60
+ return true;
61
+ return Boolean((_a = data.teamAccountName) === null || _a === void 0 ? void 0 : _a.trim());
62
+ }, {
63
+ message: 'teamAccountName is required for team account purchase',
64
+ path: ['teamAccountName'],
55
65
  });
56
66
  const IReceiptOrderSchema = zod_1.z.object({
57
67
  items: zod_1.z.array(zod_1.z.object({
@@ -9,5 +9,6 @@ var GetSubscriptionsSummaryCommand;
9
9
  features: zod_1.z.array(models_1.SubscriptionFeatureSchema),
10
10
  subscriptions: zod_1.z.array(models_1.UserToSubscriptionWithDowngradeSubscriptionSchema),
11
11
  products: zod_1.z.array(models_1.UserToProductWithProductSchema),
12
+ teamSubscription: models_1.TeamToSubscriptionWithSubscriptionSchema.nullable(),
12
13
  });
13
14
  })(GetSubscriptionsSummaryCommand || (exports.GetSubscriptionsSummaryCommand = GetSubscriptionsSummaryCommand = {}));
@@ -14,6 +14,7 @@ var InviteTeamAccountMemberCommand;
14
14
  }),
15
15
  });
16
16
  InviteTeamAccountMemberCommand.ResponseSchema = zod_1.z.object({
17
- data: zod_1.z.array(models_1.TeamAccountInviteSchema),
17
+ data: zod_1.z.array(models_1.TeamAccountInviteResponseSchema),
18
+ existEmails: zod_1.z.array(zod_1.z.string().email()),
18
19
  });
19
20
  })(InviteTeamAccountMemberCommand || (exports.InviteTeamAccountMemberCommand = InviteTeamAccountMemberCommand = {}));
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TeamAccountInviteSchema = void 0;
3
+ exports.TeamAccountInviteResponseSchema = exports.TeamAccountInviteSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  exports.TeamAccountInviteSchema = zod_1.z.object({
6
6
  uuid: zod_1.z.string().uuid(),
@@ -18,3 +18,6 @@ exports.TeamAccountInviteSchema = zod_1.z.object({
18
18
  createdAt: zod_1.z.date(),
19
19
  updatedAt: zod_1.z.date(),
20
20
  });
21
+ exports.TeamAccountInviteResponseSchema = exports.TeamAccountInviteSchema.omit({
22
+ tokenHash: true,
23
+ });
@@ -22,6 +22,7 @@ export namespace BuySubscriptionCommand {
22
22
  promocode: z.string().optional(),
23
23
  webmasterAlias: z.string().optional(),
24
24
  teamAccountPurchase: z.boolean().optional().default(false),
25
+ teamAccountName: z.string().optional(),
25
26
  webmasterReferralProvidedAt: z
26
27
  .preprocess((val) => (typeof val === 'string' ? new Date(val) : val), z.date())
27
28
  .optional(),
@@ -57,6 +58,16 @@ export namespace BuySubscriptionCommand {
57
58
  message: 'admitadClickDate cannot be in the future',
58
59
  path: ['admitadClickDate'],
59
60
  },
61
+ )
62
+ .refine(
63
+ (data) => {
64
+ if (!data.teamAccountPurchase) return true;
65
+ return Boolean(data.teamAccountName?.trim());
66
+ },
67
+ {
68
+ message: 'teamAccountName is required for team account purchase',
69
+ path: ['teamAccountName'],
70
+ },
60
71
  );
61
72
 
62
73
  export type RequestFast = z.infer<typeof RequestFastSchema>;
@@ -1,6 +1,7 @@
1
1
  import { z } from 'zod';
2
2
  import {
3
3
  SubscriptionFeatureSchema,
4
+ TeamToSubscriptionWithSubscriptionSchema,
4
5
  UserToProductWithProductSchema,
5
6
  UserToSubscriptionWithDowngradeSubscriptionSchema,
6
7
  } from '../../models';
@@ -10,6 +11,7 @@ export namespace GetSubscriptionsSummaryCommand {
10
11
  features: z.array(SubscriptionFeatureSchema),
11
12
  subscriptions: z.array(UserToSubscriptionWithDowngradeSubscriptionSchema),
12
13
  products: z.array(UserToProductWithProductSchema),
14
+ teamSubscription: TeamToSubscriptionWithSubscriptionSchema.nullable(),
13
15
  });
14
16
 
15
17
  export type Response = z.infer<typeof ResponseSchema>;
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- import { TeamAccountInviteSchema } from '../../models';
2
+ import { TeamAccountInviteResponseSchema } from '../../models';
3
3
 
4
4
  export namespace InviteTeamAccountMemberCommand {
5
5
  export const RequestSchema = z.object({
@@ -18,7 +18,8 @@ export namespace InviteTeamAccountMemberCommand {
18
18
  export type Request = z.infer<typeof RequestSchema>;
19
19
 
20
20
  export const ResponseSchema = z.object({
21
- data: z.array(TeamAccountInviteSchema),
21
+ data: z.array(TeamAccountInviteResponseSchema),
22
+ existEmails: z.array(z.string().email()),
22
23
  });
23
24
 
24
25
  export type Response = z.infer<typeof ResponseSchema>;
@@ -16,3 +16,7 @@ export const TeamAccountInviteSchema = z.object({
16
16
  createdAt: z.date(),
17
17
  updatedAt: z.date(),
18
18
  });
19
+
20
+ export const TeamAccountInviteResponseSchema = TeamAccountInviteSchema.omit({
21
+ tokenHash: true,
22
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@purpleschool/gptbot",
3
- "version": "0.11.3",
3
+ "version": "0.11.5",
4
4
  "description": "",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",