@floristcloud/api-lib 1.0.58 → 1.0.61

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 (27) hide show
  1. package/build/commands/client/create-client.command.js +1 -0
  2. package/build/commands/client/update-client.command.js +1 -0
  3. package/build/commands/integration/index.js +1 -0
  4. package/build/commands/integration/telegram-staff/generate-telegram-staff-link.command.js +17 -0
  5. package/build/commands/integration/telegram-staff/get-telegram-staff-link-status.command.js +19 -0
  6. package/build/commands/integration/telegram-staff/index.js +19 -0
  7. package/build/commands/integration/telegram-staff/unlink-telegram-staff.command.js +16 -0
  8. package/build/constant/error.js +1 -0
  9. package/build/enum/notification-channel.enum.js +1 -0
  10. package/build/enum/notification-type.enum.js +1 -0
  11. package/build/schemas/client/client-debt.schema.js +1 -0
  12. package/build/schemas/client/client.schema.js +2 -0
  13. package/build/schemas/order/order.schema.js +1 -0
  14. package/commands/client/create-client.command.ts +1 -0
  15. package/commands/client/update-client.command.ts +1 -0
  16. package/commands/integration/index.ts +1 -0
  17. package/commands/integration/telegram-staff/generate-telegram-staff-link.command.ts +16 -0
  18. package/commands/integration/telegram-staff/get-telegram-staff-link-status.command.ts +18 -0
  19. package/commands/integration/telegram-staff/index.ts +3 -0
  20. package/commands/integration/telegram-staff/unlink-telegram-staff.command.ts +15 -0
  21. package/constant/error.ts +1 -0
  22. package/enum/notification-channel.enum.ts +1 -0
  23. package/enum/notification-type.enum.ts +1 -0
  24. package/package.json +1 -1
  25. package/schemas/client/client-debt.schema.ts +1 -0
  26. package/schemas/client/client.schema.ts +2 -0
  27. package/schemas/order/order.schema.ts +1 -0
@@ -23,6 +23,7 @@ const CreateClientRequestSchema = zod_1.z.object({
23
23
  alwaysRequiresDelivery: zod_1.z.boolean().optional(),
24
24
  additionalPhone: zod_1.z.string().nullable().optional(),
25
25
  comment: zod_1.z.string().max(2000).nullable().optional(),
26
+ paymentGraceDaysAfterCompletion: zod_1.z.coerce.number().int().min(0).nullable().optional(),
26
27
  });
