Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async close(options) {
let payload = options ? options.payload : null
if (options.path) payload = `__PATH_PAYLOAD__${options.path}`
if (payload) {
if (options.params) {
payload = `${payload}?${params2queryString(options.params)}`
}
let s = this.state.session
try {
let base_url = s._hubtype_api || 'https://api.hubtype.com'
let resp = await axios({
method: 'post',
url: `${base_url}/v1/bots/${s.bot.id}/send_postback/`,
data: { payload: payload, chat_id: s.user.id }
})
} catch (e) {
console.log(e)
}
}
if (this.state.session.user.provider === 'whatsappnew') {
location.href = 'https://wa.me/' + this.state.session.user.imp_id;
}
const closeWebview = options => {
updateWebview()
if (userInputEnabled) {
textArea.current.focus()
}
if (options && options.payload) {
sendPayload(options.payload)
} else if (options && options.path) {
let params = ''
if (options.params) params = params2queryString(options.params)
sendPayload(`__PATH_PAYLOAD__${options.path}?${params}`)
}
}
closeWebview(options) {
this.setState({ ...this.state, webview: null })
this.textarea.focus()
if (options && options.payload) {
this.sendPayload(options.payload)
} else if (options && options.path) {
let params = ''
if (options.params) params = params2queryString(options.params)
this.sendPayload(`__PATH_PAYLOAD__${options.path}?${params}`)
}
}
const renderNode = () => {
if (props.webview) {
let Webview = props.webview
let params = ''
if (props.params) params = params2queryString(props.params)
return (
<button>
{props.children}
</button>
)
} else if (props.path) {
let payload = `__PATH_PAYLOAD__${props.path}`
return <button>{props.children}</button>
} else if (props.payload) {
return <button>{props.children}</button>
} else if (props.url) {
return <button>{props.children}</button>
}
}