authscape 1.0.336 → 1.0.340

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
@@ -2228,6 +2228,10 @@ var _material = require("@mui/material");
2228
2228
  var _xDataGrid = require("@mui/x-data-grid");
2229
2229
  var _PublishRounded = _interopRequireDefault(require("@mui/icons-material/PublishRounded"));
2230
2230
  var _image = _interopRequireDefault(require("next/image"));
2231
+ var _InputLabel = _interopRequireDefault(require("@mui/material/InputLabel"));
2232
+ var _MenuItem = _interopRequireDefault(require("@mui/material/MenuItem"));
2233
+ var _FormControl = _interopRequireDefault(require("@mui/material/FormControl"));
2234
+ var _Select = _interopRequireDefault(require("@mui/material/Select"));
2231
2235
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
2232
2236
  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); }
2233
2237
  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; }
@@ -2240,9 +2244,14 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
2240
2244
  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; }
2241
2245
  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; } }
2242
2246
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
2247
+ // remove after NPM
2248
+ // import {FileUploader, apiService, ColorPicker} from 'authscape';
2249
+
2243
2250
  function OEMEditor(_ref) {
2244
2251
  var loadedUser = _ref.loadedUser,
2245
2252
  notification = _ref.notification,
2253
+ _ref$showAllDomains = _ref.showAllDomains,
2254
+ showAllDomains = _ref$showAllDomains === void 0 ? false : _ref$showAllDomains,
2246
2255
  _ref$companyId = _ref.companyId,
2247
2256
  companyId = _ref$companyId === void 0 ? null : _ref$companyId;
2248
2257
  var monaco = (0, _react2.useMonaco)();
@@ -2262,57 +2271,126 @@ function OEMEditor(_ref) {
2262
2271
  setFonts = _useState6[1];
2263
2272
  var _useState7 = (0, _react.useState)([]),
2264
2273
  _useState8 = _slicedToArray(_useState7, 2),
2265
- dnsFields = _useState8[0],
2266
- setDnsFields = _useState8[1];
2267
- var _useState9 = (0, _react.useState)(null),
2274
+ oEMDomainList = _useState8[0],
2275
+ setOEMDomainList = _useState8[1];
2276
+ var _useState9 = (0, _react.useState)([]),
2268
2277
  _useState10 = _slicedToArray(_useState9, 2),
2269
- selectedFont = _useState10[0],
2270
- setSelectedFont = _useState10[1];
2278
+ dnsFields = _useState10[0],
2279
+ setDnsFields = _useState10[1];
2271
2280
  var _useState11 = (0, _react.useState)(null),
2272
2281
  _useState12 = _slicedToArray(_useState11, 2),
2273
- fontUri = _useState12[0],
2274
- setFontUri = _useState12[1];
2275
- var _useState13 = (0, _react.useState)(''),
2282
+ selectedFont = _useState12[0],
2283
+ setSelectedFont = _useState12[1];
2284
+ var _useState13 = (0, _react.useState)(null),
2276
2285
  _useState14 = _slicedToArray(_useState13, 2),
2277
- stateBaseUri = _useState14[0],
2278
- setBaseUri = _useState14[1];
2286
+ fontUri = _useState14[0],
2287
+ setFontUri = _useState14[1];
2288
+ var _useState15 = (0, _react.useState)(null),
2289
+ _useState16 = _slicedToArray(_useState15, 2),
2290
+ oEMDomain = _useState16[0],
2291
+ setOEMDomain = _useState16[1];
2292
+ var _useState17 = (0, _react.useState)(''),
2293
+ _useState18 = _slicedToArray(_useState17, 2),
2294
+ stateBaseUri = _useState18[0],
2295
+ setBaseUri = _useState18[1];
2279
2296
  var handleChange = function handleChange(event, newValue) {
2280
2297
  setValue(newValue);
2281
2298
  };
2282
2299
  var GetBaseUrl = function GetBaseUrl() {
2283
2300
  return window.location.protocol + "//" + window.location.host;
2284
2301
  };
2302
+ var loadDNSFields = /*#__PURE__*/function () {
2303
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
2304
+ var _domain,
2305
+ domain,
2306
+ responseFields,
2307
+ _args = arguments;
2308
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
2309
+ while (1) switch (_context.prev = _context.next) {
2310
+ case 0:
2311
+ _domain = _args.length > 0 && _args[0] !== undefined ? _args[0] : null;
2312
+ domain = null;
2313
+ if (_domain != null) {
2314
+ domain = _domain;
2315
+ } else {
2316
+ domain = GetBaseUrl();
2317
+ }
2318
+ _context.next = 5;
2319
+ return apiService().get("/WhiteLabel/GetFields?domain=" + domain + (companyId != null ? "&companyId=" + companyId : ""));
2320
+ case 5:
2321
+ responseFields = _context.sent;
2322
+ if (responseFields != null && responseFields.status == 200) {
2323
+ setDnsFields(responseFields.data);
2324
+ }
2325
+ case 7:
2326
+ case "end":
2327
+ return _context.stop();
2328
+ }
2329
+ }, _callee);
2330
+ }));
2331
+ return function loadDNSFields() {
2332
+ return _ref2.apply(this, arguments);
2333
+ };
2334
+ }();
2335
+ (0, _react.useEffect)(function () {
2336
+ // if (oEMDomain != null)
2337
+ // {
2338
+ loadDNSFields(oEMDomain);
2339
+ // }
2340
+ }, [oEMDomain]);
2285
2341
  (0, _react.useEffect)(function () {
2286
2342
  if (loadedUser) {
2287
2343
  var fetchData = /*#__PURE__*/function () {
2288
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
2289
- var response, domain, responseFields;
2290
- return _regeneratorRuntime().wrap(function _callee$(_context) {
2291
- while (1) switch (_context.prev = _context.next) {
2344
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
2345
+ var response, _response, _response2;
2346
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
2347
+ while (1) switch (_context2.prev = _context2.next) {
2292
2348
  case 0:
2293
- _context.next = 2;
2349
+ _context2.next = 2;
2294
2350
  return apiService().get("/WhiteLabel/GetFonts");
2295
2351
  case 2:
2296
- response = _context.sent;
2352
+ response = _context2.sent;
2297
2353
  if (response != null && response.status == 200) {
2298
2354
  setFonts(response.data);
2299
2355
  }
2300
- domain = GetBaseUrl();
2301
- _context.next = 7;
2302
- return apiService().get("/WhiteLabel/GetFields?domain=" + domain + (companyId != null ? "&companyId=" + companyId : ""));
2303
- case 7:
2304
- responseFields = _context.sent;
2305
- if (responseFields != null && responseFields.status == 200) {
2306
- setDnsFields(responseFields.data);
2356
+ _context2.next = 6;
2357
+ return loadDNSFields();
2358
+ case 6:
2359
+ if (!showAllDomains) {
2360
+ _context2.next = 13;
2361
+ break;
2307
2362
  }
2363
+ _context2.next = 9;
2364
+ return apiService().get("/WhiteLabel/GetAllDomains");
2308
2365
  case 9:
2366
+ _response = _context2.sent;
2367
+ if (_response != null && _response.status == 200) {
2368
+ setOEMDomainList(_response.data);
2369
+ if (_response.data.length > 0) {
2370
+ setOEMDomain(_response.data[0].name);
2371
+ }
2372
+ }
2373
+ _context2.next = 17;
2374
+ break;
2375
+ case 13:
2376
+ _context2.next = 15;
2377
+ return apiService().get("/WhiteLabel/GetAllDomainsUser");
2378
+ case 15:
2379
+ _response2 = _context2.sent;
2380
+ if (_response2 != null && _response2.status == 200) {
2381
+ setOEMDomainList(_response2.data);
2382
+ if (_response2.data.length > 0) {
2383
+ setOEMDomain(_response2.data[0].name);
2384
+ }
2385
+ }
2386
+ case 17:
2309
2387
  case "end":
2310
- return _context.stop();
2388
+ return _context2.stop();
2311
2389
  }
2312
- }, _callee);
2390
+ }, _callee2);
2313
2391
  }));
2314
2392
  return function fetchData() {
2315
- return _ref2.apply(this, arguments);
2393
+ return _ref3.apply(this, arguments);
2316
2394
  };
2317
2395
  }();
