@kl1/contracts 1.0.15 → 1.0.16

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
@@ -654,7 +654,7 @@ var channelContract = initContract5().router(
654
654
 
655
655
  // src/chat/index.ts
656
656
  import { initContract as initContract6 } from "@ts-rest/core";
657
- import z24 from "zod";
657
+ import z25 from "zod";
658
658
 
659
659
  // src/contact/schema.ts
660
660
  import z20 from "zod";
@@ -767,18 +767,38 @@ var ContactSchema = z20.object({
767
767
  });
768
768
 
769
769
  // src/chat/schema.ts
770
+ import z22 from "zod";
771
+
772
+ // src/cx-log/schema.ts
770
773
  import z21 from "zod";
771
- var MessageDirectionTypeSchema = z21.enum([
774
+ var CxLogSchema = DefaultEntitySchema.extend({
775
+ caseId: z21.number(),
776
+ entityId: z21.string().uuid(),
777
+ entityName: z21.string(),
778
+ contactId: z21.string().uuid().nullable(),
779
+ channel: z21.string().nullable(),
780
+ queueId: z21.string().uuid().nullable(),
781
+ agentId: z21.string().uuid().nullable(),
782
+ direction: z21.string().nullable(),
783
+ startedDate: z21.date().nullable(),
784
+ handledTime: z21.number().nullable(),
785
+ firstResponseTime: z21.number().nullable(),
786
+ disposition: z21.string().nullable()
787
+ });
788
+
789
+ // src/chat/schema.ts
790
+ var MessageDirectionTypeSchema = z22.enum([
772
791
  "incoming",
773
792
  "outgoing",
774
793
  "system"
775
794
  ]);
776
- var MessageTypeSchema = z21.enum([
795
+ var MessageTypeSchema = z22.enum([
777
796
  "text",
778
797
  "image",
779
798
  "video",
780
799
  "audio",
781
800
  "file",
801
+ "imagemap",
782
802
  "fallback",
783
803
  "location",
784
804
  "attachment",
@@ -792,136 +812,138 @@ var MessageTypeSchema = z21.enum([
792
812
  "updated",
793
813
  "started"
794
814
  ]);
795
- var MessageLocaleTypeSchema = z21.enum([
796
- "mm",
797
- "en",
798
- "th"
799
- ]);
800
- var PlatformContactMetadataSchema = z21.object({
801
- id: z21.string(),
802
- name: z21.string(),
803
- picture: z21.string(),
804
- additionalCredentials: z21.any()
815
+ var MessageLocaleTypeSchema = z22.enum(["mm", "en", "th"]);
816
+ var PlatformContactMetadataSchema = z22.object({
817
+ id: z22.string(),
818
+ name: z22.string(),
819
+ picture: z22.string(),
820
+ additionalCredentials: z22.any()
805
821
  });
806
822
  var PlatformContactSchema = DefaultEntitySchema.extend({
807
- channelId: z21.string().uuid(),
808
- socialPlatformId: z21.string().uuid(),
809
- platform: ChannelTypeSchema,
823
+ channelId: z22.string().uuid(),
824
+ socialPlatformId: z22.string().uuid(),
825
+ type: ChannelTypeSchema,
810
826
  metadata: PlatformContactMetadataSchema,
811
827
  contact: ContactSchema
812
828
  });
813
829
  var RoomSchema = DefaultEntitySchema.extend({
814
- lastMessage: z21.string(),
815
- handleTime: z21.number(),
816
- isSolved: z21.boolean(),
817
- closeAt: z21.date(),
818
- unreadCount: z21.number(),
819
- firstResponseTime: z21.date(),
820
- isLatest: z21.boolean(),
830
+ lastMessage: z22.string(),
831
+ handleTime: z22.number(),
832
+ closeAt: z22.date(),
833
+ unreadCount: z22.number(),
834
+ firstResponseAt: z22.date(),
835
+ firstResponseTime: z22.number(),
836
+ isLatest: z22.boolean(),
821
837
  direction: MessageDirectionTypeSchema,
822
838
  platformContact: PlatformContactSchema,
823
839
  actor: UserSchema,
824
840
  assignee: UserSchema,
825
- channel: ChannelSchema
841
+ channel: ChannelSchema,
842
+ cxLog: CxLogSchema
826
843
  });
827
844
  var MessageSchema = DefaultEntitySchema.extend({
828
- message: z21.string(),
845
+ message: z22.string(),
829
846
  direction: MessageDirectionTypeSchema,
830
847
  type: MessageTypeSchema,
831
- readAt: z21.date(),
832
- metadata: z21.any(),
833
- platformId: z21.string(),
834
- platformMessageId: z21.string(),
835
- replyPlatformMessageId: z21.string(),
836
- template: z21.any(),
848
+ readAt: z22.date(),
849
+ metadata: z22.any(),
850
+ platformId: z22.string(),
851
+ platformMessageId: z22.string(),
852
+ replyPlatformMessageId: z22.string(),
853
+ template: z22.any(),
837
854
  locale: MessageLocaleTypeSchema,
838
- isSent: z21.boolean(),
855
+ url: z22.string(),
856
+ previewUrl: z22.string(),
857
+ imageSetId: z22.string(),
839
858
  room: RoomSchema,
840
859
  upload: UploadSchema,
841
860
  actor: UserSchema,
842
861
  assignee: UserSchema,
843
862
  sender: UserSchema
844
863
  });
845
- var UnreadCountsByAssigneeSchema = z21.object({
846
- assigneeId: z21.string(),
847
- totalUnreadCount: z21.number()
864
+ var UnreadCountsByAssigneeSchema = z22.object({
865
+ assigneeId: z22.string(),
866
+ totalUnreadCount: z22.number()
848
867
  });
849
868
 
850
869
  // src/chat/validation.ts
851
- import z23 from "zod";
870
+ import z24 from "zod";
852
871
 
853
872
  // src/custom-field/schema.ts
854
- import z22 from "zod";
873
+ import z23 from "zod";
855
874
  var CustomFieldSchema = DefaultEntitySchema.extend({
856
- textValue: z22.string().nullable(),
857
- booleanValue: z22.boolean().nullable(),
858
- numberValue: z22.number().nullable(),
859
- dateValue: z22.date().nullable(),
860
- entityId: z22.string().uuid(),
861
- attributeId: z22.string().uuid()
875
+ textValue: z23.string().nullable(),
876
+ booleanValue: z23.boolean().nullable(),
877
+ numberValue: z23.number().nullable(),
878
+ dateValue: z23.date().nullable(),
879
+ entityId: z23.string().uuid(),
880
+ attributeId: z23.string().uuid()
862
881
  });
863
882
 
864
883
  // src/chat/validation.ts
865
- var GetRoomsSchema = z23.object({
866
- page: z23.coerce.number().positive().default(1),
867
- pageSize: z23.coerce.number().positive().default(20),
868
- contactTagIds: z23.string().array().optional(),
869
- contactIds: z23.string().array().optional(),
870
- agentIds: z23.string().array().optional(),
871
- roomTagIds: z23.string().array().optional(),
872
- keyword: z23.string().optional(),
873
- company: z23.string().array().optional(),
874
- channel: z23.string().array().optional(),
875
- name: z23.string().optional(),
876
- address: z23.string().optional(),
877
- contactGroups: z23.string().array().optional(),
878
- selectedDate: z23.string().optional(),
879
- customFields: z23.array(CustomFieldSchema).optional(),
880
- tags: z23.string().array().optional(),
881
- phone: z23.string().optional(),
882
- email: z23.string().optional(),
883
- notes: z23.string().optional(),
884
- tab: z23.string().optional()
885
- });
886
- var UpdateRoomTagsAndNotesSchema = z23.object({
887
- notes: z23.string().optional(),
888
- tags: z23.string().array().optional()
884
+ var GetRoomsSchema = z24.object({
885
+ page: z24.coerce.number().positive().default(1),
886
+ pageSize: z24.coerce.number().positive().default(20),
887
+ contactTagIds: z24.string().array().optional(),
888
+ contactIds: z24.string().array().optional(),
889
+ agentIds: z24.string().array().optional(),
890
+ roomTagIds: z24.string().array().optional(),
891
+ keyword: z24.string().optional(),
892
+ company: z24.string().array().optional(),
893
+ channel: z24.string().array().optional(),
894
+ name: z24.string().optional(),
895
+ address: z24.string().optional(),
896
+ contactGroups: z24.string().array().optional(),
897
+ selectedDate: z24.string().optional(),
898
+ customFields: z24.array(CustomFieldSchema).optional(),
899
+ tags: z24.string().array().optional(),
900
+ phone: z24.string().optional(),
901
+ email: z24.string().optional(),
902
+ notes: z24.string().optional(),
903
+ tab: z24.string().optional()
904
+ });
905
+ var UpdateRoomTagsAndNotesSchema = z24.object({
906
+ note: z24.string().optional(),
907
+ tags: TagSchema.array().optional()
889
908
  });
890
909
  var UpdateRoomAttributesSchema = UpdateRoomTagsAndNotesSchema.extend({
891
- roomId: z23.string().uuid()
892
- });
893
- var MessageAttachmentSchema = z23.object({
894
- bucketName: z23.string(),
895
- fileKey: z23.string(),
896
- fileName: z23.string(),
897
- fileSize: z23.number(),
898
- url: z23.string(),
910
+ roomId: z24.string().uuid()
911
+ });
912
+ var MessageAttachmentSchema = z24.object({
913
+ bucketName: z24.string(),
914
+ fileKey: z24.string(),
915
+ fileName: z24.string(),
916
+ fileSize: z24.number(),
917
+ url: z24.string(),
899
918
  fileType: MessageTypeSchema,
900
- thumbnailUrl: z23.string().optional()
919
+ thumbnailUrl: z24.string().optional()
901
920
  });
902
- var SendMessageSchema = z23.object({
903
- roomId: z23.string().uuid(),
921
+ var SendMessageSchema = z24.object({
922
+ roomId: z24.string().uuid(),
904
923
  messageType: MessageTypeSchema,
905
- message: z23.string().optional(),
924
+ message: z24.string().optional(),
906
925
  direction: MessageDirectionTypeSchema,
907
926
  messageAttachments: MessageAttachmentSchema.optional(),
908
- user: UserSchema.optional(),
909
- packageId: z23.number().optional(),
910
- stickerId: z23.number().optional()
927
+ user: UserSchema,
928
+ packageId: z24.number().optional(),
929
+ stickerId: z24.number().optional()
911
930
  });
912
- var SolveRoomSchema = z23.object({
913
- roomId: z23.string()
931
+ var SolveRoomSchema = z24.object({
932
+ roomId: z24.string()
914
933
  });
915
934
  var UpdateAssigneeSchema = SolveRoomSchema.extend({
916
- assigneeId: z23.string().uuid()
935
+ assigneeId: z24.string().uuid()
917
936
  });
918
937
  var SearchRoomsSchema = DefaultQueryParamsSchema.extend({
919
- query: z23.string()
938
+ query: z24.string()
920
939
  });
921
- var SendMessageToPlatformSchema = z23.object({
940
+ var SendMessageToPlatformSchema = z24.object({
922
941
  room: RoomSchema,
923
942
  message: MessageSchema,
924
- url: z23.string().optional()
943
+ url: z24.string().optional()
944
+ });
945
+ var SendMessageResponseSchema = DefaultSuccessResponseSchema.extend({
946
+ data: MessageSchema
925
947
  });
926
948
 
927
949
  // src/chat/index.ts
@@ -932,11 +954,11 @@ var mainChatContract = initContract6().router(
932
954
  path: "/rooms",
933
955
  responses: {
934
956
  200: DefaultSuccessResponseSchema.extend({
935
- total: z24.number(),
936
- page: z24.number(),
937
- pageSize: z24.number(),
938
- data: z24.array(RoomSchema),
939
- unreadCountsByAssignee: z24.array(UnreadCountsByAssigneeSchema)
957
+ total: z25.number(),
958
+ page: z25.number(),
959
+ pageSize: z25.number(),
960
+ data: z25.array(RoomSchema),
961
+ unreadCountsByAssignee: z25.array(UnreadCountsByAssigneeSchema)
940
962
  }),
941
963
  401: DefaultUnauthorizedSchema
942
964
  },
@@ -946,8 +968,8 @@ var mainChatContract = initContract6().router(
946
968
  getRoomContact: {
947
969
  method: "GET",
948
970
  path: "/contact/:contactId",
949
- pathParams: z24.object({
950
- contactId: z24.string().uuid()
971
+ pathParams: z25.object({
972
+ contactId: z25.string().uuid()
951
973
  }),
952
974
  responses: {
953
975
  200: DefaultSuccessResponseSchema.extend({
@@ -967,17 +989,6 @@ var mainChatContract = initContract6().router(
967
989
  },
968
990
  summary: "Update room attributes"
969
991
  },
970
- updateRoomTagsAndNotes: {
971
- method: "PATCH",
972
- path: "/room/:roomId",
973
- body: UpdateRoomAttributesSchema,
974
- responses: {
975
- 200: DefaultSuccessResponseSchema.extend({
976
- data: RoomSchema
977
- })
978
- },
979
- summary: "Update room tags and notes"
980
- },
981
992
  sendMessage: {
982
993
  method: "POST",
983
994
  path: "/message",
@@ -990,14 +1001,18 @@ var mainChatContract = initContract6().router(
990
1001
  getMessages: {
991
1002
  method: "GET",
992
1003
  path: "/message/:roomId",
993
- pathParams: z24.object({
994
- roomId: z24.string().uuid()
1004
+ pathParams: z25.object({
1005
+ roomId: z25.string().uuid()
995
1006
  }),
996
1007
  responses: {
997
1008
  200: DefaultSuccessResponseSchema.extend({
998
- data: z24.array(MessageSchema)
1009
+ total: z25.number(),
1010
+ page: z25.number(),
1011
+ pageSize: z25.number(),
1012
+ data: z25.array(MessageSchema)
999
1013
  })
1000
1014
  },
1015
+ query: DefaultQueryParamsSchema,
1001
1016
  summary: "Get messages"
1002
1017
  },
1003
1018
  solveRoom: {
@@ -1007,7 +1022,7 @@ var mainChatContract = initContract6().router(
1007
1022
  responses: {
1008
1023
  200: DefaultSuccessResponseSchema.extend({
1009
1024
  data: RoomSchema.extend({
1010
- solveMessage: z24.string()
1025
+ solveMessage: z25.string()
1011
1026
  })
1012
1027
  }),
1013
1028
  409: DefaultErrorResponseSchema
@@ -1028,8 +1043,8 @@ var mainChatContract = initContract6().router(
1028
1043
  getRoom: {
1029
1044
  method: "GET",
1030
1045
  path: "/room/:roomId",
1031
- pathParams: z24.object({
1032
- roomId: z24.string().uuid()
1046
+ pathParams: z25.object({
1047
+ roomId: z25.string().uuid()
1033
1048
  }),
1034
1049
  responses: {
1035
1050
  200: DefaultSuccessResponseSchema.extend({
@@ -1041,15 +1056,15 @@ var mainChatContract = initContract6().router(
1041
1056
  },
1042
1057
  createRoom: {
1043
1058
  method: "POST",
1044
- path: "/room/create/:roomid",
1045
- pathParams: z24.object({
1046
- roomId: z24.string().uuid()
1059
+ path: "/room/create/:platformContactId",
1060
+ pathParams: z25.object({
1061
+ platformContactId: z25.string().uuid()
1047
1062
  }),
1048
1063
  responses: {
1049
1064
  200: DefaultSuccessResponseSchema.extend({
1050
1065
  data: RoomSchema.extend({
1051
1066
  contact: ContactSchema,
1052
- openMessage: z24.string()
1067
+ openMessage: z25.string()
1053
1068
  })
1054
1069
  })
1055
1070
  },
@@ -1059,13 +1074,13 @@ var mainChatContract = initContract6().router(
1059
1074
  readRoom: {
1060
1075
  method: "POST",
1061
1076
  path: "/room/:roomid/read",
1062
- pathParams: z24.object({
1063
- roomId: z24.string().uuid()
1077
+ pathParams: z25.object({
1078
+ roomId: z25.string().uuid()
1064
1079
  }),
1065
1080
  responses: {
1066
1081
  200: DefaultSuccessResponseSchema.extend({
1067
1082
  data: RoomSchema.extend({
1068
- description: z24.string().nullable()
1083
+ description: z25.string().nullable()
1069
1084
  })
1070
1085
  })
1071
1086
  },
@@ -1077,10 +1092,10 @@ var mainChatContract = initContract6().router(
1077
1092
  path: "/search",
1078
1093
  responses: {
1079
1094
  200: DefaultSuccessResponseSchema.extend({
1080
- total: z24.number(),
1081
- page: z24.number(),
1082
- pageSize: z24.number(),
1083
- data: z24.array(RoomSchema)
1095
+ total: z25.number(),
1096
+ page: z25.number(),
1097
+ pageSize: z25.number(),
1098
+ data: z25.array(RoomSchema)
1084
1099
  })
1085
1100
  },
1086
1101
  query: SearchRoomsSchema,
@@ -1095,98 +1110,112 @@ var mainChatContract = initContract6().router(
1095
1110
 
1096
1111
  // src/contact/index.ts
1097
1112
  import { initContract as initContract7 } from "@ts-rest/core";
1098
- import z26 from "zod";
1113
+ import z27 from "zod";
1099
1114
 
1100
1115
  // src/contact/validation.ts
1101
- import z25 from "zod";
1102
- var BaseSchema = z25.object({
1103
- isRequired: z25.boolean(),
1104
- attributeId: z25.string()
1116
+ import z26 from "zod";
1117
+ var BaseSchema = z26.object({
1118
+ isRequired: z26.boolean(),
1119
+ attributeId: z26.string()
1105
1120
  });
1106
1121
  var SingleValue = {
1107
- value: z25.string()
1122
+ value: z26.string()
1108
1123
  };
1109
1124
  var ContactContractValidationSchema = {
1110
1125
  create: {
1111
- request: z25.object({
1126
+ request: z26.object({
1112
1127
  name: BaseSchema.extend(SingleValue),
1113
1128
  email: BaseSchema.extend({
1114
- value: z25.array(
1115
- z25.object({
1116
- email: z25.string(),
1117
- isPrimary: z25.boolean()
1129
+ value: z26.array(
1130
+ z26.object({
1131
+ email: z26.string(),
1132
+ isPrimary: z26.boolean()
1118
1133
  })
1119
1134
  )
1120
1135
  }),
1121
1136
  channel: BaseSchema.extend(SingleValue),
1122
1137
  address: BaseSchema.extend(SingleValue),
1123
1138
  phone: BaseSchema.extend({
1124
- value: z25.array(
1125
- z25.object({
1126
- phone: z25.string(),
1127
- isPrimary: z25.boolean()
1139
+ value: z26.array(
1140
+ z26.object({
1141
+ phone: z26.string(),
1142
+ isPrimary: z26.boolean()
1128
1143
  })
1129
1144
  )
1130
1145
  }).optional(),
1131
1146
  notes: BaseSchema.extend(SingleValue),
1132
1147
  tags: BaseSchema.extend({
1133
- value: z25.array(z25.string())
1148
+ value: z26.array(z26.string())
1134
1149
  }),
1135
1150
  company: BaseSchema.extend(SingleValue),
1136
- customFields: z25.array(
1151
+ customFields: z26.array(
1137
1152
  BaseSchema.extend({
1138
- value: z25.union([z25.string(), z25.array(z25.string())]),
1139
- type: z25.string(),
1140
- isDefaultAttribute: z25.boolean()
1153
+ value: z26.union([z26.string(), z26.array(z26.string())]),
1154
+ type: z26.string(),
1155
+ isDefaultAttribute: z26.boolean()
1141
1156
  })
1142
1157
  )
1143
1158
  }),
1144
- response: z25.string()
1159
+ response: z26.string()
1145
1160
  },
1146
1161
  getById: {
1147
- request: z25.object({
1148
- id: z25.string().uuid()
1162
+ request: z26.object({
1163
+ id: z26.string().uuid()
1149
1164
  }),
1150
1165
  response: ContactSchema
1151
1166
  },
1152
1167
  delete: {
1153
- request: z25.object({
1154
- id: z25.string().uuid()
1168
+ request: z26.object({
1169
+ id: z26.string().uuid()
1155
1170
  }),
1156
- response: z25.string()
1171
+ response: z26.string()
1157
1172
  },
1158
1173
  getAll: {
1159
- request: z25.object({
1160
- page: z25.coerce.number().default(1),
1161
- pageSize: z25.coerce.number().default(10),
1162
- keyword: z25.string().optional(),
1163
- company: z25.array(z25.string().uuid()),
1164
- name: z25.string(),
1165
- address: z25.string(),
1166
- channel: z25.array(z25.string()),
1167
- selectedDate: z25.string(),
1168
- customFields: z25.array(
1169
- z25.object({
1170
- attributeId: z25.string().uuid(),
1171
- type: z25.string(),
1172
- value: z25.union([z25.string(), z25.array(z25.string())])
1174
+ request: z26.object({
1175
+ page: z26.coerce.number().default(1),
1176
+ pageSize: z26.coerce.number().default(10),
1177
+ keyword: z26.string().optional(),
1178
+ company: z26.array(z26.string().uuid()),
1179
+ name: z26.string(),
1180
+ address: z26.string(),
1181
+ channel: z26.array(z26.string()),
1182
+ selectedDate: z26.string(),
1183
+ customFields: z26.array(
1184
+ z26.object({
1185
+ attributeId: z26.string().uuid(),
1186
+ type: z26.string(),
1187
+ value: z26.union([z26.string(), z26.array(z26.string())])
1173
1188
  })
1174
1189
  ),
1175
- tags: z25.array(z25.string().uuid()),
1176
- phone: z25.string(),
1177
- email: z25.string(),
1178
- notes: z25.string()
1190
+ tags: z26.array(z26.string().uuid()),
1191
+ phone: z26.string(),
1192
+ email: z26.string(),
1193
+ notes: z26.string()
1179
1194
  }).partial(),
1180
1195
  response: {
1181
- page: z25.number(),
1182
- pageSize: z25.number(),
1183
- total: z25.number(),
1184
- data: z25.array(ContactSchema)
1196
+ page: z26.number(),
1197
+ pageSize: z26.number(),
1198
+ total: z26.number(),
1199
+ data: z26.array(ContactSchema)
1185
1200
  }
1186
1201
  },
1187
1202
  createContactByPhone: {
1188
- request: z25.object({
1189
- phoneNumber: z25.string().refine(
1203
+ request: z26.object({
1204
+ phoneNumber: z26.string().refine(
1205
+ (value) => {
1206
+ const numericValue = value.replace(/\s/g, "");
1207
+ return /^\d+$/.test(numericValue);
1208
+ },
1209
+ {
1210
+ message: "Phone number must contain only numeric characters"
1211
+ }
1212
+ )
1213
+ }),
1214
+ response: ContactSchema
1215
+ },
1216
+ updateContactByPhone: {
1217
+ request: z26.object({
1218
+ phoneNumber: z26.string().refine(
1190
1219
  (value) => {
1191
1220
  const numericValue = value.replace(/\s/g, "");
1192
1221
  return /^\d+$/.test(numericValue);
@@ -1197,6 +1226,46 @@ var ContactContractValidationSchema = {
1197
1226
  )
1198
1227
  }),
1199
1228
  response: ContactSchema
1229
+ },
1230
+ updateFromOngoingCall: {
1231
+ request: z26.object({
1232
+ name: z26.string(),
1233
+ companyId: z26.string().uuid()
1234
+ }).partial(),
1235
+ response: ContactSchema
1236
+ },
1237
+ merge: {
1238
+ request: z26.object({
1239
+ primaryContactId: z26.string().uuid(),
1240
+ emails: z26.array(
1241
+ z26.object({
1242
+ email: z26.string(),
1243
+ isPrimary: z26.boolean()
1244
+ })
1245
+ ),
1246
+ phones: z26.array(
1247
+ z26.object({
1248
+ phone: z26.string(),
1249
+ isPrimary: z26.boolean()
1250
+ })
1251
+ ),
1252
+ otherContacts: z26.array(z26.string().uuid())
1253
+ }),
1254
+ response: ContactSchema
1255
+ },
1256
+ checkContactPhone: {
1257
+ request: z26.object({
1258
+ contactId: z26.string().uuid().optional(),
1259
+ phoneNumber: z26.string()
1260
+ }),
1261
+ response: z26.boolean()
1262
+ },
1263
+ checkContactEmail: {
1264
+ request: z26.object({
1265
+ contactId: z26.string().uuid().optional(),
1266
+ email: z26.string()
1267
+ }),
1268
+ response: z26.boolean()
1200
1269
  }
1201
1270
  };
1202
1271
 
@@ -1210,14 +1279,14 @@ var contactContract = initContract7().router(
1210
1279
  201: DefaultSuccessResponseSchema.extend({
1211
1280
  message: ContactContractValidationSchema.create.response
1212
1281
  }),
1213
- 400: z26.object({
1214
- message: z26.string()
1282
+ 400: z27.object({
1283
+ message: z27.string()
1215
1284
  }),
1216
- 409: z26.object({
1217
- message: z26.string()
1285
+ 409: z27.object({
1286
+ message: z27.string()
1218
1287
  }),
1219
- 500: z26.object({
1220
- message: z26.string()
1288
+ 500: z27.object({
1289
+ message: z27.string()
1221
1290
  }),
1222
1291
  401: DefaultUnauthorizedSchema,
1223
1292
  404: DefaultNotFoundSchema,
@@ -1234,14 +1303,14 @@ var contactContract = initContract7().router(
1234
1303
  200: DefaultSuccessResponseSchema.extend({
1235
1304
  data: ContactContractValidationSchema.getById.response
1236
1305
  }),
1237
- 400: z26.object({
1238
- message: z26.string()
1306
+ 400: z27.object({
1307
+ message: z27.string()
1239
1308
  }),
1240
- 409: z26.object({
1241
- message: z26.string()
1309
+ 409: z27.object({
1310
+ message: z27.string()
1242
1311
  }),
1243
- 500: z26.object({
1244
- message: z26.string()
1312
+ 500: z27.object({
1313
+ message: z27.string()
1245
1314
  }),
1246
1315
  401: DefaultUnauthorizedSchema,
1247
1316
  404: DefaultNotFoundSchema,
@@ -1257,14 +1326,14 @@ var contactContract = initContract7().router(
1257
1326
  200: DefaultSuccessResponseSchema.extend(
1258
1327
  ContactContractValidationSchema.getAll.response
1259
1328
  ),
1260
- 400: z26.object({
1261
- message: z26.string()
1329
+ 400: z27.object({
1330
+ message: z27.string()
1262
1331
  }),
1263
- 409: z26.object({
1264
- message: z26.string()
1332
+ 409: z27.object({
1333
+ message: z27.string()
1265
1334
  }),
1266
- 500: z26.object({
1267
- message: z26.string()
1335
+ 500: z27.object({
1336
+ message: z27.string()
1268
1337
  }),
1269
1338
  401: DefaultUnauthorizedSchema,
1270
1339
  404: DefaultNotFoundSchema,
@@ -1280,14 +1349,14 @@ var contactContract = initContract7().router(
1280
1349
  200: DefaultSuccessResponseSchema.extend({
1281
1350
  data: ContactContractValidationSchema.getById.response
1282
1351
  }),
1283
- 400: z26.object({
1284
- message: z26.string()
1352
+ 400: z27.object({
1353
+ message: z27.string()
1285
1354
  }),
1286
- 409: z26.object({
1287
- message: z26.string()
1355
+ 409: z27.object({
1356
+ message: z27.string()
1288
1357
  }),
1289
- 500: z26.object({
1290
- message: z26.string()
1358
+ 500: z27.object({
1359
+ message: z27.string()
1291
1360
  }),
1292
1361
  401: DefaultUnauthorizedSchema,
1293
1362
  404: DefaultNotFoundSchema,
@@ -1304,14 +1373,14 @@ var contactContract = initContract7().router(
1304
1373
  200: DefaultSuccessResponseSchema.extend({
1305
1374
  message: ContactContractValidationSchema.delete.response
1306
1375
  }),
1307
- 400: z26.object({
1308
- message: z26.string()
1376
+ 400: z27.object({
1377
+ message: z27.string()
1309
1378
  }),
1310
- 409: z26.object({
1311
- message: z26.string()
1379
+ 409: z27.object({
1380
+ message: z27.string()
1312
1381
  }),
1313
- 500: z26.object({
1314
- message: z26.string()
1382
+ 500: z27.object({
1383
+ message: z27.string()
1315
1384
  }),
1316
1385
  401: DefaultUnauthorizedSchema,
1317
1386
  404: DefaultNotFoundSchema,
@@ -1327,14 +1396,14 @@ var contactContract = initContract7().router(
1327
1396
  201: DefaultSuccessResponseSchema.extend({
1328
1397
  data: ContactContractValidationSchema.createContactByPhone.response
1329
1398
  }),
1330
- 400: z26.object({
1331
- message: z26.string()
1399
+ 400: z27.object({
1400
+ message: z27.string()
1332
1401
  }),
1333
- 409: z26.object({
1334
- message: z26.string()
1402
+ 409: z27.object({
1403
+ message: z27.string()
1335
1404
  }),
1336
- 500: z26.object({
1337
- message: z26.string()
1405
+ 500: z27.object({
1406
+ message: z27.string()
1338
1407
  }),
1339
1408
  401: DefaultUnauthorizedSchema,
1340
1409
  404: DefaultNotFoundSchema,
@@ -1342,6 +1411,98 @@ var contactContract = initContract7().router(
1342
1411
  },
1343
1412
  body: ContactContractValidationSchema.createContactByPhone.request,
1344
1413
  summary: "Create a new contact using phone number"
1414
+ },
1415
+ updateFromOngoingCall: {
1416
+ method: "PATCH",
1417
+ path: "/:id/ongoing",
1418
+ responses: {
1419
+ 201: DefaultSuccessResponseSchema.extend({
1420
+ data: ContactContractValidationSchema.updateFromOngoingCall.response
1421
+ }),
1422
+ 400: z27.object({
1423
+ message: z27.string()
1424
+ }),
1425
+ 409: z27.object({
1426
+ message: z27.string()
1427
+ }),
1428
+ 500: z27.object({
1429
+ message: z27.string()
1430
+ }),
1431
+ 401: DefaultUnauthorizedSchema,
1432
+ 404: DefaultNotFoundSchema,
1433
+ 422: DefaultUnprocessibleSchema
1434
+ },
1435
+ body: ContactContractValidationSchema.updateFromOngoingCall.request,
1436
+ summary: "Update a contact with name and company while making ongoing call"
1437
+ },
1438
+ merge: {
1439
+ method: "POST",
1440
+ path: "/merge",
1441
+ responses: {
1442
+ 200: DefaultSuccessResponseSchema.extend({
1443
+ data: ContactContractValidationSchema.merge.response
1444
+ }),
1445
+ 400: z27.object({
1446
+ message: z27.string()
1447
+ }),
1448
+ 409: z27.object({
1449
+ message: z27.string()
1450
+ }),
1451
+ 500: z27.object({
1452
+ message: z27.string()
1453
+ }),
1454
+ 401: DefaultUnauthorizedSchema,
1455
+ 404: DefaultNotFoundSchema,
1456
+ 422: DefaultUnprocessibleSchema
1457
+ },
1458
+ body: ContactContractValidationSchema.merge.request,
1459
+ summary: "Merge contacts into a single contact."
1460
+ },
1461
+ checkContactPhone: {
1462
+ method: "POST",
1463
+ path: "/check/phone",
1464
+ responses: {
1465
+ 200: DefaultSuccessResponseSchema.extend({
1466
+ existed: ContactContractValidationSchema.checkContactPhone.response
1467
+ }),
1468
+ 400: z27.object({
1469
+ message: z27.string()
1470
+ }),
1471
+ 409: z27.object({
1472
+ message: z27.string()
1473
+ }),
1474
+ 500: z27.object({
1475
+ message: z27.string()
1476
+ }),
1477
+ 401: DefaultUnauthorizedSchema,
1478
+ 404: DefaultNotFoundSchema,
1479
+ 422: DefaultUnprocessibleSchema
1480
+ },
1481
+ body: ContactContractValidationSchema.checkContactPhone.request,
1482
+ summary: "Check whether a contact owns a phone number"
1483
+ },
1484
+ checkContactEmail: {
1485
+ method: "POST",
1486
+ path: "/check/email",
1487
+ responses: {
1488
+ 200: DefaultSuccessResponseSchema.extend({
1489
+ existed: ContactContractValidationSchema.checkContactEmail.response
1490
+ }),
1491
+ 400: z27.object({
1492
+ message: z27.string()
1493
+ }),
1494
+ 409: z27.object({
1495
+ message: z27.string()
1496
+ }),
1497
+ 500: z27.object({
1498
+ message: z27.string()
1499
+ }),
1500
+ 401: DefaultUnauthorizedSchema,
1501
+ 404: DefaultNotFoundSchema,
1502
+ 422: DefaultUnprocessibleSchema
1503
+ },
1504
+ body: ContactContractValidationSchema.checkContactEmail.request,
1505
+ summary: "Check whether a contact owns a email"
1345
1506
  }
1346
1507
  },
1347
1508
  {
@@ -1354,23 +1515,6 @@ var contactContract = initContract7().router(
1354
1515
  import { initContract as initContract8 } from "@ts-rest/core";
1355
1516
  import z29 from "zod";
1356
1517
 
1357
- // src/cx-log/schema.ts
1358
- import z27 from "zod";
1359
- var CxLogSchema = DefaultEntitySchema.extend({
1360
- caseId: z27.number(),
1361
- entityId: z27.string().uuid(),
1362
- entityName: z27.string(),
1363
- contactId: z27.string().uuid().nullable(),
1364
- channel: z27.string().nullable(),
1365
- queueId: z27.string().uuid().nullable(),
1366
- agentId: z27.string().uuid().nullable(),
1367
- direction: z27.string().nullable(),
1368
- startedDate: z27.date().nullable(),
1369
- handledTime: z27.number().nullable(),
1370
- firstResponseTime: z27.number().nullable(),
1371
- disposition: z27.string().nullable()
1372
- });
1373
-
1374
1518
  // src/cx-log/validation.ts
1375
1519
  import z28 from "zod";
1376
1520
  var sentimentScoreSchema = z28.union([
@@ -2255,7 +2399,8 @@ var messengerContract = initContract17().router({
2255
2399
  path: "/message",
2256
2400
  body: SendMessageToPlatformSchema,
2257
2401
  responses: {
2258
- 200: DefaultSuccessResponseSchema
2402
+ 200: SendMessageResponseSchema,
2403
+ 500: DefaultErrorResponseSchema
2259
2404
  }
2260
2405
  }
2261
2406
  }, {