authscape 1.0.334 → 1.0.338
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 +270 -155
- package/package.json +1 -1
- package/src/components/OEMEditor.js +209 -135
- package/src/components/stripe/StripePayment.js +31 -14
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,123 @@ function OEMEditor(_ref) {
|
|
|
2262
2271
|
setFonts = _useState6[1];
|
|
2263
2272
|
var _useState7 = (0, _react.useState)([]),
|
|
2264
2273
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
var _useState9 = (0, _react.useState)(
|
|
2274
|
+
oEMDomainList = _useState8[0],
|
|
2275
|
+
setOEMDomainList = _useState8[1];
|
|
2276
|
+
var _useState9 = (0, _react.useState)([]),
|
|
2268
2277
|
_useState10 = _slicedToArray(_useState9, 2),
|
|
2269
|
-
|
|
2270
|
-
|
|
2278
|
+
dnsFields = _useState10[0],
|
|
2279
|
+
setDnsFields = _useState10[1];
|
|
2271
2280
|
var _useState11 = (0, _react.useState)(null),
|
|
2272
2281
|
_useState12 = _slicedToArray(_useState11, 2),
|
|
2273
|
-
|
|
2274
|
-
|
|
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
|
-
|
|
2278
|
-
|
|
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
|
|
2289
|
-
var response,
|
|
2290
|
-
return _regeneratorRuntime().wrap(function
|
|
2291
|
-
while (1) switch (
|
|
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
|
-
|
|
2349
|
+
_context2.next = 2;
|
|
2294
2350
|
return apiService().get("/WhiteLabel/GetFonts");
|
|
2295
2351
|
case 2:
|
|
2296
|
-
response =
|
|
2352
|
+
response = _context2.sent;
|
|
2297
2353
|
if (response != null && response.status == 200) {
|
|
2298
2354
|
setFonts(response.data);
|
|
2299
2355
|
}
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
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
|
+
}
|
|
2370
|
+
_context2.next = 17;
|
|
2371
|
+
break;
|
|
2372
|
+
case 13:
|
|
2373
|
+
_context2.next = 15;
|
|
2374
|
+
return apiService().get("/WhiteLabel/GetAllDomainsUser");
|
|
2375
|
+
case 15:
|
|
2376
|
+
_response2 = _context2.sent;
|
|
2377
|
+
if (_response2 != null && _response2.status == 200) {
|
|
2378
|
+
setOEMDomainList(_response2.data);
|
|
2379
|
+
if (_response2.data.length > 0) {
|
|
2380
|
+
setOEMDomain(_response2.data[0].name);
|
|
2381
|
+
}
|
|
2382
|
+
}
|
|
2383
|
+
case 17:
|
|
2309
2384
|
case "end":
|
|
2310
|
-
return
|
|
2385
|
+
return _context2.stop();
|
|
2311
2386
|
}
|
|
2312
|
-
},
|
|
2387
|
+
}, _callee2);
|
|
2313
2388
|
}));
|
|
2314
2389
|
return function fetchData() {
|
|
2315
|
-
return
|
|
2390
|
+
return _ref3.apply(this, arguments);
|
|
2316
2391
|
};
|
|
2317
2392
|
}();
|
|
2318
2393
|
fetchData();
|
|
@@ -2356,37 +2431,37 @@ function OEMEditor(_ref) {
|
|
|
2356
2431
|
}];
|
|
2357
2432
|
(0, _react.useEffect)(function () {
|
|
2358
2433
|
var fetchData = /*#__PURE__*/function () {
|
|
2359
|
-
var
|
|
2360
|
-
var
|
|
2361
|
-
return _regeneratorRuntime().wrap(function
|
|
2362
|
-
while (1) switch (
|
|
2434
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
2435
|
+
var response;
|
|
2436
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
2437
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
2363
2438
|
case 0:
|
|
2364
2439
|
// if (monaco) {
|
|
2365
2440
|
// //console.log("here is the monaco instance:", monaco);
|
|
2366
2441
|
// }
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
return apiService().get("/WhiteLabel/GetEditorData?domain=" +
|
|
2371
|
-
case
|
|
2372
|
-
response =
|
|
2442
|
+
|
|
2443
|
+
setData(null);
|
|
2444
|
+
_context3.next = 3;
|
|
2445
|
+
return apiService().get("/WhiteLabel/GetEditorData?domain=" + oEMDomain + (companyId != null ? "&companyId=" + companyId : ""));
|
|
2446
|
+
case 3:
|
|
2447
|
+
response = _context3.sent;
|
|
2373
2448
|
if (response.status == 200) {
|
|
2374
2449
|
setData(response.data);
|
|
2375
2450
|
setSelectedFont(response.data.fontFamily);
|
|
2376
2451
|
setFontUri(response.data.fontUrl);
|
|
2377
2452
|
}
|
|
2378
|
-
case
|
|
2453
|
+
case 5:
|
|
2379
2454
|
case "end":
|
|
2380
|
-
return
|
|
2455
|
+
return _context3.stop();
|
|
2381
2456
|
}
|
|
2382
|
-
},
|
|
2457
|
+
}, _callee3);
|
|
2383
2458
|
}));
|
|
2384
2459
|
return function fetchData() {
|
|
2385
|
-
return
|
|
2460
|
+
return _ref4.apply(this, arguments);
|
|
2386
2461
|
};
|
|
2387
2462
|
}();
|
|
2388
2463
|
fetchData();
|
|
2389
|
-
}, [monaco]);
|
|
2464
|
+
}, [monaco, oEMDomain]);
|
|
2390
2465
|
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_Box["default"], {
|
|
2391
2466
|
sx: {
|
|
2392
2467
|
width: '100%'
|
|
@@ -2394,10 +2469,31 @@ function OEMEditor(_ref) {
|
|
|
2394
2469
|
}, selectedFont != null && fontUri == null && /*#__PURE__*/_react["default"].createElement("link", {
|
|
2395
2470
|
href: "https://fonts.googleapis.com/css2?family=" + selectedFont,
|
|
2396
2471
|
rel: "stylesheet"
|
|
2397
|
-
}), /*#__PURE__*/_react["default"].createElement(_Box["default"], {
|
|
2472
|
+
}), oEMDomain != null && /*#__PURE__*/_react["default"].createElement(_Box["default"], {
|
|
2473
|
+
sx: {
|
|
2474
|
+
paddingTop: 6
|
|
2475
|
+
}
|
|
2476
|
+
}, /*#__PURE__*/_react["default"].createElement(_FormControl["default"], {
|
|
2477
|
+
fullWidth: true
|
|
2478
|
+
}, /*#__PURE__*/_react["default"].createElement(_InputLabel["default"], {
|
|
2479
|
+
id: "demo-simple-select-label"
|
|
2480
|
+
}, "Website Domain"), /*#__PURE__*/_react["default"].createElement(_Select["default"], {
|
|
2481
|
+
labelId: "demo-simple-select-label",
|
|
2482
|
+
id: "demo-simple-select",
|
|
2483
|
+
defaultValue: oEMDomain,
|
|
2484
|
+
label: "Website Domain",
|
|
2485
|
+
onChange: function onChange(val) {
|
|
2486
|
+
setOEMDomain(val.target.value);
|
|
2487
|
+
}
|
|
2488
|
+
}, oEMDomainList.map(function (dns) {
|
|
2489
|
+
return /*#__PURE__*/_react["default"].createElement(_MenuItem["default"], {
|
|
2490
|
+
value: dns.name
|
|
2491
|
+
}, dns.name);
|
|
2492
|
+
})))), /*#__PURE__*/_react["default"].createElement(_Box["default"], {
|
|
2398
2493
|
sx: {
|
|
2399
2494
|
borderBottom: 1,
|
|
2400
|
-
borderColor: 'divider'
|
|
2495
|
+
borderColor: 'divider',
|
|
2496
|
+
paddingTop: 2
|
|
2401
2497
|
}
|
|
2402
2498
|
}, /*#__PURE__*/_react["default"].createElement(_Tabs["default"], {
|
|
2403
2499
|
value: value,
|
|
@@ -2415,16 +2511,16 @@ function OEMEditor(_ref) {
|
|
|
2415
2511
|
sx: {
|
|
2416
2512
|
padding: 2
|
|
2417
2513
|
}
|
|
2418
|
-
}, value == 0 && /*#__PURE__*/_react["default"].createElement(_Box["default"], null, /*#__PURE__*/_react["default"].createElement(_Box["default"], {
|
|
2514
|
+
}, 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
2515
|
sx: {
|
|
2420
2516
|
paddingBottom: 4
|
|
2421
2517
|
}
|
|
2422
|
-
}, data.appIconUrl
|
|
2423
|
-
src:
|
|
2518
|
+
}, data != null && data.appIconUrl != null && data.appIconUrl.trim() != "" ? /*#__PURE__*/_react["default"].createElement(_image["default"], {
|
|
2519
|
+
src: data.appIconUrl,
|
|
2424
2520
|
width: 200,
|
|
2425
2521
|
height: 200
|
|
2426
|
-
})
|
|
2427
|
-
src:
|
|
2522
|
+
}) : /*#__PURE__*/_react["default"].createElement(_image["default"], {
|
|
2523
|
+
src: "/DefaultNoImage.svg",
|
|
2428
2524
|
width: 200,
|
|
2429
2525
|
height: 200
|
|
2430
2526
|
}), /*#__PURE__*/_react["default"].createElement(FileUploader, {
|
|
@@ -2458,11 +2554,11 @@ function OEMEditor(_ref) {
|
|
|
2458
2554
|
name: dnsField.name,
|
|
2459
2555
|
defaultColor: dnsField.value,
|
|
2460
2556
|
onColorChanged: /*#__PURE__*/function () {
|
|
2461
|
-
var
|
|
2462
|
-
return _regeneratorRuntime().wrap(function
|
|
2463
|
-
while (1) switch (
|
|
2557
|
+
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(name, hex) {
|
|
2558
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
2559
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
2464
2560
|
case 0:
|
|
2465
|
-
|
|
2561
|
+
_context4.next = 2;
|
|
2466
2562
|
return apiService().post("/WhiteLabel/SetFieldValue", {
|
|
2467
2563
|
id: dnsField.id,
|
|
2468
2564
|
fieldId: dnsField.fieldId,
|
|
@@ -2472,19 +2568,19 @@ function OEMEditor(_ref) {
|
|
|
2472
2568
|
notification(dnsField.name + " Saved");
|
|
2473
2569
|
case 3:
|
|
2474
2570
|
case "end":
|
|
2475
|
-
return
|
|
2571
|
+
return _context4.stop();
|
|
2476
2572
|
}
|
|
2477
|
-
},
|
|
2573
|
+
}, _callee4);
|
|
2478
2574
|
}));
|
|
2479
2575
|
return function (_x2, _x3) {
|
|
2480
|
-
return
|
|
2576
|
+
return _ref5.apply(this, arguments);
|
|
2481
2577
|
};
|
|
2482
2578
|
}()
|
|
2483
2579
|
}))));
|
|
2484
|
-
})), value == 1 && /*#__PURE__*/_react["default"].createElement(_Box["default"], {
|
|
2580
|
+
}))), value == 1 && /*#__PURE__*/_react["default"].createElement(_Box["default"], {
|
|
2485
2581
|
value: value,
|
|
2486
2582
|
index: 1
|
|
2487
|
-
}, /*#__PURE__*/_react["default"].createElement(_material.Grid, {
|
|
2583
|
+
}, data != null && /*#__PURE__*/_react["default"].createElement(_Box["default"], null, /*#__PURE__*/_react["default"].createElement(_material.Grid, {
|
|
2488
2584
|
container: true,
|
|
2489
2585
|
spacing: 2
|
|
2490
2586
|
}, /*#__PURE__*/_react["default"].createElement(_material.Grid, {
|
|
@@ -2506,33 +2602,32 @@ function OEMEditor(_ref) {
|
|
|
2506
2602
|
// rowSelectionModel={selectedFont}
|
|
2507
2603
|
,
|
|
2508
2604
|
onRowClick: /*#__PURE__*/function () {
|
|
2509
|
-
var
|
|
2510
|
-
var
|
|
2511
|
-
return _regeneratorRuntime().wrap(function
|
|
2512
|
-
while (1) switch (
|
|
2605
|
+
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(params) {
|
|
2606
|
+
var response;
|
|
2607
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
2608
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
2513
2609
|
case 0:
|
|
2514
|
-
|
|
2515
|
-
_context4.next = 3;
|
|
2610
|
+
_context5.next = 2;
|
|
2516
2611
|
return apiService().post("/WhiteLabel/SetFont", {
|
|
2517
2612
|
companyId: companyId,
|
|
2518
|
-
domain:
|
|
2613
|
+
domain: oEMDomain,
|
|
2519
2614
|
value: params.row.label
|
|
2520
2615
|
});
|
|
2521
|
-
case
|
|
2522
|
-
response =
|
|
2616
|
+
case 2:
|
|
2617
|
+
response = _context5.sent;
|
|
2523
2618
|
if (response != null && response.status == 200) {
|
|
2524
2619
|
setSelectedFont(params.row.label);
|
|
2525
2620
|
setFontUri(null);
|
|
2526
2621
|
notification("Font saved!");
|
|
2527
2622
|
}
|
|
2528
|
-
case
|
|
2623
|
+
case 4:
|
|
2529
2624
|
case "end":
|
|
2530
|
-
return
|
|
2625
|
+
return _context5.stop();
|
|
2531
2626
|
}
|
|
2532
|
-
},
|
|
2627
|
+
}, _callee5);
|
|
2533
2628
|
}));
|
|
2534
2629
|
return function (_x4) {
|
|
2535
|
-
return
|
|
2630
|
+
return _ref6.apply(this, arguments);
|
|
2536
2631
|
};
|
|
2537
2632
|
}()
|
|
2538
2633
|
}))), /*#__PURE__*/_react["default"].createElement(_material.Grid, {
|
|
@@ -2575,7 +2670,7 @@ function OEMEditor(_ref) {
|
|
|
2575
2670
|
sx: {
|
|
2576
2671
|
fontFamily: selectedFont
|
|
2577
2672
|
}
|
|
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"], {
|
|
2673
|
+
}, "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
2674
|
value: value,
|
|
2580
2675
|
index: 2
|
|
2581
2676
|
}, /*#__PURE__*/_react["default"].createElement(_material.Grid, {
|
|
@@ -2600,28 +2695,27 @@ function OEMEditor(_ref) {
|
|
|
2600
2695
|
marginTop: 4
|
|
2601
2696
|
},
|
|
2602
2697
|
variant: "contained",
|
|
2603
|
-
onClick: /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2604
|
-
var
|
|
2605
|
-
return _regeneratorRuntime().wrap(function
|
|
2606
|
-
while (1) switch (
|
|
2698
|
+
onClick: /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
2699
|
+
var response;
|
|
2700
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
2701
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
2607
2702
|
case 0:
|
|
2608
|
-
|
|
2609
|
-
_context5.next = 3;
|
|
2703
|
+
_context6.next = 2;
|
|
2610
2704
|
return apiService().post("/WhiteLabel/SetGlobalCSS", {
|
|
2611
2705
|
companyId: companyId,
|
|
2612
|
-
domain:
|
|
2706
|
+
domain: oEMDomain,
|
|
2613
2707
|
value: cssEditorRef.current.getValue()
|
|
2614
2708
|
});
|
|
2615
|
-
case
|
|
2616
|
-
response =
|
|
2709
|
+
case 2:
|
|
2710
|
+
response = _context6.sent;
|
|
2617
2711
|
if (response != null && response.status == 200) {
|
|
2618
2712
|
notification("CSS Saved!");
|
|
2619
2713
|
}
|
|
2620
|
-
case
|
|
2714
|
+
case 4:
|
|
2621
2715
|
case "end":
|
|
2622
|
-
return
|
|
2716
|
+
return _context6.stop();
|
|
2623
2717
|
}
|
|
2624
|
-
},
|
|
2718
|
+
}, _callee6);
|
|
2625
2719
|
}))
|
|
2626
2720
|
}, "Save Changes"))), /*#__PURE__*/_react["default"].createElement(_Box["default"], {
|
|
2627
2721
|
sx: {
|
|
@@ -2632,8 +2726,8 @@ function OEMEditor(_ref) {
|
|
|
2632
2726
|
onMount: handleCSSEditorDidMount,
|
|
2633
2727
|
defaultLanguage: "css",
|
|
2634
2728
|
theme: "vs-dark",
|
|
2635
|
-
defaultValue: data.prettyCSS == null ? "" : data.prettyCSS
|
|
2636
|
-
})
|
|
2729
|
+
defaultValue: data == null || data.prettyCSS == null ? "" : data.prettyCSS
|
|
2730
|
+
}))), value == 3 && /*#__PURE__*/_react["default"].createElement(_Box["default"], {
|
|
2637
2731
|
value: value,
|
|
2638
2732
|
index: 3
|
|
2639
2733
|
}, /*#__PURE__*/_react["default"].createElement(_material.Grid, {
|
|
@@ -2658,39 +2752,38 @@ function OEMEditor(_ref) {
|
|
|
2658
2752
|
marginTop: 4
|
|
2659
2753
|
},
|
|
2660
2754
|
variant: "contained",
|
|
2661
|
-
onClick: /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2662
|
-
var
|
|
2663
|
-
return _regeneratorRuntime().wrap(function
|
|
2664
|
-
while (1) switch (
|
|
2755
|
+
onClick: /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
|
|
2756
|
+
var response;
|
|
2757
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
2758
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
2665
2759
|
case 0:
|
|
2666
|
-
|
|
2667
|
-
_context6.next = 3;
|
|
2760
|
+
_context7.next = 2;
|
|
2668
2761
|
return apiService().post("/WhiteLabel/SetGlobalHTML", {
|
|
2669
2762
|
companyId: companyId,
|
|
2670
|
-
domain:
|
|
2763
|
+
domain: oEMDomain,
|
|
2671
2764
|
value: htmlEditorRef.current.getValue()
|
|
2672
2765
|
});
|
|
2673
|
-
case
|
|
2674
|
-
response =
|
|
2766
|
+
case 2:
|
|
2767
|
+
response = _context7.sent;
|
|
2675
2768
|
if (response != null && response.status == 200) {
|
|
2676
2769
|
notification("HTML saved!");
|
|
2677
2770
|
}
|
|
2678
|
-
case
|
|
2771
|
+
case 4:
|
|
2679
2772
|
case "end":
|
|
2680
|
-
return
|
|
2773
|
+
return _context7.stop();
|
|
2681
2774
|
}
|
|
2682
|
-
},
|
|
2775
|
+
}, _callee7);
|
|
2683
2776
|
}))
|
|
2684
2777
|
}, "Save Changes"))), /*#__PURE__*/_react["default"].createElement(_Box["default"], {
|
|
2685
2778
|
sx: {
|
|
2686
2779
|
paddingTop: 1
|
|
2687
2780
|
}
|
|
2688
|
-
}, /*#__PURE__*/_react["default"].createElement(_react2["default"], {
|
|
2781
|
+
}, data != null && /*#__PURE__*/_react["default"].createElement(_react2["default"], {
|
|
2689
2782
|
height: "70vh",
|
|
2690
2783
|
onMount: handleHtmlEditorDidMount,
|
|
2691
2784
|
defaultLanguage: "html",
|
|
2692
2785
|
theme: "vs-dark",
|
|
2693
|
-
defaultValue: data.prettyHTML == null ? "" : data.prettyHTML
|
|
2786
|
+
defaultValue: data == null || data.prettyHTML == null ? "" : data.prettyHTML
|
|
2694
2787
|
})))))));
|
|
2695
2788
|
}
|
|
2696
2789
|
"use strict";
|
|
@@ -2937,6 +3030,7 @@ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefine
|
|
|
2937
3030
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
2938
3031
|
var CheckoutForm = function CheckoutForm(_ref) {
|
|
2939
3032
|
var payButtonText = _ref.payButtonText,
|
|
3033
|
+
invoiceId = _ref.invoiceId,
|
|
2940
3034
|
clientSecret = _ref.clientSecret,
|
|
2941
3035
|
currentUser = _ref.currentUser,
|
|
2942
3036
|
paymentMethodType = _ref.paymentMethodType,
|
|
@@ -2955,7 +3049,7 @@ var CheckoutForm = function CheckoutForm(_ref) {
|
|
|
2955
3049
|
setErrorMessage = _useState4[1];
|
|
2956
3050
|
var handleSubmit = /*#__PURE__*/function () {
|
|
2957
3051
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(event) {
|
|
2958
|
-
var _yield$stripe$confirm, error, response, setupIntent, addPaymentMethodResponse, _response, _yield$stripe$confirm2, _error,
|
|
3052
|
+
var _yield$stripe$confirm, error, response, setupIntent, addPaymentMethodResponse, _response, _response2, _yield$stripe$confirm2, _error, _response3, paymentIntent;
|
|
2959
3053
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
2960
3054
|
while (1) switch (_context.prev = _context.next) {
|
|
2961
3055
|
case 0:
|
|
@@ -2971,7 +3065,7 @@ var CheckoutForm = function CheckoutForm(_ref) {
|
|
|
2971
3065
|
return _context.abrupt("return");
|
|
2972
3066
|
case 4:
|
|
2973
3067
|
if (!(amount == null || currentUser != null)) {
|
|
2974
|
-
_context.next =
|
|
3068
|
+
_context.next = 54;
|
|
2975
3069
|
break;
|
|
2976
3070
|
}
|
|
2977
3071
|
_context.next = 7;
|
|
@@ -2995,7 +3089,7 @@ var CheckoutForm = function CheckoutForm(_ref) {
|
|
|
2995
3089
|
// details incomplete)
|
|
2996
3090
|
setIsPaymentProcessing(false);
|
|
2997
3091
|
setErrorMessage(error.message);
|
|
2998
|
-
_context.next =
|
|
3092
|
+
_context.next = 52;
|
|
2999
3093
|
break;
|
|
3000
3094
|
case 14:
|
|
3001
3095
|
// Your customer will be redirected to your `return_url`. For some payment
|
|
@@ -3009,7 +3103,7 @@ var CheckoutForm = function CheckoutForm(_ref) {
|
|
|
3009
3103
|
response = _context.sent;
|
|
3010
3104
|
setupIntent = response.setupIntent;
|
|
3011
3105
|
_context.t0 = setupIntent.status;
|
|
3012
|
-
_context.next = _context.t0 === 'succeeded' ? 22 : _context.t0 === 'processing' ?
|
|
3106
|
+
_context.next = _context.t0 === 'succeeded' ? 22 : _context.t0 === 'processing' ? 43 : _context.t0 === 'requires_payment_method' ? 46 : 49;
|
|
3013
3107
|
break;
|
|
3014
3108
|
case 22:
|
|
3015
3109
|
_context.next = 24;
|
|
@@ -3021,51 +3115,70 @@ var CheckoutForm = function CheckoutForm(_ref) {
|
|
|
3021
3115
|
case 24:
|
|
3022
3116
|
addPaymentMethodResponse = _context.sent;
|
|
3023
3117
|
if (!(addPaymentMethodResponse != null && addPaymentMethodResponse.status == 200)) {
|
|
3024
|
-
_context.next =
|
|
3118
|
+
_context.next = 41;
|
|
3025
3119
|
break;
|
|
3026
3120
|
}
|
|
3027
3121
|
onResponse("succeeded", setupIntent.id, setupIntent.payment_method);
|
|
3028
3122
|
if (!(amount != null)) {
|
|
3029
|
-
_context.next =
|
|
3123
|
+
_context.next = 39;
|
|
3124
|
+
break;
|
|
3125
|
+
}
|
|
3126
|
+
if (!(invoiceId != null)) {
|
|
3127
|
+
_context.next = 35;
|
|
3030
3128
|
break;
|
|
3031
3129
|
}
|
|
3032
|
-
_context.next =
|
|
3130
|
+
_context.next = 31;
|
|
3131
|
+
return apiService().post("/Invoices/PayInvoice", {
|
|
3132
|
+
invoiceId: invoiceId,
|
|
3133
|
+
walletPaymentMethodId: addPaymentMethodResponse.data
|
|
3134
|
+
});
|
|
3135
|
+
case 31:
|
|
3136
|
+
_response = _context.sent;
|
|
3137
|
+
if (_response != null && _response.status == 200) {
|
|
3138
|
+
onResponse("paid", null);
|
|
3139
|
+
} else {
|
|
3140
|
+
onResponse("failed", null);
|
|
3141
|
+
}
|
|
3142
|
+
_context.next = 39;
|
|
3143
|
+
break;
|
|
3144
|
+
case 35:
|
|
3145
|
+
_context.next = 37;
|
|
3033
3146
|
return apiService().post("/Payment/Charge", {
|
|
3034
3147
|
paymentMethodType: paymentMethodType,
|
|
3035
3148
|
walletPaymentMethodId: addPaymentMethodResponse.data,
|
|
3036
3149
|
amount: amount
|
|
3037
3150
|
});
|
|
3038
|
-
case
|
|
3039
|
-
|
|
3040
|
-
if (
|
|
3041
|
-
onResponse("paid",
|
|
3151
|
+
case 37:
|
|
3152
|
+
_response2 = _context.sent;
|
|
3153
|
+
if (_response2 != null && _response2.status == 200) {
|
|
3154
|
+
onResponse("paid", _response2.data.stripePaymentIntentId);
|
|
3042
3155
|
} else {
|
|
3043
3156
|
onResponse("failed", null);
|
|
3044
3157
|
}
|
|
3045
|
-
case
|
|
3046
|
-
_context.next =
|
|
3158
|
+
case 39:
|
|
3159
|
+
_context.next = 42;
|
|
3047
3160
|
break;
|
|
3048
|
-
case
|
|
3161
|
+
case 41:
|
|
3049
3162
|
onResponse("failed", null);
|
|
3050
|
-
case
|
|
3051
|
-
return _context.abrupt("break",
|
|
3052
|
-
case
|
|
3163
|
+
case 42:
|
|
3164
|
+
return _context.abrupt("break", 52);
|
|
3165
|
+
case 43:
|
|
3053
3166
|
onResponse("processing", setupIntent.id, setupIntent.payment_method);
|
|
3054
3167
|
setIsPaymentProcessing(false);
|
|
3055
|
-
return _context.abrupt("break",
|
|
3056
|
-
case
|
|
3168
|
+
return _context.abrupt("break", 52);
|
|
3169
|
+
case 46:
|
|
3057
3170
|
onResponse("requires_payment_method", null);
|
|
3058
3171
|
setIsPaymentProcessing(false);
|
|
3059
|
-
return _context.abrupt("break",
|
|
3060
|
-
case
|
|
3172
|
+
return _context.abrupt("break", 52);
|
|
3173
|
+
case 49:
|
|
3061
3174
|
onResponse("failed", null);
|
|
3062
3175
|
setIsPaymentProcessing(false);
|
|
3063
|
-
return _context.abrupt("break",
|
|
3064
|
-
case
|
|
3065
|
-
_context.next =
|
|
3176
|
+
return _context.abrupt("break", 52);
|
|
3177
|
+
case 52:
|
|
3178
|
+
_context.next = 88;
|
|
3066
3179
|
break;
|
|
3067
|
-
case
|
|
3068
|
-
_context.next =
|
|
3180
|
+
case 54:
|
|
3181
|
+
_context.next = 56;
|
|
3069
3182
|
return stripe.confirmPayment({
|
|
3070
3183
|
//`Elements` instance that was used to create the Payment Element
|
|
3071
3184
|
elements: elements,
|
|
@@ -3074,11 +3187,11 @@ var CheckoutForm = function CheckoutForm(_ref) {
|
|
|
3074
3187
|
return_url: process.env.websiteBaseUri + '/confirmPayment?redirectUrl=' + encodeURIComponent(window.location.search)
|
|
3075
3188
|
}
|
|
3076
3189
|
});
|
|
3077
|
-
case
|
|
3190
|
+
case 56:
|
|
3078
3191
|
_yield$stripe$confirm2 = _context.sent;
|
|
3079
3192
|
_error = _yield$stripe$confirm2.error;
|
|
3080
3193
|
if (!_error) {
|
|
3081
|
-
_context.next =
|
|
3194
|
+
_context.next = 63;
|
|
3082
3195
|
break;
|
|
3083
3196
|
}
|
|
3084
3197
|
// This point will only be reached if there is an immediate error when
|
|
@@ -3086,50 +3199,50 @@ var CheckoutForm = function CheckoutForm(_ref) {
|
|
|
3086
3199
|
// details incomplete)
|
|
3087
3200
|
setIsPaymentProcessing(false);
|
|
3088
3201
|
setErrorMessage(_error.message);
|
|
3089
|
-
_context.next =
|
|
3202
|
+
_context.next = 88;
|
|
3090
3203
|
break;
|
|
3091
|
-
case
|
|
3204
|
+
case 63:
|
|
3092
3205
|
// Your customer will be redirected to your `return_url`. For some payment
|
|
3093
3206
|
// methods like iDEAL, your customer will be redirected to an intermediate
|
|
3094
3207
|
// site first to authorize the payment, then redirected to the `return_url`.
|
|
3095
|
-
|
|
3208
|
+
_response3 = null;
|
|
3096
3209
|
if (!(amount == null)) {
|
|
3097
|
-
_context.next =
|
|
3210
|
+
_context.next = 70;
|
|
3098
3211
|
break;
|
|
3099
3212
|
}
|
|
3100
|
-
_context.next =
|
|
3213
|
+
_context.next = 67;
|
|
3101
3214
|
return stripe.retrieveSetupIntent(clientSecret);
|
|
3102
|
-
case
|
|
3103
|
-
|
|
3104
|
-
_context.next =
|
|
3215
|
+
case 67:
|
|
3216
|
+
_response3 = _context.sent;
|
|
3217
|
+
_context.next = 73;
|
|
3105
3218
|
break;
|
|
3106
|
-
case
|
|
3107
|
-
_context.next =
|
|
3219
|
+
case 70:
|
|
3220
|
+
_context.next = 72;
|
|
3108
3221
|
return stripe.retrievePaymentIntent(clientSecret);
|
|
3109
|
-
case
|
|
3110
|
-
|
|
3111
|
-
case
|
|
3112
|
-
paymentIntent =
|
|
3222
|
+
case 72:
|
|
3223
|
+
_response3 = _context.sent;
|
|
3224
|
+
case 73:
|
|
3225
|
+
paymentIntent = _response3.paymentIntent;
|
|
3113
3226
|
_context.t1 = paymentIntent.status;
|
|
3114
|
-
_context.next = _context.t1 === 'succeeded' ?
|
|
3227
|
+
_context.next = _context.t1 === 'succeeded' ? 77 : _context.t1 === 'processing' ? 79 : _context.t1 === 'requires_payment_method' ? 82 : 85;
|
|
3115
3228
|
break;
|
|
3116
|
-
case
|
|
3229
|
+
case 77:
|
|
3117
3230
|
// need to store the payment intent with the customer if they are logged in... currentUser
|
|
3118
3231
|
onResponse("succeeded", paymentIntent.id);
|
|
3119
|
-
return _context.abrupt("break",
|
|
3120
|
-
case
|
|
3232
|
+
return _context.abrupt("break", 88);
|
|
3233
|
+
case 79:
|
|
3121
3234
|
onResponse("processing", paymentIntent.id);
|
|
3122
3235
|
setIsPaymentProcessing(false);
|
|
3123
|
-
return _context.abrupt("break",
|
|
3124
|
-
case
|
|
3236
|
+
return _context.abrupt("break", 88);
|
|
3237
|
+
case 82:
|
|
3125
3238
|
onResponse("requires_payment_method", null);
|
|
3126
3239
|
setIsPaymentProcessing(false);
|
|
3127
|
-
return _context.abrupt("break",
|
|
3128
|
-
case
|
|
3240
|
+
return _context.abrupt("break", 88);
|
|
3241
|
+
case 85:
|
|
3129
3242
|
onResponse("failed", null);
|
|
3130
3243
|
setIsPaymentProcessing(false);
|
|
3131
|
-
return _context.abrupt("break",
|
|
3132
|
-
case
|
|
3244
|
+
return _context.abrupt("break", 88);
|
|
3245
|
+
case 88:
|
|
3133
3246
|
case "end":
|
|
3134
3247
|
return _context.stop();
|
|
3135
3248
|
}
|
|
@@ -3404,6 +3517,7 @@ function StripePayment(_ref3) {
|
|
|
3404
3517
|
options: options
|
|
3405
3518
|
}, /*#__PURE__*/_react["default"].createElement(CheckoutForm, {
|
|
3406
3519
|
payButtonText: payButtonText,
|
|
3520
|
+
invoiceId: invoiceId,
|
|
3407
3521
|
clientSecret: options != null ? options.clientSecret : null,
|
|
3408
3522
|
onResponse: onResponse,
|
|
3409
3523
|
paymentMethodType: paymentMethodType,
|
|
@@ -3457,7 +3571,7 @@ function StripePayment(_ref3) {
|
|
|
3457
3571
|
marginTop: 2
|
|
3458
3572
|
},
|
|
3459
3573
|
onClick: /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
3460
|
-
var response,
|
|
3574
|
+
var response, _response4;
|
|
3461
3575
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
3462
3576
|
while (1) switch (_context3.prev = _context3.next) {
|
|
3463
3577
|
case 0:
|
|
@@ -3485,9 +3599,9 @@ function StripePayment(_ref3) {
|
|
|
3485
3599
|
amount: amount
|
|
3486
3600
|
});
|
|
3487
3601
|
case 9:
|
|
3488
|
-
|
|
3489
|
-
if (
|
|
3490
|
-
onResponse("paid",
|
|
3602
|
+
_response4 = _context3.sent;
|
|
3603
|
+
if (_response4 != null && _response4.status == 200) {
|
|
3604
|
+
onResponse("paid", _response4.data.stripePaymentIntentId);
|
|
3491
3605
|
}
|
|
3492
3606
|
case 11:
|
|
3493
3607
|
case "end":
|
|
@@ -3505,6 +3619,7 @@ function StripePayment(_ref3) {
|
|
|
3505
3619
|
options: options
|
|
3506
3620
|
}, /*#__PURE__*/_react["default"].createElement(CheckoutForm, {
|
|
3507
3621
|
payButtonText: payButtonText,
|
|
3622
|
+
invoiceId: invoiceId,
|
|
3508
3623
|
clientSecret: options != null ? options.clientSecret : null,
|
|
3509
3624
|
onResponse: onResponse,
|
|
3510
3625
|
paymentMethodType: paymentMethodType,
|
package/package.json
CHANGED
|
@@ -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
|
-
|
|
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,28 @@ export function OEMEditor({loadedUser, notification, companyId = null}) {
|
|
|
47
86
|
setFonts(response.data);
|
|
48
87
|
}
|
|
49
88
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
if (
|
|
89
|
+
await loadDNSFields();
|
|
90
|
+
|
|
91
|
+
if (showAllDomains)
|
|
53
92
|
{
|
|
54
|
-
|
|
93
|
+
let response = await apiService().get("/WhiteLabel/GetAllDomains");
|
|
94
|
+
if (response != null && response.status == 200)
|
|
95
|
+
{
|
|
96
|
+
setOEMDomainList(response.data);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
else
|
|
100
|
+
{
|
|
101
|
+
let response = await apiService().get("/WhiteLabel/GetAllDomainsUser");
|
|
102
|
+
if (response != null && response.status == 200)
|
|
103
|
+
{
|
|
104
|
+
setOEMDomainList(response.data);
|
|
105
|
+
|
|
106
|
+
if (response.data.length > 0)
|
|
107
|
+
{
|
|
108
|
+
setOEMDomain(response.data[0].name);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
55
111
|
}
|
|
56
112
|
|
|
57
113
|
}
|
|
@@ -105,10 +161,9 @@ export function OEMEditor({loadedUser, notification, companyId = null}) {
|
|
|
105
161
|
// //console.log("here is the monaco instance:", monaco);
|
|
106
162
|
// }
|
|
107
163
|
|
|
108
|
-
|
|
109
|
-
setBaseUri(baseUri);
|
|
164
|
+
setData(null);
|
|
110
165
|
|
|
111
|
-
let response = await apiService().get("/WhiteLabel/GetEditorData?domain=" +
|
|
166
|
+
let response = await apiService().get("/WhiteLabel/GetEditorData?domain=" + oEMDomain + (companyId != null ? ("&companyId=" + companyId) : ""));
|
|
112
167
|
if (response.status == 200)
|
|
113
168
|
{
|
|
114
169
|
setData(response.data);
|
|
@@ -118,7 +173,7 @@ export function OEMEditor({loadedUser, notification, companyId = null}) {
|
|
|
118
173
|
}
|
|
119
174
|
fetchData();
|
|
120
175
|
|
|
121
|
-
}, [monaco]);
|
|
176
|
+
}, [monaco, oEMDomain]);
|
|
122
177
|
|
|
123
178
|
return (
|
|
124
179
|
<>
|
|
@@ -127,8 +182,30 @@ export function OEMEditor({loadedUser, notification, companyId = null}) {
|
|
|
127
182
|
{(selectedFont != null && fontUri == null) &&
|
|
128
183
|
<link href={"https://fonts.googleapis.com/css2?family=" + selectedFont} rel="stylesheet"></link>
|
|
129
184
|
}
|
|
185
|
+
|
|
186
|
+
{oEMDomain != null &&
|
|
187
|
+
<Box sx={{paddingTop:6}}>
|
|
188
|
+
<FormControl fullWidth>
|
|
189
|
+
<InputLabel id="demo-simple-select-label">Website Domain</InputLabel>
|
|
190
|
+
<Select
|
|
191
|
+
labelId="demo-simple-select-label"
|
|
192
|
+
id="demo-simple-select"
|
|
193
|
+
defaultValue={oEMDomain}
|
|
194
|
+
label="Website Domain"
|
|
195
|
+
onChange={(val) => {
|
|
196
|
+
setOEMDomain(val.target.value)
|
|
197
|
+
}}>
|
|
198
|
+
{oEMDomainList.map((dns) => {
|
|
199
|
+
return (
|
|
200
|
+
<MenuItem value={dns.name}>{dns.name}</MenuItem>
|
|
201
|
+
)
|
|
202
|
+
})}
|
|
203
|
+
</Select>
|
|
204
|
+
</FormControl>
|
|
205
|
+
</Box>
|
|
206
|
+
}
|
|
130
207
|
|
|
131
|
-
<Box sx={{ borderBottom: 1, borderColor: 'divider' }}>
|
|
208
|
+
<Box sx={{ borderBottom: 1, borderColor: 'divider', paddingTop:2 }}>
|
|
132
209
|
<Tabs value={value} onChange={handleChange} aria-label="basic tabs example">
|
|
133
210
|
<Tab label="General" />
|
|
134
211
|
<Tab label="Fonts" />
|
|
@@ -141,134 +218,132 @@ export function OEMEditor({loadedUser, notification, companyId = null}) {
|
|
|
141
218
|
<Box sx={{padding:2}}>
|
|
142
219
|
{value == 0 &&
|
|
143
220
|
<Box>
|
|
144
|
-
|
|
145
|
-
<Box
|
|
146
|
-
|
|
147
|
-
{data.appIconUrl == null &&
|
|
148
|
-
<Image src={"/DefaultNoImage.svg"} width={200} height={200} />
|
|
149
|
-
}
|
|
221
|
+
{data != null &&
|
|
222
|
+
<Box>
|
|
223
|
+
<Box sx={{paddingBottom:4}}>
|
|
150
224
|
|
|
151
|
-
|
|
152
|
-
|
|
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>
|
|
225
|
+
{(data != null && data.appIconUrl != null && data.appIconUrl.trim() != "") ?
|
|
226
|
+
<Image src={data.appIconUrl} width={200} height={200} /> : <Image src={"/DefaultNoImage.svg"} width={200} height={200} />
|
|
227
|
+
}
|
|
166
228
|
|
|
229
|
+
<FileUploader url={"/WhiteLabel/UploadAppIcon"} accept={".jpg,.jpeg,.png,.gif"} params={{
|
|
230
|
+
domain: stateBaseUri
|
|
231
|
+
}} multiple={true} variant='custom' onUploadCompleted={() => {
|
|
232
|
+
window.location.reload();
|
|
233
|
+
}}>
|
|
167
234
|
|
|
235
|
+
<Button color="primary" variant="contained" startIcon={<PublishRoundedIcon/>}>Upload App Icon</Button>
|
|
168
236
|
|
|
169
|
-
|
|
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}>
|
|
237
|
+
</FileUploader>
|
|
178
238
|
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
await apiService().post("/WhiteLabel/SetFieldValue", {
|
|
182
|
-
id: dnsField.id,
|
|
183
|
-
fieldId: dnsField.fieldId,
|
|
184
|
-
value: hex
|
|
185
|
-
});
|
|
186
|
-
|
|
187
|
-
notification(dnsField.name + " Saved");
|
|
239
|
+
</Box>
|
|
188
240
|
|
|
189
|
-
|
|
241
|
+
{dnsFields != null && dnsFields.map((dnsField, index) => {
|
|
242
|
+
|
|
243
|
+
return (
|
|
244
|
+
<Box key={index}>
|
|
245
|
+
<Grid container spacing={2}>
|
|
246
|
+
<Grid item xs={3}>
|
|
247
|
+
{dnsField.name}
|
|
248
|
+
</Grid>
|
|
249
|
+
<Grid item xs={9}>
|
|
250
|
+
|
|
251
|
+
<ColorPicker name={dnsField.name} defaultColor={dnsField.value} onColorChanged={async (name, hex) => {
|
|
252
|
+
|
|
253
|
+
await apiService().post("/WhiteLabel/SetFieldValue", {
|
|
254
|
+
id: dnsField.id,
|
|
255
|
+
fieldId: dnsField.fieldId,
|
|
256
|
+
value: hex
|
|
257
|
+
});
|
|
258
|
+
|
|
259
|
+
notification(dnsField.name + " Saved");
|
|
260
|
+
|
|
261
|
+
}} />
|
|
262
|
+
</Grid>
|
|
190
263
|
</Grid>
|
|
191
|
-
</
|
|
192
|
-
|
|
193
|
-
)
|
|
264
|
+
</Box>
|
|
265
|
+
)
|
|
194
266
|
|
|
195
|
-
|
|
267
|
+
|
|
196
268
|
|
|
197
|
-
|
|
269
|
+
})}
|
|
270
|
+
</Box>
|
|
271
|
+
}
|
|
198
272
|
</Box>
|
|
199
273
|
}
|
|
200
274
|
|
|
201
275
|
{value == 1 &&
|
|
202
276
|
<Box value={value} index={1}>
|
|
277
|
+
{data != null &&
|
|
278
|
+
<Box>
|
|
279
|
+
<Grid container spacing={2}>
|
|
280
|
+
<Grid item xs={6}>
|
|
281
|
+
|
|
282
|
+
{loadedUser == true &&
|
|
283
|
+
|
|
284
|
+
<Box>
|
|
285
|
+
<DataGrid
|
|
286
|
+
rows={fonts}
|
|
287
|
+
columns={columns}
|
|
288
|
+
sx={{height:"80vh", width:"100%"}}
|
|
289
|
+
pagination
|
|
290
|
+
disableSelectionOnClick={true}
|
|
291
|
+
onPaginationModelChange={setPaginationModel}
|
|
292
|
+
paginationModel={paginationModel}
|
|
293
|
+
//pageSizeOptions={[5]}
|
|
294
|
+
// rowCount={100}
|
|
295
|
+
// rowSelectionModel={selectedFont}
|
|
296
|
+
onRowClick={async (params) => {
|
|
297
|
+
|
|
298
|
+
let response = await apiService().post("/WhiteLabel/SetFont", {
|
|
299
|
+
companyId: companyId,
|
|
300
|
+
domain: oEMDomain,
|
|
301
|
+
value: params.row.label
|
|
302
|
+
});
|
|
303
|
+
if (response != null && response.status == 200)
|
|
304
|
+
{
|
|
305
|
+
setSelectedFont(params.row.label);
|
|
306
|
+
setFontUri(null);
|
|
307
|
+
notification("Font saved!");
|
|
308
|
+
}
|
|
309
|
+
}}
|
|
310
|
+
/>
|
|
311
|
+
</Box>
|
|
312
|
+
}
|
|
203
313
|
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
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> <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
|
|
314
|
+
|
|
315
|
+
</Grid>
|
|
316
|
+
<Grid item xs={6} >
|
|
317
|
+
|
|
318
|
+
<FileUploader url={"/WhiteLabel/UploadCustomFont"} accept={".otf,.ttf,.woff"} params={{
|
|
319
|
+
domain: stateBaseUri
|
|
320
|
+
}} multiple={true} variant='custom' onUploadCompleted={() => {
|
|
321
|
+
window.location.reload();
|
|
322
|
+
}}>
|
|
323
|
+
|
|
324
|
+
<Button color="primary" variant="contained" fullWidth={true} sx={{height:50}} startIcon={<PublishRoundedIcon/>}><Box>Upload Font</Box> <Box sx={{textAlign:"center"}}><small>(.OTF, .TTF, OR .WOFF)</small></Box></Button>
|
|
325
|
+
|
|
326
|
+
</FileUploader>
|
|
327
|
+
|
|
328
|
+
|
|
329
|
+
<Box sx={{marginTop:4}}>Font Selected:</Box>
|
|
330
|
+
<Box sx={{marginBottom:2, fontWeight:"bold", fontSize:20}}> {selectedFont}</Box>
|
|
331
|
+
<hr />
|
|
332
|
+
<Box sx={{fontFamily: selectedFont}}>
|
|
333
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed ut ultricies odio. Nunc ut quam turpis. In hac habitasse platea dictumst.
|
|
334
|
+
Suspendisse potenti. Nullam malesuada, purus id sagittis vestibulum, massa tellus gravida elit, vitae ultrices tortor nulla ac nunc.
|
|
335
|
+
Aenean tempus semper est vel convallis. Sed feugiat, risus eu tincidunt eleifend, purus metus vulputate nulla, et condimentum sapien erat in nisi.
|
|
336
|
+
Nunc non malesuada libero. Donec tempus tincidunt mi at vulputate. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae;
|
|
337
|
+
Suspendisse potenti. Etiam nec eleifend orci. Suspendisse in est vel nunc rhoncus bibendum vitae id felis.
|
|
338
|
+
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.
|
|
339
|
+
Aliquam erat volutpat. Quisque dignissim felis augue, at semper nisl posuere ut. Proin fringilla diam vitae faucibus finibus.
|
|
340
|
+
<br/><br/>
|
|
341
|
+
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
|
|
342
|
+
</Box>
|
|
343
|
+
</Grid>
|
|
344
|
+
</Grid>
|
|
268
345
|
</Box>
|
|
269
|
-
|
|
270
|
-
</Grid>
|
|
271
|
-
|
|
346
|
+
}
|
|
272
347
|
</Box>
|
|
273
348
|
}
|
|
274
349
|
|
|
@@ -283,10 +358,9 @@ export function OEMEditor({loadedUser, notification, companyId = null}) {
|
|
|
283
358
|
<Grid item xs={6} sx={{textAlign:"right"}}>
|
|
284
359
|
<Button startIcon={<CheckIcon/>} sx={{marginTop:4}} variant="contained" onClick={async () => {
|
|
285
360
|
|
|
286
|
-
var baseUri = GetBaseUrl();
|
|
287
361
|
let response = await apiService().post("/WhiteLabel/SetGlobalCSS", {
|
|
288
362
|
companyId: companyId,
|
|
289
|
-
domain:
|
|
363
|
+
domain: oEMDomain,
|
|
290
364
|
value: cssEditorRef.current.getValue()
|
|
291
365
|
});
|
|
292
366
|
if (response != null && response.status == 200)
|
|
@@ -306,10 +380,9 @@ export function OEMEditor({loadedUser, notification, companyId = null}) {
|
|
|
306
380
|
onMount={handleCSSEditorDidMount}
|
|
307
381
|
defaultLanguage="css"
|
|
308
382
|
theme="vs-dark"
|
|
309
|
-
defaultValue={data.prettyCSS == null ? "" : data.prettyCSS}
|
|
383
|
+
defaultValue={(data == null || data.prettyCSS == null) ? "" : data.prettyCSS}
|
|
310
384
|
/>
|
|
311
385
|
}
|
|
312
|
-
{data.prettyCSS}
|
|
313
386
|
</Box>
|
|
314
387
|
|
|
315
388
|
</Box>
|
|
@@ -327,10 +400,9 @@ export function OEMEditor({loadedUser, notification, companyId = null}) {
|
|
|
327
400
|
<Grid item xs={6} sx={{textAlign:"right"}}>
|
|
328
401
|
<Button startIcon={<CheckIcon/>} sx={{marginTop:4}} variant="contained" onClick={async () => {
|
|
329
402
|
|
|
330
|
-
var baseUri = GetBaseUrl();
|
|
331
403
|
let response = await apiService().post("/WhiteLabel/SetGlobalHTML", {
|
|
332
404
|
companyId: companyId,
|
|
333
|
-
domain:
|
|
405
|
+
domain: oEMDomain,
|
|
334
406
|
value: htmlEditorRef.current.getValue()
|
|
335
407
|
});
|
|
336
408
|
|
|
@@ -344,13 +416,15 @@ export function OEMEditor({loadedUser, notification, companyId = null}) {
|
|
|
344
416
|
</Grid>
|
|
345
417
|
|
|
346
418
|
<Box sx={{paddingTop:1}}>
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
419
|
+
{data != null &&
|
|
420
|
+
<Editor
|
|
421
|
+
height="70vh"
|
|
422
|
+
onMount={handleHtmlEditorDidMount}
|
|
423
|
+
defaultLanguage="html"
|
|
424
|
+
theme="vs-dark"
|
|
425
|
+
defaultValue={(data == null || data.prettyHTML == null) ? "" : data.prettyHTML}
|
|
426
|
+
/>
|
|
427
|
+
}
|
|
354
428
|
</Box>
|
|
355
429
|
|
|
356
430
|
|
|
@@ -5,7 +5,7 @@ import PaymentRoundedIcon from '@mui/icons-material/PaymentRounded';
|
|
|
5
5
|
import Typography from '@mui/material/Typography';
|
|
6
6
|
import { Select, Grid, MenuItem, Box, Button, Tab, Tabs, TextField } from '@mui/material';
|
|
7
7
|
|
|
8
|
-
const CheckoutForm = ({payButtonText, clientSecret, currentUser, paymentMethodType, walletId, onResponse, amount}) => {
|
|
8
|
+
const CheckoutForm = ({payButtonText, invoiceId, clientSecret, currentUser, paymentMethodType, walletId, onResponse, amount}) => {
|
|
9
9
|
|
|
10
10
|
const [isPaymentProcessing, setIsPaymentProcessing] = useState(false);
|
|
11
11
|
|
|
@@ -79,21 +79,38 @@ import { Select, Grid, MenuItem, Box, Button, Tab, Tabs, TextField } from '@mui/
|
|
|
79
79
|
|
|
80
80
|
if (amount != null)
|
|
81
81
|
{
|
|
82
|
-
|
|
83
|
-
let response = await apiService().post("/Payment/Charge", {
|
|
84
|
-
|
|
85
|
-
paymentMethodType: paymentMethodType,
|
|
86
|
-
walletPaymentMethodId: addPaymentMethodResponse.data,
|
|
87
|
-
amount: amount
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
if (response != null && response.status == 200)
|
|
82
|
+
if (invoiceId != null)
|
|
91
83
|
{
|
|
92
|
-
|
|
84
|
+
let response = await apiService().post("/Invoices/PayInvoice", {
|
|
85
|
+
invoiceId: invoiceId,
|
|
86
|
+
walletPaymentMethodId: addPaymentMethodResponse.data
|
|
87
|
+
});
|
|
88
|
+
if (response != null && response.status == 200)
|
|
89
|
+
{
|
|
90
|
+
onResponse("paid", null);
|
|
91
|
+
}
|
|
92
|
+
else
|
|
93
|
+
{
|
|
94
|
+
onResponse("failed", null);
|
|
95
|
+
}
|
|
93
96
|
}
|
|
94
97
|
else
|
|
95
98
|
{
|
|
96
|
-
|
|
99
|
+
// charge the customer
|
|
100
|
+
let response = await apiService().post("/Payment/Charge", {
|
|
101
|
+
paymentMethodType: paymentMethodType,
|
|
102
|
+
walletPaymentMethodId: addPaymentMethodResponse.data,
|
|
103
|
+
amount: amount
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
if (response != null && response.status == 200)
|
|
107
|
+
{
|
|
108
|
+
onResponse("paid", response.data.stripePaymentIntentId);
|
|
109
|
+
}
|
|
110
|
+
else
|
|
111
|
+
{
|
|
112
|
+
onResponse("failed", null);
|
|
113
|
+
}
|
|
97
114
|
}
|
|
98
115
|
}
|
|
99
116
|
|
|
@@ -341,7 +358,7 @@ import { Select, Grid, MenuItem, Box, Button, Tab, Tabs, TextField } from '@mui/
|
|
|
341
358
|
|
|
342
359
|
{(options != null && process.env.stripePublicKey != null) &&
|
|
343
360
|
<Elements stripe={stripePromise} options={options}>
|
|
344
|
-
<CheckoutForm payButtonText={payButtonText} clientSecret={options != null ? options.clientSecret : null} onResponse={onResponse} paymentMethodType={paymentMethodType} currentUser={currentUser} walletId={walletId} amount={amount} />
|
|
361
|
+
<CheckoutForm payButtonText={payButtonText} invoiceId={invoiceId} clientSecret={options != null ? options.clientSecret : null} onResponse={onResponse} paymentMethodType={paymentMethodType} currentUser={currentUser} walletId={walletId} amount={amount} />
|
|
345
362
|
</Elements>
|
|
346
363
|
}
|
|
347
364
|
</Box>
|
|
@@ -417,7 +434,7 @@ import { Select, Grid, MenuItem, Box, Button, Tab, Tabs, TextField } from '@mui/
|
|
|
417
434
|
|
|
418
435
|
{(options != null && process.env.stripePublicKey != null) &&
|
|
419
436
|
<Elements stripe={stripePromise} options={options}>
|
|
420
|
-
<CheckoutForm payButtonText={payButtonText} clientSecret={options != null ? options.clientSecret : null} onResponse={onResponse} paymentMethodType={paymentMethodType} walletId={walletId} currentUser={currentUser} amount={amount} />
|
|
437
|
+
<CheckoutForm payButtonText={payButtonText} invoiceId={invoiceId} clientSecret={options != null ? options.clientSecret : null} onResponse={onResponse} paymentMethodType={paymentMethodType} walletId={walletId} currentUser={currentUser} amount={amount} />
|
|
421
438
|
</Elements>
|
|
422
439
|
}
|
|
423
440
|
</Box>
|