2318
2396
  fetchData();
@@ -2356,37 +2434,37 @@ function OEMEditor(_ref) {
2356
2434
  }];
2357
2435
  (0, _react.useEffect)(function () {
2358
2436
  var fetchData = /*#__PURE__*/function () {
2359
- var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
2360
- var baseUri, response;
2361
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
2362
- while (1) switch (_context2.prev = _context2.next) {
2437
+ var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
2438
+ var response;
2439
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
2440
+ while (1) switch (_context3.prev = _context3.next) {
2363
2441
  case 0:
2364
2442
  // if (monaco) {
2365
2443
  // //console.log("here is the monaco instance:", monaco);
2366
2444
  // }
2367
- baseUri = GetBaseUrl();
2368
- setBaseUri(baseUri);
2369
- _context2.next = 4;
2370
- return apiService().get("/WhiteLabel/GetEditorData?domain=" + baseUri + (companyId != null ? "&companyId=" + companyId : ""));
2371
- case 4:
2372
- response = _context2.sent;
2445
+
2446
+ setData(null);
2447
+ _context3.next = 3;
2448
+ return apiService().get("/WhiteLabel/GetEditorData?domain=" + oEMDomain + (companyId != null ? "&companyId=" + companyId : ""));
2449
+ case 3:
2450
+ response = _context3.sent;
2373
2451
  if (response.status == 200) {
2374
2452
  setData(response.data);
2375
2453
  setSelectedFont(response.data.fontFamily);
2376
2454
  setFontUri(response.data.fontUrl);
2377
2455
  }
2378
- case 6:
2456
+ case 5:
2379
2457
  case "end":
2380
- return _context2.stop();
2458
+ return _context3.stop();
2381
2459
  }
2382
- }, _callee2);
2460
+ }, _callee3);
2383
2461
  }));
2384
2462
  return function fetchData() {
2385
- return _ref3.apply(this, arguments);
2463
+ return _ref4.apply(this, arguments);
2386
2464
  };
2387
2465
  }();
2388
2466
  fetchData();
