wingbot 3.68.0-alpha.1 → 3.68.0-alpha.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 (2) hide show
  1. package/package.json +1 -1
  2. package/src/Responder.js +19 -8
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wingbot",
3
- "version": "3.68.0-alpha.1",
3
+ "version": "3.68.0-alpha.2",
4
4
  "description": "Enterprise Messaging Bot Conversation Engine",
5
5
  "main": "index.js",
6
6
  "type": "commonjs",
package/src/Responder.js CHANGED
@@ -48,7 +48,8 @@ Object.freeze(ExpectedInput);
48
48
  * @typedef {object} ExpectedInputOptions
49
49
  * @prop {string} [url]
50
50
  * @prop {string} [webview_height_ratio]
51
- * @prop {string} [on_close_payload]
51
+ * @prop {string} [onCloseAction]
52
+ * @prop {string} [onCloseActionData]
52
53
  */
53
54
 
54
55
  /**
@@ -907,8 +908,14 @@ class Responder {
907
908
  * });
908
909
  */
909
910
  expectedInput (type, options = {}) {
911
+ const { onCloseAction, onCloseActionData = {}, ...rest } = options;
912
+ if (onCloseAction) {
913
+ Object.assign(rest, {
914
+ on_close_payload: this._makePayload(onCloseAction, onCloseActionData)
915
+ });
916
+ }
910
917
  this._messageSender.send({
911
- expectedIntentsAndEntities: [{ type, ...options }]
918
+ expectedIntentsAndEntities: [{ type, ...rest }]
912
919
  });
913
920
  return this;
914
921
  }
@@ -1063,16 +1070,20 @@ class Responder {
1063
1070
  return this.template({
1064
1071
  template_type: 'one_time_notif_req',
1065
1072
  title: this._t(title),
1066
- payload: JSON.stringify({
1067
- action: makeAbsolute(action, this.path),
1068
- data: {
1069
- ...data,
1070
- _ntfTag: tag
1071
- }
1073
+ payload: this._makePayload(action, {
1074
+ ...data,
1075
+ _ntfTag: tag
1072
1076
  })
1073
1077
  });
1074
1078
  }
1075
1079
 
1080
+ _makePayload (action, data) {
1081
+ return JSON.stringify({
1082
+ action: makeAbsolute(action, this.path),
1083
+ data
1084
+ });
1085
+ }
1086
+
1076
1087
  template (payload) {
1077
1088
  const messageData = {
1078
1089
  message: {