@kl1/contracts 1.0.17 → 1.0.19

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