You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* WIP new message controller
* update code
* only register scroll when carousel is connected
* extract a message builder function and attach the card attachment to the new message
* build a message object
* attach the new messageg
* remove width and height attributes from the attachment before inserting
* update key names
* update docs
* update payload structure for quick replies
* add tests
* add more tests and respond to setId
* properly handle carousel messages
* update code
* add reply after typing indicator when visible
* update tests
Copy file name to clipboardExpand all lines: docs/webchat.md
+14Lines changed: 14 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -102,6 +102,20 @@ The webchat emits the following events which can be listened to, to add an event
102
102
}
103
103
```
104
104
105
+
The payload may contain additional information about the product card clicked from a carousel message, the following
106
+
is an example of a payload of a card click
107
+
108
+
```javascript
109
+
{
110
+
id:'xxxxxx'
111
+
body:'The message the client sent',
112
+
attachments: [], // An array of File objects associated with the card
113
+
replied_to:'xxxx', // The ID of the message that was replied to by the button click.
114
+
product:'xxxx', // The ID of the product associated with the cart. You can fetch information about the product in https://www.hellotext.com/api#products
115
+
button:'xxxx'// The ID of the button that was clicked.
116
+
}
117
+
```
118
+
105
119
-`webchat:message:received` - Emitted when a message is received by the webchat from Hellotext. The message is passed as an argument to the callback, containing the following properties
function_toPrimitive(input,hint){if(typeofinput!=="object"||input===null)returninput;varprim=input[Symbol.toPrimitive];if(prim!==undefined){varres=prim.call(input,hint||"default");if(typeofres!=="object")returnres;thrownewTypeError("@@toPrimitive must return a primitive value.");}return(hint==="string" ? String : Number)(input);}
13
+
function_inherits(subClass,superClass){if(typeofsuperClass!=="function"&&superClass!==null){thrownewTypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor: {value: subClass,writable: true,configurable: true}});Object.defineProperty(subClass,"prototype",{writable: false});if(superClass)_setPrototypeOf(subClass,superClass);}
function_possibleConstructorReturn(self,call){if(call&&(typeofcall==="object"||typeofcall==="function")){returncall;}elseif(call!==void0){thrownewTypeError("Derived constructors may only return object or undefined");}return_assertThisInitialized(self);}
17
+
function_assertThisInitialized(self){if(self===void0){thrownewReferenceError("this hasn't been initialised - super() hasn't been called");}returnself;}
function_toPrimitive(input,hint){if(typeofinput!=="object"||input===null)returninput;varprim=input[Symbol.toPrimitive];if(prim!==undefined){varres=prim.call(input,hint||"default");if(typeofres!=="object")returnres;thrownewTypeError("@@toPrimitive must return a primitive value.");}return(hint==="string" ? String : Number)(input);}
6
+
function_inherits(subClass,superClass){if(typeofsuperClass!=="function"&&superClass!==null){thrownewTypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor: {value: subClass,writable: true,configurable: true}});Object.defineProperty(subClass,"prototype",{writable: false});if(superClass)_setPrototypeOf(subClass,superClass);}
function_possibleConstructorReturn(self,call){if(call&&(typeofcall==="object"||typeofcall==="function")){returncall;}elseif(call!==void0){thrownewTypeError("Derived constructors may only return object or undefined");}return_assertThisInitialized(self);}
10
+
function_assertThisInitialized(self){if(self===void0){thrownewReferenceError("this hasn't been initialised - super() hasn't been called");}returnself;}
0 commit comments