@kl1/contracts 1.0.17 → 1.0.18

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/dist/index.mjs CHANGED
@@ -600,7 +600,7 @@ var ChannelSchema = DefaultEntitySchema.extend({
600
600
  type: ChannelTypeSchema,
601
601
  metadata: ChannelMetadataSchema,
602
602
  brandName: z15.string(),
603
- platformId: z15.string().uuid(),
603
+ platformId: z15.string(),
604
604
  status: ChannelStatusTypeSchema,
605
605
  isReloginRequired: z15.boolean(),
606
606
  connectedUserName: z15.string(),
@@ -812,16 +812,16 @@ var MessageTypeSchema = z22.enum([
812
812
  "updated",
813
813
  "started"
814
814
  ]);
815
- var MessageLocaleTypeSchema = z22.enum(["mm", "en", "th"]);
815
+ var MessageLocaleTypeSchema = z22.enum(["mm", "en", "th", ""]);
816
816
  var PlatformContactMetadataSchema = z22.object({
817
817
  id: z22.string(),
818
818
  name: z22.string(),
819
- picture: z22.string(),
819
+ picture: z22.string().optional(),
820
820
  additionalCredentials: z22.any()
821
821
  });
822
822
  var PlatformContactSchema = DefaultEntitySchema.extend({
823
823
  channelId: z22.string().uuid(),
824
- socialPlatformId: z22.string().uuid(),
824
+ socialPlatformId: z22.string(),
825
825
  type: ChannelTypeSchema,
826
826
  metadata: PlatformContactMetadataSchema,
827
827
  contact: ContactSchema
@@ -922,9 +922,8 @@ var SendMessageSchema = z24.object({
922
922
  roomId: z24.string().uuid(),
923
923
  messageType: MessageTypeSchema,
924
924
  message: z24.string().optional(),
925
- direction: MessageDirectionTypeSchema,
926
925
  messageAttachments: MessageAttachmentSchema.optional(),
927
- user: UserSchema,
926
+ user: UserSchema.optional(),
928
927
  packageId: z24.number().optional(),
929
928
  stickerId: z24.number().optional()
930
929
  });
@@ -938,9 +937,69 @@ var SearchRoomsSchema = DefaultQueryParamsSchema.extend({
938
937
  query: z24.string()
939
938
  });
940
939
  var SendMessageToPlatformSchema = z24.object({
941
- room: RoomSchema,
942
- message: MessageSchema,
943
- url: z24.string().optional()
940
+ room: z24.object({
941
+ id: z24.string().uuid(),
942
+ createdAt: z24.date().nullable(),
943
+ updatedAt: z24.date().nullable(),
944
+ deletedAt: z24.date().nullable(),
945
+ lastMessage: z24.string().optional(),
946
+ handleTime: z24.number().optional(),
947
+ isLatest: z24.boolean(),
948
+ direction: MessageDirectionTypeSchema,
949
+ platformContact: z24.object({
950
+ channelId: z24.string().uuid(),
951
+ socialPlatformId: z24.string().nullable(),
952
+ type: ChannelTypeSchema,
953
+ metadata: PlatformContactMetadataSchema,
954
+ contact: z24.object({
955
+ name: z24.string(),
956
+ address: z24.string().nullable(),
957
+ channel: z24.string().nullable(),
958
+ notes: z24.string().nullable(),
959
+ contactProfile: z24.string().nullable(),
960
+ socialProfileUrl: z24.string().nullable()
961
+ })
962
+ }),
963
+ actor: z24.object({
964
+ name: z24.string(),
965
+ email: z24.string().email(),
966
+ address: z24.string().nullable(),
967
+ phone: z24.string().nullable()
968
+ }).nullable(),
969
+ channel: z24.object({
970
+ name: z24.string(),
971
+ type: ChannelTypeSchema,
972
+ metadata: ChannelMetadataSchema,
973
+ brandName: z24.string(),
974
+ platformId: z24.string(),
975
+ status: ChannelStatusTypeSchema,
976
+ isReloginRequired: z24.boolean(),
977
+ connectedUserName: z24.string().optional().nullable(),
978
+ connectedUserId: z24.string().optional().nullable()
979
+ })
980
+ }),
981
+ message: z24.object({
982
+ message: z24.string().optional(),
983
+ direction: MessageDirectionTypeSchema,
984
+ type: MessageTypeSchema,
985
+ readAt: z24.date().optional(),
986
+ metadata: z24.any().optional(),
987
+ platformId: z24.string().optional(),
988
+ platformMessageId: z24.string().optional(),
989
+ replyPlatformMessageId: z24.string().optional(),
990
+ template: z24.any().optional(),
991
+ locale: MessageLocaleTypeSchema.optional(),
992
+ url: z24.string().optional(),
993
+ previewUrl: z24.string().optional(),
994
+ imageSetId: z24.string().optional(),
995
+ upload: UploadSchema.optional(),
996
+ sender: z24.object({
997
+ name: z24.string(),
998
+ email: z24.string().email(),
999
+ address: z24.string().nullable(),
1000
+ phone: z24.string().nullable()
1001
+ })
1002
+ })
944
1003
  });
945
1004
  var SendMessageResponseSchema = DefaultSuccessResponseSchema.extend({
946
1005
  data: MessageSchema
@@ -994,10 +1053,26 @@ var mainChatContract = initContract6().router(
994
1053
  path: "/message",
995
1054
  body: SendMessageSchema,
996
1055
  responses: {
997
- 200: null
1056
+ 200: DefaultSuccessResponseSchema.extend({
1057
+ data: MessageSchema
1058
+ }),
1059
+ 500: DefaultErrorResponseSchema
998
1060
  },
999
1061
  summary: "Send message to room"
1000
1062
  },
1063
+ getRoomsByPlatformContactId: {
1064
+ method: "GET",
1065
+ path: "/rooms/:platformContactId",
1066
+ pathParams: z25.object({
1067
+ platformContactId: z25.string()
1068
+ }),
1069
+ responses: {
1070
+ 200: DefaultSuccessResponseSchema.extend({
1071
+ data: z25.array(RoomSchema),
1072
+ total: z25.number()
1073
+ })
1074
+ }
1075
+ },
1001
1076
  getMessages: {
1002
1077
  method: "GET",
1003
1078
  path: "/message/:roomId",
@@ -1598,7 +1673,7 @@ import z28 from "zod";
1598
1673
  var TicketCustomFieldSchema = DefaultEntitySchema.extend({
1599
1674
  textValue: z28.string().nullable(),
1600
1675
  booleanValue: z28.boolean().nullable(),
1601
- numberValue: z28.number().nullable(),
1676
+ numberValue: z28.coerce.number().nullable(),
1602
1677
  dateValue: z28.date().nullable(),
1603
1678
  attribute: AttributeSchema.omit({ options: true, group: true }),
1604
1679
  uploads: z28.array(
@@ -1612,6 +1687,23 @@ var TicketCustomFieldSchema = DefaultEntitySchema.extend({
1612
1687
  })
1613
1688
  )
1614
1689
  });
1690
+ var TicketEntityTypesSchema = z28.object({
1691
+ id: z28.string().uuid(),
1692
+ createdAt: z28.date(),
1693
+ updatedAt: z28.date(),
1694
+ deletedAt: z28.date().nullable(),
1695
+ entity: z28.string(),
1696
+ description: z28.string().nullable()
1697
+ });
1698
+ var TicketActivitySchema = z28.object({
1699
+ id: z28.string().uuid(),
1700
+ createdAt: z28.date(),
1701
+ updatedAt: z28.date(),
1702
+ deletedAt: z28.date().nullable(),
1703
+ entityId: z28.string(),
1704
+ description: z28.string(),
1705
+ entityType: TicketEntityTypesSchema
1706
+ });
1615
1707
  var TicketSchema = DefaultEntitySchema.extend({
1616
1708
  title: z28.string(),
1617
1709
  description: z28.string().nullable(),
@@ -1623,7 +1715,7 @@ var TicketSchema = DefaultEntitySchema.extend({
1623
1715
  creatorId: z28.string().uuid(),
1624
1716
  assigneeId: z28.string().uuid(),
1625
1717
  reasonToAssign: z28.string().nullable(),
1626
- ticketNumber: z28.number().optional(),
1718
+ ticketNumber: z28.coerce.number().optional(),
1627
1719
  customFields: z28.array(TicketCustomFieldSchema)
1628
1720
  });
1629
1721
  var TicketCountByContactSchema = z28.object({
@@ -1632,34 +1724,7 @@ var TicketCountByContactSchema = z28.object({
1632
1724
  pending: z28.coerce.number(),
1633
1725
  closed: z28.coerce.number(),
1634
1726
  solved: z28.coerce.number()
1635
- }).optional();
1636
- var TicketParamsSchema = z28.object({
1637
- page: z28.coerce.number().default(1),
1638
- pageSize: z28.coerce.number().default(10)
1639
- }).optional();
1640
- var CustomFieldQuery = z28.object({
1641
- attributeId: z28.string(),
1642
- type: z28.string(),
1643
- value: z28.union([z28.string(), z28.array(z28.string())])
1644
- });
1645
- var GetAllTicketQuerySchema = z28.object({
1646
- page: z28.number().default(1),
1647
- pageSize: z28.number().default(10),
1648
- agent: z28.array(z28.string()),
1649
- selectedDate: z28.string(),
1650
- keyword: z28.string(),
1651
- title: z28.string(),
1652
- description: z28.string(),
1653
- status: z28.array(z28.string()),
1654
- priority: z28.array(z28.string()),
1655
- channel: z28.array(z28.string()),
1656
- type: z28.array(z28.string()),
1657
- ticketType: z28.array(z28.string()),
1658
- contact: z28.array(z28.string()),
1659
- tags: z28.array(z28.string()),
1660
- categories: z28.array(z28.string()),
1661
- customFields: z28.array(CustomFieldQuery)
1662
- }).partial();
1727
+ });
1663
1728
 
1664
1729
  // src/ticket/validation.ts
1665
1730
  import z29 from "zod";
@@ -1707,6 +1772,39 @@ var CreateTicketAttachmentRecordsSchema = z29.object({
1707
1772
  attributeId: z29.string(),
1708
1773
  ticketAttachmentRecords: z29.array(TicketAttachmentRecordSchema)
1709
1774
  });
1775
+ var TicketParamsSchema = z29.object({
1776
+ page: z29.coerce.number().default(1),
1777
+ pageSize: z29.coerce.number().default(10)
1778
+ }).optional();
1779
+ var CustomFieldQuery = z29.object({
1780
+ attributeId: z29.string(),
1781
+ type: z29.string(),
1782
+ value: z29.union([z29.string(), z29.array(z29.string())])
1783
+ });
1784
+ var GetAllTicketQuerySchema = z29.object({
1785
+ page: z29.coerce.number().default(1),
1786
+ pageSize: z29.coerce.number().default(10),
1787
+ agent: z29.array(z29.string()).optional(),
1788
+ selectedDate: z29.string().optional(),
1789
+ keyword: z29.string().optional(),
1790
+ title: z29.string().optional(),
1791
+ description: z29.string().optional(),
1792
+ status: z29.array(z29.string()).optional(),
1793
+ priority: z29.array(z29.string()).optional(),
1794
+ channel: z29.array(z29.string()).optional(),
1795
+ type: z29.array(z29.string()).optional(),
1796
+ ticketType: z29.array(z29.string()).optional(),
1797
+ contact: z29.array(z29.string()).optional(),
1798
+ tags: z29.array(z29.string()).optional(),
1799
+ categories: z29.array(z29.string()).optional(),
1800
+ customFields: z29.array(
1801
+ z29.object({
1802
+ attributeId: z29.string().uuid(),
1803
+ type: z29.string(),
1804
+ value: z29.union([z29.string(), z29.array(z29.string())])
1805
+ })
1806
+ ).optional()
1807
+ });
1710
1808
 
1711
1809
  // src/ticket/index.ts
1712
1810
  var ticketContract = initContract8().router(
@@ -2957,8 +3055,6 @@ var messengerContract = initContract18().router({
2957
3055
  500: DefaultErrorResponseSchema
2958
3056
  }
2959
3057
  }
2960
- }, {
2961
- baseHeaders: DefaultHeaderSchema
2962
3058
  });
2963
3059
 
2964
3060
  // src/permission/index.ts
@@ -3752,6 +3848,7 @@ export {
3752
3848
  chatContract,
3753
3849
  platformContract,
3754
3850
  tagContract,
3851
+ ticketContract,
3755
3852
  wrapUpFormContract
3756
3853
  };
3757
3854
  //# sourceMappingURL=index.mjs.map