From 9385e1e19395a2cbb47fbde223f766069a5e8c36 Mon Sep 17 00:00:00 2001 From: mohiit1502 Date: Thu, 26 Jul 2018 04:39:39 +0530 Subject: [PATCH] Bundled refactored changes --- dist/bundle.js | 255 +++++++++++++++++++++++++++++++----------------- dist/index.html | 160 ++---------------------------- 2 files changed, 177 insertions(+), 238 deletions(-) diff --git a/dist/bundle.js b/dist/bundle.js index 1845ccd..97bf7f7 100644 --- a/dist/bundle.js +++ b/dist/bundle.js @@ -104,7 +104,7 @@ eval("exports = module.exports = __webpack_require__(/*! ../../../node_modules/c /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { -eval("exports = module.exports = __webpack_require__(/*! ../../../node_modules/css-loader/lib/css-base.js */ \"./node_modules/css-loader/lib/css-base.js\")(false);\n// imports\n\n\n// module\nexports.push([module.i, \"body {\\n font-family: 'Poppins', sans-serif;\\n background-color: #252525; }\\n\\np {\\n font-family: 'Poppins', sans-serif;\\n font-size: 1.1em;\\n font-weight: 300;\\n line-height: 1.7em;\\n color: #999; }\\n\\na,\\na:hover,\\na:focus {\\n color: inherit;\\n text-decoration: none;\\n transition: all 0.3s; }\\n\\n.navbar {\\n padding: 15px 10px;\\n background: #fff;\\n border: none;\\n border-radius: 0 5px 5px 0;\\n margin-bottom: 40px;\\n box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.1); }\\n\\n.navbar-btn {\\n box-shadow: none;\\n outline: none !important;\\n border: none; }\\n\\n.line {\\n width: 100%;\\n height: 1px;\\n border-bottom: 1px dashed #ddd;\\n margin: 20px 0; }\\n\\ni,\\nspan {\\n display: inline-block; }\\n\\n/* ---------------------------------------------------\\r\\n SIDEBAR STYLE\\r\\n----------------------------------------------------- */\\n.wrapper {\\n display: flex;\\n align-items: stretch; }\\n\\n#sidebar {\\n min-width: 250px;\\n max-width: 250px;\\n background: #f39c12;\\n color: #252525;\\n transition: all 0.3s; }\\n\\n#sidebar.active {\\n min-width: 80px;\\n max-width: 80px;\\n text-align: center; }\\n\\n#sidebar.active .sidebar-header h3,\\n#sidebar.active .CTAs {\\n display: none; }\\n\\n.sidebar-header h3 {\\n display: inline;\\n padding-left: 0.6em;\\n vertical-align: middle; }\\n\\n#sidebar.active .sidebar-header strong {\\n display: block; }\\n\\n#sidebar ul li a {\\n text-align: left; }\\n\\n#sidebar.active ul li a {\\n padding: 20px 10px;\\n text-align: center;\\n font-size: 0.85em; }\\n\\n#sidebar.active ul li a i {\\n margin-right: 0;\\n display: block;\\n font-size: 1.8em;\\n margin-bottom: 5px; }\\n\\n#sidebar.active ul ul a {\\n padding: 10px !important; }\\n\\n#sidebar.active .dropdown-toggle::after {\\n top: auto;\\n bottom: 10px;\\n right: 50%;\\n -webkit-transform: translateX(50%);\\n -ms-transform: translateX(50%);\\n transform: translateX(50%); }\\n\\n#sidebar .sidebar-header {\\n padding: 20px;\\n background: #252525; }\\n\\n#sidebar .sidebar-header strong {\\n display: none;\\n font-size: 1.8em; }\\n\\n#sidebar ul.components {\\n padding: 20px 0;\\n border-bottom: 3px solid #252525; }\\n\\n#sidebar ul li a {\\n padding: 10px;\\n font-size: 1.1em;\\n display: block; }\\n\\n#sidebar ul li a:hover {\\n color: #7386D5;\\n background: #fff; }\\n\\n#sidebar ul li a i {\\n margin-right: 10px; }\\n\\n#sidebar ul li.active > a,\\na[aria-expanded=\\\"true\\\"] {\\n color: #f39c12;\\n background: #252525; }\\n\\na[data-toggle=\\\"collapse\\\"] {\\n position: relative; }\\n\\n.dropdown-toggle::after {\\n display: block;\\n position: absolute;\\n top: 50%;\\n right: 20px;\\n transform: translateY(-50%); }\\n\\nul ul a {\\n font-size: 0.9em !important;\\n padding-left: 30px !important;\\n background: white;\\n font-weight: bolder; }\\n\\nul.CTAs {\\n padding: 20px; }\\n\\nul.CTAs a {\\n text-align: center;\\n font-size: 0.9em !important;\\n display: block;\\n border-radius: 5px;\\n margin-bottom: 5px; }\\n\\na.download {\\n background: #fff;\\n color: #7386D5; }\\n\\na.article,\\na.article:hover {\\n background: #6d7fcc !important;\\n color: #fff !important; }\\n\\n/* ---------------------------------------------------\\r\\n CONTENT STYLE\\r\\n----------------------------------------------------- */\\n#content {\\n width: 100%;\\n padding: 20px;\\n min-height: 100vh;\\n transition: all 0.3s; }\\n\\n/* ---------------------------------------------------\\r\\n MEDIAQUERIES\\r\\n----------------------------------------------------- */\\n@media (max-width: 768px) {\\n #sidebar {\\n min-width: 80px;\\n max-width: 80px;\\n text-align: center;\\n margin-left: -80px !important; }\\n .dropdown-toggle::after {\\n top: auto;\\n bottom: 10px;\\n right: 50%;\\n -webkit-transform: translateX(50%);\\n -ms-transform: translateX(50%);\\n transform: translateX(50%); }\\n #sidebar.active {\\n margin-left: 0 !important; }\\n #sidebar .sidebar-header h3,\\n #sidebar .CTAs {\\n display: none; }\\n #sidebar .sidebar-header strong {\\n display: block; }\\n #sidebar ul li a {\\n padding: 20px 10px; }\\n #sidebar ul li a span {\\n font-size: 0.85em; }\\n #sidebar ul li a i {\\n margin-right: 0;\\n display: block; }\\n #sidebar ul ul a {\\n padding: 10px !important; }\\n #sidebar ul li a i {\\n font-size: 1.3em; }\\n #sidebar {\\n margin-left: 0; }\\n #sidebarCollapse span {\\n display: none; }\\n .text-muted {\\n color: #bcb !important; } }\\n\\n@media (min-width: 576px) {\\n .card-group > .card:first-child {\\n border-top-right-radius: .25rem;\\n border-bottom-right-radius: .25rem; }\\n .card-group > .card:not(:first-child):not(:last-child):not(:only-child) {\\n border-radius: .25rem; }\\n .card-group > .card:last-child {\\n border-top-left-radius: .25rem;\\n border-bottom-left-radius: .25rem; } }\\n\\n/* -------------------------------------------------\\r\\nADDITIONS\\r\\n--------------------------------------------------*/\\n.hide {\\n display: none; }\\n\\n.prompt {\\n display: flex;\\n width: 2em;\\n border-right: 1px solid #c99034;\\n background-color: #f5d38b;\\n width: 4%;\\n margin-bottom: 40px;\\n border-radius: 4px 0 0 4px; }\\n\\n.promptext {\\n animation: blinkingText 0.8s infinite;\\n color: #975f04;\\n text-align: center;\\n line-height: 2em;\\n font: 1.5em bolder;\\n margin: auto; }\\n\\n.good {\\n animation: anim .3s ease-in-out; }\\n\\n.repoLink {\\n color: #000;\\n font-weight: bolder;\\n text-decoration: underline; }\\n\\n.headerprompt {\\n display: flex;\\n width: 100%; }\\n\\n.logotext {\\n color: #f39c12; }\\n\\n#content nav div.collapse li a.nav-link i.far {\\n color: #f39c12;\\n font-size: 1.8em;\\n padding: 0.2em; }\\n\\n#loading-img {\\n background: url(http://preloaders.net/preloaders/360/Velocity.gif) center center no-repeat;\\n height: 100%;\\n z-index: 20; }\\n\\n.overlay {\\n background: #e9e9e9;\\n display: none;\\n position: absolute;\\n top: 0;\\n right: 0;\\n bottom: 0;\\n left: 0;\\n opacity: 0.5; }\\n\\n.loader {\\n border: 0px solid #f3f3f3;\\n border-radius: 50%;\\n border-top: 2px solid #3498db;\\n border-right: 2px solid #3498db;\\n width: 20px;\\n height: 20px;\\n -webkit-animation: spin 2s linear infinite;\\n /* Safari */\\n animation: spin 2s linear infinite; }\\n\\n@keyframes spin {\\n 0% {\\n transform: rotate(0deg); }\\n 100% {\\n transform: rotate(360deg); } }\\n\\n@keyframes anim {\\n 0% {\\n display: none;\\n opacity: 0; }\\n 1% {\\n display: block;\\n opacity: 0;\\n transform: scale(0); }\\n 100% {\\n opacity: 1;\\n transform: scale(1); } }\\n\\n@keyframes blinkingText {\\n 0% {\\n color: #000; }\\n 49% {\\n color: transparent; }\\n 50% {\\n color: transparent; }\\n 99% {\\n color: transparent; }\\n 100% {\\n color: #000; } }\\n\\n/* --------------------------------------------------\\r\\n OVERRIDES\\r\\n --------------------------------------------------*/\\n.btn {\\n background-color: #f39c12;\\n color: #252525; }\\n\\n#content #header .navbar {\\n width: 96%; }\\n\\n.navbar-form {\\n width: 88%; }\\n\\n.form-control {\\n padding: .6rem 1em; }\\n\\n.container-fluid {\\n padding-left: 0.3em; }\\n\\n.card-group {\\n flex-direction: column; }\\n\\n#command.form-control {\\n width: 87%; }\\n\\n.ml-auto {\\n margin-left: 0 !important; }\\n\", \"\"]);\n\n// exports\n\n\n//# sourceURL=webpack:///./src/styles/scss/base.scss?./node_modules/css-loader!./node_modules/sass-loader/lib/loader.js"); +eval("exports = module.exports = __webpack_require__(/*! ../../../node_modules/css-loader/lib/css-base.js */ \"./node_modules/css-loader/lib/css-base.js\")(false);\n// imports\n\n\n// module\nexports.push([module.i, \"body {\\n font-family: 'Poppins', sans-serif;\\n background-color: #252525; }\\n\\np {\\n font-family: 'Poppins', sans-serif;\\n font-size: 1.1em;\\n font-weight: 300;\\n line-height: 1.7em;\\n color: #999; }\\n\\na,\\na:hover,\\na:focus {\\n color: inherit;\\n text-decoration: none;\\n transition: all 0.3s; }\\n\\n.navbar {\\n padding: 15px 10px;\\n background: #fff;\\n border: none;\\n border-radius: 0 5px 5px 0;\\n margin-bottom: 40px;\\n box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.1); }\\n\\n.navbar-btn {\\n box-shadow: none;\\n outline: none !important;\\n border: none; }\\n\\n.line {\\n width: 100%;\\n height: 1px;\\n border-bottom: 1px dashed #ddd;\\n margin: 20px 0; }\\n\\ni,\\nspan {\\n display: inline-block; }\\n\\n/* ---------------------------------------------------\\r\\n SIDEBAR STYLE\\r\\n----------------------------------------------------- */\\n.wrapper {\\n display: flex;\\n align-items: stretch; }\\n\\n#sidebar {\\n min-width: 250px;\\n max-width: 250px;\\n background: #f39c12;\\n color: #252525;\\n transition: all 0.3s; }\\n\\n#sidebar.active {\\n min-width: 80px;\\n max-width: 80px;\\n text-align: center; }\\n\\n#sidebar.active .sidebar-header h3,\\n#sidebar.active .CTAs {\\n display: none; }\\n\\n.sidebar-header h3 {\\n display: inline;\\n padding-left: 0.6em;\\n vertical-align: middle; }\\n\\n#sidebar.active .sidebar-header strong {\\n display: block; }\\n\\n#sidebar ul li a {\\n text-align: left; }\\n\\n#sidebar.active ul li a {\\n padding: 20px 10px;\\n text-align: center;\\n font-size: 0.85em; }\\n\\n#sidebar.active ul li a i {\\n margin-right: 0;\\n display: block;\\n font-size: 1.8em;\\n margin-bottom: 5px; }\\n\\n#sidebar.active ul ul a {\\n padding: 10px !important; }\\n\\n#sidebar.active .dropdown-toggle::after {\\n top: auto;\\n bottom: 10px;\\n right: 50%;\\n -webkit-transform: translateX(50%);\\n -ms-transform: translateX(50%);\\n transform: translateX(50%); }\\n\\n#sidebar .sidebar-header {\\n padding: 20px;\\n background: #252525; }\\n\\n#sidebar .sidebar-header strong {\\n display: none;\\n font-size: 1.8em; }\\n\\n#sidebar ul.components {\\n padding: 20px 0;\\n border-bottom: 3px solid #252525; }\\n\\n#sidebar ul li a {\\n padding: 10px;\\n font-size: 1.1em;\\n display: block; }\\n\\n#sidebar ul li a:hover {\\n color: #7386D5;\\n background: #fff; }\\n\\n#sidebar ul li a i {\\n margin-right: 10px; }\\n\\n#sidebar ul li.active > a,\\na[aria-expanded=\\\"true\\\"] {\\n color: #f39c12;\\n background: #252525; }\\n\\na[data-toggle=\\\"collapse\\\"] {\\n position: relative; }\\n\\n.dropdown-toggle::after {\\n display: block;\\n position: absolute;\\n top: 50%;\\n right: 20px;\\n transform: translateY(-50%); }\\n\\nul ul a {\\n font-size: 0.9em !important;\\n padding-left: 30px !important;\\n background: white;\\n font-weight: bolder; }\\n\\nul.CTAs {\\n padding: 20px; }\\n\\nul.CTAs a {\\n text-align: center;\\n font-size: 0.9em !important;\\n display: block;\\n border-radius: 5px;\\n margin-bottom: 5px; }\\n\\na.download {\\n background: #fff;\\n color: #7386D5; }\\n\\na.article,\\na.article:hover {\\n background: #6d7fcc !important;\\n color: #fff !important; }\\n\\n/* ---------------------------------------------------\\r\\n CONTENT STYLE\\r\\n----------------------------------------------------- */\\n#content {\\n width: 100%;\\n padding: 20px;\\n min-height: 100vh;\\n transition: all 0.3s; }\\n\\n/* ---------------------------------------------------\\r\\n MEDIAQUERIES\\r\\n----------------------------------------------------- */\\n@media (max-width: 768px) {\\n #sidebar {\\n min-width: 80px;\\n max-width: 80px;\\n text-align: center;\\n margin-left: -80px !important; }\\n .dropdown-toggle::after {\\n top: auto;\\n bottom: 10px;\\n right: 50%;\\n -webkit-transform: translateX(50%);\\n -ms-transform: translateX(50%);\\n transform: translateX(50%); }\\n #sidebar.active {\\n margin-left: 0 !important; }\\n #sidebar .sidebar-header h3,\\n #sidebar .CTAs {\\n display: none; }\\n #sidebar .sidebar-header strong {\\n display: block; }\\n #sidebar ul li a {\\n padding: 20px 10px; }\\n #sidebar ul li a span {\\n font-size: 0.85em; }\\n #sidebar ul li a i {\\n margin-right: 0;\\n display: block; }\\n #sidebar ul ul a {\\n padding: 10px !important; }\\n #sidebar ul li a i {\\n font-size: 1.3em; }\\n #sidebar {\\n margin-left: 0; }\\n #sidebarCollapse span {\\n display: none; }\\n .text-muted {\\n color: #bcb !important; } }\\n\\n@media (min-width: 576px) {\\n .card-group > .card:first-child {\\n border-top-right-radius: .25rem;\\n border-bottom-right-radius: .25rem; }\\n .card-group > .card:not(:first-child):not(:last-child):not(:only-child) {\\n border-radius: .25rem; }\\n .card-group > .card:last-child {\\n border-top-left-radius: .25rem;\\n border-bottom-left-radius: .25rem; } }\\n\\n/* -------------------------------------------------\\r\\nADDITIONS\\r\\n--------------------------------------------------*/\\n.hide {\\n display: none; }\\n\\n.prompt {\\n display: flex;\\n width: 2em;\\n border-right: 1px solid #c99034;\\n background-color: #f5d38b;\\n width: 4%;\\n margin-bottom: 40px;\\n border-radius: 4px 0 0 4px; }\\n\\n.promptext {\\n animation: blinkingText 0.8s infinite;\\n color: #975f04;\\n text-align: center;\\n line-height: 2em;\\n font: 1.5em bolder;\\n margin: auto; }\\n\\n.good {\\n animation: anim .3s ease-in-out; }\\n\\n.repoLink {\\n color: #000;\\n font-weight: bolder;\\n text-decoration: underline; }\\n\\n.headerprompt {\\n display: flex;\\n width: 100%; }\\n\\n.logotext {\\n color: #f39c12; }\\n\\n#content nav div.collapse li a.nav-link i.far {\\n color: #f39c12;\\n font-size: 1.8em;\\n padding: 0.2em; }\\n\\n#loading-img {\\n background: url(http://preloaders.net/preloaders/360/Velocity.gif) center center no-repeat;\\n height: 100%;\\n z-index: 20; }\\n\\n.overlay {\\n background: #e9e9e9;\\n display: none;\\n position: absolute;\\n top: 0;\\n right: 0;\\n bottom: 0;\\n left: 0;\\n opacity: 0.5; }\\n\\n.loader {\\n border: 0px solid #f3f3f3;\\n border-radius: 50%;\\n border-top: 2px solid #3498db;\\n border-right: 2px solid #3498db;\\n width: 20px;\\n height: 20px;\\n -webkit-animation: spin 2s linear infinite;\\n /* Safari */\\n animation: spin 2s linear infinite; }\\n\\n.light-red {\\n background-color: #f3d98c; }\\n\\n@keyframes spin {\\n 0% {\\n transform: rotate(0deg); }\\n 100% {\\n transform: rotate(360deg); } }\\n\\n@keyframes anim {\\n 0% {\\n display: none;\\n opacity: 0; }\\n 1% {\\n display: block;\\n opacity: 0;\\n transform: scale(0); }\\n 100% {\\n opacity: 1;\\n transform: scale(1); } }\\n\\n@keyframes blinkingText {\\n 0% {\\n color: #000; }\\n 49% {\\n color: transparent; }\\n 50% {\\n color: transparent; }\\n 99% {\\n color: transparent; }\\n 100% {\\n color: #000; } }\\n\\n/* --------------------------------------------------\\r\\n OVERRIDES\\r\\n --------------------------------------------------*/\\n.btn {\\n background-color: #f39c12;\\n color: #252525; }\\n\\n#content #header .navbar {\\n width: 96%; }\\n\\n.navbar-form {\\n width: 88%; }\\n\\n.form-control {\\n padding: .6rem 1em; }\\n\\n.container-fluid {\\n padding-left: 0.3em; }\\n\\n.card-group {\\n flex-direction: column; }\\n\\n#command.form-control {\\n width: 87%; }\\n\\n.ml-auto {\\n margin-left: 0 !important; }\\n\", \"\"]);\n\n// exports\n\n\n//# sourceURL=webpack:///./src/styles/scss/base.scss?./node_modules/css-loader!./node_modules/sass-loader/lib/loader.js"); /***/ }), @@ -199,6 +199,18 @@ eval("module.exports = function(originalModule) {\n\tif (!originalModule.webpack /***/ }), +/***/ "./src/js/app-event-triggers.js": +/*!**************************************!*\ + !*** ./src/js/app-event-triggers.js ***! + \**************************************/ +/*! no exports provided */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _services_recast_ops_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./services/recast-ops.js */ \"./src/js/services/recast-ops.js\");\n/* harmony import */ var _services_dom_ops_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./services/dom-ops.js */ \"./src/js/services/dom-ops.js\");\n/* harmony import */ var _services_microbot_ops_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./services/microbot-ops.js */ \"./src/js/services/microbot-ops.js\");\n/* harmony import */ var _helpers_helper_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./helpers/helper.js */ \"./src/js/helpers/helper.js\");\n/* harmony import */ var _services_persistent_ops_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./services/persistent-ops.js */ \"./src/js/services/persistent-ops.js\");\n\nconst recastclient = new _services_recast_ops_js__WEBPACK_IMPORTED_MODULE_0__[\"Recast\"]();\n\n\nconst dom = new _services_dom_ops_js__WEBPACK_IMPORTED_MODULE_1__[\"DomManipulator\"]();\n\n\nconst app = new _services_microbot_ops_js__WEBPACK_IMPORTED_MODULE_2__[\"Microbot\"]();\n\n\nconst helper = new _helpers_helper_js__WEBPACK_IMPORTED_MODULE_3__[\"Helper\"]();\n\n\n\nconst $config = __webpack_require__(/*! ./config.js */ \"./src/js/config.js\");\n\n$(document).ready(() => {\n // console.log('test');\n app.setToken();\n $('#sidebarCollapse').on('click', () => {\n $('#sidebar').toggleClass('active');\n $('.hideable').toggleClass('hide');\n });\n $('#content nav div.collapse li a.nav-link i.far.fa-star').hover(() => {\n $('#content nav div.collapse li a.nav-link i.far.fa-star').toggleClass('fas');\n });\n $('#content nav div.collapse li a.nav-link i.far.fa-trash-alt').hover(() => {\n $('#content nav div.collapse li a.nav-link i.far.fa-trash-alt').toggleClass('fas');\n });\n $('#content nav div.collapse li a.nav-link i.far.fa-paper-plane').hover(() => {\n $('#content nav div.collapse li a.nav-link i.far.fa-paper-plane').toggleClass('fas');\n });\n $('#command').keyup(e => {\n const code = e.keyCode ? e.keyCode : e.which;\n if (code == 13) {\n $('#widgets').children().addClass('hide');\n $('#successAlert').addClass('hide');\n $('#dangetAlert').addClass('hide');\n $('#intentBox').addClass('hide');\n const command = document.getElementById('command').value;\n if (command) {\n const text = { text: command };\n recastclient.getAndCallProcessIntent(command, text);\n } else {\n dom.showEmptyCommandMessage();\n }\n }\n });\n $('#btnFavorites').click(function () {});\n $('#btnClearCommand').click(function () {\n $('#command').val('');\n $('#command').focus();\n });\n $('#btnFireCommand').click(function () {\n hitEnter();\n });\n $('#btnSubmitConfirm').on('click', () => {\n $('#submitConfirm').removeClass('hide');\n });\n $('#submitGitData').on('click', () => {\n const data = dom.getDataFromFormAsJSON();\n const intent = $(`#${$config.costants.hiddenIntentFieldId}`).val();\n if (intent) {\n const operation = $config.intentSlugToOperations[intent].githubOperation;\n app[operation](data);\n }\n });\n $('#hideInfoAlert').on('click', () => {\n $('#intentBox').addClass('hide');\n });\n $('#hideSuccessAlert').on('click', () => {\n $('#successAlert').addClass('hide');\n });\n $('#conversations').on('click', '.close', function () {\n const $target = $(this).closest('.card');\n const line = $target.next();\n $target.hide('slow', () => {\n $target.remove();\n });\n line.hide('slow', () => {\n line.remove();\n });\n });\n $('#conversations').on('click', '.btn.btn-info.float-right', function () {\n let parentText = $(this).closest('.card-text').text();\n const command = parentText.substring(0, parentText.indexOf('Repeat'));\n hitEnter(command);\n });\n $('#hideDangerAlert').on('click', () => {\n $('#dangerAlert').addClass('hide');\n });\n $('#git_bridge').on('click', () => {\n window.location.href = 'https://github.com/login/oauth/authorize?scope=user:email:repo&client_id=f6f649a1fe2dfea082ba';\n });\n let localHistory = JSON.parse(window.localStorage.getItem('currentState'));\n window.onload = initOps();\n\n function initOps() {\n $('#command').focus();\n dom.loadConversations(helper.concatenateAndSort(localHistory));\n }\n function hitEnter(command) {\n let commandInputField = $('#command');\n if (command) commandInputField.val(command);\n let e = jQuery.Event(\"keyup\");\n e.which = 13;\n commandInputField.focus();\n commandInputField.trigger(e);\n }\n if (window.location.href.match(/\\?code=(.*)/)) {\n const code = window.location.href.match(/\\?code=(.*)/)[1];\n app.getToken(code);\n }\n});\n\n//# sourceURL=webpack:///./src/js/app-event-triggers.js?"); + +/***/ }), + /***/ "./src/js/app.js": /*!***********************!*\ !*** ./src/js/app.js ***! @@ -207,29 +219,7 @@ eval("module.exports = function(originalModule) {\n\tif (!originalModule.webpack /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _styles_scss_base_scss__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../styles/scss/base.scss */ \"./src/styles/scss/base.scss\");\n/* harmony import */ var _styles_scss_base_scss__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_styles_scss_base_scss__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _styles_css_base_css__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../styles/css/base.css */ \"./src/styles/css/base.css\");\n/* harmony import */ var _styles_css_base_css__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_styles_css_base_css__WEBPACK_IMPORTED_MODULE_1__);\n\n\n\n__webpack_require__(/*! ./event-toggles.js */ \"./src/js/event-toggles.js\");\n\n//# sourceURL=webpack:///./src/js/app.js?"); - -/***/ }), - -/***/ "./src/js/bot/config.js": -/*!******************************!*\ - !*** ./src/js/bot/config.js ***! - \******************************/ -/*! no static exports found */ -/***/ (function(module, exports) { - -eval("module.exports = {\n recasttoken: \"26021d055040a9d9f1ad48476efab4a0\"\n};\n\n//# sourceURL=webpack:///./src/js/bot/config.js?"); - -/***/ }), - -/***/ "./src/js/bot/recast-ops.js": -/*!**********************************!*\ - !*** ./src/js/bot/recast-ops.js ***! - \**********************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -eval("const $configBot = __webpack_require__(/*! ./config.js */ \"./src/js/bot/config.js\");\nconst $config = __webpack_require__(/*! ./../config.js */ \"./src/js/config.js\");\nconst Microbot = __webpack_require__(/*! ./../microbot-ops.js */ \"./src/js/microbot-ops.js\");\nconst app = new Microbot();\nconst DomManipulator = __webpack_require__(/*! ./../dom-ops.js */ \"./src/js/dom-ops.js\");\nconst domManipulator = new DomManipulator();\nconst PersistentOps = __webpack_require__(/*! ./../persistent-ops */ \"./src/js/persistent-ops.js\");\nconst persistentOps = new PersistentOps();\nconst $actions = $config.actions;\n\nmodule.exports = class Recast {\n constructor() {\n this.recastToken = $configBot.recasttoken;\n this.requestUrl = \"https://api.recast.ai/v2/request\";\n }\n\n getAndCallProcessIntent(command, text) {\n self = this;\n var url = this.requestUrl + \"?text=\" + command;\n var bodyRelevant = '';\n var intent = '';\n fetch(url, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json; charset=utf-8\",\n \"Authorization\": \"Token \" + this.recastToken\n },\n data: text\n }).then(function (response) {\n response.json().then(function (body) {\n bodyRelevant = body.results;\n intent = bodyRelevant.intents[0][\"slug\"];\n $('#' + $config.costants.hiddenIntentFieldId).val(intent);\n if (intent !== undefined) {\n domManipulator.displayIntentBox(intent);\n domManipulator.showWidget(intent);\n persistentOps.store.dispatch($actions.action_add_query);\n domManipulator.addGitOperationHistory(command, 'command');\n domManipulator.populateRecastData(intent, bodyRelevant);\n // self.processIntent(intent);\n }\n return intent;\n });\n }).catch(function (error) {\n console.error('Fetch Error =\\n', error);\n });\n }\n};\n\n//# sourceURL=webpack:///./src/js/bot/recast-ops.js?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _styles_scss_base_scss__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../styles/scss/base.scss */ \"./src/styles/scss/base.scss\");\n/* harmony import */ var _styles_scss_base_scss__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_styles_scss_base_scss__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _styles_css_base_css__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../styles/css/base.css */ \"./src/styles/css/base.css\");\n/* harmony import */ var _styles_css_base_css__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_styles_css_base_css__WEBPACK_IMPORTED_MODULE_1__);\n\n\n\n__webpack_require__(/*! ./app-event-triggers */ \"./src/js/app-event-triggers.js\");\n\n//# sourceURL=webpack:///./src/js/app.js?"); /***/ }), @@ -240,85 +230,174 @@ eval("const $configBot = __webpack_require__(/*! ./config.js */ \"./src/js/bot/c /*! no static exports found */ /***/ (function(module, exports) { -eval("module.exports = {\n gitToken: '96ead73c54cbbf023a73ee57af145b205d460851',\n intentSlugToOperations: {\n createrepo: {\n requestMethod: 'post',\n intentMessage: 'Create a Repository in Github',\n getDataOperation: 'getCreateRepoJson',\n githubOperation: 'createRepository',\n showWidgetOperation: 'showCreateRepoWidget',\n populateDataOperation: 'populateCreateRepoData',\n successMessage: 'Repository Added!',\n cardMsg: 'Requested Repository has been added and is available at ',\n cardDataUrl: 'html_url',\n cardDataName: 'name'\n },\n createissue: {\n requestMethod: 'post',\n intentMessage: 'Raise an issue in Github',\n getDataOperation: 'getCreateIssueJson',\n githubOperation: 'createIssue',\n showWidgetOperation: 'showCreateIssueWidget',\n populateDataOperation: 'populateCreateIssueData',\n successMessage: 'Issue Created!',\n cardMsg: 'Issue Created as requested, issue details available at ',\n cardDataUrl: 'html_url',\n cardDataName: 'title'\n },\n closeissue: {\n requestMethod: 'post',\n intentMessage: 'Close an issue in Github',\n getDataOperation: 'getCloseIssueJson',\n githubOperation: 'closeIssue',\n showWidgetOperation: 'showCloseIssueWidget',\n populateDataOperation: 'populateCloseIssueData',\n successMessage: 'Issue Closed!',\n cardMsg: 'Issue Closed as requested, closed issue available at: ',\n cardDataUrl: 'html_url',\n cardDataName: 'title'\n },\n addissuecomment: {\n requestMethod: 'post',\n intentMessage: 'Add a comment on an issue in Github',\n getDataOperation: 'getAddCommentJson',\n githubOperation: 'addIssueComment',\n showWidgetOperation: 'showAddCommentWidget',\n populateDataOperation: 'populateAddCommentData',\n successMessage: 'Comment Added!',\n cardMsg: 'Comment Added as Requested, view here: ',\n cardDataUrl: 'html_url',\n cardDataName: 'title'\n },\n displaylastcomment: {\n requestMethod: 'get',\n intentMessage: 'Display last comment of an issue in Github',\n getDataOperation: 'getDisplayCommentJson',\n githubOperation: 'displayLastComment',\n showWidgetOperation: 'showDisplayCommentWidget',\n populateDataOperation: 'populateDisplayCommentData',\n successMessage: 'Comment Retrieved!',\n cardMsg: 'Please find requested comment below: ',\n cardDataUrl: 'html_url',\n cardDataName: 'title'\n },\n addcollab: {\n requestMethod: 'post',\n intentMessage: 'Add a collaborator',\n getDataOperation: 'getAddCollaboratorJson',\n githubOperation: 'addCollaborator',\n showWidgetOperation: 'showAddCollaboratorWidget',\n populateDataOperation: 'populateAddCollaboratorData',\n successMessage: 'Collaborator Added!',\n cardMsg: 'Collaborator added, details available at ',\n cardDataUrl: 'html_url',\n cardDataName: 'invitee,login'\n },\n viewrepos: {\n requestMethod: 'get',\n intentMessage: 'View Repositories for current user',\n getDataOperation: 'getViewRepositoryJson',\n githubOperation: 'viewRepositories',\n showWidgetOperation: 'showViewRepoWidget',\n populateDataOperation: 'populateViewRepoData',\n successMessage: 'Showing repositories',\n cardMsg: 'Repository Details available below: ',\n cardDataUrl: 'html_url',\n cardDataName: 'invitee,login'\n }\n },\n costants: {\n hiddenIntentFieldId: 'intentHidden'\n },\n actions: {\n createrepo: { type: 'ADD_REPO' },\n addcollab: { type: 'ADD_COLLAB' },\n createissue: { type: 'ADD_ISSUE' },\n addissuecomment: { type: 'ADD_COMMENT' },\n closeissue: { type: 'CLOSE_ISSUE' },\n displaylastcomment: { type: 'SHOW_LAST_COMMENT' },\n viewrepos: { type: 'VIEW_REPO' },\n action_add_query: { type: 'ADD_QUERY' }\n }\n};\n\n//# sourceURL=webpack:///./src/js/config.js?"); +eval("module.exports = {\n gitToken: '96ead73c54cbbf023a73ee57af145b205d460851',\n recasttoken: \"26021d055040a9d9f1ad48476efab4a0\",\n intentSlugToOperations: {\n createrepo: {\n requestMethod: 'post',\n intentMessage: 'Create a Repository in Github',\n getDataOperation: 'getCreateRepoJson',\n githubOperation: 'createRepository',\n showWidgetOperation: 'showCreateRepoWidget',\n populateDataOperation: 'populateCreateRepoData',\n successMessage: 'Repository Added!',\n cardMsg: 'Requested Repository has been added and is available at ',\n cardDataUrl: 'html_url',\n cardDataName: 'name'\n },\n createissue: {\n requestMethod: 'post',\n intentMessage: 'Raise an issue in Github',\n getDataOperation: 'getCreateIssueJson',\n githubOperation: 'createIssue',\n showWidgetOperation: 'showCreateIssueWidget',\n populateDataOperation: 'populateCreateIssueData',\n successMessage: 'Issue Created!',\n cardMsg: 'Issue Created as requested, issue details available at ',\n cardDataUrl: 'html_url',\n cardDataName: 'title'\n },\n closeissue: {\n requestMethod: 'post',\n intentMessage: 'Close an issue in Github',\n getDataOperation: 'getCloseIssueJson',\n githubOperation: 'closeIssue',\n showWidgetOperation: 'showCloseIssueWidget',\n populateDataOperation: 'populateCloseIssueData',\n successMessage: 'Issue Closed!',\n cardMsg: 'Issue Closed as requested, closed issue available at: ',\n cardDataUrl: 'html_url',\n cardDataName: 'title'\n },\n addissuecomment: {\n requestMethod: 'post',\n intentMessage: 'Add a comment on an issue in Github',\n getDataOperation: 'getAddCommentJson',\n githubOperation: 'addIssueComment',\n showWidgetOperation: 'showAddCommentWidget',\n populateDataOperation: 'populateAddCommentData',\n successMessage: 'Comment Added!',\n cardMsg: 'Comment Added as Requested, view here: ',\n cardDataUrl: 'html_url',\n cardDataName: 'title'\n },\n displaylastcomment: {\n requestMethod: 'get',\n intentMessage: 'Display last comment of an issue in Github',\n getDataOperation: 'getDisplayCommentJson',\n githubOperation: 'displayLastComment',\n showWidgetOperation: 'showDisplayCommentWidget',\n populateDataOperation: 'populateDisplayCommentData',\n successMessage: 'Comment Retrieved!',\n cardMsg: 'Please find requested comment below: ',\n cardDataUrl: 'html_url',\n cardDataName: 'title'\n },\n addcollab: {\n requestMethod: 'post',\n intentMessage: 'Add a collaborator',\n getDataOperation: 'getAddCollaboratorJson',\n githubOperation: 'addCollaborator',\n showWidgetOperation: 'showAddCollaboratorWidget',\n populateDataOperation: 'populateAddCollaboratorData',\n successMessage: 'Collaborator Added!',\n cardMsg: 'Collaborator added, details available at ',\n cardDataUrl: 'html_url',\n cardDataName: 'invitee,login'\n },\n viewrepos: {\n requestMethod: 'get',\n intentMessage: 'View Repositories for current user',\n getDataOperation: 'getViewRepositoryJson',\n githubOperation: 'viewRepositories',\n showWidgetOperation: 'showViewRepoWidget',\n populateDataOperation: 'populateViewRepoData',\n successMessage: 'Showing repositories',\n cardMsg: 'Repository Details available below: ',\n cardDataUrl: 'html_url',\n cardDataName: 'invitee,login'\n },\n resethistory: {\n requestMethod: 'purge',\n intentMessage: 'Clear all Operations History',\n successMessage: 'Purged!',\n cardMsg: 'Purged history of all Operations and Commands!'\n }\n },\n costants: {\n hiddenIntentFieldId: 'intentHidden'\n },\n actions: {\n createrepo: { type: 'ADD_REPO' },\n addcollab: { type: 'ADD_COLLAB' },\n createissue: { type: 'ADD_ISSUE' },\n addissuecomment: { type: 'ADD_COMMENT' },\n closeissue: { type: 'CLOSE_ISSUE' },\n displaylastcomment: { type: 'SHOW_LAST_COMMENT' },\n viewrepos: { type: 'VIEW_REPO' },\n action_add_query: { type: 'ADD_QUERY' },\n action_clear_history: { type: 'CLEAR_HISTORY' }\n }\n};\n\n//# sourceURL=webpack:///./src/js/config.js?"); /***/ }), -/***/ "./src/js/dom-ops.js": -/*!***************************!*\ - !*** ./src/js/dom-ops.js ***! - \***************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -eval("const $config = __webpack_require__(/*! ./config.js */ \"./src/js/config.js\");\nconst Helper = __webpack_require__(/*! ./helper.js */ \"./src/js/helper.js\");\n\nconst helper = new Helper();\n\nmodule.exports = class DomManipulator {\n constructor() {\n this.createRepoWidgetCreated = false;\n this.commandCardCounter = 1;\n }\n\n showWidget(intent) {\n // var intent = $('#' + $config.costants.hiddenIntentFieldId).val();\n const widget = this.createRepoWidget(intent);\n if (!this.isVisible(widget)) {\n widget.classList.remove('hide');\n $('#underWidgetLine').removeClass('hide');\n }\n }\n\n displayIntentBox(intent) {\n const intentBox = document.getElementById('intentBox');\n if (!this.isVisible(intentBox)) {\n intentBox.classList.remove('hide');\n }\n $('#intentName').text(`${$config.intentSlugToOperations[intent].intentMessage} [slug: ${intent}].`);\n }\n\n createRepoWidget(intent) {\n const existingWidget = document.getElementById(intent);\n if (existingWidget) {\n return existingWidget;\n }\n\n // Create Elements\n const widgets = document.getElementById('widgets');\n const createRepoWidget = document.createElement('div');\n const cardBody = document.createElement('div');\n const header = document.createElement('div');\n const form = document.createElement('form');\n\n const formRow1 = document.createElement('div');\n const formGroup1_1 = document.createElement('div');\n const repoNamelabel = document.createElement('label');\n const repoNameTextField = document.createElement('input');\n const formGroup1_2 = document.createElement('div');\n const homePageURLLabel = document.createElement('label');\n const homePageURLTextField = document.createElement('input');\n\n const formRow2 = document.createElement('div');\n const formGroup2_1 = document.createElement('div');\n const formCheck1 = document.createElement('div');\n const privateLabel = document.createElement('label');\n const privateCB = document.createElement('input');\n const formGroup2_2 = document.createElement('div');\n const formCheck2 = document.createElement('div');\n const addIssueLabel = document.createElement('label');\n const addIssueCB = document.createElement('input');\n const formGroup2_3 = document.createElement('div');\n const formCheck3 = document.createElement('div');\n const addWikiLabel = document.createElement('label');\n const addWikiCB = document.createElement('input');\n\n const formGroup3_1 = document.createElement('div');\n const descriptionLabel = document.createElement('label');\n const descriptionTextArea = document.createElement('textarea');\n\n const submitRepoCreate = document.createElement('button');\n\n // Add Attributes\n widgets.classList.add('card-group');\n createRepoWidget.setAttribute('id', 'createrepo');\n createRepoWidget.classList.add('card', 'hide', 'widget', 'good');\n cardBody.classList.add('card-body');\n header.classList.add('card-title');\n\n formRow1.classList.add('form-row');\n formGroup1_1.classList.add('form-group', 'col-md-6', 'col-sm-6', 'col-lg-6', 'col-xs-6', 'mb-3');\n repoNamelabel.setAttribute('for', 'repositoryName');\n repoNameTextField.setAttribute('type', 'text');\n repoNameTextField.setAttribute('id', 'repositoryName');\n repoNameTextField.setAttribute('placeholder', 'Repository Name... ');\n repoNameTextField.required = true;\n repoNameTextField.classList.add('form-control');\n formGroup1_2.classList.add('form-group', 'col-md-6', 'col-sm-6', 'col-lg-6', 'col-xs-6', 'mb-3');\n homePageURLLabel.setAttribute('for', 'homePageURL');\n homePageURLTextField.setAttribute('type', 'text');\n homePageURLTextField.setAttribute('id', 'homePageURL');\n homePageURLTextField.setAttribute('placeholder', 'Home Page URL... ');\n homePageURLTextField.classList.add('form-control');\n\n formRow2.classList.add('form-row');\n formGroup2_1.classList.add('form-group', 'col-md-3', 'col-sm-3', 'col-lg-3', 'col-xs-3', 'mb-3');\n formCheck1.classList.add('form-check', 'form-check-inline');\n privateLabel.setAttribute('for', 'privateRepoChk');\n privateLabel.classList.add('form-check-label');\n privateCB.setAttribute('type', 'checkbox');\n privateCB.setAttribute('id', 'privateRepoChk');\n privateCB.setAttribute('value', 'Option 1');\n privateCB.classList.add('form-check-input');\n\n formGroup2_2.classList.add('form-group', 'col-md-4', 'col-sm-4', 'col-lg-4', 'col-xs-4', 'mb-3');\n formCheck2.classList.add('form-check', 'form-check-inline');\n addIssueLabel.setAttribute('for', 'issuesChk');\n addIssueLabel.classList.add('form-check-label');\n addIssueCB.setAttribute('type', 'checkbox');\n addIssueCB.setAttribute('id', 'issuesChk');\n addIssueCB.setAttribute('value', 'Option 2');\n addIssueCB.classList.add('form-check-input');\n\n formGroup2_3.classList.add('form-group', 'col-md-4', 'col-sm-4', 'col-lg-4', 'col-xs-4', 'mb-3');\n formCheck3.classList.add('form-check', 'form-check-inline');\n addWikiLabel.setAttribute('for', 'wikiChk');\n addWikiLabel.classList.add('form-check-label');\n addWikiCB.setAttribute('type', 'checkbox');\n addWikiCB.setAttribute('id', 'wikiChk');\n addWikiCB.setAttribute('value', 'Option 3');\n addWikiCB.classList.add('form-check-input');\n\n formGroup3_1.classList.add('form-group');\n descriptionLabel.setAttribute('for', 'description');\n descriptionTextArea.setAttribute('rows', '3');\n descriptionTextArea.classList.add('form-control');\n descriptionTextArea.setAttribute('id', 'description');\n\n submitRepoCreate.setAttribute('type', 'button');\n submitRepoCreate.setAttribute('data-toggle', 'modal');\n submitRepoCreate.setAttribute('data-target', '#submitConfirm');\n submitRepoCreate.setAttribute('id', 'submitForm');\n submitRepoCreate.classList.add('btn', 'btn-primary');\n\n // Add inner HTML\n header.innerHTML = 'Create Repository';\n repoNamelabel.innerHTML = 'Repository Name';\n homePageURLLabel.innerHTML = 'Home Page URL';\n privateLabel.innerHTML = 'Private';\n addIssueLabel.innerHTML = 'Allow Adding Issues?';\n addWikiLabel.innerHTML = 'Add Wiki?';\n descriptionLabel.innerHTML = 'Add some Description for this repository:';\n submitRepoCreate.innerHTML = 'Submit';\n\n // Associations\n formCheck1.appendChild(privateCB);\n formCheck1.appendChild(privateLabel);\n\n formCheck2.appendChild(addIssueCB);\n formCheck2.appendChild(addIssueLabel);\n\n formCheck3.appendChild(addWikiCB);\n formCheck3.appendChild(addWikiLabel);\n\n formGroup1_1.appendChild(repoNamelabel);\n formGroup1_1.appendChild(repoNameTextField);\n\n formGroup1_2.appendChild(homePageURLLabel);\n formGroup1_2.appendChild(homePageURLTextField);\n\n formGroup2_1.appendChild(formCheck1);\n formGroup2_2.appendChild(formCheck2);\n formGroup2_3.appendChild(formCheck3);\n\n formGroup3_1.appendChild(descriptionLabel);\n formGroup3_1.appendChild(descriptionTextArea);\n\n formRow1.appendChild(formGroup1_1);\n formRow1.appendChild(formGroup1_2);\n\n formRow2.appendChild(formGroup2_1);\n formRow2.appendChild(formGroup2_2);\n formRow2.appendChild(formGroup2_3);\n\n form.appendChild(formRow1);\n form.appendChild(formRow2);\n form.appendChild(formGroup3_1);\n form.appendChild(submitRepoCreate);\n\n cardBody.appendChild(header);\n cardBody.appendChild(form);\n\n createRepoWidget.appendChild(cardBody);\n widgets.appendChild(createRepoWidget);\n $('#createrepo').insertBefore($('#underWidgetLine'));\n\n this.createRepoWidgetCreated = true;\n\n return createRepoWidget;\n }\n\n showEmptyCommandMessage() {\n $('#emptyCommandMsgDisplayer').click();\n }\n\n populateRecastData(widgetName, recastResponse) {\n // var requestMethod = $config.intentSlugToOperations[widgetName]['requestMethod'];\n const operation = $config.intentSlugToOperations[widgetName].populateDataOperation;\n if (typeof this[operation] === 'function') {\n this[operation](recastResponse);\n }\n }\n\n populateCreateRepoData(recastResponse) {\n const repoNameTextField = document.getElementById('repositoryName');\n if (repoNameTextField && recastResponse && recastResponse.entities['git-repository'] && recastResponse.entities['git-repository'].length > 0 && recastResponse.entities['git-repository']['0'].value) {\n const repoName = recastResponse.entities['git-repository']['0'].value;\n repoNameTextField.value = repoName;\n }\n }\n\n populateCreateIssueData(recastResponse) {\n const issueTitleTextField = document.getElementById('issueTitle');\n const issueRepositoryTextField = document.getElementById('issueRepository');\n if (issueTitleTextField && recastResponse && recastResponse.entities.issue_title && recastResponse.entities.issue_title.length > 0 && recastResponse.entities.issue_title['0'].value) {\n const issueTitle = recastResponse.entities.issue_title['0'].value;\n issueTitleTextField.value = issueTitle;\n }\n if (issueRepositoryTextField && recastResponse && recastResponse.entities['git-repository'] && recastResponse.entities['git-repository'].length > 0 && recastResponse.entities['git-repository']['0'].value) {\n const repoName = recastResponse.entities['git-repository']['0'].value;\n issueRepositoryTextField.value = repoName;\n }\n }\n\n populateCloseIssueData(recastResponse) {\n const issueNumberTextField = document.getElementById('issueNumerToClose');\n const issueRepositoryTextField = document.getElementById('repoForIssueClose');\n if (issueNumberTextField && recastResponse && recastResponse.entities.issue_id && recastResponse.entities.issue_id.length > 0 && recastResponse.entities.issue_id['0'].value) {\n const issueNumber = recastResponse.entities.issue_id['0'].value;\n issueNumberTextField.value = issueNumber;\n }\n if (issueRepositoryTextField && recastResponse && recastResponse.entities['git-repository'] && recastResponse.entities['git-repository'].length > 0 && recastResponse.entities['git-repository']['0'].value) {\n const repoName = recastResponse.entities['git-repository']['0'].value;\n issueRepositoryTextField.value = repoName;\n }\n }\n\n populateAddCollaboratorData(recastResponse) {\n const collaboratorNameTextField = document.getElementById('collaboratorName');\n const repoForCollabTextField = document.getElementById('repoForCollab');\n if (collaboratorNameTextField && recastResponse && recastResponse.entities.git_collaborator && recastResponse.entities.git_collaborator.length > 0 && recastResponse.entities.git_collaborator['0'].value) {\n const collaboratorName = recastResponse.entities.git_collaborator['0'].value;\n collaboratorNameTextField.value = collaboratorName;\n }\n if (repoForCollabTextField && recastResponse && recastResponse.entities['git-repository'] && recastResponse.entities['git-repository'].length > 0 && recastResponse.entities['git-repository']['0'].value) {\n const repoName = recastResponse.entities['git-repository']['0'].value;\n repoForCollabTextField.value = repoName;\n }\n }\n\n populateAddCommentData(recastResponse) {\n const repoForIssueCommentTextField = document.getElementById('repoForIssueComment');\n const issueNumberTextField = document.getElementById('issueNumber');\n const issueCommentTextArea = document.getElementById('issueComment');\n if (repoForIssueCommentTextField && recastResponse && recastResponse.entities['git-repository'] && recastResponse.entities['git-repository'].length > 0 && recastResponse.entities['git-repository']['0'].value) {\n const repoForIssueComment = recastResponse.entities['git-repository']['0'].value;\n repoForIssueCommentTextField.value = repoForIssueComment;\n }\n if (issueNumberTextField && recastResponse && recastResponse.entities.issue_id && recastResponse.entities.issue_id.length > 0 && recastResponse.entities.issue_id['0'].value) {\n const issueNumber = recastResponse.entities.issue_id['0'].value;\n issueNumberTextField.value = issueNumber;\n }\n if (issueCommentTextArea && recastResponse && recastResponse.entities.issue_comment && recastResponse.entities.issue_comment.length > 0 && recastResponse.entities.issue_comment['0'].value) {\n const issueComment = recastResponse.entities.issue_comment['0'].value;\n issueCommentTextArea.value = issueComment;\n }\n }\n\n populateDisplayCommentData(recastResponse) {\n const issueNumberTextField = document.getElementById('issueNumberForCommentView');\n const issueRepositoryTextField = document.getElementById('repoForCommentView');\n if (issueNumberTextField && recastResponse && recastResponse.entities.issue_id && recastResponse.entities.issue_id.length > 0 && recastResponse.entities.issue_id['0'].value) {\n const issueNumber = recastResponse.entities.issue_id['0'].value;\n issueNumberTextField.value = issueNumber;\n }\n if (issueRepositoryTextField && recastResponse && recastResponse.entities['git-repository'] && recastResponse.entities['git-repository'].length > 0 && recastResponse.entities['git-repository']['0'].value) {\n const repoName = recastResponse.entities['git-repository']['0'].value;\n issueRepositoryTextField.value = repoName;\n }\n }\n\n isVisible(element) {\n return element ? !element.classList.contains('hide') : false;\n }\n\n getDataFromFormAsJSON() {\n let data = {};\n const intent = $(`#${$config.costants.hiddenIntentFieldId}`).val();\n const requestMethod = $config.intentSlugToOperations[intent].requestMethod;\n if (intent) {\n const operation = $config.intentSlugToOperations[intent].getDataOperation;\n if (typeof this[operation] === 'function') {\n data = this[operation]();\n }\n }\n return data;\n }\n\n getCreateRepoJson() {\n const data = {};\n const request = {};\n if (this.isVisible(document.getElementById('createrepo'))) {\n request.name = document.getElementById('repositoryName').value;\n request.description = document.getElementById('description').value;\n request.homepage = document.getElementById('homePageURL').value;\n request.private = document.getElementById('privateRepoChk').checked;\n request.has_issues = document.getElementById('issuesChk').checked;\n request.has_wiki = document.getElementById('wikiChk').checked;\n }\n data.request = request;\n return data;\n }\n\n getCreateIssueJson() {\n const data = {};\n data.urlParams = {};\n const request = {};\n if (this.isVisible(document.getElementById('createissue'))) {\n request.title = document.getElementById('issueTitle').value;\n request.body = document.getElementById('description').value;\n request.assignees = document.getElementById('assignees').value ? document.getElementById('assignees').value.split(',') : [];\n request.labels = document.getElementById('labels').value ? document.getElementById('labels').value.split(',') : [];\n data.urlParams.repoName = document.getElementById('issueRepository').value;\n }\n data.request = request;\n return data;\n }\n\n getCloseIssueJson() {\n const data = {};\n data.urlParams = {};\n if (this.isVisible(document.getElementById('closeissue'))) {\n data.urlParams.issueId = document.getElementById('issueNumerToClose').value;\n data.urlParams.repoName = document.getElementById('repoForIssueClose').value;\n }\n return data;\n }\n\n getAddCollaboratorJson() {\n const data = {};\n data.urlParams = {};\n if (this.isVisible(document.getElementById('addcollab'))) {\n data.urlParams.collaborator = document.getElementById('collaboratorName').value;\n data.urlParams.repoName = document.getElementById('repoForCollab').value;\n }\n return data;\n }\n\n getAddCommentJson() {\n const data = {};\n data.urlParams = {};\n const request = {};\n if (this.isVisible(document.getElementById('addissuecomment'))) {\n request.body = document.getElementById('issueComment').value;\n data.urlParams.issueId = document.getElementById('issueNumber').value;\n data.urlParams.repoName = document.getElementById('repoForIssueComment').value;\n }\n data.request = request;\n return data;\n }\n\n getDisplayCommentJson() {\n const data = {};\n data.urlParams = {};\n if (this.isVisible(document.getElementById('displaylastcomment'))) {\n data.urlParams.issueId = document.getElementById('issueNumberForCommentView').value;\n data.urlParams.repoName = document.getElementById('repoForCommentView').value;\n }\n return data;\n }\n\n addGitOperationHistory(data, type) {\n const intent = $(`#${$config.costants.hiddenIntentFieldId}`).val();\n const requestMethod = $config.intentSlugToOperations[intent].requestMethod;\n const conversations = document.getElementById('conversations');\n let table;\n let comment;\n // Create Elements\n const card = document.createElement('div');\n const cardBody = document.createElement('div');\n const cardTitle = document.createElement('h5');\n const closeAnchor = document.createElement('a');\n const closeHeader = document.createElement('h6');\n const cardText = document.createElement('p');\n const cardFooter = document.createElement('div');\n const textMuted = document.createElement('small');\n const underCardLine = document.createElement('div');\n\n // Add Attributes\n card.classList.add('card', type);\n cardBody.classList.add('card-body');\n cardTitle.classList.add('card-title');\n closeAnchor.classList.add('close');\n // closeAnchor.setAttribute('href', '#');\n cardText.classList.add('card-text');\n cardFooter.classList.add('card-footer');\n textMuted.classList.add('text-muted');\n underCardLine.classList.add('line');\n\n // Add content\n closeHeader.innerHTML = 'x';\n\n const x = this.display_ct(0, textMuted);\n if (type === 'command') {\n // Add content\n cardTitle.innerHTML = 'You Said';\n cardText.innerHTML = data;\n const repeat = document.createElement('a');\n repeat.classList.add('btn', 'btn-info', 'float-right');\n repeat.setAttribute('role', 'button');\n repeat.setAttribute('href', '#');\n repeat.setAttribute('id', `btnRepeatCommand${this.commandCardCounter++}`);\n repeat.innerHTML = 'Repeat';\n cardText.appendChild(repeat);\n } else if (type === 'response') {\n // Add content\n cardTitle.innerHTML = 'Server Responded As..';\n if (requestMethod == 'post') {\n cardText.innerHTML = `${$config.intentSlugToOperations[intent].cardMsg}${this.getVariable(data, $config.intentSlugToOperations[intent].cardDataName)}`;\n } else if (requestMethod == 'get') {\n cardText.innerHTML = $config.intentSlugToOperations[intent].cardMsg;\n if (data && data.length && data.length > 0) {\n if (intent === 'viewrepos') {\n table = this.createRepoTable(data);\n } else if (intent === 'displaylastcomment') {\n comment = this.createCommentBody(data);\n }\n }\n }\n } else {\n cardTitle.innerHTML = 'Server Responded As..';\n cardText.innerHTML = `Operation failed with status: ${type}`;\n }\n\n // Associations\n closeAnchor.appendChild(closeHeader);\n cardTitle.appendChild(closeAnchor);\n cardBody.appendChild(cardTitle);\n cardBody.appendChild(cardText);\n if (comment) {\n cardBody.appendChild(comment);\n }\n cardFooter.appendChild(textMuted);\n card.appendChild(cardBody);\n if (table) {\n card.appendChild(table);\n }\n card.appendChild(cardFooter);\n\n conversations.insertBefore(underCardLine, conversations.firstChild);\n conversations.insertBefore(card, conversations.firstChild);\n }\n\n getVariable(data, commaSeparatedValue) {\n const arr = commaSeparatedValue.split(',');\n for (let i = 0; i < arr.length; i++) {\n data = data[arr[i]];\n }\n return data;\n }\n\n createRepoTable(data) {\n // Create Elements\n const table = document.createElement('table');\n const thead = document.createElement('thead');\n const tr_head = document.createElement('tr');\n const th_1 = document.createElement('th');\n const th_2 = document.createElement('th');\n const th_3 = document.createElement('th');\n const th_4 = document.createElement('th');\n const th_5 = document.createElement('th');\n const th_6 = document.createElement('th');\n const th_7 = document.createElement('th');\n\n // Add Attributes\n table.classList.add('table', 'tabled-bordered', 'table-striped', 'table-hover');\n thead.classList.add('thead-dark');\n th_1.setAttribute('scope', 'col');\n th_2.setAttribute('scope', 'col');\n th_3.setAttribute('scope', 'col');\n th_4.setAttribute('scope', 'col');\n th_5.setAttribute('scope', 'col');\n th_6.setAttribute('scope', 'col');\n th_7.setAttribute('scope', 'col');\n\n // Add Inner HTML\n th_1.innerHTML = '#';\n th_2.innerHTML = 'Repository Name';\n th_3.innerHTML = 'Repository ID';\n th_4.innerHTML = 'Created On';\n th_5.innerHTML = 'Created By';\n th_6.innerHTML = 'View Raw';\n th_7.innerHTML = 'Delete Repository';\n\n // Associations\n tr_head.appendChild(th_1);\n tr_head.appendChild(th_2);\n tr_head.appendChild(th_3);\n tr_head.appendChild(th_4);\n tr_head.appendChild(th_5);\n tr_head.appendChild(th_6);\n tr_head.appendChild(th_7);\n thead.appendChild(tr_head);\n table.appendChild(thead);\n\n for (let i = 0; i < data.length; i++) {\n const currentRepo = data[i];\n // Create Elements\n const tbody = document.createElement('tbody');\n const tr_body = document.createElement('tr');\n const th_vertical = document.createElement('th');\n const td_1 = document.createElement('td');\n const td_2 = document.createElement('td');\n const td_3 = document.createElement('td');\n const td_4 = document.createElement('td');\n const td_5 = document.createElement('td');\n const td_6 = document.createElement('td');\n\n // Add Attributes\n th_vertical.setAttribute('scope', 'row');\n tr_body.setAttribute('id', `repoRow${i}`);\n\n // Add Inner HTML\n th_vertical.innerHTML = i + 1;\n td_1.innerHTML = currentRepo.name;\n td_2.innerHTML = `${currentRepo.id}`;\n td_3.innerHTML = currentRepo.created_at;\n td_4.innerHTML = `${currentRepo.owner.login}`;\n td_5.innerHTML = `View`;\n td_6.innerHTML = `Delete`;\n\n // Associations\n tr_body.appendChild(th_vertical);\n tr_body.appendChild(td_1);\n tr_body.appendChild(td_2);\n tr_body.appendChild(td_3);\n tr_body.appendChild(td_4);\n tr_body.appendChild(td_5);\n tr_body.appendChild(td_6);\n tbody.appendChild(tr_body);\n table.appendChild(tbody);\n }\n\n return table;\n }\n\n loadConversations(historyAll) {\n historyAll.forEach(element => {\n this.addGitOperationHistory();\n });\n }\n\n createCommentBody(data) {\n const commentPara = document.createElement('p');\n const lastComment = helper.getLatestComment(data);\n commentPara.classList.add('card-text');\n commentPara.innerHTML = `COMMENT: ${lastComment}`;\n return commentPara;\n }\n\n concealCodeInUrl() {\n window.location = 'http://localhost:8080';\n }\n\n toggleModals(response) {\n const self = this;\n const promise = response.json();\n const intent = $(`#${$config.costants.hiddenIntentFieldId}`).val();\n $('#submitConfirm').addClass('hide');\n $('#btnCancelConfirm').click();\n $('.modal-backdrop').removeClass('modal-backdrop');\n $('#underWidgetLine').addClass('hide');\n $('#intentBox').addClass('hide');\n if (response && response.status && (response.status === 201 || response.status === 200 || response.status === 204)) {\n $('#successAlert').removeClass('hide');\n $('#widgets').children().addClass('hide');\n promise.then(body => {\n $('#op-msg').text($config.intentSlugToOperations[intent].successMessage);\n $('#successAlert').removeClass('hide');\n self.addGitOperationHistory(body, 'response');\n // clear intent\n $(`#${$config.costants.hiddenIntentFieldId}`).val('');\n });\n } else {\n $('#widgets').children().addClass('hide');\n $('#dangerAlert').removeClass('hide');\n self.addGitOperationHistory(response.status);\n // clear intent\n $(`#${$config.costants.hiddenIntentFieldId}`).val('');\n }\n }\n\n display_ct(start, element) {\n this.start = start;\n this.element = element;\n const days = Math.floor(this.start / 86400);\n const hours = Math.floor((this.start - days * 86400) / 3600);\n const minutes = Math.floor((this.start - days * 86400 - hours * 3600) / 60);\n const secs = Math.floor(this.start - days * 86400 - hours * 3600 - minutes * 60);\n let x = '';\n if (days != 0) {\n x = `${x + days} days`;\n }\n if (hours != 0) {\n x = `${x + hours} hours`;\n }\n if (minutes != 0) {\n x = `${x + minutes} minutes`;\n }\n x = `${x + secs} seconds ago`;\n element.innerHTML = x;\n this.start = this.start + 1;\n // setTimeout(this['display_ct](this.start, this.element)', 1000 )\n }\n};\n\n//# sourceURL=webpack:///./src/js/dom-ops.js?"); - -/***/ }), - -/***/ "./src/js/event-toggles.js": -/*!*********************************!*\ - !*** ./src/js/event-toggles.js ***! - \*********************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -eval("const Recast = __webpack_require__(/*! ./bot/recast-ops.js */ \"./src/js/bot/recast-ops.js\");\n\nconst recastclient = new Recast();\nconst DomManipulator = __webpack_require__(/*! ./dom-ops.js */ \"./src/js/dom-ops.js\");\n\nconst dom = new DomManipulator();\nconst Microbot = __webpack_require__(/*! ./microbot-ops.js */ \"./src/js/microbot-ops.js\");\n\nconst app = new Microbot();\nconst $config = __webpack_require__(/*! ./config.js */ \"./src/js/config.js\");\n\nconst PersistentOps = __webpack_require__(/*! ./persistent-ops */ \"./src/js/persistent-ops.js\");\nconst persistentOps = new PersistentOps();\n\nmodule.exports = $(document).ready(() => {\n // console.log('test');\n app.setToken();\n $('#sidebarCollapse').on('click', () => {\n $('#sidebar').toggleClass('active');\n $('.hideable').toggleClass('hide');\n });\n $('#content nav div.collapse li a.nav-link i.far.fa-star').hover(() => {\n $('#content nav div.collapse li a.nav-link i.far.fa-star').toggleClass('fas');\n });\n $('#content nav div.collapse li a.nav-link i.far.fa-trash-alt').hover(() => {\n $('#content nav div.collapse li a.nav-link i.far.fa-trash-alt').toggleClass('fas');\n });\n $('#content nav div.collapse li a.nav-link i.far.fa-paper-plane').hover(() => {\n $('#content nav div.collapse li a.nav-link i.far.fa-paper-plane').toggleClass('fas');\n });\n $('#command').keyup(e => {\n const code = e.keyCode ? e.keyCode : e.which;\n if (code == 13) {\n $('#widgets').children().addClass('hide');\n $('#successAlert').addClass('hide');\n $('#dangetAlert').addClass('hide');\n $('#intentBox').addClass('hide');\n const command = document.getElementById('command').value;\n if (command) {\n const text = { text: command };\n recastclient.getAndCallProcessIntent(command, text);\n } else {\n dom.showEmptyCommandMessage();\n }\n }\n });\n $('#btnSubmitConfirm').on('click', () => {\n $('#submitConfirm').removeClass('hide');\n });\n $('#submitGitData').on('click', () => {\n const data = dom.getDataFromFormAsJSON();\n const intent = $(`#${$config.costants.hiddenIntentFieldId}`).val();\n if (intent) {\n const operation = $config.intentSlugToOperations[intent].githubOperation;\n app[operation](data);\n }\n });\n $('#hideInfoAlert').on('click', () => {\n $('#intentBox').addClass('hide');\n });\n $('#hideSuccessAlert').on('click', () => {\n $('#successAlert').addClass('hide');\n });\n $('#conversations').on('click', '.close', function () {\n const $target = $(this).closest('.card');\n const line = $target.next();\n $target.hide('slow', () => {\n $target.remove();\n });\n line.hide('slow', () => {\n line.remove();\n });\n });\n $('#hideDangerAlert').on('click', () => {\n $('#dangerAlert').addClass('hide');\n });\n $('#git_bridge').on('click', () => {\n window.location.href = 'https://github.com/login/oauth/authorize?scope=user:email:repo&client_id=f6f649a1fe2dfea082ba';\n });\n window.onload = persistentOps.loadConversations();\n if (window.location.href.match(/\\?code=(.*)/)) {\n const code = window.location.href.match(/\\?code=(.*)/)[1];\n app.getToken(code);\n }\n});\n\n//# sourceURL=webpack:///./src/js/event-toggles.js?"); - -/***/ }), - -/***/ "./src/js/github-ops.js": -/*!******************************!*\ - !*** ./src/js/github-ops.js ***! - \******************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -eval("const config = __webpack_require__(/*! ./config.js */ \"./src/js/config.js\");\n\nconst DomManipulator = __webpack_require__(/*! ./dom-ops.js */ \"./src/js/dom-ops.js\");\nconst dom = new DomManipulator();\n\nconst PersistentOps = __webpack_require__(/*! ./persistent-ops.js */ \"./src/js/persistent-ops.js\");\nconst persistentOps = new PersistentOps();\n\nmodule.exports = class Github {\n constructor() {\n this.authorizationToken = `token ${config.gitToken}`;\n }\n\n getToken(code) {\n let token = '';\n self = this;\n $.getJSON(`http://localhost:9999/authenticate/${code}`, data => {\n console.log(data.token);\n token = data.token;\n // set cookie here\n persistentOps.setCookie('gitToken', token, 30);\n // self.authorizationToken = \"token \" + persistentOps.getCookie('gitToken');\n dom.concealCodeInUrl();\n });\n return token;\n }\n\n getCurrentUser() {\n let repositories = '';\n const url = 'https://api.github.com/user/';\n fetch(url, {\n method: 'GET',\n headers: {\n 'Content-Type': 'application/json; charset=utf-8'\n }\n }).then(response => {\n response.json().then(body => {\n repositories = body;\n console.log(repositories);\n return repositories;\n });\n dom.toggleModals(response);\n }).catch(error => console.error('Fetch Error =\\n', error));\n return repositories;\n }\n\n authenticate() {}\n\n viewRepositories() {\n const repositories = '';\n const url = 'https://api.github.com/user/repos';\n fetch(url, {\n method: 'GET',\n headers: {\n 'Content-Type': 'application/json; charset=utf-8',\n Authorization: this.authorizationToken\n }\n }).then(response => {\n // response.json().then(function(body){\n // repositories = body;\n // console.log(repositories);\n // return repositories;\n // });\n dom.toggleModals(response);\n }).catch(error => console.error('Fetch Error =\\n', error));\n return repositories;\n }\n\n createRepository(newRepoJson) {\n const url = 'https://api.github.com/user/repos';\n const responsePromise = '';\n fetch(url, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json; charset=utf-8',\n Authorization: this.authorizationToken\n },\n body: JSON.stringify(newRepoJson)\n }).then(response => {\n dom.toggleModals(response);\n }).catch(error => console.error('Fetch Error =\\n', error));\n }\n\n updateRepository(updateRepoJson, repoName) {\n repoName = 'Hello-World3';\n const url = `https://api.github.com/repos/mohiit1502/${repoName}`;\n fetch(url, {\n method: 'PATCH',\n headers: {\n 'Content-Type': 'application/json; charset=utf-8',\n Authorization: this.authorizationToken\n },\n body: JSON.stringify(updateRepoJson)\n }).then(response => response.json()).catch(error => console.error('Fetch Error =\\n', error));\n }\n\n deleteRepository(repoName) {\n repoName = 'Hello-World2';\n const url = `https://api.github.com/repos/mohiit1502/${repoName}`;\n fetch(url, {\n method: 'DELETE',\n headers: {\n 'Content-Type': 'application/json; charset=utf-8',\n Authorization: this.authorizationToken\n }\n }).then(response => response.json()).catch(error => console.error('Fetch Error =\\n', error));\n }\n\n createIssue(newIssueJson, repoName) {\n const url = `https://api.github.com/repos/mohiit1502/${repoName}/issues`;\n fetch(url, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json; charset=utf-8',\n Authorization: this.authorizationToken\n },\n body: JSON.stringify(newIssueJson)\n }).then(response => {\n dom.toggleModals(response);\n }).catch(error => console.error('Fetch Error =\\n', error));\n }\n\n updateIssue(updateIssueJson, repoName, issueNumber) {\n repoName = 'stack_route_prj7';\n issueNumber = 2;\n const url = `https://api.github.com/repos/mohiit1502/${repoName}/issues/${issueNumber}`;\n fetch(url, {\n method: 'PATCH',\n headers: {\n 'Content-Type': 'application/json; charset=utf-8',\n Authorization: this.authorizationToken\n },\n body: JSON.stringify(updateIssueJson)\n }).then(response => response.json()).catch(error => console.error('Fetch Error =\\n', error));\n }\n\n closeIssue(closeIssueJson, repoName, issueNumber) {\n const url = `https://api.github.com/repos/mohiit1502/${repoName}/issues/${issueNumber}`;\n fetch(url, {\n method: 'PATCH',\n headers: {\n 'Content-Type': 'application/json; charset=utf-8',\n Authorization: this.authorizationToken\n },\n body: JSON.stringify(closeIssueJson)\n }).then(response => {\n dom.toggleModals(response);\n }).catch(error => console.error('Fetch Error =\\n', error));\n }\n\n reopenIssue(reopenIssueJson, repoName, issueNumber) {\n repoName = 'stack_route_prj7';\n issueNumber = 2;\n const url = `https://api.github.com/repos/mohiit1502/${repoName}/issues/${issueNumber}`;\n fetch(url, {\n method: 'PATCH',\n headers: {\n 'Content-Type': 'application/json; charset=utf-8',\n Authorization: this.authorizationToken\n },\n body: JSON.stringify(reopenIssueJson)\n }).then(response => response.json()).catch(error => console.error('Fetch Error =\\n', error));\n }\n\n displayIssue(repoName, issueNumber) {\n repoName = 'stack_route_prj7';\n issueNumber = 2;\n const url = `https://api.github.com/repos/mohiit1502/${repoName}/issues/${issueNumber}`;\n let issues = '';\n fetch(url, {\n method: 'GET',\n headers: {\n 'Content-Type': 'application/json; charset=utf-8',\n Authorization: this.authorizationToken\n }\n }).then(response => {\n response.json().then(body => {\n issues = body;\n console.log(issues);\n return issues;\n });\n }).catch(error => console.error('Fetch Error =\\n', error));\n return issues;\n }\n\n addIssueComment(commentBodyJson, repoName, issueId) {\n const url = `https://api.github.com/repos/mohiit1502/${repoName}/issues/${issueId}/comments`;\n fetch(url, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json; charset=utf-8',\n Authorization: this.authorizationToken\n },\n body: JSON.stringify(commentBodyJson)\n }).then(response => {\n dom.toggleModals(response);\n }).catch(error => console.error('Fetch Error =\\n', error));\n }\n\n displayLastComment(repoName, issueNumber) {\n const url = `https://api.github.com/repos/mohiit1502/${repoName}/issues/${issueNumber}/comments`;\n const comments = [];\n const latestComment = '';\n fetch(url, {\n method: 'GET',\n headers: {\n 'Content-Type': 'application/json; charset=utf-8',\n Authorization: this.authorizationToken\n }\n }).then(response => {\n dom.toggleModals(response);\n // response.json().then(function(body){\n // comments = body;\n // latestComment = githubHelper.getLatestComment(comments);\n // console.log(comments);\n // console.log(latestComment);\n // });\n }).catch(error => console.error('Fetch Error =\\n', error));\n }\n\n displayIssuesForUser() {\n const url = 'https://api.github.com/user/issues';\n fetch(url, {\n method: 'GET',\n headers: {\n 'Content-Type': 'application/json; charset=utf-8',\n Authorization: this.authorizationToken\n }\n }).then(response => response.json()).catch(error => console.error('Fetch Error =\\n', error));\n }\n\n displayIssuesOnRepo() {\n repoName = 'stack_route_prj7';\n issueNumber = 2;\n const url = `https://api.github.com/repos/mohiit1502/${repoName}/issues/`;\n fetch(url, {\n method: 'PATCH',\n headers: {\n 'Content-Type': 'application/json; charset=utf-8',\n Authorization: this.authorizationToken\n },\n body: JSON.stringify(updateIssueJson)\n }).then(response => response.json()).catch(error => console.error('Fetch Error =\\n', error));\n }\n\n addCollaborator(repoName, collaborator) {\n repoName = 'stack_route_prj7';\n collaborator = 'swat1508';\n const url = `https://api.github.com/repos/mohiit1502/${repoName}/collaborators/${collaborator}`;\n fetch(url, {\n method: 'PUT',\n headers: {\n 'Content-Type': 'application/json',\n Authorization: this.authorizationToken\n }\n }).then(response => {\n dom.toggleModals(response);\n }).catch(error => console.error('Fetch Error =\\n', error));\n }\n\n removeCollaborator(repoName, collaborator) {\n repoName = 'stack_route_prj7';\n collaborator = 'swat1508';\n const url = `https://api.github.com/repos/mohiit1502/${repoName}/collaborators/${collaborator}`;\n fetch(url, {\n method: 'DELETE',\n headers: {\n 'Content-Type': 'application/json',\n Authorization: this.authorizationToken\n }\n }).then(response => response.json()).catch(error => console.error('Fetch Error =\\n', error));\n }\n\n createUser(newuserJson) {}\n\n updateUser(updateUserJson) {}\n\n deleteUser(userId) {}\n};\n\n//# sourceURL=webpack:///./src/js/github-ops.js?"); - -/***/ }), - -/***/ "./src/js/helper.js": -/*!**************************!*\ - !*** ./src/js/helper.js ***! - \**************************/ -/*! no static exports found */ -/***/ (function(module, exports) { - -eval("module.exports = class Helper {\n getLatestComment(comments) {\n if (comments && comments.length > 0) {\n return comments[comments.length - 1].body;\n }\n }\n\n compareByProperty(property) {\n return function (a, b) {\n if (a[property] < b[property]) return -1;\n if (a.last_nom > b.last_nom) return 1;\n return 0;\n };\n }\n\n clone(obj) {\n if (null == obj || \"object\" != typeof obj) return obj;\n var copy = Object.assign({}, obj);\n return copy;\n }\n\n};\n\n//# sourceURL=webpack:///./src/js/helper.js?"); - -/***/ }), - -/***/ "./src/js/history.js": -/*!***************************!*\ - !*** ./src/js/history.js ***! - \***************************/ -/*! no static exports found */ -/***/ (function(module, exports) { - -eval("const state = {\n createrepo: [],\n createissue: [],\n closeissue: [],\n addissuecomment: [],\n displaylastcomment: [],\n addcollab: [],\n viewrepos: [],\n queries: [],\n insertionCounter: 0\n};\n\nmodule.exports = state;\n\n//# sourceURL=webpack:///./src/js/history.js?"); - -/***/ }), - -/***/ "./src/js/microbot-ops.js": +/***/ "./src/js/data/history.js": /*!********************************!*\ - !*** ./src/js/microbot-ops.js ***! + !*** ./src/js/data/history.js ***! \********************************/ /*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { +/***/ (function(module, exports) { -eval("const Github = __webpack_require__(/*! ./github-ops.js */ \"./src/js/github-ops.js\");\n\nconst $github = new Github();\nconst PersistentOps = __webpack_require__(/*! ./persistent-ops.js */ \"./src/js/persistent-ops.js\");\n\nconst persistentOps = new PersistentOps();\n\nmodule.exports = class Microbot {\n constructor(clientId, clientSecret) {\n // TODO move to config or env variables\n this.clientId = 'f6f649a1fe2dfea082ba';\n this.clientSecret = '7e9a33d05ffdb36b4a498140bb9bb06d62de4f0e';\n }\n\n getToken(code) {\n $github.getToken(code);\n }\n\n setToken() {\n $github.authorizationToken = `token ${persistentOps.getCookie('gitToken')}`;\n }\n\n getCurrentUser() {\n $github.getCurrentUser();\n }\n\n viewRepositories() {\n return $github.viewRepositories();\n }\n\n createRepository(requestData) {\n const requestJson = requestData.request;\n $github.createRepository(requestJson);\n // $github.createRepository({\n // \"name\": \"new-test-js-git-api-repo\",\n // \"description\": \"This is your first repository\",\n // \"homepage\": \"https://github.com\",\n // \"private\": false,\n // \"has_issues\": true,\n // \"has_wiki\": true\n // })\n }\n\n updateRepository(repoName, repoType) {\n $github.authenticate();\n $github.updateRepository({\n name: 'Hello-World4',\n description: 'This is your test description',\n homepage: 'https://github.com',\n private: false,\n has_issues: true,\n has_projects: true,\n has_wiki: true\n });\n }\n\n deleteRepository() {\n $github.deleteRepository();\n }\n\n createIssue(requestData) {\n const requestJson = requestData.request;\n const repoName = requestData.urlParams.repoName;\n $github.createIssue(requestJson, repoName);\n }\n\n updateIssue() {\n $github.updateIssue({\n title: 'Found a bug - title updated',\n body: 'This is the updated problem description.',\n assignees: ['mohiit1502'],\n milestone: 1,\n state: 'open',\n labels: ['bug', 'issue']\n });\n }\n\n closeIssue(requestData) {\n const repoName = requestData.urlParams.repoName;\n const issueId = requestData.urlParams.issueId;\n $github.closeIssue({\n state: 'close'\n }, repoName, issueId);\n }\n\n displayIssue() {\n return $github.displayIssue();\n }\n\n reopenIssue() {\n $github.reopenIssue({\n milestone: 1,\n state: 'open'\n });\n }\n\n addIssueComment(requestData) {\n const requestJson = requestData.request;\n const repoName = requestData.urlParams.repoName;\n const issueId = requestData.urlParams.issueId;\n $github.addIssueComment(requestJson, repoName, issueId);\n }\n\n displayLastComment(requestData) {\n const repoName = requestData.urlParams.repoName;\n const issueId = requestData.urlParams.issueId;\n return $github.displayLastComment(repoName, issueId);\n }\n\n addCollaborator(requestData) {\n const repoName = requestData.urlParams.repoName;\n const collaborator = requestData.urlParams.collaborator;\n $github.addCollaborator(repoName, collaborator);\n }\n\n removeCollaborator() {\n $github.removeCollaborator();\n }\n\n callAppropriate(intent) {}\n};\n\n//# sourceURL=webpack:///./src/js/microbot-ops.js?"); +eval("const state = {\n createrepo: [],\n createissue: [],\n closeissue: [],\n addissuecomment: [],\n displaylastcomment: [],\n addcollab: [],\n viewrepos: [],\n queries: [],\n messages: [],\n insertionCounter: 0\n};\n\nmodule.exports = state;\n\n//# sourceURL=webpack:///./src/js/data/history.js?"); /***/ }), -/***/ "./src/js/persistent-ops.js": +/***/ "./src/js/helpers/helper.js": /*!**********************************!*\ - !*** ./src/js/persistent-ops.js ***! + !*** ./src/js/helpers/helper.js ***! \**********************************/ -/*! no exports provided */ +/*! exports provided: Helper */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* WEBPACK VAR INJECTION */(function(module) {/* harmony import */ var redux__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! redux */ \"./node_modules/redux/es/redux.js\");\n/* harmony import */ var _history__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./history */ \"./src/js/history.js\");\n/* harmony import */ var _history__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_history__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _helper__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./helper */ \"./src/js/helper.js\");\n/* harmony import */ var _helper__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_helper__WEBPACK_IMPORTED_MODULE_2__);\n\n\n\nconst helper = new _helper__WEBPACK_IMPORTED_MODULE_2__[\"Helper\"]();\n\nmodule.exports = class PersistentOps {\n\n constructor() {\n this.store = Object(redux__WEBPACK_IMPORTED_MODULE_0__[\"createStore\"])(this.mbReducer, _history__WEBPACK_IMPORTED_MODULE_1__[\"state\"]);\n this.store.subscribe(this.renderCards);\n }\n setCookie(cname, cvalue, exdays) {\n const d = new Date();\n d.setTime(d.getTime() + exdays * 24 * 60 * 60 * 1000);\n const expires = `expires=${d.toUTCString()}`;\n document.cookie = `${cname}=${cvalue};${expires};path=/`;\n }\n\n getCookie(cname) {\n const name = `${cname}=`;\n const decodedCookie = decodeURIComponent(document.cookie);\n const ca = decodedCookie.split(';');\n for (let i = 0; i < ca.length; i++) {\n let c = ca[i];\n while (c.charAt(0) == ' ') {\n c = c.substring(1);\n }\n if (c.indexOf(name) == 0) {\n return c.substring(name.length, c.length);\n }\n }\n return '';\n }\n\n mbReducer(currentState, action) {\n var nextState = {};\n switch (action.type) {\n case 'ADD_QUERY':\n let newHistory = {};\n let command = document.getElementById('command').value;\n nextState = helper.clone(currentState);\n newHistory.command = command;\n newHistory.insertionCounter = ++nextState.insertionCounter;\n nextState.queries = [...nextState.queries, newHistory];\n window.localStorage.setItem('currentState', JSON.stringify(nextState));\n return nextState;\n break;\n case 'DELETE':\n let deletedBtnId = action.btnDeleteId;\n nextState.todoList = [...currentState.todoList];\n nextState.counter = currentState.counter;\n return nextState;\n break;\n default:\n return currentState;\n }\n }\n\n renderCards() {\n $('#conversations').html = '';\n let history = store.getState();\n // let counter = 1;\n let historyALl = [];\n for (var property in history) {\n if (history.hasOwnProperty(property) && Array.isArray(history[property])) {\n historyAll = historyAll.concat(history[property]);\n }\n }\n historyAll.sort(helper.compareByProperty('insertionCounter'));\n dom.loadConversations(historyALl);\n }\n\n};\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../node_modules/webpack/buildin/harmony-module.js */ \"./node_modules/webpack/buildin/harmony-module.js\")(module)))\n\n//# sourceURL=webpack:///./src/js/persistent-ops.js?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Helper\", function() { return Helper; });\nclass Helper {\n\n getLatestComment(comments) {\n if (comments && comments.length > 0) {\n return comments[comments.length - 1].body;\n }\n }\n\n compareByProperty(property) {\n return function (a, b) {\n if (a[property] < b[property]) return -1;\n if (a[property] > b[property]) return 1;\n return 0;\n };\n }\n\n clone(obj) {\n if (null == obj || \"object\" != typeof obj) return obj;\n var copy = Object.assign({}, obj);\n return copy;\n }\n\n concatenateAndSort(history) {\n // let counter = 1;\n let historyAll = [];\n for (var property in history) {\n if (history.hasOwnProperty(property) && Array.isArray(history[property])) {\n historyAll = historyAll.concat(history[property]);\n }\n }\n historyAll.sort(this.compareByProperty('insertionCounter'));\n return historyAll;\n }\n\n};\n\n//# sourceURL=webpack:///./src/js/helpers/helper.js?"); + +/***/ }), + +/***/ "./src/js/services/dom-ops.js": +/*!************************************!*\ + !*** ./src/js/services/dom-ops.js ***! + \************************************/ +/*! exports provided: DomManipulator */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"DomManipulator\", function() { return DomManipulator; });\n/* harmony import */ var _helpers_helper_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../helpers/helper.js */ \"./src/js/helpers/helper.js\");\n/* harmony import */ var _views_addcollab_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./../views/addcollab.js */ \"./src/js/views/addcollab.js\");\n/* harmony import */ var _views_addissuecomment_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./../views/addissuecomment.js */ \"./src/js/views/addissuecomment.js\");\n/* harmony import */ var _views_closeissue_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./../views/closeissue.js */ \"./src/js/views/closeissue.js\");\n/* harmony import */ var _views_createissue_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./../views/createissue.js */ \"./src/js/views/createissue.js\");\n/* harmony import */ var _views_createrepo_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./../views/createrepo.js */ \"./src/js/views/createrepo.js\");\n/* harmony import */ var _views_displaylastcomment_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./../views/displaylastcomment.js */ \"./src/js/views/displaylastcomment.js\");\n/* harmony import */ var _views_viewrepos_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./../views/viewrepos.js */ \"./src/js/views/viewrepos.js\");\nconst $config = __webpack_require__(/*! ../config.js */ \"./src/js/config.js\");\n\nconst helper = new _helpers_helper_js__WEBPACK_IMPORTED_MODULE_0__[\"Helper\"]();\n\n\n\n\n\n\n\n\nclass DomManipulator {\n constructor() {\n this.createRepoWidgetCreated = false;\n this.commandCardCounter = 1;\n this.map = {\n 'addcollab': _views_addcollab_js__WEBPACK_IMPORTED_MODULE_1__[\"addcollab\"],\n 'addissuecomment': _views_addissuecomment_js__WEBPACK_IMPORTED_MODULE_2__[\"addissuecomment\"],\n 'closeissue': _views_closeissue_js__WEBPACK_IMPORTED_MODULE_3__[\"closeissue\"],\n 'createissue': _views_createissue_js__WEBPACK_IMPORTED_MODULE_4__[\"createissue\"],\n 'createrepo': _views_createrepo_js__WEBPACK_IMPORTED_MODULE_5__[\"createrepo\"],\n 'displaylastcomment': _views_displaylastcomment_js__WEBPACK_IMPORTED_MODULE_6__[\"displaylastcomment\"],\n 'viewrepos': _views_viewrepos_js__WEBPACK_IMPORTED_MODULE_7__[\"viewrepos\"]\n };\n }\n\n showWidget(intent) {\n let widget = document.getElementById(intent);\n if (widget) {\n if (!this.isVisible(widget)) {\n widget.classList.remove('hide');\n $('#underWidgetLine').removeClass('hide');\n }\n } else {\n let template = document.createElement('template');\n template.innerHTML = this.map[intent];\n widget = template.content.firstChild;\n if (!this.isVisible(widget)) {\n widget.classList.remove('hide');\n $('#underWidgetLine').removeClass('hide');\n }\n widgets.prepend(template.content.firstElementChild);\n }\n }\n\n displayIntentBox(intent) {\n const intentBox = document.getElementById('intentBox');\n if (!this.isVisible(intentBox)) {\n intentBox.classList.remove('hide');\n }\n $('#intentName').text(`${$config.intentSlugToOperations[intent].intentMessage} [slug: ${intent}].`);\n }\n\n showEmptyCommandMessage() {\n $('#emptyCommandMsgDisplayer').click();\n }\n\n populateRecastData(widgetName, recastResponse) {\n // var requestMethod = $config.intentSlugToOperations[widgetName]['requestMethod'];\n const operation = $config.intentSlugToOperations[widgetName].populateDataOperation;\n if (typeof this[operation] === 'function') {\n this[operation](recastResponse);\n }\n }\n\n populateCreateRepoData(recastResponse) {\n const repoNameTextField = document.getElementById('repositoryName');\n if (repoNameTextField && recastResponse && recastResponse.entities['git-repository'] && recastResponse.entities['git-repository'].length > 0 && recastResponse.entities['git-repository']['0'].value) {\n const repoName = recastResponse.entities['git-repository']['0'].value;\n repoNameTextField.value = repoName;\n }\n }\n\n populateCreateIssueData(recastResponse) {\n const issueTitleTextField = document.getElementById('issueTitle');\n const issueRepositoryTextField = document.getElementById('issueRepository');\n if (issueTitleTextField && recastResponse && recastResponse.entities.issue_title && recastResponse.entities.issue_title.length > 0 && recastResponse.entities.issue_title['0'].value) {\n const issueTitle = recastResponse.entities.issue_title['0'].value;\n issueTitleTextField.value = issueTitle;\n }\n if (issueRepositoryTextField && recastResponse && recastResponse.entities['git-repository'] && recastResponse.entities['git-repository'].length > 0 && recastResponse.entities['git-repository']['0'].value) {\n const repoName = recastResponse.entities['git-repository']['0'].value;\n issueRepositoryTextField.value = repoName;\n }\n }\n\n populateCloseIssueData(recastResponse) {\n const issueNumberTextField = document.getElementById('issueNumerToClose');\n const issueRepositoryTextField = document.getElementById('repoForIssueClose');\n if (issueNumberTextField && recastResponse && recastResponse.entities.issue_id && recastResponse.entities.issue_id.length > 0 && recastResponse.entities.issue_id['0'].value) {\n const issueNumber = recastResponse.entities.issue_id['0'].value;\n issueNumberTextField.value = issueNumber;\n }\n if (issueRepositoryTextField && recastResponse && recastResponse.entities['git-repository'] && recastResponse.entities['git-repository'].length > 0 && recastResponse.entities['git-repository']['0'].value) {\n const repoName = recastResponse.entities['git-repository']['0'].value;\n issueRepositoryTextField.value = repoName;\n }\n }\n\n populateAddCollaboratorData(recastResponse) {\n const collaboratorNameTextField = document.getElementById('collaboratorName');\n const repoForCollabTextField = document.getElementById('repoForCollab');\n if (collaboratorNameTextField && recastResponse && recastResponse.entities.git_collaborator && recastResponse.entities.git_collaborator.length > 0 && recastResponse.entities.git_collaborator['0'].value) {\n const collaboratorName = recastResponse.entities.git_collaborator['0'].value;\n collaboratorNameTextField.value = collaboratorName;\n }\n if (repoForCollabTextField && recastResponse && recastResponse.entities['git-repository'] && recastResponse.entities['git-repository'].length > 0 && recastResponse.entities['git-repository']['0'].value) {\n const repoName = recastResponse.entities['git-repository']['0'].value;\n repoForCollabTextField.value = repoName;\n }\n }\n\n populateAddCommentData(recastResponse) {\n const repoForIssueCommentTextField = document.getElementById('repoForIssueComment');\n const issueNumberTextField = document.getElementById('issueNumber');\n const issueCommentTextArea = document.getElementById('issueComment');\n if (repoForIssueCommentTextField && recastResponse && recastResponse.entities['git-repository'] && recastResponse.entities['git-repository'].length > 0 && recastResponse.entities['git-repository']['0'].value) {\n const repoForIssueComment = recastResponse.entities['git-repository']['0'].value;\n repoForIssueCommentTextField.value = repoForIssueComment;\n }\n if (issueNumberTextField && recastResponse && recastResponse.entities.issue_id && recastResponse.entities.issue_id.length > 0 && recastResponse.entities.issue_id['0'].value) {\n const issueNumber = recastResponse.entities.issue_id['0'].value;\n issueNumberTextField.value = issueNumber;\n }\n if (issueCommentTextArea && recastResponse && recastResponse.entities.issue_comment && recastResponse.entities.issue_comment.length > 0 && recastResponse.entities.issue_comment['0'].value) {\n const issueComment = recastResponse.entities.issue_comment['0'].value;\n issueCommentTextArea.value = issueComment;\n }\n }\n\n populateDisplayCommentData(recastResponse) {\n const issueNumberTextField = document.getElementById('issueNumberForCommentView');\n const issueRepositoryTextField = document.getElementById('repoForCommentView');\n if (issueNumberTextField && recastResponse && recastResponse.entities.issue_id && recastResponse.entities.issue_id.length > 0 && recastResponse.entities.issue_id['0'].value) {\n const issueNumber = recastResponse.entities.issue_id['0'].value;\n issueNumberTextField.value = issueNumber;\n }\n if (issueRepositoryTextField && recastResponse && recastResponse.entities['git-repository'] && recastResponse.entities['git-repository'].length > 0 && recastResponse.entities['git-repository']['0'].value) {\n const repoName = recastResponse.entities['git-repository']['0'].value;\n issueRepositoryTextField.value = repoName;\n }\n }\n\n isVisible(element) {\n return element ? !element.classList.contains('hide') : false;\n }\n\n getDataFromFormAsJSON() {\n let data = {};\n const intent = $(`#${$config.costants.hiddenIntentFieldId}`).val();\n const requestMethod = $config.intentSlugToOperations[intent].requestMethod;\n if (intent) {\n const operation = $config.intentSlugToOperations[intent].getDataOperation;\n if (typeof this[operation] === 'function') {\n data = this[operation]();\n }\n }\n return data;\n }\n\n getCreateRepoJson() {\n const data = {};\n const request = {};\n if (this.isVisible(document.getElementById('createrepo'))) {\n request.name = document.getElementById('repositoryName').value;\n request.description = document.getElementById('description').value;\n request.homepage = document.getElementById('homePageURL').value;\n request.private = document.getElementById('privateRepoChk').checked;\n request.has_issues = document.getElementById('issuesChk').checked;\n request.has_wiki = document.getElementById('wikiChk').checked;\n }\n data.request = request;\n return data;\n }\n\n getCreateIssueJson() {\n const data = {};\n data.urlParams = {};\n const request = {};\n if (this.isVisible(document.getElementById('createissue'))) {\n request.title = document.getElementById('issueTitle').value;\n request.body = document.getElementById('description').value;\n request.assignees = document.getElementById('assignees').value ? document.getElementById('assignees').value.split(',') : [];\n request.labels = document.getElementById('labels').value ? document.getElementById('labels').value.split(',') : [];\n data.urlParams.repoName = document.getElementById('issueRepository').value;\n }\n data.request = request;\n return data;\n }\n\n getCloseIssueJson() {\n const data = {};\n data.urlParams = {};\n if (this.isVisible(document.getElementById('closeissue'))) {\n data.urlParams.issueId = document.getElementById('issueNumerToClose').value;\n data.urlParams.repoName = document.getElementById('repoForIssueClose').value;\n }\n return data;\n }\n\n getAddCollaboratorJson() {\n const data = {};\n data.urlParams = {};\n if (this.isVisible(document.getElementById('addcollab'))) {\n data.urlParams.collaborator = document.getElementById('collaboratorName').value;\n data.urlParams.repoName = document.getElementById('repoForCollab').value;\n }\n return data;\n }\n\n getAddCommentJson() {\n const data = {};\n data.urlParams = {};\n const request = {};\n if (this.isVisible(document.getElementById('addissuecomment'))) {\n request.body = document.getElementById('issueComment').value;\n data.urlParams.issueId = document.getElementById('issueNumber').value;\n data.urlParams.repoName = document.getElementById('repoForIssueComment').value;\n }\n data.request = request;\n return data;\n }\n\n getDisplayCommentJson() {\n const data = {};\n data.urlParams = {};\n if (this.isVisible(document.getElementById('displaylastcomment'))) {\n data.urlParams.issueId = document.getElementById('issueNumberForCommentView').value;\n data.urlParams.repoName = document.getElementById('repoForCommentView').value;\n }\n return data;\n }\n\n addGitOperationHistory(data) {\n const intent = data.intent;\n let requestMethod = '';\n if (intent) {\n requestMethod = $config.intentSlugToOperations[intent].requestMethod;\n }\n const conversations = document.getElementById('conversations');\n let table;\n let comment;\n // Create Elements\n const card = document.createElement('div');\n const cardBody = document.createElement('div');\n const cardTitle = document.createElement('h5');\n const closeAnchor = document.createElement('a');\n const closeHeader = document.createElement('h6');\n const cardText = document.createElement('p');\n const cardFooter = document.createElement('div');\n const textMuted = document.createElement('small');\n const underCardLine = document.createElement('div');\n\n // Add Attributes\n card.classList.add('card');\n cardBody.classList.add('card-body');\n cardTitle.classList.add('card-title');\n closeAnchor.classList.add('close');\n // closeAnchor.setAttribute('href', '#');\n cardText.classList.add('card-text');\n cardFooter.classList.add('card-footer');\n textMuted.classList.add('text-muted');\n underCardLine.classList.add('line');\n\n // Add content\n closeHeader.innerHTML = 'x';\n\n const x = this.display_ct(0, textMuted);\n if (data.type === 'command') {\n // Add content\n cardTitle.innerHTML = 'You Said';\n cardText.innerHTML = data.command;\n card.classList.add('light-red');\n const repeat = document.createElement('a');\n repeat.classList.add('btn', 'btn-info', 'float-right');\n repeat.setAttribute('role', 'button');\n repeat.setAttribute('href', '#');\n repeat.setAttribute('id', `btnRepeatCommand${data.insertionCounter}`);\n repeat.innerHTML = 'Repeat';\n cardText.appendChild(repeat);\n } else if (data.type === 'response') {\n // Add content\n cardTitle.innerHTML = 'Server Responded As..';\n if (requestMethod == 'post') {\n cardText.innerHTML = `${$config.intentSlugToOperations[intent].cardMsg}${this.getVariable(data, $config.intentSlugToOperations[intent].cardDataName)}`;\n } else if (requestMethod == 'get') {\n cardText.innerHTML = $config.intentSlugToOperations[intent].cardMsg;\n if (data && data.length && data.length > 0) {\n if (intent === 'viewrepos') {\n table = this.createRepoTable(data);\n } else if (intent === 'displaylastcomment') {\n comment = this.createCommentBody(data);\n }\n }\n } else if (requestMethod == 'purge') {\n cardTitle.innerHTML = 'Operation Completed!';\n cardText.innerHTML = data.command;\n }\n } else {\n cardTitle.innerHTML = 'Server Responded As..';\n cardText.innerHTML = `Operation failed with status: ${data.status}`;\n }\n\n // Associations\n closeAnchor.appendChild(closeHeader);\n cardTitle.appendChild(closeAnchor);\n cardBody.appendChild(cardTitle);\n cardBody.appendChild(cardText);\n if (comment) {\n cardBody.appendChild(comment);\n }\n cardFooter.appendChild(textMuted);\n card.appendChild(cardBody);\n if (table) {\n card.appendChild(table);\n }\n card.appendChild(cardFooter);\n\n conversations.insertBefore(underCardLine, conversations.firstChild);\n conversations.insertBefore(card, conversations.firstChild);\n }\n\n getVariable(data, commaSeparatedValue) {\n const arr = commaSeparatedValue.split(',');\n for (let i = 0; i < arr.length; i++) {\n data = data[arr[i]];\n }\n return data;\n }\n\n // Create table of repositories ================================================================================================== \n createRepoTable(data) {\n // Create Elements\n const table = document.createElement('table');\n const thead = document.createElement('thead');\n const tr_head = document.createElement('tr');\n const th_1 = document.createElement('th');\n const th_2 = document.createElement('th');\n const th_3 = document.createElement('th');\n const th_4 = document.createElement('th');\n const th_5 = document.createElement('th');\n const th_6 = document.createElement('th');\n const th_7 = document.createElement('th');\n\n // Add Attributes\n table.classList.add('table', 'tabled-bordered', 'table-striped', 'table-hover');\n thead.classList.add('thead-dark');\n th_1.setAttribute('scope', 'col');\n th_2.setAttribute('scope', 'col');\n th_3.setAttribute('scope', 'col');\n th_4.setAttribute('scope', 'col');\n th_5.setAttribute('scope', 'col');\n th_6.setAttribute('scope', 'col');\n th_7.setAttribute('scope', 'col');\n\n // Add Inner HTML\n th_1.innerHTML = '#';\n th_2.innerHTML = 'Repository Name';\n th_3.innerHTML = 'Repository ID';\n th_4.innerHTML = 'Created On';\n th_5.innerHTML = 'Created By';\n th_6.innerHTML = 'View Raw';\n th_7.innerHTML = 'Delete Repository';\n\n // Associations\n tr_head.appendChild(th_1);\n tr_head.appendChild(th_2);\n tr_head.appendChild(th_3);\n tr_head.appendChild(th_4);\n tr_head.appendChild(th_5);\n tr_head.appendChild(th_6);\n tr_head.appendChild(th_7);\n thead.appendChild(tr_head);\n table.appendChild(thead);\n\n for (let i = 0; i < data.length; i++) {\n const currentRepo = data[i];\n // Create Elements\n const tbody = document.createElement('tbody');\n const tr_body = document.createElement('tr');\n const th_vertical = document.createElement('th');\n const td_1 = document.createElement('td');\n const td_2 = document.createElement('td');\n const td_3 = document.createElement('td');\n const td_4 = document.createElement('td');\n const td_5 = document.createElement('td');\n const td_6 = document.createElement('td');\n\n // Add Attributes\n th_vertical.setAttribute('scope', 'row');\n tr_body.setAttribute('id', `repoRow${i}`);\n\n // Add Inner HTML\n th_vertical.innerHTML = i + 1;\n td_1.innerHTML = currentRepo.name;\n td_2.innerHTML = `${currentRepo.id}`;\n td_3.innerHTML = currentRepo.created_at;\n td_4.innerHTML = `${currentRepo.owner.login}`;\n td_5.innerHTML = `View`;\n td_6.innerHTML = `Delete`;\n\n // Associations\n tr_body.appendChild(th_vertical);\n tr_body.appendChild(td_1);\n tr_body.appendChild(td_2);\n tr_body.appendChild(td_3);\n tr_body.appendChild(td_4);\n tr_body.appendChild(td_5);\n tr_body.appendChild(td_6);\n tbody.appendChild(tr_body);\n table.appendChild(tbody);\n }\n\n return table;\n }\n\n loadConversations(historyAll) {\n if (historyAll) {\n historyAll.forEach(element => {\n this.addGitOperationHistory(element);\n });\n }\n }\n\n createCommentBody(data) {\n const commentPara = document.createElement('p');\n const lastComment = helper.getLatestComment(data);\n commentPara.classList.add('card-text');\n commentPara.innerHTML = `COMMENT: ${lastComment}`;\n return commentPara;\n }\n\n concealCodeInUrl() {\n window.location = 'http://localhost:8080';\n }\n\n toggleModals(response) {\n const self = this;\n const promise = response.json();\n const intent = $(`#${$config.costants.hiddenIntentFieldId}`).val();\n $('#submitConfirm').addClass('hide');\n $('#btnCancelConfirm').click();\n $('.modal-backdrop').removeClass('modal-backdrop');\n $('#underWidgetLine').addClass('hide');\n $('#intentBox').addClass('hide');\n if (response && response.status && (response.status === 201 || response.status === 200 || response.status === 204)) {\n $('#successAlert').removeClass('hide');\n $('#widgets').children().addClass('hide');\n promise.then(body => {\n $('#op-msg').text($config.intentSlugToOperations[intent].successMessage);\n $('#successAlert').removeClass('hide');\n // self.addGitOperationHistory(body, 'response');\n // clear intent\n $(`#${$config.costants.hiddenIntentFieldId}`).val('');\n });\n } else {\n $('#widgets').children().addClass('hide');\n $('#dangerAlert').removeClass('hide');\n // self.addGitOperationHistory(response.status);\n // clear intent\n $(`#${$config.costants.hiddenIntentFieldId}`).val('');\n }\n }\n\n display_ct(start, element) {\n this.start = start;\n this.element = element;\n const days = Math.floor(this.start / 86400);\n const hours = Math.floor((this.start - days * 86400) / 3600);\n const minutes = Math.floor((this.start - days * 86400 - hours * 3600) / 60);\n const secs = Math.floor(this.start - days * 86400 - hours * 3600 - minutes * 60);\n let x = '';\n if (days != 0) {\n x = `${x + days} days`;\n }\n if (hours != 0) {\n x = `${x + hours} hours`;\n }\n if (minutes != 0) {\n x = `${x + minutes} minutes`;\n }\n x = `${x + secs} seconds ago`;\n element.innerHTML = x;\n this.start = this.start + 1;\n // setTimeout(this['display_ct](this.start, this.element)', 1000 )\n }\n};\n\n//# sourceURL=webpack:///./src/js/services/dom-ops.js?"); + +/***/ }), + +/***/ "./src/js/services/github-ops.js": +/*!***************************************!*\ + !*** ./src/js/services/github-ops.js ***! + \***************************************/ +/*! exports provided: Github */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Github\", function() { return Github; });\n/* harmony import */ var _dom_ops_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./dom-ops.js */ \"./src/js/services/dom-ops.js\");\n/* harmony import */ var _persistent_ops_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./persistent-ops.js */ \"./src/js/services/persistent-ops.js\");\nconst config = __webpack_require__(/*! ../config.js */ \"./src/js/config.js\");\n\n\nconst dom = new _dom_ops_js__WEBPACK_IMPORTED_MODULE_0__[\"DomManipulator\"]();\n\n\nconst persistentOps = new _persistent_ops_js__WEBPACK_IMPORTED_MODULE_1__[\"PersistentOps\"]();\n\nclass Github {\n constructor() {\n this.authorizationToken = `token ${config.gitToken}`;\n }\n\n getToken(code) {\n let token = '';\n self = this;\n $.getJSON(`https://micobot.herokuapp.com/authenticate/${code}`, data => {\n console.log(data.token);\n token = data.token;\n // set cookie here\n persistentOps.setCookie('gitToken', token, 30);\n // self.authorizationToken = \"token \" + persistentOps.getCookie('gitToken');\n dom.concealCodeInUrl();\n });\n return token;\n }\n\n getCurrentUser() {\n let repositories = '';\n const url = 'https://api.github.com/user/';\n fetch(url, {\n method: 'GET',\n headers: {\n 'Content-Type': 'application/json; charset=utf-8'\n }\n }).then(response => {\n response.json().then(body => {\n repositories = body;\n console.log(repositories);\n return repositories;\n });\n dom.toggleModals(response);\n }).catch(error => console.error('Fetch Error =\\n', error));\n return repositories;\n }\n\n authenticate() {}\n\n viewRepositories() {\n const repositories = '';\n const url = 'https://api.github.com/user/repos';\n fetch(url, {\n method: 'GET',\n headers: {\n 'Content-Type': 'application/json; charset=utf-8',\n Authorization: this.authorizationToken\n }\n }).then(response => {\n // response.json().then(function(body){\n // repositories = body;\n // console.log(repositories);\n // return repositories;\n // });\n dom.toggleModals(response);\n }).catch(error => console.error('Fetch Error =\\n', error));\n return repositories;\n }\n\n createRepository(newRepoJson) {\n const url = 'https://api.github.com/user/repos';\n const responsePromise = '';\n fetch(url, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json; charset=utf-8',\n Authorization: this.authorizationToken\n },\n body: JSON.stringify(newRepoJson)\n }).then(response => {\n dom.toggleModals(response);\n }).catch(error => console.error('Fetch Error =\\n', error));\n }\n\n updateRepository(updateRepoJson, repoName) {\n repoName = 'Hello-World3';\n const url = `https://api.github.com/repos/mohiit1502/${repoName}`;\n fetch(url, {\n method: 'PATCH',\n headers: {\n 'Content-Type': 'application/json; charset=utf-8',\n Authorization: this.authorizationToken\n },\n body: JSON.stringify(updateRepoJson)\n }).then(response => response.json()).catch(error => console.error('Fetch Error =\\n', error));\n }\n\n deleteRepository(repoName) {\n repoName = 'Hello-World2';\n const url = `https://api.github.com/repos/mohiit1502/${repoName}`;\n fetch(url, {\n method: 'DELETE',\n headers: {\n 'Content-Type': 'application/json; charset=utf-8',\n Authorization: this.authorizationToken\n }\n }).then(response => response.json()).catch(error => console.error('Fetch Error =\\n', error));\n }\n\n createIssue(newIssueJson, repoName) {\n const url = `https://api.github.com/repos/mohiit1502/${repoName}/issues`;\n fetch(url, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json; charset=utf-8',\n Authorization: this.authorizationToken\n },\n body: JSON.stringify(newIssueJson)\n }).then(response => {\n dom.toggleModals(response);\n }).catch(error => console.error('Fetch Error =\\n', error));\n }\n\n updateIssue(updateIssueJson, repoName, issueNumber) {\n repoName = 'stack_route_prj7';\n issueNumber = 2;\n const url = `https://api.github.com/repos/mohiit1502/${repoName}/issues/${issueNumber}`;\n fetch(url, {\n method: 'PATCH',\n headers: {\n 'Content-Type': 'application/json; charset=utf-8',\n Authorization: this.authorizationToken\n },\n body: JSON.stringify(updateIssueJson)\n }).then(response => response.json()).catch(error => console.error('Fetch Error =\\n', error));\n }\n\n closeIssue(closeIssueJson, repoName, issueNumber) {\n const url = `https://api.github.com/repos/mohiit1502/${repoName}/issues/${issueNumber}`;\n fetch(url, {\n method: 'PATCH',\n headers: {\n 'Content-Type': 'application/json; charset=utf-8',\n Authorization: this.authorizationToken\n },\n body: JSON.stringify(closeIssueJson)\n }).then(response => {\n dom.toggleModals(response);\n }).catch(error => console.error('Fetch Error =\\n', error));\n }\n\n reopenIssue(reopenIssueJson, repoName, issueNumber) {\n repoName = 'stack_route_prj7';\n issueNumber = 2;\n const url = `https://api.github.com/repos/mohiit1502/${repoName}/issues/${issueNumber}`;\n fetch(url, {\n method: 'PATCH',\n headers: {\n 'Content-Type': 'application/json; charset=utf-8',\n Authorization: this.authorizationToken\n },\n body: JSON.stringify(reopenIssueJson)\n }).then(response => response.json()).catch(error => console.error('Fetch Error =\\n', error));\n }\n\n displayIssue(repoName, issueNumber) {\n repoName = 'stack_route_prj7';\n issueNumber = 2;\n const url = `https://api.github.com/repos/mohiit1502/${repoName}/issues/${issueNumber}`;\n let issues = '';\n fetch(url, {\n method: 'GET',\n headers: {\n 'Content-Type': 'application/json; charset=utf-8',\n Authorization: this.authorizationToken\n }\n }).then(response => {\n response.json().then(body => {\n issues = body;\n console.log(issues);\n return issues;\n });\n }).catch(error => console.error('Fetch Error =\\n', error));\n return issues;\n }\n\n addIssueComment(commentBodyJson, repoName, issueId) {\n const url = `https://api.github.com/repos/mohiit1502/${repoName}/issues/${issueId}/comments`;\n fetch(url, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json; charset=utf-8',\n Authorization: this.authorizationToken\n },\n body: JSON.stringify(commentBodyJson)\n }).then(response => {\n dom.toggleModals(response);\n }).catch(error => console.error('Fetch Error =\\n', error));\n }\n\n displayLastComment(repoName, issueNumber) {\n const url = `https://api.github.com/repos/mohiit1502/${repoName}/issues/${issueNumber}/comments`;\n const comments = [];\n const latestComment = '';\n fetch(url, {\n method: 'GET',\n headers: {\n 'Content-Type': 'application/json; charset=utf-8',\n Authorization: this.authorizationToken\n }\n }).then(response => {\n dom.toggleModals(response);\n // response.json().then(function(body){\n // comments = body;\n // latestComment = githubHelper.getLatestComment(comments);\n // console.log(comments);\n // console.log(latestComment);\n // });\n }).catch(error => console.error('Fetch Error =\\n', error));\n }\n\n displayIssuesForUser() {\n const url = 'https://api.github.com/user/issues';\n fetch(url, {\n method: 'GET',\n headers: {\n 'Content-Type': 'application/json; charset=utf-8',\n Authorization: this.authorizationToken\n }\n }).then(response => response.json()).catch(error => console.error('Fetch Error =\\n', error));\n }\n\n displayIssuesOnRepo() {\n repoName = 'stack_route_prj7';\n issueNumber = 2;\n const url = `https://api.github.com/repos/mohiit1502/${repoName}/issues/`;\n fetch(url, {\n method: 'PATCH',\n headers: {\n 'Content-Type': 'application/json; charset=utf-8',\n Authorization: this.authorizationToken\n },\n body: JSON.stringify(updateIssueJson)\n }).then(response => response.json()).catch(error => console.error('Fetch Error =\\n', error));\n }\n\n addCollaborator(repoName, collaborator) {\n repoName = 'stack_route_prj7';\n collaborator = 'swat1508';\n const url = `https://api.github.com/repos/mohiit1502/${repoName}/collaborators/${collaborator}`;\n fetch(url, {\n method: 'PUT',\n headers: {\n 'Content-Type': 'application/json',\n Authorization: this.authorizationToken\n }\n }).then(response => {\n dom.toggleModals(response);\n }).catch(error => console.error('Fetch Error =\\n', error));\n }\n\n removeCollaborator(repoName, collaborator) {\n repoName = 'stack_route_prj7';\n collaborator = 'swat1508';\n const url = `https://api.github.com/repos/mohiit1502/${repoName}/collaborators/${collaborator}`;\n fetch(url, {\n method: 'DELETE',\n headers: {\n 'Content-Type': 'application/json',\n Authorization: this.authorizationToken\n }\n }).then(response => response.json()).catch(error => console.error('Fetch Error =\\n', error));\n }\n\n createUser(newuserJson) {}\n\n updateUser(updateUserJson) {}\n\n deleteUser(userId) {}\n};\n\n//# sourceURL=webpack:///./src/js/services/github-ops.js?"); + +/***/ }), + +/***/ "./src/js/services/microbot-ops.js": +/*!*****************************************!*\ + !*** ./src/js/services/microbot-ops.js ***! + \*****************************************/ +/*! exports provided: Microbot */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Microbot\", function() { return Microbot; });\n/* harmony import */ var _github_ops_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./github-ops.js */ \"./src/js/services/github-ops.js\");\n/* harmony import */ var _persistent_ops_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./persistent-ops.js */ \"./src/js/services/persistent-ops.js\");\n\nconst $github = new _github_ops_js__WEBPACK_IMPORTED_MODULE_0__[\"Github\"]();\n\n\nconst persistentOps = new _persistent_ops_js__WEBPACK_IMPORTED_MODULE_1__[\"PersistentOps\"]();\n\nclass Microbot {\n constructor(clientId, clientSecret) {\n // TODO move to config or env variables\n this.clientId = 'f6f649a1fe2dfea082ba';\n this.clientSecret = '7e9a33d05ffdb36b4a498140bb9bb06d62de4f0e';\n }\n\n getToken(code) {\n $github.getToken(code);\n }\n\n setToken() {\n $github.authorizationToken = `token ${persistentOps.getCookie('gitToken')}`;\n }\n\n getCurrentUser() {\n $github.getCurrentUser();\n }\n\n viewRepositories() {\n return $github.viewRepositories();\n }\n\n createRepository(requestData) {\n const requestJson = requestData.request;\n $github.createRepository(requestJson);\n // $github.createRepository({\n // \"name\": \"new-test-js-git-api-repo\",\n // \"description\": \"This is your first repository\",\n // \"homepage\": \"https://github.com\",\n // \"private\": false,\n // \"has_issues\": true,\n // \"has_wiki\": true\n // })\n }\n\n updateRepository(repoName, repoType) {\n $github.authenticate();\n $github.updateRepository({\n name: 'Hello-World4',\n description: 'This is your test description',\n homepage: 'https://github.com',\n private: false,\n has_issues: true,\n has_projects: true,\n has_wiki: true\n });\n }\n\n deleteRepository() {\n $github.deleteRepository();\n }\n\n createIssue(requestData) {\n const requestJson = requestData.request;\n const repoName = requestData.urlParams.repoName;\n $github.createIssue(requestJson, repoName);\n }\n\n updateIssue() {\n $github.updateIssue({\n title: 'Found a bug - title updated',\n body: 'This is the updated problem description.',\n assignees: ['mohiit1502'],\n milestone: 1,\n state: 'open',\n labels: ['bug', 'issue']\n });\n }\n\n closeIssue(requestData) {\n const repoName = requestData.urlParams.repoName;\n const issueId = requestData.urlParams.issueId;\n $github.closeIssue({\n state: 'close'\n }, repoName, issueId);\n }\n\n displayIssue() {\n return $github.displayIssue();\n }\n\n reopenIssue() {\n $github.reopenIssue({\n milestone: 1,\n state: 'open'\n });\n }\n\n addIssueComment(requestData) {\n const requestJson = requestData.request;\n const repoName = requestData.urlParams.repoName;\n const issueId = requestData.urlParams.issueId;\n $github.addIssueComment(requestJson, repoName, issueId);\n }\n\n displayLastComment(requestData) {\n const repoName = requestData.urlParams.repoName;\n const issueId = requestData.urlParams.issueId;\n return $github.displayLastComment(repoName, issueId);\n }\n\n addCollaborator(requestData) {\n const repoName = requestData.urlParams.repoName;\n const collaborator = requestData.urlParams.collaborator;\n $github.addCollaborator(repoName, collaborator);\n }\n\n removeCollaborator() {\n $github.removeCollaborator();\n }\n\n callAppropriate(intent) {}\n};\n\n//# sourceURL=webpack:///./src/js/services/microbot-ops.js?"); + +/***/ }), + +/***/ "./src/js/services/persistent-ops.js": +/*!*******************************************!*\ + !*** ./src/js/services/persistent-ops.js ***! + \*******************************************/ +/*! exports provided: PersistentOps, store */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PersistentOps\", function() { return PersistentOps; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"store\", function() { return store; });\n/* harmony import */ var redux__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! redux */ \"./node_modules/redux/es/redux.js\");\n/* harmony import */ var _helpers_helper__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../helpers/helper */ \"./src/js/helpers/helper.js\");\n/* harmony import */ var _dom_ops__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./dom-ops */ \"./src/js/services/dom-ops.js\");\n\nconst state = __webpack_require__(/*! ./../data/history */ \"./src/js/data/history.js\");\n\nconst helper = new _helpers_helper__WEBPACK_IMPORTED_MODULE_1__[\"Helper\"]();\n\nconst dom = new _dom_ops__WEBPACK_IMPORTED_MODULE_2__[\"DomManipulator\"]();\nconst $config = __webpack_require__(/*! ../config */ \"./src/js/config.js\");\n\nclass PersistentOps {\n\n setCookie(cname, cvalue, exdays) {\n const d = new Date();\n d.setTime(d.getTime() + exdays * 24 * 60 * 60 * 1000);\n const expires = `expires=${d.toUTCString()}`;\n document.cookie = `${cname}=${cvalue};${expires};path=/`;\n }\n\n getCookie(cname) {\n const name = `${cname}=`;\n const decodedCookie = decodeURIComponent(document.cookie);\n const ca = decodedCookie.split(';');\n for (let i = 0; i < ca.length; i++) {\n let c = ca[i];\n while (c.charAt(0) == ' ') {\n c = c.substring(1);\n }\n if (c.indexOf(name) == 0) {\n return c.substring(name.length, c.length);\n }\n }\n return '';\n }\n\n}\n\nfunction mbReducer(currentState, action) {\n var nextState = {};\n let newHistory = {};\n switch (action.type) {\n case 'ADD_REPO':\n // let command = document.getElementById('command').value;\n // nextState = window.localStorage.getItem('currentState') ? JSON.parse(window.localStorage.getItem('currentState')) : currentState;\n // newHistory.command = command;\n // newHistory.type = 'command';\n // // newHistory.intent = 'commandbot'\n // newHistory.insertionCounter = ++nextState.insertionCounter;\n // if(nextState.queries) {\n // nextState.queries = [ ...nextState.queries, newHistory ];\n // } else {\n // nextState.queries = [ newHistory ];\n // }\n // window.localStorage.setItem('currentState', JSON.stringify(nextState));\n // return nextState;\n break;\n case 'ADD_COLLAB':\n // let command = document.getElementById('command').value;\n // nextState = window.localStorage.getItem('currentState') ? JSON.parse(window.localStorage.getItem('currentState')) : currentState;\n // newHistory.command = command;\n // newHistory.type = 'command';\n // // newHistory.intent = 'commandbot'\n // newHistory.insertionCounter = ++nextState.insertionCounter;\n // if(nextState.queries) {\n // nextState.queries = [ ...nextState.queries, newHistory ];\n // } else {\n // nextState.queries = [ newHistory ];\n // }\n // window.localStorage.setItem('currentState', JSON.stringify(nextState));\n // return nextState;\n break;\n case 'ADD_ISSUE':\n // let command = document.getElementById('command').value;\n // nextState = window.localStorage.getItem('currentState') ? JSON.parse(window.localStorage.getItem('currentState')) : currentState;\n // newHistory.command = command;\n // newHistory.type = 'command';\n // // newHistory.intent = 'commandbot'\n // newHistory.insertionCounter = ++nextState.insertionCounter;\n // if(nextState.queries) {\n // nextState.queries = [ ...nextState.queries, newHistory ];\n // } else {\n // nextState.queries = [ newHistory ];\n // }\n // window.localStorage.setItem('currentState', JSON.stringify(nextState));\n // return nextState;\n break;\n case 'ADD_COMMENT':\n // let command = document.getElementById('command').value;\n // nextState = window.localStorage.getItem('currentState') ? JSON.parse(window.localStorage.getItem('currentState')) : currentState;\n // newHistory.command = command;\n // newHistory.type = 'command';\n // // newHistory.intent = 'commandbot'\n // newHistory.insertionCounter = ++nextState.insertionCounter;\n // if(nextState.queries) {\n // nextState.queries = [ ...nextState.queries, newHistory ];\n // } else {\n // nextState.queries = [ newHistory ];\n // }\n // window.localStorage.setItem('currentState', JSON.stringify(nextState));\n // return nextState;\n break;\n case 'CLOSE_ISSUE':\n // let command = document.getElementById('command').value;\n // nextState = window.localStorage.getItem('currentState') ? JSON.parse(window.localStorage.getItem('currentState')) : currentState;\n // newHistory.command = command;\n // newHistory.type = 'command';\n // // newHistory.intent = 'commandbot'\n // newHistory.insertionCounter = ++nextState.insertionCounter;\n // if(nextState.queries) {\n // nextState.queries = [ ...nextState.queries, newHistory ];\n // } else {\n // nextState.queries = [ newHistory ];\n // }\n // window.localStorage.setItem('currentState', JSON.stringify(nextState));\n // return nextState;\n break;\n case 'SHOW_LAST_COMMENT':\n // let command = document.getElementById('command').value;\n // nextState = window.localStorage.getItem('currentState') ? JSON.parse(window.localStorage.getItem('currentState')) : currentState;\n // newHistory.command = command;\n // newHistory.type = 'command';\n // // newHistory.intent = 'commandbot'\n // newHistory.insertionCounter = ++nextState.insertionCounter;\n // if(nextState.queries) {\n // nextState.queries = [ ...nextState.queries, newHistory ];\n // } else {\n // nextState.queries = [ newHistory ];\n // }\n // window.localStorage.setItem('currentState', JSON.stringify(nextState));\n // return nextState;\n break;\n case 'VIEW_REPO':\n // let command = document.getElementById('command').value;\n // nextState = window.localStorage.getItem('currentState') ? JSON.parse(window.localStorage.getItem('currentState')) : currentState;\n // newHistory.command = command;\n // newHistory.type = 'command';\n // // newHistory.intent = 'commandbot'\n // newHistory.insertionCounter = ++nextState.insertionCounter;\n // if(nextState.queries) {\n // nextState.queries = [ ...nextState.queries, newHistory ];\n // } else {\n // nextState.queries = [ newHistory ];\n // }\n // window.localStorage.setItem('currentState', JSON.stringify(nextState));\n // return nextState;\n break;\n case 'ADD_QUERY':\n let command = document.getElementById('command').value;\n nextState = window.localStorage.getItem('currentState') ? JSON.parse(window.localStorage.getItem('currentState')) : currentState;\n newHistory.command = command;\n newHistory.type = 'command';\n // newHistory.intent = 'commandbot'\n newHistory.insertionCounter = ++nextState.insertionCounter;\n if (nextState.queries) {\n nextState.queries = [...nextState.queries, newHistory];\n } else {\n nextState.queries = [newHistory];\n }\n window.localStorage.setItem('currentState', JSON.stringify(nextState));\n return nextState;\n break;\n case 'CLEAR_HISTORY':\n nextState = helper.clone(state);\n newHistory.command = $config.intentSlugToOperations.resethistory.cardMsg;\n newHistory.type = 'response';\n newHistory.insertionCounter = 0;\n newHistory.intent = $('#' + $config.costants.hiddenIntentFieldId).val();\n nextState.messages = [newHistory];\n window.localStorage.setItem('currentState', JSON.stringify(nextState));\n return nextState;\n default:\n return currentState;\n }\n}\n\nfunction renderCards() {\n $('#conversations').empty();\n let historyAll = helper.concatenateAndSort(store.getState());\n dom.loadConversations(historyAll);\n}\n\nconst store = Object(redux__WEBPACK_IMPORTED_MODULE_0__[\"createStore\"])(mbReducer, state);\nstore.subscribe(renderCards);\n\n//# sourceURL=webpack:///./src/js/services/persistent-ops.js?"); + +/***/ }), + +/***/ "./src/js/services/recast-ops.js": +/*!***************************************!*\ + !*** ./src/js/services/recast-ops.js ***! + \***************************************/ +/*! exports provided: Recast */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Recast\", function() { return Recast; });\n/* harmony import */ var _persistent_ops__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./persistent-ops */ \"./src/js/services/persistent-ops.js\");\n/* harmony import */ var _dom_ops__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./dom-ops */ \"./src/js/services/dom-ops.js\");\n\nconst store = _persistent_ops__WEBPACK_IMPORTED_MODULE_0__[\"store\"];\nconst $config = __webpack_require__(/*! ../config */ \"./src/js/config.js\");\n\nconst dom = new _dom_ops__WEBPACK_IMPORTED_MODULE_1__[\"DomManipulator\"]();\n\nconst $actions = $config.actions;\n\nclass Recast {\n constructor() {\n this.recastToken = $config.recasttoken;\n this.requestUrl = \"https://api.recast.ai/v2/request\";\n }\n\n getAndCallProcessIntent(command, text) {\n self = this;\n var url = this.requestUrl + \"?text=\" + command;\n var bodyRelevant = '';\n var intent = '';\n fetch(url, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json; charset=utf-8\",\n \"Authorization\": \"Token \" + this.recastToken\n },\n data: text\n }).then(function (response) {\n response.json().then(function (body) {\n bodyRelevant = body.results;\n intent = bodyRelevant.intents[0][\"slug\"];\n $('#' + $config.costants.hiddenIntentFieldId).val(intent);\n if (intent !== undefined) {\n dom.displayIntentBox(intent);\n if (intent == 'resethistory') {\n store.dispatch($actions.action_clear_history);\n return;\n }\n dom.showWidget(intent);\n dom.populateRecastData(intent, bodyRelevant);\n store.dispatch($actions.action_add_query);\n }\n return intent;\n });\n }).catch(function (error) {\n console.error('Fetch Error =\\n', error);\n });\n }\n}\n\n//# sourceURL=webpack:///./src/js/services/recast-ops.js?"); + +/***/ }), + +/***/ "./src/js/views/addcollab.js": +/*!***********************************!*\ + !*** ./src/js/views/addcollab.js ***! + \***********************************/ +/*! exports provided: addcollab */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"addcollab\", function() { return addcollab; });\nconst addcollab = `
\n \n
\n
Create Collaborator
\n
\n
\n
\n \n \n
\n
\n \n \n
\n
\n
\n \n \n
\n \n
\n
\n
`;\n\n//# sourceURL=webpack:///./src/js/views/addcollab.js?"); + +/***/ }), + +/***/ "./src/js/views/addissuecomment.js": +/*!*****************************************!*\ + !*** ./src/js/views/addissuecomment.js ***! + \*****************************************/ +/*! exports provided: addissuecomment */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"addissuecomment\", function() { return addissuecomment; });\nconst addissuecomment = `
\n \n
\n
Add Comment
\n
\n
\n
\n \n \n
\n
\n \n \n
\n
\n
\n \n \n
\n \n
\n
\n
`;\n\n//# sourceURL=webpack:///./src/js/views/addissuecomment.js?"); + +/***/ }), + +/***/ "./src/js/views/closeissue.js": +/*!************************************!*\ + !*** ./src/js/views/closeissue.js ***! + \************************************/ +/*! exports provided: closeissue */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"closeissue\", function() { return closeissue; });\nconst closeissue = `
\n
\n
Close Issue
\n
\n
\n
\n \n \n
\n
\n \n \n
\n
\n \n
\n
\n
`;\n\n//# sourceURL=webpack:///./src/js/views/closeissue.js?"); + +/***/ }), + +/***/ "./src/js/views/createissue.js": +/*!*************************************!*\ + !*** ./src/js/views/createissue.js ***! + \*************************************/ +/*! exports provided: createissue */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"createissue\", function() { return createissue; });\nconst createissue = `
\n \n
\n
Create Issue
\n
\n
\n
\n \n \n
\n
\n \n \n
\n
\n
\n
\n \n \n
\n
\n \n \n
\n
\n
\n \n \n
\n \n
\n
\n
`;\n\n//# sourceURL=webpack:///./src/js/views/createissue.js?"); + +/***/ }), + +/***/ "./src/js/views/createrepo.js": +/*!************************************!*\ + !*** ./src/js/views/createrepo.js ***! + \************************************/ +/*! exports provided: createrepo */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"createrepo\", function() { return createrepo; });\nconst createrepo = `
\n
\n
Create Repository
\n
\n
\n
\n \n \n
\n
\n \n \n
\n
\n
\n
\n
\n \n \n
\n
\n
\n
\n \n \n
\n
\n
\n
\n \n \n
\n
\n
\n
\n \n \n
\n \n
\n
\n
\n`;\n\n//# sourceURL=webpack:///./src/js/views/createrepo.js?"); + +/***/ }), + +/***/ "./src/js/views/displaylastcomment.js": +/*!********************************************!*\ + !*** ./src/js/views/displaylastcomment.js ***! + \********************************************/ +/*! exports provided: displaylastcomment */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"displaylastcomment\", function() { return displaylastcomment; });\nconst displaylastcomment = `
\n
\n
Display Last Comment
\n
\n
\n
\n \n \n
\n
\n \n \n
\n
\n \n
\n
\n
`;\n\n//# sourceURL=webpack:///./src/js/views/displaylastcomment.js?"); + +/***/ }), + +/***/ "./src/js/views/viewrepos.js": +/*!***********************************!*\ + !*** ./src/js/views/viewrepos.js ***! + \***********************************/ +/*! exports provided: viewrepos */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"viewrepos\", function() { return viewrepos; });\nconst viewrepos = `
\n
\n
View Repositories
\n
\n
\n
\n

View Repositories for the user mohiit1502?

\n
\n
\n \n
\n
\n
`;\n\n//# sourceURL=webpack:///./src/js/views/viewrepos.js?"); /***/ }), diff --git a/dist/index.html b/dist/index.html index 7c99e9c..7541076 100644 --- a/dist/index.html +++ b/dist/index.html @@ -7,6 +7,7 @@ Microbot +