2389
- }, [monaco]);
2467
+ }, [monaco, oEMDomain]);
2390
2468
  return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_Box["default"], {
2391
2469
  sx: {
2392
2470
  width: '100%'
@@ -2395,9 +2473,30 @@ function OEMEditor(_ref) {
2395
2473
  href: "https://fonts.googleapis.com/css2?family=" + selectedFont,
2396
2474
  rel: "stylesheet"
2397
2475
  }), /*#__PURE__*/_react["default"].createElement(_Box["default"], {
2476
+ sx: {
2477
+ paddingTop: 6
2478
+ }
2479
+ }, oEMDomain != null && /*#__PURE__*/_react["default"].createElement(_FormControl["default"], {
2480
+ fullWidth: true
2481
+ }, /*#__PURE__*/_react["default"].createElement(_InputLabel["default"], {
2482
+ id: "demo-simple-select-label"
2483
+ }, "Website Domain"), /*#__PURE__*/_react["default"].createElement(_Select["default"], {
2484
+ labelId: "demo-simple-select-label",
2485
+ id: "demo-simple-select",
2486
+ defaultValue: oEMDomain,
2487
+ label: "Website Domain",
2488
+ onChange: function onChange(val) {
2489
+ setOEMDomain(val.target.value);
2490
+ }
2491
+ }, oEMDomainList.map(function (dns) {
2492
+ return /*#__PURE__*/_react["default"].createElement(_MenuItem["default"], {
2493
+ value: dns.name
2494
+ }, dns.name);
2495
+ })))), /*#__PURE__*/_react["default"].createElement(_Box["default"], {
2398
2496
  sx: {
2399
2497
  borderBottom: 1,
2400
- borderColor: 'divider'
2498
+ borderColor: 'divider',
2499
+ paddingTop: 2
2401
2500
  }
2402
2501
  }, /*#__PURE__*/_react["default"].createElement(_Tabs["default"], {
2403
2502
  value: value,
@@ -2415,16 +2514,16 @@ function OEMEditor(_ref) {
2415
2514
  sx: {
2416
2515
  padding: 2
2417
2516
  }
2418
- }, value == 0 && /*#__PURE__*/_react["default"].createElement(_Box["default"], null, /*#__PURE__*/_react["default"].createElement(_Box["default"], {
2517
+ }, value == 0 && /*#__PURE__*/_react["default"].createElement(_Box["default"], null, data != null && /*#__PURE__*/_react["default"].createElement(_Box["default"], null, /*#__PURE__*/_react["default"].createElement(_Box["default"], {
2419
2518
  sx: {
2420
2519
  paddingBottom: 4
2421
2520
  }
2422
- }, data.appIconUrl == null && /*#__PURE__*/_react["default"].createElement(_image["default"], {
2423
- src: "/DefaultNoImage.svg",
2521
+ }, data != null && data.appIconUrl != null && data.appIconUrl.trim() != "" ? /*#__PURE__*/_react["default"].createElement(_image["default"], {
2522
+ src: data.appIconUrl,
2424
2523
  width: 200,
2425
2524
  height: 200
2426
- }), data.appIconUrl != null && /*#__PURE__*/_react["default"].createElement(_image["default"], {
2427
- src: data.appIconUrl,
2525
+ }) : /*#__PURE__*/_react["default"].createElement(_image["default"], {
2526
+ src: "/DefaultNoImage.svg",
2428
2527
  width: 200,
2429
2528
  height: 200
2430
2529
  }), /*#__PURE__*/_react["default"].createElement(FileUploader, {
@@ -2458,11 +2557,11 @@ function OEMEditor(_ref) {
2458
2557
  name: dnsField.name,
2459
2558
  defaultColor: dnsField.value,
2460
2559
  onColorChanged: /*#__PURE__*/function () {
2461
- var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(name, hex) {
2462
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
2463
- while (1) switch (_context3.prev = _context3.next) {
2560
+ var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(name, hex) {
2561
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
2562
+ while (1) switch (_context4.prev = _context4.next) {
2464
2563
  case 0:
2465
- _context3.next = 2;
2564
+ _context4.next = 2;
2466
2565
  return apiService().post("/WhiteLabel/SetFieldValue", {
2467
2566
  id: dnsField.id,
2468
2567
  fieldId: dnsField.fieldId,
@@ -2472,19 +2571,19 @@ function OEMEditor(_ref) {
2472
2571
  notification(dnsField.name + " Saved");
2473
2572
  case 3:
2474
2573
  case "end":
2475
- return _context3.stop();
2574
+ return _context4.stop();
2476
2575
  }
2477
- }, _callee3);
2576
+ }, _callee4);
2478
2577
  }));
2479
2578
  return function (_x2, _x3) {
2480
- return _ref4.apply(this, arguments);
2579
+ return _ref5.apply(this, arguments);
2481
2580
  };
2482
2581
  }()
2483
2582
  }))));
2484
- })), value == 1 && /*#__PURE__*/_react["default"].createElement(_Box["default"], {
2583
+ }))), value == 1 && /*#__PURE__*/_react["default"].createElement(_Box["default"], {
2485
2584
  value: value,
2486
2585
  index: 1
2487
- }, /*#__PURE__*/_react["default"].createElement(_material.Grid, {
2586
+ }, data != null && /*#__PURE__*/_react["default"].createElement(_Box["default"], null, /*#__PURE__*/_react["default"].createElement(_material.Grid, {
2488
2587
  container: true,
2489
2588
  spacing: 2
2490
2589
  }, /*#__PURE__*/_react["default"].createElement(_material.Grid, {
@@ -2506,33 +2605,32 @@ function OEMEditor(_ref) {
2506
2605
  // rowSelectionModel={selectedFont}
2507
2606
  ,
2508
2607
  onRowClick: /*#__PURE__*/function () {
2509
- var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(params) {
2510
- var baseUri, response;
2511
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
2512
- while (1) switch (_context4.prev = _context4.next) {
2608
+ var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(params) {
2609
+ var response;
2610
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
2611
+ while (1) switch (_context5.prev = _context5.next) {
2513
2612
  case 0:
2514
- baseUri = GetBaseUrl();
2515
- _context4.next = 3;
2613
+ _context5.next = 2;
2516
2614
  return apiService().post("/WhiteLabel/SetFont", {
2517
2615
  companyId: companyId,
2518
- domain: baseUri,
2616
+ domain: oEMDomain,
2519
2617
  value: params.row.label
2520
2618
  });
2521
- case 3:
2522
- response = _context4.sent;
2619
+ case 2:
2620
+ response = _context5.sent;
2523
2621
  if (response != null && response.status == 200) {
2524
2622
  setSelectedFont(params.row.label);
2525
2623
  setFontUri(null);
2526
2624
  notification("Font saved!");
2527
2625
  }
2528
- case 5:
2626
+ case 4:
2529
2627
  case "end":
2530
- return _context4.stop();
2628
+ return _context5.stop();
2531
2629
  }
2532
- }, _callee4);
2630
+ }, _callee5);
2533
2631
  }));
2534
2632
  return function (_x4) {
2535
- return _ref5.apply(this, arguments);
2633
+ return _ref6.apply(this, arguments);
2536
2634
  };
2537
2635
  }()
2538
2636
  }))), /*#__PURE__*/_react["default"].createElement(_material.Grid, {
@@ -2575,7 +2673,7 @@ function OEMEditor(_ref) {
2575
2673
  sx: {
2576
2674
  fontFamily: selectedFont
2577
2675
  }
2578
- }, "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"], {
2676
+ }, "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"], {
2579
2677
  value: value,
2580
2678
  index: 2
2581
2679
  }, /*#__PURE__*/_react["default"].createElement(_material.Grid, {
@@ -2600,28 +2698,27 @@ function OEMEditor(_ref) {
2600
2698
  marginTop: 4
2601
2699
  },
2602
2700
  variant: "contained",
2603
- onClick: /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
2604
- var baseUri, response;
2605
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
2606
- while (1) switch (_context5.prev = _context5.next) {
2701
+ onClick: /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
2702
+ var response;
2703
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
2704
+ while (1) switch (_context6.prev = _context6.next) {
2607
2705
  case 0:
2608
- baseUri = GetBaseUrl();
2609
- _context5.next = 3;
2706
+ _context6.next = 2;
2610
2707
  return apiService().post("/WhiteLabel/SetGlobalCSS", {
2611
2708
  companyId: companyId,
2612
- domain: baseUri,
2709
+ domain: oEMDomain,
2613
2710
  value: cssEditorRef.current.getValue()
2614
2711
  });
2615
- case 3:
2616
- response = _context5.sent;
2712
+ case 2:
2713
+ response = _context6.sent;
2617
2714
  if (response != null && response.status == 200) {
2618
2715
  notification("CSS Saved!");
2619
2716
  }
2620
- case 5:
2717
+ case 4:
2621
2718
  case "end":
2622
- return _context5.stop();
2719
+ return _context6.stop();
2623
2720
  }
2624
- }, _callee5);
2721
+ }, _callee6);
2625
2722
  }))
