How to use the @botonic/core.params2queryString function in @botonic/core

To help you get started, we’ve selected a few @botonic/core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github hubtype / botonic / packages / botonic-react / src / webview.jsx View on Github external
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;
        }
github hubtype / botonic / packages / botonic-react / src / webchat / webchat.jsx View on Github external
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}`)
    }
  }
github hubtype / botonic / packages / botonic-react / src / webchat.jsx View on Github external
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}`)
        }
    }
github hubtype / botonic / packages / botonic-react / src / components / button.jsx View on Github external
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>
    }
  }