Coder Social home page Coder Social logo

baha-a / byk-widget-mvp Goto Github PK

View Code? Open in Web Editor NEW

This project forked from buerokratt/byk-widget-mvp

0.0 0.0 0.0 1.49 MB

MVP version of Buerokratt Chat Widget

License: MIT License

JavaScript 1.60% TypeScript 90.23% HTML 2.79% Dockerfile 0.40% SCSS 4.97%

byk-widget-mvp's Introduction

Bürokratt Widget

Available Scripts

In the project directory, you can run:

npm start

Runs the app in the development mode.
Open http://localhost:3000 to view it in the browser.

The page will reload if you make edits.
You will also see any lint errors in the console.

npm test

Launches the test runner in the interactive watch mode.
See the section about running tests for more information.

npm test:coverage

Launches the test runner and displays code coverage

npm run build

Builds the app for production to the build folder.
It correctly bundles React in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes.\

npm run webpack

Bundles the app into a single bundle named widget_bundle.js for easy embedding

Snippet embedding

Snippet can be embedded to any site using the following html:

<div id="byk-va"></div>
<script>
  window._env_ = {
    RUUTER_API_URL: 'LOCATION_OF_RUUTER',
    TIM_AUTHENTICATION_URL: 'TIM url with callback parameter',
    NOTIFICATION_NODE_URL: 'LOCATION_OF_NOTIFICATION_SERVER',
    OFFICE_HOURS: {
      TIMEZONE: 'Europe/Tallinn',
      BEGIN: 8,
      END: 17,
      DAYS: [1, 2, 4, 5],
    },
    other variables...
  };
</script>
<script id="script-bundle" type="text/javascript" src="LOCATION_OF_WIDGET_BUNDLE" crossorigin=""></script>

Configurable variables

  • RUUTER_API_URL: Location of back end for fetching data
  • TIM_AUTHENTICATION_URL: Link to authenticate user
  • OFFICE_HOURS: If this variable is added, widget will be hidden when not in defined work hours. If this variable is not added, the widget will always be displayed
    • TIMEZONE: Used for comparing the following variables against a specific timezone.
    • BEGIN: Beginning of office hours. If current time is before this hour (24H), the widget will not be displayed
    • END: End of office hours. If current time is after this hour (24H), the widget will not be displayed
    • DAYS: List of days in numbers, where 1=monday, 2=tuesday, 3=wednesday... If current day is in the list of days, the widget will be displayed according to BEGIN and END times.

Rasa Buttons Support

In order for Rasa buttons to be supported this Pull Request must be merged and deployed. Other option is to merge and deploy it manually using these steps:

  • Add m.buttons, to the SELECT statement of DSL.Resql/get-chat-messages-updated-after-time.sql as in here

  • Add m.buttons, to the SELECT statement of DSL.Resql/get-chat-messages.sql as in here

  • Add "buttons": "{{buttons}}", in line number 5 of DSL.DMapper/format_chat_log.hbs as in here

  • Add the following line

    "buttons": "[{{#each buttons}}{\"title\": \"{{{escape_special_chars title}}}\",\"payload\": \"{{{escape_special_chars payload}}}\"}{{#unless @last}},{{/unless}}{{/each}}]",
    

    in line number 6 of DSL.DMapper/bot_responses_to_messages.hbs as in here

  • Add buttons, into the SELECT statement of DSL.Resql/get-message-by-id.sql as in here

  • Add buttons, into the SELECT statement of DSL.Resql/get-messages-by-ids.sql as in here

  • Inside file DSL.Resql/insert-bot-message.sql do

    • Add buttons, into the INSERT INTO as in here
    • Add (SELECT value) ->> 'buttons' AS buttons, into the SELECT statement as in here
  • Copy database migration file into DSL.Liquibase/changelog/20231116124800_add_buttons_to_messages.xml

  • Run database migration by executing this command

    docker run --rm --network bykstack -v `pwd`/DSL.Liquibase/changelog:/liquibase/changelog -v `pwd`/DSL.Liquibase/master.yml:/liquibase/master.yml -v `pwd`/DSL.Liquibase/data:/liquibase/data liquibase/liquibase --defaultsFile=/liquibase/changelog/liquibase.properties --changelog-file=master.yml --url=jdbc:postgresql://users_db:5432/byk?user=byk --password=01234 update
    

Licence

See licence here.

byk-widget-mvp's People

Contributors

baha-a avatar varmoh avatar 1ahmedyasser avatar paulamerle avatar turnerrainer avatar klvig avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.