2626
2723
  }, "Save Changes"))), /*#__PURE__*/_react["default"].createElement(_Box["default"], {
2627
2724
  sx: {
@@ -2632,8 +2729,8 @@ function OEMEditor(_ref) {
2632
2729
  onMount: handleCSSEditorDidMount,
2633
2730
  defaultLanguage: "css",
2634
2731
  theme: "vs-dark",
2635
- defaultValue: data.prettyCSS == null ? "" : data.prettyCSS
2636
- }), data.prettyCSS)), value == 3 && /*#__PURE__*/_react["default"].createElement(_Box["default"], {
2732
+ defaultValue: data == null || data.prettyCSS == null ? "" : data.prettyCSS
2733
+ }))), value == 3 && /*#__PURE__*/_react["default"].createElement(_Box["default"], {
2637
2734
  value: value,
2638
2735
  index: 3
2639
2736
  }, /*#__PURE__*/_react["default"].createElement(_material.Grid, {
@@ -2658,39 +2755,38 @@ function OEMEditor(_ref) {
2658
2755
  marginTop: 4
2659
2756
  },
2660
2757
  variant: "contained",
2661
- onClick: /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
2662
- var baseUri, response;
2663
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
2664
- while (1) switch (_context6.prev = _context6.next) {
2758
+ onClick: /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
2759
+ var response;
2760
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
2761
+ while (1) switch (_context7.prev = _context7.next) {
2665
2762
  case 0:
2666
- baseUri = GetBaseUrl();
2667
- _context6.next = 3;
2763
+ _context7.next = 2;
2668
2764
  return apiService().post("/WhiteLabel/SetGlobalHTML", {
2669
2765
  companyId: companyId,
2670
- domain: baseUri,
2766
+ domain: oEMDomain,
2671
2767
  value: htmlEditorRef.current.getValue()
2672
2768
  });
2673
- case 3:
2674
- response = _context6.sent;
2769
+ case 2:
2770
+ response = _context7.sent;
2675
2771
  if (response != null && response.status == 200) {
2676
2772
  notification("HTML saved!");
2677
2773
  }
2678
- case 5:
2774
+ case 4:
2679
2775
  case "end":
2680
- return _context6.stop();
2776
+ return _context7.stop();
2681
2777
  }
2682
- }, _callee6);
2778
+ }, _callee7);
2683
2779
  }))
