authscape 1.0.604 → 1.0.606

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
@@ -6314,627 +6314,6 @@ function AddDomain(_ref) {
6314
6314
  }
6315
6315
  "use strict";
6316
6316
 
6317
- 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); }
6318
- Object.defineProperty(exports, "__esModule", {
6319
- value: true
6320
- });
6321
- exports.PrivateLabelEditor = PrivateLabelEditor;
6322
- var _react = _interopRequireWildcard(require("react"));
6323
- var _react2 = _interopRequireWildcard(require("@monaco-editor/react"));
6324
- var _Button = _interopRequireDefault(require("@mui/material/Button"));
6325
- var _Check = _interopRequireDefault(require("@mui/icons-material/Check"));
6326
- var _Tabs = _interopRequireDefault(require("@mui/material/Tabs"));
6327
- var _Tab = _interopRequireDefault(require("@mui/material/Tab"));
6328
- var _Box = _interopRequireDefault(require("@mui/material/Box"));
6329
- var _material = require("@mui/material");
6330
- var _xDataGrid = require("@mui/x-data-grid");
6331
- var _PublishRounded = _interopRequireDefault(require("@mui/icons-material/PublishRounded"));
6332
- var _InputLabel = _interopRequireDefault(require("@mui/material/InputLabel"));
6333
- var _MenuItem = _interopRequireDefault(require("@mui/material/MenuItem"));
6334
- var _FormControl = _interopRequireDefault(require("@mui/material/FormControl"));
6335
- var _Select = _interopRequireDefault(require("@mui/material/Select"));
6336
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
6337
- 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); }
6338
- 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; }
6339
- 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; }
6340
- 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); } }
6341
- 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); }); }; }
6342
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
6343
- 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."); }
6344
- 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); }
6345
- 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; }
6346
- 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; } }
6347
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } // import Image from "next/image";
6348
- // remove after NPM
6349
- // import {FileUploader, apiService, ColorPicker, Dropzone} from 'authscape';
6350
- // import AddDomain from "./AddDomainModal";
6351
-
6352
- function PrivateLabelEditor(_ref) {
6353
- var loadedUser = _ref.loadedUser,
6354
- notification = _ref.notification,
6355
- _ref$showAllDomains = _ref.showAllDomains,
6356
- showAllDomains = _ref$showAllDomains === void 0 ? false : _ref$showAllDomains,
6357
- _ref$companyId = _ref.companyId,
6358
- companyId = _ref$companyId === void 0 ? null : _ref$companyId;
6359
- var monaco = (0, _react2.useMonaco)();
6360
- var cssEditorRef = (0, _react.useRef)(null);
6361
- var htmlEditorRef = (0, _react.useRef)(null);
6362
- var _useState = (0, _react.useState)(null),
6363
- _useState2 = _slicedToArray(_useState, 2),
6364
- data = _useState2[0],
6365
- setData = _useState2[1];
6366
- var _useState3 = (0, _react.useState)(0),
6367
- _useState4 = _slicedToArray(_useState3, 2),
6368
- value = _useState4[0],
6369
- setValue = _useState4[1];
6370
- var _useState5 = (0, _react.useState)([]),
6371
- _useState6 = _slicedToArray(_useState5, 2),
6372
- fonts = _useState6[0],
6373
- setFonts = _useState6[1];
6374
- var _useState7 = (0, _react.useState)([]),
6375
- _useState8 = _slicedToArray(_useState7, 2),
6376
- oEMDomainList = _useState8[0],
6377
- setOEMDomainList = _useState8[1];
6378
- var _useState9 = (0, _react.useState)([]),
6379
- _useState10 = _slicedToArray(_useState9, 2),
6380
- dnsFields = _useState10[0],
6381
- setDnsFields = _useState10[1];
6382
- var _useState11 = (0, _react.useState)(null),
6383
- _useState12 = _slicedToArray(_useState11, 2),
6384
- selectedFont = _useState12[0],
6385
- setSelectedFont = _useState12[1];
6386
- var _useState13 = (0, _react.useState)(null),
6387
- _useState14 = _slicedToArray(_useState13, 2),
6388
- fontUri = _useState14[0],
6389
- setFontUri = _useState14[1];
6390
- var _useState15 = (0, _react.useState)(null),
6391
- _useState16 = _slicedToArray(_useState15, 2),
6392
- oEMDomain = _useState16[0],
6393
- setOEMDomain = _useState16[1];
6394
- var _useState17 = (0, _react.useState)(''),
6395
- _useState18 = _slicedToArray(_useState17, 2),
6396
- stateBaseUri = _useState18[0],
6397
- setBaseUri = _useState18[1];
6398
- var _useState19 = (0, _react.useState)(false),
6399
- _useState20 = _slicedToArray(_useState19, 2),
6400
- isNewAccount = _useState20[0],
6401
- setIsNewAccount = _useState20[1];
6402
- var handleChange = function handleChange(event, newValue) {
6403
- setValue(newValue);
6404
- };
6405
- var GetBaseUrl = function GetBaseUrl() {
6406
- return window.location.protocol + "//" + window.location.host;
6407
- };
6408
- var loadDNSFields = /*#__PURE__*/function () {
6409
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
6410
- var _domain,
6411
- domain,
6412
- responseFields,
6413
- _args = arguments;
6414
- return _regeneratorRuntime().wrap(function _callee$(_context) {
6415
- while (1) switch (_context.prev = _context.next) {
6416
- case 0:
6417
- _domain = _args.length > 0 && _args[0] !== undefined ? _args[0] : null;
6418
- domain = null;
6419
- if (_domain != null) {
6420
- domain = _domain;
6421
- } else {
6422
- domain = GetBaseUrl();
6423
- }
6424
- _context.next = 5;
6425
- return apiService().get("/PrivateLabel/GetFields?domain=" + domain + (companyId != null ? "&companyId=" + companyId : ""));
6426
- case 5:
6427
- responseFields = _context.sent;
6428
- if (responseFields != null && responseFields.status == 200) {
6429
- setDnsFields(responseFields.data);
6430
- }
6431
- case 7:
6432
- case "end":
6433
- return _context.stop();
6434
- }
6435
- }, _callee);
6436
- }));
6437
- return function loadDNSFields() {
6438
- return _ref2.apply(this, arguments);
6439
- };
6440
- }();
6441
- (0, _react.useEffect)(function () {
6442
- if (oEMDomain != null) {
6443
- loadDNSFields(oEMDomain);
6444
- }
6445
- }, [oEMDomain]);
6446
- var FetchOEMData = /*#__PURE__*/function () {
6447
- var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
6448
- var response, _response, _response2;
6449
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
6450
- while (1) switch (_context2.prev = _context2.next) {
6451
- case 0:
6452
- _context2.next = 2;
6453
- return apiService().get("/PrivateLabel/GetFonts");
6454
- case 2:
6455
- response = _context2.sent;
6456
- if (response != null && response.status == 200) {
6457
- setFonts(response.data);
6458
- }
6459
- if (!showAllDomains) {
6460
- _context2.next = 11;
6461
- break;
6462
- }
6463
- _context2.next = 7;
6464
- return apiService().get("/PrivateLabel/GetAllDomains");
6465
- case 7:
6466
- _response = _context2.sent;
6467
- if (_response != null && _response.status == 200) {
6468
- setOEMDomainList(_response.data);
6469
- if (_response.data.length > 0) {
6470
- setOEMDomain(_response.data[0].name);
6471
- } else {
6472
- setIsNewAccount(true);
6473
- }
6474
- }
6475
- _context2.next = 15;
6476
- break;
6477
- case 11:
6478
- _context2.next = 13;
6479
- return apiService().get("/PrivateLabel/GetAllDomainsUser");
6480
- case 13:
6481
- _response2 = _context2.sent;
6482
- if (_response2 != null && _response2.status == 200) {
6483
- setOEMDomainList(_response2.data);
6484
- if (_response2.data.length > 0) {
6485
- setOEMDomain(_response2.data[0].name);
6486
- } else {
6487
- setIsNewAccount(true);
6488
- }
6489
- }
6490
- case 15:
6491
- case "end":
6492
- return _context2.stop();
6493
- }
6494
- }, _callee2);
6495
- }));
6496
- return function FetchOEMData() {
6497
- return _ref3.apply(this, arguments);
6498
- };
6499
- }();
6500
- (0, _react.useEffect)(function () {
6501
- if (loadedUser) {
6502
- FetchOEMData();
6503
- }
6504
- }, [loadedUser]);
6505
- var _React$useState = _react["default"].useState({
6506
- page: 0,
6507
- pageSize: 12
6508
- }),
6509
- _React$useState2 = _slicedToArray(_React$useState, 2),
6510
- paginationModel = _React$useState2[0],
6511
- setPaginationModel = _React$useState2[1];
6512
- function handleCSSEditorDidMount(editor, monaco) {
6513
- cssEditorRef.current = editor;
6514
- }
6515
- function handleHtmlEditorDidMount(editor, monaco) {
6516
- htmlEditorRef.current = editor;
6517
- }
6518
- var columns = [{
6519
- field: "label",
6520
- headerName: "Fonts",
6521
- editable: false,
6522
- width: 300,
6523
- renderCell: function renderCell(params) {
6524
- var RenderData = function RenderData(row) {
6525
- // const { id, value, field } = params;
6526
- // const apiRef = useGridApiContext();
6527
- return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_Box["default"], {
6528
- sx: {
6529
- fontFamily: row.value,
6530
- fontSize: 20,
6531
- cursor: "pointer"
6532
- }
6533
- }, row.value), /*#__PURE__*/_react["default"].createElement("link", {
6534
- href: "https://fonts.googleapis.com/css2?family=" + row.value,
6535
- rel: "stylesheet"
6536
- }));
6537
- };
6538
- return RenderData(params);
6539
- }
6540
- }];
6541
- (0, _react.useEffect)(function () {
6542
- var fetchData = /*#__PURE__*/function () {
6543
- var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
6544
- var response;
6545
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
6546
- while (1) switch (_context3.prev = _context3.next) {
6547
- case 0:
6548
- // if (monaco) {
6549
- // //console.log("here is the monaco instance:", monaco);
6550
- // }
6551
-
6552
- setData(null);
6553
- _context3.next = 3;
6554
- return apiService().get("/PrivateLabel/GetEditorData?domain=" + oEMDomain + (companyId != null ? "&companyId=" + companyId : ""));
6555
- case 3:
6556
- response = _context3.sent;
6557
- if (response.status == 200) {
6558
- setData(response.data);
6559
- setSelectedFont(response.data.fontFamily);
6560
- setFontUri(response.data.fontUrl);
6561
- }
6562
- case 5:
6563
- case "end":
6564
- return _context3.stop();
6565
- }
6566
- }, _callee3);
6567
- }));
6568
- return function fetchData() {
6569
- return _ref4.apply(this, arguments);
6570
- };
6571
- }();
6572
- fetchData();
6573
- }, [monaco, oEMDomain]);
6574
- return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_Box["default"], {
6575
- sx: {
6576
- width: '100%'
6577
- }
6578
- }, selectedFont != null && fontUri == null && /*#__PURE__*/_react["default"].createElement("link", {
6579
- href: "https://fonts.googleapis.com/css2?family=" + selectedFont,
6580
- rel: "stylesheet"
6581
- }), /*#__PURE__*/_react["default"].createElement(_Box["default"], {
6582
- sx: {
6583
- paddingTop: 6
6584
- }
6585
- }, oEMDomain != null && /*#__PURE__*/_react["default"].createElement(_FormControl["default"], {
6586
- fullWidth: true
6587
- }, /*#__PURE__*/_react["default"].createElement(_InputLabel["default"], {
6588
- id: "demo-simple-select-label"
6589
- }, "Website Domain"), /*#__PURE__*/_react["default"].createElement(_Select["default"], {
6590
- labelId: "demo-simple-select-label",
6591
- id: "demo-simple-select",
6592
- defaultValue: oEMDomain,
6593
- label: "Website Domain",
6594
- onChange: function onChange(val) {
6595
- setOEMDomain(val.target.value);
6596
- }
6597
- }, oEMDomainList.map(function (dns) {
6598
- return /*#__PURE__*/_react["default"].createElement(_MenuItem["default"], {
6599
- value: dns.name
6600
- }, dns.name);
6601
- })))), /*#__PURE__*/_react["default"].createElement(_Box["default"], {
6602
- sx: {
6603
- borderBottom: 1,
6604
- borderColor: 'divider',
6605
- paddingTop: 2
6606
- }
6607
- }, /*#__PURE__*/_react["default"].createElement(_Tabs["default"], {
6608
- value: value,
6609
- onChange: handleChange,
6610
- "aria-label": "basic tabs example"
6611
- }, /*#__PURE__*/_react["default"].createElement(_Tab["default"], {
6612
- label: "App Icon / Colors"
6613
- }), /*#__PURE__*/_react["default"].createElement(_Tab["default"], {
6614
- label: "Fonts"
6615
- }), /*#__PURE__*/_react["default"].createElement(_Tab["default"], {
6616
- label: "Style Sheet Editor"
6617
- }), /*#__PURE__*/_react["default"].createElement(_Tab["default"], {
6618
- label: "HTML Import Editor"
6619
- }))), /*#__PURE__*/_react["default"].createElement(_Box["default"], null, /*#__PURE__*/_react["default"].createElement(_Box["default"], {
6620
- sx: {
6621
- padding: 2
6622
- }
6623
- }, value == 0 && /*#__PURE__*/_react["default"].createElement(_Box["default"], null, data != null && /*#__PURE__*/_react["default"].createElement(_Box["default"], null, /*#__PURE__*/_react["default"].createElement(_material.Grid, {
6624
- container: true,
6625
- spacing: 2
6626
- }, /*#__PURE__*/_react["default"].createElement(_material.Grid, {
6627
- item: true,
6628
- xs: 4
6629
- }, /*#__PURE__*/_react["default"].createElement(_Box["default"], {
6630
- sx: {
6631
- paddingBottom: 4
6632
- }
6633
- }, /*#__PURE__*/_react["default"].createElement(Dropzone, {
6634
- image: "/DefaultNoImage.svg",
6635
- text: "Drag 'n' drop your app icon here",
6636
- onDrop: /*#__PURE__*/function () {
6637
- var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(file) {
6638
- var data, response;
6639
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
6640
- while (1) switch (_context4.prev = _context4.next) {
6641
- case 0:
6642
- data = new FormData();
6643
- data.append("file", file);
6644
- data.append("domain", stateBaseUri);
6645
- _context4.next = 5;
6646
- return apiService().post("/PrivateLabel/UploadAppIcon", data);
6647
- case 5:
6648
- response = _context4.sent;
6649
- if (response != null && response.status == 200) {
6650
- window.location.reload();
6651
- }
6652
- case 7:
6653
- case "end":
6654
- return _context4.stop();
6655
- }
6656
- }, _callee4);
6657
- }));
6658
- return function (_x2) {
6659
- return _ref5.apply(this, arguments);
6660
- };
6661
- }()
6662
- }))), /*#__PURE__*/_react["default"].createElement(_material.Grid, {
6663
- item: true,
6664
- xs: 8
6665
- }, /*#__PURE__*/_react["default"].createElement(_Box["default"], {
6666
- sx: {
6667
- paddingBottom: 2,
6668
- fontWeight: "bold",
6669
- fontSize: 16
6670
- }
6671
- }, "Adjust the colors for your site"), /*#__PURE__*/_react["default"].createElement(_Box["default"], null, dnsFields != null && dnsFields.map(function (dnsField, index) {
6672
- return /*#__PURE__*/_react["default"].createElement(_Box["default"], {
6673
- key: index
6674
- }, /*#__PURE__*/_react["default"].createElement(_material.Grid, {
6675
- container: true,
6676
- spacing: 2
6677
- }, /*#__PURE__*/_react["default"].createElement(_material.Grid, {
6678
- item: true,
6679
- xs: 3
6680
- }, dnsField.name), /*#__PURE__*/_react["default"].createElement(_material.Grid, {
6681
- item: true,
6682
- xs: 9
6683
- }, /*#__PURE__*/_react["default"].createElement(ColorPicker, {
6684
- name: dnsField.name,
6685
- defaultColor: dnsField.value,
6686
- onColorChanged: /*#__PURE__*/function () {
6687
- var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(name, hex) {
6688
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
6689
- while (1) switch (_context5.prev = _context5.next) {
6690
- case 0:
6691
- _context5.next = 2;
6692
- return apiService().post("/PrivateLabel/SetFieldValue", {
6693
- id: dnsField.id,
6694
- fieldId: dnsField.fieldId,
6695
- value: hex
6696
- });
6697
- case 2:
6698
- notification(dnsField.name + " Saved");
6699
- case 3:
6700
- case "end":
6701
- return _context5.stop();
6702
- }
6703
- }, _callee5);
6704
- }));
6705
- return function (_x3, _x4) {
6706
- return _ref6.apply(this, arguments);
6707
- };
6708
- }()
6709
- }))));
6710
- })))))), value == 1 && /*#__PURE__*/_react["default"].createElement(_Box["default"], {
6711
- value: value,
6712
- index: 1
6713
- }, data != null && /*#__PURE__*/_react["default"].createElement(_Box["default"], null, /*#__PURE__*/_react["default"].createElement(_material.Grid, {
6714
- container: true,
6715
- spacing: 2
6716
- }, /*#__PURE__*/_react["default"].createElement(_material.Grid, {
6717
- item: true,
6718
- xs: 6
6719
- }, loadedUser == true && /*#__PURE__*/_react["default"].createElement(_Box["default"], null, /*#__PURE__*/_react["default"].createElement(_xDataGrid.DataGrid, {
6720
- rows: fonts,
6721
- columns: columns,
6722
- sx: {
6723
- height: "80vh",
6724
- width: "100%"
6725
- },
6726
- pagination: true,
6727
- disableSelectionOnClick: true,
6728
- onPaginationModelChange: setPaginationModel,
6729
- paginationModel: paginationModel
6730
- //pageSizeOptions={[5]}
6731
- // rowCount={100}
6732
- // rowSelectionModel={selectedFont}
6733
- ,
6734
- onRowClick: /*#__PURE__*/function () {
6735
- var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(params) {
6736
- var response;
6737
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
6738
- while (1) switch (_context6.prev = _context6.next) {
6739
- case 0:
6740
- _context6.next = 2;
6741
- return apiService().post("/PrivateLabel/SetFont", {
6742
- companyId: companyId,
6743
- domain: oEMDomain,
6744
- value: params.row.label
6745
- });
6746
- case 2:
6747
- response = _context6.sent;
6748
- if (response != null && response.status == 200) {
6749
- setSelectedFont(params.row.label);
6750
- setFontUri(null);
6751
- notification("Font saved!");
6752
- }
6753
- case 4:
6754
- case "end":
6755
- return _context6.stop();
6756
- }
6757
- }, _callee6);
6758
- }));
6759
- return function (_x5) {
6760
- return _ref7.apply(this, arguments);
6761
- };
6762
- }()
6763
- }))), /*#__PURE__*/_react["default"].createElement(_material.Grid, {
6764
- item: true,
6765
- xs: 6
6766
- }, /*#__PURE__*/_react["default"].createElement(FileUploader, {
6767
- url: "/PrivateLabel/UploadCustomFont",
6768
- accept: ".otf,.ttf,.woff",
6769
- params: {
6770
- domain: stateBaseUri
6771
- },
6772
- multiple: true,
6773
- variant: "custom",
6774
- onUploadCompleted: function onUploadCompleted() {
6775
- window.location.reload();
6776
- }
6777
- }, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
6778
- color: "primary",
6779
- variant: "contained",
6780
- fullWidth: true,
6781
- sx: {
6782
- height: 50
6783
- },
6784
- startIcon: /*#__PURE__*/_react["default"].createElement(_PublishRounded["default"], null)
6785
- }, /*#__PURE__*/_react["default"].createElement(_Box["default"], null, "Upload Font"), "\xA0", /*#__PURE__*/_react["default"].createElement(_Box["default"], {
6786
- sx: {
6787
- textAlign: "center"
6788
- }
6789
- }, /*#__PURE__*/_react["default"].createElement("small", null, "(.OTF, .TTF, OR .WOFF)")))), /*#__PURE__*/_react["default"].createElement(_Box["default"], {
6790
- sx: {
6791
- marginTop: 4
6792
- }
6793
- }, "Font Selected:"), /*#__PURE__*/_react["default"].createElement(_Box["default"], {
6794
- sx: {
6795
- marginBottom: 2,
6796
- fontWeight: "bold",
6797
- fontSize: 20
6798
- }
6799
- }, " ", selectedFont), /*#__PURE__*/_react["default"].createElement("hr", null), /*#__PURE__*/_react["default"].createElement(_Box["default"], {
6800
- sx: {
6801
- fontFamily: selectedFont
6802
- }
6803
- }, "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed ut ultricies odio. Nunc ut quam turpis. In hac habitasse platea dictumst. Suspendisse potenti. Nullam malesuada, purus id sagittis vestibulum, massa tellus gravida elit, vitae ultrices tortor nulla ac nunc. Aenean tempus semper est vel convallis. Sed feugiat, risus eu tincidunt eleifend, purus metus vulputate nulla, et condimentum sapien erat in nisi. Nunc non malesuada libero. Donec tempus tincidunt mi at vulputate. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Suspendisse potenti. Etiam nec eleifend orci. Suspendisse in est vel nunc rhoncus bibendum vitae id felis. Integer bibendum dolor elit, at tincidunt lacus tempor ac. Maecenas lobortis, mauris at condimentum feugiat, nulla orci condimentum massa, sed facilisis tellus ligula vitae metus. Aliquam erat volutpat. Quisque dignissim felis augue, at semper nisl posuere ut. Proin fringilla diam vitae faucibus finibus.", /*#__PURE__*/_react["default"].createElement("br", null), /*#__PURE__*/_react["default"].createElement("br", null), "Aenean tempus semper est vel convallis. Sed feugiat, risus eu tincidunt eleifend, purus metus vulputate nulla, et condimentum sapien erat in nisi. Nunc non malesuada libero. Donec tempus tincidunt mi at vulputate. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Suspendisse potenti"))))), value == 2 && /*#__PURE__*/_react["default"].createElement(_Box["default"], {
6804
- value: value,
6805
- index: 3
6806
- }, /*#__PURE__*/_react["default"].createElement(_material.Grid, {
6807
- container: true,
6808
- spacing: 2
6809
- }, /*#__PURE__*/_react["default"].createElement(_material.Grid, {
6810
- item: true,
6811
- xs: 6
6812
- }, /*#__PURE__*/_react["default"].createElement("h4", {
6813
- style: {
6814
- marginBottom: "0px"
6815
- }
6816
- }, "Global CSS edits"), /*#__PURE__*/_react["default"].createElement("small", null, "You can make edits to your stylesheet")), /*#__PURE__*/_react["default"].createElement(_material.Grid, {
6817
- item: true,
6818
- xs: 6,
6819
- sx: {
6820
- textAlign: "right"
6821
- }
6822
- }, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
6823
- startIcon: /*#__PURE__*/_react["default"].createElement(_Check["default"], null),
6824
- sx: {
6825
- marginTop: 4
6826
- },
6827
- variant: "contained",
6828
- onClick: /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
6829
- var response;
6830
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
6831
- while (1) switch (_context7.prev = _context7.next) {
6832
- case 0:
6833
- _context7.next = 2;
6834
- return apiService().post("/PrivateLabel/SetGlobalCSS", {
6835
- companyId: companyId,
6836
- domain: oEMDomain,
6837
- value: cssEditorRef.current.getValue()
6838
- });
6839
- case 2:
6840
- response = _context7.sent;
6841
- if (response != null && response.status == 200) {
6842
- notification("CSS Saved!");
6843
- }
6844
- case 4:
6845
- case "end":
6846
- return _context7.stop();
6847
- }
6848
- }, _callee7);
6849
- }))
6850
- }, "Save Changes"))), /*#__PURE__*/_react["default"].createElement(_Box["default"], {
6851
- sx: {
6852
- paddingTop: 1
6853
- }
6854
- }, data != null && /*#__PURE__*/_react["default"].createElement(_react2["default"], {
6855
- height: "70vh",
6856
- onMount: handleCSSEditorDidMount,
6857
- defaultLanguage: "css",
6858
- theme: "vs-dark",
6859
- defaultValue: data == null || data.prettyCSS == null ? "" : data.prettyCSS
6860
- }))), value == 3 && /*#__PURE__*/_react["default"].createElement(_Box["default"], {
6861
- value: value,
6862
- index: 4
6863
- }, /*#__PURE__*/_react["default"].createElement(_material.Grid, {
6864
- container: true,
6865
- spacing: 2
6866
- }, /*#__PURE__*/_react["default"].createElement(_material.Grid, {
6867
- item: true,
6868
- xs: 6
6869
- }, /*#__PURE__*/_react["default"].createElement("h4", {
6870
- style: {
6871
- marginBottom: "0px"
6872
- }
6873
- }, "HTML import Edits"), /*#__PURE__*/_react["default"].createElement("small", null, "You can add imports such as google analytics or clarity")), /*#__PURE__*/_react["default"].createElement(_material.Grid, {
6874
- item: true,
6875
- xs: 6,
6876
- sx: {
6877
- textAlign: "right"
6878
- }
6879
- }, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
6880
- startIcon: /*#__PURE__*/_react["default"].createElement(_Check["default"], null),
6881
- sx: {
6882
- marginTop: 4
6883
- },
6884
- variant: "contained",
6885
- onClick: /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
6886
- var response;
6887
- return _regeneratorRuntime().wrap(function _callee8$(_context8) {
6888
- while (1) switch (_context8.prev = _context8.next) {
6889
- case 0:
6890
- _context8.next = 2;
6891
- return apiService().post("/PrivateLabel/SetGlobalHTML", {
6892
- companyId: companyId,
6893
- domain: oEMDomain,
6894
- value: htmlEditorRef.current.getValue()
6895
- });
6896
- case 2:
6897
- response = _context8.sent;
6898
- if (response != null && response.status == 200) {
6899
- notification("HTML saved!");
6900
- }
6901
- case 4:
6902
- case "end":
6903
- return _context8.stop();
6904
- }
6905
- }, _callee8);
6906
- }))
6907
- }, "Save Changes"))), /*#__PURE__*/_react["default"].createElement(_Box["default"], {
6908
- sx: {
6909
- paddingTop: 1
6910
- }
6911
- }, data != null && /*#__PURE__*/_react["default"].createElement(_react2["default"], {
6912
- height: "70vh",
6913
- onMount: handleHtmlEditorDidMount,
6914
- defaultLanguage: "html",
6915
- theme: "vs-dark",
6916
- defaultValue: data == null || data.prettyHTML == null ? "" : data.prettyHTML
6917
- }))))), /*#__PURE__*/_react["default"].createElement(AddDomain, {
6918
- open: isNewAccount,
6919
- azureWebsite: "indealspaces.azurewebsites.net",
6920
- azureTxtValue: "3C6463B49E18993E32249450799B7A1F04A9BC60DB6AD1BFBCC6429AC7F074F3",
6921
- handleClose: /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
6922
- return _regeneratorRuntime().wrap(function _callee9$(_context9) {
6923
- while (1) switch (_context9.prev = _context9.next) {
6924
- case 0:
6925
- setIsNewAccount(false);
6926
- _context9.next = 3;
6927
- return FetchOEMData();
6928
- case 3:
6929
- case "end":
6930
- return _context9.stop();
6931
- }
6932
- }, _callee9);
6933
- }))
6934
- })));
6935
- }
6936
- "use strict";
6937
-
6938
6317
  Object.defineProperty(exports, "__esModule", {
6939
6318
  value: true
6940
6319
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "authscape",
3
- "version": "1.0.604",
3
+ "version": "1.0.606",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -1,484 +0,0 @@
1
-
2
- import React, { useState, useRef, useEffect } from "react";
3
- import Editor, { useMonaco } from "@monaco-editor/react";
4
- import Button from '@mui/material/Button';
5
- import CheckIcon from '@mui/icons-material/Check';
6
- import Tabs from '@mui/material/Tabs';
7
- import Tab from '@mui/material/Tab';
8
- import Box from '@mui/material/Box';
9
- import { Grid, TextField } from "@mui/material";
10
- import { DataGrid } from "@mui/x-data-grid";
11
- import PublishRoundedIcon from '@mui/icons-material/PublishRounded';
12
- // import Image from "next/image";
13
- import InputLabel from '@mui/material/InputLabel';
14
- import MenuItem from '@mui/material/MenuItem';
15
- import FormControl from '@mui/material/FormControl';
16
- import Select from '@mui/material/Select';
17
-
18
- // remove after NPM
19
- // import {FileUploader, apiService, ColorPicker, Dropzone} from 'authscape';
20
- // import AddDomain from "./AddDomainModal";
21
-
22
- export function PrivateLabelEditor({loadedUser, notification, showAllDomains = false, companyId = null}) {
23
-
24
- const monaco = useMonaco();
25
-
26
- const cssEditorRef = useRef(null);
27
- const htmlEditorRef = useRef(null);
28
-
29
- const [data, setData] = useState(null);
30
- const [value, setValue] = useState(0);
31
- const [fonts, setFonts] = useState([]);
32
- const [oEMDomainList, setOEMDomainList] = useState([]);
33
- const [dnsFields, setDnsFields] = useState([]);
34
- const [selectedFont, setSelectedFont] = useState(null);
35
- const [fontUri, setFontUri] = useState(null);
36
-
37
- const [oEMDomain, setOEMDomain] = useState(null);
38
-
39
- const [stateBaseUri, setBaseUri] = useState('');
40
-
41
- const [isNewAccount, setIsNewAccount] = useState(false);
42
-
43
-
44
- const handleChange = (event, newValue) => {
45
- setValue(newValue);
46
- };
47
-
48
- const GetBaseUrl = () => {
49
- return window.location.protocol + "//" + window.location.host;
50
- }
51
-
52
- const loadDNSFields = async (_domain = null) => {
53
-
54
- var domain = null;
55
- if (_domain != null)
56
- {
57
- domain = _domain;
58
- }
59
- else
60
- {
61
- domain = GetBaseUrl();
62
- }
63
-
64
- let responseFields = await apiService().get("/PrivateLabel/GetFields?domain=" + domain + (companyId != null ? ("&companyId=" + companyId) : ""));
65
- if (responseFields != null && responseFields.status == 200)
66
- {
67
- setDnsFields(responseFields.data);
68
- }
69
- }
70
-
71
- useEffect(() => {
72
-
73
- if (oEMDomain != null)
74
- {
75
- loadDNSFields(oEMDomain);
76
- }
77
-
78
- }, [oEMDomain]);
79
-
80
-
81
- const FetchOEMData = async () => {
82
-
83
- let response = await apiService().get("/PrivateLabel/GetFonts");
84
- if (response != null && response.status == 200)
85
- {
86
- setFonts(response.data);
87
- }
88
-
89
- if (showAllDomains)
90
- {
91
- let response = await apiService().get("/PrivateLabel/GetAllDomains");
92
- if (response != null && response.status == 200)
93
- {
94
- setOEMDomainList(response.data);
95
-
96
- if (response.data.length > 0)
97
- {
98
- setOEMDomain(response.data[0].name);
99
- }
100
- else
101
- {
102
- setIsNewAccount(true);
103
- }
104
- }
105
- }
106
- else
107
- {
108
- let response = await apiService().get("/PrivateLabel/GetAllDomainsUser");
109
- if (response != null && response.status == 200)
110
- {
111
- setOEMDomainList(response.data);
112
-
113
- if (response.data.length > 0)
114
- {
115
- setOEMDomain(response.data[0].name);
116
- }
117
- else
118
- {
119
- setIsNewAccount(true);
120
- }
121
- }
122
- }
123
-
124
- }
125
-
126
- useEffect(() => {
127
-
128
- if (loadedUser)
129
- {
130
- FetchOEMData();
131
- }
132
-
133
- }, [loadedUser]);
134
-
135
-
136
- const [paginationModel, setPaginationModel] = React.useState({
137
- page: 0,
138
- pageSize: 12,
139
- });
140
-
141
-
142
- function handleCSSEditorDidMount(editor, monaco) {
143
- cssEditorRef.current = editor;
144
- }
145
-
146
- function handleHtmlEditorDidMount(editor, monaco) {
147
- htmlEditorRef.current = editor;
148
- }
149
-
150
- const columns = [
151
- {
152
- field: "label",
153
- headerName: "Fonts",
154
- editable: false,
155
- width:300,
156
- renderCell: (params) => {
157
- const RenderData = (row) => {
158
- // const { id, value, field } = params;
159
- // const apiRef = useGridApiContext();
160
- return (
161
- <>
162
- <Box sx={{fontFamily: row.value, fontSize:20, cursor:"pointer"}}>{row.value}</Box>
163
- <link href={"https://fonts.googleapis.com/css2?family=" + row.value} rel="stylesheet"></link>
164
- </>
165
- );
166
- };
167
- return RenderData(params);
168
- },
169
- }
170
- ];
171
-
172
- useEffect(() => {
173
-
174
- const fetchData = async () => {
175
-
176
- // if (monaco) {
177
- // //console.log("here is the monaco instance:", monaco);
178
- // }
179
-
180
- setData(null);
181
-
182
- let response = await apiService().get("/PrivateLabel/GetEditorData?domain=" + oEMDomain + (companyId != null ? ("&companyId=" + companyId) : ""));
183
- if (response.status == 200)
184
- {
185
- setData(response.data);
186
- setSelectedFont(response.data.fontFamily);
187
- setFontUri(response.data.fontUrl);
188
- }
189
- }
190
- fetchData();
191
-
192
- }, [monaco, oEMDomain]);
193
-
194
- return (
195
- <>
196
- <Box sx={{ width: '100%' }}>
197
-
198
- {(selectedFont != null && fontUri == null) &&
199
- <link href={"https://fonts.googleapis.com/css2?family=" + selectedFont} rel="stylesheet"></link>
200
- }
201
-
202
- <Box sx={{paddingTop:6}}>
203
- {oEMDomain != null &&
204
- <FormControl fullWidth>
205
- <InputLabel id="demo-simple-select-label">Website Domain</InputLabel>
206
- <Select
207
- labelId="demo-simple-select-label"
208
- id="demo-simple-select"
209
- defaultValue={oEMDomain}
210
- label="Website Domain"
211
- onChange={(val) => {
212
- setOEMDomain(val.target.value)
213
- }}>
214
- {oEMDomainList.map((dns) => {
215
- return (
216
- <MenuItem value={dns.name}>{dns.name}</MenuItem>
217
- )
218
- })}
219
- </Select>
220
- </FormControl>
221
- }
222
- </Box>
223
-
224
- <Box sx={{ borderBottom: 1, borderColor: 'divider', paddingTop:2 }}>
225
- <Tabs value={value} onChange={handleChange} aria-label="basic tabs example">
226
- <Tab label="App Icon / Colors" />
227
- <Tab label="Fonts" />
228
- {/* <Tab label="Content" /> */}
229
- <Tab label="Style Sheet Editor" />
230
- <Tab label="HTML Import Editor" />
231
- </Tabs>
232
- </Box>
233
- <Box>
234
-
235
- <Box sx={{padding:2}}>
236
- {value == 0 &&
237
- <Box>
238
- {data != null &&
239
- <Box>
240
- <Grid container spacing={2}>
241
- <Grid item xs={4}>
242
- <Box sx={{paddingBottom:4}}>
243
- <Dropzone
244
- image={"/DefaultNoImage.svg"}
245
- text={"Drag 'n' drop your app icon here"}
246
- onDrop={async (file) => {
247
- const data = new FormData();
248
-
249
- data.append("file", file);
250
- data.append("domain", stateBaseUri);
251
-
252
- let response = await apiService().post(
253
- "/PrivateLabel/UploadAppIcon",
254
- data
255
- );
256
- if (response != null && response.status == 200) {
257
- window.location.reload();
258
- }
259
- }}
260
- />
261
- </Box>
262
- </Grid>
263
- <Grid item xs={8}>
264
- <Box sx={{paddingBottom:2, fontWeight:"bold", fontSize:16}}>
265
- Adjust the colors for your site
266
- </Box>
267
- <Box>
268
- {dnsFields != null && dnsFields.map((dnsField, index) => {
269
- return (
270
- <Box key={index}>
271
- <Grid container spacing={2}>
272
- <Grid item xs={3}>
273
- {dnsField.name}
274
- </Grid>
275
- <Grid item xs={9}>
276
-
277
- <ColorPicker name={dnsField.name} defaultColor={dnsField.value} onColorChanged={async (name, hex) => {
278
-
279
- await apiService().post("/PrivateLabel/SetFieldValue", {
280
- id: dnsField.id,
281
- fieldId: dnsField.fieldId,
282
- value: hex
283
- });
284
-
285
- notification(dnsField.name + " Saved");
286
-
287
- }} />
288
- </Grid>
289
- </Grid>
290
- </Box>
291
- )
292
- })}
293
- </Box>
294
- </Grid>
295
- </Grid>
296
- </Box>
297
- }
298
- </Box>
299
- }
300
-
301
- {value == 1 &&
302
- <Box value={value} index={1}>
303
- {data != null &&
304
- <Box>
305
- <Grid container spacing={2}>
306
- <Grid item xs={6}>
307
-
308
- {loadedUser == true &&
309
-
310
- <Box>
311
- <DataGrid
312
- rows={fonts}
313
- columns={columns}
314
- sx={{height:"80vh", width:"100%"}}
315
- pagination
316
- disableSelectionOnClick={true}
317
- onPaginationModelChange={setPaginationModel}
318
- paginationModel={paginationModel}
319
- //pageSizeOptions={[5]}
320
- // rowCount={100}
321
- // rowSelectionModel={selectedFont}
322
- onRowClick={async (params) => {
323
-
324
- let response = await apiService().post("/PrivateLabel/SetFont", {
325
- companyId: companyId,
326
- domain: oEMDomain,
327
- value: params.row.label
328
- });
329
- if (response != null && response.status == 200)
330
- {
331
- setSelectedFont(params.row.label);
332
- setFontUri(null);
333
- notification("Font saved!");
334
- }
335
- }}
336
- />
337
- </Box>
338
- }
339
-
340
-
341
- </Grid>
342
- <Grid item xs={6} >
343
-
344
- <FileUploader url={"/PrivateLabel/UploadCustomFont"} accept={".otf,.ttf,.woff"} params={{
345
- domain: stateBaseUri
346
- }} multiple={true} variant='custom' onUploadCompleted={() => {
347
- window.location.reload();
348
- }}>
349
-
350
- <Button color="primary" variant="contained" fullWidth={true} sx={{height:50}} startIcon={<PublishRoundedIcon/>}><Box>Upload Font</Box>&nbsp;<Box sx={{textAlign:"center"}}><small>(.OTF, .TTF, OR .WOFF)</small></Box></Button>
351
-
352
- </FileUploader>
353
-
354
-
355
- <Box sx={{marginTop:4}}>Font Selected:</Box>
356
- <Box sx={{marginBottom:2, fontWeight:"bold", fontSize:20}}> {selectedFont}</Box>
357
- <hr />
358
- <Box sx={{fontFamily: selectedFont}}>
359
- Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed ut ultricies odio. Nunc ut quam turpis. In hac habitasse platea dictumst.
360
- Suspendisse potenti. Nullam malesuada, purus id sagittis vestibulum, massa tellus gravida elit, vitae ultrices tortor nulla ac nunc.
361
- Aenean tempus semper est vel convallis. Sed feugiat, risus eu tincidunt eleifend, purus metus vulputate nulla, et condimentum sapien erat in nisi.
362
- Nunc non malesuada libero. Donec tempus tincidunt mi at vulputate. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae;
363
- Suspendisse potenti. Etiam nec eleifend orci. Suspendisse in est vel nunc rhoncus bibendum vitae id felis.
364
- Integer bibendum dolor elit, at tincidunt lacus tempor ac. Maecenas lobortis, mauris at condimentum feugiat, nulla orci condimentum massa, sed facilisis tellus ligula vitae metus.
365
- Aliquam erat volutpat. Quisque dignissim felis augue, at semper nisl posuere ut. Proin fringilla diam vitae faucibus finibus.
366
- <br/><br/>
367
- Aenean tempus semper est vel convallis. Sed feugiat, risus eu tincidunt eleifend, purus metus vulputate nulla, et condimentum sapien erat in nisi. Nunc non malesuada libero. Donec tempus tincidunt mi at vulputate. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Suspendisse potenti
368
- </Box>
369
- </Grid>
370
- </Grid>
371
- </Box>
372
- }
373
- </Box>
374
- }
375
-
376
- {/* {value == 2 &&
377
- <Box value={value} index={2}>
378
- <Grid container spacing={2}>
379
- <Grid item xs={6}>
380
- <h4 style={{marginBottom:"0px"}}>Content</h4>
381
- <small>You can adjust the content within your site</small>
382
- </Grid>
383
- </Grid>
384
- <Box sx={{paddingTop:2}}>
385
- <TextField id="outlined-basic" label="Outlined" variant="outlined" />
386
- </Box>
387
- </Box>
388
- } */}
389
-
390
- {value == 2 &&
391
- <Box value={value} index={3}>
392
-
393
- <Grid container spacing={2}>
394
- <Grid item xs={6}>
395
- <h4 style={{marginBottom:"0px"}}>Global CSS edits</h4>
396
- <small>You can make edits to your stylesheet</small>
397
- </Grid>
398
- <Grid item xs={6} sx={{textAlign:"right"}}>
399
- <Button startIcon={<CheckIcon/>} sx={{marginTop:4}} variant="contained" onClick={async () => {
400
-
401
- let response = await apiService().post("/PrivateLabel/SetGlobalCSS", {
402
- companyId: companyId,
403
- domain: oEMDomain,
404
- value: cssEditorRef.current.getValue()
405
- });
406
- if (response != null && response.status == 200)
407
- {
408
- notification("CSS Saved!")
409
- }
410
-
411
- }}>Save Changes</Button>
412
- </Grid>
413
- </Grid>
414
-
415
- <Box sx={{paddingTop:1}}>
416
-
417
- {data != null &&
418
- <Editor
419
- height="70vh"
420
- onMount={handleCSSEditorDidMount}
421
- defaultLanguage="css"
422
- theme="vs-dark"
423
- defaultValue={(data == null || data.prettyCSS == null) ? "" : data.prettyCSS}
424
- />
425
- }
426
- </Box>
427
-
428
- </Box>
429
- }
430
-
431
- {value == 3 &&
432
- <Box value={value} index={4}>
433
-
434
-
435
- <Grid container spacing={2}>
436
- <Grid item xs={6}>
437
- <h4 style={{marginBottom:"0px"}}>HTML import Edits</h4>
438
- <small>You can add imports such as google analytics or clarity</small>
439
- </Grid>
440
- <Grid item xs={6} sx={{textAlign:"right"}}>
441
- <Button startIcon={<CheckIcon/>} sx={{marginTop:4}} variant="contained" onClick={async () => {
442
-
443
- let response = await apiService().post("/PrivateLabel/SetGlobalHTML", {
444
- companyId: companyId,
445
- domain: oEMDomain,
446
- value: htmlEditorRef.current.getValue()
447
- });
448
-
449
- if (response != null && response.status == 200)
450
- {
451
- notification("HTML saved!")
452
- }
453
-
454
- }}>Save Changes</Button>
455
- </Grid>
456
- </Grid>
457
-
458
- <Box sx={{paddingTop:1}}>
459
- {data != null &&
460
- <Editor
461
- height="70vh"
462
- onMount={handleHtmlEditorDidMount}
463
- defaultLanguage="html"
464
- theme="vs-dark"
465
- defaultValue={(data == null || data.prettyHTML == null) ? "" : data.prettyHTML}
466
- />
467
- }
468
- </Box>
469
-
470
-
471
- </Box>
472
- }
473
- </Box>
474
-
475
- </Box>
476
-
477
- <AddDomain open={isNewAccount} azureWebsite={"indealspaces.azurewebsites.net"} azureTxtValue={"3C6463B49E18993E32249450799B7A1F04A9BC60DB6AD1BFBCC6429AC7F074F3"} handleClose={async () => {
478
- setIsNewAccount(false);
479
- await FetchOEMData();
480
- }} />
481
- </Box>
482
- </>
483
- )
484
- }