authscape 1.0.460 → 1.0.464

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -5626,6 +5626,260 @@ function StripePayment(_ref3) {
5626
5626
  }
5627
5627
  "use strict";
5628
5628
 
5629
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
5630
+ Object.defineProperty(exports, "__esModule", {
5631
+ value: true
5632
+ });
5633
+ exports["default"] = Comments;
5634
+ var _react = _interopRequireWildcard(require("react"));
5635
+ var _material = require("@mui/material");
5636
+ var _InputBase = _interopRequireDefault(require("@mui/material/InputBase"));
5637
+ var _IconButton = _interopRequireDefault(require("@mui/material/IconButton"));
5638
+ var _QuestionAnswerOutlined = _interopRequireDefault(require("@mui/icons-material/QuestionAnswerOutlined"));
5639
+ var _Typography = _interopRequireDefault(require("@mui/material/Typography"));
5640
+ var _Grid = _interopRequireDefault(require("@mui/material/Grid"));
5641
+ var _List = _interopRequireDefault(require("@mui/material/List"));
5642
+ var _ListItem = _interopRequireDefault(require("@mui/material/ListItem"));
5643
+ var _ListItemText = _interopRequireDefault(require("@mui/material/ListItemText"));
5644
+ var _Avatar = _interopRequireDefault(require("@mui/material/Avatar"));
5645
+ var _SendRounded = _interopRequireDefault(require("@mui/icons-material/SendRounded"));
5646
+ var _scrollIntoViewIfNeeded = _interopRequireDefault(require("scroll-into-view-if-needed"));
5647
+ var _Stack = _interopRequireDefault(require("@mui/material/Stack"));
5648
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
5649
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
5650
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
5651
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
5652
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
5653
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
5654
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
5655
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
5656
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
5657
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
5658
+ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
5659
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } // import { apiService } from 'authscape';
5660
+ function Comments(_ref) {
5661
+ var ticketId = _ref.ticketId,
5662
+ isNote = _ref.isNote,
5663
+ isDisabled = _ref.isDisabled,
5664
+ currentUser = _ref.currentUser;
5665
+ var _useState = (0, _react.useState)([]),
5666
+ _useState2 = _slicedToArray(_useState, 2),
5667
+ comments = _useState2[0],
5668
+ setComments = _useState2[1];
5669
+ var _useState3 = (0, _react.useState)(""),
5670
+ _useState4 = _slicedToArray(_useState3, 2),
5671
+ message = _useState4[0],
5672
+ setMessage = _useState4[1];
5673
+ // const [messageDialogOpen, setMessageDialogOpen] = useState(false);
5674
+
5675
+ var reloadMessages = /*#__PURE__*/function () {
5676
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
5677
+ var response, node;
5678
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
5679
+ while (1) switch (_context.prev = _context.next) {
5680
+ case 0:
5681
+ _context.next = 2;
5682
+ return apiService().get("/Ticket/GetMessages?TicketId=" + ticketId + "&isNote=" + isNote);
5683
+ case 2:
5684
+ response = _context.sent;
5685
+ if (response != null && response.status == 200) {
5686
+ setComments(response.data);
5687
+ }
5688
+ node = document.getElementById('messages');
5689
+ if (node != null) {
5690
+ (0, _scrollIntoViewIfNeeded["default"])(node, {
5691
+ behavior: 'smooth',
5692
+ scrollMode: 'if-needed'
5693
+ });
5694
+ }
5695
+
5696
+ // setIsLoading(false);
5697
+ case 6:
5698
+ case "end":
5699
+ return _context.stop();
5700
+ }
5701
+ }, _callee);
5702
+ }));
5703
+ return function reloadMessages() {
5704
+ return _ref2.apply(this, arguments);
5705
+ };
5706
+ }();
5707
+ (0, _react.useEffect)(function () {
5708
+ if (ticketId != null) {
5709
+ var asyncPush = /*#__PURE__*/function () {
5710
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
5711
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
5712
+ while (1) switch (_context2.prev = _context2.next) {
5713
+ case 0:
5714
+ _context2.next = 2;
5715
+ return reloadMessages();
5716
+ case 2:
5717
+ case "end":
5718
+ return _context2.stop();
5719
+ }
5720
+ }, _callee2);
5721
+ }));
5722
+ return function asyncPush() {
5723
+ return _ref3.apply(this, arguments);
5724
+ };
5725
+ }();
5726
+ asyncPush();
5727
+ }
5728
+ }, [ticketId]);
5729
+ var SendMessage = /*#__PURE__*/function () {
5730
+ var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
5731
+ var response;
5732
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
5733
+ while (1) switch (_context3.prev = _context3.next) {
5734
+ case 0:
5735
+ if (!(message !== "")) {
5736
+ _context3.next = 8;
5737
+ break;
5738
+ }
5739
+ _context3.next = 3;
5740
+ return apiService().post("/Ticket/CreateMessage", {
5741
+ ticketId: ticketId,
5742
+ name: currentUser.firstName,
5743
+ message: message,
5744
+ isNote: isNote
5745
+ });
5746
+ case 3:
5747
+ response = _context3.sent;
5748
+ if (!(response != null && response.status == 200)) {
5749
+ _context3.next = 8;
5750
+ break;
5751
+ }
5752
+ _context3.next = 7;
5753
+ return reloadMessages();
5754
+ case 7:
5755
+ // messagesEndRef.current?.scrollIntoView({ behavior: 'smooth' });
5756
+ // let messages = comments.slice();
5757
+ // messages.push(message);
5758
+ // setComments(messages);
5759
+ setMessage("");
5760
+ case 8:
5761
+ case "end":
5762
+ return _context3.stop();
5763
+ }
5764
+ }, _callee3);
5765
+ }));
5766
+ return function SendMessage() {
5767
+ return _ref4.apply(this, arguments);
5768
+ };
5769
+ }();
5770
+ return /*#__PURE__*/_react["default"].createElement(_material.Box, {
5771
+ sx: {
5772
+ display: "flex",
5773
+ flexDirection: "column",
5774
+ height: "100%"
5775
+ }
5776
+ }, /*#__PURE__*/_react["default"].createElement(_material.Box, {
5777
+ sx: {
5778
+ backgroundColor: "#F3F5F7",
5779
+ overflow: "auto",
5780
+ flex: "1 1 auto"
5781
+ }
5782
+ }, /*#__PURE__*/_react["default"].createElement(_material.Box, null, comments.length == 0 && /*#__PURE__*/_react["default"].createElement(_material.Box, {
5783
+ sx: {
5784
+ paddingLeft: 4
5785
+ }
5786
+ }, /*#__PURE__*/_react["default"].createElement(_QuestionAnswerOutlined["default"], {
5787
+ sx: {
5788
+ fill: "gray",
5789
+ position: "relative",
5790
+ top: "4px",
5791
+ marginRight: 2
5792
+ },
5793
+ fontSize: "2px"
5794
+ }), /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
5795
+ variant: "subtitle2",
5796
+ color: "text.secondary",
5797
+ component: "span",
5798
+ sx: {
5799
+ marginTop: 1
5800
+ }
5801
+ }, "Add your first ", isNote ? "note" : "message", ". ", isNote ? "Your notes" : "The conversation history", " will appear here")), /*#__PURE__*/_react["default"].createElement(_material.Box, {
5802
+ sx: {
5803
+ overflow: "scroll",
5804
+ height: "300px"
5805
+ }
5806
+ }, /*#__PURE__*/_react["default"].createElement(_Grid["default"], {
5807
+ container: true
5808
+ }, /*#__PURE__*/_react["default"].createElement(_Grid["default"], {
5809
+ item: true,
5810
+ xs: 12
5811
+ }, /*#__PURE__*/_react["default"].createElement(_List["default"], null, comments != null && comments.map(function (comment, index) {
5812
+ return /*#__PURE__*/_react["default"].createElement(_ListItem["default"], {
5813
+ key: index,
5814
+ sx: {
5815
+ marginTop: 1
5816
+ }
5817
+ }, /*#__PURE__*/_react["default"].createElement(_Grid["default"], {
5818
+ container: true
5819
+ }, /*#__PURE__*/_react["default"].createElement(_Grid["default"], {
5820
+ item: true,
5821
+ xs: 1
5822
+ }, /*#__PURE__*/_react["default"].createElement(_Avatar["default"], null)), /*#__PURE__*/_react["default"].createElement(_Grid["default"], {
5823
+ item: true,
5824
+ xs: 11
5825
+ }, /*#__PURE__*/_react["default"].createElement(_Stack["default"], {
5826
+ direction: "row",
5827
+ spacing: 1
5828
+ }, /*#__PURE__*/_react["default"].createElement(_material.Box, {
5829
+ sx: {
5830
+ fontSize: 12
5831
+ }
5832
+ }, comment.firstName), /*#__PURE__*/_react["default"].createElement(_material.Box, {
5833
+ sx: {
5834
+ fontSize: 12
5835
+ }
5836
+ }, comment.created)), /*#__PURE__*/_react["default"].createElement(_material.Box, {
5837
+ sx: {
5838
+ fontSize: 16
5839
+ }
5840
+ }, comment.message))));
5841
+ }), /*#__PURE__*/_react["default"].createElement(_ListItem["default"], null, /*#__PURE__*/_react["default"].createElement("div", {
5842
+ id: "messages"
5843
+ })))))))), /*#__PURE__*/_react["default"].createElement(_material.Box, {
5844
+ sx: {
5845
+ flex: "0 1 40px"
5846
+ }
5847
+ }, /*#__PURE__*/_react["default"].createElement(_material.Paper, {
5848
+ sx: {
5849
+ p: '2px 4px',
5850
+ display: 'flex',
5851
+ alignItems: 'center'
5852
+ }
5853
+ }, /*#__PURE__*/_react["default"].createElement(_InputBase["default"], {
5854
+ sx: {
5855
+ ml: 1,
5856
+ flex: 1
5857
+ },
5858
+ disabled: isDisabled,
5859
+ onKeyUp: function onKeyUp(event) {
5860
+ if (event.key == "Enter") {
5861
+ SendMessage();
5862
+ }
5863
+ },
5864
+ placeholder: !isNote ? "Write your message here..." : "Write your notes here...",
5865
+ value: message,
5866
+ onChange: function onChange(value) {
5867
+ setMessage(value.target.value);
5868
+ }
5869
+ }), /*#__PURE__*/_react["default"].createElement(_IconButton["default"], {
5870
+ disabled: isDisabled,
5871
+ type: "button",
5872
+ sx: {
5873
+ p: '10px'
5874
+ },
5875
+ "aria-label": "search",
5876
+ onClick: function onClick() {
5877
+ SendMessage();
5878
+ }
5879
+ }, /*#__PURE__*/_react["default"].createElement(_SendRounded["default"], null)))));
5880
+ }
5881
+ "use strict";
5882
+
5629
5883
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
5630
5884
  Object.defineProperty(exports, "__esModule", {
5631
5885
  value: true
@@ -5643,7 +5897,6 @@ var _FormControl = _interopRequireDefault(require("@mui/material/FormControl"));
5643
5897
  var _Select = _interopRequireDefault(require("@mui/material/Select"));
5644
5898
  var _TextField = _interopRequireDefault(require("@mui/material/TextField"));
5645
5899
  var _Autocomplete = _interopRequireWildcard(require("@mui/material/Autocomplete"));
5646
- var _comments = _interopRequireDefault(require("../comments"));
5647
5900
  var _material = require("@mui/material");
5648
5901
  var _InsertDriveFileRounded = _interopRequireDefault(require("@mui/icons-material/InsertDriveFileRounded"));
5649
5902
  var _ArrowBackIosRounded = _interopRequireDefault(require("@mui/icons-material/ArrowBackIosRounded"));
@@ -5663,6 +5916,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
5663
5916
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
5664
5917
  function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
5665
5918
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } // import { apiService } from 'authscape';
5919
+ // import Comments from '../comments';
5666
5920
  var TicketDetail = function TicketDetail(_ref) {
5667
5921
  var ticketId = _ref.ticketId,
5668
5922
  setIsLoading = _ref.setIsLoading,
@@ -6112,7 +6366,7 @@ var TicketDetail = function TicketDetail(_ref) {
6112
6366
  }, a11yProps(3))))), /*#__PURE__*/_react["default"].createElement(TabPanel, {
6113
6367
  value: value,
6114
6368
  index: 0
6115
- }, ticket != null && /*#__PURE__*/_react["default"].createElement(_comments["default"], {
6369
+ }, ticket != null && /*#__PURE__*/_react["default"].createElement(Comments, {
6116
6370
  ticketId: ticket.id,
6117
6371
  isDisabled: false,
6118
6372
  isNote: false,
@@ -6120,7 +6374,7 @@ var TicketDetail = function TicketDetail(_ref) {
6120
6374
  })), /*#__PURE__*/_react["default"].createElement(TabPanel, {
6121
6375
  value: value,
6122
6376
  index: 1
6123
- }, ticket != null && /*#__PURE__*/_react["default"].createElement(_comments["default"], {
6377
+ }, ticket != null && /*#__PURE__*/_react["default"].createElement(Comments, {
6124
6378
  ticketId: ticket.id,
6125
6379
  isDisabled: false,
6126
6380
  isNote: true,
@@ -6155,7 +6409,6 @@ var _DeleteRounded = _interopRequireDefault(require("@mui/icons-material/DeleteR
6155
6409
  var _Typography = _interopRequireDefault(require("@mui/material/Typography"));
6156
6410
  var _AppBar = _interopRequireDefault(require("@mui/material/AppBar"));
6157
6411
  var _Toolbar = _interopRequireDefault(require("@mui/material/Toolbar"));
6158
- var _yesNoDialog = _interopRequireDefault(require("../../components/yesNoDialog"));
6159
6412
  var _VisibilityRounded = _interopRequireDefault(require("@mui/icons-material/VisibilityRounded"));
6160
6413
  var _AddRounded = _interopRequireDefault(require("@mui/icons-material/AddRounded"));
6161
6414
  var _InputLabel = _interopRequireDefault(require("@mui/material/InputLabel"));
@@ -6176,6 +6429,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
6176
6429
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
6177
6430
  function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
6178
6431
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } // import {apiService, authService} from 'authscape';
6432
+ // import YesNoDialog from '../../components/yesNoDialog';
6179
6433
  // import TicketDetail from './TicketDetail';
6180
6434
  function Tickets(_ref) {
6181
6435
  var loadedUser = _ref.loadedUser,
@@ -6458,7 +6712,7 @@ function Tickets(_ref) {
6458
6712
  },
6459
6713
  pageSize: totalTickets,
6460
6714
  rowsPerPageOptions: [20]
6461
- })), /*#__PURE__*/_react["default"].createElement(_yesNoDialog["default"], {
6715
+ })), /*#__PURE__*/_react["default"].createElement(YesNoDialog, {
6462
6716
  open: archiveTicketId != null ? true : false,
6463
6717
  title: "Remove Ticket",
6464
6718
  message: "Are you sure you want to archive this ticket?",
@@ -6486,6 +6740,52 @@ function Tickets(_ref) {
6486
6740
  }
6487
6741
  "use strict";
6488
6742
 
6743
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
6744
+ Object.defineProperty(exports, "__esModule", {
6745
+ value: true
6746
+ });
6747
+ exports["default"] = YesNoDialog;
6748
+ var _react = _interopRequireWildcard(require("react"));
6749
+ var _Button = _interopRequireDefault(require("@mui/material/Button"));
6750
+ var _Dialog = _interopRequireDefault(require("@mui/material/Dialog"));
6751
+ var _DialogActions = _interopRequireDefault(require("@mui/material/DialogActions"));
6752
+ var _DialogContent = _interopRequireDefault(require("@mui/material/DialogContent"));
6753
+ var _DialogContentText = _interopRequireDefault(require("@mui/material/DialogContentText"));
6754
+ var _DialogTitle = _interopRequireDefault(require("@mui/material/DialogTitle"));
6755
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
6756
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
6757
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
6758
+ function YesNoDialog(_ref) {
6759
+ var open = _ref.open,
6760
+ title = _ref.title,
6761
+ message = _ref.message,
6762
+ _ref$yesText = _ref.yesText,
6763
+ yesText = _ref$yesText === void 0 ? "Yes" : _ref$yesText,
6764
+ _ref$noText = _ref.noText,
6765
+ noText = _ref$noText === void 0 ? "No" : _ref$noText,
6766
+ YesAction = _ref.YesAction,
6767
+ NoAction = _ref.NoAction;
6768
+ // Declare a new state variable, which we'll call "count"
6769
+ //const [count, setCount] = useState(0);
6770
+
6771
+ return /*#__PURE__*/_react["default"].createElement(_Dialog["default"], {
6772
+ open: open,
6773
+ onClose: NoAction,
6774
+ "aria-labelledby": "alert-dialog-title",
6775
+ "aria-describedby": "alert-dialog-description"
6776
+ }, /*#__PURE__*/_react["default"].createElement(_DialogTitle["default"], {
6777
+ id: "alert-dialog-title"
6778
+ }, title), /*#__PURE__*/_react["default"].createElement(_DialogContent["default"], null, /*#__PURE__*/_react["default"].createElement(_DialogContentText["default"], {
6779
+ id: "alert-dialog-description"
6780
+ }, message)), /*#__PURE__*/_react["default"].createElement(_DialogActions["default"], null, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
6781
+ onClick: NoAction
6782
+ }, noText), /*#__PURE__*/_react["default"].createElement(_Button["default"], {
6783
+ onClick: YesAction,
6784
+ autoFocus: true
6785
+ }, yesText)));
6786
+ }
6787
+ "use strict";
6788
+
6489
6789
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
6490
6790
  Object.defineProperty(exports, "__esModule", {
6491
6791
  value: true
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "authscape",
3
- "version": "1.0.460",
3
+ "version": "1.0.464",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -0,0 +1,37 @@
1
+ import React, { useState } from 'react';
2
+ import Button from '@mui/material/Button';
3
+ import Dialog from '@mui/material/Dialog';
4
+ import DialogActions from '@mui/material/DialogActions';
5
+ import DialogContent from '@mui/material/DialogContent';
6
+ import DialogContentText from '@mui/material/DialogContentText';
7
+ import DialogTitle from '@mui/material/DialogTitle';
8
+
9
+ export default function YesNoDialog({open, title, message, yesText = "Yes", noText = "No", YesAction, NoAction}) {
10
+ // Declare a new state variable, which we'll call "count"
11
+ //const [count, setCount] = useState(0);
12
+
13
+ return (
14
+ <Dialog
15
+ open={open}
16
+ onClose={NoAction}
17
+ aria-labelledby="alert-dialog-title"
18
+ aria-describedby="alert-dialog-description">
19
+ <DialogTitle id="alert-dialog-title">
20
+ {title}
21
+ </DialogTitle>
22
+ <DialogContent>
23
+ <DialogContentText id="alert-dialog-description">
24
+ {message}
25
+ </DialogContentText>
26
+ </DialogContent>
27
+ <DialogActions>
28
+ <Button onClick={NoAction}>{noText}</Button>
29
+ <Button onClick={YesAction} autoFocus>
30
+ {yesText}
31
+ </Button>
32
+ </DialogActions>
33
+ </Dialog>
34
+ );
35
+ }
36
+
37
+
@@ -11,7 +11,7 @@ import Select from '@mui/material/Select';
11
11
  // import { apiService } from 'authscape';
12
12
  import TextField from '@mui/material/TextField';
13
13
  import Autocomplete, { createFilterOptions } from '@mui/material/Autocomplete';
14
- import Comments from '../comments';
14
+ // import Comments from '../comments';
15
15
  import { Button, Card, CardActions, CardContent, CardMedia, Stack } from "@mui/material";
16
16
  import InsertDriveFileRoundedIcon from '@mui/icons-material/InsertDriveFileRounded';
17
17
  import ArrowBackIosRoundedIcon from '@mui/icons-material/ArrowBackIosRounded';
@@ -10,7 +10,7 @@ import DeleteRoundedIcon from "@mui/icons-material/DeleteRounded";
10
10
  import Typography from '@mui/material/Typography';
11
11
  import AppBar from '@mui/material/AppBar';
12
12
  import Toolbar from '@mui/material/Toolbar';
13
- import YesNoDialog from '../../components/yesNoDialog';
13
+ // import YesNoDialog from '../../components/yesNoDialog';
14
14
  import VisibilityRoundedIcon from '@mui/icons-material/VisibilityRounded';
15
15
  import AddRoundedIcon from '@mui/icons-material/AddRounded';
16
16
  import InputLabel from '@mui/material/InputLabel';
@@ -0,0 +1,150 @@
1
+ import React, { useEffect, useState, useRef } from 'react';
2
+ import { Box, Paper } from '@mui/material';
3
+ import InputBase from '@mui/material/InputBase';
4
+ import IconButton from '@mui/material/IconButton';
5
+ import QuestionAnswerOutlinedIcon from '@mui/icons-material/QuestionAnswerOutlined';
6
+ import Typography from '@mui/material/Typography';
7
+ // import { apiService } from 'authscape';
8
+ import Grid from '@mui/material/Grid';
9
+ import List from '@mui/material/List';
10
+ import ListItem from '@mui/material/ListItem';
11
+ import ListItemText from '@mui/material/ListItemText';
12
+ import Avatar from '@mui/material/Avatar';
13
+ import SendRoundedIcon from '@mui/icons-material/SendRounded';
14
+ import scrollIntoView from 'scroll-into-view-if-needed'
15
+ import Stack from '@mui/material/Stack';
16
+
17
+ export default function Comments({ticketId, isNote, isDisabled, currentUser}) {
18
+
19
+ const [comments, setComments] = useState([]);
20
+ const [message, setMessage] = useState("");
21
+ // const [messageDialogOpen, setMessageDialogOpen] = useState(false);
22
+
23
+ const reloadMessages = async () => {
24
+
25
+ // setIsLoading(true);
26
+
27
+ let response = await apiService().get("/Ticket/GetMessages?TicketId=" + ticketId + "&isNote=" + isNote);
28
+ if (response != null && response.status == 200)
29
+ {
30
+ setComments(response.data);
31
+ }
32
+
33
+ const node = document.getElementById('messages');
34
+ if (node != null)
35
+ {
36
+ scrollIntoView(node, { behavior: 'smooth', scrollMode: 'if-needed' })
37
+ }
38
+
39
+ // setIsLoading(false);
40
+
41
+ }
42
+
43
+ useEffect(() => {
44
+
45
+ if (ticketId != null)
46
+ {
47
+ const asyncPush = async () => {
48
+ await reloadMessages();
49
+ }
50
+ asyncPush();
51
+ }
52
+
53
+ }, [ticketId]);
54
+
55
+ const SendMessage = async () => {
56
+
57
+ if (message !== "")
58
+ {
59
+ let response = await apiService().post("/Ticket/CreateMessage", {
60
+ ticketId: ticketId,
61
+ name: currentUser.firstName,
62
+ message: message,
63
+ isNote: isNote
64
+ });
65
+
66
+ if (response != null && response.status == 200)
67
+ {
68
+ await reloadMessages();
69
+ // messagesEndRef.current?.scrollIntoView({ behavior: 'smooth' });
70
+ // let messages = comments.slice();
71
+ // messages.push(message);
72
+ // setComments(messages);
73
+ setMessage("");
74
+ }
75
+ }
76
+ }
77
+
78
+ return (
79
+ <Box sx={{display:"flex", flexDirection:"column", height:"100%"}}>
80
+ <Box sx={{backgroundColor:"#F3F5F7", overflow:"auto", flex: "1 1 auto"}}>
81
+ <Box>
82
+ {comments.length == 0 &&
83
+ <Box sx={{paddingLeft:4}}>
84
+ <QuestionAnswerOutlinedIcon sx={{fill:"gray", position:"relative", top:"4px", marginRight:2}} fontSize={"2px"} />
85
+ <Typography variant="subtitle2" color="text.secondary" component="span" sx={{marginTop:1}}>
86
+ Add your first {isNote ? "note" : "message" }. {isNote ? "Your notes" : "The conversation history" } will appear here
87
+ </Typography>
88
+ </Box>
89
+ }
90
+ <Box sx={{overflow:"scroll", height:"300px"}}>
91
+ <Grid container>
92
+ <Grid item xs={12}>
93
+ <List>
94
+ {comments != null && comments.map((comment, index) => {
95
+ return (
96
+ <ListItem key={index} sx={{marginTop:1}}>
97
+ <Grid container>
98
+ <Grid item xs={1}>
99
+ <Avatar />
100
+ </Grid>
101
+ <Grid item xs={11}>
102
+ <Stack direction="row" spacing={1}>
103
+ <Box sx={{fontSize:12}}>{comment.firstName}</Box>
104
+ <Box sx={{fontSize:12}}>{comment.created}</Box>
105
+ </Stack>
106
+ <Box sx={{fontSize:16}}>{comment.message}</Box>
107
+ </Grid>
108
+ </Grid>
109
+ </ListItem>
110
+ )
111
+ })}
112
+
113
+ <ListItem>
114
+ <div id={"messages"}></div>
115
+ </ListItem>
116
+ </List>
117
+ </Grid>
118
+ </Grid>
119
+ </Box>
120
+ </Box>
121
+ </Box>
122
+
123
+ <Box sx={{flex: "0 1 40px"}}>
124
+ <Paper
125
+ sx={{ p: '2px 4px', display: 'flex', alignItems: 'center'}}>
126
+ <InputBase
127
+ sx={{ ml: 1, flex: 1 }}
128
+ disabled={isDisabled}
129
+ onKeyUp={(event) => {
130
+ if (event.key == "Enter")
131
+ {
132
+ SendMessage();
133
+ }
134
+ }}
135
+ placeholder={!isNote ? "Write your message here..." : "Write your notes here..."}
136
+ value={message}
137
+ onChange={(value) => {
138
+ setMessage(value.target.value);
139
+ }}
140
+ />
141
+ <IconButton disabled={isDisabled} type="button" sx={{ p: '10px' }} aria-label="search" onClick={() => {
142
+ SendMessage();
143
+ }}>
144
+ <SendRoundedIcon />
145
+ </IconButton>
146
+ </Paper>
147
+ </Box>
148
+ </Box>
149
+ );
150
+ }