authscape 1.0.343 → 1.0.346
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 +584 -13
- package/package.json +4 -1
- package/src/components/spreadsheet/spreadsheetViewer.js +501 -0
- package/src/services/analytics.js +32 -0
package/index.js
CHANGED
|
@@ -2964,6 +2964,513 @@ var RichTextEditor = function RichTextEditor(_ref) {
|
|
|
2964
2964
|
exports.RichTextEditor = RichTextEditor;
|
|
2965
2965
|
"use strict";
|
|
2966
2966
|
|
|
2967
|
+
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); }
|
|
2968
|
+
Object.defineProperty(exports, "__esModule", {
|
|
2969
|
+
value: true
|
|
2970
|
+
});
|
|
2971
|
+
exports["default"] = SpreadsheetViewer;
|
|
2972
|
+
var _material = require("@mui/material");
|
|
2973
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
2974
|
+
var _reactgrid = require("@silevis/reactgrid");
|
|
2975
|
+
var _authscape = require("authscape");
|
|
2976
|
+
var _reactDeviceDetect = require("react-device-detect");
|
|
2977
|
+
var signalR = _interopRequireWildcard(require("@microsoft/signalr"));
|
|
2978
|
+
var _Avatar = _interopRequireDefault(require("@mui/material/Avatar"));
|
|
2979
|
+
var _Stack = _interopRequireDefault(require("@mui/material/Stack"));
|
|
2980
|
+
var _Tooltip = _interopRequireDefault(require("@mui/material/Tooltip"));
|
|
2981
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
2982
|
+
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); }
|
|
2983
|
+
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; }
|
|
2984
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2985
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
2986
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
2987
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2988
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
2989
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
2990
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
2991
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
2992
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
2993
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
2994
|
+
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; }
|
|
2995
|
+
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); } }
|
|
2996
|
+
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); }); }; }
|
|
2997
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2998
|
+
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."); }
|
|
2999
|
+
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); }
|
|
3000
|
+
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; }
|
|
3001
|
+
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; } }
|
|
3002
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
3003
|
+
function SpreadsheetViewer(_ref) {
|
|
3004
|
+
var loadedUser = _ref.loadedUser,
|
|
3005
|
+
currentUser = _ref.currentUser,
|
|
3006
|
+
documentId = _ref.documentId,
|
|
3007
|
+
url = _ref.url,
|
|
3008
|
+
sx = _ref.sx,
|
|
3009
|
+
_ref$onFocusLocationC = _ref.onFocusLocationChanged,
|
|
3010
|
+
_onFocusLocationChanged = _ref$onFocusLocationC === void 0 ? null : _ref$onFocusLocationC,
|
|
3011
|
+
_ref$onChange = _ref.onChange,
|
|
3012
|
+
onChange = _ref$onChange === void 0 ? null : _ref$onChange,
|
|
3013
|
+
_ref$hubUrl = _ref.hubUrl,
|
|
3014
|
+
hubUrl = _ref$hubUrl === void 0 ? null : _ref$hubUrl;
|
|
3015
|
+
var _useState = (0, _react.useState)(null),
|
|
3016
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
3017
|
+
data = _useState2[0],
|
|
3018
|
+
setData = _useState2[1];
|
|
3019
|
+
var _useState3 = (0, _react.useState)(null),
|
|
3020
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
3021
|
+
rows = _useState4[0],
|
|
3022
|
+
setRows = _useState4[1];
|
|
3023
|
+
var _useState5 = (0, _react.useState)(null),
|
|
3024
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
3025
|
+
columns = _useState6[0],
|
|
3026
|
+
setColumns = _useState6[1];
|
|
3027
|
+
var _useState7 = (0, _react.useState)(function () {
|
|
3028
|
+
return -1;
|
|
3029
|
+
}),
|
|
3030
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
3031
|
+
cellChangesIndex = _useState8[0],
|
|
3032
|
+
setCellChangesIndex = _useState8[1];
|
|
3033
|
+
var _useState9 = (0, _react.useState)(function () {
|
|
3034
|
+
return [];
|
|
3035
|
+
}),
|
|
3036
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
3037
|
+
cellChanges = _useState10[0],
|
|
3038
|
+
setCellChanges = _useState10[1];
|
|
3039
|
+
var highlightsRef = (0, _react.useRef)([]);
|
|
3040
|
+
var userIdRef = (0, _react.useRef)(0);
|
|
3041
|
+
var _useState11 = (0, _react.useState)([]),
|
|
3042
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
3043
|
+
highlights = _useState12[0],
|
|
3044
|
+
setHighlights = _useState12[1];
|
|
3045
|
+
var _useState13 = (0, _react.useState)([]),
|
|
3046
|
+
_useState14 = _slicedToArray(_useState13, 2),
|
|
3047
|
+
sessions = _useState14[0],
|
|
3048
|
+
setSessions = _useState14[1];
|
|
3049
|
+
var _useState15 = (0, _react.useState)([]),
|
|
3050
|
+
_useState16 = _slicedToArray(_useState15, 2),
|
|
3051
|
+
requestedChanges = _useState16[0],
|
|
3052
|
+
setRequestedChanges = _useState16[1];
|
|
3053
|
+
var _useState17 = (0, _react.useState)(null),
|
|
3054
|
+
_useState18 = _slicedToArray(_useState17, 2),
|
|
3055
|
+
hubConnection = _useState18[0],
|
|
3056
|
+
setHubConnection = _useState18[1];
|
|
3057
|
+
(0, _react.useEffect)(function () {
|
|
3058
|
+
if (requestedChanges != null && requestedChanges.length > 0) {
|
|
3059
|
+
// go into each request
|
|
3060
|
+
for (var index = 0; index < requestedChanges.length; index++) {
|
|
3061
|
+
var request = requestedChanges[index];
|
|
3062
|
+
|
|
3063
|
+
// go into each row
|
|
3064
|
+
for (var rowIndex = 0; rowIndex < rows.length; rowIndex++) {
|
|
3065
|
+
// alert(request.rowId + "==" + rows[rowIndex].rowId)
|
|
3066
|
+
// found our row!
|
|
3067
|
+
if (request.rowId == rows[rowIndex].rowId) {
|
|
3068
|
+
// look into each cell of the row
|
|
3069
|
+
for (var cellIndex = 0; cellIndex < rows[rowIndex].cells.length; cellIndex++) {
|
|
3070
|
+
if (rows[rowIndex].cells[cellIndex].columnId == request.fieldName) {
|
|
3071
|
+
switch (rows[rowIndex].cells[cellIndex].type) {
|
|
3072
|
+
case "text":
|
|
3073
|
+
rows[rowIndex].cells[cellIndex].text = request.value;
|
|
3074
|
+
break;
|
|
3075
|
+
case "checkbox":
|
|
3076
|
+
rows[rowIndex].cells[cellIndex].checked = Boolean(request.value);
|
|
3077
|
+
break;
|
|
3078
|
+
case "date":
|
|
3079
|
+
rows[rowIndex].cells[cellIndex].date = Date.parse(request.value);
|
|
3080
|
+
break;
|
|
3081
|
+
case "dropdown":
|
|
3082
|
+
rows[rowIndex].cells[cellIndex].selectedValue = request.value;
|
|
3083
|
+
break;
|
|
3084
|
+
case "email":
|
|
3085
|
+
rows[rowIndex].cells[cellIndex].text = request.value;
|
|
3086
|
+
break;
|
|
3087
|
+
case "chevron":
|
|
3088
|
+
rows[rowIndex].cells[cellIndex].text = request.value;
|
|
3089
|
+
break;
|
|
3090
|
+
case "header":
|
|
3091
|
+
rows[rowIndex].cells[cellIndex].text = request.value;
|
|
3092
|
+
break;
|
|
3093
|
+
case "number":
|
|
3094
|
+
rows[rowIndex].cells[cellIndex].text = parseFloat(request.value);
|
|
3095
|
+
break;
|
|
3096
|
+
case "time":
|
|
3097
|
+
rows[rowIndex].cells[cellIndex].text = Date.parse(request.value);
|
|
3098
|
+
break;
|
|
3099
|
+
}
|
|
3100
|
+
}
|
|
3101
|
+
}
|
|
3102
|
+
break;
|
|
3103
|
+
}
|
|
3104
|
+
}
|
|
3105
|
+
}
|
|
3106
|
+
setRows(function (rowUpdate) {
|
|
3107
|
+
return rowUpdate;
|
|
3108
|
+
});
|
|
3109
|
+
|
|
3110
|
+
// clear our selected changes
|
|
3111
|
+
setRequestedChanges([]);
|
|
3112
|
+
}
|
|
3113
|
+
}, [requestedChanges]);
|
|
3114
|
+
var getSpreadSheetRows = function getSpreadSheetRows(headerCell, rows) {
|
|
3115
|
+
var dataRows = [{
|
|
3116
|
+
rowId: "header",
|
|
3117
|
+
cells: headerCell
|
|
3118
|
+
}];
|
|
3119
|
+
for (var index = 0; index < rows.length; index++) {
|
|
3120
|
+
var row = rows[index];
|
|
3121
|
+
dataRows.push({
|
|
3122
|
+
rowId: row.rowId,
|
|
3123
|
+
cells: row.cells
|
|
3124
|
+
});
|
|
3125
|
+
}
|
|
3126
|
+
return dataRows;
|
|
3127
|
+
};
|
|
3128
|
+
var handleUndoChanges = function handleUndoChanges() {
|
|
3129
|
+
if (cellChangesIndex >= 0) {
|
|
3130
|
+
setRows(function (prevPeople) {
|
|
3131
|
+
return undoChanges(cellChanges[cellChangesIndex], prevPeople);
|
|
3132
|
+
});
|
|
3133
|
+
}
|
|
3134
|
+
};
|
|
3135
|
+
var handleRedoChanges = function handleRedoChanges() {
|
|
3136
|
+
if (cellChangesIndex + 1 <= cellChanges.length - 1) {
|
|
3137
|
+
setRows(function (prevPeople) {
|
|
3138
|
+
return redoChanges(cellChanges[cellChangesIndex + 1], prevPeople);
|
|
3139
|
+
});
|
|
3140
|
+
}
|
|
3141
|
+
};
|
|
3142
|
+
(0, _react.useEffect)(function () {
|
|
3143
|
+
if (loadedUser) {
|
|
3144
|
+
var fetchData = /*#__PURE__*/function () {
|
|
3145
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
3146
|
+
var response;
|
|
3147
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
3148
|
+
while (1) switch (_context.prev = _context.next) {
|
|
3149
|
+
case 0:
|
|
3150
|
+
_context.next = 2;
|
|
3151
|
+
return (0, _authscape.apiService)().get(url);
|
|
3152
|
+
case 2:
|
|
3153
|
+
response = _context.sent;
|
|
3154
|
+
if (response != null && response.status == 200) {
|
|
3155
|
+
setData(response.data);
|
|
3156
|
+
setRows(response.data.rows);
|
|
3157
|
+
setColumns(response.data.columns);
|
|
3158
|
+
}
|
|
3159
|
+
case 4:
|
|
3160
|
+
case "end":
|
|
3161
|
+
return _context.stop();
|
|
3162
|
+
}
|
|
3163
|
+
}, _callee);
|
|
3164
|
+
}));
|
|
3165
|
+
return function fetchData() {
|
|
3166
|
+
return _ref2.apply(this, arguments);
|
|
3167
|
+
};
|
|
3168
|
+
}();
|
|
3169
|
+
fetchData();
|
|
3170
|
+
}
|
|
3171
|
+
}, [loadedUser]);
|
|
3172
|
+
var getSessions = /*#__PURE__*/function () {
|
|
3173
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
3174
|
+
var response, sessionData, _sessions;
|
|
3175
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
3176
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
3177
|
+
case 0:
|
|
3178
|
+
_context2.next = 2;
|
|
3179
|
+
return (0, _authscape.apiService)().get("/AuthScapeSpreadSheet/GetActiveSessions?documentId=" + documentId);
|
|
3180
|
+
case 2:
|
|
3181
|
+
response = _context2.sent;
|
|
3182
|
+
sessionData = response.data;
|
|
3183
|
+
_sessions = [];
|
|
3184
|
+
sessionData.forEach(function (element) {
|
|
3185
|
+
if (_sessions.find(function (s) {
|
|
3186
|
+
return s.userId == element.userId;
|
|
3187
|
+
}) == null) {
|
|
3188
|
+
if (element.userId == userIdRef.current) {
|
|
3189
|
+
_sessions.push({
|
|
3190
|
+
userId: element.userId,
|
|
3191
|
+
name: element.name,
|
|
3192
|
+
borderColor: "#3579f8"
|
|
3193
|
+
});
|
|
3194
|
+
} else {
|
|
3195
|
+
_sessions.push({
|
|
3196
|
+
userId: element.userId,
|
|
3197
|
+
name: element.name,
|
|
3198
|
+
borderColor: element.borderColor
|
|
3199
|
+
});
|
|
3200
|
+
}
|
|
3201
|
+
}
|
|
3202
|
+
});
|
|
3203
|
+
assignHighlights(highlightsRef.current);
|
|
3204
|
+
setSessions(_sessions);
|
|
3205
|
+
case 8:
|
|
3206
|
+
case "end":
|
|
3207
|
+
return _context2.stop();
|
|
3208
|
+
}
|
|
3209
|
+
}, _callee2);
|
|
3210
|
+
}));
|
|
3211
|
+
return function getSessions() {
|
|
3212
|
+
return _ref3.apply(this, arguments);
|
|
3213
|
+
};
|
|
3214
|
+
}();
|
|
3215
|
+
var assignHighlights = function assignHighlights(clonedAray) {
|
|
3216
|
+
var _sessions = [];
|
|
3217
|
+
clonedAray.forEach(function (element) {
|
|
3218
|
+
_sessions.push({
|
|
3219
|
+
rowId: element.rowId,
|
|
3220
|
+
columnId: element.columnId,
|
|
3221
|
+
borderColor: element.borderColor
|
|
3222
|
+
});
|
|
3223
|
+
});
|
|
3224
|
+
setHighlights(_sessions);
|
|
3225
|
+
};
|
|
3226
|
+
var onFocusClicked = function onFocusClicked(userId, color, rowId, columnId) {
|
|
3227
|
+
var isFound = false;
|
|
3228
|
+
var _highlights = highlightsRef.current;
|
|
3229
|
+
for (var index = 0; index < _highlights.length; index++) {
|
|
3230
|
+
var element = _highlights[index];
|
|
3231
|
+
if (element.userId == userId) {
|
|
3232
|
+
element.rowId = rowId;
|
|
3233
|
+
element.columnId = columnId;
|
|
3234
|
+
element.borderColor = color;
|
|
3235
|
+
isFound = true;
|
|
3236
|
+
}
|
|
3237
|
+
}
|
|
3238
|
+
if (isFound == false) {
|
|
3239
|
+
var newRecord = {
|
|
3240
|
+
userId: userId,
|
|
3241
|
+
columnId: columnId,
|
|
3242
|
+
rowId: rowId,
|
|
3243
|
+
borderColor: color
|
|
3244
|
+
};
|
|
3245
|
+
_highlights.push(newRecord);
|
|
3246
|
+
}
|
|
3247
|
+
highlightsRef.current = _highlights;
|
|
3248
|
+
assignHighlights(highlightsRef.current);
|
|
3249
|
+
};
|
|
3250
|
+
var getRandomColor = function getRandomColor() {
|
|
3251
|
+
var letters = '0123456789ABCDEF';
|
|
3252
|
+
var color = '#';
|
|
3253
|
+
for (var i = 0; i < 6; i++) {
|
|
3254
|
+
color += letters[Math.floor(Math.random() * 16)];
|
|
3255
|
+
}
|
|
3256
|
+
return color;
|
|
3257
|
+
};
|
|
3258
|
+
(0, _react.useEffect)(function () {
|
|
3259
|
+
if (loadedUser) {
|
|
3260
|
+
userIdRef.current = currentUser.id;
|
|
3261
|
+
var connection = new signalR.HubConnectionBuilder().withUrl(hubUrl).build();
|
|
3262
|
+
connection.on("onUpdateUserSession", function () {
|
|
3263
|
+
getSessions();
|
|
3264
|
+
});
|
|
3265
|
+
connection.on("onClickSpreadsheet", function (userId, color, rowId, columnId) {
|
|
3266
|
+
if (userIdRef.current != userId) {
|
|
3267
|
+
onFocusClicked(userId, color, rowId, columnId);
|
|
3268
|
+
}
|
|
3269
|
+
});
|
|
3270
|
+
connection.on("onChangeValue", function (userId, rowId, fieldName, value) {
|
|
3271
|
+
if (userIdRef.current != userId) {
|
|
3272
|
+
setRequestedChanges(function (prevMessages) {
|
|
3273
|
+
return [].concat(_toConsumableArray(prevMessages), [{
|
|
3274
|
+
userId: userId,
|
|
3275
|
+
rowId: rowId,
|
|
3276
|
+
fieldName: fieldName,
|
|
3277
|
+
value: value
|
|
3278
|
+
}]);
|
|
3279
|
+
});
|
|
3280
|
+
}
|
|
3281
|
+
});
|
|
3282
|
+
connection.start().then(function (result) {
|
|
3283
|
+
var randomColor = getRandomColor();
|
|
3284
|
+
connection.invoke("Connect", currentUser.firstName + " " + currentUser.lastName, documentId, currentUser.id, randomColor);
|
|
3285
|
+
setHubConnection(connection);
|
|
3286
|
+
|
|
3287
|
+
// get the init users, after that we need to hook it
|
|
3288
|
+
getSessions();
|
|
3289
|
+
});
|
|
3290
|
+
}
|
|
3291
|
+
}, [loadedUser]);
|
|
3292
|
+
var addEmptyRow = function addEmptyRow() {
|
|
3293
|
+
// Create a new empty row
|
|
3294
|
+
var emptyRow = Array.from({
|
|
3295
|
+
length: columns.length
|
|
3296
|
+
}, function () {
|
|
3297
|
+
return {
|
|
3298
|
+
value: ""
|
|
3299
|
+
};
|
|
3300
|
+
});
|
|
3301
|
+
setData(function (prevData) {
|
|
3302
|
+
return [].concat(_toConsumableArray(prevData), [emptyRow]);
|
|
3303
|
+
});
|
|
3304
|
+
};
|
|
3305
|
+
var applyNewValue = function applyNewValue(changes, prevPeople) {
|
|
3306
|
+
var usePrevValue = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
3307
|
+
changes.forEach(function (change) {
|
|
3308
|
+
var personIndex = change.rowId;
|
|
3309
|
+
var fieldName = change.columnId;
|
|
3310
|
+
var cell = usePrevValue ? change.previousCell : change.newCell;
|
|
3311
|
+
prevPeople[personIndex][fieldName] = cell.text;
|
|
3312
|
+
});
|
|
3313
|
+
return _toConsumableArray(prevPeople);
|
|
3314
|
+
};
|
|
3315
|
+
var undoChanges = function undoChanges(changes, prevPeople) {
|
|
3316
|
+
var updated = applyNewValue(changes, prevPeople, true);
|
|
3317
|
+
setCellChangesIndex(cellChangesIndex - 1);
|
|
3318
|
+
return updated;
|
|
3319
|
+
};
|
|
3320
|
+
var redoChanges = function redoChanges(changes, prevPeople) {
|
|
3321
|
+
var updated = applyNewValue(changes, prevPeople);
|
|
3322
|
+
setCellChangesIndex(cellChangesIndex + 1);
|
|
3323
|
+
return updated;
|
|
3324
|
+
};
|
|
3325
|
+
var handleChanges = function handleChanges(changes) {
|
|
3326
|
+
setRows(function (prevPeople) {
|
|
3327
|
+
return applyChangesToPeople(changes, prevPeople);
|
|
3328
|
+
});
|
|
3329
|
+
};
|
|
3330
|
+
var applyChangesToPeople = function applyChangesToPeople(changes, prevDetails) {
|
|
3331
|
+
changes.forEach(function (change) {
|
|
3332
|
+
var dataRowId = change.rowId;
|
|
3333
|
+
var fieldName = change.columnId;
|
|
3334
|
+
|
|
3335
|
+
// find the row and column
|
|
3336
|
+
var dataRow = prevDetails.find(function (d) {
|
|
3337
|
+
return d.rowId === dataRowId;
|
|
3338
|
+
});
|
|
3339
|
+
var cellItem = dataRow.cells.find(function (s) {
|
|
3340
|
+
return s.columnId == fieldName;
|
|
3341
|
+
});
|
|
3342
|
+
var JSONBuilder = {};
|
|
3343
|
+
if (cellItem.type == "text") {
|
|
3344
|
+
JSONBuilder[cellItem.columnId] = cellItem.text;
|
|
3345
|
+
cellItem.text = change.newCell.text;
|
|
3346
|
+
if (onChange != null) {
|
|
3347
|
+
onChange(JSONBuilder, dataRowId, fieldName, change.newCell.text);
|
|
3348
|
+
}
|
|
3349
|
+
try {
|
|
3350
|
+
hubConnection.invoke("CellChanged", documentId, userIdRef.current, dataRowId, fieldName, change.newCell.text.toString());
|
|
3351
|
+
} catch (exp) {
|
|
3352
|
+
console.error(exp);
|
|
3353
|
+
}
|
|
3354
|
+
} else if (cellItem.type == "number") {
|
|
3355
|
+
JSONBuilder[cellItem.columnId] = cellItem.value;
|
|
3356
|
+
cellItem.value = change.newCell.value;
|
|
3357
|
+
if (onChange != null) {
|
|
3358
|
+
onChange(JSONBuilder, dataRowId, fieldName, change.newCell.value);
|
|
3359
|
+
}
|
|
3360
|
+
try {
|
|
3361
|
+
hubConnection.invoke("CellChanged", documentId, userIdRef.current, dataRowId, fieldName, change.newCell.value.toString());
|
|
3362
|
+
} catch (exp) {
|
|
3363
|
+
console.error(exp);
|
|
3364
|
+
}
|
|
3365
|
+
} else if (cellItem.type == "checkbox") {
|
|
3366
|
+
JSONBuilder[cellItem.columnId] = cellItem.checked;
|
|
3367
|
+
cellItem.checked = change.newCell.checked;
|
|
3368
|
+
if (onChange != null) {
|
|
3369
|
+
onChange(JSONBuilder, dataRowId, fieldName, change.newCell.checked);
|
|
3370
|
+
}
|
|
3371
|
+
try {
|
|
3372
|
+
hubConnection.invoke("CellChanged", documentId, userIdRef.current, dataRowId, fieldName, change.newCell.checked.toString());
|
|
3373
|
+
} catch (exp) {
|
|
3374
|
+
console.error(exp);
|
|
3375
|
+
}
|
|
3376
|
+
} else if (cellItem.type == "dropdown") {
|
|
3377
|
+
cellItem.isOpen = change.newCell.isOpen;
|
|
3378
|
+
if (change.newCell.selectedValue && change.newCell.selectedValue !== change.previousCell.selectedValue) {
|
|
3379
|
+
JSONBuilder[cellItem.columnId] = cellItem.selectedValue;
|
|
3380
|
+
cellItem.selectedValue = change.newCell.selectedValue;
|
|
3381
|
+
if (onChange != null) {
|
|
3382
|
+
onChange(JSONBuilder, dataRowId, fieldName, change.newCell.selectedValue);
|
|
3383
|
+
}
|
|
3384
|
+
try {
|
|
3385
|
+
hubConnection.invoke("CellChanged", documentId, userIdRef.current, dataRowId, fieldName, change.newCell.selectedValue.toString());
|
|
3386
|
+
} catch (exp) {
|
|
3387
|
+
console.error(exp);
|
|
3388
|
+
}
|
|
3389
|
+
}
|
|
3390
|
+
}
|
|
3391
|
+
});
|
|
3392
|
+
return _toConsumableArray(prevDetails);
|
|
3393
|
+
};
|
|
3394
|
+
var handleColumnResize = function handleColumnResize(ci, width) {
|
|
3395
|
+
setColumns(function (prevColumns) {
|
|
3396
|
+
var columnIndex = prevColumns.findIndex(function (el) {
|
|
3397
|
+
return el.columnId === ci;
|
|
3398
|
+
});
|
|
3399
|
+
var resizedColumn = prevColumns[columnIndex];
|
|
3400
|
+
var updatedColumn = _objectSpread(_objectSpread({}, resizedColumn), {}, {
|
|
3401
|
+
width: width
|
|
3402
|
+
});
|
|
3403
|
+
prevColumns[columnIndex] = updatedColumn;
|
|
3404
|
+
return _toConsumableArray(prevColumns);
|
|
3405
|
+
});
|
|
3406
|
+
};
|
|
3407
|
+
var stringAvatar = function stringAvatar(name, color) {
|
|
3408
|
+
return {
|
|
3409
|
+
sx: {
|
|
3410
|
+
bgcolor: color
|
|
3411
|
+
},
|
|
3412
|
+
children: "".concat(name.split(' ')[0][0]).concat(name.split(' ')[1][0])
|
|
3413
|
+
};
|
|
3414
|
+
};
|
|
3415
|
+
return /*#__PURE__*/_react["default"].createElement(_material.Box, null, /*#__PURE__*/_react["default"].createElement(_material.Box, {
|
|
3416
|
+
sx: {
|
|
3417
|
+
paddingBottom: 2
|
|
3418
|
+
}
|
|
3419
|
+
}, /*#__PURE__*/_react["default"].createElement(_material.Box, {
|
|
3420
|
+
sx: {
|
|
3421
|
+
paddingBottom: 1
|
|
3422
|
+
}
|
|
3423
|
+
}, "Sessions"), /*#__PURE__*/_react["default"].createElement(_Stack["default"], {
|
|
3424
|
+
direction: "row",
|
|
3425
|
+
spacing: 2
|
|
3426
|
+
}, sessions.map(function (user) {
|
|
3427
|
+
return /*#__PURE__*/_react["default"].createElement(_Tooltip["default"], {
|
|
3428
|
+
title: user.name
|
|
3429
|
+
}, /*#__PURE__*/_react["default"].createElement(_Avatar["default"], _extends({}, stringAvatar(user.name, user.borderColor), {
|
|
3430
|
+
alt: user.name
|
|
3431
|
+
})));
|
|
3432
|
+
}))), /*#__PURE__*/_react["default"].createElement(_material.Box, {
|
|
3433
|
+
sx: _objectSpread(_objectSpread({}, sx), {}, {
|
|
3434
|
+
overflow: "scroll"
|
|
3435
|
+
})
|
|
3436
|
+
}, data != null && rows != null && /*#__PURE__*/_react["default"].createElement(_material.Box, {
|
|
3437
|
+
onKeyDown: function onKeyDown(e) {
|
|
3438
|
+
var isMac = /Mac|iPod|iPhone|iPad/.test(navigator.platform);
|
|
3439
|
+
if (!_reactDeviceDetect.isMacOs && e.ctrlKey || e.metaKey) {
|
|
3440
|
+
switch (e.key) {
|
|
3441
|
+
case "z":
|
|
3442
|
+
handleUndoChanges();
|
|
3443
|
+
return;
|
|
3444
|
+
case "y":
|
|
3445
|
+
handleRedoChanges();
|
|
3446
|
+
return;
|
|
3447
|
+
}
|
|
3448
|
+
}
|
|
3449
|
+
}
|
|
3450
|
+
}, /*#__PURE__*/_react["default"].createElement(_reactgrid.ReactGrid, {
|
|
3451
|
+
rows: getSpreadSheetRows(data.headerCell, rows),
|
|
3452
|
+
highlights: highlights,
|
|
3453
|
+
columns: columns,
|
|
3454
|
+
onFocusLocationChanged: function onFocusLocationChanged(location) {
|
|
3455
|
+
try {
|
|
3456
|
+
hubConnection.invoke("FocusLocationChanged", documentId, userIdRef.current, location.rowId, location.columnId);
|
|
3457
|
+
} catch (exp) {
|
|
3458
|
+
console.error(exp);
|
|
3459
|
+
}
|
|
3460
|
+
_onFocusLocationChanged(location.rowId, location.columnId);
|
|
3461
|
+
},
|
|
3462
|
+
onCellsChanged: handleChanges,
|
|
3463
|
+
enableRowSelection: true,
|
|
3464
|
+
enableColumnSelection: true,
|
|
3465
|
+
enableRangeSelection: true
|
|
3466
|
+
//onContextMenu={simpleHandleContextMenu}
|
|
3467
|
+
,
|
|
3468
|
+
onColumnResized: handleColumnResize,
|
|
3469
|
+
stickyTopRows: 1
|
|
3470
|
+
}))));
|
|
3471
|
+
}
|
|
3472
|
+
"use strict";
|
|
3473
|
+
|
|
2967
3474
|
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); }
|
|
2968
3475
|
Object.defineProperty(exports, "__esModule", {
|
|
2969
3476
|
value: true
|
|
@@ -3631,6 +4138,7 @@ function StripePayment(_ref3) {
|
|
|
3631
4138
|
}
|
|
3632
4139
|
"use strict";
|
|
3633
4140
|
|
|
4141
|
+
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); }
|
|
3634
4142
|
Object.defineProperty(exports, "__esModule", {
|
|
3635
4143
|
value: true
|
|
3636
4144
|
});
|
|
@@ -3642,7 +4150,6 @@ exports.logPurchase = logPurchase;
|
|
|
3642
4150
|
var _router = _interopRequireDefault(require("next/router"));
|
|
3643
4151
|
var _ga4React = _interopRequireDefault(require("ga-4-react"));
|
|
3644
4152
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
3645
|
-
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); }
|
|
3646
4153
|
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; }
|
|
3647
4154
|
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); } }
|
|
3648
4155
|
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); }); }; }
|
|
@@ -3651,33 +4158,33 @@ function init(_x) {
|
|
|
3651
4158
|
return _init.apply(this, arguments);
|
|
3652
4159
|
}
|
|
3653
4160
|
function _init() {
|
|
3654
|
-
_init = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3655
|
-
return _regeneratorRuntime().wrap(function
|
|
3656
|
-
while (1) switch (
|
|
4161
|
+
_init = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(G) {
|
|
4162
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
4163
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
3657
4164
|
case 0:
|
|
3658
4165
|
if (!(!_ga4React["default"].isInitialized() && G && process.browser)) {
|
|
3659
|
-
|
|
4166
|
+
_context3.next = 11;
|
|
3660
4167
|
break;
|
|
3661
4168
|
}
|
|
3662
4169
|
ga4react = new _ga4React["default"](G, {
|
|
3663
4170
|
debug_mode: !process.env.production
|
|
3664
4171
|
});
|
|
3665
|
-
|
|
3666
|
-
|
|
4172
|
+
_context3.prev = 2;
|
|
4173
|
+
_context3.next = 5;
|
|
3667
4174
|
return ga4react.initialize();
|
|
3668
4175
|
case 5:
|
|
3669
4176
|
logPageViews();
|
|
3670
|
-
|
|
4177
|
+
_context3.next = 11;
|
|
3671
4178
|
break;
|
|
3672
4179
|
case 8:
|
|
3673
|
-
|
|
3674
|
-
|
|
3675
|
-
console.error(
|
|
4180
|
+
_context3.prev = 8;
|
|
4181
|
+
_context3.t0 = _context3["catch"](2);
|
|
4182
|
+
console.error(_context3.t0);
|
|
3676
4183
|
case 11:
|
|
3677
4184
|
case "end":
|
|
3678
|
-
return
|
|
4185
|
+
return _context3.stop();
|
|
3679
4186
|
}
|
|
3680
|
-
},
|
|
4187
|
+
}, _callee3, null, [[2, 8]]);
|
|
3681
4188
|
}));
|
|
3682
4189
|
return _init.apply(this, arguments);
|
|
3683
4190
|
}
|
|
@@ -3685,6 +4192,37 @@ function logPageView() {
|
|
|
3685
4192
|
if (ga4react != null) {
|
|
3686
4193
|
ga4react.pageview(window.location.pathname);
|
|
3687
4194
|
}
|
|
4195
|
+
if (process.env.databaseAnalytics) {
|
|
4196
|
+
var executePageView = /*#__PURE__*/function () {
|
|
4197
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
4198
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
4199
|
+
while (1) switch (_context.prev = _context.next) {
|
|
4200
|
+
case 0:
|
|
4201
|
+
_context.prev = 0;
|
|
4202
|
+
_context.next = 3;
|
|
4203
|
+
return apiService().post("/PageContent/PageView", {
|
|
4204
|
+
Uri: window.location.pathname + window.location.search,
|
|
4205
|
+
Referral: document.referrer,
|
|
4206
|
+
host: window.location.host
|
|
4207
|
+
});
|
|
4208
|
+
case 3:
|
|
4209
|
+
_context.next = 7;
|
|
4210
|
+
break;
|
|
4211
|
+
case 5:
|
|
4212
|
+
_context.prev = 5;
|
|
4213
|
+
_context.t0 = _context["catch"](0);
|
|
4214
|
+
case 7:
|
|
4215
|
+
case "end":
|
|
4216
|
+
return _context.stop();
|
|
4217
|
+
}
|
|
4218
|
+
}, _callee, null, [[0, 5]]);
|
|
4219
|
+
}));
|
|
4220
|
+
return function executePageView() {
|
|
4221
|
+
return _ref.apply(this, arguments);
|
|
4222
|
+
};
|
|
4223
|
+
}();
|
|
4224
|
+
executePageView();
|
|
4225
|
+
}
|
|
3688
4226
|
}
|
|
3689
4227
|
function logPageViews() {
|
|
3690
4228
|
if (ga4react != null) {
|
|
@@ -3698,6 +4236,39 @@ function logEvent(category, action, label) {
|
|
|
3698
4236
|
if (ga4react != null) {
|
|
3699
4237
|
ga4react.event(action, label, category);
|
|
3700
4238
|
}
|
|
4239
|
+
if (process.env.databaseAnalytics) {
|
|
4240
|
+
var executePageEvent = /*#__PURE__*/function () {
|
|
4241
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
4242
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
4243
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
4244
|
+
case 0:
|
|
4245
|
+
_context2.prev = 0;
|
|
4246
|
+
_context2.next = 3;
|
|
4247
|
+
return apiService().post("/PageContent/PageEvent", {
|
|
4248
|
+
Category: category,
|
|
4249
|
+
Action: action,
|
|
4250
|
+
label: label,
|
|
4251
|
+
host: window.location.host,
|
|
4252
|
+
Uri: window.location.pathname + window.location.search
|
|
4253
|
+
});
|
|
4254
|
+
case 3:
|
|
4255
|
+
_context2.next = 7;
|
|
4256
|
+
break;
|
|
4257
|
+
case 5:
|
|
4258
|
+
_context2.prev = 5;
|
|
4259
|
+
_context2.t0 = _context2["catch"](0);
|
|
4260
|
+
case 7:
|
|
4261
|
+
case "end":
|
|
4262
|
+
return _context2.stop();
|
|
4263
|
+
}
|
|
4264
|
+
}, _callee2, null, [[0, 5]]);
|
|
4265
|
+
}));
|
|
4266
|
+
return function executePageEvent() {
|
|
4267
|
+
return _ref2.apply(this, arguments);
|
|
4268
|
+
};
|
|
4269
|
+
}();
|
|
4270
|
+
executePageEvent();
|
|
4271
|
+
}
|
|
3701
4272
|
}
|
|
3702
4273
|
function logPurchase(transactionId, amount, tax, items) {
|
|
3703
4274
|
if (ga4react != null) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "authscape",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.346",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -27,7 +27,9 @@
|
|
|
27
27
|
"react-dom": "^18.2.0"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
+
"@microsoft/signalr": "^8.0.0",
|
|
30
31
|
"@monaco-editor/react": "^4.5.1",
|
|
32
|
+
"@silevis/reactgrid": "^4.1.3",
|
|
31
33
|
"@stripe/react-stripe-js": "^1.9.0",
|
|
32
34
|
"@stripe/stripe-js": "^1.32.0",
|
|
33
35
|
"axios": "^1.6.1",
|
|
@@ -44,6 +46,7 @@
|
|
|
44
46
|
"react-color": "^2.19.3",
|
|
45
47
|
"react-cool-onclickoutside": "^1.7.0",
|
|
46
48
|
"react-data-table-component": "^7.5.2",
|
|
49
|
+
"react-device-detect": "^2.2.3",
|
|
47
50
|
"react-draft-wysiwyg": "^1.15.0",
|
|
48
51
|
"react-hook-form": "^7.44.2",
|
|
49
52
|
"react-toastify": "^9.1.3",
|
|
@@ -0,0 +1,501 @@
|
|
|
1
|
+
import { Box, Button } from '@mui/material';
|
|
2
|
+
import React, { useEffect, useState, useRef } from 'react';
|
|
3
|
+
import { ReactGrid, Column, Row } from "@silevis/reactgrid";
|
|
4
|
+
import { apiService } from 'authscape';
|
|
5
|
+
import {isMacOs} from 'react-device-detect';
|
|
6
|
+
import * as signalR from '@microsoft/signalr';
|
|
7
|
+
import Avatar from '@mui/material/Avatar';
|
|
8
|
+
import Stack from '@mui/material/Stack';
|
|
9
|
+
import Tooltip from '@mui/material/Tooltip';
|
|
10
|
+
|
|
11
|
+
export default function SpreadsheetViewer({loadedUser, currentUser, documentId, url, sx, onFocusLocationChanged = null, onChange = null, hubUrl = null}) {
|
|
12
|
+
|
|
13
|
+
const [data, setData] = useState(null);
|
|
14
|
+
const [rows, setRows] = useState(null);
|
|
15
|
+
const [columns, setColumns] = useState(null);
|
|
16
|
+
|
|
17
|
+
const [cellChangesIndex, setCellChangesIndex] = useState(() => -1);
|
|
18
|
+
const [cellChanges, setCellChanges] = useState(() => []);
|
|
19
|
+
|
|
20
|
+
const highlightsRef = useRef([]);
|
|
21
|
+
const userIdRef = useRef(0);
|
|
22
|
+
|
|
23
|
+
const [highlights, setHighlights] = useState([]);
|
|
24
|
+
const [sessions, setSessions] = useState([]);
|
|
25
|
+
const [requestedChanges, setRequestedChanges] = useState([]);
|
|
26
|
+
|
|
27
|
+
const [hubConnection, setHubConnection] = useState(null);
|
|
28
|
+
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
|
|
31
|
+
if (requestedChanges != null && requestedChanges.length > 0)
|
|
32
|
+
{
|
|
33
|
+
// go into each request
|
|
34
|
+
for (let index = 0; index < requestedChanges.length; index++) {
|
|
35
|
+
const request = requestedChanges[index];
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
// go into each row
|
|
39
|
+
for (let rowIndex = 0; rowIndex < rows.length; rowIndex++) {
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
// alert(request.rowId + "==" + rows[rowIndex].rowId)
|
|
43
|
+
// found our row!
|
|
44
|
+
if (request.rowId == rows[rowIndex].rowId)
|
|
45
|
+
{
|
|
46
|
+
// look into each cell of the row
|
|
47
|
+
for (let cellIndex = 0; cellIndex < rows[rowIndex].cells.length; cellIndex++) {
|
|
48
|
+
|
|
49
|
+
if (rows[rowIndex].cells[cellIndex].columnId == request.fieldName)
|
|
50
|
+
{
|
|
51
|
+
switch(rows[rowIndex].cells[cellIndex].type)
|
|
52
|
+
{
|
|
53
|
+
case "text":
|
|
54
|
+
rows[rowIndex].cells[cellIndex].text = request.value;
|
|
55
|
+
break;
|
|
56
|
+
case "checkbox":
|
|
57
|
+
rows[rowIndex].cells[cellIndex].checked = Boolean(request.value);
|
|
58
|
+
break;
|
|
59
|
+
case "date":
|
|
60
|
+
rows[rowIndex].cells[cellIndex].date = Date.parse(request.value);
|
|
61
|
+
break;
|
|
62
|
+
case "dropdown":
|
|
63
|
+
rows[rowIndex].cells[cellIndex].selectedValue = request.value;
|
|
64
|
+
break;
|
|
65
|
+
case "email":
|
|
66
|
+
rows[rowIndex].cells[cellIndex].text = request.value;
|
|
67
|
+
break;
|
|
68
|
+
case "chevron":
|
|
69
|
+
rows[rowIndex].cells[cellIndex].text = request.value;
|
|
70
|
+
break;
|
|
71
|
+
case "header":
|
|
72
|
+
rows[rowIndex].cells[cellIndex].text = request.value;
|
|
73
|
+
break;
|
|
74
|
+
case "number":
|
|
75
|
+
rows[rowIndex].cells[cellIndex].text = parseFloat(request.value);
|
|
76
|
+
break;
|
|
77
|
+
case "time":
|
|
78
|
+
rows[rowIndex].cells[cellIndex].text = Date.parse(request.value);
|
|
79
|
+
break;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
break;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
setRows((rowUpdate) => rowUpdate);
|
|
89
|
+
|
|
90
|
+
// clear our selected changes
|
|
91
|
+
setRequestedChanges([]);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
}, [requestedChanges]);
|
|
95
|
+
|
|
96
|
+
const getSpreadSheetRows = (headerCell, rows) => {
|
|
97
|
+
|
|
98
|
+
let dataRows = [
|
|
99
|
+
{
|
|
100
|
+
rowId: "header",
|
|
101
|
+
cells: headerCell,
|
|
102
|
+
}
|
|
103
|
+
];
|
|
104
|
+
|
|
105
|
+
for (let index = 0; index < rows.length; index++) {
|
|
106
|
+
const row = rows[index];
|
|
107
|
+
|
|
108
|
+
dataRows.push({
|
|
109
|
+
rowId: row.rowId,
|
|
110
|
+
cells: row.cells
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
return dataRows;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
const handleUndoChanges = () => {
|
|
118
|
+
if (cellChangesIndex >= 0) {
|
|
119
|
+
setRows((prevPeople) =>
|
|
120
|
+
undoChanges(cellChanges[cellChangesIndex], prevPeople)
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
const handleRedoChanges = () => {
|
|
126
|
+
if (cellChangesIndex + 1 <= cellChanges.length - 1) {
|
|
127
|
+
setRows((prevPeople) =>
|
|
128
|
+
redoChanges(cellChanges[cellChangesIndex + 1], prevPeople)
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
useEffect(() => {
|
|
134
|
+
|
|
135
|
+
if (loadedUser)
|
|
136
|
+
{
|
|
137
|
+
const fetchData = async () => {
|
|
138
|
+
let response = await apiService().get(url);
|
|
139
|
+
if (response != null && response.status == 200)
|
|
140
|
+
{
|
|
141
|
+
setData(response.data);
|
|
142
|
+
setRows(response.data.rows)
|
|
143
|
+
setColumns(response.data.columns);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
fetchData();
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
}, [loadedUser]);
|
|
150
|
+
|
|
151
|
+
const getSessions = async () => {
|
|
152
|
+
|
|
153
|
+
let response = await apiService().get("/AuthScapeSpreadSheet/GetActiveSessions?documentId=" + documentId);
|
|
154
|
+
var sessionData = response.data;
|
|
155
|
+
|
|
156
|
+
let _sessions = [];
|
|
157
|
+
sessionData.forEach((element) => {
|
|
158
|
+
|
|
159
|
+
if (_sessions.find(s => s.userId == element.userId) == null)
|
|
160
|
+
{
|
|
161
|
+
if (element.userId == userIdRef.current)
|
|
162
|
+
{
|
|
163
|
+
_sessions.push({
|
|
164
|
+
userId: element.userId,
|
|
165
|
+
name: element.name,
|
|
166
|
+
borderColor: "#3579f8"
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
else
|
|
170
|
+
{
|
|
171
|
+
_sessions.push({
|
|
172
|
+
userId: element.userId,
|
|
173
|
+
name: element.name,
|
|
174
|
+
borderColor: element.borderColor
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
assignHighlights(highlightsRef.current);
|
|
181
|
+
setSessions(_sessions);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
const assignHighlights = (clonedAray) => {
|
|
185
|
+
|
|
186
|
+
let _sessions = [];
|
|
187
|
+
|
|
188
|
+
clonedAray.forEach((element) => {
|
|
189
|
+
|
|
190
|
+
_sessions.push({
|
|
191
|
+
rowId: element.rowId,
|
|
192
|
+
columnId: element.columnId,
|
|
193
|
+
borderColor: element.borderColor
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
setHighlights(_sessions);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
const onFocusClicked = (userId, color, rowId, columnId) => {
|
|
202
|
+
|
|
203
|
+
let isFound = false;
|
|
204
|
+
|
|
205
|
+
let _highlights = highlightsRef.current;
|
|
206
|
+
|
|
207
|
+
for (let index = 0; index < _highlights.length; index++) {
|
|
208
|
+
const element = _highlights[index];
|
|
209
|
+
|
|
210
|
+
if (element.userId == userId)
|
|
211
|
+
{
|
|
212
|
+
element.rowId = rowId;
|
|
213
|
+
element.columnId = columnId;
|
|
214
|
+
element.borderColor = color;
|
|
215
|
+
|
|
216
|
+
isFound = true;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
if (isFound == false)
|
|
221
|
+
{
|
|
222
|
+
let newRecord = { userId: userId, columnId: columnId, rowId: rowId, borderColor: color };
|
|
223
|
+
_highlights.push(newRecord);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
highlightsRef.current = _highlights;
|
|
227
|
+
assignHighlights(highlightsRef.current);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
const getRandomColor = () => {
|
|
231
|
+
var letters = '0123456789ABCDEF';
|
|
232
|
+
var color = '#';
|
|
233
|
+
for (var i = 0; i < 6; i++) {
|
|
234
|
+
color += letters[Math.floor(Math.random() * 16)];
|
|
235
|
+
}
|
|
236
|
+
return color;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
useEffect(() => {
|
|
240
|
+
|
|
241
|
+
if (loadedUser)
|
|
242
|
+
{
|
|
243
|
+
userIdRef.current = currentUser.id;
|
|
244
|
+
|
|
245
|
+
const connection = new signalR.HubConnectionBuilder().withUrl(hubUrl).build();
|
|
246
|
+
|
|
247
|
+
connection.on("onUpdateUserSession", () => {
|
|
248
|
+
|
|
249
|
+
getSessions();
|
|
250
|
+
|
|
251
|
+
});
|
|
252
|
+
|
|
253
|
+
connection.on("onClickSpreadsheet", (userId, color, rowId, columnId) => {
|
|
254
|
+
|
|
255
|
+
if (userIdRef.current != userId)
|
|
256
|
+
{
|
|
257
|
+
onFocusClicked(userId, color, rowId, columnId);
|
|
258
|
+
}
|
|
259
|
+
});
|
|
260
|
+
|
|
261
|
+
connection.on("onChangeValue", (userId, rowId, fieldName, value) => {
|
|
262
|
+
|
|
263
|
+
if (userIdRef.current != userId)
|
|
264
|
+
{
|
|
265
|
+
setRequestedChanges((prevMessages) => [...prevMessages, {userId, rowId, fieldName, value}]);
|
|
266
|
+
}
|
|
267
|
+
});
|
|
268
|
+
|
|
269
|
+
connection.start().then((result => {
|
|
270
|
+
|
|
271
|
+
var randomColor = getRandomColor();
|
|
272
|
+
connection.invoke("Connect", (currentUser.firstName + " " + currentUser.lastName), documentId, currentUser.id, randomColor);
|
|
273
|
+
setHubConnection(connection);
|
|
274
|
+
|
|
275
|
+
// get the init users, after that we need to hook it
|
|
276
|
+
getSessions();
|
|
277
|
+
}));
|
|
278
|
+
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
}, [loadedUser])
|
|
282
|
+
|
|
283
|
+
const addEmptyRow = () => {
|
|
284
|
+
// Create a new empty row
|
|
285
|
+
const emptyRow = Array.from({ length: columns.length }, () => ({ value: "" }));
|
|
286
|
+
setData(prevData => [...prevData, emptyRow]);
|
|
287
|
+
};
|
|
288
|
+
|
|
289
|
+
const applyNewValue = (
|
|
290
|
+
changes,
|
|
291
|
+
prevPeople,
|
|
292
|
+
usePrevValue = false
|
|
293
|
+
) => {
|
|
294
|
+
changes.forEach((change) => {
|
|
295
|
+
const personIndex = change.rowId;
|
|
296
|
+
const fieldName = change.columnId;
|
|
297
|
+
const cell = usePrevValue ? change.previousCell : change.newCell;
|
|
298
|
+
prevPeople[personIndex][fieldName] = cell.text;
|
|
299
|
+
});
|
|
300
|
+
return [...prevPeople];
|
|
301
|
+
};
|
|
302
|
+
|
|
303
|
+
const undoChanges = (
|
|
304
|
+
changes,
|
|
305
|
+
prevPeople
|
|
306
|
+
) => {
|
|
307
|
+
const updated = applyNewValue(changes, prevPeople, true);
|
|
308
|
+
setCellChangesIndex(cellChangesIndex - 1);
|
|
309
|
+
return updated;
|
|
310
|
+
};
|
|
311
|
+
|
|
312
|
+
const redoChanges = (
|
|
313
|
+
changes,
|
|
314
|
+
prevPeople
|
|
315
|
+
) => {
|
|
316
|
+
const updated = applyNewValue(changes, prevPeople);
|
|
317
|
+
setCellChangesIndex(cellChangesIndex + 1);
|
|
318
|
+
return updated;
|
|
319
|
+
};
|
|
320
|
+
|
|
321
|
+
const handleChanges = (changes) => {
|
|
322
|
+
setRows((prevPeople) => applyChangesToPeople(changes, prevPeople));
|
|
323
|
+
};
|
|
324
|
+
|
|
325
|
+
const applyChangesToPeople = (
|
|
326
|
+
changes,
|
|
327
|
+
prevDetails) => {
|
|
328
|
+
changes.forEach((change) => {
|
|
329
|
+
const dataRowId = change.rowId;
|
|
330
|
+
const fieldName = change.columnId;
|
|
331
|
+
|
|
332
|
+
// find the row and column
|
|
333
|
+
let dataRow = prevDetails.find((d) => d.rowId === dataRowId);
|
|
334
|
+
let cellItem = dataRow.cells.find(s => s.columnId == fieldName);
|
|
335
|
+
|
|
336
|
+
let JSONBuilder = {};
|
|
337
|
+
if (cellItem.type == "text")
|
|
338
|
+
{
|
|
339
|
+
JSONBuilder[cellItem.columnId] = cellItem.text;
|
|
340
|
+
cellItem.text = change.newCell.text;
|
|
341
|
+
|
|
342
|
+
if (onChange != null)
|
|
343
|
+
{
|
|
344
|
+
onChange(JSONBuilder, dataRowId, fieldName, change.newCell.text);
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
try
|
|
348
|
+
{
|
|
349
|
+
hubConnection.invoke("CellChanged", documentId, userIdRef.current, dataRowId, fieldName, change.newCell.text.toString());
|
|
350
|
+
}
|
|
351
|
+
catch(exp)
|
|
352
|
+
{
|
|
353
|
+
console.error(exp);
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
else if (cellItem.type == "number")
|
|
357
|
+
{
|
|
358
|
+
JSONBuilder[cellItem.columnId] = cellItem.value;
|
|
359
|
+
cellItem.value = change.newCell.value;
|
|
360
|
+
|
|
361
|
+
if (onChange != null)
|
|
362
|
+
{
|
|
363
|
+
onChange(JSONBuilder, dataRowId, fieldName, change.newCell.value);
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
try
|
|
367
|
+
{
|
|
368
|
+
hubConnection.invoke("CellChanged", documentId, userIdRef.current, dataRowId, fieldName, change.newCell.value.toString());
|
|
369
|
+
}
|
|
370
|
+
catch(exp)
|
|
371
|
+
{
|
|
372
|
+
console.error(exp);
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
else if (cellItem.type == "checkbox")
|
|
376
|
+
{
|
|
377
|
+
JSONBuilder[cellItem.columnId] = cellItem.checked;
|
|
378
|
+
cellItem.checked = change.newCell.checked;
|
|
379
|
+
|
|
380
|
+
if (onChange != null)
|
|
381
|
+
{
|
|
382
|
+
onChange(JSONBuilder, dataRowId, fieldName, change.newCell.checked);
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
try
|
|
386
|
+
{
|
|
387
|
+
hubConnection.invoke("CellChanged", documentId, userIdRef.current, dataRowId, fieldName, change.newCell.checked.toString());
|
|
388
|
+
}
|
|
389
|
+
catch(exp)
|
|
390
|
+
{
|
|
391
|
+
console.error(exp);
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
else if (cellItem.type == "dropdown")
|
|
395
|
+
{
|
|
396
|
+
cellItem.isOpen = change.newCell.isOpen;
|
|
397
|
+
|
|
398
|
+
if (change.newCell.selectedValue && change.newCell.selectedValue !== change.previousCell.selectedValue)
|
|
399
|
+
{
|
|
400
|
+
JSONBuilder[cellItem.columnId] = cellItem.selectedValue;
|
|
401
|
+
cellItem.selectedValue = change.newCell.selectedValue;
|
|
402
|
+
|
|
403
|
+
if (onChange != null)
|
|
404
|
+
{
|
|
405
|
+
onChange(JSONBuilder, dataRowId, fieldName, change.newCell.selectedValue);
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
try
|
|
409
|
+
{
|
|
410
|
+
hubConnection.invoke("CellChanged", documentId, userIdRef.current, dataRowId, fieldName, change.newCell.selectedValue.toString());
|
|
411
|
+
}
|
|
412
|
+
catch(exp)
|
|
413
|
+
{
|
|
414
|
+
console.error(exp);
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
});
|
|
419
|
+
|
|
420
|
+
return [...prevDetails];
|
|
421
|
+
};
|
|
422
|
+
|
|
423
|
+
const handleColumnResize = (ci, width) => {
|
|
424
|
+
setColumns((prevColumns) => {
|
|
425
|
+
const columnIndex = prevColumns.findIndex(el => el.columnId === ci);
|
|
426
|
+
const resizedColumn = prevColumns[columnIndex];
|
|
427
|
+
const updatedColumn = { ...resizedColumn, width };
|
|
428
|
+
prevColumns[columnIndex] = updatedColumn;
|
|
429
|
+
return [...prevColumns];
|
|
430
|
+
});
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
const stringAvatar = (name, color) => {
|
|
434
|
+
return {
|
|
435
|
+
sx: {
|
|
436
|
+
bgcolor: color,
|
|
437
|
+
},
|
|
438
|
+
children: `${name.split(' ')[0][0]}${name.split(' ')[1][0]}`,
|
|
439
|
+
};
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
|
|
443
|
+
return (
|
|
444
|
+
<Box>
|
|
445
|
+
<Box sx={{paddingBottom:2}}>
|
|
446
|
+
<Box sx={{paddingBottom:1}}>
|
|
447
|
+
Sessions
|
|
448
|
+
</Box>
|
|
449
|
+
<Stack direction="row" spacing={2}>
|
|
450
|
+
{sessions.map((user) => {
|
|
451
|
+
return <Tooltip title={user.name}><Avatar {...stringAvatar(user.name, user.borderColor)} alt={user.name}></Avatar></Tooltip>
|
|
452
|
+
})}
|
|
453
|
+
</Stack>
|
|
454
|
+
</Box>
|
|
455
|
+
<Box sx={{ ...sx, overflow:"scroll"}}>
|
|
456
|
+
{(data != null && rows != null) &&
|
|
457
|
+
<Box onKeyDown={(e) => {
|
|
458
|
+
const isMac = /Mac|iPod|iPhone|iPad/.test(navigator.platform);
|
|
459
|
+
|
|
460
|
+
if ((!isMacOs && e.ctrlKey) || e.metaKey) {
|
|
461
|
+
switch (e.key) {
|
|
462
|
+
case "z":
|
|
463
|
+
handleUndoChanges();
|
|
464
|
+
return;
|
|
465
|
+
case "y":
|
|
466
|
+
handleRedoChanges();
|
|
467
|
+
return;
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
}}>
|
|
471
|
+
<ReactGrid
|
|
472
|
+
rows={getSpreadSheetRows(data.headerCell, rows)}
|
|
473
|
+
highlights={highlights}
|
|
474
|
+
columns={columns}
|
|
475
|
+
onFocusLocationChanged={(location) => {
|
|
476
|
+
|
|
477
|
+
try
|
|
478
|
+
{
|
|
479
|
+
hubConnection.invoke("FocusLocationChanged", documentId, userIdRef.current, location.rowId, location.columnId);
|
|
480
|
+
}
|
|
481
|
+
catch(exp)
|
|
482
|
+
{
|
|
483
|
+
console.error(exp);
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
onFocusLocationChanged(location.rowId, location.columnId);
|
|
487
|
+
}}
|
|
488
|
+
onCellsChanged={handleChanges}
|
|
489
|
+
enableRowSelection={true}
|
|
490
|
+
enableColumnSelection={true}
|
|
491
|
+
enableRangeSelection={true}
|
|
492
|
+
//onContextMenu={simpleHandleContextMenu}
|
|
493
|
+
onColumnResized={handleColumnResize}
|
|
494
|
+
stickyTopRows={1}
|
|
495
|
+
/>
|
|
496
|
+
</Box>
|
|
497
|
+
}
|
|
498
|
+
</Box>
|
|
499
|
+
</Box>
|
|
500
|
+
);
|
|
501
|
+
}
|
|
@@ -22,6 +22,21 @@ export function logPageView() {
|
|
|
22
22
|
{
|
|
23
23
|
ga4react.pageview(window.location.pathname);
|
|
24
24
|
}
|
|
25
|
+
|
|
26
|
+
if (process.env.databaseAnalytics)
|
|
27
|
+
{
|
|
28
|
+
const executePageView = async () => {
|
|
29
|
+
try {
|
|
30
|
+
await apiService().post("/PageContent/PageView", {
|
|
31
|
+
Uri: window.location.pathname + window.location.search,
|
|
32
|
+
Referral: document.referrer,
|
|
33
|
+
host: window.location.host
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
catch(e) { }
|
|
37
|
+
}
|
|
38
|
+
executePageView();
|
|
39
|
+
}
|
|
25
40
|
}
|
|
26
41
|
|
|
27
42
|
export function logPageViews() {
|
|
@@ -40,6 +55,23 @@ export function logEvent(category, action, label) {
|
|
|
40
55
|
{
|
|
41
56
|
ga4react.event(action, label, category);
|
|
42
57
|
}
|
|
58
|
+
|
|
59
|
+
if (process.env.databaseAnalytics)
|
|
60
|
+
{
|
|
61
|
+
const executePageEvent = async () => {
|
|
62
|
+
try {
|
|
63
|
+
await apiService().post("/PageContent/PageEvent", {
|
|
64
|
+
Category: category,
|
|
65
|
+
Action: action,
|
|
66
|
+
label: label,
|
|
67
|
+
host: window.location.host,
|
|
68
|
+
Uri: window.location.pathname + window.location.search
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
catch(e) { }
|
|
72
|
+
}
|
|
73
|
+
executePageEvent();
|
|
74
|
+
}
|
|
43
75
|
}
|
|
44
76
|
|
|
45
77
|
export function logPurchase(transactionId, amount, tax, items) {
|