27
28
  const CreateClientResponseSchema = zod_1.z.object({
28
29
  message: zod_1.z.string().optional(),
@@ -25,6 +25,7 @@ const UpdateClientRequestSchema = zod_1.z.object({
25
25
  alwaysRequiresDelivery: zod_1.z.boolean().optional(),
26
26
  additionalPhone: zod_1.z.string().nullable().optional(),
27
27
  comment: zod_1.z.string().max(2000).nullable().optional(),
28
+ paymentGraceDaysAfterCompletion: zod_1.z.coerce.number().int().min(0).nullable().optional(),
28
29
  });
29
30
  const UpdateClientResponseSchema = zod_1.z.object({
30
31
  message: zod_1.z.string().optional(),
@@ -15,3 +15,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./telegram"), exports);
18
+ __exportStar(require("./telegram-staff"), exports);
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GenerateTelegramStaffLinkContractCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ const GenerateTelegramStaffLinkResponseSchema = zod_1.z.object({
6
+ message: zod_1.z.string().optional(),
7
+ data: zod_1.z
8
+ .object({
9
+ link: zod_1.z.string(),
10
+ code: zod_1.z.string(),
11
+ })
12
+ .nullable(),
13
+ });
14
+ var GenerateTelegramStaffLinkContractCommand;
15
+ (function (GenerateTelegramStaffLinkContractCommand) {
16
+ GenerateTelegramStaffLinkContractCommand.ResponseSchema = GenerateTelegramStaffLinkResponseSchema;
17
+ })(GenerateTelegramStaffLinkContractCommand || (exports.GenerateTelegramStaffLinkContractCommand = GenerateTelegramStaffLinkContractCommand = {}));
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GetTelegramStaffLinkStatusContractCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ const GetTelegramStaffLinkStatusResponseSchema = zod_1.z.object({
6
+ message: zod_1.z.string().optional(),
7
+ data: zod_1.z
8
+ .object({
9
+ isLinked: zod_1.z.boolean(),
10
+ username: zod_1.z.string().nullable(),
11
+ firstName: zod_1.z.string().nullable(),
12
+ lastName: zod_1.z.string().nullable(),
13
+ })
14
+ .nullable(),
15
+ });
16
+ var GetTelegramStaffLinkStatusContractCommand;
17
+ (function (GetTelegramStaffLinkStatusContractCommand) {
18
+ GetTelegramStaffLinkStatusContractCommand.ResponseSchema = GetTelegramStaffLinkStatusResponseSchema;
19
+ })(GetTelegramStaffLinkStatusContractCommand || (exports.GetTelegramStaffLinkStatusContractCommand = GetTelegramStaffLinkStatusContractCommand = {}));
@@ -0,0 +1,19 @@
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("./generate-telegram-staff-link.command"), exports);
18
+ __exportStar(require("./get-telegram-staff-link-status.command"), exports);
19
+ __exportStar(require("./unlink-telegram-staff.command"), exports);
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UnlinkTelegramStaffContractCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ const UnlinkTelegramStaffResponseSchema = zod_1.z.object({
6
+ message: zod_1.z.string().optional(),
7
+ data: zod_1.z
8
+ .object({
9
+ success: zod_1.z.boolean(),
10
+ })
11
+ .nullable(),
12
+ });
13
+ var UnlinkTelegramStaffContractCommand;
14
+ (function (UnlinkTelegramStaffContractCommand) {
15
+ UnlinkTelegramStaffContractCommand.ResponseSchema = UnlinkTelegramStaffResponseSchema;
16
+ })(UnlinkTelegramStaffContractCommand || (exports.UnlinkTelegramStaffContractCommand = UnlinkTelegramStaffContractCommand = {}));
@@ -153,6 +153,7 @@ exports.ERRORS = {
153
153
  CLIENT_MARKING_NOT_UPDATED: { code: 'CL030', message: 'Client marking not updated', httpCode: 500 },
154
154
  CLIENT_HAS_TRANSACTIONS: { code: 'CL031', message: 'Client has transactions', httpCode: 400 },
155
155
  CLIENT_DEBT_LIST_FETCH_FAILED: { code: 'CL032', message: 'Failed to get client debt list', httpCode: 500 },
156
+ CLIENT_OVERDUE_STATUS_FETCH_FAILED: { code: 'CL033', message: 'Failed to get client overdue status', httpCode: 500 },
156
157
  //INDIVIDUAL PROFILE
157
158
  CLIENT_INDIVIDUAL_PROFILE_NOT_CREATED: { code: 'CL013', message: 'Failed to create client individual profile', httpCode: 500 },
158
159
  CLIENT_INDIVIDUAL_PROFILE_ALREADY_EXIST: { code: 'CL014', message: 'Individual profile already exist', httpCode: 409 },
@@ -10,5 +10,6 @@ var NotificationChannelEnum;
10
10
  NotificationChannelEnum["MAX"] = "MAX";
11
11
  NotificationChannelEnum["EMAIL"] = "EMAIL";
12
12
  NotificationChannelEnum["TELEGRAM_BOT"] = "TELEGRAM_BOT";
13
+ NotificationChannelEnum["TELEGRAM_STAFF_BOT"] = "TELEGRAM_STAFF_BOT";
13
14
  NotificationChannelEnum["SYSTEM"] = "SYSTEM";
14
15
  })(NotificationChannelEnum || (exports.NotificationChannelEnum = NotificationChannelEnum = {}));
@@ -8,4 +8,5 @@ var NotificationTypeEnum;
8
8
  NotificationTypeEnum["ORDER_INVOICE"] = "ORDER_INVOICE";
9
9
  NotificationTypeEnum["CART_EXPIRATION"] = "CART_EXPIRATION";
10
10
  NotificationTypeEnum["WRITE_OFF_REJECTED"] = "WRITE_OFF_REJECTED";
11
+ NotificationTypeEnum["CLIENT_MESSAGE_TO_EMPLOYEE"] = "CLIENT_MESSAGE_TO_EMPLOYEE";
11
12
  })(NotificationTypeEnum || (exports.NotificationTypeEnum = NotificationTypeEnum = {}));
@@ -14,6 +14,7 @@ exports.ClientDebtItemSchema = zod_1.z.object({
14
14
  completedOrdersBalance: zod_1.z.number(),
15
15
  completedOrdersBalanceWithDelay: zod_1.z.number(),
16
16
  nonCompletedBalance: zod_1.z.number(),
17
+ hasOverdueDebt: zod_1.z.boolean().nullable(),
17
18
  });
