@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.
- package/LICENSE +21 -0
- package/burgan-tech-morph-touch-runtime-0.0.2.tgz +0 -0
- package/package.json +21 -0
- package/touch/Extensions/.gitkeep +0 -0
- package/touch/Functions/.gitkeep +0 -0
- package/touch/Functions/check-livekit-room-access.1.0.0.json +28 -0
- package/touch/Functions/check-livekit-room-access.http +44 -0
- package/touch/Functions/get-absence-entry.1.0.0.json +28 -0
- package/touch/Functions/get-advisor-stats.1.0.0.json +27 -0
- package/touch/Functions/get-available-slots.1.0.0.json +30 -0
- package/touch/Functions/get-available-slots.http +29 -0
- package/touch/Functions/get-chat-rooms.1.0.0.json +28 -0
- package/touch/Functions/get-chat-rooms.http +62 -0
- package/touch/Functions/get-customer-info.1.0.0.json +27 -0
- package/touch/Functions/get-matrix-sync.1.0.0.json +28 -0
- package/touch/Functions/get-rezervations.1.0.0.json +26 -0
- package/touch/Functions/get-rezervations.http +59 -0
- package/touch/Functions/get-room-messages.1.0.0.json +29 -0
- package/touch/Functions/get-room-messages.http +45 -0
- package/touch/Functions/rezervation-transfer.http +118 -0
- package/touch/Functions/send-room-message.1.0.0.json +29 -0
- package/touch/Functions/src/CheckLivekitRoomAccessMapping.csx +238 -0
- package/touch/Functions/src/GetAbsenceEntryMapping.csx +225 -0
- package/touch/Functions/src/GetAdvisorStatsMapping.csx +190 -0
- package/touch/Functions/src/GetAvailableSlotsMapping.csx +468 -0
- package/touch/Functions/src/GetChatRoomsMapping.csx +202 -0
- package/touch/Functions/src/GetCustomerInfoMapping.csx +140 -0
- package/touch/Functions/src/GetMatrixSyncMapping.csx +197 -0
- package/touch/Functions/src/GetRezervationsMapping.csx +162 -0
- package/touch/Functions/src/GetRoomMessagesMapping.csx +165 -0
- package/touch/Functions/src/SendCancelNotificationMapping.csx +63 -0
- package/touch/Functions/src/SendRoomMessageMapping.csx +131 -0
- package/touch/Schemas/.gitkeep +0 -0
- package/touch/Schemas/absence-entry.1.0.0.json +232 -0
- package/touch/Schemas/advisor-chat-rooms.1.0.0.json +62 -0
- package/touch/Schemas/chat-room.1.0.0.json +110 -0
- package/touch/Schemas/notification-sender.1.0.0.json +159 -0
- package/touch/Schemas/portfolio-manager.1.0.0.json +63 -0
- package/touch/Schemas/rezervation.1.0.0.json +102 -0
- package/touch/Tasks/.gitkeep +0 -0
- package/touch/Tasks/cancel-absence-entry-for-rezervation.1.0.0.json +21 -0
- package/touch/Tasks/check-already-completed-chat-room.1.0.0.json +24 -0
- package/touch/Tasks/check-duplicate-portfolio-manager.1.0.0.json +23 -0
- package/touch/Tasks/check-duplicate-rezervation.1.0.0.json +23 -0
- package/touch/Tasks/check-existing-permanent-chat-room.1.0.0.json +21 -0
- package/touch/Tasks/check-randevu-time.1.0.0.json +17 -0
- package/touch/Tasks/create-permanent-chat-room.1.0.0.json +28 -0
- package/touch/Tasks/determine-transfer-type.1.0.0.json +16 -0
- package/touch/Tasks/enrich-rezervations-for-transfer.1.0.0.json +23 -0
- package/touch/Tasks/execute-permanent-chatroom-update.1.0.0.json +21 -0
- package/touch/Tasks/execute-rez-chatroom-transfer.1.0.0.json +21 -0
- package/touch/Tasks/execute-rezervation-transfer.1.0.0.json +19 -0
- package/touch/Tasks/fetch-absence-entries-for-transfer.1.0.0.json +23 -0
- package/touch/Tasks/fetch-advisors-for-transfer.1.0.0.json +23 -0
- package/touch/Tasks/fetch-permanent-chatrooms-for-transfer.1.0.0.json +23 -0
- package/touch/Tasks/fetch-rez-chatrooms-for-transfer.1.0.0.json +23 -0
- package/touch/Tasks/fetch-rezervations-for-transfer.1.0.0.json +22 -0
- package/touch/Tasks/get-absence-entry-task.1.0.0.json +23 -0
- package/touch/Tasks/get-available-slots-http.1.0.0.json +27 -0
- package/touch/Tasks/get-available-slots.1.0.0.json +24 -0
- package/touch/Tasks/get-chat-room-data-for-rezervation.1.0.0.json +23 -0
- package/touch/Tasks/get-chat-token.1.0.0.json +27 -0
- package/touch/Tasks/get-matrix-room-messages.1.0.0.json +25 -0
- package/touch/Tasks/get-matrix-sync.1.0.0.json +25 -0
- package/touch/Tasks/get-rezervation-data-task.1.0.0.json +22 -0
- package/touch/Tasks/get-rezervation-state-task.1.0.0.json +22 -0
- package/touch/Tasks/get-rezervations-task.1.0.0.json +21 -0
- package/touch/Tasks/get-user-info-for-rezervation.1.0.0.json +24 -0
- package/touch/Tasks/get-video-call-url.1.0.0.json +17 -0
- package/touch/Tasks/invite-user-to-rezervation-room.1.0.0.json +27 -0
- package/touch/Tasks/join-chat-room-for-rezervation.1.0.0.json +28 -0
- package/touch/Tasks/join-matrix-room.1.0.0.json +27 -0
- package/touch/Tasks/join-user-to-room.1.0.0.json +27 -0
- package/touch/Tasks/merge-invited-user.1.0.0.json +17 -0
- package/touch/Tasks/merge-rezervation-update.1.0.0.json +16 -0
- package/touch/Tasks/merge-target-advisor-for-transfer.1.0.0.json +17 -0
- package/touch/Tasks/merge-update-body-for-randevu-update.1.0.0.json +16 -0
- package/touch/Tasks/merge-video-call-urls.1.0.0.json +17 -0
- package/touch/Tasks/query-chat-room-instances.1.0.0.json +23 -0
- package/touch/Tasks/remove-member-from-room.1.0.0.json +28 -0
- package/touch/Tasks/send-matrix-room-message.1.0.0.json +26 -0
- package/touch/Tasks/send-push-notification.1.0.0.json +26 -0
- package/touch/Tasks/send-sms-notification.1.0.0.json +26 -0
- package/touch/Tasks/set-chat-room-status-active.1.0.0.json +16 -0
- package/touch/Tasks/set-chat-room-status-deactive.1.0.0.json +16 -0
- package/touch/Tasks/set-previous-advisor.1.0.0.json +16 -0
- package/touch/Tasks/set-user-from-headers-for-rezervation.1.0.0.json +17 -0
- package/touch/Tasks/start-absence-entry-for-rezervation.1.0.0.json +21 -0
- package/touch/Tasks/start-chat-room-for-rezervation.1.0.0.json +20 -0
- package/touch/Tasks/start-notification-sender.1.0.0.json +20 -0
- package/touch/Tasks/start-permanent-chat-room.1.0.0.json +21 -0
- package/touch/Tasks/start-transfer-from-absence-entry.1.0.0.json +19 -0
- package/touch/Tasks/start-video-call.1.0.0.json +22 -0
- package/touch/Tasks/trigger-chat-room-deactivate.1.0.0.json +21 -0
- package/touch/Tasks/trigger-chat-room-transfer.1.0.0.json +21 -0
- package/touch/Tasks/trigger-chat-room-update.1.0.0.json +20 -0
- package/touch/Tasks/trigger-rezervation-add-invited-participant.1.0.0.json +20 -0
- package/touch/Tasks/trigger-rezervation-apply-update.1.0.0.json +20 -0
- package/touch/Tasks/trigger-rezervation-to-in-meet.1.0.0.json +20 -0
- package/touch/Tasks/trigger-rezervation-video-call-update.1.0.0.json +21 -0
- package/touch/Tasks/validate-date-for-rezervation.1.0.0.json +18 -0
- package/touch/Tasks/validate-slot-for-rezervation.1.0.0.json +24 -0
- package/touch/Tasks/validate-transfer-availability.1.0.0.json +23 -0
- package/touch/Views/.gitkeep +0 -0
- package/touch/Workflows/.gitkeep +0 -0
- package/touch/Workflows/absence-entry.http +458 -0
- package/touch/Workflows/absence-entry.json +179 -0
- package/touch/Workflows/add-participant-to-rezervation.http +47 -0
- package/touch/Workflows/add-participant-to-rezervation.json +340 -0
- package/touch/Workflows/chat-room.http +207 -0
- package/touch/Workflows/chat-room.json +452 -0
- package/touch/Workflows/investment-advisor.json +367 -0
- package/touch/Workflows/notification-sender.http +299 -0
- package/touch/Workflows/notification-sender.json +262 -0
- package/touch/Workflows/portfolio-manager.json +367 -0
- package/touch/Workflows/randevu-update.http +87 -0
- package/touch/Workflows/rezervation-start.json +467 -0
- package/touch/Workflows/rezervation-transfer.json +512 -0
- package/touch/Workflows/rezervation-update.http +87 -0
- package/touch/Workflows/rezervation-update.json +485 -0
- package/touch/Workflows/rezervation.http +214 -0
- package/touch/Workflows/rezervation.json +726 -0
- package/touch/Workflows/src/AllChatRoomsSuccessRule.csx +65 -0
- package/touch/Workflows/src/AlwaysTrueRule.csx +13 -0
- package/touch/Workflows/src/AnyChatRoomFailedRule.csx +64 -0
- package/touch/Workflows/src/AutoProcessRule.csx +38 -0
- package/touch/Workflows/src/BuildRezChatRoomPlanMapping.csx +160 -0
- package/touch/Workflows/src/CanStartRezervationTimerMapping.csx +48 -0
- package/touch/Workflows/src/CanStartTransferMapping.csx +14 -0
- package/touch/Workflows/src/CancelAbsenceEntryForRezervationMapping.csx +48 -0
- package/touch/Workflows/src/CancelAbsenceForRandevuUpdateMapping.csx +62 -0
- package/touch/Workflows/src/ChatRoomCreatedFailedRule.csx +54 -0
- package/touch/Workflows/src/ChatRoomCreatedSuccessRule.csx +54 -0
- package/touch/Workflows/src/ChatRoomRemoveMapping.csx +104 -0
- package/touch/Workflows/src/ChatRoomTransferInviteMapping.csx +109 -0
- package/touch/Workflows/src/ChatRoomTransferRemoveMapping.csx +71 -0
- package/touch/Workflows/src/ChatRoomUpdateMapping.csx +107 -0
- package/touch/Workflows/src/CheckAlreadyCompletedChatRoomMapping.csx +100 -0
- package/touch/Workflows/src/CheckDuplicatePortfolioManagerMapping.csx +119 -0
- package/touch/Workflows/src/CheckDuplicateRezervationMapping.csx +150 -0
- package/touch/Workflows/src/CheckExistingPermanentChatRoomMapping.csx +169 -0
- package/touch/Workflows/src/CheckRandevuTimeMapping.csx +67 -0
- package/touch/Workflows/src/CheckRezervationStateActiveOrInMeetRule.csx +14 -0
- package/touch/Workflows/src/CreateAbsenceEntryForRezervationMapping.csx +111 -0
- package/touch/Workflows/src/CreateAbsenceForRandevuUpdateMapping.csx +108 -0
- package/touch/Workflows/src/CreateChatRoomForRezervationMapping.csx +122 -0
- package/touch/Workflows/src/CreatePermanentChatRoomMapping.csx +140 -0
- package/touch/Workflows/src/CustomerControlToEndRule.csx +14 -0
- package/touch/Workflows/src/DetermineTransferTypeMapping.csx +92 -0
- package/touch/Workflows/src/EnrichRezervationsForTransferMapping.csx +495 -0
- package/touch/Workflows/src/ExecutePermanentChatRoomUpdateMapping.csx +124 -0
- package/touch/Workflows/src/ExecuteRezChatRoomTransferMapping.csx +95 -0
- package/touch/Workflows/src/ExecuteTransferMapping.csx +152 -0
- package/touch/Workflows/src/FetchAbsenceEntriesForTransferMapping.csx +116 -0
- package/touch/Workflows/src/FetchAdvisorsForTransferMapping.csx +145 -0
- package/touch/Workflows/src/FetchPermanentChatRoomsMapping.csx +128 -0
- package/touch/Workflows/src/FetchRezervationsForTransferMapping.csx +124 -0
- package/touch/Workflows/src/GetChatRoomDataForRezervationMapping.csx +100 -0
- package/touch/Workflows/src/GetChatTokenMapping.csx +85 -0
- package/touch/Workflows/src/GetRezervationDataForAddParticipantMapping.csx +105 -0
- package/touch/Workflows/src/GetRezervationDataForRandevuUpdateMapping.csx +110 -0
- package/touch/Workflows/src/GetRezervationDataMapping.csx +111 -0
- package/touch/Workflows/src/GetRezervationStateForRandevuUpdateMapping.csx +80 -0
- package/touch/Workflows/src/GetRezervationStateMapping.csx +92 -0
- package/touch/Workflows/src/GetUserInfoForRezervationMapping.csx +63 -0
- package/touch/Workflows/src/GetVideoCallUrlMapping.csx +62 -0
- package/touch/Workflows/src/HasChangedAdvisorRule.csx +28 -0
- package/touch/Workflows/src/HasChatIntegrationRule.csx +41 -0
- package/touch/Workflows/src/HasExistingPermanentRoomRule.csx +28 -0
- package/touch/Workflows/src/InviteAdvisorForRandevuUpdateMapping.csx +86 -0
- package/touch/Workflows/src/InviteNewAdvisorToRezervationRoomMapping.csx +78 -0
- package/touch/Workflows/src/InviteNewParticipantToRandevuRoomMapping.csx +88 -0
- package/touch/Workflows/src/InvitedUserMergeMapping.csx +77 -0
- package/touch/Workflows/src/InvitedUserNotAllowedRule.csx +71 -0
- package/touch/Workflows/src/InvitedUserNotInMeetRule.csx +19 -0
- package/touch/Workflows/src/IsNotfSentRule.csx +36 -0
- package/touch/Workflows/src/JoinChatRoomForAddParticipantMapping.csx +118 -0
- package/touch/Workflows/src/JoinChatRoomForRandevuStartMapping.csx +119 -0
- package/touch/Workflows/src/JoinChatRoomForRezervationMapping.csx +118 -0
- package/touch/Workflows/src/JoinMatrixRoomMapping.csx +100 -0
- package/touch/Workflows/src/JoinUserToRoomMapping.csx +118 -0
- package/touch/Workflows/src/LoginForAddParticipantChatMapping.csx +102 -0
- package/touch/Workflows/src/LoginForRandevuStartChatMapping.csx +96 -0
- package/touch/Workflows/src/MergeRezervationUpdateMapping.csx +82 -0
- package/touch/Workflows/src/MergeTargetAdvisorForTransferMapping.csx +79 -0
- package/touch/Workflows/src/MergeUpdateBodyForRandevuUpdateMapping.csx +91 -0
- package/touch/Workflows/src/NoExistingPermanentRoomRule.csx +23 -0
- package/touch/Workflows/src/NotificationCompleteAlwaysRule.csx +14 -0
- package/touch/Workflows/src/NotificationCompleteFromPendingRule.csx +41 -0
- package/touch/Workflows/src/NotificationCompleteFromSmsRule.csx +36 -0
- package/touch/Workflows/src/NotificationPushFromPendingRule.csx +42 -0
- package/touch/Workflows/src/NotificationPushFromSmsRule.csx +36 -0
- package/touch/Workflows/src/NotificationSmsPendingRule.csx +32 -0
- package/touch/Workflows/src/PermanentDoneRule.csx +44 -0
- package/touch/Workflows/src/PermanentProcessNextRule.csx +44 -0
- package/touch/Workflows/src/RezChatRoomProcessNextRule.csx +44 -0
- package/touch/Workflows/src/RezChatRoomsDoneRule.csx +44 -0
- package/touch/Workflows/src/SendPushNotificationMapping.csx +146 -0
- package/touch/Workflows/src/SendSmsNotificationMapping.csx +138 -0
- package/touch/Workflows/src/SetChatRoomStatusActiveMapping.csx +22 -0
- package/touch/Workflows/src/SetChatRoomStatusDeactiveMapping.csx +22 -0
- package/touch/Workflows/src/SetPreviousAdvisorMapping.csx +28 -0
- package/touch/Workflows/src/SetUserFromHeadersForRezervationMapping.csx +24 -0
- package/touch/Workflows/src/SlotAvailableRule.csx +33 -0
- package/touch/Workflows/src/SlotUnavailableRule.csx +33 -0
- package/touch/Workflows/src/StartChatRoomForRezervationMapping.csx +100 -0
- package/touch/Workflows/src/StartGetChatTokenForRezervationMapping.csx +71 -0
- package/touch/Workflows/src/StartNotificationForAdvisorMapping.csx +117 -0
- package/touch/Workflows/src/StartNotificationForRezervationFromUserInfoMapping.csx +128 -0
- package/touch/Workflows/src/StartNotificationForUserMapping.csx +117 -0
- package/touch/Workflows/src/StartPermanentChatRoomMapping.csx +92 -0
- package/touch/Workflows/src/StartTransferFromAbsenceEntryMapping.csx +94 -0
- package/touch/Workflows/src/StartVideoCallCustomerSubFlowMapping.csx +37 -0
- package/touch/Workflows/src/StartVideoCallForInvitedParticipantMapping.csx +54 -0
- package/touch/Workflows/src/StartVideoCallForRandevuStartMapping.csx +70 -0
- package/touch/Workflows/src/StartVideoCallStaffSubFlowMapping.csx +37 -0
- package/touch/Workflows/src/StateActiveForUpdateRule.csx +14 -0
- package/touch/Workflows/src/StateActiveRule.csx +14 -0
- package/touch/Workflows/src/StateInMeetRule.csx +14 -0
- package/touch/Workflows/src/StateNotActiveForUpdateRule.csx +14 -0
- package/touch/Workflows/src/StateNotActiveOrInMeetRule.csx +14 -0
- package/touch/Workflows/src/StatusCustomerEnterRule.csx +25 -0
- package/touch/Workflows/src/StatusStaffEnterRule.csx +25 -0
- package/touch/Workflows/src/SyncWorkingHoursRule.csx +46 -0
- package/touch/Workflows/src/TokenSuccessRule.csx +24 -0
- package/touch/Workflows/src/TransferAllDoneRule.csx +50 -0
- package/touch/Workflows/src/TransferHasInvalidRule.csx +34 -0
- package/touch/Workflows/src/TransferProcessNextRule.csx +50 -0
- package/touch/Workflows/src/TriggerChatRoomDeactivateMapping.csx +77 -0
- package/touch/Workflows/src/TriggerChatRoomTransferMapping.csx +93 -0
- package/touch/Workflows/src/TriggerChatRoomUpdateMapping.csx +99 -0
- package/touch/Workflows/src/TriggerRezervationAddInvitedParticipantMapping.csx +77 -0
- package/touch/Workflows/src/TriggerRezervationApplyUpdateMapping.csx +66 -0
- package/touch/Workflows/src/TriggerRezervationToInMeetMapping.csx +69 -0
- package/touch/Workflows/src/TriggerRezervationVideoCallUpdateMapping.csx +67 -0
- package/touch/Workflows/src/ValidateDateForRezervationMapping.csx +60 -0
- package/touch/Workflows/src/ValidateSlotForRandevuUpdateMapping.csx +211 -0
- package/touch/Workflows/src/ValidateSlotForRezervationMapping.csx +246 -0
- package/touch/Workflows/src/ValidateTransferMapping.csx +243 -0
- package/touch/Workflows/src/VideoCallUrlUpdateMergeMapping.csx +141 -0
- package/touch/Workflows/start-chat.json +217 -0
- package/touch/Workflows/start-video-call.http +93 -0
- package/touch/Workflows/start-video-call.json +206 -0
- package/vnext.config.json +58 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
using System;
|
|
2
|
+
using System.Threading.Tasks;
|
|
3
|
+
using BBT.Workflow.Scripting;
|
|
4
|
+
|
|
5
|
+
/// <summary>
|
|
6
|
+
/// Condition for to-push-sending auto transition from pending state.
|
|
7
|
+
/// Rule: channels.sms != true AND channels.push == true AND hasRegisteredDevice == true
|
|
8
|
+
/// (Only fires when SMS is NOT requested but Push IS requested with a registered device)
|
|
9
|
+
/// </summary>
|
|
10
|
+
public class NotificationPushFromPendingRule : ScriptBase, IConditionMapping
|
|
11
|
+
{
|
|
12
|
+
public async Task<bool> Handler(ScriptContext context)
|
|
13
|
+
{
|
|
14
|
+
try
|
|
15
|
+
{
|
|
16
|
+
var data = context?.Instance?.Data;
|
|
17
|
+
if (data == null) return false;
|
|
18
|
+
|
|
19
|
+
if (!HasProperty(data, "channels") || data.channels == null)
|
|
20
|
+
return false;
|
|
21
|
+
|
|
22
|
+
var channels = data.channels;
|
|
23
|
+
|
|
24
|
+
bool smsRequested = HasProperty(channels, "sms") && channels.sms == true;
|
|
25
|
+
if (smsRequested)
|
|
26
|
+
return false;
|
|
27
|
+
|
|
28
|
+
bool pushRequested = HasProperty(channels, "push") && channels.push == true;
|
|
29
|
+
if (!pushRequested)
|
|
30
|
+
return false;
|
|
31
|
+
|
|
32
|
+
if (!HasProperty(data, "hasRegisteredDevice"))
|
|
33
|
+
return false;
|
|
34
|
+
|
|
35
|
+
return data.hasRegisteredDevice == true;
|
|
36
|
+
}
|
|
37
|
+
catch (Exception)
|
|
38
|
+
{
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
using System;
|
|
2
|
+
using System.Threading.Tasks;
|
|
3
|
+
using BBT.Workflow.Scripting;
|
|
4
|
+
|
|
5
|
+
/// <summary>
|
|
6
|
+
/// Condition for to-push-sending auto transition from sms-sending state.
|
|
7
|
+
/// Rule: channels.push == true AND hasRegisteredDevice == true
|
|
8
|
+
/// </summary>
|
|
9
|
+
public class NotificationPushFromSmsRule : ScriptBase, IConditionMapping
|
|
10
|
+
{
|
|
11
|
+
public async Task<bool> Handler(ScriptContext context)
|
|
12
|
+
{
|
|
13
|
+
try
|
|
14
|
+
{
|
|
15
|
+
var data = context?.Instance?.Data;
|
|
16
|
+
if (data == null) return false;
|
|
17
|
+
|
|
18
|
+
if (!HasProperty(data, "channels") || data.channels == null)
|
|
19
|
+
return false;
|
|
20
|
+
|
|
21
|
+
var channels = data.channels;
|
|
22
|
+
bool pushRequested = HasProperty(channels, "push") && channels.push == true;
|
|
23
|
+
if (!pushRequested)
|
|
24
|
+
return false;
|
|
25
|
+
|
|
26
|
+
if (!HasProperty(data, "hasRegisteredDevice"))
|
|
27
|
+
return false;
|
|
28
|
+
|
|
29
|
+
return data.hasRegisteredDevice == true;
|
|
30
|
+
}
|
|
31
|
+
catch (Exception)
|
|
32
|
+
{
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
using System;
|
|
2
|
+
using System.Threading.Tasks;
|
|
3
|
+
using BBT.Workflow.Scripting;
|
|
4
|
+
|
|
5
|
+
/// <summary>
|
|
6
|
+
/// Condition for to-sms-sending auto transition from pending state.
|
|
7
|
+
/// Rule: channels.sms == true
|
|
8
|
+
/// </summary>
|
|
9
|
+
public class NotificationSmsPendingRule : ScriptBase, IConditionMapping
|
|
10
|
+
{
|
|
11
|
+
public async Task<bool> Handler(ScriptContext context)
|
|
12
|
+
{
|
|
13
|
+
try
|
|
14
|
+
{
|
|
15
|
+
var data = context?.Instance?.Data;
|
|
16
|
+
if (data == null) return false;
|
|
17
|
+
|
|
18
|
+
if (!HasProperty(data, "channels") || data.channels == null)
|
|
19
|
+
return false;
|
|
20
|
+
|
|
21
|
+
var channels = data.channels;
|
|
22
|
+
if (!HasProperty(channels, "sms"))
|
|
23
|
+
return false;
|
|
24
|
+
|
|
25
|
+
return channels.sms == true;
|
|
26
|
+
}
|
|
27
|
+
catch (Exception)
|
|
28
|
+
{
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
using System;
|
|
2
|
+
using System.Threading.Tasks;
|
|
3
|
+
using BBT.Workflow.Scripting;
|
|
4
|
+
|
|
5
|
+
/// <summary>
|
|
6
|
+
/// Condition for permanent-done auto transition in updating-permanent-chatrooms state.
|
|
7
|
+
/// Rule: permanentRoomPlan is null/empty OR permanentProcessedIndex >= permanentRoomPlan.Count
|
|
8
|
+
/// </summary>
|
|
9
|
+
public class PermanentDoneRule : 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
|
+
|
|
20
|
+
if (!HasProperty(data, "permanentRoomPlan") || data.permanentRoomPlan == null)
|
|
21
|
+
return Task.FromResult(true);
|
|
22
|
+
|
|
23
|
+
var plan = data.permanentRoomPlan as System.Collections.IEnumerable;
|
|
24
|
+
if (plan == null)
|
|
25
|
+
return Task.FromResult(true);
|
|
26
|
+
|
|
27
|
+
int totalCount = 0;
|
|
28
|
+
foreach (var item in plan) totalCount++;
|
|
29
|
+
|
|
30
|
+
if (totalCount == 0)
|
|
31
|
+
return Task.FromResult(true);
|
|
32
|
+
|
|
33
|
+
int processedIndex = 0;
|
|
34
|
+
if (HasProperty(data, "permanentProcessedIndex"))
|
|
35
|
+
int.TryParse(data.permanentProcessedIndex?.ToString() ?? "0", out processedIndex);
|
|
36
|
+
|
|
37
|
+
return Task.FromResult(processedIndex >= totalCount);
|
|
38
|
+
}
|
|
39
|
+
catch (Exception)
|
|
40
|
+
{
|
|
41
|
+
return Task.FromResult(true);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
using System;
|
|
2
|
+
using System.Threading.Tasks;
|
|
3
|
+
using BBT.Workflow.Scripting;
|
|
4
|
+
|
|
5
|
+
/// <summary>
|
|
6
|
+
/// Condition for process-next-permanent auto transition in updating-permanent-chatrooms state.
|
|
7
|
+
/// Rule: permanentProcessedIndex less than permanentRoomPlan.Count
|
|
8
|
+
/// </summary>
|
|
9
|
+
public class PermanentProcessNextRule : 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
|
+
|
|
20
|
+
if (!HasProperty(data, "permanentRoomPlan") || data.permanentRoomPlan == null)
|
|
21
|
+
return Task.FromResult(false);
|
|
22
|
+
|
|
23
|
+
var plan = data.permanentRoomPlan as System.Collections.IEnumerable;
|
|
24
|
+
if (plan == null)
|
|
25
|
+
return Task.FromResult(false);
|
|
26
|
+
|
|
27
|
+
int totalCount = 0;
|
|
28
|
+
foreach (var item in plan) totalCount++;
|
|
29
|
+
|
|
30
|
+
if (totalCount == 0)
|
|
31
|
+
return Task.FromResult(false);
|
|
32
|
+
|
|
33
|
+
int processedIndex = 0;
|
|
34
|
+
if (HasProperty(data, "permanentProcessedIndex"))
|
|
35
|
+
int.TryParse(data.permanentProcessedIndex?.ToString() ?? "0", out processedIndex);
|
|
36
|
+
|
|
37
|
+
return Task.FromResult(processedIndex < totalCount);
|
|
38
|
+
}
|
|
39
|
+
catch (Exception)
|
|
40
|
+
{
|
|
41
|
+
return Task.FromResult(false);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
using System;
|
|
2
|
+
using System.Threading.Tasks;
|
|
3
|
+
using BBT.Workflow.Scripting;
|
|
4
|
+
|
|
5
|
+
/// <summary>
|
|
6
|
+
/// Condition for process-next-rez-chatroom auto transition in updating-rez-chatrooms state.
|
|
7
|
+
/// Rule: rezChatRoomProcessedIndex less than rezChatRoomPlan.Count
|
|
8
|
+
/// </summary>
|
|
9
|
+
public class RezChatRoomProcessNextRule : 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
|
+
|
|
20
|
+
if (!HasProperty(data, "rezChatRoomPlan") || data.rezChatRoomPlan == null)
|
|
21
|
+
return Task.FromResult(false);
|
|
22
|
+
|
|
23
|
+
var plan = data.rezChatRoomPlan as System.Collections.IEnumerable;
|
|
24
|
+
if (plan == null)
|
|
25
|
+
return Task.FromResult(false);
|
|
26
|
+
|
|
27
|
+
int totalCount = 0;
|
|
28
|
+
foreach (var item in plan) totalCount++;
|
|
29
|
+
|
|
30
|
+
if (totalCount == 0)
|
|
31
|
+
return Task.FromResult(false);
|
|
32
|
+
|
|
33
|
+
int processedIndex = 0;
|
|
34
|
+
if (HasProperty(data, "rezChatRoomProcessedIndex"))
|
|
35
|
+
int.TryParse(data.rezChatRoomProcessedIndex?.ToString() ?? "0", out processedIndex);
|
|
36
|
+
|
|
37
|
+
return Task.FromResult(processedIndex < totalCount);
|
|
38
|
+
}
|
|
39
|
+
catch (Exception)
|
|
40
|
+
{
|
|
41
|
+
return Task.FromResult(false);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
using System;
|
|
2
|
+
using System.Threading.Tasks;
|
|
3
|
+
using BBT.Workflow.Scripting;
|
|
4
|
+
|
|
5
|
+
/// <summary>
|
|
6
|
+
/// Condition for rez-chatrooms-done auto transition in updating-rez-chatrooms state.
|
|
7
|
+
/// Rule: rezChatRoomPlan is null/empty OR rezChatRoomProcessedIndex >= rezChatRoomPlan.Count
|
|
8
|
+
/// </summary>
|
|
9
|
+
public class RezChatRoomsDoneRule : 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
|
+
|
|
20
|
+
if (!HasProperty(data, "rezChatRoomPlan") || data.rezChatRoomPlan == null)
|
|
21
|
+
return Task.FromResult(true);
|
|
22
|
+
|
|
23
|
+
var plan = data.rezChatRoomPlan as System.Collections.IEnumerable;
|
|
24
|
+
if (plan == null)
|
|
25
|
+
return Task.FromResult(true);
|
|
26
|
+
|
|
27
|
+
int totalCount = 0;
|
|
28
|
+
foreach (var item in plan) totalCount++;
|
|
29
|
+
|
|
30
|
+
if (totalCount == 0)
|
|
31
|
+
return Task.FromResult(true);
|
|
32
|
+
|
|
33
|
+
int processedIndex = 0;
|
|
34
|
+
if (HasProperty(data, "rezChatRoomProcessedIndex"))
|
|
35
|
+
int.TryParse(data.rezChatRoomProcessedIndex?.ToString() ?? "0", out processedIndex);
|
|
36
|
+
|
|
37
|
+
return Task.FromResult(processedIndex >= totalCount);
|
|
38
|
+
}
|
|
39
|
+
catch (Exception)
|
|
40
|
+
{
|
|
41
|
+
return Task.FromResult(true);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
using System;
|
|
2
|
+
using System.Threading.Tasks;
|
|
3
|
+
using BBT.Workflow.Scripting;
|
|
4
|
+
using BBT.Workflow.Definitions;
|
|
5
|
+
|
|
6
|
+
/// <summary>
|
|
7
|
+
/// Mapping for send-push-notification HttpTask (Type 6).
|
|
8
|
+
/// Builds Push notification request body from notification-sender instance data
|
|
9
|
+
/// and sends via MessagingGateway Push API.
|
|
10
|
+
/// Content is determined by userType:
|
|
11
|
+
/// - advisor: title="Yeni Randevu", content="Sayin {advisorName}, {date} tarihli randevunuz olusturulmustur."
|
|
12
|
+
/// - user: title="Randevu Onaylandi", content="Randevunuz basariyla olusturulmustur. Tarih: {date}"
|
|
13
|
+
/// </summary>
|
|
14
|
+
public class SendPushNotificationMapping : ScriptBase, IMapping
|
|
15
|
+
{
|
|
16
|
+
public async Task<ScriptResponse> InputHandler(WorkflowTask task, ScriptContext context)
|
|
17
|
+
{
|
|
18
|
+
var httpTask = task as HttpTask;
|
|
19
|
+
if (httpTask == null)
|
|
20
|
+
throw new InvalidOperationException("Task must be an HttpTask");
|
|
21
|
+
|
|
22
|
+
var baseUrl = await GetSecretAsync("vnext-secret", "workflow-secret", "MessagingBaseUrl");
|
|
23
|
+
if (string.IsNullOrWhiteSpace(baseUrl))
|
|
24
|
+
throw new InvalidOperationException("MessagingBaseUrl secret is required");
|
|
25
|
+
var fullUrl = baseUrl.TrimEnd('/') + "/Messaging/push-notification/message";
|
|
26
|
+
httpTask.SetUrl(fullUrl);
|
|
27
|
+
|
|
28
|
+
var data = context.Instance?.Data;
|
|
29
|
+
if (data == null)
|
|
30
|
+
throw new InvalidOperationException("Instance data is required");
|
|
31
|
+
|
|
32
|
+
var userType = GetString(data, "userType") ?? "user";
|
|
33
|
+
|
|
34
|
+
var recipient = data.recipient;
|
|
35
|
+
if (recipient == null)
|
|
36
|
+
throw new InvalidOperationException("recipient is required for Push notification");
|
|
37
|
+
|
|
38
|
+
var citizenshipNo = GetString(recipient, "citizenshipNo") ?? "";
|
|
39
|
+
int customerNo = 0;
|
|
40
|
+
if (HasProperty(recipient, "customerNo"))
|
|
41
|
+
{
|
|
42
|
+
try { customerNo = (int)recipient.customerNo; }
|
|
43
|
+
catch { }
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
var ctx = data.context;
|
|
47
|
+
var advisorName = ctx != null ? GetString(ctx, "advisorName") : null;
|
|
48
|
+
var startDateTime = ctx != null ? GetString(ctx, "startDateTime") : null;
|
|
49
|
+
var reservationKey = ctx != null ? GetString(ctx, "reservationKey") : null;
|
|
50
|
+
|
|
51
|
+
string formattedDate = startDateTime ?? "";
|
|
52
|
+
DateTime dt = default;
|
|
53
|
+
if (!string.IsNullOrEmpty(startDateTime) && DateTime.TryParse(startDateTime, out dt))
|
|
54
|
+
formattedDate = dt.ToString("dd.MM.yyyy HH:mm");
|
|
55
|
+
|
|
56
|
+
string title;
|
|
57
|
+
string content;
|
|
58
|
+
if (userType == "advisor")
|
|
59
|
+
{
|
|
60
|
+
title = "Yeni Randevu";
|
|
61
|
+
content = "Sayin " + (advisorName ?? "Danisman") + ", " + formattedDate + " tarihli randevunuz olusturulmustur.";
|
|
62
|
+
}
|
|
63
|
+
else
|
|
64
|
+
{
|
|
65
|
+
title = "Randevu Onaylandi";
|
|
66
|
+
content = "Randevunuz basariyla olusturulmustur. Tarih: " + formattedDate;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
var body = new
|
|
70
|
+
{
|
|
71
|
+
sender = "AutoDetect",
|
|
72
|
+
citizenshipNo,
|
|
73
|
+
title,
|
|
74
|
+
content,
|
|
75
|
+
customerNo,
|
|
76
|
+
customParameters = (string)null,
|
|
77
|
+
tags = new string[] { "touch", "notification", "reservation" },
|
|
78
|
+
saveInbox = true,
|
|
79
|
+
notificationType = "push",
|
|
80
|
+
process = new
|
|
81
|
+
{
|
|
82
|
+
name = "touch",
|
|
83
|
+
itemId = reservationKey ?? "",
|
|
84
|
+
action = "notification-sender",
|
|
85
|
+
identity = "system"
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
httpTask.SetBody(body);
|
|
90
|
+
|
|
91
|
+
return new ScriptResponse();
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
public async Task<ScriptResponse> OutputHandler(ScriptContext context)
|
|
95
|
+
{
|
|
96
|
+
var response = context.Body;
|
|
97
|
+
var result = new ScriptResponse();
|
|
98
|
+
|
|
99
|
+
if (response?.isSuccess == true || response?.statusCode?.ToString() == "200")
|
|
100
|
+
{
|
|
101
|
+
result.Data = new
|
|
102
|
+
{
|
|
103
|
+
notificationResults = new
|
|
104
|
+
{
|
|
105
|
+
pushResult = new
|
|
106
|
+
{
|
|
107
|
+
sent = true,
|
|
108
|
+
error = (string)null
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
else
|
|
114
|
+
{
|
|
115
|
+
string errorMessage = response?.errorMessage?.ToString() ?? response?.ToString() ?? "Push notification send failed";
|
|
116
|
+
result.Data = new
|
|
117
|
+
{
|
|
118
|
+
notificationResults = new
|
|
119
|
+
{
|
|
120
|
+
pushResult = new
|
|
121
|
+
{
|
|
122
|
+
sent = false,
|
|
123
|
+
error = errorMessage
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
return result;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
private string GetString(dynamic obj, string name)
|
|
133
|
+
{
|
|
134
|
+
if (obj == null) return null;
|
|
135
|
+
try
|
|
136
|
+
{
|
|
137
|
+
if (HasProperty(obj, name))
|
|
138
|
+
{
|
|
139
|
+
var v = GetPropertyValue(obj, name);
|
|
140
|
+
return v?.ToString();
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
catch { }
|
|
144
|
+
return null;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
using System;
|
|
2
|
+
using System.Threading.Tasks;
|
|
3
|
+
using BBT.Workflow.Scripting;
|
|
4
|
+
using BBT.Workflow.Definitions;
|
|
5
|
+
|
|
6
|
+
/// <summary>
|
|
7
|
+
/// Mapping for send-sms-notification HttpTask (Type 6).
|
|
8
|
+
/// Builds SMS request body from notification-sender instance data and sends via MessagingGateway.
|
|
9
|
+
/// Content is determined by userType:
|
|
10
|
+
/// - advisor: "Sayin {advisorName}, {date} tarihli randevunuz olusturulmustur."
|
|
11
|
+
/// - user: "Randevunuz basariyla olusturulmustur. Tarih: {date}"
|
|
12
|
+
/// </summary>
|
|
13
|
+
public class SendSmsNotificationMapping : ScriptBase, IMapping
|
|
14
|
+
{
|
|
15
|
+
public async Task<ScriptResponse> InputHandler(WorkflowTask task, ScriptContext context)
|
|
16
|
+
{
|
|
17
|
+
var httpTask = task as HttpTask;
|
|
18
|
+
if (httpTask == null)
|
|
19
|
+
throw new InvalidOperationException("Task must be an HttpTask");
|
|
20
|
+
|
|
21
|
+
var baseUrl = await GetSecretAsync("vnext-secret", "workflow-secret", "MessagingBaseUrl");
|
|
22
|
+
if (string.IsNullOrWhiteSpace(baseUrl))
|
|
23
|
+
throw new InvalidOperationException("MessagingBaseUrl secret is required");
|
|
24
|
+
var fullUrl = baseUrl.TrimEnd('/') + "/Messaging/sms/message/string";
|
|
25
|
+
httpTask.SetUrl(fullUrl);
|
|
26
|
+
|
|
27
|
+
var data = context.Instance?.Data;
|
|
28
|
+
if (data == null)
|
|
29
|
+
throw new InvalidOperationException("Instance data is required");
|
|
30
|
+
|
|
31
|
+
var userType = GetString(data, "userType") ?? "user";
|
|
32
|
+
|
|
33
|
+
var recipient = data.recipient;
|
|
34
|
+
if (recipient == null || !HasProperty(recipient, "phone") || recipient.phone == null)
|
|
35
|
+
throw new InvalidOperationException("recipient.phone is required for SMS");
|
|
36
|
+
|
|
37
|
+
var phone = recipient.phone;
|
|
38
|
+
var countryCode = GetString(phone, "countryCode") ?? "90";
|
|
39
|
+
var prefix = GetString(phone, "prefix") ?? "";
|
|
40
|
+
var number = GetString(phone, "number") ?? "";
|
|
41
|
+
|
|
42
|
+
var ctx = data.context;
|
|
43
|
+
var advisorName = ctx != null ? GetString(ctx, "advisorName") : null;
|
|
44
|
+
var startDateTime = ctx != null ? GetString(ctx, "startDateTime") : null;
|
|
45
|
+
var reservationKey = ctx != null ? GetString(ctx, "reservationKey") : null;
|
|
46
|
+
|
|
47
|
+
string formattedDate = startDateTime ?? "";
|
|
48
|
+
DateTime dt = default;
|
|
49
|
+
if (!string.IsNullOrEmpty(startDateTime) && DateTime.TryParse(startDateTime, out dt))
|
|
50
|
+
formattedDate = dt.ToString("dd.MM.yyyy HH:mm");
|
|
51
|
+
|
|
52
|
+
string content;
|
|
53
|
+
if (userType == "advisor")
|
|
54
|
+
content = "Sayin " + (advisorName ?? "Danisman") + ", " + formattedDate + " tarihli randevunuz olusturulmustur.";
|
|
55
|
+
else
|
|
56
|
+
content = "Randevunuz basariyla olusturulmustur. Tarih: " + formattedDate;
|
|
57
|
+
|
|
58
|
+
var body = new
|
|
59
|
+
{
|
|
60
|
+
sender = "AutoDetect",
|
|
61
|
+
smsType = "Fast",
|
|
62
|
+
phone = new
|
|
63
|
+
{
|
|
64
|
+
countryCode,
|
|
65
|
+
prefix,
|
|
66
|
+
number
|
|
67
|
+
},
|
|
68
|
+
content,
|
|
69
|
+
customerNo = 0,
|
|
70
|
+
citizenshipNo = "",
|
|
71
|
+
tags = (string[])null,
|
|
72
|
+
instantReminder = false,
|
|
73
|
+
process = new
|
|
74
|
+
{
|
|
75
|
+
name = "touch",
|
|
76
|
+
itemId = reservationKey ?? "",
|
|
77
|
+
action = "notification-sender",
|
|
78
|
+
identity = "system"
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
httpTask.SetBody(body);
|
|
83
|
+
return new ScriptResponse();
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
public async Task<ScriptResponse> OutputHandler(ScriptContext context)
|
|
87
|
+
{
|
|
88
|
+
var response = context.Body;
|
|
89
|
+
var result = new ScriptResponse();
|
|
90
|
+
|
|
91
|
+
if (response?.isSuccess == true || response?.statusCode?.ToString() == "200")
|
|
92
|
+
{
|
|
93
|
+
result.Data = new
|
|
94
|
+
{
|
|
95
|
+
notificationResults = new
|
|
96
|
+
{
|
|
97
|
+
smsResult = new
|
|
98
|
+
{
|
|
99
|
+
sent = true,
|
|
100
|
+
error = (string)null
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
else
|
|
106
|
+
{
|
|
107
|
+
string errorMessage = response?.errorMessage?.ToString() ?? response?.ToString() ?? "SMS send failed";
|
|
108
|
+
result.Data = new
|
|
109
|
+
{
|
|
110
|
+
notificationResults = new
|
|
111
|
+
{
|
|
112
|
+
smsResult = new
|
|
113
|
+
{
|
|
114
|
+
sent = false,
|
|
115
|
+
error = errorMessage
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
return result;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
private string GetString(dynamic obj, string name)
|
|
125
|
+
{
|
|
126
|
+
if (obj == null) return null;
|
|
127
|
+
try
|
|
128
|
+
{
|
|
129
|
+
if (HasProperty(obj, name))
|
|
130
|
+
{
|
|
131
|
+
var v = GetPropertyValue(obj, name);
|
|
132
|
+
return v?.ToString();
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
catch { }
|
|
136
|
+
return null;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
using System.Threading.Tasks;
|
|
2
|
+
using BBT.Workflow.Scripting;
|
|
3
|
+
using BBT.Workflow.Definitions;
|
|
4
|
+
|
|
5
|
+
/// <summary>
|
|
6
|
+
/// Sets instance data status to "active". Used in chat-room activated state onEntry.
|
|
7
|
+
/// </summary>
|
|
8
|
+
public class SetChatRoomStatusActiveMapping : ScriptBase, IMapping
|
|
9
|
+
{
|
|
10
|
+
public Task<ScriptResponse> InputHandler(WorkflowTask task, ScriptContext context)
|
|
11
|
+
{
|
|
12
|
+
return Task.FromResult(new ScriptResponse());
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
public Task<ScriptResponse> OutputHandler(ScriptContext context)
|
|
16
|
+
{
|
|
17
|
+
return Task.FromResult(new ScriptResponse
|
|
18
|
+
{
|
|
19
|
+
Data = new { status = "activated" }
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
using System.Threading.Tasks;
|
|
2
|
+
using BBT.Workflow.Scripting;
|
|
3
|
+
using BBT.Workflow.Definitions;
|
|
4
|
+
|
|
5
|
+
/// <summary>
|
|
6
|
+
/// Sets instance data status to "deactive". Used in chat-room deactivate transition onExecutionTasks.
|
|
7
|
+
/// </summary>
|
|
8
|
+
public class SetChatRoomStatusDeactiveMapping : ScriptBase, IMapping
|
|
9
|
+
{
|
|
10
|
+
public Task<ScriptResponse> InputHandler(WorkflowTask task, ScriptContext context)
|
|
11
|
+
{
|
|
12
|
+
return Task.FromResult(new ScriptResponse());
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
public Task<ScriptResponse> OutputHandler(ScriptContext context)
|
|
16
|
+
{
|
|
17
|
+
return Task.FromResult(new ScriptResponse
|
|
18
|
+
{
|
|
19
|
+
Data = new { status = "deactived" }
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
using System;
|
|
2
|
+
using System.Threading.Tasks;
|
|
3
|
+
using BBT.Workflow.Scripting;
|
|
4
|
+
using BBT.Workflow.Definitions;
|
|
5
|
+
|
|
6
|
+
/// <summary>
|
|
7
|
+
/// Mapping for set-previous-advisor Script Task (Type 7).
|
|
8
|
+
/// Stores context.Instance.Data.advisor as previousAdvisor on the instance.
|
|
9
|
+
/// Used when: (1) create-appointment - advisor is current before merge; (2) to-active - advisor is the new one after update-control processing.
|
|
10
|
+
/// Script task only returns OutputHandler data; no HTTP or StartTask calls.
|
|
11
|
+
/// </summary>
|
|
12
|
+
public class SetPreviousAdvisorMapping : ScriptBase, IMapping
|
|
13
|
+
{
|
|
14
|
+
public Task<ScriptResponse> InputHandler(WorkflowTask task, ScriptContext context)
|
|
15
|
+
{
|
|
16
|
+
return Task.FromResult(new ScriptResponse());
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
public Task<ScriptResponse> OutputHandler(ScriptContext context)
|
|
20
|
+
{
|
|
21
|
+
var advisor = context.Instance?.Data?.advisor?.ToString()?.Trim();
|
|
22
|
+
return Task.FromResult(new ScriptResponse
|
|
23
|
+
{
|
|
24
|
+
Key = "set-previous-advisor-output",
|
|
25
|
+
Data = new { previousAdvisor = advisor ?? (string)null }
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
using System.Threading.Tasks;
|
|
2
|
+
using BBT.Workflow.Scripting;
|
|
3
|
+
using BBT.Workflow.Definitions;
|
|
4
|
+
|
|
5
|
+
/// <summary>
|
|
6
|
+
/// Populate sub (from Headers sub) into the workflow instance data.
|
|
7
|
+
/// Used at start so subsequent tasks (e.g. get-user-info-for-rezervation) read sub from data.
|
|
8
|
+
/// </summary>
|
|
9
|
+
public class SetUserFromHeadersForRezervationMapping : ScriptBase, IMapping
|
|
10
|
+
{
|
|
11
|
+
public Task<ScriptResponse> InputHandler(WorkflowTask task, ScriptContext context)
|
|
12
|
+
{
|
|
13
|
+
return Task.FromResult(new ScriptResponse());
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
public Task<ScriptResponse> OutputHandler(ScriptContext context)
|
|
17
|
+
{
|
|
18
|
+
var sub = context.Headers?["sub"]?.ToString()?.Trim();
|
|
19
|
+
return Task.FromResult(new ScriptResponse
|
|
20
|
+
{
|
|
21
|
+
Data = new { sub }
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
}
|