@burgan-tech/morph-touch-runtime 0.0.2

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 (244) hide show
  1. package/LICENSE +21 -0
  2. package/burgan-tech-morph-touch-runtime-0.0.2.tgz +0 -0
  3. package/package.json +21 -0
  4. package/touch/Extensions/.gitkeep +0 -0
  5. package/touch/Functions/.gitkeep +0 -0
  6. package/touch/Functions/check-livekit-room-access.1.0.0.json +28 -0
  7. package/touch/Functions/check-livekit-room-access.http +44 -0
  8. package/touch/Functions/get-absence-entry.1.0.0.json +28 -0
  9. package/touch/Functions/get-advisor-stats.1.0.0.json +27 -0
  10. package/touch/Functions/get-available-slots.1.0.0.json +30 -0
  11. package/touch/Functions/get-available-slots.http +29 -0
  12. package/touch/Functions/get-chat-rooms.1.0.0.json +28 -0
  13. package/touch/Functions/get-chat-rooms.http +62 -0
  14. package/touch/Functions/get-customer-info.1.0.0.json +27 -0
  15. package/touch/Functions/get-matrix-sync.1.0.0.json +28 -0
  16. package/touch/Functions/get-rezervations.1.0.0.json +26 -0
  17. package/touch/Functions/get-rezervations.http +59 -0
  18. package/touch/Functions/get-room-messages.1.0.0.json +29 -0
  19. package/touch/Functions/get-room-messages.http +45 -0
  20. package/touch/Functions/rezervation-transfer.http +118 -0
  21. package/touch/Functions/send-room-message.1.0.0.json +29 -0
  22. package/touch/Functions/src/CheckLivekitRoomAccessMapping.csx +238 -0
  23. package/touch/Functions/src/GetAbsenceEntryMapping.csx +225 -0
  24. package/touch/Functions/src/GetAdvisorStatsMapping.csx +190 -0
  25. package/touch/Functions/src/GetAvailableSlotsMapping.csx +468 -0
  26. package/touch/Functions/src/GetChatRoomsMapping.csx +202 -0
  27. package/touch/Functions/src/GetCustomerInfoMapping.csx +140 -0
  28. package/touch/Functions/src/GetMatrixSyncMapping.csx +197 -0
  29. package/touch/Functions/src/GetRezervationsMapping.csx +162 -0
  30. package/touch/Functions/src/GetRoomMessagesMapping.csx +165 -0
  31. package/touch/Functions/src/SendCancelNotificationMapping.csx +63 -0
  32. package/touch/Functions/src/SendRoomMessageMapping.csx +131 -0
  33. package/touch/Schemas/.gitkeep +0 -0
  34. package/touch/Schemas/absence-entry.1.0.0.json +232 -0
  35. package/touch/Schemas/advisor-chat-rooms.1.0.0.json +62 -0
  36. package/touch/Schemas/chat-room.1.0.0.json +110 -0
  37. package/touch/Schemas/notification-sender.1.0.0.json +159 -0
  38. package/touch/Schemas/portfolio-manager.1.0.0.json +63 -0
  39. package/touch/Schemas/rezervation.1.0.0.json +102 -0
  40. package/touch/Tasks/.gitkeep +0 -0
  41. package/touch/Tasks/cancel-absence-entry-for-rezervation.1.0.0.json +21 -0
  42. package/touch/Tasks/check-already-completed-chat-room.1.0.0.json +24 -0
  43. package/touch/Tasks/check-duplicate-portfolio-manager.1.0.0.json +23 -0
  44. package/touch/Tasks/check-duplicate-rezervation.1.0.0.json +23 -0
  45. package/touch/Tasks/check-existing-permanent-chat-room.1.0.0.json +21 -0
  46. package/touch/Tasks/check-randevu-time.1.0.0.json +17 -0
  47. package/touch/Tasks/create-permanent-chat-room.1.0.0.json +28 -0
  48. package/touch/Tasks/determine-transfer-type.1.0.0.json +16 -0
  49. package/touch/Tasks/enrich-rezervations-for-transfer.1.0.0.json +23 -0
  50. package/touch/Tasks/execute-permanent-chatroom-update.1.0.0.json +21 -0
  51. package/touch/Tasks/execute-rez-chatroom-transfer.1.0.0.json +21 -0
  52. package/touch/Tasks/execute-rezervation-transfer.1.0.0.json +19 -0
  53. package/touch/Tasks/fetch-absence-entries-for-transfer.1.0.0.json +23 -0
  54. package/touch/Tasks/fetch-advisors-for-transfer.1.0.0.json +23 -0
  55. package/touch/Tasks/fetch-permanent-chatrooms-for-transfer.1.0.0.json +23 -0
  56. package/touch/Tasks/fetch-rez-chatrooms-for-transfer.1.0.0.json +23 -0
  57. package/touch/Tasks/fetch-rezervations-for-transfer.1.0.0.json +22 -0
  58. package/touch/Tasks/get-absence-entry-task.1.0.0.json +23 -0
  59. package/touch/Tasks/get-available-slots-http.1.0.0.json +27 -0
  60. package/touch/Tasks/get-available-slots.1.0.0.json +24 -0
  61. package/touch/Tasks/get-chat-room-data-for-rezervation.1.0.0.json +23 -0
  62. package/touch/Tasks/get-chat-token.1.0.0.json +27 -0
  63. package/touch/Tasks/get-matrix-room-messages.1.0.0.json +25 -0
  64. package/touch/Tasks/get-matrix-sync.1.0.0.json +25 -0
  65. package/touch/Tasks/get-rezervation-data-task.1.0.0.json +22 -0
  66. package/touch/Tasks/get-rezervation-state-task.1.0.0.json +22 -0
  67. package/touch/Tasks/get-rezervations-task.1.0.0.json +21 -0
  68. package/touch/Tasks/get-user-info-for-rezervation.1.0.0.json +24 -0
  69. package/touch/Tasks/get-video-call-url.1.0.0.json +17 -0
  70. package/touch/Tasks/invite-user-to-rezervation-room.1.0.0.json +27 -0
  71. package/touch/Tasks/join-chat-room-for-rezervation.1.0.0.json +28 -0
  72. package/touch/Tasks/join-matrix-room.1.0.0.json +27 -0
  73. package/touch/Tasks/join-user-to-room.1.0.0.json +27 -0
  74. package/touch/Tasks/merge-invited-user.1.0.0.json +17 -0
  75. package/touch/Tasks/merge-rezervation-update.1.0.0.json +16 -0
  76. package/touch/Tasks/merge-target-advisor-for-transfer.1.0.0.json +17 -0
  77. package/touch/Tasks/merge-update-body-for-randevu-update.1.0.0.json +16 -0
  78. package/touch/Tasks/merge-video-call-urls.1.0.0.json +17 -0
  79. package/touch/Tasks/query-chat-room-instances.1.0.0.json +23 -0
  80. package/touch/Tasks/remove-member-from-room.1.0.0.json +28 -0
  81. package/touch/Tasks/send-matrix-room-message.1.0.0.json +26 -0
  82. package/touch/Tasks/send-push-notification.1.0.0.json +26 -0
  83. package/touch/Tasks/send-sms-notification.1.0.0.json +26 -0
  84. package/touch/Tasks/set-chat-room-status-active.1.0.0.json +16 -0
  85. package/touch/Tasks/set-chat-room-status-deactive.1.0.0.json +16 -0
  86. package/touch/Tasks/set-previous-advisor.1.0.0.json +16 -0
  87. package/touch/Tasks/set-user-from-headers-for-rezervation.1.0.0.json +17 -0
  88. package/touch/Tasks/start-absence-entry-for-rezervation.1.0.0.json +21 -0
  89. package/touch/Tasks/start-chat-room-for-rezervation.1.0.0.json +20 -0
  90. package/touch/Tasks/start-notification-sender.1.0.0.json +20 -0
  91. package/touch/Tasks/start-permanent-chat-room.1.0.0.json +21 -0
  92. package/touch/Tasks/start-transfer-from-absence-entry.1.0.0.json +19 -0
  93. package/touch/Tasks/start-video-call.1.0.0.json +22 -0
  94. package/touch/Tasks/trigger-chat-room-deactivate.1.0.0.json +21 -0
  95. package/touch/Tasks/trigger-chat-room-transfer.1.0.0.json +21 -0
  96. package/touch/Tasks/trigger-chat-room-update.1.0.0.json +20 -0
  97. package/touch/Tasks/trigger-rezervation-add-invited-participant.1.0.0.json +20 -0
  98. package/touch/Tasks/trigger-rezervation-apply-update.1.0.0.json +20 -0
  99. package/touch/Tasks/trigger-rezervation-to-in-meet.1.0.0.json +20 -0
  100. package/touch/Tasks/trigger-rezervation-video-call-update.1.0.0.json +21 -0
  101. package/touch/Tasks/validate-date-for-rezervation.1.0.0.json +18 -0
  102. package/touch/Tasks/validate-slot-for-rezervation.1.0.0.json +24 -0
  103. package/touch/Tasks/validate-transfer-availability.1.0.0.json +23 -0
  104. package/touch/Views/.gitkeep +0 -0
  105. package/touch/Workflows/.gitkeep +0 -0
  106. package/touch/Workflows/absence-entry.http +458 -0
  107. package/touch/Workflows/absence-entry.json +179 -0
  108. package/touch/Workflows/add-participant-to-rezervation.http +47 -0
  109. package/touch/Workflows/add-participant-to-rezervation.json +340 -0
  110. package/touch/Workflows/chat-room.http +207 -0
  111. package/touch/Workflows/chat-room.json +452 -0
  112. package/touch/Workflows/investment-advisor.json +367 -0
  113. package/touch/Workflows/notification-sender.http +299 -0
  114. package/touch/Workflows/notification-sender.json +262 -0
  115. package/touch/Workflows/portfolio-manager.json +367 -0
  116. package/touch/Workflows/randevu-update.http +87 -0
  117. package/touch/Workflows/rezervation-start.json +467 -0
  118. package/touch/Workflows/rezervation-transfer.json +512 -0
  119. package/touch/Workflows/rezervation-update.http +87 -0
  120. package/touch/Workflows/rezervation-update.json +485 -0
  121. package/touch/Workflows/rezervation.http +214 -0
  122. package/touch/Workflows/rezervation.json +726 -0
  123. package/touch/Workflows/src/AllChatRoomsSuccessRule.csx +65 -0
  124. package/touch/Workflows/src/AlwaysTrueRule.csx +13 -0
  125. package/touch/Workflows/src/AnyChatRoomFailedRule.csx +64 -0
  126. package/touch/Workflows/src/AutoProcessRule.csx +38 -0
  127. package/touch/Workflows/src/BuildRezChatRoomPlanMapping.csx +160 -0
  128. package/touch/Workflows/src/CanStartRezervationTimerMapping.csx +48 -0
  129. package/touch/Workflows/src/CanStartTransferMapping.csx +14 -0
  130. package/touch/Workflows/src/CancelAbsenceEntryForRezervationMapping.csx +48 -0
  131. package/touch/Workflows/src/CancelAbsenceForRandevuUpdateMapping.csx +62 -0
  132. package/touch/Workflows/src/ChatRoomCreatedFailedRule.csx +54 -0
  133. package/touch/Workflows/src/ChatRoomCreatedSuccessRule.csx +54 -0
  134. package/touch/Workflows/src/ChatRoomRemoveMapping.csx +104 -0
  135. package/touch/Workflows/src/ChatRoomTransferInviteMapping.csx +109 -0
  136. package/touch/Workflows/src/ChatRoomTransferRemoveMapping.csx +71 -0
  137. package/touch/Workflows/src/ChatRoomUpdateMapping.csx +107 -0
  138. package/touch/Workflows/src/CheckAlreadyCompletedChatRoomMapping.csx +100 -0
  139. package/touch/Workflows/src/CheckDuplicatePortfolioManagerMapping.csx +119 -0
  140. package/touch/Workflows/src/CheckDuplicateRezervationMapping.csx +150 -0
  141. package/touch/Workflows/src/CheckExistingPermanentChatRoomMapping.csx +169 -0
  142. package/touch/Workflows/src/CheckRandevuTimeMapping.csx +67 -0
  143. package/touch/Workflows/src/CheckRezervationStateActiveOrInMeetRule.csx +14 -0
  144. package/touch/Workflows/src/CreateAbsenceEntryForRezervationMapping.csx +111 -0
  145. package/touch/Workflows/src/CreateAbsenceForRandevuUpdateMapping.csx +108 -0
  146. package/touch/Workflows/src/CreateChatRoomForRezervationMapping.csx +122 -0
  147. package/touch/Workflows/src/CreatePermanentChatRoomMapping.csx +140 -0
  148. package/touch/Workflows/src/CustomerControlToEndRule.csx +14 -0
  149. package/touch/Workflows/src/DetermineTransferTypeMapping.csx +92 -0
  150. package/touch/Workflows/src/EnrichRezervationsForTransferMapping.csx +495 -0
  151. package/touch/Workflows/src/ExecutePermanentChatRoomUpdateMapping.csx +124 -0
  152. package/touch/Workflows/src/ExecuteRezChatRoomTransferMapping.csx +95 -0
  153. package/touch/Workflows/src/ExecuteTransferMapping.csx +152 -0
  154. package/touch/Workflows/src/FetchAbsenceEntriesForTransferMapping.csx +116 -0
  155. package/touch/Workflows/src/FetchAdvisorsForTransferMapping.csx +145 -0
  156. package/touch/Workflows/src/FetchPermanentChatRoomsMapping.csx +128 -0
  157. package/touch/Workflows/src/FetchRezervationsForTransferMapping.csx +124 -0
  158. package/touch/Workflows/src/GetChatRoomDataForRezervationMapping.csx +100 -0
  159. package/touch/Workflows/src/GetChatTokenMapping.csx +85 -0
  160. package/touch/Workflows/src/GetRezervationDataForAddParticipantMapping.csx +105 -0
  161. package/touch/Workflows/src/GetRezervationDataForRandevuUpdateMapping.csx +110 -0
  162. package/touch/Workflows/src/GetRezervationDataMapping.csx +111 -0
  163. package/touch/Workflows/src/GetRezervationStateForRandevuUpdateMapping.csx +80 -0
  164. package/touch/Workflows/src/GetRezervationStateMapping.csx +92 -0
  165. package/touch/Workflows/src/GetUserInfoForRezervationMapping.csx +63 -0
  166. package/touch/Workflows/src/GetVideoCallUrlMapping.csx +62 -0
  167. package/touch/Workflows/src/HasChangedAdvisorRule.csx +28 -0
  168. package/touch/Workflows/src/HasChatIntegrationRule.csx +41 -0
  169. package/touch/Workflows/src/HasExistingPermanentRoomRule.csx +28 -0
  170. package/touch/Workflows/src/InviteAdvisorForRandevuUpdateMapping.csx +86 -0
  171. package/touch/Workflows/src/InviteNewAdvisorToRezervationRoomMapping.csx +78 -0
  172. package/touch/Workflows/src/InviteNewParticipantToRandevuRoomMapping.csx +88 -0
  173. package/touch/Workflows/src/InvitedUserMergeMapping.csx +77 -0
  174. package/touch/Workflows/src/InvitedUserNotAllowedRule.csx +71 -0
  175. package/touch/Workflows/src/InvitedUserNotInMeetRule.csx +19 -0
  176. package/touch/Workflows/src/IsNotfSentRule.csx +36 -0
  177. package/touch/Workflows/src/JoinChatRoomForAddParticipantMapping.csx +118 -0
  178. package/touch/Workflows/src/JoinChatRoomForRandevuStartMapping.csx +119 -0
  179. package/touch/Workflows/src/JoinChatRoomForRezervationMapping.csx +118 -0
  180. package/touch/Workflows/src/JoinMatrixRoomMapping.csx +100 -0
  181. package/touch/Workflows/src/JoinUserToRoomMapping.csx +118 -0
  182. package/touch/Workflows/src/LoginForAddParticipantChatMapping.csx +102 -0
  183. package/touch/Workflows/src/LoginForRandevuStartChatMapping.csx +96 -0
  184. package/touch/Workflows/src/MergeRezervationUpdateMapping.csx +82 -0
  185. package/touch/Workflows/src/MergeTargetAdvisorForTransferMapping.csx +79 -0
  186. package/touch/Workflows/src/MergeUpdateBodyForRandevuUpdateMapping.csx +91 -0
  187. package/touch/Workflows/src/NoExistingPermanentRoomRule.csx +23 -0
  188. package/touch/Workflows/src/NotificationCompleteAlwaysRule.csx +14 -0
  189. package/touch/Workflows/src/NotificationCompleteFromPendingRule.csx +41 -0
  190. package/touch/Workflows/src/NotificationCompleteFromSmsRule.csx +36 -0
  191. package/touch/Workflows/src/NotificationPushFromPendingRule.csx +42 -0
  192. package/touch/Workflows/src/NotificationPushFromSmsRule.csx +36 -0
  193. package/touch/Workflows/src/NotificationSmsPendingRule.csx +32 -0
  194. package/touch/Workflows/src/PermanentDoneRule.csx +44 -0
  195. package/touch/Workflows/src/PermanentProcessNextRule.csx +44 -0
  196. package/touch/Workflows/src/RezChatRoomProcessNextRule.csx +44 -0
  197. package/touch/Workflows/src/RezChatRoomsDoneRule.csx +44 -0
  198. package/touch/Workflows/src/SendPushNotificationMapping.csx +146 -0
  199. package/touch/Workflows/src/SendSmsNotificationMapping.csx +138 -0
  200. package/touch/Workflows/src/SetChatRoomStatusActiveMapping.csx +22 -0
  201. package/touch/Workflows/src/SetChatRoomStatusDeactiveMapping.csx +22 -0
  202. package/touch/Workflows/src/SetPreviousAdvisorMapping.csx +28 -0
  203. package/touch/Workflows/src/SetUserFromHeadersForRezervationMapping.csx +24 -0
  204. package/touch/Workflows/src/SlotAvailableRule.csx +33 -0
  205. package/touch/Workflows/src/SlotUnavailableRule.csx +33 -0
  206. package/touch/Workflows/src/StartChatRoomForRezervationMapping.csx +100 -0
  207. package/touch/Workflows/src/StartGetChatTokenForRezervationMapping.csx +71 -0
  208. package/touch/Workflows/src/StartNotificationForAdvisorMapping.csx +117 -0
  209. package/touch/Workflows/src/StartNotificationForRezervationFromUserInfoMapping.csx +128 -0
  210. package/touch/Workflows/src/StartNotificationForUserMapping.csx +117 -0
  211. package/touch/Workflows/src/StartPermanentChatRoomMapping.csx +92 -0
  212. package/touch/Workflows/src/StartTransferFromAbsenceEntryMapping.csx +94 -0
  213. package/touch/Workflows/src/StartVideoCallCustomerSubFlowMapping.csx +37 -0
  214. package/touch/Workflows/src/StartVideoCallForInvitedParticipantMapping.csx +54 -0
  215. package/touch/Workflows/src/StartVideoCallForRandevuStartMapping.csx +70 -0
  216. package/touch/Workflows/src/StartVideoCallStaffSubFlowMapping.csx +37 -0
  217. package/touch/Workflows/src/StateActiveForUpdateRule.csx +14 -0
  218. package/touch/Workflows/src/StateActiveRule.csx +14 -0
  219. package/touch/Workflows/src/StateInMeetRule.csx +14 -0
  220. package/touch/Workflows/src/StateNotActiveForUpdateRule.csx +14 -0
  221. package/touch/Workflows/src/StateNotActiveOrInMeetRule.csx +14 -0
  222. package/touch/Workflows/src/StatusCustomerEnterRule.csx +25 -0
  223. package/touch/Workflows/src/StatusStaffEnterRule.csx +25 -0
  224. package/touch/Workflows/src/SyncWorkingHoursRule.csx +46 -0
  225. package/touch/Workflows/src/TokenSuccessRule.csx +24 -0
  226. package/touch/Workflows/src/TransferAllDoneRule.csx +50 -0
  227. package/touch/Workflows/src/TransferHasInvalidRule.csx +34 -0
  228. package/touch/Workflows/src/TransferProcessNextRule.csx +50 -0
  229. package/touch/Workflows/src/TriggerChatRoomDeactivateMapping.csx +77 -0
  230. package/touch/Workflows/src/TriggerChatRoomTransferMapping.csx +93 -0
  231. package/touch/Workflows/src/TriggerChatRoomUpdateMapping.csx +99 -0
  232. package/touch/Workflows/src/TriggerRezervationAddInvitedParticipantMapping.csx +77 -0
  233. package/touch/Workflows/src/TriggerRezervationApplyUpdateMapping.csx +66 -0
  234. package/touch/Workflows/src/TriggerRezervationToInMeetMapping.csx +69 -0
  235. package/touch/Workflows/src/TriggerRezervationVideoCallUpdateMapping.csx +67 -0
  236. package/touch/Workflows/src/ValidateDateForRezervationMapping.csx +60 -0
  237. package/touch/Workflows/src/ValidateSlotForRandevuUpdateMapping.csx +211 -0
  238. package/touch/Workflows/src/ValidateSlotForRezervationMapping.csx +246 -0
  239. package/touch/Workflows/src/ValidateTransferMapping.csx +243 -0
  240. package/touch/Workflows/src/VideoCallUrlUpdateMergeMapping.csx +141 -0
  241. package/touch/Workflows/start-chat.json +217 -0
  242. package/touch/Workflows/start-video-call.http +93 -0
  243. package/touch/Workflows/start-video-call.json +206 -0
  244. package/vnext.config.json +58 -0