18
19
  exports.ClientDebtListSchema = zod_1.z.object({
19
20
  clientList: exports.ClientDebtItemSchema.array(),
@@ -27,6 +27,7 @@ exports.ClientSchema = zod_1.z.object({
27
27
  alwaysRequiresDelivery: zod_1.z.boolean(),
28
28
  additionalPhone: zod_1.z.string().nullable(),
29
29
  comment: zod_1.z.string().nullable(),
30
+ paymentGraceDaysAfterCompletion: zod_1.z.number().nullable(),
30
31
  balance: zod_1.z.number(),
31
32
  deletedAt: zod_1.z.date().nullable(),
32
33
  createdAt: zod_1.z.date(),
@@ -44,6 +45,7 @@ exports.ClientExtendedSchema = exports.ClientSchema.merge(zod_1.z.object({
44
45
  orderCount: zod_1.z.number(),
45
46
  responsibleUser: user_schema_1.UserSchema.nullable(),
46
47
  clientMarkingList: client_marking_schema_1.ClientMarkingSchema.array().optional(),
48
+ hasOverdueDebt: zod_1.z.boolean().nullable().optional(),
47
49
  }));
48
50
  exports.ClientExtendedListSchema = zod_1.z.object({
49
51
  clientList: exports.ClientExtendedSchema.array(),
@@ -50,6 +50,7 @@ exports.OrderExtendedSchema = exports.OrderSchema.extend({
50
50
  consignmentDeliveryDates: zod_1.z.union([zod_1.z.date(), zod_1.z.literal('in-stock')]).array(),
51
51
  deliveryRoute: delivery_route_schema_1.DeliveryRouteSchema.nullable().optional(),
52
52
  canReceiveTelegramNotifications: zod_1.z.boolean(),
53
+ clientHasOverdueDebt: zod_1.z.boolean().nullable(),
53
54
  });
54
55
  exports.OrderExtendedForClientSchema = exports.OrderForClientSchema.extend({
55
56
  client: client_1.ClientSchema,
@@ -21,6 +21,7 @@ const CreateClientRequestSchema = z.object({
21
21
  alwaysRequiresDelivery: z.boolean().optional(),
22
22
  additionalPhone: z.string().nullable().optional(),
23
23
  comment: z.string().max(2000).nullable().optional(),
24
+ paymentGraceDaysAfterCompletion: z.coerce.number().int().min(0).nullable().optional(),
24
25
  });
25
26
 
26
27
  const CreateClientResponseSchema = z.object({
@@ -23,6 +23,7 @@ const UpdateClientRequestSchema = z.object({
23
23
  alwaysRequiresDelivery: z.boolean().optional(),
24
24
  additionalPhone: z.string().nullable().optional(),
25
25
  comment: z.string().max(2000).nullable().optional(),
26
+ paymentGraceDaysAfterCompletion: z.coerce.number().int().min(0).nullable().optional(),
26
27
  });
27
28
 
28
29
  const UpdateClientResponseSchema = z.object({
@@ -1,2 +1,3 @@
1
1
  export * from './telegram';
2
+ export * from './telegram-staff';
2
3
 
@@ -0,0 +1,16 @@
1
+ import { z } from 'zod';
2
+
3
+ const GenerateTelegramStaffLinkResponseSchema = z.object({
4
+ message: z.string().optional(),
5
+ data: z
6
+ .object({
7
+ link: z.string(),
8
+ code: z.string(),
9
+ })
10
+ .nullable(),
11
+ });
12
+
13
+ export namespace GenerateTelegramStaffLinkContractCommand {
14
+ export const ResponseSchema = GenerateTelegramStaffLinkResponseSchema;
15
+ export type Response = z.infer<typeof ResponseSchema>;
16
+ }
@@ -0,0 +1,18 @@
1
+ import { z } from 'zod';
2
+
3
+ const GetTelegramStaffLinkStatusResponseSchema = z.object({
4
+ message: z.string().optional(),
5
+ data: z
6
+ .object({
7
+ isLinked: z.boolean(),
8
+ username: z.string().nullable(),
9
+ firstName: z.string().nullable(),
10
+ lastName: z.string().nullable(),
11
+ })
12
+ .nullable(),
13
+ });
14
+
15
+ export namespace GetTelegramStaffLinkStatusContractCommand {
16
+ export const ResponseSchema = GetTelegramStaffLinkStatusResponseSchema;
17
+ export type Response = z.infer<typeof ResponseSchema>;
18
+ }
@@ -0,0 +1,3 @@
1
+ export * from './generate-telegram-staff-link.command';
2
+ export * from './get-telegram-staff-link-status.command';
3
+ export * from './unlink-telegram-staff.command';
@@ -0,0 +1,15 @@
1
+ import { z } from 'zod';
2
+
3
+ const UnlinkTelegramStaffResponseSchema = z.object({
4
+ message: z.string().optional(),
5
+ data: z
6
+ .object({
7
+ success: z.boolean(),
8
+ })
9
+ .nullable(),
10
+ });
11
+
12
+ export namespace UnlinkTelegramStaffContractCommand {
13
+ export const ResponseSchema = UnlinkTelegramStaffResponseSchema;
14
+ export type Response = z.infer<typeof ResponseSchema>;
15
+ }
package/constant/error.ts CHANGED
@@ -159,6 +159,7 @@ export const ERRORS = {
159
159
  CLIENT_MARKING_NOT_UPDATED: { code: 'CL030', message: 'Client marking not updated', httpCode: 500 },
160
160
  CLIENT_HAS_TRANSACTIONS: { code: 'CL031', message: 'Client has transactions', httpCode: 400 },
161
161
  CLIENT_DEBT_LIST_FETCH_FAILED: { code: 'CL032', message: 'Failed to get client debt list', httpCode: 500 },
162
+ CLIENT_OVERDUE_STATUS_FETCH_FAILED: { code: 'CL033', message: 'Failed to get client overdue status', httpCode: 500 },
162
163
 
163
164
  //INDIVIDUAL PROFILE
164
165
  CLIENT_INDIVIDUAL_PROFILE_NOT_CREATED: { code: 'CL013', message: 'Failed to create client individual profile', httpCode: 500 },
@@ -6,5 +6,6 @@ export enum NotificationChannelEnum {
6
6
  MAX = 'MAX',
7
7
  EMAIL = 'EMAIL',
8
8
  TELEGRAM_BOT = 'TELEGRAM_BOT',
9
+ TELEGRAM_STAFF_BOT = 'TELEGRAM_STAFF_BOT',
9
10
  SYSTEM = 'SYSTEM',
10
11
  }
@@ -4,4 +4,5 @@ export enum NotificationTypeEnum {
4
4
  ORDER_INVOICE = 'ORDER_INVOICE',
5
5
  CART_EXPIRATION = 'CART_EXPIRATION',
6
6
  WRITE_OFF_REJECTED = 'WRITE_OFF_REJECTED',
7
+ CLIENT_MESSAGE_TO_EMPLOYEE = 'CLIENT_MESSAGE_TO_EMPLOYEE',
7
8
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@floristcloud/api-lib",
3
- "version": "1.0.58",
3
+ "version": "1.0.61",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "scripts": {
@@ -12,6 +12,7 @@ export const ClientDebtItemSchema = z.object({
12
12
  completedOrdersBalance: z.number(),
13
13
  completedOrdersBalanceWithDelay: z.number(),
14
14
  nonCompletedBalance: z.number(),
15
+ hasOverdueDebt: z.boolean().nullable(),
15
16
  });
16
17
 
17
18
  export const ClientDebtListSchema = z.object({
@@ -25,6 +25,7 @@ export const ClientSchema = z.object({
25
25
  alwaysRequiresDelivery: z.boolean(),
26
26
  additionalPhone: z.string().nullable(),
27
27
  comment: z.string().nullable(),
28
+ paymentGraceDaysAfterCompletion: z.number().nullable(),
28
29
 
29
30
  balance: z.number(),
30
31
 
@@ -47,6 +48,7 @@ export const ClientExtendedSchema = ClientSchema.merge(
47
48
  orderCount: z.number(),
48
49
  responsibleUser: UserSchema.nullable(),
49
50
  clientMarkingList: ClientMarkingSchema.array().optional(),
51
+ hasOverdueDebt: z.boolean().nullable().optional(),
50
52
  }),
51
53
  );
52
54
 
@@ -56,6 +56,7 @@ export const OrderExtendedSchema = OrderSchema.extend({
56
56
  consignmentDeliveryDates: z.union([z.date(), z.literal('in-stock')]).array(),
57
57
  deliveryRoute: DeliveryRouteSchema.nullable().optional(),
58
58
  canReceiveTelegramNotifications: z.boolean(),
59
+ clientHasOverdueDebt: z.boolean().nullable(),
59
60
  });
60
61
 
61
62
  export const OrderExtendedForClientSchema = OrderForClientSchema.extend({