wingbot 3.65.3 → 3.65.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wingbot",
3
- "version": "3.65.3",
3
+ "version": "3.65.5",
4
4
  "description": "Enterprise Messaging Bot Conversation Engine",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/src/Responder.js CHANGED
@@ -779,7 +779,7 @@ class Responder {
779
779
  e.match
780
780
  .forEach((rule) => {
781
781
  if (rule.startsWith('#')) {
782
- if (!rule.match(/^#(\|?[a-z0-9-]+)+$/i)) {
782
+ if (!rule.match(/^#(\|?[a-z0-9-]+)+#?$/i)) {
783
783
  return;
784
784
  }
785
785
  const keywords = rule.match(/\|?[a-z0-9-]+/ig)
@@ -78,11 +78,14 @@ class GenericTemplate extends ButtonTemplate {
78
78
  *
79
79
  * @param {string} action - Button action (can be absolute or relative)
80
80
  * @param {object} [data={}] - Action data
81
+ * @param {object} [setState] - SetState data
81
82
  * @returns {this}
82
83
  *
83
84
  * @memberOf GenericTemplate
84
85
  */
85
- setElementActionPostback (action, data = {}) {
86
+ setElementActionPostback (action, data = {}, setState = null) {
87
+ const hasSetState = setState && Object.keys(setState).length !== 0;
88
+
86
89
  Object.assign(this._element, {
87
90
  default_action: {
88
91
  type: 'postback',
@@ -91,7 +94,8 @@ class GenericTemplate extends ButtonTemplate {
91
94
  data: {
92
95
  _ca: this.context.currentAction,
93
96
  ...data
94
- }
97
+ },
98
+ ...(hasSetState ? { setState } : {})
95
99
  })
96
100
  }
97
101
  });
@@ -134,6 +138,7 @@ class GenericTemplate extends ButtonTemplate {
134
138
  return this;
135
139
  }
136
140
 
141
+ // @ts-ignore
137
142
  getTemplate () {
138
143
  this._attachAndClearButtons();
139
144
  const res = {