@tiledesk/tiledesk-tybot-connector 2.0.26 → 2.0.27
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/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -61,15 +61,24 @@ class DirContactUpdate {
|
|
|
61
61
|
}
|
|
62
62
|
const filler = new Filler();
|
|
63
63
|
let updateProperties = {}
|
|
64
|
+
|
|
65
|
+
//map the key from the action to the chatbot const variable key
|
|
66
|
+
const keyToChatbotConstMap = {
|
|
67
|
+
fullname: TiledeskChatbotConst.REQ_LEAD_USERFULLNAME_KEY,
|
|
68
|
+
email: TiledeskChatbotConst.REQ_LEAD_EMAIL_KEY,
|
|
69
|
+
phone: TiledeskChatbotConst.REQ_USER_PHONE_KEY,
|
|
70
|
+
currentPhoneNumber: TiledeskChatbotConst.REQ_CURRENT_PHONE_NUMBER_KEY,
|
|
71
|
+
userLeadId: TiledeskChatbotConst.REQ_USER_LEAD_ID_KEY,
|
|
72
|
+
company: TiledeskChatbotConst.REQ_USER_COMPANY_KEY
|
|
73
|
+
};
|
|
74
|
+
|
|
64
75
|
for (const [key, value] of Object.entries(contactProperties)) {
|
|
65
76
|
let filled_value = filler.fill(value, requestAttributes);
|
|
66
77
|
updateProperties[key] = filled_value;
|
|
67
78
|
// it's important that all the lead's properties are immediatly updated in the current flow invocation so the updated values will be available in the next actions
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
else if ( key === "email") {
|
|
72
|
-
await this.context.chatbot.addParameter(TiledeskChatbotConst.REQ_LEAD_EMAIL_KEY, filled_value);
|
|
79
|
+
const chatbotKey = keyToChatbotConstMap[key];
|
|
80
|
+
if (chatbotKey) {
|
|
81
|
+
await this.context.chatbot.addParameter(chatbotKey, filled_value);
|
|
73
82
|
}
|
|
74
83
|
}
|
|
75
84
|
const leadId = requestAttributes[TiledeskChatbotConst.REQ_USER_LEAD_ID_KEY];
|