2684
2780
  }, "Save Changes"))), /*#__PURE__*/_react["default"].createElement(_Box["default"], {
2685
2781
  sx: {
2686
2782
  paddingTop: 1
2687
2783
  }
2688
- }, /*#__PURE__*/_react["default"].createElement(_react2["default"], {
2784
+ }, data != null && /*#__PURE__*/_react["default"].createElement(_react2["default"], {
2689
2785
  height: "70vh",
2690
2786
  onMount: handleHtmlEditorDidMount,
2691
2787
  defaultLanguage: "html",
2692
2788
  theme: "vs-dark",
2693
- defaultValue: data.prettyHTML == null ? "" : data.prettyHTML
2789
+ defaultValue: data == null || data.prettyHTML == null ? "" : data.prettyHTML
2694
2790
  })))))));
2695
2791
  }
2696
2792
  "use strict";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "authscape",
3
- "version": "1.0.336",
3
+ "version": "1.0.340",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -10,8 +10,15 @@ import { Grid } from "@mui/material";
10
10
  import { DataGrid } from "@mui/x-data-grid";
11
11
  import PublishRoundedIcon from '@mui/icons-material/PublishRounded';
12
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';
13
17
 
14
- export function OEMEditor({loadedUser, notification, companyId = null}) {
18
+ // remove after NPM
19
+ // import {FileUploader, apiService, ColorPicker} from 'authscape';
20
+
21
+ export function OEMEditor({loadedUser, notification, showAllDomains = false, companyId = null}) {
15
22
 
16
23
  const monaco = useMonaco();
17
24
 
@@ -21,10 +28,13 @@ export function OEMEditor({loadedUser, notification, companyId = null}) {
21
28
  const [data, setData] = useState('');
22
29
  const [value, setValue] = useState(0);
23
30
  const [fonts, setFonts] = useState([]);
31
+ const [oEMDomainList, setOEMDomainList] = useState([]);
24
32
  const [dnsFields, setDnsFields] = useState([]);
25
33
  const [selectedFont, setSelectedFont] = useState(null);
26
34
  const [fontUri, setFontUri] = useState(null);
27
35
 
36
+ const [oEMDomain, setOEMDomain] = useState(null);
37
+
28
38
  const [stateBaseUri, setBaseUri] = useState('');
29
39
 
30
40
  const handleChange = (event, newValue) => {
@@ -35,6 +45,35 @@ export function OEMEditor({loadedUser, notification, companyId = null}) {
35
45
  return window.location.protocol + "//" + window.location.host;
36
46
  }
37
47
 
48
+ const loadDNSFields = async (_domain = null) => {
49
+
50
+ var domain = null;
51
+ if (_domain != null)
52
+ {
53
+ domain = _domain;
54
+ }
55
+ else
56
+ {
57
+ domain = GetBaseUrl();
58
+ }
59
+
60
+ let responseFields = await apiService().get("/WhiteLabel/GetFields?domain=" + domain + (companyId != null ? ("&companyId=" + companyId) : ""));
61
+ if (responseFields != null && responseFields.status == 200)
62
+ {
63
+ setDnsFields(responseFields.data);
64
+ }
65
+ }
66
+
67
+ useEffect(() => {
68
+
69
+ // if (oEMDomain != null)
70
+ // {
71
+ loadDNSFields(oEMDomain);
72
+ // }
73
+
74
+ }, [oEMDomain]);
75
+
76
+
38
77
  useEffect(() => {
39
78
 
40
79
  if (loadedUser)
@@ -47,11 +86,33 @@ export function OEMEditor({loadedUser, notification, companyId = null}) {
47
86
  setFonts(response.data);
48
87
  }
49
88
 
50
- var domain = GetBaseUrl();
51
- let responseFields = await apiService().get("/WhiteLabel/GetFields?domain=" + domain + (companyId != null ? ("&companyId=" + companyId) : ""));
52
- if (responseFields != null && responseFields.status == 200)
89
+ await loadDNSFields();
90
+
91
+ if (showAllDomains)
53
92
  {
54
- setDnsFields(responseFields.data);
93
+ let response = await apiService().get("/WhiteLabel/GetAllDomains");
94
+ if (response != null && response.status == 200)
95
+ {
96
+ setOEMDomainList(response.data);
97
+
98
+ if (response.data.length > 0)
99
+ {
100
+ setOEMDomain(response.data[0].name);
101
+ }
102
+ }
103
+ }
104
+ else
105
+ {
106
+ let response = await apiService().get("/WhiteLabel/GetAllDomainsUser");
107
+ if (response != null && response.status == 200)
108
+ {
109
+ setOEMDomainList(response.data);
110
+
111
+ if (response.data.length > 0)
112
+ {
113
+ setOEMDomain(response.data[0].name);
114
+ }
115
+ }
55
116
  }
56
117
 
57
118
  }
@@ -105,10 +166,9 @@ export function OEMEditor({loadedUser, notification, companyId = null}) {
105
166
  // //console.log("here is the monaco instance:", monaco);
106
167
  // }
107
168
 
108
- var baseUri = GetBaseUrl();
109
- setBaseUri(baseUri);
169
+ setData(null);
110
170
 
111
- let response = await apiService().get("/WhiteLabel/GetEditorData?domain=" + baseUri + (companyId != null ? ("&companyId=" + companyId) : ""));
171
+ let response = await apiService().get("/WhiteLabel/GetEditorData?domain=" + oEMDomain + (companyId != null ? ("&companyId=" + companyId) : ""));
112
172
  if (response.status == 200)
113
173
  {
114
174
  setData(response.data);
@@ -118,7 +178,7 @@ export function OEMEditor({loadedUser, notification, companyId = null}) {
118
178
  }
119
179
  fetchData();
120
180
 
121
- }, [monaco]);
181
+ }, [monaco, oEMDomain]);
122
182
 
123
183
  return (
124
184
  <>
@@ -127,8 +187,30 @@ export function OEMEditor({loadedUser, notification, companyId = null}) {
127
187
  {(selectedFont != null && fontUri == null) &&
128
188
  <link href={"https://fonts.googleapis.com/css2?family=" + selectedFont} rel="stylesheet"></link>
129
189
  }
190
+
191
+ <Box sx={{paddingTop:6}}>
192
+ {oEMDomain != null &&
193
+ <FormControl fullWidth>
194
+ <InputLabel id="demo-simple-select-label">Website Domain</InputLabel>
195
+ <Select
196
+ labelId="demo-simple-select-label"
197
+ id="demo-simple-select"
198
+ defaultValue={oEMDomain}
199
+ label="Website Domain"
200
+ onChange={(val) => {
201
+ setOEMDomain(val.target.value)
202
+ }}>
203
+ {oEMDomainList.map((dns) => {
204
+ return (
205
+ <MenuItem value={dns.name}>{dns.name}</MenuItem>
206
+ )
207
+ })}
208
+ </Select>
209
+ </FormControl>
210
+ }
211
+ </Box>
130
212
 
131
- <Box sx={{ borderBottom: 1, borderColor: 'divider' }}>
213
+ <Box sx={{ borderBottom: 1, borderColor: 'divider', paddingTop:2 }}>
132
214
  <Tabs value={value} onChange={handleChange} aria-label="basic tabs example">
133
215
  <Tab label="General" />
134
216
  <Tab label="Fonts" />
@@ -141,134 +223,132 @@ export function OEMEditor({loadedUser, notification, companyId = null}) {
141
223
  <Box sx={{padding:2}}>
142
224
  {value == 0 &&
143
225
  <Box>
144
-
145
- <Box sx={{paddingBottom:4}}>
146
-
147
- {data.appIconUrl == null &&
148
- <Image src={"/DefaultNoImage.svg"} width={200} height={200} />
149
- }
226
+ {data != null &&
227
+ <Box>
228
+ <Box sx={{paddingBottom:4}}>
150
229
 
151
- {data.appIconUrl != null &&
152
- <Image src={data.appIconUrl} width={200} height={200} />
153
- }
154
-
155
- <FileUploader url={"/WhiteLabel/UploadAppIcon"} accept={".jpg,.jpeg,.png,.gif"} params={{
156
- domain: stateBaseUri
157
- }} multiple={true} variant='custom' onUploadCompleted={() => {
158
- window.location.reload();
159
- }}>
160
-
161
- <Button color="primary" variant="contained" startIcon={<PublishRoundedIcon/>}>Upload App Icon</Button>
162
-
163
- </FileUploader>
164
-
165
- </Box>
166
-
167
-
230
+ {(data != null && data.appIconUrl != null && data.appIconUrl.trim() != "") ?
231
+ <Image src={data.appIconUrl} width={200} height={200} /> : <Image src={"/DefaultNoImage.svg"} width={200} height={200} />
232
+ }
168
233
 
169
- {dnsFields != null && dnsFields.map((dnsField, index) => {
170
-
171
- return (
172
- <Box key={index}>
173
- <Grid container spacing={2}>
174
- <Grid item xs={3}>
175
- {dnsField.name}
176
- </Grid>
177
- <Grid item xs={9}>
234
+ <FileUploader url={"/WhiteLabel/UploadAppIcon"} accept={".jpg,.jpeg,.png,.gif"} params={{
235
+ domain: stateBaseUri
236
+ }} multiple={true} variant='custom' onUploadCompleted={() => {
237
+ window.location.reload();
238
+ }}>
178
239
 
179
- <ColorPicker name={dnsField.name} defaultColor={dnsField.value} onColorChanged={async (name, hex) => {
240
+ <Button color="primary" variant="contained" startIcon={<PublishRoundedIcon/>}>Upload App Icon</Button>
180
241
 
181
- await apiService().post("/WhiteLabel/SetFieldValue", {
182
- id: dnsField.id,
183
- fieldId: dnsField.fieldId,
184
- value: hex
185
- });
242
+ </FileUploader>
186
243
 
187
- notification(dnsField.name + " Saved");
244
+ </Box>
188
245
 
189
- }} />
246
+ {dnsFields != null && dnsFields.map((dnsField, index) => {
247
+
248
+ return (
249
+ <Box key={index}>
250
+ <Grid container spacing={2}>
251
+ <Grid item xs={3}>
252
+ {dnsField.name}
253
+ </Grid>
254
+ <Grid item xs={9}>
255
+
256
+ <ColorPicker name={dnsField.name} defaultColor={dnsField.value} onColorChanged={async (name, hex) => {
257
+
258
+ await apiService().post("/WhiteLabel/SetFieldValue", {
259
+ id: dnsField.id,
260
+ fieldId: dnsField.fieldId,
261
+ value: hex
262
+ });
263
+
264
+ notification(dnsField.name + " Saved");
265
+
266
+ }} />
267
+ </Grid>
190
268
  </Grid>
191
- </Grid>
192
- </Box>
193
- )
269
+ </Box>
270
+ )
194
271
 
195
-
272
+
196
273
 
197
- })}
274
+ })}
275
+ </Box>
276
+ }
198
277
  </Box>
199
278
  }
200
279
 
201
280
  {value == 1 &&
202
281
  <Box value={value} index={1}>
282
+ {data != null &&
283
+ <Box>
284
+ <Grid container spacing={2}>
285
+ <Grid item xs={6}>
286
+
287
+ {loadedUser == true &&
288
+
289
+ <Box>
290
+ <DataGrid
291
+ rows={fonts}
292
+ columns={columns}
293
+ sx={{height:"80vh", width:"100%"}}
294
+ pagination
295
+ disableSelectionOnClick={true}
296
+ onPaginationModelChange={setPaginationModel}
297
+ paginationModel={paginationModel}
298
+ //pageSizeOptions={[5]}
299
+ // rowCount={100}
300
+ // rowSelectionModel={selectedFont}
301
+ onRowClick={async (params) => {
302
+
303
+ let response = await apiService().post("/WhiteLabel/SetFont", {
304
+ companyId: companyId,
305
+ domain: oEMDomain,
306
+ value: params.row.label
307
+ });
308
+ if (response != null && response.status == 200)
309
+ {
310
+ setSelectedFont(params.row.label);
311
+ setFontUri(null);
312
+ notification("Font saved!");
313
+ }
314
+ }}
315
+ />
316
+ </Box>
317
+ }
203
318
 
204
- <Grid container spacing={2}>
205
- <Grid item xs={6}>
206
-
207
- {loadedUser == true &&
208
-
209
- <Box>
210
- <DataGrid
211
- rows={fonts}
212
- columns={columns}
213
- sx={{height:"80vh", width:"100%"}}
214
- pagination
215
- disableSelectionOnClick={true}
216
- onPaginationModelChange={setPaginationModel}
217
- paginationModel={paginationModel}
218
- //pageSizeOptions={[5]}
219
- // rowCount={100}
220
- // rowSelectionModel={selectedFont}
221
- onRowClick={async (params) => {
222
-
223
- var baseUri = GetBaseUrl();
224
- let response = await apiService().post("/WhiteLabel/SetFont", {
225
- companyId: companyId,
226
- domain: baseUri,
227
- value: params.row.label
228
- });
229
- if (response != null && response.status == 200)
230
- {
231
- setSelectedFont(params.row.label);
232
- setFontUri(null);
233
- notification("Font saved!");
234
- }
235
- }}
236
- />
237
- </Box>
238
- }
239
-
240
-
241
- </Grid>
242
- <Grid item xs={6} >
243
-
244
- <FileUploader url={"/WhiteLabel/UploadCustomFont"} accept={".otf,.ttf,.woff"} params={{
245
- domain: stateBaseUri
246
- }} multiple={true} variant='custom' onUploadCompleted={() => {
247
- window.location.reload();
248
- }}>
249
-
250
- <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>
251
-
252
- </FileUploader>
253
-
254
-
255
- <Box sx={{marginTop:4}}>Font Selected:</Box>
256
- <Box sx={{marginBottom:2, fontWeight:"bold", fontSize:20}}> {selectedFont}</Box>
257
- <hr />
258
- <Box sx={{fontFamily: selectedFont}}>
259
- Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed ut ultricies odio. Nunc ut quam turpis. In hac habitasse platea dictumst.
260
- Suspendisse potenti. Nullam malesuada, purus id sagittis vestibulum, massa tellus gravida elit, vitae ultrices tortor nulla ac nunc.
261
- Aenean tempus semper est vel convallis. Sed feugiat, risus eu tincidunt eleifend, purus metus vulputate nulla, et condimentum sapien erat in nisi.
262
- Nunc non malesuada libero. Donec tempus tincidunt mi at vulputate. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae;
263
- Suspendisse potenti. Etiam nec eleifend orci. Suspendisse in est vel nunc rhoncus bibendum vitae id felis.
264
- 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.
265
- Aliquam erat volutpat. Quisque dignissim felis augue, at semper nisl posuere ut. Proin fringilla diam vitae faucibus finibus.
266
- <br/><br/>
267
- 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
319
+
320
+ </Grid>
321
+ <Grid item xs={6} >
322
+
323
+ <FileUploader url={"/WhiteLabel/UploadCustomFont"} accept={".otf,.ttf,.woff"} params={{
324
+ domain: stateBaseUri
325
+ }} multiple={true} variant='custom' onUploadCompleted={() => {
326
+ window.location.reload();
327
+ }}>
328
+
329
+ <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>
330
+
331
+ </FileUploader>
332
+
333
+
334
+ <Box sx={{marginTop:4}}>Font Selected:</Box>
335
+ <Box sx={{marginBottom:2, fontWeight:"bold", fontSize:20}}> {selectedFont}</Box>
336
+ <hr />
337
+ <Box sx={{fontFamily: selectedFont}}>
338
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed ut ultricies odio. Nunc ut quam turpis. In hac habitasse platea dictumst.
339
+ Suspendisse potenti. Nullam malesuada, purus id sagittis vestibulum, massa tellus gravida elit, vitae ultrices tortor nulla ac nunc.
340
+ Aenean tempus semper est vel convallis. Sed feugiat, risus eu tincidunt eleifend, purus metus vulputate nulla, et condimentum sapien erat in nisi.
341
+ Nunc non malesuada libero. Donec tempus tincidunt mi at vulputate. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae;
342
+ Suspendisse potenti. Etiam nec eleifend orci. Suspendisse in est vel nunc rhoncus bibendum vitae id felis.
343
+ 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.
344
+ Aliquam erat volutpat. Quisque dignissim felis augue, at semper nisl posuere ut. Proin fringilla diam vitae faucibus finibus.
345
+ <br/><br/>
346
+ 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
347
+ </Box>
348
+ </Grid>
349
+ </Grid>
268
350
  </Box>
269
- </Grid>
270
- </Grid>
271
-
351
+ }
272
352
  </Box>
273
353
  }
274
354
 
@@ -283,10 +363,9 @@ export function OEMEditor({loadedUser, notification, companyId = null}) {
283
363
  <Grid item xs={6} sx={{textAlign:"right"}}>
284
364
  <Button startIcon={<CheckIcon/>} sx={{marginTop:4}} variant="contained" onClick={async () => {
285
365
 
286
- var baseUri = GetBaseUrl();
287
366
  let response = await apiService().post("/WhiteLabel/SetGlobalCSS", {
288
367
  companyId: companyId,
289
- domain: baseUri,
368
+ domain: oEMDomain,
290
369
  value: cssEditorRef.current.getValue()
291
370
  });
292
371
  if (response != null && response.status == 200)
@@ -306,10 +385,9 @@ export function OEMEditor({loadedUser, notification, companyId = null}) {
306
385
  onMount={handleCSSEditorDidMount}
307
386
  defaultLanguage="css"
308
387
  theme="vs-dark"
309
- defaultValue={data.prettyCSS == null ? "" : data.prettyCSS}
388
+ defaultValue={(data == null || data.prettyCSS == null) ? "" : data.prettyCSS}
310
389
  />
311
390
  }
312
- {data.prettyCSS}
313
391
  </Box>
314
392
 
315
393
  </Box>
@@ -327,10 +405,9 @@ export function OEMEditor({loadedUser, notification, companyId = null}) {
327
405
  <Grid item xs={6} sx={{textAlign:"right"}}>
328
406
  <Button startIcon={<CheckIcon/>} sx={{marginTop:4}} variant="contained" onClick={async () => {
329
407
 
330
- var baseUri = GetBaseUrl();
331
408
  let response = await apiService().post("/WhiteLabel/SetGlobalHTML", {
332
409
  companyId: companyId,
333
- domain: baseUri,
410
+ domain: oEMDomain,
334
411
  value: htmlEditorRef.current.getValue()
335
412
  });
336
413
 
@@ -344,13 +421,15 @@ export function OEMEditor({loadedUser, notification, companyId = null}) {
344
421
  </Grid>
345
422
 
346
423
  <Box sx={{paddingTop:1}}>
347
- <Editor
348
- height="70vh"
349
- onMount={handleHtmlEditorDidMount}
350
- defaultLanguage="html"
351
- theme="vs-dark"
352
- defaultValue={data.prettyHTML == null ? "" : data.prettyHTML}
353
- />
424
+ {data != null &&
425
+ <Editor
426
+ height="70vh"
427
+ onMount={handleHtmlEditorDidMount}
428
+ defaultLanguage="html"
429
+ theme="vs-dark"
430
+ defaultValue={(data == null || data.prettyHTML == null) ? "" : data.prettyHTML}
431
+ />
432
+ }
354
433
  </Box>
355
434
 
356
435