@@ -0,0 +1,33 @@
1
+ using System;
2
+ using System.Threading.Tasks;
3
+ using BBT.Workflow.Scripting;
4
+
5
+ /// <summary>
6
+ /// Condition mapping for slot-available auto transition in rezervation validating state.
7
+ /// Rule: slotCheckResult != null AND slotCheckResult.available == true
8
+ /// </summary>
9
+ public class SlotAvailableRule : ScriptBase, IConditionMapping
10
+ {
11
+ public Task<bool> Handler(ScriptContext context)
12
+ {
13
+ try
14
+ {
15
+ if (context?.Instance?.Data == null)
16
+ return Task.FromResult(false);
17
+
18
+ var data = context.Instance.Data;
19
+ if (!HasProperty(data, "slotCheckResult") || data.slotCheckResult == null)
20
+ return Task.FromResult(false);
21
+
22
+ var slotCheckResult = data.slotCheckResult;
23
+ if (!HasProperty(slotCheckResult, "available"))
24
+ return Task.FromResult(false);
25
+
26
+ return Task.FromResult(slotCheckResult.available == true);
27
+ }
28
+ catch (Exception)
29
+ {
30
+ return Task.FromResult(false);
31
+ }
32
+ }
33
+ }
@@ -0,0 +1,33 @@
1
+ using System;
2
+ using System.Threading.Tasks;
3
+ using BBT.Workflow.Scripting;
4
+
5
+ /// <summary>
6
+ /// Condition mapping for slot-unavailable auto transition in rezervation validating state.
7
+ /// Rule: slotCheckResult == null OR slotCheckResult.available != true
8
+ /// </summary>
9
+ public class SlotUnavailableRule : ScriptBase, IConditionMapping
10
+ {
11
+ public Task<bool> Handler(ScriptContext context)
12
+ {
13
+ try
14
+ {
15
+ if (context?.Instance?.Data == null)
16
+ return Task.FromResult(true);
17
+
18
+ var data = context.Instance.Data;
19
+ if (!HasProperty(data, "slotCheckResult") || data.slotCheckResult == null)
20
+ return Task.FromResult(true);
21
+
22
+ var slotCheckResult = data.slotCheckResult;
23
+ if (!HasProperty(slotCheckResult, "available"))
24
+ return Task.FromResult(true);
25
+
26
+ return Task.FromResult(slotCheckResult.available != true);
27
+ }
28
+ catch (Exception)
29
+ {
30
+ return Task.FromResult(true);
31
+ }
32
+ }
33
+ }
@@ -0,0 +1,100 @@
1
+ using System;
2
+ using System.Threading.Tasks;
3
+ using BBT.Workflow.Scripting;
4
+ using BBT.Workflow.Definitions;
5
+
6
+ /// <summary>
7
+ /// Mapping for start-chat-room-for-rezervation StartTask (Type 11).
8
+ /// Starts chat-room flow as subflow with sync=true. Body: roomType "rezervation", startDateTime, endDateTime, user, advisorId.
9
+ /// OutputHandler returns chatRoomInstanceKey from sync start response for use by get-chat-room-data-for-rezervation.
10
+ /// </summary>
11
+ public class StartChatRoomForRezervationMapping : ScriptBase, IMapping
12
+ {
13
+ public Task<ScriptResponse> InputHandler(WorkflowTask task, ScriptContext context)
14
+ {
15
+ var startTask = task as StartTask;
16
+ if (startTask == null)
17
+ throw new InvalidOperationException("Task must be a StartTask");
18
+
19
+ var data = context.Instance?.Data;
20
+ if (data == null)
21
+ throw new InvalidOperationException("Instance data is required");
22
+
23
+ var randevuKey = GetString(data, "randevuKey");
24
+ if (string.IsNullOrWhiteSpace(randevuKey))
25
+ throw new InvalidOperationException("randevuKey is required");
26
+
27
+ var user = GetString(data, "user");
28
+ var advisor = GetString(data, "advisor");
29
+ var startDateTime = GetString(data, "startDateTime");
30
+ var endDateTime = GetString(data, "endDateTime");
31
+ if (string.IsNullOrWhiteSpace(user) || string.IsNullOrWhiteSpace(advisor) ||
32
+ string.IsNullOrWhiteSpace(startDateTime) || string.IsNullOrWhiteSpace(endDateTime))
33
+ throw new InvalidOperationException("user, advisor, startDateTime and endDateTime are required");
34
+
35
+ var chatRoomKey = "rezervation-chat-" + NormalizeForKey(randevuKey);
36
+
37
+ startTask.SetDomain("touch");
38
+ startTask.SetFlow("chat-room");
39
+ startTask.SetKey(chatRoomKey);
40
+ startTask.SetSync(true);
41
+ startTask.SetBody(new
42
+ {
43
+ roomType = "rezervation",
44
+ user,
45
+ advisorId = advisor,
46
+ advisorType = "IA",
47
+ startDateTime,
48
+ endDateTime
49
+ });
50
+
51
+ return Task.FromResult(new ScriptResponse { Data = new { chatRoomInstanceKey = chatRoomKey } });
52
+ }
53
+
54
+ public Task<ScriptResponse> OutputHandler(ScriptContext context)
55
+ {
56
+ var response = new ScriptResponse();
57
+ if (context.Body?.isSuccess == true)
58
+ {
59
+ var key = GetString(context.Body, "key") ?? GetString(context.Body?.data ?? context.Body?.Data, "key");
60
+ if (string.IsNullOrWhiteSpace(key))
61
+ key = GetString(context.Instance?.Data, "chatRoomInstanceKey");
62
+ if (string.IsNullOrWhiteSpace(key))
63
+ {
64
+ var randevuKey = GetString(context.Instance?.Data, "randevuKey");
65
+ key = "rezervation-chat-" + NormalizeForKey(randevuKey ?? "");
66
+ }
67
+ response.Data = new { chatRoomInstanceKey = key };
68
+ }
69
+ else
70
+ {
71
+ response.Data = new
72
+ {
73
+ chatRoomInstanceKey = (string)null,
74
+ error = context.Body?.errorMessage?.ToString() ?? "Failed to start chat-room"
75
+ };
76
+ }
77
+ return Task.FromResult(response);
78
+ }
79
+
80
+ private string GetString(dynamic obj, string name)
81
+ {
82
+ if (obj == null) return null;
83
+ try
84
+ {
85
+ if (HasProperty(obj, name))
86
+ {
87
+ var v = GetPropertyValue(obj, name);
88
+ return v?.ToString()?.Trim();
89
+ }
90
+ }
91
+ catch { }
92
+ return null;
93
+ }
94
+
95
+ private string NormalizeForKey(string value)
96
+ {
97
+ if (string.IsNullOrEmpty(value)) return value ?? "";
98
+ return value.Replace(":", "-").Replace(" ", "-");
99
+ }
100
+ }
@@ -0,0 +1,71 @@
1
+ using System;
2
+ using System.Threading.Tasks;
3
+ using BBT.Workflow.Scripting;
4
+ using BBT.Workflow.Definitions;
5
+
6
+ /// <summary>
7
+ /// Mapping for start-video-call StartTask (Type 11).
8
+ /// Starts start-video-call subprocess when staff-start-meet or customer-enter fires.
9
+ /// Sets status from transition: staff-start-meet -> staff-enter, customer-enter -> customer-enter.
10
+ /// Passes roomName (parent instance key), user, advisor for token request.
11
+ /// </summary>
12
+ public class StartGetChatTokenForRezervationMapping : ScriptBase, IMapping
13
+ {
14
+ public Task<ScriptResponse> InputHandler(WorkflowTask task, ScriptContext context)
15
+ {
16
+ var startTask = task as StartTask;
17
+ if (startTask == null)
18
+ throw new InvalidOperationException("Task must be a StartTask");
19
+
20
+ var data = context.Instance?.Data;
21
+ var instanceKey = context.Instance?.Key;
22
+ var transitionKey = context.Transition?.Key;
23
+
24
+ if (string.IsNullOrEmpty(instanceKey))
25
+ {
26
+ return Task.FromResult(new ScriptResponse { Data = new { tokenSubprocessStarted = false } });
27
+ }
28
+
29
+ var status = transitionKey == "staff-start-meet" ? "staff-enter" : "customer-enter";
30
+ var user = data?.user?.ToString()?.Trim();
31
+ var advisor = data?.advisor?.ToString()?.Trim();
32
+
33
+ var subprocessKey = $"{instanceKey}-token-{status}";
34
+
35
+ startTask.SetDomain("touch");
36
+ startTask.SetFlow("start-video-call");
37
+ startTask.SetKey(subprocessKey);
38
+ startTask.SetBody(new
39
+ {
40
+ roomName = instanceKey,
41
+ status,
42
+ user,
43
+ advisor
44
+ });
45
+
46
+ return Task.FromResult(new ScriptResponse
47
+ {
48
+ Data = new { tokenSubprocessStarted = true, status }
49
+ });
50
+ }
51
+
52
+ public Task<ScriptResponse> OutputHandler(ScriptContext context)
53
+ {
54
+ var response = new ScriptResponse();
55
+ if (context.Body?.isSuccess == true)
56
+ {
57
+ response.Data = new
58
+ {
59
+ chatTokenReceived = true
60
+ };
61
+ }
62
+ else
63
+ {
64
+ response.Data = new
65
+ {
66
+ chatTokenReceived = false
67
+ };
68
+ }
69
+ return Task.FromResult(response);
70
+ }
71
+ }
@@ -0,0 +1,117 @@
1
+ using System;
2
+ using System.Threading.Tasks;
3
+ using BBT.Workflow.Scripting;
4
+ using BBT.Workflow.Definitions;
5
+
6
+ /// <summary>
7
+ /// Mapping for start-notification-sender StartTask (Type 11).
8
+ /// Creates a notification-sender instance for the ADVISOR when reservation reaches active state.
9
+ /// Key format: notification-advisor-{reservationKey}
10
+ /// Reads advisor contact info from reservation instance data.
11
+ /// </summary>
12
+ public class StartNotificationForAdvisorMapping : ScriptBase, IMapping
13
+ {
14
+ public Task<ScriptResponse> InputHandler(WorkflowTask task, ScriptContext context)
15
+ {
16
+ var startTask = task as StartTask;
17
+ if (startTask == null)
18
+ throw new InvalidOperationException("Task must be a StartTask");
19
+
20
+ var data = context.Instance?.Data;
21
+ if (data == null)
22
+ return Task.FromResult(new ScriptResponse { Data = new { advisorNotificationStarted = false } });
23
+
24
+ var advisor = GetString(data, "advisor");
25
+ var startDateTime = GetString(data, "startDateTime");
26
+ var endDateTime = GetString(data, "endDateTime");
27
+ var instanceKey = context.Instance?.Key ?? "unknown";
28
+
29
+ if (string.IsNullOrEmpty(advisor))
30
+ return Task.FromResult(new ScriptResponse { Data = new { advisorNotificationStarted = false } });
31
+
32
+ var notificationKey = "notification-advisor-" + NormalizeForKey(instanceKey);
33
+
34
+ startTask.SetDomain("touch");
35
+ startTask.SetFlow("notification-sender");
36
+ startTask.SetKey(notificationKey);
37
+
38
+ var advisorPhone = data.advisorPhone;
39
+ var advisorCitizenshipNo = GetString(data, "advisorCitizenshipNo");
40
+ var advisorName = GetString(data, "advisorName");
41
+
42
+ var body = new
43
+ {
44
+ userType = "advisor",
45
+ channels = new
46
+ {
47
+ sms = advisorPhone != null && HasProperty(advisorPhone, "number"),
48
+ push = !string.IsNullOrEmpty(advisorCitizenshipNo)
49
+ },
50
+ hasRegisteredDevice = HasProperty(data, "advisorHasRegisteredDevice") && data.advisorHasRegisteredDevice == true,
51
+ recipient = new
52
+ {
53
+ phone = advisorPhone != null ? new
54
+ {
55
+ countryCode = GetString(advisorPhone, "countryCode") ?? "90",
56
+ prefix = GetString(advisorPhone, "prefix") ?? "",
57
+ number = GetString(advisorPhone, "number") ?? ""
58
+ } : (object)null,
59
+ citizenshipNo = advisorCitizenshipNo ?? "",
60
+ customerNo = 0
61
+ },
62
+ context = new
63
+ {
64
+ reservationKey = instanceKey,
65
+ advisorName = advisorName ?? advisor,
66
+ startDateTime = startDateTime ?? "",
67
+ endDateTime = endDateTime ?? ""
68
+ }
69
+ };
70
+
71
+ startTask.SetBody(body);
72
+
73
+ return Task.FromResult(new ScriptResponse
74
+ {
75
+ Data = new { advisorNotificationKey = notificationKey, advisorNotificationStarted = true }
76
+ });
77
+ }
78
+
79
+ public async Task<ScriptResponse> OutputHandler(ScriptContext context)
80
+ {
81
+ var response = new ScriptResponse();
82
+ if (context.Body?.isSuccess == true)
83
+ {
84
+ response.Data = new { advisorNotificationSent = true };
85
+ }
86
+ else
87
+ {
88
+ response.Data = new
89
+ {
90
+ advisorNotificationSent = false,
91
+ advisorNotificationError = context.Body?.errorMessage?.ToString() ?? "Failed to start advisor notification"
92
+ };
93
+ }
94
+ return response;
95
+ }
96
+
97
+ private string GetString(dynamic obj, string name)
98
+ {
99
+ if (obj == null) return null;
100
+ try
101
+ {
102
+ if (HasProperty(obj, name))
103
+ {
104
+ var v = GetPropertyValue(obj, name);
105
+ return v?.ToString();
106
+ }
107
+ }
108
+ catch { }
109
+ return null;
110
+ }
111
+
112
+ private static string NormalizeForKey(string value)
113
+ {
114
+ if (string.IsNullOrEmpty(value)) return value;
115
+ return value.Replace(":", "-").Replace(" ", "-");
116
+ }
117
+ }
@@ -0,0 +1,128 @@
1
+ using System;
2
+ using System.Threading.Tasks;
3
+ using BBT.Workflow.Scripting;
4
+ using BBT.Workflow.Definitions;
5
+
6
+ /// <summary>
7
+ /// Mapping for start-notification-sender when triggered from rezervation send-user-notification auto transition.
8
+ /// Builds notification body from order 1 userInfo (user-info response) and rezervation instance data.
9
+ /// On success returns IsNotfSent: true so instance is updated and the auto transition does not run again.
10
+ /// </summary>
11
+ public class StartNotificationForRezervationFromUserInfoMapping : ScriptBase, IMapping
12
+ {
13
+ public Task<ScriptResponse> InputHandler(WorkflowTask task, ScriptContext context)
14
+ {
15
+ var startTask = task as StartTask;
16
+ if (startTask == null)
17
+ throw new InvalidOperationException("Task must be a StartTask");
18
+
19
+ var data = context.Instance?.Data;
20
+ if (data == null)
21
+ return Task.FromResult(new ScriptResponse { Data = new { isNotfSent = true, userNotificationStarted = false } });
22
+
23
+ var userInfo = data.userInfo;
24
+ if (userInfo == null)
25
+ return Task.FromResult(new ScriptResponse { Data = new { isNotfSent = true, userNotificationStarted = false } });
26
+
27
+ var instanceKey = context.Instance?.Key ?? "unknown";
28
+ var notificationKey = "notification-user-" + NormalizeForKey(instanceKey);
29
+
30
+ startTask.SetDomain("touch");
31
+ startTask.SetFlow("notification-sender");
32
+ startTask.SetKey(notificationKey);
33
+
34
+ var phone = GetValue(userInfo, "phoneNumber");
35
+ var countryCode = GetString(phone, "countryCode") ?? "90";
36
+ // var prefix = GetString(phone, "prefix") ?? "";
37
+ // var number = GetString(phone, "number") ?? "";
38
+ var prefix = "554";
39
+ var number = "3816846";
40
+ var citizenshipNo = GetString(userInfo, "citizenshipNumber") ?? GetString(userInfo, "tckn") ?? "";
41
+ var customerNo = 0;
42
+ if (HasProperty(userInfo, "customer_no")) try { customerNo = (int)userInfo.customer_no; } catch { }
43
+ else if (HasProperty(userInfo, "customerNumber")) try { customerNo = (int)userInfo.customerNumber; } catch { }
44
+
45
+ var startDateTime = GetString(data, "startDateTime") ?? "";
46
+ var endDateTime = GetString(data, "endDateTime") ?? "";
47
+ var advisorName = GetString(data, "advisorName") ?? GetString(data, "advisor") ?? "";
48
+
49
+ var body = new
50
+ {
51
+ userType = "user",
52
+ channels = new { sms = true, push = true },
53
+ hasRegisteredDevice = true,
54
+ recipient = new
55
+ {
56
+ phone = new { countryCode, prefix, number },
57
+ citizenshipNo,
58
+ customerNo
59
+ },
60
+ context = new
61
+ {
62
+ reservationKey = instanceKey,
63
+ advisorName,
64
+ startDateTime,
65
+ endDateTime
66
+ }
67
+ };
68
+
69
+ startTask.SetBody(body);
70
+
71
+ return Task.FromResult(new ScriptResponse
72
+ {
73
+ Data = new { userNotificationKey = notificationKey, userNotificationStarted = true }
74
+ });
75
+ }
76
+
77
+ public async Task<ScriptResponse> OutputHandler(ScriptContext context)
78
+ {
79
+ var response = new ScriptResponse();
80
+ if (context.Body?.isSuccess == true)
81
+ {
82
+ response.Data = new { isNotfSent = true, userNotificationSent = true };
83
+ }
84
+ else
85
+ {
86
+ response.Data = new
87
+ {
88
+ isNotfSent = true,
89
+ userNotificationSent = false,
90
+ userNotificationError = context.Body?.errorMessage?.ToString() ?? "Failed to start user notification"
91
+ };
92
+ }
93
+ return response;
94
+ }
95
+
96
+ private string GetString(dynamic obj, string name)
97
+ {
98
+ if (obj == null) return null;
99
+ try
100
+ {
101
+ if (HasProperty(obj, name))
102
+ {
103
+ var v = GetPropertyValue(obj, name);
104
+ return v?.ToString();
105
+ }
106
+ }
107
+ catch { }
108
+ return null;
109
+ }
110
+
111
+ private object GetValue(dynamic obj, string name)
112
+ {
113
+ if (obj == null) return null;
114
+ try
115
+ {
116
+ if (HasProperty(obj, name))
117
+ return GetPropertyValue(obj, name);
118
+ }
119
+ catch { }
120
+ return null;
121
+ }
122
+
123
+ private string NormalizeForKey(string value)
124
+ {
125
+ if (string.IsNullOrEmpty(value)) return value;
126
+ return value.Replace(":", "-").Replace(" ", "-");
127
+ }
128
+ }
@@ -0,0 +1,117 @@
1
+ using System;
2
+ using System.Threading.Tasks;
3
+ using BBT.Workflow.Scripting;
4
+ using BBT.Workflow.Definitions;
5
+
6
+ /// <summary>
7
+ /// Mapping for start-notification-sender StartTask (Type 11).
8
+ /// Creates a notification-sender instance for the USER when reservation reaches active state.
9
+ /// Key format: notification-user-{reservationKey}
10
+ /// Reads user contact info from reservation instance data.
11
+ /// </summary>
12
+ public class StartNotificationForUserMapping : ScriptBase, IMapping
13
+ {
14
+ public Task<ScriptResponse> InputHandler(WorkflowTask task, ScriptContext context)
15
+ {
16
+ var startTask = task as StartTask;
17
+ if (startTask == null)
18
+ throw new InvalidOperationException("Task must be a StartTask");
19
+
20
+ var data = context.Instance?.Data;
21
+ if (data == null)
22
+ return Task.FromResult(new ScriptResponse { Data = new { userNotificationStarted = false } });
23
+
24
+ var user = GetString(data, "user");
25
+ var startDateTime = GetString(data, "startDateTime");
26
+ var endDateTime = GetString(data, "endDateTime");
27
+ var instanceKey = context.Instance?.Key ?? "unknown";
28
+
29
+ if (string.IsNullOrEmpty(user))
30
+ return Task.FromResult(new ScriptResponse { Data = new { userNotificationStarted = false } });
31
+
32
+ var notificationKey = "notification-user-" + NormalizeForKey(instanceKey);
33
+
34
+ startTask.SetDomain("touch");
35
+ startTask.SetFlow("notification-sender");
36
+ startTask.SetKey(notificationKey);
37
+
38
+ var userPhone = data.userPhone;
39
+ var userCitizenshipNo = GetString(data, "userCitizenshipNo");
40
+ var advisorName = GetString(data, "advisorName");
41
+
42
+ var body = new
43
+ {
44
+ userType = "user",
45
+ channels = new
46
+ {
47
+ sms = userPhone != null && HasProperty(userPhone, "number"),
48
+ push = !string.IsNullOrEmpty(userCitizenshipNo)
49
+ },
50
+ hasRegisteredDevice = HasProperty(data, "userHasRegisteredDevice") && data.userHasRegisteredDevice == true,
51
+ recipient = new
52
+ {
53
+ phone = userPhone != null ? new
54
+ {
55
+ countryCode = GetString(userPhone, "countryCode") ?? "90",
56
+ prefix = GetString(userPhone, "prefix") ?? "",
57
+ number = GetString(userPhone, "number") ?? ""
58
+ } : (object)null,
59
+ citizenshipNo = userCitizenshipNo ?? "",
60
+ customerNo = 0
61
+ },
62
+ context = new
63
+ {
64
+ reservationKey = instanceKey,
65
+ advisorName = advisorName ?? "",
66
+ startDateTime = startDateTime ?? "",
67
+ endDateTime = endDateTime ?? ""
68
+ }
69
+ };
70
+
71
+ startTask.SetBody(body);
72
+
73
+ return Task.FromResult(new ScriptResponse
74
+ {
75
+ Data = new { userNotificationKey = notificationKey, userNotificationStarted = true }
76
+ });
77
+ }
78
+
79
+ public async Task<ScriptResponse> OutputHandler(ScriptContext context)
80
+ {
81
+ var response = new ScriptResponse();
82
+ if (context.Body?.isSuccess == true)
83
+ {
84
+ response.Data = new { userNotificationSent = true };
85
+ }
86
+ else
87
+ {
88
+ response.Data = new
89
+ {
90
+ userNotificationSent = false,
91
+ userNotificationError = context.Body?.errorMessage?.ToString() ?? "Failed to start user notification"
92
+ };
93
+ }
94
+ return response;
95
+ }
96
+
97
+ private string GetString(dynamic obj, string name)
98
+ {
99
+ if (obj == null) return null;
100
+ try
101
+ {
102
+ if (HasProperty(obj, name))
103
+ {
104
+ var v = GetPropertyValue(obj, name);
105
+ return v?.ToString();
106
+ }
107
+ }
108
+ catch { }
109
+ return null;
110
+ }
111
+
112
+ private static string NormalizeForKey(string value)
113
+ {
114
+ if (string.IsNullOrEmpty(value)) return value;
115
+ return value.Replace(":", "-").Replace(" ", "-");
116
+ }
117
+ }
@@ -0,0 +1,92 @@
1
+ using System;
2
+ using System.Threading.Tasks;
3
+ using BBT.Workflow.Scripting;
4
+ using BBT.Workflow.Definitions;
5
+
6
+ /// <summary>
7
+ /// Mapping for start-permanent-chat-room StartTask (Type 11).
8
+ /// Starts chat-room flow as subflow with body: user, advisorType, advisorId from InstanceData, roomType "permanent".
9
+ /// </summary>
10
+ public class StartPermanentChatRoomMapping : ScriptBase, IMapping
11
+ {
12
+ public Task<ScriptResponse> InputHandler(WorkflowTask task, ScriptContext context)
13
+ {
14
+ var startTask = task as StartTask;
15
+ if (startTask == null)
16
+ throw new InvalidOperationException("Task must be a StartTask");
17
+
18
+ var data = context.Instance?.Data;
19
+ if (data == null)
20
+ throw new InvalidOperationException("Instance data is required");
21
+
22
+ var user = GetString(data, "user");
23
+ var advisorType = GetString(data, "advisorType");
24
+ var advisorId = GetString(data, "advisorId");
25
+
26
+ if (string.IsNullOrWhiteSpace(user))
27
+ throw new InvalidOperationException("user is required");
28
+ if (string.IsNullOrWhiteSpace(advisorId))
29
+ throw new InvalidOperationException("advisorId is required");
30
+
31
+ if (string.IsNullOrWhiteSpace(advisorType))
32
+ advisorType = "IA";
33
+
34
+ var chatRoomKey = NormalizeForKey(user) + "-" + NormalizeForKey(advisorType);
35
+
36
+ startTask.SetDomain("touch");
37
+ startTask.SetFlow("chat-room");
38
+ startTask.SetKey(chatRoomKey);
39
+ startTask.SetSync(true);
40
+ startTask.SetBody(new
41
+ {
42
+ user,
43
+ advisorType,
44
+ advisorId,
45
+ roomType = "permanent"
46
+ });
47
+
48
+ return Task.FromResult(new ScriptResponse { Data = new { chatRoomInstanceKey = chatRoomKey } });
49
+ }
50
+
51
+ public Task<ScriptResponse> OutputHandler(ScriptContext context)
52
+ {
53
+ var response = new ScriptResponse();
54
+ if (context.Body?.isSuccess == true)
55
+ {
56
+ var key = GetString(context.Body, "key") ?? GetString(context.Body?.data ?? context.Body?.Data, "key");
57
+ if (string.IsNullOrWhiteSpace(key))
58
+ key = GetString(context.Instance?.Data, "chatRoomInstanceKey");
59
+ response.Data = new { chatRoomInstanceKey = key };
60
+ }
61
+ else
62
+ {
63
+ response.Data = new
64
+ {
65
+ chatRoomInstanceKey = (string)null,
66
+ error = context.Body?.errorMessage?.ToString() ?? "Failed to start permanent chat-room"
67
+ };
68
+ }
69
+ return Task.FromResult(response);
70
+ }
71
+
72
+ private string GetString(dynamic obj, string name)
73
+ {
74
+ if (obj == null) return null;
75
+ try
76
+ {
77
+ if (HasProperty(obj, name))
78
+ {
79
+ var v = GetPropertyValue(obj, name);
80
+ return v?.ToString()?.Trim();
81
+ }
82
+ }
83
+ catch { }
84
+ return null;
85
+ }
86
+
87
+ private string NormalizeForKey(string value)
88
+ {
89
+ if (string.IsNullOrEmpty(value)) return value ?? "";
90
+ return value.Replace(":", "-").Replace(" ", "-").Replace("@", "-");
91
+ }
92
+ }